use new marker IO dialog from marker button

This commit is contained in:
Paul Davis 2014-09-13 13:18:24 -04:00
parent 6738eac45f
commit db182c852e
2 changed files with 47 additions and 0 deletions

View file

@ -108,6 +108,7 @@
#include "gui_thread.h"
#include "keyboard.h"
#include "marker.h"
#include "marker_io_dialog.h"
#include "midi_time_axis.h"
#include "mixer_strip.h"
#include "mixer_ui.h"
@ -270,6 +271,8 @@ Editor::Editor ()
, marker_lane_hbox (get_h_box ("marker_lane_hbox"))
, skip_button (get_waves_button ("skip_button"))
, global_tracks_button (get_waves_button ("global_tracks_button"))
, marker_button (get_waves_button ("marker_button"))
, marker_io_dialog (0)
, add_marker_button (get_waves_button ("add_marker_button"))
, global_solo_button (get_waves_button ("global_solo_button"))
, global_rec_button (get_waves_button ("global_rec_button"))
@ -651,6 +654,7 @@ Editor::Editor ()
ARDOUR_UI::Blink.connect (sigc::mem_fun(*this, &Editor::record_status_blink));
global_solo_button.signal_clicked.connect (sigc::mem_fun(*this,&Editor::global_solo_clicked));
global_rec_button.signal_clicked.connect (sigc::mem_fun(*this,&Editor::global_rec_clicked));
marker_button.signal_clicked.connect (sigc::mem_fun(*this,&Editor::marker_button_clicked));
set_zoom_focus (zoom_focus);
set_visible_track_count (_visible_track_count);
@ -5724,3 +5728,42 @@ Editor::global_rec_clicked (WavesButton*)
_session->set_record_enabled (_session->get_routes(), !_session->have_rec_enabled_track());
}
void
Editor::marker_button_clicked (WavesButton*)
{
if (!_session) {
return;
}
if (!marker_io_dialog) {
marker_io_dialog = new MarkerIODialog ();
} else {
if (marker_io_dialog->is_visible()) {
marker_io_dialog->hide ();
return;
}
}
marker_io_dialog->set_session (_session);
marker_io_dialog->show ();
Gtk::Container* toplevel = get_toplevel ();
if (toplevel) {
/* position this dialog directly below the marker button */
Gtk::Allocation r = marker_button.get_allocation ();
int x, y; /* coordinates of bottom left corner of marker_button in toplevel window */
marker_button.translate_coordinates (*toplevel, 0, r.get_height(), x, y);
/* convert to root coordinates */
int rx, ry;
toplevel->get_window()->get_root_coords (x, y, rx, ry);
/* and move it there */
marker_io_dialog->move (rx, ry);
}
}

View file

@ -113,6 +113,7 @@ class EditorSummary;
class GroupedButtons;
class GUIObjectState;
class Marker;
class MarkerIODialog;
class MidiRegionView;
class MixerStrip;
class MouseCursors;
@ -1622,6 +1623,9 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
Gtk::Table toolbar_selection_clock_table;
Gtk::Label toolbar_selection_cursor_label;
WavesButton& marker_button;
MarkerIODialog* marker_io_dialog;
void marker_button_clicked (WavesButton*);
WavesButton& add_marker_button;
WavesButton& global_solo_button;
void solo_blink (bool);