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 MouseCursors::MouseCursors ()
30 , right_side_trim_left_only (0)
31 , left_side_trim_right_only (0)
37 , grabber_edit_point (0)
54 , resize_top_right (0)
56 , resize_bottom_right (0)
58 , resize_bottom_left (0)
60 , expand_left_right (0)
66 MouseCursors::drop_all ()
68 delete cross_hair; cross_hair = 0;
69 delete trimmer; trimmer = 0;
70 delete right_side_trim; right_side_trim = 0;
71 delete left_side_trim; left_side_trim = 0;
72 delete right_side_trim_left_only; right_side_trim_left_only = 0;
73 delete left_side_trim_right_only; left_side_trim_right_only = 0;
74 delete fade_in; fade_in = 0;
75 delete fade_out; fade_out = 0;
76 delete selector; selector = 0;
77 delete grabber; grabber = 0;
78 delete grabber_note; grabber_note = 0;
79 delete grabber_edit_point; grabber_edit_point = 0;
80 delete zoom_in; zoom_in = 0;
81 delete zoom_out; zoom_out = 0;
82 delete time_fx; time_fx = 0;
83 delete fader; fader = 0;
84 delete speaker; speaker = 0;
85 delete midi_pencil; midi_pencil = 0;
86 delete midi_select; midi_select = 0;
87 delete midi_resize; midi_resize = 0;
88 delete midi_erase; midi_erase = 0;
89 delete up_down; up_down = 0;
90 delete wait; wait = 0;
91 delete timebar; timebar = 0;
92 delete transparent; transparent = 0;
93 delete resize_left; resize_left = 0;
94 delete resize_top_left; resize_top_left = 0;
95 delete resize_top; resize_top = 0;
96 delete resize_top_right; resize_top_right = 0;
97 delete resize_right; resize_right = 0;
98 delete resize_bottom_right; resize_bottom_right = 0;
99 delete resize_bottom; resize_bottom = 0;
100 delete resize_bottom_left; resize_bottom_left = 0;
101 delete move; move = 0;
102 delete expand_left_right; expand_left_right = 0;
103 delete expand_up_down; expand_up_down = 0;
107 MouseCursors::set_cursor_set (const std::string& name)
109 using namespace Glib;
116 RefPtr<Pixbuf> p (::get_icon ("zoom_in_cursor", _cursor_set));
117 zoom_in = new Cursor (Display::get_default(), p, 10, 5);
121 RefPtr<Pixbuf> p (::get_icon ("zoom_out_cursor", _cursor_set));
122 zoom_out = new Cursor (Display::get_default(), p, 5, 5);
125 Color fbg ("#ffffff");
126 Color ffg ("#000000");
129 RefPtr<Bitmap> source = Bitmap::create ((char const *) fader_cursor_bits, fader_cursor_width, fader_cursor_height);
130 RefPtr<Bitmap> mask = Bitmap::create ((char const *) fader_cursor_mask_bits, fader_cursor_width, fader_cursor_height);
131 fader = new Cursor (source, mask, ffg, fbg, fader_cursor_x_hot, fader_cursor_y_hot);
135 RefPtr<Bitmap> source = Bitmap::create ((char const *) speaker_cursor_bits, speaker_cursor_width, speaker_cursor_height);
136 RefPtr<Bitmap> mask = Bitmap::create ((char const *) speaker_cursor_mask_bits, speaker_cursor_width, speaker_cursor_height);
137 speaker = new Cursor (source, mask, ffg, fbg, speaker_cursor_width >> 1, speaker_cursor_height >> 1);
141 char pix[4] = { 0, 0, 0, 0 };
142 RefPtr<Bitmap> bits = Bitmap::create (pix, 2, 2);
144 transparent = new Cursor (bits, bits, c, c, 0, 0);
148 char pix[4] = { 0, 0, 0, 0 };
149 RefPtr<Bitmap> bits = Bitmap::create (pix, 2, 2);
151 transparent = new Cursor (bits, bits, c, c, 0, 0);
155 RefPtr<Pixbuf> p (::get_icon ("grabber", _cursor_set));
156 grabber = new Cursor (Display::get_default(), p, 5, 0);
160 RefPtr<Pixbuf> p (::get_icon ("grabber_note", _cursor_set));
161 grabber_note = new Cursor (Display::get_default(), p, 5, 10);
165 RefPtr<Pixbuf> p (::get_icon ("grabber_edit_point", _cursor_set));
166 grabber_edit_point = new Cursor (Display::get_default(), p, 5, 17);
169 cross_hair = new Cursor (CROSSHAIR);
170 trimmer = new Cursor (SB_H_DOUBLE_ARROW);
173 RefPtr<Pixbuf> p (::get_icon ("trim_left_cursor", _cursor_set));
174 left_side_trim = new Cursor (Display::get_default(), p, 5, 11);
178 RefPtr<Pixbuf> p (::get_icon ("trim_right_cursor", _cursor_set));
179 right_side_trim = new Cursor (Display::get_default(), p, 23, 11);
183 RefPtr<Pixbuf> p (::get_icon ("trim_left_cursor_right_only", _cursor_set));
184 left_side_trim_right_only = new Cursor (Display::get_default(), p, 5, 11);
188 RefPtr<Pixbuf> p (::get_icon ("trim_right_cursor_left_only", _cursor_set));
189 right_side_trim_left_only = new Cursor (Display::get_default(), p, 23, 11);
193 RefPtr<Pixbuf> p (::get_icon ("fade_in_cursor", _cursor_set));
194 fade_in = new Cursor (Display::get_default(), p, 0, 0);
198 RefPtr<Pixbuf> p (::get_icon ("fade_out_cursor", _cursor_set));
199 fade_out = new Cursor (Display::get_default(), p, 29, 0);
203 RefPtr<Pixbuf> p (::get_icon ("resize_left_cursor", _cursor_set));
204 resize_left = new Cursor (Display::get_default(), p, 3, 10);
208 RefPtr<Pixbuf> p (::get_icon ("resize_top_left_cursor", _cursor_set));
209 resize_top_left = new Cursor (Display::get_default(), p, 3, 3);
213 RefPtr<Pixbuf> p (::get_icon ("resize_top_cursor", _cursor_set));
214 resize_top = new Cursor (Display::get_default(), p, 10, 3);
218 RefPtr<Pixbuf> p (::get_icon ("resize_top_right_cursor", _cursor_set));
219 resize_top_right = new Cursor (Display::get_default(), p, 18, 3);
223 RefPtr<Pixbuf> p (::get_icon ("resize_right_cursor", _cursor_set));
224 resize_right = new Cursor (Display::get_default(), p, 24, 10);
228 RefPtr<Pixbuf> p (::get_icon ("resize_bottom_right_cursor", _cursor_set));
229 resize_bottom_right = new Cursor (Display::get_default(), p, 18, 18);
233 RefPtr<Pixbuf> p (::get_icon ("resize_bottom_cursor", _cursor_set));
234 resize_bottom = new Cursor (Display::get_default(), p, 10, 24);
238 RefPtr<Pixbuf> p (::get_icon ("resize_bottom_left_cursor", _cursor_set));
239 resize_bottom_left = new Cursor (Display::get_default(), p, 3, 18);
243 RefPtr<Pixbuf> p (::get_icon ("move_cursor", _cursor_set));
244 move = new Cursor (Display::get_default(), p, 11, 11);
248 RefPtr<Pixbuf> p (::get_icon ("expand_left_right_cursor", _cursor_set));
249 expand_left_right = new Cursor (Display::get_default(), p, 11, 4);
253 RefPtr<Pixbuf> p (::get_icon ("expand_up_down_cursor", _cursor_set));
254 expand_up_down = new Cursor (Display::get_default(), p, 4, 11);
258 RefPtr<Pixbuf> p (::get_icon ("i_beam_cursor", _cursor_set));
259 selector = new Cursor (Display::get_default(), p, 4, 11);
262 time_fx = new Cursor (SIZING);
263 wait = new Cursor (WATCH);
264 timebar = new Cursor(LEFT_PTR);
265 midi_pencil = new Cursor (PENCIL);
266 midi_select = new Cursor (CENTER_PTR);
267 midi_resize = new Cursor (SIZING);
268 midi_erase = new Cursor (DRAPED_BOX);
269 up_down = new Cursor (SB_V_DOUBLE_ARROW);