X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=synfig-studio%2Ftrunk%2Fsrc%2Fsynfigapp%2Finputdevice.cpp;h=4a513a63767d005f92625b4df99c2f64a639aa87;hb=6ef7f2e519d20184a97bbea4d2ec65fd76525848;hp=b6d7f2f8a6f5b2b293a56672cf6de3c4619ffd31;hpb=02252941b29de64037116f4d37991a38d9ff0d94;p=synfig.git diff --git a/synfig-studio/trunk/src/synfigapp/inputdevice.cpp b/synfig-studio/trunk/src/synfigapp/inputdevice.cpp index b6d7f2f..4a513a6 100644 --- a/synfig-studio/trunk/src/synfigapp/inputdevice.cpp +++ b/synfig-studio/trunk/src/synfigapp/inputdevice.cpp @@ -2,19 +2,20 @@ /*! \file inputdevice.cpp ** \brief Template File ** -** $Id: inputdevice.cpp,v 1.2 2005/01/12 04:08:32 darco Exp $ +** $Id$ ** ** \legal -** Copyright (c) 2002 Robert B. Quattlebaum Jr. +** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley ** -** This software and associated documentation -** are CONFIDENTIAL and PROPRIETARY property of -** the above-mentioned copyright holder. +** This package is free software; you can redistribute it and/or +** modify it under the terms of the GNU General Public License as +** published by the Free Software Foundation; either version 2 of +** the License, or (at your option) any later version. ** -** You may not copy, print, publish, or in any -** other way distribute this software without -** a prior written agreement with -** the copyright holder. +** This package is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +** General Public License for more details. ** \endlegal */ /* ========================================================================= */ @@ -34,6 +35,8 @@ #include #include "main.h" +#include "general.h" + #endif /* === U S I N G =========================================================== */ @@ -53,7 +56,7 @@ class DeviceSettings : public Settings public: DeviceSettings(InputDevice* input_device): input_device(input_device) { } - + virtual bool get_value(const synfig::String& key, synfig::String& value)const { @@ -84,13 +87,19 @@ public: return true; } - + if(key=="bgcolor") + { + Color c(input_device->get_background_color()); + value=strprintf("%f %f %f %f",(float)c.get_r(),(float)c.get_g(),(float)c.get_b(),(float)c.get_a()); + + return true; + } + return Settings::get_value(key, value); } - + virtual bool set_value(const synfig::String& key,const synfig::String& value) { - DEBUGPOINT(); if(key=="state") { input_device->set_state(value); @@ -119,14 +128,23 @@ public: input_device->set_foreground_color(synfig::Color(r,g,b,a)); return true; } - + if(key=="bgcolor") + { + float r=0,g=0,b=0,a=1; + if(!strscanf(value,"%f %f %f %f",&r,&g,&b,&a)) + return false; + input_device->set_background_color(synfig::Color(r,g,b,a)); + return true; + } + return Settings::set_value(key, value); } - + virtual KeyList get_key_list()const { KeyList ret(Settings::get_key_list()); ret.push_back("color"); + ret.push_back("bgcolor"); ret.push_back("state"); ret.push_back("bline_width"); ret.push_back("blend_method"); @@ -171,14 +189,14 @@ InputDevice::InputDevice(const synfig::String id_, Type type_): state_="normal"; break; } - + device_settings=new DeviceSettings(this); Main::settings().add_domain(device_settings,"input_device."+id_); } InputDevice::~InputDevice() { - Main::settings().remove_domain("input_device."+id_); + Main::settings().remove_domain("input_device."+id_); delete device_settings; }