Optimized/beautified previous committed code. Appears to function identically, and uses a single function throughout 16 files.
This commit is contained in:
parent
9c5a81471e
commit
236708f9b8
|
@ -99,12 +99,7 @@ BOOL CALLBACK CDLoggerCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
|
|||
CDLogger_wndy = wrect.top;
|
||||
|
||||
#ifdef WIN32
|
||||
if (wrect.right < 59) {
|
||||
CDLogger_wndx = 0;
|
||||
}
|
||||
if (CDLogger_wndy < -18) {
|
||||
CDLogger_wndy = -18;
|
||||
}
|
||||
WindowBoundsCheckNoResize(CDLogger_wndx,CDLogger_wndy,wrect.right);
|
||||
#endif
|
||||
break;
|
||||
};
|
||||
|
|
|
@ -246,12 +246,7 @@ BOOL CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l
|
|||
ChtPosY = wrect.top;
|
||||
|
||||
#ifdef WIN32
|
||||
if (wrect.right < 59) {
|
||||
ChtPosX = 0;
|
||||
}
|
||||
if (ChtPosY < -18) {
|
||||
ChtPosY = -18;
|
||||
}
|
||||
WindowBoundsCheckNoResize(ChtPosX,ChtPosY,wrect.right);
|
||||
#endif
|
||||
break;
|
||||
|
||||
|
@ -634,12 +629,7 @@ BOOL CALLBACK GGConvCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|||
GGConv_wndy = wrect.top;
|
||||
|
||||
#ifdef WIN32
|
||||
if (wrect.right < 59) {
|
||||
GGConv_wndx = 0;
|
||||
}
|
||||
if (GGConv_wndy < -18) {
|
||||
GGConv_wndy = -18;
|
||||
}
|
||||
WindowBoundsCheckNoResize(GGConv_wndx,GGConv_wndy,wrect.right);
|
||||
#endif
|
||||
break;
|
||||
};
|
||||
|
|
|
@ -6,3 +6,22 @@ bool directoryExists(const char* dirname)
|
|||
return res != 0xFFFFFFFF && res & FILE_ATTRIBUTE_DIRECTORY;
|
||||
}
|
||||
|
||||
void WindowBoundsCheckResize(int &windowPosX, int &windowPosY, int windowSizeX, long windowRight)
|
||||
{
|
||||
if (windowRight < 59) {
|
||||
windowPosX = 59 - windowSizeX;
|
||||
}
|
||||
if (windowPosY < -18) {
|
||||
windowPosY = -18;
|
||||
}
|
||||
}
|
||||
|
||||
void WindowBoundsCheckNoResize(int &windowPosX, int &windowPosY, long windowRight)
|
||||
{
|
||||
if (windowRight < 59) {
|
||||
windowPosX = 0;
|
||||
}
|
||||
if (windowPosY < -18) {
|
||||
windowPosY = -18;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -50,4 +50,6 @@ extern int eoptions;
|
|||
#define EO_FOURSCORE 32768
|
||||
|
||||
bool directoryExists(const char* dirname);
|
||||
void WindowBoundsCheckResize(int &windowPosX, int &windowPosY, int windowSizeX, long windowRight);
|
||||
void WindowBoundsCheckNoResize(int &windowPosX, int &windowPosY, long windowRight);
|
||||
#endif
|
||||
|
|
|
@ -317,29 +317,6 @@ void SaveConfig(const char *filename)
|
|||
}
|
||||
//-----------------------------------
|
||||
|
||||
//ugetab: window positions could use some bounds checking.
|
||||
// MemView_wndx and MemView_wndy verified to sometimes end up -32000
|
||||
//CDLogger_wndx
|
||||
//CDLogger_wndy
|
||||
//GGConv_wndx
|
||||
//GGConv_wndy
|
||||
//MainWindow_wndx
|
||||
//MainWindow_wndy
|
||||
//MemFind_wndx
|
||||
//MemFind_wndy
|
||||
//MemView_wndx
|
||||
//MemView_wndy
|
||||
//MemWatch_wndx
|
||||
//MemWatch_wndy
|
||||
//Monitor_wndx
|
||||
//Monitor_wndy
|
||||
//TasEdit_wndx
|
||||
//TasEdit_wndy
|
||||
//Tracer_wndx
|
||||
//Tracer_wndy
|
||||
|
||||
//-----------------------------------
|
||||
|
||||
SaveFCEUConfig(filename,fceuconfig);
|
||||
}
|
||||
|
||||
|
|
|
@ -1085,12 +1085,7 @@ BOOL CALLBACK DebuggerCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
|
|||
DbgPosY = wrect.top;
|
||||
|
||||
#ifdef WIN32
|
||||
if (wrect.right < 59) {
|
||||
DbgPosX = 59 - DbgSizeX;
|
||||
}
|
||||
if (DbgPosY < -18) {
|
||||
DbgPosY = -18;
|
||||
}
|
||||
WindowBoundsCheckResize(DbgPosX,DbgPosY,DbgSizeX,wrect.right);
|
||||
#endif
|
||||
break;
|
||||
|
||||
|
|
|
@ -88,12 +88,7 @@ BOOL CALLBACK LogCon(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|||
MLogPosY = wrect.top;
|
||||
|
||||
#ifdef WIN32
|
||||
if (wrect.right < 59) {
|
||||
MLogPosX = 0;
|
||||
}
|
||||
if (MLogPosY < -18) {
|
||||
MLogPosY = -18;
|
||||
}
|
||||
WindowBoundsCheckNoResize(MLogPosX,MLogPosY,wrect.right);
|
||||
#endif
|
||||
|
||||
break;
|
||||
|
|
|
@ -1598,12 +1598,7 @@ LRESULT CALLBACK MemViewCallB(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
|
|||
MemView_wndy = wrect.top;
|
||||
|
||||
#ifdef WIN32
|
||||
if (wrect.right < 59) {
|
||||
MemView_wndx = 59 - MemViewSizeX;
|
||||
}
|
||||
if (MemView_wndy < -18) {
|
||||
MemView_wndy = -18;
|
||||
}
|
||||
WindowBoundsCheckResize(MemView_wndx,MemView_wndy,MemViewSizeX,wrect.right);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
|
@ -1706,12 +1701,7 @@ BOOL CALLBACK MemFindCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam
|
|||
MemFind_wndy = wrect.top;
|
||||
|
||||
#ifdef WIN32
|
||||
if (wrect.right < 59) {
|
||||
MemFind_wndx = 0;
|
||||
}
|
||||
if (MemFind_wndy < -18) {
|
||||
MemFind_wndy = -18;
|
||||
}
|
||||
WindowBoundsCheckNoResize(MemFind_wndx,MemFind_wndy,wrect.right);
|
||||
#endif
|
||||
|
||||
break;
|
||||
|
|
|
@ -726,12 +726,7 @@ static BOOL CALLBACK MemWatchCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA
|
|||
MemWatch_wndy = wrect.top;
|
||||
|
||||
#ifdef WIN32
|
||||
if (wrect.right < 59) {
|
||||
MemWatch_wndx = 0;
|
||||
}
|
||||
if (MemWatch_wndy < -18) {
|
||||
MemWatch_wndy = -18;
|
||||
}
|
||||
WindowBoundsCheckNoResize(MemWatch_wndx,MemWatch_wndy,wrect.right);
|
||||
#endif
|
||||
|
||||
break;
|
||||
|
|
|
@ -229,12 +229,7 @@ BOOL CALLBACK MonitorCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam
|
|||
Monitor_wndy = wrect.top;
|
||||
|
||||
#ifdef WIN32
|
||||
if (wrect.right < 59) {
|
||||
Monitor_wndx = 0;
|
||||
}
|
||||
if (Monitor_wndy < -18) {
|
||||
Monitor_wndy = -18;
|
||||
}
|
||||
WindowBoundsCheckNoResize(Monitor_wndx,Monitor_wndy,wrect.right);
|
||||
#endif
|
||||
|
||||
break;
|
||||
|
|
|
@ -426,12 +426,7 @@ BOOL CALLBACK NTViewCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|||
NTViewPosY = wrect.top;
|
||||
|
||||
#ifdef WIN32
|
||||
if (wrect.right < 59) {
|
||||
NTViewPosX = 0;
|
||||
}
|
||||
if (NTViewPosY < -18) {
|
||||
NTViewPosY = -18;
|
||||
}
|
||||
WindowBoundsCheckNoResize(NTViewPosX,NTViewPosY,wrect.right);
|
||||
#endif
|
||||
|
||||
break;
|
||||
|
|
|
@ -272,12 +272,7 @@ BOOL CALLBACK PPUViewCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam
|
|||
PPUViewPosY = wrect.top;
|
||||
|
||||
#ifdef WIN32
|
||||
if (wrect.right < 59) {
|
||||
PPUViewPosX = 0;
|
||||
}
|
||||
if (PPUViewPosY < -18) {
|
||||
PPUViewPosY = -18;
|
||||
}
|
||||
WindowBoundsCheckNoResize(PPUViewPosX,PPUViewPosY,wrect.right);
|
||||
#endif
|
||||
|
||||
break;
|
||||
|
|
|
@ -832,12 +832,7 @@ LRESULT CALLBACK RamWatchProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam
|
|||
ramw_y = wrect.top;
|
||||
|
||||
#ifdef WIN32
|
||||
if (wrect.right < 59) {
|
||||
ramw_x = 0;
|
||||
}
|
||||
if (ramw_y < -18) {
|
||||
ramw_y = -18;
|
||||
}
|
||||
WindowBoundsCheckNoResize(ramw_x,ramw_y,wrect.right);
|
||||
#endif
|
||||
|
||||
//regSetDwordValue(RAMWX, ramw_x); TODO
|
||||
|
|
|
@ -403,12 +403,7 @@ BOOL CALLBACK ReplayMetadataDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L
|
|||
MetaPosY = wrect.top;
|
||||
|
||||
#ifdef WIN32
|
||||
if (wrect.right < 59) {
|
||||
MetaPosX = 0;
|
||||
}
|
||||
if (MetaPosY < -18) {
|
||||
MetaPosY = -18;
|
||||
}
|
||||
WindowBoundsCheckNoResize(MetaPosX,MetaPosY,wrect.right);
|
||||
#endif
|
||||
break;
|
||||
|
||||
|
|
|
@ -1023,12 +1023,7 @@ BOOL CALLBACK WndprocTasEdit(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
|
|||
TasEdit_wndy = wrect.top;
|
||||
|
||||
#ifdef WIN32
|
||||
if (wrect.right < 59) {
|
||||
TasEdit_wndx = 0;
|
||||
}
|
||||
if (TasEdit_wndy < -18) {
|
||||
TasEdit_wndy = -18;
|
||||
}
|
||||
WindowBoundsCheckNoResize(TasEdit_wndx,TasEdit_wndy,wrect.right);
|
||||
#endif
|
||||
|
||||
break;
|
||||
|
|
|
@ -877,12 +877,7 @@ BOOL CALLBACK TextHookerCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
|
|||
TextHookerPosY = wrect.top;
|
||||
|
||||
#ifdef WIN32
|
||||
if (wrect.right < 59) {
|
||||
TextHookerPosX = 0;
|
||||
}
|
||||
if (TextHookerPosY < -18) {
|
||||
TextHookerPosY = -18;
|
||||
}
|
||||
WindowBoundsCheckNoResize(TextHookerPosX,TextHookerPosY,wrect.right);
|
||||
#endif
|
||||
|
||||
break;
|
||||
|
|
|
@ -92,12 +92,7 @@ BOOL CALLBACK TracerCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|||
Tracer_wndy = wrect.top;
|
||||
|
||||
#ifdef WIN32
|
||||
if (wrect.right < 59) {
|
||||
Tracer_wndx = 0;
|
||||
}
|
||||
if (Tracer_wndy < -18) {
|
||||
Tracer_wndy = -18;
|
||||
}
|
||||
WindowBoundsCheckNoResize(Tracer_wndx,Tracer_wndy,wrect.right);
|
||||
#endif
|
||||
|
||||
break;
|
||||
|
|
|
@ -1198,12 +1198,7 @@ LRESULT FAR PASCAL AppWndProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam)
|
|||
MainWindow_wndy = wrect.top;
|
||||
|
||||
#ifdef WIN32
|
||||
if (wrect.right < 59) {
|
||||
MainWindow_wndx = 0;
|
||||
}
|
||||
if (MainWindow_wndy < -18) {
|
||||
MainWindow_wndy = -18;
|
||||
}
|
||||
WindowBoundsCheckNoResize(MainWindow_wndx,MainWindow_wndy,wrect.right);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue