← Back to team overview

kicad-developers team mailing list archive

[PATCH] Adjust Menubar of 3D Viewer to common style

 

Hi,

some time ago there were adjustments to have a common design of the
menubar in all applications. This initial patch does some basic
adjustions of the 3D-Viewer in this direction, but things like
displaying Hotkeys was not added.


One question regarding improvements based on that patch would be:

There exists now a "Display Options" Dialog. In my point of view this
would allow us to remove quite a few submenus. What do you think about
that? Currently you need to cause a resize event to get the view updated
(https://bugs.launchpad.net/kicad/+bug/1612419), which means using the
Dialog requires the same number of events for an action and thus the
submenu does not even provide better efficiency.


Patch can also be found on GitHub:
https://github.com/pointhi/kicad-source-mirror/tree/3d_viewer_menu


Regards, Thomas

From 53e344fe2ee450b852f49b635ac89542080e0dd8 Mon Sep 17 00:00:00 2001
From: Thomas Pointhuber <thomas.pointhuber@xxxxxx>
Date: Wed, 4 Apr 2018 14:17:20 +0200
Subject: [PATCH] Adjust Menubar of 3D Viewer to common style

---
 3d-viewer/3d_viewer/3d_toolbar.cpp | 124 +++++++++++++++++++++++++++++++++----
 1 file changed, 112 insertions(+), 12 deletions(-)

diff --git a/3d-viewer/3d_viewer/3d_toolbar.cpp b/3d-viewer/3d_viewer/3d_toolbar.cpp
index 3027b1dee..d5c1ec240 100644
--- a/3d-viewer/3d_viewer/3d_toolbar.cpp
+++ b/3d-viewer/3d_viewer/3d_toolbar.cpp
@@ -35,6 +35,8 @@
 #include <menus_helpers.h>
 #include <3d_viewer_id.h>
 
+#include "help_common_strings.h"
+
 
 void EDA_3D_VIEWER::ReCreateMainToolbar()
 {
@@ -141,30 +143,100 @@ void EDA_3D_VIEWER::CreateMenuBar()
 
     wxMenuBar* menuBar   = new wxMenuBar;
     wxMenu*    fileMenu  = new wxMenu;
-    wxMenu*    editMenu  = new wxMenu;
+    wxMenu*    viewMenu  = new wxMenu;
     wxMenu*    prefsMenu = new wxMenu;
     wxMenu*    helpMenu  = new wxMenu;
 
     menuBar->Append( fileMenu, _( "&File" ) );
 
-    AddMenuItem( fileMenu, ID_MENU_SCREENCOPY_PNG,
-                 _( "Export Current View as PNG..." ),
+    // Export options
+    // /////////////////////////////////////////////////////////////////////////
+    wxMenu* exportMenu = new wxMenu;
+
+    AddMenuItem( exportMenu, ID_MENU_SCREENCOPY_PNG,
+                 _( "PNG..." ), _( "Export Current View as PNG..." ),
                  KiBitmap( export_xpm ) );
 
-    AddMenuItem( fileMenu, ID_MENU_SCREENCOPY_JPEG,
-                 _( "Export Current View as JPEG..." ),
+    AddMenuItem( exportMenu, ID_MENU_SCREENCOPY_JPEG,
+                 _( "JPEG..." ), _( "Export Current View as JPEG..." ),
                  KiBitmap( export_xpm ) );
 
+    AddMenuItem( exportMenu, ID_TOOL_SCREENCOPY_TOCLIBBOARD,
+                 _( "3D View to Clipboard" ),
+                 KiBitmap( copy_xpm ) );
+
+    AddMenuItem( fileMenu, exportMenu,
+                 ID_GEN_EXPORT_FILE, _( "E&xport" ),
+                 _( "Export Current View" ), KiBitmap( export_xpm ) );
+
     fileMenu->AppendSeparator();
-    AddMenuItem( fileMenu, wxID_EXIT,
-                 _( "&Exit" ),
-                 KiBitmap( exit_xpm ) );
+    AddMenuItem( fileMenu, wxID_EXIT, _( "&Exit" ), _( "Close 3D Viewer" ), KiBitmap( exit_xpm ) );
 
-    menuBar->Append( editMenu, _( "&Edit" ) );
+    menuBar->Append( viewMenu, _( "&View" ) );
 
-    AddMenuItem( editMenu, ID_TOOL_SCREENCOPY_TOCLIBBOARD,
-                 _( "Copy 3D Image" ),
-                 KiBitmap( copy_xpm ) );
+    AddMenuItem( viewMenu, ID_ZOOM_IN,
+                 _( "Zoom &In" ), HELP_ZOOM_IN,
+                 KiBitmap( zoom_in_xpm ) );
+
+    AddMenuItem( viewMenu, ID_ZOOM_OUT,
+                 _( "Zoom &Out" ), HELP_ZOOM_OUT,
+                 KiBitmap( zoom_out_xpm ) );
+
+    AddMenuItem( viewMenu, ID_ZOOM_PAGE,
+                 _( "Zoom to &Fit" ), HELP_ZOOM_FIT,
+                 KiBitmap( zoom_fit_in_page_xpm ) );
+
+    AddMenuItem( viewMenu, ID_ZOOM_REDRAW,
+                 _( "&Redraw" ), HELP_ZOOM_REDRAW,
+                 KiBitmap( zoom_redraw_xpm ) );
+
+    viewMenu->AppendSeparator();
+
+    AddMenuItem( viewMenu, ID_ROTATE3D_X_NEG,
+                 _( "Rotate X <-" ),
+                 KiBitmap( rotate_neg_x_xpm ) );
+
+    AddMenuItem( viewMenu, ID_ROTATE3D_X_POS,
+                 _( "Rotate X ->" ),
+                 KiBitmap( rotate_pos_x_xpm ) );
+
+    viewMenu->AppendSeparator();
+
+    AddMenuItem( viewMenu, ID_ROTATE3D_Y_NEG,
+                 _( "Rotate Y <-" ),
+                 KiBitmap( rotate_neg_y_xpm ) );
+
+    AddMenuItem( viewMenu, ID_ROTATE3D_Y_POS,
+                 _( "Rotate Y ->" ),
+                 KiBitmap( rotate_pos_y_xpm ) );
+
+    viewMenu->AppendSeparator();
+
+    AddMenuItem( viewMenu, ID_ROTATE3D_Z_NEG,
+                 _( "Rotate Z <-" ),
+                 KiBitmap( rotate_neg_z_xpm ) );
+
+    AddMenuItem( viewMenu, ID_ROTATE3D_Z_POS,
+                 _( "Rotate Z ->" ),
+                 KiBitmap( rotate_pos_z_xpm ) );
+
+    viewMenu->AppendSeparator();
+
+    AddMenuItem( viewMenu, ID_MOVE3D_LEFT,
+                 _( "Move left" ),
+                 KiBitmap( left_xpm ) );
+
+    AddMenuItem( viewMenu, ID_MOVE3D_RIGHT,
+                 _( "Move right" ),
+                 KiBitmap( right_xpm ) );
+
+    AddMenuItem( viewMenu, ID_MOVE3D_UP,
+                 _( "Move up" ),
+                 KiBitmap( up_xpm ) );
+
+    AddMenuItem( viewMenu, ID_MOVE3D_DOWN,
+                 _( "Move down" ),
+                 KiBitmap( down_xpm ) );
 
     menuBar->Append( prefsMenu, _( "&Preferences" ) );
 
@@ -174,6 +246,10 @@ void EDA_3D_VIEWER::CreateMenuBar()
 
     prefsMenu->AppendSeparator();
 
+    AddMenuItem( prefsMenu, ID_TOOL_SET_VISIBLE_ITEMS,
+                 _( "Display Options" ),
+                 KiBitmap( read_setup_xpm ) );
+
     AddMenuItem( prefsMenu, ID_MENU3D_REALISTIC_MODE,
                  _( "Realistic Mode" ),
                  KiBitmap( use_3D_copper_thickness_xpm ), wxITEM_CHECK );
@@ -402,11 +478,35 @@ void EDA_3D_VIEWER::CreateMenuBar()
     // /////////////////////////////////////////////////////////////////////////
     menuBar->Append( helpMenu, _( "&Help" ) );
 
+    AddMenuItem( helpMenu, wxID_HELP,
+                 _( "Pcbnew &Manual" ),
+                 _( "Open Pcbnew Manual" ),
+                 KiBitmap( online_help_xpm ) );
+
+    AddMenuItem( helpMenu, wxID_INDEX,
+                 _( "&Getting Started in KiCad" ),
+                 _( "Open \"Getting Started in KiCad\" guide for beginners" ),
+                 KiBitmap( help_xpm ) );
+
     AddMenuItem( helpMenu, ID_MENU3D_HELP_HOTKEY_SHOW_CURRENT_LIST,
                  _( "&List Hotkeys..." ),
                  _( "Displays the current hotkeys list and corresponding commands" ),
                  KiBitmap( hotkeys_xpm ) );
 
+    helpMenu->AppendSeparator();
+
+    AddMenuItem( helpMenu, ID_HELP_GET_INVOLVED,
+                 _( "Get &Involved" ),
+                 _( "Contribute to KiCad (opens a web browser)" ),
+                 KiBitmap( info_xpm ) );
+
+    helpMenu->AppendSeparator();
+
+    AddMenuItem( helpMenu, wxID_ABOUT,
+                 _( "&About KiCad" ),
+                 _( "Display KiCad About dialog" ),
+                 KiBitmap( about_xpm ) );
+
     SetMenuBar( menuBar );
     SetMenuBarOptionsState();
 }
-- 
2.16.3

Attachment: signature.asc
Description: OpenPGP digital signature


Follow ups