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
dbc4a8f2
Commit
dbc4a8f2
authored
Mar 20, 2014
by
Maciej Suminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
GAL zooms in and out using the default hot keys (F1/F2).
Screen size is saved in VECTOR2I instead of VECTOR2D.
parent
093e311a
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
24 additions
and
23 deletions
+24
-23
cairo_gal.cpp
common/gal/cairo/cairo_gal.cpp
+3
-3
graphics_abstraction_layer.cpp
common/gal/graphics_abstraction_layer.cpp
+2
-2
opengl_gal.cpp
common/gal/opengl/opengl_gal.cpp
+2
-2
view.cpp
common/view/view.cpp
+1
-1
zoom.cpp
common/zoom.cpp
+3
-2
graphics_abstraction_layer.h
include/gal/graphics_abstraction_layer.h
+2
-2
view.h
include/view/view.h
+1
-1
menubar_pcbframe.cpp
pcbnew/menubar_pcbframe.cpp
+10
-10
No files found.
common/gal/cairo/cairo_gal.cpp
View file @
dbc4a8f2
...
@@ -70,7 +70,7 @@ CAIRO_GAL::CAIRO_GAL( wxWindow* aParent, wxEvtHandler* aMouseListener,
...
@@ -70,7 +70,7 @@ CAIRO_GAL::CAIRO_GAL( wxWindow* aParent, wxEvtHandler* aMouseListener,
#endif
#endif
SetSize
(
aParent
->
GetSize
()
);
SetSize
(
aParent
->
GetSize
()
);
screenSize
=
VECTOR2
D
(
aParent
->
GetSize
()
);
screenSize
=
VECTOR2
I
(
aParent
->
GetSize
()
);
initCursor
();
initCursor
();
// Grid color settings are different in Cairo and OpenGL
// Grid color settings are different in Cairo and OpenGL
...
@@ -138,7 +138,7 @@ void CAIRO_GAL::EndDrawing()
...
@@ -138,7 +138,7 @@ void CAIRO_GAL::EndDrawing()
*
wxOutputPtr
++
=
value
&
0xff
;
// Blue pixel
*
wxOutputPtr
++
=
value
&
0xff
;
// Blue pixel
}
}
wxImage
img
(
(
int
)
screenSize
.
x
,
(
int
)
screenSize
.
y
,
(
unsigned
char
*
)
wxOutput
,
true
);
wxImage
img
(
screenSize
.
x
,
screenSize
.
y
,
(
unsigned
char
*
)
wxOutput
,
true
);
wxBitmap
bmp
(
img
);
wxBitmap
bmp
(
img
);
wxClientDC
client_dc
(
this
);
wxClientDC
client_dc
(
this
);
wxBufferedDC
dc
;
wxBufferedDC
dc
;
...
@@ -283,7 +283,7 @@ void CAIRO_GAL::DrawCurve( const VECTOR2D& aStartPoint, const VECTOR2D& aControl
...
@@ -283,7 +283,7 @@ void CAIRO_GAL::DrawCurve( const VECTOR2D& aStartPoint, const VECTOR2D& aControl
void
CAIRO_GAL
::
ResizeScreen
(
int
aWidth
,
int
aHeight
)
void
CAIRO_GAL
::
ResizeScreen
(
int
aWidth
,
int
aHeight
)
{
{
screenSize
=
VECTOR2
D
(
aWidth
,
aHeight
);
screenSize
=
VECTOR2
I
(
aWidth
,
aHeight
);
// Recreate the bitmaps
// Recreate the bitmaps
deleteBitmaps
();
deleteBitmaps
();
...
...
common/gal/graphics_abstraction_layer.cpp
View file @
dbc4a8f2
...
@@ -88,7 +88,7 @@ void GAL::ComputeWorldScreenMatrix()
...
@@ -88,7 +88,7 @@ void GAL::ComputeWorldScreenMatrix()
MATRIX3x3D
translation
;
MATRIX3x3D
translation
;
translation
.
SetIdentity
();
translation
.
SetIdentity
();
translation
.
SetTranslation
(
0.5
*
screenSize
);
translation
.
SetTranslation
(
0.5
*
VECTOR2D
(
screenSize
)
);
MATRIX3x3D
scale
;
MATRIX3x3D
scale
;
scale
.
SetIdentity
();
scale
.
SetIdentity
();
...
@@ -131,7 +131,7 @@ void GAL::DrawGrid()
...
@@ -131,7 +131,7 @@ void GAL::DrawGrid()
// For the drawing the start points, end points and increments have
// For the drawing the start points, end points and increments have
// to be calculated in world coordinates
// to be calculated in world coordinates
VECTOR2D
worldStartPoint
=
screenWorldMatrix
*
VECTOR2D
(
0.0
,
0.0
);
VECTOR2D
worldStartPoint
=
screenWorldMatrix
*
VECTOR2D
(
0.0
,
0.0
);
VECTOR2D
worldEndPoint
=
screenWorldMatrix
*
screenSize
;
VECTOR2D
worldEndPoint
=
screenWorldMatrix
*
VECTOR2D
(
screenSize
)
;
int
gridScreenSizeDense
=
round
(
gridSize
.
x
*
worldScale
);
int
gridScreenSizeDense
=
round
(
gridSize
.
x
*
worldScale
);
int
gridScreenSizeCoarse
=
round
(
gridSize
.
x
*
static_cast
<
double
>
(
gridTick
)
*
worldScale
);
int
gridScreenSizeCoarse
=
round
(
gridSize
.
x
*
static_cast
<
double
>
(
gridTick
)
*
worldScale
);
...
...
common/gal/opengl/opengl_gal.cpp
View file @
dbc4a8f2
...
@@ -86,7 +86,7 @@ OPENGL_GAL::OPENGL_GAL( wxWindow* aParent, wxEvtHandler* aMouseListener,
...
@@ -86,7 +86,7 @@ OPENGL_GAL::OPENGL_GAL( wxWindow* aParent, wxEvtHandler* aMouseListener,
#endif
#endif
SetSize
(
aParent
->
GetSize
()
);
SetSize
(
aParent
->
GetSize
()
);
screenSize
=
VECTOR2
D
(
aParent
->
GetSize
()
);
screenSize
=
VECTOR2
I
(
aParent
->
GetSize
()
);
// Grid color settings are different in Cairo and OpenGL
// Grid color settings are different in Cairo and OpenGL
SetGridColor
(
COLOR4D
(
0.8
,
0.8
,
0.8
,
0.1
)
);
SetGridColor
(
COLOR4D
(
0.8
,
0.8
,
0.8
,
0.1
)
);
...
@@ -562,7 +562,7 @@ void OPENGL_GAL::DrawCurve( const VECTOR2D& aStartPoint, const VECTOR2D& aContro
...
@@ -562,7 +562,7 @@ void OPENGL_GAL::DrawCurve( const VECTOR2D& aStartPoint, const VECTOR2D& aContro
void
OPENGL_GAL
::
ResizeScreen
(
int
aWidth
,
int
aHeight
)
void
OPENGL_GAL
::
ResizeScreen
(
int
aWidth
,
int
aHeight
)
{
{
screenSize
=
VECTOR2
D
(
aWidth
,
aHeight
);
screenSize
=
VECTOR2
I
(
aWidth
,
aHeight
);
// Resize framebuffers
// Resize framebuffers
compositor
.
Resize
(
aWidth
,
aHeight
);
compositor
.
Resize
(
aWidth
,
aHeight
);
...
...
common/view/view.cpp
View file @
dbc4a8f2
...
@@ -771,7 +771,7 @@ void VIEW::Redraw()
...
@@ -771,7 +771,7 @@ void VIEW::Redraw()
}
}
const
VECTOR2
D
&
VIEW
::
GetScreenPixelSize
()
const
const
VECTOR2
I
&
VIEW
::
GetScreenPixelSize
()
const
{
{
return
m_gal
->
GetScreenPixelSize
();
return
m_gal
->
GetScreenPixelSize
();
}
}
...
...
common/zoom.cpp
View file @
dbc4a8f2
...
@@ -203,8 +203,9 @@ void EDA_DRAW_FRAME::OnZoom( wxCommandEvent& event )
...
@@ -203,8 +203,9 @@ void EDA_DRAW_FRAME::OnZoom( wxCommandEvent& event )
double
zoomFactor
=
gal
->
GetWorldScale
()
/
gal
->
GetZoomFactor
();
double
zoomFactor
=
gal
->
GetWorldScale
()
/
gal
->
GetZoomFactor
();
double
zoom
=
1.0
/
(
zoomFactor
*
GetZoom
()
);
double
zoom
=
1.0
/
(
zoomFactor
*
GetZoom
()
);
view
->
SetScale
(
zoom
);
VECTOR2D
cursorWorld
(
GetCrossHairPosition
()
);
view
->
SetCenter
(
VECTOR2D
(
center
)
);
view
->
SetScale
(
zoom
,
cursorWorld
);
GetGalCanvas
()
->
Refresh
();
GetGalCanvas
()
->
Refresh
();
}
}
...
...
include/gal/graphics_abstraction_layer.h
View file @
dbc4a8f2
...
@@ -160,7 +160,7 @@ public:
...
@@ -160,7 +160,7 @@ public:
virtual
bool
Show
(
bool
aShow
)
=
0
;
virtual
bool
Show
(
bool
aShow
)
=
0
;
/// @brief Returns GAL canvas size in pixels
/// @brief Returns GAL canvas size in pixels
const
VECTOR2
D
&
GetScreenPixelSize
()
const
const
VECTOR2
I
&
GetScreenPixelSize
()
const
{
{
return
screenSize
;
return
screenSize
;
}
}
...
@@ -831,7 +831,7 @@ public:
...
@@ -831,7 +831,7 @@ public:
protected
:
protected
:
std
::
stack
<
double
>
depthStack
;
///< Stored depth values
std
::
stack
<
double
>
depthStack
;
///< Stored depth values
VECTOR2
D
screenSize
;
///< Screen size in screen coordinates
VECTOR2
I
screenSize
;
///< Screen size in screen coordinates
double
worldUnitLength
;
///< The unit length of the world coordinates [inch]
double
worldUnitLength
;
///< The unit length of the world coordinates [inch]
double
screenDPI
;
///< The dots per inch of the screen
double
screenDPI
;
///< The dots per inch of the screen
...
...
include/view/view.h
View file @
dbc4a8f2
...
@@ -261,7 +261,7 @@ public:
...
@@ -261,7 +261,7 @@ public:
* Returns the size of the our rendering area, in pixels.
* Returns the size of the our rendering area, in pixels.
* @return viewport screen size
* @return viewport screen size
*/
*/
const
VECTOR2
D
&
GetScreenPixelSize
()
const
;
const
VECTOR2
I
&
GetScreenPixelSize
()
const
;
/**
/**
* Function AddLayer()
* Function AddLayer()
...
...
pcbnew/menubar_pcbframe.cpp
View file @
dbc4a8f2
...
@@ -328,12 +328,12 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
...
@@ -328,12 +328,12 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
*/
*/
// Zoom In
// Zoom In
text
=
AddHotkeyName
(
_
(
"Zoom &In"
),
g_Pcbnew_Editor_Hokeys_Descr
,
text
=
AddHotkeyName
(
_
(
"Zoom &In"
),
g_Pcbnew_Editor_Hokeys_Descr
,
HK_ZOOM_IN
,
IS_ACCELERATOR
);
HK_ZOOM_IN
);
AddMenuItem
(
viewMenu
,
ID_ZOOM_IN
,
text
,
HELP_ZOOM_IN
,
KiBitmap
(
zoom_in_xpm
)
);
AddMenuItem
(
viewMenu
,
ID_ZOOM_IN
,
text
,
HELP_ZOOM_IN
,
KiBitmap
(
zoom_in_xpm
)
);
// Zoom Out
// Zoom Out
text
=
AddHotkeyName
(
_
(
"Zoom &Out"
),
g_Pcbnew_Editor_Hokeys_Descr
,
text
=
AddHotkeyName
(
_
(
"Zoom &Out"
),
g_Pcbnew_Editor_Hokeys_Descr
,
HK_ZOOM_OUT
,
IS_ACCELERATOR
);
HK_ZOOM_OUT
);
AddMenuItem
(
viewMenu
,
ID_ZOOM_OUT
,
text
,
HELP_ZOOM_OUT
,
KiBitmap
(
zoom_out_xpm
)
);
AddMenuItem
(
viewMenu
,
ID_ZOOM_OUT
,
text
,
HELP_ZOOM_OUT
,
KiBitmap
(
zoom_out_xpm
)
);
// Fit on Screen
// Fit on Screen
...
@@ -366,38 +366,38 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
...
@@ -366,38 +366,38 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
viewMenu
->
AppendSeparator
();
viewMenu
->
AppendSeparator
();
text
=
AddHotkeyName
(
_
(
"&Switch canvas to default"
),
g_Pcbnew_Editor_Hokeys_Descr
,
text
=
AddHotkeyName
(
_
(
"&Switch canvas to default"
),
g_Pcbnew_Editor_Hokeys_Descr
,
HK_CANVAS_DEFAULT
,
IS_ACCELERATOR
);
HK_CANVAS_DEFAULT
);
AddMenuItem
(
viewMenu
,
ID_MENU_CANVAS_DEFAULT
,
AddMenuItem
(
viewMenu
,
ID_MENU_CANVAS_DEFAULT
,
text
,
_
(
"Switch the canvas implementation to default"
),
text
,
_
(
"Switch the canvas implementation to default"
),
KiBitmap
(
tools_xpm
)
);
KiBitmap
(
tools_xpm
)
);
text
=
AddHotkeyName
(
_
(
"&Switch canvas to OpenGL"
),
g_Pcbnew_Editor_Hokeys_Descr
,
text
=
AddHotkeyName
(
_
(
"&Switch canvas to OpenGL"
),
g_Pcbnew_Editor_Hokeys_Descr
,
HK_CANVAS_OPENGL
,
IS_ACCELERATOR
);
HK_CANVAS_OPENGL
);
AddMenuItem
(
viewMenu
,
ID_MENU_CANVAS_OPENGL
,
AddMenuItem
(
viewMenu
,
ID_MENU_CANVAS_OPENGL
,
text
,
_
(
"Switch the canvas implementation to OpenGL"
),
text
,
_
(
"Switch the canvas implementation to OpenGL"
),
KiBitmap
(
tools_xpm
)
);
KiBitmap
(
tools_xpm
)
);
text
=
AddHotkeyName
(
_
(
"&Switch canvas to Cairo"
),
g_Pcbnew_Editor_Hokeys_Descr
,
text
=
AddHotkeyName
(
_
(
"&Switch canvas to Cairo"
),
g_Pcbnew_Editor_Hokeys_Descr
,
HK_CANVAS_CAIRO
,
IS_ACCELERATOR
);
HK_CANVAS_CAIRO
);
AddMenuItem
(
viewMenu
,
ID_MENU_CANVAS_CAIRO
,
AddMenuItem
(
viewMenu
,
ID_MENU_CANVAS_CAIRO
,
text
,
_
(
"Switch the canvas implementation to Cairo"
),
text
,
_
(
"Switch the canvas implementation to Cairo"
),
KiBitmap
(
tools_xpm
)
);
KiBitmap
(
tools_xpm
)
);
/** Create Place Menu **/
/** Create Place Menu **/
wxMenu
*
placeMenu
=
new
wxMenu
;
wxMenu
*
placeMenu
=
new
wxMenu
;
// Module
// Module
text
=
AddHotkeyName
(
_
(
"&Module"
),
g_Pcbnew_Editor_Hokeys_Descr
,
text
=
AddHotkeyName
(
_
(
"&Module"
),
g_Pcbnew_Editor_Hokeys_Descr
,
HK_ADD_MODULE
,
IS_ACCELERATOR
);
HK_ADD_MODULE
);
AddMenuItem
(
placeMenu
,
ID_PCB_MODULE_BUTT
,
text
,
AddMenuItem
(
placeMenu
,
ID_PCB_MODULE_BUTT
,
text
,
_
(
"Add modules"
),
KiBitmap
(
module_xpm
)
);
_
(
"Add modules"
),
KiBitmap
(
module_xpm
)
);
// Track
// Track
text
=
AddHotkeyName
(
_
(
"&Track"
),
g_Pcbnew_Editor_Hokeys_Descr
,
text
=
AddHotkeyName
(
_
(
"&Track"
),
g_Pcbnew_Editor_Hokeys_Descr
,
HK_ADD_NEW_TRACK
,
IS_ACCELERATOR
);
HK_ADD_NEW_TRACK
);
AddMenuItem
(
placeMenu
,
ID_TRACK_BUTT
,
text
,
AddMenuItem
(
placeMenu
,
ID_TRACK_BUTT
,
text
,
_
(
"Add tracks and vias"
),
KiBitmap
(
add_tracks_xpm
)
);
_
(
"Add tracks and vias"
),
KiBitmap
(
add_tracks_xpm
)
);
...
...
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