///////////////////////////////////////////////////////////////////////////// // Name: dialog_edit_component_in_schematic.cpp // Purpose: // Author: jean-pierre Charras // Modified by: // Created: 03/03/2006 15:02:54 // RCS-ID: // Copyright: License GNU // Licence: ///////////////////////////////////////////////////////////////////////////// // Generated by DialogBlocks (unregistered), 03/03/2006 15:02:54 ////@begin includes ////@end includes #include "dialog_edit_component_in_schematic.h" ////@begin XPM images ////@end XPM images /*! * WinEDA_ComponentPropertiesFrame type definition */ IMPLEMENT_DYNAMIC_CLASS( WinEDA_ComponentPropertiesFrame, wxDialog ) /*! * WinEDA_ComponentPropertiesFrame event table definition */ BEGIN_EVENT_TABLE( WinEDA_ComponentPropertiesFrame, wxDialog ) ////@begin WinEDA_ComponentPropertiesFrame event table entries EVT_BUTTON( wxID_CANCEL, WinEDA_ComponentPropertiesFrame::OnCancelClick ) EVT_BUTTON( ID_RESTORE_CMP_DEFAULTS, WinEDA_ComponentPropertiesFrame::OnRestoreCmpDefaultsClick ) EVT_BUTTON( wxID_OK, WinEDA_ComponentPropertiesFrame::OnOkClick ) ////@end WinEDA_ComponentPropertiesFrame event table entries EVT_RADIOBOX(ID_ON_SELECT_FIELD, WinEDA_ComponentPropertiesFrame::SelectNewField) END_EVENT_TABLE() /*! * WinEDA_ComponentPropertiesFrame constructors */ WinEDA_ComponentPropertiesFrame::WinEDA_ComponentPropertiesFrame( ) { } WinEDA_ComponentPropertiesFrame::WinEDA_ComponentPropertiesFrame( WinEDA_SchematicFrame* parent, SCH_COMPONENT * cmp, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style ) { m_Parent = parent; m_Cmp = cmp; m_LibEntry = FindLibPart(m_Cmp->m_ChipName.GetData(), wxEmptyString, FIND_ROOT); InitBuffers(); Create(parent, id, caption, pos, size, style); if ( m_LibEntry == NULL ) { SetTitle(_("Component properties (Not found in lib)")); } } /*! * WinEDA_ComponentPropertiesFrame creator */ bool WinEDA_ComponentPropertiesFrame::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style ) { m_FieldNameCtrl = NULL; ////@begin WinEDA_ComponentPropertiesFrame member initialisation m_GeneralBoxSizer = NULL; m_NoteBook = NULL; m_PanelBasic = NULL; m_SelectUnit = NULL; m_OrientUnit = NULL; m_MirrorUnit = NULL; m_MsgPartLocked = NULL; m_ConvertButt = NULL; m_RefInLib = NULL; m_PanelField = NULL; m_ShowFieldTextCtrl = NULL; m_VorientFieldText = NULL; m_FieldDatasBoxSizer = NULL; m_FieldSelectionBoxSizer = NULL; ////@end WinEDA_ComponentPropertiesFrame member initialisation ////@begin WinEDA_ComponentPropertiesFrame creation SetExtraStyle(GetExtraStyle()|wxWS_EX_BLOCK_EVENTS); wxDialog::Create( parent, id, caption, pos, size, style ); CreateControls(); if (GetSizer()) { GetSizer()->SetSizeHints(this); } Centre(); ////@end WinEDA_ComponentPropertiesFrame creation return true; } /*! * Control creation for WinEDA_ComponentPropertiesFrame */ void WinEDA_ComponentPropertiesFrame::CreateControls() { SetFont(*g_DialogFont); ////@begin WinEDA_ComponentPropertiesFrame content construction // Generated by DialogBlocks, 07/11/2007 08:28:00 (unregistered) WinEDA_ComponentPropertiesFrame* itemDialog1 = this; m_GeneralBoxSizer = new wxBoxSizer(wxVERTICAL); itemDialog1->SetSizer(m_GeneralBoxSizer); m_NoteBook = new wxNotebook( itemDialog1, ID_SCHEDIT_NOTEBOOK, wxDefaultPosition, wxDefaultSize, wxNB_DEFAULT|wxNB_TOP ); m_PanelBasic = new wxPanel( m_NoteBook, ID_PANEL_BASIC, wxDefaultPosition, wxDefaultSize, wxSUNKEN_BORDER|wxTAB_TRAVERSAL ); wxBoxSizer* itemBoxSizer5 = new wxBoxSizer(wxHORIZONTAL); m_PanelBasic->SetSizer(itemBoxSizer5); wxArrayString m_SelectUnitStrings; m_SelectUnitStrings.Add(_("Unit 1")); m_SelectUnitStrings.Add(_("Unit 2")); m_SelectUnitStrings.Add(_("Unit 3")); m_SelectUnitStrings.Add(_("Unit 4")); m_SelectUnitStrings.Add(_("Unit 5")); m_SelectUnitStrings.Add(_("Unit 6")); m_SelectUnitStrings.Add(_("Unit 7")); m_SelectUnitStrings.Add(_("Unit 8")); m_SelectUnitStrings.Add(_("Unit 9")); m_SelectUnitStrings.Add(_("Unit 10")); m_SelectUnitStrings.Add(_("Unit 11")); m_SelectUnitStrings.Add(_("Unit 12")); m_SelectUnitStrings.Add(_("Unit 13")); m_SelectUnitStrings.Add(_("Unit 14")); m_SelectUnitStrings.Add(_("Unit 15")); m_SelectUnitStrings.Add(_("Unit 16")); m_SelectUnitStrings.Add(_("Unit 16")); m_SelectUnitStrings.Add(_("Unit 17")); m_SelectUnitStrings.Add(_("Unit 18")); m_SelectUnitStrings.Add(_("Unit 19")); m_SelectUnitStrings.Add(_("Unit 20")); m_SelectUnitStrings.Add(_("Unit 21")); m_SelectUnitStrings.Add(_("Unit 22")); m_SelectUnitStrings.Add(_("Unit 23")); m_SelectUnitStrings.Add(_("Unit 24")); m_SelectUnitStrings.Add(_("Unit 25")); m_SelectUnitStrings.Add(_("Unit 26")); m_SelectUnit = new wxRadioBox( m_PanelBasic, ID_RADIOBOX_UNIT, _("Unit:"), wxDefaultPosition, wxDefaultSize, m_SelectUnitStrings, 9, wxRA_SPECIFY_ROWS ); m_SelectUnit->SetSelection(0); itemBoxSizer5->Add(m_SelectUnit, 0, wxGROW|wxALL, 5); wxBoxSizer* itemBoxSizer7 = new wxBoxSizer(wxVERTICAL); itemBoxSizer5->Add(itemBoxSizer7, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); wxBoxSizer* itemBoxSizer8 = new wxBoxSizer(wxHORIZONTAL); itemBoxSizer7->Add(itemBoxSizer8, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); wxArrayString m_OrientUnitStrings; m_OrientUnitStrings.Add(_("0")); m_OrientUnitStrings.Add(_("+90")); m_OrientUnitStrings.Add(_("180")); m_OrientUnitStrings.Add(_("-90")); m_OrientUnit = new wxRadioBox( m_PanelBasic, ID_RADIOBOX_ORIENT, _("Orient:"), wxDefaultPosition, wxDefaultSize, m_OrientUnitStrings, 1, wxRA_SPECIFY_COLS ); m_OrientUnit->SetSelection(0); itemBoxSizer8->Add(m_OrientUnit, 0, wxGROW|wxLEFT|wxRIGHT, 5); wxArrayString m_MirrorUnitStrings; m_MirrorUnitStrings.Add(_("Normal")); m_MirrorUnitStrings.Add(_("Mirror --")); m_MirrorUnitStrings.Add(_("Mirror !")); m_MirrorUnit = new wxRadioBox( m_PanelBasic, ID_RADIOBOX_MIRROR, _("Mirror:"), wxDefaultPosition, wxDefaultSize, m_MirrorUnitStrings, 1, wxRA_SPECIFY_COLS ); m_MirrorUnit->SetSelection(0); itemBoxSizer8->Add(m_MirrorUnit, 0, wxGROW|wxLEFT|wxRIGHT, 5); m_MsgPartLocked = new wxStaticText( m_PanelBasic, wxID_STATIC, _("Parts are locked"), wxDefaultPosition, wxDefaultSize, 0 ); itemBoxSizer7->Add(m_MsgPartLocked, 0, wxALIGN_LEFT|wxALL|wxADJUST_MINSIZE, 5); m_ConvertButt = new wxCheckBox( m_PanelBasic, ID_CHECKBOX, _("Convert"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE ); m_ConvertButt->SetValue(false); itemBoxSizer7->Add(m_ConvertButt, 0, wxALIGN_LEFT|wxALL, 5); wxStaticText* itemStaticText13 = new wxStaticText( m_PanelBasic, wxID_STATIC, _("Chip Name:"), wxDefaultPosition, wxDefaultSize, 0 ); itemStaticText13->SetForegroundColour(wxColour(202, 0, 0)); itemBoxSizer7->Add(itemStaticText13, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5); m_RefInLib = new wxTextCtrl( m_PanelBasic, ID_TEXTCTRL, _T(""), wxDefaultPosition, wxDefaultSize, 0 ); itemBoxSizer7->Add(m_RefInLib, 0, wxGROW|wxLEFT|wxRIGHT|wxBOTTOM, 5); m_NoteBook->AddPage(m_PanelBasic, _("Options")); m_PanelField = new wxPanel( m_NoteBook, ID_PANEL_FIELD, wxDefaultPosition, wxDefaultSize, wxSUNKEN_BORDER|wxTAB_TRAVERSAL ); wxBoxSizer* itemBoxSizer16 = new wxBoxSizer(wxHORIZONTAL); m_PanelField->SetSizer(itemBoxSizer16); wxBoxSizer* itemBoxSizer17 = new wxBoxSizer(wxVERTICAL); itemBoxSizer16->Add(itemBoxSizer17, 0, wxALIGN_TOP|wxALL, 5); wxBoxSizer* itemBoxSizer18 = new wxBoxSizer(wxHORIZONTAL); itemBoxSizer17->Add(itemBoxSizer18, 0, wxGROW|wxALL, 5); m_ShowFieldTextCtrl = new wxCheckBox( m_PanelField, ID_CHECKBOX_SHOW_FILED, _("Show Text"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE ); m_ShowFieldTextCtrl->SetValue(false); itemBoxSizer18->Add(m_ShowFieldTextCtrl, 0, wxGROW|wxALL, 5); m_VorientFieldText = new wxCheckBox( m_PanelField, ID_CHECKBOX_FILED_ORIENT, _("Vertical"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE ); m_VorientFieldText->SetValue(false); itemBoxSizer18->Add(m_VorientFieldText, 0, wxGROW|wxALL, 5); m_FieldDatasBoxSizer = new wxBoxSizer(wxVERTICAL); itemBoxSizer17->Add(m_FieldDatasBoxSizer, 0, wxGROW|wxALL, 5); m_FieldSelectionBoxSizer = new wxBoxSizer(wxVERTICAL); itemBoxSizer16->Add(m_FieldSelectionBoxSizer, 0, wxGROW|wxALL, 5); m_NoteBook->AddPage(m_PanelField, _("Fields")); m_GeneralBoxSizer->Add(m_NoteBook, 0, wxGROW|wxALL, 5); wxBoxSizer* itemBoxSizer23 = new wxBoxSizer(wxHORIZONTAL); m_GeneralBoxSizer->Add(itemBoxSizer23, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); wxButton* itemButton24 = new wxButton( itemDialog1, wxID_CANCEL, _("&Cancel"), wxDefaultPosition, wxDefaultSize, 0 ); itemButton24->SetForegroundColour(wxColour(0, 0, 255)); itemBoxSizer23->Add(itemButton24, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); wxButton* itemButton25 = new wxButton( itemDialog1, ID_RESTORE_CMP_DEFAULTS, _("Defaults"), wxDefaultPosition, wxDefaultSize, 0 ); itemButton25->SetForegroundColour(wxColour(206, 0, 0)); itemBoxSizer23->Add(itemButton25, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); wxButton* itemButton26 = new wxButton( itemDialog1, wxID_OK, _("&OK"), wxDefaultPosition, wxDefaultSize, 0 ); itemButton26->SetForegroundColour(wxColour(0, 128, 0)); itemBoxSizer23->Add(itemButton26, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); ////@end WinEDA_ComponentPropertiesFrame content construction BuildPanelBasic(); BuildPanelFields(); } /*! * Should we show tooltips? */ bool WinEDA_ComponentPropertiesFrame::ShowToolTips() { return true; } /*! * Get bitmap resources */ wxBitmap WinEDA_ComponentPropertiesFrame::GetBitmapResource( const wxString& name ) { // Bitmap retrieval ////@begin WinEDA_ComponentPropertiesFrame bitmap retrieval wxUnusedVar(name); return wxNullBitmap; ////@end WinEDA_ComponentPropertiesFrame bitmap retrieval } /*! * Get icon resources */ wxIcon WinEDA_ComponentPropertiesFrame::GetIconResource( const wxString& name ) { // Icon retrieval ////@begin WinEDA_ComponentPropertiesFrame icon retrieval wxUnusedVar(name); return wxNullIcon; ////@end WinEDA_ComponentPropertiesFrame icon retrieval } /*! * wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL */ void WinEDA_ComponentPropertiesFrame::OnCancelClick( wxCommandEvent& event ) { EndModal( -1 ); } /*! * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RESTORE_CMP_DEFAULTS */ void WinEDA_ComponentPropertiesFrame::OnRestoreCmpDefaultsClick( wxCommandEvent& event ) { SetInitCmp(event); } /*! * wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK */ void WinEDA_ComponentPropertiesFrame::OnOkClick( wxCommandEvent& event ) { ComponentPropertiesAccept(event); }