From e4b9aed743fc765219ac775905a221c017c88fba Mon Sep 17 00:00:00 2001 From: Taybin Rutkin Date: Sun, 25 Sep 2005 17:29:50 +0000 Subject: [PATCH] Re-synced and fixed doi.h. git-svn-id: svn://localhost/trunk/ardour2@23 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/gtkmm2ext/SConscript | 2 +- libs/gtkmm2ext/auto_spin.cc | 12 +++++++++--- libs/gtkmm2ext/choice.cc | 2 +- libs/gtkmm2ext/click_box.cc | 7 +++---- libs/gtkmm2ext/gtkmm2ext/auto_spin.h | 3 ++- libs/gtkmm2ext/gtkmm2ext/click_box.h | 2 +- libs/gtkmm2ext/gtkmm2ext/doi.h | 10 +++++----- libs/gtkmm2ext/gtkmm2ext/stop_signal.h | 4 ++-- libs/gtkmm2ext/pixscroller.cc | 2 +- 9 files changed, 25 insertions(+), 19 deletions(-) diff --git a/libs/gtkmm2ext/SConscript b/libs/gtkmm2ext/SConscript index e3ba3f1fcd..3d30ed1a24 100644 --- a/libs/gtkmm2ext/SConscript +++ b/libs/gtkmm2ext/SConscript @@ -25,7 +25,7 @@ gtkmm2ext.Merge ([ domain = 'libgtkmm2ext' -gtkmm2ext.Append(DOMAIN=domain,MAJOR=0,MINOR=8,MICRO=0) +gtkmm2ext.Append(DOMAIN=domain,MAJOR=0,MINOR=8,MICRO=1) gtkmm2ext.Append(CXXFLAGS="-DPACKAGE=\\\"" + domain + "\\\"") gtkmm2ext.Append(CCFLAGS="-DLIBSIGC_DISABLE_DEPRECATED") gtkmm2ext.Append(PACKAGE=domain) diff --git a/libs/gtkmm2ext/auto_spin.cc b/libs/gtkmm2ext/auto_spin.cc index 0830eca77e..ba2a3cf76e 100644 --- a/libs/gtkmm2ext/auto_spin.cc +++ b/libs/gtkmm2ext/auto_spin.cc @@ -33,7 +33,7 @@ const unsigned int AutoSpin::initial_timer_interval = 500; /* msecs */ const unsigned int AutoSpin::timer_interval = 20; /* msecs */ const unsigned int AutoSpin::climb_timer_calls = 5; /* between climbing */ -AutoSpin::AutoSpin (Gtk::Adjustment &adjr, gfloat cr) +AutoSpin::AutoSpin (Gtk::Adjustment &adjr, gfloat cr, bool round_to_steps_yn) : adjustment (adjr), climb_rate (cr) @@ -44,6 +44,7 @@ AutoSpin::AutoSpin (Gtk::Adjustment &adjr, gfloat cr) have_timer = false; need_timer = false; timer_calls = 0; + round_to_steps = round_to_steps_yn; } void @@ -164,7 +165,10 @@ AutoSpin::_timer (void *arg) void AutoSpin::set_value (gfloat value) { - adjustment.set_value (value); + if (round_to_steps) + adjustment.set_value (floor((value / step_increment) + 0.5f) * step_increment); + else + adjustment.set_value (value); } bool @@ -193,7 +197,7 @@ AutoSpin::adjust_value (gfloat increment) } } - adjustment.set_value (val); + set_value(val); return done; } @@ -253,6 +257,8 @@ AutoSpin::set_bounds (gfloat init, gfloat up, gfloat down, bool with_reset) { adjustment.set_upper(up); adjustment.set_lower(down); + + initial = init; adjustment.changed (); diff --git a/libs/gtkmm2ext/choice.cc b/libs/gtkmm2ext/choice.cc index 5a3b7d0140..03bfd924dc 100644 --- a/libs/gtkmm2ext/choice.cc +++ b/libs/gtkmm2ext/choice.cc @@ -33,7 +33,7 @@ Choice::Choice (string prompt, int n; vector::iterator i; - set_position (WIN_POS_MOUSE); + set_position (Gtk::WIN_POS_CENTER); set_name ("ChoiceWindow"); add (packer); diff --git a/libs/gtkmm2ext/click_box.cc b/libs/gtkmm2ext/click_box.cc index 6bd03282eb..ca8d7f725f 100644 --- a/libs/gtkmm2ext/click_box.cc +++ b/libs/gtkmm2ext/click_box.cc @@ -29,8 +29,8 @@ using namespace Gtk; using namespace Gtkmm2ext; using namespace sigc; -ClickBox::ClickBox (Gtk::Adjustment *adjp, const string &name) - : AutoSpin (*adjp) +ClickBox::ClickBox (Gtk::Adjustment *adjp, const string &name, bool round_to_steps) + : AutoSpin (*adjp,0,round_to_steps) { print_func = default_printer; print_arg = 0; @@ -68,9 +68,8 @@ ClickBox::button_release_handler (GdkEventButton* ev) case 2: case 3: stop_spinning (0); - remove_modal_grab(); - break; default: + remove_modal_grab(); break; } return true; diff --git a/libs/gtkmm2ext/gtkmm2ext/auto_spin.h b/libs/gtkmm2ext/gtkmm2ext/auto_spin.h index 41d83373ce..68da2249a0 100644 --- a/libs/gtkmm2ext/gtkmm2ext/auto_spin.h +++ b/libs/gtkmm2ext/gtkmm2ext/auto_spin.h @@ -29,7 +29,7 @@ class AutoSpin { public: - AutoSpin (Gtk::Adjustment &adj, gfloat cr = 0); + AutoSpin (Gtk::Adjustment &adj, gfloat cr = 0, bool round_to_steps_yn = false); Gtk::Adjustment &get_adjustment() { return adjustment; } @@ -54,6 +54,7 @@ class AutoSpin bool wrap; gint timeout_tag; bool left_is_decrement; + bool round_to_steps; static const unsigned int initial_timer_interval; static const unsigned int timer_interval; diff --git a/libs/gtkmm2ext/gtkmm2ext/click_box.h b/libs/gtkmm2ext/gtkmm2ext/click_box.h index cc35afb6e1..4f1ef5ca6b 100644 --- a/libs/gtkmm2ext/gtkmm2ext/click_box.h +++ b/libs/gtkmm2ext/gtkmm2ext/click_box.h @@ -31,7 +31,7 @@ namespace Gtkmm2ext { class ClickBox : public Gtk::DrawingArea, public AutoSpin { public: - ClickBox (Gtk::Adjustment *adj, const std::string &name); + ClickBox (Gtk::Adjustment *adj, const std::string &name, bool round_to_steps = false); ~ClickBox (); void set_print_func(void (*pf)(char buf[32], Gtk::Adjustment &, void *), diff --git a/libs/gtkmm2ext/gtkmm2ext/doi.h b/libs/gtkmm2ext/gtkmm2ext/doi.h index f804c8a090..16a9a6549c 100644 --- a/libs/gtkmm2ext/gtkmm2ext/doi.h +++ b/libs/gtkmm2ext/gtkmm2ext/doi.h @@ -25,12 +25,12 @@ /* XXX g++ 2.95 can't compile this as pair of member function templates */ -template gint idle_delete (T *obj) { delete obj; return FALSE; } -template void delete_when_idle (T *obj) { - Gtk::Main::idle.connect (sigc::bind (sigc::slot (idle_delete), obj)); +template gint idle_delete (T *obj) { delete obj; return FALSE; } +template void delete_when_idle (T *obj) { + Glib::signal_idle().connect (sigc::bind (sigc::ptr_fun (idle_delete), obj)); } -template gint delete_on_unmap (GdkEventAny *ignored, T *obj) { - Gtk::Main::idle.connect (sigc::bind (sigc::slot (idle_delete), obj)); +template gint delete_on_unmap (GdkEventAny *ignored, T *obj) { + Glib::signal_idle().connect (sigc::bind (sigc::ptr_fun (idle_delete), obj)); return FALSE; } diff --git a/libs/gtkmm2ext/gtkmm2ext/stop_signal.h b/libs/gtkmm2ext/gtkmm2ext/stop_signal.h index 2890efecfb..9c191a033e 100644 --- a/libs/gtkmm2ext/gtkmm2ext/stop_signal.h +++ b/libs/gtkmm2ext/gtkmm2ext/stop_signal.h @@ -1,13 +1,13 @@ #ifndef __ardour_gtk_stop_signal_h__ #define __ardour_gtk_stop_signal_h__ -#include +#include #include static inline gint stop_signal (Gtk::Widget& widget, const char *signal_name) { - gtk_signal_emit_stop_by_name (GTK_OBJECT(widget.gtkobj()), signal_name); + gtk_signal_emit_stop_by_name (GTK_OBJECT(widget.gobj()), signal_name); return TRUE; } diff --git a/libs/gtkmm2ext/pixscroller.cc b/libs/gtkmm2ext/pixscroller.cc index 78f1725271..556fce8080 100644 --- a/libs/gtkmm2ext/pixscroller.cc +++ b/libs/gtkmm2ext/pixscroller.cc @@ -60,7 +60,7 @@ PixScroller::PixScroller (Adjustment& a, Pix& pix) overall_height = railrect.get_height() + sliderrect.get_height(); sliderrect.set_y((int) rint ((overall_height - sliderrect.get_height()) * (adj.get_upper() - adj.get_value()))); - railrect.set_x((sliderrect.get_width() / 2) - 3); + railrect.set_x((sliderrect.get_width() / 2) - 2); } void