⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 studio.cpp

📁 很牛的GUI源码wxWidgets-2.8.0.zip 可在多种平台下运行.
💻 CPP
📖 第 1 页 / 共 2 页
字号:
/////////////////////////////////////////////////////////////////////////////// Name:        Studio.cpp// Purpose:     Studio application class// Author:      Julian Smart// Modified by:// Created:     27/7/98// RCS-ID:      $Id: studio.cpp,v 1.21 2005/05/30 16:17:48 ABX Exp $// Copyright:   (c) Julian Smart// Licence://///////////////////////////////////////////////////////////////////////////// For compilers that support precompilation, includes "wx/wx.h".#include "wx/wxprec.h"#ifdef __BORLANDC__#pragma hdrstop#endif#ifndef WX_PRECOMP#include "wx/wx.h"#include "wx/mdi.h"#endif#include "wx/ogl/ogl.h" // base header of OGL, includes and adjusts wx/deprecated/setup.h#include "wx/config.h"#include "wx/laywin.h"#include "wx/helpwin.h"#include "studio.h"#include "view.h"#include "doc.h"#include "mainfrm.h"#include "cspalette.h"#include "project.h"#include "symbols.h"#include "bitmaps/new.xpm"#include "bitmaps/open.xpm"#include "bitmaps/save.xpm"#include "bitmaps/copy.xpm"#include "bitmaps/cut.xpm"#include "bitmaps/paste.xpm"#include "bitmaps/print.xpm"#include "bitmaps/help.xpm"#include "bitmaps/undo.xpm"#include "bitmaps/redo.xpm"#include "bitmaps/alignl.xpm"#include "bitmaps/alignr.xpm"#include "bitmaps/alignt.xpm"#include "bitmaps/alignb.xpm"#include "bitmaps/horiz.xpm"#include "bitmaps/vert.xpm"#include "bitmaps/copysize.xpm"#include "bitmaps/linearrow.xpm"#include "bitmaps/newpoint.xpm"#include "bitmaps/cutpoint.xpm"#include "bitmaps/straight.xpm"#include "studio.xpm"IMPLEMENT_APP(csApp)csApp::csApp(){    m_docManager = NULL;    m_diagramPalette = NULL;    m_diagramToolBar = NULL;    m_projectTreeCtrl = NULL;    m_diagramPaletteSashWindow = NULL;    m_projectSashWindow = NULL;    m_symbolDatabase = NULL;    m_pointSizeComboBox = NULL;    m_zoomComboBox = NULL;    m_shapeEditMenu = NULL;    // Configuration    m_mainFramePos.x = 20;    m_mainFramePos.y = 20;    m_mainFrameSize.x = 500;    m_mainFrameSize.y = 400;    m_gridStyle = csGRID_STYLE_INVISIBLE;    m_gridSpacing = 5;}csApp::~csApp(){}// Initialise this in OnInit, not staticallybool csApp::OnInit(void){#if wxUSE_WX_RESOURCES    if (!wxResourceParseFile(_T("studio_resources.wxr")))    {        wxMessageBox(_T("Could not find or parse resource file: studio_resources.wxr"), _T("Studio"));        return false;    }#endif#if wxUSE_MS_HTML_HELP && !defined(__WXUNIVERSAL__)    m_helpController = new wxWinHelpController;#else    m_helpController = new wxHtmlHelpController;#endif    m_helpController->Initialize(_T("studio.hlp"));    ReadOptions();    wxOGLInitialize();    InitSymbols();    //// Create a document manager    m_docManager = new wxDocManager;    //// Create a template relating drawing documents to their views    (void) new wxDocTemplate(m_docManager, _T("Diagram"), _T("*.dia"), wxEmptyString, _T("dia"), _T("Diagram Doc"), _T("Diagram View"),            CLASSINFO(csDiagramDocument), CLASSINFO(csDiagramView));    // Create the main frame window.    // Note that we use a frame style that doesn't have wxCLIP_CHILDREN in it    // (the default frame style contains wxCLIP_CHILDREN), otherwise the client    // area doesn't refresh properly when we change its position, under Windows.#define wxDEFAULT_FRAME_STYLE_NO_CLIP \    (wxDEFAULT_FRAME_STYLE & ~wxCLIP_CHILDREN)    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    frame->SetIcon(wxIcon(studio_xpm));    // Make a menubar    wxMenu *fileMenu = new wxMenu;    fileMenu->Append(wxID_NEW, _T("&New...\tCtrl+N"));    fileMenu->Append(wxID_OPEN, _T("&Open...\tCtrl+O"));    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->AppendSeparator();    fileMenu->Append(wxID_EXIT, _T("E&xit"));    // A history of files visited. Use this menu.    m_docManager->FileHistoryUseMenu(fileMenu);    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"));    wxMenuBar *menuBar = new wxMenuBar;    menuBar->Append(fileMenu, _T("&File"));    menuBar->Append(viewMenu, _T("&View"));    menuBar->Append(helpMenu, _T("&Help"));    // Associate the menu bar with the frame    frame->SetMenuBar(menuBar);    // Load the file history    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);    CreatePalette(frame);    /*    CreateProjectWindow(frame);    FillProjectTreeCtrl();    */    // Create the shape editing menu    m_shapeEditMenu = new ShapeEditMenu;    m_shapeEditMenu->Append(ID_CS_EDIT_PROPERTIES, _T("Edit properties"));    m_shapeEditMenu->AppendSeparator();    m_shapeEditMenu->Append(ID_CS_ROTATE_CLOCKWISE, _T("Rotate clockwise"));    m_shapeEditMenu->Append(ID_CS_ROTATE_ANTICLOCKWISE, _T("Rotate anticlockwise"));    m_shapeEditMenu->AppendSeparator();    m_shapeEditMenu->Append(ID_CS_CUT, _T("Cut"));    frame->Show(true);    SetTopWindow(frame);    return true;}int csApp::OnExit(void){    WriteOptions();    delete m_symbolDatabase;    m_symbolDatabase = NULL;    delete m_docManager;    m_docManager = NULL;    delete m_shapeEditMenu;    m_shapeEditMenu = NULL;    delete m_helpController;    m_helpController = NULL;    wxOGLCleanUp();    return 0;}/* * Centralised code for creating a document frame. * Called from view.cpp, when a view is created. */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);#ifdef __WXMSW__    subframe->SetIcon(wxString(_T("chart")));#endif#ifdef __X__    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"));    fileMenu->AppendSeparator();    fileMenu->Append(wxID_PRINT, _T("&Print...\tCtrl+P"));

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -