Commit 31a84b84 authored by Dick Hollenbeck's avatar Dick Hollenbeck

Add include/dialog_shim.h and common/dialog_shim.cpp for use by...

Add include/dialog_shim.h and common/dialog_shim.cpp for use by wxformbuilder's "subclass a wxDialog" support.
This works, but in my version of wxformbuilder there is a bug which does not properly show the 
subclass property, even though it is still in play.  This happens after saving then loading the *.fbp file.
So it is a nuisance bug, but does not affect functionality.
parent fda20d28
......@@ -48,6 +48,7 @@ set(COMMON_SRCS
confirm.cpp
copy_to_clipboard.cpp
dcsvg.cpp
dialog_shim.cpp
displlst.cpp
dlist.cpp
drawframe.cpp
......
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2012 KiCad Developers, see CHANGELOG.TXT for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <dialog_shim.h>
DIALOG_SHIM::DIALOG_SHIM( wxWindow* aParent, wxWindowID id, const wxString& title,
const wxPoint& pos, const wxSize& size, long style, const wxString& name ) :
wxDialog( aParent, id, title, pos, size, style, name )
{
// linux wxGTK needed this at one time to allow the ESCAPE key to close a wxDialog window.
SetFocus();
}
// our hashtable is an implementation secret, don't need or want it in a header file
#include <hashtables.h>
#include <base_struct.h> // EDA_RECT
#include <typeinfo>
/// hashtable with key: C string and value: EDA_RECT.
/// The key is the classname of the derived wxformbuilder dialog
WX_DECLARE_HASH_MAP( char*, EDA_RECT, wxStringHash, wxStringEqual, RECT_MAP );
static RECT_MAP class_map;
bool DIALOG_SHIM::Show( bool show )
{
bool ret;
const char* classname = typeid(*this).name();
// Show or hide the window. If hiding, save current position and size.
// If showing, use previous position and size.
if( show )
{
ret = wxDialog::Show( show );
// classname is key, returns a zeroed out default EDA_RECT if none existed before.
EDA_RECT r = class_map[ classname ];
if( r.GetSize().x != 0 && r.GetSize().y != 0 )
SetSize( r.GetPosition().x, r.GetPosition().y, r.GetSize().x, r.GetSize().y, 0 );
}
else
{
// Save the dialog's position & size before hiding, using classname as key
EDA_RECT r( wxDialog::GetPosition(), wxDialog::GetSize() );
class_map[ classname ] = r;
ret = wxDialog::Show( show );
}
return ret;
}
/*
const wxSize& DIALOG_SHIM::GetLastSize()
{
const char* classname = typeid(*this).name();
return class_map[ classname ].GetSize();
}
const wxPoint& DIALOG_SHIM::GetLastPosition()
{
const char* classname = typeid(*this).name();
return class_map[ classname ].GetPosition();
}
*/
......@@ -7,11 +7,6 @@
#include <dialog_lib_edit_pin.h>
// dialog should remember its previous screen position and size
// Not also if the defaut size is > s_LastSize, default size is used
wxPoint DIALOG_LIB_EDIT_PIN::s_LastPos( -1, -1 );
wxSize DIALOG_LIB_EDIT_PIN::s_LastSize;
DIALOG_LIB_EDIT_PIN::DIALOG_LIB_EDIT_PIN( wxWindow* parent, LIB_PIN* aPin ) :
DIALOG_LIB_EDIT_PIN_BASE( parent )
{
......@@ -25,31 +20,17 @@ DIALOG_LIB_EDIT_PIN::DIALOG_LIB_EDIT_PIN( wxWindow* parent, LIB_PIN* aPin ) :
m_panelShowPin->SetBackgroundColour( MakeColour( g_DrawBgColor ) );
/* Required to make escape key work correctly in wxGTK. */
SetFocus();
// Set tab order
m_textPadName-> MoveAfterInTabOrder(m_textPinName);
m_textPadName->MoveAfterInTabOrder(m_textPinName);
m_sdbSizerButtonsOK->SetDefault();
}
DIALOG_LIB_EDIT_PIN::~DIALOG_LIB_EDIT_PIN()
{
delete m_dummyPin;
}
void DIALOG_LIB_EDIT_PIN::SetLastSizeAndPosition()
{
if( s_LastPos.x != -1 )
{
wxSize defaultSize = GetSize();
if( s_LastSize.x < defaultSize.x )
s_LastSize.x = defaultSize.x;
SetSize( s_LastSize );
SetPosition( s_LastPos );
}
else
Center();
}
/*
* Draw (on m_panelShowPin) the pin currently edited
......@@ -92,25 +73,16 @@ void DIALOG_LIB_EDIT_PIN::OnPaintShowPanel( wxPaintEvent& event )
void DIALOG_LIB_EDIT_PIN::OnCloseDialog( wxCloseEvent& event )
{
// Save the dialog's position
s_LastPos = GetPosition();
s_LastSize = GetSize();
EndModal( wxID_CANCEL );
}
void DIALOG_LIB_EDIT_PIN::OnCancelButtonClick( wxCommandEvent& event )
{
// Save the dialog's position
s_LastPos = GetPosition();
s_LastSize = GetSize();
EndModal( wxID_CANCEL );
}
void DIALOG_LIB_EDIT_PIN::OnOKButtonClick( wxCommandEvent& event )
{
// Save the dialog's position
s_LastPos = GetPosition();
s_LastSize = GetSize();
EndModal( wxID_OK );
}
......
......@@ -13,9 +13,6 @@
/** Implementing DIALOG_LIB_EDIT_PIN_BASE */
class DIALOG_LIB_EDIT_PIN : public DIALOG_LIB_EDIT_PIN_BASE
{
static wxSize s_LastSize; ///< last position and size
static wxPoint s_LastPos;
LIB_PIN * m_dummyPin; // a working copy used to show changes
public:
......@@ -23,7 +20,6 @@ public:
DIALOG_LIB_EDIT_PIN( wxWindow* parent, LIB_PIN* aPin );
~DIALOG_LIB_EDIT_PIN();
void SetLastSizeAndPosition();
void OnCloseDialog( wxCloseEvent& event );
void OnCancelButtonClick( wxCommandEvent& event );
void OnOKButtonClick( wxCommandEvent& event );
......
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 30 2011)
// C++ code generated with wxFormBuilder (version Mar 19 2012)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "wx/bmpcbox.h"
#include "dialog_lib_edit_pin_base.h"
///////////////////////////////////////////////////////////////////////////
DIALOG_LIB_EDIT_PIN_BASE::DIALOG_LIB_EDIT_PIN_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
DIALOG_LIB_EDIT_PIN_BASE::DIALOG_LIB_EDIT_PIN_BASE( 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 );
......@@ -34,7 +32,7 @@ DIALOG_LIB_EDIT_PIN_BASE::DIALOG_LIB_EDIT_PIN_BASE( wxWindow* parent, wxWindowID
m_staticTextPinName->Wrap( -1 );
fgSizerPins->Add( m_staticTextPinName, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
m_textPinName = new wxTextCtrl( this, ID_M_TEXTPINNAME, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_textPinName = new wxTextCtrl( this, ID_M_TEXTPINNAME, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_TAB );
fgSizerPins->Add( m_textPinName, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxTOP|wxBOTTOM, 3 );
m_staticTextPadName = new wxStaticText( this, ID_M_STATICTEXTPADNAME, _("Pin n&umber:"), wxDefaultPosition, wxDefaultSize, 0 );
......@@ -43,7 +41,7 @@ DIALOG_LIB_EDIT_PIN_BASE::DIALOG_LIB_EDIT_PIN_BASE( wxWindow* parent, wxWindowID
fgSizerPins->Add( m_staticTextPadName, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
m_textPadName = new wxTextCtrl( this, ID_M_TEXTPADNAME, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_textPadName = new wxTextCtrl( this, ID_M_TEXTPADNAME, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_TAB );
fgSizerPins->Add( m_textPadName, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxTOP|wxBOTTOM, 3 );
m_staticTextOrient = new wxStaticText( this, wxID_ANY, _("&Orientation:"), wxDefaultPosition, wxDefaultSize, 0 );
......@@ -69,6 +67,7 @@ DIALOG_LIB_EDIT_PIN_BASE::DIALOG_LIB_EDIT_PIN_BASE( wxWindow* parent, wxWindowID
m_choiceStyle = new wxBitmapComboBox( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 );
fgSizerPins->Add( m_choiceStyle, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 );
bLeftSizer->Add( fgSizerPins, 0, wxALL|wxEXPAND, 5 );
wxBoxSizer* boarderSizer;
......@@ -83,6 +82,7 @@ DIALOG_LIB_EDIT_PIN_BASE::DIALOG_LIB_EDIT_PIN_BASE( wxWindow* parent, wxWindowID
m_checkApplyToAllConversions = new wxCheckBox( this, wxID_ANY, _("Shared by all body &styles (DeMorgan)"), wxDefaultPosition, wxDefaultSize, 0 );
sbSizerPinSharing->Add( m_checkApplyToAllConversions, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
boarderSizer->Add( sbSizerPinSharing, 0, wxEXPAND|wxALL, 5 );
wxStaticBoxSizer* sbSizerSchematicProperties;
......@@ -92,10 +92,13 @@ DIALOG_LIB_EDIT_PIN_BASE::DIALOG_LIB_EDIT_PIN_BASE( wxWindow* parent, wxWindowID
m_checkShow->SetValue(true);
sbSizerSchematicProperties->Add( m_checkShow, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
boarderSizer->Add( sbSizerSchematicProperties, 0, wxEXPAND|wxALL, 5 );
bLeftSizer->Add( boarderSizer, 0, wxEXPAND|wxTOP|wxBOTTOM, 12 );
bUpperSizer->Add( bLeftSizer, 1, wxEXPAND, 5 );
wxBoxSizer* bRightSizer;
......@@ -140,6 +143,7 @@ DIALOG_LIB_EDIT_PIN_BASE::DIALOG_LIB_EDIT_PIN_BASE( wxWindow* parent, wxWindowID
m_staticLengthUnits->Wrap( -1 );
fgSizerTextsSizes->Add( m_staticLengthUnits, 0, wxALL, 5 );
bRightSizer->Add( fgSizerTextsSizes, 0, wxALL|wxEXPAND, 5 );
m_panelShowPin = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxFULL_REPAINT_ON_RESIZE|wxSUNKEN_BORDER|wxTAB_TRAVERSAL );
......@@ -147,8 +151,10 @@ DIALOG_LIB_EDIT_PIN_BASE::DIALOG_LIB_EDIT_PIN_BASE( wxWindow* parent, wxWindowID
bRightSizer->Add( m_panelShowPin, 1, wxEXPAND | wxALL, 5 );
bUpperSizer->Add( bRightSizer, 1, wxEXPAND|wxRIGHT, 5 );
mainSizer->Add( bUpperSizer, 1, wxEXPAND, 5 );
m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
......@@ -160,10 +166,13 @@ DIALOG_LIB_EDIT_PIN_BASE::DIALOG_LIB_EDIT_PIN_BASE( wxWindow* parent, wxWindowID
m_sdbSizerButtonsCancel = new wxButton( this, wxID_CANCEL );
m_sdbSizerButtons->AddButton( m_sdbSizerButtonsCancel );
m_sdbSizerButtons->Realize();
mainSizer->Add( m_sdbSizerButtons, 0, wxALL|wxALIGN_RIGHT, 5 );
this->SetSizer( mainSizer );
this->Layout();
mainSizer->Fit( this );
this->Centre( wxBOTH );
......
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<wxFormBuilder_Project>
<FileVersion major="1" minor="10" />
<FileVersion major="1" minor="11" />
<object class="Project" expanded="1">
<property name="class_decoration"></property>
<property name="code_generation">C++</property>
<property name="disconnect_events">1</property>
<property name="disconnect_mode">source_name</property>
<property name="disconnect_php_events">0</property>
<property name="disconnect_python_events">0</property>
<property name="embedded_files_path">res</property>
<property name="encoding">UTF-8</property>
......@@ -19,6 +20,7 @@
<property name="path">.</property>
<property name="precompiled_header"></property>
<property name="relative_path">1</property>
<property name="skip_php_events">1</property>
<property name="skip_python_events">1</property>
<property name="use_enum">1</property>
<property name="use_microsoft_bom">0</property>
......@@ -27,8 +29,11 @@
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_managed">0</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>
......@@ -51,7 +56,6 @@
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="layer"></property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
......@@ -65,13 +69,11 @@
<property name="pane_size"></property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="position"></property>
<property name="resize">Resizable</property>
<property name="row"></property>
<property name="show">1</property>
<property name="size">476,372</property>
<property name="size">-1,-1</property>
<property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>
<property name="subclass"></property>
<property name="subclass">DIALOG_SHIM; dialog_shim.h</property>
<property name="title">Pin Properties</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
......@@ -166,7 +168,10 @@
<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>
......@@ -187,7 +192,6 @@
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Pin &amp;name:</property>
<property name="layer"></property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
......@@ -202,9 +206,7 @@
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="position"></property>
<property name="resize">Resizable</property>
<property name="row"></property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
......@@ -253,7 +255,10 @@
<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>
......@@ -273,7 +278,6 @@
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">ID_M_TEXTPINNAME</property>
<property name="layer"></property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
......@@ -289,12 +293,10 @@
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="position"></property>
<property name="resize">Resizable</property>
<property name="row"></property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="style">wxTE_PROCESS_TAB</property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
......@@ -344,7 +346,10 @@
<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>
......@@ -365,7 +370,6 @@
<property name="hidden">0</property>
<property name="id">ID_M_STATICTEXTPADNAME</property>
<property name="label">Pin n&amp;umber:</property>
<property name="layer"></property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
......@@ -380,9 +384,7 @@
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="position"></property>
<property name="resize">Resizable</property>
<property name="row"></property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
......@@ -431,7 +433,10 @@
<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>
......@@ -451,7 +456,6 @@
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">ID_M_TEXTPADNAME</property>
<property name="layer"></property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
......@@ -467,12 +471,10 @@
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="position"></property>
<property name="resize">Resizable</property>
<property name="row"></property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="style">wxTE_PROCESS_TAB</property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
......@@ -522,7 +524,10 @@
<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>
......@@ -543,7 +548,6 @@
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">&amp;Orientation:</property>
<property name="layer"></property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
......@@ -558,9 +562,7 @@
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="position"></property>
<property name="resize">Resizable</property>
<property name="row"></property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
......@@ -609,7 +611,10 @@
<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>
......@@ -630,7 +635,6 @@
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="layer"></property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
......@@ -645,9 +649,8 @@
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="position"></property>
<property name="resize">Resizable</property>
<property name="row"></property>
<property name="selection">-1</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
......@@ -699,7 +702,10 @@
<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>
......@@ -720,7 +726,6 @@
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">&amp;Electrical type:</property>
<property name="layer"></property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
......@@ -735,9 +740,7 @@
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="position"></property>
<property name="resize">Resizable</property>
<property name="row"></property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
......@@ -786,7 +789,10 @@
<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>
......@@ -807,7 +813,6 @@
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="layer"></property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
......@@ -822,9 +827,8 @@
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="position"></property>
<property name="resize">Resizable</property>
<property name="row"></property>
<property name="selection">-1</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
......@@ -876,7 +880,10 @@
<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>
......@@ -897,7 +904,6 @@
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Graphic &amp;Style:</property>
<property name="layer"></property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
......@@ -912,9 +918,7 @@
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="position"></property>
<property name="resize">Resizable</property>
<property name="row"></property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
......@@ -963,7 +967,10 @@
<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>
......@@ -984,7 +991,6 @@
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="layer"></property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
......@@ -999,9 +1005,8 @@
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="position"></property>
<property name="resize">Resizable</property>
<property name="row"></property>
<property name="selection">-1</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
......@@ -1076,7 +1081,10 @@
<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>
......@@ -1098,7 +1106,6 @@
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Shared by all &amp;parts in component</property>
<property name="layer"></property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
......@@ -1113,9 +1120,7 @@
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="position"></property>
<property name="resize">Resizable</property>
<property name="row"></property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
......@@ -1164,7 +1169,10 @@
<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>
......@@ -1186,7 +1194,6 @@
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Shared by all body &amp;styles (DeMorgan)</property>
<property name="layer"></property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
......@@ -1201,9 +1208,7 @@
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="position"></property>
<property name="resize">Resizable</property>
<property name="row"></property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
......@@ -1266,7 +1271,10 @@
<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>
......@@ -1288,7 +1296,6 @@
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">&amp;Visible</property>
<property name="layer"></property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
......@@ -1303,9 +1310,7 @@
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="position"></property>
<property name="resize">Resizable</property>
<property name="row"></property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
......@@ -1385,7 +1390,10 @@
<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>
......@@ -1406,7 +1414,6 @@
<property name="hidden">0</property>
<property name="id">ID_M_STATICTEXTNAMESIZE</property>
<property name="label">N&amp;ame text size:</property>
<property name="layer"></property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
......@@ -1421,9 +1428,7 @@
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="position"></property>
<property name="resize">Resizable</property>
<property name="row"></property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
......@@ -1472,7 +1477,10 @@
<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>
......@@ -1492,7 +1500,6 @@
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">ID_M_TEXTPINNAMETEXTSIZE</property>
<property name="layer"></property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
......@@ -1508,9 +1515,7 @@
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="position"></property>
<property name="resize">Resizable</property>
<property name="row"></property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
......@@ -1563,7 +1568,10 @@
<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>
......@@ -1584,7 +1592,6 @@
<property name="hidden">0</property>
<property name="id">ID_M_STATICNAMETEXTSIZEUNITS</property>
<property name="label">units</property>
<property name="layer"></property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
......@@ -1599,9 +1606,7 @@
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="position"></property>
<property name="resize">Resizable</property>
<property name="row"></property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
......@@ -1650,7 +1655,10 @@
<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>
......@@ -1671,7 +1679,6 @@
<property name="hidden">0</property>
<property name="id">ID_M_STATICTEXTPADNAMESIZE</property>
<property name="label">Number te&amp;xt size:</property>
<property name="layer"></property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
......@@ -1686,9 +1693,7 @@
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="position"></property>
<property name="resize">Resizable</property>
<property name="row"></property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
......@@ -1737,7 +1742,10 @@
<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>
......@@ -1757,7 +1765,6 @@
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">ID_M_TEXTPADNAMETEXTSIZE</property>
<property name="layer"></property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
......@@ -1773,9 +1780,7 @@
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="position"></property>
<property name="resize">Resizable</property>
<property name="row"></property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
......@@ -1828,7 +1833,10 @@
<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>
......@@ -1849,7 +1857,6 @@
<property name="hidden">0</property>
<property name="id">ID_M_STATICNUMBERTEXTSIZEUNITS</property>
<property name="label">units</property>
<property name="layer"></property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
......@@ -1864,9 +1871,7 @@
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="position"></property>
<property name="resize">Resizable</property>
<property name="row"></property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
......@@ -1915,7 +1920,10 @@
<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>
......@@ -1936,7 +1944,6 @@
<property name="hidden">0</property>
<property name="id">ID_M_STATICTEXTPINLEN</property>
<property name="label">&amp;Length:</property>
<property name="layer"></property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
......@@ -1951,9 +1958,7 @@
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="position"></property>
<property name="resize">Resizable</property>
<property name="row"></property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
......@@ -2002,7 +2007,10 @@
<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>
......@@ -2022,7 +2030,6 @@
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">ID_M_TEXTLENGTH</property>
<property name="layer"></property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
......@@ -2038,9 +2045,7 @@
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="position"></property>
<property name="resize">Resizable</property>
<property name="row"></property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
......@@ -2093,7 +2098,10 @@
<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>
......@@ -2114,7 +2122,6 @@
<property name="hidden">0</property>
<property name="id">ID_M_STATICLENGTHUNITS</property>
<property name="label">units</property>
<property name="layer"></property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
......@@ -2129,9 +2136,7 @@
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="position"></property>
<property name="resize">Resizable</property>
<property name="row"></property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
......@@ -2182,7 +2187,10 @@
<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>
......@@ -2202,7 +2210,6 @@
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="layer"></property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
......@@ -2217,9 +2224,7 @@
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="position"></property>
<property name="resize">Resizable</property>
<property name="row"></property>
<property name="show">1</property>
<property name="size"></property>
<property name="subclass"></property>
......@@ -2270,7 +2275,10 @@
<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>
......@@ -2290,7 +2298,6 @@
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="layer"></property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
......@@ -2305,9 +2312,7 @@
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="position"></property>
<property name="resize">Resizable</property>
<property name="row"></property>
<property name="show">1</property>
<property name="size"></property>
<property name="style">wxLI_HORIZONTAL</property>
......
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 30 2011)
// C++ code generated with wxFormBuilder (version Mar 19 2012)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
......@@ -11,8 +11,8 @@
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
class wxBitmapComboBox;
#include "wx/bmpcbox.h"
#include "dialog_shim.h"
#include <wx/string.h>
#include <wx/stattext.h>
#include <wx/gdicmn.h>
......@@ -34,7 +34,7 @@ class wxBitmapComboBox;
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_LIB_EDIT_PIN_BASE
///////////////////////////////////////////////////////////////////////////////
class DIALOG_LIB_EDIT_PIN_BASE : public wxDialog
class DIALOG_LIB_EDIT_PIN_BASE : public DIALOG_SHIM
{
private:
......@@ -52,7 +52,7 @@ class DIALOG_LIB_EDIT_PIN_BASE : public wxDialog
ID_M_STATICNUMBERTEXTSIZEUNITS,
ID_M_STATICTEXTPINLEN,
ID_M_TEXTLENGTH,
ID_M_STATICLENGTHUNITS,
ID_M_STATICLENGTHUNITS
};
wxStaticText* m_staticTextPinName;
......@@ -93,7 +93,7 @@ class DIALOG_LIB_EDIT_PIN_BASE : public wxDialog
public:
DIALOG_LIB_EDIT_PIN_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Pin Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 476,372 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
DIALOG_LIB_EDIT_PIN_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Pin Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_LIB_EDIT_PIN_BASE();
};
......
......@@ -109,7 +109,7 @@ void LIB_EDIT_FRAME::OnEditPin( wxCommandEvent& event )
dlg.Layout();
dlg.Fit();
dlg.SetMinSize( dlg.GetSize() );
dlg.SetLastSizeAndPosition();
// dlg.SetLastSizeAndPosition(); // done in DIALOG_SHIM::Show()
if( dlg.ShowModal() == wxID_CANCEL )
{
......@@ -121,7 +121,7 @@ void LIB_EDIT_FRAME::OnEditPin( wxCommandEvent& event )
return;
}
/* Save the pin properties to use for the next new pin. */
// Save the pin properties to use for the next new pin.
LastPinNameSize = ReturnValueFromString( g_UserUnit, dlg.GetNameTextSize(), m_internalUnits );
LastPinNumSize = ReturnValueFromString( g_UserUnit, dlg.GetPadNameTextSize(), m_internalUnits );
LastPinOrient = LIB_PIN::GetOrientationCode( dlg.GetOrientation() );
......@@ -185,7 +185,7 @@ static void AbortPinMove( EDA_DRAW_PANEL* Panel, wxDC* DC )
else
parent->RestoreComponent();
/* clear edit flags */
// clear edit flags
parent->SetDrawItem( NULL );
parent->SetLastDrawItem( NULL );
Panel->Refresh( true );
......@@ -258,7 +258,7 @@ another pin. Continue?" ) );
m_component->AddDrawItem( m_drawItem );
}
/* Put linked pins in new position, and clear flags */
// Put linked pins in new position, and clear flags
for( Pin = m_component->GetNextPin(); Pin != NULL; Pin = m_component->GetNextPin( Pin ) )
{
if( Pin->GetFlags() == 0 )
......@@ -292,7 +292,7 @@ void LIB_EDIT_FRAME::StartMovePin( wxDC* DC )
TempCopyComponent();
/* Mark pins for moving. */
// Mark pins for moving.
Pin = m_component->GetNextPin();
for( ; Pin != NULL; Pin = m_component->GetNextPin( Pin ) )
......@@ -341,7 +341,7 @@ static void DrawMovePin( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosi
wxPoint pinpos = CurrentPin->GetPosition();
bool showPinText = true;
/* Erase pin in old position */
// Erase pin in old position
if( aErase )
{
CurrentPin->SetPosition( PinPreviousPos );
......@@ -349,7 +349,7 @@ static void DrawMovePin( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosi
&showPinText, DefaultTransform );
}
/* Redraw pin in new position */
// Redraw pin in new position
CurrentPin->SetPosition( aPanel->GetScreen()->GetCrossHairPosition( true ) );
CurrentPin->Draw( aPanel, aDC, wxPoint( 0, 0 ), -1, g_XorMode, &showPinText, DefaultTransform );
......@@ -383,7 +383,7 @@ void LIB_EDIT_FRAME::CreatePin( wxDC* DC )
pin->SetUnit( m_unit );
pin->SetConvert( m_convert );
/* Flag pins to consider */
// Flag pins to consider
if( SynchronizePins() )
pin->SetFlags( IS_LINKED );
......@@ -430,7 +430,7 @@ void LIB_EDIT_FRAME::CreateImagePins( LIB_PIN* aPin, int aUnit, int aConvert, bo
if( !SynchronizePins() )
return;
/* Create "convert" pin at the current position. */
// Create "convert" pin at the current position.
if( aDeMorgan && ( aPin->GetConvert() != 0 ) )
{
NewPin = (LIB_PIN*) aPin->Clone();
......@@ -446,7 +446,7 @@ void LIB_EDIT_FRAME::CreateImagePins( LIB_PIN* aPin, int aUnit, int aConvert, bo
for( ii = 1; ii <= aPin->GetParent()->GetPartCount(); ii++ )
{
if( ii == aUnit || aPin->GetUnit() == 0 )
continue; /* Pin common to all units. */
continue; // Pin common to all units.
NewPin = (LIB_PIN*) aPin->Clone();
......@@ -526,7 +526,7 @@ void LIB_EDIT_FRAME::GlobalSetPins( wxDC* DC, LIB_PIN* MasterPin, int id )
}
/* Create a new pin based on the previous pin with an incremented pin number. */
// Create a new pin based on the previous pin with an incremented pin number.
void LIB_EDIT_FRAME::RepeatPinItem( wxDC* DC, LIB_PIN* SourcePin )
{
LIB_PIN* Pin;
......@@ -570,7 +570,7 @@ void LIB_EDIT_FRAME::RepeatPinItem( wxDC* DC, LIB_PIN* SourcePin )
}
/* helper function to sort pins by pin num */
// helper function to sort pins by pin num
bool sort_by_pin_number( const LIB_PIN* ref, const LIB_PIN* tst )
{
int test = ref->GetNumber() - tst->GetNumber();
......
#ifndef DIALOG_SHIM_
#define DIALOG_SHIM_
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2012 KiCad Developers, see CHANGELOG.TXT for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <wx/dialog.h>
#include <hashtables.h>
/**
* Class DIALOG_SHIM
* may sit in the inheritance tree between wxDialog and any class written by
* wxFormBuilder. To put it there, use wxFormBuilder tool and set:
* <br> subclass name = DIALOG_SHIM
* <br> subclass header = dialog_shim.h
* <br>
* in the dialog window's properties.
**/
class DIALOG_SHIM : public wxDialog
{
public:
DIALOG_SHIM( wxWindow* aParent, wxWindowID id, const wxString& title,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_DIALOG_STYLE,
const wxString& name = wxDialogNameStr );
bool Show( bool show ); // overload wxDialog::Show
/*
const wxSize& GetLastSize();
const wxPoint& GetLastPosition();
*/
};
#endif // DIALOG_SHIM_
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