From cd81e546e4b481ececd5e09739c0dd300925fb77 Mon Sep 17 00:00:00 2001 From: dickelbeck Date: Fri, 14 Sep 2007 18:32:24 +0000 Subject: [PATCH] Using MenuText() in onrightclick.cpp --- change_log.txt | 1 + pcbnew/onrightclick.cpp | 37 +++++++------------------------------ todo.txt | 2 +- 3 files changed, 9 insertions(+), 31 deletions(-) diff --git a/change_log.txt b/change_log.txt index fba908fcc7..0f4b481923 100644 --- a/change_log.txt +++ b/change_log.txt @@ -10,6 +10,7 @@ email address. + pcbnew * controle.cpp, added Function AllAreModulesAndReturnSmallestIfSo() which is called from PcbGeneralLocateAndDisplay() + * onrightclick.cpp changed to calls to BOARD_ITEM::MenuText() 2007-Sep-13 UPDATE Dick Hollenbeck diff --git a/pcbnew/onrightclick.cpp b/pcbnew/onrightclick.cpp index 18ee3f5322..a3c1b4e26a 100644 --- a/pcbnew/onrightclick.cpp +++ b/pcbnew/onrightclick.cpp @@ -630,11 +630,9 @@ void CreatePopUpMenuForFootprints( MODULE* aModule, wxMenu* menu, bool full_menu */ { wxMenu* sub_menu_footprint; - wxString msg; int flags = aModule->m_Flags; - msg = _( "Footprint" ); - msg << wxT( " " ) << aModule->GetReference(); + wxString msg = aModule->MenuText(); sub_menu_footprint = new wxMenu; @@ -672,27 +670,12 @@ void CreatePopUpMenuForFpTexts( TEXTE_MODULE* FpText, wxMenu* menu ) */ { wxMenu* sub_menu_Fp_text; - wxString msg; int flags = FpText->m_Flags; - switch( FpText->m_Type ) - { - case TEXT_is_REFERENCE: - msg = _( "Footprint ref" ); - break; - - case TEXT_is_VALUE: - msg = _( "Footprint value" ); - break; - - default: - msg = _( "Footprint text" ); - break; - } - - msg << wxT( " " ) << FpText->m_Text; - + wxString msg = FpText->MenuText(); + sub_menu_Fp_text = new wxMenu; + ADD_MENUITEM_WITH_SUBMENU( menu, sub_menu_Fp_text, -1, msg, footprint_text_xpm ); if( !flags ) @@ -716,11 +699,9 @@ void CreatePopUpMenuForPads( D_PAD* Pad, wxMenu* menu ) /* Create pop menu for pads */ { wxMenu* sub_menu_Pad; - wxString msg; int flags = Pad->m_Flags; - msg = _( "Pad" ); - msg << wxT( " " ) << Pad->ReturnStringPadName(); + wxString msg = Pad->MenuText(); sub_menu_Pad = new wxMenu; ADD_MENUITEM_WITH_SUBMENU( menu, sub_menu_Pad, -1, msg, pad_xpm ); @@ -757,16 +738,12 @@ void CreatePopUpMenuForTexts( TEXTE_PCB* Text, wxMenu* menu ) /* Create pop menu for pcb texts */ { wxMenu* sub_menu_Text; - wxString msg; int flags = Text->m_Flags; - msg = _( "Pcb Text" ); msg << wxT( " " ); - if( Text->m_Text.Len() < 8 ) - msg << Text->m_Text; - else - msg += Text->m_Text.Left( 5 ) + wxT( ".." ); + wxString msg = Text->MenuText(); sub_menu_Text = new wxMenu; + ADD_MENUITEM_WITH_SUBMENU( menu, sub_menu_Text, -1, msg, add_text_xpm ); if( !flags ) diff --git a/todo.txt b/todo.txt index 92655e5fb1..7107c309c1 100644 --- a/todo.txt +++ b/todo.txt @@ -19,7 +19,7 @@ referenced. I think this would be an easier way to manage xpms. *** @todo: grep for @todo and finish off those tasks, scattered throughout the source. -*** use BOARD_ITEM::MenuText() and MenuIcon() in the onrightclick.cpp +*** use BOARD_ITEM::MenuIcon() in the onrightclick.cpp *** make the ADD_MENUITEM macros in include/macros.h be static inline functions instead