Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
kicad-source-mirror
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Elphel
kicad-source-mirror
Commits
8e538ddd
Commit
8e538ddd
authored
Apr 18, 2011
by
jean-pierre charras
Browse files
Options
Browse Files
Download
Plain Diff
Libedit: Make pin editor dialog resizable. This dialog remembers now its last size and position.
parents
5679e675
44c3ef1f
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
176 additions
and
27 deletions
+176
-27
dialog_lib_edit_pin.cpp
eeschema/dialogs/dialog_lib_edit_pin.cpp
+43
-0
dialog_lib_edit_pin.h
eeschema/dialogs/dialog_lib_edit_pin.h
+8
-0
dialog_lib_edit_pin_base.cpp
eeschema/dialogs/dialog_lib_edit_pin_base.cpp
+18
-11
dialog_lib_edit_pin_base.fbp
eeschema/dialogs/dialog_lib_edit_pin_base.fbp
+97
-15
dialog_lib_edit_pin_base.h
eeschema/dialogs/dialog_lib_edit_pin_base.h
+9
-1
pinedit.cpp
eeschema/pinedit.cpp
+1
-0
No files found.
eeschema/dialogs/dialog_lib_edit_pin.cpp
View file @
8e538ddd
...
...
@@ -2,6 +2,10 @@
#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
)
:
DIALOG_LIB_EDIT_PIN_BASE
(
parent
)
...
...
@@ -14,6 +18,45 @@ DIALOG_LIB_EDIT_PIN::DIALOG_LIB_EDIT_PIN( wxWindow* parent ) :
m_sdbSizerButtonsOK
->
SetDefault
();
}
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
();
}
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
);
}
void
DIALOG_LIB_EDIT_PIN
::
SetOrientationList
(
const
wxArrayString
&
list
,
const
char
***
aBitmaps
)
...
...
eeschema/dialogs/dialog_lib_edit_pin.h
View file @
8e538ddd
...
...
@@ -13,10 +13,18 @@
/** 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
;
public
:
/** Constructor */
DIALOG_LIB_EDIT_PIN
(
wxWindow
*
parent
);
void
SetLastSizeAndPosition
();
void
OnCloseDialog
(
wxCloseEvent
&
event
);
void
OnCancelButtonClick
(
wxCommandEvent
&
event
);
void
OnOKButtonClick
(
wxCommandEvent
&
event
);
void
SetOrientationList
(
const
wxArrayString
&
list
,
const
char
***
aBitmaps
);
void
SetOrientation
(
int
orientation
)
{
...
...
eeschema/dialogs/dialog_lib_edit_pin_base.cpp
View file @
8e538ddd
...
...
@@ -12,7 +12,10 @@
///////////////////////////////////////////////////////////////////////////
BEGIN_EVENT_TABLE
(
DIALOG_LIB_EDIT_PIN_BASE
,
wxDialog
)
EVT_CLOSE
(
DIALOG_LIB_EDIT_PIN_BASE
::
_wxFB_OnCloseDialog
)
EVT_CHECKBOX
(
wxID_ANY
,
DIALOG_LIB_EDIT_PIN_BASE
::
_wxFB_OnCBpartSelection
)
EVT_BUTTON
(
wxID_CANCEL
,
DIALOG_LIB_EDIT_PIN_BASE
::
_wxFB_OnCancelButtonClick
)
EVT_BUTTON
(
wxID_OK
,
DIALOG_LIB_EDIT_PIN_BASE
::
_wxFB_OnOKButtonClick
)
END_EVENT_TABLE
()
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
)
...
...
@@ -24,6 +27,8 @@ DIALOG_LIB_EDIT_PIN_BASE::DIALOG_LIB_EDIT_PIN_BASE( wxWindow* parent, wxWindowID
wxFlexGridSizer
*
fgSizer1
;
fgSizer1
=
new
wxFlexGridSizer
(
5
,
6
,
0
,
0
);
fgSizer1
->
AddGrowableCol
(
1
);
fgSizer1
->
AddGrowableCol
(
4
);
fgSizer1
->
SetFlexibleDirection
(
wxBOTH
);
fgSizer1
->
SetNonFlexibleGrowMode
(
wxFLEX_GROWMODE_ALL
);
...
...
@@ -32,7 +37,7 @@ DIALOG_LIB_EDIT_PIN_BASE::DIALOG_LIB_EDIT_PIN_BASE( wxWindow* parent, wxWindowID
fgSizer1
->
Add
(
m_staticTextPinName
,
0
,
wxALIGN_CENTER_VERTICAL
|
wxALL
,
3
);
m_textPinName
=
new
wxTextCtrl
(
this
,
ID_M_TEXTPINNAME
,
wxEmptyString
,
wxDefaultPosition
,
wxDefaultSize
,
0
);
fgSizer1
->
Add
(
m_textPinName
,
0
,
wxALIGN_CENTER_VERTICAL
|
wx
ALL
|
wxEXPAND
,
3
);
fgSizer1
->
Add
(
m_textPinName
,
0
,
wxALIGN_CENTER_VERTICAL
|
wx
EXPAND
|
wxTOP
|
wxBOTTOM
,
3
);
fgSizer1
->
Add
(
0
,
0
,
1
,
wxEXPAND
,
3
);
...
...
@@ -42,7 +47,7 @@ DIALOG_LIB_EDIT_PIN_BASE::DIALOG_LIB_EDIT_PIN_BASE( wxWindow* parent, wxWindowID
fgSizer1
->
Add
(
m_staticTextNameSize
,
0
,
wxALIGN_CENTER_VERTICAL
|
wxALL
,
3
);
m_textPinNameTextSize
=
new
wxTextCtrl
(
this
,
ID_M_TEXTPINNAMETEXTSIZE
,
wxEmptyString
,
wxDefaultPosition
,
wxDefaultSize
,
0
);
fgSizer1
->
Add
(
m_textPinNameTextSize
,
0
,
wxALIGN_CENTER_VERTICAL
|
wx
ALL
,
3
);
fgSizer1
->
Add
(
m_textPinNameTextSize
,
0
,
wxALIGN_CENTER_VERTICAL
|
wx
EXPAND
|
wxTOP
|
wxBOTTOM
,
3
);
m_staticNameTextSizeUnits
=
new
wxStaticText
(
this
,
wxID_ANY
,
_
(
"units"
),
wxDefaultPosition
,
wxDefaultSize
,
0
);
m_staticNameTextSizeUnits
->
Wrap
(
-
1
);
...
...
@@ -55,7 +60,7 @@ DIALOG_LIB_EDIT_PIN_BASE::DIALOG_LIB_EDIT_PIN_BASE( wxWindow* parent, wxWindowID
fgSizer1
->
Add
(
m_staticTextPadName
,
0
,
wxALIGN_CENTER_VERTICAL
|
wxALL
,
3
);
m_textPadName
=
new
wxTextCtrl
(
this
,
ID_M_TEXTPADNAME
,
wxEmptyString
,
wxDefaultPosition
,
wxDefaultSize
,
0
);
fgSizer1
->
Add
(
m_textPadName
,
0
,
wxALIGN_CENTER_VERTICAL
|
wx
ALL
|
wxEXPAND
,
3
);
fgSizer1
->
Add
(
m_textPadName
,
0
,
wxALIGN_CENTER_VERTICAL
|
wx
EXPAND
|
wxTOP
|
wxBOTTOM
,
3
);
fgSizer1
->
Add
(
0
,
0
,
1
,
wxEXPAND
,
3
);
...
...
@@ -65,7 +70,7 @@ DIALOG_LIB_EDIT_PIN_BASE::DIALOG_LIB_EDIT_PIN_BASE( wxWindow* parent, wxWindowID
fgSizer1
->
Add
(
m_staticTextPadNameSize
,
0
,
wxALIGN_CENTER_VERTICAL
|
wxALL
,
3
);
m_textPadNameTextSize
=
new
wxTextCtrl
(
this
,
ID_M_TEXTPADNAMETEXTSIZE
,
wxEmptyString
,
wxDefaultPosition
,
wxDefaultSize
,
0
);
fgSizer1
->
Add
(
m_textPadNameTextSize
,
0
,
wxALIGN_CENTER_VERTICAL
|
wx
ALL
,
3
);
fgSizer1
->
Add
(
m_textPadNameTextSize
,
0
,
wxALIGN_CENTER_VERTICAL
|
wx
EXPAND
|
wxTOP
|
wxBOTTOM
,
3
);
m_staticNumberTextSizeUnits
=
new
wxStaticText
(
this
,
wxID_ANY
,
_
(
"units"
),
wxDefaultPosition
,
wxDefaultSize
,
0
);
m_staticNumberTextSizeUnits
->
Wrap
(
-
1
);
...
...
@@ -76,7 +81,7 @@ DIALOG_LIB_EDIT_PIN_BASE::DIALOG_LIB_EDIT_PIN_BASE( wxWindow* parent, wxWindowID
fgSizer1
->
Add
(
m_staticTextOrient
,
0
,
wxALIGN_CENTER_VERTICAL
|
wxALL
,
3
);
m_choiceOrientation
=
new
wxBitmapComboBox
(
this
,
wxID_ANY
,
wxEmptyString
,
wxDefaultPosition
,
wxDefaultSize
,
0
,
NULL
,
0
);
fgSizer1
->
Add
(
m_choiceOrientation
,
0
,
wx
ALL
,
5
);
fgSizer1
->
Add
(
m_choiceOrientation
,
0
,
wx
EXPAND
|
wxTOP
|
wxBOTTOM
,
5
);
fgSizer1
->
Add
(
15
,
0
,
1
,
wxEXPAND
,
3
);
...
...
@@ -86,7 +91,7 @@ DIALOG_LIB_EDIT_PIN_BASE::DIALOG_LIB_EDIT_PIN_BASE( wxWindow* parent, wxWindowID
fgSizer1
->
Add
(
m_staticTextPinLen
,
0
,
wxALIGN_CENTER_VERTICAL
|
wxALL
,
3
);
m_textLength
=
new
wxTextCtrl
(
this
,
wxID_ANY
,
wxEmptyString
,
wxDefaultPosition
,
wxDefaultSize
,
0
);
fgSizer1
->
Add
(
m_textLength
,
0
,
wxALIGN_CENTER_VERTICAL
|
wx
ALL
,
3
);
fgSizer1
->
Add
(
m_textLength
,
0
,
wxALIGN_CENTER_VERTICAL
|
wx
EXPAND
|
wxTOP
|
wxBOTTOM
,
3
);
m_staticLengthUnits
=
new
wxStaticText
(
this
,
wxID_ANY
,
_
(
"units"
),
wxDefaultPosition
,
wxDefaultSize
,
0
);
m_staticLengthUnits
->
Wrap
(
-
1
);
...
...
@@ -99,7 +104,7 @@ DIALOG_LIB_EDIT_PIN_BASE::DIALOG_LIB_EDIT_PIN_BASE( wxWindow* parent, wxWindowID
fgSizer1
->
Add
(
m_staticTextEType
,
0
,
wxALIGN_CENTER_VERTICAL
|
wxALL
,
3
);
m_choiceElectricalType
=
new
wxBitmapComboBox
(
this
,
wxID_ANY
,
wxEmptyString
,
wxDefaultPosition
,
wxDefaultSize
,
0
,
NULL
,
0
);
fgSizer1
->
Add
(
m_choiceElectricalType
,
0
,
wx
ALL
,
5
);
fgSizer1
->
Add
(
m_choiceElectricalType
,
0
,
wx
EXPAND
|
wxTOP
|
wxBOTTOM
,
5
);
fgSizer1
->
Add
(
0
,
0
,
1
,
wxEXPAND
,
3
);
...
...
@@ -118,7 +123,7 @@ DIALOG_LIB_EDIT_PIN_BASE::DIALOG_LIB_EDIT_PIN_BASE( wxWindow* parent, wxWindowID
fgSizer1
->
Add
(
m_staticTextGstyle
,
0
,
wxALIGN_CENTER_VERTICAL
|
wxALL
,
3
);
m_choiceStyle
=
new
wxBitmapComboBox
(
this
,
wxID_ANY
,
wxEmptyString
,
wxDefaultPosition
,
wxDefaultSize
,
0
,
NULL
,
0
);
fgSizer1
->
Add
(
m_choiceStyle
,
0
,
wx
ALL
,
5
);
fgSizer1
->
Add
(
m_choiceStyle
,
0
,
wx
EXPAND
|
wxTOP
|
wxBOTTOM
,
5
);
fgSizer1
->
Add
(
0
,
0
,
1
,
wxEXPAND
,
3
);
...
...
@@ -129,7 +134,7 @@ DIALOG_LIB_EDIT_PIN_BASE::DIALOG_LIB_EDIT_PIN_BASE( wxWindow* parent, wxWindowID
fgSizer1
->
Add
(
0
,
0
,
1
,
wxEXPAND
,
5
);
mainSizer
->
Add
(
fgSizer1
,
0
,
wxALL
|
wxEXPAND
,
12
);
mainSizer
->
Add
(
fgSizer1
,
1
,
wxALL
|
wxEXPAND
,
12
);
wxBoxSizer
*
boarderSizer
;
boarderSizer
=
new
wxBoxSizer
(
wxVERTICAL
);
...
...
@@ -147,19 +152,21 @@ DIALOG_LIB_EDIT_PIN_BASE::DIALOG_LIB_EDIT_PIN_BASE( wxWindow* parent, wxWindowID
boarderSizer
->
Add
(
0
,
5
,
0
,
wxALL
|
wxEXPAND
,
10
);
m_staticline1
=
new
wxStaticLine
(
this
,
wxID_ANY
,
wxDefaultPosition
,
wxDefaultSize
,
wxLI_HORIZONTAL
);
boarderSizer
->
Add
(
m_staticline1
,
0
,
wxEXPAND
|
wxBOTTOM
|
wxRIGHT
|
wxLEFT
,
5
);
m_sdbSizerButtons
=
new
wxStdDialogButtonSizer
();
m_sdbSizerButtonsOK
=
new
wxButton
(
this
,
wxID_OK
);
m_sdbSizerButtons
->
AddButton
(
m_sdbSizerButtonsOK
);
m_sdbSizerButtonsCancel
=
new
wxButton
(
this
,
wxID_CANCEL
);
m_sdbSizerButtons
->
AddButton
(
m_sdbSizerButtonsCancel
);
m_sdbSizerButtons
->
Realize
();
boarderSizer
->
Add
(
m_sdbSizerButtons
,
0
,
wxALL
|
wx
EXPAND
,
0
);
boarderSizer
->
Add
(
m_sdbSizerButtons
,
0
,
wxALL
|
wx
ALIGN_RIGHT
,
0
);
mainSizer
->
Add
(
boarderSizer
,
0
,
wxALL
|
wxEXPAND
,
12
);
this
->
SetSizer
(
mainSizer
);
this
->
Layout
();
mainSizer
->
Fit
(
this
);
this
->
Centre
(
wxBOTH
);
}
...
...
eeschema/dialogs/dialog_lib_edit_pin_base.fbp
View file @
8e538ddd
This diff is collapsed.
Click to expand it.
eeschema/dialogs/dialog_lib_edit_pin_base.h
View file @
8e538ddd
...
...
@@ -22,6 +22,7 @@ class wxBitmapComboBox;
#include <wx/combobox.h>
#include <wx/sizer.h>
#include <wx/checkbox.h>
#include <wx/statline.h>
#include <wx/button.h>
#include <wx/dialog.h>
...
...
@@ -36,7 +37,10 @@ class DIALOG_LIB_EDIT_PIN_BASE : public wxDialog
private
:
// Private event handlers
void
_wxFB_OnCloseDialog
(
wxCloseEvent
&
event
){
OnCloseDialog
(
event
);
}
void
_wxFB_OnCBpartSelection
(
wxCommandEvent
&
event
){
OnCBpartSelection
(
event
);
}
void
_wxFB_OnCancelButtonClick
(
wxCommandEvent
&
event
){
OnCancelButtonClick
(
event
);
}
void
_wxFB_OnOKButtonClick
(
wxCommandEvent
&
event
){
OnOKButtonClick
(
event
);
}
protected
:
...
...
@@ -83,17 +87,21 @@ class DIALOG_LIB_EDIT_PIN_BASE : public wxDialog
wxCheckBox
*
m_checkApplyToAllConversions
;
wxCheckBox
*
m_checkShow
;
wxStaticLine
*
m_staticline1
;
wxStdDialogButtonSizer
*
m_sdbSizerButtons
;
wxButton
*
m_sdbSizerButtonsOK
;
wxButton
*
m_sdbSizerButtonsCancel
;
// Virtual event handlers, overide them in your derived class
virtual
void
OnCloseDialog
(
wxCloseEvent
&
event
)
{
event
.
Skip
();
}
virtual
void
OnCBpartSelection
(
wxCommandEvent
&
event
)
{
event
.
Skip
();
}
virtual
void
OnCancelButtonClick
(
wxCommandEvent
&
event
)
{
event
.
Skip
();
}
virtual
void
OnOKButtonClick
(
wxCommandEvent
&
event
)
{
event
.
Skip
();
}
public
:
DIALOG_LIB_EDIT_PIN_BASE
(
wxWindow
*
parent
,
wxWindowID
id
=
wxID_ANY
,
const
wxString
&
title
=
_
(
"Pin Properties"
),
const
wxPoint
&
pos
=
wxDefaultPosition
,
const
wxSize
&
size
=
wx
DefaultSize
,
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
=
wx
Size
(
487
,
344
)
,
long
style
=
wxDEFAULT_DIALOG_STYLE
|
wxRESIZE_BORDER
);
~
DIALOG_LIB_EDIT_PIN_BASE
();
};
...
...
eeschema/pinedit.cpp
View file @
8e538ddd
...
...
@@ -81,6 +81,7 @@ void LIB_EDIT_FRAME::OnEditPin( wxCommandEvent& event )
dlg
.
Layout
();
dlg
.
Fit
();
dlg
.
SetMinSize
(
dlg
.
GetSize
()
);
dlg
.
SetLastSizeAndPosition
();
if
(
dlg
.
ShowModal
()
==
wxID_CANCEL
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment