ardour
ruler_dialog.cc
Go to the documentation of this file.
1 /*
2  Copyright (C) 2014 Paul Davis
3 
4  This program is free software; you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation; either version 2 of the License, or
7  (at your option) any later version.
8 
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with this program; if not, write to the Free Software
16  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17 
18 */
19 
20 #include <gtkmm/stock.h>
21 
22 #include "actions.h"
23 #include "ruler_dialog.h"
24 
25 #include "i18n.h"
26 
28  : ArdourDialog (_("Rulers"))
29 {
30  add_button (Gtk::Stock::OK, Gtk::RESPONSE_ACCEPT);
31 
32  get_vbox()->pack_start (minsec_button);
33  get_vbox()->pack_start (timecode_button);
34  get_vbox()->pack_start (samples_button);
35  get_vbox()->pack_start (bbt_button);
36  get_vbox()->pack_start (meter_button);
37  get_vbox()->pack_start (tempo_button);
38  get_vbox()->pack_start (range_button);
39  get_vbox()->pack_start (loop_punch_button);
40  get_vbox()->pack_start (cdmark_button);
41  get_vbox()->pack_start (mark_button);
42  get_vbox()->pack_start (video_button);
43 
44  get_vbox()->show_all ();
45 
46  connect_action (samples_button, "samples-ruler");
47  connect_action (timecode_button, "timecode-ruler");
48  connect_action (minsec_button, "minsec-ruler");
49  connect_action (bbt_button, "bbt-ruler");
50  connect_action (tempo_button, "tempo-ruler");
51  connect_action (meter_button, "meter-ruler");
52  connect_action (loop_punch_button, "loop-punch-ruler");
53  connect_action (range_button, "range-ruler");
54  connect_action (mark_button, "marker-ruler");
55  connect_action (cdmark_button, "cd-marker-ruler");
56  connect_action (video_button, "video-ruler");
57 }
58 
60 {
61 }
62 
63 void
65 {
66  hide ();
67 }
68 
69 void
70 RulerDialog::connect_action (Gtk::CheckButton& button, std::string const &action_name_part)
71 {
72  std::string action_name = "toggle-";
73  action_name += action_name_part;
74 
75  Glib::RefPtr<Gtk::Action> act = ActionManager::get_action ("Rulers", action_name.c_str());
76  if (!act) {
77  return;
78  }
79 
80  Glib::RefPtr<Gtk::ToggleAction> tact = Glib::RefPtr<Gtk::ToggleAction>::cast_dynamic (act);
81  if (!tact) {
82  return;
83  }
84 
85  tact->connect_proxy (button);
86 }
Gtk::CheckButton mark_button
Definition: ruler_dialog.h:46
Gtk::CheckButton video_button
Definition: ruler_dialog.h:48
Gtk::CheckButton minsec_button
Definition: ruler_dialog.h:40
Gtk::CheckButton loop_punch_button
Definition: ruler_dialog.h:44
LIBGTKMM2EXT_API Glib::RefPtr< Gtk::Action > get_action(const char *group, const char *name)
Definition: actions.cc:406
Gtk::CheckButton timecode_button
Definition: ruler_dialog.h:39
#define _(Text)
Definition: i18n.h:11
Gtk::CheckButton range_button
Definition: ruler_dialog.h:45
Gtk::CheckButton tempo_button
Definition: ruler_dialog.h:42
void on_response(int)
Definition: ruler_dialog.cc:64
Gtk::CheckButton samples_button
Definition: ruler_dialog.h:38
Gtk::CheckButton cdmark_button
Definition: ruler_dialog.h:47
Gtk::CheckButton meter_button
Definition: ruler_dialog.h:43
Gtk::CheckButton bbt_button
Definition: ruler_dialog.h:41
void connect_action(Gtk::CheckButton &button, std::string const &action_name_part)
Definition: ruler_dialog.cc:70