Remove help from F1 key and move it to an action

Create a new action in pcbnew, gerbview and the footprint viewer/
editor to display the help documentation. Disconnect the wxID_HELP
event from the window so that it no longer conflicts with the zoom
action.

Fixes: lp:1822041
* https://bugs.launchpad.net/kicad/+bug/1822041
This commit is contained in:
Ian McInerney 2019-06-12 01:59:30 +01:00 committed by Wayne Stambaugh
parent 2aa8e444ee
commit 71f5f96e64
18 changed files with 53 additions and 12 deletions

View File

@ -100,7 +100,6 @@ BEGIN_EVENT_TABLE( GERBVIEW_FRAME, EDA_DRAW_FRAME )
EVT_MENU( ID_GERBVIEW_ERASE_CURR_LAYER, GERBVIEW_FRAME::Process_Special_Functions )
// Menu Help
EVT_MENU( wxID_HELP, EDA_DRAW_FRAME::GetKicadHelp )
EVT_MENU( wxID_INDEX, EDA_DRAW_FRAME::GetKicadHelp )
EVT_MENU( ID_HELP_GET_INVOLVED, EDA_DRAW_FRAME::GetKicadContribute )
EVT_MENU( wxID_ABOUT, EDA_DRAW_FRAME::GetKicadAbout )

View File

@ -93,6 +93,8 @@ enum gerbview_ids
ID_GERBVIEW_ZIP_FILE1,
ID_GERBVIEW_ZIP_FILEMAX = ID_GERBVIEW_ZIP_FILE + MAX_FILE_HISTORY_SIZE,
ID_GERBVIEW_SHOW_HELP,
ID_GERBER_END_LIST
};

View File

@ -353,7 +353,7 @@ void GERBVIEW_FRAME::ReCreateMenuBar()
// Help menu
wxMenu* helpMenu = new wxMenu;
AddMenuItem( helpMenu, wxID_HELP, _( "Gerbview &Manual" ),
AddMenuItem( helpMenu, ID_GERBVIEW_SHOW_HELP, _( "Gerbview &Manual" ),
_( "Open the GerbView Manual" ),
KiBitmap( online_help_xpm ) );

View File

@ -67,6 +67,9 @@ OPT<TOOL_EVENT> GERBVIEW_ACTIONS::TranslateLegacyId( int aId )
case ID_HIGHLIGHT_NET_ITEMS:
return GERBVIEW_ACTIONS::highlightNet.MakeEvent();
case ID_GERBVIEW_SHOW_HELP:
return GERBVIEW_ACTIONS::showHelp.MakeEvent();
case ID_HIGHLIGHT_APER_ATTRIBUTE_ITEMS:
return GERBVIEW_ACTIONS::highlightAttribute.MakeEvent();
break;

View File

@ -107,6 +107,7 @@ public:
static TOOL_ACTION resetCoords;
static TOOL_ACTION switchCursor;
static TOOL_ACTION switchUnits;
static TOOL_ACTION showHotkeyList;
static TOOL_ACTION showHelp;
static TOOL_ACTION toBeDone;

View File

@ -89,10 +89,14 @@ TOOL_ACTION GERBVIEW_ACTIONS::resetCoords( "gerbview.Control.resetCoords",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_RESET_LOCAL_COORD ),
"", "" );
TOOL_ACTION GERBVIEW_ACTIONS::showHelp( "gerbview.Control.showHelp",
TOOL_ACTION GERBVIEW_ACTIONS::showHotkeyList( "gerbview.Control.showHotkeyList",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_HELP ),
"", "" );
TOOL_ACTION GERBVIEW_ACTIONS::showHelp( "gerbview.Control.showHelp",
AS_GLOBAL, 0,
"", "" );
GERBVIEW_CONTROL::GERBVIEW_CONTROL() :
TOOL_INTERACTIVE( "gerbview.Control" ), m_frame( NULL )
{
@ -249,7 +253,7 @@ int GERBVIEW_CONTROL::SwitchUnits( const TOOL_EVENT& aEvent )
}
int GERBVIEW_CONTROL::ShowHelp( const TOOL_EVENT& aEvent )
int GERBVIEW_CONTROL::ShowHotkeyList( const TOOL_EVENT& aEvent )
{
DisplayHotkeyList( m_frame, m_frame->GetHotkeyConfig() );
@ -257,6 +261,16 @@ int GERBVIEW_CONTROL::ShowHelp( const TOOL_EVENT& aEvent )
}
int GERBVIEW_CONTROL::ShowHelp( const TOOL_EVENT& aEvent )
{
wxCommandEvent dummyEvent;
dummyEvent.SetId( wxID_HELP );
m_frame->GetKicadHelp( dummyEvent );
return 0;
}
void GERBVIEW_CONTROL::setTransitions()
{
Go( &GERBVIEW_CONTROL::HighlightControl, GERBVIEW_ACTIONS::highlightClear.MakeEvent() );
@ -276,4 +290,5 @@ void GERBVIEW_CONTROL::setTransitions()
Go( &GERBVIEW_CONTROL::ResetCoords, GERBVIEW_ACTIONS::resetCoords.MakeEvent() );
Go( &GERBVIEW_CONTROL::SwitchUnits, GERBVIEW_ACTIONS::switchUnits.MakeEvent() );
Go( &GERBVIEW_CONTROL::ShowHelp, GERBVIEW_ACTIONS::showHelp.MakeEvent() );
Go( &GERBVIEW_CONTROL::ShowHotkeyList, GERBVIEW_ACTIONS::showHotkeyList.MakeEvent() );
}

View File

@ -60,6 +60,7 @@ public:
int ResetCoords( const TOOL_EVENT& aEvent );
int SwitchUnits( const TOOL_EVENT& aEvent );
int ShowHelp( const TOOL_EVENT& aEvent );
int ShowHotkeyList( const TOOL_EVENT& aEvent );
///> Sets up handlers for various events.
void setTransitions() override;

View File

@ -167,7 +167,6 @@ BEGIN_EVENT_TABLE( FOOTPRINT_EDIT_FRAME, PCB_BASE_FRAME )
EVT_MENU( ID_PCB_USER_GRID_SETUP, FOOTPRINT_EDIT_FRAME::OnGridSettings )
// Menu Help
EVT_MENU( wxID_HELP, EDA_DRAW_FRAME::GetKicadHelp )
EVT_MENU( wxID_INDEX, EDA_DRAW_FRAME::GetKicadHelp )
EVT_MENU( ID_HELP_GET_INVOLVED, EDA_DRAW_FRAME::GetKicadContribute )
EVT_MENU( wxID_ABOUT, EDA_BASE_FRAME::GetKicadAbout )

View File

@ -82,7 +82,6 @@ BEGIN_EVENT_TABLE( FOOTPRINT_VIEWER_FRAME, EDA_DRAW_FRAME )
EVT_MENU( ID_SET_RELATIVE_OFFSET, FOOTPRINT_VIEWER_FRAME::OnSetRelativeOffset )
// Menu Help
EVT_MENU( wxID_HELP, EDA_DRAW_FRAME::GetKicadHelp )
EVT_MENU( wxID_INDEX, EDA_DRAW_FRAME::GetKicadHelp )
EVT_MENU( ID_HELP_GET_INVOLVED, EDA_DRAW_FRAME::GetKicadContribute )
EVT_MENU( wxID_ABOUT, EDA_BASE_FRAME::GetKicadAbout )

View File

@ -460,7 +460,7 @@ void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar()
wxMenu* helpMenu = new wxMenu;
// Contents
AddMenuItem( helpMenu, wxID_HELP,
AddMenuItem( helpMenu, ID_PCBNEW_SHOW_HELP,
_( "Pcbnew &Manual" ),
_( "Open the Pcbnew Manual" ),
KiBitmap( online_help_xpm ) );

View File

@ -419,7 +419,7 @@ void prepareToolsMenu( wxMenu* aParentMenu )
void prepareHelpMenu( wxMenu* aParentMenu )
{
AddMenuItem( aParentMenu, wxID_HELP,
AddMenuItem( aParentMenu, ID_PCBNEW_SHOW_HELP,
_( "Pcbnew &Manual" ),
_( "Open Pcbnew Manual" ),
KiBitmap( online_help_xpm ) );

View File

@ -164,7 +164,6 @@ BEGIN_EVENT_TABLE( PCB_EDIT_FRAME, PCB_BASE_FRAME )
EVT_MENU( ID_MENU_PCB_EDIT_TEXT_AND_GRAPHICS, PCB_EDIT_FRAME::OnEditTextAndGraphics )
// Menu Help
EVT_MENU( wxID_HELP, EDA_DRAW_FRAME::GetKicadHelp )
EVT_MENU( wxID_INDEX, EDA_DRAW_FRAME::GetKicadHelp )
EVT_MENU( ID_HELP_GET_INVOLVED, EDA_DRAW_FRAME::GetKicadContribute )
EVT_MENU( wxID_ABOUT, EDA_BASE_FRAME::GetKicadAbout )

View File

@ -402,6 +402,9 @@ enum pcbnew_ids
ID_EDIT_CUT,
ID_EDIT_COPY,
ID_EDIT_PASTE,
ID_PCBNEW_SHOW_HELP,
ID_PCBNEW_END_LIST
};

View File

@ -188,7 +188,7 @@ void FOOTPRINT_VIEWER_FRAME::ReCreateMenuBar()
wxMenu* helpMenu = new wxMenu;
// Contents
AddMenuItem( helpMenu, wxID_HELP,
AddMenuItem( helpMenu, ID_PCBNEW_SHOW_HELP,
_( "Pcbnew &Manual" ),
_( "Open the Pcbnew manual" ),
KiBitmap( online_help_xpm ) );

View File

@ -219,6 +219,9 @@ OPT<TOOL_EVENT> PCB_ACTIONS::TranslateLegacyId( int aId )
case ID_POPUP_PCB_AUTOPLACE_SELECTED_MODULES:
return PCB_ACTIONS::autoplaceSelectedComponents.MakeEvent();
case ID_PCBNEW_SHOW_HELP:
return PCB_ACTIONS::showHelp.MakeEvent();
}
return OPT<TOOL_EVENT>();

View File

@ -379,6 +379,7 @@ public:
static TOOL_ACTION drillOrigin;
static TOOL_ACTION crossProbeSchToPcb;
static TOOL_ACTION appendBoard;
static TOOL_ACTION showHotkeyList;
static TOOL_ACTION showHelp;
static TOOL_ACTION toBeDone;

View File

@ -195,10 +195,14 @@ TOOL_ACTION PCB_ACTIONS::deleteItemCursor( "pcbnew.Control.deleteItemCursor",
AS_GLOBAL, 0,
"", "" );
TOOL_ACTION PCB_ACTIONS::showHelp( "pcbnew.Control.showHelp",
TOOL_ACTION PCB_ACTIONS::showHotkeyList( "pcbnew.Control.showHotkeyList",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_HELP ),
"", "" );
TOOL_ACTION PCB_ACTIONS::showHelp( "pcbnew.Control.showHelp",
AS_GLOBAL, 0,
"", "" );
TOOL_ACTION PCB_ACTIONS::toBeDone( "pcbnew.Control.toBeDone",
AS_GLOBAL, 0, // dialog saying it is not implemented yet
"", "" ); // so users are aware of that
@ -980,7 +984,7 @@ int PCBNEW_CONTROL::AppendBoard( PLUGIN& pi, wxString& fileName )
}
int PCBNEW_CONTROL::ShowHelp( const TOOL_EVENT& aEvent )
int PCBNEW_CONTROL::ShowHotkeyList( const TOOL_EVENT& aEvent )
{
DisplayHotkeyList( m_frame, m_frame->GetHotkeyConfig() );
@ -988,6 +992,16 @@ int PCBNEW_CONTROL::ShowHelp( const TOOL_EVENT& aEvent )
}
int PCBNEW_CONTROL::ShowHelp( const TOOL_EVENT& aEvent )
{
wxCommandEvent dummyEvent;
dummyEvent.SetId( wxID_HELP );
m_frame->GetKicadHelp( dummyEvent );
return 0;
}
int PCBNEW_CONTROL::ToBeDone( const TOOL_EVENT& aEvent )
{
DisplayInfoMessage( m_frame, _( "Not available in OpenGL/Cairo canvases." ) );
@ -1038,6 +1052,7 @@ void PCBNEW_CONTROL::setTransitions()
Go( &PCBNEW_CONTROL::SwitchCursor, PCB_ACTIONS::switchCursor.MakeEvent() );
Go( &PCBNEW_CONTROL::SwitchUnits, PCB_ACTIONS::switchUnits.MakeEvent() );
Go( &PCBNEW_CONTROL::DeleteItemCursor, PCB_ACTIONS::deleteItemCursor.MakeEvent() );
Go( &PCBNEW_CONTROL::ShowHotkeyList, PCB_ACTIONS::showHotkeyList.MakeEvent() );
Go( &PCBNEW_CONTROL::ShowHelp, PCB_ACTIONS::showHelp.MakeEvent() );
Go( &PCBNEW_CONTROL::ToBeDone, PCB_ACTIONS::toBeDone.MakeEvent() );

View File

@ -92,6 +92,7 @@ public:
int PasteItemsFromClipboard( const TOOL_EVENT& aEvent );
int AppendBoardFromFile( const TOOL_EVENT& aEvent );
int AppendBoard( PLUGIN& pi, wxString& fileName );
int ShowHotkeyList( const TOOL_EVENT& aEvent );
int ShowHelp( const TOOL_EVENT& aEvent );
int ToBeDone( const TOOL_EVENT& aEvent );