kivio

kivioaligndialog.cpp

00001 /* This file is part of the KDE project
00002    Copyright (C) 2003 Peter Simonsson <psn@linux.se>
00003 
00004    This library is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Library General Public
00006    License as published by the Free Software Foundation; either
00007    version 2 of the License, or (at your option) any later version.
00008 
00009    This library is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012    Library General Public License for more details.
00013 
00014    You should have received a copy of the GNU Library General Public License
00015    along with this library; see the file COPYING.LIB.  If not, write to
00016    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00017    Boston, MA 02110-1301, USA.
00018 */
00019 
00020 #include "kivioaligndialog.h"
00021 #include "kivioaligndialog.moc"
00022 
00023 #include <qradiobutton.h>
00024 #include <qcheckbox.h>
00025 
00026 #include <klocale.h>
00027 
00028 #include "kivio_page.h"
00029 #include "aligndialog.h"
00030 
00031 KivioAlignDialog::KivioAlignDialog(QWidget* parent, const char* name)
00032  : KDialogBase(parent, name, true, i18n("Align & Distribute"), Ok|Cancel, Ok)
00033 {
00034   m_view = new KivioAlignDialogWidget(this);
00035   setMainWidget(m_view);
00036 }
00037 
00038 AlignData KivioAlignDialog::align()
00039 {
00040   AlignData ad;
00041 
00042   ad.centerOfPage = m_view->aCenterPage->isChecked();
00043   ad.v = AlignData::None;
00044 
00045   if (m_view->avtop->isChecked())
00046     ad.v = AlignData::Top;
00047   if (m_view->avcenter->isChecked())
00048     ad.v = AlignData::Center;
00049   if (m_view->avbottom->isChecked())
00050     ad.v = AlignData::Bottom;
00051 
00052   ad.h = AlignData::None;
00053   if (m_view->ahleft->isChecked())
00054     ad.h = AlignData::Left;
00055   if (m_view->ahcenter->isChecked())
00056     ad.h = AlignData::Center;
00057   if (m_view->ahright->isChecked())
00058     ad.h = AlignData::Right;
00059 
00060   return ad;
00061 }
00062 
00063 DistributeData KivioAlignDialog::distribute()
00064 {
00065   DistributeData dd;
00066 
00067   if (m_view->dselection->isChecked())
00068     dd.extent = DistributeData::Selection;
00069   if (m_view->dpage->isChecked())
00070     dd.extent = DistributeData::Page;
00071 
00072   dd.v = DistributeData::None;
00073   if (m_view->dvtop->isChecked())
00074     dd.v = DistributeData::Top;
00075   if (m_view->dvcenter->isChecked())
00076     dd.v = DistributeData::Center;
00077   if (m_view->dvbottom->isChecked())
00078     dd.v = DistributeData::Bottom;
00079   if (m_view->dvspacing->isChecked())
00080     dd.v = DistributeData::Spacing;
00081 
00082   dd.h = DistributeData::None;
00083   if (m_view->dhleft->isChecked())
00084     dd.h = DistributeData::Left;
00085   if (m_view->dhcenter->isChecked())
00086     dd.h = DistributeData::Center;
00087   if (m_view->dhright->isChecked())
00088     dd.h = DistributeData::Right;
00089   if (m_view->dhspacing->isChecked())
00090     dd.h = DistributeData::Spacing;
00091 
00092   return dd;
00093 }
KDE Home | KDE Accessibility Home | Description of Access Keys