Implement more context specific cursors using both stock and custom cursors.
This commit is contained in:
parent
50405b558e
commit
d9485129c8
|
@ -0,0 +1,7 @@
|
||||||
|
The following cursors were borrowed by the Inkspace project https://gitlab.com/inkscape/inkscape/
|
||||||
|
- cursor-connector.xpm
|
||||||
|
- cursor-eraser.xpm
|
||||||
|
- cursor-measure.xpm
|
||||||
|
- cursor-pencil.xpm
|
||||||
|
- cursor-select-m.xpm
|
||||||
|
- cursor-text.xpm
|
|
@ -0,0 +1,38 @@
|
||||||
|
/* XPM */
|
||||||
|
static char const *cursor_add_xpm[] = {
|
||||||
|
"32 32 3 1",
|
||||||
|
" c None",
|
||||||
|
"! c black",
|
||||||
|
"# c white",
|
||||||
|
" # ",
|
||||||
|
" #!# ",
|
||||||
|
" #!# ",
|
||||||
|
" #!# ",
|
||||||
|
" #!# ",
|
||||||
|
" #!# ",
|
||||||
|
" ##### ##### ",
|
||||||
|
"#!!!!! !!!!!# ",
|
||||||
|
" ##### ##### ",
|
||||||
|
" #!# ",
|
||||||
|
" #!# ",
|
||||||
|
" #!# ",
|
||||||
|
" #!# ",
|
||||||
|
" #!# ",
|
||||||
|
" # ## ",
|
||||||
|
" #!!# ",
|
||||||
|
" ##!!## ",
|
||||||
|
" #!!!!!!# ",
|
||||||
|
" #!!!!!!# ",
|
||||||
|
" ##!!## ",
|
||||||
|
" #!!# ",
|
||||||
|
" ## ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" "};
|
|
@ -0,0 +1,38 @@
|
||||||
|
/* XPM */
|
||||||
|
static const char * cursor_connector_xpm[] = {
|
||||||
|
"32 32 3 1 1 1",
|
||||||
|
" c None",
|
||||||
|
". c #FFFFFF",
|
||||||
|
"+ c #000000",
|
||||||
|
" ... ",
|
||||||
|
" .+. ",
|
||||||
|
" .+. ",
|
||||||
|
"....+.... ",
|
||||||
|
".+++ +++. ... ",
|
||||||
|
"....+.... .+. ",
|
||||||
|
" .+. .+. ",
|
||||||
|
" .+. .+. ",
|
||||||
|
" ... .+. ",
|
||||||
|
" .+. ",
|
||||||
|
" .+. ",
|
||||||
|
" .+. ",
|
||||||
|
" .+. ",
|
||||||
|
" ...........+. ",
|
||||||
|
" .+++++++++++. ",
|
||||||
|
" .+........... ",
|
||||||
|
" .+. ",
|
||||||
|
" .+. ",
|
||||||
|
" ...+... ",
|
||||||
|
" .+++++. ",
|
||||||
|
" .+++. ",
|
||||||
|
" .+. ",
|
||||||
|
" . ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" "};
|
|
@ -0,0 +1,38 @@
|
||||||
|
/* XPM */
|
||||||
|
static const char * cursor_eraser_xpm[] = {
|
||||||
|
"32 32 3 1 4 4",
|
||||||
|
" c None",
|
||||||
|
". c #FFFFFF",
|
||||||
|
"+ c #000000",
|
||||||
|
" ... ",
|
||||||
|
" .+. ",
|
||||||
|
" .+. ",
|
||||||
|
"....+.... ",
|
||||||
|
".+++ +++. ",
|
||||||
|
"....+.... ... ",
|
||||||
|
" .+. .+++. ",
|
||||||
|
" .+. .+...+. ",
|
||||||
|
" ... .+.....+. ",
|
||||||
|
" .+.......+. ",
|
||||||
|
" .+.........+. ",
|
||||||
|
" .++..........+. ",
|
||||||
|
" .++...........+. ",
|
||||||
|
" .+.+...........+. ",
|
||||||
|
" .+..+..........++. ",
|
||||||
|
" .+...+.........++. ",
|
||||||
|
" .+...+.......+.+. ",
|
||||||
|
" .+...+.....+..+. ",
|
||||||
|
" .+...+...+...+. ",
|
||||||
|
" .+...+++...+. ",
|
||||||
|
" .+...+...+. ",
|
||||||
|
" .+..+..+. ",
|
||||||
|
" .+.+.+. ",
|
||||||
|
" .+++. ",
|
||||||
|
" ... ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" "};
|
|
@ -0,0 +1,38 @@
|
||||||
|
/* XPM */
|
||||||
|
static char const *cursor_measure_xpm[] = {
|
||||||
|
"32 32 3 1 4 4",
|
||||||
|
" c None",
|
||||||
|
". c #FFFFFF",
|
||||||
|
"+ c #000000",
|
||||||
|
" ... ",
|
||||||
|
" .+. ",
|
||||||
|
" .+. ",
|
||||||
|
"....+.... ",
|
||||||
|
".+++ +++. ",
|
||||||
|
"....+.... ",
|
||||||
|
" .+. ",
|
||||||
|
" .+. .. ",
|
||||||
|
" ... .++. ",
|
||||||
|
" .+..+. ",
|
||||||
|
" .+....+. ",
|
||||||
|
" .+..+...+. ",
|
||||||
|
" .+.+.....+. ",
|
||||||
|
" .+.......+. ",
|
||||||
|
" .+.+.....+. ",
|
||||||
|
" .+...+...+. ",
|
||||||
|
" .+.+.....+. ",
|
||||||
|
" .+.......+. ",
|
||||||
|
" .+.+.....+. ",
|
||||||
|
" .+...+...+. ",
|
||||||
|
" .+.+.....+. ",
|
||||||
|
" .+.......+. ",
|
||||||
|
" .+.+.....+. ",
|
||||||
|
" .+...+.+. ",
|
||||||
|
" .+.+.+. ",
|
||||||
|
" .+.+. ",
|
||||||
|
" .+. ",
|
||||||
|
" . ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" "};
|
|
@ -0,0 +1,38 @@
|
||||||
|
/* XPM */
|
||||||
|
static const char * cursor_pencil_xpm[] = {
|
||||||
|
"32 32 3 1 4 4",
|
||||||
|
" c None",
|
||||||
|
". c #FFFFFF",
|
||||||
|
"+ c #000000",
|
||||||
|
" ... ",
|
||||||
|
" .+. ",
|
||||||
|
" .+. ",
|
||||||
|
"....+.... ",
|
||||||
|
".+++ +++. ",
|
||||||
|
"....+.... ",
|
||||||
|
" .+. ",
|
||||||
|
" .+. ... ",
|
||||||
|
" ... .++... ",
|
||||||
|
" .+++++... ",
|
||||||
|
" .+++.+++.. ",
|
||||||
|
" .++.....++. ",
|
||||||
|
" .+........+. ",
|
||||||
|
" .+......+.+. ",
|
||||||
|
" .+....+++..+. ",
|
||||||
|
" .+...+...+..+. ",
|
||||||
|
" .+..+....+..+. ",
|
||||||
|
" .+.++.....+..+. ",
|
||||||
|
" .+..+.....+. +. ",
|
||||||
|
" .+..+.....+. ",
|
||||||
|
" .+..+... .+. ",
|
||||||
|
" .+..+. . . ",
|
||||||
|
" .+..+. . ",
|
||||||
|
" .+ .+. ",
|
||||||
|
" .+ . ",
|
||||||
|
" . ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" "};
|
|
@ -0,0 +1,38 @@
|
||||||
|
/* XPM */
|
||||||
|
static char const *cursor_select_m_xpm[] = {
|
||||||
|
"32 32 3 1 1 1",
|
||||||
|
" c None",
|
||||||
|
". c #000000",
|
||||||
|
"+ c #FFFFFF",
|
||||||
|
". ",
|
||||||
|
".. ",
|
||||||
|
".+. ",
|
||||||
|
".++. ",
|
||||||
|
".+++. ",
|
||||||
|
".++++. ",
|
||||||
|
".+++++. ",
|
||||||
|
".++++++. ",
|
||||||
|
".+++++++. ",
|
||||||
|
".++++++++. ",
|
||||||
|
".+++++++++. ",
|
||||||
|
".++++++..... ",
|
||||||
|
".++++++. ",
|
||||||
|
".++..++. ",
|
||||||
|
".+. .+++. ",
|
||||||
|
".. .++. ",
|
||||||
|
". .+++. + ",
|
||||||
|
" .+. +.+ ",
|
||||||
|
" .. +...+ ",
|
||||||
|
" +.....+ ",
|
||||||
|
" + ++.++ + ",
|
||||||
|
" +.+ +.+ +.+ ",
|
||||||
|
" +..+++.+++..+ ",
|
||||||
|
" +.............+ ",
|
||||||
|
" +..+++.+++..+ ",
|
||||||
|
" +.+ +.+ +.+ ",
|
||||||
|
" + ++.++ + ",
|
||||||
|
" +.....+ ",
|
||||||
|
" +...+ ",
|
||||||
|
" +.+ ",
|
||||||
|
" + ",
|
||||||
|
" "};
|
|
@ -0,0 +1,38 @@
|
||||||
|
/* XPM */
|
||||||
|
static char const *cursor_subtract_xpm[] = {
|
||||||
|
"32 32 3 1",
|
||||||
|
" c None",
|
||||||
|
"! c black",
|
||||||
|
"# c white",
|
||||||
|
" # ",
|
||||||
|
" #!# ",
|
||||||
|
" #!# ",
|
||||||
|
" #!# ",
|
||||||
|
" #!# ",
|
||||||
|
" #!# ",
|
||||||
|
" ##### ##### ",
|
||||||
|
"#!!!!! !!!!!# ",
|
||||||
|
" ##### ##### ",
|
||||||
|
" #!# ",
|
||||||
|
" #!# ",
|
||||||
|
" #!# ",
|
||||||
|
" #!# ",
|
||||||
|
" #!# ",
|
||||||
|
" # ",
|
||||||
|
" ",
|
||||||
|
" ###### ",
|
||||||
|
" #!!!!!!# ",
|
||||||
|
" #!!!!!!# ",
|
||||||
|
" ###### ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" "};
|
|
@ -0,0 +1,38 @@
|
||||||
|
/* XPM */
|
||||||
|
static char const *cursor_text_xpm[] = {
|
||||||
|
"32 32 3 1",
|
||||||
|
" c None",
|
||||||
|
"! c black",
|
||||||
|
"# c white",
|
||||||
|
" # ",
|
||||||
|
" #!# ",
|
||||||
|
" #!# ",
|
||||||
|
" #!# ",
|
||||||
|
" #!# ",
|
||||||
|
" #!# ",
|
||||||
|
" ##### ##### ",
|
||||||
|
"#!!!!! !!!!!# ",
|
||||||
|
" ##### ##### ",
|
||||||
|
" #!# ",
|
||||||
|
" #!# ",
|
||||||
|
" #!# #### ",
|
||||||
|
" #!# #!!!!# ",
|
||||||
|
" #!# #!!!!# ",
|
||||||
|
" # #!!!!!!# ",
|
||||||
|
" #!!!!!!# ",
|
||||||
|
" #!!##!!# ",
|
||||||
|
" #!!!##!!!# ",
|
||||||
|
" #!!!##!!!# ",
|
||||||
|
" #!!!!!!!!# ",
|
||||||
|
" #!!!!!!!!!!# ",
|
||||||
|
" #!!!####!!!# ",
|
||||||
|
" #!!!# #!!!# ",
|
||||||
|
" #!!!# #!!!# ",
|
||||||
|
" ### ### ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" "};
|
|
@ -0,0 +1,38 @@
|
||||||
|
/* XPM */
|
||||||
|
static char const *cursor_xor_xpm[] = {
|
||||||
|
"32 32 3 1",
|
||||||
|
" c None",
|
||||||
|
"! c black",
|
||||||
|
"# c white",
|
||||||
|
" # ",
|
||||||
|
" #!# ",
|
||||||
|
" #!# ",
|
||||||
|
" #!# ",
|
||||||
|
" #!# ",
|
||||||
|
" #!# ",
|
||||||
|
" ##### ##### ",
|
||||||
|
"#!!!!! !!!!!# ",
|
||||||
|
" ##### ##### ",
|
||||||
|
" #!# ",
|
||||||
|
" #!# ",
|
||||||
|
" #!# ",
|
||||||
|
" #!# ",
|
||||||
|
" #!# # ",
|
||||||
|
" # #!# ",
|
||||||
|
" #!!!# ",
|
||||||
|
" #!!#!!# ",
|
||||||
|
" #!!# #!!# ",
|
||||||
|
" #!# #!# ",
|
||||||
|
" # # ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" "};
|
|
@ -13,6 +13,7 @@ include_directories(
|
||||||
./dialogs
|
./dialogs
|
||||||
./widgets
|
./widgets
|
||||||
./dialog_about
|
./dialog_about
|
||||||
|
${CMAKE_SOURCE_DIR}/bitmaps_png
|
||||||
${CMAKE_SOURCE_DIR}/3d-viewer
|
${CMAKE_SOURCE_DIR}/3d-viewer
|
||||||
${CMAKE_SOURCE_DIR}/pcbnew
|
${CMAKE_SOURCE_DIR}/pcbnew
|
||||||
${INC_AFTER}
|
${INC_AFTER}
|
||||||
|
@ -310,7 +311,7 @@ set( COMMON_SRCS
|
||||||
common.cpp
|
common.cpp
|
||||||
config_params.cpp
|
config_params.cpp
|
||||||
confirm.cpp
|
confirm.cpp
|
||||||
cursor_store.cpp
|
cursors.cpp
|
||||||
dialog_shim.cpp
|
dialog_shim.cpp
|
||||||
gr_text.cpp
|
gr_text.cpp
|
||||||
dsnlexer.cpp
|
dsnlexer.cpp
|
||||||
|
|
|
@ -1,100 +0,0 @@
|
||||||
/*
|
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
||||||
*
|
|
||||||
* Copyright (C) 2019 KiCad Developers, see CHANGELOG.TXT for contributors.
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU General Public License
|
|
||||||
* as published by the Free Software Foundation; either version 2
|
|
||||||
* of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, you may find one here:
|
|
||||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
||||||
* or you may search the http://www.gnu.org website for the version 2 license,
|
|
||||||
* or you may write to the Free Software Foundation, Inc.,
|
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <cursor_store.h>
|
|
||||||
|
|
||||||
#include <wx/bitmap.h>
|
|
||||||
#include <wx/debug.h>
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Construct a cursor for the given definition.
|
|
||||||
*
|
|
||||||
* How to do this depends on the platform, see
|
|
||||||
* http://docs.wxwidgets.org/trunk/classwx_cursor.html
|
|
||||||
*
|
|
||||||
* @param aDef the cursor definition
|
|
||||||
* @return a newly constructed cursor if the platform is supported,
|
|
||||||
* else wxNullCursor
|
|
||||||
*/
|
|
||||||
wxCursor constructCursor( const CURSOR_STORE::CURSOR_DEF& aDef )
|
|
||||||
{
|
|
||||||
#if defined( __WXMSW__ ) || defined( __WXMAC__ )
|
|
||||||
|
|
||||||
wxBitmap img_bitmap(
|
|
||||||
reinterpret_cast<const char*>( aDef.m_image_data ), aDef.m_size.x, aDef.m_size.y );
|
|
||||||
wxBitmap msk_bitmap(
|
|
||||||
reinterpret_cast<const char*>( aDef.m_mask_data ), aDef.m_size.x, aDef.m_size.y );
|
|
||||||
img_bitmap.SetMask( new wxMask( msk_bitmap ) );
|
|
||||||
|
|
||||||
wxImage image( img_bitmap.ConvertToImage() );
|
|
||||||
|
|
||||||
#if defined( __WXMSW__ )
|
|
||||||
image.SetMaskColour( 255, 255, 255 );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
image.SetOption( wxIMAGE_OPTION_CUR_HOTSPOT_X, aDef.m_hotspot.x );
|
|
||||||
image.SetOption( wxIMAGE_OPTION_CUR_HOTSPOT_Y, aDef.m_hotspot.y );
|
|
||||||
|
|
||||||
return wxCursor{ image };
|
|
||||||
|
|
||||||
#elif defined( __WXGTK__ ) || defined( __WXMOTIF__ )
|
|
||||||
|
|
||||||
return wxCursor{
|
|
||||||
reinterpret_cast<const char*>( aDef.m_image_data ),
|
|
||||||
aDef.m_size.x,
|
|
||||||
aDef.m_size.y,
|
|
||||||
aDef.m_hotspot.x,
|
|
||||||
aDef.m_hotspot.y,
|
|
||||||
reinterpret_cast<const char*>( aDef.m_mask_data ),
|
|
||||||
};
|
|
||||||
|
|
||||||
#else
|
|
||||||
wxASSERT_MSG( false, "Unknown platform for cursor construction." );
|
|
||||||
return wxNullCursor;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
CURSOR_STORE::CURSOR_STORE( const std::vector<CURSOR_DEF>& aDefs )
|
|
||||||
{
|
|
||||||
for( const auto& def : aDefs )
|
|
||||||
{
|
|
||||||
m_store[def.m_id_key] = constructCursor( def );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
const wxCursor& CURSOR_STORE::Get( int aIdKey ) const
|
|
||||||
{
|
|
||||||
const auto find_iter = m_store.find( aIdKey );
|
|
||||||
|
|
||||||
if( find_iter != m_store.end() )
|
|
||||||
{
|
|
||||||
return find_iter->second;
|
|
||||||
}
|
|
||||||
|
|
||||||
wxASSERT_MSG( false,
|
|
||||||
wxString::Format( "Could not find cursor with ID %d", static_cast<int>( aIdKey ) ) );
|
|
||||||
return wxNullCursor;
|
|
||||||
}
|
|
|
@ -0,0 +1,313 @@
|
||||||
|
/*
|
||||||
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2019 KiCad Developers, see CHANGELOG.TXT for contributors.
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, you may find one here:
|
||||||
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||||
|
* or you may search the http://www.gnu.org website for the version 2 license,
|
||||||
|
* or you may write to the Free Software Foundation, Inc.,
|
||||||
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
#include <cursors.h>
|
||||||
|
#include <kiplatform/ui.h>
|
||||||
|
#include <cursors/cursor-add.xpm>
|
||||||
|
#include <cursors/cursor-connector.xpm>
|
||||||
|
#include <cursors/cursor-eraser.xpm>
|
||||||
|
#include <cursors/cursor-measure.xpm>
|
||||||
|
#include <cursors/cursor-pencil.xpm>
|
||||||
|
#include <cursors/cursor-select-m.xpm>
|
||||||
|
#include <cursors/cursor-subtract.xpm>
|
||||||
|
#include <cursors/cursor-text.xpm>
|
||||||
|
#include <cursors/cursor-xor.xpm>
|
||||||
|
|
||||||
|
#include <wx/bitmap.h>
|
||||||
|
#include <wx/debug.h>
|
||||||
|
|
||||||
|
|
||||||
|
static const unsigned char voltage_probe[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x03, 0x00,
|
||||||
|
0x00, 0x30, 0x06, 0x00, 0x00, 0x18, 0x0c, 0x00, 0x00, 0x0e, 0x08, 0x00, 0x80, 0x07, 0x08, 0x00,
|
||||||
|
0xc0, 0x07, 0x18, 0x00, 0xe0, 0x07, 0x30, 0x00, 0xf0, 0x03, 0x60, 0x00, 0xf8, 0x01, 0x00, 0x00,
|
||||||
|
0xfc, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x80, 0x1f, 0x00, 0x00, 0xc0,
|
||||||
|
0x0f, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xf0, 0x03, 0x00, 0x00, 0xf0, 0x01, 0x00, 0x00, 0xf0,
|
||||||
|
0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x02,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
||||||
|
|
||||||
|
static const unsigned char current_probe[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x03, 0x00, 0x00, 0x60, 0x06, 0x00,
|
||||||
|
0x00, 0x30, 0x0c, 0x00, 0x00, 0x1c, 0x08, 0x00, 0x00, 0x0f, 0x08, 0x00, 0x80, 0x0f, 0x18, 0x00,
|
||||||
|
0xc0, 0x0f, 0x30, 0x80, 0xe1, 0x07, 0x60, 0x80, 0xf1, 0x03, 0x00, 0x80, 0xf9, 0x01, 0x00, 0x80,
|
||||||
|
0xfd, 0x00, 0x00, 0x80, 0x7f, 0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, 0x80, 0x1f, 0x00, 0x00, 0xc0,
|
||||||
|
0x0f, 0x00, 0x00, 0xf8, 0x07, 0x00, 0x00, 0xfe, 0x03, 0x00, 0x00, 0xc6, 0x01, 0x00, 0x00, 0x83,
|
||||||
|
0x01, 0x00, 0x00, 0x83, 0x01, 0x00, 0x00, 0x83, 0x01, 0x00, 0x00, 0xc2, 0x00, 0x00, 0x00, 0xfc,
|
||||||
|
0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00 };
|
||||||
|
|
||||||
|
static const unsigned char cursor_tune[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x80, 0x07, 0x00, 0x00, 0xc0, 0x0f, 0x00,
|
||||||
|
0x00, 0xe0, 0x1f, 0x00, 0x00, 0xf0, 0x1f, 0x00, 0x00, 0xf8, 0x0f, 0x00, 0x00, 0xfc, 0x07, 0x00,
|
||||||
|
0x00, 0xfe, 0x03, 0x00, 0x00, 0xff, 0x01, 0x00, 0x80, 0xff, 0x00, 0x00, 0xc0, 0x7f, 0x00, 0x00,
|
||||||
|
0xe0, 0x3f, 0x00, 0x00, 0xe0, 0x1f, 0x00, 0x00, 0xfc, 0x0f, 0x00, 0x00, 0xfc, 0x07, 0x00, 0x00,
|
||||||
|
0xfc, 0x03, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x00, 0xf4, 0x00, 0x00, 0x00, 0xea, 0x00, 0x00, 0x00,
|
||||||
|
0x05, 0x00, 0x00, 0x80, 0x02, 0x00, 0x00, 0x40, 0x01, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x50,
|
||||||
|
0x00, 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x0a,
|
||||||
|
0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00 };
|
||||||
|
|
||||||
|
static const unsigned char cursor_tune_mask[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x80, 0x07, 0x00, 0x00, 0xc0, 0x0f,
|
||||||
|
0x00, 0x00, 0xe0, 0x1f, 0x00, 0x00, 0xf0, 0x1f, 0x00, 0x00, 0xf8, 0x0f, 0x00, 0x00, 0xfc, 0x07,
|
||||||
|
0x00, 0x00, 0xfe, 0x03, 0x00, 0x00, 0xff, 0x01, 0x00, 0x80, 0xff, 0x00, 0x00, 0xc0, 0x7f, 0x00,
|
||||||
|
0x00, 0xe0, 0x3f, 0x00, 0x00, 0xe0, 0x1f, 0x00, 0x00, 0xfc, 0x0f, 0x00, 0x00, 0xfc, 0x07, 0x00,
|
||||||
|
0x00, 0xfc, 0x03, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x00, 0x00, 0xee, 0x00, 0x00,
|
||||||
|
0x00, 0x07, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00,
|
||||||
|
0x70, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00,
|
||||||
|
0x0e, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00 };
|
||||||
|
|
||||||
|
|
||||||
|
static const std::vector<CURSOR_STORE::CURSOR_DEF> standard_cursors = {
|
||||||
|
{
|
||||||
|
KICURSOR::VOLTAGE_PROBE,
|
||||||
|
voltage_probe,
|
||||||
|
voltage_probe,
|
||||||
|
nullptr,
|
||||||
|
{ 32, 32 },
|
||||||
|
{ 1, 31 },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
KICURSOR::CURRENT_PROBE,
|
||||||
|
current_probe,
|
||||||
|
current_probe,
|
||||||
|
nullptr,
|
||||||
|
{ 32, 32 },
|
||||||
|
{ 4, 27 },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
KICURSOR::TUNE,
|
||||||
|
cursor_tune,
|
||||||
|
cursor_tune_mask,
|
||||||
|
nullptr,
|
||||||
|
{ 32, 32 },
|
||||||
|
{ 1, 30 },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
KICURSOR::PENCIL,
|
||||||
|
nullptr,
|
||||||
|
nullptr,
|
||||||
|
cursor_pencil_xpm,
|
||||||
|
{ 32, 32 },
|
||||||
|
{ 4, 4 },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
KICURSOR::MOVING,
|
||||||
|
nullptr,
|
||||||
|
nullptr,
|
||||||
|
cursor_select_m_xpm,
|
||||||
|
{ 32, 32 },
|
||||||
|
{ 1, 1 },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
KICURSOR::REMOVE,
|
||||||
|
nullptr,
|
||||||
|
nullptr,
|
||||||
|
cursor_eraser_xpm,
|
||||||
|
{ 32, 32 },
|
||||||
|
{ 4, 4 },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
KICURSOR::WIRE,
|
||||||
|
nullptr,
|
||||||
|
nullptr,
|
||||||
|
cursor_connector_xpm,
|
||||||
|
{ 32, 32 },
|
||||||
|
{ 1, 1 },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
KICURSOR::TEXT,
|
||||||
|
nullptr,
|
||||||
|
nullptr,
|
||||||
|
cursor_text_xpm,
|
||||||
|
{ 32, 32 },
|
||||||
|
{ 7, 10 },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
KICURSOR::MEASURE,
|
||||||
|
nullptr,
|
||||||
|
nullptr,
|
||||||
|
cursor_measure_xpm,
|
||||||
|
{ 32, 32 },
|
||||||
|
{ 4, 4 },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
KICURSOR::ADD,
|
||||||
|
nullptr,
|
||||||
|
nullptr,
|
||||||
|
cursor_add_xpm,
|
||||||
|
{ 32, 32 },
|
||||||
|
{ 7, 10 },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
KICURSOR::SUBTRACT,
|
||||||
|
nullptr,
|
||||||
|
nullptr,
|
||||||
|
cursor_subtract_xpm,
|
||||||
|
{ 32, 32 },
|
||||||
|
{ 7, 10 },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
KICURSOR::XOR,
|
||||||
|
nullptr,
|
||||||
|
nullptr,
|
||||||
|
cursor_xor_xpm,
|
||||||
|
{ 32, 32 },
|
||||||
|
{ 7, 10 },
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Construct a cursor for the given definition.
|
||||||
|
*
|
||||||
|
* How to do this depends on the platform, see
|
||||||
|
* http://docs.wxwidgets.org/trunk/classwx_cursor.html
|
||||||
|
*
|
||||||
|
* @param aDef the cursor definition
|
||||||
|
* @return a newly constructed cursor if the platform is supported,
|
||||||
|
* else wxNullCursor
|
||||||
|
*/
|
||||||
|
wxCursor constructCursor( const CURSOR_STORE::CURSOR_DEF& aDef )
|
||||||
|
{
|
||||||
|
if( aDef.m_xpm != nullptr )
|
||||||
|
{
|
||||||
|
wxImage xpmImage = wxImage( aDef.m_xpm );
|
||||||
|
|
||||||
|
xpmImage.SetOption( wxIMAGE_OPTION_CUR_HOTSPOT_X, aDef.m_hotspot.x );
|
||||||
|
xpmImage.SetOption( wxIMAGE_OPTION_CUR_HOTSPOT_Y, aDef.m_hotspot.y );
|
||||||
|
|
||||||
|
return wxCursor( xpmImage );
|
||||||
|
}
|
||||||
|
else if( aDef.m_image_data != nullptr && aDef.m_mask_data != nullptr )
|
||||||
|
{
|
||||||
|
#if defined( __WXMSW__ ) || defined( __WXMAC__ )
|
||||||
|
|
||||||
|
wxBitmap img_bitmap(
|
||||||
|
reinterpret_cast<const char*>( aDef.m_image_data ), aDef.m_size.x, aDef.m_size.y );
|
||||||
|
wxBitmap msk_bitmap(
|
||||||
|
reinterpret_cast<const char*>( aDef.m_mask_data ), aDef.m_size.x, aDef.m_size.y );
|
||||||
|
img_bitmap.SetMask( new wxMask( msk_bitmap ) );
|
||||||
|
|
||||||
|
wxImage image( img_bitmap.ConvertToImage() );
|
||||||
|
|
||||||
|
#if defined( __WXMSW__ )
|
||||||
|
image.SetMaskColour( 255, 255, 255 );
|
||||||
|
#endif
|
||||||
|
|
||||||
|
image.SetOption( wxIMAGE_OPTION_CUR_HOTSPOT_X, aDef.m_hotspot.x );
|
||||||
|
image.SetOption( wxIMAGE_OPTION_CUR_HOTSPOT_Y, aDef.m_hotspot.y );
|
||||||
|
|
||||||
|
return wxCursor{ image };
|
||||||
|
|
||||||
|
#elif defined( __WXGTK__ ) || defined( __WXMOTIF__ )
|
||||||
|
|
||||||
|
return wxCursor{
|
||||||
|
reinterpret_cast<const char*>( aDef.m_image_data ),
|
||||||
|
aDef.m_size.x,
|
||||||
|
aDef.m_size.y,
|
||||||
|
aDef.m_hotspot.x,
|
||||||
|
aDef.m_hotspot.y,
|
||||||
|
reinterpret_cast<const char*>( aDef.m_mask_data ),
|
||||||
|
};
|
||||||
|
|
||||||
|
#else
|
||||||
|
wxASSERT_MSG( false, "Unknown platform for cursor construction." );
|
||||||
|
return wxNullCursor;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
wxASSERT_MSG( false, "Unknown to find cursor" );
|
||||||
|
return wxNullCursor;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
CURSOR_STORE::CURSOR_STORE( const std::vector<CURSOR_DEF>& aDefs )
|
||||||
|
{
|
||||||
|
for( const auto& def : aDefs )
|
||||||
|
{
|
||||||
|
m_store[def.m_id_key] = constructCursor( def );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const wxCursor& CURSOR_STORE::Get( KICURSOR aIdKey ) const
|
||||||
|
{
|
||||||
|
const auto find_iter = m_store.find( aIdKey );
|
||||||
|
|
||||||
|
if( find_iter != m_store.end() )
|
||||||
|
{
|
||||||
|
return find_iter->second;
|
||||||
|
}
|
||||||
|
|
||||||
|
wxASSERT_MSG( false,
|
||||||
|
wxString::Format( "Could not find cursor with ID %d", static_cast<int>( aIdKey ) ) );
|
||||||
|
return wxNullCursor;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const wxCursor CURSOR_STORE::GetCursor( KICURSOR aCursorType )
|
||||||
|
{
|
||||||
|
wxStockCursor stock =
|
||||||
|
GetStockCursor( aCursorType );
|
||||||
|
if( stock != wxCURSOR_MAX )
|
||||||
|
{
|
||||||
|
return wxCursor( stock );
|
||||||
|
}
|
||||||
|
|
||||||
|
static CURSOR_STORE store( standard_cursors );
|
||||||
|
return store.Get( aCursorType );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const wxStockCursor CURSOR_STORE::GetStockCursor( KICURSOR aCursorType )
|
||||||
|
{
|
||||||
|
wxStockCursor stockCursor;
|
||||||
|
switch( aCursorType )
|
||||||
|
{
|
||||||
|
case KICURSOR::MOVING:
|
||||||
|
stockCursor = wxCURSOR_SIZING;
|
||||||
|
break;
|
||||||
|
case KICURSOR::BULLSEYE:
|
||||||
|
stockCursor = wxCURSOR_BULLSEYE;
|
||||||
|
break;
|
||||||
|
case KICURSOR::HAND:
|
||||||
|
stockCursor = wxCURSOR_HAND;
|
||||||
|
break;
|
||||||
|
case KICURSOR::ARROW:
|
||||||
|
stockCursor = wxCURSOR_ARROW;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
stockCursor = wxCURSOR_MAX;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( !KIPLATFORM::UI::IsStockCursorOk( stockCursor ) )
|
||||||
|
{
|
||||||
|
stockCursor = wxCURSOR_MAX;
|
||||||
|
}
|
||||||
|
|
||||||
|
return stockCursor;
|
||||||
|
}
|
|
@ -29,6 +29,7 @@
|
||||||
#include <kiface_i.h>
|
#include <kiface_i.h>
|
||||||
#include <macros.h>
|
#include <macros.h>
|
||||||
#include <settings/app_settings.h>
|
#include <settings/app_settings.h>
|
||||||
|
#include <cursors.h>
|
||||||
|
|
||||||
#include <class_draw_panel_gal.h>
|
#include <class_draw_panel_gal.h>
|
||||||
#include <view/view.h>
|
#include <view/view.h>
|
||||||
|
@ -64,8 +65,9 @@ EDA_DRAW_PANEL_GAL::EDA_DRAW_PANEL_GAL( wxWindow* aParentWindow, wxWindowID aWin
|
||||||
m_lostFocus( false ),
|
m_lostFocus( false ),
|
||||||
m_stealsFocus( true )
|
m_stealsFocus( true )
|
||||||
{
|
{
|
||||||
m_parent = aParentWindow;
|
m_parent = aParentWindow;
|
||||||
m_currentCursor = wxStockCursor( wxCURSOR_ARROW );
|
m_currentKiCursor = KICURSOR::DEFAULT;
|
||||||
|
SetCurrentCursor( KICURSOR::ARROW );
|
||||||
|
|
||||||
SetLayoutDirection( wxLayout_LeftToRight );
|
SetLayoutDirection( wxLayout_LeftToRight );
|
||||||
|
|
||||||
|
@ -567,18 +569,16 @@ void EDA_DRAW_PANEL_GAL::onShowTimer( wxTimerEvent& aEvent )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void EDA_DRAW_PANEL_GAL::SetCurrentCursor( wxStockCursor aStockCursorID )
|
void EDA_DRAW_PANEL_GAL::SetCurrentCursor( KICURSOR cursor )
|
||||||
{
|
{
|
||||||
if ( aStockCursorID <= wxCURSOR_NONE || aStockCursorID >= wxCURSOR_MAX )
|
if( m_currentKiCursor == cursor )
|
||||||
aStockCursorID = wxCURSOR_ARROW;
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
SetCurrentCursor( wxCursor( aStockCursorID ) );
|
m_currentCursor = CURSOR_STORE::GetCursor( cursor );
|
||||||
}
|
m_currentKiCursor = cursor;
|
||||||
|
|
||||||
|
|
||||||
void EDA_DRAW_PANEL_GAL::SetCurrentCursor( const wxCursor& aCursor )
|
|
||||||
{
|
|
||||||
m_currentCursor = aCursor;
|
|
||||||
SetCursor( m_currentCursor );
|
SetCursor( m_currentCursor );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -179,7 +179,7 @@ void PICKER_TOOL::setTransitions()
|
||||||
|
|
||||||
void PICKER_TOOL::resetPicker()
|
void PICKER_TOOL::resetPicker()
|
||||||
{
|
{
|
||||||
m_cursor = wxStockCursor( wxCURSOR_ARROW );
|
m_cursor = KICURSOR::ARROW;
|
||||||
|
|
||||||
m_picked = NULLOPT;
|
m_picked = NULLOPT;
|
||||||
m_clickHandler = NULLOPT;
|
m_clickHandler = NULLOPT;
|
||||||
|
|
|
@ -51,7 +51,7 @@ int ZOOM_TOOL::Main( const TOOL_EVENT& aEvent )
|
||||||
|
|
||||||
while( TOOL_EVENT* evt = Wait() )
|
while( TOOL_EVENT* evt = Wait() )
|
||||||
{
|
{
|
||||||
m_frame->GetCanvas()->SetCurrentCursor( wxCURSOR_ARROW );
|
m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::ARROW );
|
||||||
|
|
||||||
if( evt->IsCancelInteractive() || evt->IsActivate() )
|
if( evt->IsCancelInteractive() || evt->IsActivate() )
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -55,7 +55,7 @@ int CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
|
||||||
while( TOOL_EVENT* evt = Wait() )
|
while( TOOL_EVENT* evt = Wait() )
|
||||||
{
|
{
|
||||||
if( m_frame->ToolStackIsEmpty() )
|
if( m_frame->ToolStackIsEmpty() )
|
||||||
m_frame->GetCanvas()->SetCurrentCursor( wxCURSOR_ARROW );
|
m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::ARROW );
|
||||||
|
|
||||||
// single click? Select single object
|
// single click? Select single object
|
||||||
if( evt->IsClick( BUT_LEFT ) )
|
if( evt->IsClick( BUT_LEFT ) )
|
||||||
|
|
|
@ -293,7 +293,6 @@ if( KICAD_SPICE )
|
||||||
sim/sim_panel_base.cpp
|
sim/sim_panel_base.cpp
|
||||||
sim/spice_simulator.cpp
|
sim/spice_simulator.cpp
|
||||||
sim/spice_value.cpp
|
sim/spice_value.cpp
|
||||||
simulation_cursors.cpp
|
|
||||||
dialogs/dialog_signal_list.cpp
|
dialogs/dialog_signal_list.cpp
|
||||||
dialogs/dialog_signal_list_base.cpp
|
dialogs/dialog_signal_list_base.cpp
|
||||||
dialogs/dialog_sim_settings.cpp
|
dialogs/dialog_sim_settings.cpp
|
||||||
|
|
|
@ -1,110 +0,0 @@
|
||||||
/*
|
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
||||||
*
|
|
||||||
* Copyright (C) 2019 KiCad Developers, see CHANGELOG.TXT for contributors.
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU General Public License
|
|
||||||
* as published by the Free Software Foundation; either version 2
|
|
||||||
* of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, you may find one here:
|
|
||||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
||||||
* or you may search the http://www.gnu.org website for the version 2 license,
|
|
||||||
* or you may write to the Free Software Foundation, Inc.,
|
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <simulation_cursors.h>
|
|
||||||
|
|
||||||
#include <cursor_store.h>
|
|
||||||
|
|
||||||
static const unsigned char voltage_probe[] = {
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
||||||
0x00, 0x00, 0xe0, 0x03, 0x00, 0x00, 0x30, 0x06, 0x00, 0x00, 0x18, 0x0c,
|
|
||||||
0x00, 0x00, 0x0e, 0x08, 0x00, 0x80, 0x07, 0x08, 0x00, 0xc0, 0x07, 0x18,
|
|
||||||
0x00, 0xe0, 0x07, 0x30, 0x00, 0xf0, 0x03, 0x60, 0x00, 0xf8, 0x01, 0x00,
|
|
||||||
0x00, 0xfc, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00,
|
|
||||||
0x80, 0x1f, 0x00, 0x00, 0xc0, 0x0f, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00,
|
|
||||||
0xf0, 0x03, 0x00, 0x00, 0xf0, 0x01, 0x00, 0x00, 0xf0, 0x00, 0x00, 0x00,
|
|
||||||
0x18, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
|
|
||||||
0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
|
||||||
|
|
||||||
static const unsigned char current_probe[] = {
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x03,
|
|
||||||
0x00, 0x00, 0x60, 0x06, 0x00, 0x00, 0x30, 0x0c, 0x00, 0x00, 0x1c, 0x08,
|
|
||||||
0x00, 0x00, 0x0f, 0x08, 0x00, 0x80, 0x0f, 0x18, 0x00, 0xc0, 0x0f, 0x30,
|
|
||||||
0x80, 0xe1, 0x07, 0x60, 0x80, 0xf1, 0x03, 0x00, 0x80, 0xf9, 0x01, 0x00,
|
|
||||||
0x80, 0xfd, 0x00, 0x00, 0x80, 0x7f, 0x00, 0x00, 0x80, 0x3f, 0x00, 0x00,
|
|
||||||
0x80, 0x1f, 0x00, 0x00, 0xc0, 0x0f, 0x00, 0x00, 0xf8, 0x07, 0x00, 0x00,
|
|
||||||
0xfe, 0x03, 0x00, 0x00, 0xc6, 0x01, 0x00, 0x00, 0x83, 0x01, 0x00, 0x00,
|
|
||||||
0x83, 0x01, 0x00, 0x00, 0x83, 0x01, 0x00, 0x00, 0xc2, 0x00, 0x00, 0x00,
|
|
||||||
0xfc, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00 };
|
|
||||||
|
|
||||||
static const unsigned char cursor_tune[] = {
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
||||||
0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x80, 0x07, 0x00, 0x00, 0xc0, 0x0f,
|
|
||||||
0x00, 0x00, 0xe0, 0x1f, 0x00, 0x00, 0xf0, 0x1f, 0x00, 0x00, 0xf8, 0x0f,
|
|
||||||
0x00, 0x00, 0xfc, 0x07, 0x00, 0x00, 0xfe, 0x03, 0x00, 0x00, 0xff, 0x01,
|
|
||||||
0x00, 0x80, 0xff, 0x00, 0x00, 0xc0, 0x7f, 0x00, 0x00, 0xe0, 0x3f, 0x00,
|
|
||||||
0x00, 0xe0, 0x1f, 0x00, 0x00, 0xfc, 0x0f, 0x00, 0x00, 0xfc, 0x07, 0x00,
|
|
||||||
0x00, 0xfc, 0x03, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x00, 0xf4, 0x00, 0x00,
|
|
||||||
0x00, 0xea, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x80, 0x02, 0x00, 0x00,
|
|
||||||
0x40, 0x01, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00,
|
|
||||||
0x2c, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00,
|
|
||||||
0x0a, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00 };
|
|
||||||
|
|
||||||
static const unsigned char cursor_tune_mask[] = {
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
||||||
0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x80, 0x07, 0x00, 0x00, 0xc0, 0x0f,
|
|
||||||
0x00, 0x00, 0xe0, 0x1f, 0x00, 0x00, 0xf0, 0x1f, 0x00, 0x00, 0xf8, 0x0f,
|
|
||||||
0x00, 0x00, 0xfc, 0x07, 0x00, 0x00, 0xfe, 0x03, 0x00, 0x00, 0xff, 0x01,
|
|
||||||
0x00, 0x80, 0xff, 0x00, 0x00, 0xc0, 0x7f, 0x00, 0x00, 0xe0, 0x3f, 0x00,
|
|
||||||
0x00, 0xe0, 0x1f, 0x00, 0x00, 0xfc, 0x0f, 0x00, 0x00, 0xfc, 0x07, 0x00,
|
|
||||||
0x00, 0xfc, 0x03, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x00,
|
|
||||||
0x00, 0xee, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00,
|
|
||||||
0xc0, 0x01, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00,
|
|
||||||
0x3c, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00,
|
|
||||||
0x0e, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00 };
|
|
||||||
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
static const std::vector<CURSOR_STORE::CURSOR_DEF> simulation_cursors = {
|
|
||||||
{
|
|
||||||
static_cast<int>( SIM_CURSORS::CURSOR::VOLTAGE_PROBE ),
|
|
||||||
voltage_probe,
|
|
||||||
voltage_probe,
|
|
||||||
{ 32, 32 },
|
|
||||||
{ 1, 31 },
|
|
||||||
},
|
|
||||||
{
|
|
||||||
static_cast<int>( SIM_CURSORS::CURSOR::CURRENT_PROBE ),
|
|
||||||
current_probe,
|
|
||||||
current_probe,
|
|
||||||
{ 32, 32 },
|
|
||||||
{ 4, 27 },
|
|
||||||
},
|
|
||||||
{
|
|
||||||
static_cast<int>( SIM_CURSORS::CURSOR::TUNE ),
|
|
||||||
cursor_tune,
|
|
||||||
cursor_tune_mask,
|
|
||||||
{ 32, 32 },
|
|
||||||
{ 1, 30 },
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
const wxCursor& SIM_CURSORS::GetCursor( CURSOR aCursorType )
|
|
||||||
{
|
|
||||||
static CURSOR_STORE store( simulation_cursors );
|
|
||||||
return store.Get( static_cast<int>( aCursorType ) );
|
|
||||||
}
|
|
|
@ -1,49 +0,0 @@
|
||||||
/*
|
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
||||||
*
|
|
||||||
* Copyright (C) 2019 KiCad Developers, see CHANGELOG.TXT for contributors.
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU General Public License
|
|
||||||
* as published by the Free Software Foundation; either version 2
|
|
||||||
* of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, you may find one here:
|
|
||||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
||||||
* or you may search the http://www.gnu.org website for the version 2 license,
|
|
||||||
* or you may write to the Free Software Foundation, Inc.,
|
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef EESCHEMA_SIMULATION_CURSORS__H
|
|
||||||
#define EESCHEMA_SIMULATION_CURSORS__H
|
|
||||||
|
|
||||||
#include <wx/cursor.h>
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Simple class to provide cursors for simulation functions.
|
|
||||||
*
|
|
||||||
* For now, it's using simple static-access, but could be made more advanced in future.
|
|
||||||
*/
|
|
||||||
class SIM_CURSORS
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
///> Probe cursor, used by circuit simulator
|
|
||||||
enum CURSOR
|
|
||||||
{
|
|
||||||
VOLTAGE_PROBE,
|
|
||||||
CURRENT_PROBE,
|
|
||||||
WATTAGE_PROBE,
|
|
||||||
TUNE,
|
|
||||||
};
|
|
||||||
|
|
||||||
static const wxCursor& GetCursor( CURSOR aCursorType );
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // EESCHEMA_SIMULATION_CURSORS__H
|
|
|
@ -763,7 +763,7 @@ void EE_POINT_EDITOR::setEditedPoint( EDIT_POINT* aPoint )
|
||||||
|
|
||||||
if( aPoint )
|
if( aPoint )
|
||||||
{
|
{
|
||||||
m_frame->GetCanvas()->SetCurrentCursor( wxCURSOR_ARROW );
|
m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::ARROW );
|
||||||
controls->ForceCursorPosition( true, aPoint->GetPosition() );
|
controls->ForceCursorPosition( true, aPoint->GetPosition() );
|
||||||
controls->ShowCursor( true );
|
controls->ShowCursor( true );
|
||||||
}
|
}
|
||||||
|
|
|
@ -297,14 +297,14 @@ const KICAD_T movableSymbolItems[] =
|
||||||
|
|
||||||
int EE_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
|
int EE_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
|
||||||
{
|
{
|
||||||
m_frame->GetCanvas()->SetCurrentCursor( wxCURSOR_ARROW );
|
m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::ARROW );
|
||||||
|
|
||||||
KIID lastRolloverItem = niluuid;
|
KIID lastRolloverItem = niluuid;
|
||||||
|
|
||||||
// Main loop: keep receiving events
|
// Main loop: keep receiving events
|
||||||
while( TOOL_EVENT* evt = Wait() )
|
while( TOOL_EVENT* evt = Wait() )
|
||||||
{
|
{
|
||||||
bool displayPencil = false;
|
bool displayWireCursor = false;
|
||||||
KIID rolloverItem = niluuid;
|
KIID rolloverItem = niluuid;
|
||||||
m_additive = m_subtractive = m_exclusive_or = false;
|
m_additive = m_subtractive = m_exclusive_or = false;
|
||||||
|
|
||||||
|
@ -315,6 +315,8 @@ int EE_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
|
||||||
else if( evt->Modifier( MD_CTRL ) )
|
else if( evt->Modifier( MD_CTRL ) )
|
||||||
m_exclusive_or = true;
|
m_exclusive_or = true;
|
||||||
|
|
||||||
|
bool modifier_enabled = m_subtractive || m_additive || m_exclusive_or;
|
||||||
|
|
||||||
// Is the user requesting that the selection list include all possible
|
// Is the user requesting that the selection list include all possible
|
||||||
// items without removing less likely selection candidates
|
// items without removing less likely selection candidates
|
||||||
m_skip_heuristics = !!evt->Modifier( MD_ALT );
|
m_skip_heuristics = !!evt->Modifier( MD_ALT );
|
||||||
|
@ -335,7 +337,7 @@ int EE_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
|
||||||
{
|
{
|
||||||
narrowSelection( collector, evt->Position(), false );
|
narrowSelection( collector, evt->Position(), false );
|
||||||
|
|
||||||
if( collector.GetCount() == 1 && !m_isLibEdit )
|
if( collector.GetCount() == 1 && !m_isLibEdit && !modifier_enabled )
|
||||||
{
|
{
|
||||||
// Check if we want to auto start wires
|
// Check if we want to auto start wires
|
||||||
VECTOR2I snappedCursorPos = grid.BestSnapAnchor( evt->Position(), nullptr );
|
VECTOR2I snappedCursorPos = grid.BestSnapAnchor( evt->Position(), nullptr );
|
||||||
|
@ -355,8 +357,7 @@ int EE_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
|
||||||
m_toolMgr->ProcessEvent( *newEvt );
|
m_toolMgr->ProcessEvent( *newEvt );
|
||||||
continueSelect = false;
|
continueSelect = false;
|
||||||
}
|
}
|
||||||
else if( collector[0]->Type() == SCH_IREF_T
|
else if( collector[0]->Type() == SCH_IREF_T )
|
||||||
&& !m_additive && !m_subtractive && !m_exclusive_or )
|
|
||||||
{
|
{
|
||||||
wxMenu menu;
|
wxMenu menu;
|
||||||
|
|
||||||
|
@ -428,8 +429,7 @@ int EE_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
|
||||||
if( auto schframe = dynamic_cast<SCH_EDIT_FRAME*>( m_frame ) )
|
if( auto schframe = dynamic_cast<SCH_EDIT_FRAME*>( m_frame ) )
|
||||||
schframe->FocusOnItem( nullptr );
|
schframe->FocusOnItem( nullptr );
|
||||||
|
|
||||||
if( m_additive || m_subtractive || m_exclusive_or
|
if( modifier_enabled || ( m_selection.Empty() && m_frame->GetDragSelects() ) )
|
||||||
|| ( m_selection.Empty() && m_frame->GetDragSelects() ) )
|
|
||||||
{
|
{
|
||||||
selectMultiple();
|
selectMultiple();
|
||||||
}
|
}
|
||||||
|
@ -506,17 +506,17 @@ int EE_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
|
||||||
{
|
{
|
||||||
narrowSelection( collector, evt->Position(), false );
|
narrowSelection( collector, evt->Position(), false );
|
||||||
|
|
||||||
if( collector.GetCount() == 1 )
|
if( collector.GetCount() == 1 && !modifier_enabled )
|
||||||
{
|
{
|
||||||
VECTOR2I snappedCursorPos = grid.BestSnapAnchor( evt->Position(), nullptr );
|
VECTOR2I snappedCursorPos = grid.BestSnapAnchor( evt->Position(), nullptr );
|
||||||
|
|
||||||
if( m_frame->eeconfig()->m_Drawing.auto_start_wires
|
if( m_frame->eeconfig()->m_Drawing.auto_start_wires
|
||||||
&& collector[0]->IsPointClickableAnchor( (wxPoint) snappedCursorPos ) )
|
&& collector[0]->IsPointClickableAnchor( (wxPoint) snappedCursorPos ) )
|
||||||
{
|
{
|
||||||
displayPencil = true;
|
displayWireCursor = true;
|
||||||
}
|
}
|
||||||
else if( collector[0]->Type() == SCH_IREF_T
|
else if( collector[0]->Type() == SCH_IREF_T && !m_additive && !m_subtractive
|
||||||
&& !m_additive && !m_subtractive && !m_exclusive_or )
|
&& !m_exclusive_or )
|
||||||
{
|
{
|
||||||
rolloverItem = collector[0]->m_Uuid;
|
rolloverItem = collector[0]->m_Uuid;
|
||||||
}
|
}
|
||||||
|
@ -550,12 +550,25 @@ int EE_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
|
||||||
|
|
||||||
if( m_frame->ToolStackIsEmpty() )
|
if( m_frame->ToolStackIsEmpty() )
|
||||||
{
|
{
|
||||||
if( displayPencil )
|
if( displayWireCursor )
|
||||||
m_frame->GetCanvas()->SetCurrentCursor( wxCURSOR_PENCIL );
|
m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::WIRE );
|
||||||
else if( rolloverItem != niluuid )
|
else if( rolloverItem != niluuid )
|
||||||
m_frame->GetCanvas()->SetCurrentCursor( wxCURSOR_HAND );
|
m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::HAND );
|
||||||
|
else if( !modifier_enabled && !m_selection.Empty()
|
||||||
|
&& !m_frame->GetDragSelects() && evt->HasPosition()
|
||||||
|
&& selectionContains( evt->Position() ) ) //move/drag option prediction
|
||||||
|
m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::MOVING );
|
||||||
else
|
else
|
||||||
m_frame->GetCanvas()->SetCurrentCursor( wxCURSOR_ARROW );
|
{
|
||||||
|
if( m_additive )
|
||||||
|
m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::ADD );
|
||||||
|
else if( m_subtractive )
|
||||||
|
m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::SUBTRACT );
|
||||||
|
else if( m_exclusive_or )
|
||||||
|
m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::XOR );
|
||||||
|
else
|
||||||
|
m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::ARROW );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -76,7 +76,8 @@ int LIB_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent )
|
||||||
LIBEDIT_SETTINGS* settings = Pgm().GetSettingsManager().GetAppSettings<LIBEDIT_SETTINGS>();
|
LIBEDIT_SETTINGS* settings = Pgm().GetSettingsManager().GetAppSettings<LIBEDIT_SETTINGS>();
|
||||||
LIB_PIN_TOOL* pinTool = type == LIB_PIN_T ? m_toolMgr->GetTool<LIB_PIN_TOOL>() : nullptr;
|
LIB_PIN_TOOL* pinTool = type == LIB_PIN_T ? m_toolMgr->GetTool<LIB_PIN_TOOL>() : nullptr;
|
||||||
VECTOR2I cursorPos;
|
VECTOR2I cursorPos;
|
||||||
EDA_ITEM* item = nullptr;
|
EDA_ITEM* item = nullptr;
|
||||||
|
bool isText = aEvent.IsAction( &EE_ACTIONS::placeSymbolText );
|
||||||
|
|
||||||
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true );
|
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true );
|
||||||
getViewControls()->ShowCursor( true );
|
getViewControls()->ShowCursor( true );
|
||||||
|
@ -92,7 +93,15 @@ int LIB_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent )
|
||||||
// Main loop: keep receiving events
|
// Main loop: keep receiving events
|
||||||
while( TOOL_EVENT* evt = Wait() )
|
while( TOOL_EVENT* evt = Wait() )
|
||||||
{
|
{
|
||||||
m_frame->GetCanvas()->SetCurrentCursor( wxCURSOR_PENCIL );
|
if( isText )
|
||||||
|
{
|
||||||
|
m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::TEXT );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::PENCIL );
|
||||||
|
}
|
||||||
|
|
||||||
cursorPos = getViewControls()->GetCursorPosition( !evt->Modifier( MD_ALT ) );
|
cursorPos = getViewControls()->GetCursorPosition( !evt->Modifier( MD_ALT ) );
|
||||||
|
|
||||||
auto cleanup = [&] () {
|
auto cleanup = [&] () {
|
||||||
|
@ -266,7 +275,7 @@ int LIB_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent )
|
||||||
while( TOOL_EVENT* evt = Wait() )
|
while( TOOL_EVENT* evt = Wait() )
|
||||||
{
|
{
|
||||||
if( !pointEditor->HasPoint() )
|
if( !pointEditor->HasPoint() )
|
||||||
m_frame->GetCanvas()->SetCurrentCursor( wxCURSOR_PENCIL );
|
m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::PENCIL );
|
||||||
|
|
||||||
VECTOR2I cursorPos = getViewControls()->GetCursorPosition( !evt->Modifier( MD_ALT ) );
|
VECTOR2I cursorPos = getViewControls()->GetCursorPosition( !evt->Modifier( MD_ALT ) );
|
||||||
|
|
||||||
|
@ -405,7 +414,7 @@ int LIB_DRAWING_TOOLS::PlaceAnchor( const TOOL_EVENT& aEvent )
|
||||||
// Main loop: keep receiving events
|
// Main loop: keep receiving events
|
||||||
while( TOOL_EVENT* evt = Wait() )
|
while( TOOL_EVENT* evt = Wait() )
|
||||||
{
|
{
|
||||||
m_frame->GetCanvas()->SetCurrentCursor( wxCURSOR_BULLSEYE );
|
m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::BULLSEYE );
|
||||||
|
|
||||||
if( evt->IsCancelInteractive() )
|
if( evt->IsCancelInteractive() )
|
||||||
{
|
{
|
||||||
|
|
|
@ -307,7 +307,7 @@ int LIB_EDIT_TOOL::DeleteItemCursor( const TOOL_EVENT& aEvent )
|
||||||
// Deactivate other tools; particularly important if another PICKER is currently running
|
// Deactivate other tools; particularly important if another PICKER is currently running
|
||||||
Activate();
|
Activate();
|
||||||
|
|
||||||
picker->SetCursor( wxStockCursor( wxCURSOR_BULLSEYE ) );
|
picker->SetCursor( KICURSOR::REMOVE );
|
||||||
|
|
||||||
picker->SetClickHandler(
|
picker->SetClickHandler(
|
||||||
[this] ( const VECTOR2D& aPosition ) -> bool
|
[this] ( const VECTOR2D& aPosition ) -> bool
|
||||||
|
|
|
@ -101,7 +101,7 @@ int LIB_MOVE_TOOL::Main( const TOOL_EVENT& aEvent )
|
||||||
// Main loop: keep receiving events
|
// Main loop: keep receiving events
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
m_frame->GetCanvas()->SetCurrentCursor( wxCURSOR_ARROW );
|
m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::MOVING );
|
||||||
|
|
||||||
if( evt->IsAction( &EE_ACTIONS::move ) || evt->IsMotion() || evt->IsDrag( BUT_LEFT )
|
if( evt->IsAction( &EE_ACTIONS::move ) || evt->IsMotion() || evt->IsDrag( BUT_LEFT )
|
||||||
|| evt->IsAction( &ACTIONS::refreshPreview )
|
|| evt->IsAction( &ACTIONS::refreshPreview )
|
||||||
|
|
|
@ -113,10 +113,12 @@ int SCH_DRAWING_TOOLS::PlaceComponent( const TOOL_EVENT& aEvent )
|
||||||
else if( aEvent.HasPosition() )
|
else if( aEvent.HasPosition() )
|
||||||
m_toolMgr->RunAction( EE_ACTIONS::cursorClick );
|
m_toolMgr->RunAction( EE_ACTIONS::cursorClick );
|
||||||
|
|
||||||
|
m_frame->GetCanvas()->SetCurrentCursor( component ? KICURSOR::MOVING : KICURSOR::PENCIL );
|
||||||
|
|
||||||
// Main loop: keep receiving events
|
// Main loop: keep receiving events
|
||||||
while( TOOL_EVENT* evt = Wait() )
|
while( TOOL_EVENT* evt = Wait() )
|
||||||
{
|
{
|
||||||
m_frame->GetCanvas()->SetCurrentCursor( component ? wxCURSOR_ARROW : wxCURSOR_PENCIL );
|
m_frame->GetCanvas()->SetCurrentCursor( component ? KICURSOR::MOVING : KICURSOR::PENCIL );
|
||||||
VECTOR2I cursorPos = getViewControls()->GetCursorPosition( !evt->Modifier( MD_ALT ) );
|
VECTOR2I cursorPos = getViewControls()->GetCursorPosition( !evt->Modifier( MD_ALT ) );
|
||||||
|
|
||||||
auto cleanup = [&] () {
|
auto cleanup = [&] () {
|
||||||
|
@ -302,10 +304,13 @@ int SCH_DRAWING_TOOLS::PlaceImage( const TOOL_EVENT& aEvent )
|
||||||
else if( aEvent.HasPosition() )
|
else if( aEvent.HasPosition() )
|
||||||
m_toolMgr->RunAction( ACTIONS::cursorClick );
|
m_toolMgr->RunAction( ACTIONS::cursorClick );
|
||||||
|
|
||||||
|
// Set initial cursor
|
||||||
|
m_frame->GetCanvas()->SetCurrentCursor( image ? KICURSOR::MOVING : KICURSOR::PENCIL );
|
||||||
|
|
||||||
// Main loop: keep receiving events
|
// Main loop: keep receiving events
|
||||||
while( TOOL_EVENT* evt = Wait() )
|
while( TOOL_EVENT* evt = Wait() )
|
||||||
{
|
{
|
||||||
m_frame->GetCanvas()->SetCurrentCursor( image ? wxCURSOR_ARROW : wxCURSOR_PENCIL );
|
m_frame->GetCanvas()->SetCurrentCursor( image ? KICURSOR::MOVING : KICURSOR::PENCIL );
|
||||||
cursorPos = getViewControls()->GetCursorPosition( !evt->Modifier( MD_ALT ) );
|
cursorPos = getViewControls()->GetCursorPosition( !evt->Modifier( MD_ALT ) );
|
||||||
|
|
||||||
auto cleanup = [&] () {
|
auto cleanup = [&] () {
|
||||||
|
@ -480,10 +485,13 @@ int SCH_DRAWING_TOOLS::SingleClickPlace( const TOOL_EVENT& aEvent )
|
||||||
if( aEvent.HasPosition() )
|
if( aEvent.HasPosition() )
|
||||||
m_toolMgr->RunAction( ACTIONS::cursorClick );
|
m_toolMgr->RunAction( ACTIONS::cursorClick );
|
||||||
|
|
||||||
|
// Set initial cursor
|
||||||
|
m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::ARROW );
|
||||||
|
|
||||||
// Main loop: keep receiving events
|
// Main loop: keep receiving events
|
||||||
while( TOOL_EVENT* evt = Wait() )
|
while( TOOL_EVENT* evt = Wait() )
|
||||||
{
|
{
|
||||||
m_frame->GetCanvas()->SetCurrentCursor( wxCURSOR_ARROW );
|
m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::ARROW );
|
||||||
cursorPos = (wxPoint) getViewControls()->GetCursorPosition( !evt->Modifier( MD_ALT ) );
|
cursorPos = (wxPoint) getViewControls()->GetCursorPosition( !evt->Modifier( MD_ALT ) );
|
||||||
|
|
||||||
if( evt->IsCancelInteractive() )
|
if( evt->IsCancelInteractive() )
|
||||||
|
@ -725,6 +733,7 @@ int SCH_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent )
|
||||||
{
|
{
|
||||||
EDA_ITEM* item = nullptr;
|
EDA_ITEM* item = nullptr;
|
||||||
bool importMode = aEvent.IsAction( &EE_ACTIONS::importSheetPin );
|
bool importMode = aEvent.IsAction( &EE_ACTIONS::importSheetPin );
|
||||||
|
bool isText = aEvent.IsAction( &EE_ACTIONS::placeSchematicText );
|
||||||
KICAD_T type = aEvent.Parameter<KICAD_T>();
|
KICAD_T type = aEvent.Parameter<KICAD_T>();
|
||||||
|
|
||||||
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true );
|
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true );
|
||||||
|
@ -738,10 +747,13 @@ int SCH_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent )
|
||||||
if( aEvent.HasPosition() )
|
if( aEvent.HasPosition() )
|
||||||
m_toolMgr->RunAction( ACTIONS::cursorClick );
|
m_toolMgr->RunAction( ACTIONS::cursorClick );
|
||||||
|
|
||||||
|
// Set initial cursor
|
||||||
|
m_frame->GetCanvas()->SetCurrentCursor( isText ? KICURSOR::TEXT : KICURSOR::PENCIL );
|
||||||
|
|
||||||
// Main loop: keep receiving events
|
// Main loop: keep receiving events
|
||||||
while( TOOL_EVENT* evt = Wait() )
|
while( TOOL_EVENT* evt = Wait() )
|
||||||
{
|
{
|
||||||
m_frame->GetCanvas()->SetCurrentCursor( item ? wxCURSOR_ARROW : wxCURSOR_PENCIL );
|
m_frame->GetCanvas()->SetCurrentCursor( isText ? KICURSOR::TEXT : KICURSOR::PENCIL );
|
||||||
VECTOR2I cursorPos = getViewControls()->GetCursorPosition( !evt->Modifier( MD_ALT ) );
|
VECTOR2I cursorPos = getViewControls()->GetCursorPosition( !evt->Modifier( MD_ALT ) );
|
||||||
|
|
||||||
auto cleanup = [&] () {
|
auto cleanup = [&] () {
|
||||||
|
@ -933,11 +945,13 @@ int SCH_DRAWING_TOOLS::DrawSheet( const TOOL_EVENT& aEvent )
|
||||||
if( aEvent.HasPosition() )
|
if( aEvent.HasPosition() )
|
||||||
m_toolMgr->RunAction( ACTIONS::cursorClick );
|
m_toolMgr->RunAction( ACTIONS::cursorClick );
|
||||||
|
|
||||||
|
m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::PENCIL );
|
||||||
|
|
||||||
// Main loop: keep receiving events
|
// Main loop: keep receiving events
|
||||||
while( TOOL_EVENT* evt = Wait() )
|
while( TOOL_EVENT* evt = Wait() )
|
||||||
{
|
{
|
||||||
if( !pointEditor->HasPoint() )
|
if( !pointEditor->HasPoint() )
|
||||||
m_frame->GetCanvas()->SetCurrentCursor( wxCURSOR_PENCIL );
|
m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::PENCIL );
|
||||||
|
|
||||||
VECTOR2I cursorPos = getViewControls()->GetCursorPosition( !evt->Modifier( MD_ALT ) );
|
VECTOR2I cursorPos = getViewControls()->GetCursorPosition( !evt->Modifier( MD_ALT ) );
|
||||||
|
|
||||||
|
|
|
@ -1110,7 +1110,7 @@ int SCH_EDIT_TOOL::DeleteItemCursor( const TOOL_EVENT& aEvent )
|
||||||
// Deactivate other tools; particularly important if another PICKER is currently running
|
// Deactivate other tools; particularly important if another PICKER is currently running
|
||||||
Activate();
|
Activate();
|
||||||
|
|
||||||
picker->SetCursor( wxStockCursor( wxCURSOR_BULLSEYE ) );
|
picker->SetCursor( KICURSOR::REMOVE );
|
||||||
|
|
||||||
picker->SetClickHandler(
|
picker->SetClickHandler(
|
||||||
[this] ( const VECTOR2D& aPosition ) -> bool
|
[this] ( const VECTOR2D& aPosition ) -> bool
|
||||||
|
|
|
@ -47,7 +47,6 @@
|
||||||
#include <schematic.h>
|
#include <schematic.h>
|
||||||
#include <advanced_config.h>
|
#include <advanced_config.h>
|
||||||
#include <sim/sim_plot_frame.h>
|
#include <sim/sim_plot_frame.h>
|
||||||
#include <simulation_cursors.h>
|
|
||||||
#include <lib_view_frame.h>
|
#include <lib_view_frame.h>
|
||||||
#include <status_popup.h>
|
#include <status_popup.h>
|
||||||
#include <tool/picker_tool.h>
|
#include <tool/picker_tool.h>
|
||||||
|
@ -631,7 +630,7 @@ int SCH_EDITOR_CONTROL::SimProbe( const TOOL_EVENT& aEvent )
|
||||||
// Deactivate other tools; particularly important if another PICKER is currently running
|
// Deactivate other tools; particularly important if another PICKER is currently running
|
||||||
Activate();
|
Activate();
|
||||||
|
|
||||||
picker->SetCursor( SIM_CURSORS::GetCursor( SIM_CURSORS::VOLTAGE_PROBE ) );
|
picker->SetCursor( KICURSOR::VOLTAGE_PROBE );
|
||||||
|
|
||||||
picker->SetClickHandler(
|
picker->SetClickHandler(
|
||||||
[this, simFrame] ( const VECTOR2D& aPosition )
|
[this, simFrame] ( const VECTOR2D& aPosition )
|
||||||
|
@ -693,9 +692,9 @@ int SCH_EDITOR_CONTROL::SimProbe( const TOOL_EVENT& aEvent )
|
||||||
}
|
}
|
||||||
|
|
||||||
if( item && item->Type() == SCH_PIN_T )
|
if( item && item->Type() == SCH_PIN_T )
|
||||||
picker->SetCursor( SIM_CURSORS::GetCursor( SIM_CURSORS::CURRENT_PROBE ) );
|
picker->SetCursor( KICURSOR::CURRENT_PROBE );
|
||||||
else
|
else
|
||||||
picker->SetCursor( SIM_CURSORS::GetCursor( SIM_CURSORS::VOLTAGE_PROBE ) );
|
picker->SetCursor( KICURSOR::VOLTAGE_PROBE );
|
||||||
|
|
||||||
if( m_pickerItem != item )
|
if( m_pickerItem != item )
|
||||||
{
|
{
|
||||||
|
@ -747,7 +746,7 @@ int SCH_EDITOR_CONTROL::SimTune( const TOOL_EVENT& aEvent )
|
||||||
// Deactivate other tools; particularly important if another PICKER is currently running
|
// Deactivate other tools; particularly important if another PICKER is currently running
|
||||||
Activate();
|
Activate();
|
||||||
|
|
||||||
picker->SetCursor( SIM_CURSORS::GetCursor( SIM_CURSORS::CURSOR::TUNE ) );
|
picker->SetCursor( KICURSOR::TUNE );
|
||||||
|
|
||||||
picker->SetClickHandler(
|
picker->SetClickHandler(
|
||||||
[this] ( const VECTOR2D& aPosition )
|
[this] ( const VECTOR2D& aPosition )
|
||||||
|
@ -1138,7 +1137,7 @@ int SCH_EDITOR_CONTROL::HighlightNetCursor( const TOOL_EVENT& aEvent )
|
||||||
// Deactivate other tools; particularly important if another PICKER is currently running
|
// Deactivate other tools; particularly important if another PICKER is currently running
|
||||||
Activate();
|
Activate();
|
||||||
|
|
||||||
picker->SetCursor( wxStockCursor( wxCURSOR_BULLSEYE ) );
|
picker->SetCursor( KICURSOR::BULLSEYE );
|
||||||
|
|
||||||
picker->SetClickHandler(
|
picker->SetClickHandler(
|
||||||
[this] ( const VECTOR2D& aPos )
|
[this] ( const VECTOR2D& aPos )
|
||||||
|
|
|
@ -481,11 +481,13 @@ int SCH_LINE_WIRE_BUS_TOOL::doDrawSegments( const std::string& aTool, int aType,
|
||||||
if( !m_wires.empty() )
|
if( !m_wires.empty() )
|
||||||
segment = m_wires.back();
|
segment = m_wires.back();
|
||||||
|
|
||||||
|
// Set initial cursor
|
||||||
|
m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::WIRE );
|
||||||
|
|
||||||
// Main loop: keep receiving events
|
// Main loop: keep receiving events
|
||||||
while( TOOL_EVENT* evt = Wait() )
|
while( TOOL_EVENT* evt = Wait() )
|
||||||
{
|
{
|
||||||
if( !pointEditor->HasPoint() ) // Set wxCursor shape when starting the tool
|
m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::WIRE );
|
||||||
m_frame->GetCanvas()->SetCurrentCursor( wxCURSOR_PENCIL );
|
|
||||||
|
|
||||||
grid.SetSnap( !evt->Modifier( MD_SHIFT ) );
|
grid.SetSnap( !evt->Modifier( MD_SHIFT ) );
|
||||||
wxPoint cursorPos = wxPoint( grid.BestSnapAnchor(
|
wxPoint cursorPos = wxPoint( grid.BestSnapAnchor(
|
||||||
|
|
|
@ -175,7 +175,7 @@ int SCH_MOVE_TOOL::Main( const TOOL_EVENT& aEvent )
|
||||||
// Main loop: keep receiving events
|
// Main loop: keep receiving events
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
m_frame->GetCanvas()->SetCurrentCursor( wxCURSOR_ARROW );
|
m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::MOVING );
|
||||||
|
|
||||||
if( evt->IsAction( &EE_ACTIONS::moveActivate ) || evt->IsAction( &EE_ACTIONS::restartMove )
|
if( evt->IsAction( &EE_ACTIONS::moveActivate ) || evt->IsAction( &EE_ACTIONS::restartMove )
|
||||||
|| evt->IsAction( &EE_ACTIONS::move ) || evt->IsAction( &EE_ACTIONS::drag )
|
|| evt->IsAction( &EE_ACTIONS::move ) || evt->IsAction( &EE_ACTIONS::drag )
|
||||||
|
|
|
@ -185,7 +185,7 @@ int GERBVIEW_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
|
||||||
while( TOOL_EVENT* evt = Wait() )
|
while( TOOL_EVENT* evt = Wait() )
|
||||||
{
|
{
|
||||||
if( m_frame->ToolStackIsEmpty() )
|
if( m_frame->ToolStackIsEmpty() )
|
||||||
m_frame->GetCanvas()->SetCurrentCursor( wxCURSOR_ARROW );
|
m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::ARROW );
|
||||||
|
|
||||||
m_additive = m_subtractive = m_exclusive_or = false;
|
m_additive = m_subtractive = m_exclusive_or = false;
|
||||||
|
|
||||||
|
@ -582,7 +582,7 @@ int GERBVIEW_SELECTION_TOOL::MeasureTool( const TOOL_EVENT& aEvent )
|
||||||
|
|
||||||
while( TOOL_EVENT* evt = Wait() )
|
while( TOOL_EVENT* evt = Wait() )
|
||||||
{
|
{
|
||||||
m_frame->GetCanvas()->SetCurrentCursor( wxCURSOR_ARROW );
|
m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::MEASURE );
|
||||||
const VECTOR2I cursorPos = controls.GetCursorPosition();
|
const VECTOR2I cursorPos = controls.GetCursorPosition();
|
||||||
|
|
||||||
auto clearRuler =
|
auto clearRuler =
|
||||||
|
|
|
@ -36,6 +36,7 @@
|
||||||
#include <msgpanel.h>
|
#include <msgpanel.h>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <common.h>
|
#include <common.h>
|
||||||
|
#include <cursors.h>
|
||||||
|
|
||||||
class BOARD;
|
class BOARD;
|
||||||
class EDA_DRAW_FRAME;
|
class EDA_DRAW_FRAME;
|
||||||
|
@ -197,8 +198,7 @@ public:
|
||||||
* Function SetCurrentCursor
|
* Function SetCurrentCursor
|
||||||
* Set the current cursor shape for this panel
|
* Set the current cursor shape for this panel
|
||||||
*/
|
*/
|
||||||
void SetCurrentCursor( wxStockCursor aStockCursorID );
|
void SetCurrentCursor( KICURSOR cursor );
|
||||||
void SetCurrentCursor( const wxCursor& aCursor );
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the bounding box of the view that should be used if model is not valid
|
* Returns the bounding box of the view that should be used if model is not valid
|
||||||
|
@ -244,7 +244,8 @@ protected:
|
||||||
|
|
||||||
static const int MinRefreshPeriod = 17; ///< 60 FPS.
|
static const int MinRefreshPeriod = 17; ///< 60 FPS.
|
||||||
|
|
||||||
wxCursor m_currentCursor; ///< Current mouse cursor shape id.
|
wxCursor m_currentCursor; ///< Current mouse cursor shape id.
|
||||||
|
KICURSOR m_currentKiCursor;
|
||||||
|
|
||||||
wxWindow* m_parent; ///< Pointer to the parent window
|
wxWindow* m_parent; ///< Pointer to the parent window
|
||||||
EDA_DRAW_FRAME* m_edaFrame; ///< Parent EDA_DRAW_FRAME (if available)
|
EDA_DRAW_FRAME* m_edaFrame; ///< Parent EDA_DRAW_FRAME (if available)
|
||||||
|
|
|
@ -30,6 +30,26 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
|
||||||
|
enum class KICURSOR
|
||||||
|
{
|
||||||
|
DEFAULT,
|
||||||
|
ARROW,
|
||||||
|
MOVING,
|
||||||
|
PENCIL,
|
||||||
|
REMOVE,
|
||||||
|
HAND,
|
||||||
|
BULLSEYE,
|
||||||
|
VOLTAGE_PROBE,
|
||||||
|
CURRENT_PROBE,
|
||||||
|
TUNE,
|
||||||
|
TEXT,
|
||||||
|
WIRE,
|
||||||
|
MEASURE,
|
||||||
|
ADD,
|
||||||
|
SUBTRACT,
|
||||||
|
XOR
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Simple class to construct and store cursors against unique ID keys.
|
* Simple class to construct and store cursors against unique ID keys.
|
||||||
*
|
*
|
||||||
|
@ -45,7 +65,7 @@ public:
|
||||||
struct CURSOR_DEF
|
struct CURSOR_DEF
|
||||||
{
|
{
|
||||||
///> The ID key used to uniquely identify a cursor in a given store
|
///> The ID key used to uniquely identify a cursor in a given store
|
||||||
int m_id_key;
|
KICURSOR m_id_key;
|
||||||
|
|
||||||
///> The image data bitmap
|
///> The image data bitmap
|
||||||
const unsigned char* m_image_data;
|
const unsigned char* m_image_data;
|
||||||
|
@ -53,6 +73,8 @@ public:
|
||||||
///> The mask data bitmap
|
///> The mask data bitmap
|
||||||
const unsigned char* m_mask_data;
|
const unsigned char* m_mask_data;
|
||||||
|
|
||||||
|
const char** m_xpm;
|
||||||
|
|
||||||
///> The image size in pixels
|
///> The image size in pixels
|
||||||
wxSize m_size;
|
wxSize m_size;
|
||||||
|
|
||||||
|
@ -75,11 +97,15 @@ public:
|
||||||
* @param aIdKey the ID key to look up
|
* @param aIdKey the ID key to look up
|
||||||
* @return the cursor, if found, else wxNullCursor
|
* @return the cursor, if found, else wxNullCursor
|
||||||
*/
|
*/
|
||||||
const wxCursor& Get( int aIdKey ) const;
|
const wxCursor& Get( KICURSOR aIdKey ) const;
|
||||||
|
|
||||||
|
static const wxCursor GetCursor( KICURSOR aCursorType );
|
||||||
|
|
||||||
|
static const wxStockCursor GetStockCursor( KICURSOR aCursorType );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
///> Internal store of cursors by ID
|
///> Internal store of cursors by ID
|
||||||
std::map<int, wxCursor> m_store;
|
std::map<KICURSOR, wxCursor> m_store;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CURSOR_STORE__H
|
#endif // CURSOR_STORE__H
|
|
@ -28,6 +28,7 @@
|
||||||
#include <boost/optional/optional.hpp>
|
#include <boost/optional/optional.hpp>
|
||||||
#include <math/vector2d.h>
|
#include <math/vector2d.h>
|
||||||
#include <tool/tool_interactive.h>
|
#include <tool/tool_interactive.h>
|
||||||
|
#include <cursors.h>
|
||||||
|
|
||||||
class EDA_DRAW_FRAME;
|
class EDA_DRAW_FRAME;
|
||||||
|
|
||||||
|
@ -62,7 +63,7 @@ public:
|
||||||
///> Main event loop.
|
///> Main event loop.
|
||||||
int Main( const TOOL_EVENT& aEvent );
|
int Main( const TOOL_EVENT& aEvent );
|
||||||
|
|
||||||
inline void SetCursor( const wxCursor& aCursor ) { m_cursor = aCursor; }
|
inline void SetCursor( KICURSOR aCursor ) { m_cursor = aCursor; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function SetClickHandler()
|
* Function SetClickHandler()
|
||||||
|
@ -116,8 +117,8 @@ private:
|
||||||
void setTransitions() override;
|
void setTransitions() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
EDA_DRAW_FRAME* m_frame;
|
EDA_DRAW_FRAME* m_frame;
|
||||||
wxCursor m_cursor;
|
KICURSOR m_cursor;
|
||||||
|
|
||||||
OPT<CLICK_HANDLER> m_clickHandler;
|
OPT<CLICK_HANDLER> m_clickHandler;
|
||||||
OPT<MOTION_HANDLER> m_motionHandler;
|
OPT<MOTION_HANDLER> m_motionHandler;
|
||||||
|
|
|
@ -47,3 +47,17 @@ void KIPLATFORM::UI::FixupCancelButtonCmdKeyCollision( wxWindow *aWindow )
|
||||||
{
|
{
|
||||||
// Not needed on this platform
|
// Not needed on this platform
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool KIPLATFORM::UI::IsStockCursorOk( wxStockCursor aCursor )
|
||||||
|
{
|
||||||
|
switch( aCursor )
|
||||||
|
{
|
||||||
|
case wxCURSOR_BULLSEYE:
|
||||||
|
case wxCURSOR_HAND:
|
||||||
|
case wxCURSOR_ARROW:
|
||||||
|
return true;
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
|
@ -21,6 +21,8 @@
|
||||||
#ifndef KIPLATFORM_UI_H_
|
#ifndef KIPLATFORM_UI_H_
|
||||||
#define KIPLATFORM_UI_H_
|
#define KIPLATFORM_UI_H_
|
||||||
|
|
||||||
|
#include <wx/cursor.h>
|
||||||
|
|
||||||
class wxNonOwnedWindow;
|
class wxNonOwnedWindow;
|
||||||
class wxWindow;
|
class wxWindow;
|
||||||
|
|
||||||
|
@ -67,6 +69,13 @@ namespace KIPLATFORM
|
||||||
* German because the button is &Abbrechen.
|
* German because the button is &Abbrechen.
|
||||||
*/
|
*/
|
||||||
void FixupCancelButtonCmdKeyCollision( wxWindow* aWindow );
|
void FixupCancelButtonCmdKeyCollision( wxWindow* aWindow );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if we designated a stock cursor for this OS as "OK" or else we may need to load a custom one
|
||||||
|
*
|
||||||
|
* @param aCursor is wxStockCursor we want to see if its acceptable
|
||||||
|
*/
|
||||||
|
bool IsStockCursorOk( wxStockCursor aCursor );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
|
|
||||||
#include <kiplatform/ui.h>
|
#include <kiplatform/ui.h>
|
||||||
|
|
||||||
|
#include <wx/cursor.h>
|
||||||
#include <wx/nonownedwnd.h>
|
#include <wx/nonownedwnd.h>
|
||||||
#include <wx/window.h>
|
#include <wx/window.h>
|
||||||
|
|
||||||
|
@ -47,3 +48,18 @@ void KIPLATFORM::UI::FixupCancelButtonCmdKeyCollision( wxWindow *aWindow )
|
||||||
{
|
{
|
||||||
// Not needed on this platform
|
// Not needed on this platform
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool KIPLATFORM::UI::IsStockCursorOk( wxStockCursor aCursor )
|
||||||
|
{
|
||||||
|
switch( aCursor )
|
||||||
|
{
|
||||||
|
case wxCURSOR_SIZING:
|
||||||
|
case wxCURSOR_BULLSEYE:
|
||||||
|
case wxCURSOR_HAND:
|
||||||
|
case wxCURSOR_ARROW:
|
||||||
|
return true;
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
|
@ -71,3 +71,17 @@ void KIPLATFORM::UI::FixupCancelButtonCmdKeyCollision( wxWindow *aWindow )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool KIPLATFORM::UI::IsStockCursorOk( wxStockCursor aCursor )
|
||||||
|
{
|
||||||
|
switch( aCursor )
|
||||||
|
{
|
||||||
|
case wxCURSOR_SIZING:
|
||||||
|
case wxCURSOR_BULLSEYE:
|
||||||
|
case wxCURSOR_HAND:
|
||||||
|
case wxCURSOR_ARROW:
|
||||||
|
return true;
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
|
@ -92,7 +92,8 @@ int PL_DRAWING_TOOLS::PlaceItem( const TOOL_EVENT& aEvent )
|
||||||
// Main loop: keep receiving events
|
// Main loop: keep receiving events
|
||||||
while( TOOL_EVENT* evt = Wait() )
|
while( TOOL_EVENT* evt = Wait() )
|
||||||
{
|
{
|
||||||
m_frame->GetCanvas()->SetCurrentCursor( item ? wxCURSOR_ARROW : wxCURSOR_PENCIL );
|
m_frame->GetCanvas()->SetCurrentCursor(
|
||||||
|
item ? KICURSOR::ARROW : KICURSOR::PENCIL );
|
||||||
cursorPos = getViewControls()->GetCursorPosition( !evt->Modifier( MD_ALT ) );
|
cursorPos = getViewControls()->GetCursorPosition( !evt->Modifier( MD_ALT ) );
|
||||||
|
|
||||||
auto cleanup = [&] () {
|
auto cleanup = [&] () {
|
||||||
|
@ -212,7 +213,7 @@ int PL_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent )
|
||||||
while( TOOL_EVENT* evt = Wait() )
|
while( TOOL_EVENT* evt = Wait() )
|
||||||
{
|
{
|
||||||
if( !pointEditor->HasPoint() )
|
if( !pointEditor->HasPoint() )
|
||||||
m_frame->GetCanvas()->SetCurrentCursor( wxCURSOR_PENCIL );
|
m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::PENCIL );
|
||||||
|
|
||||||
VECTOR2I cursorPos = getViewControls()->GetCursorPosition( !evt->Modifier( MD_ALT ) );
|
VECTOR2I cursorPos = getViewControls()->GetCursorPosition( !evt->Modifier( MD_ALT ) );
|
||||||
|
|
||||||
|
|
|
@ -121,7 +121,7 @@ int PL_EDIT_TOOL::Main( const TOOL_EVENT& aEvent )
|
||||||
// Main loop: keep receiving events
|
// Main loop: keep receiving events
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
m_frame->GetCanvas()->SetCurrentCursor( wxCURSOR_ARROW );
|
m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::MOVING );
|
||||||
|
|
||||||
if( evt->IsAction( &PL_ACTIONS::move ) || evt->IsMotion() || evt->IsDrag( BUT_LEFT )
|
if( evt->IsAction( &PL_ACTIONS::move ) || evt->IsMotion() || evt->IsDrag( BUT_LEFT )
|
||||||
|| evt->IsAction( &ACTIONS::refreshPreview ) )
|
|| evt->IsAction( &ACTIONS::refreshPreview ) )
|
||||||
|
@ -350,7 +350,7 @@ int PL_EDIT_TOOL::DeleteItemCursor( const TOOL_EVENT& aEvent )
|
||||||
// Deactivate other tools; particularly important if another PICKER is currently running
|
// Deactivate other tools; particularly important if another PICKER is currently running
|
||||||
Activate();
|
Activate();
|
||||||
|
|
||||||
picker->SetCursor( wxStockCursor( wxCURSOR_BULLSEYE ) );
|
picker->SetCursor( KICURSOR::REMOVE );
|
||||||
m_pickerItem = nullptr;
|
m_pickerItem = nullptr;
|
||||||
|
|
||||||
picker->SetClickHandler(
|
picker->SetClickHandler(
|
||||||
|
|
|
@ -399,7 +399,7 @@ void PL_POINT_EDITOR::setEditedPoint( EDIT_POINT* aPoint )
|
||||||
|
|
||||||
if( aPoint )
|
if( aPoint )
|
||||||
{
|
{
|
||||||
m_frame->GetCanvas()->SetCurrentCursor( wxCURSOR_ARROW );
|
m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::ARROW );
|
||||||
controls->ForceCursorPosition( true, aPoint->GetPosition() );
|
controls->ForceCursorPosition( true, aPoint->GetPosition() );
|
||||||
controls->ShowCursor( true );
|
controls->ShowCursor( true );
|
||||||
}
|
}
|
||||||
|
|
|
@ -113,9 +113,6 @@ int PL_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
|
||||||
// Main loop: keep receiving events
|
// Main loop: keep receiving events
|
||||||
while( TOOL_EVENT* evt = Wait() )
|
while( TOOL_EVENT* evt = Wait() )
|
||||||
{
|
{
|
||||||
if( m_frame->ToolStackIsEmpty() )
|
|
||||||
m_frame->GetCanvas()->SetCurrentCursor( wxCURSOR_ARROW );
|
|
||||||
|
|
||||||
m_additive = m_subtractive = m_exclusive_or = false;
|
m_additive = m_subtractive = m_exclusive_or = false;
|
||||||
|
|
||||||
if( evt->Modifier( MD_SHIFT ) && evt->Modifier( MD_CTRL ) )
|
if( evt->Modifier( MD_SHIFT ) && evt->Modifier( MD_CTRL ) )
|
||||||
|
@ -125,6 +122,8 @@ int PL_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
|
||||||
else if( evt->Modifier( MD_CTRL ) )
|
else if( evt->Modifier( MD_CTRL ) )
|
||||||
m_exclusive_or = true;
|
m_exclusive_or = true;
|
||||||
|
|
||||||
|
bool modifier_enabled = m_subtractive || m_additive || m_exclusive_or;
|
||||||
|
|
||||||
// Is the user requesting that the selection list include all possible
|
// Is the user requesting that the selection list include all possible
|
||||||
// items without removing less likely selection candidates
|
// items without removing less likely selection candidates
|
||||||
m_skip_heuristics = !!evt->Modifier( MD_ALT );
|
m_skip_heuristics = !!evt->Modifier( MD_ALT );
|
||||||
|
@ -159,7 +158,7 @@ int PL_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
|
||||||
// drag with LMB? Select multiple objects (or at least draw a selection box) or drag them
|
// drag with LMB? Select multiple objects (or at least draw a selection box) or drag them
|
||||||
else if( evt->IsDrag( BUT_LEFT ) )
|
else if( evt->IsDrag( BUT_LEFT ) )
|
||||||
{
|
{
|
||||||
if( m_additive || m_subtractive || m_exclusive_or || m_selection.Empty() )
|
if( modifier_enabled || m_selection.Empty() )
|
||||||
{
|
{
|
||||||
selectMultiple();
|
selectMultiple();
|
||||||
}
|
}
|
||||||
|
@ -169,7 +168,7 @@ int PL_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
|
||||||
if( selectionContains( evt->Position() ) )
|
if( selectionContains( evt->Position() ) )
|
||||||
{
|
{
|
||||||
// Yes -> run the move tool and wait till it finishes
|
// Yes -> run the move tool and wait till it finishes
|
||||||
m_toolMgr->InvokeTool( "plEditor.InteractiveEdit" );
|
m_toolMgr->RunAction( "plEditor.InteractiveMove.move", true );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -197,6 +196,25 @@ int PL_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
|
||||||
|
|
||||||
else
|
else
|
||||||
evt->SetPassEvent();
|
evt->SetPassEvent();
|
||||||
|
|
||||||
|
|
||||||
|
if( m_frame->ToolStackIsEmpty() )
|
||||||
|
{
|
||||||
|
if( !modifier_enabled && !m_selection.Empty() && !m_frame->GetDragSelects()
|
||||||
|
&& evt->HasPosition() && selectionContains( evt->Position() ) )
|
||||||
|
m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::MOVING );
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if( m_additive )
|
||||||
|
m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::ADD );
|
||||||
|
else if( m_subtractive )
|
||||||
|
m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::SUBTRACT );
|
||||||
|
else if( m_exclusive_or )
|
||||||
|
m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::XOR );
|
||||||
|
else
|
||||||
|
m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::ARROW );
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -137,7 +137,7 @@ int MICROWAVE_TOOL::drawMicrowaveInductor( const TOOL_EVENT& aEvent )
|
||||||
|
|
||||||
while( auto evt = Wait() )
|
while( auto evt = Wait() )
|
||||||
{
|
{
|
||||||
frame.GetCanvas()->SetCurrentCursor( wxCURSOR_PENCIL );
|
frame.GetCanvas()->SetCurrentCursor( KICURSOR::PENCIL );
|
||||||
VECTOR2I cursorPos = controls.GetCursorPosition();
|
VECTOR2I cursorPos = controls.GetCursorPosition();
|
||||||
|
|
||||||
auto cleanup = [&] () {
|
auto cleanup = [&] () {
|
||||||
|
|
|
@ -183,7 +183,7 @@ void LENGTH_TUNER_TOOL::performTuning()
|
||||||
|
|
||||||
while( TOOL_EVENT* evt = Wait() )
|
while( TOOL_EVENT* evt = Wait() )
|
||||||
{
|
{
|
||||||
frame()->GetCanvas()->SetCurrentCursor( wxCURSOR_ARROW );
|
frame()->GetCanvas()->SetCurrentCursor( KICURSOR::ARROW );
|
||||||
|
|
||||||
if( evt->IsCancelInteractive() || evt->IsActivate() )
|
if( evt->IsCancelInteractive() || evt->IsActivate() )
|
||||||
{
|
{
|
||||||
|
@ -274,7 +274,7 @@ int LENGTH_TUNER_TOOL::MainLoop( const TOOL_EVENT& aEvent )
|
||||||
// Main loop: keep receiving events
|
// Main loop: keep receiving events
|
||||||
while( TOOL_EVENT* evt = Wait() )
|
while( TOOL_EVENT* evt = Wait() )
|
||||||
{
|
{
|
||||||
frame()->GetCanvas()->SetCurrentCursor( wxCURSOR_ARROW );
|
frame()->GetCanvas()->SetCurrentCursor( KICURSOR::ARROW );
|
||||||
|
|
||||||
if( evt->IsCancelInteractive() || evt->IsActivate() )
|
if( evt->IsCancelInteractive() || evt->IsActivate() )
|
||||||
{
|
{
|
||||||
|
|
|
@ -916,7 +916,7 @@ void ROUTER_TOOL::performRouting()
|
||||||
|
|
||||||
while( TOOL_EVENT* evt = Wait() )
|
while( TOOL_EVENT* evt = Wait() )
|
||||||
{
|
{
|
||||||
frame()->GetCanvas()->SetCurrentCursor( wxCURSOR_PENCIL );
|
frame()->GetCanvas()->SetCurrentCursor( KICURSOR::PENCIL );
|
||||||
|
|
||||||
// Don't crash if we missed an operation that cancelled routing.
|
// Don't crash if we missed an operation that cancelled routing.
|
||||||
if( !m_router->RoutingInProgress() )
|
if( !m_router->RoutingInProgress() )
|
||||||
|
@ -1095,7 +1095,7 @@ int ROUTER_TOOL::MainLoop( const TOOL_EVENT& aEvent )
|
||||||
// Main loop: keep receiving events
|
// Main loop: keep receiving events
|
||||||
while( TOOL_EVENT* evt = Wait() )
|
while( TOOL_EVENT* evt = Wait() )
|
||||||
{
|
{
|
||||||
frame->GetCanvas()->SetCurrentCursor( wxCURSOR_PENCIL );
|
frame->GetCanvas()->SetCurrentCursor( KICURSOR::PENCIL );
|
||||||
|
|
||||||
if( evt->IsCancelInteractive() )
|
if( evt->IsCancelInteractive() )
|
||||||
{
|
{
|
||||||
|
@ -1429,7 +1429,7 @@ int ROUTER_TOOL::InlineDrag( const TOOL_EVENT& aEvent )
|
||||||
|
|
||||||
while( TOOL_EVENT* evt = Wait() )
|
while( TOOL_EVENT* evt = Wait() )
|
||||||
{
|
{
|
||||||
frame()->GetCanvas()->SetCurrentCursor( wxCURSOR_ARROW );
|
frame()->GetCanvas()->SetCurrentCursor( KICURSOR::ARROW );
|
||||||
|
|
||||||
if( evt->IsCancelInteractive() )
|
if( evt->IsCancelInteractive() )
|
||||||
{
|
{
|
||||||
|
|
|
@ -420,10 +420,14 @@ int DRAWING_TOOL::PlaceText( const TOOL_EVENT& aEvent )
|
||||||
if( aEvent.HasPosition() )
|
if( aEvent.HasPosition() )
|
||||||
m_toolMgr->RunAction( ACTIONS::cursorClick );
|
m_toolMgr->RunAction( ACTIONS::cursorClick );
|
||||||
|
|
||||||
|
// Set initial cursor
|
||||||
|
m_frame->GetCanvas()->SetCurrentCursor( text ? KICURSOR::ARROW : KICURSOR::TEXT );
|
||||||
|
|
||||||
// Main loop: keep receiving events
|
// Main loop: keep receiving events
|
||||||
while( TOOL_EVENT* evt = Wait() )
|
while( TOOL_EVENT* evt = Wait() )
|
||||||
{
|
{
|
||||||
m_frame->GetCanvas()->SetCurrentCursor( text ? wxCURSOR_ARROW : wxCURSOR_PENCIL );
|
m_frame->GetCanvas()->SetCurrentCursor(
|
||||||
|
text ? KICURSOR::ARROW : KICURSOR::TEXT );
|
||||||
VECTOR2I cursorPos = m_controls->GetCursorPosition();
|
VECTOR2I cursorPos = m_controls->GetCursorPosition();
|
||||||
|
|
||||||
auto cleanup = [&]()
|
auto cleanup = [&]()
|
||||||
|
@ -641,11 +645,13 @@ int DRAWING_TOOL::DrawDimension( const TOOL_EVENT& aEvent )
|
||||||
if( aEvent.HasPosition() )
|
if( aEvent.HasPosition() )
|
||||||
m_toolMgr->PrimeTool( aEvent.Position() );
|
m_toolMgr->PrimeTool( aEvent.Position() );
|
||||||
|
|
||||||
|
// Set initial cursor
|
||||||
|
m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::MEASURE );
|
||||||
|
|
||||||
// Main loop: keep receiving events
|
// Main loop: keep receiving events
|
||||||
while( TOOL_EVENT* evt = Wait() )
|
while( TOOL_EVENT* evt = Wait() )
|
||||||
{
|
{
|
||||||
if( !pointEditor->HasPoint() )
|
m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::MEASURE );
|
||||||
m_frame->GetCanvas()->SetCurrentCursor( wxCURSOR_PENCIL );
|
|
||||||
|
|
||||||
grid.SetSnap( !evt->Modifier( MD_SHIFT ) );
|
grid.SetSnap( !evt->Modifier( MD_SHIFT ) );
|
||||||
grid.SetUseGrid( m_frame->IsGridVisible() );
|
grid.SetUseGrid( m_frame->IsGridVisible() );
|
||||||
|
@ -1038,10 +1044,13 @@ int DRAWING_TOOL::PlaceImportedGraphics( const TOOL_EVENT& aEvent )
|
||||||
m_frame->PushTool( tool );
|
m_frame->PushTool( tool );
|
||||||
Activate();
|
Activate();
|
||||||
|
|
||||||
|
// Set initial cursor
|
||||||
|
m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::ARROW );
|
||||||
|
|
||||||
// Main loop: keep receiving events
|
// Main loop: keep receiving events
|
||||||
while( TOOL_EVENT* evt = Wait() )
|
while( TOOL_EVENT* evt = Wait() )
|
||||||
{
|
{
|
||||||
m_frame->GetCanvas()->SetCurrentCursor( wxCURSOR_ARROW );
|
m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::ARROW );
|
||||||
cursorPos = m_controls->GetCursorPosition();
|
cursorPos = m_controls->GetCursorPosition();
|
||||||
|
|
||||||
if( evt->IsCancelInteractive() || evt->IsActivate() )
|
if( evt->IsCancelInteractive() || evt->IsActivate() )
|
||||||
|
@ -1120,9 +1129,12 @@ int DRAWING_TOOL::SetAnchor( const TOOL_EVENT& aEvent )
|
||||||
m_controls->SetAutoPan( true );
|
m_controls->SetAutoPan( true );
|
||||||
m_controls->CaptureCursor( false );
|
m_controls->CaptureCursor( false );
|
||||||
|
|
||||||
|
// Set initial cursor
|
||||||
|
m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::BULLSEYE );
|
||||||
|
|
||||||
while( TOOL_EVENT* evt = Wait() )
|
while( TOOL_EVENT* evt = Wait() )
|
||||||
{
|
{
|
||||||
m_frame->GetCanvas()->SetCurrentCursor( wxCURSOR_BULLSEYE );
|
m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::BULLSEYE );
|
||||||
|
|
||||||
grid.SetSnap( !evt->Modifier( MD_SHIFT ) );
|
grid.SetSnap( !evt->Modifier( MD_SHIFT ) );
|
||||||
grid.SetUseGrid( m_frame->IsGridVisible() );
|
grid.SetUseGrid( m_frame->IsGridVisible() );
|
||||||
|
@ -1220,12 +1232,13 @@ bool DRAWING_TOOL::drawSegment( const std::string& aTool, int aShape, PCB_SHAPE*
|
||||||
|
|
||||||
frame()->SetMsgPanel( graphic );
|
frame()->SetMsgPanel( graphic );
|
||||||
|
|
||||||
|
// Set initial cursor
|
||||||
|
m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::PENCIL );
|
||||||
|
|
||||||
// Main loop: keep receiving events
|
// Main loop: keep receiving events
|
||||||
while( TOOL_EVENT* evt = Wait() )
|
while( TOOL_EVENT* evt = Wait() )
|
||||||
{
|
{
|
||||||
if( !pointEditor->HasPoint() )
|
m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::PENCIL );
|
||||||
m_frame->GetCanvas()->SetCurrentCursor( wxCURSOR_PENCIL );
|
|
||||||
|
|
||||||
m_frame->SetMsgPanel( graphic );
|
m_frame->SetMsgPanel( graphic );
|
||||||
|
|
||||||
grid.SetSnap( !evt->Modifier( MD_SHIFT ) );
|
grid.SetSnap( !evt->Modifier( MD_SHIFT ) );
|
||||||
|
@ -1484,13 +1497,17 @@ bool DRAWING_TOOL::drawArc( const std::string& aTool, PCB_SHAPE** aGraphic, bool
|
||||||
if( aImmediateMode )
|
if( aImmediateMode )
|
||||||
m_toolMgr->RunAction( ACTIONS::cursorClick );
|
m_toolMgr->RunAction( ACTIONS::cursorClick );
|
||||||
|
|
||||||
|
// Set initial cursor
|
||||||
|
m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::PENCIL );
|
||||||
|
|
||||||
// Main loop: keep receiving events
|
// Main loop: keep receiving events
|
||||||
while( TOOL_EVENT* evt = Wait() )
|
while( TOOL_EVENT* evt = Wait() )
|
||||||
{
|
{
|
||||||
|
m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::PENCIL );
|
||||||
|
|
||||||
PCB_LAYER_ID layer = m_frame->GetActiveLayer();
|
PCB_LAYER_ID layer = m_frame->GetActiveLayer();
|
||||||
graphic->SetLayer( layer );
|
graphic->SetLayer( layer );
|
||||||
|
|
||||||
m_frame->GetCanvas()->SetCurrentCursor( wxCURSOR_PENCIL );
|
|
||||||
grid.SetSnap( !evt->Modifier( MD_SHIFT ) );
|
grid.SetSnap( !evt->Modifier( MD_SHIFT ) );
|
||||||
grid.SetUseGrid( m_frame->IsGridVisible() );
|
grid.SetUseGrid( m_frame->IsGridVisible() );
|
||||||
VECTOR2I cursorPos = grid.BestSnapAnchor( m_controls->GetMousePosition(), graphic );
|
VECTOR2I cursorPos = grid.BestSnapAnchor( m_controls->GetMousePosition(), graphic );
|
||||||
|
@ -1734,10 +1751,13 @@ int DRAWING_TOOL::DrawZone( const TOOL_EVENT& aEvent )
|
||||||
if( aEvent.HasPosition() )
|
if( aEvent.HasPosition() )
|
||||||
m_toolMgr->PrimeTool( aEvent.Position() );
|
m_toolMgr->PrimeTool( aEvent.Position() );
|
||||||
|
|
||||||
|
// Set initial cursor
|
||||||
|
m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::PENCIL );
|
||||||
|
|
||||||
// Main loop: keep receiving events
|
// Main loop: keep receiving events
|
||||||
while( TOOL_EVENT* evt = Wait() )
|
while( TOOL_EVENT* evt = Wait() )
|
||||||
{
|
{
|
||||||
m_frame->GetCanvas()->SetCurrentCursor( wxCURSOR_PENCIL );
|
m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::PENCIL );
|
||||||
LSET layers( m_frame->GetActiveLayer() );
|
LSET layers( m_frame->GetActiveLayer() );
|
||||||
grid.SetSnap( !evt->Modifier( MD_SHIFT ) );
|
grid.SetSnap( !evt->Modifier( MD_SHIFT ) );
|
||||||
grid.SetUseGrid( m_frame->IsGridVisible() );
|
grid.SetUseGrid( m_frame->IsGridVisible() );
|
||||||
|
|
|
@ -408,7 +408,7 @@ int EDIT_TOOL::doMoveSelection( TOOL_EVENT aEvent, bool aPickReference )
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
VECTOR2I movement;
|
VECTOR2I movement;
|
||||||
editFrame->GetCanvas()->SetCurrentCursor( wxCURSOR_ARROW );
|
editFrame->GetCanvas()->SetCurrentCursor( KICURSOR::MOVING );
|
||||||
grid.SetSnap( !evt->Modifier( MD_SHIFT ) );
|
grid.SetSnap( !evt->Modifier( MD_SHIFT ) );
|
||||||
grid.SetUseGrid( !evt->Modifier( MD_ALT ) );
|
grid.SetUseGrid( !evt->Modifier( MD_ALT ) );
|
||||||
|
|
||||||
|
|
|
@ -296,7 +296,7 @@ int PAD_TOOL::EnumeratePads( const TOOL_EVENT& aEvent )
|
||||||
|
|
||||||
while( TOOL_EVENT* evt = Wait() )
|
while( TOOL_EVENT* evt = Wait() )
|
||||||
{
|
{
|
||||||
frame()->GetCanvas()->SetCurrentCursor( wxCURSOR_BULLSEYE );
|
frame()->GetCanvas()->SetCurrentCursor( KICURSOR::BULLSEYE );
|
||||||
|
|
||||||
if( evt->IsCancelInteractive() )
|
if( evt->IsCancelInteractive() )
|
||||||
{
|
{
|
||||||
|
|
|
@ -761,10 +761,12 @@ int PCB_EDITOR_CONTROL::PlaceModule( const TOOL_EVENT& aEvent )
|
||||||
else if( aEvent.HasPosition() )
|
else if( aEvent.HasPosition() )
|
||||||
m_toolMgr->RunAction( PCB_ACTIONS::cursorClick );
|
m_toolMgr->RunAction( PCB_ACTIONS::cursorClick );
|
||||||
|
|
||||||
|
m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::PENCIL );
|
||||||
|
|
||||||
// Main loop: keep receiving events
|
// Main loop: keep receiving events
|
||||||
while( TOOL_EVENT* evt = Wait() )
|
while( TOOL_EVENT* evt = Wait() )
|
||||||
{
|
{
|
||||||
m_frame->GetCanvas()->SetCurrentCursor( wxCURSOR_PENCIL );
|
m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::PENCIL );
|
||||||
cursorPos = controls->GetCursorPosition( !evt->Modifier( MD_ALT ) );
|
cursorPos = controls->GetCursorPosition( !evt->Modifier( MD_ALT ) );
|
||||||
|
|
||||||
if( reselect && module )
|
if( reselect && module )
|
||||||
|
@ -975,10 +977,12 @@ int PCB_EDITOR_CONTROL::PlaceTarget( const TOOL_EVENT& aEvent )
|
||||||
m_frame->PushTool( tool );
|
m_frame->PushTool( tool );
|
||||||
Activate();
|
Activate();
|
||||||
|
|
||||||
|
frame()->GetCanvas()->SetCurrentCursor( KICURSOR::ARROW );
|
||||||
|
|
||||||
// Main loop: keep receiving events
|
// Main loop: keep receiving events
|
||||||
while( TOOL_EVENT* evt = Wait() )
|
while( TOOL_EVENT* evt = Wait() )
|
||||||
{
|
{
|
||||||
frame()->GetCanvas()->SetCurrentCursor( wxCURSOR_ARROW );
|
frame()->GetCanvas()->SetCurrentCursor( KICURSOR::ARROW );
|
||||||
cursorPos = controls->GetCursorPosition( !evt->Modifier( MD_ALT ) );
|
cursorPos = controls->GetCursorPosition( !evt->Modifier( MD_ALT ) );
|
||||||
|
|
||||||
if( evt->IsCancelInteractive() )
|
if( evt->IsCancelInteractive() )
|
||||||
|
|
|
@ -82,13 +82,19 @@ void PCB_TOOL_BASE::doInteractiveItemPlacement( const std::string& aTool,
|
||||||
if( aOptions & IPO_SINGLE_CLICK )
|
if( aOptions & IPO_SINGLE_CLICK )
|
||||||
makeNewItem( controls()->GetCursorPosition() );
|
makeNewItem( controls()->GetCursorPosition() );
|
||||||
|
|
||||||
|
// Set initial cursor
|
||||||
|
if( !newItem )
|
||||||
|
frame()->GetCanvas()->SetCurrentCursor( KICURSOR::PENCIL );
|
||||||
|
else
|
||||||
|
frame()->GetCanvas()->SetCurrentCursor( KICURSOR::MOVING );
|
||||||
|
|
||||||
// Main loop: keep receiving events
|
// Main loop: keep receiving events
|
||||||
while( TOOL_EVENT* evt = Wait() )
|
while( TOOL_EVENT* evt = Wait() )
|
||||||
{
|
{
|
||||||
if( !newItem )
|
if( !newItem )
|
||||||
frame()->GetCanvas()->SetCurrentCursor( wxCURSOR_PENCIL );
|
frame()->GetCanvas()->SetCurrentCursor( KICURSOR::PENCIL );
|
||||||
else
|
else
|
||||||
frame()->GetCanvas()->SetCurrentCursor( wxCURSOR_ARROW );
|
frame()->GetCanvas()->SetCurrentCursor( KICURSOR::MOVING );
|
||||||
|
|
||||||
VECTOR2I cursorPos = controls()->GetCursorPosition();
|
VECTOR2I cursorPos = controls()->GetCursorPosition();
|
||||||
aPlacer->m_modifiers = evt->Modifier();
|
aPlacer->m_modifiers = evt->Modifier();
|
||||||
|
|
|
@ -222,7 +222,7 @@ int PCB_VIEWER_TOOLS::MeasureTool( const TOOL_EVENT& aEvent )
|
||||||
|
|
||||||
while( TOOL_EVENT* evt = Wait() )
|
while( TOOL_EVENT* evt = Wait() )
|
||||||
{
|
{
|
||||||
frame()->GetCanvas()->SetCurrentCursor( wxCURSOR_ARROW );
|
frame()->GetCanvas()->SetCurrentCursor( KICURSOR::MEASURE );
|
||||||
grid.SetSnap( !evt->Modifier( MD_SHIFT ) );
|
grid.SetSnap( !evt->Modifier( MD_SHIFT ) );
|
||||||
grid.SetUseGrid( !evt->Modifier( MD_ALT ) );
|
grid.SetUseGrid( !evt->Modifier( MD_ALT ) );
|
||||||
const VECTOR2I cursorPos = grid.BestSnapAnchor( controls.GetMousePosition(), nullptr );
|
const VECTOR2I cursorPos = grid.BestSnapAnchor( controls.GetMousePosition(), nullptr );
|
||||||
|
|
|
@ -1724,7 +1724,7 @@ void POINT_EDITOR::setEditedPoint( EDIT_POINT* aPoint )
|
||||||
|
|
||||||
if( aPoint )
|
if( aPoint )
|
||||||
{
|
{
|
||||||
frame()->GetCanvas()->SetCurrentCursor( wxCURSOR_ARROW );
|
frame()->GetCanvas()->SetCurrentCursor( KICURSOR::ARROW );
|
||||||
controls->ForceCursorPosition( true, aPoint->GetPosition() );
|
controls->ForceCursorPosition( true, aPoint->GetPosition() );
|
||||||
controls->ShowCursor( true );
|
controls->ShowCursor( true );
|
||||||
}
|
}
|
||||||
|
|
|
@ -208,9 +208,6 @@ int SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
|
||||||
// Main loop: keep receiving events
|
// Main loop: keep receiving events
|
||||||
while( TOOL_EVENT* evt = Wait() )
|
while( TOOL_EVENT* evt = Wait() )
|
||||||
{
|
{
|
||||||
if( m_frame->ToolStackIsEmpty() )
|
|
||||||
m_frame->GetCanvas()->SetCurrentCursor( wxCURSOR_ARROW );
|
|
||||||
|
|
||||||
bool dragAlwaysSelects = getEditFrame<PCB_BASE_FRAME>()->GetDragSelects();
|
bool dragAlwaysSelects = getEditFrame<PCB_BASE_FRAME>()->GetDragSelects();
|
||||||
TRACK_DRAG_ACTION dragAction = getEditFrame<PCB_BASE_FRAME>()->Settings().m_TrackDragAction;
|
TRACK_DRAG_ACTION dragAction = getEditFrame<PCB_BASE_FRAME>()->Settings().m_TrackDragAction;
|
||||||
m_additive = m_subtractive = m_exclusive_or = false;
|
m_additive = m_subtractive = m_exclusive_or = false;
|
||||||
|
@ -228,6 +225,8 @@ int SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
|
||||||
m_exclusive_or = true;
|
m_exclusive_or = true;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
bool modifier_enabled = m_subtractive || m_additive || m_exclusive_or;
|
||||||
|
|
||||||
// Is the user requesting that the selection list include all possible
|
// Is the user requesting that the selection list include all possible
|
||||||
// items without removing less likely selection candidates
|
// items without removing less likely selection candidates
|
||||||
m_skip_heuristics = !!evt->Modifier( MD_ALT );
|
m_skip_heuristics = !!evt->Modifier( MD_ALT );
|
||||||
|
@ -287,7 +286,7 @@ int SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
|
||||||
{
|
{
|
||||||
m_frame->FocusOnItem( nullptr );
|
m_frame->FocusOnItem( nullptr );
|
||||||
|
|
||||||
if( m_additive || m_subtractive || m_exclusive_or || dragAlwaysSelects )
|
if( modifier_enabled || dragAlwaysSelects )
|
||||||
{
|
{
|
||||||
selectMultiple();
|
selectMultiple();
|
||||||
}
|
}
|
||||||
|
@ -336,6 +335,26 @@ int SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
|
||||||
|
|
||||||
else
|
else
|
||||||
evt->SetPassEvent();
|
evt->SetPassEvent();
|
||||||
|
|
||||||
|
|
||||||
|
if( m_frame->ToolStackIsEmpty() )
|
||||||
|
{
|
||||||
|
//move cursor prediction
|
||||||
|
if( !modifier_enabled && !dragAlwaysSelects && !m_selection.Empty()
|
||||||
|
&& evt->HasPosition() && selectionContains( evt->Position() ) )
|
||||||
|
m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::MOVING );
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if( m_additive )
|
||||||
|
m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::ADD );
|
||||||
|
else if( m_subtractive )
|
||||||
|
m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::SUBTRACT );
|
||||||
|
else if( m_exclusive_or )
|
||||||
|
m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::XOR );
|
||||||
|
else
|
||||||
|
m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::ARROW );
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in New Issue