kivio

kivio_grid_data.cpp
1/*
2 * Kivio - Visual Modelling and Flowcharting
3 * Copyright (C) 2000-2001 theKompany.com & Dave Marotti
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_grid_data.h"
21#include "kivioglobal.h"
22#include "kivio_common.h"
23#include <tqdom.h>
24
25KivioGridData::KivioGridData()
26{
27 color = TQColor(200, 200, 200);
28 freq = KoSize(10.0, 10.0);
29 snap = KoSize(10.0, 10.0);
30 isSnap = true;
31 isShow = true;
32}
33
34KivioGridData::~KivioGridData()
35{
36}
37
38void KivioGridData::save(TQDomElement& element, const TQString& name)
39{
40 Kivio::saveSize(element, name + "Freg", freq);
41 Kivio::saveSize(element, name + "Snap", snap);
42 XmlWriteColor(element, name + "Color", color);
43 element.setAttribute(name + "IsSnap", (int)isSnap);
44 element.setAttribute(name + "IsShow", (int)isShow);
45}
46
47void KivioGridData::load(const TQDomElement& element, const TQString& name)
48{
49 KoSize sdef;
50 sdef = KoSize(10.0, 10.0);
51 freq = Kivio::loadSize(element, name + "Freg", sdef);
52 snap = Kivio::loadSize(element, name + "Snap", sdef);
53
54 TQColor def(TQColor(228, 228, 228));
55 color = XmlReadColor(element, name + "Color", def);
56
57 isSnap = (bool)element.attribute(name + "IsSnap", "1").toInt();
58 isShow = (bool)element.attribute(name + "IsShow", "1").toInt();
59}