pcbnew: fixed bug in modedit: delete module in library not working
This commit is contained in:
parent
cffe0cfcaa
commit
539f041b76
|
@ -1,5 +1,5 @@
|
||||||
/*********************************************************************/
|
/*********************************************************************/
|
||||||
/* EESchema */
|
/* EESchema */
|
||||||
/* edit_label.cpp: label, global label and text creation or edition */
|
/* edit_label.cpp: label, global label and text creation or edition */
|
||||||
/*********************************************************************/
|
/*********************************************************************/
|
||||||
|
|
||||||
|
@ -30,8 +30,6 @@ static int s_DefaultShapeGLabel = (int) NET_INPUT;
|
||||||
static int s_DefaultOrientGLabel = 0;
|
static int s_DefaultOrientGLabel = 0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
void DialogLabelEditor::TextPropertiesAccept( wxCommandEvent& event )
|
void DialogLabelEditor::TextPropertiesAccept( wxCommandEvent& event )
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
|
@ -57,19 +55,19 @@ void DialogLabelEditor::TextPropertiesAccept( wxCommandEvent& event )
|
||||||
m_CurrentText->m_Shape = m_TextShape->GetSelection();
|
m_CurrentText->m_Shape = m_TextShape->GetSelection();
|
||||||
|
|
||||||
int style = m_TextStyle->GetSelection();
|
int style = m_TextStyle->GetSelection();
|
||||||
if ( ( style & 1 ) )
|
if( ( style & 1 ) )
|
||||||
m_CurrentText->m_Italic = 1;
|
m_CurrentText->m_Italic = 1;
|
||||||
else
|
else
|
||||||
m_CurrentText->m_Italic = 0;
|
m_CurrentText->m_Italic = 0;
|
||||||
|
|
||||||
if ( ( style & 2 ) )
|
if( ( style & 2 ) )
|
||||||
{
|
{
|
||||||
m_CurrentText->m_Bold = true;
|
m_CurrentText->m_Bold = true;
|
||||||
m_CurrentText->m_Width = GetPenSizeForBold( m_CurrentText->m_Size.x );
|
m_CurrentText->m_Width = GetPenSizeForBold( m_CurrentText->m_Size.x );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_CurrentText->m_Bold = false;
|
m_CurrentText->m_Bold = false;
|
||||||
m_CurrentText->m_Width = 0;
|
m_CurrentText->m_Width = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -158,7 +156,7 @@ void WinEDA_SchematicFrame::ChangeTextOrient( SCH_TEXT* TextStruct, wxDC* DC )
|
||||||
{
|
{
|
||||||
if( TextStruct == NULL )
|
if( TextStruct == NULL )
|
||||||
TextStruct = (SCH_TEXT*) PickStruct( GetScreen()->m_Curseur,
|
TextStruct = (SCH_TEXT*) PickStruct( GetScreen()->m_Curseur,
|
||||||
GetScreen(), TEXTITEM | LABELITEM );
|
GetScreen(), TEXTITEM | LABELITEM );
|
||||||
if( TextStruct == NULL )
|
if( TextStruct == NULL )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -172,13 +170,14 @@ void WinEDA_SchematicFrame::ChangeTextOrient( SCH_TEXT* TextStruct, wxDC* DC )
|
||||||
|
|
||||||
/* Rotation du texte */
|
/* Rotation du texte */
|
||||||
int orient;
|
int orient;
|
||||||
|
|
||||||
switch( TextStruct->Type() )
|
switch( TextStruct->Type() )
|
||||||
{
|
{
|
||||||
case TYPE_SCH_LABEL:
|
case TYPE_SCH_LABEL:
|
||||||
case TYPE_SCH_GLOBALLABEL:
|
case TYPE_SCH_GLOBALLABEL:
|
||||||
case TYPE_SCH_HIERLABEL:
|
case TYPE_SCH_HIERLABEL:
|
||||||
case TYPE_SCH_TEXT:
|
case TYPE_SCH_TEXT:
|
||||||
orient = TextStruct->GetSchematicTextOrientation() + 1;
|
orient = TextStruct->GetSchematicTextOrientation() + 1;
|
||||||
orient &= 3;
|
orient &= 3;
|
||||||
TextStruct->SetSchematicTextOrientation( orient );
|
TextStruct->SetSchematicTextOrientation( orient );
|
||||||
break;
|
break;
|
||||||
|
@ -218,13 +217,13 @@ SCH_TEXT* WinEDA_SchematicFrame::CreateNewText( wxDC* DC, int type )
|
||||||
|
|
||||||
case LAYER_HIERLABEL:
|
case LAYER_HIERLABEL:
|
||||||
NewText = new SCH_HIERLABEL( GetScreen()->m_Curseur );
|
NewText = new SCH_HIERLABEL( GetScreen()->m_Curseur );
|
||||||
NewText->m_Shape = s_DefaultShapeGLabel;
|
NewText->m_Shape = s_DefaultShapeGLabel;
|
||||||
NewText->SetSchematicTextOrientation( s_DefaultOrientGLabel );
|
NewText->SetSchematicTextOrientation( s_DefaultOrientGLabel );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LAYER_GLOBLABEL:
|
case LAYER_GLOBLABEL:
|
||||||
NewText = new SCH_GLOBALLABEL( GetScreen()->m_Curseur );
|
NewText = new SCH_GLOBALLABEL( GetScreen()->m_Curseur );
|
||||||
NewText->m_Shape = s_DefaultShapeGLabel;
|
NewText->m_Shape = s_DefaultShapeGLabel;
|
||||||
NewText->SetSchematicTextOrientation( s_DefaultOrientGLabel );
|
NewText->SetSchematicTextOrientation( s_DefaultOrientGLabel );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -295,8 +294,8 @@ static void ExitMoveTexte( WinEDA_DrawPanel* Panel, wxDC* DC )
|
||||||
/*************************************************************/
|
/*************************************************************/
|
||||||
/* Abort function for the command move text */
|
/* Abort function for the command move text */
|
||||||
{
|
{
|
||||||
BASE_SCREEN* screen = Panel->GetScreen();
|
BASE_SCREEN* screen = Panel->GetScreen();
|
||||||
SCH_ITEM* Struct = (SCH_ITEM*) screen->GetCurItem();
|
SCH_ITEM* Struct = (SCH_ITEM*) screen->GetCurItem();
|
||||||
|
|
||||||
g_ItemToRepeat = NULL;
|
g_ItemToRepeat = NULL;
|
||||||
Panel->ManageCurseur = NULL;
|
Panel->ManageCurseur = NULL;
|
||||||
|
@ -325,11 +324,11 @@ static void ExitMoveTexte( WinEDA_DrawPanel* Panel, wxDC* DC )
|
||||||
case TYPE_SCH_TEXT:
|
case TYPE_SCH_TEXT:
|
||||||
{
|
{
|
||||||
SCH_TEXT* Text = (SCH_TEXT*) Struct;
|
SCH_TEXT* Text = (SCH_TEXT*) Struct;
|
||||||
Text->m_Pos = ItemInitialPosition;
|
Text->m_Pos = ItemInitialPosition;
|
||||||
Text->m_Size = OldSize;
|
Text->m_Size = OldSize;
|
||||||
Text->SetSchematicTextOrientation( OldOrient );
|
Text->SetSchematicTextOrientation( OldOrient );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -380,12 +379,18 @@ void WinEDA_SchematicFrame::ConvertTextType( SCH_TEXT* Text,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* copy the old text settings */
|
/* copy the old text settings
|
||||||
newtext->m_Shape = Text->m_Shape;
|
* Justifications are not copied because they are not used in labels,
|
||||||
|
* and can be used in texts
|
||||||
|
* So they will be set to default in conversion.
|
||||||
|
*/
|
||||||
|
newtext->m_Shape = Text->m_Shape;
|
||||||
newtext->SetSchematicTextOrientation( Text->GetSchematicTextOrientation() );
|
newtext->SetSchematicTextOrientation( Text->GetSchematicTextOrientation() );
|
||||||
newtext->m_Size = Text->m_Size;
|
newtext->m_Size = Text->m_Size;
|
||||||
newtext->m_Width = Text->m_Width;
|
newtext->m_Width = Text->m_Width;
|
||||||
newtext->m_IsDangling = Text->m_IsDangling;
|
newtext->m_Italic = Text->m_Italic;
|
||||||
|
newtext->m_Bold = Text->m_Bold;
|
||||||
|
|
||||||
|
|
||||||
// save current text flag:
|
// save current text flag:
|
||||||
int flags = Text->m_Flags;
|
int flags = Text->m_Flags;
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
* $EndLIBRARY
|
* $EndLIBRARY
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define OLD_EXT wxT( "bak" )
|
#define BACKUP_EXT wxT( "bak" )
|
||||||
#define FILETMP_EXT wxT( "$$$" )
|
#define FILETMP_EXT wxT( "$$$" )
|
||||||
#define EXPORT_IMPORT_LASTPATH_KEY wxT( "import_last_path" )
|
#define EXPORT_IMPORT_LASTPATH_KEY wxT( "import_last_path" )
|
||||||
|
|
||||||
|
@ -359,12 +359,12 @@ void WinEDA_ModuleEditFrame::Delete_Module_In_Library( const
|
||||||
|
|
||||||
/* Le fichier ancienne librairie est renommee en .bak */
|
/* Le fichier ancienne librairie est renommee en .bak */
|
||||||
wxFileName backupFileName = oldFileName;
|
wxFileName backupFileName = oldFileName;
|
||||||
backupFileName.SetExt( OLD_EXT );
|
backupFileName.SetExt( BACKUP_EXT );
|
||||||
|
|
||||||
if( backupFileName.FileExists() )
|
if( backupFileName.FileExists() )
|
||||||
wxRemoveFile( backupFileName.GetFullPath() );
|
wxRemoveFile( backupFileName.GetFullPath() );
|
||||||
|
|
||||||
if( !wxRenameFile( newFileName.GetFullPath(),
|
if( !wxRenameFile( oldFileName.GetFullPath(),
|
||||||
backupFileName.GetFullPath() ) )
|
backupFileName.GetFullPath() ) )
|
||||||
{
|
{
|
||||||
DisplayError( this, wxT( "Librairi.cpp: rename .bak err" ) );
|
DisplayError( this, wxT( "Librairi.cpp: rename .bak err" ) );
|
||||||
|
@ -669,7 +669,7 @@ int WinEDA_BasePcbFrame::Save_Module_In_Library( const wxString& aLibName,
|
||||||
|
|
||||||
/* The old library file is renamed .bak */
|
/* The old library file is renamed .bak */
|
||||||
oldFileName = aLibName;
|
oldFileName = aLibName;
|
||||||
oldFileName.SetExt( OLD_EXT );
|
oldFileName.SetExt( BACKUP_EXT );
|
||||||
|
|
||||||
if( oldFileName.FileExists() )
|
if( oldFileName.FileExists() )
|
||||||
wxRemoveFile( oldFileName.GetFullPath() );
|
wxRemoveFile( oldFileName.GetFullPath() );
|
||||||
|
|
|
@ -214,10 +214,13 @@ MODULE* WinEDA_BasePcbFrame::Get_Librairie_Module( const wxString& aLibraryFullF
|
||||||
|
|
||||||
if( !tmp )
|
if( !tmp )
|
||||||
{
|
{
|
||||||
msg.Printf( _( "PCB footprint library file <%s> not found in search paths." ),
|
if ( aDisplayMessageError )
|
||||||
fn.GetFullName().c_str() );
|
{
|
||||||
wxMessageBox( msg, _( "Library Load Error" ),
|
msg.Printf( _( "PCB footprint library file <%s> not found in search paths." ),
|
||||||
wxOK | wxICON_ERROR, this );
|
fn.GetFullName().c_str() );
|
||||||
|
wxMessageBox( msg, _( "Library Load Error" ),
|
||||||
|
wxOK | wxICON_ERROR, this );
|
||||||
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -124,10 +124,12 @@ void DIALOG_EXCHANGE_MODULE::OnSelectionClicked( wxCommandEvent& event )
|
||||||
case 1:
|
case 1:
|
||||||
case 2:
|
case 2:
|
||||||
m_NewModule->Enable( true );
|
m_NewModule->Enable( true );
|
||||||
|
m_Browsebutton->Enable( true );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 3:
|
case 3:
|
||||||
m_NewModule->Enable( false );
|
m_NewModule->Enable( false );
|
||||||
|
m_Browsebutton->Enable( false );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -202,7 +204,7 @@ int DIALOG_EXCHANGE_MODULE::Maj_ListeCmp( const wxString& reference,
|
||||||
strtok( buf, ";\n\r" );
|
strtok( buf, ";\n\r" );
|
||||||
if( stricmp( buf, CONV_TO_UTF8( reference ) ) == 0 )
|
if( stricmp( buf, CONV_TO_UTF8( reference ) ) == 0 )
|
||||||
{
|
{
|
||||||
start_descr = TRUE;
|
start_descr = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -247,7 +249,7 @@ void DIALOG_EXCHANGE_MODULE::Change_Module()
|
||||||
if( newmodulename == wxEmptyString )
|
if( newmodulename == wxEmptyString )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if( Change_1_Module( m_CurrentModule, newmodulename, TRUE ) )
|
if( Change_1_Module( m_CurrentModule, newmodulename, true ) )
|
||||||
{
|
{
|
||||||
m_Parent->Compile_Ratsnest( NULL, true );
|
m_Parent->Compile_Ratsnest( NULL, true );
|
||||||
m_Parent->DrawPanel->Refresh();
|
m_Parent->DrawPanel->Refresh();
|
||||||
|
@ -272,9 +274,9 @@ void DIALOG_EXCHANGE_MODULE::Change_ModuleId( bool aUseValue )
|
||||||
MODULE* Module, * PtBack;
|
MODULE* Module, * PtBack;
|
||||||
bool change = FALSE;
|
bool change = FALSE;
|
||||||
wxString newmodulename = m_NewModule->GetValue();
|
wxString newmodulename = m_NewModule->GetValue();
|
||||||
wxString value, lib_reference; // pour memo Reflib et value de reference
|
wxString value, lib_reference;
|
||||||
bool check_module_value = FALSE;
|
bool check_module_value = FALSE;
|
||||||
int ShowErr = 5; // Affiche 5 messages d'err maxi
|
int ShowErr = 3; // Affiche 3 messages d'err maxi
|
||||||
|
|
||||||
if( m_Parent->GetBoard()->m_Modules == NULL )
|
if( m_Parent->GetBoard()->m_Modules == NULL )
|
||||||
return;
|
return;
|
||||||
|
@ -284,7 +286,7 @@ void DIALOG_EXCHANGE_MODULE::Change_ModuleId( bool aUseValue )
|
||||||
lib_reference = m_CurrentModule->m_LibRef;
|
lib_reference = m_CurrentModule->m_LibRef;
|
||||||
if( aUseValue )
|
if( aUseValue )
|
||||||
{
|
{
|
||||||
check_module_value = TRUE;
|
check_module_value = true;
|
||||||
value = m_CurrentModule->m_Value->m_Text;
|
value = m_CurrentModule->m_Value->m_Text;
|
||||||
msg.Printf( _( "Change modules <%s> -> <%s> (val = %s)?" ),
|
msg.Printf( _( "Change modules <%s> -> <%s> (val = %s)?" ),
|
||||||
m_CurrentModule->m_LibRef.GetData(),
|
m_CurrentModule->m_LibRef.GetData(),
|
||||||
|
@ -320,7 +322,7 @@ void DIALOG_EXCHANGE_MODULE::Change_ModuleId( bool aUseValue )
|
||||||
}
|
}
|
||||||
module = Change_1_Module( Module, newmodulename.GetData(), ShowErr );
|
module = Change_1_Module( Module, newmodulename.GetData(), ShowErr );
|
||||||
if( module )
|
if( module )
|
||||||
change = TRUE;
|
change = true;
|
||||||
else if( ShowErr )
|
else if( ShowErr )
|
||||||
ShowErr--;
|
ShowErr--;
|
||||||
}
|
}
|
||||||
|
@ -345,7 +347,7 @@ void DIALOG_EXCHANGE_MODULE::Change_ModuleAll()
|
||||||
{
|
{
|
||||||
MODULE* Module, * PtBack;
|
MODULE* Module, * PtBack;
|
||||||
bool change = FALSE;
|
bool change = FALSE;
|
||||||
int ShowErr = 5; // Affiche 5 messages d'err maxi
|
int ShowErr = 3; // Affiche 3 messages d'err maxi
|
||||||
|
|
||||||
if( m_Parent->GetBoard()->m_Modules == NULL )
|
if( m_Parent->GetBoard()->m_Modules == NULL )
|
||||||
return;
|
return;
|
||||||
|
@ -364,7 +366,7 @@ void DIALOG_EXCHANGE_MODULE::Change_ModuleAll()
|
||||||
{
|
{
|
||||||
PtBack = Module->Back();
|
PtBack = Module->Back();
|
||||||
if( Change_1_Module( Module, Module->m_LibRef.GetData(), ShowErr ) )
|
if( Change_1_Module( Module, Module->m_LibRef.GetData(), ShowErr ) )
|
||||||
change = TRUE;
|
change = true;
|
||||||
else if( ShowErr )
|
else if( ShowErr )
|
||||||
ShowErr--;
|
ShowErr--;
|
||||||
}
|
}
|
||||||
|
@ -411,7 +413,7 @@ MODULE* DIALOG_EXCHANGE_MODULE::Change_1_Module( MODULE* Module,
|
||||||
Module->m_Reference->m_Text.GetData(), oldnamecmp.GetData() );
|
Module->m_Reference->m_Text.GetData(), oldnamecmp.GetData() );
|
||||||
m_WinMessages->AppendText( Line );
|
m_WinMessages->AppendText( Line );
|
||||||
|
|
||||||
namecmp.Trim( TRUE );
|
namecmp.Trim( true );
|
||||||
namecmp.Trim( FALSE );
|
namecmp.Trim( FALSE );
|
||||||
NewModule = m_Parent->Get_Librairie_Module( wxEmptyString,
|
NewModule = m_Parent->Get_Librairie_Module( wxEmptyString,
|
||||||
namecmp,
|
namecmp,
|
||||||
|
@ -468,19 +470,19 @@ MODULE* WinEDA_BasePcbFrame::Exchange_Module( wxWindow* winaff,
|
||||||
Place_Module( NewModule, NULL, true );
|
Place_Module( NewModule, NULL, true );
|
||||||
GetScreen()->m_Curseur = oldpos;
|
GetScreen()->m_Curseur = oldpos;
|
||||||
|
|
||||||
/* Changement eventuel de couche */
|
/* Flip footprint if needed */
|
||||||
if( OldModule->GetLayer() != NewModule->GetLayer() )
|
if( OldModule->GetLayer() != NewModule->GetLayer() )
|
||||||
{
|
{
|
||||||
GetBoard()->Change_Side_Module( NewModule, NULL );
|
GetBoard()->Change_Side_Module( NewModule, NULL );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Rotation eventuelle du module */
|
/* Rotate footprint if needed */
|
||||||
if( OldModule->m_Orient != NewModule->m_Orient )
|
if( OldModule->m_Orient != NewModule->m_Orient )
|
||||||
{
|
{
|
||||||
Rotate_Module( NULL, NewModule, OldModule->m_Orient, FALSE );
|
Rotate_Module( NULL, NewModule, OldModule->m_Orient, FALSE );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Mise a jour des textes ref et val */
|
/* Update reference and value */
|
||||||
NewModule->m_Reference->m_Text = OldModule->m_Reference->m_Text;
|
NewModule->m_Reference->m_Text = OldModule->m_Reference->m_Text;
|
||||||
NewModule->m_Value->m_Text = OldModule->m_Value->m_Text;
|
NewModule->m_Value->m_Text = OldModule->m_Value->m_Text;
|
||||||
|
|
||||||
|
@ -488,7 +490,7 @@ MODULE* WinEDA_BasePcbFrame::Exchange_Module( wxWindow* winaff,
|
||||||
NewModule->m_TimeStamp = OldModule->m_TimeStamp;
|
NewModule->m_TimeStamp = OldModule->m_TimeStamp;
|
||||||
NewModule->m_Path = OldModule->m_Path;
|
NewModule->m_Path = OldModule->m_Path;
|
||||||
|
|
||||||
/* mise a jour des netnames ( lorsque c'est possible) */
|
/* Update pad netnames ( when possible) */
|
||||||
pad = NewModule->m_Pads;
|
pad = NewModule->m_Pads;
|
||||||
for( ; pad != NULL; pad = pad->Next() )
|
for( ; pad != NULL; pad = pad->Next() )
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue