X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/c083688595507f3457d66b15721c568a8afc6552..3a39df31ff47004a46cfb06f3fb2d3e317f96d2b:/contrib/samples/ogl/studio/studio.cpp?ds=sidebyside diff --git a/contrib/samples/ogl/studio/studio.cpp b/contrib/samples/ogl/studio/studio.cpp index 4e45f3c01c..982a0bf50b 100644 --- a/contrib/samples/ogl/studio/studio.cpp +++ b/contrib/samples/ogl/studio/studio.cpp @@ -35,7 +35,6 @@ #include "project.h" #include "symbols.h" -#if defined(__WXGTK__) || defined(__WXX11__) || defined(__WXMOTIF__) || defined(__WXMAC__) #include "bitmaps/new.xpm" #include "bitmaps/open.xpm" #include "bitmaps/save.xpm" @@ -60,7 +59,6 @@ #include "bitmaps/straight.xpm" #include "studio.xpm" -#endif IMPLEMENT_APP(csApp) @@ -134,7 +132,7 @@ bool csApp::OnInit(void) wxDEFAULT_FRAME_STYLE_NO_CLIP | wxHSCROLL | wxVSCROLL); // Give it an icon - frame->SetIcon(wxICON(studio)); + frame->SetIcon(wxIcon(studio_xpm)); // Make a menubar wxMenu *fileMenu = new wxMenu; @@ -230,112 +228,100 @@ 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()), wxID_ANY, _T("Child Frame"), - wxPoint(10, 10), wxSize(300, 300), wxDEFAULT_FRAME_STYLE); + //// Make a 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__ - subframe->SetIcon(wxString(_T("chart"))); + subframe->SetIcon(wxString(_T("chart"))); #endif #ifdef __X__ - subframe->SetIcon(wxIcon(_T("doc.xbm"))); + subframe->SetIcon(wxIcon(_T("doc.xbm"))); #endif - //// Make a menubar - wxMenu *fileMenu = new wxMenu; - - fileMenu->Append(wxID_NEW, _T("&New...\tCtrl+N")); - fileMenu->Append(wxID_OPEN, _T("&Open...\tCtrl+O")); - fileMenu->Append(wxID_CLOSE, _T("&Close\tCtrl+W")); - fileMenu->Append(wxID_SAVE, _T("&Save\tCtrl+S")); - fileMenu->Append(wxID_SAVEAS, _T("Save &As...\tF12")); + //// Make a menubar + wxMenu *fileMenu = new wxMenu; - fileMenu->AppendSeparator(); - fileMenu->Append(wxID_PRINT, _T("&Print...\tCtrl+P")); - fileMenu->Append(wxID_PRINT_SETUP, _T("Print &Setup...")); - fileMenu->Append(wxID_PREVIEW, _T("Print Pre&view")); + fileMenu->Append(wxID_NEW, _T("&New...\tCtrl+N")); + fileMenu->Append(wxID_OPEN, _T("&Open...\tCtrl+O")); + fileMenu->Append(wxID_CLOSE, _T("&Close\tCtrl+W")); + fileMenu->Append(wxID_SAVE, _T("&Save\tCtrl+S")); + fileMenu->Append(wxID_SAVEAS, _T("Save &As...\tF12")); - fileMenu->AppendSeparator(); - fileMenu->Append(wxID_EXIT, _T("E&xit")); + fileMenu->AppendSeparator(); + fileMenu->Append(wxID_PRINT, _T("&Print...\tCtrl+P")); + fileMenu->Append(wxID_PRINT_SETUP, _T("Print &Setup...")); + fileMenu->Append(wxID_PREVIEW, _T("Print Pre&view")); - wxMenu* editMenu = new wxMenu; - editMenu->Append(wxID_UNDO, _T("&Undo\tCtrl+Z")); - editMenu->Append(wxID_REDO, _T("&Redo\tCtrl+Y")); - editMenu->AppendSeparator(); - editMenu->Append(wxID_CUT, _T("Cu&t\tCtrl+X")); - editMenu->Append(wxID_COPY, _T("&Copy\tCtrl+C")); - editMenu->Append(wxID_PASTE, _T("&Paste\tCtrl+V")); - editMenu->Append(wxID_DUPLICATE, _T("&Duplicate\tCtrl+D")); - editMenu->AppendSeparator(); - editMenu->Append(wxID_CLEAR, _T("Cle&ar\tDelete")); - editMenu->Append(ID_CS_SELECT_ALL, _T("Select A&ll\tCtrl+A")); - editMenu->AppendSeparator(); - editMenu->Append(ID_CS_EDIT_PROPERTIES, _T("Edit P&roperties...")); + fileMenu->AppendSeparator(); + fileMenu->Append(wxID_EXIT, _T("E&xit")); - *editMenuRet = editMenu; + wxMenu* editMenu = new wxMenu; + editMenu->Append(wxID_UNDO, _T("&Undo\tCtrl+Z")); + editMenu->Append(wxID_REDO, _T("&Redo\tCtrl+Y")); + editMenu->AppendSeparator(); + editMenu->Append(wxID_CUT, _T("Cu&t\tCtrl+X")); + editMenu->Append(wxID_COPY, _T("&Copy\tCtrl+C")); + editMenu->Append(wxID_PASTE, _T("&Paste\tCtrl+V")); + editMenu->Append(wxID_DUPLICATE, _T("&Duplicate\tCtrl+D")); + editMenu->AppendSeparator(); + editMenu->Append(wxID_CLEAR, _T("Cle&ar\tDelete")); + editMenu->Append(ID_CS_SELECT_ALL, _T("Select A&ll\tCtrl+A")); + editMenu->AppendSeparator(); + editMenu->Append(ID_CS_EDIT_PROPERTIES, _T("Edit P&roperties...")); + + *editMenuRet = editMenu; - m_docManager->FileHistoryUseMenu(fileMenu); - m_docManager->FileHistoryAddFilesToMenu(fileMenu); + m_docManager->FileHistoryUseMenu(fileMenu); + m_docManager->FileHistoryAddFilesToMenu(fileMenu); - doc->GetCommandProcessor()->SetEditMenu(editMenu); + doc->GetCommandProcessor()->SetEditMenu(editMenu); - wxMenu *viewMenu = new wxMenu; - viewMenu->Append(ID_CS_SETTINGS, _T("&Settings...")); + wxMenu *viewMenu = new wxMenu; + viewMenu->Append(ID_CS_SETTINGS, _T("&Settings...")); - wxMenu *helpMenu = new wxMenu; - helpMenu->Append(wxID_HELP, _T("&Help Contents\tF1")); - helpMenu->Append(ID_CS_ABOUT, _T("&About")); + wxMenu *helpMenu = new wxMenu; + helpMenu->Append(wxID_HELP, _T("&Help Contents\tF1")); + helpMenu->Append(ID_CS_ABOUT, _T("&About")); - wxMenuBar *menuBar = new wxMenuBar; + wxMenuBar *menuBar = new wxMenuBar; - menuBar->Append(fileMenu, _T("&File")); - menuBar->Append(editMenu, _T("&Edit")); - menuBar->Append(viewMenu, _T("&View")); - menuBar->Append(helpMenu, _T("&Help")); + menuBar->Append(fileMenu, _T("&File")); + menuBar->Append(editMenu, _T("&Edit")); + menuBar->Append(viewMenu, _T("&View")); + menuBar->Append(helpMenu, _T("&Help")); - //// Associate the menu bar with the frame - subframe->SetMenuBar(menuBar); + //// Associate the menu bar with the frame + subframe->SetMenuBar(menuBar); - return subframe; + return subframe; } // Creates a canvas. Called by OnInit as a child of the main window csCanvas *csApp::CreateCanvas(wxView *view, wxMDIChildFrame *parent) { - int width, height; - parent->GetClientSize(&width, &height); + int width, height; + parent->GetClientSize(&width, &height); - // Non-retained canvas - csCanvas *canvas = new csCanvas((csDiagramView*) view, parent, 1000, wxPoint(0, 0), wxSize(width, height), wxSUNKEN_BORDER); + // Non-retained canvas + csCanvas *canvas = new csCanvas((csDiagramView*) view, parent, 1000, wxPoint(0, 0), wxSize(width, height), wxSUNKEN_BORDER); - wxColour bgColour(_T("WHITE")); - canvas->SetBackgroundColour(bgColour); + wxColour bgColour(_T("WHITE")); + canvas->SetBackgroundColour(bgColour); - wxCursor cursor(wxCURSOR_HAND); - canvas->SetCursor(cursor); + wxCursor cursor(wxCURSOR_HAND); + canvas->SetCursor(cursor); - // Give it scrollbars - canvas->SetScrollbars(20, 20, 100, 100); + // Give it scrollbars + canvas->SetScrollbars(20, 20, 100, 100); - return canvas; + return canvas; } void csApp::InitToolBar(wxToolBar* toolBar) { wxBitmap* bitmaps[10]; -#ifdef __WXMSW__ - bitmaps[0] = new wxBitmap(_T("new"), wxBITMAP_TYPE_RESOURCE); - bitmaps[1] = new wxBitmap(_T("open"), wxBITMAP_TYPE_RESOURCE); - bitmaps[2] = new wxBitmap(_T("save"), wxBITMAP_TYPE_RESOURCE); - bitmaps[3] = new wxBitmap(_T("copy"), wxBITMAP_TYPE_RESOURCE); - bitmaps[4] = new wxBitmap(_T("cut"), wxBITMAP_TYPE_RESOURCE); - bitmaps[5] = new wxBitmap(_T("paste"), wxBITMAP_TYPE_RESOURCE); - bitmaps[6] = new wxBitmap(_T("print"), wxBITMAP_TYPE_RESOURCE); - bitmaps[7] = new wxBitmap(_T("help"), wxBITMAP_TYPE_RESOURCE); - bitmaps[8] = new wxBitmap(_T("undo"), wxBITMAP_TYPE_RESOURCE); - bitmaps[9] = new wxBitmap(_T("redo"), wxBITMAP_TYPE_RESOURCE); -#elif defined(__WXGTK__) || defined(__WXX11__) || defined(__WXMOTIF__) || defined(__WXMAC__) bitmaps[0] = new wxBitmap( new_xpm ); bitmaps[1] = new wxBitmap( open_xpm ); bitmaps[2] = new wxBitmap( save_xpm ); @@ -346,36 +332,33 @@ void csApp::InitToolBar(wxToolBar* toolBar) bitmaps[7] = new wxBitmap( help_xpm ); bitmaps[8] = new wxBitmap( undo_xpm ); bitmaps[9] = new wxBitmap( redo_xpm ); -#else -#error "Not implemented for this platform." -#endif - 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, wxDefaultCoord, wxDefaultCoord, NULL, _T("Print")); - toolBar->AddSeparator(); - 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, 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, 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); - - int i; - for (i = 0; i < 10; i++) - delete bitmaps[i]; + 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, wxDefaultCoord, wxDefaultCoord, NULL, _T("Print")); + toolBar->AddSeparator(); + 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, 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, 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); + + int i; + for (i = 0; i < 10; i++) + delete bitmaps[i]; } // Create and initialise the diagram toolbar @@ -396,19 +379,6 @@ void csApp::CreateDiagramToolBar(wxFrame* parent) wxBitmap* bitmaps[11]; -#ifdef __WXMSW__ - bitmaps[0] = new wxBitmap(_T("alignl"), wxBITMAP_TYPE_RESOURCE); - bitmaps[1] = new wxBitmap(_T("alignr"), wxBITMAP_TYPE_RESOURCE); - bitmaps[2] = new wxBitmap(_T("alignt"), wxBITMAP_TYPE_RESOURCE); - bitmaps[3] = new wxBitmap(_T("alignb"), wxBITMAP_TYPE_RESOURCE); - bitmaps[4] = new wxBitmap(_T("horiz"), wxBITMAP_TYPE_RESOURCE); - bitmaps[5] = new wxBitmap(_T("vert"), wxBITMAP_TYPE_RESOURCE); - bitmaps[6] = new wxBitmap(_T("copysize"), wxBITMAP_TYPE_RESOURCE); - bitmaps[7] = new wxBitmap(_T("linearrow"), wxBITMAP_TYPE_RESOURCE); - bitmaps[8] = new wxBitmap(_T("newpoint"), wxBITMAP_TYPE_RESOURCE); - bitmaps[9] = new wxBitmap(_T("cutpoint"), wxBITMAP_TYPE_RESOURCE); - bitmaps[10] = new wxBitmap(_T("straighten"), wxBITMAP_TYPE_RESOURCE); -#elif defined(__WXGTK__) || defined(__WXX11__) || defined(__WXMOTIF__) || defined(__WXMAC__) bitmaps[0] = new wxBitmap( alignl_xpm ); bitmaps[1] = new wxBitmap( alignr_xpm ); bitmaps[2] = new wxBitmap( alignt_xpm ); @@ -420,9 +390,6 @@ void csApp::CreateDiagramToolBar(wxFrame* parent) bitmaps[8] = new wxBitmap( newpoint_xpm ); bitmaps[9] = new wxBitmap( cutpoint_xpm ); bitmaps[10] = new wxBitmap( straight_xpm ); -#else -#error "Not implemented for this platform." -#endif 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"));