Reworking sheet duplication messages and annotation
The messages on sheet duplication are changed to reflect the action perceived by the user when accepting/rejecting the change. Annotation is also reset for duplicating sheets where maintaining existing annotation would conflict with existing sheets.
This commit is contained in:
parent
fdd3f52e2d
commit
626c8a71f7
|
@ -98,6 +98,7 @@ bool SCH_EDIT_FRAME::EditSheet( SCH_SHEET* aSheet, SCH_SHEET_PATH* aHierarchy )
|
||||||
|
|
||||||
wxString msg;
|
wxString msg;
|
||||||
bool loadFromFile = false;
|
bool loadFromFile = false;
|
||||||
|
bool clearAnnotation = false;
|
||||||
SCH_SCREEN* useScreen = NULL;
|
SCH_SCREEN* useScreen = NULL;
|
||||||
|
|
||||||
// Relative file names are relative to the path of the current sheet. This allows for
|
// Relative file names are relative to the path of the current sheet. This allows for
|
||||||
|
@ -134,22 +135,17 @@ bool SCH_EDIT_FRAME::EditSheet( SCH_SHEET* aSheet, SCH_SHEET_PATH* aHierarchy )
|
||||||
{
|
{
|
||||||
if( useScreen || loadFromFile ) // Load from existing file.
|
if( useScreen || loadFromFile ) // Load from existing file.
|
||||||
{
|
{
|
||||||
if( useScreen != NULL )
|
clearAnnotation = true;
|
||||||
{
|
|
||||||
msg.Printf( _( "A file named \"%s\" already exists in the current schematic "
|
|
||||||
"hierarchy." ), newFilename );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
msg.Printf( _( "A file named \"%s\" already exists." ), newFilename );
|
|
||||||
}
|
|
||||||
|
|
||||||
msg += _( "\n\nDo you want to create a sheet with the contents of this file?" );
|
wxString existsMsg;
|
||||||
|
wxString linkMsg;
|
||||||
|
existsMsg.Printf( _( "\"%s\" already exists." ), fileName.GetFullName() );
|
||||||
|
linkMsg.Printf( _( "Link \"%s\" to this file?" ), dlg.GetSheetName() );
|
||||||
|
msg.Printf( wxT( "%s\n\n%s" ), existsMsg, linkMsg );
|
||||||
|
|
||||||
if( !IsOK( this, msg ) )
|
if( !IsOK( this, msg ) )
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else // New file.
|
else // New file.
|
||||||
{
|
{
|
||||||
|
@ -163,6 +159,15 @@ bool SCH_EDIT_FRAME::EditSheet( SCH_SHEET* aSheet, SCH_SHEET_PATH* aHierarchy )
|
||||||
{
|
{
|
||||||
bool isUndoable = true;
|
bool isUndoable = true;
|
||||||
bool renameFile = false;
|
bool renameFile = false;
|
||||||
|
wxString replaceMsg;
|
||||||
|
wxString newMsg;
|
||||||
|
wxString noUndoMsg;
|
||||||
|
|
||||||
|
replaceMsg.Printf( _( "Change \"%s\" link from \"%s\" to \"%s\"?" ),
|
||||||
|
dlg.GetSheetName(), aSheet->GetFileName(), fileName.GetFullName() );
|
||||||
|
newMsg.Printf( _( "Create new file \"%s\" with contents of \"%s\"?" ),
|
||||||
|
fileName.GetFullName(), aSheet->GetFileName() );
|
||||||
|
noUndoMsg = _( "This action cannot be undone." );
|
||||||
|
|
||||||
// We are always using here a case insensitive comparison
|
// We are always using here a case insensitive comparison
|
||||||
// to avoid issues under Windows, although under Unix
|
// to avoid issues under Windows, although under Unix
|
||||||
|
@ -175,24 +180,12 @@ bool SCH_EDIT_FRAME::EditSheet( SCH_SHEET* aSheet, SCH_SHEET_PATH* aHierarchy )
|
||||||
{
|
{
|
||||||
// Sheet file name changes cannot be undone.
|
// Sheet file name changes cannot be undone.
|
||||||
isUndoable = false;
|
isUndoable = false;
|
||||||
msg = _( "Changing the sheet file name cannot be undone. " );
|
|
||||||
|
|
||||||
if( useScreen || loadFromFile ) // Load from existing file.
|
if( useScreen || loadFromFile ) // Load from existing file.
|
||||||
{
|
{
|
||||||
wxString tmp;
|
clearAnnotation = true;
|
||||||
|
|
||||||
if( useScreen != NULL )
|
msg.Printf( wxT( "%s\n\n%s" ), replaceMsg, noUndoMsg );
|
||||||
{
|
|
||||||
tmp.Printf( _( "A file named \"%s\" already exists in the current schematic "
|
|
||||||
"hierarchy." ), newFilename );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
tmp.Printf( _( "A file named \"%s\" already exists." ), newFilename );
|
|
||||||
}
|
|
||||||
|
|
||||||
msg += tmp;
|
|
||||||
msg += _( "\n\nDo you want to replace the sheet with the contents of this file?" );
|
|
||||||
|
|
||||||
if( !IsOK( this, msg ) )
|
if( !IsOK( this, msg ) )
|
||||||
return false;
|
return false;
|
||||||
|
@ -204,10 +197,9 @@ bool SCH_EDIT_FRAME::EditSheet( SCH_SHEET* aSheet, SCH_SHEET_PATH* aHierarchy )
|
||||||
{
|
{
|
||||||
if( aSheet->GetScreenCount() > 1 )
|
if( aSheet->GetScreenCount() > 1 )
|
||||||
{
|
{
|
||||||
msg += _( "This sheet uses shared data in a complex hierarchy.\n\n" );
|
msg.Printf( wxT( "%s\n\n%s" ), newMsg, noUndoMsg );
|
||||||
msg += _( "Do you wish to convert it to a simple hierarchical sheet?" );
|
|
||||||
|
|
||||||
if( !IsOK( NULL, msg ) )
|
if( !IsOK( this, msg ) )
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -325,6 +317,11 @@ bool SCH_EDIT_FRAME::EditSheet( SCH_SHEET* aSheet, SCH_SHEET_PATH* aHierarchy )
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( clearAnnotation )
|
||||||
|
{
|
||||||
|
newScreens.ClearAnnotation();
|
||||||
|
}
|
||||||
|
|
||||||
m_canvas->MoveCursorToCrossHair();
|
m_canvas->MoveCursorToCrossHair();
|
||||||
m_canvas->SetIgnoreMouseEvents( false );
|
m_canvas->SetIgnoreMouseEvents( false );
|
||||||
OnModify();
|
OnModify();
|
||||||
|
|
Loading…
Reference in New Issue