コード例 #1
0
void PL_EDITOR_FRAME::OnTreeRightClick( wxTreeEvent& event )
{
    m_treePagelayout->SelectCell( event.GetItem() );

    wxMenu popMenu;
    AddNewItemsCommand( &popMenu );

    popMenu.AppendSeparator();
    AddMenuItem( &popMenu, ID_POPUP_DESIGN_TREE_ITEM_DELETE, _( "Delete" ),
                 KiBitmap( delete_xpm ) );

    PopupMenu( &popMenu );
}
コード例 #2
0
/* Prepare the right-click pullup menu.
 * The menu already has a list of zoom commands.
 */
bool PL_EDITOR_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* aPopMenu )
{
    bool busy = GetScreen()->GetCurItem() != NULL;
    wxString msg;

    if( ! busy )     // No item currently edited
    {
        WORKSHEET_DATAITEM* old_item = m_treePagelayout->GetPageLayoutSelectedItem();
        WORKSHEET_DATAITEM* item = Locate( aPosition );

        if( item && old_item != item )
        {
            m_treePagelayout->SelectCell( item );
            m_canvas->Refresh();
        }

        // Add menus to edit and delete the item
        if( item )
        {
            if( (item->GetFlags() & LOCATE_STARTPOINT) )
            {
                msg = AddHotkeyName( _( "Move Start Point" ), PlEditorHokeysDescr,
                                     HK_MOVE_START_POINT );
                AddMenuItem( aPopMenu, ID_POPUP_ITEM_MOVE_START_POINT, msg,
                             KiBitmap( move_xpm ) );
            }

            if( (item->GetFlags() & LOCATE_ENDPOINT ) )
            {
                msg = AddHotkeyName( _( "Move End Point" ), PlEditorHokeysDescr,
                                     HK_MOVE_END_POINT );
                AddMenuItem( aPopMenu, ID_POPUP_ITEM_MOVE_END_POINT, msg,
                             KiBitmap( move_xpm ) );
            }

            msg = AddHotkeyName( _( "Move Item" ), PlEditorHokeysDescr,
                                 HK_MOVE_ITEM );
            AddMenuItem( aPopMenu, ID_POPUP_ITEM_MOVE, msg,
                         KiBitmap( move_xpm ) );
            aPopMenu->AppendSeparator();

            msg = AddHotkeyName( _( "Delete" ), PlEditorHokeysDescr,
                                 HK_DELETE_ITEM );
            AddMenuItem( aPopMenu, ID_POPUP_ITEM_DELETE, msg, KiBitmap( delete_xpm ) );
            aPopMenu->AppendSeparator();
        }
    }
    else     // An item is currently in edit
    {
        msg = AddHotkeyName( _( "Place Item" ), PlEditorHokeysDescr,
                                 HK_PLACE_ITEM );
        AddMenuItem( aPopMenu, ID_POPUP_ITEM_PLACE, msg,
                     KiBitmap( move_xpm ) );
        AddMenuItem( aPopMenu, ID_POPUP_ITEM_PLACE_CANCEL, _( "Cancel" ),
                     KiBitmap( cancel_xpm ) );
        aPopMenu->AppendSeparator();
    }

    if( ! busy )
    {
        AddNewItemsCommand( aPopMenu );
        aPopMenu->AppendSeparator();
    }

    return true;
}