From 914c74ad15a6d65641fa4c97175606db1f07a74d Mon Sep 17 00:00:00 2001 From: ansstuff Date: Mon, 9 Apr 2012 17:39:38 +0000 Subject: [PATCH] * Taseditor: clicks in Branches Tree * Taseditor: all GUI buttons fire off at mousedown; disabled Spacebar and enabled Middle mouse button on GUI buttons --- changelog.txt | 7 + src/drivers/win/main.cpp | 2 +- src/drivers/win/res.rc | 6 +- src/drivers/win/taseditor/branches.cpp | 43 +- src/drivers/win/taseditor/history.cpp | 386 ++++++------- src/drivers/win/taseditor/history.h | 4 +- src/drivers/win/taseditor/piano_roll.cpp | 35 +- src/drivers/win/taseditor/playback.cpp | 1 + src/drivers/win/taseditor/selection.cpp | 1 + src/drivers/win/taseditor/snapshot.cpp | 98 ++-- src/drivers/win/taseditor/snapshot.h | 8 +- .../win/taseditor/taseditor_project.cpp | 6 +- .../win/taseditor/taseditor_window.cpp | 530 ++++++++++++++++-- src/drivers/win/taseditor/taseditor_window.h | 4 +- 14 files changed, 804 insertions(+), 327 deletions(-) diff --git a/changelog.txt b/changelog.txt index 23904cbb..0a48207f 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,4 +1,11 @@ +09-Apr-2012 - AnS - Taseditor: all GUI buttons fire off at mousedown; disabled Spacebar and enabled Middle mouse button on GUI buttons +09-Apr-2012 - AnS - Taseditor: clicks in Branches Tree +07-Apr-2012 - AnS - Taseditor: version data in fm3 +07-Apr-2012 - AnS - Taseditor: much better way of calculating Branches Tree; hinting full timelines; miniarrow showing current Playback cursor position in Branches Tree; "Bookmark#" modtype, undo/redo works for Bookmarks +07-Apr-2012 - AnS - Taseditor: applying PAL and PPU flags when loading projects +05-apr-2012 - zeromus - fix mapper 242 (dragon quest 8 UNL) +26-Mar-2012 - AnS - Taseditor: Alt+Wheel = jump across gaps in Input/Markers 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 diff --git a/src/drivers/win/main.cpp b/src/drivers/win/main.cpp index 091c0219..34ed1f15 100644 --- a/src/drivers/win/main.cpp +++ b/src/drivers/win/main.cpp @@ -120,7 +120,7 @@ void ApplyDefaultCommandMapping(void); // Internal variables int frameSkipAmt = 18; uint8 *xbsave = NULL; -int eoptions = EO_BGRUN | EO_FORCEISCALE; +int eoptions = EO_BGRUN | EO_NOSPRLIM | EO_FORCEISCALE; //global variables int soundoptions = SO_SECONDARY | SO_GFOCUS; diff --git a/src/drivers/win/res.rc b/src/drivers/win/res.rc index 36639671..67a95cf1 100644 --- a/src/drivers/win/res.rc +++ b/src/drivers/win/res.rc @@ -1421,12 +1421,10 @@ BEGIN PUSHBUTTON "Similar",TASEDITOR_FIND_BEST_SIMILAR_MARKER,225,332,34,14,NOT WS_TABSTOP PUSHBUTTON "More",TASEDITOR_FIND_NEXT_SIMILAR_MARKER,259,332,34,14,NOT WS_TABSTOP PUSHBUTTON ">>",TASEDITOR_NEXT_MARKER,292,332,23,14,NOT WS_TABSTOP - CONTROL "",IDC_JUMP_PLAYBACK_BUTTON,"Button",BS_OWNERDRAW,5,0,59,13 EDITTEXT IDC_PLAYBACK_MARKER_EDIT,65,0,127,13,ES_AUTOHSCROLL | ES_READONLY | NOT WS_TABSTOP - RTEXT "Marker 0",IDC_PLAYBACK_MARKER,4,2,58,10,0,WS_EX_RIGHT - CONTROL "",IDC_JUMP_SELECTION_BUTTON,"Button",BS_OWNERDRAW,5,333,59,13 + RTEXT "Marker 0",IDC_PLAYBACK_MARKER,4,2,60,10,SS_NOTIFY,WS_EX_RIGHT EDITTEXT IDC_SELECTION_MARKER_EDIT,65,333,127,13,ES_AUTOHSCROLL | ES_READONLY | NOT WS_TABSTOP - RTEXT "Marker 99999",IDC_SELECTION_MARKER,4,335,58,10,0,WS_EX_RIGHT + RTEXT "Marker 99999",IDC_SELECTION_MARKER,4,335,60,10,SS_NOTIFY,WS_EX_RIGHT CONTROL "",IDC_BRANCHES_BITMAP,"Static",SS_OWNERDRAW | SS_NOTIFY | SS_REALSIZEIMAGE | NOT WS_VISIBLE,202,178,113,89 CONTROL " Turbo seek",CHECK_TURBO_SEEK,"Button",BS_AUTOCHECKBOX,263,25,50,12 LTEXT "Selection: 0 rows, 16 columns",IDC_TEXT_SELECTION,204,118,112,10 diff --git a/src/drivers/win/taseditor/branches.cpp b/src/drivers/win/taseditor/branches.cpp index 4d1e1966..34505f67 100644 --- a/src/drivers/win/taseditor/branches.cpp +++ b/src/drivers/win/taseditor/branches.cpp @@ -14,7 +14,7 @@ Branches - Manager of Branches * also stores the time of the last modification (see fireball) and the time of project beginning (see cloudlet) * also caches data used in calculations (cached_first_difference, cached_timelines) * saves and loads the data from a project file. On error: sends warning to caller -* implements the working of Branches Tree: creating, recalculating relations, animating, redrawing, mouseover +* implements the working of Branches Tree: creating, recalculating relations, animating, redrawing, mouseover, clicks * on demand: reacts on Bookmarks/current Movie changes and recalculates the Branches Tree * regularly updates animations in Branches Tree and calculates Playback cursor position on the Tree * stores resources: coordinates for building Branches Tree, animation timings @@ -189,7 +189,7 @@ void BRANCHES::reset() void BRANCHES::reset_vars() { transition_phase = animation_frame = 0; - playback_x = playback_y = -50; + playback_x = playback_y = 0; must_recalculate_branches_tree = must_redraw_branches_tree = true; next_animation_time = clock() + BRANCHES_ANIMATION_TICK; } @@ -1116,6 +1116,11 @@ LRESULT APIENTRY BranchesBitmapWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARA extern BRANCHES branches; switch(msg) { + case WM_SETCURSOR: + { + taseditor_window.must_update_mouse_cursor = true; + return true; + } case WM_MOUSEMOVE: { if (!bookmarks.mouse_over_bitmap) @@ -1141,7 +1146,41 @@ LRESULT APIENTRY BranchesBitmapWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARA return 0; } case WM_LBUTTONDOWN: + { + // single click on Branches Tree = send playback to the Bookmark + int branch_under_mouse = bookmarks.item_under_mouse; + if (branch_under_mouse == ITEM_UNDER_MOUSE_CLOUD) + { + playback.jump(0); + } else if (branch_under_mouse >= 0 && branch_under_mouse < TOTAL_BOOKMARKS && bookmarks.bookmarks_array[branch_under_mouse].not_empty) + { + bookmarks.command(COMMAND_JUMP, branch_under_mouse); + } else if (branch_under_mouse == TOTAL_BOOKMARKS) + { + playback.jump(currMovieData.getNumRecords() - 1); + } + if (GetFocus() != hWnd) + SetFocus(hWnd); + return 0; + } case WM_LBUTTONDBLCLK: + { + // double click on Branches Tree = deploy the Branch + int branch_under_mouse = bookmarks.item_under_mouse; + if (branch_under_mouse == ITEM_UNDER_MOUSE_CLOUD) + { + playback.jump(0); + } else if (branch_under_mouse >= 0 && branch_under_mouse < TOTAL_BOOKMARKS && bookmarks.bookmarks_array[branch_under_mouse].not_empty) + { + bookmarks.command(COMMAND_DEPLOY, branch_under_mouse); + } else if (branch_under_mouse == TOTAL_BOOKMARKS) + { + playback.jump(currMovieData.getNumRecords() - 1); + } + if (GetFocus() != hWnd) + SetFocus(hWnd); + return 0; + } case WM_RBUTTONDOWN: case WM_RBUTTONDBLCLK: { diff --git a/src/drivers/win/taseditor/history.cpp b/src/drivers/win/taseditor/history.cpp index cc7983d0..aa296f7a 100644 --- a/src/drivers/win/taseditor/history.cpp +++ b/src/drivers/win/taseditor/history.cpp @@ -142,13 +142,13 @@ void HISTORY::reset() history_start_pos = 0; history_cursor_pos = -1; // create initial snapshot - SNAPSHOT inp; - inp.init(currMovieData, taseditor_config.enable_hot_changes); - strcat(inp.description, modCaptions[MODTYPE_INIT]); - inp.jump_frame = -1; - inp.start_frame = 0; - inp.end_frame = inp.size - 1; - AddItemToHistory(inp); + SNAPSHOT snap; + snap.init(currMovieData, taseditor_config.enable_hot_changes); + strcat(snap.description, modCaptions[MODTYPE_INIT]); + snap.jump_frame = -1; + snap.start_frame = 0; + snap.end_frame = snap.size - 1; + AddItemToHistory(snap); UpdateHistoryList(); RedrawHistoryList(); } @@ -385,7 +385,7 @@ void HISTORY::redo() return; } // ---------------------------- -void HISTORY::AddItemToHistory(SNAPSHOT &inp, int cur_branch) +void HISTORY::AddItemToHistory(SNAPSHOT &snap, int cur_branch) { // history uses conveyor of items (vector with fixed size) to aviod frequent resizing, which would be awfully expensive with such large objects as SNAPSHOT and BOOKMARK if (history_total_items >= history_size) @@ -402,12 +402,12 @@ void HISTORY::AddItemToHistory(SNAPSHOT &inp, int cur_branch) } // write data int real_pos = (history_start_pos + history_cursor_pos) % history_size; - snapshots[real_pos] = inp; + snapshots[real_pos] = snap; backup_bookmarks[real_pos].free(); backup_current_branch[real_pos] = cur_branch; RedrawHistoryList(); } -void HISTORY::AddItemToHistory(SNAPSHOT &inp, int cur_branch, BOOKMARK &bookm) +void HISTORY::AddItemToHistory(SNAPSHOT &snap, int cur_branch, BOOKMARK &bookm) { // history uses conveyor of items (vector with fixed size) to aviod frequent resizing, which would be awfully expensive with such large objects as SNAPSHOT and BOOKMARK if (history_total_items >= history_size) @@ -424,7 +424,7 @@ void HISTORY::AddItemToHistory(SNAPSHOT &inp, int cur_branch, BOOKMARK &bookm) } // write data int real_pos = (history_start_pos + history_cursor_pos) % history_size; - snapshots[real_pos] = inp; + snapshots[real_pos] = snap; backup_bookmarks[real_pos] = bookm; backup_current_branch[real_pos] = cur_branch; RedrawHistoryList(); @@ -434,17 +434,17 @@ void HISTORY::AddItemToHistory(SNAPSHOT &inp, int cur_branch, BOOKMARK &bookm) int HISTORY::RegisterChanges(int mod_type, int start, int end, const char* comment, int consecutive_tag) { // create new shanshot - SNAPSHOT inp; - inp.init(currMovieData, taseditor_config.enable_hot_changes); + SNAPSHOT snap; + snap.init(currMovieData, taseditor_config.enable_hot_changes); // check if there are input differences from latest snapshot int real_pos = (history_start_pos + history_cursor_pos) % history_size; - int first_changes = inp.findFirstChange(snapshots[real_pos], start, end); + int first_changes = snap.findFirstChange(snapshots[real_pos], start, end); if (first_changes >= 0) { // differences found // fill description: - inp.mod_type = mod_type; - strcat(inp.description, modCaptions[inp.mod_type]); + snap.mod_type = mod_type; + strcat(snap.description, modCaptions[snap.mod_type]); switch (mod_type) { case MODTYPE_SET: @@ -453,7 +453,7 @@ int HISTORY::RegisterChanges(int mod_type, int start, int end, const char* comme case MODTYPE_CLEAR: case MODTYPE_CUT: { - inp.jump_frame = first_changes; + snap.jump_frame = first_changes; break; } case MODTYPE_INSERT: @@ -463,47 +463,47 @@ int HISTORY::RegisterChanges(int mod_type, int start, int end, const char* comme case MODTYPE_PATTERN: { // for these changes user prefers to see frame of attempted change (selection beginning), not frame of actual differences - inp.jump_frame = start; + snap.jump_frame = start; break; } } - inp.start_frame = start; - inp.end_frame = end; - inp.consecutive_tag = consecutive_tag; - if (consecutive_tag && taseditor_config.combine_consecutive && snapshots[real_pos].mod_type == inp.mod_type && snapshots[real_pos].consecutive_tag == inp.consecutive_tag) + snap.start_frame = start; + snap.end_frame = end; + snap.consecutive_tag = consecutive_tag; + if (consecutive_tag && taseditor_config.combine_consecutive && snapshots[real_pos].mod_type == snap.mod_type && snapshots[real_pos].consecutive_tag == snap.consecutive_tag) { // combine with previous snapshot - if (inp.jump_frame > snapshots[real_pos].jump_frame) - inp.jump_frame = snapshots[real_pos].jump_frame; - if (inp.start_frame > snapshots[real_pos].start_frame) - inp.start_frame = snapshots[real_pos].start_frame; - if (inp.end_frame < snapshots[real_pos].end_frame) - inp.end_frame = snapshots[real_pos].end_frame; + if (snap.jump_frame > snapshots[real_pos].jump_frame) + snap.jump_frame = snapshots[real_pos].jump_frame; + if (snap.start_frame > snapshots[real_pos].start_frame) + snap.start_frame = snapshots[real_pos].start_frame; + if (snap.end_frame < snapshots[real_pos].end_frame) + snap.end_frame = snapshots[real_pos].end_frame; // add upper and lower frame to description char framenum[11]; - strcat(inp.description, " "); - _itoa(inp.start_frame, framenum, 10); - strcat(inp.description, framenum); - if (inp.end_frame > inp.start_frame) + strcat(snap.description, " "); + _itoa(snap.start_frame, framenum, 10); + strcat(snap.description, framenum); + if (snap.end_frame > snap.start_frame) { - strcat(inp.description, "-"); - _itoa(inp.end_frame, framenum, 10); - strcat(inp.description, framenum); + strcat(snap.description, "-"); + _itoa(snap.end_frame, framenum, 10); + strcat(snap.description, framenum); } // add comment if there is one specified if (comment) { - strcat(inp.description, " "); - strncat(inp.description, comment, SNAPSHOT_DESC_MAX_LENGTH - strlen(inp.description) - 1); + strcat(snap.description, " "); + strncat(snap.description, comment, SNAPSHOT_DESC_MAX_LENGTH - strlen(snap.description) - 1); } // set hotchanges if (taseditor_config.enable_hot_changes) { - inp.copyHotChanges(&snapshots[real_pos]); - inp.fillHotChanges(snapshots[real_pos], first_changes, end); + snap.copyHotChanges(&snapshots[real_pos]); + snap.fillHotChanges(snapshots[real_pos], first_changes, end); } // replace current snapshot with this cloned snapshot and truncate history here - snapshots[real_pos] = inp; + snapshots[real_pos] = snap; history_total_items = history_cursor_pos+1; UpdateHistoryList(); RedrawHistoryList(); @@ -512,20 +512,20 @@ int HISTORY::RegisterChanges(int mod_type, int start, int end, const char* comme // don't combine // add upper and lower frame to description char framenum[11]; - strcat(inp.description, " "); - _itoa(inp.start_frame, framenum, 10); - strcat(inp.description, framenum); - if (inp.end_frame > inp.start_frame) + strcat(snap.description, " "); + _itoa(snap.start_frame, framenum, 10); + strcat(snap.description, framenum); + if (snap.end_frame > snap.start_frame) { - strcat(inp.description, "-"); - _itoa(inp.end_frame, framenum, 10); - strcat(inp.description, framenum); + strcat(snap.description, "-"); + _itoa(snap.end_frame, framenum, 10); + strcat(snap.description, framenum); } // add comment if there is one specified if (comment) { - strcat(inp.description, " "); - strncat(inp.description, comment, SNAPSHOT_DESC_MAX_LENGTH - strlen(inp.description) - 1); + strcat(snap.description, " "); + strncat(snap.description, comment, SNAPSHOT_DESC_MAX_LENGTH - strlen(snap.description) - 1); } // set hotchanges if (taseditor_config.enable_hot_changes) @@ -534,11 +534,11 @@ int HISTORY::RegisterChanges(int mod_type, int start, int end, const char* comme switch (mod_type) { case MODTYPE_DELETE: - inp.inheritHotChanges_DeleteSelection(&snapshots[real_pos]); + snap.inheritHotChanges_DeleteSelection(&snapshots[real_pos]); break; case MODTYPE_INSERT: case MODTYPE_CLONE: - inp.inheritHotChanges_InsertSelection(&snapshots[real_pos]); + snap.inheritHotChanges_InsertSelection(&snapshots[real_pos]); break; case MODTYPE_SET: case MODTYPE_UNSET: @@ -546,16 +546,16 @@ int HISTORY::RegisterChanges(int mod_type, int start, int end, const char* comme case MODTYPE_CUT: case MODTYPE_PASTE: case MODTYPE_PATTERN: - inp.inheritHotChanges(&snapshots[real_pos]); - inp.fillHotChanges(snapshots[real_pos], first_changes, end); + snap.inheritHotChanges(&snapshots[real_pos]); + snap.fillHotChanges(snapshots[real_pos], first_changes, end); break; case MODTYPE_TRUNCATE: - inp.copyHotChanges(&snapshots[real_pos]); + snap.copyHotChanges(&snapshots[real_pos]); // do not add new hotchanges and do not fade old hotchanges, because there was nothing added break; } } - AddItemToHistory(inp); + AddItemToHistory(snap); } branches.ChangesMadeSinceBranch(); } @@ -564,32 +564,32 @@ int HISTORY::RegisterChanges(int mod_type, int start, int end, const char* comme int HISTORY::RegisterInsertNum(int start, int frames) { // create new shanshot - SNAPSHOT inp; - inp.init(currMovieData, taseditor_config.enable_hot_changes); + SNAPSHOT snap; + snap.init(currMovieData, taseditor_config.enable_hot_changes); // check if there are input differences from latest snapshot int real_pos = (history_start_pos + history_cursor_pos) % history_size; - int first_changes = inp.findFirstChange(snapshots[real_pos], start); + int first_changes = snap.findFirstChange(snapshots[real_pos], start); if (first_changes >= 0) { // differences found // fill description: - inp.mod_type = MODTYPE_INSERTNUM; - strcat(inp.description, modCaptions[inp.mod_type]); - inp.jump_frame = start; - inp.start_frame = start; - inp.end_frame = start + frames - 1; + snap.mod_type = MODTYPE_INSERTNUM; + strcat(snap.description, modCaptions[snap.mod_type]); + snap.jump_frame = start; + snap.start_frame = start; + snap.end_frame = start + frames - 1; char framenum[11]; // add number of inserted frames to description _itoa(frames, framenum, 10); - strcat(inp.description, framenum); + strcat(snap.description, framenum); // add upper frame to description - strcat(inp.description, " "); - _itoa(inp.start_frame, framenum, 10); - strcat(inp.description, framenum); + strcat(snap.description, " "); + _itoa(snap.start_frame, framenum, 10); + strcat(snap.description, framenum); // set hotchanges if (taseditor_config.enable_hot_changes) - inp.inheritHotChanges_InsertNum(&snapshots[real_pos], start, frames); - AddItemToHistory(inp); + snap.inheritHotChanges_InsertNum(&snapshots[real_pos], start, frames); + AddItemToHistory(snap); branches.ChangesMadeSinceBranch(); } return first_changes; @@ -597,30 +597,30 @@ int HISTORY::RegisterInsertNum(int start, int frames) int HISTORY::RegisterPasteInsert(int start, SelectionFrames& inserted_set) { // create new shanshot - SNAPSHOT inp; - inp.init(currMovieData, taseditor_config.enable_hot_changes); + SNAPSHOT snap; + snap.init(currMovieData, taseditor_config.enable_hot_changes); // check if there are input differences from latest snapshot int real_pos = (history_start_pos + history_cursor_pos) % history_size; - int first_changes = inp.findFirstChange(snapshots[real_pos], start); + int first_changes = snap.findFirstChange(snapshots[real_pos], start); if (first_changes >= 0) { // differences found // fill description: - inp.mod_type = MODTYPE_PASTEINSERT; - strcat(inp.description, modCaptions[inp.mod_type]); + snap.mod_type = MODTYPE_PASTEINSERT; + strcat(snap.description, modCaptions[snap.mod_type]); // for PasteInsert user prefers to see frame of attempted change (selection beginning), not frame of actual differences - inp.jump_frame = start; - inp.start_frame = start; - inp.end_frame = -1; + snap.jump_frame = start; + snap.start_frame = start; + snap.end_frame = -1; // add upper frame to description char framenum[11]; - strcat(inp.description, " "); - _itoa(inp.start_frame, framenum, 10); - strcat(inp.description, framenum); + strcat(snap.description, " "); + _itoa(snap.start_frame, framenum, 10); + strcat(snap.description, framenum); // set hotchanges if (taseditor_config.enable_hot_changes) - inp.inheritHotChanges_PasteInsert(&snapshots[real_pos], inserted_set); - AddItemToHistory(inp); + snap.inheritHotChanges_PasteInsert(&snapshots[real_pos], inserted_set); + AddItemToHistory(snap); branches.ChangesMadeSinceBranch(); } return first_changes; @@ -628,72 +628,72 @@ int HISTORY::RegisterPasteInsert(int start, SelectionFrames& inserted_set) void HISTORY::RegisterMarkersChange(int mod_type, int start, int end, const char* comment) { // create new shanshot - SNAPSHOT inp; - inp.init(currMovieData, taseditor_config.enable_hot_changes); + SNAPSHOT snap; + snap.init(currMovieData, taseditor_config.enable_hot_changes); // fill description: - inp.mod_type = mod_type; - strcat(inp.description, modCaptions[mod_type]); - inp.jump_frame = start; - inp.start_frame = start; - inp.end_frame = end; + snap.mod_type = mod_type; + strcat(snap.description, modCaptions[mod_type]); + snap.jump_frame = start; + snap.start_frame = start; + snap.end_frame = end; // add the frame to description char framenum[11]; - strcat(inp.description, " "); - _itoa(inp.start_frame, framenum, 10); - strcat(inp.description, framenum); - if (inp.end_frame > inp.start_frame || mod_type == MODTYPE_MARKER_DRAG || mod_type == MODTYPE_MARKER_SWAP) + strcat(snap.description, " "); + _itoa(snap.start_frame, framenum, 10); + strcat(snap.description, framenum); + if (snap.end_frame > snap.start_frame || mod_type == MODTYPE_MARKER_DRAG || mod_type == MODTYPE_MARKER_SWAP) { if (mod_type == MODTYPE_MARKER_DRAG) - strcat(inp.description, "=>"); + strcat(snap.description, "=>"); else if (mod_type == MODTYPE_MARKER_SWAP) - strcat(inp.description, "<=>"); + strcat(snap.description, "<=>"); else - strcat(inp.description, "-"); - _itoa(inp.end_frame, framenum, 10); - strcat(inp.description, framenum); + strcat(snap.description, "-"); + _itoa(snap.end_frame, framenum, 10); + strcat(snap.description, framenum); } // add comment if there is one specified if (comment) { - strcat(inp.description, " "); - strncat(inp.description, comment, SNAPSHOT_DESC_MAX_LENGTH - strlen(inp.description) - 1); + strcat(snap.description, " "); + strncat(snap.description, comment, SNAPSHOT_DESC_MAX_LENGTH - strlen(snap.description) - 1); } // input hotchanges aren't changed if (taseditor_config.enable_hot_changes) - inp.copyHotChanges(&GetCurrentSnapshot()); - AddItemToHistory(inp); + snap.copyHotChanges(&GetCurrentSnapshot()); + AddItemToHistory(snap); branches.ChangesMadeSinceBranch(); project.SetProjectChanged(); } void HISTORY::RegisterBookmarkSet(int slot, BOOKMARK& backup_copy, int old_current_branch) { // create new snapshot - SNAPSHOT inp; - inp.init(currMovieData, taseditor_config.enable_hot_changes); + SNAPSHOT snap; + snap.init(currMovieData, taseditor_config.enable_hot_changes); // fill description: modification type + jump_frame of the Bookmark - inp.mod_type = MODTYPE_BOOKMARK_0 + slot; - strcat(inp.description, modCaptions[inp.mod_type]); - inp.start_frame = inp.end_frame = inp.jump_frame = bookmarks.bookmarks_array[slot].snapshot.jump_frame; + snap.mod_type = MODTYPE_BOOKMARK_0 + slot; + strcat(snap.description, modCaptions[snap.mod_type]); + snap.start_frame = snap.end_frame = snap.jump_frame = bookmarks.bookmarks_array[slot].snapshot.jump_frame; char framenum[11]; - strcat(inp.description, " "); - _itoa(inp.jump_frame, framenum, 10); - strcat(inp.description, framenum); + strcat(snap.description, " "); + _itoa(snap.jump_frame, framenum, 10); + strcat(snap.description, framenum); if (taseditor_config.enable_hot_changes) - inp.copyHotChanges(&GetCurrentSnapshot()); - AddItemToHistory(inp, old_current_branch, backup_copy); + snap.copyHotChanges(&GetCurrentSnapshot()); + AddItemToHistory(snap, old_current_branch, backup_copy); } void HISTORY::RegisterBranching(int mod_type, int first_change, int slot, int old_current_branch) { // create new snapshot - SNAPSHOT inp; - inp.init(currMovieData, taseditor_config.enable_hot_changes); + SNAPSHOT snap; + snap.init(currMovieData, taseditor_config.enable_hot_changes); // fill description: modification type + time of the Branch - inp.mod_type = mod_type; - strcat(inp.description, modCaptions[inp.mod_type]); - strcat(inp.description, bookmarks.bookmarks_array[slot].snapshot.description); - inp.jump_frame = first_change; - inp.start_frame = first_change; - inp.end_frame = -1; + snap.mod_type = mod_type; + strcat(snap.description, modCaptions[snap.mod_type]); + strcat(snap.description, bookmarks.bookmarks_array[slot].snapshot.description); + snap.jump_frame = first_change; + snap.start_frame = first_change; + snap.end_frame = -1; if (taseditor_config.enable_hot_changes) { if (mod_type < MODTYPE_BRANCH_MARKERS_0) @@ -702,122 +702,122 @@ void HISTORY::RegisterBranching(int mod_type, int first_change, int slot, int ol // copy hotchanges of the Branch if (taseditor_config.branch_full_movie) { - inp.copyHotChanges(&bookmarks.bookmarks_array[slot].snapshot); + snap.copyHotChanges(&bookmarks.bookmarks_array[slot].snapshot); } else { // input was branched partially, so copy hotchanges only up to and not including jump_frame of the Branch - inp.copyHotChanges(&bookmarks.bookmarks_array[slot].snapshot, bookmarks.bookmarks_array[slot].snapshot.jump_frame); + snap.copyHotChanges(&bookmarks.bookmarks_array[slot].snapshot, bookmarks.bookmarks_array[slot].snapshot.jump_frame); } } else { // input was not changed, only Markers were changed - inp.copyHotChanges(&GetCurrentSnapshot()); + snap.copyHotChanges(&GetCurrentSnapshot()); } } - AddItemToHistory(inp, old_current_branch); + AddItemToHistory(snap, old_current_branch); } void HISTORY::RegisterRecording(int frame_of_change) { int real_pos = (history_start_pos + history_cursor_pos) % history_size; - SNAPSHOT inp; - inp.init(currMovieData, taseditor_config.enable_hot_changes); - inp.fillJoypadsDiff(snapshots[real_pos], frame_of_change); + SNAPSHOT snap; + snap.init(currMovieData, taseditor_config.enable_hot_changes); + snap.fillJoypadsDiff(snapshots[real_pos], frame_of_change); // fill description: - inp.mod_type = MODTYPE_RECORD; - strcat(inp.description, modCaptions[MODTYPE_RECORD]); + snap.mod_type = MODTYPE_RECORD; + strcat(snap.description, modCaptions[MODTYPE_RECORD]); char framenum[11]; // check if current snapshot is also Recording and maybe it is consecutive recording if (taseditor_config.combine_consecutive && snapshots[real_pos].mod_type == MODTYPE_RECORD // a) also Recording && snapshots[real_pos].consecutive_tag == frame_of_change - 1 // b) consecutive (previous frame) - && snapshots[real_pos].rec_joypad_diff_bits == inp.rec_joypad_diff_bits) // c) recorded same set of joysticks + && snapshots[real_pos].rec_joypad_diff_bits == snap.rec_joypad_diff_bits) // c) recorded same set of joysticks { // clone this snapshot and continue chain of recorded frames - inp.jump_frame = snapshots[real_pos].jump_frame; - inp.start_frame = snapshots[real_pos].jump_frame; - inp.end_frame = frame_of_change; - inp.consecutive_tag = frame_of_change; + snap.jump_frame = snapshots[real_pos].jump_frame; + snap.start_frame = snapshots[real_pos].jump_frame; + snap.end_frame = frame_of_change; + snap.consecutive_tag = frame_of_change; // add info which joypads were affected - int num = joysticks_per_frame[inp.input_type]; + int num = joysticks_per_frame[snap.input_type]; uint32 current_mask = 1; for (int i = 0; i < num; ++i) { - if ((inp.rec_joypad_diff_bits & current_mask)) - strcat(inp.description, joypadCaptions[i]); + if ((snap.rec_joypad_diff_bits & current_mask)) + strcat(snap.description, joypadCaptions[i]); current_mask <<= 1; } // add upper and lower frame to description - strcat(inp.description, " "); - _itoa(inp.start_frame, framenum, 10); - strcat(inp.description, framenum); - strcat(inp.description, "-"); - _itoa(inp.end_frame, framenum, 10); - strcat(inp.description, framenum); + strcat(snap.description, " "); + _itoa(snap.start_frame, framenum, 10); + strcat(snap.description, framenum); + strcat(snap.description, "-"); + _itoa(snap.end_frame, framenum, 10); + strcat(snap.description, framenum); // set hotchanges if (taseditor_config.enable_hot_changes) { - inp.copyHotChanges(&snapshots[real_pos]); - inp.fillHotChanges(snapshots[real_pos], frame_of_change, frame_of_change); + snap.copyHotChanges(&snapshots[real_pos]); + snap.fillHotChanges(snapshots[real_pos], frame_of_change, frame_of_change); } // replace current snapshot with this cloned snapshot and truncate history here - snapshots[real_pos] = inp; + snapshots[real_pos] = snap; history_total_items = history_cursor_pos+1; UpdateHistoryList(); RedrawHistoryList(); } else { // not consecutive - add new snapshot to history - inp.jump_frame = inp.start_frame = inp.end_frame = inp.consecutive_tag = frame_of_change; + snap.jump_frame = snap.start_frame = snap.end_frame = snap.consecutive_tag = frame_of_change; // add info which joypads were affected - int num = joysticks_per_frame[inp.input_type]; + int num = joysticks_per_frame[snap.input_type]; uint32 current_mask = 1; for (int i = 0; i < num; ++i) { - if ((inp.rec_joypad_diff_bits & current_mask)) - strcat(inp.description, joypadCaptions[i]); + if ((snap.rec_joypad_diff_bits & current_mask)) + strcat(snap.description, joypadCaptions[i]); current_mask <<= 1; } // add upper frame to description - strcat(inp.description, " "); + strcat(snap.description, " "); _itoa(frame_of_change, framenum, 10); - strcat(inp.description, framenum); + strcat(snap.description, framenum); // set hotchanges if (taseditor_config.enable_hot_changes) { - inp.inheritHotChanges(&snapshots[real_pos]); - inp.fillHotChanges(snapshots[real_pos], frame_of_change, frame_of_change); + snap.inheritHotChanges(&snapshots[real_pos]); + snap.fillHotChanges(snapshots[real_pos], frame_of_change, frame_of_change); } - AddItemToHistory(inp); + AddItemToHistory(snap); } branches.ChangesMadeSinceBranch(); } void HISTORY::RegisterImport(MovieData& md, char* filename) { // create new snapshot - SNAPSHOT inp; - inp.init(md, taseditor_config.enable_hot_changes, GetInputType(currMovieData)); + SNAPSHOT snap; + snap.init(md, taseditor_config.enable_hot_changes, GetInputType(currMovieData)); // check if there are input differences from latest snapshot int real_pos = (history_start_pos + history_cursor_pos) % history_size; - int first_changes = inp.findFirstChange(snapshots[real_pos]); + int first_changes = snap.findFirstChange(snapshots[real_pos]); if (first_changes >= 0) { // differences found - inp.jump_frame = first_changes; - inp.start_frame = 0; - inp.end_frame = inp.size - 1; + snap.jump_frame = first_changes; + snap.start_frame = 0; + snap.end_frame = snap.size - 1; // fill description: - inp.mod_type = MODTYPE_IMPORT; - strcat(inp.description, modCaptions[inp.mod_type]); + snap.mod_type = MODTYPE_IMPORT; + strcat(snap.description, modCaptions[snap.mod_type]); // add filename to description - strcat(inp.description, " "); - strncat(inp.description, filename, SNAPSHOT_DESC_MAX_LENGTH - strlen(inp.description) - 1); + strcat(snap.description, " "); + strncat(snap.description, filename, SNAPSHOT_DESC_MAX_LENGTH - strlen(snap.description) - 1); if (taseditor_config.enable_hot_changes) { // do not inherit old hotchanges, because imported input (most likely) doesn't have direct connection with recent edits, so old hotchanges are irrelevant and should not be copied - inp.fillHotChanges(snapshots[real_pos], first_changes); + snap.fillHotChanges(snapshots[real_pos], first_changes); } - AddItemToHistory(inp); - inp.toMovie(currMovieData); + AddItemToHistory(snap); + snap.toMovie(currMovieData); piano_roll.UpdateItemCount(); branches.ChangesMadeSinceBranch(); project.SetProjectChanged(); @@ -830,41 +830,41 @@ void HISTORY::RegisterImport(MovieData& md, char* filename) int HISTORY::RegisterLuaChanges(const char* name, int start, bool InsertionDeletion_was_made) { // create new shanshot - SNAPSHOT inp; - inp.init(currMovieData, taseditor_config.enable_hot_changes); + SNAPSHOT snap; + snap.init(currMovieData, taseditor_config.enable_hot_changes); // check if there are input differences from latest snapshot int real_pos = (history_start_pos + history_cursor_pos) % history_size; - int first_changes = inp.findFirstChange(snapshots[real_pos], start); + int first_changes = snap.findFirstChange(snapshots[real_pos], start); if (first_changes >= 0) { // differences found // fill description: - inp.mod_type = MODTYPE_LUA_CHANGE; + snap.mod_type = MODTYPE_LUA_CHANGE; if (name[0]) { // user provided custom name of operation - strcat(inp.description, LuaCaptionPrefix); - strncat(inp.description, name, LUACHANGES_NAME_MAX_LEN); + strcat(snap.description, LuaCaptionPrefix); + strncat(snap.description, name, LUACHANGES_NAME_MAX_LEN); } else { // set default name - strcat(inp.description, modCaptions[inp.mod_type]); + strcat(snap.description, modCaptions[snap.mod_type]); } - inp.jump_frame = first_changes; - inp.start_frame = start; - inp.end_frame = -1; + snap.jump_frame = first_changes; + snap.start_frame = start; + snap.end_frame = -1; // add upper frame to description char framenum[11]; - strcat(inp.description, " "); + strcat(snap.description, " "); _itoa(first_changes, framenum, 10); - strcat(inp.description, framenum); + strcat(snap.description, framenum); // set hotchanges if (taseditor_config.enable_hot_changes) { if (InsertionDeletion_was_made) { - // do it hard way: take old hot_changes and insert/delete rows to create a snapshot that is comparable to inp - if (inp.input_type == snapshots[real_pos].input_type) + // do it hard way: take old hot_changes and insert/delete rows to create a snapshot that is comparable to the snap + if (snap.input_type == snapshots[real_pos].input_type) { // create temp copy of current snapshot (we need it as a container for hot_changes) SNAPSHOT hotchanges_snapshot = snapshots[real_pos]; @@ -874,21 +874,21 @@ int HISTORY::RegisterLuaChanges(const char* name, int start, bool InsertionDelet } else { hotchanges_snapshot.has_hot_changes = true; - hotchanges_snapshot.hot_changes.resize(joysticks_per_frame[inp.input_type] * hotchanges_snapshot.size * HOTCHANGE_BYTES_PER_JOY); + hotchanges_snapshot.hot_changes.resize(joysticks_per_frame[snap.input_type] * hotchanges_snapshot.size * HOTCHANGE_BYTES_PER_JOY); } - // insert/delete frames in hotchanges_snapshot, so that it will be the same size as inp + // insert/delete frames in hotchanges_snapshot, so that it will be the same size as the snap taseditor_lua.InsertDelete_rows_to_Snaphot(hotchanges_snapshot); - inp.copyHotChanges(&hotchanges_snapshot); - inp.fillHotChanges(hotchanges_snapshot, first_changes); + snap.copyHotChanges(&hotchanges_snapshot); + snap.fillHotChanges(hotchanges_snapshot, first_changes); } } else { - // easy way: inp.size is equal to currentsnapshot.size, so we can simply inherit hotchanges - inp.inheritHotChanges(&snapshots[real_pos]); - inp.fillHotChanges(snapshots[real_pos], first_changes); + // easy way: snap.size is equal to currentsnapshot.size, so we can simply inherit hotchanges + snap.inheritHotChanges(&snapshots[real_pos]); + snap.fillHotChanges(snapshots[real_pos], first_changes); } } - AddItemToHistory(inp); + AddItemToHistory(snap); branches.ChangesMadeSinceBranch(); } return first_changes; @@ -928,7 +928,7 @@ bool HISTORY::load(EMUFILE *is, bool really_load) return false; } int i = -1; - SNAPSHOT inp; + SNAPSHOT snap; BOOKMARK bookm; // read "HISTORY" string char save_id[HISTORY_ID_LEN]; @@ -966,7 +966,7 @@ bool HISTORY::load(EMUFILE *is, bool really_load) // and still need to skip some undo items for (i = 0; i < num_items_to_skip; ++i) { - if (inp.skipLoad(is)) goto error; + if (snap.skipLoad(is)) goto error; if (bookm.skipLoad(is)) goto error; if (is->fseek(1, SEEK_CUR)) goto error; // backup_current_branch } @@ -986,7 +986,7 @@ bool HISTORY::load(EMUFILE *is, bool really_load) // skip redo items if needed for (; i < total; ++i) { - if (inp.skipLoad(is)) goto error; + if (snap.skipLoad(is)) goto error; if (bookm.skipLoad(is)) goto error; if (is->fseek(1, SEEK_CUR)) goto error; // backup_current_branch } diff --git a/src/drivers/win/taseditor/history.h b/src/drivers/win/taseditor/history.h index 54fedc4c..5476bd36 100644 --- a/src/drivers/win/taseditor/history.h +++ b/src/drivers/win/taseditor/history.h @@ -129,8 +129,8 @@ public: HWND hwndHistoryList; private: - void AddItemToHistory(SNAPSHOT &inp, int cur_branch = 0); - void AddItemToHistory(SNAPSHOT &inp, int cur_branch, BOOKMARK &bookm); + void AddItemToHistory(SNAPSHOT &snap, int cur_branch = 0); + void AddItemToHistory(SNAPSHOT &snap, int cur_branch, BOOKMARK &bookm); std::vector snapshots; std::vector backup_bookmarks; diff --git a/src/drivers/win/taseditor/piano_roll.cpp b/src/drivers/win/taseditor/piano_roll.cpp index 4cb4e8e4..0ef4cab4 100644 --- a/src/drivers/win/taseditor/piano_roll.cpp +++ b/src/drivers/win/taseditor/piano_roll.cpp @@ -19,7 +19,6 @@ Piano Roll - Piano Roll interface * on demand: launches flashes in the Header * implements the working of mouse wheel: List scrolling, Playback cursor movement, Selection cursor movement, scrolling across gaps in Input/markers * implements context menu on Right-click -* updates mouse cursor icon depending on item under cursor * stores resources: save id, ids of columns, widths of columns, tables of colors, gradient of Hot Changes, gradient of Header flashings, timings of flashes, all fonts used in TAS Editor, images ------------------------------------------------------------------------------------ */ @@ -355,40 +354,9 @@ void PIANO_ROLL::update() } column_under_mouse = info.iSubItem; } - // change mouse cursor depending on what it points at - LPCSTR cursor_icon = IDC_ARROW; - switch (drag_mode) - { - case DRAG_MODE_NONE: - { - // normal mouseover - //if (row_under_mouse >= 0 && (column_under_mouse == COLUMN_FRAMENUM || column_under_mouse == COLUMN_FRAMENUM2) && markers_manager.GetMarker(row_under_mouse)) - // cursor_icon = IDC_SIZEALL; - break; - } - case DRAG_MODE_PLAYBACK: - { - // dragging Playback cursor - show either normal arrow or arrow+wait - if (playback.pause_frame) - cursor_icon = IDC_APPSTARTING; - break; - } - case DRAG_MODE_MARKER: - { - // dragging Marker - cursor_icon = IDC_SIZEALL; - break; - } - case DRAG_MODE_OBSERVE: - case DRAG_MODE_SET: - case DRAG_MODE_UNSET: - case DRAG_MODE_SELECTION: - // show normal arrow - break; - } - SetCursor(LoadCursor(0, cursor_icon)); // and don't check until mouse moves or Piano Roll scrolls must_check_item_under_mouse = false; + taseditor_window.must_update_mouse_cursor = true; } // update state of Shift/Ctrl/Alt holding @@ -1820,4 +1788,3 @@ LRESULT APIENTRY MarkerDragBoxWndProc(HWND hwnd, UINT message, WPARAM wParam, LP return DefWindowProc(hwnd, message, wParam, lParam); } - diff --git a/src/drivers/win/taseditor/playback.cpp b/src/drivers/win/taseditor/playback.cpp index 29445e6c..09eae5f5 100644 --- a/src/drivers/win/taseditor/playback.cpp +++ b/src/drivers/win/taseditor/playback.cpp @@ -372,6 +372,7 @@ void PLAYBACK::RedrawMarker() char num[11]; _itoa(shown_marker, num, 10); strcat(new_text, num); + strcat(new_text, " "); SetWindowText(hwndPlaybackMarker, new_text); // change marker note strcpy(new_text, markers_manager.GetNote(shown_marker).c_str()); diff --git a/src/drivers/win/taseditor/selection.cpp b/src/drivers/win/taseditor/selection.cpp index fbac7a8e..568f9499 100644 --- a/src/drivers/win/taseditor/selection.cpp +++ b/src/drivers/win/taseditor/selection.cpp @@ -189,6 +189,7 @@ void SELECTION::RedrawMarker() char num[11]; _itoa(shown_marker, num, 10); strcat(new_text, num); + strcat(new_text, " "); SetWindowText(hwndSelectionMarker, new_text); // change marker note strcpy(new_text, markers_manager.GetNote(shown_marker).c_str()); diff --git a/src/drivers/win/taseditor/snapshot.cpp b/src/drivers/win/taseditor/snapshot.cpp index f8e58141..7c6f0057 100644 --- a/src/drivers/win/taseditor/snapshot.cpp +++ b/src/drivers/win/taseditor/snapshot.cpp @@ -316,17 +316,17 @@ bool SNAPSHOT::skipLoad(EMUFILE *is) } // return true if any difference is found -bool SNAPSHOT::checkDiff(SNAPSHOT& inp) +bool SNAPSHOT::checkDiff(SNAPSHOT& snap) { - if (size != inp.size) return true; - if (findFirstChange(inp) >= 0) + if (size != snap.size) return true; + if (findFirstChange(snap) >= 0) return true; else return false; } // fills map of bits judging on which joypads differ (this function is only used by "Record" modtype) -void SNAPSHOT::fillJoypadsDiff(SNAPSHOT& inp, int frame) +void SNAPSHOT::fillJoypadsDiff(SNAPSHOT& snap, int frame) { rec_joypad_diff_bits = 0; uint32 current_mask = 1; @@ -339,9 +339,9 @@ void SNAPSHOT::fillJoypadsDiff(SNAPSHOT& inp, int frame) int pos = frame * BYTES_PER_JOYSTICK * joysticks_per_frame[input_type]; for (int i = 0; i < BYTES_PER_JOYSTICK * joysticks_per_frame[input_type]; ++i) { - if (pos < (inp.size * BYTES_PER_JOYSTICK * joysticks_per_frame[input_type])) + if (pos < (snap.size * BYTES_PER_JOYSTICK * joysticks_per_frame[input_type])) { - if (joysticks[pos+i] != inp.joysticks[pos+i]) rec_joypad_diff_bits |= current_mask; + if (joysticks[pos+i] != snap.joysticks[pos+i]) rec_joypad_diff_bits |= current_mask; } else { if (joysticks[pos+i]) rec_joypad_diff_bits |= current_mask; @@ -354,33 +354,33 @@ void SNAPSHOT::fillJoypadsDiff(SNAPSHOT& inp, int frame) } // return number of first frame of difference between two snapshots -int SNAPSHOT::findFirstChange(SNAPSHOT& inp, int start, int end) +int SNAPSHOT::findFirstChange(SNAPSHOT& snap, int start, int end) { // if these two snapshots have different input_type (abnormal situation) then refuse to search and return the beginning - if (inp.input_type != input_type) + if (snap.input_type != input_type) return start; // search for differences to the specified end (or to the end of this snapshot) if (end < 0 || end >= size) end = size-1; - int inp_end = inp.size; + int snap_end = snap.size; switch(input_type) { case INPUT_TYPE_FOURSCORE: { for (int frame = start, pos = start * BYTES_PER_JOYSTICK * joysticks_per_frame[input_type]; frame <= end; ++frame) { - // return the frame if found different byte, or found emptiness in inp when there's non-zero value here - if (frame < inp_end) + // return the frame if found different byte, or found emptiness in the snap when there's non-zero value here + if (frame < snap_end) { - if (joysticks[pos] != inp.joysticks[pos]) return frame; + if (joysticks[pos] != snap.joysticks[pos]) return frame; pos++; - if (joysticks[pos] != inp.joysticks[pos]) return frame; + if (joysticks[pos] != snap.joysticks[pos]) return frame; pos++; - if (joysticks[pos] != inp.joysticks[pos]) return frame; + if (joysticks[pos] != snap.joysticks[pos]) return frame; pos++; - if (joysticks[pos] != inp.joysticks[pos]) return frame; + if (joysticks[pos] != snap.joysticks[pos]) return frame; pos++; - if (commands[frame] != inp.commands[frame]) return frame; + if (commands[frame] != snap.commands[frame]) return frame; } else { if (joysticks[pos++]) return frame; @@ -396,14 +396,14 @@ int SNAPSHOT::findFirstChange(SNAPSHOT& inp, int start, int end) { for (int frame = start, pos = start * BYTES_PER_JOYSTICK * joysticks_per_frame[input_type]; frame <= end; ++frame) { - // return the frame if found different byte, or found emptiness in inp when there's non-zero value here - if (frame < inp_end) + // return the frame if found different byte, or found emptiness in the snap when there's non-zero value here + if (frame < snap_end) { - if (joysticks[pos] != inp.joysticks[pos]) return frame; + if (joysticks[pos] != snap.joysticks[pos]) return frame; pos++; - if (joysticks[pos] != inp.joysticks[pos]) return frame; + if (joysticks[pos] != snap.joysticks[pos]) return frame; pos++; - if (commands[frame] != inp.commands[frame]) return frame; + if (commands[frame] != snap.commands[frame]) return frame; } else { if (joysticks[pos++]) return frame; @@ -417,12 +417,12 @@ int SNAPSHOT::findFirstChange(SNAPSHOT& inp, int start, int end) { for (int frame = start, pos = start * BYTES_PER_JOYSTICK * joysticks_per_frame[input_type]; frame <= end; ++frame) { - // return the frame if found different byte, or found emptiness in inp when there's non-zero value here - if (frame < inp_end) + // return the frame if found different byte, or found emptiness in the snap when there's non-zero value here + if (frame < snap_end) { - if (joysticks[pos] != inp.joysticks[pos]) return frame; + if (joysticks[pos] != snap.joysticks[pos]) return frame; pos++; - if (commands[frame] != inp.commands[frame]) return frame; + if (commands[frame] != snap.commands[frame]) return frame; } else { if (joysticks[pos++]) return frame; @@ -433,7 +433,7 @@ int SNAPSHOT::findFirstChange(SNAPSHOT& inp, int start, int end) } } // if current size is less then previous, return last frame (=size-1) as the frame of difference - if (size < inp_end) return size-1; + if (size < snap_end) return size-1; // no changes were found return -1; } @@ -759,35 +759,35 @@ void SNAPSHOT::inheritHotChanges_PasteInsert(SNAPSHOT* source_of_hotchanges, Sel } } } -void SNAPSHOT::fillHotChanges(SNAPSHOT& inp, int start, int end) +void SNAPSHOT::fillHotChanges(SNAPSHOT& snap, int start, int end) { // if these two snapshots have different input_type (abnormal situation) then refuse to compare - if (inp.input_type != input_type) + if (snap.input_type != input_type) return; // compare snapshots to the specified end (or to the end of this snapshot) if (end < 0 || end >= size) end = size-1; - int inp_end = inp.size; + int snap_end = snap.size; switch(input_type) { case INPUT_TYPE_FOURSCORE: { for (int frame = start, pos = start * BYTES_PER_JOYSTICK * joysticks_per_frame[input_type]; frame <= end; ++frame) { - // consider changed if found different byte, or found emptiness in inp when there's non-zero value here - if (frame < inp_end) + // consider changed if found different byte, or found emptiness in the snap when there's non-zero value here + if (frame < snap_end) { - if (joysticks[pos] != inp.joysticks[pos]) - SetMaxHotChange_Bits(frame, 0, joysticks[pos] ^ inp.joysticks[pos]); + if (joysticks[pos] != snap.joysticks[pos]) + SetMaxHotChange_Bits(frame, 0, joysticks[pos] ^ snap.joysticks[pos]); pos++; - if (joysticks[pos] != inp.joysticks[pos]) - SetMaxHotChange_Bits(frame, 1, joysticks[pos] ^ inp.joysticks[pos]); + if (joysticks[pos] != snap.joysticks[pos]) + SetMaxHotChange_Bits(frame, 1, joysticks[pos] ^ snap.joysticks[pos]); pos++; - if (joysticks[pos] != inp.joysticks[pos]) - SetMaxHotChange_Bits(frame, 2, joysticks[pos] ^ inp.joysticks[pos]); + if (joysticks[pos] != snap.joysticks[pos]) + SetMaxHotChange_Bits(frame, 2, joysticks[pos] ^ snap.joysticks[pos]); pos++; - if (joysticks[pos] != inp.joysticks[pos]) - SetMaxHotChange_Bits(frame, 3, joysticks[pos] ^ inp.joysticks[pos]); + if (joysticks[pos] != snap.joysticks[pos]) + SetMaxHotChange_Bits(frame, 3, joysticks[pos] ^ snap.joysticks[pos]); pos++; } else { @@ -811,14 +811,14 @@ void SNAPSHOT::fillHotChanges(SNAPSHOT& inp, int start, int end) { for (int frame = start, pos = start * BYTES_PER_JOYSTICK * joysticks_per_frame[input_type]; frame <= end; ++frame) { - // consider changed if found different byte, or found emptiness in inp when there's non-zero value here - if (frame < inp_end) + // consider changed if found different byte, or found emptiness in the snap when there's non-zero value here + if (frame < snap_end) { - if (joysticks[pos] != inp.joysticks[pos]) - SetMaxHotChange_Bits(frame, 0, joysticks[pos] ^ inp.joysticks[pos]); + if (joysticks[pos] != snap.joysticks[pos]) + SetMaxHotChange_Bits(frame, 0, joysticks[pos] ^ snap.joysticks[pos]); pos++; - if (joysticks[pos] != inp.joysticks[pos]) - SetMaxHotChange_Bits(frame, 1, joysticks[pos] ^ inp.joysticks[pos]); + if (joysticks[pos] != snap.joysticks[pos]) + SetMaxHotChange_Bits(frame, 1, joysticks[pos] ^ snap.joysticks[pos]); pos++; } else { @@ -836,11 +836,11 @@ void SNAPSHOT::fillHotChanges(SNAPSHOT& inp, int start, int end) { for (int frame = start, pos = start * BYTES_PER_JOYSTICK * joysticks_per_frame[input_type]; frame <= end; ++frame) { - // consider changed if found different byte, or found emptiness in inp when there's non-zero value here - if (frame < inp_end) + // consider changed if found different byte, or found emptiness in the snap when there's non-zero value here + if (frame < snap_end) { - if (joysticks[pos] != inp.joysticks[pos]) - SetMaxHotChange_Bits(frame, 0, joysticks[pos] ^ inp.joysticks[pos]); + if (joysticks[pos] != snap.joysticks[pos]) + SetMaxHotChange_Bits(frame, 0, joysticks[pos] ^ snap.joysticks[pos]); pos++; } else { diff --git a/src/drivers/win/taseditor/snapshot.h b/src/drivers/win/taseditor/snapshot.h index 4d6eefa2..dc77a25f 100644 --- a/src/drivers/win/taseditor/snapshot.h +++ b/src/drivers/win/taseditor/snapshot.h @@ -30,10 +30,10 @@ public: bool load(EMUFILE *is); bool skipLoad(EMUFILE *is); - bool checkDiff(SNAPSHOT& inp); - void fillJoypadsDiff(SNAPSHOT& inp, int frame); + bool checkDiff(SNAPSHOT& snap); + void fillJoypadsDiff(SNAPSHOT& snap, int frame); - int findFirstChange(SNAPSHOT& inp, int start = 0, int end = -1); + int findFirstChange(SNAPSHOT& snap, int start = 0, int end = -1); int findFirstChange(MovieData& md, int start = 0, int end = -1); int GetJoystickInfo(int frame, int joy); @@ -48,7 +48,7 @@ public: void inheritHotChanges_InsertSelection(SNAPSHOT* source_of_hotchanges); void inheritHotChanges_InsertNum(SNAPSHOT* source_of_hotchanges, int start, int frames); void inheritHotChanges_PasteInsert(SNAPSHOT* source_of_hotchanges, SelectionFrames& inserted_set); - void fillHotChanges(SNAPSHOT& inp, int start = 0, int end = -1); + void fillHotChanges(SNAPSHOT& snap, int start = 0, int end = -1); void SetMaxHotChange_Bits(int frame, int joypad, uint8 joy_bits); void SetMaxHotChange(int frame, int absolute_button); diff --git a/src/drivers/win/taseditor/taseditor_project.cpp b/src/drivers/win/taseditor/taseditor_project.cpp index 7249b599..27102fd0 100644 --- a/src/drivers/win/taseditor/taseditor_project.cpp +++ b/src/drivers/win/taseditor/taseditor_project.cpp @@ -125,6 +125,7 @@ bool TASEDITOR_PROJECT::save(const char* different_name, bool save_binary, bool { // change cursor to hourglass SetCursor(LoadCursor(0, IDC_WAIT)); + currMovieData.loadFrameCount = currMovieData.records.size(); currMovieData.emuVersion = FCEU_VERSION_NUMERIC; currMovieData.dump(ofs, save_binary); @@ -151,7 +152,7 @@ bool TASEDITOR_PROJECT::save(const char* different_name, bool save_binary, bool if (!different_name) this->reset(); // restore cursor - piano_roll.must_check_item_under_mouse = true; + taseditor_window.must_update_mouse_cursor = true; return true; } else { @@ -171,6 +172,7 @@ bool TASEDITOR_PROJECT::load(char* fullname) // change cursor to hourglass SetCursor(LoadCursor(0, IDC_WAIT)); + MovieData tempMovieData = MovieData(); extern bool LoadFM2(MovieData& movieData, EMUFILE* fp, int size, bool stopAfterHeader); if (LoadFM2(tempMovieData, &ifs, ifs.size(), false)) @@ -270,7 +272,7 @@ bool TASEDITOR_PROJECT::load(char* fullname) reset(); RenameProject(fullname); // restore mouse cursor shape - piano_roll.must_check_item_under_mouse = true; + taseditor_window.must_update_mouse_cursor = true; return true; } diff --git a/src/drivers/win/taseditor/taseditor_window.cpp b/src/drivers/win/taseditor/taseditor_window.cpp index 1205a937..bcab7ae3 100644 --- a/src/drivers/win/taseditor/taseditor_window.cpp +++ b/src/drivers/win/taseditor/taseditor_window.cpp @@ -11,9 +11,10 @@ Window - User Interface [Singleton] * implements all operations with TAS Editor window: creating, redrawing, resizing, moving, tooltips, clicks +* subclasses all buttons and checkboxes in TAS Editor window GUI in order to disable Spacebar key and process Middle clicks * processes OS messages and sends signals from user to TAS Editor modules (also implements some minor commands on-site, like Greenzone capacity dialog and such) * switches off/on emulator's keyboard input when the window loses/gains focus -* on demand: updates the window caption +* on demand: updates the window caption; updates mouse cursor icon * updates all checkboxes and menu items when some settings change * stores info about 10 last projects (File->Recent) and updates it when saving/loading files * stores resources: window caption, help filename, size and other properties of all GUI items @@ -45,6 +46,7 @@ extern EDITOR editor; extern SPLICER splicer; extern MARKERS_MANAGER markers_manager; extern BOOKMARKS bookmarks; +extern BRANCHES branches; extern HISTORY history; extern POPUP_DISPLAY popup_display; @@ -57,7 +59,63 @@ extern char* GetKeyComboName(int c); extern BOOL CALLBACK FindNoteProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); extern BOOL CALLBACK AboutProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); +// main window wndproc BOOL CALLBACK WndprocTasEditor(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam); +// wndprocs for "Marker X" text fields +LRESULT APIENTRY IDC_PLAYBACK_MARKER_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); +LRESULT APIENTRY IDC_SELECTION_MARKER_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); +WNDPROC IDC_PLAYBACK_MARKER_oldWndProc = 0, IDC_SELECTION_MARKER_oldWndProc = 0; +// wndprocs for all buttons and checkboxes +LRESULT APIENTRY IDC_PROGRESS_BUTTON_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); +LRESULT APIENTRY IDC_BRANCHES_BUTTON_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); +LRESULT APIENTRY TASEDITOR_REWIND_FULL_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); +LRESULT APIENTRY TASEDITOR_REWIND_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); +LRESULT APIENTRY TASEDITOR_PLAYSTOP_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); +LRESULT APIENTRY TASEDITOR_FORWARD_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); +LRESULT APIENTRY TASEDITOR_FORWARD_FULL_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); +LRESULT APIENTRY CHECK_FOLLOW_CURSOR_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); +LRESULT APIENTRY CHECK_AUTORESTORE_PLAYBACK_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); +LRESULT APIENTRY IDC_RADIO_ALL_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); +LRESULT APIENTRY IDC_RADIO_1P_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); +LRESULT APIENTRY IDC_RADIO_2P_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); +LRESULT APIENTRY IDC_RADIO_3P_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); +LRESULT APIENTRY IDC_RADIO_4P_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); +LRESULT APIENTRY IDC_SUPERIMPOSE_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); +LRESULT APIENTRY IDC_USEPATTERN_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); +LRESULT APIENTRY TASEDITOR_PREV_MARKER_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); +LRESULT APIENTRY TASEDITOR_FIND_BEST_SIMILAR_MARKER_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); +LRESULT APIENTRY TASEDITOR_FIND_NEXT_SIMILAR_MARKER_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); +LRESULT APIENTRY TASEDITOR_NEXT_MARKER_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); +LRESULT APIENTRY CHECK_TURBO_SEEK_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); +LRESULT APIENTRY IDC_RECORDING_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); +LRESULT APIENTRY TASEDITOR_RUN_MANUAL_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); +LRESULT APIENTRY IDC_RUN_AUTO_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); +// variables storing old wndprocs +WNDPROC + IDC_PROGRESS_BUTTON_oldWndProc = 0, + IDC_BRANCHES_BUTTON_oldWndProc = 0, + TASEDITOR_REWIND_FULL_oldWndProc = 0, + TASEDITOR_REWIND_oldWndProc = 0, + TASEDITOR_PLAYSTOP_oldWndProc = 0, + TASEDITOR_FORWARD_oldWndProc = 0, + TASEDITOR_FORWARD_FULL_oldWndProc = 0, + CHECK_FOLLOW_CURSOR_oldWndProc = 0, + CHECK_AUTORESTORE_PLAYBACK_oldWndProc = 0, + IDC_RADIO_ALL_oldWndProc = 0, + IDC_RADIO_1P_oldWndProc = 0, + IDC_RADIO_2P_oldWndProc = 0, + IDC_RADIO_3P_oldWndProc = 0, + IDC_RADIO_4P_oldWndProc = 0, + IDC_SUPERIMPOSE_oldWndProc = 0, + IDC_USEPATTERN_oldWndProc = 0, + TASEDITOR_PREV_MARKER_oldWndProc = 0, + TASEDITOR_FIND_BEST_SIMILAR_MARKER_oldWndProc = 0, + TASEDITOR_FIND_NEXT_SIMILAR_MARKER_oldWndProc = 0, + TASEDITOR_NEXT_MARKER_oldWndProc = 0, + CHECK_TURBO_SEEK_oldWndProc = 0, + IDC_RECORDING_oldWndProc = 0, + TASEDITOR_RUN_MANUAL_oldWndProc = 0, + IDC_RUN_AUTO_oldWndProc = 0; // Recent Menu HMENU recent_projects_menu; @@ -84,15 +142,15 @@ Window_items_struct window_items[TASEDITOR_WINDOW_TOTAL_ITEMS] = { IDC_BOOKMARKS_BOX, -1, 0, 0, 0, "", "", false, 0, 0, IDC_HISTORY_BOX, -1, 0, 0, -1, "", "", false, 0, 0, TASEDITOR_REWIND_FULL, -1, 0, 0, 0, "Send Playback to previous Marker (mouse: Shift+Wheel up) (hotkey: Shift+PageUp)", "", false, 0, 0, - TASEDITOR_REWIND, -1, 0, 0, 0, "Rewind 1 frame (mouse: Right button+Wheel up) (hotkey: Shift+Up)", "", false, 0, 0, // EMUCMD_TASEDITOR_REWIND + TASEDITOR_REWIND, -1, 0, 0, 0, "Rewind 1 frame (mouse: Right button+Wheel up) (hotkey: Shift+Up)", "", false, EMUCMD_TASEDITOR_REWIND, 0, TASEDITOR_PLAYSTOP, -1, 0, 0, 0, "Pause/Unpause Emulation (mouse: Middle button)", "", false, EMUCMD_PAUSE, 0, - TASEDITOR_FORWARD, -1, 0, 0, 0, "Advance 1 frame (mouse: Right button+Wheel down) (hotkey: Shift+Down)", "", false, 0, 0, + TASEDITOR_FORWARD, -1, 0, 0, 0, "Advance 1 frame (mouse: Right button+Wheel down) (hotkey: Shift+Down)", "", false, EMUCMD_FRAME_ADVANCE, 0, TASEDITOR_FORWARD_FULL, -1, 0, 0, 0, "Send Playback to next Marker (mouse: Shift+Wheel down) (hotkey: Shift+PageDown)", "", false, 0, 0, IDC_PROGRESS1, -1, 0, 0, 0, "", "", false, 0, 0, CHECK_FOLLOW_CURSOR, -1, 0, 0, 0, "The Piano Roll will follow Playback cursor movements", "", false, 0, 0, - CHECK_AUTORESTORE_PLAYBACK, -1, 0, 0, 0, "If you change input above Playback, cursor will run to where it was before change", "", false, 0, 0, + CHECK_AUTORESTORE_PLAYBACK, -1, 0, 0, 0, "When you change input above Playback cursor, the cursor returns to where it was before the change", "", false, 0, 0, IDC_BOOKMARKSLIST, -1, 0, 0, 0, "Right click = set Bookmark, Left click = jump to Bookmark or load Branch", "", false, 0, 0, - IDC_HISTORYLIST, -1, 0, 0, -1, "Click to revert the movie back to that time", "", false, 0, 0, + IDC_HISTORYLIST, -1, 0, 0, -1, "Click to revert the project back to that time", "", false, 0, 0, IDC_RADIO_ALL, -1, 0, 0, 0, "", "", false, 0, 0, IDC_RADIO_1P, -1, 0, 0, 0, "", "", false, 0, 0, IDC_RADIO_2P, -1, 0, 0, 0, "", "", false, 0, 0, @@ -104,13 +162,11 @@ 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 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 Piano Roll to Selection (hotkey: tap Ctrl twice)", "", false, 0, 0, + IDC_PLAYBACK_MARKER, 0, 0, 0, 0, "Click here to scroll Piano Roll to Playback cursor (hotkey: tap Shift twice)", "", true, 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, + IDC_SELECTION_MARKER, 0, -1, 0, -1, "Click here to scroll Piano Roll to Selection (hotkey: tap Ctrl twice)", "", true, 0, 0, + IDC_BRANCHES_BITMAP, -1, 0, 0, 0, "Click on a Bookmark to send Playback cursor there, double-click to load its Branch", "", false, 0, 0, CHECK_TURBO_SEEK, -1, 0, 0, 0, "Uncheck when you need to watch seeking in slow motion", "", false, 0, 0, IDC_TEXT_SELECTION, -1, 0, 0, 0, "Current size of Selection", "", true, 0, 0, IDC_TEXT_CLIPBOARD, -1, 0, 0, 0, "Current size of Input in the Clipboard", "", true, 0, 0, @@ -205,6 +261,34 @@ void TASEDITOR_WINDOW::init() } } UpdateTooltips(); + // subclass "Marker X" text fields + IDC_PLAYBACK_MARKER_oldWndProc = (WNDPROC)SetWindowLong(GetDlgItem(hwndTasEditor, IDC_PLAYBACK_MARKER), GWL_WNDPROC, (LONG)IDC_PLAYBACK_MARKER_WndProc); + IDC_SELECTION_MARKER_oldWndProc = (WNDPROC)SetWindowLong(GetDlgItem(hwndTasEditor, IDC_SELECTION_MARKER), GWL_WNDPROC, (LONG)IDC_SELECTION_MARKER_WndProc); + // subclass all buttons + IDC_PROGRESS_BUTTON_oldWndProc = (WNDPROC)SetWindowLong(GetDlgItem(hwndTasEditor, IDC_PROGRESS_BUTTON), GWL_WNDPROC, (LONG)IDC_PROGRESS_BUTTON_WndProc); + IDC_BRANCHES_BUTTON_oldWndProc = (WNDPROC)SetWindowLong(GetDlgItem(hwndTasEditor, IDC_BRANCHES_BUTTON), GWL_WNDPROC, (LONG)IDC_BRANCHES_BUTTON_WndProc); + TASEDITOR_REWIND_FULL_oldWndProc = (WNDPROC)SetWindowLong(GetDlgItem(hwndTasEditor, TASEDITOR_REWIND_FULL), GWL_WNDPROC, (LONG)TASEDITOR_REWIND_FULL_WndProc); + TASEDITOR_REWIND_oldWndProc = (WNDPROC)SetWindowLong(GetDlgItem(hwndTasEditor, TASEDITOR_REWIND), GWL_WNDPROC, (LONG)TASEDITOR_REWIND_WndProc); + TASEDITOR_PLAYSTOP_oldWndProc = (WNDPROC)SetWindowLong(GetDlgItem(hwndTasEditor, TASEDITOR_PLAYSTOP), GWL_WNDPROC, (LONG)TASEDITOR_PLAYSTOP_WndProc); + TASEDITOR_FORWARD_oldWndProc = (WNDPROC)SetWindowLong(GetDlgItem(hwndTasEditor, TASEDITOR_FORWARD), GWL_WNDPROC, (LONG)TASEDITOR_FORWARD_WndProc); + TASEDITOR_FORWARD_FULL_oldWndProc = (WNDPROC)SetWindowLong(GetDlgItem(hwndTasEditor, TASEDITOR_FORWARD_FULL), GWL_WNDPROC, (LONG)TASEDITOR_FORWARD_FULL_WndProc); + CHECK_FOLLOW_CURSOR_oldWndProc = (WNDPROC)SetWindowLong(GetDlgItem(hwndTasEditor, CHECK_FOLLOW_CURSOR), GWL_WNDPROC, (LONG)CHECK_FOLLOW_CURSOR_WndProc); + CHECK_AUTORESTORE_PLAYBACK_oldWndProc = (WNDPROC)SetWindowLong(GetDlgItem(hwndTasEditor, CHECK_AUTORESTORE_PLAYBACK), GWL_WNDPROC, (LONG)CHECK_AUTORESTORE_PLAYBACK_WndProc); + IDC_RADIO_ALL_oldWndProc = (WNDPROC)SetWindowLong(GetDlgItem(hwndTasEditor, IDC_RADIO_ALL), GWL_WNDPROC, (LONG)IDC_RADIO_ALL_WndProc); + IDC_RADIO_1P_oldWndProc = (WNDPROC)SetWindowLong(GetDlgItem(hwndTasEditor, IDC_RADIO_1P), GWL_WNDPROC, (LONG)IDC_RADIO_1P_WndProc); + IDC_RADIO_2P_oldWndProc = (WNDPROC)SetWindowLong(GetDlgItem(hwndTasEditor, IDC_RADIO_2P), GWL_WNDPROC, (LONG)IDC_RADIO_2P_WndProc); + IDC_RADIO_3P_oldWndProc = (WNDPROC)SetWindowLong(GetDlgItem(hwndTasEditor, IDC_RADIO_3P), GWL_WNDPROC, (LONG)IDC_RADIO_3P_WndProc); + IDC_RADIO_4P_oldWndProc = (WNDPROC)SetWindowLong(GetDlgItem(hwndTasEditor, IDC_RADIO_4P), GWL_WNDPROC, (LONG)IDC_RADIO_4P_WndProc); + IDC_SUPERIMPOSE_oldWndProc = (WNDPROC)SetWindowLong(GetDlgItem(hwndTasEditor, IDC_SUPERIMPOSE), GWL_WNDPROC, (LONG)IDC_SUPERIMPOSE_WndProc); + IDC_USEPATTERN_oldWndProc = (WNDPROC)SetWindowLong(GetDlgItem(hwndTasEditor, IDC_USEPATTERN), GWL_WNDPROC, (LONG)IDC_USEPATTERN_WndProc); + TASEDITOR_PREV_MARKER_oldWndProc = (WNDPROC)SetWindowLong(GetDlgItem(hwndTasEditor, TASEDITOR_PREV_MARKER), GWL_WNDPROC, (LONG)TASEDITOR_PREV_MARKER_WndProc); + TASEDITOR_FIND_BEST_SIMILAR_MARKER_oldWndProc = (WNDPROC)SetWindowLong(GetDlgItem(hwndTasEditor, TASEDITOR_FIND_BEST_SIMILAR_MARKER), GWL_WNDPROC, (LONG)TASEDITOR_FIND_BEST_SIMILAR_MARKER_WndProc); + TASEDITOR_FIND_NEXT_SIMILAR_MARKER_oldWndProc = (WNDPROC)SetWindowLong(GetDlgItem(hwndTasEditor, TASEDITOR_FIND_NEXT_SIMILAR_MARKER), GWL_WNDPROC, (LONG)TASEDITOR_FIND_NEXT_SIMILAR_MARKER_WndProc); + TASEDITOR_NEXT_MARKER_oldWndProc = (WNDPROC)SetWindowLong(GetDlgItem(hwndTasEditor, TASEDITOR_NEXT_MARKER), GWL_WNDPROC, (LONG)TASEDITOR_NEXT_MARKER_WndProc); + CHECK_TURBO_SEEK_oldWndProc = (WNDPROC)SetWindowLong(GetDlgItem(hwndTasEditor, CHECK_TURBO_SEEK), GWL_WNDPROC, (LONG)CHECK_TURBO_SEEK_WndProc); + IDC_RECORDING_oldWndProc = (WNDPROC)SetWindowLong(GetDlgItem(hwndTasEditor, IDC_RECORDING), GWL_WNDPROC, (LONG)IDC_RECORDING_WndProc); + TASEDITOR_RUN_MANUAL_oldWndProc = (WNDPROC)SetWindowLong(GetDlgItem(hwndTasEditor, TASEDITOR_RUN_MANUAL), GWL_WNDPROC, (LONG)TASEDITOR_RUN_MANUAL_WndProc); + IDC_RUN_AUTO_oldWndProc = (WNDPROC)SetWindowLong(GetDlgItem(hwndTasEditor, IDC_RUN_AUTO), GWL_WNDPROC, (LONG)IDC_RUN_AUTO_WndProc); // create "Recent" submenu recent_projects_menu = CreateMenu(); UpdateRecentProjectsMenu(); @@ -242,10 +326,67 @@ void TASEDITOR_WINDOW::exit() } void TASEDITOR_WINDOW::reset() { - + must_update_mouse_cursor = true; } void TASEDITOR_WINDOW::update() { + if (must_update_mouse_cursor) + { + // change mouse cursor depending on what it points at + LPCSTR cursor_icon = IDC_ARROW; + switch (piano_roll.drag_mode) + { + case DRAG_MODE_NONE: + { + // normal mouseover + if (bookmarks.edit_mode == EDIT_MODE_BRANCHES) + { + int branch_under_mouse = bookmarks.item_under_mouse; + if (branch_under_mouse >= 0 && branch_under_mouse < TOTAL_BOOKMARKS && bookmarks.bookmarks_array[branch_under_mouse].not_empty) + { + int current_branch = branches.GetCurrentBranch(); + if (current_branch >= 0 && current_branch < TOTAL_BOOKMARKS) + { + // find if the Branch belongs to the current timeline + int timeline_branch = branches.FindFullTimelineForBranch(current_branch); + while (timeline_branch != ITEM_UNDER_MOUSE_CLOUD) + { + if (timeline_branch == branch_under_mouse) + break; + timeline_branch = branches.parents[timeline_branch]; + } + if (timeline_branch == ITEM_UNDER_MOUSE_CLOUD) + // branch_under_mouse wasn't found in current timeline + cursor_icon = IDC_HELP; + } + } + } + + break; + } + case DRAG_MODE_PLAYBACK: + { + // user is dragging Playback cursor - show either normal arrow or arrow+wait + if (playback.pause_frame) + cursor_icon = IDC_APPSTARTING; + break; + } + case DRAG_MODE_MARKER: + { + // user is dragging Marker + cursor_icon = IDC_SIZEALL; + break; + } + case DRAG_MODE_OBSERVE: + case DRAG_MODE_SET: + case DRAG_MODE_UNSET: + case DRAG_MODE_SELECTION: + // user is drawing/selecting - show normal arrow + break; + } + SetCursor(LoadCursor(0, cursor_icon)); + must_update_mouse_cursor = false; + } } // -------------------------------------------------------------------------------- void TASEDITOR_WINDOW::CalculateItems() @@ -717,15 +858,6 @@ BOOL CALLBACK WndprocTasEditor(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPara break; } break; - case TASEDITOR_PLAYSTOP: - switch(((LPNMHDR)lParam)->code) - { - case NM_CLICK: - case NM_DBLCLK: - playback.ToggleEmulationPause(); - break; - } - break; } break; case WM_CLOSE: @@ -890,9 +1022,6 @@ BOOL CALLBACK WndprocTasEditor(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPara } else splicer.ClearFrames(); break; - case TASEDITOR_PLAYSTOP: - playback.ToggleEmulationPause(); - break; case CHECK_FOLLOW_CURSOR: taseditor_config.follow_playback ^= 1; taseditor_window.UpdateCheckedItems(); @@ -1161,17 +1290,6 @@ BOOL CALLBACK WndprocTasEditor(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPara } break; } - case IDC_JUMP_PLAYBACK_BUTTON: - { - piano_roll.FollowPlayback(); - break; - } - case IDC_JUMP_SELECTION_BUTTON: - { - if (piano_roll.drag_mode != DRAG_MODE_SELECTION) - piano_roll.FollowSelection(); - break; - } case ID_SELECTED_SETMARKERS: { editor.SetMarkers(); @@ -1382,5 +1500,347 @@ BOOL CALLBACK WndprocTasEditor(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPara } return FALSE; } - +// ----------------------------------------------------------------------------------------------- +// implementation of wndprocs for "Marker X" text +LRESULT APIENTRY IDC_PLAYBACK_MARKER_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) +{ + switch(msg) + { + case WM_LBUTTONDOWN: + case WM_LBUTTONDBLCLK: + piano_roll.FollowPlayback(); + break; + } + return CallWindowProc(IDC_PLAYBACK_MARKER_oldWndProc, hWnd, msg, wParam, lParam); +} +LRESULT APIENTRY IDC_SELECTION_MARKER_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) +{ + switch(msg) + { + case WM_LBUTTONDOWN: + case WM_LBUTTONDBLCLK: + if (piano_roll.drag_mode != DRAG_MODE_SELECTION) + piano_roll.FollowSelection(); + break; + } + return CallWindowProc(IDC_SELECTION_MARKER_oldWndProc, hWnd, msg, wParam, lParam); +} +// ----------------------------------------------------------------------------------------------- +// implementation of wndprocs for all buttons and checkboxes +LRESULT APIENTRY IDC_PROGRESS_BUTTON_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) +{ + switch(msg) + { + case WM_MBUTTONDOWN: + case WM_MBUTTONDBLCLK: + playback.MiddleButtonClick(); + return 0; + case WM_KEYDOWN: + return 0; // disable Spacebar + } + return CallWindowProc(IDC_PROGRESS_BUTTON_oldWndProc, hWnd, msg, wParam, lParam); +} +LRESULT APIENTRY IDC_BRANCHES_BUTTON_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) +{ + switch(msg) + { + case WM_MBUTTONDOWN: + case WM_MBUTTONDBLCLK: + playback.MiddleButtonClick(); + return 0; + case WM_KEYDOWN: + return 0; // disable Spacebar + } + return CallWindowProc(IDC_BRANCHES_BUTTON_oldWndProc, hWnd, msg, wParam, lParam); +} +LRESULT APIENTRY TASEDITOR_REWIND_FULL_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) +{ + switch(msg) + { + case WM_MBUTTONDOWN: + case WM_MBUTTONDBLCLK: + playback.MiddleButtonClick(); + return 0; + case WM_KEYDOWN: + return 0; // disable Spacebar + } + return CallWindowProc(TASEDITOR_REWIND_FULL_oldWndProc, hWnd, msg, wParam, lParam); +} +LRESULT APIENTRY TASEDITOR_REWIND_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) +{ + switch(msg) + { + case WM_MBUTTONDOWN: + case WM_MBUTTONDBLCLK: + playback.MiddleButtonClick(); + return 0; + case WM_KEYDOWN: + return 0; // disable Spacebar + } + return CallWindowProc(TASEDITOR_REWIND_oldWndProc, hWnd, msg, wParam, lParam); +} +LRESULT APIENTRY TASEDITOR_PLAYSTOP_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) +{ + switch(msg) + { + case WM_MBUTTONDOWN: + case WM_MBUTTONDBLCLK: + playback.MiddleButtonClick(); + return 0; + case WM_KEYDOWN: + return 0; // disable Spacebar + case WM_LBUTTONDOWN: + case WM_LBUTTONDBLCLK: + playback.ToggleEmulationPause(); + break; + } + return CallWindowProc(TASEDITOR_PLAYSTOP_oldWndProc, hWnd, msg, wParam, lParam); +} +LRESULT APIENTRY TASEDITOR_FORWARD_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) +{ + switch(msg) + { + case WM_MBUTTONDOWN: + case WM_MBUTTONDBLCLK: + playback.MiddleButtonClick(); + return 0; + case WM_KEYDOWN: + return 0; // disable Spacebar + } + return CallWindowProc(TASEDITOR_FORWARD_oldWndProc, hWnd, msg, wParam, lParam); +} +LRESULT APIENTRY TASEDITOR_FORWARD_FULL_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) +{ + switch(msg) + { + case WM_MBUTTONDOWN: + case WM_MBUTTONDBLCLK: + playback.MiddleButtonClick(); + return 0; + case WM_KEYDOWN: + return 0; // disable Spacebar + } + return CallWindowProc(TASEDITOR_FORWARD_FULL_oldWndProc, hWnd, msg, wParam, lParam); +} +LRESULT APIENTRY CHECK_FOLLOW_CURSOR_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) +{ + switch(msg) + { + case WM_MBUTTONDOWN: + case WM_MBUTTONDBLCLK: + playback.MiddleButtonClick(); + return 0; + case WM_KEYDOWN: + return 0; // disable Spacebar + } + return CallWindowProc(CHECK_FOLLOW_CURSOR_oldWndProc, hWnd, msg, wParam, lParam); +} +LRESULT APIENTRY CHECK_AUTORESTORE_PLAYBACK_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) +{ + switch(msg) + { + case WM_MBUTTONDOWN: + case WM_MBUTTONDBLCLK: + playback.MiddleButtonClick(); + return 0; + case WM_KEYDOWN: + return 0; // disable Spacebar + } + return CallWindowProc(CHECK_AUTORESTORE_PLAYBACK_oldWndProc, hWnd, msg, wParam, lParam); +} +LRESULT APIENTRY IDC_RADIO_ALL_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) +{ + switch(msg) + { + case WM_MBUTTONDOWN: + case WM_MBUTTONDBLCLK: + playback.MiddleButtonClick(); + return 0; + case WM_KEYDOWN: + return 0; // disable Spacebar + } + return CallWindowProc(IDC_RADIO_ALL_oldWndProc, hWnd, msg, wParam, lParam); +} +LRESULT APIENTRY IDC_RADIO_1P_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) +{ + switch(msg) + { + case WM_MBUTTONDOWN: + case WM_MBUTTONDBLCLK: + playback.MiddleButtonClick(); + return 0; + case WM_KEYDOWN: + return 0; // disable Spacebar + } + return CallWindowProc(IDC_RADIO_1P_oldWndProc, hWnd, msg, wParam, lParam); +} +LRESULT APIENTRY IDC_RADIO_2P_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) +{ + switch(msg) + { + case WM_MBUTTONDOWN: + case WM_MBUTTONDBLCLK: + playback.MiddleButtonClick(); + return 0; + case WM_KEYDOWN: + return 0; // disable Spacebar + } + return CallWindowProc(IDC_RADIO_2P_oldWndProc, hWnd, msg, wParam, lParam); +} +LRESULT APIENTRY IDC_RADIO_3P_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) +{ + switch(msg) + { + case WM_MBUTTONDOWN: + case WM_MBUTTONDBLCLK: + playback.MiddleButtonClick(); + return 0; + case WM_KEYDOWN: + return 0; // disable Spacebar + } + return CallWindowProc(IDC_RADIO_3P_oldWndProc, hWnd, msg, wParam, lParam); +} +LRESULT APIENTRY IDC_RADIO_4P_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) +{ + switch(msg) + { + case WM_MBUTTONDOWN: + case WM_MBUTTONDBLCLK: + playback.MiddleButtonClick(); + return 0; + case WM_KEYDOWN: + return 0; // disable Spacebar + } + return CallWindowProc(IDC_RADIO_4P_oldWndProc, hWnd, msg, wParam, lParam); +} +LRESULT APIENTRY IDC_SUPERIMPOSE_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) +{ + switch(msg) + { + case WM_MBUTTONDOWN: + case WM_MBUTTONDBLCLK: + playback.MiddleButtonClick(); + return 0; + case WM_KEYDOWN: + return 0; // disable Spacebar + } + return CallWindowProc(IDC_SUPERIMPOSE_oldWndProc, hWnd, msg, wParam, lParam); +} +LRESULT APIENTRY IDC_USEPATTERN_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) +{ + switch(msg) + { + case WM_MBUTTONDOWN: + case WM_MBUTTONDBLCLK: + playback.MiddleButtonClick(); + return 0; + case WM_KEYDOWN: + return 0; // disable Spacebar + } + return CallWindowProc(IDC_USEPATTERN_oldWndProc, hWnd, msg, wParam, lParam); +} +LRESULT APIENTRY TASEDITOR_PREV_MARKER_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) +{ + switch(msg) + { + case WM_MBUTTONDOWN: + case WM_MBUTTONDBLCLK: + playback.MiddleButtonClick(); + return 0; + case WM_KEYDOWN: + return 0; // disable Spacebar + } + return CallWindowProc(TASEDITOR_PREV_MARKER_oldWndProc, hWnd, msg, wParam, lParam); +} +LRESULT APIENTRY TASEDITOR_FIND_BEST_SIMILAR_MARKER_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) +{ + switch(msg) + { + case WM_MBUTTONDOWN: + case WM_MBUTTONDBLCLK: + playback.MiddleButtonClick(); + return 0; + case WM_KEYDOWN: + return 0; // disable Spacebar + } + return CallWindowProc(TASEDITOR_FIND_BEST_SIMILAR_MARKER_oldWndProc, hWnd, msg, wParam, lParam); +} +LRESULT APIENTRY TASEDITOR_FIND_NEXT_SIMILAR_MARKER_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) +{ + switch(msg) + { + case WM_MBUTTONDOWN: + case WM_MBUTTONDBLCLK: + playback.MiddleButtonClick(); + return 0; + case WM_KEYDOWN: + return 0; // disable Spacebar + } + return CallWindowProc(TASEDITOR_FIND_NEXT_SIMILAR_MARKER_oldWndProc, hWnd, msg, wParam, lParam); +} +LRESULT APIENTRY TASEDITOR_NEXT_MARKER_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) +{ + switch(msg) + { + case WM_MBUTTONDOWN: + case WM_MBUTTONDBLCLK: + playback.MiddleButtonClick(); + return 0; + case WM_KEYDOWN: + return 0; // disable Spacebar + } + return CallWindowProc(TASEDITOR_NEXT_MARKER_oldWndProc, hWnd, msg, wParam, lParam); +} +LRESULT APIENTRY CHECK_TURBO_SEEK_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) +{ + switch(msg) + { + case WM_MBUTTONDOWN: + case WM_MBUTTONDBLCLK: + playback.MiddleButtonClick(); + return 0; + case WM_KEYDOWN: + return 0; // disable Spacebar + } + return CallWindowProc(CHECK_TURBO_SEEK_oldWndProc, hWnd, msg, wParam, lParam); +} +LRESULT APIENTRY IDC_RECORDING_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) +{ + switch(msg) + { + case WM_MBUTTONDOWN: + case WM_MBUTTONDBLCLK: + playback.MiddleButtonClick(); + return 0; + case WM_KEYDOWN: + return 0; // disable Spacebar + } + return CallWindowProc(IDC_RECORDING_oldWndProc, hWnd, msg, wParam, lParam); +} +LRESULT APIENTRY TASEDITOR_RUN_MANUAL_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) +{ + switch(msg) + { + case WM_MBUTTONDOWN: + case WM_MBUTTONDBLCLK: + playback.MiddleButtonClick(); + return 0; + case WM_KEYDOWN: + return 0; // disable Spacebar + } + return CallWindowProc(TASEDITOR_RUN_MANUAL_oldWndProc, hWnd, msg, wParam, lParam); +} +LRESULT APIENTRY IDC_RUN_AUTO_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) +{ + switch(msg) + { + case WM_MBUTTONDOWN: + case WM_MBUTTONDBLCLK: + playback.MiddleButtonClick(); + return 0; + case WM_KEYDOWN: + return 0; // disable Spacebar + } + return CallWindowProc(IDC_RUN_AUTO_oldWndProc, hWnd, msg, wParam, lParam); +} diff --git a/src/drivers/win/taseditor/taseditor_window.h b/src/drivers/win/taseditor/taseditor_window.h index 6af11bbf..833e2b85 100644 --- a/src/drivers/win/taseditor/taseditor_window.h +++ b/src/drivers/win/taseditor/taseditor_window.h @@ -3,7 +3,7 @@ #define TASEDITOR_WINDOW_TOTAL_ITEMS 43 #define PIANOROLL_IN_WINDOWITEMS 2 -#define TOOLTIP_TEXT_MAX_LEN 82 +#define TOOLTIP_TEXT_MAX_LEN 100 #define TOOLTIPS_AUTOPOP_TIMEOUT 30000 #define PATTERNS_MENU_POS 5 @@ -60,6 +60,8 @@ public: int min_width; int min_height; + bool must_update_mouse_cursor; + private: void CalculateItems();