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
29446320
Commit
29446320
authored
11 years ago
by
jean-pierre charras
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Code cleanup and minor fix in viewlib.
parent
a094f7d5
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
84 additions
and
149 deletions
+84
-149
tool_viewlib.cpp
eeschema/tool_viewlib.cpp
+9
-9
viewlib_frame.cpp
eeschema/viewlib_frame.cpp
+59
-116
viewlib_frame.h
eeschema/viewlib_frame.h
+9
-17
viewlibs.cpp
eeschema/viewlibs.cpp
+7
-7
No files found.
eeschema/tool_viewlib.cpp
View file @
29446320
...
@@ -105,10 +105,10 @@ void LIB_VIEW_FRAME::ReCreateHToolbar()
...
@@ -105,10 +105,10 @@ void LIB_VIEW_FRAME::ReCreateHToolbar()
m_mainToolBar
->
AddSeparator
();
m_mainToolBar
->
AddSeparator
();
S
elpartBox
=
new
wxComboBox
(
m_mainToolBar
,
ID_LIBVIEW_SELECT_PART_NUMBER
,
m_s
elpartBox
=
new
wxComboBox
(
m_mainToolBar
,
ID_LIBVIEW_SELECT_PART_NUMBER
,
wxEmptyString
,
wxDefaultPosition
,
wxEmptyString
,
wxDefaultPosition
,
wxSize
(
150
,
-
1
),
0
,
NULL
,
wxCB_READONLY
);
wxSize
(
150
,
-
1
),
0
,
NULL
,
wxCB_READONLY
);
m_mainToolBar
->
AddControl
(
S
elpartBox
);
m_mainToolBar
->
AddControl
(
m_s
elpartBox
);
m_mainToolBar
->
AddSeparator
();
m_mainToolBar
->
AddSeparator
();
m_mainToolBar
->
AddTool
(
ID_LIBVIEW_VIEWDOC
,
wxEmptyString
,
m_mainToolBar
->
AddTool
(
ID_LIBVIEW_VIEWDOC
,
wxEmptyString
,
...
@@ -116,7 +116,7 @@ void LIB_VIEW_FRAME::ReCreateHToolbar()
...
@@ -116,7 +116,7 @@ void LIB_VIEW_FRAME::ReCreateHToolbar()
_
(
"View component documents"
)
);
_
(
"View component documents"
)
);
m_mainToolBar
->
EnableTool
(
ID_LIBVIEW_VIEWDOC
,
false
);
m_mainToolBar
->
EnableTool
(
ID_LIBVIEW_VIEWDOC
,
false
);
if
(
m_
S
emaphore
)
if
(
m_
s
emaphore
)
{
{
// The library browser is called from a "load component" command
// The library browser is called from a "load component" command
m_mainToolBar
->
AddSeparator
();
m_mainToolBar
->
AddSeparator
();
...
@@ -167,17 +167,17 @@ void LIB_VIEW_FRAME::ReCreateHToolbar()
...
@@ -167,17 +167,17 @@ void LIB_VIEW_FRAME::ReCreateHToolbar()
if
(
component
)
if
(
component
)
parts_count
=
std
::
max
(
component
->
GetPartCount
(),
1
);
parts_count
=
std
::
max
(
component
->
GetPartCount
(),
1
);
S
elpartBox
->
Clear
();
m_s
elpartBox
->
Clear
();
for
(
ii
=
0
;
ii
<
parts_count
;
ii
++
)
for
(
ii
=
0
;
ii
<
parts_count
;
ii
++
)
{
{
wxString
msg
;
wxString
msg
;
msg
.
Printf
(
_
(
"Unit %c"
),
'A'
+
ii
);
msg
.
Printf
(
_
(
"Unit %c"
),
'A'
+
ii
);
S
elpartBox
->
Append
(
msg
);
m_s
elpartBox
->
Append
(
msg
);
}
}
S
elpartBox
->
SetSelection
(
(
m_unit
>
0
)
?
m_unit
-
1
:
0
);
m_s
elpartBox
->
SetSelection
(
(
m_unit
>
0
)
?
m_unit
-
1
:
0
);
S
elpartBox
->
Enable
(
parts_count
>
1
);
m_s
elpartBox
->
Enable
(
parts_count
>
1
);
m_mainToolBar
->
EnableTool
(
ID_LIBVIEW_VIEWDOC
,
m_mainToolBar
->
EnableTool
(
ID_LIBVIEW_VIEWDOC
,
entry
&&
(
entry
->
GetDocFileName
()
!=
wxEmptyString
)
);
entry
&&
(
entry
->
GetDocFileName
()
!=
wxEmptyString
)
);
...
...
This diff is collapsed.
Click to expand it.
eeschema/viewlib_frame.cpp
View file @
29446320
...
@@ -60,10 +60,6 @@ BEGIN_EVENT_TABLE( LIB_VIEW_FRAME, EDA_DRAW_FRAME )
...
@@ -60,10 +60,6 @@ BEGIN_EVENT_TABLE( LIB_VIEW_FRAME, EDA_DRAW_FRAME )
EVT_SIZE
(
LIB_VIEW_FRAME
::
OnSize
)
EVT_SIZE
(
LIB_VIEW_FRAME
::
OnSize
)
EVT_ACTIVATE
(
LIB_VIEW_FRAME
::
OnActivate
)
EVT_ACTIVATE
(
LIB_VIEW_FRAME
::
OnActivate
)
/* Sash drag events */
EVT_SASH_DRAGGED
(
ID_LIBVIEW_LIBWINDOW
,
LIB_VIEW_FRAME
::
OnSashDrag
)
EVT_SASH_DRAGGED
(
ID_LIBVIEW_CMPWINDOW
,
LIB_VIEW_FRAME
::
OnSashDrag
)
/* Toolbar events */
/* Toolbar events */
EVT_TOOL_RANGE
(
ID_LIBVIEW_NEXT
,
ID_LIBVIEW_DE_MORGAN_CONVERT_BUTT
,
EVT_TOOL_RANGE
(
ID_LIBVIEW_NEXT
,
ID_LIBVIEW_DE_MORGAN_CONVERT_BUTT
,
LIB_VIEW_FRAME
::
Process_Special_Functions
)
LIB_VIEW_FRAME
::
Process_Special_Functions
)
...
@@ -96,8 +92,6 @@ static wxAcceleratorEntry accels[] =
...
@@ -96,8 +92,6 @@ static wxAcceleratorEntry accels[] =
};
};
#define ACCEL_TABLE_CNT ( sizeof( accels ) / sizeof( wxAcceleratorEntry ) )
#define ACCEL_TABLE_CNT ( sizeof( accels ) / sizeof( wxAcceleratorEntry ) )
#define EXTRA_BORDER_SIZE 2
#define LIB_VIEW_FRAME_NAME wxT( "ViewlibFrame" )
#define LIB_VIEW_FRAME_NAME wxT( "ViewlibFrame" )
LIB_VIEW_FRAME
::
LIB_VIEW_FRAME
(
SCH_BASE_FRAME
*
aParent
,
CMP_LIBRARY
*
aLibrary
,
LIB_VIEW_FRAME
::
LIB_VIEW_FRAME
(
SCH_BASE_FRAME
*
aParent
,
CMP_LIBRARY
*
aLibrary
,
...
@@ -117,13 +111,13 @@ LIB_VIEW_FRAME::LIB_VIEW_FRAME( SCH_BASE_FRAME* aParent, CMP_LIBRARY* aLibrary,
...
@@ -117,13 +111,13 @@ LIB_VIEW_FRAME::LIB_VIEW_FRAME( SCH_BASE_FRAME* aParent, CMP_LIBRARY* aLibrary,
SetIcon
(
icon
);
SetIcon
(
icon
);
m_HotkeysZoomAndGridList
=
s_Viewlib_Hokeys_Descr
;
m_HotkeysZoomAndGridList
=
s_Viewlib_Hokeys_Descr
;
m_CmpList
=
NULL
;
m_cmpList
=
NULL
;
m_LibList
=
NULL
;
m_libList
=
NULL
;
m_LibListWindow
=
NULL
;
m_semaphore
=
aSemaphore
;
m_CmpListWindow
=
NULL
;
m_Semaphore
=
aSemaphore
;
if
(
m_semaphore
)
if
(
m_Semaphore
)
SetModalMode
(
true
);
SetModalMode
(
true
);
m_exportToEeschemaCmpName
.
Empty
();
m_exportToEeschemaCmpName
.
Empty
();
SetScreen
(
new
SCH_SCREEN
()
);
SetScreen
(
new
SCH_SCREEN
()
);
...
@@ -142,23 +136,13 @@ LIB_VIEW_FRAME::LIB_VIEW_FRAME( SCH_BASE_FRAME* aParent, CMP_LIBRARY* aLibrary,
...
@@ -142,23 +136,13 @@ LIB_VIEW_FRAME::LIB_VIEW_FRAME( SCH_BASE_FRAME* aParent, CMP_LIBRARY* aLibrary,
wxSize
size
=
GetClientSize
();
wxSize
size
=
GetClientSize
();
size
.
y
-=
m_MsgFrameHeight
+
2
;
size
.
y
-=
m_MsgFrameHeight
+
2
;
m_LibListSize
.
y
=
-
1
;
wxPoint
win_pos
(
0
,
0
);
wxPoint
win_pos
(
0
,
0
);
if
(
aLibrary
==
NULL
)
if
(
aLibrary
==
NULL
)
{
{
// Creates the libraries window display
// Creates the libraries window display
m_LibListWindow
=
m_libList
=
new
wxListBox
(
this
,
ID_LIBVIEW_LIB_LIST
,
new
wxSashLayoutWindow
(
this
,
ID_LIBVIEW_LIBWINDOW
,
win_pos
,
wxPoint
(
0
,
0
),
wxSize
(
m_libListWidth
,
-
1
),
wxDefaultSize
,
wxCLIP_CHILDREN
|
wxSW_3D
,
wxT
(
"LibWindow"
)
);
m_LibListWindow
->
SetOrientation
(
wxLAYOUT_VERTICAL
);
m_LibListWindow
->
SetAlignment
(
wxLAYOUT_LEFT
);
m_LibListWindow
->
SetSashVisible
(
wxSASH_RIGHT
,
true
);
m_LibListWindow
->
SetExtraBorderSize
(
EXTRA_BORDER_SIZE
);
m_LibList
=
new
wxListBox
(
m_LibListWindow
,
ID_LIBVIEW_LIB_LIST
,
wxPoint
(
0
,
0
),
wxDefaultSize
,
0
,
NULL
,
wxLB_HSCROLL
);
0
,
NULL
,
wxLB_HSCROLL
);
}
}
else
else
...
@@ -167,25 +151,16 @@ LIB_VIEW_FRAME::LIB_VIEW_FRAME( SCH_BASE_FRAME* aParent, CMP_LIBRARY* aLibrary,
...
@@ -167,25 +151,16 @@ LIB_VIEW_FRAME::LIB_VIEW_FRAME( SCH_BASE_FRAME* aParent, CMP_LIBRARY* aLibrary,
m_entryName
.
Clear
();
m_entryName
.
Clear
();
m_unit
=
1
;
m_unit
=
1
;
m_convert
=
1
;
m_convert
=
1
;
m_
LibListSize
.
x
=
0
;
m_
libListWidth
=
0
;
}
}
// Creates the component window display
// Creates the component window display
m_CmpListSize
.
y
=
size
.
y
;
win_pos
.
x
=
m_libListWidth
;
win_pos
.
x
=
m_LibListSize
.
x
;
m_cmpList
=
new
wxListBox
(
this
,
ID_LIBVIEW_CMP_LIST
,
m_CmpListWindow
=
new
wxSashLayoutWindow
(
this
,
ID_LIBVIEW_CMPWINDOW
,
wxPoint
(
0
,
0
),
wxSize
(
m_cmpListWidth
,
-
1
),
win_pos
,
wxDefaultSize
,
wxCLIP_CHILDREN
|
wxSW_3D
,
wxT
(
"CmpWindow"
)
);
m_CmpListWindow
->
SetOrientation
(
wxLAYOUT_VERTICAL
);
m_CmpListWindow
->
SetSashVisible
(
wxSASH_RIGHT
,
true
);
m_CmpListWindow
->
SetExtraBorderSize
(
EXTRA_BORDER_SIZE
);
m_CmpList
=
new
wxListBox
(
m_CmpListWindow
,
ID_LIBVIEW_CMP_LIST
,
wxPoint
(
0
,
0
),
wxDefaultSize
,
0
,
NULL
,
wxLB_HSCROLL
);
0
,
NULL
,
wxLB_HSCROLL
);
if
(
m_
L
ibList
)
if
(
m_
l
ibList
)
ReCreateListLib
();
ReCreateListLib
();
DisplayLibInfos
();
DisplayLibInfos
();
...
@@ -213,16 +188,14 @@ LIB_VIEW_FRAME::LIB_VIEW_FRAME( SCH_BASE_FRAME* aParent, CMP_LIBRARY* aLibrary,
...
@@ -213,16 +188,14 @@ LIB_VIEW_FRAME::LIB_VIEW_FRAME( SCH_BASE_FRAME* aParent, CMP_LIBRARY* aLibrary,
m_auimgr
.
AddPane
(
m_mainToolBar
,
m_auimgr
.
AddPane
(
m_mainToolBar
,
wxAuiPaneInfo
(
horiz
).
Name
(
wxT
(
"m_mainToolBar"
)
).
Top
().
Row
(
0
)
);
wxAuiPaneInfo
(
horiz
).
Name
(
wxT
(
"m_mainToolBar"
)
).
Top
().
Row
(
0
)
);
wxSize
minsize
(
60
,
-
1
);
// Manage the left window (list of libraries)
// Manage the left window (list of libraries)
if
(
m_
LibListWindow
)
if
(
m_
libList
)
m_auimgr
.
AddPane
(
m_
LibListWindow
,
wxAuiPaneInfo
(
info
).
Name
(
wxT
(
"m_L
ibList"
)
).
m_auimgr
.
AddPane
(
m_
libList
,
wxAuiPaneInfo
(
info
).
Name
(
wxT
(
"m_l
ibList"
)
).
Left
().
Row
(
0
));
Left
().
Row
(
0
)
);
// Manage the list of components)
// Manage the list of components)
m_auimgr
.
AddPane
(
m_
CmpListWindow
,
m_auimgr
.
AddPane
(
m_
cmpList
,
wxAuiPaneInfo
(
info
).
Name
(
wxT
(
"m_
C
mpList"
)
).
wxAuiPaneInfo
(
info
).
Name
(
wxT
(
"m_
c
mpList"
)
).
Left
().
Row
(
1
)
);
Left
().
Row
(
1
)
);
// Manage the draw panel
// Manage the draw panel
...
@@ -236,13 +209,14 @@ LIB_VIEW_FRAME::LIB_VIEW_FRAME( SCH_BASE_FRAME* aParent, CMP_LIBRARY* aLibrary,
...
@@ -236,13 +209,14 @@ LIB_VIEW_FRAME::LIB_VIEW_FRAME( SCH_BASE_FRAME* aParent, CMP_LIBRARY* aLibrary,
/* Now the minimum windows are fixed, set library list
/* Now the minimum windows are fixed, set library list
* and component list of the previous values from last viewlib use
* and component list of the previous values from last viewlib use
*/
*/
if
(
m_
LibListWindow
)
if
(
m_
libList
)
{
{
wxAuiPaneInfo
&
pane
=
m_auimgr
.
GetPane
(
m_LibListWindow
);
m_auimgr
.
GetPane
(
m_libList
).
MinSize
(
wxSize
(
80
,
-
1
)
);
pane
.
MinSize
(
wxSize
(
m_LibListSize
.
x
,
-
1
)
);
m_auimgr
.
GetPane
(
m_libList
).
BestSize
(
wxSize
(
m_libListWidth
,
-
1
)
);
}
}
wxAuiPaneInfo
&
pane
=
m_auimgr
.
GetPane
(
m_CmpListWindow
);
pane
.
MinSize
(
wxSize
(
m_CmpListSize
.
x
,
-
1
));
m_auimgr
.
GetPane
(
m_cmpList
).
MinSize
(
wxSize
(
80
,
-
1
)
);
m_auimgr
.
GetPane
(
m_cmpList
).
BestSize
(
wxSize
(
m_cmpListWidth
,
-
1
)
);
m_auimgr
.
Update
();
m_auimgr
.
Update
();
...
@@ -278,9 +252,9 @@ void LIB_VIEW_FRAME::OnCloseWindow( wxCloseEvent& Event )
...
@@ -278,9 +252,9 @@ void LIB_VIEW_FRAME::OnCloseWindow( wxCloseEvent& Event )
{
{
SaveSettings
();
SaveSettings
();
if
(
m_
S
emaphore
)
if
(
m_
s
emaphore
)
{
{
m_
S
emaphore
->
Post
();
m_
s
emaphore
->
Post
();
// This window will be destroyed by the calling function,
// This window will be destroyed by the calling function,
// if needed
// if needed
SetModalMode
(
false
);
SetModalMode
(
false
);
...
@@ -292,38 +266,6 @@ void LIB_VIEW_FRAME::OnCloseWindow( wxCloseEvent& Event )
...
@@ -292,38 +266,6 @@ void LIB_VIEW_FRAME::OnCloseWindow( wxCloseEvent& Event )
}
}
void
LIB_VIEW_FRAME
::
OnSashDrag
(
wxSashEvent
&
event
)
{
if
(
event
.
GetDragStatus
()
==
wxSASH_STATUS_OUT_OF_RANGE
)
return
;
m_LibListSize
.
y
=
GetClientSize
().
y
-
m_MsgFrameHeight
;
m_CmpListSize
.
y
=
m_LibListSize
.
y
;
switch
(
event
.
GetId
()
)
{
case
ID_LIBVIEW_LIBWINDOW
:
if
(
m_LibListWindow
)
{
wxAuiPaneInfo
&
pane
=
m_auimgr
.
GetPane
(
m_LibListWindow
);
m_LibListSize
.
x
=
event
.
GetDragRect
().
width
;
pane
.
MinSize
(
m_LibListSize
);
m_auimgr
.
Update
();
}
break
;
case
ID_LIBVIEW_CMPWINDOW
:
{
wxAuiPaneInfo
&
pane
=
m_auimgr
.
GetPane
(
m_CmpListWindow
);
m_CmpListSize
.
x
=
event
.
GetDragRect
().
width
;
pane
.
MinSize
(
m_CmpListSize
);
m_auimgr
.
Update
();
}
break
;
}
}
void
LIB_VIEW_FRAME
::
OnSize
(
wxSizeEvent
&
SizeEv
)
void
LIB_VIEW_FRAME
::
OnSize
(
wxSizeEvent
&
SizeEv
)
{
{
if
(
m_auimgr
.
GetManagedWindow
()
)
if
(
m_auimgr
.
GetManagedWindow
()
)
...
@@ -388,18 +330,18 @@ double LIB_VIEW_FRAME::BestZoom()
...
@@ -388,18 +330,18 @@ double LIB_VIEW_FRAME::BestZoom()
void
LIB_VIEW_FRAME
::
ReCreateListLib
()
void
LIB_VIEW_FRAME
::
ReCreateListLib
()
{
{
if
(
m_
L
ibList
==
NULL
)
if
(
m_
l
ibList
==
NULL
)
return
;
return
;
m_
L
ibList
->
Clear
();
m_
l
ibList
->
Clear
();
m_
L
ibList
->
Append
(
CMP_LIBRARY
::
GetLibraryNames
()
);
m_
l
ibList
->
Append
(
CMP_LIBRARY
::
GetLibraryNames
()
);
// Search for a previous selection:
// Search for a previous selection:
int
index
=
m_L
ibList
->
FindString
(
m_libraryName
);
int
index
=
m_l
ibList
->
FindString
(
m_libraryName
);
if
(
index
!=
wxNOT_FOUND
)
if
(
index
!=
wxNOT_FOUND
)
{
{
m_
L
ibList
->
SetSelection
(
index
,
true
);
m_
l
ibList
->
SetSelection
(
index
,
true
);
}
}
else
else
{
{
...
@@ -420,10 +362,10 @@ void LIB_VIEW_FRAME::ReCreateListLib()
...
@@ -420,10 +362,10 @@ void LIB_VIEW_FRAME::ReCreateListLib()
void
LIB_VIEW_FRAME
::
ReCreateListCmp
()
void
LIB_VIEW_FRAME
::
ReCreateListCmp
()
{
{
if
(
m_
C
mpList
==
NULL
)
if
(
m_
c
mpList
==
NULL
)
return
;
return
;
m_
C
mpList
->
Clear
();
m_
c
mpList
->
Clear
();
CMP_LIBRARY
*
Library
=
CMP_LIBRARY
::
FindLibrary
(
m_libraryName
);
CMP_LIBRARY
*
Library
=
CMP_LIBRARY
::
FindLibrary
(
m_libraryName
);
...
@@ -438,9 +380,9 @@ void LIB_VIEW_FRAME::ReCreateListCmp()
...
@@ -438,9 +380,9 @@ void LIB_VIEW_FRAME::ReCreateListCmp()
wxArrayString
nameList
;
wxArrayString
nameList
;
Library
->
GetEntryNames
(
nameList
);
Library
->
GetEntryNames
(
nameList
);
m_
C
mpList
->
Append
(
nameList
);
m_
c
mpList
->
Append
(
nameList
);
int
index
=
m_
C
mpList
->
FindString
(
m_entryName
);
int
index
=
m_
c
mpList
->
FindString
(
m_entryName
);
if
(
index
==
wxNOT_FOUND
)
if
(
index
==
wxNOT_FOUND
)
{
{
...
@@ -450,19 +392,19 @@ void LIB_VIEW_FRAME::ReCreateListCmp()
...
@@ -450,19 +392,19 @@ void LIB_VIEW_FRAME::ReCreateListCmp()
}
}
else
else
{
{
m_
C
mpList
->
SetSelection
(
index
,
true
);
m_
c
mpList
->
SetSelection
(
index
,
true
);
}
}
}
}
void
LIB_VIEW_FRAME
::
ClickOnLibList
(
wxCommandEvent
&
event
)
void
LIB_VIEW_FRAME
::
ClickOnLibList
(
wxCommandEvent
&
event
)
{
{
int
ii
=
m_
L
ibList
->
GetSelection
();
int
ii
=
m_
l
ibList
->
GetSelection
();
if
(
ii
<
0
)
if
(
ii
<
0
)
return
;
return
;
wxString
name
=
m_
L
ibList
->
GetString
(
ii
);
wxString
name
=
m_
l
ibList
->
GetString
(
ii
);
if
(
m_libraryName
==
name
)
if
(
m_libraryName
==
name
)
return
;
return
;
...
@@ -477,12 +419,12 @@ void LIB_VIEW_FRAME::ClickOnLibList( wxCommandEvent& event )
...
@@ -477,12 +419,12 @@ void LIB_VIEW_FRAME::ClickOnLibList( wxCommandEvent& event )
void
LIB_VIEW_FRAME
::
ClickOnCmpList
(
wxCommandEvent
&
event
)
void
LIB_VIEW_FRAME
::
ClickOnCmpList
(
wxCommandEvent
&
event
)
{
{
int
ii
=
m_
C
mpList
->
GetSelection
();
int
ii
=
m_
c
mpList
->
GetSelection
();
if
(
ii
<
0
)
if
(
ii
<
0
)
return
;
return
;
wxString
name
=
m_
C
mpList
->
GetString
(
ii
);
wxString
name
=
m_
c
mpList
->
GetString
(
ii
);
if
(
m_entryName
.
CmpNoCase
(
name
)
!=
0
)
if
(
m_entryName
.
CmpNoCase
(
name
)
!=
0
)
{
{
...
@@ -498,7 +440,7 @@ void LIB_VIEW_FRAME::ClickOnCmpList( wxCommandEvent& event )
...
@@ -498,7 +440,7 @@ void LIB_VIEW_FRAME::ClickOnCmpList( wxCommandEvent& event )
void
LIB_VIEW_FRAME
::
DClickOnCmpList
(
wxCommandEvent
&
event
)
void
LIB_VIEW_FRAME
::
DClickOnCmpList
(
wxCommandEvent
&
event
)
{
{
if
(
m_
S
emaphore
)
if
(
m_
s
emaphore
)
{
{
ExportToSchematicLibraryPart
(
event
);
ExportToSchematicLibraryPart
(
event
);
...
@@ -512,10 +454,10 @@ void LIB_VIEW_FRAME::DClickOnCmpList( wxCommandEvent& event )
...
@@ -512,10 +454,10 @@ void LIB_VIEW_FRAME::DClickOnCmpList( wxCommandEvent& event )
void
LIB_VIEW_FRAME
::
ExportToSchematicLibraryPart
(
wxCommandEvent
&
event
)
void
LIB_VIEW_FRAME
::
ExportToSchematicLibraryPart
(
wxCommandEvent
&
event
)
{
{
int
ii
=
m_
C
mpList
->
GetSelection
();
int
ii
=
m_
c
mpList
->
GetSelection
();
if
(
ii
>=
0
)
if
(
ii
>=
0
)
m_exportToEeschemaCmpName
=
m_
C
mpList
->
GetString
(
ii
);
m_exportToEeschemaCmpName
=
m_
c
mpList
->
GetString
(
ii
);
else
else
m_exportToEeschemaCmpName
.
Empty
();
m_exportToEeschemaCmpName
.
Empty
();
...
@@ -523,8 +465,8 @@ void LIB_VIEW_FRAME::ExportToSchematicLibraryPart( wxCommandEvent& event )
...
@@ -523,8 +465,8 @@ void LIB_VIEW_FRAME::ExportToSchematicLibraryPart( wxCommandEvent& event )
}
}
#define LIBLIST_WIDTH_KEY wxT( "
Liblist_w
idth" )
#define LIBLIST_WIDTH_KEY wxT( "
ViewLiblistW
idth" )
#define CMPLIST_WIDTH_KEY wxT( "
Cmplist_w
idth" )
#define CMPLIST_WIDTH_KEY wxT( "
ViewCmplistW
idth" )
void
LIB_VIEW_FRAME
::
LoadSettings
(
)
void
LIB_VIEW_FRAME
::
LoadSettings
(
)
...
@@ -536,18 +478,15 @@ void LIB_VIEW_FRAME::LoadSettings( )
...
@@ -536,18 +478,15 @@ void LIB_VIEW_FRAME::LoadSettings( )
wxConfigPathChanger
cpc
(
wxGetApp
().
GetSettings
(),
m_configPath
);
wxConfigPathChanger
cpc
(
wxGetApp
().
GetSettings
(),
m_configPath
);
cfg
=
wxGetApp
().
GetSettings
();
cfg
=
wxGetApp
().
GetSettings
();
m_LibListSize
.
x
=
150
;
// default width of libs list
cfg
->
Read
(
LIBLIST_WIDTH_KEY
,
&
m_libListWidth
,
100
);
m_CmpListSize
.
x
=
150
;
// default width of component list
cfg
->
Read
(
CMPLIST_WIDTH_KEY
,
&
m_cmpListWidth
,
100
);
cfg
->
Read
(
LIBLIST_WIDTH_KEY
,
&
m_LibListSize
.
x
);
cfg
->
Read
(
CMPLIST_WIDTH_KEY
,
&
m_CmpListSize
.
x
);
// Set parameters to a reasonable value.
// Set parameters to a reasonable value.
if
(
m_
LibListSize
.
x
>
m_FrameSize
.
x
/
2
)
if
(
m_
libListWidth
>
m_FrameSize
.
x
/
2
)
m_
LibListSize
.
x
=
m_FrameSize
.
x
/
2
;
m_
libListWidth
=
m_FrameSize
.
x
/
2
;
if
(
m_
CmpListSize
.
x
>
m_FrameSize
.
x
/
2
)
if
(
m_
cmpListWidth
>
m_FrameSize
.
x
/
2
)
m_
CmpListSize
.
x
=
m_FrameSize
.
x
/
2
;
m_
cmpListWidth
=
m_FrameSize
.
x
/
2
;
}
}
...
@@ -560,10 +499,14 @@ void LIB_VIEW_FRAME::SaveSettings()
...
@@ -560,10 +499,14 @@ void LIB_VIEW_FRAME::SaveSettings()
wxConfigPathChanger
cpc
(
wxGetApp
().
GetSettings
(),
m_configPath
);
wxConfigPathChanger
cpc
(
wxGetApp
().
GetSettings
(),
m_configPath
);
cfg
=
wxGetApp
().
GetSettings
();
cfg
=
wxGetApp
().
GetSettings
();
if
(
m_LibListSize
.
x
)
if
(
m_libListWidth
&&
m_libList
)
cfg
->
Write
(
LIBLIST_WIDTH_KEY
,
m_LibListSize
.
x
);
{
m_libListWidth
=
m_libList
->
GetSize
().
x
;
cfg
->
Write
(
LIBLIST_WIDTH_KEY
,
m_libListWidth
);
}
cfg
->
Write
(
CMPLIST_WIDTH_KEY
,
m_CmpListSize
.
x
);
m_cmpListWidth
=
m_cmpList
->
GetSize
().
x
;
cfg
->
Write
(
CMPLIST_WIDTH_KEY
,
m_cmpListWidth
);
}
}
...
@@ -575,7 +518,7 @@ void LIB_VIEW_FRAME::OnActivate( wxActivateEvent& event )
...
@@ -575,7 +518,7 @@ void LIB_VIEW_FRAME::OnActivate( wxActivateEvent& event )
if
(
m_FrameIsActive
)
if
(
m_FrameIsActive
)
m_exportToEeschemaCmpName
.
Empty
();
m_exportToEeschemaCmpName
.
Empty
();
if
(
m_
L
ibList
)
if
(
m_
l
ibList
)
ReCreateListLib
();
ReCreateListLib
();
DisplayLibInfos
();
DisplayLibInfos
();
...
...
This diff is collapsed.
Click to expand it.
eeschema/viewlib_frame.h
View file @
29446320
/*
/*
* This program source code file is part of KiCad, a free EDA CAD application.
* This program source code file is part of KiCad, a free EDA CAD application.
*
*
* Copyright (C) 20
04 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 20
14 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2008-201
1
Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 2008-201
4
Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 2004-201
1
KiCad Developers, see change_log.txt for contributors.
* Copyright (C) 2004-201
4
KiCad Developers, see change_log.txt for contributors.
*
*
* This program is free software; you can redistribute it and/or
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* modify it under the terms of the GNU General Public License
...
@@ -48,20 +48,18 @@ class CMP_LIBRARY;
...
@@ -48,20 +48,18 @@ class CMP_LIBRARY;
class
LIB_VIEW_FRAME
:
public
SCH_BASE_FRAME
class
LIB_VIEW_FRAME
:
public
SCH_BASE_FRAME
{
{
private
:
private
:
wxComboBox
*
S
elpartBox
;
wxComboBox
*
m_s
elpartBox
;
// List of libraries (for selection )
// List of libraries (for selection )
wxSashLayoutWindow
*
m_LibListWindow
;
wxListBox
*
m_libList
;
// The list of libs
wxListBox
*
m_LibList
;
// The list of libs
int
m_libListWidth
;
// Last width of the window
wxSize
m_LibListSize
;
// size of the window
// List of components in the selected library
// List of components in the selected library
wxSashLayoutWindow
*
m_CmpListWindow
;
wxListBox
*
m_cmpList
;
// The list of components
wxListBox
*
m_CmpList
;
// The list of components
int
m_cmpListWidth
;
// Last width of the window
wxSize
m_CmpListSize
;
// size of the window
// Flags
// Flags
wxSemaphore
*
m_
S
emaphore
;
// != NULL if the frame must emulate a modal dialog
wxSemaphore
*
m_
s
emaphore
;
// != NULL if the frame must emulate a modal dialog
wxString
m_configPath
;
// subpath for configuration
wxString
m_configPath
;
// subpath for configuration
protected
:
protected
:
...
@@ -95,12 +93,6 @@ public:
...
@@ -95,12 +93,6 @@ public:
void
OnSize
(
wxSizeEvent
&
event
);
void
OnSize
(
wxSizeEvent
&
event
);
/**
* Function OnSashDrag
* resizes the child windows when dragging a sash window border.
*/
void
OnSashDrag
(
wxSashEvent
&
event
);
/**
/**
* Function ReCreateListLib
* Function ReCreateListLib
*
*
...
...
This diff is collapsed.
Click to expand it.
eeschema/viewlibs.cpp
View file @
29446320
...
@@ -70,7 +70,7 @@ void LIB_VIEW_FRAME::Process_Special_Functions( wxCommandEvent& event )
...
@@ -70,7 +70,7 @@ void LIB_VIEW_FRAME::Process_Special_Functions( wxCommandEvent& event )
break
;
break
;
case
ID_LIBVIEW_SELECT_PART_NUMBER
:
case
ID_LIBVIEW_SELECT_PART_NUMBER
:
ii
=
S
elpartBox
->
GetCurrentSelection
();
ii
=
m_s
elpartBox
->
GetCurrentSelection
();
if
(
ii
<
0
)
if
(
ii
<
0
)
return
;
return
;
m_unit
=
ii
+
1
;
m_unit
=
ii
+
1
;
...
@@ -132,16 +132,16 @@ void LIB_VIEW_FRAME::SelectCurrentLibrary()
...
@@ -132,16 +132,16 @@ void LIB_VIEW_FRAME::SelectCurrentLibrary()
m_libraryName
=
Lib
->
GetName
();
m_libraryName
=
Lib
->
GetName
();
DisplayLibInfos
();
DisplayLibInfos
();
if
(
m_
L
ibList
)
if
(
m_
l
ibList
)
{
{
ReCreateListCmp
();
ReCreateListCmp
();
m_canvas
->
Refresh
();
m_canvas
->
Refresh
();
DisplayLibInfos
();
DisplayLibInfos
();
ReCreateHToolbar
();
ReCreateHToolbar
();
int
id
=
m_
L
ibList
->
FindString
(
m_libraryName
.
GetData
()
);
int
id
=
m_
l
ibList
->
FindString
(
m_libraryName
.
GetData
()
);
if
(
id
>=
0
)
if
(
id
>=
0
)
m_
L
ibList
->
SetSelection
(
id
);
m_
l
ibList
->
SetSelection
(
id
);
}
}
}
}
}
}
...
@@ -234,11 +234,11 @@ void LIB_VIEW_FRAME::ViewOneLibraryContent( CMP_LIBRARY* Lib, int Flag )
...
@@ -234,11 +234,11 @@ void LIB_VIEW_FRAME::ViewOneLibraryContent( CMP_LIBRARY* Lib, int Flag )
Zoom_Automatique
(
false
);
Zoom_Automatique
(
false
);
m_canvas
->
Refresh
(
);
m_canvas
->
Refresh
(
);
if
(
m_
C
mpList
)
if
(
m_
c
mpList
)
{
{
int
id
=
m_
C
mpList
->
FindString
(
m_entryName
.
GetData
()
);
int
id
=
m_
c
mpList
->
FindString
(
m_entryName
.
GetData
()
);
if
(
id
>=
0
)
if
(
id
>=
0
)
m_
C
mpList
->
SetSelection
(
id
);
m_
c
mpList
->
SetSelection
(
id
);
}
}
ReCreateHToolbar
();
ReCreateHToolbar
();
}
}
...
...
This diff is collapsed.
Click to expand it.
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