Commit 24aa7aa5 authored by Brian Sidebotham's avatar Brian Sidebotham

Temporary changes

parent 56f44e2f
...@@ -40,18 +40,18 @@ DIALOG_EESCHEMA_OPTIONS::DIALOG_EESCHEMA_OPTIONS( wxWindow* parent ) : ...@@ -40,18 +40,18 @@ DIALOG_EESCHEMA_OPTIONS::DIALOG_EESCHEMA_OPTIONS( wxWindow* parent ) :
wxListItem col0; wxListItem col0;
col0.SetId( 0 ); col0.SetId( 0 );
col0.SetText( _( "ID" ) ); col0.SetText( _( "Field Name" ) );
col0.SetWidth( 50 ); col0.SetWidth( 150 );
wxListItem col1; wxListItem col1;
col1.SetId( 1 ); col1.SetId( 1 );
col1.SetText( _( "Name" ) ); col1.SetText( _( "Default Value" ) );
col1.SetWidth( 150 ); col1.SetWidth( 250 );
wxListItem col2; wxListItem col2;
col2.SetId( 2 ); col2.SetId( 2 );
col2.SetText( _( "Default Value" ) ); col2.SetText( _( "Visible" ) );
col2.SetWidth( 250 ); col2.SetWidth( 100 );
templateFieldListCtrl->InsertColumn( 0, col0 ); templateFieldListCtrl->InsertColumn( 0, col0 );
templateFieldListCtrl->InsertColumn( 1, col1 ); templateFieldListCtrl->InsertColumn( 1, col1 );
...@@ -142,29 +142,92 @@ void DIALOG_EESCHEMA_OPTIONS::SetGridSizes( const GRIDS& grid_sizes, int grid_id ...@@ -142,29 +142,92 @@ void DIALOG_EESCHEMA_OPTIONS::SetGridSizes( const GRIDS& grid_sizes, int grid_id
void DIALOG_EESCHEMA_OPTIONS::OnAddButtonClick( wxCommandEvent& event ) void DIALOG_EESCHEMA_OPTIONS::OnAddButtonClick( wxCommandEvent& event )
{ {
long itemindex = templateFieldListCtrl->InsertItem( 0, wxT( "ID" ) ); long itemindex = templateFieldListCtrl->InsertItem( templateFieldListCtrl->GetItemCount(), wxT( "New Fieldname" ) );
templateFieldListCtrl->SetItem( itemindex, 1, wxT( "Next Fieldname" ) ); templateFieldListCtrl->SetItem( itemindex, 1, wxT( "Default Value" ) );
templateFieldListCtrl->SetItem( itemindex, 2, wxT( "A Default value" ) ); templateFieldListCtrl->SetItem( itemindex, 2, wxT( "Hidden" ) );
event.Skip(); event.Skip();
} }
void DIALOG_EESCHEMA_OPTIONS::copyPanelToSelected( void )
{
wxListItem iteminfo;
iteminfo.m_itemId = selectedField;
iteminfo.m_mask = wxLIST_MASK_TEXT;
iteminfo.m_col = 0;
iteminfo.m_text = fieldNameTextCtrl->GetValue();
templateFieldListCtrl->SetItem( iteminfo );
iteminfo.m_col = 1;
iteminfo.m_text = fieldDefaultValueTextCtrl->GetValue();
templateFieldListCtrl->SetItem( iteminfo );
/* TODO: Fixme! */
iteminfo.m_col = 2;
iteminfo.m_text = fieldNameTextCtrl->GetValue();
templateFieldListCtrl->SetItem( iteminfo );
}
void DIALOG_EESCHEMA_OPTIONS::copySelectedToPanel( void )
{
wxListItem iteminfo;
iteminfo.m_itemId = selectedField;
iteminfo.m_mask = wxLIST_MASK_TEXT;
iteminfo.m_col = 0;
if( !templateFieldListCtrl->GetItem( iteminfo ) )
return;
fieldNameTextCtrl->SetValue( iteminfo.m_text );
iteminfo.m_col = 1;
if( !templateFieldListCtrl->GetItem( iteminfo ) )
return;
fieldDefaultValueTextCtrl->SetValue( iteminfo.m_text );
iteminfo.m_col = 2;
if( !templateFieldListCtrl->GetItem( iteminfo ) )
return;
if( iteminfo.m_text == wxT( "Hidden" ) )
fieldVisibleCheckbox->SetValue( false );
else
fieldVisibleCheckbox->SetValue( true );
}
void DIALOG_EESCHEMA_OPTIONS::OnTemplateFieldSelected( wxListEvent& event )
{
selectedField = event.GetIndex();
printf( "selectedField = %d\n", selectedField );
copySelectedToPanel();
event.Skip();
}
void DIALOG_EESCHEMA_OPTIONS::OnTemplateFieldDeselected( wxListEvent& event )
{
event.Skip();
}
void DIALOG_EESCHEMA_OPTIONS::SetTemplateFields( const TEMPLATE_FIELDNAMES& aFields ) void DIALOG_EESCHEMA_OPTIONS::SetTemplateFields( const TEMPLATE_FIELDNAMES& aFields )
{ {
printf( "SetTemplateFields %d\n", aFields.size() ); templateFields = aFields;
for( size_t i = 0; i < aFields.size(); i++ ) for( TEMPLATE_FIELDNAMES::iterator fld = templateFields.begin(); fld != templateFields.end(); ++fld )
{ {
long itemindex = templateFieldListCtrl->InsertItem( 0, wxT( "?" ) ); long itemindex = templateFieldListCtrl->InsertItem( 0, wxT( "?" ) );
templateFieldListCtrl->SetItem( itemindex, 1, aFields[i].m_Name ); templateFieldListCtrl->SetItem( itemindex, 1, fld->m_Name );
templateFieldListCtrl->SetItem( itemindex, 2, aFields[i].m_Value ); templateFieldListCtrl->SetItem( itemindex, 2, fld->m_Value );
printf( "Parsed new templateField\n" );
} }
} }
TEMPLATE_FIELDNAMES* DIALOG_EESCHEMA_OPTIONS::GetTemplateFields( void ) TEMPLATE_FIELDNAMES DIALOG_EESCHEMA_OPTIONS::GetTemplateFields( void )
{ {
return &templateFields; return templateFields;
} }
...@@ -38,9 +38,11 @@ class DIALOG_EESCHEMA_OPTIONS : public DIALOG_EESCHEMA_OPTIONS_BASE ...@@ -38,9 +38,11 @@ class DIALOG_EESCHEMA_OPTIONS : public DIALOG_EESCHEMA_OPTIONS_BASE
{ {
protected: protected:
TEMPLATE_FIELDNAMES templateFields; TEMPLATE_FIELDNAMES templateFields;
int selectedField;
void OnAddButtonClick( wxCommandEvent& event ); void OnAddButtonClick( wxCommandEvent& event );
void copySelectedToPanel( void );
void OnTemplateFieldSelected( wxListEvent& event );
void OnTemplateFieldDeselected( wxListEvent& event );
public: public:
DIALOG_EESCHEMA_OPTIONS( wxWindow* parent ); DIALOG_EESCHEMA_OPTIONS( wxWindow* parent );
...@@ -131,7 +133,7 @@ public: ...@@ -131,7 +133,7 @@ public:
bool GetShowPageLimits( void ) { return m_checkPageLimits->GetValue(); } bool GetShowPageLimits( void ) { return m_checkPageLimits->GetValue(); }
void SetTemplateFields( const TEMPLATE_FIELDNAMES& aFields ); void SetTemplateFields( const TEMPLATE_FIELDNAMES& aFields );
TEMPLATE_FIELDNAMES* GetTemplateFields( void ); TEMPLATE_FIELDNAMES GetTemplateFields( void );
private: private:
void OnMiddleBtnPanEnbl( wxCommandEvent& event ) void OnMiddleBtnPanEnbl( wxCommandEvent& event )
......
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 10 2012) // C++ code generated with wxFormBuilder (version Oct 8 2012)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO "NOT" EDIT THIS FILE! // PLEASE DO "NOT" EDIT THIS FILE!
...@@ -11,6 +11,8 @@ ...@@ -11,6 +11,8 @@
#include <wx/artprov.h> #include <wx/artprov.h>
#include <wx/xrc/xmlres.h> #include <wx/xrc/xmlres.h>
#include <wx/intl.h> #include <wx/intl.h>
class DIALOG_SHIM;
#include "dialog_shim.h" #include "dialog_shim.h"
#include <wx/string.h> #include <wx/string.h>
#include <wx/stattext.h> #include <wx/stattext.h>
...@@ -28,6 +30,8 @@ ...@@ -28,6 +30,8 @@
#include <wx/image.h> #include <wx/image.h>
#include <wx/icon.h> #include <wx/icon.h>
#include <wx/listctrl.h> #include <wx/listctrl.h>
#include <wx/textctrl.h>
#include <wx/statbox.h>
#include <wx/button.h> #include <wx/button.h>
#include <wx/notebook.h> #include <wx/notebook.h>
#include <wx/dialog.h> #include <wx/dialog.h>
...@@ -45,6 +49,8 @@ class DIALOG_EESCHEMA_OPTIONS_BASE : public DIALOG_SHIM ...@@ -45,6 +49,8 @@ class DIALOG_EESCHEMA_OPTIONS_BASE : public DIALOG_SHIM
// Private event handlers // Private event handlers
void _wxFB_OnChooseUnits( wxCommandEvent& event ){ OnChooseUnits( event ); } void _wxFB_OnChooseUnits( wxCommandEvent& event ){ OnChooseUnits( event ); }
void _wxFB_OnMiddleBtnPanEnbl( wxCommandEvent& event ){ OnMiddleBtnPanEnbl( event ); } void _wxFB_OnMiddleBtnPanEnbl( wxCommandEvent& event ){ OnMiddleBtnPanEnbl( event ); }
void _wxFB_OnTemplateFieldDeselected( wxListEvent& event ){ OnTemplateFieldDeselected( event ); }
void _wxFB_OnTemplateFieldSelected( wxListEvent& event ){ OnTemplateFieldSelected( event ); }
void _wxFB_OnAddButtonClick( wxCommandEvent& event ){ OnAddButtonClick( event ); } void _wxFB_OnAddButtonClick( wxCommandEvent& event ){ OnAddButtonClick( event ); }
void _wxFB_OnDeleteButtonClick( wxCommandEvent& event ){ OnDeleteButtonClick( event ); } void _wxFB_OnDeleteButtonClick( wxCommandEvent& event ){ OnDeleteButtonClick( event ); }
...@@ -101,6 +107,11 @@ class DIALOG_EESCHEMA_OPTIONS_BASE : public DIALOG_SHIM ...@@ -101,6 +107,11 @@ class DIALOG_EESCHEMA_OPTIONS_BASE : public DIALOG_SHIM
wxCheckBox* m_checkPageLimits; wxCheckBox* m_checkPageLimits;
wxPanel* m_panel2; wxPanel* m_panel2;
wxListCtrl* templateFieldListCtrl; wxListCtrl* templateFieldListCtrl;
wxStaticText* fieldNameLabel;
wxTextCtrl* fieldNameTextCtrl;
wxStaticText* fieldDefaultValueLabel;
wxTextCtrl* fieldDefaultValueTextCtrl;
wxCheckBox* fieldVisibleCheckbox;
wxButton* addFieldButton; wxButton* addFieldButton;
wxButton* deleteFieldButton; wxButton* deleteFieldButton;
wxStdDialogButtonSizer* m_sdbSizer1; wxStdDialogButtonSizer* m_sdbSizer1;
...@@ -110,6 +121,8 @@ class DIALOG_EESCHEMA_OPTIONS_BASE : public DIALOG_SHIM ...@@ -110,6 +121,8 @@ class DIALOG_EESCHEMA_OPTIONS_BASE : public DIALOG_SHIM
// Virtual event handlers, overide them in your derived class // Virtual event handlers, overide them in your derived class
virtual void OnChooseUnits( wxCommandEvent& event ) { event.Skip(); } virtual void OnChooseUnits( wxCommandEvent& event ) { event.Skip(); }
virtual void OnMiddleBtnPanEnbl( wxCommandEvent& event ) { event.Skip(); } virtual void OnMiddleBtnPanEnbl( wxCommandEvent& event ) { event.Skip(); }
virtual void OnTemplateFieldDeselected( wxListEvent& event ) { event.Skip(); }
virtual void OnTemplateFieldSelected( wxListEvent& event ) { event.Skip(); }
virtual void OnAddButtonClick( wxCommandEvent& event ) { event.Skip(); } virtual void OnAddButtonClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnDeleteButtonClick( wxCommandEvent& event ) { event.Skip(); } virtual void OnDeleteButtonClick( wxCommandEvent& event ) { event.Skip(); }
......
...@@ -366,6 +366,16 @@ void SCH_EDIT_FRAME::OnSetOptions( wxCommandEvent& event ) ...@@ -366,6 +366,16 @@ void SCH_EDIT_FRAME::OnSetOptions( wxCommandEvent& event )
// look like the component field property editor, showing visibility and value also // look like the component field property editor, showing visibility and value also
DeleteAllTemplateFieldNames(); DeleteAllTemplateFieldNames();
TEMPLATE_FIELDNAMES newFieldNames = dlg.GetTemplateFields();
for( TEMPLATE_FIELDNAMES::iterator dlgfld = newFieldNames.begin(); dlgfld != newFieldNames.end(); ++dlgfld )
{
TEMPLATE_FIELDNAME fld = *dlgfld;
/* fld.m_Name = dlgfld->m_Name;
fld.m_Value = dlgfld->m_Value;
fld.m_Visible = dlgfld->m_Visible; */
AddTemplateFieldName( fld );
}
/* /*
for( int i=0; i<8; ++i ) // no. fields in this dialog window for( int i=0; i<8; ++i ) // no. fields in this dialog window
{ {
...@@ -786,7 +796,7 @@ void SCH_EDIT_FRAME::SaveSettings( wxConfigBase* aCfg ) ...@@ -786,7 +796,7 @@ void SCH_EDIT_FRAME::SaveSettings( wxConfigBase* aCfg )
m_TemplateFieldNames.Format( &sf, 0 ); m_TemplateFieldNames.Format( &sf, 0 );
DBG(printf("saving formatted template fieldnames:'%s'\n", sf.GetString().c_str() );) printf("saving formatted template fieldnames:'%s'\n", sf.GetString().c_str() );
wxString record = FROM_UTF8( sf.GetString().c_str() ); wxString record = FROM_UTF8( sf.GetString().c_str() );
record.Replace( wxT("\n"), wxT(""), true ); // strip all newlines record.Replace( wxT("\n"), wxT(""), true ); // strip all newlines
......
...@@ -62,6 +62,13 @@ struct TEMPLATE_FIELDNAME ...@@ -62,6 +62,13 @@ struct TEMPLATE_FIELDNAME
{ {
} }
TEMPLATE_FIELDNAME( const TEMPLATE_FIELDNAME& ref )
{
m_Name = ref.m_Name;
m_Value = ref.m_Value;
m_Visible = ref.m_Visible;
}
/** /**
* Function Format * Function Format
* serializes this object out as text into the given OUTPUTFORMATTER. * serializes this object out as text into the given OUTPUTFORMATTER.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment