Fix saving undo/redo limits in Eeschema.
This commit is contained in:
parent
ecb046ad0e
commit
fa29c62277
|
@ -676,8 +676,8 @@ void EDA_DRAW_FRAME::LoadSettings( wxConfigBase* aCfg )
|
|||
if( m_LastGridSizeId < 0 )
|
||||
m_LastGridSizeId = 0;
|
||||
|
||||
GetScreen()->SetMaxUndoItems( aCfg->Read( baseCfgName + MaxUndoItemsEntry,
|
||||
long( DEFAULT_MAX_UNDO_ITEMS ) ) );
|
||||
m_UndoRedoCountMax = aCfg->Read( baseCfgName + MaxUndoItemsEntry,
|
||||
long( DEFAULT_MAX_UNDO_ITEMS ) );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -430,7 +430,9 @@ bool SCH_EDIT_FRAME::AppendOneEEProject()
|
|||
sheet->SetName( tmp );
|
||||
|
||||
sheet->SetFileName( wxString::Format( wxT( "file%8.8lX.sch" ), (long) newtimestamp ) );
|
||||
sheet->SetScreen( new SCH_SCREEN( &Kiway() ) );
|
||||
SCH_SCREEN* screen = new SCH_SCREEN( &Kiway() );
|
||||
screen->SetMaxUndoItems( m_UndoRedoCountMax );
|
||||
sheet->SetScreen( screen );
|
||||
sheet->GetScreen()->SetFileName( sheet->GetFileName() );
|
||||
}
|
||||
// clear annotation and init new time stamp for the new components
|
||||
|
|
|
@ -208,13 +208,14 @@ LIB_EDIT_FRAME::LIB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
|||
icon.CopyFromBitmap( KiBitmap( libedit_icon_xpm ) );
|
||||
SetIcon( icon );
|
||||
|
||||
LoadSettings( config() );
|
||||
|
||||
SetScreen( new SCH_SCREEN( aKiway ) );
|
||||
GetScreen()->m_Center = true;
|
||||
GetScreen()->SetMaxUndoItems( m_UndoRedoCountMax );
|
||||
|
||||
SetCrossHairPosition( wxPoint( 0, 0 ) );
|
||||
|
||||
LoadSettings( config() );
|
||||
|
||||
// Ensure m_LastGridSizeId is an offset inside the allowed schematic range
|
||||
if( m_LastGridSizeId < ID_POPUP_GRID_LEVEL_50 - ID_POPUP_GRID_LEVEL_1000 )
|
||||
m_LastGridSizeId = ID_POPUP_GRID_LEVEL_50 - ID_POPUP_GRID_LEVEL_1000;
|
||||
|
|
|
@ -66,6 +66,9 @@ bool SCH_EDIT_FRAME::LoadOneEEFile( SCH_SCREEN* aScreen, const wxString& aFullFi
|
|||
if( aFullFileName.IsEmpty() )
|
||||
return false;
|
||||
|
||||
// Place the undo limit into the screen
|
||||
aScreen->SetMaxUndoItems( m_UndoRedoCountMax );
|
||||
|
||||
// If path is relative, this expands it from the project directory.
|
||||
wxString fname = Prj().AbsolutePath( aFullFileName );
|
||||
|
||||
|
|
|
@ -755,9 +755,9 @@ bool SCH_SHEET::Load( SCH_EDIT_FRAME* aFrame )
|
|||
{
|
||||
bool success = true;
|
||||
|
||||
SCH_SCREEN* screen = NULL;
|
||||
if( !m_screen )
|
||||
{
|
||||
SCH_SCREEN* screen = NULL;
|
||||
g_RootSheet->SearchHierarchy( m_fileName, &screen );
|
||||
|
||||
if( screen )
|
||||
|
|
|
@ -348,8 +348,6 @@ SCH_EDIT_FRAME::SCH_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ):
|
|||
SetSpiceAddReferencePrefix( false );
|
||||
SetSpiceUseNetcodeAsNetname( false );
|
||||
|
||||
CreateScreens();
|
||||
|
||||
// Give an icon
|
||||
wxIcon icon;
|
||||
icon.CopyFromBitmap( KiBitmap( icon_eeschema_xpm ) );
|
||||
|
@ -361,6 +359,8 @@ SCH_EDIT_FRAME::SCH_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ):
|
|||
|
||||
LoadSettings( config() );
|
||||
|
||||
CreateScreens();
|
||||
|
||||
// Ensure m_LastGridSizeId is an offset inside the allowed schematic grid range
|
||||
if( !GetScreen()->GridExists( m_LastGridSizeId + ID_POPUP_GRID_LEVEL_1000 ) )
|
||||
m_LastGridSizeId = default_grid;
|
||||
|
@ -523,7 +523,9 @@ void SCH_EDIT_FRAME::CreateScreens()
|
|||
|
||||
if( g_RootSheet->GetScreen() == NULL )
|
||||
{
|
||||
g_RootSheet->SetScreen( new SCH_SCREEN( &Kiway() ) );
|
||||
SCH_SCREEN* screen = new SCH_SCREEN( &Kiway() );
|
||||
screen->SetMaxUndoItems( m_UndoRedoCountMax );
|
||||
g_RootSheet->SetScreen( screen );
|
||||
SetScreen( g_RootSheet->GetScreen() );
|
||||
}
|
||||
|
||||
|
@ -533,7 +535,11 @@ void SCH_EDIT_FRAME::CreateScreens()
|
|||
m_CurrentSheet->Push( g_RootSheet );
|
||||
|
||||
if( GetScreen() == NULL )
|
||||
SetScreen( new SCH_SCREEN( &Kiway() ) );
|
||||
{
|
||||
SCH_SCREEN* screen = new SCH_SCREEN( &Kiway() );
|
||||
screen->SetMaxUndoItems( m_UndoRedoCountMax );
|
||||
SetScreen( screen );
|
||||
}
|
||||
|
||||
GetScreen()->SetZoom( 32.0 );
|
||||
}
|
||||
|
|
|
@ -141,6 +141,7 @@ bool SCH_EDIT_FRAME::EditSheet( SCH_SHEET* aSheet, SCH_SHEET_PATH* aHierarchy )
|
|||
else // New file.
|
||||
{
|
||||
aSheet->SetScreen( new SCH_SCREEN( &Kiway() ) );
|
||||
aSheet->GetScreen()->SetMaxUndoItems( m_UndoRedoCountMax );
|
||||
aSheet->GetScreen()->SetFileName( newFilename );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,15 +31,12 @@
|
|||
#ifndef CLASS_BASE_SCREEN_H_
|
||||
#define CLASS_BASE_SCREEN_H_
|
||||
|
||||
#include <draw_frame.h>
|
||||
#include <base_struct.h>
|
||||
#include <class_undoredo_container.h>
|
||||
#include <block_commande.h>
|
||||
#include <common.h>
|
||||
#include <id.h>
|
||||
#include <climits>
|
||||
|
||||
#define DEFAULT_MAX_UNDO_ITEMS 0
|
||||
#define ABS_MAX_UNDO_ITEMS (INT_MAX / 2)
|
||||
|
||||
/**
|
||||
* Class GRID_TYPE
|
||||
|
|
|
@ -27,10 +27,14 @@
|
|||
|
||||
#include <wxstruct.h>
|
||||
#include <kiway_player.h>
|
||||
#include <climits>
|
||||
|
||||
class wxSingleInstanceChecker;
|
||||
class EDA_HOTKEY;
|
||||
|
||||
#define DEFAULT_MAX_UNDO_ITEMS 0
|
||||
#define ABS_MAX_UNDO_ITEMS (INT_MAX / 2)
|
||||
|
||||
/**
|
||||
* Class EDA_DRAW_FRAME
|
||||
* is the base class for create windows for drawing purpose. The Eeschema, Pcbnew and
|
||||
|
@ -68,6 +72,8 @@ protected:
|
|||
double m_zoomLevelCoeff; ///< a suitable value to convert the internal zoom scaling factor
|
||||
// to a zoom level value which rougly gives 1.0 when the board/schematic
|
||||
// is at scale = 1
|
||||
int m_UndoRedoCountMax; ///< default Undo/Redo command Max depth, to be handed
|
||||
// to screens
|
||||
|
||||
/// The area to draw on.
|
||||
EDA_DRAW_PANEL* m_canvas;
|
||||
|
|
|
@ -246,10 +246,10 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
|||
wxFont font = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT );
|
||||
m_Layers = new PCB_LAYER_WIDGET( this, GetCanvas(), font.GetPointSize(), true );
|
||||
|
||||
SetScreen( new PCB_SCREEN( GetPageSettings().GetSizeIU() ) );
|
||||
|
||||
GetScreen()->SetCurItem( NULL );
|
||||
LoadSettings( config() );
|
||||
SetScreen( new PCB_SCREEN( GetPageSettings().GetSizeIU() ) );
|
||||
GetScreen()->SetMaxUndoItems( m_UndoRedoCountMax );
|
||||
GetScreen()->SetCurItem( NULL );
|
||||
|
||||
GetScreen()->AddGrid( m_UserGridSize, m_UserGridUnit, ID_POPUP_GRID_USER );
|
||||
GetScreen()->SetGrid( ID_POPUP_GRID_LEVEL_1000 + m_LastGridSizeId );
|
||||
|
|
|
@ -352,15 +352,16 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
|||
icon.CopyFromBitmap( KiBitmap( icon_pcbnew_xpm ) );
|
||||
SetIcon( icon );
|
||||
|
||||
SetScreen( new PCB_SCREEN( GetPageSettings().GetSizeIU() ) );
|
||||
|
||||
// PCB drawings start in the upper left corner.
|
||||
GetScreen()->m_Center = false;
|
||||
|
||||
// LoadSettings() *after* creating m_LayersManager, because LoadSettings()
|
||||
// initialize parameters in m_LayersManager
|
||||
LoadSettings( config() );
|
||||
|
||||
SetScreen( new PCB_SCREEN( GetPageSettings().GetSizeIU() ) );
|
||||
GetScreen()->SetMaxUndoItems( m_UndoRedoCountMax );
|
||||
|
||||
// PCB drawings start in the upper left corner.
|
||||
GetScreen()->m_Center = false;
|
||||
|
||||
SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
|
||||
|
||||
GetScreen()->AddGrid( m_UserGridSize, m_UserGridUnit, ID_POPUP_GRID_USER );
|
||||
|
|
Loading…
Reference in New Issue