From: darco Date: Thu, 31 Aug 2006 00:51:34 +0000 (+0000) Subject: Fix 1382032: problem which made it impossible to enable, disable, or rename layers... X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=a3b6b682f6c57efe5a76456e03dd123e4b851f40;p=synfig.git Fix 1382032: problem which made it impossible to enable, disable, or rename layers from the layer tab. Strangely, it should have worked to begin with, and it actually DID work fine in GTKMM 2.4 and 2.6... The way the layer and parameters tabs are currently handled is a total mess. Originally, they were both the same tab, but they went seperate ways at some point but there are still some classes they have in common which is just confusing. Bah. git-svn-id: http://svn.voria.com/code@222 1f10aa63-cdf2-0310-b900-c93c546f37ac --- diff --git a/synfig-studio/trunk/src/gtkmm/layertree.cpp b/synfig-studio/trunk/src/gtkmm/layertree.cpp index 754af74..9f84d8d 100644 --- a/synfig-studio/trunk/src/gtkmm/layertree.cpp +++ b/synfig-studio/trunk/src/gtkmm/layertree.cpp @@ -188,10 +188,21 @@ LayerTree::create_layer_tree() { // --- O N / O F F ---------------------------------------------------- - int index; - index=get_layer_tree_view().append_column_editable(_(" "),layer_model.active); + //int index; + //index=get_layer_tree_view().append_column_editable(_(" "),layer_model.active); //Gtk::TreeView::Column* column = get_layer_tree_view().get_column(index-1); - } + + Gtk::TreeView::Column* column = Gtk::manage( new Gtk::TreeView::Column(_(" ")) ); + + // Set up the icon cell-renderer + Gtk::CellRendererToggle* cellrenderer = Gtk::manage( new Gtk::CellRendererToggle() ); + cellrenderer->signal_toggled().connect(sigc::mem_fun(*this, &studio::LayerTree::on_layer_toggle)); + + column->pack_start(*cellrenderer,false); + column->add_attribute(cellrenderer->property_active(), layer_model.active); + get_layer_tree_view().append_column(*column); + } + { // --- I C O N -------------------------------------------------------- int index; index=get_layer_tree_view().append_column(_("Z"),layer_model.icon); @@ -210,8 +221,19 @@ LayerTree::create_layer_tree() } //get_layer_tree_view().append_column(_("Z"),layer_model.z_depth); { // --- N A M E -------------------------------------------------------- - int index; - index=get_layer_tree_view().append_column_editable(_("Layer"),layer_model.label); + Gtk::TreeView::Column* column = Gtk::manage( new Gtk::TreeView::Column(_("Layer")) ); + + // Set up the icon cell-renderer + Gtk::CellRendererText* cellrenderer = Gtk::manage( new Gtk::CellRendererText() ); + cellrenderer->signal_edited().connect(sigc::mem_fun(*this, &studio::LayerTree::on_layer_renamed)); + cellrenderer->property_editable()=true; + + column->pack_start(*cellrenderer,false); + column->add_attribute(cellrenderer->property_text(), layer_model.label); + get_layer_tree_view().append_column(*column); + + // int index; +// index=get_layer_tree_view().append_column_editable(_("Layer"),layer_model.label); //Gtk::TreeView::Column* column = get_layer_tree_view().get_column(index-1); //column->set_sort_column_id(layer_model.index); @@ -236,48 +258,7 @@ LayerTree::create_layer_tree() column_z_depth->set_sort_column_id(layer_model.z_depth); } - /* - { // --- N A M E -------------------------------------------------------- - Gtk::TreeView::Column* column = Gtk::manage( new Gtk::TreeView::Column(_("Layer")) ); - // Set up the icon cell-renderer - Gtk::CellRendererPixbuf* icon_cellrenderer = Gtk::manage( new Gtk::CellRendererPixbuf() ); - column->pack_start(*icon_cellrenderer,false); - column->add_attribute(icon_cellrenderer->property_pixbuf(), layer_model.icon); - - // Set up the text attributes - Pango::AttrList attr_list; - { - Pango::AttrInt pango_size(Pango::Attribute::create_attr_size(Pango::SCALE*8)); - pango_size.set_start_index(0); - pango_size.set_end_index(64); - attr_list.change(pango_size); - } - - // Pack the label into the column - //column->pack_start(layer_model.label,true); - Gtk::CellRendererText* text_cellrenderer = Gtk::manage( new Gtk::CellRendererText() ); - column->pack_start(*text_cellrenderer,false); - column->add_attribute(text_cellrenderer->property_text(), layer_model.label); - text_cellrenderer->property_attributes()=attr_list; - - // Finish setting up the column - column->set_reorderable(); - column->set_resizable(); - column->set_clickable(); - get_layer_tree_view().append_column(*column); - get_layer_tree_view().set_expander_column(*column); - } - */ - -/* { - Gtk::Widget& widget(get_layer_tree_view()); - Pango::FontDescription font(widget.get_modifier_style()->get_font()); - font.set_size(font.get_size()*3/4); - widget.get_modifier_style()->set_font(font); - widget.modify_style(widget.get_modifier_style()); - } -*/ get_layer_tree_view().set_enable_search(true); get_layer_tree_view().set_search_column(layer_model.label); get_layer_tree_view().set_search_equal_func(sigc::ptr_fun(&studio::LayerTreeStore::search_func)); @@ -740,17 +721,26 @@ LayerTree::on_edited_value(const Glib::ustring&path_string,synfig::ValueBase val //signal_edited_value()(row[param_model.value_desc],value); } -/* +void +LayerTree::on_layer_renamed(const Glib::ustring&path_string,const Glib::ustring& value) +{ + Gtk::TreePath path(path_string); + + const Gtk::TreeRow row = *(get_layer_tree_view().get_model()->get_iter(path)); + if(!row) + return; + row[layer_model.label]=value; +} + void LayerTree::on_layer_toggle(const Glib::ustring& path_string) { Gtk::TreePath path(path_string); const Gtk::TreeRow row = *(get_layer_tree_view().get_model()->get_iter(path)); - - signal_layer_toggle()(row[layer_model.layer]); + bool active=static_cast(row[layer_model.active]); + row[layer_model.active]=!active; } -*/ void LayerTree::on_waypoint_clicked(const Glib::ustring &path_string, synfig::Waypoint waypoint,int button) diff --git a/synfig-studio/trunk/src/gtkmm/layertree.h b/synfig-studio/trunk/src/gtkmm/layertree.h index 6542231..884cb36 100644 --- a/synfig-studio/trunk/src/gtkmm/layertree.h +++ b/synfig-studio/trunk/src/gtkmm/layertree.h @@ -166,6 +166,8 @@ private: void on_edited_value(const Glib::ustring&path_string,synfig::ValueBase value); + void on_layer_renamed(const Glib::ustring&path_string,const Glib::ustring& value); + void on_layer_toggle(const Glib::ustring& path_string); void on_waypoint_clicked(const Glib::ustring &, synfig::Waypoint, int button); diff --git a/synfig-studio/trunk/src/gtkmm/layertreestore.h b/synfig-studio/trunk/src/gtkmm/layertreestore.h index 87a5bb9..56537b9 100644 --- a/synfig-studio/trunk/src/gtkmm/layertreestore.h +++ b/synfig-studio/trunk/src/gtkmm/layertreestore.h @@ -118,8 +118,7 @@ private: */ private: - - virtual void set_value_impl (const Gtk::TreeModel::iterator& row, int column, const Glib::ValueBase& value); + virtual void set_value_impl (const Gtk::TreeModel::iterator& row, int column, const Glib::ValueBase& value); virtual void get_value_vfunc (const Gtk::TreeModel::iterator& iter, int column, Glib::ValueBase& value)const; virtual bool row_draggable_vfunc (const TreeModel::Path& path)const; diff --git a/synfig-studio/trunk/studio.prj b/synfig-studio/trunk/studio.prj index 9136c6f..be68d5a 100644 --- a/synfig-studio/trunk/studio.prj +++ b/synfig-studio/trunk/studio.prj @@ -1,4 +1,4 @@ -# Anjuta Version 1.2.2 +# Anjuta Version 1.2.4a Compatibility Level: 1 @@ -23,15 +23,15 @@ Compatibility Level: 1 props.file.type=project -anjuta.version=1.2.2 +anjuta.version=1.2.4a anjuta.compatibility.level=1 -project.name=studio +project.name=synfig-studio project.type=GNOMEmm 2.0 project.target.type=EXECUTABLE -project.version=0.60.00 +project.version=0.61 project.author=Robert Quattlebaum -project.source.target=src/gtkmm/synfigstudio +project.source.target=src/gtkmm/.libs/lt-synfigstudio project.has.gettext=0 project.gui.command= project.programming.language=C++ @@ -42,18 +42,17 @@ project.config.extra.modules.after= project.config.blocked=1 project.config.disable.overwriting=1 1 1 1 1 1 1 1 1 -project.menu.entry=studio Version 0.60.00 +project.menu.entry=Synfig Studio 0.61 project.menu.group=Application -project.menu.comment=studio Version 0.60.00 +project.menu.comment=Synfig Studio 0.61 project.menu.icon= project.menu.need.terminal=0 -project.configure.options=--enable-debug --enable-static=no +project.configure.options=--enable-debug --disable-optimization anjuta.program.arguments= preferences.build.option.jobs=0 preferences.build.option.silent=0 preferences.build.option.autosave=0 -preferences.anjuta.make.options=-j6 preferences.make=make preferences.build.option.keep.going=0 preferences.build.option.warn.undef=0