2 Copyright (C) 2000-2010 Paul Davis
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 #include <gdkmm/cursor.h>
22 #include "mouse_cursors.h"
23 #include "editor_xpms"
25 using namespace ARDOUR_UI_UTILS;
27 MouseCursors::MouseCursors ()
32 , anchored_right_side_trim (0)
34 , anchored_left_side_trim (0)
35 , right_side_trim_left_only (0)
36 , left_side_trim_right_only (0)
42 , grabber_edit_point (0)
59 , resize_top_right (0)
61 , resize_bottom_right (0)
63 , resize_bottom_left (0)
65 , expand_left_right (0)
71 MouseCursors::drop_all ()
73 delete cross_hair; cross_hair = 0;
74 delete scissors; scissors = 0;
75 delete trimmer; trimmer = 0;
76 delete right_side_trim; right_side_trim = 0;
77 delete anchored_right_side_trim; anchored_right_side_trim = 0;
78 delete left_side_trim; left_side_trim = 0;
79 delete anchored_left_side_trim; anchored_left_side_trim = 0;
80 delete right_side_trim_left_only; right_side_trim_left_only = 0;
81 delete left_side_trim_right_only; left_side_trim_right_only = 0;
82 delete fade_in; fade_in = 0;
83 delete fade_out; fade_out = 0;
84 delete selector; selector = 0;
85 delete grabber; grabber = 0;
86 delete grabber_note; grabber_note = 0;
87 delete grabber_edit_point; grabber_edit_point = 0;
88 delete zoom_in; zoom_in = 0;
89 delete zoom_out; zoom_out = 0;
90 delete time_fx; time_fx = 0;
91 delete fader; fader = 0;
92 delete speaker; speaker = 0;
93 delete midi_pencil; midi_pencil = 0;
94 delete midi_select; midi_select = 0;
95 delete midi_resize; midi_resize = 0;
96 delete midi_erase; midi_erase = 0;
97 delete up_down; up_down = 0;
98 delete wait; wait = 0;
99 delete timebar; timebar = 0;
100 delete transparent; transparent = 0;
101 delete resize_left; resize_left = 0;
102 delete resize_top_left; resize_top_left = 0;
103 delete resize_top; resize_top = 0;
104 delete resize_top_right; resize_top_right = 0;
105 delete resize_right; resize_right = 0;
106 delete resize_bottom_right; resize_bottom_right = 0;
107 delete resize_bottom; resize_bottom = 0;
108 delete resize_bottom_left; resize_bottom_left = 0;
109 delete move; move = 0;
110 delete expand_left_right; expand_left_right = 0;
111 delete expand_up_down; expand_up_down = 0;
115 MouseCursors::set_cursor_set (const std::string& name)
117 using namespace Glib;
124 RefPtr<Pixbuf> p (::get_icon ("zoom_in_cursor", _cursor_set));
125 zoom_in = new Cursor (Display::get_default(), p, 10, 5);
129 RefPtr<Pixbuf> p (::get_icon ("zoom_out_cursor", _cursor_set));
130 zoom_out = new Cursor (Display::get_default(), p, 5, 5);
133 Color fbg ("#ffffff");
134 Color ffg ("#000000");
137 RefPtr<Bitmap> source = Bitmap::create ((char const *) fader_cursor_bits, fader_cursor_width, fader_cursor_height);
138 RefPtr<Bitmap> mask = Bitmap::create ((char const *) fader_cursor_mask_bits, fader_cursor_width, fader_cursor_height);
139 fader = new Cursor (source, mask, ffg, fbg, fader_cursor_x_hot, fader_cursor_y_hot);
143 RefPtr<Bitmap> source = Bitmap::create ((char const *) speaker_cursor_bits, speaker_cursor_width, speaker_cursor_height);
144 RefPtr<Bitmap> mask = Bitmap::create ((char const *) speaker_cursor_mask_bits, speaker_cursor_width, speaker_cursor_height);
145 speaker = new Cursor (source, mask, ffg, fbg, speaker_cursor_width >> 1, speaker_cursor_height >> 1);
149 char pix[4] = { 0, 0, 0, 0 };
150 RefPtr<Bitmap> bits = Bitmap::create (pix, 2, 2);
152 transparent = new Cursor (bits, bits, c, c, 0, 0);
156 char pix[4] = { 0, 0, 0, 0 };
157 RefPtr<Bitmap> bits = Bitmap::create (pix, 2, 2);
159 transparent = new Cursor (bits, bits, c, c, 0, 0);
163 RefPtr<Pixbuf> p (::get_icon ("scissors", _cursor_set));
164 scissors = new Cursor (Display::get_default(), p, 5, 0);
168 RefPtr<Pixbuf> p (::get_icon ("grabber", _cursor_set));
169 grabber = new Cursor (Display::get_default(), p, 5, 0);
173 RefPtr<Pixbuf> p (::get_icon ("grabber_note", _cursor_set));
174 grabber_note = new Cursor (Display::get_default(), p, 5, 10);
178 RefPtr<Pixbuf> p (::get_icon ("grabber_edit_point", _cursor_set));
179 grabber_edit_point = new Cursor (Display::get_default(), p, 5, 17);
182 cross_hair = new Cursor (CROSSHAIR);
183 trimmer = new Cursor (SB_H_DOUBLE_ARROW);
186 RefPtr<Pixbuf> p (::get_icon ("trim_left_cursor", _cursor_set));
187 left_side_trim = new Cursor (Display::get_default(), p, 5, 11);
191 RefPtr<Pixbuf> p (::get_icon ("anchored_trim_left_cursor", _cursor_set));
192 anchored_left_side_trim = new Cursor (Display::get_default(), p, 5, 11);
196 RefPtr<Pixbuf> p (::get_icon ("trim_right_cursor", _cursor_set));
197 right_side_trim = new Cursor (Display::get_default(), p, 23, 11);
201 RefPtr<Pixbuf> p (::get_icon ("anchored_trim_right_cursor", _cursor_set));
202 anchored_right_side_trim = new Cursor (Display::get_default(), p, 23, 11);
206 RefPtr<Pixbuf> p (::get_icon ("trim_left_cursor_right_only", _cursor_set));
207 left_side_trim_right_only = new Cursor (Display::get_default(), p, 5, 11);
211 RefPtr<Pixbuf> p (::get_icon ("trim_right_cursor_left_only", _cursor_set));
212 right_side_trim_left_only = new Cursor (Display::get_default(), p, 23, 11);
216 RefPtr<Pixbuf> p (::get_icon ("fade_in_cursor", _cursor_set));
217 fade_in = new Cursor (Display::get_default(), p, 0, 0);
221 RefPtr<Pixbuf> p (::get_icon ("fade_out_cursor", _cursor_set));
222 fade_out = new Cursor (Display::get_default(), p, 29, 0);
226 RefPtr<Pixbuf> p (::get_icon ("resize_left_cursor", _cursor_set));
227 resize_left = new Cursor (Display::get_default(), p, 3, 10);
231 RefPtr<Pixbuf> p (::get_icon ("resize_top_left_cursor", _cursor_set));
232 resize_top_left = new Cursor (Display::get_default(), p, 3, 3);
236 RefPtr<Pixbuf> p (::get_icon ("resize_top_cursor", _cursor_set));
237 resize_top = new Cursor (Display::get_default(), p, 10, 3);
241 RefPtr<Pixbuf> p (::get_icon ("resize_top_right_cursor", _cursor_set));
242 resize_top_right = new Cursor (Display::get_default(), p, 18, 3);
246 RefPtr<Pixbuf> p (::get_icon ("resize_right_cursor", _cursor_set));
247 resize_right = new Cursor (Display::get_default(), p, 24, 10);
251 RefPtr<Pixbuf> p (::get_icon ("resize_bottom_right_cursor", _cursor_set));
252 resize_bottom_right = new Cursor (Display::get_default(), p, 18, 18);
256 RefPtr<Pixbuf> p (::get_icon ("resize_bottom_cursor", _cursor_set));
257 resize_bottom = new Cursor (Display::get_default(), p, 10, 24);
261 RefPtr<Pixbuf> p (::get_icon ("resize_bottom_left_cursor", _cursor_set));
262 resize_bottom_left = new Cursor (Display::get_default(), p, 3, 18);
266 RefPtr<Pixbuf> p (::get_icon ("move_cursor", _cursor_set));
267 move = new Cursor (Display::get_default(), p, 11, 11);
271 RefPtr<Pixbuf> p (::get_icon ("expand_left_right_cursor", _cursor_set));
272 expand_left_right = new Cursor (Display::get_default(), p, 11, 4);
276 RefPtr<Pixbuf> p (::get_icon ("expand_up_down_cursor", _cursor_set));
277 expand_up_down = new Cursor (Display::get_default(), p, 4, 11);
281 RefPtr<Pixbuf> p (::get_icon ("i_beam_cursor", _cursor_set));
282 selector = new Cursor (Display::get_default(), p, 4, 11);
285 time_fx = new Cursor (SIZING);
286 wait = new Cursor (WATCH);
287 timebar = new Cursor(LEFT_PTR);
288 midi_pencil = new Cursor (PENCIL);
289 midi_select = new Cursor (CENTER_PTR);
290 midi_resize = new Cursor (SIZING);
291 midi_erase = new Cursor (DRAPED_BOX);
292 up_down = new Cursor (SB_V_DOUBLE_ARROW);