#include "ardour_ui.h"
#include "automation_time_axis.h"
#include "editor.h"
-#include "global_signals.h"
#include "editing.h"
#include "rgb_macros.h"
#include "utils.h"
#include "keyboard.h"
#include "editor_cursors.h"
#include "mouse_cursors.h"
+#include "ui_config.h"
#include "verbose_cursor.h"
#include "i18n.h"
_track_canvas_viewport = new ArdourCanvas::GtkCanvasViewport (horizontal_adjustment, vertical_adjustment);
_track_canvas = _track_canvas_viewport->canvas ();
- _track_canvas->set_background_color (ARDOUR_UI::config()->color ("arrange base"));
+ _track_canvas->set_background_color (UIConfiguration::instance().color ("arrange base"));
/* scroll group for items that should not automatically scroll
* (e.g verbose cursor). It shares the canvas coordinate space.
*/
no_scroll_group = new ArdourCanvas::Container (_track_canvas->root());
- ArdourCanvas::ScrollGroup* hsg;
+ ArdourCanvas::ScrollGroup* hsg;
ArdourCanvas::ScrollGroup* hg;
ArdourCanvas::ScrollGroup* cg;
CANVAS_DEBUG_NAME (h_scroll_group, "canvas h scroll");
_track_canvas->add_scroller (*hg);
- hv_scroll_group = hsg = new ArdourCanvas::ScrollGroup (_track_canvas->root(),
+ hv_scroll_group = hsg = new ArdourCanvas::ScrollGroup (_track_canvas->root(),
ArdourCanvas::ScrollGroup::ScrollSensitivity (ArdourCanvas::ScrollGroup::ScrollsVertically|
ArdourCanvas::ScrollGroup::ScrollsHorizontally));
CANVAS_DEBUG_NAME (hv_scroll_group, "canvas hv scroll");
/* a group to hold stuff while it gets dragged around. Must be the
* uppermost (last) group with hv_scroll_group as a parent
*/
- _drag_motion_group = new ArdourCanvas::Container (hv_scroll_group);
+ _drag_motion_group = new ArdourCanvas::Container (hv_scroll_group);
CANVAS_DEBUG_NAME (_drag_motion_group, "Canvas Drag Motion");
/* TIME BAR CANVAS */
initialize_rulers ();
- ColorsChanged.connect (sigc::mem_fun (*this, &Editor::color_handler));
+ UIConfiguration::instance().ColorsChanged.connect (sigc::mem_fun (*this, &Editor::color_handler));
color_handler();
}
/* drop onto canvas background: create new tracks */
frame = 0;
-
- do_import (midi_paths, Editing::ImportDistinctFiles, ImportAsTrack, SrcBest, frame);
+ InstrumentSelector is; // instantiation builds instrument-list and sets default.
+ do_import (midi_paths, Editing::ImportDistinctFiles, ImportAsTrack, SrcBest, frame, is.selected_instrument());
- if (Profile->get_sae() || ARDOUR_UI::config()->get_only_copy_imported_files() || copy) {
+ if (Profile->get_sae() || UIConfiguration::instance().get_only_copy_imported_files() || copy) {
do_import (audio_paths, Editing::ImportDistinctFiles, Editing::ImportAsTrack, SrcBest, frame);
} else {
do_embed (audio_paths, Editing::ImportDistinctFiles, ImportAsTrack, frame);
do_import (midi_paths, Editing::ImportSerializeFiles, ImportToTrack, SrcBest, frame);
- if (Profile->get_sae() || ARDOUR_UI::config()->get_only_copy_imported_files() || copy) {
+ if (Profile->get_sae() || UIConfiguration::instance().get_only_copy_imported_files() || copy) {
do_import (audio_paths, Editing::ImportSerializeFiles, Editing::ImportToTrack, SrcBest, frame);
} else {
do_embed (audio_paths, Editing::ImportSerializeFiles, ImportToTrack, frame);
void
Editor::maybe_autoscroll (bool allow_horiz, bool allow_vert, bool from_headers)
{
- if (!ARDOUR_UI::config()->get_autoscroll_editor () || autoscroll_active ()) {
+ if (!UIConfiguration::instance().get_autoscroll_editor () || autoscroll_active ()) {
return;
}
/* the effective width of the autoscroll boundary so
that we start scrolling before we hit the edge.
-
+
this helps when the window is slammed up against the
right edge of the screen, making it hard to scroll
effectively.
*/
- if (alloc.get_width() > 20) {
+ if (alloc.get_width() > 20) {
alloc.set_width (alloc.get_width() - 20);
alloc.set_x (alloc.get_x() + 10);
- }
+ }
}
// const double vertical_pos = vertical_adjustment.get_value();
const int speed_factor = 10;
- /* vertical */
+ /* vertical */
if (y < autoscroll_boundary.y0) {
/* the motion handler expects events in canvas coordinate space */
/* we asked for the mouse position above (::get_pointer()) via
- * our own top level window (we being the Editor). Convert into
+ * our own top level window (we being the Editor). Convert into
* coordinates within the canvas window.
*/
} else if (no_stop) {
/* not changing visual state but pointer is outside the scrolling boundary
- * so we still need to deliver a fake motion event
+ * so we still need to deliver a fake motion event
*/
GdkEventMotion ev;
double const track_min_y = track.y_position ();
double const track_max_y = track.y_position () + track.effective_height ();
- if (!at_top &&
+ if (!at_top &&
(track_min_y >= current_view_min_y &&
track_max_y < current_view_max_y)) {
/* already visible, and caller did not ask to place it at the
void
Editor::color_handler()
{
- ArdourCanvas::Color base = ARDOUR_UI::config()->color ("ruler base");
- ArdourCanvas::Color text = ARDOUR_UI::config()->color ("ruler text");
+ ArdourCanvas::Color base = UIConfiguration::instance().color ("ruler base");
+ ArdourCanvas::Color text = UIConfiguration::instance().color ("ruler text");
timecode_ruler->set_fill_color (base);
timecode_ruler->set_outline_color (text);
minsec_ruler->set_fill_color (base);
bbt_ruler->set_fill_color (base);
bbt_ruler->set_outline_color (text);
- playhead_cursor->set_color (ARDOUR_UI::config()->color ("play head"));
+ playhead_cursor->set_color (UIConfiguration::instance().color ("play head"));
- meter_bar->set_fill_color (ARDOUR_UI::config()->color_mod ("meter bar", "marker bar"));
- meter_bar->set_outline_color (ARDOUR_UI::config()->color ("marker bar separator"));
+ meter_bar->set_fill_color (UIConfiguration::instance().color_mod ("meter bar", "marker bar"));
+ meter_bar->set_outline_color (UIConfiguration::instance().color ("marker bar separator"));
- tempo_bar->set_fill_color (ARDOUR_UI::config()->color_mod ("tempo bar", "marker bar"));
- tempo_bar->set_outline_color (ARDOUR_UI::config()->color ("marker bar separator"));
+ tempo_bar->set_fill_color (UIConfiguration::instance().color_mod ("tempo bar", "marker bar"));
+ tempo_bar->set_outline_color (UIConfiguration::instance().color ("marker bar separator"));
- marker_bar->set_fill_color (ARDOUR_UI::config()->color_mod ("marker bar", "marker bar"));
- marker_bar->set_outline_color (ARDOUR_UI::config()->color ("marker bar separator"));
+ marker_bar->set_fill_color (UIConfiguration::instance().color_mod ("marker bar", "marker bar"));
+ marker_bar->set_outline_color (UIConfiguration::instance().color ("marker bar separator"));
- cd_marker_bar->set_fill_color (ARDOUR_UI::config()->color_mod ("cd marker bar", "marker bar"));
- cd_marker_bar->set_outline_color (ARDOUR_UI::config()->color ("marker bar separator"));
+ cd_marker_bar->set_fill_color (UIConfiguration::instance().color_mod ("cd marker bar", "marker bar"));
+ cd_marker_bar->set_outline_color (UIConfiguration::instance().color ("marker bar separator"));
- range_marker_bar->set_fill_color (ARDOUR_UI::config()->color_mod ("range marker bar", "marker bar"));
- range_marker_bar->set_outline_color (ARDOUR_UI::config()->color ("marker bar separator"));
+ range_marker_bar->set_fill_color (UIConfiguration::instance().color_mod ("range marker bar", "marker bar"));
+ range_marker_bar->set_outline_color (UIConfiguration::instance().color ("marker bar separator"));
- transport_marker_bar->set_fill_color (ARDOUR_UI::config()->color_mod ("transport marker bar", "marker bar"));
- transport_marker_bar->set_outline_color (ARDOUR_UI::config()->color ("marker bar separator"));
+ transport_marker_bar->set_fill_color (UIConfiguration::instance().color_mod ("transport marker bar", "marker bar"));
+ transport_marker_bar->set_outline_color (UIConfiguration::instance().color ("marker bar separator"));
- cd_marker_bar_drag_rect->set_fill_color (ARDOUR_UI::config()->color ("range drag bar rect"));
- cd_marker_bar_drag_rect->set_outline_color (ARDOUR_UI::config()->color ("range drag bar rect"));
+ cd_marker_bar_drag_rect->set_fill_color (UIConfiguration::instance().color ("range drag bar rect"));
+ cd_marker_bar_drag_rect->set_outline_color (UIConfiguration::instance().color ("range drag bar rect"));
- range_bar_drag_rect->set_fill_color (ARDOUR_UI::config()->color ("range drag bar rect"));
- range_bar_drag_rect->set_outline_color (ARDOUR_UI::config()->color ("range drag bar rect"));
+ range_bar_drag_rect->set_fill_color (UIConfiguration::instance().color ("range drag bar rect"));
+ range_bar_drag_rect->set_outline_color (UIConfiguration::instance().color ("range drag bar rect"));
- transport_bar_drag_rect->set_fill_color (ARDOUR_UI::config()->color ("transport drag rect"));
- transport_bar_drag_rect->set_outline_color (ARDOUR_UI::config()->color ("transport drag rect"));
+ transport_bar_drag_rect->set_fill_color (UIConfiguration::instance().color ("transport drag rect"));
+ transport_bar_drag_rect->set_outline_color (UIConfiguration::instance().color ("transport drag rect"));
- transport_loop_range_rect->set_fill_color (ARDOUR_UI::config()->color_mod ("transport loop rect", "loop rectangle"));
- transport_loop_range_rect->set_outline_color (ARDOUR_UI::config()->color ("transport loop rect"));
+ transport_loop_range_rect->set_fill_color (UIConfiguration::instance().color_mod ("transport loop rect", "loop rectangle"));
+ transport_loop_range_rect->set_outline_color (UIConfiguration::instance().color ("transport loop rect"));
- transport_punch_range_rect->set_fill_color (ARDOUR_UI::config()->color ("transport punch rect"));
- transport_punch_range_rect->set_outline_color (ARDOUR_UI::config()->color ("transport punch rect"));
+ transport_punch_range_rect->set_fill_color (UIConfiguration::instance().color ("transport punch rect"));
+ transport_punch_range_rect->set_outline_color (UIConfiguration::instance().color ("transport punch rect"));
- transport_punchin_line->set_outline_color (ARDOUR_UI::config()->color ("punch line"));
- transport_punchout_line->set_outline_color (ARDOUR_UI::config()->color ("punch line"));
+ transport_punchin_line->set_outline_color (UIConfiguration::instance().color ("punch line"));
+ transport_punchout_line->set_outline_color (UIConfiguration::instance().color ("punch line"));
- rubberband_rect->set_outline_color (ARDOUR_UI::config()->color ("rubber band rect"));
- rubberband_rect->set_fill_color (ARDOUR_UI::config()->color_mod ("rubber band rect", "selection rect"));
+ rubberband_rect->set_outline_color (UIConfiguration::instance().color ("rubber band rect"));
+ rubberband_rect->set_fill_color (UIConfiguration::instance().color_mod ("rubber band rect", "selection rect"));
- location_marker_color = ARDOUR_UI::config()->color ("location marker");
- location_range_color = ARDOUR_UI::config()->color ("location range");
- location_cd_marker_color = ARDOUR_UI::config()->color ("location cd marker");
- location_loop_color = ARDOUR_UI::config()->color ("location loop");
- location_punch_color = ARDOUR_UI::config()->color ("location punch");
+ location_marker_color = UIConfiguration::instance().color ("location marker");
+ location_range_color = UIConfiguration::instance().color ("location range");
+ location_cd_marker_color = UIConfiguration::instance().color ("location cd marker");
+ location_loop_color = UIConfiguration::instance().color ("location loop");
+ location_punch_color = UIConfiguration::instance().color ("location punch");
refresh_location_display ();
/* redraw the whole thing */
- _track_canvas->set_background_color (ARDOUR_UI::config()->color ("arrange base"));
+ _track_canvas->set_background_color (UIConfiguration::instance().color ("arrange base"));
_track_canvas->queue_draw ();
-
+
/*
redisplay_tempo (true);
hv_scroll_group->add_items_at_point (ArdourCanvas::Duple (x,y), items);
- // first item will be the upper most
+ // first item will be the upper most
if (!items.empty()) {
const ArdourCanvas::Item* i = items.front();
{
Gdk::Cursor* cursor = which_mode_cursor ();
+ if (mouse_mode == MouseRange) {
+ switch (type) {
+ case StartSelectionTrimItem:
+ cursor = _cursors->left_side_trim;
+ break;
+ case EndSelectionTrimItem:
+ cursor = _cursors->right_side_trim;
+ break;
+ default:
+ break;
+ }
+ }
+
if ((mouse_mode == MouseObject || get_smart_mode ()) ||
mouse_mode == MouseContent) {
cursor = _cursors->fader;
break;
case GainLineItem:
- cursor = which_track_cursor ();
+ cursor = _cursors->cross_hair;
break;
case AutomationLineItem:
cursor = _cursors->cross_hair;