Add zoom cursors

This commit is contained in:
Marek Roszko 2020-10-08 20:08:44 -04:00
parent 966730710e
commit 8fa42a74bd
6 changed files with 110 additions and 3 deletions

View File

@ -5,3 +5,5 @@ The following cursors were borrowed from the Inkspace project https://gitlab.com
- cursor-pencil.xpm - cursor-pencil.xpm
- cursor-select-m.xpm - cursor-select-m.xpm
- cursor-text.xpm - cursor-text.xpm
- cursor-zoom.xpm
- cursor-zoom-out.xpm

View File

@ -0,0 +1,38 @@
/* XPM */
static char const *cursor_zoom_out_xpm[] = {
"32 32 3 1 6 6",
" c None",
". c #FFFFFF",
"+ c #000000",
" ... ",
" ..+++.. ",
" .++ ++. ",
" .+ +. ",
" .+ +. ",
".+ ..... +. ",
".+ +++++ +. ",
".+ ..... +. ",
" .+ +. ",
" .+ +. ",
" .++ ++.+.. ",
" ..+++..+.++. ",
" ... .+ +. ",
" .+ +. ",
" .+ +. ",
" .+ +. ",
" .+ +. ",
" .+ +. ",
" .++. ",
" .. ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" "};

View File

@ -0,0 +1,38 @@
/* XPM */
static char const *cursor_zoom_xpm[] = {
"32 32 3 1 6 6",
" c None",
". c #FFFFFF",
"+ c #000000",
" ... ",
" ..+++.. ",
" .++ ++. ",
" .+ +. ",
" .+ .+. +. ",
".+ ..+.. +. ",
".+ +++++ +. ",
".+ ..+.. +. ",
" .+ .+. +. ",
" .+ +. ",
" .++ ++.+.. ",
" ..+++..+.++. ",
" ... .+ +. ",
" .+ +. ",
" .+ +. ",
" .+ +. ",
" .+ +. ",
" .+ +. ",
" .++. ",
" .. ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" "};

View File

@ -34,6 +34,8 @@
#include <cursors/cursor-subtract.xpm> #include <cursors/cursor-subtract.xpm>
#include <cursors/cursor-text.xpm> #include <cursors/cursor-text.xpm>
#include <cursors/cursor-xor.xpm> #include <cursors/cursor-xor.xpm>
#include <cursors/cursor-zoom.xpm>
#include <cursors/cursor-zoom-out.xpm>
#include <wx/bitmap.h> #include <wx/bitmap.h>
#include <wx/debug.h> #include <wx/debug.h>
@ -177,6 +179,22 @@ static const std::vector<CURSOR_STORE::CURSOR_DEF> standard_cursors = {
{ 32, 32 }, { 32, 32 },
{ 7, 10 }, { 7, 10 },
}, },
{
KICURSOR::ZOOM_IN,
nullptr,
nullptr,
cursor_zoom_xpm,
{ 32, 32 },
{ 6, 6 },
},
{
KICURSOR::ZOOM_OUT,
nullptr,
nullptr,
cursor_zoom_out_xpm,
{ 32, 32 },
{ 6, 6 },
},
}; };

View File

@ -49,9 +49,18 @@ int ZOOM_TOOL::Main( const TOOL_EVENT& aEvent )
std::string tool = aEvent.GetCommandStr().get(); std::string tool = aEvent.GetCommandStr().get();
m_frame->PushTool( tool ); m_frame->PushTool( tool );
auto setCursor =
[&]()
{
m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::ZOOM_IN );
};
// Set initial cursor
setCursor();
while( TOOL_EVENT* evt = Wait() ) while( TOOL_EVENT* evt = Wait() )
{ {
m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::ARROW ); setCursor();
if( evt->IsCancelInteractive() || evt->IsActivate() ) if( evt->IsCancelInteractive() || evt->IsActivate() )
break; break;

View File

@ -47,7 +47,9 @@ enum class KICURSOR
MEASURE, MEASURE,
ADD, ADD,
SUBTRACT, SUBTRACT,
XOR XOR,
ZOOM_IN,
ZOOM_OUT
}; };
/** /**