**
** \legal
** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
-** Copyright (c) 2007 Chris Moore
+** 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 "preview.h"
#include "audiocontainer.h"
#include "widget_timeslider.h"
+#include "keyframedial.h"
#include <synfigapp/main.h>
#include <synfigapp/inputdevice.h>
#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->progressbar->set_fraction(0);
}
+ virtual Response confirmation(const std::string &title,
+ const std::string &primaryText,
+ const std::string &secondaryText,
+ const std::string &confirmPhrase,
+ const std::string &cancelPhrase,
+ Response defaultResponse=RESPONSE_OK)
+ {
+ view->present();
+ //while(studio::App::events_pending())studio::App::iteration(false);
+ Gtk::MessageDialog dialog(
+ *view, // Parent
+ primaryText, // Message
+ false, // Markup
+ Gtk::MESSAGE_WARNING, // Type
+ Gtk::BUTTONS_NONE, // Buttons
+ true // Modal
+ );
+
+ if (! title.empty())
+ dialog.set_title(title);
+ if (! secondaryText.empty())
+ dialog.set_secondary_text(secondaryText);
+
+ dialog.add_button(cancelPhrase, RESPONSE_CANCEL);
+ dialog.add_button(confirmPhrase, RESPONSE_OK);
+ dialog.set_default_response(defaultResponse);
+
+ dialog.show_all();
+ return (Response) dialog.run();
+ }
+
virtual Response yes_no(const std::string &title, const std::string &message,Response dflt=RESPONSE_YES)
{
view->present();
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("%s:%d canvas_view.layer_tree not defined!?", __FILE__, __LINE__); 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("%s:%d canvas_view.layer_tree not defined!?", __FILE__, __LINE__); 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("%s:%d canvas_view.layer_tree not defined!?", __FILE__, __LINE__); 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
{
return;
}
-
-
int get_selected_layer_parameter_count()const
{
return get_selected_layer_parameters().size();
}; // END of class SelectionManager
-
CanvasView::IsWorking::IsWorking(CanvasView &canvas_view_):
canvas_view_(canvas_view_)
{
layer_tree=0;
children_tree=0;
duck_refresh_flag=true;
+ toggling_ducks_=false;
+ changing_resolution_=false;
smach_.set_default_state(&state_normal);
//vpaned->pack2(*notebook, Gtk::SHRINK);
//vpaned->show_all();
-
//notebook->show();
//notebook->append_page(*create_layer_tree(),_("Layers"));
//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, 4, 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);
+ layout_table->attach(*create_display_bar(), 0, 1, 0, 1, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0);
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();
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");
/*
{
// this was causing a crash before
canvas_interface()->signal_dirty_preview().clear();
- synfig::info("CanvasView:~CanvasView(): Destructor Finished");
+ 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()
{
Gtk::Image *icon;
+ //Setup the Time Slider and the Time window scroll
Gtk::HScrollbar *time_window_scroll = manage(new class Gtk::HScrollbar(time_window_adjustment()));
//Gtk::HScrollbar *time_scroll = manage(new class Gtk::HScrollbar(time_adjustment()));
//TIME BAR TEMPORARY POSITION
//Widget_Timeslider *time_scroll = manage(new Widget_Timeslider);
- timeslider->show();
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();
timeslider->show();
- time_window_scroll->set_flags(Gtk::CAN_FOCUS);
+ //time_window_scroll->set_flags(Gtk::CAN_FOCUS); // Uncomment this produce bad render of the HScroll
timeslider->set_flags(Gtk::CAN_FOCUS);
//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"));
+ //Setup the Animation Mode Button and the Keyframe Lock button
+ Gtk::IconSize iconsize=Gtk::IconSize::from_name("synfig-small_icon");
+ SMALL_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"));
- 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
+ //Setup the audio display
disp_audio->set_size_request(-1,32); //disp_audio->show();
disp_audio->set_time_adjustment(&time_adjustment());
disp_audio->signal_start_scrubbing().connect(
disp_audio->signal_stop_scrubbing().connect(
sigc::mem_fun(*audio,&AudioContainer::stop_scrubbing)
);
+ //Setup the current time widget
+ 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());
+ current_time_widget->signal_value_changed().connect(
+ sigc::mem_fun(*this,&CanvasView::on_current_time_widget_changed)
+ );
+ current_time_widget->set_size_request(0,-1); // request horizontal shrink
+ tooltips.set_tip(*current_time_widget,_("Current time"));
+ current_time_widget->show();
+
+ //Setup the FrameDial widget
+ framedial = manage(new class FrameDial());
+ framedial->signal_seek_begin().connect(
+ sigc::bind(sigc::mem_fun(*canvas_interface().get(), &synfigapp::CanvasInterface::seek_time), Time::begin())
+ );
+ framedial->signal_seek_prev_frame().connect(
+ sigc::bind(sigc::mem_fun(*canvas_interface().get(), &synfigapp::CanvasInterface::seek_frame), -1)
+ );
+ framedial->signal_play_stop().connect(
+ sigc::mem_fun(*this, &studio::CanvasView::on_play_stop_pressed)
+ );
+ framedial->signal_seek_next_frame().connect(
+ sigc::bind(sigc::mem_fun(*canvas_interface().get(), &synfigapp::CanvasInterface::seek_frame), 1)
+ );
+ framedial->signal_seek_end().connect(
+ sigc::bind(sigc::mem_fun(*canvas_interface().get(), &synfigapp::CanvasInterface::seek_time), Time::end())
+ );
+ framedial->show();
+
+ //Setup the KeyFrameDial widget
+ KeyFrameDial *keyframedial = Gtk::manage(new class KeyFrameDial());
+ keyframedial->signal_seek_prev_keyframe().connect(sigc::mem_fun(*canvas_interface().get(), &synfigapp::CanvasInterface::jump_to_prev_keyframe));
+ keyframedial->signal_seek_next_keyframe().connect(sigc::mem_fun(*canvas_interface().get(), &synfigapp::CanvasInterface::jump_to_next_keyframe));
+ keyframedial->signal_lock_keyframe().connect(sigc::mem_fun(*this, &studio::CanvasView::on_keyframe_button_pressed));
+ keyframedial->show();
+ keyframebutton=keyframedial->get_lock_button();
+
+ timebar = manage(new class Gtk::Table(5, 4, false));
+
+ //Attach widgets to the timebar
+ timebar->attach(*manage(disp_audio), 1, 5, 0, 1, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK);
+ timebar->attach(*framedial, 0, 1, 2, 3,Gtk::SHRINK, Gtk::SHRINK);
+ timebar->attach(*current_time_widget, 0, 1, 1, 2, Gtk::SHRINK|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0);
+ timebar->attach(*timeslider, 1, 3, 1, 2, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK);
+ timebar->attach(*time_window_scroll, 1, 3, 2, 3, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK);
+ timebar->attach(*keyframedial, 3, 4, 1, 2, Gtk::SHRINK, Gtk::SHRINK);
+ timebar->attach(*animatebutton, 4, 5, 1, 2, Gtk::SHRINK, Gtk::SHRINK);
+ //timebar->attach(*keyframebutton, 1, 2, 3, 4, Gtk::SHRINK, Gtk::SHRINK);
- 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);
+ timebar->show();
- table->attach(*animatebutton, 1, 2, 0, 3, Gtk::SHRINK, Gtk::SHRINK, 0, 0);
- table->attach(*keyframebutton, 2, 3, 0, 3, Gtk::SHRINK, Gtk::SHRINK, 0, 0);
- timebar=table;
- table->show();
- return table;
+ return timebar;
}
Gtk::Widget *
return work_area.get();
}
-
Gtk::Widget*
CanvasView::create_status_bar()
{
cancel=false;
// Create the status bar at the bottom of the window
- Gtk::Table *statusbartable= manage(new class Gtk::Table(7, 1, false));
+ Gtk::Table *statusbartable= manage(new class Gtk::Table(5, 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"));
// 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());
- current_time_widget->signal_value_changed().connect(
- sigc::mem_fun(*this,&CanvasView::on_current_time_widget_changed)
- );
-
- statusbartable->attach(*current_time_widget, 0, 1, 0, 1, Gtk::SHRINK|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0);
- statusbartable->attach(*statusbar, 3, 4, 0, 1, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0);
- statusbartable->attach(*progressbar, 4, 5, 0, 1, Gtk::SHRINK, Gtk::EXPAND|Gtk::FILL, 0, 0);
- statusbartable->attach(*refreshbutton, 5, 6, 0, 1, Gtk::SHRINK, Gtk::SHRINK, 0, 0);
- statusbartable->attach(*stopbutton, 6, 7, 0, 1, Gtk::SHRINK, Gtk::SHRINK, 0, 0);
+ statusbartable->attach(*statusbar, 1, 2, 0, 1, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0);
+ statusbartable->attach(*progressbar, 2, 3, 0, 1, Gtk::SHRINK, Gtk::EXPAND|Gtk::FILL, 0, 0);
+ statusbartable->attach(*refreshbutton, 3, 4, 0, 1, Gtk::SHRINK, Gtk::SHRINK, 0, 0);
+ statusbartable->attach(*stopbutton, 4, 5, 0, 1, Gtk::SHRINK, Gtk::SHRINK, 0, 0);
statusbar->set_has_resize_grip(false);
statusbar->show();
stopbutton->show();
refreshbutton->signal_clicked().connect(SLOT_EVENT(EVENT_REFRESH));
stopbutton->signal_clicked().connect(SLOT_EVENT(EVENT_STOP));
-
statusbartable->show_all();
return statusbartable;
}
-void
-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()
+CanvasView::create_display_bar()
{
- 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));
+ displaybar = manage(new class Gtk::Table(1, 1, false));
- 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();
+ // Setup the ToggleDuckDial widget
+ toggleducksdial = Gtk::manage(new class ToggleDucksDial());
+ Duck::Type m = work_area->get_type_mask();
+ toggleducksdial->update_toggles(m);
- 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);
- */
+ toggleducksdial->signal_ducks_position().connect(
+ sigc::bind(sigc::mem_fun(*this, &studio::CanvasView::toggle_duck_mask),Duck::TYPE_POSITION)
+ );
+ toggleducksdial->signal_ducks_vertex().connect(
+ sigc::bind(sigc::mem_fun(*this, &studio::CanvasView::toggle_duck_mask),Duck::TYPE_VERTEX)
+ );
+ toggleducksdial->signal_ducks_tangent().connect(
+ sigc::bind(sigc::mem_fun(*this, &studio::CanvasView::toggle_duck_mask),Duck::TYPE_TANGENT)
+ );
+ toggleducksdial->signal_ducks_radius().connect(
+ sigc::bind(sigc::mem_fun(*this, &studio::CanvasView::toggle_duck_mask),Duck::TYPE_RADIUS)
+ );
+ toggleducksdial->signal_ducks_width().connect(
+ sigc::bind(sigc::mem_fun(*this, &studio::CanvasView::toggle_duck_mask),Duck::TYPE_WIDTH)
+ );
+ toggleducksdial->signal_ducks_angle().connect(
+ sigc::bind(sigc::mem_fun(*this, &studio::CanvasView::toggle_duck_mask),Duck::TYPE_ANGLE)
+ );
+ toggleducksdial->show();
- 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));
+ // Set up the ResolutionDial widget
- //layout_table->show_all();
+ resolutiondial=Gtk::manage(new class ResolutionDial());
- keyframe_tab_child=layout_table;
+ resolutiondial->update_lowres(work_area->get_low_resolution_flag());
+ resolutiondial->signal_increase_resolution().connect(
+ sigc::mem_fun(*this, &studio::CanvasView::decrease_low_res_pixel_size));
+ resolutiondial->signal_decrease_resolution().connect(
+ sigc::mem_fun(*this, &studio::CanvasView::increase_low_res_pixel_size));
+ resolutiondial->signal_use_low_resolution().connect(
+ sigc::mem_fun(*this, &studio::CanvasView::toggle_low_res_pixel_flag));
+ resolutiondial->show();
+ displaybar->attach(*resolutiondial, 1, 2, 0, 1, Gtk::SHRINK, Gtk::SHRINK);
+ displaybar->attach(*toggleducksdial, 0, 1, 0, 1, Gtk::SHRINK, Gtk::SHRINK);
+ displaybar->show();
- layout_table->hide();
+ return displaybar;
- return layout_table;
}
-Gtk::Widget*
-CanvasView::create_layer_tree()
+void
+CanvasView::on_current_time_widget_changed()
{
- // Create the layer tree
- layer_tree=manage(new class LayerTree());
+ set_time(current_time_widget->get_value());
- // Set up the layer tree
- //layer_tree->set_model(layer_tree_store());
- layer_tree->set_time_adjustment(time_adjustment());
- layer_tree->show();
+ // 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
+}
- // 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));
+// 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;
+// }
- layer_tree->hide();
- return layer_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("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("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")),
// SLOT_EVENT(EVENT_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)
);
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==9) // default quality
+ if (i==8) // default quality
{
action->set_active();
work_area->set_quality(i);
}
}
+ // 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(*this, &studio::CanvasView::toggle_low_res_pixel_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;
}
+ {
+ 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,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,_("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());
}
*/
-
-
#if 0
//
// //Test some key stuff
// 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());
//
}
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*/)
{
-/* if(lyr.second.category==_("Do Not Use"))
+/* if(lyr.second.category==CATEGORY_DO_NOT_USE)
return;
if(category_map->count(lyr.second.category)==0)
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()
{
bool
CanvasView::close_instance()
{
+#ifdef SINGLE_THREADED
if (get_work_area()->get_updating())
{
get_work_area()->stop_updating(true); // stop and mark as cancelled
250);
}
else
+#endif
Glib::signal_timeout().connect(
sigc::bind(sigc::ptr_fun(_close_instance),
(etl::handle<Instance>)get_instance()),
{
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())
- title+='"'+get_canvas()->get_id()+'"';
- else
- title+='"'+get_canvas()->get_name()+'"';
+ 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()
{
void
CanvasView::on_layer_toggle(synfig::Layer::Handle layer)
{
- synfigapp::Action::Handle action(synfigapp::Action::create("layer_activate"));
+ synfigapp::Action::Handle action(synfigapp::Action::create("LayerActivate"));
assert(action);
if(!action)
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());
}
{
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;
}
}
-
-
bool
CanvasView::on_children_user_click(int button, Gtk::TreeRow row, ChildrenTree::ColumnID column_id)
{
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 animate flag was set in mode...
+ Gtk::IconSize iconsize=Gtk::IconSize::from_name("synfig-small_icon");
if(mode&synfigapp::MODE_ANIMATE)
{
Gtk::Image *icon;
- icon=manage(new Gtk::Image(Gtk::StockID("gtk-no"),Gtk::ICON_SIZE_BUTTON));
+ icon=manage(new Gtk::Image(Gtk::StockID("gtk-no"),iconsize));
animatebutton->remove();
animatebutton->add(*icon);
tooltips.set_tip(*animatebutton,_("In Animate Editing Mode"));
else
{
Gtk::Image *icon;
- icon=manage(new Gtk::Image(Gtk::StockID("gtk-yes"),Gtk::ICON_SIZE_BUTTON));
+ icon=manage(new Gtk::Image(Gtk::StockID("gtk-yes"),iconsize));
animatebutton->remove();
animatebutton->add(*icon);
tooltips.set_tip(*animatebutton,_("Not in Animate Editing Mode"));
{
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
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);
Vector origin(layer->get_param("origin").get(Vector()));
Canvas::Handle child_canvas(layer->get_param("canvas").get(Canvas::Handle()));
+ Vector focus(layer->get_param("focus").get(Vector()));
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));
+ transform_stack.push(new Transform_Scale(layer->get_guid(), scale,origin+focus));
+ if(!origin.is_equal_to(Vector(0,0)))
+ transform_stack.push(new Transform_Translate(layer->get_guid(), origin));
rebuild_ducks_layer_(transform_stack,child_canvas,selected_list);
- if(!scale.is_equal_to(Vector(0,0)))
+ if(!origin.is_equal_to(Vector(0,0)))
transform_stack.pop();
if(!scale.is_equal_to(Vector(1,1)))
transform_stack.pop();
}
void
+CanvasView::decrease_low_res_pixel_size()
+{
+ if(changing_resolution_)
+ return;
+ changing_resolution_=true;
+ 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;
+ }
+ // Update the "toggle-low-res" action
+ Glib::RefPtr<Gtk::ToggleAction> action = Glib::RefPtr<Gtk::ToggleAction>::cast_dynamic(action_group->get_action("toggle-low-res"));
+ action->set_active(work_area->get_low_resolution_flag());
+ // Update toggle low res button
+ resolutiondial->update_lowres(work_area->get_low_resolution_flag());
+ changing_resolution_=false;
+}
+
+void
+CanvasView::increase_low_res_pixel_size()
+{
+ if(changing_resolution_)
+ return;
+ changing_resolution_=true;
+ list<int> sizes = CanvasView::get_pixel_sizes();
+ int pixel_size = work_area->get_low_res_pixel_size();
+ if (!work_area->get_low_resolution_flag())
+ {
+ // We were using "hi res" so change it to low res.
+ work_area->set_low_resolution_flag(true);
+ // Update the "toggle-low-res" action
+ Glib::RefPtr<Gtk::ToggleAction> action = Glib::RefPtr<Gtk::ToggleAction>::cast_dynamic(action_group->get_action("toggle-low-res"));
+ action->set_active(true);
+ // Update the toggle low res button
+ resolutiondial->update_lowres(true);
+ changing_resolution_=false;
+ 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;
+ }
+ // Update the "toggle-low-res" action
+ Glib::RefPtr<Gtk::ToggleAction> action = Glib::RefPtr<Gtk::ToggleAction>::cast_dynamic(action_group->get_action("toggle-low-res"));
+ action->set_active(work_area->get_low_resolution_flag());
+ // Update toggle low res button
+ resolutiondial->update_lowres(work_area->get_low_resolution_flag());
+ changing_resolution_=false;
+}
+
+void
+CanvasView::toggle_low_res_pixel_flag()
+{
+ if(changing_resolution_)
+ return;
+ changing_resolution_=true;
+ work_area->toggle_low_resolution_flag();
+ // Update the toggle low res button
+ resolutiondial->update_lowres(work_area->get_low_resolution_flag());
+ // Update the "toggle-low-res" action
+ Glib::RefPtr<Gtk::ToggleAction> action = Glib::RefPtr<Gtk::ToggleAction>::cast_dynamic(action_group->get_action("toggle-low-res"));
+ action->set_active(work_area->get_low_resolution_flag());
+ changing_resolution_=false;
+}
+
+void
CanvasView::on_dirty_preview()
{
if(!is_playing_)
return;
}
}
+ on_play_stop_pressed();
is_playing_=false;
-
time_adjustment().set_value(endtime);
time_adjustment().value_changed();
}
CanvasView::show_timebar()
{
timebar->show();
- current_time_widget->show();
+ //current_time_widget->show(); // not needed now that belongs to the timebar
//keyframe_tab_child->show();
if(layer_tree)
CanvasView::hide_timebar()
{
timebar->hide();
- current_time_widget->hide();
+ //current_time_widget->hide(); // not needed now that belongs to the timebar
//keyframe_tab_child->hide();
if(layer_tree)
layer_tree->set_show_timetrack(false);
CanvasView::set_sensitive_timebar(bool sensitive)
{
timebar->set_sensitive(sensitive);
- current_time_widget->set_sensitive(sensitive);
+ //current_time_widget->set_sensitive(sensitive); //not needed now that belongs to timebar
//keyframe_tab_child->set_sensitive(sensitive);
if(layer_tree)
layer_tree->set_sensitive(sensitive);
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("WaypointSet"));
+
+ 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* 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(
- sigc::mem_fun(
- *canvas_interface(),
- &synfigapp::CanvasInterface::set_time
- ),
- waypoint.get_time()
- )
- ));
+ 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()));
- waypoint_menu->items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("Edit Waypoint"),
- sigc::mem_fun(
- waypoint_dialog,
- &Gtk::Widget::show
- )
- ));
+ {
+ 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("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());
+ // ------------------------------------------------------------------------
+ if (size == 1)
+ {
+ const synfigapp::ValueDesc value_desc(synfig::ValueNode_Animated::Handle::cast_reinterpret(waypoint.get_parent_value_node()), time);
+ get_instance()->make_param_menu(waypoint_menu,canvas_interface()->get_canvas(),value_desc,0.5f);
+
+ // ------------------------------------------------------------------------
+ waypoint_menu->items().push_back(Gtk::Menu_Helpers::SeparatorElem());
}
- break;
+
+ // ------------------------------------------------------------------------
+ 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::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;
+
default:
break;
}
param_list.add("waypoint",waypoint_dialog.get_waypoint());
// param_list.add("time",canvas_interface()->get_time());
- get_instance()->process_action("waypoint_set_smart", param_list);
+ get_instance()->process_action("WaypointSetSmart", param_list);
}
void
param_list.add("waypoint",waypoint_dialog.get_waypoint());
// param_list.add("time",canvas_interface()->get_time());
- get_instance()->process_action("waypoint_remove", param_list);
+ get_instance()->process_action("WaypointRemove", param_list);
}
void
if(!layer->set_param("text",ValueBase(selection_data)))
break;
- synfigapp::Action::Handle action(synfigapp::Action::create("layer_add"));
+ synfigapp::Action::Handle action(synfigapp::Action::create("LayerAdd"));
assert(action);
if(!action)
}
else
{
- if(canvas_interface()->import(filename))
+ String errors, warnings;
+ if(canvas_interface()->import(filename, errors, warnings, App::resize_imported_images))
success=true;
+ if (warnings != "")
+ App::dialog_warning_blocking(_("Warnings"), strprintf("%s:\n\n%s", _("Warnings"), warnings.c_str()));
}
continue;
void
CanvasView::on_keyframe_add_pressed()
{
- synfigapp::Action::Handle action(synfigapp::Action::create("keyframe_add"));
+ synfigapp::Action::Handle action(synfigapp::Action::create("KeyframeAdd"));
if(!action)
{
}
keyframe=row[model.keyframe];
- synfigapp::Action::Handle action(synfigapp::Action::create("keyframe_duplicate"));
+ synfigapp::Action::Handle action(synfigapp::Action::create("KeyframeDuplicate"));
if(!action)
{
}
keyframe=row[model.keyframe];
- synfigapp::Action::Handle action(synfigapp::Action::create("keyframe_remove"));
+ synfigapp::Action::Handle action(synfigapp::Action::create("KeyframeRemove"));
if(!action)
{
canvas_interface()->get_instance()->perform_action(action);
}
-
void
CanvasView::toggle_duck_mask(Duckmatic::Type type)
{
+ if(toggling_ducks_)
+ return;
+ toggling_ducks_=true;
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->set_type_mask(work_area->get_type_mask()|type);
work_area->queue_draw();
+ try
+ {
+ toggleducksdial->update_toggles(work_area->get_type_mask());
+ }
+ catch(...)
+ {
+ toggling_ducks_=false;
+ }
+ toggling_ducks_=false;
}
-
void
CanvasView::image_import()
{
- String filename(dirname(get_canvas()->get_file_name()));
- if(App::dialog_open_file(_("Import Image"), filename))
- canvas_interface()->import(filename);
+ // String filename(dirname(get_canvas()->get_file_name()));
+ String filename("*.*");
+ String errors, warnings;
+ if(App::dialog_open_file(_("Import Image"), filename, IMAGE_DIR_PREFERENCE))
+ {
+ canvas_interface()->import(filename, errors, warnings, App::resize_imported_images);
+ if (warnings != "")
+ App::dialog_warning_blocking(_("Warnings"), strprintf("%s:\n\n%s", _("Warnings"), warnings.c_str()));
+ }
}
Smach::event_result
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")
}
bool
-CanvasView::on_delete_event(GdkEventAny* event)
+CanvasView::on_delete_event(GdkEventAny* event __attribute__ ((unused)))
{
close_view();
return true;
}
+
+//! Modify the play stop button apearence and play stop the animation
+void
+CanvasView::on_play_stop_pressed()
+{
+ Gtk::Image *icon;
+ Gtk::Button *stop_button;
+ stop_button=framedial->get_play_button();
+ bool play_flag;
+ if(!is_playing())
+ {
+ icon = manage(new Gtk::Image(Gtk::Stock::MEDIA_STOP, Gtk::IconSize::from_name("synfig-small_icon")));
+ stop_button->set_relief(Gtk::RELIEF_NORMAL);
+ play_flag=true;
+ }
+ else
+ {
+ icon = manage(new Gtk::Image(Gtk::Stock::MEDIA_PLAY, Gtk::IconSize::from_name("synfig-small_icon")));
+ stop_button->set_relief(Gtk::RELIEF_NONE);
+ play_flag=false;
+ }
+ stop_button->remove();
+ stop_button->add(*icon);
+ icon->set_padding(0, 0);
+ icon->show();
+ if(play_flag) play(); else stop();
+}