dialog_edit_component_in_lib.cpp 11 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301
/////////////////////////////////////////////////////////////////////////////
// Name:        dialog_edit_component_in_lib.cpp
// Purpose:     
// Author:      jean-pierre Charras
// Modified by: 
// Created:     02/03/2006 08:51:09
// RCS-ID:      
// Copyright:   License GNU
// Licence:     
/////////////////////////////////////////////////////////////////////////////

// Generated by DialogBlocks (unregistered), 02/03/2006 08:51:09


////@begin includes
////@end includes

#include "dialog_edit_component_in_lib.h"

////@begin XPM images
////@end XPM images

/*!
 * WinEDA_PartPropertiesFrame type definition
 */

IMPLEMENT_DYNAMIC_CLASS( WinEDA_PartPropertiesFrame, wxDialog )

/*!
 * WinEDA_PartPropertiesFrame event table definition
 */

BEGIN_EVENT_TABLE( WinEDA_PartPropertiesFrame, wxDialog )

////@begin WinEDA_PartPropertiesFrame event table entries
    EVT_BUTTON( ID_COPY_DOC_TO_ALIAS, WinEDA_PartPropertiesFrame::OnCopyDocToAliasClick )

    EVT_BUTTON( ID_BROWSE_DOC_FILES, WinEDA_PartPropertiesFrame::OnBrowseDocFilesClick )

    EVT_BUTTON( wxID_CANCEL, WinEDA_PartPropertiesFrame::OnCancelClick )

    EVT_BUTTON( wxID_OK, WinEDA_PartPropertiesFrame::OnOkClick )

////@end WinEDA_PartPropertiesFrame event table entries
	EVT_RADIOBOX(ID_ON_SELECT_FIELD, WinEDA_PartPropertiesFrame::SelectNewField)
	EVT_BUTTON(ID_ADD_ALIAS, WinEDA_PartPropertiesFrame::AddAliasOfPart)
	EVT_BUTTON(ID_DELETE_ONE_ALIAS, WinEDA_PartPropertiesFrame::DeleteAliasOfPart)
	EVT_BUTTON(ID_DELETE_ALL_ALIAS, WinEDA_PartPropertiesFrame::DeleteAllAliasOfPart)
	EVT_BUTTON(ID_ADD_FOOTPRINT_FILTER, WinEDA_PartPropertiesFrame::AddFootprintFilter)
	EVT_BUTTON(ID_DELETE_ONE_FOOTPRINT_FILTER, WinEDA_PartPropertiesFrame::DeleteOneFootprintFilter)
	EVT_BUTTON(ID_DELETE_ALL_FOOTPRINT_FILTER, WinEDA_PartPropertiesFrame::DeleteAllFootprintFilter)
END_EVENT_TABLE()

/*!
 * WinEDA_PartPropertiesFrame constructors
 */

WinEDA_PartPropertiesFrame::WinEDA_PartPropertiesFrame( )
{
}

WinEDA_PartPropertiesFrame::WinEDA_PartPropertiesFrame( WinEDA_LibeditFrame* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
{
	m_Parent = parent;
	m_RecreateToolbar = FALSE;
	m_AliasLocation = -1;
	m_CurrentFieldId = 0;
   
	InitBuffers();
	
    Create(parent, id, caption, pos, size, style);
	
	SetTitle(m_Title);
}

/*!
 * WinEDA_PartPropertiesFrame creator
 */

bool WinEDA_PartPropertiesFrame::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
{
	m_FieldNameCtrl = NULL;
////@begin WinEDA_PartPropertiesFrame member initialisation
    m_GeneralBoxSizer = NULL;
    m_NoteBook = NULL;
    m_PanelBasic = NULL;
    m_PanelBasicBoxSizer = NULL;
    m_OptionsBoxSizer = NULL;
    SelNumberOfUnits = NULL;
    m_SetSkew = NULL;
    m_OptionPower = NULL;
    m_OptionPartsLocked = NULL;
    m_PanelDoc = NULL;
    m_PanelDocBoxSizer = NULL;
    m_Doc = NULL;
    m_Keywords = NULL;
    m_Docfile = NULL;
    m_ButtonCopyDoc = NULL;
    m_PanelAlias = NULL;
////@end WinEDA_PartPropertiesFrame member initialisation

////@begin WinEDA_PartPropertiesFrame creation
    SetExtraStyle(GetExtraStyle()|wxWS_EX_BLOCK_EVENTS);
    wxDialog::Create( parent, id, caption, pos, size, style );

    CreateControls();
    GetSizer()->Fit(this);
    GetSizer()->SetSizeHints(this);
    Centre();
////@end WinEDA_PartPropertiesFrame creation
    return true;
}

/*!
 * Control creation for WinEDA_PartPropertiesFrame
 */

void WinEDA_PartPropertiesFrame::CreateControls()
{    
	SetFont(*g_DialogFont);
	
////@begin WinEDA_PartPropertiesFrame content construction
    // Generated by DialogBlocks, 02/03/2006 16:15:16 (unregistered)

    WinEDA_PartPropertiesFrame* itemDialog1 = this;

    m_GeneralBoxSizer = new wxBoxSizer(wxVERTICAL);
    itemDialog1->SetSizer(m_GeneralBoxSizer);

    m_NoteBook = new wxNotebook( itemDialog1, ID_LIBEDIT_NOTEBOOK, wxDefaultPosition, wxDefaultSize, wxNB_TOP );

    m_PanelBasic = new wxPanel( m_NoteBook, ID_PANEL_BASIC, wxDefaultPosition, wxDefaultSize, wxSUNKEN_BORDER|wxTAB_TRAVERSAL );
    m_PanelBasicBoxSizer = new wxBoxSizer(wxVERTICAL);
    m_PanelBasic->SetSizer(m_PanelBasicBoxSizer);

    wxStaticBox* itemStaticBoxSizer6Static = new wxStaticBox(m_PanelBasic, wxID_ANY, _("General :"));
    m_OptionsBoxSizer = new wxStaticBoxSizer(itemStaticBoxSizer6Static, wxVERTICAL);
    m_PanelBasicBoxSizer->Add(m_OptionsBoxSizer, 0, wxALIGN_LEFT|wxALL, 5);

    wxBoxSizer* itemBoxSizer7 = new wxBoxSizer(wxHORIZONTAL);
    m_PanelBasicBoxSizer->Add(itemBoxSizer7, 0, wxALIGN_LEFT|wxALL, 5);
    wxBoxSizer* itemBoxSizer8 = new wxBoxSizer(wxVERTICAL);
    itemBoxSizer7->Add(itemBoxSizer8, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
    wxStaticText* itemStaticText9 = new wxStaticText( m_PanelBasic, wxID_STATIC, _("Number of Units:"), wxDefaultPosition, wxDefaultSize, 0 );
    itemBoxSizer8->Add(itemStaticText9, 0, wxGROW|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5);

    SelNumberOfUnits = new wxSpinCtrl( m_PanelBasic, ID_SPINCTRL1, _T("0"), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 1, 26, 0 );
    itemBoxSizer8->Add(SelNumberOfUnits, 0, wxALIGN_CENTER_HORIZONTAL|wxLEFT|wxRIGHT|wxBOTTOM, 5);

    wxBoxSizer* itemBoxSizer11 = new wxBoxSizer(wxVERTICAL);
    itemBoxSizer7->Add(itemBoxSizer11, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
    wxStaticText* itemStaticText12 = new wxStaticText( m_PanelBasic, wxID_STATIC, _("Skew:"), wxDefaultPosition, wxDefaultSize, 0 );
    itemBoxSizer11->Add(itemStaticText12, 0, wxGROW|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5);

    m_SetSkew = new wxSpinCtrl( m_PanelBasic, ID_SPINCTRL, _T("0"), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 100, 0 );
    itemBoxSizer11->Add(m_SetSkew, 0, wxALIGN_CENTER_HORIZONTAL|wxLEFT|wxRIGHT|wxBOTTOM, 5);

    m_OptionPower = new wxCheckBox( m_PanelBasic, ID_CHECKBOX, _("Power Symbol"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE );
    m_OptionPower->SetValue(false);
    m_PanelBasicBoxSizer->Add(m_OptionPower, 0, wxGROW|wxALL, 5);

    m_OptionPartsLocked = new wxCheckBox( m_PanelBasic, ID_CHECKBOX1, _("Parts are locked"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE );
    m_OptionPartsLocked->SetValue(false);
    m_PanelBasicBoxSizer->Add(m_OptionPartsLocked, 0, wxGROW|wxALL, 5);

    m_NoteBook->AddPage(m_PanelBasic, _("Options"));

    m_PanelDoc = new wxPanel( m_NoteBook, ID_PANEL_DOC, wxDefaultPosition, wxDefaultSize, wxSUNKEN_BORDER|wxTAB_TRAVERSAL );
    m_PanelDocBoxSizer = new wxBoxSizer(wxVERTICAL);
    m_PanelDoc->SetSizer(m_PanelDocBoxSizer);

    wxStaticText* itemStaticText18 = new wxStaticText( m_PanelDoc, wxID_STATIC, _("Doc:"), wxDefaultPosition, wxDefaultSize, 0 );
    itemStaticText18->SetForegroundColour(wxColour(196, 0, 0));
    m_PanelDocBoxSizer->Add(itemStaticText18, 0, wxGROW|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5);

    m_Doc = new wxTextCtrl( m_PanelDoc, ID_TEXTCTRL, _T(""), wxDefaultPosition, wxDefaultSize, 0 );
    m_PanelDocBoxSizer->Add(m_Doc, 0, wxGROW|wxLEFT|wxRIGHT|wxBOTTOM, 5);

    wxStaticText* itemStaticText20 = new wxStaticText( m_PanelDoc, wxID_STATIC, _("Keywords:"), wxDefaultPosition, wxDefaultSize, 0 );
    itemStaticText20->SetForegroundColour(wxColour(196, 0, 0));
    m_PanelDocBoxSizer->Add(itemStaticText20, 0, wxGROW|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5);

    m_Keywords = new wxTextCtrl( m_PanelDoc, ID_TEXTCTRL1, _T(""), wxDefaultPosition, wxDefaultSize, 0 );
    m_PanelDocBoxSizer->Add(m_Keywords, 0, wxGROW|wxLEFT|wxRIGHT|wxBOTTOM, 5);

    wxStaticText* itemStaticText22 = new wxStaticText( m_PanelDoc, wxID_STATIC, _("DocFileName:"), wxDefaultPosition, wxDefaultSize, 0 );
    itemStaticText22->SetForegroundColour(wxColour(196, 0, 0));
    m_PanelDocBoxSizer->Add(itemStaticText22, 0, wxGROW|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5);

    m_Docfile = new wxTextCtrl( m_PanelDoc, ID_TEXTCTRL2, _T(""), wxDefaultPosition, wxDefaultSize, 0 );
    m_PanelDocBoxSizer->Add(m_Docfile, 0, wxGROW|wxLEFT|wxRIGHT|wxBOTTOM, 5);

    wxBoxSizer* itemBoxSizer24 = new wxBoxSizer(wxHORIZONTAL);
    m_PanelDocBoxSizer->Add(itemBoxSizer24, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
    m_ButtonCopyDoc = new wxButton( m_PanelDoc, ID_COPY_DOC_TO_ALIAS, _("Copy Doc"), wxDefaultPosition, wxDefaultSize, 0 );
    m_ButtonCopyDoc->SetForegroundColour(wxColour(0, 0, 255));
    itemBoxSizer24->Add(m_ButtonCopyDoc, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);

    wxButton* itemButton26 = new wxButton( m_PanelDoc, ID_BROWSE_DOC_FILES, _("Browse DocFiles"), wxDefaultPosition, wxDefaultSize, 0 );
    itemButton26->SetForegroundColour(wxColour(202, 0, 0));
    itemBoxSizer24->Add(itemButton26, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);

    m_NoteBook->AddPage(m_PanelDoc, _("Doc"));

    m_PanelAlias = new wxPanel( m_NoteBook, ID_PANEL_ALIAS, wxDefaultPosition, wxDefaultSize, wxSUNKEN_BORDER|wxTAB_TRAVERSAL );

    m_NoteBook->AddPage(m_PanelAlias, _("Alias"));

    m_GeneralBoxSizer->Add(m_NoteBook, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);

    wxBoxSizer* itemBoxSizer28 = new wxBoxSizer(wxHORIZONTAL);
    m_GeneralBoxSizer->Add(itemBoxSizer28, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);

    wxButton* itemButton29 = new wxButton( itemDialog1, wxID_CANCEL, _("&Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
    itemButton29->SetForegroundColour(wxColour(0, 0, 255));
    itemBoxSizer28->Add(itemButton29, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);

    wxButton* itemButton30 = new wxButton( itemDialog1, wxID_OK, _("&OK"), wxDefaultPosition, wxDefaultSize, 0 );
    itemButton30->SetDefault();
    itemButton30->SetForegroundColour(wxColour(202, 0, 0));
    itemBoxSizer28->Add(itemButton30, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);

////@end WinEDA_PartPropertiesFrame content construction
	BuildPanelBasic();
	BuildPanelDoc();
	BuildPanelAlias();
	BuildPanelEditField();	// Add panel Field edition
	BuildPanelFootprintFilter();
}

/*!
 * Should we show tooltips?
 */

bool WinEDA_PartPropertiesFrame::ShowToolTips()
{
    return true;
}

/*!
 * Get bitmap resources
 */

wxBitmap WinEDA_PartPropertiesFrame::GetBitmapResource( const wxString& name )
{
    // Bitmap retrieval
////@begin WinEDA_PartPropertiesFrame bitmap retrieval
    wxUnusedVar(name);
    return wxNullBitmap;
////@end WinEDA_PartPropertiesFrame bitmap retrieval
}

/*!
 * Get icon resources
 */

wxIcon WinEDA_PartPropertiesFrame::GetIconResource( const wxString& name )
{
    // Icon retrieval
////@begin WinEDA_PartPropertiesFrame icon retrieval
    wxUnusedVar(name);
    return wxNullIcon;
////@end WinEDA_PartPropertiesFrame icon retrieval
}
/*!
 * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_COPY_DOC_TO_ALIAS
 */

void WinEDA_PartPropertiesFrame::OnCopyDocToAliasClick( wxCommandEvent& event )
{
	CopyDocToAlias(event);
}

/*!
 * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_BROWSE_DOC_FILES
 */

void WinEDA_PartPropertiesFrame::OnBrowseDocFilesClick( wxCommandEvent& event )
{
	BrowseAndSelectDocFile(event);
}

/*!
 * wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL
 */

void WinEDA_PartPropertiesFrame::OnCancelClick( wxCommandEvent& event )
{
	EndModal(0);
}

/*!
 * wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK
 */

void WinEDA_PartPropertiesFrame::OnOkClick( wxCommandEvent& event )
{
	PartPropertiesAccept(event);
}