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
9ef56278
Commit
9ef56278
authored
Feb 02, 2014
by
jean-pierre charras
Browse files
Options
Browse Files
Download
Plain Diff
Kicad manager: code cleaning (better use of wxaui manager). Fix a very minor bug.
parents
fa8cbd98
6f10d168
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
94 additions
and
127 deletions
+94
-127
info3d_visu.h
3d-viewer/info3d_visu.h
+0
-1
commandframe.cpp
kicad/commandframe.cpp
+15
-42
kicad.cpp
kicad/kicad.cpp
+1
-3
kicad.h
kicad/kicad.h
+24
-19
mainframe.cpp
kicad/mainframe.cpp
+53
-54
menubar.cpp
kicad/menubar.cpp
+0
-3
prjconfig.cpp
kicad/prjconfig.cpp
+1
-5
No files found.
3d-viewer/info3d_visu.h
View file @
9ef56278
...
...
@@ -30,7 +30,6 @@
#ifndef __INFO3D_VISU_H__
#define __INFO3D_VISU_H__
//#include <wxBasePcbFrame.h>
#include <layers_id_colors_and_visibility.h> // Layers id definitions
#include <wx/glcanvas.h>
...
...
kicad/commandframe.cpp
View file @
9ef56278
...
...
@@ -35,58 +35,31 @@
#include <menus_helpers.h>
RIGHT_KM_FRAME
::
RIGHT_KM_FRAME
(
KICAD_MANAGER_FRAME
*
parent
)
:
wx
SashLayoutWindow
(
parent
,
wxID_ANY
)
LAUNCHER_PANEL
::
LAUNCHER_PANEL
(
wxWindow
*
parent
)
:
wx
Panel
(
parent
,
wxID_ANY
)
{
m_Parent
=
parent
;
m_MessagesBox
=
NULL
;
m_bitmapButtons_maxHeigth
=
0
;
m_
B
uttonSeparation
=
10
;
// control of command buttons position
m_
ButtonsListPosition
.
x
=
m_B
uttonSeparation
;
m_
ButtonsListPosition
.
y
=
m_B
uttonSeparation
;
m_
ButtonLastPosition
=
m_B
uttonsListPosition
;
m_
b
uttonSeparation
=
10
;
// control of command buttons position
m_
buttonsListPosition
.
x
=
m_b
uttonSeparation
;
m_
buttonsListPosition
.
y
=
m_b
uttonSeparation
;
m_
buttonLastPosition
=
m_b
uttonsListPosition
;
// Add bitmap buttons to launch KiCad utilities:
m_ButtPanel
=
new
wxPanel
(
this
,
wxID_ANY
);
CreateCommandToolbar
();
m_ButtonsPanelHeight
=
m_ButtonsListPosition
.
y
+
m_bitmapButtons_maxHeigth
+
m_ButtonSeparation
;
// Add the wxTextCtrl showing all messages from KiCad:
m_MessagesBox
=
new
wxTextCtrl
(
this
,
wxID_ANY
,
wxEmptyString
,
wxDefaultPosition
,
wxDefaultSize
,
wxTE_MULTILINE
|
wxSUNKEN_BORDER
|
wxTE_READONLY
);
}
void
RIGHT_KM_FRAME
::
OnSize
(
wxSizeEvent
&
event
)
int
LAUNCHER_PANEL
::
GetPanelHeight
()
const
{
#define EXTRA_MARGE 4
wxSize
wsize
;
wsize
.
x
=
GetClientSize
().
x
;
// Fix size of buttons area
wsize
.
y
=
m_ButtonsPanelHeight
;
m_ButtPanel
->
SetSize
(
wsize
);
// Fix position and size of the message area, below the buttons area
wsize
.
y
=
GetClientSize
().
y
-
m_ButtonsPanelHeight
;
m_MessagesBox
->
SetSize
(
wsize
);
m_MessagesBox
->
SetPosition
(
wxPoint
(
0
,
m_ButtonsPanelHeight
)
);
event
.
Skip
();
int
height
=
m_buttonsListPosition
.
y
+
m_bitmapButtons_maxHeigth
+
m_buttonSeparation
;
return
height
;
}
BEGIN_EVENT_TABLE
(
RIGHT_KM_FRAME
,
wxSashLayoutWindow
)
EVT_SIZE
(
RIGHT_KM_FRAME
::
OnSize
)
END_EVENT_TABLE
()
/**
* Function CreateCommandToolbar
* create the buttons to call Eeschema CvPcb, Pcbnew and GerbView
*/
void
RIGHT_KM_FRAME
::
CreateCommandToolbar
(
void
)
void
LAUNCHER_PANEL
::
CreateCommandToolbar
(
void
)
{
wxBitmapButton
*
btn
;
...
...
@@ -121,9 +94,9 @@ Creates a component (for Eeschema) or a footprint (for Pcbnew) that shows a B&W
* @param aId = the button id
* @param aBitmap = the wxBitmap used to create the button
*/
wxBitmapButton
*
RIGHT_KM_FRAME
::
AddBitmapButton
(
wxWindowID
aId
,
const
wxBitmap
&
aBitmap
)
wxBitmapButton
*
LAUNCHER_PANEL
::
AddBitmapButton
(
wxWindowID
aId
,
const
wxBitmap
&
aBitmap
)
{
wxPoint
buttPos
=
m_
B
uttonLastPosition
;
wxPoint
buttPos
=
m_
b
uttonLastPosition
;
wxSize
buttSize
;
int
btn_margin
=
10
;
// extra margin around the bitmap.
...
...
@@ -133,8 +106,8 @@ wxBitmapButton* RIGHT_KM_FRAME::AddBitmapButton( wxWindowID aId, const wxBitmap&
if
(
m_bitmapButtons_maxHeigth
<
buttSize
.
y
)
m_bitmapButtons_maxHeigth
=
buttSize
.
y
;
wxBitmapButton
*
btn
=
new
wxBitmapButton
(
m_ButtPanel
,
aId
,
aBitmap
,
buttPos
,
buttSize
);
m_
ButtonLastPosition
.
x
+=
buttSize
.
x
+
m_B
uttonSeparation
;
wxBitmapButton
*
btn
=
new
wxBitmapButton
(
this
,
aId
,
aBitmap
,
buttPos
,
buttSize
);
m_
buttonLastPosition
.
x
+=
buttSize
.
x
+
m_b
uttonSeparation
;
return
btn
;
}
kicad/kicad.cpp
View file @
9ef56278
...
...
@@ -77,9 +77,7 @@ void EDA_APP::MacOpenFile( const wxString &fileName )
frame
->
m_LeftWin
->
ReCreateTreePrj
();
frame
->
PrintMsg
(
_
(
"Working dir: "
)
+
frame
->
m_ProjectFileName
.
GetPath
()
+
_
(
"
\n
Project: "
)
+
frame
->
m_ProjectFileName
.
GetFullName
()
+
wxT
(
"
\n
"
)
);
frame
->
PrintPrjInfo
();
}
...
...
kicad/kicad.h
View file @
9ef56278
...
...
@@ -49,7 +49,7 @@
extern
const
wxString
g_KicadPrjFilenameExtension
;
class
RIGHT_KM_FRAME
;
class
LAUNCHER_PANEL
;
class
TREEPROJECTFILES
;
class
TREE_PROJECT_FRAME
;
...
...
@@ -123,14 +123,15 @@ class KICAD_MANAGER_FRAME : public EDA_BASE_FRAME
{
public
:
TREE_PROJECT_FRAME
*
m_LeftWin
;
RIGHT_KM_FRAME
*
m_RightWin
;
LAUNCHER_PANEL
*
m_Launcher
;
wxTextCtrl
*
m_MessagesBox
;
wxAuiToolBar
*
m_VToolBar
;
// Vertical toolbar (not used)
wxString
m_BoardFileName
;
wxString
m_SchematicRootFileName
;
wxFileName
m_ProjectFileName
;
private
:
int
m_
LeftWin_
Width
;
int
m_
leftWin
Width
;
public
:
KICAD_MANAGER_FRAME
(
wxWindow
*
parent
,
const
wxString
&
title
,
const
wxPoint
&
pos
,
const
wxSize
&
size
);
...
...
@@ -139,7 +140,6 @@ public: KICAD_MANAGER_FRAME( wxWindow* parent, const wxString& title,
void
OnCloseWindow
(
wxCloseEvent
&
Event
);
void
OnSize
(
wxSizeEvent
&
event
);
void
OnSashDrag
(
wxSashEvent
&
event
);
/**
* Function OnLoadProject
...
...
@@ -182,7 +182,18 @@ public: KICAD_MANAGER_FRAME( wxWindow* parent, const wxString& title,
*/
void
PrintMsg
(
const
wxString
&
aText
);
/**
* a minor helper function:
* Prints the Current Working Dir name and the projet name on the text panel.
*/
void
PrintPrjInfo
();
/**
* a minor helper function:
* Erase the text panel.
*/
void
ClearMsg
();
void
SetLanguage
(
wxCommandEvent
&
event
);
void
OnRefresh
(
wxCommandEvent
&
event
);
void
OnSelectDefaultPdfBrowser
(
wxCommandEvent
&
event
);
...
...
@@ -247,27 +258,23 @@ public: KICAD_MANAGER_FRAME( wxWindow* parent, const wxString& title,
};
/** class
RIGHT_KM_FRAME
/** class
LAUNCHER_PANEL
*/
class
RIGHT_KM_FRAME
:
public
wxSashLayoutWindow
class
LAUNCHER_PANEL
:
public
wxPanel
{
public
:
wxTextCtrl
*
m_MessagesBox
;
private
:
KICAD_MANAGER_FRAME
*
m_Parent
;
// a wxTextCtrl to displays messages frm KiCad
int
m_ButtonsPanelHeight
;
wxPanel
*
m_ButtPanel
;
int
m_ButtonSeparation
;
// button distance in pixels
wxPoint
m_ButtonsListPosition
;
/* position of the left bottom corner
int
m_buttonSeparation
;
// button distance in pixels
wxPoint
m_buttonsListPosition
;
/* position of the left bottom corner
* of the first bitmap button
*/
wxPoint
m_
B
uttonLastPosition
;
// position of the last button in the window
wxPoint
m_
b
uttonLastPosition
;
// position of the last button in the window
int
m_bitmapButtons_maxHeigth
;
// height of bigger bitmap buttons
// Used to calculate the height of the panel.
public
:
RIGHT_KM_FRAME
(
KICAD_MANAGER_FRAME
*
parent
);
~
RIGHT_KM_FRAME
()
{
};
void
OnSize
(
wxSizeEvent
&
event
);
public
:
LAUNCHER_PANEL
(
wxWindow
*
parent
);
~
LAUNCHER_PANEL
()
{
};
int
GetPanelHeight
()
const
;
private
:
...
...
@@ -278,8 +285,6 @@ private:
void
CreateCommandToolbar
(
void
);
wxBitmapButton
*
AddBitmapButton
(
wxWindowID
aId
,
const
wxBitmap
&
aBitmap
);
DECLARE_EVENT_TABLE
()
};
#endif
kicad/mainframe.cpp
View file @
9ef56278
...
...
@@ -32,6 +32,7 @@
#include <appl_wxstruct.h>
#include <confirm.h>
#include <gestfich.h>
#include <macros.h>
#include <kicad.h>
#include <tree_project_frame.h>
...
...
@@ -41,30 +42,14 @@
static
const
wxString
TreeFrameWidthEntry
(
wxT
(
"LeftWinWidth"
)
);
#define KICAD_MANAGER_FRAME_NAME wxT( "KicadFrame" )
KICAD_MANAGER_FRAME
::
KICAD_MANAGER_FRAME
(
wxWindow
*
parent
,
const
wxString
&
title
,
const
wxPoint
&
pos
,
const
wxSize
&
size
)
:
EDA_BASE_FRAME
(
parent
,
KICAD_MAIN_FRAME_TYPE
,
title
,
pos
,
size
,
KICAD_DEFAULT_DRAWFRAME_STYLE
,
KICAD_MANAGER_FRAME_NAME
)
KICAD_DEFAULT_DRAWFRAME_STYLE
,
wxT
(
"KicadFrame"
)
)
{
wxString
msg
;
wxString
line
;
wxSize
clientsize
;
m_FrameName
=
KICAD_MANAGER_FRAME_NAME
;
m_VToolBar
=
NULL
;
// No Vertical tooolbar used here
m_LeftWin
=
NULL
;
// A shashwindow that contains the project tree
m_RightWin
=
NULL
;
/* A shashwindow that contains the buttons
* and the window display text
*/
m_LeftWin_Width
=
std
::
max
(
60
,
GetSize
().
x
/
3
);
LoadSettings
();
SetSize
(
m_FramePos
.
x
,
m_FramePos
.
y
,
m_FrameSize
.
x
,
m_FrameSize
.
y
);
m_leftWinWidth
=
60
;
// Create the status line (bottom of the frame
static
const
int
dims
[
3
]
=
{
-
1
,
-
1
,
100
};
...
...
@@ -77,42 +62,48 @@ KICAD_MANAGER_FRAME::KICAD_MANAGER_FRAME( wxWindow* parent,
icon
.
CopyFromBitmap
(
KiBitmap
(
icon_kicad_xpm
)
);
SetIcon
(
icon
);
clientsize
=
GetClientSize
();
// Give the last sise and pos to main window
LoadSettings
();
SetSize
(
m_FramePos
.
x
,
m_FramePos
.
y
,
m_FrameSize
.
x
,
m_FrameSize
.
y
);
// Left window: is the box which display tree project
m_LeftWin
=
new
TREE_PROJECT_FRAME
(
this
);
//
Bottom Window: box to display message
s
m_
RightWin
=
new
RIGHT_KM_FRAME
(
this
);
m
sg
=
wxGetCwd
();
line
.
Printf
(
_
(
"Ready
\n
Working dir: %s
\n
"
),
msg
.
GetData
()
);
PrintMsg
(
line
);
//
Right top Window: buttons to launch application
s
m_
Launcher
=
new
LAUNCHER_PANEL
(
this
);
// Add the wxTextCtrl showing all messages from KiCad:
m
_MessagesBox
=
new
wxTextCtrl
(
this
,
wxID_ANY
,
wxEmptyString
,
wxDefaultPosition
,
wxDefaultSize
,
wxTE_MULTILINE
|
wxSUNKEN_BORDER
|
wxTE_READONLY
);
RecreateBaseHToolbar
();
ReCreateMenuBar
();
m_auimgr
.
SetManagedWindow
(
this
);
EDA_PANEINFO
horiz
;
horiz
.
HorizontalToolbarPane
();
EDA_PANEINFO
horiz
tb
;
horiz
tb
.
HorizontalToolbarPane
();
EDA_PANEINFO
info
;
info
.
InfoToolbarPane
();
if
(
m_mainToolBar
)
m_auimgr
.
AddPane
(
m_mainToolBar
,
wxAuiPaneInfo
(
horiz
).
Name
(
wxT
(
"m_mainToolBar"
)
).
Top
().
Layer
(
1
)
);
m_auimgr
.
AddPane
(
m_mainToolBar
,
wxAuiPaneInfo
(
horiztb
).
Name
(
wxT
(
"m_mainToolBar"
)
).
Top
()
);
m_auimgr
.
AddPane
(
m_LeftWin
,
wxAuiPaneInfo
(
info
).
Name
(
wxT
(
"m_LeftWin"
)
).
Left
().
BestSize
(
m_leftWinWidth
,
-
1
).
Layer
(
1
)
);
if
(
m_RightWin
)
m_auimgr
.
AddPane
(
m_RightWin
,
wxAuiPaneInfo
().
Name
(
wxT
(
"m_RightWin"
)
).
CentrePane
().
Layer
(
1
)
);
m_auimgr
.
AddPane
(
m_Launcher
,
wxTOP
);
m_auimgr
.
GetPane
(
m_Launcher
).
CaptionVisible
(
false
).
Row
(
1
)
.
BestSize
(
-
1
,
m_Launcher
->
GetPanelHeight
()
).
PaneBorder
(
false
).
Resizable
(
false
);
if
(
m_LeftWin
)
m_auimgr
.
AddPane
(
m_LeftWin
,
wxAuiPaneInfo
(
info
).
Name
(
wxT
(
"m_LeftWin"
)
).
Left
().
BestSize
(
m_LeftWin_Width
,
clientsize
.
y
).
Layer
(
1
)
);
m_auimgr
.
AddPane
(
m_MessagesBox
,
wxAuiPaneInfo
().
Name
(
wxT
(
"m_MessagesBox"
)
).
CentrePane
().
Layer
(
2
)
);
m_auimgr
.
GetPane
(
m_LeftWin
).
MinSize
(
wxSize
(
80
,
-
1
)
);
m_auimgr
.
GetPane
(
m_LeftWin
).
BestSize
(
wxSize
(
m_leftWinWidth
,
-
1
)
);
m_auimgr
.
Update
();
}
...
...
@@ -126,13 +117,7 @@ KICAD_MANAGER_FRAME::~KICAD_MANAGER_FRAME()
void
KICAD_MANAGER_FRAME
::
PrintMsg
(
const
wxString
&
aText
)
{
m_RightWin
->
m_MessagesBox
->
AppendText
(
aText
);
}
void
KICAD_MANAGER_FRAME
::
OnSashDrag
(
wxSashEvent
&
event
)
{
event
.
Skip
();
m_MessagesBox
->
AppendText
(
aText
);
}
...
...
@@ -324,28 +309,42 @@ void KICAD_MANAGER_FRAME::OnRefresh( wxCommandEvent& event )
void
KICAD_MANAGER_FRAME
::
ClearMsg
()
{
m_
RightWin
->
m_
MessagesBox
->
Clear
();
m_MessagesBox
->
Clear
();
}
void
KICAD_MANAGER_FRAME
::
LoadSettings
()
{
wxASSERT
(
wxGetApp
().
GetSettings
()
!=
NULL
);
wxConfig
*
cfg
=
wxGetApp
().
GetSettings
();
EDA_BASE_FRAME
::
LoadSettings
();
cfg
->
Read
(
TreeFrameWidthEntry
,
&
m_LeftWin_Width
);
if
(
cfg
)
{
EDA_BASE_FRAME
::
LoadSettings
();
cfg
->
Read
(
TreeFrameWidthEntry
,
&
m_leftWinWidth
);
}
}
void
KICAD_MANAGER_FRAME
::
SaveSettings
()
{
wxASSERT
(
wxGetApp
().
GetSettings
()
!=
NULL
);
wxConfig
*
cfg
=
wxGetApp
().
GetSettings
();
EDA_BASE_FRAME
::
SaveSettings
();
if
(
cfg
)
{
EDA_BASE_FRAME
::
SaveSettings
();
cfg
->
Write
(
TreeFrameWidthEntry
,
m_LeftWin
->
GetSize
().
x
);
}
}
cfg
->
Write
(
TreeFrameWidthEntry
,
m_LeftWin
->
GetSize
().
x
);
/**
* a minor helper function:
* Prints the Current Working Dir name and the projet name on the text panel.
*/
void
KICAD_MANAGER_FRAME
::
PrintPrjInfo
()
{
wxString
msg
;
msg
.
Printf
(
_
(
"Working dir: %s
\n
Project: %s
\n
"
),
GetChars
(
wxGetCwd
()
),
GetChars
(
m_ProjectFileName
.
GetFullPath
()
)
);
PrintMsg
(
msg
);
}
kicad/menubar.cpp
View file @
9ef56278
...
...
@@ -39,9 +39,6 @@ BEGIN_EVENT_TABLE( KICAD_MANAGER_FRAME, EDA_BASE_FRAME )
EVT_SIZE
(
KICAD_MANAGER_FRAME
::
OnSize
)
EVT_CLOSE
(
KICAD_MANAGER_FRAME
::
OnCloseWindow
)
/* Sash drag events */
EVT_SASH_DRAGGED
(
ID_LEFT_FRAME
,
KICAD_MANAGER_FRAME
::
OnSashDrag
)
/* Toolbar events */
EVT_TOOL
(
ID_NEW_PROJECT
,
KICAD_MANAGER_FRAME
::
OnLoadProject
)
EVT_TOOL
(
ID_NEW_PROJECT_FROM_TEMPLATE
,
KICAD_MANAGER_FRAME
::
OnLoadProject
)
...
...
kicad/prjconfig.cpp
View file @
9ef56278
...
...
@@ -281,11 +281,7 @@ void KICAD_MANAGER_FRAME::OnLoadProject( wxCommandEvent& event )
wxPostEvent
(
this
,
cmd
);
#endif
wxString
msg
;
msg
.
Format
(
_
(
"Working dir: <%s>
\n
Project: <%s>
\n
"
),
GetChars
(
m_ProjectFileName
.
GetPath
()
),
GetChars
(
m_ProjectFileName
.
GetFullName
()
)
);
PrintMsg
(
msg
);
PrintPrjInfo
();
}
...
...
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