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
65c11662
Commit
65c11662
authored
Jul 09, 2014
by
Maciej Suminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added support for changing the cursor size.
parent
15f5c228
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
66 additions
and
6 deletions
+66
-6
cairo_gal.cpp
common/gal/cairo/cairo_gal.cpp
+16
-0
cairo_gal.h
include/gal/cairo/cairo_gal.h
+3
-0
graphics_abstraction_layer.h
include/gal/graphics_abstraction_layer.h
+11
-1
common_actions.cpp
pcbnew/tools/common_actions.cpp
+15
-5
common_actions.h
pcbnew/tools/common_actions.h
+1
-0
pcbnew_control.cpp
pcbnew/tools/pcbnew_control.cpp
+19
-0
pcbnew_control.h
pcbnew/tools/pcbnew_control.h
+1
-0
No files found.
common/gal/cairo/cairo_gal.cpp
View file @
65c11662
...
...
@@ -75,6 +75,9 @@ CAIRO_GAL::CAIRO_GAL( wxWindow* aParent, wxEvtHandler* aMouseListener,
SetSize
(
aParent
->
GetSize
()
);
screenSize
=
VECTOR2I
(
aParent
->
GetSize
()
);
cursorPixels
=
NULL
;
cursorPixelsSaved
=
NULL
;
initCursor
();
// Grid color settings are different in Cairo and OpenGL
...
...
@@ -808,6 +811,13 @@ void CAIRO_GAL::ClearTarget( RENDER_TARGET aTarget )
}
void
CAIRO_GAL
::
SetCursorSize
(
unsigned
int
aCursorSize
)
{
GAL
::
SetCursorSize
(
aCursorSize
);
initCursor
();
}
void
CAIRO_GAL
::
DrawCursor
(
const
VECTOR2D
&
aCursorPosition
)
{
// Now we should only store the position of the mouse cursor
...
...
@@ -890,6 +900,12 @@ void CAIRO_GAL::skipMouseEvent( wxMouseEvent& aEvent )
void
CAIRO_GAL
::
initCursor
()
{
if
(
cursorPixels
)
delete
cursorPixels
;
if
(
cursorPixelsSaved
)
delete
cursorPixelsSaved
;
cursorPixels
=
new
wxBitmap
(
cursorSize
,
cursorSize
);
cursorPixelsSaved
=
new
wxBitmap
(
cursorSize
,
cursorSize
);
...
...
include/gal/cairo/cairo_gal.h
View file @
65c11662
...
...
@@ -229,6 +229,9 @@ public:
// Cursor
// -------
/// @copydoc GAL::SetCursorSize()
virtual
void
SetCursorSize
(
unsigned
int
aCursorSize
);
/// @copydoc GAL::DrawCursor()
virtual
void
DrawCursor
(
const
VECTOR2D
&
aCursorPosition
);
...
...
include/gal/graphics_abstraction_layer.h
View file @
65c11662
...
...
@@ -783,12 +783,22 @@ public:
cursorColor
=
aCursorColor
;
}
/**
* @brief Returns the cursor size.
*
* @return The current cursor size (in pixels).
*/
inline
unsigned
int
GetCursorSize
()
const
{
return
cursorSize
;
}
/**
* @brief Set the cursor size.
*
* @param aCursorSize is the size of the cursor expressed in pixels.
*/
inline
void
SetCursorSize
(
unsigned
int
aCursorSize
)
virtual
inline
void
SetCursorSize
(
unsigned
int
aCursorSize
)
{
cursorSize
=
aCursorSize
;
}
...
...
pcbnew/tools/common_actions.cpp
View file @
65c11662
...
...
@@ -29,13 +29,16 @@
// Selection tool actions
TOOL_ACTION
COMMON_ACTIONS
::
selectionActivate
(
"pcbnew.InteractiveSelection"
,
AS_GLOBAL
,
0
,
""
,
""
,
AF_ACTIVATE
);
// No description, it is not supposed to be shown anywhere
AS_GLOBAL
,
0
,
""
,
""
,
AF_ACTIVATE
);
// No description, it is not supposed to be shown anywhere
TOOL_ACTION
COMMON_ACTIONS
::
selectionSingle
(
"pcbnew.InteractiveSelection.Single"
,
AS_GLOBAL
,
0
,
""
,
""
);
// No description, it is not supposed to be shown anywhere
AS_GLOBAL
,
0
,
""
,
""
);
// No description, it is not supposed to be shown anywhere
TOOL_ACTION
COMMON_ACTIONS
::
selectionClear
(
"pcbnew.InteractiveSelection.Clear"
,
AS_GLOBAL
,
0
,
""
,
""
);
// No description, it is not supposed to be shown anywhere
AS_GLOBAL
,
0
,
""
,
""
);
// No description, it is not supposed to be shown anywhere
// Edit tool actions
...
...
@@ -287,6 +290,10 @@ TOOL_ACTION COMMON_ACTIONS::resetCoords( "pcbnew.Control.resetCoords",
AS_GLOBAL
,
' '
,
""
,
""
);
TOOL_ACTION
COMMON_ACTIONS
::
switchCursor
(
"pcbnew.Control.switchCursor"
,
AS_GLOBAL
,
0
,
""
,
""
);
TOOL_ACTION
COMMON_ACTIONS
::
switchUnits
(
"pcbnew.Control.switchUnits"
,
AS_GLOBAL
,
MD_CTRL
+
int
(
'U'
),
""
,
""
);
...
...
@@ -304,7 +311,8 @@ TOOL_ACTION COMMON_ACTIONS::routerActivate( "pcbnew.InteractiveRouter",
"Run push & shove router"
,
"Run push & shove router"
,
AF_ACTIVATE
);
TOOL_ACTION
COMMON_ACTIONS
::
pointEditorUpdate
(
"pcbnew.PointEditor.update"
,
AS_GLOBAL
,
0
,
""
,
""
);
// No description, it is not supposed to be shown anywhere
AS_GLOBAL
,
0
,
""
,
""
);
// No description, it is not supposed to be shown anywhere
// Placement tool
...
...
@@ -420,6 +428,9 @@ boost::optional<TOOL_EVENT> COMMON_ACTIONS::TranslateLegacyId( int aId )
case
ID_TB_OPTIONS_SHOW_HIGH_CONTRAST_MODE
:
return
COMMON_ACTIONS
::
highContrastMode
.
MakeEvent
();
case
ID_TB_OPTIONS_SELECT_CURSOR
:
return
COMMON_ACTIONS
::
switchCursor
.
MakeEvent
();
case
ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH
:
case
ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH
:
case
ID_PCB_DELETE_ITEM_BUTT
:
...
...
@@ -427,7 +438,6 @@ boost::optional<TOOL_EVENT> COMMON_ACTIONS::TranslateLegacyId( int aId )
case
ID_PCB_SHOW_1_RATSNEST_BUTT
:
case
ID_PCB_PLACE_OFFSET_COORD_BUTT
:
case
ID_TB_OPTIONS_SHOW_MODULE_RATSNEST
:
case
ID_TB_OPTIONS_SELECT_CURSOR
:
case
ID_TB_OPTIONS_SHOW_EXTRA_VERTICAL_TOOLBAR_MICROWAVE
:
case
ID_MENU_PCB_SHOW_HIDE_MUWAVE_TOOLBAR
:
case
ID_MICROWAVE_V_TOOLBAR
:
...
...
pcbnew/tools/common_actions.h
View file @
65c11662
...
...
@@ -189,6 +189,7 @@ public:
// Miscellaneous
static
TOOL_ACTION
resetCoords
;
static
TOOL_ACTION
switchCursor
;
static
TOOL_ACTION
switchUnits
;
static
TOOL_ACTION
showHelp
;
static
TOOL_ACTION
toBeDone
;
...
...
pcbnew/tools/pcbnew_control.cpp
View file @
65c11662
...
...
@@ -541,6 +541,24 @@ int PCBNEW_CONTROL::ResetCoords( TOOL_EVENT& aEvent )
}
int
PCBNEW_CONTROL
::
SwitchCursor
(
TOOL_EVENT
&
aEvent
)
{
const
unsigned
int
BIG_CURSOR
=
4000
;
const
unsigned
int
SMALL_CURSOR
=
80
;
KIGFX
::
GAL
*
gal
=
getEditFrame
<
PCB_BASE_FRAME
>
()
->
GetGalCanvas
()
->
GetGAL
();
if
(
gal
->
GetCursorSize
()
==
BIG_CURSOR
)
gal
->
SetCursorSize
(
SMALL_CURSOR
);
else
gal
->
SetCursorSize
(
BIG_CURSOR
);
setTransitions
();
return
0
;
}
int
PCBNEW_CONTROL
::
SwitchUnits
(
TOOL_EVENT
&
aEvent
)
{
// TODO should not it be refactored to pcb_frame member function?
...
...
@@ -621,6 +639,7 @@ void PCBNEW_CONTROL::setTransitions()
// Miscellaneous
Go
(
&
PCBNEW_CONTROL
::
ResetCoords
,
COMMON_ACTIONS
::
resetCoords
.
MakeEvent
()
);
Go
(
&
PCBNEW_CONTROL
::
SwitchCursor
,
COMMON_ACTIONS
::
switchCursor
.
MakeEvent
()
);
Go
(
&
PCBNEW_CONTROL
::
SwitchUnits
,
COMMON_ACTIONS
::
switchUnits
.
MakeEvent
()
);
Go
(
&
PCBNEW_CONTROL
::
ShowHelp
,
COMMON_ACTIONS
::
showHelp
.
MakeEvent
()
);
Go
(
&
PCBNEW_CONTROL
::
ToBeDone
,
COMMON_ACTIONS
::
toBeDone
.
MakeEvent
()
);
...
...
pcbnew/tools/pcbnew_control.h
View file @
65c11662
...
...
@@ -90,6 +90,7 @@ public:
// Miscellaneous
int
ResetCoords
(
TOOL_EVENT
&
aEvent
);
int
SwitchCursor
(
TOOL_EVENT
&
aEvent
);
int
SwitchUnits
(
TOOL_EVENT
&
aEvent
);
int
ShowHelp
(
TOOL_EVENT
&
aEvent
);
int
ToBeDone
(
TOOL_EVENT
&
aEvent
);
...
...
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