do most of the work related to adding new anchored trim cursors (but debugging/analysis continues)
This commit is contained in:
parent
f312113163
commit
f7844f4893
@ -500,6 +500,7 @@ Editor::Editor ()
|
||||
|
||||
_cursors = new MouseCursors;
|
||||
_cursors->set_cursor_set (ARDOUR_UI::config()->get_icon_set());
|
||||
cerr << "Set cursor set to " << ARDOUR_UI::config()->get_icon_set() << endl;
|
||||
|
||||
ArdourCanvas::GtkCanvas* time_pad = manage (new ArdourCanvas::GtkCanvas ());
|
||||
|
||||
@ -5428,6 +5429,9 @@ void
|
||||
Editor::ui_parameter_changed (string parameter)
|
||||
{
|
||||
if (parameter == "icon-set") {
|
||||
while (!_cursor_stack.empty()) {
|
||||
_cursor_stack.pop();
|
||||
}
|
||||
_cursors->set_cursor_set (ARDOUR_UI::config()->get_icon_set());
|
||||
}
|
||||
}
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include <list>
|
||||
#include <map>
|
||||
#include <set>
|
||||
#include <stack>
|
||||
#include <string>
|
||||
#include <sys/time.h>
|
||||
#include <cmath>
|
||||
@ -422,6 +423,10 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
|
||||
|
||||
Gdk::Cursor* get_canvas_cursor () const { return current_canvas_cursor; }
|
||||
void set_canvas_cursor (Gdk::Cursor*, bool save=false);
|
||||
|
||||
void push_canvas_cursor (Gdk::Cursor*);
|
||||
void pop_canvas_cursor ();
|
||||
|
||||
void set_current_trimmable (boost::shared_ptr<ARDOUR::Trimmable>);
|
||||
void set_current_movable (boost::shared_ptr<ARDOUR::Movable>);
|
||||
|
||||
@ -696,6 +701,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
|
||||
Gtk::VBox global_vpacker;
|
||||
Gtk::VBox vpacker;
|
||||
|
||||
std::stack<Gdk::Cursor*> _cursor_stack;
|
||||
Gdk::Cursor* current_canvas_cursor;
|
||||
Gdk::Cursor* which_grabber_cursor ();
|
||||
void set_canvas_cursor ();
|
||||
|
@ -904,6 +904,25 @@ Editor::set_canvas_cursor (Gdk::Cursor* cursor, bool save)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Editor::push_canvas_cursor (Gdk::Cursor* cursor)
|
||||
{
|
||||
if (cursor) {
|
||||
_cursor_stack.push (cursor);
|
||||
set_canvas_cursor (cursor, false);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Editor::pop_canvas_cursor ()
|
||||
{
|
||||
if (!_cursor_stack.empty()) {
|
||||
Gdk::Cursor* cursor = _cursor_stack.top ();
|
||||
_cursor_stack.pop ();
|
||||
set_canvas_cursor (cursor, false);
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
Editor::track_canvas_key_press (GdkEventKey*)
|
||||
{
|
||||
|
@ -281,11 +281,10 @@ Drag::start_grab (GdkEvent* event, Gdk::Cursor *cursor)
|
||||
|
||||
if (cursor == 0) {
|
||||
_item->grab ();
|
||||
|
||||
} else {
|
||||
/* CAIROCANVAS need a variant here that passes *cursor */
|
||||
_item->grab ();
|
||||
|
||||
_editor->push_canvas_cursor (cursor);
|
||||
}
|
||||
|
||||
if (_editor->session() && _editor->session()->transport_rolling()) {
|
||||
@ -322,6 +321,7 @@ Drag::end_grab (GdkEvent* event)
|
||||
finished (event, _move_threshold_passed);
|
||||
|
||||
_editor->verbose_cursor()->hide ();
|
||||
_editor->pop_canvas_cursor ();
|
||||
|
||||
return _move_threshold_passed;
|
||||
}
|
||||
@ -1932,6 +1932,8 @@ TrimDrag::start_grab (GdkEvent* event, Gdk::Cursor*)
|
||||
|
||||
framepos_t const pf = adjusted_current_frame (event);
|
||||
|
||||
cerr << "Button state = " << hex << event->button.state << dec << endl;
|
||||
|
||||
if (Keyboard::modifier_state_equals (event->button.state, Keyboard::PrimaryModifier)) {
|
||||
/* Move the contents of the region around without changing the region bounds */
|
||||
_operation = ContentsTrim;
|
||||
@ -1941,11 +1943,22 @@ TrimDrag::start_grab (GdkEvent* event, Gdk::Cursor*)
|
||||
if (pf < (region_start + region_length/2)) {
|
||||
/* closer to front */
|
||||
_operation = StartTrim;
|
||||
Drag::start_grab (event, _editor->cursors()->left_side_trim);
|
||||
|
||||
if (Keyboard::modifier_state_equals (event->button.state, Keyboard::TertiaryModifier)) {
|
||||
cerr << "start anchored leftdrag\n";
|
||||
Drag::start_grab (event, _editor->cursors()->anchored_left_side_trim);
|
||||
} else {
|
||||
Drag::start_grab (event, _editor->cursors()->left_side_trim);
|
||||
}
|
||||
} else {
|
||||
/* closer to end */
|
||||
_operation = EndTrim;
|
||||
Drag::start_grab (event, _editor->cursors()->right_side_trim);
|
||||
if (Keyboard::modifier_state_equals (event->button.state, Keyboard::TertiaryModifier)) {
|
||||
Drag::start_grab (event, _editor->cursors()->anchored_right_side_trim);
|
||||
cerr << "start anchored right drag\n";
|
||||
} else {
|
||||
Drag::start_grab (event, _editor->cursors()->right_side_trim);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1984,6 +1997,8 @@ TrimDrag::motion (GdkEvent* event, bool first_move)
|
||||
pair<set<boost::shared_ptr<Playlist> >::iterator,bool> insert_result;
|
||||
frameoffset_t frame_delta = 0;
|
||||
|
||||
cerr << "trim drag @ " << this << " motion\n";
|
||||
|
||||
if (tv && tv->is_track()) {
|
||||
speed = tv->track()->speed();
|
||||
}
|
||||
|
@ -26,7 +26,9 @@ MouseCursors::MouseCursors ()
|
||||
: cross_hair (0)
|
||||
, trimmer (0)
|
||||
, right_side_trim (0)
|
||||
, anchored_right_side_trim (0)
|
||||
, left_side_trim (0)
|
||||
, anchored_left_side_trim (0)
|
||||
, right_side_trim_left_only (0)
|
||||
, left_side_trim_right_only (0)
|
||||
, fade_in (0)
|
||||
@ -68,7 +70,9 @@ MouseCursors::drop_all ()
|
||||
delete cross_hair; cross_hair = 0;
|
||||
delete trimmer; trimmer = 0;
|
||||
delete right_side_trim; right_side_trim = 0;
|
||||
delete anchored_right_side_trim; anchored_right_side_trim = 0;
|
||||
delete left_side_trim; left_side_trim = 0;
|
||||
delete anchored_left_side_trim; anchored_left_side_trim = 0;
|
||||
delete right_side_trim_left_only; right_side_trim_left_only = 0;
|
||||
delete left_side_trim_right_only; left_side_trim_right_only = 0;
|
||||
delete fade_in; fade_in = 0;
|
||||
@ -174,11 +178,21 @@ MouseCursors::set_cursor_set (const std::string& name)
|
||||
left_side_trim = new Cursor (Display::get_default(), p, 5, 11);
|
||||
}
|
||||
|
||||
{
|
||||
RefPtr<Pixbuf> p (::get_icon ("anchored_trim_left_cursor", _cursor_set));
|
||||
anchored_left_side_trim = new Cursor (Display::get_default(), p, 5, 11);
|
||||
}
|
||||
|
||||
{
|
||||
RefPtr<Pixbuf> p (::get_icon ("trim_right_cursor", _cursor_set));
|
||||
right_side_trim = new Cursor (Display::get_default(), p, 23, 11);
|
||||
}
|
||||
|
||||
{
|
||||
RefPtr<Pixbuf> p (::get_icon ("anchored_trim_right_cursor", _cursor_set));
|
||||
anchored_right_side_trim = new Cursor (Display::get_default(), p, 23, 11);
|
||||
}
|
||||
|
||||
{
|
||||
RefPtr<Pixbuf> p (::get_icon ("trim_left_cursor_right_only", _cursor_set));
|
||||
left_side_trim_right_only = new Cursor (Display::get_default(), p, 5, 11);
|
||||
|
@ -36,7 +36,9 @@ public:
|
||||
Gdk::Cursor* cross_hair;
|
||||
Gdk::Cursor* trimmer;
|
||||
Gdk::Cursor* right_side_trim;
|
||||
Gdk::Cursor* anchored_right_side_trim;
|
||||
Gdk::Cursor* left_side_trim;
|
||||
Gdk::Cursor* anchored_left_side_trim;
|
||||
Gdk::Cursor* right_side_trim_left_only;
|
||||
Gdk::Cursor* left_side_trim_right_only;
|
||||
Gdk::Cursor* fade_in;
|
||||
|
@ -698,10 +698,12 @@ get_icon_path (const char* cname, string icon_set)
|
||||
name += X_(".png");
|
||||
|
||||
Searchpath spath(ARDOUR::ardour_data_search_path());
|
||||
|
||||
|
||||
if (!icon_set.empty() && icon_set != _("default")) {
|
||||
string subdir = Glib::build_filename ("icons", icon_set);
|
||||
spath.add_subdirectory_to_paths (subdir);
|
||||
|
||||
/* add "icons/icon_set" but .. not allowed to add both of these at once */
|
||||
spath.add_subdirectory_to_paths ("icons");
|
||||
spath.add_subdirectory_to_paths (icon_set);
|
||||
|
||||
find_file_in_search_path (spath, name, data_file_path);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user