Beispiel #1
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();
}
Beispiel #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();
	}
}
Beispiel #3
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();
    }
}
Beispiel #4
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();
	}
}
Beispiel #5
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);
}
Beispiel #6
0
// Close out the console log windows along with the main emu window.
// Note: This event only happens after a close event has occurred and was *not* veto'd.  Ie,
// it means it's time to provide an unconditional closure of said window.
//
void MainEmuFrame::OnCloseWindow(wxCloseEvent& evt)
{
	if( IsBeingDeleted() ) return;

	CoreThread.Suspend();

	bool isClosing = false;

	if( !evt.CanVeto() )
	{
		// Mandatory destruction...
		isClosing = true;
	}
	else
	{
		// TODO : Add confirmation prior to exit here!
		// Problem: Suspend is often slow because it needs to wait until the current EE frame
		// has finished processing (if the GS or logging has incurred severe overhead this makes
		// closing PCSX2 difficult).  A non-blocking suspend with modal dialog might suffice
		// however. --air

		//evt.Veto( true );

	}

	sApp.OnMainFrameClosed( GetId() );

	if( m_menubar.FindItem(MenuId_IsoSelector) )
		m_menuCDVD.Remove(MenuId_IsoSelector);

	RemoveEventHandler( &wxGetApp().GetRecentIsoManager() );
	wxGetApp().PostIdleAppMethod( &Pcsx2App::PrepForExit );

	evt.Skip();
}
Beispiel #7
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;
        }
    }
}
Beispiel #8
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();
	}
}
Beispiel #9
0
void wxPlaylist::OnClose(wxCloseEvent &event)
{
	if (event.CanVeto()) {
		event.Veto();
		Hide();
	}
}
Beispiel #10
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()
Beispiel #11
0
void SummaryWindow::OnClose(wxCloseEvent &event) {
	if (event.CanVeto()) {
		event.Veto();
		draw_panel->ShowSummaryWindow(false);
	} else
		Destroy();
}
Beispiel #12
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();
	}
}
Beispiel #13
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();
}
Beispiel #14
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 dlgFindReplace::OnClose(wxCloseEvent &ev)
{
	SaveSettings();
	this->Hide();
	if (ev.CanVeto())
		ev.Veto();
}
Beispiel #16
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();
}
Beispiel #17
0
void LoginForm::onClose( wxCloseEvent& event )
{
	Show(false);

	// if we can veto means it wasnt forced by the parent
	if (event.CanVeto() && GetParent())
		GetParent()->Close(true);
}
Beispiel #18
0
void DolphinApp::OnEndSession(wxCloseEvent& event)
{
    // Close if we've received wxEVT_END_SESSION (ignore wxEVT_QUERY_END_SESSION)
    if (!event.CanVeto())
    {
        main_frame->Close(true);
    }
}
Beispiel #19
0
/**
 * \brief Procedure called when closing the window.
 * \param event This event occured.
 */
void bf::snapshot_frame::on_close(wxCloseEvent& event)
{
  if ( event.CanVeto() )
    {
      Hide();
      event.Veto();
    }
} // snapshot_frame::on_close()
Beispiel #20
0
void SjVisFrame::OnCloseWindow(wxCloseEvent& e)
{
	g_visModule->StopVis();
	if( e.CanVeto() )
	{
		e.Veto();
	}
}
Beispiel #21
0
/**
 * \brief Procedure called when closing the window.
 * \param event This event occured.
 */
void bf::mark_list_frame::on_close(wxCloseEvent& event)
{
  if ( event.CanVeto() )
    {
      Hide();
      event.Veto();
    }
} // mark_list_frame::on_close()
Beispiel #22
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 (GetTopWindow())
    {
        if (!GetTopWindow()->Close(!event.CanVeto()))
            event.Veto(true);
    }
}
Beispiel #23
0
void LifeNavigator::OnClose(wxCloseEvent& event)
{
    // avoid if we can
    if (event.CanVeto())
        event.Veto();
    else
        Destroy();
}
// same as hitting done button
void PreferencesDialog::OnCloseWindow(wxCloseEvent& event)
{
    bool okay = true, qualityChanged = false;

    // set values if changed
    try {
        SET_INTEGER_REGISTRY_VALUE_IF_DIFFERENT(REG_QUALITY_SECTION,
            REG_QUALITY_ATOM_SLICES, iAtomSlices, &qualityChanged);
        SET_INTEGER_REGISTRY_VALUE_IF_DIFFERENT(REG_QUALITY_SECTION,
            REG_QUALITY_ATOM_STACKS, iAtomStacks, &qualityChanged);
        SET_INTEGER_REGISTRY_VALUE_IF_DIFFERENT(REG_QUALITY_SECTION,
            REG_QUALITY_BOND_SIDES, iBondSides, &qualityChanged);
        SET_INTEGER_REGISTRY_VALUE_IF_DIFFERENT(REG_QUALITY_SECTION,
            REG_QUALITY_WORM_SIDES, iWormSides, &qualityChanged);
        SET_INTEGER_REGISTRY_VALUE_IF_DIFFERENT(REG_QUALITY_SECTION,
            REG_QUALITY_WORM_SEGMENTS, iWormSegments, &qualityChanged);
        SET_INTEGER_REGISTRY_VALUE_IF_DIFFERENT(REG_QUALITY_SECTION,
            REG_QUALITY_HELIX_SIDES, iHelixSides, &qualityChanged);
        SET_BOOL_REGISTRY_VALUE_IF_DIFFERENT(REG_QUALITY_SECTION,
            REG_HIGHLIGHTS_ON, ID_C_HIGHLIGHT, &qualityChanged);
        SET_RADIO_REGISTRY_VALUE_IF_DIFFERENT(REG_QUALITY_SECTION,
            REG_PROJECTION_TYPE, ID_RADIOBOX, &qualityChanged);

        SET_BOOL_REGISTRY_VALUE_IF_DIFFERENT(REG_CACHE_SECTION, REG_CACHE_ENABLED, ID_C_CACHE_ON, 0);
        DECLARE_AND_FIND_WINDOW_RETURN_ON_ERR(tCache, ID_T_CACHE_FOLDER, wxTextCtrl)
        SET_STRING_REGISTRY_VALUE_IF_DIFFERENT(REG_CACHE_SECTION, REG_CACHE_FOLDER, tCache);
        SET_INTEGER_REGISTRY_VALUE_IF_DIFFERENT(REG_CACHE_SECTION, REG_CACHE_MAX_SIZE, iCacheSize, 0);

        SET_BOOL_REGISTRY_VALUE_IF_DIFFERENT(REG_ADVANCED_SECTION, REG_CDD_ANNOT_READONLY, ID_C_ANNOT_RO, 0);
#ifdef __WXGTK__
        DECLARE_AND_FIND_WINDOW_RETURN_ON_ERR(tLaunch, ID_T_LAUNCH, wxTextCtrl)
        SET_STRING_REGISTRY_VALUE_IF_DIFFERENT(REG_ADVANCED_SECTION, REG_BROWSER_LAUNCH, tLaunch);
#endif
        SET_INTEGER_REGISTRY_VALUE_IF_DIFFERENT(REG_ADVANCED_SECTION, REG_MAX_N_STRUCTS, iMaxStructs, 0);
        SET_INTEGER_REGISTRY_VALUE_IF_DIFFERENT(REG_ADVANCED_SECTION, REG_FOOTPRINT_RES, iFootRes, 0);

        SET_DOUBLE_REGISTRY_VALUE_IF_DIFFERENT(REG_ADVANCED_SECTION, REG_STEREO_SEPARATION, fSeparation, 0);
        SET_BOOL_REGISTRY_VALUE_IF_DIFFERENT(REG_ADVANCED_SECTION, REG_PROXIMAL_STEREO, ID_C_PROXIMAL, 0);

        // Limit cache size to current value now
        int size;
        if (iCacheSize->GetInteger(&size)) TruncateCache(size);

    } catch (const char *err) {
        ERRORMSG("Error setting registry values - " << err);
        okay = false;
    }

    // close dialog only if all user values are legit
    if (okay) {
        if (qualityChanged) GlobalMessenger()->PostRedrawAllStructures();
        EndModal(wxOK);
    } else {
        if (event.CanVeto())
            event.Veto();
    }
}
Beispiel #25
0
void log_window::OnFrameClose(wxCloseEvent &event) {
	if (event.CanVeto()) {
		LWShow(false);
		event.Veto();
	} else {
		globallogwindow = nullptr;
		Destroy();
	}
}
Beispiel #26
0
void TASInputDlg::OnCloseWindow(wxCloseEvent& event)
{
	if (event.CanVeto())
	{
		event.Skip(false);
		this->Show(false);
		ResetValues();
	}
}
Beispiel #27
0
//-----------------------------------------------------------------------------
void WizardLensControl::OnClose( wxCloseEvent& e )
//-----------------------------------------------------------------------------
{
    Hide();
    if( e.CanVeto() )
    {
        e.Veto();
    }
}
Beispiel #28
0
void
header_editor_frame_c::on_close_window(wxCloseEvent &evt) {
    if (!may_close() && evt.CanVeto())
        evt.Veto();
    else {
        mdlg->header_editor_frame_closed(this);
        Destroy();
    }
}
Beispiel #29
0
void wxDocMDIParentFrame::OnCloseWindow(wxCloseEvent& event)
{
    if (m_docManager->Clear(!event.CanVeto()))
    {
        this->Destroy();
    }
    else
        event.Veto();
}
Beispiel #30
0
void TraceLogFrame::OnCloseWindow( wxCloseEvent& event )
{
    if (event.CanVeto()) {
        Show(false);
        event.Veto();
    } else {
        Destroy();
        event.Skip();
    }
}