* Taseditor: holding Shift when drawing lines

This commit is contained in:
ansstuff 2012-03-14 19:06:34 +00:00
parent 1eadc6f533
commit 853d9a0df0
6 changed files with 36 additions and 21 deletions

View File

@ -845,12 +845,12 @@ bool HISTORY::CursorOverHistoryList()
POINT p;
if (GetCursorPos(&p))
{
ScreenToClient(hwndHistoryList, &p);
RECT wrect;
GetWindowRect(hwndHistoryList, &wrect);
ScreenToClient(hwndHistoryList, &p);
if (p.x >= 0
&& p.y >= 0
&& p.x < window_items[HISTORYLIST_IN_WINDOWITEMS].width
&& p.x < (wrect.right - wrect.left)
&& p.y < (wrect.bottom - wrect.top))
return true;
}

View File

@ -44,7 +44,6 @@ extern HISTORY history;
extern MARKERS_MANAGER markers_manager;
extern SELECTION selection;
extern Window_items_struct window_items[];
extern int GetInputType(MovieData& md);
LRESULT APIENTRY HeaderWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
@ -285,11 +284,6 @@ void PIANO_ROLL::free()
DeleteObject(marker_drag_box_brush_bind);
marker_drag_box_brush_bind = 0;
}
if (bg_brush)
{
DeleteObject(bg_brush);
bg_brush = 0;
}
if (himglist)
{
ImageList_Destroy(himglist);
@ -381,7 +375,12 @@ void PIANO_ROLL::update()
{
case DRAG_MODE_PLAYBACK:
{
DragPlaybackCursor();
if (!playback.pause_frame || can_drag_when_seeking)
{
DragPlaybackCursor();
// after first seeking is finished (if there was any seeking), it now becomes possible to drag when seeking
can_drag_when_seeking = true;
}
break;
}
case DRAG_MODE_MARKER:
@ -428,6 +427,13 @@ void PIANO_ROLL::update()
int drawing_current_y = p.y + GetScrollPos(hwndList, SB_VERT) * list_row_height;
// draw (or erase) line from [drawing_current_x, drawing_current_y] to (drawing_last_x, drawing_last_y)
int total_dx = drawing_last_x - drawing_current_x, total_dy = drawing_last_y - drawing_current_y;
if (GetAsyncKeyState(VK_SHIFT) < 0)
{
// when user is holding Shift, draw vertical line
total_dx = 0;
drawing_current_x = drawing_last_x;
p.x = drawing_current_x - GetScrollPos(hwndList, SB_HORZ);
}
double total_len = sqrt((double)(total_dx * total_dx + total_dy * total_dy));
LVHITTESTINFO info;
int row_index, column_index, joy, bit;
@ -733,6 +739,16 @@ void PIANO_ROLL::SetHeaderColumnLight(int column, int level)
}
}
void PIANO_ROLL::StartDraggingPlaybackCursor()
{
if (drag_mode == DRAG_MODE_NONE)
{
drag_mode = DRAG_MODE_PLAYBACK;
can_drag_when_seeking = false;
// call it once
DragPlaybackCursor();
}
}
void PIANO_ROLL::DragPlaybackCursor()
{
POINT p;
@ -1513,8 +1529,7 @@ LRESULT APIENTRY ListWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
if(column_index == COLUMN_ICONS)
{
// click on the "icons" column
if (piano_roll.drag_mode == DRAG_MODE_NONE)
piano_roll.drag_mode = DRAG_MODE_PLAYBACK;
piano_roll.StartDraggingPlaybackCursor();
} else if(column_index == COLUMN_FRAMENUM || column_index == COLUMN_FRAMENUM2)
{
// clicked on the "Frame#" column
@ -1524,7 +1539,7 @@ LRESULT APIENTRY ListWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
if (taseditor_config.deselect_on_doubleclick)
selection.ClearSelection();
if (taseditor_config.doubleclick_affects_playback)
piano_roll.DragPlaybackCursor();
piano_roll.StartDraggingPlaybackCursor();
} else
{
if (row_index >= 0)
@ -1693,8 +1708,7 @@ LRESULT APIENTRY ListWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
// user clicked on left border of the Piano Roll
// consider this as a "misclick" on Piano Roll's first column
if (piano_roll.drag_mode == DRAG_MODE_NONE)
piano_roll.drag_mode = DRAG_MODE_PLAYBACK;
piano_roll.StartDraggingPlaybackCursor();
return 0;
}
}

View File

@ -156,8 +156,7 @@ public:
void SetHeaderColumnLight(int column, int level);
void DragPlaybackCursor();
void FinishDrag();
void StartDraggingPlaybackCursor();
void AcceleratorDispatched();
@ -183,6 +182,7 @@ public:
int list_row_top, list_row_height, list_header_height;
unsigned int drag_mode;
bool rbutton_drag_mode;
bool can_drag_when_seeking;
int marker_drag_box_dx, marker_drag_box_dy;
int marker_drag_framenum;
int drawing_last_x, drawing_last_y;
@ -201,6 +201,9 @@ public:
private:
void CenterListAt(int frame);
void DragPlaybackCursor();
void FinishDrag();
std::vector<uint8> header_colors;
int num_columns;
int next_header_update_time;

View File

@ -70,8 +70,8 @@ TASEDITOR_CONFIG::TASEDITOR_CONFIG()
findnote_matchcase = false;
findnote_search_up = false;
enable_auto_function = true;
deselect_on_doubleclick = false;
doubleclick_affects_playback = true;
deselect_on_doubleclick = true;
doubleclick_affects_playback = false;
draw_input = true;
silent_autosave = true;
tooltips = true;

View File

@ -1330,8 +1330,7 @@ BOOL CALLBACK WndprocTasEditor(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPara
&& y > window_items[PIANOROLL_IN_WINDOWITEMS].y
&& y < window_items[PIANOROLL_IN_WINDOWITEMS].y + (wrect.bottom - wrect.top))
{
if (piano_roll.drag_mode == DRAG_MODE_NONE)
piano_roll.drag_mode = DRAG_MODE_PLAYBACK;
piano_roll.StartDraggingPlaybackCursor();
}
if (GetFocus() != hWnd)
SetFocus(hWnd);

View File

@ -2,7 +2,6 @@
#define TASEDITOR_WINDOW_TOTAL_ITEMS 43
#define PIANOROLL_IN_WINDOWITEMS 2
#define HISTORYLIST_IN_WINDOWITEMS 18
#define TOOLTIP_TEXT_MAX_LEN 80
#define TOOLTIPS_AUTOPOP_TIMEOUT 30000