Get rid of all references to the bootstrap script since it was removed
[synfig.git] / synfig-studio / trunk / src / gtkmm / compview.cpp
1 /* === S Y N F I G ========================================================= */
2 /*!     \file compview.cpp
3 **      \brief writeme
4 **
5 **      $Id$
6 **
7 **      \legal
8 **      Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
9 **
10 **      This package is free software; you can redistribute it and/or
11 **      modify it under the terms of the GNU General Public License as
12 **      published by the Free Software Foundation; either version 2 of
13 **      the License, or (at your option) any later version.
14 **
15 **      This package is distributed in the hope that it will be useful,
16 **      but WITHOUT ANY WARRANTY; without even the implied warranty of
17 **      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 **      General Public License for more details.
19 **      \endlegal
20 **
21 ** === N O T E S ===========================================================
22 **
23 ** ========================================================================= */
24
25 /* === H E A D E R S ======================================================= */
26
27 #ifdef USING_PCH
28 #       include "pch.h"
29 #else
30 #ifdef HAVE_CONFIG_H
31 #       include <config.h>
32 #endif
33
34 #include "compview.h"
35 #include "app.h"
36 #include <gtkmm/scrolledwindow.h>
37 #include <cassert>
38 #include <iostream>
39 #include "instance.h"
40 #include <sigc++/signal.h>
41 #include <sigc++/hide.h>
42 #include <sigc++/slot.h>
43 #include "canvasview.h"
44 #include <synfigapp/action.h>
45
46 #include "general.h"
47
48 #endif
49
50 /* === M A C R O S ========================================================= */
51
52 #define ADD_TOOLBOX_BUTTON(button,stockid,tooltip)      \
53         Gtk::Button *button = manage(new class Gtk::Button());  \
54         button->add(*manage(new Gtk::Image(Gtk::StockID(stockid),Gtk::IconSize(4))));   \
55         tooltips.set_tip(*button,tooltip);      \
56         button->show_all()
57
58 using namespace std;
59 using namespace etl;
60 using namespace synfig;
61 using namespace studio;
62
63 #define COLUMNID_JUMP           (787584)
64 #define ColumnID        int
65
66 /* === G L O B A L S ======================================================= */
67
68 /* === P R O C E D U R E S ================================================= */
69
70 /* === M E T H O D S ======================================================= */
71
72 CompView::CompView():
73         Gtk::Window(Gtk::WINDOW_TOPLEVEL),
74         dialog_settings(this,"compview")
75 {
76         init_menu();
77         set_type_hint(Gdk::WINDOW_TYPE_HINT_UTILITY);
78
79         Gtk::Table *table = manage(new class Gtk::Table(2, 1, false));
80
81
82         table->attach(*create_instance_selector(), 0, 1, 0, 1, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK, 0, 0);
83
84         notebook=manage(new class Gtk::Notebook());
85
86         table->attach(*notebook, 0, 1, 1,2, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0);
87
88         notebook->append_page(*create_canvas_tree(),_("Canvases"));
89         notebook->append_page(*create_action_tree(),_("History"));
90
91
92
93 /*
94
95         studio::Instance::ImageColumnModel image_column_model;
96         image_list=manage(new class Gtk::TreeView());
97         image_list->append_column(_("Name"),image_column_model.name);
98         image_list->signal_row_activated().connect(sigc::mem_fun(*this,&CompView::on_image_activate));
99         image_list->set_rules_hint();
100
101         Gtk::Table *image_page = manage(new class Gtk::Table(2, 1, false));
102         Gtk::ScrolledWindow *image_list_scroll = manage(new class Gtk::ScrolledWindow());
103         image_list_scroll->set_flags(Gtk::CAN_FOCUS);
104         image_list_scroll->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
105         image_list_scroll->add(*image_list);
106         image_page->attach(*image_list_scroll, 0, 1, 0, 1, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0);
107         Gtk::HBox *image_buttons=manage(new class Gtk::HBox());
108         image_page->attach(*image_buttons, 0, 1, 1,2, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK, 0, 0);
109         ADD_TOOLBOX_BUTTON(button_image_new,"gtk-new",_("Create a new image"));
110         ADD_TOOLBOX_BUTTON(button_image_delete,"gtk-delete",_("Delete image"));
111         ADD_TOOLBOX_BUTTON(button_image_rename,"gtk-rename",_("Rename image"));
112         ADD_TOOLBOX_BUTTON(button_image_copy,"gtk-copy",_("Duplicate image"));
113         button_image_new->signal_clicked().connect(sigc::mem_fun(*this,&CompView::new_image));
114         button_image_delete->signal_clicked().connect(sigc::mem_fun(*this,&CompView::delete_image));
115         button_image_rename->signal_clicked().connect(sigc::mem_fun(*this,&CompView::rename_image));
116         button_image_copy->signal_clicked().connect(sigc::mem_fun(*this,&CompView::copy_image));
117         image_buttons->pack_start(*button_image_new);
118         image_buttons->pack_start(*button_image_delete);
119         image_buttons->pack_start(*button_image_rename);
120         image_buttons->pack_start(*button_image_copy);
121
122         studio::Instance::ValueNodeColumnModel valuenode_column_model;
123         valuenode_list=manage(new class Gtk::TreeView());
124         valuenode_list->append_column(_("Name"),valuenode_column_model.name);
125         valuenode_list->signal_row_activated().connect(sigc::mem_fun(*this,&CompView::on_valuenode_activate));
126         valuenode_list->set_rules_hint();
127
128         Gtk::Table *valuenode_page = manage(new class Gtk::Table(2, 1, false));
129         Gtk::ScrolledWindow *valuenode_list_scroll = manage(new class Gtk::ScrolledWindow());
130         valuenode_list_scroll->set_flags(Gtk::CAN_FOCUS);
131         valuenode_list_scroll->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
132         valuenode_list_scroll->add(*valuenode_list);
133         valuenode_page->attach(*valuenode_list_scroll, 0, 1, 0, 1, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0);
134         Gtk::HBox *valuenode_buttons=manage(new class Gtk::HBox());
135         valuenode_page->attach(*valuenode_buttons, 0, 1, 1,2, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK, 0, 0);
136         ADD_TOOLBOX_BUTTON(button_valuenode_new,"gtk-new",_("Create a new value_node"));
137         ADD_TOOLBOX_BUTTON(button_valuenode_delete,"gtk-delete",_("Delete value_node"));
138         ADD_TOOLBOX_BUTTON(button_valuenode_rename,"gtk-rename",_("Rename value_node"));
139         ADD_TOOLBOX_BUTTON(button_valuenode_copy,"gtk-copy",_("Duplicate value_node"));
140         button_valuenode_new->signal_clicked().connect(sigc::mem_fun(*this,&CompView::new_value_node));
141         button_valuenode_delete->signal_clicked().connect(sigc::mem_fun(*this,&CompView::delete_value_node));
142         button_valuenode_rename->signal_clicked().connect(sigc::mem_fun(*this,&CompView::rename_value_node));
143         button_valuenode_copy->signal_clicked().connect(sigc::mem_fun(*this,&CompView::copy_value_node));
144         valuenode_buttons->pack_start(*button_valuenode_new);
145         valuenode_buttons->pack_start(*button_valuenode_delete);
146         valuenode_buttons->pack_start(*button_valuenode_rename);
147         valuenode_buttons->pack_start(*button_valuenode_copy);
148
149
150         notebook->append_page(*image_page,_("Images"));
151         notebook->append_page(*valuenode_page,_("ValueNodes"));
152
153         image_page->show_all();
154         valuenode_page->show_all();
155 */
156 //      notebook->set_current_page(0);
157         signal_delete_event().connect(sigc::hide(sigc::mem_fun(*this, &CompView::close)));
158         App::signal_instance_created().connect(sigc::mem_fun(*this,&studio::CompView::new_instance));
159         App::signal_instance_deleted().connect(sigc::mem_fun(*this,&studio::CompView::delete_instance));
160         App::signal_instance_selected().connect(sigc::mem_fun(*this,&studio::CompView::set_selected_instance_signal));
161
162         table->show_all();
163         add(*table);
164
165
166         set_title(_("Canvas Browser"));
167         set_modal(false);
168         set_resizable(true);
169         property_window_position().set_value(Gtk::WIN_POS_NONE);
170         set_default_size(200,300);
171 }
172
173 CompView::~CompView()
174 {
175 }
176
177 etl::loose_handle<studio::CanvasView>
178 CompView::get_selected_canvas_view()
179 {
180         return get_selected_instance()->find_canvas_view(get_selected_canvas());
181 }
182
183 Gtk::Widget*
184 CompView::create_canvas_tree()
185 {
186         studio::Instance::CanvasTreeModel canvas_tree_model;
187         canvas_tree=manage(new class Gtk::TreeView());
188         {
189                 Gtk::TreeView::Column* column = Gtk::manage( new Gtk::TreeView::Column(_("ID")) );
190 //              Gtk::CellRendererPixbuf* icon_cellrenderer = Gtk::manage( new Gtk::CellRendererPixbuf() );
191
192                 //column->pack_start(*icon_cellrenderer,false);
193                 column->pack_start(canvas_tree_model.icon, false); //false = don't expand.
194                 column->pack_start(canvas_tree_model.label);
195
196 //#ifdef NDEBUG
197 //              column->add_attribute(icon_cellrenderer->property_pixbuf(), canvas_tree_model.icon);
198 //#endif
199
200                 canvas_tree->append_column(*column);
201         }
202         canvas_tree->set_rules_hint();
203         canvas_tree->signal_row_activated().connect(sigc::mem_fun(*this,&CompView::on_row_activate));
204         canvas_tree->signal_event().connect(sigc::mem_fun(*this,&CompView::on_tree_event));
205         canvas_tree->add_events(Gdk::BUTTON_PRESS_MASK | Gdk::BUTTON_RELEASE_MASK);
206         canvas_tree->add_events(Gdk::BUTTON1_MOTION_MASK);
207         canvas_tree->show();
208
209         Gtk::ScrolledWindow *scrolledwindow = manage(new class Gtk::ScrolledWindow());
210         scrolledwindow->set_flags(Gtk::CAN_FOCUS);
211         scrolledwindow->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
212         scrolledwindow->add(*canvas_tree);
213         scrolledwindow->set_shadow_type(Gtk::SHADOW_ETCHED_IN);
214         scrolledwindow->show();
215
216         return scrolledwindow;
217 }
218
219 Gtk::Widget*
220 CompView::create_action_tree()
221 {
222         studio::HistoryTreeStore::Model history_tree_model;
223         action_tree=manage(new class Gtk::TreeView());
224         {
225                 Gtk::TreeView::Column* column = Gtk::manage( new Gtk::TreeView::Column("") );
226
227                 Gtk::CellRendererToggle* toggle_cr = Gtk::manage( new Gtk::CellRendererToggle() );
228                 toggle_cr->signal_toggled().connect(sigc::mem_fun(*this, &studio::CompView::on_action_toggle) );
229
230                 column->pack_start(*toggle_cr); //false = don't expand.
231                 column->add_attribute(toggle_cr->property_active(),history_tree_model.is_active);
232                 column->set_resizable();
233                 column->set_clickable();
234
235                 action_tree->append_column(*column);
236         }
237         /*{
238                 Gtk::TreeView::Column* column = Gtk::manage( new Gtk::TreeView::Column(_("Canvas")) );
239                 Gtk::CellRendererText *text_cr=Gtk::manage(new Gtk::CellRendererText());
240                 text_cr->property_foreground()=Glib::ustring("#7f7f7f");
241
242                 column->pack_start(*text_cr);
243                 column->add_attribute(text_cr->property_text(),history_tree_model.canvas_id);
244                 column->add_attribute(text_cr->property_foreground_set(),history_tree_model.is_redo);
245
246                 action_tree->append_column(*column);
247         }*/
248         {
249                 Gtk::TreeView::Column* column = Gtk::manage( new Gtk::TreeView::Column(_("Jump")) );
250
251                 Gtk::CellRendererText* cell_renderer_jump=Gtk::manage(new Gtk::CellRendererText());
252                 column->pack_start(*cell_renderer_jump,true);
253
254                 cell_renderer_jump->property_text()=_("(JMP)");
255                 cell_renderer_jump->property_foreground()="#003a7f";
256
257                 column->set_resizable();
258                 column->set_clickable();
259
260                 column->set_sort_column(COLUMNID_JUMP);
261
262                 action_tree->append_column(*column);
263                 //column->clicked();
264         }
265         {
266                 Gtk::TreeView::Column* column = Gtk::manage( new Gtk::TreeView::Column(_("Action")) );
267
268                 Gtk::CellRendererText *text_cr=Gtk::manage(new Gtk::CellRendererText());
269                 text_cr->property_foreground()=Glib::ustring("#7f7f7f");
270
271
272
273                 //column->pack_start(history_tree_model.icon, false); //false = don't expand.
274                 column->pack_start(*text_cr);
275                 column->add_attribute(text_cr->property_text(),history_tree_model.name);
276                 column->add_attribute(text_cr->property_foreground_set(),history_tree_model.is_redo);
277
278                 action_tree->append_column(*column);
279         }
280
281
282         action_tree->set_rules_hint();
283 //      action_tree->signal_row_activated().connect(sigc::mem_fun(*this,&CompView::on_row_activate));
284         action_tree->signal_event().connect(sigc::mem_fun(*this,&CompView::on_action_event));
285 //      action_tree->add_events(Gdk::BUTTON_PRESS_MASK | Gdk::BUTTON_RELEASE_MASK);
286 //      action_tree->add_events(Gdk::BUTTON1_MOTION_MASK);
287         action_tree->show();
288
289         Gtk::ScrolledWindow *scrolledwindow = manage(new class Gtk::ScrolledWindow());
290         scrolledwindow->set_flags(Gtk::CAN_FOCUS);
291         scrolledwindow->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
292         scrolledwindow->add(*action_tree);
293         scrolledwindow->set_shadow_type(Gtk::SHADOW_ETCHED_IN);
294         scrolledwindow->show();
295
296         Gtk::Button* clear_button(manage(new Gtk::Button(_("Clear Undo"))));
297         clear_button->signal_pressed().connect(sigc::mem_fun(*this,&studio::CompView::clear_history));
298
299         Gtk::Button* clear_redo_button(manage(new Gtk::Button(_("Clear Redo"))));
300         clear_redo_button->signal_pressed().connect(sigc::mem_fun(*this,&studio::CompView::clear_redo));
301
302         Gtk::Table* table(manage(new Gtk::Table()));
303         table->attach(*scrolledwindow, 0, 2, 0,1, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0);
304         table->attach(*clear_button, 0, 1, 1,2, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK, 0, 0);
305         table->attach(*clear_redo_button, 1, 2, 1,2, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK, 0, 0);
306
307         table->show_all();
308
309         return table;
310 }
311
312 Gtk::Widget*
313 CompView::create_instance_selector()
314 {
315         instance_selector=manage(new class Gtk::OptionMenu());
316         instance_selector->show();
317         instance_selector->set_menu(instance_list_menu);
318         return instance_selector;
319 }
320
321 bool
322 CompView::close()
323 {
324         hide();
325         return true;
326 }
327
328 void
329 CompView::clear_history()
330 {
331         if(selected_instance && App::dialog_yes_no(_("Clear History"), _("You will not be able to undo any changes that you have made!\nAre you sure you want to clear the undo stack?")))
332         {
333                 selected_instance->clear_undo_stack();
334         }
335 }
336
337 void
338 CompView::clear_redo()
339 {
340         if(selected_instance && App::dialog_yes_no(_("Clear History"), _("You will not be able to redo any changes that you have made!\nAre you sure you want to clear the redo stack?")))
341         {
342                 selected_instance->clear_redo_stack();
343         }
344 }
345
346 void
347 CompView::init_menu()
348 {
349         menu.items().push_back(Gtk::Menu_Helpers::SeparatorElem());
350         menu.items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("synfig-canvas_new"),
351                 sigc::mem_fun(*this,&CompView::menu_new_canvas)));
352         menu.items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("gtk-delete"),
353                 sigc::mem_fun(*this,&CompView::menu_delete)));
354         menu.items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("synfig-rename"),
355                 sigc::mem_fun(*this,&CompView::menu_rename)));
356 }
357
358 etl::loose_handle<synfig::Canvas>
359 CompView::get_selected_canvas()
360 {
361         Glib::RefPtr<Gtk::TreeSelection> selection=canvas_tree->get_selection();
362
363         if(!selection || !selection->get_selected())
364                 return 0;
365
366         studio::Instance::CanvasTreeModel canvas_tree_model;
367
368         return static_cast<etl::handle<synfig::Canvas> >((*selection->get_selected())[canvas_tree_model.canvas]);
369 }
370
371 void
372 CompView::menu_new_canvas()
373 {
374 #warning Update Me!
375 #if 0
376         get_selected_canvas_view()->new_child_canvas();
377 #endif
378 }
379
380 void
381 CompView::menu_delete()
382 {
383         studio::App::dialog_not_implemented();
384 }
385
386 void
387 CompView::menu_rename()
388 {
389         studio::App::dialog_not_implemented();
390 }
391
392 void
393 CompView::set_selected_instance_signal(etl::handle<studio::Instance> x)
394 {
395         set_selected_instance(x);
396 }
397
398 void
399 CompView::set_selected_instance_(etl::handle<studio::Instance> instance)
400 {
401         if(studio::App::shutdown_in_progress)
402                 return;
403
404         selected_instance=instance;
405         if(instance)
406         {
407                 canvas_tree->set_model(instance->canvas_tree_store());
408                 action_tree->set_model(instance->history_tree_store());
409                 canvas_tree->show();
410                 action_tree->show();
411         }
412         else
413         {
414                 canvas_tree->set_model(Glib::RefPtr< Gtk::TreeModel >());
415                 action_tree->set_model(Glib::RefPtr< Gtk::TreeModel >());
416                 canvas_tree->hide();
417                 action_tree->hide();
418         }
419 }
420
421 void
422 CompView::set_selected_instance(etl::loose_handle<studio::Instance> x)
423 {
424         if(studio::App::shutdown_in_progress)
425                 return;
426
427         // if it's already selected, don't select it again
428         if (x==selected_instance)
429                 return;
430
431         std::list<etl::handle<studio::Instance> >::iterator iter;
432
433         if(x)
434         {
435                 int i;
436                 for(i=0,iter=studio::App::instance_list.begin();iter!=studio::App::instance_list.end() && ((*iter)!=x);iter++,i++);
437
438                 assert(*iter==x);
439
440                 instance_selector->set_history(i);
441         }
442         else
443                 instance_selector->set_history(0);
444
445         set_selected_instance_(x);
446 }
447
448 void
449 CompView::new_instance(etl::handle<studio::Instance> instance)
450 {
451         if(studio::App::shutdown_in_progress)
452                 return;
453
454         assert(instance);
455
456         etl::loose_handle<studio::Instance> loose_instance(instance);
457
458         instance->synfigapp::Instance::signal_filename_changed().connect(sigc::mem_fun(*this,&CompView::refresh_instances));
459         instance->synfigapp::Instance::signal_filename_changed().connect(
460                 sigc::bind<etl::loose_handle<studio::Instance> >(
461                         sigc::mem_fun(*this,&CompView::set_selected_instance),
462                         loose_instance
463                 )
464         );
465
466         {
467                 std::string name=basename(instance->get_file_name());
468
469                 instance_list_menu.items().push_back(Gtk::Menu_Helpers::MenuElem(name,
470                         sigc::bind<etl::loose_handle<studio::Instance> >(sigc::mem_fun(&studio::App::set_selected_instance),loose_instance)     ));
471         }
472 }
473
474 void
475 CompView::delete_instance(etl::handle<studio::Instance> instance)
476 {
477         if(studio::App::shutdown_in_progress)
478                 return;
479
480         refresh_instances();
481
482         if(selected_instance==instance)
483         {
484                 set_selected_instance(0);
485                 instance_selector->set_history(0);
486         }
487 }
488
489 void
490 CompView::refresh_instances()
491 {
492         if(studio::App::shutdown_in_progress)
493                 return;
494
495         if(!instance_list_menu.items().empty())
496                 instance_list_menu.items().clear();
497
498         std::list<etl::handle<studio::Instance> >::iterator iter;
499         for(iter=studio::App::instance_list.begin();iter!=studio::App::instance_list.end();iter++)
500         {
501                 std::string name=basename((*iter)->get_file_name());
502
503                 instance_list_menu.items().push_back(Gtk::Menu_Helpers::MenuElem(name,
504                         sigc::bind<etl::loose_handle<studio::Instance> >(sigc::mem_fun(&studio::App::set_selected_instance),*iter)      ));
505         }
506         instance_selector->set_menu(instance_list_menu);
507 }
508
509 void
510 CompView::on_row_activate(const Gtk::TreeModel::Path &path, Gtk::TreeViewColumn *)
511 {
512         assert(get_selected_instance());
513         studio::Instance::CanvasTreeModel canvas_tree_model;
514         const Gtk::TreeRow row = *(get_selected_instance()->canvas_tree_store()->get_iter(path));
515         if(row[canvas_tree_model.is_canvas])
516                 get_selected_instance()->focus(row[canvas_tree_model.canvas]);
517         else
518                 studio::App::dialog_not_implemented();
519 }
520
521 bool
522 CompView::on_action_event(GdkEvent *event)
523 {
524         studio::HistoryTreeStore::Model model;
525     switch(event->type)
526     {
527         case GDK_BUTTON_PRESS:
528         case GDK_2BUTTON_PRESS:
529                 {
530                         Gtk::TreeModel::Path path;
531                         Gtk::TreeViewColumn *column;
532                         int cell_x, cell_y;
533                         if(!action_tree->get_path_at_pos(
534                                 int(event->button.x),int(event->button.y),      // x, y
535                                 path, // TreeModel::Path&
536                                 column, //TreeViewColumn*&
537                                 cell_x,cell_y //int&cell_x,int&cell_y
538                                 )
539                         ) break;
540                         const Gtk::TreeRow row = *(action_tree->get_model()->get_iter(path));
541
542                         //signal_user_click()(event->button.button,row,(ColumnID)column->get_sort_column_id());
543                         if((ColumnID)column->get_sort_column_id()==COLUMNID_JUMP)
544                         {
545                                 etl::handle<synfigapp::Action::Undoable> action(row[model.action]);
546                                 if((bool)row[model.is_undo])
547                                 {
548                                         while(get_selected_instance()->undo_action_stack().size() && get_selected_instance()->undo_action_stack().front()!=action)
549                                                 get_selected_instance()->undo();
550                                 }
551                                 else if((bool)row[model.is_redo])
552                                 {
553                                         while(get_selected_instance()->redo_action_stack().size() && get_selected_instance()->undo_action_stack().front()!=action)
554                                                 get_selected_instance()->redo();
555                                 }
556                         }
557                 }
558
559         case GDK_BUTTON_RELEASE:
560                 break;
561         default:
562                 break;
563         }
564         return false;
565 }
566
567 bool
568 CompView::on_tree_event(GdkEvent *event)
569 {
570     switch(event->type)
571     {
572         case GDK_BUTTON_PRESS:
573                 switch(event->button.button)
574                 {
575                 case 3:
576                 if(get_selected_canvas())
577                 {
578                         menu.items().clear();
579
580                         synfigapp::Action::ParamList param_list;
581                         param_list.add("canvas",synfig::Canvas::Handle(get_selected_canvas()));
582                         param_list.add("canvas_interface",get_selected_instance()->find_canvas_interface(get_selected_canvas()));
583                         get_selected_instance()->find_canvas_view(get_selected_canvas())->add_actions_to_menu(&menu, param_list,synfigapp::Action::CATEGORY_CANVAS);
584                         menu.popup(0,0);
585                         menu.show();
586                         break;
587                 }
588                 default:
589                         break;
590                 }
591                 break;
592         case GDK_MOTION_NOTIFY:
593                 break;
594         case GDK_BUTTON_RELEASE:
595                 break;
596         default:
597                 break;
598         }
599         return false;
600 }
601
602 void
603 CompView::on_action_toggle(const Glib::ustring& path_string)
604 {
605         studio::HistoryTreeStore::Model history_tree_model;
606
607         Gtk::TreePath path(path_string);
608
609         const Gtk::TreeRow row = *(selected_instance->history_tree_store()->get_iter(path));
610
611         handle<synfigapp::Action::Undoable> action=row[history_tree_model.action];
612
613         selected_instance->synfigapp::Instance::set_action_status(action,!action->is_active());
614 }