pcbnew: prompt for reference point in the message panel, add cut/copy/paste entries in the Edit menu
This commit is contained in:
parent
5731000135
commit
adcda4a3e8
|
@ -110,7 +110,10 @@ enum hotkey_id_commnand {
|
|||
HK_CUSTOM_TRACK_WIDTH,
|
||||
HK_DP_DIMENSIONS,
|
||||
HK_VIA_SIZE_INC,
|
||||
HK_VIA_SIZE_DEC
|
||||
HK_VIA_SIZE_DEC,
|
||||
HK_EDIT_CUT,
|
||||
HK_EDIT_PASTE,
|
||||
HK_EDIT_COPY
|
||||
};
|
||||
|
||||
// Full list of hotkey descriptors for board editor and footprint editor
|
||||
|
|
|
@ -174,6 +174,20 @@ void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar()
|
|||
// Separator
|
||||
editMenu->AppendSeparator();
|
||||
|
||||
if( IsGalCanvasActive() )
|
||||
{
|
||||
text = AddHotkeyName( _( "&Cut" ), g_Module_Viewer_Hokeys_Descr, HK_EDIT_CUT );
|
||||
AddMenuItem( editMenu, ID_EDIT_CUT, text, _(
|
||||
"Cuts the selected item(s) to the Clipboard" ), KiBitmap( cut_xpm ) );
|
||||
text = AddHotkeyName( _( "&Copy" ), g_Module_Viewer_Hokeys_Descr, HK_EDIT_COPY );
|
||||
AddMenuItem( editMenu, ID_EDIT_COPY, text, _(
|
||||
"Copies the selected item(s) to the Clipboard" ), KiBitmap( copy_xpm ) );
|
||||
text = AddHotkeyName( _( "&Paste" ), g_Module_Viewer_Hokeys_Descr, HK_EDIT_PASTE );
|
||||
AddMenuItem( editMenu, ID_EDIT_PASTE, text, _(
|
||||
"Pastes item(s) from the Clipboard" ), KiBitmap( paste_xpm ) );
|
||||
editMenu->AppendSeparator();
|
||||
}
|
||||
|
||||
// Properties
|
||||
AddMenuItem( editMenu, ID_MODEDIT_EDIT_MODULE_PROPERTIES,
|
||||
_( "Footprint &Properties" ),
|
||||
|
|
|
@ -59,7 +59,7 @@ static void prepareToolsMenu( wxMenu* aParentMenu );
|
|||
static void prepareHelpMenu( wxMenu* aParentMenu );
|
||||
|
||||
// Build the edit menu
|
||||
static void prepareEditMenu( wxMenu* aParentMenu );
|
||||
static void prepareEditMenu( wxMenu* aParentMenu, bool aUseGal );
|
||||
|
||||
// Build the route menu
|
||||
static void prepareRouteMenu( wxMenu* aParentMenu );
|
||||
|
@ -103,7 +103,7 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
|
|||
|
||||
//----- Edit menu -----------------------------------------------------------
|
||||
wxMenu* editMenu = new wxMenu;
|
||||
prepareEditMenu( editMenu );
|
||||
prepareEditMenu( editMenu, IsGalCanvasActive() );
|
||||
|
||||
//----- View menu -----------------------------------------------------------
|
||||
wxMenu* viewMenu = new wxMenu;
|
||||
|
@ -455,7 +455,7 @@ void prepareHelpMenu( wxMenu* aParentMenu )
|
|||
|
||||
|
||||
// Build the edit menu
|
||||
void prepareEditMenu( wxMenu* aParentMenu )
|
||||
void prepareEditMenu( wxMenu* aParentMenu, bool aUseGal )
|
||||
{
|
||||
wxString text;
|
||||
|
||||
|
@ -469,12 +469,25 @@ void prepareEditMenu( wxMenu* aParentMenu )
|
|||
_( "&Delete" ), _( "Delete items" ),
|
||||
KiBitmap( delete_xpm ) );
|
||||
|
||||
aParentMenu->AppendSeparator();
|
||||
|
||||
text = AddHotkeyName( _( "&Find" ), g_Pcbnew_Editor_Hokeys_Descr, HK_FIND_ITEM );
|
||||
AddMenuItem( aParentMenu, ID_FIND_ITEMS, text, HELP_FIND , KiBitmap( find_xpm ) );
|
||||
|
||||
aParentMenu->AppendSeparator();
|
||||
|
||||
if( aUseGal )
|
||||
{
|
||||
text = AddHotkeyName( _( "&Cut" ), g_Pcbnew_Editor_Hokeys_Descr, HK_EDIT_CUT );
|
||||
AddMenuItem( aParentMenu, ID_EDIT_CUT, text, _(
|
||||
"Cuts the selected item(s) to the Clipboard" ), KiBitmap( cut_xpm ) );
|
||||
text = AddHotkeyName( _( "&Copy" ), g_Pcbnew_Editor_Hokeys_Descr, HK_EDIT_COPY );
|
||||
AddMenuItem( aParentMenu, ID_EDIT_COPY, text, _(
|
||||
"Copies the selected item(s) to the Clipboard" ), KiBitmap( copy_xpm ) );
|
||||
text = AddHotkeyName( _( "&Paste" ), g_Pcbnew_Editor_Hokeys_Descr, HK_EDIT_PASTE );
|
||||
AddMenuItem( aParentMenu, ID_EDIT_PASTE, text, _(
|
||||
"Pastes item(s) from the Clipboard" ), KiBitmap( paste_xpm ) );
|
||||
aParentMenu->AppendSeparator();
|
||||
}
|
||||
|
||||
AddMenuItem( aParentMenu, ID_PCB_EDIT_ALL_VIAS_AND_TRACK_SIZE,
|
||||
_( "Edit All Tracks and Vias" ), KiBitmap( width_track_via_xpm ) );
|
||||
|
||||
|
@ -513,7 +526,7 @@ void prepareViewMenu( wxMenu* aParentMenu )
|
|||
* From hotkeys, zooming is made around the mouse cursor position
|
||||
* (obviously not possible from the toolbar or menubar command)
|
||||
*
|
||||
* in other words HK_ZOOM_IN and HK_ZOOM_OUT *are NOT* accelerators
|
||||
* in other words HK_ZOOM_IN and HK_ZOOM_OUT *are NOT* accelerator
|
||||
* for Zoom in and Zoom out sub menus
|
||||
*/
|
||||
text = AddHotkeyName( _( "Zoom &In" ), g_Pcbnew_Editor_Hokeys_Descr,
|
||||
|
|
|
@ -1011,4 +1011,6 @@ void FOOTPRINT_EDIT_FRAME::UseGalCanvas( bool aEnable )
|
|||
GetGalCanvas()->GetGAL()->SetAxesEnabled( true );
|
||||
updateView();
|
||||
}
|
||||
|
||||
ReCreateMenuBar();
|
||||
}
|
||||
|
|
|
@ -754,6 +754,8 @@ void PCB_EDIT_FRAME::enableGALSpecificMenus()
|
|||
// some menus are active only in GAL mode and do nothing in legacy mode.
|
||||
// So enable or disable them, depending on the display mode
|
||||
|
||||
ReCreateMenuBar();
|
||||
|
||||
if( GetMenuBar() )
|
||||
{
|
||||
// Enable / disable some menus which are usable only on GAL
|
||||
|
@ -775,6 +777,7 @@ void PCB_EDIT_FRAME::enableGALSpecificMenus()
|
|||
if( GetMenuBar()->FindItem( id_list[ii] ) )
|
||||
GetMenuBar()->FindItem( id_list[ii] )->Enable( enbl );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -403,6 +403,9 @@ enum pcbnew_ids
|
|||
ID_FOOTPRINT_WIZARD_EXPORT_TO_BOARD,
|
||||
|
||||
ID_UPDATE_PCB_FROM_SCH,
|
||||
ID_EDIT_CUT,
|
||||
ID_EDIT_COPY,
|
||||
ID_EDIT_PASTE,
|
||||
ID_PCBNEW_END_LIST
|
||||
};
|
||||
|
||||
|
|
|
@ -1316,18 +1316,27 @@ bool EDIT_TOOL::pickCopyReferencePoint( VECTOR2I& aP )
|
|||
int EDIT_TOOL::copyToClipboard( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
CLIPBOARD_IO io;
|
||||
BOARD* board = getModel<BOARD>();
|
||||
VECTOR2I refPoint;
|
||||
|
||||
Activate();
|
||||
|
||||
auto item1 = MSG_PANEL_ITEM( _(""), _("Select reference point for the block being copied..."), COLOR4D::BLACK );
|
||||
std::vector<MSG_PANEL_ITEM> msgItems = { item1 };
|
||||
|
||||
SELECTION selection = m_selectionTool->RequestSelection();
|
||||
|
||||
if( !pickCopyReferencePoint( refPoint ) )
|
||||
if( selection.Empty() )
|
||||
return 0;
|
||||
|
||||
frame()->SetMsgPanel( msgItems );
|
||||
bool rv = pickCopyReferencePoint( refPoint );
|
||||
frame()->SetMsgPanel( board() );
|
||||
|
||||
if( !rv )
|
||||
return 0;
|
||||
|
||||
selection.SetReferencePoint( refPoint );
|
||||
io.SetBoard( board );
|
||||
io.SetBoard( board() );
|
||||
io.SaveSelection( selection );
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -184,6 +184,15 @@ boost::optional<TOOL_EVENT> PCB_ACTIONS::TranslateLegacyId( int aId )
|
|||
|
||||
case ID_PCB_MUWAVE_TOOL_SELF_CMD:
|
||||
return PCB_ACTIONS::microwaveCreateLine.MakeEvent();
|
||||
|
||||
case ID_EDIT_CUT:
|
||||
return PCB_ACTIONS::cutToClipboard.MakeEvent();
|
||||
|
||||
case ID_EDIT_COPY:
|
||||
return PCB_ACTIONS::copyToClipboard.MakeEvent();
|
||||
|
||||
case ID_EDIT_PASTE:
|
||||
return PCB_ACTIONS::pasteFromClipboard.MakeEvent();
|
||||
}
|
||||
|
||||
return boost::optional<TOOL_EVENT>();
|
||||
|
|
Loading…
Reference in New Issue