ardour
insert_time_dialog.cc
Go to the documentation of this file.
1 /*
2  Copyright (C) 2000-2010 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/table.h>
21 #include <gtkmm/comboboxtext.h>
22 #include <gtkmm/stock.h>
23 #include <gtkmm/alignment.h>
24 #include "insert_time_dialog.h"
25 #include "audio_clock.h"
26 #include "i18n.h"
27 
28 using namespace Gtk;
29 using namespace Editing;
30 
32  : ArdourDialog (_("Insert Time"))
33  , _editor (e)
34  , _clock ("insertTimeClock", true, "", true, false, true, false)
35 {
37 
39 
40  get_vbox()->set_border_width (12);
41  get_vbox()->set_spacing (4);
42 
43  Table* table = manage (new Table (2, 2));
44  table->set_spacings (4);
45 
46  Label* time_label = manage (new Label (_("Time to insert:")));
47  time_label->set_alignment (1, 0.5);
48  table->attach (*time_label, 0, 1, 0, 1, FILL | EXPAND);
49  _clock.set (0);
52  table->attach (_clock, 1, 2, 0, 1);
53 
54  Label* intersected_label = manage (new Label (_("Intersected regions should:")));
55  intersected_label->set_alignment (1, 0.5);
56  table->attach (*intersected_label, 0, 1, 1, 2, FILL | EXPAND);
57  _intersected_combo.append_text (_("stay in position"));
58  _intersected_combo.append_text (_("move"));
59  _intersected_combo.append_text (_("be split"));
60  _intersected_combo.set_active (0);
61  table->attach (_intersected_combo, 1, 2, 1, 2);
62 
63  get_vbox()->pack_start (*table);
64 
65  _all_playlists.set_label (_("Insert time on all the track's playlists"));
66  get_vbox()->pack_start (_all_playlists);
67 
68  _move_glued.set_label (_("Move glued regions"));
69  get_vbox()->pack_start (_move_glued);
70  _move_markers.set_label (_("Move markers"));
71  get_vbox()->pack_start (_move_markers);
72  _move_markers.signal_toggled().connect (sigc::mem_fun (*this, &InsertTimeDialog::move_markers_toggled));
73  _move_glued_markers.set_label (_("Move glued markers"));
74  Alignment* indent = manage (new Alignment);
75  indent->set_padding (0, 0, 12, 0);
76  indent->add (_move_glued_markers);
77  get_vbox()->pack_start (*indent);
78  _move_locked_markers.set_label (_("Move locked markers"));
79  indent = manage (new Alignment);
80  indent->set_padding (0, 0, 12, 0);
81  indent->add (_move_locked_markers);
82  get_vbox()->pack_start (*indent);
83  tempo_label.set_markup (_("Move tempo and meter changes\n<i>(may cause oddities in the tempo map)</i>"));
84  HBox* tempo_box = manage (new HBox);
85  tempo_box->set_spacing (6);
86  tempo_box->pack_start (_move_tempos, false, false);
87  tempo_box->pack_start (tempo_label, false, false);
88  get_vbox()->pack_start (*tempo_box);
89 
90  add_button (Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
91  add_button (_("Insert time"), Gtk::RESPONSE_OK);
92  show_all ();
93 
95 }
96 
99 {
100  /* only setting this to keep GCC quiet */
101  InsertTimeOption opt = LeaveIntersected;
102 
103  switch (_intersected_combo.get_active_row_number ()) {
104  case 0:
105  opt = LeaveIntersected;
106  break;
107  case 1:
108  opt = MoveIntersected;
109  break;
110  case 2:
111  opt = SplitIntersected;
112  break;
113  }
114 
115  return opt;
116 }
117 
118 bool
120 {
121  return _all_playlists.get_active ();
122 }
123 
124 bool
126 {
127  return _move_glued.get_active ();
128 }
129 
130 bool
132 {
133  return _move_tempos.get_active ();
134 }
135 
136 bool
138 {
139  return _move_markers.get_active ();
140 }
141 
142 bool
144 {
145  return _move_glued_markers.get_active ();
146 }
147 
148 bool
150 {
151  return _move_locked_markers.get_active ();
152 }
153 
156 {
158 }
159 
160 void
162 {
163  _move_glued_markers.set_sensitive (_move_markers.get_active ());
164  _move_locked_markers.set_sensitive (_move_markers.get_active ());
165 }
bool move_tempos() const
InsertTimeOption
Definition: editing.h:188
Gtk::CheckButton _move_markers
void set(framepos_t, bool force=false, ARDOUR::framecnt_t offset=0)
Definition: audio_clock.cc:956
bool all_playlists() const
void set_session(ARDOUR::Session *s)
Editing::InsertTimeOption intersected_region_action()
PublicEditor & _editor
InsertTimeDialog(PublicEditor &)
Definition: ardour_ui.h:130
Representation of the interface of the Editor class.
bool move_locked_markers() const
Gtk::CheckButton _move_tempos
#define _(Text)
Definition: i18n.h:11
Gtk::CheckButton _move_locked_markers
bool move_glued_markers() const
Gtk::CheckButton _move_glued_markers
framepos_t distance() const
bool move_glued() const
Gtk::CheckButton _all_playlists
Gtk::ComboBoxText _intersected_combo
virtual framepos_t get_preferred_edit_position(Editing::EditIgnoreOption=Editing::EDIT_IGNORE_NONE, bool from_context_menu=false, bool from_outside_canvas=false)=0
void set_bbt_reference(framepos_t)
framepos_t current_duration(framepos_t position=0) const
virtual void set_session(ARDOUR::Session *)
int64_t framepos_t
Gtk::CheckButton _move_glued
bool move_markers() const
ARDOUR::Session * _session
virtual ARDOUR::Session * session() const =0