Commit 1aaa7a9b authored by stambaughw's avatar stambaughw

Compiler warning, object name, bug, and string fixes.

* Fixed EESchema options dialog focus bug so escape key now works in GTK.
* Rename schematic objects for improved readability.
* Fixed GCC compiler warnings in plot code.
* Added paragraph in UIpolicies.txt about setting dialog box sizes.
* Lots of message box string clean up.
parent 04c7eb29
...@@ -28,7 +28,7 @@ Dialogs: ...@@ -28,7 +28,7 @@ Dialogs:
expands the dialog window, making it easier to read more DRC error messages. expands the dialog window, making it easier to read more DRC error messages.
In other dialogs without one component more important than the others, the In other dialogs without one component more important than the others, the
sizers might be configured to position the controls to sensible positions sizers might be configured to position the controls to sensible positions
near the perimeter of the increasingly larger dialog box, not necesarily near the perimeter of the increasingly larger dialog box, not necessarily
leaving them all bundled tightly together. The dialog box should look leaving them all bundled tightly together. The dialog box should look
nice at any size large enough to show all the components. nice at any size large enough to show all the components.
...@@ -36,3 +36,12 @@ Dialogs: ...@@ -36,3 +36,12 @@ Dialogs:
This is important because the help files and the wiki often lag behind This is important because the help files and the wiki often lag behind
the source code. the source code.
Avoid defining initial dialog sizes if possible. Let the sizers do their
job. After the dialog is fit to the sizers, set the minimum size to the
current size to prevent the dialog controls from being obscured when
resizing the dialog. If the labels or text of the dialog controls are,
set or changed at run time. Rerun wxWindow::Fit() to allow the dialog to
re-size and adjust for the new control widths. This can all be done after
the dialog is created but before it is shown or use class methods to
re-size the dialog as required. Reset the minimum size to the updated
dialog size.
...@@ -193,7 +193,7 @@ void DXF_PLOTTER::arc( wxPoint centre, int StAngle, int EndAngle, int radius, ...@@ -193,7 +193,7 @@ void DXF_PLOTTER::arc( wxPoint centre, int StAngle, int EndAngle, int radius,
return; return;
user_to_device_coordinates( centre ); user_to_device_coordinates( centre );
radius = user_to_device_size( radius ); radius = wxRound( user_to_device_size( radius ) );
/* DXF ARC */ /* DXF ARC */
wxString cname = ColorRefs[current_color].m_Name; wxString cname = ColorRefs[current_color].m_Name;
......
This diff is collapsed.
/**************************************************************** /****************************************************************
* EESchema: backanno.cpp * EESchema: backanno.cpp
* (functions for backannotating Footprint info * (functions for backannotating Footprint info
****************************************************************/ ****************************************************************/
#include "fctsys.h" #include "fctsys.h"
#include "common.h" #include "common.h"
...@@ -14,15 +14,10 @@ ...@@ -14,15 +14,10 @@
#include "general.h" #include "general.h"
bool WinEDA_SchematicFrame::FillFootprintFieldForAllInstancesofComponent(
const wxString& aReference,
const wxString& aFootPrint,
bool aSetVisible )
{
/** function FillFootprintFieldForAllInstancesofComponent /** function FillFootprintFieldForAllInstancesofComponent
* Search for component "aReference", and place a Footprint in Footprint field * Search for component "aReference", and place a Footprint in Footprint field
* @param aReference = reference of the component to initialize * @param aReference = reference of the component to initialize
* @param aFootPrint = new value for the filed Fottprint component * @param aFootPrint = new value for the filed Footprint component
* @param aSetVisible = true to have the field visible, false to set the * @param aSetVisible = true to have the field visible, false to set the
* invisible flag * invisible flag
* @return true if the given component is found * @return true if the given component is found
...@@ -33,9 +28,14 @@ bool WinEDA_SchematicFrame::FillFootprintFieldForAllInstancesofComponent( ...@@ -33,9 +28,14 @@ bool WinEDA_SchematicFrame::FillFootprintFieldForAllInstancesofComponent(
* the search is not stopped when a reference is found (all instances must be * the search is not stopped when a reference is found (all instances must be
* found). * found).
*/ */
DrawSheetPath* sheet; bool WinEDA_SchematicFrame::FillFootprintFieldForAllInstancesofComponent(
const wxString& aReference,
const wxString& aFootPrint,
bool aSetVisible )
{
SCH_SHEET_PATH* sheet;
SCH_ITEM* DrawList = NULL; SCH_ITEM* DrawList = NULL;
EDA_SheetList SheetList; SCH_SHEET_LIST SheetList;
SCH_COMPONENT* Cmp; SCH_COMPONENT* Cmp;
bool found = false; bool found = false;
...@@ -82,9 +82,6 @@ bool WinEDA_SchematicFrame::FillFootprintFieldForAllInstancesofComponent( ...@@ -82,9 +82,6 @@ bool WinEDA_SchematicFrame::FillFootprintFieldForAllInstancesofComponent(
} }
bool WinEDA_SchematicFrame::ProcessStuffFile( FILE* aStuffFile, bool
aSetFielsAttributeToVisible )
{
/** Function ProcessStuffFile /** Function ProcessStuffFile
* Read a "stuff" file created by cvpcb. * Read a "stuff" file created by cvpcb.
* That file has lines like: * That file has lines like:
...@@ -99,6 +96,9 @@ bool WinEDA_SchematicFrame::ProcessStuffFile( FILE* aStuffFile, bool ...@@ -99,6 +96,9 @@ bool WinEDA_SchematicFrame::ProcessStuffFile( FILE* aStuffFile, bool
* visible * visible
* @return true if OK. * @return true if OK.
*/ */
bool WinEDA_SchematicFrame::ProcessStuffFile( FILE* aStuffFile, bool
aSetFielsAttributeToVisible )
{
int LineNum = 0; int LineNum = 0;
char* cp, Ref[256], FootPrint[256], Line[1024]; char* cp, Ref[256], FootPrint[256], Line[1024];
...@@ -127,10 +127,10 @@ bool WinEDA_SchematicFrame::ProcessStuffFile( FILE* aStuffFile, bool ...@@ -127,10 +127,10 @@ bool WinEDA_SchematicFrame::ProcessStuffFile( FILE* aStuffFile, bool
} }
bool WinEDA_SchematicFrame::ReadInputStuffFile()
{
/* Backann footprint info to schematic. /* Backann footprint info to schematic.
*/ */
bool WinEDA_SchematicFrame::ReadInputStuffFile()
{
wxString Line, filename; wxString Line, filename;
FILE* StuffFile; FILE* StuffFile;
wxString msg; wxString msg;
...@@ -157,7 +157,7 @@ bool WinEDA_SchematicFrame::ReadInputStuffFile() ...@@ -157,7 +157,7 @@ bool WinEDA_SchematicFrame::ReadInputStuffFile()
return FALSE; return FALSE;
int diag = wxMessageBox( int diag = wxMessageBox(
_( "Set the Footprint Field to Visible ?" ), _( "Set the foot print field to visible?" ),
_( "Field Display Option" ), _( "Field Display Option" ),
wxYES_NO | wxICON_QUESTION | wxCANCEL, this ); wxYES_NO | wxICON_QUESTION | wxCANCEL, this );
...@@ -171,7 +171,7 @@ bool WinEDA_SchematicFrame::ReadInputStuffFile() ...@@ -171,7 +171,7 @@ bool WinEDA_SchematicFrame::ReadInputStuffFile()
StuffFile = wxFopen( filename, wxT( "rt" ) ); StuffFile = wxFopen( filename, wxT( "rt" ) );
if( StuffFile == NULL ) if( StuffFile == NULL )
{ {
msg.Printf( _( "Failed to open Stuff File <%s>" ), filename.GetData() ); msg.Printf( _( "Failed to open stuff file <%s>" ), filename.GetData() );
DisplayError( this, msg, 20 ); DisplayError( this, msg, 20 );
return FALSE; return FALSE;
} }
......
...@@ -39,13 +39,11 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, ...@@ -39,13 +39,11 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel,
static void SaveStructListForPaste( PICKED_ITEMS_LIST& aItemsList ); static void SaveStructListForPaste( PICKED_ITEMS_LIST& aItemsList );
/*************************************************************************/
int WinEDA_SchematicFrame::ReturnBlockCommand( int key )
{
/*************************************************************************/
/* Return the block command (BLOCK_MOVE, BLOCK_COPY...) corresponding to /* Return the block command (BLOCK_MOVE, BLOCK_COPY...) corresponding to
* the key (ALT, SHIFT ALT ..) * the key (ALT, SHIFT ALT ..)
*/ */
int WinEDA_SchematicFrame::ReturnBlockCommand( int key )
{
int cmd; int cmd;
switch( key ) switch( key )
...@@ -80,12 +78,10 @@ int WinEDA_SchematicFrame::ReturnBlockCommand( int key ) ...@@ -80,12 +78,10 @@ int WinEDA_SchematicFrame::ReturnBlockCommand( int key )
} }
/*************************************************/
void WinEDA_SchematicFrame::InitBlockPasteInfos()
{
/*************************************************/
/* Init the parameters used by the block paste command /* Init the parameters used by the block paste command
*/ */
void WinEDA_SchematicFrame::InitBlockPasteInfos()
{
BLOCK_SELECTOR* block = &GetScreen()->m_BlockLocate; BLOCK_SELECTOR* block = &GetScreen()->m_BlockLocate;
block->m_ItemsSelection.CopyList( g_BlockSaveDataList.m_ItemsSelection ); block->m_ItemsSelection.CopyList( g_BlockSaveDataList.m_ItemsSelection );
...@@ -93,15 +89,13 @@ void WinEDA_SchematicFrame::InitBlockPasteInfos() ...@@ -93,15 +89,13 @@ void WinEDA_SchematicFrame::InitBlockPasteInfos()
} }
/******************************************************/
void WinEDA_SchematicFrame::HandleBlockPlace( wxDC* DC )
{
/******************************************************/
/* Routine to handle the BLOCK PLACE command /* Routine to handle the BLOCK PLACE command
* Last routine for block operation for: * Last routine for block operation for:
* - block move & drag * - block move & drag
* - block copy & paste * - block copy & paste
*/ */
void WinEDA_SchematicFrame::HandleBlockPlace( wxDC* DC )
{
bool err = FALSE; bool err = FALSE;
BLOCK_SELECTOR* block = &GetScreen()->m_BlockLocate; BLOCK_SELECTOR* block = &GetScreen()->m_BlockLocate;
...@@ -208,16 +202,14 @@ void WinEDA_SchematicFrame::HandleBlockPlace( wxDC* DC ) ...@@ -208,16 +202,14 @@ void WinEDA_SchematicFrame::HandleBlockPlace( wxDC* DC )
} }
/****************************************************/
int WinEDA_SchematicFrame::HandleBlockEnd( wxDC* DC )
{
/****************************************************/
/* Manage end block command /* Manage end block command
* Returns: * Returns:
* 0 if no features selected * 0 if no features selected
* 1 otherwise * 1 otherwise
* -1 If control ended and components selection (block delete, block save) * -1 If control ended and components selection (block delete, block save)
*/ */
int WinEDA_SchematicFrame::HandleBlockEnd( wxDC* DC )
{
int ii = 0; int ii = 0;
bool zoom_command = FALSE; bool zoom_command = FALSE;
BLOCK_SELECTOR* block = &GetScreen()->m_BlockLocate; BLOCK_SELECTOR* block = &GetScreen()->m_BlockLocate;
...@@ -349,14 +341,12 @@ int WinEDA_SchematicFrame::HandleBlockEnd( wxDC* DC ) ...@@ -349,14 +341,12 @@ int WinEDA_SchematicFrame::HandleBlockEnd( wxDC* DC )
} }
/***********************************************************************/
void WinEDA_SchematicFrame::HandleBlockEndByPopUp( int Command, wxDC* DC )
{
/***********************************************************************/
/* Manage end block command from context menu. /* Manage end block command from context menu.
* Called after HandleBlockEnd. * Called after HandleBlockEnd.
* From the command block move can execute a command other than block move. * From the command block move can execute a command other than block move.
*/ */
void WinEDA_SchematicFrame::HandleBlockEndByPopUp( int Command, wxDC* DC )
{
int ii = 0; int ii = 0;
BLOCK_SELECTOR* block = &GetScreen()->m_BlockLocate; BLOCK_SELECTOR* block = &GetScreen()->m_BlockLocate;
...@@ -476,14 +466,12 @@ void WinEDA_SchematicFrame::HandleBlockEndByPopUp( int Command, wxDC* DC ) ...@@ -476,14 +466,12 @@ void WinEDA_SchematicFrame::HandleBlockEndByPopUp( int Command, wxDC* DC )
} }
/************************************************************************/
static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC,
bool erase )
{
/************************************************************************/
/* Traces the outline of the search block structures /* Traces the outline of the search block structures
* The entire block follows the cursor * The entire block follows the cursor
*/ */
static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC,
bool erase )
{
BLOCK_SELECTOR* block = &panel->GetScreen()->m_BlockLocate;; BLOCK_SELECTOR* block = &panel->GetScreen()->m_BlockLocate;;
BASE_SCREEN* screen = panel->GetScreen(); BASE_SCREEN* screen = panel->GetScreen();
...@@ -513,15 +501,13 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -513,15 +501,13 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC,
} }
/*****************************************************************/
void SaveStructListForPaste( PICKED_ITEMS_LIST& aItemsList )
{
/*****************************************************************/
/* Routine to Save an object from global drawing object list. /* Routine to Save an object from global drawing object list.
* This routine is the same as delete but: * This routine is the same as delete but:
* - the original list is NOT removed. * - the original list is NOT removed.
* - List is saved in g_BlockSaveDataList * - List is saved in g_BlockSaveDataList
*/ */
void SaveStructListForPaste( PICKED_ITEMS_LIST& aItemsList )
{
g_BlockSaveDataList.ClearListAndDeleteItems(); // delete previous g_BlockSaveDataList.ClearListAndDeleteItems(); // delete previous
// saved list, if // saved list, if
// exists // exists
...@@ -594,16 +580,14 @@ void WinEDA_SchematicFrame::PasteListOfItems( wxDC* DC ) ...@@ -594,16 +580,14 @@ void WinEDA_SchematicFrame::PasteListOfItems( wxDC* DC )
} }
/****************************************************/
static void CollectStructsToDrag( SCH_SCREEN* screen )
{
/****************************************************/
/* creates the list of items found when a drag block is initiated. /* 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 * 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 ) * connected to a selected item (connected wires to a component or an entry )
*/ */
static void CollectStructsToDrag( SCH_SCREEN* screen )
{
SCH_ITEM* Struct; SCH_ITEM* Struct;
EDA_DrawLineStruct* SegmStruct; SCH_LINE* SegmStruct;
PICKED_ITEMS_LIST* pickedlist = &screen->m_BlockLocate.m_ItemsSelection; PICKED_ITEMS_LIST* pickedlist = &screen->m_BlockLocate.m_ItemsSelection;
...@@ -645,7 +629,7 @@ static void CollectStructsToDrag( SCH_SCREEN* screen ) ...@@ -645,7 +629,7 @@ static void CollectStructsToDrag( SCH_SCREEN* screen )
Struct = (SCH_ITEM*) (SCH_ITEM*) pickedlist->GetPickedItem( ii ); Struct = (SCH_ITEM*) (SCH_ITEM*) pickedlist->GetPickedItem( ii );
if( Struct->Type() == DRAW_SEGMENT_STRUCT_TYPE ) if( Struct->Type() == DRAW_SEGMENT_STRUCT_TYPE )
{ {
SegmStruct = (EDA_DrawLineStruct*) Struct; SegmStruct = (SCH_LINE*) Struct;
if( !screen->m_BlockLocate.Inside( SegmStruct->m_Start ) ) if( !screen->m_BlockLocate.Inside( SegmStruct->m_Start ) )
SegmStruct->m_Flags |= STARTPOINT; SegmStruct->m_Flags |= STARTPOINT;
...@@ -698,7 +682,7 @@ static void CollectStructsToDrag( SCH_SCREEN* screen ) ...@@ -698,7 +682,7 @@ static void CollectStructsToDrag( SCH_SCREEN* screen )
if( Struct->Type() == DRAW_BUSENTRY_STRUCT_TYPE ) if( Struct->Type() == DRAW_BUSENTRY_STRUCT_TYPE )
{ {
DrawBusEntryStruct* item = (DrawBusEntryStruct*) Struct; SCH_BUS_ENTRY* item = (SCH_BUS_ENTRY*) Struct;
AddPickedItem( screen, item->m_Pos ); AddPickedItem( screen, item->m_Pos );
AddPickedItem( screen, item->m_End() ); AddPickedItem( screen, item->m_End() );
} }
...@@ -706,16 +690,14 @@ static void CollectStructsToDrag( SCH_SCREEN* screen ) ...@@ -706,16 +690,14 @@ static void CollectStructsToDrag( SCH_SCREEN* screen )
} }
/******************************************************************/
static void AddPickedItem( SCH_SCREEN* screen, wxPoint position )
{
/******************************************************************/
/** AddPickedItem /** AddPickedItem
* add to the picked list in screen->m_BlockLocate items found at location * add to the picked list in screen->m_BlockLocate items found at location
* position * position
* @param screen = the screen to consider * @param screen = the screen to consider
* @param position = the wxPoint where items must be located to be select * @param position = the wxPoint where items must be located to be select
*/ */
static void AddPickedItem( SCH_SCREEN* screen, wxPoint position )
{
SCH_ITEM* Struct; SCH_ITEM* Struct;
/* Review the list of already selected elements. */ /* Review the list of already selected elements. */
...@@ -729,7 +711,7 @@ static void AddPickedItem( SCH_SCREEN* screen, wxPoint position ) ...@@ -729,7 +711,7 @@ static void AddPickedItem( SCH_SCREEN* screen, wxPoint position )
{ {
case DRAW_SEGMENT_STRUCT_TYPE: case DRAW_SEGMENT_STRUCT_TYPE:
#undef STRUCT #undef STRUCT
#define STRUCT ( (EDA_DrawLineStruct*) Struct ) #define STRUCT ( (SCH_LINE*) Struct )
if( STRUCT->m_Start == position ) if( STRUCT->m_Start == position )
STRUCT->m_Flags &= ~STARTPOINT; STRUCT->m_Flags &= ~STARTPOINT;
...@@ -765,7 +747,7 @@ static void AddPickedItem( SCH_SCREEN* screen, wxPoint position ) ...@@ -765,7 +747,7 @@ static void AddPickedItem( SCH_SCREEN* screen, wxPoint position )
case DRAW_JUNCTION_STRUCT_TYPE: case DRAW_JUNCTION_STRUCT_TYPE:
#undef STRUCT #undef STRUCT
#define STRUCT ( (DrawJunctionStruct*) Struct ) #define STRUCT ( (SCH_JUNCTION*) Struct )
if( Struct->m_Flags & SELECTED ) if( Struct->m_Flags & SELECTED )
break; break;
if( STRUCT->m_Pos != position ) if( STRUCT->m_Pos != position )
...@@ -775,7 +757,7 @@ static void AddPickedItem( SCH_SCREEN* screen, wxPoint position ) ...@@ -775,7 +757,7 @@ static void AddPickedItem( SCH_SCREEN* screen, wxPoint position )
case DRAW_SEGMENT_STRUCT_TYPE: case DRAW_SEGMENT_STRUCT_TYPE:
#undef STRUCT #undef STRUCT
#define STRUCT ( (EDA_DrawLineStruct*) Struct ) #define STRUCT ( (SCH_LINE*) Struct )
if( Struct->m_Flags & SELECTED ) if( Struct->m_Flags & SELECTED )
break; break;
if( STRUCT->m_Start == position ) if( STRUCT->m_Start == position )
...@@ -832,9 +814,9 @@ static void AddPickedItem( SCH_SCREEN* screen, wxPoint position ) ...@@ -832,9 +814,9 @@ static void AddPickedItem( SCH_SCREEN* screen, wxPoint position )
case DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE: case DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE:
break; break;
case TYPE_MARKER_SCH: case TYPE_SCH_MARKER:
#undef STRUCT #undef STRUCT
#define STRUCT ( (MARKER_SCH*) Struct ) #define STRUCT ( (SCH_MARKER*) Struct )
if( Struct->m_Flags & SELECTED ) if( Struct->m_Flags & SELECTED )
break; /* Already in list */ break; /* Already in list */
if( STRUCT->m_Pos != position ) if( STRUCT->m_Pos != position )
...@@ -845,7 +827,7 @@ static void AddPickedItem( SCH_SCREEN* screen, wxPoint position ) ...@@ -845,7 +827,7 @@ static void AddPickedItem( SCH_SCREEN* screen, wxPoint position )
case DRAW_NOCONNECT_STRUCT_TYPE: case DRAW_NOCONNECT_STRUCT_TYPE:
#undef STRUCT #undef STRUCT
#define STRUCT ( (DrawNoConnectStruct*) Struct ) #define STRUCT ( (SCH_NO_CONNECT*) Struct )
if( Struct->m_Flags & SELECTED ) if( Struct->m_Flags & SELECTED )
break; /* Already in list */ break; /* Already in list */
if( STRUCT->m_Pos != position ) if( STRUCT->m_Pos != position )
...@@ -862,12 +844,6 @@ static void AddPickedItem( SCH_SCREEN* screen, wxPoint position ) ...@@ -862,12 +844,6 @@ static void AddPickedItem( SCH_SCREEN* screen, wxPoint position )
} }
/****************************************************************************/
static LIB_PIN* GetNextPinPosition( SCH_COMPONENT* aDrawLibItem,
wxPoint& aPosition,
bool aSearchFirst )
{
/****************************************************************************/
/** GetNextPinPosition() /** GetNextPinPosition()
* calculate position of the "next" pin of the aDrawLibItem component * calculate position of the "next" pin of the aDrawLibItem component
* @param aDrawLibItem = component to test. * @param aDrawLibItem = component to test.
...@@ -876,6 +852,10 @@ static LIB_PIN* GetNextPinPosition( SCH_COMPONENT* aDrawLibItem, ...@@ -876,6 +852,10 @@ static LIB_PIN* GetNextPinPosition( SCH_COMPONENT* aDrawLibItem,
* @param aSearchFirst = if true, search for the first pin * @param aSearchFirst = if true, search for the first pin
* @return a pointer to the pin * @return a pointer to the pin
*/ */
static LIB_PIN* GetNextPinPosition( SCH_COMPONENT* aDrawLibItem,
wxPoint& aPosition,
bool aSearchFirst )
{
static LIB_COMPONENT* Entry; static LIB_COMPONENT* Entry;
static int Multi, convert, TransMat[2][2]; static int Multi, convert, TransMat[2][2];
static wxPoint CmpPosition; static wxPoint CmpPosition;
...@@ -908,7 +888,7 @@ static LIB_PIN* GetNextPinPosition( SCH_COMPONENT* aDrawLibItem, ...@@ -908,7 +888,7 @@ static LIB_PIN* GetNextPinPosition( SCH_COMPONENT* aDrawLibItem,
continue; 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; aPosition = TransformCoordinate( TransMat, Pin->m_Pos ) + CmpPosition;
return Pin; return Pin;
} }
......
This diff is collapsed.
This diff is collapsed.
...@@ -16,13 +16,12 @@ ...@@ -16,13 +16,12 @@
static int s_LastShape = '\\'; static int s_LastShape = '\\';
static wxPoint ItemInitialPosition; static wxPoint ItemInitialPosition;
/**************************************************************/
static void ExitBusEntry( WinEDA_DrawPanel* Panel, wxDC* DC ) static void ExitBusEntry( WinEDA_DrawPanel* Panel, wxDC* DC )
{ {
/**************************************************************/ /* Exit bus entry mode. */
/* Exit bus entry mode. */ SCH_BUS_ENTRY* BusEntry =
DrawBusEntryStruct* BusEntry = (SCH_BUS_ENTRY*) Panel->GetScreen()->GetCurItem();
(DrawBusEntryStruct*) Panel->GetScreen()->GetCurItem();
if( BusEntry ) if( BusEntry )
{ {
...@@ -46,13 +45,11 @@ static void ExitBusEntry( WinEDA_DrawPanel* Panel, wxDC* DC ) ...@@ -46,13 +45,11 @@ static void ExitBusEntry( WinEDA_DrawPanel* Panel, wxDC* DC )
} }
/************************************************************************/
static void ShowWhileMoving( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ) static void ShowWhileMoving( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
{ {
/************************************************************************/ /* Drawing of the bus entry segment" while moving the cursor. */
/* Drawing of the bus entry segment" while moving the cursor. */
BASE_SCREEN* screen = panel->GetScreen(); BASE_SCREEN* screen = panel->GetScreen();
DrawBusEntryStruct* BusEntry = (DrawBusEntryStruct*) screen->GetCurItem(); SCH_BUS_ENTRY* BusEntry = (SCH_BUS_ENTRY*) screen->GetCurItem();
if( BusEntry == NULL ) if( BusEntry == NULL )
return; return;
...@@ -67,15 +64,12 @@ static void ShowWhileMoving( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ) ...@@ -67,15 +64,12 @@ static void ShowWhileMoving( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
} }
/**********************************************************************************/ SCH_BUS_ENTRY* WinEDA_SchematicFrame::CreateBusEntry( wxDC* DC,
DrawBusEntryStruct* WinEDA_SchematicFrame::CreateBusEntry( wxDC* DC,
int entry_type ) int entry_type )
{ {
/**********************************************************************************/ /* Create a new bus entry, and prepare moving function (for later place it)
/* Create a new bus entry, and prepare moving function (for later place it)
*/ */
DrawBusEntryStruct* BusEntry = new DrawBusEntryStruct( SCH_BUS_ENTRY* BusEntry = new SCH_BUS_ENTRY( GetScreen()->m_Curseur,
GetScreen()->m_Curseur,
s_LastShape, s_LastShape,
entry_type ); entry_type );
...@@ -92,11 +86,9 @@ DrawBusEntryStruct* WinEDA_SchematicFrame::CreateBusEntry( wxDC* DC, ...@@ -92,11 +86,9 @@ DrawBusEntryStruct* WinEDA_SchematicFrame::CreateBusEntry( wxDC* DC,
} }
/**************************************************************************/ void WinEDA_SchematicFrame::StartMoveBusEntry( SCH_BUS_ENTRY* BusEntry,
void WinEDA_SchematicFrame::StartMoveBusEntry( DrawBusEntryStruct* BusEntry,
wxDC* DC ) wxDC* DC )
{ {
/**************************************************************************/
if( BusEntry == NULL ) if( BusEntry == NULL )
return; return;
...@@ -123,14 +115,12 @@ void WinEDA_SchematicFrame::StartMoveBusEntry( DrawBusEntryStruct* BusEntry, ...@@ -123,14 +115,12 @@ void WinEDA_SchematicFrame::StartMoveBusEntry( DrawBusEntryStruct* BusEntry,
} }
/************************************************************/ /* set the shape of BusEntry (shape = / or \ )
*/
void WinEDA_SchematicFrame::SetBusEntryShape( wxDC* DC, void WinEDA_SchematicFrame::SetBusEntryShape( wxDC* DC,
DrawBusEntryStruct* BusEntry, SCH_BUS_ENTRY* BusEntry,
int entry_shape ) int entry_shape )
{ {
/************************************************************/
/* set the shape of BusEntry (shape = / or \ )
*/
if( BusEntry == NULL ) if( BusEntry == NULL )
return; return;
...@@ -165,10 +155,8 @@ void WinEDA_SchematicFrame::SetBusEntryShape( wxDC* DC, ...@@ -165,10 +155,8 @@ void WinEDA_SchematicFrame::SetBusEntryShape( wxDC* DC,
} }
/************************************************************************/ int WinEDA_SchematicFrame::GetBusEntryShape( SCH_BUS_ENTRY* BusEntry )
int WinEDA_SchematicFrame::GetBusEntryShape( DrawBusEntryStruct* BusEntry )
{ {
/************************************************************************/
int entry_shape = '\\'; int entry_shape = '\\';
if( BusEntry->m_Size.y < 0 ) if( BusEntry->m_Size.y < 0 )
......
This diff is collapsed.
...@@ -13,8 +13,8 @@ extern SCH_SHEET* g_RootSheet; ...@@ -13,8 +13,8 @@ extern SCH_SHEET* g_RootSheet;
* Pin (label) used in sheets to create hierarchical schematics. * Pin (label) used in sheets to create hierarchical schematics.
* *
* A SCH_SHEET_PIN is used to create a hierarchical sheet in the same way a * A SCH_SHEET_PIN is used to create a hierarchical sheet in the same way a
* pin is used in a component. It connects the ojects in the sheet object * pin is used in a component. It connects the objects in the sheet object
* to the objects in the schecmitic page to the objects in the page that is * to the objects in the schematic page to the objects in the page that is
* represented by the sheet. In a sheet object, a SCH_SHEET_PIN must be * represented by the sheet. In a sheet object, a SCH_SHEET_PIN must be
* connected to a wire, bus, or label. In the schematic page represented by * connected to a wire, bus, or label. In the schematic page represented by
* the sheet, it corresponds to a hierarchical label. * the sheet, it corresponds to a hierarchical label.
...@@ -241,11 +241,11 @@ public: ...@@ -241,11 +241,11 @@ public:
* loops * loops
* in the hierarchy. * in the hierarchy.
* @param aScreen = the SCH_SCREEN* screen that we search for * @param aScreen = the SCH_SCREEN* screen that we search for
* @param aList = the DrawSheetPath* that must be used * @param aList = the SCH_SHEET_PATH* that must be used
* @return true if found * @return true if found
*/ */
bool LocatePathOfScreen( SCH_SCREEN* aScreen, bool LocatePathOfScreen( SCH_SCREEN* aScreen,
DrawSheetPath* aList ); SCH_SHEET_PATH* aList );
/** Function CountSheets /** Function CountSheets
* calculates the number of sheets found in "this" * calculates the number of sheets found in "this"
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
/* class to handle a series of sheets *********/ /* class to handle a series of sheets *********/
/* a 'path' so to speak.. *********************/ /* a 'path' so to speak.. *********************/
/**********************************************/ /**********************************************/
DrawSheetPath::DrawSheetPath() SCH_SHEET_PATH::SCH_SHEET_PATH()
{ {
for( int i = 0; i<DSLSZ; i++ ) for( int i = 0; i<DSLSZ; i++ )
m_sheets[i] = NULL; m_sheets[i] = NULL;
...@@ -28,18 +28,16 @@ DrawSheetPath::DrawSheetPath() ...@@ -28,18 +28,16 @@ DrawSheetPath::DrawSheetPath()
} }
/****************************************************************************/
bool DrawSheetPath::BuildSheetPathInfoFromSheetPathValue(
const wxString& aPath,
bool aFound )
{
/****************************************************************************/
/** Function BuildSheetPathInfoFromSheetPathValue /** Function BuildSheetPathInfoFromSheetPathValue
* Fill this with data to access to the hierarchical sheet known by its path * Fill this with data to access to the hierarchical sheet known by its path
* aPath * aPath
* @param aPath = path of the sheet to reach (in non human readable format) * @param aPath = path of the sheet to reach (in non human readable format)
* @return true if success else false * @return true if success else false
*/ */
bool SCH_SHEET_PATH::BuildSheetPathInfoFromSheetPathValue(
const wxString& aPath,
bool aFound )
{
if( aFound ) if( aFound )
return true; return true;
...@@ -69,14 +67,12 @@ bool DrawSheetPath::BuildSheetPathInfoFromSheetPathValue( ...@@ -69,14 +67,12 @@ bool DrawSheetPath::BuildSheetPathInfoFromSheetPathValue(
} }
/*******************************************************************/
int DrawSheetPath::Cmp( const DrawSheetPath& aSheetPathToTest ) const
/********************************************************************/
/** Function Cmp /** Function Cmp
* Compare if this is the same sheet path as aSheetPathToTest * Compare if this is the same sheet path as aSheetPathToTest
* @param aSheetPathToTest = sheet path to compare * @param aSheetPathToTest = sheet path to compare
* @return -1 if different, 0 if same * @return -1 if different, 0 if same
*/ */
int SCH_SHEET_PATH::Cmp( const SCH_SHEET_PATH& aSheetPathToTest ) const
{ {
if( m_numSheets > aSheetPathToTest.m_numSheets ) if( m_numSheets > aSheetPathToTest.m_numSheets )
return 1; return 1;
...@@ -102,7 +98,7 @@ int DrawSheetPath::Cmp( const DrawSheetPath& aSheetPathToTest ) const ...@@ -102,7 +98,7 @@ int DrawSheetPath::Cmp( const DrawSheetPath& aSheetPathToTest ) const
* returns a pointer to the last sheet of the list * returns a pointer to the last sheet of the list
* One can see the others sheet as the "path" to reach this last sheet * One can see the others sheet as the "path" to reach this last sheet
*/ */
SCH_SHEET* DrawSheetPath::Last() SCH_SHEET* SCH_SHEET_PATH::Last()
{ {
if( m_numSheets ) if( m_numSheets )
return m_sheets[m_numSheets - 1]; return m_sheets[m_numSheets - 1];
...@@ -113,7 +109,7 @@ SCH_SHEET* DrawSheetPath::Last() ...@@ -113,7 +109,7 @@ SCH_SHEET* DrawSheetPath::Last()
/** Function LastScreen /** Function LastScreen
* @return the SCH_SCREEN relative to the last sheet in list * @return the SCH_SCREEN relative to the last sheet in list
*/ */
SCH_SCREEN* DrawSheetPath::LastScreen() SCH_SCREEN* SCH_SHEET_PATH::LastScreen()
{ {
if( m_numSheets ) if( m_numSheets )
return m_sheets[m_numSheets - 1]->m_AssociatedScreen; return m_sheets[m_numSheets - 1]->m_AssociatedScreen;
...@@ -125,7 +121,7 @@ SCH_SCREEN* DrawSheetPath::LastScreen() ...@@ -125,7 +121,7 @@ SCH_SCREEN* DrawSheetPath::LastScreen()
* @return a pointer to the first schematic item handled by the * @return a pointer to the first schematic item handled by the
* SCH_SCREEN relative to the last sheet in list * SCH_SCREEN relative to the last sheet in list
*/ */
SCH_ITEM* DrawSheetPath::LastDrawList() SCH_ITEM* SCH_SHEET_PATH::LastDrawList()
{ {
if( m_numSheets && m_sheets[m_numSheets - 1]->m_AssociatedScreen ) if( m_numSheets && m_sheets[m_numSheets - 1]->m_AssociatedScreen )
return m_sheets[m_numSheets - 1]->m_AssociatedScreen->EEDrawList; return m_sheets[m_numSheets - 1]->m_AssociatedScreen->EEDrawList;
...@@ -133,16 +129,14 @@ SCH_ITEM* DrawSheetPath::LastDrawList() ...@@ -133,16 +129,14 @@ SCH_ITEM* DrawSheetPath::LastDrawList()
} }
/**************************************************/
void DrawSheetPath::Push( SCH_SHEET* aSheet )
{
/**************************************************/
/** Function Push /** Function Push
* store (push) aSheet in list * store (push) aSheet in list
* @param aSheet = pointer to the SCH_SHEET to store in list * @param aSheet = pointer to the SCH_SHEET to store in list
*/ */
void SCH_SHEET_PATH::Push( SCH_SHEET* aSheet )
{
if( m_numSheets > DSLSZ ) if( m_numSheets > DSLSZ )
wxMessageBox( wxT( "DrawSheetPath::Push() error: no room in buffer \ wxMessageBox( wxT( "SCH_SHEET_PATH::Push() error: no room in buffer \
to store sheet" ) ); to store sheet" ) );
if( m_numSheets < DSLSZ ) if( m_numSheets < DSLSZ )
...@@ -153,12 +147,12 @@ to store sheet" ) ); ...@@ -153,12 +147,12 @@ to store sheet" ) );
} }
SCH_SHEET* DrawSheetPath::Pop()
{
/** Function Pop /** Function Pop
* retrieves (pop) the last entered sheet and remove it from list * retrieves (pop) the last entered sheet and remove it from list
* @return a SCH_SHEET* pointer to the removed sheet in list * @return a SCH_SHEET* pointer to the removed sheet in list
*/ */
SCH_SHEET* SCH_SHEET_PATH::Pop()
{
if( m_numSheets > 0 ) if( m_numSheets > 0 )
{ {
m_numSheets--; m_numSheets--;
...@@ -168,13 +162,13 @@ SCH_SHEET* DrawSheetPath::Pop() ...@@ -168,13 +162,13 @@ SCH_SHEET* DrawSheetPath::Pop()
} }
wxString DrawSheetPath::Path()
{
/** Function Path /** Function Path
* the path uses the time stamps which do not changes even when editing sheet * the path uses the time stamps which do not changes even when editing sheet
* parameters * parameters
* a path is something like / (root) or /34005677 or /34005677/00AE4523 * a path is something like / (root) or /34005677 or /34005677/00AE4523
*/ */
wxString SCH_SHEET_PATH::Path()
{
wxString s, t; wxString s, t;
s = wxT( "/" ); // This is the root path s = wxT( "/" ); // This is the root path
...@@ -192,16 +186,14 @@ wxString DrawSheetPath::Path() ...@@ -192,16 +186,14 @@ wxString DrawSheetPath::Path()
} }
/******************************************/
wxString DrawSheetPath::PathHumanReadable()
{
/******************************************/
/** Function PathHumanReadable /** Function PathHumanReadable
* Return the sheet path in a readable form, i.e. * Return the sheet path in a readable form, i.e.
* as a path made from sheet names. * as a path made from sheet names.
* (the "normal" path uses the time stamps which do not changes even when * (the "normal" path uses the time stamps which do not changes even when
* editing sheet parameters) * editing sheet parameters)
*/ */
wxString SCH_SHEET_PATH::PathHumanReadable()
{
wxString s, t; wxString s, t;
s = wxT( "/" ); s = wxT( "/" );
...@@ -216,10 +208,8 @@ wxString DrawSheetPath::PathHumanReadable() ...@@ -216,10 +208,8 @@ wxString DrawSheetPath::PathHumanReadable()
} }
/***********************************************/ void SCH_SHEET_PATH::UpdateAllScreenReferences()
void DrawSheetPath::UpdateAllScreenReferences()
{ {
/***********************************************/
EDA_BaseStruct* t = LastDrawList(); EDA_BaseStruct* t = LastDrawList();
while( t ) while( t )
...@@ -235,7 +225,7 @@ void DrawSheetPath::UpdateAllScreenReferences() ...@@ -235,7 +225,7 @@ void DrawSheetPath::UpdateAllScreenReferences()
} }
bool DrawSheetPath::operator=( const DrawSheetPath& d1 ) bool SCH_SHEET_PATH::operator=( const SCH_SHEET_PATH& d1 )
{ {
m_numSheets = d1.m_numSheets; m_numSheets = d1.m_numSheets;
unsigned i; unsigned i;
...@@ -253,7 +243,7 @@ bool DrawSheetPath::operator=( const DrawSheetPath& d1 ) ...@@ -253,7 +243,7 @@ bool DrawSheetPath::operator=( const DrawSheetPath& d1 )
} }
bool DrawSheetPath::operator==( const DrawSheetPath& d1 ) bool SCH_SHEET_PATH::operator==( const SCH_SHEET_PATH& d1 )
{ {
if( m_numSheets != d1.m_numSheets ) if( m_numSheets != d1.m_numSheets )
return false; return false;
...@@ -267,7 +257,7 @@ bool DrawSheetPath::operator==( const DrawSheetPath& d1 ) ...@@ -267,7 +257,7 @@ bool DrawSheetPath::operator==( const DrawSheetPath& d1 )
} }
bool DrawSheetPath::operator!=( const DrawSheetPath& d1 ) bool SCH_SHEET_PATH::operator!=( const SCH_SHEET_PATH& d1 )
{ {
if( m_numSheets != d1.m_numSheets ) if( m_numSheets != d1.m_numSheets )
return true; return true;
...@@ -282,18 +272,16 @@ bool DrawSheetPath::operator!=( const DrawSheetPath& d1 ) ...@@ -282,18 +272,16 @@ bool DrawSheetPath::operator!=( const DrawSheetPath& d1 )
/*********************************************************************/ /*********************************************************************/
/* Class EDA_SheetList to handle the list of Sheets in a hierarchy */ /* Class SCH_SHEET_LIST to handle the list of Sheets in a hierarchy */
/*********************************************************************/ /*********************************************************************/
/*******************************************************/
EDA_SheetList::EDA_SheetList( SCH_SHEET* aSheet )
{
/*******************************************************/
/* The constructor: build the list of sheets from aSheet. /* The constructor: build the list of sheets from aSheet.
* If aSheet == NULL (default) build the whole list of sheets in hierarchy * If aSheet == NULL (default) build the whole list of sheets in hierarchy
* So usually call it with no param. * So usually call it with no param.
*/ */
SCH_SHEET_LIST::SCH_SHEET_LIST( SCH_SHEET* aSheet )
{
m_index = 0; m_index = 0;
m_count = 0; m_count = 0;
m_List = NULL; m_List = NULL;
...@@ -303,13 +291,11 @@ EDA_SheetList::EDA_SheetList( SCH_SHEET* aSheet ) ...@@ -303,13 +291,11 @@ EDA_SheetList::EDA_SheetList( SCH_SHEET* aSheet )
} }
/*****************************************/
DrawSheetPath* EDA_SheetList::GetFirst()
{
/*****************************************/
/** Function GetFirst /** Function GetFirst
* @return the first item (sheet) in m_List and prepare calls to GetNext() * @return the first item (sheet) in m_List and prepare calls to GetNext()
*/ */
SCH_SHEET_PATH* SCH_SHEET_LIST::GetFirst()
{
m_index = 0; m_index = 0;
if( GetCount() > 0 ) if( GetCount() > 0 )
return &( m_List[0] ); return &( m_List[0] );
...@@ -317,57 +303,58 @@ DrawSheetPath* EDA_SheetList::GetFirst() ...@@ -317,57 +303,58 @@ DrawSheetPath* EDA_SheetList::GetFirst()
} }
/*****************************************/
DrawSheetPath* EDA_SheetList::GetNext()
{
/*****************************************/
/** Function GetNext /** Function GetNext
* @return the next item (sheet) in m_List or NULL if no more item in sheet * @return the next item (sheet) in m_List or NULL if no more item in sheet
* list * list
*/ */
SCH_SHEET_PATH* SCH_SHEET_LIST::GetNext()
{
if( m_index < GetCount() ) if( m_index < GetCount() )
m_index++; m_index++;
return GetSheet( m_index ); return GetSheet( m_index );
} }
/************************************************/
DrawSheetPath* EDA_SheetList::GetSheet( int aIndex )
{
/************************************************/
/** Function GetSheet /** Function GetSheet
* @return the item (sheet) in aIndex position in m_List or NULL if less than * @return the item (sheet) in aIndex position in m_List or NULL if less than
* index items * index items
* @param aIndex = index in sheet list to get the sheet * @param aIndex = index in sheet list to get the sheet
*/ */
SCH_SHEET_PATH* SCH_SHEET_LIST::GetSheet( int aIndex )
{
if( aIndex < GetCount() ) if( aIndex < GetCount() )
return &( m_List[aIndex] ); return &( m_List[aIndex] );
return NULL; return NULL;
} }
/************************************************************************/
void EDA_SheetList::BuildSheetList( SCH_SHEET* aSheet )
{
/************************************************************************/
/** Function BuildSheetList /** Function BuildSheetList
* Build the list of sheets and their sheet path from the aSheet sheet * 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 * if aSheet = g_RootSheet, the full sheet path list (and full sheet list) is
* built * built
* @param aSheet = the starting sheet to build list * @param aSheet = the starting sheet to build list
*/ */
void SCH_SHEET_LIST::BuildSheetList( SCH_SHEET* aSheet )
{
if( m_List == NULL ) if( m_List == NULL )
{ {
int count = aSheet->CountSheets(); int count = aSheet->CountSheets();
m_count = count; m_count = count;
m_index = 0; m_index = 0;
count *= sizeof(DrawSheetPath); count *= sizeof(SCH_SHEET_PATH);
m_List = (DrawSheetPath*) MyZMalloc( count );
/* @bug - MyZMalloc() can return a NULL pointer if there is not enough
* memory. This code continues on it's merry way with out
* checking to see if the memory was actually allocated.
*/
m_List = (SCH_SHEET_PATH*) MyZMalloc( count );
m_currList.Clear(); m_currList.Clear();
} }
m_currList.Push( aSheet ); m_currList.Push( aSheet );
m_List[m_index] = m_currList; m_List[m_index] = m_currList;
m_index++; m_index++;
if( aSheet->m_AssociatedScreen != NULL ) if( aSheet->m_AssociatedScreen != NULL )
{ {
EDA_BaseStruct* strct = m_currList.LastDrawList(); EDA_BaseStruct* strct = m_currList.LastDrawList();
...@@ -378,8 +365,10 @@ void EDA_SheetList::BuildSheetList( SCH_SHEET* aSheet ) ...@@ -378,8 +365,10 @@ void EDA_SheetList::BuildSheetList( SCH_SHEET* aSheet )
SCH_SHEET* sheet = (SCH_SHEET*) strct; SCH_SHEET* sheet = (SCH_SHEET*) strct;
BuildSheetList( sheet ); BuildSheetList( sheet );
} }
strct = strct->Next(); strct = strct->Next();
} }
} }
m_currList.Pop(); m_currList.Pop();
} }
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
/** Info about complex hierarchies handling: /** Info about complex hierarchies handling:
* A hierarchical schematic uses sheets (hierarchical sheets) included in a * A hierarchical schematic uses sheets (hierarchical sheets) included in a
* given sheet. Rach sheet corresponds to a schematic drawing handled by a * given sheet. Each sheet corresponds to a schematic drawing handled by a
* SCH_SCREEN structure. A SCH_SCREEN structure contains drawings, and have * 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 * a filename to write it's data. Also a SCH_SCREEN display a sheet number
* and the name of the sheet. * and the name of the sheet.
...@@ -41,8 +41,8 @@ ...@@ -41,8 +41,8 @@
* 2) When acceded by a given selected sheet, display (update) the * 2) When acceded by a given selected sheet, display (update) the
* corresponding references and sheet path * corresponding references and sheet path
* *
* The class DrawSheetPath handles paths used to access a sheet. The class * The class SCH_SHEET_PATH handles paths used to access a sheet. The class
* EDA_SheetList allows to handle the full (or partial) list of sheets and * SCH_SHEET_LIST allows to handle the full (or partial) list of sheets and
* their paths in a complex hierarchy. The class EDA_ScreenList allow to * 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, * 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 * but is not suitable to handle the full complex hierarchy possibilities
...@@ -63,7 +63,7 @@ ...@@ -63,7 +63,7 @@
* return this last sheet * return this last sheet
* Others sheets are the "path" from the first to the last sheet * Others sheets are the "path" from the first to the last sheet
*/ */
class DrawSheetPath class SCH_SHEET_PATH
{ {
private: private:
unsigned m_numSheets; unsigned m_numSheets;
...@@ -72,8 +72,8 @@ public: ...@@ -72,8 +72,8 @@ public:
#define DSLSZ 32 // Max number of levels for a sheet path #define DSLSZ 32 // Max number of levels for a sheet path
SCH_SHEET * m_sheets[DSLSZ]; SCH_SHEET * m_sheets[DSLSZ];
public: DrawSheetPath(); public: SCH_SHEET_PATH();
~DrawSheetPath() { }; ~SCH_SHEET_PATH() { };
void Clear() void Clear()
{ {
m_numSheets = 0; m_numSheets = 0;
...@@ -91,7 +91,7 @@ public: DrawSheetPath(); ...@@ -91,7 +91,7 @@ public: DrawSheetPath();
* @param aSheetPathToTest = sheet path to compare * @param aSheetPathToTest = sheet path to compare
* @return -1 if different, 0 if same * @return -1 if different, 0 if same
*/ */
int Cmp( const DrawSheetPath& aSheetPathToTest ) const; int Cmp( const SCH_SHEET_PATH& aSheetPathToTest ) const;
/** Function Last /** Function Last
* returns a pointer to the last sheet of the list * returns a pointer to the last sheet of the list
...@@ -147,8 +147,7 @@ public: DrawSheetPath(); ...@@ -147,8 +147,7 @@ public: DrawSheetPath();
* @param aPath = path of the sheet to reach (in non human readable format) * @param aPath = path of the sheet to reach (in non human readable format)
* @return true if success else false * @return true if success else false
*/ */
bool BuildSheetPathInfoFromSheetPathValue( bool BuildSheetPathInfoFromSheetPathValue( const wxString& aPath,
const wxString& aPath,
bool aFound = false ); bool aFound = false );
/** /**
...@@ -162,11 +161,11 @@ public: DrawSheetPath(); ...@@ -162,11 +161,11 @@ public: DrawSheetPath();
*/ */
void UpdateAllScreenReferences(); void UpdateAllScreenReferences();
bool operator =( const DrawSheetPath& d1 ); bool operator=( const SCH_SHEET_PATH& d1 );
bool operator ==( const DrawSheetPath& d1 ); bool operator==( const SCH_SHEET_PATH& d1 );
bool operator !=( const DrawSheetPath& d1 ); bool operator!=( const SCH_SHEET_PATH& d1 );
}; };
...@@ -180,10 +179,10 @@ public: DrawSheetPath(); ...@@ -180,10 +179,10 @@ public: DrawSheetPath();
* and component references are specific to a sheet path. * and component references are specific to a sheet path.
* When a sheet is entered, component references and sheet number are updated * When a sheet is entered, component references and sheet number are updated
*/ */
class EDA_SheetList class SCH_SHEET_LIST
{ {
private: private:
DrawSheetPath* m_List; SCH_SHEET_PATH* m_List;
int m_count; /* Number of sheets included in hierarchy, int m_count; /* Number of sheets included in hierarchy,
* starting at the given sheet in constructor . * starting at the given sheet in constructor .
* the given sheet is counted * the given sheet is counted
...@@ -195,16 +194,16 @@ private: ...@@ -195,16 +194,16 @@ private:
* Also used for internal calculations in * Also used for internal calculations in
* BuildSheetList() * BuildSheetList()
*/ */
DrawSheetPath m_currList; SCH_SHEET_PATH m_currList;
public: public:
/* The constructor: build the list of sheets from aSheet. /* The constructor: build the list of sheets from aSheet.
* If aSheet == NULL (default) build the whole list of sheets in hierarchy * If aSheet == NULL (default) build the whole list of sheets in hierarchy
* So usually call it with no param. * So usually call it with no param.
*/ */
EDA_SheetList( SCH_SHEET* aSheet = NULL ); SCH_SHEET_LIST( SCH_SHEET* aSheet = NULL );
~EDA_SheetList() ~SCH_SHEET_LIST()
{ {
if( m_List ) if( m_List )
free( m_List ); free( m_List );
...@@ -221,20 +220,20 @@ public: ...@@ -221,20 +220,20 @@ public:
/** Function GetFirst /** Function GetFirst
* @return the first item (sheet) in m_List and prepare calls to GetNext() * @return the first item (sheet) in m_List and prepare calls to GetNext()
*/ */
DrawSheetPath* GetFirst(); SCH_SHEET_PATH* GetFirst();
/** Function GetNext /** Function GetNext
* @return the next item (sheet) in m_List or NULL if no more item in * @return the next item (sheet) in m_List or NULL if no more item in
* sheet list * sheet list
*/ */
DrawSheetPath* GetNext(); SCH_SHEET_PATH* GetNext();
/** Function GetSheet /** Function GetSheet
* @return the item (sheet) in aIndex position in m_List or NULL if less * @return the item (sheet) in aIndex position in m_List or NULL if less
* than index items * than index items
* @param aIndex = index in sheet list to get the sheet * @param aIndex = index in sheet list to get the sheet
*/ */
DrawSheetPath* GetSheet( int aIndex ); SCH_SHEET_PATH* GetSheet( int aIndex );
private: private:
......
/***********************************************************************/ /*******************************************/
/* Methodes de base de gestion des classes des elements de schematique */ /* Schematic marker object implementation. */
/***********************************************************************/ /*******************************************/
#include "fctsys.h" #include "fctsys.h"
#include "class_drawpanel.h" #include "class_drawpanel.h"
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
#include "erc.h" #include "erc.h"
/* Marker are mainly used to show an ERC error /* Marker are mainly used to show an ERC error
* but they could be used to give a specifi info * but they could be used to give a specific info
*/ */
...@@ -28,31 +28,30 @@ const wxChar* NameMarqueurType[] = ...@@ -28,31 +28,30 @@ const wxChar* NameMarqueurType[] =
/**************************/ /**************************/
/* class MARKER_SCH */ /* class SCH_MARKER */
/**************************/ /**************************/
MARKER_SCH::MARKER_SCH() : SCH_MARKER::SCH_MARKER() : SCH_ITEM( NULL, TYPE_SCH_MARKER ), MARKER_BASE()
SCH_ITEM( NULL, TYPE_MARKER_SCH ),
MARKER_BASE()
{ {
} }
MARKER_SCH::MARKER_SCH( const wxPoint& pos, const wxString& text ) : SCH_MARKER::SCH_MARKER( const wxPoint& pos, const wxString& text ) :
SCH_ITEM( NULL, TYPE_MARKER_SCH ), SCH_ITEM( NULL, TYPE_SCH_MARKER ),
MARKER_BASE( 0, pos, text, pos ) MARKER_BASE( 0, pos, text, pos )
{ {
} }
MARKER_SCH::~MARKER_SCH() SCH_MARKER::~SCH_MARKER()
{ {
} }
MARKER_SCH* MARKER_SCH::GenCopy() SCH_MARKER* SCH_MARKER::GenCopy()
{ {
MARKER_SCH* newitem = new MARKER_SCH( GetPos(), GetReporter().GetMainText() ); SCH_MARKER* newitem = new SCH_MARKER( GetPos(),
GetReporter().GetMainText() );
newitem->SetMarkerType( GetMarkerType() ); newitem->SetMarkerType( GetMarkerType() );
newitem->SetErrorLevel( GetErrorLevel() ); newitem->SetErrorLevel( GetErrorLevel() );
...@@ -70,11 +69,11 @@ MARKER_SCH* MARKER_SCH::GenCopy() ...@@ -70,11 +69,11 @@ MARKER_SCH* MARKER_SCH::GenCopy()
* of nesting of this object within the overall tree. * of nesting of this object within the overall tree.
* @param os The ostream& to output to. * @param os The ostream& to output to.
*/ */
void MARKER_SCH::Show( int nestLevel, std::ostream& os ) void SCH_MARKER::Show( int nestLevel, std::ostream& os )
{ {
// for now, make it look like XML: // for now, make it look like XML:
NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str() << GetPos() NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str()
<< "/>\n"; << GetPos() << "/>\n";
} }
...@@ -86,23 +85,21 @@ void MARKER_SCH::Show( int nestLevel, std::ostream& os ) ...@@ -86,23 +85,21 @@ void MARKER_SCH::Show( int nestLevel, std::ostream& os )
* @param aFile The FILE to write to. * @param aFile The FILE to write to.
* @return bool - true if success writing else false. * @return bool - true if success writing else false.
*/ */
bool MARKER_SCH::Save( FILE* aFile ) const bool SCH_MARKER::Save( FILE* aFile ) const
{ {
return true; return true;
} }
/****************************************************************************/ void SCH_MARKER::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
void MARKER_SCH::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
const wxPoint& aOffset, int aDrawMode, int aColor ) const wxPoint& aOffset, int aDrawMode, int aColor )
/****************************************************************************/
{ {
EDA_Colors color = (EDA_Colors) m_Color; EDA_Colors color = (EDA_Colors) m_Color;
EDA_Colors tmp = color; EDA_Colors tmp = color;
if( GetMarkerType() == MARK_ERC ) if( GetMarkerType() == MARK_ERC )
{ {
color = (GetErrorLevel() == WAR ) ? color = ( GetErrorLevel() == WAR ) ?
(EDA_Colors) g_LayerDescr.LayerColor[LAYER_ERC_WARN] : (EDA_Colors) g_LayerDescr.LayerColor[LAYER_ERC_WARN] :
(EDA_Colors) g_LayerDescr.LayerColor[LAYER_ERC_ERR]; (EDA_Colors) g_LayerDescr.LayerColor[LAYER_ERC_ERR];
} }
...@@ -124,7 +121,7 @@ void MARKER_SCH::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, ...@@ -124,7 +121,7 @@ void MARKER_SCH::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
* object, and the units should be in the pcb or schematic coordinate system. * object, and the units should be in the pcb or schematic coordinate system.
* It is OK to overestimate the size by a few counts. * It is OK to overestimate the size by a few counts.
*/ */
EDA_Rect MARKER_SCH::GetBoundingBox() EDA_Rect SCH_MARKER::GetBoundingBox()
{ {
return GetBoundingBoxMarker(); return GetBoundingBoxMarker();
} }
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
/* classes to handle markers used in schematic ... */ /* classes to handle markers used in schematic ... */
/***************************************************/ /***************************************************/
#ifndef _TYPE_MARKER_SCH_H_ #ifndef _TYPE_SCH_MARKER_H_
#define _TYPE_MARKER_SCH_H_ #define _TYPE_SCH_MARKER_H_
#include "sch_item_struct.h" #include "sch_item_struct.h"
#include "class_marker_base.h" #include "class_marker_base.h"
...@@ -24,19 +24,19 @@ enum TypeMarker { /* Markers type */ ...@@ -24,19 +24,19 @@ enum TypeMarker { /* Markers type */
extern const wxChar* NameMarqueurType[]; extern const wxChar* NameMarqueurType[];
class MARKER_SCH : public SCH_ITEM , public MARKER_BASE class SCH_MARKER : public SCH_ITEM , public MARKER_BASE
{ {
public: public:
MARKER_SCH( ); SCH_MARKER( );
MARKER_SCH( const wxPoint& aPos, const wxString& aText ); SCH_MARKER( const wxPoint& aPos, const wxString& aText );
~MARKER_SCH(); ~SCH_MARKER();
virtual wxString GetClass() const virtual wxString GetClass() const
{ {
return wxT( "MARKER_SCH" ); return wxT( "SCH_MARKER" );
} }
MARKER_SCH* GenCopy(); SCH_MARKER* GenCopy();
virtual void Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, virtual void Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
const wxPoint& aOffset, int aDraw_mode, const wxPoint& aOffset, int aDraw_mode,
...@@ -54,7 +54,8 @@ public: ...@@ -54,7 +54,8 @@ public:
/** Function GetPenSize /** Function GetPenSize
* @return the size of the "pen" that be used to draw or plot this item * @return the size of the "pen" that be used to draw or plot this item
* for a marker, has no meaning, but it is necessary to satisfy the SCH_ITEM class requirements * for a marker, has no meaning, but it is necessary to satisfy the
* SCH_ITEM class requirements
*/ */
virtual int GetPenSize( ) { return 0; }; virtual int GetPenSize( ) { return 0; };
...@@ -80,7 +81,7 @@ public: ...@@ -80,7 +81,7 @@ public:
// Geometric transforms (used in block operations): // Geometric transforms (used in block operations):
/** virtual function Move /** virtual function Move
* move item to a new position. * 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)
{ {
...@@ -103,4 +104,4 @@ public: ...@@ -103,4 +104,4 @@ public:
#endif #endif
}; };
#endif /* _TYPE_MARKER_SCH_H_ */ #endif /* _TYPE_SCH_MARKER_H_ */
/*************************************************************************************/ /***********************************************************************/
/* Class NETLIST_OBJECT to handle 1 item connected (in netlist and erc calculations) */ /* Class NETLIST_OBJECT to handle 1 item connected (in netlist and erc */
/*************************************************************************************/ /* calculations) */
/***********************************************************************/
#ifndef _CLASS_NETLIST_OBJECT_H_ #ifndef _CLASS_NETLIST_OBJECT_H_
#define _CLASS_NETLIST_OBJECT_H_ #define _CLASS_NETLIST_OBJECT_H_
...@@ -10,19 +11,31 @@ enum NetObjetType { ...@@ -10,19 +11,31 @@ enum NetObjetType {
NET_ITEM_UNSPECIFIED, // only for not yet initialized instances NET_ITEM_UNSPECIFIED, // only for not yet initialized instances
NET_SEGMENT, // connection by wire NET_SEGMENT, // connection by wire
NET_BUS, // connection by bus NET_BUS, // connection by bus
NET_JONCTION, // connection by junction: can connect to or more crossing wires NET_JONCTION, // connection by junction: can connect to
// or more crossing wires
NET_LABEL, // this is a local label NET_LABEL, // this is a local label
NET_GLOBLABEL, // this is a global label that connect all others global label in whole hierrachy NET_GLOBLABEL, // this is a global label that connect all
NET_HIERLABEL, // element to indicate connection to a higher-level sheet // others global label in whole hierarchy
NET_SHEETLABEL, // element to indicate connection to a lower-level sheet. NET_HIERLABEL, // element to indicate connection to a
// higher-level sheet
NET_SHEETLABEL, // element to indicate connection to a
// lower-level sheet.
NET_BUSLABELMEMBER, /* created when a bus label is found: NET_BUSLABELMEMBER, /* created when a bus label is found:
* the bus label (like DATA[0..7] is converted to n single labels like DATA0, DATA1 ... * the bus label (like DATA[0..7] is
* converted to n single labels like
* DATA0, DATA1 ...
*/ */
NET_GLOBBUSLABELMEMBER, // see NET_BUSLABELMEMBER, used when a global bus label is found NET_GLOBBUSLABELMEMBER, // see NET_BUSLABELMEMBER, used when a
NET_HIERBUSLABELMEMBER, // see NET_BUSLABELMEMBER, used when a hierarchical bus label is found // global bus label is found
NET_SHEETBUSLABELMEMBER, // see NET_BUSLABELMEMBER, used when a pin sheet label using bus notation is found NET_HIERBUSLABELMEMBER, // see NET_BUSLABELMEMBER, used when a
NET_PINLABEL, /* created when a pin is POWER (IN or OUT) with invisible attribute is found: // hierarchical bus label is found
* these pins are equivalent to a global label and are automatically connected NET_SHEETBUSLABELMEMBER, // see NET_BUSLABELMEMBER, used when a
// pin sheet label using bus notation
// is found
NET_PINLABEL, /* created when a pin is POWER (IN or
* OUT) with invisible attribute is found:
* these pins are equivalent to a global
* label and are automatically connected
*/ */
NET_PIN, // this is an usual pin NET_PIN, // this is an usual pin
NET_NOCONNECT // this is a no connect symbol NET_NOCONNECT // this is a no connect symbol
...@@ -31,7 +44,8 @@ enum NetObjetType { ...@@ -31,7 +44,8 @@ enum NetObjetType {
/* Values for .m_FlagOfConnection member */ /* Values for .m_FlagOfConnection member */
enum ConnectType { enum ConnectType {
UNCONNECTED = 0, /* Pin or Label not connected (error) */ UNCONNECTED = 0, /* Pin or Label not connected (error) */
NOCONNECT_SYMBOL_PRESENT, /* Pin not connected but have a NoConnect symbol on it (no error) */ NOCONNECT_SYMBOL_PRESENT, /* Pin not connected but have a NoConnect
* symbol on it (no error) */
PAD_CONNECT /* Normal connection (no error) */ PAD_CONNECT /* Normal connection (no error) */
}; };
...@@ -39,30 +53,43 @@ enum ConnectType { ...@@ -39,30 +53,43 @@ enum ConnectType {
class NETLIST_OBJECT class NETLIST_OBJECT
{ {
public: public:
NetObjetType m_Type; /* Type of this item (see NetObjetType enum) */ NetObjetType m_Type; /* Type of item (see NetObjetType
EDA_BaseStruct* m_Comp; /* Pointer on the library item that created this net object (the parent)*/ * enum) */
EDA_BaseStruct* m_Comp; /* Pointer on the library item that
* created this net object (the parent)
*/
SCH_ITEM* m_Link; /* For SCH_SHEET_PIN: SCH_ITEM* m_Link; /* For SCH_SHEET_PIN:
* Pointer to the hierarchy sheet that contains this SCH_SHEET_PIN * Pointer to the hierarchy sheet that
* For Pins: pointer to the component that contains this pin * contains this SCH_SHEET_PIN
* For Pins: pointer to the component
* that contains this pin
*/ */
int m_Flag; /* flag used in calculations */ int m_Flag; /* flag used in calculations */
DrawSheetPath m_SheetList; SCH_SHEET_PATH m_SheetList;
int m_ElectricalType; /* Has meaning only for Pins and hierachical pins: electrical type */ int m_ElectricalType; /* Has meaning only for Pins and
* hierarchical pins: electrical type */
private: private:
int m_NetCode; /* net code for all items except BUS labels because a BUS label has int m_NetCode; /* net code for all items except BUS
* labels because a BUS label has
* as many net codes as bus members * as many net codes as bus members
*/ */
public: public:
int m_BusNetCode; /* Used for BUS connections */ int m_BusNetCode; /* Used for BUS connections */
int m_Member; /* for labels type NET_BUSLABELMEMBER ( bus member created from the BUS label ) int m_Member; /* for labels type NET_BUSLABELMEMBER
* member number * ( bus member created from the BUS
* label ) member number
*/ */
ConnectType m_FlagOfConnection; ConnectType m_FlagOfConnection;
DrawSheetPath m_SheetListInclude; /* sheet that the hierarchal label connects to.*/ SCH_SHEET_PATH m_SheetListInclude; /* sheet that the hierarchical label
long m_PinNum; /* pin number ( 1 long = 4 bytes -> 4 ascii codes) */ * connects to.*/
const wxString* m_Label; /* For all labels:pointer on the text label */ long m_PinNum; /* pin number ( 1 long = 4 bytes ->
wxPoint m_Start; // Position of object or for segments: starting point * 4 ascii codes) */
wxPoint m_End; // For segments (wire and busses): ending point const wxString* m_Label; /* For all labels:pointer on the text
* label */
wxPoint m_Start; // Position of object or for segments:
// starting point
wxPoint m_End; // For segments (wire and buses):
// ending point
#if defined(DEBUG) #if defined(DEBUG)
void Show( std::ostream& out, int ndx ); void Show( std::ostream& out, int ndx );
......
/**************************************************************/ /**************************************************************/
/* class_sch_cmp_field.cpp : handle the class SCH_CMP_FIELD */ /* class_sch_cmp_field.cpp : handle the class SCH_FIELD */
/**************************************************************/ /**************************************************************/
/* Fields are texts attached to a component, having a specuial meaning /* Fields are texts attached to a component, having a special meaning
* Fields 0 and 1 are very important: reference and value * Fields 0 and 1 are very important: reference and value
* Field 2 is used as default footprint name. * Field 2 is used as default footprint name.
* Field 3 is reserved (not currently used * Field 3 is reserved (not currently used
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
#include "class_library.h" #include "class_library.h"
SCH_CMP_FIELD::SCH_CMP_FIELD( const wxPoint& aPos, int aFieldId, SCH_FIELD::SCH_FIELD( const wxPoint& aPos, int aFieldId,
SCH_COMPONENT* aParent, wxString aName ) : SCH_COMPONENT* aParent, wxString aName ) :
SCH_ITEM( aParent, DRAW_PART_TEXT_STRUCT_TYPE ), SCH_ITEM( aParent, DRAW_PART_TEXT_STRUCT_TYPE ),
EDA_TextStruct() EDA_TextStruct()
...@@ -39,7 +39,7 @@ SCH_CMP_FIELD::SCH_CMP_FIELD( const wxPoint& aPos, int aFieldId, ...@@ -39,7 +39,7 @@ SCH_CMP_FIELD::SCH_CMP_FIELD( const wxPoint& aPos, int aFieldId,
} }
SCH_CMP_FIELD::~SCH_CMP_FIELD() SCH_FIELD::~SCH_FIELD()
{ {
} }
...@@ -47,7 +47,7 @@ SCH_CMP_FIELD::~SCH_CMP_FIELD() ...@@ -47,7 +47,7 @@ SCH_CMP_FIELD::~SCH_CMP_FIELD()
/** Function GetPenSize /** Function GetPenSize
* @return the size of the "pen" that be used to draw or plot this item * @return the size of the "pen" that be used to draw or plot this item
*/ */
int SCH_CMP_FIELD::GetPenSize() int SCH_FIELD::GetPenSize()
{ {
int pensize = m_Width; int pensize = m_Width;
...@@ -68,7 +68,7 @@ int SCH_CMP_FIELD::GetPenSize() ...@@ -68,7 +68,7 @@ int SCH_CMP_FIELD::GetPenSize()
/** /**
* Draw schematic component fields. * Draw schematic component fields.
*/ */
void SCH_CMP_FIELD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, void SCH_FIELD::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
const wxPoint& offset, int DrawMode, int Color ) const wxPoint& offset, int DrawMode, int Color )
{ {
int orient; int orient;
...@@ -94,7 +94,8 @@ void SCH_CMP_FIELD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -94,7 +94,8 @@ void SCH_CMP_FIELD::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
GRSetDrawMode( DC, DrawMode ); GRSetDrawMode( DC, DrawMode );
/* Calculate the text orientation, according to the component orientation/mirror */ /* Calculate the text orientation, according to the component
* orientation/mirror */
orient = m_Orient; orient = m_Orient;
if( parentComponent->m_Transform[0][1] ) // Rotate component 90 degrees. if( parentComponent->m_Transform[0][1] ) // Rotate component 90 degrees.
{ {
...@@ -104,13 +105,14 @@ void SCH_CMP_FIELD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -104,13 +105,14 @@ void SCH_CMP_FIELD::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
orient = TEXT_ORIENT_HORIZ; orient = TEXT_ORIENT_HORIZ;
} }
/* Calculate the text justification, according to the component orientation/mirror /* Calculate the text justification, according to the component
* this is a bit complicated due to cumulative calculations: * orientation/mirror this is a bit complicated due to cumulative
* calculations:
* - numerous cases (mirrored or not, rotation) * - numerous cases (mirrored or not, rotation)
* - the DrawGraphicText function recalculate also H and H vustifications * - the DrawGraphicText function recalculate also H and H justifications
* according to the text orienation. * according to the text orientation.
* - When a component is mirrored, the text is not mirrored and justifications * - When a component is mirrored, the text is not mirrored and
* are complicated to calculate * justifications are complicated to calculate
* so the more easily way is to use no justifications ( Centered text ) * so the more easily way is to use no justifications ( Centered text )
* and use GetBoundaryBox to know the text coordinate considered as centered * and use GetBoundaryBox to know the text coordinate considered as centered
*/ */
...@@ -126,7 +128,7 @@ void SCH_CMP_FIELD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -126,7 +128,7 @@ void SCH_CMP_FIELD::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
else else
color = ReturnLayerColor( LAYER_FIELDS ); color = ReturnLayerColor( LAYER_FIELDS );
if( !m_AddExtraText || (m_FieldId != REFERENCE) ) if( !m_AddExtraText || ( m_FieldId != REFERENCE ) )
{ {
DrawGraphicText( panel, DC, textpos, color, m_Text, DrawGraphicText( panel, DC, textpos, color, m_Text,
orient, orient,
...@@ -156,6 +158,7 @@ void SCH_CMP_FIELD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -156,6 +158,7 @@ void SCH_CMP_FIELD::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
/* Enable this to draw the bounding box around the text field to validate /* Enable this to draw the bounding box around the text field to validate
* the bounding box calculations. * the bounding box calculations.
*/ */
#if 0 #if 0
// Draw boundary box: // Draw boundary box:
int x1 = BoundaryBox.GetX(); int x1 = BoundaryBox.GetX();
...@@ -164,7 +167,8 @@ void SCH_CMP_FIELD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -164,7 +167,8 @@ void SCH_CMP_FIELD::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
int y2 = BoundaryBox.GetBottom(); int y2 = BoundaryBox.GetBottom();
GRRect( &panel->m_ClipBox, DC, x1, y1, x2, y2, BROWN ); GRRect( &panel->m_ClipBox, DC, x1, y1, x2, y2, BROWN );
// Draw the text anchor point // Draw the text anchor point
/* Calculate the text position, according to the component orientation/mirror */ /* Calculate the text position, according to the component
* orientation/mirror */
textpos = m_Pos - parentComponent->m_Pos; textpos = m_Pos - parentComponent->m_Pos;
textpos = parentComponent->GetScreenCoord( textpos ); textpos = parentComponent->GetScreenCoord( textpos );
textpos += parentComponent->m_Pos; textpos += parentComponent->m_Pos;
...@@ -173,7 +177,6 @@ void SCH_CMP_FIELD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -173,7 +177,6 @@ void SCH_CMP_FIELD::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
int len = 10; int len = 10;
GRLine( &panel->m_ClipBox, DC, x1 - len, y1, x1 + len, y1, 0, BLUE ); GRLine( &panel->m_ClipBox, DC, x1 - len, y1, x1 + len, y1, 0, BLUE );
GRLine( &panel->m_ClipBox, DC, x1, y1 - len, x1, y1 +len, 0, BLUE ); GRLine( &panel->m_ClipBox, DC, x1, y1 - len, x1, y1 +len, 0, BLUE );
#endif #endif
} }
...@@ -185,7 +188,7 @@ void SCH_CMP_FIELD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -185,7 +188,7 @@ void SCH_CMP_FIELD::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
* used to init a field from the model read from a lib entry * used to init a field from the model read from a lib entry
* @param aSource = the LIB_FIELD to read * @param aSource = the LIB_FIELD to read
*/ */
void SCH_CMP_FIELD::ImportValues( const LIB_FIELD& aSource ) void SCH_FIELD::ImportValues( const LIB_FIELD& aSource )
{ {
m_Orient = aSource.m_Orient; m_Orient = aSource.m_Orient;
m_Size = aSource.m_Size; m_Size = aSource.m_Size;
...@@ -203,7 +206,7 @@ void SCH_CMP_FIELD::ImportValues( const LIB_FIELD& aSource ) ...@@ -203,7 +206,7 @@ void SCH_CMP_FIELD::ImportValues( const LIB_FIELD& aSource )
* Used if undo / redo command: * Used if undo / redo command:
* swap data between this and copyitem * swap data between this and copyitem
*/ */
void SCH_CMP_FIELD::SwapData( SCH_CMP_FIELD* copyitem ) void SCH_FIELD::SwapData( SCH_FIELD* copyitem )
{ {
EXCHG( m_Text, copyitem->m_Text ); EXCHG( m_Text, copyitem->m_Text );
EXCHG( m_Layer, copyitem->m_Layer ); EXCHG( m_Layer, copyitem->m_Layer );
...@@ -224,7 +227,7 @@ void SCH_CMP_FIELD::SwapData( SCH_CMP_FIELD* copyitem ) ...@@ -224,7 +227,7 @@ void SCH_CMP_FIELD::SwapData( SCH_CMP_FIELD* copyitem )
* return True if the field is void, i.e.: * return True if the field is void, i.e.:
* contains "~" or "" * contains "~" or ""
*/ */
bool SCH_CMP_FIELD::IsVoid() bool SCH_FIELD::IsVoid()
{ {
if( m_Text.IsEmpty() || m_Text == wxT( "~" ) ) if( m_Text.IsEmpty() || m_Text == wxT( "~" ) )
return true; return true;
...@@ -238,7 +241,7 @@ bool SCH_CMP_FIELD::IsVoid() ...@@ -238,7 +241,7 @@ bool SCH_CMP_FIELD::IsVoid()
* a text field, * a text field,
* according to the component position, rotation, mirror ... * according to the component position, rotation, mirror ...
*/ */
EDA_Rect SCH_CMP_FIELD::GetBoundaryBox() const EDA_Rect SCH_FIELD::GetBoundaryBox() const
{ {
EDA_Rect BoundaryBox; EDA_Rect BoundaryBox;
int hjustify, vjustify; int hjustify, vjustify;
...@@ -257,12 +260,13 @@ EDA_Rect SCH_CMP_FIELD::GetBoundaryBox() const ...@@ -257,12 +260,13 @@ EDA_Rect SCH_CMP_FIELD::GetBoundaryBox() const
hjustify = m_HJustify; hjustify = m_HJustify;
vjustify = m_VJustify; vjustify = m_VJustify;
x2 = pos.x + (parentComponent->m_Transform[0][0] *x1) x2 = pos.x + ( parentComponent->m_Transform[0][0] * x1 )
+ (parentComponent->m_Transform[0][1] *y1); + ( parentComponent->m_Transform[0][1] * y1 );
y2 = pos.y + (parentComponent->m_Transform[1][0] *x1) y2 = pos.y + ( parentComponent->m_Transform[1][0] * x1 )
+ (parentComponent->m_Transform[1][1] *y1); + ( parentComponent->m_Transform[1][1] * y1 );
/* Calculate the text orientation, according to the component orientation/mirror */ /* Calculate the text orientation, according to the component
* orientation/mirror */
if( parentComponent->m_Transform[0][1] ) if( parentComponent->m_Transform[0][1] )
{ {
if( orient == TEXT_ORIENT_HORIZ ) if( orient == TEXT_ORIENT_HORIZ )
...@@ -271,7 +275,8 @@ EDA_Rect SCH_CMP_FIELD::GetBoundaryBox() const ...@@ -271,7 +275,8 @@ EDA_Rect SCH_CMP_FIELD::GetBoundaryBox() const
orient = TEXT_ORIENT_HORIZ; orient = TEXT_ORIENT_HORIZ;
} }
/* Calculate the text justification, according to the component orientation/mirror */ /* Calculate the text justification, according to the component
* orientation/mirror */
if( parentComponent->m_Transform[0][1] ) if( parentComponent->m_Transform[0][1] )
{ {
/* is it mirrored (for text justify)*/ /* is it mirrored (for text justify)*/
...@@ -328,14 +333,14 @@ EDA_Rect SCH_CMP_FIELD::GetBoundaryBox() const ...@@ -328,14 +333,14 @@ EDA_Rect SCH_CMP_FIELD::GetBoundaryBox() const
BoundaryBox.SetHeight( dy ); BoundaryBox.SetHeight( dy );
// Take thickness in account: // Take thickness in account:
int linewidth = (m_Width == 0) ? g_DrawDefaultLineThickness : m_Width; int linewidth = ( m_Width == 0 ) ? g_DrawDefaultLineThickness : m_Width;
BoundaryBox.Inflate( linewidth, linewidth ); BoundaryBox.Inflate( linewidth, linewidth );
return BoundaryBox; return BoundaryBox;
} }
bool SCH_CMP_FIELD::Save( FILE* aFile ) const bool SCH_FIELD::Save( FILE* aFile ) const
{ {
char hjustify = 'C'; char hjustify = 'C';
...@@ -382,7 +387,7 @@ bool SCH_CMP_FIELD::Save( FILE* aFile ) const ...@@ -382,7 +387,7 @@ bool SCH_CMP_FIELD::Save( FILE* aFile ) const
} }
void SCH_CMP_FIELD::Place( WinEDA_SchematicFrame* frame, wxDC* DC ) void SCH_FIELD::Place( WinEDA_SchematicFrame* frame, wxDC* DC )
{ {
int fieldNdx; int fieldNdx;
LIB_COMPONENT* Entry; LIB_COMPONENT* Entry;
......
...@@ -2,10 +2,10 @@ ...@@ -2,10 +2,10 @@
/* Definitions for the component fields classes for EESchema */ /* Definitions for the component fields classes for EESchema */
/*************************************************************/ /*************************************************************/
#ifndef CLASS_SCH_CMP_FIELD_H #ifndef CLASS_SCH_FIELD_H
#define CLASS_SCH_CMP_FIELD_H #define CLASS_SCH_FIELD_H
/* Fields are texts attached to a component, having a specuial meaning /* Fields are texts attached to a component, having a special meaning
* Fields 0 and 1 are very important: reference and value * Fields 0 and 1 are very important: reference and value
* Field 2 is used as default footprint name. * Field 2 is used as default footprint name.
* Field 3 is reserved (not currently used * Field 3 is reserved (not currently used
...@@ -19,29 +19,33 @@ class LIB_FIELD; ...@@ -19,29 +19,33 @@ class LIB_FIELD;
/** /**
* Class SCH_CMP_FIELD * Class SCH_FIELD
* instances are attached to a component and provide a place for the component's value, * instances are attached to a component and provide a place for the
* component's value,
* reference designator, footprint, and user definable name-value pairs of * reference designator, footprint, and user definable name-value pairs of
* arbitrary purpose. * arbitrary purpose.
*/ */
class SCH_CMP_FIELD : public SCH_ITEM, public EDA_TextStruct class SCH_FIELD : public SCH_ITEM, public EDA_TextStruct
{ {
public: public:
int m_FieldId; // Field indicator type (REFERENCE, VALUE or other id) int m_FieldId; /* Field indicator type (REFERENCE, VALUE or
* other id) */
wxString m_Name; /* Field name (ref, value,pcb, sheet, filed 1.. wxString m_Name; /* Field name (ref, value,pcb, sheet, filed 1..
* and for fields 1 to 8 the name is editable * and for fields 1 to 8 the name is editable
*/ */
bool m_AddExtraText; // Mainly for REFERENCE, add extra info (for REFERENCE: add part selection text bool m_AddExtraText; /* Mainly for REFERENCE, add extra info
* (for REFERENCE: add part selection text */
public: public:
SCH_CMP_FIELD( const wxPoint& aPos, int aFieldId, SCH_COMPONENT* aParent, wxString aName = wxEmptyString ); SCH_FIELD( const wxPoint& aPos, int aFieldId, SCH_COMPONENT* aParent,
~SCH_CMP_FIELD(); wxString aName = wxEmptyString );
~SCH_FIELD();
virtual wxString GetClass() const virtual wxString GetClass() const
{ {
return wxT( "SCH_CMP_FIELD" ); return wxT( "SCH_FIELD" );
} }
...@@ -49,7 +53,7 @@ public: ...@@ -49,7 +53,7 @@ public:
EDA_Rect GetBoundaryBox() const; EDA_Rect GetBoundaryBox() const;
bool IsVoid(); bool IsVoid();
void SwapData( SCH_CMP_FIELD* copyitem ); void SwapData( SCH_FIELD* copyitem );
/** Function ImportValues /** Function ImportValues
* copy parameters from a source. * copy parameters from a source.
...@@ -74,7 +78,8 @@ public: ...@@ -74,7 +78,8 @@ public:
/** /**
* Function Save * 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. * @param aFile The FILE to write to.
* @return bool - true if success writing else false. * @return bool - true if success writing else false.
*/ */
...@@ -83,7 +88,7 @@ public: ...@@ -83,7 +88,7 @@ public:
// Geometric transforms (used in block operations): // Geometric transforms (used in block operations):
/** virtual function Move /** virtual function Move
* move item to a new position. * 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)
{ {
...@@ -98,10 +103,10 @@ public: ...@@ -98,10 +103,10 @@ public:
{ {
/* Do Nothing: fields are never mirrored alone. /* Do Nothing: fields are never mirrored alone.
* they are moved when the parent component is mirrored * they are moved when the parent component is mirrored
* this function is only needed by the virtual pure function of the master class * this function is only needed by the virtual pure function of the
*/ * master class */
} }
}; };
#endif /* CLASS_SCH_CMP_FIELD_H */ #endif /* CLASS_SCH_FIELD_H */
This diff is collapsed.
...@@ -7,13 +7,10 @@ ...@@ -7,13 +7,10 @@
#include "class_sch_screen.h" #include "class_sch_screen.h"
#include <wx/arrstr.h>
#include <wx/dynarray.h>
#include "class_sch_cmp_field.h" #include "class_sch_cmp_field.h"
WX_DECLARE_OBJARRAY( DrawSheetPath, ArrayOfSheetLists ); class SCH_SHEET_PATH;
/** /**
...@@ -58,8 +55,8 @@ enum NumFieldType { ...@@ -58,8 +55,8 @@ enum NumFieldType {
}; };
/// A container for several SCH_CMP_FIELD items /// A container for several SCH_FIELD items
typedef std::vector<SCH_CMP_FIELD> SCH_CMP_FIELDS; typedef std::vector<SCH_FIELD> SCH_FIELDS;
/** /**
...@@ -93,7 +90,7 @@ public: ...@@ -93,7 +90,7 @@ public:
private: private:
SCH_CMP_FIELDS m_Fields; ///< variable length list of fields SCH_FIELDS m_Fields; ///< variable length list of fields
/* Hierarchical references. /* Hierarchical references.
...@@ -102,7 +99,8 @@ private: ...@@ -102,7 +99,8 @@ private:
* with: * with:
* path = /<timestamp1>/<timestamp2> (subsheet path, = / for the root sheet) * path = /<timestamp1>/<timestamp2> (subsheet path, = / for the root sheet)
* reference = reference for this path (C23, R5, U78 ... ) * reference = reference for this path (C23, R5, U78 ... )
* multi = part selection in multi parts per package (0 or 1 for one part per package) * multi = part selection in multi parts per package (0 or 1 for one part
* per package)
*/ */
wxArrayString m_PathsAndReferences; wxArrayString m_PathsAndReferences;
...@@ -125,7 +123,7 @@ public: ...@@ -125,7 +123,7 @@ public:
* @param pos - Position to place new component. * @param pos - Position to place new component.
* @param setNewItemFlag - Set the component IS_NEW and IS_MOVED flags. * @param setNewItemFlag - Set the component IS_NEW and IS_MOVED flags.
*/ */
SCH_COMPONENT( LIB_COMPONENT& libComponent, DrawSheetPath* sheet, SCH_COMPONENT( LIB_COMPONENT& libComponent, SCH_SHEET_PATH* sheet,
int unit = 0, int convert = 0, int unit = 0, int convert = 0,
const wxPoint& pos = wxPoint( 0, 0 ), const wxPoint& pos = wxPoint( 0, 0 ),
bool setNewItemFlag = false ); bool setNewItemFlag = false );
...@@ -134,7 +132,7 @@ public: ...@@ -134,7 +132,7 @@ public:
* Copy Constructor * Copy Constructor
* clones \a aTemplate into this object. All fields are copied as is except * clones \a aTemplate into this object. All fields are copied as is except
* for the linked list management pointers which are set to NULL, and the * for the linked list management pointers which are set to NULL, and the
* SCH_CMP_FIELD's m_Parent pointers which are set to the new parent, * SCH_FIELD's m_Parent pointers which are set to the new parent,
* i.e. this new object. * i.e. this new object.
*/ */
SCH_COMPONENT( const SCH_COMPONENT& aTemplate ); SCH_COMPONENT( const SCH_COMPONENT& aTemplate );
...@@ -164,7 +162,7 @@ public: ...@@ -164,7 +162,7 @@ public:
* @param aFile The FILE to read from. * @param aFile The FILE to read from.
* @throw Error containing the error message text if there is a file format * @throw Error containing the error message text if there is a file format
* error or if the disk read has failed. * error or if the disk read has failed.
void Load( FILE* aFile ) throw( Error ); * void Load( FILE* aFile ) throw( Error );
*/ */
/** /**
...@@ -183,12 +181,14 @@ public: ...@@ -183,12 +181,14 @@ public:
* Used to display component orientation (in dialog editor or info) * Used to display component orientation (in dialog editor or info)
* @return the orientation and mirror * @return the orientation and mirror
* Note: Because there are different ways to have a given orientation/mirror, * Note: Because there are different ways to have a given orientation/mirror,
* the orientation/mirror is not necessary wht the used does * the orientation/mirror is not necessary what the used does
* (example : a mirrorX then a mirrorY give no mirror but rotate the component). * (example : a mirrorX then a mirrorY give no mirror but rotate the
* component).
* So this function find a rotation and a mirror value * So this function find a rotation and a mirror value
* ( CMP_MIROIR_X because this is the first mirror option tested) * ( CMP_MIROIR_X because this is the first mirror option tested)
* but can differs from the orientation made by an user * but can differs from the orientation made by an user
* ( a CMP_MIROIR_Y is find as a CMP_MIROIR_X + orientation 180, because they are equivalent) * ( a CMP_MIROIR_Y is find as a CMP_MIROIR_X + orientation 180, because
* they are equivalent)
*/ */
int GetRotationMiroir(); int GetRotationMiroir();
...@@ -197,10 +197,10 @@ public: ...@@ -197,10 +197,10 @@ public:
/** /**
* Suppress annotation ( i.i IC23 changed to IC? and part reset to 1) * Suppress annotation ( i.i IC23 changed to IC? and part reset to 1)
* @param aSheet: DrawSheetPath value: if NULL remove all annotations, * @param aSheet: SCH_SHEET_PATH value: if NULL remove all annotations,
* else remove annotation relative to this sheetpath * else remove annotation relative to this sheetpath
*/ */
void ClearAnnotation( DrawSheetPath* aSheet ); void ClearAnnotation( SCH_SHEET_PATH* aSheet );
/** function SetTimeStamp /** function SetTimeStamp
* Change the old time stamp to the new time stamp. * Change the old time stamp to the new time stamp.
...@@ -232,19 +232,19 @@ public: ...@@ -232,19 +232,19 @@ public:
* Function GetField * Function GetField
* returns a field. * returns a field.
* @param aFieldNdx An index into the array of fields * @param aFieldNdx An index into the array of fields
* @return SCH_CMP_FIELD* - the field value or NULL if does not exist * @return SCH_FIELD* - the field value or NULL if does not exist
*/ */
SCH_CMP_FIELD* GetField( int aFieldNdx ) const; SCH_FIELD* GetField( int aFieldNdx ) const;
/** /**
* Function AddField * Function AddField
* adds a field to the component. The field is copied as it is put into * adds a field to the component. The field is copied as it is put into
* the component. * the component.
* @param aField A const reference to the SCH_CMP_FIELD to add. * @param aField A const reference to the SCH_FIELD to add.
*/ */
void AddField( const SCH_CMP_FIELD& aField ); void AddField( const SCH_FIELD& aField );
void SetFields( const SCH_CMP_FIELDS& aFields ) void SetFields( const SCH_FIELDS& aFields )
{ {
m_Fields = aFields; // vector copying, length is changed possibly m_Fields = aFields; // vector copying, length is changed possibly
} }
...@@ -285,20 +285,20 @@ public: ...@@ -285,20 +285,20 @@ public:
void Place( WinEDA_SchematicFrame* frame, wxDC* DC ); void Place( WinEDA_SchematicFrame* frame, wxDC* DC );
// returns a unique ID, in the form of a path. // returns a unique ID, in the form of a path.
wxString GetPath( DrawSheetPath* sheet ); wxString GetPath( SCH_SHEET_PATH* sheet );
/** /**
* Function GetRef * Function GetRef
* returns the reference, for the given sheet path. * returns the reference, for the given sheet path.
*/ */
const wxString GetRef( DrawSheetPath* sheet ); const wxString GetRef( SCH_SHEET_PATH* sheet );
// Set the reference, for the given sheet path. // Set the reference, for the given sheet path.
void SetRef( DrawSheetPath* sheet, const wxString& ref ); void SetRef( SCH_SHEET_PATH* sheet, const wxString& ref );
/** /**
* Function AddHierarchicalReference * Function AddHierarchicalReference
* adds a full hierachical reference (path + local reference) * adds a full hierarchical reference (path + local reference)
* @param aPath = hierarchical path (/<sheet timestamp>/component * @param aPath = hierarchical path (/<sheet timestamp>/component
* timestamp> like /05678E50/A23EF560) * timestamp> like /05678E50/A23EF560)
* @param aRef = local reference like C45, R56 * @param aRef = local reference like C45, R56
...@@ -309,16 +309,17 @@ public: ...@@ -309,16 +309,17 @@ public:
const wxString& aRef, const wxString& aRef,
int aMulti ); int aMulti );
//returns the unit selection, for the given sheet path. // returns the unit selection, for the given sheet path.
int GetUnitSelection( DrawSheetPath* aSheet ); int GetUnitSelection( SCH_SHEET_PATH* aSheet );
//Set the unit selection, for the given sheet path. // Set the unit selection, for the given sheet path.
void SetUnitSelection( DrawSheetPath* aSheet, void SetUnitSelection( SCH_SHEET_PATH* aSheet,
int aUnitSelection ); int aUnitSelection );
/** Function GetPenSize /** Function GetPenSize
* @return the size of the "pen" that be used to draw or plot this item * @return the size of the "pen" that be used to draw or plot this item
* for a component, has no meaning, but it is necessary to satisfy the SCH_ITEM class requirements * for a component, has no meaning, but it is necessary to satisfy the
* SCH_ITEM class requirements.
*/ */
virtual int GetPenSize( ) { return 0; } virtual int GetPenSize( ) { return 0; }
...@@ -327,11 +328,11 @@ public: ...@@ -327,11 +328,11 @@ public:
* move item to a new position. * move item to a new position.
* @param aMoveVector = the displacement vector * @param aMoveVector = the displacement vector
*/ */
virtual void Move(const wxPoint& aMoveVector) virtual void Move( const wxPoint& aMoveVector )
{ {
m_Pos += aMoveVector; m_Pos += aMoveVector;
for( int ii = 0; ii < GetFieldCount(); ii++ ) for( int ii = 0; ii < GetFieldCount(); ii++ )
GetField( ii )->Move(aMoveVector); GetField( ii )->Move( aMoveVector );
} }
/** virtual function Mirror_Y /** virtual function Mirror_Y
......
...@@ -10,9 +10,7 @@ ...@@ -10,9 +10,7 @@
#include "protos.h" #include "protos.h"
/******************************************************************/
void SetaParent( EDA_BaseStruct* Struct, BASE_SCREEN* Screen ) void SetaParent( EDA_BaseStruct* Struct, BASE_SCREEN* Screen )
/******************************************************************/
{ {
switch( Struct->Type() ) switch( Struct->Type() )
{ {
...@@ -26,7 +24,7 @@ void SetaParent( EDA_BaseStruct* Struct, BASE_SCREEN* Screen ) ...@@ -26,7 +24,7 @@ void SetaParent( EDA_BaseStruct* Struct, BASE_SCREEN* Screen )
case DRAW_SEGMENT_STRUCT_TYPE: case DRAW_SEGMENT_STRUCT_TYPE:
case DRAW_BUSENTRY_STRUCT_TYPE: case DRAW_BUSENTRY_STRUCT_TYPE:
case DRAW_SHEET_STRUCT_TYPE: case DRAW_SHEET_STRUCT_TYPE:
case TYPE_MARKER_SCH: case TYPE_SCH_MARKER:
case DRAW_NOCONNECT_STRUCT_TYPE: case DRAW_NOCONNECT_STRUCT_TYPE:
Struct->SetParent( Screen ); Struct->SetParent( Screen );
break; break;
...@@ -40,12 +38,9 @@ void SetaParent( EDA_BaseStruct* Struct, BASE_SCREEN* Screen ) ...@@ -40,12 +38,9 @@ void SetaParent( EDA_BaseStruct* Struct, BASE_SCREEN* Screen )
} }
/***********************************************************************/ /* Default EESchema zoom values. Limited to 17 values to keep a decent size
/* Class SCH_SCREEN: classe de gestion d'un affichage pour schematique */ * to menus
/***********************************************************************/ */
/* Default EESchema zoom values. Limited to 17 values to keep a decent size to menus
*/
static int SchematicZoomList[] = static int SchematicZoomList[] =
{ {
5, 7, 10, 15, 20, 30, 40, 60, 80, 120, 160, 230, 320, 480, 640, 800, 1280 5, 7, 10, 15, 20, 30, 40, 60, 80, 120, 160, 230, 320, 480, 640, 800, 1280
...@@ -82,7 +77,6 @@ static GRID_TYPE SchematicGridList[] = { ...@@ -82,7 +77,6 @@ static GRID_TYPE SchematicGridList[] = {
sizeof( GRID_TYPE ) ) sizeof( GRID_TYPE ) )
/* Constructeur de SCREEN */
SCH_SCREEN::SCH_SCREEN( KICAD_T type ) : BASE_SCREEN( type ) SCH_SCREEN::SCH_SCREEN( KICAD_T type ) : BASE_SCREEN( type )
{ {
size_t i; size_t i;
...@@ -96,27 +90,25 @@ SCH_SCREEN::SCH_SCREEN( KICAD_T type ) : BASE_SCREEN( type ) ...@@ -96,27 +90,25 @@ SCH_SCREEN::SCH_SCREEN( KICAD_T type ) : BASE_SCREEN( type )
for( i = 0; i < SCHEMATIC_GRID_LIST_CNT; i++ ) for( i = 0; i < SCHEMATIC_GRID_LIST_CNT; i++ )
AddGrid( SchematicGridList[i] ); AddGrid( SchematicGridList[i] );
SetGrid( wxRealPoint( 50, 50 ) ); /* usual grid size */ SetGrid( wxRealPoint( 50, 50 ) ); /* Default grid size. */
m_RefCount = 0; m_RefCount = 0;
m_Center = false; // Suitable for schematic only. for libedit and viewlib, must be set to true m_Center = false; /* Suitable for schematic only. For
* libedit and viewlib, must be set
* to true */
InitDatas(); InitDatas();
} }
/****************************/
SCH_SCREEN::~SCH_SCREEN() SCH_SCREEN::~SCH_SCREEN()
/****************************/
{ {
ClearUndoRedoList(); ClearUndoRedoList();
FreeDrawList(); FreeDrawList();
} }
/***********************************/
void SCH_SCREEN::FreeDrawList()
/***********************************/
/* Routine to clear (free) EESchema drawing list of a screen. /* Routine to clear (free) EESchema drawing list of a screen.
*/ */
void SCH_SCREEN::FreeDrawList()
{ {
SCH_ITEM* DrawStruct; SCH_ITEM* DrawStruct;
...@@ -131,13 +123,10 @@ void SCH_SCREEN::FreeDrawList() ...@@ -131,13 +123,10 @@ void SCH_SCREEN::FreeDrawList()
} }
/**************************************************************/
void SCH_SCREEN::RemoveFromDrawList( SCH_ITEM * DrawStruct )
/**************************************************************/
/* If found in EEDrawList, remove DrawStruct from EEDrawList. /* If found in EEDrawList, remove DrawStruct from EEDrawList.
* DrawStruct is not deleted or modified * DrawStruct is not deleted or modified
*/ */
void SCH_SCREEN::RemoveFromDrawList( SCH_ITEM * DrawStruct )
{ {
if( DrawStruct == EEDrawList ) if( DrawStruct == EEDrawList )
EEDrawList = EEDrawList->Next(); EEDrawList = EEDrawList->Next();
...@@ -157,9 +146,7 @@ void SCH_SCREEN::RemoveFromDrawList( SCH_ITEM * DrawStruct ) ...@@ -157,9 +146,7 @@ void SCH_SCREEN::RemoveFromDrawList( SCH_ITEM * DrawStruct )
} }
/**************************************************************/
bool SCH_SCREEN::CheckIfOnDrawList( SCH_ITEM* st ) bool SCH_SCREEN::CheckIfOnDrawList( SCH_ITEM* st )
/**************************************************************/
{ {
SCH_ITEM * DrawList = EEDrawList; SCH_ITEM * DrawList = EEDrawList;
...@@ -174,10 +161,8 @@ bool SCH_SCREEN::CheckIfOnDrawList( SCH_ITEM* st ) ...@@ -174,10 +161,8 @@ bool SCH_SCREEN::CheckIfOnDrawList( SCH_ITEM* st )
} }
/**************************************************************/
void SCH_SCREEN::AddToDrawList( SCH_ITEM* st ) void SCH_SCREEN::AddToDrawList( SCH_ITEM* st )
/**************************************************************/ {
{ //simple function to add to the head of the drawlist.
st->SetNext( EEDrawList ); st->SetNext( EEDrawList );
EEDrawList = st; EEDrawList = st;
} }
...@@ -187,17 +172,14 @@ void SCH_SCREEN::AddToDrawList( SCH_ITEM* st ) ...@@ -187,17 +172,14 @@ void SCH_SCREEN::AddToDrawList( SCH_ITEM* st )
/* Class EDA_ScreenList to handle the list of screens in a hierarchy */ /* Class EDA_ScreenList to handle the list of screens in a hierarchy */
/*********************************************************************/ /*********************************************************************/
/********************************/
EDA_ScreenList::EDA_ScreenList() EDA_ScreenList::EDA_ScreenList()
/********************************/
{ {
m_Index = 0; m_Index = 0;
BuildScreenList( g_RootSheet ); BuildScreenList( g_RootSheet );
} }
/*****************************************/
SCH_SCREEN* EDA_ScreenList::GetFirst() SCH_SCREEN* EDA_ScreenList::GetFirst()
/*****************************************/
{ {
m_Index = 0; m_Index = 0;
if( m_List.GetCount() > 0 ) if( m_List.GetCount() > 0 )
...@@ -206,9 +188,7 @@ SCH_SCREEN* EDA_ScreenList::GetFirst() ...@@ -206,9 +188,7 @@ SCH_SCREEN* EDA_ScreenList::GetFirst()
} }
/*****************************************/
SCH_SCREEN* EDA_ScreenList::GetNext() SCH_SCREEN* EDA_ScreenList::GetNext()
/*****************************************/
{ {
if( m_Index < m_List.GetCount() ) if( m_Index < m_List.GetCount() )
m_Index++; m_Index++;
...@@ -216,12 +196,9 @@ SCH_SCREEN* EDA_ScreenList::GetNext() ...@@ -216,12 +196,9 @@ SCH_SCREEN* EDA_ScreenList::GetNext()
} }
/************************************************/
SCH_SCREEN* EDA_ScreenList::GetScreen( unsigned int index )
/************************************************/
/* return the m_List[index] item /* return the m_List[index] item
*/ */
SCH_SCREEN* EDA_ScreenList::GetScreen( unsigned int index )
{ {
if( index < m_List.GetCount() ) if( index < m_List.GetCount() )
return m_List[index]; return m_List[index];
...@@ -229,9 +206,7 @@ SCH_SCREEN* EDA_ScreenList::GetScreen( unsigned int index ) ...@@ -229,9 +206,7 @@ SCH_SCREEN* EDA_ScreenList::GetScreen( unsigned int index )
} }
/************************************************/
void EDA_ScreenList::AddScreenToList( SCH_SCREEN* testscreen ) void EDA_ScreenList::AddScreenToList( SCH_SCREEN* testscreen )
/************************************************/
{ {
if( testscreen == NULL ) if( testscreen == NULL )
return; return;
...@@ -245,9 +220,7 @@ void EDA_ScreenList::AddScreenToList( SCH_SCREEN* testscreen ) ...@@ -245,9 +220,7 @@ void EDA_ScreenList::AddScreenToList( SCH_SCREEN* testscreen )
} }
/************************************************************************/
void EDA_ScreenList::BuildScreenList( EDA_BaseStruct* s ) void EDA_ScreenList::BuildScreenList( EDA_BaseStruct* s )
/************************************************************************/
{ {
if( s && s->Type() == DRAW_SHEET_STRUCT_TYPE ) if( s && s->Type() == DRAW_SHEET_STRUCT_TYPE )
{ {
...@@ -269,4 +242,3 @@ void EDA_ScreenList::BuildScreenList( EDA_BaseStruct* s ) ...@@ -269,4 +242,3 @@ void EDA_ScreenList::BuildScreenList( EDA_BaseStruct* s )
} }
} }
} }
This diff is collapsed.
...@@ -11,11 +11,11 @@ ...@@ -11,11 +11,11 @@
/** /**
* Class EDA_DrawLineStruct * Class SCH_LINE
* is a segment description 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 ...) * points (track, wire, draw line ...)
*/ */
class EDA_DrawLineStruct : public SCH_ITEM class SCH_LINE : public SCH_ITEM
{ {
public: public:
int m_Width; // 0 = line, > 0 = tracks, bus ... int m_Width; // 0 = line, > 0 = tracks, bus ...
...@@ -26,20 +26,20 @@ public: ...@@ -26,20 +26,20 @@ public:
bool m_EndIsDangling; // TRUE if not connected (wires, tracks...) bool m_EndIsDangling; // TRUE if not connected (wires, tracks...)
public: public:
EDA_DrawLineStruct( const wxPoint& pos, int layer ); SCH_LINE( const wxPoint& pos, int layer );
~EDA_DrawLineStruct() { } ~SCH_LINE() { }
EDA_DrawLineStruct* Next() const { return (EDA_DrawLineStruct*) Pnext; } SCH_LINE* Next() const { return (SCH_LINE*) Pnext; }
EDA_DrawLineStruct* Back() const { return (EDA_DrawLineStruct*) Pback; } SCH_LINE* Back() const { return (SCH_LINE*) Pback; }
virtual wxString GetClass() const virtual wxString GetClass() const
{ {
return wxT( "EDA_DrawLine" ); return wxT( "SCH_LINE" );
} }
bool IsOneEndPointAt( const wxPoint& pos ); bool IsOneEndPointAt( const wxPoint& pos );
EDA_DrawLineStruct* GenCopy(); SCH_LINE* GenCopy();
bool IsNull() bool IsNull()
{ {
...@@ -106,22 +106,22 @@ public: ...@@ -106,22 +106,22 @@ public:
}; };
class DrawNoConnectStruct : public SCH_ITEM class SCH_NO_CONNECT : public SCH_ITEM
{ {
public: public:
wxPoint m_Pos; /* XY coordinates of NoConnect. */ wxPoint m_Pos; /* XY coordinates of NoConnect. */
wxSize m_Size; // size of this symbol wxSize m_Size; // size of this symbol
public: public:
DrawNoConnectStruct( const wxPoint& pos ); SCH_NO_CONNECT( const wxPoint& pos );
~DrawNoConnectStruct() { } ~SCH_NO_CONNECT() { }
virtual wxString GetClass() const virtual wxString GetClass() const
{ {
return wxT( "DrawNoConnect" ); return wxT( "SCH_NO_CONNECT" );
} }
DrawNoConnectStruct* GenCopy(); SCH_NO_CONNECT* GenCopy();
/** Function GetPenSize /** Function GetPenSize
* @return the size of the "pen" that be used to draw or plot this item * @return the size of the "pen" that be used to draw or plot this item
...@@ -149,10 +149,11 @@ public: ...@@ -149,10 +149,11 @@ public:
/** /**
* Function GetBoundingBox * Function GetBoundingBox
* returns the orthogonal, bounding box of this object for display purposes. * returns the orthogonal, bounding box of this object for display
* This box should be an enclosing perimeter for visible components of this * purposes. This box should be an enclosing perimeter for visible
* object, and the units should be in the pcb or schematic coordinate system. * components of this object, and the units should be in the pcb or
* It is OK to overestimate the size by a few counts. * schematic coordinate system. It is OK to overestimate the size
* by a few counts.
*/ */
EDA_Rect GetBoundingBox(); EDA_Rect GetBoundingBox();
...@@ -180,11 +181,11 @@ public: ...@@ -180,11 +181,11 @@ public:
/** /**
* Class DrawBusEntryStruct * Class SCH_BUS_ENTRY
* *
* Defines a bus or wire entry. * Defines a bus or wire entry.
*/ */
class DrawBusEntryStruct : public SCH_ITEM class SCH_BUS_ENTRY : public SCH_ITEM
{ {
public: public:
int m_Width; int m_Width;
...@@ -192,16 +193,16 @@ public: ...@@ -192,16 +193,16 @@ public:
wxSize m_Size; wxSize m_Size;
public: public:
DrawBusEntryStruct( const wxPoint& pos, int shape, int id ); SCH_BUS_ENTRY( const wxPoint& pos, int shape, int id );
~DrawBusEntryStruct() { } ~SCH_BUS_ENTRY() { }
virtual wxString GetClass() const virtual wxString GetClass() const
{ {
return wxT( "DrawBusEntry" ); return wxT( "SCH_BUS_ENTRY" );
} }
DrawBusEntryStruct* GenCopy(); SCH_BUS_ENTRY* GenCopy();
wxPoint m_End() const; wxPoint m_End() const;
virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC,
const wxPoint& offset, int draw_mode, const wxPoint& offset, int draw_mode,
...@@ -218,10 +219,11 @@ public: ...@@ -218,10 +219,11 @@ public:
/** /**
* Function GetBoundingBox * Function GetBoundingBox
* returns the orthogonal, bounding box of this object for display purposes. * returns the orthogonal, bounding box of this object for display
* This box should be an enclosing perimeter for visible components of this * purposes. This box should be an enclosing perimeter for visible
* object, and the units should be in the pcb or schematic coordinate system. * components of this object, and the units should be in the pcb or
* It is OK to overestimate the size by a few counts. * schematic coordinate system. It is OK to overestimate the size
* by a few counts.
*/ */
EDA_Rect GetBoundingBox(); EDA_Rect GetBoundingBox();
...@@ -253,23 +255,23 @@ public: ...@@ -253,23 +255,23 @@ public:
} }
}; };
class DrawPolylineStruct : public SCH_ITEM class SCH_POLYLINE : public SCH_ITEM
{ {
public: public:
int m_Width; /* Thickness */ int m_Width; /* Thickness */
std::vector<wxPoint> m_PolyPoints; // list of points (>= 2) std::vector<wxPoint> m_PolyPoints; // list of points (>= 2)
public: public:
DrawPolylineStruct( int layer ); SCH_POLYLINE( int layer );
~DrawPolylineStruct(); ~SCH_POLYLINE();
virtual wxString GetClass() const virtual wxString GetClass() const
{ {
return wxT( "DrawPolyline" ); return wxT( "SCH_POLYLINE" );
} }
DrawPolylineStruct* GenCopy(); SCH_POLYLINE* GenCopy();
virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC,
const wxPoint& offset, int draw_mode, const wxPoint& offset, int draw_mode,
int Color = -1 ); int Color = -1 );
...@@ -328,19 +330,19 @@ public: ...@@ -328,19 +330,19 @@ public:
}; };
class DrawJunctionStruct : public SCH_ITEM class SCH_JUNCTION : public SCH_ITEM
{ {
public: public:
wxPoint m_Pos; /* XY coordinates of connection. */ wxPoint m_Pos; /* XY coordinates of connection. */
wxSize m_Size; wxSize m_Size;
public: public:
DrawJunctionStruct( const wxPoint& pos ); SCH_JUNCTION( const wxPoint& pos );
~DrawJunctionStruct() { } ~SCH_JUNCTION() { }
virtual wxString GetClass() const virtual wxString GetClass() const
{ {
return wxT( "DrawJunction" ); return wxT( "SCH_JUNCTION" );
} }
...@@ -352,14 +354,15 @@ public: ...@@ -352,14 +354,15 @@ public:
/** /**
* Function GetBoundingBox * Function GetBoundingBox
* returns the orthogonal, bounding box of this object for display purposes. * returns the orthogonal, bounding box of this object for display
* This box should be an enclosing perimeter for visible components of this * purposes. This box should be an enclosing perimeter for visible
* object, and the units should be in the pcb or schematic coordinate system. * components of this object, and the units should be in the pcb or
* It is OK to overestimate the size by a few counts. * schematic coordinate system. It is OK to overestimate the size
* by a few counts.
*/ */
EDA_Rect GetBoundingBox(); EDA_Rect GetBoundingBox();
DrawJunctionStruct* GenCopy(); SCH_JUNCTION* GenCopy();
/** Function GetPenSize /** Function GetPenSize
* @return the size of the "pen" that be used to draw or plot this item * @return the size of the "pen" that be used to draw or plot this item
...@@ -367,8 +370,7 @@ public: ...@@ -367,8 +370,7 @@ public:
virtual int GetPenSize( ); virtual int GetPenSize( );
virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC,
const wxPoint& offset, int draw_mode, const wxPoint& offset, int draw_mode, int Color = -1 );
int Color = -1 );
/** /**
* Function Save * Function Save
* writes the data structures for this object out to a FILE in "*.sch" * writes the data structures for this object out to a FILE in "*.sch"
......
...@@ -15,18 +15,15 @@ ...@@ -15,18 +15,15 @@
#include "netlist.h" #include "netlist.h"
static int TstAlignSegment( EDA_DrawLineStruct* RefSegm, static int TstAlignSegment( SCH_LINE* RefSegm, SCH_LINE* TstSegm );
EDA_DrawLineStruct* TstSegm );
/*******************************************/
bool SCH_SCREEN::SchematicCleanUp( wxDC* DC )
{
/*******************************************/
/* Routine cleaning: /* Routine cleaning:
* - Includes segments or buses aligned in only 1 segment * - Includes segments or buses aligned in only 1 segment
* - Detects identical objects superimposed * - Detects identical objects superimposed
*/ */
bool SCH_SCREEN::SchematicCleanUp( wxDC* DC )
{
SCH_ITEM* DrawList, * TstDrawList; SCH_ITEM* DrawList, * TstDrawList;
int flag; int flag;
bool Modify = FALSE; bool Modify = FALSE;
...@@ -45,8 +42,8 @@ bool SCH_SCREEN::SchematicCleanUp( wxDC* DC ) ...@@ -45,8 +42,8 @@ bool SCH_SCREEN::SchematicCleanUp( wxDC* DC )
{ {
if( TstDrawList->Type() == DRAW_SEGMENT_STRUCT_TYPE ) if( TstDrawList->Type() == DRAW_SEGMENT_STRUCT_TYPE )
{ {
flag = TstAlignSegment( (EDA_DrawLineStruct*) DrawList, flag = TstAlignSegment( (SCH_LINE*) DrawList,
(EDA_DrawLineStruct*) TstDrawList ); (SCH_LINE*) TstDrawList );
if( flag ) if( flag )
{ {
/* keep the bits set in .m_Flags, because the deleted /* keep the bits set in .m_Flags, because the deleted
...@@ -71,12 +68,10 @@ bool SCH_SCREEN::SchematicCleanUp( wxDC* DC ) ...@@ -71,12 +68,10 @@ bool SCH_SCREEN::SchematicCleanUp( wxDC* DC )
} }
/***********************************************/
void BreakSegmentOnJunction( SCH_SCREEN* Screen )
{
/************************************************/
/* Routine to start/end segment (BUS or wires) on junctions. /* Routine to start/end segment (BUS or wires) on junctions.
*/ */
void BreakSegmentOnJunction( SCH_SCREEN* Screen )
{
SCH_ITEM* DrawList; SCH_ITEM* DrawList;
if( Screen == NULL ) if( Screen == NULL )
...@@ -93,13 +88,13 @@ void BreakSegmentOnJunction( SCH_SCREEN* Screen ) ...@@ -93,13 +88,13 @@ void BreakSegmentOnJunction( SCH_SCREEN* Screen )
{ {
case DRAW_JUNCTION_STRUCT_TYPE: case DRAW_JUNCTION_STRUCT_TYPE:
#undef STRUCT #undef STRUCT
#define STRUCT ( (DrawJunctionStruct*) DrawList ) #define STRUCT ( (SCH_JUNCTION*) DrawList )
BreakSegment( Screen, STRUCT->m_Pos ); BreakSegment( Screen, STRUCT->m_Pos );
break; break;
case DRAW_BUSENTRY_STRUCT_TYPE: case DRAW_BUSENTRY_STRUCT_TYPE:
#undef STRUCT #undef STRUCT
#define STRUCT ( (DrawBusEntryStruct*) DrawList ) #define STRUCT ( (SCH_BUS_ENTRY*) DrawList )
BreakSegment( Screen, STRUCT->m_Pos ); BreakSegment( Screen, STRUCT->m_Pos );
BreakSegment( Screen, STRUCT->m_End() ); BreakSegment( Screen, STRUCT->m_End() );
break; break;
...@@ -111,7 +106,7 @@ void BreakSegmentOnJunction( SCH_SCREEN* Screen ) ...@@ -111,7 +106,7 @@ void BreakSegmentOnJunction( SCH_SCREEN* Screen )
case TYPE_SCH_HIERLABEL: case TYPE_SCH_HIERLABEL:
case TYPE_SCH_COMPONENT: case TYPE_SCH_COMPONENT:
case DRAW_POLYLINE_STRUCT_TYPE: case DRAW_POLYLINE_STRUCT_TYPE:
case TYPE_MARKER_SCH: case TYPE_SCH_MARKER:
case TYPE_SCH_TEXT: case TYPE_SCH_TEXT:
case DRAW_SHEET_STRUCT_TYPE: case DRAW_SHEET_STRUCT_TYPE:
case DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE: case DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE:
...@@ -132,7 +127,7 @@ void BreakSegmentOnJunction( SCH_SCREEN* Screen ) ...@@ -132,7 +127,7 @@ void BreakSegmentOnJunction( SCH_SCREEN* Screen )
*/ */
void BreakSegment( SCH_SCREEN* aScreen, wxPoint aBreakpoint ) void BreakSegment( SCH_SCREEN* aScreen, wxPoint aBreakpoint )
{ {
EDA_DrawLineStruct* segment, * NewSegment; SCH_LINE* segment, * NewSegment;
for( SCH_ITEM* DrawList = aScreen->EEDrawList; DrawList; for( SCH_ITEM* DrawList = aScreen->EEDrawList; DrawList;
DrawList = DrawList->Next() ) DrawList = DrawList->Next() )
...@@ -140,7 +135,7 @@ void BreakSegment( SCH_SCREEN* aScreen, wxPoint aBreakpoint ) ...@@ -140,7 +135,7 @@ void BreakSegment( SCH_SCREEN* aScreen, wxPoint aBreakpoint )
if( DrawList->Type() != DRAW_SEGMENT_STRUCT_TYPE ) if( DrawList->Type() != DRAW_SEGMENT_STRUCT_TYPE )
continue; continue;
segment = (EDA_DrawLineStruct*) DrawList; segment = (SCH_LINE*) DrawList;
if( !TestSegmentHit( aBreakpoint, segment->m_Start, segment->m_End, 0 ) ) if( !TestSegmentHit( aBreakpoint, segment->m_Start, segment->m_End, 0 ) )
continue; continue;
...@@ -163,15 +158,12 @@ void BreakSegment( SCH_SCREEN* aScreen, wxPoint aBreakpoint ) ...@@ -163,15 +158,12 @@ 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. /* Search if the 2 segments RefSegm and TstSegm are on a line.
* Return 0 if no * Return 0 if no
* 1 if yes, and RefSegm is modified to be the equivalent segment * 1 if yes, and RefSegm is modified to be the equivalent segment
*/ */
static int TstAlignSegment( SCH_LINE* RefSegm, SCH_LINE* TstSegm )
{
if( RefSegm == TstSegm ) if( RefSegm == TstSegm )
return 0; return 0;
if( RefSegm->GetLayer() != TstSegm->GetLayer() ) if( RefSegm->GetLayer() != TstSegm->GetLayer() )
......
...@@ -18,11 +18,6 @@ ...@@ -18,11 +18,6 @@
#include "class_marker_sch.h" #include "class_marker_sch.h"
/*****************************************************************************/
SCH_ITEM* WinEDA_SchematicFrame:: SchematicGeneralLocateAndDisplay(
bool IncludePin )
{
/*****************************************************************************/
/** Function SchematicGeneralLocateAndDisplay /** Function SchematicGeneralLocateAndDisplay
* Overlaid function * Overlaid function
* Find the schematic item at cursor position * Find the schematic item at cursor position
...@@ -39,6 +34,9 @@ SCH_ITEM* WinEDA_SchematicFrame:: SchematicGeneralLocateAndDisplay( ...@@ -39,6 +34,9 @@ SCH_ITEM* WinEDA_SchematicFrame:: SchematicGeneralLocateAndDisplay(
* *
* For some items, characteristics are displayed on the screen. * For some items, characteristics are displayed on the screen.
*/ */
SCH_ITEM* WinEDA_SchematicFrame:: SchematicGeneralLocateAndDisplay(
bool IncludePin )
{
SCH_ITEM* DrawStruct; SCH_ITEM* DrawStruct;
wxString msg; wxString msg;
wxPoint mouse_position = GetScreen()->m_MousePosition; wxPoint mouse_position = GetScreen()->m_MousePosition;
...@@ -99,13 +97,6 @@ SCH_ITEM* WinEDA_SchematicFrame:: SchematicGeneralLocateAndDisplay( ...@@ -99,13 +97,6 @@ SCH_ITEM* WinEDA_SchematicFrame:: SchematicGeneralLocateAndDisplay(
} }
/*****************************************************************************/
SCH_ITEM* WinEDA_SchematicFrame::SchematicGeneralLocateAndDisplay(
const wxPoint& refpoint,
bool
IncludePin )
{
/*****************************************************************************/
/** Function SchematicGeneralLocateAndDisplay /** Function SchematicGeneralLocateAndDisplay
* Overlaid function * Overlaid function
* Find the schematic item at a given position * Find the schematic item at a given position
...@@ -123,6 +114,11 @@ SCH_ITEM* WinEDA_SchematicFrame::SchematicGeneralLocateAndDisplay( ...@@ -123,6 +114,11 @@ SCH_ITEM* WinEDA_SchematicFrame::SchematicGeneralLocateAndDisplay(
* *
* For some items, characteristics are displayed on the screen. * For some items, characteristics are displayed on the screen.
*/ */
SCH_ITEM* WinEDA_SchematicFrame::SchematicGeneralLocateAndDisplay(
const wxPoint& refpoint,
bool
IncludePin )
{
SCH_ITEM* DrawStruct; SCH_ITEM* DrawStruct;
LIB_PIN* Pin; LIB_PIN* Pin;
SCH_COMPONENT* LibItem; SCH_COMPONENT* LibItem;
...@@ -155,8 +151,8 @@ SCH_ITEM* WinEDA_SchematicFrame::SchematicGeneralLocateAndDisplay( ...@@ -155,8 +151,8 @@ SCH_ITEM* WinEDA_SchematicFrame::SchematicGeneralLocateAndDisplay(
if( DrawStruct ) // We have found a wire: Search for a connected pin at if( DrawStruct ) // We have found a wire: Search for a connected pin at
// the same location // the same location
{ {
Pin = LocateAnyPin( Pin = LocateAnyPin( (SCH_ITEM*) m_CurrentSheet->LastDrawList(),
(SCH_ITEM*) m_CurrentSheet->LastDrawList(), refpoint, &LibItem ); refpoint, &LibItem );
if( Pin ) if( Pin )
{ {
Pin->DisplayInfo( this ); Pin->DisplayInfo( this );
...@@ -166,13 +162,14 @@ SCH_ITEM* WinEDA_SchematicFrame::SchematicGeneralLocateAndDisplay( ...@@ -166,13 +162,14 @@ SCH_ITEM* WinEDA_SchematicFrame::SchematicGeneralLocateAndDisplay(
} }
else else
ClearMsgPanel(); ClearMsgPanel();
return DrawStruct; return DrawStruct;
} }
DrawStruct = (SCH_ITEM*) PickStruct( refpoint, GetScreen(), FIELDCMPITEM ); DrawStruct = (SCH_ITEM*) PickStruct( refpoint, GetScreen(), FIELDCMPITEM );
if( DrawStruct ) if( DrawStruct )
{ {
SCH_CMP_FIELD* Field = (SCH_CMP_FIELD*) DrawStruct; SCH_FIELD* Field = (SCH_FIELD*) DrawStruct;
LibItem = (SCH_COMPONENT*) Field->GetParent(); LibItem = (SCH_COMPONENT*) Field->GetParent();
LibItem->DisplayInfo( this ); LibItem->DisplayInfo( this );
...@@ -463,7 +460,7 @@ void WinEDA_ViewlibFrame::GeneralControle( wxDC* DC, ...@@ -463,7 +460,7 @@ void WinEDA_ViewlibFrame::GeneralControle( wxDC* DC,
screen->m_Curseur = curpos; screen->m_Curseur = curpos;
/* Snap cursor to grid. */ /* Snap cursor to grid. */
PutOnGrid( &(screen->m_Curseur) ); PutOnGrid( &screen->m_Curseur );
if( screen->IsRefreshReq() ) if( screen->IsRefreshReq() )
{ {
......
...@@ -44,21 +44,21 @@ public: ...@@ -44,21 +44,21 @@ public:
DanglingEndHandle* ItemList; DanglingEndHandle* ItemList;
static void TestWireForDangling( EDA_DrawLineStruct* DrawRef, static void TestWireForDangling( SCH_LINE* DrawRef,
WinEDA_SchematicFrame* frame, wxDC* DC ); WinEDA_SchematicFrame* frame,
wxDC* DC );
void TestLabelForDangling( SCH_TEXT* label, void TestLabelForDangling( SCH_TEXT* label,
WinEDA_SchematicFrame* frame, WinEDA_SchematicFrame* frame,
wxDC* DC ); wxDC* DC );
DanglingEndHandle* RebuildEndList( EDA_BaseStruct* DrawList ); DanglingEndHandle* RebuildEndList( EDA_BaseStruct* DrawList );
/**********************************************************/
bool SegmentIntersect( int Sx1, int Sy1, int Sx2, int Sy2,
int Px1, int Py1 )
{
/**********************************************************/
/* Returns TRUE if the point P is on the segment S. /* Returns TRUE if the point P is on the segment S.
* The segment is assumed horizontal or vertical. * The segment is assumed horizontal or vertical.
*/ */
bool SegmentIntersect( int Sx1, int Sy1, int Sx2, int Sy2,
int Px1, int Py1 )
{
int Sxmin, Sxmax, Symin, Symax; int Sxmin, Sxmax, Symin, Symax;
if( Sx1 == Sx2 ) /* Line S is vertical. */ if( Sx1 == Sx2 ) /* Line S is vertical. */
...@@ -122,7 +122,7 @@ void WinEDA_SchematicFrame::TestDanglingEnds( SCH_ITEM* DrawList, wxDC* DC ) ...@@ -122,7 +122,7 @@ void WinEDA_SchematicFrame::TestDanglingEnds( SCH_ITEM* DrawList, wxDC* DC )
case DRAW_SEGMENT_STRUCT_TYPE: case DRAW_SEGMENT_STRUCT_TYPE:
#undef STRUCT #undef STRUCT
#define STRUCT ( (EDA_DrawLineStruct*) item ) #define STRUCT ( (SCH_LINE*) item )
if( STRUCT->GetLayer() == LAYER_WIRE ) if( STRUCT->GetLayer() == LAYER_WIRE )
{ {
TestWireForDangling( STRUCT, this, DC ); TestWireForDangling( STRUCT, this, DC );
...@@ -176,11 +176,9 @@ LIB_PIN* WinEDA_SchematicFrame::LocatePinEnd( SCH_ITEM* DrawList, ...@@ -176,11 +176,9 @@ LIB_PIN* WinEDA_SchematicFrame::LocatePinEnd( SCH_ITEM* DrawList,
} }
/****************************************************************************/ void TestWireForDangling( SCH_LINE* DrawRef, WinEDA_SchematicFrame* frame,
void TestWireForDangling( EDA_DrawLineStruct* DrawRef, wxDC* DC )
WinEDA_SchematicFrame* frame, wxDC* DC )
{ {
/****************************************************************************/
DanglingEndHandle* terminal_item; DanglingEndHandle* terminal_item;
bool Sdangstate = TRUE, Edangstate = TRUE; bool Sdangstate = TRUE, Edangstate = TRUE;
...@@ -216,11 +214,9 @@ void TestWireForDangling( EDA_DrawLineStruct* DrawRef, ...@@ -216,11 +214,9 @@ void TestWireForDangling( EDA_DrawLineStruct* DrawRef,
} }
/********************************************************/
void TestLabelForDangling( SCH_TEXT* label, WinEDA_SchematicFrame* frame, void TestLabelForDangling( SCH_TEXT* label, WinEDA_SchematicFrame* frame,
wxDC* DC ) wxDC* DC )
{ {
/********************************************************/
DanglingEndHandle* terminal_item; DanglingEndHandle* terminal_item;
bool dangstate = TRUE; bool dangstate = TRUE;
...@@ -290,10 +286,8 @@ wxPoint ReturnPinPhysicalPosition( LIB_PIN* Pin, SCH_COMPONENT* DrawLibItem ) ...@@ -290,10 +286,8 @@ wxPoint ReturnPinPhysicalPosition( LIB_PIN* Pin, SCH_COMPONENT* DrawLibItem )
} }
/***********************************************************/
DanglingEndHandle* RebuildEndList( EDA_BaseStruct* DrawList ) DanglingEndHandle* RebuildEndList( EDA_BaseStruct* DrawList )
{ {
/***********************************************************/
DanglingEndHandle* StartList = NULL, * item, * lastitem = NULL; DanglingEndHandle* StartList = NULL, * item, * lastitem = NULL;
EDA_BaseStruct* DrawItem; EDA_BaseStruct* DrawItem;
...@@ -319,7 +313,7 @@ DanglingEndHandle* RebuildEndList( EDA_BaseStruct* DrawList ) ...@@ -319,7 +313,7 @@ DanglingEndHandle* RebuildEndList( EDA_BaseStruct* DrawList )
case DRAW_SEGMENT_STRUCT_TYPE: case DRAW_SEGMENT_STRUCT_TYPE:
#undef STRUCT #undef STRUCT
#define STRUCT ( (EDA_DrawLineStruct*) DrawItem ) #define STRUCT ( (SCH_LINE*) DrawItem )
if( STRUCT->GetLayer() == LAYER_NOTES ) if( STRUCT->GetLayer() == LAYER_NOTES )
break; break;
if( ( STRUCT->GetLayer() == LAYER_BUS ) if( ( STRUCT->GetLayer() == LAYER_BUS )
...@@ -349,7 +343,7 @@ DanglingEndHandle* RebuildEndList( EDA_BaseStruct* DrawList ) ...@@ -349,7 +343,7 @@ DanglingEndHandle* RebuildEndList( EDA_BaseStruct* DrawList )
case DRAW_JUNCTION_STRUCT_TYPE: case DRAW_JUNCTION_STRUCT_TYPE:
#undef STRUCT #undef STRUCT
#define STRUCT ( (DrawJunctionStruct*) DrawItem ) #define STRUCT ( (SCH_JUNCTION*) DrawItem )
item = new DanglingEndHandle( JUNCTION_END ); item = new DanglingEndHandle( JUNCTION_END );
item->m_Item = DrawItem; item->m_Item = DrawItem;
...@@ -363,7 +357,7 @@ DanglingEndHandle* RebuildEndList( EDA_BaseStruct* DrawList ) ...@@ -363,7 +357,7 @@ DanglingEndHandle* RebuildEndList( EDA_BaseStruct* DrawList )
case DRAW_BUSENTRY_STRUCT_TYPE: case DRAW_BUSENTRY_STRUCT_TYPE:
#undef STRUCT #undef STRUCT
#define STRUCT ( (DrawBusEntryStruct*) DrawItem ) #define STRUCT ( (SCH_BUS_ENTRY*) DrawItem )
item = new DanglingEndHandle( ENTRY_END ); item = new DanglingEndHandle( ENTRY_END );
item->m_Item = DrawItem; item->m_Item = DrawItem;
......
This diff is collapsed.
This diff is collapsed.
...@@ -7,12 +7,14 @@ ...@@ -7,12 +7,14 @@
/** /**
* class DIALOG_EDIT_COMPONENT_IN_SCHEMATIC * class DIALOG_EDIT_COMPONENT_IN_SCHEMATIC
* is hand coded and implements DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP which is maintained by * is hand coded and implements DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP which
* wxFormBuilder. Do not auto-generate this class or file, it is hand coded. * is maintained by wxFormBuilder. Do not auto-generate this class or file,
* it is hand coded.
*/ */
class DIALOG_EDIT_COMPONENT_IN_SCHEMATIC : public DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP class DIALOG_EDIT_COMPONENT_IN_SCHEMATIC : public DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP
{ {
friend void InstallCmpeditFrame( WinEDA_SchematicFrame* parent, wxPoint& pos, friend void InstallCmpeditFrame( WinEDA_SchematicFrame* parent,
wxPoint& pos,
SCH_COMPONENT* aComponent ); SCH_COMPONENT* aComponent );
WinEDA_SchematicFrame* m_Parent; WinEDA_SchematicFrame* m_Parent;
...@@ -25,8 +27,8 @@ class DIALOG_EDIT_COMPONENT_IN_SCHEMATIC : public DIALOG_EDIT_COMPONENT_IN_SCHEM ...@@ -25,8 +27,8 @@ class DIALOG_EDIT_COMPONENT_IN_SCHEMATIC : public DIALOG_EDIT_COMPONENT_IN_SCHEM
/// The size of the dialog window last time it was displayed; /// The size of the dialog window last time it was displayed;
static wxSize s_LastSize; static wxSize s_LastSize;
/// a copy of the edited component's SCH_CMP_FIELDs /// a copy of the edited component's SCH_FIELDs
SCH_CMP_FIELDS m_FieldsBuf; SCH_FIELDS m_FieldsBuf;
void setSelectedFieldNdx( int aFieldNdx ); void setSelectedFieldNdx( int aFieldNdx );
...@@ -42,7 +44,8 @@ class DIALOG_EDIT_COMPONENT_IN_SCHEMATIC : public DIALOG_EDIT_COMPONENT_IN_SCHEM ...@@ -42,7 +44,8 @@ class DIALOG_EDIT_COMPONENT_IN_SCHEMATIC : public DIALOG_EDIT_COMPONENT_IN_SCHEM
/** /**
* Function copyPanelToSelectedField * Function copyPanelToSelectedField
* copies the values displayed on the panel fields to the currently selected field * copies the values displayed on the panel fields to the currently
* selected field
* @return bool - true if all fields are OK, else false if the user has put * @return bool - true if all fields are OK, else false if the user has put
* bad data into a field, and this value can be used to deny a row change. * bad data into a field, and this value can be used to deny a row change.
*/ */
...@@ -52,7 +55,7 @@ class DIALOG_EDIT_COMPONENT_IN_SCHEMATIC : public DIALOG_EDIT_COMPONENT_IN_SCHEM ...@@ -52,7 +55,7 @@ class DIALOG_EDIT_COMPONENT_IN_SCHEMATIC : public DIALOG_EDIT_COMPONENT_IN_SCHEM
void copyPanelToOptions(); void copyPanelToOptions();
void setRowItem( int aFieldNdx, const SCH_CMP_FIELD& aField ); void setRowItem( int aFieldNdx, const SCH_FIELD& aField );
// event handlers // event handlers
void OnListItemDeselected( wxListEvent& event ); void OnListItemDeselected( wxListEvent& event );
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
DIALOG_EESCHEMA_OPTIONS::DIALOG_EESCHEMA_OPTIONS( wxWindow* parent ) : DIALOG_EESCHEMA_OPTIONS::DIALOG_EESCHEMA_OPTIONS( wxWindow* parent ) :
DIALOG_EESCHEMA_OPTIONS_BASE( parent ) DIALOG_EESCHEMA_OPTIONS_BASE( parent )
{ {
m_choiceUnits->SetFocus();
} }
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
/* How to add a new hotkey: /* How to add a new hotkey:
* add a new id in the enum hotkey_id_commnand like MY_NEW_ID_FUNCTION (see * add a new id in the enum hotkey_id_command like MY_NEW_ID_FUNCTION (see
* hotkeys.h). * hotkeys.h).
* add a new Ki_HotkeyInfo entry like: * add a new Ki_HotkeyInfo entry like:
* static Ki_HotkeyInfo HkMyNewEntry(wxT("Command Label"), MY_NEW_ID_FUNCTION, * static Ki_HotkeyInfo HkMyNewEntry(wxT("Command Label"), MY_NEW_ID_FUNCTION,
...@@ -130,7 +130,7 @@ Ki_HotkeyInfo* s_Schematic_Hotkey_List[] = ...@@ -130,7 +130,7 @@ Ki_HotkeyInfo* s_Schematic_Hotkey_List[] =
NULL NULL
}; };
// List of hotkey descriptors for libray editor // List of hotkey descriptors for library editor
Ki_HotkeyInfo* s_LibEdit_Hotkey_List[] = Ki_HotkeyInfo* s_LibEdit_Hotkey_List[] =
{ {
&HkInsertPin, &HkInsertPin,
...@@ -312,8 +312,7 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey, ...@@ -312,8 +312,7 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
{ {
if( DrawStruct->Type() == DRAW_SEGMENT_STRUCT_TYPE ) if( DrawStruct->Type() == DRAW_SEGMENT_STRUCT_TYPE )
{ {
EDA_DrawLineStruct* segment = SCH_LINE* segment = (SCH_LINE*) DrawStruct;
(EDA_DrawLineStruct*) DrawStruct;
if( segment->GetLayer() != LAYER_WIRE ) if( segment->GetLayer() != LAYER_WIRE )
break; break;
} }
...@@ -621,7 +620,7 @@ void WinEDA_LibeditFrame::OnHotKey( wxDC* DC, int hotkey, ...@@ -621,7 +620,7 @@ void WinEDA_LibeditFrame::OnHotKey( wxDC* DC, int hotkey,
case HK_REPEAT_LAST: case HK_REPEAT_LAST:
if( m_lastDrawItem && (m_lastDrawItem->m_Flags == 0) if( m_lastDrawItem && (m_lastDrawItem->m_Flags == 0)
&& (m_lastDrawItem->Type() == COMPONENT_PIN_DRAW_TYPE) ) && ( m_lastDrawItem->Type() == COMPONENT_PIN_DRAW_TYPE ) )
{ {
RepeatPinItem( DC, (LIB_PIN*) m_lastDrawItem ); RepeatPinItem( DC, (LIB_PIN*) m_lastDrawItem );
} }
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment