kivio

kivio_config.cpp

00001 /*
00002  * Kivio - Visual Modelling and Flowcharting
00003  * Copyright (C) 2004 Peter Simonsson
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_config.h"
00021 
00022 #include "kivioglobal.h"
00023 
00024 namespace Kivio {
00025   Config::Config() : Settings()
00026   {
00027   }
00028 
00029   KoPageLayout Config::defaultPageLayout()
00030   {
00031     KoPageLayout layout;
00032     
00033     layout.format = KoPageFormat::formatFromString(Settings::format());
00034     layout.orientation = Kivio::orientationFromString(Settings::orientation());
00035     layout.ptTop = Settings::borderTop();
00036     layout.ptBottom = Settings::borderBottom();
00037     layout.ptLeft = Settings::borderLeft();
00038     layout.ptRight = Settings::borderRight();
00039     layout.ptWidth = Settings::width();
00040     layout.ptHeight = Settings::height();
00041     
00042     return layout;
00043   }
00044   
00045   void Config::setDefaultPageLayout(const KoPageLayout& layout)
00046   {
00047     Settings::setFormat(KoPageFormat::formatString(layout.format));
00048     Settings::setOrientation(Kivio::orientationString(layout.orientation));
00049     Settings::setBorderTop(layout.ptTop);
00050     Settings::setBorderBottom(layout.ptBottom);
00051     Settings::setBorderLeft(layout.ptLeft);
00052     Settings::setBorderRight(layout.ptRight);
00053     Settings::setWidth(layout.ptWidth);
00054     Settings::setHeight(layout.ptHeight);
00055   }
00056 
00057   void Config::setGrid(const KivioGridData& /*grid*/)
00058   {
00059   }
00060   
00061   KivioGridData Config::grid()
00062   {
00063     KivioGridData gd;
00064     gd.color = Settings::gridColor();
00065     gd.isShow = Settings::showGrid();
00066     gd.isSnap = Settings::snapGrid();
00067     gd.freq.setWidth(Settings::gridXSpacing());
00068     gd.freq.setHeight(Settings::gridYSpacing());
00069     gd.snap.setWidth(Settings::gridXSnap());
00070     gd.snap.setHeight(Settings::gridYSnap());
00071     
00072     return gd;
00073   }
00074 }
KDE Home | KDE Accessibility Home | Description of Access Keys