Encapsulate LIB_PIN class and begin encapsulating SCH_EDIT_FRAME class.

This commit is contained in:
Wayne Stambaugh 2011-12-08 16:05:43 -05:00
parent 37c3e32119
commit d8ad2cceb0
23 changed files with 160 additions and 129 deletions

View File

@ -84,7 +84,7 @@ void SCH_EDIT_FRAME::AnnotateComponents( bool aAnnotateSchematic,
} }
else else
{ {
GetSheet()->GetComponents( references ); m_CurrentSheet->GetComponents( references );
} }
/* Break full components reference in name (prefix) and number: /* Break full components reference in name (prefix) and number:
@ -162,7 +162,7 @@ int SCH_EDIT_FRAME::CheckAnnotate( wxArrayString* aMessageList, bool aOneSheetOn
if( !aOneSheetOnly ) if( !aOneSheetOnly )
SheetList.GetComponents( ComponentsList ); SheetList.GetComponents( ComponentsList );
else else
GetSheet()->GetComponents( ComponentsList ); m_CurrentSheet->GetComponents( ComponentsList );
return ComponentsList.CheckAnnotation( aMessageList ); return ComponentsList.CheckAnnotation( aMessageList );
} }

View File

@ -106,7 +106,7 @@ SCH_ITEM* SCH_EDIT_FRAME::LocateAndShowItem( const wxPoint& aPosition, const KIC
Pin->DisplayInfo( this ); Pin->DisplayInfo( this );
if( LibItem ) if( LibItem )
AppendMsgPanel( LibItem->GetRef( GetSheet() ), AppendMsgPanel( LibItem->GetRef( m_CurrentSheet ),
LibItem->GetField( VALUE )->m_Text, DARKCYAN ); LibItem->GetField( VALUE )->m_Text, DARKCYAN );
// Cross probing:2 - pin found, and send a locate pin command to Pcbnew (highlight net) // Cross probing:2 - pin found, and send a locate pin command to Pcbnew (highlight net)

View File

@ -125,7 +125,8 @@ void DIALOG_SVG_PRINT::PrintSVGDoc( bool aPrintAll, bool aPrint_Sheet_Ref )
if( aPrintAll && m_Parent->IsType( SCHEMATIC_FRAME ) ) if( aPrintAll && m_Parent->IsType( SCHEMATIC_FRAME ) )
{ {
SCH_EDIT_FRAME* schframe = (SCH_EDIT_FRAME*) m_Parent; SCH_EDIT_FRAME* schframe = (SCH_EDIT_FRAME*) m_Parent;
SCH_SHEET_PATH* sheetpath, * oldsheetpath = schframe->GetSheet(); SCH_SHEET_PATH* sheetpath;
SCH_SHEET_PATH oldsheetpath = schframe->GetCurrentSheet();
SCH_SCREEN* schscreen = schframe->GetScreen(); SCH_SCREEN* schscreen = schframe->GetScreen();
SCH_SHEET_LIST SheetList( NULL ); SCH_SHEET_LIST SheetList( NULL );
sheetpath = SheetList.GetFirst(); sheetpath = SheetList.GetFirst();
@ -135,14 +136,15 @@ void DIALOG_SVG_PRINT::PrintSVGDoc( bool aPrintAll, bool aPrint_Sheet_Ref )
{ {
if( sheetpath == NULL ) if( sheetpath == NULL )
break; break;
list.Clear(); list.Clear();
if( list.BuildSheetPathInfoFromSheetPathValue( sheetpath->Path() ) ) if( list.BuildSheetPathInfoFromSheetPathValue( sheetpath->Path() ) )
{ {
schframe->m_CurrentSheet = &list; schframe->SetCurrentSheet( list );
schframe->m_CurrentSheet->UpdateAllScreenReferences(); schframe->GetCurrentSheet().UpdateAllScreenReferences();
schframe->SetSheetNumberAndCount(); schframe->SetSheetNumberAndCount();
schscreen = schframe->m_CurrentSheet->LastScreen(); schscreen = schframe->GetCurrentSheet().LastScreen();
} }
else // Should not happen else // Should not happen
return; return;
@ -161,8 +163,8 @@ void DIALOG_SVG_PRINT::PrintSVGDoc( bool aPrintAll, bool aPrint_Sheet_Ref )
m_MessagesBox->AppendText( msg ); m_MessagesBox->AppendText( msg );
} }
schframe->m_CurrentSheet = oldsheetpath; schframe->SetCurrentSheet( oldsheetpath );
schframe->m_CurrentSheet->UpdateAllScreenReferences(); schframe->GetCurrentSheet().UpdateAllScreenReferences();
schframe->SetSheetNumberAndCount(); schframe->SetSheetNumberAndCount();
} }
else else

View File

@ -167,7 +167,7 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyPanelToOptions()
if( m_Cmp->GetUnit() ) if( m_Cmp->GetUnit() )
{ {
int unit_selection = unitChoice->GetCurrentSelection() + 1; int unit_selection = unitChoice->GetCurrentSelection() + 1;
m_Cmp->SetUnitSelection( m_Parent->GetSheet(), unit_selection ); m_Cmp->SetUnitSelection( &m_Parent->GetCurrentSheet(), unit_selection );
m_Cmp->SetUnit( unit_selection ); m_Cmp->SetUnit( unit_selection );
} }
@ -279,7 +279,7 @@ Do you wish to remove this and all remaining undefined fields?" ),
// Reference has a specific initialization, depending on the current active sheet // Reference has a specific initialization, depending on the current active sheet
// because for a given component, in a complex hierarchy, there are more than one // because for a given component, in a complex hierarchy, there are more than one
// reference. // reference.
m_Cmp->SetRef( m_Parent->GetSheet(), m_FieldsBuf[REFERENCE].m_Text ); m_Cmp->SetRef( &m_Parent->GetCurrentSheet(), m_FieldsBuf[REFERENCE].m_Text );
m_Parent->OnModify(); m_Parent->OnModify();
m_Parent->GetScreen()->TestDanglingEnds(); m_Parent->GetScreen()->TestDanglingEnds();
@ -520,7 +520,7 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::InitBuffers( SCH_COMPONENT* aComponent
} }
#endif #endif
m_FieldsBuf[REFERENCE].m_Text = m_Cmp->GetRef( m_Parent->GetSheet() ); m_FieldsBuf[REFERENCE].m_Text = m_Cmp->GetRef( &m_Parent->GetCurrentSheet() );
for( unsigned i = 0; i<m_FieldsBuf.size(); ++i ) for( unsigned i = 0; i<m_FieldsBuf.size(); ++i )
{ {

View File

@ -196,11 +196,11 @@ void DIALOG_ERC::OnLeftDClickMarkersList( wxCommandEvent& event )
return; return;
} }
if( sheet != m_Parent->GetSheet() ) if( *sheet != m_Parent->GetCurrentSheet() )
{ {
sheet->LastScreen()->SetZoom( m_Parent->GetScreen()->GetZoom() ); sheet->LastScreen()->SetZoom( m_Parent->GetScreen()->GetZoom() );
*m_Parent->m_CurrentSheet = *sheet; m_Parent->SetCurrentSheet( *sheet );
m_Parent->m_CurrentSheet->UpdateAllScreenReferences(); m_Parent->GetCurrentSheet().UpdateAllScreenReferences();
} }
m_Parent->GetScreen()->SetCrossHairPosition( pos ); m_Parent->GetScreen()->SetCrossHairPosition( pos );

View File

@ -145,7 +145,8 @@ void DIALOG_PLOT_SCHEMATIC_DXF::CreateDXFFile( )
{ {
SCH_EDIT_FRAME* schframe = (SCH_EDIT_FRAME*) m_Parent; SCH_EDIT_FRAME* schframe = (SCH_EDIT_FRAME*) m_Parent;
SCH_SCREEN* screen = schframe->GetScreen(); SCH_SCREEN* screen = schframe->GetScreen();
SCH_SHEET_PATH* sheetpath, * oldsheetpath = schframe->GetSheet(); SCH_SHEET_PATH* sheetpath;
SCH_SHEET_PATH oldsheetpath = schframe->GetCurrentSheet();
wxString PlotFileName; wxString PlotFileName;
Ki_PageDescr* PlotSheet; Ki_PageDescr* PlotSheet;
wxPoint plot_offset; wxPoint plot_offset;
@ -172,13 +173,15 @@ void DIALOG_PLOT_SCHEMATIC_DXF::CreateDXFFile( )
if( list.BuildSheetPathInfoFromSheetPathValue( sheetpath->Path() ) ) if( list.BuildSheetPathInfoFromSheetPathValue( sheetpath->Path() ) )
{ {
schframe->m_CurrentSheet = &list; schframe->SetCurrentSheet( list );
schframe->m_CurrentSheet->UpdateAllScreenReferences(); schframe->GetCurrentSheet().UpdateAllScreenReferences();
schframe->SetSheetNumberAndCount(); schframe->SetSheetNumberAndCount();
screen = schframe->m_CurrentSheet->LastScreen(); screen = schframe->GetCurrentSheet().LastScreen();
} }
else // Should not happen else // Should not happen
{
return; return;
}
sheetpath = SheetList.GetNext(); sheetpath = SheetList.GetNext();
} }
@ -197,8 +200,8 @@ void DIALOG_PLOT_SCHEMATIC_DXF::CreateDXFFile( )
break; break;
} }
schframe->m_CurrentSheet = oldsheetpath; schframe->SetCurrentSheet( oldsheetpath );
schframe->m_CurrentSheet->UpdateAllScreenReferences(); schframe->GetCurrentSheet().UpdateAllScreenReferences();
schframe->SetSheetNumberAndCount(); schframe->SetSheetNumberAndCount();
} }

View File

@ -281,7 +281,8 @@ void DIALOG_PLOT_SCHEMATIC_HPGL::Plot_Schematic_HPGL( bool aPlotAll, int HPGL_Sh
{ {
wxString PlotFileName; wxString PlotFileName;
SCH_SCREEN* screen = m_Parent->GetScreen(); SCH_SCREEN* screen = m_Parent->GetScreen();
SCH_SHEET_PATH* sheetpath, * oldsheetpath = m_Parent->GetSheet(); SCH_SHEET_PATH* sheetpath;
SCH_SHEET_PATH oldsheetpath = m_Parent->GetCurrentSheet();
Ki_PageDescr* PlotSheet; Ki_PageDescr* PlotSheet;
wxSize SheetSize; wxSize SheetSize;
wxPoint SheetOffset, PlotOffset; wxPoint SheetOffset, PlotOffset;
@ -308,10 +309,10 @@ void DIALOG_PLOT_SCHEMATIC_HPGL::Plot_Schematic_HPGL( bool aPlotAll, int HPGL_Sh
if( list.BuildSheetPathInfoFromSheetPathValue( sheetpath->Path() ) ) if( list.BuildSheetPathInfoFromSheetPathValue( sheetpath->Path() ) )
{ {
m_Parent->m_CurrentSheet = &list; m_Parent->SetCurrentSheet( list );
m_Parent->m_CurrentSheet->UpdateAllScreenReferences(); m_Parent->GetCurrentSheet().UpdateAllScreenReferences();
m_Parent->SetSheetNumberAndCount(); m_Parent->SetSheetNumberAndCount();
screen = m_Parent->m_CurrentSheet->LastScreen(); screen = m_Parent->GetCurrentSheet().LastScreen();
} }
else // Should not happen else // Should not happen
return; return;
@ -344,8 +345,8 @@ void DIALOG_PLOT_SCHEMATIC_HPGL::Plot_Schematic_HPGL( bool aPlotAll, int HPGL_Sh
break; break;
} }
m_Parent->m_CurrentSheet = oldsheetpath; m_Parent->SetCurrentSheet( oldsheetpath );
m_Parent->m_CurrentSheet->UpdateAllScreenReferences(); m_Parent->GetCurrentSheet().UpdateAllScreenReferences();
m_Parent->SetSheetNumberAndCount(); m_Parent->SetSheetNumberAndCount();
} }

View File

@ -174,7 +174,7 @@ void DIALOG_PLOT_SCHEMATIC_PS::createPSFile()
{ {
SCH_SCREEN* screen = m_Parent->GetScreen(); SCH_SCREEN* screen = m_Parent->GetScreen();
SCH_SHEET_PATH* sheetpath; SCH_SHEET_PATH* sheetpath;
SCH_SHEET_PATH* oldsheetpath = m_Parent->GetSheet(); // sheetpath is saved here SCH_SHEET_PATH oldsheetpath = m_Parent->GetCurrentSheet(); // sheetpath is saved here
wxString plotFileName; wxString plotFileName;
Ki_PageDescr* actualPage; // page size selected in schematic Ki_PageDescr* actualPage; // page size selected in schematic
Ki_PageDescr* plotPage; // page size selected to plot Ki_PageDescr* plotPage; // page size selected to plot
@ -202,10 +202,10 @@ void DIALOG_PLOT_SCHEMATIC_PS::createPSFile()
if( list.BuildSheetPathInfoFromSheetPathValue( sheetpath->Path() ) ) if( list.BuildSheetPathInfoFromSheetPathValue( sheetpath->Path() ) )
{ {
m_Parent->m_CurrentSheet = &list; m_Parent->SetCurrentSheet( list );
m_Parent->m_CurrentSheet->UpdateAllScreenReferences(); m_Parent->GetCurrentSheet().UpdateAllScreenReferences();
m_Parent->SetSheetNumberAndCount(); m_Parent->SetSheetNumberAndCount();
screen = m_Parent->m_CurrentSheet->LastScreen(); screen = m_Parent->GetCurrentSheet().LastScreen();
} }
else // Should not happen else // Should not happen
return; return;
@ -246,8 +246,8 @@ void DIALOG_PLOT_SCHEMATIC_PS::createPSFile()
break; break;
} }
m_Parent->m_CurrentSheet = oldsheetpath; m_Parent->SetCurrentSheet( oldsheetpath );
m_Parent->m_CurrentSheet->UpdateAllScreenReferences(); m_Parent->GetCurrentSheet().UpdateAllScreenReferences();
m_Parent->SetSheetNumberAndCount(); m_Parent->SetSheetNumberAndCount();
} }

View File

@ -231,17 +231,17 @@ bool SCH_PRINTOUT::OnPrintPage( int page )
parent->AppendMsgPanel( msg, wxEmptyString, CYAN ); parent->AppendMsgPanel( msg, wxEmptyString, CYAN );
SCH_SCREEN* screen = parent->GetScreen(); SCH_SCREEN* screen = parent->GetScreen();
SCH_SHEET_PATH* oldsheetpath = parent->GetSheet(); SCH_SHEET_PATH oldsheetpath = parent->GetCurrentSheet();
SCH_SHEET_PATH list; SCH_SHEET_PATH list;
SCH_SHEET_LIST SheetList( NULL ); SCH_SHEET_LIST SheetList( NULL );
SCH_SHEET_PATH* sheetpath = SheetList.GetSheet( page - 1 ); SCH_SHEET_PATH* sheetpath = SheetList.GetSheet( page - 1 );
if( list.BuildSheetPathInfoFromSheetPathValue( sheetpath->Path() ) ) if( list.BuildSheetPathInfoFromSheetPathValue( sheetpath->Path() ) )
{ {
parent->m_CurrentSheet = &list; parent->SetCurrentSheet( list );
parent->m_CurrentSheet->UpdateAllScreenReferences(); parent->GetCurrentSheet().UpdateAllScreenReferences();
parent->SetSheetNumberAndCount(); parent->SetSheetNumberAndCount();
screen = parent->m_CurrentSheet->LastScreen(); screen = parent->GetCurrentSheet().LastScreen();
} }
else else
{ {
@ -252,8 +252,8 @@ bool SCH_PRINTOUT::OnPrintPage( int page )
return false; return false;
DrawPage( screen ); DrawPage( screen );
parent->m_CurrentSheet = oldsheetpath; parent->SetCurrentSheet( oldsheetpath );
parent->m_CurrentSheet->UpdateAllScreenReferences(); parent->GetCurrentSheet().UpdateAllScreenReferences();
parent->SetSheetNumberAndCount(); parent->SetSheetNumberAndCount();
return true; return true;

View File

@ -106,7 +106,7 @@ create a new power component with the new value." ), GetChars( entry->GetName()
// Test is reference is acceptable: // Test is reference is acceptable:
if( SCH_COMPONENT::IsReferenceStringValid( newtext ) ) if( SCH_COMPONENT::IsReferenceStringValid( newtext ) )
{ {
component->SetRef( GetSheet(), newtext ); component->SetRef( m_CurrentSheet, newtext );
aField->SetText( newtext ); aField->SetText( newtext );
} }
else else

View File

@ -82,7 +82,7 @@ void SCH_EDIT_FRAME::OnFindDrcMarker( wxFindDialogEvent& event )
if( lastMarker != NULL ) if( lastMarker != NULL )
{ {
if( sheetFoundIn != GetSheet() ) if( *sheetFoundIn != *m_CurrentSheet )
{ {
sheetFoundIn->LastScreen()->SetZoom( GetScreen()->GetZoom() ); sheetFoundIn->LastScreen()->SetZoom( GetScreen()->GetZoom() );
*m_CurrentSheet = *sheetFoundIn; *m_CurrentSheet = *sheetFoundIn;
@ -193,7 +193,7 @@ SCH_ITEM* SCH_EDIT_FRAME::FindComponentAndItem( const wxString& aReference,
{ {
sheet = sheetWithComponentFound; sheet = sheetWithComponentFound;
if( *sheet != *GetSheet() ) if( *sheet != *m_CurrentSheet )
{ {
sheet->LastScreen()->SetZoom( GetScreen()->GetZoom() ); sheet->LastScreen()->SetZoom( GetScreen()->GetZoom() );
*m_CurrentSheet = *sheet; *m_CurrentSheet = *sheet;
@ -362,7 +362,7 @@ void SCH_EDIT_FRAME::OnFindSchematicItem( wxFindDialogEvent& aEvent )
wxCHECK_RET( sheet != NULL, wxT( "Could not find sheet path " ) + wxCHECK_RET( sheet != NULL, wxT( "Could not find sheet path " ) +
data.GetSheetPath() ); data.GetSheetPath() );
if( sheet->PathHumanReadable() != GetSheet()->PathHumanReadable() ) if( sheet->PathHumanReadable() != m_CurrentSheet->PathHumanReadable() )
{ {
sheet->LastScreen()->SetZoom( GetScreen()->GetZoom() ); sheet->LastScreen()->SetZoom( GetScreen()->GetZoom() );
*m_CurrentSheet = *sheet; *m_CurrentSheet = *sheet;

View File

@ -219,7 +219,7 @@ SCH_COMPONENT* SCH_EDIT_FRAME::Load_Component( wxDC* DC,
lastCommponentName = Name; lastCommponentName = Name;
AddHistoryComponentName( HistoryList, Name ); AddHistoryComponentName( HistoryList, Name );
component = new SCH_COMPONENT( *Entry, GetSheet(), unit, convert, component = new SCH_COMPONENT( *Entry, m_CurrentSheet, unit, convert,
GetScreen()->GetCrossHairPosition(), true ); GetScreen()->GetCrossHairPosition(), true );
// Set the m_ChipName value, from component name in lib, for aliases // Set the m_ChipName value, from component name in lib, for aliases
@ -335,7 +335,7 @@ void SCH_EDIT_FRAME::OnSelectUnit( wxCommandEvent& aEvent )
component->Draw( DrawPanel, &dc, wxPoint( 0, 0 ), g_XorMode ); component->Draw( DrawPanel, &dc, wxPoint( 0, 0 ), g_XorMode );
/* Update the unit number. */ /* Update the unit number. */
component->SetUnitSelection( GetSheet(), unit ); component->SetUnitSelection( m_CurrentSheet, unit );
component->SetUnit( unit ); component->SetUnit( unit );
component->ClearFlags(); component->ClearFlags();
component->SetFlags( flags ); // Restore m_Flag modified by SetUnit() component->SetFlags( flags ); // Restore m_Flag modified by SetUnit()

View File

@ -1,3 +1,28 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2008-2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 2004-2011 KiCad Developers, see change_log.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 hierarch.cpp * @file hierarch.cpp
*/ */
@ -136,7 +161,7 @@ HIERARCHY_NAVIG_DLG::HIERARCHY_NAVIG_DLG( SCH_EDIT_FRAME* parent, wxDC* DC, cons
m_TreeSize.x = itemrect.GetWidth() + 10; m_TreeSize.x = itemrect.GetWidth() + 10;
m_TreeSize.y = 20; m_TreeSize.y = 20;
if( m_Parent->GetSheet()->Last() == g_RootSheet ) if( m_Parent->GetCurrentSheet().Last() == g_RootSheet )
m_Tree->SelectItem( cellule ); //root. m_Tree->SelectItem( cellule ); //root.
maxposx = 15; maxposx = 15;
@ -211,7 +236,7 @@ void HIERARCHY_NAVIG_DLG::BuildSheetsTree( SCH_SHEET_PATH* list, wxTreeItemId*
m_TreeSize.x = MAX( m_TreeSize.x, ll ); m_TreeSize.x = MAX( m_TreeSize.x, ll );
m_TreeSize.y += 1; m_TreeSize.y += 1;
if( *list == *( m_Parent->GetSheet() ) ) if( *list == m_Parent->GetCurrentSheet() )
{ {
m_Tree->EnsureVisible( menu ); m_Tree->EnsureVisible( menu );
m_Tree->SelectItem( menu ); m_Tree->SelectItem( menu );
@ -237,8 +262,7 @@ void HIERARCHY_NAVIG_DLG::OnSelect( wxTreeEvent& event )
{ {
wxTreeItemId ItemSel = m_Tree->GetSelection(); wxTreeItemId ItemSel = m_Tree->GetSelection();
*(m_Parent->m_CurrentSheet) = m_Parent->SetCurrentSheet(( (TreeItemData*) m_Tree->GetItemData( ItemSel ) )->m_SheetPath );
( (TreeItemData*) m_Tree->GetItemData( ItemSel ) )->m_SheetPath;
m_Parent->DisplayCurrentSheet(); m_Parent->DisplayCurrentSheet();
Close( true ); Close( true );
} }

View File

@ -191,14 +191,10 @@ LIB_PIN::LIB_PIN( LIB_COMPONENT* aParent ) :
m_type = PIN_UNSPECIFIED; /* electrical type of pin */ m_type = PIN_UNSPECIFIED; /* electrical type of pin */
m_attributes = 0; /* bit 0 != 0: pin invisible */ m_attributes = 0; /* bit 0 != 0: pin invisible */
m_number = 0; /* pin number ( i.e. 4 codes ASCII ) */ m_number = 0; /* pin number ( i.e. 4 codes ASCII ) */
m_PinNumSize = 50; m_numTextSize = 50;
m_PinNameSize = 50; /* Default size for pin name and num */ m_nameTextSize = 50; /* Default size for pin name and num */
m_width = 0; m_width = 0;
m_typeName = _( "Pin" ); m_typeName = _( "Pin" );
m_PinNumShapeOpt = 0;
m_PinNameShapeOpt = 0;
m_PinNumPositionOpt = 0;
m_PinNamePositionOpt = 0;
} }
@ -211,12 +207,8 @@ LIB_PIN::LIB_PIN( const LIB_PIN& pin ) : LIB_ITEM( pin )
m_type = pin.m_type; m_type = pin.m_type;
m_attributes = pin.m_attributes; m_attributes = pin.m_attributes;
m_number = pin.m_number; m_number = pin.m_number;
m_PinNumSize = pin.m_PinNumSize; m_numTextSize = pin.m_numTextSize;
m_PinNameSize = pin.m_PinNameSize; m_nameTextSize = pin.m_nameTextSize;
m_PinNumShapeOpt = pin.m_PinNumShapeOpt;
m_PinNameShapeOpt = pin.m_PinNameShapeOpt;
m_PinNumPositionOpt = pin.m_PinNumPositionOpt;
m_PinNamePositionOpt = pin.m_PinNamePositionOpt;
m_width = pin.m_width; m_width = pin.m_width;
m_name = pin.m_name; m_name = pin.m_name;
} }
@ -253,9 +245,9 @@ void LIB_PIN::SetName( const wxString& aName )
void LIB_PIN::SetNameTextSize( int size ) void LIB_PIN::SetNameTextSize( int size )
{ {
if( size != m_PinNameSize ) if( size != m_nameTextSize )
{ {
m_PinNameSize = size; m_nameTextSize = size;
SetModified(); SetModified();
} }
@ -267,10 +259,10 @@ void LIB_PIN::SetNameTextSize( int size )
for( size_t i = 0; i < pinList.size(); i++ ) for( size_t i = 0; i < pinList.size(); i++ )
{ {
if( ( pinList[i]->m_Flags & IS_LINKED ) == 0 || pinList[i]->m_PinNameSize == size ) if( ( pinList[i]->m_Flags & IS_LINKED ) == 0 || pinList[i]->m_nameTextSize == size )
continue; continue;
pinList[i]->m_PinNameSize = size; pinList[i]->m_nameTextSize = size;
SetModified(); SetModified();
} }
} }
@ -297,9 +289,9 @@ void LIB_PIN::SetNumber( const wxString& number )
void LIB_PIN::SetNumberTextSize( int size ) void LIB_PIN::SetNumberTextSize( int size )
{ {
if( size != m_PinNumSize ) if( size != m_numTextSize )
{ {
m_PinNumSize = size; m_numTextSize = size;
SetModified(); SetModified();
} }
@ -311,10 +303,10 @@ void LIB_PIN::SetNumberTextSize( int size )
for( size_t i = 0; i < pinList.size(); i++ ) for( size_t i = 0; i < pinList.size(); i++ )
{ {
if( ( pinList[i]->m_Flags & IS_LINKED ) == 0 || pinList[i]->m_PinNumSize == size ) if( ( pinList[i]->m_Flags & IS_LINKED ) == 0 || pinList[i]->m_numTextSize == size )
continue; continue;
pinList[i]->m_PinNumSize = size; pinList[i]->m_numTextSize = size;
SetModified(); SetModified();
} }
} }
@ -639,7 +631,7 @@ bool LIB_PIN::Save( OUTPUTFORMATTER& aFormatter )
if( aFormatter.Print( 0, " %s %d %d %d %c %d %d %d %d %c", if( aFormatter.Print( 0, " %s %d %d %d %c %d %d %d %d %c",
TO_UTF8( StringPinNum ), m_position.x, m_position.y, TO_UTF8( StringPinNum ), m_position.x, m_position.y,
(int) m_length, (int) m_orientation, m_PinNumSize, m_PinNameSize, (int) m_length, (int) m_orientation, m_numTextSize, m_nameTextSize,
m_Unit, m_Convert, Etype ) < 0 ) m_Unit, m_Convert, Etype ) < 0 )
return false; return false;
@ -692,8 +684,8 @@ bool LIB_PIN::Load( LINE_READER& aLineReader, wxString& aErrorMsg )
*pinAttrs = 0; *pinAttrs = 0;
i = sscanf( line + 2, "%s %s %d %d %d %s %d %d %d %d %s %s", pinName, i = sscanf( line + 2, "%s %s %d %d %d %s %d %d %d %d %s %s", pinName,
pinNum, &m_position.x, &m_position.y, &m_length, pinOrient, &m_PinNumSize, pinNum, &m_position.x, &m_position.y, &m_length, pinOrient, &m_numTextSize,
&m_PinNameSize, &m_Unit, &m_Convert, pinType, pinAttrs ); &m_nameTextSize, &m_Unit, &m_Convert, pinType, pinAttrs );
if( i < 11 ) if( i < 11 )
{ {
@ -1099,14 +1091,14 @@ void LIB_PIN::DrawPinTexts( EDA_DRAW_PANEL* panel,
wxString StringPinNum; wxString StringPinNum;
EDA_Colors NameColor, NumColor; EDA_Colors NameColor, NumColor;
wxSize PinNameSize( m_PinNameSize, m_PinNameSize ); wxSize PinNameSize( m_nameTextSize, m_nameTextSize );
wxSize PinNumSize( m_PinNumSize, m_PinNumSize ); wxSize PinNumSize( m_numTextSize, m_numTextSize );
int nameLineWidth = GetPenSize(); int nameLineWidth = GetPenSize();
nameLineWidth = Clamp_Text_PenSize( nameLineWidth, m_PinNameSize, false ); nameLineWidth = Clamp_Text_PenSize( nameLineWidth, m_nameTextSize, false );
int numLineWidth = GetPenSize(); int numLineWidth = GetPenSize();
numLineWidth = Clamp_Text_PenSize( numLineWidth, m_PinNumSize, false ); numLineWidth = Clamp_Text_PenSize( numLineWidth, m_numTextSize, false );
GRSetDrawMode( DC, DrawMode ); GRSetDrawMode( DC, DrawMode );
@ -1406,8 +1398,8 @@ void LIB_PIN::PlotPinTexts( PLOTTER* plotter,
int x, y, x1, y1; int x, y, x1, y1;
wxString StringPinNum; wxString StringPinNum;
EDA_Colors NameColor, NumColor; EDA_Colors NameColor, NumColor;
wxSize PinNameSize = wxSize( m_PinNameSize, m_PinNameSize ); wxSize PinNameSize = wxSize( m_nameTextSize, m_nameTextSize );
wxSize PinNumSize = wxSize( m_PinNumSize, m_PinNumSize ); wxSize PinNumSize = wxSize( m_numTextSize, m_numTextSize );
/* Get the num and name colors */ /* Get the num and name colors */
NameColor = ReturnLayerColor( LAYER_PINNAM ); NameColor = ReturnLayerColor( LAYER_PINNAM );
@ -1909,10 +1901,10 @@ EDA_RECT LIB_PIN::GetBoundingBox() const
} }
// First, calculate boundary box corners position // First, calculate boundary box corners position
int numberTextLength = showNum ? m_PinNumSize * GetNumberString().Len() : 0; int numberTextLength = showNum ? m_numTextSize * GetNumberString().Len() : 0;
// Actual text height is bigger than text size // Actual text height is bigger than text size
int numberTextHeight = showNum ? wxRound( m_PinNumSize * 1.1 ) : 0; int numberTextHeight = showNum ? wxRound( m_numTextSize * 1.1 ) : 0;
if( m_shape & INVERT ) if( m_shape & INVERT )
minsizeV = MAX( TARGET_PIN_RADIUS, INVERT_PIN_RADIUS ); minsizeV = MAX( TARGET_PIN_RADIUS, INVERT_PIN_RADIUS );
@ -1934,9 +1926,10 @@ EDA_RECT LIB_PIN::GetBoundingBox() const
if( m_name.Left( 1 ) == wxT( "~" ) ) if( m_name.Left( 1 ) == wxT( "~" ) )
length -= 1; length -= 1;
nameTextLength = ( m_PinNameSize * length ) + nameTextOffset; nameTextLength = ( m_nameTextSize * length ) + nameTextOffset;
// Actual text height are bigger than text size // Actual text height are bigger than text size
nameTextHeight = wxRound( m_PinNameSize * 1.1 ) + TXTMARGE; nameTextHeight = wxRound( m_nameTextSize * 1.1 ) + TXTMARGE;
} }
if( nameTextOffset ) // for values > 0, pin name is inside the body if( nameTextOffset ) // for values > 0, pin name is inside the body

View File

@ -114,6 +114,8 @@ class LIB_PIN : public LIB_ITEM
long m_number; ///< Pin number defined as 4 ASCII characters like "12", "anod", long m_number; ///< Pin number defined as 4 ASCII characters like "12", "anod",
///< "G6", or "12". It is stored as "12\0\0" and does not ///< "G6", or "12". It is stored as "12\0\0" and does not
///< depend on endian type. ///< depend on endian type.
int m_numTextSize;
int m_nameTextSize; /* Pin num and Pin name sizes */
/** /**
* Draw the pin. * Draw the pin.
@ -121,18 +123,6 @@ class LIB_PIN : public LIB_ITEM
void drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset, void drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
int aColor, int aDrawMode, void* aData, const TRANSFORM& aTransform ); int aColor, int aDrawMode, void* aData, const TRANSFORM& aTransform );
public:
int m_PinNumSize;
int m_PinNameSize; /* Pin num and Pin name sizes */
/* (Currently Unused) Pin num and Pin name text options: italic/normal
* /bold, 0 = default */
char m_PinNumShapeOpt;
char m_PinNameShapeOpt;
// (Currently Unused) Pin num and Pin name text opt position, 0 = default:
char m_PinNumPositionOpt;
char m_PinNamePositionOpt;
public: public:
LIB_PIN( LIB_COMPONENT* aParent ); LIB_PIN( LIB_COMPONENT* aParent );
LIB_PIN( const LIB_PIN& aPin ); LIB_PIN( const LIB_PIN& aPin );
@ -186,7 +176,7 @@ public:
virtual void DisplayInfo( EDA_DRAW_FRAME* aFrame ); virtual void DisplayInfo( EDA_DRAW_FRAME* aFrame );
/** /**
* @copydoc EDA_ITEM::Matches() * @copydoc EDA_ITEM::Matches(wxFindReplaceData&,void*,wxPoint*)
*/ */
virtual bool Matches( wxFindReplaceData& aSearchData, void* aAuxData, wxPoint* aFindLocation ); virtual bool Matches( wxFindReplaceData& aSearchData, void* aAuxData, wxPoint* aFindLocation );
@ -263,6 +253,8 @@ public:
*/ */
void SetNameTextSize( int aSize ); void SetNameTextSize( int aSize );
int GetNameTextSize() const { return m_nameTextSize; }
/** /**
* Set the pin number. * Set the pin number.
* *
@ -283,6 +275,8 @@ public:
*/ */
void SetNumberTextSize( int aSize ); void SetNumberTextSize( int aSize );
int GetNumberTextSize() const { return m_numTextSize; }
int GetOrientation() const { return m_orientation; } int GetOrientation() const { return m_orientation; }
/** /**

View File

@ -275,7 +275,7 @@ LIB_EDIT_FRAME::~LIB_EDIT_FRAME()
{ {
SCH_EDIT_FRAME* frame = (SCH_EDIT_FRAME*) wxGetApp().GetTopWindow(); SCH_EDIT_FRAME* frame = (SCH_EDIT_FRAME*) wxGetApp().GetTopWindow();
frame->m_LibeditFrame = NULL; frame->SetLibraryEditorWindow( NULL );
m_drawItem = m_lastDrawItem = NULL; m_drawItem = m_lastDrawItem = NULL;
if ( m_tempCopyComponent ) if ( m_tempCopyComponent )

View File

@ -125,7 +125,7 @@ bool SCH_EDIT_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu )
if( item == NULL ) if( item == NULL )
{ {
if( GetSheet()->Last() != g_RootSheet ) if( m_CurrentSheet->Last() != g_RootSheet )
AddMenuItem( PopMenu, ID_POPUP_SCH_LEAVE_SHEET, _( "Leave Sheet" ), AddMenuItem( PopMenu, ID_POPUP_SCH_LEAVE_SHEET, _( "Leave Sheet" ),
KiBitmap( leave_sheet_xpm ) ); KiBitmap( leave_sheet_xpm ) );

View File

@ -85,12 +85,12 @@ void LIB_EDIT_FRAME::OnEditPin( wxCommandEvent& event )
dlg.SetElectricalType( pin->GetType() ); dlg.SetElectricalType( pin->GetType() );
dlg.SetName( pin->GetName() ); dlg.SetName( pin->GetName() );
dlg.SetNameTextSize( ReturnStringFromValue( g_UserUnit, dlg.SetNameTextSize( ReturnStringFromValue( g_UserUnit,
pin->m_PinNameSize, pin->GetNameTextSize(),
m_InternalUnits ) ); m_InternalUnits ) );
dlg.SetNameTextSizeUnits( units ); dlg.SetNameTextSizeUnits( units );
dlg.SetPadName( pin->GetNumberString() ); dlg.SetPadName( pin->GetNumberString() );
dlg.SetPadNameTextSize( ReturnStringFromValue( g_UserUnit, dlg.SetPadNameTextSize( ReturnStringFromValue( g_UserUnit,
pin->m_PinNumSize, pin->GetNumberTextSize(),
m_InternalUnits ) ); m_InternalUnits ) );
dlg.SetPadNameTextSizeUnits( units ); dlg.SetPadNameTextSizeUnits( units );
@ -391,8 +391,8 @@ void LIB_EDIT_FRAME::CreatePin( wxDC* DC )
pin->SetOrientation( LastPinOrient ); pin->SetOrientation( LastPinOrient );
pin->SetType( LastPinType ); pin->SetType( LastPinType );
pin->SetShape( LastPinShape ); pin->SetShape( LastPinShape );
pin->m_PinNameSize = LastPinNameSize; pin->SetNameTextSize( LastPinNameSize );
pin->m_PinNumSize = LastPinNumSize; pin->SetNumberTextSize( LastPinNumSize );
pin->SetConvert( LastPinCommonConvert ? 0 : m_convert ); pin->SetConvert( LastPinCommonConvert ? 0 : m_convert );
pin->SetUnit( LastPinCommonUnit ? 0 : m_unit ); pin->SetUnit( LastPinCommonUnit ? 0 : m_unit );
pin->SetVisible( LastPinVisible ); pin->SetVisible( LastPinVisible );
@ -507,11 +507,11 @@ void LIB_EDIT_FRAME::GlobalSetPins( wxDC* DC, LIB_PIN* MasterPin, int id )
switch( id ) switch( id )
{ {
case ID_POPUP_LIBEDIT_PIN_GLOBAL_CHANGE_PINNUMSIZE_ITEM: case ID_POPUP_LIBEDIT_PIN_GLOBAL_CHANGE_PINNUMSIZE_ITEM:
Pin->m_PinNumSize = MasterPin->m_PinNumSize; Pin->SetNumberTextSize( MasterPin->GetNumberTextSize() );
break; break;
case ID_POPUP_LIBEDIT_PIN_GLOBAL_CHANGE_PINNAMESIZE_ITEM: case ID_POPUP_LIBEDIT_PIN_GLOBAL_CHANGE_PINNAMESIZE_ITEM:
Pin->m_PinNameSize = MasterPin->m_PinNameSize; Pin->SetNameTextSize( MasterPin->GetNameTextSize() );
break; break;
case ID_POPUP_LIBEDIT_PIN_GLOBAL_CHANGE_PINSIZE_ITEM: case ID_POPUP_LIBEDIT_PIN_GLOBAL_CHANGE_PINSIZE_ITEM:

View File

@ -1472,7 +1472,8 @@ void SCH_COMPONENT::DisplayInfo( EDA_DRAW_FRAME* frame )
frame->ClearMsgPanel(); frame->ClearMsgPanel();
frame->AppendMsgPanel( _( "Reference" ), GetRef( ( (SCH_EDIT_FRAME*) frame )->GetSheet() ), frame->AppendMsgPanel( _( "Reference" ),
GetRef( &( ( (SCH_EDIT_FRAME*) frame )->GetCurrentSheet() ) ),
DARKCYAN ); DARKCYAN );
if( root_component->IsPower() ) if( root_component->IsPower() )

View File

@ -286,12 +286,6 @@ SCH_EDIT_FRAME::~SCH_EDIT_FRAME()
} }
SCH_SHEET_PATH* SCH_EDIT_FRAME::GetSheet()
{
return m_CurrentSheet;
}
void SCH_EDIT_FRAME::SetSheetNumberAndCount() void SCH_EDIT_FRAME::SetSheetNumberAndCount()
{ {
SCH_SCREEN* screen = GetScreen(); SCH_SCREEN* screen = GetScreen();
@ -369,6 +363,20 @@ void SCH_EDIT_FRAME::CreateScreens()
} }
SCH_SHEET_PATH& SCH_EDIT_FRAME::GetCurrentSheet()
{
wxASSERT_MSG( m_CurrentSheet != NULL, wxT( "SCH_EDIT_FRAME m_CurrentSheet member is NULL." ) );
return *m_CurrentSheet;
}
void SCH_EDIT_FRAME::SetCurrentSheet( const SCH_SHEET_PATH& aSheet )
{
*m_CurrentSheet = aSheet;
}
void SCH_EDIT_FRAME::SetUndoItem( const SCH_ITEM* aItem ) void SCH_EDIT_FRAME::SetUndoItem( const SCH_ITEM* aItem )
{ {
// if aItem != NULL, delete a previous m_undoItem, if exists // if aItem != NULL, delete a previous m_undoItem, if exists

View File

@ -261,7 +261,7 @@ LIB_VIEW_FRAME::LIB_VIEW_FRAME( wxWindow* father, CMP_LIBRARY* Library, wxSemaph
LIB_VIEW_FRAME::~LIB_VIEW_FRAME() LIB_VIEW_FRAME::~LIB_VIEW_FRAME()
{ {
SCH_EDIT_FRAME* frame = (SCH_EDIT_FRAME*) wxGetApp().GetTopWindow(); SCH_EDIT_FRAME* frame = (SCH_EDIT_FRAME*) wxGetApp().GetTopWindow();
frame->m_ViewlibFrame = NULL; frame->SetLibraryViewerWindow( NULL );
} }

View File

@ -113,18 +113,16 @@ enum SCH_SEARCH_T {
class SCH_EDIT_FRAME : public EDA_DRAW_FRAME class SCH_EDIT_FRAME : public EDA_DRAW_FRAME
{ {
public: public:
wxComboBox* m_SelPartBox;
SCH_SHEET_PATH* m_CurrentSheet; ///< which sheet we are presently working on.
int m_NetlistFormat; int m_NetlistFormat;
int m_AddSubPrefix; int m_AddSubPrefix;
bool m_ShowAllPins; bool m_ShowAllPins;
wxPoint m_OldPos;
LIB_EDIT_FRAME* m_LibeditFrame;
LIB_VIEW_FRAME* m_ViewlibFrame;
wxString m_UserLibraryPath; wxString m_UserLibraryPath;
wxArrayString m_ComponentLibFiles; wxArrayString m_ComponentLibFiles;
private: private:
SCH_SHEET_PATH* m_CurrentSheet; ///< which sheet we are presently working on.
LIB_VIEW_FRAME* m_ViewlibFrame;
LIB_EDIT_FRAME* m_LibeditFrame;
wxString m_DefaultSchematicFileName; wxString m_DefaultSchematicFileName;
int m_TextFieldSize; int m_TextFieldSize;
PARAM_CFG_ARRAY m_projectFileParams; PARAM_CFG_ARRAY m_projectFileParams;
@ -187,6 +185,11 @@ public:
~SCH_EDIT_FRAME(); ~SCH_EDIT_FRAME();
void OnCloseWindow( wxCloseEvent& Event ); void OnCloseWindow( wxCloseEvent& Event );
void SetLibraryEditorWindow( LIB_EDIT_FRAME* aFrame ) { m_LibeditFrame = aFrame; }
void SetLibraryViewerWindow( LIB_VIEW_FRAME* aFrame ) { m_ViewlibFrame = aFrame; }
void Process_Special_Functions( wxCommandEvent& event ); void Process_Special_Functions( wxCommandEvent& event );
void OnColorConfig( wxCommandEvent& aEvent ); void OnColorConfig( wxCommandEvent& aEvent );
void Process_Config( wxCommandEvent& event ); void Process_Config( wxCommandEvent& event );
@ -311,8 +314,6 @@ public:
*/ */
void OnModify(); void OnModify();
SCH_SHEET_PATH* GetSheet();
SCH_SCREEN* GetScreen() const; SCH_SCREEN* GetScreen() const;
virtual wxString GetScreenDesc(); virtual wxString GetScreenDesc();
@ -498,6 +499,10 @@ public:
int CheckAnnotate( wxArrayString* aMessageList, bool aOneSheetOnly ); int CheckAnnotate( wxArrayString* aMessageList, bool aOneSheetOnly );
// Functions used for hierarchy handling // Functions used for hierarchy handling
SCH_SHEET_PATH& GetCurrentSheet();
void SetCurrentSheet( const SCH_SHEET_PATH& aSheet );
/** /**
* Function DisplayCurrentSheet * Function DisplayCurrentSheet
* draws the current sheet on the display. * draws the current sheet on the display.