Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions GM/DlgMedt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,7 @@ void CMarkerEditDialog::OnDblclkMarkers(wxCommandEvent& /*event*/)
bool CMarkerEditDialog::TransferDataToWindow()
{
ASSERT(m_pDoc);
m_pMMgr = m_pDoc->GetMarkManager();
ASSERT(m_pMMgr);
m_pMMgr = &m_pDoc->GetMarkManager();

m_listMarks->SetDocument(m_pDoc);

Expand All @@ -196,8 +195,7 @@ bool CMarkerEditDialog::TransferDataToWindow()
WORD wMarkFlags = m_pMMgr->GetMark(m_mid).m_flags;
m_chkPromptText->SetValue(wMarkFlags & MarkDef::flagPromptText);

m_pTMgr = m_pDoc->GetTileManager();
ASSERT(m_pTMgr);
m_pTMgr = &m_pDoc->GetTileManager();

m_listTiles->SetDocument(m_pDoc);

Expand Down
6 changes: 2 additions & 4 deletions GM/DlgMnew.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,13 +161,11 @@ void CMarkerCreateDialog::OnCreateMarker(wxCommandEvent& event)
void CMarkerCreateDialog::OnInitDialog(wxInitDialogEvent& event)
{
ASSERT(m_pDoc);
m_pMMgr = m_pDoc->GetMarkManager();
ASSERT(m_pMMgr);
m_pMMgr = &m_pDoc->GetMarkManager();

m_listMarks->SetDocument(m_pDoc);

m_pTMgr = m_pDoc->GetTileManager();
ASSERT(m_pTMgr);
m_pTMgr = &m_pDoc->GetTileManager();

m_listTiles->SetDocument(m_pDoc);

Expand Down
4 changes: 2 additions & 2 deletions GM/DlgPedt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ CPieceEditDialog::CPieceEditDialog(CGamDoc& doc, PieceID pid, wxWindow* parent /
m_pDoc(&doc),
m_pid(pid),
m_tbl(1, m_pid),
m_pTMgr(*m_pDoc->GetTileManager()),
m_pPMgr(m_pDoc->GetPieceManager())
m_pTMgr(m_pDoc->GetTileManager()),
m_pPMgr(&m_pDoc->GetPieceManager())
{
}

Expand Down
4 changes: 2 additions & 2 deletions GM/DlgPnew.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ CPieceNewDialog::CPieceNewDialog(CGamDoc& doc, size_t nPSet, wxWindow* parent /*
CB_XRC_END_CTRLS_DEFN(),
m_pDoc(&doc),
m_nPSet(nPSet),
m_pTMgr(*m_pDoc->GetTileManager()),
m_pPMgr(m_pDoc->GetPieceManager())
m_pTMgr(m_pDoc->GetTileManager()),
m_pPMgr(&m_pDoc->GetPieceManager())
{
wxSize editSize = m_editQty->GetSizeFromText("999");
m_editQty->SetInitialSize(editSize);
Expand Down
3 changes: 2 additions & 1 deletion GM/FrmBited.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ static char THIS_FILE[] = __FILE__;

IMPLEMENT_DYNCREATE(CBitEditFrame, CMDIChildWndEx)

CBitEditFrame::CBitEditFrame()
CBitEditFrame::CBitEditFrame() :
CB::wxNativeContainerWindowMixin(static_cast<CWnd&>(*this))
{
}

Expand Down
3 changes: 2 additions & 1 deletion GM/FrmBited.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ class CTileSelView;
/////////////////////////////////////////////////////////////////////////////
// CBitEditFrame frame

class CBitEditFrame : public CMDIChildWndEx
class CBitEditFrame : public CMDIChildWndEx,
public CB::wxNativeContainerWindowMixin
{
DECLARE_DYNCREATE(CBitEditFrame)
protected:
Expand Down
7 changes: 4 additions & 3 deletions GM/FrmBxdoc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ static char THIS_FILE[] = __FILE__;

IMPLEMENT_DYNCREATE(CDocFrame, CMDIChildWndEx)

CDocFrame::CDocFrame()
CDocFrame::CDocFrame() :
CB::wxNativeContainerWindowMixin(static_cast<CWnd&>(*this))
{
}

Expand Down Expand Up @@ -67,7 +68,7 @@ BOOL CDocFrame::PreCreateWindow(CREATESTRUCT& cs)

void CDocFrame::OnUpdateFrameTitle(BOOL bAddToTitle)
{
CGamDoc* pDoc = (CGamDoc*)GetActiveDocument();
CDocument* pDoc = GetActiveDocument();
CB::string str = pDoc->GetTitle();
str += " - ";
CB::string strType = CB::string::LoadString(IDS_PROJTYPE_GAMEBOX);
Expand All @@ -78,5 +79,5 @@ void CDocFrame::OnUpdateFrameTitle(BOOL bAddToTitle)
void CDocFrame::OnClose()
{
// Close the document when the main document window is closed.
((CGamDoc*)GetActiveDocument())->OnFileClose();
GetActiveDocument()->OnCmdMsg(ID_FILE_CLOSE, CN_COMMAND, nullptr, nullptr);
}
3 changes: 2 additions & 1 deletion GM/FrmBxdoc.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
/////////////////////////////////////////////////////////////////////////////
// CDocFrame frame

class CDocFrame : public CMDIChildWndEx
class CDocFrame : public CMDIChildWndEx,
public CB::wxNativeContainerWindowMixin
{
DECLARE_DYNCREATE(CDocFrame)
protected:
Expand Down
14 changes: 0 additions & 14 deletions GM/FrmMain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,20 +121,6 @@ int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
if (CMDIFrameWndEx::OnCreate(lpCreateStruct) == -1)
return -1;

/* KLUDGE: apparently wxNativeContainerWindow doesn't let
MFC receive WM_SIZE, but no WM_SIZE means no layout
update */
wxWindow* pThis = *this;
pThis->Bind(wxEVT_SIZE,
[this](wxSizeEvent& event)
{
/* wx args don't match WM_SIZE, but it looks
like specific args aren't critical */
CMDIFrameWndExCb::OnSize(0, 0, 0);
event.Skip();
}
);

CMDITabInfo mdiTabParams;
mdiTabParams.m_style = CMFCTabCtrl::STYLE_3D_VS2005; // other styles available...
mdiTabParams.m_bActiveTabCloseButton = TRUE; // set to FALSE to place close button at right of tab area
Expand Down
3 changes: 2 additions & 1 deletion GM/FrmView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ static char THIS_FILE[] = __FILE__;

IMPLEMENT_DYNCREATE(CViewFrame, CMDIChildWndEx)

CViewFrame::CViewFrame()
CViewFrame::CViewFrame() :
CB::wxNativeContainerWindowMixin(static_cast<CWnd&>(*this))
{
}

Expand Down
3 changes: 2 additions & 1 deletion GM/FrmView.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
/////////////////////////////////////////////////////////////////////////////
// CViewFrame frame

class CViewFrame : public CMDIChildWndEx
class CViewFrame : public CMDIChildWndEx,
public CB::wxNativeContainerWindowMixin
{
DECLARE_DYNCREATE(CViewFrame)
protected:
Expand Down
15 changes: 8 additions & 7 deletions GM/Gm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,8 @@ namespace {
wxXmlResource::Get()->InitAllHandlers();
wxCHECK(wxXmlResource::Get()->LoadFile(wxStandardPaths::Get().GetDataDir() + "/CBDesign.xrc"), false);

static OwnerPtr<wxDocManager> docManager = MakeOwner<wxDocManager>();

return true;
}
};
Expand Down Expand Up @@ -399,16 +401,16 @@ BOOL CGmApp::InitInstance()
// Register the application's document templates. Document templates
// serve as the connection between documents, frame windows and views.
AddDocTemplate(new CMultiDocTemplate(IDR_GAMEBOX,
RUNTIME_CLASS(CGamDoc),
RUNTIME_CLASS(CGamDocMfc),
RUNTIME_CLASS(CDocFrame),
RUNTIME_CLASS(CGbxProjViewContainer)));

m_pMapViewTmpl = new CMultiDocTemplate(IDR_BOARDVIEW,
RUNTIME_CLASS(CGamDoc), RUNTIME_CLASS(CViewFrame),
RUNTIME_CLASS(CGamDocMfc), RUNTIME_CLASS(CViewFrame),
RUNTIME_CLASS(CBrdEditViewContainer));

m_pTileEditTmpl = new CMultiDocTemplate(IDR_BITEDITOR,
RUNTIME_CLASS(CGamDoc), RUNTIME_CLASS(CBitEditFrame),
RUNTIME_CLASS(CGamDocMfc), RUNTIME_CLASS(CBitEditFrame),
RUNTIME_CLASS(CBitEditViewContainer));

EnableLoadWindowPlacement(FALSE);
Expand Down Expand Up @@ -629,10 +631,9 @@ BOOL CGmApp::OnIdle(LONG lCount)
POSITION pos2 = pTemplate->GetFirstDocPosition();
while (pos2)
{
CGamDoc* pDoc = (CGamDoc*)pTemplate->GetNextDoc(pos2);
ASSERT(pDoc != NULL);
ASSERT(pDoc->IsKindOf(RUNTIME_CLASS(CGamDoc)));
pDoc->OnIdle(bAppVisible && pDoc == pCurDoc);
CGamDoc* pDoc = CB::ToCGamDoc(pTemplate->GetNextDoc(pos2));
wxASSERT(pDoc != NULL);
pDoc->OnIdle(bAppVisible && pDoc == CB::ToCGamDoc(pCurDoc));

}
}
Expand Down
Loading