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
6601495c
Commit
6601495c
authored
Jan 11, 2010
by
charras
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed mouse wheel not working if 3D frame under wxWidgets 2.9
parent
6eda97fb
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
50 deletions
+48
-50
3d_canvas.cpp
3d-viewer/3d_canvas.cpp
+46
-49
3d_viewer.h
3d-viewer/3d_viewer.h
+2
-1
No files found.
3d-viewer/3d_canvas.cpp
View file @
6601495c
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// Name: 3d_canvas.cpp
// Name: 3d_canvas.cpp
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation
#pragma interface
#endif
#include "fctsys.h"
#include "fctsys.h"
#include "trigo.h"
#include "trigo.h"
...
@@ -35,8 +28,13 @@
...
@@ -35,8 +28,13 @@
BEGIN_EVENT_TABLE
(
Pcb3D_GLCanvas
,
wxGLCanvas
)
BEGIN_EVENT_TABLE
(
Pcb3D_GLCanvas
,
wxGLCanvas
)
EVT_PAINT
(
Pcb3D_GLCanvas
::
OnPaint
)
EVT_PAINT
(
Pcb3D_GLCanvas
::
OnPaint
)
// key event:
EVT_CHAR
(
Pcb3D_GLCanvas
::
OnChar
)
EVT_CHAR
(
Pcb3D_GLCanvas
::
OnChar
)
EVT_MOUSE_EVENTS
(
Pcb3D_GLCanvas
::
OnMouseEvent
)
// mouse events
EVT_RIGHT_DOWN
(
Pcb3D_GLCanvas
::
OnRightClick
)
EVT_MOUSEWHEEL
(
Pcb3D_GLCanvas
::
OnMouseWheel
)
EVT_MOTION
(
Pcb3D_GLCanvas
::
OnMouseMove
)
// other events
EVT_ERASE_BACKGROUND
(
Pcb3D_GLCanvas
::
OnEraseBackground
)
EVT_ERASE_BACKGROUND
(
Pcb3D_GLCanvas
::
OnEraseBackground
)
EVT_MENU_RANGE
(
ID_POPUP_3D_VIEW_START
,
ID_POPUP_3D_VIEW_END
,
EVT_MENU_RANGE
(
ID_POPUP_3D_VIEW_START
,
ID_POPUP_3D_VIEW_END
,
Pcb3D_GLCanvas
::
OnPopUpMenu
)
Pcb3D_GLCanvas
::
OnPopUpMenu
)
...
@@ -205,61 +203,60 @@ void Pcb3D_GLCanvas::SetView3D( int keycode )
...
@@ -205,61 +203,60 @@ void Pcb3D_GLCanvas::SetView3D( int keycode )
Refresh
(
FALSE
);
Refresh
(
FALSE
);
}
}
void
Pcb3D_GLCanvas
::
OnMouseWheel
(
wxMouseEvent
&
event
)
void
Pcb3D_GLCanvas
::
OnMouseEvent
(
wxMouseEvent
&
event
)
{
{
wxSize
size
(
GetClientSize
()
);
wxSize
size
(
GetClientSize
()
);
double
spin_quat
[
4
];
if
(
event
.
ShiftDown
()
)
if
(
event
.
RightDown
()
)
{
{
OnRightClick
(
event
);
return
;
if
(
event
.
GetWheelRotation
()
<
0
)
{
/* up */
SetView3D
(
WXK_UP
);
}
else
{
/* down */
SetView3D
(
WXK_DOWN
);
}
}
}
else
if
(
event
.
ControlDown
()
)
if
(
event
.
m_wheelRotation
)
{
{
if
(
event
.
ShiftDown
()
)
if
(
event
.
GetWheelRotation
()
>
0
)
{
{
if
(
event
.
GetWheelRotation
()
<
0
)
/* right */
{
SetView3D
(
WXK_RIGHT
);
/* up */
SetView3D
(
WXK_UP
);
}
else
{
/* down */
SetView3D
(
WXK_DOWN
);
}
}
}
else
if
(
event
.
ControlDown
()
)
else
{
{
if
(
event
.
GetWheelRotation
()
>
0
)
/* left */
{
SetView3D
(
WXK_LEFT
);
/* right */
SetView3D
(
WXK_RIGHT
);
}
else
{
/* left */
SetView3D
(
WXK_LEFT
);
}
}
}
else
}
else
{
if
(
event
.
GetWheelRotation
()
>
0
)
{
{
if
(
event
.
GetWheelRotation
()
>
0
)
g_Parm_3D_Visu
.
m_Zoom
/=
1.4
;
{
if
(
g_Parm_3D_Visu
.
m_Zoom
<=
0.01
)
g_Parm_3D_Visu
.
m_Zoom
/=
1.4
;
g_Parm_3D_Visu
.
m_Zoom
=
0.01
;
if
(
g_Parm_3D_Visu
.
m_Zoom
<=
0.01
)
g_Parm_3D_Visu
.
m_Zoom
=
0.01
;
}
else
g_Parm_3D_Visu
.
m_Zoom
*=
1.4
;
DisplayStatus
();
Refresh
(
FALSE
);
}
}
else
g_Parm_3D_Visu
.
m_Zoom
*=
1.4
;
DisplayStatus
();
Refresh
(
FALSE
);
}
}
g_Parm_3D_Visu
.
m_Beginx
=
event
.
GetX
();
g_Parm_3D_Visu
.
m_Beginy
=
event
.
GetY
();
}
void
Pcb3D_GLCanvas
::
OnMouseMove
(
wxMouseEvent
&
event
)
{
wxSize
size
(
GetClientSize
()
);
double
spin_quat
[
4
];
if
(
event
.
Dragging
()
)
if
(
event
.
Dragging
()
)
{
{
if
(
event
.
LeftIsDown
()
)
if
(
event
.
LeftIsDown
()
)
...
...
3d-viewer/3d_viewer.h
View file @
6601495c
...
@@ -149,7 +149,8 @@ public:
...
@@ -149,7 +149,8 @@ public:
void
OnPaint
(
wxPaintEvent
&
event
);
void
OnPaint
(
wxPaintEvent
&
event
);
void
OnEraseBackground
(
wxEraseEvent
&
event
);
void
OnEraseBackground
(
wxEraseEvent
&
event
);
void
OnChar
(
wxKeyEvent
&
event
);
void
OnChar
(
wxKeyEvent
&
event
);
void
OnMouseEvent
(
wxMouseEvent
&
event
);
void
OnMouseWheel
(
wxMouseEvent
&
event
);
void
OnMouseMove
(
wxMouseEvent
&
event
);
void
OnRightClick
(
wxMouseEvent
&
event
);
void
OnRightClick
(
wxMouseEvent
&
event
);
void
OnPopUpMenu
(
wxCommandEvent
&
event
);
void
OnPopUpMenu
(
wxCommandEvent
&
event
);
void
TakeScreenshot
(
wxCommandEvent
&
event
);
void
TakeScreenshot
(
wxCommandEvent
&
event
);
...
...
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