Updating zoom mouse cursor on modifier press. Fixes #274.
git-svn-id: svn://localhost/ardour2/branches/3.0@7820 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
a017411dfa
commit
3aa1f21475
|
@ -220,7 +220,8 @@ Gdk::Cursor* Editor::fade_out_cursor = 0;
|
|||
Gdk::Cursor* Editor::grabber_cursor = 0;
|
||||
Gdk::Cursor* Editor::grabber_note_cursor = 0;
|
||||
Gdk::Cursor* Editor::grabber_edit_point_cursor = 0;
|
||||
Gdk::Cursor* Editor::zoom_cursor = 0;
|
||||
Gdk::Cursor* Editor::zoom_in_cursor = 0;
|
||||
Gdk::Cursor* Editor::zoom_out_cursor = 0;
|
||||
Gdk::Cursor* Editor::time_fx_cursor = 0;
|
||||
Gdk::Cursor* Editor::fader_cursor = 0;
|
||||
Gdk::Cursor* Editor::speaker_cursor = 0;
|
||||
|
@ -1195,16 +1196,16 @@ Editor::build_cursors ()
|
|||
{
|
||||
using namespace Gdk;
|
||||
|
||||
Gdk::Color mbg ("#000000" ); /* Black */
|
||||
Gdk::Color mfg ("#0000ff" ); /* Blue. */
|
||||
|
||||
{
|
||||
RefPtr<Bitmap> source, mask;
|
||||
source = Bitmap::create (mag_bits, mag_width, mag_height);
|
||||
mask = Bitmap::create (magmask_bits, mag_width, mag_height);
|
||||
zoom_cursor = new Gdk::Cursor (source, mask, mfg, mbg, mag_x_hot, mag_y_hot);
|
||||
Glib::RefPtr<Gdk::Pixbuf> zoom_in_cursor_pixbuf (::get_icon ("zoom_in_cursor"));
|
||||
zoom_in_cursor = new Gdk::Cursor (Gdk::Display::get_default(), zoom_in_cursor_pixbuf, 5, 5);
|
||||
}
|
||||
|
||||
{
|
||||
Glib::RefPtr<Gdk::Pixbuf> zoom_out_cursor_pixbuf (::get_icon ("zoom_out_cursor"));
|
||||
zoom_out_cursor = new Gdk::Cursor (Gdk::Display::get_default(), zoom_out_cursor_pixbuf, 5, 5);
|
||||
}
|
||||
|
||||
Gdk::Color fbg ("#ffffff" );
|
||||
Gdk::Color ffg ("#000000" );
|
||||
|
||||
|
|
|
@ -462,7 +462,8 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
|
|||
static Gdk::Cursor* grabber_cursor;
|
||||
static Gdk::Cursor* grabber_note_cursor;
|
||||
static Gdk::Cursor* grabber_edit_point_cursor;
|
||||
static Gdk::Cursor* zoom_cursor;
|
||||
static Gdk::Cursor* zoom_in_cursor;
|
||||
static Gdk::Cursor* zoom_out_cursor;
|
||||
static Gdk::Cursor* time_fx_cursor;
|
||||
static Gdk::Cursor* fader_cursor;
|
||||
static Gdk::Cursor* speaker_cursor;
|
||||
|
@ -1408,6 +1409,8 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
|
|||
void track_canvas_allocate (Gtk::Allocation alloc);
|
||||
bool track_canvas_size_allocated ();
|
||||
bool track_canvas_drag_motion (Glib::RefPtr<Gdk::DragContext> const &, int, int, guint);
|
||||
bool track_canvas_key_press (GdkEventKey *);
|
||||
bool track_canvas_key_release (GdkEventKey *);
|
||||
|
||||
void set_playhead_cursor ();
|
||||
|
||||
|
|
|
@ -46,6 +46,7 @@
|
|||
#include "editor_group_tabs.h"
|
||||
#include "editor_routes.h"
|
||||
#include "editor_summary.h"
|
||||
#include "keyboard.h"
|
||||
|
||||
#include "i18n.h"
|
||||
|
||||
|
@ -282,9 +283,11 @@ Editor::initialize_canvas ()
|
|||
track_canvas->signal_button_press_event().connect (sigc::mem_fun (*this, &Editor::track_canvas_button_press_event));
|
||||
track_canvas->signal_button_release_event().connect (sigc::mem_fun (*this, &Editor::track_canvas_button_release_event));
|
||||
track_canvas->signal_drag_motion().connect (sigc::mem_fun (*this, &Editor::track_canvas_drag_motion));
|
||||
track_canvas->signal_key_press_event().connect (sigc::mem_fun (*this, &Editor::track_canvas_key_press));
|
||||
track_canvas->signal_key_release_event().connect (sigc::mem_fun (*this, &Editor::track_canvas_key_release));
|
||||
|
||||
track_canvas->set_name ("EditorMainCanvas");
|
||||
track_canvas->add_events (Gdk::POINTER_MOTION_HINT_MASK|Gdk::SCROLL_MASK);
|
||||
track_canvas->add_events (Gdk::POINTER_MOTION_HINT_MASK | Gdk::SCROLL_MASK | Gdk::KEY_PRESS_MASK | Gdk::KEY_RELEASE_MASK);
|
||||
track_canvas->signal_leave_notify_event().connect (sigc::mem_fun(*this, &Editor::left_track_canvas));
|
||||
track_canvas->signal_enter_notify_event().connect (sigc::mem_fun(*this, &Editor::entered_track_canvas));
|
||||
track_canvas->set_flags (CAN_FOCUS);
|
||||
|
@ -914,3 +917,24 @@ Editor::horizontal_position () const
|
|||
{
|
||||
return frame_to_unit (leftmost_frame);
|
||||
}
|
||||
|
||||
bool
|
||||
Editor::track_canvas_key_press (GdkEventKey* event)
|
||||
{
|
||||
/* XXX: event does not report the modifier key pressed down, AFAICS, so use the Keyboard object instead */
|
||||
if (mouse_mode == Editing::MouseZoom && Keyboard::the_keyboard().key_is_down (GDK_Control_L)) {
|
||||
track_canvas->get_window()->set_cursor (*zoom_out_cursor);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
Editor::track_canvas_key_release (GdkEventKey* event)
|
||||
{
|
||||
if (mouse_mode == Editing::MouseZoom && !Keyboard::the_keyboard().key_is_down (GDK_Control_L)) {
|
||||
track_canvas->get_window()->set_cursor (*zoom_in_cursor);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -294,7 +294,7 @@ Editor::canvas_stream_view_event (GdkEvent *event, ArdourCanvas::Item* item, Rou
|
|||
case GDK_LEAVE_NOTIFY:
|
||||
set_entered_track (0);
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -3561,6 +3561,7 @@ RangeMarkerBarDrag::update_item (Location* location)
|
|||
|
||||
MouseZoomDrag::MouseZoomDrag (Editor* e, ArdourCanvas::Item* i)
|
||||
: Drag (e, i)
|
||||
, _zoom_out (false)
|
||||
{
|
||||
DEBUG_TRACE (DEBUG::Drags, "New MouseZoomDrag\n");
|
||||
}
|
||||
|
@ -3568,7 +3569,14 @@ MouseZoomDrag::MouseZoomDrag (Editor* e, ArdourCanvas::Item* i)
|
|||
void
|
||||
MouseZoomDrag::start_grab (GdkEvent* event, Gdk::Cursor *)
|
||||
{
|
||||
Drag::start_grab (event, _editor->zoom_cursor);
|
||||
if (Keyboard::the_keyboard().key_is_down (GDK_Control_L)) {
|
||||
Drag::start_grab (event, _editor->zoom_out_cursor);
|
||||
_zoom_out = true;
|
||||
} else {
|
||||
Drag::start_grab (event, _editor->zoom_in_cursor);
|
||||
_zoom_out = false;
|
||||
}
|
||||
|
||||
_editor->show_verbose_time_cursor (adjusted_current_frame (event), 10);
|
||||
}
|
||||
|
||||
|
@ -3617,11 +3625,7 @@ MouseZoomDrag::finished (GdkEvent* event, bool movement_occurred)
|
|||
_editor->temporal_zoom_by_frame (last_pointer_frame(), grab_frame(), "mouse zoom");
|
||||
}
|
||||
} else {
|
||||
_editor->temporal_zoom_to_frame (false, grab_frame());
|
||||
/*
|
||||
temporal_zoom_step (false);
|
||||
center_screen (grab_frame());
|
||||
*/
|
||||
_editor->temporal_zoom_to_frame (_zoom_out, grab_frame());
|
||||
}
|
||||
|
||||
_editor->zoom_rect->hide();
|
||||
|
|
|
@ -807,6 +807,9 @@ public:
|
|||
void motion (GdkEvent *, bool);
|
||||
void finished (GdkEvent *, bool);
|
||||
void aborted ();
|
||||
|
||||
private:
|
||||
bool _zoom_out;
|
||||
};
|
||||
|
||||
/** Drag of a range of automation data, changing value but not position */
|
||||
|
|
|
@ -242,7 +242,7 @@ Editor::set_canvas_cursor ()
|
|||
break;
|
||||
|
||||
case MouseZoom:
|
||||
current_canvas_cursor = zoom_cursor;
|
||||
current_canvas_cursor = zoom_in_cursor;
|
||||
break;
|
||||
|
||||
case MouseTimeFX:
|
||||
|
@ -1595,7 +1595,7 @@ Editor::enter_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_
|
|||
cursor = selector_cursor;
|
||||
break;
|
||||
case MouseZoom:
|
||||
cursor = zoom_cursor;
|
||||
cursor = zoom_in_cursor;
|
||||
break;
|
||||
default:
|
||||
cursor = cross_hair_cursor;
|
||||
|
|
|
@ -1,18 +1,3 @@
|
|||
/* Created with The GIMP */
|
||||
#define mag_width 16
|
||||
#define mag_height 16
|
||||
#define mag_x_hot 9
|
||||
#define mag_y_hot 5
|
||||
static const gchar mag_bits[] = {
|
||||
0x7f, 0xe0, 0x3f, 0xc0, 0x1f, 0x8f, 0x8f, 0x9f, 0xcf, 0x3f, 0xcf, 0x3f,
|
||||
0xcf, 0x3f, 0xcf, 0x3f, 0x8f, 0x1f, 0x1f, 0x8f, 0x0f, 0xc0, 0x47, 0xe0,
|
||||
0xe3, 0xff, 0xf1, 0xff, 0xf8, 0xff, 0xfc, 0xff };
|
||||
|
||||
static const gchar magmask_bits[] = {
|
||||
0x80, 0x1f, 0xc0, 0x3f, 0xe0, 0x70, 0x70, 0x66, 0x30, 0xc6, 0xb0, 0xdf,
|
||||
0xb0, 0xdf, 0x30, 0xc6, 0x70, 0xe6, 0xe0, 0x70, 0xf0, 0x3f, 0xb8, 0x1f,
|
||||
0x1c, 0x00, 0x0e, 0x00, 0x07, 0x00, 0x03, 0x00 };
|
||||
|
||||
/* Created with The GIMP */
|
||||
#define fader_cursor_width 25
|
||||
#define fader_cursor_height 25
|
||||
|
|
Loading…
Reference in New Issue
Block a user