/*! \file canvasview.cpp
** \brief Template File
**
-** $Id: canvasview.cpp,v 1.7 2005/01/16 19:55:57 darco Exp $
+** $Id$
**
** \legal
** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
+** Copyright (c) 2007 Chris Moore
**
** This package is free software; you can redistribute it and/or
** modify it under the terms of the GNU General Public License as
#include <gtk/gtkversion.h>
#include <synfig/valuenode_reference.h>
-#include <synfig/valuenode_subtract.h>
-#include <synfig/valuenode_linear.h>
-#include <synfig/valuenode_timedswap.h>
+#include <synfig/valuenode_subtract.h>
+#include <synfig/valuenode_linear.h>
+#include <synfig/valuenode_timedswap.h>
#include <synfig/valuenode_scale.h>
#include <synfig/valuenode_dynamiclist.h>
#include <synfig/valuenode_twotone.h>
#include <synfigapp/main.h>
#include <synfigapp/inputdevice.h>
+#include "general.h"
+
#endif
/* === U S I N G =========================================================== */
#define NOT_IMPLEMENTED_SLOT sigc::mem_fun(*reinterpret_cast<studio::CanvasViewUIInterface*>(get_ui_interface().get()),&studio::CanvasViewUIInterface::not_implemented)
#define SLOT_EVENT(x) sigc::hide_return(sigc::bind(sigc::mem_fun(*this,&studio::CanvasView::process_event_key),x))
-
+
/* === C L A S S E S ======================================================= */
-
+
class studio::UniversalScrubber
{
CanvasView *canvas_view;
bool scrubbing;
etl::clock scrub_timer;
-
+
sigc::connection end_scrub_connection;
public:
UniversalScrubber(CanvasView *canvas_view):
sigc::mem_fun(*this,&studio::UniversalScrubber::on_time_changed)
);
}
-
+
~UniversalScrubber()
{
end_scrub_connection.disconnect();
}
-
+
void on_time_changed()
{
// Make sure we are changing the time quickly
scrub_timer.reset();
return;
}
-
+
// If we aren't scrubbing already, enable it
if(!scrubbing)
{
- scrubbing=true;
+ scrubbing=true;
audio_container()->start_scrubbing(canvas_view->get_time());
}
-
+
// Reset the scrubber ender
end_scrub_connection.disconnect();
end_scrub_connection=Glib::signal_timeout().connect(
scrub_timer.reset();
}
-
+
void end_of_scrubbing()
- {
+ {
scrubbing=false;
audio_container()->stop_scrubbing();
scrub_timer.reset();
}
-
+
handle<AudioContainer> audio_container()
{
assert(canvas_view->audio);
}
};
-
+
class studio::CanvasViewUIInterface : public synfigapp::UIInterface
{
CanvasView *view;
CanvasViewUIInterface(CanvasView *view):
view(view)
{
-
- view->statusbar->push("Idle");
+
+ view->statusbar->push(_("Idle"));
}
~CanvasViewUIInterface()
);
Gtk::Label label(message);
label.show();
-
+
dialog.get_vbox()->pack_start(label);
dialog.add_button(Gtk::StockID("gtk-yes"),RESPONSE_YES);
dialog.add_button(Gtk::StockID("gtk-no"),RESPONSE_NO);
-
+
dialog.set_default_response(dflt);
dialog.show();
return (Response)dialog.run();
);
Gtk::Label label(message);
label.show();
-
+
dialog.get_vbox()->pack_start(label);
dialog.add_button(Gtk::StockID("gtk-yes"),RESPONSE_YES);
dialog.add_button(Gtk::StockID("gtk-no"),RESPONSE_NO);
dialog.add_button(Gtk::StockID("gtk-cancel"),RESPONSE_CANCEL);
-
+
dialog.set_default_response(dflt);
dialog.show();
return (Response)dialog.run();
);
Gtk::Label label(message);
label.show();
-
+
dialog.get_vbox()->pack_start(label);
dialog.add_button(Gtk::StockID("gtk-ok"),RESPONSE_OK);
dialog.add_button(Gtk::StockID("gtk-cancel"),RESPONSE_CANCEL);
-
+
dialog.set_default_response(dflt);
dialog.show();
return (Response)dialog.run();
task(const std::string &task)
{
if(!view->is_playing_)
- {
+ {
view->statusbar->pop();
view->statusbar->push(task);
}
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 --
// don't bother displaying a dialog
{
view->statusbar->pop();
view->statusbar->push(err);
-
+
//while(studio::App::events_pending())studio::App::iteration(false);
if(view->cancel)return false;
return true;
amount_complete(int current, int total)
{
if(!view->is_playing_)
- {
+ {
if(!view->working_depth)
{
if(current)
if(view->cancel){/*view->cancel=false;*/return false;}
return true;
}
-
+
void
not_implemented()
{
- error("Feature not yet implemented");
+ error(_("Feature not yet implemented"));
}
};
public:
CanvasViewSelectionManager(CanvasView *view): view(view)
-{
-
+{
+
}
-
+
private:
void _set_selected_layer(const synfig::Layer::Handle &layer)
// It musta been for some reason, but I cannot recall.
//if(App::Busy::count)
// return;
-
+
if(view->layer_tree->get_selection()->get_selected())
{
const Gtk::TreeRow row = *(view->layer_tree->get_selection()->get_selected());
*/
}
public:
-
+
//! Returns the number of layers selected.
virtual int get_selected_layer_count()const
{
virtual LayerList get_selected_layers()const
{
// assert(view->layer_tree);
-
- if(!view->layer_tree) { DEBUGPOINT(); synfig::error("canvas_view.layer_tree not defined!?"); return LayerList(); }
+
+ if(!view->layer_tree) { DEBUGPOINT(); synfig::error("%s:%d canvas_view.layer_tree not defined!?", __FILE__, __LINE__); return LayerList(); }
return view->layer_tree->get_selected_layers();
}
-
+
//! Returns the first layer selected or an empty handle if none are selected.
virtual synfig::Layer::Handle get_selected_layer()const
{
// assert(view->layer_tree);
-
- if(!view->layer_tree) { DEBUGPOINT(); synfig::error("canvas_view.layer_tree not defined!?"); return 0; }
+
+ if(!view->layer_tree) { DEBUGPOINT(); synfig::error("%s:%d canvas_view.layer_tree not defined!?", __FILE__, __LINE__); return 0; }
return view->layer_tree->get_selected_layer();
}
-
+
//! Sets which layers should be selected
virtual void set_selected_layers(const LayerList &layer_list)
{
// assert(view->layer_tree);
-
- if(!view->layer_tree) { DEBUGPOINT(); synfig::error("canvas_view.layer_tree not defined!?"); return; }
+
+ if(!view->layer_tree) { DEBUGPOINT(); 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);
virtual 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; }
view->layer_tree->select_layer(layer);
//view->queue_rebuild_ducks();
{
return get_selected_children().size();
}
-
+
static inline void __child_grabber(const Gtk::TreeModel::iterator& iter, ChildrenList* ret)
{
const CanvasView::ChildrenTreeModel children_tree_model;
if(value_desc)
ret->push_back(value_desc);
}
-
+
//! Returns a list of the currently selected value_nodes.
virtual ChildrenList get_selected_children()const
{
if(!view->children_tree) return ChildrenList();
-
+
Glib::RefPtr<Gtk::TreeSelection> selection=view->children_tree->get_selection();
if(!selection)
return ChildrenList();
-
+
ChildrenList ret;
-
+
selection->selected_foreach_iter(
sigc::bind(
sigc::ptr_fun(
&ret
)
);
-
+
/*
Gtk::TreeModel::Children::iterator iter(view->children_tree_store()->children().begin());
iter++;
*/
return ret;
}
-
+
//! Returns the first value_node selected or an empty handle if none are selected.
virtual ChildrenList::value_type get_selected_child()const
{
return children.front();
}
-
+
//! 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();
}
-
+
LayerParamList get_selected_layer_parameters()const
{
if(!view->layer_tree) return LayerParamList();
if(!selection)
return LayerParamList();
-
+
LayerParamList ret;
-
+
Gtk::TreeModel::Children children = const_cast<CanvasView*>(view)->layer_tree_store()->children();
Gtk::TreeModel::Children::iterator iter;
for(iter = children.begin(); iter != children.end(); ++iter)
}
return ret;
}
-
+
LayerParam get_selected_layer_parameter() const
{
if(!view->layer_tree) return LayerParam();
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;
}
-
+
void clear_selected_layer_parameters()
{
return;
time_adjustment_ (0,0,25,0,0,0),
time_window_adjustment_ (0,0,25,0,0,0),
statusbar (manage(new class Gtk::Statusbar())),
-
+
timeslider (new Widget_Timeslider),
-
+
ui_interface_ (new CanvasViewUIInterface(this)),
selection_manager_ (new CanvasViewSelectionManager(this)),
is_playing_ (false),
-
+
working_depth (0),
cancel (false),
-
+
canvas_properties (*this,canvas_interface_),
canvas_options (this),
render_settings (*this,canvas_interface_),
layer_tree=0;
children_tree=0;
duck_refresh_flag=true;
-
+
smach_.set_default_state(&state_normal);
-
+
disp_audio = new Widget_Sound();
-
+
//synfig::info("Canvasview: Entered constructor");
// Minor hack
get_canvas()->set_time(0);
//layer_tree_store_->rebuild();
-
+
// Set up the UI and Selection managers
canvas_interface()->set_ui_interface(get_ui_interface());
canvas_interface()->set_selection_manager(get_selection_manager());
rebuild_ducks_queued=false;
-
+
//notebook=manage(new class Gtk::Notebook());
//Gtk::VPaned *vpaned = manage(new class Gtk::VPaned());
//vpaned->pack1(*create_work_area(), Gtk::EXPAND|Gtk::SHRINK);
//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
audio = new AudioContainer();
-
- Gtk::Table *layout_table= manage(new class Gtk::Table(1, 3, false));
+
+ Gtk::Table *layout_table= manage(new class Gtk::Table(1, 3, false));
//layout_table->attach(*vpaned, 0, 1, 0, 1, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0);
layout_table->attach(*create_work_area(), 0, 1, 1, 2, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0);
- init_menus();
+ 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);
-
+
update_title();
layout_table->show();
canvas_interface()->signal_rend_desc_changed().connect(sigc::mem_fun(*this,&studio::CanvasView::refresh_rend_desc));
waypoint_dialog.signal_changed().connect(sigc::mem_fun(*this,&studio::CanvasView::on_waypoint_changed));
waypoint_dialog.signal_delete().connect(sigc::mem_fun(*this,&studio::CanvasView::on_waypoint_delete));
-
+
//MODIFIED TIME ADJUSTMENT STUFF....
time_window_adjustment().set_child_adjustment(&time_adjustment());
- time_window_adjustment().signal_value_changed().connect(sigc::mem_fun(*this,&studio::CanvasView::refresh_time_window));
+ 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));
)
)
);
-
+
//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
+ /*! \todo We shouldn't need to do this at construction --
+ ** This should be performed at the first time the window
** becomes visible.
*/
work_area->queue_render_preview();
-
+
// If the canvas is really big, zoom out so that we can fit it all in the window
- /*! \todo In other words, this is a zoom-to-fit, and should be
- ** in it's own function.
+ /*! \todo In other words, this is a zoom-to-fit, and should be
+ ** in its own function.
*/
int w=get_canvas()->rend_desc().get_w()+70;
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);
- }
+ }
if(w>700)w=700;
- if(h>600)h=600;
+ if(h>600)h=600;
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") );
time_window_adjustment().set_page_size(10.0);
}
*/
-
+
//synfig::info("Canvasview: Before Sound Hookup");
//load sound info from meta data
{
//synfig::warning("Should load Audio: %s with %s offset",apath.c_str(),aoffset.c_str());
-
+
on_audio_file_notify(); //redundant setting of the metadata, but oh well, it's no big deal :)
on_audio_offset_notify();
-
+
//signal connection - since they are all associated with the canvas view
-
+
//hook in signals for sound options box
sound_dialog->signal_file_changed().connect(sigc::mem_fun(*this,&CanvasView::on_audio_file_change));
sound_dialog->signal_offset_changed().connect(sigc::mem_fun(*this,&CanvasView::on_audio_offset_change));
-
- //attach to the preview when it's visible
+
+ //attach to the preview when it's visible
//preview_dialog->get_widget().signal_play().connect(sigc::mem_fun(*this,&CanvasView::play_audio));
//preview_dialog->get_widget().signal_stop().connect(sigc::mem_fun(*this,&CanvasView::stop_audio));
-
+
//hook to metadata signals
get_canvas()->signal_meta_data_changed("audiofile").connect(sigc::mem_fun(*this,&CanvasView::on_audio_file_notify));
get_canvas()->signal_meta_data_changed("audiooffset").connect(sigc::mem_fun(*this,&CanvasView::on_audio_offset_notify));
//universal_scrubber=std::auto_ptr<UniversalScrubber>(new UniversalScrubber(this));
}
-
+
//synfig::info("Canvasview: Before Final time set up");
//MORE TIME STUFF
time_window_adjustment().set_value(get_canvas()->rend_desc().get_time_start());
time_window_adjustment().value_changed();
-
+
GRAB_HINT_DATA("canvas_view");
/*
{
set_type_hint(Gdk::WINDOW_TYPE_HINT_UTILITY);
}
*/
-
- refresh_rend_desc();
+
+ refresh_rend_desc();
hide_tables();
- on_time_changed();
- //synfig::info("Canvasview: Constructor Done");
+ on_time_changed();
+ //synfig::info("Canvasview: Constructor Done");
}
CanvasView::~CanvasView()
if(ext_widget_book_.begin()->second)
delete ext_widget_book_.begin()->second;
}
-
+
//delete preview
audio.reset();
-
+
hide();
-
+
+ // 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();
+
synfig::info("CanvasView:~CanvasView(): Destructor Finished");
}
timeslider->set_time_adjustment(&time_adjustment());
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();
-
+
Gtk::Table *table= manage(new class Gtk::Table(2, 3, false));
//setup the audio display
- disp_audio->set_size_request(-1,32); //disp_audio.show();
+ disp_audio->set_size_request(-1,32); //disp_audio->show();
disp_audio->set_time_adjustment(&time_adjustment());
disp_audio->signal_start_scrubbing().connect(
sigc::mem_fun(*audio,&AudioContainer::start_scrubbing)
disp_audio->signal_stop_scrubbing().connect(
sigc::mem_fun(*audio,&AudioContainer::stop_scrubbing)
);
-
+
table->attach(*manage(disp_audio), 0, 1, 0, 1, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK);
table->attach(*timeslider, 0, 1, 1, 2, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK, 0, 0);
table->attach(*time_window_scroll, 0, 1, 2, 3, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK, 0, 0);
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);
refreshbutton->signal_clicked().connect(SLOT_EVENT(EVENT_REFRESH));
stopbutton->signal_clicked().connect(SLOT_EVENT(EVENT_STOP));
-
+
statusbartable->show_all();
return statusbartable;
}
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;
+ return children_tree;
}
Gtk::Widget*
//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->set_shadow_type(Gtk::SHADOW_ETCHED_IN);
//scroll_layer_tree->show();
-
- Gtk::Table *layout_table= manage(new Gtk::Table(1, 2, false));
+
+ 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");
+ 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;
+
+ return layout_table;
}
Gtk::Widget*
layer_tree->get_selection()->signal_changed().connect(SLOT_EVENT(EVENT_REFRESH_DUCKS));
layer_tree->hide();
- return layer_tree;
+ return layer_tree;
}
void
layermenu.set_accel_path("<Canvas-view>/Layer");
*/
//cache the position of desired widgets
-
+
/*Menus to worry about:
- filemenu
- editmenu
- viewmenu
*/
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("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("undo", Gtk::StockID("gtk-undo")),
action_group->add( Gtk::Action::create("stop", Gtk::StockID("gtk-stop")),
SLOT_EVENT(EVENT_STOP)
);
-
+
action_group->add( Gtk::Action::create("refresh", Gtk::StockID("gtk-refresh")),
SLOT_EVENT(EVENT_REFRESH)
);
);
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)));
+ 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;
+ {
+ 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")),
+ action_group->add( Gtk::Action::create("play", Gtk::Stock::MEDIA_PLAY),
sigc::mem_fun(*this, &studio::CanvasView::play)
);
-
+
action_group->add( Gtk::Action::create("dialog-flipbook", _("Flipbook Dialog")),
sigc::mem_fun0(*preview_dialog, &studio::Dialog_Preview::present)
);
{
Glib::RefPtr<Gtk::Action> action;
-
+
action=Gtk::Action::create("seek-next-frame", Gtk::Stock::GO_FORWARD,_("Next Frame"),_("Next Frame"));
action_group->add(action,sigc::bind(sigc::mem_fun(*canvas_interface().get(), &synfigapp::CanvasInterface::seek_frame),1));
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)));
- // Broken...!?
- /*
action=Gtk::Action::create("seek-end", Gtk::Stock::GOTO_LAST,_("Seek to End"),_("Seek to End"));
action_group->add(action,sigc::bind(sigc::mem_fun(*canvas_interface().get(), &synfigapp::CanvasInterface::seek_time),Time::end()));
- */
+
action=Gtk::Action::create("seek-begin", Gtk::Stock::GOTO_FIRST,_("Seek to Begin"),_("Seek to Begin"));
action_group->add( action, sigc::bind(sigc::mem_fun(*canvas_interface().get(), &synfigapp::CanvasInterface::seek_time),Time::begin()));
action=Gtk::Action::create("canvas-zoom-in", Gtk::Stock::ZOOM_IN);
action_group->add( action,sigc::mem_fun(*work_area, &studio::WorkArea::zoom_in));
-
+
action=Gtk::Action::create("canvas-zoom-out", Gtk::Stock::ZOOM_OUT);
action_group->add( action, sigc::mem_fun(*work_area, &studio::WorkArea::zoom_out) );
-
+
action=Gtk::Action::create("time-zoom-in", Gtk::Stock::ZOOM_IN, _("Zoom In on Timeline"));
action_group->add( action, sigc::mem_fun(*this, &studio::CanvasView::time_zoom_in) );
-
+
action=Gtk::Action::create("time-zoom-out", Gtk::Stock::ZOOM_OUT, _("Zoom Out on Timeline"));
action_group->add( action, sigc::mem_fun(*this, &studio::CanvasView::time_zoom_out) );
-
+
}
-#define DUCK_MASK(lower,upper) \
- duck_mask_##lower=Gtk::ToggleAction::create("mask-" #lower "-ducks", _("Show "#lower" ducks")); \
+#define DUCK_MASK(lower,upper,string) \
+ duck_mask_##lower=Gtk::ToggleAction::create("mask-" #lower "-ducks", string); \
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);
+ )
+ 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"));
#undef DUCK_MASK
add_accel_group(App::ui_manager()->get_accel_group());
{
Glib::RefPtr<Gtk::ActionGroup> accel_action_group(Gtk::ActionGroup::create("canvas_view"));
Glib::RefPtr<Gtk::Action> action;
-
+
action=Gtk::Action::create("seek-next-frame", Gtk::StockID("gtk-forward"),_("Next Frame"),_("Next Frame"));
accel_action_group->add(action,sigc::bind(sigc::mem_fun(*canvas_interface().get(), &synfigapp::CanvasInterface::seek),1));
action=Gtk::Action::create("canvas-zoom-in", Gtk::StockID("gtk-zoom-in"));
accel_action_group->add( action,sigc::mem_fun(*work_area, &studio::WorkArea::zoom_in));
-
+
action=Gtk::Action::create("canvas-zoom-out", Gtk::StockID("gtk-zoom-out"));
accel_action_group->add( action, sigc::mem_fun(*work_area, &studio::WorkArea::zoom_out) );
-
+
action=Gtk::Action::create("time-zoom-in", Gtk::StockID("gtk-zoom-in"), _("Zoom In on Timeline"));
accel_action_group->add( action, sigc::mem_fun(*this, &studio::CanvasView::time_zoom_in) );
-
+
action=Gtk::Action::create("time-zoom-out", Gtk::StockID("gtk-zoom-out"), _("Zoom Out on Timeline"));
accel_action_group->add( action, sigc::mem_fun(*this, &studio::CanvasView::time_zoom_out) );
-
+
Glib::RefPtr<Gtk::UIManager> accel_ui_manager(Gtk::UIManager::create());
Glib::ustring ui_info =
accel_ui_manager->add_ui_from_string(ui_info);
add_accel_group(accel_ui_manager->get_accel_group());
-
+
accel_ui_manager->insert_action_group(accel_action_group);
set_ref_obj("accel_ui_manager",accel_ui_manager);
set_ref_obj("accel_action_group",accel_action_group);
-#if 0
-
+#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::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))));
+ 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::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("synfig-rotoscope_bline"),
- sigc::mem_fun(*this, &studio::CanvasView::do_rotoscope_bline)));
- editmenu.items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("synfig-rotoscope_polygon"),
- sigc::mem_fun(*this, &studio::CanvasView::do_rotoscope_poly)));
- editmenu.items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("synfig-eyedrop"),
- sigc::mem_fun(*this, &studio::CanvasView::do_eyedrop)));
- 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));
+ layermenu.items().push_back(Gtk::Menu_Helpers::MenuElem(_("New"),newlayermenu));
{
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)));
+
+ //canvasmenu.items().push_back(Gtk::Menu_Helpers::MenuElem(_("Keyframe Dialog"),sigc::mem_fun(keyframe_dialog,&studio::Dialog_Keyframe::present)));
// Duck Mask Menu
if(1)
viewmenu.items().push_back(Gtk::Menu_Helpers::MenuElem(_("_Mask Ducks"),duckmaskmenu));
}
-
+
// Preview Quality Menu
if(1)
{
}
viewmenu.items().push_back(Gtk::Menu_Helpers::MenuElem(_("Preview Quality"),qualitymenu));
}
-
- viewmenu.items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("synfig-play"),
+
+ 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)));
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(*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.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::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));
+ trackmenu.items().push_back(Gtk::Menu_Helpers::MenuElem(_("Properties"),NOT_IMPLEMENTED_SLOT));
}
+*/
mainmenu.show();
filemenu.show();
editmenu.show();
canvasmenu.set_accel_path("<synfig>/Canvas");
viewmenu.set_accel_path("<synfig>/View");
duckmaskmenu.set_accel_path("<synfig>/DuckMask");
-#endif
+#endif
}
void
if(selection->get_selected())
{
Gtk::TreeRow row(*selection->get_selected());
-
+
Keyframe keyframe(row[keyframe_tree->model.keyframe]);
-
+
keyframe_dialog.set_keyframe(keyframe);
keyframe_dialog.present();
}
CanvasView::add_layer(synfig::String x)
{
Canvas::Handle canvas;
-
+
synfigapp::SelectionManager::LayerList layer_list(get_selection_manager()->get_selected_layers());
-
+
int target_depth(0);
-
+
if(layer_list.empty())
{
canvas=get_canvas();
target_depth=canvas->get_depth(*layer_list.begin());
}
-
+
Layer::Handle layer(canvas_interface()->add_layer_to(x,canvas,target_depth));
if(layer)
{
get_selection_manager()->clear_selected_layers();
- get_selection_manager()->set_selected_layer(layer);
+ get_selection_manager()->set_selected_layer(layer);
}
}
//Gtk::Menu* menu(manage(new Gtk::Menu));
Gtk::Menu* menu(¶mmenu);
menu->items().clear();
-
+
synfigapp::Action::ParamList param_list;
param_list.add("time",canvas_interface()->get_time());
param_list.add("canvas",Canvas::Handle(layer->get_canvas()));
param_list.add("canvas_interface",canvas_interface());
param_list.add("layer",layer);
-
+
//Gtk::Menu *newlayers(manage(new Gtk::Menu()));
//build_new_layer_menu(*newlayers);
-
+
//parammenu.items().push_back(Gtk::Menu_Helpers::MenuElem(_("New Layer"),*newlayers));
if(layer->get_name()=="PasteCanvas")
)
));
}
-
+
add_actions_to_menu(menu, param_list,synfigapp::Action::CATEGORY_LAYER);
-
+
menu->popup(3,gtk_get_current_event_time());
}
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"))
return;
-
+
if(category_map->count(lyr.second.category)==0)
(*category_map)[lyr.second.category]=manage(new Gtk::Menu());
}
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;
std::map<synfig::String,Gtk::Menu*>::iterator iter;
for(iter=category_map.begin();iter!=category_map.end();++iter)
- menu.items().push_back(Gtk::Menu_Helpers::MenuElem(iter->first,*iter->second));
+ menu.items().push_back(Gtk::Menu_Helpers::MenuElem(iter->first,*iter->second));
menu.show();
*/
{
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()))
//set the FPS of the timeslider
timeslider->set_global_fps(get_canvas()->rend_desc().get_frame_rate());
-
+
//set the beginning and ending time of the time slider
Time begin_time=get_canvas()->rend_desc().get_time_start();
Time end_time=get_canvas()->rend_desc().get_time_end();
time_window_adjustment().set_page_increment(length);
time_window_adjustment().set_page_size(length);
}
-
+
/*synfig::info("w: %p - [%.3f,%.3f] (%.3f,%.3f) child: %p\n",
&time_window_adjustment_, time_window_adjustment_.get_lower(),
time_window_adjustment_.get_upper(),time_window_adjustment_.get_value(),
time_window_adjustment_.get_page_size(),time_window_adjustment_.get_child_adjustment()
);*/
-
+
time_window_adjustment().changed(); //only non-value stuff was changed
// Setup the time adjustment
-
+
//NOTE THESE TWO SHOULD BE CHANGED BY THE changed() CALL ABOVE
//time_adjustment().set_lower(time_window_adjustment().get_value());
//time_adjustment().set_upper(time_window_adjustment().get_value()+time_window_adjustment().get_page_size());
-
+
// time_adjustment().set_lower(get_canvas()->rend_desc().get_time_start());
// time_adjustment().set_upper(get_canvas()->rend_desc().get_time_end());
time_adjustment().set_step_increment(synfig::Time(1.0/get_canvas()->rend_desc().get_frame_rate()));
time_adjustment().set_page_increment(synfig::Time(1.0));
time_adjustment().set_page_size(0);
-
+
time_adjustment().changed();
-
+
/*synfig::info("w: %p - [%.3f,%.3f] (%.3f,%.3f) child: %p\n",
&time_window_adjustment_, time_window_adjustment_.get_lower(),
time_window_adjustment_.get_upper(),time_window_adjustment_.get_value(),
time_window_adjustment_.get_page_size(),time_window_adjustment_.get_child_adjustment()
); */
-
+
if(begin_time==end_time)
{
hide_timebar();
time_adjustment().set_value(begin_time);
time_adjustment().value_changed();
}
-
+
if(time_adjustment().get_value() > end_time)
{
time_adjustment().set_value(end_time);
time_adjustment().value_changed();
}
-
+
/*synfig::info("Time stats: \n"
"w: %p - [%.3f,%.3f] (%.3f,%.3f) child: %p\n"
"t: %p - [%.3f,%.3f] %.3f",
bool
-CanvasView::close()
+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_instance()
{
- get_instance()->safe_close();
+ 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
+ Glib::signal_timeout().connect(
+ sigc::bind(sigc::ptr_fun(_close_instance),
+ (etl::handle<Instance>)get_instance()),
+ 250);
return false;
}
{
string title;
+ if(get_instance()->synfigapp::Instance::get_action_count())
+ title="*";
title+=etl::basename(get_instance()->get_file_name())
+" : ";
if(get_canvas()->get_name().empty())
else
title+='"'+get_canvas()->get_name()+'"';
- if(get_instance()->synfigapp::Instance::get_action_count())
- title+=_(" (Unsaved)");
-
if(get_instance()->synfigapp::Instance::in_repository())
{
title+=" (CVS";
get_smach().process_event(EVENT_REFRESH_TOOL_OPTIONS);
studio::App::set_selected_canvas_view(this);
-
+
App::ui_manager()->insert_action_group(action_group);
}
-
+
// HACK ... Questionable...?
if(x)
return Gtk::Window::on_focus_in_event(x);
-
+
return true;
}
{
synfigapp::Action::Handle action(synfigapp::Action::create("layer_activate"));
assert(action);
-
+
if(!action)
return;
-
+
action->set_param("canvas",Canvas::Handle(layer->get_canvas()));
if(!action->set_param("canvas_interface",canvas_interface()))
// if(!action->set_param("canvas_interface",get_instance()->find_canvas_interface(layer->get_canvas())))
action->set_param("new_status",!layer->active());
assert(action->is_ready());
-
+
canvas_interface()->get_instance()->perform_action(action);
}
{
parammenu.items().clear();
get_instance()->make_param_menu(¶mmenu,get_canvas(),value_desc,location);
-
+
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:
menu->get_submenu()->popup(button,gtk_get_current_event_time());
}
-
+
#if 0
bool multiple_selected=true;
-
+
if(layer_tree->get_selection()->count_selected_rows()<=1)
multiple_selected=false;
layer_tree->get_selection()->select(row);
multiple_selected=false;
}
-
+
if(column_id==COLUMNID_TIME_TRACK)
return false;
-
+
//synfigapp::ValueDesc value_desc(row[layer_param_tree_model.value_desc]);
//ValueNode::Handle value_node(row[layer_param_tree_model.value_node]);
//ValueNode::Handle parent_value_node;
//ValueBase value=row[layer_param_tree_model.value];
-
+
//if(row.parent())
//{
// parent_value_node=(*row.parent())[layer_tree_model.value_node];
{
synfigapp::SelectionManager::LayerList layer_list(get_selection_manager()->get_selected_layers());
synfigapp::SelectionManager::LayerList::iterator iter;
-
+
for(iter=layer_list.begin();iter!=layer_list.end();++iter)
param_list.add("layer",Layer::Handle(*iter));
}
-
+
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"),
)
));
}
-
+
add_actions_to_menu(¶mmenu, param_list,synfigapp::Action::CATEGORY_LAYER);
parammenu.popup(button,gtk_get_current_event_time());
return true;
}
/*
else if(column_id==LayerTree::COLUMNID_TIME_TRACK && value_node && handle<synfig::ValueNode_Animated>::cast_dynamic(value_node))
- {
+ {
// Right-click on time track with animated
// trackmenu.popup(0,0);
return true;
#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);
}
return true;
break;
-
+
default:
return false;
- break;
+ break;
}
}
bool
CanvasView::on_children_user_click(int button, Gtk::TreeRow row, ChildrenTree::ColumnID column_id)
-{
+{
switch(button)
{
case 3:
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 true;
break;
-
+
default:
return false;
- break;
+ break;
}
}
case GDK_BUTTON_PRESS:
switch(event->button.button)
{
- case 3:
+ case 3:
{
//keyframemenu.popup(event->button.button,gtk_get_current_event_time());
return true;
//THESE SHOULD AUTOMATICALLY BE TAKEN CARE OF
//time_adjustment().set_lower(time_window_adjustment().get_value());
//time_adjustment().set_upper(time_window_adjustment().get_value()+time_window_adjustment().get_page_size());
-
+
time_adjustment().set_page_increment(1.0); // One second
time_adjustment().set_page_size(0);
-
+
if(get_canvas())
time_adjustment().set_step_increment(1.0/get_canvas()->rend_desc().get_frame_rate());
time_adjustment().changed();
-
+
//NOTE THIS SHOULD HOOK INTO THE CORRECT SIGNALS...
if(children_tree)
children_tree->queue_draw();
CanvasView::on_time_changed()
{
Time time(get_time());
-
+
current_time_widget->set_value(time);
try {
get_canvas()->keyframe_list().find(time);
current_time_widget->modify_text(Gtk::STATE_NORMAL,Gdk::Color("#FF0000"));
}catch(...){
- current_time_widget->modify_text(Gtk::STATE_NORMAL,Gdk::Color("#000000"));
+ current_time_widget->modify_text(Gtk::STATE_NORMAL,Gdk::Color("#000000"));
}
-
+
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())
}
time_adjustment().set_value(time);
time_adjustment().value_changed();
-
+
// Shouldn't these trees just hook into
// the time changed signal...?
//YES THEY SHOULD...
{
time_window_adjustment().set_page_size(time_window_adjustment().get_page_size()*0.75);
time_window_adjustment().changed();
-
+
refresh_time_window();
}
{
time_window_adjustment().set_page_size(time_window_adjustment().get_page_size()/0.75);
time_window_adjustment().changed();
-
+
refresh_time_window();
}
CanvasView::on_children_edited_value(const Glib::ustring&path_string,synfig::ValueBase value)
{
Gtk::TreePath path(path_string);
-
+
const Gtk::TreeRow row = *(children_tree->get_model()->get_iter(path));
assert((bool)row[children_tree_model.is_value_node]);
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;
icon=manage(new Gtk::Image(Gtk::StockID("gtk-no"),Gtk::ICON_SIZE_BUTTON));
- animatebutton->remove();
- animatebutton->add(*icon);
+ animatebutton->remove();
+ animatebutton->add(*icon);
tooltips.set_tip(*animatebutton,_("In Animate Editing Mode"));
icon->set_padding(0,0);
icon->show();
{
Gtk::Image *icon;
icon=manage(new Gtk::Image(Gtk::StockID("gtk-yes"),Gtk::ICON_SIZE_BUTTON));
- animatebutton->remove();
- animatebutton->add(*icon);
+ animatebutton->remove();
+ animatebutton->add(*icon);
tooltips.set_tip(*animatebutton,_("Not in Animate Editing Mode"));
icon->set_padding(0,0);
icon->show();
{
Gtk::Image *icon;
icon=manage(new Gtk::Image(Gtk::StockID("synfig-keyframe_lock_all"),Gtk::ICON_SIZE_BUTTON));
- keyframebutton->remove();
- keyframebutton->add(*icon);
+ keyframebutton->remove();
+ keyframebutton->add(*icon);
tooltips.set_tip(*keyframebutton,_("All Keyframes Locked"));
icon->set_padding(0,0);
icon->show();
{
Gtk::Image *icon;
icon=manage(new Gtk::Image(Gtk::StockID("synfig-keyframe_lock_future"),Gtk::ICON_SIZE_BUTTON));
- keyframebutton->remove();
- keyframebutton->add(*icon);
+ keyframebutton->remove();
+ keyframebutton->add(*icon);
tooltips.set_tip(*keyframebutton,_("Future Keyframes Locked"));
icon->set_padding(0,0);
icon->show();
{
Gtk::Image *icon;
icon=manage(new Gtk::Image(Gtk::StockID("synfig-keyframe_lock_past"),Gtk::ICON_SIZE_BUTTON));
- keyframebutton->remove();
- keyframebutton->add(*icon);
+ keyframebutton->remove();
+ keyframebutton->add(*icon);
tooltips.set_tip(*keyframebutton,_("Past Keyframes Locked"));
icon->set_padding(0,0);
icon->show();
{
Gtk::Image *icon;
icon=manage(new Gtk::Image(Gtk::StockID("synfig-keyframe_lock_none"),Gtk::ICON_SIZE_BUTTON));
- keyframebutton->remove();
- keyframebutton->add(*icon);
+ keyframebutton->remove();
+ keyframebutton->add(*icon);
tooltips.set_tip(*keyframebutton,_("No Keyframes Locked"));
icon->set_padding(0,0);
icon->show();
}
-
+
work_area->queue_draw();
}
CanvasView::on_keyframe_button_pressed()
{
synfigapp::CanvasInterface::Mode mode(get_mode());
-
+
if((mode&synfigapp::MODE_ANIMATE_FUTURE) && (mode&synfigapp::MODE_ANIMATE_PAST))
{
set_mode(get_mode()-synfigapp::MODE_ANIMATE_FUTURE);
return true;
}
+bool
+CanvasView::on_duck_angle_changed(const synfig::Angle &rotation,const synfigapp::ValueDesc& value_desc)
+{
+ // \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)
{
{
int transforms(0);
String layer_name;
-
-#define QUEUE_REBUILD_DUCKS sigc::mem_fun(*this,&CanvasView::queue_rebuild_ducks)
+
+#define QUEUE_REBUILD_DUCKS sigc::mem_fun(*this,&CanvasView::queue_rebuild_ducks)
if(!canvas)
{
// This layer is currently selected.
duck_changed_connections.push_back(layer->signal_changed().connect(QUEUE_REBUILD_DUCKS));
-
+
// 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
Layer::Vocab vocab=layer->get_param_vocab();
Layer::Vocab::iterator iter;
-
+
for(iter=vocab.begin();iter!=vocab.end();iter++)
{
if(!iter->get_hidden() && !iter->get_invisible_duck())
*this,
&studio::CanvasView::selected_layer_color_set
)
- );
+ );
}
*/
}
}
}
-
+
layer_name=layer->get_name();
-
+
if(layer->active())
{
Transform::Handle trans(layer->get_transform());
}
*/
}
-
+
// If this is a paste canvas layer, then we need to
// descend into it
if(layer_name=="PasteCanvas")
Vector scale;
scale[0]=scale[1]=exp(layer->get_param("zoom").get(Real()));
Vector origin(layer->get_param("origin").get(Vector()));
-
+
Canvas::Handle child_canvas(layer->get_param("canvas").get(Canvas::Handle()));
-
+
if(!scale.is_equal_to(Vector(1,1)))
transform_stack.push(new Transform_Scale(scale,origin));
if(!scale.is_equal_to(Vector(0,0)))
transform_stack.push(new Transform_Translate(origin));
-
+
rebuild_ducks_layer_(transform_stack,child_canvas,selected_list);
-
+
if(!scale.is_equal_to(Vector(0,0)))
transform_stack.pop();
if(!scale.is_equal_to(Vector(1,1)))
#if 0
if(rebuild_ducks_queued)
return;
-#else
+#else
if(rebuild_ducks_queued)
queue_rebuild_ducks_connection.disconnect();
#endif
-
+
queue_rebuild_ducks_connection=Glib::signal_timeout().connect(
sigc::bind_return(
sigc::mem_fun(*this,&CanvasView::rebuild_ducks),
),
50
);
-
+
rebuild_ducks_queued=true;
}
void
CanvasView::rebuild_ducks()
-{
+{
/*static int i=0;
i++;
if(i>30)
synfig::info("%d",i/(i-i));
*/
-
+
rebuild_ducks_queued=false;
//queue_rebuild_ducks_connection.disconnect();
-
+
if(work_area->is_dragging())
{
queue_rebuild_ducks();
return;
}
-
+
if(!duck_refresh_flag)
{
duck_refresh_needed=true;
return;
}
-
+
bbox=Rect::zero();
-
+
work_area->clear_ducks();
work_area->set_time(get_time());
get_canvas()->set_time(get_time());
curr_transform_stack_set=false;
for(;!duck_changed_connections.empty();duck_changed_connections.pop_back())duck_changed_connections.back().disconnect();
-
+
//get_canvas()->set_time(get_time());
bool not_empty(false);
-
- // First do the layers...
+
+ // First do the layers...
do{
synfigapp::SelectionManager::LayerList selected_list(get_selection_manager()->get_selected_layers());
std::set<synfig::Layer::Handle> layer_set(selected_list.begin(),selected_list.end());
-
+
if(!layer_set.empty())
not_empty=true;
-
+
synfig::TransformStack transform_stack;
-
+
rebuild_ducks_layer_(transform_stack, get_canvas(), layer_set);
}while(0);
synfigapp::SelectionManager::ChildrenList selected_list(get_selection_manager()->get_selected_children());
synfigapp::SelectionManager::ChildrenList::iterator iter;
synfig::TransformStack transform_stack;
-
+
if(selected_list.empty())
{
break;
CanvasView::play()
{
assert(get_canvas());
-
+
// If we are already busy, don't play!
if(working_depth)return;
-
+
// Set us up as working
IsWorking is_working(*this);
-
+
etl::clock timer;
Time
time=work_area->get_time(),
// If we are already at the end of time, start over
if(time==endtime)
time=get_canvas()->rend_desc().get_time_start();
-
- is_playing_=true;
+
+ is_playing_=true;
work_area->clear_ducks();
-
+
for(timer.reset(); time + timer() < endtime;)
{
//Clamp the time window so we can see the time value as it races across the horizon
bool timewindreset = false;
-
+
while( time + timer() > Time(time_window_adjustment().get_sub_upper()) )
{
time_window_adjustment().set_value(
);
timewindreset = true;
}
-
+
while( time + timer() < Time(time_window_adjustment().get_sub_lower()) )
{
time_window_adjustment().set_value(
time_window_adjustment().get_value()-time_window_adjustment().get_page_size()/2,
time_window_adjustment().get_lower())
);
-
+
timewindreset = true;
}
-
+
//we need to tell people that the value changed
if(timewindreset) time_window_adjustment().value_changed();
-
+
//update actual time to next step
time_adjustment().set_value(time+timer());
time_adjustment().value_changed();
-
+
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;
+ is_playing_=false;
time_adjustment().set_value(endtime);
time_adjustment().value_changed();
{
Gtk::IconSize iconsize=Gtk::IconSize::from_name("synfig-small_icon");
treetogglebutton->remove();
- treetogglebutton->add(*manage(new Gtk::Image(Gtk::StockID("gtk-go-down"),iconsize)));
+ treetogglebutton->add(*manage(new Gtk::Image(Gtk::StockID("gtk-go-down"),iconsize)));
treetogglebutton->show_all();
notebook->show();
}
{
Gtk::IconSize iconsize=Gtk::IconSize::from_name("synfig-small_icon");
treetogglebutton->remove();
- treetogglebutton->add(*manage(new Gtk::Image(Gtk::StockID("gtk-go-up"),iconsize)));
+ treetogglebutton->add(*manage(new Gtk::Image(Gtk::StockID("gtk-go-up"),iconsize)));
treetogglebutton->show_all();
notebook->hide();
}
}
void
-CanvasView::do_rotoscope_bline()
-{
- smach_.enter(&state_bline);
-}
-
-void
-CanvasView::do_rotoscope()
-{
- smach_.enter(&state_draw);
-}
-
-void
-CanvasView::do_rotoscope_poly()
-{
- smach_.enter(&state_polygon);
-}
-
-void
-CanvasView::do_eyedrop()
-{
- smach_.enter(&state_eyedrop);
-}
-
-void
CanvasView::show_timebar()
{
timebar->show();
current_time_widget->show();
-
+
//keyframe_tab_child->show();
if(layer_tree)
layer_tree->set_show_timetrack(true);
children_tree->set_show_timetrack(false);
}
+void
+CanvasView::set_sensitive_timebar(bool sensitive)
+{
+ timebar->set_sensitive(sensitive);
+ current_time_widget->set_sensitive(sensitive);
+ //keyframe_tab_child->set_sensitive(sensitive);
+ if(layer_tree)
+ layer_tree->set_sensitive(sensitive);
+ if(children_tree)
+ children_tree->set_sensitive(sensitive);
+}
void
case 2:
{
Gtk::Menu* waypoint_menu(manage(new Gtk::Menu()));
+ waypoint_menu->signal_hide().connect(sigc::bind(sigc::ptr_fun(&delete_widget), waypoint_menu));
waypoint_menu->items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("gtk-jump-to"),
sigc::bind(
&Gtk::Widget::show
)
));
-
+
waypoint_menu->items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("synfig-duplicate"),
sigc::bind(
sigc::bind(
}
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(synfig::String(selection_data_.get_data_type())=="STRING")do
break;
synfigapp::Action::Handle action(synfigapp::Action::create("layer_add"));
-
+
assert(action);
if(!action)
break;
-
+
action->set_param("canvas",get_canvas());
action->set_param("canvas_interface",canvas_interface());
action->set_param("new",layer);
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"
-
+
if(synfig::String(selection_data_.get_data_type())=="text/plain")
{
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'));
-
+
std::stringstream stream(selection_data);
-
+
//synfigapp::PassiveGrouper group(canvas_interface()->get_instance(),_("Insert Image"));
while(stream)
{
synfig::String filename,URI;
getline(stream,filename);
-
+
// If we don't have a filename, move on.
if(filename.empty())
continue;
-
+
// Make sure this URL is of the "file://" type.
URI=String(filename.begin(),filename.begin()+sizeof("file://")-1);
if(URI!="file://")
synfig::warning("Unknown URI (%s) in \"%s\"",URI.c_str(),filename.c_str());
continue;
}
-
+
// 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")
{
{
ui_interface_->error("I am unable to find the appropriate action");
return;
- }
-
+ }
+
action->set_param("canvas",get_canvas());
action->set_param("canvas_interface",canvas_interface());
action->set_param("keyframe",Keyframe(get_time()));
{
ui_interface_->error("I am unable to duplicate the keyframe");
return;
- }
+ }
keyframe=row[model.keyframe];
synfigapp::Action::Handle action(synfigapp::Action::create("keyframe_duplicate"));
{
ui_interface_->error("I am unable to find the appropriate action");
return;
- }
-
+ }
+
action->set_param("canvas",get_canvas());
action->set_param("canvas_interface",canvas_interface());
action->set_param("keyframe",keyframe);
{
ui_interface_->error("I am unable to remove the keyframe");
return;
- }
+ }
keyframe=row[model.keyframe];
synfigapp::Action::Handle action(synfigapp::Action::create("keyframe_remove"));
{
ui_interface_->error("I am unable to find the appropriate action");
return;
- }
-
+ }
+
action->set_param("canvas",get_canvas());
action->set_param("canvas_interface",canvas_interface());
action->set_param("keyframe",keyframe);
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);
work_area->set_type_mask(work_area->get_type_mask()-type);
else
work_area->set_type_mask(work_area->get_type_mask()|type);
-
+
work_area->queue_draw();
}
get_smach().egress();
}
assert(device);
-
+
synfigapp::InputDevice::Handle input_device;
input_device=synfigapp::Main::select_input_device(device->name);
App::toolbox->change_state(input_device->get_state());
CanvasView::on_preview_option()
{
Dialog_PreviewOptions *po = dynamic_cast<Dialog_PreviewOptions *>(get_ext_widget("prevoptions"));
-
+
Canvas::Handle canv = get_canvas();
-
+
if(canv)
{
RendDesc &r = canv->rend_desc();
po->set_begin_override(false);
po->set_endtime(end);
po->set_end_override(false);
-
+
set_ext_widget("prevoptions",po);
}
/*po->set_zoom(work_area->get_zoom()/2);
po->set_begin_override(false);
po->set_endtime(end);
po->set_end_override(false);*/
-
+
po->set_global_fps(r.get_frame_rate());
po->signal_finish().connect(sigc::mem_fun(*this,&CanvasView::on_preview_create));
po->present();
void
CanvasView::on_preview_create(const PreviewInfo &info)
-{
+{
//set all the options
etl::handle<Preview> prev = new Preview;
-
+
prev->set_canvasview(this);
prev->set_zoom(info.zoom);
prev->set_fps(info.fps);
//render it out...
prev->render();
-
+
Dialog_Preview *pd = preview_dialog.get();
assert(pd);
-
+
+ pd->set_default_size(700,510);
pd->set_preview(prev.get());
pd->present();
}
void
CanvasView::on_audio_file_change(const std::string &f)
-{
+{
//save in meta data - always even when not valid...
canvas_interface()->set_meta_data("audiofile",f);
}
{
std::string file(get_canvas()->get_meta_data("audiofile"));
if(!file.c_str()) return;
-
+
if(!audio->load(file,dirname(get_canvas()->get_file_name())+string("/")))
{
if(file != "") synfig::warning("Could not load the file: %s", file.c_str());
disp_audio->set_profile(etl::handle<AudioProfile>());
}else
{
- //save in canvasview
+ //save in canvasview
synfig::warning("Getting the profile of the music stuff");
-
+
//profile specific stuff for the preview widget
//similar for other attachments
Dialog_Preview *pd = preview_dialog.get();
pd->get_widget().set_audio(audio);
-
+
handle<AudioProfile> prof = audio->get_profile();
-
+
if(!prof)
{
- synfig::warning("Agh, I couldn't build the profile captain!");
+ synfig::warning("Agh, I couldn't build the profile captain!");
}
pd->get_widget().set_audioprofile(prof);
-
+
disp_audio->set_profile(audio->get_profile());
disp_audio->show();
-
+
synfig::warning("successfully set the profiles and stuff");
}
disp_audio->queue_draw();
audio->set_offset(t);
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
{
synfig::info("Playing audio at %f s",t);
audio->play(t);
- }
+ }
}
void
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)
{
- 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;
}