X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=synfig-studio%2Ftags%2Fstable%2Fsrc%2Fgtkmm%2Fmod_palette%2Fdock_paledit.cpp;h=fcafe64fbe1eaea65bcf5bd115d328c9f7ce4a7a;hb=47fce282611fbba1044921d22ca887f9b53ad91a;hp=6b5e0a0813e7907fa641e798e78b3f1953cb4bb2;hpb=7c6d5426922cb3cda793f688dcd4d534b02765c8;p=synfig.git diff --git a/synfig-studio/tags/stable/src/gtkmm/mod_palette/dock_paledit.cpp b/synfig-studio/tags/stable/src/gtkmm/mod_palette/dock_paledit.cpp index 6b5e0a0..fcafe64 100644 --- a/synfig-studio/tags/stable/src/gtkmm/mod_palette/dock_paledit.cpp +++ b/synfig-studio/tags/stable/src/gtkmm/mod_palette/dock_paledit.cpp @@ -1,20 +1,22 @@ -/* === S I N F G =========================================================== */ -/*! \file dialog_palette.cpp +/* === S Y N F I G ========================================================= */ +/*! \file dock_paledit.cpp ** \brief Template File ** -** $Id: dock_paledit.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $ +** $Id$ ** ** \legal -** Copyright (c) 2002 Robert B. Quattlebaum Jr. +** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley +** Copyright (c) 2007 Chris Moore ** -** 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 */ /* ========================================================================= */ @@ -33,47 +35,49 @@ #include #include #include -#include -#include -#include +#include +#include +#include #include "../widget_color.h" #include #include -#include +#include #include "../app.h" #include "../dialog_color.h" +#include "../general.h" + #endif /* === U S I N G =========================================================== */ using namespace std; using namespace etl; -using namespace sinfg; +using namespace synfig; using namespace studio; /* === M A C R O S ========================================================= */ /* === G L O B A L S ======================================================= */ /* -class studio::PaletteSettings : public sinfgapp::Settings +class studio::PaletteSettings : public synfigapp::Settings { Dock_PalEdit* dialog_palette; - sinfg::String name; + synfig::String name; public: - PaletteSettings(Dock_PalEdit* window,const sinfg::String& name): + PaletteSettings(Dock_PalEdit* window,const synfig::String& name): dialog_palette(window), name(name) { dialog_palette->dialog_settings.add_domain(this,name); } - + virtual ~PaletteSettings() { dialog_palette->dialog_settings.remove_domain(name); } - virtual bool get_value(const sinfg::String& key, sinfg::String& value)const + virtual bool get_value(const synfig::String& key, synfig::String& value)const { int i(atoi(key.c_str())); if(i<0 || i>=dialog_palette->size()) @@ -82,8 +86,8 @@ public: value=strprintf("%f %f %f %f",c.get_r(),c.get_g(),c.get_b(),c.get_a()); return true; } - - virtual bool set_value(const sinfg::String& key,const sinfg::String& value) + + virtual bool set_value(const synfig::String& key,const synfig::String& value) { int i(atoi(key.c_str())); if(i<0) @@ -96,11 +100,11 @@ public: dialog_palette->set_color(Color(r,g,b,a),i); return true; } - + virtual KeyList get_key_list()const { - sinfgapp::Settings::KeyList ret(sinfgapp::Settings::get_key_list()); - + synfigapp::Settings::KeyList ret(synfigapp::Settings::get_key_list()); + int i; for(i=0;isize();i++) ret.push_back(strprintf("%03d",i)); @@ -116,9 +120,8 @@ Dock_PalEdit::Dock_PalEdit(): Dockable("pal_edit",_("Palette Editor"),Gtk::StockID("gtk-select-color")), //palette_settings(new PaletteSettings(this,"colors")), table(2,2,false) -{ +{ action_group=Gtk::ActionGroup::create(); - DEBUGPOINT(); action_group->add(Gtk::Action::create( "palette-add-color", Gtk::StockID("gtk-add"), @@ -130,7 +133,7 @@ Dock_PalEdit::Dock_PalEdit(): &Dock_PalEdit::on_add_pressed ) ); - + App::ui_manager()->insert_action_group(action_group); Glib::ustring ui_info = @@ -144,7 +147,7 @@ Dock_PalEdit::Dock_PalEdit(): App::ui_manager()->add_ui_from_string(ui_info); set_toolbar(*dynamic_cast(App::ui_manager()->get_widget("/toolbar-palette"))); - + /* add_button( Gtk::StockID("gtk-add"), @@ -156,12 +159,12 @@ Dock_PalEdit::Dock_PalEdit(): ) ); */ - + add(table); table.set_homogeneous(true); - + set_default_palette(); - + show_all_children(); } @@ -171,7 +174,7 @@ Dock_PalEdit::~Dock_PalEdit() } void -Dock_PalEdit::set_palette(const sinfg::Palette& x) +Dock_PalEdit::set_palette(const synfig::Palette& x) { palette_=x; refresh(); @@ -180,13 +183,14 @@ Dock_PalEdit::set_palette(const sinfg::Palette& x) void Dock_PalEdit::on_add_pressed() { - add_color(sinfgapp::Main::get_foreground_color()); + add_color(synfigapp::Main::get_foreground_color()); } void Dock_PalEdit::show_menu(int i) { Gtk::Menu* menu(manage(new Gtk::Menu())); + menu->signal_hide().connect(sigc::bind(sigc::ptr_fun(&delete_widget), menu)); menu->items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("gtk-select-color"), sigc::bind( @@ -212,7 +216,7 @@ Dock_PalEdit::show_menu(int i) } int -Dock_PalEdit::add_color(const sinfg::Color& x) +Dock_PalEdit::add_color(const synfig::Color& x) { palette_.push_back(x); signal_changed()(); @@ -221,7 +225,7 @@ Dock_PalEdit::add_color(const sinfg::Color& x) } void -Dock_PalEdit::set_color(sinfg::Color x, int i) +Dock_PalEdit::set_color(synfig::Color x, int i) { palette_[i].color=x; signal_changed()(); @@ -246,10 +250,10 @@ void Dock_PalEdit::refresh() { const int width(12); - + // Clear the table table.foreach(sigc::mem_fun(table,&Gtk::Table::remove)); - + for(int i=0;i