Move delta-to-edit-point options to the main clock context menus (#4472).

git-svn-id: svn://localhost/ardour2/branches/3.0@12517 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Carl Hetherington
2012-05-31 23:14:03 +00:00
parent 06aa9c7435
commit 6624f9be37
15 changed files with 120 additions and 26 deletions

View File

@@ -89,6 +89,7 @@ typedef uint64_t microseconds_t;
#include "gui_thread.h"
#include "keyboard.h"
#include "location_ui.h"
#include "main_clock.h"
#include "missing_file_dialog.h"
#include "missing_plugin_dialog.h"
#include "mixer_ui.h"
@@ -128,8 +129,8 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[])
: Gtkmm2ext::UI (PROGRAM_NAME, argcp, argvp)
, gui_object_state (new GUIObjectState)
, primary_clock (new AudioClock (X_("primary"), false, X_("transport"), true, true, false, true))
, secondary_clock (new AudioClock (X_("secondary"), false, X_("secondary"), true, true, false, true))
, primary_clock (new MainClock (X_("primary"), false, X_("transport"), true, true, true, false, true))
, secondary_clock (new MainClock (X_("secondary"), false, X_("secondary"), true, true, false, false, true))
/* big clock */

View File

@@ -83,6 +83,7 @@ class ButtonJoiner;
class ConnectionEditor;
class KeyEditor;
class LocationUIWindow;
class MainClock;
class Mixer_UI;
class PublicEditor;
class RCOptionEditor;
@@ -194,8 +195,8 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr
GUIObjectState* gui_object_state;
AudioClock* primary_clock;
AudioClock* secondary_clock;
MainClock* primary_clock;
MainClock* secondary_clock;
void focus_on_clock ();
TimeInfoBox* time_info_box;

View File

@@ -47,6 +47,7 @@
#include "audio_clock.h"
#include "actions.h"
#include "button_joiner.h"
#include "main_clock.h"
#include "utils.h"
#include "theme_manager.h"
#include "midi_tracer.h"

View File

@@ -35,6 +35,7 @@
#include "gui_thread.h"
#include "keyeditor.h"
#include "location_ui.h"
#include "main_clock.h"
#include "midi_tracer.h"
#include "mixer_ui.h"
#include "public_editor.h"

View File

@@ -55,6 +55,7 @@
#include "window_proxy.h"
#include "global_port_matrix.h"
#include "location_ui.h"
#include "main_clock.h"
#include <gtkmm2ext/application.h>

View File

@@ -38,6 +38,7 @@
#include "actions.h"
#include "gui_thread.h"
#include "public_editor.h"
#include "main_clock.h"
#include "i18n.h"

View File

@@ -61,7 +61,8 @@ const double AudioClock::x_leading_padding = 6.0;
AudioClock::AudioClock (const string& clock_name, bool transient, const string& widget_name,
bool allow_edit, bool follows_playhead, bool duration, bool with_info)
: _name (clock_name)
: ops_menu (0)
, _name (clock_name)
, is_transient (transient)
, is_duration (duration)
, editable (allow_edit)
@@ -71,7 +72,6 @@ AudioClock::AudioClock (const string& clock_name, bool transient, const string&
, layout_x_offset (0)
, em_width (0)
, _edit_by_click_field (false)
, ops_menu (0)
, editing_attr (0)
, foreground_attr (0)
, first_height (0)

View File

@@ -87,6 +87,9 @@ class AudioClock : public CairoWidget, public ARDOUR::SessionHandlePtr
protected:
void render (cairo_t*);
virtual void build_ops_menu ();
Gtk::Menu *ops_menu;
private:
Mode _mode;
std::string _name;
@@ -101,8 +104,6 @@ class AudioClock : public CairoWidget, public ARDOUR::SessionHandlePtr
int em_width;
bool _edit_by_click_field;
Gtk::Menu *ops_menu;
Glib::RefPtr<Pango::Layout> _layout;
Glib::RefPtr<Pango::Layout> _left_layout;
Glib::RefPtr<Pango::Layout> _right_layout;
@@ -197,8 +198,6 @@ class AudioClock : public CairoWidget, public ARDOUR::SessionHandlePtr
framepos_t frames_from_minsec_string (const std::string&) const;
framepos_t frames_from_audioframes_string (const std::string&) const;
void build_ops_menu ();
void session_configuration_changed (std::string);
Field index_to_field () const;

View File

@@ -47,6 +47,7 @@
#include "utils.h"
#include "editor_regions.h"
#include "editor_drag.h"
#include "main_clock.h"
#include "i18n.h"

68
gtk2_ardour/main_clock.cc Normal file
View File

@@ -0,0 +1,68 @@
/*
Copyright (C) 2012 Paul Davis
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "ardour/rc_configuration.h"
#include "main_clock.h"
#include "i18n.h"
using namespace Gtk;
MainClock::MainClock (
const std::string& clock_name,
bool is_transient,
const std::string& widget_name,
bool editable,
bool follows_playhead,
bool primary,
bool duration,
bool with_info
)
: AudioClock (clock_name, is_transient, widget_name, editable, follows_playhead, duration, with_info)
, _primary (primary)
{
}
void
MainClock::build_ops_menu ()
{
using namespace Menu_Helpers;
AudioClock::build_ops_menu ();
MenuList& ops_items = ops_menu->items();
ops_items.push_back (SeparatorElem ());
ops_items.push_back (CheckMenuElem (_("Display delta to edit cursor"), sigc::mem_fun (*this, &MainClock::display_delta_to_edit_cursor)));
CheckMenuItem* c = dynamic_cast<CheckMenuItem *> (&ops_items.back());
if (_primary) {
c->set_active (ARDOUR::Config->get_primary_clock_delta_edit_cursor ());
} else {
c->set_active (ARDOUR::Config->get_secondary_clock_delta_edit_cursor ());
}
}
void
MainClock::display_delta_to_edit_cursor ()
{
if (_primary) {
ARDOUR::Config->set_primary_clock_delta_edit_cursor (!ARDOUR::Config->get_primary_clock_delta_edit_cursor ());
} else {
ARDOUR::Config->set_secondary_clock_delta_edit_cursor (!ARDOUR::Config->get_secondary_clock_delta_edit_cursor ());
}
}

33
gtk2_ardour/main_clock.h Normal file
View File

@@ -0,0 +1,33 @@
/*
Copyright (C) 2012 Paul Davis
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "audio_clock.h"
/** A simple subclass of AudioClock that adds the `display delta to edit cursor' option to its context menu */
class MainClock : public AudioClock
{
public:
MainClock (const std::string &, bool, const std::string &, bool, bool, bool primary, bool duration = false, bool with_info = false);
private:
void build_ops_menu ();
void display_delta_to_edit_cursor ();
bool _primary;
};

View File

@@ -1005,22 +1005,6 @@ RCOptionEditor::RCOptionEditor ()
sigc::mem_fun (*_rc_config, &RCConfiguration::set_seamless_loop)
));
add_option (_("Transport"),
new BoolOption (
"primary-clock-delta-edit-cursor",
_("Primary clock delta to edit cursor"),
sigc::mem_fun (*_rc_config, &RCConfiguration::get_primary_clock_delta_edit_cursor),
sigc::mem_fun (*_rc_config, &RCConfiguration::set_primary_clock_delta_edit_cursor)
));
add_option (_("Transport"),
new BoolOption (
"secondary-clock-delta-edit-cursor",
_("Secondary clock delta to edit cursor"),
sigc::mem_fun (*_rc_config, &RCConfiguration::get_secondary_clock_delta_edit_cursor),
sigc::mem_fun (*_rc_config, &RCConfiguration::set_secondary_clock_delta_edit_cursor)
));
add_option (_("Transport"),
new BoolOption (
"disable-disarm-during-roll",

View File

@@ -61,6 +61,7 @@
#include "editing.h"
#include "utils.h"
#include "gain_meter.h"
#include "main_clock.h"
#ifdef FREESOUND
#include "sfdb_freesound_mootcher.h"

View File

@@ -26,6 +26,7 @@
#include "audio_clock.h"
#include "editor.h"
#include "editor_drag.h"
#include "main_clock.h"
#include "utils.h"
#include "verbose_cursor.h"

View File

@@ -132,6 +132,7 @@ gtk2_ardour_sources = [
'lineset.cc',
'location_ui.cc',
'main.cc',
'main_clock.cc',
'marker.cc',
'midi_automation_line.cc',
'midi_channel_dialog.cc',