Win32 - GUI Dialog - added option to disable the context menu. Win32 Help CHM - added a page of lua functions & descriptions. Minor cleanup in lua-engine.cpp

This commit is contained in:
adelikat 2009-03-16 14:10:59 +00:00
parent efcc05ed8d
commit 3f60a5c6f8
8 changed files with 68 additions and 45 deletions

View File

@ -1,4 +1,5 @@
---version 2.0.4 yet to be released--- ---version 2.0.4 yet to be released---
16-mar-2009 - adelikat - Win32 - GUI Dialog - added an option to disable the context menu
15-mar-2009 - adelikat - Lua - added movie.rerecordcount(), movie.length(), movie.getname(), movie.playbeginning(), FCEU.getreadonly(), FCEU.setreadonly() 15-mar-2009 - adelikat - Lua - added movie.rerecordcount(), movie.length(), movie.getname(), movie.playbeginning(), FCEU.getreadonly(), FCEU.setreadonly()
14-mar-2009 - adelikat - Lua - added movie.active() - returns a bool value based on whether a movie is currently loaded 14-mar-2009 - adelikat - Lua - added movie.active() - returns a bool value based on whether a movie is currently loaded
14-mar-2009 - adelikat - Fixed Joypad.set, it uses 3 values instead of 2 now. True will take control of a button and make it on, False will take control and make it off, and Nil will not take control (allowing the user to press the button) 14-mar-2009 - adelikat - Fixed Joypad.set, it uses 3 values instead of 2 now. True will take control of a button and make it on, False will take control and make it off, and Nil will not take control (allowing the user to press the button)

View File

@ -54,6 +54,7 @@ extern bool bindSavestate;
extern int PPUViewRefresh; extern int PPUViewRefresh;
extern int NTViewRefresh; extern int NTViewRefresh;
extern uint8 gNoBGFillColor; extern uint8 gNoBGFillColor;
extern bool rightClickEnabled;
//window positions and sizes: //window positions and sizes:
extern int ChtPosX,ChtPosY; extern int ChtPosX,ChtPosY;
@ -239,6 +240,7 @@ static CFGSTRUCT fceuconfig[] = {
AC(ClipSidesOffset), AC(ClipSidesOffset),
AC(PPUViewRefresh), AC(PPUViewRefresh),
AC(NTViewRefresh), AC(NTViewRefresh),
AC(rightClickEnabled),
//ACS(memwLastfile[2048]), //ACS(memwLastfile[2048]),
ENDCFGSTRUCT ENDCFGSTRUCT
}; };

View File

@ -2,6 +2,8 @@
#include "main.h" #include "main.h"
#include "gui.h" #include "gui.h"
extern bool rightClickEnabled; //Declared in window.cpp and only an extern here
/** /**
* Processes information from the GUI options dialog after * Processes information from the GUI options dialog after
* the dialog was closed. * the dialog was closed.
@ -40,6 +42,16 @@ void CloseGuiDialog(HWND hwndDlg)
goptions |= GOO_DISABLESS; goptions |= GOO_DISABLESS;
} }
if(IsDlgButtonChecked(hwndDlg, CB_ENABLECONTEXTMENU)==BST_CHECKED)
{
rightClickEnabled = true;
}
else
{
rightClickEnabled = false;
}
EndDialog(hwndDlg,0); EndDialog(hwndDlg,0);
} }
@ -72,6 +84,11 @@ BOOL CALLBACK GUIConCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
CheckDlgButton(hwndDlg, CB_DISABLE_SCREEN_SAVER, BST_CHECKED); CheckDlgButton(hwndDlg, CB_DISABLE_SCREEN_SAVER, BST_CHECKED);
} }
if(rightClickEnabled)
{
CheckDlgButton(hwndDlg, CB_ENABLECONTEXTMENU, BST_CHECKED);
}
CenterWindowOnScreen(hwndDlg); CenterWindowOnScreen(hwndDlg);
break; break;

Binary file not shown.

View File

@ -551,12 +551,12 @@ BEGIN
PUSHBUTTON "Turbo A",318,195,122,32,12 PUSHBUTTON "Turbo A",318,195,122,32,12
END END
GUICONFIG DIALOGEX 16, 123, 184, 90 GUICONFIG DIALOGEX 16, 123, 184, 108
STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "GUI Configuration" CAPTION "GUI Configuration"
FONT 8, "MS Sans Serif", 0, 0, 0x0 FONT 8, "MS Sans Serif", 0, 0, 0x0
BEGIN BEGIN
DEFPUSHBUTTON "Close",BUTTON_CLOSE,64,68,56,14 DEFPUSHBUTTON "Close",BUTTON_CLOSE,64,86,56,14
CONTROL "Load ""File Open"" dialog when FCEUX starts.",CB_LOAD_FILE_OPEN, CONTROL "Load ""File Open"" dialog when FCEUX starts.",CB_LOAD_FILE_OPEN,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,8,164,12 "Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,8,164,12
CONTROL "Automatically hide menu on game load.",CB_AUTO_HIDE_MENU, CONTROL "Automatically hide menu on game load.",CB_AUTO_HIDE_MENU,
@ -564,6 +564,8 @@ BEGIN
CONTROL "Ask confirmation on exit attempt.",CB_ASK_EXIT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,38,164,12 CONTROL "Ask confirmation on exit attempt.",CB_ASK_EXIT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,38,164,12
CONTROL "Disable screen saver while game is loaded.",CB_DISABLE_SCREEN_SAVER, CONTROL "Disable screen saver while game is loaded.",CB_DISABLE_SCREEN_SAVER,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,53,164,12 "Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,53,164,12
CONTROL "Enable right-click context menu",CB_ENABLECONTEXTMENU,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,70,115,10
END END
INPUTCONFIG DIALOGEX 122, 105, 349, 199 INPUTCONFIG DIALOGEX 122, 105, 349, 199
@ -1505,7 +1507,7 @@ BEGIN
LEFTMARGIN, 10 LEFTMARGIN, 10
RIGHTMARGIN, 174 RIGHTMARGIN, 174
TOPMARGIN, 8 TOPMARGIN, 8
BOTTOMMARGIN, 82 BOTTOMMARGIN, 100
END END
"INPUTCONFIG", DIALOG "INPUTCONFIG", DIALOG

View File

@ -406,6 +406,8 @@
#define BTN_CANCELED 1200 #define BTN_CANCELED 1200
#define ID_SOUND_TRITOP 1201 #define ID_SOUND_TRITOP 1201
#define ID_SOUND_QUALITYNOTIFY 1202 #define ID_SOUND_QUALITYNOTIFY 1202
#define IDC_CHECK1 1203
#define CB_ENABLECONTEXTMENU 1203
#define MENU_NETWORK 40040 #define MENU_NETWORK 40040
#define MENU_PALETTE 40041 #define MENU_PALETTE 40041
#define MENU_SOUND 40042 #define MENU_SOUND 40042
@ -689,7 +691,7 @@
#ifndef APSTUDIO_READONLY_SYMBOLS #ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 125 #define _APS_NEXT_RESOURCE_VALUE 125
#define _APS_NEXT_COMMAND_VALUE 40353 #define _APS_NEXT_COMMAND_VALUE 40353
#define _APS_NEXT_CONTROL_VALUE 1203 #define _APS_NEXT_CONTROL_VALUE 1204
#define _APS_NEXT_SYMED_VALUE 101 #define _APS_NEXT_SYMED_VALUE 101
#endif #endif
#endif #endif

View File

@ -122,7 +122,10 @@ int MainWindow_wndx, MainWindow_wndy;
static uint32 mousex,mousey,mouseb; static uint32 mousex,mousey,mouseb;
static int vchanged = 0; static int vchanged = 0;
int menuYoffset = 0; int menuYoffset = 0;
//Function Declarations
bool rightClickEnabled = true; //If set to false, the right click context menu will be disabled.
//Function Prototypes
void ChangeMenuItemText(int menuitem, string text); //Alters a menu item name void ChangeMenuItemText(int menuitem, string text); //Alters a menu item name
void ChangeContextMenuItemText(int menuitem, string text, HMENU menu); //Alters a context menu item name void ChangeContextMenuItemText(int menuitem, string text, HMENU menu); //Alters a context menu item name
@ -933,41 +936,44 @@ LRESULT FAR PASCAL AppWndProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam)
case WM_RBUTTONUP: case WM_RBUTTONUP:
{ {
hfceuxcontext = LoadMenu(fceu_hInstance,"FCEUCONTEXTMENUS"); if (rightClickEnabled)
{
hfceuxcontext = LoadMenu(fceu_hInstance,"FCEUCONTEXTMENUS");
//If There is a movie loaded in read only //If There is a movie loaded in read only
if (GameInfo && FCEUMOV_Mode(MOVIEMODE_PLAY|MOVIEMODE_RECORD) && movie_readonly) if (GameInfo && FCEUMOV_Mode(MOVIEMODE_PLAY|MOVIEMODE_RECORD) && movie_readonly)
{ {
hfceuxcontextsub = GetSubMenu(hfceuxcontext,0); hfceuxcontextsub = GetSubMenu(hfceuxcontext,0);
whichContext = 0; whichContext = 0;
} }
//If there is a movie loaded in read+write //If there is a movie loaded in read+write
else if (GameInfo && FCEUMOV_Mode(MOVIEMODE_PLAY|MOVIEMODE_RECORD) && !movie_readonly) else if (GameInfo && FCEUMOV_Mode(MOVIEMODE_PLAY|MOVIEMODE_RECORD) && !movie_readonly)
{ {
hfceuxcontextsub = GetSubMenu(hfceuxcontext,3); hfceuxcontextsub = GetSubMenu(hfceuxcontext,3);
whichContext = 3; whichContext = 3;
} }
//If there is a ROM loaded but no movie //If there is a ROM loaded but no movie
else if (GameInfo) else if (GameInfo)
{ {
hfceuxcontextsub = GetSubMenu(hfceuxcontext,1); hfceuxcontextsub = GetSubMenu(hfceuxcontext,1);
whichContext = 1; whichContext = 1;
}
//Else no ROM
else
{
hfceuxcontextsub = GetSubMenu(hfceuxcontext,2);
whichContext = 2;
}
UpdateContextMenuItems(hfceuxcontextsub, whichContext);
pt.x = LOWORD(lParam); //Get mouse x in terms of client area
pt.y = HIWORD(lParam); //Get mouse y in terms of client area
ClientToScreen(hAppWnd, (LPPOINT) &pt); //Convert client area x,y to screen x,y
TrackPopupMenu(hfceuxcontextsub,0,(pt.x),(pt.y),TPM_RIGHTBUTTON,hWnd,0); //Create menu
} }
//Else no ROM
else
{
hfceuxcontextsub = GetSubMenu(hfceuxcontext,2);
whichContext = 2;
}
UpdateContextMenuItems(hfceuxcontextsub, whichContext);
pt.x = LOWORD(lParam); //Get mouse x in terms of client area
pt.y = HIWORD(lParam); //Get mouse y in terms of client area
ClientToScreen(hAppWnd, (LPPOINT) &pt); //Convert client area x,y to screen x,y
TrackPopupMenu(hfceuxcontextsub,0,(pt.x),(pt.y),TPM_RIGHTBUTTON,hWnd,0); //Create menu
} }
case WM_MOVE: case WM_MOVE:

View File

@ -872,14 +872,7 @@ static int savestate_load(lua_State *L) {
// //
// Gets the frame counter for the movie, or nil if no movie running. // Gets the frame counter for the movie, or nil if no movie running.
int movie_framecount(lua_State *L) { int movie_framecount(lua_State *L) {
/* // qfox, 08-11-21; fceu now counts the number of frames
//since the last reset if no movie is playing
if (!FCEUMOV_IsPlaying() && !FCEUMOV_IsRecording()) {
lua_pushnil(L);
return 1;
}
*/
lua_pushinteger(L, FCEUMOV_GetFrame()); lua_pushinteger(L, FCEUMOV_GetFrame());
return 1; return 1;
} }