kicad-developers team mailing list archive
-
kicad-developers team
-
Mailing list archive
-
Message #15106
[PATCH] eeschema: add Select button for footprints in single component field edits
Hi,
This patch makes the changes to add a selection button to the simple
dialog that appears when you right-click on a component and choose
Edit Component > Footprint. The button will open the footprint
browser. This is just like the component property editor having the
assign footprint button.
+ Doxygenization of the class.
This also works in the library editor when you click on the footprint
text and go to edit it.
Patches attached and a bazr branch submitted for merge.
https://code.launchpad.net/~mark-roszko/kicad/eeschema_footprint_pick
From 9433680797d5b1dcc7f115ea6ace5e8452077bd0 Mon Sep 17 00:00:00 2001
From: Mark Roszko <mark.roszko@xxxxxxxxx>
Date: Sat, 11 Oct 2014 01:12:58 -0400
Subject: [PATCH 1/2] Add helper button to select footprint from browser when
editing single component fields.
---
eeschema/dialogs/dialog_edit_one_field.cpp | 41 ++++
eeschema/dialogs/dialog_edit_one_field.h | 16 +-
eeschema/dialogs/dialog_lib_edit_text.cpp | 3 +
eeschema/dialogs/dialog_lib_edit_text_base.cpp | 19 +-
eeschema/dialogs/dialog_lib_edit_text_base.fbp | 283 +++++++++++++++++--------
eeschema/dialogs/dialog_lib_edit_text_base.h | 7 +-
eeschema/edit_component_in_schematic.cpp | 4 +-
eeschema/libfield.cpp | 4 +-
8 files changed, 275 insertions(+), 102 deletions(-)
diff --git a/eeschema/dialogs/dialog_edit_one_field.cpp b/eeschema/dialogs/dialog_edit_one_field.cpp
index 055eb77..b4a9459 100644
--- a/eeschema/dialogs/dialog_edit_one_field.cpp
+++ b/eeschema/dialogs/dialog_edit_one_field.cpp
@@ -30,6 +30,7 @@
#include <fctsys.h>
#include <common.h>
#include <base_units.h>
+#include <kiway.h>
#include <general.h>
#include <sch_base_frame.h>
@@ -99,6 +100,23 @@ void DIALOG_EDIT_ONE_FIELD::initDlg_base()
}
+void DIALOG_EDIT_ONE_FIELD::OnTextValueSelectButtonClick( wxCommandEvent& aEvent )
+{
+ // pick a footprint using the footprint picker.
+ wxString fpid;
+
+ KIWAY_PLAYER* frame = Kiway().Player( FRAME_PCB_MODULE_VIEWER_MODAL, true );
+
+ if( frame->ShowModal( &fpid, this ) )
+ {
+ // DBG( printf( "%s: %s\n", __func__, TO_UTF8( fpid ) ); )
+ m_TextValue->SetValue( fpid );
+ }
+
+ frame->Destroy();
+}
+
+
void DIALOG_LIB_EDIT_ONE_FIELD::initDlg()
{
m_textsize = m_field->GetSize().x;
@@ -117,6 +135,17 @@ void DIALOG_LIB_EDIT_ONE_FIELD::initDlg()
m_textHjustify = m_field->GetHorizJustify();
m_textVjustify = m_field->GetVertJustify();
+ if( m_field->GetId() == FOOTPRINT )
+ {
+ m_TextValueSelectButton->Show();
+ m_TextValueSelectButton->Enable();
+ }
+ else
+ {
+ m_TextValueSelectButton->Hide();
+ m_TextValueSelectButton->Disable();
+ }
+
initDlg_base();
}
@@ -197,6 +226,17 @@ void DIALOG_SCH_EDIT_ONE_FIELD::initDlg()
m_textHjustify = m_field->GetHorizJustify();
m_textVjustify = m_field->GetVertJustify();
+ if( m_field->GetId() == FOOTPRINT )
+ {
+ m_TextValueSelectButton->Show();
+ m_TextValueSelectButton->Enable();
+ }
+ else
+ {
+ m_TextValueSelectButton->Hide();
+ m_TextValueSelectButton->Disable();
+ }
+
initDlg_base();
}
@@ -224,3 +264,4 @@ void DIALOG_SCH_EDIT_ONE_FIELD::TransfertDataToField()
m_field->SetHorizJustify( m_textHjustify );
m_field->SetVertJustify( m_textVjustify );
}
+
diff --git a/eeschema/dialogs/dialog_edit_one_field.h b/eeschema/dialogs/dialog_edit_one_field.h
index d09474c..263d50c 100644
--- a/eeschema/dialogs/dialog_edit_one_field.h
+++ b/eeschema/dialogs/dialog_edit_one_field.h
@@ -34,6 +34,8 @@ class LIB_FIELD;
class SCH_FIELD;
// Basic class to edit a field: a schematic or a lib component field
+// DIALOG_EDIT_ONE_FIELD is setup in expectection of its children
+// possibly using Kiway player so ShowQuasiModal is required
class DIALOG_EDIT_ONE_FIELD : public DIALOG_LIB_EDIT_TEXT_BASE
{
protected:
@@ -62,16 +64,24 @@ public:
m_TextValue->SetValue( aText );
}
+
protected:
void initDlg_base( );
+ void OnTextValueSelectButtonClick( wxCommandEvent& aEvent );
+
void OnOkClick( wxCommandEvent& aEvent )
{
- EndModal(wxID_OK);
+ EndQuasiModal( wxID_OK );
+ }
+
+ void OnCancelClick( wxCommandEvent& event )
+ {
+ EndQuasiModal( wxID_CANCEL );
}
- void OnCancelClick( wxCommandEvent& aEvent )
+ void OnCloseDialog( wxCloseEvent& aEvent )
{
- EndModal(wxID_CANCEL);
+ EndQuasiModal( wxID_CANCEL );
}
};
diff --git a/eeschema/dialogs/dialog_lib_edit_text.cpp b/eeschema/dialogs/dialog_lib_edit_text.cpp
index 6530175..632e6f6 100644
--- a/eeschema/dialogs/dialog_lib_edit_text.cpp
+++ b/eeschema/dialogs/dialog_lib_edit_text.cpp
@@ -131,6 +131,9 @@ void DIALOG_LIB_EDIT_TEXT::initDlg( )
m_TextSizeText->SetLabel( msg );
m_sdbSizerButtonsOK->SetDefault();
+
+ // Hide the select button as the child dialog classes use this
+ m_TextValueSelectButton->Hide();
}
diff --git a/eeschema/dialogs/dialog_lib_edit_text_base.cpp b/eeschema/dialogs/dialog_lib_edit_text_base.cpp
index 85e80ca..b5d206f 100644
--- a/eeschema/dialogs/dialog_lib_edit_text_base.cpp
+++ b/eeschema/dialogs/dialog_lib_edit_text_base.cpp
@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
-// C++ code generated with wxFormBuilder (version Nov 6 2013)
+// C++ code generated with wxFormBuilder (version Jun 6 2014)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
@@ -29,11 +29,20 @@ DIALOG_LIB_EDIT_TEXT_BASE::DIALOG_LIB_EDIT_TEXT_BASE( wxWindow* parent, wxWindow
m_staticText1->Wrap( -1 );
bTextValueBoxSizer->Add( m_staticText1, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
+ wxBoxSizer* bTextValueOptsSizer;
+ bTextValueOptsSizer = new wxBoxSizer( wxHORIZONTAL );
+
m_TextValue = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_TextValue->SetMaxLength( 0 );
m_TextValue->SetMinSize( wxSize( 200,-1 ) );
- bTextValueBoxSizer->Add( m_TextValue, 1, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
+ bTextValueOptsSizer->Add( m_TextValue, 1, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
+
+ m_TextValueSelectButton = new wxButton( this, wxID_ANY, _("Select"), wxDefaultPosition, wxDefaultSize, 0 );
+ bTextValueOptsSizer->Add( m_TextValueSelectButton, 0, wxRIGHT, 5 );
+
+
+ bTextValueBoxSizer->Add( bTextValueOptsSizer, 1, wxEXPAND, 5 );
bUpperBoxSizer->Add( bTextValueBoxSizer, 1, wxEXPAND, 5 );
@@ -82,7 +91,7 @@ DIALOG_LIB_EDIT_TEXT_BASE::DIALOG_LIB_EDIT_TEXT_BASE( wxWindow* parent, wxWindow
wxString m_TextShapeOptChoices[] = { _("Normal"), _("Italic"), _("Bold"), _("Bold Italic") };
int m_TextShapeOptNChoices = sizeof( m_TextShapeOptChoices ) / sizeof( wxString );
m_TextShapeOpt = new wxRadioBox( this, wxID_ANY, _("Style"), wxDefaultPosition, wxDefaultSize, m_TextShapeOptNChoices, m_TextShapeOptChoices, 1, wxRA_SPECIFY_COLS );
- m_TextShapeOpt->SetSelection( 0 );
+ m_TextShapeOpt->SetSelection( 3 );
bBottomtBoxSizer->Add( m_TextShapeOpt, 1, wxALL|wxEXPAND, 5 );
wxString m_TextHJustificationOptChoices[] = { _("Align left"), _("Align center"), _("Align right") };
@@ -124,6 +133,8 @@ DIALOG_LIB_EDIT_TEXT_BASE::DIALOG_LIB_EDIT_TEXT_BASE( wxWindow* parent, wxWindow
bMainSizer->Fit( this );
// Connect Events
+ this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_LIB_EDIT_TEXT_BASE::OnCloseDialog ) );
+ m_TextValueSelectButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_LIB_EDIT_TEXT_BASE::OnTextValueSelectButtonClick ), NULL, this );
m_sdbSizerButtonsCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_LIB_EDIT_TEXT_BASE::OnCancelClick ), NULL, this );
m_sdbSizerButtonsOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_LIB_EDIT_TEXT_BASE::OnOkClick ), NULL, this );
}
@@ -131,6 +142,8 @@ DIALOG_LIB_EDIT_TEXT_BASE::DIALOG_LIB_EDIT_TEXT_BASE( wxWindow* parent, wxWindow
DIALOG_LIB_EDIT_TEXT_BASE::~DIALOG_LIB_EDIT_TEXT_BASE()
{
// Disconnect Events
+ this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_LIB_EDIT_TEXT_BASE::OnCloseDialog ) );
+ m_TextValueSelectButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_LIB_EDIT_TEXT_BASE::OnTextValueSelectButtonClick ), NULL, this );
m_sdbSizerButtonsCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_LIB_EDIT_TEXT_BASE::OnCancelClick ), NULL, this );
m_sdbSizerButtonsOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_LIB_EDIT_TEXT_BASE::OnOkClick ), NULL, this );
diff --git a/eeschema/dialogs/dialog_lib_edit_text_base.fbp b/eeschema/dialogs/dialog_lib_edit_text_base.fbp
index 8c53332..79aeb98 100644
--- a/eeschema/dialogs/dialog_lib_edit_text_base.fbp
+++ b/eeschema/dialogs/dialog_lib_edit_text_base.fbp
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<wxFormBuilder_Project>
- <FileVersion major="1" minor="11" />
+ <FileVersion major="1" minor="13" />
<object class="Project" expanded="1">
<property name="class_decoration"></property>
<property name="code_generation">C++</property>
@@ -61,7 +61,7 @@
<event name="OnAuiPaneRestore"></event>
<event name="OnAuiRender"></event>
<event name="OnChar"></event>
- <event name="OnClose"></event>
+ <event name="OnClose">OnCloseDialog</event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnHibernate"></event>
@@ -111,11 +111,11 @@
<property name="name">bUpperBoxSizer</property>
<property name="orient">wxHORIZONTAL</property>
<property name="permission">none</property>
- <object class="sizeritem" expanded="0">
+ <object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">1</property>
- <object class="wxBoxSizer" expanded="0">
+ <object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bTextValueBoxSizer</property>
<property name="orient">wxVERTICAL</property>
@@ -203,95 +203,194 @@
<event name="OnUpdateUI"></event>
</object>
</object>
- <object class="sizeritem" expanded="0">
+ <object class="sizeritem" expanded="1">
<property name="border">5</property>
- <property name="flag">wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND</property>
+ <property name="flag">wxEXPAND</property>
<property name="proportion">1</property>
- <object class="wxTextCtrl" expanded="0">
- <property name="BottomDockable">1</property>
- <property name="LeftDockable">1</property>
- <property name="RightDockable">1</property>
- <property name="TopDockable">1</property>
- <property name="aui_layer"></property>
- <property name="aui_name"></property>
- <property name="aui_position"></property>
- <property name="aui_row"></property>
- <property name="best_size"></property>
- <property name="bg"></property>
- <property name="caption"></property>
- <property name="caption_visible">1</property>
- <property name="center_pane">0</property>
- <property name="close_button">1</property>
- <property name="context_help"></property>
- <property name="context_menu">1</property>
- <property name="default_pane">0</property>
- <property name="dock">Dock</property>
- <property name="dock_fixed">0</property>
- <property name="docking">Left</property>
- <property name="enabled">1</property>
- <property name="fg"></property>
- <property name="floatable">1</property>
- <property name="font"></property>
- <property name="gripper">0</property>
- <property name="hidden">0</property>
- <property name="id">wxID_ANY</property>
- <property name="max_size"></property>
- <property name="maximize_button">0</property>
- <property name="maximum_size"></property>
- <property name="maxlength">0</property>
- <property name="min_size"></property>
- <property name="minimize_button">0</property>
- <property name="minimum_size">200,-1</property>
- <property name="moveable">1</property>
- <property name="name">m_TextValue</property>
- <property name="pane_border">1</property>
- <property name="pane_position"></property>
- <property name="pane_size"></property>
- <property name="permission">protected</property>
- <property name="pin_button">1</property>
- <property name="pos"></property>
- <property name="resize">Resizable</property>
- <property name="show">1</property>
- <property name="size"></property>
- <property name="style"></property>
- <property name="subclass"></property>
- <property name="toolbar_pane">0</property>
- <property name="tooltip"></property>
- <property name="validator_data_type"></property>
- <property name="validator_style">wxFILTER_NONE</property>
- <property name="validator_type">wxDefaultValidator</property>
- <property name="validator_variable"></property>
- <property name="value"></property>
- <property name="window_extra_style"></property>
- <property name="window_name"></property>
- <property name="window_style"></property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnText"></event>
- <event name="OnTextEnter"></event>
- <event name="OnTextMaxLen"></event>
- <event name="OnTextURL"></event>
- <event name="OnUpdateUI"></event>
+ <object class="wxBoxSizer" expanded="1">
+ <property name="minimum_size"></property>
+ <property name="name">bTextValueOptsSizer</property>
+ <property name="orient">wxHORIZONTAL</property>
+ <property name="permission">none</property>
+ <object class="sizeritem" expanded="0">
+ <property name="border">5</property>
+ <property name="flag">wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND</property>
+ <property name="proportion">1</property>
+ <object class="wxTextCtrl" expanded="0">
+ <property name="BottomDockable">1</property>
+ <property name="LeftDockable">1</property>
+ <property name="RightDockable">1</property>
+ <property name="TopDockable">1</property>
+ <property name="aui_layer"></property>
+ <property name="aui_name"></property>
+ <property name="aui_position"></property>
+ <property name="aui_row"></property>
+ <property name="best_size"></property>
+ <property name="bg"></property>
+ <property name="caption"></property>
+ <property name="caption_visible">1</property>
+ <property name="center_pane">0</property>
+ <property name="close_button">1</property>
+ <property name="context_help"></property>
+ <property name="context_menu">1</property>
+ <property name="default_pane">0</property>
+ <property name="dock">Dock</property>
+ <property name="dock_fixed">0</property>
+ <property name="docking">Left</property>
+ <property name="enabled">1</property>
+ <property name="fg"></property>
+ <property name="floatable">1</property>
+ <property name="font"></property>
+ <property name="gripper">0</property>
+ <property name="hidden">0</property>
+ <property name="id">wxID_ANY</property>
+ <property name="max_size"></property>
+ <property name="maximize_button">0</property>
+ <property name="maximum_size"></property>
+ <property name="maxlength">0</property>
+ <property name="min_size"></property>
+ <property name="minimize_button">0</property>
+ <property name="minimum_size">200,-1</property>
+ <property name="moveable">1</property>
+ <property name="name">m_TextValue</property>
+ <property name="pane_border">1</property>
+ <property name="pane_position"></property>
+ <property name="pane_size"></property>
+ <property name="permission">protected</property>
+ <property name="pin_button">1</property>
+ <property name="pos"></property>
+ <property name="resize">Resizable</property>
+ <property name="show">1</property>
+ <property name="size"></property>
+ <property name="style"></property>
+ <property name="subclass"></property>
+ <property name="toolbar_pane">0</property>
+ <property name="tooltip"></property>
+ <property name="validator_data_type"></property>
+ <property name="validator_style">wxFILTER_NONE</property>
+ <property name="validator_type">wxDefaultValidator</property>
+ <property name="validator_variable"></property>
+ <property name="value"></property>
+ <property name="window_extra_style"></property>
+ <property name="window_name"></property>
+ <property name="window_style"></property>
+ <event name="OnChar"></event>
+ <event name="OnEnterWindow"></event>
+ <event name="OnEraseBackground"></event>
+ <event name="OnKeyDown"></event>
+ <event name="OnKeyUp"></event>
+ <event name="OnKillFocus"></event>
+ <event name="OnLeaveWindow"></event>
+ <event name="OnLeftDClick"></event>
+ <event name="OnLeftDown"></event>
+ <event name="OnLeftUp"></event>
+ <event name="OnMiddleDClick"></event>
+ <event name="OnMiddleDown"></event>
+ <event name="OnMiddleUp"></event>
+ <event name="OnMotion"></event>
+ <event name="OnMouseEvents"></event>
+ <event name="OnMouseWheel"></event>
+ <event name="OnPaint"></event>
+ <event name="OnRightDClick"></event>
+ <event name="OnRightDown"></event>
+ <event name="OnRightUp"></event>
+ <event name="OnSetFocus"></event>
+ <event name="OnSize"></event>
+ <event name="OnText"></event>
+ <event name="OnTextEnter"></event>
+ <event name="OnTextMaxLen"></event>
+ <event name="OnTextURL"></event>
+ <event name="OnUpdateUI"></event>
+ </object>
+ </object>
+ <object class="sizeritem" expanded="0">
+ <property name="border">5</property>
+ <property name="flag">wxRIGHT</property>
+ <property name="proportion">0</property>
+ <object class="wxButton" expanded="0">
+ <property name="BottomDockable">1</property>
+ <property name="LeftDockable">1</property>
+ <property name="RightDockable">1</property>
+ <property name="TopDockable">1</property>
+ <property name="aui_layer"></property>
+ <property name="aui_name"></property>
+ <property name="aui_position"></property>
+ <property name="aui_row"></property>
+ <property name="best_size"></property>
+ <property name="bg"></property>
+ <property name="caption"></property>
+ <property name="caption_visible">1</property>
+ <property name="center_pane">0</property>
+ <property name="close_button">1</property>
+ <property name="context_help"></property>
+ <property name="context_menu">1</property>
+ <property name="default">0</property>
+ <property name="default_pane">0</property>
+ <property name="dock">Dock</property>
+ <property name="dock_fixed">0</property>
+ <property name="docking">Left</property>
+ <property name="enabled">1</property>
+ <property name="fg"></property>
+ <property name="floatable">1</property>
+ <property name="font"></property>
+ <property name="gripper">0</property>
+ <property name="hidden">0</property>
+ <property name="id">wxID_ANY</property>
+ <property name="label">Select</property>
+ <property name="max_size"></property>
+ <property name="maximize_button">0</property>
+ <property name="maximum_size"></property>
+ <property name="min_size"></property>
+ <property name="minimize_button">0</property>
+ <property name="minimum_size"></property>
+ <property name="moveable">1</property>
+ <property name="name">m_TextValueSelectButton</property>
+ <property name="pane_border">1</property>
+ <property name="pane_position"></property>
+ <property name="pane_size"></property>
+ <property name="permission">protected</property>
+ <property name="pin_button">1</property>
+ <property name="pos"></property>
+ <property name="resize">Resizable</property>
+ <property name="show">1</property>
+ <property name="size"></property>
+ <property name="style"></property>
+ <property name="subclass"></property>
+ <property name="toolbar_pane">0</property>
+ <property name="tooltip"></property>
+ <property name="validator_data_type"></property>
+ <property name="validator_style">wxFILTER_NONE</property>
+ <property name="validator_type">wxDefaultValidator</property>
+ <property name="validator_variable"></property>
+ <property name="window_extra_style"></property>
+ <property name="window_name"></property>
+ <property name="window_style"></property>
+ <event name="OnButtonClick">OnTextValueSelectButtonClick</event>
+ <event name="OnChar"></event>
+ <event name="OnEnterWindow"></event>
+ <event name="OnEraseBackground"></event>
+ <event name="OnKeyDown"></event>
+ <event name="OnKeyUp"></event>
+ <event name="OnKillFocus"></event>
+ <event name="OnLeaveWindow"></event>
+ <event name="OnLeftDClick"></event>
+ <event name="OnLeftDown"></event>
+ <event name="OnLeftUp"></event>
+ <event name="OnMiddleDClick"></event>
+ <event name="OnMiddleDown"></event>
+ <event name="OnMiddleUp"></event>
+ <event name="OnMotion"></event>
+ <event name="OnMouseEvents"></event>
+ <event name="OnMouseWheel"></event>
+ <event name="OnPaint"></event>
+ <event name="OnRightDClick"></event>
+ <event name="OnRightDown"></event>
+ <event name="OnRightUp"></event>
+ <event name="OnSetFocus"></event>
+ <event name="OnSize"></event>
+ <event name="OnUpdateUI"></event>
+ </object>
+ </object>
</object>
</object>
</object>
@@ -989,7 +1088,7 @@
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
- <property name="selection">0</property>
+ <property name="selection">3</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style">wxRA_SPECIFY_COLS</property>
diff --git a/eeschema/dialogs/dialog_lib_edit_text_base.h b/eeschema/dialogs/dialog_lib_edit_text_base.h
index 3cafc4f..314eec6 100644
--- a/eeschema/dialogs/dialog_lib_edit_text_base.h
+++ b/eeschema/dialogs/dialog_lib_edit_text_base.h
@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
-// C++ code generated with wxFormBuilder (version Nov 6 2013)
+// C++ code generated with wxFormBuilder (version Jun 6 2014)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
@@ -21,12 +21,12 @@ class DIALOG_SHIM;
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/textctrl.h>
+#include <wx/button.h>
#include <wx/sizer.h>
#include <wx/checkbox.h>
#include <wx/statline.h>
#include <wx/statbox.h>
#include <wx/radiobox.h>
-#include <wx/button.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
@@ -41,6 +41,7 @@ class DIALOG_LIB_EDIT_TEXT_BASE : public DIALOG_SHIM
protected:
wxStaticText* m_staticText1;
wxTextCtrl* m_TextValue;
+ wxButton* m_TextValueSelectButton;
wxStaticText* m_TextSizeText;
wxTextCtrl* m_TextSize;
wxCheckBox* m_Orient;
@@ -56,6 +57,8 @@ class DIALOG_LIB_EDIT_TEXT_BASE : public DIALOG_SHIM
wxButton* m_sdbSizerButtonsCancel;
// Virtual event handlers, overide them in your derived class
+ virtual void OnCloseDialog( wxCloseEvent& event ) { event.Skip(); }
+ virtual void OnTextValueSelectButtonClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnOkClick( wxCommandEvent& event ) { event.Skip(); }
diff --git a/eeschema/edit_component_in_schematic.cpp b/eeschema/edit_component_in_schematic.cpp
index 4a2e47e..3a143d0 100644
--- a/eeschema/edit_component_in_schematic.cpp
+++ b/eeschema/edit_component_in_schematic.cpp
@@ -85,7 +85,9 @@ void SCH_EDIT_FRAME::EditComponentFieldText( SCH_FIELD* aField )
DIALOG_SCH_EDIT_ONE_FIELD dlg( this, title, aField );
- int response = dlg.ShowModal();
+ //The diag may invoke a kiway player for footprint fields
+ //so we must use a quasimodal
+ int response = dlg.ShowQuasiModal();
m_canvas->MoveCursorToCrossHair();
m_canvas->SetIgnoreMouseEvents( false );
diff --git a/eeschema/libfield.cpp b/eeschema/libfield.cpp
index cefce0c..7a2ed08 100644
--- a/eeschema/libfield.cpp
+++ b/eeschema/libfield.cpp
@@ -44,7 +44,9 @@ void LIB_EDIT_FRAME::EditField( LIB_FIELD* aField )
DIALOG_LIB_EDIT_ONE_FIELD dlg( this, caption, aField );
- if( dlg.ShowModal() != wxID_OK )
+ //The diag may invoke a kiway player for footprint fields
+ //so we must use a quasimodal
+ if( dlg.ShowQuasiModal() != wxID_OK )
return;
text = dlg.GetTextField();
--
1.9.1
From bfff9ccaba2e9d182b95cc4d279617a728605a46 Mon Sep 17 00:00:00 2001
From: Mark Roszko <mark.roszko@xxxxxxxxx>
Date: Sat, 11 Oct 2014 01:35:09 -0400
Subject: [PATCH 2/2] Doxygenize the dialog_edit_one_field class methods
---
eeschema/dialogs/dialog_edit_one_field.cpp | 52 +++++++++++++++++++++++++++---
eeschema/dialogs/dialog_edit_one_field.h | 30 +++++++++++++----
2 files changed, 72 insertions(+), 10 deletions(-)
diff --git a/eeschema/dialogs/dialog_edit_one_field.cpp b/eeschema/dialogs/dialog_edit_one_field.cpp
index b4a9459..c93964a 100644
--- a/eeschema/dialogs/dialog_edit_one_field.cpp
+++ b/eeschema/dialogs/dialog_edit_one_field.cpp
@@ -44,6 +44,10 @@
#include <dialog_edit_one_field.h>
+/**
+* Function initDlg_base
+* Common dialog option initialization for the subclasses to call
+*/
void DIALOG_EDIT_ONE_FIELD::initDlg_base()
{
wxString msg;
@@ -100,6 +104,15 @@ void DIALOG_EDIT_ONE_FIELD::initDlg_base()
}
+/**
+* Function OnTextValueSelectButtonClick
+* Handles the select button next to the text value field. The current assumption
+* is that this event will only be enabled for footprint type fields. In the future
+* this function may need to be moved to the subclasses to access m_field and check for
+* the field type if more select actions are desired.
+*
+* @param aEvent is the the wX event thrown when the button is clicked, this isn't used
+*/
void DIALOG_EDIT_ONE_FIELD::OnTextValueSelectButtonClick( wxCommandEvent& aEvent )
{
// pick a footprint using the footprint picker.
@@ -117,13 +130,16 @@ void DIALOG_EDIT_ONE_FIELD::OnTextValueSelectButtonClick( wxCommandEvent& aEvent
}
+/**
+* Function initDlg
+* Initializes dialog data using the LIB_FIELD container of data, this function is
+* otherwise identical to DIALOG_SCH_EDIT_ONE_FIELD::initDlg()
+*/
void DIALOG_LIB_EDIT_ONE_FIELD::initDlg()
{
m_textsize = m_field->GetSize().x;
m_TextValue->SetValue( m_field->GetText() );
-
m_textorient = m_field->GetOrientation();
-
m_text_invisible = m_field->IsVisible() ? false : true;
m_textshape = 0;
@@ -149,14 +165,24 @@ void DIALOG_LIB_EDIT_ONE_FIELD::initDlg()
initDlg_base();
}
+
+/**
+* Function GetTextField
+* Returns the dialog's text field value with spaces filtered to underscores
+*/
wxString DIALOG_LIB_EDIT_ONE_FIELD::GetTextField()
{
wxString line = m_TextValue->GetValue();
// Spaces are not allowed in fields, so replace them by '_'
line.Replace( wxT( " " ), wxT( "_" ) );
return line;
-};
+}
+
+/**
+* Function TransfertDataToField
+* Converts fields from dialog window to variables to be used by child classes
+*/
void DIALOG_EDIT_ONE_FIELD::TransfertDataToField()
{
m_textorient = m_Orient->GetValue() ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ;
@@ -194,6 +220,11 @@ void DIALOG_EDIT_ONE_FIELD::TransfertDataToField()
}
}
+
+/**
+* Function TransfertDataToField
+* Saves dialog field values to field data container
+*/
void DIALOG_LIB_EDIT_ONE_FIELD::TransfertDataToField()
{
DIALOG_EDIT_ONE_FIELD::TransfertDataToField();
@@ -210,6 +241,11 @@ void DIALOG_LIB_EDIT_ONE_FIELD::TransfertDataToField()
}
+/**
+* Function initDlg
+* Initializes dialog data using the SCH_FIELD container of data, this function is
+* otherwise identical to DIALOG_LIB_EDIT_ONE_FIELD::initDlg()
+*/
void DIALOG_SCH_EDIT_ONE_FIELD::initDlg()
{
m_textsize = m_field->GetSize().x;
@@ -241,6 +277,10 @@ void DIALOG_SCH_EDIT_ONE_FIELD::initDlg()
}
+/**
+* Function GetTextField
+* Retrives text field value from dialog with whitespaced on both sides trimmed
+*/
wxString DIALOG_SCH_EDIT_ONE_FIELD::GetTextField()
{
wxString line = m_TextValue->GetValue();
@@ -249,6 +289,11 @@ wxString DIALOG_SCH_EDIT_ONE_FIELD::GetTextField()
return line;
};
+
+/**
+* Function TransfertDataToField
+* Converts fields from dialog window to variables to be used by child classes
+*/
void DIALOG_SCH_EDIT_ONE_FIELD::TransfertDataToField()
{
DIALOG_EDIT_ONE_FIELD::TransfertDataToField();
@@ -264,4 +309,3 @@ void DIALOG_SCH_EDIT_ONE_FIELD::TransfertDataToField()
m_field->SetHorizJustify( m_textHjustify );
m_field->SetVertJustify( m_textVjustify );
}
-
diff --git a/eeschema/dialogs/dialog_edit_one_field.h b/eeschema/dialogs/dialog_edit_one_field.h
index 263d50c..ef39528 100644
--- a/eeschema/dialogs/dialog_edit_one_field.h
+++ b/eeschema/dialogs/dialog_edit_one_field.h
@@ -33,9 +33,15 @@ class SCH_BASE_FRAME;
class LIB_FIELD;
class SCH_FIELD;
-// Basic class to edit a field: a schematic or a lib component field
-// DIALOG_EDIT_ONE_FIELD is setup in expectection of its children
-// possibly using Kiway player so ShowQuasiModal is required
+
+/**
+* Class DIALOG_EDIT_ONE_FIELD
+* is a basic class to edit a field: a schematic or a lib component field
+* <p>
+* This class is setup in expectection of its children
+* possibly using Kiway player so ShowQuasiModal is required when calling
+* any subclasses.
+*/
class DIALOG_EDIT_ONE_FIELD : public DIALOG_LIB_EDIT_TEXT_BASE
{
protected:
@@ -66,7 +72,7 @@ public:
protected:
- void initDlg_base( );
+ void initDlg_base();
void OnTextValueSelectButtonClick( wxCommandEvent& aEvent );
void OnOkClick( wxCommandEvent& aEvent )
@@ -86,7 +92,13 @@ protected:
};
-// Class to edit a lib component field
+/**
+* Class DIALOG_LIB_EDIT_ONE_FIELD
+* is a the class to handle editing a single component field
+* in the library editor.
+* <p>
+* Note: Use ShowQuasiModal when calling this class!
+*/
class DIALOG_LIB_EDIT_ONE_FIELD : public DIALOG_EDIT_ONE_FIELD
{
private:
@@ -113,7 +125,13 @@ private:
};
-// Class to edit a schematic component field
+/**
+* Class DIALOG_SCH_EDIT_ONE_FIELD
+* is a the class to handle editing a single component field
+* in the schematic editor.
+* <p>
+* Note: Use ShowQuasiModal when calling this class!
+*/
class DIALOG_SCH_EDIT_ONE_FIELD : public DIALOG_EDIT_ONE_FIELD
{
private:
--
1.9.1
Follow ups