Eeschema: Fix erroneous message [Read Only] after creating a new project, and obviously the corresponding schematic file does not yet exist (replaced by [no file])
This commit is contained in:
parent
3383d6c8a5
commit
742486dce6
|
@ -30,11 +30,9 @@
|
|||
#include "fctsys.h"
|
||||
#include "gr_basic.h"
|
||||
#include "class_drawpanel.h"
|
||||
#include "appl_wxstruct.h"
|
||||
#include "wxEeschemaStruct.h"
|
||||
|
||||
#include "general.h"
|
||||
#include "protos.h"
|
||||
#include "class_library.h"
|
||||
#include "sch_bus_entry.h"
|
||||
#include "sch_component.h"
|
||||
|
@ -45,8 +43,6 @@
|
|||
#include "sch_sheet.h"
|
||||
#include "sch_sheet_path.h"
|
||||
|
||||
#include "build_version.h"
|
||||
|
||||
|
||||
void DrawDanglingSymbol( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& pos, int Color )
|
||||
{
|
||||
|
@ -67,8 +63,6 @@ void DrawDanglingSymbol( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& pos, in
|
|||
*/
|
||||
void SCH_EDIT_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg )
|
||||
{
|
||||
wxString title;
|
||||
|
||||
if( GetScreen() == NULL )
|
||||
return;
|
||||
|
||||
|
@ -84,40 +78,5 @@ void SCH_EDIT_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg )
|
|||
m_canvas->DrawCrossHair( DC );
|
||||
|
||||
// Display the sheet filename, and the sheet path, for non root sheets
|
||||
if( GetScreen()->GetFileName() == m_DefaultSchematicFileName )
|
||||
{
|
||||
wxString msg = wxGetApp().GetAppName() + wxT( " " ) + GetBuildVersion();
|
||||
title.Printf( wxT( "%s [%s]" ), GetChars( msg), GetChars( GetScreen()->GetFileName() ) );
|
||||
SetTitle( title );
|
||||
}
|
||||
else
|
||||
{
|
||||
#if 0
|
||||
title = wxT( "[" );
|
||||
title << GetScreen()->GetFileName() << wxT( "] " ) << _( "Sheet" );
|
||||
title << wxT( " " ) << m_CurrentSheet->PathHumanReadable();
|
||||
|
||||
#else
|
||||
// Window title format:
|
||||
// [filename sheetpath] (/path/to/filedir)
|
||||
|
||||
wxFileName t( GetScreen()->GetFileName() );
|
||||
|
||||
// Often the /path/to/filedir is blank because of the FullFileName argument
|
||||
// passed to LoadOneEEFile() which omits the path on non-root schematics.
|
||||
// Making the path absolute solves this problem.
|
||||
t.MakeAbsolute();
|
||||
title = wxChar( '[' );
|
||||
title << t.GetName() << wxChar( ' ' );
|
||||
title << m_CurrentSheet->PathHumanReadable() << wxChar( ']' );
|
||||
|
||||
title << wxChar( ' ' );
|
||||
title << wxChar( '(' ) << t.GetPath() << wxChar( ')' );
|
||||
|
||||
if( !t.IsFileWritable() )
|
||||
title << _( " [Read Only]" );
|
||||
#endif
|
||||
|
||||
SetTitle( title );
|
||||
}
|
||||
UpdateTitle();
|
||||
}
|
||||
|
|
|
@ -62,6 +62,8 @@
|
|||
#include "dialogs/dialog_SVG_print.h"
|
||||
|
||||
#include <wx/display.h>
|
||||
#include <build_version.h>
|
||||
|
||||
|
||||
|
||||
BEGIN_EVENT_TABLE( SCH_EDIT_FRAME, EDA_DRAW_FRAME )
|
||||
|
@ -979,3 +981,47 @@ void SCH_EDIT_FRAME::addCurrentItemToList( wxDC* aDC )
|
|||
undoItem->Draw( m_canvas, aDC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE );
|
||||
}
|
||||
}
|
||||
|
||||
/* sets the main window title bar text.
|
||||
* If file name defined by SCH_SCREEN::m_FileName is not set, the title is set to the
|
||||
* application name appended with no file.
|
||||
* Otherwise, the title is set to the hierarchical sheet path and the full file name,
|
||||
* and read only is appended to the title if the user does not have write
|
||||
* access to the file.
|
||||
*/
|
||||
void SCH_EDIT_FRAME::UpdateTitle()
|
||||
{
|
||||
wxString title;
|
||||
|
||||
if( GetScreen()->GetFileName() == m_DefaultSchematicFileName )
|
||||
{
|
||||
wxString msg = wxGetApp().GetAppName() + wxT( " " ) + GetBuildVersion();
|
||||
title.Printf( wxT( "%s [%s]" ), GetChars( msg), GetChars( GetScreen()->GetFileName() ) );
|
||||
SetTitle( title );
|
||||
}
|
||||
else
|
||||
{
|
||||
wxFileName fn( GetScreen()->GetFileName() );
|
||||
|
||||
// Often the /path/to/filedir is blank because of the FullFileName argument
|
||||
// passed to LoadOneEEFile() which omits the path on non-root schematics.
|
||||
// Making the path absolute solves this problem.
|
||||
fn.MakeAbsolute();
|
||||
title = wxChar( '[' );
|
||||
title << fn.GetName() << wxChar( ' ' );
|
||||
title << m_CurrentSheet->PathHumanReadable() << wxChar( ']' );
|
||||
|
||||
title << wxChar( ' ' );
|
||||
title << wxChar( '(' ) << fn.GetPath() << wxChar( ')' );
|
||||
|
||||
if( fn.FileExists() )
|
||||
{
|
||||
if( !fn.IsFileWritable() )
|
||||
title << _( " [Read Only]" );
|
||||
}
|
||||
else
|
||||
title << _( " [no file]" );
|
||||
|
||||
SetTitle( title );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -766,6 +766,19 @@ private:
|
|||
*/
|
||||
void SetLanguage( wxCommandEvent& event );
|
||||
|
||||
/**
|
||||
* Function UpdateTitle
|
||||
* sets the main window title bar text.
|
||||
* <p>
|
||||
* If file name defined by SCH_SCREEN::m_FileName is not set, the title is set to the
|
||||
* application name appended with no file.
|
||||
* Otherwise, the title is set to the hierarchical sheet path and the full file name,
|
||||
* and read only is appended to the title if the user does not have write
|
||||
* access to the file.
|
||||
* </p>
|
||||
*/
|
||||
void UpdateTitle();
|
||||
|
||||
// Bus Entry
|
||||
SCH_BUS_ENTRY* CreateBusEntry( wxDC* DC, int entry_type );
|
||||
void SetBusEntryShape( wxDC* DC, SCH_BUS_ENTRY* BusEntry, int entry_type );
|
||||
|
|
Loading…
Reference in New Issue