X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/1484b5cc701329c54bbe70f2a155119fd86945c7..b02a6dc2b6e10302272af502a12b249681df40d6:/contrib/samples/ogl/studio/studio.cpp diff --git a/contrib/samples/ogl/studio/studio.cpp b/contrib/samples/ogl/studio/studio.cpp index 48c0b44fd1..bbb4af14d5 100644 --- a/contrib/samples/ogl/studio/studio.cpp +++ b/contrib/samples/ogl/studio/studio.cpp @@ -95,10 +95,16 @@ bool csApp::OnInit(void) if (!wxResourceParseFile(_T("studio_resources.wxr"))) { wxMessageBox(_T("Could not find or parse resource file: studio_resources.wxr"), _T("Studio")); - return FALSE; + return false; } - m_helpController.Initialize(_T("studio.hlp")); +#if wxUSE_MS_HTML_HELP && !defined(__WXUNIVERSAL__) + m_helpController = new wxWinHelpController; +#else + m_helpController = new wxHtmlHelpController; +#endif + + m_helpController->Initialize(_T("studio.hlp")); ReadOptions(); @@ -119,9 +125,9 @@ bool csApp::OnInit(void) // area doesn't refresh properly when we change its position, under Windows. #define wxDEFAULT_FRAME_STYLE_NO_CLIP \ - (wxSYSTEM_MENU | wxRESIZE_BORDER | wxMINIMIZE_BOX | wxMAXIMIZE_BOX | wxTHICK_FRAME | wxSYSTEM_MENU | wxCAPTION) + (wxDEFAULT_FRAME_STYLE & ~wxCLIP_CHILDREN) - csFrame* frame = new csFrame(m_docManager, NULL, -1, _T("OGL Studio"), m_mainFramePos, m_mainFrameSize, + csFrame* frame = new csFrame(m_docManager, NULL, wxID_ANY, _T("OGL Studio"), m_mainFramePos, m_mainFrameSize, wxDEFAULT_FRAME_STYLE_NO_CLIP | wxHSCROLL | wxVSCROLL); // Give it an icon @@ -161,10 +167,12 @@ bool csApp::OnInit(void) frame->SetMenuBar(menuBar); // Load the file history - wxConfig config(_T("OGL Studio"), _T("wxWindows")); + wxConfig config(_T("OGL Studio"), _T("wxWidgets")); m_docManager->FileHistoryLoad(config); +#if wxUSE_STATUSBAR frame->CreateStatusBar(); +#endif // wxUSE_STATUSBAR // The ordering of these is important for layout purposes CreateDiagramToolBar(frame); @@ -184,11 +192,11 @@ bool csApp::OnInit(void) m_shapeEditMenu->AppendSeparator(); m_shapeEditMenu->Append(ID_CS_CUT, _T("Cut")); - frame->Show(TRUE); + frame->Show(true); SetTopWindow(frame); - return TRUE; + return true; } int csApp::OnExit(void) @@ -204,6 +212,9 @@ int csApp::OnExit(void) delete m_shapeEditMenu; m_shapeEditMenu = NULL; + delete m_helpController; + m_helpController = NULL; + wxOGLCleanUp(); return 0; @@ -217,7 +228,7 @@ int csApp::OnExit(void) wxMDIChildFrame *csApp::CreateChildFrame(wxDocument *doc, wxView *view, wxMenu** editMenuRet) { //// Make a child frame - csMDIChildFrame *subframe = new csMDIChildFrame(doc, view, ((wxDocMDIParentFrame*)GetTopWindow()), -1, _T("Child Frame"), + csMDIChildFrame *subframe = new csMDIChildFrame(doc, view, ((wxDocMDIParentFrame*)GetTopWindow()), wxID_ANY, _T("Child Frame"), wxPoint(10, 10), wxSize(300, 300), wxDEFAULT_FRAME_STYLE); #ifdef __WXMSW__ @@ -244,9 +255,7 @@ wxMDIChildFrame *csApp::CreateChildFrame(wxDocument *doc, wxView *view, wxMenu** fileMenu->AppendSeparator(); fileMenu->Append(wxID_EXIT, _T("E&xit")); - wxMenu *editMenu = NULL; - - editMenu = new wxMenu; + wxMenu* editMenu = new wxMenu; editMenu->Append(wxID_UNDO, _T("&Undo\tCtrl+Z")); editMenu->Append(wxID_REDO, _T("&Redo\tCtrl+Y")); editMenu->AppendSeparator(); @@ -288,7 +297,7 @@ wxMDIChildFrame *csApp::CreateChildFrame(wxDocument *doc, wxView *view, wxMenu** } // Creates a canvas. Called by OnInit as a child of the main window -csCanvas *csApp::CreateCanvas(wxView *view, wxFrame *parent) +csCanvas *csApp::CreateCanvas(wxView *view, wxMDIChildFrame *parent) { int width, height; parent->GetClientSize(&width, &height); @@ -338,28 +347,28 @@ void csApp::InitToolBar(wxToolBar* toolBar) #error "Not implemented for this platform." #endif - toolBar->AddTool(wxID_NEW, *bitmaps[0], wxNullBitmap, FALSE, -1, -1, NULL, _T("New file")); - toolBar->AddTool(wxID_OPEN, *bitmaps[1], wxNullBitmap, FALSE, -1, -1, NULL, _T("Open file")); - toolBar->AddTool(wxID_SAVE, *bitmaps[2], wxNullBitmap, FALSE, -1, -1, NULL, _T("Save file")); + toolBar->AddTool(wxID_NEW, *bitmaps[0], wxNullBitmap, false, wxDefaultCoord, wxDefaultCoord, NULL, _T("New file")); + toolBar->AddTool(wxID_OPEN, *bitmaps[1], wxNullBitmap, false, wxDefaultCoord, wxDefaultCoord, NULL, _T("Open file")); + toolBar->AddTool(wxID_SAVE, *bitmaps[2], wxNullBitmap, false, wxDefaultCoord, wxDefaultCoord, NULL, _T("Save file")); toolBar->AddSeparator(); - toolBar->AddTool(wxID_PRINT, *bitmaps[6], wxNullBitmap, FALSE, -1, -1, NULL, _T("Print")); + toolBar->AddTool(wxID_PRINT, *bitmaps[6], wxNullBitmap, false, wxDefaultCoord, wxDefaultCoord, NULL, _T("Print")); toolBar->AddSeparator(); - toolBar->AddTool(wxID_COPY, *bitmaps[3], wxNullBitmap, FALSE, -1, -1, NULL, _T("Copy")); - toolBar->AddTool(wxID_CUT, *bitmaps[4], wxNullBitmap, FALSE, -1, -1, NULL, _T("Cut")); - toolBar->AddTool(wxID_PASTE, *bitmaps[5], wxNullBitmap, FALSE, -1, -1, NULL, _T("Paste")); + toolBar->AddTool(wxID_COPY, *bitmaps[3], wxNullBitmap, false, wxDefaultCoord, wxDefaultCoord, NULL, _T("Copy")); + toolBar->AddTool(wxID_CUT, *bitmaps[4], wxNullBitmap, false, wxDefaultCoord, wxDefaultCoord, NULL, _T("Cut")); + toolBar->AddTool(wxID_PASTE, *bitmaps[5], wxNullBitmap, false, wxDefaultCoord, wxDefaultCoord, NULL, _T("Paste")); toolBar->AddSeparator(); - toolBar->AddTool(wxID_UNDO, *bitmaps[8], wxNullBitmap, FALSE, -1, -1, NULL, _T("Undo")); - toolBar->AddTool(wxID_REDO, *bitmaps[9], wxNullBitmap, FALSE, -1, -1, NULL, _T("Redo")); + toolBar->AddTool(wxID_UNDO, *bitmaps[8], wxNullBitmap, false, wxDefaultCoord, wxDefaultCoord, NULL, _T("Undo")); + toolBar->AddTool(wxID_REDO, *bitmaps[9], wxNullBitmap, false, wxDefaultCoord, wxDefaultCoord, NULL, _T("Redo")); toolBar->AddSeparator(); - toolBar->AddTool(wxID_HELP, *bitmaps[7], wxNullBitmap, FALSE, -1, -1, NULL, _T("Help")); + toolBar->AddTool(wxID_HELP, *bitmaps[7], wxNullBitmap, false, wxDefaultCoord, wxDefaultCoord, NULL, _T("Help")); toolBar->Realize(); - toolBar->EnableTool(wxID_COPY, FALSE); - toolBar->EnableTool(wxID_PASTE, FALSE); - toolBar->EnableTool(wxID_PRINT, FALSE); - toolBar->EnableTool(wxID_UNDO, FALSE); - toolBar->EnableTool(wxID_REDO, FALSE); + toolBar->EnableTool(wxID_COPY, false); + toolBar->EnableTool(wxID_PASTE, false); + toolBar->EnableTool(wxID_PRINT, false); + toolBar->EnableTool(wxID_UNDO, false); + toolBar->EnableTool(wxID_REDO, false); int i; for (i = 0; i < 10; i++) @@ -377,10 +386,10 @@ void csApp::CreateDiagramToolBar(wxFrame* parent) win->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE)); m_diagramToolBarSashWindow = win; - m_diagramToolBarSashWindow->Show(FALSE); + m_diagramToolBarSashWindow->Show(false); // Create the actual toolbar - m_diagramToolBar = new wxToolBar(win, -1, wxDefaultPosition, wxDefaultSize, wxTB_HORIZONTAL|wxNO_BORDER|wxTB_FLAT); + m_diagramToolBar = new wxToolBar(win, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTB_HORIZONTAL|wxNO_BORDER|wxTB_FLAT); wxBitmap* bitmaps[11]; @@ -412,18 +421,18 @@ void csApp::CreateDiagramToolBar(wxFrame* parent) #error "Not implemented for this platform." #endif - m_diagramToolBar->AddTool(DIAGRAM_TOOLBAR_ALIGNL, *bitmaps[0], wxNullBitmap, FALSE, -1, -1, NULL, _T("Align left")); - m_diagramToolBar->AddTool(DIAGRAM_TOOLBAR_ALIGNR, *bitmaps[1], wxNullBitmap, FALSE, -1, -1, NULL, _T("Align right")); - m_diagramToolBar->AddTool(DIAGRAM_TOOLBAR_ALIGNT, *bitmaps[2], wxNullBitmap, FALSE, -1, -1, NULL, _T("Align top")); - m_diagramToolBar->AddTool(DIAGRAM_TOOLBAR_ALIGNB, *bitmaps[3], wxNullBitmap, FALSE, -1, -1, NULL, _T("Align bottom")); - m_diagramToolBar->AddTool(DIAGRAM_TOOLBAR_ALIGN_HORIZ, *bitmaps[4], wxNullBitmap, FALSE, -1, -1, NULL, _T("Align horizontally")); - m_diagramToolBar->AddTool(DIAGRAM_TOOLBAR_ALIGN_VERT, *bitmaps[5], wxNullBitmap, FALSE, -1, -1, NULL, _T("Align vertically")); - m_diagramToolBar->AddTool(DIAGRAM_TOOLBAR_COPY_SIZE, *bitmaps[6], wxNullBitmap, FALSE, -1, -1, NULL, _T("Copy size")); + m_diagramToolBar->AddTool(DIAGRAM_TOOLBAR_ALIGNL, *bitmaps[0], wxNullBitmap, false, wxDefaultCoord, wxDefaultCoord, NULL, _T("Align left")); + m_diagramToolBar->AddTool(DIAGRAM_TOOLBAR_ALIGNR, *bitmaps[1], wxNullBitmap, false, wxDefaultCoord, wxDefaultCoord, NULL, _T("Align right")); + m_diagramToolBar->AddTool(DIAGRAM_TOOLBAR_ALIGNT, *bitmaps[2], wxNullBitmap, false, wxDefaultCoord, wxDefaultCoord, NULL, _T("Align top")); + m_diagramToolBar->AddTool(DIAGRAM_TOOLBAR_ALIGNB, *bitmaps[3], wxNullBitmap, false, wxDefaultCoord, wxDefaultCoord, NULL, _T("Align bottom")); + m_diagramToolBar->AddTool(DIAGRAM_TOOLBAR_ALIGN_HORIZ, *bitmaps[4], wxNullBitmap, false, wxDefaultCoord, wxDefaultCoord, NULL, _T("Align horizontally")); + m_diagramToolBar->AddTool(DIAGRAM_TOOLBAR_ALIGN_VERT, *bitmaps[5], wxNullBitmap, false, wxDefaultCoord, wxDefaultCoord, NULL, _T("Align vertically")); + m_diagramToolBar->AddTool(DIAGRAM_TOOLBAR_COPY_SIZE, *bitmaps[6], wxNullBitmap, false, wxDefaultCoord, wxDefaultCoord, NULL, _T("Copy size")); m_diagramToolBar->AddSeparator(); - m_diagramToolBar->AddTool(DIAGRAM_TOOLBAR_LINE_ARROW, *bitmaps[7], wxNullBitmap, TRUE, -1, -1, NULL, _T("Toggle arrow")); - m_diagramToolBar->AddTool(DIAGRAM_TOOLBAR_NEW_POINT, *bitmaps[8], wxNullBitmap, FALSE, -1, -1, NULL, _T("New line point")); - m_diagramToolBar->AddTool(DIAGRAM_TOOLBAR_CUT_POINT, *bitmaps[9], wxNullBitmap, FALSE, -1, -1, NULL, _T("Cut line point")); - m_diagramToolBar->AddTool(DIAGRAM_TOOLBAR_STRAIGHTEN, *bitmaps[10], wxNullBitmap, FALSE, -1, -1, NULL, _T("Straighten lines")); + m_diagramToolBar->AddTool(DIAGRAM_TOOLBAR_LINE_ARROW, *bitmaps[7], wxNullBitmap, true, wxDefaultCoord, wxDefaultCoord, NULL, _T("Toggle arrow")); + m_diagramToolBar->AddTool(DIAGRAM_TOOLBAR_NEW_POINT, *bitmaps[8], wxNullBitmap, false, wxDefaultCoord, wxDefaultCoord, NULL, _T("New line point")); + m_diagramToolBar->AddTool(DIAGRAM_TOOLBAR_CUT_POINT, *bitmaps[9], wxNullBitmap, false, wxDefaultCoord, wxDefaultCoord, NULL, _T("Cut line point")); + m_diagramToolBar->AddTool(DIAGRAM_TOOLBAR_STRAIGHTEN, *bitmaps[10], wxNullBitmap, false, wxDefaultCoord, wxDefaultCoord, NULL, _T("Straighten lines")); m_diagramToolBar->Realize(); @@ -493,7 +502,7 @@ void csApp::CreateDiagramToolBar(wxFrame* parent) // Read/write configuration information bool csApp::ReadOptions() { - wxConfig config(_T("OGL Studio"), _T("wxWindows")); + wxConfig config(_T("OGL Studio"), _T("wxWidgets")); config.Read(_T("mainX"), & m_mainFramePos.x); config.Read(_T("mainY"), & m_mainFramePos.y); @@ -502,12 +511,12 @@ bool csApp::ReadOptions() config.Read(_T("gridStyle"), & m_gridStyle); config.Read(_T("gridSpacing"), & m_gridSpacing); - return TRUE; + return true; } bool csApp::WriteOptions() { - wxConfig config(_T("OGL Studio"), _T("wxWindows")); + wxConfig config(_T("OGL Studio"), _T("wxWidgets")); config.Write(_T("mainX"), (long) m_mainFramePos.x); config.Write(_T("mainY"), (long) m_mainFramePos.y); @@ -518,6 +527,6 @@ bool csApp::WriteOptions() m_docManager->FileHistorySave(config); - return TRUE; + return true; }