kivio

kivioaligndialog.cpp
1/* This file is part of the KDE project
2 Copyright (C) 2003 Peter Simonsson <psn@linux.se>
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301, USA.
18*/
19
20#include "kivioaligndialog.h"
21#include "kivioaligndialog.moc"
22
23#include <tqradiobutton.h>
24#include <tqcheckbox.h>
25
26#include <tdelocale.h>
27
28#include "kivio_page.h"
29#include "aligndialog.h"
30
31KivioAlignDialog::KivioAlignDialog(TQWidget* parent, const char* name)
32 : KDialogBase(parent, name, true, i18n("Align & Distribute"), Ok|Cancel, Ok)
33{
34 m_view = new KivioAlignDialogWidget(this);
35 setMainWidget(m_view);
36}
37
38AlignData KivioAlignDialog::align()
39{
40 AlignData ad;
41
42 ad.centerOfPage = m_view->aCenterPage->isChecked();
43 ad.v = AlignData::None;
44
45 if (m_view->avtop->isChecked())
46 ad.v = AlignData::Top;
47 if (m_view->avcenter->isChecked())
48 ad.v = AlignData::Center;
49 if (m_view->avbottom->isChecked())
50 ad.v = AlignData::Bottom;
51
52 ad.h = AlignData::None;
53 if (m_view->ahleft->isChecked())
54 ad.h = AlignData::Left;
55 if (m_view->ahcenter->isChecked())
56 ad.h = AlignData::Center;
57 if (m_view->ahright->isChecked())
58 ad.h = AlignData::Right;
59
60 return ad;
61}
62
63DistributeData KivioAlignDialog::distribute()
64{
65 DistributeData dd;
66
67 if (m_view->dselection->isChecked())
68 dd.extent = DistributeData::Selection;
69 if (m_view->dpage->isChecked())
70 dd.extent = DistributeData::Page;
71
72 dd.v = DistributeData::None;
73 if (m_view->dvtop->isChecked())
74 dd.v = DistributeData::Top;
75 if (m_view->dvcenter->isChecked())
76 dd.v = DistributeData::Center;
77 if (m_view->dvbottom->isChecked())
78 dd.v = DistributeData::Bottom;
79 if (m_view->dvspacing->isChecked())
80 dd.v = DistributeData::Spacing;
81
82 dd.h = DistributeData::None;
83 if (m_view->dhleft->isChecked())
84 dd.h = DistributeData::Left;
85 if (m_view->dhcenter->isChecked())
86 dd.h = DistributeData::Center;
87 if (m_view->dhright->isChecked())
88 dd.h = DistributeData::Right;
89 if (m_view->dhspacing->isChecked())
90 dd.h = DistributeData::Spacing;
91
92 return dd;
93}