Exemple #1
0
void wxDocMDIChildFrame::OnCloseWindow(wxCloseEvent& event)
{
    // Close view but don't delete the frame while doing so!
    // ...since it will be deleted by wxWidgets if we return true.
    if (m_childView)
    {
        bool ans = event.CanVeto()
                   ? m_childView->Close(false) // false means don't delete associated window
                   : true; // Must delete.

        if (ans)
        {
            m_childView->Activate(false);
            delete m_childView;
            m_childView = (wxView *) NULL;
            m_childDocument = (wxDocument *) NULL;

            this->Destroy();
        }
        else
            event.Veto();
    }
    else
        event.Veto();
}
Exemple #2
0
void
MainFrame::OnClose(wxCloseEvent &event)
{
	if (exit_) {
		/* Really close the window */
		uint8_t answer = anMessageBox(
		    _("Do you really want to close xanoubis?"), _("Confirm"),
		    wxYES_NO, this);

		if (answer == wxYES) {
			event.Skip();
		} else {
			if (event.CanVeto())
				event.Veto();
			else
				Destroy();
		}
	} else {
		/* Hide the window */
		if (event.CanVeto())
			event.Veto();
		else
			Destroy();

		this->Hide();
	}
}
Exemple #3
0
// Default behaviour: close the application with prompts. The
// user can veto the close, and therefore the end session.
void wxApp::OnQueryEndSession(wxCloseEvent& event)
{
    if ( !wxDialog::OSXHasModalDialogsOpen() )
    {
        if (GetTopWindow())
        {
            if (!GetTopWindow()->Close(!event.CanVeto()))
                event.Veto(true);
        }
    }
    else
    {
        event.Veto(true);
    }
}
/*****************************************************
**
**   ChildWindow   ---   OnClose
**
******************************************************/
void ChildWindow::OnClose( wxCloseEvent &event )
{
	wxLogMessage( wxT( "ChildWindow::OnClose classname %s" ), GetClassInfo()->GetClassName());

	if ( ismainwindow )
	{
		if ( ! doc->queryClose())
		{
			event.Veto();
			return;
		}
		doc->closeDependentChildWindows();
	}
	wxCommandEvent e( CHILD_CLOSED, GetId() );
	e.SetEventObject( this );

	// Issue 3.0
	//GetParent()->ProcessWindowEvent( e );
	//GetParent()->ProcessEvent( e );
	wxPostEvent( GetParent(), e );

	if ( doc ) doc->releaseChildWindow( this );
	Destroy();
	isvalid = false;
}
Exemple #5
0
void CCamFrame::OnCloseWindow(wxCloseEvent& event)
{
	Camelot.ShuttingDown(TRUE);

	if (m_docManager->Clear(!event.CanVeto()))
	{
PORTNOTE("other","Removed ExternalClipboard usage")
#if !defined(EXCLUDE_FROM_XARALX)
		// Put any stuff the user wants to keep on the clipboard before we depart.
		// We want this to happen before the window closes and progress displays are lost.
		ExternalClipboard::PrepareForShutdown();
#endif
		// We must DeInit the dialog manager before any windows are destroyed. 
		// This needs to be here because Popup windows (Dialogs/Floating bars) 
		// seem to be destroyed before the MainFrame receives an OnDestroy message
		DialogManager::DeInit(); 

		this->Destroy();
	}
	else
	{
		// We cancelled for some reason.
		Camelot.ShuttingDown(FALSE);

		event.Veto();
	}
}
void dlgFindReplace::OnClose(wxCloseEvent &ev)
{
	SaveSettings();
	this->Hide();
	if (ev.CanVeto())
		ev.Veto();
}
void WxDockingContainer::OnClose( wxCloseEvent& In )
{
	// Don't actually close these windows.  Just hide them so they can be recalled later.
	Hide();

	In.Veto();
}
void PCB_EDIT_FRAME::OnCloseWindow( wxCloseEvent& Event )
{
    m_canvas->SetAbortRequest( true );

    if( GetScreen()->IsModify() )
    {
        wxString msg = wxString::Format( _(
                "Save the changes in\n"
                "'%s'\n"
                "before closing?" ),
                GetChars( GetBoard()->GetFileName() )
                );

        int ii = DisplayExitDialog( this, msg );
        switch( ii )
        {
        case wxID_CANCEL:
            Event.Veto();
            return;

        case wxID_NO:
            break;

        case wxID_YES:
            // save the board. if the board has no name,
            // the ID_SAVE_BOARD_AS will actually made
            Files_io_from_id( ID_SAVE_BOARD );
            break;
        }
    }

    GetGalCanvas()->StopDrawing();

    // Delete the auto save file if it exists.
    wxFileName fn = GetBoard()->GetFileName();

    // Auto save file name is the normal file name prefixed with a '$'.
    fn.SetName( wxT( "$" ) + fn.GetName() );

    // Remove the auto save file on a normal close of Pcbnew.
    if( fn.FileExists() && !wxRemoveFile( fn.GetFullPath() ) )
    {
        wxString msg = wxString::Format( _(
                "The auto save file '%s' could not be removed!" ),
                GetChars( fn.GetFullPath() )
                );

        wxMessageBox( msg, Pgm().App().GetAppName(), wxOK | wxICON_ERROR, this );
    }

    // Delete board structs and undo/redo lists, to avoid crash on exit
    // when deleting some structs (mainly in undo/redo lists) too late
    Clear_Pcb( false );

    // do not show the window because ScreenPcb will be deleted and we do not
    // want any paint event
    Show( false );

    Destroy();
}
void FOOTPRINT_EDIT_FRAME::OnCloseWindow( wxCloseEvent& Event )
{
    if( GetScreen()->IsModify() && GetBoard()->m_Modules )
    {
        if( !HandleUnsavedChanges( this, _( "Save changes to footprint before closing?" ),
                                   [&]()->bool { return SaveFootprint( GetBoard()->m_Modules ); } ) )
        {
            Event.Veto();
            return;
        }
    }

    GetGalCanvas()->SetEventDispatcher( NULL );
    GetGalCanvas()->StopDrawing();

    // Do not show the layer manager during closing to avoid flicker
    // on some platforms (Windows) that generate useless redraw of items in
    // the Layer Manger
    m_auimgr.GetPane( "LayersManager" ).Show( false );

    Clear_Pcb( false );

    //close the editor
    Destroy();
}
void ExploreFrame::OnWindowClose( wxCloseEvent& event )
{
	if (m_archive && m_archive->IsModified())
	{
		wxMessageDialog msgDlg(this, _("Do you wan't to save unsaved changes?"), _("Warning"), wxICON_WARNING | wxYES_NO | wxCANCEL);
		msgDlg.SetYesNoLabels(_("Save"), _("Don't Save"));

		switch (msgDlg.ShowModal())
		{
			case wxID_YES:
			{
				wxCommandEvent evt(wxID_SAVE);
				OnSaveClicked(evt);
				event.Skip();
				break;
			}
			case wxID_NO:
				event.Skip();
				break;
			default:
				event.Veto();
				break;
		}
	} else
		event.Skip();
}
void wxPropertyFormFrame::OnCloseWindow(wxCloseEvent& event)
{
    if (m_view && m_view->OnClose())
        this->Destroy();
    else
        event.Veto();
}
Exemple #12
0
void MainFrame::OnExit(wxCloseEvent& event) 
{
	while(gui.IsEditorOpen()) 
	{
		if(!DoQuerySave()) 
		{
			if(event.CanVeto()) 
			{
				event.Veto();
				return;
			}
			else
			{
				break;
			}
		}
	}
	gui.aui_manager->UnInit();
	((Application&)wxGetApp()).Unload();
#ifdef __RELEASE__
	// Hack, "crash" gracefully in release builds, let OS handle cleanup of windows
	exit(0);
#endif
	Destroy();
}
Exemple #13
0
void MyFrame::OnClose(wxCloseEvent& event)
{
    if ( !event.CanVeto() )
    {
        event.Skip();
        return ;
    }
    if ( m_children.GetCount () < 1 )
    {
        event.Skip();
        return ;
    }
    // now try the children
    wxObjectList::compatibility_iterator pNode = m_children.GetFirst ();
    wxObjectList::compatibility_iterator pNext ;
    MyChild * pChild ;
    while ( pNode )
    {
        pNext = pNode -> GetNext ();
        pChild = (MyChild*) pNode -> GetData ();
        if (pChild -> Close ())
        {
            m_children.Erase(pNode) ;
        }
        else
        {
            event.Veto();
            return;
        }
        pNode = pNext ;
    }
    event.Skip();
}
void FOOTPRINT_WIZARD_MESSAGES::OnCloseMsgWindow( wxCloseEvent& aEvent )
{
    if( !m_canClose )
        aEvent.Veto();
    else
        aEvent.Skip();
}
Exemple #15
0
void MyFrame::OnClose(wxCloseEvent& event)
{
    tcDatabaseManager* databaseManager = tcDatabaseManager::Get();
    if (databaseManager->AreChangesPending())
    {
        wxMessageDialog dialog(this, "Save changes before closing?", "Save?", wxYES | wxNO | wxCANCEL, wxDefaultPosition);
        int response = dialog.ShowModal();
        if (response == wxID_YES)
        {
            databaseManager->Commit(false);
            wxWindow::Destroy();
        }
        else if (response == wxID_CANCEL)
        {
            if (event.CanVeto())
            {
                event.Veto();
            }
            else
            {
                Shutdown();
            }
        }
        else
        {
            Shutdown();
        }
    }
    else
    {
        Shutdown();
    }
}
Exemple #16
0
void QuenchFrame::OnCloseWindow(wxCloseEvent& event)
{
	NButtonChoiceDialog ed(this, "Exiting Quench...","\n\nDo you want to save state information?\n","Save","Don't Save","Cancel");
	bool bSaveDecisionMade = false;
	while (!bSaveDecisionMade)
	{
		int result = ed.ShowModal();
		switch(result)
		{
		case BUTTON_CHOICE_1: // Save
			if(!DoSaveStateDialog())
				continue;
			bSaveDecisionMade = true;
			remove(TEMP_QST_FILE_NAME);
			Destroy();
			break;
		case BUTTON_CHOICE_2: // Don't Save
			bSaveDecisionMade = true;
			Destroy();
			break;
		case BUTTON_CHOICE_3: // Cancel
			bSaveDecisionMade = true;
			event.Veto();
			break;
		}
	}
}
Exemple #17
0
//---------------------------------------------------------
void CSAGA_Frame::On_Close(wxCloseEvent &event)
{
	if( event.CanVeto() )
	{
		if( !g_pModule && DLG_Message_Confirm(ID_DLG_CLOSE) && g_pData->Close(true) )
		{
			g_pModules->Finalise();

			Destroy();
		}
		else
		{
			if( g_pModule )
			{
				DLG_Message_Show(_TL("Please stop tool execution before exiting SAGA."), _TL("Exit SAGA"));
			}

			event.Veto();
		}
	}
	else
	{
		g_pModules->Finalise();

		g_pData->Close(true);

		event.Skip();
	}
}
Exemple #18
0
void GameSettings::OnClose(wxCloseEvent& event)
{
    int msgRet;
    msgRet = wxMessageBox(_T("You've made changes to the configuration options. Do you want to store these changes?\n")
            _T("If you answer Yes, the previous configuration file will be replaced with the new settings you've selected."),
            _T("Save KeeperFX configuration"), wxYES_NO | wxCANCEL | wxYES_DEFAULT | wxICON_QUESTION, this);
    switch (msgRet)
    {
      case wxYES:      // Save, then quit dialog
          writeConfiguration();
          wxLogMessage(wxT("Configuration saved."));
        break;
      case wxNO:       // Don't save; just quit dialog
          wxLogMessage(wxT("Changed discarded."));
        break;
      case wxCANCEL:   // Do nothing - so don't quit dialog
      default:
        if (event.CanVeto()) {
            event.Veto();     // Notify the calling code that we didn't agreed to quit
            return;
        }
        break;
    }

    GetParent()->Enable(true);

    event.Skip();
    EndModal(1);
}
Exemple #19
0
void SummaryWindow::OnClose(wxCloseEvent &event) {
	if (event.CanVeto()) {
		event.Veto();
		draw_panel->ShowSummaryWindow(false);
	} else
		Destroy();
}
Exemple #20
0
void wxSettlersFrame::OnClose(wxCloseEvent& event)
{
	bool destroy = true;
	
	// If we're allowed to veto the event, we need to run our quit handler.
	if( (true == event.CanVeto()) &&
		(false == GUI.CanQuit(this)))
	{
		// They had a change of heart.
		destroy = false;
		event.Veto();
	}

	if(true == destroy)
	{
		// We only need to do this cleanup if this is happening from the main
		// window, not the context menu.
		if(false == sInExit)
		{
			Controller::get().Transmit(shEventClose, 0);
		}

		// Shut down.
		Destroy();
	}
}
Exemple #21
0
void wxGenericMDIParentFrame::OnClose(wxCloseEvent& event)
{
    if ( !CloseAll() )
        event.Veto();
    else
        event.Skip();
}
void WxFloatingFrame::OnClose( wxCloseEvent& In )
{
	// Don't actually close these windows.  Just hide them so they can be recalled later.
	Hide();

	In.Veto();
}
Exemple #23
0
/**
 * \brief Procedure called when closing the window.
 * \param event This event occured.
 */
void bf::main_frame::on_close( wxCloseEvent& event )
{
  save_config();

  bool quit = !event.CanVeto();

  if ( !quit )
    {
      quit = true;
      m_animation_edit->validate();

      if ( is_changed() )
        {
          wxMessageDialog dlg
            ( this,
              _("The animation is not saved."
                 " Do you want to save it now?"),
              _("Animation is not saved."), wxYES_NO | wxCANCEL );

          int answer = dlg.ShowModal();

          if ( answer == wxID_CANCEL )
            quit = false;
          else if ( answer == wxID_YES )
            quit = save();
        }
    }

  if ( quit )
    event.Skip();
  else
    event.Veto();
} // main_frame::on_close()
Exemple #24
0
void wxPlaylist::OnClose(wxCloseEvent &event)
{
	if (event.CanVeto()) {
		event.Veto();
		Hide();
	}
}
Exemple #25
0
void Frame::OnCloseWindow( wxCloseEvent& evt )
{
    // if the event can't be vetoed (ie, force close) then force close
    if ( !evt.CanVeto() )
    {
        cleanupAndDestroy();
    }
    else
    {
        // otherwise show "really quit" dialog, close window if OK clicked
        wxMessageDialog* exitDialog = new wxMessageDialog( this,
                _("Really quit?"), _("grav"), wxOK | wxCANCEL );
        int result = exitDialog->ShowModal();
        exitDialog->Destroy();

        switch( result )
        {
        case wxID_OK:
            cleanupAndDestroy();
            break;
        case wxID_CANCEL:
        default:
            evt.Veto();
            break;
        }
    }
}
Exemple #26
0
void CVPCB_MAINFRAME::OnCloseWindow( wxCloseEvent& Event )
{
    if( m_modified )
    {
        wxString msg = _( "Component to Footprint links modified.\nSave before exit ?" );
        int ii = DisplayExitDialog( this, msg );

        switch( ii )
        {
        case wxID_CANCEL:
            Event.Veto();
            return;

        case wxID_NO:
            break;

        case wxID_YES:
            SaveEdits();
            break;
        }
    }

    // Close module display frame
    if( GetFpViewerFrame() )
        GetFpViewerFrame()->Close( true );

    m_modified = false;

    Destroy();
    return;
}
void WinEDA_GerberFrame::OnCloseWindow(wxCloseEvent & Event)
/***********************************************************/
{
PCB_SCREEN * screen;

	screen = ScreenPcb ;
	while( screen )
		{
		if(screen->IsModify()) break;
		screen = screen->Next();
		}

	if ( screen )
		{
		if( ! IsOK(this, _("Layer modified,  Continue ?")) )
			{
			Event.Veto();
			return;
			}
		}

	while( screen )	// suppression flag modify pour eviter d'autres message
		{
		screen->ClrModify();
		screen = screen->Next();
		}

	/* Reselection de l'ecran de base,
		pour les evenements de refresh générés par wxWindows */
	m_CurrentScreen = ActiveScreen = ScreenPcb;

	SaveSettings();
	Destroy();
}
void LIB_EDIT_FRAME::OnCloseWindow( wxCloseEvent& Event )
{
    if( saveAllLibraries( true ) )
        Destroy();
    else
        Event.Veto();
}
Exemple #29
0
void frmMain::OnClose(wxCloseEvent &event)
{
	wxWindow *fr;
	windowList::Node *node;
	while ((node = frames.GetFirst()) != NULL)
	{
		fr = node->GetData();

		// if crashes occur here when closing the app,
		// some actionFactory::StartDialog returned a wxWindow* (which is registered in frames)
		// without code to handle OnClose (esp. removing itself with RemoveFrame)

		if (!fr->Close(!event.CanVeto()))
		{
			if (event.CanVeto())
			{
				event.Veto();
				return;
			}
		}
		delete node;
		fr->Destroy();
	}
	Destroy();
}
void PL_EDITOR_FRAME::OnCloseWindow( wxCloseEvent& Event )
{
    if( GetScreen()->IsModify() )
    {
        wxString msg;
        wxString filename = GetCurrFileName();

        if( filename.IsEmpty() )
            msg = _("Save changes in a new file before closing?");
        else
            msg.Printf( _("Save the changes in\n<%s>\nbefore closing?"),
                        GetChars( filename ) );

        int ii = DisplayExitDialog( this, msg );

        switch( ii )
        {
        case wxID_CANCEL:
            Event.Veto();
            return;

        case wxID_NO:
            break;

        case wxID_OK:
        case wxID_YES:
        {
            if( filename.IsEmpty() )
            {
                wxFileDialog openFileDialog(this, _("Create file"), wxEmptyString,
                        wxEmptyString, PageLayoutDescrFileWildcard, wxFD_SAVE);

                if (openFileDialog.ShowModal() == wxID_CANCEL)
                    return;

                filename = openFileDialog.GetPath();
            }

            if( !SavePageLayoutDescrFile( filename ) )
            {
                msg.Printf( _("Unable to create <%s>"), GetChars( filename ) );
                wxMessageBox( msg );
            }
        }
            break;
        }
    }

    // do not show the window because we do not want any paint event
    Show( false );

    // was: Pgm().SaveCurrentSetupValues( m_configSettings );
    wxConfigSaveSetups( Kiface().KifaceSettings(), m_configSettings );

    // On Linux, m_propertiesPagelayout must be destroyed
    // before deleting the main frame to avoid a crash when closing
    m_propertiesPagelayout->Destroy();
    Destroy();
}