Taseditor: Ctrl + mid click = run to Selection cursor; Shift + mid click = run to nearest Marker

This commit is contained in:
ansstuff 2012-04-30 18:37:59 +00:00
parent 2dc196a0bd
commit 5194e662a3
4 changed files with 69 additions and 23 deletions

View File

@ -372,7 +372,8 @@ void PIANO_ROLL::update()
shift_count++;
if (shift_count >= DOUBLETAP_COUNT)
{
FollowPlayback();
if (taseditor_window.TASEditor_focus)
FollowPlayback();
shift_count = ctrl_count = 0;
}
} else
@ -388,7 +389,8 @@ void PIANO_ROLL::update()
ctrl_count++;
if (ctrl_count >= DOUBLETAP_COUNT)
{
FollowSelection();
if (taseditor_window.TASEditor_focus)
FollowSelection();
ctrl_count = shift_count = 0;
}
} else

View File

@ -31,6 +31,7 @@ extern bool turbo;
extern TASEDITOR_CONFIG taseditor_config;
extern TASEDITOR_WINDOW taseditor_window;
extern SELECTION selection;
extern MARKERS_MANAGER markers_manager;
extern GREENZONE greenzone;
extern PIANO_ROLL piano_roll;
@ -271,9 +272,38 @@ void PLAYBACK::MiddleButtonClick()
{
if (emu_paused)
{
if (!pause_frame && lost_position_frame)
pause_frame = lost_position_frame;
UnpauseEmulation();
// check if right mouse button is released
if (GetAsyncKeyState(GetSystemMetrics(SM_SWAPBUTTON) ? VK_LBUTTON : VK_RBUTTON) >= 0)
{
if (GetAsyncKeyState(VK_SHIFT) < 0)
{
// if Shift is held, set pause_frame to nearest Marker
int last_frame = markers_manager.GetMarkersSize() - 1;
int target_frame = currFrameCounter + 1;
for (; target_frame <= last_frame; ++target_frame)
if (markers_manager.GetMarker(target_frame)) break;
if (target_frame <= last_frame)
{
seeking_start_frame = currFrameCounter;
pause_frame = target_frame + 1; // stop at the Marker
}
} else if (GetAsyncKeyState(VK_CONTROL) < 0)
{
// if Ctrl is held, set pause_frame to Selection cursor
int selection_beginning = selection.GetCurrentSelectionBeginning();
if (selection_beginning > currFrameCounter)
{
seeking_start_frame = currFrameCounter;
pause_frame = selection_beginning + 1;
}
}
if (!pause_frame && lost_position_frame)
{
seeking_start_frame = currFrameCounter;
pause_frame = lost_position_frame;
}
UnpauseEmulation();
}
} else
{
PauseEmulation();
@ -329,9 +359,9 @@ void PLAYBACK::RewindFull(int speed)
}
int lastCursor = currFrameCounter;
if (index >= 0)
jump(index);
jump(index); // jump to the Marker
else
jump(0);
jump(0); // jump to the beginning of Piano Roll
if (lastCursor != currFrameCounter)
{
// redraw row where Playback cursor was (in case there's two or more RewindFulls before playback.update())
@ -341,7 +371,7 @@ void PLAYBACK::RewindFull(int speed)
}
void PLAYBACK::ForwardFull(int speed)
{
int last_frame = currMovieData.getNumRecords()-1;
int last_frame = markers_manager.GetMarkersSize() - 1;
int index = currFrameCounter + 1;
// jump trough "speed" amount of next markers
while (speed > 0)
@ -352,9 +382,9 @@ void PLAYBACK::ForwardFull(int speed)
}
int lastCursor = currFrameCounter;
if (index <= last_frame)
jump(index);
jump(index); // jump to Marker
else
jump(last_frame);
jump(currMovieData.getNumRecords() - 1); // jump to the end of Piano Roll
if (lastCursor != currFrameCounter)
{
// redraw row where Playback cursor was (in case there's two or more ForwardFulls before playback.update())
@ -399,9 +429,9 @@ void PLAYBACK::jump(int frame)
}
}
// returns true if a jump to the frame is made, false if started seeking outside greenzone or if nothing's done
bool PLAYBACK::JumpToFrame(int index)
{
// Returns true if a jump to the frame is made, false if started seeking outside greenzone or if nothing's done
if (index < 0) return false;
if (index >= greenzone.greenZoneCount)
{
@ -411,7 +441,7 @@ bool PLAYBACK::JumpToFrame(int index)
SeekingStart(index+1);
return false;
}
/* Handle jumps inside greenzone. */
// handle jumps inside greenzone
if (greenzone.loadTasSavestate(index))
{
turbo = false;
@ -419,7 +449,7 @@ bool PLAYBACK::JumpToFrame(int index)
if (pause_frame) SeekingStop();
return true;
}
//Search for an earlier frame with savestate
// search for an earlier frame with savestate
int i = (index>0)? index-1 : 0;
for (; i > 0; i--)
{

View File

@ -209,16 +209,16 @@ void SELECTION::JumpPrevMarker(int speed)
speed--;
}
if (index >= 0)
JumpToFrame(index);
JumpToFrame(index); // jump to the Marker
else
JumpToFrame(0);
JumpToFrame(0); // jump to the beginning of Piano Roll
}
void SELECTION::JumpNextMarker(int speed)
{
// if nothing is selected, consider playback cursor as current selection
int index = GetCurrentSelectionBeginning();
if (index < 0) index = currFrameCounter;
int last_frame = currMovieData.getNumRecords()-1;
int last_frame = markers_manager.GetMarkersSize() - 1;
// jump trough "speed" amount of previous markers
while (speed > 0)
{
@ -227,9 +227,9 @@ void SELECTION::JumpNextMarker(int speed)
speed--;
}
if (index <= last_frame)
JumpToFrame(index);
JumpToFrame(index); // jump to Marker
else
JumpToFrame(last_frame);
JumpToFrame(currMovieData.getNumRecords() - 1); // jump to the end of Piano Roll
}
void SELECTION::JumpToFrame(int frame)
{

View File

@ -208,7 +208,7 @@ void TASEDITOR_WINDOW::init()
if (window_items[i].tooltip_text_base[0])
{
window_items[i].tooltip_hwnd = CreateWindowEx(NULL, TOOLTIPS_CLASS, NULL,
WS_POPUP | TTS_ALWAYSTIP | TTS_BALLOON,
WS_POPUP | TTS_ALWAYSTIP | TTS_BALLOON | TTS_NOANIMATE | TTS_NOFADE,
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
hwndTasEditor, NULL,
@ -1470,8 +1470,6 @@ BOOL CALLBACK WndprocTasEditor(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPara
case WM_MBUTTONDOWN:
case WM_MBUTTONDBLCLK:
{
if (GetFocus() != hWnd)
SetFocus(hWnd);
playback.MiddleButtonClick();
break;
}
@ -1492,7 +1490,13 @@ LRESULT APIENTRY IDC_PLAYBACK_MARKER_WndProc(HWND hWnd, UINT msg, WPARAM wParam,
case WM_LBUTTONDOWN:
case WM_LBUTTONDBLCLK:
piano_roll.FollowPlayback();
break;
if (GetFocus() != hWnd)
SetFocus(hWnd);
return 0;
case WM_MBUTTONDOWN:
case WM_MBUTTONDBLCLK:
playback.MiddleButtonClick();
return 0;
}
return CallWindowProc(IDC_PLAYBACK_MARKER_oldWndProc, hWnd, msg, wParam, lParam);
}
@ -1504,7 +1508,13 @@ LRESULT APIENTRY IDC_SELECTION_MARKER_WndProc(HWND hWnd, UINT msg, WPARAM wParam
case WM_LBUTTONDBLCLK:
if (piano_roll.drag_mode != DRAG_MODE_SELECTION)
piano_roll.FollowSelection();
break;
if (GetFocus() != hWnd)
SetFocus(hWnd);
return 0;
case WM_MBUTTONDOWN:
case WM_MBUTTONDBLCLK:
playback.MiddleButtonClick();
return 0;
}
return CallWindowProc(IDC_SELECTION_MARKER_oldWndProc, hWnd, msg, wParam, lParam);
}
@ -1517,6 +1527,8 @@ LRESULT APIENTRY IDC_PROGRESS_BUTTON_WndProc(HWND hWnd, UINT msg, WPARAM wParam,
case WM_LBUTTONDOWN:
case WM_LBUTTONDBLCLK:
playback.CancelSeeking();
if (GetFocus() != hWnd)
SetFocus(hWnd);
return 0;
case WM_MBUTTONDOWN:
case WM_MBUTTONDBLCLK:
@ -1536,6 +1548,8 @@ LRESULT APIENTRY IDC_BRANCHES_BUTTON_WndProc(HWND hWnd, UINT msg, WPARAM wParam,
// click on "Bookmarks/Branches" - switch between Bookmarks List and Branches Tree
taseditor_config.view_branches_tree ^= 1;
bookmarks.RedrawBookmarksCaption();
if (GetFocus() != hWnd)
SetFocus(hWnd);
return 0;
case WM_MBUTTONDOWN:
case WM_MBUTTONDBLCLK: