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
1f3f11ca
Commit
1f3f11ca
authored
Jul 20, 2013
by
jean-pierre charras
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add margin values control in pl_editor, and remove margin definition from class PAGE_INFO.
parent
50743cf3
Changes
31
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
31 changed files
with
5752 additions
and
4432 deletions
+5752
-4432
class_page_info.cpp
common/class_page_info.cpp
+0
-23
common_plot_functions.cpp
common/common_plot_functions.cpp
+0
-11
drawpanel.cpp
common/drawpanel.cpp
+5
-4
hotkeys_basic.cpp
common/hotkeys_basic.cpp
+2
-2
class_worksheet_dataitem.cpp
common/page_layout/class_worksheet_dataitem.cpp
+1
-1
class_worksheet_layout.cpp
common/page_layout/class_worksheet_layout.cpp
+30
-0
page_layout_default_description.cpp
common/page_layout/page_layout_default_description.cpp
+2
-1
page_layout_reader.cpp
common/page_layout/page_layout_reader.cpp
+24
-3
page_layout_reader.keywords
common/page_layout/page_layout_reader.keywords
+4
-0
title_block_shapes.cpp
common/page_layout/title_block_shapes.cpp
+8
-4
title_block_shapes_gost.cpp
common/page_layout/title_block_shapes_gost.cpp
+2
-2
appl_wxstruct.h
include/appl_wxstruct.h
+2
-1
common.h
include/common.h
+0
-54
worksheet_shape_builder.h
include/worksheet_shape_builder.h
+16
-1
dialogs_for_printing.cpp
pagelayout_editor/dialogs/dialogs_for_printing.cpp
+17
-6
properties_frame_base.cpp
pagelayout_editor/dialogs/properties_frame_base.cpp
+243
-150
properties_frame_base.fbp
pagelayout_editor/dialogs/properties_frame_base.fbp
+5124
-4008
properties_frame_base.h
pagelayout_editor/dialogs/properties_frame_base.h
+33
-17
events_functions.cpp
pagelayout_editor/events_functions.cpp
+1
-3
files.cpp
pagelayout_editor/files.cpp
+6
-10
hotkeys.cpp
pagelayout_editor/hotkeys.cpp
+38
-18
menubar.cpp
pagelayout_editor/menubar.cpp
+14
-21
page_layout_writer.cpp
pagelayout_editor/page_layout_writer.cpp
+12
-0
pl_editor.cpp
pagelayout_editor/pl_editor.cpp
+10
-3
pl_editor_config.cpp
pagelayout_editor/pl_editor_config.cpp
+20
-0
pl_editor_frame.cpp
pagelayout_editor/pl_editor_frame.cpp
+22
-0
pl_editor_frame.h
pagelayout_editor/pl_editor_frame.h
+6
-0
properties_frame.cpp
pagelayout_editor/properties_frame.cpp
+72
-24
properties_frame.h
pagelayout_editor/properties_frame.h
+6
-0
pagelayout.kicad_wks
template/pagelayout.kicad_wks
+0
-34
pagelayout_default.kicad_wks
template/pagelayout_default.kicad_wks
+32
-31
No files found.
common/class_page_info.cpp
View file @
1f3f11ca
...
...
@@ -126,25 +126,6 @@ inline void PAGE_INFO::updatePortrait()
}
void
PAGE_INFO
::
setMargins
()
{
if
(
IsGOST
()
)
{
m_left_margin
=
Mm2mils
(
20
);
// 20mm
m_right_margin
=
// 5mm
m_top_margin
=
// 5mm
m_bottom_margin
=
Mm2mils
(
5
);
// 5mm
}
else
{
m_left_margin
=
m_right_margin
=
m_top_margin
=
m_bottom_margin
=
Mm2mils
(
10
);
}
}
PAGE_INFO
::
PAGE_INFO
(
const
wxSize
&
aSizeMils
,
const
wxString
&
aType
,
wxPaperSize
aPaperId
)
:
m_type
(
aType
),
m_size
(
aSizeMils
),
...
...
@@ -152,8 +133,6 @@ PAGE_INFO::PAGE_INFO( const wxSize& aSizeMils, const wxString& aType, wxPaperSiz
{
updatePortrait
();
setMargins
();
// This constructor is protected, and only used by const PAGE_INFO's known
// only to class implementation, so no further changes to "this" object are
// expected. Therefore we should also setMargin() again when copying this
...
...
@@ -222,8 +201,6 @@ bool PAGE_INFO::SetType( const wxString& aType, bool IsPortrait )
updatePortrait
();
}
setMargins
();
return
rc
;
}
...
...
common/common_plot_functions.cpp
View file @
1f3f11ca
...
...
@@ -77,15 +77,6 @@ void PlotWorkSheet( PLOTTER* plotter, const TITLE_BLOCK& aTitleBlock,
/* Note: Page sizes values are given in mils
*/
double
iusPerMil
=
plotter
->
GetIUsPerDecimil
()
*
10.0
;
wxSize
pageSize
=
aPageInfo
.
GetSizeMils
();
// in mils
wxPoint
LTmargin
;
LTmargin
.
x
=
aPageInfo
.
GetLeftMarginMils
()
*
iusPerMil
;
LTmargin
.
y
=
aPageInfo
.
GetTopMarginMils
()
*
iusPerMil
;
wxPoint
RBmargin
;
RBmargin
.
x
=
aPageInfo
.
GetRightMarginMils
()
*
iusPerMil
;
RBmargin
.
y
=
aPageInfo
.
GetBottomMarginMils
()
*
iusPerMil
;
EDA_COLOR_T
plotColor
=
plotter
->
GetColorMode
()
?
RED
:
BLACK
;
plotter
->
SetColor
(
plotColor
);
...
...
@@ -96,10 +87,8 @@ void PlotWorkSheet( PLOTTER* plotter, const TITLE_BLOCK& aTitleBlock,
wxFileName
fn
(
aFilename
);
// Prepare plot parameters
drawList
.
SetMargins
(
LTmargin
,
RBmargin
);
drawList
.
SetPenSize
(
PLOTTER
::
DEFAULT_LINE_WIDTH
);
drawList
.
SetMilsToIUfactor
(
iusPerMil
);
drawList
.
SetPageSize
(
pageSize
);
drawList
.
SetSheetNumber
(
aSheetNumber
);
drawList
.
SetSheetCount
(
aNumberOfSheets
);
drawList
.
SetFileName
(
fn
.
GetFullName
()
);
// Print only the short filename
...
...
common/drawpanel.cpp
View file @
1f3f11ca
...
...
@@ -563,13 +563,14 @@ void EDA_DRAW_PANEL::ReDraw( wxDC* DC, bool erasebg )
g_GhostColor
=
WHITE
;
}
if
(
erasebg
)
EraseScreen
(
DC
);
GRResetPenAndBrush
(
DC
);
DC
->
SetBackground
(
*
wxBLACK
_BRUSH
);
DC
->
SetBackground
(
g_DrawBgColor
==
BLACK
?
*
wxBLACK_BRUSH
:
*
wxWHITE
_BRUSH
);
DC
->
SetBackgroundMode
(
wxSOLID
);
if
(
erasebg
)
EraseScreen
(
DC
);
GetParent
()
->
RedrawActiveWindow
(
DC
,
erasebg
);
// Verfies that the clipping is working correctly. If these two sets of numbers are
...
...
common/hotkeys_basic.cpp
View file @
1f3f11ca
...
...
@@ -682,7 +682,7 @@ void EDA_BASE_FRAME::ImportHotkeyConfigFromFile( struct EDA_HOTKEY_CONFIG* aDesc
wxString
ext
=
DEFAULT_HOTKEY_FILENAME_EXT
;
wxString
mask
=
wxT
(
"*."
)
+
ext
;
wxString
path
=
wxGetCwd
();
wxString
filename
;
wxString
filename
=
wxGetApp
().
GetAppName
()
+
wxT
(
"."
)
+
ext
;
filename
=
EDA_FileSelector
(
_
(
"Read Hotkey Configuration File:"
),
path
,
...
...
@@ -710,7 +710,7 @@ void EDA_BASE_FRAME::ExportHotkeyConfigToFile( struct EDA_HOTKEY_CONFIG* aDescLi
wxString
ext
=
DEFAULT_HOTKEY_FILENAME_EXT
;
wxString
mask
=
wxT
(
"*."
)
+
ext
;
wxString
path
=
wxGetCwd
();
wxString
filename
;
wxString
filename
=
wxGetApp
().
GetAppName
()
+
wxT
(
"."
)
+
ext
;
filename
=
EDA_FileSelector
(
_
(
"Write Hotkey Configuration File:"
),
path
,
...
...
common/page_layout/class_worksheet_dataitem.cpp
View file @
1f3f11ca
...
...
@@ -72,7 +72,7 @@ double WORKSHEET_DATAITEM::m_DefaultTextThickness = 0.0;
bool
WORKSHEET_DATAITEM
::
m_SpecialMode
=
false
;
EDA_COLOR_T
WORKSHEET_DATAITEM
::
m_Color
=
RED
;
// the default color to draw items
EDA_COLOR_T
WORKSHEET_DATAITEM
::
m_AltColor
=
RED
;
// an alternate color to draw items
EDA_COLOR_T
WORKSHEET_DATAITEM
::
m_SelectedColor
=
YELLOW
;
// the color to draw selected items
EDA_COLOR_T
WORKSHEET_DATAITEM
::
m_SelectedColor
=
BROWN
;
// the color to draw selected items
// The constructor:
WORKSHEET_DATAITEM
::
WORKSHEET_DATAITEM
(
WS_ItemType
aType
)
...
...
common/page_layout/class_worksheet_layout.cpp
View file @
1f3f11ca
...
...
@@ -61,6 +61,36 @@
// It is accessible by WORKSHEET_LAYOUT::GetTheInstance()
WORKSHEET_LAYOUT
wksTheInstance
;
WORKSHEET_LAYOUT
::
WORKSHEET_LAYOUT
()
{
m_allowVoidList
=
false
;
m_leftMargin
=
10.0
;
// the left page margin in mm
m_rightMargin
=
10.0
;
// the right page margin in mm
m_topMargin
=
10.0
;
// the top page margin in mm
m_bottomMargin
=
10.0
;
// the bottom page margin in mm
}
void
WORKSHEET_LAYOUT
::
SetLeftMargin
(
double
aMargin
)
{
m_leftMargin
=
aMargin
;
// the left page margin in mm
}
void
WORKSHEET_LAYOUT
::
SetRightMargin
(
double
aMargin
)
{
m_rightMargin
=
aMargin
;
// the right page margin in mm
}
void
WORKSHEET_LAYOUT
::
SetTopMargin
(
double
aMargin
)
{
m_topMargin
=
aMargin
;
// the top page margin in mm
}
void
WORKSHEET_LAYOUT
::
SetBottomMargin
(
double
aMargin
)
{
m_bottomMargin
=
aMargin
;
// the bottom page margin in mm
}
void
WORKSHEET_LAYOUT
::
ClearList
()
{
for
(
unsigned
ii
=
0
;
ii
<
m_list
.
size
();
ii
++
)
...
...
common/page_layout/page_layout_default_description.cpp
View file @
1f3f11ca
...
...
@@ -167,7 +167,8 @@ extern const char defaultPageLayout[];
// Default page layout (sizes are in mm)
const
char
defaultPageLayout
[]
=
"( page_layout
\n
"
"(setup (textsize 1.5 1.5) (linewidth 0.15) (textlinewidth 0.15) )"
"(setup (textsize 1.5 1.5) (linewidth 0.15) (textlinewidth 0.15)
\n
"
"(left_margin 10)(right_margin 10)(top_margin 10)(bottom_margin 10))
\n
"
"(rect (comment
\"
rect around the title block
\"
) (linewidth 0.15) (start 110 34) (end 2 2) )
\n
"
"(rect (start 0 0 ltcorner) (end 0 0 rbcorner) (repeat 2) (incrx 2) (incry 2) )
\n
"
"(line (start 50 2 ltcorner) (end 50 0 ltcorner) (repeat 30) (incrx 50) )
\n
"
...
...
common/page_layout/page_layout_reader.cpp
View file @
1f3f11ca
...
...
@@ -69,7 +69,7 @@ private:
*/
double
parseDouble
();
void
parseSetup
()
throw
(
IO_ERROR
,
PARSE_ERROR
);
void
parseSetup
(
WORKSHEET_LAYOUT
*
aLayout
)
throw
(
IO_ERROR
,
PARSE_ERROR
);
void
parseGraphic
(
WORKSHEET_DATAITEM
*
aItem
)
throw
(
IO_ERROR
,
PARSE_ERROR
);
void
parseText
(
WORKSHEET_DATAITEM_TEXT
*
aItem
)
throw
(
IO_ERROR
,
PARSE_ERROR
);
void
parsePolygon
(
WORKSHEET_DATAITEM_POLYPOLYGON
*
aItem
)
...
...
@@ -110,7 +110,7 @@ void PAGE_LAYOUT_READER_PARSER::Parse( WORKSHEET_LAYOUT* aLayout )
switch
(
token
)
{
case
T_setup
:
// Defines default values for graphic items
parseSetup
();
parseSetup
(
aLayout
);
break
;
case
T_line
:
...
...
@@ -145,7 +145,8 @@ void PAGE_LAYOUT_READER_PARSER::Parse( WORKSHEET_LAYOUT* aLayout )
}
}
void
PAGE_LAYOUT_READER_PARSER
::
parseSetup
()
throw
(
IO_ERROR
,
PARSE_ERROR
)
void
PAGE_LAYOUT_READER_PARSER
::
parseSetup
(
WORKSHEET_LAYOUT
*
aLayout
)
throw
(
IO_ERROR
,
PARSE_ERROR
)
{
T
token
;
while
(
(
token
=
NextTok
()
)
!=
T_RIGHT
)
...
...
@@ -174,6 +175,26 @@ void PAGE_LAYOUT_READER_PARSER::parseSetup() throw( IO_ERROR, PARSE_ERROR )
NeedRIGHT
();
break
;
case
T_left_margin
:
aLayout
->
SetLeftMargin
(
parseDouble
()
);
NeedRIGHT
();
break
;
case
T_right_margin
:
aLayout
->
SetRightMargin
(
parseDouble
()
);
NeedRIGHT
();
break
;
case
T_top_margin
:
aLayout
->
SetTopMargin
(
parseDouble
()
);
NeedRIGHT
();
break
;
case
T_bottom_margin
:
aLayout
->
SetBottomMargin
(
parseDouble
()
);
NeedRIGHT
();
break
;
default
:
Unexpected
(
CurText
()
);
break
;
...
...
common/page_layout/page_layout_reader.keywords
View file @
1f3f11ca
page_layout
setup
left_margin
right_margin
top_margin
bottom_margin
linewidth
textlinewidth
textsize
...
...
common/page_layout/title_block_shapes.cpp
View file @
1f3f11ca
...
...
@@ -67,17 +67,21 @@ void WS_DRAW_ITEM_LIST::BuildWorkSheetGraphicList(
EDA_COLOR_T
aColor
,
EDA_COLOR_T
aAltColor
)
{
#define milsTomm (25.4/1000)
#define mmTomils (1000/25.4)
m_titleBlock
=
&
aTitleBlock
;
m_paperFormat
=
&
aPageInfo
.
GetType
();
wxPoint
LTmargin
(
aPageInfo
.
GetLeftMarginMils
(),
aPageInfo
.
GetTopMarginMils
()
);
wxPoint
RBmargin
(
aPageInfo
.
GetRightMarginMils
(),
aPageInfo
.
GetBottomMarginMils
()
);
WORKSHEET_LAYOUT
&
pglayout
=
WORKSHEET_LAYOUT
::
GetTheInstance
();
wxPoint
LTmargin
(
Mm2mils
(
pglayout
.
GetLeftMargin
()
),
Mm2mils
(
pglayout
.
GetTopMargin
()
)
);
wxPoint
RBmargin
(
Mm2mils
(
pglayout
.
GetRightMargin
()
),
Mm2mils
(
pglayout
.
GetBottomMargin
()
)
);
SetMargins
(
LTmargin
,
RBmargin
);
SetPageSize
(
aPageInfo
.
GetSizeMils
()
);
WORKSHEET_LAYOUT
&
pglayout
=
WORKSHEET_LAYOUT
::
GetTheInstance
();
// Build the basic layout shape, if the layout list is empty
if
(
pglayout
.
GetCount
()
==
0
&&
!
pglayout
.
VoidListAllowed
()
)
pglayout
.
SetPageLayout
();
...
...
common/page_layout/title_block_shapes_gost.cpp
View file @
1f3f11ca
...
...
@@ -991,8 +991,8 @@ void WS_DRAW_ITEM_LIST::BuildWorkSheetGraphicList(
wxString
paperFormat
=
aPageInfo
.
GetType
();
WS_DRAW_ITEM_TEXT
*
gtext
;
wxPoint
LTmargin
(
aPageInfo
.
GetLeftMarginMils
(),
aPageInfo
.
GetTopMarginMils
(
)
);
wxPoint
RBmargin
(
aPageInfo
.
GetRightMarginMils
(),
aPageInfo
.
GetBottomMarginMils
(
)
);
wxPoint
LTmargin
(
Mm2mils
(
20
),
Mm2mils
(
5
)
);
wxPoint
RBmargin
(
Mm2mils
(
5
),
Mm2mils
(
5
)
);
SetMargins
(
LTmargin
,
RBmargin
);
SetPageSize
(
aPageInfo
.
GetSizeMils
()
);
...
...
include/appl_wxstruct.h
View file @
1f3f11ca
...
...
@@ -44,7 +44,8 @@ enum EDA_APP_T {
APP_PCBNEW_T
,
APP_CVPCB_T
,
APP_GERBVIEW_T
,
APP_KICAD_T
APP_KICAD_T
,
APP_PL_EDITOR_T
};
class
wxConfigBase
;
...
...
include/common.h
View file @
1f3f11ca
...
...
@@ -302,54 +302,6 @@ public:
const
wxSize
GetSizeIU
()
const
{
return
wxSize
(
GetWidthIU
(),
GetHeightIU
()
);
}
#endif
/**
* Function GetLeftMarginMils.
* @return int - logical page left margin in mils.
*/
int
GetLeftMarginMils
()
const
{
return
m_left_margin
;
}
/**
* Function GetLeftMarginMils.
* @return int - logical page right margin in mils.
*/
int
GetRightMarginMils
()
const
{
return
m_right_margin
;
}
/**
* Function GetLeftMarginMils.
* @return int - logical page top margin in mils.
*/
int
GetTopMarginMils
()
const
{
return
m_top_margin
;
}
/**
* Function GetBottomMarginMils.
* @return int - logical page bottom margin in mils.
*/
int
GetBottomMarginMils
()
const
{
return
m_bottom_margin
;
}
/**
* Function SetLeftMarginMils
* sets left page margin to @a aMargin in mils.
*/
void
SetLeftMarginMils
(
int
aMargin
)
{
m_left_margin
=
aMargin
;
}
/**
* Function SetRightMarginMils
* sets right page margin to @a aMargin in mils.
*/
void
SetRightMarginMils
(
int
aMargin
)
{
m_right_margin
=
aMargin
;
}
/**
* Function SetTopMarginMils
* sets top page margin to @a aMargin in mils.
*/
void
SetTopMarginMils
(
int
aMargin
)
{
m_top_margin
=
aMargin
;
}
/**
* Function SetBottomMarginMils
* sets bottom page margin to @a aMargin in mils.
*/
void
SetBottomMarginMils
(
int
aMargin
)
{
m_bottom_margin
=
aMargin
;
}
/**
* Function SetCustomWidthMils
* sets the width of Custom page in mils, for any custom page
...
...
@@ -429,12 +381,6 @@ private:
#define MIN_PAGE_SIZE 4000
#define MAX_PAGE_SIZE 48000
int
m_left_margin
;
int
m_right_margin
;
int
m_top_margin
;
int
m_bottom_margin
;
bool
m_portrait
;
///< true if portrait, false if landscape
wxPaperSize
m_paper_id
;
///< wx' style paper id.
...
...
include/worksheet_shape_builder.h
View file @
1f3f11ca
...
...
@@ -460,9 +460,13 @@ class WORKSHEET_LAYOUT
// will be loaded the first time
// WS_DRAW_ITEM_LIST::BuildWorkSheetGraphicList
// is run (useful mainly for page layout editor)
double
m_leftMargin
;
// the left page margin in mm
double
m_rightMargin
;
// the right page margin in mm
double
m_topMargin
;
// the top page margin in mm
double
m_bottomMargin
;
// the bottom page margin in mm
public
:
WORKSHEET_LAYOUT
()
{
m_allowVoidList
=
false
;
}
WORKSHEET_LAYOUT
()
;
~
WORKSHEET_LAYOUT
()
{
ClearList
();
}
/**
...
...
@@ -475,6 +479,17 @@ public:
return
wksTheInstance
;
}
// Accessors:
double
GetLeftMargin
()
{
return
m_leftMargin
;
}
double
GetRightMargin
()
{
return
m_rightMargin
;
}
double
GetTopMargin
()
{
return
m_topMargin
;
}
double
GetBottomMargin
()
{
return
m_bottomMargin
;
}
void
SetLeftMargin
(
double
aMargin
);
void
SetRightMargin
(
double
aMargin
);
void
SetTopMargin
(
double
aMargin
);
void
SetBottomMargin
(
double
aMargin
);
/**
* In Kicad applications, a page layout description is needed
* So if the list is empty, a default description is loaded,
...
...
pagelayout_editor/dialogs/dialogs_for_printing.cpp
View file @
1f3f11ca
...
...
@@ -63,12 +63,15 @@ public:
*/
class
PLEDITOR_PREVIEW_FRAME
:
public
wxPreviewFrame
{
PL_EDITOR_FRAME
*
m_parent
;
public
:
PLEDITOR_PREVIEW_FRAME
(
wxPrintPreview
*
aPreview
,
PL_EDITOR_FRAME
*
aParent
,
const
wxString
&
aTitle
,
const
wxPoint
&
aPos
=
wxDefaultPosition
,
const
wxSize
&
aSize
=
wxDefaultSize
)
:
wxPreviewFrame
(
aPreview
,
aParent
,
aTitle
,
aPos
,
aSize
)
{
m_parent
=
aParent
;
}
bool
Show
(
bool
show
)
// overload
...
...
@@ -79,10 +82,20 @@ public:
// If showing, use previous position and size.
if
(
show
)
{
ret
=
wxPreviewFrame
::
Show
(
show
);
bool
centre
=
false
;
if
(
s_size
.
x
==
0
||
s_size
.
y
==
0
)
{
s_size
=
(
m_parent
->
GetSize
()
*
3
)
/
4
;
s_pos
=
wxDefaultPosition
;
centre
=
true
;
}
if
(
s_size
.
x
!=
0
&&
s_size
.
y
!=
0
)
SetSize
(
s_pos
.
x
,
s_pos
.
y
,
s_size
.
x
,
s_size
.
y
,
0
);
if
(
centre
)
Center
();
ret
=
wxPreviewFrame
::
Show
(
show
);
}
else
{
...
...
@@ -191,7 +204,6 @@ void PLEDITOR_PRINTOUT::DrawPage( int aPageNum )
int
InvokeDialogPrint
(
PL_EDITOR_FRAME
*
aCaller
,
wxPrintData
*
aPrintData
,
wxPageSetupDialogData
*
aPageSetupData
)
{
PLEDITOR_PRINTOUT
dlg
(
aCaller
,
_
(
"Print Page Layout"
)
);
int
pageCount
=
2
;
wxPrintDialogData
printDialogData
(
*
aPrintData
);
...
...
@@ -224,12 +236,11 @@ int InvokeDialogPrintPreview( PL_EDITOR_FRAME* aCaller, wxPrintData* aPrintData
new
PLEDITOR_PRINTOUT
(
aCaller
,
title
),
aPrintData
);
preview
->
SetZoom
(
10
0
);
preview
->
SetZoom
(
7
0
);
PLEDITOR_PREVIEW_FRAME
*
frame
=
new
PLEDITOR_PREVIEW_FRAME
(
preview
,
aCaller
,
title
);
frame
->
Initialize
();
frame
->
Center
();
frame
->
Show
(
true
);
return
1
;
...
...
pagelayout_editor/dialogs/properties_frame_base.cpp
View file @
1f3f11ca
This diff is collapsed.
Click to expand it.
pagelayout_editor/dialogs/properties_frame_base.fbp
View file @
1f3f11ca
This diff is collapsed.
Click to expand it.
pagelayout_editor/dialogs/properties_frame_base.h
View file @
1f3f11ca
...
...
@@ -19,12 +19,16 @@
#include <wx/settings.h>
#include <wx/textctrl.h>
#include <wx/sizer.h>
#include <wx/statline.h>
#include <wx/button.h>
#include <wx/choice.h>
#include <wx/statline.h>
#include <wx/checkbox.h>
#include <wx/button.h>
#include <wx/combobox.h>
#include <wx/scrolwin.h>
#include <wx/bitmap.h>
#include <wx/image.h>
#include <wx/icon.h>
#include <wx/notebook.h>
#include <wx/panel.h>
///////////////////////////////////////////////////////////////////////////
...
...
@@ -37,19 +41,8 @@ class PANEL_PROPERTIES_BASE : public wxPanel
private
:
protected
:
wxScrolledWindow
*
m_scrolledLeftWindow
;
wxStaticText
*
m_staticTextDefVal
;
wxStaticText
*
m_staticTextDefTsX
;
wxTextCtrl
*
m_textCtrlDefaultTextSizeX
;
wxStaticText
*
m_staticTextDefTsY
;
wxTextCtrl
*
m_textCtrlDefaultTextSizeY
;
wxStaticText
*
m_staticTextDefLineW
;
wxTextCtrl
*
m_textCtrlDefaultLineWidth
;
wxStaticText
*
m_staticText22
;
wxTextCtrl
*
m_textCtrlDefaultTextThickness
;
wxStaticLine
*
m_staticline7
;
wxButton
*
m_buttonOK
;
wxStaticLine
*
m_staticline8
;
wxNotebook
*
m_notebook
;
wxScrolledWindow
*
m_swItemProperties
;
wxStaticText
*
m_staticTextType
;
wxTextCtrl
*
m_textCtrlType
;
wxStaticText
*
m_staticTextPageOpt
;
...
...
@@ -74,6 +67,8 @@ class PANEL_PROPERTIES_BASE : public wxPanel
wxStaticText
*
m_staticTextConstraintY
;
wxTextCtrl
*
m_textCtrlConstraintY
;
wxStaticLine
*
m_staticline6
;
wxButton
*
m_buttonOK
;
wxStaticLine
*
m_staticline8
;
wxStaticText
*
m_staticTextComment
;
wxTextCtrl
*
m_textCtrlComment
;
wxStaticLine
*
m_staticline2
;
...
...
@@ -108,7 +103,28 @@ class PANEL_PROPERTIES_BASE : public wxPanel
wxTextCtrl
*
m_textCtrlStepX
;
wxStaticText
*
m_staticTextStepY
;
wxTextCtrl
*
m_textCtrlStepY
;
wxStaticLine
*
m_staticline3
;
wxScrolledWindow
*
m_swGeneralOpts
;
wxStaticText
*
m_staticTextDefVal
;
wxStaticText
*
m_staticTextDefTsX
;
wxTextCtrl
*
m_textCtrlDefaultTextSizeX
;
wxStaticText
*
m_staticTextDefTsY
;
wxTextCtrl
*
m_textCtrlDefaultTextSizeY
;
wxStaticText
*
m_staticTextDefLineW
;
wxTextCtrl
*
m_textCtrlDefaultLineWidth
;
wxStaticText
*
m_staticText22
;
wxTextCtrl
*
m_textCtrlDefaultTextThickness
;
wxStaticLine
*
m_staticline9
;
wxStaticText
*
m_staticTextMargins
;
wxStaticText
*
m_staticTextLeftMargin
;
wxTextCtrl
*
m_textCtrlLeftMargin
;
wxStaticText
*
m_staticTextDefRightMargin
;
wxTextCtrl
*
m_textCtrlRightMargin
;
wxStaticText
*
m_staticTextTopMargin
;
wxTextCtrl
*
m_textCtrlTopMargin
;
wxStaticText
*
m_staticTextBottomMargin
;
wxTextCtrl
*
m_textCtrlDefaultBottomMargin
;
wxStaticLine
*
m_staticline10
;
wxButton
*
m_buttonGeneralOptsOK
;
// Virtual event handlers, overide them in your derived class
virtual
void
OnAcceptPrms
(
wxCommandEvent
&
event
)
{
event
.
Skip
();
}
...
...
@@ -116,7 +132,7 @@ class PANEL_PROPERTIES_BASE : public wxPanel
public
:
PANEL_PROPERTIES_BASE
(
wxWindow
*
parent
,
wxWindowID
id
=
wxID_ANY
,
const
wxPoint
&
pos
=
wxDefaultPosition
,
const
wxSize
&
size
=
wxSize
(
315
,
7
56
),
long
style
=
wxTAB_TRAVERSAL
);
PANEL_PROPERTIES_BASE
(
wxWindow
*
parent
,
wxWindowID
id
=
wxID_ANY
,
const
wxPoint
&
pos
=
wxDefaultPosition
,
const
wxSize
&
size
=
wxSize
(
315
,
7
39
),
long
style
=
wxTAB_TRAVERSAL
);
~
PANEL_PROPERTIES_BASE
();
};
...
...
pagelayout_editor/events_functions.cpp
View file @
1f3f11ca
...
...
@@ -49,12 +49,10 @@ BEGIN_EVENT_TABLE( PL_EDITOR_FRAME, EDA_DRAW_FRAME )
// menu Preferences
EVT_MENU_RANGE
(
ID_PREFERENCES_HOTKEY_START
,
ID_PREFERENCES_HOTKEY_END
,
PL_EDITOR_FRAME
::
Process_Config
)
EVT_MENU_RANGE
(
ID_LANGUAGE_CHOICE
,
ID_LANGUAGE_CHOICE_END
,
EDA_DRAW_FRAME
::
SetLanguage
)
// menu Postprocess
EVT_MENU
(
ID_MENU_PL_EDITOR_SELECT_PREFERED_EDITOR
,
EDA_BASE_FRAME
::
OnSelectPreferredEditor
)
EVT_MENU
(
wxID_PREFERENCES
,
PL_EDITOR_FRAME
::
Process_Config
)
// Menu Help
EVT_MENU
(
wxID_HELP
,
EDA_DRAW_FRAME
::
GetKicadHelp
)
...
...
pagelayout_editor/files.cpp
View file @
1f3f11ca
...
...
@@ -35,6 +35,7 @@
#include <worksheet_shape_builder.h>
#include <pl_editor_frame.h>
#include <properties_frame.h>
#include <pl_editor_id.h>
#include <wildcards_and_files_ext.h>
...
...
@@ -59,8 +60,8 @@ void PL_EDITOR_FRAME::OnFileHistory( wxCommandEvent& event )
msg
.
Printf
(
_
(
"File <%s> loaded"
),
GetChars
(
filename
)
);
SetStatusText
(
msg
);
}
RebuildDesignTree
();
m_canvas
->
Refresh
();
OnNewPageLayout
();
}
}
...
...
@@ -95,18 +96,14 @@ void PL_EDITOR_FRAME::Files_io( wxCommandEvent& event )
{
case
ID_LOAD_DEFAULT_PAGE_LAYOUT
:
pglayout
.
SetPageLayout
();
RebuildDesignTree
();
m_canvas
->
Refresh
();
GetScreen
()
->
ClrModify
();
OnNewPageLayout
();
break
;
case
wxID_NEW
:
pglayout
.
AllowVoidList
(
true
);
SetCurrFileName
(
wxEmptyString
);
pglayout
.
ClearList
();
RebuildDesignTree
();
m_canvas
->
Refresh
();
GetScreen
()
->
ClrModify
();
OnNewPageLayout
();
break
;
case
ID_OPEN_POLYGON_DESCR_FILE
:
...
...
@@ -153,8 +150,7 @@ void PL_EDITOR_FRAME::Files_io( wxCommandEvent& event )
}
else
{
RebuildDesignTree
();
m_canvas
->
Refresh
();
OnNewPageLayout
();
msg
.
Printf
(
_
(
"File <%s> loaded"
),
GetChars
(
filename
)
);
SetStatusText
(
msg
);
}
...
...
pagelayout_editor/hotkeys.cpp
View file @
1f3f11ca
/**
* @file gerbview/hotkeys.cpp
*/
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2013 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 1992-2013 KiCad Developers, see AUTHORS.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 <fctsys.h>
#include <common.h>
...
...
@@ -16,15 +39,13 @@
* add a new id in the enum hotkey_id_commnand like MY_NEW_ID_FUNCTION.
* add a new EDA_HOTKEY entry like:
* static EDA_HOTKEY HkMyNewEntry(wxT("Command Label"), MY_NEW_ID_FUNCTION, default key value);
* "Command Label" is the name used in hotkey list display, and the identifier in the
* hotkey list file MY_NEW_ID_FUNCTION is an equivalent id function used in the switch
* in OnHotKey() function. default key value is the default hotkey for this command.
* Can be overrided by the user hotkey list file add the HkMyNewEntry pointer in the
* s_board_edit_Hotkey_List list ( or/and the s_module_edit_Hotkey_List list) Add the
* new code in the switch in OnHotKey() function. when the variable PopupOn is true,
* an item is currently edited. This can be usefull if the new function cannot be
* executed while an item is currently being edited
* ( For example, one cannot start a new wire when a component is moving.)
* 'Command Label' is the name used in hotkey list display, and the identifier in the
* hotkey list file
* 'MY_NEW_ID_FUNCTION' is the id event function used in the switch in OnHotKey() function.
* 'Default key value' is the default hotkey for this command.
* Can be overrided by the user hotkey list
* Add the 'HkMyNewEntry' pointer in the s_PlEditor_Hotkey_List list
* Add the new code in the switch in OnHotKey() function.
*
* Note: If an hotkey is a special key, be sure the corresponding wxWidget keycode (WXK_XXXX)
* is handled in the hotkey_name_descr s_Hotkey_Name_List list (see hotkeys_basic.cpp)
...
...
@@ -41,13 +62,12 @@ static EDA_HOTKEY HkZoomRedraw( wxT( "Zoom Redraw" ), HK_ZOOM_REDRAW, WXK_F3
static
EDA_HOTKEY
HkZoomOut
(
wxT
(
"Zoom Out"
),
HK_ZOOM_OUT
,
WXK_F2
);
static
EDA_HOTKEY
HkZoomIn
(
wxT
(
"Zoom In"
),
HK_ZOOM_IN
,
WXK_F1
);
static
EDA_HOTKEY
HkHelp
(
wxT
(
"Help (this window)"
),
HK_HELP
,
'?'
);
static
EDA_HOTKEY
HkSwitchUnits
(
wxT
(
"Switch Units"
),
HK_SWITCH_UNITS
,
'U'
);
// List of common hotkey descriptors
EDA_HOTKEY
*
s_PlEditor_Hotkey_List
[]
=
{
&
HkHelp
,
&
HkZoomIn
,
&
HkZoomOut
,
&
HkZoomRedraw
,
&
HkZoomCenter
,
&
HkZoomAuto
,
&
Hk
SwitchUnits
,
&
Hk
ResetLocalCoord
,
&
HkZoomAuto
,
&
HkResetLocalCoord
,
NULL
};
...
...
@@ -61,16 +81,16 @@ struct EDA_HOTKEY_CONFIG s_PlEditor_Hokeys_Descr[] =
};
/*
* Function OnHotKey.
/* OnHotKey.
* ** Commands are case insensitive **
* Some commands are relative
s
to the item under the mouse cursor
* Some commands are relative to the item under the mouse cursor
* aDC = current device context
* aHotkeyCode = hotkey code (ascii or wxWidget code for special keys)
* aPosition The cursor position in logical (drawing) units.
* aItem = NULL or pointer on a EDA_ITEM under the mouse cursor
*/
void
PL_EDITOR_FRAME
::
OnHotKey
(
wxDC
*
aDC
,
int
aHotkeyCode
,
const
wxPoint
&
aPosition
,
EDA_ITEM
*
aItem
)
void
PL_EDITOR_FRAME
::
OnHotKey
(
wxDC
*
aDC
,
int
aHotkeyCode
,
const
wxPoint
&
aPosition
,
EDA_ITEM
*
aItem
)
{
wxCommandEvent
cmd
(
wxEVT_COMMAND_MENU_SELECTED
);
cmd
.
SetEventObject
(
this
);
...
...
pagelayout_editor/menubar.cpp
View file @
1f3f11ca
...
...
@@ -109,40 +109,34 @@ void PL_EDITOR_FRAME::ReCreateMenuBar( void )
_
(
"Quit Pl_Editor"
),
KiBitmap
(
exit_xpm
)
);
// Menu for
configuration and
preferences
wxMenu
*
config
Menu
=
new
wxMenu
;
// Menu for preferences
wxMenu
*
preferences
Menu
=
new
wxMenu
;
// Options (Preferences on WXMAC)
#ifdef __WXMAC__
config
Menu
->
Append
(
wxID_PREFERENCES
);
preferences
Menu
->
Append
(
wxID_PREFERENCES
);
#else
AddMenuItem
(
config
Menu
,
AddMenuItem
(
preferences
Menu
,
wxID_PREFERENCES
,
_
(
"&Options"
),
_
(
"Set options to draw items"
)
,
wxEmptyString
,
KiBitmap
(
preference_xpm
)
);
#endif // __WXMAC__
// Language submenu
wxGetApp
().
AddMenuLanguageList
(
configMenu
);
// Hotkey submenu
AddHotkeyConfigMenu
(
configMenu
);
// Menu miscellaneous
wxMenu
*
miscellaneousMenu
=
new
wxMenu
;
// Separator
miscellaneousMenu
->
AppendSeparator
();
// Text editor
AddMenuItem
(
miscellaneousMenu
,
// Text editor selection
AddMenuItem
(
preferencesMenu
,
ID_MENU_PL_EDITOR_SELECT_PREFERED_EDITOR
,
_
(
"&Text Editor"
),
_
(
"Select your preferred text editor"
),
KiBitmap
(
editor_xpm
)
);
// Language submenu
wxGetApp
().
AddMenuLanguageList
(
preferencesMenu
);
// Hotkey submenu
AddHotkeyConfigMenu
(
preferencesMenu
);
// Menu Help
wxMenu
*
helpMenu
=
new
wxMenu
;
...
...
@@ -165,8 +159,7 @@ void PL_EDITOR_FRAME::ReCreateMenuBar( void )
// Append menus to the menubar
menuBar
->
Append
(
fileMenu
,
_
(
"&File"
)
);
menuBar
->
Append
(
configMenu
,
_
(
"&Preferences"
)
);
menuBar
->
Append
(
miscellaneousMenu
,
_
(
"&Miscellaneous"
)
);
menuBar
->
Append
(
preferencesMenu
,
_
(
"&Preferences"
)
);
menuBar
->
Append
(
helpMenu
,
_
(
"&Help"
)
);
menuBar
->
Thaw
();
...
...
pagelayout_editor/page_layout_writer.cpp
View file @
1f3f11ca
...
...
@@ -179,12 +179,24 @@ void WORKSHEET_LAYOUT_IO::Format( WORKSHEET_LAYOUT* aPageLayout ) const
// Setup
int
nestLevel
=
1
;
// Write default values:
m_out
->
Print
(
nestLevel
,
"(%s"
,
getTokenName
(
T_setup
)
);
m_out
->
Print
(
0
,
"(textsize %s %s)"
,
double2Str
(
TB_DEFAULT_TEXTSIZE
).
c_str
(),
double2Str
(
TB_DEFAULT_TEXTSIZE
).
c_str
()
);
m_out
->
Print
(
0
,
"(linewidth %s)"
,
double2Str
(
0.15
).
c_str
()
);
m_out
->
Print
(
0
,
"(textlinewidth %s)"
,
double2Str
(
0.15
).
c_str
()
);
m_out
->
Print
(
0
,
"
\n
"
);
// Write margin values
m_out
->
Print
(
nestLevel
,
"(%s %s)"
,
getTokenName
(
T_left_margin
),
double2Str
(
aPageLayout
->
GetLeftMargin
()
).
c_str
()
);
m_out
->
Print
(
0
,
"(%s %s)"
,
getTokenName
(
T_right_margin
),
double2Str
(
aPageLayout
->
GetRightMargin
()
).
c_str
()
);
m_out
->
Print
(
0
,
"(%s %s)"
,
getTokenName
(
T_top_margin
),
double2Str
(
aPageLayout
->
GetTopMargin
()
).
c_str
()
);
m_out
->
Print
(
0
,
"(%s %s)"
,
getTokenName
(
T_bottom_margin
),
double2Str
(
aPageLayout
->
GetBottomMargin
()
).
c_str
()
);
m_out
->
Print
(
0
,
")
\n
"
);
// Save the graphical items on the page layout
...
...
pagelayout_editor/pl_editor.cpp
View file @
1f3f11ca
...
...
@@ -64,7 +64,7 @@ bool EDA_APP::OnInit()
{
wxFileName
fn
;
InitEDA_Appl
(
wxT
(
"pl_editor"
),
APP_
GERBVIEW
_T
);
InitEDA_Appl
(
wxT
(
"pl_editor"
),
APP_
PL_EDITOR
_T
);
if
(
m_Checker
&&
m_Checker
->
IsAnotherRunning
()
)
{
...
...
@@ -87,7 +87,7 @@ bool EDA_APP::OnInit()
PL_EDITOR_FRAME
*
frame
=
new
PL_EDITOR_FRAME
(
NULL
,
wxT
(
"PlEditorFrame"
),
wxPoint
(
0
,
0
),
wxSize
(
600
,
400
)
);
//
ain
frame title:
//
frame title:
frame
->
SetTitle
(
GetTitle
()
+
wxT
(
" "
)
+
GetBuildVersion
()
);
SetTopWindow
(
frame
);
...
...
@@ -96,6 +96,7 @@ bool EDA_APP::OnInit()
frame
->
GetScreen
()
->
m_FirstRedraw
=
false
;
bool
descrLoaded
=
false
;
if
(
argc
>
1
)
{
fn
=
argv
[
1
];
...
...
@@ -111,10 +112,16 @@ bool EDA_APP::OnInit()
fn
.
GetFullPath
().
GetData
()
);
wxMessageBox
(
msg
);
}
else
descrLoaded
=
true
;
}
}
frame
->
RebuildDesignTree
();
if
(
!
descrLoaded
)
{
WORKSHEET_LAYOUT
::
GetTheInstance
().
SetPageLayout
();
frame
->
OnNewPageLayout
();
}
return
true
;
}
pagelayout_editor/pl_editor_config.cpp
View file @
1f3f11ca
...
...
@@ -36,6 +36,7 @@
#include <pl_editor_frame.h>
#include <hotkeys.h>
#include <dialog_hotkeys_editor.h>
#include <pl_editor_id.h>
#define GROUP wxT("/pl_editor")
...
...
@@ -49,6 +50,25 @@ void PL_EDITOR_FRAME::Process_Config( wxCommandEvent& event )
switch
(
id
)
{
case
wxID_PREFERENCES
:
break
;
// Standard basic hotkey IDs
case
ID_PREFERENCES_HOTKEY_SHOW_EDITOR
:
InstallHotkeyFrame
(
this
,
s_PlEditor_Hokeys_Descr
);
break
;
case
ID_PREFERENCES_HOTKEY_EXPORT_CONFIG
:
ExportHotkeyConfigToFile
(
s_PlEditor_Hokeys_Descr
);
break
;
case
ID_PREFERENCES_HOTKEY_IMPORT_CONFIG
:
ImportHotkeyConfigFromFile
(
s_PlEditor_Hokeys_Descr
);
break
;
case
ID_PREFERENCES_HOTKEY_SHOW_CURRENT_LIST
:
DisplayHotkeyList
(
this
,
s_PlEditor_Hokeys_Descr
);
break
;
default
:
wxMessageBox
(
wxT
(
"PL_EDITOR_FRAME::Process_Config error"
)
);
...
...
pagelayout_editor/pl_editor_frame.cpp
View file @
1f3f11ca
...
...
@@ -464,12 +464,23 @@ void PL_EDITOR_FRAME::PrintPage( wxDC* aDC, LAYER_MSK aPrintMasklayer,
void
PL_EDITOR_FRAME
::
RedrawActiveWindow
(
wxDC
*
aDC
,
bool
aEraseBg
)
{
GetScreen
()
->
m_ScreenNumber
=
GetPageNumberOption
()
?
1
:
2
;
if
(
aEraseBg
)
m_canvas
->
EraseScreen
(
aDC
);
m_canvas
->
DrawBackGround
(
aDC
);
const
WORKSHEET_LAYOUT
&
pglayout
=
WORKSHEET_LAYOUT
::
GetTheInstance
();
WORKSHEET_DATAITEM
*
selecteditem
=
GetSelectedItem
();
// the color to draw selected items
if
(
g_DrawBgColor
==
WHITE
)
WORKSHEET_DATAITEM
::
m_SelectedColor
=
DARKCYAN
;
else
WORKSHEET_DATAITEM
::
m_SelectedColor
=
YELLOW
;
for
(
unsigned
ii
=
0
;
;
ii
++
)
{
WORKSHEET_DATAITEM
*
item
=
pglayout
.
GetItem
(
ii
);
...
...
@@ -634,3 +645,14 @@ WORKSHEET_DATAITEM* PL_EDITOR_FRAME::Locate( const wxPoint& aPosition )
return
item
;
}
/* Must be called to initialize parameters when a new page layout
* description is loaded
*/
void
PL_EDITOR_FRAME
::
OnNewPageLayout
()
{
GetScreen
()
->
ClrModify
();
m_propertiesPagelayout
->
CopyPrmsFromGeneralToPanel
();
RebuildDesignTree
();
m_canvas
->
Refresh
();
}
pagelayout_editor/pl_editor_frame.h
View file @
1f3f11ca
...
...
@@ -102,6 +102,12 @@ public:
void
UpdateStatusBar
();
// overload EDA_DRAW_FRAME
/**
* Must be called to initialize parameters when a new page layout
* description is loaded
*/
void
OnNewPageLayout
();
/**
* creates or updates the right vertical toolbar.
* @note This is currently not used.
...
...
pagelayout_editor/properties_frame.cpp
View file @
1f3f11ca
...
...
@@ -49,23 +49,85 @@ wxSize PROPERTIES_FRAME::GetMinSize() const
return
wxSize
(
150
,
-
1
);
}
// Data transfert from item to widgets in properties frame
void
PROPERTIES_FRAME
::
CopyPrmsFromItemToPanel
(
WORKSHEET_DATAITEM
*
aItem
)
// Data transfert from general properties to widgets
void
PROPERTIES_FRAME
::
CopyPrmsFromGeneralToPanel
()
{
wxString
msg
;
// Set default parameters
msg
.
Printf
(
wxT
(
"%.3f"
),
aItem
->
m_DefaultLineWidth
);
msg
.
Printf
(
wxT
(
"%.3f"
),
WORKSHEET_DATAITEM
::
m_DefaultLineWidth
);
m_textCtrlDefaultLineWidth
->
SetValue
(
msg
);
msg
.
Printf
(
wxT
(
"%.3f"
),
aItem
->
m_DefaultTextSize
.
x
);
msg
.
Printf
(
wxT
(
"%.3f"
),
WORKSHEET_DATAITEM
::
m_DefaultTextSize
.
x
);
m_textCtrlDefaultTextSizeX
->
SetValue
(
msg
);
msg
.
Printf
(
wxT
(
"%.3f"
),
aItem
->
m_DefaultTextSize
.
y
);
msg
.
Printf
(
wxT
(
"%.3f"
),
WORKSHEET_DATAITEM
::
m_DefaultTextSize
.
y
);
m_textCtrlDefaultTextSizeY
->
SetValue
(
msg
);
msg
.
Printf
(
wxT
(
"%.3f"
),
aItem
->
m_DefaultTextThickness
);
msg
.
Printf
(
wxT
(
"%.3f"
),
WORKSHEET_DATAITEM
::
m_DefaultTextThickness
);
m_textCtrlDefaultTextThickness
->
SetValue
(
msg
);
// Set page margins values
WORKSHEET_LAYOUT
&
pglayout
=
WORKSHEET_LAYOUT
::
GetTheInstance
();
msg
.
Printf
(
wxT
(
"%.3f"
),
pglayout
.
GetRightMargin
()
);
m_textCtrlRightMargin
->
SetValue
(
msg
);
msg
.
Printf
(
wxT
(
"%.3f"
),
pglayout
.
GetBottomMargin
()
);
m_textCtrlDefaultBottomMargin
->
SetValue
(
msg
);
msg
.
Printf
(
wxT
(
"%.3f"
),
pglayout
.
GetLeftMargin
()
);
m_textCtrlLeftMargin
->
SetValue
(
msg
);
msg
.
Printf
(
wxT
(
"%.3f"
),
pglayout
.
GetTopMargin
()
);
m_textCtrlTopMargin
->
SetValue
(
msg
);
}
// Data transfert from widgets to general properties
bool
PROPERTIES_FRAME
::
CopyPrmsFromPanelToGeneral
()
{
double
dtmp
;
wxString
msg
;
// Import default parameters from widgets
msg
=
m_textCtrlDefaultLineWidth
->
GetValue
();
msg
.
ToDouble
(
&
dtmp
);
WORKSHEET_DATAITEM
::
m_DefaultLineWidth
=
dtmp
;
msg
=
m_textCtrlDefaultTextSizeX
->
GetValue
();
msg
.
ToDouble
(
&
dtmp
);
WORKSHEET_DATAITEM
::
m_DefaultTextSize
.
x
=
dtmp
;
msg
=
m_textCtrlDefaultTextSizeY
->
GetValue
();
msg
.
ToDouble
(
&
dtmp
);
WORKSHEET_DATAITEM
::
m_DefaultTextSize
.
y
=
dtmp
;
msg
=
m_textCtrlDefaultTextThickness
->
GetValue
();
msg
.
ToDouble
(
&
dtmp
);
WORKSHEET_DATAITEM
::
m_DefaultTextThickness
=
dtmp
;
// Get page margins values
WORKSHEET_LAYOUT
&
pglayout
=
WORKSHEET_LAYOUT
::
GetTheInstance
();
msg
=
m_textCtrlRightMargin
->
GetValue
();
msg
.
ToDouble
(
&
dtmp
);
pglayout
.
SetRightMargin
(
dtmp
);
msg
=
m_textCtrlDefaultBottomMargin
->
GetValue
();
msg
.
ToDouble
(
&
dtmp
);
pglayout
.
SetBottomMargin
(
dtmp
);
// cordinates of the left top corner are the left and top margins
msg
=
m_textCtrlLeftMargin
->
GetValue
();
msg
.
ToDouble
(
&
dtmp
);
pglayout
.
SetLeftMargin
(
dtmp
);
msg
=
m_textCtrlTopMargin
->
GetValue
();
msg
.
ToDouble
(
&
dtmp
);
pglayout
.
SetTopMargin
(
dtmp
);
return
true
;
}
// Data transfert from item to widgets in properties frame
void
PROPERTIES_FRAME
::
CopyPrmsFromItemToPanel
(
WORKSHEET_DATAITEM
*
aItem
)
{
wxString
msg
;
// Set parameters common to all WORKSHEET_DATAITEM types
m_textCtrlType
->
SetValue
(
aItem
->
GetClassName
()
);
m_textCtrlComment
->
SetValue
(
aItem
->
m_Info
);
...
...
@@ -210,8 +272,8 @@ void PROPERTIES_FRAME::CopyPrmsFromItemToPanel( WORKSHEET_DATAITEM* aItem )
m_textCtrlStepY
->
SetValue
(
msg
);
// The number of widgets was modified
Layout
();
Refresh
();
m_swItemProperties
->
Layout
();
m_swItemProperties
->
Refresh
();
}
// Event function called by clicking on the OK button
...
...
@@ -221,6 +283,8 @@ void PROPERTIES_FRAME::OnAcceptPrms( wxCommandEvent& event )
if
(
item
)
CopyPrmsFromPanelToItem
(
item
);
CopyPrmsFromPanelToGeneral
();
m_parent
->
OnModify
();
m_parent
->
GetCanvas
()
->
Refresh
();
}
...
...
@@ -234,22 +298,6 @@ bool PROPERTIES_FRAME::CopyPrmsFromPanelToItem( WORKSHEET_DATAITEM* aItem )
double
dtmp
;
wxString
msg
;
// Import default parameters
msg
=
m_textCtrlDefaultLineWidth
->
GetValue
();
msg
.
ToDouble
(
&
dtmp
);
aItem
->
m_DefaultLineWidth
=
dtmp
;
msg
=
m_textCtrlDefaultTextSizeX
->
GetValue
();
msg
.
ToDouble
(
&
dtmp
);
aItem
->
m_DefaultTextSize
.
x
=
dtmp
;
msg
=
m_textCtrlDefaultTextSizeY
->
GetValue
();
msg
.
ToDouble
(
&
dtmp
);
aItem
->
m_DefaultTextSize
.
y
=
dtmp
;
msg
=
m_textCtrlDefaultTextThickness
->
GetValue
();
msg
.
ToDouble
(
&
dtmp
);
aItem
->
m_DefaultTextThickness
=
dtmp
;
// Import common parameters:
aItem
->
m_Info
=
m_textCtrlComment
->
GetValue
();
...
...
pagelayout_editor/properties_frame.h
View file @
1f3f11ca
...
...
@@ -50,6 +50,12 @@ public:
void
OnAcceptPrms
(
wxCommandEvent
&
event
);
// Data transfert from general properties to widgets
void
CopyPrmsFromGeneralToPanel
();
// Data transfert from widgets to general properties
bool
CopyPrmsFromPanelToGeneral
();
// Data transfert from item to widgets in properties frame
void
CopyPrmsFromItemToPanel
(
WORKSHEET_DATAITEM
*
aItem
);
...
...
template/pagelayout.kicad_wks
deleted
100644 → 0
View file @
50743cf3
( page_layout
( setup (textsize 1.5 1.5) (linewidth 0.15) (textlinewidth 0.15) )
( rect (comment "rect around the title block") (linewidth 0.15) (start 110 34) (end 2 2) )
( rect (start 0 0 ltcorner) (end 0 0 rbcorner) (repeat 2) (incrx 2) (incry 2) )
( line (start 50 2 ltcorner) (end 50 0 ltcorner) (repeat 30) (incrx 50) )
( tbtext "1" (pos 25 1 ltcorner) (font (size 1.3 1.3))(repeat 100) (incrx 50) )
( line (start 50 2 lbcorner) (end 50 0 lbcorner) (repeat 30) (incrx 50) )
( tbtext "1" (pos 25 1 lbcorner) (font (size 1.3 1.3)) (repeat 100) (incrx 50) )
( line (start 0 50 ltcorner) (end 2 50 ltcorner) (repeat 30) (incry 50) )
( tbtext "A" (pos 1 25 ltcorner) (font (size 1.3 1.3))
(justify center)(repeat 100) (incry 50) )
( line (start 0 50 rtcorner) (end 2 50 rtcorner) (repeat 30) (incry 50) )
( tbtext "A" (pos 1 25 rtcorner) (font (size 1.3 1.3))
(justify center) (repeat 100) (incry 50) )
( tbtext "Date: %D" (pos 87 6.9) )
( line (start 110 5.5) end 2 5.5) )
( tbtext "%K" (pos 109 4.1) (comment "Kicad version" ) )
( line (start 110 8.5) end 2 8.5) )
( tbtext "Rev: %R" (pos 24 6.9)(font bold)(justify left) )
( tbtext "Size: %Z" (comment "Paper format name")(pos 109 6.9) )
( tbtext "Id: %S/%N" (comment "Sheet id")(pos 24 4.1) )
( line (start 110 12.5) end 2 12.5) )
( tbtext "Title: %T" (pos 109 10.7)(font bold (size 2 2)) )
( tbtext "File: %F" (pos 109 14.3) )
( line (start 110 18.5) end 2 18.5) )
( tbtext "Sheet: %P" (pos 109 17) )
( tbtext "%Y" (comment "Company name") (pos 109 20)(font bold) )
( tbtext "%C0" (comment "Comment 0") (pos 109 23) )
( tbtext "%C1" (comment "Comment 1") (pos 109 26) )
( tbtext "%C2" (comment "Comment 2") (pos 109 29) )
( tbtext "%C3" (comment "Comment 3") (pos 109 32) )
( line (start 90 8.5) end 90 5.5) )
( line (start 26 8.5) end 26 2) )
)
template/pagelayout_default.kicad_wks
View file @
1f3f11ca
( page_layout
(setup(textsize 1.5 1.5)(linewidth 0.15)(textlinewidth 0.15))
(rect (name item1:Rect) (start 110 34) (end 2 2))
(rect (name item2:Rect) (start 0 0 ltcorner) (end 0 0) (repeat 2) (incrx 2) (incry 2))
(line (name item3:Line) (start 50 2 ltcorner) (end 50 0 ltcorner) (repeat 30) (incrx 50))
(tbtext 1 (name item4:Text) (pos 25 1 ltcorner) (font (size 1.3 1.3)) (repeat 100) (incrx 50) (incrlabel 0))
(line (name item5:Line) (start 50 2 lbcorner) (end 50 0 lbcorner) (repeat 30) (incrx 50))
(tbtext 1 (name item6:Text) (pos 25 1 lbcorner) (font (size 1.3 1.3)) (repeat 100) (incrx 50) (incrlabel 0))
(line (name item7:Line) (start 0 50 ltcorner) (end 2 50 ltcorner) (repeat 30) (incry 50))
(tbtext A (name item8:Text) (pos 1 25 ltcorner) (font (size 1.3 1.3)) (justify center) (repeat 100) (incry 50) (incrlabel 0))
(line (name item9:Line) (start 0 50 rtcorner) (end 2 50 rtcorner) (repeat 30) (incry 50))
(tbtext A (name item10:Text) (pos 1 25 rtcorner) (font (size 1.3 1.3)) (justify center) (repeat 100) (incry 50) (incrlabel 0))
(tbtext "Date: %D" (name item11:Text) (pos 87 6.9))
(line (name item12:Line) (start 110 5.5) (end 2 5.5))
(tbtext %K (name item13:Text) (pos 109 4.1))
(line (name item14:Line) (start 110 8.5) (end 2 8.5))
(tbtext "Rev: %R" (name item15:Text) (pos 24 6.9) (font bold))
(tbtext "Size: %Z" (name item16:Text) (pos 109 6.9))
(tbtext "Id: %S/%N" (name item17:Text) (pos 24 4.1))
(line (name item18:Line) (start 110 12.5) (end 2 12.5))
(tbtext "Title: %T" (name item19:Text) (pos 109 10.7) (font (size 2 2) bold))
(tbtext "File: %F" (name item20:Text) (pos 109 14.3))
(line (name item21:Line) (start 110 18.5) (end 2 18.5))
(tbtext "Sheet: %P" (name item22:Text) (pos 109 17))
(tbtext %Y (name item23:Text) (pos 109 20) (font bold))
(tbtext %C0 (name item24:Text) (pos 109 23))
(tbtext %C1 (name item25:Text) (pos 109 26))
(tbtext %C2 (name item26:Text) (pos 109 29))
(tbtext %C3 (name item27:Text) (pos 109 32))
(line (name item28:Line) (start 90 8.5) (end 90 5.5))
(line (name item29:Line) (start 26 8.5) (end 26 2))
(rect (name item30:Rect) (start 157 34) (end 110 2))
( setup (textsize 1.5 1.5) (linewidth 0.15) (textlinewidth 0.15) )
( rect (comment "rect around the title block") (linewidth 0.15) (start 110 34) (end 2 2) )
( rect (start 0 0 ltcorner) (end 0 0 rbcorner) (repeat 2) (incrx 2) (incry 2) )
( line (start 50 2 ltcorner) (end 50 0 ltcorner) (repeat 30) (incrx 50) )
( tbtext "1" (pos 25 1 ltcorner) (font (size 1.3 1.3))(repeat 100) (incrx 50) )
( line (start 50 2 lbcorner) (end 50 0 lbcorner) (repeat 30) (incrx 50) )
( tbtext "1" (pos 25 1 lbcorner) (font (size 1.3 1.3)) (repeat 100) (incrx 50) )
( line (start 0 50 ltcorner) (end 2 50 ltcorner) (repeat 30) (incry 50) )
( tbtext "A" (pos 1 25 ltcorner) (font (size 1.3 1.3))
(justify center)(repeat 100) (incry 50) )
( line (start 0 50 rtcorner) (end 2 50 rtcorner) (repeat 30) (incry 50) )
( tbtext "A" (pos 1 25 rtcorner) (font (size 1.3 1.3))
(justify center) (repeat 100) (incry 50) )
( tbtext "Date: %D" (pos 87 6.9) )
( line (start 110 5.5) end 2 5.5) )
( tbtext "%K" (pos 109 4.1) (comment "Kicad version" ) )
( line (start 110 8.5) end 2 8.5) )
( tbtext "Rev: %R" (pos 24 6.9)(font bold)(justify left) )
( tbtext "Size: %Z" (comment "Paper format name")(pos 109 6.9) )
( tbtext "Id: %S/%N" (comment "Sheet id")(pos 24 4.1) )
( line (start 110 12.5) end 2 12.5) )
( tbtext "Title: %T" (pos 109 10.7)(font bold (size 2 2)) )
( tbtext "File: %F" (pos 109 14.3) )
( line (start 110 18.5) end 2 18.5) )
( tbtext "Sheet: %P" (pos 109 17) )
( tbtext "%Y" (comment "Company name") (pos 109 20)(font bold) )
( tbtext "%C0" (comment "Comment 0") (pos 109 23) )
( tbtext "%C1" (comment "Comment 1") (pos 109 26) )
( tbtext "%C2" (comment "Comment 2") (pos 109 29) )
( tbtext "%C3" (comment "Comment 3") (pos 109 32) )
( line (start 90 8.5) end 90 5.5) )
( line (start 26 8.5) end 26 2) )
)
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