kicad-developers team mailing list archive
-
kicad-developers team
-
Mailing list archive
-
Message #26412
PATCH: add Help menu to open browser at kicad-pcb.org/contribute
This patch adds a "Get Involved" menu item to:
1. eeschema, libedit, browse module frames
2. pcbnew, footprint editor frames
3. gerbview frame
4. kicad frame
5. page layout frame
The menu uses the default web browser to open the page; if a browser
cannot be launched the fallback is to display a dialog box.
I have no skills with creating icons so the icon used is "info_xpm"
which is also used by the "About Kicad" menu entry. Perhaps someone
can come up with a good icon for "Get Involved" and "About Kicad" ?
- Cirilo
From c61b66f6026bcbeb4fc231bcc4ccf5a962bcd8f5 Mon Sep 17 00:00:00 2001
From: Cirilo Bernardo <cirilo.bernardo@xxxxxxxxx>
Date: Sat, 24 Sep 2016 10:44:52 +1000
Subject: [PATCH] Add Help Menu item to open browser at
kicad-pcb.org/contribute
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="------------2.9.3"
This is a multi-part message in MIME format.
--------------2.9.3
Content-Type: text/plain; charset=UTF-8; format=fixed
Content-Transfer-Encoding: 8bit
---
common/basicframe.cpp | 13 +++++++++++++
eeschema/libeditframe.cpp | 1 +
eeschema/menubar.cpp | 6 ++++++
eeschema/menubar_libedit.cpp | 6 ++++++
eeschema/schframe.cpp | 1 +
eeschema/tool_viewlib.cpp | 7 ++++++-
eeschema/viewlib_frame.cpp | 1 +
gerbview/events_called_functions.cpp | 1 +
gerbview/menubar.cpp | 8 ++++++++
include/id.h | 1 +
include/wxstruct.h | 2 ++
kicad/menubar.cpp | 9 +++++++++
pagelayout_editor/events_functions.cpp | 1 +
pagelayout_editor/menubar.cpp | 6 ++++++
pcbnew/menubar_modedit.cpp | 7 +++++++
pcbnew/menubar_pcbframe.cpp | 8 ++++++++
pcbnew/moduleframe.cpp | 1 +
pcbnew/pcbframe.cpp | 1 +
18 files changed, 79 insertions(+), 1 deletion(-)
--------------2.9.3
Content-Type: text/x-patch; name="0001-Add-Help-Menu-item-to-open-browser-at-kicad-pcb.org-.patch"
Content-Transfer-Encoding: 8bit
Content-Disposition: attachment; filename="0001-Add-Help-Menu-item-to-open-browser-at-kicad-pcb.org-.patch"
diff --git a/common/basicframe.cpp b/common/basicframe.cpp
index 3e772aa..53aea6a 100644
--- a/common/basicframe.cpp
+++ b/common/basicframe.cpp
@@ -40,11 +40,13 @@
#include <wxstruct.h>
#include <wx/display.h>
+#include <wx/utils.h>
/// The default auto save interval is 10 minutes.
#define DEFAULT_AUTO_SAVE_INTERVAL 600
+#define URL_GET_INVOLVED "http://kicad-pcb.org/contribute/"
const wxChar traceAutoSave[] = wxT( "KicadAutoSave" );
@@ -481,6 +483,17 @@ void EDA_BASE_FRAME::OnSelectPreferredEditor( wxCommandEvent& event )
}
+void EDA_BASE_FRAME::GetKicadContribute( wxCommandEvent& event )
+{
+ if( !wxLaunchDefaultBrowser( URL_GET_INVOLVED ) )
+ {
+ wxString msg = _( "Could not launch the default browser. For information on how to help the KiCad project, visit " );
+ msg.Append( URL_GET_INVOLVED );
+ wxMessageBox( msg, _( "Get involved with KiCad" ), wxOK, this );
+ }
+}
+
+
void EDA_BASE_FRAME::GetKicadAbout( wxCommandEvent& event )
{
bool ShowAboutDialog(wxWindow * parent);
diff --git a/eeschema/libeditframe.cpp b/eeschema/libeditframe.cpp
index e9256a6..777a8e5 100644
--- a/eeschema/libeditframe.cpp
+++ b/eeschema/libeditframe.cpp
@@ -127,6 +127,7 @@ BEGIN_EVENT_TABLE( LIB_EDIT_FRAME, EDA_DRAW_FRAME )
EVT_MENU( ID_LIBEDIT_GEN_SVG_FILE, LIB_EDIT_FRAME::OnPlotCurrentComponent )
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 )
EVT_MENU( wxID_PREFERENCES, LIB_EDIT_FRAME::OnPreferencesOptions )
diff --git a/eeschema/menubar.cpp b/eeschema/menubar.cpp
index 0a4f207..72a3241 100644
--- a/eeschema/menubar.cpp
+++ b/eeschema/menubar.cpp
@@ -524,6 +524,12 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
KiBitmap( hotkeys_xpm ) );
helpMenu->AppendSeparator();
+ AddMenuItem( helpMenu, ID_HELP_GET_INVOLVED,
+ _( "Get &Involved" ),
+ _( "Contribute to KiCad (opens a web browser)" ),
+ KiBitmap( info_xpm ) );
+
+ helpMenu->AppendSeparator();
AddMenuItem( helpMenu,
wxID_ABOUT,
_( "&About KiCad" ),
diff --git a/eeschema/menubar_libedit.cpp b/eeschema/menubar_libedit.cpp
index 3c9cc0a..b362292 100644
--- a/eeschema/menubar_libedit.cpp
+++ b/eeschema/menubar_libedit.cpp
@@ -266,6 +266,12 @@ void LIB_EDIT_FRAME::ReCreateMenuBar()
_( "Displays the current hotkeys list and corresponding commands" ),
KiBitmap( hotkeys_xpm ) );
+ helpMenu->AppendSeparator();
+ AddMenuItem( helpMenu, ID_HELP_GET_INVOLVED,
+ _( "Get &Involved" ),
+ _( "Contribute to KiCad (opens a web browser)" ),
+ KiBitmap( info_xpm ) );
+
// About Eeschema
helpMenu->AppendSeparator();
diff --git a/eeschema/schframe.cpp b/eeschema/schframe.cpp
index ad33525..38e715d 100644
--- a/eeschema/schframe.cpp
+++ b/eeschema/schframe.cpp
@@ -273,6 +273,7 @@ BEGIN_EVENT_TABLE( SCH_EDIT_FRAME, EDA_DRAW_FRAME )
EVT_TOOL( ID_AUTOPLACE_FIELDS, SCH_EDIT_FRAME::OnAutoplaceFields )
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 )
// Tools and buttons for vertical toolbar.
diff --git a/eeschema/tool_viewlib.cpp b/eeschema/tool_viewlib.cpp
index 2f7ca04..60353b5 100644
--- a/eeschema/tool_viewlib.cpp
+++ b/eeschema/tool_viewlib.cpp
@@ -253,7 +253,12 @@ void LIB_VIEW_FRAME::ReCreateMenuBar( void )
_( "Open the \"Getting Started in KiCad\" guide for beginners" ),
KiBitmap( help_xpm ) );
- // About Pcbnew
+ helpMenu->AppendSeparator();
+ AddMenuItem( helpMenu, ID_HELP_GET_INVOLVED,
+ _( "Get &Involved" ),
+ _( "Contribute to KiCad (opens a web browser)" ),
+ KiBitmap( info_xpm ) );
+
helpMenu->AppendSeparator();
AddMenuItem( helpMenu, wxID_ABOUT,
_( "&About Eeschema" ),
diff --git a/eeschema/viewlib_frame.cpp b/eeschema/viewlib_frame.cpp
index 36af402..c1d5dcb 100644
--- a/eeschema/viewlib_frame.cpp
+++ b/eeschema/viewlib_frame.cpp
@@ -71,6 +71,7 @@ BEGIN_EVENT_TABLE( LIB_VIEW_FRAME, EDA_DRAW_FRAME )
// Menu (and/or hotkey) events
EVT_MENU( wxID_HELP, EDA_DRAW_FRAME::GetKicadHelp )
EVT_MENU( wxID_EXIT, LIB_VIEW_FRAME::CloseLibraryViewer )
+ EVT_MENU( ID_HELP_GET_INVOLVED, EDA_DRAW_FRAME::GetKicadContribute )
EVT_MENU( ID_SET_RELATIVE_OFFSET, LIB_VIEW_FRAME::OnSetRelativeOffset )
END_EVENT_TABLE()
diff --git a/gerbview/events_called_functions.cpp b/gerbview/events_called_functions.cpp
index 5551126..8096fb6 100644
--- a/gerbview/events_called_functions.cpp
+++ b/gerbview/events_called_functions.cpp
@@ -87,6 +87,7 @@ BEGIN_EVENT_TABLE( GERBVIEW_FRAME, EDA_DRAW_FRAME )
// 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 )
EVT_TOOL( wxID_UNDO, GERBVIEW_FRAME::Process_Special_Functions )
diff --git a/gerbview/menubar.cpp b/gerbview/menubar.cpp
index 5e63ec0..18280c7 100644
--- a/gerbview/menubar.cpp
+++ b/gerbview/menubar.cpp
@@ -230,6 +230,14 @@ void GERBVIEW_FRAME::ReCreateMenuBar()
// Separator
helpMenu->AppendSeparator();
+ // Get involved with KiCad
+ AddMenuItem( helpMenu, ID_HELP_GET_INVOLVED,
+ _( "Get &Involved" ),
+ _( "Contribute to KiCad (opens a web browser)" ),
+ KiBitmap( info_xpm ) );
+
+ helpMenu->AppendSeparator();
+
// About Kicad
AddMenuItem( helpMenu,
wxID_ABOUT,
diff --git a/include/id.h b/include/id.h
index 66b9858..1b7dddd 100644
--- a/include/id.h
+++ b/include/id.h
@@ -260,6 +260,7 @@ enum main_id
ID_TB_OPTIONS_SELECT_CURSOR,
ID_TB_OPTIONS_SHOW_POLAR_COORD,
ID_TB_OPTIONS_SHOW_GRID,
+ ID_HELP_GET_INVOLVED,
// Common to Pcbnew and CvPcb
ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH,
diff --git a/include/wxstruct.h b/include/wxstruct.h
index a6eb79c..35a7225 100644
--- a/include/wxstruct.h
+++ b/include/wxstruct.h
@@ -217,6 +217,8 @@ public:
void GetKicadHelp( wxCommandEvent& event );
+ void GetKicadContribute( wxCommandEvent& event );
+
void GetKicadAbout( wxCommandEvent& event );
void PrintMsg( const wxString& text );
diff --git a/kicad/menubar.cpp b/kicad/menubar.cpp
index e7cd946..7c76160 100644
--- a/kicad/menubar.cpp
+++ b/kicad/menubar.cpp
@@ -64,6 +64,7 @@ BEGIN_EVENT_TABLE( KICAD_MANAGER_FRAME, EDA_BASE_FRAME )
EVT_MENU( ID_PROJECT_TREE_REFRESH, KICAD_MANAGER_FRAME::OnRefresh )
EVT_MENU( wxID_HELP, KICAD_MANAGER_FRAME::GetKicadHelp )
EVT_MENU( wxID_INDEX, KICAD_MANAGER_FRAME::GetKicadHelp )
+ EVT_MENU( ID_HELP_GET_INVOLVED, KICAD_MANAGER_FRAME::GetKicadContribute )
EVT_MENU( wxID_ABOUT, KICAD_MANAGER_FRAME::GetKicadAbout )
// Range menu events
@@ -422,6 +423,14 @@ void KICAD_MANAGER_FRAME::ReCreateMenuBar()
// Separator
helpMenu->AppendSeparator();
+ // Get involved with KiCad
+ AddMenuItem( helpMenu, ID_HELP_GET_INVOLVED,
+ _( "Get &Involved" ),
+ _( "Contribute to KiCad (opens a web browser)" ),
+ KiBitmap( info_xpm ) );
+
+ helpMenu->AppendSeparator();
+
// About
AddMenuItem( helpMenu, wxID_ABOUT,
_( "&About KiCad" ),
diff --git a/pagelayout_editor/events_functions.cpp b/pagelayout_editor/events_functions.cpp
index 674f95d..44a7df4 100644
--- a/pagelayout_editor/events_functions.cpp
+++ b/pagelayout_editor/events_functions.cpp
@@ -81,6 +81,7 @@ BEGIN_EVENT_TABLE( PL_EDITOR_FRAME, EDA_DRAW_FRAME )
// 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 )
EVT_TOOL( wxID_CUT, PL_EDITOR_FRAME::Process_Special_Functions )
diff --git a/pagelayout_editor/menubar.cpp b/pagelayout_editor/menubar.cpp
index ceadfee..8de9e1f 100644
--- a/pagelayout_editor/menubar.cpp
+++ b/pagelayout_editor/menubar.cpp
@@ -161,6 +161,12 @@ void PL_EDITOR_FRAME::ReCreateMenuBar()
_( "Displays the current hotkeys list and corresponding commands" ),
KiBitmap( hotkeys_xpm ) );
+ helpMenu->AppendSeparator();
+ AddMenuItem( helpMenu, ID_HELP_GET_INVOLVED,
+ _( "Get &Involved" ),
+ _( "Contribute to KiCad (opens a web browser)" ),
+ KiBitmap( info_xpm ) );
+
// Separator
helpMenu->AppendSeparator();
diff --git a/pcbnew/menubar_modedit.cpp b/pcbnew/menubar_modedit.cpp
index 53d202f..33da630 100644
--- a/pcbnew/menubar_modedit.cpp
+++ b/pcbnew/menubar_modedit.cpp
@@ -348,6 +348,13 @@ void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar()
_( "Displays the current hotkeys list and corresponding commands" ),
KiBitmap( hotkeys_xpm ) );
+ helpMenu->AppendSeparator();
+
+ AddMenuItem( helpMenu, ID_HELP_GET_INVOLVED,
+ _( "Get &Involved" ),
+ _( "Contribute to KiCad (opens a web browser)" ),
+ KiBitmap( info_xpm ) );
+
// About Pcbnew
helpMenu->AppendSeparator();
AddMenuItem( helpMenu, wxID_ABOUT,
diff --git a/pcbnew/menubar_pcbframe.cpp b/pcbnew/menubar_pcbframe.cpp
index a30154c..00c7d95 100644
--- a/pcbnew/menubar_pcbframe.cpp
+++ b/pcbnew/menubar_pcbframe.cpp
@@ -656,6 +656,14 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
KiBitmap( hotkeys_xpm ) );
helpMenu->AppendSeparator();
+
+ AddMenuItem( helpMenu, ID_HELP_GET_INVOLVED,
+ _( "Get &Involved" ),
+ _( "Contribute to KiCad (opens a web browser)" ),
+ KiBitmap( info_xpm ) );
+
+ helpMenu->AppendSeparator();
+
AddMenuItem( helpMenu, wxID_ABOUT,
_( "&About KiCad" ),
_( "Display the KiCad About dialog" ),
diff --git a/pcbnew/moduleframe.cpp b/pcbnew/moduleframe.cpp
index 5c4d6a0..8dfaf7b 100644
--- a/pcbnew/moduleframe.cpp
+++ b/pcbnew/moduleframe.cpp
@@ -163,6 +163,7 @@ BEGIN_EVENT_TABLE( FOOTPRINT_EDIT_FRAME, PCB_BASE_FRAME )
// 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 )
// Menu 3D Frame
diff --git a/pcbnew/pcbframe.cpp b/pcbnew/pcbframe.cpp
index 183f929..3c48906 100644
--- a/pcbnew/pcbframe.cpp
+++ b/pcbnew/pcbframe.cpp
@@ -179,6 +179,7 @@ BEGIN_EVENT_TABLE( PCB_EDIT_FRAME, PCB_BASE_FRAME )
// 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 )
// Menu 3D Frame
--------------2.9.3--
Follow ups