kivio_config.cpp
1/*
2 * Kivio - Visual Modelling and Flowcharting
3 * Copyright (C) 2004 Peter Simonsson
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 */
19
20#include "kivio_config.h"
21
22#include "kivioglobal.h"
23
24namespace Kivio {
25 Config::Config() : Settings()
26 {
27 }
28
29 KoPageLayout Config::defaultPageLayout()
30 {
31 KoPageLayout layout;
32
33 layout.format = KoPageFormat::formatFromString(Settings::format());
34 layout.orientation = Kivio::orientationFromString(Settings::orientation());
35 layout.ptTop = Settings::borderTop();
36 layout.ptBottom = Settings::borderBottom();
37 layout.ptLeft = Settings::borderLeft();
38 layout.ptRight = Settings::borderRight();
39 layout.ptWidth = Settings::width();
40 layout.ptHeight = Settings::height();
41
42 return layout;
43 }
44
45 void Config::setDefaultPageLayout(const KoPageLayout& layout)
46 {
47 Settings::setFormat(KoPageFormat::formatString(layout.format));
48 Settings::setOrientation(Kivio::orientationString(layout.orientation));
49 Settings::setBorderTop(layout.ptTop);
50 Settings::setBorderBottom(layout.ptBottom);
51 Settings::setBorderLeft(layout.ptLeft);
52 Settings::setBorderRight(layout.ptRight);
53 Settings::setWidth(layout.ptWidth);
54 Settings::setHeight(layout.ptHeight);
55 }
56
57 void Config::setGrid(const KivioGridData& /*grid*/)
58 {
59 }
60
61 KivioGridData Config::grid()
62 {
63 KivioGridData gd;
64 gd.color = Settings::gridColor();
65 gd.isShow = Settings::showGrid();
66 gd.isSnap = Settings::snapGrid();
67 gd.freq.setWidth(Settings::gridXSpacing());
68 gd.freq.setHeight(Settings::gridYSpacing());
69 gd.snap.setWidth(Settings::gridXSnap());
70 gd.snap.setHeight(Settings::gridYSnap());
71
72 return gd;
73 }
74}