From fc82f943052712dab28e6f9abc4820802611a779 Mon Sep 17 00:00:00 2001 From: EvanR Date: Tue, 26 May 2009 15:14:26 -0400 Subject: [PATCH] Added changing cursors to indicate resizing and moving. And removed the ad-hoc arrow graphics. However their remnant code is still largely intact since the state flags for those arrow graphics was used for the cursor changes. --- src/arranger.cpp | 34 ++++++++++++++++++++++++++-------- src/pianoroll.cpp | 30 ++++++++++++++++++++---------- 2 files changed, 46 insertions(+), 18 deletions(-) diff --git a/src/arranger.cpp b/src/arranger.cpp index 4a149ca..b49c61f 100644 --- a/src/arranger.cpp +++ b/src/arranger.cpp @@ -27,6 +27,8 @@ #include #include +#include + #include "ui.h" #include "uihelper.h" @@ -102,6 +104,10 @@ int Arranger::handle(int event){ case fltk::FOCUS: return 1; case fltk::ENTER: + //cursor(fltk::CURSOR_WE); + return 1; + case fltk::LEAVE: + //cursor(fltk::CURSOR_DEFAULT); return 1; case fltk::KEYUP: @@ -249,6 +255,7 @@ int Arranger::handle(int event){ move_x = X+scrollx; move_y = Y+scrolly; move_offset = xpix2tick(X+scrollx)/q_tick*q_tick - s->tick; + cursor(fltk::CURSOR_MOVE); } } } @@ -353,16 +360,19 @@ lresize_torig; else if(move_flag){ apply_move(); move_flag = 0; + cursor(fltk::CURSOR_DEFAULT); } else if(rresize_flag){ apply_rresize(); rresize_flag = 0; resize_arrow = 0; + cursor(fltk::CURSOR_DEFAULT); } else if(lresize_flag){ apply_lresize(); lresize_flag = 0; resize_arrow = 0; + cursor(fltk::CURSOR_DEFAULT); } insert_flag=0; @@ -383,6 +393,7 @@ lresize_torig; } delete_flag=0; resize_arrow = 0; + cursor(fltk::CURSOR_DEFAULT); } @@ -422,6 +433,8 @@ lresize_torig; resize_x = tick2xpix(s->tick + s->dur)-scrollx-resize_handle_width-1; resize_y = s->track*30-scrolly; redraw(); + + cursor(fltk::CURSOR_WE); } } else if(over_lhandle(s)){ @@ -433,11 +446,14 @@ lresize_torig; resize_x = tick2xpix(s->tick)+1 - scrollx; resize_y = s->track*30 - scrolly; redraw(); + + cursor(fltk::CURSOR_WE); } } else{ if(resize_arrow != 0){ resize_arrow=0; + cursor(fltk::CURSOR_DEFAULT); redraw(); } } @@ -454,6 +470,7 @@ lresize_torig; } if(resize_arrow != 0){ resize_arrow=0; + cursor(fltk::CURSOR_DEFAULT); redraw_question = 1; } if(redraw_question){redraw();} @@ -464,6 +481,7 @@ lresize_torig; return 0; } + void Arranger::draw(){ fltk::push_clip(0,0,w(),h()); @@ -682,10 +700,10 @@ void Arranger::draw(){ int X = resize_x; int Y = resize_y; - addvertex(X,Y); - addvertex(X,Y+H); - addvertex(X+W,Y+H/2); - fillpath(); + //addvertex(X,Y); + //addvertex(X,Y+H); + //addvertex(X+W,Y+H/2); + //fillpath(); } else if(resize_arrow < 0){ setcolor(resize_arrow_color); @@ -695,10 +713,10 @@ void Arranger::draw(){ int X = resize_x; int Y = resize_y; - addvertex(X+W,Y); - addvertex(X+W,Y+H); - addvertex(X,Y+H/2); - fillpath(); + //addvertex(X+W,Y); + //addvertex(X+W,Y+H); + //addvertex(X,Y+H/2); + //fillpath(); } } diff --git a/src/pianoroll.cpp b/src/pianoroll.cpp index 1ddf846..78d499c 100644 --- a/src/pianoroll.cpp +++ b/src/pianoroll.cpp @@ -26,6 +26,8 @@ #include +#include + #include #include @@ -108,6 +110,7 @@ int PianoRoll::handle(int event){ delete_flag = 0; redraw(); resize_arrow = 0; + cursor(fltk::CURSOR_DEFAULT); ui->event_edit->redraw(); return 1; } @@ -202,7 +205,7 @@ int PianoRoll::handle(int event){ } else{//begin move move_flag = 1; - + cursor(fltk::CURSOR_MOVE); move_torig = e->tick; move_qoffset = e->tick - quantize(e->tick); @@ -314,12 +317,14 @@ int PianoRoll::handle(int event){ apply_rresize(); rresize_flag = 0; resize_arrow = 0; + cursor(fltk::CURSOR_DEFAULT); ui->event_edit->redraw(); } else if(lresize_flag){ apply_lresize(); lresize_flag = 0; resize_arrow = 0; + cursor(fltk::CURSOR_DEFAULT); ui->event_edit->redraw(); } else if(insert_flag){ @@ -337,7 +342,7 @@ int PianoRoll::handle(int event){ else if(move_flag){ apply_move(); move_flag = 0; - + cursor(fltk::CURSOR_DEFAULT); midi_track_off(cur_seqpat->track); ui->keyboard->release_note(last_note,0); @@ -361,6 +366,7 @@ int PianoRoll::handle(int event){ } delete_flag=0; resize_arrow = 0; + cursor(fltk::CURSOR_DEFAULT); } redraw(); @@ -376,6 +382,7 @@ int PianoRoll::handle(int event){ else{resize_arrow_color = fltk::color(95,58,119);} resize_e = e; resize_arrow = 1; + cursor(fltk::CURSOR_WE); resize_x = tick2xpix(e->tick + e->dur)-scrollx-resize_handle_width; resize_y = note2ypix(e->value1)-scrolly; redraw(); @@ -387,6 +394,7 @@ int PianoRoll::handle(int event){ else{resize_arrow_color = fltk::color(95,58,119);} resize_e = e; resize_arrow = -1; + cursor(fltk::CURSOR_WE); resize_x = tick2xpix(e->tick)+1 - scrollx; resize_y = note2ypix(e->value1) - scrolly; redraw(); @@ -396,6 +404,7 @@ int PianoRoll::handle(int event){ if(resize_e != e || resize_arrow != 0){ resize_e = e; resize_arrow = 0; + cursor(fltk::CURSOR_DEFAULT); redraw(); } } @@ -403,6 +412,7 @@ int PianoRoll::handle(int event){ else{ if(resize_arrow != 0){ resize_arrow = 0; + cursor(fltk::CURSOR_DEFAULT); redraw(); } } @@ -557,10 +567,10 @@ void PianoRoll::draw(){ int X = resize_x; int Y = resize_y; - addvertex(X,Y); - addvertex(X,Y+H); - addvertex(X+W,Y+H/2); - fillpath(); + //addvertex(X,Y); + //addvertex(X,Y+H); + //addvertex(X+W,Y+H/2); + //fillpath(); } else if(resize_arrow < 0){ setcolor(resize_arrow_color); @@ -570,10 +580,10 @@ void PianoRoll::draw(){ int X = resize_x; int Y = resize_y; - addvertex(X+W,Y); - addvertex(X+W,Y+H); - addvertex(X,Y+H/2); - fillpath(); + //addvertex(X+W,Y); + //addvertex(X+W,Y+H); + //addvertex(X,Y+H/2); + //fillpath(); } } -- 2.11.4.GIT