← Back to team overview

kicad-developers team mailing list archive

Re: Default Canvas for v5

 

Hi Wayne, Nick,

Updated patch attached with your suggestions.

-Jon

On Wed, Jan 3, 2018 at 3:36 PM, Nick Østergaard <oe.nick@xxxxxxxxx> wrote:

> Hmm, maybe it is ok to use the technical terms OpenGL and Cairo in the
> help text for the menu item. Afterall those terms have been used a lot in
> help forums and launchpad, so it may make it easier for the curious to
> discover.
>
> 2018-01-03 21:15 GMT+01:00 Wayne Stambaugh <stambaughw@xxxxxxxxx>:
>
>> There is also wxRichMessageDialog[1] which has an optional checkbox for
>> show once features.
>>
>> [1]: http://docs.wxwidgets.org/3.0/classwx_rich_message_dialog.html
>>
>> On 1/3/2018 3:13 PM, Jon Evans wrote:
>> > I figured we might want to re-use this in the future if we ever have
>> > additional "show once" things that are more complicated than yes/no
>> > (although I didn't make it with formbuilder).
>> > It would be fine to switch to a messagedialog.  I can probably do that
>> > tonight.
>> >
>> > -Jon
>> >
>> > On Wed, Jan 3, 2018 at 3:09 PM, Wayne Stambaugh <stambaughw@xxxxxxxxx
>> > <mailto:stambaughw@xxxxxxxxx>> wrote:
>> >
>> >     John,
>> >
>> >     I took a look at your patch.  Is there any reason why you didn't use
>> >     wxMessageDialog instead of creating wxFormbuilder project for such a
>> >     simple dialog?  It seems to me that wxMessageDialog would do the
>> trick
>> >     as it allows you to change the strings for the Ok and Cancel
>> buttons.
>> >     Other than that, everything else seems fine.
>> >
>> >     Cheers,
>> >
>> >     Wayne
>> >
>> >     On 12/31/2017 4:28 PM, Jon Evans wrote:
>> >     > For your consideration, a patch is attached that implements the
>> above.
>> >     >
>> >     >
>> >     > On Sun, Dec 31, 2017 at 2:24 PM, Jon Evans <jon@xxxxxxxxxxxxx
>> <mailto:jon@xxxxxxxxxxxxx>
>> >     > <mailto:jon@xxxxxxxxxxxxx <mailto:jon@xxxxxxxxxxxxx>>> wrote:
>> >     >
>> >     >     I think that getting automatic OpenGL detection and recovery
>> working
>> >     >     for 5.0 might be ambitious.
>> >     >     Maybe Chris can detail what the next steps are for his
>> approach
>> >     >     there, but in case we want to push that to a later release,
>> here's
>> >     >     what I propose:
>> >     >
>> >     >     1) Rename the View menu options based on my proposal "Legacy",
>> >     >     "Modern (Accelerated)", "Modern (Fallback)"
>> >     >     2) Change PCB_BASE_FRAME::SwitchCanvas to save the canvas
>> config
>> >     >     value after calling UseGalCanvas() rather than before.
>> >     >     3) Show a first-run dialog like the mockup in my earlier
>> email, IF
>> >     >     canvas is not OpenGL and the dialog has not been shown before
>> >     >     44) If user clicks "yes" in the first run dialog, then:
>> >     >         (a) set the config value to prevent the dialog from
>> showing again,
>> >     >         (b) Set the canvas config setting to Cairo (but don't
>> switch the
>> >     >     GAL to Cairo), then
>> >     >         (c) switch to OpenGL canvas using SwitchCanvas()
>> >     >
>> >     >     That way, if the app crashes in step 4c, it should come back
>> up as
>> >     >     Cairo on the next launch (assuming we crash right away when
>> trying
>> >     >     to set up the canvas)
>> >     >
>> >     >     Any concerns with the above?
>> >     >
>> >     >     -Jon
>> >     >
>> >     >
>> >     >
>> >     >     On Sun, Dec 31, 2017 at 1:55 PM, Jeff Young <jeff@xxxxxxxxx
>> <mailto:jeff@xxxxxxxxx>
>> >     >     <mailto:jeff@xxxxxxxxx <mailto:jeff@xxxxxxxxx>>> wrote:
>> >     >
>> >     >         +1
>> >     >
>> >     >         No menu items.  Just a checkbox for Enable Hardware
>> Acceleration
>> >     >         in Preferences.
>> >     >
>> >     >>         On 31 Dec 2017, at 18:36, Andy Peters <devel@xxxxxxxxx
>> <mailto:devel@xxxxxxxxx>
>> >     >>         <mailto:devel@xxxxxxxxx <mailto:devel@xxxxxxxxx>>>
>> wrote:
>> >     >>
>> >     >>>         - In the case of graphics glitches, inform the users in
>> the
>> >     >>>         FAQ/Manual
>> >     >>>         that they can fall back to software renderer in the
>> View menu.
>> >     >>>         - Don't use the term 'canvas' or 'view'. Just 'Enable HW
>> >     >>>         acceleration’.
>> >     >>
>> >     >>         I like that. The fewer technical/programmer terms, the
>> better.
>> >     >
>> >     >
>> >     >         _______________________________________________
>> >     >         Mailing list: https://launchpad.net/~kicad-developers
>> >     <https://launchpad.net/~kicad-developers>
>> >     >         <https://launchpad.net/~kicad-developers
>> >     <https://launchpad.net/~kicad-developers>>
>> >     >         Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
>> >     <mailto:kicad-developers@xxxxxxxxxxxxxxxxxxx>
>> >     >         <mailto:kicad-developers@xxxxxxxxxxxxxxxxxxx
>> >     <mailto:kicad-developers@xxxxxxxxxxxxxxxxxxx>>
>> >     >         Unsubscribe : https://launchpad.net/~kicad-developers
>> >     <https://launchpad.net/~kicad-developers>
>> >     >         <https://launchpad.net/~kicad-developers
>> >     <https://launchpad.net/~kicad-developers>>
>> >     >         More help   : https://help.launchpad.net/ListHelp
>> >     <https://help.launchpad.net/ListHelp>
>> >     >         <https://help.launchpad.net/ListHelp
>> >     <https://help.launchpad.net/ListHelp>>
>> >     >
>> >     >
>> >     >
>> >     >
>> >     >
>> >     > _______________________________________________
>> >     > Mailing list: https://launchpad.net/~kicad-developers
>> >     <https://launchpad.net/~kicad-developers>
>> >     > Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
>> >     <mailto:kicad-developers@xxxxxxxxxxxxxxxxxxx>
>> >     > Unsubscribe : https://launchpad.net/~kicad-developers
>> >     <https://launchpad.net/~kicad-developers>
>> >     > More help   : https://help.launchpad.net/ListHelp
>> >     <https://help.launchpad.net/ListHelp>
>> >     >
>> >
>> >     _______________________________________________
>> >     Mailing list: https://launchpad.net/~kicad-developers
>> >     <https://launchpad.net/~kicad-developers>
>> >     Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
>> >     <mailto:kicad-developers@xxxxxxxxxxxxxxxxxxx>
>> >     Unsubscribe : https://launchpad.net/~kicad-developers
>> >     <https://launchpad.net/~kicad-developers>
>> >     More help   : https://help.launchpad.net/ListHelp
>> >     <https://help.launchpad.net/ListHelp>
>> >
>> >
>>
>> _______________________________________________
>> Mailing list: https://launchpad.net/~kicad-developers
>> Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
>> Unsubscribe : https://launchpad.net/~kicad-developers
>> More help   : https://help.launchpad.net/ListHelp
>>
>
>
From d4383c70db5ff5c9c92d91df5783005fd72e05a0 Mon Sep 17 00:00:00 2001
From: Jon Evans <jon@xxxxxxxxxxxxx>
Date: Sun, 31 Dec 2017 16:27:52 -0500
Subject: [PATCH] Add a first-run dialog to encourage user to switch to OpenGL
 graphics

---
 common/draw_frame.cpp               |   4 ++
 gerbview/gerbview_frame.cpp         |  12 +++++
 gerbview/gerbview_id.h              |   3 --
 gerbview/menubar.cpp                |  12 ++---
 include/draw_frame.h                |  13 +++++
 include/id.h                        |   4 ++
 pcbnew/basepcbframe.cpp             |   2 +-
 pcbnew/menubar_modedit.cpp          |  12 ++---
 pcbnew/menubar_pcbframe.cpp         |  12 ++---
 pcbnew/pcbframe.cpp                 |  12 +++++
 pcbnew/pcbnew_id.h                  |   3 --
 14 files changed, 222 insertions(+), 25 deletions(-)

diff --git a/common/draw_frame.cpp b/common/draw_frame.cpp
index e1f79db7b..bd9342155 100644
--- a/common/draw_frame.cpp
+++ b/common/draw_frame.cpp
@@ -76,6 +76,7 @@ static const wxString GalDisplayOptionsKeyword( wxT( "GalDisplayOptions" ) );

 const wxChar EDA_DRAW_FRAME::CANVAS_TYPE_KEY[] = wxT( "canvas_type" );

+static const wxString FirstRunShownKeyword( wxT( "FirstRunShown" ) );

 ///@}

@@ -739,6 +740,8 @@ void EDA_DRAW_FRAME::LoadSettings( wxConfigBase* aCfg )
     m_UndoRedoCountMax = aCfg->Read( baseCfgName + MaxUndoItemsEntry,
             long( DEFAULT_MAX_UNDO_ITEMS ) );

+    aCfg->Read( baseCfgName + FirstRunShownKeyword, &m_firstRunDialogSetting, 0L );
+
     m_galDisplayOptions->ReadConfig( aCfg, baseCfgName + GalDisplayOptionsKeyword );
 }

@@ -753,6 +756,7 @@ void EDA_DRAW_FRAME::SaveSettings( wxConfigBase* aCfg )
     aCfg->Write( baseCfgName + GridColorEntryKeyword,
                  GetGridColor().ToColour().GetAsString( wxC2S_CSS_SYNTAX ) );
     aCfg->Write( baseCfgName + LastGridSizeIdKeyword, ( long ) m_LastGridSizeId );
+    aCfg->Write( baseCfgName + FirstRunShownKeyword, m_firstRunDialogSetting );

     if( GetScreen() )
         aCfg->Write( baseCfgName + MaxUndoItemsEntry, long( GetScreen()->GetMaxUndoItems() ) );
diff --git a/gerbview/gerbview_frame.cpp b/gerbview/gerbview_frame.cpp
index 45ea60476..eb1538e34 100644
--- a/gerbview/gerbview_frame.cpp
+++ b/gerbview/gerbview_frame.cpp
@@ -211,6 +211,18 @@ GERBVIEW_FRAME::GERBVIEW_FRAME( KIWAY* aKiway, wxWindow* aParent ):

     EDA_DRAW_PANEL_GAL::GAL_TYPE canvasType = loadCanvasTypeSetting();

+    // Nudge user to switch to OpenGL if they are on legacy or Cairo
+    if( ( canvasType != EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL ) &&
+        ( m_firstRunDialogSetting < 1 ) )
+    {
+        ShowFirstRunDialog( this );
+        m_firstRunDialogSetting = 1;
+        SaveSettings( config() );
+    }
+
+    // Canvas may have been updated by the dialog
+    canvasType = loadCanvasTypeSetting();
+
     if( canvasType != EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE )
     {
         if( GetGalCanvas()->SwitchBackend( canvasType ) )
diff --git a/gerbview/gerbview_id.h b/gerbview/gerbview_id.h
index 2e4494b81..035aa716a 100644
--- a/gerbview/gerbview_id.h
+++ b/gerbview/gerbview_id.h
@@ -50,9 +50,6 @@ enum gerbview_ids

     ID_MENU_GERBVIEW_SHOW_HIDE_LAYERS_MANAGER_DIALOG,
     ID_MENU_GERBVIEW_SELECT_PREFERED_EDITOR,
-    ID_MENU_CANVAS_LEGACY,
-    ID_MENU_CANVAS_OPENGL,
-    ID_MENU_CANVAS_CAIRO,

     ID_GBR_AUX_TOOLBAR_PCB_CMP_CHOICE,
     ID_GBR_AUX_TOOLBAR_PCB_NET_CHOICE,
diff --git a/gerbview/menubar.cpp b/gerbview/menubar.cpp
index fa3f372b7..ca75755d3 100644
--- a/gerbview/menubar.cpp
+++ b/gerbview/menubar.cpp
@@ -211,28 +211,28 @@ void GERBVIEW_FRAME::ReCreateMenuBar()
     // Canvas selection
     configMenu->AppendSeparator();

-    text = AddHotkeyName( _( "Legacy Canva&s" ), GerbviewHokeysDescr,
+    text = AddHotkeyName( _( "Legacy graphic&s" ), GerbviewHokeysDescr,
                           HK_CANVAS_LEGACY );

     configMenu->Append(
         new wxMenuItem( configMenu, ID_MENU_CANVAS_LEGACY,
-                        text, _( "Switch the canvas implementation to Legacy" ),
+                        text, _( "Use legacy graphics mode (not all features will be available" ),
                         wxITEM_RADIO ) );

-    text = AddHotkeyName( _( "Open&GL Canvas" ), GerbviewHokeysDescr,
+    text = AddHotkeyName( _( "Modern (&Accelerated)" ), GerbviewHokeysDescr,
                           HK_CANVAS_OPENGL );

     configMenu->Append(
         new wxMenuItem( configMenu, ID_MENU_CANVAS_OPENGL,
-                        text, _( "Switch the canvas implementation to OpenGL" ),
+                        text, _( "Use modern hardware-accelerated graphics mode (recommended)" ),
                         wxITEM_RADIO ) );

-    text = AddHotkeyName( _( "&Cairo Canvas" ), GerbviewHokeysDescr,
+    text = AddHotkeyName( _( "Modern (Fallba&ck)" ), GerbviewHokeysDescr,
                           HK_CANVAS_CAIRO );

     configMenu->Append(
         new wxMenuItem( configMenu, ID_MENU_CANVAS_CAIRO,
-                        text, _( "Switch the canvas implementation to Cairo" ),
+                        text, _( "Use modern fallback graphics mode" ),
                         wxITEM_RADIO ) );

     // Menu miscellaneous
diff --git a/include/draw_frame.h b/include/draw_frame.h
index e3e2cae89..e5b7ddd63 100644
--- a/include/draw_frame.h
+++ b/include/draw_frame.h
@@ -57,6 +57,9 @@ class EDA_DRAW_FRAME : public KIWAY_PLAYER
     /// it is closely tied to the #EDA_DRAW_FRAME.
     friend class EDA_DRAW_PANEL;

+    // For access to saveCanvasTypeSetting()
+    friend class DIALOG_FIRST_RUN;
+
     ///< Id of active button on the vertical toolbar.
     int         m_toolId;

@@ -112,6 +115,9 @@ protected:
     /// True shows the drawing border and title block.
     bool    m_showBorderAndTitleBlock;

+    /// Key to control whether first run dialog is shown on startup
+    long    m_firstRunDialogSetting;
+
     /// Choice box to choose the grid size.
     wxChoice*       m_gridSelectBox;

@@ -884,6 +890,13 @@ public:
     */
     KIGFX::GAL_DISPLAY_OPTIONS& GetGalDisplayOptions() { return *m_galDisplayOptions; }

+    /**
+     * Launches the first-run dialog
+     *
+     * Currently, this dialog prompts the user to switch to the OpenGL canvas
+     */
+    void ShowFirstRunDialog( EDA_DRAW_FRAME* aCaller );
+
     DECLARE_EVENT_TABLE()
 };

diff --git a/include/id.h b/include/id.h
index e95ff3f08..1ca5b4dac 100644
--- a/include/id.h
+++ b/include/id.h
@@ -85,6 +85,10 @@ enum main_id
     ID_CONFIG_SAVE,
     ID_CONFIG_READ,

+    ID_MENU_CANVAS_LEGACY,
+    ID_MENU_CANVAS_OPENGL,
+    ID_MENU_CANVAS_CAIRO,
+
     ID_PREFERENCES_HOTKEY_START,
     ID_PREFERENCES_HOTKEY_EXPORT_CONFIG,
     ID_PREFERENCES_HOTKEY_IMPORT_CONFIG,
diff --git a/pcbnew/basepcbframe.cpp b/pcbnew/basepcbframe.cpp
index c959f8055..54ba21cb7 100644
--- a/pcbnew/basepcbframe.cpp
+++ b/pcbnew/basepcbframe.cpp
@@ -957,8 +957,8 @@ void PCB_BASE_FRAME::SwitchCanvas( wxCommandEvent& aEvent )
         break;
     }

-    saveCanvasTypeSetting( canvasType );
     UseGalCanvas( use_gal );
+    saveCanvasTypeSetting( canvasType );
 }


diff --git a/pcbnew/menubar_modedit.cpp b/pcbnew/menubar_modedit.cpp
index 88cfed0df..94bcbdc7e 100644
--- a/pcbnew/menubar_modedit.cpp
+++ b/pcbnew/menubar_modedit.cpp
@@ -254,28 +254,28 @@ void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar()
     // Add canvas selection
     viewMenu->AppendSeparator();

-    text = AddHotkeyName( _( "Legacy Canva&s" ), m_hotkeysDescrList,
+    text = AddHotkeyName( _( "Legacy graphic&s" ), m_hotkeysDescrList,
                           HK_CANVAS_LEGACY );

     viewMenu->Append(
         new wxMenuItem( viewMenu, ID_MENU_CANVAS_LEGACY,
-                        text, _( "Switch the canvas implementation to Legacy" ),
+                        text, _( "Use legacy graphics mode (not all features will be available" ),
                         wxITEM_RADIO ) );

-    text = AddHotkeyName( _( "Open&GL Canvas" ), m_hotkeysDescrList,
+    text = AddHotkeyName( _( "Modern (&Accelerated)" ), m_hotkeysDescrList,
                           HK_CANVAS_OPENGL );

     viewMenu->Append(
         new wxMenuItem( viewMenu, ID_MENU_CANVAS_OPENGL,
-                        text, _( "Switch the canvas implementation to OpenGL" ),
+                        text, _( "Use modern hardware-accelerated graphics mode (recommended)" ),
                         wxITEM_RADIO ) );

-    text = AddHotkeyName( _( "&Cairo Canvas" ), m_hotkeysDescrList,
+    text = AddHotkeyName( _( "Modern (Fallba&ck)" ), m_hotkeysDescrList,
                           HK_CANVAS_CAIRO );

     viewMenu->Append(
         new wxMenuItem( viewMenu, ID_MENU_CANVAS_CAIRO,
-                        text, _( "Switch the canvas implementation to Cairo" ),
+                        text, _( "Use modern fallback graphics mode" ),
                         wxITEM_RADIO ) );

     //-------- Place menu --------------------
diff --git a/pcbnew/menubar_pcbframe.cpp b/pcbnew/menubar_pcbframe.cpp
index 3085d5a4d..419eaa26b 100644
--- a/pcbnew/menubar_pcbframe.cpp
+++ b/pcbnew/menubar_pcbframe.cpp
@@ -559,28 +559,28 @@ void prepareViewMenu( wxMenu* aParentMenu )

     aParentMenu->AppendSeparator();

-    text = AddHotkeyName( _( "Legacy Canva&s" ), g_Pcbnew_Editor_Hokeys_Descr,
+    text = AddHotkeyName( _( "Legacy graphic&s" ), g_Pcbnew_Editor_Hokeys_Descr,
                           HK_CANVAS_LEGACY );

     aParentMenu->Append(
         new wxMenuItem( aParentMenu, ID_MENU_CANVAS_LEGACY,
-                        text, _( "Switch canvas implementation to Legacy" ),
+                        text, _( "Use legacy graphics mode (not all features will be available" ),
                         wxITEM_RADIO ) );

-    text = AddHotkeyName( _( "Open&GL Canvas" ), g_Pcbnew_Editor_Hokeys_Descr,
+    text = AddHotkeyName( _( "Modern (&Accelerated)" ), g_Pcbnew_Editor_Hokeys_Descr,
                           HK_CANVAS_OPENGL );

     aParentMenu->Append(
         new wxMenuItem( aParentMenu, ID_MENU_CANVAS_OPENGL,
-                        text, _( "Switch canvas implementation to OpenGL" ),
+                        text, _( "Use modern hardware-accelerated graphics mode (recommended)" ),
                         wxITEM_RADIO ) );

-    text = AddHotkeyName( _( "&Cairo Canvas" ), g_Pcbnew_Editor_Hokeys_Descr,
+    text = AddHotkeyName( _( "Modern (Fallba&ck)" ), g_Pcbnew_Editor_Hokeys_Descr,
                           HK_CANVAS_CAIRO );

     aParentMenu->Append(
         new wxMenuItem( aParentMenu, ID_MENU_CANVAS_CAIRO,
-                        text, _( "Switch canvas implementation to Cairo" ),
+                        text, _( "Use modern fallback graphics mode" ),
                         wxITEM_RADIO ) );
 }

diff --git a/pcbnew/pcbframe.cpp b/pcbnew/pcbframe.cpp
index c8accb7f9..036d1503e 100644
--- a/pcbnew/pcbframe.cpp
+++ b/pcbnew/pcbframe.cpp
@@ -470,6 +470,18 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :

     EDA_DRAW_PANEL_GAL::GAL_TYPE canvasType = loadCanvasTypeSetting();

+    // Nudge user to switch to OpenGL if they are on legacy or Cairo
+    if( ( canvasType != EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL ) &&
+        ( m_firstRunDialogSetting < 1 ) )
+    {
+        ShowFirstRunDialog( this );
+        m_firstRunDialogSetting = 1;
+        SaveSettings( config() );
+    }
+
+    // Canvas may have been updated by the dialog
+    canvasType = loadCanvasTypeSetting();
+
     if( canvasType != EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE )
     {
         if( GetGalCanvas()->SwitchBackend( canvasType ) )
diff --git a/pcbnew/pcbnew_id.h b/pcbnew/pcbnew_id.h
index 8c1bf27c8..41184794e 100644
--- a/pcbnew/pcbnew_id.h
+++ b/pcbnew/pcbnew_id.h
@@ -299,9 +299,6 @@ enum pcbnew_ids

     ID_PCB_GEN_CMP_FILE,
     ID_MENU_PCB_SHOW_3D_FRAME,
-    ID_MENU_CANVAS_LEGACY,
-    ID_MENU_CANVAS_OPENGL,
-    ID_MENU_CANVAS_CAIRO,
     ID_PCB_USER_GRID_SETUP,
     ID_PCB_GEN_BOM_FILE_FROM_BOARD,
     ID_PCB_LIB_WIZARD,
--
2.14.1


Follow ups

References