Commit 4a7dc4ad authored by Wayne Stambaugh's avatar Wayne Stambaugh

Add menu item function fixes and other minor improvements.

* Rename all ADD_MENUITEM_* functions to AddMenuItem and move them to
  wxstruct.h since they are used by the Kicad main frame classes.
* Move SET_BITMAP and SETBITMAPS definitions to wxstruct.h.
* Fix a bug in SET_BITMAPS that prevented enabling menu item images on
  OSX.
* Rename MsgItem to EDA_MSG_ITEM.
* Remove redundant includes from modified files.
* Doxygen and coding style policy fixes.
parent fd486a11
......@@ -3,8 +3,6 @@
/********************/
#include "fctsys.h"
#include "macros.h"
#include "bitmaps.h"
#include "3d_viewer.h"
......@@ -128,7 +126,7 @@ void EDA_3D_FRAME::ReCreateMenuBar()
// Does not work properly under linux
fileMenu->AppendSeparator();
fileMenu->Append( ID_TOOL_SCREENCOPY_TOCLIBBOARD,
_( "Copy 3D Image to Clipboard" ) );
_( "Copy 3D Image to Clipboard" ) );
#endif
fileMenu->AppendSeparator();
fileMenu->Append( wxID_EXIT, _( "&Exit" ) );
......@@ -136,31 +134,31 @@ void EDA_3D_FRAME::ReCreateMenuBar()
wxMenu* referencesMenu = new wxMenu;
menuBar->Append( referencesMenu, _( "&Preferences" ) );
ADD_MENUITEM( referencesMenu, ID_MENU3D_BGCOLOR_SELECTION,
_( "Choose background color" ), KiBitmap( palette_xpm ) );
AddMenuItem( referencesMenu, ID_MENU3D_BGCOLOR_SELECTION,
_( "Choose background color" ), KiBitmap( palette_xpm ) );
ADD_MENUITEM( referencesMenu, ID_MENU3D_AXIS_ONOFF,
_( "3D Axis On/Off" ), KiBitmap( axis3d_front_xpm ) );
AddMenuItem( referencesMenu, ID_MENU3D_AXIS_ONOFF,
_( "3D Axis On/Off" ), KiBitmap( axis3d_front_xpm ) );
if( full_options )
{
ADD_MENUITEM( referencesMenu, ID_MENU3D_MODULE_ONOFF,
_( "3D Footprints Shapes On/Off" ), KiBitmap( shape_3d_xpm ) );
AddMenuItem( referencesMenu, ID_MENU3D_MODULE_ONOFF,
_( "3D Footprints Shapes On/Off" ), KiBitmap( shape_3d_xpm ) );
ADD_MENUITEM( referencesMenu, ID_MENU3D_ZONE_ONOFF,
_( "Zone Filling On/Off" ), KiBitmap( add_zone_xpm ) );
AddMenuItem( referencesMenu, ID_MENU3D_ZONE_ONOFF,
_( "Zone Filling On/Off" ), KiBitmap( add_zone_xpm ) );
ADD_MENUITEM( referencesMenu, ID_MENU3D_COMMENTS_ONOFF,
_( "Comments Layer On/Off" ), KiBitmap( edit_sheet_xpm ) );
AddMenuItem( referencesMenu, ID_MENU3D_COMMENTS_ONOFF,
_( "Comments Layer On/Off" ), KiBitmap( edit_sheet_xpm ) );
ADD_MENUITEM( referencesMenu, ID_MENU3D_DRAWINGS_ONOFF,
_( "Drawings Layer On/Off" ), KiBitmap( add_polygon_xpm ) );
AddMenuItem( referencesMenu, ID_MENU3D_DRAWINGS_ONOFF,
_( "Drawings Layer On/Off" ), KiBitmap( add_polygon_xpm ) );
ADD_MENUITEM( referencesMenu, ID_MENU3D_ECO1_ONOFF,
_( "Eco1 Layer On/Off" ), KiBitmap( tools_xpm ) );
AddMenuItem( referencesMenu, ID_MENU3D_ECO1_ONOFF,
_( "Eco1 Layer On/Off" ), KiBitmap( tools_xpm ) );
ADD_MENUITEM( referencesMenu, ID_MENU3D_ECO2_ONOFF,
_( "Eco2 Layer On/Off" ), KiBitmap( tools_xpm ) );
AddMenuItem( referencesMenu, ID_MENU3D_ECO2_ONOFF,
_( "Eco2 Layer On/Off" ), KiBitmap( tools_xpm ) );
}
SetMenuBar( menuBar );
......
......@@ -12,14 +12,13 @@
#include "build_version.h"
#include "fctsys.h"
#include "appl_wxstruct.h"
#include "common.h"
#include "online_help.h"
#include "id.h"
#include "confirm.h"
#include "eda_doc.h"
#include "wxstruct.h"
#include "macros.h"
#include "bitmaps.h"
/*
* Class constructor for EDA_BASE_FRAME general options
......@@ -364,10 +363,10 @@ void EDA_BASE_FRAME::AddHelpVersionInfoMenuEntry( wxMenu* aMenu )
wxASSERT( aMenu != NULL );
// Copy version string to clipboard for bug report purposes.
ADD_MENUITEM_WITH_HELP( aMenu, ID_HELP_COPY_VERSION_STRING,
_( "Copy &Version Information" ),
_( "Copy the version string to clipboard to send with bug reports" ),
KiBitmap( copy_button_xpm ) );
AddMenuItem( aMenu, ID_HELP_COPY_VERSION_STRING,
_( "Copy &Version Information" ),
_( "Copy the version string to clipboard to send with bug reports" ),
KiBitmap( copy_button_xpm ) );
}
......
/***************/
/* edaappl.cpp */
/***************/
/***
* @file edaapl.cpp
*
......@@ -21,15 +17,14 @@
#include <wx/tokenzr.h>
#include "appl_wxstruct.h"
#include "common.h"
#include "wxstruct.h"
#include "macros.h"
#include "param_config.h"
#include "worksheet.h"
#include "id.h"
#include "build_version.h"
#include "hotkeys_basic.h"
#include "macros.h"
#include "online_help.h"
#include "bitmaps.h"
#include "gestfich.h"
......@@ -242,15 +237,12 @@ static struct LANGUAGE_DESCR s_Language_List[] =
};
/**
* WinEDA_App Constructor
*/
WinEDA_App::WinEDA_App()
{
m_Checker = NULL;
m_HtmlCtrl = NULL;
m_EDA_Config = NULL;
m_Env_Defined = FALSE;
m_Env_Defined = false;
m_LanguageId = wxLANGUAGE_DEFAULT;
m_PdfBrowserIsDefault = true;
m_Locale = NULL;
......@@ -259,9 +251,6 @@ WinEDA_App::WinEDA_App()
}
/**
* WinEDA_App Destructor
*/
WinEDA_App::~WinEDA_App()
{
SaveSettings();
......@@ -269,11 +258,15 @@ WinEDA_App::~WinEDA_App()
/* delete user datas */
if( m_ProjectConfig )
delete m_ProjectConfig;
if( m_EDA_CommonConfig )
delete m_EDA_CommonConfig;
delete m_EDA_Config;
if( m_Checker )
delete m_Checker;
delete m_Locale;
}
......@@ -848,11 +841,11 @@ void WinEDA_App::AddMenuLanguageList( wxMenu* MasterMenu )
menu->Append( item );
}
ADD_MENUITEM_WITH_HELP_AND_SUBMENU( MasterMenu, menu,
ID_LANGUAGE_CHOICE,
_( "Language" ),
_( "Select application language (only for testing!)" ),
KiBitmap( language_xpm ) );
AddMenuItem( MasterMenu, menu,
ID_LANGUAGE_CHOICE,
_( "Language" ),
_( "Select application language (only for testing!)" ),
KiBitmap( language_xpm ) );
// Set Check mark on current selected language
for( ii = 0; ii < LANGUAGE_DESCR_COUNT; ii++ )
......
......@@ -7,15 +7,13 @@
#include "fctsys.h"
#include "appl_wxstruct.h"
#include "common.h"
#include "hotkeys_basic.h"
#include "macros.h"
#include "bitmaps.h"
#include "id.h"
#include "confirm.h"
#include "kicad_string.h"
#include "gestfich.h"
#include "wxstruct.h"
#include "macros.h"
#include "dialog_hotkeys_editor.h"
#include <wx/apptrait.h>
......@@ -133,8 +131,10 @@ wxString ReturnKeyNameFromKeyCode( int aKeycode, bool* aIsFound )
if( (aKeycode & GR_KB_CTRL) != 0 )
modifier << MODIFIER_CTRL;
if( (aKeycode & GR_KB_ALT) != 0 )
modifier << MODIFIER_ALT;
if( (aKeycode & GR_KB_SHIFT) != 0 )
modifier << MODIFIER_SHIFT;
......@@ -143,7 +143,7 @@ wxString ReturnKeyNameFromKeyCode( int aKeycode, bool* aIsFound )
if( (aKeycode > ' ') && (aKeycode < 0x7F ) )
{
found = true;
keyname.Append((wxChar)aKeycode);
keyname.Append( (wxChar)aKeycode );
}
else
{
......@@ -165,6 +165,7 @@ wxString ReturnKeyNameFromKeyCode( int aKeycode, bool* aIsFound )
if( aIsFound )
*aIsFound = found;
fullkeyname = modifier + keyname;
return fullkeyname;
}
......@@ -195,6 +196,7 @@ wxString AddHotkeyName( const wxString& aText, Ki_HotkeyInfo** aList,
else
msg << wxT( " <" ) << keyname << wxT( ">" );
}
return msg;
}
......@@ -223,12 +225,14 @@ wxString AddHotkeyName( const wxString& aText,
{
List = aDescList->m_HK_InfoList;
keyname = ReturnKeyNameFromCommandId( List, aCommandId );
if( !keyname.IsEmpty() )
{
if( aIsShortCut )
msg << wxT( "\t" ) << keyname;
else
msg << wxT( " <" ) << keyname << wxT( ">" );
break;
}
}
......@@ -252,6 +256,7 @@ wxString ReturnKeyNameFromCommandId( Ki_HotkeyInfo** aList, int aCommandId )
for( ; *aList != NULL; aList++ )
{
Ki_HotkeyInfo* hk_decr = *aList;
if( hk_decr->m_Idcommand == aCommandId )
{
keyname = ReturnKeyNameFromKeyCode( hk_decr->m_KeyCode );
......@@ -285,7 +290,6 @@ int ReturnKeyCodeFromKeyName( const wxString& keyname )
modifier |= GR_KB_CTRL;
key.Remove( 0, 5 );
}
else if( key.StartsWith( MODIFIER_ALT ) )
{
modifier |= GR_KB_ALT;
......@@ -297,7 +301,9 @@ int ReturnKeyCodeFromKeyName( const wxString& keyname )
key.Remove( 0, 6 );
}
else
{
break;
}
}
if( (key.length() == 1) && (key[0] > ' ') && (key[0] < 0x7F) )
......@@ -338,6 +344,7 @@ void DisplayHotkeyList( EDA_DRAW_FRAME* aFrame,
for( ; aDescList->m_HK_InfoList != NULL; aDescList++ )
{
List = aDescList->m_HK_InfoList;
for( ; *List != NULL; List++ )
{
Ki_HotkeyInfo* hk_decr = *List;
......@@ -392,6 +399,7 @@ int EDA_BASE_FRAME::WriteHotkeyConfig( struct Ki_HotkeyInfoSectionDescriptor* aD
/* Print the current hotkey list */
Ki_HotkeyInfo** List;
for( ; aDescList->m_HK_InfoList != NULL; aDescList++ )
{
if( aDescList->m_Comment )
......@@ -400,10 +408,12 @@ int EDA_BASE_FRAME::WriteHotkeyConfig( struct Ki_HotkeyInfoSectionDescriptor* aD
msg += wxString( aDescList->m_Comment );
msg += wxT( "\n" );
}
msg += *aDescList->m_SectionTag;
msg += wxT( "\n" );
List = aDescList->m_HK_InfoList;
for( ; *List != NULL; List++ )
{
Ki_HotkeyInfo* hk_decr = *List;
......@@ -421,8 +431,11 @@ int EDA_BASE_FRAME::WriteHotkeyConfig( struct Ki_HotkeyInfoSectionDescriptor* aD
if( aFullFileName )
{
FILE* file = wxFopen( *aFullFileName, wxT( "wt" ) );
if( file )
{
fputs( TO_UTF8( msg ), file );
}
else
{
msg.Printf( wxT( "Unable to write file %s" ), GetChars( *aFullFileName ) );
......@@ -504,9 +517,8 @@ int EDA_BASE_FRAME::ReadHotkeyConfig( struct Ki_HotkeyInfoSectionDescriptor* aDe
* lines starting by # are ignored (comments)
* lines like [xxx] are tags (example: [common] or [libedit] which identify sections
*/
void ParseHotkeyConfig(
const wxString& data,
struct Ki_HotkeyInfoSectionDescriptor* aDescList )
void ParseHotkeyConfig( const wxString& data,
struct Ki_HotkeyInfoSectionDescriptor* aDescList )
{
/* Read the config */
wxStringTokenizer tokenizer( data, L"\r\n", wxTOKEN_STRTOK );
......@@ -525,6 +537,7 @@ void ParseHotkeyConfig(
{
CurrentHotkeyList = 0;
Ki_HotkeyInfoSectionDescriptor* DList = aDescList;
for( ; DList->m_HK_InfoList; DList++ )
{
if( *DList->m_SectionTag == line_type )
......@@ -536,10 +549,13 @@ void ParseHotkeyConfig(
continue;
}
if( line_type == wxT( "$Endlist" ) )
break;
if( line_type != wxT( "shortcut" ) )
continue;
if( CurrentHotkeyList == NULL )
continue;
......@@ -559,6 +575,7 @@ void ParseHotkeyConfig(
if( hk_decr->m_InfoMsg == fctname )
{
int code = ReturnKeyCodeFromKeyName( keyname );
if( code )
hk_decr->m_KeyCode = code;
......@@ -635,36 +652,35 @@ void AddHotkeyConfigMenu( wxMenu* aMenu )
wxMenu* HotkeySubmenu = new wxMenu();
/* List existing hotkey menu*/
ADD_MENUITEM_WITH_HELP( HotkeySubmenu,
ID_PREFERENCES_HOTKEY_SHOW_CURRENT_LIST,
_( "List Current Keys" ),
_( "Displays the current hotkeys list and corresponding commands" ),
KiBitmap( info_xpm ) );
AddMenuItem( HotkeySubmenu,
ID_PREFERENCES_HOTKEY_SHOW_CURRENT_LIST,
_( "List Current Keys" ),
_( "Displays the current hotkeys list and corresponding commands" ),
KiBitmap( info_xpm ) );
/* Call hotkeys editor*/
ADD_MENUITEM_WITH_HELP( HotkeySubmenu, ID_PREFERENCES_HOTKEY_SHOW_EDITOR,
_( "Edit Hotkeys" ),
_( "Call the hotkeys editor" ),
KiBitmap( editor_xpm ) );
AddMenuItem( HotkeySubmenu, ID_PREFERENCES_HOTKEY_SHOW_EDITOR,
_( "Edit Hotkeys" ),
_( "Call the hotkeys editor" ),
KiBitmap( editor_xpm ) );
HotkeySubmenu->AppendSeparator();
/* create hotkey file to export current hotkeys config */
ADD_MENUITEM_WITH_HELP( HotkeySubmenu, ID_PREFERENCES_HOTKEY_EXPORT_CONFIG,
_( "Export Hotkeys Config" ),
_( "Create a hotkey configuration file to export the current hotkey config" ),
KiBitmap( save_setup_xpm ) );
AddMenuItem( HotkeySubmenu, ID_PREFERENCES_HOTKEY_EXPORT_CONFIG,
_( "Export Hotkeys Config" ),
_( "Create a hotkey configuration file to export the current hotkey config" ),
KiBitmap( save_setup_xpm ) );
/* Reload hotkey file */
ADD_MENUITEM_WITH_HELP( HotkeySubmenu, ID_PREFERENCES_HOTKEY_IMPORT_CONFIG,
_( "Import Hotkeys Config" ),
_( "Load an existing hotkey configuration file" ),
KiBitmap( reload_xpm ) );
AddMenuItem( HotkeySubmenu, ID_PREFERENCES_HOTKEY_IMPORT_CONFIG,
_( "Import Hotkeys Config" ),
_( "Load an existing hotkey configuration file" ),
KiBitmap( reload_xpm ) );
/* Append HotkeySubmenu to menu */
ADD_MENUITEM_WITH_HELP_AND_SUBMENU( aMenu, HotkeySubmenu,
ID_PREFERENCES_HOTKEY_SUBMENU, _( "Hotkeys" ),
_( "Hotkeys configuration and preferences" ),
KiBitmap( hotkeys_xpm ) );
AddMenuItem( aMenu, HotkeySubmenu,
ID_PREFERENCES_HOTKEY_SUBMENU, _( "Hotkeys" ),
_( "Hotkeys configuration and preferences" ),
KiBitmap( hotkeys_xpm ) );
}
......@@ -97,7 +97,7 @@ void EDA_MSG_PANEL::AppendMessage( const wxString& textUpper,
text = ( textUpper.Len() > textLower.Len() ) ? textUpper : textLower;
text.Append( ' ', pad );
MsgItem item;
EDA_MSG_ITEM item;
/* Don't put the first message a window client position 0. Offset by
* one 'W' character width. */
......@@ -133,7 +133,7 @@ void EDA_MSG_PANEL::SetMessage( int aXPosition, const wxString& aUpperText,
else
pos.x = m_last_x;
MsgItem item;
EDA_MSG_ITEM item;
item.m_X = pos.x;
......@@ -174,7 +174,7 @@ void EDA_MSG_PANEL::SetMessage( int aXPosition, const wxString& aUpperText,
}
void EDA_MSG_PANEL::showItem( wxDC& dc, const MsgItem& aItem )
void EDA_MSG_PANEL::showItem( wxDC& dc, const EDA_MSG_ITEM& aItem )
{
int color = aItem.m_Color;
......@@ -205,6 +205,7 @@ void EDA_MSG_PANEL::EraseMsgBox()
Refresh();
}
void EDA_MSG_PANEL::erase( wxDC* DC )
{
wxPen pen;
......
......@@ -7,9 +7,7 @@
*/
#include "fctsys.h"
#include "common.h"
#include "macros.h"
#include "bitmaps.h"
#include "id.h"
#include "class_drawpanel.h"
#include "class_base_screen.h"
......@@ -154,21 +152,21 @@ void EDA_DRAW_FRAME::AddMenuZoomAndGrid( wxMenu* MasterMenu )
BASE_SCREEN * screen = DrawPanel->GetScreen();
msg = AddHotkeyName( _( "Center" ), m_HotkeysZoomAndGridList, HK_ZOOM_CENTER );
ADD_MENUITEM( MasterMenu, ID_POPUP_ZOOM_CENTER, msg, KiBitmap( zoom_center_on_screen_xpm ) );
AddMenuItem( MasterMenu, ID_POPUP_ZOOM_CENTER, msg, KiBitmap( zoom_center_on_screen_xpm ) );
msg = AddHotkeyName( _( "Zoom in" ), m_HotkeysZoomAndGridList, HK_ZOOM_IN );
ADD_MENUITEM( MasterMenu, ID_POPUP_ZOOM_IN, msg, KiBitmap( zoom_in_xpm ) );
AddMenuItem( MasterMenu, ID_POPUP_ZOOM_IN, msg, KiBitmap( zoom_in_xpm ) );
msg = AddHotkeyName( _( "Zoom out" ), m_HotkeysZoomAndGridList, HK_ZOOM_OUT );
ADD_MENUITEM( MasterMenu, ID_POPUP_ZOOM_OUT, msg, KiBitmap( zoom_out_xpm ) );
AddMenuItem( MasterMenu, ID_POPUP_ZOOM_OUT, msg, KiBitmap( zoom_out_xpm ) );
msg = AddHotkeyName( _( "Redraw view" ), m_HotkeysZoomAndGridList, HK_ZOOM_REDRAW );
ADD_MENUITEM( MasterMenu, ID_ZOOM_REDRAW, msg, KiBitmap( zoom_redraw_xpm ) );
AddMenuItem( MasterMenu, ID_ZOOM_REDRAW, msg, KiBitmap( zoom_redraw_xpm ) );
msg = AddHotkeyName( _( "Zoom auto" ), m_HotkeysZoomAndGridList, HK_ZOOM_AUTO );
ADD_MENUITEM( MasterMenu, ID_ZOOM_PAGE, msg, KiBitmap( zoom_fit_in_page_xpm ) );
AddMenuItem( MasterMenu, ID_ZOOM_PAGE, msg, KiBitmap( zoom_fit_in_page_xpm ) );
wxMenu* zoom_choice = new wxMenu;
ADD_MENUITEM_WITH_SUBMENU( MasterMenu, zoom_choice,
ID_POPUP_ZOOM_SELECT, _( "Zoom select" ),
KiBitmap( zoom_selection_xpm ) );
AddMenuItem( MasterMenu, zoom_choice,
ID_POPUP_ZOOM_SELECT, _( "Zoom select" ),
KiBitmap( zoom_selection_xpm ) );
zoom = screen->GetZoom();
maxZoomIds = ID_POPUP_ZOOM_LEVEL_END - ID_POPUP_ZOOM_LEVEL_START;
......@@ -190,8 +188,8 @@ void EDA_DRAW_FRAME::AddMenuZoomAndGrid( wxMenu* MasterMenu )
if( screen->GetGridCount() )
{
wxMenu* gridMenu = new wxMenu;
ADD_MENUITEM_WITH_SUBMENU( MasterMenu, gridMenu, ID_POPUP_GRID_SELECT,
_( "Grid Select" ), KiBitmap( grid_select_xpm ) );
AddMenuItem( MasterMenu, gridMenu, ID_POPUP_GRID_SELECT,
_( "Grid Select" ), KiBitmap( grid_select_xpm ) );
GRID_TYPE tmp;
wxRealPoint grid = screen->GetGridSize();
......@@ -234,5 +232,5 @@ void EDA_DRAW_FRAME::AddMenuZoomAndGrid( wxMenu* MasterMenu )
}
MasterMenu->AppendSeparator();
ADD_MENUITEM( MasterMenu, ID_POPUP_CANCEL, _( "Close" ), KiBitmap( cancel_xpm ) );
AddMenuItem( MasterMenu, ID_POPUP_CANCEL, _( "Close" ), KiBitmap( cancel_xpm ) );
}
......@@ -4,7 +4,6 @@
*/
#include "fctsys.h"
#include "appl_wxstruct.h"
#include "common.h"
#include "confirm.h"
#include "gestfich.h"
......@@ -12,7 +11,6 @@
#include "cvpcb_mainframe.h"
#include "cvpcb_id.h"
#include "bitmaps.h"
/**
* @brief (Re)Create the menubar for the cvpcb mainframe
......@@ -39,11 +37,11 @@ void CVPCB_MAINFRAME::ReCreateMenuBar()
wxMenu* filesMenu = new wxMenu;
// Open
ADD_MENUITEM_WITH_HELP( filesMenu,
ID_LOAD_PROJECT,
_( "&Open" ),
_( "Open a net list file" ),
open_document_xpm );
AddMenuItem( filesMenu,
ID_LOAD_PROJECT,
_( "&Open" ),
_( "Open a net list file" ),
open_document_xpm );
// Open Recent submenu
static wxMenu* openRecentMenu;
......@@ -56,51 +54,51 @@ void CVPCB_MAINFRAME::ReCreateMenuBar()
openRecentMenu = new wxMenu();
wxGetApp().m_fileHistory.UseMenu( openRecentMenu );
wxGetApp().m_fileHistory.AddFilesToMenu();
ADD_MENUITEM_WITH_HELP_AND_SUBMENU( filesMenu, openRecentMenu, -1,
_( "Open &Recent" ),
_( "Open a recent opened netlist document" ),
open_project_xpm );
AddMenuItem( filesMenu, openRecentMenu, -1,
_( "Open &Recent" ),
_( "Open a recent opened netlist document" ),
open_project_xpm );
// Separator
filesMenu->AppendSeparator();
// Save
ADD_MENUITEM_WITH_HELP( filesMenu,
wxID_SAVE,
_( "&Save\tCtrl+S" ),
_( "Save net list and footprint list files" ),
save_xpm );
AddMenuItem( filesMenu,
wxID_SAVE,
_( "&Save\tCtrl+S" ),
_( "Save net list and footprint list files" ),
save_xpm );
// Save as
ADD_MENUITEM_WITH_HELP( filesMenu,
wxID_SAVEAS,
_( "Save &As..." ),
_( "Save new net list and footprint list files" ),
save_xpm );
AddMenuItem( filesMenu,
wxID_SAVEAS,
_( "Save &As..." ),
_( "Save new net list and footprint list files" ),
save_xpm );
// Separator
filesMenu->AppendSeparator();
// Quit
ADD_MENUITEM_WITH_HELP( filesMenu,
wxID_EXIT,
_( "&Quit" ),
_( "Quit CvPcb" ),
exit_xpm );
AddMenuItem( filesMenu,
wxID_EXIT,
_( "&Quit" ),
_( "Quit CvPcb" ),
exit_xpm );
// Menu Preferences:
wxMenu* preferencesMenu = new wxMenu;
// Options (Preferences on WXMAC)
ADD_MENUITEM_WITH_HELP( preferencesMenu,
wxID_PREFERENCES,
AddMenuItem( preferencesMenu,
wxID_PREFERENCES,
#ifdef __WXMAC__
_( "&Preferences..." ),
_( "&Preferences..." ),
#else
_( "&Options" ),
_( "&Options" ),
#endif // __WXMAC__
_( "Set libraries and library search paths" ),
config_xpm );
_( "Set libraries and library search paths" ),
config_xpm );
// Language submenu
wxGetApp().AddMenuLanguageList( preferencesMenu );
......@@ -115,14 +113,14 @@ void CVPCB_MAINFRAME::ReCreateMenuBar()
// Separator
preferencesMenu->AppendSeparator();
ADD_MENUITEM_WITH_HELP( preferencesMenu, ID_SAVE_PROJECT,
_( "&Save Project File" ),
_( "Save changes to the project configuration file" ),
save_setup_xpm );
ADD_MENUITEM_WITH_HELP( preferencesMenu, ID_SAVE_PROJECT_AS,
_( "&Save Project File As" ),
_( "Save changes to the project configuration to a new file" ),
save_setup_xpm );
AddMenuItem( preferencesMenu, ID_SAVE_PROJECT,
_( "&Save Project File" ),
_( "Save changes to the project configuration file" ),
save_setup_xpm );
AddMenuItem( preferencesMenu, ID_SAVE_PROJECT_AS,
_( "&Save Project File As" ),
_( "Save changes to the project configuration to a new file" ),
save_setup_xpm );
// Menu Help:
wxMenu* helpMenu = new wxMenu;
......@@ -131,15 +129,15 @@ void CVPCB_MAINFRAME::ReCreateMenuBar()
AddHelpVersionInfoMenuEntry( helpMenu );
// Contents
ADD_MENUITEM_WITH_HELP( helpMenu, wxID_HELP, _( "&Contents" ),
_( "Open the CvPcb handbook" ),
online_help_xpm );
AddMenuItem( helpMenu, wxID_HELP, _( "&Contents" ),
_( "Open the CvPcb handbook" ),
online_help_xpm );
// About
ADD_MENUITEM_WITH_HELP( helpMenu, wxID_ABOUT,
_( "&About CvPcb" ),
_( "About CvPcb schematic to pcb converter" ),
info_xpm );
AddMenuItem( helpMenu, wxID_ABOUT,
_( "&About CvPcb" ),
_( "About CvPcb schematic to pcb converter" ),
info_xpm );
// Create the menubar and append all submenus
menuBar->Append( filesMenu, _( "&File" ) );
......
......@@ -4,7 +4,6 @@
#include "fctsys.h"
#include "gr_basic.h"
#include "common.h"
#include "class_drawpanel.h"
#include "eda_dde.h"
#include "wxEeschemaStruct.h"
......@@ -144,7 +143,7 @@ SCH_ITEM* SCH_EDIT_FRAME::LocateItem( const wxPoint& aPosition, const KICAD_T aF
{
wxString text = m_collectedItems[i]->GetSelectMenuText();
BITMAP_DEF xpm = m_collectedItems[i]->GetMenuImage();
ADD_MENUITEM( &selectMenu, ID_SELECT_ITEM_START + i, text, xpm );
AddMenuItem( &selectMenu, ID_SELECT_ITEM_START + i, text, xpm );
}
// Set to NULL in case user aborts the clarification context menu.
......
This diff is collapsed.
......@@ -6,12 +6,9 @@
#include "fctsys.h"
#include "appl_wxstruct.h"
#include "common.h"
#include "macros.h"
#include "class_drawpanel.h"
#include "confirm.h"
#include "eda_doc.h"
#include "bitmaps.h"
#include "gr_basic.h"
#include "class_sch_screen.h"
#include "wxEeschemaStruct.h"
......@@ -745,11 +742,14 @@ void LIB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_LIBEDIT_FIELD_EDIT_ITEM:
if( m_drawItem == NULL )
break;
DrawPanel->CrossHairOff( &dc );
if( m_drawItem->Type() == LIB_FIELD_T )
{
EditField( &dc, (LIB_FIELD*) m_drawItem );
}
DrawPanel->MoveCursorToCrossHair();
DrawPanel->CrossHairOn( &dc );
break;
......@@ -759,6 +759,7 @@ void LIB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_LIBEDIT_PIN_GLOBAL_CHANGE_PINNUMSIZE_ITEM:
if( ( m_drawItem == NULL ) || ( m_drawItem->Type() != LIB_PIN_T ) )
break;
SaveCopyInUndoList( m_component );
GlobalSetPins( &dc, (LIB_PIN*) m_drawItem, id );
DrawPanel->MoveCursorToCrossHair();
......@@ -1130,7 +1131,7 @@ LIB_ITEM* LIB_EDIT_FRAME::locateItem( const wxPoint& aPosition, const KICAD_T aF
{
wxString text = m_collectedItems[i]->GetSelectMenuText();
BITMAP_DEF xpm = m_collectedItems[i]->GetMenuImage();
ADD_MENUITEM( &selectMenu, ID_SELECT_ITEM_START + i, text, xpm );
AddMenuItem( &selectMenu, ID_SELECT_ITEM_START + i, text, xpm );
}
// Set to NULL in case user aborts the clarification context menu.
......
......@@ -318,7 +318,7 @@ private:
*
* @param aLibEntry A pointer to the LIB_ALIAS object to load.
* @param aLibrary A pointer to the CMP_LIBRARY object to load \a aLibEntry from.
* @returns True if a copy of \a aLibEntry was successfully loaded from \aLibrary.
* @return True if a copy of \a aLibEntry was successfully loaded from \a aLibrary.
*/
bool LoadOneLibraryPartAux( LIB_ALIAS* aLibEntry, CMP_LIBRARY* aLibrary );
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -151,7 +151,7 @@ public:
* checks for \a aName in the the template field name list.
*
* @param aName A wxString object containing the field name to search for.
* @param True if \a aName is found in the list.
* @return True if \a aName is found in the list.
*/
bool HasFieldName( const wxString& aName ) const;
};
......
......@@ -19,6 +19,8 @@ class GERBVIEW_FRAME;
//class BOARD;
class GERBER_IMAGE;
class Ki_PageDescr;
// Type of photoplotter action:
#define GERB_ACTIVE_DRAW 1 // Activate light (lower pen)
......
This diff is collapsed.
......@@ -3,10 +3,8 @@
/********************/
#include "fctsys.h"
#include "common.h"
#include "class_drawpanel.h"
#include "confirm.h"
#include "bitmaps.h"
#include "gerbview.h"
......@@ -34,11 +32,11 @@ bool GERBVIEW_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu )
if( GetToolId() != ID_NO_TOOL_SELECTED )
{
if( DrawStruct && DrawStruct->m_Flags )
ADD_MENUITEM( PopMenu, ID_POPUP_CANCEL_CURRENT_COMMAND,
_( "Cancel" ), cancel_xpm );
AddMenuItem( PopMenu, ID_POPUP_CANCEL_CURRENT_COMMAND,
_( "Cancel" ), cancel_xpm );
else
ADD_MENUITEM( PopMenu, ID_POPUP_CLOSE_CURRENT_TOOL,
_( "End Tool" ), cancel_tool_xpm );
AddMenuItem( PopMenu, ID_POPUP_CLOSE_CURRENT_TOOL,
_( "End Tool" ), cancel_tool_xpm );
PopMenu->AppendSeparator();
}
......@@ -48,17 +46,20 @@ bool GERBVIEW_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu )
{
if( BlockActive )
{
ADD_MENUITEM( PopMenu, ID_POPUP_CANCEL_CURRENT_COMMAND,
_( "Cancel Block" ), cancel_xpm );
AddMenuItem( PopMenu, ID_POPUP_CANCEL_CURRENT_COMMAND,
_( "Cancel Block" ), cancel_xpm );
PopMenu->AppendSeparator();
ADD_MENUITEM( PopMenu, ID_POPUP_PLACE_BLOCK,
_( "Place Block" ), apply_xpm );
ADD_MENUITEM( PopMenu, ID_POPUP_DELETE_BLOCK,
_( "Delete Block (ctrl + drag mouse)" ), delete_xpm );
AddMenuItem( PopMenu, ID_POPUP_PLACE_BLOCK,
_( "Place Block" ), apply_xpm );
AddMenuItem( PopMenu, ID_POPUP_DELETE_BLOCK,
_( "Delete Block (ctrl + drag mouse)" ), delete_xpm );
}
else
ADD_MENUITEM( PopMenu, ID_POPUP_CANCEL_CURRENT_COMMAND,
_( "Cancel" ), cancel_xpm );
{
AddMenuItem( PopMenu, ID_POPUP_CANCEL_CURRENT_COMMAND,
_( "Cancel" ), cancel_xpm );
}
PopMenu->AppendSeparator();
}
}
......
......@@ -224,7 +224,7 @@ public: WinEDA_App();
/**
* Function GetHelpFile
* get the help file path.
* <p?
* <p>
* Return the Kicad help file with path. The base paths defined in
* m_searchPaths are tested for a valid file. The path returned can
* be relative depending on the paths added to m_searchPaths. See the
......@@ -233,8 +233,8 @@ public: WinEDA_App();
* version of the help file is made.
* wxEmptyString is returned if help file not found.
* Help file is searched in directories in this order:
* help/<canonical name> like help/en_GB
* help/<short name> like help/en
* help/\<canonical name\> like help/en_GB
* help/\<short name\> like help/en
* help/en
* </p>
*/
......
......@@ -11,6 +11,9 @@
#define DEFAULT_HOTKEY_FILENAME_EXT wxT( "key" )
class EDA_DRAW_FRAME;
/* Class to handle hotkey commnands. hotkeys have a default value
* This class allows the real key code changed by user(from a key code list file)
*/
......
/**************************************/
/* Useful macros and inline functions */
/**************************************/
/**
* @file macros.h
* @brief This file contains miscellaneous helper definitions and functions.
*/
#ifndef MACROS_H
#define MACROS_H
#include <wx/wx.h>
#include "bitmaps.h"
/**
* Macro TO_UTF8
* converts a wxString to a UTF8 encoded C string for all wxWidgets build modes.
......@@ -26,8 +24,10 @@
static inline wxString FROM_UTF8( const char* cstring )
{
wxString line = wxString::FromUTF8( cstring );
if( line.IsEmpty() ) // happens when cstring is not a valid UTF8 sequence
line = wxConvCurrent->cMB2WC( cstring ); // try to use locale conversion
return line;
}
......@@ -78,33 +78,39 @@ static inline const wxChar* GetChars( const wxString& s )
#define RAD2DEG( Rad ) ( (Rad) * 180.0 / M_PI )
// Normalize angle to be in the -360.0 .. 360.0:
#define NORMALIZE_ANGLE_360( Angle ) { while( Angle < -3600 ) \
Angle += 3600;\
while( Angle > 3600 ) \
Angle -= 3600;}
#define NORMALIZE_ANGLE_360( Angle ) { \
while( Angle < -3600 ) \
Angle += 3600; \
while( Angle > 3600 ) \
Angle -= 3600; }
/* Normalize angle to be in the 0.0 .. 360.0 range: */
#define NORMALIZE_ANGLE_POS( Angle ) { while( Angle < 0 ) \
Angle += 3600;\
while( Angle >= 3600 ) \
Angle -= 3600;}
#define NEGATE_AND_NORMALIZE_ANGLE_POS( Angle ) \
{ Angle = -Angle; while( Angle < 0 ) \
Angle += 3600;while( Angle >= 3600 ) \
Angle -= 3600;}
#define NORMALIZE_ANGLE_POS( Angle ) { \
while( Angle < 0 ) \
Angle += 3600; \
while( Angle >= 3600 ) \
Angle -= 3600; }
#define NEGATE_AND_NORMALIZE_ANGLE_POS( Angle ) { \
Angle = -Angle; \
while( Angle < 0 ) \
Angle += 3600; \
while( Angle >= 3600 ) \
Angle -= 3600; }
/* Normalize angle to be in the -90.0 .. 90.0 range */
#define NORMALIZE_ANGLE_90( Angle ) { while( Angle < -900 ) \
Angle += 1800;\
while( Angle > 900 ) \
Angle -= 1800;}
#define NORMALIZE_ANGLE_90( Angle ) { \
while( Angle < -900 ) \
Angle += 1800; \
while( Angle > 900 ) \
Angle -= 1800; }
/* Normalize angle to be in the -180.0 .. 180.0 range */
#define NORMALIZE_ANGLE_180( Angle ) { while( Angle <= -1800 ) \
Angle += 3600;\
while( Angle > 1800 ) \
Angle -= 3600;}
#define NORMALIZE_ANGLE_180( Angle ) { \
while( Angle <= -1800 ) \
Angle += 3600; \
while( Angle > 1800 ) \
Angle -= 3600; }
/*****************************/
/* macro to exchange 2 items */
......@@ -140,92 +146,4 @@ BOOST_TYPEOF_REGISTER_TYPE( BOARD_ITEM* )
(b) = __temp__; }
/*****************************************************/
/* inline functions to insert menuitems with a icon: */
/*****************************************************/
static inline void ADD_MENUITEM( wxMenu* menu,
int id,
const wxString& text,
const wxBitmap& icon )
{
wxMenuItem* l_item;
l_item = new wxMenuItem( menu, id, text );
#if defined( USE_IMAGES_IN_MENUS )
l_item->SetBitmap( icon );
#endif
menu->Append( l_item );
}
static inline void ADD_MENUITEM_WITH_HELP( wxMenu* menu,
int id,
const wxString& text,
const wxString& help,
const wxBitmap& icon )
{
wxMenuItem* l_item;
l_item = new wxMenuItem( menu, id, text, help );
#if defined( USE_IMAGES_IN_MENUS )
l_item->SetBitmap( icon );
#endif
menu->Append( l_item );
}
static inline void ADD_MENUITEM_WITH_SUBMENU( wxMenu* menu,
wxMenu* submenu,
int id,
const wxString& text,
const wxBitmap& icon )
{
wxMenuItem* l_item;
l_item = new wxMenuItem( menu, id, text );
l_item->SetSubMenu( submenu );
#if defined( USE_IMAGES_IN_MENUS )
l_item->SetBitmap( icon );
#endif
menu->Append( l_item );
};
static inline void ADD_MENUITEM_WITH_HELP_AND_SUBMENU( wxMenu* menu,
wxMenu* submenu,
int id,
const wxString& text,
const wxString& help,
const wxBitmap& icon )
{
wxMenuItem* l_item;
l_item = new wxMenuItem( menu, id, text, help );
l_item->SetSubMenu( submenu );
#if defined( USE_IMAGES_IN_MENUS )
l_item->SetBitmap( icon );
#endif
menu->Append( l_item );
};
// macro to add a bitmap list to check menus (do not use with normal menus)
#if defined( USE_IMAGES_IN_MENUS ) && defined( __WINDOWS__ )
# define SETBITMAPS( icon ) item->SetBitmaps( KiBitmap( apply_xpm ), KiBitmap( icon ) )
#else
# define SETBITMAPS( icon )
#endif
// macro to add a bitmap menus (do not use with check menus)
#if !defined( USE_IMAGES_IN_MENUS ) || defined( __WXMAC__ )
# define SET_BITMAP( icon )
#else
# define SET_BITMAP( icon ) item->SetBitmap( (icon) )
#endif
#endif /* ifdef MACRO_H */
This diff is collapsed.
......@@ -4,10 +4,8 @@
*/
#include "fctsys.h"
#include "appl_wxstruct.h"
#include "common.h"
#include "kicad.h"
#include "macros.h"
#include "bitmaps.h"
/* Menubar and toolbar event table */
BEGIN_EVENT_TABLE( KICAD_MANAGER_FRAME, EDA_BASE_FRAME )
......@@ -74,6 +72,7 @@ void KICAD_MANAGER_FRAME::ReCreateMenuBar()
// Delete all existing menus so they can be rebuilt.
// This allows language changes of the menu text on the fly.
menuBar->Freeze();
while( menuBar->GetMenuCount() )
delete menuBar->Remove( 0 );
......@@ -83,91 +82,93 @@ void KICAD_MANAGER_FRAME::ReCreateMenuBar()
wxMenu* fileMenu = new wxMenu;
// Open
ADD_MENUITEM_WITH_HELP( fileMenu,
ID_LOAD_PROJECT,
_( "&Open\tCtrl+O" ),
_( "Open an existing project" ),
open_project_xpm );
AddMenuItem( fileMenu,
ID_LOAD_PROJECT,
_( "&Open\tCtrl+O" ),
_( "Open an existing project" ),
open_project_xpm );
// Open Recent submenu
static wxMenu* openRecentMenu;
// Add this menu to list menu managed by m_fileHistory
// (the file history will be updated when adding/removing files in history
if( openRecentMenu )
wxGetApp().m_fileHistory.RemoveMenu( openRecentMenu );
openRecentMenu = new wxMenu();
wxGetApp().m_fileHistory.UseMenu( openRecentMenu );
wxGetApp().m_fileHistory.AddFilesToMenu( );
ADD_MENUITEM_WITH_HELP_AND_SUBMENU( fileMenu, openRecentMenu,
wxID_ANY,
_( "Open &Recent" ),
_( "Open a recent opened schematic project" ),
open_project_xpm );
AddMenuItem( fileMenu, openRecentMenu,
wxID_ANY,
_( "Open &Recent" ),
_( "Open a recent opened schematic project" ),
open_project_xpm );
// New
ADD_MENUITEM_WITH_HELP( fileMenu, ID_NEW_PROJECT,
_( "&New\tCtrl+N" ),
_( "Start a new project" ),
new_project_xpm );
AddMenuItem( fileMenu, ID_NEW_PROJECT,
_( "&New\tCtrl+N" ),
_( "Start a new project" ),
new_project_xpm );
// Save
ADD_MENUITEM_WITH_HELP( fileMenu,
ID_SAVE_PROJECT,
_( "&Save\tCtrl+S" ),
_( "Save current project" ),
save_project_xpm );
AddMenuItem( fileMenu,
ID_SAVE_PROJECT,
_( "&Save\tCtrl+S" ),
_( "Save current project" ),
save_project_xpm );
// Archive
fileMenu->AppendSeparator();
ADD_MENUITEM_WITH_HELP( fileMenu,
ID_SAVE_AND_ZIP_FILES,
_( "&Archive" ),
_( "Archive project files in zip archive" ),
zip_xpm );
AddMenuItem( fileMenu,
ID_SAVE_AND_ZIP_FILES,
_( "&Archive" ),
_( "Archive project files in zip archive" ),
zip_xpm );
// Unarchive
ADD_MENUITEM_WITH_HELP( fileMenu,
ID_READ_ZIP_ARCHIVE,
_( "&Unarchive" ),
_( "Unarchive project files from zip file" ),
unzip_xpm );
AddMenuItem( fileMenu,
ID_READ_ZIP_ARCHIVE,
_( "&Unarchive" ),
_( "Unarchive project files from zip file" ),
unzip_xpm );
// Separator
fileMenu->AppendSeparator();
// Quit
ADD_MENUITEM_WITH_HELP( fileMenu,
wxID_EXIT,
_( "&Quit" ),
_( "Quit KiCad" ),
exit_xpm );
AddMenuItem( fileMenu,
wxID_EXIT,
_( "&Quit" ),
_( "Quit KiCad" ),
exit_xpm );
// Menu Browse:
wxMenu* browseMenu = new wxMenu();
// Text editor
ADD_MENUITEM_WITH_HELP( browseMenu,
ID_TO_EDITOR,
_( "Text E&ditor" ),
_( "Launch preferred text editor" ),
editor_xpm );
AddMenuItem( browseMenu,
ID_TO_EDITOR,
_( "Text E&ditor" ),
_( "Launch preferred text editor" ),
editor_xpm );
// View file
ADD_MENUITEM_WITH_HELP( browseMenu,
ID_BROWSE_AN_SELECT_FILE,
_( "&View File" ),
_( "View, read or edit file with a text editor" ),
browse_files_xpm );
AddMenuItem( browseMenu,
ID_BROWSE_AN_SELECT_FILE,
_( "&View File" ),
_( "View, read or edit file with a text editor" ),
browse_files_xpm );
// Menu Preferences:
wxMenu* preferencesMenu = new wxMenu;
// Text editor
ADD_MENUITEM_WITH_HELP( preferencesMenu,
ID_SELECT_PREFERED_EDITOR,
_( "&Text Editor" ),
_( "Select your preferred text editor" ),
editor_xpm );
AddMenuItem( preferencesMenu,
ID_SELECT_PREFERED_EDITOR,
_( "&Text Editor" ),
_( "Select your preferred text editor" ),
editor_xpm );
// PDF Viewer submenu:System browser or user defined checkbox
wxMenu* SubMenuPdfBrowserChoice = new wxMenu;
......@@ -200,18 +201,18 @@ void KICAD_MANAGER_FRAME::ReCreateMenuBar()
!wxGetApp().m_PdfBrowserIsDefault );
// Append PDF Viewer submenu to preferences
ADD_MENUITEM_WITH_HELP( SubMenuPdfBrowserChoice,
ID_SELECT_PREFERED_PDF_BROWSER_NAME,
_( "PDF Viewer" ),
_( "Select your favourite PDF viewer used to browse datasheets" ),
datasheet_xpm );
AddMenuItem( SubMenuPdfBrowserChoice,
ID_SELECT_PREFERED_PDF_BROWSER_NAME,
_( "PDF Viewer" ),
_( "Select your favourite PDF viewer used to browse datasheets" ),
datasheet_xpm );
// PDF viewer submenu
ADD_MENUITEM_WITH_HELP_AND_SUBMENU( preferencesMenu,
SubMenuPdfBrowserChoice, -1,
_( "PDF Viewer" ),
_( "PDF viewer preferences" ),
datasheet_xpm );
AddMenuItem( preferencesMenu,
SubMenuPdfBrowserChoice, -1,
_( "PDF Viewer" ),
_( "PDF viewer preferences" ),
datasheet_xpm );
// Language submenu
preferencesMenu->AppendSeparator();
......@@ -224,26 +225,26 @@ void KICAD_MANAGER_FRAME::ReCreateMenuBar()
AddHelpVersionInfoMenuEntry( helpMenu );
// Contents
ADD_MENUITEM_WITH_HELP( helpMenu,
wxID_HELP,
_( "&Contents" ),
_( "Open the Kicad handbook" ),
online_help_xpm );
ADD_MENUITEM_WITH_HELP( helpMenu,
wxID_INDEX,
_( "&Getting Started in KiCad" ),
_( "Open the \"Getting Started in KiCad\" guide for beginners" ),
help_xpm );
AddMenuItem( helpMenu,
wxID_HELP,
_( "&Contents" ),
_( "Open the Kicad handbook" ),
online_help_xpm );
AddMenuItem( helpMenu,
wxID_INDEX,
_( "&Getting Started in KiCad" ),
_( "Open the \"Getting Started in KiCad\" guide for beginners" ),
help_xpm );
// Separator
helpMenu->AppendSeparator();
// About
ADD_MENUITEM_WITH_HELP( helpMenu,
wxID_ABOUT,
_( "&About KiCad" ),
_( "About kicad project manager" ),
info_xpm );
AddMenuItem( helpMenu,
wxID_ABOUT,
_( "&About KiCad" ),
_( "About kicad project manager" ),
info_xpm );
// Create the menubar and append all submenus
menuBar->Append( fileMenu, _( "&File" ) );
......
......@@ -3,7 +3,6 @@
/****************/
#include "fctsys.h"
#include "common.h"
#include "class_drawpanel.h"
#include "pcbnew.h"
#include "wxPcbStruct.h"
......@@ -176,16 +175,16 @@ BOARD_ITEM* PCB_BASE_FRAME::PcbGeneralLocateAndDisplay( int aHotKeyCode )
wxMenu itemMenu;
/* Give a title to the selection menu. This is also a cancel menu item */
wxMenuItem * item_title = new wxMenuItem(&itemMenu, -1, _( "Selection Clarification" ) );
wxMenuItem * item_title = new wxMenuItem( &itemMenu, -1, _( "Selection Clarification" ) );
#ifdef __WINDOWS__
wxFont bold_font(*wxNORMAL_FONT);
bold_font.SetWeight(wxFONTWEIGHT_BOLD);
bold_font.SetStyle( wxFONTSTYLE_ITALIC);
item_title->SetFont(bold_font);
wxFont bold_font( *wxNORMAL_FONT );
bold_font.SetWeight( wxFONTWEIGHT_BOLD );
bold_font.SetStyle( wxFONTSTYLE_ITALIC );
item_title->SetFont( bold_font );
#endif
itemMenu.Append(item_title);
itemMenu.Append( item_title );
itemMenu.AppendSeparator();
int limit = MIN( MAX_ITEMS_IN_PICKER, m_Collector->GetCount() );
......@@ -199,7 +198,7 @@ BOARD_ITEM* PCB_BASE_FRAME::PcbGeneralLocateAndDisplay( int aHotKeyCode )
BITMAP_DEF xpm = item->GetMenuImage();
ADD_MENUITEM( &itemMenu, ID_POPUP_PCB_ITEM_SELECTION_START + i, text, xpm );
AddMenuItem( &itemMenu, ID_POPUP_PCB_ITEM_SELECTION_START + i, text, xpm );
}
/* @todo: rather than assignment to true, these should be increment and decrement
......
......@@ -188,12 +188,14 @@ private:
* Function BuildHolesList
* Create the list of holes and tools for a given board
* The list is sorted by increasing drill values
* Only holes from aFirstLayer to aLastLayer copper layers are listed (for vias, because pad holes are always through holes)
* Only holes from aFirstLayer to aLastLayer copper layers are listed (for vias, because
* pad holes are always through holes)
* @param aPcb : the given board
* @param aHoleListBuffer : the std::vector<HOLE_INFO> to fill with pcb holes info
* @param aToolListBuffer : the std::vector<DRILL_TOOL> to fill with tools to use
* @param aFirstLayer = first layer to consider. if < 0 aFirstLayer is ignored
* @param aLastLayer = last layer to consider. if < 0 aLastLayer is ignored
* @param aExcludeThroughHoles Exclude through holes if true.
* @param aGenerateNPTH_list :
* true to create NPTH only list (with no plated holes)
* false to created plated holes list (with no NPTH )
......
......@@ -3,13 +3,11 @@
* @brief (Re)Create the main menubar for the module editor
*/
#include "fctsys.h"
#include "common.h"
#include "pcbnew.h"
#include "wxPcbStruct.h"
#include "module_editor_frame.h"
#include "bitmaps.h"
#include "protos.h"
#include "pcbnew_id.h"
......@@ -71,10 +69,10 @@ void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar()
openSubmenu->Append( item );
/* Append openSubmenu to fileMenu */
ADD_MENUITEM_WITH_HELP_AND_SUBMENU( fileMenu, openSubmenu, -1,
_( "&Load Module" ),
_( "Load a footprint module" ),
open_document_xpm );
AddMenuItem( fileMenu, openSubmenu, -1,
_( "&Load Module" ),
_( "Load a footprint module" ),
open_document_xpm );
// Save module
item = new wxMenuItem( fileMenu,
......@@ -188,11 +186,11 @@ void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar()
dimensions_Submenu->Append( item );
// Append dimensions_Submenu to editMenu
ADD_MENUITEM_WITH_HELP_AND_SUBMENU( editMenu,
dimensions_Submenu, -1,
_( "&Dimensions" ),
_( "Edit dimensions preferences" ),
add_dimension_xpm );
AddMenuItem( editMenu,
dimensions_Submenu, -1,
_( "&Dimensions" ),
_( "Edit dimensions preferences" ),
add_dimension_xpm );
// View menu
wxMenu* viewMenu = new wxMenu;
......@@ -302,23 +300,23 @@ void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar()
AddHelpVersionInfoMenuEntry( helpMenu );
// Contents
ADD_MENUITEM_WITH_HELP( helpMenu,
wxID_HELP,
_( "&Contents" ),
_( "Open the PCBNew handbook" ),
online_help_xpm );
ADD_MENUITEM_WITH_HELP( helpMenu,
wxID_INDEX,
_( "&Getting Started in KiCad" ),
_( "Open the \"Getting Started in KiCad\" guide for beginners" ),
help_xpm );
AddMenuItem( helpMenu,
wxID_HELP,
_( "&Contents" ),
_( "Open the PCBNew handbook" ),
online_help_xpm );
AddMenuItem( helpMenu,
wxID_INDEX,
_( "&Getting Started in KiCad" ),
_( "Open the \"Getting Started in KiCad\" guide for beginners" ),
help_xpm );
// About PCBNew
helpMenu->AppendSeparator();
ADD_MENUITEM_WITH_HELP( helpMenu, wxID_ABOUT,
_( "&About PCBNew" ),
_( "About PCBNew PCB designer" ),
info_xpm );
AddMenuItem( helpMenu, wxID_ABOUT,
_( "&About PCBNew" ),
_( "About PCBNew PCB designer" ),
info_xpm );
// Append menus to the menubar
menuBar->Append( fileMenu, _( "&File" ) );
......
......@@ -4,14 +4,11 @@
*/
#include "fctsys.h"
#include "appl_wxstruct.h"
#include "common.h"
#include "pcbnew.h"
#include "wxPcbStruct.h"
#include "bitmaps.h"
#include "protos.h"
#include "hotkeys.h"
#include "pcbnew_id.h"
#include "macros.h"
#include "help_common_strings.h"
......@@ -30,6 +27,7 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
// Delete all existing menus so they can be rebuilt.
// This allows language changes of the menu text on the fly.
menuBar->Freeze();
while( menuBar->GetMenuCount() )
delete menuBar->Remove(0);
......@@ -54,17 +52,19 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
// Load Recent submenu
static wxMenu* openRecentMenu;
// Add this menu to list menu managed by m_fileHistory
// (the file history will be updated when adding/removing files in history
if( openRecentMenu )
wxGetApp().m_fileHistory.RemoveMenu( openRecentMenu );
openRecentMenu = new wxMenu();
wxGetApp().m_fileHistory.UseMenu( openRecentMenu );
wxGetApp().m_fileHistory.AddFilesToMenu();
ADD_MENUITEM_WITH_HELP_AND_SUBMENU( filesMenu, openRecentMenu,
-1, _( "Open &Recent" ),
_( "Open a recent opened board" ),
open_project_xpm );
AddMenuItem( filesMenu, openRecentMenu,
-1, _( "Open &Recent" ),
_( "Open a recent opened board" ),
open_project_xpm );
// PCBNew Board
......@@ -136,10 +136,10 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
fabricationOutputsMenu->Append( item );
// Fabrications Outputs submenu append
ADD_MENUITEM_WITH_HELP_AND_SUBMENU( filesMenu, fabricationOutputsMenu,
-1, _( "Fabrication Outputs" ),
_( "Generate files for fabrication" ),
fabrication_xpm );
AddMenuItem( filesMenu, fabricationOutputsMenu,
-1, _( "Fabrication Outputs" ),
_( "Generate files for fabrication" ),
fabrication_xpm );
......@@ -153,9 +153,9 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
SET_BITMAP( import_xpm ); // @todo need better bitmap
submenuImport->Append( item );
ADD_MENUITEM_WITH_HELP_AND_SUBMENU( filesMenu, submenuImport,
ID_GEN_IMPORT_FILE, _( "Import" ),
_( "Import files" ), import_xpm );
AddMenuItem( filesMenu, submenuImport,
ID_GEN_IMPORT_FILE, _( "Import" ),
_( "Import files" ), import_xpm );
......@@ -189,9 +189,9 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
SET_BITMAP( three_d_xpm );
submenuexport->Append( item );
ADD_MENUITEM_WITH_HELP_AND_SUBMENU( filesMenu, submenuexport,
ID_GEN_EXPORT_FILE, _( "&Export" ),
_( "Export board" ), export_xpm );
AddMenuItem( filesMenu, submenuexport,
ID_GEN_EXPORT_FILE, _( "&Export" ),
_( "Export board" ), export_xpm );
filesMenu->AppendSeparator();
......@@ -240,11 +240,11 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
SET_BITMAP( library_xpm );
submenuarchive->Append( item );
ADD_MENUITEM_WITH_HELP_AND_SUBMENU( filesMenu, submenuarchive,
ID_MENU_ARCHIVE_MODULES,
_( "Archive Footprints" ),
_( "Archive or add footprints in a library file" ),
library_xpm );
AddMenuItem( filesMenu, submenuarchive,
ID_MENU_ARCHIVE_MODULES,
_( "Archive Footprints" ),
_( "Archive or add footprints in a library file" ),
library_xpm );
/* Quit */
filesMenu->AppendSeparator();
......@@ -337,36 +337,29 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
* for Zoom in and Zoom out sub menus
*/
// Zoom In
text = AddHotkeyName( _( "Zoom In" ), g_Pcbnew_Editor_Hokeys_Descr,
HK_ZOOM_IN, false );
item = new wxMenuItem( viewMenu, ID_ZOOM_IN, text,
HELP_ZOOM_IN, wxITEM_NORMAL );
text = AddHotkeyName( _( "Zoom In" ), g_Pcbnew_Editor_Hokeys_Descr, HK_ZOOM_IN, false );
item = new wxMenuItem( viewMenu, ID_ZOOM_IN, text, HELP_ZOOM_IN, wxITEM_NORMAL );
SET_BITMAP( zoom_in_xpm );
viewMenu->Append( item );
// Zoom Out
text = AddHotkeyName( _( "Zoom Out" ), g_Pcbnew_Editor_Hokeys_Descr,
HK_ZOOM_OUT, false );
item = new wxMenuItem( viewMenu, ID_ZOOM_OUT, text,
HELP_ZOOM_OUT, wxITEM_NORMAL );
text = AddHotkeyName( _( "Zoom Out" ), g_Pcbnew_Editor_Hokeys_Descr, HK_ZOOM_OUT, false );
item = new wxMenuItem( viewMenu, ID_ZOOM_OUT, text, HELP_ZOOM_OUT, wxITEM_NORMAL );
SET_BITMAP( zoom_out_xpm );
viewMenu->Append( item );
// Fit on Screen
text = AddHotkeyName( _( "Fit on Screen" ), g_Pcbnew_Editor_Hokeys_Descr,
HK_ZOOM_AUTO );
text = AddHotkeyName( _( "Fit on Screen" ), g_Pcbnew_Editor_Hokeys_Descr, HK_ZOOM_AUTO );
item = new wxMenuItem( viewMenu, ID_ZOOM_PAGE, text,
HELP_ZOOM_FIT, wxITEM_NORMAL );
item = new wxMenuItem( viewMenu, ID_ZOOM_PAGE, text, HELP_ZOOM_FIT, wxITEM_NORMAL );
SET_BITMAP( zoom_fit_in_page_xpm );
viewMenu->Append( item );
viewMenu->AppendSeparator();
// Redraw
text = AddHotkeyName( _( "Redraw" ), g_Pcbnew_Editor_Hokeys_Descr,
HK_ZOOM_REDRAW );
text = AddHotkeyName( _( "Redraw" ), g_Pcbnew_Editor_Hokeys_Descr, HK_ZOOM_REDRAW );
item = new wxMenuItem( viewMenu, ID_ZOOM_REDRAW, text,
HELP_ZOOM_REDRAW,
......@@ -403,8 +396,7 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
placeMenu->Append( item );
// Track
text = AddHotkeyName( _( "Track" ), g_Pcbnew_Editor_Hokeys_Descr,
HK_ADD_NEW_TRACK, false );
text = AddHotkeyName( _( "Track" ), g_Pcbnew_Editor_Hokeys_Descr, HK_ADD_NEW_TRACK, false );
item = new wxMenuItem( placeMenu, ID_TRACK_BUTT, text,
_( "Add tracks and vias" ), wxITEM_NORMAL );
......@@ -449,8 +441,8 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
// Dimension
item = new wxMenuItem( placeMenu, ID_PCB_DIMENSION_BUTT,
_( "Dimension" ),
_( "Add dimension" ) );
_( "Dimension" ),
_( "Add dimension" ) );
SET_BITMAP( add_dimension_xpm );
placeMenu->Append( item );
......@@ -464,8 +456,8 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
// Drill & Place Offset
item = new wxMenuItem( placeMenu, ID_PCB_PLACE_OFFSET_COORD_BUTT,
_( "Drill and Place Offset" ),
_( "Place the origin point for drill and place files" ));
_( "Drill and Place Offset" ),
_( "Place the origin point for drill and place files" ));
SET_BITMAP( pcb_offset_xpm );
placeMenu->Append( item );
......@@ -556,10 +548,10 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
dimensionsMenu->Append( item );
// Append dimension menu to config menu
ADD_MENUITEM_WITH_HELP_AND_SUBMENU( configmenu, dimensionsMenu,
-1, _( "Di&mensions" ),
_( "Global dimensions preferences" ),
add_dimension_xpm );
AddMenuItem( configmenu, dimensionsMenu,
-1, _( "Di&mensions" ),
_( "Global dimensions preferences" ),
add_dimension_xpm );
// Language submenu
wxGetApp().AddMenuLanguageList( configmenu );
......@@ -634,7 +626,6 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
SET_BITMAP( copper_layers_setup_xpm );
designRulesMenu->Append( item );
/**
* Help menu
*/
......@@ -643,23 +634,23 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
AddHelpVersionInfoMenuEntry( helpMenu );
// Contents
ADD_MENUITEM_WITH_HELP( helpMenu,
wxID_HELP,
_( "&Contents" ),
_( "Open the PCBNew handbook" ),
online_help_xpm );
ADD_MENUITEM_WITH_HELP( helpMenu,
wxID_INDEX,
_( "&Getting Started in KiCad" ),
_( "Open the \"Getting Started in KiCad\" guide for beginners" ),
help_xpm );
AddMenuItem( helpMenu,
wxID_HELP,
_( "&Contents" ),
_( "Open the PCBNew handbook" ),
online_help_xpm );
AddMenuItem( helpMenu,
wxID_INDEX,
_( "&Getting Started in KiCad" ),
_( "Open the \"Getting Started in KiCad\" guide for beginners" ),
help_xpm );
// About
helpMenu->AppendSeparator();
ADD_MENUITEM_WITH_HELP( helpMenu, wxID_ABOUT,
_( "&About PCBNew" ),
_( "About PCBnew printed circuit board designer" ),
info_xpm );
AddMenuItem( helpMenu, wxID_ABOUT,
_( "&About PCBNew" ),
_( "About PCBnew printed circuit board designer" ),
info_xpm );
/**
* Append all menus to the menuBar
......
......@@ -8,7 +8,6 @@
#include "confirm.h"
#include "gestfich.h"
#include "appl_wxstruct.h"
#include "bitmaps.h"
#include "pcbnew_id.h"
#include "trigo.h"
......@@ -100,10 +99,10 @@ BOARD_ITEM* FOOTPRINT_EDIT_FRAME::ModeditLocateAndDisplay( int aHotKeyCode )
text = item->GetSelectMenuText();
xpm = item->GetMenuImage();
ADD_MENUITEM( &itemMenu,
ID_POPUP_PCB_ITEM_SELECTION_START + ii,
text,
xpm );
AddMenuItem( &itemMenu,
ID_POPUP_PCB_ITEM_SELECTION_START + ii,
text,
xpm );
}
// this menu's handler is void
......@@ -735,6 +734,7 @@ void FOOTPRINT_EDIT_FRAME::Transform( MODULE* module, int transform )
edgemod->m_Start0 = edgemod->m_Start;
edgemod->m_End0 = edgemod->m_End;
}
if( PtStruct->Type() == TYPE_TEXTE_MODULE )
{
textmod = (TEXTE_MODULE*) PtStruct;
......@@ -775,6 +775,7 @@ void FOOTPRINT_EDIT_FRAME::Transform( MODULE* module, int transform )
/* Reverse mirror of footprints. */
PtStruct = module->m_Drawings;
for( ; PtStruct != NULL; PtStruct = PtStruct->Next() )
{
switch( PtStruct->Type() )
......
This diff is collapsed.
......@@ -30,7 +30,7 @@ public:
/**
* Function RedrawActiveWindoow
* daws the footprint editor BOARD, and others elements : axis, grid ..
* daws the footprint editor BOARD, and others elements such as axis and grid.
*/
void RedrawActiveWindow( wxDC* DC, bool EraseBg );
......
This diff is collapsed.
......@@ -224,8 +224,9 @@ void Calcule_Coord_Extremite_45( const wxPoint& aPosition, int ox, int oy, int*
* interesting segments
* @param aTrackLen = a pointer to an integer where to return the lenght of the
* track
* @param aLengthDie = a pointer to an integer where to return the extra lengths inside integrated circuits
* from the pads connected to this track to the die (if any)
* @param aLengthDie = a pointer to an integer where to return the extra lengths inside
* integrated circuits from the pads connected to this track to the
* die (if any)
* @param aReorder = true for reorder the interesting segments (useful for
* track edition/deletion) in this case the flag BUSY is
* set (the user is responsible of flag clearing). False
......
......@@ -28,30 +28,6 @@ static void Marque_Chaine_segments( BOARD* Pcb,
TRACK_PTRS* aList );
/**
* Function Marque_Une_Piste
* marks a chain of track segments, connected to aTrackList.
* Each segment is marked by setting the BUSY bit into m_Flags. Electrical
* continuity is detected by walking each segment, and finally the segments
* are rearranged into a contiguous chain within the given list.
* @param aPcb = the board to analyze
* @param aStartSegm - The first interesting segment within a list of track
* segment of aPcb
* @param aSegmCount = a pointer to an integer where to return the number of
* interesting segments
* @param aTrackLen = a pointer to an integer where to return the length of the
* track on board
* @param aLengthDie = a pointer to an integer where to return the extra lengths inside integrated circuits
* from the pads connected to this track to the die (if any)
* @param aReorder = bool:
* true for reorder the interesting segments (useful for track
*edition/deletion)
* in this case the flag BUSY is set (the user is responsible of flag
*clearing)
* false for no reorder : useful when we want just calculate the track length
* in this case, flags are reset
* @return TRACK* the first in the chain of interesting segments.
*/
TRACK* Marque_Une_Piste( BOARD* aPcb,
TRACK* aStartSegm,
int* aSegmCount,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment