Win32 - Add movie filename at the top of the main window, did this by creating a SetMainWindowText() function that sets it based on various conditions, this allowed some nice code cleanup on the various places that set the window text. Also removed an unused and useless prototype from movie.h

This commit is contained in:
adelikat 2010-08-21 03:59:17 +00:00
parent 27134c26bc
commit 1cd34b57ea
7 changed files with 57 additions and 10 deletions

View File

@ -1,3 +1,4 @@
20-aug-2010 - adelikat - Win32 - Display movie name at the top of the main window
09-july-2010 - mart0258 - TasEdit - cleanup; prevent crash when truncating while turbo 09-july-2010 - mart0258 - TasEdit - cleanup; prevent crash when truncating while turbo
13-june-2010 - adelikat - Win32 - avi capture commandline argument and related parameters 13-june-2010 - adelikat - Win32 - avi capture commandline argument and related parameters
12-june-2010 - adelikat - Save Turbo frame skip amount to config so that it can be customized by user 12-june-2010 - adelikat - Save Turbo frame skip amount to config so that it can be customized by user

View File

@ -175,6 +175,27 @@ string moviehelp = "{695C964E-B83F-4A6E-9BA2-1A975387DB55}"; //Movie Recording
string gettingstartedhelp = "{C76AEBD9-1E27-4045-8A37-69E5A52D0F9A}";//Getting Started string gettingstartedhelp = "{C76AEBD9-1E27-4045-8A37-69E5A52D0F9A}";//Getting Started
//******************************************************************************** //********************************************************************************
void SetMainWindowText()
{
if (GameInfo)
{
//Add the filename to the window caption
extern char FileBase[];
string str = FCEU_NAME_AND_VERSION;
str.append(": ");
str.append(FileBase);
if (FCEUMOV_IsLoaded())
{
str.append(" Playing: ");
str.append(StripPath(FCEUI_GetMovieName()));
}
SetWindowText(hAppWnd, str.c_str());
}
else
SetWindowText(hAppWnd, FCEU_NAME_AND_VERSION);
}
bool HasRecentFiles() bool HasRecentFiles()
{ {
@ -1022,7 +1043,7 @@ void CloseGame()
KillMemView(); KillMemView();
updateGameDependentMenus(GameInfo != 0); updateGameDependentMenus(GameInfo != 0);
updateGameDependentMenusDebugger(GameInfo != 0); updateGameDependentMenusDebugger(GameInfo != 0);
SetWindowText(hAppWnd, FCEU_NAME_AND_VERSION); SetMainWindowText();
} }
} }
@ -1058,13 +1079,7 @@ bool ALoad(char *nameo, char* innerFilename)
SetFSVideoMode(); SetFSVideoMode();
} }
//Add the filename to the window caption
extern char FileBase[];
string str = FCEU_NAME_AND_VERSION;
str.append(": ");
str.append(FileBase);
SetWindowText(hAppWnd, str.c_str());
if (AutoRWLoad) if (AutoRWLoad)
{ {
OpenRWRecentFile(0); //adelikat: TODO: This command should be called internally from the RamWatch dialog in order for it to be more portable OpenRWRecentFile(0); //adelikat: TODO: This command should be called internally from the RamWatch dialog in order for it to be more portable
@ -1080,7 +1095,8 @@ bool ALoad(char *nameo, char* innerFilename)
SetWindowText(hAppWnd, FCEU_NAME_AND_VERSION); //adelikat: If game fails to load while a previous one was open, the previous would have been closed, so reflect that in the window caption SetWindowText(hAppWnd, FCEU_NAME_AND_VERSION); //adelikat: If game fails to load while a previous one was open, the previous would have been closed, so reflect that in the window caption
return false; return false;
} }
SetMainWindowText();
ParseGIInput(GameInfo); ParseGIInput(GameInfo);
updateGameDependentMenus(GameInfo != 0); updateGameDependentMenus(GameInfo != 0);

View File

@ -23,6 +23,7 @@ extern HWND pwindow;
HWND GetMainHWND(); HWND GetMainHWND();
void SetMainWindowText();
void HideFWindow(int h); void HideFWindow(int h);
void SetMainWindowStuff(); void SetMainWindowStuff();
int GetClientAbsRect(LPRECT lpRect); int GetClientAbsRect(LPRECT lpRect);

View File

@ -38,6 +38,7 @@
#include <windows.h> #include <windows.h>
#include "./drivers/win/common.h" #include "./drivers/win/common.h"
#include "./drivers/win/tasedit.h" #include "./drivers/win/tasedit.h"
#include "./drivers/win/window.h"
extern void AddRecentMovieFile(const char *filename); extern void AddRecentMovieFile(const char *filename);
#endif #endif
@ -796,6 +797,10 @@ void FCEUI_StopMovie()
curMovieFilename[0] = 0; //No longer a current movie filename curMovieFilename[0] = 0; //No longer a current movie filename
freshMovie = false; //No longer a fresh movie loaded freshMovie = false; //No longer a fresh movie loaded
if (bindSavestate) AutoSS = false; //If bind movies to savestates is true, then there is no longer a valid auto-save to load if (bindSavestate) AutoSS = false; //If bind movies to savestates is true, then there is no longer a valid auto-save to load
#ifdef WIN32
SetMainWindowText();
#endif
} }
void poweron(bool shouldDisableBatteryLoading) void poweron(bool shouldDisableBatteryLoading)
@ -1005,6 +1010,10 @@ bool FCEUI_LoadMovie(const char *fname, bool _read_only, bool tasedit, int _paus
FCEU_DispMessage("Replay started Read+Write.",0); FCEU_DispMessage("Replay started Read+Write.",0);
} }
#ifdef WIN32
SetMainWindowText();
#endif
#ifdef CREATE_AVI #ifdef CREATE_AVI
if(LoggingEnabled) if(LoggingEnabled)
{ {
@ -1598,6 +1607,9 @@ void FCEUI_MoviePlayFromBeginning(void)
//currMovieData.loadSavestateFrom(&currMovieData.savestate); //TODO: make something like this work instead so it doesn't have to reload //currMovieData.loadSavestateFrom(&currMovieData.savestate); //TODO: make something like this work instead so it doesn't have to reload
} }
} }
#ifdef WIN32
SetMainWindowText();
#endif
} }
string FCEUI_GetMovieName(void) string FCEUI_GetMovieName(void)

View File

@ -76,6 +76,7 @@ bool FCEUMOV_Mode(int modemask);
inline bool FCEUMOV_IsPlaying() { return (FCEUMOV_Mode(MOVIEMODE_PLAY|MOVIEMODE_FINISHED)); } inline bool FCEUMOV_IsPlaying() { return (FCEUMOV_Mode(MOVIEMODE_PLAY|MOVIEMODE_FINISHED)); }
inline bool FCEUMOV_IsRecording() { return FCEUMOV_Mode(MOVIEMODE_RECORD); } inline bool FCEUMOV_IsRecording() { return FCEUMOV_Mode(MOVIEMODE_RECORD); }
inline bool FCEUMOV_IsFinished() { return FCEUMOV_Mode(MOVIEMODE_FINISHED);} inline bool FCEUMOV_IsFinished() { return FCEUMOV_Mode(MOVIEMODE_FINISHED);}
inline bool FCEUMOV_IsLoaded() { return (FCEUMOV_Mode(MOVIEMODE_PLAY|MOVIEMODE_RECORD|MOVIEMODE_FINISHED)); }
bool FCEUMOV_ShouldPause(void); bool FCEUMOV_ShouldPause(void);
int FCEUMOV_GetFrame(void); int FCEUMOV_GetFrame(void);
@ -268,7 +269,7 @@ bool FCEUI_LoadMovie(const char *fname, bool read_only, bool tasedit, int _stopf
void FCEUI_MoviePlayFromBeginning(void); void FCEUI_MoviePlayFromBeginning(void);
void FCEUI_StopMovie(void); void FCEUI_StopMovie(void);
bool FCEUI_MovieGetInfo(FCEUFILE* fp, MOVIE_INFO& info, bool skipFrameCount = false); bool FCEUI_MovieGetInfo(FCEUFILE* fp, MOVIE_INFO& info, bool skipFrameCount = false);
char* FCEUI_MovieGetCurrentName(int addSlotNumber); //char* FCEUI_MovieGetCurrentName(int addSlotNumber);
void FCEUI_MovieToggleReadOnly(void); void FCEUI_MovieToggleReadOnly(void);
bool FCEUI_GetMovieToggleReadOnly(); bool FCEUI_GetMovieToggleReadOnly();
void FCEUI_SetMovieToggleReadOnly(bool which); void FCEUI_SetMovieToggleReadOnly(bool which);

View File

@ -774,3 +774,16 @@ std::string getExtension(const char* input) {
ext[k]=tolower(ext[k]); ext[k]=tolower(ext[k]);
return ext; return ext;
} }
//strips the file extension off a filename
std::string StripExtension(std::string filename)
{
return filename.substr(0, filename.find_last_of("."));
}
//strips the path off a filename
std::string StripPath(std::string filename)
{
int x = filename.find_last_of("\\") + 1;
return filename.substr(x, filename.length() - x);
}

View File

@ -126,3 +126,6 @@ std::string wcstombs(std::wstring str);
//TODO - dont we already have another function that can do this //TODO - dont we already have another function that can do this
std::string getExtension(const char* input); std::string getExtension(const char* input);
std::string StripExtension(std::string filename);
std::string StripPath(std::string filename);