vari-size rect as step-edit cursor
git-svn-id: svn://localhost/ardour2/branches/3.0@7599 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
5182f0770c
commit
afd5b2002a
@ -23,7 +23,6 @@
|
||||
#include <ostream>
|
||||
|
||||
#include <gtkmm.h>
|
||||
#include <libgnomecanvasmm/pixbuf.h>
|
||||
|
||||
#include <gtkmm2ext/gtk_ui.h>
|
||||
|
||||
@ -61,6 +60,7 @@
|
||||
#include "midi_time_axis.h"
|
||||
#include "midi_util.h"
|
||||
#include "public_editor.h"
|
||||
#include "rgb_macros.h"
|
||||
#include "selection.h"
|
||||
#include "simpleline.h"
|
||||
#include "streamview.h"
|
||||
@ -89,6 +89,7 @@ MidiRegionView::MidiRegionView (ArdourCanvas::Group *parent, RouteTimeAxisView &
|
||||
, _ghost_note(0)
|
||||
, _drag_rect (0)
|
||||
, _step_edit_cursor (0)
|
||||
, _step_edit_cursor_width (1.0)
|
||||
, _mouse_state(None)
|
||||
, _pressed_button(0)
|
||||
, _sort_needed (true)
|
||||
@ -1152,6 +1153,10 @@ MidiRegionView::set_height (double height)
|
||||
for (PgmChanges::iterator x = _pgm_changes.begin(); x != _pgm_changes.end(); ++x) {
|
||||
(*x)->set_height (midi_stream_view()->contents_height());
|
||||
}
|
||||
|
||||
if (_step_edit_cursor) {
|
||||
_step_edit_cursor->property_y2() = midi_stream_view()->contents_height();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -2983,9 +2988,11 @@ MidiRegionView::show_step_edit_cursor (Evoral::MusicalTime pos)
|
||||
if (_step_edit_cursor == 0) {
|
||||
ArdourCanvas::Group* const group = (ArdourCanvas::Group*)get_canvas_group();
|
||||
|
||||
_step_edit_cursor = new ArdourCanvas::Pixbuf (*group);
|
||||
_step_edit_cursor->property_y() = 0;
|
||||
_step_edit_cursor->property_pixbuf() = ::get_icon ("wholenote");
|
||||
_step_edit_cursor = new ArdourCanvas::SimpleRect (*group);
|
||||
_step_edit_cursor->property_y1() = 0;
|
||||
_step_edit_cursor->property_y2() = midi_stream_view()->contents_height();
|
||||
_step_edit_cursor->property_fill_color_rgba() = RGBA_TO_UINT (45,45,45,90);
|
||||
_step_edit_cursor->property_outline_color_rgba() = RGBA_TO_UINT (255,255,255,90);
|
||||
}
|
||||
|
||||
move_step_edit_cursor (pos);
|
||||
@ -2997,13 +3004,8 @@ MidiRegionView::move_step_edit_cursor (Evoral::MusicalTime pos)
|
||||
{
|
||||
if (_step_edit_cursor) {
|
||||
double pixel = trackview.editor().frame_to_pixel (beats_to_frames (pos));
|
||||
Glib::RefPtr<Gdk::Pixbuf> pb = _step_edit_cursor->property_pixbuf();
|
||||
|
||||
if (pixel >= (pb->get_width()/2.0)) {
|
||||
pixel -= pb->get_width()/2.0;
|
||||
}
|
||||
|
||||
_step_edit_cursor->property_x() = pixel;
|
||||
_step_edit_cursor->property_x1() = pixel;
|
||||
_step_edit_cursor->property_x2() = pixel + _step_edit_cursor_width;
|
||||
}
|
||||
}
|
||||
|
||||
@ -3014,3 +3016,11 @@ MidiRegionView::hide_step_edit_cursor ()
|
||||
_step_edit_cursor->hide ();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
MidiRegionView::set_step_edit_cursor_width (Evoral::MusicalTime beats)
|
||||
{
|
||||
_step_edit_cursor_width = trackview.editor().frame_to_pixel (beats_to_frames (beats));
|
||||
_step_edit_cursor->property_x2() = _step_edit_cursor->property_x1() + _step_edit_cursor_width;
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (C) 2001-2007 Paul Davis
|
||||
Copyright (C) 2001-2010 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
|
||||
@ -46,12 +46,6 @@
|
||||
#include "canvas-program-change.h"
|
||||
#include "canvas-sysex.h"
|
||||
|
||||
namespace Gnome {
|
||||
namespace Canvas {
|
||||
class Pixbuf;
|
||||
}
|
||||
};
|
||||
|
||||
namespace ARDOUR {
|
||||
class MidiRegion;
|
||||
class MidiModel;
|
||||
@ -113,6 +107,7 @@ class MidiRegionView : public RegionView
|
||||
void show_step_edit_cursor (Evoral::MusicalTime pos);
|
||||
void move_step_edit_cursor (Evoral::MusicalTime pos);
|
||||
void hide_step_edit_cursor ();
|
||||
void set_step_edit_cursor_width (Evoral::MusicalTime beats);
|
||||
|
||||
void redisplay_model();
|
||||
|
||||
@ -373,8 +368,9 @@ class MidiRegionView : public RegionView
|
||||
double _last_x;
|
||||
double _last_y;
|
||||
ArdourCanvas::SimpleRect* _drag_rect;
|
||||
ArdourCanvas::Pixbuf* _step_edit_cursor;
|
||||
|
||||
ArdourCanvas::SimpleRect* _step_edit_cursor;
|
||||
double _step_edit_cursor_width;
|
||||
|
||||
MouseState _mouse_state;
|
||||
int _pressed_button;
|
||||
|
||||
|
@ -912,15 +912,16 @@ MidiTimeAxisView::start_step_editing ()
|
||||
step_edit_region_view = dynamic_cast<MidiRegionView*>(rv);
|
||||
}
|
||||
|
||||
if (step_edit_region_view) {
|
||||
step_edit_region_view->show_step_edit_cursor (0.0);
|
||||
}
|
||||
|
||||
if (step_editor == 0) {
|
||||
step_editor = new StepEntry (*this);
|
||||
step_editor->signal_delete_event().connect (sigc::mem_fun (*this, &MidiTimeAxisView::step_editor_hidden));
|
||||
}
|
||||
|
||||
if (step_edit_region_view) {
|
||||
step_edit_region_view->show_step_edit_cursor (0.0);
|
||||
step_edit_region_view->set_step_edit_cursor_width (step_editor->note_length());
|
||||
}
|
||||
|
||||
step_editor->set_position (WIN_POS_MOUSE);
|
||||
step_editor->present ();
|
||||
}
|
||||
@ -1048,6 +1049,14 @@ MidiTimeAxisView::step_add_note (uint8_t channel, uint8_t pitch, uint8_t velocit
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
MidiTimeAxisView::set_step_edit_cursor_width (Evoral::MusicalTime beats)
|
||||
{
|
||||
if (step_edit_region_view) {
|
||||
step_edit_region_view->set_step_edit_cursor_width (beats);
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
MidiTimeAxisView::step_edit_within_triplet() const
|
||||
{
|
||||
|
@ -99,7 +99,8 @@ class MidiTimeAxisView : public RouteTimeAxisView
|
||||
void step_edit_toggle_triplet ();
|
||||
bool step_edit_within_chord () const;
|
||||
void step_edit_toggle_chord ();
|
||||
|
||||
void set_step_edit_cursor_width (Evoral::MusicalTime beats);
|
||||
|
||||
const MidiMultipleChannelSelector& channel_selector() { return _channel_selector; }
|
||||
|
||||
Gtk::CheckMenuItem* automation_child_menu_item (Evoral::Parameter);
|
||||
|
@ -805,6 +805,8 @@ StepEntry::length_value_change ()
|
||||
length_16_button.set_inconsistent (inconsistent);
|
||||
length_32_button.set_inconsistent (inconsistent);
|
||||
length_64_button.set_inconsistent (inconsistent);
|
||||
|
||||
_mtv->set_step_edit_cursor_width (note_length());
|
||||
}
|
||||
|
||||
bool
|
||||
|
Loading…
Reference in New Issue
Block a user