Allows custom number of entries in recently opened files menu.
NEW: Adds a configuration option to set number of entries in the "Open Recent" menu. Fixes: lp:1745729 * https://bugs.launchpad.net/kicad/+bug/1745729
This commit is contained in:
parent
6db71cd734
commit
8d625854b8
|
@ -24,11 +24,13 @@
|
|||
|
||||
#include <bin_mod.h>
|
||||
#include <common.h>
|
||||
#include <pgm_base.h>
|
||||
|
||||
|
||||
BIN_MOD::BIN_MOD( const char* aName ) :
|
||||
m_name( aName ),
|
||||
m_config( 0 )
|
||||
m_config( 0 ),
|
||||
m_history( 0 )
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -41,7 +43,13 @@ void BIN_MOD::Init()
|
|||
// wxWidgets' implementation of this is *very* expensive, and we don't use them anyway.
|
||||
m_config->SetExpandEnvVars( false );
|
||||
|
||||
m_history.Load( *m_config );
|
||||
// get file history size from common settings
|
||||
int fileHistorySize;
|
||||
Pgm().CommonSettings()->Read( FILE_HISTORY_SIZE, &fileHistorySize, DEFAULT_FILE_HISTORY_SIZE );
|
||||
|
||||
// file history size can only be set in wxFileHistory constructor
|
||||
m_history = new wxFileHistory( fileHistorySize );
|
||||
m_history->Load( *m_config );
|
||||
|
||||
// Prepare On Line Help. Use only lower case for help file names, in order to
|
||||
// avoid problems with upper/lower case file names under windows and unix.
|
||||
|
@ -57,7 +65,9 @@ void BIN_MOD::End()
|
|||
{
|
||||
if( m_config )
|
||||
{
|
||||
m_history.Save( *m_config );
|
||||
m_history->Save( *m_config );
|
||||
|
||||
delete m_history;
|
||||
|
||||
// Deleting a wxConfigBase writes its contents to disk if changed.
|
||||
// Might be NULL if called twice, in which case nothing happens.
|
||||
|
|
|
@ -28,7 +28,6 @@
|
|||
#include <bitmaps.h>
|
||||
#include "panel_common_settings.h"
|
||||
|
||||
|
||||
PANEL_COMMON_SETTINGS::PANEL_COMMON_SETTINGS( DIALOG_SHIM* aDialog, wxWindow* aParent ) :
|
||||
PANEL_COMMON_SETTINGS_BASE( aParent ),
|
||||
m_dialog( aDialog ),
|
||||
|
@ -52,6 +51,10 @@ bool PANEL_COMMON_SETTINGS::TransferDataToWindow()
|
|||
msg << timevalue / 60;
|
||||
m_SaveTime->SetValue( msg );
|
||||
|
||||
int fileHistorySize;
|
||||
commonSettings->Read( FILE_HISTORY_SIZE, &fileHistorySize, DEFAULT_FILE_HISTORY_SIZE );
|
||||
m_fileHistorySize->SetValue( fileHistorySize );
|
||||
|
||||
int scale_fourths;
|
||||
commonSettings->Read( ICON_SCALE_KEY, &scale_fourths );
|
||||
|
||||
|
@ -94,6 +97,8 @@ bool PANEL_COMMON_SETTINGS::TransferDataFromWindow()
|
|||
|
||||
commonSettings->Write( AUTOSAVE_INTERVAL_KEY, m_SaveTime->GetValue() * 60 );
|
||||
|
||||
commonSettings->Write( FILE_HISTORY_SIZE, m_fileHistorySize->GetValue() );
|
||||
|
||||
const int scale_fourths = m_scaleAuto->GetValue() ? -1 : m_scaleSlider->GetValue() / 25;
|
||||
commonSettings->Write( ICON_SCALE_KEY, scale_fourths );
|
||||
|
||||
|
|
|
@ -41,6 +41,13 @@ PANEL_COMMON_SETTINGS_BASE::PANEL_COMMON_SETTINGS_BASE( wxWindow* parent, wxWind
|
|||
|
||||
gbSizer1->Add( bSizer6, wxGBPosition( 0, 1 ), wxGBSpan( 1, 1 ), wxEXPAND, 5 );
|
||||
|
||||
m_staticTextFileHistorySize = new wxStaticText( this, wxID_ANY, _("File history size:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticTextFileHistorySize->Wrap( -1 );
|
||||
gbSizer1->Add( m_staticTextFileHistorySize, wxGBPosition( 1, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_fileHistorySize = new wxSpinCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 1, 100, 0 );
|
||||
gbSizer1->Add( m_fileHistorySize, wxGBPosition( 1, 1 ), wxGBSpan( 1, 1 ), wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
wxStaticText* textEditorLabel;
|
||||
textEditorLabel = new wxStaticText( this, wxID_ANY, _("Text editor:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
textEditorLabel->Wrap( -1 );
|
||||
|
|
|
@ -200,16 +200,16 @@
|
|||
<property name="flag">wxEXPAND</property>
|
||||
<property name="row">0</property>
|
||||
<property name="rowspan">1</property>
|
||||
<object class="wxBoxSizer" expanded="1">
|
||||
<object class="wxBoxSizer" expanded="0">
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">bSizer6</property>
|
||||
<property name="orient">wxHORIZONTAL</property>
|
||||
<property name="permission">none</property>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<object class="sizeritem" expanded="0">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxTOP|wxBOTTOM|wxLEFT</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxSpinCtrl" expanded="1">
|
||||
<object class="wxSpinCtrl" expanded="0">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
|
@ -293,11 +293,11 @@
|
|||
<event name="OnUpdateUI"></event>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<object class="sizeritem" expanded="0">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxStaticText" expanded="1">
|
||||
<object class="wxStaticText" expanded="0">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
|
@ -378,6 +378,183 @@
|
|||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object class="gbsizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="colspan">1</property>
|
||||
<property name="column">0</property>
|
||||
<property name="flag">wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT</property>
|
||||
<property name="row">1</property>
|
||||
<property name="rowspan">1</property>
|
||||
<object class="wxStaticText" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">File history size:</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_staticTextFileHistorySize</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass">; forward_declare</property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<property name="wrap">-1</property>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
<event name="OnKeyDown"></event>
|
||||
<event name="OnKeyUp"></event>
|
||||
<event name="OnKillFocus"></event>
|
||||
<event name="OnLeaveWindow"></event>
|
||||
<event name="OnLeftDClick"></event>
|
||||
<event name="OnLeftDown"></event>
|
||||
<event name="OnLeftUp"></event>
|
||||
<event name="OnMiddleDClick"></event>
|
||||
<event name="OnMiddleDown"></event>
|
||||
<event name="OnMiddleUp"></event>
|
||||
<event name="OnMotion"></event>
|
||||
<event name="OnMouseEvents"></event>
|
||||
<event name="OnMouseWheel"></event>
|
||||
<event name="OnPaint"></event>
|
||||
<event name="OnRightDClick"></event>
|
||||
<event name="OnRightDown"></event>
|
||||
<event name="OnRightUp"></event>
|
||||
<event name="OnSetFocus"></event>
|
||||
<event name="OnSize"></event>
|
||||
<event name="OnUpdateUI"></event>
|
||||
</object>
|
||||
</object>
|
||||
<object class="gbsizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="colspan">1</property>
|
||||
<property name="column">1</property>
|
||||
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT</property>
|
||||
<property name="row">1</property>
|
||||
<property name="rowspan">1</property>
|
||||
<object class="wxSpinCtrl" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="initial">0</property>
|
||||
<property name="max">100</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min">1</property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_fileHistorySize</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style">wxSP_ARROW_KEYS</property>
|
||||
<property name="subclass">; forward_declare</property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="value"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
<event name="OnKeyDown"></event>
|
||||
<event name="OnKeyUp"></event>
|
||||
<event name="OnKillFocus"></event>
|
||||
<event name="OnLeaveWindow"></event>
|
||||
<event name="OnLeftDClick"></event>
|
||||
<event name="OnLeftDown"></event>
|
||||
<event name="OnLeftUp"></event>
|
||||
<event name="OnMiddleDClick"></event>
|
||||
<event name="OnMiddleDown"></event>
|
||||
<event name="OnMiddleUp"></event>
|
||||
<event name="OnMotion"></event>
|
||||
<event name="OnMouseEvents"></event>
|
||||
<event name="OnMouseWheel"></event>
|
||||
<event name="OnPaint"></event>
|
||||
<event name="OnRightDClick"></event>
|
||||
<event name="OnRightDown"></event>
|
||||
<event name="OnRightUp"></event>
|
||||
<event name="OnSetFocus"></event>
|
||||
<event name="OnSize"></event>
|
||||
<event name="OnSpinCtrl"></event>
|
||||
<event name="OnSpinCtrlText"></event>
|
||||
<event name="OnTextEnter"></event>
|
||||
<event name="OnUpdateUI"></event>
|
||||
</object>
|
||||
</object>
|
||||
<object class="gbsizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="colspan">1</property>
|
||||
|
|
|
@ -50,6 +50,8 @@ class PANEL_COMMON_SETTINGS_BASE : public wxPanel
|
|||
|
||||
wxStaticText* m_staticTextautosave;
|
||||
wxSpinCtrl* m_SaveTime;
|
||||
wxStaticText* m_staticTextFileHistorySize;
|
||||
wxSpinCtrl* m_fileHistorySize;
|
||||
wxTextCtrl* m_textEditorPath;
|
||||
wxBitmapButton* m_textEditorBtn;
|
||||
wxRadioButton* m_defaultPDFViewer;
|
||||
|
|
|
@ -55,7 +55,7 @@ struct BIN_MOD
|
|||
const char* m_name; ///< name of this binary module, static C string.
|
||||
|
||||
wxConfigBase* m_config; ///< maybe from $HOME/.${m_name}
|
||||
wxFileHistory m_history;
|
||||
wxFileHistory* m_history;
|
||||
wxString m_help_file;
|
||||
|
||||
SEARCH_STACK m_search;
|
||||
|
|
|
@ -120,7 +120,7 @@ public:
|
|||
*/
|
||||
const wxString& GetHelpFileName() const { return m_bm.m_help_file; }
|
||||
|
||||
wxFileHistory& GetFileHistory() { return m_bm.m_history; }
|
||||
wxFileHistory& GetFileHistory() { return *m_bm.m_history; }
|
||||
|
||||
/// Only for DSO specific 'non-library' files.
|
||||
/// (The library search path is in the PROJECT class.)
|
||||
|
|
|
@ -47,9 +47,12 @@
|
|||
#define ENBL_MOUSEWHEEL_PAN_KEY wxT( "MousewheelPAN" )
|
||||
#define MIDDLE_BUTT_PAN_LIMITED_KEY wxT( "MiddleBtnPANLimited" )
|
||||
#define ENBL_AUTO_PAN_KEY wxT( "AutoPAN" )
|
||||
#define FILE_HISTORY_SIZE wxT( "FileHistorySize" )
|
||||
|
||||
///@}
|
||||
|
||||
/// The default file history size is 9.
|
||||
#define DEFAULT_FILE_HISTORY_SIZE 9
|
||||
|
||||
class wxConfigBase;
|
||||
class wxSingleInstanceChecker;
|
||||
|
|
|
@ -54,7 +54,7 @@ public:
|
|||
|
||||
void MacOpenFile( const wxString& aFileName ) override;
|
||||
|
||||
wxFileHistory& GetFileHistory() { return m_bm.m_history; }
|
||||
wxFileHistory& GetFileHistory() { return *m_bm.m_history; }
|
||||
|
||||
wxConfigBase* PgmSettings() { return m_bm.m_config; }
|
||||
|
||||
|
|
Loading…
Reference in New Issue