some C++-ification of GnomeCanvasBlah
[ardour.git] / gtk2_ardour / tempo_dialog.cc
index 9e2a9aafe851db94eb63ce3330f93aa60ed7ed3e..060cb9217f7538f9523af8a9cdf0e9d3d378ad00 100644 (file)
@@ -3,10 +3,12 @@
 #include <gtkmm2ext/utils.h>
 
 #include "tempo_dialog.h"
+#include "utils.h"
 
 #include "i18n.h"
 
 using namespace Gtk;
+using namespace Gtkmm2ext;
 using namespace ARDOUR;
 
 TempoDialog::TempoDialog (TempoMap& map, jack_nframes_t frame, string action)
@@ -82,11 +84,11 @@ TempoDialog::init (const BBT_Time& when, double bpm, bool movable)
                when_table.set_col_spacings (2);
                when_table.set_border_width (5);
                
-               when_table.attach (when_bar_label, 0, 1, 0, 1, 0, Gtk::FILL|Gtk::EXPAND);
-               when_table.attach (when_bar_entry, 0, 1, 1, 2, 0, Gtk::FILL|Gtk::EXPAND);
+               when_table.attach (when_bar_label, 0, 1, 0, 1, Gtk::AttachOptions(0), Gtk::FILL|Gtk::EXPAND);
+               when_table.attach (when_bar_entry, 0, 1, 1, 2, Gtk::AttachOptions(0), Gtk::FILL|Gtk::EXPAND);
                
-               when_table.attach (when_beat_label, 1, 2, 0, 1, 0, 0);
-               when_table.attach (when_beat_entry, 1, 2, 1, 2, 0, 0);
+               when_table.attach (when_beat_label, 1, 2, 0, 1, Gtk::AttachOptions(0), Gtk::AttachOptions(0));
+               when_table.attach (when_beat_entry, 1, 2, 1, 2, Gtk::AttachOptions(0), Gtk::AttachOptions(0));
                
                when_frame.set_name ("MetricDialogFrame");
                when_frame.add (when_table);
@@ -174,6 +176,7 @@ MeterDialog::init (const BBT_Time& when, double bpb, double note_type, bool mova
        bpb_entry.select_region (0, -1);
        Gtkmm2ext::set_size_request_to_display_given_text (bpb_entry, "999999g", 5, 5);
 
+       vector<string> strings;
        
        strings.push_back (_("whole (1)"));
        strings.push_back (_("second (2)"));
@@ -184,26 +187,27 @@ MeterDialog::init (const BBT_Time& when, double bpb, double note_type, bool mova
        strings.push_back (_("thirty-second (32)"));
        
        set_popdown_strings (note_types, strings);
-       
+
        if (note_type==1.0f)
-               note_types.get_entry()->set_text(_("whole (1)"));
+               note_types.set_active_text (_("whole (1)"));
        else if (note_type==2.0f)
-               note_types.get_entry()->set_text(_("second (2)"));
+               note_types.set_active_text (_("second (2)"));
        else if (note_type==3.0f)
-               note_types.get_entry()->set_text(_("third (3)"));
+               note_types.set_active_text (_("third (3)"));
        else if (note_type==4.0f)
-               note_types.get_entry()->set_text(_("quarter (4)"));
+               note_types.set_active_text (_("quarter (4)"));
        else if (note_type==8.0f)
-               note_types.get_entry()->set_text(_("eighth (8)"));
+               note_types.set_active_text (_("eighth (8)"));
        else if (note_type==16.0f)
-               note_types.get_entry()->set_text(_("sixteenth (16)"));
+               note_types.set_active_text (_("sixteenth (16)"));
        else if (note_type==32.0f)
-               note_types.get_entry()->set_text(_("thirty-second (32)"));
+               note_types.set_active_text (_("thirty-second (32)"));
        else
-               note_types.get_entry()->set_text(_("quarter (4)"));
+               note_types.set_active_text (_("quarter (4)"));
                
        /* strings.back() just happens to be the longest one to display */
-       Gtkmm2ext::set_size_request_to_display_given_text (*(note_types.get_entry()), strings.back(), 7, 7);
+       // GTK2FIX
+       // Gtkmm2ext::set_size_request_to_display_given_text (*(note_types.get_entry()), strings.back(), 7, 7);
 
        hspacer1.set_border_width (5);
        hspacer1.pack_start (note_types, false, false);
@@ -247,11 +251,11 @@ MeterDialog::init (const BBT_Time& when, double bpb, double note_type, bool mova
                when_table.set_col_spacings (2);
                when_table.set_border_width (5);
                
-               when_table.attach (when_bar_label, 0, 1, 0, 1, 0, Gtk::FILL|Gtk::EXPAND);
-               when_table.attach (when_bar_entry, 0, 1, 1, 2, 0, Gtk::FILL|Gtk::EXPAND);
+               when_table.attach (when_bar_label, 0, 1, 0, 1, Gtk::AttachOptions(0), Gtk::FILL|Gtk::EXPAND);
+               when_table.attach (when_bar_entry, 0, 1, 1, 2, Gtk::AttachOptions(0), Gtk::FILL|Gtk::EXPAND);
                
-               when_table.attach (when_beat_label, 1, 2, 0, 1, 0, 0);
-               when_table.attach (when_beat_entry, 1, 2, 1, 2, 0, 0);
+               when_table.attach (when_beat_label, 1, 2, 0, 1, Gtk::AttachOptions(0), Gtk::AttachOptions(0));
+               when_table.attach (when_beat_entry, 1, 2, 1, 2, Gtk::AttachOptions(0), Gtk::AttachOptions(0));
                
                when_frame.set_name ("MetricDialogFrame");
                when_frame.add (when_table);
@@ -265,7 +269,6 @@ MeterDialog::init (const BBT_Time& when, double bpb, double note_type, bool mova
        
        bpb_frame.set_name ("MetricDialogFrame");
        note_frame.set_name ("MetricDialogFrame");
-       note_types.get_entry()->set_name ("MetricEntry");
        bpb_entry.set_name ("MetricEntry");
        ok_button.set_name ("MetricButton");
        cancel_button.set_name ("MetricButton");
@@ -293,12 +296,12 @@ MeterDialog::get_note_type ()
 {
        double note_type = 0;
        vector<const gchar *>::iterator i;
-       string text = note_types.get_entry()->get_text();
+       string text = note_types.get_active_text();
        
        for (i = strings.begin(); i != strings.end(); ++i) {
                if (text == *i) {
                        if (sscanf (text.c_str(), "%*[^0-9]%lf", &note_type) != 1) {
-                               error << compose(_("garbaged note type entry (%1)"), text) << endmsg;
+                               error << string_compose(_("garbaged note type entry (%1)"), text) << endmsg;
                                return 0;
                        } else {
                                break;
@@ -308,7 +311,7 @@ MeterDialog::get_note_type ()
        
        if (i == strings.end()) {
                if (sscanf (text.c_str(), "%lf", &note_type) != 1) {
-                       error << compose(_("incomprehensible note type entry (%1)"), text) << endmsg;
+                       error << string_compose(_("incomprehensible note type entry (%1)"), text) << endmsg;
                        return 0;
                }
        }