From 6393d226ea411608ef33dc6cecbcdb65e5bc239e Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Tue, 27 Jan 2015 12:01:58 +0100 Subject: [PATCH] Other minor fixes --- .../dialog_edit_component_in_schematic_fbp.cpp | 6 +++--- .../dialog_edit_component_in_schematic_fbp.fbp | 6 +++--- .../dialogs/dialog_edit_libentry_fields_in_lib.cpp | 2 +- .../dialog_edit_libentry_fields_in_lib_base.cpp | 11 +++++------ .../dialog_edit_libentry_fields_in_lib_base.fbp | 14 +++++++------- .../dialog_edit_libentry_fields_in_lib_base.h | 2 +- eeschema/libedit_undo_redo.cpp | 6 +++--- eeschema/libeditframe.h | 8 +++++++- 8 files changed, 30 insertions(+), 25 deletions(-) diff --git a/eeschema/dialogs/dialog_edit_component_in_schematic_fbp.cpp b/eeschema/dialogs/dialog_edit_component_in_schematic_fbp.cpp index 8cec6af050..5635f6f9ee 100644 --- a/eeschema/dialogs/dialog_edit_component_in_schematic_fbp.cpp +++ b/eeschema/dialogs/dialog_edit_component_in_schematic_fbp.cpp @@ -149,13 +149,13 @@ DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP( int m_FieldHJustifyCtrlNChoices = sizeof( m_FieldHJustifyCtrlChoices ) / sizeof( wxString ); m_FieldHJustifyCtrl = new wxRadioBox( this, wxID_ANY, _("Horiz. Justify"), wxDefaultPosition, wxDefaultSize, m_FieldHJustifyCtrlNChoices, m_FieldHJustifyCtrlChoices, 1, wxRA_SPECIFY_COLS ); m_FieldHJustifyCtrl->SetSelection( 2 ); - bSizerJustification->Add( m_FieldHJustifyCtrl, 1, wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + bSizerJustification->Add( m_FieldHJustifyCtrl, 1, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 ); wxString m_FieldVJustifyCtrlChoices[] = { _("Bottom"), _("Center"), _("Top") }; int m_FieldVJustifyCtrlNChoices = sizeof( m_FieldVJustifyCtrlChoices ) / sizeof( wxString ); m_FieldVJustifyCtrl = new wxRadioBox( this, wxID_ANY, _("Vert. Justify"), wxDefaultPosition, wxDefaultSize, m_FieldVJustifyCtrlNChoices, m_FieldVJustifyCtrlChoices, 1, wxRA_SPECIFY_COLS ); m_FieldVJustifyCtrl->SetSelection( 2 ); - bSizerJustification->Add( m_FieldVJustifyCtrl, 1, wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + bSizerJustification->Add( m_FieldVJustifyCtrl, 1, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 ); fieldEditBoxSizer->Add( bSizerJustification, 1, wxEXPAND|wxBOTTOM, 5 ); @@ -188,7 +188,7 @@ DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP( bSizerStyle->Add( m_StyleRadioBox, 1, wxEXPAND|wxALL, 5 ); - fieldEditBoxSizer->Add( bSizerStyle, 1, wxEXPAND, 5 ); + fieldEditBoxSizer->Add( bSizerStyle, 1, wxEXPAND|wxBOTTOM, 5 ); wxBoxSizer* fieldNameBoxSizer; fieldNameBoxSizer = new wxBoxSizer( wxVERTICAL ); diff --git a/eeschema/dialogs/dialog_edit_component_in_schematic_fbp.fbp b/eeschema/dialogs/dialog_edit_component_in_schematic_fbp.fbp index bce93189bc..69bc7bbed7 100644 --- a/eeschema/dialogs/dialog_edit_component_in_schematic_fbp.fbp +++ b/eeschema/dialogs/dialog_edit_component_in_schematic_fbp.fbp @@ -1782,7 +1782,7 @@ none 5 - wxBOTTOM|wxRIGHT|wxLEFT + wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND 1 1 @@ -1872,7 +1872,7 @@ 5 - wxBOTTOM|wxRIGHT|wxLEFT + wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND 1 1 @@ -1964,7 +1964,7 @@ 5 - wxEXPAND + wxEXPAND|wxBOTTOM 1 diff --git a/eeschema/dialogs/dialog_edit_libentry_fields_in_lib.cpp b/eeschema/dialogs/dialog_edit_libentry_fields_in_lib.cpp index d42752ee72..75fdff829f 100644 --- a/eeschema/dialogs/dialog_edit_libentry_fields_in_lib.cpp +++ b/eeschema/dialogs/dialog_edit_libentry_fields_in_lib.cpp @@ -266,7 +266,7 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::OnOKButtonClick( wxCommandEvent& event /* End unused code */ // save old cmp in undo list - m_parent->SaveCopyInUndoList( m_libEntry, IS_CHANGED ); + m_parent->SaveCopyInUndoList( m_libEntry ); // delete any fields with no name or no value before we copy all of m_FieldsBuf // back into the component diff --git a/eeschema/dialogs/dialog_edit_libentry_fields_in_lib_base.cpp b/eeschema/dialogs/dialog_edit_libentry_fields_in_lib_base.cpp index e01286ed02..c12779d419 100644 --- a/eeschema/dialogs/dialog_edit_libentry_fields_in_lib_base.cpp +++ b/eeschema/dialogs/dialog_edit_libentry_fields_in_lib_base.cpp @@ -57,7 +57,7 @@ DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE m_FieldHJustifyCtrl->SetSelection( 1 ); m_FieldHJustifyCtrl->SetToolTip( _("Select if the component is to be rotated when drawn") ); - bSizerJustify->Add( m_FieldHJustifyCtrl, 1, wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + bSizerJustify->Add( m_FieldHJustifyCtrl, 1, wxEXPAND|wxALL, 5 ); wxString m_FieldVJustifyCtrlChoices[] = { _("Bottom"), _("Center"), _("Top") }; int m_FieldVJustifyCtrlNChoices = sizeof( m_FieldVJustifyCtrlChoices ) / sizeof( wxString ); @@ -65,10 +65,10 @@ DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE m_FieldVJustifyCtrl->SetSelection( 0 ); m_FieldVJustifyCtrl->SetToolTip( _("Pick the graphical transformation to be used when displaying the component, if any") ); - bSizerJustify->Add( m_FieldVJustifyCtrl, 1, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 ); + bSizerJustify->Add( m_FieldVJustifyCtrl, 1, wxEXPAND|wxALL, 5 ); - fieldEditBoxSizer->Add( bSizerJustify, 0, wxEXPAND|wxBOTTOM, 5 ); + fieldEditBoxSizer->Add( bSizerJustify, 1, wxEXPAND|wxBOTTOM, 5 ); wxBoxSizer* bSizerAspect; bSizerAspect = new wxBoxSizer( wxHORIZONTAL ); @@ -93,10 +93,10 @@ DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE int m_StyleRadioBoxNChoices = sizeof( m_StyleRadioBoxChoices ) / sizeof( wxString ); m_StyleRadioBox = new wxRadioBox( this, wxID_ANY, _("Style:"), wxDefaultPosition, wxDefaultSize, m_StyleRadioBoxNChoices, m_StyleRadioBoxChoices, 1, wxRA_SPECIFY_COLS ); m_StyleRadioBox->SetSelection( 0 ); - bSizerAspect->Add( m_StyleRadioBox, 1, wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + bSizerAspect->Add( m_StyleRadioBox, 1, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 ); - fieldEditBoxSizer->Add( bSizerAspect, 0, wxEXPAND|wxTOP, 5 ); + fieldEditBoxSizer->Add( bSizerAspect, 1, wxEXPAND|wxTOP|wxBOTTOM, 5 ); wxBoxSizer* fieldNameBoxSizer; fieldNameBoxSizer = new wxBoxSizer( wxVERTICAL ); @@ -199,7 +199,6 @@ DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE this->SetSizer( mainSizer ); this->Layout(); - mainSizer->Fit( this ); // Connect Events this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::OnCloseDialog ) ); diff --git a/eeschema/dialogs/dialog_edit_libentry_fields_in_lib_base.fbp b/eeschema/dialogs/dialog_edit_libentry_fields_in_lib_base.fbp index 647cfd8e2f..b561e6b9b6 100644 --- a/eeschema/dialogs/dialog_edit_libentry_fields_in_lib_base.fbp +++ b/eeschema/dialogs/dialog_edit_libentry_fields_in_lib_base.fbp @@ -44,7 +44,7 @@ DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE - -1,-1 + 542,529 wxCAPTION|wxCLOSE_BOX|wxDEFAULT_DIALOG_STYLE|wxMAXIMIZE_BOX|wxMINIMIZE_BOX|wxRESIZE_BORDER|wxSYSTEM_MENU DIALOG_SHIM; dialog_shim.h Field Properties @@ -494,7 +494,7 @@ 5 wxEXPAND|wxBOTTOM - 0 + 1 bSizerJustify @@ -502,7 +502,7 @@ none 5 - wxBOTTOM|wxRIGHT|wxLEFT + wxEXPAND|wxALL 1 1 @@ -592,7 +592,7 @@ 5 - wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND + wxEXPAND|wxALL 1 1 @@ -684,8 +684,8 @@ 5 - wxEXPAND|wxTOP - 0 + wxEXPAND|wxTOP|wxBOTTOM + 1 bSizerAspect @@ -883,7 +883,7 @@ 5 - wxBOTTOM|wxRIGHT|wxLEFT + wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND 1 1 diff --git a/eeschema/dialogs/dialog_edit_libentry_fields_in_lib_base.h b/eeschema/dialogs/dialog_edit_libentry_fields_in_lib_base.h index 5d90a82f6d..bba59ef640 100644 --- a/eeschema/dialogs/dialog_edit_libentry_fields_in_lib_base.h +++ b/eeschema/dialogs/dialog_edit_libentry_fields_in_lib_base.h @@ -84,7 +84,7 @@ class DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE : public DIALOG_SHIM public: - DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Field Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxCAPTION|wxCLOSE_BOX|wxDEFAULT_DIALOG_STYLE|wxMAXIMIZE_BOX|wxMINIMIZE_BOX|wxRESIZE_BORDER|wxSYSTEM_MENU ); + DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Field Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 542,529 ), long style = wxCAPTION|wxCLOSE_BOX|wxDEFAULT_DIALOG_STYLE|wxMAXIMIZE_BOX|wxMINIMIZE_BOX|wxRESIZE_BORDER|wxSYSTEM_MENU ); ~DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE(); }; diff --git a/eeschema/libedit_undo_redo.cpp b/eeschema/libedit_undo_redo.cpp index 81cb7f17e8..a29350081f 100644 --- a/eeschema/libedit_undo_redo.cpp +++ b/eeschema/libedit_undo_redo.cpp @@ -25,13 +25,13 @@ #include #include -#include -#include +//#include +//#include #include #include -void LIB_EDIT_FRAME::SaveCopyInUndoList( EDA_ITEM* ItemToCopy, int unused_flag ) +void LIB_EDIT_FRAME::SaveCopyInUndoList( EDA_ITEM* ItemToCopy ) { LIB_PART* CopyItem; PICKED_ITEMS_LIST* lastcmd; diff --git a/eeschema/libeditframe.h b/eeschema/libeditframe.h index a5562c7185..4abccf5b7d 100644 --- a/eeschema/libeditframe.h +++ b/eeschema/libeditframe.h @@ -506,7 +506,13 @@ private: // General editing public: - void SaveCopyInUndoList( EDA_ITEM* ItemToCopy, int flag_type_command = 0 ); + /** + * Function SaveCopyInUndoList. + * Create a copy of the current component, and save it in the undo list. + * Because a component in library editor does not a lot of primitives, + * the full data is duplicated. It is not worth to try to optimize this save funtion + */ + void SaveCopyInUndoList( EDA_ITEM* ItemToCopy ); private: void GetComponentFromUndoList( wxCommandEvent& event );