#include <synfigapp/main.h>
#include <synfigapp/inputdevice.h>
+#include "general.h"
+
#endif
/* === U S I N G =========================================================== */
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"));
}
};
//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
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();
// WorkArea::async_update_preview() =>
// WorkArea::set_zoom(float) =>
// WorkArea::async_update_preview() =>
- // desc.set_time(cur_time), where cur_time isn't initialised
+ // 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);
//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 *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);
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);
*/
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")),
);
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->set_active();
}
-#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( \
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());
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)));
));
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));
{
}
- //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)
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();
bool
-CanvasView::close()
+CanvasView::close_view()
{
- get_instance()->safe_close();
+ 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()
+{
+ 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";
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);
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;
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)
{
// 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
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(
{
// 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))
{
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")
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
- );
- }
+ 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?