1 /* === S Y N F I G ========================================================= */
2 /*! \file dialogsettings.cpp
3 ** \brief Template File
5 ** $Id: dialogsettings.cpp,v 1.1.1.1 2005/01/07 03:34:36 darco Exp $
8 ** Copyright (c) 2002 Robert B. Quattlebaum Jr.
10 ** This software and associated documentation
11 ** are CONFIDENTIAL and PROPRIETARY property of
12 ** the above-mentioned copyright holder.
14 ** You may not copy, print, publish, or in any
15 ** other way distribute this software without
16 ** a prior written agreement with
17 ** the copyright holder.
20 /* ========================================================================= */
22 /* === H E A D E R S ======================================================= */
31 #include "dialogsettings.h"
32 #include <synfigapp/main.h>
36 /* === U S I N G =========================================================== */
40 using namespace synfig;
41 using namespace studio;
43 /* === M A C R O S ========================================================= */
45 /* === G L O B A L S ======================================================= */
47 /* === P R O C E D U R E S ================================================= */
49 /* === M E T H O D S ======================================================= */
51 DialogSettings::DialogSettings(Gtk::Window* window,const synfig::String& name):
55 synfigapp::Main::settings().add_domain(this,"window."+name);
58 DialogSettings::~DialogSettings()
60 synfigapp::Main::settings().remove_domain("window."+name);
64 DialogSettings::get_value(const synfig::String& key, synfig::String& value)const
68 if(!window->is_visible())return false;
69 int x,y; window->get_position(x,y);
70 value=strprintf("%d %d",x,y);
75 if(!window->is_visible())return false;
76 int x,y; window->get_size(x,y);
77 value=strprintf("%d %d",x,y);
82 int x,y; window->get_position(x,y);
83 value=strprintf("%d",x);
88 int x,y; window->get_position(x,y);
89 value=strprintf("%d",y);
94 int x,y; window->get_size(x,y);
95 value=strprintf("%d",x);
100 int x,y; window->get_size(x,y);
101 value=strprintf("%d",y);
106 value=window->is_visible()?"1":"0";
110 return synfigapp::Settings::get_value(key,value);
114 DialogSettings::set_value(const synfig::String& key,const synfig::String& value)
122 if(!strscanf(value,"%d %d",&x, &y))
130 if(!strscanf(value,"%d %d",&x, &y))
132 window->set_default_size(x,y);
137 int x,y; window->get_position(x,y);
138 x=atoi(value.c_str());
144 int x,y; window->get_position(x,y);
145 y=atoi(value.c_str());
151 int x,y; window->get_size(x,y);
152 x=atoi(value.c_str());
153 window->set_default_size(x,y);
158 int x,y; window->get_size(x,y);
159 y=atoi(value.c_str());
160 window->set_default_size(x,y);
172 return synfigapp::Settings::set_value(key,value);
175 synfigapp::Settings::KeyList
176 DialogSettings::get_key_list()const
178 synfigapp::Settings::KeyList ret(synfigapp::Settings::get_key_list());
180 ret.push_back("size");
181 ret.push_back("pos");
182 ret.push_back("visible");