当前位置: 首页>>代码示例>>C++>>正文


C++ Workspace::Redraw方法代码示例

本文整理汇总了C++中Workspace::Redraw方法的典型用法代码示例。如果您正苦于以下问题:C++ Workspace::Redraw方法的具体用法?C++ Workspace::Redraw怎么用?C++ Workspace::Redraw使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Workspace的用法示例。


在下文中一共展示了Workspace::Redraw方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: fileHandling

MainFrame::MainFrame(wxWindow* parent, wxLocale* locale, PropertiesData* initProperties, wxString openPath)
    : MainFrameBase(parent)
{
    m_locale = locale;
    m_generalProperties = initProperties;

    Init();

    if(openPath != "") {
        EnableCurrentProjectRibbon();
        Workspace* newWorkspace = new Workspace(this, _("Open project"), this->GetStatusBar(), m_sharedGLContext);
        if(!m_sharedGLContext) m_sharedGLContext = newWorkspace->GetOpenGLContext();

        FileHanding fileHandling(newWorkspace);
        if(fileHandling.OpenProject(openPath)) {
            newWorkspace->SetSavedPath(openPath);

            m_workspaceList.push_back(newWorkspace);

            m_ribbonButtonBarContinuous->ToggleButton(ID_RIBBON_DISABLESOL, true);
            m_ribbonButtonBarContinuous->ToggleButton(ID_RIBBON_ENABLESOL, false);

            m_auiNotebook->AddPage(newWorkspace, newWorkspace->GetName(), true);
            m_auiNotebook->Layout();
            newWorkspace->Redraw();
            newWorkspace->SetJustOpened(true);
            newWorkspace->Fit();
            m_projectNumber++;
        }
    }
}
开发者ID:Thales1330,项目名称:PSP,代码行数:31,代码来源:MainFrame.cpp

示例2: OnOpenClick

void MainFrame::OnOpenClick(wxRibbonButtonBarEvent& event)
{
    wxFileDialog openFileDialog(this, _("Open PSP file"), "", "", "PSP files (*.psp)|*.psp",
                                wxFD_OPEN | wxFD_FILE_MUST_EXIST);
    if(openFileDialog.ShowModal() == wxID_CANCEL) return;

    wxFileName fileName(openFileDialog.GetPath());

    EnableCurrentProjectRibbon();
    Workspace* newWorkspace = new Workspace(this, _("Open project"), this->GetStatusBar(), m_sharedGLContext);
    if(!m_sharedGLContext) m_sharedGLContext = newWorkspace->GetOpenGLContext();

    FileHanding fileHandling(newWorkspace);
    if(fileHandling.OpenProject(fileName)) {
        newWorkspace->SetSavedPath(fileName);

        m_workspaceList.push_back(newWorkspace);

        m_ribbonButtonBarContinuous->ToggleButton(ID_RIBBON_DISABLESOL, true);
        m_ribbonButtonBarContinuous->ToggleButton(ID_RIBBON_ENABLESOL, false);

        m_auiNotebook->AddPage(newWorkspace, newWorkspace->GetName(), true);
        m_auiNotebook->Layout();
        newWorkspace->Redraw();
        newWorkspace->SetJustOpened(true);
        newWorkspace->Fit();
        m_projectNumber++;
    } else {
        wxMessageDialog msgDialog(this, _("It was not possible to open the selected file."), _("Error"),
                                  wxOK | wxCENTRE | wxICON_ERROR);
        msgDialog.ShowModal();
        delete newWorkspace;
    }
}
开发者ID:Thales1330,项目名称:PSP,代码行数:34,代码来源:MainFrame.cpp

示例3: OnNewClick

void MainFrame::OnNewClick(wxRibbonButtonBarEvent& event)
{
    EnableCurrentProjectRibbon();

    Workspace* newWorkspace = new Workspace(this, wxString::Format(_("New project %d"), m_projectNumber),
                                            this->GetStatusBar(), m_sharedGLContext);
    if(!m_sharedGLContext) m_sharedGLContext = newWorkspace->GetOpenGLContext();
    m_workspaceList.push_back(newWorkspace);

    m_ribbonButtonBarContinuous->ToggleButton(ID_RIBBON_DISABLESOL, true);
    m_ribbonButtonBarContinuous->ToggleButton(ID_RIBBON_ENABLESOL, false);

    m_auiNotebook->AddPage(newWorkspace, newWorkspace->GetName(), true);
    newWorkspace->Redraw();
    m_projectNumber++;
}
开发者ID:Thales1330,项目名称:PSP,代码行数:16,代码来源:MainFrame.cpp

示例4: OnImportClick

void MainFrame::OnImportClick(wxRibbonButtonBarEvent& event)
{
    // Create a new workspace to import
    Workspace* impWorkspace = new Workspace(this, _("Imported project"), this->GetStatusBar(), m_sharedGLContext);
    ImportForm importForm(this, impWorkspace);
    if(importForm.ShowModal() == wxID_OK) {
        // Import file(s)
        EnableCurrentProjectRibbon();

        if(!m_sharedGLContext) m_sharedGLContext = impWorkspace->GetOpenGLContext();
        m_workspaceList.push_back(impWorkspace);

        m_ribbonButtonBarContinuous->ToggleButton(ID_RIBBON_DISABLESOL, true);
        m_ribbonButtonBarContinuous->ToggleButton(ID_RIBBON_ENABLESOL, false);

        m_auiNotebook->AddPage(impWorkspace, impWorkspace->GetName(), true);
        m_auiNotebook->Layout();
        impWorkspace->Redraw();
        impWorkspace->SetJustOpened(true);
        impWorkspace->Fit();
        m_projectNumber++;
    }
}
开发者ID:Thales1330,项目名称:PSP,代码行数:23,代码来源:MainFrame.cpp

示例5: OnAddElementsClick

void MainFrame::OnAddElementsClick(wxCommandEvent& event)
{
    Workspace* workspace = static_cast<Workspace*>(m_auiNotebook->GetCurrentPage());

    if(workspace) {
        if(workspace->GetWorkspaceMode() != Workspace::MODE_INSERT) {
            auto elementList = workspace->GetElementList();
            wxString statusBarText = "";
            bool newElement = false;

            switch(event.GetId()) {
                case ID_ADDMENU_BUS: {
                    Bus* newBus = new Bus(wxPoint2DDouble(0, 0),
                                          wxString::Format(_("Bus %d"), workspace->GetElementNumber(ID_BUS)));
                    workspace->IncrementElementNumber(ID_BUS);
                    elementList.push_back(newBus);
                    statusBarText = _("Insert Bus: Click to insert, ESC to cancel.");
                    newElement = true;
                } break;
                case ID_ADDMENU_LINE: {
                    Line* newLine = new Line(wxString::Format(_("Line %d"), workspace->GetElementNumber(ID_LINE)));
                    elementList.push_back(newLine);
                    workspace->IncrementElementNumber(ID_LINE);
                    statusBarText = _("Insert Line: Click on two buses, ESC to cancel.");
                    newElement = true;
                } break;
                case ID_ADDMENU_TRANSFORMER: {
                    Transformer* newTransformer = new Transformer(
                        wxString::Format(_("Transformer %d"), workspace->GetElementNumber(ID_TRANSFORMER)));
                    workspace->IncrementElementNumber(ID_TRANSFORMER);
                    elementList.push_back(newTransformer);
                    statusBarText = _("Insert Transformer: Click on two buses, ESC to cancel.");
                    newElement = true;
                } break;
                case ID_ADDMENU_GENERATOR: {
                    SyncGenerator* newGenerator = new SyncGenerator(
                        wxString::Format(_("Generator %d"), workspace->GetElementNumber(ID_SYNCGENERATOR)));
                    workspace->IncrementElementNumber(ID_SYNCGENERATOR);
                    elementList.push_back(newGenerator);
                    statusBarText = _("Insert Generator: Click on a buses, ESC to cancel.");
                    newElement = true;
                } break;
                case ID_ADDMENU_LOAD: {
                    Load* newLoad = new Load(wxString::Format(_("Load %d"), workspace->GetElementNumber(ID_LOAD)));
                    workspace->IncrementElementNumber(ID_LOAD);
                    elementList.push_back(newLoad);
                    statusBarText = _("Insert Load: Click on a buses, ESC to cancel.");
                    newElement = true;
                } break;
                case ID_ADDMENU_CAPACITOR: {
                    Capacitor* newCapacitor =
                        new Capacitor(wxString::Format(_("Capacitor %d"), workspace->GetElementNumber(ID_CAPACITOR)));
                    workspace->IncrementElementNumber(ID_CAPACITOR);
                    elementList.push_back(newCapacitor);
                    statusBarText = _("Insert Capacitor: Click on a buses, ESC to cancel.");
                    newElement = true;
                } break;
                case ID_ADDMENU_INDUCTOR: {
                    Inductor* newInductor =
                        new Inductor(wxString::Format(_("Inductor %d"), workspace->GetElementNumber(ID_INDUCTOR)));
                    workspace->IncrementElementNumber(ID_INDUCTOR);
                    elementList.push_back(newInductor);
                    statusBarText = _("Insert Inductor: Click on a buses, ESC to cancel.");
                    newElement = true;
                } break;
                case ID_ADDMENU_INDMOTOR: {
                    IndMotor* newIndMotor = new IndMotor(
                        wxString::Format(_("Induction motor %d"), workspace->GetElementNumber(ID_INDMOTOR)));
                    workspace->IncrementElementNumber(ID_INDMOTOR);
                    elementList.push_back(newIndMotor);
                    statusBarText = _("Insert Induction Motor: Click on a buses, ESC to cancel.");
                    newElement = true;
                } break;
                case ID_ADDMENU_SYNCCOMP: {
                    SyncMotor* newSyncCondenser = new SyncMotor(
                        wxString::Format(_("Synchronous condenser %d"), workspace->GetElementNumber(ID_SYNCMOTOR)));
                    workspace->IncrementElementNumber(ID_SYNCMOTOR);
                    elementList.push_back(newSyncCondenser);
                    statusBarText = _("Insert Synchronous Condenser: Click on a buses, ESC to cancel.");
                    newElement = true;
                } break;
            }
            if(newElement) {
                workspace->SetElementList(elementList);
                workspace->SetWorkspaceMode(Workspace::MODE_INSERT);
                workspace->SetStatusBarText(statusBarText);
                workspace->Redraw();
            }
        }
    }
}
开发者ID:Thales1330,项目名称:PSP,代码行数:91,代码来源:MainFrame.cpp


注:本文中的Workspace::Redraw方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。