summaryrefslogtreecommitdiff
path: root/gtk2_ardour
diff options
context:
space:
mode:
authorCarl Hetherington <carl@carlh.net>2010-11-16 14:53:16 +0000
committerCarl Hetherington <carl@carlh.net>2010-11-16 14:53:16 +0000
commit8fc660e76e50920d744942c241275849b7b9720e (patch)
tree3cccf87a1f913822f812e9d3f4a44d06d39278fb /gtk2_ardour
parent840a81a0e452b39ee7e8c32484c12c3a53ce8172 (diff)
Move mouse cursor stuff out of Editor into its own class.
git-svn-id: svn://localhost/ardour2/branches/3.0@8048 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour')
-rw-r--r--gtk2_ardour/editor.cc208
-rw-r--r--gtk2_ardour/editor.h66
-rw-r--r--gtk2_ardour/editor_audio_import.cc8
-rw-r--r--gtk2_ardour/editor_canvas.cc6
-rw-r--r--gtk2_ardour/editor_cursors.cc1
-rw-r--r--gtk2_ardour/editor_cursors.h39
-rw-r--r--gtk2_ardour/editor_drag.cc32
-rw-r--r--gtk2_ardour/editor_mouse.cc80
-rw-r--r--gtk2_ardour/editor_ops.cc10
-rw-r--r--gtk2_ardour/editor_rulers.cc1
-rw-r--r--gtk2_ardour/editor_selection.cc3
-rw-r--r--gtk2_ardour/editor_summary.cc24
-rw-r--r--gtk2_ardour/midi_region_view.cc5
-rw-r--r--gtk2_ardour/mouse_cursors.cc181
-rw-r--r--gtk2_ardour/mouse_cursors.h66
-rw-r--r--gtk2_ardour/public_editor.h3
-rw-r--r--gtk2_ardour/wscript1
17 files changed, 394 insertions, 340 deletions
diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc
index 22a4f9e805..d19f5f6424 100644
--- a/gtk2_ardour/editor.cc
+++ b/gtk2_ardour/editor.cc
@@ -115,6 +115,8 @@
#include "editor_snapshots.h"
#include "editor_summary.h"
#include "region_layering_order_editor.h"
+#include "mouse_cursors.h"
+#include "editor_cursors.h"
#include "i18n.h"
@@ -136,8 +138,6 @@ using Gtkmm2ext::Keyboard;
const double Editor::timebar_height = 15.0;
-#include "editor_xpms"
-
static const gchar *_snap_type_strings[] = {
N_("CD Frames"),
N_("Timecode Frames"),
@@ -207,45 +207,6 @@ static const gchar *_rb_opt_strings[] = {
};
#endif
-/* Soundfile drag-n-drop */
-
-Gdk::Cursor* Editor::cross_hair_cursor = 0;
-Gdk::Cursor* Editor::selector_cursor = 0;
-Gdk::Cursor* Editor::trimmer_cursor = 0;
-Gdk::Cursor* Editor::left_side_trim_cursor = 0;
-Gdk::Cursor* Editor::right_side_trim_cursor = 0;
-Gdk::Cursor* Editor::left_side_trim_right_only_cursor = 0;
-Gdk::Cursor* Editor::right_side_trim_left_only_cursor = 0;
-Gdk::Cursor* Editor::fade_in_cursor = 0;
-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_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;
-Gdk::Cursor* Editor::midi_pencil_cursor = 0;
-Gdk::Cursor* Editor::midi_select_cursor = 0;
-Gdk::Cursor* Editor::midi_resize_cursor = 0;
-Gdk::Cursor* Editor::midi_erase_cursor = 0;
-Gdk::Cursor* Editor::wait_cursor = 0;
-Gdk::Cursor* Editor::timebar_cursor = 0;
-Gdk::Cursor* Editor::transparent_cursor = 0;
-Gdk::Cursor* Editor::up_down_cursor = 0;
-Gdk::Cursor* Editor::resize_left_cursor = 0;
-Gdk::Cursor* Editor::resize_top_left_cursor = 0;
-Gdk::Cursor* Editor::resize_top_cursor = 0;
-Gdk::Cursor* Editor::resize_top_right_cursor = 0;
-Gdk::Cursor* Editor::resize_right_cursor = 0;
-Gdk::Cursor* Editor::resize_bottom_right_cursor = 0;
-Gdk::Cursor* Editor::resize_bottom_cursor = 0;
-Gdk::Cursor* Editor::resize_bottom_left_cursor = 0;
-Gdk::Cursor* Editor::move_cursor = 0;
-Gdk::Cursor* Editor::expand_left_right_cursor = 0;
-Gdk::Cursor* Editor::expand_up_down_cursor = 0;
-
void
show_me_the_size (Requisition* r, const char* what)
{
@@ -518,7 +479,7 @@ Editor::Editor ()
controls_layout.signal_button_release_event().connect (sigc::mem_fun(*this, &Editor::edit_controls_button_release));
controls_layout_size_request_connection = controls_layout.signal_size_request().connect (sigc::mem_fun (*this, &Editor::controls_layout_size_request));
- build_cursors ();
+ _cursors = new MouseCursors;
ArdourCanvas::Canvas* time_pad = manage(new ArdourCanvas::Canvas());
ArdourCanvas::SimpleLine* pad_line_1 = manage(new ArdourCanvas::SimpleLine(*time_pad->root(),
@@ -1236,169 +1197,6 @@ Editor::action_pre_activated (Glib::RefPtr<Action> const & a)
}
}
-void
-Editor::build_cursors ()
-{
- using namespace Gdk;
-
- {
- 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" );
-
- {
- RefPtr<Bitmap> source, mask;
-
- source = Bitmap::create (fader_cursor_bits, fader_cursor_width, fader_cursor_height);
- mask = Bitmap::create (fader_cursor_mask_bits, fader_cursor_width, fader_cursor_height);
- fader_cursor = new Gdk::Cursor (source, mask, ffg, fbg, fader_cursor_x_hot, fader_cursor_y_hot);
- }
-
- {
- RefPtr<Bitmap> source, mask;
- source = Bitmap::create (speaker_cursor_bits, speaker_cursor_width, speaker_cursor_height);
- mask = Bitmap::create (speaker_cursor_mask_bits, speaker_cursor_width, speaker_cursor_height);
- speaker_cursor = new Gdk::Cursor (source, mask, ffg, fbg, speaker_cursor_x_hot, speaker_cursor_y_hot);
- }
-
- {
- RefPtr<Bitmap> bits;
- char pix[4] = { 0, 0, 0, 0 };
- bits = Bitmap::create (pix, 2, 2);
- Gdk::Color c;
- transparent_cursor = new Gdk::Cursor (bits, bits, c, c, 0, 0);
- }
-
- {
- RefPtr<Bitmap> bits;
- char pix[4] = { 0, 0, 0, 0 };
- bits = Bitmap::create (pix, 2, 2);
- Gdk::Color c;
- transparent_cursor = new Gdk::Cursor (bits, bits, c, c, 0, 0);
- }
-
- {
- Glib::RefPtr<Gdk::Pixbuf> grabber_pixbuf (::get_icon ("grabber"));
- grabber_cursor = new Gdk::Cursor (Gdk::Display::get_default(), grabber_pixbuf, 5, 0);
- }
-
- {
- Glib::RefPtr<Gdk::Pixbuf> grabber_note_pixbuf (::get_icon ("grabber_note"));
- grabber_note_cursor = new Gdk::Cursor (Gdk::Display::get_default(), grabber_note_pixbuf, 5, 10);
- }
-
- {
- Glib::RefPtr<Gdk::Pixbuf> grabber_edit_point_pixbuf (::get_icon ("grabber_edit_point"));
- grabber_edit_point_cursor = new Gdk::Cursor (Gdk::Display::get_default(), grabber_edit_point_pixbuf, 5, 17);
- }
-
- cross_hair_cursor = new Gdk::Cursor (CROSSHAIR);
- trimmer_cursor = new Gdk::Cursor (SB_H_DOUBLE_ARROW);
-
- {
- Glib::RefPtr<Gdk::Pixbuf> apixbuf (::get_icon ("trim_left_cursor"));
- left_side_trim_cursor = new Gdk::Cursor (Gdk::Display::get_default(), apixbuf, 5, 11);
- }
-
- {
- Glib::RefPtr<Gdk::Pixbuf> apixbuf (::get_icon ("trim_right_cursor"));
- right_side_trim_cursor = new Gdk::Cursor (Gdk::Display::get_default(), apixbuf, 23, 11);
- }
-
- {
- Glib::RefPtr<Gdk::Pixbuf> apixbuf (::get_icon ("trim_left_cursor_right_only"));
- left_side_trim_right_only_cursor = new Gdk::Cursor (Gdk::Display::get_default(), apixbuf, 5, 11);
- }
-
- {
- Glib::RefPtr<Gdk::Pixbuf> apixbuf (::get_icon ("trim_right_cursor_left_only"));
- right_side_trim_left_only_cursor = new Gdk::Cursor (Gdk::Display::get_default(), apixbuf, 23, 11);
- }
-
- {
- Glib::RefPtr<Gdk::Pixbuf> apixbuf (::get_icon ("fade_in_cursor"));
- fade_in_cursor = new Gdk::Cursor (Gdk::Display::get_default(), apixbuf, 0, 0);
- }
-
- {
- Glib::RefPtr<Gdk::Pixbuf> apixbuf (::get_icon ("fade_out_cursor"));
- fade_out_cursor = new Gdk::Cursor (Gdk::Display::get_default(), apixbuf, 29, 0);
- }
-
- {
- Glib::RefPtr<Gdk::Pixbuf> p (::get_icon ("resize_left_cursor"));
- resize_left_cursor = new Gdk::Cursor (Gdk::Display::get_default(), p, 3, 10);
- }
-
- {
- Glib::RefPtr<Gdk::Pixbuf> p (::get_icon ("resize_top_left_cursor"));
- resize_top_left_cursor = new Gdk::Cursor (Gdk::Display::get_default(), p, 3, 3);
- }
-
- {
- Glib::RefPtr<Gdk::Pixbuf> p (::get_icon ("resize_top_cursor"));
- resize_top_cursor = new Gdk::Cursor (Gdk::Display::get_default(), p, 10, 3);
- }
-
- {
- Glib::RefPtr<Gdk::Pixbuf> p (::get_icon ("resize_top_right_cursor"));
- resize_top_right_cursor = new Gdk::Cursor (Gdk::Display::get_default(), p, 18, 3);
- }
-
- {
- Glib::RefPtr<Gdk::Pixbuf> p (::get_icon ("resize_right_cursor"));
- resize_right_cursor = new Gdk::Cursor (Gdk::Display::get_default(), p, 24, 10);
- }
-
- {
- Glib::RefPtr<Gdk::Pixbuf> p (::get_icon ("resize_bottom_right_cursor"));
- resize_bottom_right_cursor = new Gdk::Cursor (Gdk::Display::get_default(), p, 18, 18);
- }
-
- {
- Glib::RefPtr<Gdk::Pixbuf> p (::get_icon ("resize_bottom_cursor"));
- resize_bottom_cursor = new Gdk::Cursor (Gdk::Display::get_default(), p, 10, 24);
- }
-
- {
- Glib::RefPtr<Gdk::Pixbuf> p (::get_icon ("resize_bottom_left_cursor"));
- resize_bottom_left_cursor = new Gdk::Cursor (Gdk::Display::get_default(), p, 3, 18);
- }
-
- {
- Glib::RefPtr<Gdk::Pixbuf> p (::get_icon ("move_cursor"));
- move_cursor = new Gdk::Cursor (Gdk::Display::get_default(), p, 11, 11);
- }
-
- {
- Glib::RefPtr<Gdk::Pixbuf> p (::get_icon ("expand_left_right_cursor"));
- expand_left_right_cursor = new Gdk::Cursor (Gdk::Display::get_default(), p, 11, 4);
- }
-
- {
- Glib::RefPtr<Gdk::Pixbuf> p (::get_icon ("expand_up_down_cursor"));
- expand_up_down_cursor = new Gdk::Cursor (Gdk::Display::get_default(), p, 4, 11);
- }
-
- selector_cursor = new Gdk::Cursor (XTERM);
- time_fx_cursor = new Gdk::Cursor (SIZING);
- wait_cursor = new Gdk::Cursor (WATCH);
- timebar_cursor = new Gdk::Cursor(LEFT_PTR);
- midi_pencil_cursor = new Gdk::Cursor (PENCIL);
- midi_select_cursor = new Gdk::Cursor (CENTER_PTR);
- midi_resize_cursor = new Gdk::Cursor (SIZING);
- midi_erase_cursor = new Gdk::Cursor (DRAPED_BOX);
- up_down_cursor = new Gdk::Cursor (Gdk::SB_V_DOUBLE_ARROW);
-}
-
/** Pop up a context menu for when the user clicks on a fade in or fade out */
void
Editor::popup_fade_context_menu (int button, int32_t time, ArdourCanvas::Item* item, ItemType item_type)
diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h
index a3b7cd3628..3c3f56d2f1 100644
--- a/gtk2_ardour/editor.h
+++ b/gtk2_ardour/editor.h
@@ -128,6 +128,8 @@ class EditorSnapshots;
class EditorSummary;
class RegionLayeringOrderEditor;
class ProgressReporter;
+class EditorCursor;
+class MouseCursors;
/* <CMT Additions> */
class ImageFrameView;
@@ -139,23 +141,6 @@ class ImageFrameSocketHandler ;
class TimeAxisViewItem ;
/* </CMT Additions> */
-struct EditorCursor {
- Editor& editor;
- ArdourCanvas::Points points;
- ArdourCanvas::Line canvas_item;
- framepos_t current_frame;
- double length;
-
- EditorCursor (Editor&, bool (Editor::*)(GdkEvent*,ArdourCanvas::Item*));
- ~EditorCursor ();
-
- void set_position (framepos_t);
- void set_length (double units);
- void set_y_axis (double position);
-
- PBD::Signal1<void, framepos_t> PositionChanged;
-};
-
class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARDOUR::SessionHandlePtr
{
public:
@@ -450,50 +435,15 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
void maybe_autoscroll (bool, bool);
- /* handy cursors for everyone to use */
-
- static Gdk::Cursor* cross_hair_cursor;
- static Gdk::Cursor* trimmer_cursor;
- static Gdk::Cursor* right_side_trim_cursor;
- static Gdk::Cursor* left_side_trim_cursor;
- static Gdk::Cursor* right_side_trim_left_only_cursor;
- static Gdk::Cursor* left_side_trim_right_only_cursor;
- static Gdk::Cursor* fade_in_cursor;
- static Gdk::Cursor* fade_out_cursor;
- static Gdk::Cursor* selector_cursor;
- static Gdk::Cursor* grabber_cursor;
- static Gdk::Cursor* grabber_note_cursor;
- static Gdk::Cursor* grabber_edit_point_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;
- static Gdk::Cursor* midi_pencil_cursor;
- static Gdk::Cursor* midi_select_cursor;
- static Gdk::Cursor* midi_resize_cursor;
- static Gdk::Cursor* midi_erase_cursor;
- static Gdk::Cursor* up_down_cursor;
- static Gdk::Cursor* wait_cursor;
- static Gdk::Cursor* timebar_cursor;
- static Gdk::Cursor* transparent_cursor;
- static Gdk::Cursor* resize_left_cursor;
- static Gdk::Cursor* resize_top_left_cursor;
- static Gdk::Cursor* resize_top_cursor;
- static Gdk::Cursor* resize_top_right_cursor;
- static Gdk::Cursor* resize_right_cursor;
- static Gdk::Cursor* resize_bottom_right_cursor;
- static Gdk::Cursor* resize_bottom_cursor;
- static Gdk::Cursor* resize_bottom_left_cursor;
- static Gdk::Cursor* move_cursor;
- static Gdk::Cursor* expand_left_right_cursor;
- static Gdk::Cursor* expand_up_down_cursor;
-
Gdk::Cursor* get_canvas_cursor () const { return current_canvas_cursor; }
void set_canvas_cursor (Gdk::Cursor*, bool save=false);
void set_current_trimmable (boost::shared_ptr<ARDOUR::Trimmable>);
void set_current_movable (boost::shared_ptr<ARDOUR::Movable>);
+ MouseCursors const * cursors () const {
+ return _cursors;
+ }
+
protected:
void map_transport_state ();
void map_position_change (framepos_t);
@@ -1056,8 +1006,6 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
TrackViewList get_tracks_for_range_action () const;
- static void build_cursors ();
-
sigc::connection super_rapid_screen_update_connection;
framepos_t last_update_frame;
void center_screen_internal (framepos_t, float);
@@ -2102,6 +2050,8 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
void action_pre_activated (Glib::RefPtr<Gtk::Action> const &);
void set_canvas_cursor_for_region_view (double, RegionView *);
+
+ MouseCursors* _cursors;
friend class Drag;
friend class RegionDrag;
diff --git a/gtk2_ardour/editor_audio_import.cc b/gtk2_ardour/editor_audio_import.cc
index dadde038a8..d5a58e3ab9 100644
--- a/gtk2_ardour/editor_audio_import.cc
+++ b/gtk2_ardour/editor_audio_import.cc
@@ -60,6 +60,8 @@
#include "utils.h"
#include "gui_thread.h"
#include "interthread_progress_window.h"
+#include "mouse_cursors.h"
+#include "editor_cursors.h"
#include "i18n.h"
@@ -519,7 +521,7 @@ Editor::import_sndfiles (vector<string> paths, ImportMode mode, SrcQuality quali
import_status.track = track;
import_status.replace = replace;
- set_canvas_cursor (wait_cursor);
+ set_canvas_cursor (_cursors->wait);
gdk_flush ();
/* start import thread for this spec. this will ultimately call Session::import_audiofiles()
@@ -569,7 +571,7 @@ Editor::embed_sndfiles (vector<string> paths, bool multifile,
SoundFileInfo finfo;
int ret = 0;
- set_canvas_cursor (wait_cursor);
+ set_canvas_cursor (_cursors->wait);
gdk_flush ();
for (vector<string>::iterator p = paths.begin(); p != paths.end(); ++p) {
@@ -642,7 +644,7 @@ Editor::embed_sndfiles (vector<string> paths, bool multifile,
}
}
- set_canvas_cursor (wait_cursor);
+ set_canvas_cursor (_cursors->wait);
for (int n = 0; n < finfo.channels; ++n) {
try {
diff --git a/gtk2_ardour/editor_canvas.cc b/gtk2_ardour/editor_canvas.cc
index 7da8d08f52..beace83c3f 100644
--- a/gtk2_ardour/editor_canvas.cc
+++ b/gtk2_ardour/editor_canvas.cc
@@ -51,6 +51,8 @@
#include "editor_routes.h"
#include "editor_summary.h"
#include "keyboard.h"
+#include "editor_cursors.h"
+#include "mouse_cursors.h"
#include "i18n.h"
@@ -940,7 +942,7 @@ 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)) {
- set_canvas_cursor (zoom_out_cursor);
+ set_canvas_cursor (_cursors->zoom_out);
}
return false;
@@ -950,7 +952,7 @@ bool
Editor::track_canvas_key_release (GdkEventKey* event)
{
if (mouse_mode == Editing::MouseZoom && !Keyboard::the_keyboard().key_is_down (GDK_Control_L)) {
- set_canvas_cursor (zoom_in_cursor);
+ set_canvas_cursor (_cursors->zoom_in);
}
return false;
diff --git a/gtk2_ardour/editor_cursors.cc b/gtk2_ardour/editor_cursors.cc
index e2a04d939b..21ba063c09 100644
--- a/gtk2_ardour/editor_cursors.cc
+++ b/gtk2_ardour/editor_cursors.cc
@@ -23,6 +23,7 @@
#include <libgnomecanvas/libgnomecanvas.h>
#include "utils.h"
+#include "editor_cursors.h"
#include "editor.h"
using namespace ARDOUR;
diff --git a/gtk2_ardour/editor_cursors.h b/gtk2_ardour/editor_cursors.h
new file mode 100644
index 0000000000..b5c228a54a
--- /dev/null
+++ b/gtk2_ardour/editor_cursors.h
@@ -0,0 +1,39 @@
+/*
+ Copyright (C) 2000 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 "pbd/signals.h"
+
+class Editor;
+
+struct EditorCursor {
+ Editor& editor;
+ ArdourCanvas::Points points;
+ ArdourCanvas::Line canvas_item;
+ framepos_t current_frame;
+ double length;
+
+ EditorCursor (Editor&, bool (Editor::*)(GdkEvent*,ArdourCanvas::Item*));
+ ~EditorCursor ();
+
+ void set_position (framepos_t);
+ void set_length (double units);
+ void set_y_axis (double position);
+
+ PBD::Signal1<void, framepos_t> PositionChanged;
+};
diff --git a/gtk2_ardour/editor_drag.cc b/gtk2_ardour/editor_drag.cc
index 179ce81919..900fd0ea4c 100644
--- a/gtk2_ardour/editor_drag.cc
+++ b/gtk2_ardour/editor_drag.cc
@@ -50,6 +50,8 @@
#include "midi_selection.h"
#include "automation_time_axis.h"
#include "debug.h"
+#include "editor_cursors.h"
+#include "mouse_cursors.h"
using namespace std;
using namespace ARDOUR;
@@ -1409,9 +1411,9 @@ NoteResizeDrag::start_grab (GdkEvent* event, Gdk::Cursor* /*ignored*/)
float x_fraction = cnote->mouse_x_fraction ();
if (x_fraction > 0.0 && x_fraction < 0.25) {
- cursor = _editor->left_side_trim_cursor;
+ cursor = _editor->cursors()->left_side_trim;
} else {
- cursor = _editor->right_side_trim_cursor;
+ cursor = _editor->cursors()->right_side_trim;
}
Drag::start_grab (event, cursor);
@@ -1422,10 +1424,10 @@ NoteResizeDrag::start_grab (GdkEvent* event, Gdk::Cursor* /*ignored*/)
double const middle_point = region_start + cnote->x1() + (cnote->x2() - cnote->x1()) / 2.0L;
if (grab_x() <= middle_point) {
- cursor = _editor->left_side_trim_cursor;
+ cursor = _editor->cursors()->left_side_trim;
at_front = true;
} else {
- cursor = _editor->right_side_trim_cursor;
+ cursor = _editor->cursors()->right_side_trim;
at_front = false;
}
@@ -1532,17 +1534,17 @@ TrimDrag::start_grab (GdkEvent* event, Gdk::Cursor*)
if (Keyboard::modifier_state_equals (event->button.state, Keyboard::PrimaryModifier)) {
_operation = ContentsTrim;
- Drag::start_grab (event, _editor->trimmer_cursor);
+ Drag::start_grab (event, _editor->cursors()->trimmer);
} else {
/* These will get overridden for a point trim.*/
if (pf < (region_start + region_length/2)) {
/* closer to start */
_operation = StartTrim;
- Drag::start_grab (event, _editor->left_side_trim_cursor);
+ Drag::start_grab (event, _editor->cursors()->left_side_trim);
} else {
/* closer to end */
_operation = EndTrim;
- Drag::start_grab (event, _editor->right_side_trim_cursor);
+ Drag::start_grab (event, _editor->cursors()->right_side_trim);
}
}
@@ -2613,7 +2615,7 @@ ControlPointDrag::ControlPointDrag (Editor* e, ArdourCanvas::Item* i)
void
ControlPointDrag::start_grab (GdkEvent* event, Gdk::Cursor* /*cursor*/)
{
- Drag::start_grab (event, _editor->fader_cursor);
+ Drag::start_grab (event, _editor->cursors()->fader);
// start the grab at the center of the control point so
// the point doesn't 'jump' to the mouse after the first drag
@@ -2758,7 +2760,7 @@ LineDrag::start_grab (GdkEvent* event, Gdk::Cursor* /*cursor*/)
return;
}
- Drag::start_grab (event, _editor->fader_cursor);
+ Drag::start_grab (event, _editor->cursors()->fader);
/* store grab start in parent frame */
@@ -3138,7 +3140,7 @@ SelectionDrag::start_grab (GdkEvent* event, Gdk::Cursor*)
} else {
_copy = false;
}
- cursor = _editor->selector_cursor;
+ cursor = _editor->cursors()->selector;
Drag::start_grab (event, cursor);
break;
@@ -3146,7 +3148,7 @@ SelectionDrag::start_grab (GdkEvent* event, Gdk::Cursor*)
if (_editor->clicked_axisview) {
_editor->clicked_axisview->order_selection_trims (_item, true);
}
- Drag::start_grab (event, _editor->left_side_trim_cursor);
+ Drag::start_grab (event, _editor->cursors()->left_side_trim);
start = _editor->selection->time[_editor->clicked_selection].start;
_pointer_frame_offset = raw_grab_frame() - start;
break;
@@ -3155,7 +3157,7 @@ SelectionDrag::start_grab (GdkEvent* event, Gdk::Cursor*)
if (_editor->clicked_axisview) {
_editor->clicked_axisview->order_selection_trims (_item, false);
}
- Drag::start_grab (event, _editor->right_side_trim_cursor);
+ Drag::start_grab (event, _editor->cursors()->right_side_trim);
end = _editor->selection->time[_editor->clicked_selection].end;
_pointer_frame_offset = raw_grab_frame() - end;
break;
@@ -3405,7 +3407,7 @@ RangeMarkerBarDrag::start_grab (GdkEvent* event, Gdk::Cursor *)
} else {
_copy = false;
}
- cursor = _editor->selector_cursor;
+ cursor = _editor->cursors()->selector;
break;
}
@@ -3594,10 +3596,10 @@ void
MouseZoomDrag::start_grab (GdkEvent* event, Gdk::Cursor *)
{
if (Keyboard::the_keyboard().key_is_down (GDK_Control_L)) {
- Drag::start_grab (event, _editor->zoom_out_cursor);
+ Drag::start_grab (event, _editor->cursors()->zoom_out);
_zoom_out = true;
} else {
- Drag::start_grab (event, _editor->zoom_in_cursor);
+ Drag::start_grab (event, _editor->cursors()->zoom_in);
_zoom_out = false;
}
diff --git a/gtk2_ardour/editor_mouse.cc b/gtk2_ardour/editor_mouse.cc
index 653fdc3204..6b1703ed1b 100644
--- a/gtk2_ardour/editor_mouse.cc
+++ b/gtk2_ardour/editor_mouse.cc
@@ -56,6 +56,8 @@
#include "editor_drag.h"
#include "automation_region_view.h"
#include "edit_note_dialog.h"
+#include "mouse_cursors.h"
+#include "editor_cursors.h"
#include "ardour/types.h"
#include "ardour/profile.h"
@@ -171,20 +173,20 @@ Editor::event_frame (GdkEvent const * event, double* pcx, double* pcy) const
Gdk::Cursor*
Editor::which_grabber_cursor ()
{
- Gdk::Cursor* c = grabber_cursor;
+ Gdk::Cursor* c = _cursors->grabber;
if (_internal_editing) {
switch (mouse_mode) {
case MouseRange:
- c = midi_pencil_cursor;
+ c = _cursors->midi_pencil;
break;
case MouseObject:
- c = grabber_note_cursor;
+ c = _cursors->grabber_note;
break;
case MouseTimeFX:
- c = midi_resize_cursor;
+ c = _cursors->midi_resize;
break;
default:
@@ -195,12 +197,12 @@ Editor::which_grabber_cursor ()
switch (_edit_point) {
case EditAtMouse:
- c = grabber_edit_point_cursor;
+ c = _cursors->grabber_edit_point;
break;
default:
boost::shared_ptr<Movable> m = _movable.lock();
if (m && m->locked()) {
- c = speaker_cursor;
+ c = _cursors->speaker;
}
break;
}
@@ -239,7 +241,7 @@ Editor::set_canvas_cursor ()
switch (mouse_mode) {
case MouseRange:
- current_canvas_cursor = midi_pencil_cursor;
+ current_canvas_cursor = _cursors->midi_pencil;
break;
case MouseObject:
@@ -247,7 +249,7 @@ Editor::set_canvas_cursor ()
break;
case MouseTimeFX:
- current_canvas_cursor = midi_resize_cursor;
+ current_canvas_cursor = _cursors->midi_resize;
break;
default:
@@ -258,7 +260,7 @@ Editor::set_canvas_cursor ()
switch (mouse_mode) {
case MouseRange:
- current_canvas_cursor = selector_cursor;
+ current_canvas_cursor = _cursors->selector;
break;
case MouseObject:
@@ -266,23 +268,23 @@ Editor::set_canvas_cursor ()
break;
case MouseGain:
- current_canvas_cursor = cross_hair_cursor;
+ current_canvas_cursor = _cursors->cross_hair;
break;
case MouseZoom:
if (Keyboard::the_keyboard().key_is_down (GDK_Control_L)) {
- current_canvas_cursor = zoom_out_cursor;
+ current_canvas_cursor = _cursors->zoom_out;
} else {
- current_canvas_cursor = zoom_in_cursor;
+ current_canvas_cursor = _cursors->zoom_in;
}
break;
case MouseTimeFX:
- current_canvas_cursor = time_fx_cursor; // just use playhead
+ current_canvas_cursor = _cursors->time_fx; // just use playhead
break;
case MouseAudition:
- current_canvas_cursor = speaker_cursor;
+ current_canvas_cursor = _cursors->speaker;
break;
}
}
@@ -294,7 +296,7 @@ Editor::set_canvas_cursor ()
current_canvas_cursor = which_grabber_cursor ();
break;
case JOIN_OBJECT_RANGE_RANGE:
- current_canvas_cursor = selector_cursor;
+ current_canvas_cursor = _cursors->selector;
break;
}
@@ -303,7 +305,7 @@ Editor::set_canvas_cursor ()
if (last_item_entered->property_parent() && (*last_item_entered->property_parent()).get_data (X_("timeselection"))) {
pair<TimeAxisView*, int> tvp = trackview_by_y_position (_last_motion_y + vertical_adjustment.get_value() - canvas_timebars_vsize);
if (dynamic_cast<AutomationTimeAxisView*> (tvp.first)) {
- current_canvas_cursor = up_down_cursor;
+ current_canvas_cursor = _cursors->up_down;
}
}
}
@@ -694,7 +696,7 @@ Editor::button_press_handler_1 (ArdourCanvas::Item* item, GdkEvent* event, ItemT
AutomationTimeAxisView* atv = dynamic_cast<AutomationTimeAxisView*> (tvp.first);
if (join_object_range_button.get_active() && atv) {
/* smart "join" mode: drag automation */
- _drags->set (new AutomationRangeDrag (this, atv->base_item(), selection->time), event, up_down_cursor);
+ _drags->set (new AutomationRangeDrag (this, atv->base_item(), selection->time), event, _cursors->up_down);
} else {
/* this was debated, but decided the more common action was to
make a new selection */
@@ -776,14 +778,14 @@ Editor::button_press_handler_1 (ArdourCanvas::Item* item, GdkEvent* event, ItemT
case FadeInHandleItem:
{
RegionSelection s = get_equivalent_regions (selection->regions, Properties::edit.property_id);
- _drags->set (new FadeInDrag (this, item, reinterpret_cast<RegionView*> (item->get_data("regionview")), s), event, fade_in_cursor);
+ _drags->set (new FadeInDrag (this, item, reinterpret_cast<RegionView*> (item->get_data("regionview")), s), event, _cursors->fade_in);
return true;
}
case FadeOutHandleItem:
{
RegionSelection s = get_equivalent_regions (selection->regions, Properties::edit.property_id);
- _drags->set (new FadeOutDrag (this, item, reinterpret_cast<RegionView*> (item->get_data("regionview")), s), event, fade_out_cursor);
+ _drags->set (new FadeOutDrag (this, item, reinterpret_cast<RegionView*> (item->get_data("regionview")), s), event, _cursors->fade_out);
return true;
}
@@ -884,7 +886,7 @@ Editor::button_press_handler_1 (ArdourCanvas::Item* item, GdkEvent* event, ItemT
/* if we're over an automation track, start a drag of its data */
AutomationTimeAxisView* atv = dynamic_cast<AutomationTimeAxisView*> (tvp.first);
if (atv) {
- _drags->set (new AutomationRangeDrag (this, atv->base_item(), selection->time), event, up_down_cursor);
+ _drags->set (new AutomationRangeDrag (this, atv->base_item(), selection->time), event, _cursors->up_down);
}
/* if we're over a track and a region, and in the `object' part of a region,
@@ -1022,7 +1024,7 @@ Editor::button_press_handler_1 (ArdourCanvas::Item* item, GdkEvent* event, ItemT
scrub_reverse_distance = 0;
last_scrub_x = event->button.x;
scrubbing_direction = 0;
- set_canvas_cursor (transparent_cursor);
+ set_canvas_cursor (_cursors->transparent);
return true;
break;
@@ -1542,7 +1544,7 @@ Editor::enter_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_
fraction = 1.0 - (cp->get_y() / cp->line().height());
if (is_drawable() && !_drags->active ()) {
- set_canvas_cursor (fader_cursor);
+ set_canvas_cursor (_cursors->fader);
}
set_verbose_canvas_cursor (cp->line().get_verbose_cursor_string (fraction), at_x, at_y);
@@ -1556,7 +1558,7 @@ Editor::enter_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_
if (line)
line->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_EnteredGainLine.get();
if (is_drawable()) {
- set_canvas_cursor (fader_cursor);
+ set_canvas_cursor (_cursors->fader);
}
}
break;
@@ -1569,7 +1571,7 @@ Editor::enter_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_
line->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_EnteredAutomationLine.get();
}
if (is_drawable()) {
- set_canvas_cursor (fader_cursor);
+ set_canvas_cursor (_cursors->fader);
}
}
break;
@@ -1599,7 +1601,7 @@ Editor::enter_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_
#endif
if (is_drawable()) {
- set_canvas_cursor (trimmer_cursor);
+ set_canvas_cursor (_cursors->trimmer);
}
break;
@@ -1607,10 +1609,10 @@ Editor::enter_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_
if (is_drawable()) {
switch (_edit_point) {
case EditAtMouse:
- set_canvas_cursor (grabber_edit_point_cursor);
+ set_canvas_cursor (_cursors->grabber_edit_point);
break;
default:
- set_canvas_cursor (grabber_cursor);
+ set_canvas_cursor (_cursors->grabber);
break;
}
}
@@ -1634,13 +1636,13 @@ Editor::enter_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_
Gdk::Cursor *cursor;
switch (mouse_mode) {
case MouseRange:
- cursor = selector_cursor;
+ cursor = _cursors->selector;
break;
case MouseZoom:
- cursor = zoom_in_cursor;
+ cursor = _cursors->zoom_in;
break;
default:
- cursor = cross_hair_cursor;
+ cursor = _cursors->cross_hair;
break;
}
@@ -1661,7 +1663,7 @@ Editor::enter_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_
case MeterBarItem:
case TempoBarItem:
if (is_drawable()) {
- set_canvas_cursor (timebar_cursor);
+ set_canvas_cursor (_cursors->timebar);
}
break;
@@ -1675,7 +1677,7 @@ Editor::enter_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_
case MeterMarkerItem:
case TempoMarkerItem:
if (is_drawable()) {
- set_canvas_cursor (timebar_cursor);
+ set_canvas_cursor (_cursors->timebar);
}
break;
@@ -1685,7 +1687,7 @@ Editor::enter_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_
if (rect) {
rect->property_fill_color_rgba() = 0xBBBBBBAA;
}
- set_canvas_cursor (fade_in_cursor);
+ set_canvas_cursor (_cursors->fade_in);
}
break;
@@ -1695,7 +1697,7 @@ Editor::enter_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_
if (rect) {
rect->property_fill_color_rgba() = 0xBBBBBBAA;
}
- set_canvas_cursor (fade_out_cursor);
+ set_canvas_cursor (_cursors->fade_out);
}
break;
case FeatureLineItem:
@@ -1833,7 +1835,7 @@ Editor::leave_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_
case TempoMarkerItem:
if (is_drawable()) {
- set_canvas_cursor (timebar_cursor);
+ set_canvas_cursor (_cursors->timebar);
}
break;
@@ -2719,15 +2721,15 @@ Editor::set_canvas_cursor_for_region_view (double x, RegionView* rv)
Trimmable::CanTrim ct = rv->region()->can_trim ();
if (x <= h) {
if (ct & Trimmable::FrontTrimEarlier) {
- set_canvas_cursor (left_side_trim_cursor);
+ set_canvas_cursor (_cursors->left_side_trim);
} else {
- set_canvas_cursor (left_side_trim_right_only_cursor);
+ set_canvas_cursor (_cursors->left_side_trim_right_only);
}
} else {
if (ct & Trimmable::EndTrimLater) {
- set_canvas_cursor (right_side_trim_cursor);
+ set_canvas_cursor (_cursors->right_side_trim);
} else {
- set_canvas_cursor (right_side_trim_left_only_cursor);
+ set_canvas_cursor (_cursors->right_side_trim_left_only);
}
}
}
diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc
index 3cf4e1747a..2396c362d1 100644
--- a/gtk2_ardour/editor_ops.cc
+++ b/gtk2_ardour/editor_ops.cc
@@ -82,6 +82,8 @@
#include "interthread_progress_window.h"
#include "insert_time_dialog.h"
#include "normalize_dialog.h"
+#include "editor_cursors.h"
+#include "mouse_cursors.h"
#include "i18n.h"
@@ -3547,7 +3549,7 @@ Editor::freeze_route ()
pthread_create_and_store (X_("freezer"), &itt.thread, _freeze_thread, this);
- set_canvas_cursor (wait_cursor);
+ set_canvas_cursor (_cursors->wait);
while (!itt.done && !itt.cancel) {
gtk_main_iteration ();
@@ -4385,7 +4387,7 @@ Editor::normalize_region ()
return;
}
- set_canvas_cursor (wait_cursor);
+ set_canvas_cursor (_cursors->wait);
gdk_flush ();
/* XXX: should really only count audio regions here */
@@ -4611,7 +4613,7 @@ Editor::fork_region ()
begin_reversible_command (_("Fork Region(s)"));
- set_canvas_cursor (wait_cursor);
+ set_canvas_cursor (_cursors->wait);
gdk_flush ();
for (RegionSelection::iterator r = rs.begin(); r != rs.end(); ) {
@@ -4671,7 +4673,7 @@ Editor::apply_filter (Filter& filter, string command, ProgressReporter* progress
begin_reversible_command (command);
- set_canvas_cursor (wait_cursor);
+ set_canvas_cursor (_cursors->wait);
gdk_flush ();
int n = 0;
diff --git a/gtk2_ardour/editor_rulers.cc b/gtk2_ardour/editor_rulers.cc
index 152fef8f83..068be6d534 100644
--- a/gtk2_ardour/editor_rulers.cc
+++ b/gtk2_ardour/editor_rulers.cc
@@ -41,6 +41,7 @@
#include "gui_thread.h"
#include "time_axis_view.h"
#include "editor_drag.h"
+#include "editor_cursors.h"
#include "i18n.h"
diff --git a/gtk2_ardour/editor_selection.cc b/gtk2_ardour/editor_selection.cc
index ca3197c533..0a7ad1958c 100644
--- a/gtk2_ardour/editor_selection.cc
+++ b/gtk2_ardour/editor_selection.cc
@@ -36,6 +36,7 @@
#include "automation_line.h"
#include "control_point.h"
#include "editor_regions.h"
+#include "editor_cursors.h"
#include "i18n.h"
@@ -1482,7 +1483,7 @@ Editor::select_all_selectables_using_cursor (EditorCursor *cursor, bool after)
if (after) {
begin_reversible_command (_("select all after cursor"));
- start = cursor->current_frame ;
+ start = cursor->current_frame;
end = _session->current_end_frame();
} else {
if (cursor->current_frame > 0) {
diff --git a/gtk2_ardour/editor_summary.cc b/gtk2_ardour/editor_summary.cc
index dc25824a02..e55b53aeea 100644
--- a/gtk2_ardour/editor_summary.cc
+++ b/gtk2_ardour/editor_summary.cc
@@ -27,6 +27,8 @@
#include "rgb_macros.h"
#include "keyboard.h"
#include "editor_routes.h"
+#include "editor_cursors.h"
+#include "mouse_cursors.h"
using namespace std;
using namespace ARDOUR;
@@ -412,37 +414,37 @@ EditorSummary::set_cursor (Position p)
{
switch (p) {
case LEFT:
- get_window()->set_cursor (*_editor->resize_left_cursor);
+ get_window()->set_cursor (*_editor->_cursors->resize_left);
break;
case LEFT_TOP:
- get_window()->set_cursor (*_editor->resize_top_left_cursor);
+ get_window()->set_cursor (*_editor->_cursors->resize_top_left);
break;
case TOP:
- get_window()->set_cursor (*_editor->resize_top_cursor);
+ get_window()->set_cursor (*_editor->_cursors->resize_top);
break;
case RIGHT_TOP:
- get_window()->set_cursor (*_editor->resize_top_right_cursor);
+ get_window()->set_cursor (*_editor->_cursors->resize_top_right);
break;
case RIGHT:
- get_window()->set_cursor (*_editor->resize_right_cursor);
+ get_window()->set_cursor (*_editor->_cursors->resize_right);
break;
case RIGHT_BOTTOM:
- get_window()->set_cursor (*_editor->resize_bottom_right_cursor);
+ get_window()->set_cursor (*_editor->_cursors->resize_bottom_right);
break;
case BOTTOM:
- get_window()->set_cursor (*_editor->resize_bottom_cursor);
+ get_window()->set_cursor (*_editor->_cursors->resize_bottom);
break;
case LEFT_BOTTOM:
- get_window()->set_cursor (*_editor->resize_bottom_left_cursor);
+ get_window()->set_cursor (*_editor->_cursors->resize_bottom_left);
break;
case INSIDE:
- get_window()->set_cursor (*_editor->move_cursor);
+ get_window()->set_cursor (*_editor->_cursors->move);
break;
case TO_LEFT_OR_RIGHT:
- get_window()->set_cursor (*_editor->expand_left_right_cursor);
+ get_window()->set_cursor (*_editor->_cursors->expand_left_right);
break;
case BELOW_OR_ABOVE:
- get_window()->set_cursor (*_editor->expand_up_down_cursor);
+ get_window()->set_cursor (*_editor->_cursors->expand_up_down);
break;
default:
get_window()->set_cursor ();
diff --git a/gtk2_ardour/midi_region_view.cc b/gtk2_ardour/midi_region_view.cc
index 6424b8b389..bb1eb76fcb 100644
--- a/gtk2_ardour/midi_region_view.cc
+++ b/gtk2_ardour/midi_region_view.cc
@@ -67,6 +67,7 @@
#include "simpleline.h"
#include "streamview.h"
#include "utils.h"
+#include "mouse_cursors.h"
#include "i18n.h"
@@ -2699,9 +2700,9 @@ MidiRegionView::note_mouse_position (float x_fraction, float /*y_fraction*/, boo
Editor* editor = dynamic_cast<Editor*>(&trackview.editor());
if (x_fraction > 0.0 && x_fraction < 0.25) {
- editor->set_canvas_cursor (editor->left_side_trim_cursor);
+ editor->set_canvas_cursor (editor->cursors()->left_side_trim);
} else if (x_fraction >= 0.75 && x_fraction < 1.0) {
- editor->set_canvas_cursor (editor->right_side_trim_cursor);
+ editor->set_canvas_cursor (editor->cursors()->right_side_trim);
} else {
if (pre_enter_cursor && can_set_cursor) {
editor->set_canvas_cursor (pre_enter_cursor);
diff --git a/gtk2_ardour/mouse_cursors.cc b/gtk2_ardour/mouse_cursors.cc
new file mode 100644
index 0000000000..5c06b55803
--- /dev/null
+++ b/gtk2_ardour/mouse_cursors.cc
@@ -0,0 +1,181 @@
+/*
+ Copyright (C) 2000-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
+ 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 <gdkmm/cursor.h>
+#include "utils.h"
+#include "mouse_cursors.h"
+#include "editor_xpms"
+
+MouseCursors::MouseCursors ()
+{
+ using namespace Glib;
+ using namespace Gdk;
+
+ {
+ RefPtr<Pixbuf> p (::get_icon ("zoom_in_cursor"));
+ zoom_in = new Cursor (Display::get_default(), p, 5, 5);
+ }
+
+ {
+ RefPtr<Pixbuf> p (::get_icon ("zoom_out_cursor"));
+ zoom_out = new Cursor (Display::get_default(), p, 5, 5);
+ }
+
+ Color fbg ("#ffffff");
+ Color ffg ("#000000");
+
+ {
+ RefPtr<Bitmap> source = Bitmap::create (fader_cursor_bits, fader_cursor_width, fader_cursor_height);
+ RefPtr<Bitmap> mask = Bitmap::create (fader_cursor_mask_bits, fader_cursor_width, fader_cursor_height);
+ fader = new Cursor (source, mask, ffg, fbg, fader_cursor_x_hot, fader_cursor_y_hot);
+ }
+
+ {
+ RefPtr<Bitmap> source = Bitmap::create (speaker_cursor_bits, speaker_cursor_width, speaker_cursor_height);
+ RefPtr<Bitmap> mask = Bitmap::create (speaker_cursor_mask_bits, speaker_cursor_width, speaker_cursor_height);
+ speaker = new Cursor (source, mask, ffg, fbg, speaker_cursor_x_hot, speaker_cursor_y_hot);
+ }
+
+ {
+ char pix[4] = { 0, 0, 0, 0 };
+ RefPtr<Bitmap> bits = Bitmap::create (pix, 2, 2);
+ Color c;
+ transparent = new Cursor (bits, bits, c, c, 0, 0);
+ }
+
+ {
+ char pix[4] = { 0, 0, 0, 0 };
+ RefPtr<Bitmap> bits = Bitmap::create (pix, 2, 2);
+ Color c;
+ transparent = new Cursor (bits, bits, c, c, 0, 0);
+ }
+
+ {
+ RefPtr<Pixbuf> p (::get_icon ("grabber"));
+ grabber = new Cursor (Display::get_default(), p, 5, 0);
+ }
+
+ {
+ RefPtr<Pixbuf> p (::get_icon ("grabber_note"));
+ grabber_note = new Cursor (Display::get_default(), p, 5, 10);
+ }
+
+ {
+ RefPtr<Pixbuf> p (::get_icon ("grabber_edit_point"));
+ grabber_edit_point = new Cursor (Display::get_default(), p, 5, 17);
+ }
+
+ cross_hair = new Cursor (CROSSHAIR);
+ trimmer = new Cursor (SB_H_DOUBLE_ARROW);
+
+ {
+ RefPtr<Pixbuf> p (::get_icon ("trim_left_cursor"));
+ left_side_trim = new Cursor (Display::get_default(), p, 5, 11);
+ }
+
+ {
+ RefPtr<Pixbuf> p (::get_icon ("trim_right_cursor"));
+ right_side_trim = new Cursor (Display::get_default(), p, 23, 11);
+ }
+
+ {
+ RefPtr<Pixbuf> p (::get_icon ("trim_left_cursor_right_only"));
+ left_side_trim_right_only = new Cursor (Display::get_default(), p, 5, 11);
+ }
+
+ {
+ RefPtr<Pixbuf> p (::get_icon ("trim_right_cursor_left_only"));
+ right_side_trim_left_only = new Cursor (Display::get_default(), p, 23, 11);
+ }
+
+ {
+ RefPtr<Pixbuf> p (::get_icon ("fade_in_cursor"));
+ fade_in = new Cursor (Display::get_default(), p, 0, 0);
+ }
+
+ {
+ RefPtr<Pixbuf> p (::get_icon ("fade_out_cursor"));
+ fade_out = new Cursor (Display::get_default(), p, 29, 0);
+ }
+
+ {
+ RefPtr<Pixbuf> p (::get_icon ("resize_left_cursor"));
+ resize_left = new Cursor (Display::get_default(), p, 3, 10);
+ }
+
+ {
+ RefPtr<Pixbuf> p (::get_icon ("resize_top_left_cursor"));
+ resize_top_left = new Cursor (Display::get_default(), p, 3, 3);
+ }
+
+ {
+ RefPtr<Pixbuf> p (::get_icon ("resize_top_cursor"));
+ resize_top = new Cursor (Display::get_default(), p, 10, 3);
+ }
+
+ {
+ RefPtr<Pixbuf> p (::get_icon ("resize_top_right_cursor"));
+ resize_top_right = new Cursor (Display::get_default(), p, 18, 3);
+ }
+
+ {
+ RefPtr<Pixbuf> p (::get_icon ("resize_right_cursor"));
+ resize_right = new Cursor (Display::get_default(), p, 24, 10);
+ }
+
+ {
+ RefPtr<Pixbuf> p (::get_icon ("resize_bottom_right_cursor"));
+ resize_bottom_right = new Cursor (Display::get_default(), p, 18, 18);
+ }
+
+ {
+ RefPtr<Pixbuf> p (::get_icon ("resize_bottom_cursor"));
+ resize_bottom = new Cursor (Display::get_default(), p, 10, 24);
+ }
+
+ {
+ RefPtr<Pixbuf> p (::get_icon ("resize_bottom_left_cursor"));
+ resize_bottom_left = new Cursor (Display::get_default(), p, 3, 18);
+ }
+
+ {
+ RefPtr<Pixbuf> p (::get_icon ("move_cursor"));
+ move = new Cursor (Display::get_default(), p, 11, 11);
+ }
+
+ {
+ RefPtr<Pixbuf> p (::get_icon ("expand_left_right_cursor"));
+ expand_left_right = new Cursor (Display::get_default(), p, 11, 4);
+ }
+
+ {
+ RefPtr<Pixbuf> p (::get_icon ("expand_up_down_cursor"));
+ expand_up_down = new Cursor (Display::get_default(), p, 4, 11);
+ }
+
+ selector = new Cursor (XTERM);
+ time_fx = new Cursor (SIZING);
+ wait = new Cursor (WATCH);
+ timebar = new Cursor(LEFT_PTR);
+ midi_pencil = new Cursor (PENCIL);
+ midi_select = new Cursor (CENTER_PTR);
+ midi_resize = new Cursor (SIZING);
+ midi_erase = new Cursor (DRAPED_BOX);
+ up_down = new Cursor (SB_V_DOUBLE_ARROW);
+}
diff --git a/gtk2_ardour/mouse_cursors.h b/gtk2_ardour/mouse_cursors.h
new file mode 100644
index 0000000000..26fa9472a5
--- /dev/null
+++ b/gtk2_ardour/mouse_cursors.h
@@ -0,0 +1,66 @@
+/*
+ Copyright (C) 2000-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
+ 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.
+
+*/
+
+/** @file Handling of bitmaps to be used for mouse cursors.
+ *
+ * Held centrally by the Editor because some cursors are used in several places.
+ */
+
+class MouseCursors
+{
+public:
+ MouseCursors ();
+
+ Gdk::Cursor* cross_hair;
+ Gdk::Cursor* trimmer;
+ Gdk::Cursor* right_side_trim;
+ Gdk::Cursor* left_side_trim;
+ Gdk::Cursor* right_side_trim_left_only;
+ Gdk::Cursor* left_side_trim_right_only;
+ Gdk::Cursor* fade_in;
+ Gdk::Cursor* fade_out;
+ Gdk::Cursor* selector;
+ Gdk::Cursor* grabber;
+ Gdk::Cursor* grabber_note;
+ Gdk::Cursor* grabber_edit_point;
+ Gdk::Cursor* zoom_in;
+ Gdk::Cursor* zoom_out;
+ Gdk::Cursor* time_fx;
+ Gdk::Cursor* fader;
+ Gdk::Cursor* speaker;
+ Gdk::Cursor* midi_pencil;
+ Gdk::Cursor* midi_select;
+ Gdk::Cursor* midi_resize;
+ Gdk::Cursor* midi_erase;
+ Gdk::Cursor* up_down;
+ Gdk::Cursor* wait;
+ Gdk::Cursor* timebar;
+ Gdk::Cursor* transparent;
+ Gdk::Cursor* resize_left;
+ Gdk::Cursor* resize_top_left;
+ Gdk::Cursor* resize_top;
+ Gdk::Cursor* resize_top_right;
+ Gdk::Cursor* resize_right;
+ Gdk::Cursor* resize_bottom_right;
+ Gdk::Cursor* resize_bottom;
+ Gdk::Cursor* resize_bottom_left;
+ Gdk::Cursor* move;
+ Gdk::Cursor* expand_left_right;
+ Gdk::Cursor* expand_up_down;
+};
diff --git a/gtk2_ardour/public_editor.h b/gtk2_ardour/public_editor.h
index 711b069e25..c967786452 100644
--- a/gtk2_ardour/public_editor.h
+++ b/gtk2_ardour/public_editor.h
@@ -86,6 +86,7 @@ class ImageFrameView;
class ImageFrameTimeAxis;
class MarkerView;
class DragManager;
+class MouseCursors;
using ARDOUR::framepos_t;
using ARDOUR::framecnt_t;
@@ -380,6 +381,8 @@ class PublicEditor : public Gtk::Window, public PBD::StatefulDestructible {
virtual void maybe_autoscroll (bool, bool) = 0;
virtual void stop_canvas_autoscroll () = 0;
+ virtual MouseCursors const * cursors () const = 0;
+
/// Singleton instance, set up by Editor::Editor()
static PublicEditor* _instance;
diff --git a/gtk2_ardour/wscript b/gtk2_ardour/wscript
index 4c5f3daaea..218a2edaef 100644
--- a/gtk2_ardour/wscript
+++ b/gtk2_ardour/wscript
@@ -146,6 +146,7 @@ gtk2_ardour_sources = [
'mixer_strip.cc',
'mixer_ui.cc',
'monitor_section.cc',
+ 'mouse_cursors.cc',
'nag.cc',
'normalize_dialog.cc',
'note_player.cc',