diff --git a/eeschema/edit_label.cpp b/eeschema/edit_label.cpp index 6078038911..09f38688e6 100644 --- a/eeschema/edit_label.cpp +++ b/eeschema/edit_label.cpp @@ -1,5 +1,5 @@ /*********************************************************************/ -/* EESchema */ +/* EESchema */ /* 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; - - /****************************************************************************/ void DialogLabelEditor::TextPropertiesAccept( wxCommandEvent& event ) /****************************************************************************/ @@ -57,19 +55,19 @@ void DialogLabelEditor::TextPropertiesAccept( wxCommandEvent& event ) m_CurrentText->m_Shape = m_TextShape->GetSelection(); int style = m_TextStyle->GetSelection(); - if ( ( style & 1 ) ) + if( ( style & 1 ) ) m_CurrentText->m_Italic = 1; else 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 ); } else { - m_CurrentText->m_Bold = false; + m_CurrentText->m_Bold = false; m_CurrentText->m_Width = 0; } @@ -158,7 +156,7 @@ void WinEDA_SchematicFrame::ChangeTextOrient( SCH_TEXT* TextStruct, wxDC* DC ) { if( TextStruct == NULL ) TextStruct = (SCH_TEXT*) PickStruct( GetScreen()->m_Curseur, - GetScreen(), TEXTITEM | LABELITEM ); + GetScreen(), TEXTITEM | LABELITEM ); if( TextStruct == NULL ) return; @@ -172,13 +170,14 @@ void WinEDA_SchematicFrame::ChangeTextOrient( SCH_TEXT* TextStruct, wxDC* DC ) /* Rotation du texte */ int orient; + switch( TextStruct->Type() ) { case TYPE_SCH_LABEL: case TYPE_SCH_GLOBALLABEL: case TYPE_SCH_HIERLABEL: case TYPE_SCH_TEXT: - orient = TextStruct->GetSchematicTextOrientation() + 1; + orient = TextStruct->GetSchematicTextOrientation() + 1; orient &= 3; TextStruct->SetSchematicTextOrientation( orient ); break; @@ -218,13 +217,13 @@ SCH_TEXT* WinEDA_SchematicFrame::CreateNewText( wxDC* DC, int type ) case LAYER_HIERLABEL: NewText = new SCH_HIERLABEL( GetScreen()->m_Curseur ); - NewText->m_Shape = s_DefaultShapeGLabel; + NewText->m_Shape = s_DefaultShapeGLabel; NewText->SetSchematicTextOrientation( s_DefaultOrientGLabel ); break; case LAYER_GLOBLABEL: NewText = new SCH_GLOBALLABEL( GetScreen()->m_Curseur ); - NewText->m_Shape = s_DefaultShapeGLabel; + NewText->m_Shape = s_DefaultShapeGLabel; NewText->SetSchematicTextOrientation( s_DefaultOrientGLabel ); break; @@ -295,8 +294,8 @@ static void ExitMoveTexte( WinEDA_DrawPanel* Panel, wxDC* DC ) /*************************************************************/ /* Abort function for the command move text */ { - BASE_SCREEN* screen = Panel->GetScreen(); - SCH_ITEM* Struct = (SCH_ITEM*) screen->GetCurItem(); + BASE_SCREEN* screen = Panel->GetScreen(); + SCH_ITEM* Struct = (SCH_ITEM*) screen->GetCurItem(); g_ItemToRepeat = NULL; Panel->ManageCurseur = NULL; @@ -325,11 +324,11 @@ static void ExitMoveTexte( WinEDA_DrawPanel* Panel, wxDC* DC ) case TYPE_SCH_TEXT: { SCH_TEXT* Text = (SCH_TEXT*) Struct; - Text->m_Pos = ItemInitialPosition; - Text->m_Size = OldSize; + Text->m_Pos = ItemInitialPosition; + Text->m_Size = OldSize; Text->SetSchematicTextOrientation( OldOrient ); } - break; + break; default: break; @@ -380,12 +379,18 @@ void WinEDA_SchematicFrame::ConvertTextType( SCH_TEXT* Text, return; } - /* copy the old text settings */ - newtext->m_Shape = Text->m_Shape; + /* copy the old text settings + * 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->m_Size = Text->m_Size; - newtext->m_Width = Text->m_Width; - newtext->m_IsDangling = Text->m_IsDangling; + newtext->m_Size = Text->m_Size; + newtext->m_Width = Text->m_Width; + newtext->m_Italic = Text->m_Italic; + newtext->m_Bold = Text->m_Bold; + // save current text flag: int flags = Text->m_Flags; diff --git a/pcbnew/librairi.cpp b/pcbnew/librairi.cpp index 24f360d63b..fe46728c16 100644 --- a/pcbnew/librairi.cpp +++ b/pcbnew/librairi.cpp @@ -24,7 +24,7 @@ * $EndLIBRARY */ -#define OLD_EXT wxT( "bak" ) +#define BACKUP_EXT wxT( "bak" ) #define FILETMP_EXT wxT( "$$$" ) #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 */ wxFileName backupFileName = oldFileName; - backupFileName.SetExt( OLD_EXT ); + backupFileName.SetExt( BACKUP_EXT ); if( backupFileName.FileExists() ) wxRemoveFile( backupFileName.GetFullPath() ); - if( !wxRenameFile( newFileName.GetFullPath(), + if( !wxRenameFile( oldFileName.GetFullPath(), backupFileName.GetFullPath() ) ) { 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 */ oldFileName = aLibName; - oldFileName.SetExt( OLD_EXT ); + oldFileName.SetExt( BACKUP_EXT ); if( oldFileName.FileExists() ) wxRemoveFile( oldFileName.GetFullPath() ); diff --git a/pcbnew/loadcmp.cpp b/pcbnew/loadcmp.cpp index 8fcd4f6cd7..793c2b0d8d 100644 --- a/pcbnew/loadcmp.cpp +++ b/pcbnew/loadcmp.cpp @@ -214,10 +214,13 @@ MODULE* WinEDA_BasePcbFrame::Get_Librairie_Module( const wxString& aLibraryFullF if( !tmp ) { - msg.Printf( _( "PCB footprint library file <%s> not found in search paths." ), - fn.GetFullName().c_str() ); - wxMessageBox( msg, _( "Library Load Error" ), - wxOK | wxICON_ERROR, this ); + if ( aDisplayMessageError ) + { + msg.Printf( _( "PCB footprint library file <%s> not found in search paths." ), + fn.GetFullName().c_str() ); + wxMessageBox( msg, _( "Library Load Error" ), + wxOK | wxICON_ERROR, this ); + } continue; } diff --git a/pcbnew/xchgmod.cpp b/pcbnew/xchgmod.cpp index 8e7ae3e17d..4c2fe6df47 100644 --- a/pcbnew/xchgmod.cpp +++ b/pcbnew/xchgmod.cpp @@ -124,10 +124,12 @@ void DIALOG_EXCHANGE_MODULE::OnSelectionClicked( wxCommandEvent& event ) case 1: case 2: m_NewModule->Enable( true ); + m_Browsebutton->Enable( true ); break; case 3: m_NewModule->Enable( false ); + m_Browsebutton->Enable( false ); break; } } @@ -202,7 +204,7 @@ int DIALOG_EXCHANGE_MODULE::Maj_ListeCmp( const wxString& reference, strtok( buf, ";\n\r" ); 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 ) 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->DrawPanel->Refresh(); @@ -272,9 +274,9 @@ void DIALOG_EXCHANGE_MODULE::Change_ModuleId( bool aUseValue ) MODULE* Module, * PtBack; bool change = FALSE; 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; - 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 ) return; @@ -284,7 +286,7 @@ void DIALOG_EXCHANGE_MODULE::Change_ModuleId( bool aUseValue ) lib_reference = m_CurrentModule->m_LibRef; if( aUseValue ) { - check_module_value = TRUE; + check_module_value = true; value = m_CurrentModule->m_Value->m_Text; msg.Printf( _( "Change modules <%s> -> <%s> (val = %s)?" ), 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 ); if( module ) - change = TRUE; + change = true; else if( ShowErr ) ShowErr--; } @@ -345,7 +347,7 @@ void DIALOG_EXCHANGE_MODULE::Change_ModuleAll() { MODULE* Module, * PtBack; 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 ) return; @@ -364,7 +366,7 @@ void DIALOG_EXCHANGE_MODULE::Change_ModuleAll() { PtBack = Module->Back(); if( Change_1_Module( Module, Module->m_LibRef.GetData(), ShowErr ) ) - change = TRUE; + change = true; else if( ShowErr ) ShowErr--; } @@ -411,7 +413,7 @@ MODULE* DIALOG_EXCHANGE_MODULE::Change_1_Module( MODULE* Module, Module->m_Reference->m_Text.GetData(), oldnamecmp.GetData() ); m_WinMessages->AppendText( Line ); - namecmp.Trim( TRUE ); + namecmp.Trim( true ); namecmp.Trim( FALSE ); NewModule = m_Parent->Get_Librairie_Module( wxEmptyString, namecmp, @@ -468,19 +470,19 @@ MODULE* WinEDA_BasePcbFrame::Exchange_Module( wxWindow* winaff, Place_Module( NewModule, NULL, true ); GetScreen()->m_Curseur = oldpos; - /* Changement eventuel de couche */ + /* Flip footprint if needed */ if( OldModule->GetLayer() != NewModule->GetLayer() ) { GetBoard()->Change_Side_Module( NewModule, NULL ); } - /* Rotation eventuelle du module */ + /* Rotate footprint if needed */ if( OldModule->m_Orient != NewModule->m_Orient ) { 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_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_Path = OldModule->m_Path; - /* mise a jour des netnames ( lorsque c'est possible) */ + /* Update pad netnames ( when possible) */ pad = NewModule->m_Pads; for( ; pad != NULL; pad = pad->Next() ) {