#include <gtkmm/stock.h>
#include <gtkmm/table.h>
+#include "gtkmm2ext/utils.h"
+
#include "canvas-note-event.h"
#include "edit_note_dialog.h"
#include "midi_region_view.h"
#include "i18n.h"
using namespace Gtk;
+using namespace Gtkmm2ext;
/**
* EditNoteDialog constructor.
int r = 0;
- Label* l = manage (new Label (_("Channel")));
- l->set_alignment (0, 0.5);
+ Label* l = manage (left_aligned_label (_("Channel")));
table->attach (*l, 0, 1, r, r + 1);
table->attach (_channel, 1, 2, r, r + 1);
++r;
_channel.set_increments (1, 2);
_channel.set_value (ev->note()->channel () + 1);
- l = manage (new Label (_("Pitch")));
- l->set_alignment (0, 0.5);
+ l = manage (left_aligned_label (_("Pitch")));
table->attach (*l, 0, 1, r, r + 1);
table->attach (_pitch, 1, 2, r, r + 1);
++r;
_pitch.set_increments (1, 10);
_pitch.set_value (ev->note()->note ());
- l = manage (new Label (_("Velocity")));
- l->set_alignment (0, 0.5);
+ l = manage (left_aligned_label (_("Velocity")));
table->attach (*l, 0, 1, r, r + 1);
table->attach (_velocity, 1, 2, r, r + 1);
++r;
_velocity.set_increments (1, 10);
_velocity.set_value (ev->note()->velocity ());
- l = manage (new Label (_("Time")));
- l->set_alignment (0, 0.5);
+ l = manage (left_aligned_label (_("Time")));
table->attach (*l, 0, 1, r, r + 1);
table->attach (_time_clock, 1, 2, r, r + 1);
++r;
_time_clock.set_mode (AudioClock::BBT);
_time_clock.set (_region_view->source_relative_time_converter().to (ev->note()->time ()), true);
- l = manage (new Label (_("Length")));
- l->set_alignment (0, 0.5);
+ l = manage (left_aligned_label (_("Length")));
table->attach (*l, 0, 1, r, r + 1);
table->attach (_length_clock, 1, 2, r, r + 1);
++r;
Table table (2, 3);
table.set_spacings (12);
table.set_border_width (12);
- Label* l = manage (new Label (_("Crossfade length")));
- l->set_alignment (0, 0.5);
+ Label* l = manage (left_aligned_label (_("Crossfade length")));
table.attach (*l, 0, 1, 0, 1);
SpinButton spin_crossfade (1, 0);
table.attach (*manage (new Label (_("ms"))), 2, 3, 0, 1);
- l = manage (new Label (_("Pull-back length")));
- l->set_alignment (0, 0.5);
+ l = manage (left_aligned_label (_("Pull-back length")));
table.attach (*l, 0, 1, 1, 2);
SpinButton spin_pullback (1, 0);
row = 0;
- label = manage (new Label (_("Driver:")));
- label->set_alignment (0, 0.5);
+ label = manage (left_aligned_label (_("Driver:")));
basic_packer.attach (*label, 0, 1, row, row + 1, FILL|EXPAND, (AttachOptions) 0);
basic_packer.attach (driver_combo, 1, 2, row, row + 1, FILL|EXPAND, (AttachOptions) 0);
row++;
- label = manage (new Label (_("Audio Interface:")));
- label->set_alignment (0, 0.5);
+ label = manage (left_aligned_label (_("Audio Interface:")));
basic_packer.attach (*label, 0, 1, row, row + 1, FILL|EXPAND, (AttachOptions) 0);
basic_packer.attach (interface_combo, 1, 2, row, row + 1, FILL|EXPAND, (AttachOptions) 0);
row++;
- label = manage (new Label (_("Sample rate:")));
- label->set_alignment (0, 0.5);
+ label = manage (left_aligned_label (_("Sample rate:")));
basic_packer.attach (*label, 0, 1, row, row + 1, FILL|EXPAND, (AttachOptions) 0);
basic_packer.attach (sample_rate_combo, 1, 2, row, row + 1, FILL|EXPAND, (AttachOptions) 0);
row++;
- label = manage (new Label (_("Buffer size:")));
- label->set_alignment (0, 0.5);
+ label = manage (left_aligned_label (_("Buffer size:")));
basic_packer.attach (*label, 0, 1, row, row + 1, FILL|EXPAND, (AttachOptions) 0);
basic_packer.attach (period_size_combo, 1, 2, row, row + 1, FILL|EXPAND, (AttachOptions) 0);
row++;
#ifndef __APPLE__
- label = manage (new Label (_("Number of buffers:")));
- label->set_alignment (0, 0.5);
+ label = manage (left_aligned_label (_("Number of buffers:")));
basic_packer.attach (*label, 0, 1, row, row + 1, FILL|EXPAND, (AttachOptions) 0);
basic_packer.attach (periods_spinner, 1, 2, row, row + 1, FILL|EXPAND, (AttachOptions) 0);
periods_spinner.set_value (2);
row++;
#endif
- label = manage (new Label (_("Approximate latency:")));
- label->set_alignment (0, 0.5);
+ label = manage (left_aligned_label (_("Approximate latency:")));
basic_packer.attach (*label, 0, 1, row, row + 1, FILL|EXPAND, (AttachOptions) 0);
basic_packer.attach (latency_label, 1, 2, row, row + 1, FILL|EXPAND, (AttachOptions) 0);
row++;
/* no audio mode with CoreAudio, its duplex or nuthin' */
#ifndef __APPLE__
- label = manage (new Label (_("Audio mode:")));
- label->set_alignment (0, 0.5);
+ label = manage (left_aligned_label (_("Audio mode:")));
basic_packer.attach (*label, 0, 1, row, row + 1, FILL|EXPAND, (AttachOptions) 0);
basic_packer.attach (audio_mode_combo, 1, 2, row, row + 1, FILL|EXPAND, (AttachOptions) 0);
row++;
++row;
#endif /* PROVIDE_TOO_MANY_OPTIONS */
- label = manage (new Label (_("Number of ports:")));
- label->set_alignment (0, 0.5);
+ label = manage (left_aligned_label (_("Number of ports:")));
options_packer.attach (ports_spinner, 1, 2, row, row + 1, FILL|EXPAND, AttachOptions(0));
options_packer.attach (*label, 0, 1, row, row + 1, FILL|EXPAND, (AttachOptions) 0);
++row;
- label = manage (new Label (_("MIDI driver:")));
- label->set_alignment (0, 0.5);
+ label = manage (left_aligned_label (_("MIDI driver:")));
options_packer.attach (midi_driver_combo, 1, 2, row, row + 1, FILL|EXPAND, AttachOptions(0));
options_packer.attach (*label, 0, 1, row, row + 1, FILL|EXPAND, (AttachOptions) 0);
++row;
#ifndef __APPLE__
- label = manage (new Label (_("Dither:")));
- label->set_alignment (0, 0.5);
+ label = manage (left_aligned_label (_("Dither:")));
options_packer.attach (dither_mode_combo, 1, 2, row, row + 1, FILL|EXPAND, AttachOptions(0));
options_packer.attach (*label, 0, 1, row, row + 1, FILL|EXPAND, (AttachOptions) 0);
++row;
serverpath_combo.set_active_text (server_strings.front());
if (server_strings.size() > 1) {
- label = manage (new Label (_("Server:")));
+ label = manage (left_aligned_label (_("Server:")));
options_packer.attach (*label, 0, 1, row, row + 1, FILL|EXPAND, (AttachOptions) 0);
- label->set_alignment (0.0, 0.5);
options_packer.attach (serverpath_combo, 1, 2, row, row + 1, FILL|EXPAND, (AttachOptions) 0);
++row;
}
row = 0;
#ifndef __APPLE__
- label = manage (new Label (_("Input device:")));
- label->set_alignment (0, 0.5);
+ label = manage (left_aligned_label (_("Input device:")));
device_packer.attach (*label, 0, 1, row, row+1, FILL|EXPAND, (AttachOptions) 0);
device_packer.attach (input_device_combo, 1, 2, row, row+1, FILL|EXPAND, (AttachOptions) 0);
++row;
- label = manage (new Label (_("Output device:")));
- label->set_alignment (0, 0.5);
+ label = manage (left_aligned_label (_("Output device:")));
device_packer.attach (*label, 0, 1, row, row+1, FILL|EXPAND, (AttachOptions) 0);
device_packer.attach (output_device_combo, 1, 2, row, row+1, FILL|EXPAND, (AttachOptions) 0);
++row;
#endif
- label = manage (new Label (_("Hardware input latency:")));
- label->set_alignment (0, 0.5);
+ label = manage (left_aligned_label (_("Hardware input latency:")));
device_packer.attach (*label, 0, 1, row, row+1, FILL|EXPAND, (AttachOptions) 0);
device_packer.attach (input_latency, 1, 2, row, row+1, FILL|EXPAND, (AttachOptions) 0);
- label = manage (new Label (_("samples")));
- label->set_alignment (0, 0.5);
+ label = manage (left_aligned_label (_("samples")));
device_packer.attach (*label, 2, 3, row, row+1, FILL|EXPAND, (AttachOptions) 0);
++row;
- label = manage (new Label (_("Hardware output latency:")));
- label->set_alignment (0, 0.5);
+ label = manage (left_aligned_label (_("Hardware output latency:")));
device_packer.attach (*label, 0, 1, row, row+1, FILL|EXPAND, (AttachOptions) 0);
device_packer.attach (output_latency, 1, 2, row, row+1, FILL|EXPAND, (AttachOptions) 0);
- label = manage (new Label (_("samples")));
- label->set_alignment (0, 0.5);
+ label = manage (left_aligned_label (_("samples")));
device_packer.attach (*label, 2, 3, row, row+1, FILL|EXPAND, (AttachOptions) 0);
++row;
{
std::stringstream s;
s << "<b>" << h << "</b>";
- _label = manage (new Label (s.str()));
- _label->set_alignment (0, 0.5);
+ _label = manage (left_aligned_label (s.str()));
_label->set_use_markup (true);
}
_get (g),
_set (s)
{
- _label = manage (new Label (n + ":"));
- _label->set_alignment (0, 0.5);
+ _label = manage (left_aligned_label (n + ":"));
_entry = manage (new Entry);
_entry->signal_activate().connect (sigc::mem_fun (*this, &EntryOption::activated));
}
#include <gtkmm/stock.h>
#include <gtkmm/table.h>
#include <boost/algorithm/string.hpp>
+#include "gtkmm2ext/utils.h"
#include "ardour/midi_patch_manager.h"
#include "ardour/beats_frames_converter.h"
#include "patch_change_dialog.h"
using namespace std;
using namespace Gtk;
+using namespace Gtkmm2ext;
/** @param tc If non-0, a time converter for this patch change. If 0, time control will be desensitized */
PatchChangeDialog::PatchChangeDialog (
if (_time_converter) {
- l = manage (new Label (_("Time")));
- l->set_alignment (0, 0.5);
+ l = manage (left_aligned_label (_("Time")));
t->attach (*l, 0, 1, r, r + 1);
t->attach (_time, 1, 2, r, r + 1);
++r;
_time.set (_time_converter->to (patch.time ()), true);
}
- l = manage (new Label (_("Patch Bank")));
- l->set_alignment (0, 0.5);
+ l = manage (left_aligned_label (_("Patch Bank")));
t->attach (*l, 0, 1, r, r + 1);
t->attach (_bank_combo, 1, 2, r, r + 1);
++r;
_bank_combo.signal_changed().connect (sigc::mem_fun (*this, &PatchChangeDialog::bank_combo_changed));
- l = manage (new Label (_("Patch")));
- l->set_alignment (0, 0.5);
+ l = manage (left_aligned_label (_("Patch")));
t->attach (*l, 0, 1, r, r + 1);
t->attach (_patch_combo, 1, 2, r, r + 1);
++r;
_patch_combo.signal_changed().connect (sigc::mem_fun (*this, &PatchChangeDialog::patch_combo_changed));
- l = manage (new Label (_("Channel")));
- l->set_alignment (0, 0.5);
+ l = manage (left_aligned_label (_("Channel")));
t->attach (*l, 0, 1, r, r + 1);
t->attach (_channel, 1, 2, r, r + 1);
++r;
_channel.set_value (patch.channel() + 1);
_channel.signal_changed().connect (sigc::mem_fun (*this, &PatchChangeDialog::channel_changed));
- l = manage (new Label (_("Program")));
- l->set_alignment (0, 0.5);
+ l = manage (left_aligned_label (_("Program")));
t->attach (*l, 0, 1, r, r + 1);
t->attach (_program, 1, 2, r, r + 1);
++r;
_program.set_value (patch.program () + 1);
_program.signal_changed().connect (sigc::mem_fun (*this, &PatchChangeDialog::program_changed));
- l = manage (new Label (_("Bank")));
- l->set_alignment (0, 0.5);
+ l = manage (left_aligned_label (_("Bank")));
t->attach (*l, 0, 1, r, r + 1);
t->attach (_bank, 1, 2, r, r + 1);
++r;
Table* t = manage (new Table (2, 3));
t->set_spacings (4);
- Label* l = manage (new Label (_("Click audio file:")));
- l->set_alignment (0, 0.5);
+ Label* l = manage (left_aligned_label (_("Click audio file:")));
t->attach (*l, 0, 1, 0, 1, FILL);
t->attach (_click_path_entry, 1, 2, 0, 1, FILL);
Button* b = manage (new Button (_("Browse...")));
b->signal_clicked().connect (sigc::mem_fun (*this, &ClickOptions::click_browse_clicked));
t->attach (*b, 2, 3, 0, 1, FILL);
- l = manage (new Label (_("Click emphasis audio file:")));
- l->set_alignment (0, 0.5);
+ l = manage (left_aligned_label (_("Click emphasis audio file:")));
t->attach (*l, 0, 1, 1, 2, FILL);
t->attach (_click_emphasis_path_entry, 1, 2, 1, 2, FILL);
b = manage (new Button (_("Browse...")));
_limit_undo_spin.set_range (0, 512);
_limit_undo_spin.set_increments (1, 10);
t->attach (_limit_undo_spin, 1, 2, 0, 1, FILL | EXPAND);
- Label* l = manage (new Label (_("commands")));
- l->set_alignment (0, 0.5);
+ Label* l = manage (left_aligned_label (_("commands")));
t->attach (*l, 2, 3, 0, 1);
t->attach (_save_undo_button, 0, 1, 1, 2, FILL);
_save_undo_spin.set_range (0, 512);
_save_undo_spin.set_increments (1, 10);
t->attach (_save_undo_spin, 1, 2, 1, 2, FILL | EXPAND);
- l = manage (new Label (_("commands")));
- l->set_alignment (0, 0.5);
+ l = manage (left_aligned_label (_("commands")));
t->attach (*l, 2, 3, 1, 2);
_box->pack_start (*t);
Table* t = manage (new Table (4, 4));
t->set_spacings (4);
- Label* l = manage (new Label (_("Edit using:")));
+ Label* l = manage (left_aligned_label (_("Edit using:")));
l->set_name ("OptionsLabel");
- l->set_alignment (0, 0.5);
t->attach (*l, 0, 1, 0, 1, FILL | EXPAND, FILL);
t->attach (_edit_modifier_combo, 1, 2, 0, 1, FILL | EXPAND, FILL);
}
}
- l = manage (new Label (_("Delete using:")));
+ l = manage (left_aligned_label (_("Delete using:")));
l->set_name ("OptionsLabel");
- l->set_alignment (0, 0.5);
t->attach (*l, 0, 1, 1, 2, FILL | EXPAND, FILL);
t->attach (_delete_modifier_combo, 1, 2, 1, 2, FILL | EXPAND, FILL);
}
}
- l = manage (new Label (_("Insert note using:")));
+ l = manage (left_aligned_label (_("Insert note using:")));
l->set_name ("OptionsLabel");
- l->set_alignment (0, 0.5);
t->attach (*l, 0, 1, 2, 3, FILL | EXPAND, FILL);
t->attach (_insert_note_modifier_combo, 1, 2, 2, 3, FILL | EXPAND, FILL);
}
}
- l = manage (new Label (_("Toggle snap using:")));
+ l = manage (left_aligned_label (_("Toggle snap using:")));
l->set_name ("OptionsLabel");
- l->set_alignment (0, 0.5);
t->attach (*l, 0, 1, 3, 4, FILL | EXPAND, FILL);
t->attach (_snap_modifier_combo, 1, 2, 3, 4, FILL | EXPAND, FILL);
_keyboard_layout_selector.set_active_text (Keyboard::current_binding_name());
_keyboard_layout_selector.signal_changed().connect (sigc::mem_fun (*this, &KeyboardOptions::bindings_changed));
- l = manage (new Label (_("Keyboard layout:")));
+ l = manage (left_aligned_label (_("Keyboard layout:")));
l->set_name ("OptionsLabel");
- l->set_alignment (0, 0.5);
t->attach (*l, 0, 1, 4, 5, FILL | EXPAND, FILL);
t->attach (_keyboard_layout_selector, 1, 2, 4, 5, FILL | EXPAND, FILL);
void rounded_top_half_rectangle (cairo_t*, double x, double y, double w, double h, double r=10);
void rounded_bottom_half_rectangle (cairo_t*, double x, double y, double w, double h, double r=10);
+
+ Gtk::Label* left_aligned_label (std::string const &);
};
#endif /* __gtkmm2ext_utils_h__ */
return std::make_pair (name, width);
}
+Gtk::Label *
+Gtkmm2ext::left_aligned_label (string const & t)
+{
+ Gtk::Label* l = new Gtk::Label (t);
+ l->set_alignment (0, 0.5);
+ return l;
+}