kicad-developers team mailing list archive
-
kicad-developers team
-
Mailing list archive
-
Message #06786
[PATCH] new hotkeys window + some menu entry mistakes corrected + CONTRIBUTE file added
Dear All,
this is my first patch, I hope it will be all right. This is what I have done.
1) the hotkey menu (the "List Current Hotkeys" one) has been replaced
by an html-based menu where text can be easily justified. To do that a
new Frame class was added. I believe this class could be reused for a
future help menu based in html.
2) hotkeys in the "Place" top menu are now properly displayed. They
are right justified and appear without the unnecessary "<>".
3) Few capital letters here and there in various menus were corrected.
4) A simple instruction file "CONTRIBUTE.txt" that explain what to do
if you want to contribute was added.
To achieve point 1 I had to add a new Frame class implementation and
its declaration. I wasn't really sure about where to place it so I
just placed it on top of file "common/confirm.cpp". Sorry if it is
not the right location but I do not know the source very well.
Regards
Fabrizio
=== added file 'CONTRIBUTE.txt'
--- CONTRIBUTE.txt 1970-01-01 00:00:00 +0000
+++ CONTRIBUTE.txt 2011-09-03 13:14:02 +0000
@@ -0,0 +1,44 @@
+Contribute to KiCad
+--------------------
+
+1) make sure you have all the dependencies of KiCad:
+ sudo apt-get install debhelper dpatch libx11-dev
+ sudo apt-get install libglu1-mesa-dev libgl1-mesa-dev mesa-common-dev
+ sudo apt-get install libwxbase2.8-dev libwxgtk2.8-dev libboost-dev fakeroot
+ sudo apt-get install cmake bzr
+
+2) initialize Bazaar:
+ bzr whoami "John Doe <john.doe@xxxxxxxxx>"
+
+3) get latest KiCad source tree and name it "kicad_john":
+ cd ~/
+ bzr branch lp:kicad kicad_john
+
+4) create a copy of this folder and zip it away (just in case).
+
+5) Modify/add source code.
+ cd kicad_john
+ gedit .......
+
+6) Compile:
+ cd kicad_john
+ mkdir build; cd build
+ cmake ../ -DKICAD_TESTING_VERSION=ON -DCMAKE_BUILD_TYPE=Debug
+ make -j 4 # this is for a 4 core machine
+
+7) Repeat step 5 and 6 until satisfied.
+
+8) Delete the "build" folder create a patch:
+ cd kicad_john
+ rm -R ./build
+ bzr add .
+ bzr status
+ bzr diff > gui_better_zoom.patch
+
+9) Send the patch file "gui_better_zoom.patch" to the KiCad development mailing list.
+ in the subject of the e-mail include the keyword "[PATCH]".
+ in the body of the e-mail clearly explain what you have done.
+
+
+for more info see INSTALL.txt.
+
=== modified file 'common/confirm.cpp'
--- common/confirm.cpp 2011-07-06 16:40:54 +0000
+++ common/confirm.cpp 2011-09-02 23:45:17 +0000
@@ -5,7 +5,27 @@
#include "fctsys.h"
#include "common.h"
-
+#include "wx/wx.h"
+#include "wx/html/htmlwin.h"
+
+// frame class for html message window
+class MyFrame : public wxFrame
+{
+public:
+ MyFrame(wxWindow* parent, const wxString& title, const wxPoint& pos, const wxSize& size, const wxString& text);
+};
+
+// frame constructor for html message window
+MyFrame::MyFrame(wxWindow* parent, const wxString& title, const wxPoint& pos, const wxSize& size, const wxString& text)
+ : wxFrame(parent, wxID_ANY, title, pos, size)
+{
+ Centre();
+ wxHtmlWindow *m_Html;
+ m_Html = new wxHtmlWindow(this);
+ m_Html -> SetRelatedFrame(this, _("HTML : %s"));
+ //m_Html -> LoadPage(wxT("test.html"));
+ m_Html -> SetPage(text);
+}
/* Display an error or warning message.
* TODO:
@@ -44,6 +64,15 @@
dialog->Destroy();
}
+/* Display a simple message window in html format.
+ */
+void DisplayHtmlInfoMessage( wxWindow* parent, const wxString& title, const wxString& text, const wxSize& size,
+ int displaytime )
+{
+ MyFrame *frame = new MyFrame(parent,title, wxDefaultPosition, size, text);
+ frame->Show(true);
+}
+
bool IsOK( wxWindow* parent, const wxString& text )
{
=== modified file 'common/hotkeys_basic.cpp'
--- common/hotkeys_basic.cpp 2011-08-29 21:42:11 +0000
+++ common/hotkeys_basic.cpp 2011-09-03 11:57:45 +0000
@@ -176,7 +176,7 @@
* aList = pointer to a Ki_HotkeyInfo list of commands
* aCommandId = Command Id value
* aIsShortCut = true to add <tab><keyname> (active shortcuts in menus)
- * = false to add <spaces><(keyname)>
+ * = false to add <spaces><keyname>
* Return a wxString (aTest + key name) if key found or aText without modification
*/
wxString AddHotkeyName( const wxString& aText, Ki_HotkeyInfo** aList,
@@ -193,7 +193,7 @@
if( aIsShortCut )
msg << wxT( "\t" ) << keyname;
else
- msg << wxT( " <" ) << keyname << wxT( ">" );
+ msg << wxT( "\t" ) << keyname;
}
return msg;
}
@@ -228,7 +228,7 @@
if( aIsShortCut )
msg << wxT( "\t" ) << keyname;
else
- msg << wxT( " <" ) << keyname << wxT( ">" );
+ msg << wxT( "\t" ) << keyname;
break;
}
}
@@ -333,7 +333,7 @@
wxString keyname;
Ki_HotkeyInfo** List;
- wxString msg = _( "Current hotkey list:\n\n" );
+ wxString msg = _( "<html><body><H3>Hotkeys List</H3> <table cellpadding=\"0\">" );
for( ; aDescList->m_HK_InfoList != NULL; aDescList++ )
{
@@ -341,13 +341,13 @@
for( ; *List != NULL; List++ )
{
Ki_HotkeyInfo* hk_decr = *List;
- msg += _( "key " );
keyname = ReturnKeyNameFromKeyCode( hk_decr->m_KeyCode );
- msg += keyname + wxT( ": " ) + hk_decr->m_InfoMsg + wxT( "\n" );
+ msg += wxT( "<tr><td>" ) + hk_decr->m_InfoMsg + wxT("</td><td><b> ") + keyname + wxT( "</b></td></tr>" );
}
}
- DisplayInfoMessage( aFrame, msg );
+ msg += wxT("</table></html></body>");
+ DisplayHtmlInfoMessage( aFrame, _("Hotkeys List"), msg, wxSize(400, 750));
}
=== modified file 'eeschema/hotkeys.cpp'
--- eeschema/hotkeys.cpp 2011-08-30 19:24:28 +0000
+++ eeschema/hotkeys.cpp 2011-09-03 12:52:07 +0000
@@ -87,8 +87,8 @@
static Ki_HotkeyInfo HkZoomOut( wxT( "Zoom Out" ), HK_ZOOM_OUT, GR_KB_CTRL + '-' );
#endif
-static Ki_HotkeyInfo HkHelp( wxT( "Help: this message" ), HK_HELP, '?' );
-static Ki_HotkeyInfo HkResetLocalCoord( wxT( "Reset local coord." ),
+static Ki_HotkeyInfo HkHelp( wxT( "Help (this window)" ), HK_HELP, '?' );
+static Ki_HotkeyInfo HkResetLocalCoord( wxT( "Reset Local Coordinates" ),
HK_RESET_LOCAL_COORD, ' ' );
/* Undo */
@@ -103,12 +103,12 @@
#endif
// Schematic editor
-static Ki_HotkeyInfo HkAddLabel( wxT( "add Label" ), HK_ADD_LABEL, 'L' );
-static Ki_HotkeyInfo HkAddHierarchicalLabel( wxT( "add Hierarchical Label" ), HK_ADD_HLABEL, 'H' );
-static Ki_HotkeyInfo HkAddGlobalLabel( wxT( "add Global Label" ), HK_ADD_GLABEL, GR_KB_CTRL + 'L' );
-static Ki_HotkeyInfo HkAddJunction( wxT( "add Junction" ), HK_ADD_JUNCTION, 'J' );
-static Ki_HotkeyInfo HkBeginWire( wxT( "begin Wire" ), HK_BEGIN_WIRE, 'W' );
-static Ki_HotkeyInfo HkBeginBus( wxT( "begin Bus" ), HK_BEGIN_BUS, 'B' );
+static Ki_HotkeyInfo HkAddLabel( wxT( "Add Label" ), HK_ADD_LABEL, 'L' );
+static Ki_HotkeyInfo HkAddHierarchicalLabel( wxT( "Add Hierarchical Label" ), HK_ADD_HLABEL, 'H' );
+static Ki_HotkeyInfo HkAddGlobalLabel( wxT( "Add Global Label" ), HK_ADD_GLABEL, GR_KB_CTRL + 'L' );
+static Ki_HotkeyInfo HkAddJunction( wxT( "Add Junction" ), HK_ADD_JUNCTION, 'J' );
+static Ki_HotkeyInfo HkBeginWire( wxT( "Begin Wire" ), HK_BEGIN_WIRE, 'W' );
+static Ki_HotkeyInfo HkBeginBus( wxT( "Begin Bus" ), HK_BEGIN_BUS, 'B' );
static Ki_HotkeyInfo HkAddComponent( wxT( "Add Component" ), HK_ADD_NEW_COMPONENT, 'A' );
static Ki_HotkeyInfo HkAddPower( wxT( "Add Power" ), HK_ADD_NEW_POWER, 'P' );
static Ki_HotkeyInfo HkAddNoConn( wxT( "Add NoConnected Flag" ), HK_ADD_NOCONN_FLAG, 'Q' );
@@ -139,14 +139,14 @@
static Ki_HotkeyInfo HkDrag( wxT( "Drag Schematic Item" ), HK_DRAG, 'G',
ID_POPUP_SCH_DRAG_CMP_REQUEST );
-static Ki_HotkeyInfo HkMove2Drag( wxT( "Switch move block to drag block" ),
+static Ki_HotkeyInfo HkMove2Drag( wxT( "Move Block -> Drag Block" ),
HK_MOVEBLOCK_TO_DRAGBLOCK, '\t' );
static Ki_HotkeyInfo HkInsert( wxT( "Repeat Last Item" ), HK_REPEAT_LAST, WXK_INSERT );
static Ki_HotkeyInfo HkDelete( wxT( "Delete Item" ), HK_DELETE, WXK_DELETE );
static Ki_HotkeyInfo HkFindItem( wxT( "Find Item" ), HK_FIND_ITEM, 'F' + GR_KB_CTRL );
static Ki_HotkeyInfo HkFindNextItem( wxT( "Find Next Item" ), HK_FIND_NEXT_ITEM, WXK_F5 );
-static Ki_HotkeyInfo HkFindNextDrcMarker( wxT( "Find next DRC marker" ), HK_FIND_NEXT_DRC_MARKER,
+static Ki_HotkeyInfo HkFindNextDrcMarker( wxT( "Find Next DRC marker" ), HK_FIND_NEXT_DRC_MARKER,
WXK_F5 + GR_KB_SHIFT );
// Special keys for library editor:
@@ -969,7 +969,7 @@
break;
case HK_LIBEDIT_CREATE_PIN:
- SetToolID( ID_LIBEDIT_PIN_BUTT, wxCURSOR_PENCIL, _( "Add pin" ) );
+ SetToolID( ID_LIBEDIT_PIN_BUTT, wxCURSOR_PENCIL, _( "Add Pin" ) );
OnLeftClick( aDC, aPosition );
break;
=== modified file 'eeschema/menubar.cpp'
--- eeschema/menubar.cpp 2011-08-30 13:54:22 +0000
+++ eeschema/menubar.cpp 2011-09-03 12:45:25 +0000
@@ -54,7 +54,7 @@
ADD_MENUITEM_WITH_HELP( fileMenu,
ID_LOAD_PROJECT,
_( "&Open\tCtrl+O" ),
- _( "Open an existing schematic project" ),
+ _( "Open existing schematic project" ),
open_document_xpm );
// Open Recent submenu
@@ -69,7 +69,7 @@
wxGetApp().m_fileHistory.AddFilesToMenu( openRecentMenu );
ADD_MENUITEM_WITH_HELP_AND_SUBMENU( fileMenu, openRecentMenu,
wxID_ANY, _( "Open &Recent" ),
- _( "Open a recent opened schematic project" ),
+ _( "Open recent opened schematic project" ),
open_project_xpm );
// Separator
@@ -201,7 +201,7 @@
ADD_MENUITEM_WITH_HELP( editMenu,
ID_BACKANNO_ITEMS,
_( "&Backannotate" ),
- _( "Back annotate the footprint fields" ),
+ _( "Back annotate footprint fields" ),
import_footprint_names_xpm );
@@ -262,15 +262,16 @@
// @todo unify IDs
wxMenu* placeMenu = new wxMenu;
+
// Component
text = AddHotkeyName( _( "Component" ), s_Schematic_Hokeys_Descr,
HK_ADD_NEW_COMPONENT, false ); // add comment, not a shortcut
ADD_MENUITEM_WITH_HELP( placeMenu, ID_SCH_PLACE_COMPONENT, text,
HELP_PLACE_COMPONENTS,
add_component_xpm );
-
+
// Power port
- text = AddHotkeyName( _( "Power port" ), s_Schematic_Hokeys_Descr,
+ text = AddHotkeyName( _( "Power Port" ), s_Schematic_Hokeys_Descr,
HK_ADD_NEW_POWER, false ); // add comment, not a shortcut
ADD_MENUITEM_WITH_HELP( placeMenu, ID_PLACE_POWER_BUTT, text,
HELP_PLACE_POWERPORT,
@@ -291,21 +292,21 @@
add_bus_xpm );
// Wire to Bus entry
- text = AddHotkeyName( _( "Wire to bus entry" ), s_Schematic_Hokeys_Descr,
+ text = AddHotkeyName( _( "Wire to Bus Entry" ), s_Schematic_Hokeys_Descr,
HK_ADD_WIRE_ENTRY, false ); // add comment, not a shortcut
ADD_MENUITEM_WITH_HELP( placeMenu, ID_WIRETOBUS_ENTRY_BUTT, text,
HELP_PLACE_WIRE2BUS_ENTRY,
add_line2bus_xpm );
// Bus to Bus entry
- text = AddHotkeyName( _( "Bus to bus entry" ), s_Schematic_Hokeys_Descr,
+ text = AddHotkeyName( _( "Bus to Bus Entry" ), s_Schematic_Hokeys_Descr,
HK_ADD_BUS_ENTRY, false ); // add comment, not a shortcut
ADD_MENUITEM_WITH_HELP( placeMenu, ID_BUSTOBUS_ENTRY_BUTT, text,
HELP_PLACE_BUS2BUS_ENTRY,
add_bus2bus_xpm );
// No connect flag
- text = AddHotkeyName( _( "No connect flag" ), s_Schematic_Hokeys_Descr,
+ text = AddHotkeyName( _( "No Connect Flag" ), s_Schematic_Hokeys_Descr,
HK_ADD_NOCONN_FLAG, false ); // add comment, not a shortcut
ADD_MENUITEM_WITH_HELP( placeMenu, ID_NOCONN_BUTT, text, HELP_PLACE_NC_FLAG,
noconn_xpm );
@@ -317,8 +318,8 @@
HELP_PLACE_NETLABEL,
add_line_label_xpm );
- // Global label
- text = AddHotkeyName( _( "Global label" ), s_Schematic_Hokeys_Descr,
+ // Global Label
+ text = AddHotkeyName( _( "Global Label" ), s_Schematic_Hokeys_Descr,
HK_ADD_GLABEL, false ); // add comment, not a shortcut
ADD_MENUITEM_WITH_HELP( placeMenu, ID_GLABEL_BUTT, text,
HELP_PLACE_GLOBALLABEL,
@@ -335,9 +336,7 @@
placeMenu->AppendSeparator();
// Hierarchical label
- text = AddHotkeyName( _( "Hierarchical label" ), s_Schematic_Hokeys_Descr,
- HK_ADD_HLABEL, false ); // add comment, not a shortcut
- text = AddHotkeyName( _( "Hierarchical label" ), s_Schematic_Hokeys_Descr,
+ text = AddHotkeyName( _( "Hierarchical Label" ), s_Schematic_Hokeys_Descr,
HK_ADD_HLABEL, false ); // add comment, not a shortcut
ADD_MENUITEM_WITH_HELP( placeMenu, ID_HIERLABEL_BUTT,
text, HELP_PLACE_HIER_LABEL,
@@ -345,7 +344,7 @@
// Hierarchical sheet
- text = AddHotkeyName( _( "Hierarchical sheet" ), s_Schematic_Hokeys_Descr,
+ text = AddHotkeyName( _( "Hierarchical Sheet" ), s_Schematic_Hokeys_Descr,
HK_ADD_HIER_SHEET, false ); // add comment, not a shortcut
ADD_MENUITEM_WITH_HELP( placeMenu, ID_SHEET_SYMBOL_BUTT, text,
HELP_PLACE_SHEET,
@@ -361,7 +360,7 @@
// Add hierarchical Pin to Sheet
ADD_MENUITEM_WITH_HELP( placeMenu,
ID_SHEET_PIN_BUTT,
- _( "Add Hierarchical Pin to Sheet" ),
+ _( "Hierarchical Pin to Sheet" ),
HELP_PLACE_SHEETPIN,
add_hierar_pin_xpm );
@@ -369,14 +368,14 @@
placeMenu->AppendSeparator();
// Graphic line or polygon
- text = AddHotkeyName( _( "Graphic polyline" ), s_Schematic_Hokeys_Descr,
+ text = AddHotkeyName( _( "Graphic Polyline" ), s_Schematic_Hokeys_Descr,
HK_ADD_GRAPHIC_POLYLINE, false ); // add comment, not a shortcut
ADD_MENUITEM_WITH_HELP( placeMenu, ID_LINE_COMMENT_BUTT, text,
HELP_PLACE_GRAPHICLINES,
add_dashed_line_xpm );
// Graphic text
- text = AddHotkeyName( _( "Graphic text" ), s_Schematic_Hokeys_Descr,
+ text = AddHotkeyName( _( "Graphic Text" ), s_Schematic_Hokeys_Descr,
HK_ADD_GRAPHIC_TEXT, false ); // add comment, not a shortcut
ADD_MENUITEM_WITH_HELP( placeMenu, ID_TEXT_COMMENT_BUTT, text,
HELP_PLACE_GRAPHICTEXTS,
@@ -425,14 +424,14 @@
// Save preferences
ADD_MENUITEM_WITH_HELP( preferencesMenu,
ID_CONFIG_SAVE,
- _( "&Save preferences" ),
+ _( "&Save Preferences" ),
_( "Save application preferences" ),
save_setup_xpm );
// Read preferences
ADD_MENUITEM_WITH_HELP( preferencesMenu,
ID_CONFIG_READ,
- _( "&Read preferences" ),
+ _( "&Read Preferences" ),
_( "Read application preferences" ),
read_setup_xpm );
@@ -491,13 +490,13 @@
//Run CVPcb
ADD_MENUITEM_WITH_HELP( toolsMenu,
ID_TO_CVPCB,
- _( "A&ssign component footprints" ),
+ _( "A&ssign Component Footprints" ),
_( "Run CVPcb" ),
cvpcb_xpm );
// Run PCBNew
ADD_MENUITEM_WITH_HELP( toolsMenu,
ID_TO_PCB,
- _( "&Layout printed circuit board" ),
+ _( "&Layout Printed Circuit Board" ),
_( "Run PCBNew" ),
pcbnew_xpm );
=== modified file 'gerbview/hotkeys.cpp'
--- gerbview/hotkeys.cpp 2011-03-14 21:19:13 +0000
+++ gerbview/hotkeys.cpp 2011-09-03 12:47:32 +0000
@@ -30,13 +30,13 @@
/* local variables */
/* Hotkey list: */
-static Ki_HotkeyInfo HkResetLocalCoord( wxT( "Reset local coord." ), HK_RESET_LOCAL_COORD, ' ' );
+static Ki_HotkeyInfo HkResetLocalCoord( wxT( "Reset Local Coordinates" ), HK_RESET_LOCAL_COORD, ' ' );
static Ki_HotkeyInfo HkZoomAuto( wxT( "Zoom Auto" ), HK_ZOOM_AUTO, WXK_HOME );
static Ki_HotkeyInfo HkZoomCenter( wxT( "Zoom Center" ), HK_ZOOM_CENTER, WXK_F4 );
static Ki_HotkeyInfo HkZoomRedraw( wxT( "Zoom Redraw" ), HK_ZOOM_REDRAW, WXK_F3 );
static Ki_HotkeyInfo HkZoomOut( wxT( "Zoom Out" ), HK_ZOOM_OUT, WXK_F2 );
static Ki_HotkeyInfo HkZoomIn( wxT( "Zoom In" ), HK_ZOOM_IN, WXK_F1 );
-static Ki_HotkeyInfo HkHelp( wxT( "Help: this message" ), HK_HELP, '?' );
+static Ki_HotkeyInfo HkHelp( wxT( "Help (this window)" ), HK_HELP, '?' );
static Ki_HotkeyInfo HkSwitchUnits( wxT( "Switch Units" ), HK_SWITCH_UNITS, 'U' );
static Ki_HotkeyInfo HkTrackDisplayMode( wxT(
"Track Display Mode" ),
=== modified file 'include/confirm.h'
--- include/confirm.h 2010-07-20 18:11:34 +0000
+++ include/confirm.h 2011-09-02 23:27:16 +0000
@@ -13,7 +13,8 @@
int displaytime = 0 );
void DisplayInfoMessage( wxWindow* parent, const wxString& msg,
int displaytime = 0 );
-
+void DisplayHtmlInfoMessage( wxWindow* parent, const wxString& title, const wxString& msg,const wxSize& size=wxDefaultSize,
+ int displaytime = 0 );
bool IsOK( wxWindow* parent, const wxString& msg );
#endif /* __INCLUDE__CONFIRM_H__ */
=== modified file 'pcbnew/hotkeys.cpp'
--- pcbnew/hotkeys.cpp 2011-08-30 09:42:42 +0000
+++ pcbnew/hotkeys.cpp 2011-09-03 12:47:42 +0000
@@ -82,7 +82,7 @@
static Ki_HotkeyInfo HkLock_Unlock_Footprint( wxT( "Lock/Unlock Footprint" ),
HK_LOCK_UNLOCK_FOOTPRINT, 'L' );
static Ki_HotkeyInfo HkDelete( wxT( "Delete Track or Footprint" ), HK_DELETE, WXK_DELETE );
-static Ki_HotkeyInfo HkResetLocalCoord( wxT( "Reset local coord." ),
+static Ki_HotkeyInfo HkResetLocalCoord( wxT( "Reset Local Coordinates" ),
HK_RESET_LOCAL_COORD, ' ' );
/* Fit on Screen */
@@ -115,7 +115,7 @@
static Ki_HotkeyInfo HkZoomOut( wxT( "Zoom Out" ), HK_ZOOM_OUT, GR_KB_CTRL + '-' );
#endif
-static Ki_HotkeyInfo HkHelp( wxT( "Help: this message" ), HK_HELP, '?' );
+static Ki_HotkeyInfo HkHelp( wxT( "Help (this window)" ), HK_HELP, '?' );
/* Undo */
Follow ups