fix libeditframe.cpp, which in release build would not show multipart text in listbox. dialog uses DIALOG_SHIM.

This commit is contained in:
Dick Hollenbeck 2013-06-05 14:23:55 -05:00
parent 66f5b3d3cc
commit 142306e238
6 changed files with 96 additions and 129 deletions

View File

@ -40,12 +40,95 @@
#include <class_library.h>
#include <sch_component.h>
#include <dialog_helpers.h>
#include <dialog_edit_component_in_schematic_fbp.h>
#include <dialog_edit_component_in_schematic.h>
/**
* class DIALOG_EDIT_COMPONENT_IN_SCHEMATIC
* is hand coded and implements DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP which
* is maintained by wxFormBuilder. Do not auto-generate this class or file,
* it is hand coded.
*/
class DIALOG_EDIT_COMPONENT_IN_SCHEMATIC : public DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP
{
public:
/** Constructor */
DIALOG_EDIT_COMPONENT_IN_SCHEMATIC( wxWindow* parent );
/**
* Function InitBuffers
* sets up to edit the given component.
* @param aComponent The component to edit.
*/
void InitBuffers( SCH_COMPONENT* aComponent );
private:
friend class SCH_EDIT_FRAME;
SCH_EDIT_FRAME* m_Parent;
SCH_COMPONENT* m_Cmp;
LIB_COMPONENT* m_LibEntry;
bool m_skipCopyFromPanel;
static int s_SelectedRow;
/// a copy of the edited component's SCH_FIELDs
SCH_FIELDS m_FieldsBuf;
void setSelectedFieldNdx( int aFieldNdx );
int getSelectedFieldNdx();
/**
* Function copySelectedFieldToPanel
* sets the values displayed on the panel according to
* the currently selected field row
*/
void copySelectedFieldToPanel();
/**
* Function copyPanelToSelectedField
* copies the values displayed on the panel fields to the currently
* selected field
* @return bool - true if all fields are OK, else false if the user has put
* bad data into a field, and this value can be used to deny a row change.
*/
bool copyPanelToSelectedField();
void copyOptionsToPanel();
void copyPanelToOptions();
void setRowItem( int aFieldNdx, const SCH_FIELD& aField );
// event handlers
void OnListItemDeselected( wxListEvent& event );
void OnListItemSelected( wxListEvent& event );
void OnCancelButtonClick( wxCommandEvent& event );
void OnOKButtonClick( wxCommandEvent& event );
void SetInitCmp( wxCommandEvent& event );
void addFieldButtonHandler( wxCommandEvent& event );
void deleteFieldButtonHandler( wxCommandEvent& event );
void moveUpButtonHandler( wxCommandEvent& event );
SCH_FIELD* findField( const wxString& aFieldName );
/**
* Function updateDisplay
* update the listbox showing fields, according to the fields texts
* must be called after a text change in fields, if this change is not an edition
*/
void updateDisplay( )
{
for( unsigned ii = FIELD1; ii<m_FieldsBuf.size(); ii++ )
setRowItem( ii, m_FieldsBuf[ii] );
}
};
int DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::s_SelectedRow;
wxSize DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::s_LastSize = wxDefaultSize;
void SCH_EDIT_FRAME::EditComponent( SCH_COMPONENT* aComponent )
@ -59,25 +142,11 @@ void SCH_EDIT_FRAME::EditComponent( SCH_COMPONENT* aComponent )
dlg->InitBuffers( aComponent );
wxSize sizeNow = dlg->GetSize();
// this relies on wxDefaultSize being -1,-1, be careful here.
if( sizeNow.GetWidth() < DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::s_LastSize.GetWidth()
|| sizeNow.GetHeight() < DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::s_LastSize.GetHeight() )
{
dlg->SetSize( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::s_LastSize );
}
// make sure the chipnameTextCtrl is wide enough to hold any unusually long chip names:
EnsureTextCtrlWidth( dlg->chipnameTextCtrl );
dlg->ShowModal();
// Some of the field values are long and are not always fully visible because the
// window comes up too narrow. Remember user's manual window resizing efforts here
// so it comes up wide enough next time.
DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::s_LastSize = dlg->GetSize();
m_canvas->MoveCursorToCrossHair();
m_canvas->SetIgnoreMouseEvents( false );
dlg->Destroy();

View File

@ -1,105 +0,0 @@
#ifndef __dialog_edit_component_in_schematic__
#define __dialog_edit_component_in_schematic__
#include <sch_field.h>
#include <template_fieldnames.h>
#include <dialog_edit_component_in_schematic_fbp.h>
class SCH_EDIT_FRAME;
/**
* class DIALOG_EDIT_COMPONENT_IN_SCHEMATIC
* is hand coded and implements DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP which
* is maintained by wxFormBuilder. Do not auto-generate this class or file,
* it is hand coded.
*/
class DIALOG_EDIT_COMPONENT_IN_SCHEMATIC : public DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP
{
friend class SCH_EDIT_FRAME;
SCH_EDIT_FRAME* m_Parent;
SCH_COMPONENT* m_Cmp;
LIB_COMPONENT* m_LibEntry;
bool m_skipCopyFromPanel;
static int s_SelectedRow;
/// The size of the dialog window last time it was displayed;
static wxSize s_LastSize;
/// a copy of the edited component's SCH_FIELDs
SCH_FIELDS m_FieldsBuf;
void setSelectedFieldNdx( int aFieldNdx );
int getSelectedFieldNdx();
/**
* Function copySelectedFieldToPanel
* sets the values displayed on the panel according to
* the currently selected field row
*/
void copySelectedFieldToPanel();
/**
* Function copyPanelToSelectedField
* copies the values displayed on the panel fields to the currently
* selected field
* @return bool - true if all fields are OK, else false if the user has put
* bad data into a field, and this value can be used to deny a row change.
*/
bool copyPanelToSelectedField();
void copyOptionsToPanel();
void copyPanelToOptions();
void setRowItem( int aFieldNdx, const SCH_FIELD& aField );
// event handlers
void OnListItemDeselected( wxListEvent& event );
void OnListItemSelected( wxListEvent& event );
void OnCancelButtonClick( wxCommandEvent& event );
void OnOKButtonClick( wxCommandEvent& event );
void SetInitCmp( wxCommandEvent& event );
void addFieldButtonHandler( wxCommandEvent& event );
void deleteFieldButtonHandler( wxCommandEvent& event );
void moveUpButtonHandler( wxCommandEvent& event );
SCH_FIELD* findField( const wxString& aFieldName );
protected:
public:
/** Constructor */
DIALOG_EDIT_COMPONENT_IN_SCHEMATIC( wxWindow* parent );
/**
* Function InitBuffers
* sets up to edit the given component.
* @param aComponent The component to edit.
*/
void InitBuffers( SCH_COMPONENT* aComponent );
private:
/**
* Function updateDisplay
* update the listbox showing fields, according to the fields texts
* must be called after a text change in fields, if this change is not an edition
*/
void updateDisplay( )
{
for( unsigned ii = FIELD1; ii<m_FieldsBuf.size(); ii++ )
setRowItem( ii, m_FieldsBuf[ii] );
}
};
#endif // __dialog_edit_component_in_schematic__

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Oct 8 2012)
// C++ code generated with wxFormBuilder (version Apr 30 2013)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
@ -9,7 +9,7 @@
///////////////////////////////////////////////////////////////////////////
DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxDefaultSize, wxDefaultSize );

View File

@ -44,7 +44,7 @@
<property name="pos"></property>
<property name="size">700,496</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="subclass">DIALOG_SHIM; dialog_shim.h</property>
<property name="title">Component Properties</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Oct 8 2012)
// C++ code generated with wxFormBuilder (version Apr 30 2013)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
@ -11,6 +11,9 @@
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
class DIALOG_SHIM;
#include "dialog_shim.h"
#include <wx/string.h>
#include <wx/stattext.h>
#include <wx/gdicmn.h>
@ -33,7 +36,7 @@
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP
///////////////////////////////////////////////////////////////////////////////
class DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP : public wxDialog
class DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP : public DIALOG_SHIM
{
private:

View File

@ -468,9 +468,9 @@ void LIB_EDIT_FRAME::UpdatePartSelectList()
{
for( int i = 0; i < m_component->GetPartCount(); i++ )
{
wxString msg = LIB_COMPONENT::ReturnSubReference( i+1, false );
msg.Printf( _( "Part %s" ), GetChars( msg ) );
m_partSelectBox->Append( msg );
wxString sub = LIB_COMPONENT::ReturnSubReference( i+1, false );
wxString part = wxString::Format( _( "Part %s" ), GetChars( sub ) );
m_partSelectBox->Append( part );
}
}