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
15f5c228
Commit
15f5c228
authored
Jul 09, 2014
by
Maciej Suminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed autozooming with empty board/module.
parent
31e25ac4
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
42 additions
and
34 deletions
+42
-34
moduleframe.cpp
pcbnew/moduleframe.cpp
+1
-19
modview_frame.cpp
pcbnew/modview_frame.cpp
+20
-6
modview_frame.h
pcbnew/modview_frame.h
+1
-1
pcbnew_control.cpp
pcbnew/tools/pcbnew_control.cpp
+20
-8
No files found.
pcbnew/moduleframe.cpp
View file @
15f5c228
...
...
@@ -696,24 +696,6 @@ void FOOTPRINT_EDIT_FRAME::updateTitle()
void
FOOTPRINT_EDIT_FRAME
::
updateView
()
{
static_cast
<
PCB_DRAW_PANEL_GAL
*>
(
GetGalCanvas
()
)
->
DisplayBoard
(
GetBoard
()
);
m_Pcb
->
ComputeBoundingBox
(
false
);
EDA_RECT
boardBbox
=
m_Pcb
->
GetBoundingBox
();
BOX2D
bbox
;
if
(
boardBbox
.
GetSize
().
x
>
0
&&
boardBbox
.
GetSize
().
y
>
0
)
{
bbox
.
SetOrigin
(
VECTOR2D
(
boardBbox
.
GetOrigin
()
)
);
bbox
.
SetSize
(
VECTOR2D
(
boardBbox
.
GetSize
()
)
);
}
else
{
// Default empty view
bbox
.
SetOrigin
(
VECTOR2D
(
-
1000
,
-
1000
)
);
bbox
.
SetSize
(
VECTOR2D
(
2000
,
2000
)
);
}
GetGalCanvas
()
->
GetView
()
->
SetViewport
(
bbox
);
m_toolManager
->
RunAction
(
COMMON_ACTIONS
::
zoomFitScreen
);
m_toolManager
->
ResetTools
(
TOOL_BASE
::
MODEL_RELOAD
);
}
pcbnew/modview_frame.cpp
View file @
15f5c228
...
...
@@ -466,7 +466,7 @@ void FOOTPRINT_VIEWER_FRAME::ClickOnFootprintList( wxCommandEvent& event )
UpdateTitle
();
if
(
IsGalCanvasActive
()
)
redrawGal
();
updateView
();
Zoom_Automatique
(
false
);
m_canvas
->
Refresh
();
...
...
@@ -851,7 +851,7 @@ void FOOTPRINT_VIEWER_FRAME::SelectAndViewFootprint( int aMode )
Update3D_Frame
();
if
(
IsGalCanvasActive
()
)
redrawGal
();
updateView
();
}
...
...
@@ -880,12 +880,26 @@ void FOOTPRINT_VIEWER_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg )
}
void
FOOTPRINT_VIEWER_FRAME
::
redrawGal
()
void
FOOTPRINT_VIEWER_FRAME
::
updateView
()
{
static_cast
<
PCB_DRAW_PANEL_GAL
*>
(
GetGalCanvas
()
)
->
DisplayBoard
(
m_Pcb
);
static_cast
<
PCB_DRAW_PANEL_GAL
*>
(
GetGalCanvas
()
)
->
DisplayBoard
(
GetBoard
()
);
// Autozoom
m_Pcb
->
ComputeBoundingBox
(
false
);
EDA_RECT
boardBbox
=
m_Pcb
->
GetBoundingBox
();
GetGalCanvas
()
->
GetView
()
->
SetViewport
(
BOX2D
(
boardBbox
.
GetOrigin
(),
boardBbox
.
GetSize
()
)
);
BOX2D
bbox
;
// Autozoom
if
(
boardBbox
.
GetSize
().
x
>
0
&&
boardBbox
.
GetSize
().
y
>
0
)
{
bbox
.
SetOrigin
(
VECTOR2D
(
boardBbox
.
GetOrigin
()
)
);
bbox
.
SetSize
(
VECTOR2D
(
boardBbox
.
GetSize
()
)
);
}
else
{
// Default empty view
bbox
.
SetOrigin
(
VECTOR2D
(
-
1000
,
-
1000
)
);
bbox
.
SetSize
(
VECTOR2D
(
2000
,
2000
)
);
}
GetGalCanvas
()
->
GetView
()
->
SetViewport
(
bbox
);
}
pcbnew/modview_frame.h
View file @
15f5c228
...
...
@@ -172,7 +172,7 @@ private:
void
SaveCopyInUndoList
(
BOARD_ITEM
*
,
UNDO_REDO_T
,
const
wxPoint
&
)
{}
void
SaveCopyInUndoList
(
const
PICKED_ITEMS_LIST
&
,
UNDO_REDO_T
,
const
wxPoint
&
)
{}
void
redrawGal
();
void
updateView
();
DECLARE_EVENT_TABLE
()
};
...
...
pcbnew/tools/pcbnew_control.cpp
View file @
15f5c228
...
...
@@ -109,6 +109,16 @@ int PCBNEW_CONTROL::ZoomFitScreen( TOOL_EVENT& aEvent )
KIGFX
::
VIEW
*
view
=
m_frame
->
GetGalCanvas
()
->
GetView
();
KIGFX
::
GAL
*
gal
=
m_frame
->
GetGalCanvas
()
->
GetGAL
();
BOX2I
boardBBox
=
getModel
<
BOARD
>
()
->
ViewBBox
();
if
(
boardBBox
.
GetSize
().
x
==
0
||
boardBBox
.
GetSize
().
y
==
0
)
{
// Empty view
view
->
SetScale
(
100000.0
);
view
->
SetCenter
(
VECTOR2D
(
0
,
0
)
);
}
else
{
// Autozoom to board
VECTOR2I
screenSize
=
gal
->
GetScreenPixelSize
();
double
iuPerX
=
screenSize
.
x
?
boardBBox
.
GetWidth
()
/
screenSize
.
x
:
1.0
;
...
...
@@ -120,6 +130,8 @@ int PCBNEW_CONTROL::ZoomFitScreen( TOOL_EVENT& aEvent )
view
->
SetScale
(
zoom
);
view
->
SetCenter
(
boardBBox
.
Centre
()
);
}
setTransitions
();
return
0
;
...
...
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