#include <gtkmm/messagedialog.h>
#include <gtkmm/treemodelsort.h>
#include <gtkmm/buttonbox.h>
+#include <gtkmm/separator.h>
#include <gtk/gtktreestore.h>
#include <gtk/gtkversion.h>
//keyframe_tree_store_ (KeyframeTreeStore::create(canvas_interface_)),
time_adjustment_ (0,0,25,0,0,0),
time_window_adjustment_ (0,0,25,0,0,0),
+ quality_adjustment_ (8,1,10,1,1,0),
statusbar (manage(new class Gtk::Statusbar())),
timeslider (new Widget_Timeslider),
duck_refresh_flag=true;
toggling_ducks_=false;
changing_resolution_=false;
+ updating_quality_=false;
+ toggling_show_grid=false;
smach_.set_default_state(&state_normal);
Gtk::Widget*
CanvasView::create_display_bar()
{
- displaybar = manage(new class Gtk::Table(1, 1, false));
+ displaybar = manage(new class Gtk::Table(1, 6, false));
// Setup the ToggleDuckDial widget
toggleducksdial = Gtk::manage(new class ToggleDucksDial());
toggleducksdial->show();
// Set up the ResolutionDial widget
-
resolutiondial=Gtk::manage(new class ResolutionDial());
resolutiondial->update_lowres(work_area->get_low_resolution_flag());
sigc::mem_fun(*this, &studio::CanvasView::toggle_low_res_pixel_flag));
resolutiondial->show();
- displaybar->attach(*resolutiondial, 1, 2, 0, 1, Gtk::SHRINK, Gtk::SHRINK);
+ // Set up a separator
+ Gtk::VSeparator *separator1 = Gtk::manage(new class Gtk::VSeparator());
+ separator1->show();
+ Gtk::VSeparator *separator2 = Gtk::manage(new class Gtk::VSeparator());
+ separator2->show();
+
+ // Set up quality spin button
+ quality_spin=Gtk::manage(new class Gtk::SpinButton(quality_adjustment_));
+ quality_spin->signal_value_changed().connect(
+ sigc::mem_fun(*this, &studio::CanvasView::update_quality));
+ tooltips.set_tip(*quality_spin, _("Quality (lower is better)"));
+ quality_spin->show();
+
+ // Set up the show grid check button
+ show_grid = Gtk::manage(new class Gtk::CheckButton());
+ show_grid->set_active(work_area->grid_status());
+ Gtk::Image *icon = manage(new Gtk::Image(Gtk::Stock::REMOVE, Gtk::IconSize::from_name("synfig-small_icon")));
+ icon->set_padding(0, 0);
+ icon->show();
+ show_grid->add(*icon);
+ show_grid->signal_toggled().connect(
+ sigc::mem_fun(*this, &studio::CanvasView::toggle_show_grid));
+ tooltips.set_tip(*show_grid, _("Show grid when enabled"));
+ show_grid->show();
+
displaybar->attach(*toggleducksdial, 0, 1, 0, 1, Gtk::SHRINK, Gtk::SHRINK);
+ displaybar->attach(*separator1, 1, 2, 0, 1, Gtk::FILL, Gtk::FILL);
+ displaybar->attach(*resolutiondial, 2, 3, 0, 1, Gtk::SHRINK, Gtk::SHRINK);
+ displaybar->attach(*separator2, 3, 4, 0, 1, Gtk::FILL, Gtk::FILL);
+ displaybar->attach(*quality_spin, 4, 5, 0, 1, Gtk::SHRINK, Gtk::SHRINK);
+ displaybar->attach(*show_grid, 5, 6, 0, 1, Gtk::SHRINK, Gtk::SHRINK);
+
displaybar->show();
return displaybar;
}
action_group->add( action,
sigc::bind(
- sigc::mem_fun(*work_area, &studio::WorkArea::set_quality),
+ sigc::mem_fun(*this, &studio::CanvasView::set_quality),
i
)
);
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));
+ action_group->add(grid_show_toggle, sigc::mem_fun(*this, &studio::CanvasView::toggle_show_grid));
grid_snap_toggle = Gtk::ToggleAction::create("toggle-grid-snap", _("Snap to Grid"));
grid_snap_toggle->set_active(work_area->get_grid_snap());
}
void
+CanvasView::update_quality()
+{
+ if(working_depth)
+ return;
+ if(updating_quality_)
+ return;
+ updating_quality_=true;
+ work_area->set_quality((int) quality_spin->get_value());
+ // Update Quality Radio actions
+ Glib::RefPtr<Gtk::RadioAction> action=Glib::RefPtr<Gtk::RadioAction>::cast_dynamic(
+ action_group->get_action(strprintf("quality-%02d",(int) quality_spin->get_value()))
+ );
+ action->set_active();
+
+ updating_quality_=false;
+}
+
+void
+CanvasView::set_quality(int x)
+{
+ if(updating_quality_)
+ return;
+ work_area->set_quality(x);
+ // Update the quality spin button
+ quality_spin->set_value(x);
+}
+
+void
+CanvasView::toggle_show_grid()
+{
+ if(toggling_show_grid)
+ return;
+ toggling_show_grid=true;
+ work_area->toggle_grid();
+ // Update the toggle grid show action
+ set_grid_show_toggle(work_area->grid_status());
+ // Update the toggle grid show check button
+ show_grid->set_active(work_area->grid_status());
+ toggling_show_grid=false;
+}
+
+
+void
CanvasView::on_dirty_preview()
{
if(!is_playing_)