convert property_foo().set_value(bar) to property_foo() = bar
[ardour.git] / gtk2_ardour / editor_tempodisplay.cc
index eae91fc92cbe5342f8bb435232268f1c0286742b..715adf72847c04ddcae87e9dca1b0c5a12c50adb 100644 (file)
@@ -24,7 +24,7 @@
 #include <string>
 #include <climits>
 
-#include <gtk-canvas.h>
+#include <libgnomecanvasmm/libgnomecanvasmm.h>
 
 #include <pbd/error.h>
 
@@ -71,12 +71,12 @@ Editor::draw_metric_marks (const Metrics& metrics)
                
                if ((ms = dynamic_cast<const MeterSection*>(*i)) != 0) {
                        snprintf (buf, sizeof(buf), "%g/%g", ms->beats_per_bar(), ms->note_divisor ());
-                       metric_marks.push_back (new MeterMarker (*this, GTK_CANVAS_GROUP(meter_group), color_map[cMeterMarker], buf, 
-                                                                *(const_cast<MeterSection*>(ms)), PublicEditor::canvas_meter_marker_event));
+                       metric_marks.push_back (new MeterMarker (*this, *meter_group, color_map[cMeterMarker], buf, 
+                                                                *(const_cast<MeterSection*>(ms))));
                } else if ((ts = dynamic_cast<const TempoSection*>(*i)) != 0) {
                        snprintf (buf, sizeof (buf), "%.2f", ts->beats_per_minute());
-                       metric_marks.push_back (new TempoMarker (*this, GTK_CANVAS_GROUP(tempo_group), color_map[cTempoMarker], buf, 
-                                                                *(const_cast<TempoSection*>(ts)), PublicEditor::canvas_tempo_marker_event));
+                       metric_marks.push_back (new TempoMarker (*this, *tempo_group, color_map[cTempoMarker], buf, 
+                                                                *(const_cast<TempoSection*>(ts))));
                }
                
        }
@@ -85,7 +85,7 @@ Editor::draw_metric_marks (const Metrics& metrics)
 void
 Editor::tempo_map_changed (Change ignored)
 {
-       ENSURE_GUI_THREAD(bind (slot (*this, &Editor::tempo_map_changed), ignored));
+       ENSURE_GUI_THREAD(bind (mem_fun(*this, &Editor::tempo_map_changed), ignored));
        
        if (current_bbt_points) {
                delete current_bbt_points;
@@ -120,21 +120,19 @@ void
 Editor::hide_measures ()
 {
        for (TimeLineList::iterator i = used_measure_lines.begin(); i != used_measure_lines.end(); ++i) {
-               gtk_canvas_item_hide (*i);
+               (*i)->hide();
                free_measure_lines.push_back (*i);
        }
        used_measure_lines.clear ();
 }
 
-GtkCanvasItem *
+ArdourCanvas::Line *
 Editor::get_time_line ()
 {
-       GtkCanvasItem *line;
+         ArdourCanvas::Line *line;
 
        if (free_measure_lines.empty()) {
-               line = gtk_canvas_item_new (GTK_CANVAS_GROUP(time_line_group),
-                                           gtk_canvas_simpleline_get_type(),
-                                           NULL);
+               line = new ArdourCanvas::Line (*time_line_group);
                // cerr << "measure line @ " << line << endl;
                used_measure_lines.push_back (line);
        } else {
@@ -155,7 +153,7 @@ Editor::draw_measures ()
 
        TempoMap::BBTPointList::iterator i;
        TempoMap::BBTPointList *all_bbt_points;
-       GtkCanvasItem *line;
+       ArdourCanvas::Line *line;
        gdouble xpos, last_xpos;
        uint32_t cnt;
        uint32_t color;
@@ -217,14 +215,12 @@ Editor::draw_measures ()
 
                        if (cnt == 0 || xpos - last_xpos > 4.0) {
                                line = get_time_line ();
-                               gtk_object_set (GTK_OBJECT(line),
-                                               "x1", xpos,
-                                               "x2", xpos,
-                                               "y2", (gdouble) canvas_height,
-                                               "color_rgba", color,
-                                               NULL);
-                               gtk_canvas_item_raise_to_top (line);
-                               gtk_canvas_item_show (line);
+                               line->set_property ("x1", xpos);
+                               line->set_property ("x2", xpos);
+                               line->set_property ("y2", (gdouble) canvas_height);
+                               line->set_property ("color_rgba", color);
+                               line->raise_to_top();
+                               line->show();
                                last_xpos = xpos;       
                                ++cnt;
                        } 
@@ -236,8 +232,8 @@ Editor::draw_measures ()
 
        /* the cursors are always on top of everything */
 
-       gtk_canvas_item_raise_to_top (cursor_group);
-       gtk_canvas_item_lower_to_bottom (time_line_group);
+       cursor_group->raise_to_top();
+       time_line_group->lower_to_bottom();
 }
 
 void
@@ -251,13 +247,14 @@ Editor::mouse_add_new_tempo_event (jack_nframes_t frame)
        TempoMap& map(session->tempo_map());
        TempoDialog tempo_dialog (map, frame, _("add"));
        
-       tempo_dialog.bpm_entry.activate.connect (bind (slot (tempo_dialog, &ArdourDialog::stop), 0));
-       tempo_dialog.ok_button.signal_clicked().connect (bind (slot (tempo_dialog, &ArdourDialog::stop), 0));
-       tempo_dialog.cancel_button.signal_clicked().connect (bind (slot (tempo_dialog, &ArdourDialog::stop), -1));
+       tempo_dialog.bpm_entry.signal_activate().connect (bind (mem_fun (tempo_dialog, &ArdourDialog::stop), 0));
+       tempo_dialog.ok_button.signal_clicked().connect (bind (mem_fun (tempo_dialog, &ArdourDialog::stop), 0));
+       tempo_dialog.cancel_button.signal_clicked().connect (bind (mem_fun (tempo_dialog, &ArdourDialog::stop), -1));
 
        tempo_dialog.set_position (Gtk::WIN_POS_MOUSE);
-       tempo_dialog.realize ();
-       tempo_dialog.get_window().set_decorations (GdkWMDecoration (GDK_DECOR_BORDER|GDK_DECOR_RESIZEH));
+       // GTK2FIX
+       // tempo_dialog.realize ();
+       // tempo_dialog.get_window()->set_decorations (Gdk::WMDecoration (Gdk::DECOR_BORDER|Gdk::DECOR_RESIZEH));
 
        ensure_float (tempo_dialog);
 
@@ -294,12 +291,13 @@ Editor::mouse_add_new_meter_event (jack_nframes_t frame)
        TempoMap& map(session->tempo_map());
        MeterDialog meter_dialog (map, frame, _("add"));
 
-       meter_dialog.ok_button.signal_clicked().connect (bind (slot (meter_dialog, &ArdourDialog::stop), 0));
-       meter_dialog.cancel_button.signal_clicked().connect (bind (slot (meter_dialog, &ArdourDialog::stop), -1));
+       meter_dialog.ok_button.signal_clicked().connect (bind (mem_fun (meter_dialog, &ArdourDialog::stop), 0));
+       meter_dialog.cancel_button.signal_clicked().connect (bind (mem_fun (meter_dialog, &ArdourDialog::stop), -1));
 
        meter_dialog.set_position (Gtk::WIN_POS_MOUSE);
-       meter_dialog.realize ();
-       meter_dialog.get_window().set_decorations (GdkWMDecoration (GDK_DECOR_BORDER|GDK_DECOR_RESIZEH));
+       // GTK2FIX
+       // meter_dialog.realize ();
+       // meter_dialog.get_window()->set_decorations (Gdk::WMDecoration (Gdk::DECOR_BORDER|Gdk::DECOR_RESIZEH));
 
        ensure_float (meter_dialog);
        
@@ -326,7 +324,7 @@ Editor::mouse_add_new_meter_event (jack_nframes_t frame)
 }
 
 void
-Editor::remove_tempo_marker (GtkCanvasItem* item)
+Editor::remove_tempo_marker (ArdourCanvas::Item* item)
 {
        Marker* marker;
        TempoMarker* tempo_marker;
@@ -342,7 +340,7 @@ Editor::remove_tempo_marker (GtkCanvasItem* item)
        }               
 
        if (tempo_marker->tempo().movable()) {
-               Gtk::Main::idle.connect (bind (slot (*this, &Editor::real_remove_tempo_marker), &tempo_marker->tempo()));
+         Glib::signal_idle().connect (bind (mem_fun(*this, &Editor::real_remove_tempo_marker), &tempo_marker->tempo()));
        }
 }
 
@@ -351,12 +349,13 @@ Editor::edit_meter_section (MeterSection* section)
 {
        MeterDialog meter_dialog (*section, _("done"));
 
-       meter_dialog.ok_button.signal_clicked().connect (bind (slot (meter_dialog, &ArdourDialog::stop), 0));
-       meter_dialog.cancel_button.signal_clicked().connect (bind (slot (meter_dialog, &ArdourDialog::stop), -1));
+       meter_dialog.ok_button.signal_clicked().connect (bind (mem_fun (meter_dialog, &ArdourDialog::stop), 0));
+       meter_dialog.cancel_button.signal_clicked().connect (bind (mem_fun (meter_dialog, &ArdourDialog::stop), -1));
 
        meter_dialog.set_position (Gtk::WIN_POS_MOUSE);
-       meter_dialog.realize ();
-       meter_dialog.get_window().set_decorations (GdkWMDecoration (GDK_DECOR_BORDER|GDK_DECOR_RESIZEH));
+       // GTK2FIX
+       // meter_dialog.realize ();
+       // meter_dialog.get_window()->set_decorations (Gdk::WMDecoration (Gdk::DECOR_BORDER|Gdk::DECOR_RESIZEH));
 
        ensure_float (meter_dialog);
 
@@ -382,13 +381,14 @@ Editor::edit_tempo_section (TempoSection* section)
 {
        TempoDialog tempo_dialog (*section, _("done"));
 
-       tempo_dialog.bpm_entry.activate.connect (bind (slot (tempo_dialog, &ArdourDialog::stop), 0));
-       tempo_dialog.ok_button.signal_clicked().connect (bind (slot (tempo_dialog, &ArdourDialog::stop), 0));
-       tempo_dialog.cancel_button.signal_clicked().connect (bind (slot (tempo_dialog, &ArdourDialog::stop), -1));
+       tempo_dialog.bpm_entry.signal_activate().connect (bind (mem_fun (tempo_dialog, &ArdourDialog::stop), 0));
+       tempo_dialog.ok_button.signal_clicked().connect (bind (mem_fun (tempo_dialog, &ArdourDialog::stop), 0));
+       tempo_dialog.cancel_button.signal_clicked().connect (bind (mem_fun (tempo_dialog, &ArdourDialog::stop), -1));
 
        tempo_dialog.set_position (Gtk::WIN_POS_MOUSE);
-       tempo_dialog.realize ();
-       tempo_dialog.get_window().set_decorations (GdkWMDecoration (GDK_DECOR_BORDER|GDK_DECOR_RESIZEH));
+       // GTK2FIX
+       // tempo_dialog.realize ();
+       // tempo_dialog.get_window()->set_decorations (Gdk::WMDecoration (Gdk::DECOR_BORDER|Gdk::DECOR_RESIZEH));
 
        ensure_float (tempo_dialog);
        
@@ -411,7 +411,7 @@ Editor::edit_tempo_section (TempoSection* section)
 }
 
 void
-Editor::edit_tempo_marker (GtkCanvasItem *item)
+Editor::edit_tempo_marker (ArdourCanvas::Item *item)
 {
        Marker* marker;
        TempoMarker* tempo_marker;
@@ -430,7 +430,7 @@ Editor::edit_tempo_marker (GtkCanvasItem *item)
 }
 
 void
-Editor::edit_meter_marker (GtkCanvasItem *item)
+Editor::edit_meter_marker (ArdourCanvas::Item *item)
 {
        Marker* marker;
        MeterMarker* meter_marker;
@@ -461,7 +461,7 @@ Editor::real_remove_tempo_marker (TempoSection *section)
 }
 
 void
-Editor::remove_meter_marker (GtkCanvasItem* item)
+Editor::remove_meter_marker (ArdourCanvas::Item* item)
 {
        Marker* marker;
        MeterMarker* meter_marker;
@@ -477,7 +477,7 @@ Editor::remove_meter_marker (GtkCanvasItem* item)
        }               
 
        if (meter_marker->meter().movable()) {
-               Gtk::Main::idle.connect (bind (slot (*this, &Editor::real_remove_meter_marker), &meter_marker->meter()));
+         Glib::signal_idle().connect (bind (mem_fun(*this, &Editor::real_remove_meter_marker), &meter_marker->meter()));
        }
 }