Do-not-show-again section for common prefs & zone fill warning infobar.
Note that the dialogs which have mutliple options were not moved over as it seems perahps not the right choice to have them save state between sessions. Fixes https://gitlab.com/kicad/code/kicad/issues/8762
This commit is contained in:
parent
c74148fa88
commit
886dc2f43e
|
@ -348,7 +348,8 @@ void DIALOG_CONFIGURE_PATHS::OnGridCellChanging( wxGridEvent& event )
|
|||
|
||||
if( grid == m_EnvVars )
|
||||
{
|
||||
if( col == TV_VALUE_COL && m_EnvVars->GetCellValue( row, TV_FLAG_COL ).Length() )
|
||||
if( col == TV_VALUE_COL && m_EnvVars->GetCellValue( row, TV_FLAG_COL ).Length()
|
||||
&& !Pgm().GetCommonSettings()->m_DoNotShowAgain.env_var_overwrite_warning )
|
||||
{
|
||||
wxString msg1 = _( "This path was defined externally to the running process and\n"
|
||||
"will only be temporarily overwritten." );
|
||||
|
@ -361,14 +362,16 @@ void DIALOG_CONFIGURE_PATHS::OnGridCellChanging( wxGridEvent& event )
|
|||
dlg.ShowDetailedText( msg2 );
|
||||
dlg.DoNotShowCheckbox( __FILE__, __LINE__ );
|
||||
dlg.ShowModal();
|
||||
|
||||
if( dlg.DoNotShowAgain() )
|
||||
Pgm().GetCommonSettings()->m_DoNotShowAgain.env_var_overwrite_warning = true;
|
||||
}
|
||||
else if( col == TV_NAME_COL && m_EnvVars->GetCellValue( row, TV_NAME_COL ) != text )
|
||||
{
|
||||
// This env var name is reserved and cannot be added here.
|
||||
if( text == PROJECT_VAR_NAME )
|
||||
{
|
||||
wxMessageBox( wxString::Format(
|
||||
_( "The name %s is reserved, and cannot be used here" ),
|
||||
wxMessageBox( wxString::Format( _( "The name %s is reserved, and cannot be used." ),
|
||||
PROJECT_VAR_NAME ) );
|
||||
event.Veto();
|
||||
}
|
||||
|
|
|
@ -106,8 +106,6 @@ PGM_BASE::PGM_BASE()
|
|||
m_Printing = false;
|
||||
m_ModalDialogCount = 0;
|
||||
|
||||
m_show_env_var_dialog = true;
|
||||
|
||||
setLanguageId( wxLANGUAGE_DEFAULT );
|
||||
|
||||
ForceSystemPdfBrowser( false );
|
||||
|
@ -338,7 +336,6 @@ bool PGM_BASE::setExecutablePath()
|
|||
|
||||
void PGM_BASE::loadCommonSettings()
|
||||
{
|
||||
m_show_env_var_dialog = GetCommonSettings()->m_Env.show_warning_dialog;
|
||||
m_editor_name = GetCommonSettings()->m_System.editor_name;
|
||||
|
||||
for( const std::pair<wxString, ENV_VAR_ITEM> it : GetCommonSettings()->m_Env.vars )
|
||||
|
@ -369,10 +366,7 @@ void PGM_BASE::SaveCommonSettings()
|
|||
// GetCommonSettings() is not initialized until fairly late in the
|
||||
// process startup: InitPgm(), so test before using:
|
||||
if( GetCommonSettings() )
|
||||
{
|
||||
GetCommonSettings()->m_System.working_dir = wxGetCwd();
|
||||
GetCommonSettings()->m_Env.show_warning_dialog = m_show_env_var_dialog;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -97,9 +97,6 @@ COMMON_SETTINGS::COMMON_SETTINGS() :
|
|||
m_params.emplace_back( new PARAM<int>( "auto_backup.min_interval",
|
||||
&m_Backup.min_interval, 300 ) );
|
||||
|
||||
m_params.emplace_back( new PARAM<bool>( "environment.show_warning_dialog",
|
||||
&m_Env.show_warning_dialog, false ) );
|
||||
|
||||
m_params.emplace_back( new PARAM_LAMBDA<nlohmann::json>( "environment.vars",
|
||||
[&]() -> nlohmann::json
|
||||
{
|
||||
|
@ -276,6 +273,15 @@ COMMON_SETTINGS::COMMON_SETTINGS() :
|
|||
m_params.emplace_back( new PARAM<int>( "system.clear_3d_cache_interval",
|
||||
&m_System.clear_3d_cache_interval, 30 ) );
|
||||
|
||||
m_params.emplace_back( new PARAM<bool>( "do_not_show_again.zone_fill_warning",
|
||||
&m_DoNotShowAgain.zone_fill_warning, false ) );
|
||||
|
||||
m_params.emplace_back( new PARAM<bool>( "do_not_show_again.env_var_overwrite_warning",
|
||||
&m_DoNotShowAgain.env_var_overwrite_warning, false ) );
|
||||
|
||||
m_params.emplace_back( new PARAM<bool>( "do_not_show_again.scaled_3d_models_warning",
|
||||
&m_DoNotShowAgain.scaled_3d_models_warning, false ) );
|
||||
|
||||
m_params.emplace_back( new PARAM<bool>( "session.remember_open_files",
|
||||
&m_Session.remember_open_files, false ) );
|
||||
|
||||
|
|
|
@ -327,9 +327,6 @@ protected:
|
|||
wxString m_pdf_browser;
|
||||
wxString m_editor_name;
|
||||
|
||||
/// Flag to indicate if the environment variable overwrite warning dialog should be shown.
|
||||
bool m_show_env_var_dialog;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -69,7 +69,6 @@ public:
|
|||
|
||||
struct ENVIRONMENT
|
||||
{
|
||||
bool show_warning_dialog;
|
||||
ENV_VAR_MAP vars;
|
||||
};
|
||||
|
||||
|
@ -118,6 +117,13 @@ public:
|
|||
int clear_3d_cache_interval;
|
||||
};
|
||||
|
||||
struct DO_NOT_SHOW_AGAIN
|
||||
{
|
||||
bool zone_fill_warning;
|
||||
bool env_var_overwrite_warning;
|
||||
bool scaled_3d_models_warning;
|
||||
};
|
||||
|
||||
struct NETCLASS_PANEL
|
||||
{
|
||||
int sash_pos;
|
||||
|
@ -153,12 +159,9 @@ public:
|
|||
|
||||
SYSTEM m_System;
|
||||
|
||||
DO_NOT_SHOW_AGAIN m_DoNotShowAgain;
|
||||
|
||||
NETCLASS_PANEL m_NetclassPanel;
|
||||
|
||||
// TODO: These may not want to be in common
|
||||
wxString m_3DLibsUrl;
|
||||
|
||||
wxString m_3DLibsDownloadPath;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
#include <wx/stdpaths.h>
|
||||
#include <wx/process.h>
|
||||
|
||||
|
||||
#include <pgm_base.h>
|
||||
#include <board.h>
|
||||
#include <confirm.h>
|
||||
#include <dialog_export_step_base.h>
|
||||
|
@ -182,17 +182,21 @@ DIALOG_EXPORT_STEP::DIALOG_EXPORT_STEP( PCB_EDIT_FRAME* aParent, const wxString&
|
|||
break;
|
||||
}
|
||||
|
||||
if( !bad_scales.empty() )
|
||||
if( !bad_scales.empty()
|
||||
&& !Pgm().GetCommonSettings()->m_DoNotShowAgain.scaled_3d_models_warning )
|
||||
{
|
||||
wxString extendedMsg = _( "Non-unity scaled models:" ) + "\n" + bad_scales;
|
||||
|
||||
KIDIALOG msgDlg( m_parent, _( "Scaled models detected. "
|
||||
"Model scaling is not reliable for mechanical export." ),
|
||||
"Model scaling is not reliable for mechanical export." ),
|
||||
_( "Model Scale Warning" ), wxOK | wxICON_WARNING );
|
||||
msgDlg.SetExtendedMessage( extendedMsg );
|
||||
msgDlg.DoNotShowCheckbox( __FILE__, __LINE__ );
|
||||
|
||||
msgDlg.ShowModal();
|
||||
|
||||
if( msgDlg.DoNotShowAgain() )
|
||||
Pgm().GetCommonSettings()->m_DoNotShowAgain.scaled_3d_models_warning = true;
|
||||
}
|
||||
// Now all widgets have the size fixed, call FinishDialogSettings
|
||||
finishDialogSettings();
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
*/
|
||||
|
||||
#include "edit_tool.h"
|
||||
#include <pgm_base.h>
|
||||
#include "pcb_actions.h"
|
||||
#include "pcb_control.h"
|
||||
#include "pcb_picker_tool.h"
|
||||
|
@ -52,10 +53,11 @@
|
|||
#include <properties.h>
|
||||
#include <settings/color_settings.h>
|
||||
#include <tool/tool_manager.h>
|
||||
#include <view/view_controls.h>
|
||||
#include <footprint_viewer_frame.h>
|
||||
#include <footprint_edit_frame.h>
|
||||
#include <widgets/progress_reporter.h>
|
||||
#include <widgets/infobar.h>
|
||||
#include <wx/hyperlink.h>
|
||||
|
||||
using namespace std::placeholders;
|
||||
|
||||
|
@ -185,6 +187,53 @@ int PCB_CONTROL::ViaDisplayMode( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* We have bug reports indicating that some new users confuse zone filling/unfilling with the
|
||||
* display modes. This will put up a warning if they show zone fills when one or more zones
|
||||
* are unfilled.
|
||||
*/
|
||||
void PCB_CONTROL::unfilledZoneCheck()
|
||||
{
|
||||
if( Pgm().GetCommonSettings()->m_DoNotShowAgain.zone_fill_warning )
|
||||
return;
|
||||
|
||||
bool unfilledZones = false;
|
||||
|
||||
for( const ZONE* zone : board()->Zones() )
|
||||
{
|
||||
if( !zone->IsFilled() )
|
||||
{
|
||||
unfilledZones = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if( unfilledZones )
|
||||
{
|
||||
WX_INFOBAR* infobar = frame()->GetInfoBar();
|
||||
wxHyperlinkCtrl* button = new wxHyperlinkCtrl( infobar, wxID_ANY, _( "Don't show again" ),
|
||||
wxEmptyString );
|
||||
|
||||
button->Bind( wxEVT_COMMAND_HYPERLINK, std::function<void( wxHyperlinkEvent& aEvent )>(
|
||||
[&]( wxHyperlinkEvent& aEvent )
|
||||
{
|
||||
Pgm().GetCommonSettings()->m_DoNotShowAgain.zone_fill_warning = true;
|
||||
frame()->GetInfoBar()->Dismiss();
|
||||
} ) );
|
||||
|
||||
infobar->RemoveAllButtons();
|
||||
infobar->AddButton( button );
|
||||
|
||||
wxString msg;
|
||||
msg.Printf( _( "Not all zones are filled. Use Edit > Fill All Zones (%s) "
|
||||
"if you wish to see all fills." ),
|
||||
KeyNameFromKeyCode( PCB_ACTIONS::zoneFillAll.GetHotKey() ) );
|
||||
|
||||
infobar->ShowMessageFor( msg, 10000, wxICON_WARNING );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int PCB_CONTROL::ZoneDisplayMode( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
PCB_DISPLAY_OPTIONS opts = displayOptions();
|
||||
|
@ -192,22 +241,7 @@ int PCB_CONTROL::ZoneDisplayMode( const TOOL_EVENT& aEvent )
|
|||
// Apply new display options to the GAL canvas
|
||||
if( aEvent.IsAction( &PCB_ACTIONS::zoneDisplayFilled ) )
|
||||
{
|
||||
if( opts.m_ZoneDisplayMode == ZONE_DISPLAY_MODE::SHOW_FILLED )
|
||||
{
|
||||
// Check for user misunderstanding between fills and display mode
|
||||
for( const ZONE* zone : board()->Zones() )
|
||||
{
|
||||
if( !zone->IsFilled() )
|
||||
{
|
||||
wxString msg;
|
||||
msg.Printf( _( "Not all zones are filled. Use Edit > Fill All Zones (%s) "
|
||||
"if you wish to see all fills." ),
|
||||
KeyNameFromKeyCode( PCB_ACTIONS::zoneFillAll.GetHotKey() ) );
|
||||
m_frame->ShowInfoBarMsg( msg, true );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
unfilledZoneCheck();
|
||||
|
||||
opts.m_ZoneDisplayMode = ZONE_DISPLAY_MODE::SHOW_FILLED;
|
||||
}
|
||||
|
|
|
@ -100,6 +100,13 @@ private:
|
|||
///< Sets up handlers for various events.
|
||||
void setTransitions() override;
|
||||
|
||||
/**
|
||||
* We have bug reports indicating that some new users confuse zone filling/unfilling with
|
||||
* the display modes. This will put up a warning if they show zone fills when one or more
|
||||
* zones are unfilled.
|
||||
*/
|
||||
void unfilledZoneCheck();
|
||||
|
||||
/**
|
||||
* Add and select or just select for move/place command a list of board items.
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue