kivio

kivio_grid_data.cpp

00001 /*
00002  * Kivio - Visual Modelling and Flowcharting
00003  * Copyright (C) 2000-2001 theKompany.com & Dave Marotti
00004  *
00005  * This program is free software; you can redistribute it and/or
00006  * modify it under the terms of the GNU General Public License
00007  * as published by the Free Software Foundation; either version 2
00008  * of the License, or (at your option) any later version.
00009  *
00010  * This program is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  * GNU General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU General Public License
00016  * along with this program; if not, write to the Free Software
00017  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
00018  */
00019 
00020 #include "kivio_grid_data.h"
00021 #include "kivioglobal.h"
00022 #include "kivio_common.h"
00023 #include <qdom.h>
00024 
00025 KivioGridData::KivioGridData()
00026 {
00027   color = QColor(200, 200, 200);
00028   freq = KoSize(10.0, 10.0);
00029   snap = KoSize(10.0, 10.0);
00030   isSnap = true;
00031   isShow = true;
00032 }
00033 
00034 KivioGridData::~KivioGridData()
00035 {
00036 }
00037 
00038 void KivioGridData::save(QDomElement& element, const QString& name)
00039 {
00040   Kivio::saveSize(element, name + "Freg", freq);
00041   Kivio::saveSize(element, name + "Snap", snap);
00042   XmlWriteColor(element, name + "Color", color);
00043   element.setAttribute(name + "IsSnap", (int)isSnap);
00044   element.setAttribute(name + "IsShow", (int)isShow);
00045 }
00046 
00047 void KivioGridData::load(const QDomElement& element, const QString& name)
00048 {
00049   KoSize sdef;
00050   sdef = KoSize(10.0, 10.0);
00051   freq = Kivio::loadSize(element, name + "Freg", sdef);
00052   snap = Kivio::loadSize(element, name + "Snap", sdef);
00053 
00054   QColor def(QColor(228, 228, 228));
00055   color = XmlReadColor(element, name + "Color", def);
00056 
00057   isSnap = (bool)element.attribute(name + "IsSnap", "1").toInt();
00058   isShow = (bool)element.attribute(name + "IsShow", "1").toInt();
00059 }
KDE Home | KDE Accessibility Home | Description of Access Keys