kicad/eeschema/dialog_edit_component_in_sc...

314 lines
10 KiB
C++
Raw Normal View History

/////////////////////////////////////////////////////////////////////////////
// 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_CLOSE, WinEDA_ComponentPropertiesFrame::OnCloseClick )
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,
EDA_SchComponentStruct * 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, 24/11/2006 13:20:15 (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);
wxString m_SelectUnitStrings[] = {
_("Unit 1"),
_("Unit 2"),
_("Unit 3"),
_("Unit 4"),
_("Unit 5"),
_("Unit 6"),
_("Unit 7"),
_("Unit 8"),
_("Unit 9"),
_("Unit 10"),
_("Unit 11"),
_("Unit 12"),
_("Unit 13"),
_("Unit 14"),
_("Unit 15"),
_("Unit 16"),
_("Unit 16"),
_("Unit 17"),
_("Unit 18"),
_("Unit 19"),
_("Unit 20"),
_("Unit 21"),
_("Unit 22"),
_("Unit 23"),
_("Unit 24"),
_("Unit 25"),
_("Unit 26")
};
m_SelectUnit = new wxRadioBox( m_PanelBasic, ID_RADIOBOX_UNIT, _("Unit:"), wxDefaultPosition, wxDefaultSize, 27, 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);
wxString m_OrientUnitStrings[] = {
_("0"),
_("+90"),
_("180"),
_("-90")
};
m_OrientUnit = new wxRadioBox( m_PanelBasic, ID_RADIOBOX_ORIENT, _("Orient:"), wxDefaultPosition, wxDefaultSize, 4, m_OrientUnitStrings, 1, wxRA_SPECIFY_COLS );
m_OrientUnit->SetSelection(0);
itemBoxSizer8->Add(m_OrientUnit, 0, wxGROW|wxLEFT|wxRIGHT, 5);
wxString m_MirrorUnitStrings[] = {
_("Normal"),
_("Mirror --"),
_("Mirror !")
};
m_MirrorUnit = new wxRadioBox( m_PanelBasic, ID_RADIOBOX_MIRROR, _("Mirror:"), wxDefaultPosition, wxDefaultSize, 3, 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_CLOSE, _("&Close"), 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_CLOSE
*/
void WinEDA_ComponentPropertiesFrame::OnCloseClick( wxCommandEvent& event )
{
Close(true);
}
/*!
* 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);
}