diff options
author | Taybin Rutkin <taybin@taybin.com> | 2007-02-01 13:17:04 +0000 |
---|---|---|
committer | Taybin Rutkin <taybin@taybin.com> | 2007-02-01 13:17:04 +0000 |
commit | b05c4dc540d0f9f97975a0d6ff9c3cd8a569b980 (patch) | |
tree | c39366f0c328f2c540ecc46ec42604cf547269d0 /gtk2_ardour | |
parent | 43a063d8c6142f482ea425cfebca1202a501668b (diff) |
Moved GroupButtons to gtkmm2ext
Fixed stacktrace.cc compilation.
git-svn-id: svn://localhost/ardour2/trunk@1403 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour')
-rw-r--r-- | gtk2_ardour/SConscript | 1 | ||||
-rw-r--r-- | gtk2_ardour/ardour.bindings | 1 | ||||
-rw-r--r-- | gtk2_ardour/editor.cc | 3 | ||||
-rw-r--r-- | gtk2_ardour/grouped_buttons.cc | 96 | ||||
-rw-r--r-- | gtk2_ardour/grouped_buttons.h | 49 |
5 files changed, 1 insertions, 149 deletions
diff --git a/gtk2_ardour/SConscript b/gtk2_ardour/SConscript index 9a43258196..5d15980b99 100644 --- a/gtk2_ardour/SConscript +++ b/gtk2_ardour/SConscript @@ -145,7 +145,6 @@ export_range_markers_dialog.cc gain_automation_time_axis.cc gain_meter.cc ghostregion.cc -grouped_buttons.cc gtk-custom-hruler.c gtk-custom-ruler.c imageframe.cc diff --git a/gtk2_ardour/ardour.bindings b/gtk2_ardour/ardour.bindings index 537ae9c60d..58ad927a82 100644 --- a/gtk2_ardour/ardour.bindings +++ b/gtk2_ardour/ardour.bindings @@ -112,7 +112,6 @@ (gtk_accel_path "<Actions>/Editor/extend-range-to-end-of-region" "rightanglebracket") (gtk_accel_path "<Actions>/Editor/scroll-backward" "leftarrow") (gtk_accel_path "<Actions>/Editor/start-range" "<Control>KP_Down") -; (gtk_accel_path "<Actions>/Editor/ToggleTranzportSurface" "") ; (gtk_accel_path "<Actions>/ShuttleActions/SetShuttleUnitsSemitones" "") ; (gtk_accel_path "<Actions>/JACK/JACKLatency128" "") ; (gtk_accel_path "<Actions>/Snap/snap-to-beat" "") diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc index 6742fb0465..cf0a5baabf 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -35,6 +35,7 @@ #include <gdkmm/color.h> #include <gdkmm/bitmap.h> +#include <gtkmm2ext/grouped_buttons.h> #include <gtkmm2ext/gtk_ui.h> #include <gtkmm2ext/tearoff.h> #include <gtkmm2ext/utils.h> @@ -54,7 +55,6 @@ #include "ardour_ui.h" #include "editor.h" -#include "grouped_buttons.h" #include "keyboard.h" #include "marker.h" #include "playlist_selector.h" @@ -69,7 +69,6 @@ #include "editing.h" #include "public_editor.h" #include "crossfade_edit.h" -#include "audio_time_axis.h" #include "canvas_impl.h" #include "actions.h" #include "gui_thread.h" diff --git a/gtk2_ardour/grouped_buttons.cc b/gtk2_ardour/grouped_buttons.cc deleted file mode 100644 index 64c58d8197..0000000000 --- a/gtk2_ardour/grouped_buttons.cc +++ /dev/null @@ -1,96 +0,0 @@ -/* - Copyright (C) 2001 Paul Davis - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - - $Id$ -*/ - -#include <gtkmm.h> - -#include "grouped_buttons.h" - -using namespace std; - -GroupedButtons::GroupedButtons (vector<Gtk::ToggleButton *>& buttonset) -{ - uint32_t n = 0; - - buttons = buttonset; - - for (vector<Gtk::ToggleButton *>::iterator i = buttons.begin(); i != buttons.end(); ++i, ++n) { - if ((*i)->get_active()) { - current_active = n; - } - (*i)->signal_clicked().connect (sigc::bind (mem_fun (*this, &GroupedButtons::one_clicked), n)); - } -} - -GroupedButtons::GroupedButtons (uint32_t nbuttons, uint32_t first_active) -{ - buttons.reserve (nbuttons); - current_active = first_active; - - for (uint32_t n = 0; n < nbuttons; ++n) { - - Gtk::ToggleButton *button; - - button = manage (new (Gtk::ToggleButton)); - - if (n == current_active) { - button->set_active (true); - } - - button->signal_clicked().connect (sigc::bind (mem_fun (*this, &GroupedButtons::one_clicked), n)); - buttons.push_back (button); - } -} - -static gint -reactivate_button (void *arg) -{ - Gtk::ToggleButton *b = (Gtk::ToggleButton *) arg; - b->set_active (true); - return FALSE; -} - -void -GroupedButtons::one_clicked (uint32_t which) -{ - if (buttons[which]->get_active()) { - - if (which != current_active) { - uint32_t old = current_active; - current_active = which; - buttons[old]->set_active (false); - } - - } else if (which == current_active) { - - /* Someobody tried to unset the current active - button by clicking on it. This caused - set_active (false) to be called. We don't - allow that, so just reactivate it. - - Don't try this right here, because of some - design glitches with GTK+ toggle buttons. - Setting the button back to active from - within the signal emission that marked - it as inactive causes a segfault ... - */ - - gtk_idle_add (reactivate_button, buttons[which]); - } -} diff --git a/gtk2_ardour/grouped_buttons.h b/gtk2_ardour/grouped_buttons.h deleted file mode 100644 index 2bb067fcd0..0000000000 --- a/gtk2_ardour/grouped_buttons.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - Copyright (C) 2001 Paul Davis - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - - $Id$ -*/ - -#ifndef __gtkmm2ext_grouped_buttons_h__ -#define __gtkmm2ext_grouped_buttons_h__ - -#include <stdint.h> - -#include <vector> -#include <sigc++/signal.h> - -namespace Gtk { - class ToggleButton; -}; - -class GroupedButtons : public sigc::trackable -{ - public: - GroupedButtons (uint32_t nbuttons, uint32_t first_active); - GroupedButtons (std::vector<Gtk::ToggleButton *>&); - - Gtk::ToggleButton& button (uint32_t which) { - return *buttons[which]; - } - - private: - std::vector<Gtk::ToggleButton *> buttons; - uint32_t current_active; - void one_clicked (uint32_t which); -}; - -#endif /* __gtkmm2ext_grouped_buttons_h__ */ |