///////////////////////////////////////////////////////////////////////////// // Name: dialog_display_options.cpp // Purpose: // Author: jean-pierre Charras // Modified by: // Created: 17/02/2006 17:47:55 // RCS-ID: // Copyright: License GNU // Licence: ///////////////////////////////////////////////////////////////////////////// // Generated by DialogBlocks (unregistered), 17/02/2006 17:47:55 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) #pragma implementation "dialog_display_options.h" #endif // For compilers that support precompilation, includes "wx/wx.h". #include "wx/wxprec.h" #ifdef __BORLANDC__ #pragma hdrstop #endif #ifndef WX_PRECOMP #include "wx/wx.h" #endif ////@begin includes ////@end includes #include "fctsys.h" #include "wxstruct.h" #include "common.h" #include "cvpcb.h" #include "protos.h" #include "dialog_display_options.h" ////@begin XPM images ////@end XPM images /*********************************************************************/ void WinEDA_DisplayFrame::InstallOptionsDisplay(wxCommandEvent& event) /*********************************************************************/ /* Creation de la fenetre d'options de la fenetre de visu */ { KiDisplayOptionsFrame * OptionWindow = new KiDisplayOptionsFrame(this); OptionWindow->ShowModal(); OptionWindow->Destroy(); } /*! * KiDisplayOptionsFrame type definition */ IMPLEMENT_DYNAMIC_CLASS( KiDisplayOptionsFrame, wxDialog ) /*! * KiDisplayOptionsFrame event table definition */ BEGIN_EVENT_TABLE( KiDisplayOptionsFrame, wxDialog ) ////@begin KiDisplayOptionsFrame event table entries EVT_BUTTON( ID_SAVE_CONFIG, KiDisplayOptionsFrame::OnSaveConfigClick ) EVT_BUTTON( wxID_OK, KiDisplayOptionsFrame::OnOkClick ) EVT_BUTTON( wxID_CANCEL, KiDisplayOptionsFrame::OnCancelClick ) EVT_BUTTON( wxID_APPLY, KiDisplayOptionsFrame::OnApplyClick ) ////@end KiDisplayOptionsFrame event table entries END_EVENT_TABLE() /*! * KiDisplayOptionsFrame constructors */ KiDisplayOptionsFrame::KiDisplayOptionsFrame( ) { } KiDisplayOptionsFrame::KiDisplayOptionsFrame( WinEDA_BasePcbFrame* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style ) { m_Parent = parent; Create(parent, id, caption, pos, size, style); } /*! * KiDisplayOptionsFrame creator */ bool KiDisplayOptionsFrame::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style ) { ////@begin KiDisplayOptionsFrame member initialisation m_EdgesDisplayOption = NULL; m_TextDisplayOption = NULL; m_IsShowPadNum = NULL; m_IsShowPadFill = NULL; ////@end KiDisplayOptionsFrame member initialisation ////@begin KiDisplayOptionsFrame creation SetExtraStyle(GetExtraStyle()|wxWS_EX_BLOCK_EVENTS); wxDialog::Create( parent, id, caption, pos, size, style ); CreateControls(); GetSizer()->Fit(this); GetSizer()->SetSizeHints(this); Centre(); ////@end KiDisplayOptionsFrame creation return true; } /*! * Control creation for KiDisplayOptionsFrame */ void KiDisplayOptionsFrame::CreateControls() { SetFont(*g_DialogFont); ////@begin KiDisplayOptionsFrame content construction // Generated by DialogBlocks, 17/02/2006 18:31:55 (unregistered) KiDisplayOptionsFrame* itemDialog1 = this; wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL); itemDialog1->SetSizer(itemBoxSizer2); wxBoxSizer* itemBoxSizer3 = new wxBoxSizer(wxHORIZONTAL); // itemBoxSizer2->Add(itemBoxSizer3, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); itemBoxSizer2->Add(itemBoxSizer3, 0, wxALIGN_TOP|wxALL, 5); wxBoxSizer* itemBoxSizer4 = new wxBoxSizer(wxHORIZONTAL); // itemBoxSizer2->Add(itemBoxSizer4, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); itemBoxSizer2->Add(itemBoxSizer4, 0, wxGROW|wxALIGN_TOP|wxALL, 5); wxString m_EdgesDisplayOptionStrings[] = { _("&Filaire"), _("&Filled"), _("&Sketch") }; m_EdgesDisplayOption = new wxRadioBox( itemDialog1, EDGE_SELECT, _("Edges:"), wxDefaultPosition, wxDefaultSize, 3, m_EdgesDisplayOptionStrings, 1, wxRA_SPECIFY_COLS ); // itemBoxSizer3->Add(m_EdgesDisplayOption, 0, wxGROW|wxALL, 5); itemBoxSizer3->Add(m_EdgesDisplayOption, 0, wxALIGN_LEFT|wxALL, 5); wxString m_TextDisplayOptionStrings[] = { _("&Filaire"), _("&Filled"), _("&Sketch") }; m_TextDisplayOption = new wxRadioBox( itemDialog1, TEXT_SELECT, _("Texts:"), wxDefaultPosition, wxDefaultSize, 3, m_TextDisplayOptionStrings, 1, wxRA_SPECIFY_COLS ); // itemBoxSizer3->Add(m_TextDisplayOption, 0, wxGROW|wxALL, 5); itemBoxSizer3->Add(m_TextDisplayOption, 0, wxALIGN_LEFT|wxALL, 5); wxBoxSizer* itemBoxSizer5 = new wxBoxSizer(wxVERTICAL); // itemBoxSizer3->Add(itemBoxSizer5, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5); itemBoxSizer3->Add(itemBoxSizer5, 0, wxGROW|wxALL, 0); // Provide a spacer to improve appearance of dialog box itemBoxSizer5->AddSpacer(5); m_IsShowPadNum = new wxCheckBox( itemDialog1, PADNUM_OPT, _("Pad &Num"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE ); m_IsShowPadNum->SetValue(false); // itemBoxSizer5->Add(m_IsShowPadNum, 0, wxGROW|wxALL, 5); itemBoxSizer5->Add(m_IsShowPadNum, 0, wxALIGN_TOP|wxALL, 5); m_IsShowPadFill = new wxCheckBox( itemDialog1, PADFILL_OPT, _("&Pad Fill"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE ); m_IsShowPadFill->SetValue(false); // itemBoxSizer5->Add(m_IsShowPadFill, 0, wxGROW|wxALL, 5); itemBoxSizer5->Add(m_IsShowPadFill, 0, wxALIGN_TOP|wxALL, 5); // Provide a stretch spacer to improve appearance of dialog box itemBoxSizer5->AddStretchSpacer(); wxButton* itemButton6 = new wxButton( itemDialog1, ID_SAVE_CONFIG, _("Save Cfg..."), wxDefaultPosition, wxDefaultSize, 0 ); // itemBoxSizer5->Add(itemButton6, 0, wxGROW|wxALL, 5); itemBoxSizer5->Add(itemButton6, 0, wxALIGN_BOTTOM|wxALL, 5); // itemBoxSizer4->AddStretchSpacer(); wxButton* itemButton7 = new wxButton( itemDialog1, wxID_OK, _("OK"), wxDefaultPosition, wxDefaultSize, 0 ); itemButton7->SetForegroundColour(*wxRED); // itemBoxSizer4->Add(itemButton7, 0, wxGROW|wxALL, 5); itemBoxSizer4->Add(itemButton7, 0, wxALIGN_RIGHT|wxALL, 5); wxButton* itemButton8 = new wxButton( itemDialog1, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0 ); itemButton8->SetForegroundColour(*wxBLUE); // itemBoxSizer4->Add(itemButton8, 0, wxGROW|wxALL, 5); itemBoxSizer4->Add(itemButton8, 0, wxALIGN_RIGHT|wxALL, 5); wxButton* itemButton9 = new wxButton( itemDialog1, wxID_APPLY, _("Apply"), wxDefaultPosition, wxDefaultSize, 0 ); // itemBoxSizer4->Add(itemButton9, 0, wxGROW|wxALL, 5); itemBoxSizer4->Add(itemButton9, 0, wxALIGN_RIGHT|wxALL, 5); // Set validators m_EdgesDisplayOption->SetValidator( wxGenericValidator(& DisplayOpt.DisplayModEdge) ); m_TextDisplayOption->SetValidator( wxGenericValidator(& DisplayOpt.DisplayModText) ); m_IsShowPadNum->SetValidator( wxGenericValidator(& DisplayOpt.DisplayPadNum) ); m_IsShowPadFill->SetValidator( wxGenericValidator(& DisplayOpt.DisplayPadFill) ); ////@end KiDisplayOptionsFrame content construction } /*! * Should we show tooltips? */ bool KiDisplayOptionsFrame::ShowToolTips() { return true; } /*! * Get bitmap resources */ wxBitmap KiDisplayOptionsFrame::GetBitmapResource( const wxString& name ) { // Bitmap retrieval ////@begin KiDisplayOptionsFrame bitmap retrieval wxUnusedVar(name); return wxNullBitmap; ////@end KiDisplayOptionsFrame bitmap retrieval } /*! * Get icon resources */ wxIcon KiDisplayOptionsFrame::GetIconResource( const wxString& name ) { // Icon retrieval ////@begin KiDisplayOptionsFrame icon retrieval wxUnusedVar(name); return wxNullIcon; ////@end KiDisplayOptionsFrame icon retrieval } /*! * Update settings related to edges, text strings, and pads */ void KiDisplayOptionsFrame::UpdateObjectSettings() { // Update settings ////@begin KiDisplayOptionsFrame update settings DisplayOpt.DisplayModEdge = m_Parent->m_DisplayModEdge = m_EdgesDisplayOption->GetSelection(); DisplayOpt.DisplayModText = m_Parent->m_DisplayModText = m_TextDisplayOption->GetSelection(); DisplayOpt.DisplayPadNum = m_Parent->m_DisplayPadNum = m_IsShowPadNum->GetValue(); DisplayOpt.DisplayPadFill = m_Parent->m_DisplayPadFill = m_IsShowPadFill->GetValue(); m_Parent->ReDrawPanel(); ////@end KiDisplayOptionsFrame update settings } /*! * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_SAVE_CONFIG */ void KiDisplayOptionsFrame::OnSaveConfigClick( wxCommandEvent& event ) { Save_Config(this); } /*! * wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK */ void KiDisplayOptionsFrame::OnOkClick( wxCommandEvent& event ) { UpdateObjectSettings(); EndModal( 1 ); } /*! * wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL */ void KiDisplayOptionsFrame::OnCancelClick( wxCommandEvent& event ) { EndModal( -1 ); } /*! * wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_APPLY */ void KiDisplayOptionsFrame::OnApplyClick( wxCommandEvent& event ) { UpdateObjectSettings(); }