diff --git a/CMakeLists.txt b/CMakeLists.txt index ba680ba..4f8c510 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -30,6 +30,7 @@ endif() set(wxBUILD_INSTALL OFF CACHE BOOL "skip") set(wxBUILD_SHARED OFF CACHE BOOL "skip") set(wxBUILD_USE_STATIC_RUNTIME ON CACHE BOOL "skip") +set(wxUSE_LIBWEBP OFF CACHE BOOL "skip") set(wxUSE_MEDIACTRL OFF CACHE BOOL "skip") set(wxUSE_POSTSCRIPT OFF CACHE BOOL "skip") set(wxUSE_STC OFF CACHE BOOL "skip") diff --git a/GM/CBDesign.fbp b/GM/CBDesign.fbp index 52d892b..ad6e88a 100644 --- a/GM/CBDesign.fbp +++ b/GM/CBDesign.fbp @@ -5932,7 +5932,7 @@ - wxBORDER_SIMPLE|wxTAB_TRAVERSAL|wxWANTS_CHARS + wxBORDER_SIMPLE|wxWANTS_CHARS @@ -6295,7 +6295,7 @@ - wxBORDER_SIMPLE|wxTAB_TRAVERSAL|wxWANTS_CHARS + wxBORDER_SIMPLE|wxWANTS_CHARS @@ -6354,7 +6354,7 @@ - wxBORDER_SIMPLE|wxTAB_TRAVERSAL|wxWANTS_CHARS + wxBORDER_SIMPLE|wxWANTS_CHARS @@ -6413,7 +6413,7 @@ - wxBORDER_SIMPLE|wxTAB_TRAVERSAL|wxWANTS_CHARS + wxBORDER_SIMPLE|wxWANTS_CHARS @@ -9110,7 +9110,7 @@ - wxBORDER_SIMPLE|wxTAB_TRAVERSAL|wxWANTS_CHARS + wxBORDER_SIMPLE|wxWANTS_CHARS @@ -9242,7 +9242,7 @@ - wxBORDER_SIMPLE|wxTAB_TRAVERSAL|wxWANTS_CHARS + wxBORDER_SIMPLE|wxWANTS_CHARS @@ -9836,7 +9836,7 @@ - wxBORDER_SIMPLE|wxTAB_TRAVERSAL|wxWANTS_CHARS + wxBORDER_SIMPLE|wxWANTS_CHARS @@ -9968,7 +9968,7 @@ - wxBORDER_SIMPLE|wxTAB_TRAVERSAL|wxWANTS_CHARS + wxBORDER_SIMPLE|wxWANTS_CHARS @@ -13251,7 +13251,7 @@ - wxBORDER_SIMPLE|wxTAB_TRAVERSAL|wxWANTS_CHARS + wxBORDER_SIMPLE|wxWANTS_CHARS @@ -13451,7 +13451,7 @@ - wxBORDER_SIMPLE|wxTAB_TRAVERSAL|wxWANTS_CHARS + wxBORDER_SIMPLE|wxWANTS_CHARS @@ -13583,7 +13583,7 @@ - wxBORDER_SIMPLE|wxTAB_TRAVERSAL|wxWANTS_CHARS + wxBORDER_SIMPLE|wxWANTS_CHARS @@ -15952,7 +15952,7 @@ - wxBORDER_SIMPLE|wxTAB_TRAVERSAL|wxWANTS_CHARS + wxBORDER_SIMPLE|wxWANTS_CHARS @@ -16011,7 +16011,7 @@ - wxBORDER_SIMPLE|wxTAB_TRAVERSAL|wxWANTS_CHARS + wxBORDER_SIMPLE|wxWANTS_CHARS @@ -16923,7 +16923,7 @@ - wxBORDER_SIMPLE|wxTAB_TRAVERSAL|wxWANTS_CHARS + wxBORDER_SIMPLE|wxWANTS_CHARS @@ -19841,7 +19841,7 @@ - wxBORDER_SIMPLE|wxTAB_TRAVERSAL|wxWANTS_CHARS + wxBORDER_SIMPLE|wxWANTS_CHARS diff --git a/GM/CBDesign.xrc b/GM/CBDesign.xrc index fee6757..c71d01b 100644 --- a/GM/CBDesign.xrc +++ b/GM/CBDesign.xrc @@ -1074,7 +1074,7 @@ 5 - + @@ -1146,7 +1146,7 @@ 5 - + 1 @@ -1155,7 +1155,7 @@ 5 - + 1 @@ -1164,7 +1164,7 @@ 5 - + 1 @@ -1660,7 +1660,7 @@ 5 - + @@ -1685,7 +1685,7 @@ 5 - + @@ -1796,7 +1796,7 @@ 5 - + @@ -1821,7 +1821,7 @@ 5 - + @@ -2452,7 +2452,7 @@ 5 - + @@ -2486,7 +2486,7 @@ 5 - + @@ -2511,7 +2511,7 @@ 5 - + @@ -2958,7 +2958,7 @@ 5 - + @@ -2966,7 +2966,7 @@ 5 - + @@ -3137,7 +3137,7 @@ 5 - + @@ -3729,7 +3729,7 @@ 5 - + diff --git a/GM/DlgBrdp.h b/GM/DlgBrdp.h index 33ab089..efd7d98 100644 --- a/GM/DlgBrdp.h +++ b/GM/DlgBrdp.h @@ -34,36 +34,6 @@ class CBoardPropDialog : public wxDialog CBoardPropDialog(wxWindow* parent = &CB::GetMainWndWx()); // standard constructor // Dialog Data -private: - CB_XRC_BEGIN_CTRLS_DECL() - RefPtr m_staticHalfPixelWidth; - RefPtr m_staticSmallPixelWidth; - RefPtr m_staticSmallPixelHeight; - RefPtr m_staticHalfPixelHeight; - RefPtr m_staticPixelWidth; - RefPtr m_staticPixelHeight; - RefPtr m_editBrdName; - RefPtr m_cpCellFrame; - RefPtr m_staticWidth; - RefPtr m_staticHeight; - RefPtr m_staticRows; - RefPtr m_staticCols; - RefPtr m_comboStyle; - RefPtr m_chkCellLines; - RefPtr m_chkGridSnap; - RefPtr m_chkTrackCellNum; - RefPtr m_editRowTrkOffset; - RefPtr m_editColTrkOffset; - RefPtr m_editXGridSnapOff; - RefPtr m_editYGridSnapOff; - RefPtr m_editXGridSnap; - RefPtr m_editYGridSnap; - RefPtr m_chkColTrkInvert; - RefPtr m_chkRowTrkInvert; - RefPtr m_chkCellBorderOnTop; - RefPtr m_chkEnableXParentCells; - CB_XRC_END_CTRLS_DECL() -public: bool m_bCellLines; bool m_bGridSnap; bool m_bTrackCellNum; @@ -97,6 +67,36 @@ class CBoardPropDialog : public wxDialog uint32_t m_nCellHt; uint32_t m_nCellWd; CellStagger m_bStagger; +private: + CB_XRC_BEGIN_CTRLS_DECL() + RefPtr m_staticHalfPixelWidth; + RefPtr m_staticSmallPixelWidth; + RefPtr m_staticSmallPixelHeight; + RefPtr m_staticHalfPixelHeight; + RefPtr m_staticPixelWidth; + RefPtr m_staticPixelHeight; + RefPtr m_editBrdName; + RefPtr m_cpCellFrame; + RefPtr m_staticWidth; + RefPtr m_staticHeight; + RefPtr m_staticRows; + RefPtr m_staticCols; + RefPtr m_comboStyle; + RefPtr m_chkCellLines; + RefPtr m_chkGridSnap; + RefPtr m_chkTrackCellNum; + RefPtr m_editRowTrkOffset; + RefPtr m_editColTrkOffset; + RefPtr m_editXGridSnapOff; + RefPtr m_editYGridSnapOff; + RefPtr m_editXGridSnap; + RefPtr m_editYGridSnap; + RefPtr m_chkColTrkInvert; + RefPtr m_chkRowTrkInvert; + RefPtr m_chkCellBorderOnTop; + RefPtr m_chkEnableXParentCells; + CB_XRC_END_CTRLS_DECL() +public: // Implementation protected: diff --git a/GM/DlgBrdsz.h b/GM/DlgBrdsz.h index 3edf06e..802762c 100644 --- a/GM/DlgBrdsz.h +++ b/GM/DlgBrdsz.h @@ -34,7 +34,15 @@ class CBoardReshapeDialog : public wxDialog CBoardReshapeDialog(wxWindow* parent = &CB::GetMainWndWx()); // standard constructor // Dialog Data + uint32_t m_nCellHt; + uint32_t m_nCellWd; + size_t m_nCols; + size_t m_nRows; + CellStagger m_bStagger; + + CellFormType m_eCellStyle; // Used to disable cell a cell dimension private: + bool m_bStaggerAdapter; CB_XRC_BEGIN_CTRLS_DECL() RefPtr m_checkStaggerIn; RefPtr m_editCellWd; @@ -42,15 +50,7 @@ class CBoardReshapeDialog : public wxDialog RefPtr m_editCols; RefPtr m_editRows; CB_XRC_END_CTRLS_DECL() - bool m_bStaggerAdapter; public: - uint32_t m_nCellHt; - uint32_t m_nCellWd; - size_t m_nCols; - size_t m_nRows; - CellStagger m_bStagger; - - CellFormType m_eCellStyle; // Used to disable cell a cell dimension // Implementation protected: diff --git a/GM/DlgGboxp.h b/GM/DlgGboxp.h index 8491ac1..8a5cfb8 100644 --- a/GM/DlgGboxp.h +++ b/GM/DlgGboxp.h @@ -55,13 +55,13 @@ class CGmBoxPropsDialog : public wxDialog wxDECLARE_EVENT_TABLE(); + // adapt between m_nCompressLevel and m_comboCompress + int32_t m_nCompressLevelIndex; + CB_XRC_BEGIN_CTRLS_DECL() RefPtr m_comboCompress; RefPtr m_editAuthor; RefPtr m_editTitle; RefPtr m_editDescr; CB_XRC_END_CTRLS_DECL() - - // adapt between m_nCompressLevel and m_comboCompress - int m_nCompressLevelIndex; }; diff --git a/GM/DlgMEditMulti.h b/GM/DlgMEditMulti.h index 540e116..fd9a703 100644 --- a/GM/DlgMEditMulti.h +++ b/GM/DlgMEditMulti.h @@ -39,6 +39,10 @@ class CMarkerEditMultipleDialog : public wxDialog CMarkerEditMultipleDialog(wxWindow* parent = &CB::GetMainWndWx()); // standard constructor // Dialog Data + wxCheckBoxState m_bPromptForText; + + bool m_bSetText; + wxString m_strText; private: CB_XRC_BEGIN_CTRLS_DECL() RefPtr m_chkSetText; @@ -48,10 +52,6 @@ class CMarkerEditMultipleDialog : public wxDialog CB_XRC_END_CTRLS_DECL() public: - wxCheckBoxState m_bPromptForText; - - bool m_bSetText; - wxString m_strText; // Overrides protected: diff --git a/GM/DlgMakts.h b/GM/DlgMakts.h index e866897..a8f6983 100644 --- a/GM/DlgMakts.h +++ b/GM/DlgMakts.h @@ -29,12 +29,12 @@ class CCreateTSet : public wxDialog CCreateTSet(wxWindow* parent = &CB::GetMainWndWx()); // standard constructor // Dialog Data + wxString m_strTSName; private: CB_XRC_BEGIN_CTRLS_DECL() RefPtr m_editTSName; CB_XRC_END_CTRLS_DECL() public: - wxString m_strTSName; // Implementation protected: diff --git a/GM/DlgMgrpn.h b/GM/DlgMgrpn.h index 6118f2b..2e3aada 100644 --- a/GM/DlgMgrpn.h +++ b/GM/DlgMgrpn.h @@ -32,10 +32,10 @@ class CMarkGroupNewDialog : public wxDialog CMarkGroupNewDialog(wxWindow* parent = &CB::GetMainWndWx()); // standard constructor // Dialog Data +public: + wxString m_strName; private: CB_XRC_BEGIN_CTRLS_DECL() RefPtr m_editName; CB_XRC_END_CTRLS_DECL() -public: - wxString m_strName; }; diff --git a/GM/DlgMkbrd.h b/GM/DlgMkbrd.h index 3c20b68..547d829 100644 --- a/GM/DlgMkbrd.h +++ b/GM/DlgMkbrd.h @@ -29,7 +29,15 @@ class CGridType : public wxDialog CGridType(wxWindow* parent = &CB::GetMainWndWx()); // standard constructor // Dialog Data + int m_iCellWd; + int m_iCellHt; + size_t m_iCols; + size_t m_iRows; + wxString m_strBoardName; + CellStagger m_bStagger; + CellFormType m_nBoardType; private: + int m_nBoardTypeHelper; CB_XRC_BEGIN_CTRLS_DECL() RefPtr m_staticPixelSize; RefPtr m_chkStagger; @@ -40,15 +48,7 @@ class CGridType : public wxDialog RefPtr m_radioRect; RefPtr m_editBoardName; CB_XRC_END_CTRLS_DECL() - int m_nBoardTypeHelper; public: - int m_iCellWd; - int m_iCellHt; - size_t m_iCols; - size_t m_iRows; - wxString m_strBoardName; - CellStagger m_bStagger; - CellFormType m_nBoardType; // Implementation protected: diff --git a/GM/DlgMrkp.h b/GM/DlgMrkp.h index c42b4b0..8c9d3bf 100644 --- a/GM/DlgMrkp.h +++ b/GM/DlgMrkp.h @@ -35,15 +35,15 @@ class CMarkerPropDialog : public wxDialog CMarkerPropDialog(wxWindow* parent = &CB::GetMainWndWx()); // standard constructor // Dialog Data + wxString m_strName; + MarkerTrayViz m_nMarkerViz; private: + int m_nMarkerVizHelper; CB_XRC_BEGIN_CTRLS_DECL() RefPtr m_editName; RefPtr m_radioMarkerViz; CB_XRC_END_CTRLS_DECL() - int m_nMarkerVizHelper; public: - wxString m_strName; - MarkerTrayViz m_nMarkerViz; // Implementation protected: diff --git a/GM/DlgNtile.h b/GM/DlgNtile.h index 14fabf4..9752e6b 100644 --- a/GM/DlgNtile.h +++ b/GM/DlgNtile.h @@ -34,13 +34,6 @@ class CNewTileDialog : public wxDialog CNewTileDialog(wxWindow* parent = &CB::GetMainWndWx()); // standard constructor // Dialog Data -private: - CB_XRC_BEGIN_CTRLS_DECL() - RefPtr m_editWidth; - RefPtr m_editHeight; - RefPtr m_comboBoard; - CB_XRC_END_CTRLS_DECL() -public: UINT m_nHeight; UINT m_nWidth; @@ -48,6 +41,13 @@ class CNewTileDialog : public wxDialog UINT m_nHalfWidth; CBoardManager* m_pBMgr; +private: + CB_XRC_BEGIN_CTRLS_DECL() + RefPtr m_editWidth; + RefPtr m_editHeight; + RefPtr m_comboBoard; + CB_XRC_END_CTRLS_DECL() +public: // Implementation protected: diff --git a/GM/DlgPEditMulti.h b/GM/DlgPEditMulti.h index a6d70e5..52a2b88 100644 --- a/GM/DlgPEditMulti.h +++ b/GM/DlgPEditMulti.h @@ -39,6 +39,12 @@ class CPieceEditMultipleDialog : public wxDialog CPieceEditMultipleDialog(size_t sides, wxWindow* parent = &CB::GetMainWndWx()); // standard constructor // Dialog Data + BOOL m_bSetTopOnlyVisible; // TRUE if m_bTopOnlyVisible changed + BOOL m_bTopOnlyVisible; + BOOL m_bTopOnlyOwnersToo; + + std::vector m_bSetTexts; // TRUE if text should change + std::vector m_strs; private: CB_XRC_BEGIN_CTRLS_DECL() RefPtr m_chkTopVisibleOwnersToo; @@ -56,12 +62,6 @@ class CPieceEditMultipleDialog : public wxDialog CB_XRC_END_CTRLS_DECL() public: - BOOL m_bSetTopOnlyVisible; // TRUE if m_bTopOnlyVisible changed - BOOL m_bTopOnlyVisible; - BOOL m_bTopOnlyOwnersToo; - - std::vector m_bSetTexts; // TRUE if text should change - std::vector m_strs; // Overrides protected: diff --git a/GM/DlgPaste.h b/GM/DlgPaste.h index df59ee7..cad1ae5 100644 --- a/GM/DlgPaste.h +++ b/GM/DlgPaste.h @@ -32,14 +32,14 @@ class CPasteBitmapDialog : public wxDialog CPasteBitmapDialog(wxWindow* parent = &CB::GetMainWndWx()); // standard constructor // Dialog Data + int m_nPasteAction; + private: CB_XRC_BEGIN_CTRLS_DECL() RefPtr m_radioPasteAction; CB_XRC_END_CTRLS_DECL() public: - int m_nPasteAction; - // Implementation protected: diff --git a/GM/DlgPcep.h b/GM/DlgPcep.h index 8c67db7..6a3efa6 100644 --- a/GM/DlgPcep.h +++ b/GM/DlgPcep.h @@ -32,11 +32,9 @@ class CPiecePropDialog : public wxDialog CPiecePropDialog(wxWindow* parent = &CB::GetMainWndWx()); // standard constructor // Dialog Data + wxString m_strName; private: CB_XRC_BEGIN_CTRLS_DECL() RefPtr m_editName; CB_XRC_END_CTRLS_DECL() - -public: - wxString m_strName; }; diff --git a/GM/DlgPgrpn.h b/GM/DlgPgrpn.h index a1e0e65..7c295fb 100644 --- a/GM/DlgPgrpn.h +++ b/GM/DlgPgrpn.h @@ -32,11 +32,9 @@ class CPieceGroupNameDialog : public wxDialog CPieceGroupNameDialog(wxWindow* parent = &CB::GetMainWndWx()); // standard constructor // Dialog Data + wxString m_strName; private: CB_XRC_BEGIN_CTRLS_DECL() RefPtr m_editName; CB_XRC_END_CTRLS_DECL() - -public: - wxString m_strName; }; diff --git a/GM/DlgPnew.h b/GM/DlgPnew.h index 87a0bf5..f4615b6 100644 --- a/GM/DlgPnew.h +++ b/GM/DlgPnew.h @@ -41,6 +41,7 @@ class CPieceNewDialog : public wxDialog // Dialog Data private: + size_t m_qty; CB_XRC_BEGIN_CTRLS_DECL() RefPtr m_chkTopOnlyOwnersToo; RefPtr m_chkTopOnlyVisible; @@ -61,7 +62,6 @@ class CPieceNewDialog : public wxDialog RefPtr m_side_1; RefPtr m_create; CB_XRC_END_CTRLS_DECL() - size_t m_qty; RefPtr m_pDoc; // Pointer to document const size_t m_nPSet; // Number of piece set diff --git a/GM/DlgSvisi.h b/GM/DlgSvisi.h index 0ad59c6..fa0524c 100644 --- a/GM/DlgSvisi.h +++ b/GM/DlgSvisi.h @@ -32,6 +32,10 @@ class CSetScaleVisibilityDialog : public wxDialog CSetScaleVisibilityDialog(wxWindow* parent = &CB::GetMainWndWx()); // standard constructor // Dialog Data + bool m_bFullScale; + bool m_bHalfScale; + bool m_bSmallScale; + bool m_bNaturalScale; private: CB_XRC_BEGIN_CTRLS_DECL() RefPtr m_chkNaturalScale; @@ -41,10 +45,6 @@ class CSetScaleVisibilityDialog : public wxDialog CB_XRC_END_CTRLS_DECL() public: - bool m_bFullScale; - bool m_bHalfScale; - bool m_bSmallScale; - bool m_bNaturalScale; // Implementation protected: diff --git a/GM/DlgTexto.h b/GM/DlgTexto.h index 1b4a5c1..1d71d4f 100644 --- a/GM/DlgTexto.h +++ b/GM/DlgTexto.h @@ -35,13 +35,6 @@ class CTextObjDialog : public wxDialog virtual ~CTextObjDialog(); // Dialog Data -private: - CB_XRC_BEGIN_CTRLS_DECL() - RefPtr m_btnTxtPropFont; - RefPtr m_editText; - CB_XRC_END_CTRLS_DECL() - -public: CFontTbl* m_pFontMgr; FontID m_fontID; // Current font. private: @@ -49,6 +42,13 @@ class CTextObjDialog : public wxDialog public: wxString m_strText; +private: + CB_XRC_BEGIN_CTRLS_DECL() + RefPtr m_btnTxtPropFont; + RefPtr m_editText; + CB_XRC_END_CTRLS_DECL() + +public: void SetFontID(FontID fontID); diff --git a/GM/DlgTilsz.h b/GM/DlgTilsz.h index 6edafbc..3d6504b 100644 --- a/GM/DlgTilsz.h +++ b/GM/DlgTilsz.h @@ -34,6 +34,13 @@ class CResizeTileDialog : public wxDialog CResizeTileDialog(wxWindow* parent = &CB::GetMainWndWx()); // standard constructor // Dialog Data + bool m_bRescaleBMaps; + UINT m_nWidth; + UINT m_nHeight; + + UINT m_nHalfHeight; // If 0, caller computes half size + UINT m_nHalfWidth; // If 0, caller computes half size + CBoardManager* m_pBMgr; private: CB_XRC_BEGIN_CTRLS_DECL() RefPtr m_editHeight; @@ -44,15 +51,6 @@ class CResizeTileDialog : public wxDialog RefPtr m_chkRescaleBMaps; CB_XRC_END_CTRLS_DECL() -public: - bool m_bRescaleBMaps; - UINT m_nWidth; - UINT m_nHeight; - - UINT m_nHalfHeight; // If 0, caller computes half size - UINT m_nHalfWidth; // If 0, caller computes half size - CBoardManager* m_pBMgr; - // Implementation protected: bool TransferDataToWindow() override; diff --git a/GM/DlgTsetp.h b/GM/DlgTsetp.h index b7f9972..a07ebc2 100644 --- a/GM/DlgTsetp.h +++ b/GM/DlgTsetp.h @@ -32,17 +32,15 @@ class CTSetPropDialog : public wxDialog CTSetPropDialog(wxWindow* parent = &CB::GetMainWndWx()); // Dialog Data + wxString m_strName; + + wxColour m_crTrans; private: CB_XRC_BEGIN_CTRLS_DECL() RefPtr m_cpTrans; RefPtr m_editName; CB_XRC_END_CTRLS_DECL() -public: - wxString m_strName; - - wxColour m_crTrans; - // Implementation protected: #if 0 diff --git a/GM/FrmBited.cpp b/GM/FrmBited.cpp index 34f0209..4b953c7 100644 --- a/GM/FrmBited.cpp +++ b/GM/FrmBited.cpp @@ -61,6 +61,9 @@ CBitEditFrame::CBitEditFrame(wxDocument& doc, retval->SetSashGravity(0.0); CTileSelView* pSelView = new CTileSelView(*retval, view, createParam); CBitEditView* pBitView = new CBitEditView(*retval, view); + // don't steal Ctrl-Tab from MDI client + wxASSERT(retval->HasFlag(wxTAB_TRAVERSAL)); + retval->ToggleWindowStyle(wxTAB_TRAVERSAL); if (!retval->SplitVertically(pSelView, pBitView, 90)) { AfxThrowMemoryException(); @@ -305,6 +308,7 @@ bool wxBitEditView::OnClose(bool /*deleteWindow*/) { /* doc's life determined by wxGbxProjView, not this, so bypass wxView::OnClose() */ + FileHistoryRemoveMenu(); return true; } @@ -318,6 +322,7 @@ bool wxBitEditView::OnCreate(wxDocument* doc, long flags) new CBitEditFrame(CheckedDeref(doc), *this, CheckedDeref(GetMainFrame())); + FileHistoryAddMenu(); /* wx tried to activate this before it was ready, so do it now */ ready = true; diff --git a/GM/FrmDockTile.cpp b/GM/FrmDockTile.cpp index 65699a9..e47154f 100644 --- a/GM/FrmDockTile.cpp +++ b/GM/FrmDockTile.cpp @@ -62,10 +62,6 @@ void CDockTilePalette::SetChild(CTilePalette* pChildWnd) m_pChildWnd->SetDockingFrame(NULL); Refresh(TRUE); } - // We need to set this field explicitly rather than - // using CDockablePane::SetChild() since this function - // insists that the window be non-NULL even though it's - // perfectly fine to be NULL! m_pChildWnd = pChildWnd; if (pChildWnd != NULL) { @@ -75,13 +71,14 @@ void CDockTilePalette::SetChild(CTilePalette* pChildWnd) Layout(); SetMinClientSize(m_pChildWnd->GetMinSize()); pane.BestSize(GetBestSize()). + FloatingClientSize(GetBestSize()). MinSize(GetMinSize()); } else { pane.Show(false); } - auiMgr.Update(); + GetMainFrame()->AuiScheduleUpdate(); } wxSize CDockTilePalette::DoGetBestClientSize() const diff --git a/GM/FrmMain.cpp b/GM/FrmMain.cpp index 47114e0..5f32a59 100644 --- a/GM/FrmMain.cpp +++ b/GM/FrmMain.cpp @@ -46,8 +46,8 @@ static char THIS_FILE[] = __FILE__; wxBEGIN_EVENT_TABLE(CMainFrame, wxDocParentFrameAny) #if 0 ON_WM_CREATE() - ON_WM_CLOSE() #endif + EVT_CLOSE(OnClose) EVT_MENU(XRCID("ID_WINDOW_TOOLPAL"), OnWindowToolPal) EVT_MENU(XRCID("ID_WINDOW_ITOOLPAL"), OnWindowIToolPal) EVT_MENU(XRCID("ID_WINDOW_COLORPAL"), OnWindowColorPal) @@ -235,6 +235,7 @@ CMainFrame::CMainFrame() : MinSize(m_wndColorPal->GetBestSize()). BestSize(m_wndColorPal->GetBestSize()). MaxSize(m_wndColorPal->GetBestSize()). + FloatingClientSize(m_wndColorPal->GetBestSize()). Right().Layer(0).Position(0). Hide()); @@ -243,12 +244,35 @@ CMainFrame::CMainFrame() : auiManager.AddPane(m_wndTilePal, wxAuiPaneInfo(). Name("CTilePalette").Caption("Tiles"_cbstring). BestSize(m_wndTilePal->GetBestSize()). + FloatingClientSize(m_wndTilePal->GetBestSize()). Right().Layer(0).Position(1). Hide()); - // default width doesn't leave enough space for color palette - SetClientSize(4*m_wndColorPal->GetBestSize().x, GetClientSize().y); + if (!wxPersistentRegisterAndRestore(this)) + { + // default width doesn't leave enough space for color palette + wxSize clientSize = GetClientSize(); + if (clientSize.x < 4*m_wndColorPal->GetBestSize().x) + { + wxSize oldSize = GetSize(); + clientSize.x = 4*m_wndColorPal->GetBestSize().x; + wxSize newSize = ClientToWindowSize(clientSize); + // preserve aspect ratio of window + newSize.y = oldSize.y * newSize.x/oldSize.x; + // but don't exceed client area + wxRect clientArea = wxDisplay().GetClientArea(); + newSize.x = std::min(newSize.x, clientArea.GetWidth()); + newSize.y = std::min(newSize.y, clientArea.GetHeight()); + wxPoint pos = GetPosition(); + pos.x = std::min(pos.x, clientArea.GetRight() - newSize.x); + pos.y = std::min(pos.y, clientArea.GetBottom() - newSize.y); + SetSize(pos.x, pos.y, newSize.x, newSize.y); + } + } + auiManager.Update(); + + RestoreProfileSettings(); } CMainFrame::~CMainFrame() @@ -360,13 +384,15 @@ int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) return 0; } +#endif -void CMainFrame::OnClose() +void CMainFrame::OnClose(wxCloseEvent& event) { SaveProfileSettings(); - CMDIFrameWndEx::OnClose(); + event.Skip(); } +#if 0 ///////////////////////////////////////////////////////////////////////////// BOOL CMainFrame::OnHelpInfo(HELPINFO* pHelpInfo) @@ -402,43 +428,50 @@ wxView* CMainFrame::GetActiveView() const /////////////////////////////////////////////////////////////////////// -static const CB::string szSectSettings = "Settings"; -static const CB::string szSectControlBars = "ControlBars"; -static const CB::string szEntryToolPal = "ToolPal"; -static const CB::string szEntryIToolPal = "ImageToolPal"; +static const CB::string szFramePath = "Persistent_Options/Window/frame/"; +static const CB::string szConfigVer = "v1"; +static const CB::string szEntryPerspective = "Perspective"; static const CB::string szEntryColorPal = "ColorPal"; static const CB::string szEntryTilePal = "TilePal"; -static const CB::string szEntryToolBar = "ToolBar"; static const CB::string szEntryStatusBar = "StatusBar"; void CMainFrame::SaveProfileSettings() { -#if 0 - SaveBarState(szSectControlBars); + wxConfigBase& config = CheckedDeref(wxConfig::Get()); + wxConfigPathChanger setPath(&config, szFramePath); - GetApp()->WriteProfileInt(szSectSettings, szEntryColorPal, m_bColorPalOn); - GetApp()->WriteProfileInt(szSectSettings, szEntryTilePal, m_bTilePalOn); + wxString perspective = szConfigVer + "\n" + auiManager.SavePerspective(); + CB_VERIFY(config.Write(szEntryPerspective, perspective)); - GetApp()->WriteProfileInt(szSectSettings, szEntryStatusBar, - (m_wndStatusBar.GetStyle() & WS_VISIBLE) ? 1 : 0); -#else - AfxThrowNotSupportedException(); -#endif + CB_VERIFY(config.Write(szEntryColorPal, m_bColorPalOn)); + CB_VERIFY(config.Write(szEntryTilePal, m_bTilePalOn)); + + CB_VERIFY(config.Write(szEntryStatusBar, bool(m_wndStatusBar))); } void CMainFrame::RestoreProfileSettings() { -#if 0 - // Note: I only send a message to turn off the tool and status bars - // since MFC sets them on by default. - if (!GetApp()->GetProfileInt(szSectSettings, szEntryStatusBar, 1)) - SendMessage(WM_COMMAND, ID_VIEW_STATUS_BAR, 0L); - - m_bColorPalOn = GetApp()->GetProfileInt(szSectSettings, szEntryColorPal, TRUE); - m_bTilePalOn = GetApp()->GetProfileInt(szSectSettings, szEntryTilePal, TRUE); -#else - AfxThrowNotSupportedException(); -#endif + wxConfigBase& config = CheckedDeref(wxConfig::Get()); + wxConfigPathChanger setPath(&config, szFramePath); + + // status bar is initialized on, so only adjust to turn off + if (!config.Read(szEntryStatusBar, true)) + { + wxCommandEvent dummy; + OnViewStatusBar(dummy); + } + + m_bColorPalOn = config.Read(szEntryColorPal, true); + m_bTilePalOn = config.Read(szEntryTilePal, true); + + wxString perspective = config.Read(szEntryPerspective, wxEmptyString); + wxStringTokenizer tokenizer(perspective, "\n"); + if (tokenizer.HasMoreTokens() && + tokenizer.GetNextToken() == szConfigVer.wx_str() && + tokenizer.HasMoreTokens()) + { + auiManager.LoadPerspective(tokenizer.GetNextToken()); + } } void CMainFrame::OnUpdateEnable(wxUpdateUIEvent& pCmdUI) @@ -609,22 +642,6 @@ void CMainFrame::OnIdle() UpdatePaletteWindow(*m_wndColorPal, tblColor, m_bColorPalOn); - wxAuiPaneInfo& pane = auiManager.GetPane(m_wndTilePal); - if (GetCurrentDocument() == NULL) - { - pane.Show(false); - auiMgrScheduleUpdate = true; - } - else - { - wxSize newSize = m_wndTilePal->GetBestSize(); - if (pane.best_size != newSize) - { - pane.BestSize(newSize); - auiMgrScheduleUpdate = true; - } - } - if (m_wndColorPal->GetHandle() && m_wndColorPal->IsShownOnScreen()) { wxCommandEvent event(wxEVT_MENU, XRCID("WM_IDLEUPDATECMDUI")); diff --git a/GM/FrmMain.h b/GM/FrmMain.h index 7d3c503..97d8d74 100644 --- a/GM/FrmMain.h +++ b/GM/FrmMain.h @@ -61,6 +61,7 @@ class CMainFrame : public wxDocParentFrameAny public: void SaveProfileSettings(); void RestoreProfileSettings(); + void AuiScheduleUpdate() { auiMgrScheduleUpdate = true; } // Implementation public: @@ -99,8 +100,8 @@ class CMainFrame : public wxDocParentFrameAny #if 0 afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); - afx_msg void OnClose(); #endif + void OnClose(wxCloseEvent& event); void OnWindowToolPal(wxCommandEvent& event); void OnWindowIToolPal(wxCommandEvent& event); void OnWindowColorPal(wxCommandEvent& event); diff --git a/GM/ToolObjs.cpp b/GM/ToolObjs.cpp index b3b2f9a..38bc050 100644 --- a/GM/ToolObjs.cpp +++ b/GM/ToolObjs.cpp @@ -853,7 +853,7 @@ wxCursor CTileTool::OnSetCursor(const CBrdEditView& /*pView*/, wxPoint /*point*/ void CCellEraserTool::OnLButtonDown(CBrdEditView& pView, int nMods, wxPoint point) { - pView.SetCellColor(noColor, point, TRUE); + pView.SetCellColor(noColorWx, point, TRUE); // pView->SetCellTile(nullTid, point, TRUE); } @@ -861,7 +861,7 @@ void CCellEraserTool::OnMouseMove(CBrdEditView& pView, int nMods, int nButs, wxP { if (nButs & wxMOUSE_BTN_LEFT) { - pView.SetCellColor(noColor, point, TRUE); + pView.SetCellColor(noColorWx, point, TRUE); // pView->SetCellTile(nullTid, point, TRUE); } } diff --git a/GM/VwEdtbrd.cpp b/GM/VwEdtbrd.cpp index 4097500..933a661 100644 --- a/GM/VwEdtbrd.cpp +++ b/GM/VwEdtbrd.cpp @@ -1020,7 +1020,7 @@ void CBrdEditView::SetCellColor(wxColour crCell, wxPoint pnt, BOOL bUpdate) if (!pBa.FindCell(pnt.x, pnt.y, row, col, m_nZoom)) return; // Not a valid cell hit - if (crCell != pBa.GetCellColor(row, col)) + if (crCell != CB::Convert(pBa.GetCellColor(row, col))) { pBa.SetCellColor(row, col, CB::Convert(crCell)); if (bUpdate) @@ -1093,7 +1093,7 @@ void CBrdEditView::DoCreateTextDrawingObject(wxPoint point) if (!dlg.m_strText.empty()) { CreateTextDrawingObject(point, dlg.m_fontID, - m_pBMgr->GetForeColor(), dlg.m_strText, TRUE); + CB::Convert(m_pBMgr->GetForeColor()), dlg.m_strText, TRUE); GetDocument().SetModifiedFlag(); } } @@ -2397,6 +2397,7 @@ bool wxBrdEditView::OnClose(bool /*deleteWindow*/) { /* doc's life determined by wxGbxProjView, not this, so bypass wxView::OnClose() */ + FileHistoryRemoveMenu(); return true; } @@ -2422,6 +2423,7 @@ bool wxBrdEditView::OnCreate(wxDocument* doc, long flags) /* KLUDGE: giving each frame its own menu seems to avoid crashes on process close */ wxXmlResource::Get()->LoadMenuBar(frame, "IDR_GAMEBOX"_cbstring); + FileHistoryAddMenu(); new CBrdEditView(*this, *createParam); frame->Show(); diff --git a/GM/VwPrjgbx.cpp b/GM/VwPrjgbx.cpp index deb86b9..d078b4e 100644 --- a/GM/VwPrjgbx.cpp +++ b/GM/VwPrjgbx.cpp @@ -159,6 +159,7 @@ wxBEGIN_EVENT_TABLE(CGbxProjView, wxPanel) EVT_UPDATE_UI(XRCID("ID_PROJECT_CLONEBOARD"), OnUpdateProjectCloneBoard) EVT_DRAGDROP(OnDragItem) EVT_GET_DRAG_SIZE(OnGetDragSize) + EVT_NAVIGATION_KEY(OnNavigationKey) wxEND_EVENT_TABLE() ///////////////////////////////////////////////////////////////////////////// @@ -189,6 +190,17 @@ CGbxProjView::CGbxProjView(wxView& v) : m_listTiles->EnableDrag(); m_listTiles->EnableSelfDrop(); m_listTiles->EnableDropScroll(); + // don't steal Ctrl-Tab from MDI client + wxASSERT(HasFlag(wxTAB_TRAVERSAL)); + ToggleWindowStyle(wxTAB_TRAVERSAL); + /* KLUDGE: even w/o wxTAB_TRAVERSAL, we still need this + hack as well, or dynamic handlers trigger infinite + recursion before executing event table handler */ + Bind(wxEVT_NAVIGATION_KEY, + [this](wxNavigationKeyEvent& event) + { + OnNavigationKey(event); + }); } CGbxProjView::~CGbxProjView() @@ -523,6 +535,25 @@ void CGbxProjView::OnGetDragSize(GetDragSizeEvent& event) event.SetSize(retval); } +void CGbxProjView::OnNavigationKey(wxNavigationKeyEvent& event) +{ + // don't steal Ctrl-Tab from MDI client + if (event.IsWindowChange()) + { + GetMainFrame()->GetClientWindow()->ProcessWindowEvent(event); + } + else + { + // KLUDGE: avoid infinite recursion at end of children + static wxRecursionGuardFlag flag; + wxRecursionGuard guard(flag); + if (!guard.IsInside()) + { + wxPanel::OnNavigationKey(event); + } + } +} + ///////////////////////////////////////////////////////////////////////////// // Updates buttons for specified group @@ -1435,20 +1466,21 @@ bool wxGbxProjView::OnClose(bool deleteWindow) { GetWindow().Hide(); } - wxMenuBar& menubar = CheckedDeref(GetFrame().GetMenuBar()); - wxMenu& menuFile = CheckedDeref(menubar.GetMenu(size_t(0))); - wxDocManager& docMgr = CheckedDeref(wxDocManager::GetDocumentManager()); - docMgr.FileHistoryRemoveMenu(&menuFile); + FileHistoryRemoveMenu(); /* CB defines doc's life only by proj view, - so delete rest */ + so close rest */ wxViewVector views = GetDocument()->GetViewsVector(); for (auto it = views.begin() ; it != views.end() ; ++it) { ::wxView* view = *it; if (view != this) { - delete view; + /* KLUDGE: need to close frame because + closing non-proj views is disabled + in order to override standard doc + lifetime */ + CB_VERIFY(view->GetFrame()->Close(true)); } } @@ -1482,10 +1514,7 @@ bool wxGbxProjView::OnCreate(wxDocument* doc, long flags) /* KLUDGE: giving each frame its own menu seems to avoid crashes on process close */ wxMenuBar& menubar = CheckedDeref(wxXmlResource::Get()->LoadMenuBar(frame, "IDR_GAMEBOX"_cbstring)); - wxMenu& menuFile = CheckedDeref(menubar.GetMenu(size_t(0))); - wxDocManager& docMgr = CheckedDeref(wxDocManager::GetDocumentManager()); - docMgr.FileHistoryUseMenu(&menuFile); - docMgr.FileHistoryAddFilesToMenu(&menuFile); + FileHistoryAddMenu(); /* postpone because this gets called before OnOpenDocument() new CGbxProjView(*this); frame->Show(); diff --git a/GM/VwPrjgbx.h b/GM/VwPrjgbx.h index 5dda287..989b0b8 100644 --- a/GM/VwPrjgbx.h +++ b/GM/VwPrjgbx.h @@ -245,6 +245,7 @@ class CGbxProjView : public wxPanel, private CB::Impl::CGbxProjViewBase void OnUpdateProjectCloneBoard(wxUpdateUIEvent& pCmdUI); void OnDragItem(DragDropEvent& event); void OnGetDragSize(GetDragSizeEvent& event); + void OnNavigationKey(wxNavigationKeyEvent& event); wxDECLARE_EVENT_TABLE(); private: diff --git a/GM/VwTilesl.cpp b/GM/VwTilesl.cpp index be14255..e197045 100644 --- a/GM/VwTilesl.cpp +++ b/GM/VwTilesl.cpp @@ -81,7 +81,7 @@ void CTileSelView::OnInitialUpdate() // Fetch small scale color and create bogus tile for color editing tile = m_pTileMgr->GetTile(m_tid, smallScale); - m_crSmall = tile.GetSmallColor(); + m_crSmall = CB::Convert(tile.GetSmallColor()); m_sizeSmall = wxSize(8, 8); m_bmSmall = CreateColorBitmap(m_sizeSmall, m_crSmall); diff --git a/GP/CBPlay.fbp b/GP/CBPlay.fbp new file mode 100644 index 0000000..28f2522 --- /dev/null +++ b/GP/CBPlay.fbp @@ -0,0 +1,12825 @@ + + + + + C++ + ; + 0 + connect + none + + + 0 + 1 + res + UTF-8 + MyProjectBase + 6000 + 1 + 1 + UI + CBPlay + . + 0 + source_name + 1 + 0 + source_name + + 1 + 1 + 1 + 0 + 0 + + 0 + wxAUI_MGR_DEFAULT + + wxBOTH + + 1 + 0 + 1 + impl_virtual + + + + 0 + wxID_ANY + + + CChgGameOwnerDialog + + + wxDEFAULT_DIALOG_STYLE + ; ; forward_declare + Change Game File Owner + + 0 + + + + + + bSizer1 + wxHORIZONTAL + none + + 5 + wxEXPAND + 1 + + + bSizer2 + wxVERTICAL + none + + 5 + wxTOP|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + Select a new owner for the Game file: + 0 + + 0 + + + 0 + + 1 + m_staticText1 + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + 5 + wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + "1" "2" "3" "4" "5" "6" + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_listPlayers + 1 + + + protected + 1 + + Resizable + 1 + + wxLB_SINGLE + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + 5 + + 0 + + + bSizer3 + wxVERTICAL + none + + 5 + wxTOP|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + 0 + + + + + 1 + 0 + 1 + + 1 + + 1 + 0 + + Dock + 0 + Left + 0 + 1 + + 1 + + + 0 + 0 + wxID_ANY + OK + + 0 + + 0 + + + 0 + + 1 + wxID_OK + 1 + + + protected + 1 + + + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + 0 + + + + + 1 + 0 + 1 + + 1 + + 0 + 0 + + Dock + 0 + Left + 0 + 1 + + 1 + + + 0 + 0 + wxID_ANY + Cancel + + 0 + + 0 + + + 0 + + 1 + wxID_CANCEL + 1 + + + protected + 1 + + + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + 0 + wxAUI_MGR_DEFAULT + + wxBOTH + + 1 + 0 + 1 + impl_virtual + + + + 0 + wxID_ANY + + + CCreateGeomorphicBoardDialog + + + wxDEFAULT_DIALOG_STYLE + ; ; forward_declare + Create Geomorphic Board + + 0 + + + + + + bSizer30 + wxHORIZONTAL + none + + 5 + wxEXPAND + 1 + + + bSizer31 + wxVERTICAL + none + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + New board's name: + 0 + + 0 + + + 0 + + 1 + m_staticText23 + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + 5 + wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + 0 + + 0 + + 1 + m_editBoardName + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + 5 + wxEXPAND + 1 + + + bSizer34 + wxHORIZONTAL + none + + 5 + wxEXPAND + 1 + + + bSizer35 + wxVERTICAL + none + + 5 + wxEXPAND|wxTOP|wxRIGHT|wxLEFT + 1 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_listBoard + 1 + + + protected + 1 + + Resizable + 1 + + wxLB_SINGLE|wxLB_SORT + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxEXPAND|wxTOP|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + 0 + + + + + 1 + 0 + 1 + + 1 + + 0 + 0 + + Dock + 0 + Left + 0 + 1 + + 1 + + + 0 + 0 + wxID_ANY + Add Board + + 0 + + 0 + + + 0 + + 1 + m_btnAddBoard + 1 + + + protected + 1 + + + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + 0 + + + + + 1 + 0 + 1 + + 1 + + 0 + 0 + + Dock + 0 + Left + 0 + 1 + + 1 + + + 0 + 0 + wxID_ANY + Add Row Break + + 0 + + 0 + + + 0 + + 1 + m_btnAddBreak + 1 + + + protected + 1 + + + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + 5 + wxEXPAND + 1 + + + bSizer36 + wxVERTICAL + none + + 5 + wxEXPAND|wxTOP|wxRIGHT|wxLEFT + 1 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_listGeo + 1 + + + protected + 1 + + Resizable + 1 + + wxLB_SINGLE + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + 0 + + + + + 1 + 0 + 1 + + 1 + + 0 + 0 + + Dock + 0 + Left + 0 + 1 + + 1 + + + 0 + 0 + wxID_ANY + Clear List + + 0 + + 0 + + + 0 + + 1 + m_btnClearList + 1 + + + protected + 1 + + + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + 5 + + 0 + + + bSizer33 + wxVERTICAL + none + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + 0 + + + + + 1 + 0 + 1 + + 1 + + 1 + 0 + + Dock + 0 + Left + 0 + 1 + + 1 + + + 0 + 0 + wxID_ANY + OK + + 0 + + 0 + + + 0 + + 1 + wxID_OK + 1 + + + protected + 1 + + + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + 0 + + + + + 1 + 0 + 1 + + 1 + + 0 + 0 + + Dock + 0 + Left + 0 + 1 + + 1 + + + 0 + 0 + wxID_ANY + Cancel + + 0 + + 0 + + + 0 + + 1 + wxID_CANCEL + 1 + + + protected + 1 + + + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + 0 + + + + + 1 + 0 + 1 + + 1 + + 0 + 0 + + Dock + 0 + Left + 0 + 1 + + 1 + + + 0 + 0 + wxID_ANY + Help + + 0 + + 0 + + + 0 + + 1 + wxID_HELP + 1 + + + protected + 1 + + + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + 0 + wxAUI_MGR_DEFAULT + + wxBOTH + + 1 + 0 + 1 + impl_virtual + + + + 0 + wxID_ANY + + + CCreatePlayersDialog + + + wxDEFAULT_DIALOG_STYLE + ; ; forward_declare + Create Players + + 0 + + + + + + bSizer36 + wxHORIZONTAL + none + + 5 + wxEXPAND + 1 + + + bSizer38 + wxVERTICAL + none + + 5 + wxEXPAND + 1 + + + bSizer40 + wxHORIZONTAL + none + + 5 + wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + How many players should be created? + 0 + + 0 + + + 0 + + 1 + m_staticText26 + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + 5 + wxALL|wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + 0 + + 0 + + 1 + m_editPlayerCount + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + Tip: Maximum of 26 players. Zero deletes all players. + 0 + + 0 + + + 0 + + 1 + m_staticText25 + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + + + 5 + + 0 + + + bSizer39 + wxVERTICAL + none + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + 0 + + + + + 1 + 0 + 1 + + 1 + + 1 + 0 + + Dock + 0 + Left + 0 + 1 + + 1 + + + 0 + 0 + wxID_ANY + OK + + 0 + + 0 + + + 0 + + 1 + wxID_OK + 1 + + + protected + 1 + + + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + 0 + + + + + 1 + 0 + 1 + + 1 + + 0 + 0 + + Dock + 0 + Left + 0 + 1 + + 1 + + + 0 + 0 + wxID_ANY + Cancel + + 0 + + 0 + + + 0 + + 1 + wxID_CANCEL + 1 + + + protected + 1 + + + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + 0 + wxAUI_MGR_DEFAULT + + wxBOTH + + 1 + 0 + 1 + impl_virtual + + + + 0 + wxID_ANY + + + CDieRollerDlg + + + wxDEFAULT_DIALOG_STYLE + ; ; forward_declare + Roll Dice + + 0 + + + + + + bSizer4 + wxVERTICAL + none + + 5 + wxEXPAND + 1 + + + bSizer5 + wxHORIZONTAL + none + + 5 + wxEXPAND + 1 + + + bSizer6 + wxVERTICAL + none + + 5 + + 0 + + + bSizer11 + wxVERTICAL + none + + 5 + + 0 + + + bSizer12 + wxHORIZONTAL + none + + 5 + wxALL|wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + Roll + 0 + + 0 + + + 0 + + 1 + m_staticText5 + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + 5 + wxALL|wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + 0 + + 0 + + 1 + m_editSets + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + 5 + wxALL|wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + sets of the following: + 0 + + 0 + + + 0 + + 1 + m_staticText6 + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + + + + + 5 + wxEXPAND + 1 + + 5 + wxBOTH + + + 0 + + fgSizer1 + wxFLEX_GROWMODE_SPECIFIED + none + 3 + 0 + + 5 + wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + Roll: + + 0 + + + 0 + + 1 + m_chkRoll1 + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + 0 + + 0 + + 1 + m_editDice1 + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + Dice having: + 0 + + 0 + + + 0 + + 1 + m_staticText7 + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + 5 + wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + 0 + + 0 + + 1 + m_editFaces1 + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + Faces + 0 + + 0 + + + 0 + + 1 + m_staticText8 + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + 5 + wxTOP|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + Roll: + + 0 + + + 0 + + 1 + m_chkRoll2 + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxTOP|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + 0 + + 0 + + 1 + m_editDice2 + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + 5 + wxTOP|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + Dice having: + 0 + + 0 + + + 0 + + 1 + m_staticText9 + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + 5 + wxTOP|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + 0 + + 0 + + 1 + m_editFaces2 + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + 5 + wxTOP|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + Faces + 0 + + 0 + + + 0 + + 1 + m_staticText10 + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + 5 + wxALL|wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + Roll: + + 0 + + + 0 + + 1 + m_chkRoll3 + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxALL|wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + 0 + + 0 + + 1 + m_editDice3 + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + 5 + wxALL|wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + Dice having: + 0 + + 0 + + + 0 + + 1 + m_staticText11 + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + 5 + wxALL|wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + 0 + + 0 + + 1 + m_editFaces3 + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + 5 + wxALL|wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + Faces + 0 + + 0 + + + 0 + + 1 + m_staticText12 + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + + + + + 5 + + 0 + + + bSizer7 + wxVERTICAL + none + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + 0 + + + + + 1 + 0 + 1 + + 1 + + 1 + 0 + + Dock + 0 + Left + 0 + 1 + + 1 + + + 0 + 0 + wxID_ANY + Roll + + 0 + + 0 + + + 0 + + 1 + wxID_OK + 1 + + + protected + 1 + + + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + 0 + + + + + 1 + 0 + 1 + + 1 + + 0 + 0 + + Dock + 0 + Left + 0 + 1 + + 1 + + + 0 + 0 + wxID_ANY + Cancel + + 0 + + 0 + + + 0 + + 1 + wxID_CANCEL + 1 + + + protected + 1 + + + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + 5 + wxEXPAND + 0 + + + bSizer8 + wxHORIZONTAL + none + + 5 + wxALL|wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + Add: + 0 + + 0 + + + 0 + + 1 + m_staticText2 + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + 5 + wxALL|wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + 0 + + 0 + + 1 + m_editBias + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + 5 + wxALL|wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + to the above result. + 0 + + 0 + + + 0 + + 1 + m_staticText3 + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + + + 5 + wxEXPAND + 0 + + 2 + wxHORIZONTAL + 1 + + 0 + + fgSizer2 + wxFLEX_GROWMODE_ALL + none + 2 + 0 + + 5 + wxALL|wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + Seed value (optional): + 0 + + 0 + + + 0 + + 1 + m_staticText13 + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + 5 + wxALL|wxEXPAND|wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + 0 + + 0 + + 1 + m_editSeed + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + 5 + wxEXPAND + 1 + + 0 + protected + 0 + + + + 5 + wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + 0 + + + + + 1 + 0 + 1 + + 1 + + 0 + 0 + + Dock + 0 + Left + 0 + 1 + + 1 + + + 0 + 0 + wxID_ANY + Reset Seed Vaue + + 0 + + 0 + + + 0 + + 1 + m_btnResetSeed + 1 + + + protected + 1 + + + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + 0 + wxAUI_MGR_DEFAULT + + wxBOTH + + 1 + 0 + 1 + impl_virtual + + + + 0 + wxID_ANY + + + CEditElementTextDialog + + + wxDEFAULT_DIALOG_STYLE + ; ; forward_declare + Enter Object Text + + 0 + + + + + + bSizer14 + wxHORIZONTAL + none + + 5 + wxEXPAND + 1 + + + bSizer15 + wxVERTICAL + none + + 5 + wxTOP|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + Enter text to be associated with the piece and/or marker: + 0 + + 0 + + + 0 + + 1 + m_staticText14 + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + 5 + wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + 0 + + 0 + + 1 + m_editText + 1 + + + protected + 1 + + Resizable + 1 + + wxTE_MULTILINE + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + 1 2 3 4 5 6 + + + + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + Set text on all sides of pieces. + + 0 + + + 0 + + 1 + m_chkAllSides + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + 5 + + 0 + + + bSizer16 + wxVERTICAL + none + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + 0 + + + + + 1 + 0 + 1 + + 1 + + 1 + 0 + + Dock + 0 + Left + 0 + 1 + + 1 + + + 0 + 0 + wxID_ANY + OK + + 0 + + 0 + + + 0 + + 1 + wxID_OK + 1 + + + protected + 1 + + + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + 0 + + + + + 1 + 0 + 1 + + 1 + + 0 + 0 + + Dock + 0 + Left + 0 + 1 + + 1 + + + 0 + 0 + wxID_ANY + Cancel + + 0 + + 0 + + + 0 + + 1 + wxID_CANCEL + 1 + + + protected + 1 + + + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + 0 + wxAUI_MGR_DEFAULT + + wxBOTH + + 1 + 0 + 1 + impl_virtual + + + + 0 + wxID_ANY + + + CEditPlayersDialog + + -1,-1 + wxDEFAULT_DIALOG_STYLE + ; ; forward_declare + Edit Player Names + + 0 + + + + + + bSizer14 + wxHORIZONTAL + none + + 5 + wxEXPAND + 1 + + -1,-1 + bSizer15 + wxVERTICAL + none + + 5 + wxTOP|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + Player names: + 0 + + 0 + + + 0 + + 1 + m_staticText14 + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + 5 + wxEXPAND|wxALL + 1 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_listNames + 1 + + + protected + 1 + + Resizable + 1 + + wxLB_SINGLE + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxTOP|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + New player name: + 0 + + 0 + + + 0 + + 1 + m_staticText15 + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + 5 + wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + 0 + + 0 + + 1 + m_editName + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + 5 + wxALL|wxALIGN_CENTER_HORIZONTAL + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + 0 + + + + + 1 + 0 + 1 + + 1 + + 0 + 0 + + Dock + 0 + Left + 0 + 1 + + 1 + + + 0 + 0 + wxID_ANY + Update Name + + 0 + + 0 + + + 0 + + 1 + m_btnUpdate + 1 + + + protected + 1 + + + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + 5 + + 0 + + + bSizer16 + wxVERTICAL + none + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + 0 + + + + + 1 + 0 + 1 + + 1 + + 1 + 0 + + Dock + 0 + Left + 0 + 1 + + 1 + + + 0 + 0 + wxID_ANY + OK + + 0 + + 0 + + + 0 + + 1 + wxID_OK + 1 + + + protected + 1 + + + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + 0 + + + + + 1 + 0 + 1 + + 1 + + 0 + 0 + + Dock + 0 + Left + 0 + 1 + + 1 + + + 0 + 0 + wxID_ANY + Cancel + + 0 + + 0 + + + 0 + + 1 + wxID_CANCEL + 1 + + + protected + 1 + + + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + 0 + wxAUI_MGR_DEFAULT + + wxBOTH + + 1 + 0 + 1 + impl_virtual + + + + 0 + wxID_ANY + + + CImportTraysDlg + + + wxDEFAULT_DIALOG_STYLE + ; ; forward_declare + Import Piece Groups + + 0 + + + + + + bSizer17 + wxHORIZONTAL + none + + 5 + wxEXPAND + 1 + + + bSizer18 + wxVERTICAL + none + + 5 + wxTOP|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + Create Trays from the selected Piece Groups: + 0 + + 0 + + + 0 + + 1 + m_staticText16 + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + 5 + wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND + 1 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_listGroups + 1 + + + protected + 1 + + Resizable + 1 + + wxLB_EXTENDED|wxLB_SORT + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxEXPAND + 0 + + + bSizer20 + wxHORIZONTAL + none + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + 0 + + + + + 1 + 0 + 1 + + 1 + + 0 + 0 + + Dock + 0 + Left + 0 + 1 + + 1 + + + 0 + 0 + wxID_ANY + Select All + + 0 + + 0 + + + 0 + + 1 + OnBnClickedSelectAll + 1 + + + protected + 1 + + + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxEXPAND + 1 + + 0 + protected + 0 + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + 0 + + + + + 1 + 0 + 1 + + 1 + + 0 + 0 + + Dock + 0 + Left + 0 + 1 + + 1 + + + 0 + 0 + wxID_ANY + Clear All + + 0 + + 0 + + + 0 + + 1 + OnBnClickedClearAll + 1 + + + protected + 1 + + + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + 5 + + 0 + + + bSizer19 + wxVERTICAL + none + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + 0 + + + + + 1 + 0 + 1 + + 1 + + 1 + 0 + + Dock + 0 + Left + 0 + 1 + + 1 + + + 0 + 0 + wxID_ANY + OK + + 0 + + 0 + + + 0 + + 1 + wxID_OK + 1 + + + protected + 1 + + + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + 0 + + + + + 1 + 0 + 1 + + 1 + + 0 + 0 + + Dock + 0 + Left + 0 + 1 + + 1 + + + 0 + 0 + wxID_ANY + Cancel + + 0 + + 0 + + + 0 + + 1 + wxID_CANCEL + 1 + + + protected + 1 + + + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + 0 + wxAUI_MGR_DEFAULT + + wxBOTH + + 1 + 0 + 1 + impl_virtual + + + + 0 + wxID_ANY + + + CMarkerCountDialog + + + wxDEFAULT_DIALOG_STYLE + ; ; forward_declare + Enter Marker Count + + 0 + + + + + + bSizer21 + wxHORIZONTAL + none + + 5 + wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + Enter the number of markers to be created: + 0 + + 0 + + + 0 + + 1 + m_staticText17 + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + 5 + wxALL|wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + 0 + + 0 + + 1 + m_editMarkerCount + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + 5 + wxEXPAND + 1 + + + bSizer22 + wxVERTICAL + none + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + 0 + + + + + 1 + 0 + 1 + + 1 + + 1 + 0 + + Dock + 0 + Left + 0 + 1 + + 1 + + + 0 + 0 + wxID_ANY + OK + + 0 + + 0 + + + 0 + + 1 + wxID_OK + 1 + + + protected + 1 + + + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + 0 + + + + + 1 + 0 + 1 + + 1 + + 0 + 0 + + Dock + 0 + Left + 0 + 1 + + 1 + + + 0 + 0 + wxID_ANY + Cancel + + 0 + + 0 + + + 0 + + 1 + wxID_CANCEL + 1 + + + protected + 1 + + + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + 0 + wxAUI_MGR_DEFAULT + + wxBOTH + + 1 + 0 + 1 + impl_virtual + + + + 0 + wxID_ANY + + + CMovDescDialog + + + wxDEFAULT_DIALOG_STYLE + ; ; forward_declare + Enter Move Description + + 0 + + + + + + bSizer23 + wxVERTICAL + none + + 5 + wxEXPAND + 1 + + + bSizer24 + wxHORIZONTAL + none + + 5 + wxEXPAND + 1 + + + bSizer25 + wxVERTICAL + none + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + Enter a description for this recorded set of moves. The title is presented in the move history list. + 0 + + 0 + + + 0 + + 1 + m_staticText18 + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + 5 + wxEXPAND + 1 + + 0 + protected + 0 + + + + 5 + wxTOP|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + Title: + 0 + + 0 + + + 0 + + 1 + m_staticText19 + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + + + 5 + + 0 + + + bSizer26 + wxVERTICAL + none + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + 0 + + + + + 1 + 0 + 1 + + 1 + + 1 + 0 + + Dock + 0 + Left + 0 + 1 + + 1 + + + 0 + 0 + wxID_ANY + OK + + 0 + + 0 + + + 0 + + 1 + wxID_OK + 1 + + + protected + 1 + + + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + 0 + + + + + 1 + 0 + 1 + + 1 + + 0 + 0 + + Dock + 0 + Left + 0 + 1 + + 1 + + + 0 + 0 + wxID_ANY + Cancel + + 0 + + 0 + + + 0 + + 1 + wxID_CANCEL + 1 + + + protected + 1 + + + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + 5 + wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + 0 + + 0 + + 1 + m_editTitle + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + 5 + wxTOP|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + Description: + 0 + + 0 + + + 0 + + 1 + m_staticText20 + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + 5 + wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + 0 + + 0 + + 1 + m_editDesc + 1 + + + protected + 1 + + Resizable + 1 + + wxTE_MULTILINE + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + 0 + wxAUI_MGR_DEFAULT + + wxBOTH + + 1 + 0 + 1 + impl_virtual + + + + 0 + wxID_ANY + + + CMultiplayerGameDialog + + + wxDEFAULT_DIALOG_STYLE + ; ; forward_declare + Creating Multiplayer Game + + 0 + + + + + + bSizer27 + wxHORIZONTAL + none + + 5 + wxEXPAND + 1 + + + bSizer28 + wxVERTICAL + none + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + This scenario is for a multi-player game. You will be prompted for a base file name that will be used to create a unique game file for each player. The generated files should be distributed to the appropriate players after which you may begin play. + 0 + + 0 + + + 0 + + 1 + m_static1 + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + Create a Referee game file. It has unlimited player access. + + 0 + + + 0 + + 1 + m_chkCreateReferee + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + The names below are the default player names. You may change them now before creating the games. Press OK when you are done. + 0 + + 0 + + + 0 + + 1 + m_static2 + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + 5 + wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_listPlayers + 1 + + + protected + 1 + + Resizable + 1 + + wxLB_SINGLE + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + 0 + + 0 + + 1 + m_editPlayer + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + 5 + wxALL|wxALIGN_CENTER_HORIZONTAL + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + 0 + + + + + 1 + 0 + 1 + + 1 + + 0 + 0 + + Dock + 0 + Left + 0 + 1 + + 1 + + + 0 + 0 + wxID_ANY + Update Name + + 0 + + 0 + + + 0 + + 1 + OnBtnPressUpdateName + 1 + + + protected + 1 + + + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + 5 + + 0 + + + bSizer29 + wxVERTICAL + none + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + 0 + + + + + 1 + 0 + 1 + + 1 + + 1 + 0 + + Dock + 0 + Left + 0 + 1 + + 1 + + + 0 + 0 + wxID_ANY + OK + + 0 + + 0 + + + 0 + + 1 + wxID_OK + 1 + + + protected + 1 + + + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + 0 + + + + + 1 + 0 + 1 + + 1 + + 0 + 0 + + Dock + 0 + Left + 0 + 1 + + 1 + + + 0 + 0 + wxID_ANY + Cancel + + 0 + + 0 + + + 0 + + 1 + wxID_CANCEL + 1 + + + protected + 1 + + + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + 0 + wxAUI_MGR_DEFAULT + + wxBOTH + + 1 + 0 + 1 + impl_virtual + + + + 0 + wxID_ANY + + + CPasswordDialog + + + wxDEFAULT_DIALOG_STYLE + ; ; forward_declare + Enter Password + + 0 + + + + + + bSizer41 + wxHORIZONTAL + none + + 5 + wxEXPAND + 1 + + + bSizer42 + wxVERTICAL + none + + 5 + wxTOP|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + Enter the password: + 0 + + 0 + + + 0 + + 1 + m_staticText27 + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + 0 + + 0 + + 1 + m_editPassword + 1 + + + protected + 1 + + Resizable + 1 + + wxTE_PASSWORD + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + 5 + + 0 + + + bSizer43 + wxVERTICAL + none + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + 0 + + + + + 1 + 0 + 1 + + 1 + + 1 + 0 + + Dock + 0 + Left + 0 + 1 + + 1 + + + 0 + 0 + wxID_ANY + OK + + 0 + + 0 + + + 0 + + 1 + wxID_OK + 1 + + + protected + 1 + + + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + 0 + + + + + 1 + 0 + 1 + + 1 + + 0 + 0 + + Dock + 0 + Left + 0 + 1 + + 1 + + + 0 + 0 + wxID_ANY + Cancel + + 0 + + 0 + + + 0 + + 1 + wxID_CANCEL + 1 + + + protected + 1 + + + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + 0 + wxAUI_MGR_DEFAULT + + wxBOTH + + 1 + 0 + 1 + impl_virtual + + + + 0 + wxID_ANY + + + CPBrdPropDialog + + + wxDEFAULT_DIALOG_STYLE + ; ; forward_declare + Board Properties + + 0 + + + + + + bSizer44 + wxVERTICAL + none + + 5 + wxEXPAND + 0 + + + bSizer45 + wxHORIZONTAL + none + + 5 + wxEXPAND + 1 + + + bSizer46 + wxVERTICAL + none + + 5 + wxTOP|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + Board Name: + 0 + + 0 + + + 0 + + 1 + m_staticText28 + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + 5 + wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + 0 + + 0 + + 1 + m_editBoardName + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + 5 + wxTOP|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + Board's owner: + 0 + + 0 + + + 0 + + 1 + m_staticOwnerLabel + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + + + 5 + + 0 + + + bSizer47 + wxVERTICAL + none + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + 0 + + + + + 1 + 0 + 1 + + 1 + + 1 + 0 + + Dock + 0 + Left + 0 + 1 + + 1 + + + 0 + 0 + wxID_ANY + OK + + 0 + + 0 + + + 0 + + 1 + wxID_OK + 1 + + + protected + 1 + + + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + 0 + + + + + 1 + 0 + 1 + + 1 + + 0 + 0 + + Dock + 0 + Left + 0 + 1 + + 1 + + + 0 + 0 + wxID_ANY + Cancel + + 0 + + 0 + + + 0 + + 1 + wxID_CANCEL + 1 + + + protected + 1 + + + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + 5 + wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_comboOwners + 1 + + + protected + 1 + + Resizable + 0 + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxTOP|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + Allow non-owners to access pieces on this board. + + 0 + + + 0 + + 1 + m_chkAllowAccess + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxTOP|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + This board is private (restricted to owner). + + 0 + + + 0 + + 1 + m_chkPrivate + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxTOP|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + Automatically Show Board on Open + + 0 + + + 0 + + 1 + m_chkOpenBoardOnLoad + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxTOP|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + Show select list and tiny board view. (Reopen window) + + 0 + + + 0 + + 1 + m_chkShowSelListAndTinyMap + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + Draw locked objects below non-locked objects. + + 0 + + + 0 + + 1 + m_chkDrawLockedBeneath + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxALL + 0 + + wxID_ANY + Snap Grid + + sbSizer2 + wxVERTICAL + 1 + none + + 5 + wxEXPAND + 1 + + 4 + wxBOTH + + + 0 + + fgSizer3 + wxFLEX_GROWMODE_SPECIFIED + none + 2 + 0 + + 5 + wxALIGN_CENTER_VERTICAL|wxTOP|wxLEFT + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + X Pixels: + 0 + + 0 + + + 0 + + 1 + m_staticText30 + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + 5 + wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + 0 + + 0 + + 1 + m_editXGridSnap + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL|wxTOP|wxLEFT + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + X Offset: + 0 + + 0 + + + 0 + + 1 + m_staticText31 + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + 5 + wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + 0 + + 0 + + 1 + m_editXGridSnapOff + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + Y Pixels: + 0 + + 0 + + + 0 + + 1 + m_staticText32 + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + 5 + wxALL|wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + 0 + + 0 + + 1 + m_editYGridSnap + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + Y Offset: + 0 + + 0 + + + 0 + + 1 + m_staticText33 + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + 5 + wxALL|wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + 0 + + 0 + + 1 + m_editYGridSnapOff + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + 5 + wxTOP|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + Enable snap grid + + 0 + + + 0 + + 1 + m_chkGridSnap + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxTOP|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + Snap objects to their centers. + + 0 + + + 0 + + 1 + m_chkGridRectCenters + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxTOP|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + Snap plotted move lines to grid. + + 0 + + + 0 + + 1 + m_chkSnapMovePlot + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + 5 + wxALL + 0 + + wxID_ANY + Cells + + sbSizer3 + wxVERTICAL + 1 + none + + 5 + wxTOP|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + Show cell border lines on large boards. + + 0 + + + 0 + + 1 + m_chkCellBorders + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + Show cell border lines on small board. + + 0 + + + 0 + + 1 + m_chkSmallCellBorders + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + 5 + + 0 + + + bSizer48 + wxHORIZONTAL + none + + 5 + wxEXPAND|wxALL + 0 + + wxID_ANY + Auto Stack + + sbSizer4 + wxVERTICAL + 1 + none + + 5 + wxEXPAND + 1 + + 3 + wxBOTH + + + 0 + + fgSizer4 + wxFLEX_GROWMODE_SPECIFIED + none + 2 + 0 + + 5 + wxALIGN_CENTER_VERTICAL|wxTOP|wxLEFT + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + X Piece Stagger: + 0 + + 0 + + + 0 + + 1 + m_staticText37 + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + 5 + wxALIGN_CENTER_VERTICAL|wxTOP|wxLEFT + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + 0 + + 0 + + 1 + m_editXStackStagger + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + Pixels + 0 + + 0 + + + 0 + + 1 + m_staticText38 + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + 5 + wxTOP|wxBOTTOM|wxLEFT|wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + Y Piece Stagger: + 0 + + 0 + + + 0 + + 1 + m_staticText39 + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + 5 + wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + 0 + + 0 + + 1 + m_editYStackStagger + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + 5 + wxALL|wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + Pixels + 0 + + 0 + + + 0 + + 1 + m_staticText40 + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + + + + + 5 + wxEXPAND|wxALL + 0 + + wxID_ANY + Plotted Moves + + sbSizer5 + wxVERTICAL + 1 + none + + 5 + wxEXPAND + 1 + + 2 + wxBOTH + + + 0 + + fgSizer5 + wxFLEX_GROWMODE_SPECIFIED + none + 2 + 0 + + 5 + wxALIGN_CENTER_VERTICAL|wxTOP|wxLEFT + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + Color: + 0 + + 0 + + + 0 + + 1 + m_staticText41 + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + 5 + wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_cpPlotColor + 1 + + + protected + 1 + + Resizable + 1 + + wxCLRP_DEFAULT_STYLE + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + Width: + 0 + + 0 + + + 0 + + 1 + m_staticText42 + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + 5 + wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + "1" "2" "3" "4" "5" + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_comboPlotWd + 1 + + + protected + 1 + + Resizable + 0 + 1 + + wxCB_SORT + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + 0 + wxAUI_MGR_DEFAULT + + wxBOTH + + 1 + 0 + 1 + impl_virtual + + + + 0 + wxID_ANY + + + CRotatePieceDialog + + + wxDEFAULT_DIALOG_STYLE + ; ; forward_declare + Rotate Object + + 0 + + + + + + bSizer48 + wxHORIZONTAL + none + + 5 + wxEXPAND|wxTOP|wxBOTTOM|wxRIGHT + 1 + + 2 + 0 + + gSizer1 + none + 4 + 0 + + 5 + wxLEFT|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + 0 + + + + + 1 + 0 + 1 + + 1 + + 0 + 0 + + Dock + 0 + Left + 0 + 1 + + 1 + + + 0 + 0 + wxID_ANY + -1° + + 0 + + 0 + + + 0 + + 1 + OnRotatePieceCCW1 + 1 + + + protected + 1 + + + + Resizable + 1 + + wxBU_EXACTFIT + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxLEFT|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + 0 + + + + + 1 + 0 + 1 + + 1 + + 0 + 0 + + Dock + 0 + Left + 0 + 1 + + 1 + + + 0 + 0 + wxID_ANY + +1° + + 0 + + 0 + + + 0 + + 1 + OnRotatePieceCW1 + 1 + + + protected + 1 + + + + Resizable + 1 + + wxBU_EXACTFIT + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxLEFT|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + 0 + + + + + 1 + 0 + 1 + + 1 + + 0 + 0 + + Dock + 0 + Left + 0 + 1 + + 1 + + + 0 + 0 + wxID_ANY + -5° + + 0 + + 0 + + + 0 + + 1 + OnRotatePieceCCW5 + 1 + + + protected + 1 + + + + Resizable + 1 + + wxBU_EXACTFIT + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxLEFT|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + 0 + + + + + 1 + 0 + 1 + + 1 + + 0 + 0 + + Dock + 0 + Left + 0 + 1 + + 1 + + + 0 + 0 + wxID_ANY + +5° + + 0 + + 0 + + + 0 + + 1 + OnRotatePieceCW5 + 1 + + + protected + 1 + + + + Resizable + 1 + + wxBU_EXACTFIT + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxLEFT|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + 0 + + + + + 1 + 0 + 1 + + 1 + + 0 + 0 + + Dock + 0 + Left + 0 + 1 + + 1 + + + 0 + 0 + wxID_ANY + -10° + + 0 + + 0 + + + 0 + + 1 + OnRotatePieceCCW10 + 1 + + + protected + 1 + + + + Resizable + 1 + + wxBU_EXACTFIT + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxLEFT|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + 0 + + + + + 1 + 0 + 1 + + 1 + + 0 + 0 + + Dock + 0 + Left + 0 + 1 + + 1 + + + 0 + 0 + wxID_ANY + +10° + + 0 + + 0 + + + 0 + + 1 + OnRotatePieceCW10 + 1 + + + protected + 1 + + + + Resizable + 1 + + wxBU_EXACTFIT + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxLEFT|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + 0 + + + + + 1 + 0 + 1 + + 1 + + 0 + 0 + + Dock + 0 + Left + 0 + 1 + + 1 + + + 0 + 0 + wxID_ANY + -50° + + 0 + + 0 + + + 0 + + 1 + OnRotatePieceCCW50 + 1 + + + protected + 1 + + + + Resizable + 1 + + wxBU_EXACTFIT + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxLEFT|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + 0 + + + + + 1 + 0 + 1 + + 1 + + 0 + 0 + + Dock + 0 + Left + 0 + 1 + + 1 + + + 0 + 0 + wxID_ANY + +50° + + 0 + + 0 + + + 0 + + 1 + OnRotatePieceCW50 + 1 + + + protected + 1 + + + + Resizable + 1 + + wxBU_EXACTFIT + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + 5 + wxEXPAND|wxLEFT + 0 + + + bSizer49 + wxVERTICAL + none + + 5 + wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + 0 + + + + + 1 + 0 + 1 + + 1 + + 1 + 0 + + Dock + 0 + Left + 0 + 1 + + 1 + + + 0 + 0 + wxID_ANY + OK + + 0 + + 0 + + + 0 + + 1 + wxID_OK + 1 + + + protected + 1 + + + + Resizable + 1 + + wxBU_EXACTFIT + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + 0 + + + + + 1 + 0 + 1 + + 1 + + 0 + 0 + + Dock + 0 + Left + 0 + 1 + + 1 + + + 0 + 0 + wxID_ANY + Cancel + + 0 + + 0 + + + 0 + + 1 + wxID_CANCEL + 1 + + + protected + 1 + + + + Resizable + 1 + + wxBU_EXACTFIT + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxEXPAND + 1 + + 0 + protected + 0 + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + 0 + + 0 + + 1 + m_editCurVal + 1 + + + protected + 1 + + Resizable + 1 + + wxTE_CENTER|wxTE_READONLY + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + 0 + wxAUI_MGR_DEFAULT + + wxBOTH + + 1 + 0 + 1 + impl_virtual + + + + 0 + wxID_ANY + + + CScnPropDialog + + + wxDEFAULT_DIALOG_STYLE + ; ; forward_declare + Scenario Properties + + 0 + + + + + + bSizer50 + wxVERTICAL + none + + 5 + wxEXPAND + 1 + + + bSizer51 + wxHORIZONTAL + none + + 5 + wxEXPAND + 1 + + + bSizer52 + wxVERTICAL + none + + 5 + wxTOP|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + Author: + 0 + + 0 + + + 0 + + 1 + m_staticText39 + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + 5 + wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + 0 + + 0 + + 1 + m_editAuthor + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + 5 + wxTOP|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + Title: + 0 + + 0 + + + 0 + + 1 + m_staticText40 + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + + + 5 + + 0 + + + bSizer53 + wxVERTICAL + none + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + 0 + + + + + 1 + 0 + 1 + + 1 + + 1 + 0 + + Dock + 0 + Left + 0 + 1 + + 1 + + + 0 + 0 + wxID_ANY + OK + + 0 + + 0 + + + 0 + + 1 + wxID_OK + 1 + + + protected + 1 + + + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + 0 + + + + + 1 + 0 + 1 + + 1 + + 0 + 0 + + Dock + 0 + Left + 0 + 1 + + 1 + + + 0 + 0 + wxID_ANY + Cancel + + 0 + + 0 + + + 0 + + 1 + wxID_CANCEL + 1 + + + protected + 1 + + + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + 5 + wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + 0 + + 0 + + 1 + m_editTitle + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + MMMMMMMMMMMMMMMMMMMMMMMMMMMMM + + + + + + + 5 + wxTOP|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + Description: + 0 + + 0 + + + 0 + + 1 + m_staticText41 + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + 5 + wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + 0 + + 0 + + 1 + m_editDescr + 1 + + + protected + 1 + + Resizable + 1 + + wxTE_MULTILINE + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + 1 2 3 4 5 6 + + + + + + + + + 0 + wxAUI_MGR_DEFAULT + + wxBOTH + + 1 + 0 + 1 + impl_virtual + + + + 0 + wxID_ANY + + + CSelectBoardsDialog + + + wxDEFAULT_DIALOG_STYLE + ; ; forward_declare + Select Boards + + 0 + + + + + + bSizer57 + wxHORIZONTAL + none + + 5 + wxEXPAND + 1 + + + bSizer58 + wxVERTICAL + none + + 5 + wxTOP|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + Select boards used in the scenario: + 0 + + 0 + + + 0 + + 1 + m_staticText44 + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + 5 + wxALL|wxEXPAND + 1 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_listBoards + 1 + + + protected + 1 + + Resizable + 1 + + wxLB_EXTENDED|wxLB_SORT + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxEXPAND + 0 + + + bSizer60 + wxHORIZONTAL + none + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + 0 + + + + + 1 + 0 + 1 + + 1 + + 0 + 0 + + Dock + 0 + Left + 0 + 1 + + 1 + + + 0 + 0 + wxID_ANY + Select All + + 0 + + 0 + + + 0 + + 1 + OnBtnClickedSelectAll + 1 + + + protected + 1 + + + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxEXPAND + 1 + + 0 + protected + 0 + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + 0 + + + + + 1 + 0 + 1 + + 1 + + 0 + 0 + + Dock + 0 + Left + 0 + 1 + + 1 + + + 0 + 0 + wxID_ANY + Clear All + + 0 + + 0 + + + 0 + + 1 + OnBtnClickedClearAll + 1 + + + protected + 1 + + + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + 5 + + 0 + + + bSizer59 + wxVERTICAL + none + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + 0 + + + + + 1 + 0 + 1 + + 1 + + 1 + 0 + + Dock + 0 + Left + 0 + 1 + + 1 + + + 0 + 0 + wxID_ANY + OK + + 0 + + 0 + + + 0 + + 1 + wxID_OK + 1 + + + protected + 1 + + + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + 0 + + + + + 1 + 0 + 1 + + 1 + + 0 + 0 + + Dock + 0 + Left + 0 + 1 + + 1 + + + 0 + 0 + wxID_ANY + Cancel + + 0 + + 0 + + + 0 + + 1 + wxID_CANCEL + 1 + + + protected + 1 + + + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + 0 + wxAUI_MGR_DEFAULT + + wxBOTH + + 1 + 0 + 1 + impl_virtual + + + + 0 + wxID_ANY + + + CSelectNewOwnerDialog + + + wxDEFAULT_DIALOG_STYLE + ; ; forward_declare + Select New Owner + + 0 + + + + + + bSizer54 + wxHORIZONTAL + none + + 5 + wxEXPAND + 1 + + + bSizer55 + wxVERTICAL + none + + 5 + wxTOP|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + Select a new owner for the piece(s): + 0 + + 0 + + + 0 + + 1 + m_staticText43 + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + 5 + wxALL|wxEXPAND + 1 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + "1" "2" "3" "4" "5" "6" + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_listPlayers + 1 + + + protected + 1 + + Resizable + 1 + + wxLB_SINGLE + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + 5 + + 0 + + + bSizer56 + wxVERTICAL + none + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + 0 + + + + + 1 + 0 + 1 + + 1 + + 1 + 0 + + Dock + 0 + Left + 0 + 1 + + 1 + + + 0 + 0 + wxID_ANY + OK + + 0 + + 0 + + + 0 + + 1 + wxID_OK + 1 + + + protected + 1 + + + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + 0 + + + + + 1 + 0 + 1 + + 1 + + 0 + 0 + + Dock + 0 + Left + 0 + 1 + + 1 + + + 0 + 0 + wxID_ANY + Cancel + + 0 + + 0 + + + 0 + + 1 + wxID_CANCEL + 1 + + + protected + 1 + + + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + 0 + wxAUI_MGR_DEFAULT + + wxBOTH + + 1 + 0 + 1 + impl_virtual + + + + 0 + wxID_ANY + + + CSendMsgDialog + + + wxCAPTION + ; ; forward_declare + Send Message + + 0 + + + + + + bSizer61 + wxVERTICAL + none + + 5 + wxEXPAND|wxTOP|wxRIGHT|wxLEFT + 2 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + 0 + + 0 + + 1 + m_editMsg + 1 + + + protected + 1 + + Resizable + 1 + + wxTE_MULTILINE|wxTE_PROCESS_ENTER + CEditNoChevron; forward_declare; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + 5 + wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT + 1 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + 0 + + 0 + + 1 + m_editMsg2 + 1 + + + protected + 1 + + Resizable + 1 + + wxTE_MULTILINE|wxTE_PROCESS_ENTER + CEditNoChevron; forward_declare; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + 1 2 3 4 5 + + + + + + + 5 + wxEXPAND + 0 + + + bSizer62 + wxHORIZONTAL + none + + 5 + wxTOP|wxBOTTOM|wxLEFT + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + 0 + + + + + 1 + 0 + 1 + + 1 + + 1 + 0 + + Dock + 0 + Left + 0 + 1 + + 1 + + + 0 + 0 + wxID_ANY + Send && Close + + 0 + + 0 + + + 0 + + 1 + wxID_OK + 1 + + + protected + 1 + + + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxTOP|wxBOTTOM + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + 0 + + + + + 1 + 0 + 1 + + 1 + + 0 + 0 + + Dock + 0 + Left + 0 + 1 + + 1 + + + 0 + 0 + wxID_ANY + Send + + 0 + + 0 + + + 0 + + 1 + OnSendMsgSend + 1 + + + protected + 1 + + + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxTOP|wxBOTTOM|wxRIGHT + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + 0 + + + + + 1 + 0 + 1 + + 1 + + 0 + 0 + + Dock + 0 + Left + 0 + 1 + + 1 + + + 0 + 0 + wxID_ANY + Roll Dice... + + 0 + + 0 + + + 0 + + 1 + OnRollDice + 1 + + + protected + 1 + + + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxEXPAND + 1 + + 0 + protected + 0 + + + + 5 + wxTOP|wxBOTTOM|wxLEFT + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + 0 + + + + + 1 + 0 + 1 + + 1 + + 0 + 0 + + Dock + 0 + Left + 0 + 1 + + 1 + + + 0 + 0 + wxID_ANY + Defer + + 0 + + 0 + + + 0 + + 1 + m_btnDefer + 1 + + + protected + 1 + + + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxTOP|wxBOTTOM|wxRIGHT + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + 0 + + + + + 1 + 0 + 1 + + 1 + + 0 + 0 + + Dock + 0 + Left + 0 + 1 + + 1 + + + 0 + 0 + wxID_ANY + Discard + + 0 + + 0 + + + 0 + + 1 + wxID_CANCEL + 1 + + + protected + 1 + + + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + 0 + wxAUI_MGR_DEFAULT + + wxBOTH + + 1 + 0 + 1 + impl_virtual + + + + 0 + wxID_ANY + + -1,-1 + CSetPiecesDialog + + -1,-1 + wxDEFAULT_DIALOG_STYLE + ; ; forward_declare + Setup Pieces + + 0 + + + + + 500,375 + bSizer63 + wxHORIZONTAL + none + + 5 + wxEXPAND + 1 + + + bSizer64 + wxVERTICAL + none + + 5 + wxTOP|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + Piece Group: + 0 + + 0 + + + 0 + + 1 + m_staticText44 + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + 5 + wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_comboPGrp + 1 + + + protected + 1 + + Resizable + 0 + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxTOP|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + Pieces: + 0 + + 0 + + + 0 + + 1 + m_staticText45 + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + 5 + wxALL|wxEXPAND + 1 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_listPiece + 1 + + + protected + 1 + + Resizable + 1 + + wxLB_MULTIPLE + CPieceListBoxWx; forward_declare + 0 + + + + + + + + + + 5 + wxEXPAND + 0 + + + bSizer65 + wxVERTICAL + none + + 5 + wxEXPAND + 1 + + 0 + protected + 0 + + + + 5 + wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + 0 + + + + + 1 + 0 + 1 + + 1 + + 1 + 0 + + Dock + 0 + Left + 0 + 1 + + 1 + + + 0 + 0 + wxID_ANY + Close + + 0 + + 0 + + + 0 + + 1 + wxID_OK + 1 + + + protected + 1 + + + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxEXPAND + 2 + + 0 + protected + 0 + + + + 5 + wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + 0 + + + + + 1 + 0 + 1 + + 1 + + 0 + 0 + + Dock + 0 + Left + 0 + 1 + + 1 + + + 0 + 0 + wxID_ANY + Copy >> + + 0 + + 0 + + + 0 + + 1 + OnCopySelections + 1 + + + protected + 1 + + + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + 0 + + + + + 1 + 0 + 1 + + 1 + + 0 + 0 + + Dock + 0 + Left + 0 + 1 + + 1 + + + 0 + 0 + wxID_ANY + Copy All >> + + 0 + + 0 + + + 0 + + 1 + OnCopyAll + 1 + + + protected + 1 + + + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxEXPAND + 1 + + 0 + protected + 0 + + + + 5 + wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + 0 + + + + + 1 + 0 + 1 + + 1 + + 0 + 0 + + Dock + 0 + Left + 0 + 1 + + 1 + + + 0 + 0 + wxID_ANY + Remove << + + 0 + + 0 + + + 0 + + 1 + OnRemoveSelections + 1 + + + protected + 1 + + + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + 0 + + + + + 1 + 0 + 1 + + 1 + + 0 + 0 + + Dock + 0 + Left + 0 + 1 + + 1 + + + 0 + 0 + wxID_ANY + Remove All << + + 0 + + 0 + + + 0 + + 1 + OnRemoveAll + 1 + + + protected + 1 + + + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxEXPAND + 3 + + 0 + protected + 0 + + + + + + 5 + wxEXPAND + 1 + + + bSizer66 + wxVERTICAL + none + + 5 + wxTOP|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + Tray Name: + 0 + + 0 + + + 0 + + 1 + m_staticText46 + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + 5 + wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_comboYGrp + 1 + + + protected + 1 + + Resizable + 0 + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxTOP|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + Tray Contents: + 0 + + 0 + + + 0 + + 1 + m_staticText47 + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + 5 + wxALL|wxEXPAND + 1 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_listTray + 1 + + + protected + 1 + + Resizable + 1 + + wxLB_MULTIPLE + CTrayListBoxWx; forward_declare + 0 + + + + + + + + + + + + diff --git a/GP/CBPlay.xrc b/GP/CBPlay.xrc new file mode 100644 index 0000000..0664ab8 --- /dev/null +++ b/GP/CBPlay.xrc @@ -0,0 +1,2455 @@ + + + + + Change Game File Owner + 1 + + wxHORIZONTAL + + wxEXPAND + 5 + + + wxVERTICAL + + wxTOP|wxRIGHT|wxLEFT + 5 + + + + -1 + + + + wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT + 5 + + + + + 1 + 2 + 3 + 4 + 5 + 6 + + + + + + + + 5 + + + wxVERTICAL + + wxTOP|wxRIGHT|wxLEFT + 5 + + + + 1 + 0 + 0 + + + + + wxALL + 5 + + + + 0 + 0 + 0 + + + + + + + + + + Create Geomorphic Board + 1 + + wxHORIZONTAL + + wxEXPAND + 5 + + + wxVERTICAL + + wxALL + 5 + + + + -1 + + + + wxALL|wxEXPAND + 5 + + + + 0 + + + + wxEXPAND + 5 + + + wxHORIZONTAL + + wxEXPAND + 5 + + + wxVERTICAL + + wxEXPAND|wxTOP|wxRIGHT|wxLEFT + 5 + + + + + + + + wxEXPAND|wxTOP|wxRIGHT|wxLEFT + 5 + + + + 0 + 0 + 0 + + + + + wxALL|wxEXPAND + 5 + + + + 0 + 0 + 0 + + + + + + + wxEXPAND + 5 + + + wxVERTICAL + + wxEXPAND|wxTOP|wxRIGHT|wxLEFT + 5 + + + + + + + + wxALL|wxEXPAND + 5 + + + + 0 + 0 + 0 + + + + + + + + + + + + 5 + + + wxVERTICAL + + wxALL + 5 + + + + 1 + 0 + 0 + + + + + wxALL + 5 + + + + 0 + 0 + 0 + + + + + wxALL + 5 + + + + 0 + 0 + 0 + + + + + + + + + + Create Players + 1 + + wxHORIZONTAL + + wxEXPAND + 5 + + + wxVERTICAL + + wxEXPAND + 5 + + + wxHORIZONTAL + + wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT + 5 + + + + -1 + + + + wxALL|wxALIGN_CENTER_VERTICAL + 5 + + + + 0 + + + + + + wxALL + 5 + + + + -1 + + + + + + + 5 + + + wxVERTICAL + + wxALL + 5 + + + + 1 + 0 + 0 + + + + + wxALL + 5 + + + + 0 + 0 + 0 + + + + + + + + + + Roll Dice + 1 + + wxVERTICAL + + wxEXPAND + 5 + + + wxHORIZONTAL + + wxEXPAND + 5 + + + wxVERTICAL + + + 5 + + + wxVERTICAL + + + 5 + + + wxHORIZONTAL + + wxALL|wxALIGN_CENTER_VERTICAL + 5 + + + + -1 + + + + wxALL|wxALIGN_CENTER_VERTICAL + 5 + + + + 0 + + + + wxALL|wxALIGN_CENTER_VERTICAL + 5 + + + + -1 + + + + + + + + wxEXPAND + 5 + + + 0 + 0 + + + 3 + 5 + + wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT|wxLEFT + 5 + + + + 0 + + + + wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT|wxLEFT + 5 + + + + 0 + + + + wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT|wxLEFT + 5 + + + + -1 + + + + wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT|wxLEFT + 5 + + + + 0 + + + + wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT|wxLEFT + 5 + + + + -1 + + + + wxTOP|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL + 5 + + + + 0 + + + + wxTOP|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL + 5 + + + + 0 + + + + wxTOP|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL + 5 + + + + -1 + + + + wxTOP|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL + 5 + + + + 0 + + + + wxTOP|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL + 5 + + + + -1 + + + + wxALL|wxALIGN_CENTER_VERTICAL + 5 + + + + 0 + + + + wxALL|wxALIGN_CENTER_VERTICAL + 5 + + + + 0 + + + + wxALL|wxALIGN_CENTER_VERTICAL + 5 + + + + -1 + + + + wxALL|wxALIGN_CENTER_VERTICAL + 5 + + + + 0 + + + + wxALL|wxALIGN_CENTER_VERTICAL + 5 + + + + -1 + + + + + + + + + 5 + + + wxVERTICAL + + wxALL + 5 + + + + 1 + 0 + 0 + + + + + wxALL + 5 + + + + 0 + 0 + 0 + + + + + + + + + wxEXPAND + 5 + + + wxHORIZONTAL + + wxALL|wxALIGN_CENTER_VERTICAL + 5 + + + + -1 + + + + wxALL|wxALIGN_CENTER_VERTICAL + 5 + + + + 0 + + + + wxALL|wxALIGN_CENTER_VERTICAL + 5 + + + + -1 + + + + + + wxEXPAND + 5 + + + 0 + 0 + + 1 + 2 + 2 + + wxALL|wxALIGN_CENTER_VERTICAL + 5 + + + + -1 + + + + wxALL|wxEXPAND|wxALIGN_CENTER_VERTICAL + 5 + + + + 0 + + + + wxEXPAND + 5 + + 0,0 + + + wxALL|wxEXPAND + 5 + + + + 0 + 0 + 0 + + + + + + + + + + Enter Object Text + 1 + + wxHORIZONTAL + + wxEXPAND + 5 + + + wxVERTICAL + + wxTOP|wxRIGHT|wxLEFT + 5 + + + + -1 + + + + wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT + 5 + + + + 1\n2\n3\n4\n5\n6 + 0 + + + + wxALL + 5 + + + + 0 + + + + + + + 5 + + + wxVERTICAL + + wxALL + 5 + + + + 1 + 0 + 0 + + + + + wxALL + 5 + + + + 0 + 0 + 0 + + + + + + + + + + Edit Player Names + 1 + + wxHORIZONTAL + + wxEXPAND + 5 + + + wxVERTICAL + + wxTOP|wxRIGHT|wxLEFT + 5 + + + + -1 + + + + wxEXPAND|wxALL + 5 + + + + + + + + wxTOP|wxRIGHT|wxLEFT + 5 + + + + -1 + + + + wxALL|wxEXPAND + 5 + + + + 0 + + + + wxALL|wxALIGN_CENTER_HORIZONTAL + 5 + + + + 0 + 0 + 0 + + + + + + + + 5 + + + wxVERTICAL + + wxALL + 5 + + + + 1 + 0 + 0 + + + + + wxALL + 5 + + + + 0 + 0 + 0 + + + + + + + + + + Import Piece Groups + 1 + + wxHORIZONTAL + + wxEXPAND + 5 + + + wxVERTICAL + + wxTOP|wxRIGHT|wxLEFT + 5 + + + + -1 + + + + wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND + 5 + + + + + + + + wxEXPAND + 5 + + + wxHORIZONTAL + + wxALL + 5 + + + + 0 + 0 + 0 + + + + + wxEXPAND + 5 + + 0,0 + + + wxALL + 5 + + + + 0 + 0 + 0 + + + + + + + + + + 5 + + + wxVERTICAL + + wxALL + 5 + + + + 1 + 0 + 0 + + + + + wxALL + 5 + + + + 0 + 0 + 0 + + + + + + + + + + Enter Marker Count + 1 + + wxHORIZONTAL + + wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT + 5 + + + + -1 + + + + wxALL|wxALIGN_CENTER_VERTICAL + 5 + + + + 0 + + + + wxEXPAND + 5 + + + wxVERTICAL + + wxALL + 5 + + + + 1 + 0 + 0 + + + + + wxALL + 5 + + + + 0 + 0 + 0 + + + + + + + + + + Enter Move Description + 1 + + wxVERTICAL + + wxEXPAND + 5 + + + wxHORIZONTAL + + wxEXPAND + 5 + + + wxVERTICAL + + wxALL + 5 + + + + -1 + + + + wxEXPAND + 5 + + 0,0 + + + wxTOP|wxRIGHT|wxLEFT + 5 + + + + -1 + + + + + + + 5 + + + wxVERTICAL + + wxALL + 5 + + + + 1 + 0 + 0 + + + + + wxALL + 5 + + + + 0 + 0 + 0 + + + + + + + + + wxALL|wxEXPAND + 5 + + + + 0 + + + + wxTOP|wxRIGHT|wxLEFT + 5 + + + + -1 + + + + wxALL|wxEXPAND + 5 + + + + \n\n\n\n\n\n\n\n\n + 0 + + + + + + + Creating Multiplayer Game + 1 + + wxHORIZONTAL + + wxEXPAND + 5 + + + wxVERTICAL + + wxALL + 5 + + + + -1 + + + + wxALL + 5 + + + + 0 + + + + wxALL + 5 + + + + -1 + + + + wxALL|wxEXPAND + 5 + + + + + + + + wxALL|wxEXPAND + 5 + + + + 0 + + + + wxALL|wxALIGN_CENTER_HORIZONTAL + 5 + + + + 0 + 0 + 0 + + + + + + + + 5 + + + wxVERTICAL + + wxALL + 5 + + + + 1 + 0 + 0 + + + + + wxALL + 5 + + + + 0 + 0 + 0 + + + + + + + + + + Enter Password + 1 + + wxHORIZONTAL + + wxEXPAND + 5 + + + wxVERTICAL + + wxTOP|wxRIGHT|wxLEFT + 5 + + + + -1 + + + + wxALL + 5 + + + + + 0 + + + + + + + 5 + + + wxVERTICAL + + wxALL + 5 + + + + 1 + 0 + 0 + + + + + wxALL + 5 + + + + 0 + 0 + 0 + + + + + + + + + + Board Properties + 1 + + wxVERTICAL + + wxEXPAND + 5 + + + wxHORIZONTAL + + wxEXPAND + 5 + + + wxVERTICAL + + wxTOP|wxRIGHT|wxLEFT + 5 + + + + -1 + + + + wxALL|wxEXPAND + 5 + + + + 0 + + + + wxTOP|wxRIGHT|wxLEFT + 5 + + + + -1 + + + + + + + 5 + + + wxVERTICAL + + wxALL + 5 + + + + 1 + 0 + 0 + + + + + wxALL + 5 + + + + 0 + 0 + 0 + + + + + + + + + wxALL|wxEXPAND + 5 + + + 0 + + + + + wxTOP|wxRIGHT|wxLEFT + 5 + + + + 0 + + + + wxTOP|wxRIGHT|wxLEFT + 5 + + + + 0 + + + + wxTOP|wxRIGHT|wxLEFT + 5 + + + + 0 + + + + wxTOP|wxRIGHT|wxLEFT + 5 + + + + 0 + + + + wxALL + 5 + + + + 0 + + + + wxALL + 5 + + + wxVERTICAL + + + wxEXPAND + 5 + + + 0 + 0 + + + 2 + 4 + + wxALIGN_CENTER_VERTICAL|wxTOP|wxLEFT + 5 + + + + -1 + + + + wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT|wxLEFT + 5 + + + + 0 + + + + wxALIGN_CENTER_VERTICAL|wxTOP|wxLEFT + 5 + + + + -1 + + + + wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT|wxLEFT + 5 + + + + 0 + + + + wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT + 5 + + + + -1 + + + + wxALL|wxALIGN_CENTER_VERTICAL + 5 + + + + 0 + + + + wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT + 5 + + + + -1 + + + + wxALL|wxALIGN_CENTER_VERTICAL + 5 + + + + 0 + + + + + + wxTOP|wxRIGHT|wxLEFT + 5 + + + + 0 + + + + wxTOP|wxRIGHT|wxLEFT + 5 + + + + 0 + + + + wxTOP|wxRIGHT|wxLEFT + 5 + + + + 0 + + + + + + wxALL + 5 + + + wxVERTICAL + + + wxTOP|wxRIGHT|wxLEFT + 5 + + + + 0 + + + + wxALL + 5 + + + + 0 + + + + + + + 5 + + + wxHORIZONTAL + + wxEXPAND|wxALL + 5 + + + wxVERTICAL + + + wxEXPAND + 5 + + + 0 + 0 + + + 2 + 3 + + wxALIGN_CENTER_VERTICAL|wxTOP|wxLEFT + 5 + + + + -1 + + + + wxALIGN_CENTER_VERTICAL|wxTOP|wxLEFT + 5 + + + + 0 + + + + wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT|wxLEFT + 5 + + + + -1 + + + + wxTOP|wxBOTTOM|wxLEFT|wxALIGN_CENTER_VERTICAL + 5 + + + + -1 + + + + wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT + 5 + + + + 0 + + + + wxALL|wxALIGN_CENTER_VERTICAL + 5 + + + + -1 + + + + + + + + wxEXPAND|wxALL + 5 + + + wxVERTICAL + + + wxEXPAND + 5 + + + 0 + 0 + + + 2 + 2 + + wxALIGN_CENTER_VERTICAL|wxTOP|wxLEFT + 5 + + + + -1 + + + + wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT|wxLEFT + 5 + + + + #000000 + + + + wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT + 5 + + + + -1 + + + + wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND + 5 + + + + 0 + + 1 + 2 + 3 + 4 + 5 + + + + + + + + + + + + + + Rotate Object + 1 + + wxHORIZONTAL + + wxEXPAND|wxTOP|wxBOTTOM|wxRIGHT + 5 + + + 4 + 2 + 0 + 0 + + wxLEFT|wxEXPAND + 5 + + + + + 0 + 0 + 0 + + + + + wxLEFT|wxEXPAND + 5 + + + + + 0 + 0 + 0 + + + + + wxLEFT|wxEXPAND + 5 + + + + + 0 + 0 + 0 + + + + + wxLEFT|wxEXPAND + 5 + + + + + 0 + 0 + 0 + + + + + wxLEFT|wxEXPAND + 5 + + + + + 0 + 0 + 0 + + + + + wxLEFT|wxEXPAND + 5 + + + + + 0 + 0 + 0 + + + + + wxLEFT|wxEXPAND + 5 + + + + + 0 + 0 + 0 + + + + + wxLEFT|wxEXPAND + 5 + + + + + 0 + 0 + 0 + + + + + + + wxEXPAND|wxLEFT + 5 + + + wxVERTICAL + + wxALL|wxEXPAND + 5 + + + + + 1 + 0 + 0 + + + + + wxALL|wxEXPAND + 5 + + + + + 0 + 0 + 0 + + + + + wxEXPAND + 5 + + 0,0 + + + wxALL + 5 + + + + + 0 + + + + + + + + + Scenario Properties + 1 + + wxVERTICAL + + wxEXPAND + 5 + + + wxHORIZONTAL + + wxEXPAND + 5 + + + wxVERTICAL + + wxTOP|wxRIGHT|wxLEFT + 5 + + + + -1 + + + + wxALL|wxEXPAND + 5 + + + + 0 + + + + wxTOP|wxRIGHT|wxLEFT + 5 + + + + -1 + + + + + + + 5 + + + wxVERTICAL + + wxALL + 5 + + + + 1 + 0 + 0 + + + + + wxALL + 5 + + + + 0 + 0 + 0 + + + + + + + + + wxALL|wxEXPAND + 5 + + + MMMMMMMMMMMMMMMMMMMMMMMMMMMMM + 0 + + + + wxTOP|wxRIGHT|wxLEFT + 5 + + + + -1 + + + + wxALL|wxEXPAND + 5 + + + + 1\n2\n3\n4\n5\n6 + 0 + + + + + + + Select Boards + 1 + + wxHORIZONTAL + + wxEXPAND + 5 + + + wxVERTICAL + + wxTOP|wxRIGHT|wxLEFT + 5 + + + + -1 + + + + wxALL|wxEXPAND + 5 + + + + + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + + + + + wxEXPAND + 5 + + + wxHORIZONTAL + + wxALL + 5 + + + + 0 + 0 + 0 + + + + + wxEXPAND + 5 + + 0,0 + + + wxALL + 5 + + + + 0 + 0 + 0 + + + + + + + + + + 5 + + + wxVERTICAL + + wxALL + 5 + + + + 1 + 0 + 0 + + + + + wxALL + 5 + + + + 0 + 0 + 0 + + + + + + + + + + Select New Owner + 1 + + wxHORIZONTAL + + wxEXPAND + 5 + + + wxVERTICAL + + wxTOP|wxRIGHT|wxLEFT + 5 + + + + -1 + + + + wxALL|wxEXPAND + 5 + + + + + 1 + 2 + 3 + 4 + 5 + 6 + + + + + + + + 5 + + + wxVERTICAL + + wxALL + 5 + + + + 1 + 0 + 0 + + + + + wxALL + 5 + + + + 0 + 0 + 0 + + + + + + + + + + Send Message + 1 + + wxVERTICAL + + wxEXPAND|wxTOP|wxRIGHT|wxLEFT + 5 + + + + + 0 + + + + wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT + 5 + + + + 1\n2\n3\n4\n5 + 0 + + + + wxEXPAND + 5 + + + wxHORIZONTAL + + wxTOP|wxBOTTOM|wxLEFT + 5 + + + + 1 + 0 + 0 + + + + + wxTOP|wxBOTTOM + 5 + + + + 0 + 0 + 0 + + + + + wxTOP|wxBOTTOM|wxRIGHT + 5 + + + + 0 + 0 + 0 + + + + + wxEXPAND + 5 + + 0,0 + + + wxTOP|wxBOTTOM|wxLEFT + 5 + + + + 0 + 0 + 0 + + + + + wxTOP|wxBOTTOM|wxRIGHT + 5 + + + + 0 + 0 + 0 + + + + + + + + + + Setup Pieces + 1 + + 500,375 + wxHORIZONTAL + + wxEXPAND + 5 + + + wxVERTICAL + + wxTOP|wxRIGHT|wxLEFT + 5 + + + + -1 + + + + wxALL|wxEXPAND + 5 + + + 0 + + + + + wxTOP|wxRIGHT|wxLEFT + 5 + + + + -1 + + + + wxALL|wxEXPAND + 5 + + + + + + + + + wxEXPAND + 5 + + + wxVERTICAL + + wxEXPAND + 5 + + 0,0 + + + wxALL|wxEXPAND + 5 + + + + 1 + 0 + 0 + + + + + wxEXPAND + 5 + + 0,0 + + + wxALL|wxEXPAND + 5 + + + + 0 + 0 + 0 + + + + + wxALL|wxEXPAND + 5 + + + + 0 + 0 + 0 + + + + + wxEXPAND + 5 + + 0,0 + + + wxALL|wxEXPAND + 5 + + + + 0 + 0 + 0 + + + + + wxALL|wxEXPAND + 5 + + + + 0 + 0 + 0 + + + + + wxEXPAND + 5 + + 0,0 + + + + + wxEXPAND + 5 + + + wxVERTICAL + + wxTOP|wxRIGHT|wxLEFT + 5 + + + + -1 + + + + wxALL|wxEXPAND + 5 + + + 0 + + + + + wxTOP|wxRIGHT|wxLEFT + 5 + + + + -1 + + + + wxALL|wxEXPAND + 5 + + + + + + + + + + diff --git a/GP/CBPlay32.vcxproj b/GP/CBPlay32.vcxproj index 3e67f25..24ba1e9 100644 --- a/GP/CBPlay32.vcxproj +++ b/GP/CBPlay32.vcxproj @@ -129,7 +129,7 @@ echo off 0x0409 - wxbase33u.lib;wxmsw33u_core.lib;wxpng.lib;wxzlib.lib;htmlhelp.lib;rpcrt4.lib;%(AdditionalDependencies) + wxbase33u.lib;wxbase33u_xml.lib;wxmsw33u_core.lib;wxmsw33u_html.lib;wxmsw33u_xrc.lib;wxexpat.lib;wxpng.lib;wxzlib.lib;htmlhelp.lib;rpcrt4.lib;%(AdditionalDependencies) true true false @@ -186,7 +186,7 @@ echo off Windows ..\out\build\x64-Release\deps\wxWidgets\lib\vc_x64_lib - wxbase33u.lib;wxmsw33u_core.lib;wxpng.lib;wxzlib.lib;htmlhelp.lib;rpcrt4.lib;%(AdditionalDependencies) + wxbase33u.lib;wxbase33u_xml.lib;wxmsw33u_core.lib;wxmsw33u_html.lib;wxmsw33u_xrc.lib;wxexpat.lib;wxpng.lib;wxzlib.lib;htmlhelp.lib;rpcrt4.lib;%(AdditionalDependencies) @@ -230,7 +230,7 @@ echo off 0x0409 - wxbase33ud.lib;wxmsw33ud_core.lib;wxpngd.lib;wxzlibd.lib;htmlhelp.lib;rpcrt4.lib;%(AdditionalDependencies) + wxbase33ud.lib;wxbase33ud_xml.lib;wxmsw33ud_core.lib;wxmsw33ud_html.lib;wxmsw33ud_xrc.lib;wxexpatd.lib;wxpngd.lib;wxzlibd.lib;htmlhelp.lib;rpcrt4.lib;%(AdditionalDependencies) true true false @@ -280,7 +280,7 @@ echo off 0x0409 - wxbase33ud.lib;wxmsw33ud_core.lib;wxpngd.lib;wxzlibd.lib;htmlhelp.lib;rpcrt4.lib;%(AdditionalDependencies) + wxbase33ud.lib;wxbase33ud_xml.lib;wxmsw33ud_core.lib;wxmsw33ud_html.lib;wxmsw33ud_xrc.lib;wxexpatd.lib;wxpngd.lib;wxzlibd.lib;htmlhelp.lib;rpcrt4.lib;%(AdditionalDependencies) true true false @@ -311,7 +311,6 @@ echo off - @@ -424,7 +423,6 @@ echo off - diff --git a/GP/CMakeLists.txt b/GP/CMakeLists.txt index 03b9b77..802ad0d 100644 --- a/GP/CMakeLists.txt +++ b/GP/CMakeLists.txt @@ -15,7 +15,6 @@ set(SRCS DlgNPly.cpp DlgPass.cpp DlgPbprp.cpp - DlgRot.cpp DlgRotpc.cpp DlgScnp.cpp DlgSelOwner.cpp @@ -136,3 +135,12 @@ if (MSVC) endif() target_precompile_headers(CBPlay PRIVATE StdAfx.h) target_link_libraries(CBPlay wx::core wx::xrc) + +add_custom_command( + OUTPUT "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/CBPlay.xrc" + COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${CMAKE_CURRENT_SOURCE_DIR}/CBPlay.xrc" "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/CBPlay.xrc" + DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/CBPlay.xrc" + VERBATIM +) +add_custom_target(CBPlay_copy_files DEPENDS ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/CBPlay.xrc) +add_dependencies(CBPlay CBPlay_copy_files) diff --git a/GP/Cbplay32.vcxproj.filters b/GP/Cbplay32.vcxproj.filters index 5d381d8..3367882 100644 --- a/GP/Cbplay32.vcxproj.filters +++ b/GP/Cbplay32.vcxproj.filters @@ -69,9 +69,6 @@ Source Files - - Source Files - Source Files @@ -385,9 +382,6 @@ Header Files - - Header Files - Header Files diff --git a/GP/DlgChgGameOwner.cpp b/GP/DlgChgGameOwner.cpp index 41ff860..d775224 100644 --- a/GP/DlgChgGameOwner.cpp +++ b/GP/DlgChgGameOwner.cpp @@ -1,6 +1,6 @@ // DlgChangeOwner.cpp : implementation file // -// Copyright (c) 1994-2020 By Dale L. Larson, All Rights Reserved. +// Copyright (c) 1994-2025 By Dale L. Larson & William Su, All Rights Reserved. // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the @@ -36,62 +36,57 @@ static char THIS_FILE[] = __FILE__; ///////////////////////////////////////////////////////////////////////////// // CChgGameOwnerDialog dialog -CChgGameOwnerDialog::CChgGameOwnerDialog(CWnd* pParent /*=NULL*/) - : CDialog(CChgGameOwnerDialog::IDD, pParent) +CChgGameOwnerDialog::CChgGameOwnerDialog(CPlayerManager& pm, wxWindow* pParent /*= &CB::GetMainWndWx()*/) : + CB_XRC_BEGIN_CTRLS_DEFN(pParent, CChgGameOwnerDialog) + , m_btnOK(XRCCTRL(*this, "wxID_OK", std::remove_reference_t)) + CB_XRC_CTRL(m_listPlayers) + CB_XRC_END_CTRLS_DEFN(), + m_pPlayerMgr(&pm) { - //{{AFX_DATA_INIT(CChgGameOwnerDialog) - // NOTE: the ClassWizard will add member initialization here - //}}AFX_DATA_INIT - - m_nPlayer = -1; - m_pPlayerMgr = NULL; -} - -void CChgGameOwnerDialog::DoDataExchange(CDataExchange* pDX) -{ - CDialog::DoDataExchange(pDX); - //{{AFX_DATA_MAP(CChgGameOwnerDialog) - DDX_Control(pDX, IDOK, m_btnOK); - DDX_Control(pDX, IDC_D_CHGGAMEOWN_LIST, m_listPlayers); - //}}AFX_DATA_MAP + m_nPlayer = INVALID_PLAYER; } -BEGIN_MESSAGE_MAP(CChgGameOwnerDialog, CDialog) - //{{AFX_MSG_MAP(CChgGameOwnerDialog) - ON_LBN_SELCHANGE(IDC_D_CHGGAMEOWN_LIST, OnSelChangePlayerList) - ON_LBN_DBLCLK(IDC_D_CHGGAMEOWN_LIST, OnDblClkPlayerList) - //}}AFX_MSG_MAP -END_MESSAGE_MAP() +wxBEGIN_EVENT_TABLE(CChgGameOwnerDialog, wxDialog) + EVT_LISTBOX(XRCID("m_listPlayers"), OnSelChangePlayerList) + EVT_LISTBOX_DCLICK(XRCID("m_listPlayers"), OnDblClkPlayerList) +wxEND_EVENT_TABLE() ///////////////////////////////////////////////////////////////////////////// // CChgGameOwnerDialog message handlers -void CChgGameOwnerDialog::OnOK() +bool CChgGameOwnerDialog::TransferDataFromWindow() { - m_nPlayer = m_listPlayers.GetCurSel(); - CDialog::OnOK(); + if (!wxDialog::TransferDataFromWindow()) + { + return false; + } + + m_nPlayer = PlayerId(m_listPlayers->GetSelection()); + + return true; } -BOOL CChgGameOwnerDialog::OnInitDialog() +bool CChgGameOwnerDialog::TransferDataToWindow() { - CDialog::OnInitDialog(); - - for (int i = 0; i < m_pPlayerMgr->GetSize(); i++) - m_listPlayers.AddString(m_pPlayerMgr->ElementAt(i).m_strName); + m_listPlayers->Clear(); + for (const Player& player : *m_pPlayerMgr) + m_listPlayers->AppendString(player.m_strName); - if (m_nPlayer >= 0) - m_listPlayers.SetCurSel(m_nPlayer); - m_btnOK.EnableWindow(m_listPlayers.GetCurSel() >= 0); + if (m_nPlayer != INVALID_PLAYER) + m_listPlayers->SetSelection(static_cast(m_nPlayer)); + m_btnOK->Enable(m_listPlayers->GetSelection() != wxNOT_FOUND); - return TRUE; // return TRUE unless you set the focus to a control + return wxDialog::TransferDataToWindow(); } -void CChgGameOwnerDialog::OnSelChangePlayerList() +void CChgGameOwnerDialog::OnSelChangePlayerList(wxCommandEvent& /*event*/) { - m_btnOK.EnableWindow(m_listPlayers.GetCurSel() >= 0); + m_btnOK->Enable(m_listPlayers->GetSelection() != wxNOT_FOUND); } -void CChgGameOwnerDialog::OnDblClkPlayerList() +void CChgGameOwnerDialog::OnDblClkPlayerList(wxCommandEvent& /*event*/) { - OnOK(); + wxCommandEvent event(wxEVT_BUTTON, m_btnOK->GetId()); + event.SetEventObject(&*m_btnOK); + m_btnOK->HandleWindowEvent(event); } diff --git a/GP/DlgChgGameOwner.h b/GP/DlgChgGameOwner.h index 0115365..ecbba7e 100644 --- a/GP/DlgChgGameOwner.h +++ b/GP/DlgChgGameOwner.h @@ -1,6 +1,6 @@ // DlgSelOwner.h : header file // -// Copyright (c) 1994-2020 By Dale L. Larson, All Rights Reserved. +// Copyright (c) 1994-2025 By Dale L. Larson & William Su, All Rights Reserved. // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the @@ -33,42 +33,37 @@ ///////////////////////////////////////////////////////////////////////////// // CSelectNewOwnerDialog dialog -class CChgGameOwnerDialog : public CDialog +class CChgGameOwnerDialog : public wxDialog { // Construction public: - CChgGameOwnerDialog(CWnd* pParent = NULL); // standard constructor + CChgGameOwnerDialog(CPlayerManager& pm, wxWindow* pParent = &CB::GetMainWndWx()); // standard constructor // Dialog Data - //{{AFX_DATA(CChgGameOwnerDialog ) - enum { IDD = IDD_CHANGE_GAME_OWNER }; - CButton m_btnOK; - CListBox m_listPlayers; - //}}AFX_DATA + PlayerId m_nPlayer; + RefPtr m_pPlayerMgr; - int m_nPlayer; - CPlayerManager* m_pPlayerMgr; +private: + CB_XRC_BEGIN_CTRLS_DECL() + RefPtr m_btnOK; + RefPtr m_listPlayers; + CB_XRC_END_CTRLS_DECL() +public: // Overrides - // ClassWizard generated virtual function overrides - //{{AFX_VIRTUAL(CChgGameOwnerDialog) - protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support - //}}AFX_VIRTUAL // Implementation protected: + bool TransferDataToWindow() override; + bool TransferDataFromWindow() override; - // Generated message map functions - //{{AFX_MSG(CChgGameOwnerDialog ) - virtual void OnOK(); - virtual BOOL OnInitDialog(); - afx_msg void OnSelChangePlayerList(); - afx_msg void OnDblClkPlayerList(); + void OnSelChangePlayerList(wxCommandEvent& event); + void OnDblClkPlayerList(wxCommandEvent& event); +#if 0 afx_msg BOOL OnHelpInfo(HELPINFO* pHelpInfo); afx_msg void OnContextMenu(CWnd* pWnd, CPoint point); - //}}AFX_MSG - DECLARE_MESSAGE_MAP() +#endif + wxDECLARE_EVENT_TABLE(); }; #endif diff --git a/GP/DlgDice.cpp b/GP/DlgDice.cpp index 5a10cdc..330d114 100644 --- a/GP/DlgDice.cpp +++ b/GP/DlgDice.cpp @@ -1,6 +1,6 @@ // DlgDice.cpp : implementation file // -// Copyright (c) 1994-2023 By Dale L. Larson & William Su, All Rights Reserved. +// Copyright (c) 1994-2025 By Dale L. Larson & William Su, All Rights Reserved. // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the @@ -91,10 +91,24 @@ CArchive& operator>>(CArchive& ar, CRollState& rs) ///////////////////////////////////////////////////////////////////////////// // CDieRollerDlg dialog -CDieRollerDlg::CDieRollerDlg(CWnd* pParent /*=NULL*/) - : CDialog(CDieRollerDlg::IDD, pParent) +CDieRollerDlg::CDieRollerDlg(wxWindow* pParent /*= &CB::GetMainWndWx()*/) : + CB_XRC_BEGIN_CTRLS_DEFN(pParent, CDieRollerDlg) + CB_XRC_CTRL(m_btnResetSeed) + CB_XRC_CTRL_VAL(m_editSeed, m_strSeed, wxFILTER_ASCII, 40) + , m_btnOK(XRCCTRL(*this, "wxID_OK", std::remove_reference_t)) + CB_XRC_CTRL_VAL(m_chkRoll3, m_bRoll3) + CB_XRC_CTRL_VAL(m_chkRoll2, m_bRoll2) + CB_XRC_CTRL_VAL(m_chkRoll1, m_bRoll1) + CB_XRC_CTRL_VAL(m_editSets, m_nSets, uint32_t(1), uint32_t(75)) + CB_XRC_CTRL_VAL(m_editDice1, m_nDice1, uint32_t(0), uint32_t(100)) + CB_XRC_CTRL_VAL(m_editFaces1, m_nFaces1, uint32_t(2), uint32_t(32767)) + CB_XRC_CTRL_VAL(m_editDice2, m_nDice2, uint32_t(0), uint32_t(100)) + CB_XRC_CTRL_VAL(m_editFaces2, m_nFaces2, uint32_t(2), uint32_t(32767)) + CB_XRC_CTRL_VAL(m_editDice3, m_nDice3, uint32_t(0), uint32_t(100)) + CB_XRC_CTRL_VAL(m_editFaces3, m_nFaces3, uint32_t(2), uint32_t(32767)) + CB_XRC_CTRL_VAL(m_editBias, m_nBias, -5000, 5000) + CB_XRC_END_CTRLS_DEFN() { - //{{AFX_DATA_INIT(CDieRollerDlg) m_strSeed = ""; m_nFaces1 = uint32_t(6); m_nFaces2 = uint32_t(6); @@ -107,59 +121,41 @@ CDieRollerDlg::CDieRollerDlg(CWnd* pParent /*=NULL*/) m_bRoll3 = FALSE; m_nBias = int32_t(0); m_nSets = uint32_t(1); - //}}AFX_DATA_INIT m_bFirstRoll = TRUE; m_strInitialSeed = ""; -} -void CDieRollerDlg::DoDataExchange(CDataExchange* pDX) -{ - CDialog::DoDataExchange(pDX); - //{{AFX_DATA_MAP(CDieRollerDlg) - DDX_Control(pDX, IDC_DIE_RESET_SEED, m_btnResetSeed); - DDX_Control(pDX, IDC_DIE_SEED, m_editSeed); - DDX_Control(pDX, IDOK, m_btnOK); - DDX_Control(pDX, IDC_DIE_ROLL3, m_chkRoll3); - DDX_Control(pDX, IDC_DIE_ROLL2, m_chkRoll2); - DDX_Control(pDX, IDC_DIE_ROLL1, m_chkRoll1); - DDX_Text(pDX, IDC_DIE_SEED, m_strSeed); - DDV_MaxChars(pDX, m_strSeed, 40); - DDX_Text(pDX, IDC_DIE_FACES1, m_nFaces1); - DDV_MinMaxUInt(pDX, m_nFaces1, 2, 32767); - DDX_Text(pDX, IDC_DIE_FACES2, m_nFaces2); - DDV_MinMaxUInt(pDX, m_nFaces2, 2, 32767); - DDX_Text(pDX, IDC_DIE_FACES3, m_nFaces3); - DDV_MinMaxUInt(pDX, m_nFaces3, 2, 32767); - DDX_Text(pDX, IDC_DIE_NUMDIES1, m_nDice1); - DDV_MinMaxUInt(pDX, m_nDice1, 0, 100); - DDX_Text(pDX, IDC_DIE_NUMDIES2, m_nDice2); - DDV_MinMaxUInt(pDX, m_nDice2, 0, 100); - DDX_Text(pDX, IDC_DIE_NUMDIES3, m_nDice3); - DDV_MinMaxUInt(pDX, m_nDice3, 0, 100); - DDX_Check(pDX, IDC_DIE_ROLL1, m_bRoll1); - DDX_Check(pDX, IDC_DIE_ROLL2, m_bRoll2); - DDX_Check(pDX, IDC_DIE_ROLL3, m_bRoll3); - DDX_Text(pDX, IDC_DIE_BIAS, m_nBias); - DDV_MinMaxInt(pDX, m_nBias, -5000, 5000); - DDX_Text(pDX, IDC_DIE_SETS, m_nSets); - DDV_MinMaxUInt(pDX, m_nSets, 1, 75); - //}}AFX_DATA_MAP + // KLUDGE: don't see a way to use GetSizeFromText() in .xrc + wxSize editSize = m_editSets->GetSizeFromText("999"); + m_editSets->SetInitialSize(editSize); + m_editDice1->SetInitialSize(editSize); + m_editDice2->SetInitialSize(editSize); + m_editDice3->SetInitialSize(editSize); + editSize = m_editFaces1->GetSizeFromText("99999"); + m_editFaces1->SetInitialSize(editSize); + m_editFaces2->SetInitialSize(editSize); + m_editFaces3->SetInitialSize(editSize); + m_editBias->SetInitialSize(editSize); + SetMinSize(wxDefaultSize); + Layout(); + Fit(); + Centre(); } -BEGIN_MESSAGE_MAP(CDieRollerDlg, CDialog) - //{{AFX_MSG_MAP(CDieRollerDlg) - ON_BN_CLICKED(IDC_DIE_ROLL1, OnDieRoll1) - ON_BN_CLICKED(IDC_DIE_ROLL2, OnDieRoll2) - ON_BN_CLICKED(IDC_DIE_ROLL3, OnDieRoll3) - ON_EN_CHANGE(IDC_DIE_NUMDIES1, OnChangeDieNumdies1) - ON_EN_CHANGE(IDC_DIE_NUMDIES2, OnChangeDieNumdies2) - ON_EN_CHANGE(IDC_DIE_NUMDIES3, OnChangeDieNumdies3) - ON_BN_CLICKED(IDC_DIE_RESET_SEED, OnDieResetSeed) +wxBEGIN_EVENT_TABLE(CDieRollerDlg, wxDialog) + EVT_CHECKBOX(XRCID("m_chkRoll1"), OnDieRoll1) + EVT_CHECKBOX(XRCID("m_chkRoll2"), OnDieRoll2) + EVT_CHECKBOX(XRCID("m_chkRoll3"), OnDieRoll3) + EVT_TEXT(XRCID("m_editDice1"), OnChangeDieNumdies1) + EVT_TEXT(XRCID("m_editDice2"), OnChangeDieNumdies2) + EVT_TEXT(XRCID("m_editDice3"), OnChangeDieNumdies3) + EVT_BUTTON(XRCID("m_btnResetSeed"), OnDieResetSeed) +#if 0 ON_WM_HELPINFO() ON_WM_CONTEXTMENU() - //}}AFX_MSG_MAP -END_MESSAGE_MAP() +#endif +wxEND_EVENT_TABLE() +#if 0 ///////////////////////////////////////////////////////////////////////////// // Html Help control ID Map @@ -184,6 +180,7 @@ static DWORD adwHelpMap[] = IDC_DIE_SETS, IDH_DIE_SETS, 0, 0 }; +#endif ///////////////////////////////////////////////////////////////////////////// @@ -340,7 +337,7 @@ void CDieRollerDlg::SetRollState(const CRollState& rstate) { m_bFirstRoll = rstate.m_bFirstRoll; m_nSets = rstate.m_nSetsToRoll; - m_strSeed = rstate.m_strUserSeed; + m_strSeed = rstate.m_strUserSeed.wx_str(); m_strInitialSeed = rstate.m_strUserSeed; // Saved to detect changes m_nSeedCarryOver = rstate.m_nSeedCarryOver; @@ -364,79 +361,93 @@ void CDieRollerDlg::SetRollState(const CRollState& rstate) bool CDieRollerDlg::IsAnyDieSelected() const { - return (m_chkRoll1.GetCheck() && GetDlgItemInt(IDC_DIE_NUMDIES1) > 0) || - (m_chkRoll2.GetCheck() && GetDlgItemInt(IDC_DIE_NUMDIES2) > 0) || - (m_chkRoll3.GetCheck() && GetDlgItemInt(IDC_DIE_NUMDIES3) > 0); + static const auto GetDlgItemInt = [](const wxTextCtrl& tc) -> int + { + CB::string s = tc.GetValue(); + return std::stoi(s.w_str()); + }; + return (m_chkRoll1->GetValue() && GetDlgItemInt(*m_editDice1) > 0) || + (m_chkRoll2->GetValue() && GetDlgItemInt(*m_editDice2) > 0) || + (m_chkRoll3->GetValue() && GetDlgItemInt(*m_editDice3) > 0); } ///////////////////////////////////////////////////////////////////////////// void CDieRollerDlg::UpdateControls() { - m_btnOK.EnableWindow(IsAnyDieSelected()); + m_btnOK->Enable(IsAnyDieSelected()); } ///////////////////////////////////////////////////////////////////////////// // CDieRollerDlg message handlers -BOOL CDieRollerDlg::OnInitDialog() +bool CDieRollerDlg::TransferDataToWindow() { - CDialog::OnInitDialog(); + if (!wxDialog::TransferDataToWindow()) + { + return false; + } UpdateControls(); if (!m_bFirstRoll && !m_strSeed.empty()) - m_editSeed.EnableWindow(FALSE); + m_editSeed->Enable(false); else - m_btnResetSeed.EnableWindow(FALSE); + m_btnResetSeed->Enable(false); return TRUE; } -void CDieRollerDlg::OnOK() +bool CDieRollerDlg::TransferDataFromWindow() { - CDialog::OnOK(); - if (m_strInitialSeed != m_strSeed) + if (!wxDialog::TransferDataFromWindow()) + { + return false; + } + if (m_strInitialSeed.wx_str() != m_strSeed) m_bFirstRoll = TRUE; MakeFormattedRollResult(); + + return true; } -void CDieRollerDlg::OnDieRoll1() +void CDieRollerDlg::OnDieRoll1(wxCommandEvent& /*event*/) { UpdateControls(); } -void CDieRollerDlg::OnDieRoll2() +void CDieRollerDlg::OnDieRoll2(wxCommandEvent& /*event*/) { UpdateControls(); } -void CDieRollerDlg::OnDieRoll3() +void CDieRollerDlg::OnDieRoll3(wxCommandEvent& /*event*/) { UpdateControls(); } -void CDieRollerDlg::OnChangeDieNumdies1() +void CDieRollerDlg::OnChangeDieNumdies1(wxCommandEvent& /*event*/) { UpdateControls(); } -void CDieRollerDlg::OnChangeDieNumdies2() +void CDieRollerDlg::OnChangeDieNumdies2(wxCommandEvent& /*event*/) { UpdateControls(); } -void CDieRollerDlg::OnChangeDieNumdies3() +void CDieRollerDlg::OnChangeDieNumdies3(wxCommandEvent& /*event*/) { UpdateControls(); } -void CDieRollerDlg::OnDieResetSeed() +void CDieRollerDlg::OnDieResetSeed(wxCommandEvent& /*event*/) { - m_editSeed.EnableWindow(TRUE); - m_btnResetSeed.EnableWindow(FALSE); + m_editSeed->Enable(true); + m_btnResetSeed->Enable(false); m_bFirstRoll = TRUE; } +#if 0 BOOL CDieRollerDlg::OnHelpInfo(HELPINFO* pHelpInfo) { return GetApp()->DoHelpTipHelp(pHelpInfo, adwHelpMap); @@ -446,4 +457,5 @@ void CDieRollerDlg::OnContextMenu(CWnd* pWnd, CPoint point) { GetApp()->DoHelpWhatIsHelp(pWnd, adwHelpMap); } +#endif diff --git a/GP/DlgDice.h b/GP/DlgDice.h index daab2ea..af76eff 100644 --- a/GP/DlgDice.h +++ b/GP/DlgDice.h @@ -1,6 +1,6 @@ // DlgDice.h : header file // -// Copyright (c) 1994-2023 By Dale L. Larson & William Su, All Rights Reserved. +// Copyright (c) 1994-2025 By Dale L. Larson & William Su, All Rights Reserved. // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the @@ -66,11 +66,11 @@ CArchive& operator>>(CArchive& ar, CRollState& rs); ///////////////////////////////////////////////////////////////////////////// // CDieRollerDlg dialog -class CDieRollerDlg : public CDialog +class CDieRollerDlg : public wxDialog { // Construction public: - CDieRollerDlg(CWnd* pParent = NULL); // standard constructor + CDieRollerDlg(wxWindow* pParent = &CB::GetMainWndWx()); // standard constructor // Methods public: @@ -80,15 +80,7 @@ class CDieRollerDlg : public CDialog void SetRollState(const CRollState& rstate); // Dialog Data - //{{AFX_DATA(CDieRollerDlg) - enum { IDD = IDD_DIEROLLER }; - CButton m_btnResetSeed; - CEdit m_editSeed; - CButton m_btnOK; - CButton m_chkRoll3; - CButton m_chkRoll2; - CButton m_chkRoll1; - CB::string m_strSeed; + wxString m_strSeed; uint32_t m_nFaces1; uint32_t m_nFaces2; uint32_t m_nFaces3; @@ -100,15 +92,29 @@ class CDieRollerDlg : public CDialog bool m_bRoll3; int32_t m_nBias; uint32_t m_nSets; - //}}AFX_DATA +private: + CB_XRC_BEGIN_CTRLS_DECL() + RefPtr m_btnResetSeed; + RefPtr m_editSeed; + RefPtr m_btnOK; + RefPtr m_chkRoll3; + RefPtr m_chkRoll2; + RefPtr m_chkRoll1; + RefPtr m_editSets; + RefPtr m_editDice1; + RefPtr m_editFaces1; + RefPtr m_editDice2; + RefPtr m_editFaces2; + RefPtr m_editDice3; + RefPtr m_editFaces3; + RefPtr m_editBias; + CB_XRC_END_CTRLS_DECL() // Overrides - // ClassWizard generated virtual function overrides - //{{AFX_VIRTUAL(CDieRollerDlg) - protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support - //}}AFX_VIRTUAL +protected: + bool TransferDataToWindow() override; + bool TransferDataFromWindow() override; // Implementation protected: @@ -125,21 +131,18 @@ class CDieRollerDlg : public CDialog uint32_t m_nSeedCarryOver; - // Generated message map functions - //{{AFX_MSG(CDieRollerDlg) - virtual void OnOK(); - afx_msg void OnDieRoll1(); - afx_msg void OnDieRoll2(); - afx_msg void OnDieRoll3(); - afx_msg void OnChangeDieNumdies1(); - afx_msg void OnChangeDieNumdies2(); - afx_msg void OnChangeDieNumdies3(); - virtual BOOL OnInitDialog(); - afx_msg void OnDieResetSeed(); + void OnDieRoll1(wxCommandEvent& event); + void OnDieRoll2(wxCommandEvent& event); + void OnDieRoll3(wxCommandEvent& event); + void OnChangeDieNumdies1(wxCommandEvent& event); + void OnChangeDieNumdies2(wxCommandEvent& event); + void OnChangeDieNumdies3(wxCommandEvent& event); + void OnDieResetSeed(wxCommandEvent& event); +#if 0 afx_msg BOOL OnHelpInfo(HELPINFO* pHelpInfo); afx_msg void OnContextMenu(CWnd* pWnd, CPoint point); - //}}AFX_MSG - DECLARE_MESSAGE_MAP() +#endif + wxDECLARE_EVENT_TABLE(); }; #endif diff --git a/GP/DlgEPly.cpp b/GP/DlgEPly.cpp index b7d6070..2551fd7 100644 --- a/GP/DlgEPly.cpp +++ b/GP/DlgEPly.cpp @@ -1,6 +1,6 @@ // DlgEPly.cpp : implementation file // -// Copyright (c) 1994-2023 By Dale L. Larson & William Su, All Rights Reserved. +// Copyright (c) 1994-2025 By Dale L. Larson & William Su, All Rights Reserved. // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the @@ -26,6 +26,7 @@ #include "Gp.h" #include "Player.h" #include "DlgEply.h" +#include #ifdef _DEBUG #define new DEBUG_NEW @@ -36,33 +37,25 @@ static char THIS_FILE[] = __FILE__; ///////////////////////////////////////////////////////////////////////////// // CEditPlayersDialog dialog -CEditPlayersDialog::CEditPlayersDialog(CWnd* pParent /*=NULL*/) - : CDialog(CEditPlayersDialog::IDD, pParent) +CEditPlayersDialog::CEditPlayersDialog(wxWindow* pParent /*= &CB::GetMainWndWx()*/) : + CB_XRC_BEGIN_CTRLS_DEFN(pParent, CEditPlayersDialog) + CB_XRC_CTRL(m_btnUpdate) + CB_XRC_CTRL(m_listNames) + CB_XRC_CTRL(m_editName) + CB_XRC_END_CTRLS_DEFN() { - //{{AFX_DATA_INIT(CEditPlayersDialog) - // NOTE: the ClassWizard will add member initialization here - //}}AFX_DATA_INIT } -void CEditPlayersDialog::DoDataExchange(CDataExchange* pDX) -{ - CDialog::DoDataExchange(pDX); - //{{AFX_DATA_MAP(CEditPlayersDialog) - DDX_Control(pDX, IDC_D_EPLAY_UPDATE_NAME, m_btnUpdate); - DDX_Control(pDX, IDC_D_EPLAY_NAME_LIST, m_listNames); - DDX_Control(pDX, IDC_D_EPLAY_EDIT_NAME, m_editName); - //}}AFX_DATA_MAP -} - -BEGIN_MESSAGE_MAP(CEditPlayersDialog, CDialog) - //{{AFX_MSG_MAP(CEditPlayersDialog) - ON_LBN_SELCHANGE(IDC_D_EPLAY_NAME_LIST, OnSelChangeNameList) - ON_BN_CLICKED(IDC_D_EPLAY_UPDATE_NAME, OnBtnPressUpdateName) +wxBEGIN_EVENT_TABLE(CEditPlayersDialog, wxDialog) + EVT_LISTBOX(XRCID("m_listNames"), OnSelChangeNameList) + EVT_BUTTON(XRCID("m_btnUpdate"), OnBtnPressUpdateName) +#if 0 ON_WM_HELPINFO() ON_WM_CONTEXTMENU() - //}}AFX_MSG_MAP -END_MESSAGE_MAP() +#endif +wxEND_EVENT_TABLE() +#if 0 ///////////////////////////////////////////////////////////////////////////// // Html Help control ID Map @@ -83,70 +76,94 @@ void CEditPlayersDialog::OnContextMenu(CWnd* pWnd, CPoint point) { GetApp()->DoHelpWhatIsHelp(pWnd, adwHelpMap); } +#endif ///////////////////////////////////////////////////////////////////////////// -void CEditPlayersDialog::SetDialogsPlayerNames(CPlayerManager* pPlayerMgr) +void CEditPlayersDialog::SetDialogsPlayerNames(const CPlayerManager& pPlayerMgr) { - m_tblNames.reserve(m_tblNames.size() + value_preserving_cast(pPlayerMgr->GetSize())); - for (int i = 0; i < pPlayerMgr->GetSize(); i++) - m_tblNames.push_back(pPlayerMgr->ElementAt(i).m_strName); + m_tblNames.reserve(m_tblNames.size() + pPlayerMgr.size()); + for (const Player& player : pPlayerMgr) + { + m_tblNames.push_back(player.m_strName); + } } -void CEditPlayersDialog::GetPlayerNamesFromDialog(CPlayerManager* pPlayerMgr) +void CEditPlayersDialog::GetPlayerNamesFromDialog(CPlayerManager& pPlayerMgr) const { - for (int i = 0; i < pPlayerMgr->GetSize(); i++) - pPlayerMgr->ElementAt(i).m_strName = m_tblNames[value_preserving_cast(i)]; + wxASSERT(pPlayerMgr.size() <= m_tblNames.size()); + for (size_t i = size_t(0) ; i < pPlayerMgr.size() ; ++i) + { + pPlayerMgr[PlayerId(i)].m_strName = m_tblNames[i]; + } } ///////////////////////////////////////////////////////////////////////////// // CEditPlayersDialog message handlers -void CEditPlayersDialog::OnSelChangeNameList() +void CEditPlayersDialog::OnSelChangeNameList(wxCommandEvent& /*event*/) { - int nSel = m_listNames.GetCurSel(); - if (nSel >= 0) + int nSel = m_listNames->GetSelection(); + if (nSel != wxNOT_FOUND) { - CB::string strEdit = CB::string::GetText(m_listNames, nSel); - m_editName.SetWindowText(strEdit); + wxString strEdit = m_listNames->GetString(value_preserving_cast(nSel)); + m_editName->SetValue(strEdit); } } -void CEditPlayersDialog::OnBtnPressUpdateName() +void CEditPlayersDialog::OnBtnPressUpdateName(wxCommandEvent& /*event*/) { - CB::string strEdit = CB::string::GetWindowText(m_editName); + CB::string strEdit = m_editName->GetValue(); if (!strEdit.empty()) { - int nSel = m_listNames.GetCurSel(); - if (nSel >= 0) + int nSel = m_listNames->GetSelection(); + if (nSel != wxNOT_FOUND) { - m_listNames.DeleteString(nSel); - m_listNames.InsertString(nSel, strEdit); + m_listNames->Delete(value_preserving_cast(nSel)); + m_listNames->Insert(strEdit, value_preserving_cast(nSel)); } } } -BOOL CEditPlayersDialog::OnInitDialog() +bool CEditPlayersDialog::TransferDataToWindow() { - CDialog::OnInitDialog(); + /* display the player names initially sorted, + but don't actually reorder them */ + m_tblNamesSorted.resize(m_tblNames.size()); + std::iota(m_tblNamesSorted.begin(), m_tblNamesSorted.end(), size_t(0)); + std::sort(m_tblNamesSorted.begin(), m_tblNamesSorted.end(), + [this](const size_t left, const size_t right) + { + return m_tblNames[left] < m_tblNames[right]; + }); for (size_t i = size_t(0) ; i < m_tblNames.size() ; ++i) - m_listNames.AddString(m_tblNames[i]); + m_listNames->AppendString(m_tblNames[m_tblNamesSorted[i]]); - return TRUE; // return TRUE unless you set the focus to a control + if (!wxDialog::TransferDataToWindow()) + { + return false; + } + return true; } -void CEditPlayersDialog::OnOK() +bool CEditPlayersDialog::TransferDataFromWindow() { + if (!wxDialog::TransferDataFromWindow()) + { + return false; + } + m_tblNames.clear(); - m_tblNames.reserve(value_preserving_cast(m_listNames.GetCount())); - for (int i = 0; i < m_listNames.GetCount(); i++) + m_tblNames.reserve(m_listNames->GetCount()); + for (size_t i = size_t(0) ; i < m_tblNamesSorted.size() ; ++i) { - CB::string strName = CB::string::GetText(m_listNames, i); + unsigned j = value_preserving_cast(m_tblNamesSorted[i]); + CB::string strName = m_listNames->GetString(j); m_tblNames.push_back(std::move(strName)); } - CDialog::OnOK(); + return true; } diff --git a/GP/DlgEPly.h b/GP/DlgEPly.h index 0e219e2..d78f1b7 100644 --- a/GP/DlgEPly.h +++ b/GP/DlgEPly.h @@ -1,6 +1,6 @@ // DlgEPly.h : header file // -// Copyright (c) 1994-2020 By Dale L. Larson, All Rights Reserved. +// Copyright (c) 1994-2025 By Dale L. Larson & William Su, All Rights Reserved. // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the @@ -33,45 +33,43 @@ // CEditPlayersDialog dialog class CPlayerManager; -class CEditPlayersDialog : public CDialog +class CEditPlayersDialog : public wxDialog { // Construction public: - CEditPlayersDialog(CWnd* pParent = NULL); // standard constructor + CEditPlayersDialog(wxWindow* pParent = &CB::GetMainWndWx()); // standard constructor // Dialog Data - //{{AFX_DATA(CEditPlayersDialog) - enum { IDD = IDD_EDIT_PLAYERS }; - CButton m_btnUpdate; - CListBox m_listNames; - CEdit m_editName; - //}}AFX_DATA +private: + CB_XRC_BEGIN_CTRLS_DECL() + RefPtr m_btnUpdate; + RefPtr m_listNames; + RefPtr m_editName; + CB_XRC_END_CTRLS_DECL() + // wx doesn't support mixing sorted wxListBox w/ Insert() + std::vector m_tblNamesSorted; +public: - void SetDialogsPlayerNames(CPlayerManager* pPlayerMgr); - void GetPlayerNamesFromDialog(CPlayerManager* pPlayerMgr); + void SetDialogsPlayerNames(const CPlayerManager& pPlayerMgr); + void GetPlayerNamesFromDialog(CPlayerManager& pPlayerMgr) const; std::vector m_tblNames; // Overrides - // ClassWizard generated virtual function overrides - //{{AFX_VIRTUAL(CEditPlayersDialog) - protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support - //}}AFX_VIRTUAL +protected: + bool TransferDataToWindow() override; + bool TransferDataFromWindow() override; // Implementation protected: - // Generated message map functions - //{{AFX_MSG(CEditPlayersDialog) - virtual void OnOK(); - afx_msg void OnSelChangeNameList(); - afx_msg void OnBtnPressUpdateName(); - virtual BOOL OnInitDialog(); + void OnSelChangeNameList(wxCommandEvent& event); + void OnBtnPressUpdateName(wxCommandEvent& event); +#if 0 afx_msg BOOL OnHelpInfo(HELPINFO* pHelpInfo); afx_msg void OnContextMenu(CWnd* pWnd, CPoint point); - //}}AFX_MSG - DECLARE_MESSAGE_MAP() +#endif + wxDECLARE_EVENT_TABLE(); }; #endif diff --git a/GP/DlgEdtEl.cpp b/GP/DlgEdtEl.cpp index b149f0d..82245e5 100644 --- a/GP/DlgEdtEl.cpp +++ b/GP/DlgEdtEl.cpp @@ -1,6 +1,6 @@ // DlgEdtEl.cpp : implementation file // -// Copyright (c) 1994-2020 By Dale L. Larson, All Rights Reserved. +// Copyright (c) 1994-2025 By Dale L. Larson & William Su, All Rights Reserved. // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the @@ -36,35 +36,26 @@ static char THIS_FILE[] = __FILE__; // CEditElementTextDialog dialog -CEditElementTextDialog::CEditElementTextDialog(CWnd* pParent /*=NULL*/) - : CDialog(CEditElementTextDialog::IDD, pParent) +CEditElementTextDialog::CEditElementTextDialog(wxWindow* pParent /*= &CB::GetMainWndWx()*/) : + CB_XRC_BEGIN_CTRLS_DEFN(pParent, CEditElementTextDialog) + CB_XRC_CTRL_VAL(m_chkAllSides, m_bSetAllSides) + CB_XRC_CTRL_VAL(m_editText, m_strTextTemp) + CB_XRC_END_CTRLS_DEFN() { - //{{AFX_DATA_INIT(CEditElementTextDialog) m_strText = ""; m_bSetAllSides = FALSE; - //}}AFX_DATA_INIT m_nSides = size_t(1); } -void CEditElementTextDialog::DoDataExchange(CDataExchange* pDX) -{ - CDialog::DoDataExchange(pDX); - //{{AFX_DATA_MAP(CEditElementTextDialog) - DDX_Control(pDX, IDC_D_EDITELEM_SETALL, m_chkAllSides); - DDX_Control(pDX, IDC_D_EDITELEM_TEXT, m_editText); - DDX_Text(pDX, IDC_D_EDITELEM_TEXT, m_strText); - DDX_Check(pDX, IDC_D_EDITELEM_SETALL, m_bSetAllSides); - //}}AFX_DATA_MAP -} - -BEGIN_MESSAGE_MAP(CEditElementTextDialog, CDialog) - //{{AFX_MSG_MAP(CEditElementTextDialog) +wxBEGIN_EVENT_TABLE(CEditElementTextDialog, wxDialog) +#if 0 ON_WM_HELPINFO() ON_WM_CONTEXTMENU() - //}}AFX_MSG_MAP -END_MESSAGE_MAP() +#endif +wxEND_EVENT_TABLE() +#if 0 ///////////////////////////////////////////////////////////////////////////// // Html Help control ID Map @@ -84,17 +75,32 @@ void CEditElementTextDialog::OnContextMenu(CWnd* pWnd, CPoint point) { GetApp()->DoHelpWhatIsHelp(pWnd, adwHelpMap); } +#endif ///////////////////////////////////////////////////////////////////////////// // CEditElementTextDialog message handlers -BOOL CEditElementTextDialog::OnInitDialog() +bool CEditElementTextDialog::TransferDataToWindow() { - CDialog::OnInitDialog(); + m_strTextTemp = m_strText.wx_str(); + if (!wxDialog::TransferDataToWindow()) + { + return false; + } + + wxTextPos nChars = m_editText->GetLastPosition(); + m_editText->SetFocus(); + m_editText->SetSelection(value_preserving_cast(nChars), value_preserving_cast(nChars)); + m_chkAllSides->Enable(m_nSides >= size_t(2)); + return true; +} - int nChars = m_editText.GetWindowTextLength(); - m_editText.SetFocus(); - m_editText.SetSel(nChars, nChars, TRUE); - m_chkAllSides.EnableWindow(m_nSides >= size_t(2)); - return FALSE; +bool CEditElementTextDialog::TransferDataFromWindow() +{ + if (!wxDialog::TransferDataFromWindow()) + { + return false; + } + m_strText = m_strTextTemp; + return true; } diff --git a/GP/DlgEdtEl.h b/GP/DlgEdtEl.h index b3d9a95..5ce64d0 100644 --- a/GP/DlgEdtEl.h +++ b/GP/DlgEdtEl.h @@ -1,6 +1,6 @@ // DlgEdtEl.h : header file // -// Copyright (c) 1994-2020 By Dale L. Larson, All Rights Reserved. +// Copyright (c) 1994-2025 By Dale L. Larson & William Su, All Rights Reserved. // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the @@ -32,40 +32,38 @@ ///////////////////////////////////////////////////////////////////////////// // CEditElementTextDialog dialog -class CEditElementTextDialog : public CDialog +class CEditElementTextDialog : public wxDialog { // Construction public: - CEditElementTextDialog(CWnd* pParent = NULL); // standard constructor + CEditElementTextDialog(wxWindow* pParent = &CB::GetMainWndWx()); // standard constructor // Dialog Data - //{{AFX_DATA(CEditElementTextDialog) - enum { IDD = IDD_EDIT_ELEMENT_TEXT }; - CButton m_chkAllSides; - CEdit m_editText; CB::string m_strText; - BOOL m_bSetAllSides; - //}}AFX_DATA + bool m_bSetAllSides; size_t m_nSides; +private: + wxString m_strTextTemp; + CB_XRC_BEGIN_CTRLS_DECL() + RefPtr m_chkAllSides; + RefPtr m_editText; + CB_XRC_END_CTRLS_DECL() +public: // Overrides - // ClassWizard generated virtual function overrides - //{{AFX_VIRTUAL(CEditElementTextDialog) - protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support - //}}AFX_VIRTUAL +protected: + bool TransferDataToWindow() override; + bool TransferDataFromWindow() override; // Implementation protected: - // Generated message map functions - //{{AFX_MSG(CEditElementTextDialog) - virtual BOOL OnInitDialog(); +#if 0 afx_msg BOOL OnHelpInfo(HELPINFO* pHelpInfo); afx_msg void OnContextMenu(CWnd* pWnd, CPoint point); - //}}AFX_MSG - DECLARE_MESSAGE_MAP() +#endif + wxDECLARE_EVENT_TABLE(); }; #endif diff --git a/GP/DlgItray.cpp b/GP/DlgItray.cpp index d258798..419342b 100644 --- a/GP/DlgItray.cpp +++ b/GP/DlgItray.cpp @@ -1,6 +1,6 @@ // DlgITray.cpp : implementation file // -// Copyright (c) 1994-2024 By Dale L. Larson & William Su, All Rights Reserved. +// Copyright (c) 1994-2025 By Dale L. Larson & William Su, All Rights Reserved. // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the @@ -38,32 +38,33 @@ static char THIS_FILE[] = __FILE__; ///////////////////////////////////////////////////////////////////////////// // CImportTraysDlg dialog -CImportTraysDlg::CImportTraysDlg(CWnd* pParent /*=NULL*/) - : CDialog(CImportTraysDlg::IDD, pParent) +CImportTraysDlg::CImportTraysDlg(CGamDoc& doc, wxWindow* pParent /*= &CB::GetMainWndWx()*/) : + CB_XRC_BEGIN_CTRLS_DEFN(pParent, CImportTraysDlg) + CB_XRC_CTRL(m_listGroups) + CB_XRC_END_CTRLS_DEFN(), + m_pDoc(&doc) { - //{{AFX_DATA_INIT(CImportTraysDlg) - // NOTE: the ClassWizard will add member initialization here - //}}AFX_DATA_INIT - m_pDoc = NULL; -} - -void CImportTraysDlg::DoDataExchange(CDataExchange* pDX) -{ - CDialog::DoDataExchange(pDX); - //{{AFX_DATA_MAP(CImportTraysDlg) - DDX_Control(pDX, IDC_D_IMPPCE_GROUPLIST, m_listGroups); - //}}AFX_DATA_MAP + // adjust m_listGroups size + for (int i = 0; i < 12; ++i) + { + m_listGroups->Append(wxEmptyString); + } + Layout(); + Fit(); + Centre(); + m_listGroups->Clear(); } -BEGIN_MESSAGE_MAP(CImportTraysDlg, CDialog) - //{{AFX_MSG_MAP(CImportTraysDlg) +wxBEGIN_EVENT_TABLE(CImportTraysDlg, wxDialog) +#if 0 ON_WM_HELPINFO() ON_WM_CONTEXTMENU() - //}}AFX_MSG_MAP - ON_BN_CLICKED(IDC_D_IMPPCE_SELECTALL, OnBnClickedSelectAll) - ON_BN_CLICKED(IDC_D_IMPPCE_CLEARALL, OnBnClickedClearAll) -END_MESSAGE_MAP() +#endif + EVT_BUTTON(XRCID("OnBnClickedSelectAll"), OnBnClickedSelectAll) + EVT_BUTTON(XRCID("OnBnClickedClearAll"), OnBnClickedClearAll) +wxEND_EVENT_TABLE() +#if 0 ///////////////////////////////////////////////////////////////////////////// // Html Help control ID Map @@ -82,18 +83,20 @@ void CImportTraysDlg::OnContextMenu(CWnd* pWnd, CPoint point) { GetApp()->DoHelpWhatIsHelp(pWnd, adwHelpMap); } +#endif ///////////////////////////////////////////////////////////////////////////// // CImportTraysDlg message handlers -BOOL CImportTraysDlg::OnInitDialog() +bool CImportTraysDlg::TransferDataToWindow() { - ASSERT(m_pDoc != NULL); // MUST BE SET - CDialog::OnInitDialog(); + if (!wxDialog::TransferDataToWindow()) + { + return false; + } const CPieceManager& pPMgr = m_pDoc->GetPieceManager(); - CTrayManager* pYMgr = m_pDoc->GetTrayManager(); - ASSERT(pYMgr != NULL); + CTrayManager& pYMgr = m_pDoc->GetTrayManager(); // Loop through all the piece groups in the gamebox. If a group // already doesn't exist as a tray in the scenario, add it to the @@ -103,59 +106,66 @@ BOOL CImportTraysDlg::OnInitDialog() { CB::string strName = pPMgr.GetPieceSet(nPSet).GetName(); size_t nTray; - for (nTray = size_t(0); nTray < pYMgr->GetNumTraySets(); nTray++) + for (nTray = size_t(0); nTray < pYMgr.GetNumTraySets(); nTray++) { - if (strName.CompareNoCase(pYMgr->GetTraySet(nTray).GetName()) == 0) + if (strName.CompareNoCase(pYMgr.GetTraySet(nTray).GetName()) == 0) break; } - if (nTray >= pYMgr->GetNumTraySets()) + if (nTray >= pYMgr.GetNumTraySets()) { // Found one... - int nIdx = m_listGroups.AddString(strName); - m_listGroups.SetItemData(nIdx, nPSet); - m_listGroups.SetCheck(nIdx, 0); + int nIdx = m_listGroups->Append(strName); + m_listGroups->SetClientData(value_preserving_cast(nIdx), reinterpret_cast(value_preserving_cast(nPSet))); + m_listGroups->Check(value_preserving_cast(nIdx), false); } } - return TRUE; // return TRUE unless you set the focus to a control - // EXCEPTION: OCX Property Pages should return FALSE + return TRUE; } -void CImportTraysDlg::OnOK() +bool CImportTraysDlg::TransferDataFromWindow() { + if (!wxDialog::TransferDataFromWindow()) + { + return false; + } + const CPieceManager& pPMgr = m_pDoc->GetPieceManager(); - CTrayManager* pYMgr = m_pDoc->GetTrayManager(); - CPieceTable* pPTbl = m_pDoc->GetPieceTable(); - ASSERT(pPTbl != NULL); + CTrayManager& pYMgr = m_pDoc->GetTrayManager(); + CPieceTable& pPTbl = m_pDoc->GetPieceTable(); - for (int i = 0; i < m_listGroups.GetCount(); i++) + for (unsigned int i = 0u ; i < m_listGroups->GetCount() ; ++i) { - if (m_listGroups.GetCheck(i) > 0) + if (m_listGroups->IsChecked(i)) { - size_t nPSet = value_preserving_cast(m_listGroups.GetItemData(i)); + size_t nPSet = value_preserving_cast(reinterpret_cast(m_listGroups->GetClientData(i))); const CPieceSet& pPSet = pPMgr.GetPieceSet(nPSet); // Create tray and add pieces... - size_t nTray = pYMgr->CreateTraySet(pPSet.GetName()); - CTraySet& pYSet = pYMgr->GetTraySet(nTray); + size_t nTray = pYMgr.CreateTraySet(pPSet.GetName()); + CTraySet& pYSet = pYMgr.GetTraySet(nTray); // Locate only those pieces that aren't currently being used. - std::vector arrUnusedPieces = pPTbl->LoadUnusedPieceList(nPSet); - pPTbl->SetPieceListAsFrontUp(arrUnusedPieces); + std::vector arrUnusedPieces = pPTbl.LoadUnusedPieceList(nPSet); + pPTbl.SetPieceListAsFrontUp(arrUnusedPieces); pYSet.AddPieceList(arrUnusedPieces); } } - CDialog::OnOK(); + return true; } -void CImportTraysDlg::OnBnClickedSelectAll() +void CImportTraysDlg::OnBnClickedSelectAll(wxCommandEvent& /*event*/) { - for (int i = 0; i < m_listGroups.GetCount(); i++) - m_listGroups.SetCheck(i, 1); + for (unsigned int i = 0u ; i < m_listGroups->GetCount() ; ++i) + { + m_listGroups->Check(i, true); + } } -void CImportTraysDlg::OnBnClickedClearAll() +void CImportTraysDlg::OnBnClickedClearAll(wxCommandEvent& /*event*/) { - for (int i = 0; i < m_listGroups.GetCount(); i++) - m_listGroups.SetCheck(i, 0); + for (unsigned int i = 0u ; i < m_listGroups->GetCount() ; ++i) + { + m_listGroups->Check(i, false); + } } diff --git a/GP/DlgItray.h b/GP/DlgItray.h index 59ec2f6..cb236dd 100644 --- a/GP/DlgItray.h +++ b/GP/DlgItray.h @@ -1,6 +1,6 @@ // DlgITray.h : header file // -// Copyright (c) 1994-2020 By Dale L. Larson, All Rights Reserved. +// Copyright (c) 1994-2025 By Dale L. Larson & William Su, All Rights Reserved. // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the @@ -32,44 +32,36 @@ ///////////////////////////////////////////////////////////////////////////// // CImportTraysDlg dialog -class CImportTraysDlg : public CDialog +class CImportTraysDlg : public wxDialog { // Construction public: - CImportTraysDlg(CWnd* pParent = NULL); // standard constructor + CImportTraysDlg(CGamDoc& doc, wxWindow* pParent = &CB::GetMainWndWx()); // standard constructor // Dialog Data - //{{AFX_DATA(CImportTraysDlg) - enum { IDD = IDD_IMPORTPIECEGROUPS }; - CCheckListBox m_listGroups; - //}}AFX_DATA +private: + CB_XRC_BEGIN_CTRLS_DECL() + RefPtr m_listGroups; + CB_XRC_END_CTRLS_DECL() - CGamDoc* m_pDoc; + RefPtr m_pDoc; // Overrides - // ClassWizard generated virtual function overrides - //{{AFX_VIRTUAL(CImportTraysDlg) - protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support - //}}AFX_VIRTUAL +public: + bool TransferDataToWindow() override; + bool TransferDataFromWindow() override; // Implementation protected: - // Generated message map functions - //{{AFX_MSG(CImportTraysDlg) - virtual BOOL OnInitDialog(); - virtual void OnOK(); +#if 0 afx_msg BOOL OnHelpInfo(HELPINFO* pHelpInfo); afx_msg void OnContextMenu(CWnd* pWnd, CPoint point); - //}}AFX_MSG - DECLARE_MESSAGE_MAP() +#endif + wxDECLARE_EVENT_TABLE(); public: - afx_msg void OnBnClickedSelectAll(); - afx_msg void OnBnClickedClearAll(); + void OnBnClickedSelectAll(wxCommandEvent& event); + void OnBnClickedClearAll(wxCommandEvent& event); }; -//{{AFX_INSERT_LOCATION}} -// Microsoft Visual C++ will insert additional declarations immediately before the previous line. - #endif // _DLGITRAY_H_ diff --git a/GP/DlgMPly.cpp b/GP/DlgMPly.cpp index f70acfa..6453166 100644 --- a/GP/DlgMPly.cpp +++ b/GP/DlgMPly.cpp @@ -1,6 +1,6 @@ // DlgMPly.cpp // -// Copyright (c) 1994-2023 By Dale L. Larson & William Su, All Rights Reserved. +// Copyright (c) 1994-2025 By Dale L. Larson & William Su, All Rights Reserved. // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the @@ -36,34 +36,36 @@ static char THIS_FILE[] = __FILE__; ///////////////////////////////////////////////////////////////////////////// // CMultiplayerGameDialog dialog -CMultiplayerGameDialog::CMultiplayerGameDialog(CWnd* pParent /*=NULL*/) - : CDialog(CMultiplayerGameDialog::IDD, pParent) +CMultiplayerGameDialog::CMultiplayerGameDialog(CPlayerManager& pm, wxWindow* pParent /*= &CB::GetMainWndWx()*/) : + CB_XRC_BEGIN_CTRLS_DEFN(pParent, CMultiplayerGameDialog) + CB_XRC_CTRL(m_static1) + CB_XRC_CTRL_VAL(m_chkCreateReferee, m_bCreateReferee) + CB_XRC_CTRL(m_static2) + CB_XRC_CTRL(m_editPlayer) + CB_XRC_CTRL(m_listPlayers) + CB_XRC_END_CTRLS_DEFN(), + m_pPlayerMgr(&pm) { - //{{AFX_DATA_INIT(CMultiplayerGameDialog) m_bCreateReferee = FALSE; - //}}AFX_DATA_INIT - m_pPlayerMgr = NULL; -} -void CMultiplayerGameDialog::DoDataExchange(CDataExchange* pDX) -{ - CDialog::DoDataExchange(pDX); - //{{AFX_DATA_MAP(CMultiplayerGameDialog) - DDX_Control(pDX, IDC_D_MPGAME_PLAYER_NAME, m_editPlayer); - DDX_Control(pDX, IDC_D_MPGAME_PLAYER_LIST, m_listPlayers); - DDX_Check(pDX, IDC_D_MPGAME_CREATE_REFEREE, m_bCreateReferee); - //}}AFX_DATA_MAP + wxSize chkSize = m_chkCreateReferee->GetBestSize(); + m_static1->Wrap(chkSize.GetWidth()); + m_static2->Wrap(chkSize.GetWidth()); + /* adding content to listbox may change its size, so no + reason to adjust layout yet despite changing static + wrap */ } -BEGIN_MESSAGE_MAP(CMultiplayerGameDialog, CDialog) - //{{AFX_MSG_MAP(CMultiplayerGameDialog) - ON_BN_CLICKED(IDC_D_MPGAME, OnBtnPressUpdateName) - ON_LBN_SELCHANGE(IDC_D_MPGAME_PLAYER_LIST, OnSelChangePlayerList) +wxBEGIN_EVENT_TABLE(CMultiplayerGameDialog, wxDialog) + EVT_BUTTON(XRCID("OnBtnPressUpdateName"), OnBtnPressUpdateName) + EVT_LISTBOX(XRCID("m_listPlayers"), OnSelChangePlayerList) +#if 0 ON_WM_HELPINFO() ON_WM_CONTEXTMENU() - //}}AFX_MSG_MAP -END_MESSAGE_MAP() +#endif +wxEND_EVENT_TABLE() +#if 0 ///////////////////////////////////////////////////////////////////////////// // Html Help control ID Map @@ -85,50 +87,67 @@ void CMultiplayerGameDialog::OnContextMenu(CWnd* pWnd, CPoint point) { GetApp()->DoHelpWhatIsHelp(pWnd, adwHelpMap); } +#endif ///////////////////////////////////////////////////////////////////////////// // CMultiplayerGameDialog message handlers -void CMultiplayerGameDialog::OnBtnPressUpdateName() +void CMultiplayerGameDialog::OnBtnPressUpdateName(wxCommandEvent& /*event*/) { - CB::string strEdit = CB::string::GetWindowText(m_editPlayer); + CB::string strEdit = m_editPlayer->GetValue(); if (!strEdit.empty()) { - int nSel = m_listPlayers.GetCurSel(); - if (nSel >= 0) + int nSel = m_listPlayers->GetSelection(); + if (nSel != wxNOT_FOUND) { - m_listPlayers.DeleteString(nSel); - m_listPlayers.InsertString(nSel, strEdit); + m_listPlayers->Delete(value_preserving_cast(nSel)); + m_listPlayers->Insert(strEdit, value_preserving_cast(nSel)); } } } -void CMultiplayerGameDialog::OnSelChangePlayerList() +void CMultiplayerGameDialog::OnSelChangePlayerList(wxCommandEvent& /*event*/) { - int nSel = m_listPlayers.GetCurSel(); - if (nSel >= 0) + int nSel = m_listPlayers->GetSelection(); + if (nSel != wxNOT_FOUND) { - CB::string strEdit = CB::string::GetText(m_listPlayers, nSel); - m_editPlayer.SetWindowText(strEdit); + CB::string strEdit = m_listPlayers->GetString(value_preserving_cast(nSel)); + m_editPlayer->SetValue(strEdit); } } -BOOL CMultiplayerGameDialog::OnInitDialog() +bool CMultiplayerGameDialog::TransferDataToWindow() { - CDialog::OnInitDialog(); - ASSERT(m_pPlayerMgr != NULL); + if (!wxDialog::TransferDataToWindow()) + { + return false; + } + + for (const Player& player : *m_pPlayerMgr) + { + m_listPlayers->Append(player.m_strName); + } - for (int i = 0; i < m_pPlayerMgr->GetSize(); i++) - m_listPlayers.AddString(m_pPlayerMgr->ElementAt(i).m_strName); + // all controls are ready, so now adjust layout + SetMinSize(wxDefaultSize); + Fit(); + Centre(); - return TRUE; // return TRUE unless you set the focus to a control + return TRUE; } -void CMultiplayerGameDialog::OnOK() +bool CMultiplayerGameDialog::TransferDataFromWindow() { - for (int i = 0; i < m_pPlayerMgr->GetSize(); i++) - m_pPlayerMgr->ElementAt(i).m_strName = CB::string::GetText(m_listPlayers, i); + if (!wxDialog::TransferDataFromWindow()) + { + return false; + } + + for (size_t i = size_t(0) ; i < m_pPlayerMgr->size() ; ++i) + { + (*m_pPlayerMgr)[PlayerId(i)].m_strName = m_listPlayers->GetString(value_preserving_cast(i)); + } - CDialog::OnOK(); + return true; } diff --git a/GP/DlgMPly.h b/GP/DlgMPly.h index fe39d15..0c5bb3b 100644 --- a/GP/DlgMPly.h +++ b/GP/DlgMPly.h @@ -1,6 +1,6 @@ // DlgMPly.h : header file // -// Copyright (c) 1994-2020 By Dale L. Larson, All Rights Reserved. +// Copyright (c) 1994-2025 By Dale L. Larson & William Su, All Rights Reserved. // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the @@ -34,42 +34,39 @@ class CPlayerManager; -class CMultiplayerGameDialog : public CDialog +class CMultiplayerGameDialog : public wxDialog { // Construction public: - CMultiplayerGameDialog(CWnd* pParent = NULL); // standard constructor + CMultiplayerGameDialog(CPlayerManager& pm, wxWindow* pParent = &CB::GetMainWndWx()); // standard constructor // Dialog Data - //{{AFX_DATA(CMultiplayerGameDialog) - enum { IDD = IDD_MULTIPLAYER_GAME }; - CEdit m_editPlayer; - CListBox m_listPlayers; - BOOL m_bCreateReferee; - //}}AFX_DATA + bool m_bCreateReferee; +private: + CB_XRC_BEGIN_CTRLS_DECL() + RefPtr m_static1; + RefPtr m_chkCreateReferee; + RefPtr m_static2; + RefPtr m_editPlayer; + RefPtr m_listPlayers; + CB_XRC_END_CTRLS_DECL() - CPlayerManager* m_pPlayerMgr; + RefPtr m_pPlayerMgr; // Overrides - // ClassWizard generated virtual function overrides - //{{AFX_VIRTUAL(CMultiplayerGameDialog) - protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support - //}}AFX_VIRTUAL // Implementation protected: - // Generated message map functions - //{{AFX_MSG(CMultiplayerGameDialog) - afx_msg void OnBtnPressUpdateName(); - afx_msg void OnSelChangePlayerList(); - virtual BOOL OnInitDialog(); - virtual void OnOK(); + void OnBtnPressUpdateName(wxCommandEvent& event); + void OnSelChangePlayerList(wxCommandEvent& event); + bool TransferDataToWindow() override; + bool TransferDataFromWindow() override; +#if 0 afx_msg BOOL OnHelpInfo(HELPINFO* pHelpInfo); afx_msg void OnContextMenu(CWnd* pWnd, CPoint point); - //}}AFX_MSG - DECLARE_MESSAGE_MAP() +#endif + wxDECLARE_EVENT_TABLE(); }; #endif diff --git a/GP/DlgMarkCount.cpp b/GP/DlgMarkCount.cpp index f3000c8..8f30a03 100644 --- a/GP/DlgMarkCount.cpp +++ b/GP/DlgMarkCount.cpp @@ -1,6 +1,6 @@ // DlgMarkCount.cpp : implementation file // -// Copyright (c) 1994-2020 By Dale L. Larson, All Rights Reserved. +// Copyright (c) 1994-2025 By Dale L. Larson & William Su, All Rights Reserved. // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the @@ -36,29 +36,18 @@ static char THIS_FILE[] = __FILE__; // CMarkerCountDialog dialog -CMarkerCountDialog::CMarkerCountDialog(CWnd* pParent /*=NULL*/) - : CDialog(CMarkerCountDialog::IDD, pParent) +CMarkerCountDialog::CMarkerCountDialog(wxWindow* pParent /*= &CB::GetMainWndWx()*/) : + CB_XRC_BEGIN_CTRLS_DEFN(pParent, CMarkerCountDialog) + CB_XRC_CTRL_VAL(m_editMarkerCount, m_nMarkerCount, 2, 25) + CB_XRC_END_CTRLS_DEFN() { - //{{AFX_DATA_INIT(CMarkerCountDialog) - m_nMarkerCount = 0; - //}}AFX_DATA_INIT -} - + // KLUDGE: don't see a way to use GetSizeFromText() in .xrc + wxSize editSize = m_editMarkerCount->GetSizeFromText("99"); + m_editMarkerCount->SetInitialSize(editSize); + SetMinSize(wxDefaultSize); + Layout(); + Fit(); + Centre(); -void CMarkerCountDialog::DoDataExchange(CDataExchange* pDX) -{ - CDialog::DoDataExchange(pDX); - //{{AFX_DATA_MAP(CMarkerCountDialog) - DDX_Text(pDX, IDC_MRKCNT_NUMBER, m_nMarkerCount); - DDV_MinMaxInt(pDX, m_nMarkerCount, 2, 25); - //}}AFX_DATA_MAP + m_nMarkerCount = 0; } - - -BEGIN_MESSAGE_MAP(CMarkerCountDialog, CDialog) - //{{AFX_MSG_MAP(CMarkerCountDialog) - // NOTE: the ClassWizard will add message map macros here - //}}AFX_MSG_MAP -END_MESSAGE_MAP() - - diff --git a/GP/DlgMarkCount.h b/GP/DlgMarkCount.h index ff1d64b..2b7e93f 100644 --- a/GP/DlgMarkCount.h +++ b/GP/DlgMarkCount.h @@ -1,6 +1,6 @@ // DlgMarkCount.h : header file // -// Copyright (c) 1994-2020 By Dale L. Larson, All Rights Reserved. +// Copyright (c) 1994-2025 By Dale L. Larson & William Su, All Rights Reserved. // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the @@ -32,34 +32,24 @@ ///////////////////////////////////////////////////////////////////////////// // CMarkerCountDialog dialog -class CMarkerCountDialog : public CDialog +class CMarkerCountDialog : public wxDialog { // Construction public: - CMarkerCountDialog(CWnd* pParent = NULL); // standard constructor + CMarkerCountDialog(wxWindow* pParent = &CB::GetMainWndWx()); // standard constructor // Dialog Data - //{{AFX_DATA(CMarkerCountDialog) - enum { IDD = IDD_MARKER_COUNT }; int m_nMarkerCount; - //}}AFX_DATA - +private: + CB_XRC_BEGIN_CTRLS_DECL() + RefPtr m_editMarkerCount; + CB_XRC_END_CTRLS_DECL() // Overrides - // ClassWizard generated virtual function overrides - //{{AFX_VIRTUAL(CMarkerCountDialog) - protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support - //}}AFX_VIRTUAL // Implementation protected: - // Generated message map functions - //{{AFX_MSG(CMarkerCountDialog) - // NOTE: the ClassWizard will add member functions here - //}}AFX_MSG - DECLARE_MESSAGE_MAP() }; #endif diff --git a/GP/DlgMdesc.cpp b/GP/DlgMdesc.cpp index 34e0d00..269c629 100644 --- a/GP/DlgMdesc.cpp +++ b/GP/DlgMdesc.cpp @@ -1,6 +1,6 @@ // dlgmdesc.cpp : implementation file // -// Copyright (c) 1994-2020 By Dale L. Larson, All Rights Reserved. +// Copyright (c) 1994-2025 By Dale L. Larson & William Su, All Rights Reserved. // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the @@ -34,34 +34,24 @@ static char THIS_FILE[] = __FILE__; ///////////////////////////////////////////////////////////////////////////// // CMovDescDialog dialog -CMovDescDialog::CMovDescDialog(CWnd* pParent /*=NULL*/) - : CDialog(CMovDescDialog::IDD, pParent) +CMovDescDialog::CMovDescDialog(wxWindow* pParent /*= &CB::GetMainWndWx()*/) : + CB_XRC_BEGIN_CTRLS_DEFN(pParent, CMovDescDialog) + CB_XRC_CTRL_VAL(m_editDesc, m_strDesc, wxFILTER_NONE, 2048) + CB_XRC_CTRL_VAL(m_editTitle, m_strTitle, wxFILTER_NONE, 64) + CB_XRC_END_CTRLS_DEFN() { - //{{AFX_DATA_INIT(CMovDescDialog) m_strDesc = ""; m_strTitle = ""; - //}}AFX_DATA_INIT } -void CMovDescDialog::DoDataExchange(CDataExchange* pDX) -{ - CDialog::DoDataExchange(pDX); - //{{AFX_DATA_MAP(CMovDescDialog) - DDX_Text(pDX, IDC_D_MDESC_DESCR, m_strDesc); - DDV_MaxChars(pDX, m_strDesc, 2048); - DDX_Text(pDX, IDC_D_MDESC_TITLE, m_strTitle); - DDV_MaxChars(pDX, m_strTitle, 64); - //}}AFX_DATA_MAP -} - -BEGIN_MESSAGE_MAP(CMovDescDialog, CDialog) - //{{AFX_MSG_MAP(CMovDescDialog) - // NOTE: the ClassWizard will add message map macros here +wxBEGIN_EVENT_TABLE(CMovDescDialog, wxDialog) +#if 0 ON_WM_HELPINFO() ON_WM_CONTEXTMENU() - //}}AFX_MSG_MAP -END_MESSAGE_MAP() +#endif +wxEND_EVENT_TABLE() +#if 0 ///////////////////////////////////////////////////////////////////////////// // Html Help control ID Map @@ -81,6 +71,7 @@ void CMovDescDialog::OnContextMenu(CWnd* pWnd, CPoint point) { GetApp()->DoHelpWhatIsHelp(pWnd, adwHelpMap); } +#endif ///////////////////////////////////////////////////////////////////////////// // CMovDescDialog message handlers diff --git a/GP/DlgMdesc.h b/GP/DlgMdesc.h index e07bf05..d6f7e87 100644 --- a/GP/DlgMdesc.h +++ b/GP/DlgMdesc.h @@ -1,6 +1,6 @@ // DlgMdesc.h : header file // -// Copyright (c) 1994-2020 By Dale L. Larson, All Rights Reserved. +// Copyright (c) 1994-2025 By Dale L. Larson & William Su, All Rights Reserved. // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the @@ -25,28 +25,26 @@ ///////////////////////////////////////////////////////////////////////////// // CMovDescDialog dialog -class CMovDescDialog : public CDialog +class CMovDescDialog : public wxDialog { // Construction public: - CMovDescDialog(CWnd* pParent = NULL); // standard constructor + CMovDescDialog(wxWindow* pParent = &CB::GetMainWndWx()); // standard constructor // Dialog Data - //{{AFX_DATA(CMovDescDialog) - enum { IDD = IDD_GMOVDESCR }; - CB::string m_strDesc; - CB::string m_strTitle; - //}}AFX_DATA + wxString m_strDesc; + wxString m_strTitle; +private: + CB_XRC_BEGIN_CTRLS_DECL() + RefPtr m_editDesc; + RefPtr m_editTitle; + CB_XRC_END_CTRLS_DECL() // Implementation protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support - - // Generated message map functions - //{{AFX_MSG(CMovDescDialog) - // NOTE: the ClassWizard will add member functions here +#if 0 afx_msg BOOL OnHelpInfo(HELPINFO* pHelpInfo); afx_msg void OnContextMenu(CWnd* pWnd, CPoint point); - //}}AFX_MSG - DECLARE_MESSAGE_MAP() +#endif + wxDECLARE_EVENT_TABLE(); }; diff --git a/GP/DlgNPly.cpp b/GP/DlgNPly.cpp index 6017b55..02021f2 100644 --- a/GP/DlgNPly.cpp +++ b/GP/DlgNPly.cpp @@ -1,6 +1,6 @@ // DlgNPly.cpp // -// Copyright (c) 1994-2020 By Dale L. Larson, All Rights Reserved. +// Copyright (c) 1994-2025 By Dale L. Larson & William Su, All Rights Reserved. // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the @@ -35,27 +35,17 @@ static char THIS_FILE[] = __FILE__; ///////////////////////////////////////////////////////////////////////////// // CCreatePlayersDialog dialog -CCreatePlayersDialog::CCreatePlayersDialog(CWnd* pParent /*=NULL*/) - : CDialog(CCreatePlayersDialog::IDD, pParent) +CCreatePlayersDialog::CCreatePlayersDialog(wxWindow* pParent /*= &CB::GetMainWndWx()*/) : + CB_XRC_BEGIN_CTRLS_DEFN(pParent, CCreatePlayersDialog) + CB_XRC_CTRL_VAL(m_editPlayerCount, m_nPlayerCount, size_t(0), size_t(26)) + CB_XRC_END_CTRLS_DEFN() { - //{{AFX_DATA_INIT(CCreatePlayersDialog) m_nPlayerCount = size_t(0); - //}}AFX_DATA_INIT -} -void CCreatePlayersDialog::DoDataExchange(CDataExchange* pDX) -{ - CDialog::DoDataExchange(pDX); - //{{AFX_DATA_MAP(CCreatePlayersDialog) - DDX_Text(pDX, IDC_D_CPLAY_NUM_PLAYERS, m_nPlayerCount); - DDV_MinMaxUInt(pDX, value_preserving_cast(m_nPlayerCount), 0, 26); - //}}AFX_DATA_MAP + // KLUDGE: don't see a way to use GetSizeFromText() in .xrc + wxSize editSize = m_editPlayerCount->GetSizeFromText("99"); + m_editPlayerCount->SetInitialSize(editSize); + SetMinSize(wxDefaultSize); + Fit(); + Centre(); } - -BEGIN_MESSAGE_MAP(CCreatePlayersDialog, CDialog) - //{{AFX_MSG_MAP(CCreatePlayersDialog) - // NOTE: the ClassWizard will add message map macros here - //}}AFX_MSG_MAP -END_MESSAGE_MAP() - - diff --git a/GP/DlgNPly.h b/GP/DlgNPly.h index 88064cc..27fcb5b 100644 --- a/GP/DlgNPly.h +++ b/GP/DlgNPly.h @@ -1,6 +1,6 @@ // DlgNPly.h : header file // -// Copyright (c) 1994-2020 By Dale L. Larson, All Rights Reserved. +// Copyright (c) 1994-2025 By Dale L. Larson & William Su, All Rights Reserved. // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the @@ -32,34 +32,18 @@ ///////////////////////////////////////////////////////////////////////////// // CCreatePlayersDialog dialog -class CCreatePlayersDialog : public CDialog +class CCreatePlayersDialog : public wxDialog { // Construction public: - CCreatePlayersDialog(CWnd* pParent = NULL); // standard constructor + CCreatePlayersDialog(wxWindow* pParent = &CB::GetMainWndWx()); // standard constructor // Dialog Data - //{{AFX_DATA(CCreatePlayersDialog) - enum { IDD = IDD_CREATE_PLAYERS }; size_t m_nPlayerCount; - //}}AFX_DATA - - -// Overrides - // ClassWizard generated virtual function overrides - //{{AFX_VIRTUAL(CCreatePlayersDialog) - protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support - //}}AFX_VIRTUAL - -// Implementation -protected: - - // Generated message map functions - //{{AFX_MSG(CCreatePlayersDialog) - // NOTE: the ClassWizard will add member functions here - //}}AFX_MSG - DECLARE_MESSAGE_MAP() +private: + CB_XRC_BEGIN_CTRLS_DECL() + RefPtr m_editPlayerCount; + CB_XRC_END_CTRLS_DECL() }; #endif diff --git a/GP/DlgNewGeoBoard.cpp b/GP/DlgNewGeoBoard.cpp index 66f2eda..619c296 100644 --- a/GP/DlgNewGeoBoard.cpp +++ b/GP/DlgNewGeoBoard.cpp @@ -1,6 +1,6 @@ // DlgNewGeoBoard.cpp : implementation file // -// Copyright (c) 1994-2024 By Dale L. Larson & William Su, All Rights Reserved. +// Copyright (c) 1994-2025 By Dale L. Larson & William Su, All Rights Reserved. // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the @@ -40,12 +40,18 @@ static char THIS_FILE[] = __FILE__; ///////////////////////////////////////////////////////////////////////////// // CCreateGeomorphicBoardDialog dialog -CCreateGeomorphicBoardDialog::CCreateGeomorphicBoardDialog(CGamDoc& doc, CWnd* pParent /*=NULL*/) - : CDialog(CCreateGeomorphicBoardDialog::IDD, pParent), +CCreateGeomorphicBoardDialog::CCreateGeomorphicBoardDialog(CGamDoc& doc, wxWindow* pParent /*= &CB::GetMainWndWx()*/) : + CB_XRC_BEGIN_CTRLS_DEFN(pParent, CCreateGeomorphicBoardDialog) + , m_btnOK(XRCCTRL(*this, "wxID_OK", std::remove_reference_t)) + CB_XRC_CTRL(m_btnClearList) + CB_XRC_CTRL(m_btnAddBreak) + CB_XRC_CTRL(m_btnAddBoard) + CB_XRC_CTRL(m_listGeo) + CB_XRC_CTRL(m_editBoardName) + CB_XRC_CTRL(m_listBoard) + CB_XRC_END_CTRLS_DEFN(), m_pDoc(&doc) { - //{{AFX_DATA_INIT(CCreateGeomorphicBoardDialog) - //}}AFX_DATA_INIT m_nCurrentRowHeight = size_t(0); m_nCurrentColumn = size_t(0); m_nMaxColumns = size_t(0); @@ -54,37 +60,21 @@ CCreateGeomorphicBoardDialog::CCreateGeomorphicBoardDialog(CGamDoc& doc, CWnd* p ///////////////////////////////////////////////////////////////////////////// -void CCreateGeomorphicBoardDialog::DoDataExchange(CDataExchange* pDX) -{ - CDialog::DoDataExchange(pDX); - //{{AFX_DATA_MAP(CCreateGeomorphicBoardDialog) - DDX_Control(pDX, IDOK, m_btnOK); - DDX_Control(pDX, IDC_D_NEWGEO_CLEAR, m_btnClearList); - DDX_Control(pDX, IDC_D_NEWGEO_ADD_BREAK, m_btnAddBreak); - DDX_Control(pDX, IDC_D_NEWGEO_ADD_BOARD, m_btnAddBoard); - DDX_Control(pDX, IDC_D_NEWGEO_GEOMORPHIC_LIST, m_listGeo); - DDX_Control(pDX, IDC_D_NEWGEO_BOARD_NAME, m_editBoardName); - DDX_Control(pDX, IDC_D_NEWGEO_BOARD_LIST, m_listBoard); - //}}AFX_DATA_MAP -} - -///////////////////////////////////////////////////////////////////////////// - -BEGIN_MESSAGE_MAP(CCreateGeomorphicBoardDialog, CDialog) - //{{AFX_MSG_MAP(CCreateGeomorphicBoardDialog) - ON_LBN_SELCHANGE(IDC_D_NEWGEO_BOARD_LIST, OnSelChangeBoardList) - ON_BN_CLICKED(IDC_D_NEWGEO_ADD_BOARD, OnBtnPressedAddBoard) - ON_BN_CLICKED(IDC_D_NEWGEO_ADD_BREAK, OnBtnPressedAddBreak) - ON_BN_CLICKED(IDC_D_NEWGEO_CLEAR, OnBtnPressClear) - ON_EN_CHANGE(IDC_D_NEWGEO_BOARD_NAME, OnChangeBoardName) - ON_LBN_DBLCLK(IDC_D_NEWGEO_BOARD_LIST, OnDblClickBoardList) +wxBEGIN_EVENT_TABLE(CCreateGeomorphicBoardDialog, wxDialog) + EVT_LISTBOX(XRCID("m_listBoard"), OnSelChangeBoardList) + EVT_BUTTON(XRCID("m_btnAddBoard"), OnBtnPressedAddBoard) + EVT_BUTTON(XRCID("m_btnAddBreak"), OnBtnPressedAddBreak) + EVT_BUTTON(XRCID("m_btnClearList"), OnBtnPressClear) + EVT_TEXT(XRCID("m_editBoardName"), OnChangeBoardName) + EVT_LISTBOX_DCLICK(XRCID("m_listBoard"), OnDblClickBoardList) +#if 0 ON_WM_HELPINFO() ON_WM_CONTEXTMENU() ON_BN_CLICKED(IDC_D_NEWGEO_HELP, OnBtnPressedHelp) - ON_WM_DESTROY() - //}}AFX_MSG_MAP -END_MESSAGE_MAP() +#endif +wxEND_EVENT_TABLE() +#if 0 ///////////////////////////////////////////////////////////////////////////// // Html Help control ID Map @@ -98,12 +88,13 @@ static DWORD adwHelpMap[] = IDC_D_NEWGEO_BOARD_LIST, IDH_D_NEWGEO_BOARD_LIST, 0,0 }; +#endif ///////////////////////////////////////////////////////////////////////////// void CCreateGeomorphicBoardDialog::LoadBoardListWithCompliantBoards() { - ResetContent(m_listBoard); + ResetContent(*m_listBoard); if (m_nMaxColumns != size_t(0) && m_nCurrentColumn == m_nMaxColumns) return; // No boards allowed since row break is only option @@ -176,47 +167,47 @@ void CCreateGeomorphicBoardDialog::LoadBoardListWithCompliantBoards() continue; } static const CB::string suffix[] = { "", " - 90°", " - 180°", " - 270°" }; - int nItem = m_listBoard.AddString(pBrd.GetName() + suffix[ptrdiff_t(r)]); - m_listBoard.SetItemDataPtr(nItem, ge.release()); + int nItem = m_listBoard->Append(pBrd.GetName() + suffix[ptrdiff_t(r)]); + m_listBoard->SetClientData(value_preserving_cast(nItem), ge.release()); } } - if (m_listBoard.GetCount() > 0) - m_listBoard.SetCurSel(0); + if (m_listBoard->GetCount() > 0) + m_listBoard->SetSelection(0); } void CCreateGeomorphicBoardDialog::UpdateButtons() { - BOOL bEnableOK = m_editBoardName.GetWindowTextLength() > size_t(0) && - m_listGeo.GetCount() > size_t(0) && + BOOL bEnableOK = !m_editBoardName->GetValue().empty() && + m_listGeo->GetCount() > size_t(0) && (m_nCurrentColumn == m_nMaxColumns || m_nMaxColumns == size_t(0)); - m_btnOK.EnableWindow(bEnableOK); + m_btnOK->Enable(bEnableOK); if (m_pRootBoard == NULL) { // Nothing added yet. Don't allow row break. - m_btnAddBreak.EnableWindow(FALSE); - m_btnAddBoard.EnableWindow(m_listBoard.GetCurSel() >= 0); + m_btnAddBreak->Enable(FALSE); + m_btnAddBoard->Enable(m_listBoard->GetSelection() != wxNOT_FOUND); } else if (m_nMaxColumns == size_t(0) && !m_tblColWidth.empty()) { // At least one column but no row break yet. Allow anything. - m_btnAddBreak.EnableWindow(TRUE); - m_btnAddBoard.EnableWindow(m_listBoard.GetCurSel() >= 0); + m_btnAddBreak->Enable(TRUE); + m_btnAddBoard->Enable(m_listBoard->GetSelection() != wxNOT_FOUND); } else if (m_nMaxColumns > size_t(0) && m_nCurrentColumn == m_nMaxColumns) { - m_btnAddBreak.EnableWindow(TRUE); - m_btnAddBoard.EnableWindow(FALSE); + m_btnAddBreak->Enable(TRUE); + m_btnAddBoard->Enable(FALSE); } else { // Somewhere other than the end of a follow on row // of boards. Only allow adding a board. - m_btnAddBreak.EnableWindow(FALSE); - m_btnAddBoard.EnableWindow(m_listBoard.GetCurSel() >= 0); + m_btnAddBreak->Enable(FALSE); + m_btnAddBoard->Enable(m_listBoard->GetSelection() != wxNOT_FOUND); } - m_btnClearList.EnableWindow(m_listGeo.GetCount() > 0); + m_btnClearList->Enable(m_listGeo->GetCount() > 0); } OwnerPtr CCreateGeomorphicBoardDialog::DetachGeomorphicBoard() @@ -227,26 +218,26 @@ OwnerPtr CCreateGeomorphicBoardDialog::DetachGeomorphicBoard() ///////////////////////////////////////////////////////////////////////////// // CCreateGeomorphicBoardDialog message handlers -void CCreateGeomorphicBoardDialog::OnSelChangeBoardList() +void CCreateGeomorphicBoardDialog::OnSelChangeBoardList(wxCommandEvent& /*event*/) { UpdateButtons(); } -void CCreateGeomorphicBoardDialog::OnChangeBoardName() +void CCreateGeomorphicBoardDialog::OnChangeBoardName(wxCommandEvent& /*event*/) { UpdateButtons(); } -void CCreateGeomorphicBoardDialog::OnDblClickBoardList() +void CCreateGeomorphicBoardDialog::OnDblClickBoardList(wxCommandEvent& event) { - if (m_btnAddBoard.IsWindowEnabled()) - OnBtnPressedAddBoard(); + if (m_btnAddBoard->IsEnabled()) + OnBtnPressedAddBoard(event); } -void CCreateGeomorphicBoardDialog::OnBtnPressedAddBoard() +void CCreateGeomorphicBoardDialog::OnBtnPressedAddBoard(wxCommandEvent& /*event*/) { - ASSERT(m_listBoard.GetCurSel() >= 0); - CGeoBoardElement& ge = *static_cast(m_listBoard.GetItemDataPtr(m_listBoard.GetCurSel())); + wxASSERT(m_listBoard->GetSelection() != wxNOT_FOUND); + CGeoBoardElement& ge = *static_cast(m_listBoard->GetClientData(m_listBoard->GetSelection())); CBoardManager& pBMgr = m_pDoc->GetBoardManager(); const CBoard& pBrd = pBMgr.Get(ge); const CBoardArray& pBArray = pBrd.GetBoardArray(); @@ -258,30 +249,30 @@ void CCreateGeomorphicBoardDialog::OnBtnPressedAddBoard() if (m_nCurrentRowHeight == size_t(0)) m_nCurrentRowHeight = pBArray.GetRows(); - CB::string strLabel = CB::string::GetText(m_listBoard, m_listBoard.GetCurSel()); + CB::string strLabel = m_listBoard->GetString(m_listBoard->GetSelection()); - int nItem = m_listGeo.AddString(strLabel); - m_listGeo.SetItemDataPtr(nItem, new CGeoBoardElement(ge)); + int nItem = m_listGeo->Append(strLabel); + m_listGeo->SetClientData(value_preserving_cast(nItem), new CGeoBoardElement(ge)); m_nCurrentColumn++; if (m_nCurrentColumn == m_nMaxColumns) { - m_btnAddBoard.EnableWindow(FALSE); - m_btnAddBreak.EnableWindow(TRUE); + m_btnAddBoard->Enable(FALSE); + m_btnAddBreak->Enable(TRUE); } else if (m_nMaxColumns == size_t(0) && !m_tblColWidth.empty()) - m_btnAddBreak.EnableWindow(TRUE); + m_btnAddBreak->Enable(TRUE); LoadBoardListWithCompliantBoards(); UpdateButtons(); } -void CCreateGeomorphicBoardDialog::OnBtnPressedAddBreak() +void CCreateGeomorphicBoardDialog::OnBtnPressedAddBreak(wxCommandEvent& /*event*/) { CB::string str = CB::string::LoadString(IDS_ROW_BREAK); - int nItem = m_listGeo.AddString(str); - m_listGeo.SetItemDataPtr(nItem, nullptr); + int nItem = m_listGeo->Append(str); + m_listGeo->SetClientData(value_preserving_cast(nItem), nullptr); m_nMaxColumns = m_tblColWidth.size(); m_nRowNumber++; @@ -292,9 +283,9 @@ void CCreateGeomorphicBoardDialog::OnBtnPressedAddBreak() UpdateButtons(); } -void CCreateGeomorphicBoardDialog::OnBtnPressClear() +void CCreateGeomorphicBoardDialog::OnBtnPressClear(wxCommandEvent& /*event*/) { - ResetContent(m_listGeo); + ResetContent(*m_listGeo); m_nMaxColumns = size_t(0); m_nCurrentColumn = size_t(0); m_nCurrentRowHeight = size_t(0); @@ -306,39 +297,50 @@ void CCreateGeomorphicBoardDialog::OnBtnPressClear() UpdateButtons(); } -BOOL CCreateGeomorphicBoardDialog::OnInitDialog() +bool CCreateGeomorphicBoardDialog::TransferDataToWindow() { - CDialog::OnInitDialog(); + if (!wxDialog::TransferDataToWindow()) + { + return false; + } LoadBoardListWithCompliantBoards(); UpdateButtons(); + // update layout after filling in m_listBoard + Fit(); + Centre(); - return TRUE; // return TRUE unless you set the focus to a control - // EXCEPTION: OCX Property Pages should return FALSE + return TRUE; } -void CCreateGeomorphicBoardDialog::OnOK() +bool CCreateGeomorphicBoardDialog::TransferDataFromWindow() { + if (!wxDialog::TransferDataFromWindow()) + { + return false; + } + m_pGeoBoard = MakeOwner(*m_pDoc); - CB::string strName = CB::string::GetWindowText(m_editBoardName); + CB::string strName = m_editBoardName->GetValue(); m_pGeoBoard->SetName(strName); - m_pGeoBoard->SetSerialNumber(m_pDoc->GetPBoardManager()->IssueGeoSerialNumber()); + m_pGeoBoard->SetSerialNumber(m_pDoc->GetPBoardManager().IssueGeoSerialNumber()); m_pGeoBoard->SetBoardRowCount(m_nRowNumber + size_t(1)); m_pGeoBoard->SetBoardColCount(m_tblColWidth.size()); - for (int i = 0; i < m_listGeo.GetCount(); i++) + for (unsigned int i = 0u; i < m_listGeo->GetCount(); i++) { - CGeoBoardElement* ge = static_cast(m_listGeo.GetItemDataPtr(i)); + CGeoBoardElement* ge = static_cast(m_listGeo->GetClientData(i)); if (!ge) continue; // Skip the row break m_pGeoBoard->AddElement(ge->m_nBoardSerialNum, ge->m_rotation); } - CDialog::OnOK(); + return true; } +#if 0 BOOL CCreateGeomorphicBoardDialog::OnHelpInfo(HELPINFO* pHelpInfo) { return GetApp()->DoHelpTipHelp(pHelpInfo, adwHelpMap); @@ -353,18 +355,20 @@ void CCreateGeomorphicBoardDialog::OnBtnPressedHelp() { GetApp()->DoHelpTopic("gp-adv-geomorphic.htm"); } +#endif -void CCreateGeomorphicBoardDialog::OnDestroy() +// see https://docs.wxwidgets.org/latest/classwx_window_destroy_event.html +CCreateGeomorphicBoardDialog::~CCreateGeomorphicBoardDialog() { - ResetContent(m_listBoard); - ResetContent(m_listGeo); + ResetContent(*m_listBoard); + ResetContent(*m_listGeo); } -void CCreateGeomorphicBoardDialog::ResetContent(CListBox& lb) +void CCreateGeomorphicBoardDialog::ResetContent(wxListBox& lb) { - for (int i = 0; i < lb.GetCount(); ++i) + for (unsigned int i = 0u; i < lb.GetCount(); ++i) { - delete static_cast(lb.GetItemDataPtr(i)); + delete static_cast(lb.GetClientData(i)); } - lb.ResetContent(); + lb.Clear(); } diff --git a/GP/DlgNewGeoBoard.h b/GP/DlgNewGeoBoard.h index a113be0..2bb97c9 100644 --- a/GP/DlgNewGeoBoard.h +++ b/GP/DlgNewGeoBoard.h @@ -1,6 +1,6 @@ // DlgNewGeoBoard.h : header file // -// Copyright (c) 1994-2020 By Dale L. Larson, All Rights Reserved. +// Copyright (c) 1994-2025 By Dale L. Larson & William Su, All Rights Reserved. // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the @@ -35,11 +35,13 @@ class CGamDoc; class CGeomorphicBoard; -class CCreateGeomorphicBoardDialog : public CDialog +class CCreateGeomorphicBoardDialog : public wxDialog { // Construction public: - CCreateGeomorphicBoardDialog(CGamDoc& doc, CWnd* pParent = NULL); // standard constructor + CCreateGeomorphicBoardDialog(CGamDoc& doc, wxWindow* pParent = &CB::GetMainWndWx()); // standard constructor + // see https://docs.wxwidgets.org/latest/classwx_window_destroy_event.html + ~CCreateGeomorphicBoardDialog(); // Operations public: @@ -47,28 +49,22 @@ class CCreateGeomorphicBoardDialog : public CDialog OwnerPtr DetachGeomorphicBoard(); // Dialog Data - //{{AFX_DATA(CCreateGeomorphicBoardDialog) - enum { IDD = IDD_GEOMORPHIC_BOARD }; - CButton m_btnOK; - CButton m_btnClearList; - CButton m_btnAddBreak; - CButton m_btnAddBoard; - CListBox m_listGeo; - CEdit m_editBoardName; - CListBox m_listBoard; - //}}AFX_DATA - private: + CB_XRC_BEGIN_CTRLS_DECL() + RefPtr m_btnOK; + RefPtr m_btnClearList; + RefPtr m_btnAddBreak; + RefPtr m_btnAddBoard; + RefPtr m_listGeo; + RefPtr m_editBoardName; + RefPtr m_listBoard; + CB_XRC_END_CTRLS_DECL() + RefPtr m_pDoc; public: // Overrides - // ClassWizard generated virtual function overrides - //{{AFX_VIRTUAL(CCreateGeomorphicBoardDialog) - protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support - //}}AFX_VIRTUAL // Implementation - vars protected: @@ -89,24 +85,22 @@ class CCreateGeomorphicBoardDialog : public CDialog void LoadBoardListWithCompliantBoards(); void UpdateButtons(); - // Generated message map functions - //{{AFX_MSG(CCreateGeomorphicBoardDialog) - virtual BOOL OnInitDialog(); - virtual void OnOK(); - afx_msg void OnSelChangeBoardList(); - afx_msg void OnBtnPressedAddBoard(); - afx_msg void OnBtnPressedAddBreak(); - afx_msg void OnBtnPressClear(); - afx_msg void OnChangeBoardName(); - afx_msg void OnDblClickBoardList(); + bool TransferDataToWindow() override; + bool TransferDataFromWindow() override; + void OnSelChangeBoardList(wxCommandEvent& event); + void OnBtnPressedAddBoard(wxCommandEvent& event); + void OnBtnPressedAddBreak(wxCommandEvent& event); + void OnBtnPressClear(wxCommandEvent& event); + void OnChangeBoardName(wxCommandEvent& event); + void OnDblClickBoardList(wxCommandEvent& event); +#if 0 afx_msg BOOL OnHelpInfo(HELPINFO* pHelpInfo); afx_msg void OnContextMenu(CWnd* pWnd, CPoint point); afx_msg void OnBtnPressedHelp(); - afx_msg void OnDestroy(); - //}}AFX_MSG - DECLARE_MESSAGE_MAP() +#endif + wxDECLARE_EVENT_TABLE(); - static void ResetContent(CListBox& lb); + static void ResetContent(wxListBox& lb); }; #endif diff --git a/GP/DlgPass.cpp b/GP/DlgPass.cpp index 5ca5eb3..922750a 100644 --- a/GP/DlgPass.cpp +++ b/GP/DlgPass.cpp @@ -1,6 +1,6 @@ // DlgPass.cpp : implementation file // -// Copyright (c) 1994-2020 By Dale L. Larson, All Rights Reserved. +// Copyright (c) 1994-2025 By Dale L. Larson & William Su, All Rights Reserved. // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the @@ -36,29 +36,34 @@ static char THIS_FILE[] = __FILE__; // CPasswordDialog dialog -CPasswordDialog::CPasswordDialog(CWnd* pParent /*=NULL*/) - : CDialog(CPasswordDialog::IDD, pParent) +CPasswordDialog::CPasswordDialog(wxWindow* pParent /*= &CB::GetMainWndWx()*/) : + CB_XRC_BEGIN_CTRLS_DEFN(pParent, CPasswordDialog) + CB_XRC_CTRL_VAL(m_editPassword, tempPassword) + CB_XRC_END_CTRLS_DEFN() { - //{{AFX_DATA_INIT(CPasswordDialog) m_strPassword = ""; - //}}AFX_DATA_INIT } - -void CPasswordDialog::DoDataExchange(CDataExchange* pDX) +bool CPasswordDialog::TransferDataToWindow() { - CDialog::DoDataExchange(pDX); - //{{AFX_DATA_MAP(CPasswordDialog) - DDX_Text(pDX, IDC_D_GETPASS_PASSWORD, m_strPassword); - //}}AFX_DATA_MAP + tempPassword = m_strPassword.wx_str(); + + if (!wxDialog::TransferDataToWindow()) + { + return false; + } + + return TRUE; } +bool CPasswordDialog::TransferDataFromWindow() +{ + if (!wxDialog::TransferDataFromWindow()) + { + return false; + } -BEGIN_MESSAGE_MAP(CPasswordDialog, CDialog) - //{{AFX_MSG_MAP(CPasswordDialog) - // NOTE: the ClassWizard will add message map macros here - //}}AFX_MSG_MAP -END_MESSAGE_MAP() + m_strPassword = tempPassword; -///////////////////////////////////////////////////////////////////////////// -// CPasswordDialog message handlers + return true; +} diff --git a/GP/DlgPass.h b/GP/DlgPass.h index 7909e2c..fb3b29a 100644 --- a/GP/DlgPass.h +++ b/GP/DlgPass.h @@ -1,6 +1,6 @@ // DlgPass.h : header file // -// Copyright (c) 1994-2020 By Dale L. Larson, All Rights Reserved. +// Copyright (c) 1994-2025 By Dale L. Larson & William Su, All Rights Reserved. // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the @@ -32,34 +32,24 @@ ///////////////////////////////////////////////////////////////////////////// // CPasswordDialog dialog -class CPasswordDialog : public CDialog +class CPasswordDialog : public wxDialog { // Construction public: - CPasswordDialog(CWnd* pParent = NULL); // standard constructor + CPasswordDialog(wxWindow* pParent = &CB::GetMainWndWx()); // standard constructor // Dialog Data - //{{AFX_DATA(CPasswordDialog) - enum { IDD = IDD_GET_PASSWORD }; CB::string m_strPassword; - //}}AFX_DATA - +private: + wxString tempPassword; + CB_XRC_BEGIN_CTRLS_DECL() + RefPtr m_editPassword; + CB_XRC_END_CTRLS_DECL() // Overrides - // ClassWizard generated virtual function overrides - //{{AFX_VIRTUAL(CPasswordDialog) - protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support - //}}AFX_VIRTUAL - -// Implementation -protected: - - // Generated message map functions - //{{AFX_MSG(CPasswordDialog) - // NOTE: the ClassWizard will add member functions here - //}}AFX_MSG - DECLARE_MESSAGE_MAP() +public: + bool TransferDataToWindow() override; + bool TransferDataFromWindow() override; }; #endif diff --git a/GP/DlgPbprp.cpp b/GP/DlgPbprp.cpp index a77b4cc..cec0d33 100644 --- a/GP/DlgPbprp.cpp +++ b/GP/DlgPbprp.cpp @@ -1,6 +1,6 @@ // DlgPbprp.cpp - Playing board properties // -// Copyright (c) 1994-2020 By Dale L. Larson, All Rights Reserved. +// Copyright (c) 1994-2025 By Dale L. Larson & William Su, All Rights Reserved. // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the @@ -37,10 +37,31 @@ static char THIS_FILE[] = __FILE__; // CPBrdPropDialog dialog -CPBrdPropDialog::CPBrdPropDialog(CWnd* pParent /*=NULL*/) - : CDialog(CPBrdPropDialog::IDD, pParent) +CPBrdPropDialog::CPBrdPropDialog(wxWindow* pParent /*= &CB::GetMainWndWx()*/) : + CB_XRC_BEGIN_CTRLS_DEFN(pParent, CPBrdPropDialog) + CB_XRC_CTRL(m_chkAllowAccess) + CB_XRC_CTRL(m_chkPrivate) + CB_XRC_CTRL(m_comboOwners) + CB_XRC_CTRL(m_staticOwnerLabel) + CB_XRC_CTRL(m_cpPlotColor) + CB_XRC_CTRL(m_comboPlotWd) + CB_XRC_CTRL_VAL(m_chkGridSnap, m_bGridSnap) + CB_XRC_CTRL_VAL(m_chkSmallCellBorders, m_bSmallCellBorders) + CB_XRC_CTRL_VAL(m_chkCellBorders, m_bCellBorders) + CB_XRC_CTRL_VAL(m_editXStackStagger, m_xStackStagger, -256, 256) + CB_XRC_CTRL_VAL(m_editYStackStagger, m_yStackStagger, -256, 256) + CB_XRC_CTRL_VAL(m_editBoardName, m_strBoardName) + CB_XRC_CTRL_VAL(m_chkGridRectCenters, m_bGridRectCenters) + CB_XRC_CTRL_VAL(m_chkSnapMovePlot, m_bSnapMovePlot) + CB_XRC_CTRL_VAL(m_editXGridSnapOff, m_fXGridSnapOff, 0.f, 255.999f) + CB_XRC_CTRL_VAL(m_editYGridSnapOff, m_fYGridSnapOff, 0.f, 255.999f) + CB_XRC_CTRL_VAL(m_editXGridSnap, m_fXGridSnap, 2.f, 256.f) + CB_XRC_CTRL_VAL(m_editYGridSnap, m_fYGridSnap, 2.f, 256.f) + CB_XRC_CTRL_VAL(m_chkOpenBoardOnLoad, m_bOpenBoardOnLoad) + CB_XRC_CTRL_VAL(m_chkShowSelListAndTinyMap, m_bShowSelListAndTinyMap) + CB_XRC_CTRL_VAL(m_chkDrawLockedBeneath, m_bDrawLockedBeneath) + CB_XRC_END_CTRLS_DEFN() { - //{{AFX_DATA_INIT(CPBrdPropDialog) m_bGridSnap = FALSE; m_bSmallCellBorders = FALSE; m_bCellBorders = FALSE; @@ -56,57 +77,23 @@ CPBrdPropDialog::CPBrdPropDialog(CWnd* pParent /*=NULL*/) m_bOpenBoardOnLoad = FALSE; m_bShowSelListAndTinyMap = FALSE; m_bDrawLockedBeneath = TRUE; - //}}AFX_DATA_INIT - m_crPlotColor = RGB(0,0,0); - m_nPlotWd = 1; + m_crPlotColor = wxColour(0,0,0); + m_nPlotWd = uint32_t(1); m_bNonOwnerAccess = FALSE; m_bPrivate = FALSE; - m_nOwnerSel = -1; + m_nOwnerSel = INVALID_PLAYER; m_pPlayerMgr = NULL; m_bOwnerInfoIsReadOnly = FALSE; } -void CPBrdPropDialog::DoDataExchange(CDataExchange* pDX) -{ - CDialog::DoDataExchange(pDX); - //{{AFX_DATA_MAP(CPBrdPropDialog) - DDX_Control(pDX, IDC_D_PBPRP_NONOWNER_ACCESS, m_chkAllowAccess); - DDX_Control(pDX, IDC_D_PBPRP_NONOWNER_HIDE, m_chkPrivate); - DDX_Control(pDX, IDC_D_PBPRP_OWNER_LIST, m_comboOwners); - DDX_Control(pDX, IDC_D_PBPRP_OWNER_LABEL, m_staticOwnerLabel); - DDX_Control(pDX, IDC_D_PBPRP_PLOTCOLOR, m_cpPlotColor); - DDX_Control(pDX, IDC_D_PBPRP_PLOTWIDTH, m_comboPlotWd); - DDX_Check(pDX, IDC_D_PBPRP_SNAPON, m_bGridSnap); - DDX_Check(pDX, IDC_D_PBPRP_S_CELLBORDER, m_bSmallCellBorders); - DDX_Check(pDX, IDC_D_PBPRP_L_CELLBORDER, m_bCellBorders); - DDX_Text(pDX, IDC_D_PBPRP_XPCE_STGGR, m_xStackStagger); - DDV_MinMaxInt(pDX, m_xStackStagger, -256, 256); - DDX_Text(pDX, IDC_D_PBPRP_YPCE_STGGR, m_yStackStagger); - DDV_MinMaxInt(pDX, m_yStackStagger, -256, 256); - DDX_Text(pDX, IDC_D_PBPRP_BOARDNAME, m_strBoardName); - DDX_Check(pDX, IDC_D_PBPRP_S_RECTCENTER, m_bGridRectCenters); - DDX_Check(pDX, IDC_D_PBPRP_S_SNAPPLOTS, m_bSnapMovePlot); - DDX_Text(pDX, IDC_D_PBPRP_XOFFSET, m_fXGridSnapOff); - DDV_MinMaxFloat(pDX, m_fXGridSnapOff, 0.f, 255.999f); - DDX_Text(pDX, IDC_D_PBPRP_YOFFSET, m_fYGridSnapOff); - DDV_MinMaxFloat(pDX, m_fYGridSnapOff, 0.f, 255.999f); - DDX_Text(pDX, IDC_D_PBPRP_XPIXELS, m_fXGridSnap); - DDV_MinMaxFloat(pDX, m_fXGridSnap, 2.f, 256.f); - DDX_Text(pDX, IDC_D_PBPRP_YPIXELS, m_fYGridSnap); - DDV_MinMaxFloat(pDX, m_fYGridSnap, 2.f, 256.f); - DDX_Check(pDX, IDC_D_PBPRP_AUTOOPEN, m_bOpenBoardOnLoad); - DDX_Check(pDX, IDC_D_PBPRP_SHOW_SEL_AND_TINY, m_bShowSelListAndTinyMap); - DDX_Check(pDX, IDC_D_PBPRP_DRAW_LOCKED_BENEATH, m_bDrawLockedBeneath); - //}}AFX_DATA_MAP -} - -BEGIN_MESSAGE_MAP(CPBrdPropDialog, CDialog) - //{{AFX_MSG_MAP(CPBrdPropDialog) +wxBEGIN_EVENT_TABLE(CPBrdPropDialog, wxDialog) +#if 0 ON_WM_HELPINFO() ON_WM_CONTEXTMENU() - //}}AFX_MSG_MAP -END_MESSAGE_MAP() +#endif +wxEND_EVENT_TABLE() +#if 0 ///////////////////////////////////////////////////////////////////////////// // Html Help control ID Map @@ -143,19 +130,23 @@ void CPBrdPropDialog::OnContextMenu(CWnd* pWnd, CPoint point) { GetApp()->DoHelpWhatIsHelp(pWnd, adwHelpMap); } +#endif ///////////////////////////////////////////////////////////////////////////// // CPBrdPropDialog message handlers -void CPBrdPropDialog::OnOK() +bool CPBrdPropDialog::TransferDataFromWindow() { - m_crPlotColor = m_cpPlotColor.GetColor(); + m_crPlotColor = m_cpPlotColor->GetColour(); - int nIdx = m_comboPlotWd.GetCurSel(); - if (nIdx >= 0) - m_nPlotWd = nIdx + 1; + int nIdx = m_comboPlotWd->GetSelection(); + if (nIdx != wxNOT_FOUND) + m_nPlotWd = value_preserving_cast(nIdx) + uint32_t(1); - CDialog::OnOK(); + if (!wxDialog::TransferDataFromWindow()) + { + return false; + } // Make sure these are within grid size @@ -164,7 +155,7 @@ void CPBrdPropDialog::OnOK() m_xGridSnap = value_preserving_cast(std::round(m_fXGridSnap * 1000)); m_yGridSnap = value_preserving_cast(std::round(m_fYGridSnap * 1000)); - ASSERT(m_xGridSnap > 0u && m_yGridSnap > 0u); + wxASSERT(m_xGridSnap > 0u && m_yGridSnap > 0u); if (m_xGridSnap > 0u) m_xGridSnapOff = m_xGridSnapOff % m_xGridSnap; if (m_yGridSnap > 0u) @@ -172,59 +163,60 @@ void CPBrdPropDialog::OnOK() if (m_pPlayerMgr != NULL && !m_bOwnerInfoIsReadOnly) { - m_nOwnerSel = m_comboOwners.GetCurSel() - 1; - m_bNonOwnerAccess = m_chkAllowAccess.GetCheck() != 0; - m_bPrivate = m_chkPrivate.GetCheck() != 0; + m_nOwnerSel = PlayerId(m_comboOwners->GetSelection() - 1); + m_bNonOwnerAccess = m_chkAllowAccess->GetValue(); + m_bPrivate = m_chkPrivate->GetValue(); } + + return true; } -BOOL CPBrdPropDialog::OnInitDialog() +bool CPBrdPropDialog::TransferDataToWindow() { m_fXGridSnapOff = value_preserving_cast(m_xGridSnapOff) / 1000.f; m_fYGridSnapOff = value_preserving_cast(m_yGridSnapOff) / 1000.f; m_fXGridSnap = value_preserving_cast(m_xGridSnap) / 1000.f; m_fYGridSnap = value_preserving_cast(m_yGridSnap) / 1000.f; - CDialog::OnInitDialog(); + if (!wxDialog::TransferDataToWindow()) + { + return false; + } - m_cpPlotColor.SetColor(m_crPlotColor); + m_cpPlotColor->SetColour(m_crPlotColor); - if (m_nPlotWd <= 0) - m_nPlotWd = 1; - ASSERT((int)m_nPlotWd <= m_comboPlotWd.GetCount()); - m_comboPlotWd.SetCurSel(m_nPlotWd - 1); + if (m_nPlotWd == 0u) + m_nPlotWd = 1u; + wxASSERT(m_nPlotWd <= m_comboPlotWd->GetCount()); + m_comboPlotWd->SetSelection(value_preserving_cast(m_nPlotWd) - 1); if (m_pPlayerMgr == NULL) { - m_comboOwners.EnableWindow(FALSE); - m_staticOwnerLabel.EnableWindow(FALSE); - m_chkAllowAccess.SetCheck(0); - m_chkAllowAccess.EnableWindow(FALSE); - m_chkPrivate.SetCheck(0); - m_chkPrivate.EnableWindow(FALSE); + m_comboOwners->Enable(FALSE); + m_staticOwnerLabel->Enable(FALSE); + m_chkAllowAccess->SetValue(false); + m_chkAllowAccess->Enable(FALSE); + m_chkPrivate->SetValue(false); + m_chkPrivate->Enable(FALSE); } else { CB::string str = CB::string::LoadString(IDS_LBL_NO_OWNER); - m_comboOwners.AddString(str); - for (int i = 0; i < m_pPlayerMgr->GetSize(); i++) - m_comboOwners.AddString(m_pPlayerMgr->GetAt(i).m_strName); - m_comboOwners.SetCurSel(m_nOwnerSel + 1); - m_chkAllowAccess.SetCheck(m_bNonOwnerAccess ? 1 : 0); - m_chkPrivate.SetCheck(m_bPrivate ? 1 : 0); + m_comboOwners->Append(str); + for (const Player& player : *m_pPlayerMgr) + { + m_comboOwners->Append(player.m_strName); + } + m_comboOwners->SetSelection(static_cast(m_nOwnerSel) + 1); + m_chkAllowAccess->SetValue(m_bNonOwnerAccess); + m_chkPrivate->SetValue(m_bPrivate); } if (m_bOwnerInfoIsReadOnly) { - m_comboOwners.EnableWindow(FALSE); - m_chkAllowAccess.EnableWindow(FALSE); - m_chkPrivate.EnableWindow(FALSE); + m_comboOwners->Enable(FALSE); + m_chkAllowAccess->Enable(FALSE); + m_chkPrivate->Enable(FALSE); } return TRUE; // return TRUE unless you set the focus to a control } - - -void CPBrdPropDialog::OnBnClickedDPbprpShowSelAndTiny2() -{ - // TODO: Add your control notification handler code here -} diff --git a/GP/DlgPbprp.h b/GP/DlgPbprp.h index 3172560..e1ff773 100644 --- a/GP/DlgPbprp.h +++ b/GP/DlgPbprp.h @@ -1,6 +1,6 @@ // DlgPbprp.h - Playing board properties // -// Copyright (c) 1994-2020 By Dale L. Larson, All Rights Reserved. +// Copyright (c) 1994-2025 By Dale L. Larson & William Su, All Rights Reserved. // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the @@ -27,39 +27,26 @@ class CPlayerManager; -class CPBrdPropDialog : public CDialog +class CPBrdPropDialog : public wxDialog { // Construction public: - CPBrdPropDialog(CWnd* pParent = NULL); // standard constructor + CPBrdPropDialog(wxWindow* pParent = &CB::GetMainWndWx()); // standard constructor // Dialog Data - //{{AFX_DATA(CPBrdPropDialog) - enum { IDD = IDD_PBRDPROP }; - CButton m_chkAllowAccess; - CButton m_chkPrivate; - CComboBox m_comboOwners; - CStatic m_staticOwnerLabel; - CMFCColorButton m_cpPlotColor; - CComboBox m_comboPlotWd; - BOOL m_bGridSnap; - BOOL m_bSmallCellBorders; - BOOL m_bCellBorders; + bool m_bGridSnap; + bool m_bSmallCellBorders; + bool m_bCellBorders; int m_xStackStagger; int m_yStackStagger; - CB::string m_strBoardName; - BOOL m_bGridRectCenters; - BOOL m_bSnapMovePlot; - float m_fXGridSnapOff; - float m_fYGridSnapOff; - float m_fXGridSnap; - float m_fYGridSnap; - BOOL m_bOpenBoardOnLoad; - BOOL m_bShowSelListAndTinyMap; - BOOL m_bDrawLockedBeneath; - //}}AFX_DATA + wxString m_strBoardName; + bool m_bGridRectCenters; + bool m_bSnapMovePlot; + bool m_bOpenBoardOnLoad; + bool m_bShowSelListAndTinyMap; + bool m_bDrawLockedBeneath; - COLORREF m_crPlotColor; + wxColour m_crPlotColor; UINT m_nPlotWd; uint32_t m_xGridSnapOff; @@ -70,23 +57,46 @@ class CPBrdPropDialog : public CDialog BOOL m_bOwnerInfoIsReadOnly; BOOL m_bNonOwnerAccess; BOOL m_bPrivate; - int m_nOwnerSel; // -1 = no owner, 0 = first player, .... + PlayerId m_nOwnerSel; // -1 = no owner, 0 = first player, .... CPlayerManager* m_pPlayerMgr; +private: + float m_fXGridSnapOff; + float m_fYGridSnapOff; + float m_fXGridSnap; + float m_fYGridSnap; + CB_XRC_BEGIN_CTRLS_DECL() + RefPtr m_chkAllowAccess; + RefPtr m_chkPrivate; + RefPtr m_comboOwners; + RefPtr m_staticOwnerLabel; + RefPtr m_cpPlotColor; + RefPtr m_comboPlotWd; + RefPtr m_chkGridSnap; + RefPtr m_chkSmallCellBorders; + RefPtr m_chkCellBorders; + RefPtr m_editXStackStagger; + RefPtr m_editYStackStagger; + RefPtr m_editBoardName; + RefPtr m_chkGridRectCenters; + RefPtr m_chkSnapMovePlot; + RefPtr m_editXGridSnapOff; + RefPtr m_editYGridSnapOff; + RefPtr m_editXGridSnap; + RefPtr m_editYGridSnap; + RefPtr m_chkOpenBoardOnLoad; + RefPtr m_chkShowSelListAndTinyMap; + RefPtr m_chkDrawLockedBeneath; + CB_XRC_END_CTRLS_DECL() // Implementation protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support - - // Generated message map functions - //{{AFX_MSG(CPBrdPropDialog) - virtual void OnOK(); - virtual BOOL OnInitDialog(); + bool TransferDataFromWindow() override; + bool TransferDataToWindow() override; +#if 0 afx_msg BOOL OnHelpInfo(HELPINFO* pHelpInfo); afx_msg void OnContextMenu(CWnd* pWnd, CPoint point); - //}}AFX_MSG - DECLARE_MESSAGE_MAP() -public: - afx_msg void OnBnClickedDPbprpShowSelAndTiny2(); +#endif + wxDECLARE_EVENT_TABLE(); }; diff --git a/GP/DlgRmsg.h b/GP/DlgRmsg.h index 63e1e5c..5cfa5a6 100644 --- a/GP/DlgRmsg.h +++ b/GP/DlgRmsg.h @@ -25,6 +25,7 @@ ///////////////////////////////////////////////////////////////////////////// // CReadMsgDialog dialog +#error dead code class CReadMsgDialog : public CDialog { DECLARE_DYNAMIC(CReadMsgDialog) diff --git a/GP/DlgRot.h b/GP/DlgRot.h index 5eca43c..4d1e74d 100644 --- a/GP/DlgRot.h +++ b/GP/DlgRot.h @@ -24,6 +24,7 @@ ///////////////////////////////////////////////////////////////////////////// // CRotateDialog dialog +#error dead code class CDib; diff --git a/GP/DlgRotpc.cpp b/GP/DlgRotpc.cpp index ac9e835..0439717 100644 --- a/GP/DlgRotpc.cpp +++ b/GP/DlgRotpc.cpp @@ -1,6 +1,6 @@ // DlgRotpc.cpp : implementation file // -// Copyright (c) 1994-2020 By Dale L. Larson, All Rights Reserved. +// Copyright (c) 1994-2025 By Dale L. Larson & William Su, All Rights Reserved. // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the @@ -35,36 +35,41 @@ static char THIS_FILE[] = __FILE__; ///////////////////////////////////////////////////////////////////////////// // CRotatePieceDialog dialog -CRotatePieceDialog::CRotatePieceDialog(CWnd* pParent /*=NULL*/) - : CDialog(CRotatePieceDialog::IDD, pParent) +CRotatePieceDialog::CRotatePieceDialog(CWnd& v, wxWindow* pParent /*= &CB::GetMainWndWx()*/) : + CB_XRC_BEGIN_CTRLS_DEFN(pParent, CRotatePieceDialog) + CB_XRC_CTRL_VAL(m_editCurVal, m_nRelativeRotation, -359, 359, wxNUM_VAL_SIGN_PLUS) + CB_XRC_END_CTRLS_DEFN(), + view(&v) { - m_nRelativeRotation = 0; -} + // KLUDGE: don't see a way to use GetSizeFromText() in .xrc + wxSize size = m_editCurVal->GetSizeFromText("+999"_cbstring); + m_editCurVal->CacheBestSize(size); + SetMinSize(wxDefaultSize); + Layout(); + Fit(); + Centre(); -void CRotatePieceDialog::DoDataExchange(CDataExchange* pDX) -{ - CDialog::DoDataExchange(pDX); - //{{AFX_DATA_MAP(CRotatePieceDialog) - DDX_Control(pDX, IDC_D_ROTPCE_CURVAL, m_editCurVal); - //}}AFX_DATA_MAP + m_nRelativeRotation = 0; } -BEGIN_MESSAGE_MAP(CRotatePieceDialog, CDialog) - //{{AFX_MSG_MAP(CRotatePieceDialog) - ON_BN_CLICKED(IDC_D_ROTPCE_CCW1, OnRotatePieceCCW1) - ON_BN_CLICKED(IDC_D_ROTPCE_CCW5, OnRotatePieceCCW5) - ON_BN_CLICKED(IDC_D_ROTPCE_CCW10, OnRotatePieceCCW10) - ON_BN_CLICKED(IDC_D_ROTPCE_CCW50, OnRotatePieceCCW50) - ON_BN_CLICKED(IDC_D_ROTPCE_CW1, OnRotatePieceCW1) - ON_BN_CLICKED(IDC_D_ROTPCE_CW5, OnRotatePieceCW5) - ON_BN_CLICKED(IDC_D_ROTPCE_CW10, OnRotatePieceCW10) - ON_BN_CLICKED(IDC_D_ROTPCE_CW50, OnRotatePieceCW50) + +wxBEGIN_EVENT_TABLE(CRotatePieceDialog, wxDialog) + EVT_BUTTON(XRCID("OnRotatePieceCCW1"), OnRotatePieceCCW1) + EVT_BUTTON(XRCID("OnRotatePieceCCW5"), OnRotatePieceCCW5) + EVT_BUTTON(XRCID("OnRotatePieceCCW10"), OnRotatePieceCCW10) + EVT_BUTTON(XRCID("OnRotatePieceCCW50"), OnRotatePieceCCW50) + EVT_BUTTON(XRCID("OnRotatePieceCW1"), OnRotatePieceCW1) + EVT_BUTTON(XRCID("OnRotatePieceCW5"), OnRotatePieceCW5) + EVT_BUTTON(XRCID("OnRotatePieceCW10"), OnRotatePieceCW10) + EVT_BUTTON(XRCID("OnRotatePieceCW50"), OnRotatePieceCW50) +#if 0 ON_WM_HELPINFO() ON_WM_CONTEXTMENU() - //}}AFX_MSG_MAP -END_MESSAGE_MAP() +#endif +wxEND_EVENT_TABLE() +#if 0 ///////////////////////////////////////////////////////////////////////////// // Html Help control ID Map @@ -91,73 +96,54 @@ void CRotatePieceDialog::OnContextMenu(CWnd* pWnd, CPoint point) { GetApp()->DoHelpWhatIsHelp(pWnd, adwHelpMap); } +#endif ///////////////////////////////////////////////////////////////////////////// // CRotatePieceDialog message handlers -void CRotatePieceDialog::UpdateRotationValue() -{ - CB::string szBfr; - if (m_nRelativeRotation != 0) - { - szBfr = std::format(L"{}{}", m_nRelativeRotation < 0 ? L'-' : L'+', - abs(m_nRelativeRotation)); - } - else - szBfr = "0"; - m_editCurVal.SetWindowText(szBfr); -} - void CRotatePieceDialog::ApplyOffset(int nOffset) { m_nRelativeRotation = (m_nRelativeRotation + nOffset) % 360; - m_pParentWnd->SendMessage(WM_ROTATEPIECE_DELTA, (WPARAM)m_nRelativeRotation); - UpdateRotationValue(); + view->SendMessage(WM_ROTATEPIECE_DELTA, (WPARAM)m_nRelativeRotation); + TransferDataToWindow(); } -void CRotatePieceDialog::OnRotatePieceCCW1() +void CRotatePieceDialog::OnRotatePieceCCW1(wxCommandEvent& /*event*/) { ApplyOffset(-1); } -void CRotatePieceDialog::OnRotatePieceCCW5() +void CRotatePieceDialog::OnRotatePieceCCW5(wxCommandEvent& /*event*/) { ApplyOffset(-5); } -void CRotatePieceDialog::OnRotatePieceCCW10() +void CRotatePieceDialog::OnRotatePieceCCW10(wxCommandEvent& /*event*/) { ApplyOffset(-10); } -void CRotatePieceDialog::OnRotatePieceCCW50() +void CRotatePieceDialog::OnRotatePieceCCW50(wxCommandEvent& /*event*/) { ApplyOffset(-50); } -void CRotatePieceDialog::OnRotatePieceCW1() +void CRotatePieceDialog::OnRotatePieceCW1(wxCommandEvent& /*event*/) { ApplyOffset(1); } -void CRotatePieceDialog::OnRotatePieceCW5() +void CRotatePieceDialog::OnRotatePieceCW5(wxCommandEvent& /*event*/) { ApplyOffset(5); } -void CRotatePieceDialog::OnRotatePieceCW10() +void CRotatePieceDialog::OnRotatePieceCW10(wxCommandEvent& /*event*/) { ApplyOffset(10); } -void CRotatePieceDialog::OnRotatePieceCW50() +void CRotatePieceDialog::OnRotatePieceCW50(wxCommandEvent& /*event*/) { ApplyOffset(50); } - -BOOL CRotatePieceDialog::OnInitDialog() -{ - CDialog::OnInitDialog(); - UpdateRotationValue(); - return TRUE; -} diff --git a/GP/DlgRotpc.h b/GP/DlgRotpc.h index f811d2f..7bc339b 100644 --- a/GP/DlgRotpc.h +++ b/GP/DlgRotpc.h @@ -1,6 +1,6 @@ // DlgRotpc.h : header file // -// Copyright (c) 1994-2020 By Dale L. Larson, All Rights Reserved. +// Copyright (c) 1994-2025 By Dale L. Larson & William Su, All Rights Reserved. // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the @@ -32,44 +32,45 @@ ///////////////////////////////////////////////////////////////////////////// // CRotatePieceDialog dialog -class CRotatePieceDialog : public CDialog +class CRotatePieceDialog : public wxDialog { // Construction public: - CRotatePieceDialog(CWnd* pParent = NULL); // standard constructor + /* TEMPORARY: this needs to send msgs to the view, but that + hasn't been converted to wx yet, so can't be passed as + parent */ + CRotatePieceDialog(CWnd& v, wxWindow* pParent = &CB::GetMainWndWx()); // standard constructor // Dialog Data - //{{AFX_DATA(CRotatePieceDialog) - enum { IDD = IDD_ROTATEPIECE }; - CEdit m_editCurVal; - //}}AFX_DATA - int m_nRelativeRotation; +private: + CB_XRC_BEGIN_CTRLS_DECL() + RefPtr m_editCurVal; + CB_XRC_END_CTRLS_DECL() // Overrides protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support - virtual BOOL OnInitDialog(); // Implementation protected: void ApplyOffset(int nOffset); - void UpdateRotationValue(); - // Generated message map functions - //{{AFX_MSG(CRotatePieceDialog) - afx_msg void OnRotatePieceCCW1(); - afx_msg void OnRotatePieceCCW5(); - afx_msg void OnRotatePieceCCW10(); - afx_msg void OnRotatePieceCCW50(); - afx_msg void OnRotatePieceCW1(); - afx_msg void OnRotatePieceCW5(); - afx_msg void OnRotatePieceCW10(); - afx_msg void OnRotatePieceCW50(); + void OnRotatePieceCCW1(wxCommandEvent& event); + void OnRotatePieceCCW5(wxCommandEvent& event); + void OnRotatePieceCCW10(wxCommandEvent& event); + void OnRotatePieceCCW50(wxCommandEvent& event); + void OnRotatePieceCW1(wxCommandEvent& event); + void OnRotatePieceCW5(wxCommandEvent& event); + void OnRotatePieceCW10(wxCommandEvent& event); + void OnRotatePieceCW50(wxCommandEvent& event); +#if 0 afx_msg BOOL OnHelpInfo(HELPINFO* pHelpInfo); afx_msg void OnContextMenu(CWnd* pWnd, CPoint point); - //}}AFX_MSG - DECLARE_MESSAGE_MAP() +#endif + wxDECLARE_EVENT_TABLE(); + +private: + RefPtr view; }; #endif diff --git a/GP/DlgScnp.cpp b/GP/DlgScnp.cpp index 3795110..4b2409f 100644 --- a/GP/DlgScnp.cpp +++ b/GP/DlgScnp.cpp @@ -1,6 +1,6 @@ // DlgScnp.cpp : implementation file // -// Copyright (c) 1994-2020 By Dale L. Larson, All Rights Reserved. +// Copyright (c) 1994-2025 By Dale L. Larson & William Su, All Rights Reserved. // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the @@ -38,37 +38,35 @@ static char THIS_FILE[] = __FILE__; ///////////////////////////////////////////////////////////////////////////// // CScnPropDialog dialog -CScnPropDialog::CScnPropDialog(CWnd* pParent /*=NULL*/) - : CDialog(CScnPropDialog::IDD, pParent) +CScnPropDialog::CScnPropDialog(wxWindow* pParent /*= &CB::GetMainWndWx()*/) : + CB_XRC_BEGIN_CTRLS_DEFN(pParent, CScnPropDialog) + CB_XRC_CTRL_VAL(m_editAuthor, m_strAuthor, wxFILTER_NONE, 60) + CB_XRC_CTRL_VAL(m_editTitle, m_strTitle, wxFILTER_NONE, 60) + CB_XRC_CTRL_VAL(m_editDescr, m_strDescr, wxFILTER_NONE, 2500) + CB_XRC_END_CTRLS_DEFN() { - //{{AFX_DATA_INIT(CScnPropDialog) + // KLUDGE: don't see a way to use GetSizeFromText() in .xrc + wxSize size = m_editTitle->GetSizeFromText(m_editTitle->GetValue()); + m_editTitle->CacheBestSize(size); + + SetMinSize(wxDefaultSize); + Layout(); + Fit(); + Centre(); + m_strAuthor = ""; m_strTitle = ""; m_strDescr = ""; - //}}AFX_DATA_INIT } -void CScnPropDialog::DoDataExchange(CDataExchange* pDX) -{ - CDialog::DoDataExchange(pDX); - //{{AFX_DATA_MAP(CScnPropDialog) - DDX_Text(pDX, IDC_D_SCNPRP_AUTHOR, m_strAuthor); - DDV_MaxChars(pDX, m_strAuthor, 60); - DDX_Text(pDX, IDC_D_SCNPRP_TITLE, m_strTitle); - DDV_MaxChars(pDX, m_strTitle, 60); - DDX_Text(pDX, IDC_D_SCNPRP_DESCR, m_strDescr); - DDV_MaxChars(pDX, m_strDescr, 2500); - //}}AFX_DATA_MAP -} - -BEGIN_MESSAGE_MAP(CScnPropDialog, CDialog) - //{{AFX_MSG_MAP(CScnPropDialog) - // NOTE: the ClassWizard will add message map macros here +wxBEGIN_EVENT_TABLE(CScnPropDialog, wxDialog) +#if 0 ON_WM_HELPINFO() ON_WM_CONTEXTMENU() - //}}AFX_MSG_MAP -END_MESSAGE_MAP() +#endif +wxEND_EVENT_TABLE() +#if 0 ///////////////////////////////////////////////////////////////////////////// // Html Help control ID Map @@ -89,4 +87,5 @@ void CScnPropDialog::OnContextMenu(CWnd* pWnd, CPoint point) { GetApp()->DoHelpWhatIsHelp(pWnd, adwHelpMap); } +#endif diff --git a/GP/DlgScnp.h b/GP/DlgScnp.h index 02f796f..34b429f 100644 --- a/GP/DlgScnp.h +++ b/GP/DlgScnp.h @@ -1,6 +1,6 @@ // DlgScnp.h : header file // -// Copyright (c) 1994-2020 By Dale L. Larson, All Rights Reserved. +// Copyright (c) 1994-2025 By Dale L. Larson & William Su, All Rights Reserved. // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the @@ -25,29 +25,28 @@ ///////////////////////////////////////////////////////////////////////////// // CScnPropDialog dialog -class CScnPropDialog : public CDialog +class CScnPropDialog : public wxDialog { // Construction public: - CScnPropDialog(CWnd* pParent = NULL); // standard constructor + CScnPropDialog(wxWindow* pParent = &CB::GetMainWndWx()); // standard constructor // Dialog Data - //{{AFX_DATA(CScnPropDialog) - enum { IDD = IDD_SCNPROP }; - CB::string m_strAuthor; - CB::string m_strTitle; - CB::string m_strDescr; - //}}AFX_DATA + wxString m_strAuthor; + wxString m_strTitle; + wxString m_strDescr; +private: + CB_XRC_BEGIN_CTRLS_DECL() + RefPtr m_editAuthor; + RefPtr m_editTitle; + RefPtr m_editDescr; + CB_XRC_END_CTRLS_DECL() // Implementation protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support - - // Generated message map functions - //{{AFX_MSG(CScnPropDialog) - // NOTE: the ClassWizard will add member functions here +#if 0 afx_msg BOOL OnHelpInfo(HELPINFO* pHelpInfo); afx_msg void OnContextMenu(CWnd* pWnd, CPoint point); - //}}AFX_MSG - DECLARE_MESSAGE_MAP() +#endif + wxDECLARE_EVENT_TABLE(); }; diff --git a/GP/DlgSelOwner.cpp b/GP/DlgSelOwner.cpp index 37bd1b2..7371dde 100644 --- a/GP/DlgSelOwner.cpp +++ b/GP/DlgSelOwner.cpp @@ -1,6 +1,6 @@ // DlgSelOwner.cpp : implementation file // -// Copyright (c) 1994-2020 By Dale L. Larson, All Rights Reserved. +// Copyright (c) 1994-2025 By Dale L. Larson & William Su, All Rights Reserved. // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the @@ -36,35 +36,26 @@ static char THIS_FILE[] = __FILE__; ///////////////////////////////////////////////////////////////////////////// // CSelectNewOwnerDialog dialog -CSelectNewOwnerDialog::CSelectNewOwnerDialog(CWnd* pParent /*=NULL*/) - : CDialog(CSelectNewOwnerDialog::IDD, pParent) +CSelectNewOwnerDialog::CSelectNewOwnerDialog(CPlayerManager& pm, wxWindow* pParent /*= &CB::GetMainWndWx()*/) : + CB_XRC_BEGIN_CTRLS_DEFN(pParent, CSelectNewOwnerDialog) + , m_btnOK(XRCCTRL(*this, "wxID_OK", std::remove_reference_t)) + CB_XRC_CTRL(m_listPlayers) + CB_XRC_END_CTRLS_DEFN(), + m_pPlayerMgr(&pm) { - //{{AFX_DATA_INIT(CSelectNewOwnerDialog) - // NOTE: the ClassWizard will add member initialization here - //}}AFX_DATA_INIT - - m_nPlayer = -1; - m_pPlayerMgr = NULL; + m_nPlayer = INVALID_PLAYER; } -void CSelectNewOwnerDialog::DoDataExchange(CDataExchange* pDX) -{ - CDialog::DoDataExchange(pDX); - //{{AFX_DATA_MAP(CSelectNewOwnerDialog) - DDX_Control(pDX, IDOK, m_btnOK); - DDX_Control(pDX, IDC_D_SELOWN_LIST, m_listPlayers); - //}}AFX_DATA_MAP -} - -BEGIN_MESSAGE_MAP(CSelectNewOwnerDialog, CDialog) - //{{AFX_MSG_MAP(CSelectNewOwnerDialog) - ON_LBN_SELCHANGE(IDC_D_SELOWN_LIST, OnSelChangePlayerList) - ON_LBN_DBLCLK(IDC_D_SELOWN_LIST, OnDblClkPlayerList) +wxBEGIN_EVENT_TABLE(CSelectNewOwnerDialog, wxDialog) + EVT_LISTBOX(XRCID("m_listPlayers"), OnSelChangePlayerList) + EVT_LISTBOX_DCLICK(XRCID("m_listPlayers"), OnDblClkPlayerList) +#if 0 ON_WM_HELPINFO() ON_WM_CONTEXTMENU() - //}}AFX_MSG_MAP -END_MESSAGE_MAP() +#endif +wxEND_EVENT_TABLE() +#if 0 ///////////////////////////////////////////////////////////////////////////// // Html Help control ID Map @@ -83,37 +74,44 @@ void CSelectNewOwnerDialog::OnContextMenu(CWnd* pWnd, CPoint point) { GetApp()->DoHelpWhatIsHelp(pWnd, adwHelpMap); } +#endif ///////////////////////////////////////////////////////////////////////////// // CSelectNewOwnerDialog message handlers -void CSelectNewOwnerDialog::OnOK() +bool CSelectNewOwnerDialog::TransferDataFromWindow() { - m_nPlayer = m_listPlayers.GetCurSel(); - CDialog::OnOK(); + if (!wxDialog::TransferDataFromWindow()) + { + return false; + } + + m_nPlayer = PlayerId(m_listPlayers->GetSelection()); + + return true; } -BOOL CSelectNewOwnerDialog::OnInitDialog() +bool CSelectNewOwnerDialog::TransferDataToWindow() { - CDialog::OnInitDialog(); - - for (int i = 0; i < m_pPlayerMgr->GetSize(); i++) - m_listPlayers.AddString(m_pPlayerMgr->ElementAt(i).m_strName); + m_listPlayers->Clear(); + for (const Player& player : *m_pPlayerMgr) + m_listPlayers->AppendString(player.m_strName); - if (m_nPlayer >= 0) - m_listPlayers.SetCurSel(m_nPlayer); - m_btnOK.EnableWindow(m_listPlayers.GetCurSel() >= 0); + if (m_nPlayer != INVALID_PLAYER) + m_listPlayers->SetSelection(static_cast(m_nPlayer)); + m_btnOK->Enable(m_listPlayers->GetSelection() != wxNOT_FOUND); - return TRUE; // return TRUE unless you set the focus to a control - // EXCEPTION: OCX Property Pages should return FALSE + return wxDialog::TransferDataToWindow(); } -void CSelectNewOwnerDialog::OnSelChangePlayerList() +void CSelectNewOwnerDialog::OnSelChangePlayerList(wxCommandEvent& /*event*/) { - m_btnOK.EnableWindow(m_listPlayers.GetCurSel() >= 0); + m_btnOK->Enable(m_listPlayers->GetSelection() != wxNOT_FOUND); } -void CSelectNewOwnerDialog::OnDblClkPlayerList() +void CSelectNewOwnerDialog::OnDblClkPlayerList(wxCommandEvent& /*event*/) { - OnOK(); + wxCommandEvent event(wxEVT_BUTTON, m_btnOK->GetId()); + event.SetEventObject(&*m_btnOK); + m_btnOK->HandleWindowEvent(event); } diff --git a/GP/DlgSelOwner.h b/GP/DlgSelOwner.h index 458ed45..5d038d5 100644 --- a/GP/DlgSelOwner.h +++ b/GP/DlgSelOwner.h @@ -1,6 +1,6 @@ // DlgSelOwner.h : header file // -// Copyright (c) 1994-2020 By Dale L. Larson, All Rights Reserved. +// Copyright (c) 1994-2025 By Dale L. Larson & William Su, All Rights Reserved. // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the @@ -32,42 +32,38 @@ ///////////////////////////////////////////////////////////////////////////// // CSelectNewOwnerDialog dialog -class CSelectNewOwnerDialog : public CDialog +class CSelectNewOwnerDialog : public wxDialog { // Construction public: - CSelectNewOwnerDialog(CWnd* pParent = NULL); // standard constructor + CSelectNewOwnerDialog(CPlayerManager& pm, wxWindow* pParent = &CB::GetMainWndWx()); // standard constructor // Dialog Data - //{{AFX_DATA(CSelectNewOwnerDialog) - enum { IDD = IDD_SELECT_OWNER }; - CButton m_btnOK; - CListBox m_listPlayers; - //}}AFX_DATA +private: + CB_XRC_BEGIN_CTRLS_DECL() + RefPtr m_btnOK; + RefPtr m_listPlayers; + CB_XRC_END_CTRLS_DECL() - int m_nPlayer; - CPlayerManager* m_pPlayerMgr; +public: + PlayerId m_nPlayer; +private: + RefPtr m_pPlayerMgr; // Overrides - // ClassWizard generated virtual function overrides - //{{AFX_VIRTUAL(CSelectNewOwnerDialog) - protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support - //}}AFX_VIRTUAL // Implementation protected: - // Generated message map functions - //{{AFX_MSG(CSelectNewOwnerDialog) - virtual void OnOK(); - virtual BOOL OnInitDialog(); - afx_msg void OnSelChangePlayerList(); - afx_msg void OnDblClkPlayerList(); + bool TransferDataFromWindow() override; + bool TransferDataToWindow() override; + void OnSelChangePlayerList(wxCommandEvent& event); + void OnDblClkPlayerList(wxCommandEvent& event); +#if 0 afx_msg BOOL OnHelpInfo(HELPINFO* pHelpInfo); afx_msg void OnContextMenu(CWnd* pWnd, CPoint point); - //}}AFX_MSG - DECLARE_MESSAGE_MAP() +#endif + wxDECLARE_EVENT_TABLE(); }; #endif diff --git a/GP/DlgSlbrd.cpp b/GP/DlgSlbrd.cpp index 286d623..85d171e 100644 --- a/GP/DlgSlbrd.cpp +++ b/GP/DlgSlbrd.cpp @@ -1,6 +1,6 @@ // DlgSlbrd.cpp : implementation file // -// Copyright (c) 1994-2020 By Dale L. Larson, All Rights Reserved. +// Copyright (c) 1994-2025 By Dale L. Larson & William Su, All Rights Reserved. // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the @@ -37,32 +37,24 @@ static char THIS_FILE[] = __FILE__; // CSelectBoardsDialog dialog -CSelectBoardsDialog::CSelectBoardsDialog(CWnd* pParent /*=NULL*/) - : CDialog(CSelectBoardsDialog::IDD, pParent) +CSelectBoardsDialog::CSelectBoardsDialog(const CBoardManager& bm, wxWindow* pParent /*= &CB::GetMainWndWx()*/) : + CB_XRC_BEGIN_CTRLS_DEFN(pParent, CSelectBoardsDialog) + CB_XRC_CTRL(m_listBoards) + CB_XRC_END_CTRLS_DEFN(), + m_pBMgr(bm) { - //{{AFX_DATA_INIT(CSelectBoardsDialog) - // NOTE: the ClassWizard will add member initialization here - //}}AFX_DATA_INIT } -void CSelectBoardsDialog::DoDataExchange(CDataExchange* pDX) -{ - CDialog::DoDataExchange(pDX); - //{{AFX_DATA_MAP(CSelectBoardsDialog) - DDX_Control(pDX, IDOK, m_btnOK); - DDX_Control(pDX, IDC_D_SETBRD_LIST, m_listBoards); - //}}AFX_DATA_MAP -} - -BEGIN_MESSAGE_MAP(CSelectBoardsDialog, CDialog) - //{{AFX_MSG_MAP(CSelectBoardsDialog) +wxBEGIN_EVENT_TABLE(CSelectBoardsDialog, wxDialog) +#if 0 ON_WM_HELPINFO() ON_WM_CONTEXTMENU() - //}}AFX_MSG_MAP - ON_BN_CLICKED(IDC_D_SETBRD_SELECTALL, OnBtnClickedSelectAll) - ON_BN_CLICKED(IDC_D_SETBRD_CLEARALL, OnBtnClickedClearAll) -END_MESSAGE_MAP() +#endif + EVT_BUTTON(XRCID("OnBtnClickedSelectAll"), OnBtnClickedSelectAll) + EVT_BUTTON(XRCID("OnBtnClickedClearAll"), OnBtnClickedClearAll) +wxEND_EVENT_TABLE() +#if 0 ///////////////////////////////////////////////////////////////////////////// // Html Help control ID Map @@ -81,34 +73,39 @@ void CSelectBoardsDialog::OnContextMenu(CWnd* pWnd, CPoint point) { GetApp()->DoHelpWhatIsHelp(pWnd, adwHelpMap); } +#endif ///////////////////////////////////////////////////////////////////////////// int CSelectBoardsDialog::FindSerialNumberListIndex(BoardID nSerial) const { - for (int i = 0; i < m_listBoards.GetCount(); i++) + for (unsigned int i = 0u ; i < m_listBoards->GetCount() ; ++i) { - if (static_cast(m_listBoards.GetItemData(i)) == nSerial) - return i; + if (static_cast(reinterpret_cast(m_listBoards->GetClientData(i))) == nSerial) + { + return value_preserving_cast(i); + } } - return -1; + return wxNOT_FOUND; } ///////////////////////////////////////////////////////////////////////////// // CSelectBoardsDialog message handlers -BOOL CSelectBoardsDialog::OnInitDialog() +bool CSelectBoardsDialog::TransferDataToWindow() { - CDialog::OnInitDialog(); - - ASSERT(m_pBMgr != NULL); + if (!wxDialog::TransferDataToWindow()) + { + return false; + } - for (size_t i = 0; i < m_pBMgr->GetNumBoards(); i++) + m_listBoards->Clear(); + for (size_t i = size_t(0); i < m_pBMgr.GetNumBoards(); i++) { - const CBoard& pBoard = m_pBMgr->GetBoard(i); - int nIdx = m_listBoards.AddString(pBoard.GetName()); - m_listBoards.SetItemData(nIdx, value_preserving_cast(static_cast(pBoard.GetSerialNumber()))); - m_listBoards.SetCheck(nIdx, 0); + const CBoard& pBoard = m_pBMgr.GetBoard(i); + int nIdx = m_listBoards->Append(pBoard.GetName()); + m_listBoards->SetClientData(value_preserving_cast(nIdx), reinterpret_cast(value_preserving_cast(static_cast(pBoard.GetSerialNumber())))); + m_listBoards->Check(value_preserving_cast(nIdx), false); } // If there are actively selected boards. Reselect them. @@ -116,38 +113,46 @@ BOOL CSelectBoardsDialog::OnInitDialog() for (size_t i = 0; i < m_tblBrds.size(); i++) { int nIdx = FindSerialNumberListIndex(m_tblBrds[i]); - if (nIdx == -1) - AfxMessageBox(IDS_ERR_BOARDNOTEXIST, MB_OK | MB_ICONEXCLAMATION); - m_listBoards.SetCheck(nIdx, 1); + if (nIdx == wxNOT_FOUND) + { + wxMessageBox(CB::string::LoadString(IDS_ERR_BOARDNOTEXIST), + CB::GetAppName(), + wxOK | wxICON_EXCLAMATION); + } + m_listBoards->Check(value_preserving_cast(nIdx), true); } - return TRUE; // return TRUE unless you set the focus to a control + return true; } -void CSelectBoardsDialog::OnOK() +bool CSelectBoardsDialog::TransferDataFromWindow() { m_tblBrds.clear(); // Clear the board table - m_tblBrds.reserve(value_preserving_cast(m_listBoards.GetCount())); - for (int i = 0; i < m_listBoards.GetCount(); i++) + m_tblBrds.reserve(value_preserving_cast(m_listBoards->GetCount())); + for (unsigned int i = 0u ; i < m_listBoards->GetCount() ; ++i) { - if (m_listBoards.GetCheck(i) > 0) + if (m_listBoards->IsChecked(i)) { // Add serial numbers for selected boards - m_tblBrds.push_back(static_cast(m_listBoards.GetItemData(i))); + m_tblBrds.push_back(static_cast(reinterpret_cast(m_listBoards->GetClientData(i)))); } } - CDialog::OnOK(); + return wxDialog::TransferDataFromWindow(); } -void CSelectBoardsDialog::OnBtnClickedSelectAll() +void CSelectBoardsDialog::OnBtnClickedSelectAll(wxCommandEvent& /*event*/) { - for (int i = 0; i < m_listBoards.GetCount(); i++) - m_listBoards.SetCheck(i, 1); + for (unsigned int i = 0u ; i < m_listBoards->GetCount() ; ++i) + { + m_listBoards->Check(i, true); + } } -void CSelectBoardsDialog::OnBtnClickedClearAll() +void CSelectBoardsDialog::OnBtnClickedClearAll(wxCommandEvent& /*event*/) { - for (int i = 0; i < m_listBoards.GetCount(); i++) - m_listBoards.SetCheck(i, 0); + for (unsigned int i = 0u ; i < m_listBoards->GetCount() ; ++i) + { + m_listBoards->Check(i, false); + } } diff --git a/GP/DlgSlbrd.h b/GP/DlgSlbrd.h index 11648d0..33920a5 100644 --- a/GP/DlgSlbrd.h +++ b/GP/DlgSlbrd.h @@ -1,6 +1,6 @@ // DlgSlbrd.h : header file // -// Copyright (c) 1994-2020 By Dale L. Larson, All Rights Reserved. +// Copyright (c) 1994-2025 By Dale L. Larson & William Su, All Rights Reserved. // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the @@ -27,37 +27,31 @@ class CBoardManager; ///////////////////////////////////////////////////////////////////////////// // CSelectBoardsDialog dialog -class CSelectBoardsDialog : public CDialog +class CSelectBoardsDialog : public wxDialog { // Construction public: - CSelectBoardsDialog(CWnd* pParent = NULL); // standard constructor + CSelectBoardsDialog(const CBoardManager& bm, wxWindow* pParent = &CB::GetMainWndWx()); // standard constructor // Dialog Data - //{{AFX_DATA(CSelectBoardsDialog) - enum { IDD = IDD_SETBOARDS }; - CButton m_btnOK; - CCheckListBox m_listBoards; - //}}AFX_DATA + CB_XRC_BEGIN_CTRLS_DECL() + RefPtr m_listBoards; + CB_XRC_END_CTRLS_DECL() std::vector m_tblBrds; // Table of board serial numbers - const CBoardManager* m_pBMgr; // Pointer to gamebox board manager. + const CBoardManager& m_pBMgr; // Pointer to gamebox board manager. // Implementation protected: int FindSerialNumberListIndex(BoardID nSerial) const; - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support - - // Generated message map functions - //{{AFX_MSG(CSelectBoardsDialog) - virtual BOOL OnInitDialog(); - virtual void OnOK(); + bool TransferDataToWindow() override; + bool TransferDataFromWindow() override; +#if 0 afx_msg BOOL OnHelpInfo(HELPINFO* pHelpInfo); afx_msg void OnContextMenu(CWnd* pWnd, CPoint point); - //}}AFX_MSG - DECLARE_MESSAGE_MAP() -public: - afx_msg void OnBtnClickedSelectAll(); - afx_msg void OnBtnClickedClearAll(); +#endif + wxDECLARE_EVENT_TABLE(); + void OnBtnClickedSelectAll(wxCommandEvent& event); + void OnBtnClickedClearAll(wxCommandEvent& event); }; diff --git a/GP/DlgSmsg.cpp b/GP/DlgSmsg.cpp index 677305b..041e6be 100644 --- a/GP/DlgSmsg.cpp +++ b/GP/DlgSmsg.cpp @@ -1,6 +1,6 @@ // DlgSmsg.cpp : implementation file // -// Copyright (c) 1994-2023 By Dale L. Larson & William Su, All Rights Reserved. +// Copyright (c) 1994-2025 By Dale L. Larson & William Su, All Rights Reserved. // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the @@ -35,49 +35,50 @@ static char THIS_FILE[] = __FILE__; #endif -IMPLEMENT_DYNAMIC(CSendMsgDialog, CDialog) - ///////////////////////////////////////////////////////////////////////////// // CSendMsgDialog dialog -CSendMsgDialog::CSendMsgDialog(CGamDoc& doc, CWnd* pParent /*=NULL*/) - : CDialog(CSendMsgDialog::IDD, pParent), +CSendMsgDialog::CSendMsgDialog(CGamDoc& doc, wxWindow* pParent /*= &CB::GetMainWndWx()*/) : + CB_XRC_BEGIN_CTRLS_DEFN(pParent, CSendMsgDialog) + CB_XRC_CTRL(m_editMsg2) + CB_XRC_CTRL(m_btnDefer) + , m_btnCancel(XRCCTRL(*this, "wxID_CANCEL", std::remove_reference_t)) + CB_XRC_CTRL(m_editMsg) + CB_XRC_END_CTRLS_DEFN(), m_pDoc(&doc) { - //{{AFX_DATA_INIT(CSendMsgDialog) - // NOTE: the ClassWizard will add member initialization here - //}}AFX_DATA_INIT - m_bReadOnlyView = FALSE; + // KLUDGE: Send & Close isn't coming through correctly + wxButton* sendClose = XRCCTRL(*this, "wxID_OK", wxButton); + wxString label = sendClose->GetLabel(); + label.Replace("_", "&&"); + sendClose->SetLabel(label); + + /* layout done with both editboxes visible + so sizers produce proper result */ + m_bReadOnlyView = TRUE; + // now hide second editbox + TeardownReadOnlyView(); + m_bShowDieRoller = FALSE; } ///////////////////////////////////////////////////////////////////////////// -void CSendMsgDialog::DoDataExchange(CDataExchange* pDX) -{ - CDialog::DoDataExchange(pDX); - //{{AFX_DATA_MAP(CSendMsgDialog) - DDX_Control(pDX, IDC_D_SMSG_MESSAGE2, m_editMsg2); - DDX_Control(pDX, IDC_D_SMSG_CLOSE, m_btnDefer); - DDX_Control(pDX, IDCANCEL, m_btnCancel); - DDX_Control(pDX, IDC_D_SMSG_MESSAGE, m_editMsg); - //}}AFX_DATA_MAP -} - -BEGIN_MESSAGE_MAP(CSendMsgDialog, CDialog) - //{{AFX_MSG_MAP(CSendMsgDialog) - ON_BN_CLICKED(IDOK, OnSendMsgSendAndClose) - ON_BN_CLICKED(IDC_D_SMSG_SEND, OnSendMsgSend) - ON_BN_CLICKED(IDC_D_SMSG_CLOSE, OnSendMsgClose) - ON_BN_CLICKED(IDCANCEL, OnSendMsgCancel) - ON_BN_CLICKED(IDC_D_SMSG_ROLLDICE, OnRollDice) +wxBEGIN_EVENT_TABLE(CSendMsgDialog, wxDialog) + EVT_BUTTON(wxID_OK, OnSendMsgSendAndClose) + EVT_BUTTON(XRCID("OnSendMsgSend"), OnSendMsgSend) + EVT_BUTTON(XRCID("m_btnDefer"), OnSendMsgClose) + EVT_BUTTON(wxID_CANCEL, OnSendMsgCancel) + EVT_BUTTON(XRCID("OnRollDice"), OnRollDice) +#if 0 ON_WM_HELPINFO() ON_WM_CONTEXTMENU() - ON_EN_CHANGE(IDC_D_SMSG_MESSAGE, OnChangeEditMessage) - ON_EN_CHANGE(IDC_D_SMSG_MESSAGE2, OnChangeEdit2Message) - //}}AFX_MSG_MAP -END_MESSAGE_MAP() +#endif + EVT_TEXT(XRCID("m_editMsg"), OnChangeEditMessage) + EVT_TEXT(XRCID("m_editMsg2"), OnChangeEdit2Message) +wxEND_EVENT_TABLE() +#if 0 ///////////////////////////////////////////////////////////////////////////// // Html Help control ID Map @@ -102,6 +103,7 @@ void CSendMsgDialog::OnContextMenu(CWnd* pWnd, CPoint point) { GetApp()->DoHelpWhatIsHelp(pWnd, adwHelpMap); } +#endif ///////////////////////////////////////////////////////////////////////////// @@ -110,10 +112,10 @@ void CSendMsgDialog::TransferToReadOnlyView() if (!m_bReadOnlyView) SetupReadOnlyView(); - CB::string str = CB::string::GetWindowText(m_editMsg2); - AppendStringToEditBox(m_editMsg, str, TRUE); - m_editMsg2.SetWindowText(""_cbstring); - m_btnCancel.EnableWindow(FALSE); + CB::string str = m_editMsg2->GetValue(); + AppendStringToEditBox(*m_editMsg, str, TRUE); + m_editMsg2->SetValue(""_cbstring); + m_btnCancel->Enable(FALSE); } ///////////////////////////////////////////////////////////////////////////// @@ -125,18 +127,9 @@ void CSendMsgDialog::SetupReadOnlyView() m_bReadOnlyView = TRUE; // Convert the current edit view to read-only and // layout the new edit window. - CRect rctTop; - m_editMsg.GetWindowRect(&rctTop); - ScreenToClient(&rctTop); - CRect rctBot = rctTop; - - rctTop.bottom = rctTop.top + (2 * rctTop.Height()) / 3 - 1; - rctBot.top = rctTop.bottom; - - m_editMsg.SetReadOnly(TRUE); - m_editMsg.MoveWindow(&rctTop); - m_editMsg2.MoveWindow(&rctBot); - m_editMsg2.ShowWindow(SW_SHOW); + m_editMsg->SetEditable(false); + m_editMsg2->Show(); + Layout(); } } @@ -147,19 +140,12 @@ void CSendMsgDialog::TeardownReadOnlyView() if (m_bReadOnlyView) { m_bReadOnlyView = FALSE; + // Undo the above: // Convert the current edit view to read-only and // layout the new edit window. - CRect rctTop; - m_editMsg.GetWindowRect(&rctTop); - ScreenToClient(&rctTop); - CRect rctBot; - m_editMsg2.GetWindowRect(&rctBot); - ScreenToClient(&rctBot); - rctTop.bottom = rctBot.bottom; - - m_editMsg.SetReadOnly(FALSE); - m_editMsg.MoveWindow(&rctTop); - m_editMsg2.ShowWindow(SW_HIDE); + m_editMsg->SetEditable(true); + m_editMsg2->Hide(); + Layout(); } } @@ -167,8 +153,8 @@ void CSendMsgDialog::TeardownReadOnlyView() void CSendMsgDialog::FillEditBoxes(const CB::string& str) { - m_editMsg.SetWindowText(""_cbstring); - m_editMsg2.SetWindowText(""_cbstring); + m_editMsg->SetValue(""_cbstring); + m_editMsg2->SetValue(""_cbstring); CB::string strReadOnly; CB::string strEditable; @@ -176,42 +162,39 @@ void CSendMsgDialog::FillEditBoxes(const CB::string& str) CGamDoc::MsgSeperateIntoPieces(str, strReadOnly, strEditable); if (strReadOnly.empty()) { - m_editMsg.SetWindowText(strEditable); - m_editMsg.SetFocus(); - m_editMsg.SetSel(m_editMsg.GetWindowTextLength(), - m_editMsg.GetWindowTextLength()); + m_editMsg->SetValue(strEditable); + m_editMsg->SetFocus(); + m_editMsg->SetInsertionPointEnd(); } else { SetupReadOnlyView(); - m_editMsg.SetWindowText(strReadOnly); - int nChars = m_editMsg.GetWindowTextLength(); - int nLine = m_editMsg.LineFromChar(nChars); - m_editMsg.LineScroll(nLine); - - m_editMsg2.SetWindowText(strEditable); - m_editMsg2.SetFocus(); - m_editMsg2.SetSel(m_editMsg2.GetWindowTextLength(), - m_editMsg2.GetWindowTextLength()); + m_editMsg->SetValue(strReadOnly); + wxTextPos nChars = m_editMsg->GetLastPosition(); + m_editMsg->ShowPosition(nChars); + + m_editMsg2->SetValue(strEditable); + m_editMsg2->SetFocus(); + m_editMsg->SetInsertionPointEnd(); if (!strReadOnly.empty()) { // If there is a read-only part in the message, there // must have been a die roll. We need to disable cancel. - m_btnCancel.EnableWindow(FALSE); + m_btnCancel->Enable(FALSE); } else - m_btnCancel.EnableWindow(TRUE); + m_btnCancel->Enable(TRUE); } } ///////////////////////////////////////////////////////////////////////////// -void CSendMsgDialog::OnChangeEditMessage() +void CSendMsgDialog::OnChangeEditMessage(wxCommandEvent& /*event*/) { m_pDoc->SetModifiedFlag(); } -void CSendMsgDialog::OnChangeEdit2Message() +void CSendMsgDialog::OnChangeEdit2Message(wxCommandEvent& /*event*/) { m_pDoc->SetModifiedFlag(); } @@ -219,9 +202,12 @@ void CSendMsgDialog::OnChangeEdit2Message() ///////////////////////////////////////////////////////////////////////////// // CSendMsgDialog message handlers -BOOL CSendMsgDialog::OnInitDialog() +bool CSendMsgDialog::TransferDataToWindow() { - CDialog::OnInitDialog(); + if (!wxDialog::TransferDataToWindow()) + { + return false; + } if (m_pDoc->GetDieRollState() != NULL) { ASSERT(m_pRollState == NULL); @@ -229,36 +215,37 @@ BOOL CSendMsgDialog::OnInitDialog() m_pRollState = MakeOwner(*m_pDoc->GetDieRollState()); } +#if 0 // why override default? m_editMsg.SetFont(CFont::FromHandle(g_res.h8ss)); m_editMsg2.SetFont(CFont::FromHandle(g_res.h8ss)); +#endif FillEditBoxes(m_pDoc->MsgGetMessageText()); if (m_bShowDieRoller) { - PostMessage(WM_COMMAND, MAKEWPARAM(uint16_t(IDC_D_SMSG_ROLLDICE), uint16_t(BN_CLICKED)), - (LPARAM)::GetDlgItem(m_hWnd, IDC_D_SMSG_ROLLDICE)); + QueueEvent(new wxCommandEvent(wxEVT_BUTTON, XRCID("OnRollDice"))); } - return FALSE; // return TRUE unless you set the focus to a control + return true; } -void CSendMsgDialog::OnSendMsgSendAndClose() +void CSendMsgDialog::OnSendMsgSendAndClose(wxCommandEvent& /*event*/) { if (m_bReadOnlyView) TransferToReadOnlyView(); - CB::string str = CB::string::GetWindowText(m_editMsg); + CB::string str = m_editMsg->GetValue(); m_pDoc->SetDieRollState(std::move(m_pRollState)); m_pDoc->MsgDialogSend(str, TRUE); } -void CSendMsgDialog::OnSendMsgSend() +void CSendMsgDialog::OnSendMsgSend(wxCommandEvent& /*event*/) { if (m_bReadOnlyView) TransferToReadOnlyView(); - CB::string str = CB::string::GetWindowText(m_editMsg); + CB::string str = m_editMsg->GetValue(); m_pDoc->MsgDialogSend(str, FALSE); // Don't close us TeardownReadOnlyView(); // Back to original layout @@ -266,47 +253,45 @@ void CSendMsgDialog::OnSendMsgSend() FillEditBoxes(m_pDoc->MsgGetMessageText()); } -void CSendMsgDialog::OnSendMsgClose() +void CSendMsgDialog::OnSendMsgClose(wxCommandEvent& /*event*/) { CB::string str; if (m_bReadOnlyView) { - CB::string strReadOnly = CB::string::GetWindowText(m_editMsg); - CB::string strEditable = CB::string::GetWindowText(m_editMsg2); + CB::string strReadOnly = m_editMsg->GetValue(); + CB::string strEditable = m_editMsg2->GetValue(); str = CGamDoc::MsgEncodeFromPieces(strReadOnly, strEditable); } else { // No read-only part yet - CB::string strEditable = CB::string::GetWindowText(m_editMsg); + CB::string strEditable = m_editMsg->GetValue(); str = CGamDoc::MsgEncodeFromPieces("", strEditable); } m_pDoc->MsgDialogClose(str); } -void CSendMsgDialog::OnSendMsgCancel() +void CSendMsgDialog::OnSendMsgCancel(wxCommandEvent& /*event*/) { m_pDoc->MsgDialogCancel(); } -void CSendMsgDialog::OnRollDice() +void CSendMsgDialog::OnRollDice(wxCommandEvent& /*event*/) { CDieRollerDlg dlg; if (m_pRollState) dlg.SetRollState(*m_pRollState); - if (dlg.DoModal() == IDOK) + if (dlg.ShowModal() == wxID_OK) { m_pRollState = dlg.GetRollState(); - CB::string str = CB::string::GetWindowText(m_editMsg2); + CB::string str = m_editMsg2->GetValue(); if (str != "" && str[str.a_size() - size_t(1)] != '\n') - AppendStringToEditBox(m_editMsg2, "\r\n", FALSE); + AppendStringToEditBox(*m_editMsg2, "\n", FALSE); - int nLen = m_editMsg2.GetWindowTextLength(); - m_editMsg2.SetSel(nLen, nLen); - m_editMsg2.ReplaceSel(dlg.GetFormattedRollResult()); - m_btnCancel.EnableWindow(FALSE); + m_editMsg2->AppendText(dlg.GetFormattedRollResult()); + m_btnCancel->Enable(FALSE); TransferToReadOnlyView(); } diff --git a/GP/DlgSmsg.h b/GP/DlgSmsg.h index f67fe7f..783370c 100644 --- a/GP/DlgSmsg.h +++ b/GP/DlgSmsg.h @@ -1,6 +1,6 @@ // DlgSmsg.h : header file // -// Copyright (c) 1994-2020 By Dale L. Larson, All Rights Reserved. +// Copyright (c) 1994-2025 By Dale L. Larson & William Su, All Rights Reserved. // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the @@ -29,25 +29,24 @@ class CRollState; -class CSendMsgDialog : public CDialog +class CSendMsgDialog : public wxDialog { - DECLARE_DYNAMIC(CSendMsgDialog) // Construction public: - CSendMsgDialog(CGamDoc& doc, CWnd* pParent = NULL); + CSendMsgDialog(CGamDoc& doc, wxWindow* pParent = &CB::GetMainWndWx()); ~CSendMsgDialog() = default; // Dialog Data -public: - //{{AFX_DATA(CSendMsgDialog) - enum { IDD = IDD_SENDMESSAGE }; - CEditNoChevron m_editMsg2; - CButton m_btnDefer; - CButton m_btnCancel; - CEditNoChevron m_editMsg; - //}}AFX_DATA +private: + CB_XRC_BEGIN_CTRLS_DECL() + RefPtr m_editMsg2; + RefPtr m_btnDefer; + RefPtr m_btnCancel; + RefPtr m_editMsg; + CB_XRC_END_CTRLS_DECL() RefPtr m_pDoc; +public: bool m_bShowDieRoller; // Implementation @@ -63,20 +62,18 @@ class CSendMsgDialog : public CDialog // Implementation protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support - virtual BOOL OnInitDialog(); + bool TransferDataToWindow() override; - // Generated message map functions - //{{AFX_MSG(CSendMsgDialog) - afx_msg void OnSendMsgSendAndClose(); - afx_msg void OnSendMsgSend(); - afx_msg void OnSendMsgClose(); - afx_msg void OnSendMsgCancel(); - afx_msg void OnRollDice(); + void OnSendMsgSendAndClose(wxCommandEvent& event); + void OnSendMsgSend(wxCommandEvent& event); + void OnSendMsgClose(wxCommandEvent& event); + void OnSendMsgCancel(wxCommandEvent& event); + void OnRollDice(wxCommandEvent& event); +#if 0 afx_msg BOOL OnHelpInfo(HELPINFO* pHelpInfo); afx_msg void OnContextMenu(CWnd* pWnd, CPoint point); - afx_msg void OnChangeEditMessage(); - afx_msg void OnChangeEdit2Message(); - //}}AFX_MSG - DECLARE_MESSAGE_MAP() +#endif + void OnChangeEditMessage(wxCommandEvent& event); + void OnChangeEdit2Message(wxCommandEvent& event); + wxDECLARE_EVENT_TABLE(); }; diff --git a/GP/DlgSpece.cpp b/GP/DlgSpece.cpp index 82a0c7e..cf345f3 100644 --- a/GP/DlgSpece.cpp +++ b/GP/DlgSpece.cpp @@ -1,6 +1,6 @@ // DlgSpece.cpp : implementation file // -// Copyright (c) 1994-2020 By Dale L. Larson, All Rights Reserved. +// Copyright (c) 1994-2025 By Dale L. Larson & William Su, All Rights Reserved. // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the @@ -37,43 +37,35 @@ static char THIS_FILE[] = __FILE__; ///////////////////////////////////////////////////////////////////////////// // CSetPiecesDialog dialog -CSetPiecesDialog::CSetPiecesDialog(CGamDoc& doc, CWnd* pParent /*=NULL*/) - : CDialog(CSetPiecesDialog::IDD, pParent), - m_listTray(doc), - m_pDoc(&doc) -{ - //{{AFX_DATA_INIT(CSetPiecesDialog) - // NOTE: the ClassWizard will add member initialization here - //}}AFX_DATA_INIT - m_pPTbl = NULL; - m_pYMgr = NULL; +CSetPiecesDialog::CSetPiecesDialog(CGamDoc& doc, wxWindow* pParent /*= &CB::GetMainWndWx()*/) : + CB_XRC_BEGIN_CTRLS_DEFN(pParent, CSetPiecesDialog) + CB_XRC_CTRL(m_comboPGrp) + CB_XRC_CTRL(m_listPiece) + CB_XRC_CTRL(m_comboYGrp) + CB_XRC_CTRL(m_listTray) + CB_XRC_END_CTRLS_DEFN(), + m_pDoc(&doc), + m_pYMgr(&m_pDoc->GetTrayManager()), + m_pPTbl(&m_pDoc->GetPieceTable()) +{ + m_listTray->Init(doc); m_nYSel = -1; } -void CSetPiecesDialog::DoDataExchange(CDataExchange* pDX) -{ - CDialog::DoDataExchange(pDX); - //{{AFX_DATA_MAP(CSetPiecesDialog) - DDX_Control(pDX, IDC_D_SETPCE_TRAYNAME, m_comboYGrp); - DDX_Control(pDX, IDC_D_SETPCE_TRAYLIST, m_listTray); - DDX_Control(pDX, IDC_D_SETPCE_PCELIST, m_listPiece); - DDX_Control(pDX, IDC_D_SETPCE_PCEGRP, m_comboPGrp); - //}}AFX_DATA_MAP -} - -BEGIN_MESSAGE_MAP(CSetPiecesDialog, CDialog) - //{{AFX_MSG_MAP(CSetPiecesDialog) - ON_CBN_SELCHANGE(IDC_D_SETPCE_PCEGRP, OnSelChangePieceGroup) - ON_BN_CLICKED(IDC_D_SETPCE_REMALL, OnRemoveAll) - ON_BN_CLICKED(IDC_D_SETPCE_COPYALL, OnCopyAll) - ON_BN_CLICKED(IDC_D_SETPCE_COPYSEL, OnCopySelections) - ON_BN_CLICKED(IDC_D_SETPCE_REMSEL, OnRemoveSelections) - ON_CBN_SELCHANGE(IDC_D_SETPCE_TRAYNAME, OnSelChangeTrayName) +wxBEGIN_EVENT_TABLE(CSetPiecesDialog, wxDialog) + EVT_CHOICE(XRCID("m_comboPGrp"), OnSelChangePieceGroup) + EVT_BUTTON(XRCID("OnRemoveAll"), OnRemoveAll) + EVT_BUTTON(XRCID("OnCopyAll"), OnCopyAll) + EVT_BUTTON(XRCID("OnCopySelections"), OnCopySelections) + EVT_BUTTON(XRCID("OnRemoveSelections"), OnRemoveSelections) + EVT_CHOICE(XRCID("m_comboYGrp"), OnSelChangeTrayName) +#if 0 ON_WM_HELPINFO() ON_WM_CONTEXTMENU() - //}}AFX_MSG_MAP -END_MESSAGE_MAP() +#endif +wxEND_EVENT_TABLE() +#if 0 ///////////////////////////////////////////////////////////////////////////// // Html Help control ID Map @@ -99,25 +91,30 @@ void CSetPiecesDialog::OnContextMenu(CWnd* pWnd, CPoint point) { GetApp()->DoHelpWhatIsHelp(pWnd, adwHelpMap); } +#endif ///////////////////////////////////////////////////////////////////////////// void CSetPiecesDialog::LoadPieceNameList() { - m_comboPGrp.ResetContent(); + m_comboPGrp->Clear(); const CPieceManager& pPMgr = m_pPTbl->GetPieceManager(); for (size_t i = size_t(0); i < pPMgr.GetNumPieceSets(); i++) - m_comboPGrp.AddString(pPMgr.GetPieceSet(i).GetName()); - m_comboPGrp.SetCurSel(0); + { + m_comboPGrp->Append(pPMgr.GetPieceSet(i).GetName()); + } + m_comboPGrp->SetSelection(0); UpdatePieceList(); } void CSetPiecesDialog::LoadTrayNameList() { - m_comboYGrp.ResetContent(); - for (size_t i = 0; i < m_pYMgr->GetNumTraySets(); i++) - m_comboYGrp.AddString(m_pYMgr->GetTraySet(i).GetName()); - m_comboYGrp.SetCurSel(m_nYSel == -1 ? 0 : m_nYSel); + m_comboYGrp->Clear(); + for (size_t i = size_t(0); i < m_pYMgr->GetNumTraySets(); i++) + { + m_comboYGrp->Append(m_pYMgr->GetTraySet(i).GetName()); + } + m_comboYGrp->SetSelection(m_nYSel == -1 ? 0 : m_nYSel); UpdateTrayList(); } @@ -125,52 +122,52 @@ void CSetPiecesDialog::LoadTrayNameList() void CSetPiecesDialog::UpdatePieceList() { - int nSel = m_comboPGrp.GetCurSel(); - if (nSel < 0) + int nSel = m_comboPGrp->GetSelection(); + if (nSel == wxNOT_FOUND) { - m_listPiece.SetItemMap(NULL); + m_listPiece->SetItemMap(NULL); return; } m_tblPiece = m_pPTbl->LoadUnusedPieceList(value_preserving_cast(nSel)); - m_listPiece.SetItemMap(&m_tblPiece, FALSE); + m_listPiece->SetItemMap(&m_tblPiece, FALSE); } void CSetPiecesDialog::UpdateTrayList() { - int nSel = m_comboYGrp.GetCurSel(); - if (nSel < 0) + int nSel = m_comboYGrp->GetSelection(); + if (nSel == wxNOT_FOUND) { - m_listTray.SetItemMap(NULL); + m_listTray->SetItemMap(NULL); return; } const std::vector& pPieceTbl = m_pYMgr->GetTraySet(value_preserving_cast(nSel)).GetPieceIDTable(); m_tblTray = pPieceTbl; // Clone the table - m_listTray.SetItemMap(&pPieceTbl, FALSE); + m_listTray->SetItemMap(&pPieceTbl, FALSE); } ///////////////////////////////////////////////////////////////////////////// // CSetPiecesDialog message handlers -void CSetPiecesDialog::OnSelChangePieceGroup() +void CSetPiecesDialog::OnSelChangePieceGroup(wxCommandEvent& /*event*/) { UpdatePieceList(); } -void CSetPiecesDialog::OnSelChangeTrayName() +void CSetPiecesDialog::OnSelChangeTrayName(wxCommandEvent& /*event*/) { UpdateTrayList(); } -void CSetPiecesDialog::OnCopyAll() +void CSetPiecesDialog::OnCopyAll(wxCommandEvent& /*event*/) { - int nTraySet = m_comboYGrp.GetCurSel(); - if (nTraySet < 0) + int nTraySet = m_comboYGrp->GetSelection(); + if (nTraySet == wxNOT_FOUND) return; CTraySet& pYSet = m_pYMgr->GetTraySet(value_preserving_cast(nTraySet)); - const std::vector* pPList = m_listPiece.GetItemMap(); + const std::vector* pPList = m_listPiece->GetItemMap(); if (pPList == NULL) return; @@ -181,14 +178,14 @@ void CSetPiecesDialog::OnCopyAll() UpdateTrayList(); } -void CSetPiecesDialog::OnCopySelections() +void CSetPiecesDialog::OnCopySelections(wxCommandEvent& /*event*/) { - int nTraySet = m_comboYGrp.GetCurSel(); - if (nTraySet < 0) + int nTraySet = m_comboYGrp->GetSelection(); + if (nTraySet == wxNOT_FOUND) return; CTraySet& pYSet = m_pYMgr->GetTraySet(value_preserving_cast(nTraySet)); - std::vector selList = m_listPiece.GetCurMappedItemList(); + std::vector selList = m_listPiece->GetCurMappedItemList(); if (selList.empty()) return; // Nothing to copy. @@ -199,15 +196,15 @@ void CSetPiecesDialog::OnCopySelections() UpdateTrayList(); } -void CSetPiecesDialog::OnRemoveSelections() +void CSetPiecesDialog::OnRemoveSelections(wxCommandEvent& /*event*/) { - int nTraySet = m_comboYGrp.GetCurSel(); - if (nTraySet < 0) + int nTraySet = m_comboYGrp->GetSelection(); + if (nTraySet == wxNOT_FOUND) return; CTraySet& pYSet = m_pYMgr->GetTraySet(value_preserving_cast(nTraySet)); - std::vector selList = m_listTray.GetCurMappedItemList(); + std::vector selList = m_listTray->GetCurMappedItemList(); if (selList.empty()) return; // Nothing to remove @@ -218,10 +215,10 @@ void CSetPiecesDialog::OnRemoveSelections() UpdateTrayList(); } -void CSetPiecesDialog::OnRemoveAll() +void CSetPiecesDialog::OnRemoveAll(wxCommandEvent& /*event*/) { - int nTraySet = m_comboYGrp.GetCurSel(); - if (nTraySet < 0) + int nTraySet = m_comboYGrp->GetSelection(); + if (nTraySet == wxNOT_FOUND) return; CTraySet& pYSet = m_pYMgr->GetTraySet(value_preserving_cast(nTraySet)); @@ -234,21 +231,19 @@ void CSetPiecesDialog::OnRemoveAll() UpdateTrayList(); } -BOOL CSetPiecesDialog::OnInitDialog() +bool CSetPiecesDialog::TransferDataToWindow() { - CDialog::OnInitDialog(); - ASSERT(m_pDoc != NULL); - m_pYMgr = m_pDoc->GetTrayManager(); - ASSERT(m_pYMgr != NULL); - m_pPTbl = m_pDoc->GetPieceTable(); - ASSERT(m_pPTbl != NULL); + if (!wxDialog::TransferDataToWindow()) + { + return false; + } - m_listPiece.SetDocument(*m_pDoc); - m_listTray.SetTrayContentVisibility(trayVizAllSides); + m_listPiece->SetDocument(*m_pDoc); + m_listTray->SetTrayContentVisibility(trayVizAllSides); LoadPieceNameList(); LoadTrayNameList(); - return TRUE; // return TRUE unless you set the focus to a control + return TRUE; } diff --git a/GP/DlgSpece.h b/GP/DlgSpece.h index d73b4c6..223c831 100644 --- a/GP/DlgSpece.h +++ b/GP/DlgSpece.h @@ -1,6 +1,6 @@ // DlgSpece.h : header file // -// Copyright (c) 1994-2020 By Dale L. Larson, All Rights Reserved. +// Copyright (c) 1994-2025 By Dale L. Larson & William Su, All Rights Reserved. // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the @@ -33,28 +33,29 @@ ///////////////////////////////////////////////////////////////////////////// // CSetPiecesDialog dialog -class CSetPiecesDialog : public CDialog +class CSetPiecesDialog : public wxDialog { // Construction public: - CSetPiecesDialog(CGamDoc& doc, CWnd* pParent = NULL); // standard constructor + CSetPiecesDialog(CGamDoc& doc, wxWindow* pParent = &CB::GetMainWndWx()); // standard constructor // Dialog Data - //{{AFX_DATA(CSetPiecesDialog) - enum { IDD = IDD_SETPIECES }; - CComboBox m_comboPGrp; - CPieceListBox m_listPiece; - CComboBox m_comboYGrp; - CTrayListBox m_listTray; - //}}AFX_DATA +private: + CB_XRC_BEGIN_CTRLS_DECL() + RefPtr m_comboPGrp; + RefPtr m_listPiece; + RefPtr m_comboYGrp; + RefPtr m_listTray; + CB_XRC_END_CTRLS_DECL() - CGamDoc* const m_pDoc; // Must be set by creator + RefPtr m_pDoc; // Must be set by creator +public: int m_nYSel; // Initial tray number // Implementation protected: - CPieceTable* m_pPTbl; // Loaded using doc pointer - CTrayManager* m_pYMgr; // Loaded using doc pointer + RefPtr m_pPTbl; // Loaded using doc pointer + RefPtr m_pYMgr; // Loaded using doc pointer std::vector m_tblPiece; std::vector m_tblTray; @@ -67,19 +68,17 @@ class CSetPiecesDialog : public CDialog // Implementation protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support - virtual BOOL OnInitDialog(); + bool TransferDataToWindow() override; - // Generated message map functions - //{{AFX_MSG(CSetPiecesDialog) - afx_msg void OnSelChangePieceGroup(); - afx_msg void OnRemoveAll(); - afx_msg void OnCopyAll(); - afx_msg void OnCopySelections(); - afx_msg void OnRemoveSelections(); - afx_msg void OnSelChangeTrayName(); + void OnSelChangePieceGroup(wxCommandEvent& event); + void OnRemoveAll(wxCommandEvent& event); + void OnCopyAll(wxCommandEvent& event); + void OnCopySelections(wxCommandEvent& event); + void OnRemoveSelections(wxCommandEvent& event); + void OnSelChangeTrayName(wxCommandEvent& event); +#if 0 afx_msg BOOL OnHelpInfo(HELPINFO* pHelpInfo); afx_msg void OnContextMenu(CWnd* pWnd, CPoint point); - //}}AFX_MSG - DECLARE_MESSAGE_MAP() +#endif + wxDECLARE_EVENT_TABLE(); }; diff --git a/GP/DlgYprop.cpp b/GP/DlgYprop.cpp index bc6ade1..c9e74d9 100644 --- a/GP/DlgYprop.cpp +++ b/GP/DlgYprop.cpp @@ -1,6 +1,6 @@ // DlgYprop.cpp : implementation file // -// Copyright (c) 1994-2020 By Dale L. Larson, All Rights Reserved. +// Copyright (c) 1994-2025 By Dale L. Larson & William Su, All Rights Reserved. // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the @@ -46,7 +46,7 @@ CTrayPropDialog::CTrayPropDialog(CWnd* pParent /*=NULL*/) m_bRandomSide = false; //}}AFX_DATA_INIT m_nYSel = Invalid_v; - m_nOwnerSel = -1; + m_nOwnerSel = INVALID_PLAYER; m_bNonOwnerAccess = FALSE; m_pPlayerMgr = NULL; m_pYMgr = NULL; @@ -145,10 +145,10 @@ void CTrayPropDialog::OnOK() } if (m_pPlayerMgr != NULL) { - m_nOwnerSel = m_comboOwners.GetCurSel() - 1; + m_nOwnerSel = PlayerId(m_comboOwners.GetCurSel() - 1); m_bNonOwnerAccess = m_chkAllowAccess.GetCheck() != 0; m_bEnforceVizForOwnerToo = m_chkVizOwnerToo.GetCheck() != 0; - if (m_nOwnerSel < 0) + if (m_nOwnerSel == INVALID_PLAYER) { m_bNonOwnerAccess = FALSE; m_bEnforceVizForOwnerToo = FALSE; @@ -176,9 +176,11 @@ BOOL CTrayPropDialog::OnInitDialog() { CB::string str = CB::string::LoadString(IDS_LBL_NO_OWNER); m_comboOwners.AddString(str); - for (int i = 0; i < m_pPlayerMgr->GetSize(); i++) - m_comboOwners.AddString(m_pPlayerMgr->GetAt(i).m_strName); - m_comboOwners.SetCurSel(m_nOwnerSel + 1); + for (const Player& player : *m_pPlayerMgr) + { + m_comboOwners.AddString(player.m_strName); + } + m_comboOwners.SetCurSel(static_cast(m_nOwnerSel) + 1); if (m_comboOwners.GetCurSel() <= 0) { m_chkAllowAccess.SetCheck(0); diff --git a/GP/DlgYprop.h b/GP/DlgYprop.h index 7d0b2c6..ff2fc9c 100644 --- a/GP/DlgYprop.h +++ b/GP/DlgYprop.h @@ -51,7 +51,7 @@ class CTrayPropDialog : public CDialog //}}AFX_DATA size_t m_nYSel; - int m_nOwnerSel; // -1 = no owner, 0 = first player, .... + PlayerId m_nOwnerSel; // -1 = no owner, 0 = first player, .... BOOL m_bNonOwnerAccess; BOOL m_bEnforceVizForOwnerToo; diff --git a/GP/Editnocv.cpp b/GP/Editnocv.cpp index 377f145..e029a48 100644 --- a/GP/Editnocv.cpp +++ b/GP/Editnocv.cpp @@ -1,6 +1,6 @@ // Editnocv.cpp : implementation file // -// Copyright (c) 1994-2023 By Dale L. Larson & William Su, All Rights Reserved. +// Copyright (c) 1994-2025 By Dale L. Larson & William Su, All Rights Reserved. // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the @@ -35,106 +35,47 @@ static char THIS_FILE[] = __FILE__; ///////////////////////////////////////////////////////////////////////////// // CEditNoChevron -CEditNoChevron::CEditNoChevron() -{ -} +wxIMPLEMENT_DYNAMIC_CLASS(CEditNoChevron, wxTextCtrl); -CEditNoChevron::~CEditNoChevron() -{ -} +wxBEGIN_EVENT_TABLE(CEditNoChevron, wxTextCtrl) + EVT_CHAR(OnChar) + EVT_TEXT_PASTE(wxID_ANY, OnPasteMessage) +wxEND_EVENT_TABLE() -BEGIN_MESSAGE_MAP(CEditNoChevron, CEdit) - //{{AFX_MSG_MAP(CEditNoChevron) - ON_WM_CHAR() - ON_MESSAGE(WM_PASTE, OnPasteMessage) - //}}AFX_MSG_MAP -END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CEditNoChevron message handlers -void CEditNoChevron::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags) +void CEditNoChevron::OnChar(wxKeyEvent& event) { // Filter chevrons ('>>') and paragraph marks ('reverse P') - if (nChar != 0xBB && nChar != 0xB6) - CEdit::OnChar(nChar, nRepCnt, nFlags); + if (event.GetUnicodeKey() != 0xBB && event.GetUnicodeKey() != 0xB6) + { + event.Skip(); + } } -LRESULT CEditNoChevron::OnPasteMessage(WPARAM, LPARAM) +void CEditNoChevron::OnPasteMessage(wxClipboardTextEvent& event) { - if (GetStyle() & ES_READONLY) - return (LRESULT)0; - - class RAII_OpenClipboard - { - public: - RAII_OpenClipboard(CWnd* wnd) : b(wnd->OpenClipboard()) {} - ~RAII_OpenClipboard() - { - if (b) - { - CloseClipboard(); - } - } - explicit operator bool() const { return b; } - private: - const bool b; - } openClipboard(this); - if (openClipboard) + wxClipboardLocker clipLock; + wxTextDataObject data; + if (wxTheClipboard->GetData(data)) { - std::optional pText; - { - class RAII_GlobalLock - { - public: - RAII_GlobalLock(HGLOBAL h) : - hData(h), - data(GlobalLock(hData)) - { - } - operator const void* () const { return data; } - ~RAII_GlobalLock() { GlobalUnlock(hData); } - private: - const HGLOBAL hData; - const void* const data; - }; - - RAII_GlobalLock globalLockUnicode(::GetClipboardData(CF_UNICODETEXT)); - if (globalLockUnicode) - { - pText.emplace(static_cast(static_cast(globalLockUnicode))); - } - else - { - RAII_GlobalLock globalLockText(::GetClipboardData(CF_UNICODETEXT)); - if (globalLockText) - { - pText.emplace(static_cast(static_cast(globalLockText))); - } - } - } - if (pText != NULL) + wxString s = data.GetText(); + for (auto it = s.begin() ; it != s.end() ; ++it) { - // Replace chevrons and paragraph chars with spaces - CB::string str; - str.reserve(pText->a_size()); - for (size_t i = size_t(0) ; i < pText->a_size() ; ++i) + switch ((*it).GetValue()) { - char c = (*pText)[i]; - switch (c) - { - case static_cast(0xBB): - case static_cast(0xB6): - str += ' '; - break; - default: - str += c; - } + case 0xBB: + case 0xB6: + *it = ' '; + break; } - ReplaceSel(str); } + long from, to; + GetSelection(&from, &to); + Replace(from, to, s); } - return (LRESULT)0; } diff --git a/GP/Editnocv.h b/GP/Editnocv.h index d083693..8fbe3f3 100644 --- a/GP/Editnocv.h +++ b/GP/Editnocv.h @@ -1,6 +1,6 @@ // Editnocv.h : header file // -// Copyright (c) 1994-2020 By Dale L. Larson, All Rights Reserved. +// Copyright (c) 1994-2025 By Dale L. Larson & William Su, All Rights Reserved. // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the @@ -32,11 +32,11 @@ ///////////////////////////////////////////////////////////////////////////// // CEditNoChevron window -class CEditNoChevron : public CEdit +class CEditNoChevron : public wxTextCtrl { // Construction public: - CEditNoChevron(); + using wxTextCtrl::wxTextCtrl; // Attributes public: @@ -45,22 +45,18 @@ class CEditNoChevron : public CEdit public: // Overrides - // ClassWizard generated virtual function overrides - //{{AFX_VIRTUAL(CEditNoChevron) - //}}AFX_VIRTUAL // Implementation public: - virtual ~CEditNoChevron(); // Generated message map functions protected: - //{{AFX_MSG(CEditNoChevron) - afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags); - afx_msg LRESULT OnPasteMessage(WPARAM, LPARAM); - //}}AFX_MSG + void OnChar(wxKeyEvent& event); + void OnPasteMessage(wxClipboardTextEvent& event); - DECLARE_MESSAGE_MAP() + wxDECLARE_EVENT_TABLE(); + wxDECLARE_NO_COPY_CLASS(CEditNoChevron); + wxDECLARE_DYNAMIC_CLASS(CEditNoChevron); }; ///////////////////////////////////////////////////////////////////////////// diff --git a/GP/FrmMain.cpp b/GP/FrmMain.cpp index 55f2618..f7b0cda 100644 --- a/GP/FrmMain.cpp +++ b/GP/FrmMain.cpp @@ -91,7 +91,8 @@ static const CB::string szSectControlBars = "ControlBars"; ///////////////////////////////////////////////////////////////////////////// // CMainFrame construction/destruction -CMainFrame::CMainFrame() +CMainFrame::CMainFrame() : + CB::wxNativeContainerWindowMixin(static_cast(*this)) { // TODO: add member initialization code here } diff --git a/GP/FrmMain.h b/GP/FrmMain.h index 40be225..ee8894e 100644 --- a/GP/FrmMain.h +++ b/GP/FrmMain.h @@ -39,7 +39,8 @@ #include "PalReadMsg.h" #endif -class CMainFrame : public CMDIFrameWndExCb +class CMainFrame : public CMDIFrameWndExCb, + public CB::wxNativeContainerWindowMixin { DECLARE_DYNAMIC(CMainFrame) public: diff --git a/GP/GamDoc.cpp b/GP/GamDoc.cpp index dd61cd7..b6fd74d 100644 --- a/GP/GamDoc.cpp +++ b/GP/GamDoc.cpp @@ -1,6 +1,6 @@ // GamDoc.cpp // -// Copyright (c) 1994-2024 By Dale L. Larson & William Su, All Rights Reserved. +// Copyright (c) 1994-2025 By Dale L. Larson & William Su, All Rights Reserved. // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the @@ -247,7 +247,7 @@ CGamDoc::CGamDoc() : m_pWinState = NULL; m_pPlayerMgr = NULL; - m_dwCurrentPlayer = 0; + m_dwCurrentPlayer = OWNER_MASK_SPECTATOR; m_dwPlayerHash = 0; m_bSimulateSpectator = FALSE; @@ -434,7 +434,7 @@ void CGamDoc::DeleteContents() if (m_pPlayerMgr != NULL) delete m_pPlayerMgr; m_pPlayerMgr = NULL; - m_dwCurrentPlayer = 0; + m_dwCurrentPlayer = OWNER_MASK_SPECTATOR; m_dwPlayerHash = 0; m_strPlayerFileDescr.clear(); @@ -518,7 +518,7 @@ BOOL CGamDoc::CreateNewFrame(CDocTemplate* pTemplate, const CB::string& pszTitle ///////////////////////////////////////////////////////////////////////////// -CGamProjView& CGamDoc::FindProjectView() +CGamProjView& CGamDoc::FindProjectView() const { POSITION pos = GetFirstViewPosition(); while (pos != NULL) @@ -533,7 +533,7 @@ CGamProjView& CGamDoc::FindProjectView() AfxThrowNotSupportedException(); } -CView* CGamDoc::FindPBoardView(const CPlayBoard& pPBoard) +CView* CGamDoc::FindPBoardView(const CPlayBoard& pPBoard) const { if (!IsScenario() && pPBoard.IsPrivate() && @@ -558,7 +558,7 @@ CView* CGamDoc::FindPBoardView(const CPlayBoard& pPBoard) ///////////////////////////////////////////////////////////////////////////// -void CGamDoc::GetDocumentFrameList(std::vector>& tblFrames) +void CGamDoc::GetDocumentFrameList(std::vector>& tblFrames) const { tblFrames.clear(); @@ -703,9 +703,8 @@ BOOL CGamDoc::OnNewGame() // First prompt for name changes... - CMultiplayerGameDialog dlgMultiplay; - dlgMultiplay.m_pPlayerMgr = m_pPlayerMgr; - if (dlgMultiplay.DoModal() != IDOK) + CMultiplayerGameDialog dlgMultiplay(*m_pPlayerMgr); + if (dlgMultiplay.ShowModal() != wxID_OK) return FALSE; // Prompt for a base file name... @@ -739,9 +738,11 @@ BOOL CGamDoc::OnNewGame() // the scenario description. CB::string strPlayers; - for (int i = 0; i < m_pPlayerMgr->GetSize(); i++) - strPlayers += m_pPlayerMgr->ElementAt(i).m_strName + "\r\n"; - CB::string strGamInfo = CB::string::Format(IDS_INFO_MPLAY_CREATE, m_pPlayerMgr->GetSize(), + for (const Player& player : *m_pPlayerMgr) + { + strPlayers += player.m_strName + "\r\n"; + } + CB::string strGamInfo = CB::string::Format(IDS_INFO_MPLAY_CREATE, m_pPlayerMgr->size(), strPlayers); if (dlgMultiplay.m_bCreateReferee) { @@ -751,14 +752,15 @@ BOOL CGamDoc::OnNewGame() // First create each of the player game files... - for (int i = 0; i < m_pPlayerMgr->GetSize(); i++) + for (size_t i = size_t(0) ; i < m_pPlayerMgr->size() ; ++i) { + PlayerId id(i); CB::string strPlayName; - strPlayName = m_pPlayerMgr->ElementAt(i).m_strName; + strPlayName = (*m_pPlayerMgr)[id].m_strName; CB::string strFName = strBaseName + "-" + strPlayName + "." + dlg.GetFileExt(); m_strPlayerFileDescr = strGamInfo + "@" + strFName; // For hash check and calc - m_dwCurrentPlayer = CPlayerManager::GetMaskFromPlayerNum(i); + m_dwCurrentPlayer = CPlayerManager::GetMaskFromPlayerNum(id); m_dwPlayerHash = CalculateHashForCurrentPlayerMask(); if (!DoSaveGameFile(strFName)) @@ -773,7 +775,7 @@ BOOL CGamDoc::OnNewGame() CB::string strFName = strBaseName + strSpec + dlg.GetFileExt(); m_strPlayerFileDescr = strGamInfo + "@" + strFName; // For hash check and calc - m_dwCurrentPlayer = 0; + m_dwCurrentPlayer = OWNER_MASK_SPECTATOR; m_dwPlayerHash = CalculateHashForCurrentPlayerMask(); if (!DoSaveGameFile(strFName)) @@ -812,7 +814,7 @@ BOOL CGamDoc::OnNewGame() ///////////////////////////////////////////////////////////////////////////// -DWORD CGamDoc::CalculateHashForCurrentPlayerMask() +DWORD CGamDoc::CalculateHashForCurrentPlayerMask() const { ASSERT(!m_strPlayerFileDescr.empty()); std::array bfr1 = @@ -820,13 +822,13 @@ DWORD CGamDoc::CalculateHashForCurrentPlayerMask() compatible with CB3 */ Compute16ByteHash<18>(m_strPlayerFileDescr.a_str(), m_strPlayerFileDescr.a_size()); - bfr1[16] = static_cast(m_dwCurrentPlayer >> 8); - bfr1[17] = static_cast(m_dwCurrentPlayer & 0xFF); + bfr1[16] = static_cast((static_cast(m_dwCurrentPlayer) >> 8)); + bfr1[17] = static_cast((static_cast(m_dwCurrentPlayer) & uint32_t(0xFF))); std::array bfr2 = Compute16ByteHash(bfr1.data(), bfr1.size()); return *reinterpret_cast(bfr2.data()); } -BOOL CGamDoc::VerifyCurrentPlayerMask() +BOOL CGamDoc::VerifyCurrentPlayerMask() const { DWORD dwCalcedKey = CalculateHashForCurrentPlayerMask(); return m_dwPlayerHash == dwCalcedKey; @@ -839,9 +841,9 @@ BOOL CGamDoc::CheckIfPlayerFilesExist(const CB::string& strBaseName, const CB::s { BOOL bFilesExist = FALSE; - for (int i = 0; i < m_pPlayerMgr->GetSize(); i++) + for (const Player& player : *m_pPlayerMgr) { - CB::string strPlayName = m_pPlayerMgr->ElementAt(i).m_strName; + CB::string strPlayName = player.m_strName; CB::string strFName = strBaseName + "-" + strPlayName + "." + strFileExt; if (std::filesystem::exists(strFName)) @@ -978,16 +980,16 @@ const CPieceManager& CGamDoc::GetPieceManager() const //////////////////////////////////////////////////////////////////////// -CTileFacingMap* CGamDoc::GetFacingMap() +CTileFacingMap& CGamDoc::GetFacingMap() { ASSERT(m_pGbx != NULL); ASSERT(m_pGbx->GetTileManager()); if (m_pTileFacingMap != NULL) - return m_pTileFacingMap; + return *m_pTileFacingMap; else { m_pTileFacingMap = new CTileFacingMap(&GetTileManager()); - return m_pTileFacingMap; + return *m_pTileFacingMap; } } @@ -1005,7 +1007,7 @@ void CGamDoc::CloseTrayPalettes() void CGamDoc::DoBoardProperties(size_t nBrd) { - CPlayBoard& pPBoard = GetPBoardManager()->GetPBoard(nBrd); + CPlayBoard& pPBoard = GetPBoardManager().GetPBoard(nBrd); DoBoardProperties(pPBoard); } @@ -1026,9 +1028,9 @@ void CGamDoc::DoBoardProperties(CPlayBoard& pPBoard) dlg.m_bShowSelListAndTinyMap = pPBoard.m_bShowSelListAndTinyMap; dlg.m_xStackStagger = pPBoard.m_xStackStagger; dlg.m_yStackStagger = pPBoard.m_yStackStagger; - dlg.m_crPlotColor = pPBoard.m_crPlotLineColor; + dlg.m_crPlotColor = CB::Convert(pPBoard.m_crPlotLineColor); dlg.m_nPlotWd = pPBoard.m_nPlotLineWidth; - dlg.m_strBoardName = pPBoard.GetBoard()->GetName(); + dlg.m_strBoardName = pPBoard.GetBoard()->GetName().wx_str(); dlg.m_pPlayerMgr = GetPlayerManager(); dlg.m_nOwnerSel = CPlayerManager::GetPlayerNumFromMask(pPBoard.GetOwnerMask()); dlg.m_bOwnerInfoIsReadOnly = !IsScenario(); @@ -1036,7 +1038,7 @@ void CGamDoc::DoBoardProperties(CPlayBoard& pPBoard) dlg.m_bPrivate = pPBoard.IsPrivate(); dlg.m_bDrawLockedBeneath = pPBoard.GetDrawLockedBeneath(); - if (dlg.DoModal() == IDOK) + if (dlg.ShowModal() == wxID_OK) { pPBoard.m_bGridSnap = dlg.m_bGridSnap; pPBoard.m_bGridRectCenters = dlg.m_bGridRectCenters; @@ -1051,7 +1053,7 @@ void CGamDoc::DoBoardProperties(CPlayBoard& pPBoard) pPBoard.m_bShowSelListAndTinyMap = dlg.m_bShowSelListAndTinyMap; pPBoard.m_xStackStagger = dlg.m_xStackStagger; pPBoard.m_yStackStagger = dlg.m_yStackStagger; - pPBoard.m_crPlotLineColor = dlg.m_crPlotColor; + pPBoard.m_crPlotLineColor = CB::Convert(dlg.m_crPlotColor); pPBoard.m_nPlotLineWidth = dlg.m_nPlotWd; pPBoard.SetDrawLockedBeneath(dlg.m_bDrawLockedBeneath); @@ -1570,7 +1572,7 @@ void CGamDoc::OnEditCreateTray() { ASSERT(IsScenario()); CTrayNewDialog dlg; - dlg.m_pYMgr =GetTrayManager(); + dlg.m_pYMgr = &GetTrayManager(); if (dlg.DoModal() == IDOK) { dlg.m_pYMgr->CreateTraySet(dlg.m_strName); @@ -1589,14 +1591,14 @@ void CGamDoc::OnUpdateEditCreateTray(CCmdUI* pCmdUI) void CGamDoc::OnEditScenarioProperties() { - ASSERT(IsScenario()); + wxASSERT(IsScenario()); CScnPropDialog dlg; - dlg.m_strAuthor = m_strScnAuthor; - dlg.m_strTitle = m_strScnTitle; - dlg.m_strDescr = m_strScnDescr; + dlg.m_strAuthor = m_strScnAuthor.wx_str(); + dlg.m_strTitle = m_strScnTitle.wx_str(); + dlg.m_strDescr = m_strScnDescr.wx_str(); - if (dlg.DoModal() == IDOK) + if (dlg.ShowModal() == wxID_OK) { m_strScnAuthor = dlg.m_strAuthor; m_strScnTitle = dlg.m_strTitle; @@ -1615,21 +1617,18 @@ void CGamDoc::OnEditSelectBoards() { ASSERT(IsScenario()); - CPBoardManager* pPBMgr = GetPBoardManager(); - ASSERT(pPBMgr); - - CSelectBoardsDialog dlg; + CPBoardManager& pPBMgr = GetPBoardManager(); - dlg.m_pBMgr = pPBMgr->GetBoardManager(); - pPBMgr->GetPBoardList(dlg.m_tblBrds); + CSelectBoardsDialog dlg(CheckedDeref(pPBMgr.GetBoardManager())); + pPBMgr.GetPBoardList(dlg.m_tblBrds); - if (dlg.DoModal() == IDOK) + if (dlg.ShowModal() == wxID_OK) { // First close all the views of boards that are going // to be removed from the play list. std::vector> tblNotInList; - pPBMgr->FindPBoardsNotInList(dlg.m_tblBrds, tblNotInList); - for (size_t i = 0; i < tblNotInList.size(); i++) + pPBMgr.FindPBoardsNotInList(dlg.m_tblBrds, tblNotInList); + for (size_t i = size_t(0); i < tblNotInList.size(); i++) { CView* pView = FindPBoardView(*tblNotInList.at(i)); if (pView != NULL) @@ -1641,7 +1640,7 @@ void CGamDoc::OnEditSelectBoards() } // Then change the play list. - pPBMgr->SetPBoardList(dlg.m_tblBrds); + pPBMgr.SetPBoardList(dlg.m_tblBrds); UpdateAllViews(NULL, HINT_BOARDCHANGE); SetModifiedFlag(); } @@ -1656,10 +1655,9 @@ void CGamDoc::OnEditImportPieceGroups() { ASSERT(IsScenario()); - CImportTraysDlg dlg; - dlg.m_pDoc = this; + CImportTraysDlg dlg(*this); - if (dlg.DoModal() == IDOK) + if (dlg.ShowModal() == wxID_OK) { CGamDocHint hint; hint.GetArgs().m_pTray = NULL; @@ -1675,15 +1673,14 @@ void CGamDoc::OnUpdateEditImportPieceGroups(CCmdUI* pCmdUI) void CGamDoc::OnEditSelectGamePieces() { - ASSERT(IsScenario() && GetTrayManager()->GetNumTraySets() > 0); - CTrayManager* pYMgr = GetTrayManager(); + wxASSERT(IsScenario() && GetTrayManager().GetNumTraySets() > size_t(0)); CSetPiecesDialog dlg(*this); dlg.m_nYSel = 0; // Default is first tray CloseTrayPalettes(); // ...Ditto that for tray palettes - dlg.DoModal(); + dlg.ShowModal(); // Notify all visible trays CGamDocHint hint; @@ -1694,7 +1691,7 @@ void CGamDoc::OnEditSelectGamePieces() void CGamDoc::OnUpdateEditSelectGamePieces(CCmdUI* pCmdUI) { - pCmdUI->Enable(IsScenario() && GetTrayManager()->GetNumTraySets() > 0); + pCmdUI->Enable(IsScenario() && GetTrayManager().GetNumTraySets() > 0); } void CGamDoc::OnFileLoadMoveFile() @@ -1726,7 +1723,7 @@ void CGamDoc::OnUpdateFileLoadMoveFile(CCmdUI* pCmdUI) /////////////////////////////////////////////////////////////////////// -BOOL CGamDoc::IsRecordingCompoundMove() +BOOL CGamDoc::IsRecordingCompoundMove() const { return IsRecording() && m_pRcdMoves != NULL && m_pRcdMoves->IsRecordingCompoundMove(); @@ -1786,12 +1783,12 @@ void CGamDoc::OnFileSaveGameAsScenario() m_bScenario = TRUE; CB::string strPlayerFileDescr = m_strPlayerFileDescr; DWORD dwPlayerHash = m_dwPlayerHash; - DWORD dwCurrentPlayer = m_dwCurrentPlayer; + PlayerMask dwCurrentPlayer = m_dwCurrentPlayer; DWORD dwScenarioID = m_dwScenarioID; // Cache scenario ID m_strPlayerFileDescr.clear(); m_dwPlayerHash = 0; - m_dwCurrentPlayer = 0; + m_dwCurrentPlayer = OWNER_MASK_SPECTATOR; m_dwScenarioID = IssueScenarioID(); // Create new scenario ID std::unique_ptr fileName = CB::string::DoPromptFileName(*GetApp(), IDS_SAVEGAMEASSCENARIO, @@ -1878,8 +1875,8 @@ void CGamDoc::OnUpdateViewSaveWinState(CCmdUI* pCmdUI) void CGamDoc::OnEditCreatePlayers() { CCreatePlayersDialog dlg; - dlg.m_nPlayerCount = value_preserving_cast(m_pPlayerMgr != NULL ? m_pPlayerMgr->GetSize() : 0); - if (dlg.DoModal() != IDOK) + dlg.m_nPlayerCount = m_pPlayerMgr != NULL ? m_pPlayerMgr->size() : size_t(0); + if (dlg.ShowModal() != wxID_OK) return; if (m_pPlayerMgr != NULL) @@ -1910,10 +1907,10 @@ void CGamDoc::OnUpdateEditCreatePlayers(CCmdUI* pCmdUI) void CGamDoc::OnEditEditPlayers() { CEditPlayersDialog dlg; - dlg.SetDialogsPlayerNames(m_pPlayerMgr); - if (dlg.DoModal() != IDOK) + dlg.SetDialogsPlayerNames(*m_pPlayerMgr); + if (dlg.ShowModal() != wxID_OK) return; - dlg.GetPlayerNamesFromDialog(m_pPlayerMgr); + dlg.GetPlayerNamesFromDialog(*m_pPlayerMgr); SetModifiedFlag(); UpdateAllViews(NULL); } @@ -1921,7 +1918,7 @@ void CGamDoc::OnEditEditPlayers() void CGamDoc::OnUpdateEditEditPlayers(CCmdUI* pCmdUI) { pCmdUI->Enable(IsScenario() && m_pPlayerMgr != NULL && - m_pPlayerMgr->GetSize() > 0); + !m_pPlayerMgr->empty()); } void CGamDoc::OnActSimulateSpectator() @@ -1932,7 +1929,7 @@ void CGamDoc::OnActSimulateSpectator() void CGamDoc::OnUpdateActSimulateSpectator(CCmdUI* pCmdUI) { - if (!IsScenario() && m_dwCurrentPlayer != 0) + if (!IsScenario() && bool(m_dwCurrentPlayer)) { pCmdUI->Enable(TRUE); pCmdUI->SetCheck(m_bSimulateSpectator ? 1 : 0); @@ -1947,11 +1944,11 @@ void CGamDoc::OnUpdateActSimulateSpectator(CCmdUI* pCmdUI) void CGamDoc::OnEditCreateGeomorphic() { CCreateGeomorphicBoardDialog dlg(*this); - if (dlg.DoModal() != IDOK) + if (dlg.ShowModal() != wxID_OK) return; OwnerPtr pGeoBoard = dlg.DetachGeomorphicBoard(); - GetPBoardManager()->AddBoard(std::move(pGeoBoard)); // Add to list of active boards + GetPBoardManager().AddBoard(std::move(pGeoBoard)); // Add to list of active boards UpdateAllViews(NULL, HINT_BOARDCHANGE); SetModifiedFlag(); @@ -1973,7 +1970,7 @@ static BYTE szPassWord[16] = void CGamDoc::OnFileCreateReferee() { CPasswordDialog dlg; - if (dlg.DoModal() != IDOK) + if (dlg.ShowModal() != wxID_OK) return; MD5_CTX md5Context; /* use CP1252 (not wchar_t, not UTF8) to remain @@ -1988,7 +1985,7 @@ void CGamDoc::OnFileCreateReferee() // Save so we can later restore. CB::string strPlayerFileDescr = m_strPlayerFileDescr; - DWORD dwCurrentPlayer = m_dwCurrentPlayer; + PlayerMask dwCurrentPlayer = m_dwCurrentPlayer; DWORD dwPlayerHash = m_dwPlayerHash; CB::string strReferee = CB::string::LoadString(IDS_GAME_REFEREE); @@ -2047,7 +2044,7 @@ void CGamDoc::OnUpdateFileCreateReferee(CCmdUI* pCmdUI) void CGamDoc::OnFileChangeGameOwner() { CPasswordDialog dlg; - if (dlg.DoModal() != IDOK) + if (dlg.ShowModal() != wxID_OK) return; MD5_CTX md5Context; /* use CP1252 (not wchar_t, not UTF8) to remain @@ -2060,20 +2057,19 @@ void CGamDoc::OnFileChangeGameOwner() return; } - CChgGameOwnerDialog dlg2; - dlg2.m_pPlayerMgr = GetPlayerManager(); - if (dlg2.DoModal() != IDOK) + CChgGameOwnerDialog dlg2(CheckedDeref(GetPlayerManager())); + if (dlg2.ShowModal() != wxID_OK) return; - if (dlg2.m_nPlayer == -1) + if (dlg2.m_nPlayer == INVALID_PLAYER) return; // No player selected - DWORD dwPlayerMask = CPlayerManager::GetMaskFromPlayerNum(dlg2.m_nPlayer); - CB::string strPlayerName = m_pPlayerMgr->ElementAt(dlg2.m_nPlayer).m_strName; + PlayerMask dwPlayerMask = CPlayerManager::GetMaskFromPlayerNum(dlg2.m_nPlayer); + CB::string strPlayerName = (*m_pPlayerMgr)[dlg2.m_nPlayer].m_strName; // Save so we can later restore. CB::string strPlayerFileDescr = m_strPlayerFileDescr; - DWORD dwCurrentPlayer = m_dwCurrentPlayer; + PlayerMask dwCurrentPlayer = m_dwCurrentPlayer; DWORD dwPlayerHash = m_dwPlayerHash; // Rip apart current player string to get the raw stuff diff --git a/GP/GamDoc.h b/GP/GamDoc.h index 3804187..e32537c 100644 --- a/GP/GamDoc.h +++ b/GP/GamDoc.h @@ -1,6 +1,6 @@ // GamDoc.h // -// Copyright (c) 1994-2024 By Dale L. Larson & William Su, All Rights Reserved. +// Copyright (c) 1994-2025 By Dale L. Larson & William Su, All Rights Reserved. // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the @@ -94,7 +94,7 @@ class CSendMsgDialog; class CModelessDialogCleaner { public: - void operator()(CDialog* p) const; + void operator()(wxDialog* p) const; }; //////////////////////////////////////////////////////////////// @@ -281,7 +281,7 @@ class CGamDoc : public CDocument // to the file. Normally the histories are simply copied // with the file. int m_nLoadedFileVersion; - int GetLoadedVersion() { return m_nLoadedFileVersion; } + int GetLoadedVersion() const { return m_nLoadedFileVersion; } // Attributes public: @@ -290,23 +290,23 @@ class CGamDoc : public CDocument enum GameState { stateNotRecording, stateRecording, stateMovePlay, stateHistPlay }; - GameState GetGameState() { return m_eState; } + GameState GetGameState() const { return m_eState; } void SetGameState(GameState eState) { m_eState = eState; } - BOOL IsRecording() { return m_eState == stateRecording; } - BOOL IsAnyRecorded() { return m_eState == stateRecording && m_pRcdMoves != NULL; } + BOOL IsRecording() const { return m_eState == stateRecording; } + BOOL IsAnyRecorded() const { return m_eState == stateRecording && m_pRcdMoves != NULL; } BOOL IsPlaying() const { return m_eState == stateMovePlay || m_eState == stateHistPlay; } - BOOL IsPlayingMoves() { return m_eState == stateMovePlay; } - BOOL IsPlayingHistory() { return m_eState == stateHistPlay; } - BOOL IsPlayingLastHistory(); + BOOL IsPlayingMoves() const { return m_eState == stateMovePlay; } + BOOL IsPlayingHistory() const { return m_eState == stateHistPlay; } + BOOL IsPlayingLastHistory() const; - BOOL IsQuietPlayback() { return m_bQuietPlayback; } + BOOL IsQuietPlayback() const { return m_bQuietPlayback; } void SetQuietPlayback(BOOL bBeQuite) { m_bQuietPlayback = bBeQuite; } BOOL IsScenario() const { return m_bScenario; } BOOL IsShowingObjectTips() const { return m_bShowObjTipText; } - BOOL IsRecordingCompoundMove(); + BOOL IsRecordingCompoundMove() const; size_t GetCurrentHistoryRecNum() const { return m_nCurHist; } @@ -323,12 +323,12 @@ class CGamDoc : public CDocument return const_cast(std::as_const(*this).GetBoardManager()); } const CPieceManager& GetPieceManager() const; - const CPieceTable* GetPieceTable() const { return m_pPTbl; } - CPieceTable* GetPieceTable() { return const_cast(std::as_const(*this).GetPieceTable()); } - const CTrayManager* GetTrayManager() const { return m_pYMgr; } - CTrayManager* GetTrayManager() { return const_cast(std::as_const(*this).GetTrayManager()); } - const CPBoardManager* GetPBoardManager() const { return m_pPBMgr; } - CPBoardManager* GetPBoardManager() { return const_cast(std::as_const(*this).GetPBoardManager()); } + const CPieceTable& GetPieceTable() const { return CheckedDeref(m_pPTbl); } + CPieceTable& GetPieceTable() { return const_cast(std::as_const(*this).GetPieceTable()); } + const CTrayManager& GetTrayManager() const { return CheckedDeref(m_pYMgr); } + CTrayManager& GetTrayManager() { return const_cast(std::as_const(*this).GetTrayManager()); } + const CPBoardManager& GetPBoardManager() const { return CheckedDeref(m_pPBMgr); } + CPBoardManager& GetPBoardManager() { return const_cast(std::as_const(*this).GetPBoardManager()); } const CPlayerManager* GetPlayerManager() const { return m_pPlayerMgr; } CPlayerManager* GetPlayerManager() { return const_cast(std::as_const(*this).GetPlayerManager()); } CMoveList* GetRecordMoveList() { return m_pRcdMoves.get(); } @@ -337,47 +337,47 @@ class CGamDoc : public CDocument CGameElementStringMap& GetGameStringMap() { return const_cast(std::as_const(*this).GetGameStringMap()); } // Fetch map of temporary tile rotations. - CTileFacingMap* GetFacingMap(); + CTileFacingMap& GetFacingMap(); - uint32_t GetRandomNumberSeed() { return m_nSeedCarryOver; } + uint32_t GetRandomNumberSeed() const { return m_nSeedCarryOver; } void SetRandomNumberSeed(uint32_t nSeedCarryOver) { m_nSeedCarryOver = nSeedCarryOver; } // Operations public: BOOL CreateNewFrame(CDocTemplate* pTemplate, const CB::string& pszTitle, LPVOID lpvCreateParam); - CGamProjView& FindProjectView(); - CView* FindPBoardView(const CPlayBoard& pPBoard); + CGamProjView& FindProjectView() const; + CView* FindPBoardView(const CPlayBoard& pPBoard) const; CView* MakeSurePBoardVisible(CPlayBoard& pPBoard); - void GetDocumentFrameList(std::vector>& tblFrames); + void GetDocumentFrameList(std::vector>& tblFrames) const; - BOOL IsWindowStateAvailable() { return m_pWinState != NULL; } + BOOL IsWindowStateAvailable() const { return m_pWinState != NULL; } void RestoreWindowState(); void DiscardWindowState(); // Support for player accounts BOOL HasPlayers() const { return m_pPlayerMgr != NULL; } - DWORD GetCurrentPlayerMask() const; - void SetCurrentPlayerMask(WORD dwMask) { m_dwCurrentPlayer = dwMask; } - BOOL IsCurrentPlayerReferee(); + PlayerMask GetCurrentPlayerMask() const; + void SetCurrentPlayerMask(PlayerMask dwMask) { m_dwCurrentPlayer = dwMask; } + BOOL IsCurrentPlayerReferee() const; void ClearAllOwnership(); CB::string GetPieceOwnerName(PieceID pid) const; - BOOL IsCurrentPlayer(DWORD dwMask) { return (BOOL)(GetCurrentPlayerMask() & dwMask); } + bool IsCurrentPlayer(PlayerMask dwMask) const { return bool(GetCurrentPlayerMask() & dwMask); } - DWORD CalculateHashForCurrentPlayerMask(); - BOOL VerifyCurrentPlayerMask(); + DWORD CalculateHashForCurrentPlayerMask() const; + BOOL VerifyCurrentPlayerMask() const; - BOOL IsOwnerTipsDisabled() { return m_bDisableOwnerTips; } + BOOL IsOwnerTipsDisabled() const { return m_bDisableOwnerTips; } // Support for strings associated with game elements (pieces, markers) CB::string GetGameElementString(GameElement gelem) const; BOOL HasGameElementString(GameElement gelem) const; void SetGameElementString(GameElement gelem, const CB::string* pszString); - void GetTipTextForObject(const CDrawObj& pDObj, CB::string &strTip, CB::string* pStrTitle = NULL); + void GetTipTextForObject(const CDrawObj& pDObj, CB::string &strTip, CB::string* pStrTitle = NULL) const; // Invalid_v = top - GameElement GetGameElementCodeForObject(const CDrawObj& pDObj, size_t nSide = Invalid_v); - GameElement GetVerifiedGameElementCodeForObject(const CDrawObj& pDObj, size_t nSide = Invalid_v); + GameElement GetGameElementCodeForObject(const CDrawObj& pDObj, size_t nSide = Invalid_v) const; + GameElement GetVerifiedGameElementCodeForObject(const CDrawObj& pDObj, size_t nSide = Invalid_v) const; void DoEditPieceText(PieceID pid); void DoEditObjectText(const CDrawObj& pDObj); @@ -404,7 +404,7 @@ class CGamDoc : public CDocument void RecordPieceMoveToTray(const CTraySet& pYGrp, PieceID pid, size_t nPos); void RecordPieceSetSide(PieceID pid, CPieceTable::Flip flip, size_t side, bool forceHide); void RecordPieceSetFacing(PieceID pid, uint16_t nFacingDegCW); - void RecordPieceSetOwnership(PieceID pid, DWORD dwOwnerMask); + void RecordPieceSetOwnership(PieceID pid, PlayerMask dwOwnerMask); void RecordMarkerSetFacing(ObjectID dwObjID, MarkID mid, uint16_t nFacingDegCW); void RecordMarkMoveToBoard(CPlayBoard* pPBrd, ObjectID dwObjID, MarkID mid, CPoint pnt, PlacePos ePos = placeDefault); @@ -448,8 +448,8 @@ class CGamDoc : public CDocument void ChangePlayingPieceFacingInTray(PieceID pid, uint16_t nFacingDegCW); void ChangeMarkerFacingOnBoard(CMarkObj& pObj, CPlayBoard* pPBrd, uint16_t nFacingDegCW); - void SetPieceOwnership(PieceID pid, DWORD dwOwnerMask); - void SetPieceOwnershipTable(const std::vector& pTblPieces, DWORD dwOwnerMask); + void SetPieceOwnership(PieceID pid, PlayerMask dwOwnerMask); + void SetPieceOwnershipTable(const std::vector& pTblPieces, PlayerMask dwOwnerMask); CDrawObj& CreateMarkerObject(CPlayBoard* pPBrd, MarkID mid, CPoint pnt, ObjectID dwObjID = ObjectID()); @@ -468,7 +468,7 @@ class CGamDoc : public CDocument void RemoveObjectFromCurrentLocation(CDrawObj* pObj); void ExpungeUnusedPiecesFromBoards(); - void FindObjectTableUnionRect(const std::vector>& pLst, CRect& rct); + void FindObjectTableUnionRect(const std::vector>& pLst, CRect& rct) const; // Object and piece locator methods... BOOL FindPieceCurrentLocation(PieceID pid, const CTraySet*& pTraySet, @@ -536,7 +536,6 @@ class CGamDoc : public CDocument void MsgDialogSend(const CB::string& str); void MsgDialogCancel(BOOL bDiscardHistory = FALSE); void MsgDialogClose(const CB::string& str); - void MsgDialogForceDefer(); static CB::string MsgEncodeFromPieces(const CB::string& strReadOnly, const CB::string& strEditable); static void MsgSeperateIntoPieces(const CB::string& strMsg, CB::string& strReadOnly, @@ -612,7 +611,7 @@ class CGamDoc : public CDocument CB::string m_strScnTitle; // Scenario title CB::string m_strScnDescr; // Scenario description CPlayerManager* m_pPlayerMgr;// Pointer to player manager (if has player accounts) - DWORD m_dwCurrentPlayer;// Mask for game file's player + PlayerMask m_dwCurrentPlayer;// Mask for game file's player DWORD m_dwPlayerHash; // MS 32 bits of MD5 hash of m_wCurrentPlayer .. // .. and player file description text. Used as .. // .. a tamper check. diff --git a/GP/GamDoc1.cpp b/GP/GamDoc1.cpp index 7560e73..19de48e 100644 --- a/GP/GamDoc1.cpp +++ b/GP/GamDoc1.cpp @@ -1,6 +1,6 @@ // GamDoc1.cpp - Command and Control for document wide operations // -// Copyright (c) 1994-2020 By Dale L. Larson, All Rights Reserved. +// Copyright (c) 1994-2025 By Dale L. Larson & William Su, All Rights Reserved. // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the @@ -58,7 +58,7 @@ void CGamDoc::PlacePieceOnBoard(CPoint pnt, PieceID pid, CPlayBoard *pPBrd) // If the destination is owned, force the piece to take on the // same ownership. Otherwise, leave it's ownership state alone. if (pPBrd->IsOwned()) - GetPieceTable()->SetOwnerMask(pid, pPBrd->GetOwnerMask()); + GetPieceTable().SetOwnerMask(pid, pPBrd->GetOwnerMask()); if (!IsQuietPlayback()) { @@ -93,7 +93,7 @@ void CGamDoc::PlacePieceInTray(PieceID pid, CTraySet& pYGrp, size_t nPos) // Force the piece to take on the same ownership as the // tray has. - GetPieceTable()->SetOwnerMask(pid, pYGrp.IsOwned() ? pYGrp.GetOwnerMask() : 0); + GetPieceTable().SetOwnerMask(pid, pYGrp.IsOwned() ? pYGrp.GetOwnerMask() : OWNER_MASK_SPECTATOR); pYGrp.AddPieceID(pid, nPos); @@ -164,7 +164,7 @@ void CGamDoc::PlaceObjectOnBoard(CPlayBoard *pPBrd, CDrawObj::OwnerPtr opObj, if (pPBrd->IsOwned() && pObj.GetType() == CDrawObj::drawPieceObj) { CPieceObj& pPObj = static_cast(pObj); - GetPieceTable()->SetOwnerMask(pPObj.m_pid, pPBrd->GetOwnerMask()); + GetPieceTable().SetOwnerMask(pPObj.m_pid, pPBrd->GetOwnerMask()); } if (!IsQuietPlayback()) @@ -329,7 +329,7 @@ void CGamDoc::PlaceObjectTableOnBoard(const std::vector> if (pPBrd->IsOwned() && pObj.GetType() == CDrawObj::drawPieceObj) { CPieceObj& pPObj = static_cast(pObj); - GetPieceTable()->SetOwnerMask(pPObj.m_pid, pPBrd->GetOwnerMask()); + GetPieceTable().SetOwnerMask(pPObj.m_pid, pPBrd->GetOwnerMask()); } if (!IsQuietPlayback()) @@ -481,7 +481,7 @@ void CGamDoc::InvertPlayingPieceOnBoard(CPieceObj& pObj, const CPlayBoard& pPBrd m_pPTbl->FlipPieceOver(pObj.m_pid, flip, side); // Record processing - RecordPieceSetSide(pObj.m_pid, flip, GetPieceTable()->GetSide(pObj.m_pid), false); + RecordPieceSetSide(pObj.m_pid, flip, GetPieceTable().GetSide(pObj.m_pid), false); if (!IsQuietPlayback()) { @@ -514,7 +514,7 @@ void CGamDoc::InvertPlayingPieceInTray(PieceID pid, CPieceTable::Flip flip, size CTraySet* pYGrp = FindPieceInTray(pid); // Record processing - RecordPieceSetSide(pid, flip, GetPieceTable()->GetSide(pid), forceHide); + RecordPieceSetSide(pid, flip, GetPieceTable().GetSide(pid), forceHide); if (!IsQuietPlayback() && bOkToNotifyTray) { @@ -692,9 +692,9 @@ void CGamDoc::SetObjectLockdown(CDrawObj& pDObj, BOOL bLockState) ////////////////////////////////////////////////////////////////////// // (RECORDS) -void CGamDoc::SetPieceOwnership(PieceID pid, DWORD dwOwnerMask) +void CGamDoc::SetPieceOwnership(PieceID pid, PlayerMask dwOwnerMask) { - GetPieceTable()->SetOwnerMask(pid, dwOwnerMask); + GetPieceTable().SetOwnerMask(pid, dwOwnerMask); // Record processing RecordPieceSetOwnership(pid, dwOwnerMask); @@ -702,7 +702,7 @@ void CGamDoc::SetPieceOwnership(PieceID pid, DWORD dwOwnerMask) SetModifiedFlag(); } -void CGamDoc::SetPieceOwnershipTable(const std::vector& pTblPieces, DWORD dwOwnerMask) +void CGamDoc::SetPieceOwnershipTable(const std::vector& pTblPieces, PlayerMask dwOwnerMask) { for (size_t i = 0; i < pTblPieces.size(); i++) SetPieceOwnership(pTblPieces.at(i), dwOwnerMask); @@ -963,7 +963,7 @@ void CGamDoc::RemoveObjectFromCurrentLocation(CDrawObj* pObj) //////////////////////////////////////////////////////////////////// -void CGamDoc::FindObjectTableUnionRect(const std::vector>& pLst, CRect& rct) +void CGamDoc::FindObjectTableUnionRect(const std::vector>& pLst, CRect& rct) const { rct.SetRectEmpty(); diff --git a/GP/GamDoc2.cpp b/GP/GamDoc2.cpp index 975902f..382879b 100644 --- a/GP/GamDoc2.cpp +++ b/GP/GamDoc2.cpp @@ -136,7 +136,7 @@ void CGamDoc::SaveRecordedMoves() // Get a description from user. CMovDescDialog dlg2; - if (dlg2.DoModal() != IDOK) + if (dlg2.ShowModal() != wxID_OK) return; // Set up history record. @@ -324,7 +324,7 @@ void CGamDoc::RecordPieceMoveToTray(const CTraySet& pYGrp, PieceID pid, size_t n if (!IsRecording()) return; CreateRecordListIfRequired(); ASSERT(m_pRcdMoves != NULL); - size_t nYGrp = GetTrayManager()->FindTrayByRef(pYGrp); + size_t nYGrp = GetTrayManager().FindTrayByRef(pYGrp); ASSERT(nYGrp != Invalid_v); OwnerPtr pRcd = MakeOwner(nYGrp, pid, nPos); m_pRcdMoves->AppendMoveRecord(std::move(pRcd)); @@ -354,11 +354,11 @@ void CGamDoc::RecordPieceSetFacing(PieceID pid, uint16_t nFacingDegCW) //////////////////////////////////////////////////////////////////// -void CGamDoc::RecordPieceSetOwnership(PieceID pid, DWORD dwOwnerMask) +void CGamDoc::RecordPieceSetOwnership(PieceID pid, PlayerMask dwOwnerMask) { if (!IsRecording()) return; CreateRecordListIfRequired(); - ASSERT(m_pRcdMoves != NULL); + wxASSERT(m_pRcdMoves != NULL); OwnerPtr pRcd = MakeOwner(pid, dwOwnerMask); m_pRcdMoves->AppendMoveRecord(std::move(pRcd)); } diff --git a/GP/GamDoc3.cpp b/GP/GamDoc3.cpp index b82ee53..10194e4 100644 --- a/GP/GamDoc3.cpp +++ b/GP/GamDoc3.cpp @@ -1,6 +1,6 @@ // GamDoc3.cpp -- serialization support for the document. // -// Copyright (c) 1994-2024 By Dale L. Larson & William Su, All Rights Reserved. +// Copyright (c) 1994-2025 By Dale L. Larson & William Su, All Rights Reserved. // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the @@ -373,27 +373,27 @@ void CGamDoc::SerializeGame(CArchive& ar) uint64_t dummy; SerializeScenarioOrGame(ar, dummy); - WORD wTmp; - BYTE cTmp; + uint16_t wTmp; + uint8_t cTmp; if (CGamDoc::GetLoadingVersion() >= NumVersion(2, 0)) { if (CGamDoc::GetLoadingVersion() < NumVersion(3, 10)) { ar >> wTmp; - m_dwCurrentPlayer = UPGRADE_OWNER_MASK(wTmp); + m_dwCurrentPlayer = PlayerMask(UPGRADE_OWNER_MASK(wTmp)); } else ar >> m_dwCurrentPlayer; ar >> m_dwPlayerHash; ar >> m_strPlayerFileDescr; - if (CGamDoc::GetLoadingVersion() < NumVersion(3, 10) && m_dwCurrentPlayer != 0) + if (CGamDoc::GetLoadingVersion() < NumVersion(3, 10) && m_dwCurrentPlayer != OWNER_MASK_SPECTATOR) m_dwPlayerHash = CalculateHashForCurrentPlayerMask(); // Recompute player hash } else { - m_dwCurrentPlayer = 0; + m_dwCurrentPlayer = OWNER_MASK_SPECTATOR; m_dwPlayerHash = 0; m_strPlayerFileDescr.clear(); } @@ -515,17 +515,17 @@ void CGamDoc::SerializeGame(CArchive& ar) // in trays. It will only fix the gamebox if the actual piece is // on a board somewhere. - if (GetPBoardManager()->FindPieceOnBoard(PieceID(0)) != NULL) + if (GetPBoardManager().FindPieceOnBoard(PieceID(0)) != NULL) { - CTrayManager *pTMgr = GetTrayManager(); - while (pTMgr->FindPieceIDInTraySet(PieceID(0)) != NULL) + CTrayManager& pTMgr = GetTrayManager(); + while (pTMgr.FindPieceIDInTraySet(PieceID(0)) != NULL) { TRACE0("Removed bogus PieceID 0 from tray\n"); - pTMgr->RemovePieceIDFromTraySets(PieceID(0)); + pTMgr.RemovePieceIDFromTraySets(PieceID(0)); } } - GetTrayManager()->PropagateOwnerMaskToAllPieces(this); - GetPBoardManager()->PropagateOwnerMaskToAllPieces(); + GetTrayManager().PropagateOwnerMaskToAllPieces(this); + GetPBoardManager().PropagateOwnerMaskToAllPieces(); GetMainFrame()->GetMessageWindow()->SetText(this); } } @@ -572,13 +572,13 @@ void CGamDoc::SerializeScenario(CArchive& ar) // This code will repair a game containing extraneous ID 0 Pieces // in trays. It will only fix the gamebox if the actual piece is // on a board somewhere. - if (GetPBoardManager()->FindPieceOnBoard(PieceID(0)) != NULL) + if (GetPBoardManager().FindPieceOnBoard(PieceID(0)) != NULL) { - CTrayManager *pTMgr = GetTrayManager(); - while (pTMgr->FindPieceIDInTraySet(PieceID(0)) != NULL) + CTrayManager& pTMgr = GetTrayManager(); + while (pTMgr.FindPieceIDInTraySet(PieceID(0)) != NULL) { TRACE0("Removed bogus PieceID 0 from tray\n"); - pTMgr->RemovePieceIDFromTraySets(PieceID(0)); + pTMgr.RemovePieceIDFromTraySets(PieceID(0)); } } } @@ -957,7 +957,7 @@ void CGamDoc::LoadGameBoxFileForSerialize() szFPath = StrBuildFullFilename(szPath, szGbxRootName); - if (std::filesystem::exists(szFPath)) + if (!std::filesystem::exists(szFPath)) { // File doesn't exist where the game file is. // Use open file dialog to locate file. diff --git a/GP/GamDoc4.cpp b/GP/GamDoc4.cpp index ac04ea7..157363c 100644 --- a/GP/GamDoc4.cpp +++ b/GP/GamDoc4.cpp @@ -1,6 +1,6 @@ // GamDoc4.cpp - various game playback support routines // -// Copyright (c) 1994-2023 By Dale L. Larson & William Su, All Rights Reserved. +// Copyright (c) 1994-2025 By Dale L. Larson & William Su, All Rights Reserved. // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the @@ -136,7 +136,7 @@ void CGamDoc::LoadAndActivateMoveFile(const CB::string& pszPathName) pRcd.GetGameState().RestoreState(*this); // Make sure we account for possible deletions // of pieces in move file (for crash resistance) - GetPieceTable()->PurgeUndefinedPieceIDs(); + GetPieceTable().PurgeUndefinedPieceIDs(); bUpdatedGameState = TRUE; // File's positions match current positions. @@ -266,7 +266,7 @@ BOOL CGamDoc::LoadAndActivateHistory(size_t nHistRec) // Make sure we account for possible deletions // of pieces in move file (for crash resistance) - GetPieceTable()->PurgeUndefinedPieceIDs(); + GetPieceTable().PurgeUndefinedPieceIDs(); m_nFirstMove = size_t(1); // Restart location (state rec) m_nCurMove = size_t(2); // Set to start of actual moves @@ -357,7 +357,7 @@ BOOL CGamDoc::LoadVintageHistoryRecord(CFile& file, CHistRecord& pHist) // Make sure we account for possible deletions // of pieces in move file (for crash resistance) - GetPieceTable()->PurgeUndefinedPieceIDs(); + GetPieceTable().PurgeUndefinedPieceIDs(); pHist.m_dwFilePos = 0; // Just to be clean. Never used again pHist.m_pMList = std::move(pMoves); @@ -491,7 +491,7 @@ void CGamDoc::EnsureTrayIndexVisible(const CTraySet& pYSet, int nPos) OnViewTrayA(); // Make sure item nPos is visible. - size_t nGroup = GetTrayManager()->FindTrayByRef(pYSet); + size_t nGroup = GetTrayManager().FindTrayByRef(pYSet); ASSERT(nGroup != Invalid_v); m_palTrayA.ShowTrayIndex(nGroup, nPos); } @@ -544,7 +544,7 @@ void CGamDoc::SelectTrayItem(const CTraySet& pYSet, PieceID pid, OnViewTrayA(); // Select the piece in the appropriate trayset. - size_t nGroup = GetTrayManager()->FindTrayByRef(pYSet); + size_t nGroup = GetTrayManager().FindTrayByRef(pYSet); ASSERT(nGroup != Invalid_v); m_palTrayA.SelectTrayPiece(nGroup, pid, pszNotificationTip ? pszNotificationTip : nullptr); } diff --git a/GP/GamDoc5.cpp b/GP/GamDoc5.cpp index 1caf3c4..a18bd17 100644 --- a/GP/GamDoc5.cpp +++ b/GP/GamDoc5.cpp @@ -1,6 +1,6 @@ // GamDoc5.cpp : just plain miscellaneous stuff // -// Copyright (c) 1994-2023 By Dale L. Larson & William Su, All Rights Reserved. +// Copyright (c) 1994-2025 By Dale L. Larson & William Su, All Rights Reserved. // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the @@ -50,23 +50,26 @@ static char THIS_FILE[] = __FILE__; #define new DEBUG_NEW #endif -void CModelessDialogCleaner::operator()(CDialog* p) const +void CModelessDialogCleaner::operator()(wxDialog* p) const { if (p) { - if (p->m_hWnd) + if (p->GetHandle()) { - p->DestroyWindow(); + p->Destroy(); + } + else + { + delete p; } - delete p; } } //////////////////////////////////////////////////////////////////////////// -DWORD CGamDoc::GetCurrentPlayerMask() const +PlayerMask CGamDoc::GetCurrentPlayerMask() const { - return m_bSimulateSpectator ? 0 : m_dwCurrentPlayer; + return m_bSimulateSpectator ? OWNER_MASK_SPECTATOR : m_dwCurrentPlayer; } //////////////////////////////////////////////////////////////////////////// @@ -74,14 +77,14 @@ DWORD CGamDoc::GetCurrentPlayerMask() const void CGamDoc::ClearAllOwnership() { - GetPieceTable()->ClearAllOwnership(); - GetTrayManager()->ClearAllOwnership(); - GetPBoardManager()->ClearAllOwnership(); + GetPieceTable().ClearAllOwnership(); + GetTrayManager().ClearAllOwnership(); + GetPBoardManager().ClearAllOwnership(); } //////////////////////////////////////////////////////////////////////////// -BOOL CGamDoc::IsCurrentPlayerReferee() +BOOL CGamDoc::IsCurrentPlayerReferee() const { return HasPlayers() && CPlayerManager::IsReferee(GetCurrentPlayerMask()); } @@ -92,10 +95,10 @@ BOOL CGamDoc::IsCurrentPlayerReferee() CB::string CGamDoc::GetPieceOwnerName(PieceID pid) const { CB::string strName; - if (GetPieceTable()->IsPieceOwned(pid)) + if (GetPieceTable().IsPieceOwned(pid)) { strName = GetPlayerManager()->GetPlayerUsingMask( - GetPieceTable()->GetOwnerMask(pid)).m_strName; + GetPieceTable().GetOwnerMask(pid)).m_strName; } return strName; } @@ -138,7 +141,7 @@ void CGamDoc::SetGameElementString(GameElement gelem, const CB::string* pszStrin } GameElement CGamDoc::GetGameElementCodeForObject(const CDrawObj& pDObj, - size_t nSide /*= Invalid_v*/) + size_t nSide /*= Invalid_v*/) const { if (pDObj.GetType() == CDrawObj::drawPieceObj) { @@ -146,7 +149,7 @@ GameElement CGamDoc::GetGameElementCodeForObject(const CDrawObj& pDObj, PieceID pid = pObj.m_pid; if (nSide == Invalid_v) { - nSide = GetPieceTable()->GetSide(pid); + nSide = GetPieceTable().GetSide(pid); } return MakePieceElement(pid, value_preserving_cast(nSide)); } @@ -160,7 +163,7 @@ GameElement CGamDoc::GetGameElementCodeForObject(const CDrawObj& pDObj, } GameElement CGamDoc::GetVerifiedGameElementCodeForObject(const CDrawObj& pDObj, - size_t nSide /*= Invalid_v*/) + size_t nSide /*= Invalid_v*/) const { GameElement elem = Invalid_v; if (pDObj.GetType() == CDrawObj::drawPieceObj) @@ -169,7 +172,7 @@ GameElement CGamDoc::GetVerifiedGameElementCodeForObject(const CDrawObj& pDObj, PieceID pid = pObj.m_pid; if (nSide == Invalid_v) { - nSide = GetPieceTable()->GetSide(pid); + nSide = GetPieceTable().GetSide(pid); } elem = MakePieceElement(pid, value_preserving_cast(nSide)); @@ -196,13 +199,13 @@ GameElement CGamDoc::GetVerifiedGameElementCodeForObject(const CDrawObj& pDObj, } void CGamDoc::GetTipTextForObject(const CDrawObj& pDObj, CB::string &strTip, - CB::string* pStrTitle /* = NULL */) + CB::string* pStrTitle /* = NULL */) const { if (pDObj.GetType() == CDrawObj::drawPieceObj) { const CPieceObj& pObj = static_cast(pDObj); PieceID pid = pObj.m_pid; - uint8_t nSide = GetPieceTable()->GetSide(pid); + uint8_t nSide = GetPieceTable().GetSide(pid); strTip = GetGameElementString(MakePieceElement(pid, nSide)); } else if (pDObj.GetType() == CDrawObj::drawMarkObj) @@ -220,10 +223,10 @@ void CGamDoc::DoEditPieceText(PieceID pid) { CEditElementTextDialog dlg; - uint8_t nSide = GetPieceTable()->GetSide(pid); + uint8_t nSide = GetPieceTable().GetSide(pid); GameElement elem = MakePieceElement(pid, nSide); dlg.m_strText = GetGameElementString(elem); - dlg.m_nSides = GetPieceTable()->GetSides(pid); + dlg.m_nSides = GetPieceTable().GetSides(pid); /* dlg.m_bSetAllSides = sides >= 2 && all side texts are currently same */ @@ -239,7 +242,7 @@ void CGamDoc::DoEditPieceText(PieceID pid) } } - if (dlg.DoModal() != IDOK) + if (dlg.ShowModal() != wxID_OK) return; AssignNewMoveGroup(); @@ -274,7 +277,7 @@ void CGamDoc::DoEditObjectText(const CDrawObj& pDObj) dlg.m_strText = strTip; - if (dlg.DoModal() != IDOK) + if (dlg.ShowModal() != wxID_OK) return; GameElement elem = GetGameElementCodeForObject(pDObj); @@ -285,7 +288,7 @@ void CGamDoc::DoEditObjectText(const CDrawObj& pDObj) //////////////////////////////////////////////////////////////////////////// -BOOL CGamDoc::IsPlayingLastHistory() +BOOL CGamDoc::IsPlayingLastHistory() const { return IsPlayingHistory() && m_nCurHist == m_pHistTbl->GetNumHistRecords() - 1; @@ -312,7 +315,7 @@ void CGamDoc::EventShowBoardNotification(BoardID nBrdSerNum, CPoint pntTipLoc, c { if (IsQuietPlayback()) return; - CPlayBoard* pPBoard = GetPBoardManager()->GetPBoardBySerial(nBrdSerNum); + CPlayBoard* pPBoard = GetPBoardManager().GetPBoardBySerial(nBrdSerNum); ASSERT(pPBoard); CPlayBoardView* pView; @@ -342,7 +345,7 @@ void CGamDoc::EventShowTrayNotification(size_t nTrayNum, PieceID pid, const CB:: { if (IsQuietPlayback()) return; - CTraySet& pYGrp = GetTrayManager()->GetTraySet(nTrayNum); + CTraySet& pYGrp = GetTrayManager().GetTraySet(nTrayNum); SelectTrayItem(pYGrp, pid, &strMsg); } @@ -392,7 +395,7 @@ BOOL CGamDoc::MsgSendDialogOpen(BOOL bShowDieRoller /* = FALSE */) } CSendMsgDlgPtr pDlg(new CSendMsgDialog(*this)); pDlg->m_bShowDieRoller = bShowDieRoller; - if (!pDlg->Create(IDD_SENDMESSAGE)) + if (!pDlg->Show()) { TRACE0("Failed to create Send Message Dialog\n"); return FALSE; @@ -441,14 +444,6 @@ void CGamDoc::MsgDialogCancel(BOOL bDiscardHistory /* = FALSE */) //////////////////////////////////////////////////////////////////////////// -void CGamDoc::MsgDialogForceDefer() -{ - if (m_pMsgDialog != NULL) - m_pMsgDialog->SendMessage(WM_COMMAND, MAKEWPARAM(uint16_t(IDC_D_SMSG_CLOSE), uint16_t(BN_CLICKED))); -} - -//////////////////////////////////////////////////////////////////////////// - void CGamDoc::MsgDialogClose(const CB::string& str) { m_strCurMsg = str; // Just save the current encoded message string diff --git a/GP/GamState.cpp b/GP/GamState.cpp index c03b813..5fbfb1e 100644 --- a/GP/GamState.cpp +++ b/GP/GamState.cpp @@ -1,6 +1,6 @@ // GamState.cpp // -// Copyright (c) 1994-2020 By Dale L. Larson, All Rights Reserved. +// Copyright (c) 1994-2025 By Dale L. Larson & William Su, All Rights Reserved. // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the @@ -54,13 +54,13 @@ BOOL CGameState::CompareState(const CGamDoc& doc) const // Compare the string tables // Compare the piece tables - if (!doc.GetPieceTable()->Compare(*m_pPTbl)) + if (!doc.GetPieceTable().Compare(*m_pPTbl)) return FALSE; // Compare the play boards - if (!doc.GetPBoardManager()->Compare(*m_pPBMgr)) + if (!doc.GetPBoardManager().Compare(*m_pPBMgr)) return FALSE; // Compare the trays - if (!doc.GetTrayManager()->Compare(m_pYMgr)) + if (!doc.GetTrayManager().Compare(m_pYMgr)) return FALSE; return TRUE; } @@ -71,11 +71,11 @@ BOOL CGameState::SaveState(CGamDoc& doc) TRY { m_mapString.Clone(doc.GetGameStringMap()); - OwnerPtr temp1 = doc.GetPBoardManager()->Clone(doc); + OwnerPtr temp1 = doc.GetPBoardManager().Clone(doc); OwnerOrNullPtr temp2 = std::move(temp1); m_pPBMgr = CB::get_underlying(std::move(temp2)).release(); - m_pYMgr = doc.GetTrayManager()->Clone(&doc); - m_pPTbl = doc.GetPieceTable()->Clone(); + m_pYMgr = doc.GetTrayManager().Clone(&doc); + m_pPTbl = doc.GetPieceTable().Clone(); } CATCH_ALL(e) { @@ -94,9 +94,9 @@ BOOL CGameState::RestoreState(CGamDoc& doc) const TRY { doc.GetGameStringMap().Clone(m_mapString); - doc.GetPBoardManager()->Restore(doc, *m_pPBMgr); - doc.GetTrayManager()->Restore(&doc, m_pYMgr); - doc.GetPieceTable()->Restore(*m_pPTbl); + doc.GetPBoardManager().Restore(doc, *m_pPBMgr); + doc.GetTrayManager().Restore(&doc, m_pYMgr); + doc.GetPieceTable().Restore(*m_pPTbl); } CATCH_ALL(e) { diff --git a/GP/Gp.cpp b/GP/Gp.cpp index 3acd21e..faf8cf5 100644 --- a/GP/Gp.cpp +++ b/GP/Gp.cpp @@ -1,6 +1,6 @@ // Gp.cpp : Defines the class behaviors for the application. // -// Copyright (c) 1994-2024 By Dale L. Larson & William Su, All Rights Reserved. +// Copyright (c) 1994-2025 By Dale L. Larson & William Su, All Rights Reserved. // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the @@ -141,6 +141,8 @@ class CGpApp::CwxGpApp : public wxMFCApp pMainFrame->UpdateWindow(); } + wxTheApp->SetTopWindow(&CB::GetMainWndWx()); + OnIdle(0); // Run idle so control bars are in sync prior to message boxes return TRUE; @@ -166,6 +168,10 @@ namespace { virtual bool OnInit() override { // handling cmd line w/ MFC, so skip wxCmdLineParser + + wxXmlResource::Get()->InitAllHandlers(); + wxCHECK(wxXmlResource::Get()->LoadFile(wxStandardPaths::Get().GetDataDir() + "/CBPlay.xrc"), false); + return true; } }; @@ -640,3 +646,12 @@ void CGpApp::OnHelpReleases() ShellExecute(NULL, "open"_cbstring, strUrl, NULL, NULL, SW_SHOWNORMAL); } +wxWindow* CB::pGetMainWndWx() +{ + return *dynamic_cast(AfxGetMainWnd()); +} + +CB::string CB::GetAppName() +{ + return AfxGetAppName(); +} diff --git a/GP/LBoxSlct.cpp b/GP/LBoxSlct.cpp index fe3ac12..d03e283 100644 --- a/GP/LBoxSlct.cpp +++ b/GP/LBoxSlct.cpp @@ -1,6 +1,6 @@ // LBoxSlct.cpp // -// Copyright (c) 1994-2023 By Dale L. Larson & William Su, All Rights Reserved. +// Copyright (c) 1994-2025 By Dale L. Larson & William Su, All Rights Reserved. // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the @@ -326,7 +326,7 @@ GameElement CSelectListBox::OnGetHitItemCodeAtPoint(GetGameElementCodeForObject_ if (pObj.GetType() == CDrawObj::drawPieceObj) { const CPieceObj& pieceObj = static_cast(pObj); - CPieceTable& pieceTbl = CheckedDeref(m_pDoc->GetPieceTable()); + CPieceTable& pieceTbl = m_pDoc->GetPieceTable(); uint8_t side = pieceTbl.GetSide(pieceObj.m_pid, i); return (m_pDoc->*func)(pieceObj, side); } @@ -356,7 +356,7 @@ BOOL CSelectListBox::OnDoesItemHaveTipText(size_t nItem) const if (pDObj.GetType() == CDrawObj::drawPieceObj) { const CPieceObj& pObj = static_cast(pDObj); - CPieceTable& pieceTbl = CheckedDeref(m_pDoc->GetPieceTable()); + CPieceTable& pieceTbl = m_pDoc->GetPieceTable(); size_t sides = pieceTbl.GetSides(pObj.m_pid); for (size_t i = size_t(0); i < sides; ++i) { @@ -424,16 +424,15 @@ std::vector CSelectListBox::GetTileIDs(size_t nIndex) const if (pDObj.GetType() == CDrawObj::drawPieceObj) { - CPieceTable* pPTbl = m_pDoc->GetPieceTable(); - ASSERT(pPTbl != NULL); + CPieceTable& pPTbl = m_pDoc->GetPieceTable(); PieceID pid = static_cast(pDObj).m_pid; - if (!m_pDoc->IsScenario() && pPTbl->IsPieceOwned(pid) && - !pPTbl->IsPieceOwnedBy(pid, m_pDoc->GetCurrentPlayerMask())) + if (!m_pDoc->IsScenario() && pPTbl.IsPieceOwned(pid) && + !pPTbl.IsPieceOwnedBy(pid, m_pDoc->GetCurrentPlayerMask())) { std::vector retval; - retval.push_back(pPTbl->GetFrontTileID(pid)); + retval.push_back(pPTbl.GetFrontTileID(pid)); return retval; } @@ -441,16 +440,16 @@ std::vector CSelectListBox::GetTileIDs(size_t nIndex) const std::vector retval; if ((pPce.m_flags & PieceDef::flagShowOnlyVisibleSide) && - (!pPTbl->IsPieceOwnedBy(pid, m_pDoc->GetCurrentPlayerMask()) || + (!pPTbl.IsPieceOwnedBy(pid, m_pDoc->GetCurrentPlayerMask()) || pPce.m_flags & PieceDef::flagShowOnlyOwnersToo)) { - retval.push_back(pPTbl->GetActiveTileID(pid)); + retval.push_back(pPTbl.GetActiveTileID(pid)); } else { - retval.reserve(pPTbl->GetSides(pid)); - retval.push_back(pPTbl->GetActiveTileID(pid)); - std::vector inactives = pPTbl->GetInactiveTileIDs(pid); + retval.reserve(pPTbl.GetSides(pid)); + retval.push_back(pPTbl.GetActiveTileID(pid)); + std::vector inactives = pPTbl.GetInactiveTileIDs(pid); retval.insert(retval.end(), inactives.begin(), inactives.end()); } return retval; diff --git a/GP/LBoxSlct.h b/GP/LBoxSlct.h index e1f3949..07ce987 100644 --- a/GP/LBoxSlct.h +++ b/GP/LBoxSlct.h @@ -82,7 +82,7 @@ class CSelectListBox : public CTileBaseListBox2 virtual BOOL OnIsToolTipsEnabled() const override; virtual GameElement OnGetHitItemCodeAtPoint(CPoint point, CRect& rct) const override; private: - typedef GameElement (CGamDoc::*GetGameElementCodeForObject_t)(const CDrawObj& pDObj, size_t nSide); + typedef GameElement (CGamDoc::*GetGameElementCodeForObject_t)(const CDrawObj& pDObj, size_t nSide) const; GameElement OnGetHitItemCodeAtPoint(GetGameElementCodeForObject_t func, CPoint point, CRect& rct) const; public: virtual void OnGetTipTextForItemCode(GameElement nItemCode, CB::string& strTip) const override; diff --git a/GP/LBoxTray.cpp b/GP/LBoxTray.cpp index 4f82632..9ba9c8b 100644 --- a/GP/LBoxTray.cpp +++ b/GP/LBoxTray.cpp @@ -1,6 +1,6 @@ // LBoxTray.cpp // -// Copyright (c) 1994-2020 By Dale L. Larson, All Rights Reserved. +// Copyright (c) 1994-2025 By Dale L. Larson & William Su, All Rights Reserved. // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the @@ -95,12 +95,11 @@ GameElement CTrayListBox::OnGetHitItemCodeAtPoint(CPoint point, CRect& rct) cons ASSERT(m_eTrayViz == trayVizAllSides || m_eTrayViz == trayVizOneSide); - const CPieceTable* pPTbl = m_pDoc.GetPieceTable(); - ASSERT(pPTbl != NULL); + const CPieceTable& pPTbl = m_pDoc.GetPieceTable(); PieceID nPid = MapIndexToItem(nIndex); - TileID tidLeft = pPTbl->GetActiveTileID(nPid); + TileID tidLeft = pPTbl.GetActiveTileID(nPid); ASSERT(tidLeft != nullTid); // Should exist std::vector tids; @@ -108,7 +107,7 @@ GameElement CTrayListBox::OnGetHitItemCodeAtPoint(CPoint point, CRect& rct) cons if (IsShowAllSides(nPid)) { - std::vector inactives = pPTbl->GetInactiveTileIDs(nPid); + std::vector inactives = pPTbl.GetInactiveTileIDs(nPid); tids.insert(tids.end(), inactives.begin(), inactives.end()); } @@ -120,7 +119,7 @@ GameElement CTrayListBox::OnGetHitItemCodeAtPoint(CPoint point, CRect& rct) cons if (!rects[i].IsRectEmpty() && rects[i].PtInRect(point)) { rct = ItemToClient(rects[i]); - const CPieceTable& pieceTbl = CheckedDeref(m_pDoc.GetPieceTable()); + const CPieceTable& pieceTbl = m_pDoc.GetPieceTable(); uint8_t side = pieceTbl.GetSide(nPid, i); return GameElement(nPid, side); } @@ -146,12 +145,12 @@ BOOL CTrayListBox::OnDoesItemHaveTipText(size_t nItem) const PieceID pid = MapIndexToItem(nItem); if (m_eTrayViz != trayVizAllSides) { - uint8_t side = m_pDoc.GetPieceTable()->GetSide(pid); + uint8_t side = m_pDoc.GetPieceTable().GetSide(pid); return m_pDoc.HasGameElementString(MakePieceElement(pid, side)); } else { - size_t sides = m_pDoc.GetPieceTable()->GetSides(pid); + size_t sides = m_pDoc.GetPieceTable().GetSides(pid); for (unsigned i = unsigned(0) ; i < sides ; ++i) { if (m_pDoc.HasGameElementString(MakePieceElement(pid, i))) @@ -267,29 +266,28 @@ void CTrayListBox::OnItemDraw(CDC& pDC, size_t nIndex, UINT nAction, UINT nState std::vector CTrayListBox::GetPieceTileIDs(size_t nIndex) const { - const CPieceTable* pPTbl = m_pDoc.GetPieceTable(); - ASSERT(pPTbl != NULL); + const CPieceTable& pPTbl = m_pDoc.GetPieceTable(); PieceID pid = MapIndexToItem(nIndex); std::vector retval; if (!m_pDoc.IsScenario() && - m_pDoc.HasPlayers() && pPTbl->IsPieceOwned(pid) && - !pPTbl->IsPieceOwnedBy(pid, m_pDoc.GetCurrentPlayerMask())) + m_pDoc.HasPlayers() && pPTbl.IsPieceOwned(pid) && + !pPTbl.IsPieceOwnedBy(pid, m_pDoc.GetCurrentPlayerMask())) { // Piece is owned but not by the current player. Only show the // top image. - retval.push_back(pPTbl->GetFrontTileID(pid)); + retval.push_back(pPTbl.GetFrontTileID(pid)); } else { - retval.push_back(pPTbl->GetActiveTileID(pid)); + retval.push_back(pPTbl.GetActiveTileID(pid)); ASSERT(retval.front() != nullTid); if (IsShowAllSides(pid)) { - std::vector inactives = pPTbl->GetInactiveTileIDs(pid); + std::vector inactives = pPTbl.GetInactiveTileIDs(pid); retval.insert(retval.end(), inactives.begin(), inactives.end()); } } @@ -327,7 +325,7 @@ BOOL CTrayListBox::OnDragSetup(DragInfo& pDI) const bool CTrayListBox::IsShowAllSides(PieceID pid) const { - const CPieceTable& pPTbl = CheckedDeref(m_pDoc.GetPieceTable()); + const CPieceTable& pPTbl = m_pDoc.GetPieceTable(); const PieceDef& pPce = m_pDoc.GetPieceManager().GetPiece(pid); BOOL bIsOwnedByCurrentPlayer = m_pDoc.HasPlayers() && @@ -347,3 +345,326 @@ bool CTrayListBox::IsShowAllSides(PieceID pid) const } +// KLUDGE: macro parser can't handle the , in the template args +namespace { + typedef CGrafixListBoxDataWx CTrayListBoxWxBase; +} +wxIMPLEMENT_DYNAMIC_CLASS(CTrayListBoxWx, CTrayListBoxWxBase); + +///////////////////////////////////////////////////////////////////////////// + +CTrayListBoxWx::CTrayListBoxWx() : + m_pDoc(nullptr) +{ + m_eTrayViz = trayVizOneSide; + m_bAllowTips = TRUE; +} + +CTrayListBoxWx::CTrayListBoxWx(CGamDoc& pDoc) : + CTrayListBoxWx() +{ + Init(pDoc); + CGrafixListBoxDataWx::SetDocument(pDoc); +} + +///////////////////////////////////////////////////////////////////////////// + +const CTileManager& CTrayListBoxWx::GetTileManager() const +{ + return m_pDoc->GetTileManager(); +} + +#if 0 +BOOL CTrayListBox::IsShowingTileImages() const +{ + return m_eTrayViz == trayVizAllSides || m_eTrayViz == trayVizOneSide; +} +#endif + +void CTrayListBoxWx::SetTrayContentVisibility(TrayViz eTrayViz, CB::string pszHiddenString) +{ + m_eTrayViz = eTrayViz; + m_strHiddenString = std::move(pszHiddenString); +} + +///////////////////////////////////////////////////////////////////////////// +// Tool tip processing + +BOOL CTrayListBoxWx::OnIsToolTipsEnabled() const +{ + if (m_eTrayViz != trayVizAllSides && m_eTrayViz != trayVizOneSide) + return FALSE; + return m_pDoc->IsShowingObjectTips() && m_bAllowTips; +} + +GameElement CTrayListBoxWx::OnGetHitItemCodeAtPoint(wxPoint point, wxRect& rct) const +{ + point = ClientToItem(point); + + int nIndex = VirtualHitTest(point.y); + if (nIndex == wxNOT_FOUND) + { + return Invalid_v; + } + + wxASSERT(m_eTrayViz == trayVizAllSides || m_eTrayViz == trayVizOneSide); + + const CPieceTable& pPTbl = m_pDoc->GetPieceTable(); + + PieceID nPid = MapIndexToItem(value_preserving_cast(nIndex)); + + TileID tidLeft = pPTbl.GetActiveTileID(nPid); + wxASSERT(tidLeft != nullTid); // Should exist + + std::vector tids; + tids.push_back(tidLeft); // Initially assume no second tile image + + if (IsShowAllSides(nPid)) + { + std::vector inactives = pPTbl.GetInactiveTileIDs(nPid); + tids.insert(tids.end(), inactives.begin(), inactives.end()); + } + + std::vector rects = GetTileRectsForItem(value_preserving_cast(nIndex), tids); + + for (size_t i = size_t(0) ; i < rects.size() ; ++i) + { + wxASSERT(!rects[i].IsEmpty()); + if (!rects[i].IsEmpty() && rects[i].Contains(point)) + { + rct = ItemToClient(rects[i]); + const CPieceTable& pieceTbl = m_pDoc->GetPieceTable(); + uint8_t side = pieceTbl.GetSide(nPid, i); + return GameElement(nPid, side); + } + } + + return Invalid_v; +} + +void CTrayListBoxWx::OnGetTipTextForItemCode(GameElement nItemCode, + CB::string& strTip) const +{ + if (nItemCode == Invalid_v) + return; + strTip = m_pDoc->GetGameElementString(nItemCode); +} + +///////////////////////////////////////////////////////////////////////////// + +BOOL CTrayListBoxWx::OnDoesItemHaveTipText(size_t nItem) const +{ + wxASSERT(m_eTrayViz == trayVizAllSides || m_eTrayViz == trayVizOneSide); + + PieceID pid = MapIndexToItem(nItem); + if (m_eTrayViz != trayVizAllSides) + { + wxASSERT(!"untested code"); + uint8_t side = m_pDoc->GetPieceTable().GetSide(pid); + return m_pDoc->HasGameElementString(MakePieceElement(pid, side)); + } + else + { + size_t sides = m_pDoc->GetPieceTable().GetSides(pid); + for (unsigned i = unsigned(0) ; i < sides ; ++i) + { + if (m_pDoc->HasGameElementString(MakePieceElement(pid, i))) + { + wxASSERT(!"untested code"); + return true; + } + } + return false; + } +} + +///////////////////////////////////////////////////////////////////////////// + +#if 0 +void CTrayListBox::DeselectAll() +{ + ASSERT(IsMultiSelect()); + if (GetCount() < 1) + return; + SelItemRange(FALSE, 0, GetCount()-1); +} + +size_t CTrayListBox::SelectTrayPiece(PieceID pid) +{ + size_t nIndex = MapItemToIndex(pid); + if (nIndex != Invalid_v) + { + ShowListIndex(value_preserving_cast(nIndex)); + SetSel(value_preserving_cast(nIndex), TRUE); + } + else + { + if (GetCount() > 0) + SetSel(0, TRUE); + } + return nIndex; +} + +///////////////////////////////////////////////////////////////////////////// + +void CTrayListBox::ShowListIndex(int nPos) +{ + if (nPos < GetTopIndex()) + { + SetTopIndex(nPos); + return; + } + CRect rct; + GetItemRect(nPos, &rct); + CRect rctClient; + GetClientRect(&rctClient); + if (rct.IntersectRect(&rct, &rctClient)) + return; + + SetTopIndex(nPos); +} +#endif + +///////////////////////////////////////////////////////////////////////////// + +wxSize CTrayListBoxWx::GetItemSize(size_t nIndex) const +{ + if (m_eTrayViz == trayVizAllSides || m_eTrayViz == trayVizOneSide) + { + std::vector tids = GetPieceTileIDs(value_preserving_cast(nIndex)); + return DoOnItemSize(nIndex, tids); + } + else + { + // Hidden pieces. Draw the supplied text. + wxASSERT(!m_strHiddenString.empty()); + /* KLUDGE: wxInfoDC should not modify wxWindow, + so const_cast<> should be safe */ + wxInfoDC pDC(const_cast(this)); + pDC.SetFont(g_res.h8ssWx); + wxSize extent = pDC.GetTextExtent(m_strHiddenString); + return extent; + } +} + +void CTrayListBoxWx::OnDrawItem(wxDC& pDC, const wxRect& rctItem, size_t nIndex) const +{ + if (m_eTrayViz == trayVizAllSides || m_eTrayViz == trayVizOneSide) + { + std::vector tids = GetPieceTileIDs(value_preserving_cast(nIndex)); + DoOnDrawItem(pDC, nIndex, rctItem, tids); + } + else + { + // Hidden pieces. Draw the supplied text. +#if 0 + pDC.SetTextAlign(TA_TOP | TA_LEFT); + CBrush brBack(GetSysColor(nState & ODS_SELECTED ? + COLOR_HIGHLIGHT : COLOR_WINDOW)); + pDC.FillRect(&rctItem, &brBack); // Fill background color + pDC.SetBkMode(TRANSPARENT); + CFont* pPrvFont = pDC.SelectObject(CFont::FromHandle(g_res.h8ss)); + pDC.SetTextColor(GetSysColor(nState & ODS_SELECTED ? + COLOR_HIGHLIGHTTEXT : COLOR_WINDOWTEXT)); + pDC.TextOut(rctItem.left, rctItem.top, m_strHiddenString); + pDC.SelectObject(pPrvFont); +#else + wxASSERT(!"needs testing"); + // TODO: is bkg automatic? + pDC.SetBackgroundMode(wxBRUSHSTYLE_TRANSPARENT); + pDC.SetFont(g_res.h8ssWx); + pDC.SetTextForeground(wxSystemSettings::GetColour(IsSelected(nIndex) ? + wxSYS_COLOUR_HIGHLIGHTTEXT : wxSYS_COLOUR_WINDOWTEXT)); + pDC.DrawLabel(m_strHiddenString, rctItem, wxALIGN_TOP | wxALIGN_LEFT); +#endif +#if 0 + if (nAction & ODA_FOCUS) + pDC.DrawFocusRect(&rctItem); +#else + // wx automatically draws focus rect +#endif + } +} + +std::vector CTrayListBoxWx::GetPieceTileIDs(size_t nIndex) const +{ + const CPieceTable& pPTbl = m_pDoc->GetPieceTable(); + + PieceID pid = MapIndexToItem(nIndex); + + std::vector retval; + + if (!m_pDoc->IsScenario() && + m_pDoc->HasPlayers() && pPTbl.IsPieceOwned(pid) && + !pPTbl.IsPieceOwnedBy(pid, m_pDoc->GetCurrentPlayerMask())) + { + // Piece is owned but not by the current player. Only show the + // top image. + retval.push_back(pPTbl.GetFrontTileID(pid)); + } + else + { + retval.push_back(pPTbl.GetActiveTileID(pid)); + wxASSERT(retval.front() != nullTid); + + if (IsShowAllSides(pid)) + { + std::vector inactives = pPTbl.GetInactiveTileIDs(pid); + retval.insert(retval.end(), inactives.begin(), inactives.end()); + } + } + + return retval; +} + +BOOL CTrayListBoxWx::OnDragSetup(DragInfoWx& pDI) const +{ + wxASSERT(!"needs testing"); + if (m_pDoc->IsPlaying()) + { + pDI.SetDragType(DRAG_INVALID); + return FALSE; // Drags not supported during play + } + + if (IsMultiSelect()) + { + pDI.SetDragType(DRAG_PIECELIST); + pDI.GetSubInfo().m_pieceIDList = &GetMappedMultiSelectList(); + pDI.GetSubInfo().m_size = GetDragSize(); + pDI.GetSubInfo().m_gamDoc = m_pDoc; + pDI.m_hcsrSuggest = g_res.hcrDragTileWx; + } + else + { + ASSERT(!"untested code"); + pDI.SetDragType(DRAG_PIECE); + pDI.GetSubInfo().m_pieceID = GetCurMapItem(); + pDI.GetSubInfo().m_size = GetDragSize(); + pDI.GetSubInfo().m_gamDoc = m_pDoc; + pDI.m_hcsrSuggest = g_res.hcrDragTileWx; + } + return TRUE; +} + +bool CTrayListBoxWx::IsShowAllSides(PieceID pid) const +{ + const CPieceTable& pPTbl = m_pDoc->GetPieceTable(); + const PieceDef& pPce = m_pDoc->GetPieceManager().GetPiece(pid); + + BOOL bIsOwnedByCurrentPlayer = m_pDoc->HasPlayers() && + pPTbl.IsPieceOwnedBy(pid, m_pDoc->GetCurrentPlayerMask()); + + // If showing all sides, only show it if the piece allows it + // or if the current players is the owner, or if the + // program is in scenario mode. + if (m_eTrayViz == trayVizAllSides && (bIsOwnedByCurrentPlayer && + !(pPce.m_flags & PieceDef::flagShowOnlyOwnersToo) || + !(pPce.m_flags & PieceDef::flagShowOnlyVisibleSide)) || + m_pDoc->IsScenario()) + { + return true; + } + return false; +} + + diff --git a/GP/LBoxTray.h b/GP/LBoxTray.h index 1406981..245cde1 100644 --- a/GP/LBoxTray.h +++ b/GP/LBoxTray.h @@ -1,6 +1,6 @@ // LBoxTray.cpp // -// Copyright (c) 1994-2020 By Dale L. Larson, All Rights Reserved. +// Copyright (c) 1994-2025 By Dale L. Larson & William Su, All Rights Reserved. // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the @@ -106,5 +106,66 @@ class CTrayListBox : public CGrafixListBoxData bool IsShowAllSides(PieceID pid) const; }; +class CTrayListBoxWx : public CGrafixListBoxDataWx +{ +// Construction +public: + CTrayListBoxWx(); + CTrayListBoxWx(CGamDoc& pDoc); + void Init(const CGamDoc& pDoc) { wxASSERT(!m_pDoc); m_pDoc = &pDoc; } + +// Attributes +public: + virtual const CTileManager& GetTileManager() const override; + + TrayViz GetTrayContentVisibility() const { return m_eTrayViz; } + + BOOL IsShowingTileImages() const; + +// Operations +public: + void DeselectAll(); + size_t SelectTrayPiece(PieceID pid); + void ShowListIndex(int nPos); + + void SetTrayContentVisibility(TrayViz eTrayViz, CB::string pszHiddenString = CB::string()); + void SetTipsAllowed(BOOL bTipsAllowed) + { + m_bAllowTips = bTipsAllowed; + SetTipMarkVisibility(m_bAllowTips); + } + +// Implementation +protected: + // retval[0] is active face + std::vector GetPieceTileIDs(size_t nIndex) const; + +// Implementation +protected: + const CGamDoc* m_pDoc; + + TrayViz m_eTrayViz; + CB::string m_strHiddenString; + BOOL m_bAllowTips; + + // Overrides + wxSize GetItemSize(size_t nIndex) const override; + void OnDrawItem(wxDC& pDC, const wxRect& rctItem, size_t nIndex) const override; + BOOL OnDragSetup(DragInfoWx& pDI) const override; + + // Tool tip processing + BOOL OnIsToolTipsEnabled() const override; + GameElement OnGetHitItemCodeAtPoint(wxPoint point, wxRect& rct) const override; + void OnGetTipTextForItemCode(GameElement nItemCode, CB::string& strTip) const override; + BOOL OnDoesItemHaveTipText(size_t nItem) const override; + + // Misc + + wxDECLARE_DYNAMIC_CLASS(CTrayListBoxWx); + +private: + bool IsShowAllSides(PieceID pid) const; +}; + #endif diff --git a/GP/MoveMgr.cpp b/GP/MoveMgr.cpp index d918b3f..8039f24 100644 --- a/GP/MoveMgr.cpp +++ b/GP/MoveMgr.cpp @@ -1,6 +1,6 @@ // MoveMgr.cpp // -// Copyright (c) 1994-2023 By Dale L. Larson & William Su, All Rights Reserved. +// Copyright (c) 1994-2025 By Dale L. Larson & William Su, All Rights Reserved. // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the @@ -91,7 +91,7 @@ void CMoveRecord::SerializeHiddenByPrivate(CGamDoc& /*doc*/, bool CMoveRecord::IsPrivateBoard(CGamDoc& pDoc, BoardID bid) { - CPlayBoard& pbrd = CheckedDeref(pDoc.GetPBoardManager()-> + CPlayBoard& pbrd = CheckedDeref(pDoc.GetPBoardManager(). GetPBoardBySerial(bid)); return IsPrivateBoard(pDoc, pbrd); } @@ -119,12 +119,12 @@ CBoardPieceMove::CBoardPieceMove(BoardID nBrdSerNum, PieceID pid, CPoint pnt, BOOL CBoardPieceMove::ValidatePieces(const CGamDoc& pDoc) const { #ifdef _DEBUG - BOOL bUsed = pDoc.GetPieceTable()->IsPieceUsed(m_pid); + BOOL bUsed = pDoc.GetPieceTable().IsPieceUsed(m_pid); if (!bUsed) TRACE1("CBoardPieceMove::ValidatePieces - Piece %u not in piece table.\n", value_preserving_cast(static_cast(m_pid))); return bUsed; #else - return pDoc.GetPieceTable()->IsPieceUsed(m_pid); + return pDoc.GetPieceTable().IsPieceUsed(m_pid); #endif } @@ -139,7 +139,7 @@ void CBoardPieceMove::DoMoveSetup(CGamDoc& pDoc, int nMoveWithinGroup) const CRect rct = pObj->GetRect(); CPoint ptCtr = GetMidRect(rct); pDoc.EnsureBoardLocationVisible(*pPBoard, ptCtr); - CPlayBoard& pPBrdDest = CheckedDeref(pDoc.GetPBoardManager()-> + CPlayBoard& pPBrdDest = CheckedDeref(pDoc.GetPBoardManager(). GetPBoardBySerial(m_nBrdNum)); pDoc.IndicateBoardToBoardPieceMove(CheckedDeref(pPBoard), pPBrdDest, ptCtr, m_ptCtr, pObj->GetRect().Size()); @@ -154,7 +154,7 @@ void CBoardPieceMove::DoMove(CGamDoc& pDoc, int nMoveWithinGroup) const CTraySet* pTrayFrom; CPieceObj* pObj; - CPlayBoard& pPBrdDest = CheckedDeref(pDoc.GetPBoardManager()-> + CPlayBoard& pPBrdDest = CheckedDeref(pDoc.GetPBoardManager(). GetPBoardBySerial(m_nBrdNum)); pDoc.EnsureBoardLocationVisible(pPBrdDest, m_ptCtr); @@ -281,12 +281,12 @@ CTrayPieceMove::CTrayPieceMove(size_t nTrayNum, PieceID pid, size_t nPos) BOOL CTrayPieceMove::ValidatePieces(const CGamDoc& pDoc) const { #ifdef _DEBUG - BOOL bUsed = pDoc.GetPieceTable()->IsPieceUsed(m_pid); + BOOL bUsed = pDoc.GetPieceTable().IsPieceUsed(m_pid); if (!bUsed) TRACE1("CTrayPieceMove::ValidatePieces - Piece %u not in piece table.\n", value_preserving_cast(static_cast(m_pid))); return bUsed; #else - return pDoc.GetPieceTable()->IsPieceUsed(m_pid); + return pDoc.GetPieceTable().IsPieceUsed(m_pid); #endif } @@ -309,13 +309,13 @@ void CTrayPieceMove::DoMoveSetup(CGamDoc& pDoc, int nMoveWithinGroup) const void CTrayPieceMove::DoMove(CGamDoc& pDoc, int nMoveWithinGroup) const { - CTraySet& pYGrp = pDoc.GetTrayManager()->GetTraySet(m_nTrayNum); + CTraySet& pYGrp = pDoc.GetTrayManager().GetTraySet(m_nTrayNum); pDoc.PlacePieceInTray(m_pid, pYGrp, m_nPos); } void CTrayPieceMove::DoMoveCleanup(CGamDoc& pDoc, int nMoveWithinGroup) const { - CTraySet& pYGrp = pDoc.GetTrayManager()->GetTraySet(m_nTrayNum); + CTraySet& pYGrp = pDoc.GetTrayManager().GetTraySet(m_nTrayNum); pDoc.SelectTrayItem(pYGrp, m_pid); } @@ -370,12 +370,12 @@ void CTrayPieceMove::DumpToTextFile(const CGamDoc& /*pDoc*/, CFile& file) const BOOL CPieceSetSide::ValidatePieces(const CGamDoc& pDoc) const { #ifdef _DEBUG - BOOL bUsed = pDoc.GetPieceTable()->IsPieceUsed(m_pid); + BOOL bUsed = pDoc.GetPieceTable().IsPieceUsed(m_pid); if (!bUsed) TRACE1("CPieceSetSide::ValidatePieces - Piece %u not in piece table.\n", value_preserving_cast(static_cast(m_pid))); return bUsed; #else - return pDoc.GetPieceTable()->IsPieceUsed(m_pid); + return pDoc.GetPieceTable().IsPieceUsed(m_pid); #endif } @@ -396,7 +396,7 @@ BOOL CPieceSetSide::IsMoveHidden(const CGamDoc& pDoc, const CTraySet* pTray; const CPieceObj* pObj; - if (pDoc.GetPieceTable()->IsOwnedButNotByCurrentPlayer(m_pid, pDoc)) + if (pDoc.GetPieceTable().IsOwnedButNotByCurrentPlayer(m_pid, pDoc)) return TRUE; if (pDoc.FindPieceCurrentLocation(m_pid, pTray, pPBoard, pObj)) @@ -555,7 +555,7 @@ void CPieceSetSide::DumpToTextFile(const CGamDoc& pDoc, CFile& file) const } }(m_flip), [](const CGamDoc& pDoc, PieceID pid, size_t side) { - if (pDoc.GetPieceTable()->GetSides(pid) <= size_t(2)) + if (pDoc.GetPieceTable().GetSides(pid) <= size_t(2)) { return side == size_t(0) ? "front"_cbstring : "back"_cbstring; } @@ -574,12 +574,12 @@ void CPieceSetSide::DumpToTextFile(const CGamDoc& pDoc, CFile& file) const BOOL CPieceSetFacing::ValidatePieces(const CGamDoc& pDoc) const { #ifdef _DEBUG - BOOL bUsed = pDoc.GetPieceTable()->IsPieceUsed(m_pid); + BOOL bUsed = pDoc.GetPieceTable().IsPieceUsed(m_pid); if (!bUsed) TRACE1("CPieceSetFacing::ValidatePieces - Piece %u not in piece table.\n", value_preserving_cast(static_cast(m_pid))); return bUsed; #else - return pDoc.GetPieceTable()->IsPieceUsed(m_pid); + return pDoc.GetPieceTable().IsPieceUsed(m_pid); #endif } @@ -679,12 +679,12 @@ void CPieceSetFacing::DumpToTextFile(const CGamDoc& /*pDoc*/, CFile& file) const BOOL CPieceSetOwnership::ValidatePieces(const CGamDoc& pDoc) const { #ifdef _DEBUG - BOOL bUsed = pDoc.GetPieceTable()->IsPieceUsed(m_pid); + BOOL bUsed = pDoc.GetPieceTable().IsPieceUsed(m_pid); if (!bUsed) TRACE1("CPieceSetOwnership::ValidatePieces - Piece %u not in piece table.\n", value_preserving_cast(static_cast(m_pid))); return bUsed; #else - return pDoc.GetPieceTable()->IsPieceUsed(m_pid); + return pDoc.GetPieceTable().IsPieceUsed(m_pid); #endif } @@ -734,12 +734,12 @@ void CPieceSetOwnership::Serialize(CArchive& ar) } else { - WORD wTmp; + uint16_t wTmp; ar >> m_pid; if (CGamDoc::GetLoadingVersion() < NumVersion(3, 10)) { ar >> wTmp; - m_dwOwnerMask = UPGRADE_OWNER_MASK(wTmp); + m_dwOwnerMask = PlayerMask(UPGRADE_OWNER_MASK(wTmp)); } else ar >> m_dwOwnerMask; @@ -901,7 +901,7 @@ void CBoardMarkerMove::DoMoveSetup(CGamDoc& pDoc, int nMoveWithinGroup) const CRect rct = pObj->GetRect(); CPoint ptCtr = GetMidRect(rct); pDoc.EnsureBoardLocationVisible(*pPBoard, ptCtr); - CPlayBoard& pPBrdDest = CheckedDeref(pDoc.GetPBoardManager()-> + CPlayBoard& pPBrdDest = CheckedDeref(pDoc.GetPBoardManager(). GetPBoardBySerial(m_nBrdNum)); pDoc.IndicateBoardToBoardPieceMove(*pPBoard, pPBrdDest, ptCtr, m_ptCtr, pObj->GetRect().Size()); @@ -912,7 +912,7 @@ void CBoardMarkerMove::DoMoveSetup(CGamDoc& pDoc, int nMoveWithinGroup) const void CBoardMarkerMove::DoMove(CGamDoc& pDoc, int nMoveWithinGroup) const { - CPlayBoard& pPBrdDest = CheckedDeref(pDoc.GetPBoardManager()-> + CPlayBoard& pPBrdDest = CheckedDeref(pDoc.GetPBoardManager(). GetPBoardBySerial(m_nBrdNum)); pDoc.EnsureBoardLocationVisible(pPBrdDest, m_ptCtr); @@ -1107,7 +1107,7 @@ BOOL CObjectSetText::IsMoveHidden(const CGamDoc& pDoc, if (IsGameElementAPiece(m_elem)) { PieceID pid = GetPieceIDFromElement(m_elem); - if (pDoc.GetPieceTable()->IsOwnedButNotByCurrentPlayer(pid, pDoc)) + if (pDoc.GetPieceTable().IsOwnedButNotByCurrentPlayer(pid, pDoc)) return TRUE; pDoc.FindPieceCurrentLocation(pid, pTray, pPBoard, pPObj); @@ -1247,7 +1247,7 @@ BOOL CObjectLockdown::IsMoveHidden(const CGamDoc& pDoc, if (IsGameElementAPiece(m_elem)) { PieceID pid = GetPieceIDFromElement(m_elem); - if (pDoc.GetPieceTable()->IsOwnedButNotByCurrentPlayer(pid, pDoc)) + if (pDoc.GetPieceTable().IsOwnedButNotByCurrentPlayer(pid, pDoc)) return TRUE; pPBoard = pDoc.FindPieceOnBoard(GetPieceIDFromElement(m_elem), pPObj); pObj = pPObj; @@ -1437,7 +1437,7 @@ void CMovePlotList::SavePlotList(const CDrawList& pDwg) void CMovePlotList::DoMoveSetup(CGamDoc& pDoc, int nMoveWithinGroup) const { - CPlayBoard& pPBrd = CheckedDeref(pDoc.GetPBoardManager()->GetPBoardBySerial(m_nBrdNum)); + CPlayBoard& pPBrd = CheckedDeref(pDoc.GetPBoardManager().GetPBoardBySerial(m_nBrdNum)); pPBrd.SetPlotMoveMode(TRUE); for (int i = 0; i < m_tblPlot.GetSize(); i += 2) { @@ -1449,7 +1449,7 @@ void CMovePlotList::DoMoveSetup(CGamDoc& pDoc, int nMoveWithinGroup) const void CMovePlotList::DoMoveCleanup(CGamDoc& pDoc, int nMoveWithinGroup) const { - CPlayBoard& pPBrd = CheckedDeref(pDoc.GetPBoardManager()->GetPBoardBySerial(m_nBrdNum)); + CPlayBoard& pPBrd = CheckedDeref(pDoc.GetPBoardManager().GetPBoardBySerial(m_nBrdNum)); pPBrd.SetPlotMoveMode(FALSE); } diff --git a/GP/MoveMgr.h b/GP/MoveMgr.h index 6f3ffe1..f790405 100644 --- a/GP/MoveMgr.h +++ b/GP/MoveMgr.h @@ -229,7 +229,7 @@ class CPieceSetOwnership : public CMoveRecord { public: CPieceSetOwnership() { m_eType = mrecPOwner; } - CPieceSetOwnership(PieceID pid, DWORD dwOwnerMask) + CPieceSetOwnership(PieceID pid, PlayerMask dwOwnerMask) { m_eType = mrecPOwner; m_pid = pid; m_dwOwnerMask = dwOwnerMask; } virtual void DoMove(CGamDoc& pDoc, int nMoveWithinGroup) const override; @@ -247,7 +247,7 @@ class CPieceSetOwnership : public CMoveRecord #endif protected: PieceID m_pid; - DWORD m_dwOwnerMask; + PlayerMask m_dwOwnerMask; }; /////////////////////////////////////////////////////////////////////// diff --git a/GP/PBoard.cpp b/GP/PBoard.cpp index a546508..6ef2f59 100644 --- a/GP/PBoard.cpp +++ b/GP/PBoard.cpp @@ -1,6 +1,6 @@ // PBoard.cpp // -// Copyright (c) 1994-2024 By Dale L. Larson & William Su, All Rights Reserved. +// Copyright (c) 1994-2025 By Dale L. Larson & William Su, All Rights Reserved. // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the @@ -90,7 +90,7 @@ CPlayBoard::CPlayBoard(CGamDoc& doc) : m_bEnforceLocks = TRUE; m_bNonOwnerAccess = FALSE; // Owned stuff can't be messed with - m_dwOwnerMask = 0; // No player owns it + m_dwOwnerMask = OWNER_MASK_SPECTATOR; // No player owns it m_bPrivate = false; @@ -147,13 +147,12 @@ void CPlayBoard::Draw(CDC& pDC, const CRect& pDrawRct, TileScale eScale) CPieceObj& CPlayBoard::AddPiece(CPoint pnt, PieceID pid) { CTileManager& pTMgr = m_pDoc->GetTileManager(); - CPieceTable* pPTbl = m_pDoc->GetPieceTable(); - ASSERT(pPTbl); - TileID tid = pPTbl->GetActiveTileID(pid); + CPieceTable& pPTbl = m_pDoc->GetPieceTable(); + TileID tid = pPTbl.GetActiveTileID(pid); ASSERT(tid != nullTid); if (IsOwned()) - pPTbl->SetOwnerMask(pid, GetOwnerMask());// Force piece to be owned by this player + pPTbl.SetOwnerMask(pid, GetOwnerMask());// Force piece to be owned by this player CTile tile = pTMgr.GetTile(tid, fullScale); CRect rct(pnt, tile.GetSize()); @@ -377,7 +376,7 @@ void CPlayBoard::Serialize(CArchive& ar) { Clear(); ASSERT(m_pDoc == (CGamDoc*)ar.m_pDocument); - BYTE cTmp; + uint8_t cTmp; uint16_t wTmp; uint32_t dwTmp; @@ -473,13 +472,13 @@ void CPlayBoard::Serialize(CArchive& ar) if (CGamDoc::GetLoadingVersion() < NumVersion(2, 0)) { - m_dwOwnerMask = 0; + m_dwOwnerMask = OWNER_MASK_SPECTATOR; m_bNonOwnerAccess = FALSE; } else if (CGamDoc::GetLoadingVersion() < NumVersion(3, 10)) { ar >> wTmp; - m_dwOwnerMask = UPGRADE_OWNER_MASK(wTmp); + m_dwOwnerMask = PlayerMask(UPGRADE_OWNER_MASK(wTmp)); ar >> wTmp; m_bNonOwnerAccess = (BOOL)wTmp; } @@ -600,7 +599,7 @@ void CPBoardManager::SetPBoardList(const std::vector& tblBrds) CDrawList* pDwg = pPBrd.GetPieceList(); std::vector tblPid; pDwg->GetPieceIDTable(tblPid); - m_pDoc->GetPieceTable()->SetPieceListAsUnused(tblPid); + m_pDoc->GetPieceTable().SetPieceListAsUnused(tblPid); erase(begin() + value_preserving_cast(i)); i--; // Recycle 'i' to look at next element @@ -643,7 +642,7 @@ void CPBoardManager::DeletePBoard(size_t nBrd) CDrawList* pDwg = pPBrd.GetPieceList(); std::vector tblPid; pDwg->GetPieceIDTable(tblPid); - m_pDoc->GetPieceTable()->SetPieceListAsUnused(tblPid); + m_pDoc->GetPieceTable().SetPieceListAsUnused(tblPid); erase(begin() + value_preserving_cast(nBrd)); } @@ -669,8 +668,8 @@ size_t CPBoardManager::FindPBoardBySerial(BoardID nSerialNum) const void CPBoardManager::ClearAllOwnership() { - for (size_t i = 0; i < GetNumPBoards(); i++) - GetPBoard(i).SetOwnerMask(0); + for (size_t i = size_t(0); i < GetNumPBoards(); i++) + GetPBoard(i).SetOwnerMask(OWNER_MASK_SPECTATOR); } void CPBoardManager::PropagateOwnerMaskToAllPieces() diff --git a/GP/PBoard.h b/GP/PBoard.h index 7193e3e..3cb7ad2 100644 --- a/GP/PBoard.h +++ b/GP/PBoard.h @@ -1,6 +1,6 @@ // PBoard.h // -// Copyright (c) 1994-2020 By Dale L. Larson, All Rights Reserved. +// Copyright (c) 1994-2025 By Dale L. Larson & William Su, All Rights Reserved. // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the @@ -91,10 +91,10 @@ class CPlayBoard BoardID GetSerialNumber() const { return m_nSerialNum; } void SetSerialNumber(BoardID nSerialNum) { m_nSerialNum = nSerialNum; } - DWORD GetOwnerMask() const { return m_dwOwnerMask; } - void SetOwnerMask(DWORD dwMask) { m_dwOwnerMask = dwMask; } - BOOL IsOwned() const { return m_dwOwnerMask != 0; } - BOOL IsOwnedBy(DWORD dwMask) const { return (BOOL)(m_dwOwnerMask & dwMask); } + PlayerMask GetOwnerMask() const { return m_dwOwnerMask; } + void SetOwnerMask(PlayerMask dwMask) { m_dwOwnerMask = dwMask; } + bool IsOwned() const { return bool(m_dwOwnerMask); } + bool IsOwnedBy(PlayerMask dwMask) const { return bool(m_dwOwnerMask & dwMask); } BOOL IsOwnedButNotByCurrentPlayer(const CGamDoc& pDoc) const; void PropagateOwnerMaskToAllPieces(); @@ -179,7 +179,7 @@ class CPlayBoard public: FontID m_fontID; // Text font - DWORD m_dwOwnerMask; // Who can change it + PlayerMask m_dwOwnerMask; // Who can change it BOOL m_bNonOwnerAccess; // Allow non-owner access to owned stuff. // ..Visiblity is still enforced. diff --git a/GP/PPieces.cpp b/GP/PPieces.cpp index 67f1121..9234085 100644 --- a/GP/PPieces.cpp +++ b/GP/PPieces.cpp @@ -1,6 +1,6 @@ // PPieces.cpp // -// Copyright (c) 1994-2023 By Dale L. Larson & William Su, All Rights Reserved. +// Copyright (c) 1994-2025 By Dale L. Larson & William Su, All Rights Reserved. // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the @@ -107,10 +107,8 @@ void CPieceTable::SetPieceListAsFrontUp(const std::vector& pPTbl) void CPieceTable::PurgeUndefinedPieceIDs() { - CTrayManager* pYMgr = m_pDoc->GetTrayManager(); - ASSERT(pYMgr != NULL); - CPBoardManager* pPBMgr = m_pDoc->GetPBoardManager(); - ASSERT(pPBMgr != NULL); + CTrayManager& pYMgr = m_pDoc->GetTrayManager(); + CPBoardManager& pPBMgr = m_pDoc->GetPBoardManager(); size_t nPiecesDeleted = 0; @@ -125,8 +123,8 @@ void CPieceTable::PurgeUndefinedPieceIDs() { TRACE1("ERROR: Piece %zu was defined but had no Tile Images. " "Piece removed from game!\n", i); - pYMgr->RemovePieceIDFromTraySets(static_cast(i)); - OwnerPtr pObj = pPBMgr->RemoveObjectID(static_cast(static_cast(i))); + pYMgr.RemovePieceIDFromTraySets(static_cast(i)); + OwnerPtr pObj = pPBMgr.RemoveObjectID(static_cast(static_cast(i))); pPce->SetUnused(); // Render it gone! nPiecesDeleted++; } @@ -274,7 +272,7 @@ size_t CPieceTable::GetSides(PieceID pid) const void CPieceTable::ClearAllOwnership() { for (size_t i = size_t(0); i < m_pPieceTbl.GetSize(); i++) - m_pPieceTbl[static_cast(i)].SetOwnerMask(uint32_t(0)); + m_pPieceTbl[static_cast(i)].SetOwnerMask(OWNER_MASK_SPECTATOR); } BOOL CPieceTable::IsPieceOwned(PieceID pid) const @@ -282,7 +280,7 @@ BOOL CPieceTable::IsPieceOwned(PieceID pid) const return GetPiece(pid).IsOwned(); } -BOOL CPieceTable::IsPieceOwnedBy(PieceID pid, uint32_t dwOwnerMask) const +BOOL CPieceTable::IsPieceOwnedBy(PieceID pid, PlayerMask dwOwnerMask) const { return GetPiece(pid).IsOwnedBy(dwOwnerMask); } @@ -292,12 +290,12 @@ BOOL CPieceTable::IsOwnedButNotByCurrentPlayer(PieceID pid, const CGamDoc& pDoc) return IsPieceOwned(pid) && !IsPieceOwnedBy(pid, pDoc.GetCurrentPlayerMask()); } -uint32_t CPieceTable::GetOwnerMask(PieceID pid) const +PlayerMask CPieceTable::GetOwnerMask(PieceID pid) const { return GetPiece(pid).GetOwnerMask(); } -void CPieceTable::SetOwnerMask(PieceID pid, uint32_t dwMask) +void CPieceTable::SetOwnerMask(PieceID pid, PlayerMask dwMask) { GetPiece(pid).SetOwnerMask(dwMask); } @@ -471,11 +469,11 @@ TileID CPieceTable::GetFacedTileID(PieceID pid, TileID tidBase, uint16_t nFacing { // Handle rotated pieces... ElementState state(pid, nFacing, nSide); - CTileFacingMap* pMapFacing = m_pDoc->GetFacingMap(); - TileID tidFacing = pMapFacing->GetFacingTileID(state); + CTileFacingMap& pMapFacing = m_pDoc->GetFacingMap(); + TileID tidFacing = pMapFacing.GetFacingTileID(state); if (tidFacing != nullTid) return tidFacing; - tidFacing = pMapFacing->CreateFacingTileID(state, tidBase); + tidFacing = pMapFacing.CreateFacingTileID(state, tidBase); return tidFacing; } @@ -579,12 +577,12 @@ void CPieceTable::Serialize(CArchive& ar) size_t nOldTblSize = m_pPieceTbl.GetSize(); m_pPieceTbl.ResizeTable(nDefSize, nullptr); // Purge pieces in use that don't exist anymore - CTrayManager* pYMgr = m_pDoc->GetTrayManager(); - CPBoardManager* pPBMgr = m_pDoc->GetPBoardManager(); + CTrayManager& pYMgr = m_pDoc->GetTrayManager(); + CPBoardManager& pPBMgr = m_pDoc->GetPBoardManager(); for (size_t i = m_pPieceTbl.GetSize(); i < nOldTblSize; i++) { - pYMgr->RemovePieceIDFromTraySets(static_cast(i)); - OwnerPtr pObj = pPBMgr->RemoveObjectID(static_cast(static_cast(i))); + pYMgr.RemovePieceIDFromTraySets(static_cast(i)); + OwnerPtr pObj = pPBMgr.RemoveObjectID(static_cast(static_cast(i))); } } } @@ -614,12 +612,12 @@ void Piece::Serialize(CArchive& ar) else ar >> m_nFacing; if (CGamDoc::GetLoadingVersion() < NumVersion(2, 0)) - m_dwOwnerMask = uint32_t(0); + m_dwOwnerMask = OWNER_MASK_SPECTATOR; else if (CGamDoc::GetLoadingVersion() < NumVersion(3, 10)) { - WORD wTmp; + uint16_t wTmp; ar >> wTmp; - m_dwOwnerMask = UPGRADE_OWNER_MASK(wTmp); + m_dwOwnerMask = PlayerMask(UPGRADE_OWNER_MASK(wTmp)); } else ar >> m_dwOwnerMask; @@ -661,7 +659,7 @@ void Piece::SetUnused() { m_nSide = uint8_t(0xFF); m_nFacing = uint16_t(0); - m_dwOwnerMask = uint32_t(0); + m_dwOwnerMask = OWNER_MASK_SPECTATOR; } diff --git a/GP/PPieces.h b/GP/PPieces.h index 873c7b4..62a94a9 100644 --- a/GP/PPieces.h +++ b/GP/PPieces.h @@ -1,6 +1,6 @@ // PPieces.h // -// Copyright (c) 1994-2020 By Dale L. Larson, All Rights Reserved. +// Copyright (c) 1994-2025 By Dale L. Larson & William Su, All Rights Reserved. // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the @@ -32,6 +32,7 @@ #ifndef _PIECES_H #include "Pieces.h" #endif +#include "Player.h" ////////////////////////////////////////////////////////////////////// @@ -66,10 +67,10 @@ class Piece void SetFacing(uint16_t nFacing) { m_nFacing = nFacing; } uint16_t GetFacing() const { return m_nFacing; } - uint32_t GetOwnerMask() const { return m_dwOwnerMask; } - void SetOwnerMask(uint32_t dwMask) { m_dwOwnerMask = dwMask; } - BOOL IsOwned() const { return m_dwOwnerMask != uint32_t(0); } - BOOL IsOwnedBy(uint32_t dwMask) const { return (BOOL)(m_dwOwnerMask & dwMask); } + PlayerMask GetOwnerMask() const { return m_dwOwnerMask; } + void SetOwnerMask(PlayerMask dwMask) { m_dwOwnerMask = dwMask; } + bool IsOwned() const { return m_dwOwnerMask != OWNER_MASK_SPECTATOR; } + bool IsOwnedBy(PlayerMask dwMask) const { return bool(m_dwOwnerMask & dwMask); } BOOL operator != (const Piece& pce) const { return m_nSide != pce.m_nSide || m_nFacing != pce.m_nFacing; } @@ -82,7 +83,7 @@ class Piece // If m_nSide is == 0xFF, the piece is not used. uint8_t m_nSide; // Visible side of piece (0 is front, 1 is back) uint16_t m_nFacing; // (1 deg incrs) 0 is normal facing - uint32_t m_dwOwnerMask; // Who owns the piece + PlayerMask m_dwOwnerMask; // Who owns the piece }; ////////////////////////////////////////////////////////////////////// @@ -131,10 +132,10 @@ class CPieceTable BOOL IsPieceUsed(PieceID pid) const; BOOL IsPieceOwned(PieceID pid) const; - BOOL IsPieceOwnedBy(PieceID pid, uint32_t dwOwnerMask) const; + BOOL IsPieceOwnedBy(PieceID pid, PlayerMask dwOwnerMask) const; BOOL IsOwnedButNotByCurrentPlayer(PieceID pid, const CGamDoc& pDoc) const; - uint32_t GetOwnerMask(PieceID pid) const; - void SetOwnerMask(PieceID pid, uint32_t wwMask); + PlayerMask GetOwnerMask(PieceID pid) const; + void SetOwnerMask(PieceID pid, PlayerMask wwMask); void ClearAllOwnership(); BOOL IsPieceInvisible(PieceID pid) const; diff --git a/GP/PalTray.cpp b/GP/PalTray.cpp index fb05114..6e0d072 100644 --- a/GP/PalTray.cpp +++ b/GP/PalTray.cpp @@ -1,6 +1,6 @@ // PalTray.cpp : implementation file // -// Copyright (c) 1994-2023 By Dale L. Larson & William Su, All Rights Reserved. +// Copyright (c) 1994-2025 By Dale L. Larson & William Su, All Rights Reserved. // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the @@ -343,8 +343,8 @@ LRESULT CTrayPalette::OnOverrideSelectedItemList(WPARAM wParam, LPARAM lParam) if (nSel == Invalid_v || !wParam || prefix != L'P') return (LRESULT)0; - CTrayManager* pYMgr = m_pDoc->GetTrayManager(); - CTraySet& pYSet = pYMgr->GetTraySet(nSel); + CTrayManager& pYMgr = m_pDoc->GetTrayManager(); + CTraySet& pYSet = pYMgr.GetTraySet(nSel); if (pYSet.IsRandomPiecePull() || pYSet.IsRandomSidePull()) @@ -368,7 +368,7 @@ LRESULT CTrayPalette::OnOverrideSelectedItemList(WPARAM wParam, LPARAM lParam) } } - CPieceTable& pieceTable = CheckedDeref(m_pDoc->GetPieceTable()); + CPieceTable& pieceTable = m_pDoc->GetPieceTable(); for (size_t i = size_t(0); i < pPceArray.size(); i++) { pPceArray.at(i) = pYSet.GetPieceIDTable().at(value_preserving_cast(pnIndices[i])); @@ -402,8 +402,8 @@ LRESULT CTrayPalette::OnGetDragSize(WPARAM wParam, LPARAM /*lParam*/) ASSERT(!"bad tray"); return 0; } - CTrayManager* pYMgr = m_pDoc->GetTrayManager(); - CTraySet& pYSet = pYMgr->GetTraySet(nSel); + CTrayManager& pYMgr = m_pDoc->GetTrayManager(); + CTraySet& pYSet = pYMgr.GetTraySet(nSel); std::vector items; if (pYSet.IsRandomPiecePull() || @@ -422,9 +422,9 @@ LRESULT CTrayPalette::OnGetDragSize(WPARAM wParam, LPARAM /*lParam*/) } // check all sides of all items - CPieceTable& pieceTable = CheckedDeref(m_pDoc->GetPieceTable()); + CPieceTable& pieceTable = m_pDoc->GetPieceTable(); CTileManager& tileMgr = m_pDoc->GetTileManager(); - DWORD player = m_pDoc->GetCurrentPlayerMask(); + PlayerMask player = m_pDoc->GetCurrentPlayerMask(); CSize retval(0, 0); for (int item : items) { @@ -496,13 +496,12 @@ void CTrayPalette::Serialize(CArchive& ar) void CTrayPalette::LoadTrayNameList() { - CTrayManager* pYMgr = m_pDoc->GetTrayManager(); - ASSERT(pYMgr != NULL); + CTrayManager& pYMgr = m_pDoc->GetTrayManager(); m_comboYGrp.ResetContent(); - for (size_t i = 0; i < pYMgr->GetNumTraySets(); i++) + for (size_t i = size_t(0); i < pYMgr.GetNumTraySets(); i++) { - CTraySet& pYSet = pYMgr->GetTraySet(i); + CTraySet& pYSet = pYMgr.GetTraySet(i); CB::string strTrayName = pYSet.GetName(); if (pYSet.IsOwned()) { @@ -524,8 +523,8 @@ void CTrayPalette::UpdatePaletteContents(const CTraySet* pTray) size_t nSel = GetSelectedTray(); if (nSel != Invalid_v && pTray != NULL) { - CTrayManager* pYMgr = m_pDoc->GetTrayManager(); - if (&pYMgr->GetTraySet(nSel) != pTray) + CTrayManager& pYMgr = m_pDoc->GetTrayManager(); + if (&pYMgr.GetTraySet(nSel) != pTray) return; // Not visible in palette at present. } if (nSel == Invalid_v) @@ -582,8 +581,7 @@ void CTrayPalette::SelectTrayPiece(size_t nGroup, PieceID pid, void CTrayPalette::UpdateTrayList() { - CTrayManager* pYMgr = m_pDoc->GetTrayManager(); - ASSERT(pYMgr != NULL); + CTrayManager& pYMgr = m_pDoc->GetTrayManager(); m_toolTipCombo.DelTool(&m_comboYGrp); // Always delete current tool @@ -601,7 +599,7 @@ void CTrayPalette::UpdateTrayList() ti.lpszText = const_cast(strTrayName.v_str()); m_toolTipCombo.SendMessage(TTM_ADDTOOL, 0, (LPARAM)&ti); - CTraySet& pYSet = pYMgr->GetTraySet(nSel); + CTraySet& pYSet = pYMgr.GetTraySet(nSel); const std::vector* pPieceTbl = &pYSet.GetPieceIDTable(); CB::string str = ""; @@ -701,8 +699,8 @@ LRESULT CTrayPalette::OnDragItem(WPARAM wParam, LPARAM lParam) return (LRESULT)(LPVOID)pdi->m_hcsrSuggest; else if (pdi->m_phase == PhaseDrag::Drop) { - CTrayManager* pYMgr = m_pDoc->GetTrayManager(); - CTraySet& pYGrp = pYMgr->GetTraySet(nGrpSel); + CTrayManager& pYMgr = m_pDoc->GetTrayManager(); + CTraySet& pYGrp = pYMgr.GetTraySet(nGrpSel); // Force selection of item under the mouse m_listTray.SetSelFromPoint(pdi->m_point); @@ -894,8 +892,8 @@ void CTrayPalette::OnTrayListDoubleClick() size_t nSel = GetSelectedTray(); if (nSel != Invalid_v) { - CTrayManager* pYMgr = m_pDoc->GetTrayManager(); - CTraySet& pYSet = pYMgr->GetTraySet(nSel); + CTrayManager& pYMgr = m_pDoc->GetTrayManager(); + CTraySet& pYSet = pYMgr.GetTraySet(nSel); if (pYSet.IsOwned() && !pYSet.IsOwnedBy(m_pDoc->GetCurrentPlayerMask())) return; @@ -923,7 +921,7 @@ void CTrayPalette::OnPieceTrayShuffle() m_pDoc->AssignNewMoveGroup(); size_t nSel = GetSelectedTray(); - CTrayManager* pYMgr = m_pDoc->GetTrayManager(); + CTrayManager& pYMgr = m_pDoc->GetTrayManager(); if (m_pDoc->IsRecording()) { @@ -931,7 +929,7 @@ void CTrayPalette::OnPieceTrayShuffle() m_pDoc->RecordEventMessage(strMsg, nSel, tblPids.front()); } - m_pDoc->PlacePieceListInTray(tblPids, pYMgr->GetTraySet(nSel), 0); + m_pDoc->PlacePieceListInTray(tblPids, pYMgr.GetTraySet(nSel), 0); } void CTrayPalette::OnUpdatePieceTrayShuffle(CCmdUI* pCmdUI) @@ -940,8 +938,8 @@ void CTrayPalette::OnUpdatePieceTrayShuffle(CCmdUI* pCmdUI) size_t nSel = GetSelectedTray(); if (nSel != Invalid_v) { - CTrayManager* pYMgr = m_pDoc->GetTrayManager(); - CTraySet& pYSet = pYMgr->GetTraySet(nSel); + CTrayManager& pYMgr = m_pDoc->GetTrayManager(); + CTraySet& pYSet = pYMgr.GetTraySet(nSel); bNoOwnerRestrictions = !(pYSet.IsOwnedButNotByCurrentPlayer(*m_pDoc) && !pYSet.IsNonOwnerAccessAllowed()); } @@ -973,7 +971,7 @@ void CTrayPalette::OnPieceTrayShuffleSelected() m_pDoc->AssignNewMoveGroup(); size_t nSel = GetSelectedTray(); - CTrayManager* pYMgr = m_pDoc->GetTrayManager(); + CTrayManager& pYMgr = m_pDoc->GetTrayManager(); if (m_pDoc->IsRecording()) { @@ -981,7 +979,7 @@ void CTrayPalette::OnPieceTrayShuffleSelected() m_pDoc->RecordEventMessage(strMsg, nSel, tblPids.front()); } - m_pDoc->PlacePieceListInTray(tblPids, pYMgr->GetTraySet(nSel), value_preserving_cast(nTopSel)); + m_pDoc->PlacePieceListInTray(tblPids, pYMgr.GetTraySet(nSel), value_preserving_cast(nTopSel)); } void CTrayPalette::OnUpdatePieceTrayShuffleSelected(CCmdUI* pCmdUI) @@ -990,8 +988,8 @@ void CTrayPalette::OnUpdatePieceTrayShuffleSelected(CCmdUI* pCmdUI) size_t nSel = GetSelectedTray(); if (nSel != Invalid_v) { - CTrayManager* pYMgr = m_pDoc->GetTrayManager(); - CTraySet& pYSet = pYMgr->GetTraySet(nSel); + CTrayManager& pYMgr = m_pDoc->GetTrayManager(); + CTraySet& pYSet = pYMgr.GetTraySet(nSel); bNoOwnerRestrictions = !(pYSet.IsOwnedButNotByCurrentPlayer(*m_pDoc) && !pYSet.IsNonOwnerAccessAllowed()); } @@ -1011,8 +1009,8 @@ void CTrayPalette::OnUpdateEditElementText(CCmdUI* pCmdUI) size_t nSel = GetSelectedTray(); if (nSel != Invalid_v) { - CTrayManager* pYMgr = m_pDoc->GetTrayManager(); - CTraySet& pYSet = pYMgr->GetTraySet(nSel); + CTrayManager& pYMgr = m_pDoc->GetTrayManager(); + CTraySet& pYSet = pYMgr.GetTraySet(nSel); bNoOwnerRestrictions = !pYSet.IsOwnedButNotByCurrentPlayer(*m_pDoc); } pCmdUI->Enable((m_pDoc->IsScenario() || bNoOwnerRestrictions) && @@ -1102,9 +1100,9 @@ BOOL CTrayPalette::OnActTurnOver(UINT id) } m_pDoc->InvertPlayingPieceInTray(pid, flip, side, false, false); } - CTrayManager* pYMgr = m_pDoc->GetTrayManager(); + CTrayManager& pYMgr = m_pDoc->GetTrayManager(); CGamDocHint hint; - hint.GetArgs().m_pTray = &pYMgr->GetTraySet(nSel); + hint.GetArgs().m_pTray = &pYMgr.GetTraySet(nSel); m_pDoc->UpdateAllViews(NULL, HINT_TRAYCHANGE, &hint); /* flipping pieces shouldn't change tray content, @@ -1143,8 +1141,8 @@ void CTrayPalette::OnUpdateActTurnOver(CCmdUI* pCmdUI) size_t nSel = GetSelectedTray(); if (nSel != Invalid_v) { - CTrayManager* pYMgr = m_pDoc->GetTrayManager(); - CTraySet& pYSet = pYMgr->GetTraySet(nSel); + CTrayManager& pYMgr = m_pDoc->GetTrayManager(); + CTraySet& pYSet = pYMgr.GetTraySet(nSel); bNoOwnerRestrictions = !pYSet.IsOwnedButNotByCurrentPlayer(*m_pDoc); } @@ -1165,8 +1163,8 @@ void CTrayPalette::OnPieceTrayAbout() size_t nSel = GetSelectedTray(); if (nSel == Invalid_v) return; - CTrayManager* pYMgr = m_pDoc->GetTrayManager(); - CTraySet& pYSet = pYMgr->GetTraySet(nSel); + CTrayManager& pYMgr = m_pDoc->GetTrayManager(); + CTraySet& pYSet = pYMgr.GetTraySet(nSel); CB::string strMsg = CB::string::Format(IDS_MSG_TRAY_INFO, pYSet.GetName()); CB::string strTmp; diff --git a/GP/Player.cpp b/GP/Player.cpp index 9b03d54..c4e49fb 100644 --- a/GP/Player.cpp +++ b/GP/Player.cpp @@ -1,6 +1,6 @@ // Player.cpp // -// Copyright (c) 1994-2023 By Dale L. Larson & William Su, All Rights Reserved. +// Copyright (c) 1994-2025 By Dale L. Larson & William Su, All Rights Reserved. // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the @@ -26,38 +26,39 @@ #include "Versions.h" #include "Player.h" -intptr_t CPlayerManager::AddPlayer(CB::string pszName) +PlayerId CPlayerManager::AddPlayer(CB::string pszName) { - Player player(std::move(pszName)); - return Add(player); + emplace_back(std::move(pszName)); + return PlayerId(size() - size_t(1)); } -const Player& CPlayerManager::GetPlayerUsingMask(DWORD dwMask) const +const Player& CPlayerManager::GetPlayerUsingMask(PlayerMask dwMask) const { - ASSERT(dwMask != 0); - int nPlayerNum = GetPlayerNumFromMask(dwMask); - return ElementAt(nPlayerNum); + wxASSERT(dwMask); + PlayerId nPlayerNum = GetPlayerNumFromMask(dwMask); + return (*this)[nPlayerNum]; } -DWORD CPlayerManager::GetMaskFromPlayerNum(int nPlayerNumber) +PlayerMask CPlayerManager::GetMaskFromPlayerNum(PlayerId nPlayerNumber) { - if (nPlayerNumber < 0) - return 0; - return (DWORD)1 << nPlayerNumber; + if (nPlayerNumber == INVALID_PLAYER) + return OWNER_MASK_SPECTATOR; + return PlayerMask(uint32_t(1) << static_cast(nPlayerNumber)); } // Returns -1 if no bit set. Otherwise, returns number of // the rightmost set bit. -int CPlayerManager::GetPlayerNumFromMask(DWORD dwMask) +PlayerId CPlayerManager::GetPlayerNumFromMask(PlayerMask dwMask) { - if (dwMask == 0) return -1; // For a bit more speed + if (!dwMask) return INVALID_PLAYER; // For a bit more speed + uint32_t u32(dwMask); for (int i = 0; i < MAX_OWNER_ACCOUNTS; i++) { - if ((dwMask & 1) != 0) - return i; - dwMask >>= 1; + if ((u32 & uint32_t(1)) != uint32_t(0)) + return PlayerId(i); + u32 >>= 1; } - return -1; + return INVALID_PLAYER; } void CPlayerManager::Serialize(CArchive& ar) @@ -66,20 +67,22 @@ void CPlayerManager::Serialize(CArchive& ar) { if (!CB::GetFeatures(ar).Check(ftrSizet64Bit)) { - ar << value_preserving_cast(GetSize()); + ar << value_preserving_cast(size()); } else { - CB::WriteCount(ar, value_preserving_cast(GetSize())); + CB::WriteCount(ar, size()); + } + for (Player& player : *this) + { + player.Serialize(ar); } - for (int i = 0; i < GetSize(); i++) - GetAt(i).Serialize(ar); } else { - RemoveAll(); + clear(); size_t nCount; - WORD wTmp; + uint16_t wTmp; if (!CB::GetFeatures(ar).Check(ftrSizet64Bit)) { @@ -94,7 +97,7 @@ void CPlayerManager::Serialize(CArchive& ar) { Player player; player.Serialize(ar); - Add(player); + push_back(std::move(player)); } } } diff --git a/GP/Player.h b/GP/Player.h index c6e0b97..2f8494c 100644 --- a/GP/Player.h +++ b/GP/Player.h @@ -1,6 +1,6 @@ // Player.h // -// Copyright (c) 1994-2020 By Dale L. Larson, All Rights Reserved. +// Copyright (c) 1994-2025 By Dale L. Larson & William Su, All Rights Reserved. // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the @@ -25,31 +25,163 @@ #ifndef _PLAYER_H #define _PLAYER_H +class alignas(uint8_t) PlayerId +{ +public: + PlayerId() = default; + + template::value, bool> = true> + explicit PlayerId(Integer i) : + id(value_preserving_cast(i) != -1 ? + value_preserving_cast(i) + : + uint8_t(-1)) + { + static_assert(sizeof(*this) == sizeof(uint8_t)); + static_assert(alignof(std::remove_reference_t) == alignof(uint8_t)); + wxASSERT(id <= 25 || id == uint8_t(-1)); + } + + template::value, bool> = true> + explicit operator Integer() const + { + return id != uint8_t(-1) ? + value_preserving_cast(id) + : + static_cast(-1); + } + +private: + uint8_t id; +}; + +inline bool operator==(const PlayerId& l, const PlayerId& r) +{ + return static_cast(l) == static_cast(r); +} + +inline bool operator!=(const PlayerId& l, const PlayerId& r) +{ + return !(l == r); +} + +class alignas(uint32_t) PlayerMask +{ +public: + PlayerMask() = default; + explicit PlayerMask(uint32_t i) : + mask(i) + { + static_assert(sizeof(*this) == sizeof(uint32_t)); + static_assert(alignof(std::remove_reference_t) == alignof(uint32_t)); + } + + explicit operator uint32_t() const + { + return mask; + } + + explicit operator bool() const + { + return bool(uint32_t(*this)); + } + +private: + uint32_t mask; +}; + +inline bool operator==(const PlayerMask& l, const PlayerMask& r) +{ + return static_cast(l) == static_cast(r); +} + +inline bool operator!=(const PlayerMask& l, const PlayerMask& r) +{ + return !(l == r); +} + +inline PlayerMask operator&(const PlayerMask& l, const PlayerMask& r) +{ + return PlayerMask(static_cast(l) & static_cast(r)); +} + +inline PlayerMask operator|(const PlayerMask& l, const PlayerMask& r) +{ + return PlayerMask(static_cast(l) | static_cast(r)); +} + +inline CArchive& operator<<(CArchive& ar, const PlayerMask& m) +{ + return ar << static_cast(m); +} + +inline CArchive& operator>>(CArchive& ar, PlayerMask& m) +{ + return ar >> reinterpret_cast(m); +} + +template +struct std::formatter : private std::formatter +{ +private: + using BASE = std::formatter; +public: + using BASE::parse; + + template + FormatContext::iterator format(const PlayerMask& t, FormatContext& ctx) const + { + return BASE::format(static_cast(t), ctx); + } +}; + const int MAX_OWNER_ACCOUNTS = 26; // Max of 26 players (A..Z) -const DWORD PLAYER_REFEREE_FLAG = 0x80000000; // Top bit set is referee -const DWORD OWNER_MASK_REFEREE = 0x03FFFFFF; // 26 total players allowed -const DWORD OWNER_MASK_SPECTATOR = 0; // No ownership is spectator +const PlayerId INVALID_PLAYER(-1); +const PlayerMask PLAYER_REFEREE_FLAG(uint32_t(0x80000000)); // Top bit set is referee +const PlayerMask OWNER_MASK_REFEREE(uint32_t(0x03FFFFFF)); // 26 total players allowed +const PlayerMask OWNER_MASK_SPECTATOR(uint32_t(0)); // No ownership is spectator struct Player { CB::string m_strName; // The player's name - DWORD m_seqNum; // Number used for special unlock messages + uint32_t m_seqNum; // Number used for special unlock messages - Player() { m_seqNum = 0; } - Player(CB::string pszName) { m_strName = std::move(pszName); m_seqNum = 0; } + Player() { m_seqNum = uint32_t(0); } + Player(CB::string pszName) { m_strName = std::move(pszName); m_seqNum = uint32_t(0); } void Serialize(CArchive& ar); }; -class CPlayerManager : public CArray< Player, Player& > +class CPlayerManager : private std::vector { +private: + typedef std::vector BASE; public: - intptr_t AddPlayer(CB::string pszName); - const Player& GetPlayerUsingMask(DWORD dwMask) const; + using BASE::begin; + using BASE::end; + using BASE::iterator; + using BASE::const_iterator; + + using BASE::empty; + using BASE::size; + + const Player& operator[](PlayerId i) const + { + return BASE::at(static_cast(i)); + } + Player& operator[](PlayerId i) + { + return BASE::at(static_cast(i)); + } + + PlayerId AddPlayer(CB::string pszName); + const Player& GetPlayerUsingMask(PlayerMask dwMask) const; - static DWORD GetMaskFromPlayerNum(int nPlayerNumber); - static int GetPlayerNumFromMask(DWORD dwMask); - static BOOL IsReferee(DWORD dwMask) { return (BOOL)(dwMask & PLAYER_REFEREE_FLAG); } + static PlayerMask GetMaskFromPlayerNum(PlayerId nPlayerNumber); + static PlayerId GetPlayerNumFromMask(PlayerMask dwMask); + static bool IsReferee(PlayerMask dwMask) { return bool(dwMask & PLAYER_REFEREE_FLAG); } void Serialize(CArchive& ar); }; diff --git a/GP/SelOPlay.cpp b/GP/SelOPlay.cpp index 5d0507b..83f6cc7 100644 --- a/GP/SelOPlay.cpp +++ b/GP/SelOPlay.cpp @@ -1,6 +1,6 @@ // SelOPlay.cpp // -// Copyright (c) 1994-2020 By Dale L. Larson, All Rights Reserved. +// Copyright (c) 1994-2025 By Dale L. Larson & William Su, All Rights Reserved. // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the @@ -642,14 +642,14 @@ BOOL CSelList::HasPieces() const BOOL CSelList::HasNonOwnedPieces() const { - const CPieceTable* pPTbl = m_pView->GetDocument()->GetPieceTable(); + const CPieceTable& pPTbl = m_pView->GetDocument()->GetPieceTable(); for (const_iterator pos = begin() ; pos != end() ; ++pos) { const CSelection& pSel = **pos; if (pSel.m_pObj->GetType() == CDrawObj::drawPieceObj) { const CPieceObj& pPObj = static_cast(*pSel.m_pObj); - if (pPTbl->GetOwnerMask(pPObj.m_pid) == uint32_t(0)) + if (pPTbl.GetOwnerMask(pPObj.m_pid) == OWNER_MASK_SPECTATOR) return TRUE; } } @@ -658,31 +658,31 @@ BOOL CSelList::HasNonOwnedPieces() const BOOL CSelList::HasOwnedPieces() const { - const CPieceTable* pPTbl = m_pView->GetDocument()->GetPieceTable(); + const CPieceTable& pPTbl = m_pView->GetDocument()->GetPieceTable(); for (const_iterator pos = begin() ; pos != end() ; ++pos) { const CSelection& pSel = **pos; if (pSel.m_pObj->GetType() == CDrawObj::drawPieceObj) { const CPieceObj& pPObj = static_cast(*pSel.m_pObj); - if (pPTbl->GetOwnerMask(pPObj.m_pid) != uint32_t(0)) + if (pPTbl.GetOwnerMask(pPObj.m_pid) != OWNER_MASK_SPECTATOR) return TRUE; } } return FALSE; } -BOOL CSelList::HasOwnedPiecesNotMatching(DWORD dwOwnerMask) const +BOOL CSelList::HasOwnedPiecesNotMatching(PlayerMask dwOwnerMask) const { - const CPieceTable* pPTbl = m_pView->GetDocument()->GetPieceTable(); + const CPieceTable& pPTbl = m_pView->GetDocument()->GetPieceTable(); for (const_iterator pos = begin() ; pos != end() ; ++pos) { const CSelection& pSel = **pos; if (pSel.m_pObj->GetType() == CDrawObj::drawPieceObj) { const CPieceObj& pPObj = static_cast(*pSel.m_pObj); - if (pPTbl->IsPieceOwned(pPObj.m_pid) && - !pPTbl->IsPieceOwnedBy(pPObj.m_pid, dwOwnerMask)) + if (pPTbl.IsPieceOwned(pPObj.m_pid) && + !pPTbl.IsPieceOwnedBy(pPObj.m_pid, dwOwnerMask)) { return TRUE; } @@ -709,7 +709,7 @@ BOOL CSelList::HasFlippablePieces() const const CSelection& pSel = **pos; if (pSel.m_pObj->GetType() == CDrawObj::drawPieceObj) { - if (m_pView->GetDocument()->GetPieceTable()->GetSides( + if (m_pView->GetDocument()->GetPieceTable().GetSides( static_cast(*pSel.m_pObj).m_pid) >= size_t(2)) return TRUE; } @@ -783,7 +783,7 @@ void CSelList::LoadTableWithPieceIDs(std::vector& pTbl, BOOL bVisualOrd void CSelList::LoadTableWithOwnerStatePieceIDs(std::vector& pTbl, LoadFilter eWantOwned, BOOL bVisualOrder /* = TRUE */) { - CPieceTable* pPTbl = m_pView->GetDocument()->GetPieceTable(); + CPieceTable& pPTbl = m_pView->GetDocument()->GetPieceTable(); pTbl.clear(); pTbl.reserve(size()); @@ -793,8 +793,8 @@ void CSelList::LoadTableWithOwnerStatePieceIDs(std::vector& pTbl, LoadF if (pSel.m_pObj->GetType() == CDrawObj::drawPieceObj) { CPieceObj& pPObj = static_cast(*pSel.m_pObj); - if (eWantOwned == LF_OWNED && pPTbl->GetOwnerMask(pPObj.m_pid) != uint32_t(0) || - eWantOwned == LF_NOTOWNED && pPTbl->GetOwnerMask(pPObj.m_pid) == uint32_t(0) || + if (eWantOwned == LF_OWNED && pPTbl.GetOwnerMask(pPObj.m_pid) != OWNER_MASK_SPECTATOR || + eWantOwned == LF_NOTOWNED && pPTbl.GetOwnerMask(pPObj.m_pid) == OWNER_MASK_SPECTATOR || eWantOwned == LF_BOTH) { pTbl.push_back(pPObj.m_pid); diff --git a/GP/SelOPlay.h b/GP/SelOPlay.h index 768a83a..a642614 100644 --- a/GP/SelOPlay.h +++ b/GP/SelOPlay.h @@ -213,7 +213,7 @@ class CSelList : private std::list> BOOL HasPieces() const; BOOL HasOwnedPieces() const; BOOL HasNonOwnedPieces() const; - BOOL HasOwnedPiecesNotMatching(DWORD dwOwnerMask) const; + BOOL HasOwnedPiecesNotMatching(PlayerMask dwOwnerMask) const; BOOL HasMarkers() const; BOOL HasFlippablePieces() const; BOOL IsMarkerSelected() const; diff --git a/GP/ToolPlay.cpp b/GP/ToolPlay.cpp index cef45ca..cab40fa 100644 --- a/GP/ToolPlay.cpp +++ b/GP/ToolPlay.cpp @@ -127,7 +127,7 @@ void CPSelectTool::OnLButtonDown(CPlayBoardView* pView, UINT nFlags, if (pObj != NULL && pObj->GetType() == CDrawObj::drawPieceObj) { CPieceObj* pPObj = (CPieceObj*)pObj; - DWORD dwCurrentPlayer = pView->GetDocument()->GetCurrentPlayerMask(); + PlayerMask dwCurrentPlayer = pView->GetDocument()->GetCurrentPlayerMask(); bOwnedButNotOkToSelect = !pView->GetDocument()->IsScenario() && !pPBoard->IsNonOwnerAccessAllowed() && pPObj->IsOwned() && !pPObj->IsOwnedBy(dwCurrentPlayer); diff --git a/GP/Trays.cpp b/GP/Trays.cpp index d45c9f1..de204f1 100644 --- a/GP/Trays.cpp +++ b/GP/Trays.cpp @@ -1,6 +1,6 @@ // Trays.cpp // -// Copyright (c) 1994-2023 By Dale L. Larson & William Su, All Rights Reserved. +// Copyright (c) 1994-2025 By Dale L. Larson & William Su, All Rights Reserved. // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the @@ -41,7 +41,7 @@ static char THIS_FILE[] = __FILE__; CTraySet::CTraySet() { - m_dwOwnerMask = 0; + m_dwOwnerMask = OWNER_MASK_SPECTATOR; m_bNonOwnerAccess = FALSE; m_bRandomPull = FALSE; m_bRandomSidePull = false; @@ -144,7 +144,7 @@ void CTraySet::PropagateOwnerMaskToAllPieces(CGamDoc* pDoc) { for (size_t i = 0; i < m_pidTbl.size(); i++) { - pDoc->GetPieceTable()->SetOwnerMask( + pDoc->GetPieceTable().SetOwnerMask( m_pidTbl[i], GetOwnerMask()); } } @@ -204,7 +204,7 @@ void CTraySet::Serialize(CArchive& ar) if (CGamDoc::GetLoadingVersion() < NumVersion(3, 10)) { ar >> wTmp; - m_dwOwnerMask = UPGRADE_OWNER_MASK(wTmp); + m_dwOwnerMask = PlayerMask(UPGRADE_OWNER_MASK(wTmp)); } else ar >> m_dwOwnerMask; @@ -269,7 +269,7 @@ void CTrayManager::ClearAllOwnership() for (size_t i = 0; i < GetNumTraySets(); i++) { CTraySet& pYSet = GetTraySet(i); - pYSet.SetOwnerMask(0); + pYSet.SetOwnerMask(OWNER_MASK_SPECTATOR); } } diff --git a/GP/Trays.h b/GP/Trays.h index 7664d5b..63f6373 100644 --- a/GP/Trays.h +++ b/GP/Trays.h @@ -28,6 +28,7 @@ #ifndef _PPIECES_H #include "PPieces.h" #endif +#include "Player.h" ////////////////////////////////////////////////////////////////////// @@ -78,10 +79,10 @@ class CTraySet BOOL IsNonOwnerAccessAllowed() { return m_bNonOwnerAccess; } void SetNonOwnerAccess(BOOL bAllowAccess) { m_bNonOwnerAccess = bAllowAccess; } - DWORD GetOwnerMask() { return m_dwOwnerMask; } - void SetOwnerMask(DWORD dwMask) { m_dwOwnerMask = dwMask; } - BOOL IsOwned() const { return m_dwOwnerMask != 0; } - BOOL IsOwnedBy(DWORD dwMask) const { return (BOOL)(m_dwOwnerMask & dwMask); } + PlayerMask GetOwnerMask() { return m_dwOwnerMask; } + void SetOwnerMask(PlayerMask dwMask) { m_dwOwnerMask = dwMask; } + bool IsOwned() const { return bool(m_dwOwnerMask); } + BOOL IsOwnedBy(PlayerMask dwMask) const { return bool(m_dwOwnerMask & dwMask); } BOOL IsOwnedButNotByCurrentPlayer(const CGamDoc& pDOc) const; // Operations @@ -105,7 +106,7 @@ class CTraySet CB::string m_strName; std::vector m_pidTbl; - DWORD m_dwOwnerMask; // Who can change the tray (0=no owners) + PlayerMask m_dwOwnerMask; // Who can change the tray (0=no owners) BOOL m_bNonOwnerAccess; // Allow non-owner access. Visiblity is still enforced. BOOL m_bRandomPull; // Pieces are randomly selected on drags bool m_bRandomSidePull; // Piece sidess are randomly selected on drags diff --git a/GP/VwPbrd.cpp b/GP/VwPbrd.cpp index df6641f..6560a60 100644 --- a/GP/VwPbrd.cpp +++ b/GP/VwPbrd.cpp @@ -1,6 +1,6 @@ // VwPbrd.cpp : implementation of the CPlayBoardView class // -// Copyright (c) 1994-2024 By Dale L. Larson & William Su, All Rights Reserved. +// Copyright (c) 1994-2025 By Dale L. Larson & William Su, All Rights Reserved. // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the @@ -34,7 +34,9 @@ #include "VwpBrd.h" #include "GMisc.h" #include "LibMfc.h" +#if 0 #include "DlgRot.h" +#endif #include "DlgRotpc.h" #include "DlgEdtel.h" #include "DlgSelOwner.h" @@ -214,7 +216,7 @@ void CPlayBoardView::OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint) else if (lHint == HINT_BOARDCHANGE) { // Make sure we still exist! - if (GetDocument()->GetPBoardManager()->FindPBoardByRef(CheckedDeref(m_pPBoard)) == Invalid_v) + if (GetDocument()->GetPBoardManager().FindPBoardByRef(CheckedDeref(m_pPBoard)) == Invalid_v) { CFrameWnd* pFrm = GetParentFrame(); ASSERT(pFrm != NULL); @@ -590,7 +592,7 @@ LRESULT CPlayBoardView::DoDragPieceList(DragInfo& pdi) ClientToWorkspace(pnt); // If the snap grid is on, adjust the point. - CSize sz = GetDocument()->GetPieceTable()->GetStackedSize(pTbl, + CSize sz = GetDocument()->GetPieceTable().GetStackedSize(pTbl, m_pPBoard->m_xStackStagger, m_pPBoard->m_yStackStagger); ASSERT(sz.cx != 0 && sz.cy != 0); CRect rct(CPoint(pnt.x - sz.cx/2, pnt.y - sz.cy/2), sz); @@ -670,9 +672,9 @@ LRESULT CPlayBoardView::DoDragMarker(DragInfo& pdi) CMarkerCountDialog dlg; dlg.m_nMarkerCount = 2; - if (dlg.DoModal() != IDOK) + if (dlg.ShowModal() != wxID_OK) goto NASTY_GOTO_TARGET; - ASSERT(dlg.m_nMarkerCount > 0); + wxASSERT(dlg.m_nMarkerCount > 0); m_selList.PurgeList(); @@ -743,7 +745,7 @@ LRESULT CPlayBoardView::DoDragMarker(DragInfo& pdi) dlg.m_strText = pDoc->GetGameElementString(MakeMarkerElement(mid)); - if (dlg.DoModal() == IDOK) + if (dlg.ShowModal() == wxID_OK) { GameElement elem = pDoc->GetGameElementCodeForObject(pObj); pDoc->SetObjectText(elem, dlg.m_strText.empty() ? NULL : @@ -1736,13 +1738,16 @@ void CPlayBoardView::OnActRotate() // ** TEST CODE ** // std::vector tbl; CGamDoc* pDoc = GetDocument(); m_selList.LoadTableWithPieceIDs(tbl); - TileID tid = pDoc->GetPieceTable()->GetActiveTileID(tbl.front()); + TileID tid = pDoc->GetPieceTable().GetActiveTileID(tbl.front()); CTile tile = pDoc->GetTileManager().GetTile(tid); OwnerPtr bmap = tile.CreateBitmapOfTile(); + wxASSERT(!"dead code"); +#if 0 CRotateDialog dlg; dlg.m_pBMap = &*bmap; dlg.m_crTrans = pDoc->GetTileManager().GetTransparentColor(); dlg.DoModal(); +#endif } void CPlayBoardView::OnUpdateActRotate(CCmdUI* pCmdUI) // ** TEST CODE ** // @@ -1855,9 +1860,9 @@ void CPlayBoardView::DoRotateRelative(BOOL bWheelRotation) { m_bWheelRotation = bWheelRotation; - CRotatePieceDialog dlg(this); + CRotatePieceDialog dlg(*this); CGamDoc* pDoc = GetDocument(); - CPieceTable* pPTbl = pDoc->GetPieceTable(); + CPieceTable& pPTbl = pDoc->GetPieceTable(); // Get a list of the selected pieces and save their current // rotations. @@ -1877,7 +1882,7 @@ void CPlayBoardView::DoRotateRelative(BOOL bWheelRotation) if (pDObj.GetType() == CDrawObj::drawPieceObj) { CPieceObj& pObj = static_cast(pDObj); - m_tblCurAngles.push_back(pPTbl->GetPieceFacing(pObj.m_pid)); + m_tblCurAngles.push_back(pPTbl.GetPieceFacing(pObj.m_pid)); } else if (pDObj.GetType() == CDrawObj::drawMarkObj) { @@ -1893,12 +1898,32 @@ void CPlayBoardView::DoRotateRelative(BOOL bWheelRotation) } } // If we're recording moves right now, suspend it for the moment. - BOOL bRecording = pDoc->IsRecording(); - if (bRecording) - pDoc->SetGameState(CGamDoc::stateNotRecording); + int nDlgResult; + { + class SuspendRecording + { + public: + SuspendRecording(CGamDoc& d) : doc(d) + { + if (bRecording) + { + doc.SetGameState(CGamDoc::stateNotRecording); + } + } + ~SuspendRecording() + { + if (bRecording) + { + doc.SetGameState(CGamDoc::stateRecording); + } + } + private: + CGamDoc& doc; + BOOL bRecording = doc.IsRecording(); + } suspendRecording(*pDoc); // Show the rotation dialog - INT_PTR nDlgResult = dlg.DoModal(); + nDlgResult = dlg.ShowModal(); // Restore angles before possibly recording the operation. for (size_t i = size_t(0) ; i < m_tblCurPieces.size() ; ++i) @@ -1924,9 +1949,8 @@ void CPlayBoardView::DoRotateRelative(BOOL bWheelRotation) } } // Restore recording mode if it was active. - if (bRecording) - pDoc->SetGameState(CGamDoc::stateRecording); - if (nDlgResult == IDOK) + } + if (nDlgResult == wxID_OK) { // Rotation was accepted. Make the final changes. pDoc->AssignNewMoveGroup(); @@ -2282,7 +2306,7 @@ void CPlayBoardView::OnUpdateActTakeOwnership(CCmdUI* pCmdUI) else { pCmdUI->Enable(pDoc->HasPlayers() && m_selList.HasNonOwnedPieces() && - pDoc->GetCurrentPlayerMask() != 0); + pDoc->GetCurrentPlayerMask() != OWNER_MASK_SPECTATOR); } } @@ -2311,7 +2335,7 @@ void CPlayBoardView::OnActReleaseOwnership() value_preserving_cast(pntCenter.x), value_preserving_cast(pntCenter.y)); } - pDoc->SetPieceOwnershipTable(tblPieces, 0); + pDoc->SetPieceOwnershipTable(tblPieces, OWNER_MASK_SPECTATOR); CGamDocHint hint; hint.GetArgs().m_pPBoard = m_pPBoard.get(); @@ -2331,7 +2355,7 @@ void CPlayBoardView::OnUpdateActReleaseOwnership(CCmdUI* pCmdUI) else { pCmdUI->Enable(pDoc->HasPlayers() && m_selList.HasOwnedPieces() && - pDoc->GetCurrentPlayerMask() != 0); + pDoc->GetCurrentPlayerMask() != OWNER_MASK_SPECTATOR); } } @@ -2342,15 +2366,14 @@ void CPlayBoardView::OnActSetOwner() if (rct.IsRectEmpty()) return; - CSelectNewOwnerDialog dlg; - dlg.m_pPlayerMgr = pDoc->GetPlayerManager(); + CSelectNewOwnerDialog dlg(CheckedDeref(pDoc->GetPlayerManager())); if (!pDoc->IsCurrentPlayerReferee()) dlg.m_nPlayer = CPlayerManager::GetPlayerNumFromMask(pDoc->GetCurrentPlayerMask()); - if (dlg.DoModal() != IDOK) + if (dlg.ShowModal() != wxID_OK) return; - DWORD dwNewOwnerMask = CPlayerManager::GetMaskFromPlayerNum(dlg.m_nPlayer); + PlayerMask dwNewOwnerMask = CPlayerManager::GetMaskFromPlayerNum(dlg.m_nPlayer); CPoint pntCenter(MidPnt(rct.left, rct.right), MidPnt(rct.top, rct.bottom)); @@ -2388,7 +2411,7 @@ void CPlayBoardView::OnUpdateActSetOwner(CCmdUI* pCmdUI) else { pCmdUI->Enable(pDoc->HasPlayers() && - (m_selList.HasPieces() && pDoc->GetCurrentPlayerMask() != 0)); + (m_selList.HasPieces() && pDoc->GetCurrentPlayerMask() != OWNER_MASK_SPECTATOR)); } } diff --git a/GP/VwPbrd1.cpp b/GP/VwPbrd1.cpp index a235c50..a76fc70 100644 --- a/GP/VwPbrd1.cpp +++ b/GP/VwPbrd1.cpp @@ -71,7 +71,7 @@ void CPlayBoardView::DoToolTipHitProcessing(CPoint pointClient) { CPieceObj* pPObj = (CPieceObj*)pDObj; if (pPObj->IsOwned() && - !pDoc->GetPieceTable()->IsPieceInvisible(pPObj->m_pid)) + !pDoc->GetPieceTable().IsPieceInvisible(pPObj->m_pid)) { CB::string strOwner = pDoc->GetPieceOwnerName(pPObj->m_pid); CB::string strOwnedBy = CB::string::Format(IDS_TIP_OWNED_BY_UC, strOwner); @@ -106,7 +106,7 @@ void CPlayBoardView::DoToolTipHitProcessing(CPoint pointClient) { CPieceObj* pPObj = (CPieceObj*)pDObj; if (pPObj->IsOwned() && - !pDoc->GetPieceTable()->IsPieceInvisible(pPObj->m_pid)) + !pDoc->GetPieceTable().IsPieceInvisible(pPObj->m_pid)) { CB::string strOwner = pDoc->GetPieceOwnerName(pPObj->m_pid); CB::string strOwnedBy = CB::string::Format(IDS_TIP_OWNED_BY_UC, strOwner); @@ -242,7 +242,7 @@ void CPlayBoardView::SelectWithinRect(CRect rctNet, BOOL bInclIntersects) if (pObj.GetType() == CDrawObj::drawPieceObj) { CPieceObj& pPObj = static_cast(pObj); - DWORD dwCurrentPlayer = pDoc->GetCurrentPlayerMask(); + PlayerMask dwCurrentPlayer = pDoc->GetCurrentPlayerMask(); bOwnedByCurrentPlayer = !pPObj.IsOwned() || pPObj.IsOwnedBy(dwCurrentPlayer) || m_pPBoard->IsNonOwnerAccessAllowed(); @@ -293,7 +293,7 @@ void CPlayBoardView::SelectAllUnderPoint(CPoint point) if (pObj.GetType() == CDrawObj::drawPieceObj) { CPieceObj& pPObj = static_cast(pObj); - DWORD dwCurrentPlayer = GetDocument()->GetCurrentPlayerMask(); + PlayerMask dwCurrentPlayer = GetDocument()->GetCurrentPlayerMask(); bOwnedByCurrentPlayer = !pPObj.IsOwned() || pPObj.IsOwnedBy(dwCurrentPlayer); } diff --git a/GP/VwPrjga1.cpp b/GP/VwPrjga1.cpp index c42cce6..6ba3dcc 100644 --- a/GP/VwPrjga1.cpp +++ b/GP/VwPrjga1.cpp @@ -98,7 +98,7 @@ void CGamProjView::DoBoardView() ASSERT(m_listProj.GetItemGroupCode(nSel) == grpBrd); size_t nBrd = m_listProj.GetItemSourceCode(nSel); - CPlayBoard& pPBoard = pDoc->GetPBoardManager()->GetPBoard(nBrd); + CPlayBoard& pPBoard = pDoc->GetPBoardManager().GetPBoard(nBrd); if (pPBoard.IsPrivate() && pPBoard.IsOwnedButNotByCurrentPlayer(*pDoc)) { diff --git a/GP/VwPrjgam.cpp b/GP/VwPrjgam.cpp index 7f6afbd..7e440ba 100644 --- a/GP/VwPrjgam.cpp +++ b/GP/VwPrjgam.cpp @@ -1,6 +1,6 @@ // VwPrjgam.cpp : Game Project View // -// Copyright (c) 1994-2023 By Dale L. Larson & William Su, All Rights Reserved. +// Copyright (c) 1994-2025 By Dale L. Larson & William Su, All Rights Reserved. // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the @@ -136,7 +136,7 @@ int CGamProjView::Find(BoardID bid) const if (m_listProj.GetItemGroupCode(i) == grpBrd) { size_t nBrd = m_listProj.GetItemSourceCode(i); - const CPlayBoard& pPBoard = doc.GetPBoardManager()->GetPBoard(nBrd); + const CPlayBoard& pPBoard = doc.GetPBoardManager().GetPBoard(nBrd); if (pPBoard.GetBoard()->GetSerialNumber() == bid) { return i; @@ -194,15 +194,14 @@ void CGamProjView::OnInitialUpdate() GetDocument()->DoInitialUpdate(); // Since UpdateAllViews isn't virtual CView::OnInitialUpdate(); CGamDoc* pDoc = GetDocument(); - CPBoardManager* pPBMgr = pDoc->GetPBoardManager(); - ASSERT(pPBMgr); + CPBoardManager& pPBMgr = pDoc->GetPBoardManager(); // Only honor the open-on-load flags if the save window state // is disabled. if (!pDoc->m_bSaveWindowPositions) { - for (size_t i = 0; i < pPBMgr->GetNumPBoards(); i++) + for (size_t i = size_t(0); i < pPBMgr.GetNumPBoards(); i++) { - CPlayBoard& pPBoard = pPBMgr->GetPBoard(i); + CPlayBoard& pPBoard = pPBMgr.GetPBoard(i); if (pPBoard.m_bOpenBoardOnLoad) { // Defer opening the view until our view init @@ -415,7 +414,7 @@ void CGamProjView::DoUpdateProjectList(BOOL bUpdateItem /* = TRUE */) CB::string str = CB::string::LoadString(IDS_PHEAD_GAM_DOCTYPE); if (pDoc->HasPlayers()) { - if (pDoc->GetCurrentPlayerMask() == 0) + if (pDoc->GetCurrentPlayerMask() == OWNER_MASK_SPECTATOR) { CB::string strSpec = CB::string::LoadString(IDS_PHEAD_SPECTATOR_OWNED); str += strSpec; @@ -439,22 +438,21 @@ void CGamProjView::DoUpdateProjectList(BOOL bUpdateItem /* = TRUE */) str = CB::string::LoadString(IDS_PHEAD_GAM_BOARDS); m_listProj.AddItem(grpBrdHdr, str); - CPBoardManager* pPBMgr = pDoc->GetPBoardManager(); - ASSERT(pPBMgr); - for (size_t i = 0; i < pPBMgr->GetNumPBoards(); i++) + CPBoardManager& pPBMgr = pDoc->GetPBoardManager(); + for (size_t i = size_t(0); i < pPBMgr.GetNumPBoards(); i++) { static int bDisplayIDs = -1; if (bDisplayIDs == -1) { bDisplayIDs = GetApp()->GetProfileInt("Settings"_cbstring, "DisplayIDs"_cbstring, 0); } - CPlayBoard& pPBoard = pPBMgr->GetPBoard(i); + CPlayBoard& pPBoard = pPBMgr.GetPBoard(i); str = pPBoard.GetBoard()->GetName(); if (bDisplayIDs) { CB::string strTmp = std::move(str); str = std::format("[{}] {}", - pPBMgr->GetPBoard(i).GetBoard()->GetSerialNumber(), strTmp); + pPBMgr.GetPBoard(i).GetBoard()->GetSerialNumber(), strTmp); } if (pPBoard.IsOwned()) { @@ -780,7 +778,7 @@ void CGamProjView::OnUpdateProjItemExport(CCmdUI* pCmdUI) LRESULT CGamProjView::OnMessageShowPlayingBoard(WPARAM wParam, LPARAM) { CGamDoc* pDoc = GetDocument(); - CPlayBoard& pPBoard = pDoc->GetPBoardManager()->GetPBoard(value_preserving_cast(wParam)); + CPlayBoard& pPBoard = pDoc->GetPBoardManager().GetPBoard(value_preserving_cast(wParam)); ASSERT(pPBoard.m_bOpenBoardOnLoad); pDoc->CreateNewFrame(GetApp()->m_pBrdViewTmpl, pPBoard.GetBoard()->GetName(), &pPBoard); diff --git a/GP/VwPrjgs1.cpp b/GP/VwPrjgs1.cpp index 7e1352a..d6b7292 100644 --- a/GP/VwPrjgs1.cpp +++ b/GP/VwPrjgs1.cpp @@ -1,6 +1,6 @@ // VwPrjgs1.cpp : Scenario View Support Routines // -// Copyright (c) 1994-2023 By Dale L. Larson & William Su, All Rights Reserved. +// Copyright (c) 1994-2025 By Dale L. Larson & William Su, All Rights Reserved. // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the @@ -95,7 +95,7 @@ void CGsnProjView::DoBoardView() ASSERT(m_listProj.GetItemGroupCode(nSel) == grpBrd); size_t nBrd = m_listProj.GetItemSourceCode(nSel); - CPlayBoard& pPBoard = pDoc->GetPBoardManager()->GetPBoard(nBrd); + CPlayBoard& pPBoard = pDoc->GetPBoardManager().GetPBoard(nBrd); CView* pView = pDoc->FindPBoardView(pPBoard); if (pView != NULL) { @@ -120,7 +120,7 @@ void CGsnProjView::DoBoardRemove() ASSERT(m_listProj.GetItemGroupCode(nSel) == grpBrd); size_t nBrd = m_listProj.GetItemSourceCode(nSel); - pDoc->GetPBoardManager()->DeletePBoard(nBrd); + pDoc->GetPBoardManager().DeletePBoard(nBrd); pDoc->SetModifiedFlag(TRUE); pDoc->UpdateAllViews(NULL, HINT_BOARDCHANGE); } @@ -154,10 +154,10 @@ void CGsnProjView::DoTrayProperty() CTrayPropDialog dlg; dlg.m_nYSel = nGrp; - dlg.m_pYMgr = pDoc->GetTrayManager(); + dlg.m_pYMgr = &pDoc->GetTrayManager(); dlg.m_pPlayerMgr = pDoc->GetPlayerManager(); - CTraySet& pYGrp = pDoc->GetTrayManager()->GetTraySet(nGrp); + CTraySet& pYGrp = pDoc->GetTrayManager().GetTraySet(nGrp); dlg.m_bRandomSel = pYGrp.IsRandomPiecePull(); dlg.m_bRandomSide = pYGrp.IsRandomSidePull(); dlg.SetTrayViz(pYGrp.GetTrayContentVisibility()); @@ -191,10 +191,10 @@ void CGsnProjView::DoTrayEdit() { CGamDoc* pDoc = GetDocument(); int nSel = m_listProj.GetCurSel(); - ASSERT(nSel >= 0); - ASSERT(m_listProj.GetItemGroupCode(nSel) == grpTray); + wxASSERT(nSel >= 0); + wxASSERT(m_listProj.GetItemGroupCode(nSel) == grpTray); size_t nGrp = m_listProj.GetItemSourceCode(nSel); - CTrayManager* pYMgr = pDoc->GetTrayManager(); + CTrayManager& pYMgr = pDoc->GetTrayManager(); CSetPiecesDialog dlg(*pDoc); dlg.m_nYSel = value_preserving_cast(nGrp); @@ -202,7 +202,7 @@ void CGsnProjView::DoTrayEdit() m_listTrays->SetItemMap(NULL); // Clear this since repaint may fail... pDoc->CloseTrayPalettes(); // ...Ditto that for tray palettes - dlg.DoModal(); + dlg.ShowModal(); // Notify all visible trays CGamDocHint hint; @@ -214,24 +214,24 @@ void CGsnProjView::DoTrayEdit() void CGsnProjView::DoTrayDelete() { CGamDoc* pDoc = GetDocument(); - CTrayManager *pYMgr = pDoc->GetTrayManager(); - CPieceTable *pPTbl = pDoc->GetPieceTable(); + CTrayManager& pYMgr = pDoc->GetTrayManager(); + CPieceTable& pPTbl = pDoc->GetPieceTable(); int nSel = m_listProj.GetCurSel(); ASSERT(nSel >= 0); ASSERT(m_listProj.GetItemGroupCode(nSel) == grpTray); size_t nGrp = m_listProj.GetItemSourceCode(nSel); - if (!pYMgr->GetTraySet(nGrp).IsEmpty()) + if (!pYMgr.GetTraySet(nGrp).IsEmpty()) { if (AfxMessageBox(IDS_ERR_TRAYHASPIECES, MB_OKCANCEL | MB_ICONEXCLAMATION) != IDOK) return; // Mark those pieces as unused. - pPTbl->SetPieceListAsUnused( - pYMgr->GetTraySet(nGrp).GetPieceIDTable()); + pPTbl.SetPieceListAsUnused( + pYMgr.GetTraySet(nGrp).GetPieceIDTable()); } - pYMgr->DeleteTraySet(nGrp); + pYMgr.DeleteTraySet(nGrp); CGamDocHint hint; hint.GetArgs().m_pTray = NULL; pDoc->UpdateAllViews(NULL, HINT_TRAYCHANGE, &hint); @@ -252,7 +252,7 @@ void CGsnProjView::DoUpdateTrayList() ASSERT(m_listProj.GetItemGroupCode(nSel) == grpTray); size_t nGrp = m_listProj.GetItemSourceCode(nSel); - CTraySet& pYGrp = pDoc->GetTrayManager()->GetTraySet(nGrp); + CTraySet& pYGrp = pDoc->GetTrayManager().GetTraySet(nGrp); const std::vector& pLstMap = pYGrp.GetPieceIDTable(); m_listTrays->SetItemMap(&pLstMap); } diff --git a/GP/VwPrjgsn.cpp b/GP/VwPrjgsn.cpp index d36dd39..70430f7 100644 --- a/GP/VwPrjgsn.cpp +++ b/GP/VwPrjgsn.cpp @@ -1,6 +1,6 @@ // VwPrjgsn.cpp : Scenario Project View // -// Copyright (c) 1994-2023 By Dale L. Larson & William Su, All Rights Reserved. +// Copyright (c) 1994-2025 By Dale L. Larson & William Su, All Rights Reserved. // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the @@ -173,15 +173,14 @@ void CGsnProjView::OnInitialUpdate() GetDocument()->DoInitialUpdate(); // Since UpdateAllViews isn't virtual CView::OnInitialUpdate(); CGamDoc* pDoc = GetDocument(); - CPBoardManager* pPBMgr = pDoc->GetPBoardManager(); - ASSERT(pPBMgr); + CPBoardManager& pPBMgr = pDoc->GetPBoardManager(); // Only honor the open-on-load flags if the save window state // is disabled. if (!pDoc->m_bSaveWindowPositions) { - for (size_t i = 0; i < pPBMgr->GetNumPBoards(); i++) + for (size_t i = size_t(0); i < pPBMgr.GetNumPBoards(); i++) { - CPlayBoard& pPBoard = pPBMgr->GetPBoard(i); + CPlayBoard& pPBoard = pPBMgr.GetPBoard(i); if (pPBoard.m_bOpenBoardOnLoad) { // Defer opening the view until our view init @@ -421,11 +420,10 @@ void CGsnProjView::DoUpdateProjectList(BOOL bUpdateItem /* = TRUE */) str = CB::string::LoadString(IDS_PHEAD_GSN_BOARDS); m_listProj.AddItem(grpBrdHdr, str); - CPBoardManager* pPBMgr = pDoc->GetPBoardManager(); - ASSERT(pPBMgr); - for (size_t i = 0; i < pPBMgr->GetNumPBoards(); i++) + CPBoardManager& pPBMgr = pDoc->GetPBoardManager(); + for (size_t i = size_t(0); i < pPBMgr.GetNumPBoards(); i++) { - CPlayBoard& pPBoard = pPBMgr->GetPBoard(i); + CPlayBoard& pPBoard = pPBMgr.GetPBoard(i); str = pPBoard.GetBoard()->GetName(); if (bDisplayIDs) { @@ -447,11 +445,10 @@ void CGsnProjView::DoUpdateProjectList(BOOL bUpdateItem /* = TRUE */) str = CB::string::LoadString(IDS_PHEAD_GSN_TRAYS); m_listProj.AddItem(grpTrayHdr, str); - CTrayManager* pYMgr = pDoc->GetTrayManager(); - ASSERT(pYMgr); - for (size_t i = 0; i < pYMgr->GetNumTraySets(); i++) + CTrayManager& pYMgr = pDoc->GetTrayManager(); + for (size_t i = size_t(0); i < pYMgr.GetNumTraySets(); i++) { - CTraySet& pYSet = pYMgr->GetTraySet(i); + CTraySet& pYSet = pYMgr.GetTraySet(i); str = pYSet.GetName(); if (bDisplayIDs) { @@ -748,7 +745,7 @@ void CGsnProjView::OnUpdateProjItemView(CCmdUI* pCmdUI) LRESULT CGsnProjView::OnMessageShowPlayingBoard(WPARAM wParam, LPARAM) { CGamDoc* pDoc = GetDocument(); - CPlayBoard& pPBoard = pDoc->GetPBoardManager()->GetPBoard(value_preserving_cast(wParam)); + CPlayBoard& pPBoard = pDoc->GetPBoardManager().GetPBoard(value_preserving_cast(wParam)); ASSERT(pPBoard.m_bOpenBoardOnLoad); pDoc->CreateNewFrame(GetApp()->m_pBrdViewTmpl, pPBoard.GetBoard()->GetName(), &pPBoard); diff --git a/GP/WStateGp.cpp b/GP/WStateGp.cpp index c82902e..ea37644 100644 --- a/GP/WStateGp.cpp +++ b/GP/WStateGp.cpp @@ -47,7 +47,7 @@ CWnd* CGpWinStateMgr::OnGetFrameForWinStateElement(const CWinStateElement& pWse) else if (pWse.m_wUserCode1 == gpFrmPlayBoard) { // The second user code is the board's serial number. - CPlayBoard& pPBoard = CheckedDeref(pDoc->GetPBoardManager()->GetPBoardBySerial(pWse.m_boardID)); + CPlayBoard& pPBoard = CheckedDeref(pDoc->GetPBoardManager().GetPBoardBySerial(pWse.m_boardID)); CView* pView = pDoc->FindPBoardView(pPBoard); if (pView == NULL) { diff --git a/GShr/CyberBoard.h b/GShr/CyberBoard.h index 7202ede..5bbf03d 100644 --- a/GShr/CyberBoard.h +++ b/GShr/CyberBoard.h @@ -66,6 +66,7 @@ #include #include #include +#include #include #include #include @@ -75,9 +76,10 @@ #include #include #include -#include #include "wx/dcprint.h" #include +#include +#include #include #include #include @@ -87,6 +89,7 @@ #include #include #include +#include #include #include #include @@ -1089,6 +1092,9 @@ namespace CB inline string operator+(string lhs, const char* rhs) { return lhs += static_cast(rhs); } inline string operator+(const char* lhs, const string& rhs) { return static_cast(lhs) + rhs; } inline string operator+(string lhs, const CString& rhs) { return lhs += static_cast(rhs); } + inline string operator+(string lhs, const wxString& rhs) { return lhs += static_cast(rhs); } + inline string operator+(string lhs, const ::std::string& rhs) { return lhs += static_cast(rhs); } + inline string operator+(string lhs, const ::std::wstring& rhs) { return lhs += static_cast(rhs); } inline string operator+(char lhs, const string& rhs) { return string(size_t(1), lhs) += rhs; } // not impl yet inline string operator+(wchar_t lhs, const string& rhs) = delete; @@ -1924,7 +1930,6 @@ static_assert(std::is_same_v::iterator::difference_type, ptrdif // adapt between CWnd and wxWindow namespace CB { -#if 0 class wxNativeContainerWindowMixin { public: @@ -1960,7 +1965,6 @@ namespace CB /* if mfcWnd or one of its descendants has wxNativeContainerWindowMixin, return it */ wxWindow* FindWxWindow(CWnd& mfcWnd); -#endif // emulate CWnd::SendMessageToDescendants() void SendEventToDescendants(wxWindow& wnd, wxEvent& event, bool deep = true); @@ -2045,6 +2049,9 @@ namespace CB // validators. // for CB, forward events to window here bool TryBefore(wxEvent& event) override; + + void FileHistoryAddMenu(); + void FileHistoryRemoveMenu(); }; } @@ -2097,9 +2104,9 @@ namespace CB } template>> - wxTextCtrl& SetValidator(wxTextCtrl& ctrl, VAR& var, VAR min, VAR max) + wxTextCtrl& SetValidator(wxTextCtrl& ctrl, VAR& var, VAR min, VAR max, int style = wxNUM_VAL_DEFAULT) { - ctrl.SetValidator(CB::MakeValidator(var, min, max)); + ctrl.SetValidator(CB::MakeValidator(var, min, max, style)); return ctrl; } diff --git a/GShr/DragDrop.h b/GShr/DragDrop.h index ec259bc..9277139 100644 --- a/GShr/DragDrop.h +++ b/GShr/DragDrop.h @@ -249,21 +249,21 @@ struct DragInfoWx wxSize m_size; const CGamDoc* m_gamDoc; }; -#if 0 template<> struct SubInfo { PieceID m_pieceID; - CSize m_size; + wxSize m_size; const CGamDoc* m_gamDoc; }; template<> struct SubInfo { const std::vector* m_pieceIDList; - CSize m_size; + wxSize m_size; const CGamDoc* m_gamDoc; }; +#if 0 template<> struct SubInfo { @@ -290,9 +290,9 @@ struct DragInfoWx { SubInfo m_tile; SubInfo m_tileList; -#if 0 SubInfo m_piece; SubInfo m_pieceList; +#if 0 SubInfo m_marker; SubInfo m_selectList; SubInfo m_selectView; diff --git a/GShr/DrawObj.cpp b/GShr/DrawObj.cpp index 8d851e8..f6856df 100644 --- a/GShr/DrawObj.cpp +++ b/GShr/DrawObj.cpp @@ -1,6 +1,6 @@ // DrawObj.cpp // -// Copyright (c) 1994-2024 By Dale L. Larson & William Su, All Rights Reserved. +// Copyright (c) 1994-2025 By Dale L. Larson & William Su, All Rights Reserved. // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the @@ -1677,16 +1677,15 @@ void CPieceObj::Draw(CDC& pDC, TileScale eScale) { ASSERT(m_pDoc != NULL); CTileManager& pTMgr = m_pDoc->GetTileManager(); - CPieceTable* pPTbl = m_pDoc->GetPieceTable(); - ASSERT(pPTbl != NULL); + CPieceTable& pPTbl = m_pDoc->GetPieceTable(); TileID tid; if (!m_pDoc->IsScenario() && - pPTbl->IsOwnedButNotByCurrentPlayer(m_pid, *m_pDoc)) - tid = pPTbl->GetFrontTileID(m_pid, TRUE); + pPTbl.IsOwnedButNotByCurrentPlayer(m_pid, *m_pDoc)) + tid = pPTbl.GetFrontTileID(m_pid, TRUE); else - tid = pPTbl->GetActiveTileID(m_pid, TRUE); // Show rotations + tid = pPTbl.GetActiveTileID(m_pid, TRUE); // Show rotations ASSERT(tid != nullTid); CPoint pnt = GetRect().TopLeft(); @@ -1697,7 +1696,7 @@ void CPieceObj::Draw(wxDC& pDC, TileScale eScale) { wxASSERT(m_pDoc != NULL); CTileManager& pTMgr = m_pDoc->GetTileManager(); - CPieceTable& pPTbl = CheckedDeref(m_pDoc->GetPieceTable()); + CPieceTable& pPTbl = m_pDoc->GetPieceTable(); TileID tid; @@ -1712,36 +1711,32 @@ void CPieceObj::Draw(wxDC& pDC, TileScale eScale) DrawObjTile(pDC, pnt, pTMgr, tid, eScale); } -void CPieceObj::SetOwnerMask(DWORD dwMask) +void CPieceObj::SetOwnerMask(PlayerMask dwMask) { - ASSERT(m_pDoc != NULL); - CPieceTable* pPTbl = m_pDoc->GetPieceTable(); - ASSERT(pPTbl != NULL); - pPTbl->SetOwnerMask(m_pid, dwMask); + wxASSERT(m_pDoc != NULL); + CPieceTable& pPTbl = m_pDoc->GetPieceTable(); + pPTbl.SetOwnerMask(m_pid, dwMask); } BOOL CPieceObj::IsOwned() const { ASSERT(m_pDoc != NULL); - CPieceTable* pPTbl = m_pDoc->GetPieceTable(); - ASSERT(pPTbl != NULL); - return pPTbl->IsPieceOwned(m_pid); + CPieceTable& pPTbl = m_pDoc->GetPieceTable(); + return pPTbl.IsPieceOwned(m_pid); } -BOOL CPieceObj::IsOwnedBy(DWORD dwMask) const +BOOL CPieceObj::IsOwnedBy(PlayerMask dwMask) const { - ASSERT(m_pDoc != NULL); - CPieceTable* pPTbl = m_pDoc->GetPieceTable(); - ASSERT(pPTbl != NULL); - return pPTbl->IsPieceOwnedBy(m_pid, dwMask); + wxASSERT(m_pDoc != NULL); + CPieceTable& pPTbl = m_pDoc->GetPieceTable(); + return pPTbl.IsPieceOwnedBy(m_pid, dwMask); } BOOL CPieceObj::IsOwnedButNotByCurrentPlayer() const { ASSERT(m_pDoc != NULL); - CPieceTable* pPTbl = m_pDoc->GetPieceTable(); - ASSERT(pPTbl != NULL); - return pPTbl->IsOwnedButNotByCurrentPlayer(m_pid, *m_pDoc); + CPieceTable& pPTbl = m_pDoc->GetPieceTable(); + return pPTbl.IsOwnedButNotByCurrentPlayer(m_pid, *m_pDoc); } void CPieceObj::SetPiece(const CRect& rct, PieceID pid) @@ -1754,16 +1749,15 @@ CSize CPieceObj::GetSize() const { ASSERT(m_pDoc != NULL); CTileManager& pTMgr = m_pDoc->GetTileManager(); - CPieceTable* pPTbl = m_pDoc->GetPieceTable(); - ASSERT(pPTbl != NULL); + CPieceTable& pPTbl = m_pDoc->GetPieceTable(); TileID tid; - if (pPTbl->IsPieceOwned(m_pid) && - !pPTbl->IsPieceOwnedBy(m_pid, m_pDoc->GetCurrentPlayerMask())) - tid = pPTbl->GetFrontTileID(m_pid, TRUE); + if (pPTbl.IsPieceOwned(m_pid) && + !pPTbl.IsPieceOwnedBy(m_pid, m_pDoc->GetCurrentPlayerMask())) + tid = pPTbl.GetFrontTileID(m_pid, TRUE); else - tid = pPTbl->GetActiveTileID(m_pid, TRUE); + tid = pPTbl.GetActiveTileID(m_pid, TRUE); ASSERT(tid != nullTid); CTile tile = pTMgr.GetTile(tid); @@ -1863,10 +1857,10 @@ TileID CMarkObj::GetCurrentTileID() { // Handle rotated markers... ElementState state(m_mid, m_nFacingDegCW); - CTileFacingMap* pMapFacing = m_pDoc->GetFacingMap(); - TileID tidFacing = pMapFacing->GetFacingTileID(state); + CTileFacingMap& pMapFacing = m_pDoc->GetFacingMap(); + TileID tidFacing = pMapFacing.GetFacingTileID(state); if (tidFacing == nullTid) - tidFacing = pMapFacing->CreateFacingTileID(state, pMark.m_tid); + tidFacing = pMapFacing.CreateFacingTileID(state, pMark.m_tid); return tidFacing; } else @@ -2326,7 +2320,7 @@ void CDrawList::RemoveObject(const CDrawObj& pDrawObj) #ifdef GPLAY -void CDrawList::SetOwnerMasks(DWORD dwOwnerMask) +void CDrawList::SetOwnerMasks(PlayerMask dwOwnerMask) { for (iterator pos = begin(); pos != end(); ++pos) { diff --git a/GShr/DrawObj.h b/GShr/DrawObj.h index 5b17be0..10624cd 100644 --- a/GShr/DrawObj.h +++ b/GShr/DrawObj.h @@ -38,6 +38,9 @@ #if !defined(_MARKS_H) && defined(GPLAY) #include "Marks.h" #endif +#if defined(GPLAY) +#include "Player.h" +#endif class CSelection; @@ -971,9 +974,9 @@ class CPieceObj : public CDrawObj void SetPiece(const CRect& rct, PieceID pid); BOOL IsOwned() const; - BOOL IsOwnedBy(DWORD dwMask) const; + BOOL IsOwnedBy(PlayerMask dwMask) const; BOOL IsOwnedButNotByCurrentPlayer() const; - void SetOwnerMask(DWORD dwMask); + void SetOwnerMask(PlayerMask dwMask); virtual enum CDrawObjType GetType() const override { return drawPieceObj; } virtual ObjectID GetObjectID() const override { return static_cast(m_pid); } @@ -1126,7 +1129,7 @@ class CDrawList : private std::list void ArrangeObjectPtrTableInDrawOrder(std::vector>& pTbl) const; void ArrangeObjectPtrTableInVisualOrder(std::vector>& pTbl) const; #ifdef GPLAY - void SetOwnerMasks(DWORD dwOwnerMask); + void SetOwnerMasks(PlayerMask dwOwnerMask); const CPieceObj* FindPieceID(PieceID pid) const; CPieceObj* FindPieceID(PieceID pid) diff --git a/GShr/GdiTools.cpp b/GShr/GdiTools.cpp index d8d8228..4c7dfa9 100644 --- a/GShr/GdiTools.cpp +++ b/GShr/GdiTools.cpp @@ -355,7 +355,7 @@ wxBitmap CutBitmapPiece(wxBitmap& pbmSrc, wxRect rctSrc, wxASSERT(!rct.IsEmpty()); wxBitmap pbmDst = pbmSrc.GetSubBitmap(rct); - if (crVoided != noColor) + if (crVoided != noColorWx) { wxMemoryDC dc(pbmSrc); dc.SetPen(crVoided); diff --git a/GShr/GdiTools.h b/GShr/GdiTools.h index 7c5b80f..14615a1 100644 --- a/GShr/GdiTools.h +++ b/GShr/GdiTools.h @@ -70,6 +70,7 @@ static_assert(sizeof(WIN_RGBTRIO) == 3 && //////////////////////////////////////////////////////////////////// const COLORREF noColor = 0xFF000000; +const wxColour noColorWx = CB::Convert(noColor); //////////////////////////////////////////////////////////////////// diff --git a/GShr/LibMfc.cpp b/GShr/LibMfc.cpp index 42151fb..5686afc 100644 --- a/GShr/LibMfc.cpp +++ b/GShr/LibMfc.cpp @@ -81,19 +81,16 @@ BOOL FindWindowForProcessIDAndBringToFront(DWORD dwProcessID) ///////////////////////////////////////////////////////////////////////////// -BOOL AppendStringToEditBox(CEdit& edit, const CB::string& strAppend, +BOOL AppendStringToEditBox(wxTextCtrl& edit, const CB::string& strAppend, BOOL bEnsureNewline /* = FALSE */) { if (bEnsureNewline) { -ASSERT(!"needs testing"); - CB::string str = CB::string::GetWindowText(edit); + CB::string str = edit.GetValue(); if (!str.empty() && str[str.a_size() - size_t(1)] != '\n') - AppendStringToEditBox(edit, L"\r\n", FALSE); + AppendStringToEditBox(edit, L"\n", FALSE); } - int nLen = edit.GetWindowTextLength(); - edit.SetSel(nLen, nLen); - edit.ReplaceSel(strAppend); + edit.AppendText(strAppend); return TRUE; } @@ -773,7 +770,6 @@ void CB::string::Serialize(CArchive& ar) #endif } -#if 0 CB::wxNativeContainerWindowMixin::operator const wxNativeContainerWindow*() const { if (!mfcWnd->m_hWnd) @@ -871,7 +867,6 @@ wxWindow* CB::FindWxWindow(CWnd& mfcWnd) } return wxWnd; } -#endif // emulate CWnd::SendMessageToDescendants() void CB::SendEventToDescendants(wxWindow& wnd, wxEvent& event, bool deep /*= true*/) @@ -989,6 +984,35 @@ bool CB::wxView::TryBefore(wxEvent& event) return GetWindow().ProcessWindowEventLocally(event); } +void CB::wxView::FileHistoryAddMenu() +{ + wxFrame& frame = dynamic_cast(CheckedDeref(GetFrame())); + wxMenuBar& menubar = CheckedDeref(frame.GetMenuBar()); + wxMenu& menuFile = CheckedDeref(menubar.GetMenu(size_t(0))); + wxDocManager& docMgr = CheckedDeref(wxDocManager::GetDocumentManager()); + docMgr.FileHistoryUseMenu(&menuFile); + docMgr.FileHistoryAddFilesToMenu(&menuFile); + /*KLUDGE: MRU menu items don't always respect + wxFileHistoryMenuPathStyle without this */ + wxFileHistory& fileHist = CheckedDeref(docMgr.GetFileHistory()); + wxFileHistoryMenuPathStyle style = fileHist.GetMenuPathStyle(); + wxFileHistoryMenuPathStyle tempStyle = style == wxFH_PATH_SHOW_IF_DIFFERENT ? + wxFH_PATH_SHOW_NEVER + : + wxFH_PATH_SHOW_IF_DIFFERENT; + fileHist.SetMenuPathStyle(tempStyle); + fileHist.SetMenuPathStyle(style); +} + +void CB::wxView::FileHistoryRemoveMenu() +{ + wxFrame& frame = dynamic_cast(CheckedDeref(GetFrame())); + wxMenuBar& menubar = CheckedDeref(frame.GetMenuBar()); + wxMenu& menuFile = CheckedDeref(menubar.GetMenu(size_t(0))); + wxDocManager& docMgr = CheckedDeref(wxDocManager::GetDocumentManager()); + docMgr.FileHistoryRemoveMenu(&menuFile); +} + CB::ToolTip::~ToolTip() { Enable(false); diff --git a/GShr/LibMfc.h b/GShr/LibMfc.h index b99795b..2db0b07 100644 --- a/GShr/LibMfc.h +++ b/GShr/LibMfc.h @@ -43,7 +43,7 @@ class CDisableMainWindow HWND FindWindowForProcessID(DWORD dwProcessID); BOOL FindWindowForProcessIDAndBringToFront(DWORD dwProcessID); -BOOL AppendStringToEditBox(CEdit& edit, const CB::string& strAppend, +BOOL AppendStringToEditBox(wxTextCtrl& edit, const CB::string& strAppend, BOOL bEnsureNewline = FALSE); BOOL TranslateKeyToScrollBarMessage(CWnd* pWnd, UINT nChar); diff --git a/GShr/TileSht.cpp b/GShr/TileSht.cpp index f5bc4d2..d5ec57d 100644 --- a/GShr/TileSht.cpp +++ b/GShr/TileSht.cpp @@ -482,7 +482,7 @@ void CTileSheet::TransBltThruDIBSectMonoMask(wxDC& pDC, int xDst, int yDst, int wxNativePixelData::Iterator maskRowStart(pMaskBMapInfoData); for (int y = 0 ; - y < std::min(value_preserving_cast(m_size.cy).get_value(), pMaskBMapInfo.GetHeight()) && + y < std::min(value_preserving_cast(m_size.cy), pMaskBMapInfo.GetHeight()) && yDst + y < hBMapDest.GetHeight() ; ++y) { @@ -492,7 +492,7 @@ void CTileSheet::TransBltThruDIBSectMonoMask(wxDC& pDC, int xDst, int yDst, int wxAlphaPixelData::Iterator dest = destRowStart; wxNativePixelData::Iterator mask = maskRowStart; for (int x = 0 ; - x < std::min(value_preserving_cast(m_size.cx).get_value(), pMaskBMapInfo.GetWidth()) && + x < std::min(value_preserving_cast(m_size.cx), pMaskBMapInfo.GetWidth()) && xDst + x < hBMapDest.GetWidth() ; ++x) { @@ -512,7 +512,7 @@ void CTileSheet::TransBltThruDIBSectMonoMask(wxDC& pDC, int xDst, int yDst, int ++dest; } } - srcRowStart += srcStride.get_value(); + srcRowStart += srcStride; destRowStart.OffsetY(hBMapDestData, 1); maskRowStart.OffsetY(pMaskBMapInfoData, 1); } diff --git a/deps/wxWidgets b/deps/wxWidgets index 5a51e52..0396c26 160000 --- a/deps/wxWidgets +++ b/deps/wxWidgets @@ -1 +1 @@ -Subproject commit 5a51e52ef817b513dce0f24fee2dbd0ea5f921ab +Subproject commit 0396c2661f434176c5198f2cac84ef91e5f1b540