本文整理匯總了C++中AddMenuItem函數的典型用法代碼示例。如果您正苦於以下問題:C++ AddMenuItem函數的具體用法?C++ AddMenuItem怎麽用?C++ AddMenuItem使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了AddMenuItem函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: _
void EDA_3D_FRAME::CreateMenuBar()
{
wxMenuBar* menuBar = new wxMenuBar;
wxMenu* fileMenu = new wxMenu;
wxMenu* prefsMenu = new wxMenu;
menuBar->Append( fileMenu, _( "&File" ) );
fileMenu->Append( ID_MENU_SCREENCOPY_PNG, _( "Create Image (png format)" ) );
fileMenu->Append( ID_MENU_SCREENCOPY_JPEG, _( "Create Image (jpeg format)" ) );
#if (defined(__WINDOWS__) || defined(__APPLE__ ) )
// Does not work properly under linux
fileMenu->AppendSeparator();
fileMenu->Append( ID_TOOL_SCREENCOPY_TOCLIBBOARD, _( "Copy 3D Image to Clipboard" ) );
#endif
fileMenu->AppendSeparator();
fileMenu->Append( wxID_EXIT, _( "&Exit" ) );
menuBar->Append( prefsMenu, _( "&Preferences" ) );
AddMenuItem( prefsMenu, ID_MENU3D_REALISTIC_MODE,
_( "Realistic Mode" ),
KiBitmap( use_3D_copper_thickness_xpm ), wxITEM_CHECK );
wxMenu * renderOptionsMenu = new wxMenu;
AddMenuItem( prefsMenu, renderOptionsMenu, ID_MENU3D_COLOR,
_( "Render options" ), KiBitmap( tools_xpm ) );
AddMenuItem( renderOptionsMenu, ID_MENU3D_FL_RENDER_SHADOWS,
_( "Render Shadows" ),
KiBitmap( green_xpm ), wxITEM_CHECK );
AddMenuItem( renderOptionsMenu, ID_MENU3D_FL_RENDER_SHOW_HOLES_IN_ZONES,
_( "Show Holes in Zones" ),
_( "Holes inside a copper layer copper zones are shown, "
"but the calculation time is longer" ),
KiBitmap( green_xpm ), wxITEM_CHECK );
AddMenuItem( renderOptionsMenu, ID_MENU3D_FL_RENDER_TEXTURES,
_( "Render Textures" ),
_( "Apply a grid/cloud textures to Board, Solder Mask and Silkscreen" ),
KiBitmap( green_xpm ), wxITEM_CHECK );
AddMenuItem( renderOptionsMenu, ID_MENU3D_FL_RENDER_SMOOTH,
_( "Render Smooth Normals" ),
KiBitmap( green_xpm ), wxITEM_CHECK );
AddMenuItem( renderOptionsMenu, ID_MENU3D_FL_RENDER_MATERIAL,
_( "Render Material properties" ),
KiBitmap( green_xpm ), wxITEM_CHECK );
prefsMenu->AppendSeparator();
wxMenu * backgrounColorMenu = new wxMenu;
// Add submenu Choose Colors
AddMenuItem( prefsMenu, backgrounColorMenu, ID_MENU3D_COLOR,
_( "Choose Colors" ), KiBitmap( palette_xpm ) );
AddMenuItem( backgrounColorMenu, ID_MENU3D_BGCOLOR_TOP_SELECTION,
_( "Background Top Color" ), KiBitmap( palette_xpm ) );
AddMenuItem( backgrounColorMenu, ID_MENU3D_BGCOLOR_SELECTION,
_( "Background Bottom Color" ), KiBitmap( palette_xpm ) );
AddMenuItem( prefsMenu, ID_MENU3D_AXIS_ONOFF,
_( "Show 3D &Axis" ), KiBitmap( axis3d_front_xpm ), wxITEM_CHECK );
// Creates grid menu
wxMenu * gridlistMenu = new wxMenu;
AddMenuItem( prefsMenu, gridlistMenu, ID_MENU3D_GRID,
_( "3D Grid" ), KiBitmap( grid_xpm ) );
gridlistMenu->AppendCheckItem( ID_MENU3D_GRID_NOGRID, _( "No 3D Grid" ), wxEmptyString );
gridlistMenu->AppendCheckItem( ID_MENU3D_GRID_10_MM, _( "3D Grid 10 mm" ), wxEmptyString );
gridlistMenu->AppendCheckItem( ID_MENU3D_GRID_5_MM, _( "3D Grid 5 mm" ), wxEmptyString );
gridlistMenu->AppendCheckItem( ID_MENU3D_GRID_2P5_MM, _( "3D Grid 2.5 mm" ), wxEmptyString );
gridlistMenu->AppendCheckItem( ID_MENU3D_GRID_1_MM, _( "3D Grid 1 mm" ), wxEmptyString );
// If the grid is on, check the corresponding menuitem showing the grid size
if( IsEnabled( FL_GRID ) )
{
gridlistMenu->Check( ID_MENU3D_GRID_10_MM, GetPrm3DVisu().m_3D_Grid == 10.0 );
gridlistMenu->Check( ID_MENU3D_GRID_5_MM, GetPrm3DVisu().m_3D_Grid == 5.0 );
gridlistMenu->Check( ID_MENU3D_GRID_2P5_MM, GetPrm3DVisu().m_3D_Grid == 2.5 );
gridlistMenu->Check( ID_MENU3D_GRID_1_MM, GetPrm3DVisu().m_3D_Grid == 1.0 );
}
else
gridlistMenu->Check( ID_MENU3D_GRID_NOGRID, true );
prefsMenu->AppendSeparator();
AddMenuItem( prefsMenu, ID_MENU3D_SHOW_BOARD_BODY,
_( "Show Board Body" ), KiBitmap( use_3D_copper_thickness_xpm ), wxITEM_CHECK );
AddMenuItem( prefsMenu, ID_MENU3D_USE_COPPER_THICKNESS,
_( "Show Copper Thickness" ), KiBitmap( use_3D_copper_thickness_xpm ), wxITEM_CHECK );
AddMenuItem( prefsMenu, ID_MENU3D_MODULE_ONOFF,
//.........這裏部分代碼省略.........
示例2: create_PopUpMenu
GtkWidget * create_PopUpMenu( void )
{
GtkWidget * window1;
GtkWidget * Menu = NULL;
GtkWidget * SubMenu = NULL;
GtkWidget * MenuItem = NULL;
GtkWidget * H, * N, * D, * F;
demuxer_t *demuxer = mpctx_get_demuxer(guiInfo.mpcontext);
mixer_t *mixer = mpctx_get_mixer(guiInfo.mpcontext);
int global_sub_size = mpctx_get_global_sub_size(guiInfo.mpcontext);
Menu=gtk_menu_new();
gtk_widget_realize (Menu);
window1 = gtk_widget_get_toplevel(Menu);
AddMenuItem( window1, (const char*)about_xpm, Menu,MSGTR_MENU_AboutMPlayer" ", evAbout );
AddSeparator( Menu );
SubMenu=AddSubMenu( window1, (const char*)open_xpm, Menu,MSGTR_MENU_Open );
AddMenuItem( window1, (const char*)file2_xpm, SubMenu,MSGTR_MENU_PlayFile" ", evLoadPlay );
#ifdef CONFIG_VCD
AddMenuItem( window1, (const char*)playvcd_xpm, SubMenu,MSGTR_MENU_PlayVCD, evPlayVCD );
#endif
#ifdef CONFIG_DVDREAD
AddMenuItem( window1, (const char*)playdvd_xpm, SubMenu,MSGTR_MENU_PlayDVD, evPlayDVD );
#endif
AddMenuItem( window1, (const char*)url_xpm, SubMenu,MSGTR_MENU_PlayURL, evSetURL );
AddMenuItem( window1, (const char*)sub_xpm, SubMenu,MSGTR_MENU_LoadSubtitle" ", evLoadSubtitle );
AddMenuItem( window1, (const char*)nosub_xpm, SubMenu,MSGTR_MENU_DropSubtitle,evDropSubtitle );
AddMenuItem( window1, (const char*)loadeaf_xpm, SubMenu,MSGTR_MENU_LoadExternAudioFile, evLoadAudioFile );
SubMenu=AddSubMenu(window1, (const char*)play_xpm, Menu,MSGTR_MENU_Playing );
AddMenuItem( window1, (const char*)play_xpm, SubMenu,MSGTR_MENU_Play" ", evPlay );
AddMenuItem( window1, (const char*)pause_xpm, SubMenu,MSGTR_MENU_Pause, evPause );
AddMenuItem( window1, (const char*)stop_xpm, SubMenu,MSGTR_MENU_Stop, evStop );
AddMenuItem( window1, (const char*)next_xpm, SubMenu,MSGTR_MENU_NextStream, evNext );
AddMenuItem( window1, (const char*)prev_xpm, SubMenu,MSGTR_MENU_PrevStream, evPrev );
// AddSeparator( SubMenu );
// AddMenuItem( SubMenu,"Back 10 sec", evBackward10sec );
// AddMenuItem( SubMenu,"Fwd 10 sec", evForward10sec );
// AddMenuItem( SubMenu,"Back 1 min", evBackward1min );
// AddMenuItem( SubMenu,"Fwd 1 min", evForward1min );
// SubMenu=AddSubMenu( Menu,MSGTR_MENU_Size );
// AddMenuItem( SubMenu,MSGTR_MENU_NormalSize" ", evNormalSize );
// AddMenuItem( SubMenu,MSGTR_MENU_DoubleSize, evDoubleSize );
// AddMenuItem( SubMenu,MSGTR_MENU_FullScreen, evFullScreen );
#ifdef CONFIG_VCD
VCDSubMenu=AddSubMenu( window1, (const char*)vcd_xpm, Menu,MSGTR_MENU_VCD );
AddMenuItem( window1, (const char*)playvcd_xpm, VCDSubMenu,MSGTR_MENU_PlayDisc,evPlayVCD );
AddSeparator( VCDSubMenu );
VCDTitleMenu=AddSubMenu( window1, (const char*)title_xpm, VCDSubMenu,MSGTR_MENU_Titles );
if ( guiInfo.Tracks )
{
char tmp[32]; int i;
for ( i=1;i < guiInfo.Tracks;i++ )
{
snprintf( tmp,32,MSGTR_MENU_Title,i );
//AddMenuItem( VCDTitleMenu,tmp,( i << 16 ) + evSetVCDTrack );
AddMenuItem(window1, (const char*)empty_xpm, VCDTitleMenu,tmp,( ( i + 1 ) << 16 ) + evSetVCDTrack );
}
}
else
{
MenuItem=AddMenuItem( window1, (const char*)empty_xpm, VCDTitleMenu,MSGTR_MENU_None,evNone );
gtk_widget_set_sensitive( MenuItem,FALSE );
}
#endif
#ifdef CONFIG_DVDREAD
DVDSubMenu=AddSubMenu( window1, (const char*)dvd_xpm, Menu,MSGTR_MENU_DVD );
AddMenuItem( window1, (const char*)playdvd_xpm, DVDSubMenu,MSGTR_MENU_PlayDisc" ", evPlayDVD );
// AddMenuItem( DVDSubMenu,MSGTR_MENU_ShowDVDMenu, evNone );
AddSeparator( DVDSubMenu );
DVDTitleMenu=AddSubMenu( window1, (const char*)title_xpm, DVDSubMenu,MSGTR_MENU_Titles );
if ( guiInfo.Tracks )
{
char tmp[32]; int i;
for ( i=1 ; i<= guiInfo.Tracks;i++ )
{
snprintf( tmp,32,MSGTR_MENU_Title,i);
AddMenuCheckItem( window1, (const char*)empty1px_xpm, DVDTitleMenu,tmp,
guiInfo.Track == i,
(i << 16) + evSetDVDTitle );
}
}
else
{
MenuItem=AddMenuItem( window1, (const char*)empty_xpm, DVDTitleMenu,MSGTR_MENU_None,evNone );
gtk_widget_set_sensitive( MenuItem,FALSE );
}
DVDChapterMenu=AddSubMenu( window1, (const char*)chapter_xpm, DVDSubMenu,MSGTR_MENU_Chapters );
if ( guiInfo.Chapters )
{
char tmp[32]; int i;
for ( i=1;i <= guiInfo.Chapters;i++ )
{
snprintf( tmp,32,MSGTR_MENU_Chapter,i );
AddMenuCheckItem( window1, (const char*)empty1px_xpm, DVDChapterMenu,tmp,guiInfo.Chapter == i,
( i << 16 ) + evSetDVDChapter );
}
}
else
//.........這裏部分代碼省略.........
示例3: AddMenuItem
void GossipMenu::AddMenuItem(uint8 Icon, char const* Message, uint32 dtSender, uint32 dtAction, char const* BoxMessage, uint32 BoxMoney, bool Coded)
{
AddMenuItem(Icon, std::string(Message ? Message : ""), dtSender, dtAction, std::string(BoxMessage ? BoxMessage : ""), BoxMoney, Coded);
}
示例4: GetCrossHairPosition
/* Create command lines for a popup menu, for track and via editing
* also update Netclass selection
*/
void PCB_EDIT_FRAME::createPopupMenuForTracks( TRACK* Track, wxMenu* PopMenu )
{
wxPoint cursorPosition = GetCrossHairPosition();
wxString msg;
SetCurrentNetClass( Track->GetNetClassName() );
int flags = Track->GetFlags();
if( flags == 0 )
{
msg = AddHotkeyName( _( "Begin Track" ),
g_Board_Editor_Hokeys_Descr, HK_ADD_NEW_TRACK );
AddMenuItem( PopMenu, ID_POPUP_PCB_BEGIN_TRACK,
msg, KiBitmap( add_tracks_xpm ) );
if( Track->Type() == PCB_VIA_T )
{
msg = AddHotkeyName( _( "Drag Via" ), g_Board_Editor_Hokeys_Descr,
HK_DRAG_ITEM );
AddMenuItem( PopMenu, ID_POPUP_PCB_MOVE_TRACK_NODE, msg,
KiBitmap( move_xpm ) );
}
else
{
if( Track->IsPointOnEnds( cursorPosition, -1 ) != 0 )
{
msg = AddHotkeyName( _( "Move Node" ), g_Board_Editor_Hokeys_Descr, HK_MOVE_ITEM );
AddMenuItem( PopMenu, ID_POPUP_PCB_MOVE_TRACK_NODE,
msg, KiBitmap( move_xpm ) );
}
else
{
msg = AddHotkeyName( _( "Drag Segments, Keep Slope" ), g_Board_Editor_Hokeys_Descr,
HK_DRAG_TRACK_KEEP_SLOPE );
AddMenuItem( PopMenu, ID_POPUP_PCB_DRAG_TRACK_SEGMENT_KEEP_SLOPE,
msg, KiBitmap( drag_segment_withslope_xpm ) );
msg = AddHotkeyName( _( "Drag Segment" ), g_Board_Editor_Hokeys_Descr,
HK_DRAG_ITEM );
AddMenuItem( PopMenu, ID_POPUP_PCB_DRAG_TRACK_SEGMENT,
msg, KiBitmap( drag_track_segment_xpm ) );
msg = AddHotkeyName( _( "Duplicate Track" ), g_Board_Editor_Hokeys_Descr,
HK_DUPLICATE_ITEM );
AddMenuItem( PopMenu, ID_POPUP_PCB_DUPLICATE_ITEM,
msg, KiBitmap( duplicate_line_xpm ) );
msg = AddHotkeyName( _("Move Track Exactly" ), g_Board_Editor_Hokeys_Descr,
HK_MOVE_ITEM_EXACT );
AddMenuItem( PopMenu, ID_POPUP_PCB_MOVE_EXACT,
msg, KiBitmap( move_line_xpm ) );
msg = AddHotkeyName( _("Create Track Array" ), g_Board_Editor_Hokeys_Descr,
HK_CREATE_ARRAY );
AddMenuItem( PopMenu, ID_POPUP_PCB_CREATE_ARRAY,
msg, KiBitmap( array_line_xpm ) );
AddMenuItem( PopMenu, ID_POPUP_PCB_BREAK_TRACK,
_( "Break Track" ), KiBitmap( break_line_xpm ) );
}
}
AddMenuItem( PopMenu, ID_POPUP_PCB_SELECT_CU_LAYER,
_( "Select Working Layer" ), KiBitmap( select_w_layer_xpm ) );
}
else if( flags & IS_DRAGGED ) // Drag via or node in progress
{
AddMenuItem( PopMenu, ID_POPUP_PCB_PLACE_MOVED_TRACK_NODE,
_( "Place Node" ), KiBitmap( checked_ok_xpm ) );
return;
}
else // Edition in progress
{
if( flags & IS_NEW )
{
msg = AddHotkeyName( _( "End Track" ), g_Board_Editor_Hokeys_Descr, HK_LEFT_DCLICK );
AddMenuItem( PopMenu, ID_POPUP_PCB_END_TRACK, msg, KiBitmap( checked_ok_xpm ) );
}
msg = AddHotkeyName( _( "Place Through Via" ), g_Board_Editor_Hokeys_Descr, HK_ADD_THROUGH_VIA );
AddMenuItem( PopMenu, ID_POPUP_PCB_PLACE_THROUGH_VIA, msg, KiBitmap( via_xpm ) );
msg = AddHotkeyName( _( "Select Layer and Place Through Via" ),
g_Board_Editor_Hokeys_Descr, HK_SEL_LAYER_AND_ADD_THROUGH_VIA );
AddMenuItem( PopMenu, ID_POPUP_PCB_SELECT_CU_LAYER_AND_PLACE_THROUGH_VIA,
msg, KiBitmap( select_w_layer_xpm ) );
if( GetDesignSettings().m_BlindBuriedViaAllowed )
{
msg = AddHotkeyName( _( "Place Blind/Buried Via" ),
g_Board_Editor_Hokeys_Descr, HK_ADD_BLIND_BURIED_VIA );
AddMenuItem( PopMenu, ID_POPUP_PCB_PLACE_BLIND_BURIED_VIA, msg, KiBitmap( via_buried_xpm ) );
msg = AddHotkeyName( _( "Select Layer and Place Blind/Buried Via" ),
g_Board_Editor_Hokeys_Descr, HK_SEL_LAYER_AND_ADD_BLIND_BURIED_VIA );
AddMenuItem( PopMenu, ID_POPUP_PCB_SELECT_CU_LAYER_AND_PLACE_BLIND_BURIED_VIA,
//.........這裏部分代碼省略.........
示例5: AddMenuItem
/* Create the wxMenuitem list for zone outlines editing and zone filling
*/
void PCB_EDIT_FRAME::createPopUpMenuForZones( ZONE_CONTAINER* edge_zone, wxMenu* aPopMenu )
{
wxString msg;
if( edge_zone->GetFlags() == IS_DRAGGED )
{
AddMenuItem( aPopMenu, ID_POPUP_PCB_PLACE_DRAGGED_ZONE_OUTLINE_SEGMENT,
_( "Place Edge Outline" ), KiBitmap( checked_ok_xpm ) );
}
else if( edge_zone->GetFlags() )
{
if( (edge_zone->GetFlags() & IN_EDIT ) )
AddMenuItem( aPopMenu, ID_POPUP_PCB_PLACE_ZONE_CORNER,
_( "Place Corner" ), KiBitmap( checked_ok_xpm ) );
else
AddMenuItem( aPopMenu, ID_POPUP_PCB_PLACE_ZONE_OUTLINES,
_( "Place Zone" ), KiBitmap( checked_ok_xpm ) );
}
else
{
wxMenu* zones_menu = new wxMenu();
AddMenuItem( aPopMenu, zones_menu, -1,
edge_zone->GetIsKeepout() ? _("Keepout Area") : _( "Zones" ),
KiBitmap( add_zone_xpm ) );
if( edge_zone->HitTestForCorner( RefPos( true ) ) >= 0 )
{
AddMenuItem( zones_menu, ID_POPUP_PCB_MOVE_ZONE_CORNER,
_( "Move Corner" ), KiBitmap( move_xpm ) );
AddMenuItem( zones_menu, ID_POPUP_PCB_DELETE_ZONE_CORNER,
_( "Delete Corner" ), KiBitmap( delete_xpm ) );
}
else if( edge_zone->HitTestForEdge( RefPos( true ) ) >= 0 )
{
AddMenuItem( zones_menu, ID_POPUP_PCB_ADD_ZONE_CORNER,
_( "Create Corner" ), KiBitmap( add_corner_xpm ) );
msg = AddHotkeyName( _( "Drag Outline Segment" ), g_Board_Editor_Hokeys_Descr,
HK_DRAG_ITEM );
AddMenuItem( zones_menu, ID_POPUP_PCB_DRAG_ZONE_OUTLINE_SEGMENT,
msg, KiBitmap( drag_outline_segment_xpm ) );
}
zones_menu->AppendSeparator();
AddMenuItem( zones_menu, ID_POPUP_PCB_ZONE_ADD_SIMILAR_ZONE,
_( "Add Similar Zone" ), KiBitmap( add_zone_xpm ) );
AddMenuItem( zones_menu, ID_POPUP_PCB_ZONE_ADD_CUTOUT_ZONE,
_( "Add Cutout Area" ), KiBitmap( add_zone_cutout_xpm ) );
AddMenuItem( zones_menu, ID_POPUP_PCB_ZONE_DUPLICATE,
_( "Duplicate Zone Onto Layer" ), KiBitmap( zone_duplicate_xpm ) );
zones_menu->AppendSeparator();
if( ! edge_zone->GetIsKeepout() )
AddMenuItem( zones_menu, ID_POPUP_PCB_FILL_ZONE, _( "Fill Zone" ),
KiBitmap( fill_zone_xpm ) );
if( !edge_zone->GetFilledPolysList().IsEmpty() )
{
AddMenuItem( zones_menu, ID_POPUP_PCB_REMOVE_FILLED_AREAS_IN_CURRENT_ZONE,
_( "Remove Filled Areas in Zone" ), KiBitmap( zone_unfill_xpm ) );
}
msg = AddHotkeyName( _( "Move Zone" ), g_Board_Editor_Hokeys_Descr, HK_MOVE_ITEM );
AddMenuItem( zones_menu, ID_POPUP_PCB_MOVE_ZONE_OUTLINES, msg, KiBitmap( move_xpm ) );
msg = AddHotkeyName( _("Move Zone Exactly" ), g_Board_Editor_Hokeys_Descr,
HK_MOVE_ITEM_EXACT );
AddMenuItem( zones_menu, ID_POPUP_PCB_MOVE_EXACT,
msg, KiBitmap( move_zone_xpm ) );
msg = AddHotkeyName( _( "Edit Zone Properties" ), g_Board_Editor_Hokeys_Descr,
HK_EDIT_ITEM );
AddMenuItem( zones_menu, ID_POPUP_PCB_EDIT_ZONE_PARAMS,
msg, KiBitmap( edit_xpm ) );
zones_menu->AppendSeparator();
if( edge_zone->GetSelectedCorner() >= 0 &&
edge_zone->Outline()->IsCutoutContour( edge_zone->GetSelectedCorner() ) )
AddMenuItem( zones_menu, ID_POPUP_PCB_DELETE_ZONE_CUTOUT,
_( "Delete Cutout" ), KiBitmap( delete_xpm ) );
AddMenuItem( zones_menu, ID_POPUP_PCB_DELETE_ZONE_CONTAINER,
_( "Delete Zone Outline" ), KiBitmap( delete_xpm ) );
}
}
示例6: AddMenuItem
void Menu::AppendMenuItem(int item_id,
const std::wstring& label,
MenuItemType type)
{
AddMenuItem(-1, item_id, label, type);
}
示例7: GetRegistryValue
int CGitExtensionsShellEx::PopulateMenu(HMENU hMenu, int firstId, int id, bool isSubMenu)
{
CString szShellVisibleMenuItems = GetRegistryValue(HKEY_CURRENT_USER, "SOFTWARE\\GitExtensions\\GitExtensions", "ShellVisibleMenuItems");
// preset values, if not used
AddFilesId = -1;
ApplyPatchId = -1;
BrowseId = -1;
CreateBranchId = -1;
CheckoutBranchId = -1;
CheckoutRevisionId = -1;
CloneId = -1;
CommitId = -1;
FileHistoryId = -1;
PullId = -1;
PushId = -1;
SettingsId = -1;
ViewDiffId = -1;
ResetFileChangesId = -1;
int pos = 0;
if (isSubMenu)
{
if (IsMenuItemVisible(szShellVisibleMenuItems, 0))
AddMenuItem(hMenu, "Add files", IDI_ICONADDED, firstId, ++id, AddFilesId=pos++);
if (IsMenuItemVisible(szShellVisibleMenuItems, 1))
AddMenuItem(hMenu, "Apply patch", 0, firstId, ++id, ApplyPatchId=pos++);
if (IsMenuItemVisible(szShellVisibleMenuItems, 2))
AddMenuItem(hMenu, "Browse", IDI_ICONBROWSEFILEEXPLORER, firstId, ++id, BrowseId=pos++);
if (IsMenuItemVisible(szShellVisibleMenuItems, 3))
AddMenuItem(hMenu, "Create branch", IDI_ICONBRANCHCREATE, firstId, ++id, CreateBranchId=pos++);
if (IsMenuItemVisible(szShellVisibleMenuItems, 4))
AddMenuItem(hMenu, "Checkout branch", IDI_ICONBRANCHCHECKOUT, firstId, ++id, CheckoutBranchId=pos++);
if (IsMenuItemVisible(szShellVisibleMenuItems, 5))
AddMenuItem(hMenu, "Checkout revision", IDI_ICONREVISIONCHECKOUT, firstId, ++id, CheckoutRevisionId=pos++);
if (IsMenuItemVisible(szShellVisibleMenuItems, 6))
AddMenuItem(hMenu, "Clone", IDI_ICONCLONEREPOGIT, firstId, ++id, CloneId=pos++);
if (IsMenuItemVisible(szShellVisibleMenuItems, 7))
AddMenuItem(hMenu, "Commit", IDI_ICONCOMMIT, firstId, ++id, CommitId=pos++);
if (IsMenuItemVisible(szShellVisibleMenuItems, 8))
AddMenuItem(hMenu, "File history", IDI_ICONFILEHISTORY, firstId, ++id, FileHistoryId=pos++);
if (IsMenuItemVisible(szShellVisibleMenuItems, 9))
AddMenuItem(hMenu, "Reset file changes", IDI_ICONTRESETFILETO, firstId, ++id, ResetFileChangesId=pos++);
if (IsMenuItemVisible(szShellVisibleMenuItems, 10))
AddMenuItem(hMenu, "Pull", IDI_ICONPULL, firstId, ++id, PullId=pos++);
if (IsMenuItemVisible(szShellVisibleMenuItems, 11))
AddMenuItem(hMenu, "Push", IDI_ICONPUSH, firstId, ++id, PushId=pos++);
if (IsMenuItemVisible(szShellVisibleMenuItems, 12))
AddMenuItem(hMenu, "Settings", IDI_ICONSETTINGS, firstId, ++id, SettingsId=pos++);
if (IsMenuItemVisible(szShellVisibleMenuItems, 13))
AddMenuItem(hMenu, "View diff", IDI_ICONDIFF, firstId, ++id, ViewDiffId=pos++);
}
else
{
if (IsMenuItemVisible(szShellVisibleMenuItems, 0))
AddMenuItem(hMenu, "GitEx Add files", IDI_ICONADDED, firstId, ++id, AddFilesId=pos++);
if (IsMenuItemVisible(szShellVisibleMenuItems, 1))
AddMenuItem(hMenu, "GitEx Apply patch", 0, firstId, ++id, ApplyPatchId=pos++);
if (IsMenuItemVisible(szShellVisibleMenuItems, 2))
AddMenuItem(hMenu, "GitEx Browse", IDI_ICONBROWSEFILEEXPLORER, firstId, ++id, BrowseId=pos++);
if (IsMenuItemVisible(szShellVisibleMenuItems, 3))
AddMenuItem(hMenu, "GitEx Create branch", IDI_ICONBRANCHCREATE, firstId, ++id, CreateBranchId=pos++);
if (IsMenuItemVisible(szShellVisibleMenuItems, 4))
AddMenuItem(hMenu, "GitEx Checkout branch", IDI_ICONBRANCHCHECKOUT, firstId, ++id, CheckoutBranchId=pos++);
if (IsMenuItemVisible(szShellVisibleMenuItems, 5))
AddMenuItem(hMenu, "GitEx Checkout revision", IDI_ICONREVISIONCHECKOUT, firstId, ++id, CheckoutRevisionId=pos++);
if (IsMenuItemVisible(szShellVisibleMenuItems, 6))
AddMenuItem(hMenu, "GitEx Clone", IDI_ICONCLONEREPOGIT, firstId, ++id, CloneId=pos++);
if (IsMenuItemVisible(szShellVisibleMenuItems, 7))
AddMenuItem(hMenu, "GitEx Commit", IDI_ICONCOMMIT, firstId, ++id, CommitId=pos++);
if (IsMenuItemVisible(szShellVisibleMenuItems, 8))
AddMenuItem(hMenu, "GitEx File history", IDI_ICONFILEHISTORY, firstId, ++id, FileHistoryId=pos++);
if (IsMenuItemVisible(szShellVisibleMenuItems, 9))
AddMenuItem(hMenu, "GitEx Reset file changes", IDI_ICONTRESETFILETO, firstId, ++id, ResetFileChangesId=pos++);
if (IsMenuItemVisible(szShellVisibleMenuItems, 10))
AddMenuItem(hMenu, "GitEx Pull", IDI_ICONPULL, firstId, ++id, PullId=pos++);
//.........這裏部分代碼省略.........
示例8: AddMenusForComponent
void AddMenusForComponent( wxMenu* PopMenu, SCH_COMPONENT* Component )
{
if( Component->Type() != SCH_COMPONENT_T )
{
wxASSERT( 0 );
return;
}
wxString msg;
LIB_ALIAS* libEntry;
libEntry = CMP_LIBRARY::FindLibraryEntry( Component->GetLibName() );
if( !Component->GetFlags() )
{
msg.Printf( _( "Move Component %s" ),
GetChars( Component->GetField( REFERENCE )->GetText() ) );
msg = AddHotkeyName( msg, s_Schematic_Hokeys_Descr, HK_MOVE_COMPONENT_OR_ITEM );
AddMenuItem( PopMenu, ID_SCH_MOVE_ITEM, msg, KiBitmap( move_xpm ) );
msg = AddHotkeyName( _( "Drag Component" ), s_Schematic_Hokeys_Descr, HK_DRAG );
AddMenuItem( PopMenu, ID_SCH_DRAG_ITEM, msg, KiBitmap( move_xpm ) );
}
wxMenu* orientmenu = new wxMenu;
msg = AddHotkeyName( _( "Rotate +" ), s_Schematic_Hokeys_Descr, HK_ROTATE );
AddMenuItem( orientmenu, ID_SCH_ROTATE_COUNTERCLOCKWISE, msg,
KiBitmap( rotate_ccw_xpm ) );
AddMenuItem( orientmenu, ID_SCH_ROTATE_CLOCKWISE, _( "Rotate -" ),
KiBitmap( rotate_cw_xpm ) );
msg = AddHotkeyName( _( "Mirror --" ), s_Schematic_Hokeys_Descr, HK_MIRROR_X_COMPONENT );
AddMenuItem( orientmenu, ID_SCH_MIRROR_X, msg, KiBitmap( mirror_v_xpm ) );
msg = AddHotkeyName( _( "Mirror ||" ), s_Schematic_Hokeys_Descr, HK_MIRROR_Y_COMPONENT );
AddMenuItem( orientmenu, ID_SCH_MIRROR_Y, msg, KiBitmap( mirror_h_xpm ) );
msg = AddHotkeyName( _( "Normal" ), s_Schematic_Hokeys_Descr, HK_ORIENT_NORMAL_COMPONENT );
AddMenuItem( orientmenu, ID_SCH_ORIENT_NORMAL, msg, KiBitmap( normal_xpm ) );
AddMenuItem( PopMenu, orientmenu, ID_POPUP_SCH_GENERIC_ORIENT_CMP,
_( "Orient Component" ), KiBitmap( orient_xpm ) );
AddMenusForEditComponent( PopMenu, Component );
if( !Component->GetFlags() )
{
msg = AddHotkeyName( _( "Copy Component" ), s_Schematic_Hokeys_Descr,
HK_COPY_COMPONENT_OR_LABEL );
AddMenuItem( PopMenu, ID_POPUP_SCH_COPY_ITEM, msg, KiBitmap( copy_button_xpm ) );
msg = AddHotkeyName( _( "Delete Component" ), s_Schematic_Hokeys_Descr, HK_DELETE );
AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE_CMP, msg, KiBitmap( delete_xpm ) );
}
if( libEntry && !libEntry->GetDocFileName().IsEmpty() )
AddMenuItem( PopMenu, ID_POPUP_SCH_DISPLAYDOC_CMP, _( "Doc" ), KiBitmap( datasheet_xpm ) );
}
示例9: prepareToolsMenu
void prepareToolsMenu( wxMenu* aParentMenu )
{
wxString text;
text = AddHotkeyName( _( "Update PCB from Schematic..." ), g_Schematic_Hotkeys_Descr,
HK_UPDATE_PCB_FROM_SCH );
AddMenuItem( aParentMenu,
ID_UPDATE_PCB_FROM_SCH,
text, _( "Update PCB design with current schematic." ),
KiBitmap( update_pcb_from_sch_xpm ) );
// Run Pcbnew
AddMenuItem( aParentMenu, ID_RUN_PCB, _( "&Open PCB Editor" ),
_( "Run Pcbnew" ),
KiBitmap( pcbnew_xpm ) );
aParentMenu->AppendSeparator();
AddMenuItem( aParentMenu, ID_RUN_LIBRARY, _( "Symbol Library &Editor" ),
HELP_RUN_LIB_EDITOR,
KiBitmap( libedit_xpm ) );
AddMenuItem( aParentMenu, ID_RESCUE_CACHED, _( "&Rescue Symbols..." ),
_( "Find old symbols in project and rename/rescue them" ),
KiBitmap( rescue_xpm ) );
AddMenuItem( aParentMenu, ID_REMAP_SYMBOLS, _( "Remap S&ymbols..." ),
_( "Remap legacy library symbols to symbol library table" ),
KiBitmap( rescue_xpm ) );
aParentMenu->AppendSeparator();
AddMenuItem( aParentMenu, ID_OPEN_CMP_TABLE, _( "Edit Symbol Field&s..." ),
KiBitmap( spreadsheet_xpm ) );
AddMenuItem( aParentMenu, ID_EDIT_COMPONENTS_TO_SYMBOLS_LIB_ID,
_( "Edit Symbol &Library References..." ),
_( "Edit links between schematic symbols and library symbols" ),
KiBitmap( edit_cmp_symb_links_xpm ) );
aParentMenu->AppendSeparator();
AddMenuItem( aParentMenu, ID_GET_ANNOTATE, _( "&Annotate Schematic..." ),
HELP_ANNOTATE,
KiBitmap( annotate_xpm ) );
AddMenuItem( aParentMenu, ID_BUS_MANAGER, _( "Bus &Definitions..." ),
HELP_BUS_MANAGER,
KiBitmap( bus_definition_tool_xpm ) );
aParentMenu->AppendSeparator();
// Run CvPcb
AddMenuItem( aParentMenu, ID_RUN_CVPCB, _( "A&ssign Footprints..." ),
_( "Assign PCB footprints to schematic symbols" ),
KiBitmap( cvpcb_xpm ) );
AddMenuItem( aParentMenu, ID_GET_TOOLS, _( "Generate Bill of &Materials..." ),
HELP_GENERATE_BOM,
KiBitmap( bom_xpm ) );
aParentMenu->AppendSeparator();
#ifdef KICAD_SPICE
// Simulator
AddMenuItem( aParentMenu, ID_SIM_SHOW, _("Simula&tor"),
_( "Simulate circuit" ),
KiBitmap( simulator_xpm ) );
#endif /* KICAD_SPICE */
}
示例10: GetMenuBar
//.........這裏部分代碼省略.........
// Units submenu
CONDITIONAL_MENU* unitsSubMenu = new CONDITIONAL_MENU( false, selTool );
unitsSubMenu->SetTitle( _( "&Units" ) );
unitsSubMenu->SetIcon( unit_mm_xpm );
unitsSubMenu->AddCheckItem( ACTIONS::imperialUnits, imperialUnitsCondition );
unitsSubMenu->AddCheckItem( ACTIONS::metricUnits, metricUnitsCondition );
viewMenu->AddMenu( unitsSubMenu );
viewMenu->AddCheckItem( ACTIONS::toggleCursorStyle, fullCrosshairCondition );
viewMenu->AddSeparator();
viewMenu->AddCheckItem( EE_ACTIONS::toggleHiddenPins, hiddenPinsCondition );
#ifdef __APPLE__
viewMenu->AppendSeparator();
#endif
//-- Place menu -----------------------------------------------------------
//
CONDITIONAL_MENU* placeMenu = new CONDITIONAL_MENU( false, selTool );
placeMenu->AddItem( EE_ACTIONS::placeSymbol, EE_CONDITIONS::ShowAlways );
placeMenu->AddItem( EE_ACTIONS::placePower, EE_CONDITIONS::ShowAlways );
placeMenu->AddItem( EE_ACTIONS::drawWire, EE_CONDITIONS::ShowAlways );
placeMenu->AddItem( EE_ACTIONS::drawBus, EE_CONDITIONS::ShowAlways );
placeMenu->AddItem( EE_ACTIONS::placeBusWireEntry, EE_CONDITIONS::ShowAlways );
placeMenu->AddItem( EE_ACTIONS::placeBusBusEntry, EE_CONDITIONS::ShowAlways );
placeMenu->AddItem( EE_ACTIONS::placeNoConnect, EE_CONDITIONS::ShowAlways );
placeMenu->AddItem( EE_ACTIONS::placeJunction, EE_CONDITIONS::ShowAlways );
placeMenu->AddItem( EE_ACTIONS::placeLabel, EE_CONDITIONS::ShowAlways );
placeMenu->AddItem( EE_ACTIONS::placeGlobalLabel, EE_CONDITIONS::ShowAlways );
placeMenu->AddSeparator();
placeMenu->AddItem( EE_ACTIONS::placeHierarchicalLabel, EE_CONDITIONS::ShowAlways );
placeMenu->AddItem( EE_ACTIONS::drawSheet, EE_CONDITIONS::ShowAlways );
placeMenu->AddItem( EE_ACTIONS::importSheetPin, EE_CONDITIONS::ShowAlways );
placeMenu->AddItem( EE_ACTIONS::placeSheetPin, EE_CONDITIONS::ShowAlways );
placeMenu->AddSeparator();
placeMenu->AddItem( EE_ACTIONS::drawLines, EE_CONDITIONS::ShowAlways );
placeMenu->AddItem( EE_ACTIONS::placeSchematicText, EE_CONDITIONS::ShowAlways );
placeMenu->AddItem( EE_ACTIONS::placeImage, EE_CONDITIONS::ShowAlways );
//-- Inspect menu -----------------------------------------------
//
wxMenu* inspectMenu = new wxMenu;
AddMenuItem( inspectMenu, ID_GET_ERC, _( "Electrical Rules &Checker" ),
_( "Perform electrical rules check" ), KiBitmap( erc_xpm ) );
//-- Tools menu -----------------------------------------------
//
wxMenu* toolsMenu = new wxMenu;
prepareToolsMenu( toolsMenu );
//-- Preferences menu -----------------------------------------------
//
CONDITIONAL_MENU* prefsMenu = new CONDITIONAL_MENU( false, selTool );
auto acceleratedGraphicsCondition = [ this ] ( const SELECTION& aSel ) {
return GetGalCanvas()->GetBackend() == EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL;
};
auto standardGraphicsCondition = [ this ] ( const SELECTION& aSel ) {
return GetGalCanvas()->GetBackend() == EDA_DRAW_PANEL_GAL::GAL_TYPE_CAIRO;
};
prefsMenu->AddItem( ID_PREFERENCES_CONFIGURE_PATHS, _( "Configure Pa&ths..." ),
_( "Edit path configuration environment variables" ),
path_xpm, EE_CONDITIONS::ShowAlways );
prefsMenu->AddItem( ID_EDIT_SYM_LIB_TABLE, _( "Manage Symbol Libraries..." ),
_( "Edit the global and project symbol library lists" ),
library_table_xpm, EE_CONDITIONS::ShowAlways );
prefsMenu->AddItem( wxID_PREFERENCES,
AddHotkeyName( _( "&Preferences..." ), g_Eeschema_Hotkeys_Descr, HK_PREFERENCES ),
_( "Show preferences for all open tools" ),
preference_xpm, EE_CONDITIONS::ShowAlways );
prefsMenu->AddSeparator();
Pgm().AddMenuLanguageList( prefsMenu );
prefsMenu->AddSeparator();
prefsMenu->AddCheckItem( ACTIONS::acceleratedGraphics, acceleratedGraphicsCondition );
prefsMenu->AddCheckItem( ACTIONS::standardGraphics, standardGraphicsCondition );
//-- Menubar -----------------------------------------------
//
menuBar->Append( fileMenu, _( "&File" ) );
menuBar->Append( editMenu, _( "&Edit" ) );
menuBar->Append( viewMenu, _( "&View" ) );
menuBar->Append( placeMenu, _( "&Place" ) );
menuBar->Append( inspectMenu, _( "&Inspect" ) );
menuBar->Append( toolsMenu, _( "&Tools" ) );
menuBar->Append( prefsMenu, _( "P&references" ) );
AddStandardHelpMenu( menuBar );
SetMenuBar( menuBar );
delete oldMenuBar;
}
示例11: GetCurItem
BOARD_ITEM* FOOTPRINT_EDIT_FRAME::ModeditLocateAndDisplay( int aHotKeyCode )
{
BOARD_ITEM* item = GetCurItem();
if( GetBoard()->m_Modules == NULL )
return NULL;
GENERAL_COLLECTORS_GUIDE guide = GetCollectorsGuide();
// Assign to scanList the proper item types desired based on tool type
// or hotkey that is in play.
const KICAD_T* scanList = NULL;
if( aHotKeyCode )
{
// @todo: add switch here and add calls to PcbGeneralLocateAndDisplay(
// int aHotKeyCode ) when searching is needed from a hotkey handler
}
else
{
scanList = GENERAL_COLLECTOR::ModulesAndTheirItems;
}
m_Collector->Collect( GetBoard(), scanList, RefPos( true ), guide );
// Remove redundancies: when an item is found, we can remove the module from list
if( m_Collector->GetCount() > 1 )
{
for( int ii = 0; ii < m_Collector->GetCount(); ii++ )
{
item = (*m_Collector)[ii];
if( item->Type() != PCB_MODULE_T )
continue;
m_Collector->Remove( ii );
ii--;
}
}
if( m_Collector->GetCount() <= 1 )
{
item = (*m_Collector)[0];
SetCurItem( item );
}
else // we can't figure out which item user wants, do popup menu so user can choose
{
wxMenu itemMenu;
// Give a title to the selection menu. It also allow to close the popup menu without any action
wxMenuItem* item_title = new wxMenuItem( &itemMenu, wxID_NONE, _( "Selection Clarification" ) );
#ifdef __WINDOWS__
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.AppendSeparator();
int limit = std::min( MAX_ITEMS_IN_PICKER, m_Collector->GetCount() );
for( int ii = 0; ii<limit; ++ii )
{
item = (*m_Collector)[ii];
wxString text = item->GetSelectMenuText();
BITMAP_DEF xpm = item->GetMenuImage();
AddMenuItem( &itemMenu,
ID_POPUP_PCB_ITEM_SELECTION_START + ii,
text,
KiBitmap( xpm ) );
}
// this menu's handler is void
// PCB_BASE_FRAME::ProcessItemSelection()
// and it calls SetCurItem() which in turn calls DisplayInfo() on the
// item.
m_canvas->SetAbortRequest( true ); // changed in false if an item
PopupMenu( &itemMenu ); // m_AbortRequest = false if an item is selected
m_canvas->MoveCursorToCrossHair();
m_canvas->SetIgnoreMouseEvents( false );
// The function ProcessItemSelection() has set the current item, return it.
item = GetCurItem();
}
if( item )
{
SetMsgPanel( item );
}
return item;
}
示例12: GetMenuBar
/**
* @brief (Re)Create the menubar for the component editor frame
*/
void LIB_EDIT_FRAME::ReCreateMenuBar()
{
// Create and try to get the current menubar
wxString text;
wxMenuBar* menuBar = GetMenuBar();
if( !menuBar )
menuBar = new wxMenuBar();
// 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 );
// Recreate all menus:
// Menu File:
wxMenu* fileMenu = new wxMenu;
// Select current library
AddMenuItem( fileMenu,
ID_LIBEDIT_SELECT_CURRENT_LIB,
_( "&Current Library" ),
_( "Select working library" ),
KiBitmap( library_xpm ) );
fileMenu->AppendSeparator();
// Save current library
AddMenuItem( fileMenu,
ID_LIBEDIT_SAVE_CURRENT_LIB,
_( "&Save Current Library\tCtrl+S" ),
_( "Save the current active library" ),
KiBitmap( save_xpm ) );
// Save current library as...
AddMenuItem( fileMenu,
ID_LIBEDIT_SAVE_CURRENT_LIB_AS,
_( "Save Current Library &As" ),
_( "Save current active library as..." ),
KiBitmap( save_as_xpm ) );
// Separator
fileMenu->AppendSeparator();
// Export as png file
AddMenuItem( fileMenu,
ID_LIBEDIT_GEN_PNG_FILE,
_( "Create &PNG File from Screen" ),
_( "Create a PNG file from the component displayed on screen" ),
KiBitmap( plot_xpm ) );
// Export as SVG file
AddMenuItem( fileMenu,
ID_LIBEDIT_GEN_SVG_FILE,
_( "Create S&VG File" ),
_( "Create a SVG file from the current loaded component" ),
KiBitmap( plot_svg_xpm ) );
// Separator
fileMenu->AppendSeparator();
// Quit
AddMenuItem( fileMenu,
wxID_EXIT,
_( "&Quit" ),
_( "Quit Library Editor" ),
KiBitmap( exit_xpm ) );
// Edit menu
wxMenu* editMenu = new wxMenu;
// Undo
text = AddHotkeyName( _( "&Undo" ), s_Libedit_Hokeys_Descr, HK_UNDO );
AddMenuItem( editMenu,
wxID_UNDO,
text,
_( "Undo last edit" ),
KiBitmap( undo_xpm ) );
// Redo
text = AddHotkeyName( _( "&Redo" ), s_Libedit_Hokeys_Descr, HK_REDO );
AddMenuItem( editMenu,
wxID_REDO,
text,
_( "Redo the last undo command" ),
KiBitmap( redo_xpm ) );
// Separator
editMenu->AppendSeparator();
// Delete
AddMenuItem( editMenu,
ID_LIBEDIT_DELETE_ITEM_BUTT,
_( "&Delete" ),
//.........這裏部分代碼省略.........
示例13: GetScreen
/* Prepare the right-click pullup menu.
* The menu already has a list of zoom commands.
*/
bool GERBVIEW_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* aPopMenu )
{
GERBER_DRAW_ITEM* currItem = (GERBER_DRAW_ITEM*) GetScreen()->GetCurItem();
wxString msg;
bool BlockActive = !GetScreen()->m_BlockLocate.IsIdle();
bool busy = currItem && currItem->GetFlags();
// Do not initiate a start block validation on menu.
m_canvas->SetCanStartBlock( -1 );
// Simple location of elements where possible.
if( !busy )
{
currItem = Locate( aPosition, CURSEUR_OFF_GRILLE );
busy = currItem && currItem->GetFlags();
}
// If command in progress, end command.
if( GetToolId() != ID_NO_TOOL_SELECTED )
{
if( busy )
AddMenuItem( aPopMenu, ID_POPUP_CANCEL_CURRENT_COMMAND,
_( "Cancel" ), KiBitmap( cancel_xpm ) );
else
AddMenuItem( aPopMenu, ID_POPUP_CLOSE_CURRENT_TOOL,
_( "End Tool" ), KiBitmap( cursor_xpm ) );
aPopMenu->AppendSeparator();
}
else
{
if( busy || BlockActive )
{
if( BlockActive )
{
AddMenuItem( aPopMenu, ID_POPUP_CANCEL_CURRENT_COMMAND,
_( "Cancel Block" ), KiBitmap( cancel_xpm ) );
aPopMenu->AppendSeparator();
AddMenuItem( aPopMenu, ID_POPUP_PLACE_BLOCK,
_( "Place Block" ), KiBitmap( checked_ok_xpm ) );
}
else
{
AddMenuItem( aPopMenu, ID_POPUP_CANCEL_CURRENT_COMMAND,
_( "Cancel" ), KiBitmap( cancel_xpm ) );
}
aPopMenu->AppendSeparator();
}
}
if( BlockActive )
return true;
if( currItem )
{
GetScreen()->SetCurItem( currItem );
bool add_separator = false;
// Now, display a context menu
// to allow highlighting items which share the same attributes
// as the selected item (net attributes and aperture attributes)
const GBR_NETLIST_METADATA& net_attr = currItem->GetNetAttributes();
if( ( net_attr.m_NetAttribType & GBR_NETLIST_METADATA::GBR_NETINFO_PAD ) ||
( net_attr.m_NetAttribType & GBR_NETLIST_METADATA::GBR_NETINFO_CMP ) )
{
AddMenuItem( aPopMenu, ID_HIGHLIGHT_CMP_ITEMS,
wxString::Format( _( "Highlight items of component \"%s\"" ),
GetChars( net_attr.m_Cmpref ) ),
KiBitmap( file_footprint_xpm ) );
add_separator = true;
}
if( ( net_attr.m_NetAttribType & GBR_NETLIST_METADATA::GBR_NETINFO_NET ) )
{
AddMenuItem( aPopMenu, ID_HIGHLIGHT_NET_ITEMS,
wxString::Format( _( "Highlight items of net \"%s\"" ),
GetChars( net_attr.m_Netname ) ),
KiBitmap( general_ratsnest_xpm ) );
add_separator = true;
}
D_CODE* apertDescr = currItem->GetDcodeDescr();
if( apertDescr && !apertDescr->m_AperFunction.IsEmpty() )
{
AddMenuItem( aPopMenu, ID_HIGHLIGHT_APER_ATTRIBUTE_ITEMS,
wxString::Format( _( "Highlight aperture type \"%s\"" ),
GetChars( apertDescr->m_AperFunction ) ),
KiBitmap( flag_xpm ) );
add_separator = true;
}
if( add_separator )
aPopMenu->AppendSeparator();
}
//.........這裏部分代碼省略.........
示例14: GetColumnCount
void ColumnManager::OnContextMenuHeader(CWnd* pWnd, CPoint point, bool isGroundEnable /* = false*/)
{
CHeaderCtrl* pHeaderCtrl = (CHeaderCtrl*)pWnd;
if ((point.x == -1) && (point.y == -1))
{
CRect rect;
pHeaderCtrl->GetItemRect(0, &rect);
pHeaderCtrl->ClientToScreen(&rect);
point = rect.CenterPoint();
}
CMenu popup;
if (popup.CreatePopupMenu())
{
int columnCount = GetColumnCount();
CString temp;
UINT uCheckedFlags = MF_STRING | MF_ENABLED | MF_CHECKED;
UINT uUnCheckedFlags = MF_STRING | MF_ENABLED;
// build control menu
//temp.LoadString(IDS_STATUSLIST_SHOWGROUPS);
//popup.AppendMenu(isGroundEnable? uCheckedFlags : uUnCheckedFlags, columnCount, temp);
temp.LoadString(IDS_STATUSLIST_RESETCOLUMNORDER);
popup.AppendMenu(uUnCheckedFlags, columnCount + 2, temp);
popup.AppendMenu(MF_SEPARATOR);
// standard columns
AddMenuItem(&popup);
// user-prop columns:
// find relevant ones and sort 'em
std::map<CString, int> sortedProps;
for (int i = (int)itemName.size(); i < columnCount; ++i)
if (IsRelevant(i))
sortedProps[GetName(i)] = i;
if (!sortedProps.empty())
{
// add 'em to the menu
popup.AppendMenu(MF_SEPARATOR);
for (auto iter = sortedProps.cbegin(), end = sortedProps.cend(); iter != end; ++iter)
{
popup.AppendMenu(IsVisible(iter->second)
? uCheckedFlags
: uUnCheckedFlags
, iter->second
, iter->first);
}
}
// show menu & let user pick an entry
int cmd = popup.TrackPopupMenu(TPM_RETURNCMD | TPM_LEFTALIGN | TPM_NONOTIFY, point.x, point.y, pWnd);
if ((cmd >= 1) && (cmd < columnCount))
SetVisible(cmd, !IsVisible(cmd));
else if (cmd == columnCount)
{
pWnd->GetParent()->SendMessage(LVM_ENABLEGROUPVIEW, !isGroundEnable, NULL);
//EnableGroupView(!isGroundEnable);
}
else if (cmd == columnCount + 1)
RemoveUnusedProps();
else if (cmd == columnCount + 2)
{
temp.LoadString(IDS_CONFIRMRESETCOLUMNORDER);
if (MessageBox(pWnd->m_hWnd, temp, L"TortoiseGit", MB_YESNO | MB_ICONQUESTION) == IDYES)
ResetColumns(m_dwDefaultColumns);
}
}
}
示例15: AddMenusForEditComponent
void AddMenusForEditComponent( wxMenu* PopMenu, SCH_COMPONENT* Component )
{
if( Component->Type() != SCH_COMPONENT_T )
{
wxASSERT( 0 );
return;
}
wxString msg;
LIB_ALIAS* libEntry;
LIB_COMPONENT* libComponent = NULL;
libEntry = CMP_LIBRARY::FindLibraryEntry( Component->GetLibName() );
if( libEntry )
libComponent = libEntry->GetComponent();
wxMenu* editmenu = new wxMenu;
msg = AddHotkeyName( _( "Edit" ), s_Schematic_Hokeys_Descr, HK_EDIT );
AddMenuItem( editmenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( edit_component_xpm ) );
if( libComponent && libComponent->IsNormal() )
{
msg = AddHotkeyName( _( "Value" ), s_Schematic_Hokeys_Descr,
HK_EDIT_COMPONENT_VALUE );
AddMenuItem( editmenu, ID_SCH_EDIT_COMPONENT_VALUE, msg,
KiBitmap( edit_comp_value_xpm ) );
msg = AddHotkeyName( _( "Reference" ), s_Schematic_Hokeys_Descr,
HK_EDIT_COMPONENT_REFERENCE );
AddMenuItem( editmenu, ID_SCH_EDIT_COMPONENT_REFERENCE, msg,
KiBitmap( edit_comp_ref_xpm ) );
msg = AddHotkeyName( _( "Footprint" ), s_Schematic_Hokeys_Descr,
HK_EDIT_COMPONENT_FOOTPRINT );
AddMenuItem( editmenu, ID_SCH_EDIT_COMPONENT_FOOTPRINT, msg,
KiBitmap( edit_comp_footprint_xpm ) );
}
if( libComponent && libComponent->HasConversion() )
AddMenuItem( editmenu, ID_POPUP_SCH_EDIT_CONVERT_CMP, _( "Convert" ),
KiBitmap( component_select_alternate_shape_xpm ) );
if( libComponent && ( libComponent->GetPartCount() >= 2 ) )
{
wxMenu* sel_unit_menu = new wxMenu; int ii;
for( ii = 0; ii < libComponent->GetPartCount(); ii++ )
{
wxString num_unit;
int unit = Component->GetUnit();
num_unit.Printf( _( "Unit %d %c" ), ii + 1,
"?ABCDEFGHIJKLMNOPQRSTUVWXYZ"[ ii + 1 ] );
wxMenuItem * item = sel_unit_menu->Append( ID_POPUP_SCH_SELECT_UNIT1 + ii,
num_unit, wxEmptyString,
wxITEM_CHECK );
if( unit == ii + 1 )
item->Check(true);
}
AddMenuItem( editmenu, sel_unit_menu, ID_POPUP_SCH_SELECT_UNIT_CMP,
_( "Unit" ), KiBitmap( component_select_unit_xpm ) );
}
if( !Component->GetFlags() )
{
AddMenuItem( editmenu, ID_POPUP_SCH_CALL_LIBEDIT_AND_LOAD_CMP,
_( "Edit with Library Editor" ),
KiBitmap( libedit_xpm ) );
}
AddMenuItem( PopMenu, editmenu, ID_SCH_EDIT_ITEM,
_( "Edit Component" ), KiBitmap( edit_component_xpm ) );
}