From fcc26857bd057cd2e26f900221fd41bd9e0d907e Mon Sep 17 00:00:00 2001 From: Ivan Mahonin Date: Sep 03 2018 15:40:03 +0000 Subject: Fix interactions with Gtk::Adjustment --- diff --git a/synfig-core/src/synfig/general.h b/synfig-core/src/synfig/general.h index 54ccb8c..8a30321 100644 --- a/synfig-core/src/synfig/general.h +++ b/synfig-core/src/synfig/general.h @@ -62,6 +62,11 @@ /* === C L A S S E S & S T R U C T S ======================================= */ +namespace Glib { + template class RefPtr; + class ObjectBase; +} + namespace synfig { class ChangeLocale { @@ -81,6 +86,22 @@ public: } }; +//! Temoraly freezes all notifications from Glib object +//! All notifications will raised immediately when GlibFreezeNotify is destroyed +//! see: Glib::ObjectBase::freeze_notify(), Glib::ObjectBase::thaw_notify() +class GlibFreezeNotify { +private: + Glib::ObjectBase *obj; + Glib::RefPtr *obj_ref; + GlibFreezeNotify(const GlibFreezeNotify &other); + GlibFreezeNotify& operator=(const GlibFreezeNotify&) { return *this; } +public: + explicit GlibFreezeNotify(Glib::ObjectBase &obj); + explicit GlibFreezeNotify(Glib::ObjectBase *obj); + explicit GlibFreezeNotify(const Glib::RefPtr &obj_ref); + ~GlibFreezeNotify(); +}; + /* extern bool add_to_module_search_path(const std:string &path); extern bool add_to_config_search_path(const std:string &path); diff --git a/synfig-core/src/synfig/main.cpp b/synfig-core/src/synfig/main.cpp index d68d63d..2be3bce 100644 --- a/synfig-core/src/synfig/main.cpp +++ b/synfig-core/src/synfig/main.cpp @@ -77,6 +77,7 @@ #include "mutex.h" #include +#include #ifdef HAVE_SIGNAL_H #include @@ -118,6 +119,33 @@ GeneralIOMutexHolder general_io_mutex; /* === M E T H O D S ======================================================= */ +GlibFreezeNotify::GlibFreezeNotify(Glib::ObjectBase &obj): + obj(&obj), obj_ref() + { if (this->obj) this->obj->freeze_notify(); } + +GlibFreezeNotify::GlibFreezeNotify(Glib::ObjectBase *obj): + obj(obj), obj_ref() + { if (this->obj) this->obj->freeze_notify(); } + +GlibFreezeNotify::GlibFreezeNotify(const Glib::RefPtr &obj_ref): + obj(), obj_ref() +{ + if (obj_ref) { + this->obj_ref = new Glib::RefPtr(obj_ref); + (*this->obj_ref)->freeze_notify(); + } +} + +GlibFreezeNotify::~GlibFreezeNotify() +{ + if (obj) obj->thaw_notify(); + if (obj_ref) { + if (*obj_ref) (*obj_ref)->thaw_notify(); + delete obj_ref; + } +} + + const char * synfig::get_version() { diff --git a/synfig-studio/src/gui/docks/dock_timetrack.cpp b/synfig-studio/src/gui/docks/dock_timetrack.cpp index c7a6d01..a10983f 100644 --- a/synfig-studio/src/gui/docks/dock_timetrack.cpp +++ b/synfig-studio/src/gui/docks/dock_timetrack.cpp @@ -169,7 +169,6 @@ public: mimic_tree_view->get_vadjustment()->get_page_size() ) ); - mimic_tree_view->get_vadjustment()->value_changed(); } else if(event->scroll.direction==GDK_SCROLL_UP) { @@ -180,7 +179,6 @@ public: mimic_tree_view->get_vadjustment()->get_lower() ) ); - mimic_tree_view->get_vadjustment()->value_changed(); } } break; diff --git a/synfig-studio/src/gui/preview.cpp b/synfig-studio/src/gui/preview.cpp index 6a3ea84..53dafb4 100644 --- a/synfig-studio/src/gui/preview.cpp +++ b/synfig-studio/src/gui/preview.cpp @@ -833,7 +833,6 @@ bool studio::Widget_Preview::play_update() //set the new time... adj_time_scrub->set_value(time); - adj_time_scrub->value_changed(); //update the window to the correct image we might want to do this later... //update(); @@ -859,10 +858,7 @@ void studio::Widget_Preview::scrub_updated(double t) //synfig::info("Scrubbing to %.3f, setting adj to %.3f",oldt,t); if(adj_time_scrub->get_value() != t) - { adj_time_scrub->set_value(t); - adj_time_scrub->value_changed(); - } } void studio::Widget_Preview::disconnect_preview(Preview *prev) diff --git a/synfig-studio/src/gui/timemodel.cpp b/synfig-studio/src/gui/timemodel.cpp index 49e78e9..579f463 100644 --- a/synfig-studio/src/gui/timemodel.cpp +++ b/synfig-studio/src/gui/timemodel.cpp @@ -111,8 +111,6 @@ TimeModel::on_value_changed(Glib::RefPtr *source) void TimeModel::configure_adjustment( const Glib::RefPtr &adjustment, - bool &is_changed, - bool &is_value_changed, synfig::Time value, synfig::Time lower, synfig::Time upper, @@ -120,13 +118,6 @@ TimeModel::configure_adjustment( synfig::Time page_increment, synfig::Time page_size ) { - is_value_changed = !approximate_equal(adjustment->get_value(), (double)value); - is_changed = !approximate_equal(adjustment->get_lower(), (double)lower) - || !approximate_equal(adjustment->get_upper(), (double)upper) - || !approximate_equal(adjustment->get_step_increment(), (double)step_increment) - || !approximate_equal(adjustment->get_page_increment(), (double)page_increment) - || !approximate_equal(adjustment->get_page_size(), (double)page_size); - adjustment->set_lower((double)lower); adjustment->set_upper((double)upper); adjustment->set_step_increment((double)step_increment); @@ -139,24 +130,18 @@ TimeModel::configure_adjustment( void TimeModel::sync() { - bool is_full_changed = false; - bool is_scroll_changed = false; - bool is_visible_changed = false; - bool is_play_changed = false; - - bool is_full_value_changed = false; - bool is_scroll_value_changed = false; - bool is_visible_value_changed = false; - bool is_play_value_changed = false; - Time step_increment = get_step_increment(); Time page_increment = get_page_increment(); Time page_size = get_page_size(); + // raise events only when all changes will done + GlibFreezeNotify freeze_full_time(full_time_adjustment()); + GlibFreezeNotify freeze_scroll_time(scroll_time_adjustment()); + GlibFreezeNotify freeze_visible_time(visible_time_adjustment()); + GlibFreezeNotify freeze_play_bounds(play_bounds_adjustment()); + configure_adjustment( full_time_adjustment(), - is_full_changed, - is_full_value_changed, time, lower, upper, @@ -166,8 +151,6 @@ TimeModel::sync() configure_adjustment( scroll_time_adjustment(), - is_scroll_changed, - is_scroll_value_changed, visible_lower, lower, upper, @@ -177,8 +160,6 @@ TimeModel::sync() configure_adjustment( visible_time_adjustment(), - is_visible_changed, - is_visible_value_changed, time, visible_lower, visible_upper, @@ -188,26 +169,12 @@ TimeModel::sync() configure_adjustment( play_bounds_adjustment(), - is_play_changed, - is_play_value_changed, time, play_bounds_lower, play_bounds_upper, step_increment, page_increment, page_size ); - - if (is_full_changed) full_time_adjustment()->changed(); else - if (is_full_value_changed) full_time_adjustment()->value_changed(); - - if (is_scroll_changed) scroll_time_adjustment()->changed(); else - if (is_scroll_value_changed) scroll_time_adjustment()->value_changed(); - - if (is_visible_changed) visible_time_adjustment()->changed(); else - if (is_visible_value_changed) visible_time_adjustment()->value_changed(); - - if (is_play_changed) play_bounds_adjustment()->changed(); else - if (is_play_value_changed) play_bounds_adjustment()->value_changed(); } bool diff --git a/synfig-studio/src/gui/timemodel.h b/synfig-studio/src/gui/timemodel.h index f635d70..482c92c 100644 --- a/synfig-studio/src/gui/timemodel.h +++ b/synfig-studio/src/gui/timemodel.h @@ -80,8 +80,6 @@ private: void configure_adjustment( const Glib::RefPtr &adjustment, - bool &is_changed, - bool &is_value_changed, synfig::Time value, synfig::Time lower, synfig::Time upper, diff --git a/synfig-studio/src/gui/widgets/widget_coloredit.cpp b/synfig-studio/src/gui/widgets/widget_coloredit.cpp index 71290f6..4cbe3b4 100644 --- a/synfig-studio/src/gui/widgets/widget_coloredit.cpp +++ b/synfig-studio/src/gui/widgets/widget_coloredit.cpp @@ -399,12 +399,6 @@ Widget_ColorEdit::Widget_ColorEdit(): set_size_request(200,-1); hold_signals=true; - - R_adjustment->set_lower(-10000000); - G_adjustment->set_lower(-10000000); - B_adjustment->set_lower(-10000000); - A_adjustment->set_lower(-10000000); - clamp_=true; Pango::AttrList attr_list; diff --git a/synfig-studio/src/gui/widgets/widget_curves.cpp b/synfig-studio/src/gui/widgets/widget_curves.cpp index 6ee530e..139c41d 100644 --- a/synfig-studio/src/gui/widgets/widget_curves.cpp +++ b/synfig-studio/src/gui/widgets/widget_curves.cpp @@ -418,33 +418,29 @@ Widget_Curves::on_event(GdkEvent *event) switch(event->scroll.direction) { case GDK_SCROLL_UP: - case GDK_SCROLL_RIGHT: - if (Gdk::ModifierType(event->scroll.state)&GDK_CONTROL_MASK) - { + case GDK_SCROLL_RIGHT: { + GlibFreezeNotify freeze(range_adjustment_); + if (Gdk::ModifierType(event->scroll.state)&GDK_CONTROL_MASK) { // Ctrl+scroll , perform zoom in range_adjustment_->set_page_size(range_adjustment_->get_page_size()/1.25); - } - else - { + } else { // Scroll up range_adjustment_->set_value(range_adjustment_->get_value()-range_adjustment_->get_step_increment ()); } - range_adjustment_->changed(); break; + } case GDK_SCROLL_DOWN: - case GDK_SCROLL_LEFT: - if (Gdk::ModifierType(event->scroll.state)&GDK_CONTROL_MASK) - { + case GDK_SCROLL_LEFT: { + GlibFreezeNotify freeze(range_adjustment_); + if (Gdk::ModifierType(event->scroll.state)&GDK_CONTROL_MASK) { // Ctrl+scroll , perform zoom out range_adjustment_->set_page_size(range_adjustment_->get_page_size()*1.25); - } - else - { + } else { // Scroll down range_adjustment_->set_value(range_adjustment_->get_value()+range_adjustment_->get_step_increment ()); } - range_adjustment_->changed(); break; + } default: break; } @@ -455,27 +451,6 @@ Widget_Curves::on_event(GdkEvent *event) } return true; - -/* switch(event->type) - { - case GDK_BUTTON_PRESS: - if(event->button.button==1) - { - signal_activate_(); - return true; - } - if(event->button.button==3) - { - signal_secondary_(); - return true; - } - break; - - default: - break; - } - return false; -*/ } bool @@ -613,6 +588,7 @@ Widget_Curves::on_draw(const Cairo::RefPtr &cr) if(!curve_list_.empty()) { + GlibFreezeNotify freeze(range_adjustment_); range_adjustment_->set_upper(r_max+range_adjustment_->get_page_size()/2); range_adjustment_->set_lower(r_min-range_adjustment_->get_page_size()/2); } diff --git a/synfig-studio/src/gui/widgets/widget_sound.cpp b/synfig-studio/src/gui/widgets/widget_sound.cpp index 72382e0..b1df4e7 100644 --- a/synfig-studio/src/gui/widgets/widget_sound.cpp +++ b/synfig-studio/src/gui/widgets/widget_sound.cpp @@ -31,12 +31,13 @@ #include -#include #include #include -#include "widgets/widget_sound.h" +#include + #include "audiocontainer.h" +#include "widget_sound.h" #include @@ -44,11 +45,8 @@ /* === U S I N G =========================================================== */ -using namespace std; -using namespace etl; -//using namespace synfig; - -using studio::AudioProfile; +using namespace synfig; +using namespace studio; /* === M A C R O S ========================================================= */ @@ -60,47 +58,44 @@ using studio::AudioProfile; /* === E N T R Y P O I N T ================================================= */ -studio::Widget_Sound::Widget_Sound() -{ -} +Widget_Sound::Widget_Sound() + { } -studio::Widget_Sound::~Widget_Sound() -{ -} +Widget_Sound::~Widget_Sound() + { } -void studio::Widget_Sound::set_position(double t) +void +Widget_Sound::set_position(double t) { - //synfig::info("Setting position to %.2lf s", t); - if(adj_timescale && t != adj_timescale->get_value()) - { + //info("Setting position to %.2lf s", t); + if(adj_timescale && t != adj_timescale->get_value()) { float upper = adj_timescale->get_upper(); float lower = adj_timescale->get_lower(); float framesize = upper - lower; - if(t < lower) - { + if (t < lower) { lower -= ceil((lower-t)/framesize)*framesize; upper = lower + framesize; - adj_timescale->set_lower(lower); adj_timescale->set_upper(upper); + GlibFreezeNotify freeze(adj_timescale); + adj_timescale->set_lower(lower); + adj_timescale->set_upper(upper); adj_timescale->set_value(t); - adj_timescale->changed(); adj_timescale->value_changed(); - }else - if(t > upper) - { + } else + if (t > upper) { lower += ceil((t-upper)/framesize)*framesize; upper = lower + framesize; - adj_timescale->set_lower(lower); adj_timescale->set_upper(upper); + GlibFreezeNotify freeze(adj_timescale); + adj_timescale->set_lower(lower); + adj_timescale->set_upper(upper); adj_timescale->set_value(t); - adj_timescale->changed(); adj_timescale->value_changed(); - }else - { + } else { adj_timescale->set_value(t); - adj_timescale->value_changed(); } } } -double studio::Widget_Sound::get_position() const +double +Widget_Sound::get_position() const { if(adj_timescale) { @@ -109,15 +104,15 @@ double studio::Widget_Sound::get_position() const return 0; } -bool studio::Widget_Sound::set_profile(etl::handle p) +bool +Widget_Sound::set_profile(etl::handle p) { clear(); //set the profile audioprof = p; - if(!audioprof) - { + if (!audioprof) { clear(); return false; } @@ -125,22 +120,20 @@ bool studio::Widget_Sound::set_profile(etl::handle p) return true; } -etl::handle studio::Widget_Sound::get_profile() const -{ - return audioprof; -} +etl::handle +Widget_Sound::get_profile() const + { return audioprof; } -void studio::Widget_Sound::clear() -{ - audioprof.detach(); -} +void +Widget_Sound::clear() + { audioprof.detach(); } -void studio::Widget_Sound::draw() -{ - queue_draw(); -} +void +Widget_Sound::draw() + { queue_draw(); } -bool studio::Widget_Sound::on_draw(const Cairo::RefPtr &cr) +bool +Widget_Sound::on_draw(const Cairo::RefPtr &cr) { Gdk::RGBA c("#3f3f3f"); @@ -158,7 +151,7 @@ bool studio::Widget_Sound::on_draw(const Cairo::RefPtr &cr) //redraw all the samples from begin to end, but only if we have samples to draw (or there is no space to draw) - //synfig::warning("Ok rendered everything, now must render actual sound wave"); + //warning("Ok rendered everything, now must render actual sound wave"); if(!audioprof || !adj_timescale || !w) return true; @@ -185,20 +178,20 @@ bool studio::Widget_Sound::on_draw(const Cairo::RefPtr &cr) float beginf = adj_timescale->get_lower(); float endf = adj_timescale->get_upper(); - posi = round_to_int((position-beginf)*w/framesize); + posi = etl::round_to_int((position-beginf)*w/framesize); //posi = (int)((position-beginf)*w/framesize); //calculate in sample space from seconds - begin = round_to_int((beginf - offset)*samplerate); - end = round_to_int((endf - offset)*samplerate); + begin = etl::round_to_int((beginf - offset)*samplerate); + end = etl::round_to_int((endf - offset)*samplerate); //begin = (int)((beginf - offset)*samplerate); //end = (int)((endf - offset)*samplerate); } delta = (end - begin)/(float)w; //samples per pixel - /*synfig::warning("Rendering a framesize of %f secs from [%d,%d) samples to %d samples, took %f sec", - framesize, begin, end, w, check());*/ + //warning("Rendering a framesize of %f secs from [%d,%d) samples to %d samples, took %f sec", + // framesize, begin, end, w, check()); cur = begin; cum = 0; @@ -227,7 +220,7 @@ bool studio::Widget_Sound::on_draw(const Cairo::RefPtr &cr) } } - //synfig::warning("Drawing audio line"); + //warning("Drawing audio line"); cr->set_source_rgb(1.0, 0.0, 0.0); cr->move_to(posi,0); cr->line_to(posi,get_height()); @@ -239,7 +232,8 @@ bool studio::Widget_Sound::on_draw(const Cairo::RefPtr &cr) //--- Handle the single clicking and dragging for scrubbing -bool studio::Widget_Sound::on_motion_notify_event(GdkEventMotion* event) +bool +Widget_Sound::on_motion_notify_event(GdkEventMotion* event) { Gdk::ModifierType mod = Gdk::ModifierType(event->state); @@ -257,20 +251,19 @@ bool studio::Widget_Sound::on_motion_notify_event(GdkEventMotion* event) //signal that we are scrubbing to this new value... signal_scrub()(t); - // We should be able to just call // Widget_Timeslider::on_motion_notify_event(), // but that seems to cause the program to halt // for some reason. So for now, let's do the job ourselves //adj_timescale->set_value(t); - //adj_timescale->changed(); //return true; } return Widget_Timeslider::on_motion_notify_event(event); } -bool studio::Widget_Sound::on_button_press_event(GdkEventButton *event) +bool +Widget_Sound::on_button_press_event(GdkEventButton *event) { //Assume button PRESS @@ -293,16 +286,15 @@ bool studio::Widget_Sound::on_button_press_event(GdkEventButton *event) return Widget_Timeslider::on_button_press_event(event); } -bool studio::Widget_Sound::on_button_release_event(GdkEventButton *event) +bool +Widget_Sound::on_button_release_event(GdkEventButton *event) { //Assume button RELEASE //if we are ending... using left click - if(event->button == 1) - { + if (event->button == 1) { //signal the scrubbing device... to stop signal_stop_scrubbing()(); - return true; } diff --git a/synfig-studio/src/gui/widgets/widget_timeslider.cpp b/synfig-studio/src/gui/widgets/widget_timeslider.cpp index 61224fe..01e4b34 100644 --- a/synfig-studio/src/gui/widgets/widget_timeslider.cpp +++ b/synfig-studio/src/gui/widgets/widget_timeslider.cpp @@ -422,17 +422,14 @@ bool Widget_Timeslider::on_motion_notify_event(GdkEventMotion* event) //for drag //But clamp to bounds if they exist... //HACK - bounds should not be required for this slider - if(adj_bounds) - { - if(start < adj_bounds->get_lower()) - { + if (adj_bounds) { + GlibFreezeNotify freeze(adj_bounds); + if(start < adj_bounds->get_lower()) { diff = adj_bounds->get_lower() - start; start += diff; end += diff; } - - if(end > adj_bounds->get_upper()) - { + if(end > adj_bounds->get_upper()) { diff = adj_bounds->get_upper() - end; start += diff; end += diff; @@ -441,10 +438,9 @@ bool Widget_Timeslider::on_motion_notify_event(GdkEventMotion* event) //for drag //synfig::info("Scrolling timerange to (%.4f,%.4f)",start,end); + GlibFreezeNotify freeze(adj_timescale); adj_timescale->set_lower(start); adj_timescale->set_upper(end); - - adj_timescale->changed(); }else { dragscroll = true; @@ -460,29 +456,17 @@ bool Widget_Timeslider::on_motion_notify_event(GdkEventMotion* event) //for drag double curx = event->x; //get time from drag... - double start = adj_timescale->get_lower(), - end = adj_timescale->get_upper(), - current = adj_timescale->get_value(); - double t = start + curx*(end - start)/get_width(); + double start = adj_timescale->get_lower(); + double end = adj_timescale->get_upper(); + double current = adj_timescale->get_value(); + Time t(start + curx*(end - start)/get_width()); //snap it to fps - if they exist... - if(fps) - { - t = floor(t*fps + 0.5)/fps; - } + if (fps) t = t.round(fps); //set time if needed - if(current != t) - { - adj_timescale->set_value(t); - - //Fixed this to actually do what it's supposed to... - if(event->time-last_event_time>50) - { - adj_timescale->value_changed(); - last_event_time = event->time; - } - } + if (current != t) + adj_timescale->set_value((double)t); return true; } @@ -538,14 +522,13 @@ bool Widget_Timeslider::on_scroll_event(GdkEventScroll* event) //for zooming if ((t-start)*2 > (end-start)) { // if we can't scroll the background left one whole tick, scroll it to the end - if (end > upper - (t-orig_t)) - { + if (end > upper - (t-orig_t)) { + GlibFreezeNotify freeze(adj_timescale); adj_timescale->set_lower(upper - (end-start)); adj_timescale->set_upper(upper); - } - // else scroll the background left - else - { + } else { + // else scroll the background left + GlibFreezeNotify freeze(adj_timescale); adj_timescale->set_lower(start + (t-orig_t)); adj_timescale->set_upper(start + (t-orig_t) + (end-start)); } @@ -564,25 +547,22 @@ bool Widget_Timeslider::on_scroll_event(GdkEventScroll* event) //for zooming if ((t-start)*2 < (end-start)) { // if we can't scroll the background right one whole tick, scroll it to the beginning - if (start < lower + (orig_t-t)) - { + if (start < lower + (orig_t-t)) { + GlibFreezeNotify freeze(adj_timescale); adj_timescale->set_lower(lower); adj_timescale->set_upper(lower + (end-start)); - } - // else scroll the background right - else - { + } else { + // else scroll the background left + GlibFreezeNotify freeze(adj_timescale); adj_timescale->set_lower(start - (orig_t-t)); adj_timescale->set_upper(start - (orig_t-t) + (end-start)); } } } - if(adj_timescale) - { + if (adj_timescale) adj_timescale->set_value(t); - adj_timescale->value_changed(); - } + return true; } default: @@ -605,25 +585,18 @@ void Widget_Timeslider::zoom_in(bool centerontime) start = focuspoint + (start-focuspoint)*zoominfactor; //synfig::info("Zooming in timerange to (%.4f,%.4f)",start,end); - if(adj_bounds) - { + if (adj_bounds) { + GlibFreezeNotify freeze(adj_bounds); if(start < adj_bounds->get_lower()) - { start = adj_bounds->get_lower(); - } - if(end > adj_bounds->get_upper()) - { end = adj_bounds->get_upper(); - } } //reset values + GlibFreezeNotify freeze(adj_timescale); adj_timescale->set_lower(start); adj_timescale->set_upper(end); - - //call changed function - adj_timescale->changed(); } void Widget_Timeslider::zoom_out(bool centerontime) @@ -641,25 +614,18 @@ void Widget_Timeslider::zoom_out(bool centerontime) start = focuspoint + (start-focuspoint)*zoomoutfactor; //synfig::info("Zooming out timerange to (%.4f,%.4f)",start,end); - if(adj_bounds) - { + if(adj_bounds) { + GlibFreezeNotify freeze(adj_bounds); if(start < adj_bounds->get_lower()) - { start = adj_bounds->get_lower(); - } - if(end > adj_bounds->get_upper()) - { end = adj_bounds->get_upper(); - } } //reset values + GlibFreezeNotify freeze(adj_timescale); adj_timescale->set_lower(start); adj_timescale->set_upper(end); - - //call changed function - adj_timescale->changed(); } bool Widget_Timeslider::on_button_press_event(GdkEventButton *event) //for clicking @@ -669,28 +635,19 @@ bool Widget_Timeslider::on_button_press_event(GdkEventButton *event) //for click //time click... case 1: { - double start = adj_timescale->get_lower(), - end = adj_timescale->get_upper(), - current = adj_timescale->get_value(); - + double start = adj_timescale->get_lower(); + double end = adj_timescale->get_upper(); + double current = adj_timescale->get_value(); double w = get_width(); - double t = start + (end - start) * event->x / w; - - t = floor(t*fps + 0.5)/fps; + Time t(start + (end - start)*event->x/w); + if (fps) t = t.round(fps); /*synfig::info("Clicking time from %.3lf to %.3lf [(%.2lf,%.2lf) %.2lf / %.2lf ... %.2lf", current, vt, start, end, event->x, w, fps);*/ - if(t != current) - { - current = t; - + if (t != Time(current)) if(adj_timescale) - { - adj_timescale->set_value(current); - adj_timescale->value_changed(); - } - } + adj_timescale->set_value((double)t); break; } diff --git a/synfig-studio/src/gui/workarea.cpp b/synfig-studio/src/gui/workarea.cpp index a502a91..d9f7239 100644 --- a/synfig-studio/src/gui/workarea.cpp +++ b/synfig-studio/src/gui/workarea.cpp @@ -1783,14 +1783,15 @@ WorkArea::refresh_dimension_info() pw=canvaswidth/w; ph=canvasheight/h; - scrollx_adjustment->set_page_increment(abs(get_grid_size()[0])); - scrollx_adjustment->set_step_increment(abs(pw)); - scrollx_adjustment->set_lower(-abs(canvaswidth)); - scrollx_adjustment->set_upper(abs(canvaswidth)); - scrolly_adjustment->set_lower(-abs(canvasheight)); - scrolly_adjustment->set_upper(abs(canvasheight)); - scrolly_adjustment->set_step_increment(abs(ph)); - scrolly_adjustment->set_page_increment(abs(get_grid_size()[1])); + { + GlibFreezeNotify freeze(scrollx_adjustment); + scrollx_adjustment->set_page_increment(abs(get_grid_size()[0])); + scrollx_adjustment->set_step_increment(abs(pw)); + scrollx_adjustment->set_lower(-abs(canvaswidth)); + scrollx_adjustment->set_upper(abs(canvaswidth)); + scrolly_adjustment->set_step_increment(abs(ph)); + scrolly_adjustment->set_page_increment(abs(get_grid_size()[1])); + } const synfig::Point focus_point(get_focus_point()); const synfig::Real x(focus_point[0]/pw+drawing_area->get_width()/2-w/2);