Exemplo n.º 1
0
void DIALOG_DRC_CONTROL::OnOkClick( wxCommandEvent& event )
{
    SetReturnCode( wxID_OK );
    SetDrcParmeters();

    m_tester->DestroyDialog( wxID_OK );
}
DIALOG_COPPER_ZONE::DIALOG_COPPER_ZONE( PCB_BASE_FRAME* aParent, ZONE_SETTINGS* aSettings ) :
    DIALOG_COPPER_ZONE_BASE( aParent )
{
    m_Parent = aParent;
    m_Config = Kiface().KifaceSettings();

    m_ptr = aSettings;
    m_settings = *aSettings;

    m_NetSortingByPadCount = true;      // false = alphabetic sort, true = pad count sort
    m_OnExitCode = ZONE_ABORT;

    SetReturnCode( ZONE_ABORT );        // Will be changed on buttons click

    // Fix static text widget minimum width to a suitable value so that
    // resizing the dialog is not necessary when changing the corner smoothing type.
    // Depends on the default text in the widget.
    m_cornerSmoothingTitle->SetMinSize( m_cornerSmoothingTitle->GetSize() );

    initDialog();

    m_sdbSizerOK->SetDefault();
    GetSizer()->SetSizeHints( this );
    Center();
}
Exemplo n.º 3
0
void DlgSaveLayout::OnOkClick( wxCommandEvent& event )
{
	if(!m_ComboLayout->GetValue().IsEmpty())
    {
		if(bSave)
		{
			wxMainFrame::Get()->AddLayout(m_ComboLayout->GetValue());
		}
		else
		{
			wxMainFrame::Get()->RemoveLayout(m_ComboLayout->GetValue());
		}

        if ( IsModal() )
            EndModal(wxID_OK); // If modal
        else
        {
            SetReturnCode(wxID_OK);
            this->Show(false); // If modeless
        }
    }	
	else
	{
		wxMessageBox(wxT("You must enter a layout name"), wxT("Error"));
	}
}
void DIALOG_NON_COPPER_ZONES_EDITOR::Init()
{
    BOARD* board = m_parent->GetBoard();

    SetReturnCode( ZONE_ABORT );  // Will be changed on button click

    AddUnitSymbol( *m_MinThicknessValueTitle, g_UserUnit );
    wxString msg = StringFromValue( g_UserUnit, m_settings.m_ZoneMinThickness );
    m_ZoneMinThicknessCtrl->SetValue( msg );

    if( m_settings.m_Zone_45_Only )
        m_OrientEdgesOpt->SetSelection( 1 );

    switch( m_settings.m_Zone_HatchingStyle )
    {
    case CPolyLine::NO_HATCH:
        m_OutlineAppearanceCtrl->SetSelection( 0 );
        break;

    case CPolyLine::DIAGONAL_EDGE:
        m_OutlineAppearanceCtrl->SetSelection( 1 );
        break;

    case CPolyLine::DIAGONAL_FULL:
        m_OutlineAppearanceCtrl->SetSelection( 2 );
        break;
    }

    // Create one column in m_LayerSelectionCtrl
    wxListItem column0;
    column0.SetId( 0 );
    m_LayerSelectionCtrl->InsertColumn( 0, column0 );

    // Create an icon list:
    wxImageList* imageList = new wxImageList( LAYER_BITMAP_SIZE_X, LAYER_BITMAP_SIZE_Y );
    m_LayerSelectionCtrl->AssignImageList( imageList, wxIMAGE_LIST_SMALL );

    int ii = 0;
    int lyrSelect = ( (PCB_SCREEN*) m_parent->GetScreen() )->m_Active_Layer;

    if( m_zone )
        lyrSelect = m_zone->GetLayer();

    for( LSEQ seq = LSET::AllNonCuMask().Seq(); seq; ++seq, ++ii )
    {
        LAYER_ID layer = *seq;

        EDA_COLOR_T layerColor = board->GetLayerColor( layer );
        imageList->Add( makeLayerBitmap( layerColor ) );

        wxString msg = board->GetLayerName( layer );
        msg.Trim();

        int itemIndex = m_LayerSelectionCtrl->InsertItem(
                m_LayerSelectionCtrl->GetItemCount(), msg, ii );

        if(lyrSelect == layer )
            m_LayerSelectionCtrl->Select( itemIndex );
    }
}
Exemplo n.º 5
0
void ParamEdit::Close() {
	if (IsModal()) 
		EndModal(wxID_OK);
	else {
		SetReturnCode(wxID_OK);
		Show(false);
	}
}
Exemplo n.º 6
0
void ParamEdit::OnCancel(wxCommandEvent & event) {
	if (IsModal()) 
		EndModal(wxID_CANCEL);
	else {
		SetReturnCode(wxID_CANCEL);
		Show(false);
	}
}
Exemplo n.º 7
0
void wxDialog::EndModal(int retCode)
{
    wxASSERT_MSG( IsModal(), wxT("EndModal() called for non modal dialog") );

    SetReturnCode(retCode);

    Hide();
}
void DIALOG_DRC_CONTROL::OnCancelClick( wxCommandEvent& event )
{
    SetReturnCode( wxID_CANCEL );

    // The dialog can be modal or not modal.
    // Leave the DRC caller destroy (or not) the dialog
    m_tester->DestroyDRCDialog( wxID_CANCEL );
}
Exemplo n.º 9
0
// NB: this function (surprisingly) may be called for both modal and modeless
//     dialogs and should work for both of them
void wxDialog::EndModal(int retCode)
{
    if ( m_eventLoop )
        m_eventLoop->Exit(retCode);

    SetReturnCode(retCode);
    Show(false);
}
Exemplo n.º 10
0
void CConfigChooser::onCancel(wxCommandEvent& WXUNUSED(event))
{
	if (IsModal()) {
		EndModal(wxID_CANCEL);
	} else {
		SetReturnCode(wxID_CANCEL);
		Show(false);
	}
}
Exemplo n.º 11
0
void wxDialog::EndModal(int retCode)
{
    wxASSERT_MSG( IsModal(), _T("EndModal() called for non modal dialog") );

//    m_endModalCalled = true;
    SetReturnCode(retCode);

    Hide();
}
void DIALOG_DRC_CONTROL::OnOkClick( wxCommandEvent& event )
{
    SetReturnCode( wxID_OK );
    SetDrcParmeters();

    // The dialog can be modal or not modal.
    // Leave the DRC caller destroy (or not) the dialog
    m_tester->DestroyDRCDialog( wxID_OK );
}
Exemplo n.º 13
0
//----------------------------------------------------------------
void CommandDialog::OnButtonCancelClick(wxCommandEvent& event)
/**
 * \brief Occurs when the Cancel Button is clicked. Closes the Dialog.
 * \param event CommandEvent.
 **/
{
    SetReturnCode(wxID_CANCEL);
    Destroy();
}
Exemplo n.º 14
0
//----------------------------------------------------------------
void CommandDialog::OnClose(wxCloseEvent& event)
/**
 * \brief Closes the dialog, sets the return code to cancel.
 * \param event CommandEvent.
 **/
{
    SetReturnCode(wxID_CANCEL);
    Destroy();
}
Exemplo n.º 15
0
void wxDialog::OnCancel(wxCommandEvent& WXUNUSED(event))
{
    if ( IsModal() )
        EndModal(wxID_CANCEL);
    else
    {
        SetReturnCode(wxID_CANCEL);
        this->Show(false);
    }
}
Exemplo n.º 16
0
void DIALOG_ANNOTATE::OnCancelClick( wxCommandEvent& event )
{
    if( IsModal() )
        EndModal( wxID_CANCEL );
    else
    {
        SetReturnCode( wxID_CANCEL );
        this->Show( false );
    }
}
Exemplo n.º 17
0
void wxDialogBase::ShowWindowModal ()
{
    int retval = ShowModal();
    // wxWindowModalDialogEvent relies on GetReturnCode() returning correct
    // code. Rather than doing it manually in all ShowModal() overrides for
    // native dialogs (and getting accidentally broken again), set it here.
    // The worst that can happen is that it will be set twice to the same
    // value.
    SetReturnCode(retval);
    SendWindowModalDialogEvent ( wxEVT_WINDOW_MODAL_DIALOG_CLOSED  );
}
Exemplo n.º 18
0
//----------------------------------------------------------------
void CommandDialog::OnButtonOkClick(wxCommandEvent& event)
/**
 * \brief Occurs when the Ok button is clicked. Saves and closes
 * the dialog.
 * \param event CommandEvent.
 **/
{
    SetReturnCode(wxID_OK);
    SaveContent();
    Destroy();
}
Exemplo n.º 19
0
void wxDialog::EndModal(
  int                               nRetCode
)
{
    wxASSERT_MSG( IsModal(), wxT("EndModal() called for non modal dialog") );

    m_endModalCalled = true;
    SetReturnCode(nRetCode);

    Hide();
} // end of wxDialog::EndModal
Exemplo n.º 20
0
void filter_dlg::OnOK(wxCommandEvent &event) {
	if (Validate() && TransferDataFromWindow()) {
		ApplyLimit();
		ExecFilter();
		if (IsModal()) {
			EndModal(wxID_OK);
		} else {
			SetReturnCode(wxID_OK);
			Show(false);
		}
	}
}
DIALOG_GENDRILL::DIALOG_GENDRILL( PCB_EDIT_FRAME* parent ) :
    DIALOG_GENDRILL_BASE( parent )
{
    m_parent = parent;
    m_board  = parent->GetBoard();
    m_config = Kiface().KifaceSettings();
    m_plotOpts = m_parent->GetPlotSettings();

    SetReturnCode( 1 );
    initDialog();
    GetSizer()->SetSizeHints( this );
}
Exemplo n.º 22
0
void ImageMessageBox::OnNo(wxCommandEvent& event) {
  if ( Validate() && TransferDataFromWindow() )
    {
      if ( IsModal() )
	EndModal(wxNO); // If modal
      else
	{
	  SetReturnCode(wxNO);
	  this->Show(false); // If modeless
	}
    }
}
Exemplo n.º 23
0
// Standard buttons
void wxDialog::OnOK(wxCommandEvent& WXUNUSED(event))
{
    if ( Validate() && TransferDataFromWindow() )
    {
        if ( IsModal() )
            EndModal(wxID_OK);
        else
        {
            SetReturnCode(wxID_OK);
            this->Show(false);
        }
    }
}
Exemplo n.º 24
0
void wxDialog::EndModal(int retCode)
{
    if (!m_modalShowing)
        return;

    SetReturnCode(retCode);

    // Strangely, we don't seem to need this now.
    //    XtRemoveGrab((Widget) m_mainWidget);

    Show(false);

    m_modalShowing = false;
    m_eventLoop->Exit();
}
Exemplo n.º 25
0
void wxDialog::EndModal( int retCode )
{
    SetReturnCode( retCode );

    if (!IsModal())
    {
        wxFAIL_MSG( wxT("wxDialog:EndModal called twice") );
        return;
    }

    m_modalShowing = false;

    gtk_main_quit();

    Show( false );
}
Exemplo n.º 26
0
/***********************************************************************
 *  Method: ButtonChoiceDialog::OnChoice2
 *  Params: wxCommandEvent &event
 * Returns: void
 * Effects: 
 ***********************************************************************/
void
ButtonChoiceDialog::OnChoice2(wxCommandEvent &event)
{
  if ( Validate() && TransferDataFromWindow() )
    {   
        if ( IsModal() )
        {
            EndModal(BUTTON_CHOICE_2);
        }
        else
        {
            SetReturnCode(BUTTON_CHOICE_2);
            Show(false);
        }
    }
}
Exemplo n.º 27
0
void CConfigChooser::onOK(wxCommandEvent& WXUNUSED(event))
{
	int choice = m_configChoice->GetSelection();
	if (choice == wxNOT_FOUND) {
		::wxMessageBox(_("No SDR Name has been chosen"), _("UWSDR Error"), wxICON_ERROR);
		return;
	}

	m_name = m_configChoice->GetString(choice);

	if (IsModal()) {
		EndModal(wxID_OK);
	} else {
		SetReturnCode(wxID_OK);
		Show(false);
	}
}
Exemplo n.º 28
0
void ddTableNameDialog::OnEnterPressed( wxCommandEvent& event )
{
  if (event.GetEventType() == wxEVT_COMMAND_TEXT_ENTER)
  {
 if ( Validate() && TransferDataFromWindow() )
    {
        if ( IsModal() )
            EndModal(wxID_OK); // If modal
        else
        {
            SetReturnCode(wxID_OK);
            this->Show(false); // If modeless
        }
    }

  }
}
Exemplo n.º 29
0
void wxDialog::EndModal(int retCode)
{
    wxASSERT_MSG( m_eventLoop, wxT("wxDialog is not modal") );

    SetReturnCode(retCode);

    if ( !IsModal() )
    {
        wxFAIL_MSG( wxT("wxDialog:EndModal called twice") );
        return;
    }

    m_isShowingModal = false;

    m_eventLoop->Exit();

    Show(false);
}
Exemplo n.º 30
0
Arquivo: App.cpp Projeto: brho/xword
bool
MyApp::OnInit()
{
    m_frame = NULL;

    wxLogDebug(_T("Starting App"));
    SetReturnCode(0);

    m_isTimerRunning = false;

    // Seed random number generator (for grid scrambling)
    srand( time(NULL) );

    SetupConfig();
    SetupPrinting();

    return ReadCommandLine();
}