From 8b89eb1ebed6f0b048968b27b9230682b3e0eb8c Mon Sep 17 00:00:00 2001 From: zeromus Date: Wed, 16 Dec 2009 05:07:38 +0000 Subject: [PATCH] win32: fix always on top inifile saving and add "lockdown" option to keep mouse from breaking the window during fast stylus action --- desmume/ChangeLog | 1 + desmume/src/driver.cpp | 45 +- desmume/src/types.h | 1 + desmume/src/windows/DeSmuME_2005.vcproj | 4 - desmume/src/windows/main.cpp | 70 +- desmume/src/windows/resource.h | 3 +- desmume/src/windows/resources.rc | Bin 888142 -> 888274 bytes desmume/src/wxdlg/desmume.pjd | 835 ++++++++++++++++-------- desmume/src/wxdlg/wxdlg3dViewer.cpp | 176 ++++- desmume/src/wxdlg/wxdlg3dViewer.h | 79 ++- 10 files changed, 872 insertions(+), 342 deletions(-) diff --git a/desmume/ChangeLog b/desmume/ChangeLog index 2785a3940..3e2131596 100644 --- a/desmume/ChangeLog +++ b/desmume/ChangeLog @@ -20,6 +20,7 @@ Windows: enh: add EPX and EPX1.5X resize filters enh: add a japanese translation which will soon be stale like the others enh: add fancy printscreen with emulator info on it + enh: add "lockdown" window mode to keep window safe from fast stylus action Linux/OSX: bug: fix building for nosse2 systems diff --git a/desmume/src/driver.cpp b/desmume/src/driver.cpp index 0554e75ad..a1ac4c810 100644 --- a/desmume/src/driver.cpp +++ b/desmume/src/driver.cpp @@ -24,20 +24,18 @@ #include "rasterize.h" #include "gfx3d.h" -#ifdef _MSC_VER -#define HAVE_WX -#endif #ifdef HAVE_WX #include "wx/wxprec.h" #include "wx/wx.h" #include "wxdlg/wxdlg3dViewer.h" -const int kVewportWidth = 512; +const int kViewportWidth = 256; +const int kViewportHeight = 192; static SoftRasterizerEngine engine; -static Fragment _screen[kVewportWidth*384]; -static FragmentColor _screenColor[kVewportWidth*384]; +static Fragment _screen[kViewportWidth*kViewportHeight]; +static FragmentColor _screenColor[kViewportWidth*kViewportHeight]; extern void _HACK_Viewer_ExecUnit(SoftRasterizerEngine* engine); @@ -54,6 +52,24 @@ public: Update(); } + void NewFrame() + { + listPolys->SetItemCount(viewer3d_state.polylist.count); + labelUserPolycount->SetLabel(wxString::Format("%s: %d",_("User Polys"),viewer3d_state.polylist.count)); + labelFinalPolycount->SetLabel(wxString::Format("%s: %d",_("Final Polys"),viewer3d_state.polylist.count)); + tree->DeleteAllItems(); + wxTreeItemId root = tree->AddRoot(""); + for(int i=0;iAppendItem(root,"hai kirin"); + } + } + + virtual wxString OnGetItemText(const wxListCtrl* list, long item, long column) const + { + return "hi"; + } + void RedrawPanel(wxClientDC* dc) { //------------ @@ -63,16 +79,16 @@ public: engine.indexlist = &viewer3d_state.indexlist; engine.screen = _screen; engine.screenColor = _screenColor; - engine.width = kVewportWidth; - engine.height = 384; + engine.width = kViewportWidth; + engine.height = kViewportHeight; engine.updateFogTable(); - engine.initFramebuffer(kVewportWidth,384,gfx3d.state.enableClearImage); + engine.initFramebuffer(kViewportWidth,kViewportHeight,gfx3d.state.enableClearImage); engine.updateToonTable(); engine.updateFloatColors(); engine.performClipping(checkMaterialInterpolate->IsChecked()); - engine.performViewportTransforms(kVewportWidth,384); + engine.performViewportTransforms(kViewportWidth,kViewportHeight); engine.performBackfaceTests(); engine.performCoordAdjustment(false); engine.setupTextures(false); @@ -81,14 +97,14 @@ public: //------------ //dc.SetBackground(*wxGREEN_BRUSH); dc.Clear(); - u8 framebuffer[kVewportWidth*384*3]; - for(int y=0,i=0;y<384;y++) - for(int x=0;xDrawBitmap(bitmap,0,0); } @@ -135,6 +151,7 @@ public: return; } + viewer->NewFrame(); viewer->RepaintPanel(); } diff --git a/desmume/src/types.h b/desmume/src/types.h index 46f8a804e..3daeaaf07 100644 --- a/desmume/src/types.h +++ b/desmume/src/types.h @@ -33,6 +33,7 @@ #endif #ifdef _MSC_VER + #define HAVE_WX #define ENABLE_SSE #define ENABLE_SSE2 #ifdef DEVELOPER diff --git a/desmume/src/windows/DeSmuME_2005.vcproj b/desmume/src/windows/DeSmuME_2005.vcproj index fe89fa18a..8f7872ba8 100644 --- a/desmume/src/windows/DeSmuME_2005.vcproj +++ b/desmume/src/windows/DeSmuME_2005.vcproj @@ -1564,10 +1564,6 @@ RelativePath="..\wxdlg\wxdlg3dViewer.h" > - - getHWnd(),GWL_STYLE); + ws &= ~(WS_CAPTION | WS_POPUP | WS_THICKFRAME | WS_DLGFRAME ); + if(dws & DWS_LOCKDOWN) + ws |= WS_POPUP | WS_DLGFRAME ; + else ws |= WS_CAPTION | WS_THICKFRAME; + SetWindowLong(MainWindow->getHWnd(),GWL_STYLE, ws); + + currWindowStyle = dws; + HWND insertAfter = HWND_NOTOPMOST; + if(dws & DWS_ALWAYSONTOP) + insertAfter = HWND_TOPMOST; + SetWindowPos(MainWindow->getHWnd(), insertAfter, 0,0,0,0, SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED); +} + +static u32 GetStyle() { return currWindowStyle; } +//--------- + void UpdateRecentRomsMenu() { //This function will be called to populate the Recent Menu @@ -2157,9 +2186,10 @@ static void RefreshMicSettings() DWORD wmTimerRes; int _main() { + //7zup initialization InitDecoder(); -#ifdef WX_STUB +#ifdef HAVE_WX wxInitialize(); #endif @@ -2214,6 +2244,10 @@ int _main() exit(-1); } + u32 style = DWS_NORMAL; + if(GetPrivateProfileBool("Video","Window Always On Top", false, IniName)) style |= DWS_ALWAYSONTOP; + if(GetPrivateProfileBool("Video","Window Lockdown", false, IniName)) style |= DWS_LOCKDOWN; + windowSize = GetPrivateProfileInt("Video","Window Size", 0, IniName); video.rotation = GetPrivateProfileInt("Video","Window Rotate", 0, IniName); video.rotation_userset = GetPrivateProfileInt("Video","Window Rotate Set", video.rotation, IniName); @@ -2288,7 +2322,7 @@ int _main() MainWindow = new WINCLASS(CLASSNAME, hAppInst); if (!MainWindow->create((char*)EMU_DESMUME_NAME_AND_VERSION(), WndX, WndY, video.width,video.height+video.screengap, - WS_CAPTION| WS_SYSMENU | WS_SIZEBOX | WS_MINIMIZEBOX | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, + WS_CAPTION | WS_SYSMENU | WS_SIZEBOX | WS_MINIMIZEBOX | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, NULL)) { MessageBox(NULL, "Error creating main window", "DeSmuME", MB_OK); @@ -2296,6 +2330,8 @@ int _main() exit(-1); } + SetStyle(style); + gpu_SetRotateScreen(video.rotation); //default the firmware settings, they may get changed later @@ -2582,8 +2618,8 @@ int _main() MainWindow->Show(SW_NORMAL); //DEBUG TEST HACK - //driver->VIEW3D_Init(); - //driver->view3d->Launch(); + driver->VIEW3D_Init(); + driver->view3d->Launch(); //--------- //------DO EVERYTHING @@ -3550,6 +3586,7 @@ void FilterUpdate (HWND hwnd, bool user) WritePrivateProfileInt("Video", "Height", video.height, IniName); } + void DesEnableMenuItem(HMENU hMenu, UINT uIDEnableItem, bool enable) { EnableMenuItem(hMenu, uIDEnableItem, MF_BYCOMMAND | (enable?MF_ENABLED:MF_GRAYED)); @@ -3646,6 +3683,8 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM MainWindow->checkMenu(IDC_WINDOW2_5X, ((windowSize==65534))); MainWindow->checkMenu(IDC_WINDOW3X, ((windowSize==3))); MainWindow->checkMenu(IDC_WINDOW4X, ((windowSize==4))); + MainWindow->checkMenu(IDM_ALWAYS_ON_TOP, (GetStyle()&DWS_ALWAYSONTOP)!=0); + MainWindow->checkMenu(IDM_LOCKDOWN, (GetStyle()&DWS_LOCKDOWN)!=0); //Screen Separation MainWindow->checkMenu(IDM_SCREENSEP_NONE, ((video.screengap==kGapNone))); @@ -5090,23 +5129,16 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM ScaleScreen(1); } break; + case IDM_LOCKDOWN: + { + SetStyle(GetStyle()^DWS_LOCKDOWN); + WritePrivateProfileBool("Video", "Window Lockdown", (GetStyle()&DWS_LOCKDOWN)!=0, IniName); + } + return 0; case IDM_ALWAYS_ON_TOP: { - LONG exStyle = GetWindowLong(MainWindow->getHWnd(), GWL_EXSTYLE); - UINT menuCheck = MF_BYCOMMAND; - HWND insertAfter = HWND_TOPMOST; - - - if(exStyle & WS_EX_TOPMOST) - { - menuCheck |= MF_UNCHECKED; - insertAfter = HWND_NOTOPMOST; - } - else - menuCheck |= MF_CHECKED; - - CheckMenuItem(mainMenu, IDM_ALWAYS_ON_TOP, menuCheck); - SetWindowPos(MainWindow->getHWnd(), insertAfter, 0,0,0,0, SWP_NOMOVE | SWP_NOSIZE); + SetStyle(GetStyle()^DWS_ALWAYSONTOP); + WritePrivateProfileBool("Video", "Window Always On Top", (GetStyle()&DWS_ALWAYSONTOP)!=0, IniName); } return 0; diff --git a/desmume/src/windows/resource.h b/desmume/src/windows/resource.h index 620611714..7e94c0267 100644 --- a/desmume/src/windows/resource.h +++ b/desmume/src/windows/resource.h @@ -699,6 +699,7 @@ #define IDM_CHEATS_SEARCH 40063 #define ID_RAMSEARCH_CAPTIONTEXT 40064 #define IDM_VIEW3D 40065 +#define IDM_LOCKDOWN 40066 #define IDC_LABEL_UP 50000 #define IDC_LABEL_RIGHT 50001 #define IDC_LABEL_LEFT 50002 @@ -794,7 +795,7 @@ #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 106 -#define _APS_NEXT_COMMAND_VALUE 40010 +#define _APS_NEXT_COMMAND_VALUE 40012 #define _APS_NEXT_CONTROL_VALUE 1020 #define _APS_NEXT_SYMED_VALUE 101 #endif diff --git a/desmume/src/windows/resources.rc b/desmume/src/windows/resources.rc index a0f96a224f9fcc76ff694c6bccebc3578fcb12d6..8d763cd0ef9a5a3c6d4d3fec439d8e0b16866765 100644 GIT binary patch delta 125 zcmX>%%k0u@vxXMN7N!>F7M2#)7Pc+y0b8eE*v`c=eF_Jw#dHB1CXVSf(M)>N8{)WR zrW>qaXW`9fNM^`pNMXolC}+r<-e|$3J$*wb6BoBXgENCSgA0Q{L-_PS7bfxP2289P Z?XR}712G2>a{@6J5OZ&TwUsC3Iso(;D%$`6 delta 54 zcmcaK+w9ydvxXMN7N!>F7M2#)7Pc+y0b8esRB_E|FWANo#2i4(3B+7L%)Px}8&A@8 E09RNRY5)KL diff --git a/desmume/src/wxdlg/desmume.pjd b/desmume/src/wxdlg/desmume.pjd index 951611081..09c225c6d 100644 --- a/desmume/src/wxdlg/desmume.pjd +++ b/desmume/src/wxdlg/desmume.pjd @@ -289,7 +289,7 @@ -1 -1 399 - 299 + 300 0 "" @@ -322,7 +322,7 @@ 0 0 - "wxStaticBoxSizer V" + "wxBoxSizer V" "dialog-control-document" "" "sizer" @@ -330,20 +330,11 @@ 1 0 0 - "wbStaticBoxSizerProxy" - "wxID_ANY" - -1 - "Display optionsss" - "" - "" - "" - "" - 0 - 1 - "wxStaticBox" + "wbBoxSizerProxy" "Vertical" - "Centre" - "Centre" + "" + "Expand" + "Top" 0 5 1 @@ -355,57 +346,28 @@ 0 "<Any platform>" - "wxCheckBox: ID_MATERIALINTERPOLATE" + "wxStaticBoxSizer V" "dialog-control-document" "" - "checkbox" + "sizer" 0 1 0 0 - "wbCheckBoxProxy" - "wxEVT_COMMAND_CHECKBOX_CLICKED|OnMaterialInterpolateClick|NONE||wxdlg3dViewer" - "ID_MATERIALINTERPOLATE" - 10004 - "" - "wxCheckBox" - "wxCheckBox" - 1 - 0 - "" - "" - "checkMaterialInterpolate" - "Material clip interpolation" - 0 - "" - "" - "" - "" - "" - "" - "" - "" - "" - "" + "wbStaticBoxSizerProxy" + "wxID_ANY" + -1 + "Display optionsss" + "" + "" "" "" 0 1 - "<Any platform>" - 0 - 0 - 0 - 0 - 0 - 0 - 0 - "" - -1 - -1 - -1 - -1 + "wxStaticBox" + "Vertical" "Centre" - "Centre" + "Top" 0 5 1 @@ -415,58 +377,147 @@ 0 0 0 - "" - "" + "<Any platform>" + + "wxCheckBox: ID_MATERIALINTERPOLATE" + "dialog-control-document" + "" + "checkbox" + 0 + 1 + 0 + 0 + "wbCheckBoxProxy" + "wxEVT_COMMAND_CHECKBOX_CLICKED|OnMaterialInterpolateClick|NONE||wxdlg3dViewer" + "ID_MATERIALINTERPOLATE" + 10004 + "" + "wxCheckBox" + "wxCheckBox" + 1 + 0 + "" + "" + "checkMaterialInterpolate" + "Material clip interpolation" + 0 + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + 0 + 1 + "<Any platform>" + 0 + 0 + 0 + 0 + 0 + 0 + 0 + "" + -1 + -1 + -1 + -1 + "Centre" + "Centre" + 0 + 5 + 1 + 1 + 1 + 1 + 0 + 0 + 0 + "" + "" + + + "wxCheckBox: ID_CHECKBOX1" + "dialog-control-document" + "" + "checkbox" + 0 + 1 + 0 + 0 + "wbCheckBoxProxy" + "ID_CHECKBOX1" + 10008 + "" + "wxCheckBox" + "wxCheckBox" + 1 + 0 + "" + "" + "" + "Something else" + 0 + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + 0 + 1 + "<Any platform>" + 0 + 0 + 0 + 0 + 0 + 0 + 0 + "" + -1 + -1 + -1 + -1 + "Centre" + "Centre" + 0 + 5 + 1 + 1 + 1 + 1 + 0 + 0 + 0 + "" + "" + - "wxCheckBox: ID_CHECKBOX1" + "Spacer" "dialog-control-document" "" - "checkbox" + "spacer" 0 1 0 0 - "wbCheckBoxProxy" - "ID_CHECKBOX1" - 10008 - "" - "wxCheckBox" - "wxCheckBox" - 1 - 0 - "" - "" - "" - "Something else" - 0 - "" - "" - "" - "" - "" - "" - "" - "" - "" - "" - "" - "" - 0 - 1 - "<Any platform>" - 0 - 0 - 0 - 0 - 0 - 0 - 0 - "" - -1 - -1 - -1 - -1 + "wbSpacerProxy" + 5 + 5 "Centre" "Centre" 0 @@ -478,32 +529,62 @@ 0 0 0 - "" - "" + "<Any platform>" + + + "wxFlexGridSizer" + "dialog-control-document" + "" + "sizer" + 0 + 1 + 0 + 0 + "wbFlexGridSizerProxy" + "" + "" + 2 + 0 + 0 + 0 + "" + "<Any platform>" + "Centre" + "Centre" + 1 + 5 + 1 + 1 + 1 + 1 + 0 + 0 + 0 - "wxPanel: ID_PANEL" + "wxWindow: ID_VIEWPORT" "dialog-control-document" "" - "panel" + "foreign" 0 1 0 0 - "wbPanelProxy" + "wbForeignCtrlProxy" "wxEVT_PAINT|OnPanelPaint|NONE||wxdlg3dViewer" "wxEVT_ERASE_BACKGROUND|OnPanelEraseBackground|NONE||wxdlg3dViewer" - "ID_PANEL" - 10001 + "ID_VIEWPORT" + 10002 "" - "wxPanel" - "wxPanel" + "wxWindow" + "wxWindow" 1 0 "" "" "panelViewport" + 1 "" "" "" @@ -512,18 +593,18 @@ 0 1 "<Any platform>" + "" + "" "" "" "" "" "" - "" - "Tiled" 0 - 0 + 1 0 0 - 1 + 0 0 0 0 @@ -532,16 +613,12 @@ 0 0 0 - 1 - 0 0 - 0 "" - 1 -1 -1 - 512 - 384 + 256 + 192 "Centre" "Centre" 0 @@ -556,10 +633,9 @@ "" "" "" - 0 - "wxStaticBoxSizer V" + "wxFlexGridSizer" "dialog-control-document" "" "sizer" @@ -567,21 +643,18 @@ 1 0 0 - "wbStaticBoxSizerProxy" - "wxID_ANY" - -1 - "Choose One" + "wbFlexGridSizerProxy" + "" + "1" + 1 + 3 + 0 + 0 "" - "" - "" - "" - 0 - 1 - "wxStaticBox" - "Vertical" + "<Any platform>" "Centre" - "Top" - 0 + "Expand" + 1 5 1 1 @@ -590,56 +663,29 @@ 0 0 0 - "<Any platform>" - "wxRadioButton: ID_RADIOBUTTON" + "wxStaticBoxSizer V" "dialog-control-document" "" - "radiobutton" + "sizer" 0 1 0 0 - "wbRadioButtonProxy" - "ID_RADIOBUTTON" - 10005 - "" - "wxRadioButton" - "wxRadioButton" - 1 - 0 - "" - "" + "wbStaticBoxSizerProxy" + "wxID_ANY" + -1 + "Choose One" "" - "Final Polylist" - 1 - "" - "" - "" + "" "" "" 0 1 - "<Any platform>" - "" - "" - "" - "" - "" - "" - "" - 0 - 0 - 0 - 0 - 0 - "" - -1 - -1 - -1 - -1 + "wxStaticBox" + "Vertical" "Centre" - "Centre" + "Bottom" 0 5 1 @@ -649,59 +695,206 @@ 0 0 0 - "" - "" + "<Any platform>" + + "wxRadioButton: ID_RADIOBUTTON" + "dialog-control-document" + "" + "radiobutton" + 0 + 1 + 0 + 0 + "wbRadioButtonProxy" + "ID_RADIOBUTTON" + 10005 + "" + "wxRadioButton" + "wxRadioButton" + 1 + 0 + "" + "" + "" + "Final Polylist" + 1 + "" + "" + "" + "" + "" + 0 + 1 + "<Any platform>" + "" + "" + "" + "" + "" + "" + "" + 0 + 0 + 0 + 0 + 0 + "" + -1 + -1 + -1 + -1 + "Centre" + "Centre" + 0 + 5 + 1 + 1 + 1 + 1 + 0 + 0 + 0 + "" + "" + + + "wxRadioButton: ID_RADIOBUTTON1" + "dialog-control-document" + "" + "radiobutton" + 0 + 1 + 0 + 0 + "wbRadioButtonProxy" + "ID_RADIOBUTTON1" + 10006 + "" + "wxRadioButton" + "wxRadioButton" + 1 + 0 + "" + "" + "" + "User Polylist" + 0 + "" + "" + "" + "" + "" + 0 + 0 + "<Any platform>" + "" + "" + "" + "" + "" + "" + "" + 0 + 0 + 0 + 0 + 0 + "" + -1 + -1 + -1 + -1 + "Centre" + "Centre" + 0 + 5 + 1 + 1 + 1 + 1 + 0 + 0 + 0 + "" + "" + + + "wxRadioButton: ID_RADIOBUTTON2" + "dialog-control-document" + "" + "radiobutton" + 0 + 1 + 0 + 0 + "wbRadioButtonProxy" + "ID_RADIOBUTTON2" + 10007 + "" + "wxRadioButton" + "wxRadioButton" + 1 + 0 + "" + "" + "" + "Display List" + 0 + "" + "" + "" + "" + "" + 0 + 0 + "<Any platform>" + "" + "" + "" + "" + "" + "" + "" + 0 + 0 + 0 + 0 + 0 + "" + -1 + -1 + -1 + -1 + "Centre" + "Centre" + 0 + 5 + 1 + 1 + 1 + 1 + 0 + 0 + 0 + "" + "" + - "wxRadioButton: ID_RADIOBUTTON1" + "Spacer" "dialog-control-document" "" - "radiobutton" + "spacer" 0 1 0 0 - "wbRadioButtonProxy" - "ID_RADIOBUTTON1" - 10006 - "" - "wxRadioButton" - "wxRadioButton" - 1 - 0 - "" - "" - "" - "User Polylist" - 0 - "" - "" - "" - "" - "" - 0 - 0 - "<Any platform>" - "" - "" - "" - "" - "" - "" - "" - 0 - 0 - 0 - 0 - 0 - "" - -1 - -1 - -1 - -1 + "wbSpacerProxy" + 5 + 5 "Centre" "Centre" - 0 + 1 5 1 1 @@ -710,57 +903,30 @@ 0 0 0 - "" - "" + "<Any platform>" - "wxRadioButton: ID_RADIOBUTTON2" + "wxStaticBoxSizer V" "dialog-control-document" "" - "radiobutton" + "sizer" 0 1 0 0 - "wbRadioButtonProxy" - "ID_RADIOBUTTON2" - 10007 - "" - "wxRadioButton" - "wxRadioButton" - 1 - 0 - "" - "" + "wbStaticBoxSizerProxy" + "wxID_ANY" + -1 + "Statistics" "" - "Display List" - 0 - "" - "" - "" + "" "" "" 0 - 0 - "<Any platform>" - "" - "" - "" - "" - "" - "" - "" - 0 - 0 - 0 - 0 - 0 - "" - -1 - -1 - -1 - -1 - "Centre" + 1 + "wxStaticBox" + "Vertical" + "Expand" "Centre" 0 5 @@ -771,8 +937,147 @@ 0 0 0 - "" - "" + "<Any platform>" + + "wxStaticText: wxID_STATIC" + "dialog-control-document" + "" + "statictext" + 0 + 1 + 0 + 0 + "wbStaticTextProxy" + "wxID_STATIC" + 5105 + "" + "wxStaticText" + "wxStaticText" + 1 + 0 + "" + "" + "labelUserPolycount" + "User Polys" + -1 + "" + "" + "" + "" + "" + 0 + 1 + "<Any platform>" + "" + "" + "" + "" + "" + "" + "" + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + "" + -1 + -1 + -1 + -1 + "Left" + "Centre" + 0 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + 0 + "" + "" + + + "wxStaticText: wxID_STATIC" + "dialog-control-document" + "" + "statictext" + 0 + 1 + 0 + 0 + "wbStaticTextProxy" + "wxID_STATIC" + 5105 + "" + "wxStaticText" + "wxStaticText" + 1 + 0 + "" + "" + "labelFinalPolycount" + "Final Polys: " + -1 + "" + "" + "" + "" + "" + 0 + 1 + "<Any platform>" + "" + "" + "" + "" + "" + "" + "" + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + "" + -1 + -1 + -1 + -1 + "Left" + "Centre" + 0 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + 0 + "" + "" + @@ -831,7 +1136,7 @@ 0 - "wxListCtrl: ID_LISTCTRL" + "wxDesmumeListCtrl: ID_DESMUMELISTCTRL1" "dialog-control-document" "" "listctrl" @@ -840,16 +1145,16 @@ 0 0 "wbListCtrlProxy" - "ID_LISTCTRL" - 10002 + "ID_DESMUMELISTCTRL1" + 10009 "" - "wxListCtrl" + "wxDesmumeListCtrl" "wxListCtrl" - 1 + 0 0 "" "" - "" + "listPolys" "" "" "" @@ -869,7 +1174,7 @@ 1 0 0 - 0 + 1 0 0 0 @@ -932,7 +1237,7 @@ 0 "" "" - "" + "tree" "" "" "" @@ -950,13 +1255,13 @@ "" 0 0 - 0 + 1 0 0 0 0 - 0 - 0 + 1 + 1 0 1 0 diff --git a/desmume/src/wxdlg/wxdlg3dViewer.cpp b/desmume/src/wxdlg/wxdlg3dViewer.cpp index c7a091498..5adf398eb 100644 --- a/desmume/src/wxdlg/wxdlg3dViewer.cpp +++ b/desmume/src/wxdlg/wxdlg3dViewer.cpp @@ -68,6 +68,8 @@ wxdlg3dViewer::wxdlg3dViewer( wxWindow* parent, wxWindowID id, const wxString& c { Init(); Create(parent, id, caption, pos, size, style); + listPolys->callbacks = this; + listPolys->InsertColumn(0,"polys"); } @@ -112,6 +114,10 @@ void wxdlg3dViewer::Init() ////@begin wxdlg3dViewer member initialisation checkMaterialInterpolate = NULL; panelViewport = NULL; + labelUserPolycount = NULL; + labelFinalPolycount = NULL; + listPolys = NULL; + tree = NULL; ////@end wxdlg3dViewer member initialisation } @@ -123,8 +129,6 @@ void wxdlg3dViewer::Init() void wxdlg3dViewer::CreateControls() { ////@begin wxdlg3dViewer content construction - // Generated by DialogBlocks, 14/12/2009 20:51:53 (unregistered) - wxdlg3dViewer* itemDialog1 = this; wxFlexGridSizer* itemFlexGridSizer2 = new wxFlexGridSizer(1, 0, 0, 0); @@ -135,51 +139,75 @@ void wxdlg3dViewer::CreateControls() itemFlexGridSizer2->AddGrowableCol(4); itemDialog1->SetSizer(itemFlexGridSizer2); - wxStaticBox* itemStaticBoxSizer3Static = new wxStaticBox(itemDialog1, wxID_ANY, _("Display optionsss")); - wxStaticBoxSizer* itemStaticBoxSizer3 = new wxStaticBoxSizer(itemStaticBoxSizer3Static, wxVERTICAL); - itemFlexGridSizer2->Add(itemStaticBoxSizer3, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5); + wxBoxSizer* itemBoxSizer3 = new wxBoxSizer(wxVERTICAL); + itemFlexGridSizer2->Add(itemBoxSizer3, 0, wxGROW|wxALIGN_TOP|wxALL, 5); + + wxStaticBox* itemStaticBoxSizer4Static = new wxStaticBox(itemDialog1, wxID_ANY, _("Display optionsss")); + wxStaticBoxSizer* itemStaticBoxSizer4 = new wxStaticBoxSizer(itemStaticBoxSizer4Static, wxVERTICAL); + itemBoxSizer3->Add(itemStaticBoxSizer4, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); checkMaterialInterpolate = new wxCheckBox( itemDialog1, ID_MATERIALINTERPOLATE, _("Material clip interpolation"), wxDefaultPosition, wxDefaultSize, 0 ); checkMaterialInterpolate->SetValue(false); - itemStaticBoxSizer3->Add(checkMaterialInterpolate, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); + itemStaticBoxSizer4->Add(checkMaterialInterpolate, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); - wxCheckBox* itemCheckBox5 = new wxCheckBox( itemDialog1, ID_CHECKBOX1, _("Something else"), wxDefaultPosition, wxDefaultSize, 0 ); - itemCheckBox5->SetValue(false); - itemStaticBoxSizer3->Add(itemCheckBox5, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); + wxCheckBox* itemCheckBox6 = new wxCheckBox( itemDialog1, ID_CHECKBOX1, _("Something else"), wxDefaultPosition, wxDefaultSize, 0 ); + itemCheckBox6->SetValue(false); + itemStaticBoxSizer4->Add(itemCheckBox6, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); - panelViewport = new wxPanel( itemDialog1, ID_PANEL, wxDefaultPosition, wxSize(512, 384), wxSUNKEN_BORDER|wxTAB_TRAVERSAL ); + itemBoxSizer3->Add(5, 5, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); + + wxFlexGridSizer* itemFlexGridSizer8 = new wxFlexGridSizer(0, 2, 0, 0); + itemBoxSizer3->Add(itemFlexGridSizer8, 1, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); + + panelViewport = new wxWindow( itemDialog1, ID_VIEWPORT, wxDefaultPosition, wxSize(256, 192), wxSIMPLE_BORDER ); itemFlexGridSizer2->Add(panelViewport, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5); - wxStaticBox* itemStaticBoxSizer7Static = new wxStaticBox(itemDialog1, wxID_ANY, _("Choose One")); - wxStaticBoxSizer* itemStaticBoxSizer7 = new wxStaticBoxSizer(itemStaticBoxSizer7Static, wxVERTICAL); - itemFlexGridSizer2->Add(itemStaticBoxSizer7, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_TOP|wxALL, 5); + wxFlexGridSizer* itemFlexGridSizer10 = new wxFlexGridSizer(3, 1, 0, 0); + itemFlexGridSizer10->AddGrowableRow(1); + itemFlexGridSizer2->Add(itemFlexGridSizer10, 1, wxALIGN_CENTER_HORIZONTAL|wxGROW|wxALL, 5); - wxRadioButton* itemRadioButton8 = new wxRadioButton( itemDialog1, ID_RADIOBUTTON, _("Final Polylist"), wxDefaultPosition, wxDefaultSize, 0 ); - itemRadioButton8->SetValue(true); - itemStaticBoxSizer7->Add(itemRadioButton8, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); + wxStaticBox* itemStaticBoxSizer11Static = new wxStaticBox(itemDialog1, wxID_ANY, _("Choose One")); + wxStaticBoxSizer* itemStaticBoxSizer11 = new wxStaticBoxSizer(itemStaticBoxSizer11Static, wxVERTICAL); + itemFlexGridSizer10->Add(itemStaticBoxSizer11, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_BOTTOM|wxALL, 5); - wxRadioButton* itemRadioButton9 = new wxRadioButton( itemDialog1, ID_RADIOBUTTON1, _("User Polylist"), wxDefaultPosition, wxDefaultSize, 0 ); - itemRadioButton9->SetValue(false); - itemRadioButton9->Enable(false); - itemStaticBoxSizer7->Add(itemRadioButton9, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); + wxRadioButton* itemRadioButton12 = new wxRadioButton( itemDialog1, ID_RADIOBUTTON, _("Final Polylist"), wxDefaultPosition, wxDefaultSize, 0 ); + itemRadioButton12->SetValue(true); + itemStaticBoxSizer11->Add(itemRadioButton12, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); - wxRadioButton* itemRadioButton10 = new wxRadioButton( itemDialog1, ID_RADIOBUTTON2, _("Display List"), wxDefaultPosition, wxDefaultSize, 0 ); - itemRadioButton10->SetValue(false); - itemRadioButton10->Enable(false); - itemStaticBoxSizer7->Add(itemRadioButton10, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); + wxRadioButton* itemRadioButton13 = new wxRadioButton( itemDialog1, ID_RADIOBUTTON1, _("User Polylist"), wxDefaultPosition, wxDefaultSize, 0 ); + itemRadioButton13->SetValue(false); + itemRadioButton13->Enable(false); + itemStaticBoxSizer11->Add(itemRadioButton13, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); - wxStaticLine* itemStaticLine11 = new wxStaticLine( itemDialog1, wxID_STATIC, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); - itemFlexGridSizer2->Add(itemStaticLine11, 0, wxALIGN_CENTER_HORIZONTAL|wxGROW|wxALL, 5); + wxRadioButton* itemRadioButton14 = new wxRadioButton( itemDialog1, ID_RADIOBUTTON2, _("Display List"), wxDefaultPosition, wxDefaultSize, 0 ); + itemRadioButton14->SetValue(false); + itemRadioButton14->Enable(false); + itemStaticBoxSizer11->Add(itemRadioButton14, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); - wxListCtrl* itemListCtrl12 = new wxListCtrl( itemDialog1, ID_LISTCTRL, wxDefaultPosition, wxDefaultSize, wxLC_REPORT ); - itemFlexGridSizer2->Add(itemListCtrl12, 0, wxALIGN_CENTER_HORIZONTAL|wxGROW|wxALL, 5); + itemFlexGridSizer10->Add(5, 5, 1, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5); - wxTreeCtrl* itemTreeCtrl13 = new wxTreeCtrl( itemDialog1, ID_TREECTRL, wxDefaultPosition, wxSize(99, 99), wxTR_SINGLE ); - itemFlexGridSizer2->Add(itemTreeCtrl13, 0, wxALIGN_CENTER_HORIZONTAL|wxGROW|wxALL, 5); + wxStaticBox* itemStaticBoxSizer16Static = new wxStaticBox(itemDialog1, wxID_ANY, _("Statistics")); + wxStaticBoxSizer* itemStaticBoxSizer16 = new wxStaticBoxSizer(itemStaticBoxSizer16Static, wxVERTICAL); + itemFlexGridSizer10->Add(itemStaticBoxSizer16, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5); + + labelUserPolycount = new wxStaticText( itemDialog1, wxID_STATIC, _("User Polys"), wxDefaultPosition, wxDefaultSize, 0 ); + itemStaticBoxSizer16->Add(labelUserPolycount, 0, wxALIGN_LEFT|wxALL, 1); + + labelFinalPolycount = new wxStaticText( itemDialog1, wxID_STATIC, _("Final Polys: "), wxDefaultPosition, wxDefaultSize, 0 ); + itemStaticBoxSizer16->Add(labelFinalPolycount, 0, wxALIGN_LEFT|wxALL, 1); + + wxStaticLine* itemStaticLine19 = new wxStaticLine( itemDialog1, wxID_STATIC, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); + itemFlexGridSizer2->Add(itemStaticLine19, 0, wxALIGN_CENTER_HORIZONTAL|wxGROW|wxALL, 5); + + listPolys = new wxDesmumeListCtrl( itemDialog1, ID_DESMUMELISTCTRL1, wxDefaultPosition, wxDefaultSize, wxLC_REPORT|wxLC_VIRTUAL ); + itemFlexGridSizer2->Add(listPolys, 0, wxALIGN_CENTER_HORIZONTAL|wxGROW|wxALL, 5); + + tree = new wxTreeCtrl( itemDialog1, ID_TREECTRL, wxDefaultPosition, wxSize(99, 99), wxTR_HAS_BUTTONS |wxTR_HIDE_ROOT|wxTR_ROW_LINES|wxTR_SINGLE ); + itemFlexGridSizer2->Add(tree, 0, wxALIGN_CENTER_HORIZONTAL|wxGROW|wxALL, 5); // Connect events and objects - panelViewport->Connect(ID_PANEL, wxEVT_PAINT, wxPaintEventHandler(wxdlg3dViewer::OnPanelPaint), NULL, this); - panelViewport->Connect(ID_PANEL, wxEVT_ERASE_BACKGROUND, wxEraseEventHandler(wxdlg3dViewer::OnPanelEraseBackground), NULL, this); + panelViewport->Connect(ID_VIEWPORT, wxEVT_PAINT, wxPaintEventHandler(wxdlg3dViewer::OnPanelPaint), NULL, this); + panelViewport->Connect(ID_VIEWPORT, wxEVT_ERASE_BACKGROUND, wxEraseEventHandler(wxdlg3dViewer::OnPanelEraseBackground), NULL, this); ////@end wxdlg3dViewer content construction } @@ -262,3 +290,87 @@ void wxdlg3dViewer::OnPanelEraseBackground( wxEraseEvent& event ) //blank to block background clearing } + + +/* + * wxDesmumeListCtrl type definition + */ + +IMPLEMENT_DYNAMIC_CLASS( wxDesmumeListCtrl, wxListCtrl ) + + +/* + * wxDesmumeListCtrl event table definition + */ + +BEGIN_EVENT_TABLE( wxDesmumeListCtrl, wxListCtrl ) + +////@begin wxDesmumeListCtrl event table entries +////@end wxDesmumeListCtrl event table entries + +END_EVENT_TABLE() + + +/* + * wxDesmumeListCtrl constructors + */ + +wxDesmumeListCtrl::wxDesmumeListCtrl() +{ + Init(); +} + +wxDesmumeListCtrl::wxDesmumeListCtrl(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxValidator& validator) +{ + Init(); + Create(parent, id, pos, size, style, validator); +} + + +/* + * wxDesmumeListCtrl creator + */ + +bool wxDesmumeListCtrl::Create(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxValidator& validator) +{ +////@begin wxDesmumeListCtrl creation + wxListCtrl::Create(parent, id, pos, size, style, validator); + CreateControls(); +////@end wxDesmumeListCtrl creation + return true; +} + + +/* + * wxDesmumeListCtrl destructor + */ + +wxDesmumeListCtrl::~wxDesmumeListCtrl() +{ +////@begin wxDesmumeListCtrl destruction +////@end wxDesmumeListCtrl destruction +} + + +/* + * Member initialisation + */ + +void wxDesmumeListCtrl::Init() +{ +////@begin wxDesmumeListCtrl member initialisation +////@end wxDesmumeListCtrl member initialisation +} + + +/* + * Control creation for wxDesmumeListCtrl + */ + +void wxDesmumeListCtrl::CreateControls() +{ +////@begin wxDesmumeListCtrl content construction +////@end wxDesmumeListCtrl content construction +} + + diff --git a/desmume/src/wxdlg/wxdlg3dViewer.h b/desmume/src/wxdlg/wxdlg3dViewer.h index a8c541ce8..dd7155d0c 100644 --- a/desmume/src/wxdlg/wxdlg3dViewer.h +++ b/desmume/src/wxdlg/wxdlg3dViewer.h @@ -25,11 +25,21 @@ #include "wx/treectrl.h" ////@end includes +class IListCtrlCallbacks +{ +public: + virtual wxString OnGetItemText(const wxListCtrl* list, long item, long column) const = 0; +}; + + /*! * Forward declarations */ ////@begin forward declarations +class wxWindow; +class wxDesmumeListCtrl; +class wxTreeCtrl; ////@end forward declarations /*! @@ -40,17 +50,21 @@ #define ID_X 10000 #define ID_MATERIALINTERPOLATE 10004 #define ID_CHECKBOX1 10008 -#define ID_PANEL 10001 +#define ID_VIEWPORT 10002 #define ID_RADIOBUTTON 10005 #define ID_RADIOBUTTON1 10006 #define ID_RADIOBUTTON2 10007 -#define ID_LISTCTRL 10002 +#define ID_DESMUMELISTCTRL1 10009 #define ID_TREECTRL 10003 #define SYMBOL_WXDLG3DVIEWER_STYLE wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU|wxDIALOG_NO_PARENT|wxCLOSE_BOX|wxTAB_TRAVERSAL #define SYMBOL_WXDLG3DVIEWER_TITLE _("3D Viewer") #define SYMBOL_WXDLG3DVIEWER_IDNAME ID_X -#define SYMBOL_WXDLG3DVIEWER_SIZE wxSize(399, 299) +#define SYMBOL_WXDLG3DVIEWER_SIZE wxSize(399, 300) #define SYMBOL_WXDLG3DVIEWER_POSITION wxDefaultPosition +#define SYMBOL_WXDESMUMELISTCTRL_STYLE wxLC_REPORT|wxLC_VIRTUAL +#define SYMBOL_WXDESMUMELISTCTRL_IDNAME ID_DESMUMELISTCTRL1 +#define SYMBOL_WXDESMUMELISTCTRL_SIZE wxDefaultSize +#define SYMBOL_WXDESMUMELISTCTRL_POSITION wxDefaultPosition ////@end control identifiers @@ -58,7 +72,7 @@ * wxdlg3dViewer class declaration */ -class wxdlg3dViewer: public wxDialog +class wxdlg3dViewer: public wxDialog, public IListCtrlCallbacks { DECLARE_DYNAMIC_CLASS( wxdlg3dViewer ) DECLARE_EVENT_TABLE() @@ -80,6 +94,9 @@ public: /// Creates the controls and sizers void CreateControls(); + virtual wxString OnGetItemText(const wxListCtrl* list, long item, long column) const { + return ""; + } virtual void RepaintPanel() {} virtual void _OnPaintPanel( wxPaintEvent& event ) {}; @@ -91,10 +108,10 @@ public: /// wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_MATERIALINTERPOLATE void OnMaterialInterpolateClick( wxCommandEvent& event ); - /// wxEVT_PAINT event handler for ID_PANEL + /// wxEVT_PAINT event handler for ID_VIEWPORT void OnPanelPaint( wxPaintEvent& event ); - /// wxEVT_ERASE_BACKGROUND event handler for ID_PANEL + /// wxEVT_ERASE_BACKGROUND event handler for ID_VIEWPORT void OnPanelEraseBackground( wxEraseEvent& event ); ////@end wxdlg3dViewer event handler declarations @@ -113,9 +130,57 @@ public: ////@begin wxdlg3dViewer member variables wxCheckBox* checkMaterialInterpolate; - wxPanel* panelViewport; + wxWindow* panelViewport; + wxStaticText* labelUserPolycount; + wxStaticText* labelFinalPolycount; + wxDesmumeListCtrl* listPolys; + wxTreeCtrl* tree; ////@end wxdlg3dViewer member variables }; +/*! + * wxDesmumeListCtrl class declaration + */ + +class wxDesmumeListCtrl: public wxListCtrl +{ + DECLARE_DYNAMIC_CLASS( wxDesmumeListCtrl ) + DECLARE_EVENT_TABLE() + +public: + IListCtrlCallbacks* callbacks; + + virtual wxString OnGetItemText(long item, long column) const { + return callbacks->OnGetItemText(this,item,column); + } + + /// Constructors + wxDesmumeListCtrl(); + wxDesmumeListCtrl(wxWindow* parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxLC_ICON, const wxValidator& validator = wxDefaultValidator); + + /// Creation + bool Create(wxWindow* parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxLC_ICON, const wxValidator& validator = wxDefaultValidator); + + /// Destructor + ~wxDesmumeListCtrl(); + + /// Initialises member variables + void Init(); + + /// Creates the controls and sizers + void CreateControls(); + +////@begin wxDesmumeListCtrl event handler declarations + +////@end wxDesmumeListCtrl event handler declarations + +////@begin wxDesmumeListCtrl member function declarations + +////@end wxDesmumeListCtrl member function declarations + +////@begin wxDesmumeListCtrl member variables +////@end wxDesmumeListCtrl member variables +}; + #endif // _X_H_