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
8f6d69e5
Commit
8f6d69e5
authored
Dec 16, 2013
by
Wayne Stambaugh
Browse files
Options
Browse Files
Download
Plain Diff
Pcbnew: fix 45 degree rotation angle undo and global variable elimination.
parents
2d9385b4
efd99637
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
44 additions
and
32 deletions
+44
-32
pcbcommon.cpp
common/pcbcommon.cpp
+0
-3
pcbcommon.h
include/pcbcommon.h
+0
-2
wxPcbStruct.h
include/wxPcbStruct.h
+6
-0
board_undo_redo.cpp
pcbnew/board_undo_redo.cpp
+4
-2
dialog_general_options.cpp
pcbnew/dialogs/dialog_general_options.cpp
+2
-3
edit.cpp
pcbnew/edit.cpp
+2
-2
pcbframe.cpp
pcbnew/pcbframe.cpp
+10
-0
pcbnew_config.cpp
pcbnew/pcbnew_config.cpp
+20
-20
No files found.
common/pcbcommon.cpp
View file @
8f6d69e5
...
...
@@ -55,9 +55,6 @@ LAYER_MSK g_TabAllCopperLayerMask[NB_COPPER_LAYERS] = {
DISPLAY_OPTIONS
DisplayOpt
;
// Display options for board items
// This will be always be 450 or 900 (by UI design) at the moment
int
g_RotationAngle
;
int
g_AnchorColor
=
BLUE
;
int
g_ModuleTextCMPColor
=
LIGHTGRAY
;
int
g_ModuleTextCUColor
=
MAGENTA
;
...
...
include/pcbcommon.h
View file @
8f6d69e5
...
...
@@ -25,8 +25,6 @@ extern DISPLAY_OPTIONS DisplayOpt;
extern
int
g_CurrentVersionPCB
;
extern
int
g_RotationAngle
;
/// List of segments of the trace currently being drawn.
extern
DLIST
<
TRACK
>
g_CurrentTrackList
;
...
...
include/wxPcbStruct.h
View file @
8f6d69e5
...
...
@@ -87,6 +87,9 @@ class PCB_EDIT_FRAME : public PCB_BASE_FRAME
/// The global footprint library table.
FP_LIB_TABLE
*
m_globalFootprintTable
;
/// User defined rotation angle (in tenths of a degree).
int
m_rotationAngle
;
/**
* Function loadFootprints
* loads the footprints for each #COMPONENT in \a aNetlist from the list of libraries.
...
...
@@ -330,6 +333,9 @@ public:
*/
virtual
void
SetGridColor
(
EDA_COLOR_T
aColor
);
int
GetRotationAngle
()
const
{
return
m_rotationAngle
;
}
void
SetRotationAngle
(
int
aRotationAngle
);
// Configurations:
void
InstallConfigFrame
();
void
Process_Config
(
wxCommandEvent
&
event
);
...
...
pcbnew/board_undo_redo.cpp
View file @
8f6d69e5
...
...
@@ -504,11 +504,13 @@ void PCB_EDIT_FRAME::PutDataInPreviousState( PICKED_ITEMS_LIST* aList, bool aRed
break
;
case
UR_ROTATED
:
item
->
Rotate
(
aList
->
m_TransformPoint
,
aRedoCommand
?
900
:
-
900
);
item
->
Rotate
(
aList
->
m_TransformPoint
,
aRedoCommand
?
m_rotationAngle
:
-
m_rotationAngle
);
break
;
case
UR_ROTATED_CLOCKWISE
:
item
->
Rotate
(
aList
->
m_TransformPoint
,
aRedoCommand
?
-
900
:
900
);
item
->
Rotate
(
aList
->
m_TransformPoint
,
aRedoCommand
?
-
m_rotationAngle
:
m_rotationAngle
);
break
;
case
UR_FLIPPED
:
...
...
pcbnew/dialogs/dialog_general_options.cpp
View file @
8f6d69e5
...
...
@@ -69,7 +69,7 @@ void DIALOG_GENERALOPTIONS::init()
m_CursorShape
->
SetSelection
(
GetParent
()
->
GetCursorShape
()
?
1
:
0
);
switch
(
g_RotationAngle
)
switch
(
GetParent
()
->
GetRotationAngle
()
)
{
case
450
:
m_RotationAngle
->
SetSelection
(
0
);
...
...
@@ -121,8 +121,7 @@ void DIALOG_GENERALOPTIONS::OnOkClick( wxCommandEvent& event )
GetParent
()
->
SetCursorShape
(
m_CursorShape
->
GetSelection
()
);
GetParent
()
->
SetAutoSaveInterval
(
m_SaveTime
->
GetValue
()
*
60
);
g_RotationAngle
=
10
*
wxAtoi
(
m_RotationAngle
->
GetStringSelection
()
);
GetParent
()
->
SetRotationAngle
(
10
*
wxAtoi
(
m_RotationAngle
->
GetStringSelection
()
)
);
/* Updating the combobox to display the active layer. */
g_MaxLinksShowed
=
m_MaxShowLinks
->
GetValue
();
...
...
pcbnew/edit.cpp
View file @
8f6d69e5
...
...
@@ -747,7 +747,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
if
(
!
GetCurItem
()
->
IsMoving
()
)
SaveCopyInUndoList
(
GetCurItem
(),
UR_ROTATED
,
((
MODULE
*
)
GetCurItem
())
->
GetPosition
()
);
Rotate_Module
(
&
dc
,
(
MODULE
*
)
GetCurItem
(),
g_R
otationAngle
,
true
);
Rotate_Module
(
&
dc
,
(
MODULE
*
)
GetCurItem
(),
m_r
otationAngle
,
true
);
break
;
case
ID_POPUP_PCB_ROTATE_MODULE_CLOCKWISE
:
...
...
@@ -776,7 +776,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
SaveCopyInUndoList
(
GetCurItem
(),
UR_ROTATED_CLOCKWISE
,
((
MODULE
*
)
GetCurItem
())
->
GetPosition
()
);
Rotate_Module
(
&
dc
,
(
MODULE
*
)
GetCurItem
(),
-
g_R
otationAngle
,
true
);
Rotate_Module
(
&
dc
,
(
MODULE
*
)
GetCurItem
(),
-
m_r
otationAngle
,
true
);
break
;
case
ID_POPUP_PCB_CHANGE_SIDE_MODULE
:
...
...
pcbnew/pcbframe.cpp
View file @
8f6d69e5
...
...
@@ -317,6 +317,7 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( wxWindow* parent, const wxString& title,
m_footprintLibTable
=
NULL
;
m_globalFootprintTable
=
NULL
;
m_rotationAngle
=
900
;
#ifdef KICAD_SCRIPTING_WXPYTHON
m_pythonPanel
=
NULL
;
...
...
@@ -1072,3 +1073,12 @@ void PCB_EDIT_FRAME::ToPlotter( wxCommandEvent& event )
DIALOG_PLOT
dlg
(
this
);
dlg
.
ShowModal
();
}
void
PCB_EDIT_FRAME
::
SetRotationAngle
(
int
aRotationAngle
)
{
wxCHECK2_MSG
(
aRotationAngle
>
0
&&
aRotationAngle
<
900
,
aRotationAngle
=
900
,
wxT
(
"Invalid rotation angle, defaulting to 90."
)
);
m_rotationAngle
=
aRotationAngle
;
}
pcbnew/pcbnew_config.cpp
View file @
8f6d69e5
...
...
@@ -158,27 +158,27 @@ void PCB_EDIT_FRAME::Process_Config( wxCommandEvent& event )
break
;
case
ID_CONFIG_READ
:
{
fn
=
GetBoard
()
->
GetFileName
();
fn
.
SetExt
(
ProjectFileExtension
);
wxFileDialog
dlg
(
this
,
_
(
"Read Project File"
),
fn
.
GetPath
(),
fn
.
GetFullName
(),
ProjectFileWildcard
,
wxFD_OPEN
|
wxFD_FILE_MUST_EXIST
|
wxFD_CHANGE_DIR
);
{
fn
=
GetBoard
()
->
GetFileName
();
fn
.
SetExt
(
ProjectFileExtension
);
if
(
dlg
.
ShowModal
()
==
wxID_CANCEL
)
break
;
wxFileDialog
dlg
(
this
,
_
(
"Read Project File"
),
fn
.
GetPath
(),
fn
.
GetFullName
(),
ProjectFileWildcard
,
wxFD_OPEN
|
wxFD_FILE_MUST_EXIST
|
wxFD_CHANGE_DIR
);
if
(
!
wxFileExists
(
dlg
.
GetPath
()
)
)
{
wxString
msg
;
msg
.
Printf
(
_
(
"File %s not found"
),
GetChars
(
dlg
.
GetPath
()
)
);
DisplayError
(
this
,
msg
);
break
;
}
if
(
dlg
.
ShowModal
()
==
wxID_CANCEL
)
break
;
LoadProjectSettings
(
dlg
.
GetPath
()
);
if
(
!
wxFileExists
(
dlg
.
GetPath
()
)
)
{
wxString
msg
;
msg
.
Printf
(
_
(
"File %s not found"
),
GetChars
(
dlg
.
GetPath
()
)
);
DisplayError
(
this
,
msg
);
break
;
}
LoadProjectSettings
(
dlg
.
GetPath
()
);
}
break
;
// Hotkey IDs
...
...
@@ -478,7 +478,7 @@ PARAM_CFG_ARRAY& PCB_EDIT_FRAME::GetConfigurationSettings()
WHITE
)
);
// Miscellaneous:
m_configSettings
.
push_back
(
new
PARAM_CFG_INT
(
true
,
wxT
(
"RotationAngle"
),
&
g_R
otationAngle
,
m_configSettings
.
push_back
(
new
PARAM_CFG_INT
(
true
,
wxT
(
"RotationAngle"
),
&
m_r
otationAngle
,
900
,
450
,
900
)
);
m_configSettings
.
push_back
(
new
PARAM_CFG_INT
(
true
,
wxT
(
"MaxLnkS"
),
&
g_MaxLinksShowed
,
3
,
0
,
15
)
);
...
...
@@ -486,8 +486,8 @@ PARAM_CFG_ARRAY& PCB_EDIT_FRAME::GetConfigurationSettings()
&
g_Show_Module_Ratsnest
,
true
)
);
m_configSettings
.
push_back
(
new
PARAM_CFG_BOOL
(
true
,
wxT
(
"TwoSegT"
),
&
g_TwoSegmentTrackBuild
,
true
)
);
m_configSettings
.
push_back
(
new
PARAM_CFG_BOOL
(
true
,
wxT
(
"SegmPcb45Only"
)
,
&
g_Segments_45_Only
,
true
)
);
m_configSettings
.
push_back
(
new
PARAM_CFG_BOOL
(
true
,
wxT
(
"SegmPcb45Only"
)
,
&
g_Segments_45_Only
,
true
)
);
return
m_configSettings
;
}
...
...
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