/** * End the dialog whether modal or quasimodal */ void EndFlexible( int aRtnCode ) { if( IsQuasiModal() ) EndQuasiModal( aRtnCode ); else EndModal( aRtnCode ); }
DIALOG_SHIM::~DIALOG_SHIM() { // if the dialog is quasi-modal, this will end its event loop if( IsQuasiModal() ) EndQuasiModal( wxID_CANCEL ); delete m_qmodal_parent_disabler; // usually NULL by now }
void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::OnCloseDialog( wxCloseEvent& event ) { // On wxWidgets 2.8, and on Linux, call EndQuasiModal here is mandatory // Otherwise, the main event loop is never restored, and Eeschema does not // respond to any event, because the DIALOG_SHIM destructor is never called. // on wxWidgets 3.0, or on Windows, the DIALOG_SHIM destructor is called, // and calls EndQuasiModal. // Therefore calling EndQuasiModal here is not mandatory but it creates no issues. EndQuasiModal( wxID_CANCEL ); }
void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::OnOKButtonClick( wxCommandEvent& event ) { if( !copyPanelToSelectedField() ) return; // test if reference prefix is acceptable if( !SCH_COMPONENT::IsReferenceStringValid( m_FieldsBuf[REFERENCE].GetText() ) ) { DisplayError( NULL, _( "Illegal reference prefix. A reference must start by a letter" ) ); return; } /* Note: this code is now (2010-dec-04) not used, because the value field is no more editable * because changing the value is equivalent to create a new component or alias. * This is now handled in libedit main frame, and no more in this dialog * but this code is not removed, just in case */ /* If a new name entered in the VALUE field, that it not an existing alias name * or root alias of the component */ wxString newvalue = m_FieldsBuf[VALUE].GetText(); if( m_libEntry->HasAlias( newvalue ) && !m_libEntry->GetAlias( newvalue )->IsRoot() ) { wxString msg = wxString::Format( _( "A new name is entered for this component\n" "An alias %s already exists!\n" "Cannot update this component" ), GetChars( newvalue ) ); DisplayError( this, msg ); return; } /* End unused code */ // save old cmp in undo list m_parent->SaveCopyInUndoList( m_libEntry ); // delete any fields with no name or no value before we copy all of m_FieldsBuf // back into the component for( unsigned i = MANDATORY_FIELDS; i < m_FieldsBuf.size(); ) { if( m_FieldsBuf[i].GetName().IsEmpty() || m_FieldsBuf[i].GetText().IsEmpty() ) { m_FieldsBuf.erase( m_FieldsBuf.begin() + i ); continue; } ++i; } #if defined(DEBUG) for( unsigned i = 0; i<m_FieldsBuf.size(); ++i ) { printf( "save[%u].name:'%s' value:'%s'\n", i, TO_UTF8( m_FieldsBuf[i].GetName() ), TO_UTF8( m_FieldsBuf[i].GetText() ) ); } #endif // copy all the fields back, fully replacing any previous fields m_libEntry->SetFields( m_FieldsBuf ); // We need to keep the name and the value the same at the moment! SetName( m_libEntry->GetValueField().GetText() ); m_parent->OnModify(); EndQuasiModal( wxID_OK ); }
void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::OnCancelButtonClick( wxCommandEvent& event ) { EndQuasiModal( wxID_CANCEL ); }
void DIALOG_EXCHANGE_MODULE::OnQuit( wxCommandEvent& event ) { m_selectionMode = m_Selection->GetSelection(); Show( false ); EndQuasiModal( wxID_CANCEL ); }