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
4868af8b
Commit
4868af8b
authored
Apr 23, 2013
by
Maciej Suminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changed view control settings to KiCad default (panning, zooming, etc.)
parent
ced0d8ad
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
28 deletions
+29
-28
cairo_gal.cpp
common/gal/cairo/cairo_gal.cpp
+2
-0
opengl_gal.cpp
common/gal/opengl/opengl_gal.cpp
+2
-0
wx_view_controls.cpp
common/view/wx_view_controls.cpp
+25
-28
No files found.
common/gal/cairo/cairo_gal.cpp
View file @
4868af8b
...
@@ -61,6 +61,8 @@ CAIRO_GAL::CAIRO_GAL( wxWindow* aParent, wxEvtHandler* aMouseListener,
...
@@ -61,6 +61,8 @@ CAIRO_GAL::CAIRO_GAL( wxWindow* aParent, wxEvtHandler* aMouseListener,
Connect
(
wxEVT_RIGHT_UP
,
wxMouseEventHandler
(
CAIRO_GAL
::
skipMouseEvent
)
);
Connect
(
wxEVT_RIGHT_UP
,
wxMouseEventHandler
(
CAIRO_GAL
::
skipMouseEvent
)
);
Connect
(
wxEVT_LEFT_DOWN
,
wxMouseEventHandler
(
CAIRO_GAL
::
skipMouseEvent
)
);
Connect
(
wxEVT_LEFT_DOWN
,
wxMouseEventHandler
(
CAIRO_GAL
::
skipMouseEvent
)
);
Connect
(
wxEVT_LEFT_UP
,
wxMouseEventHandler
(
CAIRO_GAL
::
skipMouseEvent
)
);
Connect
(
wxEVT_LEFT_UP
,
wxMouseEventHandler
(
CAIRO_GAL
::
skipMouseEvent
)
);
Connect
(
wxEVT_MIDDLE_DOWN
,
wxMouseEventHandler
(
CAIRO_GAL
::
skipMouseEvent
)
);
Connect
(
wxEVT_MIDDLE_UP
,
wxMouseEventHandler
(
CAIRO_GAL
::
skipMouseEvent
)
);
#if defined _WIN32 || defined _WIN64
#if defined _WIN32 || defined _WIN64
Connect
(
wxEVT_ENTER_WINDOW
,
wxMouseEventHandler
(
CAIRO_GAL
::
skipMouseEvent
)
);
Connect
(
wxEVT_ENTER_WINDOW
,
wxMouseEventHandler
(
CAIRO_GAL
::
skipMouseEvent
)
);
#endif
#endif
...
...
common/gal/opengl/opengl_gal.cpp
View file @
4868af8b
...
@@ -90,6 +90,8 @@ OPENGL_GAL::OPENGL_GAL( wxWindow* aParent, wxEvtHandler* aMouseListener,
...
@@ -90,6 +90,8 @@ OPENGL_GAL::OPENGL_GAL( wxWindow* aParent, wxEvtHandler* aMouseListener,
Connect
(
wxEVT_RIGHT_UP
,
wxMouseEventHandler
(
OPENGL_GAL
::
skipMouseEvent
)
);
Connect
(
wxEVT_RIGHT_UP
,
wxMouseEventHandler
(
OPENGL_GAL
::
skipMouseEvent
)
);
Connect
(
wxEVT_LEFT_DOWN
,
wxMouseEventHandler
(
OPENGL_GAL
::
skipMouseEvent
)
);
Connect
(
wxEVT_LEFT_DOWN
,
wxMouseEventHandler
(
OPENGL_GAL
::
skipMouseEvent
)
);
Connect
(
wxEVT_LEFT_UP
,
wxMouseEventHandler
(
OPENGL_GAL
::
skipMouseEvent
)
);
Connect
(
wxEVT_LEFT_UP
,
wxMouseEventHandler
(
OPENGL_GAL
::
skipMouseEvent
)
);
Connect
(
wxEVT_MIDDLE_DOWN
,
wxMouseEventHandler
(
OPENGL_GAL
::
skipMouseEvent
)
);
Connect
(
wxEVT_MIDDLE_UP
,
wxMouseEventHandler
(
OPENGL_GAL
::
skipMouseEvent
)
);
#if defined _WIN32 || defined _WIN64
#if defined _WIN32 || defined _WIN64
Connect
(
wxEVT_ENTER_WINDOW
,
wxMouseEventHandler
(
OPENGL_GAL
::
skipMouseEvent
)
);
Connect
(
wxEVT_ENTER_WINDOW
,
wxMouseEventHandler
(
OPENGL_GAL
::
skipMouseEvent
)
);
#endif
#endif
...
...
common/view/wx_view_controls.cpp
View file @
4868af8b
...
@@ -42,9 +42,9 @@ WX_VIEW_CONTROLS::WX_VIEW_CONTROLS( VIEW* aView, wxWindow* aParentPanel ) :
...
@@ -42,9 +42,9 @@ WX_VIEW_CONTROLS::WX_VIEW_CONTROLS( VIEW* aView, wxWindow* aParentPanel ) :
WX_VIEW_CONTROLS
::
onMotion
),
NULL
,
this
);
WX_VIEW_CONTROLS
::
onMotion
),
NULL
,
this
);
m_parentPanel
->
Connect
(
wxEVT_MOUSEWHEEL
,
wxMouseEventHandler
(
m_parentPanel
->
Connect
(
wxEVT_MOUSEWHEEL
,
wxMouseEventHandler
(
WX_VIEW_CONTROLS
::
onWheel
),
NULL
,
this
);
WX_VIEW_CONTROLS
::
onWheel
),
NULL
,
this
);
m_parentPanel
->
Connect
(
wxEVT_
RIGHT
_UP
,
wxMouseEventHandler
(
m_parentPanel
->
Connect
(
wxEVT_
MIDDLE
_UP
,
wxMouseEventHandler
(
WX_VIEW_CONTROLS
::
onButton
),
NULL
,
this
);
WX_VIEW_CONTROLS
::
onButton
),
NULL
,
this
);
m_parentPanel
->
Connect
(
wxEVT_
RIGHT
_DOWN
,
wxMouseEventHandler
(
m_parentPanel
->
Connect
(
wxEVT_
MIDDLE
_DOWN
,
wxMouseEventHandler
(
WX_VIEW_CONTROLS
::
onButton
),
NULL
,
this
);
WX_VIEW_CONTROLS
::
onButton
),
NULL
,
this
);
#if defined _WIN32 || defined _WIN64
#if defined _WIN32 || defined _WIN64
m_parentPanel
->
Connect
(
wxEVT_ENTER_WINDOW
,
wxMouseEventHandler
(
m_parentPanel
->
Connect
(
wxEVT_ENTER_WINDOW
,
wxMouseEventHandler
(
...
@@ -55,10 +55,6 @@ WX_VIEW_CONTROLS::WX_VIEW_CONTROLS( VIEW* aView, wxWindow* aParentPanel ) :
...
@@ -55,10 +55,6 @@ WX_VIEW_CONTROLS::WX_VIEW_CONTROLS( VIEW* aView, wxWindow* aParentPanel ) :
void
WX_VIEW_CONTROLS
::
onMotion
(
wxMouseEvent
&
event
)
void
WX_VIEW_CONTROLS
::
onMotion
(
wxMouseEvent
&
event
)
{
{
// workaround for wxmsw..
//if( event.Entering() )
//m_parentPanel->SetFocus();
if
(
event
.
Dragging
()
&&
m_isDragPanning
)
if
(
event
.
Dragging
()
&&
m_isDragPanning
)
{
{
VECTOR2D
mousePoint
(
event
.
GetX
(),
event
.
GetY
()
);
VECTOR2D
mousePoint
(
event
.
GetX
(),
event
.
GetY
()
);
...
@@ -77,8 +73,28 @@ void WX_VIEW_CONTROLS::onWheel( wxMouseEvent& event )
...
@@ -77,8 +73,28 @@ void WX_VIEW_CONTROLS::onWheel( wxMouseEvent& event )
{
{
const
double
wheelPanSpeed
=
0.001
;
const
double
wheelPanSpeed
=
0.001
;
if
(
event
.
ControlDown
()
)
if
(
event
.
ControlDown
()
||
event
.
ShiftDown
()
)
{
// Scrolling
VECTOR2D
scrollVec
=
m_view
->
ToWorld
(
m_view
->
GetScreenPixelSize
()
*
(
(
double
)
event
.
GetWheelRotation
()
*
wheelPanSpeed
),
false
);
double
scrollSpeed
;
if
(
abs
(
scrollVec
.
x
)
>
abs
(
scrollVec
.
y
)
)
scrollSpeed
=
scrollVec
.
x
;
else
scrollSpeed
=
scrollVec
.
y
;
VECTOR2D
t
=
m_view
->
GetScreenPixelSize
();
VECTOR2D
delta
(
event
.
ControlDown
()
?
-
scrollSpeed
:
0.0
,
event
.
ShiftDown
()
?
-
scrollSpeed
:
0.0
);
m_view
->
SetCenter
(
m_view
->
GetCenter
()
+
delta
);
m_parentPanel
->
Refresh
();
}
else
{
{
// Zooming
wxLongLong
timeStamp
=
wxGetLocalTimeMillis
();
wxLongLong
timeStamp
=
wxGetLocalTimeMillis
();
double
timeDiff
=
timeStamp
.
ToDouble
()
-
m_timeStamp
.
ToDouble
();
double
timeDiff
=
timeStamp
.
ToDouble
()
-
m_timeStamp
.
ToDouble
();
...
@@ -96,29 +112,10 @@ void WX_VIEW_CONTROLS::onWheel( wxMouseEvent& event )
...
@@ -96,29 +112,10 @@ void WX_VIEW_CONTROLS::onWheel( wxMouseEvent& event )
zoomScale
=
(
event
.
GetWheelRotation
()
>
0.0
)
?
1.05
:
0.95
;
zoomScale
=
(
event
.
GetWheelRotation
()
>
0.0
)
?
1.05
:
0.95
;
}
}
VECTOR2D
anchor
=
m_view
->
ToWorld
(
VECTOR2D
(
event
.
GetX
(),
event
.
GetY
()
)
);
VECTOR2D
anchor
=
m_view
->
ToWorld
(
VECTOR2D
(
event
.
GetX
(),
event
.
GetY
()
)
);
m_view
->
SetScale
(
m_view
->
GetScale
()
*
zoomScale
,
anchor
);
m_view
->
SetScale
(
m_view
->
GetScale
()
*
zoomScale
,
anchor
);
m_parentPanel
->
Refresh
();
m_parentPanel
->
Refresh
();
}
}
else
{
VECTOR2D
scrollVec
=
m_view
->
ToWorld
(
m_view
->
GetScreenPixelSize
()
*
(
(
double
)
event
.
GetWheelRotation
()
*
wheelPanSpeed
),
false
);
double
scrollSpeed
;
if
(
abs
(
scrollVec
.
x
)
>
abs
(
scrollVec
.
y
)
)
scrollSpeed
=
scrollVec
.
x
;
else
scrollSpeed
=
scrollVec
.
y
;
VECTOR2D
t
=
m_view
->
GetScreenPixelSize
();
VECTOR2D
delta
(
event
.
ShiftDown
()
?
scrollSpeed
:
0.0
,
!
event
.
ShiftDown
()
?
scrollSpeed
:
0.0
);
m_view
->
SetCenter
(
m_view
->
GetCenter
()
+
delta
);
m_parentPanel
->
Refresh
();
}
event
.
Skip
();
event
.
Skip
();
}
}
...
@@ -126,13 +123,13 @@ void WX_VIEW_CONTROLS::onWheel( wxMouseEvent& event )
...
@@ -126,13 +123,13 @@ void WX_VIEW_CONTROLS::onWheel( wxMouseEvent& event )
void
WX_VIEW_CONTROLS
::
onButton
(
wxMouseEvent
&
event
)
void
WX_VIEW_CONTROLS
::
onButton
(
wxMouseEvent
&
event
)
{
{
if
(
event
.
Right
Down
()
)
if
(
event
.
Middle
Down
()
)
{
{
m_isDragPanning
=
true
;
m_isDragPanning
=
true
;
m_dragStartPoint
=
VECTOR2D
(
event
.
GetX
(),
event
.
GetY
()
);
m_dragStartPoint
=
VECTOR2D
(
event
.
GetX
(),
event
.
GetY
()
);
m_lookStartPoint
=
m_view
->
GetCenter
();
m_lookStartPoint
=
m_view
->
GetCenter
();
}
}
else
if
(
event
.
Right
Up
()
)
else
if
(
event
.
Middle
Up
()
)
{
{
m_isDragPanning
=
false
;
m_isDragPanning
=
false
;
}
}
...
...
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