Marginal cleanup.
authorCarl Hetherington <carl@carlh.net>
Tue, 5 Jun 2012 01:03:36 +0000 (01:03 +0000)
committerCarl Hetherington <carl@carlh.net>
Tue, 5 Jun 2012 01:03:36 +0000 (01:03 +0000)
git-svn-id: svn://localhost/ardour2/branches/3.0@12565 d708f5d6-7413-0410-9779-e7cbd77b26cf

gtk2_ardour/edit_note_dialog.cc
gtk2_ardour/editor_ops.cc
gtk2_ardour/engine_dialog.cc
gtk2_ardour/option_editor.cc
gtk2_ardour/patch_change_dialog.cc
gtk2_ardour/rc_option_editor.cc
libs/gtkmm2ext/gtkmm2ext/utils.h
libs/gtkmm2ext/utils.cc

index 4195ab8962e4c58fc3d2a56f7e973774336caf14..3c866cfe6f01c32923b2b2e6f68ef6906cf3fe05 100644 (file)
@@ -20,6 +20,8 @@
 #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"
@@ -27,6 +29,7 @@
 #include "i18n.h"
 
 using namespace Gtk;
+using namespace Gtkmm2ext;
 
 /**
  *    EditNoteDialog constructor.
@@ -46,8 +49,7 @@ EditNoteDialog::EditNoteDialog (MidiRegionView* rv, Gnome::Canvas::CanvasNoteEve
 
        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;
@@ -56,8 +58,7 @@ EditNoteDialog::EditNoteDialog (MidiRegionView* rv, Gnome::Canvas::CanvasNoteEve
        _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;
@@ -66,8 +67,7 @@ EditNoteDialog::EditNoteDialog (MidiRegionView* rv, Gnome::Canvas::CanvasNoteEve
        _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;
@@ -76,8 +76,7 @@ EditNoteDialog::EditNoteDialog (MidiRegionView* rv, Gnome::Canvas::CanvasNoteEve
        _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;
@@ -86,8 +85,7 @@ EditNoteDialog::EditNoteDialog (MidiRegionView* rv, Gnome::Canvas::CanvasNoteEve
        _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;
index d3ce0492c5ea4813115166dc4cb5a05dd4fcb37a..6d66c57b50afc25413de522463be2b3d3cfd58df 100644 (file)
@@ -6065,8 +6065,7 @@ Editor::close_region_gaps ()
        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);
@@ -6077,8 +6076,7 @@ Editor::close_region_gaps ()
 
        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);
index de613f3cf46065669ddfefb43d0ba60aa2affb41..6fe514b99198db87f9d79a16bf02eb3a14082099 100644 (file)
@@ -172,41 +172,35 @@ EngineControl::EngineControl ()
 
        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++;
@@ -219,8 +213,7 @@ EngineControl::EngineControl ()
        /* 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++;
@@ -306,21 +299,18 @@ EngineControl::EngineControl ()
        ++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;
@@ -337,9 +327,8 @@ EngineControl::EngineControl ()
        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;
        }
@@ -350,31 +339,25 @@ EngineControl::EngineControl ()
        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;
 
index ca8fa0a2cf451848bb033bc6bd7d5c0225f03dcf..e1946002c1b834d8dc02a964ace0b5a9bda450c6 100644 (file)
@@ -87,8 +87,7 @@ OptionEditorHeading::OptionEditorHeading (string const & h)
 {
        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);
 }
 
@@ -141,8 +140,7 @@ EntryOption::EntryOption (string const & i, string const & n, sigc::slot<string>
          _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));
 }
index c7b80a54803ccb7fbc63431a1910a204249b1f85..23feab8a77b64fcb2a2e22661d4cac25ea8a6f5e 100644 (file)
@@ -21,6 +21,7 @@
 #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"
@@ -28,6 +29,7 @@
 
 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 (
@@ -55,8 +57,7 @@ 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;
@@ -66,24 +67,21 @@ PatchChangeDialog::PatchChangeDialog (
                _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;
@@ -91,8 +89,7 @@ PatchChangeDialog::PatchChangeDialog (
        _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;
@@ -100,8 +97,7 @@ PatchChangeDialog::PatchChangeDialog (
        _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;
index f5a8cc56f0ba34af5943e321eb44dab5c579bf19..1d58443435b13e4b3d573159e3c90bb87edbb586 100644 (file)
@@ -65,16 +65,14 @@ public:
                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...")));
@@ -171,16 +169,14 @@ public:
                _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);
@@ -318,9 +314,8 @@ public:
                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);
@@ -345,9 +340,8 @@ public:
                        }
                }
 
-               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);
@@ -373,9 +367,8 @@ public:
                        }
                }
 
-               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);
@@ -401,9 +394,8 @@ public:
                        }
                }
 
-               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);
@@ -418,9 +410,8 @@ public:
                _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);
index 97c6e7758b1a437803b4e45ed12a31454ba3638b..b7e27ea351c4d901bdbf52a9f8e9a005df3f4606 100644 (file)
@@ -106,6 +106,8 @@ namespace Gtkmm2ext {
 
        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__ */
index 7ecb481e3397d71b14b8032051b662c20c8490d6..63d7655331f3ec1c9f55c3f662b40d7653a1f911 100644 (file)
@@ -624,3 +624,10 @@ Gtkmm2ext::fit_to_pixels (cairo_t* cr, std::string name, double avail)
        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;
+}