コード例 #1
0
ファイル: eda_3d_viewer.cpp プロジェクト: cpavlina/kicad
void EDA_3D_VIEWER::OnUpdateMenus(wxUpdateUIEvent &event)
{
    //!TODO: verify how many times this event is called and check if that is OK
    // to have it working this way
    SetMenuBarOptionsState();
}
コード例 #2
0
ファイル: eda_3d_viewer.cpp プロジェクト: cpavlina/kicad
void EDA_3D_VIEWER::Process_Special_Functions( wxCommandEvent &event )
{
    int     id = event.GetId();
    bool    isChecked = event.IsChecked();

    wxLogTrace( m_logTrace,
                wxT( "EDA_3D_VIEWER::Process_Special_Functions id:%d isChecked:%d" ),
                id, isChecked );

    if( m_canvas == NULL )
        return;

    switch( id )
    {
    case ID_RENDER_CURRENT_VIEW:
        m_canvas->RenderRaytracingRequest();
        break;

    case ID_RELOAD3D_BOARD:
        ReloadRequest();
        m_canvas->Request_refresh();
        break;

    case ID_ROTATE3D_X_POS:
        m_settings.CameraGet().RotateX( glm::radians(ROT_ANGLE) );
        m_canvas->Request_refresh();
        break;

    case ID_ROTATE3D_X_NEG:
        m_settings.CameraGet().RotateX( -glm::radians(ROT_ANGLE) );
        m_canvas->Request_refresh();
        break;

    case ID_ROTATE3D_Y_POS:
        m_settings.CameraGet().RotateY( glm::radians(ROT_ANGLE) );
        m_canvas->Request_refresh();
        break;

    case ID_ROTATE3D_Y_NEG:
        m_settings.CameraGet().RotateY( -glm::radians(ROT_ANGLE) );
        m_canvas->Request_refresh();
        break;

    case ID_ROTATE3D_Z_POS:
        m_settings.CameraGet().RotateZ( glm::radians(ROT_ANGLE) );
        m_canvas->Request_refresh();
        break;

    case ID_ROTATE3D_Z_NEG:
        m_settings.CameraGet().RotateZ( -glm::radians(ROT_ANGLE) );
        m_canvas->Request_refresh();
        break;

    case ID_MOVE3D_LEFT:
        m_canvas->SetView3D( WXK_LEFT );
        return;

    case ID_MOVE3D_RIGHT:
        m_canvas->SetView3D( WXK_RIGHT );
        return;

    case ID_MOVE3D_UP:
        m_canvas->SetView3D( WXK_UP );
        return;

    case ID_MOVE3D_DOWN:
        m_canvas->SetView3D( WXK_DOWN );
        return;

    case ID_ORTHO:
        m_settings.CameraGet().ToggleProjection();
        m_canvas->Request_refresh();
        return;

    case ID_TOOL_SCREENCOPY_TOCLIBBOARD:
    case ID_MENU_SCREENCOPY_PNG:
    case ID_MENU_SCREENCOPY_JPEG:
        takeScreenshot( event );
        return;

    case ID_MENU3D_BGCOLOR_BOTTOM_SELECTION:
        if( Set3DColorFromUser( m_settings.m_BgColorBot, _( "Background Color, Bottom" ) ) )
        {
            if( m_settings.RenderEngineGet() == RENDER_ENGINE_OPENGL_LEGACY )
                m_canvas->Request_refresh();
            else
                ReloadRequest();
        }
        return;

    case ID_MENU3D_BGCOLOR_TOP_SELECTION:
        if( Set3DColorFromUser( m_settings.m_BgColorTop, _( "Background Color, Top" ) ) )
        {
            if( m_settings.RenderEngineGet() == RENDER_ENGINE_OPENGL_LEGACY )
                m_canvas->Request_refresh();
            else
                ReloadRequest();
        }
        return;

    case ID_MENU3D_SILKSCREEN_COLOR_SELECTION:
        Set3DSilkScreenColorFromUser();
        return;

    case ID_MENU3D_SOLDERMASK_COLOR_SELECTION:
        Set3DSolderMaskColorFromUser();
        return;

    case ID_MENU3D_SOLDERPASTE_COLOR_SELECTION:
        Set3DSolderPasteColorFromUser();
        return;

    case ID_MENU3D_COPPER_COLOR_SELECTION:
        Set3DCopperColorFromUser();
        break;

    case ID_MENU3D_PCB_BODY_COLOR_SELECTION:
        Set3DBoardBodyColorFromUser();
        break;

    case ID_MENU3D_MOUSEWHEEL_PANNING:
        m_settings.SetFlag( FL_MOUSEWHEEL_PANNING, isChecked );
        break;

    case ID_MENU3D_REALISTIC_MODE:
        m_settings.SetFlag( FL_USE_REALISTIC_MODE, isChecked );
        SetMenuBarOptionsState();
        ReloadRequest( );
        return;

    case ID_MENU3D_FL_RENDER_MATERIAL_MODE_NORMAL:
        m_settings.MaterialModeSet( MATERIAL_MODE_NORMAL );
        ReloadRequest( );
        return;

    case ID_MENU3D_FL_RENDER_MATERIAL_MODE_DIFFUSE_ONLY:
        m_settings.MaterialModeSet( MATERIAL_MODE_DIFFUSE_ONLY );
        ReloadRequest( );
        return;

    case ID_MENU3D_FL_RENDER_MATERIAL_MODE_CAD_MODE:
        m_settings.MaterialModeSet( MATERIAL_MODE_CAD_MODE );
        ReloadRequest( );
        return;

    case ID_MENU3D_FL_OPENGL_RENDER_COPPER_THICKNESS:
        m_settings.SetFlag( FL_RENDER_OPENGL_COPPER_THICKNESS, isChecked );
        ReloadRequest();
        return;

    case ID_MENU3D_FL_OPENGL_RENDER_SHOW_MODEL_BBOX:
        m_settings.SetFlag( FL_RENDER_OPENGL_SHOW_MODEL_BBOX, isChecked );
        m_canvas->Request_refresh();
        return;

    case ID_MENU3D_FL_RAYTRACING_RENDER_SHADOWS:
        m_settings.SetFlag( FL_RENDER_RAYTRACING_SHADOWS, isChecked );
        m_canvas->Request_refresh();
        return;

    case ID_MENU3D_FL_RAYTRACING_PROCEDURAL_TEXTURES:
        m_settings.SetFlag( FL_RENDER_RAYTRACING_PROCEDURAL_TEXTURES, isChecked );
        ReloadRequest( );
        return;

    case ID_MENU3D_FL_RAYTRACING_BACKFLOOR:
        m_settings.SetFlag( FL_RENDER_RAYTRACING_BACKFLOOR, isChecked );
        ReloadRequest( );
        return;

    case ID_MENU3D_FL_RAYTRACING_REFRACTIONS:
        m_settings.SetFlag( FL_RENDER_RAYTRACING_REFRACTIONS, isChecked );
        m_canvas->Request_refresh();
        return;

    case ID_MENU3D_FL_RAYTRACING_REFLECTIONS:
        m_settings.SetFlag( FL_RENDER_RAYTRACING_REFLECTIONS, isChecked );
        m_canvas->Request_refresh();
        return;

    case ID_MENU3D_FL_RAYTRACING_POST_PROCESSING:
        m_settings.SetFlag( FL_RENDER_RAYTRACING_POST_PROCESSING, isChecked );
        ReloadRequest( );
        return;

    case ID_MENU3D_FL_RAYTRACING_ANTI_ALIASING:
        m_settings.SetFlag( FL_RENDER_RAYTRACING_ANTI_ALIASING, isChecked );
        m_canvas->Request_refresh();
        return;

    case ID_MENU3D_SHOW_BOARD_BODY:
        m_settings.SetFlag( FL_SHOW_BOARD_BODY, isChecked );
        ReloadRequest( );
        return;

    case ID_MENU3D_AXIS_ONOFF:
        m_settings.SetFlag( FL_AXIS, isChecked );
        m_canvas->Request_refresh();
        return;

    case ID_MENU3D_MODULE_ONOFF_ATTRIBUTES_NORMAL:
        m_settings.SetFlag( FL_MODULE_ATTRIBUTES_NORMAL, isChecked );
        ReloadRequest( );
        return;

    case ID_MENU3D_MODULE_ONOFF_ATTRIBUTES_NORMAL_INSERT:
        m_settings.SetFlag( FL_MODULE_ATTRIBUTES_NORMAL_INSERT, isChecked );
        ReloadRequest( );
        return;

    case ID_MENU3D_MODULE_ONOFF_ATTRIBUTES_VIRTUAL:
        m_settings.SetFlag( FL_MODULE_ATTRIBUTES_VIRTUAL, isChecked );
        ReloadRequest( );
        return;

    case ID_MENU3D_ZONE_ONOFF:
        m_settings.SetFlag( FL_ZONE, isChecked );
        ReloadRequest( );
        return;

    case ID_MENU3D_ADHESIVE_ONOFF:
        m_settings.SetFlag( FL_ADHESIVE, isChecked );
        ReloadRequest( );
        return;

    case ID_MENU3D_SILKSCREEN_ONOFF:
        m_settings.SetFlag( FL_SILKSCREEN, isChecked );
        ReloadRequest( );
        return;

    case ID_MENU3D_SOLDER_MASK_ONOFF:
        m_settings.SetFlag( FL_SOLDERMASK, isChecked );
        ReloadRequest( );
        return;

    case ID_MENU3D_SOLDER_PASTE_ONOFF:
        m_settings.SetFlag( FL_SOLDERPASTE, isChecked );
        ReloadRequest( );
        return;

    case ID_MENU3D_COMMENTS_ONOFF:
        m_settings.SetFlag( FL_COMMENTS, isChecked );
        ReloadRequest( );
        return;

    case ID_MENU3D_ECO_ONOFF:
        m_settings.SetFlag( FL_ECO, isChecked );
        ReloadRequest( );
        return;

    case ID_MENU3D_RESET_DEFAULTS:
    {
        // Reload settings with a dummy config, so it will load the defaults
        wxConfig *fooconfig = new wxConfig("FooBarApp");
        LoadSettings( fooconfig );
        delete fooconfig;

        // Refresh menu option state
        SetMenuBarOptionsState();

        // Tell canvas that we (may) changed the render engine
        RenderEngineChanged();

        ReloadRequest();
    }
        return;

    case ID_MENU3D_HELP_HOTKEY_SHOW_CURRENT_LIST:
    {
        DisplayHotKeys();
    }
        return;

    default:
        wxLogMessage( wxT( "EDA_3D_VIEWER::Process_Special_Functions() error: unknown command %d" ), id );
        return;
    }
}
コード例 #3
0
void EDA_3D_FRAME::CreateMenuBar()
{
    wxMenuBar* menuBar   = new wxMenuBar;
    wxMenu*    fileMenu  = new wxMenu;
    wxMenu*    prefsMenu = new wxMenu;

    menuBar->Append( fileMenu, _( "&File" ) );

    AddMenuItem( fileMenu, ID_MENU_SCREENCOPY_PNG,
                 _( "Create Image (png format)" ),
                 KiBitmap( export_xpm ) );
    AddMenuItem( fileMenu, ID_MENU_SCREENCOPY_JPEG,
                 _( "Create Image (jpeg format)" ),
                 KiBitmap( export_xpm ) );

    fileMenu->AppendSeparator();
    AddMenuItem( fileMenu, ID_TOOL_SCREENCOPY_TOCLIBBOARD,
                 _( "Copy 3D Image to Clipboard" ),
                 KiBitmap( copy_button_xpm ) );

    fileMenu->AppendSeparator();
    AddMenuItem( fileMenu, wxID_EXIT,
                 _( "&Exit" ),
                 KiBitmap( exit_xpm ) );

    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_NORMALS,
        _( "Render Smooth Normals" ),
        KiBitmap( green_xpm ), wxITEM_CHECK );

    AddMenuItem( renderOptionsMenu, ID_MENU3D_FL_RENDER_USE_MODEL_NORMALS,
        _( "Use Model Normals" ),
        KiBitmap( green_xpm ), wxITEM_CHECK );

    AddMenuItem( renderOptionsMenu, ID_MENU3D_FL_RENDER_MATERIAL,
        _( "Render Material Properties" ),
        KiBitmap( green_xpm ), wxITEM_CHECK );

    AddMenuItem( renderOptionsMenu, ID_MENU3D_FL_RENDER_SHOW_MODEL_BBOX,
        _( "Show Model Bounding Boxes" ),
        KiBitmap( green_xpm ), wxITEM_CHECK );

    prefsMenu->AppendSeparator();

    // Add submenu set Colors
    wxMenu * setColorMenu = new wxMenu;
    AddMenuItem( prefsMenu, setColorMenu, ID_MENU3D_COLOR,
                 _( "Choose Colors" ), KiBitmap( palette_xpm ) );

    wxMenu * setBgColorMenu = new wxMenu;
    AddMenuItem( setColorMenu, setBgColorMenu, ID_MENU3D_BGCOLOR,
                 _( "Background Color" ), KiBitmap( palette_xpm ) );

    AddMenuItem( setBgColorMenu, ID_MENU3D_BGCOLOR_TOP_SELECTION,
                 _( "Background Top Color" ), KiBitmap( setcolor_3d_bg_xpm ) );

    AddMenuItem( setBgColorMenu, ID_MENU3D_BGCOLOR_BOTTOM_SELECTION,
                 _( "Background Bottom Color" ), KiBitmap( setcolor_3d_bg_xpm ) );

    AddMenuItem( setColorMenu, ID_MENU3D_SILKSCREEN_COLOR_SELECTION,
                 _( "Silkscreen Color" ), KiBitmap( setcolor_silkscreen_xpm ) );

    AddMenuItem( setColorMenu, ID_MENU3D_SOLDERMASK_COLOR_SELECTION,
                 _( "Solder Mask Color" ), KiBitmap( setcolor_soldermask_xpm ) );

    AddMenuItem( setColorMenu, ID_MENU3D_SOLDERPASTE_COLOR_SELECTION,
                 _( "Solder Paste Color" ), KiBitmap( setcolor_solderpaste_xpm ) );

    AddMenuItem( setColorMenu, ID_MENU3D_COPPER_COLOR_SELECTION,
                 _( "Copper/Surface Finish Color" ), KiBitmap( setcolor_copper_xpm ) );

    AddMenuItem( setColorMenu, ID_MENU3D_PCB_BODY_COLOR_SELECTION,
                 _( "Board Body Color" ), KiBitmap( setcolor_board_body_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 Bod&y" ), 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,
           _( "Show 3D F&ootprints" ), KiBitmap( shape_3d_xpm ), wxITEM_CHECK );

    AddMenuItem( prefsMenu, ID_MENU3D_ZONE_ONOFF,
           _( "Show Zone &Filling" ), KiBitmap( add_zone_xpm ), wxITEM_CHECK );

    prefsMenu->AppendSeparator();

    wxMenu * layersMenu = new wxMenu;
    AddMenuItem( prefsMenu, layersMenu, ID_MENU3D_LAYERS,
           _( "Show &Layers" ), KiBitmap( tools_xpm ) );

    AddMenuItem( layersMenu, ID_MENU3D_ADHESIVE_ONOFF,
           _( "Show &Adhesive Layers" ), KiBitmap( tools_xpm ), wxITEM_CHECK );

    AddMenuItem( layersMenu, ID_MENU3D_SILKSCREEN_ONOFF,
           _( "Show &Silkscreen Layer" ), KiBitmap( add_text_xpm ), wxITEM_CHECK );

    AddMenuItem( layersMenu, ID_MENU3D_SOLDER_MASK_ONOFF,
           _( "Show Solder &Mask Layers" ), KiBitmap( pads_mask_layers_xpm ), wxITEM_CHECK );

    AddMenuItem( layersMenu, ID_MENU3D_SOLDER_PASTE_ONOFF,
           _( "Show Solder &Paste Layers" ), KiBitmap( pads_mask_layers_xpm ), wxITEM_CHECK );

    // Other layers are not "board" layers, and are not shown in realistic mode
    // These menus will be disabled in in realistic mode
    AddMenuItem( layersMenu, ID_MENU3D_COMMENTS_ONOFF,
           _( "Show &Comments and Drawings Layer" ), KiBitmap( edit_sheet_xpm ), wxITEM_CHECK );

    AddMenuItem( layersMenu, ID_MENU3D_ECO_ONOFF,
           _( "Show &Eco Layers" ), KiBitmap( edit_sheet_xpm ), wxITEM_CHECK );

    SetMenuBar( menuBar );
    SetMenuBarOptionsState();
}
コード例 #4
0
ファイル: 3d_toolbar.cpp プロジェクト: jerkey/kicad
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 );
    prefsMenu->AppendSeparator();

    AddMenuItem( prefsMenu, ID_MENU3D_BGCOLOR_SELECTION,
                 _( "Choose background 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->Append( ID_MENU3D_GRID_NOGRID, _( "No 3D Grid" ), wxEmptyString, true );
    gridlistMenu->Check( ID_MENU3D_GRID_NOGRID, true );

    gridlistMenu->Append( ID_MENU3D_GRID_10_MM, _( "3D Grid 10 mm" ), wxEmptyString, true );
    gridlistMenu->Append( ID_MENU3D_GRID_5_MM, _( "3D Grid 5 mm" ), wxEmptyString, true );
    gridlistMenu->Append( ID_MENU3D_GRID_2P5_MM, _( "3D Grid 2.5 mm" ), wxEmptyString, true );
    gridlistMenu->Append( ID_MENU3D_GRID_1_MM, _( "3D Grid 1 mm" ), wxEmptyString, 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,
           _( "Show 3D F&ootprints" ), KiBitmap( shape_3d_xpm ), wxITEM_CHECK );

    AddMenuItem( prefsMenu, ID_MENU3D_ZONE_ONOFF,
           _( "Show Zone &Filling" ), KiBitmap( add_zone_xpm ), wxITEM_CHECK );

    prefsMenu->AppendSeparator();

    AddMenuItem( prefsMenu, ID_MENU3D_ADHESIVE_ONOFF,
           _( "Show &Adhesive Layers" ), KiBitmap( tools_xpm ), wxITEM_CHECK );

    AddMenuItem( prefsMenu, ID_MENU3D_SILKSCREEN_ONOFF,
           _( "Show &Silkscreen Layer" ), KiBitmap( add_text_xpm ), wxITEM_CHECK );

    AddMenuItem( prefsMenu, ID_MENU3D_SOLDER_MASK_ONOFF,
           _( "Show Solder &Mask Layers" ), KiBitmap( pads_mask_layers_xpm ), wxITEM_CHECK );

    AddMenuItem( prefsMenu, ID_MENU3D_SOLDER_PASTE_ONOFF,
           _( "Show Solder &Paste Layers" ), KiBitmap( pads_mask_layers_xpm ), wxITEM_CHECK );

    AddMenuItem( prefsMenu, ID_MENU3D_COMMENTS_ONOFF,
           _( "Show &Comments and Drawings Layer" ), KiBitmap( edit_sheet_xpm ), wxITEM_CHECK );

    AddMenuItem( prefsMenu, ID_MENU3D_ECO_ONOFF,
           _( "Show &Eco Layers" ), KiBitmap( edit_sheet_xpm ), wxITEM_CHECK );

    SetMenuBar( menuBar );
    SetMenuBarOptionsState();
}
コード例 #5
0
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,
           _( "Show 3D F&ootprints" ), KiBitmap( shape_3d_xpm ), wxITEM_CHECK );

    AddMenuItem( prefsMenu, ID_MENU3D_ZONE_ONOFF,
           _( "Show Zone &Filling" ), KiBitmap( add_zone_xpm ), wxITEM_CHECK );

    prefsMenu->AppendSeparator();

    wxMenu * layersMenu = new wxMenu;
    AddMenuItem( prefsMenu, layersMenu, ID_MENU3D_LAYERS,
           _( "Show Layers" ), KiBitmap( tools_xpm ) );

    AddMenuItem( layersMenu, ID_MENU3D_ADHESIVE_ONOFF,
           _( "Show &Adhesive Layers" ), KiBitmap( tools_xpm ), wxITEM_CHECK );

    AddMenuItem( layersMenu, ID_MENU3D_SILKSCREEN_ONOFF,
           _( "Show &Silkscreen Layer" ), KiBitmap( add_text_xpm ), wxITEM_CHECK );

    AddMenuItem( layersMenu, ID_MENU3D_SOLDER_MASK_ONOFF,
           _( "Show Solder &Mask Layers" ), KiBitmap( pads_mask_layers_xpm ), wxITEM_CHECK );

    AddMenuItem( layersMenu, ID_MENU3D_SOLDER_PASTE_ONOFF,
           _( "Show Solder &Paste Layers" ), KiBitmap( pads_mask_layers_xpm ), wxITEM_CHECK );

    AddMenuItem( layersMenu, ID_MENU3D_COMMENTS_ONOFF,
           _( "Show &Comments and Drawings Layer" ), KiBitmap( edit_sheet_xpm ), wxITEM_CHECK );

    AddMenuItem( layersMenu, ID_MENU3D_ECO_ONOFF,
           _( "Show &Eco Layers" ), KiBitmap( edit_sheet_xpm ), wxITEM_CHECK );

    SetMenuBar( menuBar );
    SetMenuBarOptionsState();
}