← Back to team overview

kicad-developers team mailing list archive

code minor improvements -- patch

 

Remove useless HK_* defines.
Use HK_DELETE instead of HK_DELETE_PIN.

Replace tabs with spaces in code

Regards,
--
    Yury Khalyavin
=== modified file eeschema/hotkeys.cpp
--- eeschema/hotkeys.cpp	2010-07-20 11:58:23 +0000
+++ eeschema/hotkeys.cpp	2010-07-21 07:10:19 +0000
@@ -153,8 +153,6 @@
 static Ki_HotkeyInfo HkInsertPin( wxT( "Repeat Pin" ), HK_REPEAT_LAST,
                                   WXK_INSERT );
 static Ki_HotkeyInfo HkMovePin( wxT( "Move Pin" ), HK_LIBEDIT_MOVE_GRAPHIC_ITEM, 'M' );
-static Ki_HotkeyInfo HkDeletePin( wxT( "Delete Pin" ), HK_DELETE_PIN,
-                                  WXK_DELETE );
 
 
 // List of common hotkey descriptors
@@ -205,7 +203,7 @@
     &HkInsertPin,
     &HkEdit,
     &HkMovePin,
-    &HkDeletePin,
+    &HkDelete,
     &HkRotate,
     &HkDrag,
     NULL
@@ -865,7 +863,7 @@
             break;
         }
 
-    case HK_DELETE_PIN:
+    case HK_DELETE:
         m_drawItem = LocateItemUsingCursor();
 
         if( m_drawItem )

=== modified file eeschema/hotkeys.h
--- eeschema/hotkeys.h	2010-07-20 11:47:31 +0000
+++ eeschema/hotkeys.h	2010-07-21 07:10:19 +0000
@@ -15,16 +15,13 @@
     HK_FIND_ITEM,
     HK_DELETE,
     HK_REPEAT_LAST,
-	HK_EDIT_PIN,
-	HK_LIBEDIT_MOVE_GRAPHIC_ITEM,
-	HK_LIBEDIT_ROTATE_PIN,
-	HK_LIBEDIT_CREATE_PIN,
-    HK_DELETE_PIN,
+    HK_LIBEDIT_MOVE_GRAPHIC_ITEM,
+    HK_LIBEDIT_CREATE_PIN,
     HK_MOVEBLOCK_TO_DRAGBLOCK,
     HK_ROTATE,
-	HK_EDIT,
-	HK_EDIT_COMPONENT_VALUE,
-	HK_EDIT_COMPONENT_FOOTPRINT,
+    HK_EDIT,
+    HK_EDIT_COMPONENT_VALUE,
+    HK_EDIT_COMPONENT_FOOTPRINT,
     HK_MIRROR_X_COMPONENT,
     HK_MIRROR_Y_COMPONENT,
     HK_ORIENT_NORMAL_COMPONENT,
@@ -46,4 +43,4 @@
 // List of hotkey descriptors for the lib browser only
 extern struct Ki_HotkeyInfoSectionDescriptor s_Viewlib_Hokeys_Descr[];
 
-#endif		// KOTKEYS_H
+#endif      // KOTKEYS_H

=== modified file eeschema/libedit_onrightclick.cpp
--- eeschema/libedit_onrightclick.cpp	2010-07-20 11:58:23 +0000
+++ eeschema/libedit_onrightclick.cpp	2010-07-21 07:10:19 +0000
@@ -1,5 +1,5 @@
 /****************************/
-/*	EESchema - libedit_onrightclick.cpp	*/
+/*  EESchema - libedit_onrightclick.cpp */
 /****************************/
 
 /* , In library editor, create the pop menu when clicking on mouse right button
@@ -85,21 +85,21 @@
                                  HK_LIBEDIT_MOVE_GRAPHIC_ITEM );
             ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_MOVE_ITEM_REQUEST,
                           msg, move_arc_xpm );
-			msg = AddHotkeyName( _( "Drag Arc Size" ), s_Libedit_Hokeys_Descr,
-						HK_DRAG );
-			ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_MODIFY_ITEM,
+            msg = AddHotkeyName( _( "Drag Arc Size" ), s_Libedit_Hokeys_Descr,
+                                 HK_DRAG );
+            ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_MODIFY_ITEM,
                                   msg, move_arc_xpm );
         }
 
         msg = AddHotkeyName( _( "Edit Arc Options" ), s_Libedit_Hokeys_Descr,
-        						HK_EDIT );
+                             HK_EDIT );
         ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_BODY_EDIT_ITEM,
                       msg, options_arc_xpm );
 
         if( DrawEntry->m_Flags == 0 )
         {
             msg = AddHotkeyName( _( "Delete Arc " ), s_Libedit_Hokeys_Descr,
-                                 HK_DELETE_PIN );
+                                 HK_DELETE );
             ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_DELETE_ITEM,
                           msg, delete_arc_xpm );
         }
@@ -115,22 +115,22 @@
         }
 
         if( DrawEntry->m_Flags == 0 )
-		{
-			msg = AddHotkeyName( _( "Drag Circle Outline" ), s_Libedit_Hokeys_Descr,
-						HK_DRAG );
-			ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_MODIFY_ITEM,
-                                  msg, move_rectangle_xpm );
-		}
+        {
+            msg = AddHotkeyName( _( "Drag Circle Outline" ), s_Libedit_Hokeys_Descr,
+                                 HK_DRAG );
+            ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_MODIFY_ITEM,
+                          msg, move_rectangle_xpm );
+        }
 
         msg = AddHotkeyName( _( "Edit Circle Options" ), s_Libedit_Hokeys_Descr,
-                						HK_EDIT );
+                             HK_EDIT );
         ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_BODY_EDIT_ITEM,
                       msg, options_circle_xpm );
 
         if( DrawEntry->m_Flags == 0 )
         {
             msg = AddHotkeyName( _( "Delete Circle " ),
-                                 s_Libedit_Hokeys_Descr, HK_DELETE_PIN );
+                                 s_Libedit_Hokeys_Descr, HK_DELETE );
             ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_DELETE_ITEM,
                           msg, delete_circle_xpm );
         }
@@ -146,22 +146,22 @@
         }
 
         msg = AddHotkeyName( _( "Edit Rectangle Options" ), s_Libedit_Hokeys_Descr,
-                						HK_EDIT );
+                             HK_EDIT );
         ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_BODY_EDIT_ITEM,
                       msg, options_rectangle_xpm );
 
         if( DrawEntry->m_Flags == 0 )
-		{
-			msg = AddHotkeyName( _( "Drag Rectangle Edge" ), s_Libedit_Hokeys_Descr,
-						HK_DRAG );
-			ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_MODIFY_ITEM,
-                                  msg, move_rectangle_xpm );
-		}
+        {
+            msg = AddHotkeyName( _( "Drag Rectangle Edge" ), s_Libedit_Hokeys_Descr,
+                                 HK_DRAG );
+            ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_MODIFY_ITEM,
+                          msg, move_rectangle_xpm );
+        }
 
         if( DrawEntry->m_Flags == 0 )
         {
             msg = AddHotkeyName( _( "Delete Rectangle " ), s_Libedit_Hokeys_Descr,
-                                 HK_DELETE_PIN );
+                                 HK_DELETE );
             ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_DELETE_ITEM,
                           msg, delete_rectangle_xpm );
         }
@@ -178,19 +178,19 @@
         }
 
         msg = AddHotkeyName( _( "Edit Text " ), s_Libedit_Hokeys_Descr,
-								HK_EDIT );
+                             HK_EDIT );
         ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_BODY_EDIT_ITEM,
                       msg, edit_text_xpm );
 
         msg = AddHotkeyName( _( "Rotate Text " ), s_Libedit_Hokeys_Descr,
-								HK_ROTATE );
+                             HK_ROTATE );
         ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_ROTATE_GRAPHIC_TEXT,
                       msg, edit_text_xpm );
 
         if( DrawEntry->m_Flags == 0 )
         {
             msg = AddHotkeyName( _( "Delete Text " ), s_Libedit_Hokeys_Descr,
-                                 HK_DELETE_PIN );
+                                 HK_DELETE );
             ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_DELETE_ITEM,
                           msg, delete_text_xpm );
         }
@@ -203,9 +203,9 @@
                                  HK_LIBEDIT_MOVE_GRAPHIC_ITEM );
             ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_MOVE_ITEM_REQUEST,
                           msg, move_line_xpm );
-			msg = AddHotkeyName( _( "Drag Edge Point" ), s_Libedit_Hokeys_Descr,
-						HK_DRAG );
-			ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_MODIFY_ITEM,
+            msg = AddHotkeyName( _( "Drag Edge Point" ), s_Libedit_Hokeys_Descr,
+                                 HK_DRAG );
+            ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_MODIFY_ITEM,
                                   msg, move_line_xpm );
         }
 
@@ -216,14 +216,14 @@
         }
 
         msg = AddHotkeyName( _( "Edit Line Options" ), s_Libedit_Hokeys_Descr,
-                						HK_EDIT );
+                             HK_EDIT );
         ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_BODY_EDIT_ITEM,
                       msg, options_segment_xpm );
 
         if( DrawEntry->m_Flags == 0 )
         {
             msg = AddHotkeyName( _( "Delete Line " ), s_Libedit_Hokeys_Descr,
-                                 HK_DELETE_PIN );
+                                 HK_DELETE );
             ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_DELETE_ITEM,
                           msg, delete_segment_xpm );
         }
@@ -232,7 +232,7 @@
             if( ( (LIB_POLYLINE*) DrawEntry )->GetCornerCount() > 2 )
             {
                 msg = AddHotkeyName( _( "Delete Segment " ),
-                                     s_Libedit_Hokeys_Descr, HK_DELETE_PIN );
+                                     s_Libedit_Hokeys_Descr, HK_DELETE );
                 ADD_MENUITEM( PopMenu,
                               ID_POPUP_LIBEDIT_DELETE_CURRENT_POLY_SEGMENT,
                               msg, delete_segment_xpm );
@@ -300,7 +300,7 @@
     if( not_in_move )
     {
         msg = AddHotkeyName( _( "Delete Pin " ), s_Libedit_Hokeys_Descr,
-                             HK_DELETE_PIN );
+                             HK_DELETE );
         ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_DELETE_ITEM,
                       msg, delete_pin_xpm );
     }

=== modified file include/hotkeys_basic.h
--- include/hotkeys_basic.h	2010-02-16 11:02:20 +0000
+++ include/hotkeys_basic.h	2010-07-21 07:10:19 +0000
@@ -139,8 +139,8 @@
     HK_ZOOM_REDRAW,
     HK_ZOOM_CENTER,
     HK_ZOOM_AUTO,
-	HK_UNDO,
-	HK_REDO,
+    HK_UNDO,
+    HK_REDO,
     HK_COMMON_END
 };

Follow ups