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
43afa81a
Commit
43afa81a
authored
May 29, 2013
by
jean-pierre charras
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Kicad template selector dialog: add info line showing the template path in use.
parent
5560cb54
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
279 additions
and
67 deletions
+279
-67
dialog_template_selector.cpp
kicad/dialogs/dialog_template_selector.cpp
+18
-5
dialog_template_selector.fbp
kicad/dialogs/dialog_template_selector.fbp
+177
-3
dialog_template_selector.h
kicad/dialogs/dialog_template_selector.h
+8
-5
dialog_template_selector_base.cpp
kicad/dialogs/dialog_template_selector_base.cpp
+45
-32
dialog_template_selector_base.h
kicad/dialogs/dialog_template_selector_base.h
+31
-22
No files found.
kicad/dialogs/dialog_template_selector.cpp
View file @
43afa81a
...
...
@@ -28,10 +28,12 @@
#include <wx/settings.h>
TEMPLATE_SELECTION_PANEL
::
TEMPLATE_SELECTION_PANEL
(
wxWindow
*
aParent
)
:
TEMPLATE_SELECTION_PANEL
::
TEMPLATE_SELECTION_PANEL
(
wxWindow
*
aParent
,
const
wxString
&
aPath
)
:
TEMPLATE_SELECTION_PANEL_BASE
(
aParent
)
{
parent
=
aParent
;
m_templatesPath
=
aPath
;
}
...
...
@@ -127,6 +129,13 @@ void DIALOG_TEMPLATE_SELECTOR::onNotebookResize(wxSizeEvent& event)
event
.
Skip
();
}
void
DIALOG_TEMPLATE_SELECTOR
::
OnPageChange
(
wxNotebookEvent
&
event
)
{
int
page
=
m_notebook
->
GetSelection
();
if
(
page
!=
wxNOT_FOUND
)
m_textCtrlTemplatePath
->
SetValue
(
m_panels
[
page
]
->
GetPath
()
);
}
DIALOG_TEMPLATE_SELECTOR
::
DIALOG_TEMPLATE_SELECTOR
(
wxWindow
*
aParent
)
:
DIALOG_TEMPLATE_SELECTOR_BASE
(
aParent
)
...
...
@@ -186,15 +195,19 @@ void DIALOG_TEMPLATE_SELECTOR::AddPage( const wxString& aTitle, wxFileName& aPat
wxNotebookPage
*
newPage
=
new
wxNotebookPage
(
m_notebook
,
wxID_ANY
);
m_notebook
->
AddPage
(
newPage
,
aTitle
);
TEMPLATE_SELECTION_PANEL
*
p
=
new
TEMPLATE_SELECTION_PANEL
(
newPage
);
m_panels
.
push_back
(
p
);
wxString
path
=
aPath
.
GetFullPath
();
// caller ensures this ends with file separator.
TEMPLATE_SELECTION_PANEL
*
tpanel
=
new
TEMPLATE_SELECTION_PANEL
(
newPage
,
path
);
m_panels
.
push_back
(
tpanel
);
if
(
m_notebook
->
GetPageCount
()
==
1
)
m_textCtrlTemplatePath
->
SetValue
(
path
);
// Get a list of files under the template path to include as choices...
wxArrayString
files
;
wxDir
dir
;
wxString
path
=
aPath
.
GetFullPath
();
// caller ensures this ends with file separator.
if
(
dir
.
Open
(
path
)
)
{
wxDir
sub_dir
;
...
...
kicad/dialogs/dialog_template_selector.fbp
View file @
43afa81a
This diff is collapsed.
Click to expand it.
kicad/dialogs/dialog_template_selector.h
View file @
43afa81a
...
...
@@ -60,13 +60,16 @@ class TEMPLATE_SELECTION_PANEL : public TEMPLATE_SELECTION_PANEL_BASE
{
protected
:
wxWindow
*
parent
;
wxString
m_templatesPath
;
public
:
/**
* @param aParent The window creating the dialog
*/
TEMPLATE_SELECTION_PANEL
(
wxWindow
*
aParent
);
TEMPLATE_SELECTION_PANEL
(
wxWindow
*
aParent
,
const
wxString
&
aPath
);
~
TEMPLATE_SELECTION_PANEL
();
const
wxString
&
GetPath
()
{
return
m_templatesPath
;
}
};
class
DIALOG_TEMPLATE_SELECTOR
:
public
DIALOG_TEMPLATE_SELECTOR_BASE
...
...
@@ -81,15 +84,15 @@ public:
~
DIALOG_TEMPLATE_SELECTOR
();
/**
* Add a new page with \a aTitle, populated with templates from \a aPath
- All directories
* directories under the path are treated as templates
* Add a new page with \a aTitle, populated with templates from \a aPath
*
- All
directories under the path are treated as templates
*/
void
AddPage
(
const
wxString
&
aTitle
,
wxFileName
&
aPath
);
void
SetHtml
(
wxFileName
aFilename
);
TEMPLATE_WIDGET
*
GetWidget
();
void
SetWidget
(
TEMPLATE_WIDGET
*
aWidget
);
void
onNotebookResize
(
wxSizeEvent
&
event
);
void
onNotebookResize
(
wxSizeEvent
&
event
);
void
OnPageChange
(
wxNotebookEvent
&
event
);
};
#endif
kicad/dialogs/dialog_template_selector_base.cpp
View file @
43afa81a
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version
Apr 10
2012)
// C++ code generated with wxFormBuilder (version
Oct 8
2012)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
...
...
@@ -12,52 +12,65 @@
DIALOG_TEMPLATE_SELECTOR_BASE
::
DIALOG_TEMPLATE_SELECTOR_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
(
wxSize
(
640
,
480
),
wxDefaultSize
);
wxBoxSizer
*
b
Sizer1
;
b
Sizer1
=
new
wxBoxSizer
(
wxVERTICAL
);
wxBoxSizer
*
b
mainSizer
;
b
mainSizer
=
new
wxBoxSizer
(
wxVERTICAL
);
m_notebook
=
new
wxNotebook
(
this
,
wxID_ANY
,
wxDefaultPosition
,
wxDefaultSize
,
0
);
b
Sizer1
->
Add
(
m_notebook
,
0
,
wxEXPAND
|
wxALL
,
3
);
b
mainSizer
->
Add
(
m_notebook
,
0
,
wxEXPAND
|
wxALL
,
3
);
m_htmlWin
=
new
wxHtmlWindow
(
this
,
wxID_ANY
,
wxDefaultPosition
,
wxSize
(
-
1
,
-
1
),
wxHW_SCROLLBAR_AUTO
);
bSizer1
->
Add
(
m_htmlWin
,
1
,
wxALL
|
wxEXPAND
,
3
);
m_sdbSizer1
=
new
wxStdDialogButtonSizer
();
m_sdbSizer1OK
=
new
wxButton
(
this
,
wxID_OK
);
m_sdbSizer1
->
AddButton
(
m_sdbSizer1OK
);
m_sdbSizer1Cancel
=
new
wxButton
(
this
,
wxID_CANCEL
);
m_sdbSizer1
->
AddButton
(
m_sdbSizer1Cancel
);
m_sdbSizer1
->
Realize
();
bSizer1
->
Add
(
m_sdbSizer1
,
0
,
wxALL
|
wxEXPAND
,
3
);
this
->
SetSizer
(
bSizer1
);
bmainSizer
->
Add
(
m_htmlWin
,
1
,
wxALL
|
wxEXPAND
,
3
);
m_staticTextTpath
=
new
wxStaticText
(
this
,
wxID_ANY
,
wxT
(
"Templates path"
),
wxDefaultPosition
,
wxDefaultSize
,
0
);
m_staticTextTpath
->
Wrap
(
-
1
);
bmainSizer
->
Add
(
m_staticTextTpath
,
0
,
wxRIGHT
|
wxLEFT
,
5
);
m_textCtrlTemplatePath
=
new
wxTextCtrl
(
this
,
wxID_ANY
,
wxEmptyString
,
wxDefaultPosition
,
wxDefaultSize
,
wxTE_READONLY
);
bmainSizer
->
Add
(
m_textCtrlTemplatePath
,
0
,
wxEXPAND
|
wxBOTTOM
|
wxRIGHT
|
wxLEFT
,
5
);
m_sdbSizer
=
new
wxStdDialogButtonSizer
();
m_sdbSizerOK
=
new
wxButton
(
this
,
wxID_OK
);
m_sdbSizer
->
AddButton
(
m_sdbSizerOK
);
m_sdbSizerCancel
=
new
wxButton
(
this
,
wxID_CANCEL
);
m_sdbSizer
->
AddButton
(
m_sdbSizerCancel
);
m_sdbSizer
->
Realize
();
bmainSizer
->
Add
(
m_sdbSizer
,
0
,
wxALL
|
wxEXPAND
,
3
);
this
->
SetSizer
(
bmainSizer
);
this
->
Layout
();
this
->
Centre
(
wxBOTH
);
// Connect Events
m_notebook
->
Connect
(
wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED
,
wxNotebookEventHandler
(
DIALOG_TEMPLATE_SELECTOR_BASE
::
OnPageChange
),
NULL
,
this
);
}
DIALOG_TEMPLATE_SELECTOR_BASE
::~
DIALOG_TEMPLATE_SELECTOR_BASE
()
{
// Disconnect Events
m_notebook
->
Disconnect
(
wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED
,
wxNotebookEventHandler
(
DIALOG_TEMPLATE_SELECTOR_BASE
::
OnPageChange
),
NULL
,
this
);
}
TEMPLATE_SELECTION_PANEL_BASE
::
TEMPLATE_SELECTION_PANEL_BASE
(
wxWindow
*
parent
,
wxWindowID
id
,
const
wxPoint
&
pos
,
const
wxSize
&
size
,
long
style
)
:
wxPanel
(
parent
,
id
,
pos
,
size
,
style
)
{
m_SizerBase
=
new
wxBoxSizer
(
wxHORIZONTAL
);
m_scrolledWindow1
=
new
wxScrolledWindow
(
this
,
wxID_ANY
,
wxDefaultPosition
,
wxDefaultSize
,
wxHSCROLL
);
m_scrolledWindow1
->
SetScrollRate
(
5
,
5
);
m_SizerChoice
=
new
wxBoxSizer
(
wxHORIZONTAL
);
m_scrolledWindow1
->
SetSizer
(
m_SizerChoice
);
m_scrolledWindow1
->
Layout
();
m_SizerChoice
->
Fit
(
m_scrolledWindow1
);
m_SizerBase
->
Add
(
m_scrolledWindow1
,
0
,
wxEXPAND
|
wxALL
,
3
);
this
->
SetSizer
(
m_SizerBase
);
this
->
Layout
();
}
...
...
@@ -70,18 +83,18 @@ TEMPLATE_WIDGET_BASE::TEMPLATE_WIDGET_BASE( wxWindow* parent, wxWindowID id, con
{
this
->
SetMinSize
(
wxSize
(
74
,
-
1
)
);
this
->
SetMaxSize
(
wxSize
(
74
,
-
1
)
);
wxBoxSizer
*
bSizer4
;
bSizer4
=
new
wxBoxSizer
(
wxVERTICAL
);
m_bitmapIcon
=
new
wxStaticBitmap
(
this
,
wxID_ANY
,
wxNullBitmap
,
wxDefaultPosition
,
wxSize
(
64
,
64
),
0
);
bSizer4
->
Add
(
m_bitmapIcon
,
0
,
wxALIGN_CENTER_HORIZONTAL
|
wxALL
|
wxEXPAND
,
3
);
m_staticTitle
=
new
wxStaticText
(
this
,
wxID_ANY
,
wxT
(
"Project Template Title"
),
wxDefaultPosition
,
wxDefaultSize
,
wxALIGN_CENTRE
);
m_staticTitle
->
Wrap
(
150
);
bSizer4
->
Add
(
m_staticTitle
,
1
,
wxALIGN_CENTER_HORIZONTAL
|
wxALL
|
wxEXPAND
,
3
);
this
->
SetSizer
(
bSizer4
);
this
->
Layout
();
}
...
...
kicad/dialogs/dialog_template_selector_base.h
View file @
43afa81a
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version
Apr 10
2012)
// C++ code generated with wxFormBuilder (version
Oct 8
2012)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
...
...
@@ -10,6 +10,8 @@
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
class
DIALOG_SHIM
;
#include "dialog_shim.h"
#include <wx/gdicmn.h>
#include <wx/notebook.h>
...
...
@@ -18,6 +20,8 @@
#include <wx/settings.h>
#include <wx/string.h>
#include <wx/html/htmlwin.h>
#include <wx/stattext.h>
#include <wx/textctrl.h>
#include <wx/sizer.h>
#include <wx/button.h>
#include <wx/dialog.h>
...
...
@@ -27,7 +31,6 @@
#include <wx/image.h>
#include <wx/icon.h>
#include <wx/statbmp.h>
#include <wx/stattext.h>
///////////////////////////////////////////////////////////////////////////
...
...
@@ -38,56 +41,62 @@
class
DIALOG_TEMPLATE_SELECTOR_BASE
:
public
DIALOG_SHIM
{
private
:
protected
:
wxNotebook
*
m_notebook
;
wxHtmlWindow
*
m_htmlWin
;
wxStdDialogButtonSizer
*
m_sdbSizer1
;
wxButton
*
m_sdbSizer1OK
;
wxButton
*
m_sdbSizer1Cancel
;
wxStaticText
*
m_staticTextTpath
;
wxTextCtrl
*
m_textCtrlTemplatePath
;
wxStdDialogButtonSizer
*
m_sdbSizer
;
wxButton
*
m_sdbSizerOK
;
wxButton
*
m_sdbSizerCancel
;
// Virtual event handlers, overide them in your derived class
virtual
void
OnPageChange
(
wxNotebookEvent
&
event
)
{
event
.
Skip
();
}
public
:
DIALOG_TEMPLATE_SELECTOR_BASE
(
wxWindow
*
parent
,
wxWindowID
id
=
wxID_ANY
,
const
wxString
&
title
=
wxT
(
"Project Template Selector"
),
const
wxPoint
&
pos
=
wxDefaultPosition
,
const
wxSize
&
size
=
wxSize
(
640
,
480
),
long
style
=
wxDEFAULT_DIALOG_STYLE
|
wxRESIZE_BORDER
);
DIALOG_TEMPLATE_SELECTOR_BASE
(
wxWindow
*
parent
,
wxWindowID
id
=
wxID_ANY
,
const
wxString
&
title
=
wxT
(
"Project Template Selector"
),
const
wxPoint
&
pos
=
wxDefaultPosition
,
const
wxSize
&
size
=
wxSize
(
640
,
480
),
long
style
=
wxDEFAULT_DIALOG_STYLE
|
wxRESIZE_BORDER
);
~
DIALOG_TEMPLATE_SELECTOR_BASE
();
};
///////////////////////////////////////////////////////////////////////////////
/// Class TEMPLATE_SELECTION_PANEL_BASE
///////////////////////////////////////////////////////////////////////////////
class
TEMPLATE_SELECTION_PANEL_BASE
:
public
wxPanel
class
TEMPLATE_SELECTION_PANEL_BASE
:
public
wxPanel
{
private
:
protected
:
public
:
wxBoxSizer
*
m_SizerBase
;
wxScrolledWindow
*
m_scrolledWindow1
;
wxBoxSizer
*
m_SizerChoice
;
TEMPLATE_SELECTION_PANEL_BASE
(
wxWindow
*
parent
,
wxWindowID
id
=
wxID_ANY
,
const
wxPoint
&
pos
=
wxDefaultPosition
,
const
wxSize
&
size
=
wxSize
(
-
1
,
140
),
long
style
=
wxNO_BORDER
|
wxTAB_TRAVERSAL
);
TEMPLATE_SELECTION_PANEL_BASE
(
wxWindow
*
parent
,
wxWindowID
id
=
wxID_ANY
,
const
wxPoint
&
pos
=
wxDefaultPosition
,
const
wxSize
&
size
=
wxSize
(
-
1
,
140
),
long
style
=
wxNO_BORDER
|
wxTAB_TRAVERSAL
);
~
TEMPLATE_SELECTION_PANEL_BASE
();
};
///////////////////////////////////////////////////////////////////////////////
/// Class TEMPLATE_WIDGET_BASE
///////////////////////////////////////////////////////////////////////////////
class
TEMPLATE_WIDGET_BASE
:
public
wxPanel
class
TEMPLATE_WIDGET_BASE
:
public
wxPanel
{
private
:
protected
:
wxStaticBitmap
*
m_bitmapIcon
;
wxStaticText
*
m_staticTitle
;
public
:
TEMPLATE_WIDGET_BASE
(
wxWindow
*
parent
,
wxWindowID
id
=
wxID_ANY
,
const
wxPoint
&
pos
=
wxDefaultPosition
,
const
wxSize
&
size
=
wxSize
(
74
,
-
1
),
long
style
=
wxTAB_TRAVERSAL
);
TEMPLATE_WIDGET_BASE
(
wxWindow
*
parent
,
wxWindowID
id
=
wxID_ANY
,
const
wxPoint
&
pos
=
wxDefaultPosition
,
const
wxSize
&
size
=
wxSize
(
74
,
-
1
),
long
style
=
wxTAB_TRAVERSAL
);
~
TEMPLATE_WIDGET_BASE
();
};
#endif //__DIALOG_TEMPLATE_SELECTOR_BASE_H__
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