Commit d8ad2cce authored by Wayne Stambaugh's avatar Wayne Stambaugh

Encapsulate LIB_PIN class and begin encapsulating SCH_EDIT_FRAME class.

parent 37c3e321
......@@ -84,7 +84,7 @@ void SCH_EDIT_FRAME::AnnotateComponents( bool aAnnotateSchematic,
}
else
{
GetSheet()->GetComponents( references );
m_CurrentSheet->GetComponents( references );
}
/* Break full components reference in name (prefix) and number:
......@@ -162,7 +162,7 @@ int SCH_EDIT_FRAME::CheckAnnotate( wxArrayString* aMessageList, bool aOneSheetOn
if( !aOneSheetOnly )
SheetList.GetComponents( ComponentsList );
else
GetSheet()->GetComponents( ComponentsList );
m_CurrentSheet->GetComponents( ComponentsList );
return ComponentsList.CheckAnnotation( aMessageList );
}
......@@ -106,7 +106,7 @@ SCH_ITEM* SCH_EDIT_FRAME::LocateAndShowItem( const wxPoint& aPosition, const KIC
Pin->DisplayInfo( this );
if( LibItem )
AppendMsgPanel( LibItem->GetRef( GetSheet() ),
AppendMsgPanel( LibItem->GetRef( m_CurrentSheet ),
LibItem->GetField( VALUE )->m_Text, DARKCYAN );
// Cross probing:2 - pin found, and send a locate pin command to Pcbnew (highlight net)
......
......@@ -125,7 +125,8 @@ void DIALOG_SVG_PRINT::PrintSVGDoc( bool aPrintAll, bool aPrint_Sheet_Ref )
if( aPrintAll && m_Parent->IsType( SCHEMATIC_FRAME ) )
{
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_SHEET_LIST SheetList( NULL );
sheetpath = SheetList.GetFirst();
......@@ -135,14 +136,15 @@ void DIALOG_SVG_PRINT::PrintSVGDoc( bool aPrintAll, bool aPrint_Sheet_Ref )
{
if( sheetpath == NULL )
break;
list.Clear();
if( list.BuildSheetPathInfoFromSheetPathValue( sheetpath->Path() ) )
{
schframe->m_CurrentSheet = &list;
schframe->m_CurrentSheet->UpdateAllScreenReferences();
schframe->SetCurrentSheet( list );
schframe->GetCurrentSheet().UpdateAllScreenReferences();
schframe->SetSheetNumberAndCount();
schscreen = schframe->m_CurrentSheet->LastScreen();
schscreen = schframe->GetCurrentSheet().LastScreen();
}
else // Should not happen
return;
......@@ -161,8 +163,8 @@ void DIALOG_SVG_PRINT::PrintSVGDoc( bool aPrintAll, bool aPrint_Sheet_Ref )
m_MessagesBox->AppendText( msg );
}
schframe->m_CurrentSheet = oldsheetpath;
schframe->m_CurrentSheet->UpdateAllScreenReferences();
schframe->SetCurrentSheet( oldsheetpath );
schframe->GetCurrentSheet().UpdateAllScreenReferences();
schframe->SetSheetNumberAndCount();
}
else
......
......@@ -167,7 +167,7 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyPanelToOptions()
if( m_Cmp->GetUnit() )
{
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 );
}
......@@ -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
// because for a given component, in a complex hierarchy, there are more than one
// 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->GetScreen()->TestDanglingEnds();
......@@ -520,7 +520,7 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::InitBuffers( SCH_COMPONENT* aComponent
}
#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 )
{
......
......@@ -196,11 +196,11 @@ void DIALOG_ERC::OnLeftDClickMarkersList( wxCommandEvent& event )
return;
}
if( sheet != m_Parent->GetSheet() )
if( *sheet != m_Parent->GetCurrentSheet() )
{
sheet->LastScreen()->SetZoom( m_Parent->GetScreen()->GetZoom() );
*m_Parent->m_CurrentSheet = *sheet;
m_Parent->m_CurrentSheet->UpdateAllScreenReferences();
m_Parent->SetCurrentSheet( *sheet );
m_Parent->GetCurrentSheet().UpdateAllScreenReferences();
}
m_Parent->GetScreen()->SetCrossHairPosition( pos );
......
......@@ -145,7 +145,8 @@ void DIALOG_PLOT_SCHEMATIC_DXF::CreateDXFFile( )
{
SCH_EDIT_FRAME* schframe = (SCH_EDIT_FRAME*) m_Parent;
SCH_SCREEN* screen = schframe->GetScreen();
SCH_SHEET_PATH* sheetpath, * oldsheetpath = schframe->GetSheet();
SCH_SHEET_PATH* sheetpath;
SCH_SHEET_PATH oldsheetpath = schframe->GetCurrentSheet();
wxString PlotFileName;
Ki_PageDescr* PlotSheet;
wxPoint plot_offset;
......@@ -172,13 +173,15 @@ void DIALOG_PLOT_SCHEMATIC_DXF::CreateDXFFile( )
if( list.BuildSheetPathInfoFromSheetPathValue( sheetpath->Path() ) )
{
schframe->m_CurrentSheet = &list;
schframe->m_CurrentSheet->UpdateAllScreenReferences();
schframe->SetCurrentSheet( list );
schframe->GetCurrentSheet().UpdateAllScreenReferences();
schframe->SetSheetNumberAndCount();
screen = schframe->m_CurrentSheet->LastScreen();
screen = schframe->GetCurrentSheet().LastScreen();
}
else // Should not happen
{
return;
}
sheetpath = SheetList.GetNext();
}
......@@ -197,8 +200,8 @@ void DIALOG_PLOT_SCHEMATIC_DXF::CreateDXFFile( )
break;
}
schframe->m_CurrentSheet = oldsheetpath;
schframe->m_CurrentSheet->UpdateAllScreenReferences();
schframe->SetCurrentSheet( oldsheetpath );
schframe->GetCurrentSheet().UpdateAllScreenReferences();
schframe->SetSheetNumberAndCount();
}
......
......@@ -281,7 +281,8 @@ void DIALOG_PLOT_SCHEMATIC_HPGL::Plot_Schematic_HPGL( bool aPlotAll, int HPGL_Sh
{
wxString PlotFileName;
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;
wxSize SheetSize;
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() ) )
{
m_Parent->m_CurrentSheet = &list;
m_Parent->m_CurrentSheet->UpdateAllScreenReferences();
m_Parent->SetCurrentSheet( list );
m_Parent->GetCurrentSheet().UpdateAllScreenReferences();
m_Parent->SetSheetNumberAndCount();
screen = m_Parent->m_CurrentSheet->LastScreen();
screen = m_Parent->GetCurrentSheet().LastScreen();
}
else // Should not happen
return;
......@@ -344,8 +345,8 @@ void DIALOG_PLOT_SCHEMATIC_HPGL::Plot_Schematic_HPGL( bool aPlotAll, int HPGL_Sh
break;
}
m_Parent->m_CurrentSheet = oldsheetpath;
m_Parent->m_CurrentSheet->UpdateAllScreenReferences();
m_Parent->SetCurrentSheet( oldsheetpath );
m_Parent->GetCurrentSheet().UpdateAllScreenReferences();
m_Parent->SetSheetNumberAndCount();
}
......
......@@ -174,7 +174,7 @@ void DIALOG_PLOT_SCHEMATIC_PS::createPSFile()
{
SCH_SCREEN* screen = m_Parent->GetScreen();
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;
Ki_PageDescr* actualPage; // page size selected in schematic
Ki_PageDescr* plotPage; // page size selected to plot
......@@ -202,10 +202,10 @@ void DIALOG_PLOT_SCHEMATIC_PS::createPSFile()
if( list.BuildSheetPathInfoFromSheetPathValue( sheetpath->Path() ) )
{
m_Parent->m_CurrentSheet = &list;
m_Parent->m_CurrentSheet->UpdateAllScreenReferences();
m_Parent->SetCurrentSheet( list );
m_Parent->GetCurrentSheet().UpdateAllScreenReferences();
m_Parent->SetSheetNumberAndCount();
screen = m_Parent->m_CurrentSheet->LastScreen();
screen = m_Parent->GetCurrentSheet().LastScreen();
}
else // Should not happen
return;
......@@ -246,8 +246,8 @@ void DIALOG_PLOT_SCHEMATIC_PS::createPSFile()
break;
}
m_Parent->m_CurrentSheet = oldsheetpath;
m_Parent->m_CurrentSheet->UpdateAllScreenReferences();
m_Parent->SetCurrentSheet( oldsheetpath );
m_Parent->GetCurrentSheet().UpdateAllScreenReferences();
m_Parent->SetSheetNumberAndCount();
}
......
......@@ -231,17 +231,17 @@ bool SCH_PRINTOUT::OnPrintPage( int page )
parent->AppendMsgPanel( msg, wxEmptyString, CYAN );
SCH_SCREEN* screen = parent->GetScreen();
SCH_SHEET_PATH* oldsheetpath = parent->GetSheet();
SCH_SHEET_PATH oldsheetpath = parent->GetCurrentSheet();
SCH_SHEET_PATH list;
SCH_SHEET_LIST SheetList( NULL );
SCH_SHEET_PATH* sheetpath = SheetList.GetSheet( page - 1 );
if( list.BuildSheetPathInfoFromSheetPathValue( sheetpath->Path() ) )
{
parent->m_CurrentSheet = &list;
parent->m_CurrentSheet->UpdateAllScreenReferences();
parent->SetCurrentSheet( list );
parent->GetCurrentSheet().UpdateAllScreenReferences();
parent->SetSheetNumberAndCount();
screen = parent->m_CurrentSheet->LastScreen();
screen = parent->GetCurrentSheet().LastScreen();
}
else
{
......@@ -252,8 +252,8 @@ bool SCH_PRINTOUT::OnPrintPage( int page )
return false;
DrawPage( screen );
parent->m_CurrentSheet = oldsheetpath;
parent->m_CurrentSheet->UpdateAllScreenReferences();
parent->SetCurrentSheet( oldsheetpath );
parent->GetCurrentSheet().UpdateAllScreenReferences();
parent->SetSheetNumberAndCount();
return true;
......
......@@ -106,7 +106,7 @@ create a new power component with the new value." ), GetChars( entry->GetName()
// Test is reference is acceptable:
if( SCH_COMPONENT::IsReferenceStringValid( newtext ) )
{
component->SetRef( GetSheet(), newtext );
component->SetRef( m_CurrentSheet, newtext );
aField->SetText( newtext );
}
else
......
......@@ -82,7 +82,7 @@ void SCH_EDIT_FRAME::OnFindDrcMarker( wxFindDialogEvent& event )
if( lastMarker != NULL )
{
if( sheetFoundIn != GetSheet() )
if( *sheetFoundIn != *m_CurrentSheet )
{
sheetFoundIn->LastScreen()->SetZoom( GetScreen()->GetZoom() );
*m_CurrentSheet = *sheetFoundIn;
......@@ -193,7 +193,7 @@ SCH_ITEM* SCH_EDIT_FRAME::FindComponentAndItem( const wxString& aReference,
{
sheet = sheetWithComponentFound;
if( *sheet != *GetSheet() )
if( *sheet != *m_CurrentSheet )
{
sheet->LastScreen()->SetZoom( GetScreen()->GetZoom() );
*m_CurrentSheet = *sheet;
......@@ -362,7 +362,7 @@ void SCH_EDIT_FRAME::OnFindSchematicItem( wxFindDialogEvent& aEvent )
wxCHECK_RET( sheet != NULL, wxT( "Could not find sheet path " ) +
data.GetSheetPath() );
if( sheet->PathHumanReadable() != GetSheet()->PathHumanReadable() )
if( sheet->PathHumanReadable() != m_CurrentSheet->PathHumanReadable() )
{
sheet->LastScreen()->SetZoom( GetScreen()->GetZoom() );
*m_CurrentSheet = *sheet;
......
......@@ -219,7 +219,7 @@ SCH_COMPONENT* SCH_EDIT_FRAME::Load_Component( wxDC* DC,
lastCommponentName = Name;
AddHistoryComponentName( HistoryList, Name );
component = new SCH_COMPONENT( *Entry, GetSheet(), unit, convert,
component = new SCH_COMPONENT( *Entry, m_CurrentSheet, unit, convert,
GetScreen()->GetCrossHairPosition(), true );
// 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 );
/* Update the unit number. */
component->SetUnitSelection( GetSheet(), unit );
component->SetUnitSelection( m_CurrentSheet, unit );
component->SetUnit( unit );
component->ClearFlags();
component->SetFlags( flags ); // Restore m_Flag modified by SetUnit()
......
/*
* 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
*/
......@@ -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.y = 20;
if( m_Parent->GetSheet()->Last() == g_RootSheet )
if( m_Parent->GetCurrentSheet().Last() == g_RootSheet )
m_Tree->SelectItem( cellule ); //root.
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.y += 1;
if( *list == *( m_Parent->GetSheet() ) )
if( *list == m_Parent->GetCurrentSheet() )
{
m_Tree->EnsureVisible( menu );
m_Tree->SelectItem( menu );
......@@ -237,8 +262,7 @@ void HIERARCHY_NAVIG_DLG::OnSelect( wxTreeEvent& event )
{
wxTreeItemId ItemSel = m_Tree->GetSelection();
*(m_Parent->m_CurrentSheet) =
( (TreeItemData*) m_Tree->GetItemData( ItemSel ) )->m_SheetPath;
m_Parent->SetCurrentSheet(( (TreeItemData*) m_Tree->GetItemData( ItemSel ) )->m_SheetPath );
m_Parent->DisplayCurrentSheet();
Close( true );
}
......
......@@ -188,37 +188,29 @@ LIB_PIN::LIB_PIN( LIB_COMPONENT* aParent ) :
m_length = 300; /* default Pin len */
m_orientation = PIN_RIGHT; /* Pin orient: Up, Down, Left, Right */
m_shape = NONE; /* Pin shape, bitwise. */
m_type = PIN_UNSPECIFIED; /* electrical type of pin */
m_attributes = 0; /* bit 0 != 0: pin invisible */
m_number = 0; /* pin number ( i.e. 4 codes ASCII ) */
m_PinNumSize = 50;
m_PinNameSize = 50; /* Default size for pin name and num */
m_width = 0;
m_type = PIN_UNSPECIFIED; /* electrical type of pin */
m_attributes = 0; /* bit 0 != 0: pin invisible */
m_number = 0; /* pin number ( i.e. 4 codes ASCII ) */
m_numTextSize = 50;
m_nameTextSize = 50; /* Default size for pin name and num */
m_width = 0;
m_typeName = _( "Pin" );
m_PinNumShapeOpt = 0;
m_PinNameShapeOpt = 0;
m_PinNumPositionOpt = 0;
m_PinNamePositionOpt = 0;
}
LIB_PIN::LIB_PIN( const LIB_PIN& pin ) : LIB_ITEM( pin )
{
m_position = pin.m_position;
m_length = pin.m_length;
m_position = pin.m_position;
m_length = pin.m_length;
m_orientation = pin.m_orientation;
m_shape = pin.m_shape;
m_type = pin.m_type;
m_attributes = pin.m_attributes;
m_number = pin.m_number;
m_PinNumSize = pin.m_PinNumSize;
m_PinNameSize = pin.m_PinNameSize;
m_PinNumShapeOpt = pin.m_PinNumShapeOpt;
m_PinNameShapeOpt = pin.m_PinNameShapeOpt;
m_PinNumPositionOpt = pin.m_PinNumPositionOpt;
m_PinNamePositionOpt = pin.m_PinNamePositionOpt;
m_type = pin.m_type;
m_attributes = pin.m_attributes;
m_number = pin.m_number;
m_numTextSize = pin.m_numTextSize;
m_nameTextSize = pin.m_nameTextSize;
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 )
{
if( size != m_PinNameSize )
if( size != m_nameTextSize )
{
m_PinNameSize = size;
m_nameTextSize = size;
SetModified();
}
......@@ -267,10 +259,10 @@ void LIB_PIN::SetNameTextSize( int size )
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;
pinList[i]->m_PinNameSize = size;
pinList[i]->m_nameTextSize = size;
SetModified();
}
}
......@@ -297,9 +289,9 @@ void LIB_PIN::SetNumber( const wxString& number )
void LIB_PIN::SetNumberTextSize( int size )
{
if( size != m_PinNumSize )
if( size != m_numTextSize )
{
m_PinNumSize = size;
m_numTextSize = size;
SetModified();
}
......@@ -311,10 +303,10 @@ void LIB_PIN::SetNumberTextSize( int size )
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;
pinList[i]->m_PinNumSize = size;
pinList[i]->m_numTextSize = size;
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",
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 )
return false;
......@@ -692,8 +684,8 @@ bool LIB_PIN::Load( LINE_READER& aLineReader, wxString& aErrorMsg )
*pinAttrs = 0;
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,
&m_PinNameSize, &m_Unit, &m_Convert, pinType, pinAttrs );
pinNum, &m_position.x, &m_position.y, &m_length, pinOrient, &m_numTextSize,
&m_nameTextSize, &m_Unit, &m_Convert, pinType, pinAttrs );
if( i < 11 )
{
......@@ -1099,14 +1091,14 @@ void LIB_PIN::DrawPinTexts( EDA_DRAW_PANEL* panel,
wxString StringPinNum;
EDA_Colors NameColor, NumColor;
wxSize PinNameSize( m_PinNameSize, m_PinNameSize );
wxSize PinNumSize( m_PinNumSize, m_PinNumSize );
wxSize PinNameSize( m_nameTextSize, m_nameTextSize );
wxSize PinNumSize( m_numTextSize, m_numTextSize );
int nameLineWidth = GetPenSize();
nameLineWidth = Clamp_Text_PenSize( nameLineWidth, m_PinNameSize, false );
nameLineWidth = Clamp_Text_PenSize( nameLineWidth, m_nameTextSize, false );
int numLineWidth = GetPenSize();
numLineWidth = Clamp_Text_PenSize( numLineWidth, m_PinNumSize, false );
numLineWidth = Clamp_Text_PenSize( numLineWidth, m_numTextSize, false );
GRSetDrawMode( DC, DrawMode );
......@@ -1406,8 +1398,8 @@ void LIB_PIN::PlotPinTexts( PLOTTER* plotter,
int x, y, x1, y1;
wxString StringPinNum;
EDA_Colors NameColor, NumColor;
wxSize PinNameSize = wxSize( m_PinNameSize, m_PinNameSize );
wxSize PinNumSize = wxSize( m_PinNumSize, m_PinNumSize );
wxSize PinNameSize = wxSize( m_nameTextSize, m_nameTextSize );
wxSize PinNumSize = wxSize( m_numTextSize, m_numTextSize );
/* Get the num and name colors */
NameColor = ReturnLayerColor( LAYER_PINNAM );
......@@ -1909,10 +1901,10 @@ EDA_RECT LIB_PIN::GetBoundingBox() const
}
// 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
int numberTextHeight = showNum ? wxRound( m_PinNumSize * 1.1 ) : 0;
int numberTextHeight = showNum ? wxRound( m_numTextSize * 1.1 ) : 0;
if( m_shape & INVERT )
minsizeV = MAX( TARGET_PIN_RADIUS, INVERT_PIN_RADIUS );
......@@ -1934,9 +1926,10 @@ EDA_RECT LIB_PIN::GetBoundingBox() const
if( m_name.Left( 1 ) == wxT( "~" ) )
length -= 1;
nameTextLength = ( m_PinNameSize * length ) + nameTextOffset;
nameTextLength = ( m_nameTextSize * length ) + nameTextOffset;
// 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
......
......@@ -114,6 +114,8 @@ class LIB_PIN : public LIB_ITEM
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
///< depend on endian type.
int m_numTextSize;
int m_nameTextSize; /* Pin num and Pin name sizes */
/**
* Draw the pin.
......@@ -121,18 +123,6 @@ class LIB_PIN : public LIB_ITEM
void drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
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:
LIB_PIN( LIB_COMPONENT* aParent );
LIB_PIN( const LIB_PIN& aPin );
......@@ -186,7 +176,7 @@ public:
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 );
......@@ -263,6 +253,8 @@ public:
*/
void SetNameTextSize( int aSize );
int GetNameTextSize() const { return m_nameTextSize; }
/**
* Set the pin number.
*
......@@ -283,6 +275,8 @@ public:
*/
void SetNumberTextSize( int aSize );
int GetNumberTextSize() const { return m_numTextSize; }
int GetOrientation() const { return m_orientation; }
/**
......
......@@ -275,7 +275,7 @@ LIB_EDIT_FRAME::~LIB_EDIT_FRAME()
{
SCH_EDIT_FRAME* frame = (SCH_EDIT_FRAME*) wxGetApp().GetTopWindow();
frame->m_LibeditFrame = NULL;
frame->SetLibraryEditorWindow( NULL );
m_drawItem = m_lastDrawItem = NULL;
if ( m_tempCopyComponent )
......
......@@ -125,7 +125,7 @@ bool SCH_EDIT_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu )
if( item == NULL )
{
if( GetSheet()->Last() != g_RootSheet )
if( m_CurrentSheet->Last() != g_RootSheet )
AddMenuItem( PopMenu, ID_POPUP_SCH_LEAVE_SHEET, _( "Leave Sheet" ),
KiBitmap( leave_sheet_xpm ) );
......
......@@ -85,12 +85,12 @@ void LIB_EDIT_FRAME::OnEditPin( wxCommandEvent& event )
dlg.SetElectricalType( pin->GetType() );
dlg.SetName( pin->GetName() );
dlg.SetNameTextSize( ReturnStringFromValue( g_UserUnit,
pin->m_PinNameSize,
pin->GetNameTextSize(),
m_InternalUnits ) );
dlg.SetNameTextSizeUnits( units );
dlg.SetPadName( pin->GetNumberString() );
dlg.SetPadNameTextSize( ReturnStringFromValue( g_UserUnit,
pin->m_PinNumSize,
pin->GetNumberTextSize(),
m_InternalUnits ) );
dlg.SetPadNameTextSizeUnits( units );
......@@ -391,8 +391,8 @@ void LIB_EDIT_FRAME::CreatePin( wxDC* DC )
pin->SetOrientation( LastPinOrient );
pin->SetType( LastPinType );
pin->SetShape( LastPinShape );
pin->m_PinNameSize = LastPinNameSize;
pin->m_PinNumSize = LastPinNumSize;
pin->SetNameTextSize( LastPinNameSize );
pin->SetNumberTextSize( LastPinNumSize );
pin->SetConvert( LastPinCommonConvert ? 0 : m_convert );
pin->SetUnit( LastPinCommonUnit ? 0 : m_unit );
pin->SetVisible( LastPinVisible );
......@@ -507,11 +507,11 @@ void LIB_EDIT_FRAME::GlobalSetPins( wxDC* DC, LIB_PIN* MasterPin, int id )
switch( id )
{
case ID_POPUP_LIBEDIT_PIN_GLOBAL_CHANGE_PINNUMSIZE_ITEM:
Pin->m_PinNumSize = MasterPin->m_PinNumSize;
Pin->SetNumberTextSize( MasterPin->GetNumberTextSize() );
break;
case ID_POPUP_LIBEDIT_PIN_GLOBAL_CHANGE_PINNAMESIZE_ITEM:
Pin->m_PinNameSize = MasterPin->m_PinNameSize;
Pin->SetNameTextSize( MasterPin->GetNameTextSize() );
break;
case ID_POPUP_LIBEDIT_PIN_GLOBAL_CHANGE_PINSIZE_ITEM:
......
......@@ -1472,7 +1472,8 @@ void SCH_COMPONENT::DisplayInfo( EDA_DRAW_FRAME* frame )
frame->ClearMsgPanel();
frame->AppendMsgPanel( _( "Reference" ), GetRef( ( (SCH_EDIT_FRAME*) frame )->GetSheet() ),
frame->AppendMsgPanel( _( "Reference" ),
GetRef( &( ( (SCH_EDIT_FRAME*) frame )->GetCurrentSheet() ) ),
DARKCYAN );
if( root_component->IsPower() )
......
......@@ -59,7 +59,7 @@ bool SCH_SHEET_PATH::BuildSheetPathInfoFromSheetPathValue( const wxString& aPath
if( aFound )
return true;
if( GetSheetsCount() == 0 )
if( GetSheetsCount() == 0 )
Push( g_RootSheet );
if( aPath == Path() )
......
......@@ -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()
{
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 )
{
// if aItem != NULL, delete a previous m_undoItem, if exists
......
......@@ -261,7 +261,7 @@ LIB_VIEW_FRAME::LIB_VIEW_FRAME( wxWindow* father, CMP_LIBRARY* Library, wxSemaph
LIB_VIEW_FRAME::~LIB_VIEW_FRAME()
{
SCH_EDIT_FRAME* frame = (SCH_EDIT_FRAME*) wxGetApp().GetTopWindow();
frame->m_ViewlibFrame = NULL;
frame->SetLibraryViewerWindow( NULL );
}
......
......@@ -113,18 +113,16 @@ enum SCH_SEARCH_T {
class SCH_EDIT_FRAME : public EDA_DRAW_FRAME
{
public:
wxComboBox* m_SelPartBox;
SCH_SHEET_PATH* m_CurrentSheet; ///< which sheet we are presently working on.
int m_NetlistFormat;
int m_AddSubPrefix;
bool m_ShowAllPins;
wxPoint m_OldPos;
LIB_EDIT_FRAME* m_LibeditFrame;
LIB_VIEW_FRAME* m_ViewlibFrame;
wxString m_UserLibraryPath;
wxArrayString m_ComponentLibFiles;
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;
int m_TextFieldSize;
PARAM_CFG_ARRAY m_projectFileParams;
......@@ -187,6 +185,11 @@ public:
~SCH_EDIT_FRAME();
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 OnColorConfig( wxCommandEvent& aEvent );
void Process_Config( wxCommandEvent& event );
......@@ -311,8 +314,6 @@ public:
*/
void OnModify();
SCH_SHEET_PATH* GetSheet();
SCH_SCREEN* GetScreen() const;
virtual wxString GetScreenDesc();
......@@ -498,6 +499,10 @@ public:
int CheckAnnotate( wxArrayString* aMessageList, bool aOneSheetOnly );
// Functions used for hierarchy handling
SCH_SHEET_PATH& GetCurrentSheet();
void SetCurrentSheet( const SCH_SHEET_PATH& aSheet );
/**
* Function DisplayCurrentSheet
* draws the current sheet on the display.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment