Better management of the "Zoom to selection" tool in page layout editor.
- the useless "arrow tool" is removed. - the "Zoom to selection" tool enable or disable the Zoom to selection (this is a on/off tool) - When enabled, it can be disabled by the popup context menu, like in others applications.
This commit is contained in:
parent
526b5e2cd3
commit
eadfff8ac4
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2013 CERN
|
||||
* Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2017 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* @author Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
|
@ -97,13 +97,15 @@ BEGIN_EVENT_TABLE( PL_EDITOR_FRAME, EDA_DRAW_FRAME )
|
|||
EVT_CHOICE( ID_SELECT_COORDINATE_ORIGIN, PL_EDITOR_FRAME::OnSelectCoordOriginCorner)
|
||||
EVT_CHOICE( ID_SELECT_PAGE_NUMBER, PL_EDITOR_FRAME::Process_Special_Functions)
|
||||
|
||||
// Vertical toolbar:
|
||||
// the ID_NO_TOOL_SELECTED id TOOL does not existing currently, but the right click
|
||||
// popup menu can generate this event.
|
||||
EVT_TOOL( ID_NO_TOOL_SELECTED, PL_EDITOR_FRAME::Process_Special_Functions )
|
||||
|
||||
EVT_MENU_RANGE( ID_POPUP_START_RANGE, ID_POPUP_END_RANGE,
|
||||
PL_EDITOR_FRAME::Process_Special_Functions )
|
||||
|
||||
EVT_UPDATE_UI( ID_NO_TOOL_SELECTED, PL_EDITOR_FRAME::OnUpdateSelectTool )
|
||||
|
||||
EVT_UPDATE_UI( ID_ZOOM_SELECTION, PL_EDITOR_FRAME::OnUpdateSelectTool )
|
||||
EVT_UPDATE_UI( ID_SHOW_REAL_MODE, PL_EDITOR_FRAME::OnUpdateTitleBlockDisplayNormalMode )
|
||||
EVT_UPDATE_UI( ID_SHOW_PL_EDITOR_MODE, PL_EDITOR_FRAME::OnUpdateTitleBlockDisplaySpecialMode )
|
||||
|
@ -130,7 +132,11 @@ void PL_EDITOR_FRAME::Process_Special_Functions( wxCommandEvent& event )
|
|||
break;
|
||||
|
||||
case ID_ZOOM_SELECTION:
|
||||
// This tool is located on the main toolbar: switch it on or off on click
|
||||
if( GetToolId() != ID_ZOOM_SELECTION )
|
||||
SetToolID( ID_ZOOM_SELECTION, wxCURSOR_MAGNIFIER, _( "Zoom to selection" ) );
|
||||
else
|
||||
SetToolID( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor(), wxEmptyString );
|
||||
break;
|
||||
|
||||
case ID_SELECT_PAGE_NUMBER:
|
||||
|
@ -602,6 +608,5 @@ void PL_EDITOR_FRAME::OnUpdateTitleBlockDisplaySpecialMode( wxUpdateUIEvent& eve
|
|||
|
||||
void PL_EDITOR_FRAME::OnUpdateSelectTool( wxUpdateUIEvent& aEvent )
|
||||
{
|
||||
if( aEvent.GetEventObject() == m_mainToolBar )
|
||||
aEvent.Check( GetToolId() == aEvent.GetId() );
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2013 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
* Copyright (C) 2017 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
* Copyright (C) 2013 CERN
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
|
@ -64,6 +64,14 @@ bool PL_EDITOR_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* aPopMenu )
|
|||
bool busy = GetScreen()->GetCurItem() != NULL;
|
||||
wxString msg;
|
||||
|
||||
// If the tool ID_ZOOM_SELECTION is currently in use, add a
|
||||
if( GetToolId() == ID_ZOOM_SELECTION && !busy )
|
||||
{
|
||||
AddMenuItem( aPopMenu, ID_NO_TOOL_SELECTED, _( "End Tool" ),
|
||||
KiBitmap( cursor_xpm ) );
|
||||
aPopMenu->AppendSeparator();
|
||||
}
|
||||
|
||||
if( ! busy ) // No item currently edited
|
||||
{
|
||||
WORKSHEET_DATAITEM* old_item = m_treePagelayout->GetPageLayoutSelectedItem();
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2013 CERN
|
||||
* Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2017 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* @author Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
|
|
|
@ -92,10 +92,6 @@ void PL_EDITOR_FRAME::ReCreateHToolbar( void )
|
|||
m_mainToolBar->AddTool( ID_ZOOM_SELECTION, wxEmptyString, KiBitmap( zoom_area_xpm ),
|
||||
_( "Zoom to selection" ), wxITEM_CHECK );
|
||||
|
||||
m_mainToolBar->AddSeparator();
|
||||
m_mainToolBar->AddTool( ID_NO_TOOL_SELECTED, wxEmptyString, KiBitmap( cursor_xpm ),
|
||||
wxEmptyString, wxITEM_CHECK );
|
||||
|
||||
// Display mode switch
|
||||
m_mainToolBar->AddSeparator();
|
||||
m_mainToolBar->AddTool( ID_SHOW_REAL_MODE, wxEmptyString,
|
||||
|
|
Loading…
Reference in New Issue