Commit baa0d792 authored by Wayne Stambaugh's avatar Wayne Stambaugh

EESchema bug fixes and other minor changes (fixes lp:793373).

* Fix debug build warning (lp:793373).
* Changed sheet edit restore and undo to use object copy and replace method.
* Add minimum width and height constraints when resizing sheets that have
  hierarchical pins.
* Fix drag sheet hot key bug.
* Change Doxygen configuration to extract private methods and members
  when creating documentation.
* Fix a bunch of Doxygen comment warnings.
parent 864426fb
......@@ -35,7 +35,7 @@ SUBGROUPING = YES
# Build related configuration options
#---------------------------------------------------------------------------
EXTRACT_ALL = YES
EXTRACT_PRIVATE = NO
EXTRACT_PRIVATE = YES
EXTRACT_STATIC = YES
EXTRACT_LOCAL_CLASSES = YES
EXTRACT_LOCAL_METHODS = NO
......
/****************************************/
/* Basic classes for Kicad: */
/* EDA_ITEM */
/**********************************/
/* Basic classes for Kicad: */
/* EDA_ITEM */
/* EDA_TEXT */
/****************************************/
/**********************************/
#include "fctsys.h"
#include "gr_basic.h"
......@@ -196,8 +196,8 @@ EDA_TEXT::EDA_TEXT( const wxString& text )
m_Orient = 0; // Rotation angle in 0.1 degrees.
m_Attributs = 0;
m_Mirror = false; // display mirror if true
m_HJustify = GR_TEXT_HJUSTIFY_CENTER; // Defualt horizontal justification is centered.
m_VJustify = GR_TEXT_VJUSTIFY_CENTER; // Defualt vertical justification is centered.
m_HJustify = GR_TEXT_HJUSTIFY_CENTER; // Default horizontal justification is centered.
m_VJustify = GR_TEXT_VJUSTIFY_CENTER; // Default vertical justification is centered.
m_Thickness = 0; // thickness
m_Italic = false; // true = italic shape.
m_Bold = false;
......@@ -230,7 +230,7 @@ EDA_TEXT::~EDA_TEXT()
int EDA_TEXT::LenSize( const wxString& aLine ) const
{
return ReturnGraphicTextWidth(aLine, m_Size.x, m_Italic, m_Bold ) + m_Thickness;
return ReturnGraphicTextWidth( aLine, m_Size.x, m_Italic, m_Bold ) + m_Thickness;
}
......@@ -356,8 +356,8 @@ bool EDA_TEXT::TextHitTest( const EDA_RECT& aRect, bool aContains, int aAccuracy
void EDA_TEXT::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
EDA_Colors aColor, int aDrawMode,
GRTraceMode aFillMode, EDA_Colors aAnchor_color )
EDA_Colors aColor, int aDrawMode,
GRTraceMode aFillMode, EDA_Colors aAnchor_color )
{
if( m_MultilineAllowed )
{
......@@ -400,10 +400,10 @@ void EDA_TEXT::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
void EDA_TEXT::DrawOneLineOfText( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
const wxPoint& aOffset, EDA_Colors aColor,
int aDrawMode, GRTraceMode aFillMode,
EDA_Colors aAnchor_color,
wxString& aText, wxPoint aPos )
const wxPoint& aOffset, EDA_Colors aColor,
int aDrawMode, GRTraceMode aFillMode,
EDA_Colors aAnchor_color,
wxString& aText, wxPoint aPos )
{
int width = m_Thickness;
......@@ -443,6 +443,7 @@ void EDA_TEXT::DrawOneLineOfText( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
m_HJustify, m_VJustify, width, m_Italic, m_Bold );
}
wxString EDA_TEXT::GetTextStyleName()
{
int style = 0;
......@@ -510,6 +511,7 @@ bool EDA_RECT::Contains( const wxPoint& aPoint ) const
return (rel_pos.x >= 0) && (rel_pos.y >= 0) && ( rel_pos.y <= size.y) && ( rel_pos.x <= size.x);
}
/*
* return true if aRect is inside me (or on boundaries)
*/
......
......@@ -302,9 +302,9 @@ void GERBER_PLOTTER::circle( wxPoint aCentre, int aDiameter, FILL_T aFill,
/*
* Function PlotPoly
* writes a filled or not filled polyline to output file
* param aCornerList = buffer of corners coordinates
* param aFill = plot option (NO_FILL, FILLED_SHAPE, FILLED_WITH_BG_BODYCOLOR)
* param aWidth = Width of the line to plot.
* @param aCornerList = buffer of corners coordinates
* @param aFill = plot option (NO_FILL, FILLED_SHAPE, FILLED_WITH_BG_BODYCOLOR)
* @param aWidth = Width of the line to plot.
*/
void GERBER_PLOTTER::PlotPoly( std::vector< wxPoint >& aCornerList, FILL_T aFill, int aWidth )
{
......
......@@ -366,8 +366,8 @@ int DSNLEXER::NeedNUMBER( const char* aExpectation ) throw( IO_ERROR )
/**
* Function isspace
* strips the upper bits of the int to ensure the value passed to ::isspace() is
* Function isSpace
* strips the upper bits of the int to ensure the value passed to C++ %isspace() is
* in the range of 0-255
*/
static inline bool isSpace( int cc )
......
......@@ -41,7 +41,7 @@ private:
* Function CreateParstList
* prints a list of components, in a form which can be imported by a
* spreadsheet. Form is:
* cmp value; number of components; <footprint>; <field1>; ...;
* cmp value; number of components; \<footprint\>; \<field1\>; ...;
* list of references having the same value
*/
void CreatePartsList( const wxString& aFullFileName, bool aIncludeSubComponents );
......
......@@ -66,7 +66,6 @@ private:
/**
* Function InitBuffers
* sets up to edit the given component.
* @param aComponent The component to edit.
*/
void InitBuffers();
......
......@@ -690,6 +690,7 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
case SCH_COMPONENT_T:
case SCH_GLOBAL_LABEL_T:
case SCH_HIERARCHICAL_LABEL_T:
case SCH_SHEET_T:
cmd.SetId( HK_Descr->m_IdMenuEvent );
wxPostEvent( this, cmd );
break;
......
......@@ -168,8 +168,8 @@ class EXPORT_HELP
* created by BuildNetList() in the table g_NetObjectslist.
*/
bool addPinToComponentPinList( SCH_COMPONENT* Component,
SCH_SHEET_PATH* sheet,
LIB_PIN* PinEntry );
SCH_SHEET_PATH* sheet,
LIB_PIN* PinEntry );
/**
* Function findAllInstancesOfComponent
......@@ -179,9 +179,9 @@ class EXPORT_HELP
* matching reference designator, and for each part, add all its pins
* to the temporary sorted pin list.
*/
void findAllInstancesOfComponent( SCH_COMPONENT* aComponent,
LIB_COMPONENT* aEntry,
SCH_SHEET_PATH* aSheetPath );
void findAllInstancesOfComponent( SCH_COMPONENT* aComponent,
LIB_COMPONENT* aEntry,
SCH_SHEET_PATH* aSheetPath );
/**
* Function writeGENERICListOfNets
......@@ -192,12 +192,13 @@ class EXPORT_HELP
/**
* Function writeListOfNetsCADSTAR
* writes a net list (ranked by Netcode), and
* Pins connected to it
* writes a net list (ranked by Netcode), and pins connected to it.
* <p>
* Format:
*. ADD_TER RR2 6 "$42"
*. B U1 100
* 6 CA
* - ADD_TER RR2 6 \"$42\"
* - B U1 100
* - 6 CA
* </p>
*/
void writeListOfNetsCADSTAR( FILE* f, NETLIST_OBJECT_LIST& aObjectsList );
......
......@@ -120,6 +120,7 @@ const KICAD_T SCH_COLLECTOR::RotatableItems[] = {
SCH_HIERARCHICAL_LABEL_T,
SCH_FIELD_T,
SCH_COMPONENT_T,
SCH_SHEET_T,
EOT
};
......
......@@ -33,6 +33,7 @@ SCH_SHEET::SCH_SHEET( const wxPoint& pos ) :
{
m_Layer = LAYER_SHEET;
m_Pos = pos;
m_Size = wxSize( MIN_SHEET_WIDTH, MIN_SHEET_HEIGHT );
m_TimeStamp = GetTimeStamp();
m_SheetNameSize = m_FileNameSize = 60;
m_AssociatedScreen = NULL;
......@@ -176,7 +177,7 @@ bool SCH_SHEET::Load( LINE_READER& aLine, wxString& aErrorMsg )
{
if( !aLine.ReadLine() )
{
aErrorMsg.Printf( wxT( "Read File Errror" ) );
aErrorMsg.Printf( wxT( "Read File Error" ) );
return false;
}
}
......@@ -292,14 +293,20 @@ bool SCH_SHEET::Load( LINE_READER& aLine, wxString& aErrorMsg )
}
void SCH_SHEET::SwapData( SCH_SHEET* copyitem )
void SCH_SHEET::SwapData( SCH_ITEM* aItem )
{
EXCHG( m_Pos, copyitem->m_Pos );
EXCHG( m_Size, copyitem->m_Size );
EXCHG( m_SheetName, copyitem->m_SheetName );
EXCHG( m_SheetNameSize, copyitem->m_SheetNameSize );
EXCHG( m_FileNameSize, copyitem->m_FileNameSize );
m_pins.swap( copyitem->m_pins );
wxCHECK_RET( aItem->Type() == SCH_SHEET_T,
wxString::Format( wxT( "SCH_SHEET object cannot swap data with %s object." ),
GetChars( aItem->GetClass() ) ) );
SCH_SHEET* sheet = ( SCH_SHEET* ) aItem;
EXCHG( m_Pos, sheet->m_Pos );
EXCHG( m_Size, sheet->m_Size );
EXCHG( m_SheetName, sheet->m_SheetName );
EXCHG( m_SheetNameSize, sheet->m_SheetNameSize );
EXCHG( m_FileNameSize, sheet->m_FileNameSize );
m_pins.swap( sheet->m_pins );
// Ensure sheet labels have their .m_Parent member pointing really on their
// parent, after swapping.
......@@ -308,9 +315,9 @@ void SCH_SHEET::SwapData( SCH_SHEET* copyitem )
sheetPin.SetParent( this );
}
BOOST_FOREACH( SCH_SHEET_PIN& sheetPin, copyitem->m_pins )
BOOST_FOREACH( SCH_SHEET_PIN& sheetPin, sheet->m_pins )
{
sheetPin.SetParent( copyitem );
sheetPin.SetParent( sheet );
}
}
......@@ -399,6 +406,56 @@ bool SCH_SHEET::HasUndefinedPins()
}
int SCH_SHEET::GetMinWidth() const
{
int width = MIN_SHEET_WIDTH;
for( size_t i = 0; i < m_pins.size(); i++ )
{
int edge = m_pins[i].GetEdge();
// Make sure pin is on right or left side of sheet.
if( edge >= 2 )
continue;
EDA_RECT rect = m_pins[i].GetBoundingBox();
if( width < rect.GetWidth() )
width = rect.GetWidth();
for( size_t j = 0; j < m_pins.size(); j++ )
{
if( (i == j) || (m_pins[i].m_Pos.y != m_pins[j].m_Pos.y) )
continue;
if( width < rect.GetWidth() + m_pins[j].GetBoundingBox().GetWidth() )
{
width = rect.GetWidth() + m_pins[j].GetBoundingBox().GetWidth();
break;
}
}
}
return width;
}
int SCH_SHEET::GetMinHeight() const
{
int height = MIN_SHEET_HEIGHT;
for( size_t i = 0; i < m_pins.size(); i++ )
{
int pinY = m_pins[i].m_Pos.y - m_Pos.y;
if( pinY > height )
height = pinY;
}
return height;
}
void SCH_SHEET::Place( SCH_EDIT_FRAME* frame, wxDC* DC )
{
/* Place list structures for new sheet. */
......@@ -1013,6 +1070,12 @@ bool SCH_SHEET::doHitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy
}
wxPoint SCH_SHEET::GetResizePosition() const
{
return wxPoint( m_Pos.x + m_Size.GetWidth(), m_Pos.y + m_Size.GetHeight() );
}
#if defined(DEBUG)
void SCH_SHEET::Show( int nestLevel, std::ostream& os )
......
......@@ -19,6 +19,10 @@ class DANGLING_END_ITEM;
class SCH_EDIT_FRAME;
#define MIN_SHEET_WIDTH 500
#define MIN_SHEET_HEIGHT 150
/**
* Pin (label) used in sheets to create hierarchical schematics.
*
......@@ -81,14 +85,14 @@ public:
*/
virtual void CreateGraphicShape( std::vector <wxPoint>& aCorner_list, const wxPoint& aPos );
void SwapData( SCH_SHEET_PIN* copyitem );
virtual void SwapData( SCH_ITEM* aItem );
/**
* Get the sheet label number.
*
* @return Number of the sheet label.
*/
int GetNumber() { return m_Number; }
int GetNumber() const { return m_Number; }
/**
* Set the sheet label number.
......@@ -96,8 +100,10 @@ public:
* @param aNumber - New sheet number label.
*/
void SetNumber( int aNumber );
void SetEdge( int aEdge );
int GetEdge();
int GetEdge() const;
/**
* Function ConstraintOnEdge
......@@ -345,6 +351,38 @@ public:
*/
bool HasUndefinedPins();
/**
* Function GetMinWidth
* returns the minimum width of the sheet based on the widths of the sheet pin text.
*
* <p>
* The minimum sheet width is determined by the width of the bounding box of each
* hierarchical sheet pin. If two pins are horizontally adjacent ( same Y position )
* to each other, the sum of the bounding box widths is used. If at some point in
* the future sheet objects can be rotated or pins can be placed in the vertical
* orientation, this function will need to be changed.
* </p>
*
* @return The minimum width the sheet can be resized.
*/
int GetMinWidth() const;
/**
* Function GetMinHeight
* returns the minimum height that the sheet can be resized based on the sheet pin
* positions.
*
* <p>
* The minimum width of a sheet is determined by the Y axis location of the bottom
* most sheet pin. If at some point in the future sheet objects can be rotated or
* pins can be placed in the vertical orientation, this function will need to be
* changed.
* </p>
*
* @return The minimum height the sheet can be resized.
*/
int GetMinHeight() const;
/**
* Function GetPenSize
* @return the size of the "pen" that be used to draw or plot this item
......@@ -373,7 +411,15 @@ public:
*/
EDA_RECT GetBoundingBox() const;
void SwapData( SCH_SHEET* copyitem );
/**
* Function GetResizePos
* returns the position of the lower right corner of the sheet in drawing units.
*
* @return A wxPoint containing lower right corner of the sheet in drawing units.
*/
wxPoint GetResizePosition() const;
virtual void SwapData( SCH_ITEM* aItem );
/**
* Function ComponentCount
......
......@@ -80,15 +80,20 @@ void SCH_SHEET_PIN::Draw( EDA_DRAW_PANEL* aPanel,
}
void SCH_SHEET_PIN::SwapData( SCH_SHEET_PIN* copyitem )
void SCH_SHEET_PIN::SwapData( SCH_ITEM* aItem )
{
SCH_TEXT::SwapData( (SCH_TEXT*) copyitem );
wxCHECK_RET( aItem->Type() == SCH_SHEET_PIN_T,
wxString::Format( wxT( "SCH_SHEET_PIN object cannot swap data with %s object." ),
GetChars( aItem->GetClass() ) ) );
SCH_SHEET_PIN* pin = ( SCH_SHEET_PIN* ) aItem;
SCH_TEXT::SwapData( (SCH_TEXT*) pin );
int tmp;
tmp = copyitem->GetNumber();
copyitem->SetNumber( GetNumber() );
tmp = pin->GetNumber();
pin->SetNumber( GetNumber() );
SetNumber( tmp );
tmp = copyitem->GetEdge();
copyitem->SetEdge( GetEdge() );
tmp = pin->GetEdge();
pin->SetEdge( GetEdge() );
SetEdge( tmp );
}
......@@ -178,7 +183,7 @@ void SCH_SHEET_PIN::SetEdge( int aEdge )
}
int SCH_SHEET_PIN::GetEdge()
int SCH_SHEET_PIN::GetEdge() const
{
return m_Edge;
}
......
......@@ -1602,7 +1602,7 @@ wxPoint SCH_HIERLABEL::GetSchematicTextOffset()
void SCH_HIERLABEL::Mirror_Y( int aYaxis_position )
{
/* The hierarchical label is NOT really mirrored for an horizontal label, the schematic
* orientation is changed. For a vericalal label, the schematic orientation is not changed
* orientation is changed. For a vertical label, the schematic orientation is not changed
* and the label is moved to a suitable position.
*/
......
......@@ -28,34 +28,6 @@
#include <boost/foreach.hpp>
static int s_PreviousSheetWidth;
static int s_PreviousSheetHeight;
static wxPoint s_OldPos; /* Former position for cancellation or move ReSize */
/**
* Function EditSheet
* is used to edit an existing sheet or add a new sheet to the schematic.
* <p>
* When \a aSheet is a new sheet:
* <ul>
* <li>and the file name already exists in the schematic hierarchy, the screen associated with
* the sheet found in the hierarchy is associated with \a aSheet.</li>
* <li>and the file name already exists on the system, then \a aSheet is loaded with the
* existing file.</li>
* <li>and the file name does not exist in the schematic hierarchy or on the file system, then
* a new screen is created and associated with \a aSheet.</li>
* </ul> </p> <p>
* When \a aSheet is an existing sheet:
* <ul>
* <li>and the file name already exists in the schematic hierarchy, the current associated screen
* is replace by the one found in the hierarchy.</li>
* <li>and the file name already exists on the system, the current associated screen file name
* is changed and the file is loaded.</li>
* <li>and the file name does not exist in the schematic hierarchy or on the file system, the
* current associated screen file name is changed and saved to disk.</li>
* </ul> </p>
*/
bool SCH_EDIT_FRAME::EditSheet( SCH_SHEET* aSheet, wxDC* aDC )
{
if( aSheet == NULL )
......@@ -231,11 +203,30 @@ static void MoveOrResizeSheet( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint&
if( aErase )
sheet->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode );
if( sheet->m_Flags & IS_RESIZED )
if( sheet->GetFlags() & IS_RESIZED )
{
wxSize newSize( MAX( s_PreviousSheetWidth, screen->GetCrossHairPosition().x - sheet->m_Pos.x ),
MAX( s_PreviousSheetHeight, screen->GetCrossHairPosition().y - sheet->m_Pos.y ) );
sheet->Resize( newSize );
int width = screen->GetCrossHairPosition().x - sheet->m_Pos.x;
int height = screen->GetCrossHairPosition().y - sheet->m_Pos.y;
// If the sheet doesn't have any pins, clamp the minimum size to the default values.
width = ( width < MIN_SHEET_WIDTH ) ? MIN_SHEET_WIDTH : width;
height = ( height < MIN_SHEET_HEIGHT ) ? MIN_SHEET_HEIGHT : height;
if( sheet->HasPins() )
{
int gridSizeX = wxRound( screen->GetGridSize().x );
int gridSizeY = wxRound( screen->GetGridSize().y );
// If the sheet has pins, use the pin positions to clamp the minimum height.
height = ( height < sheet->GetMinHeight() + gridSizeY ) ?
sheet->GetMinHeight() + gridSizeY : height;
width = ( width < sheet->GetMinWidth() + gridSizeX ) ?
sheet->GetMinWidth() + gridSizeX : width;
}
wxPoint grid = screen->GetNearestGridPosition( wxPoint( sheet->m_Pos.x + width,
sheet->m_Pos.y + height ) );
sheet->Resize( wxSize( grid.x - sheet->m_Pos.x, grid.y - sheet->m_Pos.y ) );
}
else /* Move Sheet */
{
......@@ -251,38 +242,47 @@ static void MoveOrResizeSheet( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint&
static void ExitSheet( EDA_DRAW_PANEL* aPanel, wxDC* aDC )
{
SCH_SCREEN* screen = (SCH_SCREEN*) aPanel->GetScreen();
SCH_SHEET* sheet = (SCH_SHEET*) screen->GetCurItem();
SCH_ITEM* item = screen->GetCurItem();
SCH_EDIT_FRAME* parent = ( SCH_EDIT_FRAME* ) aPanel->GetParent();
if( sheet == NULL )
if( (item == NULL) || (item->Type() != SCH_SHEET_T) || (parent == NULL) )
return;
if( sheet->IsNew() )
parent->SetRepeatItem( NULL );
item->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode );
if( item->IsNew() )
{
sheet->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode );
SAFE_DELETE( sheet );
SAFE_DELETE( item );
}
else if( (sheet->m_Flags & (IS_RESIZED|IS_MOVED)) )
else if( item->m_Flags & (IS_RESIZED | IS_MOVED) )
{
wxPoint curspos = screen->GetCrossHairPosition();
aPanel->GetScreen()->SetCrossHairPosition( s_OldPos );
MoveOrResizeSheet( aPanel, aDC, wxDefaultPosition, true );
sheet->Draw( aPanel, aDC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE );
sheet->m_Flags = 0;
screen->SetCrossHairPosition( curspos );
screen->RemoveFromDrawList( item );
delete item;
item = parent->GetUndoItem();
wxCHECK_RET( item != NULL, wxT( "Cannot restore undefined last sheet item." ) );
screen->AddToDrawList( item );
parent->SetUndoItem( NULL );
item->Draw( aPanel, aDC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE );
item->ClearFlags();
SCH_SHEET* sheet = ( SCH_SHEET* ) item;
aPanel->CrossHairOff( aDC );
screen->SetCrossHairPosition( sheet->GetResizePosition() );
aPanel->CrossHairOn( aDC );
}
else
{
sheet->m_Flags = 0;
item->ClearFlags();
}
screen->SetCurItem( NULL );
}
#define SHEET_MIN_WIDTH 500
#define SHEET_MIN_HEIGHT 150
/* Create hierarchy sheet. */
SCH_SHEET* SCH_EDIT_FRAME::CreateSheet( wxDC* aDC )
{
......@@ -294,8 +294,6 @@ SCH_SHEET* SCH_EDIT_FRAME::CreateSheet( wxDC* aDC )
sheet->m_TimeStamp = GetTimeStamp();
sheet->SetParent( GetScreen() );
sheet->SetScreen( NULL );
s_PreviousSheetWidth = SHEET_MIN_WIDTH;
s_PreviousSheetHeight = SHEET_MIN_HEIGHT;
// need to check if this is being added to the GetDrawItems().
// also need to update the hierarchy, if we are adding
......@@ -303,6 +301,9 @@ SCH_SHEET* SCH_EDIT_FRAME::CreateSheet( wxDC* aDC )
GetScreen()->SetCurItem( sheet );
DrawPanel->SetMouseCapture( MoveOrResizeSheet, ExitSheet );
DrawPanel->m_mouseCaptureCallback( DrawPanel, aDC, wxDefaultPosition, false );
DrawPanel->CrossHairOff( aDC );
GetScreen()->SetCrossHairPosition( sheet->GetResizePosition() );
DrawPanel->CrossHairOn( aDC );
return sheet;
}
......@@ -313,33 +314,24 @@ void SCH_EDIT_FRAME::ReSizeSheet( SCH_SHEET* aSheet, wxDC* aDC )
if( aSheet == NULL || aSheet->IsNew() )
return;
if( aSheet->Type() != SCH_SHEET_T )
{
DisplayError( this, wxT( "SCH_EDIT_FRAME::ReSizeSheet: Bad SructType" ) );
return;
}
OnModify( );
aSheet->m_Flags |= IS_RESIZED;
s_OldPos = aSheet->m_Pos + aSheet->m_Size;
wxCHECK_RET( aSheet->Type() == SCH_SHEET_T,
wxString::Format( wxT( "Cannot perform sheet resize on %s object." ),
GetChars( aSheet->GetClass() ) ) );
s_PreviousSheetWidth = SHEET_MIN_WIDTH;
s_PreviousSheetHeight = SHEET_MIN_HEIGHT;
SetUndoItem( aSheet );
OnModify();
aSheet->SetFlags( IS_RESIZED );
BOOST_FOREACH( SCH_SHEET_PIN sheetPin, aSheet->GetPins() )
{
s_PreviousSheetWidth = MAX( s_PreviousSheetWidth,
( sheetPin.GetLength() + 1 ) * sheetPin.m_Size.x );
s_PreviousSheetHeight = MAX( s_PreviousSheetHeight,
sheetPin.m_Pos.y - aSheet->m_Pos.y );
}
DrawPanel->SetMouseCapture( MoveOrResizeSheet, ExitSheet );
DrawPanel->m_mouseCaptureCallback( DrawPanel, aDC, wxDefaultPosition, true );
if( aSheet->IsNew() ) // not already in edit, save a copy for undo/redo
SetUndoItem( aSheet );
DrawPanel->CrossHairOff( aDC );
GetScreen()->SetCrossHairPosition( aSheet->GetResizePosition() );
DrawPanel->CrossHairOn( aDC );
}
......@@ -352,12 +344,11 @@ void SCH_EDIT_FRAME::StartMoveSheet( SCH_SHEET* aSheet, wxDC* aDC )
GetScreen()->SetCrossHairPosition( aSheet->m_Pos );
DrawPanel->MoveCursorToCrossHair();
s_OldPos = aSheet->m_Pos;
aSheet->m_Flags |= IS_MOVED;
if( !aSheet->IsNew() )
SetUndoItem( aSheet );
aSheet->SetFlags( IS_MOVED );
DrawPanel->SetMouseCapture( MoveOrResizeSheet, ExitSheet );
DrawPanel->m_mouseCaptureCallback( DrawPanel, aDC, wxDefaultPosition, true );
DrawPanel->CrossHairOn( aDC );
if( !aSheet->IsNew() ) // not already in edit, save a copy for undo/redo
SetUndoItem( aSheet );
}
......@@ -176,7 +176,7 @@ public:
*
* @param aKeywordTable is an array of KEYWORDS holding \a aKeywordCount. This
* token table need not contain the lexer separators such as '(' ')', etc.
* @param aKeywordTable is the count of tokens in aKeywordTable.
* @param aKeywordCount is the count of tokens in aKeywordTable.
* @param aFile is an open file, which will be closed when this is destructed.
* @param aFileName is the name of the file
*/
......@@ -189,7 +189,7 @@ public:
*
* @param aKeywordTable is an array of KEYWORDS holding \a aKeywordCount. This
* token table need not contain the lexer separators such as '(' ')', etc.
* @param aKeywordTable is the count of tokens in aKeywordTable.
* @param aKeywordCount is the count of tokens in aKeywordTable.
* @param aSExpression is text to feed through a STRING_LINE_READER
* @param aSource is a description of aSExpression, used for error reporting.
*/
......@@ -204,7 +204,7 @@ public:
*
* @param aKeywordTable is an array of KEYWORDS holding \a aKeywordCount. This
* token table need not contain the lexer separators such as '(' ')', etc.
* @param aKeywordTable is the count of tokens in aKeywordTable.
* @param aKeywordCount is the count of tokens in aKeywordTable.
* @param aLineReader is any subclassed instance of LINE_READER, such as
* STRING_LINE_READER or FILE_LINE_READER.
*/
......
......@@ -565,7 +565,30 @@ private:
wxString SelectFromLibBrowser( void );
public:
bool EditSheet( SCH_SHEET* Sheet, wxDC* DC );
/**
* Function EditSheet
* is used to edit an existing sheet or add a new sheet to the schematic.
* <p>
* When \a aSheet is a new sheet:
* <ul>
* <li>and the file name already exists in the schematic hierarchy, the screen associated
* with the sheet found in the hierarchy is associated with \a aSheet.</li>
* <li>and the file name already exists on the system, then \a aSheet is loaded with the
* existing file.</li>
* <li>and the file name does not exist in the schematic hierarchy or on the file system,
* then a new screen is created and associated with \a aSheet.</li>
* </ul> </p> <p>
* When \a aSheet is an existing sheet:
* <ul>
* <li>and the file name already exists in the schematic hierarchy, the current associated
* screen is replace by the one found in the hierarchy.</li>
* <li>and the file name already exists on the system, the current associated screen file
* name is changed and the file is loaded.</li>
* <li>and the file name does not exist in the schematic hierarchy or on the file system,
* the current associated screen file name is changed and saved to disk.</li>
* </ul> </p>
*/
bool EditSheet( SCH_SHEET* aSheet, wxDC* aDC );
wxPoint GetLastSheetPinPosition() const { return m_lastSheetPinPosition; }
......@@ -723,15 +746,15 @@ private:
* Function copyBlockItems
* copies the list of block item.
* @sa m_blockItems
* @param aItemList List to copy the block select items into.
* @param aItemsList List to copy the block select items into.
*/
void copyBlockItems( PICKED_ITEMS_LIST& aItemsList );
/**
* Function addJunctionMenuEntries
* adds the context menu items to \a aMenu for \a aJunction.
* @params aMenu The menu to add the items to.
* @params aJunction The SCH_JUNCTION object selected.
* @param aMenu The menu to add the items to.
* @param aJunction The SCH_JUNCTION object selected.
*/
void addJunctionMenuEntries( wxMenu* aMenu, SCH_JUNCTION* aJunction );
......
......@@ -199,13 +199,13 @@ private:
* but does not add it to the BOARD. Use this to report any kind of
* DRC problem, or unconnected pad problem.
*
* @param aTrack The reference track
* @param aTrack The reference track.
* @param aItem Another item on the BOARD, such as a SEGVIA, SEGZONE,
* or TRACK.
* or TRACK.
* @param aErrorCode A categorizing identifier for the particular type
* of error that is being reported.
* of error that is being reported.
* @param fillMe A MARKER_PCB* which is to be filled in, or NULL if one is to
* first be allocated, then filled.
* first be allocated, then filled.
*/
MARKER_PCB* fillMarker( TRACK* aTrack, BOARD_ITEM* aItem, int aErrorCode, MARKER_PCB* fillMe );
......@@ -219,11 +219,11 @@ private:
* but does not add it to the BOARD. Use this to report any kind of
* DRC problem, or unconnected pad problem.
*
* @param aEdge edge zone to test
* @param aArea The zone to test
* @param aPos position of error
* @param aErrorCode Type of error
* @param fillMe A MARKER_PCB* which is to be filled in, or NULL if one is to
* first be allocated, then filled.
* first be allocated, then filled.
*/
MARKER_PCB* fillMarker( const ZONE_CONTAINER* aArea,
const wxPoint& aPos,
......
......@@ -144,7 +144,7 @@ private:
/**
* Function SetPadNetName
* Update a pad netname using the current footprint
* from the netlist (line format: ( <pad number> <net name> ) )
* from the netlist (line format: ( \<pad number\> \<net name\> ) )
* @param aText = current line read from netlist
*/
bool SetPadNetName( char* aText );
......
......@@ -1134,7 +1134,7 @@ class LAYER : public ELEM
std::string name;
DSN_T layer_type; ///< one of: T_signal, T_power, T_mixed, T_jumper
int direction;
int cost; ///< [forbidden | high | medium | low | free | <positive_integer > | -1]
int cost; ///< [forbidden | high | medium | low | free | \<positive_integer\> | -1]
int cost_type; ///< T_length | T_way
RULE* rules;
STRINGS use_net;
......@@ -2678,7 +2678,7 @@ class CLASS : public ELEM
STRINGS net_ids;
/// <circuit_descriptor> list
/// circuit descriptor list
STRINGS circuit;
RULE* rules;
......@@ -3619,7 +3619,7 @@ class SPECCTRA_DB : public SPECCTRA_LEXER
* pin_reference and it will be tested through CurTok().
*
* @param component_id Where to put the text preceeding the '-' hyphen.
* @param pin_d Where to put the text which trails the '-'.
* @param pid_id Where to put the text which trails the '-'.
* @throw IO_ERROR, if the next token or two do no make up a pin_reference,
* or there is an error reading from the input stream.
*/
......@@ -3719,6 +3719,7 @@ class SPECCTRA_DB : public SPECCTRA_LEXER
* Function makePADSTACK
* creates a PADSTACK which matches the given pad. Only pads which do not
* satisfy the function isKeepout() should be passed to this function.
* @param aBoard The owner of the MODULE.
* @param aPad The D_PAD which needs to be made into a PADSTACK.
* @return PADSTACK* - The created padstack, including its padstack_id.
*/
......
......@@ -143,7 +143,7 @@ public:
/**
* Function Fillet
* returns a filleted version of a polygon.
* @param aDistance is the fillet radius.
* @param aRadius is the fillet radius.
* @param aSegments is the number of segments / fillet.
* @return CPolyLine* - Pointer to new polygon.
*/
......
......@@ -955,7 +955,8 @@ double GetPointToLineSegmentDistance( int x, int y, int xi, int yi, int xf, int
* Function GetPointToLineSegmentDistance
* Get distance between line segment and point
* @param x,y = point
* @param xi,yi and xf,yf = the end-points of the line segment
* @param xi,yi Start point of the line segament
* @param xf,yf End point of the line segment
* @return the distance
*/
{
......
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