Implemented missing warning dialogs in Qt TAS project loader.

This commit is contained in:
mjbudd77 2021-12-31 05:59:51 -05:00
parent 31e6578877
commit c198739c30
10 changed files with 78 additions and 721 deletions

View File

@ -20,10 +20,6 @@ Bookmark - Single Bookmark data
#include "Qt/TasEditor/taseditor_project.h"
#include "Qt/TasEditor/TasEditorWindow.h"
//extern TASEDITOR_CONFIG taseditorConfig;
//extern GREENZONE greenzone;
//extern HISTORY history;
extern uint8 *XBuf;
extern uint8 *XBackBuf;

View File

@ -27,27 +27,9 @@ History - History of movie modifications
#include "Qt/TasEditor/taseditor_project.h"
#include "Qt/TasEditor/TasEditorWindow.h"
//LRESULT APIENTRY historyListWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
//WNDPROC hwndHistoryList_oldWndProc;
//extern TASEDITOR_CONFIG taseditorConfig;
//extern TASEDITOR_WINDOW taseditorWindow;
//extern MARKERS_MANAGER markersManager;
//extern BOOKMARKS bookmarks;
//extern BRANCHES branches;
//extern PLAYBACK playback;
//extern SELECTION selection;
//extern GREENZONE greenzone;
//extern TASEDITOR_PROJECT project;
//extern PIANO_ROLL pianoRoll;
//extern POPUP_DISPLAY popupDisplay;
//extern TASEDITOR_LUA taseditor_lua;
extern int joysticksPerFrame[INPUT_TYPES_TOTAL];
extern int getInputType(MovieData& md);
//extern WindowItemData windowItems[];
char historySaveID[HISTORY_ID_LEN] = "HISTORY";
char historySkipSaveID[HISTORY_ID_LEN] = "HISTORX";
char modCaptions[MODTYPES_TOTAL][20] = {" Initialization",
@ -1333,80 +1315,6 @@ int HISTORY::getUndoHint()
}
bool HISTORY::isCursorOverHistoryList()
{
// POINT p;
// if (GetCursorPos(&p))
// {
// ScreenToClient(hwndHistoryList, &p);
// RECT wrect;
// GetWindowRect(hwndHistoryList, &wrect);
// if (p.x >= 0
// && p.y >= 0
// && p.x < (wrect.right - wrect.left)
// && p.y < (wrect.bottom - wrect.top))
// return true;
// }
return false;
}
// ---------------------------------------------------------------------------------
//LRESULT APIENTRY historyListWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
//{
// extern HISTORY history;
// switch(msg)
// {
// case WM_CHAR:
// case WM_KEYDOWN:
// case WM_KEYUP:
// case WM_KILLFOCUS:
// return 0;
// case WM_LBUTTONDOWN:
// case WM_LBUTTONDBLCLK:
// {
// if (GetFocus() != hWnd)
// SetFocus(hWnd);
// // perform hit test
// LVHITTESTINFO info;
// info.pt.x = GET_X_LPARAM(lParam);
// info.pt.y = GET_Y_LPARAM(lParam);
// ListView_SubItemHitTest(hWnd, (LPARAM)&info);
// history.handleSingleClick(info.iItem);
// return 0;
// }
// case WM_MBUTTONDOWN:
// case WM_MBUTTONDBLCLK:
// {
// if (GetFocus() != hWnd)
// SetFocus(hWnd);
// playback->handleMiddleButtonClick();
// return 0;
// }
// case WM_RBUTTONDOWN:
// case WM_RBUTTONDBLCLK:
// if (GetFocus() != hWnd)
// SetFocus(hWnd);
// return 0;
// case WM_MOUSEWHEEL:
// {
// if (!history.isCursorOverHistoryList())
// {
// return SendMessage(pianoRoll.hwndList, msg, wParam, lParam);
// }
// break;
// }
// case WM_MOUSEWHEEL_RESENT:
// {
// // this is message from Piano Roll
// // it means that cursor is currently over History List, and user scrolls the wheel (although focus may be on some other window)
// // ensure that wParam's low-order word is 0 (so fwKeys = 0)
// CallWindowProc(hwndHistoryList_oldWndProc, hWnd, WM_MOUSEWHEEL, wParam & ~(LOWORD(-1)), lParam);
// return 0;
// }
// case WM_MOUSEACTIVATE:
// if (GetFocus() != hWnd)
// SetFocus(hWnd);
// break;
//
// }
// return CallWindowProc(hwndHistoryList_oldWndProc, hWnd, msg, wParam, lParam);
//}

View File

@ -15,7 +15,6 @@ LagLog - Log of Lag appearance
* provides interface for reading and writing log data
------------------------------------------------------------------------------------ */
//#include "taseditor_project.h"
#include <zlib.h>
#include "fceu.h"

View File

@ -24,20 +24,11 @@ Markers_manager - Manager of Markers
#include "fceu.h"
#include "Qt/TasEditor/taseditor_project.h"
#include "Qt/TasEditor/TasEditorWindow.h"
//#include <Shlwapi.h> // for StrStrI
//#pragma comment(lib, "Shlwapi.lib")
//extern TASEDITOR_CONFIG taseditorConfig;
//extern TASEDITOR_WINDOW taseditorWindow;
//extern PLAYBACK playback;
//extern SELECTION selection;
//extern HISTORY history;
// resources
char markers_save_id[MARKERS_ID_LEN] = "MARKERS";
char markers_skipsave_id[MARKERS_ID_LEN] = "MARKERX";
char keywordDelimiters[] = " !\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~";
static char markers_save_id[MARKERS_ID_LEN] = "MARKERS";
static char markers_skipsave_id[MARKERS_ID_LEN] = "MARKERX";
//static char keywordDelimiters[] = " !\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~";
MARKERS_MANAGER::MARKERS_MANAGER()
{
@ -376,210 +367,7 @@ void MARKERS_MANAGER::findSimilarNote()
}
void MARKERS_MANAGER::findNextSimilarNote()
{
// int i, t;
// int sourceMarker = playback.displayedMarkerNumber;
// char sourceNote[MAX_NOTE_LEN];
// strcpy(sourceNote, getNoteCopy(sourceMarker).c_str());
//
// // check if playback_marker_text is empty
// if (!sourceNote[0])
// {
// MessageBox(taseditorWindow.hwndTASEditor, "Marker Note under Playback cursor is empty!", "Find Similar Note", MB_OK);
// return;
// }
// // check if there's at least one note (not counting zeroth note)
// if (markers.notes.size() <= 0)
// {
// MessageBox(taseditorWindow.hwndTASEditor, "This project doesn't have any Markers!", "Find Similar Note", MB_OK);
// return;
// }
//
// // 0 - divide source string into keywords
// int totalSourceKeywords = 0;
// char sourceKeywords[MAX_NUM_KEYWORDS][MAX_NOTE_LEN] = {0};
// int current_line_pos = 0;
// char sourceKeywordsLine[MAX_NUM_KEYWORDS] = {0};
// char* pch;
// // divide into tokens
// pch = strtok(sourceNote, keywordDelimiters);
// while (pch != NULL)
// {
// if (strlen(pch) >= KEYWORD_MIN_LEN)
// {
// // check if same keyword already appeared in the string
// for (t = totalSourceKeywords - 1; t >= 0; t--)
// if (!_stricmp(sourceKeywords[t], pch)) break;
// if (t < 0)
// {
// // save new keyword
// strcpy(sourceKeywords[totalSourceKeywords], pch);
// // also set its id into the line
// sourceKeywordsLine[current_line_pos++] = totalSourceKeywords + 1;
// totalSourceKeywords++;
// } else
// {
// // same keyword found
// sourceKeywordsLine[current_line_pos++] = t + 1;
// }
// }
// pch = strtok(NULL, keywordDelimiters);
// }
// // we found the line (sequence) of keywords
// sourceKeywordsLine[current_line_pos] = 0;
//
// if (!totalSourceKeywords)
// {
// MessageBox(taseditorWindow.hwndTASEditor, "Marker Note under Playback cursor doesn't have keywords!", "Find Similar Note", MB_OK);
// return;
// }
//
// // 1 - find how frequently each keyword appears in notes
// std::vector<int> keywordFound(totalSourceKeywords);
// char checkedNote[MAX_NOTE_LEN];
// for (i = markers.notes.size() - 1; i > 0; i--)
// {
// if (i != sourceMarker)
// {
// strcpy(checkedNote, markers.notes[i].c_str());
// for (t = totalSourceKeywords - 1; t >= 0; t--)
// if (StrStrI(checkedNote, sourceKeywords[t]))
// keywordFound[t]++;
// }
// }
// // findmax
// int maxFound = 0;
// for (t = totalSourceKeywords - 1; t >= 0; t--)
// if (maxFound < keywordFound[t])
// maxFound = keywordFound[t];
// // and then calculate weight of each keyword: the more often it appears in Markers, the less weight it has
// std::vector<double> keywordWeight(totalSourceKeywords);
// for (t = totalSourceKeywords - 1; t >= 0; t--)
// keywordWeight[t] = KEYWORD_WEIGHT_BASE + KEYWORD_WEIGHT_FACTOR * (keywordFound[t] / (double)maxFound);
//
// // start accumulating priorities
// std::vector<std::pair<int, double>> notePriority(markers.notes.size());
//
// // 2 - find keywords in notes (including cases when keyword appears inside another word)
// for (i = notePriority.size() - 1; i > 0; i--)
// {
// notePriority[i].first = i;
// if (i != sourceMarker)
// {
// strcpy(checkedNote, markers.notes[i].c_str());
// for (t = totalSourceKeywords - 1; t >= 0; t--)
// {
// if (StrStrI(checkedNote, sourceKeywords[t]))
// notePriority[i].second += KEYWORD_CASEINSENTITIVE_BONUS_PER_CHAR * keywordWeight[t] * strlen(sourceKeywords[t]);
// if (strstr(checkedNote, sourceKeywords[t]))
// notePriority[i].second += KEYWORD_CASESENTITIVE_BONUS_PER_CHAR * keywordWeight[t] * strlen(sourceKeywords[t]);
// }
// }
// }
//
// // 3 - search sequences of keywords from all other notes
// current_line_pos = 0;
// char checkedKeywordsLine[MAX_NUM_KEYWORDS] = {0};
// int keyword_id;
// for (i = markers.notes.size() - 1; i > 0; i--)
// {
// if (i != sourceMarker)
// {
// strcpy(checkedNote, markers.notes[i].c_str());
// // divide into tokens
// pch = strtok(checkedNote, keywordDelimiters);
// while (pch != NULL)
// {
// if (strlen(pch) >= KEYWORD_MIN_LEN)
// {
// // check if the keyword is one of sourceKeywords
// for (t = totalSourceKeywords - 1; t >= 0; t--)
// if (!_stricmp(sourceKeywords[t], pch)) break;
// if (t >= 0)
// {
// // the keyword is one of sourceKeywords - set its id into the line
// checkedKeywordsLine[current_line_pos++] = t + 1;
// } else
// {
// // found keyword that doesn't appear in sourceNote, give penalty
// notePriority[i].second -= KEYWORD_PENALTY_FOR_STRANGERS * strlen(pch);
// // since the keyword breaks our sequence of coincident keywords, check if that sequence is similar to sourceKeywordsLine
// if (current_line_pos >= KEYWORDS_LINE_MIN_SEQUENCE)
// {
// checkedKeywordsLine[current_line_pos] = 0;
// // search checkedKeywordsLine in sourceKeywordsLine
// if (strstr(sourceKeywordsLine, checkedKeywordsLine))
// {
// // found same sequence of keywords! add priority to this checkedNote
// for (t = current_line_pos - 1; t >= 0; t--)
// {
// // add bonus for every keyword in the sequence
// keyword_id = checkedKeywordsLine[t] - 1;
// notePriority[i].second += current_line_pos * KEYWORD_SEQUENCE_BONUS_PER_CHAR * keywordWeight[keyword_id] * strlen(sourceKeywords[keyword_id]);
// }
// }
// }
// // clear checkedKeywordsLine
// memset(checkedKeywordsLine, 0, MAX_NUM_KEYWORDS);
// current_line_pos = 0;
// }
// }
// pch = strtok(NULL, keywordDelimiters);
// }
// // finished dividing into tokens
// if (current_line_pos >= KEYWORDS_LINE_MIN_SEQUENCE)
// {
// checkedKeywordsLine[current_line_pos] = 0;
// // search checkedKeywordsLine in sourceKeywordsLine
// if (strstr(sourceKeywordsLine, checkedKeywordsLine))
// {
// // found same sequence of keywords! add priority to this checkedNote
// for (t = current_line_pos - 1; t >= 0; t--)
// {
// // add bonus for every keyword in the sequence
// keyword_id = checkedKeywordsLine[t] - 1;
// notePriority[i].second += current_line_pos * KEYWORD_SEQUENCE_BONUS_PER_CHAR * keywordWeight[keyword_id] * strlen(sourceKeywords[keyword_id]);
// }
// }
// }
// // clear checkedKeywordsLine
// memset(checkedKeywordsLine, 0, MAX_NUM_KEYWORDS);
// current_line_pos = 0;
// }
// }
//
// // 4 - sort notePriority by second member of the pair
// std::sort(notePriority.begin(), notePriority.end(), ordering);
//
// /*
// // debug trace
// FCEU_printf("\n\n\n\n\n\n\n\n\n\n");
// for (t = totalSourceKeywords - 1; t >= 0; t--)
// FCEU_printf("Keyword: %s, %d, %f\n", sourceKeywords[t], keywordFound[t], keywordWeight[t]);
// for (i = notePriority.size() - 1; i > 0; i--)
// {
// int marker_id = notePriority[i].first;
// FCEU_printf("Result: %s, %d, %f\n", notes[marker_id].c_str(), marker_id, notePriority[i].second);
// }
// */
//
// // Send Selection to the Marker found
// int index = notePriority.size()-1 - currentIterationOfFindSimilar;
// if (index >= 0 && notePriority[index].second >= MIN_PRIORITY_TRESHOLD)
// {
// int marker_id = notePriority[index].first;
// int frame = getMarkerFrameNumber(marker_id);
// if (frame >= 0)
// selection.jumpToFrame(frame);
// } else
// {
// if (currentIterationOfFindSimilar)
// MessageBox(taseditorWindow.hwndTASEditor, "Could not find more Notes similar to Marker Note under Playback cursor!", "Find Similar Note", MB_OK);
// else
// MessageBox(taseditorWindow.hwndTASEditor, "Could not find anything similar to Marker Note under Playback cursor!", "Find Similar Note", MB_OK);
// }
//
// // increase currentIterationOfFindSimilar so that next time we'll find another note
// currentIterationOfFindSimilar++;
// This is implemented in TasEditorWindow.cpp
}
// ------------------------------------------------------------------------------------
void MARKERS_MANAGER::updateEditedMarkerNote()
@ -645,134 +433,3 @@ void MARKERS_MANAGER::updateEditedMarkerNote()
}
}
// ------------------------------------------------------------------------------------
//INT_PTR CALLBACK findNoteWndProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM lParam)
//{
// extern MARKERS_MANAGER markersManager;
// switch (message)
// {
// case WM_INITDIALOG:
// {
// if (taseditorConfig.findnoteWindowX == -32000) taseditorConfig.findnoteWindowX = 0; //Just in case
// if (taseditorConfig.findnoteWindowY == -32000) taseditorConfig.findnoteWindowY = 0;
// SetWindowPos(hwndDlg, 0, taseditorConfig.findnoteWindowX, taseditorConfig.findnoteWindowY, 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOOWNERZORDER);
//
// CheckDlgButton(hwndDlg, IDC_MATCH_CASE, taseditorConfig.findnoteMatchCase ? BST_CHECKED : BST_UNCHECKED);
// if (taseditorConfig.findnoteSearchUp)
// Button_SetCheck(GetDlgItem(hwndDlg, IDC_RADIO_UP), BST_CHECKED);
// else
// Button_SetCheck(GetDlgItem(hwndDlg, IDC_RADIO_DOWN), BST_CHECKED);
// HWND hwndEdit = GetDlgItem(hwndDlg, IDC_NOTE_TO_FIND);
// SendMessage(hwndEdit, EM_SETLIMITTEXT, MAX_NOTE_LEN - 1, 0);
// SetWindowText(hwndEdit, markersManager.findNoteString);
// if (GetDlgCtrlID((HWND)wParam) != IDC_NOTE_TO_FIND)
// {
// SetFocus(hwndEdit);
// return false;
// }
// return true;
// }
// case WM_MOVE:
// {
// if (!IsIconic(hwndDlg))
// {
// RECT wrect;
// GetWindowRect(hwndDlg, &wrect);
// taseditorConfig.findnoteWindowX = wrect.left;
// taseditorConfig.findnoteWindowY = wrect.top;
// WindowBoundsCheckNoResize(taseditorConfig.findnoteWindowX, taseditorConfig.findnoteWindowY, wrect.right);
// }
// break;
// }
// case WM_COMMAND:
// {
// switch (LOWORD(wParam))
// {
// case IDC_NOTE_TO_FIND:
// {
// if (HIWORD(wParam) == EN_CHANGE)
// {
// if (GetWindowTextLength(GetDlgItem(hwndDlg, IDC_NOTE_TO_FIND)))
// EnableWindow(GetDlgItem(hwndDlg, IDOK), true);
// else
// EnableWindow(GetDlgItem(hwndDlg, IDOK), false);
// }
// break;
// }
// case IDC_RADIO_UP:
// taseditorConfig.findnoteSearchUp = true;
// break;
// case IDC_RADIO_DOWN:
// taseditorConfig.findnoteSearchUp = false;
// break;
// case IDC_MATCH_CASE:
// taseditorConfig.findnoteMatchCase ^= 1;
// CheckDlgButton(hwndDlg, IDC_MATCH_CASE, taseditorConfig.findnoteMatchCase? BST_CHECKED : BST_UNCHECKED);
// break;
// case IDOK:
// {
// int len = SendMessage(GetDlgItem(hwndDlg, IDC_NOTE_TO_FIND), WM_GETTEXT, MAX_NOTE_LEN, (LPARAM)markersManager.findNoteString);
// markersManager.findNoteString[len] = 0;
// // scan frames from current Selection to the border
// int cur_marker = 0;
// bool result;
// int movie_size = currMovieData.getNumRecords();
// int current_frame = selection.getCurrentRowsSelectionBeginning();
// if (current_frame < 0 && taseditorConfig.findnoteSearchUp)
// current_frame = movie_size;
// while (true)
// {
// // move forward
// if (taseditorConfig.findnoteSearchUp)
// {
// current_frame--;
// if (current_frame < 0)
// {
// MessageBox(taseditorWindow.hwndFindNote, "Nothing was found.", "Find Note", MB_OK);
// break;
// }
// } else
// {
// current_frame++;
// if (current_frame >= movie_size)
// {
// MessageBox(taseditorWindow.hwndFindNote, "Nothing was found!", "Find Note", MB_OK);
// break;
// }
// }
// // scan marked frames
// cur_marker = markersManager.getMarkerAtFrame(current_frame);
// if (cur_marker)
// {
// if (taseditorConfig.findnoteMatchCase)
// result = (strstr(markersManager.getNoteCopy(cur_marker).c_str(), markersManager.findNoteString) != 0);
// else
// result = (StrStrI(markersManager.getNoteCopy(cur_marker).c_str(), markersManager.findNoteString) != 0);
// if (result)
// {
// // found note containing searched string - jump there
// selection.jumpToFrame(current_frame);
// break;
// }
// }
// }
// return TRUE;
// }
// case IDCANCEL:
// DestroyWindow(taseditorWindow.hwndFindNote);
// taseditorWindow.hwndFindNote = 0;
// return TRUE;
// }
// break;
// }
// case WM_CLOSE:
// case WM_QUIT:
// {
// DestroyWindow(taseditorWindow.hwndFindNote);
// taseditorWindow.hwndFindNote = 0;
// break;
// }
// }
// return FALSE;
//}

View File

@ -34,21 +34,8 @@ extern void ForceExecuteLuaFrameFunctions();
extern bool mustRewindNow;
extern bool turbo;
//extern TASEDITOR_CONFIG taseditorConfig;
//extern TASEDITOR_WINDOW taseditorWindow;
//extern SELECTION selection;
//extern MARKERS_MANAGER markersManager;
//extern GREENZONE greenzone;
//extern PIANO_ROLL pianoRoll;
//extern BOOKMARKS bookmarks;
//extern void Update_RAM_Search();
//LRESULT APIENTRY UpperMarkerEditWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
//WNDPROC playbackMarkerEdit_oldWndproc;
// resources
char upperMarkerText[] = "Marker ";
static char upperMarkerText[] = "Marker ";
PLAYBACK::PLAYBACK()
{
@ -56,20 +43,6 @@ PLAYBACK::PLAYBACK()
void PLAYBACK::init()
{
//hwndProgressbar = GetDlgItem(taseditorWindow.hwndTASEditor, IDC_PROGRESS1);
//SendMessage(hwndProgressbar, PBM_SETRANGE, 0, MAKELPARAM(0, PROGRESSBAR_WIDTH));
//hwndRewind = GetDlgItem(taseditorWindow.hwndTASEditor, TASEDITOR_REWIND);
//hwndForward = GetDlgItem(taseditorWindow.hwndTASEditor, TASEDITOR_FORWARD);
//hwndRewindFull = GetDlgItem(taseditorWindow.hwndTASEditor, TASEDITOR_REWIND_FULL);
//hwndForwardFull = GetDlgItem(taseditorWindow.hwndTASEditor, TASEDITOR_FORWARD_FULL);
//hwndPlaybackMarkerNumber = GetDlgItem(taseditorWindow.hwndTASEditor, IDC_PLAYBACK_MARKER);
//SendMessage(hwndPlaybackMarkerNumber, WM_SETFONT, (WPARAM)pianoRoll.hMarkersFont, 0);
//hwndPlaybackMarkerEditField = GetDlgItem(taseditorWindow.hwndTASEditor, IDC_PLAYBACK_MARKER_EDIT);
//SendMessage(hwndPlaybackMarkerEditField, EM_SETLIMITTEXT, MAX_NOTE_LEN - 1, 0);
//SendMessage(hwndPlaybackMarkerEditField, WM_SETFONT, (WPARAM)pianoRoll.hMarkersEditFont, 0);
// subclass the edit control
//playbackMarkerEdit_oldWndproc = (WNDPROC)SetWindowLongPtr(hwndPlaybackMarkerEditField, GWLP_WNDPROC, (LONG_PTR)UpperMarkerEditWndProc);
reset();
}
void PLAYBACK::reset()
@ -593,6 +566,7 @@ int PLAYBACK::getFlashingPauseFrame()
void PLAYBACK::setProgressbar(int a, int b)
{
// TODO
//SendMessage(hwndProgressbar, PBM_SETPOS, PROGRESSBAR_WIDTH * a / b, 0);
}
void PLAYBACK::cancelSeeking()
@ -600,84 +574,6 @@ void PLAYBACK::cancelSeeking()
if (pauseFrame)
stopSeeking();
}
// -------------------------------------------------------------------------
//LRESULT APIENTRY UpperMarkerEditWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
//{
// extern PLAYBACK playback;
// extern SELECTION selection;
// switch(msg)
// {
// case WM_SETFOCUS:
// {
// markersManager.markerNoteEditMode = MARKER_NOTE_EDIT_UPPER;
// // enable editing
// SendMessage(playback.hwndPlaybackMarkerEditField, EM_SETREADONLY, false, 0);
// // disable FCEUX keyboard
// disableGeneralKeyboardInput();
// break;
// }
// case WM_KILLFOCUS:
// {
// // if we were editing, save and finish editing
// if (markersManager.markerNoteEditMode == MARKER_NOTE_EDIT_UPPER)
// {
// markersManager.updateEditedMarkerNote();
// markersManager.markerNoteEditMode = MARKER_NOTE_EDIT_NONE;
// }
// // disable editing (make the bg grayed)
// SendMessage(playback.hwndPlaybackMarkerEditField, EM_SETREADONLY, true, 0);
// // enable FCEUX keyboard
// if (taseditorWindow.TASEditorIsInFocus)
// enableGeneralKeyboardInput();
// break;
// }
// case WM_CHAR:
// case WM_KEYDOWN:
// {
// if (markersManager.markerNoteEditMode == MARKER_NOTE_EDIT_UPPER)
// {
// switch(wParam)
// {
// case VK_ESCAPE:
// // revert text to original note text
// SetWindowText(playback.hwndPlaybackMarkerEditField, markersManager.getNoteCopy(playback.displayedMarkerNumber).c_str());
// SetFocus(pianoRoll.hwndList);
// return 0;
// case VK_RETURN:
// // exit and save text changes
// SetFocus(pianoRoll.hwndList);
// return 0;
// case VK_TAB:
// {
// // switch to lower edit control (also exit and save text changes)
// SetFocus(selection.hwndSelectionMarkerEditField);
// // scroll to the Marker
// if (taseditorConfig.followMarkerNoteContext)
// pianoRoll.followMarker(selection.displayedMarkerNumber);
// return 0;
// }
// }
// }
// break;
// }
// case WM_MBUTTONDOWN:
// case WM_MBUTTONDBLCLK:
// {
// playback.handleMiddleButtonClick();
// return 0;
// }
// case WM_LBUTTONDOWN:
// case WM_RBUTTONDOWN:
// {
// // scroll to the Marker
// if (taseditorConfig.followMarkerNoteContext)
// pianoRoll.followMarker(playback.displayedMarkerNumber);
// break;
// }
// }
// return CallWindowProc(playbackMarkerEdit_oldWndproc, hWnd, msg, wParam, lParam);
//}
// -------------------------------------------------------------------------
UpperMarkerNoteEdit::UpperMarkerNoteEdit( QWidget *parent )
: QLineEdit(parent)

View File

@ -25,28 +25,20 @@ extern uint32 GetGamepadPressedImmediate();
extern char lagFlag;
//extern TASEDITOR_CONFIG taseditorConfig;
//extern TASEDITOR_WINDOW taseditorWindow;
//extern BOOKMARKS bookmarks;
//extern HISTORY history;
//extern GREENZONE greenzone;
//extern PIANO_ROLL pianoRoll;
//extern EDITOR editor;
// resources
const char recordingCheckbox[11] = " Recording";
const char recordingCheckboxBlankPattern[17] = " Recording blank";
static const char recordingCheckbox[11] = " Recording";
static const char recordingCheckboxBlankPattern[17] = " Recording blank";
const char recordingModes[5][4] = { "All",
"1P",
"2P",
"3P",
"4P"};
const char recordingCaptions[5][17] = { " (Recording All)",
" (Recording 1P)",
" (Recording 2P)",
" (Recording 3P)",
" (Recording 4P)"};
static const char recordingModes[5][4] = { "All",
"1P",
"2P",
"3P",
"4P"};
static const char recordingCaptions[5][17] = { " (Recording All)",
" (Recording 1P)",
" (Recording 2P)",
" (Recording 3P)",
" (Recording 4P)"};
RECORDER::RECORDER()
{
}

View File

@ -846,83 +846,6 @@ RowsSelection& SELECTION::getCurrentRowsSelection()
{
return rowsSelectionHistory[(historyStartPos + historyCursorPos) % historySize];
}
// -------------------------------------------------------------------------
//LRESULT APIENTRY LowerMarkerEditWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
//{
// extern PLAYBACK playback;
// extern SELECTION selection;
// switch(msg)
// {
// case WM_SETFOCUS:
// {
// markersManager.markerNoteEditMode = MARKER_NOTE_EDIT_LOWER;
// // enable editing
// SendMessage(selection.hwndSelectionMarkerEditField, EM_SETREADONLY, false, 0);
// // disable FCEUX keyboard
// disableGeneralKeyboardInput();
// break;
// }
// case WM_KILLFOCUS:
// {
// if (markersManager.markerNoteEditMode == MARKER_NOTE_EDIT_LOWER)
// {
// markersManager.updateEditedMarkerNote();
// markersManager.markerNoteEditMode = MARKER_NOTE_EDIT_NONE;
// }
// // disable editing (make the bg grayed)
// SendMessage(selection.hwndSelectionMarkerEditField, EM_SETREADONLY, true, 0);
// // enable FCEUX keyboard
// if (taseditorWindow.TASEditorIsInFocus)
// enableGeneralKeyboardInput();
// break;
// }
// case WM_CHAR:
// case WM_KEYDOWN:
// {
// if (markersManager.markerNoteEditMode == MARKER_NOTE_EDIT_LOWER)
// {
// switch(wParam)
// {
// case VK_ESCAPE:
// // revert text to original note text
// //SetWindowText(selection.hwndSelectionMarkerEditField, markersManager.getNoteCopy(selection.displayedMarkerNumber).c_str());
// //SetFocus(pianoRoll.hwndList);
// return 0;
// case VK_RETURN:
// // exit and save text changes
// //SetFocus(pianoRoll.hwndList);
// return 0;
// case VK_TAB:
// {
// // switch to upper edit control (also exit and save text changes)
// //SetFocus(playback.hwndPlaybackMarkerEditField);
// // scroll to the Marker
// //if (taseditorConfig.followMarkerNoteContext)
// // pianoRoll.followMarker(playback.displayedMarkerNumber);
// return 0;
// }
// }
// }
// break;
// }
// case WM_MBUTTONDOWN:
// case WM_MBUTTONDBLCLK:
// {
// playback.handleMiddleButtonClick();
// return 0;
// }
// case WM_LBUTTONDOWN:
// case WM_RBUTTONDOWN:
// {
// // scroll to the Marker
// if (taseditorConfig.followMarkerNoteContext)
// pianoRoll.followMarker(selection.displayedMarkerNumber);
// break;
// }
// }
// return CallWindowProc(selectionMarkerEdit_oldWndproc, hWnd, msg, wParam, lParam);
//}
// -------------------------------------------------------------------------
LowerMarkerNoteEdit::LowerMarkerNoteEdit( QWidget *parent )
: QLineEdit(parent)

View File

@ -23,15 +23,6 @@ Splicer - Tool for montage
#include "Qt/TasEditor/taseditor_project.h"
#include "Qt/TasEditor/TasEditorWindow.h"
//extern TASEDITOR_WINDOW taseditorWindow;
//extern TASEDITOR_CONFIG taseditorConfig;
//extern HISTORY history;
//extern MARKERS_MANAGER markersManager;
//extern PLAYBACK playback;
//extern GREENZONE greenzone;
//extern PIANO_ROLL pianoRoll;
//extern SELECTION selection;
extern int joysticksPerFrame[INPUT_TYPES_TOTAL];
//extern int getInputType(MovieData& md);

View File

@ -19,21 +19,9 @@ Lua - Manager of Lua features
#include "Qt/TasEditor/taseditor_project.h"
#include "Qt/TasEditor/TasEditorWindow.h"
//extern TASEDITOR_CONFIG taseditorConfig;
//extern TASEDITOR_WINDOW taseditorWindow;
//extern HISTORY history;
//extern MARKERS_MANAGER markersManager;
//extern BOOKMARKS bookmarks;
//extern BRANCHES branches;
//extern RECORDER recorder;
//extern PLAYBACK playback;
//extern GREENZONE greenzone;
//extern PIANO_ROLL pianoRoll;
//extern SELECTION selection;
extern void TaseditorDisableManualFunctionIfNeeded();
const char defaultRunFunctionCaption[] = "Run function";
//const char defaultRunFunctionCaption[] = "Run function";
TASEDITOR_LUA::TASEDITOR_LUA()
{
@ -42,7 +30,6 @@ TASEDITOR_LUA::TASEDITOR_LUA()
void TASEDITOR_LUA::init()
{
pending_changes.resize(0);
//hwndRunFunctionButton = GetDlgItem(taseditorWindow.hwndTASEditor, TASEDITOR_RUN_MANUAL);
reset();
}
void TASEDITOR_LUA::reset()

View File

@ -16,6 +16,8 @@ Project - Manager of working project
* stores resources: autosave period scale, default filename, fm3 format offsets
------------------------------------------------------------------------------------ */
#include <QMessageBox>
#include "fceu.h"
#include "movie.h"
#include "driver.h"
@ -24,19 +26,6 @@ Project - Manager of working project
#include "Qt/TasEditor/taseditor_project.h"
#include "Qt/TasEditor/TasEditorWindow.h"
//extern TASEDITOR_CONFIG taseditorConfig;
//extern TASEDITOR_WINDOW taseditorWindow;
//extern MARKERS_MANAGER markersManager;
//extern BOOKMARKS bookmarks;
//extern POPUP_DISPLAY popupDisplay;
//extern GREENZONE greenzone;
//extern PLAYBACK playback;
//extern RECORDER recorder;
//extern HISTORY history;
//extern PIANO_ROLL pianoRoll;
//extern SELECTION selection;
//extern SPLICER splicer;
extern FCEUGI *GameInfo;
extern void FCEU_PrintError(const char *format, ...);
@ -226,21 +215,26 @@ bool TASEDITOR_PROJECT::load(const char* fullName)
for(k = 0; k < strlen(md5OfCurrent); k++) count2 += md5OfCurrent[k] - '0';
if (count1 && count2)
{
int ret;
// ask user if he really wants to load the project
char message[2048] = {0};
strcpy(message, "This project was made using different ROM!\n\n");
strcat(message, "Original ROM:\n");
strncat(message, tempMovieData.romFilename.c_str(), 2047 - strlen(message));
strncat(message, "\nMD5: ", 2047 - strlen(message));
strncat(message, md5OfOriginal, 2047 - strlen(message));
strncat(message, "\n\nCurrent ROM:\n", 2047 - strlen(message));
strncat(message, GameInfo->filename, 2047 - strlen(message));
strncat(message, "\nMD5: ", 2047 - strlen(message));
strncat(message, md5OfCurrent, 2047 - strlen(message));
strncat(message, "\n\nLoad the project anyway?", 2047 - strlen(message));
//int answer = MessageBox(taseditorWindow.hwndTASEditor, message, "ROM Checksum Mismatch", MB_YESNO);
//if (answer == IDNO)
// return false;
std::string message;
message.assign("This project was made using different ROM!\n\n");
message.append("Original ROM:\n");
message.append(tempMovieData.romFilename.c_str());
message.append("\nMD5: ");
message.append(md5OfOriginal);
message.append("\n\nCurrent ROM:\n");
message.append(GameInfo->filename);
message.append("\nMD5: ");
message.append(md5OfCurrent);
message.append("\n\nLoad the project anyway?");
ret = QMessageBox::warning( tasWin, QObject::tr("ROM Checksum Mismatch"), QObject::tr(message.c_str()), QMessageBox::Yes | QMessageBox::No, QMessageBox::No );
if ( QMessageBox::No == ret )
{
return false;
}
}
}
taseditorDataOffset = ifs.ftell();
@ -250,33 +244,46 @@ bool TASEDITOR_PROJECT::load(const char* fullName)
{
if (projectFileVersion != PROJECT_FILE_CURRENT_VERSION)
{
char message[2048] = {0};
strcpy(message, "This project was saved using different version of TAS Editor!\n\n");
strcat(message, "Original version: ");
int ret;
std::string message;
message.assign("This project was saved using different version of TAS Editor!\n\n");
message.append("Original version: ");
char versionNum[16];
sprintf( versionNum, "%u", projectFileVersion);
strncat(message, versionNum, 2047 - strlen(message));
strncat(message, "\nCurrent version: ", 2047 - strlen(message));
message.append(versionNum);
message.append("\nCurrent version: ");
sprintf( versionNum, "%i", PROJECT_FILE_CURRENT_VERSION);
strncat(message, versionNum, 2047 - strlen(message));
strncat(message, "\n\nClick Yes to try loading all data from the file (may crash).\n", 2047 - strlen(message));
strncat(message, "Click No to only load movie data.\n", 2047 - strlen(message));
strncat(message, "Click Cancel to abort loading.", 2047 - strlen(message));
//int answer = MessageBox(taseditorWindow.hwndTASEditor, message, "FM3 Version Mismatch", MB_YESNOCANCEL);
//if (answer == IDCANCEL)
// return false;
//else if (answer == IDNO)
// loadAll = false;
message.append(versionNum);
message.append("\n\nClick Yes to try loading all data from the file (may crash).\n");
message.append("Click No to only load movie data.\n");
message.append("Click Cancel to abort loading.");
ret = QMessageBox::warning( tasWin, QObject::tr("FM3 Version Mismatch"), QObject::tr(message.c_str()), QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel, QMessageBox::No );
if ( QMessageBox::Cancel == ret )
{
return false;
}
else if ( QMessageBox::No == ret )
{
loadAll = false;
}
}
} else
}
else
{
int ret;
// couldn't even load header, this seems like an FM2
loadAll = false;
char message[2048];
strcpy(message, "This file doesn't seem to be an FM3 project.\nIt only contains FM2 movie data. Load it anyway?");
//int answer = MessageBox(taseditorWindow.hwndTASEditor, message, "Opening FM2 file", MB_YESNO);
//if (answer == IDNO)
// return false;
std::string message;
message.assign("This file doesn't seem to be an FM3 project.\nIt only contains FM2 movie data. Load it anyway?");
ret = QMessageBox::warning( tasWin, QObject::tr("Opening FM2 file"), QObject::tr(message.c_str()), QMessageBox::Yes | QMessageBox::No, QMessageBox::No );
if ( QMessageBox::No == ret )
{
return false;
}
}
// save data to currMovieData and continue loading
FCEU_printf("\nLoading TAS Editor project %s...\n", fullName);
@ -284,7 +291,8 @@ bool TASEDITOR_PROJECT::load(const char* fullName)
LoadSubtitles(currMovieData);
// ensure that movie has correct set of ports/fourscore
setInputType(currMovieData, getInputType(currMovieData));
} else
}
else
{
FCEU_PrintError("Error loading movie data from %s!", fullName);
// do not alter the project
@ -335,21 +343,21 @@ bool TASEDITOR_PROJECT::load(const char* fullName)
else
dataOffset = 0;
selection->load(&ifs, dataOffset);
} else
}
else
{
// reset modules
markersManager->load(&ifs, 0);
bookmarks->load(&ifs, 0);
greenzone->load(&ifs, 0);
history->load(&ifs, 0);
//pianoRoll.load(&ifs, 0);
tasWin->pianoRoll->load(&ifs, 0);
selection->load(&ifs, 0);
}
// reset other modules
playback->reset();
recorder->reset();
splicer->reset();
//popupDisplay.reset();
reset();
renameProject(fullName, loadAll);
// restore mouse cursor shape