**
** \legal
** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
+** Copyright (c) 2007, 2008 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
#include <synfig/valuenode_dynamiclist.h>
#include <synfig/valuenode_twotone.h>
#include <synfig/valuenode_stripes.h>
+#include <synfig/valuenode_blinecalctangent.h>
+#include <synfig/valuenode_blinecalcvertex.h>
+#include <synfig/valuenode_blinecalcwidth.h>
+#include <synfig/valuenode_bline.h>
#include <synfig/layer.h>
#include <synfigapp/uimanager.h>
#include <synfigapp/main.h>
#include <synfigapp/inputdevice.h>
+#include "general.h"
+
#endif
/* === U S I N G =========================================================== */
using namespace etl;
using namespace synfig;
using namespace studio;
-using namespace SigC;
+using namespace sigc;
/* === M A C R O S ========================================================= */
#define DEFAULT_TIME_WINDOW_SIZE (10.0)
-/*
-#ifdef DEBUGPOINT
-#undef DEBUGPOINT
-#endif
-#define DEBUGPOINT()
-*/
-
#ifndef SMALL_BUTTON
#define SMALL_BUTTON(button,stockid,tooltip) \
button = manage(new class Gtk::Button()); \
/* === C L A S S E S ======================================================= */
-
class studio::UniversalScrubber
{
CanvasView *canvas_view;
}
};
-
class studio::CanvasViewUIInterface : public synfigapp::UIInterface
{
CanvasView *view;
CanvasViewUIInterface(CanvasView *view):
view(view)
{
-
- view->statusbar->push("Idle");
+ view->statusbar->push(_("Idle"));
}
~CanvasViewUIInterface()
virtual bool
error(const std::string &err)
{
- view->statusbar->push("ERROR");
+ view->statusbar->push(_("ERROR"));
// If we are in the process of canceling,
// then just go ahead and return false --
void
not_implemented()
{
- error("Feature not yet implemented");
+ error(_("Feature not yet implemented"));
}
};
CanvasView *view;
CanvasView::LayerTreeModel layer_tree_model;
CanvasView::ChildrenTreeModel children_tree_model;
-public:
-
- CanvasViewSelectionManager(CanvasView *view): view(view)
-{
-
- }
+public:
+ CanvasViewSelectionManager(CanvasView *view): view(view) { }
private:
void _set_selected_layer(const synfig::Layer::Handle &layer)
{
// assert(view->layer_tree);
- if(!view->layer_tree) { DEBUGPOINT(); synfig::error("canvas_view.layer_tree not defined!?"); return LayerList(); }
+ if(!view->layer_tree) { synfig::error("%s:%d canvas_view.layer_tree not defined!?", __FILE__, __LINE__); return LayerList(); }
return view->layer_tree->get_selected_layers();
}
{
// assert(view->layer_tree);
- if(!view->layer_tree) { DEBUGPOINT(); synfig::error("canvas_view.layer_tree not defined!?"); return 0; }
+ if(!view->layer_tree) { synfig::error("%s:%d canvas_view.layer_tree not defined!?", __FILE__, __LINE__); return 0; }
return view->layer_tree->get_selected_layer();
}
{
// assert(view->layer_tree);
- if(!view->layer_tree) { DEBUGPOINT(); synfig::error("canvas_view.layer_tree not defined!?"); return; }
+ if(!view->layer_tree) { synfig::error("%s:%d canvas_view.layer_tree not defined!?", __FILE__, __LINE__); return; }
view->layer_tree->select_layers(layer_list);
//view->get_smach().process_event(EVENT_REFRESH_DUCKS);
{
// assert(view->layer_tree);
- if(!view->layer_tree) { DEBUGPOINT(); synfig::error("canvas_view.layer_tree not defined!?"); return; }
+ if(!view->layer_tree) { synfig::error("canvas_view.layer_tree not defined!?"); return; }
view->layer_tree->select_layer(layer);
//view->queue_rebuild_ducks();
}
view->layer_tree->clear_selected_layers();
}
-
-
//! Returns the number of value_nodes selected.
virtual int get_selected_children_count()const
{
}
//! Sets which value_nodes should be selected
- virtual void set_selected_children(const ChildrenList &children_list)
+ virtual void set_selected_children(const ChildrenList &/*children_list*/)
{
return;
}
//! Sets which value_node should be selected. Empty handle if none.
- virtual void set_selected_child(const ChildrenList::value_type &child)
+ virtual void set_selected_child(const ChildrenList::value_type &/*child*/)
{
return;
}
return;
}
-
-
int get_selected_layer_parameter_count()const
{
return get_selected_layer_parameters().size();
return get_selected_layer_parameters().front();
}
- void set_selected_layer_parameters(const LayerParamList &layer_param_list)
+ void set_selected_layer_parameters(const LayerParamList &/*layer_param_list*/)
{
return;
}
- void set_selected_layer_param(const LayerParam &layer_param)
+ void set_selected_layer_param(const LayerParam &/*layer_param*/)
{
return;
}
}; // END of class SelectionManager
-
CanvasView::IsWorking::IsWorking(CanvasView &canvas_view_):
canvas_view_(canvas_view_)
{
//vpaned->pack2(*notebook, Gtk::SHRINK);
//vpaned->show_all();
-
//notebook->show();
- //notebook->append_page(*create_layer_tree(),"Layers");
- //notebook->append_page(*create_children_tree(),"Children");
- //notebook->append_page(*create_keyframe_tree(),"Keyframes");
+ //notebook->append_page(*create_layer_tree(),_("Layers"));
+ //notebook->append_page(*create_children_tree(),_("Children"));
+ //notebook->append_page(*create_keyframe_tree(),_("Keyframes"));
//synfig::info("Canvasview: Before big chunk of allocation and tabling stuff");
//create all allocated stuff for this canvas
init_menus();
//layout_table->attach(*App::ui_manager()->get_widget("/menu-main"), 0, 1, 0, 1, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0);
-
layout_table->attach(*create_time_bar(), 0, 1, 3, 4, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0);
layout_table->attach(*create_status_bar(), 0, 1, 4, 5, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0);
time_window_adjustment().signal_value_changed().connect(sigc::mem_fun(*this,&studio::CanvasView::refresh_time_window));
time_adjustment().signal_value_changed().connect(sigc::mem_fun(*this,&studio::CanvasView::time_was_changed));
-
work_area->signal_layer_selected().connect(sigc::mem_fun(*this,&studio::CanvasView::workarea_layer_selected));
work_area->signal_input_device_changed().connect(sigc::mem_fun(*this,&studio::CanvasView::on_input_device_changed));
)
);
-
//MUCH TIME STUFF TAKES PLACE IN HERE
refresh_rend_desc();
refresh_time_window();
/*! \todo We shouldn't need to do this at construction --
- ** This should be preformed at the first time the window
+ ** This should be performed at the first time the window
** becomes visible.
*/
work_area->queue_render_preview();
int h=get_canvas()->rend_desc().get_h()+70;
while(w>700 || h>600)
{
+ // Minor hack:
+ // zoom_out() =>
+ // WorkArea::async_update_preview() =>
+ // WorkArea::set_zoom(float) =>
+ // WorkArea::async_update_preview() =>
+ // desc.set_time(cur_time), where cur_time isn't initialized
+ work_area->set_time(0);
work_area->zoom_out();
w=round_to_int(get_canvas()->rend_desc().get_w()*work_area->get_zoom()+70);
h=round_to_int(get_canvas()->rend_desc().get_h()*work_area->get_zoom()+70);
set_default_size(w,h);
property_window_position().set_value(Gtk::WIN_POS_NONE);
-
-
-
std::list<Gtk::TargetEntry> listTargets;
listTargets.push_back( Gtk::TargetEntry("STRING") );
listTargets.push_back( Gtk::TargetEntry("text/plain") );
drag_dest_set(listTargets);
signal_drag_data_received().connect( sigc::mem_fun(*this, &studio::CanvasView::on_drop_drag_data_received) );
-
/*
Time length(get_canvas()->rend_desc().get_time_end()-get_canvas()->rend_desc().get_time_start());
if(length<10.0)
time_window_adjustment().set_value(get_canvas()->rend_desc().get_time_start());
time_window_adjustment().value_changed();
-
GRAB_HINT_DATA("canvas_view");
/*
{
hide();
- synfig::info("CanvasView:~CanvasView(): Destructor Finished");
+ // don't be calling on_dirty_preview once this object has been deleted;
+ // this was causing a crash before
+ canvas_interface()->signal_dirty_preview().clear();
+
+ if (getenv("SYNFIG_DEBUG_DESTRUCTORS"))
+ synfig::info("CanvasView::~CanvasView(): Deleted");
}
+std::list<int>&
+CanvasView::get_pixel_sizes()
+{
+ // prime factors of 120 are 2, 2, 2, 3, 5 - see TILE_SIZE in synfig-core/trunk/src/synfig/target_tile.h
+ static int pixel_size_array[] = {2,3,4,5,6,8,10,12,15,20,24,30,40,60,120};
+ static list<int> pixel_sizes = list<int>(pixel_size_array, pixel_size_array + sizeof(pixel_size_array) / sizeof(int));
+ return pixel_sizes;
+}
Gtk::Widget *
CanvasView::create_time_bar()
timeslider->set_bounds_adjustment(&time_window_adjustment());
//layout_table->attach(*timeslider, 0, 1, 2, 3, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL);
-
tooltips.set_tip(*time_window_scroll,_("Moves the time window"));
tooltips.set_tip(*timeslider,_("Changes the current time"));
time_window_scroll->show();
//time_scroll->signal_value_changed().connect(sigc::mem_fun(*work_area, &studio::WorkArea::render_preview_hook));
//time_scroll->set_update_policy(Gtk::UPDATE_DISCONTINUOUS);
- NORMAL_BUTTON(animatebutton,"gtk-yes","Animate");
+ NORMAL_BUTTON(animatebutton,"gtk-yes",_("Animate"));
animatebutton->signal_clicked().connect(sigc::mem_fun(*this, &studio::CanvasView::on_animate_button_pressed));
animatebutton->show();
- NORMAL_BUTTON(keyframebutton,"synfig-keyframe_lock_all","All Keyframes Locked");
+ NORMAL_BUTTON(keyframebutton,"synfig-keyframe_lock_all",_("All Keyframes Locked"));
keyframebutton->signal_clicked().connect(sigc::mem_fun(*this, &studio::CanvasView::on_keyframe_button_pressed));
keyframebutton->show();
return work_area.get();
}
-
Gtk::Widget*
CanvasView::create_status_bar()
{
Gtk::Table *statusbartable= manage(new class Gtk::Table(7, 1, false));
// statusbar = manage(new class Gtk::Statusbar()); // This is already done at construction
progressbar =manage(new class Gtk::ProgressBar());
- SMALL_BUTTON(stopbutton,"gtk-stop","Stop");
- SMALL_BUTTON(refreshbutton,"gtk-refresh","Refresh");
- //SMALL_BUTTON(treetogglebutton,"gtk-go-down","Toggle Layer Tree");
-// NEW_SMALL_BUTTON(raisebutton,"gtk-go-up","Raise Layer");
-// NEW_SMALL_BUTTON(lowerbutton,"gtk-go-down","Lower Layer");
+ SMALL_BUTTON(stopbutton,"gtk-stop",_("Stop"));
+ SMALL_BUTTON(refreshbutton,"gtk-refresh",_("Refresh"));
+ //SMALL_BUTTON(treetogglebutton,"gtk-go-down",_("Toggle Layer Tree"));
+// NEW_SMALL_BUTTON(raisebutton,"gtk-go-up",_("Raise Layer"));
+// NEW_SMALL_BUTTON(lowerbutton,"gtk-go-down",_("Lower Layer"));
//statusbartable->attach(*treetogglebutton, 0, 1, 0, 1, Gtk::SHRINK, Gtk::SHRINK, 0, 0);
// statusbartable->attach(*lowerbutton, 0, 1, 0, 1, Gtk::SHRINK, Gtk::SHRINK, 0, 0);
// statusbartable->attach(*raisebutton, 1, 2, 0, 1, Gtk::SHRINK, Gtk::SHRINK, 0, 0);
-
current_time_widget=manage(new Widget_Time);
current_time_widget->set_value(get_time());
current_time_widget->set_fps(get_canvas()->rend_desc().get_frame_rate());
refreshbutton->signal_clicked().connect(SLOT_EVENT(EVENT_REFRESH));
stopbutton->signal_clicked().connect(SLOT_EVENT(EVENT_STOP));
-
statusbartable->show_all();
return statusbartable;
}
CanvasView::on_current_time_widget_changed()
{
set_time(current_time_widget->get_value());
-}
-
-Gtk::Widget*
-CanvasView::create_children_tree()
-{
- // Create the layer tree
- children_tree=manage(new class ChildrenTree());
-
- // Set up the layer tree
- //children_tree->set_model(children_tree_store());
- if(children_tree)children_tree->set_time_adjustment(time_adjustment());
- if(children_tree)children_tree->show();
-
- // Connect Signals
- if(children_tree)children_tree->signal_edited_value().connect(sigc::mem_fun(*this, &studio::CanvasView::on_edited_value));
- if(children_tree)children_tree->signal_user_click().connect(sigc::mem_fun(*this, &studio::CanvasView::on_children_user_click));
- if(children_tree)children_tree->signal_waypoint_clicked().connect(sigc::mem_fun(*this, &studio::CanvasView::on_waypoint_clicked));
- if(children_tree)children_tree->get_selection()->signal_changed().connect(SLOT_EVENT(EVENT_REFRESH_DUCKS));
-
- return children_tree;
-}
-
-Gtk::Widget*
-CanvasView::create_keyframe_tree()
-{
- keyframe_tree=manage(new KeyframeTree());
-
- //keyframe_tree->get_selection()->set_mode(Gtk::SELECTION_MULTIPLE);
- //keyframe_tree->show();
- //keyframe_tree->set_model(keyframe_tree_store());
- keyframe_tree->set_editable(true);
- //keyframe_tree->signal_edited().connect(sigc::hide_return(sigc::mem_fun(*canvas_interface(), &synfigapp::CanvasInterface::update_keyframe)));
-
- keyframe_tree->signal_event().connect(sigc::mem_fun(*this, &studio::CanvasView::on_keyframe_tree_event));
-
- Gtk::ScrolledWindow *scroll_layer_tree = manage(new class Gtk::ScrolledWindow());
- scroll_layer_tree->set_flags(Gtk::CAN_FOCUS);
- scroll_layer_tree->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
- scroll_layer_tree->add(*keyframe_tree);
- scroll_layer_tree->set_shadow_type(Gtk::SHADOW_ETCHED_IN);
- //scroll_layer_tree->show();
-
- Gtk::Table *layout_table= manage(new Gtk::Table(1, 2, false));
- layout_table->attach(*scroll_layer_tree, 0, 1, 0, 1, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0);
-
- Gtk::Image *icon;
- Gtk::IconSize iconsize(Gtk::IconSize::from_name("synfig-small_icon"));
-
- NEW_SMALL_BUTTON(button_add,"gtk-add","New Keyframe");
- NEW_SMALL_BUTTON(button_duplicate,"synfig-duplicate","Duplicate Keyframe");
- NEW_SMALL_BUTTON(button_delete,"gtk-delete","Delete Keyframe");
-
- Gtk::HBox *hbox(manage(new Gtk::HBox()));
- layout_table->attach(*hbox, 0, 1, 1, 2, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK, 0, 0);
-
- hbox->pack_start(*button_add,Gtk::PACK_SHRINK);
- hbox->pack_start(*button_duplicate,Gtk::PACK_SHRINK);
- hbox->pack_start(*button_delete,Gtk::PACK_SHRINK);
-
- /*
- button_raise->set_relief(Gtk::RELIEF_HALF);
- button_lower->set_relief(Gtk::RELIEF_HALF);
- button_duplicate->set_relief(Gtk::RELIEF_HALF);
- button_delete->set_relief(Gtk::RELIEF_HALF);
- */
-
- button_add->signal_clicked().connect(sigc::mem_fun(*this, &studio::CanvasView::on_keyframe_add_pressed));
- button_duplicate->signal_clicked().connect(sigc::mem_fun(*this, &studio::CanvasView::on_keyframe_duplicate_pressed));
- button_delete->signal_clicked().connect(sigc::mem_fun(*this, &studio::CanvasView::on_keyframe_remove_pressed));
-
- //layout_table->show_all();
-
- keyframe_tab_child=layout_table;
-
-
- layout_table->hide();
-
- return layout_table;
-}
-
-Gtk::Widget*
-CanvasView::create_layer_tree()
-{
- // Create the layer tree
- layer_tree=manage(new class LayerTree());
-
- // Set up the layer tree
- //layer_tree->set_model(layer_tree_store());
- layer_tree->set_time_adjustment(time_adjustment());
- layer_tree->show();
-
- // Connect Signals
- layer_tree->signal_layer_toggle().connect(sigc::mem_fun(*this, &studio::CanvasView::on_layer_toggle));
- layer_tree->signal_edited_value().connect(sigc::mem_fun(*this, &studio::CanvasView::on_edited_value));
- layer_tree->signal_layer_user_click().connect(sigc::mem_fun(*this, &studio::CanvasView::on_layer_user_click));
- layer_tree->signal_param_user_click().connect(sigc::mem_fun(*this, &studio::CanvasView::on_children_user_click));
- layer_tree->signal_waypoint_clicked().connect(sigc::mem_fun(*this, &studio::CanvasView::on_waypoint_clicked));
- layer_tree->get_selection()->signal_changed().connect(SLOT_EVENT(EVENT_REFRESH_DUCKS));
-
- layer_tree->hide();
- return layer_tree;
-}
+ // show the value being used - it will have been rounded to nearest frame
+ // this was already being done elsewhere, but only if the time was really changed;
+ // if the current time was 6f and the user edited it to 6.1f, then the 6.1f would
+ // be left in the display without the following line to fix it
+ current_time_widget->set_value(get_time());
+ current_time_widget->set_position(-1); // leave the cursor at the end
+}
+
+// Gtk::Widget*
+// CanvasView::create_children_tree()
+// {
+// // Create the layer tree
+// children_tree=manage(new class ChildrenTree());
+//
+// // Set up the layer tree
+// //children_tree->set_model(children_tree_store());
+// if(children_tree)children_tree->set_time_adjustment(time_adjustment());
+// if(children_tree)children_tree->show();
+//
+// // Connect Signals
+// if(children_tree)children_tree->signal_edited_value().connect(sigc::mem_fun(*this, &studio::CanvasView::on_edited_value));
+// if(children_tree)children_tree->signal_user_click().connect(sigc::mem_fun(*this, &studio::CanvasView::on_children_user_click));
+// if(children_tree)children_tree->signal_waypoint_clicked_childrentree().connect(sigc::mem_fun(*this, &studio::CanvasView::on_waypoint_clicked_canvasview));
+// if(children_tree)children_tree->get_selection()->signal_changed().connect(SLOT_EVENT(EVENT_REFRESH_DUCKS));
+//
+// return children_tree;
+// }
+
+// Gtk::Widget*
+// CanvasView::create_keyframe_tree()
+// {
+// keyframe_tree=manage(new KeyframeTree());
+//
+// //keyframe_tree->get_selection()->set_mode(Gtk::SELECTION_MULTIPLE);
+// //keyframe_tree->show();
+// //keyframe_tree->set_model(keyframe_tree_store());
+// keyframe_tree->set_editable(true);
+// //keyframe_tree->signal_edited().connect(sigc::hide_return(sigc::mem_fun(*canvas_interface(), &synfigapp::CanvasInterface::update_keyframe)));
+//
+// keyframe_tree->signal_event().connect(sigc::mem_fun(*this, &studio::CanvasView::on_keyframe_tree_event));
+//
+// Gtk::ScrolledWindow *scroll_layer_tree = manage(new class Gtk::ScrolledWindow());
+// scroll_layer_tree->set_flags(Gtk::CAN_FOCUS);
+// scroll_layer_tree->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
+// scroll_layer_tree->add(*keyframe_tree);
+// scroll_layer_tree->set_shadow_type(Gtk::SHADOW_ETCHED_IN);
+// //scroll_layer_tree->show();
+//
+//
+// Gtk::Table *layout_table= manage(new Gtk::Table(1, 2, false));
+// layout_table->attach(*scroll_layer_tree, 0, 1, 0, 1, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0);
+//
+// Gtk::Image *icon;
+// Gtk::IconSize iconsize(Gtk::IconSize::from_name("synfig-small_icon"));
+//
+// NEW_SMALL_BUTTON(button_add,"gtk-add",_("New Keyframe"));
+// NEW_SMALL_BUTTON(button_duplicate,"synfig-duplicate",_("Duplicate Keyframe"));
+// NEW_SMALL_BUTTON(button_delete,"gtk-delete",_("Delete Keyframe"));
+//
+// Gtk::HBox *hbox(manage(new Gtk::HBox()));
+// layout_table->attach(*hbox, 0, 1, 1, 2, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK, 0, 0);
+//
+// hbox->pack_start(*button_add,Gtk::PACK_SHRINK);
+// hbox->pack_start(*button_duplicate,Gtk::PACK_SHRINK);
+// hbox->pack_start(*button_delete,Gtk::PACK_SHRINK);
+//
+// /*
+// button_raise->set_relief(Gtk::RELIEF_HALF);
+// button_lower->set_relief(Gtk::RELIEF_HALF);
+// button_duplicate->set_relief(Gtk::RELIEF_HALF);
+// button_delete->set_relief(Gtk::RELIEF_HALF);
+// */
+//
+// button_add->signal_clicked().connect(sigc::mem_fun(*this, &studio::CanvasView::on_keyframe_add_pressed));
+// button_duplicate->signal_clicked().connect(sigc::mem_fun(*this, &studio::CanvasView::on_keyframe_duplicate_pressed));
+// button_delete->signal_clicked().connect(sigc::mem_fun(*this, &studio::CanvasView::on_keyframe_remove_pressed));
+//
+// //layout_table->show_all();
+//
+// keyframe_tab_child=layout_table;
+//
+//
+// layout_table->hide();
+//
+// return layout_table;
+// }
+
+// Gtk::Widget*
+// CanvasView::create_layer_tree()
+// {
+// // Create the layer tree
+// printf("CanvasView::create_layer_tree()\n");
+// layer_tree=manage(new class LayerTree());
+//
+// // Set up the layer tree
+// //layer_tree->set_model(layer_tree_store());
+// layer_tree->set_time_adjustment(time_adjustment());
+// layer_tree->show();
+//
+// // Connect Signals
+// layer_tree->signal_layer_toggle().connect(sigc::mem_fun(*this, &studio::CanvasView::on_layer_toggle));
+// layer_tree->signal_edited_value().connect(sigc::mem_fun(*this, &studio::CanvasView::on_edited_value));
+// layer_tree->signal_layer_user_click().connect(sigc::mem_fun(*this, &studio::CanvasView::on_layer_user_click));
+// layer_tree->signal_param_user_click().connect(sigc::mem_fun(*this, &studio::CanvasView::on_children_user_click));
+// layer_tree->signal_waypoint_clicked_layertree().connect(sigc::mem_fun(*this, &studio::CanvasView::on_waypoint_clicked_canvasview));
+// layer_tree->get_selection()->signal_changed().connect(SLOT_EVENT(EVENT_REFRESH_DUCKS));
+//
+// layer_tree->hide();
+// return layer_tree;
+// }
void
CanvasView::init_menus()
*/
action_group = Gtk::ActionGroup::create();
- //action_group->add( Gtk::Action::create("MenuFile", "_File") );
+ //action_group->add( Gtk::Action::create("MenuFile", _("_File")) );
+ action_group->add( Gtk::Action::create("new", Gtk::Stock::NEW),
+ sigc::hide_return(sigc::ptr_fun(&studio::App::new_instance))
+ );
+ action_group->add( Gtk::Action::create("open", Gtk::Stock::OPEN),
+ sigc::hide_return(sigc::mem_fun(*get_instance().get(), &studio::Instance::open))
+ );
action_group->add( Gtk::Action::create("save", Gtk::Stock::SAVE),
hide_return(sigc::mem_fun(*get_instance().get(), &studio::Instance::save))
);
action_group->add( Gtk::Action::create("options", _("Options")),
sigc::mem_fun0(canvas_options,&studio::CanvasOptions::present)
);
- action_group->add( Gtk::Action::create("close", Gtk::StockID("gtk-close")),
- sigc::hide_return(sigc::mem_fun(*this,&studio::CanvasView::close))
+ action_group->add( Gtk::Action::create("close", Gtk::StockID("gtk-close"), _("Close Window")),
+ sigc::hide_return(sigc::mem_fun(*this,&studio::CanvasView::close_view))
+ );
+ action_group->add( Gtk::Action::create("close-document", Gtk::StockID("gtk-close"), _("Close Document")),
+ sigc::hide_return(sigc::mem_fun(*this,&studio::CanvasView::close_instance))
+ );
+ action_group->add( Gtk::Action::create("quit", Gtk::StockID("gtk-quit"), _("Quit")),
+ sigc::hide_return(sigc::ptr_fun(&studio::App::quit))
);
//action_group->add( Gtk::Action::create("undo", Gtk::StockID("gtk-undo")),
sigc::mem_fun(*work_area,&studio::WorkArea::select_all_ducks)
);
+ action_group->add( Gtk::Action::create("unselect-all-ducks", _("Unselect All Ducks")),
+ sigc::mem_fun(*work_area,&studio::WorkArea::unselect_all_ducks)
+ );
+
+ action_group->add( Gtk::Action::create("select-all-layers", _("Select All Layers")),
+ sigc::mem_fun(*this,&CanvasView::on_select_layers)
+ );
+
action_group->add( Gtk::Action::create("unselect-all-layers", _("Unselect All Layers")),
sigc::mem_fun(*this,&CanvasView::on_unselect_layers)
);
);
for(i=1;i<=10;i++)
{
- Glib::RefPtr<Gtk::RadioAction> action(Gtk::RadioAction::create(quality_group,strprintf("quality-%02d",i), strprintf("Set Quality to %d",i)));
- if(i==10)
- action->property_value()=10;
+ String note;
+ if (i == 1) note = _(" (best)");
+ if (i == 10) note = _(" (fastest)");
+ Glib::RefPtr<Gtk::RadioAction> action(Gtk::RadioAction::create(quality_group,strprintf("quality-%02d",i),
+ strprintf(_("Set Quality to %d"),i) + note));
+ if (i==8) // default quality
+ {
+ action->set_active();
+ work_area->set_quality(i);
+ }
action_group->add( action,
sigc::bind(
sigc::mem_fun(*work_area, &studio::WorkArea::set_quality),
}
}
- action_group->add( Gtk::Action::create("play", Gtk::StockID("synfig-play")),
+ // Low-Res Quality Menu
+ {
+ int i;
+ for(list<int>::iterator iter = CanvasView::get_pixel_sizes().begin(); iter != CanvasView::get_pixel_sizes().end(); iter++)
+ {
+ i = *iter;
+ Glib::RefPtr<Gtk::RadioAction> action(Gtk::RadioAction::create(low_res_pixel_size_group,strprintf("lowres-pixel-%d",i),
+ strprintf(_("Set Low-Res pixel size to %d"),i)));
+ if(i==2) // default pixel size
+ {
+ action->set_active();
+ work_area->set_low_res_pixel_size(i);
+ }
+ action_group->add( action,
+ sigc::bind(
+ sigc::mem_fun(*work_area, &studio::WorkArea::set_low_res_pixel_size),
+ i
+ )
+ );
+ }
+
+ Glib::RefPtr<Gtk::Action> action;
+
+ action=Gtk::Action::create("decrease-low-res-pixel-size", _("Decrease Low-Res Pixel Size"));
+ action_group->add( action,sigc::mem_fun(this, &studio::CanvasView::decrease_low_res_pixel_size));
+
+ action=Gtk::Action::create("increase-low-res-pixel-size", _("Increase Low-Res Pixel Size"));
+ action_group->add( action, sigc::mem_fun(this, &studio::CanvasView::increase_low_res_pixel_size));
+
+ }
+
+ action_group->add( Gtk::Action::create("play", Gtk::Stock::MEDIA_PLAY),
sigc::mem_fun(*this, &studio::CanvasView::play)
);
sigc::mem_fun0(*preview_dialog, &studio::Dialog_Preview::present)
);
- action_group->add( Gtk::Action::create("toggle-grid-show", _("Toggle Grid Show")),
- sigc::mem_fun(*work_area, &studio::WorkArea::toggle_grid)
- );
- action_group->add( Gtk::Action::create("toggle-grid-snap", _("Toggle Grid Snap")),
- sigc::mem_fun(*work_area, &studio::WorkArea::toggle_grid_snap)
- );
- action_group->add( Gtk::Action::create("toggle-guide-show", _("Toggle Guide Show")),
- sigc::mem_fun(*work_area, &studio::WorkArea::toggle_guide_snap)
- );
- action_group->add( Gtk::Action::create("toggle-low-res", _("Toggle Low-Res")),
- sigc::mem_fun(*work_area, &studio::WorkArea::toggle_low_resolution_flag)
- );
- action_group->add( Gtk::Action::create("toggle-onion-skin", _("Toggle Onion Skin")),
- sigc::mem_fun(*work_area, &studio::WorkArea::toggle_onion_skin)
- );
+ {
+ Glib::RefPtr<Gtk::ToggleAction> action;
+
+ grid_show_toggle = Gtk::ToggleAction::create("toggle-grid-show", _("Show Grid"));
+ grid_show_toggle->set_active(work_area->grid_status());
+ action_group->add(grid_show_toggle, sigc::mem_fun(*work_area, &studio::WorkArea::toggle_grid));
+
+ grid_snap_toggle = Gtk::ToggleAction::create("toggle-grid-snap", _("Snap to Grid"));
+ grid_snap_toggle->set_active(work_area->get_grid_snap());
+ action_group->add(grid_snap_toggle, sigc::mem_fun(*work_area, &studio::WorkArea::toggle_grid_snap));
+ action = Gtk::ToggleAction::create("toggle-guide-show", _("Show Guides"));
+ action->set_active(work_area->get_show_guides());
+ action_group->add(action, sigc::mem_fun(*work_area, &studio::WorkArea::toggle_guide_snap));
+
+ action = Gtk::ToggleAction::create("toggle-low-res", _("Use Low-Res"));
+ action->set_active(work_area->get_low_resolution_flag());
+ action_group->add(action, sigc::mem_fun(*work_area, &studio::WorkArea::toggle_low_resolution_flag));
+
+ action = Gtk::ToggleAction::create("toggle-onion-skin", _("Show Onion Skin"));
+ action->set_active(work_area->get_onion_skin());
+ action_group->add(action, sigc::mem_fun(*work_area, &studio::WorkArea::toggle_onion_skin));
+ }
action_group->add( Gtk::Action::create("canvas-zoom-fit", Gtk::StockID("gtk-zoom-fit")),
sigc::mem_fun(*work_area, &studio::WorkArea::zoom_fit)
sigc::mem_fun(*work_area, &studio::WorkArea::zoom_norm)
);
-
{
Glib::RefPtr<Gtk::Action> action;
action=Gtk::Action::create("seek-prev-frame", Gtk::Stock::GO_BACK,_("Prev Frame"),_("Prev Frame"));
action_group->add( action, sigc::bind(sigc::mem_fun(*canvas_interface().get(), &synfigapp::CanvasInterface::seek_frame),-1));
- action=Gtk::Action::create("seek-next-second", Gtk::Stock::GO_FORWARD,_("Seek Foward"),_("Seek Foward"));
+ action=Gtk::Action::create("seek-next-second", Gtk::Stock::GO_FORWARD,_("Seek Forward"),_("Seek Forward"));
action_group->add(action,sigc::bind(sigc::mem_fun(*canvas_interface().get(), &synfigapp::CanvasInterface::seek_time),Time(1)));
action=Gtk::Action::create("seek-prev-second", Gtk::Stock::GO_BACK,_("Seek Backward"),_("Seek Backward"));
action_group->add( action, sigc::bind(sigc::mem_fun(*canvas_interface().get(), &synfigapp::CanvasInterface::seek_time),Time(-1)));
}
+ {
+ Glib::RefPtr<Gtk::ToggleAction> action;
+
+#define DUCK_MASK(lower,upper,string) \
+ action=Gtk::ToggleAction::create("mask-" #lower "-ducks", string); \
+ action->set_active((bool)(work_area->get_type_mask()&Duck::TYPE_##upper)); \
+ action_group->add(action, \
+ sigc::bind( \
+ sigc::mem_fun(*this, &studio::CanvasView::toggle_duck_mask), \
+ Duck::TYPE_##upper))
+
+ DUCK_MASK(position,POSITION,_("Show Position Ducks"));
+ DUCK_MASK(tangent,TANGENT,_("Show Tangent Ducks"));
+ DUCK_MASK(vertex,VERTEX,_("Show Vertex Ducks"));
+ DUCK_MASK(radius,RADIUS,_("Show Radius Ducks"));
+ DUCK_MASK(width,WIDTH,_("Show Width Ducks"));
+ DUCK_MASK(angle,ANGLE,_("Show Angle Ducks"));
-#define DUCK_MASK(lower,upper) \
- duck_mask_##lower=Gtk::ToggleAction::create("mask-" #lower "-ducks", _("Show "#lower" ducks")); \
- duck_mask_##lower->set_active((bool)(work_area->get_type_mask()&Duck::TYPE_##upper)); \
- action_group->add( duck_mask_##lower, \
- sigc::bind( \
- sigc::mem_fun(*this, &studio::CanvasView::toggle_duck_mask), \
- Duck::TYPE_##upper \
- ) \
- )
- DUCK_MASK(position,POSITION);
- DUCK_MASK(tangent,TANGENT);
- DUCK_MASK(vertex,VERTEX);
- DUCK_MASK(radius,RADIUS);
- DUCK_MASK(width,WIDTH);
- DUCK_MASK(angle,ANGLE);
#undef DUCK_MASK
+ }
add_accel_group(App::ui_manager()->get_accel_group());
}
*/
-
-
#if 0
-
- //Test some key stuff
-
- filemenu.items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("gtk-save"),
- hide_return(sigc::mem_fun(*get_instance().get(), &studio::Instance::save))));
- filemenu.items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("gtk-save-as"),sigc::hide_return(sigc::mem_fun(*get_instance(), &studio::Instance::dialog_save_as))));
- filemenu.items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("gtk-revert-to-saved"),hide_return(sigc::mem_fun(*get_instance().get(), &studio::Instance::safe_revert))));
- filemenu.items().push_back(Gtk::Menu_Helpers::SeparatorElem());
-
- filemenu.items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("synfig-cvs_add"),sigc::hide_return(sigc::mem_fun(*get_instance(), &studio::Instance::dialog_cvs_add))));
- filemenu.items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("synfig-cvs_update"),sigc::hide_return(sigc::mem_fun(*get_instance(), &studio::Instance::dialog_cvs_update))));
- filemenu.items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("synfig-cvs_commit"),sigc::hide_return(sigc::mem_fun(*get_instance(), &studio::Instance::dialog_cvs_commit))));
-
- filemenu.items().push_back(Gtk::Menu_Helpers::SeparatorElem());
- filemenu.items().push_back(Gtk::Menu_Helpers::MenuElem(_("Import..."),Gtk::AccelKey('I',Gdk::CONTROL_MASK),sigc::hide_return(sigc::mem_fun(*this, &studio::CanvasView::image_import))));
- filemenu.items().push_back(Gtk::Menu_Helpers::SeparatorElem());
- filemenu.items().push_back(Gtk::Menu_Helpers::MenuElem(_("Render"),Gtk::AccelKey("F9"),
- sigc::mem_fun(render_settings,&studio::RenderSettings::present)
- ));
- filemenu.items().push_back(Gtk::Menu_Helpers::MenuElem(_("Preview"),Gtk::AccelKey("F11"),
- sigc::mem_fun(*this,&CanvasView::on_preview_option)
- ));
- filemenu.items().push_back(Gtk::Menu_Helpers::MenuElem(_("Sound File"),
- sigc::mem_fun(*this,&CanvasView::on_audio_option)
- ));
-
- filemenu.items().push_back(Gtk::Menu_Helpers::SeparatorElem());
- filemenu.items().push_back(Gtk::Menu_Helpers::MenuElem(_("Options"),Gtk::AccelKey("F12"),
- sigc::mem_fun(canvas_options,&studio::CanvasOptions::present)
- ));
- filemenu.items().push_back(Gtk::Menu_Helpers::SeparatorElem());
- filemenu.items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("gtk-close"),sigc::hide_return(sigc::mem_fun(*this,&studio::CanvasView::close))));
-
- editmenu.items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("gtk-undo"),Gtk::AccelKey('Z',Gdk::CONTROL_MASK),SLOT_EVENT(EVENT_UNDO)));
- editmenu.items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("gtk-redo"),Gtk::AccelKey('R',Gdk::CONTROL_MASK),SLOT_EVENT(EVENT_REDO)));
- editmenu.items().push_back(Gtk::Menu_Helpers::SeparatorElem());
- editmenu.items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("gtk-cut"),NOT_IMPLEMENTED_SLOT));
- editmenu.items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("gtk-copy"),NOT_IMPLEMENTED_SLOT));
- editmenu.items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("gtk-paste"),NOT_IMPLEMENTED_SLOT));
- editmenu.items().push_back(Gtk::Menu_Helpers::SeparatorElem());
- editmenu.items().push_back(Gtk::Menu_Helpers::MenuElem(_("Select All Ducks"),Gtk::AccelKey('E',Gdk::CONTROL_MASK),sigc::mem_fun(*work_area,&studio::WorkArea::select_all_ducks)));
- editmenu.items().push_back(Gtk::Menu_Helpers::MenuElem(_("Unselect All Layers"),Gtk::AccelKey('D',Gdk::CONTROL_MASK),sigc::mem_fun(*this,&CanvasView::on_unselect_layers)));
- editmenu.items().push_back(Gtk::Menu_Helpers::SeparatorElem());
-
- //editmenu.items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("gtk-stop"),Gtk::AccelKey(GDK_Escape,static_cast<Gdk::ModifierType>(0)),sigc::hide_return(sigc::mem_fun(*this, &studio::CanvasView::stop))));
- //editmenu.items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("gtk-refresh"),Gtk::AccelKey('k',Gdk::CONTROL_MASK),sigc::hide_return(sigc::mem_fun(*this, &studio::CanvasView::on_refresh_pressed))));
- editmenu.items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("gtk-stop"),Gtk::AccelKey(GDK_Escape,static_cast<Gdk::ModifierType>(0)),SLOT_EVENT(EVENT_STOP)));
- editmenu.items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("gtk-refresh"),Gtk::AccelKey('k',Gdk::CONTROL_MASK),SLOT_EVENT(EVENT_REFRESH)));
- editmenu.items().push_back(Gtk::Menu_Helpers::SeparatorElem());
- editmenu.items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("gtk-properties"),Gtk::AccelKey("F8"),
- sigc::mem_fun(canvas_properties,&studio::CanvasProperties::present)
- ));
-
- build_new_layer_menu(newlayermenu);
- layermenu.items().push_back(Gtk::Menu_Helpers::MenuElem("New",newlayermenu));
-
-
- {
- synfigapp::Action::ParamList param_list;
- param_list.add("canvas",Canvas::Handle(get_canvas()));
- param_list.add("canvas_interface",canvas_interface());
- add_actions_to_menu(&canvasmenu, param_list,synfigapp::Action::CATEGORY_CANVAS);
- }
-
-
- //canvasmenu.items().push_back(Gtk::Menu_Helpers::MenuElem("Keyframe Dialog",sigc::mem_fun(keyframe_dialog,&studio::Dialog_Keyframe::present)));
-
- // Duck Mask Menu
- if(1)
- {
- duckmaskmenu.items().push_back(Gtk::Menu_Helpers::TearoffMenuElem());
-
- duckmaskmenu.items().push_back(Gtk::Menu_Helpers::CheckMenuElem(_("Position Ducks"),Gtk::AccelKey('1',Gdk::MOD1_MASK)));
- duck_mask_position=static_cast<Gtk::CheckMenuItem*>(&duckmaskmenu.items().back());
- duck_mask_position->set_active((bool)(work_area->get_type_mask()&Duck::TYPE_POSITION));
- duck_mask_position->signal_toggled().connect(
- sigc::bind(
- sigc::mem_fun(*this, &studio::CanvasView::toggle_duck_mask),
- Duck::TYPE_POSITION
- )
- );
-
- duckmaskmenu.items().push_back(Gtk::Menu_Helpers::CheckMenuElem(_("Vertex Ducks"),Gtk::AccelKey('2',Gdk::MOD1_MASK)));
- duck_mask_vertex=static_cast<Gtk::CheckMenuItem*>(&duckmaskmenu.items().back());
- duck_mask_vertex->set_active((bool)(work_area->get_type_mask()&Duck::TYPE_VERTEX));
- duck_mask_vertex->signal_toggled().connect(
- sigc::bind(
- sigc::mem_fun(*this, &studio::CanvasView::toggle_duck_mask),
- Duck::TYPE_VERTEX
- )
- );
-
- duckmaskmenu.items().push_back(Gtk::Menu_Helpers::CheckMenuElem(_("Tangent Ducks"),Gtk::AccelKey('3',Gdk::MOD1_MASK)));
- duck_mask_tangent=static_cast<Gtk::CheckMenuItem*>(&duckmaskmenu.items().back());
- duck_mask_tangent->set_active((bool)(work_area->get_type_mask()&Duck::TYPE_TANGENT));
- duck_mask_tangent->signal_toggled().connect(
- sigc::bind(
- sigc::mem_fun(*this, &studio::CanvasView::toggle_duck_mask),
- Duck::TYPE_TANGENT
- )
- );
-
- duckmaskmenu.items().push_back(Gtk::Menu_Helpers::CheckMenuElem(_("Radius Ducks"),Gtk::AccelKey('4',Gdk::MOD1_MASK)));
- duck_mask_radius=static_cast<Gtk::CheckMenuItem*>(&duckmaskmenu.items().back());
- duck_mask_radius->set_active((bool)(work_area->get_type_mask()&Duck::TYPE_RADIUS));
- duck_mask_radius->signal_toggled().connect(
- sigc::bind(
- sigc::mem_fun(*this, &studio::CanvasView::toggle_duck_mask),
- Duck::TYPE_RADIUS
- )
- );
-
- duckmaskmenu.items().push_back(Gtk::Menu_Helpers::CheckMenuElem(_("Width Ducks"),Gtk::AccelKey('5',Gdk::MOD1_MASK)));
- duck_mask_width=static_cast<Gtk::CheckMenuItem*>(&duckmaskmenu.items().back());
- duck_mask_width->set_active((bool)(work_area->get_type_mask()&Duck::TYPE_WIDTH));
- duck_mask_width->signal_toggled().connect(
- sigc::bind(
- sigc::mem_fun(*this, &studio::CanvasView::toggle_duck_mask),
- Duck::TYPE_WIDTH
- )
- );
-
- duckmaskmenu.items().push_back(Gtk::Menu_Helpers::CheckMenuElem(_("Angle Ducks"),Gtk::AccelKey('6',Gdk::MOD1_MASK)));
- duck_mask_angle=static_cast<Gtk::CheckMenuItem*>(&duckmaskmenu.items().back());
- duck_mask_angle->set_active((bool)(work_area->get_type_mask()&Duck::TYPE_ANGLE));
- duck_mask_angle->signal_toggled().connect(
- sigc::bind(
- sigc::mem_fun(*this, &studio::CanvasView::toggle_duck_mask),
- Duck::TYPE_ANGLE
- )
- );
-
- viewmenu.items().push_back(Gtk::Menu_Helpers::MenuElem(_("_Mask Ducks"),duckmaskmenu));
- }
-
- // Preview Quality Menu
- if(1)
- {
- qualitymenu.items().push_back(Gtk::Menu_Helpers::TearoffMenuElem());
- int i;
- qualitymenu.items().push_back(Gtk::Menu_Helpers::MenuElem(strprintf(_("Use Parametric Renderer"),0),
- sigc::bind(
- sigc::mem_fun(*work_area, &studio::WorkArea::set_quality),
- 0
- )
- ));
- for(i=1;i<=10;i++)
- {
- qualitymenu.items().push_back(Gtk::Menu_Helpers::MenuElem(strprintf(_("Set Quality to %d"),i),Gtk::AccelKey('0'+(i%10),Gdk::CONTROL_MASK),
- sigc::bind(
- sigc::mem_fun(*work_area, &studio::WorkArea::set_quality),
- i
- )
- ));
- }
- viewmenu.items().push_back(Gtk::Menu_Helpers::MenuElem(_("Preview Quality"),qualitymenu));
- }
-
- viewmenu.items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("synfig-play"),
- sigc::mem_fun(*this, &studio::CanvasView::play)));
- viewmenu.items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("Flipbook Dialog"),
- sigc::mem_fun(*preview_dialog, &studio::Dialog_Preview::present)));
-
- viewmenu.items().push_back(Gtk::Menu_Helpers::SeparatorElem());
-
- viewmenu.items().push_back(Gtk::Menu_Helpers::MenuElem(_("Toggle Grid Show"),Gtk::AccelKey('g',Gdk::CONTROL_MASK),
- sigc::mem_fun(*work_area, &studio::WorkArea::toggle_grid)));
- viewmenu.items().push_back(Gtk::Menu_Helpers::MenuElem(_("Toggle Grid Snap"),Gtk::AccelKey('l',Gdk::CONTROL_MASK),
- sigc::mem_fun(*work_area, &studio::WorkArea::toggle_grid_snap)));
- viewmenu.items().push_back(Gtk::Menu_Helpers::MenuElem(_("Toggle Guide Snap"),Gtk::AccelKey('k',Gdk::CONTROL_MASK),
- sigc::mem_fun(*work_area, &studio::WorkArea::toggle_guide_snap)));
- viewmenu.items().push_back(Gtk::Menu_Helpers::MenuElem(_("Toggle Low-Res"),Gtk::AccelKey('`',Gdk::CONTROL_MASK),
- sigc::mem_fun(*work_area, &studio::WorkArea::toggle_low_resolution_flag)));
-
- viewmenu.items().push_back(Gtk::Menu_Helpers::SeparatorElem());
-
- viewmenu.items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("gtk-zoom-in"),Gtk::AccelKey('=',static_cast<Gdk::ModifierType>(0)),
- sigc::mem_fun(*work_area, &studio::WorkArea::zoom_in)));
- viewmenu.items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("gtk-zoom-out"),Gtk::AccelKey('-',static_cast<Gdk::ModifierType>(0)),
- sigc::mem_fun(*work_area, &studio::WorkArea::zoom_out)));
- viewmenu.items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("gtk-zoom-fit"),
- sigc::mem_fun(*work_area, &studio::WorkArea::zoom_fit)));
- viewmenu.items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("gtk-zoom-100"),Gtk::AccelKey('`',static_cast<Gdk::ModifierType>(0)),
- sigc::mem_fun(*work_area, &studio::WorkArea::zoom_norm)));
- viewmenu.items().push_back(Gtk::Menu_Helpers::SeparatorElem());
-
- viewmenu.items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("gtk-zoom-in"),Gtk::AccelKey('+',static_cast<Gdk::ModifierType>(0)),
- sigc::mem_fun(*this, &studio::CanvasView::time_zoom_in)));
- viewmenu.items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("gtk-zoom-out"),Gtk::AccelKey('_',static_cast<Gdk::ModifierType>(0)),
- sigc::mem_fun(*this, &studio::CanvasView::time_zoom_out)));
-
- viewmenu.items().push_back(Gtk::Menu_Helpers::MenuElem(_("Jump to Next Keyframe"),Gtk::AccelKey(']',static_cast<Gdk::ModifierType>(0)),
- sigc::mem_fun(*canvas_interface().get(), &synfigapp::CanvasInterface::jump_to_next_keyframe)));
- viewmenu.items().push_back(Gtk::Menu_Helpers::MenuElem(_("Jump to Prev Keyframe"),Gtk::AccelKey('[',static_cast<Gdk::ModifierType>(0)),
- sigc::mem_fun(*canvas_interface().get(), &synfigapp::CanvasInterface::jump_to_prev_keyframe)));
-
- mainmenu.items().push_back(Gtk::Menu_Helpers::TearoffMenuElem());
- mainmenu.items().push_back(Gtk::Menu_Helpers::MenuElem("_File",filemenu));
- mainmenu.items().push_back(Gtk::Menu_Helpers::MenuElem("_Edit",editmenu));
- mainmenu.items().push_back(Gtk::Menu_Helpers::MenuElem("_View",viewmenu));
- mainmenu.items().push_back(Gtk::Menu_Helpers::MenuElem("_Canvas",canvasmenu));
- mainmenu.items().push_back(Gtk::Menu_Helpers::MenuElem("_Layer",layermenu));
-
- mainmenu.accelerate(*this);
-
- {
-
- trackmenu.items().push_back(Gtk::Menu_Helpers::MenuElem("New Waypoint",NOT_IMPLEMENTED_SLOT));
- trackmenu.items().push_back(Gtk::Menu_Helpers::MenuElem("Delete Waypoint",NOT_IMPLEMENTED_SLOT));
- trackmenu.items().push_back(Gtk::Menu_Helpers::MenuElem("Export",NOT_IMPLEMENTED_SLOT));
- trackmenu.items().push_back(Gtk::Menu_Helpers::SeparatorElem());
- trackmenu.items().push_back(Gtk::Menu_Helpers::MenuElem("Properties",NOT_IMPLEMENTED_SLOT));
- }
- mainmenu.show();
- filemenu.show();
- editmenu.show();
- canvasmenu.show();
- layermenu.show();
-
- keyframemenu.items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("gtk-properties"),
- sigc::mem_fun(*this,&studio::CanvasView::show_keyframe_dialog)
- ));
-
-
- get_accel_group()->unlock();
-
- //Set the accelerator paths for all the menus
- filemenu.set_accel_path("<synfig>/File");
- editmenu.set_accel_path("<synfig>/Edit");
- layermenu.set_accel_path("<synfig>/Layer");
- //mainmenu.set_accel_path("<synfig-main>");
- canvasmenu.set_accel_path("<synfig>/Canvas");
- viewmenu.set_accel_path("<synfig>/View");
- duckmaskmenu.set_accel_path("<synfig>/DuckMask");
+//
+// //Test some key stuff
+//
+// filemenu.items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("gtk-save"),
+// hide_return(sigc::mem_fun(*get_instance().get(), &studio::Instance::save))));
+// filemenu.items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("gtk-save-as"),sigc::hide_return(sigc::mem_fun(*get_instance(), &studio::Instance::dialog_save_as))));
+// filemenu.items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("gtk-revert-to-saved"),hide_return(sigc::mem_fun(*get_instance().get(), &studio::Instance::safe_revert))));
+// filemenu.items().push_back(Gtk::Menu_Helpers::SeparatorElem());
+//
+// filemenu.items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("synfig-cvs_add"),sigc::hide_return(sigc::mem_fun(*get_instance(), &studio::Instance::dialog_cvs_add))));
+// filemenu.items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("synfig-cvs_update"),sigc::hide_return(sigc::mem_fun(*get_instance(), &studio::Instance::dialog_cvs_update))));
+// filemenu.items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("synfig-cvs_commit"),sigc::hide_return(sigc::mem_fun(*get_instance(), &studio::Instance::dialog_cvs_commit))));
+//
+// filemenu.items().push_back(Gtk::Menu_Helpers::SeparatorElem());
+// filemenu.items().push_back(Gtk::Menu_Helpers::MenuElem(_("Import..."),Gtk::AccelKey('I',Gdk::CONTROL_MASK),sigc::hide_return(sigc::mem_fun(*this, &studio::CanvasView::image_import))));
+// filemenu.items().push_back(Gtk::Menu_Helpers::SeparatorElem());
+// filemenu.items().push_back(Gtk::Menu_Helpers::MenuElem(_("Render"),Gtk::AccelKey("F9"),
+// sigc::mem_fun(render_settings,&studio::RenderSettings::present)
+// ));
+// filemenu.items().push_back(Gtk::Menu_Helpers::MenuElem(_("Preview"),Gtk::AccelKey("F11"),
+// sigc::mem_fun(*this,&CanvasView::on_preview_option)
+// ));
+// filemenu.items().push_back(Gtk::Menu_Helpers::MenuElem(_("Sound File"),
+// sigc::mem_fun(*this,&CanvasView::on_audio_option)
+// ));
+//
+// filemenu.items().push_back(Gtk::Menu_Helpers::SeparatorElem());
+// filemenu.items().push_back(Gtk::Menu_Helpers::MenuElem(_("Options"),Gtk::AccelKey("F12"),
+// sigc::mem_fun(canvas_options,&studio::CanvasOptions::present)
+// ));
+// filemenu.items().push_back(Gtk::Menu_Helpers::SeparatorElem());
+// filemenu.items().push_back(Gtk::Menu_Helpers::MenuElem(_("Close View"),
+// sigc::hide_return(sigc::mem_fun(*this,&studio::CanvasView::close_view))
+// ));
+// filemenu.items().push_back(Gtk::Menu_Helpers::MenuElem(_("Close Document"),
+// sigc::hide_return(sigc::mem_fun(*this,&studio::CanvasView::close_document))
+// ));
+//
+// editmenu.items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("gtk-undo"),Gtk::AccelKey('Z',Gdk::CONTROL_MASK),SLOT_EVENT(EVENT_UNDO)));
+// editmenu.items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("gtk-redo"),Gtk::AccelKey('R',Gdk::CONTROL_MASK),SLOT_EVENT(EVENT_REDO)));
+// editmenu.items().push_back(Gtk::Menu_Helpers::SeparatorElem());
+// editmenu.items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("gtk-cut"),NOT_IMPLEMENTED_SLOT));
+// editmenu.items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("gtk-copy"),NOT_IMPLEMENTED_SLOT));
+// editmenu.items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("gtk-paste"),NOT_IMPLEMENTED_SLOT));
+// editmenu.items().push_back(Gtk::Menu_Helpers::SeparatorElem());
+// editmenu.items().push_back(Gtk::Menu_Helpers::MenuElem(_("Select All Ducks"),Gtk::AccelKey('E',Gdk::CONTROL_MASK),sigc::mem_fun(*work_area,&studio::WorkArea::select_all_ducks)));
+// editmenu.items().push_back(Gtk::Menu_Helpers::MenuElem(_("Unselect All Ducks"),Gtk::AccelKey('E',Gdk::CONTROL_MASK),sigc::mem_fun(*work_area,&studio::WorkArea::unselect_all_ducks)));
+// editmenu.items().push_back(Gtk::Menu_Helpers::MenuElem(_("Select All Layers"),Gtk::AccelKey('A',Gdk::CONTROL_MASK),sigc::mem_fun(*this,&CanvasView::on_select_layers)));
+// editmenu.items().push_back(Gtk::Menu_Helpers::MenuElem(_("Unselect All Layers"),Gtk::AccelKey('D',Gdk::CONTROL_MASK),sigc::mem_fun(*this,&CanvasView::on_unselect_layers)));
+// editmenu.items().push_back(Gtk::Menu_Helpers::SeparatorElem());
+//
+// //editmenu.items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("gtk-stop"),Gtk::AccelKey(GDK_Escape,static_cast<Gdk::ModifierType>(0)),sigc::hide_return(sigc::mem_fun(*this, &studio::CanvasView::stop))));
+// //editmenu.items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("gtk-refresh"),Gtk::AccelKey('k',Gdk::CONTROL_MASK),sigc::hide_return(sigc::mem_fun(*this, &studio::CanvasView::on_refresh_pressed))));
+// editmenu.items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("gtk-stop"),Gtk::AccelKey(GDK_Escape,static_cast<Gdk::ModifierType>(0)),SLOT_EVENT(EVENT_STOP)));
+// editmenu.items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("gtk-refresh"),Gtk::AccelKey('k',Gdk::CONTROL_MASK),SLOT_EVENT(EVENT_REFRESH)));
+// editmenu.items().push_back(Gtk::Menu_Helpers::SeparatorElem());
+// editmenu.items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("gtk-properties"),Gtk::AccelKey("F8"),
+// sigc::mem_fun(canvas_properties,&studio::CanvasProperties::present)
+// ));
+//
+// build_new_layer_menu(newlayermenu);
+// layermenu.items().push_back(Gtk::Menu_Helpers::MenuElem(_("New"),newlayermenu));
+//
+//
+// {
+// synfigapp::Action::ParamList param_list;
+// param_list.add("canvas",Canvas::Handle(get_canvas()));
+// param_list.add("canvas_interface",canvas_interface());
+// add_actions_to_menu(&canvasmenu, param_list,synfigapp::Action::CATEGORY_CANVAS);
+// }
+//
+//
+// //canvasmenu.items().push_back(Gtk::Menu_Helpers::MenuElem(_("Keyframe Dialog"),sigc::mem_fun(keyframe_dialog,&studio::Dialog_Keyframe::present)));
+//
+// // Duck Mask Menu
+// if(1)
+// {
+// duckmaskmenu.items().push_back(Gtk::Menu_Helpers::TearoffMenuElem());
+//
+// duckmaskmenu.items().push_back(Gtk::Menu_Helpers::CheckMenuElem(_("Position Ducks"),Gtk::AccelKey('1',Gdk::MOD1_MASK)));
+// duck_mask_position=static_cast<Gtk::CheckMenuItem*>(&duckmaskmenu.items().back());
+// duck_mask_position->set_active((bool)(work_area->get_type_mask()&Duck::TYPE_POSITION));
+// duck_mask_position->signal_toggled().connect(
+// sigc::bind(
+// sigc::mem_fun(*this, &studio::CanvasView::toggle_duck_mask),
+// Duck::TYPE_POSITION
+// )
+// );
+//
+// duckmaskmenu.items().push_back(Gtk::Menu_Helpers::CheckMenuElem(_("Vertex Ducks"),Gtk::AccelKey('2',Gdk::MOD1_MASK)));
+// duck_mask_vertex=static_cast<Gtk::CheckMenuItem*>(&duckmaskmenu.items().back());
+// duck_mask_vertex->set_active((bool)(work_area->get_type_mask()&Duck::TYPE_VERTEX));
+// duck_mask_vertex->signal_toggled().connect(
+// sigc::bind(
+// sigc::mem_fun(*this, &studio::CanvasView::toggle_duck_mask),
+// Duck::TYPE_VERTEX
+// )
+// );
+//
+// duckmaskmenu.items().push_back(Gtk::Menu_Helpers::CheckMenuElem(_("Tangent Ducks"),Gtk::AccelKey('3',Gdk::MOD1_MASK)));
+// duck_mask_tangent=static_cast<Gtk::CheckMenuItem*>(&duckmaskmenu.items().back());
+// duck_mask_tangent->set_active((bool)(work_area->get_type_mask()&Duck::TYPE_TANGENT));
+// duck_mask_tangent->signal_toggled().connect(
+// sigc::bind(
+// sigc::mem_fun(*this, &studio::CanvasView::toggle_duck_mask),
+// Duck::TYPE_TANGENT
+// )
+// );
+//
+// duckmaskmenu.items().push_back(Gtk::Menu_Helpers::CheckMenuElem(_("Radius Ducks"),Gtk::AccelKey('4',Gdk::MOD1_MASK)));
+// duck_mask_radius=static_cast<Gtk::CheckMenuItem*>(&duckmaskmenu.items().back());
+// duck_mask_radius->set_active((bool)(work_area->get_type_mask()&Duck::TYPE_RADIUS));
+// duck_mask_radius->signal_toggled().connect(
+// sigc::bind(
+// sigc::mem_fun(*this, &studio::CanvasView::toggle_duck_mask),
+// Duck::TYPE_RADIUS
+// )
+// );
+//
+// duckmaskmenu.items().push_back(Gtk::Menu_Helpers::CheckMenuElem(_("Width Ducks"),Gtk::AccelKey('5',Gdk::MOD1_MASK)));
+// duck_mask_width=static_cast<Gtk::CheckMenuItem*>(&duckmaskmenu.items().back());
+// duck_mask_width->set_active((bool)(work_area->get_type_mask()&Duck::TYPE_WIDTH));
+// duck_mask_width->signal_toggled().connect(
+// sigc::bind(
+// sigc::mem_fun(*this, &studio::CanvasView::toggle_duck_mask),
+// Duck::TYPE_WIDTH
+// )
+// );
+//
+// duckmaskmenu.items().push_back(Gtk::Menu_Helpers::CheckMenuElem(_("Angle Ducks"),Gtk::AccelKey('6',Gdk::MOD1_MASK)));
+// duck_mask_angle=static_cast<Gtk::CheckMenuItem*>(&duckmaskmenu.items().back());
+// duck_mask_angle->set_active((bool)(work_area->get_type_mask()&Duck::TYPE_ANGLE));
+// duck_mask_angle->signal_toggled().connect(
+// sigc::bind(
+// sigc::mem_fun(*this, &studio::CanvasView::toggle_duck_mask),
+// Duck::TYPE_ANGLE
+// )
+// );
+//
+// viewmenu.items().push_back(Gtk::Menu_Helpers::MenuElem(_("_Mask Ducks"),duckmaskmenu));
+// }
+//
+// // Preview Quality Menu
+// if(1)
+// {
+// qualitymenu.items().push_back(Gtk::Menu_Helpers::TearoffMenuElem());
+// int i;
+// qualitymenu.items().push_back(Gtk::Menu_Helpers::MenuElem(strprintf(_("Use Parametric Renderer"),0),
+// sigc::bind(
+// sigc::mem_fun(*work_area, &studio::WorkArea::set_quality),
+// 0
+// )
+// ));
+// for(i=1;i<=10;i++)
+// {
+// qualitymenu.items().push_back(Gtk::Menu_Helpers::MenuElem(strprintf(_("Set Quality to %d"),i),Gtk::AccelKey('0'+(i%10),Gdk::CONTROL_MASK),
+// sigc::bind(
+// sigc::mem_fun(*work_area, &studio::WorkArea::set_quality),
+// i
+// )
+// ));
+// }
+// viewmenu.items().push_back(Gtk::Menu_Helpers::MenuElem(_("Preview Quality"),qualitymenu));
+// }
+//
+// viewmenu.items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::Stock::MEDIA_PLAY,
+// sigc::mem_fun(*this, &studio::CanvasView::play)));
+// viewmenu.items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("Flipbook Dialog"),
+// sigc::mem_fun(*preview_dialog, &studio::Dialog_Preview::present)));
+//
+// viewmenu.items().push_back(Gtk::Menu_Helpers::SeparatorElem());
+//
+// viewmenu.items().push_back(Gtk::Menu_Helpers::MenuElem(_("Toggle Grid Show"),Gtk::AccelKey('g',Gdk::CONTROL_MASK),
+// sigc::mem_fun(*work_area, &studio::WorkArea::toggle_grid)));
+// viewmenu.items().push_back(Gtk::Menu_Helpers::MenuElem(_("Toggle Grid Snap"),Gtk::AccelKey('l',Gdk::CONTROL_MASK),
+// sigc::mem_fun(*work_area, &studio::WorkArea::toggle_grid_snap)));
+// viewmenu.items().push_back(Gtk::Menu_Helpers::MenuElem(_("Toggle Guide Snap"),Gtk::AccelKey('k',Gdk::CONTROL_MASK),
+// sigc::mem_fun(*work_area, &studio::WorkArea::toggle_guide_snap)));
+// viewmenu.items().push_back(Gtk::Menu_Helpers::MenuElem(_("Toggle Low-Res"),Gtk::AccelKey('`',Gdk::CONTROL_MASK),
+// sigc::mem_fun(*work_area, &studio::WorkArea::toggle_low_resolution_flag)));
+//
+// viewmenu.items().push_back(Gtk::Menu_Helpers::SeparatorElem());
+//
+// viewmenu.items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("gtk-zoom-in"),Gtk::AccelKey('=',static_cast<Gdk::ModifierType>(0)),
+// sigc::mem_fun(*work_area, &studio::WorkArea::zoom_in)));
+// viewmenu.items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("gtk-zoom-out"),Gtk::AccelKey('-',static_cast<Gdk::ModifierType>(0)),
+// sigc::mem_fun(*work_area, &studio::WorkArea::zoom_out)));
+// viewmenu.items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("gtk-zoom-fit"),
+// sigc::mem_fun(*work_area, &studio::WorkArea::zoom_fit)));
+// viewmenu.items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("gtk-zoom-100"),Gtk::AccelKey('`',static_cast<Gdk::ModifierType>(0)),
+// sigc::mem_fun(*work_area, &studio::WorkArea::zoom_norm)));
+// viewmenu.items().push_back(Gtk::Menu_Helpers::SeparatorElem());
+//
+// viewmenu.items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("gtk-zoom-in"),Gtk::AccelKey('+',static_cast<Gdk::ModifierType>(0)),
+// sigc::mem_fun(*this, &studio::CanvasView::time_zoom_in)));
+// viewmenu.items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("gtk-zoom-out"),Gtk::AccelKey('_',static_cast<Gdk::ModifierType>(0)),
+// sigc::mem_fun(*this, &studio::CanvasView::time_zoom_out)));
+//
+// viewmenu.items().push_back(Gtk::Menu_Helpers::MenuElem(_("Jump to Next Keyframe"),Gtk::AccelKey(']',static_cast<Gdk::ModifierType>(0)),
+// sigc::mem_fun(*canvas_interface().get(), &synfigapp::CanvasInterface::jump_to_next_keyframe)));
+// viewmenu.items().push_back(Gtk::Menu_Helpers::MenuElem(_("Jump to Prev Keyframe"),Gtk::AccelKey('[',static_cast<Gdk::ModifierType>(0)),
+// sigc::mem_fun(*canvas_interface().get(), &synfigapp::CanvasInterface::jump_to_prev_keyframe)));
+//
+// mainmenu.items().push_back(Gtk::Menu_Helpers::TearoffMenuElem());
+// mainmenu.items().push_back(Gtk::Menu_Helpers::MenuElem(_("_File"),filemenu));
+// mainmenu.items().push_back(Gtk::Menu_Helpers::MenuElem(_("_Edit"),editmenu));
+// mainmenu.items().push_back(Gtk::Menu_Helpers::MenuElem(_("_View"),viewmenu));
+// mainmenu.items().push_back(Gtk::Menu_Helpers::MenuElem(_("_Canvas"),canvasmenu));
+// mainmenu.items().push_back(Gtk::Menu_Helpers::MenuElem(_("_Layer"),layermenu));
+//
+// mainmenu.accelerate(*this);
+//
+///*
+// {
+//
+// trackmenu.items().push_back(Gtk::Menu_Helpers::MenuElem(_("New Waypoint"),NOT_IMPLEMENTED_SLOT));
+// trackmenu.items().push_back(Gtk::Menu_Helpers::MenuElem(_("Delete Waypoint"),NOT_IMPLEMENTED_SLOT));
+// trackmenu.items().push_back(Gtk::Menu_Helpers::MenuElem(_("Export"),NOT_IMPLEMENTED_SLOT));
+// trackmenu.items().push_back(Gtk::Menu_Helpers::SeparatorElem());
+// trackmenu.items().push_back(Gtk::Menu_Helpers::MenuElem(_("Properties"),NOT_IMPLEMENTED_SLOT));
+// }
+//*/
+// mainmenu.show();
+// filemenu.show();
+// editmenu.show();
+// canvasmenu.show();
+// layermenu.show();
+//
+// keyframemenu.items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("gtk-properties"),
+// sigc::mem_fun(*this,&studio::CanvasView::show_keyframe_dialog)
+// ));
+//
+//
+// get_accel_group()->unlock();
+//
+// //Set the accelerator paths for all the menus
+// filemenu.set_accel_path("<synfig>/File");
+// editmenu.set_accel_path("<synfig>/Edit");
+// layermenu.set_accel_path("<synfig>/Layer");
+// //mainmenu.set_accel_path("<synfig-main>");
+// canvasmenu.set_accel_path("<synfig>/Canvas");
+// viewmenu.set_accel_path("<synfig>/View");
+// duckmaskmenu.set_accel_path("<synfig>/DuckMask");
#endif
}
void
+CanvasView::on_select_layers()
+{
+ Canvas::Handle canvas(get_canvas());
+ for (CanvasBase::iterator iter = canvas->begin(); iter != canvas->end(); iter++)
+ layer_tree->select_all_children_layers(*iter);
+}
+
+void
CanvasView::on_unselect_layers()
{
layer_tree->clear_selected_layers();
target_depth=canvas->get_depth(*layer_list.begin());
}
-
Layer::Handle layer(canvas_interface()->add_layer_to(x,canvas,target_depth));
if(layer)
{
}
void
-CanvasView::register_layer_type(synfig::Layer::Book::value_type &lyr,std::map<synfig::String,Gtk::Menu*>* category_map)
+CanvasView::register_layer_type(synfig::Layer::Book::value_type &/*lyr*/,std::map<synfig::String,Gtk::Menu*>* /*category_map*/)
{
-/* if(lyr.second.category==_("Do Not Use"))
+/* if(lyr.second.category==CATEGORY_DO_NOT_USE)
return;
if(category_map->count(lyr.second.category)==0)
}
void
-CanvasView::build_new_layer_menu(Gtk::Menu &menu)
+CanvasView::build_new_layer_menu(Gtk::Menu &/*menu*/)
{
/*
std::map<synfig::String,Gtk::Menu*> category_map;
get_selection_manager()->set_selected_layer(layer);
}
-
void
CanvasView::refresh_rend_desc()
{
current_time_widget->set_fps(get_canvas()->rend_desc().get_frame_rate());
-
//????
//synfig::info("Canvasview: Refreshing render desc info");
if(!get_time().is_equal(time_adjustment().get_value()))
}
//clamp time to big bounds...
+ if(time_window_adjustment().get_value() < begin_time)
+ {
+ time_window_adjustment().set_value(begin_time);
+ time_window_adjustment().value_changed();
+ }
+
+ if(time_window_adjustment().get_value() + time_window_adjustment().get_page_size() > end_time)
+ {
+ time_window_adjustment().set_value(end_time - time_window_adjustment().get_page_size());
+ time_window_adjustment().value_changed();
+ }
+
if(time_adjustment().get_value() < begin_time)
{
time_adjustment().set_value(begin_time);
work_area->queue_render_preview();
}
+bool
+CanvasView::close_view()
+{
+ if(get_instance()->get_visible_canvases()==1)
+ close_instance();
+ else
+ hide();
+ return false;
+}
+
+static bool _close_instance(etl::handle<Instance> instance)
+{
+ etl::handle<Instance> argh(instance);
+ instance->safe_close();
+ synfig::info("closed");
+ return false;
+}
bool
-CanvasView::close()
+CanvasView::close_instance()
{
- get_instance()->safe_close();
+#ifdef SINGLE_THREADED
+ if (get_work_area()->get_updating())
+ {
+ get_work_area()->stop_updating(true); // stop and mark as cancelled
+
+ // give the workarea chances to stop updating
+ Glib::signal_timeout().connect(
+ sigc::mem_fun(*this, &CanvasView::close_instance),
+ 250);
+ }
+ else
+#endif
+ Glib::signal_timeout().connect(
+ sigc::bind(sigc::ptr_fun(_close_instance),
+ (etl::handle<Instance>)get_instance()),
+ 250);
return false;
}
handle<CanvasView>
-CanvasView::create(loose_handle<Instance> instance,handle<Canvas> canvas)
+CanvasView::create(etl::loose_handle<Instance> instance, etl::handle<synfig::Canvas> canvas)
{
etl::handle<studio::CanvasView> view(new CanvasView(instance,instance->synfigapp::Instance::find_canvas_interface(canvas)));
instance->canvas_view_list().push_front(view);
{
string title;
- title+=etl::basename(get_instance()->get_file_name())
- +" : ";
- if(get_canvas()->get_name().empty())
- title+='"'+get_canvas()->get_id()+'"';
- else
- title+='"'+get_canvas()->get_name()+'"';
-
- if(get_instance()->synfigapp::Instance::get_action_count())
- title+=_(" (Unsaved)");
+ title = strprintf("%s%s\"%s\"",
+ (
+ get_instance()->get_action_count()
+ ? "*"
+ : ""
+ ), (
+ get_instance()->has_real_filename()
+ ? (etl::basename(get_instance()->get_file_name()) + " : ").c_str()
+ : ""
+ ), (
+ get_canvas()->get_name().empty()
+ ? get_canvas()->get_id().c_str()
+ : get_canvas()->get_name().c_str()
+ ));
if(get_instance()->synfigapp::Instance::in_repository())
{
set_title(title);
}
-
void
CanvasView::on_hide()
{
canvas_interface()->get_instance()->perform_action(action);
}
-
void
-CanvasView::popup_param_menu(synfigapp::ValueDesc value_desc, float location)
+CanvasView::popup_param_menu(synfigapp::ValueDesc value_desc, float location, bool bezier)
{
parammenu.items().clear();
- get_instance()->make_param_menu(¶mmenu,get_canvas(),value_desc,location);
+ get_instance()->make_param_menu(¶mmenu,get_canvas(),value_desc,location,bezier);
parammenu.popup(3,gtk_get_current_event_time());
}
}
bool
-CanvasView::on_layer_user_click(int button, Gtk::TreeRow row, LayerTree::ColumnID column_id)
+CanvasView::on_layer_user_click(int button, Gtk::TreeRow /*row*/, LayerTree::ColumnID /*column_id*/)
{
switch(button)
{
case 3:
{
-
Gtk::MenuItem* menu = dynamic_cast<Gtk::MenuItem*>(App::ui_manager()->get_widget("/menu-main/menu-layer"));
if(menu && menu->get_submenu())
{
menu->get_submenu()->popup(button,gtk_get_current_event_time());
}
-
#if 0
bool multiple_selected=true;
parammenu.items().clear();
Gtk::Menu *newlayers(manage(new Gtk::Menu()));
+ // do we need this? the code is all #ifdef'ed out anyway
+ // newlayers->signal_hide().connect(sigc::bind(sigc::ptr_fun(&delete_widget), newlayers));
build_new_layer_menu(*newlayers);
- parammenu.items().push_back(Gtk::Menu_Helpers::MenuElem("New Layer",*newlayers));
+ parammenu.items().push_back(Gtk::Menu_Helpers::MenuElem(_("New Layer"),*newlayers));
if(!multiple_selected && layer->get_name()=="PasteCanvas")
{
parammenu.items().push_back(Gtk::Menu_Helpers::MenuElem(_("Select All Children"),
#warning update me!
#if 0
parammenu.items().clear();
- parammenu.items().push_back(Gtk::Menu_Helpers::MenuElem("Connect",
+ parammenu.items().push_back(Gtk::Menu_Helpers::MenuElem(_("Connect"),
hide_return(sigc::mem_fun(*canvas_interface().get(),&synfigapp::CanvasInterface::connect_selected_layer_params))
));
- parammenu.items().push_back(Gtk::Menu_Helpers::MenuElem("Disconnect",
+ parammenu.items().push_back(Gtk::Menu_Helpers::MenuElem(_("Disconnect"),
hide_return(sigc::mem_fun(*canvas_interface().get(),&synfigapp::CanvasInterface::disconnect_selected_layer_params))
));
parammenu.popup(0,0);
}
}
-
-
bool
CanvasView::on_children_user_click(int button, Gtk::TreeRow row, ChildrenTree::ColumnID column_id)
{
if(!(bool)row[children_tree_model.is_canvas])
{
synfigapp::ValueDesc value_desc=row[children_tree_model.value_desc];
+ if (!value_desc)
+ {
+ //! \todo fix properly -- what is the child dialog for?
+ synfig::info("preventing child dialog right-click crash");
+ return true;
+ }
assert(value_desc);
popup_param_menu(value_desc);
return true;
return false;
}
-
void
CanvasView::refresh_time_window()
{
if(get_time() != time_adjustment().get_value())
{
-
//Recenters the window, causing it to jump (possibly undesirably... but whatever)
if(time < time_window_adjustment().get_value() ||
time > time_window_adjustment().get_value()+time_window_adjustment().get_page_size())
void
CanvasView::time_zoom_in()
{
+ float frame_rate = get_canvas()->rend_desc().get_frame_rate();
+ Time min_page_size = 2/frame_rate;
+
time_window_adjustment().set_page_size(time_window_adjustment().get_page_size()*0.75);
+ if (time_window_adjustment().get_page_size() < min_page_size)
+ time_window_adjustment().set_page_size(min_page_size);
+ time_window_adjustment().set_page_increment(time_window_adjustment().get_page_size());
time_window_adjustment().changed();
refresh_time_window();
void
CanvasView::time_zoom_out()
{
+ Time length = (get_canvas()->rend_desc().get_time_end() -
+ get_canvas()->rend_desc().get_time_start());
+
time_window_adjustment().set_page_size(time_window_adjustment().get_page_size()/0.75);
+ if (time_window_adjustment().get_page_size() > length)
+ time_window_adjustment().set_page_size(length);
+ time_window_adjustment().set_page_increment(time_window_adjustment().get_page_size());
time_window_adjustment().changed();
refresh_time_window();
update_title();
}
-
void
CanvasView::on_mode_changed(synfigapp::CanvasInterface::Mode mode)
{
- // If the aninimate flag was set in mode...
+ // If the animate flag was set in mode...
if(mode&synfigapp::MODE_ANIMATE)
{
Gtk::Image *icon;
{
synfigapp::CanvasInterface::Mode mode(get_mode());
+ // future && past --> past
if((mode&synfigapp::MODE_ANIMATE_FUTURE) && (mode&synfigapp::MODE_ANIMATE_PAST))
- {
set_mode(get_mode()-synfigapp::MODE_ANIMATE_FUTURE);
- }
+ // past --> future
else if(!(mode&synfigapp::MODE_ANIMATE_FUTURE) && (mode&synfigapp::MODE_ANIMATE_PAST))
- {
- set_mode(get_mode()-synfigapp::MODE_ANIMATE_PAST|synfigapp::MODE_ANIMATE_FUTURE);
- }
+ set_mode((get_mode()-synfigapp::MODE_ANIMATE_PAST)|synfigapp::MODE_ANIMATE_FUTURE);
+ // future --> (nothing)
else if((mode&synfigapp::MODE_ANIMATE_FUTURE) && !(mode&synfigapp::MODE_ANIMATE_PAST))
- {
set_mode(get_mode()-synfigapp::MODE_ANIMATE_FUTURE);
- }
+ // (nothing) --> future && past
else if(!(mode&synfigapp::MODE_ANIMATE_FUTURE) && !(mode&synfigapp::MODE_ANIMATE_PAST))
- {
set_mode(get_mode()|synfigapp::MODE_ANIMATE_FUTURE|synfigapp::MODE_ANIMATE_PAST);
- }
}
bool
-CanvasView::duck_change_param(const Point &value,synfig::Layer::Handle layer, synfig::String param_name)
+CanvasView::duck_change_param(const synfig::Point &value,synfig::Layer::Handle layer, synfig::String param_name)
{
return canvas_interface()->change_value(synfigapp::ValueDesc(layer,param_name),value);
}
bool
CanvasView::on_duck_changed(const synfig::Point &value,const synfigapp::ValueDesc& value_desc)
{
+ if (ValueNode_BLineCalcWidth::Handle bline_width = ValueNode_BLineCalcWidth::Handle::cast_dynamic(value_desc.get_value_node()))
+ {
+ Real old_width((*bline_width)(get_time()).get(Real()));
+ Real new_width(value.mag());
+ int scale_index(bline_width->get_link_index_from_name("scale"));
+ Real scale((*(bline_width->get_link(scale_index)))(get_time()).get(Real()));
+ return canvas_interface()->change_value(synfigapp::ValueDesc(bline_width,scale_index), new_width * scale / old_width);
+ }
+
+ if (ValueNode_BLineCalcVertex::Handle bline_vertex = ValueNode_BLineCalcVertex::Handle::cast_dynamic(value_desc.get_value_node()))
+ {
+ ValueNode_BLine::Handle bline = ValueNode_BLine::Handle::cast_dynamic(bline_vertex->get_link(bline_vertex->get_link_index_from_name("bline")));
+ Real radius = 0.0;
+ Real amount = synfig::find_closest_point((*bline)(get_time()), value, radius, bline->get_loop());
+ return canvas_interface()->change_value(synfigapp::ValueDesc(bline_vertex,bline_vertex->get_link_index_from_name("amount")), amount);
+ }
+
+ if (ValueNode_BLineCalcTangent::Handle bline_tangent = ValueNode_BLineCalcTangent::Handle::cast_dynamic(value_desc.get_value_node()))
+ {
+ switch(value_desc.get_value_type())
+ {
+ case ValueBase::TYPE_REAL:
+ {
+ Real old_length = (*bline_tangent)(get_time()).get(Real());
+ Real new_length = value.mag();
+ int scale_index(bline_tangent->get_link_index_from_name("scale"));
+ int fixed_length_index(bline_tangent->get_link_index_from_name("fixed_length"));
+ Real scale((*(bline_tangent->get_link(scale_index)))(get_time()).get(Real()));
+ bool fixed_length((*(bline_tangent->get_link(fixed_length_index)))(get_time()).get(bool()));
+ if (fixed_length)
+ return canvas_interface()->change_value(synfigapp::ValueDesc(bline_tangent,scale_index), new_length);
+ if (old_length == 0)
+ return true;
+ return canvas_interface()->change_value(synfigapp::ValueDesc(bline_tangent,scale_index), new_length * scale / old_length);
+ }
+
+ case ValueBase::TYPE_ANGLE:
+ assert(0); // doesn't happen?
+ break;
+
+ case ValueBase::TYPE_VECTOR:
+ {
+ Vector old_tangent = (*bline_tangent)(get_time()).get(Vector());
+ Angle old_angle = old_tangent.angle();
+ Real old_length = old_tangent.mag();
+ Angle new_angle = value.angle();
+ Real new_length = value.mag();
+ int offset_index(bline_tangent->get_link_index_from_name("offset"));
+ int scale_index(bline_tangent->get_link_index_from_name("scale"));
+ int fixed_length_index(bline_tangent->get_link_index_from_name("fixed_length"));
+ Angle old_offset((*(bline_tangent->get_link(offset_index)))(get_time()).get(Angle()));
+ Real scale((*(bline_tangent->get_link(scale_index)))(get_time()).get(Real()));
+ bool fixed_length((*(bline_tangent->get_link(fixed_length_index)))(get_time()).get(bool()));
+ if (fixed_length)
+ {
+ if (!(canvas_interface()->change_value(synfigapp::ValueDesc(bline_tangent,scale_index), new_length)))
+ return false;
+ }
+ else if (old_length != 0 && !(canvas_interface()->change_value(synfigapp::ValueDesc(bline_tangent,scale_index), new_length * scale / old_length)))
+ return false;
+ return canvas_interface()->change_value(synfigapp::ValueDesc(bline_tangent,offset_index), old_offset + new_angle - old_angle);
+ }
+ default:
+ break;
+ }
+ }
+
switch(value_desc.get_value_type())
{
case ValueBase::TYPE_REAL:
return canvas_interface()->change_value(value_desc,value.mag());
- break;
case ValueBase::TYPE_ANGLE:
return canvas_interface()->change_value(value_desc,Angle::tan(value[1],value[0]));
- break;
default:
return canvas_interface()->change_value(value_desc,value);
- break;
}
+}
- return true;
+bool
+CanvasView::on_duck_angle_changed(const synfig::Angle &rotation,const synfigapp::ValueDesc& value_desc)
+{
+ if (ValueNode_BLineCalcTangent::Handle bline_tangent = ValueNode_BLineCalcTangent::Handle::cast_dynamic(value_desc.get_value_node()))
+ {
+ int offset_index(bline_tangent->get_link_index_from_name("offset"));
+ Angle old_offset((*(bline_tangent->get_link(offset_index)))(get_time()).get(Angle()));
+ return canvas_interface()->change_value(synfigapp::ValueDesc(bline_tangent,offset_index), old_offset + rotation);
+ }
+
+ // \todo will this really always be the case?
+ assert(value_desc.get_value_type() == ValueBase::TYPE_ANGLE);
+ return canvas_interface()->change_value(value_desc, value_desc.get_value(get_time()).get(Angle()) + rotation);
}
void
-CanvasView::selected_layer_color_set(Color color)
+CanvasView::selected_layer_color_set(synfig::Color color)
{
synfigapp::SelectionManager::LayerList selected_list(get_selection_manager()->get_selected_layers());
synfigapp::SelectionManager::LayerList::iterator iter;
}
void
-CanvasView::rebuild_ducks_layer_(synfig::TransformStack& transform_stack, Canvas::Handle canvas, std::set<synfig::Layer::Handle>& selected_list)
+CanvasView::rebuild_ducks_layer_(synfig::TransformStack& transform_stack, synfig::Canvas::Handle canvas, std::set<synfig::Layer::Handle>& selected_list)
{
int transforms(0);
String layer_name;
// do the bounding box thing
bbox|=transform_stack.perform(layer->get_bounding_rect());
- // Grab the layer's list pf parameters
+ // Grab the layer's list of parameters
Layer::ParamList paramlist(layer->get_param_list());
// Grab the layer vocabulary
}
void
+CanvasView::decrease_low_res_pixel_size()
+{
+ list<int> sizes = CanvasView::get_pixel_sizes();
+ int pixel_size = work_area->get_low_res_pixel_size();
+
+ for (list<int>::iterator iter = sizes.begin(); iter != sizes.end(); iter++)
+ if (*iter == pixel_size)
+ {
+ if (iter == sizes.begin())
+ // we already have the smallest low-res pixels possible - turn off low-res instead
+ work_area->set_low_resolution_flag(false);
+ else
+ {
+ iter--;
+ Glib::RefPtr<Gtk::Action> action = action_group->get_action(strprintf("lowres-pixel-%d", *iter));
+ action->activate(); // to make sure the radiobutton in the menu is updated too
+ work_area->set_low_resolution_flag(true);
+ }
+ break;
+ }
+}
+
+void
+CanvasView::increase_low_res_pixel_size()
+{
+ list<int> sizes = CanvasView::get_pixel_sizes();
+ int pixel_size = work_area->get_low_res_pixel_size();
+
+ if (!work_area->get_low_resolution_flag())
+ {
+ work_area->set_low_resolution_flag(true);
+ return;
+ }
+
+ for (list<int>::iterator iter = sizes.begin(); iter != sizes.end(); iter++)
+ if (*iter == pixel_size)
+ {
+ iter++;
+ if (iter != sizes.end())
+ {
+ Glib::RefPtr<Gtk::Action> action = action_group->get_action(strprintf("lowres-pixel-%d", *iter));
+ action->activate(); // to make sure the radiobutton in the menu is updated too
+ work_area->set_low_resolution_flag(true);
+ }
+ break;
+ }
+}
+
+void
CanvasView::on_dirty_preview()
{
if(!is_playing_)
if(!work_area->sync_render_preview())
break;
- studio::App::iteration(false);
+ // wait for the workarea to refresh itself
+ while (studio::App::events_pending())
+ studio::App::iteration(false);
if(get_cancel_status())
+ {
+ is_playing_=false;
return;
+ }
}
is_playing_=false;
children_tree->set_sensitive(sensitive);
}
+static void
+set_waypoint_model(std::set<synfig::Waypoint, std::less<UniqueID> > waypoints,
+ Waypoint::Model model,
+ etl::loose_handle<synfigapp::CanvasInterface> canvas_interface)
+{
+ // Create the action group
+ synfigapp::Action::PassiveGrouper group(canvas_interface->get_instance().get(),_("Change Waypoint Group"));
+
+ std::set<synfig::Waypoint, std::less<UniqueID> >::const_iterator iter;
+ for(iter=waypoints.begin();iter!=waypoints.end();++iter)
+ {
+ Waypoint waypoint(*iter);
+ waypoint.apply_model(model);
+
+ synfigapp::Action::Handle action(synfigapp::Action::create("waypoint_set"));
+
+ assert(action);
+
+ action->set_param("canvas",canvas_interface->get_canvas());
+ action->set_param("canvas_interface",canvas_interface);
+
+ action->set_param("waypoint",waypoint);
+ action->set_param("value_node",waypoint.get_parent_value_node());
+
+ if(!canvas_interface->get_instance()->perform_action(action))
+ {
+ group.cancel();
+ return;
+ }
+ }
+}
+
+static void
+duplicate_waypoints(std::set<synfig::Waypoint, std::less<UniqueID> > waypoints,
+ etl::loose_handle<synfigapp::CanvasInterface> canvas_interface)
+{
+ // Create the action group
+ synfigapp::Action::PassiveGrouper group(canvas_interface->get_instance().get(),_("Duplicate Waypoints"));
+
+ std::set<synfig::Waypoint, std::less<UniqueID> >::const_iterator iter;
+ for (iter = waypoints.begin(); iter != waypoints.end(); iter++)
+ {
+ Waypoint waypoint(*iter);
+ ValueNode::Handle value_node(iter->get_parent_value_node());
+ canvas_interface->waypoint_duplicate(value_node, waypoint);
+ }
+}
+
+static void
+remove_waypoints(std::set<synfig::Waypoint, std::less<UniqueID> > waypoints,
+ etl::loose_handle<synfigapp::CanvasInterface> canvas_interface)
+{
+ // Create the action group
+ synfigapp::Action::PassiveGrouper group(canvas_interface->get_instance().get(),_("Remove Waypoints"));
+
+ std::set<synfig::Waypoint, std::less<UniqueID> >::const_iterator iter;
+ for (iter = waypoints.begin(); iter != waypoints.end(); iter++)
+ {
+ Waypoint waypoint(*iter);
+ ValueNode::Handle value_node(iter->get_parent_value_node());
+ canvas_interface->waypoint_remove(value_node, waypoint);
+ }
+}
void
-CanvasView::on_waypoint_clicked(synfigapp::ValueDesc value_desc,synfig::Waypoint waypoint,int button)
+CanvasView::on_waypoint_clicked_canvasview(synfigapp::ValueDesc value_desc,
+ std::set<synfig::Waypoint, std::less<UniqueID> > waypoint_set,
+ int button)
{
- waypoint_dialog.set_value_desc(value_desc);
- waypoint_dialog.set_waypoint(waypoint);
+ int size = waypoint_set.size();
+ Waypoint waypoint(*(waypoint_set.begin()));
+ Time time(waypoint.get_time());
+
+ if (size == 1)
+ {
+ waypoint_dialog.set_value_desc(value_desc);
+ waypoint_dialog.set_waypoint(waypoint);
+ }
switch(button)
{
case -1:
- waypoint_dialog.show();
+ if (size == 1)
+ waypoint_dialog.show();
break;
case 2:
+ {
+ Gtk::Menu* waypoint_menu(manage(new Gtk::Menu()));
+ waypoint_menu->signal_hide().connect(sigc::bind(sigc::ptr_fun(&delete_widget), waypoint_menu));
+
+ Gtk::Menu* interp_menu_in(manage(new Gtk::Menu()));
+ Gtk::Menu* interp_menu_out(manage(new Gtk::Menu()));
+ Gtk::Menu* interp_menu_both(manage(new Gtk::Menu()));
+
{
- Gtk::Menu* waypoint_menu(manage(new Gtk::Menu()));
+ Waypoint::Model model;
+
+ model.reset(); model.set_before(INTERPOLATION_TCB);
+ interp_menu_in->items().push_back(Gtk::Menu_Helpers::MenuElem(_("_TCB"),
+ sigc::bind(sigc::ptr_fun(set_waypoint_model), waypoint_set, model, canvas_interface())));
+ model.reset(); model.set_after(INTERPOLATION_TCB);
+ interp_menu_out->items().push_back(Gtk::Menu_Helpers::MenuElem(_("_TCB"),
+ sigc::bind(sigc::ptr_fun(set_waypoint_model), waypoint_set, model, canvas_interface())));
+ model.set_before(INTERPOLATION_TCB);
+ interp_menu_both->items().push_back(Gtk::Menu_Helpers::MenuElem(_("_TCB"),
+ sigc::bind(sigc::ptr_fun(set_waypoint_model), waypoint_set, model, canvas_interface())));
+
+ model.reset(); model.set_before(INTERPOLATION_LINEAR);
+ interp_menu_in->items().push_back(Gtk::Menu_Helpers::MenuElem(_("_Linear"),
+ sigc::bind(sigc::ptr_fun(set_waypoint_model), waypoint_set, model, canvas_interface())));
+ model.reset(); model.set_after(INTERPOLATION_LINEAR);
+ interp_menu_out->items().push_back(Gtk::Menu_Helpers::MenuElem(_("_Linear"),
+ sigc::bind(sigc::ptr_fun(set_waypoint_model), waypoint_set, model, canvas_interface())));
+ model.set_before(INTERPOLATION_LINEAR);
+ interp_menu_both->items().push_back(Gtk::Menu_Helpers::MenuElem(_("_Linear"),
+ sigc::bind(sigc::ptr_fun(set_waypoint_model), waypoint_set, model, canvas_interface())));
+
+ model.reset(); model.set_before(INTERPOLATION_HALT);
+ interp_menu_in->items().push_back(Gtk::Menu_Helpers::MenuElem(_("_Ease In"),
+ sigc::bind(sigc::ptr_fun(set_waypoint_model), waypoint_set, model, canvas_interface())));
+ model.reset(); model.set_after(INTERPOLATION_HALT);
+ interp_menu_out->items().push_back(Gtk::Menu_Helpers::MenuElem(_("_Ease Out"),
+ sigc::bind(sigc::ptr_fun(set_waypoint_model), waypoint_set, model, canvas_interface())));
+ model.set_before(INTERPOLATION_HALT);
+ interp_menu_both->items().push_back(Gtk::Menu_Helpers::MenuElem(_("_Ease In/Out"),
+ sigc::bind(sigc::ptr_fun(set_waypoint_model), waypoint_set, model, canvas_interface())));
+
+ model.reset(); model.set_before(INTERPOLATION_CONSTANT);
+ interp_menu_in->items().push_back(Gtk::Menu_Helpers::MenuElem(_("_Constant"),
+ sigc::bind(sigc::ptr_fun(set_waypoint_model), waypoint_set, model, canvas_interface())));
+ model.reset(); model.set_after(INTERPOLATION_CONSTANT);
+ interp_menu_out->items().push_back(Gtk::Menu_Helpers::MenuElem(_("_Constant"),
+ sigc::bind(sigc::ptr_fun(set_waypoint_model), waypoint_set, model, canvas_interface())));
+ model.set_before(INTERPOLATION_CONSTANT);
+ interp_menu_both->items().push_back(Gtk::Menu_Helpers::MenuElem(_("_Constant"),
+ sigc::bind(sigc::ptr_fun(set_waypoint_model), waypoint_set, model, canvas_interface())));
+ }
- waypoint_menu->items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("gtk-jump-to"),
- sigc::bind(
- sigc::mem_fun(
- *canvas_interface(),
- &synfigapp::CanvasInterface::set_time
- ),
- waypoint.get_time()
- )
- ));
+ // ------------------------------------------------------------------------
+ waypoint_menu->items().push_back(Gtk::Menu_Helpers::MenuElem(_("_Jump To"),
+ sigc::bind(sigc::mem_fun(*canvas_interface(), &synfigapp::CanvasInterface::set_time), time)));
- waypoint_menu->items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("Edit Waypoint"),
- sigc::mem_fun(
- waypoint_dialog,
- &Gtk::Widget::show
- )
- ));
+ waypoint_menu->items().push_back(Gtk::Menu_Helpers::MenuElem(_("_Duplicate"),
+ sigc::bind(sigc::ptr_fun(duplicate_waypoints), waypoint_set, canvas_interface())));
+
+ waypoint_menu->items().push_back(Gtk::Menu_Helpers::MenuElem((size == 1) ? _("_Remove") : strprintf(_("_Remove %d Waypoints"), size),
+ sigc::bind(sigc::ptr_fun(remove_waypoints), waypoint_set, canvas_interface())));
+
+ if (size == 1 && value_desc.is_valid())
+ waypoint_menu->items().push_back(Gtk::Menu_Helpers::MenuElem(_("_Edit"),
+ sigc::mem_fun(waypoint_dialog,&Gtk::Widget::show)));
+
+ // ------------------------------------------------------------------------
+ waypoint_menu->items().push_back(Gtk::Menu_Helpers::SeparatorElem());
+
+ // ------------------------------------------------------------------------
+ waypoint_menu->items().push_back(Gtk::Menu_Helpers::MenuElem(_("_Both"), *interp_menu_both));
+ waypoint_menu->items().push_back(Gtk::Menu_Helpers::MenuElem(_("_In"), *interp_menu_in));
+ waypoint_menu->items().push_back(Gtk::Menu_Helpers::MenuElem(_("_Out"), *interp_menu_out));
+
+ // ------------------------------------------------------------------------
+ waypoint_menu->popup(button+1,gtk_get_current_event_time());
+ }
+ break;
- waypoint_menu->items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("synfig-duplicate"),
- sigc::bind(
- sigc::bind(
- sigc::mem_fun(
- *canvas_interface(),
- &synfigapp::CanvasInterface::waypoint_duplicate
- ),
- waypoint
- ),
- value_desc
- )
- ));
- waypoint_menu->items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("gtk-delete"),
- sigc::bind(
- sigc::bind(
- sigc::mem_fun(
- *canvas_interface(),
- &synfigapp::CanvasInterface::waypoint_remove
- ),
- waypoint
- ),
- value_desc
- )
- ));
- waypoint_menu->popup(button+1,gtk_get_current_event_time());
- }
- break;
default:
break;
}
}
void
-CanvasView::on_drop_drag_data_received(const Glib::RefPtr<Gdk::DragContext>& context, int x, int y, const Gtk::SelectionData& selection_data_, guint info, guint time)
+CanvasView::on_drop_drag_data_received(const Glib::RefPtr<Gdk::DragContext>& context, int /*x*/, int /*y*/, const Gtk::SelectionData& selection_data_, guint /*info*/, guint time)
{
// We will make this true once we have a solid drop
bool success(false);
- //synfig::info("Droped data of type \"%s\"",selection_data.get_data_type());
- //synfig::info("Droped data of target \"%s\"",gdk_atom_name(selection_data->target));
+ //synfig::info("Dropped data of type \"%s\"",selection_data.get_data_type());
+ //synfig::info("Dropped data of target \"%s\"",gdk_atom_name(selection_data->target));
//synfig::info("selection=\"%s\"",gdk_atom_name(selection_data->selection));
if ((selection_data_.get_length() >= 0) && (selection_data_.get_format() == 8))
if(!get_instance()->perform_action(action))
break;
- // Ok, we have successfuly imported at least one item.
+ // Ok, we have successfully imported at least one item.
success=true;
} while(0); // END of "STRING"
{
synfig::String selection_data((gchar *)(selection_data_.get_data()));
- // For some reason, GTK hands us a list of URL's seperated
- // by not only Carrage-Returns, but also Line-Feeds.
+ // For some reason, GTK hands us a list of URLs separated
+ // by not only Carriage-Returns, but also Line-Feeds.
// Line-Feeds will mess us up. Remove all the line-feeds.
while(selection_data.find_first_of('\r')!=synfig::String::npos)
selection_data.erase(selection_data.begin()+selection_data.find_first_of('\r'));
// Strip the "file://" part from the filename
filename=synfig::String(filename.begin()+sizeof("file://")-1,filename.end());
- String ext;
- try{ext=(String(filename.begin()+filename.find_last_of('.')+1,filename.end()));}catch(...){continue;}
+ String ext(filename_extension(filename));
+ if (ext.size()) ext = ext.substr(1); // skip initial '.'
// If this is a SIF file, then we need to do things slightly differently
if(ext=="sketch")
canvas_interface()->get_instance()->perform_action(action);
}
-
void
CanvasView::toggle_duck_mask(Duckmatic::Type type)
{
bool is_currently_on(work_area->get_type_mask()&type);
- switch(type)
- {
- case Duck::TYPE_POSITION:
- if(duck_mask_position)
- duck_mask_position->set_active(!is_currently_on);
- break;
-
- case Duck::TYPE_VERTEX:
- if(duck_mask_vertex)
- duck_mask_vertex->set_active(!is_currently_on);
- break;
-
- case Duck::TYPE_TANGENT:
- if(duck_mask_tangent)
- duck_mask_tangent->set_active(!is_currently_on);
- break;
-
- case Duck::TYPE_RADIUS:
- if(duck_mask_radius)
- duck_mask_radius->set_active(!is_currently_on);
- break;
-
- case Duck::TYPE_WIDTH:
- if(duck_mask_width)
- duck_mask_width->set_active(!is_currently_on);
- break;
-
- case Duck::TYPE_ANGLE:
- if(duck_mask_angle)
- duck_mask_angle->set_active(!is_currently_on);
- break;
-
- default:
- synfig::warning("CanvasView::toggle_duck_mask():Unknown duck type!");
- break;
- }
-
if(is_currently_on)
work_area->set_type_mask(work_area->get_type_mask()-type);
else
work_area->queue_draw();
}
-
void
CanvasView::image_import()
{
- String filename(dirname(get_canvas()->get_file_name()));
- if(App::dialog_open_file(_("Import Image"), filename))
+ // String filename(dirname(get_canvas()->get_file_name()));
+ String filename("*.*");
+ if(App::dialog_open_file(_("Import Image"), filename, IMAGE_DIR_PREFERENCE))
canvas_interface()->import(filename);
}
}
void
-CanvasView::on_audio_offset_change(const Time &t)
+CanvasView::on_audio_offset_change(const synfig::Time &t)
{
canvas_interface()->set_meta_data("audiooffset",t.get_string());
}
sound_dialog->set_offset(t);
disp_audio->queue_draw();
- synfig::info("CanvasView::on_audio_offset_notify(): offset time set to %s",t.get_string(get_canvas()->rend_desc().get_frame_rate()).c_str());
+ // synfig::info("CanvasView::on_audio_offset_notify(): offset time set to %s",t.get_string(get_canvas()->rend_desc().get_frame_rate()).c_str());
}
void
return true;
}
-
-
Glib::RefPtr<Glib::ObjectBase>
CanvasView::get_ref_obj(const synfig::String& x)
{
layer_tree->get_selection()->signal_changed().connect(SLOT_EVENT(EVENT_REFRESH_DUCKS));
layer_tree->signal_layer_user_click().connect(sigc::mem_fun(*this, &studio::CanvasView::on_layer_user_click));
layer_tree->signal_param_user_click().connect(sigc::mem_fun(*this, &studio::CanvasView::on_children_user_click));
- layer_tree->signal_waypoint_clicked().connect(sigc::mem_fun(*this, &studio::CanvasView::on_waypoint_clicked));
+ layer_tree->signal_waypoint_clicked_layertree().connect(sigc::mem_fun(*this, &studio::CanvasView::on_waypoint_clicked_canvasview));
}
if(x=="children")
{
children_tree=dynamic_cast<ChildrenTree*>(y);
if(children_tree)children_tree->signal_user_click().connect(sigc::mem_fun(*this, &studio::CanvasView::on_children_user_click));
- if(children_tree)children_tree->signal_waypoint_clicked().connect(sigc::mem_fun(*this, &studio::CanvasView::on_waypoint_clicked));
+ if(children_tree)children_tree->signal_waypoint_clicked_childrentree().connect(sigc::mem_fun(*this, &studio::CanvasView::on_waypoint_clicked_canvasview));
if(children_tree)children_tree->get_selection()->signal_changed().connect(SLOT_EVENT(EVENT_REFRESH_DUCKS));
}
if(x=="keyframes")
keyframe_tree=dynamic_cast<KeyframeTree*>(y);
}
-static bool _close_instance(etl::handle<Instance> instance)
-{
- etl::handle<Instance> argh(instance);
- instance->safe_close();
- synfig::info("closed");
- return false;
-}
-
bool
-CanvasView::on_delete_event(GdkEventAny* event)
+CanvasView::on_delete_event(GdkEventAny* event __attribute__ ((unused)))
{
- if(get_instance()->get_visible_canvases()==1)
- {
- // Schedule a close to occur in a few moments
- Glib::signal_timeout().connect(
- sigc::bind(
- sigc::ptr_fun(_close_instance),
- (etl::handle<Instance>)get_instance()
- )
- ,250
- );
- }
- if(event)
- return Gtk::Window::on_delete_event(event);
+ close_view();
+
+ //! \todo This causes the window to be deleted straight away - but what if we prompt 'save?' and the user cancels?
+ // Is there ever any need to pass on the delete event to the window here?
+ // if(event) return Gtk::Window::on_delete_event(event);
return true;
}