/*! \file layertree.cpp
** \brief Template File
**
-** $Id: layertree.cpp,v 1.1.1.1 2005/01/07 03:34:36 darco Exp $
+** $Id$
**
** \legal
** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
#include "instance.h"
#include <gtkmm/treemodelsort.h>
+#include "general.h"
+
#endif
/* === U S I N G =========================================================== */
LayerTree::LayerTree():
layer_amount_adjustment_(1,0,1,0.01,0.01,0)
-{
+{
param_tree_view_=new Gtk::TreeView;
layer_tree_view_=new Gtk::TreeView;
-
+
//Gtk::HPaned* hpaned(manage(new Gtk::HPaned()));
//hpaned->show();
//attach(*hpaned, 0, 3, 0, 1, Gtk::EXPAND|Gtk::FILL,Gtk::EXPAND|Gtk::FILL, 0, 0);
//attach(*create_layer_tree(), 0, 3, 0, 1, Gtk::EXPAND|Gtk::FILL,Gtk::EXPAND|Gtk::FILL, 0, 0);
-
+
create_layer_tree();
create_param_tree();
-
+
//hpaned->pack1(*create_layer_tree(),false,false);
//hpaned->pack2(*create_param_tree(),true,false);
//hpaned->set_position(200);
hbox=manage(new Gtk::HBox());
-
+
attach(*hbox, 0, 1, 1, 2, Gtk::FILL|Gtk::SHRINK, Gtk::SHRINK, 0, 0);
attach(blend_method_widget, 2, 3, 1, 2,Gtk::SHRINK, Gtk::SHRINK, 0, 0);
layer_amount_hscale->set_digits(2);
layer_amount_hscale->set_value_pos(Gtk::POS_LEFT);
layer_amount_hscale->set_sensitive(false);
- layer_amount_hscale->set_update_policy( Gtk::UPDATE_DISCONTINUOUS);
+ layer_amount_hscale->set_update_policy( Gtk::UPDATE_DISCONTINUOUS);
attach(*layer_amount_hscale, 1, 2, 1, 2, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK, 1, 1);
layer_amount_adjustment_.signal_value_changed().connect(sigc::mem_fun(*this, &studio::LayerTree::on_amount_value_changed));
-
-
-
-
+
Gtk::Image *icon;
//Gtk::IconSize iconsize(Gtk::IconSize::from_name("synfig-small_icon"));
Gtk::IconSize iconsize(Gtk::ICON_SIZE_SMALL_TOOLBAR);
SMALL_BUTTON(button_lower,"gtk-go-down","Lower");
SMALL_BUTTON(button_duplicate,"synfig-duplicate","Duplicate");
SMALL_BUTTON(button_delete,"gtk-delete","Delete");
-
+
hbox->pack_start(*button_raise,Gtk::PACK_SHRINK);
hbox->pack_start(*button_lower,Gtk::PACK_SHRINK);
hbox->pack_start(*button_duplicate,Gtk::PACK_SHRINK);
button_duplicate->set_sensitive(false);
button_delete->set_sensitive(false);
-
-
-
get_selection()->signal_changed().connect(sigc::mem_fun(*this, &studio::LayerTree::on_selection_changed));
-
get_layer_tree_view().set_reorderable(true);
get_selection()->set_mode(Gtk::SELECTION_MULTIPLE);
//get_param_tree_view().get_selection()->set_mode(Gtk::SELECTION_MULTIPLE);
get_layer_tree_view().show();
- param_tree_view().show();
-
+ get_param_tree_view().show();
hbox->show();
layer_amount_hscale->show();
tooltips_.enable();
disable_amount_changed_signal=false;
-
-
-
-
blend_method_widget.set_param_desc(ParamDesc(Color::BlendMethod(),"blend_method"));
blend_method_widget.set_value((int)Color::BLEND_COMPOSITE);
blend_method_widget.signal_activate().connect(sigc::mem_fun(*this, &studio::LayerTree::on_blend_method_changed));
}
-
LayerTree::~LayerTree()
{
synfig::info("LayerTree::~LayerTree(): Deleted");
{
const LayerTreeStore::Model model;
-
{ // --- 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);
Gtk::TreeView::Column* column = get_layer_tree_view().get_column(index-1);
get_layer_tree_view().set_expander_column(*column);
-
column->set_sort_column_id(layer_model.z_depth);
//column->set_reorderable();
//column->set_resizable();
//column->set_clickable();
-
+
//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);
}
//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);
//column->set_reorderable();
//column->set_resizable();
//column->set_clickable(false);
-
+
//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);
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));
listTargets.push_back( Gtk::TargetEntry("LAYER") );
get_layer_tree_view().drag_dest_set(listTargets);
-
// This makes things easier to read.
get_layer_tree_view().set_rules_hint();
-
+
// Make us more sensitive to several events
//get_layer_tree_view().add_events(Gdk::BUTTON_PRESS_MASK | Gdk::BUTTON_RELEASE_MASK | Gdk::BUTTON1_MOTION_MASK | Gdk::BUTTON2_MOTION_MASK|Gdk::POINTER_MOTION_MASK);
-
+
get_layer_tree_view().signal_event().connect(sigc::mem_fun(*this, &studio::LayerTree::on_layer_tree_event));
get_layer_tree_view().show();
-
-
Gtk::ScrolledWindow *scroll = manage(new class Gtk::ScrolledWindow());
scroll->set_flags(Gtk::CAN_FOCUS);
scroll->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
//scroll->add(get_layer_tree_view());
scroll->set_shadow_type(Gtk::SHADOW_ETCHED_IN);
scroll->show();
-
+
return scroll;
}
pango_size.set_end_index(64);
attr_list.change(pango_size);
}
-
+
Gtk::IconSize icon_size(Gtk::ICON_SIZE_SMALL_TOOLBAR);
-
+
{ // --- N A M E --------------------------------------------------------
- Gtk::TreeView::Column* column = Gtk::manage( new Gtk::TreeView::Column(_("Param")) );
+ Gtk::TreeView::Column* column = Gtk::manage( new Gtk::TreeView::Column(_("Name")) );
// 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(), param_model.icon);
-
+
// Pack the label into the column
//column->pack_start(layer_model.label,true);
Gtk::CellRendererText* text_cellrenderer = Gtk::manage( new Gtk::CellRendererText() );
valuenode_icon_cellrenderer->property_pixbuf()=Gtk::Button().render_icon(Gtk::StockID("synfig-value_node"),icon_size);
column->add_attribute(valuenode_icon_cellrenderer->property_visible(), param_model.is_shared);
- // Finish setting up the column
+ // Finish setting up the column
column->set_reorderable();
column->set_resizable();
column->set_clickable();
-
- param_tree_view().append_column(*column);
+
+ get_param_tree_view().append_column(*column);
}
{ // --- V A L U E -----------------------------------------------------
- Gtk::TreeView::Column* column = Gtk::manage( new Gtk::TreeView::Column(_("ValueBase")) );
-
+ Gtk::TreeView::Column* column = Gtk::manage( new Gtk::TreeView::Column(_("Value")) );
+
// Set up the value cell-renderer
cellrenderer_value=LayerParamTreeStore::add_cell_renderer_value(column);
cellrenderer_value->signal_edited().connect(sigc::mem_fun(*this, &studio::LayerTree::on_edited_value));
cellrenderer_value->property_value()=synfig::ValueBase();
column->add_attribute(cellrenderer_value->property_param_desc(), param_model.param_desc);
- column->add_attribute(cellrenderer_value->property_inconsistant(),param_model.is_inconsistent);
+ column->add_attribute(cellrenderer_value->property_inconsistent(),param_model.is_inconsistent);
//cellrenderer_value->property_canvas()=canvas_interface->get_canvas(); // Is this line necessary?
cellrenderer_value->property_attributes()=attr_list;
// Finish setting up the column
- param_tree_view().append_column(*column);
+ get_param_tree_view().append_column(*column);
column->set_sizing(Gtk::TREE_VIEW_COLUMN_AUTOSIZE);
column->set_clickable();
column->set_min_width(120);
column->set_reorderable();
column->set_resizable();
}
+ { // --- T Y P E --------------------------------------------------------
+ Gtk::TreeView::Column* column = Gtk::manage( new Gtk::TreeView::Column(_("Type")) );
+ Gtk::CellRendererText* text_cellrenderer = Gtk::manage( new Gtk::CellRendererText() );
+ column->pack_start(*text_cellrenderer,false);
+ column->add_attribute(text_cellrenderer->property_text(), param_model.type);
+ text_cellrenderer->property_attributes()=attr_list;
+ get_param_tree_view().append_column(*column);
+ column->set_reorderable();
+ column->set_resizable();
+ column->set_clickable();
+ column->set_sort_column_id(param_model.type);
+ }
/*{ // --- T I M E T R A C K --------------------------------------------
Gtk::TreeView::Column* column = Gtk::manage( new Gtk::TreeView::Column(_("Time Track")) );
column_time_track=column;
-
+
// Set up the value-node cell-renderer
cellrenderer_time_track=LayerParamTreeStore::add_cell_renderer_value_node(column);
cellrenderer_time_track->property_mode()=Gtk::CELL_RENDERER_MODE_ACTIVATABLE;
//column->add_attribute(cellrenderer_time_track->property_visible(), model.is_value_node);
//column->pack_start(*cellrenderer_time_track);
-
+
// Finish setting up the column
column->set_reorderable();
column->set_resizable();
column->set_min_width(200);
- //param_tree_view().append_column(*column);
+ //get_param_tree_view().append_column(*column);
}*/
-
-
// This makes things easier to read.
- param_tree_view().set_rules_hint();
-
+ get_param_tree_view().set_rules_hint();
+
// Make us more sensitive to several events
- param_tree_view().add_events(Gdk::BUTTON_PRESS_MASK | Gdk::BUTTON_RELEASE_MASK | Gdk::BUTTON1_MOTION_MASK | Gdk::BUTTON2_MOTION_MASK|Gdk::POINTER_MOTION_MASK);
-
- param_tree_view().signal_event().connect(sigc::mem_fun(*this, &studio::LayerTree::on_param_tree_event));
- param_tree_view().show();
-
+ get_param_tree_view().add_events(Gdk::BUTTON_PRESS_MASK | Gdk::BUTTON_RELEASE_MASK | Gdk::BUTTON1_MOTION_MASK | Gdk::BUTTON2_MOTION_MASK|Gdk::POINTER_MOTION_MASK);
+
+ get_param_tree_view().signal_event().connect(sigc::mem_fun(*this, &studio::LayerTree::on_param_tree_event));
+ get_param_tree_view().show();
+
Gtk::ScrolledWindow *scroll = manage(new class Gtk::ScrolledWindow());
scroll->set_flags(Gtk::CAN_FOCUS);
scroll->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
- //scroll->add(param_tree_view());
+ //scroll->add(get_param_tree_view());
scroll->set_shadow_type(Gtk::SHADOW_ETCHED_IN);
scroll->show();
//column_time_track->set_visible(false);
-
+
return scroll;
}
{
if(sorted_layer_tree_store_)
iter=sorted_layer_tree_store_->convert_child_iter_to_iter(iter);
-
+
Gtk::TreePath path(iter);
for(int i=path.get_depth();i;i--)
{
get_layer_tree_view().get_selection()->unselect_all();
}
-
-
-
-
-
-
-
-
-
-
-
-
void
LayerTree::set_show_timetrack(bool x)
{
LayerTree::set_model(Glib::RefPtr<LayerTreeStore> layer_tree_store)
{
layer_tree_store_=layer_tree_store;
-
if(false)
{
- sorted_layer_tree_store_=Gtk::TreeModelSort::create(layer_tree_store);
-
+ sorted_layer_tree_store_=Gtk::TreeModelSort::create(layer_tree_store);
+
sorted_layer_tree_store_->set_default_sort_func(sigc::ptr_fun(&studio::LayerTreeStore::z_sorter));
-
+
//sorted_store->set_sort_func(model.time.index(),sigc::mem_fun(&studio::KeyframeTreeStore::time_sorter));
//sorted_store->set_sort_column_id(model.time.index(), Gtk::SORT_ASCENDING);
-
+
get_layer_tree_view().set_model(sorted_layer_tree_store_);
}
else
get_layer_tree_view().set_model(layer_tree_store_);
-
+
layer_tree_store_->canvas_interface()->signal_dirty_preview().connect(sigc::mem_fun(*this,&studio::LayerTree::on_dirty_preview));
//layer_tree_store_->canvas_interface()->signal_dirty_preview().connect(sigc::mem_fun(*this,&studio::LayerTree::on_dirty_preview));
-
+
layer_tree_store_->canvas_interface()->signal_time_changed().connect(
sigc::mem_fun(
- ¶m_tree_view(),
+ &get_param_tree_view(),
&Gtk::Widget::queue_draw
)
);
if(!param_tree_store_)
{
param_tree_store_=LayerParamTreeStore::create(layer_tree_store_->canvas_interface(), this);
- param_tree_view().set_model(param_tree_store_);
+ get_param_tree_view().set_model(param_tree_store_);
}
-
+
/* if(cellrenderer_time_track && layer_tree_store_ && layer_tree_store_->canvas_interface())
{
cellrenderer_time_track->set_canvas_interface(layer_tree_store_->canvas_interface());
LayerTree::set_time_adjustment(Gtk::Adjustment &adjustment)
{
//cellrenderer_time_track->set_adjustment(adjustment);
- adjustment.signal_value_changed().connect(sigc::mem_fun(param_tree_view(),&Gtk::TreeView::queue_draw));
- adjustment.signal_changed().connect(sigc::mem_fun(param_tree_view(),&Gtk::TreeView::queue_draw));
+ adjustment.signal_value_changed().connect(sigc::mem_fun(get_param_tree_view(),&Gtk::TreeView::queue_draw));
+ adjustment.signal_changed().connect(sigc::mem_fun(get_param_tree_view(),&Gtk::TreeView::queue_draw));
}
void
LayerTree::on_selection_changed()
{
synfigapp::SelectionManager::LayerList layer_list(get_selection_manager()->get_selected_layers());
-
+
Gtk::TreeIter iter;
if(last_top_selected_layer && !layer_tree_store_->find_layer_row(last_top_selected_layer,iter))
{
}
}
-
{
if(!layer_list.empty())
{
last_top_selected_layer=0;
}
}
-
-
+
if(layer_list.empty())
{
button_raise->set_sensitive(false);
button_lower->set_sensitive(true);
button_duplicate->set_sensitive(true);
button_delete->set_sensitive(true);
-
- if(layer_list.size()==1 && (*layer_list.begin())->get_param("amount").is_valid()&& (*layer_list.begin())->get_param("amount").same_as(Real()))
+
+ if(layer_list.size()==1 && (*layer_list.begin())->get_param("amount").is_valid()&& (*layer_list.begin())->get_param("amount").same_type_as(Real()))
{
quick_layer=*layer_list.begin();
}
else
quick_layer=0;
-
+
if(quick_layer)
{
layer_amount_hscale->set_sensitive(true);
disable_amount_changed_signal=false;
}
else
- blend_method_widget.set_sensitive(false);
+ blend_method_widget.set_sensitive(false);
}
else
{
- layer_amount_hscale->set_sensitive(false);
+ layer_amount_hscale->set_sensitive(false);
blend_method_widget.set_sensitive(false);
}
}
-
void
LayerTree::on_blend_method_changed()
{
return;
if(!quick_layer)
return;
-
+
if(quick_layer->get_param("blend_method").is_valid())
{
disable_amount_changed_signal=true;
return;
if(!quick_layer)
return;
-
+
disable_amount_changed_signal=true;
signal_edited_value()(synfigapp::ValueDesc(quick_layer,"amount"),synfig::ValueBase(layer_amount_adjustment_.get_value()));
disable_amount_changed_signal=false;
}
-
void
LayerTree::on_edited_value(const Glib::ustring&path_string,synfig::ValueBase value)
{
Gtk::TreePath path(path_string);
-
- const Gtk::TreeRow row = *(param_tree_view().get_model()->get_iter(path));
+
+ const Gtk::TreeRow row = *(get_param_tree_view().get_model()->get_iter(path));
if(!row)
return;
row[param_model.value]=value;
//signal_edited_value()(row[param_model.value_desc],value);
}
-/*
void
-LayerTree::on_layer_toggle(const Glib::ustring& path_string)
+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);
- signal_layer_toggle()(row[layer_model.layer]);
+ const Gtk::TreeRow row = *(get_layer_tree_view().get_model()->get_iter(path));
+ bool active=static_cast<bool>(row[layer_model.active]);
+ row[layer_model.active]=!active;
}
-*/
void
LayerTree::on_waypoint_clicked(const Glib::ustring &path_string, synfig::Waypoint waypoint,int button)
{
Gtk::TreePath path(path_string);
-
- const Gtk::TreeRow row = *(param_tree_view().get_model()->get_iter(path));
+
+ const Gtk::TreeRow row = *(get_param_tree_view().get_model()->get_iter(path));
if(!row)
return;
-
+
signal_waypoint_clicked()(static_cast<synfigapp::ValueDesc>(row[param_model.value_desc]),waypoint,button);
}
)
) break;
const Gtk::TreeRow row = *(get_layer_tree_view().get_model()->get_iter(path));
-
+
//if(column->get_first_cell_renderer()==cellrenderer_time_track)
// return signal_layer_user_click()(event->button.button,row,COLUMNID_TIME_TRACK);
//else
return signal_layer_user_click()(event->button.button,row,COLUMNID_VALUE);
else
return signal_layer_user_click()(event->button.button,row,COLUMNID_NAME);
-
+
}
break;
-
+
case GDK_MOTION_NOTIFY:
{
Gtk::TreeModel::Path path;
cell_x,cell_y //int&cell_x,int&cell_y
)
) break;
-
+
if(!get_layer_tree_view().get_model()->get_iter(path))
break;
-
+
Gtk::TreeRow row = *(get_layer_tree_view().get_model()->get_iter(path));
-
+
/*
if(cellrenderer_time_track==column->get_first_cell_renderer())
{
return false;
}
-
bool
LayerTree::on_param_tree_event(GdkEvent *event)
{
Gtk::TreeModel::Path path;
Gtk::TreeViewColumn *column;
int cell_x, cell_y;
- if(!param_tree_view().get_path_at_pos(
+ if(!get_param_tree_view().get_path_at_pos(
int(event->button.x),int(event->button.y), // x, y
path, // TreeModel::Path&
column, //TreeViewColumn*&
cell_x,cell_y //int&cell_x,int&cell_y
)
) break;
- const Gtk::TreeRow row = *(param_tree_view().get_model()->get_iter(path));
-
+ const Gtk::TreeRow row = *(get_param_tree_view().get_model()->get_iter(path));
+
/* if(column && column->get_first_cell_renderer()==cellrenderer_time_track)
{
Gdk::Rectangle rect;
- param_tree_view().get_cell_area(path,*column,rect);
+ get_param_tree_view().get_cell_area(path,*column,rect);
cellrenderer_time_track->property_value_desc()=row[param_model.value_desc];
cellrenderer_time_track->property_canvas()=row[param_model.canvas];
cellrenderer_time_track->activate(event,*this,path.to_string(),rect,rect,Gtk::CellRendererState());
- param_tree_view().queue_draw_area(rect.get_x(),rect.get_y(),rect.get_width(),rect.get_height());
+ get_param_tree_view().queue_draw_area(rect.get_x(),rect.get_y(),rect.get_width(),rect.get_height());
return true;
//return signal_param_user_click()(event->button.button,row,COLUMNID_TIME_TRACK);
}
- else
+ else
*/ {
if(event->button.button==3)
{
if(layer_list.size()<=1)
{
synfigapp::ValueDesc value_desc(row[param_model.value_desc]);
- Gtk::Menu* menu(manage(new Gtk::Menu()));
+ Gtk::Menu* menu(manage(new Gtk::Menu()));
+ menu->signal_hide().connect(sigc::bind(sigc::ptr_fun(&delete_widget), menu));
App::get_instance(param_tree_store_->canvas_interface()->get_canvas())->make_param_menu(menu,param_tree_store_->canvas_interface()->get_canvas(),value_desc,0.5f);
menu->popup(event->button.button,gtk_get_current_event_time());
return true;
}
- Gtk::Menu* menu(manage(new Gtk::Menu()));
+ Gtk::Menu* menu(manage(new Gtk::Menu()));
+ menu->signal_hide().connect(sigc::bind(sigc::ptr_fun(&delete_widget), menu));
std::list<synfigapp::ValueDesc> value_desc_list;
ParamDesc param_desc(row[param_model.param_desc]);
for(;!layer_list.empty();layer_list.pop_back())
}
}
break;
-
+
case GDK_MOTION_NOTIFY:
{
Gtk::TreeModel::Path path;
Gtk::TreeViewColumn *column;
int cell_x, cell_y;
- if(!param_tree_view().get_path_at_pos(
+ if(!get_param_tree_view().get_path_at_pos(
(int)event->motion.x,(int)event->motion.y, // x, y
path, // TreeModel::Path&
column, //TreeViewColumn*&
cell_x,cell_y //int&cell_x,int&cell_y
)
) break;
-
- if(!param_tree_view().get_model()->get_iter(path))
+
+ if(!get_param_tree_view().get_model()->get_iter(path))
break;
-
- Gtk::TreeRow row = *(param_tree_view().get_model()->get_iter(path));
-
+
+ Gtk::TreeRow row = *(get_param_tree_view().get_model()->get_iter(path));
+
/* if((event->motion.state&GDK_BUTTON1_MASK ||event->motion.state&GDK_BUTTON3_MASK) && column && cellrenderer_time_track==column->get_first_cell_renderer())
{
Gdk::Rectangle rect;
- param_tree_view().get_cell_area(path,*column,rect);
+ get_param_tree_view().get_cell_area(path,*column,rect);
cellrenderer_time_track->property_value_desc()=row[param_model.value_desc];
cellrenderer_time_track->property_canvas()=row[param_model.canvas];
cellrenderer_time_track->activate(event,*this,path.to_string(),rect,rect,Gtk::CellRendererState());
- param_tree_view().queue_draw();
- //param_tree_view().queue_draw_area(rect.get_x(),rect.get_y(),rect.get_width(),rect.get_height());
+ get_param_tree_view().queue_draw();
+ //get_param_tree_view().queue_draw_area(rect.get_x(),rect.get_y(),rect.get_width(),rect.get_height());
return true;
}
else
Gtk::TreeModel::Path path;
Gtk::TreeViewColumn *column;
int cell_x, cell_y;
- if(!param_tree_view().get_path_at_pos(
+ if(!get_param_tree_view().get_path_at_pos(
(int)event->button.x,(int)event->button.y, // x, y
path, // TreeModel::Path&
column, //TreeViewColumn*&
cell_x,cell_y //int&cell_x,int&cell_y
)
) break;
-
- if(!param_tree_view().get_model()->get_iter(path))
+
+ if(!get_param_tree_view().get_model()->get_iter(path))
break;
-
- Gtk::TreeRow row = *(param_tree_view().get_model()->get_iter(path));
-
+
+ Gtk::TreeRow row = *(get_param_tree_view().get_model()->get_iter(path));
+
/* if(column && cellrenderer_time_track==column->get_first_cell_renderer())
{
Gdk::Rectangle rect;
- param_tree_view().get_cell_area(path,*column,rect);
+ get_param_tree_view().get_cell_area(path,*column,rect);
cellrenderer_time_track->property_value_desc()=row[param_model.value_desc];
cellrenderer_time_track->property_canvas()=row[param_model.canvas];
cellrenderer_time_track->activate(event,*this,path.to_string(),rect,rect,Gtk::CellRendererState());
- param_tree_view().queue_draw();
- param_tree_view().queue_draw_area(rect.get_x(),rect.get_y(),rect.get_width(),rect.get_height());
+ get_param_tree_view().queue_draw();
+ get_param_tree_view().queue_draw_area(rect.get_x(),rect.get_y(),rect.get_width(),rect.get_height());
return true;
-
+
}
*/
}
param_list.add("time",layer_tree_store_->canvas_interface()->get_time());
param_list.add("canvas",layer_tree_store_->canvas_interface()->get_canvas());
param_list.add("canvas_interface",layer_tree_store_->canvas_interface());
-
+
{
synfigapp::SelectionManager::LayerList layer_list(get_selection_manager()->get_selected_layers());
synfigapp::SelectionManager::LayerList::iterator iter;
-
+
for(iter=layer_list.begin();iter!=layer_list.end();++iter)
param_list.add("layer",Layer::Handle(*iter));
}
param_list.add("time",layer_tree_store_->canvas_interface()->get_time());
param_list.add("canvas",layer_tree_store_->canvas_interface()->get_canvas());
param_list.add("canvas_interface",layer_tree_store_->canvas_interface());
-
+
{
synfigapp::SelectionManager::LayerList layer_list(get_selection_manager()->get_selected_layers());
synfigapp::SelectionManager::LayerList::iterator iter;
-
+
for(iter=layer_list.begin();iter!=layer_list.end();++iter)
param_list.add("layer",Layer::Handle(*iter));
}
-
+
synfigapp::Action::Handle action(synfigapp::Action::create("layer_lower"));
action->set_param_list(param_list);
layer_tree_store_->canvas_interface()->get_instance()->perform_action(action);
param_list.add("time",layer_tree_store_->canvas_interface()->get_time());
param_list.add("canvas",layer_tree_store_->canvas_interface()->get_canvas());
param_list.add("canvas_interface",layer_tree_store_->canvas_interface());
-
+
{
synfigapp::SelectionManager::LayerList layer_list(get_selection_manager()->get_selected_layers());
synfigapp::SelectionManager::LayerList::iterator iter;
-
+
for(iter=layer_list.begin();iter!=layer_list.end();++iter)
param_list.add("layer",Layer::Handle(*iter));
}
-
+
synfigapp::Action::Handle action(synfigapp::Action::create("layer_duplicate"));
action->set_param_list(param_list);
layer_tree_store_->canvas_interface()->get_instance()->perform_action(action);
param_list.add("time",layer_tree_store_->canvas_interface()->get_time());
param_list.add("canvas",layer_tree_store_->canvas_interface()->get_canvas());
param_list.add("canvas_interface",layer_tree_store_->canvas_interface());
-
+
{
synfigapp::SelectionManager::LayerList layer_list(get_selection_manager()->get_selected_layers());
synfigapp::SelectionManager::LayerList::iterator iter;
-
+
for(iter=layer_list.begin();iter!=layer_list.end();++iter)
param_list.add("layer",Layer::Handle(*iter));
}
-
+
synfigapp::Action::Handle action(synfigapp::Action::create("layer_remove"));
action->set_param_list(param_list);
layer_tree_store_->canvas_interface()->get_instance()->perform_action(action);
}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
/*
void
LayerTree::on_drag_data_get(const Glib::RefPtr<Gdk::DragContext>&context, Gtk::SelectionData& selection_data, guint info, guint time)
synfig::info("Dropped x=%d, y=%d",x,y);
bool success=false;
bool dropped_on_specific_row=false;
-
+
Gtk::TreeModel::Path path;
Gtk::TreeViewColumn *column;
int cell_x, cell_y;
}
else
dropped_on_specific_row=true;
-
+
Gtk::TreeRow row = *(get_model()->get_iter(path));
-
if ((selection_data.get_length() >= 0) && (selection_data.get_format() == 8))
{
if(synfig::String(selection_data.get_data_type())=="LAYER")do
{
Layer::Handle src(*reinterpret_cast<Layer**>(selection_data.get_data()));
assert(src);
-
+
Canvas::Handle dest_canvas;
Layer::Handle dest_layer;
-
+
if(dropped_on_specific_row)
{
dest_canvas=(Canvas::Handle)(row[model.canvas]);
}
else
dest_canvas=layer_tree_store_->canvas_interface()->get_canvas();
-
+
// In this case, we are just moving.
if(dest_canvas==src->get_canvas())
{
if(!dest_layer || dest_layer==src)
break;
-
+
synfigapp::Action::Handle action(synfigapp::Action::create("layer_move"));
action->set_param("canvas",dest_canvas);
action->set_param("canvas_interface",layer_tree_store_->canvas_interface());
}
}while(0);
}
-
+
// Finish the drag
context->drag_finish(success, false, time);
}
{
context->drag_finish(false, false, time);
}
-
+
if(layer_tree_store_->row_drop_possible(path,selection_data))
{
if(layer_tree_store_->drag_data_received(path,selection_data))