Commit 0d530fb3 authored by jean-pierre charras's avatar jean-pierre charras
Browse files

dialog_edit_component_in_schematic: moved "Reset to Library Default" Button....

dialog_edit_component_in_schematic: moved "Reset to Library Default" Button. This command is now undoable.
parent 05287607
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -789,6 +789,10 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::SetInitCmp( wxCommandEvent& event )
    if( entry == NULL )
        return;

    // save old cmp in undo list if not already in edit, or moving ...
    if( m_Cmp->m_Flags == 0 )
        m_Parent->SaveCopyInUndoList( m_Cmp, UR_CHANGED );

    INSTALL_DC( dc, m_Parent->DrawPanel );

    RedrawOneStruct( m_Parent->DrawPanel, &dc, m_Cmp, g_XorMode );
+271 −271
Original line number Diff line number Diff line
@@ -31,7 +31,7 @@ DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP(
	unitChoice->SetSelection( 0 );
	unitSizer->Add( unitChoice, 1, wxALL|wxEXPAND, 5 );
	
	optionsSizer->Add( unitSizer, 0, wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 8 );
	optionsSizer->Add( unitSizer, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 8 );
	
	wxBoxSizer* orientationSizer;
	orientationSizer = new wxBoxSizer( wxHORIZONTAL );
@@ -80,6 +80,11 @@ DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP(
	partsAreLockedLabel->Wrap( -1 );
	optionsSizer->Add( partsAreLockedLabel, 0, wxALL|wxEXPAND, 8 );
	
	defaultsButton = new wxButton( this, wxID_ANY, _("Reset to Library Defaults"), wxDefaultPosition, wxDefaultSize, 0 );
	defaultsButton->SetToolTip( _("Set position and style of fields and component orientation  to default lib value.\nFields texts are not modified.") );
	
	optionsSizer->Add( defaultsButton, 0, wxALL|wxEXPAND, 5 );
	
	upperSizer->Add( optionsSizer, 0, wxALIGN_TOP|wxALL|wxEXPAND, 5 );
	
	wxStaticBoxSizer* fieldsSizer;
@@ -221,11 +226,6 @@ DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP(
	
	fieldEditBoxSizer->Add( 0, 0, 1, wxEXPAND, 5 );
	
	defaultsButton = new wxButton( this, wxID_ANY, _("Reset to Library Defaults"), wxDefaultPosition, wxDefaultSize, 0 );
	defaultsButton->SetToolTip( _("Set position and style of fields and component orientation  to default lib value.\nFields texts are not modified.") );
	
	fieldEditBoxSizer->Add( defaultsButton, 0, wxALL|wxEXPAND, 5 );
	
	
	fieldEditBoxSizer->Add( 0, 0, 1, wxEXPAND, 5 );
	
@@ -247,12 +247,12 @@ DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP(
	this->Layout();
	
	// Connect Events
	defaultsButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::SetInitCmp ), NULL, this );
	fieldListCtrl->Connect( wxEVT_COMMAND_LIST_ITEM_DESELECTED, wxListEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::OnListItemDeselected ), NULL, this );
	fieldListCtrl->Connect( wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::OnListItemSelected ), NULL, this );
	addFieldButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::addFieldButtonHandler ), NULL, this );
	deleteFieldButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::deleteFieldButtonHandler ), NULL, this );
	moveUpButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::moveUpButtonHandler ), NULL, this );
	defaultsButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::SetInitCmp ), NULL, this );
	stdDialogButtonSizerCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::OnCancelButtonClick ), NULL, this );
	stdDialogButtonSizerOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::OnOKButtonClick ), NULL, this );
}
@@ -260,12 +260,12 @@ DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP(
DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::~DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP()
{
	// Disconnect Events
	defaultsButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::SetInitCmp ), NULL, this );
	fieldListCtrl->Disconnect( wxEVT_COMMAND_LIST_ITEM_DESELECTED, wxListEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::OnListItemDeselected ), NULL, this );
	fieldListCtrl->Disconnect( wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::OnListItemSelected ), NULL, this );
	addFieldButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::addFieldButtonHandler ), NULL, this );
	deleteFieldButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::deleteFieldButtonHandler ), NULL, this );
	moveUpButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::moveUpButtonHandler ), NULL, this );
	defaultsButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::SetInitCmp ), NULL, this );
	stdDialogButtonSizerCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::OnCancelButtonClick ), NULL, this );
	stdDialogButtonSizerOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::OnOKButtonClick ), NULL, this );
}
+1614 −1614
Original line number Diff line number Diff line
@@ -32,7 +32,7 @@
            <property name="minimum_size"></property>
            <property name="name">DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP</property>
            <property name="pos"></property>
            <property name="size">630,481</property>
            <property name="size">630,520</property>
            <property name="style">wxCAPTION|wxCLOSE_BOX|wxDEFAULT_DIALOG_STYLE|wxMAXIMIZE_BOX|wxMINIMIZE_BOX|wxRESIZE_BORDER|wxSYSTEM_MENU</property>
            <property name="subclass"></property>
            <property name="title">Component Properties</property>
@@ -98,7 +98,7 @@
                                <event name="OnUpdateUI"></event>
                                <object class="sizeritem" expanded="1">
                                    <property name="border">8</property>
                                    <property name="flag">wxEXPAND|wxLEFT|wxRIGHT|wxTOP</property>
                                    <property name="flag">wxEXPAND|wxTOP|wxRIGHT|wxLEFT</property>
                                    <property name="proportion">0</property>
                                    <object class="wxStaticBoxSizer" expanded="1">
                                        <property name="id">wxID_ANY</property>
@@ -463,6 +463,58 @@
                                        <event name="OnUpdateUI"></event>
                                    </object>
                                </object>
                                <object class="sizeritem" expanded="1">
                                    <property name="border">5</property>
                                    <property name="flag">wxALL|wxEXPAND</property>
                                    <property name="proportion">0</property>
                                    <object class="wxButton" expanded="1">
                                        <property name="bg"></property>
                                        <property name="context_help"></property>
                                        <property name="default">0</property>
                                        <property name="enabled">1</property>
                                        <property name="fg"></property>
                                        <property name="font"></property>
                                        <property name="hidden">0</property>
                                        <property name="id">wxID_ANY</property>
                                        <property name="label">Reset to Library Defaults</property>
                                        <property name="maximum_size"></property>
                                        <property name="minimum_size"></property>
                                        <property name="name">defaultsButton</property>
                                        <property name="permission">protected</property>
                                        <property name="pos"></property>
                                        <property name="size"></property>
                                        <property name="style"></property>
                                        <property name="subclass"></property>
                                        <property name="tooltip">Set position and style of fields and component orientation  to default lib value.&#x0A;Fields texts are not modified.</property>
                                        <property name="window_extra_style"></property>
                                        <property name="window_name"></property>
                                        <property name="window_style"></property>
                                        <event name="OnButtonClick">SetInitCmp</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 class="sizeritem" expanded="1">
@@ -1514,58 +1566,6 @@
                                                <property name="width">0</property>
                                            </object>
                                        </object>
                                        <object class="sizeritem" expanded="1">
                                            <property name="border">5</property>
                                            <property name="flag">wxALL|wxEXPAND</property>
                                            <property name="proportion">0</property>
                                            <object class="wxButton" expanded="1">
                                                <property name="bg"></property>
                                                <property name="context_help"></property>
                                                <property name="default">0</property>
                                                <property name="enabled">1</property>
                                                <property name="fg"></property>
                                                <property name="font"></property>
                                                <property name="hidden">0</property>
                                                <property name="id">wxID_ANY</property>
                                                <property name="label">Reset to Library Defaults</property>
                                                <property name="maximum_size"></property>
                                                <property name="minimum_size"></property>
                                                <property name="name">defaultsButton</property>
                                                <property name="permission">protected</property>
                                                <property name="pos"></property>
                                                <property name="size"></property>
                                                <property name="style"></property>
                                                <property name="subclass"></property>
                                                <property name="tooltip">Set position and style of fields and component orientation  to default lib value.&#x0A;Fields texts are not modified.</property>
                                                <property name="window_extra_style"></property>
                                                <property name="window_name"></property>
                                                <property name="window_style"></property>
                                                <event name="OnButtonClick">SetInitCmp</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 class="sizeritem" expanded="1">
                                            <property name="border">5</property>
                                            <property name="flag">wxEXPAND</property>
+87 −87
Original line number Diff line number Diff line
@@ -22,8 +22,8 @@
#include <wx/textctrl.h>
#include <wx/checkbox.h>
#include <wx/stattext.h>
#include <wx/listctrl.h>
#include <wx/button.h>
#include <wx/listctrl.h>
#include <wx/dialog.h>

///////////////////////////////////////////////////////////////////////////
@@ -43,6 +43,7 @@ class DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP : public wxDialog
		wxTextCtrl* chipnameTextCtrl;
		wxCheckBox* convertCheckBox;
		wxStaticText* partsAreLockedLabel;
		wxButton* defaultsButton;
		wxListCtrl* fieldListCtrl;
		wxButton* addFieldButton;
		wxButton* deleteFieldButton;
@@ -61,25 +62,24 @@ class DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP : public wxDialog
		wxStaticText* posYLabel;
		wxTextCtrl* posYTextCtrl;
		
		wxButton* defaultsButton;
		
		wxStdDialogButtonSizer* stdDialogButtonSizer;
		wxButton* stdDialogButtonSizerOK;
		wxButton* stdDialogButtonSizerCancel;
		
		// Virtual event handlers, overide them in your derived class
		virtual void SetInitCmp( wxCommandEvent& event ){ event.Skip(); }
		virtual void OnListItemDeselected( wxListEvent& event ){ event.Skip(); }
		virtual void OnListItemSelected( wxListEvent& event ){ event.Skip(); }
		virtual void addFieldButtonHandler( wxCommandEvent& event ){ event.Skip(); }
		virtual void deleteFieldButtonHandler( wxCommandEvent& event ){ event.Skip(); }
		virtual void moveUpButtonHandler( wxCommandEvent& event ){ event.Skip(); }
		virtual void SetInitCmp( wxCommandEvent& event ){ event.Skip(); }
		virtual void OnCancelButtonClick( wxCommandEvent& event ){ event.Skip(); }
		virtual void OnOKButtonClick( wxCommandEvent& event ){ event.Skip(); }
		
	
	public:
		DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Component Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 864,640 ), long style = wxCAPTION|wxCLOSE_BOX|wxDEFAULT_DIALOG_STYLE|wxMAXIMIZE_BOX|wxMINIMIZE_BOX|wxRESIZE_BORDER|wxSYSTEM_MENU );
		DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Component Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 630,520 ), long style = wxCAPTION|wxCLOSE_BOX|wxDEFAULT_DIALOG_STYLE|wxMAXIMIZE_BOX|wxMINIMIZE_BOX|wxRESIZE_BORDER|wxSYSTEM_MENU );
		~DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP();
	
};