* middle button click on FCEUX sends message to TAS Editor

* Shift/Ctrl set focus to Piano Roll, double Shift / double Ctrl scroll Piano Roll to respective cursor
This commit is contained in:
ansstuff 2012-03-10 20:12:22 +00:00
parent 0ef60e2c8a
commit a484b4eb15
8 changed files with 55 additions and 16 deletions

View File

@ -1399,7 +1399,7 @@ FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
CONTROL "",IDC_PROGRESS_BUTTON,"Button",BS_OWNERDRAW,199,36,116,12
CONTROL "",IDC_BRANCHES_BUTTON,"Button",BS_OWNERDRAW,206,167,104,11
CONTROL "",IDC_LIST1,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_ALIGNLEFT | LVS_OWNERDATA | LVS_NOSORTHEADER | WS_BORDER,5,13,186,320
CONTROL "",IDC_LIST1,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_ALIGNLEFT | LVS_OWNERDATA | LVS_NOSORTHEADER | WS_BORDER,4,13,187,320
GROUPBOX " Playback ",IDC_PLAYBACK_BOX,196,0,123,62,BS_CENTER,WS_EX_RIGHT
GROUPBOX " Recorder ",IDC_RECORDER_BOX,196,63,123,46,BS_CENTER,WS_EX_RIGHT
GROUPBOX " Splicer ",IDC_SPLICER_BOX,196,110,123,30,BS_CENTER,WS_EX_RIGHT

View File

@ -289,6 +289,7 @@ void UpdateTasEditor()
}
// update all modules that need to be updated every frame
taseditor_window.update();
recorder.update();
piano_roll.update();
markers_manager.update();

View File

@ -233,6 +233,7 @@ void PIANO_ROLL::free()
}
void PIANO_ROLL::reset()
{
vk_shift_release_time = vk_control_release_time = 0;
next_header_update_time = header_item_under_mouse = 0;
// delete all columns except 0th
while (ListView_DeleteColumn(hwndList, 1)) {}
@ -1078,8 +1079,27 @@ LRESULT APIENTRY ListWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
}
break;
}
case WM_KEYUP:
{
if (wParam == VK_SHIFT)
piano_roll.vk_shift_release_time = clock();
else if (wParam == VK_CONTROL)
piano_roll.vk_control_release_time = clock();
break;
}
case WM_KEYDOWN:
{
if (wParam == VK_SHIFT)
{
// double-tap of Shift key
if (piano_roll.vk_shift_release_time + GetDoubleClickTime() > clock())
piano_roll.FollowPlayback();
} else if (wParam == VK_CONTROL)
{
// double-tap of Ctrl key
if (piano_roll.vk_control_release_time + GetDoubleClickTime() > clock())
piano_roll.FollowSelection();
}
// only allow 8 keys
if (taseditor_config.keyboard_for_piano_roll && (wParam == VK_LEFT || wParam == VK_UP || wParam == VK_RIGHT || wParam == VK_DOWN || wParam == VK_END || wParam == VK_HOME || wParam == VK_PRIOR || wParam == VK_NEXT))
break;

View File

@ -12,8 +12,8 @@
#define HEADER_LIGHT_MAX 10
#define HEADER_LIGHT_HOLD 5
#define HEADER_LIGHT_MOUSEOVER 1
#define HEADER_LIGHT_MOUSEOVER_SEL 3
#define HEADER_LIGHT_MOUSEOVER 0
#define HEADER_LIGHT_UPDATE_TICK 40 // 25FPS
#define HEADER_DX_FIX 4
@ -67,7 +67,7 @@ enum
#define ARROW_IMAGE_ID 20
#define GREEN_ARROW_IMAGE_ID 21
#define COLUMN_ICONS_WIDTH 13
#define COLUMN_ICONS_WIDTH 16
#define COLUMN_FRAMENUM_WIDTH 75
#define COLUMN_BUTTON_WIDTH 21
@ -157,6 +157,10 @@ public:
int header_item_under_mouse;
HWND hwndList, hwndHeader;
TRACKMOUSEEVENT tme;
int vk_shift_release_time;
int vk_control_release_time;
// GDI stuff
HIMAGELIST himglist;
HFONT hMainListFont, hMainListSelectFont, hMarkersFont, hMarkersEditFont, hTaseditorAboutFont;

View File

@ -261,12 +261,9 @@ void PLAYBACK::MiddleButtonClick()
{
if (emu_paused)
{
if (pause_frame)
jump(pause_frame-1);
else if (lost_position_frame)
jump(lost_position_frame-1);
else
UnpauseEmulation();
if (!pause_frame && lost_position_frame)
pause_frame = lost_position_frame;
UnpauseEmulation();
} else
{
PauseEmulation();

View File

@ -70,7 +70,7 @@ TASEDITOR_CONFIG::TASEDITOR_CONFIG()
findnote_matchcase = false;
findnote_search_up = false;
enable_auto_function = true;
deselect_on_doubleclick = true;
deselect_on_doubleclick = false;
silent_autosave = true;
tooltips = true;
current_pattern = 0;

View File

@ -99,10 +99,10 @@ Window_items_struct window_items[TASEDITOR_WINDOW_TOTAL_ITEMS] = {
TASEDITOR_FIND_BEST_SIMILAR_MARKER, -1, -1, 0, -1, "Auto-search for Marker Note", "", false, 0, 0,
TASEDITOR_FIND_NEXT_SIMILAR_MARKER, -1, -1, 0, -1, "Continue Auto-search", "", false, 0, 0,
TASEDITOR_NEXT_MARKER, -1, -1, 0, -1, "Send Selection to next Marker (mouse: Ctrl+Wheel up) (hotkey: Ctrl+PageDown)", "", false, 0, 0,
IDC_JUMP_PLAYBACK_BUTTON, 0, 0, 0, 0, "Click here to scroll the Piano Roll to Playback cursor", "", false, 0, 0,
IDC_JUMP_PLAYBACK_BUTTON, 0, 0, 0, 0, "Click here to scroll Piano Roll to Playback cursor (hotkey: tap Shift twice)", "", false, 0, 0,
IDC_PLAYBACK_MARKER_EDIT, 0, 0, -1, 0, "Click to edit text", "", false, 0, 0,
IDC_PLAYBACK_MARKER, 0, 0, 0, 0, "", "", false, 0, 0,
IDC_JUMP_SELECTION_BUTTON, 0, -1, 0, -1, "Click here to scroll the Piano Roll to Selection", "", false, 0, 0,
IDC_JUMP_SELECTION_BUTTON, 0, -1, 0, -1, "Click here to scroll Piano Roll to Selection (hotkey: tap Ctrl twice)", "", false, 0, 0,
IDC_SELECTION_MARKER_EDIT, 0, -1, -1, -1, "Click to edit text", "", false, 0, 0,
IDC_SELECTION_MARKER, 0, -1, 0, -1, "", "", false, 0, 0,
IDC_BRANCHES_BITMAP, -1, 0, 0, 0, "This window visualizes the hierarchy of your Branches", "", false, 0, 0,
@ -243,7 +243,14 @@ void TASEDITOR_WINDOW::reset()
}
void TASEDITOR_WINDOW::update()
{
if (markers_manager.marker_note_edit == MARKER_NOTE_EDIT_NONE)
{
HWND cur_focus = GetFocus();
if (cur_focus != piano_roll.hwndList && cur_focus != hwndFindNote)
// set focus to Piano Roll when Shift or Ctrl are held
if ((GetAsyncKeyState(VK_CONTROL) < 0) || (GetAsyncKeyState(VK_SHIFT) < 0))
SetFocus(piano_roll.hwndList);
}
}
// --------------------------------------------------------------------------------
void TASEDITOR_WINDOW::CalculateItems()
@ -1243,7 +1250,7 @@ BOOL CALLBACK WndprocTasEditor(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPara
case ID_VIEW_FINDNOTE:
{
if (taseditor_window.hwndFindNote)
SetFocus(GetDlgItem(taseditor_window.hwndFindNote, IDC_NOTE_TO_FIND));
SendMessage(taseditor_window.hwndFindNote, WM_NEXTDLGCTL, (WPARAM)GetDlgItem(taseditor_window.hwndFindNote, IDC_NOTE_TO_FIND), true);
else
taseditor_window.hwndFindNote = CreateDialog(fceu_hInstance, MAKEINTRESOURCE(IDD_TASEDITOR_FINDNOTE), taseditor_window.hwndTasEditor, FindNoteProc);
break;

View File

@ -74,7 +74,9 @@
#include <cmath>
#include "taseditor/taseditor_window.h"
#include "taseditor/playback.h"
extern TASEDITOR_WINDOW taseditor_window;
extern PLAYBACK playback;
using namespace std;
@ -1236,6 +1238,13 @@ LRESULT FAR PASCAL AppWndProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam)
return 0;
}
case WM_MBUTTONDOWN:
{
if (taseditor_window.hwndTasEditor)
playback.MiddleButtonClick();
return 0;
}
case WM_RBUTTONUP:
{
// If TAS Editor is engaged, rightclick shouldn't popup menus, because right button is used with wheel input for TAS Editor's own purposes
@ -1268,6 +1277,7 @@ LRESULT FAR PASCAL AppWndProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam)
mouseb=wParam;
}
}
goto proco;
}
case WM_MOVE:
@ -1282,16 +1292,16 @@ LRESULT FAR PASCAL AppWndProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam)
WindowBoundsCheckNoResize(MainWindow_wndx,MainWindow_wndy,wrect.right);
#endif
}
goto proco;
}
case WM_MOUSEMOVE:
{
mousex=LOWORD(lParam);
mousey=HIWORD(lParam);
}
goto proco;
}
case WM_ERASEBKGND:
if(xbsave)
return(0);