Commit 121b65bf authored by Wayne Stambaugh's avatar Wayne Stambaugh

More auto save improvements.

* Factor test for auto save file into base frame class.
* Added auto save feature to Eeschema for saving schematics, addresses
  launchpad question 173631.
* Add auto save interval control to Eeschema options dialog.
* Fix problem with subsequent auto saves in last commit.
parent 8e6ac6c5
/********************************************************/
/* base_screen.cpp - BASE_SCREEN object implementation. */
/********************************************************/
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2009 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifdef __GNUG__
#pragma implementation
#endif
/**
* @file base_screen.cpp
* @brief BASE_SCREEN object implementation.
*/
#include "fctsys.h"
#include "common.h"
......@@ -19,12 +41,11 @@
BASE_SCREEN::BASE_SCREEN( KICAD_T aType ) : EDA_ITEM( aType )
{
m_drawList = NULL; /* Draw items list */
m_UndoRedoCountMax = 10; /* undo/Redo command Max depth, 10 is a
* reasonable value */
m_UndoRedoCountMax = 10; /* undo/Redo command Max depth, 10 is a reasonable value */
m_FirstRedraw = TRUE;
m_ScreenNumber = 1;
m_NumberOfScreen = 1; /* Hierarchy: Root: ScreenNumber = 1 */
m_Zoom = 32.0;
m_Zoom = 32.0;
m_Grid.m_Size = wxRealPoint( 50, 50 ); /* Default grid size */
m_Grid.m_Id = ID_POPUP_GRID_LEVEL_50;
m_Center = true;
......@@ -61,8 +82,8 @@ void BASE_SCREEN::InitDatas()
SetCurItem( NULL );
m_FlagModified = 0; // Set when any change is made on broad
m_FlagSave = 1; // Used in auto save: set when an auto save is made
m_FlagModified = false; // Set when any change is made on broad.
m_FlagSave = false; // Used in auto save set when an auto save is required.
}
......@@ -450,8 +471,6 @@ void BASE_SCREEN::SetCrossHairPosition( const wxPoint& aPosition, bool aSnapToGr
}
/* free the undo and the redo lists
*/
void BASE_SCREEN::ClearUndoRedoList()
{
ClearUndoORRedoList( m_UndoList );
......@@ -459,9 +478,6 @@ void BASE_SCREEN::ClearUndoRedoList()
}
/* Put aNewitem in top of undo list
* Deletes old items if > count max.
*/
void BASE_SCREEN::PushCommandToUndoList( PICKED_ITEMS_LIST* aNewitem )
{
m_UndoList.PushCommand( aNewitem );
......@@ -515,13 +531,7 @@ void BASE_SCREEN::InsertItem( EDA_ITEMS::iterator aIter, EDA_ITEM* aItem )
#if defined(DEBUG)
/**
* Function Show
* is used to output the object tree, currently for debugging only.
* @param nestLevel An aid to prettier tree indenting, and is the level
* of nesting of this object within the overall tree.
* @param os The ostream& to output to.
*/
void BASE_SCREEN::Show( int nestLevel, std::ostream& os )
{
EDA_ITEM* item = m_drawList;
......@@ -536,4 +546,5 @@ void BASE_SCREEN::Show( int nestLevel, std::ostream& os )
NestedSpace( nestLevel, os ) << "</" << GetClass().Lower().mb_str() << ">\n";
}
#endif
......@@ -49,6 +49,9 @@
#define DEFAULT_AUTO_SAVE_INTERVAL 600
const wxChar* traceAutoSave = wxT( "KicadAutoSave" );
/// Configuration file entry name for auto save interval.
static const wxChar* entryAutoSaveInterval = wxT( "AutoSaveInterval" );
......@@ -116,15 +119,17 @@ bool EDA_BASE_FRAME::ProcessEvent( wxEvent& aEvent )
if( !wxFrame::ProcessEvent( aEvent ) )
return false;
if( m_hasAutoSave && (m_autoSaveState != isModified()) && (m_autoSaveInterval > 0) )
if( m_hasAutoSave && (m_autoSaveState != isAutoSaveRequired()) && (m_autoSaveInterval > 0) )
{
if( !m_autoSaveState )
{
wxLogTrace( traceAutoSave, wxT( "Starting auto save timer." ) );
m_autoSaveTimer->Start( m_autoSaveInterval * 1000, wxTIMER_ONE_SHOT );
m_autoSaveState = true;
}
else
else if( m_autoSaveTimer->IsRunning() )
{
wxLogTrace( traceAutoSave, wxT( "Stopping auto save timer." ) );
m_autoSaveTimer->Stop();
m_autoSaveState = false;
}
......@@ -569,3 +574,70 @@ bool EDA_BASE_FRAME::IsWritable( const wxFileName& aFileName )
return true;
}
void EDA_BASE_FRAME::CheckForAutoSaveFile( const wxFileName& aFileName,
const wxString& aBackupFileExtension )
{
wxCHECK_RET( aFileName.IsOk(), wxT( "Invalid file name!" ) );
wxCHECK_RET( !aBackupFileExtension.IsEmpty(), wxT( "Invalid backup file extension!" ) );
wxFileName autoSaveFileName = aFileName;
// Check for auto save file.
autoSaveFileName.SetName( wxT( "$" ) + aFileName.GetName() );
wxLogTrace( traceAutoSave,
wxT( "Checking for auto save file " ) + autoSaveFileName.GetFullPath() );
if( !autoSaveFileName.FileExists() )
return;
wxString msg;
msg.Printf( _( "Well this is potentially embarrassing! It appears that the last time \
you were editing the file <%s> it was not saved properly. Do you wish to restore the last \
edits you made?" ),
GetChars( aFileName.GetFullName() ) );
int response = wxMessageBox( msg, wxGetApp().GetAppName(), wxYES_NO | wxICON_QUESTION, this );
// Make a backup of the current file, delete the file, and rename the auto save file to
// the file name.
if( response == wxYES )
{
// Get the backup file name.
wxFileName backupFileName = aFileName;
backupFileName.SetExt( aBackupFileExtension );
// If an old backup file exists, delete it. If an old copy of the file exists, rename
// it to the backup file name
if( aFileName.FileExists() )
{
// Remove the old file backup file.
if( backupFileName.FileExists() )
wxRemoveFile( backupFileName.GetFullPath() );
// Rename the old file to the backup file name.
if( !wxRenameFile( aFileName.GetFullPath(), backupFileName.GetFullPath() ) )
{
msg = _( "Could not create backup file " ) + backupFileName.GetFullPath();
DisplayError( this, msg );
}
}
if( !wxRenameFile( autoSaveFileName.GetFullPath(), aFileName.GetFullPath() ) )
{
wxMessageBox( _( "The auto save file could not be renamed to the board file name." ),
wxGetApp().GetAppName(), wxOK | wxICON_EXCLAMATION, this );
}
}
else
{
wxLogTrace( traceAutoSave,
wxT( "Removing auto save file " ) + autoSaveFileName.GetFullPath() );
// Remove the auto save file when using the previous file as is.
wxRemoveFile( autoSaveFileName.GetFullPath() );
}
}
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2009 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/**
* @file dialog_eeschema_options.cpp
*/
#include "fctsys.h"
#include "class_base_screen.h"
......
#ifndef __dialog_eeschema_options__
#define __dialog_eeschema_options__
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2009 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/**
* @file
* @file dialog_eeschema_options.h
*
* Subclass of DIALOG_EESCHEMA_OPTIONS_BASE, which is generated by wxFormBuilder.
*/
#ifndef __dialog_eeschema_options__
#define __dialog_eeschema_options__
#include "dialog_eeschema_options_base.h"
class DIALOG_EESCHEMA_OPTIONS : public DIALOG_EESCHEMA_OPTIONS_BASE
......@@ -56,6 +81,9 @@ public:
}
int GetRepeatLabel( void ) { return m_spinRepeatLabel->GetValue(); }
void SetAutoSaveInterval( int aInterval ) { m_spinAutoSaveInterval->SetValue( aInterval ); }
int GetAutoSaveInterval() const { return m_spinAutoSaveInterval->GetValue(); }
void SetShowGrid( bool show ) { m_checkShowGrid->SetValue( show ); }
bool GetShowGrid( void ) { return m_checkShowGrid->GetValue(); }
......
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Nov 17 2010)
// C++ code generated with wxFormBuilder (version Sep 8 2010)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
......@@ -16,7 +16,6 @@ END_EVENT_TABLE()
DIALOG_EESCHEMA_OPTIONS_BASE::DIALOG_EESCHEMA_OPTIONS_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
this->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_BTNFACE ) );
wxBoxSizer* mainSizer;
mainSizer = new wxBoxSizer( wxVERTICAL );
......@@ -25,9 +24,9 @@ DIALOG_EESCHEMA_OPTIONS_BASE::DIALOG_EESCHEMA_OPTIONS_BASE( wxWindow* parent, wx
bOptionsSizer = new wxBoxSizer( wxVERTICAL );
m_notebook1 = new wxNotebook( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
m_panel1 = new wxPanel( m_notebook1, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
m_panel1->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_BTNFACE ) );
m_notebook1->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_BTNFACE ) );
m_panel1 = new wxPanel( m_notebook1, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
wxBoxSizer* p1mainSizer;
p1mainSizer = new wxBoxSizer( wxHORIZONTAL );
......@@ -35,7 +34,7 @@ DIALOG_EESCHEMA_OPTIONS_BASE::DIALOG_EESCHEMA_OPTIONS_BASE( wxWindow* parent, wx
bSizer3 = new wxBoxSizer( wxVERTICAL );
wxFlexGridSizer* fgSizer1;
fgSizer1 = new wxFlexGridSizer( 7, 3, 0, 0 );
fgSizer1 = new wxFlexGridSizer( 8, 3, 0, 0 );
fgSizer1->AddGrowableCol( 0 );
fgSizer1->AddGrowableCol( 1 );
fgSizer1->AddGrowableCol( 2 );
......@@ -121,6 +120,17 @@ DIALOG_EESCHEMA_OPTIONS_BASE::DIALOG_EESCHEMA_OPTIONS_BASE( wxWindow* parent, wx
fgSizer1->Add( 0, 0, 1, wxALIGN_CENTER_VERTICAL|wxEXPAND, 3 );
m_staticText221 = new wxStaticText( m_panel1, wxID_ANY, _("Auto save time interval:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText221->Wrap( -1 );
fgSizer1->Add( m_staticText221, 1, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
m_spinAutoSaveInterval = new wxSpinCtrl( m_panel1, ID_M_SPINAUTOSAVEINTERVAL, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 1000, 10 );
fgSizer1->Add( m_spinAutoSaveInterval, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND, 3 );
m_staticText23 = new wxStaticText( m_panel1, wxID_ANY, _("minutes"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText23->Wrap( -1 );
fgSizer1->Add( m_staticText23, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
bSizer3->Add( fgSizer1, 0, wxALIGN_CENTER|wxEXPAND, 0 );
wxBoxSizer* bSizer2;
......@@ -153,7 +163,6 @@ DIALOG_EESCHEMA_OPTIONS_BASE::DIALOG_EESCHEMA_OPTIONS_BASE( wxWindow* parent, wx
p1mainSizer->Fit( m_panel1 );
m_notebook1->AddPage( m_panel1, _("General Options"), true );
m_panel2 = new wxPanel( m_notebook1, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
m_panel2->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_BTNFACE ) );
m_panel2->SetToolTip( _("User defined field names for schematic components. ") );
wxBoxSizer* bSizer6;
......
This source diff could not be displayed because it is too large. You can view the blob instead.
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Nov 17 2010)
// C++ code generated with wxFormBuilder (version Sep 8 2010)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
......@@ -44,6 +44,11 @@ class DIALOG_EESCHEMA_OPTIONS_BASE : public wxDialog
protected:
enum
{
ID_M_SPINAUTOSAVEINTERVAL = 1000,
};
wxNotebook* m_notebook1;
wxPanel* m_panel1;
wxStaticText* m_staticText2;
......@@ -67,6 +72,9 @@ class DIALOG_EESCHEMA_OPTIONS_BASE : public wxDialog
wxStaticText* m_staticText16;
wxSpinCtrl* m_spinRepeatLabel;
wxStaticText* m_staticText221;
wxSpinCtrl* m_spinAutoSaveInterval;
wxStaticText* m_staticText23;
wxCheckBox* m_checkShowGrid;
wxCheckBox* m_checkShowHiddenPins;
wxCheckBox* m_checkAutoPan;
......@@ -101,7 +109,7 @@ class DIALOG_EESCHEMA_OPTIONS_BASE : public wxDialog
public:
DIALOG_EESCHEMA_OPTIONS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Schematic Editor Options"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
DIALOG_EESCHEMA_OPTIONS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Schematic Editor Options"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_EESCHEMA_OPTIONS_BASE();
};
......
......@@ -39,6 +39,7 @@ wxString g_NetCmpExtBuffer( wxT( "cmp" ) );
const wxString SymbolFileExtension( wxT( "sym" ) );
const wxString CompLibFileExtension( wxT( "lib" ) );
const wxString g_SchematicBackupFileExtension( wxT( "bak" ) );
const wxString SymbolFileWildcard( wxT( "KiCad drawing symbol file (*.sym)|*.sym" ) );
const wxString CompLibFileWildcard( wxT( "KiCad component library file (*.lib)|*.lib" ) );
......
......@@ -189,6 +189,7 @@ void SCH_EDIT_FRAME::OnSetOptions( wxCommandEvent& event )
dlg.SetRepeatHorizontal( g_RepeatStep.x );
dlg.SetRepeatVertical( g_RepeatStep.y );
dlg.SetRepeatLabel( g_RepeatDeltaLabel );
dlg.SetAutoSaveInterval( GetAutoSaveInterval() / 60 );
dlg.SetShowGrid( IsGridVisible() );
dlg.SetShowHiddenPins( m_ShowAllPins );
dlg.SetEnableAutoPan( DrawPanel->m_AutoPAN_Enable );
......@@ -219,6 +220,7 @@ void SCH_EDIT_FRAME::OnSetOptions( wxCommandEvent& event )
g_RepeatStep.x = dlg.GetRepeatHorizontal();
g_RepeatStep.y = dlg.GetRepeatVertical();
g_RepeatDeltaLabel = dlg.GetRepeatLabel();
SetAutoSaveInterval( dlg.GetAutoSaveInterval() * 60 );
SetGridVisibility( dlg.GetShowGrid() );
m_ShowAllPins = dlg.GetShowHiddenPins();
DrawPanel->m_AutoPAN_Enable = dlg.GetEnableAutoPan();
......
/****************************/
/* EESCHEMA - files-io.cpp */
/****************************/
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/**
* @file files-io.cpp
*/
#include "fctsys.h"
#include "class_drawpanel.h"
......@@ -16,7 +41,7 @@
#include "sch_sheet.h"
bool SCH_EDIT_FRAME::SaveEEFile( SCH_SCREEN* aScreen, int aSaveType )
bool SCH_EDIT_FRAME::SaveEEFile( SCH_SCREEN* aScreen, int aSaveType, bool aCreateBackupFile )
{
wxString msg;
wxFileName schematicFileName, backupFileName;
......@@ -33,23 +58,28 @@ bool SCH_EDIT_FRAME::SaveEEFile( SCH_SCREEN* aScreen, int aSaveType )
{
case FILE_SAVE_AS:
schematicFileName = aScreen->GetFileName();
backupFileName = schematicFileName;
if( !IsWritable( schematicFileName ) )
return false;
/* Rename the old file to a '.bak' one: */
if( schematicFileName.FileExists() )
if( aCreateBackupFile )
{
backupFileName.SetExt( wxT( "bak" ) );
wxRemoveFile( backupFileName.GetFullPath() );
backupFileName = schematicFileName;
if( !wxRenameFile( schematicFileName.GetFullPath(), backupFileName.GetFullPath() ) )
if( !IsWritable( schematicFileName ) )
return false;
/* Rename the old file to a '.bak' one: */
if( schematicFileName.FileExists() )
{
DisplayError( this, _( "Could not save backup of file <" ) +
schematicFileName.GetFullPath() + wxT( ">." ) );
backupFileName.SetExt( g_SchematicBackupFileExtension );
wxRemoveFile( backupFileName.GetFullPath() );
if( !wxRenameFile( schematicFileName.GetFullPath(), backupFileName.GetFullPath() ) )
{
DisplayError( this, _( "Could not save backup of file <" ) +
schematicFileName.GetFullPath() + wxT( ">." ) );
}
}
}
break;
case FILE_SAVE_NEW:
......@@ -76,6 +106,9 @@ bool SCH_EDIT_FRAME::SaveEEFile( SCH_SCREEN* aScreen, int aSaveType )
break;
}
wxLogTrace( traceAutoSave,
wxT( "Saving file <" ) + schematicFileName.GetFullPath() + wxT( ">" ) );
if( ( f = wxFopen( schematicFileName.GetFullPath(), wxT( "wt" ) ) ) == NULL )
{
msg = _( "Failed to create file " ) + schematicFileName.GetFullPath();
......@@ -94,6 +127,20 @@ bool SCH_EDIT_FRAME::SaveEEFile( SCH_SCREEN* aScreen, int aSaveType )
}
else
{
// Delete auto save file on successful save.
wxFileName autoSaveFileName = schematicFileName;
autoSaveFileName.SetName( wxT( "$" ) + schematicFileName.GetName() );
if( autoSaveFileName.FileExists() )
{
wxLogTrace( traceAutoSave,
wxT( "Removing auto save file <" ) + autoSaveFileName.GetFullPath() +
wxT( ">" ) );
wxRemoveFile( autoSaveFileName.GetFullPath() );
}
aScreen->ClrSave();
aScreen->ClrModify();
wxString msg;
msg.Printf( _( "File %s saved" ), GetChars( aScreen->GetFileName() ) );
......@@ -284,7 +331,7 @@ bool SCH_EDIT_FRAME::LoadOneEEProject( const wxString& aFileName, bool aIsNew )
Zoom_Automatique( false );
msg.Printf( _( "File <%s> not found." ),
GetChars( g_RootSheet->GetScreen()->GetFileName() ) );
DisplayInfoMessage( this, msg, 0 );
DisplayInfoMessage( this, msg );
return false;
}
......@@ -319,7 +366,6 @@ void SCH_EDIT_FRAME::OnSaveProject( wxCommandEvent& aEvent )
for( screen = ScreenList.GetFirst(); screen != NULL; screen = ScreenList.GetNext() )
{
D( printf( "SaveEEFile, %s\n", TO_UTF8( screen->GetFileName() ) ); )
SaveEEFile( screen, FILE_SAVE_AS );
}
......@@ -328,3 +374,48 @@ void SCH_EDIT_FRAME::OnSaveProject( wxCommandEvent& aEvent )
fn.SetExt( CompLibFileExtension );
LibArchive( this, fn.GetFullPath() );
}
bool SCH_EDIT_FRAME::doAutoSave()
{
wxFileName tmpFileName = g_RootSheet->GetFileName();
wxFileName fn = tmpFileName;
wxFileName tmp;
SCH_SCREENS screens;
bool autoSaveOk = true;
tmp.AssignDir( fn.GetPath() );
if( !IsWritable( tmp ) )
return false;
for( SCH_SCREEN* screen = screens.GetFirst(); screen != NULL; screen = screens.GetNext() )
{
// Only create auto save files for the schematics that have been modified.
if( !screen->IsSave() )
continue;
tmpFileName = fn = screen->GetFileName();
// Auto save file name is the normal file name prefixed with $.
fn.SetName( wxT( "$" ) + fn.GetName() );
screen->SetFileName( fn.GetFullPath() );
if( SaveEEFile( screen, FILE_SAVE_AS, NO_BACKUP_FILE ) )
{
screen->SetModify();
}
else
{
autoSaveOk = false;
}
screen->SetFileName( tmpFileName.GetFullPath() );
}
if( autoSaveOk )
m_autoSaveState = false;
return autoSaveOk;
}
......@@ -138,6 +138,8 @@ extern const wxString SymbolFileWildcard;
extern const wxString CompLibFileExtension;
extern const wxString CompLibFileWildcard;
extern const wxString g_SchematicBackupFileExtension;
extern LayerStruct g_LayerDescr;
extern bool g_EditPinByPinIsOn; /* True to prevent displacing
......
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/**
* @file load_one_schematic_file.cpp
* @brief Code to load and save Eeschema files.
......@@ -37,24 +62,29 @@ bool SCH_EDIT_FRAME::LoadOneEEFile( SCH_SCREEN* aScreen, const wxString& aFullFi
SCH_ITEM* item;
wxString MsgDiag; // Error and log messages
char* line;
wxFileName fn;
if( aScreen == NULL )
return FALSE;
return false;
if( aFullFileName.IsEmpty() )
return FALSE;
return false;
fn = aFullFileName;
CheckForAutoSaveFile( fn, g_SchematicBackupFileExtension );
wxLogTrace( traceAutoSave, wxT( "Loading schematic file " ) + aFullFileName );
aScreen->SetCurItem( NULL );
aScreen->SetFileName( aFullFileName );
// D(printf("LoadOneEEFile:%s\n", TO_UTF8( aFullFileName ) ); )
FILE* f;
FILE* f;
if( ( f = wxFopen( aFullFileName, wxT( "rt" ) ) ) == NULL )
{
MsgDiag = _( "Failed to open " ) + aFullFileName;
DisplayError( this, MsgDiag );
return FALSE;
return false;
}
// reader now owns the open FILE.
......@@ -68,7 +98,7 @@ bool SCH_EDIT_FRAME::LoadOneEEFile( SCH_SCREEN* aScreen, const wxString& aFullFi
{
MsgDiag = aFullFileName + _( " is NOT an Eeschema file!" );
DisplayError( this, MsgDiag );
return FALSE;
return false;
}
line = reader.Line();
......@@ -105,7 +135,7 @@ again." );
{
MsgDiag = aFullFileName + _( " is NOT an Eeschema file!" );
DisplayError( this, MsgDiag );
return FALSE;
return false;
}
LoadLayers( &reader );
......
/////////////////////////////////////////////////////////////////////////////
// Name: sch_sheet_path.cpp
// Purpose: member functions for SCH_SHEET_PATH
// header = sch_sheet_path.h
// Author: jean-pierre Charras
// Modified by:
// License: License GNU
/////////////////////////////////////////////////////////////////////////////
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/**
* @file sch_sheet_path.cpp
* @brief SCH_SHEET_PATH class implementation.
*/
#include "fctsys.h"
......@@ -562,6 +583,18 @@ bool SCH_SHEET_LIST::IsModified()
}
bool SCH_SHEET_LIST::IsAutoSaveRequired()
{
for( SCH_SHEET_PATH* sheet = GetFirst(); sheet != NULL; sheet = GetNext() )
{
if( sheet->LastScreen() && sheet->LastScreen()->IsSave() )
return true;
}
return false;
}
void SCH_SHEET_LIST::ClearModifyStatus()
{
for( SCH_SHEET_PATH* sheet = GetFirst(); sheet != NULL; sheet = GetNext() )
......
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/**
* @file sch_sheet_path.h
* @brief Definition of the SCH_SHEET_PATH and SCH_SHEET_LIST classes for Eeschema.
......@@ -272,12 +297,10 @@ private:
* starting at the given sheet in constructor .
* the given sheet is counted
*/
int m_index; /* internal variable to handle GetNext():
* cleared by GetFirst()
* and incremented by GetNext() after
* returning the next item in m_List
* Also used for internal calculations in
* BuildSheetList()
int m_index; /* internal variable to handle GetNext(): cleared by
* GetFirst() and incremented by GetNext() after
* returning the next item in m_List. Also used for
* internal calculations in BuildSheetList()
*/
SCH_SHEET_PATH m_currList;
......@@ -351,6 +374,13 @@ public:
*/
bool IsModified();
/**
* Function IsAutoSaveRequired
* checks the entire hierarchy for any modifications that require auto save.
* @returns True if the hierarchy is modified otherwise false.
*/
bool IsAutoSaveRequired();
void ClearModifyStatus();
/**
......
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/**
* @file schframe.cpp
*/
......@@ -174,6 +199,7 @@ SCH_EDIT_FRAME::SCH_EDIT_FRAME( wxWindow* father,
m_dlgFindReplace = NULL;
m_findReplaceData = new wxFindReplaceData( wxFR_DOWN );
m_undoItem = NULL;
m_hasAutoSave = true;
CreateScreens();
......@@ -261,12 +287,6 @@ SCH_SHEET_PATH* SCH_EDIT_FRAME::GetSheet()
}
/**
* Function SetSheetNumberAndCount
* Set the m_ScreenNumber and m_NumberOfScreen members for screens
* must be called after a delete or add sheet command, and when entering a
* sheet
*/
void SCH_EDIT_FRAME::SetSheetNumberAndCount()
{
SCH_SCREEN* screen = GetScreen();
......@@ -412,6 +432,20 @@ void SCH_EDIT_FRAME::OnCloseWindow( wxCloseEvent& aEvent )
}
}
SCH_SCREENS screens;
wxFileName fn;
for( SCH_SCREEN* screen = screens.GetFirst(); screen != NULL; screen = screens.GetNext() )
{
fn = screen->GetFileName();
// Auto save file name is the normal file name prepended with $.
fn.SetName( wxT( "$" ) + fn.GetName() );
if( fn.FileExists() && fn.IsFileWritable() )
wxRemoveFile( fn.GetFullPath() );
}
SheetList.ClearModifyStatus();
if( !g_RootSheet->GetScreen()->GetFileName().IsEmpty()
......@@ -482,15 +516,11 @@ wxString SCH_EDIT_FRAME::GetUniqueFilenameForCurrentSheet()
return filename;
}
/**
* Function OnModify
* Must be called after a schematic change
* in order to set the "modify" flag of the current screen
* and update the date in frame reference
*/
void SCH_EDIT_FRAME::OnModify( )
{
GetScreen()->SetModify();
GetScreen()->SetSave();
wxString date = GenDate();
SCH_SCREENS s_list;
......@@ -788,15 +818,7 @@ void SCH_EDIT_FRAME::SVG_Print( wxCommandEvent& event )
frame.ShowModal();
}
/*
* Function PrintPage (virtual)
* Previously used to print a page,
* but now only used to plot/print the current sheet to the clipboard
* @param aDC = wxDC given by the calling print function
* @param aPrintMask = not used here
* @param aPrintMirrorMode = not used here (Set when printing in mirror mode)
* @param aData = a pointer on an auxiliary data (not used here)
*/
void SCH_EDIT_FRAME::PrintPage( wxDC* aDC, int aPrintMask, bool aPrintMirrorMode, void* aData )
{
GetScreen()->Draw( DrawPanel, aDC, GR_DEFAULT_DRAWMODE );
......@@ -817,3 +839,11 @@ void SCH_EDIT_FRAME::OnSelectItem( wxCommandEvent& aEvent )
GetScreen()->SetCurItem( item );
}
}
bool SCH_EDIT_FRAME::isAutoSaveRequired() const
{
SCH_SHEET_LIST SheetList;
return SheetList.IsAutoSaveRequired();
}
/**********************
* class_base_screen.h
**********************/
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/* define :
* class BASE_SCREEN to handle how to draw a screen (a board, a schematic ...)
/**
* @file class_base_screen.h
* @brief BASE_SCREEN class implementation.
*/
#ifndef __CLASS_BASE_SCREEN_H__
......@@ -48,9 +70,10 @@ public:
typedef std::vector< GRID_TYPE > GRIDS;
/*******************************************************************/
/* Class to handle how to draw a screen (a board, a schematic ...) */
/*******************************************************************/
/**
* Class BASE_SCREEN
* handle how to draw a screen (a board, a schematic ...)
*/
class BASE_SCREEN : public EDA_ITEM
{
EDA_ITEMS m_items; ///< The drawing items associated with this screen.
......@@ -58,8 +81,8 @@ class BASE_SCREEN : public EDA_ITEM
EDA_ITEM* m_drawList; ///< Object list for the screen.
wxString m_fileName; ///< File used to load the screen.
char m_FlagRefreshReq; ///< Indicates that the screen should be redrawn.
char m_FlagModified; ///< Indicates current drawing has been modified.
char m_FlagSave; ///< Indicates automatic file save.
bool m_FlagModified; ///< Indicates current drawing has been modified.
bool m_FlagSave; ///< Indicates automatic file save.
EDA_ITEM* m_CurrentItem; ///< Currently selected object
GRID_TYPE m_Grid; ///< Current grid selection.
wxPoint m_scrollCenter; ///< Current scroll center point in logical units.
......@@ -248,12 +271,12 @@ public:
}
void SetModify() { m_FlagModified = 1; m_FlagSave = 0; }
void ClrModify() { m_FlagModified = 0; m_FlagSave = 1; }
void SetSave() { m_FlagSave = 1; }
void ClrSave() { m_FlagSave = 0; }
int IsModify() { return m_FlagModified & 1; }
int IsSave() { return m_FlagSave & 1; }
void SetModify() { m_FlagModified = true; }
void ClrModify() { m_FlagModified = false;; }
void SetSave() { m_FlagSave = true; }
void ClrSave() { m_FlagSave = false; }
int IsModify() { return m_FlagModified; }
int IsSave() { return m_FlagSave; }
//----<zoom stuff>---------------------------------------------------------
......
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/**
* @file class_sch_screen.h
* @brief Definitions for the Eeschema program SCH_SCREEN class.
......
......@@ -90,9 +90,6 @@ public:
wxString m_UserLibraryPath;
wxArrayString m_ComponentLibFiles;
protected:
TEMPLATES m_TemplateFieldNames;
private:
wxString m_DefaultSchematicFileName;
int m_TextFieldSize;
......@@ -126,6 +123,23 @@ private:
static wxPoint m_lastSheetPinPosition; ///< Last sheet pin position.
static int m_lastSheetPinEdge; ///< Last sheet edge a sheet pin was placed.
protected:
TEMPLATES m_TemplateFieldNames;
/**
* Function doAutoSave
* saves the schematic files that have been modified and not yet saved.
*
* @return true if the auto save was successful otherwise false.
*/
virtual bool doAutoSave();
/**
* Function autoSaveRequired
* returns true if the schematic has been modified.
*/
virtual bool isAutoSaveRequired() const;
public:
SCH_EDIT_FRAME( wxWindow* father,
......@@ -135,13 +149,13 @@ public:
~SCH_EDIT_FRAME();
void OnCloseWindow( wxCloseEvent& Event );
void Process_Special_Functions( wxCommandEvent& event );
void OnColorConfig( wxCommandEvent& aEvent );
void Process_Config( wxCommandEvent& event );
void OnSelectTool( wxCommandEvent& aEvent );
void OnCloseWindow( wxCloseEvent& Event );
void Process_Special_Functions( wxCommandEvent& event );
void OnColorConfig( wxCommandEvent& aEvent );
void Process_Config( wxCommandEvent& event );
void OnSelectTool( wxCommandEvent& aEvent );
void GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey = 0 );
void GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey = 0 );
/**
* Function GetProjectFileParameters
......@@ -240,18 +254,17 @@ public:
*/
PARAM_CFG_ARRAY& GetConfigurationSettings( void );
void LoadSettings();
void SaveSettings();
void LoadSettings();
void SaveSettings();
void RedrawActiveWindow( wxDC* DC, bool EraseBg );
void RedrawActiveWindow( wxDC* DC, bool EraseBg );
void CreateScreens();
void ReCreateHToolbar();
void ReCreateVToolbar();
void ReCreateOptToolbar();
void ReCreateMenuBar();
void OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
EDA_ITEM* aItem = NULL );
void CreateScreens();
void ReCreateHToolbar();
void ReCreateVToolbar();
void ReCreateOptToolbar();
void ReCreateMenuBar();
void OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, EDA_ITEM* aItem = NULL );
/**
* Function OnModify
......@@ -259,21 +272,21 @@ public:
* in order to set the "modify" flag of the current screen
* and update the date in frame reference
*/
void OnModify();
void OnModify();
SCH_SHEET_PATH* GetSheet();
SCH_SHEET_PATH* GetSheet();
SCH_SCREEN* GetScreen() const;
SCH_SCREEN* GetScreen() const;
virtual wxString GetScreenDesc();
void InstallConfigFrame( wxCommandEvent& event );
void InstallConfigFrame( wxCommandEvent& event );
void OnLeftClick( wxDC* aDC, const wxPoint& aPosition );
void OnLeftDClick( wxDC* aDC, const wxPoint& aPosition );
bool OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu );
void OnSelectOptionToolbar( wxCommandEvent& event );
double BestZoom();
void OnLeftClick( wxDC* aDC, const wxPoint& aPosition );
void OnLeftDClick( wxDC* aDC, const wxPoint& aPosition );
bool OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu );
void OnSelectOptionToolbar( wxCommandEvent& event );
double BestZoom();
/**
* Function LocateAndShowItem
......@@ -326,17 +339,17 @@ public:
*/
bool DeleteItemAtCrossHair( wxDC* aDC );
SCH_ITEM* FindComponentAndItem( const wxString& component_reference,
bool Find_in_hierarchy,
int SearchType,
const wxString& text_to_find,
bool mouseWarp );
SCH_ITEM* FindComponentAndItem( const wxString& component_reference,
bool Find_in_hierarchy,
int SearchType,
const wxString& text_to_find,
bool mouseWarp );
/* Cross probing with Pcbnew */
void SendMessageToPCBNEW( EDA_ITEM* objectToSync, SCH_COMPONENT* LibItem );
void SendMessageToPCBNEW( EDA_ITEM* objectToSync, SCH_COMPONENT* LibItem );
/* netlist generation */
void BuildNetListBase();
void BuildNetListBase();
/**
* Function CreateNetlist
......@@ -352,10 +365,10 @@ public:
* @param aUsePrefix Prefix reference designator with an 'X' for spice output.
* @return true if success.
*/
bool CreateNetlist( int aFormat,
const wxString& aFullFileName,
bool aUse_netnames,
bool aUsePrefix );
bool CreateNetlist( int aFormat,
const wxString& aFullFileName,
bool aUse_netnames,
bool aUsePrefix );
/**
* Function WriteNetListFile
......@@ -367,10 +380,10 @@ public:
* bool aUse_netnames is used only for Spice netlist
* @return true if success.
*/
bool WriteNetListFile( int aFormat,
const wxString& aFullFileName,
bool aUse_netnames,
bool aUsePrefix );
bool WriteNetListFile( int aFormat,
const wxString& aFullFileName,
bool aUse_netnames,
bool aUsePrefix );
/**
* Function DeleteAnnotation
......@@ -432,7 +445,7 @@ public:
* Function DisplayCurrentSheet
* draws the current sheet on the display.
*/
void DisplayCurrentSheet();
void DisplayCurrentSheet();
/**
* Function GetUniqueFilenameForCurrentSheet
......@@ -445,7 +458,7 @@ public:
* Name is &ltroot sheet filename&gt-&ltsheet path&gt and has no extension.
* However if filename is too long name is &ltsheet filename&gt-&ltsheet number&gt
*/
wxString GetUniqueFilenameForCurrentSheet();
wxString GetUniqueFilenameForCurrentSheet();
/**
* Function SetSheetNumberAndCount
......@@ -453,41 +466,41 @@ public:
* must be called after a delete or add sheet command, and when entering
* a sheet
*/
void SetSheetNumberAndCount();
void SetSheetNumberAndCount();
/**
* Show the print dialog
*/
void OnPrint( wxCommandEvent& event );
void OnPrint( wxCommandEvent& event );
wxPageSetupDialogData& GetPageSetupData() { return m_pageSetupData; }
void SetPreviewPosition( const wxPoint& aPoint ) { m_previewPosition = aPoint; }
void SetPreviewSize( const wxSize& aSize ) { m_previewSize = aSize; }
void SetPreviewPosition( const wxPoint& aPoint ) { m_previewPosition = aPoint; }
void SetPreviewSize( const wxSize& aSize ) { m_previewSize = aSize; }
const wxPoint& GetPreviewPosition() { return m_previewPosition; }
const wxSize& GetPreviewSize() { return m_previewSize; }
const wxSize& GetPreviewSize() { return m_previewSize; }
void SetPrintDialogPosition( const wxPoint& aPoint )
void SetPrintDialogPosition( const wxPoint& aPoint )
{
m_printDialogPosition = aPoint;
}
void SetPrintDialogSize( const wxSize& aSize ) { m_printDialogSize = aSize; }
void SetPrintDialogSize( const wxSize& aSize ) { m_printDialogSize = aSize; }
const wxPoint& GetPrintDialogPosition() { return m_printDialogPosition; }
const wxSize& GetPrintDialogSize() { return m_printDialogSize; }
const wxSize& GetPrintDialogSize() { return m_printDialogSize; }
bool GetPrintMonochrome() { return m_printMonochrome; }
void SetPrintMonochrome( bool aMonochrome ) { m_printMonochrome = aMonochrome; }
bool GetPrintSheetReference() { return m_printSheetReference; }
void SetPrintSheetReference( bool aShow ) { m_printSheetReference = aShow; }
void SVG_Print( wxCommandEvent& event );
bool GetPrintMonochrome() { return m_printMonochrome; }
void SetPrintMonochrome( bool aMonochrome ) { m_printMonochrome = aMonochrome; }
bool GetPrintSheetReference() { return m_printSheetReference; }
void SetPrintSheetReference( bool aShow ) { m_printSheetReference = aShow; }
void SVG_Print( wxCommandEvent& event );
// Plot functions:
void ToPlot_PS( wxCommandEvent& event );
void ToPlot_HPGL( wxCommandEvent& event );
void ToPlot_DXF( wxCommandEvent& event );
void ToPostProcess( wxCommandEvent& event );
void ToPlot_PS( wxCommandEvent& event );
void ToPlot_HPGL( wxCommandEvent& event );
void ToPlot_DXF( wxCommandEvent& event );
void ToPostProcess( wxCommandEvent& event );
// read and save files
void Save_File( wxCommandEvent& event );
......@@ -527,7 +540,7 @@ public:
*/
bool LoadOneEEFile( SCH_SCREEN* aScreen, const wxString& aFullFileName );
bool ReadInputStuffFile();
bool ReadInputStuffFile();
/**
* Function ProcessStuffFile
......@@ -545,7 +558,7 @@ public:
* @param aSetFieldsAttributeToVisible = true to set the footprint field flag to visible
* @return bool - true if success, else true.
*/
bool ProcessStuffFile( FILE* aFilename, bool aSetFieldsAttributeToVisible );
bool ProcessStuffFile( FILE* aFilename, bool aSetFieldsAttributeToVisible );
/**
* Function SaveEEFile
......@@ -554,61 +567,63 @@ public:
* @param aScreen A pointer to the SCH_SCREEN object to save. A NULL pointer saves
* the current screen.
* @param aSaveType Controls how the file is to be saved.
* @param aCreateBackupFile Creates a back of the file associated with \a aScreen
* if true. Helper definitions #CREATE_BACKUP_FILE and
* #NO_BACKUP_FILE are defined for improved code readability.
* @return True if the file has been saved.
*/
bool SaveEEFile( SCH_SCREEN* aScreen, int aSaveType );
bool SaveEEFile( SCH_SCREEN* aScreen,
int aSaveType,
bool aCreateBackupFile = CREATE_BACKUP_FILE );
// General search:
private:
void OnMoveItem( wxCommandEvent& aEvent );
void OnExit( wxCommandEvent& event );
void OnAnnotate( wxCommandEvent& event );
void OnErc( wxCommandEvent& event );
void OnCreateNetlist( wxCommandEvent& event );
void OnCreateBillOfMaterials( wxCommandEvent& event );
void OnFindItems( wxCommandEvent& event );
void OnFindDialogClose( wxFindDialogEvent& event );
void OnFindDrcMarker( wxFindDialogEvent& event );
void OnFindCompnentInLib( wxFindDialogEvent& event );
void OnFindSchematicItem( wxFindDialogEvent& event );
void OnLoadFile( wxCommandEvent& event );
void OnLoadStuffFile( wxCommandEvent& event );
void OnNewProject( wxCommandEvent& event );
void OnLoadProject( wxCommandEvent& event );
void OnOpenPcbnew( wxCommandEvent& event );
void OnOpenCvpcb( wxCommandEvent& event );
void OnOpenLibraryViewer( wxCommandEvent& event );
void OnOpenLibraryEditor( wxCommandEvent& event );
void OnSetOptions( wxCommandEvent& event );
void OnCancelCurrentCommand( wxCommandEvent& aEvent );
void OnMoveItem( wxCommandEvent& aEvent );
void OnExit( wxCommandEvent& event );
void OnAnnotate( wxCommandEvent& event );
void OnErc( wxCommandEvent& event );
void OnCreateNetlist( wxCommandEvent& event );
void OnCreateBillOfMaterials( wxCommandEvent& event );
void OnFindItems( wxCommandEvent& event );
void OnFindDialogClose( wxFindDialogEvent& event );
void OnFindDrcMarker( wxFindDialogEvent& event );
void OnFindCompnentInLib( wxFindDialogEvent& event );
void OnFindSchematicItem( wxFindDialogEvent& event );
void OnLoadFile( wxCommandEvent& event );
void OnLoadStuffFile( wxCommandEvent& event );
void OnNewProject( wxCommandEvent& event );
void OnLoadProject( wxCommandEvent& event );
void OnOpenPcbnew( wxCommandEvent& event );
void OnOpenCvpcb( wxCommandEvent& event );
void OnOpenLibraryViewer( wxCommandEvent& event );
void OnOpenLibraryEditor( wxCommandEvent& event );
void OnSetOptions( wxCommandEvent& event );
void OnCancelCurrentCommand( wxCommandEvent& aEvent );
void OnSelectItem( wxCommandEvent& aEvent );
/* edition events functions */
void OnCopySchematicItemRequest( wxCommandEvent& event );
void OnCopySchematicItemRequest( wxCommandEvent& event );
/* User interface update event handlers. */
void OnUpdateBlockSelected( wxUpdateUIEvent& event );
void OnUpdatePaste( wxUpdateUIEvent& event );
void OnUpdateHiddenPins( wxUpdateUIEvent& event );
void OnUpdateBusOrientation( wxUpdateUIEvent& event );
void OnUpdateSelectTool( wxUpdateUIEvent& aEvent );
void OnUpdateBlockSelected( wxUpdateUIEvent& event );
void OnUpdatePaste( wxUpdateUIEvent& event );
void OnUpdateHiddenPins( wxUpdateUIEvent& event );
void OnUpdateBusOrientation( wxUpdateUIEvent& event );
void OnUpdateSelectTool( wxUpdateUIEvent& aEvent );
/**
* Function SetLanguage
* called on a language menu selection
*/
void SetLanguage( wxCommandEvent& event );
void SetLanguage( wxCommandEvent& event );
// Bus Entry
SCH_BUS_ENTRY* CreateBusEntry( wxDC* DC, int entry_type );
void SetBusEntryShape( wxDC* DC,
SCH_BUS_ENTRY* BusEntry,
int entry_type );
int GetBusEntryShape( SCH_BUS_ENTRY* BusEntry );
void StartMoveBusEntry( SCH_BUS_ENTRY* DrawLibItem,
wxDC* DC );
SCH_BUS_ENTRY* CreateBusEntry( wxDC* DC, int entry_type );
void SetBusEntryShape( wxDC* DC, SCH_BUS_ENTRY* BusEntry, int entry_type );
int GetBusEntryShape( SCH_BUS_ENTRY* BusEntry );
void StartMoveBusEntry( SCH_BUS_ENTRY* DrawLibItem, wxDC* DC );
/**
* Function AddNoConnect
......@@ -620,13 +635,13 @@ private:
SCH_NO_CONNECT* AddNoConnect( wxDC* aDC, const wxPoint& aPosition );
// Junction
SCH_JUNCTION* AddJunction( wxDC* aDC, const wxPoint& aPosition, bool aPutInUndoList = FALSE );
SCH_JUNCTION* AddJunction( wxDC* aDC, const wxPoint& aPosition, bool aPutInUndoList = FALSE );
// Text, label, glabel
SCH_TEXT* CreateNewText( wxDC* aDC, int aType );
void EditSchematicText( SCH_TEXT* TextStruct );
void ChangeTextOrient( SCH_TEXT* aTextItem, wxDC* aDC );
void MoveText( SCH_TEXT* aTextItem, wxDC* aDC );
SCH_TEXT* CreateNewText( wxDC* aDC, int aType );
void EditSchematicText( SCH_TEXT* TextStruct );
void ChangeTextOrient( SCH_TEXT* aTextItem, wxDC* aDC );
void MoveText( SCH_TEXT* aTextItem, wxDC* aDC );
/**
* Function OnCovertTextType
......@@ -637,21 +652,21 @@ private:
void OnConvertTextType( wxCommandEvent& aEvent );
// Wire, Bus
void BeginSegment( wxDC* DC, int type );
void EndSegment( wxDC* DC );
void DeleteCurrentSegment( wxDC* DC );
void DeleteConnection( bool DeleteFullConnection );
void BeginSegment( wxDC* DC, int type );
void EndSegment( wxDC* DC );
void DeleteCurrentSegment( wxDC* DC );
void DeleteConnection( bool DeleteFullConnection );
// graphic lines
void Delete_Segment_Edge( DRAWSEGMENT* Segment, wxDC* DC );
void Drawing_SetNewWidth( DRAWSEGMENT* DrawSegm, wxDC* DC );
void Delete_Drawings_All_Layer( DRAWSEGMENT* Segment, wxDC* DC );
DRAWSEGMENT* Begin_Edge( DRAWSEGMENT* Segment, wxDC* DC );
void Edge( DRAWSEGMENT* Segment, wxDC* DC );
void SetNewWidth( DRAWSEGMENT* DrawSegm, wxDC* DC );
void Layer( DRAWSEGMENT* Segment, wxDC* DC );
DRAWSEGMENT* Begin_Edge( DRAWSEGMENT* Segment, wxDC* DC );
// Images:
SCH_BITMAP* CreateNewImage( wxDC* aDC );
void MoveImage( SCH_BITMAP* aItem, wxDC* aDC );
void RotateImage( SCH_BITMAP* aItem );
SCH_BITMAP* CreateNewImage( wxDC* aDC );
void MoveImage( SCH_BITMAP* aItem, wxDC* aDC );
void RotateImage( SCH_BITMAP* aItem );
/**
* Function MirrorImage
* Mirror a bitmap
......@@ -659,18 +674,18 @@ private:
* @param Is_X_axis = true to mirror relative to Horizontal axis
* false to mirror relative to vertical axis
*/
void MirrorImage( SCH_BITMAP* aItem, bool Is_X_axis );
void EditImage( SCH_BITMAP* aItem );
void MirrorImage( SCH_BITMAP* aItem, bool Is_X_axis );
void EditImage( SCH_BITMAP* aItem );
// Hierarchical Sheet & PinSheet
void InstallHierarchyFrame( wxDC* DC, wxPoint& pos );
SCH_SHEET* CreateSheet( wxDC* DC );
void ReSizeSheet( SCH_SHEET* Sheet, wxDC* DC );
void InstallHierarchyFrame( wxDC* DC, wxPoint& pos );
SCH_SHEET* CreateSheet( wxDC* DC );
void ReSizeSheet( SCH_SHEET* Sheet, wxDC* DC );
/**
* Use the component viewer to select component to import into schematic.
*/
wxString SelectFromLibBrowser( void );
wxString SelectFromLibBrowser( void );
public:
/**
......@@ -703,7 +718,7 @@ public:
int GetLastSheetPinEdge() const { return m_lastSheetPinEdge; }
private:
void StartMoveSheet( SCH_SHEET* sheet, wxDC* DC );
void StartMoveSheet( SCH_SHEET* sheet, wxDC* DC );
/**
* Function CreateSheetPin
......@@ -758,7 +773,7 @@ private:
const wxString& libname,
wxArrayString& List,
bool UseLibBrowser );
void StartMovePart( SCH_COMPONENT* DrawLibItem, wxDC* DC );
void StartMovePart( SCH_COMPONENT* DrawLibItem, wxDC* DC );
/**
* Function EditComponent
......@@ -772,15 +787,15 @@ public:
void OnChangeComponentOrientation( wxCommandEvent& aEvent );
private:
void OnSelectUnit( wxCommandEvent& aEvent );
void ConvertPart( SCH_COMPONENT* DrawComponent, wxDC* DC );
void SetInitCmp( SCH_COMPONENT* DrawComponent, wxDC* DC );
void OnSelectUnit( wxCommandEvent& aEvent );
void ConvertPart( SCH_COMPONENT* DrawComponent, wxDC* DC );
void SetInitCmp( SCH_COMPONENT* DrawComponent, wxDC* DC );
void MoveField( SCH_FIELD* aField, wxDC* aDC );
void EditComponentFieldText( SCH_FIELD* aField, wxDC* aDC );
void RotateField( SCH_FIELD* aField, wxDC* aDC );
void PasteListOfItems( wxDC* DC );
void PasteListOfItems( wxDC* DC );
/* Undo - redo */
public:
......@@ -848,7 +863,7 @@ private:
* - Get an old version of the schematic from Redo list
* @return none
*/
void GetSchematicFromRedoList( wxCommandEvent& event );
void GetSchematicFromRedoList( wxCommandEvent& event );
/**
* Function GetSchematicFromUndoList
......@@ -856,7 +871,7 @@ private:
* - Save the current schematic in Redo list
* - Get an old version of the schematic from Undo list
*/
void GetSchematicFromUndoList( wxCommandEvent& event );
void GetSchematicFromUndoList( wxCommandEvent& event );
/**
* Function copyBlockItems
......@@ -875,11 +890,11 @@ private:
void addJunctionMenuEntries( wxMenu* aMenu, SCH_JUNCTION* aJunction );
public:
void Key( wxDC* DC, int hotkey, EDA_ITEM* DrawStruct );
void Key( wxDC* DC, int hotkey, EDA_ITEM* DrawStruct );
/* Block operations. */
void InitBlockPasteInfos();
void HandleBlockEndByPopUp( int Command, wxDC* DC );
void InitBlockPasteInfos();
void HandleBlockEndByPopUp( int Command, wxDC* DC );
/**
* Function ReturnBlockCommand
......@@ -912,7 +927,7 @@ public:
*/
virtual bool HandleBlockEnd( wxDC* DC );
void RepeatDrawItem( wxDC* DC );
void RepeatDrawItem( wxDC* DC );
void SetRepeatItem( SCH_ITEM* aItem ) { m_itemToRepeat = aItem; }
......
......@@ -43,10 +43,6 @@
#endif
#define CREATE_BACKUP_FILE true
#define NO_BACKUP_FILE false
/* Forward declarations of classes. */
class PCB_SCREEN;
class BOARD;
......@@ -152,10 +148,10 @@ protected:
virtual bool doAutoSave();
/**
* Function isModified
* Function isautoSaveRequired
* returns true if the board has been modified.
*/
virtual bool isModified() const;
virtual bool isAutoSaveRequired() const;
public:
LAYER_BOX_SELECTOR* m_SelLayerBox; // a combo box to display and select active layer
......
......@@ -60,6 +60,12 @@
#define KICAD_DEFAULT_DRAWFRAME_STYLE wxDEFAULT_FRAME_STYLE | wxWANTS_CHARS
// Readability helper definitions for creating backup files.
#define CREATE_BACKUP_FILE true
#define NO_BACKUP_FILE false
class EDA_ITEM;
class EDA_RECT;
class EDA_DRAW_PANEL;
......@@ -100,6 +106,10 @@ enum id_toolbar {
};
/// Custom trace mask to enable and disable auto save tracing.
extern const wxChar* traceAutoSave;
/**
* Class EDA_BASE_FRAME
* is the base frame for deriving all KiCad main window classes. This class is not
......@@ -140,11 +150,11 @@ protected:
void onAutoSaveTimer( wxTimerEvent& aEvent );
/**
* Function isModified
* returns the modification status of the application. Override this function if
* Function autoSaveRequired
* returns the auto save status of the application. Override this function if
* your derived frame supports automatic file saving.
*/
virtual bool isModified() const { return false; }
virtual bool isAutoSaveRequired() const { return false; }
/**
* Function doAutoSave
......@@ -328,6 +338,24 @@ public:
* @return False if \a aFileName cannot be written.
*/
bool IsWritable( const wxFileName& aFileName );
/**
* Function CheckForAutoSaveFile
* checks if an auto save file exists for \a aFileName and takes the appropriate
* action depending on the user input.
* <p>
* If an auto save file exists for \a aFileName, the user is prompted if they wish
* to replace file \a aFileName with the auto saved file. If the user chooses to
* replace the file, the backup file of \a aFileName is removed, \a aFileName is
* renamed to the backup file name, and the auto save file is renamed to \a aFileName.
* If user chooses to keep the existing version of \a aFileName, the auto save file
* is removed.
* </p>
* @param aFileName A wxFileName object containing the file name to check.
* @param aBackupFileExtension A wxString object containing the backup file extension
* used to create the backup file name.
*/
void CheckForAutoSaveFile( const wxFileName& aFileName, const wxString& aBackupFileExtension );
};
......
/********************/
/* basepcbframe.cpp */
/********************/
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/**
* @file basepcbframe.cpp
*/
#ifdef __GNUG__
#pragma implementation
......@@ -36,10 +61,6 @@ static const wxString FastGrid1Entry( wxT( "FastGrid1" ) );
static const wxString FastGrid2Entry( wxT( "FastGrid2" ) );
/****************************/
/* class PCB_BASE_FRAME */
/****************************/
BEGIN_EVENT_TABLE( PCB_BASE_FRAME, EDA_DRAW_FRAME )
EVT_MENU_RANGE( ID_POPUP_PCB_ITEM_SELECTION_START, ID_POPUP_PCB_ITEM_SELECTION_END,
PCB_BASE_FRAME::ProcessItemSelection )
......@@ -459,12 +480,6 @@ void PCB_BASE_FRAME::unitsChangeRefresh()
}
/**
* Load PCB base frame specific configuration settings.
*
* Don't forget to call this base method from any derived classes or the
* settings will not get loaded.
*/
void PCB_BASE_FRAME::LoadSettings()
{
wxASSERT( wxGetApp().m_EDA_Config != NULL );
......@@ -509,12 +524,6 @@ void PCB_BASE_FRAME::LoadSettings()
}
/**
* Save PCB base frame specific configuration settings.
*
* Don't forget to call this base method from any derived classes or the
* settings will not get saved.
*/
void PCB_BASE_FRAME::SaveSettings()
{
wxASSERT( wxGetApp().m_EDA_Config != NULL );
......@@ -535,20 +544,11 @@ void PCB_BASE_FRAME::SaveSettings()
}
/**
* Function OnModify
* Must be called after a schematic change
* in order to set the "modify" flag of the current screen
* and update the date in frame reference
* do not forget to call this basic OnModify function to update info
* in derived OnModify functions
*/
void PCB_BASE_FRAME::OnModify( )
{
GetScreen()->SetModify( );
wxString date = GenDate();
GetScreen()->m_Date = date;
GetScreen()->SetModify();
GetScreen()->SetSave();
GetScreen()->m_Date = GenDate();
}
......
......@@ -48,7 +48,7 @@
#include "class_board.h"
#define BACKUP_FILE_EXT wxT( "000" )
static const wxString pcbBackupFileExtension( wxT( "000" ) );
void PCB_EDIT_FRAME::OnFileHistory( wxCommandEvent& event )
......@@ -96,7 +96,7 @@ void PCB_EDIT_FRAME::Files_io( wxCommandEvent& event )
else
{
fn = GetScreen()->GetFileName();
fn.SetExt( BACKUP_FILE_EXT );
fn.SetExt( pcbBackupFileExtension );
}
if( !fn.FileExists() )
......@@ -195,54 +195,7 @@ the changes?" ) ) )
if( !aAppend )
Clear_Pcb( false ); // pass false since we prompted above for a modified board
// Check for board auto save file.
wxFileName autoSaveFileName = fileName;
autoSaveFileName.SetName( wxT( "$" ) + autoSaveFileName.GetName() );
if( autoSaveFileName.FileExists() )
{
int response = wxMessageBox( _( "Well this is embarrassing! It appears that the last \
time you were editing this board the file was not save properly. Do you wish to restore the \
last edits you made?" ), wxGetApp().GetAppName(), wxYES_NO | wxICON_QUESTION, this );
// Make a backup of the current board file, delete the board file, and copy
// the auto save file to the board file name.
if( response == wxYES )
{
/* Get the backup file name */
wxFileName backupFileName = fileName;
backupFileName.SetExt( BACKUP_FILE_EXT );
/* If an old backup file exists, delete it. If an old board file exists, rename
* it to the backup file name
*/
if( fileName.FileExists() )
{
/* rename the "old" file" from xxx.brd to xxx.000 */
if( backupFileName.FileExists() ) /* Remove the old file xxx.000 (if exists) */
wxRemoveFile( backupFileName.GetFullPath() );
if( !wxRenameFile( fileName.GetFullPath(), backupFileName.GetFullPath() ) )
{
msg = _( "Could not create backup file " ) + backupFileName.GetFullPath();
DisplayError( this, msg );
}
}
if( !wxRenameFile( autoSaveFileName.GetFullPath(), fileName.GetFullPath() ) )
{
wxMessageBox( _( "The auto save file could not be renamed to the board file \
name." ),
wxGetApp().GetAppName(), wxOK | wxICON_EXCLAMATION, this );
}
}
else
{
// Remove the auto save file when using the board file as is.
wxRemoveFile( autoSaveFileName.GetFullPath() );
}
}
CheckForAutoSaveFile( fileName, pcbBackupFileExtension );
GetScreen()->SetFileName( fileName.GetFullPath() );
......@@ -418,7 +371,7 @@ bool PCB_EDIT_FRAME::SavePcbFile( const wxString& aFileName, bool aCreateBackupF
{
/* Get the backup file name */
backupFileName = pcbFileName;
backupFileName.SetExt( BACKUP_FILE_EXT );
backupFileName.SetExt( pcbBackupFileExtension );
/* If an old backup file exists, delete it. If an old board file exists, rename
* it to the backup file name
......@@ -488,6 +441,7 @@ bool PCB_EDIT_FRAME::SavePcbFile( const wxString& aFileName, bool aCreateBackupF
ClearMsgPanel();
AppendMsgPanel( upperTxt, lowerTxt, CYAN );
GetScreen()->ClrSave();
GetScreen()->ClrModify();
return true;
}
......@@ -501,12 +455,15 @@ bool PCB_EDIT_FRAME::doAutoSave()
// Auto save file name is the normal file name prepended with $.
fn.SetName( wxT( "$" ) + fn.GetName() );
wxLogTrace( traceAutoSave,
wxT( "Creating auto save file <" + fn.GetFullPath() ) + wxT( ">" ) );
if( SavePcbFile( fn.GetFullPath(), NO_BACKUP_FILE ) )
{
OnModify();
GetScreen()->SetSave(); // Set the flags m_FlagSave cleared by SetModify()
GetScreen()->SetModify();
GetScreen()->SetFileName( tmpFileName.GetFullPath() );
UpdateTitle();
m_autoSaveState = false;
return true;
}
......
......@@ -413,9 +413,9 @@ PCB_EDIT_FRAME::~PCB_EDIT_FRAME()
}
bool PCB_EDIT_FRAME::isModified() const
bool PCB_EDIT_FRAME::isAutoSaveRequired() const
{
return GetScreen()->IsModify();
return GetScreen()->IsSave();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment