Commit 65c11662 authored by Maciej Suminski's avatar Maciej Suminski
Browse files

Added support for changing the cursor size.

parent 15f5c228
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -75,6 +75,9 @@ CAIRO_GAL::CAIRO_GAL( wxWindow* aParent, wxEvtHandler* aMouseListener,

    SetSize( aParent->GetSize() );
    screenSize = VECTOR2I( aParent->GetSize() );

    cursorPixels = NULL;
    cursorPixelsSaved = NULL;
    initCursor();

    // Grid color settings are different in Cairo and OpenGL
@@ -808,6 +811,13 @@ void CAIRO_GAL::ClearTarget( RENDER_TARGET aTarget )
}


void CAIRO_GAL::SetCursorSize( unsigned int aCursorSize )
{
    GAL::SetCursorSize( aCursorSize );
    initCursor();
}


void CAIRO_GAL::DrawCursor( const VECTOR2D& aCursorPosition )
{
    // Now we should only store the position of the mouse cursor
@@ -890,6 +900,12 @@ void CAIRO_GAL::skipMouseEvent( wxMouseEvent& aEvent )

void CAIRO_GAL::initCursor()
{
    if( cursorPixels )
        delete cursorPixels;

    if( cursorPixelsSaved )
        delete cursorPixelsSaved;

    cursorPixels      = new wxBitmap( cursorSize, cursorSize );
    cursorPixelsSaved = new wxBitmap( cursorSize, cursorSize );

+3 −0
Original line number Diff line number Diff line
@@ -229,6 +229,9 @@ public:
    // Cursor
    // -------

    /// @copydoc GAL::SetCursorSize()
    virtual void SetCursorSize( unsigned int aCursorSize );

    /// @copydoc GAL::DrawCursor()
    virtual void DrawCursor( const VECTOR2D& aCursorPosition );

+11 −1
Original line number Diff line number Diff line
@@ -783,12 +783,22 @@ public:
        cursorColor = aCursorColor;
    }

    /**
     * @brief Returns the cursor size.
     *
     * @return The current cursor size (in pixels).
     */
    inline unsigned int GetCursorSize() const
    {
        return cursorSize;
    }

    /**
     * @brief Set the cursor size.
     *
     * @param aCursorSize is the size of the cursor expressed in pixels.
     */
    inline void SetCursorSize( unsigned int aCursorSize )
    virtual inline void SetCursorSize( unsigned int aCursorSize )
    {
        cursorSize = aCursorSize;
    }
+15 −5
Original line number Diff line number Diff line
@@ -29,13 +29,16 @@

// Selection tool actions
TOOL_ACTION COMMON_ACTIONS::selectionActivate( "pcbnew.InteractiveSelection",
        AS_GLOBAL, 0, "", "", AF_ACTIVATE ); // No description, it is not supposed to be shown anywhere
        AS_GLOBAL, 0,
        "", "", AF_ACTIVATE ); // No description, it is not supposed to be shown anywhere

TOOL_ACTION COMMON_ACTIONS::selectionSingle( "pcbnew.InteractiveSelection.Single",
        AS_GLOBAL, 0, "", "" );    // No description, it is not supposed to be shown anywhere
        AS_GLOBAL, 0,
        "", "" );    // No description, it is not supposed to be shown anywhere

TOOL_ACTION COMMON_ACTIONS::selectionClear( "pcbnew.InteractiveSelection.Clear",
        AS_GLOBAL, 0, "", "" );    // No description, it is not supposed to be shown anywhere
        AS_GLOBAL, 0,
        "", "" );    // No description, it is not supposed to be shown anywhere


// Edit tool actions
@@ -287,6 +290,10 @@ TOOL_ACTION COMMON_ACTIONS::resetCoords( "pcbnew.Control.resetCoords",
        AS_GLOBAL, ' ',
        "", "" );

TOOL_ACTION COMMON_ACTIONS::switchCursor( "pcbnew.Control.switchCursor",
        AS_GLOBAL, 0,
        "", "" );

TOOL_ACTION COMMON_ACTIONS::switchUnits( "pcbnew.Control.switchUnits",
        AS_GLOBAL, MD_CTRL + int( 'U' ),
        "", "" );
@@ -304,7 +311,8 @@ TOOL_ACTION COMMON_ACTIONS::routerActivate( "pcbnew.InteractiveRouter",
        "Run push & shove router", "Run push & shove router", AF_ACTIVATE );

TOOL_ACTION COMMON_ACTIONS::pointEditorUpdate( "pcbnew.PointEditor.update",
        AS_GLOBAL, 0, "", "" );    // No description, it is not supposed to be shown anywhere
        AS_GLOBAL, 0,
        "", "" );    // No description, it is not supposed to be shown anywhere


// Placement tool
@@ -420,6 +428,9 @@ boost::optional<TOOL_EVENT> COMMON_ACTIONS::TranslateLegacyId( int aId )
    case ID_TB_OPTIONS_SHOW_HIGH_CONTRAST_MODE:
        return COMMON_ACTIONS::highContrastMode.MakeEvent();

    case ID_TB_OPTIONS_SELECT_CURSOR:
        return COMMON_ACTIONS::switchCursor.MakeEvent();

    case ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH:
    case ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH:
    case ID_PCB_DELETE_ITEM_BUTT:
@@ -427,7 +438,6 @@ boost::optional<TOOL_EVENT> COMMON_ACTIONS::TranslateLegacyId( int aId )
    case ID_PCB_SHOW_1_RATSNEST_BUTT:
    case ID_PCB_PLACE_OFFSET_COORD_BUTT:
    case ID_TB_OPTIONS_SHOW_MODULE_RATSNEST:
    case ID_TB_OPTIONS_SELECT_CURSOR:
    case ID_TB_OPTIONS_SHOW_EXTRA_VERTICAL_TOOLBAR_MICROWAVE:
    case ID_MENU_PCB_SHOW_HIDE_MUWAVE_TOOLBAR:
    case ID_MICROWAVE_V_TOOLBAR:
+1 −0
Original line number Diff line number Diff line
@@ -189,6 +189,7 @@ public:

    // Miscellaneous
    static TOOL_ACTION resetCoords;
    static TOOL_ACTION switchCursor;
    static TOOL_ACTION switchUnits;
    static TOOL_ACTION showHelp;
    static TOOL_ACTION toBeDone;
Loading