mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-04-21 09:51:53 +00:00
Begin translating comments to English and minor code clean up.
* Translate comments in source files beginning with A-E in eeschema. * Spell check comments and strings and uncrusified all modified files.
This commit is contained in:
parent
d3468dd557
commit
1a4d23896e
eeschema
backanno.cppblock.cppblock_libedit.cppbuild_BOM.cppbus-wire-junction.cppbusentry.cppclass_drawsheet.cppclass_drawsheet.hclass_drawsheetpath.cppclass_drawsheetpath.hclass_hierarchical_PIN_sheet.cppclass_libentry_fields.cppclass_libentry_fields.hclass_library.cppclass_library.hclass_sch_cmp_field.cppclass_schematic_items.cppclass_schematic_items.hclass_text-label.cppclass_text-label.hcleanup.cppcontrole.cppdangling_ends.cppdatabase.cppdelete.cppdelsheet.cppdialog_erc.cppedit_component_in_schematic.cppedit_graphic_bodyitem_text.cppedit_label.cppeelayer.cppeelayer.heeredraw.cppeeschema.cppeeschema_config.cppeeschema_config.herc.cpperc.h
@ -13,34 +13,35 @@
|
||||
|
||||
#include "general.h"
|
||||
|
||||
/* Variables Locales */
|
||||
|
||||
/*******************************************************************************************/
|
||||
bool WinEDA_SchematicFrame::FillFootprintFieldForAllInstancesofComponent(
|
||||
const wxString& aReference,
|
||||
const wxString& aFootPrint,
|
||||
bool aSetVisible )
|
||||
/********************************************************************************************/
|
||||
|
||||
{
|
||||
/** function FillFootprintFieldForAllInstancesofComponent
|
||||
* Search for component "aReference", and place a Footprint in Footprint field
|
||||
* @param aReference = reference of the component to initialise
|
||||
* @param aReference = reference of the component to initialize
|
||||
* @param aFootPrint = new value for the filed Fottprint component
|
||||
* @param aSetVisible = true to have the field visible, false to set the invisible flag
|
||||
* @param aSetVisible = true to have the field visible, false to set the
|
||||
* invisible flag
|
||||
* @return true if the given component is found
|
||||
* Note:
|
||||
* the component is searched in the whole schematic, and because some components
|
||||
* the component is searched in the whole schematic, and because some
|
||||
* components
|
||||
* have more than one instance (multiple parts per package components)
|
||||
* the search is not stopped when a reference is found (all instances must be found).
|
||||
* the search is not stopped when a reference is found (all instances must be
|
||||
* found).
|
||||
*/
|
||||
{
|
||||
DrawSheetPath* sheet;
|
||||
SCH_ITEM* DrawList = NULL;
|
||||
EDA_SheetList SheetList;
|
||||
SCH_COMPONENT* Cmp;
|
||||
bool found = false;
|
||||
|
||||
for( sheet = SheetList.GetFirst(); sheet != NULL; sheet = SheetList.GetNext() )
|
||||
for( sheet = SheetList.GetFirst();
|
||||
sheet != NULL;
|
||||
sheet = SheetList.GetNext() )
|
||||
{
|
||||
DrawList = (SCH_ITEM*) sheet->LastDrawList();
|
||||
for( ; (DrawList != NULL); DrawList = DrawList->Next() )
|
||||
@ -51,22 +52,27 @@ bool WinEDA_SchematicFrame::FillFootprintFieldForAllInstancesofComponent(
|
||||
Cmp = (SCH_COMPONENT*) DrawList;
|
||||
if( aReference.CmpNoCase( Cmp->GetRef( sheet ) ) == 0 )
|
||||
{
|
||||
// Found: Init Footprint Field
|
||||
/* Give a reasonnable value to the fied position and orientation, if
|
||||
* the text is empty at position 0, because it is probably not yet initialised
|
||||
*/
|
||||
if( Cmp->GetField(FOOTPRINT)->m_Text.IsEmpty()
|
||||
&& ( Cmp->GetField(FOOTPRINT)->m_Pos == wxPoint( 0, 0 ) ) )
|
||||
// Found: Init Footprint Field
|
||||
|
||||
/* Give a reasonable value to the field position and
|
||||
* orientation, if the text is empty at position 0, because
|
||||
* it is probably not yet initialized
|
||||
*/
|
||||
if( Cmp->GetField( FOOTPRINT )->m_Text.IsEmpty()
|
||||
&& ( Cmp->GetField( FOOTPRINT )->m_Pos == wxPoint( 0, 0 ) ) )
|
||||
{
|
||||
Cmp->GetField(FOOTPRINT)->m_Orient = Cmp->GetField(VALUE)->m_Orient;
|
||||
Cmp->GetField(FOOTPRINT)->m_Pos = Cmp->GetField(VALUE)->m_Pos;
|
||||
Cmp->GetField(FOOTPRINT)->m_Pos.y -= 100;
|
||||
Cmp->GetField( FOOTPRINT )->m_Orient = Cmp->GetField(
|
||||
VALUE )->m_Orient;
|
||||
Cmp->GetField( FOOTPRINT )->m_Pos = Cmp->GetField(
|
||||
VALUE )->m_Pos;
|
||||
Cmp->GetField( FOOTPRINT )->m_Pos.y -= 100;
|
||||
}
|
||||
Cmp->GetField(FOOTPRINT)->m_Text = aFootPrint;
|
||||
Cmp->GetField( FOOTPRINT )->m_Text = aFootPrint;
|
||||
if( aSetVisible )
|
||||
Cmp->GetField(FOOTPRINT)->m_Attributs &= ~TEXT_NO_VISIBLE;
|
||||
Cmp->GetField( FOOTPRINT )->m_Attributs &=
|
||||
~TEXT_NO_VISIBLE;
|
||||
else
|
||||
Cmp->GetField(FOOTPRINT)->m_Attributs |= TEXT_NO_VISIBLE;
|
||||
Cmp->GetField( FOOTPRINT )->m_Attributs |= TEXT_NO_VISIBLE;
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
@ -76,11 +82,9 @@ bool WinEDA_SchematicFrame::FillFootprintFieldForAllInstancesofComponent(
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************************/
|
||||
bool WinEDA_SchematicFrame::ProcessStuffFile( FILE* aStuffFile, bool
|
||||
aSetFielsAttributeToVisible )
|
||||
/***************************************************************************/
|
||||
|
||||
{
|
||||
/** Function ProcessStuffFile
|
||||
* Read a "stuff" file created by cvpcb.
|
||||
* That file has lines like:
|
||||
@ -91,10 +95,10 @@ bool WinEDA_SchematicFrame::ProcessStuffFile( FILE* aStuffFile, bool
|
||||
* "module =" gives the footprint name
|
||||
*
|
||||
* @param aStuffFile = file (*.stf) to Read.
|
||||
* @param aSetFielsAttributeToVisible = true to set the footprint field flag to visible
|
||||
* @return true if ok.
|
||||
* @param aSetFielsAttributeToVisible = true to set the footprint field flag to
|
||||
* visible
|
||||
* @return true if OK.
|
||||
*/
|
||||
{
|
||||
int LineNum = 0;
|
||||
char* cp, Ref[256], FootPrint[256], Line[1024];
|
||||
|
||||
@ -112,9 +116,10 @@ bool WinEDA_SchematicFrame::ProcessStuffFile( FILE* aStuffFile, bool
|
||||
|
||||
wxString reference = CONV_FROM_UTF8( Ref );
|
||||
wxString Footprint = CONV_FROM_UTF8( FootPrint );
|
||||
FillFootprintFieldForAllInstancesofComponent( reference,
|
||||
Footprint,
|
||||
aSetFielsAttributeToVisible );
|
||||
FillFootprintFieldForAllInstancesofComponent(
|
||||
reference,
|
||||
Footprint,
|
||||
aSetFielsAttributeToVisible );
|
||||
}
|
||||
}
|
||||
|
||||
@ -122,23 +127,20 @@ bool WinEDA_SchematicFrame::ProcessStuffFile( FILE* aStuffFile, bool
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************/
|
||||
bool WinEDA_SchematicFrame::ReadInputStuffFile()
|
||||
/**************************************************************/
|
||||
|
||||
{
|
||||
/* Backann footprint info to schematic.
|
||||
*/
|
||||
{
|
||||
wxString Line, filename;
|
||||
FILE* StuffFile;
|
||||
wxString msg;
|
||||
bool SetFieldToVisible = true;
|
||||
|
||||
filename = EDA_FileSelector( _( "Load Stuff File" ),
|
||||
wxEmptyString, /* Chemin par defaut */
|
||||
wxEmptyString, /* nom fichier par defaut */
|
||||
wxT( ".stf" ), /* extension par defaut */
|
||||
wxT( "*.stf" ), /* Masque d'affichage */
|
||||
wxEmptyString,
|
||||
wxEmptyString,
|
||||
wxT( ".stf" ),
|
||||
wxT( "*.stf" ),
|
||||
this,
|
||||
wxFD_OPEN,
|
||||
FALSE
|
||||
@ -156,7 +158,7 @@ bool WinEDA_SchematicFrame::ReadInputStuffFile()
|
||||
|
||||
int diag = wxMessageBox(
|
||||
_( "Set the Footprint Field to Visible ?" ),
|
||||
_ ("Field Display Option"),
|
||||
_( "Field Display Option" ),
|
||||
wxYES_NO | wxICON_QUESTION | wxCANCEL, this );
|
||||
|
||||
if( diag == wxCANCEL )
|
||||
|
@ -1,6 +1,5 @@
|
||||
/****************************************************/
|
||||
/* BLOCK.CPP */
|
||||
/* Gestion des Operations sur Blocks et Effacements */
|
||||
/****************************************************/
|
||||
|
||||
#include "fctsys.h"
|
||||
@ -18,41 +17,35 @@
|
||||
#include "protos.h"
|
||||
|
||||
|
||||
/* Variables Locales */
|
||||
|
||||
// Imported functions:
|
||||
void MoveItemsInList( PICKED_ITEMS_LIST& aItemsList,
|
||||
const wxPoint aMoveVector );
|
||||
void MirrorListOfItems( PICKED_ITEMS_LIST& aItemsList,
|
||||
wxPoint& Center );
|
||||
void DeleteItemsInList( WinEDA_DrawPanel* panel,
|
||||
PICKED_ITEMS_LIST& aItemsList );
|
||||
void DuplicateItemsInList( SCH_SCREEN* screen,
|
||||
PICKED_ITEMS_LIST& aItemsList,
|
||||
const wxPoint aMoveVector );
|
||||
void MoveItemsInList( PICKED_ITEMS_LIST& aItemsList,
|
||||
const wxPoint aMoveVector );
|
||||
void MirrorListOfItems( PICKED_ITEMS_LIST& aItemsList,
|
||||
wxPoint& Center );
|
||||
void DeleteItemsInList( WinEDA_DrawPanel* panel,
|
||||
PICKED_ITEMS_LIST& aItemsList );
|
||||
void DuplicateItemsInList( SCH_SCREEN* screen,
|
||||
PICKED_ITEMS_LIST& aItemsList,
|
||||
const wxPoint aMoveVector );
|
||||
|
||||
/* Fonctions exportees */
|
||||
|
||||
/* Fonctions Locales */
|
||||
static void CollectStructsToDrag( SCH_SCREEN* screen );
|
||||
static void AddPickedItem( SCH_SCREEN* screen, wxPoint aPosition );
|
||||
static LIB_PIN* GetNextPinPosition( SCH_COMPONENT* aDrawLibItem,
|
||||
wxPoint& aPosition,
|
||||
bool aSearchFirst );
|
||||
static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel,
|
||||
wxDC* DC,
|
||||
bool erase );
|
||||
static void SaveStructListForPaste( PICKED_ITEMS_LIST& aItemsList );
|
||||
static void CollectStructsToDrag( SCH_SCREEN* screen );
|
||||
static void AddPickedItem( SCH_SCREEN* screen, wxPoint aPosition );
|
||||
static LIB_PIN* GetNextPinPosition( SCH_COMPONENT* aDrawLibItem,
|
||||
wxPoint& aPosition,
|
||||
bool aSearchFirst );
|
||||
static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel,
|
||||
wxDC* DC,
|
||||
bool erase );
|
||||
static void SaveStructListForPaste( PICKED_ITEMS_LIST& aItemsList );
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
int WinEDA_SchematicFrame::ReturnBlockCommand( int key )
|
||||
{
|
||||
/*************************************************************************/
|
||||
|
||||
/* Return the block command (BLOCK_MOVE, BLOCK_COPY...) corresponding to
|
||||
* the key (ALT, SHIFT ALT ..)
|
||||
*/
|
||||
{
|
||||
int cmd;
|
||||
|
||||
switch( key )
|
||||
@ -89,11 +82,10 @@ int WinEDA_SchematicFrame::ReturnBlockCommand( int key )
|
||||
|
||||
/*************************************************/
|
||||
void WinEDA_SchematicFrame::InitBlockPasteInfos()
|
||||
{
|
||||
/*************************************************/
|
||||
|
||||
/* Init the parameters used by the block paste command
|
||||
*/
|
||||
{
|
||||
BLOCK_SELECTOR* block = &GetScreen()->m_BlockLocate;
|
||||
|
||||
block->m_ItemsSelection.CopyList( g_BlockSaveDataList.m_ItemsSelection );
|
||||
@ -103,14 +95,13 @@ void WinEDA_SchematicFrame::InitBlockPasteInfos()
|
||||
|
||||
/******************************************************/
|
||||
void WinEDA_SchematicFrame::HandleBlockPlace( wxDC* DC )
|
||||
{
|
||||
/******************************************************/
|
||||
|
||||
/* Routine to handle the BLOCK PLACE commande
|
||||
/* Routine to handle the BLOCK PLACE command
|
||||
* Last routine for block operation for:
|
||||
* - block move & drag
|
||||
* - block copie & paste
|
||||
* - block copy & paste
|
||||
*/
|
||||
{
|
||||
bool err = FALSE;
|
||||
BLOCK_SELECTOR* block = &GetScreen()->m_BlockLocate;
|
||||
|
||||
@ -124,7 +115,8 @@ void WinEDA_SchematicFrame::HandleBlockPlace( wxDC* DC )
|
||||
{
|
||||
wxString msg;
|
||||
err = TRUE;
|
||||
msg.Printf( wxT( "HandleBlockPLace() error : no items to place (cmd %d, state %d)" ),
|
||||
msg.Printf( wxT( "HandleBlockPLace() error : no items to place (cmd \
|
||||
%d, state %d)" ),
|
||||
block->m_Command, block->m_State );
|
||||
DisplayError( this, msg );
|
||||
}
|
||||
@ -142,7 +134,9 @@ void WinEDA_SchematicFrame::HandleBlockPlace( wxDC* DC )
|
||||
if( DrawPanel->ManageCurseur )
|
||||
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
|
||||
|
||||
SaveCopyInUndoList( block->m_ItemsSelection, UR_MOVED, block->m_MoveVector );
|
||||
SaveCopyInUndoList( block->m_ItemsSelection,
|
||||
UR_MOVED,
|
||||
block->m_MoveVector );
|
||||
|
||||
MoveItemsInList( block->m_ItemsSelection, block->m_MoveVector );
|
||||
block->ClearItemsList();
|
||||
@ -153,15 +147,18 @@ void WinEDA_SchematicFrame::HandleBlockPlace( wxDC* DC )
|
||||
if( DrawPanel->ManageCurseur )
|
||||
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
|
||||
|
||||
DuplicateItemsInList( GetScreen(), block->m_ItemsSelection, block->m_MoveVector );
|
||||
DuplicateItemsInList(
|
||||
GetScreen(), block->m_ItemsSelection, block->m_MoveVector );
|
||||
|
||||
SaveCopyInUndoList( block->m_ItemsSelection,
|
||||
(block->m_Command == BLOCK_PRESELECT_MOVE) ? UR_CHANGED : UR_NEW );
|
||||
SaveCopyInUndoList(
|
||||
block->m_ItemsSelection,
|
||||
(block->m_Command ==
|
||||
BLOCK_PRESELECT_MOVE) ? UR_CHANGED : UR_NEW );
|
||||
|
||||
block->ClearItemsList();
|
||||
break;
|
||||
|
||||
case BLOCK_PASTE: /* Paste (recopie du dernier bloc sauve */
|
||||
case BLOCK_PASTE:
|
||||
if( DrawPanel->ManageCurseur )
|
||||
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
|
||||
PasteListOfItems( DC );
|
||||
@ -184,7 +181,9 @@ void WinEDA_SchematicFrame::HandleBlockPlace( wxDC* DC )
|
||||
|
||||
/* clear struct.m_Flags */
|
||||
SCH_ITEM* Struct;
|
||||
for( Struct = GetScreen()->EEDrawList; Struct != NULL; Struct = Struct->Next() )
|
||||
for( Struct = GetScreen()->EEDrawList;
|
||||
Struct != NULL;
|
||||
Struct = Struct->Next() )
|
||||
Struct->m_Flags = 0;
|
||||
|
||||
DrawPanel->ManageCurseur = NULL;
|
||||
@ -198,27 +197,27 @@ void WinEDA_SchematicFrame::HandleBlockPlace( wxDC* DC )
|
||||
|
||||
if( block->GetCount() )
|
||||
{
|
||||
DisplayError( this, wxT( "HandleBlockPLace() error: some items left in buffer" ) );
|
||||
DisplayError( this,
|
||||
wxT( "HandleBlockPLace() error: some items left in buffer" ) );
|
||||
block->ClearItemsList();
|
||||
}
|
||||
|
||||
SetToolID( m_ID_current_state, DrawPanel->m_PanelDefaultCursor,
|
||||
wxEmptyString );
|
||||
DrawPanel->Refresh( );
|
||||
DrawPanel->Refresh();
|
||||
}
|
||||
|
||||
|
||||
/****************************************************/
|
||||
int WinEDA_SchematicFrame::HandleBlockEnd( wxDC* DC )
|
||||
/****************************************************/
|
||||
|
||||
/* Routine de gestion de la commande BLOCK END
|
||||
* retourne :
|
||||
* 0 si aucun composant selectionne
|
||||
* 1 sinon
|
||||
* -1 si commande terminee et composants trouves (block delete, block save)
|
||||
*/
|
||||
{
|
||||
/****************************************************/
|
||||
/* Manage end block command
|
||||
* Returns:
|
||||
* 0 if no features selected
|
||||
* 1 otherwise
|
||||
* -1 If control ended and components selection (block delete, block save)
|
||||
*/
|
||||
int ii = 0;
|
||||
bool zoom_command = FALSE;
|
||||
BLOCK_SELECTOR* block = &GetScreen()->m_BlockLocate;
|
||||
@ -247,6 +246,7 @@ int WinEDA_SchematicFrame::HandleBlockEnd( wxDC* DC )
|
||||
|
||||
case BLOCK_DRAG: /* Drag */
|
||||
BreakSegmentOnJunction( (SCH_SCREEN*) GetScreen() );
|
||||
|
||||
case BLOCK_MOVE: /* Move */
|
||||
case BLOCK_COPY: /* Copy */
|
||||
PickItemsInBlock( GetScreen()->m_BlockLocate, GetScreen() );
|
||||
@ -288,9 +288,11 @@ int WinEDA_SchematicFrame::HandleBlockEnd( wxDC* DC )
|
||||
DrawAndSizingBlockOutlines( DrawPanel, DC, FALSE );
|
||||
if( block->GetCount() )
|
||||
{
|
||||
wxPoint move_vector = -GetScreen()->m_BlockLocate.m_BlockLastCursorPosition;
|
||||
wxPoint move_vector =
|
||||
-GetScreen()->m_BlockLocate.m_BlockLastCursorPosition;
|
||||
SaveStructListForPaste( block->m_ItemsSelection );
|
||||
MoveItemsInList( g_BlockSaveDataList.m_ItemsSelection, move_vector);
|
||||
MoveItemsInList( g_BlockSaveDataList.m_ItemsSelection,
|
||||
move_vector );
|
||||
ii = -1;
|
||||
}
|
||||
block->ClearItemsList();
|
||||
@ -321,7 +323,9 @@ int WinEDA_SchematicFrame::HandleBlockEnd( wxDC* DC )
|
||||
{
|
||||
/* clear struct.m_Flags */
|
||||
EDA_BaseStruct* Struct;
|
||||
for( Struct = GetScreen()->EEDrawList; Struct != NULL; Struct = Struct->Next() )
|
||||
for( Struct = GetScreen()->EEDrawList;
|
||||
Struct != NULL;
|
||||
Struct = Struct->Next() )
|
||||
Struct->m_Flags = 0;
|
||||
}
|
||||
|
||||
@ -333,7 +337,9 @@ int WinEDA_SchematicFrame::HandleBlockEnd( wxDC* DC )
|
||||
DrawPanel->ManageCurseur = NULL;
|
||||
DrawPanel->ForceCloseManageCurseur = NULL;
|
||||
GetScreen()->SetCurItem( NULL );
|
||||
SetToolID( m_ID_current_state, DrawPanel->m_PanelDefaultCursor, wxEmptyString );
|
||||
SetToolID( m_ID_current_state,
|
||||
DrawPanel->m_PanelDefaultCursor,
|
||||
wxEmptyString );
|
||||
}
|
||||
|
||||
if( zoom_command )
|
||||
@ -345,13 +351,12 @@ int WinEDA_SchematicFrame::HandleBlockEnd( wxDC* DC )
|
||||
|
||||
/***********************************************************************/
|
||||
void WinEDA_SchematicFrame::HandleBlockEndByPopUp( int Command, wxDC* DC )
|
||||
/***********************************************************************/
|
||||
|
||||
/* Routine de gestion de la commande BLOCK END by PopUp
|
||||
* Appelee apres HandleBlockEnd.
|
||||
* A partir de la commande bloc move, peut executer une commande autre que bloc move.
|
||||
*/
|
||||
{
|
||||
/***********************************************************************/
|
||||
/* Manage end block command from context menu.
|
||||
* Called after HandleBlockEnd.
|
||||
* From the command block move can execute a command other than block move.
|
||||
*/
|
||||
int ii = 0;
|
||||
BLOCK_SELECTOR* block = &GetScreen()->m_BlockLocate;
|
||||
|
||||
@ -372,8 +377,10 @@ void WinEDA_SchematicFrame::HandleBlockEndByPopUp( int Command, wxDC* DC )
|
||||
|
||||
case BLOCK_DRAG: /* move to Drag */
|
||||
|
||||
/* Effacement de la liste des structures de pointage,
|
||||
* qui est devenue erronnee */
|
||||
/* *JP translate*
|
||||
* Effacement de la liste des structures de pointage,
|
||||
* qui est devenue erronnee
|
||||
*/
|
||||
if( DrawPanel->ManageCurseur )
|
||||
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
|
||||
block->ClearItemsList();
|
||||
@ -410,7 +417,8 @@ void WinEDA_SchematicFrame::HandleBlockEndByPopUp( int Command, wxDC* DC )
|
||||
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
|
||||
if( block->GetCount() )
|
||||
{
|
||||
wxPoint move_vector = -GetScreen()->m_BlockLocate.m_BlockLastCursorPosition;
|
||||
wxPoint move_vector =
|
||||
-GetScreen()->m_BlockLocate.m_BlockLastCursorPosition;
|
||||
SaveStructListForPaste( block->m_ItemsSelection );
|
||||
MoveItemsInList( g_BlockSaveDataList.m_ItemsSelection, move_vector );
|
||||
ii = -1;
|
||||
@ -435,10 +443,12 @@ void WinEDA_SchematicFrame::HandleBlockEndByPopUp( int Command, wxDC* DC )
|
||||
if( block->GetCount() )
|
||||
{
|
||||
ii = -1;
|
||||
/* Compute the mirror centre and put it on grid */
|
||||
/* Compute the mirror center and put it on grid */
|
||||
wxPoint mirrorPoint = block->Centre();
|
||||
PutOnGrid( &mirrorPoint );
|
||||
SaveCopyInUndoList( block->m_ItemsSelection, UR_MIRRORED_Y, mirrorPoint );
|
||||
SaveCopyInUndoList( block->m_ItemsSelection,
|
||||
UR_MIRRORED_Y,
|
||||
mirrorPoint );
|
||||
MirrorListOfItems( block->m_ItemsSelection, mirrorPoint );
|
||||
GetScreen()->SetModify();
|
||||
}
|
||||
@ -459,7 +469,9 @@ void WinEDA_SchematicFrame::HandleBlockEndByPopUp( int Command, wxDC* DC )
|
||||
DrawPanel->ManageCurseur = NULL;
|
||||
DrawPanel->ForceCloseManageCurseur = NULL;
|
||||
GetScreen()->SetCurItem( NULL );
|
||||
SetToolID( m_ID_current_state, DrawPanel->m_PanelDefaultCursor, wxEmptyString );
|
||||
SetToolID( m_ID_current_state,
|
||||
DrawPanel->m_PanelDefaultCursor,
|
||||
wxEmptyString );
|
||||
}
|
||||
}
|
||||
|
||||
@ -467,18 +479,17 @@ void WinEDA_SchematicFrame::HandleBlockEndByPopUp( int Command, wxDC* DC )
|
||||
/************************************************************************/
|
||||
static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC,
|
||||
bool erase )
|
||||
/************************************************************************/
|
||||
|
||||
/* Retrace le contour du block de recherche de structures
|
||||
* L'ensemble du block suit le curseur
|
||||
*/
|
||||
{
|
||||
/************************************************************************/
|
||||
/* Traces the outline of the search block structures
|
||||
* The entire block follows the cursor
|
||||
*/
|
||||
BLOCK_SELECTOR* block = &panel->GetScreen()->m_BlockLocate;;
|
||||
|
||||
BASE_SCREEN* screen = panel->GetScreen();
|
||||
SCH_ITEM* schitem;
|
||||
|
||||
/* Effacement ancien cadre */
|
||||
/* Erase old block contents. */
|
||||
if( erase )
|
||||
{
|
||||
block->Draw( panel, DC, block->m_MoveVector, g_XorMode, block->m_Color );
|
||||
@ -489,8 +500,7 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC,
|
||||
}
|
||||
}
|
||||
|
||||
/* Redessin nouvel affichage */
|
||||
|
||||
/* Repaint new view. */
|
||||
block->m_MoveVector = screen->m_Curseur - block->m_BlockLastCursorPosition;
|
||||
|
||||
block->Draw( panel, DC, block->m_MoveVector, g_XorMode, block->m_Color );
|
||||
@ -505,22 +515,24 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC,
|
||||
|
||||
/*****************************************************************/
|
||||
void SaveStructListForPaste( PICKED_ITEMS_LIST& aItemsList )
|
||||
{
|
||||
/*****************************************************************/
|
||||
|
||||
/* Routine to Save an object from global drawing object list.
|
||||
* This routine is the same as delete but:
|
||||
* - the original list is NOT removed.
|
||||
* - List is saved in g_BlockSaveDataList
|
||||
*/
|
||||
{
|
||||
g_BlockSaveDataList.ClearListAndDeleteItems(); // delete previous saved list, if exists
|
||||
g_BlockSaveDataList.ClearListAndDeleteItems(); // delete previous
|
||||
// saved list, if
|
||||
// exists
|
||||
|
||||
/* save the new list: */
|
||||
ITEM_PICKER item;
|
||||
for( unsigned ii = 0; ii < aItemsList.GetCount(); ii++ )
|
||||
{
|
||||
/* Make a copy of the original picked item. */
|
||||
SCH_ITEM* DrawStructCopy = DuplicateStruct( (SCH_ITEM*) aItemsList.GetPickedItem( ii ) );
|
||||
SCH_ITEM* DrawStructCopy = DuplicateStruct(
|
||||
(SCH_ITEM*) aItemsList.GetPickedItem( ii ) );
|
||||
DrawStructCopy->SetParent( NULL );
|
||||
item.m_PickedItem = DrawStructCopy;
|
||||
g_BlockSaveDataList.PushItem( item );
|
||||
@ -545,10 +557,12 @@ void WinEDA_SchematicFrame::PasteListOfItems( wxDC* DC )
|
||||
PICKED_ITEMS_LIST picklist;
|
||||
|
||||
// Creates data, and push it as new data in undo item list buffer
|
||||
ITEM_PICKER picker( NULL, UR_NEW );
|
||||
ITEM_PICKER picker( NULL, UR_NEW );
|
||||
for( unsigned ii = 0; ii < g_BlockSaveDataList.GetCount(); ii++ )
|
||||
{
|
||||
Struct = DuplicateStruct( (SCH_ITEM*) g_BlockSaveDataList.m_ItemsSelection.GetPickedItem( ii ) );
|
||||
Struct = DuplicateStruct(
|
||||
(SCH_ITEM*) g_BlockSaveDataList.m_ItemsSelection.GetPickedItem(
|
||||
ii ) );
|
||||
picker.m_PickedItem = Struct;
|
||||
picklist.PushItem( picker );
|
||||
|
||||
@ -569,7 +583,9 @@ void WinEDA_SchematicFrame::PasteListOfItems( wxDC* DC )
|
||||
MoveItemsInList( picklist, GetScreen()->m_BlockLocate.m_MoveVector );
|
||||
|
||||
/* clear .m_Flags member for all items */
|
||||
for( Struct = GetScreen()->EEDrawList; Struct != NULL; Struct = Struct->Next() )
|
||||
for( Struct = GetScreen()->EEDrawList;
|
||||
Struct != NULL;
|
||||
Struct = Struct->Next() )
|
||||
Struct->m_Flags = 0;
|
||||
|
||||
GetScreen()->SetModify();
|
||||
@ -580,13 +596,12 @@ void WinEDA_SchematicFrame::PasteListOfItems( wxDC* DC )
|
||||
|
||||
/****************************************************/
|
||||
static void CollectStructsToDrag( SCH_SCREEN* screen )
|
||||
/****************************************************/
|
||||
|
||||
/* creates the list of items found when a drag block is initiated.
|
||||
* items are those selected in window block an some items outside this area but connected
|
||||
* to a selected item (connected wires to a component or an entry )
|
||||
*/
|
||||
{
|
||||
/****************************************************/
|
||||
/* creates the list of items found when a drag block is initiated.
|
||||
* items are those selected in window block an some items outside this area but
|
||||
* connected to a selected item (connected wires to a component or an entry )
|
||||
*/
|
||||
SCH_ITEM* Struct;
|
||||
EDA_DrawLineStruct* SegmStruct;
|
||||
|
||||
@ -601,14 +616,16 @@ static void CollectStructsToDrag( SCH_SCREEN* screen )
|
||||
for( Struct = screen->EEDrawList; Struct != NULL; Struct = Struct->Next() )
|
||||
Struct->m_Flags = 0;
|
||||
|
||||
// Sel .m_Flags to selected for a wire or bus in selected area if there is only one item:
|
||||
// Sel .m_Flags to selected for a wire or bus in selected area if there is
|
||||
// only one item:
|
||||
if( pickedlist->GetCount() == 1 )
|
||||
{
|
||||
Struct = (SCH_ITEM*) pickedlist->GetPickedItem( 0 );
|
||||
if( Struct->Type() == DRAW_SEGMENT_STRUCT_TYPE )
|
||||
Struct->m_Flags = SELECTED;
|
||||
}
|
||||
// Sel .m_Flags to selected for a wire or bus in selected area for a list of items:
|
||||
// Sel .m_Flags to selected for a wire or bus in selected area for a list
|
||||
// of items:
|
||||
else
|
||||
{
|
||||
for( unsigned ii = 0; ii < pickedlist->GetCount(); ii++ )
|
||||
@ -622,41 +639,40 @@ static void CollectStructsToDrag( SCH_SCREEN* screen )
|
||||
return;
|
||||
|
||||
|
||||
/* Suppression du deplacement des extremites de segments hors cadre
|
||||
* de selection */
|
||||
/* Remove the displacement of segment and undo the selection. */
|
||||
for( unsigned ii = 0; ii < pickedlist->GetCount(); ii++ )
|
||||
{
|
||||
Struct = (SCH_ITEM*)(SCH_ITEM*) pickedlist->GetPickedItem( ii );
|
||||
Struct = (SCH_ITEM*) (SCH_ITEM*) pickedlist->GetPickedItem( ii );
|
||||
if( Struct->Type() == DRAW_SEGMENT_STRUCT_TYPE )
|
||||
{
|
||||
SegmStruct = (EDA_DrawLineStruct*) Struct;
|
||||
if( ! screen->m_BlockLocate.Inside(SegmStruct->m_Start) )
|
||||
if( !screen->m_BlockLocate.Inside( SegmStruct->m_Start ) )
|
||||
SegmStruct->m_Flags |= STARTPOINT;
|
||||
|
||||
if( ! screen->m_BlockLocate.Inside(SegmStruct->m_End) )
|
||||
if( !screen->m_BlockLocate.Inside( SegmStruct->m_End ) )
|
||||
SegmStruct->m_Flags |= ENDPOINT;
|
||||
|
||||
// Save m_Flags for Undo/redo drag operations:
|
||||
pickedlist->SetPickerFlags(SegmStruct->m_Flags, ii);
|
||||
|
||||
pickedlist->SetPickerFlags( SegmStruct->m_Flags, ii );
|
||||
}
|
||||
}
|
||||
|
||||
/* Search for other items to drag. They are end wires connected to selected items
|
||||
/* Search for other items to drag. They are end wires connected to selected
|
||||
* items
|
||||
*/
|
||||
|
||||
for( unsigned ii = 0; ii < pickedlist->GetCount(); ii++ )
|
||||
{
|
||||
Struct = (SCH_ITEM*)(SCH_ITEM*) pickedlist->GetPickedItem( ii );
|
||||
Struct = (SCH_ITEM*) (SCH_ITEM*) pickedlist->GetPickedItem( ii );
|
||||
if( Struct->Type() == TYPE_SCH_COMPONENT )
|
||||
{
|
||||
// Add all pins of the selected component to list
|
||||
LIB_PIN* pin;
|
||||
wxPoint pos;
|
||||
wxPoint pos;
|
||||
pin = GetNextPinPosition( (SCH_COMPONENT*) Struct, pos, true );
|
||||
while( pin )
|
||||
{
|
||||
if( ! screen->m_BlockLocate.Inside(pos) )
|
||||
if( !screen->m_BlockLocate.Inside( pos ) )
|
||||
{
|
||||
// This pin is outside area,
|
||||
// but because it it the pin of a selected component
|
||||
@ -693,17 +709,17 @@ static void CollectStructsToDrag( SCH_SCREEN* screen )
|
||||
|
||||
/******************************************************************/
|
||||
static void AddPickedItem( SCH_SCREEN* screen, wxPoint position )
|
||||
{
|
||||
/******************************************************************/
|
||||
|
||||
/** AddPickedItem
|
||||
* add to the picked list in screen->m_BlockLocate items found at location position
|
||||
* add to the picked list in screen->m_BlockLocate items found at location
|
||||
* position
|
||||
* @param screen = the screen to consider
|
||||
* @param position = the wxPoint where items must be located to be select
|
||||
*/
|
||||
{
|
||||
SCH_ITEM* Struct;
|
||||
|
||||
/* Examen de la liste des elements deja selectionnes */
|
||||
/* Review the list of already selected elements. */
|
||||
PICKED_ITEMS_LIST* pickedlist = &screen->m_BlockLocate.m_ItemsSelection;
|
||||
|
||||
for( unsigned ii = 0; ii < pickedlist->GetCount(); ii++ )
|
||||
@ -722,7 +738,7 @@ static void AddPickedItem( SCH_SCREEN* screen, wxPoint position )
|
||||
STRUCT->m_Flags &= ~ENDPOINT;
|
||||
|
||||
// Save m_Flags for Undo/redo drag operations:
|
||||
pickedlist->SetPickerFlags(STRUCT->m_Flags, ii);
|
||||
pickedlist->SetPickerFlags( STRUCT->m_Flags, ii );
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -730,13 +746,13 @@ static void AddPickedItem( SCH_SCREEN* screen, wxPoint position )
|
||||
}
|
||||
}
|
||||
|
||||
/* Examen de la liste des elements non selectionnes */
|
||||
/* Review the list of elements not selected. */
|
||||
|
||||
ITEM_PICKER picker;
|
||||
Struct = screen->EEDrawList;
|
||||
while( Struct )
|
||||
{
|
||||
picker.m_PickedItem = Struct;
|
||||
picker.m_PickedItem = Struct;
|
||||
picker.m_PickedItemType = Struct->Type();
|
||||
switch( Struct->Type() )
|
||||
{
|
||||
@ -745,14 +761,14 @@ static void AddPickedItem( SCH_SCREEN* screen, wxPoint position )
|
||||
|
||||
case DRAW_POLYLINE_STRUCT_TYPE:
|
||||
if( Struct->m_Flags & SELECTED )
|
||||
break; /* Deja en liste */
|
||||
break;
|
||||
break;
|
||||
|
||||
case DRAW_JUNCTION_STRUCT_TYPE:
|
||||
#undef STRUCT
|
||||
#define STRUCT ( (DrawJunctionStruct*) Struct )
|
||||
if( Struct->m_Flags & SELECTED )
|
||||
break; /* Deja en liste */
|
||||
break;
|
||||
if( STRUCT->m_Pos != position )
|
||||
break;
|
||||
pickedlist->PushItem( picker );
|
||||
@ -762,21 +778,23 @@ static void AddPickedItem( SCH_SCREEN* screen, wxPoint position )
|
||||
#undef STRUCT
|
||||
#define STRUCT ( (EDA_DrawLineStruct*) Struct )
|
||||
if( Struct->m_Flags & SELECTED )
|
||||
break; /* Deja en liste */
|
||||
break;
|
||||
if( STRUCT->m_Start == position )
|
||||
{
|
||||
Struct->m_Flags = SELECTED | ENDPOINT | STARTPOINT;
|
||||
Struct->m_Flags &= ~STARTPOINT;
|
||||
|
||||
// Save m_Flags for Undo/redo drag operations:
|
||||
picker.m_PickerFlags= Struct->m_Flags;
|
||||
picker.m_PickerFlags = Struct->m_Flags;
|
||||
pickedlist->PushItem( picker );
|
||||
}
|
||||
else if( STRUCT->m_End == position )
|
||||
{
|
||||
Struct->m_Flags = SELECTED | ENDPOINT | STARTPOINT;
|
||||
Struct->m_Flags &= ~ENDPOINT;
|
||||
|
||||
// Save m_Flags for Undo/redo drag operations:
|
||||
picker.m_PickerFlags= Struct->m_Flags;
|
||||
picker.m_PickerFlags = Struct->m_Flags;
|
||||
pickedlist->PushItem( picker );
|
||||
}
|
||||
break;
|
||||
@ -791,7 +809,7 @@ static void AddPickedItem( SCH_SCREEN* screen, wxPoint position )
|
||||
#undef STRUCT
|
||||
#define STRUCT ( (SCH_LABEL*) Struct )
|
||||
if( Struct->m_Flags & SELECTED )
|
||||
break; /* Already in list */
|
||||
break; /* Already in list */
|
||||
if( STRUCT->m_Pos != position )
|
||||
break;
|
||||
Struct->m_Flags |= SELECTED;
|
||||
@ -803,7 +821,7 @@ static void AddPickedItem( SCH_SCREEN* screen, wxPoint position )
|
||||
#undef STRUCT
|
||||
#define STRUCT ( (SCH_LABEL*) Struct )
|
||||
if( Struct->m_Flags & SELECTED )
|
||||
break; /* Already in list */
|
||||
break; /* Already in list */
|
||||
if( STRUCT->m_Pos != position )
|
||||
break;
|
||||
Struct->m_Flags |= SELECTED;
|
||||
@ -819,7 +837,7 @@ static void AddPickedItem( SCH_SCREEN* screen, wxPoint position )
|
||||
#undef STRUCT
|
||||
#define STRUCT ( (MARKER_SCH*) Struct )
|
||||
if( Struct->m_Flags & SELECTED )
|
||||
break; /* Already in list */
|
||||
break; /* Already in list */
|
||||
if( STRUCT->m_Pos != position )
|
||||
break;
|
||||
Struct->m_Flags |= SELECTED;
|
||||
@ -830,7 +848,7 @@ static void AddPickedItem( SCH_SCREEN* screen, wxPoint position )
|
||||
#undef STRUCT
|
||||
#define STRUCT ( (DrawNoConnectStruct*) Struct )
|
||||
if( Struct->m_Flags & SELECTED )
|
||||
break; /* Already in list */
|
||||
break; /* Already in list */
|
||||
if( STRUCT->m_Pos != position )
|
||||
break;
|
||||
Struct->m_Flags |= SELECTED;
|
||||
@ -845,20 +863,20 @@ static void AddPickedItem( SCH_SCREEN* screen, wxPoint position )
|
||||
}
|
||||
|
||||
|
||||
/*********************************************************************************/
|
||||
/****************************************************************************/
|
||||
static LIB_PIN* GetNextPinPosition( SCH_COMPONENT* aDrawLibItem,
|
||||
wxPoint& aPosition,
|
||||
bool aSearchFirst)
|
||||
/*********************************************************************************/
|
||||
|
||||
wxPoint& aPosition,
|
||||
bool aSearchFirst )
|
||||
{
|
||||
/****************************************************************************/
|
||||
/** GetNextPinPosition()
|
||||
* calculate position of the "next" pin of the aDrawLibItem component
|
||||
* @param aDrawLibItem = component to test.
|
||||
* @param aPosition = the calculated pin position, according to the component orientation and position
|
||||
* @param aPosition = the calculated pin position, according to the component
|
||||
* orientation and position
|
||||
* @param aSearchFirst = if true, search for the first pin
|
||||
* @return a pointer to the pin
|
||||
*/
|
||||
{
|
||||
static LIB_COMPONENT* Entry;
|
||||
static int Multi, convert, TransMat[2][2];
|
||||
static wxPoint CmpPosition;
|
||||
@ -871,8 +889,8 @@ static LIB_PIN* GetNextPinPosition( SCH_COMPONENT* aDrawLibItem,
|
||||
if( Entry == NULL )
|
||||
return NULL;
|
||||
|
||||
Pin = Entry->GetNextPin();
|
||||
Multi = aDrawLibItem->m_Multi;
|
||||
Pin = Entry->GetNextPin();
|
||||
Multi = aDrawLibItem->m_Multi;
|
||||
convert = aDrawLibItem->m_Convert;
|
||||
CmpPosition = aDrawLibItem->m_Pos;
|
||||
memcpy( TransMat, aDrawLibItem->m_Transform, sizeof(TransMat) );
|
||||
@ -890,9 +908,11 @@ static LIB_PIN* GetNextPinPosition( SCH_COMPONENT* aDrawLibItem,
|
||||
if( convert && Pin->m_Convert && ( Pin->m_Convert != convert ) )
|
||||
continue;
|
||||
|
||||
/* Calculate the pin position (according to the component orientation) */
|
||||
/* Calculate the pin position (according to the component orientation)
|
||||
**/
|
||||
aPosition = TransformCoordinate( TransMat, Pin->m_Pos ) + CmpPosition;
|
||||
return Pin;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
/****************************************************/
|
||||
/* block_libedit.cpp */
|
||||
/* Gestion des Operations sur Blocks et Effacements */
|
||||
/* block_libedit.cpp */
|
||||
/****************************************************/
|
||||
|
||||
#include "fctsys.h"
|
||||
@ -191,10 +190,10 @@ int WinEDA_LibeditFrame::HandleBlockEnd( wxDC* DC )
|
||||
|
||||
|
||||
/*
|
||||
* Routine to handle the BLOCK PLACE commande
|
||||
* Routine to handle the BLOCK PLACE command
|
||||
* Last routine for block operation for:
|
||||
* - block move & drag
|
||||
* - block copie & paste
|
||||
* - block copy & paste
|
||||
*/
|
||||
void WinEDA_LibeditFrame::HandleBlockPlace( wxDC* DC )
|
||||
{
|
||||
@ -238,7 +237,7 @@ void WinEDA_LibeditFrame::HandleBlockPlace( wxDC* DC )
|
||||
m_component->CopySelectedItems( pt );
|
||||
break;
|
||||
|
||||
case BLOCK_PASTE: /* Paste (recopie du dernier bloc sauve */
|
||||
case BLOCK_PASTE: /* Paste (recopy the last block saved) */
|
||||
GetScreen()->m_BlockLocate.ClearItemsList();
|
||||
break;
|
||||
|
||||
@ -276,8 +275,8 @@ void WinEDA_LibeditFrame::HandleBlockPlace( wxDC* DC )
|
||||
|
||||
|
||||
/*
|
||||
* Retrace le contour du block de recherche de structures
|
||||
* L'ensemble du block suit le curseur
|
||||
* Traces the outline of the search block structures
|
||||
* The entire block follows the cursor
|
||||
*/
|
||||
void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
|
||||
{
|
||||
@ -307,7 +306,7 @@ void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
|
||||
true, true, true );
|
||||
}
|
||||
|
||||
/* Redessin nouvel affichage */
|
||||
/* Repaint new view */
|
||||
PtBlock->m_MoveVector.x =
|
||||
screen->m_Curseur.x - PtBlock->m_BlockLastCursorPosition.x;
|
||||
PtBlock->m_MoveVector.y =
|
||||
|
@ -1,8 +1,9 @@
|
||||
// Name: build_BOM.cpp
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// Name: build_BOM.cpp
|
||||
// Purpose:
|
||||
// Author: jean-pierre Charras
|
||||
// Licence: GPL license
|
||||
// Author: jean-pierre Charras
|
||||
// License: GPL license
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <algorithm> // to use sort vector
|
||||
@ -37,8 +38,7 @@ public:
|
||||
//have to store it here since the object references will be duplicated.
|
||||
DrawSheetPath m_SheetPath; //composed of UIDs
|
||||
|
||||
public:
|
||||
LABEL_OBJECT()
|
||||
public: LABEL_OBJECT()
|
||||
{
|
||||
m_Label = NULL;
|
||||
m_LabelType = 0;
|
||||
@ -52,12 +52,17 @@ static const wxString BomFileExtension( wxT( "lst" ) );
|
||||
|
||||
|
||||
/* Local functions */
|
||||
static void BuildComponentsListFromSchematic( std::vector <OBJ_CMP_TO_LIST>& aList );
|
||||
static void BuildComponentsListFromSchematic(
|
||||
std::vector <OBJ_CMP_TO_LIST>& aList );
|
||||
static void GenListeGLabels( std::vector <LABEL_OBJECT>& aList );
|
||||
static bool SortComponentsByReference( const OBJ_CMP_TO_LIST& obj1, const OBJ_CMP_TO_LIST& obj2 );
|
||||
static bool SortComponentsByValue( const OBJ_CMP_TO_LIST& obj1, const OBJ_CMP_TO_LIST& obj2 );
|
||||
static bool SortLabelsByValue( const LABEL_OBJECT& obj1, const LABEL_OBJECT& obj2 );
|
||||
static bool SortLabelsBySheet( const LABEL_OBJECT& obj1, const LABEL_OBJECT& obj2 );
|
||||
static bool SortComponentsByReference( const OBJ_CMP_TO_LIST& obj1,
|
||||
const OBJ_CMP_TO_LIST& obj2 );
|
||||
static bool SortComponentsByValue( const OBJ_CMP_TO_LIST& obj1,
|
||||
const OBJ_CMP_TO_LIST& obj2 );
|
||||
static bool SortLabelsByValue( const LABEL_OBJECT& obj1,
|
||||
const LABEL_OBJECT& obj2 );
|
||||
static bool SortLabelsBySheet( const LABEL_OBJECT& obj1,
|
||||
const LABEL_OBJECT& obj2 );
|
||||
static void DeleteSubCmp( std::vector <OBJ_CMP_TO_LIST>& aList );
|
||||
|
||||
static int PrintListeGLabel( FILE* f, std::vector <LABEL_OBJECT>& aList );
|
||||
@ -79,8 +84,8 @@ void DIALOG_BUILD_BOM::Create_BOM_Lists( bool aTypeFileIsExport,
|
||||
bool aIncludeSubComponents,
|
||||
char aExportSeparatorSymbol,
|
||||
bool aRunBrowser )
|
||||
/**************************************************************************/
|
||||
{
|
||||
/**************************************************************************/
|
||||
wxFileName fn;
|
||||
|
||||
s_ExportSeparatorSymbol = aExportSeparatorSymbol;
|
||||
@ -120,18 +125,16 @@ void DIALOG_BUILD_BOM::Create_BOM_Lists( bool aTypeFileIsExport,
|
||||
/****************************************************************************/
|
||||
void DIALOG_BUILD_BOM::CreateExportList( const wxString& aFullFileName,
|
||||
bool aIncludeSubComponents )
|
||||
{
|
||||
/****************************************************************************/
|
||||
|
||||
/*
|
||||
* Print a list of components, in a form which can be imported by a spreadsheet
|
||||
* form is:
|
||||
* cmp name; cmp val; fields;
|
||||
*/
|
||||
{
|
||||
FILE* f;
|
||||
wxString msg;
|
||||
|
||||
/* Creation de la liste des elements */
|
||||
if( ( f = wxFopen( aFullFileName, wxT( "wt" ) ) ) == NULL )
|
||||
{
|
||||
msg = _( "Failed to open file " );
|
||||
@ -157,15 +160,16 @@ void DIALOG_BUILD_BOM::CreateExportList( const wxString& aFullFileName,
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
void DIALOG_BUILD_BOM::GenereListeOfItems( const wxString& aFullFileName,
|
||||
bool aIncludeSubComponents )
|
||||
void DIALOG_BUILD_BOM::GenereListeOfItems(
|
||||
const wxString& aFullFileName,
|
||||
bool
|
||||
aIncludeSubComponents )
|
||||
{
|
||||
/****************************************************************************/
|
||||
|
||||
/** GenereListeOfItems()
|
||||
* Main function to create the list of components and/or labels
|
||||
* (global labels and pin sheets" )
|
||||
*/
|
||||
{
|
||||
FILE* f;
|
||||
int itemCount;
|
||||
char Line[1024];
|
||||
@ -217,8 +221,8 @@ void DIALOG_BUILD_BOM::GenereListeOfItems( const wxString& aFullFileName,
|
||||
if( m_GenListLabelsbySheet->GetValue() )
|
||||
{
|
||||
sort( listOfLabels.begin(), listOfLabels.end(), SortLabelsBySheet );
|
||||
msg.Printf( _(
|
||||
"\n#Global, Hierarchical Labels and PinSheets ( order = Sheet Number ) count = %d\n" ),
|
||||
msg.Printf( _( "\n#Global, Hierarchical Labels and PinSheets \
|
||||
( order = Sheet Number ) count = %d\n" ),
|
||||
itemCount );
|
||||
fprintf( f, "%s", CONV_TO_UTF8( msg ) );
|
||||
PrintListeGLabel( f, listOfLabels );
|
||||
@ -228,8 +232,8 @@ void DIALOG_BUILD_BOM::GenereListeOfItems( const wxString& aFullFileName,
|
||||
{
|
||||
sort( listOfLabels.begin(), listOfLabels.end(), SortLabelsByValue );
|
||||
|
||||
msg.Printf( _(
|
||||
"\n#Global, Hierarchical Labels and PinSheets ( order = Alphab. ) count = %d\n\n" ),
|
||||
msg.Printf( _( "\n#Global, Hierarchical Labels and PinSheets ( \
|
||||
order = Alphab. ) count = %d\n\n" ),
|
||||
itemCount );
|
||||
fprintf( f, "%s", CONV_TO_UTF8( msg ) );
|
||||
PrintListeGLabel( f, listOfLabels );
|
||||
@ -244,16 +248,15 @@ void DIALOG_BUILD_BOM::GenereListeOfItems( const wxString& aFullFileName,
|
||||
|
||||
/***************************************************************************/
|
||||
void BuildComponentsListFromSchematic( std::vector <OBJ_CMP_TO_LIST>& aList )
|
||||
{
|
||||
/***************************************************************************/
|
||||
|
||||
/* Creates the list of components found in the whole schematic
|
||||
*
|
||||
* if List == null, just returns the count. if not, fills the list.
|
||||
* goes through the sheets, not the screens, so that we account for
|
||||
* multiple instances of a given screen.
|
||||
* Also Initialise m_Father as pointerof the SCH_SCREN parent
|
||||
* Also Initialize m_Father as pointer of the SCH_SCREEN parent
|
||||
*/
|
||||
{
|
||||
EDA_BaseStruct* SchItem;
|
||||
SCH_COMPONENT* DrawLibItem;
|
||||
DrawSheetPath* sheet;
|
||||
@ -261,9 +264,12 @@ void BuildComponentsListFromSchematic( std::vector <OBJ_CMP_TO_LIST>& aList )
|
||||
/* Build the sheet (not screen) list */
|
||||
EDA_SheetList SheetList;
|
||||
|
||||
for( sheet = SheetList.GetFirst(); sheet != NULL; sheet = SheetList.GetNext() )
|
||||
for( sheet = SheetList.GetFirst();
|
||||
sheet != NULL;
|
||||
sheet = SheetList.GetNext() )
|
||||
{
|
||||
for( SchItem = sheet->LastDrawList(); SchItem; SchItem = SchItem->Next() )
|
||||
for( SchItem = sheet->LastDrawList(); SchItem;
|
||||
SchItem = SchItem->Next() )
|
||||
{
|
||||
if( SchItem->Type() != TYPE_SCH_COMPONENT )
|
||||
continue;
|
||||
@ -279,7 +285,7 @@ void BuildComponentsListFromSchematic( std::vector <OBJ_CMP_TO_LIST>& aList )
|
||||
CONV_TO_UTF8( DrawLibItem->GetRef( sheet ) ),
|
||||
sizeof( item.m_Reference ) );
|
||||
|
||||
// Ensure always nul terminate m_Ref.
|
||||
// Ensure always null terminate m_Ref.
|
||||
item.m_Reference[sizeof( item.m_Reference ) - 1 ] = 0;
|
||||
aList.push_back( item );
|
||||
}
|
||||
@ -289,11 +295,10 @@ void BuildComponentsListFromSchematic( std::vector <OBJ_CMP_TO_LIST>& aList )
|
||||
|
||||
/****************************************************************/
|
||||
static void GenListeGLabels( std::vector <LABEL_OBJECT>& aList )
|
||||
{
|
||||
/****************************************************************/
|
||||
|
||||
/* Fill aList with Glabel info
|
||||
*/
|
||||
{
|
||||
SCH_ITEM* DrawList;
|
||||
Hierarchical_PIN_Sheet_Struct* PinLabel;
|
||||
DrawSheetPath* sheet;
|
||||
@ -303,7 +308,9 @@ static void GenListeGLabels( std::vector <LABEL_OBJECT>& aList )
|
||||
|
||||
LABEL_OBJECT labet_object;
|
||||
|
||||
for( sheet = SheetList.GetFirst(); sheet != NULL; sheet = SheetList.GetNext() )
|
||||
for( sheet = SheetList.GetFirst();
|
||||
sheet != NULL;
|
||||
sheet = SheetList.GetNext() )
|
||||
{
|
||||
DrawList = (SCH_ITEM*) sheet->LastDrawList();
|
||||
while( DrawList )
|
||||
@ -323,7 +330,8 @@ static void GenListeGLabels( std::vector <LABEL_OBJECT>& aList )
|
||||
PinLabel = ( (DrawSheetStruct*) DrawList )->m_Label;
|
||||
while( PinLabel != NULL )
|
||||
{
|
||||
labet_object.m_LabelType = DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE;
|
||||
labet_object.m_LabelType =
|
||||
DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE;
|
||||
labet_object.m_SheetPath = *sheet;
|
||||
labet_object.m_Label = PinLabel;
|
||||
aList.push_back( labet_object );
|
||||
@ -342,17 +350,17 @@ static void GenListeGLabels( std::vector <LABEL_OBJECT>& aList )
|
||||
}
|
||||
|
||||
|
||||
/************************************************************************************/
|
||||
bool SortComponentsByValue( const OBJ_CMP_TO_LIST& obj1, const OBJ_CMP_TO_LIST& obj2 )
|
||||
/************************************************************************************/
|
||||
|
||||
/* Compare fuinction for sort()
|
||||
/*****************************************************************************/
|
||||
bool SortComponentsByValue( const OBJ_CMP_TO_LIST& obj1,
|
||||
const OBJ_CMP_TO_LIST& obj2 )
|
||||
{
|
||||
/*****************************************************************************/
|
||||
/* Compare function for sort()
|
||||
* components are sorted
|
||||
* by value
|
||||
* if same value: by reference
|
||||
* if same reference: by unit number
|
||||
*/
|
||||
{
|
||||
int ii;
|
||||
const wxString* Text1, * Text2;
|
||||
|
||||
@ -374,17 +382,17 @@ bool SortComponentsByValue( const OBJ_CMP_TO_LIST& obj1, const OBJ_CMP_TO_LIST&
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************************************/
|
||||
bool SortComponentsByReference( const OBJ_CMP_TO_LIST& obj1, const OBJ_CMP_TO_LIST& obj2 )
|
||||
/***************************************************************************************/
|
||||
|
||||
/*****************************************************************************/
|
||||
bool SortComponentsByReference( const OBJ_CMP_TO_LIST& obj1,
|
||||
const OBJ_CMP_TO_LIST& obj2 )
|
||||
{
|
||||
/*****************************************************************************/
|
||||
/* compare function for sorting
|
||||
* components are sorted
|
||||
* by reference
|
||||
* if same reference: by value
|
||||
* if same value: by unit number
|
||||
*/
|
||||
{
|
||||
int ii;
|
||||
const wxString* Text1, * Text2;
|
||||
|
||||
@ -408,26 +416,25 @@ bool SortComponentsByReference( const OBJ_CMP_TO_LIST& obj1, const OBJ_CMP_TO_LI
|
||||
|
||||
/******************************************************************/
|
||||
bool SortLabelsByValue( const LABEL_OBJECT& obj1, const LABEL_OBJECT& obj2 )
|
||||
{
|
||||
/*******************************************************************/
|
||||
|
||||
/* compare function for sorting labels
|
||||
* sort by
|
||||
* value
|
||||
* if same value: by sheet
|
||||
*/
|
||||
{
|
||||
int ii;
|
||||
wxString* Text1, * Text2;
|
||||
|
||||
if( obj1.m_LabelType == DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE )
|
||||
Text1 = &( (Hierarchical_PIN_Sheet_Struct*)(obj1.m_Label) )->m_Text;
|
||||
Text1 = &( (Hierarchical_PIN_Sheet_Struct*) (obj1.m_Label) )->m_Text;
|
||||
else
|
||||
Text1 = &( (SCH_TEXT*)(obj1.m_Label) )->m_Text;
|
||||
Text1 = &( (SCH_TEXT*) (obj1.m_Label) )->m_Text;
|
||||
|
||||
if( obj2.m_LabelType == DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE )
|
||||
Text2 = &( (Hierarchical_PIN_Sheet_Struct*)(obj2.m_Label) )->m_Text;
|
||||
Text2 = &( (Hierarchical_PIN_Sheet_Struct*) (obj2.m_Label) )->m_Text;
|
||||
else
|
||||
Text2 = &( (SCH_TEXT*)(obj2.m_Label) )->m_Text;
|
||||
Text2 = &( (SCH_TEXT*) (obj2.m_Label) )->m_Text;
|
||||
|
||||
ii = Text1->CmpNoCase( *Text2 );
|
||||
|
||||
@ -440,15 +447,14 @@ bool SortLabelsByValue( const LABEL_OBJECT& obj1, const LABEL_OBJECT& obj2 )
|
||||
}
|
||||
|
||||
|
||||
/*************************************************************************************/
|
||||
/*****************************************************************************/
|
||||
bool SortLabelsBySheet( const LABEL_OBJECT& obj1, const LABEL_OBJECT& obj2 )
|
||||
/*************************************************************************************/
|
||||
|
||||
{
|
||||
/*****************************************************************************/
|
||||
/* compare function for sorting labels
|
||||
* by sheet
|
||||
* in a sheet, by alphabetic order
|
||||
*/
|
||||
{
|
||||
int ii;
|
||||
wxString Text1, Text2;
|
||||
|
||||
@ -476,12 +482,12 @@ bool SortLabelsBySheet( const LABEL_OBJECT& obj1, const LABEL_OBJECT& obj2 )
|
||||
|
||||
/**************************************************************/
|
||||
static void DeleteSubCmp( std::vector <OBJ_CMP_TO_LIST>& aList )
|
||||
{
|
||||
/**************************************************************/
|
||||
|
||||
/* Remove sub components from the list, when multiples parts per package are found in this list
|
||||
/* Remove sub components from the list, when multiples parts per package are
|
||||
* found in this list
|
||||
* The component list **MUST** be sorted by reference and by unit number
|
||||
*/
|
||||
{
|
||||
SCH_COMPONENT* libItem;
|
||||
wxString oldName;
|
||||
wxString currName;
|
||||
@ -497,7 +503,8 @@ static void DeleteSubCmp( std::vector <OBJ_CMP_TO_LIST>& aList )
|
||||
|
||||
if( !oldName.IsEmpty() )
|
||||
{
|
||||
if( oldName == currName ) // currName is a subpart of oldName: remove it
|
||||
if( oldName == currName ) // currName is a subpart of oldName:
|
||||
// remove it
|
||||
{
|
||||
aList.erase( aList.begin() + ii );
|
||||
ii--;
|
||||
@ -508,13 +515,14 @@ static void DeleteSubCmp( std::vector <OBJ_CMP_TO_LIST>& aList )
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************************/
|
||||
/****************************************************************************/
|
||||
void DIALOG_BUILD_BOM::PrintFieldData( FILE* f, SCH_COMPONENT* DrawLibItem,
|
||||
bool CompactForm )
|
||||
/*******************************************************************************************/
|
||||
{
|
||||
/****************************************************************************/
|
||||
// @todo make this variable length
|
||||
const wxCheckBox* FieldListCtrl[] = {
|
||||
const wxCheckBox* FieldListCtrl[] =
|
||||
{
|
||||
m_AddField1,
|
||||
m_AddField2,
|
||||
m_AddField3,
|
||||
@ -526,17 +534,18 @@ void DIALOG_BUILD_BOM::PrintFieldData( FILE* f, SCH_COMPONENT* DrawLibItem,
|
||||
};
|
||||
|
||||
int ii;
|
||||
const wxCheckBox* FieldCtrl = FieldListCtrl[0];
|
||||
const wxCheckBox* FieldCtrl = FieldListCtrl[0];
|
||||
|
||||
if( m_AddFootprintField->IsChecked() )
|
||||
{
|
||||
if( CompactForm )
|
||||
{
|
||||
fprintf( f, "%c%s", s_ExportSeparatorSymbol,
|
||||
CONV_TO_UTF8( DrawLibItem->GetField( FOOTPRINT )->m_Text ) );
|
||||
CONV_TO_UTF8( DrawLibItem->GetField( FOOTPRINT )->m_Text ) );
|
||||
}
|
||||
else
|
||||
fprintf( f, "; %-12s", CONV_TO_UTF8( DrawLibItem->GetField( FOOTPRINT )->m_Text ) );
|
||||
fprintf( f, "; %-12s",
|
||||
CONV_TO_UTF8( DrawLibItem->GetField( FOOTPRINT )->m_Text ) );
|
||||
}
|
||||
|
||||
for( ii = FIELD1; ii < DrawLibItem->GetFieldCount(); ii++ )
|
||||
@ -557,24 +566,24 @@ void DIALOG_BUILD_BOM::PrintFieldData( FILE* f, SCH_COMPONENT* DrawLibItem,
|
||||
|
||||
if( CompactForm )
|
||||
fprintf( f, "%c%s", s_ExportSeparatorSymbol,
|
||||
CONV_TO_UTF8( DrawLibItem->GetField( ii )->m_Text ) );
|
||||
CONV_TO_UTF8( DrawLibItem->GetField( ii )->m_Text ) );
|
||||
else
|
||||
fprintf( f, "; %-12s", CONV_TO_UTF8( DrawLibItem->GetField( ii )->m_Text ) );
|
||||
fprintf( f, "; %-12s",
|
||||
CONV_TO_UTF8( DrawLibItem->GetField( ii )->m_Text ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*********************************************************************************************/
|
||||
/****************************************************************************/
|
||||
int DIALOG_BUILD_BOM::PrintComponentsListByRef(
|
||||
FILE* f,
|
||||
std::vector <OBJ_CMP_TO_LIST>& aList,
|
||||
bool CompactForm,
|
||||
bool aIncludeSubComponents )
|
||||
/*********************************************************************************************/
|
||||
|
||||
{
|
||||
/****************************************************************************/
|
||||
/* Print the B.O.M sorted by reference
|
||||
*/
|
||||
{
|
||||
int Multi, Unit;
|
||||
EDA_BaseStruct* DrawList;
|
||||
SCH_COMPONENT* DrawLibItem;
|
||||
@ -585,7 +594,8 @@ int DIALOG_BUILD_BOM::PrintComponentsListByRef(
|
||||
if( CompactForm )
|
||||
{
|
||||
// @todo make this variable length
|
||||
const wxCheckBox* FieldListCtrl[FIELD8 - FIELD1 + 1] = {
|
||||
const wxCheckBox* FieldListCtrl[FIELD8 - FIELD1 + 1] =
|
||||
{
|
||||
m_AddField1,
|
||||
m_AddField2,
|
||||
m_AddField3,
|
||||
@ -618,7 +628,8 @@ int DIALOG_BUILD_BOM::PrintComponentsListByRef(
|
||||
continue;
|
||||
|
||||
msg = _( "Field" );
|
||||
fprintf( f, "%c%s%d", s_ExportSeparatorSymbol, CONV_TO_UTF8( msg ), ii - FIELD1 + 1 );
|
||||
fprintf( f, "%c%s%d", s_ExportSeparatorSymbol, CONV_TO_UTF8(
|
||||
msg ), ii - FIELD1 + 1 );
|
||||
}
|
||||
|
||||
fprintf( f, "\n" );
|
||||
@ -653,15 +664,11 @@ int DIALOG_BUILD_BOM::PrintComponentsListByRef(
|
||||
Multi = Entry->GetPartCount();
|
||||
|
||||
if( ( Multi > 1 ) && aIncludeSubComponents )
|
||||
#if defined (KICAD_GOST)
|
||||
|
||||
|
||||
#if defined(KICAD_GOST)
|
||||
|
||||
Unit = aList[ii].m_Unit + '1' - 1;
|
||||
#else
|
||||
|
||||
|
||||
|
||||
Unit = aList[ii].m_Unit + 'A' - 1;
|
||||
#endif
|
||||
|
||||
@ -671,10 +678,10 @@ int DIALOG_BUILD_BOM::PrintComponentsListByRef(
|
||||
|
||||
if( CompactForm )
|
||||
fprintf( f, "%s%c%s", CmpName, s_ExportSeparatorSymbol,
|
||||
CONV_TO_UTF8( DrawLibItem->GetField( VALUE )->m_Text ) );
|
||||
CONV_TO_UTF8( DrawLibItem->GetField( VALUE )->m_Text ) );
|
||||
else
|
||||
fprintf( f, "| %-10s %-12s", CmpName,
|
||||
CONV_TO_UTF8( DrawLibItem->GetField( VALUE )->m_Text ) );
|
||||
CONV_TO_UTF8( DrawLibItem->GetField( VALUE )->m_Text ) );
|
||||
|
||||
if( aIncludeSubComponents )
|
||||
{
|
||||
@ -683,14 +690,17 @@ int DIALOG_BUILD_BOM::PrintComponentsListByRef(
|
||||
{
|
||||
fprintf( f, "%c%s", s_ExportSeparatorSymbol, CONV_TO_UTF8( msg ) );
|
||||
msg = m_Parent->GetXYSheetReferences(
|
||||
(BASE_SCREEN*) DrawLibItem->GetParent(), DrawLibItem->m_Pos );
|
||||
fprintf( f, "%c%s)", s_ExportSeparatorSymbol, CONV_TO_UTF8( msg ) );
|
||||
(BASE_SCREEN*) DrawLibItem->GetParent(),
|
||||
DrawLibItem->m_Pos );
|
||||
fprintf( f, "%c%s)", s_ExportSeparatorSymbol,
|
||||
CONV_TO_UTF8( msg ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf( f, " (Sheet %s)", CONV_TO_UTF8( msg ) );
|
||||
msg = m_Parent->GetXYSheetReferences(
|
||||
(BASE_SCREEN*) DrawLibItem->GetParent(), DrawLibItem->m_Pos );
|
||||
(BASE_SCREEN*) DrawLibItem->GetParent(),
|
||||
DrawLibItem->m_Pos );
|
||||
fprintf( f, " (loc %s)", CONV_TO_UTF8( msg ) );
|
||||
}
|
||||
}
|
||||
@ -709,13 +719,13 @@ int DIALOG_BUILD_BOM::PrintComponentsListByRef(
|
||||
}
|
||||
|
||||
|
||||
/*********************************************************************************************/
|
||||
/*****************************************************************************/
|
||||
int DIALOG_BUILD_BOM::PrintComponentsListByVal(
|
||||
FILE* f,
|
||||
std::vector <OBJ_CMP_TO_LIST>& aList,
|
||||
bool aIncludeSubComponents )
|
||||
/**********************************************************************************************/
|
||||
{
|
||||
/*****************************************************************************/
|
||||
int Multi;
|
||||
wxChar Unit;
|
||||
EDA_BaseStruct* DrawList;
|
||||
@ -764,8 +774,9 @@ int DIALOG_BUILD_BOM::PrintComponentsListByVal(
|
||||
|
||||
sprintf( CmpName, "%s%c", aList[ii].m_Reference, Unit );
|
||||
#endif
|
||||
fprintf( f, "| %-12s %-10s", CONV_TO_UTF8( DrawLibItem->GetField(
|
||||
VALUE )->m_Text ), CmpName );
|
||||
fprintf( f, "| %-12s %-10s",
|
||||
CONV_TO_UTF8( DrawLibItem->GetField( VALUE )->m_Text ),
|
||||
CmpName );
|
||||
|
||||
// print the sheet path
|
||||
if( aIncludeSubComponents )
|
||||
@ -790,8 +801,8 @@ int DIALOG_BUILD_BOM::PrintComponentsListByVal(
|
||||
|
||||
/************************************************************************/
|
||||
static int PrintListeGLabel( FILE* f, std::vector <LABEL_OBJECT>& aList )
|
||||
/************************************************************************/
|
||||
{
|
||||
/************************************************************************/
|
||||
SCH_LABEL* DrawTextItem;
|
||||
Hierarchical_PIN_Sheet_Struct* DrawSheetLabel;
|
||||
wxString msg, sheetpath;
|
||||
@ -803,7 +814,7 @@ static int PrintListeGLabel( FILE* f, std::vector <LABEL_OBJECT>& aList )
|
||||
{
|
||||
case TYPE_SCH_HIERLABEL:
|
||||
case TYPE_SCH_GLOBALLABEL:
|
||||
DrawTextItem = (SCH_LABEL*)(aList[ii].m_Label);
|
||||
DrawTextItem = (SCH_LABEL*) (aList[ii].m_Label);
|
||||
|
||||
if( aList[ii].m_LabelType == TYPE_SCH_HIERLABEL )
|
||||
labeltype = wxT( "Hierarchical" );
|
||||
@ -824,7 +835,8 @@ static int PrintListeGLabel( FILE* f, std::vector <LABEL_OBJECT>& aList )
|
||||
|
||||
case DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE:
|
||||
{
|
||||
DrawSheetLabel = (Hierarchical_PIN_Sheet_Struct*) aList[ii].m_Label;
|
||||
DrawSheetLabel =
|
||||
(Hierarchical_PIN_Sheet_Struct*) aList[ii].m_Label;
|
||||
int jj = DrawSheetLabel->m_Shape;
|
||||
if( jj < 0 )
|
||||
jj = NET_TMAX;
|
||||
@ -855,15 +867,14 @@ static int PrintListeGLabel( FILE* f, std::vector <LABEL_OBJECT>& aList )
|
||||
|
||||
/********************************************/
|
||||
int RefDesStringCompare( const char* obj1, const char* obj2 )
|
||||
{
|
||||
/********************************************/
|
||||
|
||||
/* This function will act just like the strcmp function but correctly sort
|
||||
* the numerical order in the string
|
||||
* return -1 if first string is less than the second
|
||||
* return 0 if the strings are equal
|
||||
* return 1 if the first string is greater than the second
|
||||
*/
|
||||
{
|
||||
/* The strings we are going to compare */
|
||||
wxString strFWord;
|
||||
wxString strSWord;
|
||||
@ -877,14 +888,16 @@ int RefDesStringCompare( const char* obj1, const char* obj2 )
|
||||
int isEqual = 0; /* The numerical results of a string compare */
|
||||
int iReturn = 0; /* The variable that is being returned */
|
||||
|
||||
long lFirstDigit = 0; /* The converted middle section of the first string */
|
||||
long lSecondDigit = 0; /* The converted middle section of the second string */
|
||||
long lFirstDigit = 0; /* The converted middle section of the first
|
||||
*string */
|
||||
long lSecondDigit = 0; /* The converted middle section of the second
|
||||
*string */
|
||||
|
||||
/* Since m_Ref is a char * it is ASCII */
|
||||
strFWord = wxString::FromAscii( obj1 );
|
||||
strSWord = wxString::FromAscii( obj2 );
|
||||
|
||||
/* Split the two string into seperate parts */
|
||||
/* Split the two string into separate parts */
|
||||
SplitString( strFWord, &strFWordBeg, &strFWordMid, &strFWordEnd );
|
||||
SplitString( strSWord, &strSWordBeg, &strSWordMid, &strSWordEnd );
|
||||
|
||||
@ -920,20 +933,19 @@ int RefDesStringCompare( const char* obj1, const char* obj2 )
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************************************/
|
||||
/****************************************************************************/
|
||||
int SplitString( wxString strToSplit,
|
||||
wxString* strBeginning,
|
||||
wxString* strDigits,
|
||||
wxString* strEnd )
|
||||
/**************************************************************************************************/
|
||||
|
||||
{
|
||||
/****************************************************************************/
|
||||
/* This is the function that breaks a string into three parts.
|
||||
* The alphabetic preamble
|
||||
* The numeric part
|
||||
* Any alphabetic ending
|
||||
* For example C10A is split to C 10 A
|
||||
*/
|
||||
{
|
||||
/* Clear all the return strings */
|
||||
strBeginning->Clear();
|
||||
strDigits->Clear();
|
||||
@ -971,7 +983,8 @@ int SplitString( wxString strToSplit,
|
||||
if( ii < 0 )
|
||||
*strDigits = strToSplit.substr( 0, position );
|
||||
|
||||
/* We were only looking for the last set of digits everything else is part of the preamble */
|
||||
/* We were only looking for the last set of digits everything else is
|
||||
*part of the preamble */
|
||||
else
|
||||
{
|
||||
*strDigits = strToSplit.substr( ii + 1, position - ii - 1 );
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*********************************************************/
|
||||
/* Modules de creations de Traits, Wires, Bus, Junctions */
|
||||
/*********************************************************/
|
||||
/***************************************************************/
|
||||
/* Code for handling creation of buses, wires, and junctions. */
|
||||
/***************************************************************/
|
||||
|
||||
#include "fctsys.h"
|
||||
#include "gr_basic.h"
|
||||
@ -15,31 +15,34 @@
|
||||
|
||||
|
||||
/* Routines Locales */
|
||||
static void Show_Polyline_in_Ghost( WinEDA_DrawPanel* panel, wxDC* DC, bool erase );
|
||||
static void Show_Polyline_in_Ghost( WinEDA_DrawPanel* panel,
|
||||
wxDC* DC,
|
||||
bool erase );
|
||||
static void Segment_in_Ghost( WinEDA_DrawPanel* panel, wxDC* DC, bool erase );
|
||||
static void AbortCreateNewLine( WinEDA_DrawPanel* Panel, wxDC* DC );
|
||||
static bool IsTerminalPoint( SCH_SCREEN* screen, const wxPoint& pos, int layer );
|
||||
static bool IsJunctionNeeded( WinEDA_SchematicFrame* frame, wxPoint& pos );
|
||||
static void ComputeBreakPoint( EDA_DrawLineStruct* segment, const wxPoint& new_pos );
|
||||
static void ComputeBreakPoint( EDA_DrawLineStruct* segment,
|
||||
const wxPoint& new_pos );
|
||||
|
||||
SCH_ITEM* s_OldWiresList;
|
||||
wxPoint s_ConnexionStartPoint;
|
||||
wxPoint s_ConnexionStartPoint;
|
||||
|
||||
/*********************************************************/
|
||||
SCH_ITEM* SCH_SCREEN::ExtractWires( bool CreateCopy )
|
||||
/*********************************************************/
|
||||
|
||||
/* Extract the old wires, junctions and busses, an if CreateCopy replace them by a copy.
|
||||
* Old ones must be put in undo list, and the new ones can be modified by clean up
|
||||
* safely.
|
||||
* If an abord command is made, old wires must be put in EEDrawList, and copies must be deleted
|
||||
* This is because previously stored undo commands can handle pointers on wires or bus,
|
||||
* and we do not delete wires or bus, we must put they in undo list.
|
||||
*
|
||||
* Because cleanup delete and/or modify bus and wires, the more easy is to put all wires in undo list
|
||||
* and use a new copy of wires for cleanup
|
||||
*/
|
||||
{
|
||||
/*********************************************************/
|
||||
/* Extract the old wires, junctions and buses, an if CreateCopy replace them
|
||||
* by a copy. Old ones must be put in undo list, and the new ones can be
|
||||
* modified by clean up safely.
|
||||
* If an abort command is made, old wires must be put in EEDrawList, and
|
||||
* copies must be deleted. This is because previously stored undo commands
|
||||
* can handle pointers on wires or bus, and we do not delete wires or bus,
|
||||
* we must put they in undo list.
|
||||
*
|
||||
* Because cleanup delete and/or modify bus and wires, the more easy is to put
|
||||
* all wires in undo list and use a new copy of wires for cleanup.
|
||||
*/
|
||||
SCH_ITEM* item, * next_item, * new_item, * List = NULL;
|
||||
|
||||
for( item = EEDrawList; item != NULL; item = next_item )
|
||||
@ -75,11 +78,10 @@ SCH_ITEM* SCH_SCREEN::ExtractWires( bool CreateCopy )
|
||||
|
||||
/*************************************************/
|
||||
static void RestoreOldWires( SCH_SCREEN* screen )
|
||||
{
|
||||
/*************************************************/
|
||||
|
||||
/* Replace the wires in screen->EEDrawList by s_OldWiresList wires.
|
||||
*/
|
||||
{
|
||||
SCH_ITEM* item;
|
||||
SCH_ITEM* next_item;
|
||||
|
||||
@ -105,24 +107,23 @@ static void RestoreOldWires( SCH_SCREEN* screen )
|
||||
next_item = s_OldWiresList->Next();
|
||||
|
||||
s_OldWiresList->SetNext( screen->EEDrawList );
|
||||
screen->EEDrawList = s_OldWiresList;
|
||||
s_OldWiresList = next_item;
|
||||
screen->EEDrawList = s_OldWiresList;
|
||||
s_OldWiresList = next_item;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*************************************************************/
|
||||
void WinEDA_SchematicFrame::BeginSegment( wxDC* DC, int type )
|
||||
{
|
||||
/*************************************************************/
|
||||
|
||||
/* Creates a new segment ( WIRE, BUS ),
|
||||
* or terminates the current segment
|
||||
* If the end of the current segment is on an other segment, place a junction if needed
|
||||
* and terminates the command
|
||||
* If the end of the current segment is on an other segment, place a junction
|
||||
* if needed and terminates the command
|
||||
* If the end of the current segment is on a pin, terminates the command
|
||||
* In others cases starts a new segment
|
||||
*/
|
||||
{
|
||||
EDA_DrawLineStruct* oldsegment, * newsegment, * nextsegment;
|
||||
wxPoint cursorpos = GetScreen()->m_Curseur;
|
||||
|
||||
@ -145,11 +146,11 @@ void WinEDA_SchematicFrame::BeginSegment( wxDC* DC, int type )
|
||||
oldsegment = newsegment =
|
||||
(EDA_DrawLineStruct*) GetScreen()->GetCurItem();
|
||||
|
||||
if( !newsegment ) /* first point : Create first wire ou bus */
|
||||
if( !newsegment ) /* first point : Create first wire or bus */
|
||||
{
|
||||
s_ConnexionStartPoint = cursorpos;
|
||||
s_OldWiresList = ((SCH_SCREEN*)GetScreen())->ExtractWires( TRUE );
|
||||
((SCH_SCREEN*)GetScreen())->SchematicCleanUp( NULL );
|
||||
s_OldWiresList = ( (SCH_SCREEN*) GetScreen() )->ExtractWires( TRUE );
|
||||
( (SCH_SCREEN*) GetScreen() )->SchematicCleanUp( NULL );
|
||||
|
||||
switch( type )
|
||||
{
|
||||
@ -160,8 +161,8 @@ void WinEDA_SchematicFrame::BeginSegment( wxDC* DC, int type )
|
||||
case LAYER_WIRE:
|
||||
newsegment = new EDA_DrawLineStruct( cursorpos, LAYER_WIRE );
|
||||
|
||||
/* A junction will be created later, when w'll know the
|
||||
* segment end position, and if the junction is really needed */
|
||||
/* A junction will be created later, when we'll know the
|
||||
* segment end position, and if the junction is really needed */
|
||||
break;
|
||||
|
||||
case LAYER_BUS:
|
||||
@ -170,7 +171,8 @@ void WinEDA_SchematicFrame::BeginSegment( wxDC* DC, int type )
|
||||
}
|
||||
|
||||
newsegment->m_Flags = IS_NEW;
|
||||
if( g_HVLines ) // We need 2 segments to go from a given start pint to an end point
|
||||
if( g_HVLines ) // We need 2 segments to go from a given start pint to
|
||||
// an end point
|
||||
{
|
||||
nextsegment = newsegment->GenCopy();
|
||||
nextsegment->m_Flags = IS_NEW;
|
||||
@ -182,17 +184,20 @@ void WinEDA_SchematicFrame::BeginSegment( wxDC* DC, int type )
|
||||
DrawPanel->ForceCloseManageCurseur = AbortCreateNewLine;
|
||||
g_ItemToRepeat = NULL;
|
||||
}
|
||||
else /* A segment is in progress: terminates the current segment and add a new segment */
|
||||
else /* A segment is in progress: terminates the current segment and add
|
||||
* a new segment */
|
||||
{
|
||||
nextsegment = oldsegment->Next();
|
||||
if( !g_HVLines )
|
||||
{ /* if only one segment is needed and the current is has len = 0, do not create a new one*/
|
||||
if( !g_HVLines ) /* if only one segment is needed and the current is
|
||||
* has len = 0, do not create a new one */
|
||||
{
|
||||
if( oldsegment->IsNull() )
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* if we want 2 segment and the last two have len = 0, do not create a new one*/
|
||||
/* if we want 2 segment and the last two have len = 0, do not
|
||||
* create a new one */
|
||||
if( oldsegment->IsNull() && nextsegment && nextsegment->IsNull() )
|
||||
return;
|
||||
}
|
||||
@ -200,13 +205,12 @@ void WinEDA_SchematicFrame::BeginSegment( wxDC* DC, int type )
|
||||
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
|
||||
|
||||
/* Creates the new segment, or terminates the command
|
||||
* if the end point is on a pin, jonction or an other wire or bus */
|
||||
* if the end point is on a pin, junction or an other wire or bus */
|
||||
if( IsTerminalPoint( GetScreen(), cursorpos, oldsegment->GetLayer() ) )
|
||||
{
|
||||
EndSegment( DC ); return;
|
||||
}
|
||||
|
||||
/* Placement en liste generale */
|
||||
oldsegment->SetNext( GetScreen()->EEDrawList );
|
||||
GetScreen()->EEDrawList = oldsegment;
|
||||
DrawPanel->CursorOff( DC ); // Erase schematic cursor
|
||||
@ -233,11 +237,13 @@ void WinEDA_SchematicFrame::BeginSegment( wxDC* DC, int type )
|
||||
newsegment->m_Flags = IS_NEW;
|
||||
GetScreen()->SetCurItem( newsegment );
|
||||
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
|
||||
|
||||
/* This is the first segment: Now we know the start segment position.
|
||||
* Create a junction if needed. Note: a junction can be needed later,
|
||||
* if the new segment is merged (after a cleanup) with an older one
|
||||
* (tested when the connection will be finished)*/
|
||||
if( oldsegment->m_Start == s_ConnexionStartPoint )
|
||||
{ /* This is the first segment: Now we know the start segment position.
|
||||
* Create a junction if needed. Note: a junction can be needed
|
||||
* later, if the new segment is merged (after a cleanup) with an older one
|
||||
* (tested when the connection will be finished)*/
|
||||
{
|
||||
if( IsJunctionNeeded( this, s_ConnexionStartPoint ) )
|
||||
CreateNewJunctionStruct( DC, s_ConnexionStartPoint );
|
||||
}
|
||||
@ -247,13 +253,13 @@ void WinEDA_SchematicFrame::BeginSegment( wxDC* DC, int type )
|
||||
|
||||
/***********************************************/
|
||||
void WinEDA_SchematicFrame::EndSegment( wxDC* DC )
|
||||
{
|
||||
/***********************************************/
|
||||
|
||||
/* Called to terminate a bus, wire, or line creation
|
||||
*/
|
||||
{
|
||||
EDA_DrawLineStruct* firstsegment = (EDA_DrawLineStruct*) GetScreen()->GetCurItem();
|
||||
EDA_DrawLineStruct* lastsegment = firstsegment;
|
||||
EDA_DrawLineStruct* firstsegment =
|
||||
(EDA_DrawLineStruct*) GetScreen()->GetCurItem();
|
||||
EDA_DrawLineStruct* lastsegment = firstsegment;
|
||||
EDA_DrawLineStruct* segment;
|
||||
|
||||
if( firstsegment == NULL )
|
||||
@ -285,12 +291,11 @@ void WinEDA_SchematicFrame::EndSegment( wxDC* DC )
|
||||
while( segment )
|
||||
{
|
||||
lastsegment = segment;
|
||||
segment = segment->Next();
|
||||
segment = segment->Next();
|
||||
lastsegment->SetNext( GetScreen()->EEDrawList );
|
||||
GetScreen()->EEDrawList = lastsegment;
|
||||
}
|
||||
|
||||
/* Fin de trace */
|
||||
DrawPanel->ManageCurseur = NULL;
|
||||
DrawPanel->ForceCloseManageCurseur = NULL;
|
||||
GetScreen()->SetCurItem( NULL );
|
||||
@ -299,16 +304,16 @@ void WinEDA_SchematicFrame::EndSegment( wxDC* DC )
|
||||
|
||||
/* A junction can be needed to connect the last segment
|
||||
* usually to m_End coordinate.
|
||||
* But if the last segment is removed by a cleanup, because od redundancy,
|
||||
* a junction can be needed to connect the previous segment m_End coordinate
|
||||
* with is also the lastsegment->m_Start coordinate */
|
||||
* But if the last segment is removed by a cleanup, because of redundancy,
|
||||
* a junction can be needed to connect the previous segment m_End
|
||||
* coordinate with is also the lastsegment->m_Start coordinate */
|
||||
if( lastsegment )
|
||||
{
|
||||
end_point = lastsegment->m_End;
|
||||
alt_end_point = lastsegment->m_Start;
|
||||
}
|
||||
|
||||
((SCH_SCREEN*)GetScreen())->SchematicCleanUp( NULL );
|
||||
( (SCH_SCREEN*) GetScreen() )->SchematicCleanUp( NULL );
|
||||
|
||||
/* clear flags and find last segment entered, for repeat function */
|
||||
segment = (EDA_DrawLineStruct*) GetScreen()->EEDrawList;
|
||||
@ -333,8 +338,8 @@ void WinEDA_SchematicFrame::EndSegment( wxDC* DC )
|
||||
CreateNewJunctionStruct( DC, alt_end_point );
|
||||
}
|
||||
|
||||
/* Automatic place of a junction on the start point if necessary because the
|
||||
* Cleanup can suppress intermediate points by merging wire segments*/
|
||||
/* Automatic place of a junction on the start point if necessary because
|
||||
* the cleanup can suppress intermediate points by merging wire segments */
|
||||
if( IsJunctionNeeded( this, s_ConnexionStartPoint ) )
|
||||
CreateNewJunctionStruct( DC, s_ConnexionStartPoint );
|
||||
|
||||
@ -350,7 +355,7 @@ void WinEDA_SchematicFrame::EndSegment( wxDC* DC )
|
||||
{
|
||||
case DRAW_JUNCTION_STRUCT_TYPE:
|
||||
case DRAW_SEGMENT_STRUCT_TYPE:
|
||||
DrawPanel->PostDirtyRect(item->GetBoundingBox());
|
||||
DrawPanel->PostDirtyRect( item->GetBoundingBox() );
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -372,12 +377,12 @@ void WinEDA_SchematicFrame::EndSegment( wxDC* DC )
|
||||
|
||||
/****************************************************************************/
|
||||
static void Segment_in_Ghost( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
|
||||
{
|
||||
/****************************************************************************/
|
||||
|
||||
/* Redraw the segment (g_HVLines == FALSE ) or the two segments (g_HVLines == TRUE )
|
||||
/* Redraw the segment (g_HVLines == FALSE ) or the two segments (g_HVLines ==
|
||||
* TRUE )
|
||||
* from the start point to the cursor, when moving the mouse
|
||||
*/
|
||||
{
|
||||
EDA_DrawLineStruct* CurrentLine =
|
||||
(EDA_DrawLineStruct*) panel->GetScreen()->GetCurItem();
|
||||
EDA_DrawLineStruct* segment;
|
||||
@ -393,7 +398,7 @@ static void Segment_in_Ghost( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
|
||||
segment = CurrentLine;
|
||||
while( segment )
|
||||
{
|
||||
if( !segment->IsNull() ) // Redraw if segment lengtht != 0
|
||||
if( !segment->IsNull() ) // Redraw if segment length != 0
|
||||
RedrawOneStruct( panel, DC, segment, g_XorMode, color );
|
||||
segment = segment->Next();
|
||||
}
|
||||
@ -410,21 +415,22 @@ static void Segment_in_Ghost( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
|
||||
segment = CurrentLine;
|
||||
while( segment )
|
||||
{
|
||||
if( !segment->IsNull() ) // Redraw if segment lengtht != 0
|
||||
if( !segment->IsNull() ) // Redraw if segment length != 0
|
||||
RedrawOneStruct( panel, DC, segment, g_XorMode, color );
|
||||
segment = segment->Next();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************************/
|
||||
static void ComputeBreakPoint( EDA_DrawLineStruct* segment, const wxPoint& new_pos )
|
||||
/**************************************************************************************/
|
||||
|
||||
/* compute the middle coordinate for 2 segments, from the start point to new_pos
|
||||
/***************************************************************************/
|
||||
static void ComputeBreakPoint( EDA_DrawLineStruct* segment,
|
||||
const wxPoint& new_pos )
|
||||
{
|
||||
/***************************************************************************/
|
||||
/* compute the middle coordinate for 2 segments, from the start point to
|
||||
* new_pos
|
||||
* with the 2 segments kept H or V only
|
||||
*/
|
||||
{
|
||||
EDA_DrawLineStruct* nextsegment = segment->Next();
|
||||
wxPoint middle_position = new_pos;
|
||||
|
||||
@ -439,11 +445,13 @@ static void ComputeBreakPoint( EDA_DrawLineStruct* segment, const wxPoint& new_p
|
||||
#else
|
||||
int iDx = segment->m_End.x - segment->m_Start.x;
|
||||
int iDy = segment->m_End.y - segment->m_Start.y;
|
||||
if( iDy != 0 ) // keep the first segment orientation (currently horizontal)
|
||||
if( iDy != 0 ) // keep the first segment orientation (currently
|
||||
// horizontal)
|
||||
{
|
||||
middle_position.x = segment->m_Start.x;
|
||||
}
|
||||
else if( iDx != 0 ) // keep the first segment orientation (currently vertical)
|
||||
else if( iDx != 0 ) // keep the first segment orientation (currently
|
||||
// vertical)
|
||||
{
|
||||
middle_position.y = segment->m_Start.y;
|
||||
}
|
||||
@ -465,12 +473,13 @@ static void ComputeBreakPoint( EDA_DrawLineStruct* segment, const wxPoint& new_p
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
static void Show_Polyline_in_Ghost( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
|
||||
/*****************************************************************************/
|
||||
|
||||
/* Dessin du du Polyline Fantome lors des deplacements du curseur
|
||||
*/
|
||||
static void Show_Polyline_in_Ghost( WinEDA_DrawPanel* panel,
|
||||
wxDC* DC,
|
||||
bool erase )
|
||||
{
|
||||
/*****************************************************************************/
|
||||
/* Drawing Polyline phantom at the displacement of the cursor
|
||||
*/
|
||||
DrawPolylineStruct* NewPoly =
|
||||
(DrawPolylineStruct*) panel->GetScreen()->GetCurItem();
|
||||
int color;
|
||||
@ -502,12 +511,11 @@ static void Show_Polyline_in_Ghost( WinEDA_DrawPanel* panel, wxDC* DC, bool eras
|
||||
|
||||
/**********************************************************/
|
||||
void WinEDA_SchematicFrame::DeleteCurrentSegment( wxDC* DC )
|
||||
/**********************************************************/
|
||||
|
||||
/*
|
||||
* Routine effacant le dernier trait trace, ou l'element pointe par la souris
|
||||
*/
|
||||
{
|
||||
/**********************************************************/
|
||||
/*
|
||||
* Erase the last trace or the element at the current mouse position.
|
||||
*/
|
||||
g_ItemToRepeat = NULL;
|
||||
|
||||
if( (GetScreen()->GetCurItem() == NULL)
|
||||
@ -516,17 +524,18 @@ void WinEDA_SchematicFrame::DeleteCurrentSegment( wxDC* DC )
|
||||
return;
|
||||
}
|
||||
|
||||
/* Trace en cours: annulation */
|
||||
/* Cancel trace in progress */
|
||||
if( GetScreen()->GetCurItem()->Type() == DRAW_POLYLINE_STRUCT_TYPE )
|
||||
{
|
||||
Show_Polyline_in_Ghost( DrawPanel, DC, FALSE ); /* Effacement du trace en cours */
|
||||
Show_Polyline_in_Ghost( DrawPanel, DC, FALSE );
|
||||
}
|
||||
else
|
||||
{
|
||||
Segment_in_Ghost( DrawPanel, DC, FALSE ); /* Effacement du trace en cours */
|
||||
Segment_in_Ghost( DrawPanel, DC, FALSE );
|
||||
}
|
||||
|
||||
EraseStruct( (SCH_ITEM*) GetScreen()->GetCurItem(), (SCH_SCREEN*)GetScreen() );
|
||||
EraseStruct( (SCH_ITEM*) GetScreen()->GetCurItem(),
|
||||
(SCH_SCREEN*) GetScreen() );
|
||||
DrawPanel->ManageCurseur = NULL;
|
||||
GetScreen()->SetCurItem( NULL );
|
||||
}
|
||||
@ -535,11 +544,10 @@ void WinEDA_SchematicFrame::DeleteCurrentSegment( wxDC* DC )
|
||||
/***************************************************************************/
|
||||
DrawJunctionStruct* WinEDA_SchematicFrame::CreateNewJunctionStruct(
|
||||
wxDC* DC, const wxPoint& pos, bool PutInUndoList )
|
||||
{
|
||||
/***************************************************************************/
|
||||
|
||||
/* Routine to create new connection struct.
|
||||
*/
|
||||
{
|
||||
DrawJunctionStruct* NewJunction;
|
||||
|
||||
NewJunction = new DrawJunctionStruct( pos );
|
||||
@ -561,11 +569,9 @@ DrawJunctionStruct* WinEDA_SchematicFrame::CreateNewJunctionStruct(
|
||||
|
||||
/*******************************************************************************/
|
||||
DrawNoConnectStruct* WinEDA_SchematicFrame::CreateNewNoConnectStruct( wxDC* DC )
|
||||
/*******************************************************************************/
|
||||
|
||||
/*Routine to create new NoConnect struct. ( Symbole de Non Connexion)
|
||||
*/
|
||||
{
|
||||
/*******************************************************************************/
|
||||
/* Routine to create new NoConnect struct. */
|
||||
DrawNoConnectStruct* NewNoConnect;
|
||||
|
||||
NewNoConnect = new DrawNoConnectStruct( GetScreen()->m_Curseur );
|
||||
@ -585,14 +591,13 @@ DrawNoConnectStruct* WinEDA_SchematicFrame::CreateNewNoConnectStruct( wxDC* DC )
|
||||
|
||||
/*****************************************************************/
|
||||
static void AbortCreateNewLine( WinEDA_DrawPanel* Panel, wxDC* DC )
|
||||
{
|
||||
/*****************************************************************/
|
||||
|
||||
/* Abort function for wire, bus or line creation
|
||||
*/
|
||||
{
|
||||
SCH_SCREEN* Screen = (SCH_SCREEN*) Panel->GetScreen();
|
||||
|
||||
if( Screen->GetCurItem() ) /* trace en cours */
|
||||
if( Screen->GetCurItem() )
|
||||
{
|
||||
Panel->ManageCurseur = NULL;
|
||||
Panel->ForceCloseManageCurseur = NULL;
|
||||
@ -602,9 +607,9 @@ static void AbortCreateNewLine( WinEDA_DrawPanel* Panel, wxDC* DC )
|
||||
Panel->Refresh();
|
||||
}
|
||||
else
|
||||
g_ItemToRepeat = NULL; // Fin de commande generale
|
||||
g_ItemToRepeat = NULL;
|
||||
|
||||
/* Clear m_Flags wich is used in edit functions: */
|
||||
/* Clear m_Flags which is used in edit functions: */
|
||||
SCH_ITEM* item = Screen->EEDrawList;
|
||||
while( item )
|
||||
{
|
||||
@ -616,14 +621,12 @@ static void AbortCreateNewLine( WinEDA_DrawPanel* Panel, wxDC* DC )
|
||||
|
||||
/***************************************************/
|
||||
void WinEDA_SchematicFrame::RepeatDrawItem( wxDC* DC )
|
||||
/***************************************************/
|
||||
|
||||
/* Routine de recopie du dernier element dessine
|
||||
* Les elements duplicables sont
|
||||
* fils, bus, traits, textes, labels
|
||||
* Les labels termines par un nombre seront incrementes
|
||||
*/
|
||||
{
|
||||
/***************************************************/
|
||||
/* Repeat the last item placement.
|
||||
* Bus lines, text, labels
|
||||
* Labels that end with a number will be incremented.
|
||||
*/
|
||||
wxPoint new_pos;
|
||||
|
||||
if( g_ItemToRepeat == NULL )
|
||||
@ -653,7 +656,6 @@ void WinEDA_SchematicFrame::RepeatDrawItem( wxDC* DC )
|
||||
g_ItemToRepeat = STRUCT->GenCopy();
|
||||
STRUCT->m_Pos += g_RepeatStep;
|
||||
new_pos = STRUCT->m_Pos;
|
||||
/*** Increment du numero de label ***/
|
||||
IncrementLabelMember( STRUCT->m_Text );
|
||||
break;
|
||||
|
||||
@ -664,7 +666,6 @@ void WinEDA_SchematicFrame::RepeatDrawItem( wxDC* DC )
|
||||
g_ItemToRepeat = STRUCT->GenCopy();
|
||||
STRUCT->m_Pos += g_RepeatStep;
|
||||
new_pos = STRUCT->m_Pos;
|
||||
/*** Increment du numero de label ***/
|
||||
IncrementLabelMember( STRUCT->m_Text );
|
||||
break;
|
||||
|
||||
@ -675,7 +676,6 @@ void WinEDA_SchematicFrame::RepeatDrawItem( wxDC* DC )
|
||||
g_ItemToRepeat = STRUCT->GenCopy();
|
||||
STRUCT->m_Pos += g_RepeatStep;
|
||||
new_pos = STRUCT->m_Pos;
|
||||
/*** Increment du numero de label ***/
|
||||
IncrementLabelMember( STRUCT->m_Text );
|
||||
break;
|
||||
|
||||
@ -685,7 +685,6 @@ void WinEDA_SchematicFrame::RepeatDrawItem( wxDC* DC )
|
||||
g_ItemToRepeat = STRUCT->GenCopy();
|
||||
STRUCT->m_Pos += g_RepeatStep;
|
||||
new_pos = STRUCT->m_Pos;
|
||||
/*** Increment du numero de label ***/
|
||||
IncrementLabelMember( STRUCT->m_Text );
|
||||
break;
|
||||
|
||||
@ -706,21 +705,22 @@ void WinEDA_SchematicFrame::RepeatDrawItem( wxDC* DC )
|
||||
new_pos = STRUCT->m_Pos;
|
||||
break;
|
||||
|
||||
case TYPE_SCH_COMPONENT: // In repeat command the new component is put in move mode
|
||||
case TYPE_SCH_COMPONENT: // In repeat command the new component is put
|
||||
// in move mode
|
||||
#undef STRUCT
|
||||
#define STRUCT ( (SCH_COMPONENT*) g_ItemToRepeat )
|
||||
|
||||
// Create the duplicate component, position = mouse cursor
|
||||
g_ItemToRepeat = STRUCT->GenCopy();
|
||||
new_pos.x = GetScreen()->m_Curseur.x - STRUCT->m_Pos.x;
|
||||
new_pos.y = GetScreen()->m_Curseur.y - STRUCT->m_Pos.y;
|
||||
STRUCT->m_Pos = GetScreen()->m_Curseur;
|
||||
new_pos.x = GetScreen()->m_Curseur.x - STRUCT->m_Pos.x;
|
||||
new_pos.y = GetScreen()->m_Curseur.y - STRUCT->m_Pos.y;
|
||||
STRUCT->m_Pos = GetScreen()->m_Curseur;
|
||||
STRUCT->m_Flags = IS_NEW;
|
||||
STRUCT->m_TimeStamp = GetTimeStamp();
|
||||
|
||||
for( int ii = 0; ii < STRUCT->GetFieldCount(); ii++ )
|
||||
{
|
||||
STRUCT->GetField(ii)->m_Pos += new_pos;
|
||||
STRUCT->GetField( ii )->m_Pos += new_pos;
|
||||
}
|
||||
|
||||
RedrawOneStruct( DrawPanel, DC, STRUCT, g_XorMode );
|
||||
@ -743,20 +743,19 @@ void WinEDA_SchematicFrame::RepeatDrawItem( wxDC* DC )
|
||||
SaveCopyInUndoList( g_ItemToRepeat, UR_NEW );
|
||||
g_ItemToRepeat->m_Flags = 0;
|
||||
|
||||
// GetScreen()->Curseur = new_pos;
|
||||
// DrawPanel->MouseTo( DrawPanel->CursorScreenPosition() );
|
||||
// GetScreen()->Curseur = new_pos;
|
||||
// DrawPanel->MouseTo( DrawPanel->CursorScreenPosition() );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/******************************************/
|
||||
void IncrementLabelMember( wxString& name )
|
||||
/******************************************/
|
||||
|
||||
/* Routine incrementant les labels, c'est a dire pour les textes finissant
|
||||
* par un nombre, ajoutant <RepeatDeltaLabel> a ce nombre
|
||||
*/
|
||||
{
|
||||
/******************************************/
|
||||
/* Routine incrementing labels, ie for the text ending with a number, adding
|
||||
* that a number <RepeatDeltaLabel>
|
||||
*/
|
||||
int ii, nn;
|
||||
long number = 0;
|
||||
|
||||
@ -781,8 +780,8 @@ void IncrementLabelMember( wxString& name )
|
||||
|
||||
/***************************************************************************/
|
||||
static bool IsTerminalPoint( SCH_SCREEN* screen, const wxPoint& pos, int layer )
|
||||
{
|
||||
/***************************************************************************/
|
||||
|
||||
/* Return TRUE if pos can be a terminal point for a wire or a bus
|
||||
* i.e. :
|
||||
* for a WIRE, if at pos is found:
|
||||
@ -793,12 +792,11 @@ static bool IsTerminalPoint( SCH_SCREEN* screen, const wxPoint& pos, int layer )
|
||||
* - for a BUS, if at pos is found:
|
||||
* - a BUS
|
||||
*/
|
||||
{
|
||||
EDA_BaseStruct* item;
|
||||
LIB_PIN* pin;
|
||||
SCH_COMPONENT* LibItem = NULL;
|
||||
Hierarchical_PIN_Sheet_Struct* pinsheet;
|
||||
wxPoint itempos;
|
||||
Hierarchical_PIN_Sheet_Struct* pinsheet;
|
||||
wxPoint itempos;
|
||||
|
||||
switch( layer )
|
||||
{
|
||||
@ -829,8 +827,8 @@ static bool IsTerminalPoint( SCH_SCREEN* screen, const wxPoint& pos, int layer )
|
||||
pin = LocateAnyPin( screen->EEDrawList, pos, &LibItem );
|
||||
if( pin && LibItem )
|
||||
{
|
||||
// calcul de la position exacte du point de connexion de la pin,
|
||||
// selon orientation du composant:
|
||||
// Calculate the exact position of the connection point of the pin,
|
||||
// depending on orientation of the component.
|
||||
itempos = LibItem->GetScreenCoord( pin->m_Pos );
|
||||
itempos.x += LibItem->m_Pos.x;
|
||||
itempos.y += LibItem->m_Pos.y;
|
||||
@ -868,8 +866,8 @@ static bool IsTerminalPoint( SCH_SCREEN* screen, const wxPoint& pos, int layer )
|
||||
|
||||
/****************************************************************/
|
||||
bool IsJunctionNeeded( WinEDA_SchematicFrame* frame, wxPoint& pos )
|
||||
{
|
||||
/****************************************************************/
|
||||
|
||||
/* Return True when a wire is located at pos "pos" if
|
||||
* - there is no junction.
|
||||
* - The wire has no ends at pos "pos",
|
||||
@ -878,13 +876,14 @@ bool IsJunctionNeeded( WinEDA_SchematicFrame* frame, wxPoint& pos )
|
||||
* or
|
||||
* - a pin is on location pos
|
||||
*/
|
||||
{
|
||||
if( PickStruct( pos, frame->GetScreen(), JUNCTIONITEM ) )
|
||||
return FALSE;
|
||||
|
||||
if( PickStruct( pos, frame->GetScreen(), WIREITEM | EXCLUDE_WIRE_BUS_ENDPOINTS ) )
|
||||
if( PickStruct( pos, frame->GetScreen(), WIREITEM |
|
||||
EXCLUDE_WIRE_BUS_ENDPOINTS ) )
|
||||
{
|
||||
if( PickStruct( pos, frame->GetScreen(), WIREITEM | WIRE_BUS_ENDPOINTS_ONLY ) )
|
||||
if( PickStruct( pos, frame->GetScreen(), WIREITEM |
|
||||
WIRE_BUS_ENDPOINTS_ONLY ) )
|
||||
return TRUE;
|
||||
if( frame->LocatePinEnd( frame->GetScreen()->EEDrawList, pos ) )
|
||||
return TRUE;
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*************************************/
|
||||
/* Modules de creations de Bus Entry */
|
||||
/*************************************/
|
||||
/*****************************************************/
|
||||
/* Code to handle manipulation on bus entry objects. */
|
||||
/*****************************************************/
|
||||
|
||||
#include "fctsys.h"
|
||||
#include "gr_basic.h"
|
||||
@ -13,21 +13,18 @@
|
||||
#include "general.h"
|
||||
#include "protos.h"
|
||||
|
||||
/* Routines Locales */
|
||||
|
||||
/* Variables locales */
|
||||
static int s_LastShape = '\\';
|
||||
static wxPoint ItemInitialPosition;
|
||||
|
||||
/**************************************************************/
|
||||
static void ExitBusEntry( WinEDA_DrawPanel* Panel, wxDC* DC )
|
||||
/**************************************************************/
|
||||
/* Routine de sortie des menus de trace */
|
||||
{
|
||||
/**************************************************************/
|
||||
/* Exit bus entry mode. */
|
||||
DrawBusEntryStruct* BusEntry =
|
||||
(DrawBusEntryStruct*) Panel->GetScreen()->GetCurItem();
|
||||
|
||||
if( BusEntry ) /* trace en cours */
|
||||
if( BusEntry )
|
||||
{
|
||||
RedrawOneStruct( Panel, DC, BusEntry, g_XorMode );
|
||||
if( BusEntry->m_Flags & IS_NEW )
|
||||
@ -51,36 +48,36 @@ static void ExitBusEntry( WinEDA_DrawPanel* Panel, wxDC* DC )
|
||||
|
||||
/************************************************************************/
|
||||
static void ShowWhileMoving( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
|
||||
/************************************************************************/
|
||||
|
||||
/* Dessin du Segment "BusEntry" lors des deplacements du curseur
|
||||
*/
|
||||
{
|
||||
/************************************************************************/
|
||||
/* Drawing of the bus entry segment" while moving the cursor. */
|
||||
BASE_SCREEN* screen = panel->GetScreen();
|
||||
DrawBusEntryStruct* BusEntry = (DrawBusEntryStruct*) screen->GetCurItem();
|
||||
|
||||
if( BusEntry == NULL )
|
||||
return;
|
||||
|
||||
/* effacement apres deplacement curseur */
|
||||
/* Erase the last segment position. */
|
||||
if( erase )
|
||||
RedrawOneStruct( panel, DC, BusEntry, g_XorMode );
|
||||
|
||||
/* Reaffichage au bon endroit */
|
||||
/* Redraw at the new position. */
|
||||
BusEntry->m_Pos = screen->m_Curseur;
|
||||
RedrawOneStruct( panel, DC, BusEntry, g_XorMode );
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************************************/
|
||||
DrawBusEntryStruct* WinEDA_SchematicFrame::CreateBusEntry( wxDC* DC, int entry_type )
|
||||
DrawBusEntryStruct* WinEDA_SchematicFrame::CreateBusEntry( wxDC* DC,
|
||||
int entry_type )
|
||||
{
|
||||
/**********************************************************************************/
|
||||
|
||||
/* Create a new bus entry, and prepare moving function (for later place it)
|
||||
*/
|
||||
{
|
||||
DrawBusEntryStruct* BusEntry = new DrawBusEntryStruct( GetScreen()->m_Curseur,
|
||||
s_LastShape, entry_type );
|
||||
DrawBusEntryStruct* BusEntry = new DrawBusEntryStruct(
|
||||
GetScreen()->m_Curseur,
|
||||
s_LastShape,
|
||||
entry_type );
|
||||
|
||||
BusEntry->m_Flags = IS_NEW;
|
||||
|
||||
@ -98,12 +95,13 @@ DrawBusEntryStruct* WinEDA_SchematicFrame::CreateBusEntry( wxDC* DC, int entry_t
|
||||
/**************************************************************************/
|
||||
void WinEDA_SchematicFrame::StartMoveBusEntry( DrawBusEntryStruct* BusEntry,
|
||||
wxDC* DC )
|
||||
/**************************************************************************/
|
||||
{
|
||||
/**************************************************************************/
|
||||
if( BusEntry == NULL )
|
||||
return;
|
||||
|
||||
if( (BusEntry->m_Flags & IS_NEW) == 0 ) // => not already in edit, save shape */
|
||||
if( (BusEntry->m_Flags & IS_NEW) == 0 ) // => not already in edit, save
|
||||
// shape */
|
||||
{
|
||||
delete g_ItemToUndoCopy;
|
||||
g_ItemToUndoCopy = BusEntry->GenCopy();
|
||||
@ -126,13 +124,13 @@ void WinEDA_SchematicFrame::StartMoveBusEntry( DrawBusEntryStruct* BusEntry,
|
||||
|
||||
|
||||
/************************************************************/
|
||||
void WinEDA_SchematicFrame::SetBusEntryShape( wxDC* DC,
|
||||
DrawBusEntryStruct* BusEntry, int entry_shape )
|
||||
void WinEDA_SchematicFrame::SetBusEntryShape( wxDC* DC,
|
||||
DrawBusEntryStruct* BusEntry,
|
||||
int entry_shape )
|
||||
{
|
||||
/************************************************************/
|
||||
|
||||
/* set the shape of BusEntry (shape = / or \ )
|
||||
*/
|
||||
{
|
||||
if( BusEntry == NULL )
|
||||
return;
|
||||
|
||||
@ -169,8 +167,8 @@ void WinEDA_SchematicFrame::SetBusEntryShape( wxDC* DC,
|
||||
|
||||
/************************************************************************/
|
||||
int WinEDA_SchematicFrame::GetBusEntryShape( DrawBusEntryStruct* BusEntry )
|
||||
/************************************************************************/
|
||||
{
|
||||
/************************************************************************/
|
||||
int entry_shape = '\\';
|
||||
|
||||
if( BusEntry->m_Size.y < 0 )
|
||||
|
@ -1,14 +1,14 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// Name: class_drawsheet.cpp
|
||||
// Purpose: member functions for DrawSheetStruct
|
||||
// header = class_drawsheet.h
|
||||
// Purpose: member functions for DrawSheetStruct
|
||||
// header = class_drawsheet.h
|
||||
// Author: jean-pierre Charras
|
||||
// Modified by:
|
||||
// Created: 08/02/2006 18:37:02
|
||||
// RCS-ID:
|
||||
// Copyright:
|
||||
// Licence: License GNU
|
||||
// License: License GNU
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "fctsys.h"
|
||||
@ -26,13 +26,13 @@
|
||||
/***********************************************************/
|
||||
DrawSheetStruct::DrawSheetStruct( const wxPoint& pos ) :
|
||||
SCH_ITEM( NULL, DRAW_SHEET_STRUCT_TYPE )
|
||||
/***********************************************************/
|
||||
{
|
||||
m_Label = NULL;
|
||||
m_NbLabel = 0;
|
||||
m_Layer = LAYER_SHEET;
|
||||
m_Pos = pos;
|
||||
m_TimeStamp = GetTimeStamp();
|
||||
/***********************************************************/
|
||||
m_Label = NULL;
|
||||
m_NbLabel = 0;
|
||||
m_Layer = LAYER_SHEET;
|
||||
m_Pos = pos;
|
||||
m_TimeStamp = GetTimeStamp();
|
||||
m_SheetNameSize = m_FileNameSize = 60;
|
||||
m_AssociatedScreen = NULL;
|
||||
m_SheetName.Printf( wxT( "Sheet%8.8lX" ), m_TimeStamp );
|
||||
@ -42,8 +42,8 @@ DrawSheetStruct::DrawSheetStruct( const wxPoint& pos ) :
|
||||
|
||||
/**************************************/
|
||||
DrawSheetStruct::~DrawSheetStruct()
|
||||
/**************************************/
|
||||
{
|
||||
/**************************************/
|
||||
Hierarchical_PIN_Sheet_Struct* label = m_Label, * next_label;
|
||||
|
||||
while( label )
|
||||
@ -67,7 +67,6 @@ DrawSheetStruct::~DrawSheetStruct()
|
||||
/**********************************************/
|
||||
bool DrawSheetStruct::Save( FILE* aFile ) const
|
||||
/***********************************************/
|
||||
|
||||
/** Function Save
|
||||
* writes the data structures for this object out to a FILE in "*.brd" format.
|
||||
* @param aFile The FILE to write to.
|
||||
@ -87,13 +86,13 @@ bool DrawSheetStruct::Save( FILE* aFile ) const
|
||||
return Success;
|
||||
}
|
||||
|
||||
//save the unique timestamp, like other shematic parts.
|
||||
//save the unique timestamp, like other schematic parts.
|
||||
if( fprintf( aFile, "U %8.8lX\n", m_TimeStamp ) == EOF )
|
||||
{
|
||||
Success = false; return Success;
|
||||
}
|
||||
|
||||
/* Generation de la liste des 2 textes (sheetname et filename) */
|
||||
/* Save schematic sheetname and filename. */
|
||||
if( !m_SheetName.IsEmpty() )
|
||||
{
|
||||
if( fprintf( aFile, "F0 \"%s\" %d\n", CONV_TO_UTF8( m_SheetName ),
|
||||
@ -112,7 +111,7 @@ bool DrawSheetStruct::Save( FILE* aFile ) const
|
||||
}
|
||||
}
|
||||
|
||||
/* Generation de la liste des labels (entrees) de la sous feuille */
|
||||
/* Create the list of labels in the sheet. */
|
||||
SheetLabel = m_Label;
|
||||
int l_id = 2;
|
||||
while( SheetLabel != NULL )
|
||||
@ -130,12 +129,11 @@ bool DrawSheetStruct::Save( FILE* aFile ) const
|
||||
|
||||
/***********************************************/
|
||||
DrawSheetStruct* DrawSheetStruct::GenCopy()
|
||||
{
|
||||
/***********************************************/
|
||||
|
||||
/* creates a copy of a sheet
|
||||
* The linked data itself (EEDrawList) is not duplicated
|
||||
*/
|
||||
{
|
||||
DrawSheetStruct* newitem = new DrawSheetStruct( m_Pos );
|
||||
|
||||
|
||||
@ -143,11 +141,14 @@ DrawSheetStruct* DrawSheetStruct::GenCopy()
|
||||
newitem->SetParent( m_Parent );
|
||||
newitem->m_TimeStamp = GetTimeStamp();
|
||||
|
||||
newitem->m_FileName = m_FileName;
|
||||
newitem->m_FileNameSize = m_FileNameSize;
|
||||
/* newitem->m_SheetName = m_SheetName; m_SheetName must be unique for all sub sheets in a given sheet
|
||||
* so we no not duplicate sheet name
|
||||
*/
|
||||
newitem->m_FileName = m_FileName;
|
||||
newitem->m_FileNameSize = m_FileNameSize;
|
||||
|
||||
/* newitem->m_SheetName = m_SheetName; m_SheetName must be unique for
|
||||
* all sub sheets in a given sheet
|
||||
* so we no not duplicate sheet
|
||||
* name
|
||||
*/
|
||||
newitem->m_SheetNameSize = m_SheetNameSize;
|
||||
|
||||
newitem->m_Label = NULL;
|
||||
@ -180,12 +181,11 @@ DrawSheetStruct* DrawSheetStruct::GenCopy()
|
||||
|
||||
/**********************************************************/
|
||||
void DrawSheetStruct::SwapData( DrawSheetStruct* copyitem )
|
||||
{
|
||||
/**********************************************************/
|
||||
|
||||
/* Used if undo / redo command:
|
||||
* swap data between this and copyitem
|
||||
*/
|
||||
{
|
||||
EXCHG( m_Pos, copyitem->m_Pos );
|
||||
EXCHG( m_Size, copyitem->m_Size );
|
||||
EXCHG( m_SheetName, copyitem->m_SheetName );
|
||||
@ -194,7 +194,8 @@ void DrawSheetStruct::SwapData( DrawSheetStruct* copyitem )
|
||||
EXCHG( m_Label, copyitem->m_Label );
|
||||
EXCHG( m_NbLabel, copyitem->m_NbLabel );
|
||||
|
||||
// Ensure sheet labels have their .m_Parent member poiuntin really on their parent, after swapping.
|
||||
// Ensure sheet labels have their .m_Parent member poiuntin really on their
|
||||
// parent, after swapping.
|
||||
Hierarchical_PIN_Sheet_Struct* label = m_Label;
|
||||
while( label )
|
||||
{
|
||||
@ -213,10 +214,11 @@ void DrawSheetStruct::SwapData( DrawSheetStruct* copyitem )
|
||||
|
||||
/********************************************************************/
|
||||
void DrawSheetStruct::Place( WinEDA_SchematicFrame* frame, wxDC* DC )
|
||||
/********************************************************************/
|
||||
{
|
||||
/* Placement en liste des structures si nouveau composant:*/
|
||||
/********************************************************************/
|
||||
/* Place list structures for new sheet. */
|
||||
bool isnew = (m_Flags & IS_NEW) ? true : false;
|
||||
|
||||
if( isnew )
|
||||
{
|
||||
if( !frame->EditSheet( this, DC ) )
|
||||
@ -231,7 +233,7 @@ void DrawSheetStruct::Place( WinEDA_SchematicFrame* frame, wxDC* DC )
|
||||
}
|
||||
|
||||
SCH_ITEM::Place( frame, DC ); //puts it on the EEDrawList.
|
||||
if ( isnew )
|
||||
if( isnew )
|
||||
{
|
||||
frame->SetSheetNumberAndCount();
|
||||
}
|
||||
@ -239,15 +241,15 @@ void DrawSheetStruct::Place( WinEDA_SchematicFrame* frame, wxDC* DC )
|
||||
|
||||
|
||||
/********************************************************************/
|
||||
void DrawSheetStruct::CleanupSheet( WinEDA_SchematicFrame* aFrame, bool aRedraw )
|
||||
void DrawSheetStruct::CleanupSheet( WinEDA_SchematicFrame* aFrame,
|
||||
bool aRedraw )
|
||||
{
|
||||
/********************************************************************/
|
||||
|
||||
/** Function CleanupSheet
|
||||
* Delete pinsheets which are not corresponding to a hierarchal label
|
||||
* Delete pinsheets which are not corresponding to a hierarchical label
|
||||
* @param aRedraw = true to redraw Sheet
|
||||
* @param aFrame = the schematic frame
|
||||
*/
|
||||
{
|
||||
Hierarchical_PIN_Sheet_Struct* Pinsheet, * NextPinsheet;
|
||||
|
||||
if( !IsOK( aFrame, _( "Ok to cleanup this sheet" ) ) )
|
||||
@ -267,7 +269,7 @@ void DrawSheetStruct::CleanupSheet( WinEDA_SchematicFrame* aFrame, bool aRedraw
|
||||
|
||||
HLabel = (SCH_HIERLABEL*) DrawStruct;
|
||||
if( Pinsheet->m_Text.CmpNoCase( HLabel->m_Text ) == 0 )
|
||||
break; // Found!
|
||||
break; // Found!
|
||||
|
||||
HLabel = NULL;
|
||||
}
|
||||
@ -289,26 +291,27 @@ void DrawSheetStruct::CleanupSheet( WinEDA_SchematicFrame* aFrame, bool aRedraw
|
||||
/** Function GetPenSize
|
||||
* @return the size of the "pen" that be used to draw or plot this item
|
||||
*/
|
||||
int DrawSheetStruct::GetPenSize( )
|
||||
int DrawSheetStruct::GetPenSize()
|
||||
{
|
||||
return g_DrawDefaultLineThickness;
|
||||
}
|
||||
|
||||
/**************************************************************************************/
|
||||
|
||||
/*****************************************************************************/
|
||||
void DrawSheetStruct::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
|
||||
const wxPoint& aOffset,
|
||||
int aDrawMode, int aColor )
|
||||
/**************************************************************************************/
|
||||
|
||||
{
|
||||
/*****************************************************************************/
|
||||
/** Function Draw
|
||||
* Draw the hierarchical sheet shape
|
||||
* @param aPanel = the current DrawPanel
|
||||
* @param aDc = the current Device Context
|
||||
* @param aOffset = draw offset (usually wxPoint(0,0))
|
||||
* @param aDrawMode = draw mode
|
||||
* @param aColor = color used to draw sheet. Usually -1 to use the normal color for sheet items
|
||||
* @param aColor = color used to draw sheet. Usually -1 to use the normal
|
||||
* color for sheet items
|
||||
*/
|
||||
{
|
||||
Hierarchical_PIN_Sheet_Struct* SheetLabelStruct;
|
||||
int txtcolor;
|
||||
wxString Text;
|
||||
@ -332,10 +335,11 @@ void DrawSheetStruct::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
|
||||
txtcolor = ReturnLayerColor( LAYER_SHEETNAME );
|
||||
|
||||
Text = wxT( "Sheet: " ) + m_SheetName;
|
||||
DrawGraphicText( aPanel, aDC,
|
||||
wxPoint( pos.x, pos.y - 8 ), (EDA_Colors) txtcolor,
|
||||
Text, TEXT_ORIENT_HORIZ, wxSize( m_SheetNameSize, m_SheetNameSize ),
|
||||
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_BOTTOM, LineWidth, false, false, false );
|
||||
DrawGraphicText( aPanel, aDC, wxPoint( pos.x, pos.y - 8 ),
|
||||
(EDA_Colors) txtcolor, Text, TEXT_ORIENT_HORIZ,
|
||||
wxSize( m_SheetNameSize, m_SheetNameSize ),
|
||||
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_BOTTOM, LineWidth,
|
||||
false, false, false );
|
||||
|
||||
/* Draw text : FileName */
|
||||
if( aColor >= 0 )
|
||||
@ -343,11 +347,11 @@ void DrawSheetStruct::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
|
||||
else
|
||||
txtcolor = ReturnLayerColor( LAYER_SHEETFILENAME );
|
||||
Text = wxT( "File: " ) + m_FileName;
|
||||
DrawGraphicText( aPanel, aDC,
|
||||
wxPoint( pos.x, pos.y + m_Size.y + 4 ),
|
||||
(EDA_Colors) txtcolor,
|
||||
Text, TEXT_ORIENT_HORIZ, wxSize( m_FileNameSize, m_FileNameSize ),
|
||||
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_TOP, LineWidth, false, false, false );
|
||||
DrawGraphicText( aPanel, aDC, wxPoint( pos.x, pos.y + m_Size.y + 4 ),
|
||||
(EDA_Colors) txtcolor, Text, TEXT_ORIENT_HORIZ,
|
||||
wxSize( m_FileNameSize, m_FileNameSize ),
|
||||
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_TOP, LineWidth,
|
||||
false, false, false );
|
||||
|
||||
|
||||
/* Draw text : SheetLabel */
|
||||
@ -363,12 +367,11 @@ void DrawSheetStruct::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
|
||||
|
||||
/*****************************************/
|
||||
EDA_Rect DrawSheetStruct::GetBoundingBox()
|
||||
/*****************************************/
|
||||
|
||||
/** Function GetBoundingBox
|
||||
* @return an EDA_Rect giving the bouding box of the sheet
|
||||
*/
|
||||
{
|
||||
/*****************************************/
|
||||
/** Function GetBoundingBox
|
||||
* @return an EDA_Rect giving the bounding box of the sheet
|
||||
*/
|
||||
int dx, dy;
|
||||
|
||||
// Determine length of texts
|
||||
@ -381,32 +384,34 @@ EDA_Rect DrawSheetStruct::GetBoundingBox()
|
||||
dx = MAX( m_Size.x, textlen1 );
|
||||
dy = m_Size.y + m_SheetNameSize + m_FileNameSize + 16;
|
||||
|
||||
EDA_Rect box( wxPoint( m_Pos.x, m_Pos.y - m_SheetNameSize - 8 ), wxSize( dx, dy ) );
|
||||
EDA_Rect box( wxPoint( m_Pos.x, m_Pos.y - m_SheetNameSize - 8 ),
|
||||
wxSize( dx, dy ) );
|
||||
return box;
|
||||
}
|
||||
|
||||
|
||||
/************************************************/
|
||||
bool DrawSheetStruct::HitTest( const wxPoint& aPosRef )
|
||||
{
|
||||
/************************************************/
|
||||
/** Function HitTest
|
||||
* @return true if the point aPosRef is within item area
|
||||
* @param aPosRef = a wxPoint to test
|
||||
*/
|
||||
{
|
||||
EDA_Rect rect = GetBoundingBox();
|
||||
|
||||
return rect.Inside( aPosRef );
|
||||
}
|
||||
|
||||
|
||||
/************************************/
|
||||
int DrawSheetStruct::ComponentCount()
|
||||
{
|
||||
/************************************/
|
||||
|
||||
/** Function ComponentCount
|
||||
* count our own components, without the power components.
|
||||
* @return the copponent count.
|
||||
* @return the component count.
|
||||
*/
|
||||
{
|
||||
int n = 0;
|
||||
|
||||
if( m_AssociatedScreen )
|
||||
@ -431,17 +436,17 @@ int DrawSheetStruct::ComponentCount()
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************/
|
||||
bool DrawSheetStruct::SearchHierarchy( wxString aFilename, SCH_SCREEN** aScreen )
|
||||
/*******************************************************************************/
|
||||
|
||||
/*****************************************************************************/
|
||||
bool DrawSheetStruct::SearchHierarchy( wxString aFilename,
|
||||
SCH_SCREEN** aScreen )
|
||||
{
|
||||
/*****************************************************************************/
|
||||
/** Function SearchHierarchy
|
||||
* search the existing hierarchy for an instance of screen "FileName".
|
||||
* @param aFilename = the filename to find
|
||||
* @param aFilename = a location to return a pointer to the screen (if found)
|
||||
* @return bool if found, and a pointer to the screen
|
||||
*/
|
||||
{
|
||||
if( m_AssociatedScreen )
|
||||
{
|
||||
EDA_BaseStruct* strct = m_AssociatedScreen->EEDrawList;
|
||||
@ -469,18 +474,18 @@ bool DrawSheetStruct::SearchHierarchy( wxString aFilename, SCH_SCREEN** aScreen
|
||||
/*******************************************************************************/
|
||||
bool DrawSheetStruct::LocatePathOfScreen( SCH_SCREEN* aScreen,
|
||||
DrawSheetPath* aList )
|
||||
{
|
||||
/*******************************************************************************/
|
||||
|
||||
/** Function LocatePathOfScreen
|
||||
* search the existing hierarchy for an instance of screen "FileName".
|
||||
* don't bother looking at the root sheet - it must be unique,
|
||||
* no other references to its m_AssociatedScreen otherwise there would be loops
|
||||
* no other references to its m_AssociatedScreen otherwise there would be
|
||||
* loops
|
||||
* in the hierarchy.
|
||||
* @param aScreen = the SCH_SCREEN* screen that we search for
|
||||
* @param aList = the DrawSheetPath* that must be used
|
||||
* @return true if found
|
||||
*/
|
||||
{
|
||||
if( m_AssociatedScreen )
|
||||
{
|
||||
aList->Push( this );
|
||||
@ -506,8 +511,8 @@ bool DrawSheetStruct::LocatePathOfScreen( SCH_SCREEN* aScreen,
|
||||
|
||||
/**********************************************************/
|
||||
bool DrawSheetStruct::Load( WinEDA_SchematicFrame* aFrame )
|
||||
{
|
||||
/***********************************************************/
|
||||
|
||||
/** Function Load.
|
||||
* for the sheet: load the file m_FileName
|
||||
* if a screen already exists, the file is already read.
|
||||
@ -516,7 +521,6 @@ bool DrawSheetStruct::Load( WinEDA_SchematicFrame* aFrame )
|
||||
* @param aFrame = a WinEDA_SchematicFrame pointer to the maim schematic frame
|
||||
* @return true if OK
|
||||
*/
|
||||
{
|
||||
bool success = true;
|
||||
|
||||
if( !m_AssociatedScreen )
|
||||
@ -557,13 +561,13 @@ bool DrawSheetStruct::Load( WinEDA_SchematicFrame* aFrame )
|
||||
|
||||
/**********************************/
|
||||
int DrawSheetStruct::CountSheets()
|
||||
{
|
||||
/**********************************/
|
||||
/** Function CountSheets
|
||||
* calculates the number of sheets found in "this"
|
||||
* this number includes the full subsheets count
|
||||
* @return the full count of sheets+subsheets contained by "this"
|
||||
*/
|
||||
{
|
||||
int count = 1; //1 = this!!
|
||||
|
||||
if( m_AssociatedScreen )
|
||||
@ -584,8 +588,8 @@ int DrawSheetStruct::CountSheets()
|
||||
|
||||
/******************************************/
|
||||
wxString DrawSheetStruct::GetFileName( void )
|
||||
/******************************************/
|
||||
{
|
||||
/******************************************/
|
||||
return m_FileName;
|
||||
}
|
||||
|
||||
@ -593,16 +597,18 @@ wxString DrawSheetStruct::GetFileName( void )
|
||||
/************************************************************************/
|
||||
bool DrawSheetStruct::ChangeFileName( WinEDA_SchematicFrame* aFrame,
|
||||
const wxString& aFileName )
|
||||
{
|
||||
/************************************************************************/
|
||||
/** Function ChangeFileName
|
||||
* Set a new filename and manage data and associated screen
|
||||
* The main difficulty is the filename change in a complex hierarchy.
|
||||
* - if new filename is not already used: change to the new name (and if an existing file is found, load it on request)
|
||||
* - if new filename is already used (a complex hierarchy) : reference the sheet.
|
||||
* - if new filename is not already used: change to the new name (and if an
|
||||
* existing file is found, load it on request)
|
||||
* - if new filename is already used (a complex hierarchy) : reference the
|
||||
* sheet.
|
||||
* @param aFileName = the new filename
|
||||
* @param aFrame = the schematic frame
|
||||
*/
|
||||
{
|
||||
if( (GetFileName() == aFileName) && m_AssociatedScreen )
|
||||
return true;
|
||||
|
||||
@ -611,45 +617,52 @@ bool DrawSheetStruct::ChangeFileName( WinEDA_SchematicFrame* aFrame,
|
||||
bool LoadFromFile = false;
|
||||
|
||||
|
||||
if( g_RootSheet->SearchHierarchy( aFileName, &Screen_to_use ) ) //do we reload the data from the existing hierarchy
|
||||
// do we reload the data from the existing hierarchy
|
||||
if( g_RootSheet->SearchHierarchy( aFileName, &Screen_to_use ) )
|
||||
{
|
||||
if( m_AssociatedScreen ) //upon initial load, this will be null.
|
||||
if( m_AssociatedScreen ) // upon initial load, this will be null.
|
||||
{
|
||||
msg.Printf( _(
|
||||
"A Sub Hierarchy named %s exists, Use it (The data in this sheet will be replaced)?" ),
|
||||
aFileName.GetData() );
|
||||
msg.Printf( _( "A Sub Hierarchy named %s exists, Use it (The \
|
||||
data in this sheet will be replaced)?" ),
|
||||
aFileName.GetData() );
|
||||
if( !IsOK( NULL, msg ) )
|
||||
{
|
||||
DisplayInfoMessage( (wxWindow*)NULL, _( "Sheet Filename Renaming Aborted" ) );
|
||||
DisplayInfoMessage( (wxWindow*) NULL,
|
||||
_( "Sheet Filename Renaming Aborted" ) );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if( wxFileExists( aFileName ) ) //do we reload the data from an existing file
|
||||
else if( wxFileExists( aFileName ) ) // do we reload the data from
|
||||
// an existing file
|
||||
{
|
||||
msg.Printf( _(
|
||||
"A file named %s exists, load it (otherwise keep current sheet data if possible)?" ),
|
||||
msg.Printf( _( "A file named %s exists, load it (otherwise keep \
|
||||
current sheet data if possible)?" ),
|
||||
aFileName.GetData() );
|
||||
if( IsOK( NULL, msg ) )
|
||||
{
|
||||
LoadFromFile = true;
|
||||
if( m_AssociatedScreen ) // Can be NULL if loading a file when creating a new sheet
|
||||
|
||||
// Can be NULL if loading a file when creating a new sheet.
|
||||
if( m_AssociatedScreen )
|
||||
{
|
||||
m_AssociatedScreen->m_RefCount--; //be careful with these
|
||||
m_AssociatedScreen->m_RefCount--; // be careful with these
|
||||
if( m_AssociatedScreen->m_RefCount == 0 )
|
||||
SAFE_DELETE( m_AssociatedScreen );
|
||||
m_AssociatedScreen = NULL; //will be created later
|
||||
m_AssociatedScreen = NULL; // will be created later
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// if an associated screen exists, shared between this sheet and others sheets, what we do ?
|
||||
// if an associated screen exists, shared between this sheet and others
|
||||
// sheets, what we do ?
|
||||
if( m_AssociatedScreen && ( m_AssociatedScreen->m_RefCount > 1 ) )
|
||||
{
|
||||
msg = _( "This sheet uses shared data in a complex hierarchy" );
|
||||
msg << wxT( "\n" );
|
||||
msg << _(
|
||||
"Do we convert it in a simple hierarchical sheet (otherwise delete current sheet data)" );
|
||||
msg << _( "Do we convert it in a simple hierarchical sheet (\
|
||||
otherwise delete current sheet data)" );
|
||||
|
||||
if( IsOK( NULL, msg ) )
|
||||
{
|
||||
LoadFromFile = true;
|
||||
@ -665,13 +678,14 @@ bool DrawSheetStruct::ChangeFileName( WinEDA_SchematicFrame* aFrame,
|
||||
|
||||
SetFileName( aFileName );
|
||||
|
||||
// if we use new data (from file or from internal hierarchy), delete the current sheet data
|
||||
// if we use new data (from file or from internal hierarchy), delete the
|
||||
// current sheet data
|
||||
if( m_AssociatedScreen && (LoadFromFile || Screen_to_use) )
|
||||
{
|
||||
m_AssociatedScreen->m_RefCount--;
|
||||
if( m_AssociatedScreen->m_RefCount == 0 )
|
||||
SAFE_DELETE( m_AssociatedScreen );
|
||||
m_AssociatedScreen = NULL; //so that we reload..
|
||||
m_AssociatedScreen = NULL; // so that we reload..
|
||||
}
|
||||
|
||||
if( LoadFromFile )
|
||||
@ -687,7 +701,7 @@ bool DrawSheetStruct::ChangeFileName( WinEDA_SchematicFrame* aFrame,
|
||||
if( !m_AssociatedScreen )
|
||||
{
|
||||
m_AssociatedScreen = new SCH_SCREEN();
|
||||
m_AssociatedScreen->m_RefCount++; //be careful with these
|
||||
m_AssociatedScreen->m_RefCount++; // be careful with these
|
||||
}
|
||||
m_AssociatedScreen->m_FileName = aFileName;
|
||||
|
||||
@ -708,7 +722,7 @@ void DrawSheetStruct::DisplayInfo( WinEDA_DrawFrame* frame )
|
||||
* mirror item relative to an Y axis
|
||||
* @param aYaxis_position = the y axis position
|
||||
*/
|
||||
void DrawSheetStruct::Mirror_Y(int aYaxis_position)
|
||||
void DrawSheetStruct::Mirror_Y( int aYaxis_position )
|
||||
{
|
||||
m_Pos.x -= aYaxis_position;
|
||||
NEGATE( m_Pos.x );
|
||||
@ -716,7 +730,7 @@ void DrawSheetStruct::Mirror_Y(int aYaxis_position)
|
||||
|
||||
m_Pos.x -= m_Size.x;
|
||||
|
||||
Hierarchical_PIN_Sheet_Struct* label = m_Label;
|
||||
Hierarchical_PIN_Sheet_Struct* label = m_Label;
|
||||
while( label != NULL )
|
||||
{
|
||||
label->Mirror_Y( aYaxis_position );
|
||||
@ -732,12 +746,12 @@ void DrawSheetStruct::Show( int nestLevel, std::ostream& os )
|
||||
wxString s = GetClass();
|
||||
|
||||
NestedSpace( nestLevel, os ) << '<' << s.Lower().mb_str() << ">"
|
||||
<< " sheet_name=\"" << CONV_TO_UTF8( m_SheetName ) << '"'
|
||||
<< ">\n";
|
||||
<< " sheet_name=\"" << CONV_TO_UTF8( m_SheetName )
|
||||
<< '"' << ">\n";
|
||||
|
||||
// show all the pins, and check the linked list integrity
|
||||
Hierarchical_PIN_Sheet_Struct* label;
|
||||
for( label = m_Label; label; label = label->Next() )
|
||||
for( label = m_Label; label; label = label->Next() )
|
||||
{
|
||||
label->Show( nestLevel + 1, os );
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/********************************************/
|
||||
/* Definitions for the EESchema program: */
|
||||
/* Definitions for the EESchema program: */
|
||||
/********************************************/
|
||||
|
||||
#ifndef CLASS_DRAWSHEET_H
|
||||
@ -10,8 +10,10 @@
|
||||
extern DrawSheetStruct* g_RootSheet;
|
||||
|
||||
/* class Hierarchical_PIN_Sheet_Struct
|
||||
* a Hierarchical_PIN_Sheet_Struct is for a hierarchical sheet like a pin for a component
|
||||
* At root level, a Hierarchical_PIN_Sheet_Struct must be connected to a wire, bus or label
|
||||
* a Hierarchical_PIN_Sheet_Struct is for a hierarchical sheet like a pin for
|
||||
* a component
|
||||
* At root level, a Hierarchical_PIN_Sheet_Struct must be connected to a wire,
|
||||
* bus or label
|
||||
* A sheet level it corresponds to a hierarchical label.
|
||||
*/
|
||||
class Hierarchical_PIN_Sheet_Struct : public SCH_ITEM,
|
||||
@ -20,13 +22,13 @@ class Hierarchical_PIN_Sheet_Struct : public SCH_ITEM,
|
||||
public:
|
||||
int m_Edge, m_Shape;
|
||||
bool m_IsDangling; // TRUE non connected
|
||||
int m_Number; // used to numbered labels when writing data on file . m_Number >= 2
|
||||
int m_Number; // used to numbered labels when writing data on file .
|
||||
// m_Number >= 2
|
||||
// value 0 is for sheet name and 1 for sheet filename
|
||||
|
||||
public:
|
||||
Hierarchical_PIN_Sheet_Struct( DrawSheetStruct* parent,
|
||||
const wxPoint& pos = wxPoint( 0, 0 ),
|
||||
const wxString& text = wxEmptyString );
|
||||
public: Hierarchical_PIN_Sheet_Struct( DrawSheetStruct* parent,
|
||||
const wxPoint& pos = wxPoint( 0, 0 ),
|
||||
const wxString& text = wxEmptyString );
|
||||
|
||||
~Hierarchical_PIN_Sheet_Struct() { }
|
||||
|
||||
@ -38,56 +40,67 @@ public:
|
||||
|
||||
Hierarchical_PIN_Sheet_Struct* GenCopy();
|
||||
|
||||
Hierarchical_PIN_Sheet_Struct* Next() { return (Hierarchical_PIN_Sheet_Struct*) Pnext; }
|
||||
Hierarchical_PIN_Sheet_Struct* Next()
|
||||
{
|
||||
return ( Hierarchical_PIN_Sheet_Struct*) Pnext;
|
||||
}
|
||||
|
||||
void Place( WinEDA_SchematicFrame* frame, wxDC* DC );
|
||||
void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
|
||||
int draw_mode, int Color = -1 );
|
||||
void Place( WinEDA_SchematicFrame* frame,
|
||||
wxDC* DC );
|
||||
void Draw( WinEDA_DrawPanel* panel,
|
||||
wxDC* DC,
|
||||
const wxPoint& offset,
|
||||
int draw_mode,
|
||||
int Color = -1 );
|
||||
|
||||
/**
|
||||
* Function Save
|
||||
* writes the data structures for this object out to a FILE in "*.sch" format.
|
||||
* writes the data structures for this object out to a FILE in "*.sch"
|
||||
* format.
|
||||
* @param aFile The FILE to write to.
|
||||
* @return bool - true if success writing else false.
|
||||
*/
|
||||
bool Save( FILE* aFile ) const;
|
||||
bool Save( FILE* aFile ) const;
|
||||
|
||||
#if defined (DEBUG)
|
||||
#if defined(DEBUG)
|
||||
|
||||
// comment inherited by Doxygen from Base_Struct
|
||||
void Show( int nestLevel, std::ostream& os );
|
||||
void Show( int nestLevel, std::ostream& os );
|
||||
|
||||
#endif
|
||||
|
||||
/** Function GetPenSize
|
||||
* @return the size of the "pen" that be used to draw or plot this item
|
||||
*/
|
||||
virtual int GetPenSize( );
|
||||
virtual int GetPenSize();
|
||||
|
||||
/** function CreateGraphicShape
|
||||
* Calculates the graphic shape (a polygon) associated to the text
|
||||
* @param aCorner_list = list to fill with polygon corners coordinates
|
||||
* @param Pos = Position of the shape
|
||||
*/
|
||||
void CreateGraphicShape( std::vector <wxPoint>& aCorner_list, const wxPoint& Pos );
|
||||
void CreateGraphicShape( std::vector <wxPoint>& aCorner_list,
|
||||
const wxPoint& Pos );
|
||||
|
||||
// Geometric transforms (used in block operations):
|
||||
|
||||
/** virtual function Move
|
||||
* move item to a new position.
|
||||
* @param aMoveVector = the deplacement vector
|
||||
* @param aMoveVector = the displacement vector
|
||||
*/
|
||||
virtual void Move(const wxPoint& aMoveVector)
|
||||
virtual void Move( const wxPoint& aMoveVector )
|
||||
{
|
||||
m_Pos += aMoveVector;
|
||||
}
|
||||
|
||||
|
||||
/** virtual function Mirror_Y
|
||||
* mirror item relative to an Y axis
|
||||
* @param aYaxis_position = the y axis position
|
||||
*/
|
||||
virtual void Mirror_Y(int aYaxis_position)
|
||||
virtual void Mirror_Y( int aYaxis_position )
|
||||
{
|
||||
m_Edge = m_Edge ? 0 : 1;
|
||||
m_Edge = m_Edge ? 0 : 1;
|
||||
m_Pos.x -= aYaxis_position;
|
||||
NEGATE( m_Pos.x );
|
||||
m_Pos.x += aYaxis_position;
|
||||
@ -96,32 +109,41 @@ public:
|
||||
|
||||
|
||||
/* class DrawSheetStruct
|
||||
* This class is the sheet symbol placed in a schematic, and is the entry point for a sub schematic
|
||||
* This class is the sheet symbol placed in a schematic, and is the entry point
|
||||
* for a sub schematic
|
||||
*/
|
||||
|
||||
class DrawSheetStruct : public SCH_ITEM
|
||||
{
|
||||
public:
|
||||
wxString m_SheetName; /*this is equivalent to C101 for components:
|
||||
* it is stored in F0 ... of the file. */
|
||||
wxString m_SheetName; /* this is equivalent to C101 for
|
||||
* components: it is stored in F0 ...
|
||||
* of the file. */
|
||||
private:
|
||||
wxString m_FileName; /*also in SCH_SCREEN (redundant),
|
||||
* but need it here for loading after
|
||||
* reading the sheet description from file. */
|
||||
* reading the sheet description from
|
||||
* file. */
|
||||
public:
|
||||
int m_SheetNameSize; /* Size (height) of the text, used to draw the sheet name */
|
||||
int m_FileNameSize; /* Size (height) of the text, used to draw the file name */
|
||||
int m_SheetNameSize; /* Size (height) of the text, used to
|
||||
* draw the sheet name */
|
||||
int m_FileNameSize; /* Size (height) of the text, used to
|
||||
* draw the file name */
|
||||
wxPoint m_Pos;
|
||||
wxSize m_Size; /* Position and Size of sheet symbol */
|
||||
wxSize m_Size; /* Position and Size of *sheet symbol */
|
||||
int m_Layer;
|
||||
Hierarchical_PIN_Sheet_Struct* m_Label; /* Points de connection, linked list.*/
|
||||
int m_NbLabel; /* Pins sheet (corresponding to hierarchical labels) count */
|
||||
SCH_SCREEN* m_AssociatedScreen; /* Associated Screen which handle the physical data
|
||||
* In complex hierarchies we can have many DrawSheetStruct using the same data
|
||||
*/
|
||||
Hierarchical_PIN_Sheet_Struct* m_Label; /* Points Be connection, linked
|
||||
* list.*/
|
||||
int m_NbLabel; /* Pins sheet (corresponding to
|
||||
* hierarchical labels) count */
|
||||
SCH_SCREEN* m_AssociatedScreen; /* Associated Screen which
|
||||
* handle the physical data
|
||||
* In complex hierarchies we
|
||||
* can have many DrawSheetStruct
|
||||
* using the same data
|
||||
*/
|
||||
|
||||
public:
|
||||
DrawSheetStruct( const wxPoint& pos = wxPoint( 0, 0 ) );
|
||||
public: DrawSheetStruct( const wxPoint& pos = wxPoint( 0, 0 ) );
|
||||
~DrawSheetStruct();
|
||||
virtual wxString GetClass() const
|
||||
{
|
||||
@ -131,7 +153,8 @@ public:
|
||||
|
||||
/**
|
||||
* Function Save
|
||||
* writes the data structures for this object out to a FILE in "*.brd" format.
|
||||
* writes the data structures for this object out to a FILE in "*.sch"
|
||||
* format.
|
||||
* @param aFile The FILE to write to.
|
||||
* @return bool - true if success writing else false.
|
||||
*/
|
||||
@ -142,7 +165,7 @@ public:
|
||||
void DisplayInfo( WinEDA_DrawFrame* frame );
|
||||
|
||||
/** Function CleanupSheet
|
||||
* Delete pinsheets which are not corresponding to a hierarchal label
|
||||
* Delete pinsheets which are not corresponding to a hierarchical label
|
||||
* @param aRedraw = true to redraw Sheet
|
||||
* @param aFrame = the schematic frame
|
||||
*/
|
||||
@ -151,7 +174,7 @@ public:
|
||||
/** Function GetPenSize
|
||||
* @return the size of the "pen" that be used to draw or plot this item
|
||||
*/
|
||||
virtual int GetPenSize( );
|
||||
virtual int GetPenSize();
|
||||
|
||||
/** Function Draw
|
||||
* Draw the hierarchical sheet shape
|
||||
@ -159,71 +182,80 @@ public:
|
||||
* @param aDc = the current Device Context
|
||||
* @param aOffset = draw offset (usually wxPoint(0,0))
|
||||
* @param aDrawMode = draw mode
|
||||
* @param aColor = color used to draw sheet. Usually -1 to use the normal color for sheet items
|
||||
* @param aColor = color used to draw sheet. Usually -1 to use the normal
|
||||
* color for sheet items
|
||||
*/
|
||||
void Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, const wxPoint& aOffset,
|
||||
int aDrawMode, int aColor = -1 );
|
||||
void Draw( WinEDA_DrawPanel* aPanel,
|
||||
wxDC* aDC,
|
||||
const wxPoint& aOffset,
|
||||
int aDrawMode,
|
||||
int aColor = -1 );
|
||||
|
||||
/** Function HitTest
|
||||
* @return true if the point aPosRef is within item area
|
||||
* @param aPosRef = a wxPoint to test
|
||||
*/
|
||||
bool HitTest( const wxPoint& aPosRef );
|
||||
bool HitTest( const wxPoint& aPosRef );
|
||||
|
||||
/** Function GetBoundingBox
|
||||
* @return an EDA_Rect giving the bouding box of the sheet
|
||||
* @return an EDA_Rect giving the bounding box of the sheet
|
||||
*/
|
||||
EDA_Rect GetBoundingBox();
|
||||
EDA_Rect GetBoundingBox();
|
||||
|
||||
void SwapData( DrawSheetStruct* copyitem );
|
||||
void SwapData( DrawSheetStruct* copyitem );
|
||||
|
||||
/** Function ComponentCount
|
||||
* count our own components, without the power components.
|
||||
* @return the component count.
|
||||
*/
|
||||
int ComponentCount();
|
||||
int ComponentCount();
|
||||
|
||||
/** Function Load.
|
||||
* for the sheet: load the file m_FileName
|
||||
* if a screen already exists, the file is already read.
|
||||
* m_AssociatedScreen point on the screen, and its m_RefCount is incremented
|
||||
* m_AssociatedScreen point on the screen, and its m_RefCount is
|
||||
* incremented
|
||||
* else creates a new associated screen and load the data file.
|
||||
* @param aFrame = a WinEDA_SchematicFrame pointer to the maim schematic frame
|
||||
* @param aFrame = a WinEDA_SchematicFrame pointer to the maim schematic
|
||||
* frame
|
||||
* @return true if OK
|
||||
*/
|
||||
bool Load( WinEDA_SchematicFrame* aFrame );
|
||||
bool Load( WinEDA_SchematicFrame* aFrame );
|
||||
|
||||
/** Function SearchHierarchy
|
||||
* search the existing hierarchy for an instance of screen "FileName".
|
||||
* @param aFilename = the filename to find
|
||||
* @param aFilename = a location to return a pointer to the screen (if found)
|
||||
* @param aFilename = a location to return a pointer to the screen (if
|
||||
* found)
|
||||
* @return bool if found, and a pointer to the screen
|
||||
*/
|
||||
bool SearchHierarchy( wxString aFilename, SCH_SCREEN** aScreen );
|
||||
bool SearchHierarchy( wxString aFilename, SCH_SCREEN** aScreen );
|
||||
|
||||
/** Function LocatePathOfScreen
|
||||
* search the existing hierarchy for an instance of screen "FileName".
|
||||
* don't bother looking at the root sheet - it must be unique,
|
||||
* no other references to its m_AssociatedScreen otherwise there would be loops
|
||||
* no other references to its m_AssociatedScreen otherwise there would be
|
||||
* loops
|
||||
* in the hierarchy.
|
||||
* @param aScreen = the SCH_SCREEN* screen that we search for
|
||||
* @param aList = the DrawSheetPath* that must be used
|
||||
* @return true if found
|
||||
*/
|
||||
bool LocatePathOfScreen( SCH_SCREEN* aScreen, DrawSheetPath* aList );
|
||||
bool LocatePathOfScreen( SCH_SCREEN* aScreen,
|
||||
DrawSheetPath* aList );
|
||||
|
||||
/** Function CountSheets
|
||||
* calculates the number of sheets found in "this"
|
||||
* this number includes the full subsheets count
|
||||
* @return the full count of sheets+subsheets contained by "this"
|
||||
*/
|
||||
int CountSheets();
|
||||
int CountSheets();
|
||||
|
||||
/** Function GetFileName
|
||||
* return the filename corresponding to this sheet
|
||||
* @return a wxString containing the filename
|
||||
*/
|
||||
wxString GetFileName( void );
|
||||
wxString GetFileName( void );
|
||||
|
||||
// Set a new filename without changing anything else
|
||||
void SetFileName( const wxString& aFilename )
|
||||
@ -235,26 +267,30 @@ public:
|
||||
/** Function ChangeFileName
|
||||
* Set a new filename and manage data and associated screen
|
||||
* The main difficulty is the filename change in a complex hierarchy.
|
||||
* - if new filename is not already used: change to the new name (and if an existing file is found, load it on request)
|
||||
* - if new filename is already used (a complex hierarchy) : reference the sheet.
|
||||
* - if new filename is not already used: change to the new name (and if an
|
||||
* existing file is found, load it on request)
|
||||
* - if new filename is already used (a complex hierarchy) : reference the
|
||||
* sheet.
|
||||
* @param aFileName = the new filename
|
||||
* @param aFrame = the schematic frame
|
||||
*/
|
||||
bool ChangeFileName( WinEDA_SchematicFrame* aFrame, const wxString& aFileName );
|
||||
bool ChangeFileName( WinEDA_SchematicFrame* aFrame,
|
||||
const wxString& aFileName );
|
||||
|
||||
//void RemoveSheet(DrawSheetStruct* sheet);
|
||||
//to remove a sheet, just delete it
|
||||
//-- the destructor should take care of everything else.
|
||||
|
||||
// Geometric transforms (used in block operations):
|
||||
|
||||
/** virtual function Move
|
||||
* move item to a new position.
|
||||
* @param aMoveVector = the deplacement vector
|
||||
* @param aMoveVector = the displacement vector
|
||||
*/
|
||||
virtual void Move(const wxPoint& aMoveVector)
|
||||
virtual void Move( const wxPoint& aMoveVector )
|
||||
{
|
||||
m_Pos += aMoveVector;
|
||||
Hierarchical_PIN_Sheet_Struct* label = m_Label;
|
||||
Hierarchical_PIN_Sheet_Struct* label = m_Label;
|
||||
while( label != NULL )
|
||||
{
|
||||
label->Move( aMoveVector );
|
||||
@ -262,16 +298,17 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/** virtual function Mirror_Y
|
||||
* mirror item relative to an Y axis
|
||||
* @param aYaxis_position = the y axis position
|
||||
*/
|
||||
virtual void Mirror_Y(int aYaxis_position);
|
||||
virtual void Mirror_Y( int aYaxis_position );
|
||||
|
||||
#if defined (DEBUG)
|
||||
#if defined(DEBUG)
|
||||
|
||||
// comment inherited by Doxygen from Base_Struct
|
||||
void Show( int nestLevel, std::ostream& os );
|
||||
void Show( int nestLevel, std::ostream& os );
|
||||
|
||||
#endif
|
||||
};
|
||||
|
@ -1,10 +1,11 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// Name: class_drawsheet.cpp
|
||||
// Purpose: member functions for DrawSheetStruct
|
||||
// header = class_drawsheet.h
|
||||
// Purpose: member functions for DrawSheetStruct
|
||||
// header = class_drawsheet.h
|
||||
// Author: jean-pierre Charras
|
||||
// Modified by:
|
||||
// Licence: License GNU
|
||||
// License: License GNU
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "fctsys.h"
|
||||
@ -15,7 +16,7 @@
|
||||
|
||||
|
||||
/**********************************************/
|
||||
/* class to handle a serie of sheets *********/
|
||||
/* class to handle a series of sheets *********/
|
||||
/* a 'path' so to speak.. *********************/
|
||||
/**********************************************/
|
||||
DrawSheetPath::DrawSheetPath()
|
||||
@ -26,22 +27,26 @@ DrawSheetPath::DrawSheetPath()
|
||||
m_numSheets = 0;
|
||||
}
|
||||
|
||||
/*********************************************************************************************/
|
||||
bool DrawSheetPath::BuildSheetPathInfoFromSheetPathValue(const wxString & aPath, bool aFound )
|
||||
/*********************************************************************************************/
|
||||
|
||||
/****************************************************************************/
|
||||
bool DrawSheetPath::BuildSheetPathInfoFromSheetPathValue(
|
||||
const wxString& aPath,
|
||||
bool aFound )
|
||||
{
|
||||
/****************************************************************************/
|
||||
/** Function BuildSheetPathInfoFromSheetPathValue
|
||||
* Fill this with data to acces to the hierarchical sheet known by its path aPath
|
||||
* Fill this with data to access to the hierarchical sheet known by its path
|
||||
* aPath
|
||||
* @param aPath = path of the sheet to reach (in non human readable format)
|
||||
* @return true if success else false
|
||||
*/
|
||||
{
|
||||
if ( aFound )
|
||||
if( aFound )
|
||||
return true;
|
||||
|
||||
if ( GetSheetsCount() == 0 )
|
||||
if( GetSheetsCount() == 0 )
|
||||
Push( g_RootSheet );
|
||||
|
||||
if ( aPath == Path() )
|
||||
if( aPath == Path() )
|
||||
return true;
|
||||
|
||||
SCH_ITEM* schitem = LastDrawList();
|
||||
@ -51,25 +56,26 @@ bool DrawSheetPath::BuildSheetPathInfoFromSheetPathValue(const wxString & aPath,
|
||||
{
|
||||
DrawSheetStruct* sheet = (DrawSheetStruct*) schitem;
|
||||
Push( sheet );
|
||||
if ( aPath == Path() )
|
||||
if( aPath == Path() )
|
||||
return true;
|
||||
if ( BuildSheetPathInfoFromSheetPathValue( aPath ) )
|
||||
if( BuildSheetPathInfoFromSheetPathValue( aPath ) )
|
||||
return true;
|
||||
Pop();
|
||||
}
|
||||
schitem = schitem->Next();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************/
|
||||
int DrawSheetPath::Cmp( const DrawSheetPath& aSheetPathToTest ) const
|
||||
/********************************************************************/
|
||||
|
||||
/** Function Cmp
|
||||
* Compare if this is the same sheet path as aSheetPathToTest
|
||||
* @param aSheetPathToTest = sheet path to compare
|
||||
* @return -1 if differents, 0 if same
|
||||
* @return -1 if different, 0 if same
|
||||
*/
|
||||
{
|
||||
if( m_numSheets > aSheetPathToTest.m_numSheets )
|
||||
@ -80,9 +86,11 @@ int DrawSheetPath::Cmp( const DrawSheetPath& aSheetPathToTest ) const
|
||||
//otherwise, same number of sheets.
|
||||
for( unsigned i = 0; i<m_numSheets; i++ )
|
||||
{
|
||||
if( m_sheets[i]->m_TimeStamp > aSheetPathToTest.m_sheets[i]->m_TimeStamp )
|
||||
if( m_sheets[i]->m_TimeStamp >
|
||||
aSheetPathToTest.m_sheets[i]->m_TimeStamp )
|
||||
return 1;
|
||||
if( m_sheets[i]->m_TimeStamp < aSheetPathToTest.m_sheets[i]->m_TimeStamp )
|
||||
if( m_sheets[i]->m_TimeStamp <
|
||||
aSheetPathToTest.m_sheets[i]->m_TimeStamp )
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -91,8 +99,8 @@ int DrawSheetPath::Cmp( const DrawSheetPath& aSheetPathToTest ) const
|
||||
|
||||
|
||||
/** Function Last
|
||||
* returns a pointer to the last sheet of the list
|
||||
* One can see the others sheet as the "path" to reach this last sheet
|
||||
* returns a pointer to the last sheet of the list
|
||||
* One can see the others sheet as the "path" to reach this last sheet
|
||||
*/
|
||||
DrawSheetStruct* DrawSheetPath::Last()
|
||||
{
|
||||
@ -127,15 +135,16 @@ SCH_ITEM* DrawSheetPath::LastDrawList()
|
||||
|
||||
/**************************************************/
|
||||
void DrawSheetPath::Push( DrawSheetStruct* aSheet )
|
||||
{
|
||||
/**************************************************/
|
||||
|
||||
/** Function Push
|
||||
* store (push) aSheet in list
|
||||
* @param aSheet = pointer to the DrawSheetStruct to store in list
|
||||
*/
|
||||
{
|
||||
if( m_numSheets > DSLSZ )
|
||||
wxMessageBox( wxT( "DrawSheetPath::Push() error: no room in buffer to store sheet" ) );
|
||||
wxMessageBox( wxT( "DrawSheetPath::Push() error: no room in buffer \
|
||||
to store sheet" ) );
|
||||
|
||||
if( m_numSheets < DSLSZ )
|
||||
{
|
||||
m_sheets[m_numSheets] = aSheet;
|
||||
@ -145,12 +154,11 @@ void DrawSheetPath::Push( DrawSheetStruct* aSheet )
|
||||
|
||||
|
||||
DrawSheetStruct* DrawSheetPath::Pop()
|
||||
|
||||
{
|
||||
/** Function Pop
|
||||
* retrieves (pop) the last entered sheet and remove it from list
|
||||
* @return a DrawSheetStruct* pointer to the removed sheet in list
|
||||
*/
|
||||
{
|
||||
if( m_numSheets > 0 )
|
||||
{
|
||||
m_numSheets--;
|
||||
@ -161,20 +169,20 @@ DrawSheetStruct* DrawSheetPath::Pop()
|
||||
|
||||
|
||||
wxString DrawSheetPath::Path()
|
||||
|
||||
{
|
||||
/** Function Path
|
||||
* the path uses the time stamps which do not changes even when editing sheet parameters
|
||||
* the path uses the time stamps which do not changes even when editing sheet
|
||||
* parameters
|
||||
* a path is something like / (root) or /34005677 or /34005677/00AE4523
|
||||
*/
|
||||
{
|
||||
wxString s, t;
|
||||
|
||||
s = wxT( "/" ); // This is the root path
|
||||
|
||||
//start at 1 to avoid the root sheet,
|
||||
//which does not need to be added to the path
|
||||
//it's timestamp changes anyway.
|
||||
for( unsigned i = 1; i< m_numSheets; i++ )
|
||||
// start at 1 to avoid the root sheet,
|
||||
// which does not need to be added to the path
|
||||
// it's timestamp changes anyway.
|
||||
for( unsigned i = 1; i < m_numSheets; i++ )
|
||||
{
|
||||
t.Printf( _( "%8.8lX/" ), m_sheets[i]->m_TimeStamp );
|
||||
s = s + t;
|
||||
@ -186,19 +194,19 @@ wxString DrawSheetPath::Path()
|
||||
|
||||
/******************************************/
|
||||
wxString DrawSheetPath::PathHumanReadable()
|
||||
{
|
||||
/******************************************/
|
||||
|
||||
/** Function PathHumanReadable
|
||||
* Return the sheet path in a readable form, i.e.
|
||||
* as a path made from sheet names.
|
||||
* (the "normal" path uses the time stamps which do not changes even when editing sheet parameters)
|
||||
* (the "normal" path uses the time stamps which do not changes even when
|
||||
* editing sheet parameters)
|
||||
*/
|
||||
{
|
||||
wxString s, t;
|
||||
|
||||
s = wxT( "/" );
|
||||
|
||||
//start at 1 to avoid the root sheet, as above.
|
||||
// start at 1 to avoid the root sheet, as above.
|
||||
for( unsigned i = 1; i< m_numSheets; i++ )
|
||||
{
|
||||
s = s + m_sheets[i]->m_SheetName + wxT( "/" );
|
||||
@ -210,8 +218,8 @@ wxString DrawSheetPath::PathHumanReadable()
|
||||
|
||||
/***********************************************/
|
||||
void DrawSheetPath::UpdateAllScreenReferences()
|
||||
/***********************************************/
|
||||
{
|
||||
/***********************************************/
|
||||
EDA_BaseStruct* t = LastDrawList();
|
||||
|
||||
while( t )
|
||||
@ -231,12 +239,12 @@ bool DrawSheetPath::operator=( const DrawSheetPath& d1 )
|
||||
{
|
||||
m_numSheets = d1.m_numSheets;
|
||||
unsigned i;
|
||||
for( i = 0; i<m_numSheets; i++ )
|
||||
for( i = 0; i < m_numSheets; i++ )
|
||||
{
|
||||
m_sheets[i] = d1.m_sheets[i];
|
||||
}
|
||||
|
||||
for( ; i<DSLSZ; i++ )
|
||||
for( ; i < DSLSZ; i++ )
|
||||
{
|
||||
m_sheets[i] = 0;
|
||||
}
|
||||
@ -249,7 +257,7 @@ bool DrawSheetPath::operator==( const DrawSheetPath& d1 )
|
||||
{
|
||||
if( m_numSheets != d1.m_numSheets )
|
||||
return false;
|
||||
for( unsigned i = 0; i<m_numSheets; i++ )
|
||||
for( unsigned i = 0; i < m_numSheets; i++ )
|
||||
{
|
||||
if( m_sheets[i] != d1.m_sheets[i] )
|
||||
return false;
|
||||
@ -263,7 +271,7 @@ bool DrawSheetPath::operator!=( const DrawSheetPath& d1 )
|
||||
{
|
||||
if( m_numSheets != d1.m_numSheets )
|
||||
return true;
|
||||
for( unsigned i = 0; i<m_numSheets; i++ )
|
||||
for( unsigned i = 0; i < m_numSheets; i++ )
|
||||
{
|
||||
if( m_sheets[i] != d1.m_sheets[i] )
|
||||
return true;
|
||||
@ -280,13 +288,12 @@ bool DrawSheetPath::operator!=( const DrawSheetPath& d1 )
|
||||
|
||||
/*******************************************************/
|
||||
EDA_SheetList::EDA_SheetList( DrawSheetStruct* aSheet )
|
||||
{
|
||||
/*******************************************************/
|
||||
|
||||
/* The constructor: build the list of sheets from aSheet.
|
||||
* If aSheet == NULL (default) build the whole list of sheets in hierarchy
|
||||
* So usually call it with no param.
|
||||
*/
|
||||
{
|
||||
m_index = 0;
|
||||
m_count = 0;
|
||||
m_List = NULL;
|
||||
@ -298,12 +305,11 @@ EDA_SheetList::EDA_SheetList( DrawSheetStruct* aSheet )
|
||||
|
||||
/*****************************************/
|
||||
DrawSheetPath* EDA_SheetList::GetFirst()
|
||||
{
|
||||
/*****************************************/
|
||||
|
||||
/** Function GetFirst
|
||||
* @return the first item (sheet) in m_List and prepare calls to GetNext()
|
||||
*/
|
||||
{
|
||||
m_index = 0;
|
||||
if( GetCount() > 0 )
|
||||
return &( m_List[0] );
|
||||
@ -313,12 +319,12 @@ DrawSheetPath* EDA_SheetList::GetFirst()
|
||||
|
||||
/*****************************************/
|
||||
DrawSheetPath* EDA_SheetList::GetNext()
|
||||
/*****************************************/
|
||||
|
||||
/** Function GetNext
|
||||
* @return the next item (sheet) in m_List or NULL if no more item in sheet list
|
||||
*/
|
||||
{
|
||||
/*****************************************/
|
||||
/** Function GetNext
|
||||
* @return the next item (sheet) in m_List or NULL if no more item in sheet
|
||||
* list
|
||||
*/
|
||||
if( m_index < GetCount() )
|
||||
m_index++;
|
||||
return GetSheet( m_index );
|
||||
@ -327,29 +333,29 @@ DrawSheetPath* EDA_SheetList::GetNext()
|
||||
|
||||
/************************************************/
|
||||
DrawSheetPath* EDA_SheetList::GetSheet( int aIndex )
|
||||
{
|
||||
/************************************************/
|
||||
|
||||
/** Function GetSheet
|
||||
* @return the item (sheet) in aIndex position in m_List or NULL if less than index items
|
||||
* @return the item (sheet) in aIndex position in m_List or NULL if less than
|
||||
* index items
|
||||
* @param aIndex = index in sheet list to get the sheet
|
||||
*/
|
||||
{
|
||||
if( aIndex < GetCount() )
|
||||
return &(m_List[aIndex]);
|
||||
return &( m_List[aIndex] );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
void EDA_SheetList::BuildSheetList( DrawSheetStruct* aSheet )
|
||||
{
|
||||
/************************************************************************/
|
||||
|
||||
/** Function BuildSheetList
|
||||
* Build the list of sheets and their sheet path from the aSheet sheet
|
||||
* if aSheet = g_RootSheet, the full sheet path list (and full sheet list) is built
|
||||
* if aSheet = g_RootSheet, the full sheet path list (and full sheet list) is
|
||||
* built
|
||||
* @param aSheet = the starting sheet to build list
|
||||
*/
|
||||
{
|
||||
if( m_List == NULL )
|
||||
{
|
||||
int count = aSheet->CountSheets();
|
||||
|
@ -1,5 +1,5 @@
|
||||
/********************************************/
|
||||
/* Definitions for the EESchema program: */
|
||||
/* Definitions for the EESchema program: */
|
||||
/********************************************/
|
||||
|
||||
#ifndef CLASS_DRAWSHEET_PATH_H
|
||||
@ -8,51 +8,60 @@
|
||||
#include "base_struct.h"
|
||||
|
||||
/** Info about complex hierarchies handling:
|
||||
* A hierarchical schematic uses sheets (hierachical sheets) included in a given sheet.
|
||||
* each sheet corresponds to a schematic drawing handled by a SCH_SCREEN structure
|
||||
* a SCH_SCREEN structure contains drawings, and have a filename to write to its data.
|
||||
* Also a SCH_SCREEN display a sheet number and the name of the sheet
|
||||
* In simple (and flat) hierarchies a sheet is linked to a SCH_SCREEN,
|
||||
* A hierarchical schematic uses sheets (hierarchical sheets) included in a
|
||||
* given sheet. Rach sheet corresponds to a schematic drawing handled by a
|
||||
* SCH_SCREEN structure. A SCH_SCREEN structure contains drawings, and have
|
||||
* a filename to write it's data. Also a SCH_SCREEN display a sheet number
|
||||
* and the name of the sheet.
|
||||
*
|
||||
* In simple (and flat) hierarchies a sheet is linked to a SCH_SCREEN,
|
||||
* and a SCH_SCREEN is used by only one hierarchical sheet.
|
||||
*
|
||||
* In complex hierachies the same SCH_SCREEN (and its data) is shared between more than one sheet.
|
||||
* Therefore subsheets (like subsheets in a SCH_SCREEN shared by many sheets) can be also shared
|
||||
* So the same SCH_SCREEN must handle differents components references and parts selection
|
||||
* depending on which sheet is currently selected, and how a given subsheet is selected.
|
||||
* 2 sheets share the same SCH_SCREEN (the same drawings) if they have the same filename.
|
||||
* In complex hierarchies the same SCH_SCREEN (and its data) is shared between
|
||||
* more than one sheet. Therefore subsheets (like subsheets in a SCH_SCREEN
|
||||
* shared by many sheets) can be also shared. So the same SCH_SCREEN must
|
||||
* handle different components references and parts selection depending on
|
||||
* which sheet is currently selected, and how a given subsheet is selected.
|
||||
* 2 sheets share the same SCH_SCREEN (the same drawings) if they have the
|
||||
* same filename.
|
||||
*
|
||||
* In kicad each component and sheet receives (when created) an unique identification called Time Stamp.
|
||||
* So each sheet have 2 id : its time stamp (that cannot change) and its name
|
||||
* ( that can be edited and therefore is not reliable for strong identification)
|
||||
* Kicad uses therefore Time Stamp ( an unique 32 bit id), to identify sheets in hierarchies.
|
||||
* A given sheet in a hierarchy is fully labelled by its path (or sheet path)
|
||||
* that is the list of timestamp found to access it through the hierarchy
|
||||
* the root sheet is /
|
||||
* others have a path like /1234ABCD ou /4567FEDC/AA2233DD/
|
||||
* of course this path can be displayed as human readable sheet name like :
|
||||
* / or /sheet1/include_sheet/ or /sheet2/include_sheet/
|
||||
* In Kicad each component and sheet receives (when created) an unique
|
||||
* identification called Time Stamp. So each sheet has 2 ids: its time stamp
|
||||
* (that cannot change) and its name ( that can be edited and therefore is
|
||||
* not reliable for strong identification). Kicad uses Time Stamp ( a unique
|
||||
* 32 bit id), to identify sheets in hierarchies.
|
||||
* A given sheet in a hierarchy is fully labeled by its path (or sheet path)
|
||||
* that is the list of time stamp found to access it through the hierarchy
|
||||
* the root sheet is /. All other sheets have a path like /1234ABCD or
|
||||
* /4567FEDC/AA2233DD/. This path can be displayed as human readable sheet
|
||||
* name like: / or /sheet1/include_sheet/ or /sheet2/include_sheet/
|
||||
*
|
||||
* So to know for a given SCH_SCREEN (a given schematic drawings) we must:
|
||||
* Handle all references possibilities.
|
||||
* When acceded by a given selected sheet, display (update) the corresponding references and sheet path
|
||||
* 1) Handle all references possibilities.
|
||||
* 2) When acceded by a given selected sheet, display (update) the
|
||||
* corresponding references and sheet path
|
||||
*
|
||||
* the class DrawSheetPath handles paths used to access a sheet
|
||||
* the class EDA_SheetList allows to handle the full (or partial) list of sheets and their paths in a complex hierarchy.
|
||||
* the class EDA_ScreenList allow to handle the list of SCH_SCREEN. It is useful to clear or save data,
|
||||
* but is not suitable to handle the full complex hierarchy possibilities (useable in flat and simple hierarchies).
|
||||
* The class DrawSheetPath handles paths used to access a sheet. The class
|
||||
* EDA_SheetList allows to handle the full (or partial) list of sheets and
|
||||
* their paths in a complex hierarchy. The class EDA_ScreenList allow to
|
||||
* handle the list of SCH_SCREEN. It is useful to clear or save data,
|
||||
* but is not suitable to handle the full complex hierarchy possibilities
|
||||
* (usable in flat and simple hierarchies).
|
||||
*/
|
||||
|
||||
|
||||
/****************************************/
|
||||
/* class to handle and acces to a sheet */
|
||||
/* class to handle and access to a sheet */
|
||||
/* a 'path' so to speak.. */
|
||||
/****************************************/
|
||||
|
||||
/*
|
||||
* The member m_sheets stores the list of sheets from the first (usually g_RootSheet)
|
||||
* to a given sheet in last position.
|
||||
* The last sheet is usually the sheet we want to select or reach. So Last() return this last sheet
|
||||
* Others sheets are the "path" from the first to the last sheet
|
||||
* The member m_sheets stores the list of sheets from the first (usually
|
||||
* g_RootSheet)
|
||||
* to a given sheet in last position.
|
||||
* The last sheet is usually the sheet we want to select or reach. So Last()
|
||||
* return this last sheet
|
||||
* Others sheets are the "path" from the first to the last sheet
|
||||
*/
|
||||
class DrawSheetPath
|
||||
{
|
||||
@ -61,94 +70,103 @@ private:
|
||||
|
||||
public:
|
||||
#define DSLSZ 32 // Max number of levels for a sheet path
|
||||
DrawSheetStruct* m_sheets[DSLSZ];
|
||||
DrawSheetStruct * m_sheets[DSLSZ];
|
||||
|
||||
public:
|
||||
DrawSheetPath();
|
||||
public: DrawSheetPath();
|
||||
~DrawSheetPath() { };
|
||||
void Clear()
|
||||
{ m_numSheets = 0;
|
||||
{
|
||||
m_numSheets = 0;
|
||||
}
|
||||
|
||||
|
||||
unsigned GetSheetsCount()
|
||||
{
|
||||
return m_numSheets;
|
||||
}
|
||||
|
||||
|
||||
/** Function Cmp
|
||||
* Compare if this is the same sheet path as aSheetPathToTest
|
||||
* @param aSheetPathToTest = sheet path to compare
|
||||
* @return -1 if differents, 0 if same
|
||||
* @return -1 if different, 0 if same
|
||||
*/
|
||||
int Cmp( const DrawSheetPath& aSheetPathToTest ) const;
|
||||
int Cmp( const DrawSheetPath& aSheetPathToTest ) const;
|
||||
|
||||
/** Function Last
|
||||
* returns a pointer to the last sheet of the list
|
||||
* One can see the others sheet as the "path" to reach this last sheet
|
||||
* returns a pointer to the last sheet of the list
|
||||
* One can see the others sheet as the "path" to reach this last sheet
|
||||
*/
|
||||
DrawSheetStruct* Last();
|
||||
DrawSheetStruct* Last();
|
||||
|
||||
/** Function LastScreen
|
||||
* @return the SCH_SCREEN relative to the last sheet in list
|
||||
*/
|
||||
SCH_SCREEN* LastScreen();
|
||||
SCH_SCREEN* LastScreen();
|
||||
|
||||
/** Function LastScreen
|
||||
* @return a pointer to the first schematic item handled by the
|
||||
* SCH_SCREEN relative to the last sheet in list
|
||||
*/
|
||||
SCH_ITEM* LastDrawList();
|
||||
SCH_ITEM* LastDrawList();
|
||||
|
||||
/** Function Push
|
||||
* store (push) aSheet in list
|
||||
* @param aSheet = pointer to the DrawSheetStruct to store in list
|
||||
* Push is used when entered a sheet to select or analyse it
|
||||
* Push is used when entered a sheet to select or analyze it
|
||||
* This is like cd <directory> in directories navigation
|
||||
*/
|
||||
void Push( DrawSheetStruct* aSheet );
|
||||
void Push( DrawSheetStruct* aSheet );
|
||||
|
||||
/** Function Pop
|
||||
* retrieves (pop) the last entered sheet and remove it from list
|
||||
* @return a DrawSheetStruct* pointer to the removed sheet in list
|
||||
* Pop is used when leaving a sheet after a selection or analyse
|
||||
* Pop is used when leaving a sheet after a selection or analyze
|
||||
* This is like cd .. in directories navigation
|
||||
*/
|
||||
DrawSheetStruct* Pop();
|
||||
DrawSheetStruct* Pop();
|
||||
|
||||
/** Function Path
|
||||
* the path uses the time stamps which do not changes even when editing sheet parameters
|
||||
* the path uses the time stamps which do not changes even when editing
|
||||
* sheet parameters
|
||||
* a path is something like / (root) or /34005677 or /34005677/00AE4523
|
||||
*/
|
||||
wxString Path();
|
||||
wxString Path();
|
||||
|
||||
/** Function PathHumanReadable
|
||||
* Return the sheet path in a readable form, i.e.
|
||||
* as a path made from sheet names.
|
||||
* (the "normal" path uses the time stamps which do not changes even when editing sheet parameters)
|
||||
* (the "normal" path uses the time stamps which do not changes even when
|
||||
* editing sheet parameters)
|
||||
*/
|
||||
wxString PathHumanReadable();
|
||||
wxString PathHumanReadable();
|
||||
|
||||
/** Function BuildSheetPathInfoFromSheetPathValue
|
||||
* Fill this with data to acces to the hierarchical sheet known by its path aPath
|
||||
* Fill this with data to access to the hierarchical sheet known by its
|
||||
* path aPath
|
||||
* @param aPath = path of the sheet to reach (in non human readable format)
|
||||
* @return true if success else false
|
||||
*/
|
||||
bool BuildSheetPathInfoFromSheetPathValue(const wxString & aPath, bool aFound = false );
|
||||
bool BuildSheetPathInfoFromSheetPathValue(
|
||||
const wxString& aPath,
|
||||
bool aFound = false );
|
||||
|
||||
/**
|
||||
* Function UpdateAllScreenReferences
|
||||
* updates the reference and the m_Multi parameter (part selection) for all
|
||||
* components on a screen depending on the actual sheet path.
|
||||
* Mandatory in complex hierarchies because sheets use the same screen (basic schematic)
|
||||
* but with different references and part selections according to the displayed sheet
|
||||
* Mandatory in complex hierarchies because sheets use the same screen
|
||||
* (basic schematic)
|
||||
* but with different references and part selections according to the
|
||||
* displayed sheet
|
||||
*/
|
||||
void UpdateAllScreenReferences();
|
||||
void UpdateAllScreenReferences();
|
||||
|
||||
bool operator =( const DrawSheetPath& d1 );
|
||||
bool operator =( const DrawSheetPath& d1 );
|
||||
|
||||
bool operator ==( const DrawSheetPath& d1 );
|
||||
bool operator ==( const DrawSheetPath& d1 );
|
||||
|
||||
bool operator !=( const DrawSheetPath& d1 );
|
||||
bool operator !=( const DrawSheetPath& d1 );
|
||||
};
|
||||
|
||||
|
||||
@ -167,16 +185,19 @@ class EDA_SheetList
|
||||
private:
|
||||
DrawSheetPath* m_List;
|
||||
int m_count; /* Number of sheets included in hierarchy,
|
||||
* starting at the given sheet in constructor . the given sheet is counted
|
||||
* starting at the given sheet in constructor .
|
||||
* the given sheet is counted
|
||||
*/
|
||||
int m_index; /* internal variable to handle GetNext(): cleared by GetFirst()
|
||||
* and incremented by GetNext() after returning the next item in m_List
|
||||
* Also used for internal calculations in BuildSheetList()
|
||||
int m_index; /* internal variable to handle GetNext():
|
||||
* cleared by GetFirst()
|
||||
* and incremented by GetNext() after
|
||||
* returning the next item in m_List
|
||||
* Also used for internal calculations in
|
||||
* BuildSheetList()
|
||||
*/
|
||||
DrawSheetPath m_currList;
|
||||
DrawSheetPath m_currList;
|
||||
|
||||
public:
|
||||
|
||||
/* The constructor: build the list of sheets from aSheet.
|
||||
* If aSheet == NULL (default) build the whole list of sheets in hierarchy
|
||||
* So usually call it with no param.
|
||||
@ -200,18 +221,20 @@ public:
|
||||
/** Function GetFirst
|
||||
* @return the first item (sheet) in m_List and prepare calls to GetNext()
|
||||
*/
|
||||
DrawSheetPath* GetFirst();
|
||||
DrawSheetPath* GetFirst();
|
||||
|
||||
/** Function GetNext
|
||||
* @return the next item (sheet) in m_List or NULL if no more item in sheet list
|
||||
* @return the next item (sheet) in m_List or NULL if no more item in
|
||||
* sheet list
|
||||
*/
|
||||
DrawSheetPath* GetNext();
|
||||
DrawSheetPath* GetNext();
|
||||
|
||||
/** Function GetSheet
|
||||
* @return the item (sheet) in aIndex position in m_List or NULL if less than index items
|
||||
* @return the item (sheet) in aIndex position in m_List or NULL if less
|
||||
* than index items
|
||||
* @param aIndex = index in sheet list to get the sheet
|
||||
*/
|
||||
DrawSheetPath* GetSheet( int aIndex );
|
||||
DrawSheetPath* GetSheet( int aIndex );
|
||||
|
||||
private:
|
||||
|
||||
@ -220,7 +243,7 @@ private:
|
||||
* if aSheet = g_RootSheet, the full sheet path and sheet list is built
|
||||
* @param aSheet = the starting sheet from the built is made
|
||||
*/
|
||||
void BuildSheetList( DrawSheetStruct* sheet );
|
||||
void BuildSheetList( DrawSheetStruct* sheet );
|
||||
};
|
||||
|
||||
#endif /* CLASS_DRAWSHEET_PATH_H */
|
||||
|
@ -1,14 +1,14 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// Name: class_hierarchical_PIN_sheet.cpp
|
||||
// Purpose: member functions Hierarchical_PIN_Sheet_Struct
|
||||
// header = class_drawsheet.h
|
||||
// Purpose: member functions Hierarchical_PIN_Sheet_Struct
|
||||
// header = class_drawsheet.h
|
||||
// Author: jean-pierre Charras
|
||||
// Modified by:
|
||||
// Created: 08/02/2006 18:37:02
|
||||
// RCS-ID:
|
||||
// Copyright: License GNU
|
||||
// Licence:
|
||||
// License:
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "fctsys.h"
|
||||
@ -23,13 +23,14 @@
|
||||
|
||||
|
||||
/*******************************************************************/
|
||||
Hierarchical_PIN_Sheet_Struct::Hierarchical_PIN_Sheet_Struct( DrawSheetStruct* parent,
|
||||
const wxPoint& pos,
|
||||
const wxString& text ) :
|
||||
Hierarchical_PIN_Sheet_Struct::Hierarchical_PIN_Sheet_Struct(
|
||||
DrawSheetStruct* parent,
|
||||
const wxPoint& pos,
|
||||
const wxString& text ) :
|
||||
SCH_ITEM( parent, DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE ),
|
||||
EDA_TextStruct( text )
|
||||
/*******************************************************************/
|
||||
{
|
||||
/*******************************************************************/
|
||||
wxASSERT( parent );
|
||||
wxASSERT( Pnext == NULL );
|
||||
m_Layer = LAYER_SHEETLABEL;
|
||||
@ -43,10 +44,11 @@ Hierarchical_PIN_Sheet_Struct::Hierarchical_PIN_Sheet_Struct( DrawSheetStruct* p
|
||||
|
||||
/***********************************************************/
|
||||
Hierarchical_PIN_Sheet_Struct* Hierarchical_PIN_Sheet_Struct::GenCopy()
|
||||
/***********************************************************/
|
||||
{
|
||||
/***********************************************************/
|
||||
Hierarchical_PIN_Sheet_Struct* newitem =
|
||||
new Hierarchical_PIN_Sheet_Struct( (DrawSheetStruct*) m_Parent, m_Pos, m_Text );
|
||||
new Hierarchical_PIN_Sheet_Struct( (DrawSheetStruct*) m_Parent, m_Pos,
|
||||
m_Text );
|
||||
|
||||
newitem->m_Edge = m_Edge;
|
||||
newitem->m_Shape = m_Shape;
|
||||
@ -59,25 +61,28 @@ Hierarchical_PIN_Sheet_Struct* Hierarchical_PIN_Sheet_Struct::GenCopy()
|
||||
/** Function GetPenSize
|
||||
* @return the size of the "pen" that be used to draw or plot this item
|
||||
*/
|
||||
int Hierarchical_PIN_Sheet_Struct::GetPenSize( )
|
||||
int Hierarchical_PIN_Sheet_Struct::GetPenSize()
|
||||
{
|
||||
return g_DrawDefaultLineThickness;
|
||||
}
|
||||
|
||||
|
||||
/********************************************************************************************/
|
||||
void Hierarchical_PIN_Sheet_Struct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
|
||||
int DrawMode, int Color )
|
||||
/********************************************************************************************/
|
||||
/* Routine de dessin des Labels type hierarchie */
|
||||
/*****************************************************************************/
|
||||
void Hierarchical_PIN_Sheet_Struct::Draw( WinEDA_DrawPanel* panel,
|
||||
wxDC* DC,
|
||||
const wxPoint& offset,
|
||||
int DrawMode,
|
||||
int Color )
|
||||
{
|
||||
GRTextHorizJustifyType side;
|
||||
EDA_Colors txtcolor;
|
||||
/*****************************************************************************/
|
||||
/* Routine to create hierarchical labels */
|
||||
GRTextHorizJustifyType side;
|
||||
EDA_Colors txtcolor;
|
||||
int posx, tposx, posy;
|
||||
|
||||
static std::vector <wxPoint> Poly;
|
||||
|
||||
int LineWidth = GetPenSize( );
|
||||
int LineWidth = GetPenSize();
|
||||
|
||||
if( Color >= 0 )
|
||||
txtcolor = (EDA_Colors) Color;
|
||||
@ -85,8 +90,8 @@ void Hierarchical_PIN_Sheet_Struct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, con
|
||||
txtcolor = ReturnLayerColor( m_Layer );
|
||||
GRSetDrawMode( DC, DrawMode );
|
||||
|
||||
posx = m_Pos.x + offset.x;
|
||||
posy = m_Pos.y + offset.y;
|
||||
posx = m_Pos.x + offset.x;
|
||||
posy = m_Pos.y + offset.y;
|
||||
wxSize size = m_Size;
|
||||
|
||||
if( !m_Text.IsEmpty() )
|
||||
@ -102,15 +107,15 @@ void Hierarchical_PIN_Sheet_Struct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, con
|
||||
side = GR_TEXT_HJUSTIFY_LEFT;
|
||||
}
|
||||
DrawGraphicText( panel, DC, wxPoint( tposx, posy ), txtcolor,
|
||||
m_Text, TEXT_ORIENT_HORIZ, size,
|
||||
side, GR_TEXT_VJUSTIFY_CENTER, LineWidth, false, false );
|
||||
m_Text, TEXT_ORIENT_HORIZ, size, side,
|
||||
GR_TEXT_VJUSTIFY_CENTER, LineWidth, false, false );
|
||||
}
|
||||
|
||||
/* Draw the graphic symbol */
|
||||
CreateGraphicShape( Poly, m_Pos + offset );
|
||||
int FillShape = false;
|
||||
GRPoly( &panel->m_ClipBox, DC, Poly.size(), &Poly[0],
|
||||
FillShape, LineWidth, txtcolor, txtcolor ); /* Poly Non rempli */
|
||||
FillShape, LineWidth, txtcolor, txtcolor );
|
||||
}
|
||||
|
||||
|
||||
@ -119,8 +124,9 @@ void Hierarchical_PIN_Sheet_Struct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, con
|
||||
* @param aCorner_list = list to fill with polygon corners coordinates
|
||||
* @param Pos = Position of the shape
|
||||
*/
|
||||
void Hierarchical_PIN_Sheet_Struct::CreateGraphicShape( std::vector <wxPoint>& aCorner_list,
|
||||
const wxPoint& Pos )
|
||||
void Hierarchical_PIN_Sheet_Struct::CreateGraphicShape(
|
||||
std::vector <wxPoint>& aCorner_list,
|
||||
const wxPoint& Pos )
|
||||
{
|
||||
wxSize size = m_Size;
|
||||
|
||||
@ -206,8 +212,7 @@ bool Hierarchical_PIN_Sheet_Struct::Save( FILE* aFile ) const
|
||||
}
|
||||
|
||||
if( fprintf( aFile, "F%d \"%s\" %c %c %-3d %-3d %-3d\n", m_Number,
|
||||
CONV_TO_UTF8( m_Text ), type, side,
|
||||
m_Pos.x, m_Pos.y,
|
||||
CONV_TO_UTF8( m_Text ), type, side, m_Pos.x, m_Pos.y,
|
||||
m_Size.x ) == EOF )
|
||||
{
|
||||
return false;
|
||||
@ -224,9 +229,8 @@ void Hierarchical_PIN_Sheet_Struct::Show( int nestLevel, std::ostream& os )
|
||||
wxString s = GetClass();
|
||||
|
||||
NestedSpace( nestLevel, os ) << '<' << s.Lower().mb_str() << ">"
|
||||
<< " pin_name=\"" << CONV_TO_UTF8( m_Text ) << '"'
|
||||
<< "/>\n"
|
||||
<< std::flush;
|
||||
<< " pin_name=\"" << CONV_TO_UTF8( m_Text )
|
||||
<< '"' << "/>\n" << std::flush;
|
||||
|
||||
// NestedSpace( nestLevel, os ) << "</" << s.Lower().mb_str() << ">\n";
|
||||
}
|
||||
|
@ -393,7 +393,6 @@ bool LIB_FIELD::HitTest( wxPoint aPosRef, int aThreshold,
|
||||
return hit;
|
||||
}
|
||||
|
||||
// Creation et Duplication d'un field
|
||||
LIB_DRAW_ITEM* LIB_FIELD::DoGenCopy()
|
||||
{
|
||||
LIB_FIELD* newfield = new LIB_FIELD( m_FieldId );
|
||||
|
@ -1,5 +1,5 @@
|
||||
/**************************************************************/
|
||||
/* Lib component definitions (libentry) definition of fields */
|
||||
/* Lib component definitions (libentry) definition of fields */
|
||||
/**************************************************************/
|
||||
|
||||
#ifndef CLASS_LIBENTRY_FIELDS_H
|
||||
|
@ -76,7 +76,7 @@ bool operator<( const CMP_LIBRARY& item1, const CMP_LIBRARY& item2 )
|
||||
CMP_LIBRARY::CMP_LIBRARY( int type, const wxFileName& fileName )
|
||||
{
|
||||
m_Type = type; /* type indicator */
|
||||
m_IsModified = false; /* flag indicateur d'edition */
|
||||
m_IsModified = false; /* modified indicator */
|
||||
m_TimeStamp = 0;
|
||||
m_Flags = 0;
|
||||
m_IsCache = false;
|
||||
@ -505,7 +505,7 @@ bool CMP_LIBRARY::Load( wxString& errMsg )
|
||||
* apparently started with EESchema-LIB. Sometime after 2.0, it
|
||||
* was changed to EESchema-LIBRARY. Therefore, the test for
|
||||
* EESchema-LIB will work in both cases. Don't change this unless
|
||||
* backwards compatability is no longer required.
|
||||
* backwards compatibility is no longer required.
|
||||
*/
|
||||
if( !tkn.HasMoreTokens()
|
||||
|| !tkn.GetNextToken().Upper().StartsWith(wxT( "EESCHEMA-LIB" ) ) )
|
||||
@ -559,7 +559,7 @@ the current schematic." ),
|
||||
{
|
||||
if( !LoadHeader( f, &LineNum ) )
|
||||
{
|
||||
errMsg = _( "An error occured attempting to read the header." );
|
||||
errMsg = _( "An error occurred attempting to read the header." );
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -659,14 +659,14 @@ bool CMP_LIBRARY::LoadDocs( wxString& errMsg )
|
||||
|
||||
if( f == NULL )
|
||||
{
|
||||
errMsg.Printf( _( "Could not open component document libray file <%s>." ),
|
||||
errMsg.Printf( _( "Could not open component document library file <%s>." ),
|
||||
GetChars( fn.GetFullPath() ) );
|
||||
return false;
|
||||
}
|
||||
|
||||
if( GetLine( f, Line, &LineNum, sizeof(Line) ) == NULL )
|
||||
{
|
||||
errMsg.Printf( _( "Component document libray file <%s> is empty." ),
|
||||
errMsg.Printf( _( "Component document library file <%s> is empty." ),
|
||||
GetChars( fn.GetFullPath() ) );
|
||||
fclose( f );
|
||||
return false;
|
||||
@ -765,7 +765,6 @@ bool CMP_LIBRARY::Save( const wxString& FullFileName, bool oldDocFormat )
|
||||
|
||||
m_IsModified = false;
|
||||
|
||||
/* Creation de l'entete de la librairie */
|
||||
m_TimeStamp = GetTimeStamp();
|
||||
if( !SaveHeader( libfile ) )
|
||||
{
|
||||
|
@ -89,8 +89,7 @@ public:
|
||||
* @param oldDocFormat - Save the document information in a separate
|
||||
* file if true. The default is to save as the
|
||||
* current library file format.
|
||||
*
|
||||
* @return bool - true if success writing else false.
|
||||
* @return True if success writing else false.
|
||||
*/
|
||||
bool Save( const wxString& aFullFileName, bool oldDocFormat = false );
|
||||
|
||||
@ -101,8 +100,7 @@ public:
|
||||
* file *.bck.
|
||||
*
|
||||
* @param aFullFileName - The library filename with path.
|
||||
*
|
||||
* @return bool - true if success writing else false.
|
||||
* @return True if success writing else false.
|
||||
*/
|
||||
bool SaveDocFile( const wxString& FullFileName );
|
||||
|
||||
@ -110,8 +108,7 @@ public:
|
||||
* Load library from file.
|
||||
*
|
||||
* @param errMsg - Error message if load fails.
|
||||
*
|
||||
* @return bool - True if load was successful otherwise false.
|
||||
* @return True if load was successful otherwise false.
|
||||
*/
|
||||
bool Load( wxString& errMsg );
|
||||
|
||||
@ -129,7 +126,7 @@ public:
|
||||
/**
|
||||
* Get library entry status.
|
||||
*
|
||||
* @return true if there are no entries in the library.
|
||||
* @return True if there are no entries in the library.
|
||||
*/
|
||||
bool IsEmpty() const
|
||||
{
|
||||
@ -151,16 +148,12 @@ public:
|
||||
return m_IsModified;
|
||||
}
|
||||
|
||||
|
||||
bool IsCache() const { return m_IsCache; }
|
||||
|
||||
|
||||
void SetModified( void ) { m_IsModified = true; }
|
||||
|
||||
|
||||
void SetCache( void ) { m_IsCache = true; }
|
||||
|
||||
|
||||
/**
|
||||
* Load a string array with the names of all the entries in this library.
|
||||
*
|
||||
@ -202,7 +195,6 @@ public:
|
||||
* Find entry by name.
|
||||
*
|
||||
* @param name - Name of entry, case insensitive.
|
||||
*
|
||||
* @return Pointer to entry if found. NULL if not found.
|
||||
*/
|
||||
CMP_LIB_ENTRY* FindEntry( const wxChar* name );
|
||||
@ -212,7 +204,6 @@ public:
|
||||
*
|
||||
* @param name - Name of entry, case insensitive.
|
||||
* @param type - Type of entry, root or alias.
|
||||
*
|
||||
* @return Pointer to entry if found. NULL if not found.
|
||||
*/
|
||||
CMP_LIB_ENTRY* FindEntry( const wxChar* name, LibrEntryType type );
|
||||
@ -226,7 +217,6 @@ public:
|
||||
* @param name - Name of component, case insensitive.
|
||||
* @param searchAliases - Searches for component by alias name as well as
|
||||
* component name if true.
|
||||
*
|
||||
* @return Pointer to component if found. NULL if not found.
|
||||
*/
|
||||
LIB_COMPONENT* FindComponent( const wxChar* name );
|
||||
@ -238,7 +228,6 @@ public:
|
||||
* a LIB_ALIAS pointer is not required.
|
||||
*
|
||||
* @param name - Name of alias, case insensitive.
|
||||
*
|
||||
* @return Pointer to alias if found. NULL if not found.
|
||||
*/
|
||||
LIB_ALIAS* FindAlias( const wxChar* name )
|
||||
@ -256,9 +245,7 @@ public:
|
||||
* remove the alias from the library.
|
||||
*
|
||||
* @param alias - Alias to add to library.
|
||||
*
|
||||
* @return bool - True if alias added to library. False if conflict
|
||||
* exists.
|
||||
* @return True if alias added to library. False if conflict exists.
|
||||
*/
|
||||
bool AddAlias( LIB_ALIAS* alias );
|
||||
|
||||
@ -266,7 +253,6 @@ public:
|
||||
* Add component entry to library.
|
||||
*
|
||||
* @param cmp - Component to add.
|
||||
*
|
||||
* @return Pointer to added component if successful.
|
||||
*/
|
||||
LIB_COMPONENT* AddComponent( LIB_COMPONENT* cmp );
|
||||
@ -311,9 +297,7 @@ public:
|
||||
* entry in the list is returned.
|
||||
*
|
||||
* @param name - Name of current entry.
|
||||
*
|
||||
* @return CMP_LIB_ENTRY - Pointer to next entry if entry name is found.
|
||||
* Otherwise NULL.
|
||||
* @return Pointer to next entry if entry name is found. Otherwise NULL.
|
||||
*/
|
||||
CMP_LIB_ENTRY* GetNextEntry( const wxChar* name );
|
||||
|
||||
@ -325,23 +309,21 @@ public:
|
||||
* entry in the list is returned.
|
||||
*
|
||||
* @param name - Name of current entry.
|
||||
*
|
||||
* @return CMP_LIB_ENTRY - Pointer to previous entry if entry name is found.
|
||||
* Otherwise NULL.
|
||||
* @return Previous entry if entry name is found, otherwise NULL.
|
||||
*/
|
||||
CMP_LIB_ENTRY* GetPreviousEntry( const wxChar* name );
|
||||
|
||||
/**
|
||||
* Return the file name without path or extension.
|
||||
*
|
||||
* @return wxString - Name of library file.
|
||||
* @return Name of library file.
|
||||
*/
|
||||
wxString GetName() const { return m_fileName.GetName(); }
|
||||
|
||||
/**
|
||||
* Return the full file library name with path and extension.
|
||||
*
|
||||
* @return wxString - Full library file name with path and extension.
|
||||
* @return Full library file name with path and extension.
|
||||
*/
|
||||
wxString GetFullFileName() { return m_fileName.GetFullPath(); }
|
||||
|
||||
@ -368,9 +350,8 @@ public:
|
||||
*
|
||||
* @param fileName - File name of the component library to load.
|
||||
* @param errMsg - Error message if the component library failed to load.
|
||||
*
|
||||
* @return Pointer to library object if library file loaded successfully.
|
||||
* Otherwise NULL.
|
||||
* @return Library object if library file loaded successfully,
|
||||
* otherwise NULL.
|
||||
*/
|
||||
static CMP_LIBRARY* LoadLibrary( const wxFileName& fileName,
|
||||
wxString& errMsg );
|
||||
@ -380,8 +361,7 @@ public:
|
||||
*
|
||||
* @param fileName - File name object of component library.
|
||||
* @param errMsg - Error message if the component library failed to load.
|
||||
*
|
||||
* @return bool - True if library loaded properly otherwise false.
|
||||
* @return True if library loaded properly otherwise false.
|
||||
*/
|
||||
static bool AddLibrary( const wxFileName& fileName, wxString& errMsg );
|
||||
|
||||
@ -391,8 +371,7 @@ public:
|
||||
* @param fileName - File name object of component library.
|
||||
* @param errMsg - Error message if the component library failed to load.
|
||||
* @param i - Iterator to insert library in front of.
|
||||
*
|
||||
* @return bool - True if library loaded properly otherwise false.
|
||||
* @return True if library loaded properly otherwise false.
|
||||
*/
|
||||
static bool AddLibrary( const wxFileName& fileName, wxString& errMsg,
|
||||
CMP_LIBRARY_LIST::iterator& i );
|
||||
@ -408,9 +387,7 @@ public:
|
||||
* Find component library by name.
|
||||
*
|
||||
* @param name - Library file name without path or extension to find.
|
||||
*
|
||||
* @return CMP_LIBRARY* - Pointer to component library if found,
|
||||
* otherwise NULL.
|
||||
* @return Pointer to component library if found, otherwise NULL.
|
||||
*/
|
||||
static CMP_LIBRARY* FindLibrary( const wxString& name );
|
||||
|
||||
@ -419,8 +396,7 @@ public:
|
||||
*
|
||||
* @param sorted - Sort the list of name if true. Otherwise use the
|
||||
* library load order.
|
||||
*
|
||||
* @return wxArrayString - The list of library names.
|
||||
* @return The list of library names.
|
||||
*/
|
||||
static wxArrayString GetLibraryNames( bool sorted = true );
|
||||
|
||||
@ -432,8 +408,7 @@ public:
|
||||
*
|
||||
* @param name - Name of component to search for.
|
||||
* @param libNaem - Name of the library to search for component.
|
||||
*
|
||||
* @return Pointer to a valid component object if found. Otherwise NULL.
|
||||
* @return The component object if found, otherwise NULL.
|
||||
*/
|
||||
static LIB_COMPONENT* FindLibraryComponent(
|
||||
const wxString& name, const wxString& libName = wxEmptyString );
|
||||
@ -445,8 +420,7 @@ public:
|
||||
*
|
||||
* @param name - Name of component to search for.
|
||||
* @param libNaem - Name of the library to search for entry.
|
||||
*
|
||||
* @return Pointer to a valid entry object if found. Otherwise NULL.
|
||||
* @return The entry object if found, otherwise NULL.
|
||||
*/
|
||||
static CMP_LIB_ENTRY* FindLibraryEntry(
|
||||
const wxString& name,
|
||||
|
@ -66,9 +66,7 @@ int SCH_CMP_FIELD::GetPenSize()
|
||||
|
||||
|
||||
/**
|
||||
* Routine de trace des textes type Field du composant.
|
||||
* entree:
|
||||
* DrawMode: mode de trace
|
||||
* Draw schematic component fields.
|
||||
*/
|
||||
void SCH_CMP_FIELD::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
|
||||
const wxPoint& offset, int DrawMode, int Color )
|
||||
@ -98,7 +96,7 @@ void SCH_CMP_FIELD::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
|
||||
|
||||
/* Calculate the text orientation, according to the component orientation/mirror */
|
||||
orient = m_Orient;
|
||||
if( parentComponent->m_Transform[0][1] ) // Rotation du composant de 90deg
|
||||
if( parentComponent->m_Transform[0][1] ) // Rotate component 90 degrees.
|
||||
{
|
||||
if( orient == TEXT_ORIENT_HORIZ )
|
||||
orient = TEXT_ORIENT_VERT;
|
||||
|
@ -1,6 +1,6 @@
|
||||
/***********************************************************************/
|
||||
/* Methodes de base de gestion des classes des elements de schematique */
|
||||
/***********************************************************************/
|
||||
/*****************************/
|
||||
/* class_schematic_items.cpp */
|
||||
/*****************************/
|
||||
|
||||
#include "fctsys.h"
|
||||
#include "gr_basic.h"
|
||||
@ -60,7 +60,7 @@ DrawBusEntryStruct* DrawBusEntryStruct::GenCopy()
|
||||
|
||||
/**
|
||||
* Function Save
|
||||
* writes the data structures for this object out to a FILE in "*.brd" format.
|
||||
* writes the data structures for this object out to a FILE in "*.sch" format.
|
||||
* @param aFile The FILE to write to.
|
||||
* @return bool - true if success writing else false.
|
||||
*/
|
||||
@ -162,7 +162,7 @@ DrawJunctionStruct* DrawJunctionStruct::GenCopy()
|
||||
|
||||
/**
|
||||
* Function Save
|
||||
* writes the data structures for this object out to a FILE in "*.brd" format.
|
||||
* writes the data structures for this object out to a FILE in "*.sch" format.
|
||||
* @param aFile The FILE to write to.
|
||||
* @return bool - true if success writing else false.
|
||||
*/
|
||||
@ -202,7 +202,7 @@ bool DrawJunctionStruct::HitTest( const wxPoint& aPosRef )
|
||||
wxPoint dist = aPosRef - m_Pos;
|
||||
|
||||
return sqrt( ( (double) ( dist.x * dist.x ) ) +
|
||||
( (double) ( dist.y * dist.y ) ) ) < (DRAWJUNCTION_DIAMETER/2);
|
||||
( (double) ( dist.y * dist.y ) ) ) < (DRAWJUNCTION_DIAMETER/2);
|
||||
}
|
||||
|
||||
|
||||
@ -217,7 +217,7 @@ int DrawJunctionStruct::GetPenSize()
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
* Routine to redraw connection struct. *
|
||||
* Routine to redraw connection struct. *
|
||||
*****************************************************************************/
|
||||
void DrawJunctionStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
|
||||
const wxPoint& offset, int DrawMode, int Color )
|
||||
@ -231,7 +231,8 @@ void DrawJunctionStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
|
||||
GRSetDrawMode( DC, DrawMode );
|
||||
|
||||
GRFilledCircle( &panel->m_ClipBox, DC, m_Pos.x + offset.x,
|
||||
m_Pos.y + offset.y, (DRAWJUNCTION_DIAMETER/2), 0, color, color );
|
||||
m_Pos.y + offset.y, (DRAWJUNCTION_DIAMETER/2), 0, color,
|
||||
color );
|
||||
}
|
||||
|
||||
|
||||
@ -274,7 +275,7 @@ EDA_Rect DrawNoConnectStruct::GetBoundingBox()
|
||||
{
|
||||
const int DELTA = DRAWNOCONNECT_SIZE / 2;
|
||||
EDA_Rect box( wxPoint( m_Pos.x - DELTA, m_Pos.y - DELTA ),
|
||||
wxSize( 2 * DELTA, 2 * DELTA ) );
|
||||
wxSize( 2 * DELTA, 2 * DELTA ) );
|
||||
|
||||
box.Normalize();
|
||||
return box;
|
||||
@ -301,7 +302,7 @@ bool DrawNoConnectStruct::HitTest( const wxPoint& aPosRef )
|
||||
|
||||
/**
|
||||
* Function Save
|
||||
* writes the data structures for this object out to a FILE in "*.brd" format.
|
||||
* writes the data structures for this object out to a FILE in "*.sch" format.
|
||||
* @param aFile The FILE to write to.
|
||||
* @return bool - true if success writing else false.
|
||||
*/
|
||||
@ -364,7 +365,7 @@ EDA_DrawLineStruct::EDA_DrawLineStruct( const wxPoint& pos, int layer ) :
|
||||
switch( layer )
|
||||
{
|
||||
default:
|
||||
m_Layer = LAYER_NOTES; /* Mettre ds Notes */
|
||||
m_Layer = LAYER_NOTES;
|
||||
break;
|
||||
|
||||
case LAYER_WIRE:
|
||||
@ -435,7 +436,7 @@ EDA_Rect EDA_DrawLineStruct::GetBoundingBox()
|
||||
|
||||
// return a rectangle which is [pos,dim) in nature. therefore the +1
|
||||
EDA_Rect ret( wxPoint( xmin, ymin ),
|
||||
wxSize( xmax - xmin + 1, ymax - ymin + 1 ) );
|
||||
wxSize( xmax - xmin + 1, ymax - ymin + 1 ) );
|
||||
|
||||
return ret;
|
||||
}
|
||||
@ -443,7 +444,7 @@ EDA_Rect EDA_DrawLineStruct::GetBoundingBox()
|
||||
|
||||
/**
|
||||
* Function Save
|
||||
* writes the data structures for this object out to a FILE in "*.brd" format.
|
||||
* writes the data structures for this object out to a FILE in "*.sch" format.
|
||||
* @param aFile The FILE to write to.
|
||||
* @return bool - true if success writing else false.
|
||||
*/
|
||||
@ -559,7 +560,7 @@ DrawPolylineStruct* DrawPolylineStruct::GenCopy()
|
||||
|
||||
/**
|
||||
* Function Save
|
||||
* writes the data structures for this object out to a FILE in "*.brd" format.
|
||||
* writes the data structures for this object out to a FILE in "*.sch" format.
|
||||
* @param aFile The FILE to write to.
|
||||
* @return bool - true if success writing else false.
|
||||
*/
|
||||
@ -575,7 +576,7 @@ bool DrawPolylineStruct::Save( FILE* aFile ) const
|
||||
if( GetLayer() == LAYER_BUS )
|
||||
layer = "Bus";
|
||||
if( fprintf( aFile, "Poly %s %s %d\n",
|
||||
width, layer, GetCornerCount() ) == EOF )
|
||||
width, layer, GetCornerCount() ) == EOF )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -5,17 +5,18 @@
|
||||
#ifndef CLASS_SCHEMATIC_ITEMS_H
|
||||
#define CLASS_SCHEMATIC_ITEMS_H
|
||||
|
||||
#define DRAWJUNCTION_DIAMETER 32 /* Size (diameter) of junctions between wires */
|
||||
#define DRAWNOCONNECT_SIZE 48 /* Rayon du symbole No Connexion */
|
||||
#define DRAWJUNCTION_DIAMETER 32 /* Diameter of junction symbol between
|
||||
* wires */
|
||||
#define DRAWNOCONNECT_SIZE 48 /* No symbol connection range. */
|
||||
|
||||
/* flags pour BUS ENTRY (bus to bus ou wire to bus */
|
||||
/* Flags for BUS ENTRY (bus to bus or wire to bus */
|
||||
#define WIRE_TO_BUS 0
|
||||
#define BUS_TO_BUS 1
|
||||
|
||||
|
||||
/**
|
||||
* Class EDA_DrawLineStruct
|
||||
* is a segment decription base class to describe items which have 2 end
|
||||
* is a segment description base class to describe items which have 2 end
|
||||
* points (track, wire, draw line ...)
|
||||
*/
|
||||
class EDA_DrawLineStruct : public SCH_ITEM
|
||||
@ -26,7 +27,7 @@ public:
|
||||
wxPoint m_End; // Line end point
|
||||
|
||||
bool m_StartIsDangling;
|
||||
bool m_EndIsDangling; // TRUE si Start ou End not connected (wires, tracks...)
|
||||
bool m_EndIsDangling; // TRUE if not connected (wires, tracks...)
|
||||
|
||||
public:
|
||||
EDA_DrawLineStruct( const wxPoint& pos, int layer );
|
||||
@ -57,7 +58,7 @@ public:
|
||||
|
||||
/**
|
||||
* Function Save
|
||||
* writes the data structures for this object out to a FILE in "*.brd"
|
||||
* writes the data structures for this object out to a FILE in "*.sch"
|
||||
* format.
|
||||
* @param aFile The FILE to write to.
|
||||
* @return bool - true if success writing else false.
|
||||
@ -72,7 +73,7 @@ public:
|
||||
// Geometric transforms (used in block operations):
|
||||
/** virtual function Move
|
||||
* move item to a new position.
|
||||
* @param aMoveVector = the deplacement vector
|
||||
* @param aMoveVector = the displacement vector
|
||||
*/
|
||||
virtual void Move(const wxPoint& aMoveVector)
|
||||
{
|
||||
@ -102,7 +103,7 @@ public:
|
||||
};
|
||||
|
||||
|
||||
class DrawNoConnectStruct : public SCH_ITEM /* Symboles de non connexion */
|
||||
class DrawNoConnectStruct : public SCH_ITEM
|
||||
{
|
||||
public:
|
||||
wxPoint m_Pos; /* XY coordinates of NoConnect. */
|
||||
@ -129,7 +130,7 @@ public:
|
||||
|
||||
/**
|
||||
* Function Save
|
||||
* writes the data structures for this object out to a FILE in "*.brd"
|
||||
* writes the data structures for this object out to a FILE in "*.sch"
|
||||
* format.
|
||||
* @param aFile The FILE to write to.
|
||||
* @return bool - true if success writing else false.
|
||||
@ -146,7 +147,7 @@ public:
|
||||
// Geometric transforms (used in block operations):
|
||||
/** virtual function Move
|
||||
* move item to a new position.
|
||||
* @param aMoveVector = the deplacement vector
|
||||
* @param aMoveVector = the displacement vector
|
||||
*/
|
||||
virtual void Move(const wxPoint& aMoveVector)
|
||||
{
|
||||
@ -168,7 +169,8 @@ public:
|
||||
|
||||
/**
|
||||
* Class DrawBusEntryStruct
|
||||
* Struct de descr 1 raccord a 45 degres de BUS ou WIRE
|
||||
*
|
||||
* Defines a bus or wire entry.
|
||||
*/
|
||||
class DrawBusEntryStruct : public SCH_ITEM
|
||||
{
|
||||
@ -188,14 +190,14 @@ public:
|
||||
|
||||
|
||||
DrawBusEntryStruct* GenCopy();
|
||||
wxPoint m_End() const; // retourne la coord de fin du raccord
|
||||
wxPoint m_End() const;
|
||||
virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC,
|
||||
const wxPoint& offset, int draw_mode,
|
||||
int Color = -1 );
|
||||
|
||||
/**
|
||||
* Function Save
|
||||
* writes the data structures for this object out to a FILE in "*.brd"
|
||||
* writes the data structures for this object out to a FILE in "*.sch"
|
||||
* format.
|
||||
* @param aFile The FILE to write to.
|
||||
* @return bool - true if success writing else false.
|
||||
@ -212,7 +214,7 @@ public:
|
||||
// Geometric transforms (used in block operations):
|
||||
/** virtual function Move
|
||||
* move item to a new position.
|
||||
* @param aMoveVector = the deplacement vector
|
||||
* @param aMoveVector = the displacement vector
|
||||
*/
|
||||
virtual void Move(const wxPoint& aMoveVector)
|
||||
{
|
||||
@ -232,10 +234,10 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
class DrawPolylineStruct : public SCH_ITEM /* Polyligne (serie de segments) */
|
||||
class DrawPolylineStruct : public SCH_ITEM
|
||||
{
|
||||
public:
|
||||
int m_Width; /* Tickness */
|
||||
int m_Width; /* Thickness */
|
||||
std::vector<wxPoint> m_PolyPoints; // list of points (>= 2)
|
||||
|
||||
public:
|
||||
@ -255,7 +257,7 @@ public:
|
||||
|
||||
/**
|
||||
* Function Save
|
||||
* writes the data structures for this object out to a FILE in "*.brd"
|
||||
* writes the data structures for this object out to a FILE in "*.sch"
|
||||
* format.
|
||||
* @param aFile The FILE to write to.
|
||||
* @return bool - true if success writing else false.
|
||||
@ -284,7 +286,7 @@ public:
|
||||
// Geometric transforms (used in block operations):
|
||||
/** virtual function Move
|
||||
* move item to a new position.
|
||||
* @param aMoveVector = the deplacement vector
|
||||
* @param aMoveVector = the displacement vector
|
||||
*/
|
||||
virtual void Move(const wxPoint& aMoveVector)
|
||||
{
|
||||
@ -342,7 +344,8 @@ public:
|
||||
int Color = -1 );
|
||||
/**
|
||||
* Function Save
|
||||
* writes the data structures for this object out to a FILE in "*.brd" format.
|
||||
* writes the data structures for this object out to a FILE in "*.sch"
|
||||
* format.
|
||||
* @param aFile The FILE to write to.
|
||||
* @return bool - true if success writing else false.
|
||||
*/
|
||||
@ -351,7 +354,7 @@ public:
|
||||
// Geometric transforms (used in block operations):
|
||||
/** virtual function Move
|
||||
* move item to a new position.
|
||||
* @param aMoveVector = the deplacement vector
|
||||
* @param aMoveVector = the displacement vector
|
||||
*/
|
||||
virtual void Move(const wxPoint& aMoveVector)
|
||||
{
|
||||
|
@ -1,6 +1,6 @@
|
||||
/***********************************************************************/
|
||||
/* Methodes de base de gestion des classes des elements de schematique */
|
||||
/***********************************************************************/
|
||||
/*********************************************/
|
||||
/* Code for handling schematic sheet labels. */
|
||||
/*********************************************/
|
||||
|
||||
#include "fctsys.h"
|
||||
#include "gr_basic.h"
|
||||
@ -22,7 +22,7 @@
|
||||
/* class SCH_HIERLABEL */
|
||||
/************************/
|
||||
|
||||
/* Messages correspondants aux types ou forme des labels */
|
||||
/* Names of sheet label types. */
|
||||
const char* SheetLabelType[] =
|
||||
{
|
||||
"Input",
|
||||
@ -65,20 +65,25 @@ static int Template3STATE_BOTTOM[] = { 5, 0, 0, -1, 1, 0, 2, 1, 1, 0, 0 };
|
||||
|
||||
static int* TemplateShape[5][4] =
|
||||
{
|
||||
{ TemplateIN_HN, TemplateIN_UP, TemplateIN_HI, TemplateIN_BOTTOM },
|
||||
{ TemplateOUT_HN, TemplateOUT_UP, TemplateOUT_HI, TemplateOUT_BOTTOM },
|
||||
{ TemplateBIDI_HN, TemplateBIDI_UP, TemplateBIDI_HI, TemplateBIDI_BOTTOM },
|
||||
{ Template3STATE_HN, Template3STATE_UP, Template3STATE_HI, Template3STATE_BOTTOM },
|
||||
{ TemplateUNSPC_HN, TemplateUNSPC_UP, TemplateUNSPC_HI, TemplateUNSPC_BOTTOM }
|
||||
{ TemplateIN_HN, TemplateIN_UP, TemplateIN_HI,
|
||||
TemplateIN_BOTTOM },
|
||||
{ TemplateOUT_HN, TemplateOUT_UP, TemplateOUT_HI,
|
||||
TemplateOUT_BOTTOM },
|
||||
{ TemplateBIDI_HN, TemplateBIDI_UP, TemplateBIDI_HI,
|
||||
TemplateBIDI_BOTTOM },
|
||||
{ Template3STATE_HN, Template3STATE_UP, Template3STATE_HI,
|
||||
Template3STATE_BOTTOM },
|
||||
{ TemplateUNSPC_HN, TemplateUNSPC_UP, TemplateUNSPC_HI,
|
||||
TemplateUNSPC_BOTTOM }
|
||||
};
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
SCH_TEXT::SCH_TEXT( const wxPoint& pos, const wxString& text, KICAD_T aType ) :
|
||||
SCH_ITEM( NULL, aType ),
|
||||
EDA_TextStruct( text )
|
||||
/**************************************************************************/
|
||||
SCH_TEXT::SCH_TEXT( const wxPoint& pos, const wxString& text,
|
||||
KICAD_T aType ) :
|
||||
SCH_ITEM( NULL, aType ), EDA_TextStruct( text )
|
||||
{
|
||||
/**************************************************************************/
|
||||
m_Layer = LAYER_NOTES;
|
||||
m_Pos = pos;
|
||||
m_Shape = 0;
|
||||
@ -100,8 +105,8 @@ bool SCH_TEXT::HitTest( const wxPoint& aPosRef )
|
||||
|
||||
/*********************************************/
|
||||
SCH_TEXT* SCH_TEXT::GenCopy()
|
||||
/*********************************************/
|
||||
{
|
||||
/*********************************************/
|
||||
SCH_TEXT* newitem;
|
||||
|
||||
switch( Type() )
|
||||
@ -124,8 +129,8 @@ SCH_TEXT* SCH_TEXT::GenCopy()
|
||||
break;
|
||||
}
|
||||
|
||||
newitem->m_Layer = m_Layer;
|
||||
newitem->m_Shape = m_Shape;
|
||||
newitem->m_Layer = m_Layer;
|
||||
newitem->m_Shape = m_Shape;
|
||||
newitem->m_Orient = m_Orient;
|
||||
newitem->m_Size = m_Size;
|
||||
newitem->m_Width = m_Width;
|
||||
@ -141,7 +146,8 @@ SCH_TEXT* SCH_TEXT::GenCopy()
|
||||
|
||||
|
||||
/** function GetSchematicTextOffset (virtual)
|
||||
* @return the offset between the SCH_TEXT position and the text itself position
|
||||
* @return the offset between the SCH_TEXT position and the text itself
|
||||
* position
|
||||
* This offset depend on orientation, and the type of text
|
||||
* (room to draw an associated graphic symbol, or put the text above a wire)
|
||||
*/
|
||||
@ -149,7 +155,8 @@ wxPoint SCH_TEXT::GetSchematicTextOffset()
|
||||
{
|
||||
wxPoint text_offset;
|
||||
|
||||
// add a small offset (TXTMARGE) to x ( or y) position to allow a text to be on a wire or a line and be readable
|
||||
// add a small offset (TXTMARGE) to x ( or y) position to allow a text to
|
||||
// be on a wire or a line and be readable
|
||||
switch( m_SchematicOrientation )
|
||||
{
|
||||
default:
|
||||
@ -175,7 +182,8 @@ wxPoint SCH_TEXT::GetSchematicTextOffset()
|
||||
|
||||
|
||||
/** function GetSchematicTextOffset (virtual)
|
||||
* @return the offset between the SCH_TEXT position and the text itself position
|
||||
* @return the offset between the SCH_TEXT position and the text itself
|
||||
* position
|
||||
* This offset depend on orientation, and the type of text
|
||||
* (room to draw an associated graphic symbol, or put the text above a wire)
|
||||
*/
|
||||
@ -189,29 +197,33 @@ wxPoint SCH_LABEL::GetSchematicTextOffset()
|
||||
* mirror item relative to an Y axis
|
||||
* @param aYaxis_position = the y axis position
|
||||
*/
|
||||
void SCH_TEXT::Mirror_Y(int aYaxis_position)
|
||||
void SCH_TEXT::Mirror_Y( int aYaxis_position )
|
||||
{
|
||||
// Text is NOT really mirrored; it is moved to a suitable position
|
||||
// which is the closest position for a true mirrored text
|
||||
// The center position is mirrored and the text is moved for half horizontal len
|
||||
// The center position is mirrored and the text is moved for half
|
||||
// horizontal len
|
||||
int px = m_Pos.x;
|
||||
int dx;
|
||||
if( m_Orient == 0 ) /* horizontal text */
|
||||
|
||||
if( m_Orient == 0 ) /* horizontal text */
|
||||
dx = LenSize( m_Text ) / 2;
|
||||
else if( m_Orient == 2 ) /* invert horizontal text*/
|
||||
else if( m_Orient == 2 ) /* invert horizontal text*/
|
||||
dx = -LenSize( m_Text ) / 2;
|
||||
else
|
||||
dx = 0;
|
||||
px += dx;
|
||||
px -= aYaxis_position;
|
||||
NEGATE(px);
|
||||
NEGATE( px );
|
||||
px += aYaxis_position;
|
||||
px -= dx;
|
||||
m_Pos.x = px;
|
||||
}
|
||||
|
||||
|
||||
/** function GetSchematicTextOffset (virtual)
|
||||
* @return the offset between the SCH_TEXT position and the text itself position
|
||||
* @return the offset between the SCH_TEXT position and the text itself
|
||||
* position
|
||||
* This offset depend on orientation, and the type of text
|
||||
* (room to draw an associated graphic symbol, or put the text above a wire)
|
||||
*/
|
||||
@ -245,44 +257,50 @@ wxPoint SCH_HIERLABEL::GetSchematicTextOffset()
|
||||
return text_offset;
|
||||
}
|
||||
|
||||
/** virtual function Mirror_Y
|
||||
* mirror item relative to an Y axis
|
||||
* @param aYaxis_position = the y axis position
|
||||
*/
|
||||
void SCH_HIERLABEL::Mirror_Y(int aYaxis_position)
|
||||
{
|
||||
// Text is NOT really mirrored; it is moved to a suitable position
|
||||
// which is the closest position for a true mirrored text
|
||||
// The center position is mirrored and the text is moved for half horizontal len
|
||||
if( m_Orient == 0 ) /* horizontal text */
|
||||
m_Orient = 2;
|
||||
else if( m_Orient == 2 ) /* invert horizontal text*/
|
||||
m_Orient = 0;
|
||||
m_Pos.x -= aYaxis_position;
|
||||
NEGATE(m_Pos.x);
|
||||
m_Pos.x += aYaxis_position;
|
||||
}
|
||||
|
||||
/** virtual function Mirror_Y
|
||||
* mirror item relative to an Y axis
|
||||
* @param aYaxis_position = the y axis position
|
||||
*/
|
||||
void SCH_GLOBALLABEL::Mirror_Y(int aYaxis_position)
|
||||
void SCH_HIERLABEL::Mirror_Y( int aYaxis_position )
|
||||
{
|
||||
// Text is NOT really mirrored; it is moved to a suitable position
|
||||
// which is the closest position for a true mirrored text
|
||||
// The center position is mirrored and the text is moved for half horizontal len
|
||||
if( m_Orient == 0 ) /* horizontal text */
|
||||
// The center position is mirrored and the text is moved for half
|
||||
// horizontal len
|
||||
if( m_Orient == 0 ) /* horizontal text */
|
||||
m_Orient = 2;
|
||||
else if( m_Orient == 2 ) /* invert horizontal text*/
|
||||
else if( m_Orient == 2 ) /* invert horizontal text*/
|
||||
m_Orient = 0;
|
||||
m_Pos.x -= aYaxis_position;
|
||||
NEGATE(m_Pos.x);
|
||||
NEGATE( m_Pos.x );
|
||||
m_Pos.x += aYaxis_position;
|
||||
}
|
||||
|
||||
|
||||
/** virtual function Mirror_Y
|
||||
* mirror item relative to an Y axis
|
||||
* @param aYaxis_position = the y axis position
|
||||
*/
|
||||
void SCH_GLOBALLABEL::Mirror_Y( int aYaxis_position )
|
||||
{
|
||||
// Text is NOT really mirrored; it is moved to a suitable position
|
||||
// which is the closest position for a true mirrored text
|
||||
// The center position is mirrored and the text is moved for half
|
||||
// horizontal len
|
||||
if( m_Orient == 0 ) /* horizontal text */
|
||||
m_Orient = 2;
|
||||
else if( m_Orient == 2 ) /* invert horizontal text*/
|
||||
m_Orient = 0;
|
||||
m_Pos.x -= aYaxis_position;
|
||||
NEGATE( m_Pos.x );
|
||||
m_Pos.x += aYaxis_position;
|
||||
}
|
||||
|
||||
|
||||
/** function GetSchematicTextOffset (virtual)
|
||||
* @return the offset between the SCH_TEXT position and the text itself position
|
||||
* @return the offset between the SCH_TEXT position and the text itself
|
||||
* position
|
||||
* This offset depend on orientation, and the type of text
|
||||
* (room to draw an associated graphic symbol, or put the text above a wire)
|
||||
*/
|
||||
@ -314,7 +332,7 @@ wxPoint SCH_GLOBALLABEL::GetSchematicTextOffset()
|
||||
|
||||
switch( m_SchematicOrientation )
|
||||
{
|
||||
case 0: /* Orientation horiz normale */
|
||||
case 0: /* Orientation horiz normal */
|
||||
text_offset.x -= offset;
|
||||
break;
|
||||
|
||||
@ -337,12 +355,14 @@ wxPoint SCH_GLOBALLABEL::GetSchematicTextOffset()
|
||||
|
||||
/** function SetTextOrientAndJustifyParmeters (virtual)
|
||||
* Set m_SchematicOrientation, and initialize
|
||||
* m_orient,m_HJustified and m_VJustified, according to the value of m_SchematicOrientation
|
||||
* m_orient,m_HJustified and m_VJustified, according to the value of
|
||||
* m_SchematicOrientation
|
||||
* must be called after changing m_SchematicOrientation
|
||||
* @param aSchematicOrientation =
|
||||
* 0 = normal (horizontal, left justified).
|
||||
* 1 = up (vertical)
|
||||
* 2 = (horizontal, rignt justified). This can be seen as the mirrored position of 0
|
||||
* 2 = (horizontal, right justified). This can be seen as the mirrored
|
||||
* position of 0
|
||||
* 3 = bottom . This can be seen as the mirrored position of up
|
||||
*/
|
||||
void SCH_TEXT::SetSchematicTextOrientation( int aSchematicOrientation )
|
||||
@ -381,12 +401,14 @@ void SCH_TEXT::SetSchematicTextOrientation( int aSchematicOrientation )
|
||||
|
||||
/** function SetTextOrientAndJustifyParmeters
|
||||
* Set m_SchematicOrientation, and initialize
|
||||
* m_orient,m_HJustified and m_VJustified, according to the value of m_SchematicOrientation (for a label)
|
||||
* m_orient,m_HJustified and m_VJustified, according to the value of
|
||||
* m_SchematicOrientation (for a label)
|
||||
* must be called after changing m_SchematicOrientation
|
||||
* @param aSchematicOrientation =
|
||||
* 0 = normal (horizontal, left justified).
|
||||
* 1 = up (vertical)
|
||||
* 2 = (horizontal, rignt justified). This can be seen as the mirrored position of 0
|
||||
* 2 = (horizontal, right justified). This can be seen as the mirrored
|
||||
* position of 0
|
||||
* 3 = bottom . This can be seen as the mirrored position of up
|
||||
*/
|
||||
void SCH_LABEL::SetSchematicTextOrientation( int aSchematicOrientation )
|
||||
@ -397,12 +419,14 @@ void SCH_LABEL::SetSchematicTextOrientation( int aSchematicOrientation )
|
||||
|
||||
/** function SetTextOrientAndJustifyParmeters
|
||||
* Set m_SchematicOrientation, and initialize
|
||||
* m_orient,m_HJustified and m_VJustified, according to the value of m_SchematicOrientation
|
||||
* m_orient,m_HJustified and m_VJustified, according to the value of
|
||||
* m_SchematicOrientation
|
||||
* must be called after changing m_SchematicOrientation
|
||||
* @param aSchematicOrientation =
|
||||
* 0 = normal (horizontal, left justified).
|
||||
* 1 = up (vertical)
|
||||
* 2 = (horizontal, rignt justified). This can be seen as the mirrored position of 0
|
||||
* 2 = (horizontal, right justified). This can be seen as the mirrored
|
||||
* position of 0
|
||||
* 3 = bottom . This can be seen as the mirrored position of up
|
||||
*/
|
||||
void SCH_GLOBALLABEL::SetSchematicTextOrientation( int aSchematicOrientation )
|
||||
@ -441,12 +465,14 @@ void SCH_GLOBALLABEL::SetSchematicTextOrientation( int aSchematicOrientation )
|
||||
|
||||
/** function SetTextOrientAndJustifyParmeters
|
||||
* Set m_SchematicOrientation, and initialize
|
||||
* m_orient,m_HJustified and m_VJustified, according to the value of m_SchematicOrientation
|
||||
* m_orient,m_HJustified and m_VJustified, according to the value of
|
||||
* m_SchematicOrientation
|
||||
* must be called after changing m_SchematicOrientation
|
||||
* @param aSchematicOrientation =
|
||||
* 0 = normal (horizontal, left justified).
|
||||
* 1 = up (vertical)
|
||||
* 2 = (horizontal, rignt justified). This can be seen as the mirrored position of 0
|
||||
* 2 = (horizontal, right justified). This can be seen as the mirrored
|
||||
* position of 0
|
||||
* 3 = bottom . This can be seen as the mirrored position of up
|
||||
*/
|
||||
void SCH_HIERLABEL::SetSchematicTextOrientation( int aSchematicOrientation )
|
||||
@ -485,8 +511,8 @@ void SCH_HIERLABEL::SetSchematicTextOrientation( int aSchematicOrientation )
|
||||
|
||||
/********************************************************/
|
||||
void SCH_TEXT::SwapData( SCH_TEXT* copyitem )
|
||||
/********************************************************/
|
||||
{
|
||||
/********************************************************/
|
||||
EXCHG( m_Text, copyitem->m_Text );
|
||||
EXCHG( m_Pos, copyitem->m_Pos );
|
||||
EXCHG( m_Size, copyitem->m_Size );
|
||||
@ -504,8 +530,8 @@ void SCH_TEXT::SwapData( SCH_TEXT* copyitem )
|
||||
|
||||
/***************************************************************/
|
||||
void SCH_TEXT::Place( WinEDA_SchematicFrame* frame, wxDC* DC )
|
||||
/***************************************************************/
|
||||
{
|
||||
/***************************************************************/
|
||||
/* save old text in undo list */
|
||||
if( g_ItemToUndoCopy && ( (m_Flags & IS_NEW) == 0 ) )
|
||||
{
|
||||
@ -528,9 +554,9 @@ void SCH_TEXT::Place( WinEDA_SchematicFrame* frame, wxDC* DC )
|
||||
/** Function GetPenSize
|
||||
* @return the size of the "pen" that be used to draw or plot this item
|
||||
*/
|
||||
int SCH_TEXT::GetPenSize( )
|
||||
int SCH_TEXT::GetPenSize()
|
||||
{
|
||||
int pensize = m_Width;
|
||||
int pensize = m_Width;
|
||||
|
||||
if( pensize == 0 ) // Use default values for pen size
|
||||
{
|
||||
@ -539,22 +565,24 @@ int SCH_TEXT::GetPenSize( )
|
||||
else
|
||||
pensize = g_DrawDefaultLineThickness;
|
||||
}
|
||||
|
||||
// Clip pen size for small texts:
|
||||
pensize = Clamp_Text_PenSize( pensize, m_Size, m_Bold );
|
||||
return pensize;
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************************/
|
||||
/****************************************************************************/
|
||||
void SCH_TEXT::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& aOffset,
|
||||
int DrawMode, int Color )
|
||||
/*******************************************************************************************/
|
||||
|
||||
/* Texts type Comment (text on layer "NOTE") have 4 directions, and the Text origin is the first letter
|
||||
*/
|
||||
{
|
||||
/****************************************************************************/
|
||||
/* Text type Comment (text on layer "NOTE") have 4 directions, and the Text
|
||||
* origin is the first letter
|
||||
*/
|
||||
EDA_Colors color;
|
||||
int linewidth = (m_Width == 0) ? g_DrawDefaultLineThickness : m_Width;
|
||||
int linewidth =
|
||||
(m_Width == 0) ? g_DrawDefaultLineThickness : m_Width;
|
||||
|
||||
linewidth = Clamp_Text_PenSize( linewidth, m_Size, m_Bold );
|
||||
|
||||
@ -567,7 +595,8 @@ void SCH_TEXT::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& aOffset,
|
||||
wxPoint text_offset = aOffset + GetSchematicTextOffset();
|
||||
|
||||
EXCHG( linewidth, m_Width ); // Set the minimum width
|
||||
EDA_TextStruct::Draw( panel, DC, text_offset, color, DrawMode, FILLED, UNSPECIFIED_COLOR );
|
||||
EDA_TextStruct::Draw( panel, DC, text_offset, color, DrawMode, FILLED,
|
||||
UNSPECIFIED_COLOR );
|
||||
EXCHG( linewidth, m_Width ); // set initial value
|
||||
if( m_IsDangling )
|
||||
DrawDanglingSymbol( panel, DC, m_Pos + aOffset, color );
|
||||
@ -601,10 +630,8 @@ bool SCH_TEXT::Save( FILE* aFile ) const
|
||||
}
|
||||
|
||||
if( fprintf( aFile, "Text Notes %-4d %-4d %-4d %-4d %s %d\n%s\n",
|
||||
m_Pos.x, m_Pos.y,
|
||||
m_SchematicOrientation, m_Size.x,
|
||||
shape, m_Width,
|
||||
CONV_TO_UTF8( text ) ) == EOF )
|
||||
m_Pos.x, m_Pos.y, m_SchematicOrientation, m_Size.x,
|
||||
shape, m_Width, CONV_TO_UTF8( text ) ) == EOF )
|
||||
{
|
||||
success = false;
|
||||
}
|
||||
@ -635,8 +662,8 @@ void SCH_TEXT::Show( int nestLevel, std::ostream& os )
|
||||
/****************************************************************************/
|
||||
SCH_LABEL::SCH_LABEL( const wxPoint& pos, const wxString& text ) :
|
||||
SCH_TEXT( pos, text, TYPE_SCH_LABEL )
|
||||
/****************************************************************************/
|
||||
{
|
||||
/****************************************************************************/
|
||||
m_Layer = LAYER_LOCLABEL;
|
||||
m_Shape = NET_INPUT;
|
||||
m_IsDangling = TRUE;
|
||||
@ -659,9 +686,8 @@ bool SCH_LABEL::Save( FILE* aFile ) const
|
||||
shape = "Italic";
|
||||
|
||||
if( fprintf( aFile, "Text Label %-4d %-4d %-4d %-4d %s %d\n%s\n",
|
||||
m_Pos.x, m_Pos.y,
|
||||
m_SchematicOrientation, m_Size.x, shape, m_Width,
|
||||
CONV_TO_UTF8( m_Text ) ) == EOF )
|
||||
m_Pos.x, m_Pos.y, m_SchematicOrientation, m_Size.x, shape,
|
||||
m_Width, CONV_TO_UTF8( m_Text ) ) == EOF )
|
||||
{
|
||||
success = false;
|
||||
}
|
||||
@ -670,11 +696,11 @@ bool SCH_LABEL::Save( FILE* aFile ) const
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************************/
|
||||
/*****************************************************************************/
|
||||
SCH_GLOBALLABEL::SCH_GLOBALLABEL( const wxPoint& pos, const wxString& text ) :
|
||||
SCH_TEXT( pos, text, TYPE_SCH_GLOBALLABEL )
|
||||
/***********************************************************************************/
|
||||
{
|
||||
/*****************************************************************************/
|
||||
m_Layer = LAYER_GLOBLABEL;
|
||||
m_Shape = NET_BIDI;
|
||||
m_IsDangling = TRUE;
|
||||
@ -696,11 +722,9 @@ bool SCH_GLOBALLABEL::Save( FILE* aFile ) const
|
||||
if( m_Italic )
|
||||
shape = "Italic";
|
||||
if( fprintf( aFile, "Text GLabel %-4d %-4d %-4d %-4d %s %s %d\n%s\n",
|
||||
m_Pos.x, m_Pos.y,
|
||||
m_SchematicOrientation, m_Size.x,
|
||||
SheetLabelType[m_Shape],
|
||||
shape, m_Width,
|
||||
CONV_TO_UTF8( m_Text ) ) == EOF )
|
||||
m_Pos.x, m_Pos.y, m_SchematicOrientation, m_Size.x,
|
||||
SheetLabelType[m_Shape], shape, m_Width,
|
||||
CONV_TO_UTF8( m_Text ) ) == EOF )
|
||||
{
|
||||
success = false;
|
||||
}
|
||||
@ -711,24 +735,23 @@ bool SCH_GLOBALLABEL::Save( FILE* aFile ) const
|
||||
|
||||
/************************************************/
|
||||
bool SCH_GLOBALLABEL::HitTest( const wxPoint& aPosRef )
|
||||
{
|
||||
/************************************************/
|
||||
|
||||
/** Function HitTest
|
||||
* @return true if the point aPosRef is within item area
|
||||
* @param aPosRef = a wxPoint to test
|
||||
*/
|
||||
{
|
||||
EDA_Rect rect = GetBoundingBox();
|
||||
|
||||
return rect.Inside( aPosRef );
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************************/
|
||||
/*****************************************************************************/
|
||||
SCH_HIERLABEL::SCH_HIERLABEL( const wxPoint& pos, const wxString& text ) :
|
||||
SCH_TEXT( pos, text, TYPE_SCH_HIERLABEL )
|
||||
/***********************************************************************************/
|
||||
{
|
||||
/*****************************************************************************/
|
||||
m_Layer = LAYER_HIERLABEL;
|
||||
m_Shape = NET_INPUT;
|
||||
m_IsDangling = TRUE;
|
||||
@ -750,11 +773,9 @@ bool SCH_HIERLABEL::Save( FILE* aFile ) const
|
||||
if( m_Italic )
|
||||
shape = "Italic";
|
||||
if( fprintf( aFile, "Text HLabel %-4d %-4d %-4d %-4d %s %s %d\n%s\n",
|
||||
m_Pos.x, m_Pos.y,
|
||||
m_SchematicOrientation, m_Size.x,
|
||||
SheetLabelType[m_Shape],
|
||||
shape, m_Width,
|
||||
CONV_TO_UTF8( m_Text ) ) == EOF )
|
||||
m_Pos.x, m_Pos.y, m_SchematicOrientation, m_Size.x,
|
||||
SheetLabelType[m_Shape], shape, m_Width,
|
||||
CONV_TO_UTF8( m_Text ) ) == EOF )
|
||||
{
|
||||
success = false;
|
||||
}
|
||||
@ -765,13 +786,12 @@ bool SCH_HIERLABEL::Save( FILE* aFile ) const
|
||||
|
||||
/************************************************/
|
||||
bool SCH_HIERLABEL::HitTest( const wxPoint& aPosRef )
|
||||
{
|
||||
/************************************************/
|
||||
|
||||
/** Function HitTest
|
||||
* @return true if the point aPosRef is within item area
|
||||
* @param aPosRef = a wxPoint to test
|
||||
*/
|
||||
{
|
||||
EDA_Rect rect = GetBoundingBox();
|
||||
|
||||
return rect.Inside( aPosRef );
|
||||
@ -781,23 +801,28 @@ bool SCH_HIERLABEL::HitTest( const wxPoint& aPosRef )
|
||||
/*********************************************************************************************/
|
||||
void SCH_LABEL::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
|
||||
int DrawMode, int Color )
|
||||
/*********************************************************************************************/
|
||||
{
|
||||
/*********************************************************************************************/
|
||||
SCH_TEXT::Draw( panel, DC, offset, DrawMode, Color );
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************************/
|
||||
void SCH_HIERLABEL::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
|
||||
int DrawMode, int Color )
|
||||
/******************************************************************************************/
|
||||
|
||||
/* Texts type Global Label have 4 directions, and the Text origin is the graphic icon
|
||||
*/
|
||||
/*****************************************************************************/
|
||||
void SCH_HIERLABEL::Draw( WinEDA_DrawPanel* panel,
|
||||
wxDC* DC,
|
||||
const wxPoint& offset,
|
||||
int DrawMode,
|
||||
int Color )
|
||||
{
|
||||
/*****************************************************************************/
|
||||
/* Texts type Global Label have 4 directions, and the Text origin is the
|
||||
* graphic icon
|
||||
*/
|
||||
static std::vector <wxPoint> Poly;
|
||||
EDA_Colors color;
|
||||
int linewidth = (m_Width == 0) ? g_DrawDefaultLineThickness : m_Width;
|
||||
int linewidth =
|
||||
( m_Width == 0 ) ? g_DrawDefaultLineThickness : m_Width;
|
||||
|
||||
linewidth = Clamp_Text_PenSize( linewidth, m_Size, m_Bold );
|
||||
|
||||
if( Color >= 0 )
|
||||
@ -809,11 +834,13 @@ void SCH_HIERLABEL::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offs
|
||||
|
||||
EXCHG( linewidth, m_Width ); // Set the minimum width
|
||||
wxPoint text_offset = offset + GetSchematicTextOffset();
|
||||
EDA_TextStruct::Draw( panel, DC, text_offset, color, DrawMode, FILLED, UNSPECIFIED_COLOR );
|
||||
EDA_TextStruct::Draw( panel, DC, text_offset, color, DrawMode, FILLED,
|
||||
UNSPECIFIED_COLOR );
|
||||
EXCHG( linewidth, m_Width ); // set initial value
|
||||
|
||||
CreateGraphicShape( Poly, m_Pos + offset );
|
||||
GRPoly( &panel->m_ClipBox, DC, Poly.size(), &Poly[0], 0, linewidth, color, color );
|
||||
GRPoly( &panel->m_ClipBox, DC, Poly.size(), &Poly[0], 0, linewidth,
|
||||
color, color );
|
||||
|
||||
if( m_IsDangling )
|
||||
DrawDanglingSymbol( panel, DC, m_Pos + offset, color );
|
||||
@ -825,7 +852,8 @@ void SCH_HIERLABEL::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offs
|
||||
* @param aCorner_list = a buffer to fill with polygon corners coordinates
|
||||
* @param Pos = Postion of the shape
|
||||
*/
|
||||
void SCH_HIERLABEL::CreateGraphicShape( std::vector <wxPoint>& aCorner_list, const wxPoint& Pos )
|
||||
void SCH_HIERLABEL::CreateGraphicShape( std::vector <wxPoint>& aCorner_list,
|
||||
const wxPoint& Pos )
|
||||
{
|
||||
int* Template = TemplateShape[m_Shape][m_SchematicOrientation];
|
||||
int HalfSize = m_Size.x / 2;
|
||||
@ -849,8 +877,8 @@ void SCH_HIERLABEL::CreateGraphicShape( std::vector <wxPoint>& aCorner_list, con
|
||||
|
||||
/****************************************/
|
||||
EDA_Rect SCH_HIERLABEL::GetBoundingBox()
|
||||
/****************************************/
|
||||
{
|
||||
/****************************************/
|
||||
int x, y, dx, dy, length, height;
|
||||
|
||||
x = m_Pos.x;
|
||||
@ -865,7 +893,8 @@ EDA_Rect SCH_HIERLABEL::GetBoundingBox()
|
||||
|
||||
switch( m_SchematicOrientation ) // respect orientation
|
||||
{
|
||||
case 0: /* Horiz Normal Orientation (left justified) */
|
||||
case 0: /* Horiz Normal Orientation (left
|
||||
*justified) */
|
||||
dx = -length;
|
||||
dy = height;
|
||||
x += DANGLING_SYMBOL_SIZE;
|
||||
@ -900,14 +929,17 @@ EDA_Rect SCH_HIERLABEL::GetBoundingBox()
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************************/
|
||||
void SCH_GLOBALLABEL::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& aOffset,
|
||||
int DrawMode, int Color )
|
||||
/******************************************************************************************/
|
||||
|
||||
/* Texts type Global Label have 4 directions, and the Text origin is the graphic icon
|
||||
*/
|
||||
/*****************************************************************************/
|
||||
void SCH_GLOBALLABEL::Draw( WinEDA_DrawPanel* panel,
|
||||
wxDC* DC,
|
||||
const wxPoint& aOffset,
|
||||
int DrawMode,
|
||||
int Color )
|
||||
{
|
||||
/*****************************************************************************/
|
||||
/* Texts type Global Label have 4 directions, and the Text origin is the
|
||||
* graphic icon
|
||||
*/
|
||||
static std::vector <wxPoint> Poly;
|
||||
EDA_Colors color;
|
||||
wxPoint text_offset = aOffset + GetSchematicTextOffset();
|
||||
@ -923,11 +955,13 @@ void SCH_GLOBALLABEL::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& aO
|
||||
int linewidth = (m_Width == 0) ? g_DrawDefaultLineThickness : m_Width;
|
||||
linewidth = Clamp_Text_PenSize( linewidth, m_Size, m_Bold );
|
||||
EXCHG( linewidth, m_Width ); // Set the minimum width
|
||||
EDA_TextStruct::Draw( panel, DC, text_offset, color, DrawMode, FILLED, UNSPECIFIED_COLOR );
|
||||
EDA_TextStruct::Draw( panel, DC, text_offset, color, DrawMode, FILLED,
|
||||
UNSPECIFIED_COLOR );
|
||||
EXCHG( linewidth, m_Width ); // set initial value
|
||||
|
||||
CreateGraphicShape( Poly, m_Pos + aOffset );
|
||||
GRPoly( &panel->m_ClipBox, DC, Poly.size(), &Poly[0], 0, linewidth, color, color );
|
||||
GRPoly( &panel->m_ClipBox, DC, Poly.size(), &Poly[0], 0, linewidth,
|
||||
color, color );
|
||||
|
||||
if( m_IsDangling )
|
||||
DrawDanglingSymbol( panel, DC, m_Pos + aOffset, color );
|
||||
@ -939,7 +973,8 @@ void SCH_GLOBALLABEL::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& aO
|
||||
* @param aCorner_list = a buffer to fill with polygon corners coordinates
|
||||
* @param Pos = Position of the shape
|
||||
*/
|
||||
void SCH_GLOBALLABEL::CreateGraphicShape( std::vector <wxPoint>& aCorner_list, const wxPoint& Pos )
|
||||
void SCH_GLOBALLABEL::CreateGraphicShape( std::vector <wxPoint>& aCorner_list,
|
||||
const wxPoint& Pos )
|
||||
{
|
||||
int HalfSize = m_Size.y / 2;
|
||||
int linewidth = (m_Width == 0) ? g_DrawDefaultLineThickness : m_Width;
|
||||
@ -948,17 +983,20 @@ void SCH_GLOBALLABEL::CreateGraphicShape( std::vector <wxPoint>& aCorner_list, c
|
||||
|
||||
aCorner_list.clear();
|
||||
|
||||
int symb_len = LenSize( m_Text ) + (TXTMARGE * 2);
|
||||
int symb_len = LenSize( m_Text ) + ( TXTMARGE * 2 );
|
||||
|
||||
// Create outline shape : 6 points
|
||||
int x = symb_len + linewidth + 3;
|
||||
int y = wxRound( (double) HalfSize * 1.5 + (double) linewidth + 3.0 ); // 50% more for negation bar
|
||||
aCorner_list.push_back( wxPoint( 0, 0 ) ); // Starting point (anchor)
|
||||
aCorner_list.push_back( wxPoint( 0, -y ) ); // Up
|
||||
aCorner_list.push_back( wxPoint( -x, -y ) ); // left Up
|
||||
aCorner_list.push_back( wxPoint( -x, 0 ) ); // left
|
||||
aCorner_list.push_back( wxPoint( -x, y ) ); // left down
|
||||
aCorner_list.push_back( wxPoint( 0, y ) ); // down
|
||||
|
||||
// 50% more for negation bar
|
||||
int y = wxRound( (double) HalfSize * 1.5 + (double) linewidth + 3.0 );
|
||||
// Starting point(anchor)
|
||||
aCorner_list.push_back( wxPoint( 0, 0 ) );
|
||||
aCorner_list.push_back( wxPoint( 0, -y ) ); // Up
|
||||
aCorner_list.push_back( wxPoint( -x, -y ) ); // left
|
||||
aCorner_list.push_back( wxPoint( -x, 0 ) ); // Up left
|
||||
aCorner_list.push_back( wxPoint( -x, y ) ); // left down
|
||||
aCorner_list.push_back( wxPoint( 0, y ) ); // down
|
||||
|
||||
int x_offset = 0;
|
||||
|
||||
@ -989,7 +1027,7 @@ void SCH_GLOBALLABEL::CreateGraphicShape( std::vector <wxPoint>& aCorner_list, c
|
||||
|
||||
switch( m_SchematicOrientation )
|
||||
{
|
||||
case 0: /* Orientation horiz normale */
|
||||
case 0: /* Orientation horiz normal */
|
||||
break;
|
||||
|
||||
case 1: /* Orientation vert UP */
|
||||
@ -1020,8 +1058,8 @@ void SCH_GLOBALLABEL::CreateGraphicShape( std::vector <wxPoint>& aCorner_list, c
|
||||
|
||||
/******************************************/
|
||||
EDA_Rect SCH_GLOBALLABEL::GetBoundingBox()
|
||||
/******************************************/
|
||||
{
|
||||
/******************************************/
|
||||
int x, y, dx, dy, length, height;
|
||||
|
||||
x = m_Pos.x;
|
||||
@ -1030,14 +1068,12 @@ EDA_Rect SCH_GLOBALLABEL::GetBoundingBox()
|
||||
|
||||
int width = (m_Width == 0) ? g_DrawDefaultLineThickness : m_Width;
|
||||
height = ( (m_Size.y * 15) / 10 ) + width + 2 * TXTMARGE;
|
||||
length =
|
||||
LenSize( m_Text ) // text X size
|
||||
+ height // add height for triangular shapes (bidirectional)
|
||||
+ DANGLING_SYMBOL_SIZE;
|
||||
// text X size add height for triangular shapes(bidirectional)
|
||||
length = LenSize( m_Text ) + height + DANGLING_SYMBOL_SIZE;
|
||||
|
||||
switch( m_SchematicOrientation ) // respect orientation
|
||||
{
|
||||
case 0: /* Horiz Normal Orientation (left justified) */
|
||||
case 0: /* Horiz Normal Orientation (left justified) */
|
||||
dx = -length;
|
||||
dy = height;
|
||||
x += DANGLING_SYMBOL_SIZE;
|
||||
@ -1074,8 +1110,8 @@ EDA_Rect SCH_GLOBALLABEL::GetBoundingBox()
|
||||
|
||||
/***********************************/
|
||||
EDA_Rect SCH_TEXT::GetBoundingBox()
|
||||
/***********************************/
|
||||
{
|
||||
/***********************************/
|
||||
int x, y, dx, dy, length, height;
|
||||
|
||||
x = m_Pos.x;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/********************************************/
|
||||
/* Definitions for the EESchema program: */
|
||||
/* Definitions for the EESchema program: */
|
||||
/********************************************/
|
||||
|
||||
#ifndef CLASS_TEXT_LABEL_H
|
||||
@ -10,7 +10,7 @@
|
||||
|
||||
/* Type of SCH_HIERLABEL and SCH_GLOBALLABEL
|
||||
* mainly used to handle the graphic associated shape
|
||||
*/
|
||||
*/
|
||||
typedef enum {
|
||||
NET_INPUT,
|
||||
NET_OUTPUT,
|
||||
@ -29,20 +29,30 @@ class SCH_TEXT : public SCH_ITEM,
|
||||
public:
|
||||
int m_Layer;
|
||||
int m_Shape;
|
||||
bool m_IsDangling; // true if not connected (used to draw the "not connected" symbol
|
||||
bool m_IsDangling; // true if not connected (used to draw the "not
|
||||
// connected" symbol
|
||||
protected:
|
||||
int m_SchematicOrientation; /* orientation of texts (comments) and labels in schematic
|
||||
* 0 = normal (horizontal, left justified).
|
||||
int m_SchematicOrientation; /* orientation of texts (comments) and
|
||||
* labels in schematic
|
||||
* 0 = normal (horizontal, left
|
||||
* justified).
|
||||
* 1 = up (vertical)
|
||||
* 2 = (horizontal, rignt justified). This can be seen as the mirrored position of 0
|
||||
* 3 = bottom . This can be seen as the mirrored position of up
|
||||
* this is perhaps a duplicate of m_Orient and m_HJustified or m_VJustified,
|
||||
* but is more easy to handle that 3 parmeters in editions, Reading and Saving file
|
||||
* 2 = (horizontal, right justified).
|
||||
* This can be seen as the mirrored
|
||||
* position of 0
|
||||
* 3 = bottom . This can be seen as the
|
||||
* mirrored position of up
|
||||
* this is perhaps a duplicate of m_Orient
|
||||
* and m_HJustified or m_VJustified,
|
||||
* but is more easy to handle that 3
|
||||
* parameters in editions, Reading and
|
||||
* Saving file
|
||||
*/
|
||||
|
||||
|
||||
public:
|
||||
SCH_TEXT( const wxPoint& pos = wxPoint( 0, 0 ), const wxString& text = wxEmptyString,
|
||||
SCH_TEXT( const wxPoint& pos = wxPoint( 0, 0 ),
|
||||
const wxString& text = wxEmptyString,
|
||||
KICAD_T aType = TYPE_SCH_TEXT );
|
||||
~SCH_TEXT() { }
|
||||
|
||||
@ -54,69 +64,79 @@ public:
|
||||
|
||||
/** function SetTextOrientAndJustifyParmeters
|
||||
* Set m_SchematicOrientation, and initialize
|
||||
* m_orient,m_HJustified and m_VJustified, according to the value of m_SchematicOrientation (for a text )
|
||||
* m_orient,m_HJustified and m_VJustified, according to the value of
|
||||
* m_SchematicOrientation (for a text )
|
||||
* must be called after changing m_SchematicOrientation
|
||||
* @param aSchematicOrientation =
|
||||
* 0 = normal (horizontal, left justified).
|
||||
* 1 = up (vertical)
|
||||
* 2 = (horizontal, rignt justified). This can be seen as the mirrored position of 0
|
||||
* 2 = (horizontal, right justified). This can be seen as the mirrored
|
||||
* position of 0
|
||||
* 3 = bottom . This can be seen as the mirrored position of up
|
||||
*/
|
||||
virtual void SetSchematicTextOrientation( int aSchematicOrientation );
|
||||
virtual void SetSchematicTextOrientation( int aSchematicOrientation );
|
||||
|
||||
int GetSchematicTextOrientation() { return m_SchematicOrientation;}
|
||||
int GetSchematicTextOrientation() { return m_SchematicOrientation; }
|
||||
|
||||
/** function GetSchematicTextOffset (virtual)
|
||||
* @return the offset between the SCH_TEXT position and the text itself position
|
||||
* @return the offset between the SCH_TEXT position and the text itself
|
||||
* position
|
||||
* This offset depend on orientation, and the type of text
|
||||
* (room to draw an associated graphic symbol, or put the text above a wire)
|
||||
* (room to draw an associated graphic symbol, or put the text above a
|
||||
* wire)
|
||||
*/
|
||||
virtual wxPoint GetSchematicTextOffset( );
|
||||
virtual wxPoint GetSchematicTextOffset();
|
||||
|
||||
SCH_TEXT* GenCopy();
|
||||
virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int draw_mode,
|
||||
int Color = -1 );
|
||||
SCH_TEXT* GenCopy();
|
||||
virtual void Draw( WinEDA_DrawPanel* panel,
|
||||
wxDC* DC,
|
||||
const wxPoint& offset,
|
||||
int draw_mode,
|
||||
int Color = -1 );
|
||||
|
||||
void SwapData( SCH_TEXT* copyitem );
|
||||
void SwapData( SCH_TEXT* copyitem );
|
||||
|
||||
void Place( WinEDA_SchematicFrame* frame, wxDC* DC );
|
||||
void Place( WinEDA_SchematicFrame* frame, wxDC* DC );
|
||||
|
||||
/** Function HitTest
|
||||
* @return true if the point aPosRef is within item area
|
||||
* @param aPosRef = a wxPoint to test
|
||||
*/
|
||||
bool HitTest( const wxPoint& aPosRef );
|
||||
bool HitTest( const wxPoint& aPosRef );
|
||||
|
||||
EDA_Rect GetBoundingBox();
|
||||
EDA_Rect GetBoundingBox();
|
||||
|
||||
/**
|
||||
* Function Save
|
||||
* writes the data structures for this object out to a FILE in "*.brd" format.
|
||||
* writes the data structures for this object out to a FILE in "*.sch"
|
||||
* format.
|
||||
* @param aFile The FILE to write to.
|
||||
* @return bool - true if success writing else false.
|
||||
*/
|
||||
bool Save( FILE* aFile ) const;
|
||||
bool Save( FILE* aFile ) const;
|
||||
|
||||
/** Function GetPenSize
|
||||
* @return the size of the "pen" that be used to draw or plot this item
|
||||
*/
|
||||
int GetPenSize( );
|
||||
int GetPenSize();
|
||||
|
||||
// Geometric transforms (used in block operations):
|
||||
|
||||
/** virtual function Move
|
||||
* move item to a new position.
|
||||
* @param aMoveVector = the deplacement vector
|
||||
* @param aMoveVector = the displacement vector
|
||||
*/
|
||||
virtual void Move(const wxPoint& aMoveVector)
|
||||
virtual void Move( const wxPoint& aMoveVector )
|
||||
{
|
||||
m_Pos += aMoveVector;
|
||||
}
|
||||
|
||||
|
||||
/** virtual function Mirror_Y
|
||||
* mirror item relative to an Y axis
|
||||
* @param aYaxis_position = the y axis position
|
||||
*/
|
||||
virtual void Mirror_Y(int aYaxis_position);
|
||||
virtual void Mirror_Y( int aYaxis_position );
|
||||
|
||||
#if defined(DEBUG)
|
||||
void Show( int nestLevel, std::ostream& os );
|
||||
@ -128,10 +148,14 @@ public:
|
||||
class SCH_LABEL : public SCH_TEXT
|
||||
{
|
||||
public:
|
||||
SCH_LABEL( const wxPoint& pos = wxPoint( 0, 0 ), const wxString& text = wxEmptyString );
|
||||
SCH_LABEL( const wxPoint& pos = wxPoint( 0, 0 ),
|
||||
const wxString& text = wxEmptyString );
|
||||
~SCH_LABEL() { }
|
||||
virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int draw_mode,
|
||||
int Color = -1 );
|
||||
virtual void Draw( WinEDA_DrawPanel* panel,
|
||||
wxDC* DC,
|
||||
const wxPoint& offset,
|
||||
int draw_mode,
|
||||
int Color = -1 );
|
||||
|
||||
virtual wxString GetClass() const
|
||||
{
|
||||
@ -141,30 +165,35 @@ public:
|
||||
|
||||
/** function SetTextOrientAndJustifyParmeters
|
||||
* Set m_SchematicOrientation, and initialize
|
||||
* m_orient,m_HJustified and m_VJustified, according to the value of m_SchematicOrientation (for a label)
|
||||
* m_orient,m_HJustified and m_VJustified, according to the value of
|
||||
* m_SchematicOrientation (for a label)
|
||||
* must be called after changing m_SchematicOrientation
|
||||
* @param aSchematicOrientation =
|
||||
* 0 = normal (horizontal, left justified).
|
||||
* 1 = up (vertical)
|
||||
* 2 = (horizontal, rignt justified). This can be seen as the mirrored position of 0
|
||||
* 2 = (horizontal, right justified). This can be seen as the mirrored
|
||||
* position of 0
|
||||
* 3 = bottom . This can be seen as the mirrored position of up
|
||||
*/
|
||||
virtual void SetSchematicTextOrientation( int aSchematicOrientation );
|
||||
virtual void SetSchematicTextOrientation( int aSchematicOrientation );
|
||||
|
||||
/** function GetSchematicTextOffset (virtual)
|
||||
* @return the offset between the SCH_TEXT position and the text itself position
|
||||
* @return the offset between the SCH_TEXT position and the text itself
|
||||
* position
|
||||
* This offset depend on orientation, and the type of text
|
||||
* (room to draw an associated graphic symbol, or put the text above a wire)
|
||||
* (room to draw an associated graphic symbol, or put the text above a
|
||||
* wire)
|
||||
*/
|
||||
virtual wxPoint GetSchematicTextOffset( );
|
||||
virtual wxPoint GetSchematicTextOffset();
|
||||
|
||||
/**
|
||||
* Function Save
|
||||
* writes the data structures for this object out to a FILE in "*.brd" format.
|
||||
* writes the data structures for this object out to a FILE in "*.sch"
|
||||
* format.
|
||||
* @param aFile The FILE to write to.
|
||||
* @return bool - true if success writing else false.
|
||||
*/
|
||||
bool Save( FILE* aFile ) const;
|
||||
bool Save( FILE* aFile ) const;
|
||||
};
|
||||
|
||||
|
||||
@ -174,8 +203,11 @@ public:
|
||||
SCH_GLOBALLABEL( const wxPoint& pos = wxPoint( 0, 0 ),
|
||||
const wxString& text = wxEmptyString );
|
||||
~SCH_GLOBALLABEL() { }
|
||||
virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int draw_mode,
|
||||
int Color = -1 );
|
||||
virtual void Draw( WinEDA_DrawPanel* panel,
|
||||
wxDC* DC,
|
||||
const wxPoint& offset,
|
||||
int draw_mode,
|
||||
int Color = -1 );
|
||||
|
||||
virtual wxString GetClass() const
|
||||
{
|
||||
@ -185,51 +217,57 @@ public:
|
||||
|
||||
/** function SetTextOrientAndJustifyParmeters
|
||||
* Set m_SchematicOrientation, and initialize
|
||||
* m_orient,m_HJustified and m_VJustified, according to the value of m_SchematicOrientation
|
||||
* m_orient,m_HJustified and m_VJustified, according to the value of
|
||||
* m_SchematicOrientation
|
||||
* must be called after changing m_SchematicOrientation
|
||||
* @param aSchematicOrientation =
|
||||
* 0 = normal (horizontal, left justified).
|
||||
* 1 = up (vertical)
|
||||
* 2 = (horizontal, rignt justified). This can be seen as the mirrored position of 0
|
||||
* 2 = (horizontal, right justified). This can be seen as the mirrored
|
||||
* position of 0
|
||||
* 3 = bottom . This can be seen as the mirrored position of up
|
||||
*/
|
||||
virtual void SetSchematicTextOrientation( int aSchematicOrientation );
|
||||
virtual void SetSchematicTextOrientation( int aSchematicOrientation );
|
||||
|
||||
/** function GetSchematicTextOffset (virtual)
|
||||
* @return the offset between the SCH_TEXT position and the text itself position
|
||||
* @return the offset between the SCH_TEXT position and the text itself
|
||||
* position
|
||||
* This offset depend on orientation, and the type of text
|
||||
* (room to draw an associated graphic symbol, or put the text above a wire)
|
||||
* (room to draw an associated graphic symbol, or put the text above a
|
||||
* wire)
|
||||
*/
|
||||
virtual wxPoint GetSchematicTextOffset( );
|
||||
virtual wxPoint GetSchematicTextOffset();
|
||||
|
||||
/**
|
||||
* Function Save
|
||||
* writes the data structures for this object out to a FILE in "*.brd" format.
|
||||
* writes the data structures for this object out to a FILE in "*.sch"
|
||||
* format.
|
||||
* @param aFile The FILE to write to.
|
||||
* @return bool - true if success writing else false.
|
||||
*/
|
||||
bool Save( FILE* aFile ) const;
|
||||
bool Save( FILE* aFile ) const;
|
||||
|
||||
/** Function HitTest
|
||||
* @return true if the point aPosRef is within item area
|
||||
* @param aPosRef = a wxPoint to test
|
||||
*/
|
||||
bool HitTest( const wxPoint& aPosRef );
|
||||
bool HitTest( const wxPoint& aPosRef );
|
||||
|
||||
EDA_Rect GetBoundingBox();
|
||||
EDA_Rect GetBoundingBox();
|
||||
|
||||
/** function CreateGraphicShape
|
||||
* Calculates the graphic shape (a polygon) associated to the text
|
||||
* @param aCorner_list = a buffer to fill with polygon corners coordinates
|
||||
* @param Pos = Position of the shape
|
||||
*/
|
||||
void CreateGraphicShape( std::vector <wxPoint>& aCorner_list, const wxPoint& Pos );
|
||||
void CreateGraphicShape( std::vector <wxPoint>& aCorner_list,
|
||||
const wxPoint& Pos );
|
||||
|
||||
/** virtual function Mirror_Y
|
||||
* mirror item relative to an Y axis
|
||||
* @param aYaxis_position = the y axis position
|
||||
*/
|
||||
virtual void Mirror_Y(int aYaxis_position);
|
||||
virtual void Mirror_Y( int aYaxis_position );
|
||||
};
|
||||
|
||||
|
||||
@ -239,8 +277,11 @@ public:
|
||||
SCH_HIERLABEL( const wxPoint& pos = wxPoint( 0, 0 ),
|
||||
const wxString& text = wxEmptyString );
|
||||
~SCH_HIERLABEL() { }
|
||||
virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int draw_mode,
|
||||
int Color = -1 );
|
||||
virtual void Draw( WinEDA_DrawPanel* panel,
|
||||
wxDC* DC,
|
||||
const wxPoint& offset,
|
||||
int draw_mode,
|
||||
int Color = -1 );
|
||||
|
||||
virtual wxString GetClass() const
|
||||
{
|
||||
@ -250,50 +291,57 @@ public:
|
||||
|
||||
/** function SetTextOrientAndJustifyParmeters
|
||||
* Set m_SchematicOrientation, and initialize
|
||||
* m_orient,m_HJustified and m_VJustified, according to the value of m_SchematicOrientation
|
||||
* m_orient,m_HJustified and m_VJustified, according to the value of
|
||||
* m_SchematicOrientation
|
||||
* must be called after changing m_SchematicOrientation
|
||||
* @param aSchematicOrientation =
|
||||
* 0 = normal (horizontal, left justified).
|
||||
* 1 = up (vertical)
|
||||
* 2 = (horizontal, rignt justified). This can be seen as the mirrored position of 0
|
||||
* 2 = (horizontal, right justified). This can be seen as the mirrored
|
||||
* position of 0
|
||||
* 3 = bottom . This can be seen as the mirrored position of up
|
||||
*/
|
||||
virtual void SetSchematicTextOrientation( int aSchematicOrientation );
|
||||
virtual void SetSchematicTextOrientation( int aSchematicOrientation );
|
||||
|
||||
/** function GetSchematicTextOffset (virtual)
|
||||
* @return the offset between the SCH_TEXT position and the text itself position
|
||||
* @return the offset between the SCH_TEXT position and the text itself
|
||||
* position
|
||||
* This offset depend on orientation, and the type of text
|
||||
* (room to draw an associated graphic symbol, or put the text above a wire)
|
||||
* (room to draw an associated graphic symbol, or put the text above a
|
||||
* wire)
|
||||
*/
|
||||
virtual wxPoint GetSchematicTextOffset( );
|
||||
virtual wxPoint GetSchematicTextOffset();
|
||||
|
||||
/** function CreateGraphicShape
|
||||
* Calculates the graphic shape (a polygon) associated to the text
|
||||
* @param aCorner_list = a buffer to fill with polygon corners coordinates
|
||||
* @param Pos = Postion of the shape
|
||||
*/
|
||||
void CreateGraphicShape( std::vector <wxPoint>& aCorner_list, const wxPoint& Pos );
|
||||
void CreateGraphicShape( std::vector <wxPoint>& aCorner_list,
|
||||
const wxPoint& Pos );
|
||||
|
||||
/**
|
||||
* Function Save
|
||||
* writes the data structures for this object out to a FILE in "*.brd" format.
|
||||
* writes the data structures for this object out to a FILE in "*.sch"
|
||||
* format.
|
||||
* @param aFile The FILE to write to.
|
||||
* @return bool - true if success writing else false.
|
||||
*/
|
||||
bool Save( FILE* aFile ) const;
|
||||
bool Save( FILE* aFile ) const;
|
||||
|
||||
/** Function HitTest
|
||||
* @return true if the point aPosRef is within item area
|
||||
* @param aPosRef = a wxPoint to test
|
||||
*/
|
||||
bool HitTest( const wxPoint& aPosRef );
|
||||
bool HitTest( const wxPoint& aPosRef );
|
||||
|
||||
EDA_Rect GetBoundingBox();
|
||||
|
||||
EDA_Rect GetBoundingBox();
|
||||
/** virtual function Mirror_Y
|
||||
* mirror item relative to an Y axis
|
||||
* @param aYaxis_position = the y axis position
|
||||
*/
|
||||
virtual void Mirror_Y(int aYaxis_position);
|
||||
virtual void Mirror_Y( int aYaxis_position );
|
||||
};
|
||||
|
||||
#endif /* CLASS_TEXT_LABEL_H */
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*********************************/
|
||||
/* Module de nettoyage du schema */
|
||||
/*********************************/
|
||||
/**************************************/
|
||||
/* Code to handle schematic clean up. */
|
||||
/**************************************/
|
||||
|
||||
#include "fctsys.h"
|
||||
#include "appl_wxstruct.h"
|
||||
@ -15,21 +15,18 @@
|
||||
#include "netlist.h"
|
||||
|
||||
|
||||
/* Routines locales */
|
||||
static int TstAlignSegment( EDA_DrawLineStruct* RefSegm, EDA_DrawLineStruct* TstSegm );
|
||||
|
||||
/* Variable locales */
|
||||
static int TstAlignSegment( EDA_DrawLineStruct* RefSegm,
|
||||
EDA_DrawLineStruct* TstSegm );
|
||||
|
||||
|
||||
/*******************************************/
|
||||
bool SCH_SCREEN::SchematicCleanUp( wxDC* DC )
|
||||
/*******************************************/
|
||||
|
||||
/* Routine de nettoyage:
|
||||
* - regroupe les segments de fils (ou de bus) alignes en 1 seul segment
|
||||
* - Detecte les objets identiques superposes
|
||||
*/
|
||||
{
|
||||
/*******************************************/
|
||||
/* Routine cleaning:
|
||||
* - Includes segments or buses aligned in only 1 segment
|
||||
* - Detects identical objects superimposed
|
||||
*/
|
||||
SCH_ITEM* DrawList, * TstDrawList;
|
||||
int flag;
|
||||
bool Modify = FALSE;
|
||||
@ -50,9 +47,10 @@ bool SCH_SCREEN::SchematicCleanUp( wxDC* DC )
|
||||
{
|
||||
flag = TstAlignSegment( (EDA_DrawLineStruct*) DrawList,
|
||||
(EDA_DrawLineStruct*) TstDrawList );
|
||||
if( flag ) /* Suppression de TstSegm */
|
||||
if( flag )
|
||||
{
|
||||
/* keep the bits set in .m_Flags, because the deleted segment can be flagged */
|
||||
/* keep the bits set in .m_Flags, because the deleted
|
||||
* segment can be flagged */
|
||||
DrawList->m_Flags |= TstDrawList->m_Flags;
|
||||
EraseStruct( TstDrawList, this );
|
||||
SetRefreshReq();
|
||||
@ -75,18 +73,16 @@ bool SCH_SCREEN::SchematicCleanUp( wxDC* DC )
|
||||
|
||||
/***********************************************/
|
||||
void BreakSegmentOnJunction( SCH_SCREEN* Screen )
|
||||
/************************************************/
|
||||
|
||||
/* Routine creant des debuts / fin de segment (BUS ou WIRES) sur les jonctions
|
||||
* et les raccords
|
||||
*/
|
||||
{
|
||||
/************************************************/
|
||||
/* Routine to start/end segment (BUS or wires) on junctions.
|
||||
*/
|
||||
SCH_ITEM* DrawList;
|
||||
|
||||
if( Screen == NULL )
|
||||
{
|
||||
DisplayError( NULL,
|
||||
wxT( "BreakSegmentOnJunction() error: NULL screen" ) );
|
||||
wxT( "BreakSegmentOnJunction() error: NULL screen" ) );
|
||||
return;
|
||||
}
|
||||
|
||||
@ -134,24 +130,28 @@ void BreakSegmentOnJunction( SCH_SCREEN* Screen )
|
||||
* ( excluding ends)
|
||||
* fill aPicklist with modified items if non null
|
||||
*/
|
||||
void BreakSegment(SCH_SCREEN * aScreen, wxPoint aBreakpoint )
|
||||
void BreakSegment( SCH_SCREEN* aScreen, wxPoint aBreakpoint )
|
||||
{
|
||||
EDA_DrawLineStruct* segment, * NewSegment;
|
||||
for( SCH_ITEM* DrawList = aScreen->EEDrawList;DrawList; DrawList = DrawList->Next() )
|
||||
|
||||
for( SCH_ITEM* DrawList = aScreen->EEDrawList; DrawList;
|
||||
DrawList = DrawList->Next() )
|
||||
{
|
||||
if( DrawList->Type() != DRAW_SEGMENT_STRUCT_TYPE )
|
||||
continue;
|
||||
if( DrawList->Type() != DRAW_SEGMENT_STRUCT_TYPE )
|
||||
continue;
|
||||
|
||||
segment = (EDA_DrawLineStruct*) DrawList;
|
||||
|
||||
if( !TestSegmentHit( aBreakpoint, segment->m_Start, segment->m_End, 0 ) )
|
||||
continue;
|
||||
|
||||
/* Segment connecte: doit etre coupe en 2 si px,py n'est
|
||||
/* * JP translate * Segment connecte: doit etre coupe en 2 si px,py
|
||||
* n'est
|
||||
* pas une extremite */
|
||||
if( (segment->m_Start == aBreakpoint) || (segment->m_End == aBreakpoint ) )
|
||||
if( ( segment->m_Start == aBreakpoint )
|
||||
|| ( segment->m_End == aBreakpoint ) )
|
||||
continue;
|
||||
/* Ici il faut couper le segment en 2 */
|
||||
/* Here we must cut the segment into 2. */
|
||||
NewSegment = segment->GenCopy();
|
||||
NewSegment->m_Start = aBreakpoint;
|
||||
segment->m_End = NewSegment->m_Start;
|
||||
@ -165,35 +165,36 @@ void BreakSegment(SCH_SCREEN * aScreen, wxPoint aBreakpoint )
|
||||
/***********************************************************/
|
||||
static int TstAlignSegment( EDA_DrawLineStruct* RefSegm,
|
||||
EDA_DrawLineStruct* TstSegm )
|
||||
{
|
||||
/***********************************************************/
|
||||
|
||||
/* Search if the 2 segments RefSegm and TstSegm are on a line.
|
||||
* Retourn 0 if no
|
||||
* Return 0 if no
|
||||
* 1 if yes, and RefSegm is modified to be the equivalent segment
|
||||
*/
|
||||
{
|
||||
if( RefSegm == TstSegm )
|
||||
return 0;
|
||||
if( RefSegm->GetLayer() != TstSegm->GetLayer() )
|
||||
return 0;
|
||||
|
||||
// search for a common end, and modify coordinates to ensure RefSegm->m_End == TstSegm->m_Start
|
||||
// search for a common end, and modify coordinates to ensure RefSegm->m_End
|
||||
// == TstSegm->m_Start
|
||||
if( RefSegm->m_Start == TstSegm->m_Start )
|
||||
{
|
||||
if( RefSegm->m_End == TstSegm->m_End ) // trivial case: RefSegm and TstSegm are identical
|
||||
if( RefSegm->m_End == TstSegm->m_End )
|
||||
return 1;
|
||||
EXCHG( RefSegm->m_Start, RefSegm->m_End ); // at this point, RefSegm->m_End == TstSegm->m_Start
|
||||
EXCHG( RefSegm->m_Start, RefSegm->m_End );
|
||||
}
|
||||
else if( RefSegm->m_Start == TstSegm->m_End )
|
||||
{
|
||||
EXCHG( RefSegm->m_Start, RefSegm->m_End );
|
||||
EXCHG( TstSegm->m_Start, TstSegm->m_End ); // at this point, RefSegm->m_End == TstSegm->m_Start
|
||||
EXCHG( TstSegm->m_Start, TstSegm->m_End );
|
||||
}
|
||||
else if( RefSegm->m_End == TstSegm->m_End )
|
||||
{
|
||||
EXCHG( TstSegm->m_Start, TstSegm->m_End ); // at this point, RefSegm->m_End == TstSegm->m_Start
|
||||
EXCHG( TstSegm->m_Start, TstSegm->m_End );
|
||||
}
|
||||
else if( RefSegm->m_End != TstSegm->m_Start ) // No common end point, segments cannot be merged
|
||||
else if( RefSegm->m_End != TstSegm->m_Start )
|
||||
// No common end point, segments cannot be merged.
|
||||
return 0;
|
||||
|
||||
/* Test alignment: */
|
||||
|
@ -18,12 +18,13 @@
|
||||
#include "class_marker_sch.h"
|
||||
|
||||
|
||||
/**************************************************************************************/
|
||||
SCH_ITEM* WinEDA_SchematicFrame:: SchematicGeneralLocateAndDisplay( bool IncludePin )
|
||||
/**************************************************************************************/
|
||||
|
||||
/*****************************************************************************/
|
||||
SCH_ITEM* WinEDA_SchematicFrame:: SchematicGeneralLocateAndDisplay(
|
||||
bool IncludePin )
|
||||
{
|
||||
/*****************************************************************************/
|
||||
/** Function SchematicGeneralLocateAndDisplay
|
||||
* Overlayed function
|
||||
* Overlaid function
|
||||
* Find the schematic item at cursor position
|
||||
* the priority order is:
|
||||
* - marker
|
||||
@ -34,11 +35,10 @@ SCH_ITEM* WinEDA_SchematicFrame:: SchematicGeneralLocateAndDisplay( bool Include
|
||||
* - pin
|
||||
* - component
|
||||
* @return an EDA_BaseStruct pointer on the item or NULL if no item found
|
||||
* @param IncludePin = true to search for pins, fase to ignore them
|
||||
* @param IncludePin = true to search for pins, false to ignore them
|
||||
*
|
||||
* For some items, caracteristics are displayed on the screen.
|
||||
* For some items, characteristics are displayed on the screen.
|
||||
*/
|
||||
{
|
||||
SCH_ITEM* DrawStruct;
|
||||
wxString msg;
|
||||
wxPoint mouse_position = GetScreen()->m_MousePosition;
|
||||
@ -67,7 +67,7 @@ SCH_ITEM* WinEDA_SchematicFrame:: SchematicGeneralLocateAndDisplay( bool Include
|
||||
Pin = LocateAnyPin( GetScreen()->EEDrawList, GetScreen()->m_Curseur,
|
||||
&LibItem );
|
||||
if( Pin )
|
||||
break; // Priority is probing a pin first
|
||||
break; // Priority is probing a pin first
|
||||
LibItem = (SCH_COMPONENT*) DrawStruct;
|
||||
SendMessageToPCBNEW( DrawStruct, LibItem );
|
||||
break;
|
||||
@ -92,20 +92,22 @@ SCH_ITEM* WinEDA_SchematicFrame:: SchematicGeneralLocateAndDisplay( bool Include
|
||||
LibItem->GetField( VALUE )->m_Text, DARKCYAN );
|
||||
|
||||
// Cross probing:2 - pin found, and send a locate pin command to
|
||||
// pcbnew (hightlight net)
|
||||
// pcbnew (highlight net)
|
||||
SendMessageToPCBNEW( Pin, LibItem );
|
||||
}
|
||||
return DrawStruct;
|
||||
}
|
||||
|
||||
|
||||
/********************************************************************************************/
|
||||
SCH_ITEM* WinEDA_SchematicFrame::SchematicGeneralLocateAndDisplay( const wxPoint& refpoint,
|
||||
bool IncludePin )
|
||||
/********************************************************************************************/
|
||||
|
||||
/*****************************************************************************/
|
||||
SCH_ITEM* WinEDA_SchematicFrame::SchematicGeneralLocateAndDisplay(
|
||||
const wxPoint& refpoint,
|
||||
bool
|
||||
IncludePin )
|
||||
{
|
||||
/*****************************************************************************/
|
||||
/** Function SchematicGeneralLocateAndDisplay
|
||||
* Overlayed function
|
||||
* Overlaid function
|
||||
* Find the schematic item at a given position
|
||||
* the priority order is:
|
||||
* - marker
|
||||
@ -116,12 +118,11 @@ SCH_ITEM* WinEDA_SchematicFrame::SchematicGeneralLocateAndDisplay( const wxPoint
|
||||
* - pin
|
||||
* - component
|
||||
* @return an EDA_BaseStruct pointer on the item or NULL if no item found
|
||||
* @param refpoint = the wxPoint loaction where to search
|
||||
* @param IncludePin = true to search for pins, fase to ignore them
|
||||
* @param refpoint = the wxPoint location where to search
|
||||
* @param IncludePin = true to search for pins, false to ignore them
|
||||
*
|
||||
* For some items, caracteristics are displayed on the screen.
|
||||
* For some items, characteristics are displayed on the screen.
|
||||
*/
|
||||
{
|
||||
SCH_ITEM* DrawStruct;
|
||||
LIB_PIN* Pin;
|
||||
SCH_COMPONENT* LibItem;
|
||||
@ -148,10 +149,14 @@ SCH_ITEM* WinEDA_SchematicFrame::SchematicGeneralLocateAndDisplay( const wxPoint
|
||||
return DrawStruct;
|
||||
}
|
||||
|
||||
DrawStruct = (SCH_ITEM*) PickStruct( refpoint, GetScreen(), WIREITEM | BUSITEM | RACCORDITEM );
|
||||
if( DrawStruct ) // We have found a wire: Search for a connected pin at the same location
|
||||
DrawStruct = (SCH_ITEM*) PickStruct( refpoint,
|
||||
GetScreen(), WIREITEM | BUSITEM |
|
||||
RACCORDITEM );
|
||||
if( DrawStruct ) // We have found a wire: Search for a connected pin at
|
||||
// the same location
|
||||
{
|
||||
Pin = LocateAnyPin( (SCH_ITEM*) m_CurrentSheet->LastDrawList(), refpoint, &LibItem );
|
||||
Pin = LocateAnyPin(
|
||||
(SCH_ITEM*) m_CurrentSheet->LastDrawList(), refpoint, &LibItem );
|
||||
if( Pin )
|
||||
{
|
||||
Pin->DisplayInfo( this );
|
||||
@ -176,7 +181,7 @@ SCH_ITEM* WinEDA_SchematicFrame::SchematicGeneralLocateAndDisplay( const wxPoint
|
||||
|
||||
/* search for a pin */
|
||||
Pin = LocateAnyPin( (SCH_ITEM*) m_CurrentSheet->LastDrawList(), refpoint,
|
||||
&LibItem );
|
||||
&LibItem );
|
||||
if( Pin )
|
||||
{
|
||||
Pin->DisplayInfo( this );
|
||||
@ -203,7 +208,6 @@ SCH_ITEM* WinEDA_SchematicFrame::SchematicGeneralLocateAndDisplay( const wxPoint
|
||||
return DrawStruct;
|
||||
}
|
||||
|
||||
// Recherche des autres elements
|
||||
DrawStruct = (SCH_ITEM*) PickStruct( refpoint, GetScreen(), SEARCHALL );
|
||||
if( DrawStruct )
|
||||
{
|
||||
@ -215,7 +219,7 @@ SCH_ITEM* WinEDA_SchematicFrame::SchematicGeneralLocateAndDisplay( const wxPoint
|
||||
}
|
||||
|
||||
|
||||
void WinEDA_SchematicFrame::GeneralControle( wxDC* DC,
|
||||
void WinEDA_SchematicFrame::GeneralControle( wxDC* DC,
|
||||
wxPoint MousePositionInPixels )
|
||||
{
|
||||
wxRealPoint delta;
|
||||
@ -241,27 +245,27 @@ void WinEDA_SchematicFrame::GeneralControle( wxDC* DC,
|
||||
case 0:
|
||||
break;
|
||||
|
||||
case WXK_NUMPAD8: /* Deplacement curseur vers le haut */
|
||||
case WXK_NUMPAD8:
|
||||
case WXK_UP:
|
||||
MousePositionInPixels.y -= wxRound(delta.y);
|
||||
MousePositionInPixels.y -= wxRound( delta.y );
|
||||
DrawPanel->MouseTo( MousePositionInPixels );
|
||||
break;
|
||||
|
||||
case WXK_NUMPAD2: /* Deplacement curseur vers le bas */
|
||||
case WXK_NUMPAD2:
|
||||
case WXK_DOWN:
|
||||
MousePositionInPixels.y += wxRound(delta.y);
|
||||
MousePositionInPixels.y += wxRound( delta.y );
|
||||
DrawPanel->MouseTo( MousePositionInPixels );
|
||||
break;
|
||||
|
||||
case WXK_NUMPAD4: /* Deplacement curseur vers la gauche */
|
||||
case WXK_NUMPAD4:
|
||||
case WXK_LEFT:
|
||||
MousePositionInPixels.x -= wxRound(delta.x);
|
||||
MousePositionInPixels.x -= wxRound( delta.x );
|
||||
DrawPanel->MouseTo( MousePositionInPixels );
|
||||
break;
|
||||
|
||||
case WXK_NUMPAD6: /* Deplacement curseur vers la droite */
|
||||
case WXK_NUMPAD6:
|
||||
case WXK_RIGHT:
|
||||
MousePositionInPixels.x += wxRound(delta.x);
|
||||
MousePositionInPixels.x += wxRound( delta.x );
|
||||
DrawPanel->MouseTo( MousePositionInPixels );
|
||||
break;
|
||||
|
||||
@ -270,10 +274,10 @@ void WinEDA_SchematicFrame::GeneralControle( wxDC* DC,
|
||||
break;
|
||||
}
|
||||
|
||||
/* Recalcul de la position du curseur schema */
|
||||
/* Update cursor position. */
|
||||
screen->m_Curseur = curpos;
|
||||
|
||||
/* Placement sur la grille generale */
|
||||
/* Snap cursor to grid. */
|
||||
PutOnGrid( &(screen->m_Curseur) );
|
||||
|
||||
if( screen->IsRefreshReq() )
|
||||
@ -303,12 +307,12 @@ void WinEDA_SchematicFrame::GeneralControle( wxDC* DC,
|
||||
OnHotKey( DC, hotkey, NULL );
|
||||
}
|
||||
|
||||
UpdateStatusBar(); /* Display cursor coordintes info */
|
||||
UpdateStatusBar(); /* Display cursor coordinates info */
|
||||
SetToolbars();
|
||||
}
|
||||
|
||||
|
||||
void WinEDA_LibeditFrame::GeneralControle( wxDC* DC,
|
||||
void WinEDA_LibeditFrame::GeneralControle( wxDC* DC,
|
||||
wxPoint MousePositionInPixels )
|
||||
{
|
||||
wxRealPoint delta;
|
||||
@ -334,27 +338,27 @@ void WinEDA_LibeditFrame::GeneralControle( wxDC* DC,
|
||||
case 0:
|
||||
break;
|
||||
|
||||
case WXK_NUMPAD8: /* Deplacement curseur vers le haut */
|
||||
case WXK_NUMPAD8:
|
||||
case WXK_UP:
|
||||
MousePositionInPixels.y -= wxRound(delta.y);
|
||||
MousePositionInPixels.y -= wxRound( delta.y );
|
||||
DrawPanel->MouseTo( MousePositionInPixels );
|
||||
break;
|
||||
|
||||
case WXK_NUMPAD2: /* Deplacement curseur vers le bas */
|
||||
case WXK_NUMPAD2:
|
||||
case WXK_DOWN:
|
||||
MousePositionInPixels.y += wxRound(delta.y);
|
||||
MousePositionInPixels.y += wxRound( delta.y );
|
||||
DrawPanel->MouseTo( MousePositionInPixels );
|
||||
break;
|
||||
|
||||
case WXK_NUMPAD4: /* Deplacement curseur vers la gauche */
|
||||
case WXK_NUMPAD4:
|
||||
case WXK_LEFT:
|
||||
MousePositionInPixels.x -= wxRound(delta.x);
|
||||
MousePositionInPixels.x -= wxRound( delta.x );
|
||||
DrawPanel->MouseTo( MousePositionInPixels );
|
||||
break;
|
||||
|
||||
case WXK_NUMPAD6: /* Deplacement curseur vers la droite */
|
||||
case WXK_NUMPAD6:
|
||||
case WXK_RIGHT:
|
||||
MousePositionInPixels.x += wxRound(delta.x);
|
||||
MousePositionInPixels.x += wxRound( delta.x );
|
||||
DrawPanel->MouseTo( MousePositionInPixels );
|
||||
break;
|
||||
|
||||
@ -363,10 +367,10 @@ void WinEDA_LibeditFrame::GeneralControle( wxDC* DC,
|
||||
break;
|
||||
}
|
||||
|
||||
/* Recalcul de la position du curseur schema */
|
||||
/* Update the cursor position. */
|
||||
screen->m_Curseur = curpos;
|
||||
|
||||
/* Placement sur la grille generale */
|
||||
/* Snap cursor to grid. */
|
||||
PutOnGrid( &(screen->m_Curseur) );
|
||||
|
||||
if( screen->IsRefreshReq() )
|
||||
@ -396,7 +400,7 @@ void WinEDA_LibeditFrame::GeneralControle( wxDC* DC,
|
||||
OnHotKey( DC, hotkey, NULL );
|
||||
}
|
||||
|
||||
UpdateStatusBar(); /* Affichage des coord curseur */
|
||||
UpdateStatusBar();
|
||||
}
|
||||
|
||||
|
||||
@ -426,27 +430,27 @@ void WinEDA_ViewlibFrame::GeneralControle( wxDC* DC,
|
||||
case 0:
|
||||
break;
|
||||
|
||||
case WXK_NUMPAD8: /* Deplacement curseur vers le haut */
|
||||
case WXK_NUMPAD8:
|
||||
case WXK_UP:
|
||||
MousePositionInPixels.y -= wxRound(delta.y);
|
||||
MousePositionInPixels.y -= wxRound( delta.y );
|
||||
DrawPanel->MouseTo( MousePositionInPixels );
|
||||
break;
|
||||
|
||||
case WXK_NUMPAD2: /* Deplacement curseur vers le bas */
|
||||
case WXK_NUMPAD2:
|
||||
case WXK_DOWN:
|
||||
MousePositionInPixels.y += wxRound(delta.y);
|
||||
MousePositionInPixels.y += wxRound( delta.y );
|
||||
DrawPanel->MouseTo( MousePositionInPixels );
|
||||
break;
|
||||
|
||||
case WXK_NUMPAD4: /* Deplacement curseur vers la gauche */
|
||||
case WXK_NUMPAD4:
|
||||
case WXK_LEFT:
|
||||
MousePositionInPixels.x -= wxRound(delta.x);
|
||||
MousePositionInPixels.x -= wxRound( delta.x );
|
||||
DrawPanel->MouseTo( MousePositionInPixels );
|
||||
break;
|
||||
|
||||
case WXK_NUMPAD6: /* Deplacement curseur vers la droite */
|
||||
case WXK_NUMPAD6:
|
||||
case WXK_RIGHT:
|
||||
MousePositionInPixels.x += wxRound(delta.x);
|
||||
MousePositionInPixels.x += wxRound( delta.x );
|
||||
DrawPanel->MouseTo( MousePositionInPixels );
|
||||
break;
|
||||
|
||||
@ -455,10 +459,10 @@ void WinEDA_ViewlibFrame::GeneralControle( wxDC* DC,
|
||||
break;
|
||||
}
|
||||
|
||||
/* Recalcul de la position du curseur schema */
|
||||
/* Update cursor position. */
|
||||
screen->m_Curseur = curpos;
|
||||
|
||||
/* Placement sur la grille generale */
|
||||
/* Snap cursor to grid. */
|
||||
PutOnGrid( &(screen->m_Curseur) );
|
||||
|
||||
if( screen->IsRefreshReq() )
|
||||
@ -488,6 +492,6 @@ void WinEDA_ViewlibFrame::GeneralControle( wxDC* DC,
|
||||
OnHotKey( DC, hotkey, NULL );
|
||||
}
|
||||
|
||||
UpdateStatusBar(); /* Affichage des coord curseur */
|
||||
UpdateStatusBar();
|
||||
SetToolbars();
|
||||
}
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
#include "program.h"
|
||||
#include "general.h"
|
||||
#include "netlist.h" /* Definitions generales liees au calcul de netliste */
|
||||
#include "netlist.h"
|
||||
#include "protos.h"
|
||||
#include "class_library.h"
|
||||
|
||||
@ -34,7 +34,8 @@ public:
|
||||
int m_Type;
|
||||
DanglingEndHandle* m_Pnext;
|
||||
|
||||
DanglingEndHandle( int type ) {
|
||||
DanglingEndHandle( int type )
|
||||
{
|
||||
m_Item = NULL;
|
||||
m_Type = type;
|
||||
m_Pnext = NULL;
|
||||
@ -43,21 +44,21 @@ public:
|
||||
|
||||
DanglingEndHandle* ItemList;
|
||||
|
||||
static void TestWireForDangling( EDA_DrawLineStruct* DrawRef,
|
||||
WinEDA_SchematicFrame* frame, wxDC* DC );
|
||||
void TestLabelForDangling( SCH_TEXT* label,
|
||||
WinEDA_SchematicFrame* frame, wxDC* DC );
|
||||
DanglingEndHandle* RebuildEndList( EDA_BaseStruct* DrawList );
|
||||
static void TestWireForDangling( EDA_DrawLineStruct* DrawRef,
|
||||
WinEDA_SchematicFrame* frame, wxDC* DC );
|
||||
void TestLabelForDangling( SCH_TEXT* label,
|
||||
WinEDA_SchematicFrame* frame,
|
||||
wxDC* DC );
|
||||
DanglingEndHandle* RebuildEndList( EDA_BaseStruct* DrawList );
|
||||
|
||||
/**********************************************************/
|
||||
bool SegmentIntersect( int Sx1, int Sy1, int Sx2, int Sy2,
|
||||
int Px1, int Py1 )
|
||||
/**********************************************************/
|
||||
|
||||
/* Retourne TRUE si le point P est sur le segment S.
|
||||
* Le segment est suppose horizontal ou vertical.
|
||||
*/
|
||||
{
|
||||
/**********************************************************/
|
||||
/* Returns TRUE if the point P is on the segment S.
|
||||
* The segment is assumed horizontal or vertical.
|
||||
*/
|
||||
int Sxmin, Sxmax, Symin, Symax;
|
||||
|
||||
if( Sx1 == Sx2 ) /* Line S is vertical. */
|
||||
@ -81,29 +82,26 @@ bool SegmentIntersect( int Sx1, int Sy1, int Sx2, int Sy2,
|
||||
if( Py1 != Sy1 )
|
||||
return FALSE;
|
||||
|
||||
if( Px1 >= Sxmin && Px1 <= Sxmax )
|
||||
if( Px1 >= Sxmin && Px1 <= Sxmax )
|
||||
return TRUE;
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
return FALSE; // Segments quelconques
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************/
|
||||
void WinEDA_SchematicFrame::TestDanglingEnds( SCH_ITEM* DrawList, wxDC* DC )
|
||||
/******************************************************************************/
|
||||
|
||||
/* Met a jour les membres m_Dangling des wires, bus, labels
|
||||
*/
|
||||
{
|
||||
if( ItemList )
|
||||
{
|
||||
const DanglingEndHandle* DanglingItem;
|
||||
const DanglingEndHandle* nextitem;
|
||||
|
||||
for( DanglingItem = ItemList; DanglingItem != NULL; DanglingItem = nextitem )
|
||||
for( DanglingItem = ItemList;
|
||||
DanglingItem != NULL;
|
||||
DanglingItem = nextitem )
|
||||
{
|
||||
nextitem = DanglingItem->m_Pnext;
|
||||
SAFE_DELETE( DanglingItem );
|
||||
@ -112,8 +110,7 @@ void WinEDA_SchematicFrame::TestDanglingEnds( SCH_ITEM* DrawList, wxDC* DC )
|
||||
|
||||
ItemList = RebuildEndList( DrawList );
|
||||
|
||||
// Controle des elements
|
||||
for( SCH_ITEM* item = DrawList; item; item = item->Next() )
|
||||
for( SCH_ITEM* item = DrawList; item; item = item->Next() )
|
||||
{
|
||||
switch( item->Type() )
|
||||
{
|
||||
@ -135,8 +132,7 @@ void WinEDA_SchematicFrame::TestDanglingEnds( SCH_ITEM* DrawList, wxDC* DC )
|
||||
break;
|
||||
if( STRUCT->GetLayer() == LAYER_BUS )
|
||||
{
|
||||
STRUCT->m_StartIsDangling =
|
||||
STRUCT->m_EndIsDangling = FALSE;
|
||||
STRUCT->m_StartIsDangling = STRUCT->m_EndIsDangling = FALSE;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
@ -148,7 +144,6 @@ void WinEDA_SchematicFrame::TestDanglingEnds( SCH_ITEM* DrawList, wxDC* DC )
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Test if point pos is on a pin end.
|
||||
*
|
||||
@ -156,8 +151,8 @@ void WinEDA_SchematicFrame::TestDanglingEnds( SCH_ITEM* DrawList, wxDC* DC )
|
||||
*
|
||||
* @return LIB_PIN - Pointer to the located pin or NULL if no pin was found.
|
||||
*/
|
||||
LIB_PIN* WinEDA_SchematicFrame::LocatePinEnd( SCH_ITEM* DrawList,
|
||||
const wxPoint& pos )
|
||||
LIB_PIN* WinEDA_SchematicFrame::LocatePinEnd( SCH_ITEM* DrawList,
|
||||
const wxPoint& pos )
|
||||
{
|
||||
SCH_COMPONENT* DrawLibItem;
|
||||
LIB_PIN* Pin;
|
||||
@ -173,7 +168,7 @@ LIB_PIN* WinEDA_SchematicFrame::LocatePinEnd( SCH_ITEM* DrawList,
|
||||
NEGATE( pinpos.y );
|
||||
|
||||
else
|
||||
pinpos = TransformCoordinate( DrawLibItem->m_Transform, pinpos);
|
||||
pinpos = TransformCoordinate( DrawLibItem->m_Transform, pinpos );
|
||||
|
||||
if( pos == pinpos )
|
||||
return Pin;
|
||||
@ -184,8 +179,8 @@ LIB_PIN* WinEDA_SchematicFrame::LocatePinEnd( SCH_ITEM* DrawList,
|
||||
/****************************************************************************/
|
||||
void TestWireForDangling( EDA_DrawLineStruct* DrawRef,
|
||||
WinEDA_SchematicFrame* frame, wxDC* DC )
|
||||
/****************************************************************************/
|
||||
{
|
||||
/****************************************************************************/
|
||||
DanglingEndHandle* terminal_item;
|
||||
bool Sdangstate = TRUE, Edangstate = TRUE;
|
||||
|
||||
@ -215,16 +210,17 @@ void TestWireForDangling( EDA_DrawLineStruct* DrawRef,
|
||||
DrawRef->m_StartIsDangling = Sdangstate;
|
||||
DrawRef->m_EndIsDangling = Edangstate;
|
||||
if( DC )
|
||||
RedrawOneStruct( frame->DrawPanel, DC, DrawRef, GR_DEFAULT_DRAWMODE );
|
||||
RedrawOneStruct( frame->DrawPanel, DC, DrawRef,
|
||||
GR_DEFAULT_DRAWMODE );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/********************************************************/
|
||||
void TestLabelForDangling( SCH_TEXT* label,
|
||||
WinEDA_SchematicFrame* frame, wxDC* DC )
|
||||
/********************************************************/
|
||||
void TestLabelForDangling( SCH_TEXT* label, WinEDA_SchematicFrame* frame,
|
||||
wxDC* DC )
|
||||
{
|
||||
/********************************************************/
|
||||
DanglingEndHandle* terminal_item;
|
||||
bool dangstate = TRUE;
|
||||
|
||||
@ -239,8 +235,8 @@ void TestLabelForDangling( SCH_TEXT* label,
|
||||
case PIN_END:
|
||||
case LABEL_END:
|
||||
case SHEET_LABEL_END:
|
||||
if( (label->m_Pos.x == terminal_item->m_Pos.x)
|
||||
&& (label->m_Pos.y == terminal_item->m_Pos.y) )
|
||||
if( ( label->m_Pos.x == terminal_item->m_Pos.x )
|
||||
&& ( label->m_Pos.y == terminal_item->m_Pos.y ) )
|
||||
dangstate = FALSE;
|
||||
break;
|
||||
|
||||
@ -277,9 +273,8 @@ void TestLabelForDangling( SCH_TEXT* label,
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Retourne la position physique de la pin, qui d<>pend de l'orientation
|
||||
* du composant */
|
||||
/* Returns the physical position of the pin relative to the component
|
||||
* orientation. */
|
||||
wxPoint ReturnPinPhysicalPosition( LIB_PIN* Pin, SCH_COMPONENT* DrawLibItem )
|
||||
{
|
||||
wxPoint PinPos = Pin->m_Pos;
|
||||
@ -297,8 +292,8 @@ wxPoint ReturnPinPhysicalPosition( LIB_PIN* Pin, SCH_COMPONENT* DrawLibItem )
|
||||
|
||||
/***********************************************************/
|
||||
DanglingEndHandle* RebuildEndList( EDA_BaseStruct* DrawList )
|
||||
/***********************************************************/
|
||||
{
|
||||
/***********************************************************/
|
||||
DanglingEndHandle* StartList = NULL, * item, * lastitem = NULL;
|
||||
EDA_BaseStruct* DrawItem;
|
||||
|
||||
@ -327,10 +322,12 @@ DanglingEndHandle* RebuildEndList( EDA_BaseStruct* DrawList )
|
||||
#define STRUCT ( (EDA_DrawLineStruct*) DrawItem )
|
||||
if( STRUCT->GetLayer() == LAYER_NOTES )
|
||||
break;
|
||||
if( (STRUCT->GetLayer() == LAYER_BUS) || (STRUCT->GetLayer() == LAYER_WIRE) )
|
||||
if( ( STRUCT->GetLayer() == LAYER_BUS )
|
||||
|| (STRUCT->GetLayer() == LAYER_WIRE ) )
|
||||
{
|
||||
item = new DanglingEndHandle( (STRUCT->GetLayer() == LAYER_BUS) ?
|
||||
BUS_START_END : WIRE_START_END );
|
||||
item = new DanglingEndHandle(
|
||||
(STRUCT->GetLayer() == LAYER_BUS) ?
|
||||
BUS_START_END : WIRE_START_END );
|
||||
|
||||
item->m_Item = DrawItem;
|
||||
item->m_Pos = STRUCT->m_Start;
|
||||
@ -339,11 +336,12 @@ DanglingEndHandle* RebuildEndList( EDA_BaseStruct* DrawList )
|
||||
else
|
||||
StartList = item;
|
||||
lastitem = item;
|
||||
item = new DanglingEndHandle( (STRUCT->GetLayer() == LAYER_BUS) ?
|
||||
BUS_END_END : WIRE_END_END );
|
||||
item =
|
||||
new DanglingEndHandle( (STRUCT->GetLayer() == LAYER_BUS) ?
|
||||
BUS_END_END : WIRE_END_END );
|
||||
|
||||
item->m_Item = DrawItem;
|
||||
item->m_Pos = STRUCT->m_End;
|
||||
item->m_Item = DrawItem;
|
||||
item->m_Pos = STRUCT->m_End;
|
||||
lastitem->m_Pnext = item;
|
||||
lastitem = item;
|
||||
}
|
||||
@ -375,10 +373,10 @@ DanglingEndHandle* RebuildEndList( EDA_BaseStruct* DrawList )
|
||||
else
|
||||
StartList = item;
|
||||
lastitem = item;
|
||||
item = new DanglingEndHandle( ENTRY_END );
|
||||
item = new DanglingEndHandle( ENTRY_END );
|
||||
|
||||
item->m_Item = DrawItem;
|
||||
item->m_Pos = STRUCT->m_End();
|
||||
item->m_Item = DrawItem;
|
||||
item->m_Pos = STRUCT->m_End();
|
||||
lastitem->m_Pnext = item;
|
||||
lastitem = item;
|
||||
break;
|
||||
@ -402,7 +400,7 @@ DanglingEndHandle* RebuildEndList( EDA_BaseStruct* DrawList )
|
||||
continue;
|
||||
|
||||
if( Pin->m_Convert && STRUCT->m_Convert
|
||||
&& ( STRUCT->m_Convert != Pin->m_Convert ) )
|
||||
&& ( STRUCT->m_Convert != Pin->m_Convert ) )
|
||||
continue;
|
||||
|
||||
item = new DanglingEndHandle( PIN_END );
|
||||
@ -420,26 +418,29 @@ DanglingEndHandle* RebuildEndList( EDA_BaseStruct* DrawList )
|
||||
}
|
||||
|
||||
case DRAW_SHEET_STRUCT_TYPE:
|
||||
{
|
||||
Hierarchical_PIN_Sheet_Struct* pinsheet;
|
||||
for( pinsheet = ( (DrawSheetStruct*) DrawItem )->m_Label;
|
||||
pinsheet;
|
||||
pinsheet = pinsheet->Next() )
|
||||
{
|
||||
Hierarchical_PIN_Sheet_Struct* pinsheet;
|
||||
for( pinsheet = ((DrawSheetStruct*)DrawItem)->m_Label; pinsheet; pinsheet = pinsheet->Next() )
|
||||
{
|
||||
wxASSERT( pinsheet->Type() == DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE );
|
||||
wxASSERT( pinsheet->Type() ==
|
||||
DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE );
|
||||
|
||||
item = new DanglingEndHandle( SHEET_LABEL_END );
|
||||
item = new DanglingEndHandle( SHEET_LABEL_END );
|
||||
|
||||
item->m_Item = pinsheet;
|
||||
item->m_Pos = pinsheet->m_Pos;
|
||||
item->m_Item = pinsheet;
|
||||
item->m_Pos = pinsheet->m_Pos;
|
||||
|
||||
if( lastitem )
|
||||
lastitem->m_Pnext = item;
|
||||
else
|
||||
StartList = item;
|
||||
if( lastitem )
|
||||
lastitem->m_Pnext = item;
|
||||
else
|
||||
StartList = item;
|
||||
|
||||
lastitem = item;
|
||||
}
|
||||
lastitem = item;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
;
|
||||
|
@ -2,9 +2,6 @@
|
||||
/* EESchema - database.cpp */
|
||||
/****************************/
|
||||
|
||||
/* Routine de selection d'un composant en librairie
|
||||
*/
|
||||
|
||||
#include "fctsys.h"
|
||||
#include "gr_basic.h"
|
||||
#include "common.h"
|
||||
@ -21,16 +18,16 @@
|
||||
|
||||
|
||||
/*
|
||||
* Routine de selection du nom d'un composant en librairie pour chargement,
|
||||
* Keys pointe la liste des mots cles de filtrage
|
||||
* Si Keys = "", recherche des composants qui correspondent
|
||||
* au masque BufName( avec * et ? )
|
||||
* Routine name selection of a component library for loading,
|
||||
* Keys leading the list of the keywords filter
|
||||
* If Keys = "", research components that correspond
|
||||
* BufName mask (with * and?)
|
||||
*
|
||||
* Retourne
|
||||
* TRUE si composant selectionne
|
||||
* FALSE si commande annulee
|
||||
* place le nom du composant a charger, selectionne a partir d'une liste dans
|
||||
* BufName
|
||||
* Returns
|
||||
* TRUE if the selected component
|
||||
* FALSE canceled order
|
||||
* Place the name of the component has loaded, select from a list in
|
||||
* BufName
|
||||
*/
|
||||
wxString DataBaseGetName( WinEDA_DrawFrame* frame, wxString& Keys,
|
||||
wxString& BufName )
|
||||
@ -41,7 +38,7 @@ wxString DataBaseGetName( WinEDA_DrawFrame* frame, wxString& Keys,
|
||||
BufName.MakeUpper();
|
||||
Keys.MakeUpper();
|
||||
|
||||
/* Examen de la liste des librairies pour comptage */
|
||||
/* Review the list of libraries for counting. */
|
||||
BOOST_FOREACH( CMP_LIBRARY& lib, CMP_LIBRARY::GetLibraryList() )
|
||||
{
|
||||
lib.SearchEntryNames( nameList, BufName, Keys );
|
||||
|
@ -1,5 +1,5 @@
|
||||
/************************************/
|
||||
/* Delete.cpp: routines d'effacement */
|
||||
/* delete.cpp */
|
||||
/************************************/
|
||||
|
||||
#include "fctsys.h"
|
||||
@ -41,10 +41,10 @@ static int CountConnectedItems( WinEDA_SchematicFrame* frame,
|
||||
continue;
|
||||
|
||||
|
||||
if( TstJunction && (Struct->Type() == DRAW_JUNCTION_STRUCT_TYPE) )
|
||||
if( TstJunction && ( Struct->Type() == DRAW_JUNCTION_STRUCT_TYPE ) )
|
||||
{
|
||||
#define JUNCTION ( (DrawJunctionStruct*) Struct )
|
||||
if( (JUNCTION->m_Pos.x == pos.x) && (JUNCTION->m_Pos.y == pos.y) )
|
||||
if( JUNCTION->m_Pos == pos )
|
||||
count++;
|
||||
#undef JUNCTION
|
||||
}
|
||||
@ -201,7 +201,7 @@ void WinEDA_SchematicFrame::DeleteConnection( bool DeleteFullConnection )
|
||||
removed_struct != NULL;
|
||||
removed_struct = removed_struct->Next() )
|
||||
{
|
||||
if( (removed_struct->m_Flags & STRUCT_DELETED) == 0 )
|
||||
if( ( removed_struct->m_Flags & STRUCT_DELETED ) == 0 )
|
||||
continue;
|
||||
|
||||
if( removed_struct->Type() != DRAW_SEGMENT_STRUCT_TYPE )
|
||||
@ -223,7 +223,7 @@ void WinEDA_SchematicFrame::DeleteConnection( bool DeleteFullConnection )
|
||||
removed_struct != NULL;
|
||||
removed_struct = removed_struct->Next() )
|
||||
{
|
||||
if( (removed_struct->m_Flags & STRUCT_DELETED) == 0 )
|
||||
if( ( removed_struct->m_Flags & STRUCT_DELETED ) == 0 )
|
||||
continue;
|
||||
if( removed_struct->Type() != DRAW_SEGMENT_STRUCT_TYPE )
|
||||
continue;
|
||||
@ -324,12 +324,12 @@ void WinEDA_SchematicFrame::DeleteConnection( bool DeleteFullConnection )
|
||||
|
||||
|
||||
/*
|
||||
* Locate and delete the item found under the mouse cousor
|
||||
* Locate and delete the item found under the mouse cursor
|
||||
* If more than one item found: the priority order is:
|
||||
* 1 : MARKER
|
||||
* 2 : JUNCTION
|
||||
* 2 : NOCONNECT
|
||||
* 3 : WIRE ou BUS
|
||||
* 3 : WIRE or BUS
|
||||
* 4 : DRAWITEM
|
||||
* 5 : TEXT
|
||||
* 6 : COMPOSANT
|
||||
@ -376,16 +376,15 @@ bool LocateAndDeleteItem( WinEDA_SchematicFrame* frame, wxDC* DC )
|
||||
|
||||
|
||||
/*
|
||||
* Suppression definitive d'une structure dans une liste chainee
|
||||
* d'elements de dessin
|
||||
* DrawStruct = pointeur sur la structure
|
||||
* Screen = pointeur sur l'ecran d'appartenance
|
||||
* Le chainage de la liste est modifie.
|
||||
* Remove definition of a structure in a linked list
|
||||
* Elements of Drawing
|
||||
* DrawStruct * = pointer to the structure
|
||||
* Screen = pointer on the screen of belonging
|
||||
*
|
||||
* Remarque:
|
||||
* pour les structures DRAW_SHEET_STRUCT_TYPE, l'ecran et les structures
|
||||
* correspondantes ne sont pas touches.
|
||||
* Ils doivent etre traites separement
|
||||
* Note:
|
||||
* DRAW_SHEET_STRUCT_TYPE structures for the screen and structures
|
||||
* Corresponding keys are not.
|
||||
* They must be treated separately
|
||||
*/
|
||||
void EraseStruct( SCH_ITEM* DrawStruct, SCH_SCREEN* Screen )
|
||||
{
|
||||
@ -424,7 +423,7 @@ void EraseStruct( SCH_ITEM* DrawStruct, SCH_SCREEN* Screen )
|
||||
}
|
||||
else
|
||||
{
|
||||
while( SheetLabel->Next() ) /* Examen de la liste dependante */
|
||||
while( SheetLabel->Next() )
|
||||
{
|
||||
NextLabel =
|
||||
(Hierarchical_PIN_Sheet_Struct*) SheetLabel->Next();
|
||||
@ -468,9 +467,6 @@ void EraseStruct( SCH_ITEM* DrawStruct, SCH_SCREEN* Screen )
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Effacement des marqueurs du type "type"
|
||||
*/
|
||||
void DeleteAllMarkers( int type )
|
||||
{
|
||||
SCH_SCREEN* screen;
|
||||
@ -489,12 +485,11 @@ void DeleteAllMarkers( int type )
|
||||
if( DrawStruct->Type() != TYPE_MARKER_SCH )
|
||||
continue;
|
||||
|
||||
/* Marqueur trouve */
|
||||
Marker = (MARKER_SCH*) DrawStruct;
|
||||
if( Marker->GetMarkerType() != type )
|
||||
continue;
|
||||
|
||||
/* Suppression du marqueur */
|
||||
/* Remove marker */
|
||||
EraseStruct( DrawStruct, screen );
|
||||
}
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user