current_interthread_info = 0;
_show_measures = true;
show_gain_after_trim = false;
- verbose_cursor_on = true;
last_item_entered = 0;
have_pending_keyboard_selection = false;
}
}
-void
-Editor::show_verbose_canvas_cursor ()
-{
- verbose_canvas_cursor->raise_to_top();
- verbose_canvas_cursor->show();
- verbose_cursor_visible = true;
-}
-
-void
-Editor::hide_verbose_canvas_cursor ()
-{
- verbose_canvas_cursor->hide();
- verbose_cursor_visible = false;
-}
-
-double
-Editor::clamp_verbose_cursor_x (double x)
-{
- if (x < 0) {
- x = 0;
- } else {
- x = min (_canvas_width - 200.0, x);
- }
- return x;
-}
-
-double
-Editor::clamp_verbose_cursor_y (double y)
-{
- if (y < canvas_timebars_vsize) {
- y = canvas_timebars_vsize;
- } else {
- y = min (_canvas_height - 50, y);
- }
- return y;
-}
-
-void
-Editor::show_verbose_canvas_cursor_with (const string & txt, int32_t xoffset, int32_t yoffset)
-{
- verbose_canvas_cursor->property_text() = txt.c_str();
-
- int x, y;
- double wx, wy;
-
- track_canvas->get_pointer (x, y);
- track_canvas->window_to_world (x, y, wx, wy);
-
- wx += xoffset;
- wy += yoffset;
-
- /* don't get too close to the edge */
- verbose_canvas_cursor->property_x() = clamp_verbose_cursor_x (wx);
- verbose_canvas_cursor->property_y() = clamp_verbose_cursor_y (wy);
-
- show_verbose_canvas_cursor ();
-}
-
-void
-Editor::set_verbose_canvas_cursor (const string & txt, double x, double y)
-{
- verbose_canvas_cursor->property_text() = txt.c_str();
- /* don't get too close to the edge */
- verbose_canvas_cursor->property_x() = clamp_verbose_cursor_x (x);
- verbose_canvas_cursor->property_y() = clamp_verbose_cursor_y (y);
-}
-
-void
-Editor::set_verbose_canvas_cursor_text (const string & txt)
-{
- verbose_canvas_cursor->property_text() = txt.c_str();
-}
-
void
Editor::set_edit_mode (EditMode m)
{
class ProgressReporter;
class EditorCursor;
class MouseCursors;
+class VerboseCursor;
/* <CMT Additions> */
class ImageFrameView;
void get_regions_corresponding_to (boost::shared_ptr<ARDOUR::Region> region, std::vector<RegionView*>& regions);
- void show_verbose_canvas_cursor_with (const std::string& txt, int32_t xoffset = 0, int32_t yoffset = 0);
- void hide_verbose_canvas_cursor();
-
void center_screen (framepos_t);
TrackViewList axis_views_from_routes (boost::shared_ptr<ARDOUR::RouteList>) const;
return _cursors;
}
+ VerboseCursor* verbose_cursor () const {
+ return _verbose_cursor;
+ }
+
+ void get_pointer_position (double &, double &) const;
+
protected:
void map_transport_state ();
void map_position_change (framepos_t);
ArdourCanvas::Canvas* track_canvas;
- ArdourCanvas::NoEventText* verbose_canvas_cursor;
- bool verbose_cursor_visible;
+ friend class VerboseCursor;
+ VerboseCursor* _verbose_cursor;
void parameter_changed (std::string);
bool track_canvas_motion (GdkEvent*);
- void set_verbose_canvas_cursor (const std::string &, double x, double y);
- void set_verbose_canvas_cursor_text (const std::string &);
- void show_verbose_canvas_cursor();
-
- bool verbose_cursor_on; // so far unused
-
Gtk::EventBox time_canvas_event_box;
Gtk::EventBox track_canvas_event_box;
Gtk::EventBox time_button_event_box;
void mouse_brush_insert_region (RegionView*, framepos_t pos);
- void show_verbose_time_cursor (framepos_t frame, double offset = 0, double xpos=-1, double ypos=-1);
- void show_verbose_duration_cursor (framepos_t start, framepos_t end, double offset = 0, double xpos=-1, double ypos=-1);
- double clamp_verbose_cursor_x (double);
- double clamp_verbose_cursor_y (double);
-
/* Canvas event handlers */
bool canvas_control_point_event (GdkEvent* event,ArdourCanvas::Item*, ControlPoint*);
#include "keyboard.h"
#include "editor_cursors.h"
#include "mouse_cursors.h"
+#include "verbose_cursor.h"
#include "i18n.h"
gint phys_width = physical_screen_width (Glib::RefPtr<Gdk::Window>());
gint phys_height = physical_screen_height (Glib::RefPtr<Gdk::Window>());
- /* stuff for the verbose canvas cursor */
-
- Pango::FontDescription* font = get_font_for_style (N_("VerboseCanvasCursor"));
-
- verbose_canvas_cursor = new ArdourCanvas::NoEventText (*track_canvas->root());
- verbose_canvas_cursor->property_font_desc() = *font;
- verbose_canvas_cursor->property_anchor() = ANCHOR_NW;
-
- delete font;
-
- verbose_cursor_visible = false;
-
+ _verbose_cursor = new VerboseCursor (this);
+
/* on the bottom, an image */
if (Profile->get_sae()) {
Editor::color_handler()
{
playhead_cursor->canvas_item.property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_PlayHead.get();
- verbose_canvas_cursor->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_VerboseCanvasCursor.get();
+ _verbose_cursor->set_color (ARDOUR_UI::config()->canvasvar_VerboseCanvasCursor.get());
meter_bar->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_MeterBar.get();
meter_bar->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_MarkerBarSeparator.get();
#include "editor_drag.h"
#include "midi_time_axis.h"
#include "editor_regions.h"
+#include "verbose_cursor.h"
#include "i18n.h"
bool
Editor::track_canvas_motion (GdkEvent *ev)
{
- if (verbose_cursor_visible) {
- verbose_canvas_cursor->property_x() = clamp_verbose_cursor_x (ev->motion.x + 10);
- verbose_canvas_cursor->property_y() = clamp_verbose_cursor_y (ev->motion.y + 10);
+ if (_verbose_cursor->visible ()) {
+ _verbose_cursor->set_position (ev->motion.x + 10, ev->motion.y + 10);
}
return false;
#include "debug.h"
#include "editor_cursors.h"
#include "mouse_cursors.h"
+#include "verbose_cursor.h"
using namespace std;
using namespace ARDOUR;
finished (event, _move_threshold_passed);
- _editor->hide_verbose_canvas_cursor();
+ _editor->verbose_cursor()->hide ();
return _move_threshold_passed;
}
aborted (_move_threshold_passed);
_editor->stop_canvas_autoscroll ();
- _editor->hide_verbose_canvas_cursor ();
+ _editor->verbose_cursor()->hide ();
}
+void
+Drag::show_verbose_cursor_time (framepos_t frame)
+{
+ _editor->verbose_cursor()->set_time (
+ frame,
+ _drags->current_pointer_x() + 10 - _editor->horizontal_position(),
+ _drags->current_pointer_y() + 10 - _editor->vertical_adjustment.get_value() + _editor->canvas_timebars_vsize
+ );
+
+ _editor->verbose_cursor()->show ();
+}
+
+void
+Drag::show_verbose_cursor_duration (framepos_t start, framepos_t end)
+{
+ _editor->verbose_cursor()->set_duration (
+ start, end,
+ _drags->current_pointer_x() + 10 - _editor->horizontal_position(),
+ _drags->current_pointer_y() + 10 - _editor->vertical_adjustment.get_value() + _editor->canvas_timebars_vsize
+ );
+
+ _editor->verbose_cursor()->show ();
+}
+
+void
+Drag::show_verbose_cursor_text (string const & text)
+{
+ _editor->verbose_cursor()->set (
+ text,
+ _drags->current_pointer_x() + 10 - _editor->horizontal_position(),
+ _drags->current_pointer_y() + 10 - _editor->vertical_adjustment.get_value() + _editor->canvas_timebars_vsize
+ );
+
+ _editor->verbose_cursor()->show ();
+}
+
+
struct EditorOrderTimeAxisViewSorter {
bool operator() (TimeAxisView* a, TimeAxisView* b) {
RouteTimeAxisView* ra = dynamic_cast<RouteTimeAxisView*> (a);
{
Drag::start_grab (event, cursor);
- _editor->show_verbose_time_cursor (_last_frame_position, 10);
+ show_verbose_cursor_time (_last_frame_position);
pair<TimeAxisView*, int> const tv = _editor->trackview_by_y_position (_drags->current_pointer_y ());
_last_pointer_time_axis_view = find_time_axis_view (tv.first);
/* Bail early if we're not over a track */
RouteTimeAxisView* rtv = dynamic_cast<RouteTimeAxisView*> (tv.first);
if (!rtv || !rtv->is_track()) {
- _editor->hide_verbose_canvas_cursor ();
+ _editor->verbose_cursor()->hide ();
return;
}
}
if (x_delta != 0 && !_brushing) {
- _editor->show_verbose_time_cursor (_last_frame_position, 10);
+ show_verbose_cursor_time (_last_frame_position);
}
_last_pointer_time_axis_view += delta_time_axis_view;
/* To make sure we hide the verbose canvas cursor when the mouse is
not held over and audiotrack.
*/
- _editor->hide_verbose_canvas_cursor ();
+ _editor->verbose_cursor()->hide ();
return;
}
switch (_operation) {
case StartTrim:
- _editor->show_verbose_time_cursor (region_start, 10);
+ show_verbose_cursor_time (region_start);
for (list<DraggingView>::iterator i = _views.begin(); i != _views.end(); ++i) {
i->view->trim_front_starting ();
}
break;
case EndTrim:
- _editor->show_verbose_time_cursor (region_end, 10);
+ show_verbose_cursor_time (region_end);
break;
case ContentsTrim:
- _editor->show_verbose_time_cursor (pf, 10);
+ show_verbose_cursor_time (pf);
break;
}
switch (_operation) {
case StartTrim:
- _editor->show_verbose_time_cursor ((framepos_t) (rv->region()->position() / speed), 10);
+ show_verbose_cursor_time ((framepos_t) (rv->region()->position() / speed));
break;
case EndTrim:
- _editor->show_verbose_time_cursor ((framepos_t) (rv->region()->last_frame() / speed), 10);
+ show_verbose_cursor_time ((framepos_t) (rv->region()->last_frame() / speed));
break;
case ContentsTrim:
- _editor->show_verbose_time_cursor (adjusted_current_frame (event), 10);
+ show_verbose_cursor_time (adjusted_current_frame (event));
break;
}
}
Drag::start_grab (event, cursor);
- _editor->show_verbose_time_cursor (adjusted_current_frame(event), 10);
+ show_verbose_cursor_time (adjusted_current_frame(event));
}
void
_marker->set_position (pf);
- _editor->show_verbose_time_cursor (pf, 10);
+ show_verbose_cursor_time (pf);
}
void
Drag::start_grab (event, cursor);
- _editor->show_verbose_time_cursor (adjusted_current_frame (event), 10);
+ show_verbose_cursor_time (adjusted_current_frame (event));
}
void
{
framepos_t const pf = adjusted_current_frame (event);
_marker->set_position (pf);
- _editor->show_verbose_time_cursor (pf, 10);
+ show_verbose_cursor_time (pf);
}
void
s->send_full_time_code (f);
}
- _editor->show_verbose_time_cursor (t, 10);
+ show_verbose_cursor_time (t);
_editor->UpdateAllTransportClocks (t);
}
AudioRegionView* arv = dynamic_cast<AudioRegionView*> (_primary);
boost::shared_ptr<AudioRegion> const r = arv->audio_region ();
- _editor->show_verbose_duration_cursor (r->position(), r->position() + r->fade_in()->back()->when, 10);
+ show_verbose_cursor_duration (r->position(), r->position() + r->fade_in()->back()->when);
arv->show_fade_line((framepos_t) r->fade_in()->back()->when);
}
tmp->show_fade_line((framecnt_t) fade_length);
}
- _editor->show_verbose_duration_cursor (region->position(), region->position() + fade_length, 10);
+ show_verbose_cursor_duration (region->position(), region->position() + fade_length);
}
void
AudioRegionView* arv = dynamic_cast<AudioRegionView*> (_primary);
boost::shared_ptr<AudioRegion> r = arv->audio_region ();
- _editor->show_verbose_duration_cursor (r->last_frame() - r->fade_out()->back()->when, r->last_frame(), 10);
+ show_verbose_cursor_duration (r->last_frame() - r->fade_out()->back()->when, r->last_frame());
arv->show_fade_line(r->length() - r->fade_out()->back()->when);
}
tmp->show_fade_line(region->length() - fade_length);
}
- _editor->show_verbose_duration_cursor (region->last_frame() - fade_length, region->last_frame(), 10);
+ show_verbose_cursor_duration (region->last_frame() - fade_length, region->last_frame());
}
void
// _line->raise_to_top();
if (is_start) {
- _editor->show_verbose_time_cursor (location->start(), 10);
+ show_verbose_cursor_time (location->start());
} else {
- _editor->show_verbose_time_cursor (location->end(), 10);
+ show_verbose_cursor_time (location->end());
}
Selection::Operation op = ArdourKeyboard::selection_type (event->button.state);
assert (!_copied_locations.empty());
- _editor->show_verbose_time_cursor (newframe, 10);
+ show_verbose_cursor_time (newframe);
#ifdef GTKOSX
_editor->update_canvas_now ();
_point->line().start_drag_single (_point, _fixed_grab_x, fraction);
- _editor->set_verbose_canvas_cursor (_point->line().get_verbose_cursor_string (fraction),
- event->button.x + 10, event->button.y + 10);
+ _editor->verbose_cursor()->set (_point->line().get_verbose_cursor_string (fraction),
+ event->button.x + 10, event->button.y + 10);
- _editor->show_verbose_canvas_cursor ();
+ _editor->verbose_cursor()->show ();
}
void
_point->line().drag_motion (_editor->frame_to_unit (cx_frames), fraction, false, push);
- _editor->set_verbose_canvas_cursor_text (_point->line().get_verbose_cursor_string (fraction));
+ _editor->verbose_cursor()->set_text (_point->line().get_verbose_cursor_string (fraction));
}
void
_line->start_drag_line (before, after, fraction);
- _editor->set_verbose_canvas_cursor (_line->get_verbose_cursor_string (fraction),
- event->button.x + 10, event->button.y + 10);
+ _editor->verbose_cursor()->set (_line->get_verbose_cursor_string (fraction),
+ event->button.x + 10, event->button.y + 10);
- _editor->show_verbose_canvas_cursor ();
+ _editor->verbose_cursor()->show ();
}
void
/* we are ignoring x position for this drag, so we can just pass in anything */
_line->drag_motion (0, fraction, true, push);
- _editor->set_verbose_canvas_cursor_text (_line->get_verbose_cursor_string (fraction));
+ _editor->verbose_cursor()->set_text (_line->get_verbose_cursor_string (fraction));
}
void
RubberbandSelectDrag::start_grab (GdkEvent* event, Gdk::Cursor *)
{
Drag::start_grab (event);
- _editor->show_verbose_time_cursor (adjusted_current_frame (event), 10);
+ show_verbose_cursor_time (adjusted_current_frame (event));
}
void
_editor->rubberband_rect->show();
_editor->rubberband_rect->raise_to_top();
- _editor->show_verbose_time_cursor (pf, 10);
+ show_verbose_cursor_time (pf);
}
}
{
Drag::start_grab (event, cursor);
- _editor->show_verbose_time_cursor (adjusted_current_frame (event), 10);
+ show_verbose_cursor_time (adjusted_current_frame (event));
}
void
rv->get_time_axis_view().show_timestretch (rv->region()->position(), pf);
}
- _editor->show_verbose_time_cursor (pf, 10);
+ show_verbose_cursor_time (pf);
}
void
}
if (_operation == SelectionMove) {
- _editor->show_verbose_time_cursor (_editor->selection->time[_editor->clicked_selection].start, 10);
+ show_verbose_cursor_time (_editor->selection->time[_editor->clicked_selection].start);
} else {
- _editor->show_verbose_time_cursor (adjusted_current_frame (event), 10);
+ show_verbose_cursor_time (adjusted_current_frame (event));
}
_original_pointer_time_axis = _editor->trackview_by_y_position (_drags->current_pointer_y ()).first->order ();
}
if (_operation == SelectionMove) {
- _editor->show_verbose_time_cursor(start, 10);
+ show_verbose_cursor_time(start);
} else {
- _editor->show_verbose_time_cursor(pending_position, 10);
+ show_verbose_cursor_time(pending_position);
}
}
Drag::start_grab (event, cursor);
- _editor->show_verbose_time_cursor (adjusted_current_frame (event), 10);
+ show_verbose_cursor_time (adjusted_current_frame (event));
}
void
update_item (_editor->temp_location);
}
- _editor->show_verbose_time_cursor (pf, 10);
+ show_verbose_cursor_time (pf);
}
_zoom_out = false;
}
- _editor->show_verbose_time_cursor (adjusted_current_frame (event), 10);
+ show_verbose_cursor_time (adjusted_current_frame (event));
}
void
_editor->reposition_zoom_rect(start, end);
- _editor->show_verbose_time_cursor (pf, 10);
+ show_verbose_cursor_time (pf);
}
}
snprintf (buf, sizeof (buf), "%s (%d)", Evoral::midi_note_name (_primary->note()->note() + note_delta).c_str(),
(int) floor (_primary->note()->note() + note_delta));
- _editor->show_verbose_canvas_cursor_with (buf);
+ show_verbose_cursor_text (buf);
}
}
return _last_pointer_frame;
}
+ void show_verbose_cursor_time (framepos_t);
+ void show_verbose_cursor_duration (framepos_t, framepos_t);
+ void show_verbose_cursor_text (std::string const &);
+
Editor* _editor; ///< our editor
DragManager* _drags;
ArdourCanvas::Item* _item; ///< our item
#include "edit_note_dialog.h"
#include "mouse_cursors.h"
#include "editor_cursors.h"
+#include "verbose_cursor.h"
#include "ardour/types.h"
#include "ardour/profile.h"
set_canvas_cursor (_cursors->fader);
}
- set_verbose_canvas_cursor (cp->line().get_verbose_cursor_string (fraction), at_x, at_y);
- show_verbose_canvas_cursor ();
+ _verbose_cursor->set (cp->line().get_verbose_cursor_string (fraction), at_x, at_y);
+ _verbose_cursor->show ();
}
break;
set_canvas_cursor (current_canvas_cursor);
}
- hide_verbose_canvas_cursor ();
+ _verbose_cursor->hide ();
break;
case RegionViewNameHighlight:
}
}
-void
-Editor::show_verbose_time_cursor (framepos_t frame, double offset, double xpos, double ypos)
-{
- char buf[128];
- Timecode::Time timecode;
- Timecode::BBT_Time bbt;
- int hours, mins;
- framepos_t frame_rate;
- float secs;
-
- if (_session == 0) {
- return;
- }
-
- AudioClock::Mode m;
-
- if (Profile->get_sae() || Profile->get_small_screen()) {
- m = ARDOUR_UI::instance()->primary_clock.mode();
- } else {
- m = ARDOUR_UI::instance()->secondary_clock.mode();
- }
-
- switch (m) {
- case AudioClock::BBT:
- _session->bbt_time (frame, bbt);
- snprintf (buf, sizeof (buf), "%02" PRIu32 "|%02" PRIu32 "|%02" PRIu32, bbt.bars, bbt.beats, bbt.ticks);
- break;
-
- case AudioClock::Timecode:
- _session->timecode_time (frame, timecode);
- snprintf (buf, sizeof (buf), "%02" PRId32 ":%02" PRId32 ":%02" PRId32 ":%02" PRId32, timecode.hours, timecode.minutes, timecode.seconds, timecode.frames);
- break;
-
- case AudioClock::MinSec:
- /* XXX this is copied from show_verbose_duration_cursor() */
- frame_rate = _session->frame_rate();
- hours = frame / (frame_rate * 3600);
- frame = frame % (frame_rate * 3600);
- mins = frame / (frame_rate * 60);
- frame = frame % (frame_rate * 60);
- secs = (float) frame / (float) frame_rate;
- snprintf (buf, sizeof (buf), "%02" PRId32 ":%02" PRId32 ":%07.4f", hours, mins, secs);
- break;
-
- default:
- snprintf (buf, sizeof(buf), "%" PRIi64, frame);
- break;
- }
-
- if (xpos >= 0 && ypos >=0) {
- set_verbose_canvas_cursor (buf, xpos + offset, ypos + offset);
- } else {
- set_verbose_canvas_cursor (buf, _drags->current_pointer_x() + offset - horizontal_position(), _drags->current_pointer_y() + offset - vertical_adjustment.get_value() + canvas_timebars_vsize);
- }
- show_verbose_canvas_cursor ();
-}
-
-void
-Editor::show_verbose_duration_cursor (framepos_t start, framepos_t end, double offset, double xpos, double ypos)
-{
- char buf[128];
- Timecode::Time timecode;
- Timecode::BBT_Time sbbt;
- Timecode::BBT_Time ebbt;
- int hours, mins;
- framepos_t distance, frame_rate;
- float secs;
- Meter meter_at_start(_session->tempo_map().meter_at(start));
-
- if (_session == 0) {
- return;
- }
-
- AudioClock::Mode m;
-
- if (Profile->get_sae() || Profile->get_small_screen()) {
- m = ARDOUR_UI::instance()->primary_clock.mode ();
- } else {
- m = ARDOUR_UI::instance()->secondary_clock.mode ();
- }
-
- switch (m) {
- case AudioClock::BBT:
- {
- _session->bbt_time (start, sbbt);
- _session->bbt_time (end, ebbt);
-
- /* subtract */
- /* XXX this computation won't work well if the
- user makes a selection that spans any meter changes.
- */
-
- /* use signed integers for the working values so that
- we can underflow.
- */
-
- int ticks = ebbt.ticks;
- int beats = ebbt.beats;
- int bars = ebbt.bars;
-
- ticks -= sbbt.ticks;
- if (ticks < 0) {
- ticks += int (Timecode::BBT_Time::ticks_per_beat);
- --beats;
- }
-
- beats -= sbbt.beats;
- if (beats < 0) {
- beats += int (meter_at_start.beats_per_bar());
- --bars;
- }
-
- bars -= sbbt.bars;
-
- snprintf (buf, sizeof (buf), "%02" PRIu32 "|%02" PRIu32 "|%02" PRIu32, bars, beats, ticks);
- break;
- }
-
- case AudioClock::Timecode:
- _session->timecode_duration (end - start, timecode);
- snprintf (buf, sizeof (buf), "%02" PRId32 ":%02" PRId32 ":%02" PRId32 ":%02" PRId32, timecode.hours, timecode.minutes, timecode.seconds, timecode.frames);
- break;
-
- case AudioClock::MinSec:
- /* XXX this stuff should be elsewhere.. */
- distance = end - start;
- frame_rate = _session->frame_rate();
- hours = distance / (frame_rate * 3600);
- distance = distance % (frame_rate * 3600);
- mins = distance / (frame_rate * 60);
- distance = distance % (frame_rate * 60);
- secs = (float) distance / (float) frame_rate;
- snprintf (buf, sizeof (buf), "%02" PRId32 ":%02" PRId32 ":%07.4f", hours, mins, secs);
- break;
-
- default:
- snprintf (buf, sizeof(buf), "%" PRIi64, end - start);
- break;
- }
-
- if (xpos >= 0 && ypos >=0) {
- set_verbose_canvas_cursor (buf, xpos + offset, ypos + offset);
- }
- else {
- set_verbose_canvas_cursor (buf, _drags->current_pointer_x() + offset, _drags->current_pointer_y() + offset);
- }
-
- show_verbose_canvas_cursor ();
-}
-
void
Editor::collect_new_region_view (RegionView* rv)
{
}
}
}
+
+/** Obtain the pointer position in world coordinates */
+void
+Editor::get_pointer_position (double& x, double& y) const
+{
+ int px, py;
+ track_canvas->get_pointer (px, py);
+ track_canvas->window_to_world (px, py, x, y);
+}
#include "utils.h"
#include "mouse_cursors.h"
#include "patch_change_dialog.h"
+#include "verbose_cursor.h"
#include "i18n.h"
{
_mouse_mode_connection.disconnect ();
- trackview.editor().hide_verbose_canvas_cursor ();
+ trackview.editor().verbose_cursor()->hide ();
remove_ghost_note ();
return false;
}
create_ghost_note (_last_event_x, _last_event_y);
} else {
remove_ghost_note ();
- trackview.editor().hide_verbose_canvas_cursor ();
+ trackview.editor().verbose_cursor()->hide ();
}
}
delete _ghost_note;
_ghost_note = 0;
- trackview.editor().hide_verbose_canvas_cursor ();
+ trackview.editor().verbose_cursor()->hide ();
}
else if (_ghost_note && trackview.editor().current_mouse_mode() == MouseRange) {
update_ghost_note (ev->x, ev->y);
delete _ghost_note;
_ghost_note = 0;
- trackview.editor().hide_verbose_canvas_cursor ();
+ trackview.editor().verbose_cursor()->hide ();
}
return true;
return false;
}
- trackview.editor().hide_verbose_canvas_cursor ();
+ trackview.editor().verbose_cursor()->hide ();
bool fine = !Keyboard::modifier_state_equals (ev->state, Keyboard::SecondaryModifier);
{
in_destructor = true;
- trackview.editor().hide_verbose_canvas_cursor ();
+ trackview.editor().verbose_cursor()->hide ();
note_delete_connection.disconnect ();
_note_diff_command->remove (n);
apply_diff ();
- trackview.editor().hide_verbose_canvas_cursor ();
+ trackview.editor().verbose_cursor()->hide ();
}
void
char buf[16];
snprintf (buf, sizeof (buf), "%.3g beats", len);
- trackview.editor().show_verbose_canvas_cursor_with (buf);
+ show_verbose_cursor (buf, 0, 0);
cursor_set = true;
}
char buf[24];
snprintf (buf, sizeof (buf), "Vel %d",
(int) (*_selection.begin())->note()->velocity());
- trackview.editor().show_verbose_canvas_cursor_with (buf, 10, 10);
+ show_verbose_cursor (buf, 10, 10);
}
}
note_selected (ev, true);
}
- show_verbose_canvas_cursor (ev->note ());
+ show_verbose_cursor (ev->note ());
}
void
(*i)->hide_velocity ();
}
- editor->hide_verbose_canvas_cursor ();
+ editor->verbose_cursor()->hide ();
if (pre_enter_cursor) {
editor->set_canvas_cursor (pre_enter_cursor);
{
ostringstream s;
s << ((int) ev->patch()->program() + 1) << ":" << (ev->patch()->bank() + 1);
- trackview.editor().show_verbose_canvas_cursor_with (s.str().c_str(), 10, 20);
+ show_verbose_cursor (s.str(), 10, 20);
}
void
MidiRegionView::patch_left (ArdourCanvas::CanvasPatchChange *)
{
- trackview.editor().hide_verbose_canvas_cursor ();
+ trackview.editor().verbose_cursor()->hide ();
}
void
/* the ghost note does not appear in ghost regions, so pass false in here */
update_note (_ghost_note, false);
- show_verbose_canvas_cursor (_ghost_note->note ());
+ show_verbose_cursor (_ghost_note->note ());
}
void
_last_ghost_x = x;
_last_ghost_y = y;
- show_verbose_canvas_cursor (_ghost_note->note ());
+ show_verbose_cursor (_ghost_note->note ());
}
void
create_ghost_note (_last_ghost_x, _last_ghost_y);
}
-void
-MidiRegionView::show_verbose_canvas_cursor (boost::shared_ptr<NoteType> n) const
-{
- char buf[24];
- snprintf (buf, sizeof (buf), "%s (%d) Chn %d\nVel %d",
- Evoral::midi_note_name (n->note()).c_str(),
- (int) n->note (),
- (int) n->channel() + 1,
- (int) n->velocity());
- trackview.editor().show_verbose_canvas_cursor_with (buf, 10, 20);
-}
-
void
MidiRegionView::drop_down_keys ()
{
change_patch_change (pc->patch(), d.patch ());
}
+
+
+void
+MidiRegionView::show_verbose_cursor (boost::shared_ptr<NoteType> n) const
+{
+ char buf[24];
+ snprintf (buf, sizeof (buf), "%s (%d) Chn %d\nVel %d",
+ Evoral::midi_note_name (n->note()).c_str(),
+ (int) n->note (),
+ (int) n->channel() + 1,
+ (int) n->velocity());
+
+ show_verbose_cursor (buf, 10, 20);
+}
+
+void
+MidiRegionView::show_verbose_cursor (string const & text, double xoffset, double yoffset) const
+{
+ double wx, wy;
+
+ trackview.editor().get_pointer_position (wx, wy);
+
+ wx += xoffset;
+ wy += yoffset;
+
+ trackview.editor().verbose_cursor()->set (text, wx, wy);
+ trackview.editor().verbose_cursor()->show ();
+}
uint8_t get_channel_for_add () const;
+ void show_verbose_cursor (std::string const &, double, double) const;
+ void show_verbose_cursor (boost::shared_ptr<NoteType>) const;
+
int8_t _force_channel;
uint16_t _last_channel_selection;
uint8_t _current_range_min;
void snap_changed ();
PBD::ScopedConnection snap_changed_connection;
- void show_verbose_canvas_cursor (boost::shared_ptr<NoteType>) const;
-
bool motion (GdkEventMotion*);
bool scroll (GdkEventScroll*);
bool key_press (GdkEventKey*);
class MarkerView;
class DragManager;
class MouseCursors;
+class VerboseCursor;
using ARDOUR::framepos_t;
using ARDOUR::framecnt_t;
virtual TimeAxisView* axis_view_from_route (boost::shared_ptr<ARDOUR::Route>) const = 0;
- virtual void show_verbose_canvas_cursor_with (const std::string& txt, int32_t xoffset = 0, int32_t yoffset = 0) = 0;
- virtual void hide_verbose_canvas_cursor() = 0;
-
virtual void set_current_trimmable (boost::shared_ptr<ARDOUR::Trimmable>) = 0;
virtual void set_current_movable (boost::shared_ptr<ARDOUR::Movable>) = 0;
virtual void stop_canvas_autoscroll () = 0;
virtual MouseCursors const * cursors () const = 0;
+ virtual VerboseCursor * verbose_cursor () const = 0;
+ virtual void get_pointer_position (double &, double &) const = 0;
+
/// Singleton instance, set up by Editor::Editor()
static PublicEditor* _instance;
--- /dev/null
+/*
+ Copyright (C) 2000-2011 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 <string>
+#include <gtkmm/enums.h>
+#include "ardour/profile.h"
+#include "editor.h"
+#include "ardour_ui.h"
+#include "verbose_cursor.h"
+#include "utils.h"
+#include "editor_drag.h"
+
+#include "i18n.h"
+
+using namespace std;
+using namespace ARDOUR;
+
+VerboseCursor::VerboseCursor (Editor* editor)
+ : _editor (editor)
+ , _visible (false)
+{
+ Pango::FontDescription* font = get_font_for_style (N_("VerboseCanvasCursor"));
+
+ _canvas_item = new ArdourCanvas::NoEventText (*_editor->track_canvas->root());
+ _canvas_item->property_font_desc() = *font;
+ _canvas_item->property_anchor() = Gtk::ANCHOR_NW;
+
+ delete font;
+}
+
+ArdourCanvas::Item *
+VerboseCursor::canvas_item () const
+{
+ return _canvas_item;
+}
+
+void
+VerboseCursor::set (string const & text, double x, double y)
+{
+ set_text (text);
+ set_position (x, y);
+}
+
+void
+VerboseCursor::set_text (string const & text)
+{
+ _canvas_item->property_text() = text.c_str();
+}
+
+void
+VerboseCursor::show ()
+{
+ _canvas_item->raise_to_top ();
+ _canvas_item->show ();
+ _visible = true;
+}
+
+void
+VerboseCursor::hide ()
+{
+ _canvas_item->hide ();
+ _visible = false;
+}
+
+double
+VerboseCursor::clamp_x (double x)
+{
+ if (x < 0) {
+ x = 0;
+ } else {
+ x = min (_editor->_canvas_width - 200.0, x);
+ }
+ return x;
+}
+
+double
+VerboseCursor::clamp_y (double y)
+{
+ if (y < _editor->canvas_timebars_vsize) {
+ y = _editor->canvas_timebars_vsize;
+ } else {
+ y = min (_editor->_canvas_height - 50, y);
+ }
+ return y;
+}
+
+void
+VerboseCursor::set_time (framepos_t frame, double x, double y)
+{
+ char buf[128];
+ Timecode::Time timecode;
+ Timecode::BBT_Time bbt;
+ int hours, mins;
+ framepos_t frame_rate;
+ float secs;
+
+ if (_editor->_session == 0) {
+ return;
+ }
+
+ AudioClock::Mode m;
+
+ if (Profile->get_sae() || Profile->get_small_screen()) {
+ m = ARDOUR_UI::instance()->primary_clock.mode();
+ } else {
+ m = ARDOUR_UI::instance()->secondary_clock.mode();
+ }
+
+ switch (m) {
+ case AudioClock::BBT:
+ _editor->_session->bbt_time (frame, bbt);
+ snprintf (buf, sizeof (buf), "%02" PRIu32 "|%02" PRIu32 "|%02" PRIu32, bbt.bars, bbt.beats, bbt.ticks);
+ break;
+
+ case AudioClock::Timecode:
+ _editor->_session->timecode_time (frame, timecode);
+ snprintf (buf, sizeof (buf), "%02" PRId32 ":%02" PRId32 ":%02" PRId32 ":%02" PRId32, timecode.hours, timecode.minutes, timecode.seconds, timecode.frames);
+ break;
+
+ case AudioClock::MinSec:
+ /* XXX this is copied from show_verbose_duration_cursor() */
+ frame_rate = _editor->_session->frame_rate();
+ hours = frame / (frame_rate * 3600);
+ frame = frame % (frame_rate * 3600);
+ mins = frame / (frame_rate * 60);
+ frame = frame % (frame_rate * 60);
+ secs = (float) frame / (float) frame_rate;
+ snprintf (buf, sizeof (buf), "%02" PRId32 ":%02" PRId32 ":%07.4f", hours, mins, secs);
+ break;
+
+ default:
+ snprintf (buf, sizeof(buf), "%" PRIi64, frame);
+ break;
+ }
+
+ set (buf, x, y);
+}
+
+void
+VerboseCursor::set_duration (framepos_t start, framepos_t end, double x, double y)
+{
+ char buf[128];
+ Timecode::Time timecode;
+ Timecode::BBT_Time sbbt;
+ Timecode::BBT_Time ebbt;
+ int hours, mins;
+ framepos_t distance, frame_rate;
+ float secs;
+ Meter meter_at_start (_editor->_session->tempo_map().meter_at(start));
+
+ if (_editor->_session == 0) {
+ return;
+ }
+
+ AudioClock::Mode m;
+
+ if (Profile->get_sae() || Profile->get_small_screen()) {
+ m = ARDOUR_UI::instance()->primary_clock.mode ();
+ } else {
+ m = ARDOUR_UI::instance()->secondary_clock.mode ();
+ }
+
+ switch (m) {
+ case AudioClock::BBT:
+ {
+ _editor->_session->bbt_time (start, sbbt);
+ _editor->_session->bbt_time (end, ebbt);
+
+ /* subtract */
+ /* XXX this computation won't work well if the
+ user makes a selection that spans any meter changes.
+ */
+
+ /* use signed integers for the working values so that
+ we can underflow.
+ */
+
+ int ticks = ebbt.ticks;
+ int beats = ebbt.beats;
+ int bars = ebbt.bars;
+
+ ticks -= sbbt.ticks;
+ if (ticks < 0) {
+ ticks += int (Timecode::BBT_Time::ticks_per_beat);
+ --beats;
+ }
+
+ beats -= sbbt.beats;
+ if (beats < 0) {
+ beats += int (meter_at_start.beats_per_bar());
+ --bars;
+ }
+
+ bars -= sbbt.bars;
+
+ snprintf (buf, sizeof (buf), "%02" PRIu32 "|%02" PRIu32 "|%02" PRIu32, bars, beats, ticks);
+ break;
+ }
+
+ case AudioClock::Timecode:
+ _editor->_session->timecode_duration (end - start, timecode);
+ snprintf (buf, sizeof (buf), "%02" PRId32 ":%02" PRId32 ":%02" PRId32 ":%02" PRId32, timecode.hours, timecode.minutes, timecode.seconds, timecode.frames);
+ break;
+
+ case AudioClock::MinSec:
+ /* XXX this stuff should be elsewhere.. */
+ distance = end - start;
+ frame_rate = _editor->_session->frame_rate();
+ hours = distance / (frame_rate * 3600);
+ distance = distance % (frame_rate * 3600);
+ mins = distance / (frame_rate * 60);
+ distance = distance % (frame_rate * 60);
+ secs = (float) distance / (float) frame_rate;
+ snprintf (buf, sizeof (buf), "%02" PRId32 ":%02" PRId32 ":%07.4f", hours, mins, secs);
+ break;
+
+ default:
+ snprintf (buf, sizeof(buf), "%" PRIi64, end - start);
+ break;
+ }
+
+ set (buf, x, y);
+}
+
+void
+VerboseCursor::set_color (uint32_t color)
+{
+ _canvas_item->property_fill_color_rgba() = color;
+}
+
+void
+VerboseCursor::set_position (double x, double y)
+{
+ _canvas_item->property_x() = clamp_x (x);
+ _canvas_item->property_y() = clamp_y (y);
+}
+
+bool
+VerboseCursor::visible () const
+{
+ return _visible;
+}
--- /dev/null
+/*
+ Copyright (C) 2000-2011 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 <libgnomecanvasmm/item.h>
+#include "ardour/types.h"
+#include "canvas-noevent-text.h"
+#include "canvas.h"
+
+class Editor;
+
+class VerboseCursor
+{
+public:
+ VerboseCursor (Editor *);
+
+ ArdourCanvas::Item* canvas_item () const;
+ bool visible () const;
+
+ void set_color (uint32_t);
+
+ void set (std::string const &, double, double);
+ void set_text (std::string const &);
+ void set_position (double, double);
+ void set_time (framepos_t, double, double);
+ void set_duration (framepos_t, framepos_t, double, double);
+
+ void show ();
+ void hide ();
+
+private:
+ double clamp_x (double);
+ double clamp_y (double);
+
+ Editor* _editor;
+ ArdourCanvas::NoEventText* _canvas_item;
+ bool _visible;
+};
'transpose_dialog.cc',
'ui_config.cc',
'utils.cc',
+ 'verbose_cursor.cc',
'version.cc',
'volume_controller.cc',
'waveview.cc',