projects
/
synfig.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Use ValueNode_DynamicList::set_member_canvas() to set the canvas for each blinepoint...
[synfig.git]
/
synfig-studio
/
trunk
/
src
/
gtkmm
/
mod_palette
/
dock_paledit.cpp
diff --git
a/synfig-studio/trunk/src/gtkmm/mod_palette/dock_paledit.cpp
b/synfig-studio/trunk/src/gtkmm/mod_palette/dock_paledit.cpp
index
94a3dcb
..
fcafe64
100644
(file)
--- a/
synfig-studio/trunk/src/gtkmm/mod_palette/dock_paledit.cpp
+++ b/
synfig-studio/trunk/src/gtkmm/mod_palette/dock_paledit.cpp
@@
-1,11
+1,12
@@
/* === S Y N F I G ========================================================= */
/* === S Y N F I G ========================================================= */
-/*! \file d
ialog_palette
.cpp
+/*! \file d
ock_paledit
.cpp
** \brief Template File
**
** \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-2005 Robert B. Quattlebaum Jr., Adrian Bentley
**
** \legal
** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
+** Copyright (c) 2007 Chris Moore
**
** This package is free software; you can redistribute it and/or
** modify it under the terms of the GNU General Public License as
**
** This package is free software; you can redistribute it and/or
** modify it under the terms of the GNU General Public License as
@@
-44,6
+45,8
@@
#include "../app.h"
#include "../dialog_color.h"
#include "../app.h"
#include "../dialog_color.h"
+#include "../general.h"
+
#endif
/* === U S I N G =========================================================== */
#endif
/* === U S I N G =========================================================== */
@@
-68,7
+71,7
@@
public:
{
dialog_palette->dialog_settings.add_domain(this,name);
}
{
dialog_palette->dialog_settings.add_domain(this,name);
}
-
+
virtual ~PaletteSettings()
{
dialog_palette->dialog_settings.remove_domain(name);
virtual ~PaletteSettings()
{
dialog_palette->dialog_settings.remove_domain(name);
@@
-83,7
+86,7
@@
public:
value=strprintf("%f %f %f %f",c.get_r(),c.get_g(),c.get_b(),c.get_a());
return true;
}
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 synfig::String& key,const synfig::String& value)
{
int i(atoi(key.c_str()));
virtual bool set_value(const synfig::String& key,const synfig::String& value)
{
int i(atoi(key.c_str()));
@@
-97,11
+100,11
@@
public:
dialog_palette->set_color(Color(r,g,b,a),i);
return true;
}
dialog_palette->set_color(Color(r,g,b,a),i);
return true;
}
-
+
virtual KeyList get_key_list()const
{
synfigapp::Settings::KeyList ret(synfigapp::Settings::get_key_list());
virtual KeyList get_key_list()const
{
synfigapp::Settings::KeyList ret(synfigapp::Settings::get_key_list());
-
+
int i;
for(i=0;i<dialog_palette->size();i++)
ret.push_back(strprintf("%03d",i));
int i;
for(i=0;i<dialog_palette->size();i++)
ret.push_back(strprintf("%03d",i));
@@
-117,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)
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();
action_group=Gtk::ActionGroup::create();
- DEBUGPOINT();
action_group->add(Gtk::Action::create(
"palette-add-color",
Gtk::StockID("gtk-add"),
action_group->add(Gtk::Action::create(
"palette-add-color",
Gtk::StockID("gtk-add"),
@@
-131,7
+133,7
@@
Dock_PalEdit::Dock_PalEdit():
&Dock_PalEdit::on_add_pressed
)
);
&Dock_PalEdit::on_add_pressed
)
);
-
+
App::ui_manager()->insert_action_group(action_group);
Glib::ustring ui_info =
App::ui_manager()->insert_action_group(action_group);
Glib::ustring ui_info =
@@
-145,7
+147,7
@@
Dock_PalEdit::Dock_PalEdit():
App::ui_manager()->add_ui_from_string(ui_info);
set_toolbar(*dynamic_cast<Gtk::Toolbar*>(App::ui_manager()->get_widget("/toolbar-palette")));
App::ui_manager()->add_ui_from_string(ui_info);
set_toolbar(*dynamic_cast<Gtk::Toolbar*>(App::ui_manager()->get_widget("/toolbar-palette")));
-
+
/*
add_button(
Gtk::StockID("gtk-add"),
/*
add_button(
Gtk::StockID("gtk-add"),
@@
-157,12
+159,12
@@
Dock_PalEdit::Dock_PalEdit():
)
);
*/
)
);
*/
-
+
add(table);
table.set_homogeneous(true);
add(table);
table.set_homogeneous(true);
-
+
set_default_palette();
set_default_palette();
-
+
show_all_children();
}
show_all_children();
}
@@
-188,6
+190,7
@@
void
Dock_PalEdit::show_menu(int i)
{
Gtk::Menu* menu(manage(new Gtk::Menu()));
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(
menu->items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("gtk-select-color"),
sigc::bind(
@@
-247,10
+250,10
@@
void
Dock_PalEdit::refresh()
{
const int width(12);
Dock_PalEdit::refresh()
{
const int width(12);
-
+
// Clear the table
table.foreach(sigc::mem_fun(table,&Gtk::Table::remove));
// Clear the table
table.foreach(sigc::mem_fun(table,&Gtk::Table::remove));
-
+
for(int i=0;i<size();i++)
{
Widget_Color* widget_color(manage(new Widget_Color()));
for(int i=0;i<size();i++)
{
Widget_Color* widget_color(manage(new Widget_Color()));
@@
-269,7
+272,7
@@
Dock_PalEdit::refresh()
)
);
int c(i%width),r(i/width);
)
);
int c(i%width),r(i/width);
- table.attach(*widget_color, c, c+1, r, r+1, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0);
+ table.attach(*widget_color, c, c+1, r, r+1, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0);
}
table.show_all();
queue_draw();
}
table.show_all();
queue_draw();
@@
-295,12
+298,12
@@
Dock_PalEdit::select_color(int i)
{
synfigapp::Main::set_foreground_color(get_color(i));
}
{
synfigapp::Main::set_foreground_color(get_color(i));
}
-
+
void
Dock_PalEdit::set_default_palette()
{
int width=12;
void
Dock_PalEdit::set_default_palette()
{
int width=12;
-
+
palette_.clear();
// Greys
palette_.clear();
// Greys
@@
-321,7
+324,7
@@
Dock_PalEdit::set_default_palette()
float x(float(i)/(float)(width-1));
const Color tan1(0.2,0.05,0);
const Color tan2(0.85,0.64,0.20);
float x(float(i)/(float)(width-1));
const Color tan1(0.2,0.05,0);
const Color tan2(0.85,0.64,0.20);
-
+
palette_.push_back(Color::blend(tan2,tan1,x));
}
palette_.push_back(Color::blend(tan2,tan1,x));
}
@@
-339,7
+342,7
@@
Dock_PalEdit::set_default_palette()
palette_.push_back(Color::magenta());
palette_.push_back(Color(1.0f,0.0f,0.25f));
palette_.push_back(Color::magenta());
palette_.push_back(Color(1.0f,0.0f,0.25f));
-
+
const int levels(3);
// Colors
const int levels(3);
// Colors
@@
-357,10
+360,10
@@
Dock_PalEdit::set_default_palette()
palette_.push_back(c);
}
palette_.push_back(c);
}
-
+
/*
const int levels(3);
/*
const int levels(3);
-
+
for(int i=0;i<levels*levels*levels;i++)
{
Color c(
for(int i=0;i<levels*levels*levels;i++)
{
Color c(