* Taseditor: BookmarksList clicks apply on buttonup only

* returned default mapping of Frame Advance hotkey to Backslash
* updated documentation on fm2 format

[[Split portion of a mixed commit.]]
This commit is contained in:
ansstuff 2012-03-25 15:37:45 +00:00
parent 8319946675
commit 893d871902
8 changed files with 102 additions and 35 deletions

View File

@ -1,4 +1,6 @@
25-Mar-2012 - AnS - returned default mapping of Frame Advance hotkey to Backslash
25-Mar-2012 - AnS - Taseditor: BookmarksList clicks apply on buttonup only
22-Mar-2012 - AnS - Config->Combine consecutive Recordings/Draws 22-Mar-2012 - AnS - Config->Combine consecutive Recordings/Draws
18-Mar-2012 - AnS - new hotkey "Cancel Seeking (TAS Editor)" (Esc) 18-Mar-2012 - AnS - new hotkey "Cancel Seeking (TAS Editor)" (Esc)
18-Mar-2012 - AnS - Taseditor: Config->Autopause at the end of Movie 18-Mar-2012 - AnS - Taseditor: Config->Autopause at the end of Movie
@ -34,7 +36,7 @@
13-feb-2012 - AnS - Replay dialog speedup, now movie is not loaded into memory when checking md5 13-feb-2012 - AnS - Replay dialog speedup, now movie is not loaded into memory when checking md5
06-feb-2012 - AnS - new Lua scripts: SoundDisplay.lua, TrackNoise.lua 06-feb-2012 - AnS - new Lua scripts: SoundDisplay.lua, TrackNoise.lua
06-feb-2012 - AnS - refined Recording, now can safely record commands (Power, Reset, Insert, Switch) 06-feb-2012 - AnS - refined Recording, now can safely record commands (Power, Reset, Insert, Switch)
02-feb-2012 - AnS - updated fceux.chm and online documentation, uploaded HelpNDoc3 project file 02-feb-2012 - AnS - uploaded HelpNDoc3 project file
02-feb-2012 - AnS - added Lua scripts demonstrating some TAS Editor library functions 02-feb-2012 - AnS - added Lua scripts demonstrating some TAS Editor library functions
02-feb-2012 - AnS - new Lua function in TAS Editor library: getsuperimpose() 02-feb-2012 - AnS - new Lua function in TAS Editor library: getsuperimpose()
02-feb-2012 - AnS - new Lua function in Joypad library: getimmediate() 02-feb-2012 - AnS - new Lua function in Joypad library: getimmediate()

Binary file not shown.

View File

@ -24,7 +24,7 @@ static struct
{ {
{ EMUCMD_RESET, SCAN_R | CMD_KEY_CTRL, }, { EMUCMD_RESET, SCAN_R | CMD_KEY_CTRL, },
{ EMUCMD_PAUSE, SCAN_PAUSE, }, { EMUCMD_PAUSE, SCAN_PAUSE, },
{ EMUCMD_FRAME_ADVANCE, SCAN_TILDE, }, { EMUCMD_FRAME_ADVANCE, SCAN_BACKSLASH, },
{ EMUCMD_SCREENSHOT, SCAN_F12, }, { EMUCMD_SCREENSHOT, SCAN_F12, },
{ EMUCMD_HIDE_MENU_TOGGLE, SCAN_ESCAPE }, { EMUCMD_HIDE_MENU_TOGGLE, SCAN_ESCAPE },
{ EMUCMD_SPEED_SLOWER, SCAN_MINUS, }, { EMUCMD_SPEED_SLOWER, SCAN_MINUS, },

View File

@ -1,6 +1,8 @@
// Specification file for Bookmark class // Specification file for Bookmark class
#define FLASH_PHASE_MAX 11 #define FLASH_PHASE_MAX 11
#define FLASH_PHASE_BUTTONHELD 6
enum enum
{ {
FLASH_TYPE_SET = 0, FLASH_TYPE_SET = 0,
@ -31,8 +33,6 @@ public:
std::vector<uint8> savestate; std::vector<uint8> savestate;
std::vector<uint8> saved_screenshot; std::vector<uint8> saved_screenshot;
//int parent_branch;
// not saved vars // not saved vars
int flash_phase; int flash_phase;
int flash_type; int flash_type;

View File

@ -82,15 +82,15 @@ void BOOKMARKS::init()
LVCOLUMN lvc; LVCOLUMN lvc;
// icons column // icons column
lvc.mask = LVCF_WIDTH; lvc.mask = LVCF_WIDTH;
lvc.cx = 13; lvc.cx = BOOKMARKSLIST_COLUMN_ICONS_WIDTH;
ListView_InsertColumn(hwndBookmarksList, 0, &lvc); ListView_InsertColumn(hwndBookmarksList, 0, &lvc);
// jump_frame column // jump_frame column
lvc.mask = LVCF_WIDTH | LVCF_FMT; lvc.mask = LVCF_WIDTH | LVCF_FMT;
lvc.fmt = LVCFMT_CENTER; lvc.fmt = LVCFMT_CENTER;
lvc.cx = 74; lvc.cx = BOOKMARKSLIST_COLUMN_FRAMENUM_WIDTH;
ListView_InsertColumn(hwndBookmarksList, 1, &lvc); ListView_InsertColumn(hwndBookmarksList, 1, &lvc);
// time column // time column
lvc.cx = 80; lvc.cx = BOOKMARKSLIST_COLUMN_TIME_WIDTH;
ListView_InsertColumn(hwndBookmarksList, 2, &lvc); ListView_InsertColumn(hwndBookmarksList, 2, &lvc);
ListView_SetItemCountEx(hwndBookmarksList, TOTAL_BOOKMARKS, LVSICF_NOSCROLL | LVSICF_NOINVALIDATEALL); ListView_SetItemCountEx(hwndBookmarksList, TOTAL_BOOKMARKS, LVSICF_NOSCROLL | LVSICF_NOINVALIDATEALL);
@ -106,6 +106,7 @@ void BOOKMARKS::init()
{ {
// couldn't get rect, set default values // couldn't get rect, set default values
list_row_top = 0; list_row_top = 0;
list_row_left = BOOKMARKSLIST_COLUMN_ICONS_WIDTH + BOOKMARKSLIST_COLUMN_FRAMENUM_WIDTH;
list_row_height = 14; list_row_height = 14;
} }
RedrawBookmarksCaption(); RedrawBookmarksCaption();
@ -131,6 +132,7 @@ void BOOKMARKS::reset_vars()
item_under_mouse = ITEM_UNDER_MOUSE_NONE; item_under_mouse = ITEM_UNDER_MOUSE_NONE;
mouse_over_bitmap = false; mouse_over_bitmap = false;
must_check_item_under_mouse = true; must_check_item_under_mouse = true;
bookmark_leftclicked = bookmark_rightclicked = -1;
check_flash_shedule = clock() + BOOKMARKS_FLASH_TICK; check_flash_shedule = clock() + BOOKMARKS_FLASH_TICK;
} }
@ -156,17 +158,28 @@ void BOOKMARKS::update()
} }
commands.resize(0); commands.resize(0);
// once per 100 milliseconds fade bookmark flashes // once per 100 milliseconds update bookmark flashes
if (clock() > check_flash_shedule) if (clock() > check_flash_shedule)
{ {
check_flash_shedule = clock() + BOOKMARKS_FLASH_TICK; check_flash_shedule = clock() + BOOKMARKS_FLASH_TICK;
for (int i = 0; i < TOTAL_BOOKMARKS; ++i) for (int i = 0; i < TOTAL_BOOKMARKS; ++i)
{ {
if (bookmarks_array[i].flash_phase) if (bookmark_rightclicked == i || bookmark_leftclicked == i)
{ {
bookmarks_array[i].flash_phase--; if (bookmarks_array[i].flash_phase != FLASH_PHASE_BUTTONHELD)
RedrawBookmarksRow((i + TOTAL_BOOKMARKS - 1) % TOTAL_BOOKMARKS); {
branches.must_redraw_branches_tree = true; // because border of some branch digit has changed bookmarks_array[i].flash_phase = FLASH_PHASE_BUTTONHELD;
RedrawBookmarksRow((i + TOTAL_BOOKMARKS - 1) % TOTAL_BOOKMARKS);
branches.must_redraw_branches_tree = true; // because border of branch digit has changed
}
} else
{
if (bookmarks_array[i].flash_phase > 0)
{
bookmarks_array[i].flash_phase--;
RedrawBookmarksRow((i + TOTAL_BOOKMARKS - 1) % TOTAL_BOOKMARKS);
branches.must_redraw_branches_tree = true; // because border of branch digit has changed
}
} }
} }
} }
@ -488,7 +501,9 @@ void BOOKMARKS::MouseMove(int new_x, int new_y)
void BOOKMARKS::FindItemUnderMouse() void BOOKMARKS::FindItemUnderMouse()
{ {
item_under_mouse = ITEM_UNDER_MOUSE_NONE; item_under_mouse = ITEM_UNDER_MOUSE_NONE;
if (mouse_x > list_row_left) RECT wrect;
GetClientRect(hwndBookmarksList, &wrect);
if (mouse_x >= list_row_left && mouse_x < wrect.right - wrect.left && mouse_y >= list_row_top && mouse_y < wrect.bottom - wrect.top)
{ {
item_under_mouse = (mouse_y - list_row_top) / list_row_height; item_under_mouse = (mouse_y - list_row_top) / list_row_height;
if (item_under_mouse >= 0 && item_under_mouse < TOTAL_BOOKMARKS) if (item_under_mouse >= 0 && item_under_mouse < TOTAL_BOOKMARKS)
@ -616,21 +631,17 @@ LONG BOOKMARKS::CustomDraw(NMLVCUSTOMDRAW* msg)
} }
} }
void BOOKMARKS::LeftClick(int column_index, int row_index) void BOOKMARKS::LeftClick()
{ {
if (row_index >= 0 && column_index >= 0) if (column_clicked <= BOOKMARKS_COLUMN_FRAME || (taseditor_config.branch_only_when_rec && movie_readonly))
{ command(COMMAND_JUMP, bookmark_leftclicked);
if (column_index <= BOOKMARKS_COLUMN_FRAME || (taseditor_config.branch_only_when_rec && movie_readonly)) else if (column_clicked == BOOKMARKS_COLUMN_TIME && (!taseditor_config.branch_only_when_rec || !movie_readonly))
command(COMMAND_JUMP, (row_index + 1) % TOTAL_BOOKMARKS); command(COMMAND_DEPLOY, bookmark_leftclicked);
else if (column_index == BOOKMARKS_COLUMN_TIME && (!taseditor_config.branch_only_when_rec || !movie_readonly))
command(COMMAND_DEPLOY, (row_index + 1) % TOTAL_BOOKMARKS);
}
} }
void BOOKMARKS::RightClick(int column_index, int row_index) void BOOKMARKS::RightClick()
{ {
// set Bookmark if (bookmark_rightclicked >= 0)
if (row_index >= 0) command(COMMAND_SET, bookmark_rightclicked);
command(COMMAND_SET, (row_index + 1) % TOTAL_BOOKMARKS);
} }
int BOOKMARKS::FindBookmarkAtFrame(int frame) int BOOKMARKS::FindBookmarkAtFrame(int frame)
@ -678,12 +689,37 @@ LRESULT APIENTRY BookmarksListWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM
{ {
if (GetFocus() != hWnd) if (GetFocus() != hWnd)
SetFocus(hWnd); SetFocus(hWnd);
// perform hit test
LVHITTESTINFO info; LVHITTESTINFO info;
info.pt.x = GET_X_LPARAM(lParam); info.pt.x = GET_X_LPARAM(lParam);
info.pt.y = GET_Y_LPARAM(lParam); info.pt.y = GET_Y_LPARAM(lParam);
ListView_SubItemHitTest(hWnd, (LPARAM)&info); ListView_SubItemHitTest(hWnd, (LPARAM)&info);
bookmarks.LeftClick(info.iSubItem, info.iItem); if (info.iItem >= 0 && bookmarks.bookmark_rightclicked < 0)
{
bookmarks.bookmark_leftclicked = (info.iItem + 1) % TOTAL_BOOKMARKS;
bookmarks.column_clicked = info.iSubItem;
if (bookmarks.column_clicked <= BOOKMARKS_COLUMN_FRAME || (taseditor_config.branch_only_when_rec && movie_readonly))
bookmarks.bookmarks_array[bookmarks.bookmark_leftclicked].flash_type = FLASH_TYPE_JUMP;
else if (bookmarks.column_clicked == BOOKMARKS_COLUMN_TIME && (!taseditor_config.branch_only_when_rec || !movie_readonly))
bookmarks.bookmarks_array[bookmarks.bookmark_leftclicked].flash_type = FLASH_TYPE_DEPLOY;
SetCapture(hWnd);
}
return 0;
}
case WM_LBUTTONUP:
{
LVHITTESTINFO info;
info.pt.x = GET_X_LPARAM(lParam);
info.pt.y = GET_Y_LPARAM(lParam);
RECT wrect;
GetClientRect(hWnd, &wrect);
if (info.pt.x >= 0 && info.pt.x < wrect.right - wrect.left && info.pt.y >= 0 && info.pt.y < wrect.bottom - wrect.top)
{
ListView_SubItemHitTest(hWnd, (LPARAM)&info);
if (bookmarks.bookmark_leftclicked == (info.iItem + 1) % TOTAL_BOOKMARKS && bookmarks.column_clicked == info.iSubItem)
bookmarks.LeftClick();
}
ReleaseCapture();
bookmarks.bookmark_leftclicked = -1;
return 0; return 0;
} }
case WM_RBUTTONDOWN: case WM_RBUTTONDOWN:
@ -691,12 +727,34 @@ LRESULT APIENTRY BookmarksListWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM
{ {
if (GetFocus() != hWnd) if (GetFocus() != hWnd)
SetFocus(hWnd); SetFocus(hWnd);
// perform hit test
LVHITTESTINFO info; LVHITTESTINFO info;
info.pt.x = GET_X_LPARAM(lParam); info.pt.x = GET_X_LPARAM(lParam);
info.pt.y = GET_Y_LPARAM(lParam); info.pt.y = GET_Y_LPARAM(lParam);
ListView_SubItemHitTest(hWnd, (LPARAM)&info); ListView_SubItemHitTest(hWnd, (LPARAM)&info);
bookmarks.RightClick(info.iSubItem, info.iItem); if (info.iItem >= 0 && bookmarks.bookmark_leftclicked < 0)
{
bookmarks.bookmark_rightclicked = (info.iItem + 1) % TOTAL_BOOKMARKS;
bookmarks.column_clicked = info.iSubItem;
bookmarks.bookmarks_array[bookmarks.bookmark_rightclicked].flash_type = FLASH_TYPE_SET;
SetCapture(hWnd);
}
return 0;
}
case WM_RBUTTONUP:
{
LVHITTESTINFO info;
info.pt.x = GET_X_LPARAM(lParam);
info.pt.y = GET_Y_LPARAM(lParam);
RECT wrect;
GetClientRect(hWnd, &wrect);
if (info.pt.x >= 0 && info.pt.x < wrect.right - wrect.left && info.pt.y >= 0 && info.pt.y < wrect.bottom - wrect.top)
{
ListView_SubItemHitTest(hWnd, (LPARAM)&info);
if (bookmarks.bookmark_rightclicked == (info.iItem + 1) % TOTAL_BOOKMARKS && bookmarks.column_clicked == info.iSubItem)
bookmarks.RightClick();
}
ReleaseCapture();
bookmarks.bookmark_rightclicked = -1;
return 0; return 0;
} }
case WM_MBUTTONDOWN: case WM_MBUTTONDOWN:
@ -708,6 +766,7 @@ LRESULT APIENTRY BookmarksListWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM
return 0; return 0;
} }
case WM_MOUSEWHEEL: case WM_MOUSEWHEEL:
bookmarks.bookmark_rightclicked = -1;
return SendMessage(piano_roll.hwndList, msg, wParam, lParam); return SendMessage(piano_roll.hwndList, msg, wParam, lParam);
} }

View File

@ -21,6 +21,10 @@ enum COMMANDS
TOTAL_COMMANDS TOTAL_COMMANDS
}; };
#define BOOKMARKSLIST_COLUMN_ICONS_WIDTH 13
#define BOOKMARKSLIST_COLUMN_FRAMENUM_WIDTH 74
#define BOOKMARKSLIST_COLUMN_TIME_WIDTH 82
#define ITEM_UNDER_MOUSE_NONE -2 #define ITEM_UNDER_MOUSE_NONE -2
#define ITEM_UNDER_MOUSE_CLOUD -1 #define ITEM_UNDER_MOUSE_CLOUD -1
@ -56,8 +60,8 @@ public:
void GetDispInfo(NMLVDISPINFO* nmlvDispInfo); void GetDispInfo(NMLVDISPINFO* nmlvDispInfo);
LONG CustomDraw(NMLVCUSTOMDRAW* msg); LONG CustomDraw(NMLVCUSTOMDRAW* msg);
void LeftClick(int column_index, int row_index); void LeftClick();
void RightClick(int column_index, int row_index); void RightClick();
int FindBookmarkAtFrame(int frame); int FindBookmarkAtFrame(int frame);
@ -78,6 +82,11 @@ public:
bool mouse_over_bitmap, mouse_over_bookmarkslist; bool mouse_over_bitmap, mouse_over_bookmarkslist;
int item_under_mouse; int item_under_mouse;
TRACKMOUSEEVENT tme, list_tme; TRACKMOUSEEVENT tme, list_tme;
int bookmark_leftclicked, bookmark_rightclicked, column_clicked;
int list_row_top;
int list_row_left;
int list_row_height;
HWND hwndBookmarksList, hwndBranchesBitmap, hwndBookmarks; HWND hwndBookmarksList, hwndBranchesBitmap, hwndBookmarks;
private: private:
@ -89,9 +98,6 @@ private:
std::vector<int> commands; std::vector<int> commands;
int check_flash_shedule; int check_flash_shedule;
int mouse_x, mouse_y; int mouse_x, mouse_y;
int list_row_top;
int list_row_left;
int list_row_height;
// GDI stuff // GDI stuff
HFONT hBookmarksFont; HFONT hBookmarksFont;

View File

@ -141,7 +141,7 @@ void PLAYBACK::update()
lost_position_frame = 0; lost_position_frame = 0;
// pause when seeking hit pause_frame // pause when seeking hit pause_frame
if(pause_frame && pause_frame <= currFrameCounter + 1) if(pause_frame && currFrameCounter + 1 >= pause_frame)
SeekingStop(); SeekingStop();
else if (!lost_position_frame && currFrameCounter >= currMovieData.getNumRecords()-1 && autopause_at_the_end && taseditor_config.autopause_at_finish) else if (!lost_position_frame && currFrameCounter >= currMovieData.getNumRecords()-1 && autopause_at_the_end && taseditor_config.autopause_at_finish)
PauseEmulation(); PauseEmulation();

Binary file not shown.