kicad-developers team mailing list archive
-
kicad-developers team
-
Mailing list archive
-
Message #01557
pcbnew hotkeys.cpp improvment
In my opinion 'hot keys' should always work as expected or give some
kind of error if they do not.
I 'fixed' pcbnew/hotkeys.cpp to my liking but I would like to hear
other opinions. Maybe I went a little overboard?
The only problems that I can see is that wxBell does not sound on many
Linux distributions (including mine, Fedora 8) which is a common
problem mentioned on the web. It is suppose to work OK on Windows.
Do we have any other way of producing simple sounds?
The other problem is that the messages are displayed on status line
until another message overwrites them. It may take a while.
Any suggestions on how to clear them after a few seconds?
If acceptable, I can fix other hotkeys files in other programs.
Martin
--- tmp/hotkeys-HEAD.4.cpp 2008-05-19 21:52:26.000000000 -0700
+++ svn/kicad/pcbnew/hotkeys.cpp 2008-05-19 21:36:49.000000000 -0700
@@ -17 +17 @@
- * add a new id in the enum hotkey_id_commnand like MY_NEW_ID_FUNCTION.
+ * add a new id in the enum hotkey_id_command like MY_NEW_ID_FUNCTION.
@@ -25 +25 @@
- * when the variable PopupOn is true, an item is currently edited.
+ * When the variable ItemFree is false, an item is currently edited.
@@ -175,3 +175 @@
- bool PopupOn = (GetCurItem() && GetCurItem()->m_Flags);
-
- bool ItemFree = (GetCurItem()==0 || GetCurItem()->m_Flags==0);
+ bool ItemFree = (GetCurItem() == NULL || GetCurItem()->m_Flags == 0);
@@ -206 +203,0 @@
- return;
@@ -211,0 +209,3 @@
+ {
+ Affiche_Message( _( "Requested layer is out of range" ) );
+ wxBell();
@@ -212,0 +213 @@
+ }
@@ -224,0 +226,3 @@
+ {
+ Affiche_Message( _( "Requested layer is out of range" ) );
+ wxBell();
@@ -225,0 +230 @@
+ }
@@ -322,0 +328,6 @@
+ GetScreen()->SetModify();
+ }
+ else
+ {
+ Affiche_Message( _( "Cannot delete modules" ) );
+ wxBell();
@@ -324 +334,0 @@
- GetScreen()->SetModify();
@@ -334,0 +345,10 @@
+ else
+ {
+ Affiche_Message( _( "Nothing to delete" ) );
+ wxBell();
+ }
+ }
+ else
+ {
+ Affiche_Message( _( "Backspace key is only active during
track edit mode" ) );
+ wxBell();
@@ -344,0 +365,5 @@
+ else
+ {
+ Affiche_Message( _( "No new track in progress" ) );
+ wxBell();
+ }
@@ -353,0 +379,5 @@
+ else
+ {
+ Affiche_Message( _( "Not allowed now" ) );
+ wxBell();
+ }
@@ -362,0 +393,5 @@
+ else
+ {
+ Affiche_Message( _( "Not allowed now" ) );
+ wxBell();
+ }
@@ -372,0 +408,5 @@
+ else
+ {
+ Affiche_Message( _( "Not allowed now" ) );
+ wxBell();
+ }
@@ -382,0 +423,5 @@
+ else
+ {
+ Affiche_Message( _( "Not allowed now" ) );
+ wxBell();
+ }
@@ -385,10 +430,9 @@
- case HK_ADD_MICROVIA: // Place a micro via if a track is in
progress
- if( m_ID_current_state != ID_TRACK_BUTT )
- return;
- if( ItemFree ) // no track in progress: nothing to do
- break;
- if( GetCurItem()->Type() != TYPETRACK ) // Should not occur
- return;
- if( (GetCurItem()->m_Flags & IS_NEW) == 0 )
- return;
-
+ case HK_ADD_MICROVIA: // Place a micro via if a track is in
progress
+ if( m_ID_current_state != ID_TRACK_BUTT
+ || ItemFree // no track in
progress: nothing to do
+ || GetCurItem()->Type() != TYPETRACK // Should not occur
+ || (GetCurItem()->m_Flags & IS_NEW) == 0 )
+ {
+ Affiche_Message( _( "No new track in progress" ) );
+ wxBell();
+ }
@@ -396 +440 @@
- if ( GetScreen()->IsMicroViaAcceptable() )
+ else if ( GetScreen()->IsMicroViaAcceptable() )
@@ -404,0 +449,5 @@
+ else
+ {
+ Affiche_Message( _( "Microvia is not allowed" ) );
+ wxBell();
+ }
@@ -409 +458,5 @@
- return;
+ {
+ Affiche_Message( _( "No new track in progress" ) );
+ wxBell();
+ break;
+ }
@@ -416 +469,5 @@
- return;
+ {
+ Affiche_Message( _( "No new track in progress" ) );
+ wxBell();
+ break;
+ }
@@ -418 +475,5 @@
- return;
+ {
+ Affiche_Message( _( "No new track in progress" ) );
+ wxBell();
+ break;
+ }
@@ -436,0 +498,5 @@
+ else
+ {
+ Affiche_Message( _( "Not a module" ) );
+ wxBell();
+ }
@@ -441 +507 @@
- if( PopupOn )
+ if( ! ItemFree )
@@ -483,0 +550,3 @@
+ {
+ Affiche_Message( _( "Not a module" ) );
+ wxBell();
@@ -484,0 +554 @@
+ }
@@ -550 +619,0 @@
- return;
@@ -598,2 +667 @@
- bool ItemFree = (GetCurItem() == NULL )
- || (GetCurItem()->m_Flags == 0);
+ bool ItemFree = (GetCurItem() == NULL || GetCurItem()->m_Flags == 0);
@@ -604,0 +673,3 @@
+ {
+ Affiche_Message( _( "Active layer is out of range" ) );
+ wxBell();
@@ -605,0 +677 @@
+ }
@@ -609,0 +682,3 @@
+ {
+ Affiche_Message( _( "Cannot delete modules" ) );
+ wxBell();
@@ -610,0 +686 @@
+ }
@@ -628,0 +705,3 @@
+ {
+ Affiche_Message( _( "No module found" ) );
+ wxBell();
@@ -629,0 +709 @@
+ }
@@ -632,0 +713 @@
+ break;
@@ -634,3 +715 @@
- else
- return FALSE;
- break;
+ // else fall into default case
@@ -638,0 +718,2 @@
+ Affiche_Message( _( "Not allowed now" ) );
+ wxBell();
Follow ups