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.
This commit is contained in:
parent
04c7eb2916
commit
1aaa7a9bf2
|
@ -2,24 +2,24 @@
|
||||||
** General UI Guidelines for KICAD Development
|
** General UI Guidelines for KICAD Development
|
||||||
|
|
||||||
|
|
||||||
Capitalization:
|
Capitalization:
|
||||||
|
|
||||||
For any visible text used within Kicad, follow recommendations here:
|
For any visible text used within Kicad, follow recommendations here:
|
||||||
http://library.gnome.org/devel/hig-book/2.20/design-text-labels.html.en#layout-capitalization
|
http://library.gnome.org/devel/hig-book/2.20/design-text-labels.html.en#layout-capitalization
|
||||||
This applies to all Menus, Titles, Labels, Tooltips, Buttons, etc.
|
This applies to all Menus, Titles, Labels, Tooltips, Buttons, etc.
|
||||||
|
|
||||||
|
|
||||||
Dialogs:
|
Dialogs:
|
||||||
|
|
||||||
Follow the recommendations here:
|
Follow the recommendations here:
|
||||||
http://library.gnome.org/devel/hig-book/2.20/windows-dialog.html.en
|
http://library.gnome.org/devel/hig-book/2.20/windows-dialog.html.en
|
||||||
paying particular attention to "initial focus", "sensible default values",
|
paying particular attention to "initial focus", "sensible default values",
|
||||||
"default buttons", ESC key termination.
|
"default buttons", ESC key termination.
|
||||||
|
|
||||||
Use wxWidgets "sizers" in all dialogs, no matter how simple they are:
|
Use wxWidgets "sizers" in all dialogs, no matter how simple they are:
|
||||||
http://zetcode.com/tutorials/wxwidgetstutorial/layoutmanagement
|
http://zetcode.com/tutorials/wxwidgetstutorial/layoutmanagement
|
||||||
and keep dialogs resizeable.
|
and keep dialogs resizeable.
|
||||||
|
|
||||||
Configure the sizers so that as the dialog window is expanded, the most
|
Configure the sizers so that as the dialog window is expanded, the most
|
||||||
sensible use of the increased dialog window occurs automatically by the
|
sensible use of the increased dialog window occurs automatically by the
|
||||||
sizers. For example, in the DRC dialog of PCBNEW, sizers should be used to
|
sizers. For example, in the DRC dialog of PCBNEW, sizers should be used to
|
||||||
|
@ -28,11 +28,20 @@ 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.
|
||||||
|
|
||||||
Use tooltips to explain the functionality of each non-obvious control.
|
Use tooltips to explain the functionality of each non-obvious control.
|
||||||
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,
|
||||||
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;
|
||||||
|
|
|
@ -17,9 +17,8 @@
|
||||||
#include "netlist.h"
|
#include "netlist.h"
|
||||||
|
|
||||||
|
|
||||||
/* Local Functions*/
|
|
||||||
static int AddComponentsInSheetToList( std::vector <OBJ_CMP_TO_LIST>& aComponentsList,
|
static int AddComponentsInSheetToList( std::vector <OBJ_CMP_TO_LIST>& aComponentsList,
|
||||||
DrawSheetPath* sheet );
|
SCH_SHEET_PATH* sheet );
|
||||||
static void BreakReference( std::vector <OBJ_CMP_TO_LIST>& aComponentsList );
|
static void BreakReference( std::vector <OBJ_CMP_TO_LIST>& aComponentsList );
|
||||||
static void ReAnnotateComponents( std::vector <OBJ_CMP_TO_LIST>& aComponentsList );
|
static void ReAnnotateComponents( std::vector <OBJ_CMP_TO_LIST>& aComponentsList );
|
||||||
static void ComputeReferenceNumber( std::vector <OBJ_CMP_TO_LIST>& aComponentsList );
|
static void ComputeReferenceNumber( std::vector <OBJ_CMP_TO_LIST>& aComponentsList );
|
||||||
|
@ -30,19 +29,17 @@ static int ExistUnit( int aObjet, int aUnit,
|
||||||
static int ReplaceDuplicatedTimeStamps();
|
static int ReplaceDuplicatedTimeStamps();
|
||||||
|
|
||||||
|
|
||||||
/******************************************************/
|
|
||||||
void WinEDA_SchematicFrame::UpdateSheetNumberAndDate()
|
|
||||||
/******************************************************/
|
|
||||||
|
|
||||||
/* Set a sheet number, the sheet count for sheets in the whole schematic
|
/* Set a sheet number, the sheet count for sheets in the whole schematic
|
||||||
* and update the date in all screens
|
* and update the date in all screens
|
||||||
*/
|
*/
|
||||||
|
void WinEDA_SchematicFrame::UpdateSheetNumberAndDate()
|
||||||
{
|
{
|
||||||
wxString date = GenDate();
|
wxString date = GenDate();
|
||||||
EDA_ScreenList s_list;
|
EDA_ScreenList s_list;
|
||||||
|
|
||||||
// Set the date
|
// Set the date
|
||||||
for( SCH_SCREEN* screen = s_list.GetFirst(); screen != NULL; screen = s_list.GetNext() )
|
for( SCH_SCREEN* screen = s_list.GetFirst(); screen != NULL;
|
||||||
|
screen = s_list.GetNext() )
|
||||||
screen->m_Date = date;
|
screen->m_Date = date;
|
||||||
|
|
||||||
// Set sheet counts
|
// Set sheet counts
|
||||||
|
@ -61,12 +58,13 @@ void WinEDA_SchematicFrame::UpdateSheetNumberAndDate()
|
||||||
void ReAnnotatePowerSymbolsOnly( void )
|
void ReAnnotatePowerSymbolsOnly( void )
|
||||||
{
|
{
|
||||||
/* Build the whole sheet list in hierarchy (sheet, not screen) */
|
/* Build the whole sheet list in hierarchy (sheet, not screen) */
|
||||||
EDA_SheetList SheetList;
|
SCH_SHEET_LIST SheetList;
|
||||||
|
|
||||||
DrawSheetPath* sheet;
|
SCH_SHEET_PATH* sheet;
|
||||||
int CmpNumber = 1;
|
int CmpNumber = 1;
|
||||||
|
|
||||||
for( sheet = SheetList.GetFirst(); sheet != NULL; sheet = SheetList.GetNext() )
|
for( sheet = SheetList.GetFirst(); sheet != NULL;
|
||||||
|
sheet = SheetList.GetNext() )
|
||||||
{
|
{
|
||||||
EDA_BaseStruct* DrawList = sheet->LastDrawList();
|
EDA_BaseStruct* DrawList = sheet->LastDrawList();
|
||||||
for( ; DrawList != NULL; DrawList = DrawList->Next() )
|
for( ; DrawList != NULL; DrawList = DrawList->Next() )
|
||||||
|
@ -105,7 +103,8 @@ void ReAnnotatePowerSymbolsOnly( void )
|
||||||
* if same X pos, by Y pos
|
* if same X pos, by Y pos
|
||||||
* if same Y pos, by time stamp
|
* if same Y pos, by time stamp
|
||||||
*/
|
*/
|
||||||
static bool AnnotateBy_X_Position( const OBJ_CMP_TO_LIST& item1, const OBJ_CMP_TO_LIST& item2 )
|
static bool AnnotateBy_X_Position( const OBJ_CMP_TO_LIST& item1,
|
||||||
|
const OBJ_CMP_TO_LIST& item2 )
|
||||||
{
|
{
|
||||||
int ii = item1.CompareRef( item2 );
|
int ii = item1.CompareRef( item2 );
|
||||||
|
|
||||||
|
@ -130,7 +129,8 @@ static bool AnnotateBy_X_Position( const OBJ_CMP_TO_LIST& item1, const OBJ_CMP_T
|
||||||
* if same Y pos, by X pos
|
* if same Y pos, by X pos
|
||||||
* if same X pos, by time stamp
|
* if same X pos, by time stamp
|
||||||
*/
|
*/
|
||||||
static bool AnnotateBy_Y_Position( const OBJ_CMP_TO_LIST& item1, const OBJ_CMP_TO_LIST& item2 )
|
static bool AnnotateBy_Y_Position( const OBJ_CMP_TO_LIST& item1,
|
||||||
|
const OBJ_CMP_TO_LIST& item2 )
|
||||||
{
|
{
|
||||||
int ii = item1.CompareRef( item2 );
|
int ii = item1.CompareRef( item2 );
|
||||||
|
|
||||||
|
@ -148,15 +148,16 @@ static bool AnnotateBy_Y_Position( const OBJ_CMP_TO_LIST& item1, const OBJ_CMP_T
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* qsort function to annotate items by value
|
* qsort function to annotate items by value
|
||||||
* Components are sorted
|
* Components are sorted
|
||||||
* by reference
|
* by reference
|
||||||
* if same reference: by value
|
* if same reference: by value
|
||||||
* if same value: by unit number
|
* if same value: by unit number
|
||||||
* if same unit number, by sheet
|
* if same unit number, by sheet
|
||||||
* if same sheet, by time stamp
|
* if same sheet, by time stamp
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
static bool AnnotateByValue( const OBJ_CMP_TO_LIST& item1, const OBJ_CMP_TO_LIST& item2 )
|
static bool AnnotateByValue( const OBJ_CMP_TO_LIST& item1,
|
||||||
|
const OBJ_CMP_TO_LIST& item2 )
|
||||||
{
|
{
|
||||||
int ii = item1.CompareRef( item2 );
|
int ii = item1.CompareRef( item2 );
|
||||||
|
|
||||||
|
@ -178,10 +179,11 @@ static bool AnnotateByValue( const OBJ_CMP_TO_LIST& item1, const OBJ_CMP_TO_LIST
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* qsort function to annotate items by value
|
* qsort function to annotate items by value
|
||||||
* Components are sorted by time stamp
|
* Components are sorted by time stamp
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
static bool SortByTimeStamp( const OBJ_CMP_TO_LIST& item1, const OBJ_CMP_TO_LIST& item2 )
|
static bool SortByTimeStamp( const OBJ_CMP_TO_LIST& item1,
|
||||||
|
const OBJ_CMP_TO_LIST& item2 )
|
||||||
{
|
{
|
||||||
int ii = item1.m_SheetPath.Cmp( item2.m_SheetPath );
|
int ii = item1.m_SheetPath.Cmp( item2.m_SheetPath );
|
||||||
|
|
||||||
|
@ -192,15 +194,14 @@ static bool SortByTimeStamp( const OBJ_CMP_TO_LIST& item1, const OBJ_CMP_TO_LIST
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**************************************************************************************/
|
|
||||||
void WinEDA_SchematicFrame::DeleteAnnotation( bool aCurrentSheetOnly, bool aRedraw )
|
|
||||||
/**************************************************************************************/
|
|
||||||
|
|
||||||
/** Function DeleteAnnotation
|
/** Function DeleteAnnotation
|
||||||
* Remove current component annotations
|
* Remove current component annotations
|
||||||
* @param aCurrentSheetOnly : if false: remove all annotations, else remove annotation relative to the current sheet only
|
* @param aCurrentSheetOnly : if false: remove all annotations, else remove
|
||||||
|
* annotation relative to the current sheet only
|
||||||
* @param aRedraw : true to refresh display
|
* @param aRedraw : true to refresh display
|
||||||
*/
|
*/
|
||||||
|
void WinEDA_SchematicFrame::DeleteAnnotation( bool aCurrentSheetOnly,
|
||||||
|
bool aRedraw )
|
||||||
{
|
{
|
||||||
SCH_ITEM* strct;
|
SCH_ITEM* strct;
|
||||||
SCH_SCREEN* screen;
|
SCH_SCREEN* screen;
|
||||||
|
@ -242,22 +243,26 @@ void WinEDA_SchematicFrame::DeleteAnnotation( bool aCurrentSheetOnly, bool aRedr
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************
|
/**
|
||||||
* AnnotateComponents:
|
* AnnotateComponents:
|
||||||
*
|
*
|
||||||
* Compute the annotation of the components for the whole project, or the
|
* Compute the annotation of the components for the whole project, or the
|
||||||
* current sheet only. All the components or the new ones only will be
|
* current sheet only. All the components or the new ones only will be
|
||||||
* annotated.
|
* annotated.
|
||||||
* @param parent = Schematic frame
|
* @param parent = Schematic frame
|
||||||
* @param annotateSchematic : true = entire schematic annotation, false = current scheet only
|
* @param annotateSchematic : true = entire schematic annotation,
|
||||||
* @param sortOption : 0 = annotate by sorting X position,
|
* false = current sheet only
|
||||||
* 1 = annotate by sorting Y position,
|
* @param sortOption : 0 = annotate by sorting X position,
|
||||||
* 2 = annotate by sorting value
|
* 1 = annotate by sorting Y position,
|
||||||
* @param resetAnnotation : true = remove previous annotation false = anotate new components only
|
* 2 = annotate by sorting value
|
||||||
* @param repairsTimestamps : true = test for duplicate times stamps and replace duplicated
|
* @param resetAnnotation : true = remove previous annotation
|
||||||
* Note: this option could change previous annotation, because time stamps are used to handle annotation
|
* false = annotate new components only
|
||||||
* mainly in complex hierarchies.
|
* @param repairsTimestamps : true = test for duplicate times stamps and
|
||||||
*****************************************************************************/
|
* replace duplicated
|
||||||
|
* Note: this option could change previous annotation, because time
|
||||||
|
* stamps are used to handle annotation mainly in complex
|
||||||
|
* hierarchies.
|
||||||
|
*/
|
||||||
void AnnotateComponents( WinEDA_SchematicFrame* parent,
|
void AnnotateComponents( WinEDA_SchematicFrame* parent,
|
||||||
bool annotateSchematic,
|
bool annotateSchematic,
|
||||||
int sortOption,
|
int sortOption,
|
||||||
|
@ -268,15 +273,17 @@ void AnnotateComponents( WinEDA_SchematicFrame* parent,
|
||||||
|
|
||||||
wxBusyCursor dummy;
|
wxBusyCursor dummy;
|
||||||
|
|
||||||
// Test and replace duplicte time stamps
|
// Test and replace duplicate time stamps
|
||||||
// duplicate can happen with old schematics, or schematic conversions or manual editions of files ...
|
// duplicate can happen with old schematics, or schematic conversions or
|
||||||
|
// manual editions of files ...
|
||||||
if( repairsTimestamps )
|
if( repairsTimestamps )
|
||||||
{
|
{
|
||||||
int ireplacecount = ReplaceDuplicatedTimeStamps();
|
int ireplacecount = ReplaceDuplicatedTimeStamps();
|
||||||
if( ireplacecount )
|
if( ireplacecount )
|
||||||
{
|
{
|
||||||
wxString msg;
|
wxString msg;
|
||||||
msg.Printf( _( "%d Duplicate Time stamps replaced" ), ireplacecount );
|
msg.Printf( _( "%d duplicate time stamps replaced." ),
|
||||||
|
ireplacecount );
|
||||||
DisplayInfoMessage( NULL, msg, 2 );
|
DisplayInfoMessage( NULL, msg, 2 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -287,7 +294,7 @@ void AnnotateComponents( WinEDA_SchematicFrame* parent,
|
||||||
parent->DeleteAnnotation( !annotateSchematic, false );
|
parent->DeleteAnnotation( !annotateSchematic, false );
|
||||||
|
|
||||||
/* Build the sheet list */
|
/* Build the sheet list */
|
||||||
EDA_SheetList SheetList;
|
SCH_SHEET_LIST SheetList;
|
||||||
|
|
||||||
/* Update the sheet number, sheet count and date */
|
/* Update the sheet number, sheet count and date */
|
||||||
parent->UpdateSheetNumberAndDate();
|
parent->UpdateSheetNumberAndDate();
|
||||||
|
@ -295,7 +302,7 @@ void AnnotateComponents( WinEDA_SchematicFrame* parent,
|
||||||
/* Build component list */
|
/* Build component list */
|
||||||
if( annotateSchematic )
|
if( annotateSchematic )
|
||||||
{
|
{
|
||||||
DrawSheetPath* sheet;
|
SCH_SHEET_PATH* sheet;
|
||||||
for( sheet = SheetList.GetFirst();
|
for( sheet = SheetList.GetFirst();
|
||||||
sheet != NULL;
|
sheet != NULL;
|
||||||
sheet = SheetList.GetNext() )
|
sheet = SheetList.GetNext() )
|
||||||
|
@ -312,11 +319,13 @@ void AnnotateComponents( WinEDA_SchematicFrame* parent,
|
||||||
switch( sortOption )
|
switch( sortOption )
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
sort( ComponentsList.begin(), ComponentsList.end(), AnnotateBy_X_Position );
|
sort( ComponentsList.begin(), ComponentsList.end(),
|
||||||
|
AnnotateBy_X_Position );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
sort( ComponentsList.begin(), ComponentsList.end(), AnnotateBy_Y_Position );
|
sort( ComponentsList.begin(), ComponentsList.end(),
|
||||||
|
AnnotateBy_Y_Position );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
|
@ -334,16 +343,14 @@ void AnnotateComponents( WinEDA_SchematicFrame* parent,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************************************/
|
|
||||||
int AddComponentsInSheetToList( std::vector <OBJ_CMP_TO_LIST>& aComponentsList,
|
|
||||||
DrawSheetPath* aSheet )
|
|
||||||
/********************************************************************************************************/
|
|
||||||
|
|
||||||
/** function AddComponentsInSheetToList()
|
/** function AddComponentsInSheetToList()
|
||||||
* Add a OBJ_CMP_TO_LIST object in aComponentsList for each component found in sheet
|
* Add a OBJ_CMP_TO_LIST object in aComponentsList for each component found
|
||||||
|
* in sheet
|
||||||
* @param aComponentsList = a std::vector list to fill
|
* @param aComponentsList = a std::vector list to fill
|
||||||
* @param the DrawSheetPath sheet to analyse
|
* @param the SCH_SHEET_PATH sheet to analyze
|
||||||
*/
|
*/
|
||||||
|
int AddComponentsInSheetToList( std::vector <OBJ_CMP_TO_LIST>& aComponentsList,
|
||||||
|
SCH_SHEET_PATH* aSheet )
|
||||||
{
|
{
|
||||||
int NbrCmp = 0;
|
int NbrCmp = 0;
|
||||||
EDA_BaseStruct* DrawList = aSheet->LastDrawList();
|
EDA_BaseStruct* DrawList = aSheet->LastDrawList();
|
||||||
|
@ -372,7 +379,8 @@ int AddComponentsInSheetToList( std::vector <OBJ_CMP_TO_LIST>& aComponentsList,
|
||||||
if( DrawLibItem->GetRef( aSheet ).IsEmpty() )
|
if( DrawLibItem->GetRef( aSheet ).IsEmpty() )
|
||||||
DrawLibItem->SetRef( aSheet, wxT( "DefRef?" ) );
|
DrawLibItem->SetRef( aSheet, wxT( "DefRef?" ) );
|
||||||
|
|
||||||
strncpy( new_object.m_Reference, CONV_TO_UTF8( DrawLibItem->GetRef( aSheet ) ), 32 );
|
strncpy( new_object.m_Reference,
|
||||||
|
CONV_TO_UTF8( DrawLibItem->GetRef( aSheet ) ), 32 );
|
||||||
|
|
||||||
new_object.m_NumRef = -1;
|
new_object.m_NumRef = -1;
|
||||||
|
|
||||||
|
@ -390,10 +398,10 @@ int AddComponentsInSheetToList( std::vector <OBJ_CMP_TO_LIST>& aComponentsList,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************
|
/*
|
||||||
* Update the reference component for the schematic project (or the current
|
* Update the reference component for the schematic project (or the current
|
||||||
* sheet)
|
* sheet)
|
||||||
*****************************************************************************/
|
*/
|
||||||
static void ReAnnotateComponents( std::vector <OBJ_CMP_TO_LIST>& aComponentsList )
|
static void ReAnnotateComponents( std::vector <OBJ_CMP_TO_LIST>& aComponentsList )
|
||||||
{
|
{
|
||||||
/* update the reference numbers */
|
/* update the reference numbers */
|
||||||
|
@ -407,7 +415,8 @@ static void ReAnnotateComponents( std::vector <OBJ_CMP_TO_LIST>& aComponentsList
|
||||||
else
|
else
|
||||||
sprintf( Text + strlen( Text ), "%d", aComponentsList[ii].m_NumRef );
|
sprintf( Text + strlen( Text ), "%d", aComponentsList[ii].m_NumRef );
|
||||||
|
|
||||||
component->SetRef( &(aComponentsList[ii].m_SheetPath), CONV_FROM_UTF8( Text ) );
|
component->SetRef( &(aComponentsList[ii].m_SheetPath),
|
||||||
|
CONV_FROM_UTF8( Text ) );
|
||||||
component->m_Multi = aComponentsList[ii].m_Unit;
|
component->m_Multi = aComponentsList[ii].m_Unit;
|
||||||
component->SetUnitSelection( &(aComponentsList[ii].m_SheetPath),
|
component->SetUnitSelection( &(aComponentsList[ii].m_SheetPath),
|
||||||
aComponentsList[ii].m_Unit );
|
aComponentsList[ii].m_Unit );
|
||||||
|
@ -415,15 +424,15 @@ static void ReAnnotateComponents( std::vector <OBJ_CMP_TO_LIST>& aComponentsList
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************
|
/**
|
||||||
* Split component reference designators into a name (prefix) and number.
|
* Split component reference designators into a name (prefix) and number.
|
||||||
* Example: IC1 becomes IC and 1 in the .m_NumRef member.
|
* Example: IC1 becomes IC and 1 in the .m_NumRef member.
|
||||||
* For multi part per package components not already annotated, set .m_Unit
|
* For multi part per package components not already annotated, set .m_Unit
|
||||||
* to a max value (0x7FFFFFFF).
|
* to a max value (0x7FFFFFFF).
|
||||||
*
|
*
|
||||||
* @param aComponentsList = list of component
|
* @param aComponentsList = list of component
|
||||||
* @param NbOfCmp = item count in the list
|
* @param NbOfCmp = item count in the list
|
||||||
*****************************************************************************/
|
*/
|
||||||
void BreakReference( std::vector <OBJ_CMP_TO_LIST>& aComponentsList )
|
void BreakReference( std::vector <OBJ_CMP_TO_LIST>& aComponentsList )
|
||||||
{
|
{
|
||||||
char* Text;
|
char* Text;
|
||||||
|
@ -466,16 +475,16 @@ void BreakReference( std::vector <OBJ_CMP_TO_LIST>& aComponentsList )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************
|
/*
|
||||||
* Compute the reference number for components without reference number
|
* Compute the reference number for components without reference number
|
||||||
* Compute .m_NumRef member
|
* Compute .m_NumRef member
|
||||||
*****************************************************************************/
|
*/
|
||||||
static void ComputeReferenceNumber( std::vector <OBJ_CMP_TO_LIST>& aComponentsList )
|
static void ComputeReferenceNumber( std::vector <OBJ_CMP_TO_LIST>& aComponentsList )
|
||||||
{
|
{
|
||||||
int LastReferenceNumber, NumberOfUnits, Unit;
|
int LastReferenceNumber, NumberOfUnits, Unit;
|
||||||
|
|
||||||
/* Components with an invisible reference (power...) always are re-annotated.
|
/* Components with an invisible reference (power...) always are
|
||||||
* So set theirs .m_IsNew member to true
|
* re-annotated. So set their .m_IsNew member to true
|
||||||
*/
|
*/
|
||||||
for( unsigned ii = 0; ii < aComponentsList.size(); ii++ )
|
for( unsigned ii = 0; ii < aComponentsList.size(); ii++ )
|
||||||
{
|
{
|
||||||
|
@ -486,9 +495,10 @@ static void ComputeReferenceNumber( std::vector <OBJ_CMP_TO_LIST>& aComponentsLi
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* calculate index of the first component with the same reference prefix than the current component.
|
/* calculate index of the first component with the same reference prefix
|
||||||
* all of component having the same reference prefix will receive a reference number with consecutives values:
|
* than the current component. All components having the same reference
|
||||||
* IC .. will be set to IC4, IC4, IC5 ...
|
* prefix will receive a reference number with consecutive values:
|
||||||
|
* IC .. will be set to IC4, IC4, IC5 ...
|
||||||
*/
|
*/
|
||||||
unsigned first = 0;
|
unsigned first = 0;
|
||||||
/* calculate the last used number for this reference prefix: */
|
/* calculate the last used number for this reference prefix: */
|
||||||
|
@ -498,8 +508,10 @@ static void ComputeReferenceNumber( std::vector <OBJ_CMP_TO_LIST>& aComponentsLi
|
||||||
if( aComponentsList[ii].m_Flag )
|
if( aComponentsList[ii].m_Flag )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if( aComponentsList[first].CompareRef( aComponentsList[ii] ) != 0 ) /* New reference found: we need a new ref number for this reference */
|
if( aComponentsList[first].CompareRef( aComponentsList[ii] ) != 0 )
|
||||||
{
|
{
|
||||||
|
/* New reference found: we need a new ref number for this
|
||||||
|
* reference */
|
||||||
first = ii;
|
first = ii;
|
||||||
LastReferenceNumber = GetLastReferenceNumber( ii, aComponentsList );
|
LastReferenceNumber = GetLastReferenceNumber( ii, aComponentsList );
|
||||||
}
|
}
|
||||||
|
@ -533,7 +545,8 @@ static void ComputeReferenceNumber( std::vector <OBJ_CMP_TO_LIST>& aComponentsLi
|
||||||
}
|
}
|
||||||
|
|
||||||
/* search for others units of this component.
|
/* search for others units of this component.
|
||||||
* we search for others parts that have the same value and the same reference prefix (ref without ref number)
|
* we search for others parts that have the same value and the same
|
||||||
|
* reference prefix (ref without ref number)
|
||||||
*/
|
*/
|
||||||
for( Unit = 1; Unit <= NumberOfUnits; Unit++ )
|
for( Unit = 1; Unit <= NumberOfUnits; Unit++ )
|
||||||
{
|
{
|
||||||
|
@ -541,23 +554,27 @@ static void ComputeReferenceNumber( std::vector <OBJ_CMP_TO_LIST>& aComponentsLi
|
||||||
continue;
|
continue;
|
||||||
int found = ExistUnit( ii, Unit, aComponentsList );
|
int found = ExistUnit( ii, Unit, aComponentsList );
|
||||||
if( found >= 0 )
|
if( found >= 0 )
|
||||||
continue; /* this unit exists for this reference (unit already annotated) */
|
continue; /* this unit exists for this reference (unit
|
||||||
|
* already annotated) */
|
||||||
|
|
||||||
/* Search a component to annotate ( same prefix, same value, not annotated) */
|
/* Search a component to annotate ( same prefix, same value,
|
||||||
|
* not annotated) */
|
||||||
for( unsigned jj = ii + 1; jj < aComponentsList.size(); jj++ )
|
for( unsigned jj = ii + 1; jj < aComponentsList.size(); jj++ )
|
||||||
{
|
{
|
||||||
if( aComponentsList[jj].m_Flag ) // already tested
|
if( aComponentsList[jj].m_Flag ) // already tested
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if( aComponentsList[ii].CompareRef( aComponentsList[jj] ) != 0 ) // references are different
|
if( aComponentsList[ii].CompareRef( aComponentsList[jj] ) != 0 )
|
||||||
continue;
|
continue;
|
||||||
if( aComponentsList[jj].CompareValue( aComponentsList[ii] ) != 0 )
|
if( aComponentsList[jj].CompareValue( aComponentsList[ii] ) != 0 )
|
||||||
continue; // values are different
|
continue;
|
||||||
if( !aComponentsList[jj].m_IsNew )
|
if( !aComponentsList[jj].m_IsNew )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* Component without reference number found, annotate it if possible */
|
/* Component without reference number found, annotate it
|
||||||
if( !aComponentsList[jj].IsPartsLocked() || (aComponentsList[jj].m_Unit == Unit) )
|
* if possible */
|
||||||
|
if( !aComponentsList[jj].IsPartsLocked()
|
||||||
|
|| ( aComponentsList[jj].m_Unit == Unit ) )
|
||||||
{
|
{
|
||||||
aComponentsList[jj].m_NumRef = aComponentsList[ii].m_NumRef;
|
aComponentsList[jj].m_NumRef = aComponentsList[ii].m_NumRef;
|
||||||
aComponentsList[jj].m_Unit = Unit;
|
aComponentsList[jj].m_Unit = Unit;
|
||||||
|
@ -571,21 +588,23 @@ static void ComputeReferenceNumber( std::vector <OBJ_CMP_TO_LIST>& aComponentsLi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************
|
/**
|
||||||
* Search the last used (greatest) reference number in the component list
|
* Search the last used (greatest) reference number in the component list
|
||||||
* for the prefix reference given by Objet
|
* for the prefix reference given by Objet
|
||||||
* The component list must be sorted.
|
* The component list must be sorted.
|
||||||
*
|
*
|
||||||
* @param aObjet = reference item ( aComponentsList[aObjet].m_TextRef is the search pattern)
|
* @param aObjet = reference item ( aComponentsList[aObjet].m_TextRef is
|
||||||
* @param aComponentsList = list of items
|
* the search pattern)
|
||||||
*****************************************************************************/
|
* @param aComponentsList = list of items
|
||||||
int GetLastReferenceNumber( int aObjet, std::vector <OBJ_CMP_TO_LIST>& aComponentsList )
|
*/
|
||||||
|
int GetLastReferenceNumber( int aObjet,
|
||||||
|
std::vector <OBJ_CMP_TO_LIST>& aComponentsList )
|
||||||
{
|
{
|
||||||
int LastNumber = 0;
|
int LastNumber = 0;
|
||||||
|
|
||||||
for( unsigned ii = 0; ii < aComponentsList.size(); ii++ )
|
for( unsigned ii = 0; ii < aComponentsList.size(); ii++ )
|
||||||
{
|
{
|
||||||
/* Nouveau Identificateur */
|
/* New identifier. */
|
||||||
if( aComponentsList[aObjet].CompareRef( aComponentsList[ii] ) != 0 )
|
if( aComponentsList[aObjet].CompareRef( aComponentsList[ii] ) != 0 )
|
||||||
continue;
|
continue;
|
||||||
if( LastNumber < aComponentsList[ii].m_NumRef )
|
if( LastNumber < aComponentsList[ii].m_NumRef )
|
||||||
|
@ -596,15 +615,16 @@ int GetLastReferenceNumber( int aObjet, std::vector <OBJ_CMP_TO_LIST>& aComponen
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************
|
/**
|
||||||
* Search in the sorted list of components, for a given componen,t an other component
|
* Search in the sorted list of components, for a given component an other
|
||||||
* with the same reference and a given part unit.
|
* component with the same reference and a given part unit. Mainly used to
|
||||||
* Mainly used to manage multiple parts per package components
|
* manage multiple parts per package components.
|
||||||
* @param aObjet = index in aComponentsList for the given OBJ_CMP_TO_LIST item to test
|
* @param aObjet = index in aComponentsList for the given OBJ_CMP_TO_LIST
|
||||||
* @param Unit = the given unit number to search
|
* item to test
|
||||||
* @param aComponentsList = list of items to examine
|
* @param Unit = the given unit number to search
|
||||||
* @return index in aComponentsList if found or -1 if not found
|
* @param aComponentsList = list of items to examine
|
||||||
*****************************************************************************/
|
* @return index in aComponentsList if found or -1 if not found
|
||||||
|
*/
|
||||||
static int ExistUnit( int aObjet, int Unit,
|
static int ExistUnit( int aObjet, int Unit,
|
||||||
std::vector <OBJ_CMP_TO_LIST>& aComponentsList )
|
std::vector <OBJ_CMP_TO_LIST>& aComponentsList )
|
||||||
{
|
{
|
||||||
|
@ -613,16 +633,21 @@ static int ExistUnit( int aObjet, int Unit,
|
||||||
NumRef = aComponentsList[aObjet].m_NumRef;
|
NumRef = aComponentsList[aObjet].m_NumRef;
|
||||||
for( unsigned ii = 0; ii < aComponentsList.size(); ii++ )
|
for( unsigned ii = 0; ii < aComponentsList.size(); ii++ )
|
||||||
{
|
{
|
||||||
if( aObjet == (int) ii ) // Do not compare with itself !
|
if( aObjet == (int) ii )
|
||||||
|
// Do not compare with itself !
|
||||||
continue;
|
continue;
|
||||||
if( aComponentsList[ii].m_IsNew ) // Not already with an updated reference
|
if( aComponentsList[ii].m_IsNew )
|
||||||
|
// Not already with an updated reference
|
||||||
continue;
|
continue;
|
||||||
if( aComponentsList[ii].m_NumRef != NumRef ) // Not the same reference number (like 35 in R35)
|
if( aComponentsList[ii].m_NumRef != NumRef )
|
||||||
|
// Not the same reference number (like 35 in R35)
|
||||||
continue;
|
continue;
|
||||||
if( aComponentsList[aObjet].CompareRef( aComponentsList[ii] ) != 0 ) // Not the same reference prefix
|
if( aComponentsList[aObjet].CompareRef( aComponentsList[ii] ) != 0 )
|
||||||
|
// Not the same reference prefix
|
||||||
continue;
|
continue;
|
||||||
if( aComponentsList[ii].m_Unit == Unit ) // A part with the same reference and the given unit is found
|
if( aComponentsList[ii].m_Unit == Unit )
|
||||||
{
|
{
|
||||||
|
// A part with the same reference and the given unit is found
|
||||||
return ii;
|
return ii;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -631,10 +656,6 @@ static int ExistUnit( int aObjet, int Unit,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************************/
|
|
||||||
int WinEDA_SchematicFrame::CheckAnnotate( wxArrayString* aMessageList, bool aOneSheetOnly )
|
|
||||||
/***************************************************************************************/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function CheckAnnotate
|
* Function CheckAnnotate
|
||||||
* Check errors relatives to annotation:
|
* Check errors relatives to annotation:
|
||||||
|
@ -643,26 +664,30 @@ int WinEDA_SchematicFrame::CheckAnnotate( wxArrayString* aMessageList, bool aOne
|
||||||
* for multiple parts per package components :
|
* for multiple parts per package components :
|
||||||
* part number > number of parts
|
* part number > number of parts
|
||||||
* different values between parts
|
* different values between parts
|
||||||
* @return errors count
|
* @param aMessageList = a wxArrayString to store messages. If NULL, they
|
||||||
* @param aMessageList = a wxArrayString to store messages. If NULL, they are displayed in a wxMessageBox
|
* are displayed in a wxMessageBox
|
||||||
* @param aOneSheetOnly : true = search is made only in the current sheet
|
* @param aOneSheetOnly : true = search is made only in the current sheet
|
||||||
* false = search in whole hierarchy (usual search).
|
* false = search in whole hierarchy (usual search).
|
||||||
|
* @return errors count
|
||||||
*/
|
*/
|
||||||
|
int WinEDA_SchematicFrame::CheckAnnotate( wxArrayString* aMessageList,
|
||||||
|
bool aOneSheetOnly )
|
||||||
{
|
{
|
||||||
int error;
|
int error;
|
||||||
wxString Buff;
|
wxString Buff;
|
||||||
wxString msg, cmpref;
|
wxString msg, cmpref;
|
||||||
|
|
||||||
/* build the screen list */
|
/* build the screen list */
|
||||||
EDA_SheetList SheetList;
|
SCH_SHEET_LIST SheetList;
|
||||||
|
|
||||||
std::vector <OBJ_CMP_TO_LIST> ComponentsList;
|
std::vector <OBJ_CMP_TO_LIST> ComponentsList;
|
||||||
|
|
||||||
/* Build the list of components */
|
/* Build the list of components */
|
||||||
if( !aOneSheetOnly )
|
if( !aOneSheetOnly )
|
||||||
{
|
{
|
||||||
DrawSheetPath* sheet;
|
SCH_SHEET_PATH* sheet;
|
||||||
for( sheet = SheetList.GetFirst(); sheet != NULL; sheet = SheetList.GetNext() )
|
for( sheet = SheetList.GetFirst(); sheet != NULL;
|
||||||
|
sheet = SheetList.GetNext() )
|
||||||
AddComponentsInSheetToList( ComponentsList, sheet );
|
AddComponentsInSheetToList( ComponentsList, sheet );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -693,23 +718,28 @@ int WinEDA_SchematicFrame::CheckAnnotate( wxArrayString* aMessageList, bool aOne
|
||||||
msg.Printf( _( "item not annotated: %s%s" ),
|
msg.Printf( _( "item not annotated: %s%s" ),
|
||||||
cmpref.GetData(), Buff.GetData() );
|
cmpref.GetData(), Buff.GetData() );
|
||||||
|
|
||||||
if( (ComponentsList[ii].m_Unit > 0) && (ComponentsList[ii].m_Unit < 0x7FFFFFFF) )
|
if( ( ComponentsList[ii].m_Unit > 0 )
|
||||||
|
&& ( ComponentsList[ii].m_Unit < 0x7FFFFFFF ) )
|
||||||
{
|
{
|
||||||
Buff.Printf( _( "( unit %d)" ), ComponentsList[ii].m_Unit );
|
Buff.Printf( _( "( unit %d)" ), ComponentsList[ii].m_Unit );
|
||||||
msg << Buff;
|
msg << Buff;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( aMessageList )
|
if( aMessageList )
|
||||||
{
|
{
|
||||||
aMessageList->Add( msg + wxT( "\n" ) );
|
aMessageList->Add( msg + wxT( "\n" ) );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
DisplayError( NULL, msg );
|
DisplayError( NULL, msg );
|
||||||
|
}
|
||||||
error++;
|
error++;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Annotate error
|
// Annotate error
|
||||||
if( MAX( ComponentsList[ii].m_Entry->GetPartCount(), 1 ) < ComponentsList[ii].m_Unit )
|
if( MAX( ComponentsList[ii].m_Entry->GetPartCount(), 1 )
|
||||||
|
< ComponentsList[ii].m_Unit )
|
||||||
{
|
{
|
||||||
if( ComponentsList[ii].m_NumRef >= 0 )
|
if( ComponentsList[ii].m_NumRef >= 0 )
|
||||||
Buff << ComponentsList[ii].m_NumRef;
|
Buff << ComponentsList[ii].m_NumRef;
|
||||||
|
@ -721,7 +751,8 @@ int WinEDA_SchematicFrame::CheckAnnotate( wxArrayString* aMessageList, bool aOne
|
||||||
Buff.GetData() );
|
Buff.GetData() );
|
||||||
|
|
||||||
Buff.Printf( _( " unit %d and no more than %d parts" ),
|
Buff.Printf( _( " unit %d and no more than %d parts" ),
|
||||||
ComponentsList[ii].m_Unit, ComponentsList[ii].m_Entry->GetPartCount() );
|
ComponentsList[ii].m_Unit,
|
||||||
|
ComponentsList[ii].m_Entry->GetPartCount() );
|
||||||
msg << Buff;
|
msg << Buff;
|
||||||
if( aMessageList )
|
if( aMessageList )
|
||||||
{
|
{
|
||||||
|
@ -743,7 +774,7 @@ int WinEDA_SchematicFrame::CheckAnnotate( wxArrayString* aMessageList, bool aOne
|
||||||
msg.Empty();
|
msg.Empty();
|
||||||
Buff.Empty();
|
Buff.Empty();
|
||||||
|
|
||||||
if( (ComponentsList[ii].CompareRef( ComponentsList[ii + 1] ) != 0)
|
if( ( ComponentsList[ii].CompareRef( ComponentsList[ii + 1] ) != 0 )
|
||||||
|| ( ComponentsList[ii].m_NumRef != ComponentsList[ii + 1].m_NumRef ) )
|
|| ( ComponentsList[ii].m_NumRef != ComponentsList[ii + 1].m_NumRef ) )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -760,7 +791,8 @@ int WinEDA_SchematicFrame::CheckAnnotate( wxArrayString* aMessageList, bool aOne
|
||||||
msg.Printf( _( "Multiple item %s%s" ),
|
msg.Printf( _( "Multiple item %s%s" ),
|
||||||
cmpref.GetData(), Buff.GetData() );
|
cmpref.GetData(), Buff.GetData() );
|
||||||
|
|
||||||
if( (ComponentsList[ii].m_Unit > 0) && (ComponentsList[ii].m_Unit < 0x7FFFFFFF) )
|
if( ( ComponentsList[ii].m_Unit > 0 )
|
||||||
|
&& ( ComponentsList[ii].m_Unit < 0x7FFFFFFF ) )
|
||||||
{
|
{
|
||||||
Buff.Printf( _( " (unit %d)" ), ComponentsList[ii].m_Unit );
|
Buff.Printf( _( " (unit %d)" ), ComponentsList[ii].m_Unit );
|
||||||
msg << Buff;
|
msg << Buff;
|
||||||
|
@ -776,8 +808,9 @@ int WinEDA_SchematicFrame::CheckAnnotate( wxArrayString* aMessageList, bool aOne
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Test error if units are different but number of parts per package
|
/* Test error if units are different but number of parts per package
|
||||||
* too hight (ex U3 ( 1 part) and we find U3B this is an error) */
|
* too high (ex U3 ( 1 part) and we find U3B this is an error) */
|
||||||
if( ComponentsList[ii].m_Entry->GetPartCount() != ComponentsList[ii + 1].m_Entry->GetPartCount() )
|
if( ComponentsList[ii].m_Entry->GetPartCount()
|
||||||
|
!= ComponentsList[ii + 1].m_Entry->GetPartCount() )
|
||||||
{
|
{
|
||||||
if( ComponentsList[ii].m_NumRef >= 0 )
|
if( ComponentsList[ii].m_NumRef >= 0 )
|
||||||
Buff << ComponentsList[ii].m_NumRef;
|
Buff << ComponentsList[ii].m_NumRef;
|
||||||
|
@ -788,7 +821,8 @@ int WinEDA_SchematicFrame::CheckAnnotate( wxArrayString* aMessageList, bool aOne
|
||||||
msg.Printf( _( "Multiple item %s%s" ),
|
msg.Printf( _( "Multiple item %s%s" ),
|
||||||
cmpref.GetData(), Buff.GetData() );
|
cmpref.GetData(), Buff.GetData() );
|
||||||
|
|
||||||
if( (ComponentsList[ii].m_Unit > 0) && (ComponentsList[ii].m_Unit < 0x7FFFFFFF) )
|
if( ( ComponentsList[ii].m_Unit > 0 )
|
||||||
|
&& ( ComponentsList[ii].m_Unit < 0x7FFFFFFF ) )
|
||||||
{
|
{
|
||||||
Buff.Printf( _( " (unit %d)" ), ComponentsList[ii].m_Unit );
|
Buff.Printf( _( " (unit %d)" ), ComponentsList[ii].m_Unit );
|
||||||
msg << Buff;
|
msg << Buff;
|
||||||
|
@ -799,11 +833,14 @@ int WinEDA_SchematicFrame::CheckAnnotate( wxArrayString* aMessageList, bool aOne
|
||||||
aMessageList->Add( msg + wxT( "\n" ));
|
aMessageList->Add( msg + wxT( "\n" ));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
DisplayError( NULL, msg );
|
DisplayError( NULL, msg );
|
||||||
|
}
|
||||||
error++;
|
error++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Error if values are different between units, for the same reference */
|
/* Error if values are different between units, for the same
|
||||||
|
* reference */
|
||||||
int next = ii + 1;
|
int next = ii + 1;
|
||||||
if( ComponentsList[ii].CompareValue( ComponentsList[next] ) != 0 )
|
if( ComponentsList[ii].CompareValue( ComponentsList[next] ) != 0 )
|
||||||
{
|
{
|
||||||
|
@ -812,40 +849,47 @@ int WinEDA_SchematicFrame::CheckAnnotate( wxArrayString* aMessageList, bool aOne
|
||||||
nextcmpref = CONV_FROM_UTF8( ComponentsList[next].m_Reference );
|
nextcmpref = CONV_FROM_UTF8( ComponentsList[next].m_Reference );
|
||||||
#if defined(KICAD_GOST)
|
#if defined(KICAD_GOST)
|
||||||
msg.Printf( _( "Diff values for %s%d.%c (%s) and %s%d.%c (%s)" ),
|
msg.Printf( _( "Diff values for %s%d.%c (%s) and %s%d.%c (%s)" ),
|
||||||
cmpref.GetData(),
|
cmpref.GetData(),
|
||||||
ComponentsList[ii].m_NumRef,
|
ComponentsList[ii].m_NumRef,
|
||||||
ComponentsList[ii].m_Unit + '1' - 1,
|
ComponentsList[ii].m_Unit + '1' - 1,
|
||||||
ComponentsList[ii].m_Value->GetData(), nextcmpref.GetData(),
|
ComponentsList[ii].m_Value->GetData(),
|
||||||
ComponentsList[next].m_NumRef,
|
nextcmpref.GetData(),
|
||||||
ComponentsList[next].m_Unit + '1' - 1,
|
ComponentsList[next].m_NumRef,
|
||||||
ComponentsList[next].m_Value->GetData() );
|
ComponentsList[next].m_Unit + '1' - 1,
|
||||||
|
ComponentsList[next].m_Value->GetData() );
|
||||||
#else
|
#else
|
||||||
msg.Printf( _( "Diff values for %s%d%c (%s) and %s%d%c (%s)" ),
|
msg.Printf( _( "Diff values for %s%d%c (%s) and %s%d%c (%s)" ),
|
||||||
cmpref.GetData(),
|
cmpref.GetData(),
|
||||||
ComponentsList[ii].m_NumRef,
|
ComponentsList[ii].m_NumRef,
|
||||||
ComponentsList[ii].m_Unit + 'A' - 1,
|
ComponentsList[ii].m_Unit + 'A' - 1,
|
||||||
ComponentsList[ii].m_Value->GetData(), nextcmpref.GetData(),
|
ComponentsList[ii].m_Value->GetData(),
|
||||||
ComponentsList[next].m_NumRef,
|
nextcmpref.GetData(),
|
||||||
ComponentsList[next].m_Unit + 'A' - 1,
|
ComponentsList[next].m_NumRef,
|
||||||
ComponentsList[next].m_Value->GetData() );
|
ComponentsList[next].m_Unit + 'A' - 1,
|
||||||
|
ComponentsList[next].m_Value->GetData() );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if( aMessageList )
|
if( aMessageList )
|
||||||
{
|
{
|
||||||
aMessageList->Add( msg + wxT( "\n" ));
|
aMessageList->Add( msg + wxT( "\n" ));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
DisplayError( NULL, msg );
|
DisplayError( NULL, msg );
|
||||||
|
}
|
||||||
|
|
||||||
error++;
|
error++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// count the duplicated time stamps
|
// count the duplicated time stamps
|
||||||
sort( ComponentsList.begin(), ComponentsList.end(), SortByTimeStamp );
|
sort( ComponentsList.begin(), ComponentsList.end(), SortByTimeStamp );
|
||||||
for( int ii = 0; (ii < imax) && (error < 4); ii++ )
|
for( int ii = 0; ( ii < imax ) && ( error < 4 ); ii++ )
|
||||||
{
|
{
|
||||||
if( (ComponentsList[ii].m_TimeStamp != ComponentsList[ii + 1].m_TimeStamp)
|
if( (ComponentsList[ii].m_TimeStamp
|
||||||
|| ( ComponentsList[ii].m_SheetPath != ComponentsList[ii + 1].m_SheetPath ) )
|
!= ComponentsList[ii + 1].m_TimeStamp)
|
||||||
|
|| ( ComponentsList[ii].m_SheetPath
|
||||||
|
!= ComponentsList[ii + 1].m_SheetPath ) )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* Same time stamp found. */
|
/* Same time stamp found. */
|
||||||
|
@ -862,10 +906,13 @@ int WinEDA_SchematicFrame::CheckAnnotate( wxArrayString* aMessageList, bool aOne
|
||||||
nextcmpref.GetData(), ComponentsList[ii + 1].m_NumRef );
|
nextcmpref.GetData(), ComponentsList[ii + 1].m_NumRef );
|
||||||
if( aMessageList )
|
if( aMessageList )
|
||||||
{
|
{
|
||||||
aMessageList->Add( msg + wxT( "\n" ));
|
aMessageList->Add( msg + wxT( "\n" ));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
DisplayError( NULL, msg );
|
DisplayError( NULL, msg );
|
||||||
|
}
|
||||||
|
|
||||||
error++;
|
error++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -896,7 +943,8 @@ static bool SortItemByTimeStamp( const SCH_ITEM* item1, const SCH_ITEM* item2 )
|
||||||
|
|
||||||
|
|
||||||
/** Function ReplaceDuplicatedTimeStamps
|
/** Function ReplaceDuplicatedTimeStamps
|
||||||
* Search for duplicate time stamps in the whole hierarchy, and replace duplicae by new time stamps
|
* Search for duplicate time stamps in the whole hierarchy, and replace
|
||||||
|
* duplicate by new time stamps
|
||||||
*/
|
*/
|
||||||
int ReplaceDuplicatedTimeStamps()
|
int ReplaceDuplicatedTimeStamps()
|
||||||
{
|
{
|
||||||
|
@ -904,19 +952,22 @@ int ReplaceDuplicatedTimeStamps()
|
||||||
EDA_ScreenList ScreenList;
|
EDA_ScreenList ScreenList;
|
||||||
|
|
||||||
/* Build the list of items with time stamps (components and sheets)
|
/* Build the list of items with time stamps (components and sheets)
|
||||||
* note: if all items have a different time stamp, this ensure also different paths in complex hierarchy
|
* note: if all items have a different time stamp, this ensure also
|
||||||
* this is the reason we have differant time stamps for components AND sheets
|
* different paths in complex hierarchy
|
||||||
|
* this is the reason we have different time stamps for components AND
|
||||||
|
* sheets
|
||||||
*/
|
*/
|
||||||
std::vector <SCH_ITEM*> itemlist;
|
std::vector <SCH_ITEM*> itemlist;
|
||||||
SCH_SCREEN* screen;
|
SCH_SCREEN* screen;
|
||||||
SCH_ITEM* item;
|
SCH_ITEM* item;
|
||||||
for( screen = ScreenList.GetFirst(); screen != NULL; screen = ScreenList.GetNext() )
|
for( screen = ScreenList.GetFirst(); screen != NULL;
|
||||||
|
screen = ScreenList.GetNext() )
|
||||||
{
|
{
|
||||||
item = screen->EEDrawList;
|
item = screen->EEDrawList;
|
||||||
while( item )
|
while( item )
|
||||||
{
|
{
|
||||||
if( (item->Type() == DRAW_SHEET_STRUCT_TYPE)
|
if( ( item->Type() == DRAW_SHEET_STRUCT_TYPE )
|
||||||
|| (item->Type() == TYPE_SCH_COMPONENT) )
|
|| ( item->Type() == TYPE_SCH_COMPONENT ) )
|
||||||
itemlist.push_back( item );
|
itemlist.push_back( item );
|
||||||
|
|
||||||
item = item->Next();
|
item = item->Next();
|
||||||
|
@ -924,7 +975,6 @@ int ReplaceDuplicatedTimeStamps()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test and replace duplicated time stamps
|
// Test and replace duplicated time stamps
|
||||||
|
|
||||||
int imax = itemlist.size() - 1;
|
int imax = itemlist.size() - 1;
|
||||||
int errcount = 0;
|
int errcount = 0;
|
||||||
sort( itemlist.begin(), itemlist.end(), SortItemByTimeStamp );
|
sort( itemlist.begin(), itemlist.end(), SortItemByTimeStamp );
|
||||||
|
@ -936,12 +986,15 @@ int ReplaceDuplicatedTimeStamps()
|
||||||
{
|
{
|
||||||
errcount++;
|
errcount++;
|
||||||
|
|
||||||
// for a component, update its Time stamp and its paths (m_PathsAndReferences field)
|
// for a component, update its Time stamp and its paths
|
||||||
|
// (m_PathsAndReferences field)
|
||||||
if( item->Type() == TYPE_SCH_COMPONENT )
|
if( item->Type() == TYPE_SCH_COMPONENT )
|
||||||
( (SCH_COMPONENT*) item )->SetTimeStamp( GetTimeStamp() );
|
( (SCH_COMPONENT*) item )->SetTimeStamp( GetTimeStamp() );
|
||||||
|
|
||||||
// for a sheet, update only its time stamp (annotation of its components will be lost)
|
// for a sheet, update only its time stamp (annotation of its
|
||||||
// TODO: see how to change sheet paths for its cmp list (can be possible in most cases)
|
// components will be lost)
|
||||||
|
// @todo: see how to change sheet paths for its cmp list (can
|
||||||
|
// be possible in most cases)
|
||||||
else
|
else
|
||||||
item->m_TimeStamp = GetTimeStamp();
|
item->m_TimeStamp = GetTimeStamp();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/****************************************************************
|
/****************************************************************
|
||||||
* 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 @@
|
||||||
#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,11 +28,16 @@ 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(
|
||||||
SCH_ITEM* DrawList = NULL;
|
const wxString& aReference,
|
||||||
EDA_SheetList SheetList;
|
const wxString& aFootPrint,
|
||||||
SCH_COMPONENT* Cmp;
|
bool aSetVisible )
|
||||||
bool found = false;
|
{
|
||||||
|
SCH_SHEET_PATH* sheet;
|
||||||
|
SCH_ITEM* DrawList = NULL;
|
||||||
|
SCH_SHEET_LIST SheetList;
|
||||||
|
SCH_COMPONENT* Cmp;
|
||||||
|
bool found = false;
|
||||||
|
|
||||||
for( sheet = SheetList.GetFirst();
|
for( sheet = SheetList.GetFirst();
|
||||||
sheet != NULL;
|
sheet != NULL;
|
||||||
|
@ -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
|
||||||
* 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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
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()
|
||||||
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()
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/****************************************************/
|
/****************************************************/
|
||||||
/* BLOCK.CPP */
|
/* BLOCK.CPP */
|
||||||
/****************************************************/
|
/****************************************************/
|
||||||
|
|
||||||
#include "fctsys.h"
|
#include "fctsys.h"
|
||||||
|
@ -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 )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*************************************************/
|
|
||||||
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()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/******************************************************/
|
|
||||||
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 )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/****************************************************/
|
|
||||||
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;
|
||||||
|
@ -244,7 +236,7 @@ int WinEDA_SchematicFrame::HandleBlockEnd( wxDC* DC )
|
||||||
DisplayError( this, wxT( "Error in HandleBlockPLace()" ) );
|
DisplayError( this, wxT( "Error in HandleBlockPLace()" ) );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BLOCK_DRAG: /* Drag */
|
case BLOCK_DRAG: /* Drag */
|
||||||
BreakSegmentOnJunction( (SCH_SCREEN*) GetScreen() );
|
BreakSegmentOnJunction( (SCH_SCREEN*) GetScreen() );
|
||||||
|
|
||||||
case BLOCK_MOVE: /* Move */
|
case BLOCK_MOVE: /* Move */
|
||||||
|
@ -283,7 +275,7 @@ int WinEDA_SchematicFrame::HandleBlockEnd( wxDC* DC )
|
||||||
DrawPanel->Refresh();
|
DrawPanel->Refresh();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BLOCK_SAVE: /* Save */
|
case BLOCK_SAVE: /* Save */
|
||||||
PickItemsInBlock( GetScreen()->m_BlockLocate, GetScreen() );
|
PickItemsInBlock( GetScreen()->m_BlockLocate, GetScreen() );
|
||||||
DrawAndSizingBlockOutlines( DrawPanel, DC, FALSE );
|
DrawAndSizingBlockOutlines( DrawPanel, DC, FALSE );
|
||||||
if( block->GetCount() )
|
if( block->GetCount() )
|
||||||
|
@ -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 )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/************************************************************************/
|
|
||||||
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,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************/
|
|
||||||
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
|
||||||
|
@ -542,7 +528,7 @@ void SaveStructListForPaste( PICKED_ITEMS_LIST& aItemsList )
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* Routine to paste a structure from the g_BlockSaveDataList stack.
|
* Routine to paste a structure from the g_BlockSaveDataList stack.
|
||||||
* This routine is the same as undelete but original list is NOT removed.
|
* This routine is the same as undelete but original list is NOT removed.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
void WinEDA_SchematicFrame::PasteListOfItems( wxDC* DC )
|
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 )
|
||||||
*/
|
*/
|
||||||
SCH_ITEM* Struct;
|
static void CollectStructsToDrag( SCH_SCREEN* screen )
|
||||||
EDA_DrawLineStruct* SegmStruct;
|
{
|
||||||
|
SCH_ITEM* Struct;
|
||||||
|
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 )
|
||||||
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 )
|
||||||
|
|
||||||
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 )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************/
|
|
||||||
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 )
|
||||||
{
|
{
|
||||||
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 )
|
||||||
|
|
||||||
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 )
|
||||||
|
|
||||||
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 )
|
||||||
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 )
|
||||||
|
|
||||||
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 )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************/
|
|
||||||
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,
|
||||||
* @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,
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
// Name: build_BOM.cpp
|
// Name: build_BOM.cpp
|
||||||
// Purpose:
|
// Purpose:
|
||||||
// Author: jean-pierre Charras
|
// Author: jean-pierre Charras
|
||||||
// License: GPL license
|
// License: GPL license
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#include <algorithm> // to use sort vector
|
#include <algorithm> // to use sort vector
|
||||||
|
@ -25,6 +24,11 @@
|
||||||
#include "dialog_build_BOM.h"
|
#include "dialog_build_BOM.h"
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @bug - Every instance of fprintf() and fputs() in this file fails to check
|
||||||
|
* the return value for an error.
|
||||||
|
*/
|
||||||
|
|
||||||
/* object used in build BOM to handle the list of labels in schematic
|
/* object used in build BOM to handle the list of labels in schematic
|
||||||
* because in a complex hierarchy, a label is used more than once,
|
* because in a complex hierarchy, a label is used more than once,
|
||||||
* and had more than one sheet path, so we must create a flat list of labels
|
* and had more than one sheet path, so we must create a flat list of labels
|
||||||
|
@ -32,11 +36,11 @@
|
||||||
class LABEL_OBJECT
|
class LABEL_OBJECT
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
int m_LabelType;
|
int m_LabelType;
|
||||||
SCH_ITEM* m_Label;
|
SCH_ITEM* m_Label;
|
||||||
|
|
||||||
//have to store it here since the object references will be duplicated.
|
//have to store it here since the object references will be duplicated.
|
||||||
DrawSheetPath m_SheetPath; //composed of UIDs
|
SCH_SHEET_PATH m_SheetPath; //composed of UIDs
|
||||||
|
|
||||||
public: LABEL_OBJECT()
|
public: LABEL_OBJECT()
|
||||||
{
|
{
|
||||||
|
@ -51,7 +55,6 @@ static const wxString BomFileExtension( wxT( "lst" ) );
|
||||||
#define BomFileWildcard _( "Bill of Materials file (*.lst)|*.lst" )
|
#define BomFileWildcard _( "Bill of Materials file (*.lst)|*.lst" )
|
||||||
|
|
||||||
|
|
||||||
/* Local functions */
|
|
||||||
static void BuildComponentsListFromSchematic(
|
static void BuildComponentsListFromSchematic(
|
||||||
std::vector <OBJ_CMP_TO_LIST>& aList );
|
std::vector <OBJ_CMP_TO_LIST>& aList );
|
||||||
static void GenListeGLabels( std::vector <LABEL_OBJECT>& aList );
|
static void GenListeGLabels( std::vector <LABEL_OBJECT>& aList );
|
||||||
|
@ -73,19 +76,16 @@ int SplitString( wxString strToSplit,
|
||||||
wxString* strDigits,
|
wxString* strDigits,
|
||||||
wxString* strEnd );
|
wxString* strEnd );
|
||||||
|
|
||||||
/* Local variables */
|
|
||||||
|
|
||||||
/* separator used in bom export to spreadsheet */
|
/* separator used in bom export to spreadsheet */
|
||||||
static char s_ExportSeparatorSymbol;
|
static char s_ExportSeparatorSymbol;
|
||||||
|
|
||||||
|
|
||||||
/**************************************************************************/
|
|
||||||
void DIALOG_BUILD_BOM::Create_BOM_Lists( bool aTypeFileIsExport,
|
void DIALOG_BUILD_BOM::Create_BOM_Lists( bool aTypeFileIsExport,
|
||||||
bool aIncludeSubComponents,
|
bool aIncludeSubComponents,
|
||||||
char aExportSeparatorSymbol,
|
char aExportSeparatorSymbol,
|
||||||
bool aRunBrowser )
|
bool aRunBrowser )
|
||||||
{
|
{
|
||||||
/**************************************************************************/
|
|
||||||
wxFileName fn;
|
wxFileName fn;
|
||||||
|
|
||||||
s_ExportSeparatorSymbol = aExportSeparatorSymbol;
|
s_ExportSeparatorSymbol = aExportSeparatorSymbol;
|
||||||
|
@ -122,16 +122,14 @@ void DIALOG_BUILD_BOM::Create_BOM_Lists( bool aTypeFileIsExport,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************/
|
|
||||||
void DIALOG_BUILD_BOM::CreateExportList( const wxString& aFullFileName,
|
|
||||||
bool aIncludeSubComponents )
|
|
||||||
{
|
|
||||||
/****************************************************************************/
|
|
||||||
/*
|
/*
|
||||||
* Print a list of components, in a form which can be imported by a spreadsheet
|
* Print a list of components, in a form which can be imported by a spreadsheet
|
||||||
* form is:
|
* form is:
|
||||||
* cmp name; cmp val; fields;
|
* cmp name; cmp val; fields;
|
||||||
*/
|
*/
|
||||||
|
void DIALOG_BUILD_BOM::CreateExportList( const wxString& aFullFileName,
|
||||||
|
bool aIncludeSubComponents )
|
||||||
|
{
|
||||||
FILE* f;
|
FILE* f;
|
||||||
wxString msg;
|
wxString msg;
|
||||||
|
|
||||||
|
@ -159,17 +157,13 @@ void DIALOG_BUILD_BOM::CreateExportList( const wxString& aFullFileName,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************/
|
|
||||||
void DIALOG_BUILD_BOM::GenereListeOfItems(
|
|
||||||
const wxString& aFullFileName,
|
|
||||||
bool
|
|
||||||
aIncludeSubComponents )
|
|
||||||
{
|
|
||||||
/****************************************************************************/
|
|
||||||
/** GenereListeOfItems()
|
/** GenereListeOfItems()
|
||||||
* Main function to create the list of components and/or labels
|
* Main function to create the list of components and/or labels
|
||||||
* (global labels and pin sheets" )
|
* (global labels and pin sheets" )
|
||||||
*/
|
*/
|
||||||
|
void DIALOG_BUILD_BOM::GenereListeOfItems( const wxString& aFullFileName,
|
||||||
|
bool aIncludeSubComponents )
|
||||||
|
{
|
||||||
FILE* f;
|
FILE* f;
|
||||||
int itemCount;
|
int itemCount;
|
||||||
char Line[1024];
|
char Line[1024];
|
||||||
|
@ -212,7 +206,7 @@ void DIALOG_BUILD_BOM::GenereListeOfItems(
|
||||||
}
|
}
|
||||||
|
|
||||||
/*************************************************/
|
/*************************************************/
|
||||||
/* Create list of global labels and pins sheets */
|
/* Create list of global labels and pins sheets */
|
||||||
/*************************************************/
|
/*************************************************/
|
||||||
std::vector <LABEL_OBJECT> listOfLabels;
|
std::vector <LABEL_OBJECT> listOfLabels;
|
||||||
GenListeGLabels( listOfLabels );
|
GenListeGLabels( listOfLabels );
|
||||||
|
@ -246,10 +240,6 @@ order = Alphab. ) count = %d\n\n" ),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************/
|
|
||||||
void BuildComponentsListFromSchematic( std::vector <OBJ_CMP_TO_LIST>& aList )
|
|
||||||
{
|
|
||||||
/***************************************************************************/
|
|
||||||
/* Creates the list of components found in the whole schematic
|
/* Creates the list of components found in the whole schematic
|
||||||
*
|
*
|
||||||
* if List == null, just returns the count. if not, fills the list.
|
* if List == null, just returns the count. if not, fills the list.
|
||||||
|
@ -257,12 +247,14 @@ void BuildComponentsListFromSchematic( std::vector <OBJ_CMP_TO_LIST>& aList )
|
||||||
* multiple instances of a given screen.
|
* multiple instances of a given screen.
|
||||||
* Also Initialize m_Father as pointer of the SCH_SCREEN parent
|
* Also Initialize m_Father as pointer of the SCH_SCREEN parent
|
||||||
*/
|
*/
|
||||||
|
void BuildComponentsListFromSchematic( std::vector <OBJ_CMP_TO_LIST>& aList )
|
||||||
|
{
|
||||||
EDA_BaseStruct* SchItem;
|
EDA_BaseStruct* SchItem;
|
||||||
SCH_COMPONENT* DrawLibItem;
|
SCH_COMPONENT* DrawLibItem;
|
||||||
DrawSheetPath* sheet;
|
SCH_SHEET_PATH* sheet;
|
||||||
|
|
||||||
/* Build the sheet (not screen) list */
|
/* Build the sheet (not screen) list */
|
||||||
EDA_SheetList SheetList;
|
SCH_SHEET_LIST SheetList;
|
||||||
|
|
||||||
for( sheet = SheetList.GetFirst();
|
for( sheet = SheetList.GetFirst();
|
||||||
sheet != NULL;
|
sheet != NULL;
|
||||||
|
@ -293,20 +285,18 @@ void BuildComponentsListFromSchematic( std::vector <OBJ_CMP_TO_LIST>& aList )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************/
|
|
||||||
static void GenListeGLabels( std::vector <LABEL_OBJECT>& aList )
|
|
||||||
{
|
|
||||||
/****************************************************************/
|
|
||||||
/* Fill aList with Glabel info
|
/* Fill aList with Glabel info
|
||||||
*/
|
*/
|
||||||
SCH_ITEM* DrawList;
|
static void GenListeGLabels( std::vector <LABEL_OBJECT>& aList )
|
||||||
SCH_SHEET_PIN* PinLabel;
|
{
|
||||||
DrawSheetPath* sheet;
|
SCH_ITEM* DrawList;
|
||||||
|
SCH_SHEET_PIN* PinLabel;
|
||||||
|
SCH_SHEET_PATH* sheet;
|
||||||
|
|
||||||
/* Build the sheet list */
|
/* Build the sheet list */
|
||||||
EDA_SheetList SheetList;
|
SCH_SHEET_LIST SheetList;
|
||||||
|
|
||||||
LABEL_OBJECT labet_object;
|
LABEL_OBJECT labet_object;
|
||||||
|
|
||||||
for( sheet = SheetList.GetFirst();
|
for( sheet = SheetList.GetFirst();
|
||||||
sheet != NULL;
|
sheet != NULL;
|
||||||
|
@ -350,22 +340,20 @@ static void GenListeGLabels( std::vector <LABEL_OBJECT>& aList )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
bool SortComponentsByValue( const OBJ_CMP_TO_LIST& obj1,
|
|
||||||
const OBJ_CMP_TO_LIST& obj2 )
|
|
||||||
{
|
|
||||||
/*****************************************************************************/
|
|
||||||
/* Compare function for sort()
|
/* Compare function for sort()
|
||||||
* components are sorted
|
* components are sorted
|
||||||
* by value
|
* by value
|
||||||
* if same value: by reference
|
* if same value: by reference
|
||||||
* if same reference: by unit number
|
* if same reference: by unit number
|
||||||
*/
|
*/
|
||||||
|
bool SortComponentsByValue( const OBJ_CMP_TO_LIST& obj1,
|
||||||
|
const OBJ_CMP_TO_LIST& obj2 )
|
||||||
|
{
|
||||||
int ii;
|
int ii;
|
||||||
const wxString* Text1, * Text2;
|
const wxString* Text1, * Text2;
|
||||||
|
|
||||||
Text1 = &(obj1.m_RootCmp->GetField( VALUE )->m_Text);
|
Text1 = &( obj1.m_RootCmp->GetField( VALUE )->m_Text );
|
||||||
Text2 = &(obj2.m_RootCmp->GetField( VALUE )->m_Text);
|
Text2 = &( obj2.m_RootCmp->GetField( VALUE )->m_Text );
|
||||||
ii = Text1->CmpNoCase( *Text2 );
|
ii = Text1->CmpNoCase( *Text2 );
|
||||||
|
|
||||||
if( ii == 0 )
|
if( ii == 0 )
|
||||||
|
@ -382,17 +370,15 @@ bool SortComponentsByValue( const OBJ_CMP_TO_LIST& obj1,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
bool SortComponentsByReference( const OBJ_CMP_TO_LIST& obj1,
|
|
||||||
const OBJ_CMP_TO_LIST& obj2 )
|
|
||||||
{
|
|
||||||
/*****************************************************************************/
|
|
||||||
/* compare function for sorting
|
/* compare function for sorting
|
||||||
* components are sorted
|
* components are sorted
|
||||||
* by reference
|
* by reference
|
||||||
* if same reference: by value
|
* if same reference: by value
|
||||||
* if same value: by unit number
|
* if same value: by unit number
|
||||||
*/
|
*/
|
||||||
|
bool SortComponentsByReference( const OBJ_CMP_TO_LIST& obj1,
|
||||||
|
const OBJ_CMP_TO_LIST& obj2 )
|
||||||
|
{
|
||||||
int ii;
|
int ii;
|
||||||
const wxString* Text1, * Text2;
|
const wxString* Text1, * Text2;
|
||||||
|
|
||||||
|
@ -414,15 +400,13 @@ bool SortComponentsByReference( const OBJ_CMP_TO_LIST& obj1,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************/
|
|
||||||
bool SortLabelsByValue( const LABEL_OBJECT& obj1, const LABEL_OBJECT& obj2 )
|
|
||||||
{
|
|
||||||
/*******************************************************************/
|
|
||||||
/* compare function for sorting labels
|
/* compare function for sorting labels
|
||||||
* sort by
|
* sort by
|
||||||
* value
|
* value
|
||||||
* if same value: by sheet
|
* if same value: by sheet
|
||||||
*/
|
*/
|
||||||
|
bool SortLabelsByValue( const LABEL_OBJECT& obj1, const LABEL_OBJECT& obj2 )
|
||||||
|
{
|
||||||
int ii;
|
int ii;
|
||||||
wxString* Text1, * Text2;
|
wxString* Text1, * Text2;
|
||||||
|
|
||||||
|
@ -447,14 +431,12 @@ bool SortLabelsByValue( const LABEL_OBJECT& obj1, const LABEL_OBJECT& obj2 )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
bool SortLabelsBySheet( const LABEL_OBJECT& obj1, const LABEL_OBJECT& obj2 )
|
|
||||||
{
|
|
||||||
/*****************************************************************************/
|
|
||||||
/* compare function for sorting labels
|
/* compare function for sorting labels
|
||||||
* by sheet
|
* by sheet
|
||||||
* in a sheet, by alphabetic order
|
* in a sheet, by alphabetic order
|
||||||
*/
|
*/
|
||||||
|
bool SortLabelsBySheet( const LABEL_OBJECT& obj1, const LABEL_OBJECT& obj2 )
|
||||||
|
{
|
||||||
int ii;
|
int ii;
|
||||||
wxString Text1, Text2;
|
wxString Text1, Text2;
|
||||||
|
|
||||||
|
@ -480,14 +462,12 @@ bool SortLabelsBySheet( const LABEL_OBJECT& obj1, const LABEL_OBJECT& obj2 )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**************************************************************/
|
|
||||||
static void DeleteSubCmp( std::vector <OBJ_CMP_TO_LIST>& aList )
|
|
||||||
{
|
|
||||||
/**************************************************************/
|
|
||||||
/* Remove sub components from the list, when multiples parts per package are
|
/* Remove sub components from the list, when multiples parts per package are
|
||||||
* found in this list
|
* found in this list
|
||||||
* The component list **MUST** be sorted by reference and by unit number
|
* The component list **MUST** be sorted by reference and by unit number
|
||||||
*/
|
*/
|
||||||
|
static void DeleteSubCmp( std::vector <OBJ_CMP_TO_LIST>& aList )
|
||||||
|
{
|
||||||
SCH_COMPONENT* libItem;
|
SCH_COMPONENT* libItem;
|
||||||
wxString oldName;
|
wxString oldName;
|
||||||
wxString currName;
|
wxString currName;
|
||||||
|
@ -515,11 +495,9 @@ static void DeleteSubCmp( std::vector <OBJ_CMP_TO_LIST>& aList )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************/
|
|
||||||
void DIALOG_BUILD_BOM::PrintFieldData( FILE* f, SCH_COMPONENT* DrawLibItem,
|
void DIALOG_BUILD_BOM::PrintFieldData( FILE* f, SCH_COMPONENT* DrawLibItem,
|
||||||
bool CompactForm )
|
bool CompactForm )
|
||||||
{
|
{
|
||||||
/****************************************************************************/
|
|
||||||
// @todo make this variable length
|
// @todo make this variable length
|
||||||
const wxCheckBox* FieldListCtrl[] =
|
const wxCheckBox* FieldListCtrl[] =
|
||||||
{
|
{
|
||||||
|
@ -544,8 +522,10 @@ void DIALOG_BUILD_BOM::PrintFieldData( FILE* f, SCH_COMPONENT* DrawLibItem,
|
||||||
CONV_TO_UTF8( DrawLibItem->GetField( FOOTPRINT )->m_Text ) );
|
CONV_TO_UTF8( DrawLibItem->GetField( FOOTPRINT )->m_Text ) );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
fprintf( f, "; %-12s",
|
fprintf( f, "; %-12s",
|
||||||
CONV_TO_UTF8( DrawLibItem->GetField( FOOTPRINT )->m_Text ) );
|
CONV_TO_UTF8( DrawLibItem->GetField( FOOTPRINT )->m_Text ) );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for( ii = FIELD1; ii < DrawLibItem->GetFieldCount(); ii++ )
|
for( ii = FIELD1; ii < DrawLibItem->GetFieldCount(); ii++ )
|
||||||
|
@ -574,16 +554,14 @@ void DIALOG_BUILD_BOM::PrintFieldData( FILE* f, SCH_COMPONENT* DrawLibItem,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************/
|
/* Print the B.O.M sorted by reference
|
||||||
|
*/
|
||||||
int DIALOG_BUILD_BOM::PrintComponentsListByRef(
|
int DIALOG_BUILD_BOM::PrintComponentsListByRef(
|
||||||
FILE* f,
|
FILE* f,
|
||||||
std::vector <OBJ_CMP_TO_LIST>& aList,
|
std::vector <OBJ_CMP_TO_LIST>& aList,
|
||||||
bool CompactForm,
|
bool CompactForm,
|
||||||
bool aIncludeSubComponents )
|
bool aIncludeSubComponents )
|
||||||
{
|
{
|
||||||
/****************************************************************************/
|
|
||||||
/* Print the B.O.M sorted by reference
|
|
||||||
*/
|
|
||||||
int Multi, Unit;
|
int Multi, Unit;
|
||||||
EDA_BaseStruct* DrawList;
|
EDA_BaseStruct* DrawList;
|
||||||
SCH_COMPONENT* DrawLibItem;
|
SCH_COMPONENT* DrawLibItem;
|
||||||
|
@ -665,10 +643,8 @@ int DIALOG_BUILD_BOM::PrintComponentsListByRef(
|
||||||
|
|
||||||
if( ( Multi > 1 ) && aIncludeSubComponents )
|
if( ( Multi > 1 ) && aIncludeSubComponents )
|
||||||
#if defined(KICAD_GOST)
|
#if defined(KICAD_GOST)
|
||||||
|
|
||||||
Unit = aList[ii].m_Unit + '1' - 1;
|
Unit = aList[ii].m_Unit + '1' - 1;
|
||||||
#else
|
#else
|
||||||
|
|
||||||
Unit = aList[ii].m_Unit + 'A' - 1;
|
Unit = aList[ii].m_Unit + 'A' - 1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -688,7 +664,8 @@ int DIALOG_BUILD_BOM::PrintComponentsListByRef(
|
||||||
msg = aList[ii].m_SheetPath.PathHumanReadable();
|
msg = aList[ii].m_SheetPath.PathHumanReadable();
|
||||||
if( CompactForm )
|
if( CompactForm )
|
||||||
{
|
{
|
||||||
fprintf( f, "%c%s", s_ExportSeparatorSymbol, CONV_TO_UTF8( msg ) );
|
fprintf( f, "%c%s", s_ExportSeparatorSymbol,
|
||||||
|
CONV_TO_UTF8( msg ) );
|
||||||
msg = m_Parent->GetXYSheetReferences(
|
msg = m_Parent->GetXYSheetReferences(
|
||||||
(BASE_SCREEN*) DrawLibItem->GetParent(),
|
(BASE_SCREEN*) DrawLibItem->GetParent(),
|
||||||
DrawLibItem->m_Pos );
|
DrawLibItem->m_Pos );
|
||||||
|
@ -715,17 +692,16 @@ int DIALOG_BUILD_BOM::PrintComponentsListByRef(
|
||||||
msg = _( "#End Cmp\n" );
|
msg = _( "#End Cmp\n" );
|
||||||
fputs( CONV_TO_UTF8( msg ), f );
|
fputs( CONV_TO_UTF8( msg ), f );
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
int DIALOG_BUILD_BOM::PrintComponentsListByVal(
|
int DIALOG_BUILD_BOM::PrintComponentsListByVal(
|
||||||
FILE* f,
|
FILE* f,
|
||||||
std::vector <OBJ_CMP_TO_LIST>& aList,
|
std::vector <OBJ_CMP_TO_LIST>& aList,
|
||||||
bool aIncludeSubComponents )
|
bool aIncludeSubComponents )
|
||||||
{
|
{
|
||||||
/*****************************************************************************/
|
|
||||||
int Multi;
|
int Multi;
|
||||||
wxChar Unit;
|
wxChar Unit;
|
||||||
EDA_BaseStruct* DrawList;
|
EDA_BaseStruct* DrawList;
|
||||||
|
@ -799,10 +775,8 @@ int DIALOG_BUILD_BOM::PrintComponentsListByVal(
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/************************************************************************/
|
|
||||||
static int PrintListeGLabel( FILE* f, std::vector <LABEL_OBJECT>& aList )
|
static int PrintListeGLabel( FILE* f, std::vector <LABEL_OBJECT>& aList )
|
||||||
{
|
{
|
||||||
/************************************************************************/
|
|
||||||
SCH_LABEL* DrawTextItem;
|
SCH_LABEL* DrawTextItem;
|
||||||
SCH_SHEET_PIN* DrawSheetLabel;
|
SCH_SHEET_PIN* DrawSheetLabel;
|
||||||
wxString msg, sheetpath;
|
wxString msg, sheetpath;
|
||||||
|
@ -864,16 +838,14 @@ static int PrintListeGLabel( FILE* f, std::vector <LABEL_OBJECT>& aList )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/********************************************/
|
|
||||||
int RefDesStringCompare( const char* obj1, const char* obj2 )
|
|
||||||
{
|
|
||||||
/********************************************/
|
|
||||||
/* This function will act just like the strcmp function but correctly sort
|
/* This function will act just like the strcmp function but correctly sort
|
||||||
* the numerical order in the string
|
* the numerical order in the string
|
||||||
* return -1 if first string is less than the second
|
* return -1 if first string is less than the second
|
||||||
* return 0 if the strings are equal
|
* return 0 if the strings are equal
|
||||||
* return 1 if the first string is greater than the second
|
* return 1 if the first string is greater than the second
|
||||||
*/
|
*/
|
||||||
|
int RefDesStringCompare( const char* obj1, const char* obj2 )
|
||||||
|
{
|
||||||
/* The strings we are going to compare */
|
/* The strings we are going to compare */
|
||||||
wxString strFWord;
|
wxString strFWord;
|
||||||
wxString strSWord;
|
wxString strSWord;
|
||||||
|
@ -932,19 +904,17 @@ int RefDesStringCompare( const char* obj1, const char* obj2 )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************/
|
|
||||||
int SplitString( wxString strToSplit,
|
|
||||||
wxString* strBeginning,
|
|
||||||
wxString* strDigits,
|
|
||||||
wxString* strEnd )
|
|
||||||
{
|
|
||||||
/****************************************************************************/
|
|
||||||
/* This is the function that breaks a string into three parts.
|
/* This is the function that breaks a string into three parts.
|
||||||
* The alphabetic preamble
|
* The alphabetic preamble
|
||||||
* The numeric part
|
* The numeric part
|
||||||
* Any alphabetic ending
|
* Any alphabetic ending
|
||||||
* For example C10A is split to C 10 A
|
* For example C10A is split to C 10 A
|
||||||
*/
|
*/
|
||||||
|
int SplitString( wxString strToSplit,
|
||||||
|
wxString* strBeginning,
|
||||||
|
wxString* strDigits,
|
||||||
|
wxString* strEnd )
|
||||||
|
{
|
||||||
/* Clear all the return strings */
|
/* Clear all the return strings */
|
||||||
strBeginning->Clear();
|
strBeginning->Clear();
|
||||||
strDigits->Clear();
|
strDigits->Clear();
|
||||||
|
|
|
@ -22,16 +22,12 @@ static void Segment_in_Ghost( WinEDA_DrawPanel* panel, wxDC* DC, bool erase );
|
||||||
static void AbortCreateNewLine( WinEDA_DrawPanel* Panel, wxDC* DC );
|
static void AbortCreateNewLine( WinEDA_DrawPanel* Panel, wxDC* DC );
|
||||||
static bool IsTerminalPoint( SCH_SCREEN* screen, const wxPoint& pos, int layer );
|
static bool IsTerminalPoint( SCH_SCREEN* screen, const wxPoint& pos, int layer );
|
||||||
static bool IsJunctionNeeded( WinEDA_SchematicFrame* frame, wxPoint& pos );
|
static bool IsJunctionNeeded( WinEDA_SchematicFrame* frame, wxPoint& pos );
|
||||||
static void ComputeBreakPoint( EDA_DrawLineStruct* segment,
|
static void ComputeBreakPoint( SCH_LINE* segment, const wxPoint& new_pos );
|
||||||
const wxPoint& new_pos );
|
|
||||||
|
|
||||||
SCH_ITEM* s_OldWiresList;
|
SCH_ITEM* s_OldWiresList;
|
||||||
wxPoint s_ConnexionStartPoint;
|
wxPoint s_ConnexionStartPoint;
|
||||||
|
|
||||||
/*********************************************************/
|
|
||||||
SCH_ITEM* SCH_SCREEN::ExtractWires( bool CreateCopy )
|
|
||||||
{
|
|
||||||
/*********************************************************/
|
|
||||||
/* Extract the old wires, junctions and buses, an if CreateCopy replace them
|
/* Extract the old wires, junctions and buses, an if CreateCopy replace them
|
||||||
* by a copy. Old ones must be put in undo list, and the new ones can be
|
* by a copy. Old ones must be put in undo list, and the new ones can be
|
||||||
* modified by clean up safely.
|
* modified by clean up safely.
|
||||||
|
@ -43,6 +39,8 @@ SCH_ITEM* SCH_SCREEN::ExtractWires( bool CreateCopy )
|
||||||
* Because cleanup delete and/or modify bus and wires, the more easy is to put
|
* Because cleanup delete and/or modify bus and wires, the more easy is to put
|
||||||
* all wires in undo list and use a new copy of wires for cleanup.
|
* all wires in undo list and use a new copy of wires for cleanup.
|
||||||
*/
|
*/
|
||||||
|
SCH_ITEM* SCH_SCREEN::ExtractWires( bool CreateCopy )
|
||||||
|
{
|
||||||
SCH_ITEM* item, * next_item, * new_item, * List = NULL;
|
SCH_ITEM* item, * next_item, * new_item, * List = NULL;
|
||||||
|
|
||||||
for( item = EEDrawList; item != NULL; item = next_item )
|
for( item = EEDrawList; item != NULL; item = next_item )
|
||||||
|
@ -59,9 +57,9 @@ SCH_ITEM* SCH_SCREEN::ExtractWires( bool CreateCopy )
|
||||||
if( CreateCopy )
|
if( CreateCopy )
|
||||||
{
|
{
|
||||||
if( item->Type() == DRAW_JUNCTION_STRUCT_TYPE )
|
if( item->Type() == DRAW_JUNCTION_STRUCT_TYPE )
|
||||||
new_item = ( (DrawJunctionStruct*) item )->GenCopy();
|
new_item = ( (SCH_JUNCTION*) item )->GenCopy();
|
||||||
else
|
else
|
||||||
new_item = ( (EDA_DrawLineStruct*) item )->GenCopy();
|
new_item = ( (SCH_LINE*) item )->GenCopy();
|
||||||
new_item->SetNext( EEDrawList );
|
new_item->SetNext( EEDrawList );
|
||||||
EEDrawList = new_item;
|
EEDrawList = new_item;
|
||||||
}
|
}
|
||||||
|
@ -76,12 +74,10 @@ SCH_ITEM* SCH_SCREEN::ExtractWires( bool CreateCopy )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*************************************************/
|
|
||||||
static void RestoreOldWires( SCH_SCREEN* screen )
|
|
||||||
{
|
|
||||||
/*************************************************/
|
|
||||||
/* Replace the wires in screen->EEDrawList by s_OldWiresList wires.
|
/* Replace the wires in screen->EEDrawList by s_OldWiresList wires.
|
||||||
*/
|
*/
|
||||||
|
static void RestoreOldWires( SCH_SCREEN* screen )
|
||||||
|
{
|
||||||
SCH_ITEM* item;
|
SCH_ITEM* item;
|
||||||
SCH_ITEM* next_item;
|
SCH_ITEM* next_item;
|
||||||
|
|
||||||
|
@ -113,10 +109,6 @@ static void RestoreOldWires( SCH_SCREEN* screen )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************/
|
|
||||||
void WinEDA_SchematicFrame::BeginSegment( wxDC* DC, int type )
|
|
||||||
{
|
|
||||||
/*************************************************************/
|
|
||||||
/* Creates a new segment ( WIRE, BUS ),
|
/* Creates a new segment ( WIRE, BUS ),
|
||||||
* or terminates the current segment
|
* or terminates the current segment
|
||||||
* If the end of the current segment is on an other segment, place a junction
|
* If the end of the current segment is on an other segment, place a junction
|
||||||
|
@ -124,8 +116,10 @@ void WinEDA_SchematicFrame::BeginSegment( wxDC* DC, int type )
|
||||||
* If the end of the current segment is on a pin, terminates the command
|
* If the end of the current segment is on a pin, terminates the command
|
||||||
* In others cases starts a new segment
|
* In others cases starts a new segment
|
||||||
*/
|
*/
|
||||||
EDA_DrawLineStruct* oldsegment, * newsegment, * nextsegment;
|
void WinEDA_SchematicFrame::BeginSegment( wxDC* DC, int type )
|
||||||
wxPoint cursorpos = GetScreen()->m_Curseur;
|
{
|
||||||
|
SCH_LINE* oldsegment, * newsegment, * nextsegment;
|
||||||
|
wxPoint cursorpos = GetScreen()->m_Curseur;
|
||||||
|
|
||||||
if( GetScreen()->GetCurItem() && (GetScreen()->GetCurItem()->m_Flags == 0) )
|
if( GetScreen()->GetCurItem() && (GetScreen()->GetCurItem()->m_Flags == 0) )
|
||||||
GetScreen()->SetCurItem( NULL );
|
GetScreen()->SetCurItem( NULL );
|
||||||
|
@ -143,8 +137,7 @@ void WinEDA_SchematicFrame::BeginSegment( wxDC* DC, int type )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
oldsegment = newsegment =
|
oldsegment = newsegment = (SCH_LINE*) GetScreen()->GetCurItem();
|
||||||
(EDA_DrawLineStruct*) GetScreen()->GetCurItem();
|
|
||||||
|
|
||||||
if( !newsegment ) /* first point : Create first wire or bus */
|
if( !newsegment ) /* first point : Create first wire or bus */
|
||||||
{
|
{
|
||||||
|
@ -155,18 +148,18 @@ void WinEDA_SchematicFrame::BeginSegment( wxDC* DC, int type )
|
||||||
switch( type )
|
switch( type )
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
newsegment = new EDA_DrawLineStruct( cursorpos, LAYER_NOTES );
|
newsegment = new SCH_LINE( cursorpos, LAYER_NOTES );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LAYER_WIRE:
|
case LAYER_WIRE:
|
||||||
newsegment = new EDA_DrawLineStruct( cursorpos, LAYER_WIRE );
|
newsegment = new SCH_LINE( cursorpos, LAYER_WIRE );
|
||||||
|
|
||||||
/* A junction will be created later, when we'll know the
|
/* A junction will be created later, when we'll know the
|
||||||
* segment end position, and if the junction is really needed */
|
* segment end position, and if the junction is really needed */
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LAYER_BUS:
|
case LAYER_BUS:
|
||||||
newsegment = new EDA_DrawLineStruct( cursorpos, LAYER_BUS );
|
newsegment = new SCH_LINE( cursorpos, LAYER_BUS );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -251,30 +244,27 @@ void WinEDA_SchematicFrame::BeginSegment( wxDC* DC, int type )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************/
|
|
||||||
void WinEDA_SchematicFrame::EndSegment( wxDC* DC )
|
|
||||||
{
|
|
||||||
/***********************************************/
|
|
||||||
/* Called to terminate a bus, wire, or line creation
|
/* Called to terminate a bus, wire, or line creation
|
||||||
*/
|
*/
|
||||||
EDA_DrawLineStruct* firstsegment =
|
void WinEDA_SchematicFrame::EndSegment( wxDC* DC )
|
||||||
(EDA_DrawLineStruct*) GetScreen()->GetCurItem();
|
{
|
||||||
EDA_DrawLineStruct* lastsegment = firstsegment;
|
SCH_LINE* firstsegment = (SCH_LINE*) GetScreen()->GetCurItem();
|
||||||
EDA_DrawLineStruct* segment;
|
SCH_LINE* lastsegment = firstsegment;
|
||||||
|
SCH_LINE* segment;
|
||||||
|
|
||||||
if( firstsegment == NULL )
|
if( firstsegment == NULL )
|
||||||
return;
|
return;
|
||||||
if( (firstsegment->m_Flags & IS_NEW) == 0 )
|
if( ( firstsegment->m_Flags & IS_NEW ) == 0 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* Delete Null segments and Put line it in Drawlist */
|
/* Delete Null segments and Put line it in Drawlist */
|
||||||
lastsegment = firstsegment;
|
lastsegment = firstsegment;
|
||||||
while( lastsegment )
|
while( lastsegment )
|
||||||
{
|
{
|
||||||
EDA_DrawLineStruct* nextsegment = lastsegment->Next();
|
SCH_LINE* nextsegment = lastsegment->Next();
|
||||||
if( lastsegment->IsNull() )
|
if( lastsegment->IsNull() )
|
||||||
{
|
{
|
||||||
EDA_DrawLineStruct* previous_segment = lastsegment->Back();
|
SCH_LINE* previous_segment = lastsegment->Back();
|
||||||
if( firstsegment == lastsegment )
|
if( firstsegment == lastsegment )
|
||||||
firstsegment = nextsegment;
|
firstsegment = nextsegment;
|
||||||
if( nextsegment )
|
if( nextsegment )
|
||||||
|
@ -316,7 +306,7 @@ void WinEDA_SchematicFrame::EndSegment( wxDC* DC )
|
||||||
( (SCH_SCREEN*) GetScreen() )->SchematicCleanUp( NULL );
|
( (SCH_SCREEN*) GetScreen() )->SchematicCleanUp( NULL );
|
||||||
|
|
||||||
/* clear flags and find last segment entered, for repeat function */
|
/* clear flags and find last segment entered, for repeat function */
|
||||||
segment = (EDA_DrawLineStruct*) GetScreen()->EEDrawList;
|
segment = (SCH_LINE*) GetScreen()->EEDrawList;
|
||||||
while( segment )
|
while( segment )
|
||||||
{
|
{
|
||||||
if( segment->m_Flags )
|
if( segment->m_Flags )
|
||||||
|
@ -375,17 +365,14 @@ void WinEDA_SchematicFrame::EndSegment( wxDC* DC )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************/
|
/* Redraw the segment (g_HVLines == FALSE ) or the two segments (g_HVLines ==
|
||||||
static void Segment_in_Ghost( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
|
|
||||||
{
|
|
||||||
/****************************************************************************/
|
|
||||||
/* Redraw the segment (g_HVLines == FALSE ) or the two segments (g_HVLines ==
|
|
||||||
* TRUE )
|
* TRUE )
|
||||||
* from the start point to the cursor, when moving the mouse
|
* from the start point to the cursor, when moving the mouse
|
||||||
*/
|
*/
|
||||||
EDA_DrawLineStruct* CurrentLine =
|
static void Segment_in_Ghost( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
|
||||||
(EDA_DrawLineStruct*) panel->GetScreen()->GetCurItem();
|
{
|
||||||
EDA_DrawLineStruct* segment;
|
SCH_LINE* CurrentLine = (SCH_LINE*) panel->GetScreen()->GetCurItem();
|
||||||
|
SCH_LINE* segment;
|
||||||
int color;
|
int color;
|
||||||
|
|
||||||
if( CurrentLine == NULL )
|
if( CurrentLine == NULL )
|
||||||
|
@ -422,23 +409,20 @@ static void Segment_in_Ghost( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************/
|
|
||||||
static void ComputeBreakPoint( EDA_DrawLineStruct* segment,
|
|
||||||
const wxPoint& new_pos )
|
|
||||||
{
|
|
||||||
/***************************************************************************/
|
|
||||||
/* compute the middle coordinate for 2 segments, from the start point to
|
/* compute the middle coordinate for 2 segments, from the start point to
|
||||||
* new_pos
|
* new_pos
|
||||||
* with the 2 segments kept H or V only
|
* with the 2 segments kept H or V only
|
||||||
*/
|
*/
|
||||||
EDA_DrawLineStruct* nextsegment = segment->Next();
|
static void ComputeBreakPoint( SCH_LINE* segment, const wxPoint& new_pos )
|
||||||
wxPoint middle_position = new_pos;
|
{
|
||||||
|
SCH_LINE* nextsegment = segment->Next();
|
||||||
|
wxPoint middle_position = new_pos;
|
||||||
|
|
||||||
if( nextsegment == NULL )
|
if( nextsegment == NULL )
|
||||||
return;
|
return;
|
||||||
#if 0
|
#if 0
|
||||||
if( ABS( middle_position.x - segment->m_Start.x ) <
|
if( ABS( middle_position.x - segment->m_Start.x ) <
|
||||||
ABS( middle_position.y - segment->m_Start.y ) )
|
ABS( middle_position.y - segment->m_Start.y ) )
|
||||||
middle_position.x = segment->m_Start.x;
|
middle_position.x = segment->m_Start.x;
|
||||||
else
|
else
|
||||||
middle_position.y = segment->m_Start.y;
|
middle_position.y = segment->m_Start.y;
|
||||||
|
@ -458,7 +442,7 @@ static void ComputeBreakPoint( EDA_DrawLineStruct* segment,
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if( ABS( middle_position.x - segment->m_Start.x ) <
|
if( ABS( middle_position.x - segment->m_Start.x ) <
|
||||||
ABS( middle_position.y - segment->m_Start.y ) )
|
ABS( middle_position.y - segment->m_Start.y ) )
|
||||||
middle_position.x = segment->m_Start.x;
|
middle_position.x = segment->m_Start.x;
|
||||||
else
|
else
|
||||||
middle_position.y = segment->m_Start.y;
|
middle_position.y = segment->m_Start.y;
|
||||||
|
@ -472,18 +456,15 @@ static void ComputeBreakPoint( EDA_DrawLineStruct* segment,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/* Drawing Polyline phantom at the displacement of the cursor
|
||||||
|
*/
|
||||||
static void Show_Polyline_in_Ghost( WinEDA_DrawPanel* panel,
|
static void Show_Polyline_in_Ghost( WinEDA_DrawPanel* panel,
|
||||||
wxDC* DC,
|
wxDC* DC,
|
||||||
bool erase )
|
bool erase )
|
||||||
{
|
{
|
||||||
/*****************************************************************************/
|
SCH_POLYLINE* NewPoly = (SCH_POLYLINE*) panel->GetScreen()->GetCurItem();
|
||||||
/* Drawing Polyline phantom at the displacement of the cursor
|
int color;
|
||||||
*/
|
wxPoint endpos;
|
||||||
DrawPolylineStruct* NewPoly =
|
|
||||||
(DrawPolylineStruct*) panel->GetScreen()->GetCurItem();
|
|
||||||
int color;
|
|
||||||
wxPoint endpos;
|
|
||||||
|
|
||||||
endpos = panel->GetScreen()->m_Curseur;
|
endpos = panel->GetScreen()->m_Curseur;
|
||||||
color = ReturnLayerColor( NewPoly->GetLayer() );
|
color = ReturnLayerColor( NewPoly->GetLayer() );
|
||||||
|
@ -509,17 +490,15 @@ static void Show_Polyline_in_Ghost( WinEDA_DrawPanel* panel,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**********************************************************/
|
|
||||||
void WinEDA_SchematicFrame::DeleteCurrentSegment( wxDC* DC )
|
|
||||||
{
|
|
||||||
/**********************************************************/
|
|
||||||
/*
|
/*
|
||||||
* Erase the last trace or the element at the current mouse position.
|
* Erase the last trace or the element at the current mouse position.
|
||||||
*/
|
*/
|
||||||
|
void WinEDA_SchematicFrame::DeleteCurrentSegment( wxDC* DC )
|
||||||
|
{
|
||||||
g_ItemToRepeat = NULL;
|
g_ItemToRepeat = NULL;
|
||||||
|
|
||||||
if( (GetScreen()->GetCurItem() == NULL)
|
if( ( GetScreen()->GetCurItem() == NULL )
|
||||||
|| ( (GetScreen()->GetCurItem()->m_Flags & IS_NEW) == 0 ) )
|
|| ( ( GetScreen()->GetCurItem()->m_Flags & IS_NEW ) == 0 ) )
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -541,16 +520,14 @@ void WinEDA_SchematicFrame::DeleteCurrentSegment( wxDC* DC )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************/
|
|
||||||
DrawJunctionStruct* WinEDA_SchematicFrame::CreateNewJunctionStruct(
|
|
||||||
wxDC* DC, const wxPoint& pos, bool PutInUndoList )
|
|
||||||
{
|
|
||||||
/***************************************************************************/
|
|
||||||
/* Routine to create new connection struct.
|
/* Routine to create new connection struct.
|
||||||
*/
|
*/
|
||||||
DrawJunctionStruct* NewJunction;
|
SCH_JUNCTION* WinEDA_SchematicFrame::CreateNewJunctionStruct(
|
||||||
|
wxDC* DC, const wxPoint& pos, bool PutInUndoList )
|
||||||
|
{
|
||||||
|
SCH_JUNCTION* NewJunction;
|
||||||
|
|
||||||
NewJunction = new DrawJunctionStruct( pos );
|
NewJunction = new SCH_JUNCTION( pos );
|
||||||
|
|
||||||
g_ItemToRepeat = NewJunction;
|
g_ItemToRepeat = NewJunction;
|
||||||
|
|
||||||
|
@ -567,14 +544,12 @@ DrawJunctionStruct* WinEDA_SchematicFrame::CreateNewJunctionStruct(
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************/
|
|
||||||
DrawNoConnectStruct* WinEDA_SchematicFrame::CreateNewNoConnectStruct( wxDC* DC )
|
|
||||||
{
|
|
||||||
/*******************************************************************************/
|
|
||||||
/* Routine to create new NoConnect struct. */
|
/* Routine to create new NoConnect struct. */
|
||||||
DrawNoConnectStruct* NewNoConnect;
|
SCH_NO_CONNECT* WinEDA_SchematicFrame::CreateNewNoConnectStruct( wxDC* DC )
|
||||||
|
{
|
||||||
|
SCH_NO_CONNECT* NewNoConnect;
|
||||||
|
|
||||||
NewNoConnect = new DrawNoConnectStruct( GetScreen()->m_Curseur );
|
NewNoConnect = new SCH_NO_CONNECT( GetScreen()->m_Curseur );
|
||||||
g_ItemToRepeat = NewNoConnect;
|
g_ItemToRepeat = NewNoConnect;
|
||||||
|
|
||||||
DrawPanel->CursorOff( DC ); // Erase schematic cursor
|
DrawPanel->CursorOff( DC ); // Erase schematic cursor
|
||||||
|
@ -589,12 +564,10 @@ DrawNoConnectStruct* WinEDA_SchematicFrame::CreateNewNoConnectStruct( wxDC* DC )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************/
|
|
||||||
static void AbortCreateNewLine( WinEDA_DrawPanel* Panel, wxDC* DC )
|
|
||||||
{
|
|
||||||
/*****************************************************************/
|
|
||||||
/* Abort function for wire, bus or line creation
|
/* Abort function for wire, bus or line creation
|
||||||
*/
|
*/
|
||||||
|
static void AbortCreateNewLine( WinEDA_DrawPanel* Panel, wxDC* DC )
|
||||||
|
{
|
||||||
SCH_SCREEN* Screen = (SCH_SCREEN*) Panel->GetScreen();
|
SCH_SCREEN* Screen = (SCH_SCREEN*) Panel->GetScreen();
|
||||||
|
|
||||||
if( Screen->GetCurItem() )
|
if( Screen->GetCurItem() )
|
||||||
|
@ -619,14 +592,12 @@ static void AbortCreateNewLine( WinEDA_DrawPanel* Panel, wxDC* DC )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***************************************************/
|
|
||||||
void WinEDA_SchematicFrame::RepeatDrawItem( wxDC* DC )
|
|
||||||
{
|
|
||||||
/***************************************************/
|
|
||||||
/* Repeat the last item placement.
|
/* Repeat the last item placement.
|
||||||
* Bus lines, text, labels
|
* Bus lines, text, labels
|
||||||
* Labels that end with a number will be incremented.
|
* Labels that end with a number will be incremented.
|
||||||
*/
|
*/
|
||||||
|
void WinEDA_SchematicFrame::RepeatDrawItem( wxDC* DC )
|
||||||
|
{
|
||||||
wxPoint new_pos;
|
wxPoint new_pos;
|
||||||
|
|
||||||
if( g_ItemToRepeat == NULL )
|
if( g_ItemToRepeat == NULL )
|
||||||
|
@ -636,7 +607,7 @@ void WinEDA_SchematicFrame::RepeatDrawItem( wxDC* DC )
|
||||||
{
|
{
|
||||||
case DRAW_JUNCTION_STRUCT_TYPE:
|
case DRAW_JUNCTION_STRUCT_TYPE:
|
||||||
#undef STRUCT
|
#undef STRUCT
|
||||||
#define STRUCT ( (DrawJunctionStruct*) g_ItemToRepeat )
|
#define STRUCT ( (SCH_JUNCTION*) g_ItemToRepeat )
|
||||||
g_ItemToRepeat = STRUCT->GenCopy();
|
g_ItemToRepeat = STRUCT->GenCopy();
|
||||||
STRUCT->m_Pos += g_RepeatStep;
|
STRUCT->m_Pos += g_RepeatStep;
|
||||||
new_pos = STRUCT->m_Pos;
|
new_pos = STRUCT->m_Pos;
|
||||||
|
@ -644,7 +615,7 @@ void WinEDA_SchematicFrame::RepeatDrawItem( wxDC* DC )
|
||||||
|
|
||||||
case DRAW_NOCONNECT_STRUCT_TYPE:
|
case DRAW_NOCONNECT_STRUCT_TYPE:
|
||||||
#undef STRUCT
|
#undef STRUCT
|
||||||
#define STRUCT ( (DrawNoConnectStruct*) g_ItemToRepeat )
|
#define STRUCT ( (SCH_NO_CONNECT*) g_ItemToRepeat )
|
||||||
g_ItemToRepeat = STRUCT->GenCopy();
|
g_ItemToRepeat = STRUCT->GenCopy();
|
||||||
STRUCT->m_Pos += g_RepeatStep;
|
STRUCT->m_Pos += g_RepeatStep;
|
||||||
new_pos = STRUCT->m_Pos;
|
new_pos = STRUCT->m_Pos;
|
||||||
|
@ -690,7 +661,7 @@ void WinEDA_SchematicFrame::RepeatDrawItem( wxDC* DC )
|
||||||
|
|
||||||
case DRAW_SEGMENT_STRUCT_TYPE:
|
case DRAW_SEGMENT_STRUCT_TYPE:
|
||||||
#undef STRUCT
|
#undef STRUCT
|
||||||
#define STRUCT ( (EDA_DrawLineStruct*) g_ItemToRepeat )
|
#define STRUCT ( (SCH_LINE*) g_ItemToRepeat )
|
||||||
g_ItemToRepeat = STRUCT->GenCopy();
|
g_ItemToRepeat = STRUCT->GenCopy();
|
||||||
STRUCT->m_Start += g_RepeatStep;
|
STRUCT->m_Start += g_RepeatStep;
|
||||||
new_pos = STRUCT->m_Start;
|
new_pos = STRUCT->m_Start;
|
||||||
|
@ -699,7 +670,7 @@ void WinEDA_SchematicFrame::RepeatDrawItem( wxDC* DC )
|
||||||
|
|
||||||
case DRAW_BUSENTRY_STRUCT_TYPE:
|
case DRAW_BUSENTRY_STRUCT_TYPE:
|
||||||
#undef STRUCT
|
#undef STRUCT
|
||||||
#define STRUCT ( (DrawBusEntryStruct*) g_ItemToRepeat )
|
#define STRUCT ( (SCH_BUS_ENTRY*) g_ItemToRepeat )
|
||||||
g_ItemToRepeat = STRUCT->GenCopy();
|
g_ItemToRepeat = STRUCT->GenCopy();
|
||||||
STRUCT->m_Pos += g_RepeatStep;
|
STRUCT->m_Pos += g_RepeatStep;
|
||||||
new_pos = STRUCT->m_Pos;
|
new_pos = STRUCT->m_Pos;
|
||||||
|
@ -749,13 +720,11 @@ void WinEDA_SchematicFrame::RepeatDrawItem( wxDC* DC )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/******************************************/
|
|
||||||
void IncrementLabelMember( wxString& name )
|
|
||||||
{
|
|
||||||
/******************************************/
|
|
||||||
/* Routine incrementing labels, ie for the text ending with a number, adding
|
/* Routine incrementing labels, ie for the text ending with a number, adding
|
||||||
* that a number <RepeatDeltaLabel>
|
* that a number <RepeatDeltaLabel>
|
||||||
*/
|
*/
|
||||||
|
void IncrementLabelMember( wxString& name )
|
||||||
|
{
|
||||||
int ii, nn;
|
int ii, nn;
|
||||||
long number = 0;
|
long number = 0;
|
||||||
|
|
||||||
|
@ -778,10 +747,6 @@ void IncrementLabelMember( wxString& name )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************/
|
|
||||||
static bool IsTerminalPoint( SCH_SCREEN* screen, const wxPoint& pos, int layer )
|
|
||||||
{
|
|
||||||
/***************************************************************************/
|
|
||||||
/* Return TRUE if pos can be a terminal point for a wire or a bus
|
/* Return TRUE if pos can be a terminal point for a wire or a bus
|
||||||
* i.e. :
|
* i.e. :
|
||||||
* for a WIRE, if at pos is found:
|
* for a WIRE, if at pos is found:
|
||||||
|
@ -792,6 +757,8 @@ static bool IsTerminalPoint( SCH_SCREEN* screen, const wxPoint& pos, int layer )
|
||||||
* - for a BUS, if at pos is found:
|
* - for a BUS, if at pos is found:
|
||||||
* - a BUS
|
* - a BUS
|
||||||
*/
|
*/
|
||||||
|
static bool IsTerminalPoint( SCH_SCREEN* screen, const wxPoint& pos, int layer )
|
||||||
|
{
|
||||||
EDA_BaseStruct* item;
|
EDA_BaseStruct* item;
|
||||||
LIB_PIN* pin;
|
LIB_PIN* pin;
|
||||||
SCH_COMPONENT* LibItem = NULL;
|
SCH_COMPONENT* LibItem = NULL;
|
||||||
|
@ -832,7 +799,7 @@ static bool IsTerminalPoint( SCH_SCREEN* screen, const wxPoint& pos, int layer )
|
||||||
itempos = LibItem->GetScreenCoord( pin->m_Pos );
|
itempos = LibItem->GetScreenCoord( pin->m_Pos );
|
||||||
itempos.x += LibItem->m_Pos.x;
|
itempos.x += LibItem->m_Pos.x;
|
||||||
itempos.y += LibItem->m_Pos.y;
|
itempos.y += LibItem->m_Pos.y;
|
||||||
if( (itempos.x == pos.x) && (itempos.y == pos.y) )
|
if( ( itempos.x == pos.x ) && ( itempos.y == pos.y ) )
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -850,7 +817,7 @@ static bool IsTerminalPoint( SCH_SCREEN* screen, const wxPoint& pos, int layer )
|
||||||
if( pinsheet && !IsBusLabel( pinsheet->m_Text ) )
|
if( pinsheet && !IsBusLabel( pinsheet->m_Text ) )
|
||||||
{
|
{
|
||||||
itempos = pinsheet->m_Pos;
|
itempos = pinsheet->m_Pos;
|
||||||
if( (itempos.x == pos.x) && (itempos.y == pos.y) )
|
if( ( itempos.x == pos.x ) && ( itempos.y == pos.y ) )
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -864,10 +831,6 @@ static bool IsTerminalPoint( SCH_SCREEN* screen, const wxPoint& pos, int layer )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************/
|
|
||||||
bool IsJunctionNeeded( WinEDA_SchematicFrame* frame, wxPoint& pos )
|
|
||||||
{
|
|
||||||
/****************************************************************/
|
|
||||||
/* Return True when a wire is located at pos "pos" if
|
/* Return True when a wire is located at pos "pos" if
|
||||||
* - there is no junction.
|
* - there is no junction.
|
||||||
* - The wire has no ends at pos "pos",
|
* - The wire has no ends at pos "pos",
|
||||||
|
@ -876,6 +839,8 @@ bool IsJunctionNeeded( WinEDA_SchematicFrame* frame, wxPoint& pos )
|
||||||
* or
|
* or
|
||||||
* - a pin is on location pos
|
* - a pin is on location pos
|
||||||
*/
|
*/
|
||||||
|
bool IsJunctionNeeded( WinEDA_SchematicFrame* frame, wxPoint& pos )
|
||||||
|
{
|
||||||
if( PickStruct( pos, frame->GetScreen(), JUNCTIONITEM ) )
|
if( PickStruct( pos, frame->GetScreen(), JUNCTIONITEM ) )
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
|
|
@ -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 )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/************************************************************************/
|
|
||||||
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();
|
SCH_BUS_ENTRY* BusEntry = (SCH_BUS_ENTRY*) screen->GetCurItem();
|
||||||
DrawBusEntryStruct* BusEntry = (DrawBusEntryStruct*) screen->GetCurItem();
|
|
||||||
|
|
||||||
if( BusEntry == NULL )
|
if( BusEntry == NULL )
|
||||||
return;
|
return;
|
||||||
|
@ -67,17 +64,14 @@ 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)
|
*/
|
||||||
*/
|
SCH_BUS_ENTRY* BusEntry = new SCH_BUS_ENTRY( GetScreen()->m_Curseur,
|
||||||
DrawBusEntryStruct* BusEntry = new DrawBusEntryStruct(
|
s_LastShape,
|
||||||
GetScreen()->m_Curseur,
|
entry_type );
|
||||||
s_LastShape,
|
|
||||||
entry_type );
|
|
||||||
|
|
||||||
BusEntry->m_Flags = IS_NEW;
|
BusEntry->m_Flags = IS_NEW;
|
||||||
|
|
||||||
|
@ -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,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/************************************************************/
|
|
||||||
void WinEDA_SchematicFrame::SetBusEntryShape( wxDC* DC,
|
|
||||||
DrawBusEntryStruct* BusEntry,
|
|
||||||
int entry_shape )
|
|
||||||
{
|
|
||||||
/************************************************************/
|
|
||||||
/* set the shape of BusEntry (shape = / or \ )
|
/* set the shape of BusEntry (shape = / or \ )
|
||||||
*/
|
*/
|
||||||
|
void WinEDA_SchematicFrame::SetBusEntryShape( wxDC* DC,
|
||||||
|
SCH_BUS_ENTRY* BusEntry,
|
||||||
|
int entry_shape )
|
||||||
|
{
|
||||||
if( BusEntry == NULL )
|
if( BusEntry == NULL )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -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 )
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
// Name: class_drawsheet.cpp
|
// Name: class_drawsheet.cpp
|
||||||
// Purpose: member functions for SCH_SHEET
|
// Purpose: member functions for SCH_SHEET
|
||||||
// header = class_drawsheet.h
|
// header = class_drawsheet.h
|
||||||
|
@ -23,11 +22,9 @@
|
||||||
#include "protos.h"
|
#include "protos.h"
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************/
|
|
||||||
SCH_SHEET::SCH_SHEET( const wxPoint& pos ) :
|
SCH_SHEET::SCH_SHEET( const wxPoint& pos ) :
|
||||||
SCH_ITEM( NULL, DRAW_SHEET_STRUCT_TYPE )
|
SCH_ITEM( NULL, DRAW_SHEET_STRUCT_TYPE )
|
||||||
{
|
{
|
||||||
/***********************************************************/
|
|
||||||
m_Label = NULL;
|
m_Label = NULL;
|
||||||
m_NbLabel = 0;
|
m_NbLabel = 0;
|
||||||
m_Layer = LAYER_SHEET;
|
m_Layer = LAYER_SHEET;
|
||||||
|
@ -40,10 +37,8 @@ SCH_SHEET::SCH_SHEET( const wxPoint& pos ) :
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**************************************/
|
|
||||||
SCH_SHEET::~SCH_SHEET()
|
SCH_SHEET::~SCH_SHEET()
|
||||||
{
|
{
|
||||||
/**************************************/
|
|
||||||
SCH_SHEET_PIN* label = m_Label, * next_label;
|
SCH_SHEET_PIN* label = m_Label, * next_label;
|
||||||
|
|
||||||
while( label )
|
while( label )
|
||||||
|
@ -53,8 +48,8 @@ SCH_SHEET::~SCH_SHEET()
|
||||||
label = next_label;
|
label = next_label;
|
||||||
}
|
}
|
||||||
|
|
||||||
//also, look at the associated sheet & its reference count
|
// also, look at the associated sheet & its reference count
|
||||||
//perhaps it should be deleted also.
|
// perhaps it should be deleted also.
|
||||||
if( m_AssociatedScreen )
|
if( m_AssociatedScreen )
|
||||||
{
|
{
|
||||||
m_AssociatedScreen->m_RefCount--;
|
m_AssociatedScreen->m_RefCount--;
|
||||||
|
@ -64,51 +59,37 @@ SCH_SHEET::~SCH_SHEET()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**********************************************/
|
|
||||||
bool SCH_SHEET::Save( FILE* aFile ) const
|
|
||||||
/***********************************************/
|
|
||||||
/** Function Save
|
/** Function Save
|
||||||
* writes the data structures for this object out to a FILE in "*.brd" format.
|
* writes the data structures for this object out to a FILE in "*.brd" 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.
|
||||||
*/
|
*/
|
||||||
|
bool SCH_SHEET::Save( FILE* aFile ) const
|
||||||
{
|
{
|
||||||
bool Success = true;
|
|
||||||
SCH_SHEET_PIN* SheetLabel;
|
SCH_SHEET_PIN* SheetLabel;
|
||||||
|
|
||||||
fprintf( aFile, "$Sheet\n" );
|
if( fprintf( aFile, "$Sheet\n" ) == EOF
|
||||||
|
|| fprintf( aFile, "S %-4d %-4d %-4d %-4d\n",
|
||||||
if( fprintf( aFile, "S %-4d %-4d %-4d %-4d\n",
|
m_Pos.x, m_Pos.y, m_Size.x, m_Size.y ) == EOF )
|
||||||
m_Pos.x, m_Pos.y,
|
return false;
|
||||||
m_Size.x, m_Size.y ) == EOF )
|
|
||||||
{
|
|
||||||
Success = false;
|
|
||||||
return Success;
|
|
||||||
}
|
|
||||||
|
|
||||||
//save the unique timestamp, like other schematic parts.
|
//save the unique timestamp, like other schematic parts.
|
||||||
if( fprintf( aFile, "U %8.8lX\n", m_TimeStamp ) == EOF )
|
if( fprintf( aFile, "U %8.8lX\n", m_TimeStamp ) == EOF )
|
||||||
{
|
return false;
|
||||||
Success = false; return Success;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Save schematic sheetname and filename. */
|
/* Save schematic sheetname and filename. */
|
||||||
if( !m_SheetName.IsEmpty() )
|
if( !m_SheetName.IsEmpty() )
|
||||||
{
|
{
|
||||||
if( fprintf( aFile, "F0 \"%s\" %d\n", CONV_TO_UTF8( m_SheetName ),
|
if( fprintf( aFile, "F0 \"%s\" %d\n", CONV_TO_UTF8( m_SheetName ),
|
||||||
m_SheetNameSize ) == EOF )
|
m_SheetNameSize ) == EOF )
|
||||||
{
|
return false;
|
||||||
Success = false; return Success;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !m_FileName.IsEmpty() )
|
if( !m_FileName.IsEmpty() )
|
||||||
{
|
{
|
||||||
if( fprintf( aFile, "F1 \"%s\" %d\n", CONV_TO_UTF8( m_FileName ),
|
if( fprintf( aFile, "F1 \"%s\" %d\n", CONV_TO_UTF8( m_FileName ),
|
||||||
m_FileNameSize ) == EOF )
|
m_FileNameSize ) == EOF )
|
||||||
{
|
return false;
|
||||||
Success = false; return Success;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Create the list of labels in the sheet. */
|
/* Create the list of labels in the sheet. */
|
||||||
|
@ -122,18 +103,18 @@ bool SCH_SHEET::Save( FILE* aFile ) const
|
||||||
SheetLabel = SheetLabel->Next();
|
SheetLabel = SheetLabel->Next();
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf( aFile, "$EndSheet\n" );
|
if( fprintf( aFile, "$EndSheet\n" ) == EOF )
|
||||||
return Success;
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************/
|
|
||||||
SCH_SHEET* SCH_SHEET::GenCopy()
|
|
||||||
{
|
|
||||||
/***********************************************/
|
|
||||||
/* creates a copy of a sheet
|
/* creates a copy of a sheet
|
||||||
* The linked data itself (EEDrawList) is not duplicated
|
* The linked data itself (EEDrawList) is not duplicated
|
||||||
*/
|
*/
|
||||||
|
SCH_SHEET* SCH_SHEET::GenCopy()
|
||||||
|
{
|
||||||
SCH_SHEET* newitem = new SCH_SHEET( m_Pos );
|
SCH_SHEET* newitem = new SCH_SHEET( m_Pos );
|
||||||
|
|
||||||
|
|
||||||
|
@ -179,13 +160,11 @@ SCH_SHEET* SCH_SHEET::GenCopy()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**********************************************************/
|
|
||||||
void SCH_SHEET::SwapData( SCH_SHEET* copyitem )
|
|
||||||
{
|
|
||||||
/**********************************************************/
|
|
||||||
/* Used if undo / redo command:
|
/* Used if undo / redo command:
|
||||||
* swap data between this and copyitem
|
* swap data between this and copyitem
|
||||||
*/
|
*/
|
||||||
|
void SCH_SHEET::SwapData( SCH_SHEET* copyitem )
|
||||||
|
{
|
||||||
EXCHG( m_Pos, copyitem->m_Pos );
|
EXCHG( m_Pos, copyitem->m_Pos );
|
||||||
EXCHG( m_Size, copyitem->m_Size );
|
EXCHG( m_Size, copyitem->m_Size );
|
||||||
EXCHG( m_SheetName, copyitem->m_SheetName );
|
EXCHG( m_SheetName, copyitem->m_SheetName );
|
||||||
|
@ -194,7 +173,7 @@ void SCH_SHEET::SwapData( SCH_SHEET* copyitem )
|
||||||
EXCHG( m_Label, copyitem->m_Label );
|
EXCHG( m_Label, copyitem->m_Label );
|
||||||
EXCHG( m_NbLabel, copyitem->m_NbLabel );
|
EXCHG( m_NbLabel, copyitem->m_NbLabel );
|
||||||
|
|
||||||
// Ensure sheet labels have their .m_Parent member poiuntin really on their
|
// Ensure sheet labels have their .m_Parent member pointing really on their
|
||||||
// parent, after swapping.
|
// parent, after swapping.
|
||||||
SCH_SHEET_PIN* label = m_Label;
|
SCH_SHEET_PIN* label = m_Label;
|
||||||
while( label )
|
while( label )
|
||||||
|
@ -212,12 +191,10 @@ void SCH_SHEET::SwapData( SCH_SHEET* copyitem )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/********************************************************************/
|
|
||||||
void SCH_SHEET::Place( WinEDA_SchematicFrame* frame, wxDC* DC )
|
void SCH_SHEET::Place( WinEDA_SchematicFrame* frame, wxDC* DC )
|
||||||
{
|
{
|
||||||
/********************************************************************/
|
|
||||||
/* Place list structures for new sheet. */
|
/* Place list structures for new sheet. */
|
||||||
bool isnew = (m_Flags & IS_NEW) ? true : false;
|
bool isnew = ( m_Flags & IS_NEW ) ? true : false;
|
||||||
|
|
||||||
if( isnew )
|
if( isnew )
|
||||||
{
|
{
|
||||||
|
@ -240,16 +217,14 @@ void SCH_SHEET::Place( WinEDA_SchematicFrame* frame, wxDC* DC )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/********************************************************************/
|
|
||||||
void SCH_SHEET::CleanupSheet( WinEDA_SchematicFrame* aFrame,
|
|
||||||
bool aRedraw )
|
|
||||||
{
|
|
||||||
/********************************************************************/
|
|
||||||
/** Function CleanupSheet
|
/** Function CleanupSheet
|
||||||
* Delete pinsheets which are not corresponding to a hierarchical label
|
* Delete pinsheets which are not corresponding to a hierarchical label
|
||||||
* @param aRedraw = true to redraw Sheet
|
* @param aRedraw = true to redraw Sheet
|
||||||
* @param aFrame = the schematic frame
|
* @param aFrame = the schematic frame
|
||||||
*/
|
*/
|
||||||
|
void SCH_SHEET::CleanupSheet( WinEDA_SchematicFrame* aFrame,
|
||||||
|
bool aRedraw )
|
||||||
|
{
|
||||||
SCH_SHEET_PIN* Pinsheet, * NextPinsheet;
|
SCH_SHEET_PIN* Pinsheet, * NextPinsheet;
|
||||||
|
|
||||||
if( !IsOK( aFrame, _( "Ok to cleanup this sheet" ) ) )
|
if( !IsOK( aFrame, _( "Ok to cleanup this sheet" ) ) )
|
||||||
|
@ -297,11 +272,6 @@ int SCH_SHEET::GetPenSize()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
void SCH_SHEET::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
|
|
||||||
const wxPoint& aOffset, int aDrawMode, int aColor )
|
|
||||||
{
|
|
||||||
/*****************************************************************************/
|
|
||||||
/** Function Draw
|
/** Function Draw
|
||||||
* Draw the hierarchical sheet shape
|
* Draw the hierarchical sheet shape
|
||||||
* @param aPanel = the current DrawPanel
|
* @param aPanel = the current DrawPanel
|
||||||
|
@ -311,6 +281,9 @@ void SCH_SHEET::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
|
||||||
* @param aColor = color used to draw sheet. Usually -1 to use the normal
|
* @param aColor = color used to draw sheet. Usually -1 to use the normal
|
||||||
* color for sheet items
|
* color for sheet items
|
||||||
*/
|
*/
|
||||||
|
void SCH_SHEET::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
|
||||||
|
const wxPoint& aOffset, int aDrawMode, int aColor )
|
||||||
|
{
|
||||||
SCH_SHEET_PIN* SheetLabelStruct;
|
SCH_SHEET_PIN* SheetLabelStruct;
|
||||||
int txtcolor;
|
int txtcolor;
|
||||||
wxString Text;
|
wxString Text;
|
||||||
|
@ -364,13 +337,11 @@ void SCH_SHEET::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*****************************************/
|
|
||||||
EDA_Rect SCH_SHEET::GetBoundingBox()
|
|
||||||
{
|
|
||||||
/*****************************************/
|
|
||||||
/** Function GetBoundingBox
|
/** Function GetBoundingBox
|
||||||
* @return an EDA_Rect giving the bounding box of the sheet
|
* @return an EDA_Rect giving the bounding box of the sheet
|
||||||
*/
|
*/
|
||||||
|
EDA_Rect SCH_SHEET::GetBoundingBox()
|
||||||
|
{
|
||||||
int dx, dy;
|
int dx, dy;
|
||||||
|
|
||||||
// Determine length of texts
|
// Determine length of texts
|
||||||
|
@ -389,28 +360,24 @@ EDA_Rect SCH_SHEET::GetBoundingBox()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/************************************************/
|
|
||||||
bool SCH_SHEET::HitTest( const wxPoint& aPosRef )
|
|
||||||
{
|
|
||||||
/************************************************/
|
|
||||||
/** Function HitTest
|
/** Function HitTest
|
||||||
* @return true if the point aPosRef is within item area
|
* @return true if the point aPosRef is within item area
|
||||||
* @param aPosRef = a wxPoint to test
|
* @param aPosRef = a wxPoint to test
|
||||||
*/
|
*/
|
||||||
|
bool SCH_SHEET::HitTest( const wxPoint& aPosRef )
|
||||||
|
{
|
||||||
EDA_Rect rect = GetBoundingBox();
|
EDA_Rect rect = GetBoundingBox();
|
||||||
|
|
||||||
return rect.Inside( aPosRef );
|
return rect.Inside( aPosRef );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/************************************/
|
|
||||||
int SCH_SHEET::ComponentCount()
|
|
||||||
{
|
|
||||||
/************************************/
|
|
||||||
/** Function ComponentCount
|
/** Function ComponentCount
|
||||||
* count our own components, without the power components.
|
* count our own components, without the power components.
|
||||||
* @return the component count.
|
* @return the component count.
|
||||||
*/
|
*/
|
||||||
|
int SCH_SHEET::ComponentCount()
|
||||||
|
{
|
||||||
int n = 0;
|
int n = 0;
|
||||||
|
|
||||||
if( m_AssociatedScreen )
|
if( m_AssociatedScreen )
|
||||||
|
@ -431,20 +398,19 @@ int SCH_SHEET::ComponentCount()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
bool SCH_SHEET::SearchHierarchy( wxString aFilename, SCH_SCREEN** aScreen )
|
|
||||||
{
|
|
||||||
/*****************************************************************************/
|
|
||||||
/** Function SearchHierarchy
|
/** Function SearchHierarchy
|
||||||
* search the existing hierarchy for an instance of screen "FileName".
|
* search the existing hierarchy for an instance of screen "FileName".
|
||||||
* @param aFilename = the filename to find
|
* @param aFilename = the filename to find
|
||||||
* @param aFilename = a location to return a pointer to the screen (if found)
|
* @param aFilename = a location to return a pointer to the screen (if found)
|
||||||
* @return bool if found, and a pointer to the screen
|
* @return bool if found, and a pointer to the screen
|
||||||
*/
|
*/
|
||||||
|
bool SCH_SHEET::SearchHierarchy( wxString aFilename, SCH_SCREEN** aScreen )
|
||||||
|
{
|
||||||
if( m_AssociatedScreen )
|
if( m_AssociatedScreen )
|
||||||
{
|
{
|
||||||
EDA_BaseStruct* strct = m_AssociatedScreen->EEDrawList;
|
EDA_BaseStruct* strct = m_AssociatedScreen->EEDrawList;
|
||||||
|
@ -459,20 +425,18 @@ bool SCH_SHEET::SearchHierarchy( wxString aFilename, SCH_SCREEN** aScreen )
|
||||||
*aScreen = ss->m_AssociatedScreen;
|
*aScreen = ss->m_AssociatedScreen;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( ss->SearchHierarchy( aFilename, aScreen ) )
|
if( ss->SearchHierarchy( aFilename, aScreen ) )
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
strct = strct->Next();
|
strct = strct->Next();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************/
|
|
||||||
bool SCH_SHEET::LocatePathOfScreen( SCH_SCREEN* aScreen, DrawSheetPath* aList )
|
|
||||||
{
|
|
||||||
/*******************************************************************************/
|
|
||||||
/** Function LocatePathOfScreen
|
/** Function LocatePathOfScreen
|
||||||
* search the existing hierarchy for an instance of screen "FileName".
|
* search the existing hierarchy for an instance of screen "FileName".
|
||||||
* don't bother looking at the root sheet - it must be unique,
|
* don't bother looking at the root sheet - it must be unique,
|
||||||
|
@ -480,9 +444,11 @@ bool SCH_SHEET::LocatePathOfScreen( SCH_SCREEN* aScreen, DrawSheetPath* aList )
|
||||||
* 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 SCH_SHEET::LocatePathOfScreen( SCH_SCREEN* aScreen, SCH_SHEET_PATH* aList )
|
||||||
|
{
|
||||||
if( m_AssociatedScreen )
|
if( m_AssociatedScreen )
|
||||||
{
|
{
|
||||||
aList->Push( this );
|
aList->Push( this );
|
||||||
|
@ -506,10 +472,6 @@ bool SCH_SHEET::LocatePathOfScreen( SCH_SCREEN* aScreen, DrawSheetPath* aList )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**********************************************************/
|
|
||||||
bool SCH_SHEET::Load( WinEDA_SchematicFrame* aFrame )
|
|
||||||
{
|
|
||||||
/***********************************************************/
|
|
||||||
/** Function Load.
|
/** Function Load.
|
||||||
* for the sheet: load the file m_FileName
|
* for the sheet: load the file m_FileName
|
||||||
* if a screen already exists, the file is already read.
|
* if a screen already exists, the file is already read.
|
||||||
|
@ -518,6 +480,8 @@ bool SCH_SHEET::Load( WinEDA_SchematicFrame* aFrame )
|
||||||
* @param aFrame = a WinEDA_SchematicFrame pointer to the maim schematic frame
|
* @param aFrame = a WinEDA_SchematicFrame pointer to the maim schematic frame
|
||||||
* @return true if OK
|
* @return true if OK
|
||||||
*/
|
*/
|
||||||
|
bool SCH_SHEET::Load( WinEDA_SchematicFrame* aFrame )
|
||||||
|
{
|
||||||
bool success = true;
|
bool success = true;
|
||||||
|
|
||||||
if( !m_AssociatedScreen )
|
if( !m_AssociatedScreen )
|
||||||
|
@ -552,19 +516,18 @@ bool SCH_SHEET::Load( WinEDA_SchematicFrame* aFrame )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**********************************/
|
|
||||||
int SCH_SHEET::CountSheets()
|
|
||||||
{
|
|
||||||
/**********************************/
|
|
||||||
/** Function CountSheets
|
/** Function CountSheets
|
||||||
* calculates the number of sheets found in "this"
|
* calculates the number of sheets found in "this"
|
||||||
* this number includes the full subsheets count
|
* this number includes the full subsheets count
|
||||||
* @return the full count of sheets+subsheets contained by "this"
|
* @return the full count of sheets+subsheets contained by "this"
|
||||||
*/
|
*/
|
||||||
|
int SCH_SHEET::CountSheets()
|
||||||
|
{
|
||||||
int count = 1; //1 = this!!
|
int count = 1; //1 = this!!
|
||||||
|
|
||||||
if( m_AssociatedScreen )
|
if( m_AssociatedScreen )
|
||||||
|
@ -583,19 +546,12 @@ int SCH_SHEET::CountSheets()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/******************************************/
|
|
||||||
wxString SCH_SHEET::GetFileName( void )
|
wxString SCH_SHEET::GetFileName( void )
|
||||||
{
|
{
|
||||||
/******************************************/
|
|
||||||
return m_FileName;
|
return m_FileName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/************************************************************************/
|
|
||||||
bool SCH_SHEET::ChangeFileName( WinEDA_SchematicFrame* aFrame,
|
|
||||||
const wxString& aFileName )
|
|
||||||
{
|
|
||||||
/************************************************************************/
|
|
||||||
/** Function ChangeFileName
|
/** Function ChangeFileName
|
||||||
* Set a new filename and manage data and associated screen
|
* Set a new filename and manage data and associated screen
|
||||||
* The main difficulty is the filename change in a complex hierarchy.
|
* The main difficulty is the filename change in a complex hierarchy.
|
||||||
|
@ -606,7 +562,10 @@ bool SCH_SHEET::ChangeFileName( WinEDA_SchematicFrame* aFrame,
|
||||||
* @param aFileName = the new filename
|
* @param aFileName = the new filename
|
||||||
* @param aFrame = the schematic frame
|
* @param aFrame = the schematic frame
|
||||||
*/
|
*/
|
||||||
if( (GetFileName() == aFileName) && m_AssociatedScreen )
|
bool SCH_SHEET::ChangeFileName( WinEDA_SchematicFrame* aFrame,
|
||||||
|
const wxString& aFileName )
|
||||||
|
{
|
||||||
|
if( ( GetFileName() == aFileName ) && m_AssociatedScreen )
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
SCH_SCREEN* Screen_to_use = NULL;
|
SCH_SCREEN* Screen_to_use = NULL;
|
||||||
|
@ -706,7 +665,6 @@ otherwise delete current sheet data)" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************/
|
|
||||||
void SCH_SHEET::DisplayInfo( WinEDA_DrawFrame* frame )
|
void SCH_SHEET::DisplayInfo( WinEDA_DrawFrame* frame )
|
||||||
{
|
{
|
||||||
frame->ClearMsgPanel();
|
frame->ClearMsgPanel();
|
||||||
|
@ -743,7 +701,8 @@ void SCH_SHEET::Show( int nestLevel, std::ostream& os )
|
||||||
wxString s = GetClass();
|
wxString s = GetClass();
|
||||||
|
|
||||||
NestedSpace( nestLevel, os ) << '<' << s.Lower().mb_str() << ">"
|
NestedSpace( nestLevel, os ) << '<' << s.Lower().mb_str() << ">"
|
||||||
<< " sheet_name=\"" << CONV_TO_UTF8( m_SheetName )
|
<< " sheet_name=\""
|
||||||
|
<< CONV_TO_UTF8( m_SheetName )
|
||||||
<< '"' << ">\n";
|
<< '"' << ">\n";
|
||||||
|
|
||||||
// show all the pins, and check the linked list integrity
|
// show all the pins, and check the linked list integrity
|
||||||
|
|
|
@ -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.
|
||||||
|
@ -238,14 +238,14 @@ public:
|
||||||
* search the existing hierarchy for an instance of screen "FileName".
|
* search the existing hierarchy for an instance of screen "FileName".
|
||||||
* don't bother looking at the root sheet - it must be unique,
|
* don't bother looking at the root sheet - it must be unique,
|
||||||
* no other references to its m_AssociatedScreen otherwise there would be
|
* no other references to its m_AssociatedScreen otherwise there would be
|
||||||
* 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"
|
||||||
|
@ -271,9 +271,9 @@ public:
|
||||||
* Set a new filename and manage data and associated screen
|
* Set a new filename and manage data and associated screen
|
||||||
* The main difficulty is the filename change in a complex hierarchy.
|
* The main difficulty is the filename change in a complex hierarchy.
|
||||||
* - if new filename is not already used: change to the new name (and if an
|
* - if new filename is not already used: change to the new name (and if an
|
||||||
* existing file is found, load it on request)
|
* existing file is found, load it on request)
|
||||||
* - if new filename is already used (a complex hierarchy) : reference the
|
* - if new filename is already used (a complex hierarchy) : reference the
|
||||||
* sheet.
|
* sheet.
|
||||||
* @param aFileName = the new filename
|
* @param aFileName = the new filename
|
||||||
* @param aFrame = the schematic frame
|
* @param aFrame = the schematic frame
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -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()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************/
|
|
||||||
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(
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************/
|
|
||||||
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
|
||||||
* 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()
|
||||||
/** 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()
|
||||||
* @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()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**************************************************/
|
|
||||||
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" ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
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()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
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()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/******************************************/
|
|
||||||
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()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************/
|
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()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
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 )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
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 )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
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 )
|
||||||
|
|
||||||
|
|
||||||
/*********************************************************************/
|
/*********************************************************************/
|
||||||
/* 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 )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*****************************************/
|
|
||||||
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()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*****************************************/
|
|
||||||
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 )
|
||||||
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 @@
|
||||||
|
|
||||||
/** 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 @@
|
||||||
* 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 @@
|
||||||
* 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:
|
||||||
#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();
|
||||||
* @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,9 +147,8 @@ 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 );
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function UpdateAllScreenReferences
|
* Function UpdateAllScreenReferences
|
||||||
|
@ -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,31 +179,31 @@ 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
|
||||||
*/
|
*/
|
||||||
int m_index; /* internal variable to handle GetNext():
|
int m_index; /* internal variable to handle GetNext():
|
||||||
* cleared by GetFirst()
|
* cleared by GetFirst()
|
||||||
* and incremented by GetNext() after
|
* and incremented by GetNext() after
|
||||||
* returning the next item in m_List
|
* returning the next item in m_List
|
||||||
* 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:
|
||||||
/** 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:
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/***********************************************************************/
|
/*******************************************/
|
||||||
/* 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 @@
|
||||||
#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[] =
|
||||||
|
|
||||||
|
|
||||||
/**************************/
|
/**************************/
|
||||||
/* 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()
|
||||||
* 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 )
|
||||||
* @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,
|
||||||
* 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 @@
|
||||||
/* 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 */
|
||||||
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:
|
||||||
|
|
||||||
/** 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:
|
||||||
// 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:
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* _TYPE_MARKER_SCH_H_ */
|
#endif /* _TYPE_SCH_MARKER_H_ */
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
/*************************************************************************************/
|
/***********************************************************************/
|
||||||
/* 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,59 +11,85 @@ 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
|
||||||
NET_BUSLABELMEMBER, /* created when a bus label is found:
|
// higher-level sheet
|
||||||
* the bus label (like DATA[0..7] is converted to n single labels like DATA0, DATA1 ...
|
NET_SHEETLABEL, // element to indicate connection to a
|
||||||
*/
|
// lower-level sheet.
|
||||||
NET_GLOBBUSLABELMEMBER, // see NET_BUSLABELMEMBER, used when a global bus label is found
|
NET_BUSLABELMEMBER, /* created when a bus label is found:
|
||||||
NET_HIERBUSLABELMEMBER, // see NET_BUSLABELMEMBER, used when a hierarchical bus label is found
|
* the bus label (like DATA[0..7] is
|
||||||
NET_SHEETBUSLABELMEMBER, // see NET_BUSLABELMEMBER, used when a pin sheet label using bus notation is found
|
* converted to n single labels like
|
||||||
NET_PINLABEL, /* created when a pin is POWER (IN or OUT) with invisible attribute is found:
|
* DATA0, DATA1 ...
|
||||||
* these pins are equivalent to a global label and are automatically connected
|
*/
|
||||||
*/
|
NET_GLOBBUSLABELMEMBER, // see NET_BUSLABELMEMBER, used when a
|
||||||
|
// global bus label is found
|
||||||
|
NET_HIERBUSLABELMEMBER, // see NET_BUSLABELMEMBER, used when a
|
||||||
|
// hierarchical bus label is found
|
||||||
|
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
|
||||||
};
|
};
|
||||||
|
|
||||||
/* 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
|
||||||
PAD_CONNECT /* Normal connection (no error) */
|
* symbol on it (no error) */
|
||||||
|
PAD_CONNECT /* Normal connection (no error) */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
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) */
|
||||||
SCH_ITEM* m_Link; /* For SCH_SHEET_PIN:
|
EDA_BaseStruct* m_Comp; /* Pointer on the library item that
|
||||||
* Pointer to the hierarchy sheet that contains this SCH_SHEET_PIN
|
* created this net object (the parent)
|
||||||
* For Pins: pointer to the component that contains this pin
|
*/
|
||||||
*/
|
SCH_ITEM* m_Link; /* For SCH_SHEET_PIN:
|
||||||
int m_Flag; /* flag used in calculations */
|
* Pointer to the hierarchy sheet that
|
||||||
DrawSheetPath m_SheetList;
|
* contains this SCH_SHEET_PIN
|
||||||
int m_ElectricalType; /* Has meaning only for Pins and hierachical pins: electrical type */
|
* For Pins: pointer to the component
|
||||||
|
* that contains this pin
|
||||||
|
*/
|
||||||
|
int m_Flag; /* flag used in calculations */
|
||||||
|
SCH_SHEET_PATH m_SheetList;
|
||||||
|
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
|
||||||
* as many net codes as bus members
|
* labels because a BUS label has
|
||||||
|
* 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 );
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
/**************************************************************/
|
/**************************************************************/
|
||||||
/* 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,8 +24,8 @@
|
||||||
#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,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
SCH_CMP_FIELD::~SCH_CMP_FIELD()
|
SCH_FIELD::~SCH_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,8 +68,8 @@ 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;
|
||||||
EDA_Colors color;
|
EDA_Colors color;
|
||||||
|
@ -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,
|
||||||
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,
|
||||||
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,
|
||||||
/* 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,
|
||||||
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,
|
||||||
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,
|
||||||
* 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 )
|
||||||
* 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 )
|
||||||
* 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()
|
||||||
* 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
|
||||||
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
|
||||||
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
|
||||||
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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
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 @@
|
||||||
/* 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;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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:
|
||||||
|
|
||||||
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:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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:
|
||||||
// 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:
|
||||||
{
|
{
|
||||||
/* 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 */
|
||||||
|
|
|
@ -16,9 +16,9 @@
|
||||||
#include <wx/tokenzr.h>
|
#include <wx/tokenzr.h>
|
||||||
|
|
||||||
|
|
||||||
/* Local variables */
|
|
||||||
static LIB_COMPONENT* DummyCmp;
|
static LIB_COMPONENT* DummyCmp;
|
||||||
|
|
||||||
|
|
||||||
/* Descr component <DUMMY> used when a component is not found in library,
|
/* Descr component <DUMMY> used when a component is not found in library,
|
||||||
* to draw a dummy shape
|
* to draw a dummy shape
|
||||||
* This component is a 400 mils square with the text ??
|
* This component is a 400 mils square with the text ??
|
||||||
|
@ -50,7 +50,6 @@ void CreateDummyCmp()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************/
|
|
||||||
SCH_COMPONENT::SCH_COMPONENT( const wxPoint& aPos, SCH_ITEM* aParent ) :
|
SCH_COMPONENT::SCH_COMPONENT( const wxPoint& aPos, SCH_ITEM* aParent ) :
|
||||||
SCH_ITEM( aParent, TYPE_SCH_COMPONENT )
|
SCH_ITEM( aParent, TYPE_SCH_COMPONENT )
|
||||||
{
|
{
|
||||||
|
@ -58,9 +57,9 @@ SCH_COMPONENT::SCH_COMPONENT( const wxPoint& aPos, SCH_ITEM* aParent ) :
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
SCH_COMPONENT::SCH_COMPONENT( LIB_COMPONENT& libComponent, DrawSheetPath* sheet,
|
SCH_COMPONENT::SCH_COMPONENT( LIB_COMPONENT& libComponent,
|
||||||
int unit, int convert, const wxPoint& pos,
|
SCH_SHEET_PATH* sheet, int unit, int convert,
|
||||||
bool setNewItemFlag ) :
|
const wxPoint& pos, bool setNewItemFlag ) :
|
||||||
SCH_ITEM( NULL, TYPE_SCH_COMPONENT )
|
SCH_ITEM( NULL, TYPE_SCH_COMPONENT )
|
||||||
{
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
|
@ -90,13 +89,13 @@ SCH_COMPONENT::SCH_COMPONENT( LIB_COMPONENT& libComponent, DrawSheetPath* sheet,
|
||||||
{
|
{
|
||||||
while( (int) i >= GetFieldCount() )
|
while( (int) i >= GetFieldCount() )
|
||||||
{
|
{
|
||||||
SCH_CMP_FIELD field( wxPoint( 0, 0 ), GetFieldCount(), this,
|
SCH_FIELD field( wxPoint( 0, 0 ), GetFieldCount(), this,
|
||||||
ReturnDefaultFieldName( i ) );
|
ReturnDefaultFieldName( i ) );
|
||||||
AddField( field );
|
AddField( field );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SCH_CMP_FIELD* schField = GetField( i );
|
SCH_FIELD* schField = GetField( i );
|
||||||
|
|
||||||
schField->m_Pos = m_Pos + libFields[i].m_Pos;
|
schField->m_Pos = m_Pos + libFields[i].m_Pos;
|
||||||
schField->ImportValues( libFields[i] );
|
schField->ImportValues( libFields[i] );
|
||||||
|
@ -160,16 +159,16 @@ void SCH_COMPONENT::Init( const wxPoint& pos )
|
||||||
|
|
||||||
for( int i = 0; i < NUMBER_OF_FIELDS; ++i )
|
for( int i = 0; i < NUMBER_OF_FIELDS; ++i )
|
||||||
{
|
{
|
||||||
SCH_CMP_FIELD field( pos, i, this, ReturnDefaultFieldName( i ) );
|
SCH_FIELD field( pos, i, this, ReturnDefaultFieldName( i ) );
|
||||||
|
|
||||||
if( i==REFERENCE )
|
if( i==REFERENCE )
|
||||||
field.SetLayer( LAYER_REFERENCEPART );
|
field.SetLayer( LAYER_REFERENCEPART );
|
||||||
else if( i==VALUE )
|
else if( i==VALUE )
|
||||||
field.SetLayer( LAYER_VALUEPART );
|
field.SetLayer( LAYER_VALUEPART );
|
||||||
|
|
||||||
// else keep LAYER_FIELDS from SCH_CMP_FIELD constructor
|
// else keep LAYER_FIELDS from SCH_FIELD constructor
|
||||||
|
|
||||||
// SCH_CMP_FIELD's implicitly created copy constructor is called in here
|
// SCH_FIELD's implicitly created copy constructor is called in here
|
||||||
AddField( field );
|
AddField( field );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -204,7 +203,7 @@ void SCH_COMPONENT::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
|
||||||
dummy ? 0 : m_Convert, DrawMode, Color, m_Transform,
|
dummy ? 0 : m_Convert, DrawMode, Color, m_Transform,
|
||||||
DrawPinText, false );
|
DrawPinText, false );
|
||||||
|
|
||||||
SCH_CMP_FIELD* field = GetField( REFERENCE );
|
SCH_FIELD* field = GetField( REFERENCE );
|
||||||
|
|
||||||
if( ( ( field->m_Attributs & TEXT_NO_VISIBLE ) == 0 )
|
if( ( ( field->m_Attributs & TEXT_NO_VISIBLE ) == 0 )
|
||||||
&& !( field->m_Flags & IS_MOVED ) )
|
&& !( field->m_Flags & IS_MOVED ) )
|
||||||
|
@ -295,11 +294,9 @@ void SCH_COMPONENT::AddHierarchicalReference( const wxString& aPath,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************/
|
|
||||||
wxString SCH_COMPONENT::ReturnFieldName( int aFieldNdx ) const
|
wxString SCH_COMPONENT::ReturnFieldName( int aFieldNdx ) const
|
||||||
/****************************************************************/
|
|
||||||
{
|
{
|
||||||
SCH_CMP_FIELD* field = GetField( aFieldNdx );
|
SCH_FIELD* field = GetField( aFieldNdx );
|
||||||
|
|
||||||
if( field )
|
if( field )
|
||||||
{
|
{
|
||||||
|
@ -313,9 +310,7 @@ wxString SCH_COMPONENT::ReturnFieldName( int aFieldNdx ) const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************/
|
wxString SCH_COMPONENT::GetPath( SCH_SHEET_PATH* sheet )
|
||||||
wxString SCH_COMPONENT::GetPath( DrawSheetPath* sheet )
|
|
||||||
/****************************************************************/
|
|
||||||
{
|
{
|
||||||
wxString str;
|
wxString str;
|
||||||
|
|
||||||
|
@ -324,9 +319,7 @@ wxString SCH_COMPONENT::GetPath( DrawSheetPath* sheet )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/********************************************************************/
|
const wxString SCH_COMPONENT::GetRef( SCH_SHEET_PATH* sheet )
|
||||||
const wxString SCH_COMPONENT::GetRef( DrawSheetPath* sheet )
|
|
||||||
/********************************************************************/
|
|
||||||
{
|
{
|
||||||
wxString path = GetPath( sheet );
|
wxString path = GetPath( sheet );
|
||||||
wxString h_path, h_ref;
|
wxString h_path, h_ref;
|
||||||
|
@ -362,9 +355,7 @@ const wxString SCH_COMPONENT::GetRef( DrawSheetPath* sheet )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************/
|
void SCH_COMPONENT::SetRef( SCH_SHEET_PATH* sheet, const wxString& ref )
|
||||||
void SCH_COMPONENT::SetRef( DrawSheetPath* sheet, const wxString& ref )
|
|
||||||
/***********************************************************************/
|
|
||||||
{
|
{
|
||||||
wxString path = GetPath( sheet );
|
wxString path = GetPath( sheet );
|
||||||
|
|
||||||
|
@ -374,14 +365,14 @@ void SCH_COMPONENT::SetRef( DrawSheetPath* sheet, const wxString& ref )
|
||||||
wxStringTokenizer tokenizer;
|
wxStringTokenizer tokenizer;
|
||||||
wxString separators( wxT( " " ) );
|
wxString separators( wxT( " " ) );
|
||||||
|
|
||||||
//check to see if it is already there before inserting it
|
// check to see if it is already there before inserting it
|
||||||
for( unsigned ii = 0; ii < m_PathsAndReferences.GetCount(); ii++ )
|
for( unsigned ii = 0; ii < m_PathsAndReferences.GetCount(); ii++ )
|
||||||
{
|
{
|
||||||
tokenizer.SetString( m_PathsAndReferences[ii], separators );
|
tokenizer.SetString( m_PathsAndReferences[ii], separators );
|
||||||
h_path = tokenizer.GetNextToken();
|
h_path = tokenizer.GetNextToken();
|
||||||
if( h_path.Cmp( path ) == 0 )
|
if( h_path.Cmp( path ) == 0 )
|
||||||
{
|
{
|
||||||
//just update the reference text, not the timestamp.
|
// just update the reference text, not the timestamp.
|
||||||
h_ref = h_path + wxT( " " ) + ref;
|
h_ref = h_path + wxT( " " ) + ref;
|
||||||
h_ref += wxT( " " );
|
h_ref += wxT( " " );
|
||||||
tokenizer.GetNextToken(); // Skip old reference
|
tokenizer.GetNextToken(); // Skip old reference
|
||||||
|
@ -395,7 +386,7 @@ void SCH_COMPONENT::SetRef( DrawSheetPath* sheet, const wxString& ref )
|
||||||
if( notInArray )
|
if( notInArray )
|
||||||
AddHierarchicalReference( path, ref, m_Multi );
|
AddHierarchicalReference( path, ref, m_Multi );
|
||||||
|
|
||||||
SCH_CMP_FIELD* rf = GetField( REFERENCE );
|
SCH_FIELD* rf = GetField( REFERENCE );
|
||||||
|
|
||||||
if( rf->m_Text.IsEmpty()
|
if( rf->m_Text.IsEmpty()
|
||||||
|| ( abs( rf->m_Pos.x - m_Pos.x ) +
|
|| ( abs( rf->m_Pos.x - m_Pos.x ) +
|
||||||
|
@ -430,7 +421,8 @@ void SCH_COMPONENT::SetTimeStamp( long aNewTimeStamp)
|
||||||
m_TimeStamp = aNewTimeStamp;
|
m_TimeStamp = aNewTimeStamp;
|
||||||
for( unsigned ii = 0; ii < m_PathsAndReferences.GetCount(); ii++ )
|
for( unsigned ii = 0; ii < m_PathsAndReferences.GetCount(); ii++ )
|
||||||
{
|
{
|
||||||
m_PathsAndReferences[ii].Replace(string_oldtimestamp.GetData(), string_timestamp.GetData());
|
m_PathsAndReferences[ii].Replace( string_oldtimestamp.GetData(),
|
||||||
|
string_timestamp.GetData() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -438,7 +430,7 @@ void SCH_COMPONENT::SetTimeStamp( long aNewTimeStamp)
|
||||||
/***********************************************************/
|
/***********************************************************/
|
||||||
//returns the unit selection, for the given sheet path.
|
//returns the unit selection, for the given sheet path.
|
||||||
/***********************************************************/
|
/***********************************************************/
|
||||||
int SCH_COMPONENT::GetUnitSelection( DrawSheetPath* aSheet )
|
int SCH_COMPONENT::GetUnitSelection( SCH_SHEET_PATH* aSheet )
|
||||||
{
|
{
|
||||||
wxString path = GetPath( aSheet );
|
wxString path = GetPath( aSheet );
|
||||||
wxString h_path, h_multi;
|
wxString h_path, h_multi;
|
||||||
|
@ -469,7 +461,8 @@ int SCH_COMPONENT::GetUnitSelection( DrawSheetPath* aSheet )
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
//Set the unit selection, for the given sheet path.
|
//Set the unit selection, for the given sheet path.
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
void SCH_COMPONENT::SetUnitSelection( DrawSheetPath* aSheet, int aUnitSelection )
|
void SCH_COMPONENT::SetUnitSelection( SCH_SHEET_PATH* aSheet,
|
||||||
|
int aUnitSelection )
|
||||||
{
|
{
|
||||||
wxString path = GetPath( aSheet );
|
wxString path = GetPath( aSheet );
|
||||||
|
|
||||||
|
@ -503,9 +496,9 @@ void SCH_COMPONENT::SetUnitSelection( DrawSheetPath* aSheet, int aUnitSelection
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
SCH_CMP_FIELD* SCH_COMPONENT::GetField( int aFieldNdx ) const
|
SCH_FIELD* SCH_COMPONENT::GetField( int aFieldNdx ) const
|
||||||
{
|
{
|
||||||
const SCH_CMP_FIELD* field;
|
const SCH_FIELD* field;
|
||||||
|
|
||||||
if( (unsigned) aFieldNdx < m_Fields.size() )
|
if( (unsigned) aFieldNdx < m_Fields.size() )
|
||||||
field = &m_Fields[aFieldNdx];
|
field = &m_Fields[aFieldNdx];
|
||||||
|
@ -515,11 +508,11 @@ SCH_CMP_FIELD* SCH_COMPONENT::GetField( int aFieldNdx ) const
|
||||||
wxASSERT( field );
|
wxASSERT( field );
|
||||||
|
|
||||||
// use case to remove const-ness
|
// use case to remove const-ness
|
||||||
return (SCH_CMP_FIELD*) field;
|
return (SCH_FIELD*) field;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SCH_COMPONENT::AddField( const SCH_CMP_FIELD& aField )
|
void SCH_COMPONENT::AddField( const SCH_FIELD& aField )
|
||||||
{
|
{
|
||||||
m_Fields.push_back( aField );
|
m_Fields.push_back( aField );
|
||||||
}
|
}
|
||||||
|
@ -585,11 +578,9 @@ EDA_Rect SCH_COMPONENT::GetBoundaryBox() const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**************************************************************************/
|
|
||||||
/* Used if undo / redo command:
|
/* Used if undo / redo command:
|
||||||
* swap data between this and copyitem
|
* swap data between this and copyitem
|
||||||
*/
|
*/
|
||||||
/**************************************************************************/
|
|
||||||
void SCH_COMPONENT::SwapData( SCH_COMPONENT* copyitem )
|
void SCH_COMPONENT::SwapData( SCH_COMPONENT* copyitem )
|
||||||
{
|
{
|
||||||
EXCHG( m_ChipName, copyitem->m_ChipName );
|
EXCHG( m_ChipName, copyitem->m_ChipName );
|
||||||
|
@ -617,9 +608,7 @@ void SCH_COMPONENT::SwapData( SCH_COMPONENT* copyitem )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************/
|
|
||||||
void SCH_COMPONENT::Place( WinEDA_SchematicFrame* frame, wxDC* DC )
|
void SCH_COMPONENT::Place( WinEDA_SchematicFrame* frame, wxDC* DC )
|
||||||
/***********************************************************************/
|
|
||||||
{
|
{
|
||||||
/* save old text in undo list */
|
/* save old text in undo list */
|
||||||
if( g_ItemToUndoCopy
|
if( g_ItemToUndoCopy
|
||||||
|
@ -644,10 +633,10 @@ void SCH_COMPONENT::Place( WinEDA_SchematicFrame* frame, wxDC* DC )
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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 SCH_COMPONENT::ClearAnnotation( DrawSheetPath* aSheet )
|
void SCH_COMPONENT::ClearAnnotation( SCH_SHEET_PATH* aSheet )
|
||||||
{
|
{
|
||||||
wxString defRef = m_PrefixString;
|
wxString defRef = m_PrefixString;
|
||||||
bool KeepMulti = false;
|
bool KeepMulti = false;
|
||||||
|
@ -770,42 +759,42 @@ void SCH_COMPONENT::SetRotationMiroir( int type_rotate )
|
||||||
SetRotationMiroir( CMP_ROTATE_CLOCKWISE );
|
SetRotationMiroir( CMP_ROTATE_CLOCKWISE );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case (CMP_ORIENT_0 + CMP_MIROIR_X):
|
case ( CMP_ORIENT_0 + CMP_MIROIR_X ):
|
||||||
SetRotationMiroir( CMP_ORIENT_0 );
|
SetRotationMiroir( CMP_ORIENT_0 );
|
||||||
SetRotationMiroir( CMP_MIROIR_X );
|
SetRotationMiroir( CMP_MIROIR_X );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case (CMP_ORIENT_0 + CMP_MIROIR_Y):
|
case ( CMP_ORIENT_0 + CMP_MIROIR_Y ):
|
||||||
SetRotationMiroir( CMP_ORIENT_0 );
|
SetRotationMiroir( CMP_ORIENT_0 );
|
||||||
SetRotationMiroir( CMP_MIROIR_Y );
|
SetRotationMiroir( CMP_MIROIR_Y );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case (CMP_ORIENT_90 + CMP_MIROIR_X):
|
case ( CMP_ORIENT_90 + CMP_MIROIR_X ):
|
||||||
SetRotationMiroir( CMP_ORIENT_90 );
|
SetRotationMiroir( CMP_ORIENT_90 );
|
||||||
SetRotationMiroir( CMP_MIROIR_X );
|
SetRotationMiroir( CMP_MIROIR_X );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case (CMP_ORIENT_90 + CMP_MIROIR_Y):
|
case ( CMP_ORIENT_90 + CMP_MIROIR_Y ):
|
||||||
SetRotationMiroir( CMP_ORIENT_90 );
|
SetRotationMiroir( CMP_ORIENT_90 );
|
||||||
SetRotationMiroir( CMP_MIROIR_Y );
|
SetRotationMiroir( CMP_MIROIR_Y );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case (CMP_ORIENT_180 + CMP_MIROIR_X):
|
case ( CMP_ORIENT_180 + CMP_MIROIR_X ):
|
||||||
SetRotationMiroir( CMP_ORIENT_180 );
|
SetRotationMiroir( CMP_ORIENT_180 );
|
||||||
SetRotationMiroir( CMP_MIROIR_X );
|
SetRotationMiroir( CMP_MIROIR_X );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case (CMP_ORIENT_180 + CMP_MIROIR_Y):
|
case ( CMP_ORIENT_180 + CMP_MIROIR_Y ):
|
||||||
SetRotationMiroir( CMP_ORIENT_180 );
|
SetRotationMiroir( CMP_ORIENT_180 );
|
||||||
SetRotationMiroir( CMP_MIROIR_Y );
|
SetRotationMiroir( CMP_MIROIR_Y );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case (CMP_ORIENT_270 + CMP_MIROIR_X):
|
case ( CMP_ORIENT_270 + CMP_MIROIR_X ):
|
||||||
SetRotationMiroir( CMP_ORIENT_270 );
|
SetRotationMiroir( CMP_ORIENT_270 );
|
||||||
SetRotationMiroir( CMP_MIROIR_X );
|
SetRotationMiroir( CMP_MIROIR_X );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case (CMP_ORIENT_270 + CMP_MIROIR_Y):
|
case ( CMP_ORIENT_270 + CMP_MIROIR_Y ):
|
||||||
SetRotationMiroir( CMP_ORIENT_270 );
|
SetRotationMiroir( CMP_ORIENT_270 );
|
||||||
SetRotationMiroir( CMP_MIROIR_Y );
|
SetRotationMiroir( CMP_MIROIR_Y );
|
||||||
break;
|
break;
|
||||||
|
@ -850,30 +839,35 @@ void SCH_COMPONENT::SetRotationMiroir( int type_rotate )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int SCH_COMPONENT::GetRotationMiroir()
|
|
||||||
/** function GetRotationMiroir()
|
/** function GetRotationMiroir()
|
||||||
* 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 SCH_COMPONENT::GetRotationMiroir()
|
||||||
{
|
{
|
||||||
int type_rotate = CMP_ORIENT_0;
|
int type_rotate = CMP_ORIENT_0;
|
||||||
int ComponentMatOrient[2][2];
|
int ComponentMatOrient[2][2];
|
||||||
int ii;
|
int ii;
|
||||||
|
|
||||||
#define ROTATE_VALUES_COUNT 12
|
#define ROTATE_VALUES_COUNT 12
|
||||||
int rotate_value[ROTATE_VALUES_COUNT] = // list of all possibilities, but only the first 8 are actually used
|
|
||||||
|
// list of all possibilities, but only the first 8 are actually used
|
||||||
|
int rotate_value[ROTATE_VALUES_COUNT] =
|
||||||
{
|
{
|
||||||
CMP_ORIENT_0, CMP_ORIENT_90, CMP_ORIENT_180, CMP_ORIENT_270,
|
CMP_ORIENT_0, CMP_ORIENT_90, CMP_ORIENT_180, CMP_ORIENT_270,
|
||||||
CMP_MIROIR_X + CMP_ORIENT_0, CMP_MIROIR_X + CMP_ORIENT_90, CMP_MIROIR_X + CMP_ORIENT_180, CMP_MIROIR_X + CMP_ORIENT_270,
|
CMP_MIROIR_X + CMP_ORIENT_0, CMP_MIROIR_X + CMP_ORIENT_90,
|
||||||
CMP_MIROIR_Y + CMP_ORIENT_0, CMP_MIROIR_Y + CMP_ORIENT_90, CMP_MIROIR_Y + CMP_ORIENT_180, CMP_MIROIR_Y + CMP_ORIENT_270
|
CMP_MIROIR_X + CMP_ORIENT_180, CMP_MIROIR_X + CMP_ORIENT_270,
|
||||||
|
CMP_MIROIR_Y + CMP_ORIENT_0, CMP_MIROIR_Y + CMP_ORIENT_90,
|
||||||
|
CMP_MIROIR_Y + CMP_ORIENT_180, CMP_MIROIR_Y + CMP_ORIENT_270
|
||||||
};
|
};
|
||||||
|
|
||||||
// Try to find the current transform option:
|
// Try to find the current transform option:
|
||||||
|
@ -883,7 +877,8 @@ int SCH_COMPONENT::GetRotationMiroir()
|
||||||
{
|
{
|
||||||
type_rotate = rotate_value[ii];
|
type_rotate = rotate_value[ii];
|
||||||
SetRotationMiroir( type_rotate );
|
SetRotationMiroir( type_rotate );
|
||||||
if( memcmp( ComponentMatOrient, m_Transform, sizeof(ComponentMatOrient) ) == 0 )
|
if( memcmp( ComponentMatOrient, m_Transform,
|
||||||
|
sizeof(ComponentMatOrient) ) == 0 )
|
||||||
return type_rotate;
|
return type_rotate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -921,10 +916,12 @@ wxPoint SCH_COMPONENT::GetScreenCoord( const wxPoint& coord )
|
||||||
void SCH_COMPONENT::Show( int nestLevel, std::ostream& os )
|
void SCH_COMPONENT::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() <<
|
NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str()
|
||||||
" ref=\"" << ReturnFieldName( 0 ) << '"' << " chipName=\"" <<
|
<< " ref=\"" << ReturnFieldName( 0 )
|
||||||
m_ChipName.mb_str() << '"' << m_Pos << " layer=\"" << m_Layer <<
|
<< '"' << " chipName=\""
|
||||||
'"' << "/>\n";
|
<< m_ChipName.mb_str() << '"' << m_Pos
|
||||||
|
<< " layer=\"" << m_Layer
|
||||||
|
<< '"' << "/>\n";
|
||||||
|
|
||||||
// skip the reference, it's been output already.
|
// skip the reference, it's been output already.
|
||||||
for( int i = 1; i < GetFieldCount(); ++i )
|
for( int i = 1; i < GetFieldCount(); ++i )
|
||||||
|
@ -933,13 +930,15 @@ void SCH_COMPONENT::Show( int nestLevel, std::ostream& os )
|
||||||
|
|
||||||
if( !value.IsEmpty() )
|
if( !value.IsEmpty() )
|
||||||
{
|
{
|
||||||
NestedSpace( nestLevel + 1, os ) << "<field" << " name=\"" <<
|
NestedSpace( nestLevel + 1, os ) << "<field" << " name=\""
|
||||||
ReturnFieldName( i ).mb_str() << '"' << " value=\"" <<
|
<< ReturnFieldName( i ).mb_str()
|
||||||
value.mb_str() << "\"/>\n";
|
<< '"' << " value=\""
|
||||||
|
<< value.mb_str() << "\"/>\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
NestedSpace( nestLevel, os ) << "</" << GetClass().Lower().mb_str() << ">\n";
|
NestedSpace( nestLevel, os ) << "</" << GetClass().Lower().mb_str()
|
||||||
|
<< ">\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -1037,8 +1036,8 @@ bool SCH_COMPONENT::Save( FILE* f ) const
|
||||||
|
|
||||||
for( int fieldNdx = 0; fieldNdx < GetFieldCount(); ++fieldNdx )
|
for( int fieldNdx = 0; fieldNdx < GetFieldCount(); ++fieldNdx )
|
||||||
{
|
{
|
||||||
SCH_CMP_FIELD* field = GetField( fieldNdx );
|
SCH_FIELD* field = GetField( fieldNdx );
|
||||||
wxString defaultName = ReturnDefaultFieldName( fieldNdx );
|
wxString defaultName = ReturnDefaultFieldName( fieldNdx );
|
||||||
|
|
||||||
// only save the field if there is a value in the field or if field name
|
// only save the field if there is a value in the field or if field name
|
||||||
// is different than the default field name
|
// is different than the default field name
|
||||||
|
@ -1049,7 +1048,7 @@ bool SCH_COMPONENT::Save( FILE* f ) const
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Generation du num unit, position, box ( ancienne norme )*/
|
/* Unit number, position, box ( old standard ) */
|
||||||
if( fprintf( f, "\t%-4d %-4d %-4d\n", m_Multi, m_Pos.x, m_Pos.y ) == EOF )
|
if( fprintf( f, "\t%-4d %-4d %-4d\n", m_Multi, m_Pos.x, m_Pos.y ) == EOF )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -1130,7 +1129,8 @@ void SCH_COMPONENT::Mirror_Y(int aYaxis_position)
|
||||||
|
|
||||||
for( int ii = 0; ii < GetFieldCount(); ii++ )
|
for( int ii = 0; ii < GetFieldCount(); ii++ )
|
||||||
{
|
{
|
||||||
/* move the fields to the new position because the component itself has moved */
|
/* move the fields to the new position because the component itself
|
||||||
|
* has moved */
|
||||||
GetField( ii )->m_Pos.x -= dx;
|
GetField( ii )->m_Pos.x -= dx;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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 {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/// 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:
|
||||||
|
|
||||||
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:
|
||||||
* 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:
|
||||||
* @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:
|
||||||
* 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:
|
||||||
* @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:
|
||||||
* 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:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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:
|
||||||
* 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:
|
||||||
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:
|
||||||
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:
|
||||||
* 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
|
||||||
|
@ -349,7 +350,7 @@ public:
|
||||||
* 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 Show( int nestLevel, std::ostream& os );
|
void Show( int nestLevel, std::ostream& os );
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
|
@ -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 )
|
||||||
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 )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************/
|
/* 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[] = {
|
||||||
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 )
|
||||||
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()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**************************************************************/
|
|
||||||
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 )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**************************************************************/
|
|
||||||
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 )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**************************************************************/
|
|
||||||
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 )
|
||||||
/* 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()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*****************************************/
|
|
||||||
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()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/************************************************/
|
|
||||||
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 )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/************************************************/
|
|
||||||
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 )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/************************************************************************/
|
|
||||||
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 )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,11 +16,11 @@
|
||||||
*/
|
*/
|
||||||
#define BUS_WIDTH_EXPAND 1.4
|
#define BUS_WIDTH_EXPAND 1.4
|
||||||
|
|
||||||
/****************************/
|
/***********************/
|
||||||
/* class DrawBusEntryStruct */
|
/* class SCH_BUS_ENTRY */
|
||||||
/***************************/
|
/***********************/
|
||||||
|
|
||||||
DrawBusEntryStruct::DrawBusEntryStruct( const wxPoint& pos, int shape, int id ) :
|
SCH_BUS_ENTRY::SCH_BUS_ENTRY( const wxPoint& pos, int shape, int id ) :
|
||||||
SCH_ITEM( NULL, DRAW_BUSENTRY_STRUCT_TYPE )
|
SCH_ITEM( NULL, DRAW_BUSENTRY_STRUCT_TYPE )
|
||||||
{
|
{
|
||||||
m_Pos = pos;
|
m_Pos = pos;
|
||||||
|
@ -39,15 +39,15 @@ DrawBusEntryStruct::DrawBusEntryStruct( const wxPoint& pos, int shape, int id )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
wxPoint DrawBusEntryStruct::m_End() const
|
wxPoint SCH_BUS_ENTRY::m_End() const
|
||||||
{
|
{
|
||||||
return wxPoint( m_Pos.x + m_Size.x, m_Pos.y + m_Size.y );
|
return wxPoint( m_Pos.x + m_Size.x, m_Pos.y + m_Size.y );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
DrawBusEntryStruct* DrawBusEntryStruct::GenCopy()
|
SCH_BUS_ENTRY* SCH_BUS_ENTRY::GenCopy()
|
||||||
{
|
{
|
||||||
DrawBusEntryStruct* newitem = new DrawBusEntryStruct( m_Pos, 0, 0 );
|
SCH_BUS_ENTRY* newitem = new SCH_BUS_ENTRY( m_Pos, 0, 0 );
|
||||||
|
|
||||||
newitem->m_Layer = m_Layer;
|
newitem->m_Layer = m_Layer;
|
||||||
newitem->m_Width = m_Width;
|
newitem->m_Width = m_Width;
|
||||||
|
@ -64,7 +64,7 @@ DrawBusEntryStruct* DrawBusEntryStruct::GenCopy()
|
||||||
* @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 DrawBusEntryStruct::Save( FILE* aFile ) const
|
bool SCH_BUS_ENTRY::Save( FILE* aFile ) const
|
||||||
{
|
{
|
||||||
bool success = true;
|
bool success = true;
|
||||||
|
|
||||||
|
@ -90,14 +90,14 @@ bool DrawBusEntryStruct::Save( FILE* aFile ) const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
EDA_Rect DrawBusEntryStruct::GetBoundingBox()
|
EDA_Rect SCH_BUS_ENTRY::GetBoundingBox()
|
||||||
{
|
{
|
||||||
int dx = m_Pos.x - m_End().x;
|
int dx = m_Pos.x - m_End().x;
|
||||||
int dy = m_Pos.y - m_End().y;
|
int dy = m_Pos.y - m_End().y;
|
||||||
EDA_Rect box( wxPoint( m_Pos.x, m_Pos.y ), wxSize( dx, dy ) );
|
EDA_Rect box( wxPoint( m_Pos.x, m_Pos.y ), wxSize( dx, dy ) );
|
||||||
|
|
||||||
box.Normalize();
|
box.Normalize();
|
||||||
int width = (m_Width == 0) ? g_DrawDefaultLineThickness : m_Width;
|
int width = ( m_Width == 0 ) ? g_DrawDefaultLineThickness : m_Width;
|
||||||
box.Inflate( width / 2, width / 2 );
|
box.Inflate( width / 2, width / 2 );
|
||||||
|
|
||||||
return box;
|
return box;
|
||||||
|
@ -107,9 +107,9 @@ EDA_Rect DrawBusEntryStruct::GetBoundingBox()
|
||||||
/** 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 DrawBusEntryStruct::GetPenSize()
|
int SCH_BUS_ENTRY::GetPenSize()
|
||||||
{
|
{
|
||||||
int pensize = (m_Width == 0) ? g_DrawDefaultLineThickness : m_Width;
|
int pensize = ( m_Width == 0 ) ? g_DrawDefaultLineThickness : m_Width;
|
||||||
|
|
||||||
if( m_Layer == LAYER_BUS && m_Width == 0 )
|
if( m_Layer == LAYER_BUS && m_Width == 0 )
|
||||||
{
|
{
|
||||||
|
@ -121,8 +121,8 @@ int DrawBusEntryStruct::GetPenSize()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void DrawBusEntryStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
|
void SCH_BUS_ENTRY::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
|
||||||
const wxPoint& offset, int DrawMode, int Color )
|
const wxPoint& offset, int DrawMode, int Color )
|
||||||
{
|
{
|
||||||
int color;
|
int color;
|
||||||
|
|
||||||
|
@ -137,14 +137,14 @@ void DrawBusEntryStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/****************************/
|
/**********************/
|
||||||
/* class DrawJunctionStruct */
|
/* class SCH_JUNCTION */
|
||||||
/***************************/
|
/**********************/
|
||||||
|
|
||||||
DrawJunctionStruct::DrawJunctionStruct( const wxPoint& pos ) :
|
SCH_JUNCTION::SCH_JUNCTION( const wxPoint& pos ) :
|
||||||
SCH_ITEM( NULL, DRAW_JUNCTION_STRUCT_TYPE )
|
SCH_ITEM( NULL, DRAW_JUNCTION_STRUCT_TYPE )
|
||||||
{
|
{
|
||||||
#define DRAWJUNCTION_DIAMETER 32 /* Diameter of junction symbol between wires */
|
#define DRAWJUNCTION_DIAMETER 32 /* Diameter of junction symbol between wires */
|
||||||
m_Pos = pos;
|
m_Pos = pos;
|
||||||
m_Layer = LAYER_JUNCTION;
|
m_Layer = LAYER_JUNCTION;
|
||||||
m_Size.x = m_Size.y = DRAWJUNCTION_DIAMETER;
|
m_Size.x = m_Size.y = DRAWJUNCTION_DIAMETER;
|
||||||
|
@ -153,9 +153,9 @@ DrawJunctionStruct::DrawJunctionStruct( const wxPoint& pos ) :
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
DrawJunctionStruct* DrawJunctionStruct::GenCopy()
|
SCH_JUNCTION* SCH_JUNCTION::GenCopy()
|
||||||
{
|
{
|
||||||
DrawJunctionStruct* newitem = new DrawJunctionStruct( m_Pos );
|
SCH_JUNCTION* newitem = new SCH_JUNCTION( m_Pos );
|
||||||
|
|
||||||
newitem->m_Size = m_Size;
|
newitem->m_Size = m_Size;
|
||||||
newitem->m_Layer = m_Layer;
|
newitem->m_Layer = m_Layer;
|
||||||
|
@ -171,7 +171,7 @@ DrawJunctionStruct* DrawJunctionStruct::GenCopy()
|
||||||
* @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 DrawJunctionStruct::Save( FILE* aFile ) const
|
bool SCH_JUNCTION::Save( FILE* aFile ) const
|
||||||
{
|
{
|
||||||
bool success = true;
|
bool success = true;
|
||||||
|
|
||||||
|
@ -184,13 +184,11 @@ bool DrawJunctionStruct::Save( FILE* aFile ) const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
EDA_Rect DrawJunctionStruct::GetBoundingBox()
|
EDA_Rect SCH_JUNCTION::GetBoundingBox()
|
||||||
|
|
||||||
// return a bounding box
|
|
||||||
{
|
{
|
||||||
EDA_Rect rect;
|
EDA_Rect rect;
|
||||||
rect.SetOrigin(m_Pos);
|
rect.SetOrigin( m_Pos );
|
||||||
rect.Inflate( (GetPenSize() + m_Size.x)/2);
|
rect.Inflate( ( GetPenSize() + m_Size.x ) / 2 );
|
||||||
|
|
||||||
return rect;
|
return rect;
|
||||||
};
|
};
|
||||||
|
@ -200,20 +198,20 @@ EDA_Rect DrawJunctionStruct::GetBoundingBox()
|
||||||
* @return true if the point aPosRef is within item area
|
* @return true if the point aPosRef is within item area
|
||||||
* @param aPosRef = a wxPoint to test
|
* @param aPosRef = a wxPoint to test
|
||||||
*/
|
*/
|
||||||
bool DrawJunctionStruct::HitTest( const wxPoint& aPosRef )
|
bool SCH_JUNCTION::HitTest( const wxPoint& aPosRef )
|
||||||
{
|
{
|
||||||
wxPoint dist = aPosRef - m_Pos;
|
wxPoint dist = aPosRef - m_Pos;
|
||||||
|
|
||||||
return sqrt( ( (double) ( dist.x * dist.x ) ) +
|
return sqrt( ( (double) ( dist.x * dist.x ) ) +
|
||||||
( (double) ( dist.y * dist.y ) ) ) < (m_Size.x/2);
|
( (double) ( dist.y * dist.y ) ) ) < ( m_Size.x / 2 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/** 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
|
||||||
* has no meaning for DrawJunctionStruct
|
* has no meaning for SCH_JUNCTION
|
||||||
*/
|
*/
|
||||||
int DrawJunctionStruct::GetPenSize()
|
int SCH_JUNCTION::GetPenSize()
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -222,8 +220,8 @@ int DrawJunctionStruct::GetPenSize()
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* Routine to redraw connection struct. *
|
* Routine to redraw connection struct. *
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
void DrawJunctionStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
|
void SCH_JUNCTION::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
|
||||||
const wxPoint& offset, int DrawMode, int Color )
|
const wxPoint& offset, int DrawMode, int Color )
|
||||||
{
|
{
|
||||||
int color;
|
int color;
|
||||||
|
|
||||||
|
@ -240,7 +238,7 @@ void DrawJunctionStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
|
||||||
|
|
||||||
|
|
||||||
#if defined(DEBUG)
|
#if defined(DEBUG)
|
||||||
void DrawJunctionStruct::Show( int nestLevel, std::ostream& os )
|
void SCH_JUNCTION::Show( int nestLevel, std::ostream& os )
|
||||||
{
|
{
|
||||||
// XML output:
|
// XML output:
|
||||||
wxString s = GetClass();
|
wxString s = GetClass();
|
||||||
|
@ -253,11 +251,11 @@ void DrawJunctionStruct::Show( int nestLevel, std::ostream& os )
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/*****************************/
|
/************************/
|
||||||
/* class DrawNoConnectStruct */
|
/* class SCH_NO_CONNECT */
|
||||||
/*****************************/
|
/************************/
|
||||||
|
|
||||||
DrawNoConnectStruct::DrawNoConnectStruct( const wxPoint& pos ) :
|
SCH_NO_CONNECT::SCH_NO_CONNECT( const wxPoint& pos ) :
|
||||||
SCH_ITEM( NULL, DRAW_NOCONNECT_STRUCT_TYPE )
|
SCH_ITEM( NULL, DRAW_NOCONNECT_STRUCT_TYPE )
|
||||||
{
|
{
|
||||||
#define DRAWNOCONNECT_SIZE 48 /* No symbol connection range. */
|
#define DRAWNOCONNECT_SIZE 48 /* No symbol connection range. */
|
||||||
|
@ -267,9 +265,9 @@ DrawNoConnectStruct::DrawNoConnectStruct( const wxPoint& pos ) :
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
DrawNoConnectStruct* DrawNoConnectStruct::GenCopy()
|
SCH_NO_CONNECT* SCH_NO_CONNECT::GenCopy()
|
||||||
{
|
{
|
||||||
DrawNoConnectStruct* newitem = new DrawNoConnectStruct( m_Pos );
|
SCH_NO_CONNECT* newitem = new SCH_NO_CONNECT( m_Pos );
|
||||||
|
|
||||||
newitem->m_Size = m_Size;
|
newitem->m_Size = m_Size;
|
||||||
newitem->m_Flags = m_Flags;
|
newitem->m_Flags = m_Flags;
|
||||||
|
@ -278,12 +276,12 @@ DrawNoConnectStruct* DrawNoConnectStruct::GenCopy()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
EDA_Rect DrawNoConnectStruct::GetBoundingBox()
|
EDA_Rect SCH_NO_CONNECT::GetBoundingBox()
|
||||||
{
|
{
|
||||||
int delta = (GetPenSize() + m_Size.x)/2;
|
int delta = ( GetPenSize() + m_Size.x ) / 2;
|
||||||
EDA_Rect box;
|
EDA_Rect box;
|
||||||
box.SetOrigin( m_Pos );
|
box.SetOrigin( m_Pos );
|
||||||
box.Inflate(delta);
|
box.Inflate( delta );
|
||||||
|
|
||||||
return box;
|
return box;
|
||||||
}
|
}
|
||||||
|
@ -294,14 +292,14 @@ EDA_Rect DrawNoConnectStruct::GetBoundingBox()
|
||||||
* @return true if the point aPosRef is within item area
|
* @return true if the point aPosRef is within item area
|
||||||
* @param aPosRef = a wxPoint to test
|
* @param aPosRef = a wxPoint to test
|
||||||
*/
|
*/
|
||||||
bool DrawNoConnectStruct::HitTest( const wxPoint& aPosRef )
|
bool SCH_NO_CONNECT::HitTest( const wxPoint& aPosRef )
|
||||||
{
|
{
|
||||||
int width = g_DrawDefaultLineThickness;
|
int width = g_DrawDefaultLineThickness;
|
||||||
int delta = ( m_Size.x + width) / 2;
|
int delta = ( m_Size.x + width ) / 2;
|
||||||
|
|
||||||
wxPoint dist = aPosRef - m_Pos;
|
wxPoint dist = aPosRef - m_Pos;
|
||||||
|
|
||||||
if( (ABS( dist.x ) <= delta) && (ABS( dist.y ) <= delta) )
|
if( ( ABS( dist.x ) <= delta ) && ( ABS( dist.y ) <= delta ) )
|
||||||
return true;
|
return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -313,7 +311,7 @@ bool DrawNoConnectStruct::HitTest( const wxPoint& aPosRef )
|
||||||
* @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 DrawNoConnectStruct::Save( FILE* aFile ) const
|
bool SCH_NO_CONNECT::Save( FILE* aFile ) const
|
||||||
{
|
{
|
||||||
bool success = true;
|
bool success = true;
|
||||||
|
|
||||||
|
@ -329,20 +327,21 @@ bool DrawNoConnectStruct::Save( FILE* aFile ) const
|
||||||
/** 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 DrawNoConnectStruct::GetPenSize()
|
int SCH_NO_CONNECT::GetPenSize()
|
||||||
{
|
{
|
||||||
return g_DrawDefaultLineThickness;
|
return g_DrawDefaultLineThickness;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void DrawNoConnectStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
|
void SCH_NO_CONNECT::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
|
||||||
const wxPoint& offset, int DrawMode, int Color )
|
const wxPoint& offset, int DrawMode, int Color )
|
||||||
{
|
{
|
||||||
int delta = m_Size.x / 2;
|
|
||||||
int pX, pY, color;
|
int pX, pY, color;
|
||||||
|
int delta = m_Size.x / 2;
|
||||||
int width = g_DrawDefaultLineThickness;
|
int width = g_DrawDefaultLineThickness;
|
||||||
|
|
||||||
pX = m_Pos.x + offset.x; pY = m_Pos.y + offset.y;
|
pX = m_Pos.x + offset.x;
|
||||||
|
pY = m_Pos.y + offset.y;
|
||||||
|
|
||||||
if( Color >= 0 )
|
if( Color >= 0 )
|
||||||
color = Color;
|
color = Color;
|
||||||
|
@ -357,11 +356,11 @@ void DrawNoConnectStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***************************/
|
/******************/
|
||||||
/* Class EDA_DrawLineStruct */
|
/* Class SCH_LINE */
|
||||||
/***************************/
|
/******************/
|
||||||
|
|
||||||
EDA_DrawLineStruct::EDA_DrawLineStruct( const wxPoint& pos, int layer ) :
|
SCH_LINE::SCH_LINE( const wxPoint& pos, int layer ) :
|
||||||
SCH_ITEM( NULL, DRAW_SEGMENT_STRUCT_TYPE )
|
SCH_ITEM( NULL, DRAW_SEGMENT_STRUCT_TYPE )
|
||||||
{
|
{
|
||||||
m_Start = pos;
|
m_Start = pos;
|
||||||
|
@ -386,9 +385,9 @@ EDA_DrawLineStruct::EDA_DrawLineStruct( const wxPoint& pos, int layer ) :
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
EDA_DrawLineStruct* EDA_DrawLineStruct::GenCopy()
|
SCH_LINE* SCH_LINE::GenCopy()
|
||||||
{
|
{
|
||||||
EDA_DrawLineStruct* newitem = new EDA_DrawLineStruct( m_Start, m_Layer );
|
SCH_LINE* newitem = new SCH_LINE( m_Start, m_Layer );
|
||||||
|
|
||||||
newitem->m_End = m_End;
|
newitem->m_End = m_End;
|
||||||
|
|
||||||
|
@ -396,11 +395,11 @@ EDA_DrawLineStruct* EDA_DrawLineStruct::GenCopy()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool EDA_DrawLineStruct::IsOneEndPointAt( const wxPoint& pos )
|
bool SCH_LINE::IsOneEndPointAt( const wxPoint& pos )
|
||||||
{
|
{
|
||||||
if( (pos.x == m_Start.x) && (pos.y == m_Start.y) )
|
if( ( pos.x == m_Start.x ) && ( pos.y == m_Start.y ) )
|
||||||
return TRUE;
|
return TRUE;
|
||||||
if( (pos.x == m_End.x) && (pos.y == m_End.y) )
|
if( ( pos.x == m_End.x ) && ( pos.y == m_End.y ) )
|
||||||
return TRUE;
|
return TRUE;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -415,23 +414,23 @@ bool EDA_DrawLineStruct::IsOneEndPointAt( const wxPoint& pos )
|
||||||
* 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 EDA_DrawLineStruct::Show( int nestLevel, std::ostream& os )
|
void SCH_LINE::Show( int nestLevel, std::ostream& os )
|
||||||
{
|
{
|
||||||
NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str() <<
|
NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str()
|
||||||
" layer=\"" << m_Layer << '"' <<
|
<< " layer=\"" << m_Layer << '"'
|
||||||
" width=\"" << m_Width << '"' <<
|
<< " width=\"" << m_Width << '"'
|
||||||
" startIsDangling=\"" << m_StartIsDangling << '"' <<
|
<< " startIsDangling=\"" << m_StartIsDangling
|
||||||
" endIsDangling=\"" << m_EndIsDangling << '"' << ">" <<
|
<< '"' << " endIsDangling=\""
|
||||||
" <start" << m_Start << "/>" <<
|
<< m_EndIsDangling << '"' << ">"
|
||||||
" <end" << m_End << "/>" <<
|
<< " <start" << m_Start << "/>"
|
||||||
"</" << GetClass().Lower().mb_str() << ">\n";
|
<< " <end" << m_End << "/>" << "</"
|
||||||
|
<< GetClass().Lower().mb_str() << ">\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
EDA_Rect EDA_DrawLineStruct::GetBoundingBox()
|
EDA_Rect SCH_LINE::GetBoundingBox()
|
||||||
{
|
{
|
||||||
int width = 25;
|
int width = 25;
|
||||||
|
|
||||||
|
@ -455,7 +454,7 @@ EDA_Rect EDA_DrawLineStruct::GetBoundingBox()
|
||||||
* @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 EDA_DrawLineStruct::Save( FILE* aFile ) const
|
bool SCH_LINE::Save( FILE* aFile ) const
|
||||||
{
|
{
|
||||||
bool success = true;
|
bool success = true;
|
||||||
|
|
||||||
|
@ -483,9 +482,9 @@ bool EDA_DrawLineStruct::Save( FILE* aFile ) const
|
||||||
/** 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 EDA_DrawLineStruct::GetPenSize()
|
int SCH_LINE::GetPenSize()
|
||||||
{
|
{
|
||||||
int pensize = (m_Width == 0) ? g_DrawDefaultLineThickness : m_Width;
|
int pensize = ( m_Width == 0 ) ? g_DrawDefaultLineThickness : m_Width;
|
||||||
|
|
||||||
if( m_Layer == LAYER_BUS && m_Width == 0 )
|
if( m_Layer == LAYER_BUS && m_Width == 0 )
|
||||||
{
|
{
|
||||||
|
@ -497,8 +496,8 @@ int EDA_DrawLineStruct::GetPenSize()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void EDA_DrawLineStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
|
void SCH_LINE::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
|
||||||
const wxPoint& offset, int DrawMode, int Color )
|
int DrawMode, int Color )
|
||||||
{
|
{
|
||||||
int color;
|
int color;
|
||||||
int width = GetPenSize();
|
int width = GetPenSize();
|
||||||
|
@ -527,11 +526,11 @@ void EDA_DrawLineStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/****************************/
|
/***********************/
|
||||||
/* Class DrawPolylineStruct */
|
/* Class SCH_POLYLINE */
|
||||||
/****************************/
|
/***********************/
|
||||||
|
|
||||||
DrawPolylineStruct::DrawPolylineStruct( int layer ) :
|
SCH_POLYLINE::SCH_POLYLINE( int layer ) :
|
||||||
SCH_ITEM( NULL, DRAW_POLYLINE_STRUCT_TYPE )
|
SCH_ITEM( NULL, DRAW_POLYLINE_STRUCT_TYPE )
|
||||||
{
|
{
|
||||||
m_Width = 0;
|
m_Width = 0;
|
||||||
|
@ -551,14 +550,14 @@ DrawPolylineStruct::DrawPolylineStruct( int layer ) :
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
DrawPolylineStruct::~DrawPolylineStruct()
|
SCH_POLYLINE::~SCH_POLYLINE()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
DrawPolylineStruct* DrawPolylineStruct::GenCopy()
|
SCH_POLYLINE* SCH_POLYLINE::GenCopy()
|
||||||
{
|
{
|
||||||
DrawPolylineStruct* newitem = new DrawPolylineStruct( m_Layer );
|
SCH_POLYLINE* newitem = new SCH_POLYLINE( m_Layer );
|
||||||
|
|
||||||
newitem->m_PolyPoints = m_PolyPoints; // std::vector copy
|
newitem->m_PolyPoints = m_PolyPoints; // std::vector copy
|
||||||
return newitem;
|
return newitem;
|
||||||
|
@ -571,7 +570,7 @@ DrawPolylineStruct* DrawPolylineStruct::GenCopy()
|
||||||
* @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 DrawPolylineStruct::Save( FILE* aFile ) const
|
bool SCH_POLYLINE::Save( FILE* aFile ) const
|
||||||
{
|
{
|
||||||
bool success = true;
|
bool success = true;
|
||||||
|
|
||||||
|
@ -604,16 +603,16 @@ bool DrawPolylineStruct::Save( FILE* aFile ) const
|
||||||
/** 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 DrawPolylineStruct::GetPenSize()
|
int SCH_POLYLINE::GetPenSize()
|
||||||
{
|
{
|
||||||
int pensize = (m_Width == 0) ? g_DrawDefaultLineThickness : m_Width;
|
int pensize = ( m_Width == 0 ) ? g_DrawDefaultLineThickness : m_Width;
|
||||||
|
|
||||||
return pensize;
|
return pensize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void DrawPolylineStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
|
void SCH_POLYLINE::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
|
||||||
const wxPoint& offset, int DrawMode, int Color )
|
const wxPoint& offset, int DrawMode, int Color )
|
||||||
{
|
{
|
||||||
int color;
|
int color;
|
||||||
int width = GetPenSize();
|
int width = GetPenSize();
|
||||||
|
|
|
@ -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:
|
||||||
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:
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
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:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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:
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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,20 +193,20 @@ 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,
|
||||||
int Color = -1 );
|
int Color = -1 );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function Save
|
* Function Save
|
||||||
|
@ -214,16 +215,17 @@ public:
|
||||||
* @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 Save( FILE* aFile ) const;
|
bool Save( FILE* aFile ) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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();
|
||||||
|
|
||||||
/** 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
|
||||||
|
@ -253,26 +255,26 @@ 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 );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function Save
|
* Function Save
|
||||||
|
@ -281,12 +283,12 @@ public:
|
||||||
* @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 Save( FILE* aFile ) const;
|
bool Save( FILE* aFile ) const;
|
||||||
|
|
||||||
/** Function AddPoint
|
/** Function AddPoint
|
||||||
* add a corner to m_PolyPoints
|
* add a corner to m_PolyPoints
|
||||||
*/
|
*/
|
||||||
void AddPoint( const wxPoint& point )
|
void AddPoint( const wxPoint& point )
|
||||||
{
|
{
|
||||||
m_PolyPoints.push_back( point );
|
m_PolyPoints.push_back( point );
|
||||||
}
|
}
|
||||||
|
@ -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,23 +354,23 @@ 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
|
||||||
*/
|
*/
|
||||||
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"
|
||||||
|
@ -376,7 +378,7 @@ public:
|
||||||
* @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 Save( FILE* aFile ) const;
|
bool Save( FILE* aFile ) const;
|
||||||
|
|
||||||
// Geometric transforms (used in block operations):
|
// Geometric transforms (used in block operations):
|
||||||
/** virtual function Move
|
/** virtual function Move
|
||||||
|
@ -400,7 +402,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(DEBUG)
|
#if defined(DEBUG)
|
||||||
void Show( int nestLevel, std::ostream& os );
|
void Show( int nestLevel, std::ostream& os );
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -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 )
|
||||||
{
|
{
|
||||||
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 )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************/
|
|
||||||
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 )
|
||||||
{
|
{
|
||||||
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 )
|
||||||
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 )
|
||||||
*/
|
*/
|
||||||
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 )
|
||||||
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 )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************/
|
|
||||||
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() )
|
||||||
|
@ -219,8 +211,8 @@ static int TstAlignSegment( EDA_DrawLineStruct* RefSegm,
|
||||||
{
|
{
|
||||||
if( atan2( (double) ( RefSegm->m_Start.x - RefSegm->m_End.x ),
|
if( atan2( (double) ( RefSegm->m_Start.x - RefSegm->m_End.x ),
|
||||||
(double) ( RefSegm->m_Start.y - RefSegm->m_End.y ) ) ==
|
(double) ( RefSegm->m_Start.y - RefSegm->m_End.y ) ) ==
|
||||||
atan2( (double) ( TstSegm->m_Start.x - TstSegm->m_End.x ),
|
atan2( (double) ( TstSegm->m_Start.x - TstSegm->m_End.x ),
|
||||||
(double) ( TstSegm->m_Start.y - TstSegm->m_End.y ) ) )
|
(double) ( TstSegm->m_Start.y - TstSegm->m_End.y ) ) )
|
||||||
{
|
{
|
||||||
RefSegm->m_End = TstSegm->m_End;
|
RefSegm->m_End = TstSegm->m_End;
|
||||||
return 1;
|
return 1;
|
||||||
|
|
|
@ -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(
|
||||||
*
|
*
|
||||||
* 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(
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
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(
|
||||||
*
|
*
|
||||||
* 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(
|
||||||
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(
|
||||||
}
|
}
|
||||||
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 );
|
||||||
|
|
||||||
|
@ -181,7 +178,7 @@ SCH_ITEM* WinEDA_SchematicFrame::SchematicGeneralLocateAndDisplay(
|
||||||
|
|
||||||
/* search for a pin */
|
/* search for a pin */
|
||||||
Pin = LocateAnyPin( (SCH_ITEM*) m_CurrentSheet->LastDrawList(), refpoint,
|
Pin = LocateAnyPin( (SCH_ITEM*) m_CurrentSheet->LastDrawList(), refpoint,
|
||||||
&LibItem );
|
&LibItem );
|
||||||
if( Pin )
|
if( Pin )
|
||||||
{
|
{
|
||||||
Pin->DisplayInfo( this );
|
Pin->DisplayInfo( this );
|
||||||
|
@ -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:
|
||||||
|
|
||||||
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 )
|
||||||
|
|
||||||
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,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************/
|
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,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/********************************************************/
|
|
||||||
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 )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************/
|
|
||||||
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 )
|
||||||
|
|
||||||
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 )
|
||||||
|
|
||||||
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 )
|
||||||
|
|
||||||
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;
|
||||||
|
|
|
@ -43,7 +43,7 @@ static int CountConnectedItems( WinEDA_SchematicFrame* frame,
|
||||||
|
|
||||||
if( TstJunction && ( Struct->Type() == DRAW_JUNCTION_STRUCT_TYPE ) )
|
if( TstJunction && ( Struct->Type() == DRAW_JUNCTION_STRUCT_TYPE ) )
|
||||||
{
|
{
|
||||||
#define JUNCTION ( (DrawJunctionStruct*) Struct )
|
#define JUNCTION ( (SCH_JUNCTION*) Struct )
|
||||||
if( JUNCTION->m_Pos == pos )
|
if( JUNCTION->m_Pos == pos )
|
||||||
count++;
|
count++;
|
||||||
#undef JUNCTION
|
#undef JUNCTION
|
||||||
|
@ -52,7 +52,7 @@ static int CountConnectedItems( WinEDA_SchematicFrame* frame,
|
||||||
if( Struct->Type() != DRAW_SEGMENT_STRUCT_TYPE )
|
if( Struct->Type() != DRAW_SEGMENT_STRUCT_TYPE )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
#define SEGM ( (EDA_DrawLineStruct*) Struct )
|
#define SEGM ( (SCH_LINE*) Struct )
|
||||||
if( SEGM->IsOneEndPointAt( pos ) )
|
if( SEGM->IsOneEndPointAt( pos ) )
|
||||||
count++;
|
count++;
|
||||||
#undef SEGM
|
#undef SEGM
|
||||||
|
@ -71,7 +71,7 @@ static int CountConnectedItems( WinEDA_SchematicFrame* frame,
|
||||||
* Used by WinEDA_SchematicFrame::DeleteConnection()
|
* Used by WinEDA_SchematicFrame::DeleteConnection()
|
||||||
*/
|
*/
|
||||||
static bool MarkConnected( WinEDA_SchematicFrame* frame, SCH_ITEM* ListStruct,
|
static bool MarkConnected( WinEDA_SchematicFrame* frame, SCH_ITEM* ListStruct,
|
||||||
EDA_DrawLineStruct* segment )
|
SCH_LINE* segment )
|
||||||
{
|
{
|
||||||
EDA_BaseStruct* Struct;
|
EDA_BaseStruct* Struct;
|
||||||
|
|
||||||
|
@ -81,7 +81,7 @@ static bool MarkConnected( WinEDA_SchematicFrame* frame, SCH_ITEM* ListStruct,
|
||||||
continue;
|
continue;
|
||||||
if( Struct->Type() == DRAW_JUNCTION_STRUCT_TYPE )
|
if( Struct->Type() == DRAW_JUNCTION_STRUCT_TYPE )
|
||||||
{
|
{
|
||||||
#define JUNCTION ( (DrawJunctionStruct*) Struct )
|
#define JUNCTION ( (SCH_JUNCTION*) Struct )
|
||||||
if( segment->IsOneEndPointAt( JUNCTION->m_Pos ) )
|
if( segment->IsOneEndPointAt( JUNCTION->m_Pos ) )
|
||||||
Struct->m_Flags |= CANDIDATE;
|
Struct->m_Flags |= CANDIDATE;
|
||||||
continue;
|
continue;
|
||||||
|
@ -91,7 +91,7 @@ static bool MarkConnected( WinEDA_SchematicFrame* frame, SCH_ITEM* ListStruct,
|
||||||
if( Struct->Type() != DRAW_SEGMENT_STRUCT_TYPE )
|
if( Struct->Type() != DRAW_SEGMENT_STRUCT_TYPE )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
#define SEGM ( (EDA_DrawLineStruct*) Struct )
|
#define SEGM ( (SCH_LINE*) Struct )
|
||||||
if( segment->IsOneEndPointAt( SEGM->m_Start ) )
|
if( segment->IsOneEndPointAt( SEGM->m_Start ) )
|
||||||
{
|
{
|
||||||
if( !frame->LocatePinEnd( ListStruct, SEGM->m_Start ) )
|
if( !frame->LocatePinEnd( ListStruct, SEGM->m_Start ) )
|
||||||
|
@ -167,7 +167,7 @@ void WinEDA_SchematicFrame::DeleteConnection( bool DeleteFullConnection )
|
||||||
if( !(DelStruct->m_Flags & SELECTEDNODE) )
|
if( !(DelStruct->m_Flags & SELECTEDNODE) )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
#define SEGM ( (EDA_DrawLineStruct*) DelStruct )
|
#define SEGM ( (SCH_LINE*) DelStruct )
|
||||||
if( DelStruct->Type() != DRAW_SEGMENT_STRUCT_TYPE )
|
if( DelStruct->Type() != DRAW_SEGMENT_STRUCT_TYPE )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -191,7 +191,7 @@ void WinEDA_SchematicFrame::DeleteConnection( bool DeleteFullConnection )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
DelStruct->m_Flags |= SKIP_STRUCT;
|
DelStruct->m_Flags |= SKIP_STRUCT;
|
||||||
#define SEGM ( (EDA_DrawLineStruct*) DelStruct )
|
#define SEGM ( (SCH_LINE*) DelStruct )
|
||||||
|
|
||||||
/* Test the SEGM->m_Start point: if this point was connected to
|
/* Test the SEGM->m_Start point: if this point was connected to
|
||||||
* an STRUCT_DELETED wire, and now is not connected, the wire can
|
* an STRUCT_DELETED wire, and now is not connected, the wire can
|
||||||
|
@ -207,7 +207,7 @@ void WinEDA_SchematicFrame::DeleteConnection( bool DeleteFullConnection )
|
||||||
if( removed_struct->Type() != DRAW_SEGMENT_STRUCT_TYPE )
|
if( removed_struct->Type() != DRAW_SEGMENT_STRUCT_TYPE )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
#define WIRE ( (EDA_DrawLineStruct*) removed_struct )
|
#define WIRE ( (SCH_LINE*) removed_struct )
|
||||||
if( WIRE->IsOneEndPointAt( SEGM->m_Start ) )
|
if( WIRE->IsOneEndPointAt( SEGM->m_Start ) )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -265,7 +265,7 @@ void WinEDA_SchematicFrame::DeleteConnection( bool DeleteFullConnection )
|
||||||
|
|
||||||
if( DelStruct->Type() == DRAW_JUNCTION_STRUCT_TYPE )
|
if( DelStruct->Type() == DRAW_JUNCTION_STRUCT_TYPE )
|
||||||
{
|
{
|
||||||
#define JUNCTION ( (DrawJunctionStruct*) DelStruct )
|
#define JUNCTION ( (SCH_JUNCTION*) DelStruct )
|
||||||
count = CountConnectedItems( this, GetScreen()->EEDrawList,
|
count = CountConnectedItems( this, GetScreen()->EEDrawList,
|
||||||
JUNCTION->m_Pos, FALSE );
|
JUNCTION->m_Pos, FALSE );
|
||||||
if( count <= 2 )
|
if( count <= 2 )
|
||||||
|
@ -441,7 +441,7 @@ void EraseStruct( SCH_ITEM* DrawStruct, SCH_SCREEN* Screen )
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else // structure usuelle */
|
else
|
||||||
{
|
{
|
||||||
if( DrawStruct == Screen->EEDrawList )
|
if( DrawStruct == Screen->EEDrawList )
|
||||||
{
|
{
|
||||||
|
@ -470,7 +470,7 @@ void DeleteAllMarkers( int type )
|
||||||
{
|
{
|
||||||
SCH_SCREEN* screen;
|
SCH_SCREEN* screen;
|
||||||
SCH_ITEM * DrawStruct, * NextStruct;
|
SCH_ITEM * DrawStruct, * NextStruct;
|
||||||
MARKER_SCH* Marker;
|
SCH_MARKER* Marker;
|
||||||
|
|
||||||
EDA_ScreenList ScreenList;
|
EDA_ScreenList ScreenList;
|
||||||
|
|
||||||
|
@ -481,10 +481,10 @@ void DeleteAllMarkers( int type )
|
||||||
DrawStruct = NextStruct )
|
DrawStruct = NextStruct )
|
||||||
{
|
{
|
||||||
NextStruct = DrawStruct->Next();
|
NextStruct = DrawStruct->Next();
|
||||||
if( DrawStruct->Type() != TYPE_MARKER_SCH )
|
if( DrawStruct->Type() != TYPE_SCH_MARKER )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
Marker = (MARKER_SCH*) DrawStruct;
|
Marker = (SCH_MARKER*) DrawStruct;
|
||||||
if( Marker->GetMarkerType() != type )
|
if( Marker->GetMarkerType() != type )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
// Name: dialog_svg_print.cpp
|
// Name: dialog_svg_print.cpp
|
||||||
// Author: jean-pierre Charras
|
// Author: jean-pierre Charras
|
||||||
// Modified by:
|
// Modified by:
|
||||||
|
@ -52,16 +51,15 @@ private:
|
||||||
void OnSetColorModeSelected( wxCommandEvent& event );
|
void OnSetColorModeSelected( wxCommandEvent& event );
|
||||||
void SetPenWidth();
|
void SetPenWidth();
|
||||||
void PrintSVGDoc( bool aPrintAll, bool aPrint_Sheet_Ref );
|
void PrintSVGDoc( bool aPrintAll, bool aPrint_Sheet_Ref );
|
||||||
bool DrawPage( const wxString& FullFileName, BASE_SCREEN* screen, bool aPrint_Sheet_Ref );
|
bool DrawPage( const wxString& FullFileName, BASE_SCREEN* screen,
|
||||||
|
bool aPrint_Sheet_Ref );
|
||||||
};
|
};
|
||||||
|
|
||||||
/*******************************************************/
|
|
||||||
void WinEDA_DrawFrame::SVG_Print( wxCommandEvent& event )
|
|
||||||
/*******************************************************/
|
|
||||||
|
|
||||||
/* Prepare les structures de donnees de gestion de l'impression
|
/* Prepare the data structures of print management and display the dialog
|
||||||
* et affiche la fenetre de dialogue de gestion de l'impression des feuilles
|
* window for printing sheets.
|
||||||
*/
|
*/
|
||||||
|
void WinEDA_DrawFrame::SVG_Print( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
DIALOG_SVG_PRINT frame( this );
|
DIALOG_SVG_PRINT frame( this );
|
||||||
|
|
||||||
|
@ -80,9 +78,7 @@ DIALOG_SVG_PRINT::DIALOG_SVG_PRINT( WinEDA_DrawFrame* parent )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************/
|
|
||||||
void DIALOG_SVG_PRINT::OnInitDialog( wxInitDialogEvent& event )
|
void DIALOG_SVG_PRINT::OnInitDialog( wxInitDialogEvent& event )
|
||||||
/*************************************************************/
|
|
||||||
{
|
{
|
||||||
SetFocus(); // Make ESC key working
|
SetFocus(); // Make ESC key working
|
||||||
|
|
||||||
|
@ -94,7 +90,8 @@ void DIALOG_SVG_PRINT::OnInitDialog( wxInitDialogEvent& event )
|
||||||
|
|
||||||
AddUnitSymbol(* m_TextPenWidth, g_UnitMetric );
|
AddUnitSymbol(* m_TextPenWidth, g_UnitMetric );
|
||||||
m_DialogPenWidth->SetValue(
|
m_DialogPenWidth->SetValue(
|
||||||
ReturnStringFromValue(g_UnitMetric, g_DrawDefaultLineThickness, m_Parent->m_InternalUnits ) );
|
ReturnStringFromValue(g_UnitMetric, g_DrawDefaultLineThickness,
|
||||||
|
m_Parent->m_InternalUnits ) );
|
||||||
m_Print_Sheet_Ref->SetValue( s_Print_Frame_Ref );
|
m_Print_Sheet_Ref->SetValue( s_Print_Frame_Ref );
|
||||||
if (GetSizer())
|
if (GetSizer())
|
||||||
{
|
{
|
||||||
|
@ -103,11 +100,10 @@ void DIALOG_SVG_PRINT::OnInitDialog( wxInitDialogEvent& event )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/********************************************/
|
|
||||||
void DIALOG_SVG_PRINT::SetPenWidth()
|
void DIALOG_SVG_PRINT::SetPenWidth()
|
||||||
/********************************************/
|
|
||||||
{
|
{
|
||||||
g_DrawDefaultLineThickness = ReturnValueFromTextCtrl( *m_DialogPenWidth, m_Parent->m_InternalUnits );
|
g_DrawDefaultLineThickness =
|
||||||
|
ReturnValueFromTextCtrl( *m_DialogPenWidth, m_Parent->m_InternalUnits );
|
||||||
|
|
||||||
if( g_DrawDefaultLineThickness > WIDTH_MAX_VALUE )
|
if( g_DrawDefaultLineThickness > WIDTH_MAX_VALUE )
|
||||||
{
|
{
|
||||||
|
@ -120,13 +116,12 @@ void DIALOG_SVG_PRINT::SetPenWidth()
|
||||||
}
|
}
|
||||||
|
|
||||||
m_DialogPenWidth->SetValue(
|
m_DialogPenWidth->SetValue(
|
||||||
ReturnStringFromValue(g_UnitMetric, g_DrawDefaultLineThickness, m_Parent->m_InternalUnits ) );
|
ReturnStringFromValue( g_UnitMetric, g_DrawDefaultLineThickness,
|
||||||
|
m_Parent->m_InternalUnits ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************/
|
|
||||||
void DIALOG_SVG_PRINT::PrintSVGDoc( bool aPrintAll, bool aPrint_Sheet_Ref )
|
void DIALOG_SVG_PRINT::PrintSVGDoc( bool aPrintAll, bool aPrint_Sheet_Ref )
|
||||||
/***************************************************************************/
|
|
||||||
{
|
{
|
||||||
wxString msg;
|
wxString msg;
|
||||||
wxFileName fn;
|
wxFileName fn;
|
||||||
|
@ -138,13 +133,13 @@ void DIALOG_SVG_PRINT::PrintSVGDoc( bool aPrintAll, bool aPrint_Sheet_Ref )
|
||||||
|
|
||||||
if( aPrintAll && m_Parent->m_Ident == SCHEMATIC_FRAME )
|
if( aPrintAll && m_Parent->m_Ident == SCHEMATIC_FRAME )
|
||||||
{
|
{
|
||||||
WinEDA_SchematicFrame* schframe = (WinEDA_SchematicFrame*) m_Parent;
|
WinEDA_SchematicFrame* schframe = (WinEDA_SchematicFrame*) m_Parent;
|
||||||
DrawSheetPath* sheetpath, *oldsheetpath = schframe->GetSheet();
|
SCH_SHEET_PATH* sheetpath, *oldsheetpath = schframe->GetSheet();
|
||||||
SCH_SCREEN* schscreen = schframe->GetScreen();
|
SCH_SCREEN* schscreen = schframe->GetScreen();
|
||||||
oldscreen = schscreen;
|
oldscreen = schscreen;
|
||||||
EDA_SheetList SheetList( NULL );
|
SCH_SHEET_LIST SheetList( NULL );
|
||||||
sheetpath = SheetList.GetFirst();
|
sheetpath = SheetList.GetFirst();
|
||||||
DrawSheetPath list;
|
SCH_SHEET_PATH list;
|
||||||
|
|
||||||
for( ; ; )
|
for( ; ; )
|
||||||
{
|
{
|
||||||
|
@ -195,18 +190,14 @@ void DIALOG_SVG_PRINT::PrintSVGDoc( bool aPrintAll, bool aPrint_Sheet_Ref )
|
||||||
msg += wxT( "\n" );
|
msg += wxT( "\n" );
|
||||||
m_MessagesBox->AppendText( msg );
|
m_MessagesBox->AppendText( msg );
|
||||||
}
|
}
|
||||||
|
|
||||||
ActiveScreen = oldscreen;
|
ActiveScreen = oldscreen;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************/
|
bool DIALOG_SVG_PRINT::DrawPage( const wxString& FullFileName,
|
||||||
bool DIALOG_SVG_PRINT::DrawPage( const wxString& FullFileName, BASE_SCREEN* screen
|
BASE_SCREEN* screen,
|
||||||
, bool aPrint_Sheet_Ref)
|
bool aPrint_Sheet_Ref)
|
||||||
/*****************************************************************/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Routine effective d'impression
|
|
||||||
*/
|
|
||||||
{
|
{
|
||||||
int tmpzoom;
|
int tmpzoom;
|
||||||
wxPoint tmp_startvisu;
|
wxPoint tmp_startvisu;
|
||||||
|
@ -215,7 +206,6 @@ bool DIALOG_SVG_PRINT::DrawPage( const wxString& FullFileName, BASE_SCREEN* scre
|
||||||
float dpi;
|
float dpi;
|
||||||
bool success = true;
|
bool success = true;
|
||||||
|
|
||||||
/* modification des cadrages et reglages locaux */
|
|
||||||
tmp_startvisu = screen->m_StartVisu;
|
tmp_startvisu = screen->m_StartVisu;
|
||||||
tmpzoom = screen->GetZoom();
|
tmpzoom = screen->GetZoom();
|
||||||
old_org = screen->m_DrawOrg;
|
old_org = screen->m_DrawOrg;
|
||||||
|
@ -234,18 +224,22 @@ bool DIALOG_SVG_PRINT::DrawPage( const wxString& FullFileName, BASE_SCREEN* scre
|
||||||
|
|
||||||
EDA_Rect tmp = panel->m_ClipBox;
|
EDA_Rect tmp = panel->m_ClipBox;
|
||||||
GRResetPenAndBrush( &dc );
|
GRResetPenAndBrush( &dc );
|
||||||
g_DrawDefaultLineThickness = ReturnValueFromTextCtrl( *m_DialogPenWidth, m_Parent->m_InternalUnits );
|
g_DrawDefaultLineThickness =
|
||||||
|
ReturnValueFromTextCtrl( *m_DialogPenWidth, m_Parent->m_InternalUnits );
|
||||||
SetPenMinWidth( g_DrawDefaultLineThickness );
|
SetPenMinWidth( g_DrawDefaultLineThickness );
|
||||||
GRForceBlackPen( m_ModeColorOption->GetSelection() == 0 ? FALSE : true );
|
GRForceBlackPen( m_ModeColorOption->GetSelection() == 0 ? FALSE : true );
|
||||||
|
|
||||||
|
|
||||||
panel->m_ClipBox.SetX( 0 ); panel->m_ClipBox.SetY( 0 );
|
panel->m_ClipBox.SetX( 0 );
|
||||||
panel->m_ClipBox.SetWidth( 0x7FFFFF0 ); panel->m_ClipBox.SetHeight( 0x7FFFFF0 );
|
panel->m_ClipBox.SetY( 0 );
|
||||||
|
panel->m_ClipBox.SetWidth( 0x7FFFFF0 );
|
||||||
|
panel->m_ClipBox.SetHeight( 0x7FFFFF0 );
|
||||||
|
|
||||||
screen->m_IsPrinting = true;
|
screen->m_IsPrinting = true;
|
||||||
SetLocaleTo_C_standard( ); // Switch the locale to standard C (needed to print floating point numbers like 1.3)
|
SetLocaleTo_C_standard( ); // Switch the locale to standard C (needed
|
||||||
|
// to print floating point numbers like 1.3)
|
||||||
panel->PrintPage( &dc, aPrint_Sheet_Ref, 1, false );
|
panel->PrintPage( &dc, aPrint_Sheet_Ref, 1, false );
|
||||||
SetLocaleTo_Default( ); // revert to the current locale
|
SetLocaleTo_Default( ); // revert to the current locale
|
||||||
screen->m_IsPrinting = false;
|
screen->m_IsPrinting = false;
|
||||||
panel->m_ClipBox = tmp;
|
panel->m_ClipBox = tmp;
|
||||||
|
|
||||||
|
@ -261,32 +255,24 @@ bool DIALOG_SVG_PRINT::DrawPage( const wxString& FullFileName, BASE_SCREEN* scre
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/********************************************************************/
|
|
||||||
void DIALOG_SVG_PRINT::OnButtonPlotAllClick( wxCommandEvent& event )
|
void DIALOG_SVG_PRINT::OnButtonPlotAllClick( wxCommandEvent& event )
|
||||||
/********************************************************************/
|
|
||||||
{
|
{
|
||||||
PrintSVGDoc( true, m_Print_Sheet_Ref->GetValue() );
|
PrintSVGDoc( true, m_Print_Sheet_Ref->GetValue() );
|
||||||
}
|
}
|
||||||
|
|
||||||
/********************************************************************/
|
|
||||||
void DIALOG_SVG_PRINT::OnButtonPlotCurrentClick( wxCommandEvent& event )
|
void DIALOG_SVG_PRINT::OnButtonPlotCurrentClick( wxCommandEvent& event )
|
||||||
/********************************************************************/
|
|
||||||
{
|
{
|
||||||
PrintSVGDoc( false, m_Print_Sheet_Ref->GetValue() );
|
PrintSVGDoc( false, m_Print_Sheet_Ref->GetValue() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************/
|
|
||||||
void DIALOG_SVG_PRINT::OnButtonCancelClick( wxCommandEvent& event )
|
void DIALOG_SVG_PRINT::OnButtonCancelClick( wxCommandEvent& event )
|
||||||
/******************************************************************/
|
|
||||||
{
|
{
|
||||||
Close( );
|
Close( );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************/
|
|
||||||
void DIALOG_SVG_PRINT::OnCloseWindow( wxCloseEvent& event )
|
void DIALOG_SVG_PRINT::OnCloseWindow( wxCloseEvent& event )
|
||||||
/***********************************************************/
|
|
||||||
{
|
{
|
||||||
if( m_Config )
|
if( m_Config )
|
||||||
{
|
{
|
||||||
|
@ -296,11 +282,10 @@ void DIALOG_SVG_PRINT::OnCloseWindow( wxCloseEvent& event )
|
||||||
EndModal( 0 );
|
EndModal( 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*********************************************************************/
|
|
||||||
void DIALOG_SVG_PRINT::OnSetColorModeSelected( wxCommandEvent& event )
|
|
||||||
/*********************************************************************/
|
|
||||||
/* called on radiobox color/black and white selection
|
/* called on radiobox color/black and white selection
|
||||||
*/
|
*/
|
||||||
|
void DIALOG_SVG_PRINT::OnSetColorModeSelected( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
s_PlotBlackAndWhite = m_ModeColorOption->GetSelection();
|
s_PlotBlackAndWhite = m_ModeColorOption->GetSelection();
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,10 +22,8 @@ int DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::s_SelectedRow;
|
||||||
wxSize DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::s_LastSize = wxDefaultSize;
|
wxSize DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::s_LastSize = wxDefaultSize;
|
||||||
|
|
||||||
|
|
||||||
/**********************************************************************/
|
|
||||||
void InstallCmpeditFrame( WinEDA_SchematicFrame* parent, wxPoint& pos,
|
void InstallCmpeditFrame( WinEDA_SchematicFrame* parent, wxPoint& pos,
|
||||||
SCH_COMPONENT* aComponent )
|
SCH_COMPONENT* aComponent )
|
||||||
/*********************************************************************/
|
|
||||||
{
|
{
|
||||||
if( aComponent == NULL ) // Null component not accepted
|
if( aComponent == NULL ) // Null component not accepted
|
||||||
return;
|
return;
|
||||||
|
@ -34,7 +32,7 @@ void InstallCmpeditFrame( WinEDA_SchematicFrame* parent, wxPoint& pos,
|
||||||
if( aComponent->Type() != TYPE_SCH_COMPONENT )
|
if( aComponent->Type() != TYPE_SCH_COMPONENT )
|
||||||
{
|
{
|
||||||
DisplayError( parent,
|
DisplayError( parent,
|
||||||
wxT( "InstallCmpeditFrame() error: This item is not a component" ) );
|
wxT( "InstallCmpeditFrame() error: This item is not a component" ) );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -46,20 +44,24 @@ void InstallCmpeditFrame( WinEDA_SchematicFrame* parent, wxPoint& pos,
|
||||||
wxSize sizeNow = dialog->GetSize();
|
wxSize sizeNow = dialog->GetSize();
|
||||||
|
|
||||||
// this relies on wxDefaultSize being -1,-1, be careful here.
|
// this relies on wxDefaultSize being -1,-1, be careful here.
|
||||||
if( sizeNow.GetWidth() < DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::s_LastSize.GetWidth()
|
if( sizeNow.GetWidth()
|
||||||
|| sizeNow.GetHeight() < DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::s_LastSize.GetHeight() )
|
< DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::s_LastSize.GetWidth()
|
||||||
|
|| sizeNow.GetHeight()
|
||||||
|
< DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::s_LastSize.GetHeight() )
|
||||||
{
|
{
|
||||||
dialog->SetSize( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::s_LastSize );
|
dialog->SetSize( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::s_LastSize );
|
||||||
}
|
}
|
||||||
|
|
||||||
// make sure the chipnameTextCtrl is wide enough to hold any unusually long chip names:
|
// make sure the chipnameTextCtrl is wide enough to hold any
|
||||||
|
// unusually long chip names:
|
||||||
EnsureTextCtrlWidth( dialog->chipnameTextCtrl );
|
EnsureTextCtrlWidth( dialog->chipnameTextCtrl );
|
||||||
|
|
||||||
dialog->ShowModal();
|
dialog->ShowModal();
|
||||||
|
|
||||||
// Some of the field values are long and are not always fully visible
|
// Some of the field values are long and are not always fully visible
|
||||||
// because the window comes up too narrow.
|
// because the window comes up too narrow.
|
||||||
// Remember user's manual window resizing efforts here so it comes up wide enough next time.
|
// Remember user's manual window resizing efforts here so it comes up
|
||||||
|
// wide enough next time.
|
||||||
DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::s_LastSize = dialog->GetSize();
|
DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::s_LastSize = dialog->GetSize();
|
||||||
|
|
||||||
dialog->Destroy();
|
dialog->Destroy();
|
||||||
|
@ -113,9 +115,7 @@ DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC( wxWindow
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************/
|
|
||||||
void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::reinitializeFieldsIdAndDefaultNames( )
|
void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::reinitializeFieldsIdAndDefaultNames( )
|
||||||
/*****************************************************************************/
|
|
||||||
{
|
{
|
||||||
for( unsigned new_id = FIELD1; new_id < m_FieldsBuf.size(); new_id++ )
|
for( unsigned new_id = FIELD1; new_id < m_FieldsBuf.size(); new_id++ )
|
||||||
{
|
{
|
||||||
|
@ -183,7 +183,8 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyPanelToOptions()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// For components with multiple shapes (De Morgan representation) Set the selected shape:
|
// For components with multiple shapes (De Morgan representation) Set the
|
||||||
|
// selected shape:
|
||||||
if( convertCheckBox->IsEnabled() )
|
if( convertCheckBox->IsEnabled() )
|
||||||
{
|
{
|
||||||
m_Cmp->m_Convert = convertCheckBox->GetValue() ? 2 : 1;
|
m_Cmp->m_Convert = convertCheckBox->GetValue() ? 2 : 1;
|
||||||
|
@ -289,9 +290,9 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::addFieldButtonHandler( wxCommandEvent&
|
||||||
if( !copyPanelToSelectedField() )
|
if( !copyPanelToSelectedField() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
unsigned fieldNdx = m_FieldsBuf.size();
|
unsigned fieldNdx = m_FieldsBuf.size();
|
||||||
|
|
||||||
SCH_CMP_FIELD blank( wxPoint(), fieldNdx, m_Cmp );
|
SCH_FIELD blank( wxPoint(), fieldNdx, m_Cmp );
|
||||||
|
|
||||||
blank.m_Orient = m_FieldsBuf[REFERENCE].m_Orient;
|
blank.m_Orient = m_FieldsBuf[REFERENCE].m_Orient;
|
||||||
|
|
||||||
|
@ -353,7 +354,7 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC:: moveUpButtonHandler( wxCommandEvent& e
|
||||||
|
|
||||||
// swap the fieldNdx field with the one before it, in both the vector
|
// swap the fieldNdx field with the one before it, in both the vector
|
||||||
// and in the fieldListCtrl
|
// and in the fieldListCtrl
|
||||||
SCH_CMP_FIELD tmp = m_FieldsBuf[fieldNdx - 1];
|
SCH_FIELD tmp = m_FieldsBuf[fieldNdx - 1];
|
||||||
|
|
||||||
D( printf( "tmp.m_Text=\"%s\" tmp.m_Name=\"%s\"\n",
|
D( printf( "tmp.m_Text=\"%s\" tmp.m_Name=\"%s\"\n",
|
||||||
CONV_TO_UTF8( tmp.m_Text ), CONV_TO_UTF8( tmp.m_Name ) ); )
|
CONV_TO_UTF8( tmp.m_Text ), CONV_TO_UTF8( tmp.m_Name ) ); )
|
||||||
|
@ -376,8 +377,10 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC:: moveUpButtonHandler( wxCommandEvent& e
|
||||||
|
|
||||||
void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::setSelectedFieldNdx( int aFieldNdx )
|
void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::setSelectedFieldNdx( int aFieldNdx )
|
||||||
{
|
{
|
||||||
/* deselect old selection, but I think this is done by single selection flag within fieldListCtrl
|
/* deselect old selection, but I think this is done by single selection
|
||||||
* fieldListCtrl->SetItemState( s_SelectedRow, 0, wxLIST_STATE_SELECTED|wxLIST_STATE_FOCUSED);
|
* flag within fieldListCtrl.
|
||||||
|
* fieldListCtrl->SetItemState( s_SelectedRow, 0,
|
||||||
|
* wxLIST_STATE_SELECTED|wxLIST_STATE_FOCUSED);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if( aFieldNdx >= (int) m_FieldsBuf.size() )
|
if( aFieldNdx >= (int) m_FieldsBuf.size() )
|
||||||
|
@ -400,14 +403,13 @@ int DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::getSelectedFieldNdx()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static bool SortFieldsById(const SCH_CMP_FIELD& item1, const SCH_CMP_FIELD& item2)
|
static bool SortFieldsById(const SCH_FIELD& item1, const SCH_FIELD& item2)
|
||||||
{
|
{
|
||||||
return item1.m_FieldId < item2.m_FieldId;
|
return item1.m_FieldId < item2.m_FieldId;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*******************************************************************************/
|
|
||||||
void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::InitBuffers( SCH_COMPONENT* aComponent )
|
void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::InitBuffers( SCH_COMPONENT* aComponent )
|
||||||
/*******************************************************************************/
|
|
||||||
{
|
{
|
||||||
m_Cmp = aComponent;
|
m_Cmp = aComponent;
|
||||||
|
|
||||||
|
@ -466,7 +468,8 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::InitBuffers( SCH_COMPONENT* aComponent
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::setRowItem( int aFieldNdx, const SCH_CMP_FIELD& aField )
|
void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::setRowItem( int aFieldNdx,
|
||||||
|
const SCH_FIELD& aField )
|
||||||
{
|
{
|
||||||
wxASSERT( aFieldNdx >= 0 );
|
wxASSERT( aFieldNdx >= 0 );
|
||||||
|
|
||||||
|
@ -489,16 +492,14 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::setRowItem( int aFieldNdx, const SCH_CM
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************/
|
|
||||||
void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copySelectedFieldToPanel()
|
void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copySelectedFieldToPanel()
|
||||||
/****************************************************************/
|
|
||||||
{
|
{
|
||||||
unsigned fieldNdx = getSelectedFieldNdx();
|
unsigned fieldNdx = getSelectedFieldNdx();
|
||||||
|
|
||||||
if( fieldNdx >= m_FieldsBuf.size() ) // traps the -1 case too
|
if( fieldNdx >= m_FieldsBuf.size() ) // traps the -1 case too
|
||||||
return;
|
return;
|
||||||
|
|
||||||
SCH_CMP_FIELD& field = m_FieldsBuf[fieldNdx];
|
SCH_FIELD& field = m_FieldsBuf[fieldNdx];
|
||||||
|
|
||||||
showCheckBox->SetValue( !(field.m_Attributs & TEXT_NO_VISIBLE) );
|
showCheckBox->SetValue( !(field.m_Attributs & TEXT_NO_VISIBLE) );
|
||||||
|
|
||||||
|
@ -513,62 +514,67 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copySelectedFieldToPanel()
|
||||||
|
|
||||||
fieldNameTextCtrl->SetValue( field.m_Name );
|
fieldNameTextCtrl->SetValue( field.m_Name );
|
||||||
|
|
||||||
// if fieldNdx == REFERENCE, VALUE, FOOTPRINT, or DATASHEET, then disable editing
|
// if fieldNdx == REFERENCE, VALUE, FOOTPRINT, or DATASHEET, then
|
||||||
|
//disable editing
|
||||||
fieldNameTextCtrl->Enable( fieldNdx >= FIELD1 );
|
fieldNameTextCtrl->Enable( fieldNdx >= FIELD1 );
|
||||||
fieldNameTextCtrl->SetEditable( fieldNdx >= FIELD1 );
|
fieldNameTextCtrl->SetEditable( fieldNdx >= FIELD1 );
|
||||||
moveUpButton->Enable( fieldNdx >= FIELD1 ); // disable move up button for non moveable fields
|
moveUpButton->Enable( fieldNdx >= FIELD1 ); /* disable move up button
|
||||||
|
* for non moveable fields */
|
||||||
// if fieldNdx == REFERENCE, VALUE, then disable delete button
|
// if fieldNdx == REFERENCE, VALUE, then disable delete button
|
||||||
deleteFieldButton->Enable( fieldNdx > VALUE );
|
deleteFieldButton->Enable( fieldNdx > VALUE );
|
||||||
|
|
||||||
fieldValueTextCtrl->SetValue( field.m_Text );
|
fieldValueTextCtrl->SetValue( field.m_Text );
|
||||||
|
|
||||||
// For power symbols, the value is NOR editable, because value and pin name must be same
|
// For power symbols, the value is NOR editable, because value and pin
|
||||||
// and can be edited only in library editor
|
// name must be same and can be edited only in library editor
|
||||||
if( fieldNdx == VALUE && m_LibEntry && m_LibEntry->m_Options == ENTRY_POWER )
|
if( fieldNdx == VALUE && m_LibEntry && m_LibEntry->m_Options == ENTRY_POWER )
|
||||||
fieldValueTextCtrl->Enable( false );
|
fieldValueTextCtrl->Enable( false );
|
||||||
else
|
else
|
||||||
fieldValueTextCtrl->Enable( true );
|
fieldValueTextCtrl->Enable( true );
|
||||||
|
|
||||||
textSizeTextCtrl->SetValue(
|
textSizeTextCtrl->SetValue(
|
||||||
WinEDA_GraphicTextCtrl::FormatSize( EESCHEMA_INTERNAL_UNIT, g_UnitMetric, field.m_Size.x ) );
|
WinEDA_GraphicTextCtrl::FormatSize( EESCHEMA_INTERNAL_UNIT,
|
||||||
|
g_UnitMetric, field.m_Size.x ) );
|
||||||
|
|
||||||
wxPoint coord = field.m_Pos;
|
wxPoint coord = field.m_Pos;
|
||||||
wxPoint zero = -m_Cmp->m_Pos; // relative zero
|
wxPoint zero = -m_Cmp->m_Pos; // relative zero
|
||||||
|
|
||||||
// If the field value is empty and the position is at relative zero, we set the
|
// If the field value is empty and the position is at relative zero, we
|
||||||
// initial position as a small offset from the ref field, and orient
|
// set the initial position as a small offset from the ref field, and
|
||||||
// it the same as the ref field. That is likely to put it at least
|
// orient it the same as the ref field. That is likely to put it at least
|
||||||
// close to the desired position.
|
// close to the desired position.
|
||||||
if( coord == zero && field.m_Text.IsEmpty() )
|
if( coord == zero && field.m_Text.IsEmpty() )
|
||||||
{
|
{
|
||||||
rotateCheckBox->SetValue( m_FieldsBuf[REFERENCE].m_Orient == TEXT_ORIENT_VERT );
|
rotateCheckBox->SetValue( m_FieldsBuf[REFERENCE].m_Orient == TEXT_ORIENT_VERT );
|
||||||
|
|
||||||
coord.x = m_FieldsBuf[REFERENCE].m_Pos.x + (fieldNdx - FIELD1 + 1) * 100;
|
coord.x = m_FieldsBuf[REFERENCE].m_Pos.x
|
||||||
coord.y = m_FieldsBuf[REFERENCE].m_Pos.y + (fieldNdx - FIELD1 + 1) * 100;
|
+ ( fieldNdx - FIELD1 + 1 ) * 100;
|
||||||
|
coord.y = m_FieldsBuf[REFERENCE].m_Pos.y
|
||||||
|
+ ( fieldNdx - FIELD1 + 1 ) * 100;
|
||||||
|
|
||||||
// coord can compute negative if field is < FIELD1, e.g. FOOTPRINT.
|
// coord can compute negative if field is < FIELD1, e.g. FOOTPRINT.
|
||||||
// That is ok, we basically don't want all the new empty fields on
|
// That is ok, we basically don't want all the new empty fields on
|
||||||
// top of each other.
|
// top of each other.
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString coordText = ReturnStringFromValue( g_UnitMetric, coord.x, EESCHEMA_INTERNAL_UNIT );
|
wxString coordText = ReturnStringFromValue( g_UnitMetric, coord.x,
|
||||||
|
EESCHEMA_INTERNAL_UNIT );
|
||||||
posXTextCtrl->SetValue( coordText );
|
posXTextCtrl->SetValue( coordText );
|
||||||
|
|
||||||
coordText = ReturnStringFromValue( g_UnitMetric, coord.y, EESCHEMA_INTERNAL_UNIT );
|
coordText = ReturnStringFromValue( g_UnitMetric, coord.y,
|
||||||
|
EESCHEMA_INTERNAL_UNIT );
|
||||||
posYTextCtrl->SetValue( coordText );
|
posYTextCtrl->SetValue( coordText );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************/
|
|
||||||
bool DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyPanelToSelectedField()
|
bool DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyPanelToSelectedField()
|
||||||
/*****************************************************************/
|
|
||||||
{
|
{
|
||||||
unsigned fieldNdx = getSelectedFieldNdx();
|
unsigned fieldNdx = getSelectedFieldNdx();
|
||||||
|
|
||||||
if( fieldNdx >= m_FieldsBuf.size() ) // traps the -1 case too
|
if( fieldNdx >= m_FieldsBuf.size() ) // traps the -1 case too
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
SCH_CMP_FIELD& field = m_FieldsBuf[fieldNdx];
|
SCH_FIELD& field = m_FieldsBuf[fieldNdx];
|
||||||
|
|
||||||
if( showCheckBox->GetValue() )
|
if( showCheckBox->GetValue() )
|
||||||
field.m_Attributs &= ~TEXT_NO_VISIBLE;
|
field.m_Attributs &= ~TEXT_NO_VISIBLE;
|
||||||
|
@ -584,7 +590,8 @@ bool DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyPanelToSelectedField()
|
||||||
|
|
||||||
|
|
||||||
field.m_Name = fieldNameTextCtrl->GetValue();
|
field.m_Name = fieldNameTextCtrl->GetValue();
|
||||||
/* Void fields texts for REFERENCE and VALUE (value is the name of the compinent in lib ! ) are not allowed
|
/* Void fields texts for REFERENCE and VALUE (value is the name of the
|
||||||
|
* compinent in lib ! ) are not allowed
|
||||||
* change them only for a new non void value
|
* change them only for a new non void value
|
||||||
* When woid, usually netlists are broken
|
* When woid, usually netlists are broken
|
||||||
*/
|
*/
|
||||||
|
@ -611,10 +618,12 @@ bool DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyPanelToSelectedField()
|
||||||
double value;
|
double value;
|
||||||
|
|
||||||
posXTextCtrl->GetValue().ToDouble( &value );
|
posXTextCtrl->GetValue().ToDouble( &value );
|
||||||
field.m_Pos.x = From_User_Unit( g_UnitMetric, value, EESCHEMA_INTERNAL_UNIT );
|
field.m_Pos.x = From_User_Unit( g_UnitMetric, value,
|
||||||
|
EESCHEMA_INTERNAL_UNIT );
|
||||||
|
|
||||||
posYTextCtrl->GetValue().ToDouble( &value );
|
posYTextCtrl->GetValue().ToDouble( &value );
|
||||||
field.m_Pos.y = From_User_Unit( g_UnitMetric, value, EESCHEMA_INTERNAL_UNIT );
|
field.m_Pos.y = From_User_Unit( g_UnitMetric, value,
|
||||||
|
EESCHEMA_INTERNAL_UNIT );
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -648,7 +657,8 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyOptionsToPanel()
|
||||||
if( choiceCount <= 1 )
|
if( choiceCount <= 1 )
|
||||||
unitChoice->Enable( false );
|
unitChoice->Enable( false );
|
||||||
|
|
||||||
int orientation = m_Cmp->GetRotationMiroir() & ~(CMP_MIROIR_X | CMP_MIROIR_Y);
|
int orientation = m_Cmp->GetRotationMiroir()
|
||||||
|
& ~( CMP_MIROIR_X | CMP_MIROIR_Y );
|
||||||
|
|
||||||
if( orientation == CMP_ORIENT_90 )
|
if( orientation == CMP_ORIENT_90 )
|
||||||
orientationRadioBox->SetSelection( 1 );
|
orientationRadioBox->SetSelection( 1 );
|
||||||
|
@ -659,7 +669,7 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyOptionsToPanel()
|
||||||
else
|
else
|
||||||
orientationRadioBox->SetSelection( 0 );
|
orientationRadioBox->SetSelection( 0 );
|
||||||
|
|
||||||
int mirror = m_Cmp->GetRotationMiroir() & (CMP_MIROIR_X | CMP_MIROIR_Y);
|
int mirror = m_Cmp->GetRotationMiroir() & ( CMP_MIROIR_X | CMP_MIROIR_Y );
|
||||||
|
|
||||||
if( mirror == CMP_MIROIR_X )
|
if( mirror == CMP_MIROIR_X )
|
||||||
{
|
{
|
||||||
|
@ -674,7 +684,8 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyOptionsToPanel()
|
||||||
else
|
else
|
||||||
mirrorRadioBox->SetSelection( 0 );
|
mirrorRadioBox->SetSelection( 0 );
|
||||||
|
|
||||||
// Activate/Desactivate the normal/convert option ? (activated only if the component has more than one shape)
|
// Activate/Desactivate the normal/convert option ? (activated only if
|
||||||
|
// the component has more than one shape)
|
||||||
if( m_Cmp->m_Convert > 1 )
|
if( m_Cmp->m_Convert > 1 )
|
||||||
{
|
{
|
||||||
convertCheckBox->SetValue( true );
|
convertCheckBox->SetValue( true );
|
||||||
|
@ -697,12 +708,9 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyOptionsToPanel()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::SetInitCmp( wxCommandEvent& event )
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
/* reinitialise components parametres to default values found in lib
|
/* reinitialise components parametres to default values found in lib
|
||||||
*/
|
*/
|
||||||
|
void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::SetInitCmp( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
LIB_COMPONENT* entry;
|
LIB_COMPONENT* entry;
|
||||||
|
|
||||||
|
|
|
@ -7,13 +7,15 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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,
|
||||||
SCH_COMPONENT* aComponent );
|
wxPoint& pos,
|
||||||
|
SCH_COMPONENT* aComponent );
|
||||||
|
|
||||||
WinEDA_SchematicFrame* m_Parent;
|
WinEDA_SchematicFrame* m_Parent;
|
||||||
SCH_COMPONENT* m_Cmp;
|
SCH_COMPONENT* m_Cmp;
|
||||||
|
@ -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
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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
|
||||||
|
|
||||||
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 @@
|
||||||
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();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
// Name: dialog_erc.cpp
|
// Name: dialog_erc.cpp
|
||||||
// Purpose:
|
// Purpose:
|
||||||
// Author: jean-pierre Charras
|
// Author: jean-pierre Charras
|
||||||
|
@ -116,18 +115,18 @@ void DIALOG_ERC::OnLeftDClickMarkersList( wxCommandEvent& event )
|
||||||
if( index < 0 )
|
if( index < 0 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const MARKER_SCH* marker = m_MarkersList->GetItem( (unsigned) index );
|
const SCH_MARKER* marker = m_MarkersList->GetItem( (unsigned) index );
|
||||||
|
|
||||||
EndModal( 1 );
|
EndModal( 1 );
|
||||||
|
|
||||||
|
|
||||||
// Search for the selected marker
|
// Search for the selected marker
|
||||||
DrawSheetPath* sheet;
|
SCH_SHEET_PATH* sheet;
|
||||||
bool NotFound;
|
bool NotFound;
|
||||||
wxPoint pos = marker->m_Pos;
|
wxPoint pos = marker->m_Pos;
|
||||||
wxPoint curpos, old_cursor_position;
|
wxPoint curpos, old_cursor_position;
|
||||||
|
|
||||||
EDA_SheetList SheetList;
|
SCH_SHEET_LIST SheetList;
|
||||||
|
|
||||||
NotFound = TRUE;
|
NotFound = TRUE;
|
||||||
/* Search for the selected marker */
|
/* Search for the selected marker */
|
||||||
|
@ -170,12 +169,10 @@ void DIALOG_ERC::OnLeftDClickMarkersList( wxCommandEvent& event )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*********************************************/
|
|
||||||
void DIALOG_ERC::ReBuildMatrixPanel()
|
|
||||||
{
|
|
||||||
/*********************************************/
|
|
||||||
/* Build or rebuild the panel showing the ERC conflict matrix
|
/* Build or rebuild the panel showing the ERC conflict matrix
|
||||||
*/
|
*/
|
||||||
|
void DIALOG_ERC::ReBuildMatrixPanel()
|
||||||
|
{
|
||||||
int ii, jj, event_id, text_height;
|
int ii, jj, event_id, text_height;
|
||||||
wxPoint pos, BoxMatrixPosition;
|
wxPoint pos, BoxMatrixPosition;
|
||||||
|
|
||||||
|
@ -298,21 +295,21 @@ void DIALOG_ERC::ReBuildMatrixPanel()
|
||||||
*/
|
*/
|
||||||
void DIALOG_ERC::DisplayERC_MarkersList()
|
void DIALOG_ERC::DisplayERC_MarkersList()
|
||||||
{
|
{
|
||||||
EDA_SheetList SheetList;
|
SCH_SHEET_LIST SheetList;
|
||||||
|
|
||||||
m_MarkersList->ClearList();
|
m_MarkersList->ClearList();
|
||||||
|
|
||||||
for( DrawSheetPath* Sheet = SheetList.GetFirst();
|
for( SCH_SHEET_PATH* Sheet = SheetList.GetFirst();
|
||||||
Sheet != NULL;
|
Sheet != NULL;
|
||||||
Sheet = SheetList.GetNext() )
|
Sheet = SheetList.GetNext() )
|
||||||
{
|
{
|
||||||
SCH_ITEM* DrawStruct = Sheet->LastDrawList();
|
SCH_ITEM* DrawStruct = Sheet->LastDrawList();
|
||||||
for( ; DrawStruct != NULL; DrawStruct = DrawStruct->Next() )
|
for( ; DrawStruct != NULL; DrawStruct = DrawStruct->Next() )
|
||||||
{
|
{
|
||||||
if( DrawStruct->Type() != TYPE_MARKER_SCH )
|
if( DrawStruct->Type() != TYPE_SCH_MARKER )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
MARKER_SCH* Marker = (MARKER_SCH*) DrawStruct;
|
SCH_MARKER* Marker = (SCH_MARKER*) DrawStruct;
|
||||||
if( Marker->GetMarkerType() != MARK_ERC )
|
if( Marker->GetMarkerType() != MARK_ERC )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -329,23 +326,19 @@ void DIALOG_ERC::DisplayERC_MarkersList()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**************************************************************/
|
|
||||||
void DIALOG_ERC::ResetDefaultERCDiag( wxCommandEvent& event )
|
|
||||||
{
|
|
||||||
/**************************************************************/
|
|
||||||
/* Resets the default values of the ERC matrix.
|
/* Resets the default values of the ERC matrix.
|
||||||
*/
|
*/
|
||||||
|
void DIALOG_ERC::ResetDefaultERCDiag( wxCommandEvent& event )
|
||||||
|
{
|
||||||
memcpy( DiagErc, DefaultDiagErc, sizeof(DiagErc) );
|
memcpy( DiagErc, DefaultDiagErc, sizeof(DiagErc) );
|
||||||
ReBuildMatrixPanel();
|
ReBuildMatrixPanel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/************************************************************/
|
|
||||||
void DIALOG_ERC::ChangeErrorLevel( wxCommandEvent& event )
|
|
||||||
{
|
|
||||||
/************************************************************/
|
|
||||||
/* Change the error level for the pressed button, on the matrix table
|
/* Change the error level for the pressed button, on the matrix table
|
||||||
*/
|
*/
|
||||||
|
void DIALOG_ERC::ChangeErrorLevel( wxCommandEvent& event )
|
||||||
|
{
|
||||||
int id, level, ii, x, y;
|
int id, level, ii, x, y;
|
||||||
wxBitmapButton* Butt;
|
wxBitmapButton* Butt;
|
||||||
const char** new_bitmap_xpm = NULL;
|
const char** new_bitmap_xpm = NULL;
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
// Name: dialog_erc.h
|
// Name: dialog_erc.h
|
||||||
// Author: jean-pierre Charras
|
// Author: jean-pierre Charras
|
||||||
// Licence: GPL
|
// Licence: GPL
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef DIALOG_ERC_LISTBOX_H
|
#ifndef DIALOG_ERC_LISTBOX_H
|
||||||
|
@ -23,12 +22,14 @@
|
||||||
class ERC_HTML_LISTBOX : public wxHtmlListBox
|
class ERC_HTML_LISTBOX : public wxHtmlListBox
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
std::vector<MARKER_SCH*> m_MarkerList; ///< wxHtmlListBox does not own the list, I do
|
std::vector<SCH_MARKER*> m_MarkerList; ///< wxHtmlListBox does not own the list, I do
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ERC_HTML_LISTBOX( wxWindow* parent, wxWindowID id = wxID_ANY,
|
ERC_HTML_LISTBOX( wxWindow* parent, wxWindowID id = wxID_ANY,
|
||||||
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
long style = 0, const wxString choices[] = NULL, int unused = 0 ) :
|
const wxSize& size = wxDefaultSize,
|
||||||
|
long style = 0, const wxString choices[] = NULL,
|
||||||
|
int unused = 0 ) :
|
||||||
wxHtmlListBox( parent, id, pos, size, style )
|
wxHtmlListBox( parent, id, pos, size, style )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -41,12 +42,12 @@ public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function SetList
|
* Function SetList
|
||||||
* sets the DRC_ITEM_LIST for this listbox. Ownership of the DRC_ITEM_LIST is
|
* sets the DRC_ITEM_LIST for this listbox. Ownership of the DRC_ITEM_LIST
|
||||||
* transfered to this ERC_HTML_LISTBOX.
|
* is transferred to this ERC_HTML_LISTBOX.
|
||||||
* @param aList The DRC_ITEM_LIST* containing the DRC_ITEMs which will be
|
* @param aList The DRC_ITEM_LIST* containing the DRC_ITEMs which will be
|
||||||
* displayed in the wxHtmlListBox
|
* displayed in the wxHtmlListBox
|
||||||
*/
|
*/
|
||||||
void AppendToList( MARKER_SCH* aItem )
|
void AppendToList( SCH_MARKER* aItem )
|
||||||
{
|
{
|
||||||
m_MarkerList.push_back( aItem);
|
m_MarkerList.push_back( aItem);
|
||||||
SetItemCount( m_MarkerList.size() );
|
SetItemCount( m_MarkerList.size() );
|
||||||
|
@ -58,7 +59,7 @@ public:
|
||||||
* Function GetItem
|
* Function GetItem
|
||||||
* returns a requested DRC_ITEM* or NULL.
|
* returns a requested DRC_ITEM* or NULL.
|
||||||
*/
|
*/
|
||||||
const MARKER_SCH* GetItem( unsigned aIndex )
|
const SCH_MARKER* GetItem( unsigned aIndex )
|
||||||
{
|
{
|
||||||
if( m_MarkerList.size() > aIndex )
|
if( m_MarkerList.size() > aIndex )
|
||||||
{
|
{
|
||||||
|
@ -78,7 +79,7 @@ public:
|
||||||
{
|
{
|
||||||
if( m_MarkerList.size() > n && n >= 0 )
|
if( m_MarkerList.size() > n && n >= 0 )
|
||||||
{
|
{
|
||||||
const MARKER_SCH* item = m_MarkerList[ n ];
|
const SCH_MARKER* item = m_MarkerList[ n ];
|
||||||
if( item )
|
if( item )
|
||||||
return item->GetReporter().ShowHtml();
|
return item->GetReporter().ShowHtml();
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,8 @@
|
||||||
|
|
||||||
#define PRINTMODECOLOR_KEY wxT("PrintModeColor")
|
#define PRINTMODECOLOR_KEY wxT("PrintModeColor")
|
||||||
|
|
||||||
// static print data and page setup data, to remember settings during the session
|
// static print data and page setup data, to remember settings during the
|
||||||
|
// session
|
||||||
static wxPrintData* g_PrintData;
|
static wxPrintData* g_PrintData;
|
||||||
|
|
||||||
// Variables locales
|
// Variables locales
|
||||||
|
@ -35,7 +36,7 @@ static bool s_Print_Frame_Ref = true;
|
||||||
|
|
||||||
|
|
||||||
/* Dialog to print schematic. Class derived from DIALOG_PRINT_USING_PRINTER_base
|
/* Dialog to print schematic. Class derived from DIALOG_PRINT_USING_PRINTER_base
|
||||||
* created by wxFormBuilder
|
* created by wxFormBuilder
|
||||||
*/
|
*/
|
||||||
class DIALOG_PRINT_USING_PRINTER : public DIALOG_PRINT_USING_PRINTER_base
|
class DIALOG_PRINT_USING_PRINTER : public DIALOG_PRINT_USING_PRINTER_base
|
||||||
{
|
{
|
||||||
|
@ -53,13 +54,10 @@ private:
|
||||||
void OnPrintSetup( wxCommandEvent& event );
|
void OnPrintSetup( wxCommandEvent& event );
|
||||||
void OnPrintPreview( wxCommandEvent& event );
|
void OnPrintPreview( wxCommandEvent& event );
|
||||||
void OnPrintButtonClick( wxCommandEvent& event );
|
void OnPrintButtonClick( wxCommandEvent& event );
|
||||||
void OnButtonCancelClick( wxCommandEvent& event ){ Close(); }
|
void OnButtonCancelClick( wxCommandEvent& event ){ Close(); }
|
||||||
void SetPenWidth();
|
void SetPenWidth();
|
||||||
};
|
};
|
||||||
|
|
||||||
/***************************/
|
|
||||||
/* Gestion de l'impression */
|
|
||||||
/***************************/
|
|
||||||
|
|
||||||
class EDA_Printout : public wxPrintout
|
class EDA_Printout : public wxPrintout
|
||||||
{
|
{
|
||||||
|
@ -85,18 +83,17 @@ public:
|
||||||
bool OnPrintPage( int page );
|
bool OnPrintPage( int page );
|
||||||
bool HasPage( int page );
|
bool HasPage( int page );
|
||||||
bool OnBeginDocument( int startPage, int endPage );
|
bool OnBeginDocument( int startPage, int endPage );
|
||||||
void GetPageInfo( int* minPage, int* maxPage, int* selPageFrom, int* selPageTo );
|
void GetPageInfo( int* minPage, int* maxPage, int* selPageFrom,
|
||||||
|
int* selPageTo );
|
||||||
|
|
||||||
void DrawPage();
|
void DrawPage();
|
||||||
};
|
};
|
||||||
|
|
||||||
/*******************************************************/
|
|
||||||
void WinEDA_DrawFrame::ToPrinter( wxCommandEvent& event )
|
|
||||||
/*******************************************************/
|
|
||||||
|
|
||||||
/* Virtual function
|
/* Virtual function
|
||||||
* Calls the print dialog for Eeschema
|
* Calls the print dialog for Eeschema
|
||||||
*/
|
*/
|
||||||
|
void WinEDA_DrawFrame::ToPrinter( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
if( g_PrintData == NULL ) // First call. creates print handlers
|
if( g_PrintData == NULL ) // First call. creates print handlers
|
||||||
{
|
{
|
||||||
|
@ -104,31 +101,29 @@ void WinEDA_DrawFrame::ToPrinter( wxCommandEvent& event )
|
||||||
|
|
||||||
if( !g_PrintData->Ok() )
|
if( !g_PrintData->Ok() )
|
||||||
{
|
{
|
||||||
DisplayError( this, _( "Error Init Printer info" ) );
|
DisplayError( this,
|
||||||
|
_( "Error initializing printer information." ) );
|
||||||
}
|
}
|
||||||
g_PrintData->SetQuality( wxPRINT_QUALITY_HIGH ); // Default resolution = HIGHT;
|
g_PrintData->SetQuality( wxPRINT_QUALITY_HIGH );
|
||||||
g_PrintData->SetOrientation( DEFAULT_ORIENTATION_PAPER );
|
g_PrintData->SetOrientation( DEFAULT_ORIENTATION_PAPER );
|
||||||
}
|
}
|
||||||
|
|
||||||
DIALOG_PRINT_USING_PRINTER* frame = new DIALOG_PRINT_USING_PRINTER( this );
|
DIALOG_PRINT_USING_PRINTER* frame = new DIALOG_PRINT_USING_PRINTER( this );
|
||||||
|
|
||||||
frame->ShowModal(); frame->Destroy();
|
frame->ShowModal();
|
||||||
|
frame->Destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************************/
|
|
||||||
DIALOG_PRINT_USING_PRINTER::DIALOG_PRINT_USING_PRINTER( WinEDA_DrawFrame* parent ) :
|
DIALOG_PRINT_USING_PRINTER::DIALOG_PRINT_USING_PRINTER( WinEDA_DrawFrame* parent ) :
|
||||||
DIALOG_PRINT_USING_PRINTER_base( parent )
|
DIALOG_PRINT_USING_PRINTER_base( parent )
|
||||||
/*************************************************************************************/
|
|
||||||
{
|
{
|
||||||
m_Parent = parent;
|
m_Parent = parent;
|
||||||
m_Config = wxGetApp().m_EDA_Config;
|
m_Config = wxGetApp().m_EDA_Config;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/************************************************************************/
|
|
||||||
void DIALOG_PRINT_USING_PRINTER::OnInitDialog( wxInitDialogEvent& event )
|
void DIALOG_PRINT_USING_PRINTER::OnInitDialog( wxInitDialogEvent& event )
|
||||||
/************************************************************************/
|
|
||||||
{
|
{
|
||||||
SetFocus();
|
SetFocus();
|
||||||
|
|
||||||
|
@ -137,24 +132,23 @@ void DIALOG_PRINT_USING_PRINTER::OnInitDialog( wxInitDialogEvent& event )
|
||||||
m_Config->Read( PRINTMODECOLOR_KEY, &s_Print_Black_and_White );
|
m_Config->Read( PRINTMODECOLOR_KEY, &s_Print_Black_and_White );
|
||||||
}
|
}
|
||||||
|
|
||||||
AddUnitSymbol(* m_TextPenWidth, g_DrawDefaultLineThickness );
|
AddUnitSymbol( *m_TextPenWidth, g_DrawDefaultLineThickness );
|
||||||
m_DialogPenWidth->SetValue(
|
m_DialogPenWidth->SetValue(
|
||||||
ReturnStringFromValue(g_UnitMetric, g_DrawDefaultLineThickness, m_Parent->m_InternalUnits ) );
|
ReturnStringFromValue( g_UnitMetric, g_DrawDefaultLineThickness,
|
||||||
|
m_Parent->m_InternalUnits ) );
|
||||||
m_Print_Sheet_Ref->SetValue( s_Print_Frame_Ref );
|
m_Print_Sheet_Ref->SetValue( s_Print_Frame_Ref );
|
||||||
|
|
||||||
m_ModeColorOption->SetSelection( s_Print_Black_and_White ? 1 : 0);
|
m_ModeColorOption->SetSelection( s_Print_Black_and_White ? 1 : 0 );
|
||||||
m_Print_Sheet_Ref->SetValue(s_Print_Frame_Ref);
|
m_Print_Sheet_Ref->SetValue( s_Print_Frame_Ref );
|
||||||
|
|
||||||
if (GetSizer())
|
if ( GetSizer() )
|
||||||
{
|
{
|
||||||
GetSizer()->SetSizeHints(this);
|
GetSizer()->SetSizeHints(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*********************************************************************/
|
|
||||||
void DIALOG_PRINT_USING_PRINTER::OnCloseWindow( wxCloseEvent& event )
|
void DIALOG_PRINT_USING_PRINTER::OnCloseWindow( wxCloseEvent& event )
|
||||||
/*********************************************************************/
|
|
||||||
{
|
{
|
||||||
s_Print_Black_and_White = m_ModeColorOption->GetSelection();
|
s_Print_Black_and_White = m_ModeColorOption->GetSelection();
|
||||||
s_Print_Frame_Ref = m_Print_Sheet_Ref->GetValue();
|
s_Print_Frame_Ref = m_Print_Sheet_Ref->GetValue();
|
||||||
|
@ -169,15 +163,13 @@ void DIALOG_PRINT_USING_PRINTER::OnCloseWindow( wxCloseEvent& event )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/****************************************/
|
|
||||||
void DIALOG_PRINT_USING_PRINTER::SetPenWidth()
|
|
||||||
/****************************************/
|
|
||||||
|
|
||||||
/* Get the new pen width value, and verify min et max value
|
/* Get the new pen width value, and verify min et max value
|
||||||
* NOTE: g_PlotLine_Width is in internal units
|
* NOTE: g_PlotLine_Width is in internal units
|
||||||
*/
|
*/
|
||||||
|
void DIALOG_PRINT_USING_PRINTER::SetPenWidth()
|
||||||
{
|
{
|
||||||
g_DrawDefaultLineThickness = ReturnValueFromTextCtrl( *m_DialogPenWidth, m_Parent->m_InternalUnits );
|
g_DrawDefaultLineThickness =
|
||||||
|
ReturnValueFromTextCtrl( *m_DialogPenWidth, m_Parent->m_InternalUnits );
|
||||||
|
|
||||||
if( g_DrawDefaultLineThickness > WIDTH_MAX_VALUE )
|
if( g_DrawDefaultLineThickness > WIDTH_MAX_VALUE )
|
||||||
{
|
{
|
||||||
|
@ -190,16 +182,14 @@ void DIALOG_PRINT_USING_PRINTER::SetPenWidth()
|
||||||
}
|
}
|
||||||
|
|
||||||
m_DialogPenWidth->SetValue(
|
m_DialogPenWidth->SetValue(
|
||||||
ReturnStringFromValue(g_UnitMetric, g_DrawDefaultLineThickness, m_Parent->m_InternalUnits ) );
|
ReturnStringFromValue( g_UnitMetric, g_DrawDefaultLineThickness,
|
||||||
|
m_Parent->m_InternalUnits ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**********************************************************/
|
|
||||||
void DIALOG_PRINT_USING_PRINTER::OnPrintSetup( wxCommandEvent& event )
|
|
||||||
/**********************************************************/
|
|
||||||
|
|
||||||
/* Open a dialog box for printer setup (printer options, page size ...)
|
/* Open a dialog box for printer setup (printer options, page size ...)
|
||||||
*/
|
*/
|
||||||
|
void DIALOG_PRINT_USING_PRINTER::OnPrintSetup( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
wxPrintDialogData printDialogData( *g_PrintData );
|
wxPrintDialogData printDialogData( *g_PrintData );
|
||||||
|
|
||||||
|
@ -212,16 +202,15 @@ void DIALOG_PRINT_USING_PRINTER::OnPrintSetup( wxCommandEvent& event )
|
||||||
*g_PrintData = printerDialog.GetPrintDialogData().GetPrintData();
|
*g_PrintData = printerDialog.GetPrintDialogData().GetPrintData();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
DisplayError( this, _( "Printer Problem!" ) );
|
{
|
||||||
|
DisplayError( this, _( "Printer error!" ) );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************/
|
|
||||||
void DIALOG_PRINT_USING_PRINTER::OnPrintPreview( wxCommandEvent& event )
|
|
||||||
/***********************************************************************/
|
|
||||||
|
|
||||||
/* Open and display a previewer frame for printing
|
/* Open and display a previewer frame for printing
|
||||||
*/
|
*/
|
||||||
|
void DIALOG_PRINT_USING_PRINTER::OnPrintPreview( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
wxSize WSize;
|
wxSize WSize;
|
||||||
wxPoint WPos;
|
wxPoint WPos;
|
||||||
|
@ -236,11 +225,12 @@ void DIALOG_PRINT_USING_PRINTER::OnPrintPreview( wxCommandEvent& event )
|
||||||
wxString title = _("Preview");
|
wxString title = _("Preview");
|
||||||
wxPrintPreview* preview =
|
wxPrintPreview* preview =
|
||||||
new wxPrintPreview( new EDA_Printout( this, m_Parent, title, print_ref ),
|
new wxPrintPreview( new EDA_Printout( this, m_Parent, title, print_ref ),
|
||||||
new EDA_Printout( this, m_Parent, title, print_ref ), g_PrintData );
|
new EDA_Printout( this, m_Parent, title, print_ref ),
|
||||||
|
g_PrintData );
|
||||||
|
|
||||||
if( preview == NULL )
|
if( preview == NULL )
|
||||||
{
|
{
|
||||||
DisplayError( this, wxT( "OnPrintPreview() problem" ) );
|
DisplayError( this, wxT( "Print preview error!" ) );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -255,9 +245,7 @@ void DIALOG_PRINT_USING_PRINTER::OnPrintPreview( wxCommandEvent& event )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**************************************************************************/
|
|
||||||
void DIALOG_PRINT_USING_PRINTER::OnPrintButtonClick( wxCommandEvent& event )
|
void DIALOG_PRINT_USING_PRINTER::OnPrintButtonClick( wxCommandEvent& event )
|
||||||
/**************************************************************************/
|
|
||||||
{
|
{
|
||||||
bool print_ref = m_Print_Sheet_Ref->GetValue();
|
bool print_ref = m_Print_Sheet_Ref->GetValue();
|
||||||
|
|
||||||
|
@ -278,13 +266,13 @@ void DIALOG_PRINT_USING_PRINTER::OnPrintButtonClick( wxCommandEvent& event )
|
||||||
|
|
||||||
#if !defined(__WINDOWS__) && !wxCHECK_VERSION(2,9,0)
|
#if !defined(__WINDOWS__) && !wxCHECK_VERSION(2,9,0)
|
||||||
wxDC* dc = printout.GetDC();
|
wxDC* dc = printout.GetDC();
|
||||||
( (wxPostScriptDC*) dc )->SetResolution( 600 ); // Postscript DC resolution is 600 ppi
|
( (wxPostScriptDC*) dc )->SetResolution( 600 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if( !printer.Print( this, &printout, true ) )
|
if( !printer.Print( this, &printout, true ) )
|
||||||
{
|
{
|
||||||
if( wxPrinter::GetLastError() == wxPRINTER_ERROR )
|
if( wxPrinter::GetLastError() == wxPRINTER_ERROR )
|
||||||
DisplayError( this, _( "There was a problem printing" ) );
|
DisplayError( this, _( "There was a problem printing." ) );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -294,9 +282,7 @@ void DIALOG_PRINT_USING_PRINTER::OnPrintButtonClick( wxCommandEvent& event )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***************************************/
|
|
||||||
bool EDA_Printout::OnPrintPage( int page )
|
bool EDA_Printout::OnPrintPage( int page )
|
||||||
/***************************************/
|
|
||||||
{
|
{
|
||||||
wxString msg;
|
wxString msg;
|
||||||
|
|
||||||
|
@ -306,10 +292,10 @@ bool EDA_Printout::OnPrintPage( int page )
|
||||||
WinEDA_SchematicFrame* schframe = (WinEDA_SchematicFrame*) m_Parent;
|
WinEDA_SchematicFrame* schframe = (WinEDA_SchematicFrame*) m_Parent;
|
||||||
SCH_SCREEN* screen = schframe->GetScreen();
|
SCH_SCREEN* screen = schframe->GetScreen();
|
||||||
SCH_SCREEN* oldscreen = screen;
|
SCH_SCREEN* oldscreen = screen;
|
||||||
DrawSheetPath* oldsheetpath = schframe->GetSheet();
|
SCH_SHEET_PATH* oldsheetpath = schframe->GetSheet();
|
||||||
|
|
||||||
|
|
||||||
DrawSheetPath list;
|
SCH_SHEET_PATH list;
|
||||||
if( s_OptionPrintPage == 1 )
|
if( s_OptionPrintPage == 1 )
|
||||||
{
|
{
|
||||||
/* Print all pages, so when called, the page is not the current page.
|
/* Print all pages, so when called, the page is not the current page.
|
||||||
|
@ -317,8 +303,8 @@ bool EDA_Printout::OnPrintPage( int page )
|
||||||
* because in complex hierarchies a SCH_SCREEN (a schematic drawings)
|
* because in complex hierarchies a SCH_SCREEN (a schematic drawings)
|
||||||
* is shared between many sheets
|
* is shared between many sheets
|
||||||
*/
|
*/
|
||||||
EDA_SheetList SheetList( NULL );
|
SCH_SHEET_LIST SheetList( NULL );
|
||||||
DrawSheetPath* sheetpath = SheetList.GetSheet( page - 1 );
|
SCH_SHEET_PATH* sheetpath = SheetList.GetSheet( page - 1 );
|
||||||
if( list.BuildSheetPathInfoFromSheetPathValue( sheetpath->Path() ) )
|
if( list.BuildSheetPathInfoFromSheetPathValue( sheetpath->Path() ) )
|
||||||
{
|
{
|
||||||
schframe->m_CurrentSheet = &list;
|
schframe->m_CurrentSheet = &list;
|
||||||
|
@ -343,10 +329,8 @@ bool EDA_Printout::OnPrintPage( int page )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*********************************************************/
|
|
||||||
void EDA_Printout::GetPageInfo( int* minPage, int* maxPage,
|
void EDA_Printout::GetPageInfo( int* minPage, int* maxPage,
|
||||||
int* selPageFrom, int* selPageTo )
|
int* selPageFrom, int* selPageTo )
|
||||||
/*********************************************************/
|
|
||||||
{
|
{
|
||||||
int ii = 1;
|
int ii = 1;
|
||||||
|
|
||||||
|
@ -363,9 +347,7 @@ void EDA_Printout::GetPageInfo( int* minPage, int* maxPage,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**************************************/
|
|
||||||
bool EDA_Printout::HasPage( int pageNum )
|
bool EDA_Printout::HasPage( int pageNum )
|
||||||
/**************************************/
|
|
||||||
{
|
{
|
||||||
int pageCount;
|
int pageCount;
|
||||||
|
|
||||||
|
@ -377,9 +359,7 @@ bool EDA_Printout::HasPage( int pageNum )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************/
|
|
||||||
bool EDA_Printout::OnBeginDocument( int startPage, int endPage )
|
bool EDA_Printout::OnBeginDocument( int startPage, int endPage )
|
||||||
/*************************************************************/
|
|
||||||
{
|
{
|
||||||
if( !wxPrintout::OnBeginDocument( startPage, endPage ) )
|
if( !wxPrintout::OnBeginDocument( startPage, endPage ) )
|
||||||
return false;
|
return false;
|
||||||
|
@ -388,13 +368,10 @@ bool EDA_Printout::OnBeginDocument( int startPage, int endPage )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/********************************/
|
|
||||||
void EDA_Printout::DrawPage()
|
|
||||||
/********************************/
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This is the real print function: print the active screen
|
* This is the real print function: print the active screen
|
||||||
*/
|
*/
|
||||||
|
void EDA_Printout::DrawPage()
|
||||||
{
|
{
|
||||||
int tmpzoom;
|
int tmpzoom;
|
||||||
wxPoint tmp_startvisu;
|
wxPoint tmp_startvisu;
|
||||||
|
@ -403,8 +380,8 @@ void EDA_Printout::DrawPage()
|
||||||
wxSize PlotAreaSize; // plot area size in pixels
|
wxSize PlotAreaSize; // plot area size in pixels
|
||||||
double scaleX, scaleY, scale;
|
double scaleX, scaleY, scale;
|
||||||
wxPoint old_org;
|
wxPoint old_org;
|
||||||
wxPoint DrawOffset; // Offset de trace
|
wxPoint DrawOffset;
|
||||||
double DrawZoom = 1;
|
double DrawZoom = 1;
|
||||||
wxDC* dc = GetDC();
|
wxDC* dc = GetDC();
|
||||||
|
|
||||||
wxBusyCursor dummy;
|
wxBusyCursor dummy;
|
||||||
|
@ -420,9 +397,9 @@ void EDA_Printout::DrawPage()
|
||||||
ActiveScreen->m_DrawOrg.x = ActiveScreen->m_DrawOrg.y = 0;
|
ActiveScreen->m_DrawOrg.x = ActiveScreen->m_DrawOrg.y = 0;
|
||||||
ActiveScreen->m_StartVisu.x = ActiveScreen->m_StartVisu.y = 0;
|
ActiveScreen->m_StartVisu.x = ActiveScreen->m_StartVisu.y = 0;
|
||||||
|
|
||||||
SheetSize = ActiveScreen->m_CurrentSheetDesc->m_Size; // size in 1/1000 inch
|
SheetSize = ActiveScreen->m_CurrentSheetDesc->m_Size; // size in 1/1000 inch
|
||||||
SheetSize.x *= m_Parent->m_InternalUnits / 1000;
|
SheetSize.x *= m_Parent->m_InternalUnits / 1000;
|
||||||
SheetSize.y *= m_Parent->m_InternalUnits / 1000; // size in pixels
|
SheetSize.y *= m_Parent->m_InternalUnits / 1000; // size in pixels
|
||||||
|
|
||||||
// Get the size of the DC in pixels
|
// Get the size of the DC in pixels
|
||||||
dc->GetSize( &PlotAreaSize.x, &PlotAreaSize.y );
|
dc->GetSize( &PlotAreaSize.x, &PlotAreaSize.y );
|
||||||
|
@ -430,9 +407,10 @@ void EDA_Printout::DrawPage()
|
||||||
// Calculate a suitable scaling factor
|
// Calculate a suitable scaling factor
|
||||||
scaleX = (double) SheetSize.x / PlotAreaSize.x;
|
scaleX = (double) SheetSize.x / PlotAreaSize.x;
|
||||||
scaleY = (double) SheetSize.y / PlotAreaSize.y;
|
scaleY = (double) SheetSize.y / PlotAreaSize.y;
|
||||||
scale = wxMax( scaleX, scaleY ); // Use x or y scaling factor, whichever fits on the DC
|
scale = wxMax( scaleX, scaleY ); // Use x or y scaling factor, whichever
|
||||||
|
// fits on the DC
|
||||||
|
|
||||||
// ajust the real draw scale
|
// adjust the real draw scale
|
||||||
dc->SetUserScale( DrawZoom / scale, DrawZoom / scale );
|
dc->SetUserScale( DrawZoom / scale, DrawZoom / scale );
|
||||||
|
|
||||||
ActiveScreen->m_DrawOrg = DrawOffset;
|
ActiveScreen->m_DrawOrg = DrawOffset;
|
||||||
|
@ -441,7 +419,6 @@ void EDA_Printout::DrawPage()
|
||||||
if( s_Print_Black_and_White )
|
if( s_Print_Black_and_White )
|
||||||
GRForceBlackPen( true );
|
GRForceBlackPen( true );
|
||||||
|
|
||||||
|
|
||||||
/* set Pen min width (not used now) */
|
/* set Pen min width (not used now) */
|
||||||
SetPenMinWidth( 1 );
|
SetPenMinWidth( 1 );
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ static void MoveCmpField( WinEDA_DrawPanel* panel, wxDC* DC, bool erase );
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
void WinEDA_SchematicFrame::StartMoveCmpField( SCH_CMP_FIELD* aField, wxDC* DC )
|
void WinEDA_SchematicFrame::StartMoveCmpField( SCH_FIELD* aField, wxDC* DC )
|
||||||
{
|
{
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
/* Prepare the displacement of the text being edited.
|
/* Prepare the displacement of the text being edited.
|
||||||
|
@ -82,7 +82,7 @@ void WinEDA_SchematicFrame::StartMoveCmpField( SCH_CMP_FIELD* aField, wxDC* DC )
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
void WinEDA_SchematicFrame::EditCmpFieldText( SCH_CMP_FIELD* Field, wxDC* DC )
|
void WinEDA_SchematicFrame::EditCmpFieldText( SCH_FIELD* Field, wxDC* DC )
|
||||||
{
|
{
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
/* Edit the field Field (text, size) */
|
/* Edit the field Field (text, size) */
|
||||||
|
@ -182,7 +182,7 @@ static void MoveCmpField( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
|
||||||
int fieldNdx;
|
int fieldNdx;
|
||||||
|
|
||||||
WinEDA_SchematicFrame* frame = (WinEDA_SchematicFrame*) panel->GetParent();
|
WinEDA_SchematicFrame* frame = (WinEDA_SchematicFrame*) panel->GetParent();
|
||||||
SCH_CMP_FIELD* currentField = frame->GetCurrentField();
|
SCH_FIELD* currentField = frame->GetCurrentField();
|
||||||
|
|
||||||
if( currentField == NULL )
|
if( currentField == NULL )
|
||||||
return;
|
return;
|
||||||
|
@ -219,7 +219,7 @@ static void AbortMoveCmpField( WinEDA_DrawPanel* Panel, wxDC* DC )
|
||||||
Panel->ManageCurseur = NULL;
|
Panel->ManageCurseur = NULL;
|
||||||
|
|
||||||
WinEDA_SchematicFrame* frame = (WinEDA_SchematicFrame*) Panel->GetParent();
|
WinEDA_SchematicFrame* frame = (WinEDA_SchematicFrame*) Panel->GetParent();
|
||||||
SCH_CMP_FIELD* currentField = frame->GetCurrentField();
|
SCH_FIELD* currentField = frame->GetCurrentField();
|
||||||
|
|
||||||
if( currentField )
|
if( currentField )
|
||||||
{
|
{
|
||||||
|
@ -237,7 +237,7 @@ static void AbortMoveCmpField( WinEDA_DrawPanel* Panel, wxDC* DC )
|
||||||
|
|
||||||
|
|
||||||
/*********************************************************************************/
|
/*********************************************************************************/
|
||||||
void WinEDA_SchematicFrame::RotateCmpField( SCH_CMP_FIELD* Field, wxDC* DC )
|
void WinEDA_SchematicFrame::RotateCmpField( SCH_FIELD* Field, wxDC* DC )
|
||||||
{
|
{
|
||||||
/*********************************************************************************/
|
/*********************************************************************************/
|
||||||
int fieldNdx, flag;
|
int fieldNdx, flag;
|
||||||
|
@ -342,7 +342,7 @@ void WinEDA_SchematicFrame::EditComponentValue( SCH_COMPONENT* Cmp, wxDC* DC )
|
||||||
if( Entry == NULL )
|
if( Entry == NULL )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
SCH_CMP_FIELD* TextField = Cmp->GetField( VALUE );
|
SCH_FIELD* TextField = Cmp->GetField( VALUE );
|
||||||
|
|
||||||
message = TextField->m_Text;
|
message = TextField->m_Text;
|
||||||
if( Get_Message( _( "Value" ), _( "Component value" ), message, this ) )
|
if( Get_Message( _( "Value" ), _( "Component value" ), message, this ) )
|
||||||
|
@ -382,7 +382,7 @@ void WinEDA_SchematicFrame::EditComponentFootprint( SCH_COMPONENT* Cmp,
|
||||||
if( Entry == NULL )
|
if( Entry == NULL )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
SCH_CMP_FIELD* TextField = Cmp->GetField( FOOTPRINT );
|
SCH_FIELD* TextField = Cmp->GetField( FOOTPRINT );
|
||||||
|
|
||||||
message = TextField->m_Text;
|
message = TextField->m_Text;
|
||||||
if( message.IsEmpty() )
|
if( message.IsEmpty() )
|
||||||
|
|
|
@ -176,7 +176,7 @@ void DrawStructsInGhost( WinEDA_DrawPanel* aPanel,
|
||||||
{
|
{
|
||||||
case DRAW_POLYLINE_STRUCT_TYPE:
|
case DRAW_POLYLINE_STRUCT_TYPE:
|
||||||
{
|
{
|
||||||
DrawPolylineStruct* Struct = (DrawPolylineStruct*) aItem;
|
SCH_POLYLINE* Struct = (SCH_POLYLINE*) aItem;
|
||||||
GRMoveTo( Struct->m_PolyPoints[0].x + aOffset.x,
|
GRMoveTo( Struct->m_PolyPoints[0].x + aOffset.x,
|
||||||
Struct->m_PolyPoints[0].y + aOffset.y );
|
Struct->m_PolyPoints[0].y + aOffset.y );
|
||||||
for( unsigned ii = 1; ii < Struct->GetCornerCount(); ii++ )
|
for( unsigned ii = 1; ii < Struct->GetCornerCount(); ii++ )
|
||||||
|
@ -192,8 +192,8 @@ void DrawStructsInGhost( WinEDA_DrawPanel* aPanel,
|
||||||
|
|
||||||
case DRAW_SEGMENT_STRUCT_TYPE:
|
case DRAW_SEGMENT_STRUCT_TYPE:
|
||||||
{
|
{
|
||||||
EDA_DrawLineStruct* Struct;
|
SCH_LINE* Struct;
|
||||||
Struct = (EDA_DrawLineStruct*) aItem;
|
Struct = (SCH_LINE*) aItem;
|
||||||
if( (Struct->m_Flags & STARTPOINT) == 0 )
|
if( (Struct->m_Flags & STARTPOINT) == 0 )
|
||||||
{
|
{
|
||||||
GRMoveTo( Struct->m_Start.x + aOffset.x,
|
GRMoveTo( Struct->m_Start.x + aOffset.x,
|
||||||
|
@ -218,8 +218,8 @@ void DrawStructsInGhost( WinEDA_DrawPanel* aPanel,
|
||||||
|
|
||||||
case DRAW_BUSENTRY_STRUCT_TYPE:
|
case DRAW_BUSENTRY_STRUCT_TYPE:
|
||||||
{
|
{
|
||||||
DrawBusEntryStruct* Struct = (DrawBusEntryStruct*) aItem;
|
SCH_BUS_ENTRY* Struct = (SCH_BUS_ENTRY*) aItem;
|
||||||
wxPoint start = Struct->m_Pos + aOffset;
|
wxPoint start = Struct->m_Pos + aOffset;
|
||||||
GRMoveTo( start.x, start.y );
|
GRMoveTo( start.x, start.y );
|
||||||
GRLineTo( &aPanel->m_ClipBox, aDC, Struct->m_Size.x + start.x,
|
GRLineTo( &aPanel->m_ClipBox, aDC, Struct->m_Size.x + start.x,
|
||||||
Struct->m_Size.y + start.y, width, g_GhostColor );
|
Struct->m_Size.y + start.y, width, g_GhostColor );
|
||||||
|
@ -228,8 +228,8 @@ void DrawStructsInGhost( WinEDA_DrawPanel* aPanel,
|
||||||
|
|
||||||
case DRAW_JUNCTION_STRUCT_TYPE:
|
case DRAW_JUNCTION_STRUCT_TYPE:
|
||||||
{
|
{
|
||||||
DrawJunctionStruct* Struct;
|
SCH_JUNCTION* Struct;
|
||||||
Struct = (DrawJunctionStruct*) aItem;
|
Struct = (SCH_JUNCTION*) aItem;
|
||||||
Struct->Draw( aPanel, aDC, aOffset, DrawMode, g_GhostColor );
|
Struct->Draw( aPanel, aDC, aOffset, DrawMode, g_GhostColor );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -254,8 +254,8 @@ void DrawStructsInGhost( WinEDA_DrawPanel* aPanel,
|
||||||
|
|
||||||
case DRAW_NOCONNECT_STRUCT_TYPE:
|
case DRAW_NOCONNECT_STRUCT_TYPE:
|
||||||
{
|
{
|
||||||
DrawNoConnectStruct* Struct;
|
SCH_NO_CONNECT* Struct;
|
||||||
Struct = (DrawNoConnectStruct*) aItem;
|
Struct = (SCH_NO_CONNECT*) aItem;
|
||||||
Struct->Draw( aPanel, aDC, aOffset, DrawMode, g_GhostColor );
|
Struct->Draw( aPanel, aDC, aOffset, DrawMode, g_GhostColor );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -286,7 +286,7 @@ void DrawStructsInGhost( WinEDA_DrawPanel* aPanel,
|
||||||
}
|
}
|
||||||
|
|
||||||
case DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE:
|
case DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE:
|
||||||
case TYPE_MARKER_SCH:
|
case TYPE_SCH_MARKER:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -203,7 +203,7 @@ int TestDuplicateSheetNames()
|
||||||
== 0 )
|
== 0 )
|
||||||
{
|
{
|
||||||
/* Create a new marker type ERC error*/
|
/* Create a new marker type ERC error*/
|
||||||
MARKER_SCH* Marker = new MARKER_SCH();
|
SCH_MARKER* Marker = new SCH_MARKER();
|
||||||
Marker->m_TimeStamp = GetTimeStamp();
|
Marker->m_TimeStamp = GetTimeStamp();
|
||||||
Marker->SetData( ERCE_DUPLICATE_SHEET_NAME,
|
Marker->SetData( ERCE_DUPLICATE_SHEET_NAME,
|
||||||
( (SCH_SHEET*) item_to_test )->m_Pos,
|
( (SCH_SHEET*) item_to_test )->m_Pos,
|
||||||
|
@ -223,10 +223,8 @@ int TestDuplicateSheetNames()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**************************************************/
|
|
||||||
void DIALOG_ERC::TestErc( wxArrayString* aMessagesList )
|
void DIALOG_ERC::TestErc( wxArrayString* aMessagesList )
|
||||||
{
|
{
|
||||||
/**************************************************/
|
|
||||||
wxFileName fn;
|
wxFileName fn;
|
||||||
unsigned NetItemRef;
|
unsigned NetItemRef;
|
||||||
unsigned OldItem;
|
unsigned OldItem;
|
||||||
|
@ -247,7 +245,7 @@ void DIALOG_ERC::TestErc( wxArrayString* aMessagesList )
|
||||||
{
|
{
|
||||||
if( aMessagesList )
|
if( aMessagesList )
|
||||||
{
|
{
|
||||||
wxString msg = _( "Annotation Required!" );
|
wxString msg = _( "Annotation required!" );
|
||||||
msg += wxT( "\n" );
|
msg += wxT( "\n" );
|
||||||
aMessagesList->Add( msg );
|
aMessagesList->Add( msg );
|
||||||
}
|
}
|
||||||
|
@ -394,18 +392,16 @@ void DIALOG_ERC::TestErc( wxArrayString* aMessagesList )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/********************************************************/
|
/* Creates an ERC marker to show the ERC problem about aNetItemRef
|
||||||
|
* or between aNetItemRef and aNetItemTst
|
||||||
|
* if MinConn < 0: this is an error on labels
|
||||||
|
*/
|
||||||
static void Diagnose( WinEDA_DrawPanel* aPanel,
|
static void Diagnose( WinEDA_DrawPanel* aPanel,
|
||||||
NETLIST_OBJECT* aNetItemRef,
|
NETLIST_OBJECT* aNetItemRef,
|
||||||
NETLIST_OBJECT* aNetItemTst,
|
NETLIST_OBJECT* aNetItemTst,
|
||||||
int aMinConn, int aDiag )
|
int aMinConn, int aDiag )
|
||||||
{
|
{
|
||||||
/********************************************************/
|
SCH_MARKER* Marker = NULL;
|
||||||
/* Creates an ERC marker to show the ERC problem about aNetItemRef
|
|
||||||
* or between aNetItemRef and aNetItemTst
|
|
||||||
* if MinConn < 0: this is an error on labels
|
|
||||||
*/
|
|
||||||
MARKER_SCH* Marker = NULL;
|
|
||||||
SCH_SCREEN* screen;
|
SCH_SCREEN* screen;
|
||||||
int ii, jj;
|
int ii, jj;
|
||||||
|
|
||||||
|
@ -413,7 +409,7 @@ static void Diagnose( WinEDA_DrawPanel* aPanel,
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* Create new marker for ERC error. */
|
/* Create new marker for ERC error. */
|
||||||
Marker = new MARKER_SCH();
|
Marker = new SCH_MARKER();
|
||||||
Marker->m_TimeStamp = GetTimeStamp();
|
Marker->m_TimeStamp = GetTimeStamp();
|
||||||
|
|
||||||
Marker->SetMarkerType( MARK_ERC );
|
Marker->SetMarkerType( MARK_ERC );
|
||||||
|
@ -531,16 +527,14 @@ static void Diagnose( WinEDA_DrawPanel* aPanel,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/********************************************************************/
|
/* Routine testing electrical conflicts between NetItemRef and other items
|
||||||
|
* of the same net
|
||||||
|
*/
|
||||||
static void TestOthersItems( WinEDA_DrawPanel* panel,
|
static void TestOthersItems( WinEDA_DrawPanel* panel,
|
||||||
unsigned NetItemRef,
|
unsigned NetItemRef,
|
||||||
unsigned netstart,
|
unsigned netstart,
|
||||||
int* NetNbItems, int* MinConnexion )
|
int* NetNbItems, int* MinConnexion )
|
||||||
{
|
{
|
||||||
/********************************************************************/
|
|
||||||
/* Routine testing electrical conflicts between NetItemRef and other items
|
|
||||||
* of the same net
|
|
||||||
*/
|
|
||||||
unsigned NetItemTst;
|
unsigned NetItemTst;
|
||||||
|
|
||||||
int ref_elect_type, jj, erc = OK, local_minconn;
|
int ref_elect_type, jj, erc = OK, local_minconn;
|
||||||
|
@ -676,18 +670,16 @@ static void TestOthersItems( WinEDA_DrawPanel* panel,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/********************************************************/
|
|
||||||
static bool WriteDiagnosticERC( const wxString& FullFileName )
|
|
||||||
{
|
|
||||||
/*********************************************************/
|
|
||||||
/* Create the Diagnostic file (<xxx>.erc file)
|
/* Create the Diagnostic file (<xxx>.erc file)
|
||||||
*/
|
*/
|
||||||
SCH_ITEM* DrawStruct;
|
static bool WriteDiagnosticERC( const wxString& FullFileName )
|
||||||
MARKER_SCH* Marker;
|
{
|
||||||
char Line[1024];
|
SCH_ITEM* DrawStruct;
|
||||||
static FILE* OutErc;
|
SCH_MARKER* Marker;
|
||||||
DrawSheetPath* Sheet;
|
char Line[1024];
|
||||||
wxString msg;
|
static FILE* OutErc;
|
||||||
|
SCH_SHEET_PATH* Sheet;
|
||||||
|
wxString msg;
|
||||||
|
|
||||||
if( ( OutErc = wxFopen( FullFileName, wxT( "wt" ) ) ) == NULL )
|
if( ( OutErc = wxFopen( FullFileName, wxT( "wt" ) ) ) == NULL )
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -697,7 +689,7 @@ static bool WriteDiagnosticERC( const wxString& FullFileName )
|
||||||
|
|
||||||
fprintf( OutErc, "%s (%s)\n", CONV_TO_UTF8( msg ), Line );
|
fprintf( OutErc, "%s (%s)\n", CONV_TO_UTF8( msg ), Line );
|
||||||
|
|
||||||
EDA_SheetList SheetList;
|
SCH_SHEET_LIST SheetList;
|
||||||
|
|
||||||
for( Sheet = SheetList.GetFirst();
|
for( Sheet = SheetList.GetFirst();
|
||||||
Sheet != NULL;
|
Sheet != NULL;
|
||||||
|
@ -718,10 +710,10 @@ static bool WriteDiagnosticERC( const wxString& FullFileName )
|
||||||
DrawStruct = Sheet->LastDrawList();
|
DrawStruct = Sheet->LastDrawList();
|
||||||
for( ; DrawStruct != NULL; DrawStruct = DrawStruct->Next() )
|
for( ; DrawStruct != NULL; DrawStruct = DrawStruct->Next() )
|
||||||
{
|
{
|
||||||
if( DrawStruct->Type() != TYPE_MARKER_SCH )
|
if( DrawStruct->Type() != TYPE_SCH_MARKER )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
Marker = (MARKER_SCH*) DrawStruct;
|
Marker = (SCH_MARKER*) DrawStruct;
|
||||||
if( Marker->GetMarkerType() != MARK_ERC )
|
if( Marker->GetMarkerType() != MARK_ERC )
|
||||||
continue;
|
continue;
|
||||||
msg = Marker->GetReporter().ShowReport();
|
msg = Marker->GetReporter().ShowReport();
|
||||||
|
@ -754,15 +746,13 @@ static bool IsLabelsConnected( NETLIST_OBJECT* a, NETLIST_OBJECT* b )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************/
|
/* Routine to perform erc on a sheetLabel that is connected to a corresponding
|
||||||
|
* sub sheet Glabel
|
||||||
|
*/
|
||||||
void TestLabel( WinEDA_DrawPanel* panel,
|
void TestLabel( WinEDA_DrawPanel* panel,
|
||||||
unsigned NetItemRef,
|
unsigned NetItemRef,
|
||||||
unsigned StartNet )
|
unsigned StartNet )
|
||||||
{
|
{
|
||||||
/***********************************************************************/
|
|
||||||
/* Routine to perform erc on a sheetLabel that is connected to a corresponding
|
|
||||||
* sub sheet Glabel
|
|
||||||
*/
|
|
||||||
unsigned NetItemTst;
|
unsigned NetItemTst;
|
||||||
int erc = 1;
|
int erc = 1;
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/****************************************************************/
|
/****************************************************************/
|
||||||
/* EESchema: find.cpp (functions for seraching a schematic item */
|
/* EESchema: find.cpp (functions for searching a schematic item */
|
||||||
/****************************************************************/
|
/****************************************************************/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -31,14 +31,11 @@ static wxString s_OldStringFound;
|
||||||
#include "dialog_find.cpp"
|
#include "dialog_find.cpp"
|
||||||
|
|
||||||
|
|
||||||
/**************************************************************/
|
|
||||||
void WinEDA_FindFrame::FindMarker( wxCommandEvent& event )
|
|
||||||
/**************************************************************/
|
|
||||||
|
|
||||||
/* Search markers in whole hierarchy.
|
/* Search markers in whole hierarchy.
|
||||||
* Mouse cursor is put on the marker
|
* Mouse cursor is put on the marker
|
||||||
* search the first marker, or next marker
|
* search the first marker, or next marker
|
||||||
*/
|
*/
|
||||||
|
void WinEDA_FindFrame::FindMarker( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
int id = event.GetId();
|
int id = event.GetId();
|
||||||
|
|
||||||
|
@ -51,19 +48,12 @@ void WinEDA_FindFrame::FindMarker( wxCommandEvent& event )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/************************************************************************/
|
|
||||||
SCH_ITEM* WinEDA_SchematicFrame::FindComponentAndItem(
|
|
||||||
const wxString& component_reference, bool Find_in_hierarchy,
|
|
||||||
int SearchType,
|
|
||||||
const wxString& text_to_find,
|
|
||||||
bool mouseWarp )
|
|
||||||
/************************************************************************/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function FindComponentAndItem
|
* Function FindComponentAndItem
|
||||||
* finds a Component in the schematic, and an item in this component.
|
* finds a Component in the schematic, and an item in this component.
|
||||||
* @param component_reference The component reference to find.
|
* @param component_reference The component reference to find.
|
||||||
* @param text_to_find The text to search for, either in value, reference or elsewhere.
|
* @param text_to_find - The text to search for, either in value, reference
|
||||||
|
* or elsewhere.
|
||||||
* @param Find_in_hierarchy: false => Search is made in current sheet
|
* @param Find_in_hierarchy: false => Search is made in current sheet
|
||||||
* true => the whole hierarchy
|
* true => the whole hierarchy
|
||||||
* @param SearchType: 0 => find component
|
* @param SearchType: 0 => find component
|
||||||
|
@ -73,18 +63,22 @@ SCH_ITEM* WinEDA_SchematicFrame::FindComponentAndItem(
|
||||||
* >= 4 => unused (same as 0)
|
* >= 4 => unused (same as 0)
|
||||||
* @param mouseWarp If true, then move the mouse cursor to the item.
|
* @param mouseWarp If true, then move the mouse cursor to the item.
|
||||||
*/
|
*/
|
||||||
|
SCH_ITEM* WinEDA_SchematicFrame::FindComponentAndItem(
|
||||||
|
const wxString& component_reference, bool Find_in_hierarchy,
|
||||||
|
int SearchType,
|
||||||
|
const wxString& text_to_find,
|
||||||
|
bool mouseWarp )
|
||||||
{
|
{
|
||||||
DrawSheetPath* sheet, * SheetWithComponentFound = NULL;
|
SCH_SHEET_PATH* sheet, * SheetWithComponentFound = NULL;
|
||||||
SCH_ITEM* DrawList = NULL;
|
SCH_ITEM* DrawList = NULL;
|
||||||
SCH_COMPONENT* Component = NULL;
|
SCH_COMPONENT* Component = NULL;
|
||||||
wxSize DrawAreaSize = DrawPanel->GetClientSize();
|
wxSize DrawAreaSize = DrawPanel->GetClientSize();
|
||||||
wxPoint pos, curpos;
|
wxPoint pos, curpos;
|
||||||
bool DoCenterAndRedraw = FALSE;
|
bool DoCenterAndRedraw = FALSE;
|
||||||
bool NotFound = true;
|
bool NotFound = true;
|
||||||
wxString msg;
|
wxString msg;
|
||||||
LIB_PIN* pin;
|
LIB_PIN* pin;
|
||||||
|
SCH_SHEET_LIST SheetList;
|
||||||
EDA_SheetList SheetList;
|
|
||||||
|
|
||||||
sheet = SheetList.GetFirst();
|
sheet = SheetList.GetFirst();
|
||||||
if( !Find_in_hierarchy )
|
if( !Find_in_hierarchy )
|
||||||
|
@ -93,7 +87,8 @@ SCH_ITEM* WinEDA_SchematicFrame::FindComponentAndItem(
|
||||||
for( ; sheet != NULL; sheet = SheetList.GetNext() )
|
for( ; sheet != NULL; sheet = SheetList.GetNext() )
|
||||||
{
|
{
|
||||||
DrawList = (SCH_ITEM*) sheet->LastDrawList();
|
DrawList = (SCH_ITEM*) sheet->LastDrawList();
|
||||||
for( ; (DrawList != NULL) && (NotFound == true); DrawList = DrawList->Next() )
|
for( ; ( DrawList != NULL ) && ( NotFound == true );
|
||||||
|
DrawList = DrawList->Next() )
|
||||||
{
|
{
|
||||||
if( DrawList->Type() == TYPE_SCH_COMPONENT )
|
if( DrawList->Type() == TYPE_SCH_COMPONENT )
|
||||||
{
|
{
|
||||||
|
@ -113,7 +108,8 @@ SCH_ITEM* WinEDA_SchematicFrame::FindComponentAndItem(
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 1: // find a pin
|
case 1: // find a pin
|
||||||
pos = pSch->m_Pos; // temporary: will be changed if the pin is found
|
pos = pSch->m_Pos; /* temporary: will be changed if
|
||||||
|
* the pin is found */
|
||||||
pin = pSch->GetPin( text_to_find );
|
pin = pSch->GetPin( text_to_find );
|
||||||
if( pin == NULL )
|
if( pin == NULL )
|
||||||
break;
|
break;
|
||||||
|
@ -172,8 +168,8 @@ SCH_ITEM* WinEDA_SchematicFrame::FindComponentAndItem(
|
||||||
|
|
||||||
/* There may be need to reframe the drawing */
|
/* There may be need to reframe the drawing */
|
||||||
#define MARGIN 30
|
#define MARGIN 30
|
||||||
if( (curpos.x <= MARGIN) || (curpos.x >= DrawAreaSize.x - MARGIN)
|
if( ( curpos.x <= MARGIN ) || ( curpos.x >= DrawAreaSize.x - MARGIN )
|
||||||
|| (curpos.y <= MARGIN) || (curpos.y >= DrawAreaSize.y - MARGIN) )
|
|| ( curpos.y <= MARGIN ) || ( curpos.y >= DrawAreaSize.y - MARGIN ) )
|
||||||
{
|
{
|
||||||
DoCenterAndRedraw = true;;
|
DoCenterAndRedraw = true;;
|
||||||
}
|
}
|
||||||
|
@ -257,43 +253,41 @@ SCH_ITEM* WinEDA_SchematicFrame::FindComponentAndItem(
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************/
|
|
||||||
SCH_ITEM* WinEDA_SchematicFrame::FindMarker( int SearchType )
|
|
||||||
/*****************************************************************/
|
|
||||||
|
|
||||||
/* Search markers in whole the hierarchy.
|
/* Search markers in whole the hierarchy.
|
||||||
* Mouse cursor is put on the marker
|
* Mouse cursor is put on the marker
|
||||||
* SearchType = 0: search the first marker, else search next marker
|
* SearchType = 0: search the first marker, else search next marker
|
||||||
*/
|
*/
|
||||||
|
SCH_ITEM* WinEDA_SchematicFrame::FindMarker( int SearchType )
|
||||||
{
|
{
|
||||||
DrawSheetPath* sheet, * FirstSheet = NULL;
|
SCH_SHEET_PATH* sheet, * FirstSheet = NULL;
|
||||||
SCH_ITEM* DrawList, * FirstStruct = NULL, * Struct = NULL;
|
SCH_ITEM* DrawList, * FirstStruct = NULL, * Struct = NULL;
|
||||||
MARKER_SCH* Marker = NULL;
|
SCH_MARKER* Marker = NULL;
|
||||||
int StartCount;
|
int StartCount;
|
||||||
bool NotFound;
|
bool NotFound;
|
||||||
wxPoint firstpos, pos;
|
wxPoint firstpos, pos;
|
||||||
wxSize DrawAreaSize = DrawPanel->GetClientSize();
|
wxSize DrawAreaSize = DrawPanel->GetClientSize();
|
||||||
wxPoint curpos, old_cursor_position;
|
wxPoint curpos, old_cursor_position;
|
||||||
bool DoCenterAndRedraw = FALSE;
|
bool DoCenterAndRedraw = FALSE;
|
||||||
wxString msg, WildText;
|
wxString msg, WildText;
|
||||||
|
|
||||||
g_LastSearchIsMarker = TRUE;
|
g_LastSearchIsMarker = TRUE;
|
||||||
/* Set s_MarkerCount to 0 if we are look for the first marker */
|
/* Set s_MarkerCount to 0 if we are look for the first marker */
|
||||||
if( SearchType == 0 )
|
if( SearchType == 0 )
|
||||||
s_MarkerCount = 0;
|
s_MarkerCount = 0;
|
||||||
|
|
||||||
EDA_SheetList SheetList;
|
SCH_SHEET_LIST SheetList;
|
||||||
|
|
||||||
NotFound = TRUE; StartCount = 0;
|
NotFound = TRUE; StartCount = 0;
|
||||||
/* Search for s_MarkerCount markers */
|
/* Search for s_MarkerCount markers */
|
||||||
for( sheet = SheetList.GetFirst(); sheet != NULL; sheet = SheetList.GetNext() )
|
for( sheet = SheetList.GetFirst(); sheet != NULL;
|
||||||
|
sheet = SheetList.GetNext() )
|
||||||
{
|
{
|
||||||
DrawList = (SCH_ITEM*) sheet->LastDrawList();
|
DrawList = (SCH_ITEM*) sheet->LastDrawList();
|
||||||
while( DrawList && NotFound )
|
while( DrawList && NotFound )
|
||||||
{
|
{
|
||||||
if( DrawList->Type() == TYPE_MARKER_SCH )
|
if( DrawList->Type() == TYPE_SCH_MARKER )
|
||||||
{
|
{
|
||||||
Marker = (MARKER_SCH*) DrawList;
|
Marker = (SCH_MARKER*) DrawList;
|
||||||
NotFound = FALSE;
|
NotFound = FALSE;
|
||||||
pos = Marker->m_Pos;
|
pos = Marker->m_Pos;
|
||||||
if( FirstSheet == NULL ) /* First item found */
|
if( FirstSheet == NULL ) /* First item found */
|
||||||
|
@ -305,9 +299,10 @@ SCH_ITEM* WinEDA_SchematicFrame::FindMarker( int SearchType )
|
||||||
StartCount++;
|
StartCount++;
|
||||||
if( s_MarkerCount >= StartCount )
|
if( s_MarkerCount >= StartCount )
|
||||||
{
|
{
|
||||||
NotFound = TRUE; /* Search for other markers */
|
NotFound = TRUE; /* Search for other markers */
|
||||||
}
|
}
|
||||||
else /* We have found s_MarkerCount markers -> Ok */
|
else /* We have found s_MarkerCount
|
||||||
|
* markers -> Ok */
|
||||||
{
|
{
|
||||||
Struct = DrawList; s_MarkerCount++; break;
|
Struct = DrawList; s_MarkerCount++; break;
|
||||||
}
|
}
|
||||||
|
@ -319,7 +314,8 @@ SCH_ITEM* WinEDA_SchematicFrame::FindMarker( int SearchType )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( NotFound && FirstSheet ) // markers are found, but we have reach the last marker */
|
if( NotFound && FirstSheet ) /* markers are found, but we have
|
||||||
|
* reach the last marker */
|
||||||
{
|
{
|
||||||
// After the last marker, the first marker is used */
|
// After the last marker, the first marker is used */
|
||||||
NotFound = FALSE; sheet = FirstSheet;
|
NotFound = FALSE; sheet = FirstSheet;
|
||||||
|
@ -349,8 +345,8 @@ SCH_ITEM* WinEDA_SchematicFrame::FindMarker( int SearchType )
|
||||||
|
|
||||||
// reposition the window if the chosen marker is off screen.
|
// reposition the window if the chosen marker is off screen.
|
||||||
#define MARGIN 30
|
#define MARGIN 30
|
||||||
if( (curpos.x <= MARGIN) || (curpos.x >= DrawAreaSize.x - MARGIN)
|
if( ( curpos.x <= MARGIN ) || ( curpos.x >= DrawAreaSize.x - MARGIN )
|
||||||
|| (curpos.y <= MARGIN) || (curpos.y >= DrawAreaSize.y - MARGIN) )
|
|| ( curpos.y <= MARGIN ) || ( curpos.y >= DrawAreaSize.y - MARGIN ) )
|
||||||
{
|
{
|
||||||
DoCenterAndRedraw = true;;
|
DoCenterAndRedraw = true;;
|
||||||
}
|
}
|
||||||
|
@ -370,7 +366,8 @@ SCH_ITEM* WinEDA_SchematicFrame::FindMarker( int SearchType )
|
||||||
DrawPanel->CursorOn( &dc );
|
DrawPanel->CursorOn( &dc );
|
||||||
}
|
}
|
||||||
wxString path = sheet->Path();
|
wxString path = sheet->Path();
|
||||||
msg.Printf( _( "Marker %d found in %s" ), s_MarkerCount, path.GetData() );
|
msg.Printf( _( "Marker %d found in %s" ),
|
||||||
|
s_MarkerCount, path.GetData() );
|
||||||
Affiche_Message( msg );
|
Affiche_Message( msg );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -384,13 +381,10 @@ SCH_ITEM* WinEDA_SchematicFrame::FindMarker( int SearchType )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**************************************************************/
|
|
||||||
void WinEDA_FindFrame::FindSchematicItem( wxCommandEvent& event )
|
|
||||||
/**************************************************************/
|
|
||||||
|
|
||||||
/* Find a string in schematic.
|
/* Find a string in schematic.
|
||||||
* Call to WinEDA_SchematicFrame::FindSchematicItem()
|
* Call to WinEDA_SchematicFrame::FindSchematicItem()
|
||||||
*/
|
*/
|
||||||
|
void WinEDA_FindFrame::FindSchematicItem( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
int id = event.GetId();
|
int id = event.GetId();
|
||||||
|
|
||||||
|
@ -405,31 +399,30 @@ void WinEDA_FindFrame::FindSchematicItem( wxCommandEvent& event )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/************************************************************************/
|
|
||||||
SCH_ITEM* WinEDA_SchematicFrame::FindSchematicItem(
|
|
||||||
const wxString& pattern, int SearchType, bool mouseWarp )
|
|
||||||
/************************************************************************/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function FindSchematicItem
|
* Function FindSchematicItem
|
||||||
* finds a string in the schematic.
|
* finds a string in the schematic.
|
||||||
* @param pattern The text to search for, either in value, reference or elsewhere.
|
* @param pattern The text to search for, either in value, reference or
|
||||||
|
* elsewhere.
|
||||||
* @param SearchType: 0 => Search is made in current sheet
|
* @param SearchType: 0 => Search is made in current sheet
|
||||||
* 1 => the whole hierarchy
|
* 1 => the whole hierarchy
|
||||||
* 2 => or for the next item
|
* 2 => or for the next item
|
||||||
* @param mouseWarp If true, then move the mouse cursor to the item.
|
* @param mouseWarp If true, then move the mouse cursor to the item.
|
||||||
*/
|
*/
|
||||||
|
SCH_ITEM* WinEDA_SchematicFrame::FindSchematicItem( const wxString& pattern,
|
||||||
|
int SearchType,
|
||||||
|
bool mouseWarp )
|
||||||
{
|
{
|
||||||
DrawSheetPath* Sheet, * FirstSheet = NULL;
|
SCH_SHEET_PATH* Sheet, * FirstSheet = NULL;
|
||||||
SCH_ITEM* DrawList = NULL, * FirstStruct = NULL, * Struct = NULL;
|
SCH_ITEM* DrawList = NULL, * FirstStruct = NULL, * Struct = NULL;
|
||||||
int StartCount;
|
int StartCount;
|
||||||
bool NotFound;
|
bool NotFound;
|
||||||
wxPoint firstpos, pos, old_cursor_position;
|
wxPoint firstpos, pos, old_cursor_position;
|
||||||
static int Find_in_hierarchy;
|
static int Find_in_hierarchy;
|
||||||
wxSize DrawAreaSize = DrawPanel->GetClientSize();
|
wxSize DrawAreaSize = DrawPanel->GetClientSize();
|
||||||
wxPoint curpos;
|
wxPoint curpos;
|
||||||
bool DoCenterAndRedraw = FALSE;
|
bool DoCenterAndRedraw = FALSE;
|
||||||
wxString msg, WildText;
|
wxString msg, WildText;
|
||||||
|
|
||||||
g_LastSearchIsMarker = FALSE;
|
g_LastSearchIsMarker = FALSE;
|
||||||
|
|
||||||
|
@ -452,7 +445,7 @@ SCH_ITEM* WinEDA_SchematicFrame::FindSchematicItem(
|
||||||
NotFound = TRUE;
|
NotFound = TRUE;
|
||||||
StartCount = 0;
|
StartCount = 0;
|
||||||
|
|
||||||
EDA_SheetList SheetList;
|
SCH_SHEET_LIST SheetList;
|
||||||
|
|
||||||
Sheet = SheetList.GetFirst();
|
Sheet = SheetList.GetFirst();
|
||||||
if( !Find_in_hierarchy )
|
if( !Find_in_hierarchy )
|
||||||
|
@ -474,7 +467,9 @@ SCH_ITEM* WinEDA_SchematicFrame::FindSchematicItem(
|
||||||
pos = pSch->GetField( REFERENCE )->m_Pos;
|
pos = pSch->GetField( REFERENCE )->m_Pos;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if( WildCompareString( WildText, pSch->GetField( VALUE )->m_Text, FALSE ) )
|
if( WildCompareString( WildText,
|
||||||
|
pSch->GetField( VALUE )->m_Text,
|
||||||
|
false ) )
|
||||||
{
|
{
|
||||||
NotFound = FALSE;
|
NotFound = FALSE;
|
||||||
pos = pSch->GetField( VALUE )->m_Pos;
|
pos = pSch->GetField( VALUE )->m_Pos;
|
||||||
|
@ -611,7 +606,7 @@ SCH_ITEM* WinEDA_SchematicFrame::FindSchematicItem(
|
||||||
if( !mouseWarp )
|
if( !mouseWarp )
|
||||||
{
|
{
|
||||||
// if called from RemoteCommand() don't popup the dialog which
|
// if called from RemoteCommand() don't popup the dialog which
|
||||||
// needs to be dismissed, user is in PCBNEW, and does'nt want to
|
// needs to be dismissed, user is in PCBNEW, and doesn't want to
|
||||||
// bother with dismissing the dialog in EESCHEMA.
|
// bother with dismissing the dialog in EESCHEMA.
|
||||||
msg = WildText + _( " Not Found" );
|
msg = WildText + _( " Not Found" );
|
||||||
DisplayError( this, msg, 10 );
|
DisplayError( this, msg, 10 );
|
||||||
|
@ -700,9 +695,8 @@ void WinEDA_FindFrame::LocatePartInLibs( wxCommandEvent& event )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************************/
|
int WinEDA_FindFrame::ExploreAllLibraries( const wxString& wildmask,
|
||||||
int WinEDA_FindFrame::ExploreAllLibraries( const wxString& wildmask, wxString& FindList )
|
wxString& FindList )
|
||||||
/***************************************************************************************/
|
|
||||||
{
|
{
|
||||||
wxString FullFileName;
|
wxString FullFileName;
|
||||||
FILE* file;
|
FILE* file;
|
||||||
|
@ -713,7 +707,8 @@ int WinEDA_FindFrame::ExploreAllLibraries( const wxString& wildmask, wxString& F
|
||||||
for( unsigned ii = 0; ii < wxGetApp().GetLibraryPathList().GetCount(); ii++ )
|
for( unsigned ii = 0; ii < wxGetApp().GetLibraryPathList().GetCount(); ii++ )
|
||||||
{
|
{
|
||||||
path = wxGetApp().GetLibraryPathList()[ii] + STRING_DIR_SEP;
|
path = wxGetApp().GetLibraryPathList()[ii] + STRING_DIR_SEP;
|
||||||
FullFileName = wxFindFirstFile( path + wxT( "*." ) + CompLibFileExtension );
|
FullFileName = wxFindFirstFile( path + wxT( "*." ) +
|
||||||
|
CompLibFileExtension );
|
||||||
|
|
||||||
while( !FullFileName.IsEmpty() )
|
while( !FullFileName.IsEmpty() )
|
||||||
{
|
{
|
||||||
|
@ -725,7 +720,8 @@ int WinEDA_FindFrame::ExploreAllLibraries( const wxString& wildmask, wxString& F
|
||||||
{
|
{
|
||||||
if( strnicmp( Line, "DEF", 3 ) == 0 )
|
if( strnicmp( Line, "DEF", 3 ) == 0 )
|
||||||
{
|
{
|
||||||
/* Read one DEF part from library: DEF 74LS00 U 0 30 Y Y 4 0 N */
|
/* Read one DEF part from library:
|
||||||
|
* DEF 74LS00 U 0 30 Y Y 4 0 N */
|
||||||
strtok( Line, " \t\r\n" );
|
strtok( Line, " \t\r\n" );
|
||||||
name = strtok( NULL, " \t\r\n" );
|
name = strtok( NULL, " \t\r\n" );
|
||||||
wxString st_name = CONV_FROM_UTF8( name );
|
wxString st_name = CONV_FROM_UTF8( name );
|
||||||
|
@ -740,7 +736,8 @@ int WinEDA_FindFrame::ExploreAllLibraries( const wxString& wildmask, wxString& F
|
||||||
}
|
}
|
||||||
else if( strnicmp( Line, "ALIAS", 5 ) == 0 )
|
else if( strnicmp( Line, "ALIAS", 5 ) == 0 )
|
||||||
{
|
{
|
||||||
/* Read one ALIAS part from library: ALIAS 74HC00 74HCT00 7400 74LS37 */
|
/* Read one ALIAS part from library:
|
||||||
|
* ALIAS 74HC00 74HCT00 7400 74LS37 */
|
||||||
strtok( Line, " \t\r\n" );
|
strtok( Line, " \t\r\n" );
|
||||||
while( ( name = strtok( NULL, " \t\r\n" ) ) != NULL )
|
while( ( name = strtok( NULL, " \t\r\n" ) ) != NULL )
|
||||||
{
|
{
|
||||||
|
|
|
@ -26,14 +26,14 @@ enum
|
||||||
|
|
||||||
class WinEDA_HierFrame;
|
class WinEDA_HierFrame;
|
||||||
|
|
||||||
/* This class derived from wxTreeItemData stores the DrawSheetPath of each
|
/* This class derived from wxTreeItemData stores the SCH_SHEET_PATH of each
|
||||||
* sheet in hierarchy in each TreeItem, in its associated data buffer
|
* sheet in hierarchy in each TreeItem, in its associated data buffer
|
||||||
*/
|
*/
|
||||||
class TreeItemData : public wxTreeItemData
|
class TreeItemData : public wxTreeItemData
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
DrawSheetPath m_SheetPath;
|
SCH_SHEET_PATH m_SheetPath;
|
||||||
TreeItemData( DrawSheetPath sheet ) : wxTreeItemData()
|
TreeItemData( SCH_SHEET_PATH sheet ) : wxTreeItemData()
|
||||||
{
|
{
|
||||||
m_SheetPath = sheet;
|
m_SheetPath = sheet;
|
||||||
}
|
}
|
||||||
|
@ -52,13 +52,14 @@ public:
|
||||||
|
|
||||||
DECLARE_DYNAMIC_CLASS( WinEDA_Tree )
|
DECLARE_DYNAMIC_CLASS( WinEDA_Tree )
|
||||||
};
|
};
|
||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS( WinEDA_Tree, wxTreeCtrl )
|
IMPLEMENT_DYNAMIC_CLASS( WinEDA_Tree, wxTreeCtrl )
|
||||||
|
|
||||||
|
|
||||||
WinEDA_Tree::WinEDA_Tree( WinEDA_HierFrame* parent ) :
|
WinEDA_Tree::WinEDA_Tree( WinEDA_HierFrame* parent ) :
|
||||||
wxTreeCtrl( (wxWindow*)parent, ID_TREECTRL_HIERARCHY,
|
wxTreeCtrl( (wxWindow*)parent, ID_TREECTRL_HIERARCHY,
|
||||||
wxDefaultPosition, wxDefaultSize,
|
wxDefaultPosition, wxDefaultSize,
|
||||||
wxTR_HAS_BUTTONS, wxDefaultValidator, wxT( "HierachyTreeCtrl" ) )
|
wxTR_HAS_BUTTONS, wxDefaultValidator, wxT( "HierachyTreeCtrl" ) )
|
||||||
{
|
{
|
||||||
m_Parent = parent;
|
m_Parent = parent;
|
||||||
|
|
||||||
|
@ -86,7 +87,7 @@ private:
|
||||||
|
|
||||||
public:
|
public:
|
||||||
WinEDA_HierFrame( WinEDA_SchematicFrame* parent, wxDC* DC, const wxPoint& pos );
|
WinEDA_HierFrame( WinEDA_SchematicFrame* parent, wxDC* DC, const wxPoint& pos );
|
||||||
void BuildSheetsTree( DrawSheetPath* list, wxTreeItemId* previousmenu );
|
void BuildSheetsTree( SCH_SHEET_PATH* list, wxTreeItemId* previousmenu );
|
||||||
|
|
||||||
~WinEDA_HierFrame();
|
~WinEDA_HierFrame();
|
||||||
|
|
||||||
|
@ -99,18 +100,17 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE( WinEDA_HierFrame, wxDialog )
|
BEGIN_EVENT_TABLE( WinEDA_HierFrame, wxDialog )
|
||||||
EVT_TREE_ITEM_ACTIVATED( ID_TREECTRL_HIERARCHY,
|
EVT_TREE_ITEM_ACTIVATED( ID_TREECTRL_HIERARCHY,
|
||||||
WinEDA_HierFrame::OnSelect )
|
WinEDA_HierFrame::OnSelect )
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************/
|
|
||||||
void WinEDA_SchematicFrame::InstallHierarchyFrame( wxDC* DC, wxPoint& pos )
|
void WinEDA_SchematicFrame::InstallHierarchyFrame( wxDC* DC, wxPoint& pos )
|
||||||
/*************************************************************************/
|
|
||||||
{
|
{
|
||||||
WinEDA_HierFrame* treeframe = new WinEDA_HierFrame( this, DC, pos );
|
WinEDA_HierFrame* treeframe = new WinEDA_HierFrame( this, DC, pos );
|
||||||
|
|
||||||
treeframe->ShowModal(); treeframe->Destroy();
|
treeframe->ShowModal();
|
||||||
|
treeframe->Destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -129,7 +129,7 @@ WinEDA_HierFrame::WinEDA_HierFrame( WinEDA_SchematicFrame* parent, wxDC* DC,
|
||||||
|
|
||||||
cellule = m_Tree->AddRoot( _( "Root" ), 0, 1 );
|
cellule = m_Tree->AddRoot( _( "Root" ), 0, 1 );
|
||||||
m_Tree->SetItemBold( cellule, TRUE );
|
m_Tree->SetItemBold( cellule, TRUE );
|
||||||
DrawSheetPath list;
|
SCH_SHEET_PATH list;
|
||||||
list.Push( g_RootSheet );
|
list.Push( g_RootSheet );
|
||||||
m_Tree->SetItemData( cellule, new TreeItemData( list ) );
|
m_Tree->SetItemData( cellule, new TreeItemData( list ) );
|
||||||
|
|
||||||
|
@ -167,9 +167,7 @@ WinEDA_HierFrame::~WinEDA_HierFrame()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/************************************************************************/
|
|
||||||
void WinEDA_HierFrame::OnQuit( wxCommandEvent& WXUNUSED (event) )
|
void WinEDA_HierFrame::OnQuit( wxCommandEvent& WXUNUSED (event) )
|
||||||
/************************************************************************/
|
|
||||||
{
|
{
|
||||||
// true is to force the frame to close
|
// true is to force the frame to close
|
||||||
Close( true );
|
Close( true );
|
||||||
|
@ -180,7 +178,7 @@ void WinEDA_HierFrame::OnQuit( wxCommandEvent& WXUNUSED (event) )
|
||||||
* Schematic
|
* Schematic
|
||||||
* This routine is re-entrant!
|
* This routine is re-entrant!
|
||||||
*/
|
*/
|
||||||
void WinEDA_HierFrame::BuildSheetsTree( DrawSheetPath* list,
|
void WinEDA_HierFrame::BuildSheetsTree( SCH_SHEET_PATH* list,
|
||||||
wxTreeItemId* previousmenu )
|
wxTreeItemId* previousmenu )
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -261,11 +259,12 @@ void WinEDA_SchematicFrame::InstallPreviousSheet()
|
||||||
ClearMsgPanel();
|
ClearMsgPanel();
|
||||||
|
|
||||||
//make a copy for testing purposes.
|
//make a copy for testing purposes.
|
||||||
DrawSheetPath listtemp = *m_CurrentSheet;
|
SCH_SHEET_PATH listtemp = *m_CurrentSheet;
|
||||||
listtemp.Pop();
|
listtemp.Pop();
|
||||||
if( listtemp.LastScreen() == NULL )
|
if( listtemp.LastScreen() == NULL )
|
||||||
{
|
{
|
||||||
DisplayError( this, wxT( "InstallPreviousScreen() Error: Sheet not found" ) );
|
DisplayError( this,
|
||||||
|
wxT( "InstallPreviousScreen() Error: Sheet not found" ) );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
m_CurrentSheet->Pop();
|
m_CurrentSheet->Pop();
|
||||||
|
@ -316,11 +315,12 @@ static bool UpdateScreenFromSheet( WinEDA_SchematicFrame* frame )
|
||||||
NewScreen->m_ScrollbarPos.x,
|
NewScreen->m_ScrollbarPos.x,
|
||||||
NewScreen->m_ScrollbarPos.y, TRUE );
|
NewScreen->m_ScrollbarPos.y, TRUE );
|
||||||
|
|
||||||
//update the References
|
// update the References
|
||||||
frame->m_CurrentSheet->UpdateAllScreenReferences();
|
frame->m_CurrentSheet->UpdateAllScreenReferences();
|
||||||
frame->SetSheetNumberAndCount();
|
frame->SetSheetNumberAndCount();
|
||||||
frame->DrawPanel->m_CanStartBlock = -1;
|
frame->DrawPanel->m_CanStartBlock = -1;
|
||||||
ActiveScreen = frame->m_CurrentSheet->LastScreen();
|
ActiveScreen = frame->m_CurrentSheet->LastScreen();
|
||||||
|
|
||||||
if( NewScreen->m_FirstRedraw )
|
if( NewScreen->m_FirstRedraw )
|
||||||
{
|
{
|
||||||
NewScreen->m_FirstRedraw = FALSE;
|
NewScreen->m_FirstRedraw = FALSE;
|
||||||
|
|
|
@ -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[] =
|
||||||
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,
|
||||||
{
|
{
|
||||||
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,
|
||||||
|
|
||||||
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 );
|
||||||
}
|
}
|
||||||
|
|
|
@ -508,7 +508,8 @@ lost!\n\nClear the current component from the screen?" ) ) )
|
||||||
|
|
||||||
if( dlg.GetName().IsEmpty() )
|
if( dlg.GetName().IsEmpty() )
|
||||||
{
|
{
|
||||||
wxMessageBox(_("This new component has no name and cannot be created. Aborted"));
|
wxMessageBox( _( "This new component has no name and cannot be \
|
||||||
|
created. Aborted" ) );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,20 +39,20 @@ static void LoadLayers( FILE* f, int* linecnt );
|
||||||
bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen,
|
bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen,
|
||||||
const wxString& FullFileName )
|
const wxString& FullFileName )
|
||||||
{
|
{
|
||||||
char Line[1024], * SLine;
|
char Line[1024], * SLine;
|
||||||
char Name1[256],
|
char Name1[256],
|
||||||
Name2[256];
|
Name2[256];
|
||||||
int ii, layer;
|
int ii, layer;
|
||||||
wxPoint pos;
|
wxPoint pos;
|
||||||
bool Failed = FALSE;
|
bool Failed = FALSE;
|
||||||
SCH_ITEM* Phead, * Pnext;
|
SCH_ITEM* Phead, * Pnext;
|
||||||
DrawJunctionStruct* ConnectionStruct;
|
SCH_JUNCTION* ConnectionStruct;
|
||||||
DrawPolylineStruct* PolylineStruct;
|
SCH_POLYLINE* PolylineStruct;
|
||||||
EDA_DrawLineStruct* SegmentStruct;
|
SCH_LINE* SegmentStruct;
|
||||||
DrawBusEntryStruct* RaccordStruct;
|
SCH_BUS_ENTRY* RaccordStruct;
|
||||||
DrawNoConnectStruct* NoConnectStruct;
|
SCH_NO_CONNECT* NoConnectStruct;
|
||||||
int LineCount;
|
int LineCount;
|
||||||
wxString MsgDiag; /* Error and log messages */
|
wxString MsgDiag; /* Error and log messages */
|
||||||
|
|
||||||
FILE* f;
|
FILE* f;
|
||||||
|
|
||||||
|
@ -185,7 +185,7 @@ again." );
|
||||||
if( Name1[0] == 'B' )
|
if( Name1[0] == 'B' )
|
||||||
layer = LAYER_BUS;
|
layer = LAYER_BUS;
|
||||||
|
|
||||||
SegmentStruct = new EDA_DrawLineStruct( wxPoint( 0, 0 ), layer );
|
SegmentStruct = new SCH_LINE( wxPoint( 0, 0 ), layer );
|
||||||
|
|
||||||
LineCount++;
|
LineCount++;
|
||||||
if( fgets( Line, 256 - 1, f ) == NULL
|
if( fgets( Line, 256 - 1, f ) == NULL
|
||||||
|
@ -222,7 +222,7 @@ again." );
|
||||||
ii = WIRE_TO_BUS;
|
ii = WIRE_TO_BUS;
|
||||||
if( Name1[0] == 'B' )
|
if( Name1[0] == 'B' )
|
||||||
ii = BUS_TO_BUS;
|
ii = BUS_TO_BUS;
|
||||||
RaccordStruct = new DrawBusEntryStruct( wxPoint( 0, 0 ), '\\', ii );
|
RaccordStruct = new SCH_BUS_ENTRY( wxPoint( 0, 0 ), '\\', ii );
|
||||||
|
|
||||||
LineCount++;
|
LineCount++;
|
||||||
if( fgets( Line, 256 - 1, f ) == NULL
|
if( fgets( Line, 256 - 1, f ) == NULL
|
||||||
|
@ -262,7 +262,7 @@ again." );
|
||||||
if( Name2[0] == 'B' )
|
if( Name2[0] == 'B' )
|
||||||
layer = LAYER_BUS;
|
layer = LAYER_BUS;
|
||||||
|
|
||||||
PolylineStruct = new DrawPolylineStruct( layer );
|
PolylineStruct = new SCH_POLYLINE( layer );
|
||||||
for( unsigned jj = 0; jj < (unsigned)ii; jj++ )
|
for( unsigned jj = 0; jj < (unsigned)ii; jj++ )
|
||||||
{
|
{
|
||||||
LineCount++;
|
LineCount++;
|
||||||
|
@ -290,13 +290,14 @@ at line %d, aborted" ),
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'C': /* It is a connection item. */
|
case 'C': /* It is a connection item. */
|
||||||
ConnectionStruct = new DrawJunctionStruct( wxPoint( 0, 0 ) );
|
ConnectionStruct = new SCH_JUNCTION( wxPoint( 0, 0 ) );
|
||||||
|
|
||||||
if( sscanf( SLine, "%s %d %d", Name1, &ConnectionStruct->m_Pos.x,
|
if( sscanf( SLine, "%s %d %d", Name1, &ConnectionStruct->m_Pos.x,
|
||||||
&ConnectionStruct->m_Pos.y ) != 3 )
|
&ConnectionStruct->m_Pos.y ) != 3 )
|
||||||
{
|
{
|
||||||
MsgDiag.Printf( wxT( "EESchema file connection struct error \
|
MsgDiag.Printf( wxT( "EESchema file connection struct error \
|
||||||
at line %d, aborted" ), LineCount );
|
at line %d, aborted" ),
|
||||||
|
LineCount );
|
||||||
MsgDiag << wxT( "\n" ) << CONV_FROM_UTF8( Line );
|
MsgDiag << wxT( "\n" ) << CONV_FROM_UTF8( Line );
|
||||||
Failed = true;
|
Failed = true;
|
||||||
SAFE_DELETE( ConnectionStruct );
|
SAFE_DELETE( ConnectionStruct );
|
||||||
|
@ -318,7 +319,7 @@ at line %d, aborted" ),
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
NoConnectStruct = new DrawNoConnectStruct( pos );
|
NoConnectStruct = new SCH_NO_CONNECT( pos );
|
||||||
NoConnectStruct->SetNext( screen->EEDrawList );
|
NoConnectStruct->SetNext( screen->EEDrawList );
|
||||||
screen->EEDrawList = NoConnectStruct;
|
screen->EEDrawList = NoConnectStruct;
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,12 +72,6 @@ SCH_COMPONENT* LocateSmallestComponent( SCH_SCREEN* Screen )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************/
|
|
||||||
SCH_ITEM* PickStruct( const wxPoint& refpos,
|
|
||||||
BASE_SCREEN* screen,
|
|
||||||
int SearchMask )
|
|
||||||
{
|
|
||||||
/******************************************************************************/
|
|
||||||
/* Search an item at pos refpos
|
/* Search an item at pos refpos
|
||||||
* SearchMask = (bitwise OR):
|
* SearchMask = (bitwise OR):
|
||||||
* LIBITEM
|
* LIBITEM
|
||||||
|
@ -105,6 +99,10 @@ SCH_ITEM* PickStruct( const wxPoint& refpos,
|
||||||
* pointer on item found or NULL
|
* pointer on item found or NULL
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
SCH_ITEM* PickStruct( const wxPoint& refpos,
|
||||||
|
BASE_SCREEN* screen,
|
||||||
|
int SearchMask )
|
||||||
|
{
|
||||||
bool Snapped;
|
bool Snapped;
|
||||||
|
|
||||||
if( screen == NULL || screen->EEDrawList == NULL )
|
if( screen == NULL || screen->EEDrawList == NULL )
|
||||||
|
@ -175,7 +173,7 @@ bool SnapPoint2( const wxPoint& aPosRef, int SearchMask,
|
||||||
{
|
{
|
||||||
case DRAW_POLYLINE_STRUCT_TYPE:
|
case DRAW_POLYLINE_STRUCT_TYPE:
|
||||||
#undef STRUCT
|
#undef STRUCT
|
||||||
#define STRUCT ( (DrawPolylineStruct*) DrawList )
|
#define STRUCT ( (SCH_POLYLINE*) DrawList )
|
||||||
if( !( SearchMask & (DRAWITEM | WIREITEM | BUSITEM) ) )
|
if( !( SearchMask & (DRAWITEM | WIREITEM | BUSITEM) ) )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -193,24 +191,24 @@ bool SnapPoint2( const wxPoint& aPosRef, int SearchMask,
|
||||||
|
|
||||||
case DRAW_SEGMENT_STRUCT_TYPE:
|
case DRAW_SEGMENT_STRUCT_TYPE:
|
||||||
#undef STRUCT
|
#undef STRUCT
|
||||||
#define STRUCT ( (EDA_DrawLineStruct*) DrawList )
|
#define STRUCT ( (SCH_LINE*) DrawList )
|
||||||
if( !( SearchMask & (DRAWITEM | WIREITEM | BUSITEM) ) )
|
if( !( SearchMask & (DRAWITEM | WIREITEM | BUSITEM) ) )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if( TestSegmentHit( aPosRef, STRUCT->m_Start, STRUCT->m_End, 0 ) )
|
if( TestSegmentHit( aPosRef, STRUCT->m_Start, STRUCT->m_End, 0 ) )
|
||||||
{
|
{
|
||||||
if( ( (SearchMask & DRAWITEM)
|
if( ( ( SearchMask & DRAWITEM )
|
||||||
&& (STRUCT->GetLayer() == LAYER_NOTES) )
|
&& ( STRUCT->GetLayer() == LAYER_NOTES ) )
|
||||||
|| ( (SearchMask & WIREITEM)
|
|| ( ( SearchMask & WIREITEM )
|
||||||
&& (STRUCT->GetLayer() == LAYER_WIRE) )
|
&& ( STRUCT->GetLayer() == LAYER_WIRE ) )
|
||||||
|| ( (SearchMask & BUSITEM)
|
|| ( ( SearchMask & BUSITEM )
|
||||||
&& (STRUCT->GetLayer() == LAYER_BUS) )
|
&& ( STRUCT->GetLayer() == LAYER_BUS ) )
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if( SearchMask & EXCLUDE_WIRE_BUS_ENDPOINTS )
|
if( SearchMask & EXCLUDE_WIRE_BUS_ENDPOINTS )
|
||||||
{
|
{
|
||||||
if( aPosRef == STRUCT->m_Start || aPosRef ==
|
if( aPosRef == STRUCT->m_Start
|
||||||
STRUCT->m_End )
|
|| aPosRef == STRUCT->m_End )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -229,7 +227,7 @@ bool SnapPoint2( const wxPoint& aPosRef, int SearchMask,
|
||||||
|
|
||||||
case DRAW_BUSENTRY_STRUCT_TYPE:
|
case DRAW_BUSENTRY_STRUCT_TYPE:
|
||||||
#undef STRUCT
|
#undef STRUCT
|
||||||
#define STRUCT ( (DrawBusEntryStruct*) DrawList )
|
#define STRUCT ( (SCH_BUS_ENTRY*) DrawList )
|
||||||
if( !( SearchMask & (RACCORDITEM) ) )
|
if( !( SearchMask & (RACCORDITEM) ) )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -243,7 +241,7 @@ bool SnapPoint2( const wxPoint& aPosRef, int SearchMask,
|
||||||
|
|
||||||
case DRAW_JUNCTION_STRUCT_TYPE:
|
case DRAW_JUNCTION_STRUCT_TYPE:
|
||||||
#undef STRUCT
|
#undef STRUCT
|
||||||
#define STRUCT ( (DrawJunctionStruct*) DrawList )
|
#define STRUCT ( (SCH_JUNCTION*) DrawList )
|
||||||
if( !(SearchMask & JUNCTIONITEM) )
|
if( !(SearchMask & JUNCTIONITEM) )
|
||||||
break;
|
break;
|
||||||
if( STRUCT->HitTest( aPosRef ) )
|
if( STRUCT->HitTest( aPosRef ) )
|
||||||
|
@ -255,7 +253,7 @@ bool SnapPoint2( const wxPoint& aPosRef, int SearchMask,
|
||||||
|
|
||||||
case DRAW_NOCONNECT_STRUCT_TYPE:
|
case DRAW_NOCONNECT_STRUCT_TYPE:
|
||||||
#undef STRUCT
|
#undef STRUCT
|
||||||
#define STRUCT ( (DrawNoConnectStruct*) DrawList )
|
#define STRUCT ( (SCH_NO_CONNECT*) DrawList )
|
||||||
if( !(SearchMask & NOCONNECTITEM) )
|
if( !(SearchMask & NOCONNECTITEM) )
|
||||||
break;
|
break;
|
||||||
if( STRUCT->HitTest( aPosRef ) )
|
if( STRUCT->HitTest( aPosRef ) )
|
||||||
|
@ -265,10 +263,10 @@ bool SnapPoint2( const wxPoint& aPosRef, int SearchMask,
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TYPE_MARKER_SCH:
|
case TYPE_SCH_MARKER:
|
||||||
{
|
{
|
||||||
#undef STRUCT
|
#undef STRUCT
|
||||||
#define STRUCT ( (MARKER_SCH*) DrawList )
|
#define STRUCT ( (SCH_MARKER*) DrawList )
|
||||||
if( !(SearchMask & MARKERITEM) )
|
if( !(SearchMask & MARKERITEM) )
|
||||||
break;
|
break;
|
||||||
if( STRUCT->HitTest( aPosRef ) )
|
if( STRUCT->HitTest( aPosRef ) )
|
||||||
|
@ -316,7 +314,7 @@ bool SnapPoint2( const wxPoint& aPosRef, int SearchMask,
|
||||||
SCH_COMPONENT* DrawLibItem = (SCH_COMPONENT*) DrawList;
|
SCH_COMPONENT* DrawLibItem = (SCH_COMPONENT*) DrawList;
|
||||||
for( int i = REFERENCE; i < DrawLibItem->GetFieldCount(); i++ )
|
for( int i = REFERENCE; i < DrawLibItem->GetFieldCount(); i++ )
|
||||||
{
|
{
|
||||||
SCH_CMP_FIELD* field = DrawLibItem->GetField( i );
|
SCH_FIELD* field = DrawLibItem->GetField( i );
|
||||||
|
|
||||||
if( field->m_Attributs & TEXT_NO_VISIBLE )
|
if( field->m_Attributs & TEXT_NO_VISIBLE )
|
||||||
continue;
|
continue;
|
||||||
|
@ -386,7 +384,7 @@ bool IsItemInBox( EDA_Rect& aBox, SCH_ITEM* DrawStruct )
|
||||||
{
|
{
|
||||||
case DRAW_POLYLINE_STRUCT_TYPE:
|
case DRAW_POLYLINE_STRUCT_TYPE:
|
||||||
#undef STRUCT
|
#undef STRUCT
|
||||||
#define STRUCT ( (DrawPolylineStruct*) DrawStruct )
|
#define STRUCT ( (SCH_POLYLINE*) DrawStruct )
|
||||||
for( unsigned i = 0; i < STRUCT->GetCornerCount(); i++ )
|
for( unsigned i = 0; i < STRUCT->GetCornerCount(); i++ )
|
||||||
{
|
{
|
||||||
if( aBox.Inside(STRUCT->m_PolyPoints[i]) )
|
if( aBox.Inside(STRUCT->m_PolyPoints[i]) )
|
||||||
|
@ -397,7 +395,7 @@ bool IsItemInBox( EDA_Rect& aBox, SCH_ITEM* DrawStruct )
|
||||||
|
|
||||||
case DRAW_SEGMENT_STRUCT_TYPE:
|
case DRAW_SEGMENT_STRUCT_TYPE:
|
||||||
#undef STRUCT
|
#undef STRUCT
|
||||||
#define STRUCT ( (EDA_DrawLineStruct*) DrawStruct )
|
#define STRUCT ( (SCH_LINE*) DrawStruct )
|
||||||
if( aBox.Inside(STRUCT->m_Start) )
|
if( aBox.Inside(STRUCT->m_Start) )
|
||||||
return true;
|
return true;
|
||||||
if( aBox.Inside(STRUCT->m_End) )
|
if( aBox.Inside(STRUCT->m_End) )
|
||||||
|
@ -406,7 +404,7 @@ bool IsItemInBox( EDA_Rect& aBox, SCH_ITEM* DrawStruct )
|
||||||
|
|
||||||
case DRAW_BUSENTRY_STRUCT_TYPE:
|
case DRAW_BUSENTRY_STRUCT_TYPE:
|
||||||
#undef STRUCT
|
#undef STRUCT
|
||||||
#define STRUCT ( (DrawBusEntryStruct*) DrawStruct )
|
#define STRUCT ( (SCH_BUS_ENTRY*) DrawStruct )
|
||||||
if( aBox.Inside(STRUCT->m_Pos) )
|
if( aBox.Inside(STRUCT->m_Pos) )
|
||||||
return true;
|
return true;
|
||||||
if( aBox.Inside(STRUCT->m_End() ) )
|
if( aBox.Inside(STRUCT->m_End() ) )
|
||||||
|
@ -421,7 +419,7 @@ bool IsItemInBox( EDA_Rect& aBox, SCH_ITEM* DrawStruct )
|
||||||
case TYPE_SCH_GLOBALLABEL:
|
case TYPE_SCH_GLOBALLABEL:
|
||||||
case TYPE_SCH_COMPONENT:
|
case TYPE_SCH_COMPONENT:
|
||||||
case DRAW_SHEET_STRUCT_TYPE:
|
case DRAW_SHEET_STRUCT_TYPE:
|
||||||
case TYPE_MARKER_SCH:
|
case TYPE_SCH_MARKER:
|
||||||
BoundaryBox = DrawStruct->GetBoundingBox();
|
BoundaryBox = DrawStruct->GetBoundingBox();
|
||||||
if( aBox.Intersects( BoundaryBox ) )
|
if( aBox.Intersects( BoundaryBox ) )
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -17,6 +17,12 @@
|
||||||
#include "class_library.h"
|
#include "class_library.h"
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @bug - Every place in this file where fprintf() is used and the return
|
||||||
|
* is not checked is a bug. The fprintf() function can fail and
|
||||||
|
* returns a value less than 0 when it does.
|
||||||
|
*/
|
||||||
|
|
||||||
static void Write_GENERIC_NetList( WinEDA_SchematicFrame* frame,
|
static void Write_GENERIC_NetList( WinEDA_SchematicFrame* frame,
|
||||||
const wxString& FullFileName );
|
const wxString& FullFileName );
|
||||||
static void WriteNetListPCBNEW( WinEDA_SchematicFrame* frame, FILE* f,
|
static void WriteNetListPCBNEW( WinEDA_SchematicFrame* frame, FILE* f,
|
||||||
|
@ -27,33 +33,31 @@ static void WriteNetListPspice( WinEDA_SchematicFrame* frame, FILE* f,
|
||||||
bool use_netnames );
|
bool use_netnames );
|
||||||
|
|
||||||
static void WriteGENERICListOfNets( FILE* f, NETLIST_OBJECT_LIST& aObjectsList );
|
static void WriteGENERICListOfNets( FILE* f, NETLIST_OBJECT_LIST& aObjectsList );
|
||||||
static void AddPinToComponentPinList( SCH_COMPONENT* Component,
|
static void AddPinToComponentPinList( SCH_COMPONENT* Component,
|
||||||
DrawSheetPath* sheet,
|
SCH_SHEET_PATH* sheet,
|
||||||
LIB_PIN* PinEntry );
|
LIB_PIN* PinEntry );
|
||||||
static void FindAllsInstancesOfComponent( SCH_COMPONENT* Component,
|
static void FindAllsInstancesOfComponent( SCH_COMPONENT* Component,
|
||||||
LIB_COMPONENT* Entry,
|
LIB_COMPONENT* Entry,
|
||||||
DrawSheetPath* Sheet_in );
|
SCH_SHEET_PATH* Sheet_in );
|
||||||
static bool SortPinsByNum( NETLIST_OBJECT* Pin1, NETLIST_OBJECT* Pin2 );
|
static bool SortPinsByNum( NETLIST_OBJECT* Pin1, NETLIST_OBJECT* Pin2 );
|
||||||
static void EraseDuplicatePins( NETLIST_OBJECT_LIST& aPinList );
|
static void EraseDuplicatePins( NETLIST_OBJECT_LIST& aPinList );
|
||||||
|
|
||||||
static void ClearUsedFlags( void );
|
static void ClearUsedFlags( void );
|
||||||
|
|
||||||
|
|
||||||
/* Local variables */
|
|
||||||
static NETLIST_OBJECT_LIST s_SortedComponentPinList;
|
static NETLIST_OBJECT_LIST s_SortedComponentPinList;
|
||||||
|
|
||||||
// list of references already found for multi part per packages components
|
// list of references already found for multi part per packages components
|
||||||
// (used to avoid to used more than one time a component)
|
// (used to avoid to used more than one time a component)
|
||||||
static wxArrayString s_ReferencesAlreadyFound;
|
static wxArrayString s_ReferencesAlreadyFound;
|
||||||
|
|
||||||
/******************************************************************************/
|
|
||||||
void WriteNetList( WinEDA_SchematicFrame* frame, const wxString& FileNameNL,
|
|
||||||
bool use_netnames )
|
|
||||||
{
|
|
||||||
/*******************************************************************************/
|
|
||||||
/* Create the netlist file ( Format is given by frame->m_NetlistFormat )
|
/* Create the netlist file ( Format is given by frame->m_NetlistFormat )
|
||||||
* bool use_netnames is used only for Spice netlist
|
* bool use_netnames is used only for Spice netlist
|
||||||
*/
|
*/
|
||||||
|
void WriteNetList( WinEDA_SchematicFrame* frame, const wxString& FileNameNL,
|
||||||
|
bool use_netnames )
|
||||||
|
{
|
||||||
FILE* f = NULL;
|
FILE* f = NULL;
|
||||||
|
|
||||||
if( frame->m_NetlistFormat < NET_TYPE_CUSTOM1 )
|
if( frame->m_NetlistFormat < NET_TYPE_CUSTOM1 )
|
||||||
|
@ -106,7 +110,7 @@ void WriteNetList( WinEDA_SchematicFrame* frame, const wxString& FileNameNL,
|
||||||
*/
|
*/
|
||||||
static SCH_COMPONENT* FindNextComponentAndCreatPinList(
|
static SCH_COMPONENT* FindNextComponentAndCreatPinList(
|
||||||
EDA_BaseStruct* DrawList,
|
EDA_BaseStruct* DrawList,
|
||||||
DrawSheetPath* sheet )
|
SCH_SHEET_PATH* sheet )
|
||||||
{
|
{
|
||||||
SCH_COMPONENT* Component = NULL;
|
SCH_COMPONENT* Component = NULL;
|
||||||
LIB_COMPONENT* Entry;
|
LIB_COMPONENT* Entry;
|
||||||
|
@ -254,7 +258,7 @@ void Write_GENERIC_NetList( WinEDA_SchematicFrame* frame,
|
||||||
const wxString& FullFileName )
|
const wxString& FullFileName )
|
||||||
{
|
{
|
||||||
wxString Line, FootprintName;
|
wxString Line, FootprintName;
|
||||||
DrawSheetPath* sheet;
|
SCH_SHEET_PATH* sheet;
|
||||||
EDA_BaseStruct* SchItem;
|
EDA_BaseStruct* SchItem;
|
||||||
SCH_COMPONENT* Component;
|
SCH_COMPONENT* Component;
|
||||||
wxString netname;
|
wxString netname;
|
||||||
|
@ -276,7 +280,7 @@ void Write_GENERIC_NetList( WinEDA_SchematicFrame* frame,
|
||||||
|
|
||||||
/* Create netlist module section */
|
/* Create netlist module section */
|
||||||
fprintf( tmpfile, "$BeginComponentList\n" );
|
fprintf( tmpfile, "$BeginComponentList\n" );
|
||||||
EDA_SheetList SheetList;
|
SCH_SHEET_LIST SheetList;
|
||||||
|
|
||||||
for( sheet = SheetList.GetFirst();
|
for( sheet = SheetList.GetFirst();
|
||||||
sheet != NULL;
|
sheet != NULL;
|
||||||
|
@ -381,7 +385,7 @@ static void WriteNetListPspice( WinEDA_SchematicFrame* frame, FILE* f,
|
||||||
bool use_netnames )
|
bool use_netnames )
|
||||||
{
|
{
|
||||||
char Line[1024];
|
char Line[1024];
|
||||||
DrawSheetPath* sheet;
|
SCH_SHEET_PATH* sheet;
|
||||||
EDA_BaseStruct* DrawList;
|
EDA_BaseStruct* DrawList;
|
||||||
SCH_COMPONENT* Component;
|
SCH_COMPONENT* Component;
|
||||||
int nbitems;
|
int nbitems;
|
||||||
|
@ -402,7 +406,7 @@ static void WriteNetListPspice( WinEDA_SchematicFrame* frame, FILE* f,
|
||||||
* commands) and create text list starting by [+]pspice , or [+]gnucap
|
* commands) and create text list starting by [+]pspice , or [+]gnucap
|
||||||
* (simulator commands) */
|
* (simulator commands) */
|
||||||
bufnum[BUFYPOS_LEN] = 0;
|
bufnum[BUFYPOS_LEN] = 0;
|
||||||
EDA_SheetList SheetList;
|
SCH_SHEET_LIST SheetList;
|
||||||
|
|
||||||
for( sheet = SheetList.GetFirst();
|
for( sheet = SheetList.GetFirst();
|
||||||
sheet != NULL;
|
sheet != NULL;
|
||||||
|
@ -541,9 +545,9 @@ static void WriteNetListPCBNEW( WinEDA_SchematicFrame* frame,
|
||||||
{
|
{
|
||||||
wxString Line, FootprintName;
|
wxString Line, FootprintName;
|
||||||
char Buf[256];
|
char Buf[256];
|
||||||
DrawSheetPath* sheet;
|
SCH_SHEET_PATH* sheet;
|
||||||
EDA_BaseStruct* DrawList;
|
EDA_BaseStruct* DrawList;
|
||||||
SCH_COMPONENT* Component;
|
SCH_COMPONENT* Component;
|
||||||
OBJ_CMP_TO_LIST* CmpList = NULL;
|
OBJ_CMP_TO_LIST* CmpList = NULL;
|
||||||
int CmpListCount = 0, CmpListSize = 1000;
|
int CmpListCount = 0, CmpListSize = 1000;
|
||||||
|
|
||||||
|
@ -556,9 +560,9 @@ static void WriteNetListPCBNEW( WinEDA_SchematicFrame* frame,
|
||||||
|
|
||||||
/* Create netlist module section */
|
/* Create netlist module section */
|
||||||
ClearUsedFlags(); /* Reset the flags FlagControlMulti in all schematic
|
ClearUsedFlags(); /* Reset the flags FlagControlMulti in all schematic
|
||||||
*files*/
|
* files*/
|
||||||
|
|
||||||
EDA_SheetList SheetList;
|
SCH_SHEET_LIST SheetList;
|
||||||
|
|
||||||
for( sheet = SheetList.GetFirst();
|
for( sheet = SheetList.GetFirst();
|
||||||
sheet != NULL;
|
sheet != NULL;
|
||||||
|
@ -574,14 +578,13 @@ static void WriteNetListPCBNEW( WinEDA_SchematicFrame* frame,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* Get the Component FootprintFilter and put the component in
|
/* Get the Component FootprintFilter and put the component in
|
||||||
*CmpList if filter is not void */
|
* CmpList if filter is not void */
|
||||||
LIB_COMPONENT* Entry =
|
LIB_COMPONENT* Entry =
|
||||||
CMP_LIBRARY::FindLibraryComponent( Component->m_ChipName );
|
CMP_LIBRARY::FindLibraryComponent( Component->m_ChipName );
|
||||||
|
|
||||||
if( Entry != NULL )
|
if( Entry != NULL )
|
||||||
{
|
{
|
||||||
if( Entry->m_FootprintList.GetCount() != 0 ) /* Put in list
|
if( Entry->m_FootprintList.GetCount() != 0 ) /* Put in list */
|
||||||
**/
|
|
||||||
{
|
{
|
||||||
if( CmpList == NULL )
|
if( CmpList == NULL )
|
||||||
{
|
{
|
||||||
|
@ -678,7 +681,8 @@ static void WriteNetListPCBNEW( WinEDA_SchematicFrame* frame,
|
||||||
/* Write the footprint list */
|
/* Write the footprint list */
|
||||||
for( unsigned jj = 0; jj < Entry->m_FootprintList.GetCount(); jj++ )
|
for( unsigned jj = 0; jj < Entry->m_FootprintList.GetCount(); jj++ )
|
||||||
{
|
{
|
||||||
fprintf( f, " %s\n", CONV_TO_UTF8( Entry->m_FootprintList[jj] ) );
|
fprintf( f, " %s\n",
|
||||||
|
CONV_TO_UTF8( Entry->m_FootprintList[jj] ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf( f, "$endlist\n" );
|
fprintf( f, "$endlist\n" );
|
||||||
|
@ -705,7 +709,7 @@ static void WriteNetListPCBNEW( WinEDA_SchematicFrame* frame,
|
||||||
* created by BuildNetList() in the table g_NetObjectslist
|
* created by BuildNetList() in the table g_NetObjectslist
|
||||||
*/
|
*/
|
||||||
static void AddPinToComponentPinList( SCH_COMPONENT* Component,
|
static void AddPinToComponentPinList( SCH_COMPONENT* Component,
|
||||||
DrawSheetPath* sheetlist, LIB_PIN* Pin )
|
SCH_SHEET_PATH* sheetlist, LIB_PIN* Pin )
|
||||||
{
|
{
|
||||||
/* Search the PIN description for Pin in g_NetObjectslist*/
|
/* Search the PIN description for Pin in g_NetObjectslist*/
|
||||||
for( unsigned ii = 0; ii < g_NetObjectslist.size(); ii++ )
|
for( unsigned ii = 0; ii < g_NetObjectslist.size(); ii++ )
|
||||||
|
@ -797,17 +801,17 @@ static void EraseDuplicatePins( NETLIST_OBJECT_LIST& aPinList )
|
||||||
* Calls AddPinToComponentPinList() to and pins founds to the current
|
* Calls AddPinToComponentPinList() to and pins founds to the current
|
||||||
* component pin list
|
* component pin list
|
||||||
*/
|
*/
|
||||||
static void FindAllsInstancesOfComponent( SCH_COMPONENT* Component_in,
|
static void FindAllsInstancesOfComponent( SCH_COMPONENT* Component_in,
|
||||||
LIB_COMPONENT* Entry,
|
LIB_COMPONENT* Entry,
|
||||||
DrawSheetPath* Sheet_in )
|
SCH_SHEET_PATH* Sheet_in )
|
||||||
{
|
{
|
||||||
EDA_BaseStruct* SchItem;
|
EDA_BaseStruct* SchItem;
|
||||||
SCH_COMPONENT* Component2;
|
SCH_COMPONENT* Component2;
|
||||||
LIB_PIN* pin;
|
LIB_PIN* pin;
|
||||||
DrawSheetPath* sheet;
|
SCH_SHEET_PATH* sheet;
|
||||||
wxString str, Reference = Component_in->GetRef( Sheet_in );
|
wxString str, Reference = Component_in->GetRef( Sheet_in );
|
||||||
|
|
||||||
EDA_SheetList SheetList;
|
SCH_SHEET_LIST SheetList;
|
||||||
|
|
||||||
for( sheet = SheetList.GetFirst(); sheet != NULL;
|
for( sheet = SheetList.GetFirst(); sheet != NULL;
|
||||||
sheet = SheetList.GetNext() )
|
sheet = SheetList.GetNext() )
|
||||||
|
@ -991,7 +995,7 @@ static void WriteNetListCADSTAR( WinEDA_SchematicFrame* frame, FILE* f )
|
||||||
wxString msg;
|
wxString msg;
|
||||||
wxString FootprintName;
|
wxString FootprintName;
|
||||||
char Line[1024];
|
char Line[1024];
|
||||||
DrawSheetPath* sheet;
|
SCH_SHEET_PATH* sheet;
|
||||||
EDA_BaseStruct* DrawList;
|
EDA_BaseStruct* DrawList;
|
||||||
SCH_COMPONENT* Component;
|
SCH_COMPONENT* Component;
|
||||||
wxString Title = wxGetApp().GetAppName() + wxT( " " ) + GetBuildVersion();
|
wxString Title = wxGetApp().GetAppName() + wxT( " " ) + GetBuildVersion();
|
||||||
|
@ -1006,7 +1010,7 @@ static void WriteNetListCADSTAR( WinEDA_SchematicFrame* frame, FILE* f )
|
||||||
/* Create netlist module section */
|
/* Create netlist module section */
|
||||||
ClearUsedFlags(); /* Reset the flags FlagControlMulti in all schematic
|
ClearUsedFlags(); /* Reset the flags FlagControlMulti in all schematic
|
||||||
*files*/
|
*files*/
|
||||||
EDA_SheetList SheetList;
|
SCH_SHEET_LIST SheetList;
|
||||||
|
|
||||||
for( sheet = SheetList.GetFirst();
|
for( sheet = SheetList.GetFirst();
|
||||||
sheet != NULL;
|
sheet != NULL;
|
||||||
|
|
|
@ -21,7 +21,7 @@ NETLIST_OBJECT_LIST g_NetObjectslist;
|
||||||
|
|
||||||
static void PropageNetCode( int OldNetCode, int NewNetCode, int IsBus );
|
static void PropageNetCode( int OldNetCode, int NewNetCode, int IsBus );
|
||||||
static void SheetLabelConnect( NETLIST_OBJECT* SheetLabel );
|
static void SheetLabelConnect( NETLIST_OBJECT* SheetLabel );
|
||||||
static void ListeObjetConnection( DrawSheetPath* sheetlist,
|
static void ListeObjetConnection( SCH_SHEET_PATH* sheetlist,
|
||||||
NETLIST_OBJECT_LIST& aNetItemBuffer );
|
NETLIST_OBJECT_LIST& aNetItemBuffer );
|
||||||
static int ConvertBusToMembers( NETLIST_OBJECT_LIST& aNetItemBuffer,
|
static int ConvertBusToMembers( NETLIST_OBJECT_LIST& aNetItemBuffer,
|
||||||
NETLIST_OBJECT& ObjNet );
|
NETLIST_OBJECT& ObjNet );
|
||||||
|
@ -77,11 +77,11 @@ void FreeNetObjectsList( NETLIST_OBJECT_LIST& aNetObjectsBuffer )
|
||||||
*/
|
*/
|
||||||
void WinEDA_SchematicFrame::BuildNetListBase()
|
void WinEDA_SchematicFrame::BuildNetListBase()
|
||||||
{
|
{
|
||||||
int NetNumber;
|
int NetNumber;
|
||||||
int NetCode;
|
int NetCode;
|
||||||
DrawSheetPath* sheet;
|
SCH_SHEET_PATH* sheet;
|
||||||
wxString msg, activity;
|
wxString msg, activity;
|
||||||
wxBusyCursor Busy;
|
wxBusyCursor Busy;
|
||||||
|
|
||||||
NetNumber = 1;
|
NetNumber = 1;
|
||||||
|
|
||||||
|
@ -91,7 +91,7 @@ void WinEDA_SchematicFrame::BuildNetListBase()
|
||||||
FreeNetObjectsList( g_NetObjectslist );
|
FreeNetObjectsList( g_NetObjectslist );
|
||||||
|
|
||||||
/* Build the sheet (not screen) list (flattened)*/
|
/* Build the sheet (not screen) list (flattened)*/
|
||||||
EDA_SheetList SheetListList;
|
SCH_SHEET_LIST SheetListList;
|
||||||
|
|
||||||
/* Fill g_NetObjectslist with items used in connectivity calculation */
|
/* Fill g_NetObjectslist with items used in connectivity calculation */
|
||||||
|
|
||||||
|
@ -346,7 +346,7 @@ static void SheetLabelConnect( NETLIST_OBJECT* SheetLabel )
|
||||||
* @param aNetItemBuffer: a std::vector to store pointer on NETLIST_OBJECT
|
* @param aNetItemBuffer: a std::vector to store pointer on NETLIST_OBJECT
|
||||||
* created
|
* created
|
||||||
*/
|
*/
|
||||||
static void ListeObjetConnection( DrawSheetPath* sheetlist,
|
static void ListeObjetConnection( SCH_SHEET_PATH* sheetlist,
|
||||||
std::vector<NETLIST_OBJECT*>& aNetItemBuffer )
|
std::vector<NETLIST_OBJECT*>& aNetItemBuffer )
|
||||||
{
|
{
|
||||||
int ii;
|
int ii;
|
||||||
|
@ -356,7 +356,7 @@ static void ListeObjetConnection( DrawSheetPath* sheetlist,
|
||||||
LIB_COMPONENT* Entry;
|
LIB_COMPONENT* Entry;
|
||||||
LIB_PIN* pin;
|
LIB_PIN* pin;
|
||||||
SCH_SHEET_PIN* SheetLabel;
|
SCH_SHEET_PIN* SheetLabel;
|
||||||
DrawSheetPath list;
|
SCH_SHEET_PATH list;
|
||||||
|
|
||||||
DrawList = sheetlist->LastScreen()->EEDrawList;
|
DrawList = sheetlist->LastScreen()->EEDrawList;
|
||||||
for( ; DrawList; DrawList = DrawList->Next() )
|
for( ; DrawList; DrawList = DrawList->Next() )
|
||||||
|
@ -365,7 +365,7 @@ static void ListeObjetConnection( DrawSheetPath* sheetlist,
|
||||||
{
|
{
|
||||||
case DRAW_SEGMENT_STRUCT_TYPE:
|
case DRAW_SEGMENT_STRUCT_TYPE:
|
||||||
#undef STRUCT
|
#undef STRUCT
|
||||||
#define STRUCT ( (EDA_DrawLineStruct*) DrawList )
|
#define STRUCT ( (SCH_LINE*) DrawList )
|
||||||
if( (STRUCT->GetLayer() != LAYER_BUS)
|
if( (STRUCT->GetLayer() != LAYER_BUS)
|
||||||
&& (STRUCT->GetLayer() != LAYER_WIRE) )
|
&& (STRUCT->GetLayer() != LAYER_WIRE) )
|
||||||
break;
|
break;
|
||||||
|
@ -390,7 +390,7 @@ static void ListeObjetConnection( DrawSheetPath* sheetlist,
|
||||||
|
|
||||||
case DRAW_JUNCTION_STRUCT_TYPE:
|
case DRAW_JUNCTION_STRUCT_TYPE:
|
||||||
#undef STRUCT
|
#undef STRUCT
|
||||||
#define STRUCT ( (DrawJunctionStruct*) DrawList )
|
#define STRUCT ( (SCH_JUNCTION*) DrawList )
|
||||||
new_item = new NETLIST_OBJECT();
|
new_item = new NETLIST_OBJECT();
|
||||||
|
|
||||||
new_item->m_SheetList = *sheetlist;
|
new_item->m_SheetList = *sheetlist;
|
||||||
|
@ -404,7 +404,7 @@ static void ListeObjetConnection( DrawSheetPath* sheetlist,
|
||||||
|
|
||||||
case DRAW_NOCONNECT_STRUCT_TYPE:
|
case DRAW_NOCONNECT_STRUCT_TYPE:
|
||||||
#undef STRUCT
|
#undef STRUCT
|
||||||
#define STRUCT ( (DrawNoConnectStruct*) DrawList )
|
#define STRUCT ( (SCH_NO_CONNECT*) DrawList )
|
||||||
new_item = new NETLIST_OBJECT();
|
new_item = new NETLIST_OBJECT();
|
||||||
|
|
||||||
new_item->m_SheetList = *sheetlist;
|
new_item->m_SheetList = *sheetlist;
|
||||||
|
@ -533,7 +533,7 @@ static void ListeObjetConnection( DrawSheetPath* sheetlist,
|
||||||
|
|
||||||
case DRAW_POLYLINE_STRUCT_TYPE:
|
case DRAW_POLYLINE_STRUCT_TYPE:
|
||||||
case DRAW_BUSENTRY_STRUCT_TYPE:
|
case DRAW_BUSENTRY_STRUCT_TYPE:
|
||||||
case TYPE_MARKER_SCH:
|
case TYPE_SCH_MARKER:
|
||||||
case TYPE_SCH_TEXT:
|
case TYPE_SCH_TEXT:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,7 @@ public:
|
||||||
LIB_COMPONENT* m_Entry; // the source component in library
|
LIB_COMPONENT* m_Entry; // the source component in library
|
||||||
int m_Unit; /* Selected part (For multi parts per
|
int m_Unit; /* Selected part (For multi parts per
|
||||||
* package) depending on sheet path */
|
* package) depending on sheet path */
|
||||||
DrawSheetPath m_SheetPath; /* the sheet path for this component */
|
SCH_SHEET_PATH m_SheetPath; /* the sheet path for this component */
|
||||||
unsigned long m_TimeStamp; /* unique identification number
|
unsigned long m_TimeStamp; /* unique identification number
|
||||||
* depending on sheet path */
|
* depending on sheet path */
|
||||||
bool m_IsNew; /* true for not yet annotated
|
bool m_IsNew; /* true for not yet annotated
|
||||||
|
|
|
@ -361,12 +361,12 @@ void WinEDA_SchematicFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DRAW_PART_TEXT_STRUCT_TYPE:
|
case DRAW_PART_TEXT_STRUCT_TYPE:
|
||||||
EditCmpFieldText( (SCH_CMP_FIELD*) DrawStruct, DC );
|
EditCmpFieldText( (SCH_FIELD*) DrawStruct, DC );
|
||||||
DrawPanel->MouseToCursorSchema();
|
DrawPanel->MouseToCursorSchema();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TYPE_MARKER_SCH:
|
case TYPE_SCH_MARKER:
|
||||||
((MARKER_SCH*)DrawStruct)->DisplayMarkerInfo( this);
|
( (SCH_MARKER*) DrawStruct )->DisplayMarkerInfo( this );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -18,9 +18,9 @@
|
||||||
|
|
||||||
|
|
||||||
static void AddMenusForBlock( wxMenu* PopMenu, WinEDA_SchematicFrame* frame );
|
static void AddMenusForBlock( wxMenu* PopMenu, WinEDA_SchematicFrame* frame );
|
||||||
static void AddMenusForWire( wxMenu* PopMenu, EDA_DrawLineStruct* Wire,
|
static void AddMenusForWire( wxMenu* PopMenu, SCH_LINE* Wire,
|
||||||
WinEDA_SchematicFrame* frame );
|
WinEDA_SchematicFrame* frame );
|
||||||
static void AddMenusForBus( wxMenu* PopMenu, EDA_DrawLineStruct* Bus,
|
static void AddMenusForBus( wxMenu* PopMenu, SCH_LINE* Bus,
|
||||||
WinEDA_SchematicFrame* frame );
|
WinEDA_SchematicFrame* frame );
|
||||||
static void AddMenusForHierchicalSheet( wxMenu* PopMenu, SCH_SHEET* Sheet );
|
static void AddMenusForHierchicalSheet( wxMenu* PopMenu, SCH_SHEET* Sheet );
|
||||||
static void AddMenusForPinSheet( wxMenu* PopMenu, SCH_SHEET_PIN* PinSheet );
|
static void AddMenusForPinSheet( wxMenu* PopMenu, SCH_SHEET_PIN* PinSheet );
|
||||||
|
@ -29,10 +29,10 @@ static void AddMenusForLabel( wxMenu* PopMenu, SCH_LABEL* Label );
|
||||||
static void AddMenusForGLabel( wxMenu* PopMenu, SCH_GLOBALLABEL* GLabel );
|
static void AddMenusForGLabel( wxMenu* PopMenu, SCH_GLOBALLABEL* GLabel );
|
||||||
static void AddMenusForHLabel( wxMenu* PopMenu, SCH_HIERLABEL* GLabel );
|
static void AddMenusForHLabel( wxMenu* PopMenu, SCH_HIERLABEL* GLabel );
|
||||||
static void AddMenusForComponent( wxMenu* PopMenu, SCH_COMPONENT* Component );
|
static void AddMenusForComponent( wxMenu* PopMenu, SCH_COMPONENT* Component );
|
||||||
static void AddMenusForComponentField( wxMenu* PopMenu, SCH_CMP_FIELD* Field );
|
static void AddMenusForComponentField( wxMenu* PopMenu, SCH_FIELD* Field );
|
||||||
static void AddMenusForJunction( wxMenu* PopMenu, DrawJunctionStruct* Junction,
|
static void AddMenusForJunction( wxMenu* PopMenu, SCH_JUNCTION* Junction,
|
||||||
WinEDA_SchematicFrame* frame );
|
WinEDA_SchematicFrame* frame );
|
||||||
static void AddMenusForMarkers( wxMenu* aPopMenu, MARKER_SCH* aMarker,
|
static void AddMenusForMarkers( wxMenu* aPopMenu, SCH_MARKER* aMarker,
|
||||||
WinEDA_SchematicFrame* aFrame );
|
WinEDA_SchematicFrame* aFrame );
|
||||||
|
|
||||||
|
|
||||||
|
@ -121,14 +121,14 @@ bool WinEDA_SchematicFrame::OnRightClick( const wxPoint& MousePos,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DRAW_JUNCTION_STRUCT_TYPE:
|
case DRAW_JUNCTION_STRUCT_TYPE:
|
||||||
AddMenusForJunction( PopMenu, (DrawJunctionStruct*) DrawStruct, this );
|
AddMenusForJunction( PopMenu, (SCH_JUNCTION*) DrawStruct, this );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DRAW_BUSENTRY_STRUCT_TYPE:
|
case DRAW_BUSENTRY_STRUCT_TYPE:
|
||||||
if( !flags )
|
if( !flags )
|
||||||
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_MOVE_ITEM_REQUEST,
|
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_MOVE_ITEM_REQUEST,
|
||||||
_( "Move Bus Entry" ), move_xpm );
|
_( "Move Bus Entry" ), move_xpm );
|
||||||
if( GetBusEntryShape( (DrawBusEntryStruct*) DrawStruct ) == '\\' )
|
if( GetBusEntryShape( (SCH_BUS_ENTRY*) DrawStruct ) == '\\' )
|
||||||
PopMenu->Append( ID_POPUP_SCH_ENTRY_SELECT_SLASH,
|
PopMenu->Append( ID_POPUP_SCH_ENTRY_SELECT_SLASH,
|
||||||
_( "Set Bus Entry /" ) );
|
_( "Set Bus Entry /" ) );
|
||||||
else
|
else
|
||||||
|
@ -138,8 +138,8 @@ bool WinEDA_SchematicFrame::OnRightClick( const wxPoint& MousePos,
|
||||||
_( "Delete Bus Entry" ), delete_bus_xpm );
|
_( "Delete Bus Entry" ), delete_bus_xpm );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TYPE_MARKER_SCH:
|
case TYPE_SCH_MARKER:
|
||||||
AddMenusForMarkers( PopMenu, (MARKER_SCH*) DrawStruct, this );
|
AddMenusForMarkers( PopMenu, (SCH_MARKER*) DrawStruct, this );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TYPE_SCH_TEXT:
|
case TYPE_SCH_TEXT:
|
||||||
|
@ -160,7 +160,7 @@ bool WinEDA_SchematicFrame::OnRightClick( const wxPoint& MousePos,
|
||||||
|
|
||||||
case DRAW_PART_TEXT_STRUCT_TYPE:
|
case DRAW_PART_TEXT_STRUCT_TYPE:
|
||||||
{
|
{
|
||||||
AddMenusForComponentField( PopMenu, (SCH_CMP_FIELD*) DrawStruct );
|
AddMenusForComponentField( PopMenu, (SCH_FIELD*) DrawStruct );
|
||||||
if( flags )
|
if( flags )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -187,11 +187,11 @@ bool WinEDA_SchematicFrame::OnRightClick( const wxPoint& MousePos,
|
||||||
switch( DrawStruct->GetLayer() )
|
switch( DrawStruct->GetLayer() )
|
||||||
{
|
{
|
||||||
case LAYER_WIRE:
|
case LAYER_WIRE:
|
||||||
AddMenusForWire( PopMenu, (EDA_DrawLineStruct*) DrawStruct, this );
|
AddMenusForWire( PopMenu, (SCH_LINE*) DrawStruct, this );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LAYER_BUS:
|
case LAYER_BUS:
|
||||||
AddMenusForBus( PopMenu, (EDA_DrawLineStruct*) DrawStruct, this );
|
AddMenusForBus( PopMenu, (SCH_LINE*) DrawStruct, this );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -227,7 +227,7 @@ DrawType %d" ),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void AddMenusForComponentField( wxMenu* PopMenu, SCH_CMP_FIELD* Field )
|
void AddMenusForComponentField( wxMenu* PopMenu, SCH_FIELD* Field )
|
||||||
{
|
{
|
||||||
if( !Field->m_Flags )
|
if( !Field->m_Flags )
|
||||||
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_MOVE_ITEM_REQUEST,
|
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_MOVE_ITEM_REQUEST,
|
||||||
|
@ -486,7 +486,7 @@ void AddMenusForText( wxMenu* PopMenu, SCH_TEXT* Text )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void AddMenusForJunction( wxMenu* PopMenu, DrawJunctionStruct* Junction,
|
void AddMenusForJunction( wxMenu* PopMenu, SCH_JUNCTION* Junction,
|
||||||
WinEDA_SchematicFrame* frame )
|
WinEDA_SchematicFrame* frame )
|
||||||
{
|
{
|
||||||
bool is_new = (Junction->m_Flags & IS_NEW) ? TRUE : FALSE;
|
bool is_new = (Junction->m_Flags & IS_NEW) ? TRUE : FALSE;
|
||||||
|
@ -513,7 +513,7 @@ void AddMenusForJunction( wxMenu* PopMenu, DrawJunctionStruct* Junction,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void AddMenusForWire( wxMenu* PopMenu, EDA_DrawLineStruct* Wire,
|
void AddMenusForWire( wxMenu* PopMenu, SCH_LINE* Wire,
|
||||||
WinEDA_SchematicFrame* frame )
|
WinEDA_SchematicFrame* frame )
|
||||||
{
|
{
|
||||||
bool is_new = (Wire->m_Flags & IS_NEW) ? TRUE : FALSE;
|
bool is_new = (Wire->m_Flags & IS_NEW) ? TRUE : FALSE;
|
||||||
|
@ -554,7 +554,7 @@ void AddMenusForWire( wxMenu* PopMenu, EDA_DrawLineStruct* Wire,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void AddMenusForBus( wxMenu* PopMenu, EDA_DrawLineStruct* Bus,
|
void AddMenusForBus( wxMenu* PopMenu, SCH_LINE* Bus,
|
||||||
WinEDA_SchematicFrame* frame )
|
WinEDA_SchematicFrame* frame )
|
||||||
{
|
{
|
||||||
bool is_new = (Bus->m_Flags & IS_NEW) ? TRUE : FALSE;
|
bool is_new = (Bus->m_Flags & IS_NEW) ? TRUE : FALSE;
|
||||||
|
@ -673,7 +673,7 @@ void AddMenusForBlock( wxMenu* PopMenu, WinEDA_SchematicFrame* frame )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void AddMenusForMarkers( wxMenu* aPopMenu, MARKER_SCH* aMarker,
|
void AddMenusForMarkers( wxMenu* aPopMenu, SCH_MARKER* aMarker,
|
||||||
WinEDA_SchematicFrame* aFrame )
|
WinEDA_SchematicFrame* aFrame )
|
||||||
{
|
{
|
||||||
ADD_MENUITEM( aPopMenu, ID_POPUP_SCH_DELETE, _( "Delete Marker" ),
|
ADD_MENUITEM( aPopMenu, ID_POPUP_SCH_DELETE, _( "Delete Marker" ),
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/***************************************************
|
/***************************************************
|
||||||
* operations_on_item_lists.cpp
|
* operations_on_item_lists.cpp
|
||||||
* functions used in block commands, on lists of schematic items:
|
* functions used in block commands, on lists of schematic items:
|
||||||
* move, mirror, delete anc copy
|
* move, mirror, delete and copy
|
||||||
****************************************************/
|
****************************************************/
|
||||||
|
|
||||||
#include "fctsys.h"
|
#include "fctsys.h"
|
||||||
|
@ -35,7 +35,7 @@ void MirrorListOfItems( PICKED_ITEMS_LIST& aItemsList, wxPoint& aMirrorPoint )
|
||||||
|
|
||||||
|
|
||||||
/** Function MoveItemsInList
|
/** Function MoveItemsInList
|
||||||
* Move a list of items to a givent move vector
|
* Move a list of items to a given move vector
|
||||||
* @param aItemsList = list of picked items
|
* @param aItemsList = list of picked items
|
||||||
* @param aMoveVector = the move vector value
|
* @param aMoveVector = the move vector value
|
||||||
*/
|
*/
|
||||||
|
@ -159,7 +159,7 @@ void DuplicateItemsInList( SCH_SCREEN* screen, PICKED_ITEMS_LIST& aItemsList,
|
||||||
case TYPE_SCH_GLOBALLABEL:
|
case TYPE_SCH_GLOBALLABEL:
|
||||||
case TYPE_SCH_HIERLABEL:
|
case TYPE_SCH_HIERLABEL:
|
||||||
case DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE:
|
case DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE:
|
||||||
case TYPE_MARKER_SCH:
|
case TYPE_SCH_MARKER:
|
||||||
case DRAW_NOCONNECT_STRUCT_TYPE:
|
case DRAW_NOCONNECT_STRUCT_TYPE:
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -204,27 +204,27 @@ SCH_ITEM* DuplicateStruct( SCH_ITEM* DrawStruct )
|
||||||
switch( DrawStruct->Type() )
|
switch( DrawStruct->Type() )
|
||||||
{
|
{
|
||||||
case DRAW_POLYLINE_STRUCT_TYPE:
|
case DRAW_POLYLINE_STRUCT_TYPE:
|
||||||
NewDrawStruct = ( (DrawPolylineStruct*) DrawStruct )->GenCopy();
|
NewDrawStruct = ( (SCH_POLYLINE*) DrawStruct )->GenCopy();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DRAW_SEGMENT_STRUCT_TYPE:
|
case DRAW_SEGMENT_STRUCT_TYPE:
|
||||||
NewDrawStruct = ( (EDA_DrawLineStruct*) DrawStruct )->GenCopy();
|
NewDrawStruct = ( (SCH_LINE*) DrawStruct )->GenCopy();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DRAW_BUSENTRY_STRUCT_TYPE:
|
case DRAW_BUSENTRY_STRUCT_TYPE:
|
||||||
NewDrawStruct = ( (DrawBusEntryStruct*) DrawStruct )->GenCopy();
|
NewDrawStruct = ( (SCH_BUS_ENTRY*) DrawStruct )->GenCopy();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DRAW_JUNCTION_STRUCT_TYPE:
|
case DRAW_JUNCTION_STRUCT_TYPE:
|
||||||
NewDrawStruct = ( (DrawJunctionStruct*) DrawStruct )->GenCopy();
|
NewDrawStruct = ( (SCH_JUNCTION*) DrawStruct )->GenCopy();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TYPE_MARKER_SCH:
|
case TYPE_SCH_MARKER:
|
||||||
NewDrawStruct = ( (MARKER_SCH*) DrawStruct )->GenCopy();
|
NewDrawStruct = ( (SCH_MARKER*) DrawStruct )->GenCopy();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DRAW_NOCONNECT_STRUCT_TYPE:
|
case DRAW_NOCONNECT_STRUCT_TYPE:
|
||||||
NewDrawStruct = ( (DrawNoConnectStruct*) DrawStruct )->GenCopy();
|
NewDrawStruct = ( (SCH_NO_CONNECT*) DrawStruct )->GenCopy();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TYPE_SCH_TEXT:
|
case TYPE_SCH_TEXT:
|
||||||
|
@ -254,8 +254,8 @@ SCH_ITEM* DuplicateStruct( SCH_ITEM* DrawStruct )
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
wxString msg;
|
wxString msg;
|
||||||
msg << wxT( "DuplicateStruct error: unexpected StructType " ) <<
|
msg << wxT( "DuplicateStruct error: unexpected StructType " )
|
||||||
DrawStruct->Type() << wxT( " " ) << DrawStruct->GetClass();
|
<< DrawStruct->Type() << wxT( " " ) << DrawStruct->GetClass();
|
||||||
wxMessageBox( msg );
|
wxMessageBox( msg );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -23,7 +23,7 @@ static void PlotTextField( PLOTTER* plotter, SCH_COMPONENT* DrawLibItem,
|
||||||
int FieldNumber, int IsMulti, int DrawMode );
|
int FieldNumber, int IsMulti, int DrawMode );
|
||||||
|
|
||||||
|
|
||||||
static void PlotNoConnectStruct( PLOTTER* plotter, DrawNoConnectStruct* Struct )
|
static void PlotNoConnectStruct( PLOTTER* plotter, SCH_NO_CONNECT* Struct )
|
||||||
{
|
{
|
||||||
int delta = Struct->m_Size.x / 2;
|
int delta = Struct->m_Size.x / 2;
|
||||||
int pX, pY;
|
int pX, pY;
|
||||||
|
@ -72,8 +72,8 @@ static void PlotLibPart( PLOTTER* plotter, SCH_COMPONENT* DrawLibItem )
|
||||||
static void PlotTextField( PLOTTER* plotter, SCH_COMPONENT* DrawLibItem,
|
static void PlotTextField( PLOTTER* plotter, SCH_COMPONENT* DrawLibItem,
|
||||||
int FieldNumber, int IsMulti, int DrawMode )
|
int FieldNumber, int IsMulti, int DrawMode )
|
||||||
{
|
{
|
||||||
SCH_CMP_FIELD* field = DrawLibItem->GetField( FieldNumber );
|
SCH_FIELD* field = DrawLibItem->GetField( FieldNumber );
|
||||||
EDA_Colors color = UNSPECIFIED_COLOR;
|
EDA_Colors color = UNSPECIFIED_COLOR;
|
||||||
|
|
||||||
color = ReturnLayerColor( field->GetLayer() );
|
color = ReturnLayerColor( field->GetLayer() );
|
||||||
|
|
||||||
|
@ -433,7 +433,7 @@ void PlotDrawlist( PLOTTER* plotter, SCH_ITEM* aDrawlist )
|
||||||
if( aDrawlist->Type() == DRAW_BUSENTRY_STRUCT_TYPE )
|
if( aDrawlist->Type() == DRAW_BUSENTRY_STRUCT_TYPE )
|
||||||
{
|
{
|
||||||
#undef STRUCT
|
#undef STRUCT
|
||||||
#define STRUCT ( (DrawBusEntryStruct*) aDrawlist )
|
#define STRUCT ( (SCH_BUS_ENTRY*) aDrawlist )
|
||||||
StartPos = STRUCT->m_Pos;
|
StartPos = STRUCT->m_Pos;
|
||||||
EndPos = STRUCT->m_End();
|
EndPos = STRUCT->m_End();
|
||||||
layer = STRUCT->GetLayer();
|
layer = STRUCT->GetLayer();
|
||||||
|
@ -442,7 +442,7 @@ void PlotDrawlist( PLOTTER* plotter, SCH_ITEM* aDrawlist )
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#undef STRUCT
|
#undef STRUCT
|
||||||
#define STRUCT ( (EDA_DrawLineStruct*) aDrawlist )
|
#define STRUCT ( (SCH_LINE*) aDrawlist )
|
||||||
StartPos = STRUCT->m_Start;
|
StartPos = STRUCT->m_Start;
|
||||||
EndPos = STRUCT->m_End;
|
EndPos = STRUCT->m_End;
|
||||||
layer = STRUCT->GetLayer();
|
layer = STRUCT->GetLayer();
|
||||||
|
@ -460,7 +460,7 @@ void PlotDrawlist( PLOTTER* plotter, SCH_ITEM* aDrawlist )
|
||||||
|
|
||||||
case DRAW_JUNCTION_STRUCT_TYPE:
|
case DRAW_JUNCTION_STRUCT_TYPE:
|
||||||
#undef STRUCT
|
#undef STRUCT
|
||||||
#define STRUCT ( (DrawJunctionStruct*) aDrawlist )
|
#define STRUCT ( (SCH_JUNCTION*) aDrawlist )
|
||||||
plotter->set_color( ReturnLayerColor( STRUCT->GetLayer() ) );
|
plotter->set_color( ReturnLayerColor( STRUCT->GetLayer() ) );
|
||||||
plotter->circle( STRUCT->m_Pos, STRUCT->m_Size.x, FILLED_SHAPE );
|
plotter->circle( STRUCT->m_Pos, STRUCT->m_Size.x, FILLED_SHAPE );
|
||||||
break;
|
break;
|
||||||
|
@ -483,7 +483,7 @@ void PlotDrawlist( PLOTTER* plotter, SCH_ITEM* aDrawlist )
|
||||||
case DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE:
|
case DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TYPE_MARKER_SCH:
|
case TYPE_SCH_MARKER:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DRAW_SHEET_STRUCT_TYPE:
|
case DRAW_SHEET_STRUCT_TYPE:
|
||||||
|
@ -492,7 +492,7 @@ void PlotDrawlist( PLOTTER* plotter, SCH_ITEM* aDrawlist )
|
||||||
|
|
||||||
case DRAW_NOCONNECT_STRUCT_TYPE:
|
case DRAW_NOCONNECT_STRUCT_TYPE:
|
||||||
plotter->set_color( ReturnLayerColor( LAYER_NOCONNECT ) );
|
plotter->set_color( ReturnLayerColor( LAYER_NOCONNECT ) );
|
||||||
PlotNoConnectStruct( plotter, (DrawNoConnectStruct*) aDrawlist );
|
PlotNoConnectStruct( plotter, (SCH_NO_CONNECT*) aDrawlist );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
// Name: plotdxf.cpp
|
// Name: plotdxf.cpp
|
||||||
// Purpose:
|
// Purpose:
|
||||||
// Author: Lorenzo Marcantonio
|
// Author: Lorenzo Marcantonio
|
||||||
|
@ -309,23 +308,19 @@ void WinEDA_PlotDXFFrame::OnCancelClick( wxCommandEvent& event )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*****************************************/
|
|
||||||
void WinEDA_PlotDXFFrame::InitOptVars()
|
void WinEDA_PlotDXFFrame::InitOptVars()
|
||||||
{
|
{
|
||||||
/*****************************************/
|
|
||||||
Plot_Sheet_Ref = m_Plot_Sheet_Ref->GetValue();
|
Plot_Sheet_Ref = m_Plot_Sheet_Ref->GetValue();
|
||||||
PlotDXFColorOpt = m_PlotDXFColorOption->GetSelection();
|
PlotDXFColorOpt = m_PlotDXFColorOption->GetSelection();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************/
|
|
||||||
void WinEDA_PlotDXFFrame::CreateDXFFile( int AllPages )
|
void WinEDA_PlotDXFFrame::CreateDXFFile( int AllPages )
|
||||||
{
|
{
|
||||||
/*************************************************************/
|
|
||||||
WinEDA_SchematicFrame* schframe = (WinEDA_SchematicFrame*) m_Parent;
|
WinEDA_SchematicFrame* schframe = (WinEDA_SchematicFrame*) m_Parent;
|
||||||
SCH_SCREEN* screen = schframe->GetScreen();
|
SCH_SCREEN* screen = schframe->GetScreen();
|
||||||
SCH_SCREEN* oldscreen = screen;
|
SCH_SCREEN* oldscreen = screen;
|
||||||
DrawSheetPath* sheetpath, * oldsheetpath = schframe->GetSheet();
|
SCH_SHEET_PATH* sheetpath, * oldsheetpath = schframe->GetSheet();
|
||||||
wxString PlotFileName;
|
wxString PlotFileName;
|
||||||
Ki_PageDescr* PlotSheet;
|
Ki_PageDescr* PlotSheet;
|
||||||
wxPoint plot_offset;
|
wxPoint plot_offset;
|
||||||
|
@ -336,10 +331,10 @@ void WinEDA_PlotDXFFrame::CreateDXFFile( int AllPages )
|
||||||
* because in complex hierarchies a SCH_SCREEN (a schematic drawings)
|
* because in complex hierarchies a SCH_SCREEN (a schematic drawings)
|
||||||
* is shared between many sheets
|
* is shared between many sheets
|
||||||
*/
|
*/
|
||||||
EDA_SheetList SheetList( NULL );
|
SCH_SHEET_LIST SheetList( NULL );
|
||||||
|
|
||||||
sheetpath = SheetList.GetFirst();
|
sheetpath = SheetList.GetFirst();
|
||||||
DrawSheetPath list;
|
SCH_SHEET_PATH list;
|
||||||
|
|
||||||
while( true )
|
while( true )
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
// Name: plothpgl.cpp
|
// Name: plothpgl.cpp
|
||||||
// Purpose:
|
// Purpose:
|
||||||
// Author: jean-pierre Charras
|
// Author: jean-pierre Charras
|
||||||
|
@ -71,10 +70,8 @@ static Ki_PageDescr* Plot_sheet_list[] =
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**************************************************************/
|
|
||||||
void WinEDA_SchematicFrame::ToPlot_HPGL( wxCommandEvent& event )
|
void WinEDA_SchematicFrame::ToPlot_HPGL( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
/**************************************************************/
|
|
||||||
WinEDA_PlotHPGLFrame* HPGL_frame = new WinEDA_PlotHPGLFrame( this );
|
WinEDA_PlotHPGLFrame* HPGL_frame = new WinEDA_PlotHPGLFrame( this );
|
||||||
|
|
||||||
HPGL_frame->ShowModal();
|
HPGL_frame->ShowModal();
|
||||||
|
@ -224,11 +221,10 @@ void WinEDA_PlotHPGLFrame::CreateControls()
|
||||||
wxBoxSizer* itemBoxSizer6 = new wxBoxSizer( wxVERTICAL );
|
wxBoxSizer* itemBoxSizer6 = new wxBoxSizer( wxVERTICAL );
|
||||||
itemBoxSizer3->Add( itemBoxSizer6, 0, wxALIGN_TOP | wxALL, 5 );
|
itemBoxSizer3->Add( itemBoxSizer6, 0, wxALIGN_TOP | wxALL, 5 );
|
||||||
|
|
||||||
wxStaticBox* itemStaticBoxSizer7Static = new wxStaticBox(
|
wxStaticBox* itemStaticBoxSizer7Static =
|
||||||
itemDialog1, wxID_ANY, _( "Pen control:" ) );
|
new wxStaticBox( itemDialog1, wxID_ANY, _( "Pen control:" ) );
|
||||||
wxStaticBoxSizer* itemStaticBoxSizer7 = new wxStaticBoxSizer(
|
wxStaticBoxSizer* itemStaticBoxSizer7 =
|
||||||
itemStaticBoxSizer7Static,
|
new wxStaticBoxSizer( itemStaticBoxSizer7Static, wxVERTICAL );
|
||||||
wxVERTICAL );
|
|
||||||
itemBoxSizer6->Add( itemStaticBoxSizer7,
|
itemBoxSizer6->Add( itemStaticBoxSizer7,
|
||||||
0,
|
0,
|
||||||
wxALIGN_CENTER_HORIZONTAL | wxALL,
|
wxALIGN_CENTER_HORIZONTAL | wxALL,
|
||||||
|
@ -614,7 +610,7 @@ void WinEDA_PlotHPGLFrame::Plot_Schematic_HPGL( int Select_PlotAll,
|
||||||
wxString PlotFileName;
|
wxString PlotFileName;
|
||||||
SCH_SCREEN* screen = schframe->GetScreen();
|
SCH_SCREEN* screen = schframe->GetScreen();
|
||||||
SCH_SCREEN* oldscreen = screen;
|
SCH_SCREEN* oldscreen = screen;
|
||||||
DrawSheetPath* sheetpath, * oldsheetpath = schframe->GetSheet();
|
SCH_SHEET_PATH* sheetpath, * oldsheetpath = schframe->GetSheet();
|
||||||
Ki_PageDescr* PlotSheet;
|
Ki_PageDescr* PlotSheet;
|
||||||
wxSize SheetSize;
|
wxSize SheetSize;
|
||||||
wxPoint SheetOffset, PlotOffset;
|
wxPoint SheetOffset, PlotOffset;
|
||||||
|
@ -625,10 +621,10 @@ void WinEDA_PlotHPGLFrame::Plot_Schematic_HPGL( int Select_PlotAll,
|
||||||
* because in complex hierarchies a SCH_SCREEN (a schematic drawings)
|
* because in complex hierarchies a SCH_SCREEN (a schematic drawings)
|
||||||
* is shared between many sheets
|
* is shared between many sheets
|
||||||
*/
|
*/
|
||||||
EDA_SheetList SheetList( NULL );
|
SCH_SHEET_LIST SheetList( NULL );
|
||||||
|
|
||||||
sheetpath = SheetList.GetFirst();
|
sheetpath = SheetList.GetFirst();
|
||||||
DrawSheetPath list;
|
SCH_SHEET_PATH list;
|
||||||
|
|
||||||
while( true )
|
while( true )
|
||||||
{
|
{
|
||||||
|
|
|
@ -356,10 +356,10 @@ void WinEDA_PlotPSFrame::CreatePSFile( int AllPages, int pagesize )
|
||||||
WinEDA_SchematicFrame* schframe = (WinEDA_SchematicFrame*) m_Parent;
|
WinEDA_SchematicFrame* schframe = (WinEDA_SchematicFrame*) m_Parent;
|
||||||
SCH_SCREEN* screen = schframe->GetScreen();
|
SCH_SCREEN* screen = schframe->GetScreen();
|
||||||
SCH_SCREEN* oldscreen = screen;
|
SCH_SCREEN* oldscreen = screen;
|
||||||
DrawSheetPath* sheetpath, * oldsheetpath = schframe->GetSheet();
|
SCH_SHEET_PATH* sheetpath, * oldsheetpath = schframe->GetSheet();
|
||||||
wxString PlotFileName;
|
wxString PlotFileName;
|
||||||
Ki_PageDescr* PlotSheet, * RealSheet;
|
Ki_PageDescr* PlotSheet, * RealSheet;
|
||||||
wxPoint plot_offset;
|
wxPoint plot_offset;
|
||||||
|
|
||||||
/* When printing all pages, the printed page is not the current page.
|
/* When printing all pages, the printed page is not the current page.
|
||||||
* In complex hierarchies, we must setup references and others parameters
|
* In complex hierarchies, we must setup references and others parameters
|
||||||
|
@ -367,10 +367,10 @@ void WinEDA_PlotPSFrame::CreatePSFile( int AllPages, int pagesize )
|
||||||
* because in complex hierarchies a SCH_SCREEN (a schematic drawings)
|
* because in complex hierarchies a SCH_SCREEN (a schematic drawings)
|
||||||
* is shared between many sheets
|
* is shared between many sheets
|
||||||
*/
|
*/
|
||||||
EDA_SheetList SheetList( NULL );
|
SCH_SHEET_LIST SheetList( NULL );
|
||||||
|
|
||||||
sheetpath = SheetList.GetFirst();
|
sheetpath = SheetList.GetFirst();
|
||||||
DrawSheetPath list;
|
SCH_SHEET_PATH list;
|
||||||
|
|
||||||
while( true )
|
while( true )
|
||||||
{
|
{
|
||||||
|
|
|
@ -246,7 +246,7 @@ int ReadSheetDescr( wxWindow* frame, char* Line, FILE* f, wxString& aMsgDiag,
|
||||||
* If F0 "text" for SheetName
|
* If F0 "text" for SheetName
|
||||||
* F1 and "text" for filename
|
* F1 and "text" for filename
|
||||||
*/
|
*/
|
||||||
ptcar = Line; while( *ptcar && (*ptcar != '"') )
|
ptcar = Line; while( *ptcar && ( *ptcar != '"' ) )
|
||||||
ptcar++;
|
ptcar++;
|
||||||
|
|
||||||
if( *ptcar != '"' )
|
if( *ptcar != '"' )
|
||||||
|
@ -713,10 +713,10 @@ int ReadPartDescr( wxWindow* frame, char* Line, FILE* f, wxString& aMsgDiag,
|
||||||
// contiguous, no gaps.
|
// contiguous, no gaps.
|
||||||
while( fieldNdx >= component->GetFieldCount() )
|
while( fieldNdx >= component->GetFieldCount() )
|
||||||
{
|
{
|
||||||
int newNdx = component->GetFieldCount();
|
int newNdx = component->GetFieldCount();
|
||||||
|
|
||||||
SCH_CMP_FIELD field( wxPoint( 0, 0 ), newNdx, component,
|
SCH_FIELD field( wxPoint( 0, 0 ), newNdx, component,
|
||||||
fieldName );
|
fieldName );
|
||||||
component->AddField( field );
|
component->AddField( field );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -794,12 +794,12 @@ int ReadPartDescr( wxWindow* frame, char* Line, FILE* f, wxString& aMsgDiag,
|
||||||
}
|
}
|
||||||
|
|
||||||
*aLineNum++;
|
*aLineNum++;
|
||||||
if( (fgets( Line, 256 - 1, f ) == NULL)
|
if( ( fgets( Line, 256 - 1, f ) == NULL )
|
||||||
|| (sscanf( Line, "%d %d %d %d",
|
|| ( sscanf( Line, "%d %d %d %d",
|
||||||
&component->m_Transform[0][0],
|
&component->m_Transform[0][0],
|
||||||
&component->m_Transform[0][1],
|
&component->m_Transform[0][1],
|
||||||
&component->m_Transform[1][0],
|
&component->m_Transform[1][0],
|
||||||
&component->m_Transform[1][1] ) != 4) )
|
&component->m_Transform[1][1] ) != 4 ) )
|
||||||
{
|
{
|
||||||
aMsgDiag.Printf(
|
aMsgDiag.Printf(
|
||||||
wxT( "Component orient error at line %d, aborted" ),
|
wxT( "Component orient error at line %d, aborted" ),
|
||||||
|
|
|
@ -249,14 +249,12 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
|
||||||
|
|
||||||
case ID_POPUP_SCH_ENTRY_SELECT_SLASH:
|
case ID_POPUP_SCH_ENTRY_SELECT_SLASH:
|
||||||
DrawPanel->MouseToCursorSchema();
|
DrawPanel->MouseToCursorSchema();
|
||||||
SetBusEntryShape( &dc,
|
SetBusEntryShape( &dc, (SCH_BUS_ENTRY*) screen->GetCurItem(), '/' );
|
||||||
(DrawBusEntryStruct*) screen->GetCurItem(), '/' );
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_POPUP_SCH_ENTRY_SELECT_ANTISLASH:
|
case ID_POPUP_SCH_ENTRY_SELECT_ANTISLASH:
|
||||||
DrawPanel->MouseToCursorSchema();
|
DrawPanel->MouseToCursorSchema();
|
||||||
SetBusEntryShape( &dc,
|
SetBusEntryShape( &dc, (SCH_BUS_ENTRY*) screen->GetCurItem(), '\\' );
|
||||||
(DrawBusEntryStruct*) screen->GetCurItem(), '\\' );
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_NO_SELECT_BUTT:
|
case ID_NO_SELECT_BUTT:
|
||||||
|
@ -313,11 +311,11 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
|
||||||
|
|
||||||
case ID_POPUP_SCH_ROTATE_FIELD:
|
case ID_POPUP_SCH_ROTATE_FIELD:
|
||||||
DrawPanel->MouseToCursorSchema();
|
DrawPanel->MouseToCursorSchema();
|
||||||
RotateCmpField( (SCH_CMP_FIELD*) screen->GetCurItem(), &dc );
|
RotateCmpField( (SCH_FIELD*) screen->GetCurItem(), &dc );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_POPUP_SCH_EDIT_FIELD:
|
case ID_POPUP_SCH_EDIT_FIELD:
|
||||||
EditCmpFieldText( (SCH_CMP_FIELD*) screen->GetCurItem(), &dc );
|
EditCmpFieldText( (SCH_FIELD*) screen->GetCurItem(), &dc );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_POPUP_SCH_DELETE_NODE:
|
case ID_POPUP_SCH_DELETE_NODE:
|
||||||
|
@ -452,7 +450,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
|
||||||
// whole segment. This works fine only for H and V segments and
|
// whole segment. This works fine only for H and V segments and
|
||||||
// only if they do not cross a component
|
// only if they do not cross a component
|
||||||
// TODO: a better way to drag only wires
|
// TODO: a better way to drag only wires
|
||||||
EDA_DrawLineStruct* segm = (EDA_DrawLineStruct*)screen->GetCurItem();
|
SCH_LINE* segm = (SCH_LINE*)screen->GetCurItem();
|
||||||
if( !screen->m_BlockLocate.Inside(segm->m_Start) &&
|
if( !screen->m_BlockLocate.Inside(segm->m_Start) &&
|
||||||
!screen->m_BlockLocate.Inside(segm->m_End) )
|
!screen->m_BlockLocate.Inside(segm->m_End) )
|
||||||
{
|
{
|
||||||
|
@ -511,11 +509,11 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
|
||||||
|
|
||||||
DrawPanel->MouseToCursorSchema();
|
DrawPanel->MouseToCursorSchema();
|
||||||
if( screen->GetCurItem()->m_Flags == 0 )
|
if( screen->GetCurItem()->m_Flags == 0 )
|
||||||
SaveCopyInUndoList( (SCH_ITEM*) screen->GetCurItem(), UR_CHANGED );
|
SaveCopyInUndoList( (SCH_ITEM*) screen->GetCurItem(),
|
||||||
|
UR_CHANGED );
|
||||||
|
|
||||||
CmpRotationMiroir(
|
CmpRotationMiroir( (SCH_COMPONENT*) screen->GetCurItem(),
|
||||||
(SCH_COMPONENT*) screen->GetCurItem(),
|
&dc, option );
|
||||||
&dc, option );
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -545,8 +543,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
|
||||||
if( screen->GetCurItem() == NULL )
|
if( screen->GetCurItem() == NULL )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
EditComponentReference(
|
EditComponentReference( (SCH_COMPONENT*) screen->GetCurItem(), &dc );
|
||||||
(SCH_COMPONENT*) screen->GetCurItem(), &dc );
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_POPUP_SCH_EDIT_FOOTPRINT_CMP:
|
case ID_POPUP_SCH_EDIT_FOOTPRINT_CMP:
|
||||||
|
@ -557,8 +554,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
|
||||||
screen->SetCurItem( LocateSmallestComponent( screen ) );
|
screen->SetCurItem( LocateSmallestComponent( screen ) );
|
||||||
if( screen->GetCurItem() == NULL )
|
if( screen->GetCurItem() == NULL )
|
||||||
break;
|
break;
|
||||||
EditComponentFootprint(
|
EditComponentFootprint( (SCH_COMPONENT*) screen->GetCurItem(), &dc );
|
||||||
(SCH_COMPONENT*) screen->GetCurItem(), &dc );
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
|
@ -631,10 +627,8 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
|
||||||
if( screen->GetCurItem() == NULL )
|
if( screen->GetCurItem() == NULL )
|
||||||
break;
|
break;
|
||||||
DrawPanel->MouseToCursorSchema();
|
DrawPanel->MouseToCursorSchema();
|
||||||
SelPartUnit(
|
SelPartUnit( (SCH_COMPONENT*) screen->GetCurItem(),
|
||||||
(SCH_COMPONENT*) screen->GetCurItem(),
|
id + 1 - ID_POPUP_SCH_SELECT_UNIT1, &dc );
|
||||||
id + 1 - ID_POPUP_SCH_SELECT_UNIT1,
|
|
||||||
&dc );
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_POPUP_SCH_DISPLAYDOC_CMP:
|
case ID_POPUP_SCH_DISPLAYDOC_CMP:
|
||||||
|
@ -719,8 +713,8 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
|
||||||
|
|
||||||
case ID_POPUP_SCH_ADD_JUNCTION:
|
case ID_POPUP_SCH_ADD_JUNCTION:
|
||||||
DrawPanel->MouseToCursorSchema();
|
DrawPanel->MouseToCursorSchema();
|
||||||
screen->SetCurItem(
|
screen->SetCurItem( CreateNewJunctionStruct( &dc, screen->m_Curseur,
|
||||||
CreateNewJunctionStruct( &dc, screen->m_Curseur, TRUE ) );
|
true ) );
|
||||||
TestDanglingEnds( screen->EEDrawList, &dc );
|
TestDanglingEnds( screen->EEDrawList, &dc );
|
||||||
screen->SetCurItem( NULL );
|
screen->SetCurItem( NULL );
|
||||||
break;
|
break;
|
||||||
|
@ -741,8 +735,8 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
|
||||||
|
|
||||||
case ID_POPUP_SCH_GETINFO_MARKER:
|
case ID_POPUP_SCH_GETINFO_MARKER:
|
||||||
if( screen->GetCurItem()
|
if( screen->GetCurItem()
|
||||||
&& screen->GetCurItem()->Type() == TYPE_MARKER_SCH )
|
&& screen->GetCurItem()->Type() == TYPE_SCH_MARKER )
|
||||||
((MARKER_SCH*)screen->GetCurItem())->DisplayMarkerInfo( this );
|
((SCH_MARKER*)screen->GetCurItem())->DisplayMarkerInfo( this );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default: // Log error:
|
default: // Log error:
|
||||||
|
@ -772,7 +766,7 @@ void WinEDA_SchematicFrame::Process_Move_Item( SCH_ITEM* DrawStruct, wxDC* DC )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DRAW_BUSENTRY_STRUCT_TYPE:
|
case DRAW_BUSENTRY_STRUCT_TYPE:
|
||||||
StartMoveBusEntry( (DrawBusEntryStruct*) DrawStruct, DC );
|
StartMoveBusEntry( (SCH_BUS_ENTRY*) DrawStruct, DC );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TYPE_SCH_LABEL:
|
case TYPE_SCH_LABEL:
|
||||||
|
@ -797,10 +791,10 @@ void WinEDA_SchematicFrame::Process_Move_Item( SCH_ITEM* DrawStruct, wxDC* DC )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DRAW_PART_TEXT_STRUCT_TYPE:
|
case DRAW_PART_TEXT_STRUCT_TYPE:
|
||||||
StartMoveCmpField( (SCH_CMP_FIELD*) DrawStruct, DC );
|
StartMoveCmpField( (SCH_FIELD*) DrawStruct, DC );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TYPE_MARKER_SCH:
|
case TYPE_SCH_MARKER:
|
||||||
case DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE:
|
case DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE:
|
||||||
default:
|
default:
|
||||||
wxString msg;
|
wxString msg;
|
||||||
|
|
|
@ -13,16 +13,17 @@
|
||||||
|
|
||||||
|
|
||||||
/* Functions to undo and redo edit commands.
|
/* Functions to undo and redo edit commands.
|
||||||
* commmands to undo are stored in CurrentScreen->m_UndoList
|
* commands to undo are stored in CurrentScreen->m_UndoList
|
||||||
* commmands to redo are stored in CurrentScreen->m_RedoList
|
* commands to redo are stored in CurrentScreen->m_RedoList
|
||||||
*
|
*
|
||||||
* m_UndoList and m_RedoList handle a std::vector of PICKED_ITEMS_LIST
|
* m_UndoList and m_RedoList handle a std::vector of PICKED_ITEMS_LIST
|
||||||
* Each PICKED_ITEMS_LIST handle a std::vector of pickers (class ITEM_PICKER),
|
* Each PICKED_ITEMS_LIST handle a std::vector of pickers (class ITEM_PICKER),
|
||||||
* that store the list of schematic items that are concerned by the command to undo or redo
|
* that store the list of schematic items that are concerned by the command to
|
||||||
* and is created for each command to undo (handle also a command to redo).
|
* undo or redo and is created for each command to undo (handle also a command
|
||||||
* each picker has a pointer pointing to an item to undo or redo (in fact: deleted, added or modified),
|
* to redo). each picker has a pointer pointing to an item to undo or redo (in
|
||||||
* and has a pointer to a copy of this item, when this item has been modified
|
* fact: deleted, added or modified), and has a pointer to a copy of this item,
|
||||||
* (the old values of parameters are therefore saved)
|
* when this item has been modified (the old values of parameters are
|
||||||
|
* therefore saved)
|
||||||
*
|
*
|
||||||
* there are 3 cases:
|
* there are 3 cases:
|
||||||
* - delete item(s) command
|
* - delete item(s) command
|
||||||
|
@ -42,7 +43,8 @@
|
||||||
* the .m_Item member of each wrapper points the old copy of this item.
|
* the .m_Item member of each wrapper points the old copy of this item.
|
||||||
*
|
*
|
||||||
* - add item(s) command
|
* - add item(s) command
|
||||||
* =>A list of item(s) is made. The .m_Item member of each wrapper points the new item.
|
* =>A list of item(s) is made. The .m_Item member of each wrapper points
|
||||||
|
* the new item.
|
||||||
*
|
*
|
||||||
* Redo command
|
* Redo command
|
||||||
* - delete item(s) old command:
|
* - delete item(s) old command:
|
||||||
|
@ -52,28 +54,27 @@
|
||||||
* => the copy of item(s) is moved in Undo list
|
* => the copy of item(s) is moved in Undo list
|
||||||
*
|
*
|
||||||
* - add item(s) command
|
* - add item(s) command
|
||||||
* => The list of item(s) is used to create a deleted list in undo list(same as a delete command)
|
* => The list of item(s) is used to create a deleted list in undo
|
||||||
|
* list(same as a delete command)
|
||||||
*
|
*
|
||||||
* Some block operations that change items can be undoed without memorise items, just the coordiantes of the transform:
|
* Some block operations that change items can be undone without memorized
|
||||||
* move list of items (undo/redo is made by moving with the opposite move vector)
|
* items, just the coordinates of the transform: move list of items (undo/
|
||||||
* mirror (Y) and flip list of items (undo/redo is made by mirror or flip items)
|
* redo is made by moving with the opposite move vector) mirror (Y) and flip
|
||||||
* so they are handled specifically.
|
* list of items (undo/redo is made by mirror or flip items) so they are
|
||||||
|
* handled specifically.
|
||||||
*
|
*
|
||||||
* A problem is the hierarchical sheet handling.
|
* A problem is the hierarchical sheet handling.
|
||||||
* the data associated (subhierarchy, uno/redo list) is deleted only
|
* the data associated (sub-hierarchy, undo/redo list) is deleted only
|
||||||
* when the sheet is really deleted (i.e. when deleted from undo or redo list)
|
* when the sheet is really deleted (i.e. when deleted from undo or redo list)
|
||||||
* This is handled by its destructor.
|
* This is handled by its destructor.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/**************************************************************/
|
|
||||||
void SwapData( EDA_BaseStruct* aItem, EDA_BaseStruct* aImage )
|
|
||||||
/***************************************************************/
|
|
||||||
|
|
||||||
/* Used if undo / redo command:
|
/* Used if undo / redo command:
|
||||||
* swap data between Item and its copy, pointed by its .m_Image member
|
* swap data between Item and its copy, pointed by its .m_Image member
|
||||||
* swapped data is data modified by edition, so not all values are swapped
|
* swapped data is data modified by edition, so not all values are swapped
|
||||||
*/
|
*/
|
||||||
|
void SwapData( EDA_BaseStruct* aItem, EDA_BaseStruct* aImage )
|
||||||
{
|
{
|
||||||
if( aItem == NULL || aImage == NULL )
|
if( aItem == NULL || aImage == NULL )
|
||||||
{
|
{
|
||||||
|
@ -86,15 +87,15 @@ void SwapData( EDA_BaseStruct* aItem, EDA_BaseStruct* aImage )
|
||||||
case DRAW_POLYLINE_STRUCT_TYPE:
|
case DRAW_POLYLINE_STRUCT_TYPE:
|
||||||
#undef SOURCE
|
#undef SOURCE
|
||||||
#undef DEST
|
#undef DEST
|
||||||
#define SOURCE ( (DrawPolylineStruct*) aItem )
|
#define SOURCE ( (SCH_POLYLINE*) aItem )
|
||||||
#define DEST ( (DrawPolylineStruct*) aImage )
|
#define DEST ( (SCH_POLYLINE*) aImage )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DRAW_JUNCTION_STRUCT_TYPE:
|
case DRAW_JUNCTION_STRUCT_TYPE:
|
||||||
#undef SOURCE
|
#undef SOURCE
|
||||||
#undef DEST
|
#undef DEST
|
||||||
#define SOURCE ( (DrawJunctionStruct*) aItem )
|
#define SOURCE ( (SCH_JUNCTION*) aItem )
|
||||||
#define DEST ( (DrawJunctionStruct*) aImage )
|
#define DEST ( (SCH_JUNCTION*) aImage )
|
||||||
EXCHG( SOURCE->m_Pos, DEST->m_Pos );
|
EXCHG( SOURCE->m_Pos, DEST->m_Pos );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -120,8 +121,8 @@ void SwapData( EDA_BaseStruct* aItem, EDA_BaseStruct* aImage )
|
||||||
case DRAW_SEGMENT_STRUCT_TYPE:
|
case DRAW_SEGMENT_STRUCT_TYPE:
|
||||||
#undef SOURCE
|
#undef SOURCE
|
||||||
#undef DEST
|
#undef DEST
|
||||||
#define SOURCE ( (EDA_DrawLineStruct*) aItem )
|
#define SOURCE ( (SCH_LINE*) aItem )
|
||||||
#define DEST ( (EDA_DrawLineStruct*) aImage )
|
#define DEST ( (SCH_LINE*) aImage )
|
||||||
EXCHG( SOURCE->m_Start, DEST->m_Start );
|
EXCHG( SOURCE->m_Start, DEST->m_Start );
|
||||||
EXCHG( SOURCE->m_End, DEST->m_End );
|
EXCHG( SOURCE->m_End, DEST->m_End );
|
||||||
break;
|
break;
|
||||||
|
@ -129,8 +130,8 @@ void SwapData( EDA_BaseStruct* aItem, EDA_BaseStruct* aImage )
|
||||||
case DRAW_BUSENTRY_STRUCT_TYPE:
|
case DRAW_BUSENTRY_STRUCT_TYPE:
|
||||||
#undef SOURCE
|
#undef SOURCE
|
||||||
#undef DEST
|
#undef DEST
|
||||||
#define SOURCE ( (DrawBusEntryStruct*) aItem )
|
#define SOURCE ( (SCH_BUS_ENTRY*) aItem )
|
||||||
#define DEST ( (DrawBusEntryStruct*) aImage )
|
#define DEST ( (SCH_BUS_ENTRY*) aImage )
|
||||||
EXCHG( SOURCE->m_Pos, DEST->m_Pos );
|
EXCHG( SOURCE->m_Pos, DEST->m_Pos );
|
||||||
EXCHG( SOURCE->m_Size, DEST->m_Size );
|
EXCHG( SOURCE->m_Size, DEST->m_Size );
|
||||||
break;
|
break;
|
||||||
|
@ -143,11 +144,11 @@ void SwapData( EDA_BaseStruct* aItem, EDA_BaseStruct* aImage )
|
||||||
DEST->SwapData( SOURCE );
|
DEST->SwapData( SOURCE );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TYPE_MARKER_SCH:
|
case TYPE_SCH_MARKER:
|
||||||
#undef SOURCE
|
#undef SOURCE
|
||||||
#undef DEST
|
#undef DEST
|
||||||
#define SOURCE ( (MARKER_SCH*) aItem )
|
#define SOURCE ( (SCH_MARKER*) aItem )
|
||||||
#define DEST ( (MARKER_SCH*) aImage )
|
#define DEST ( (SCH_MARKER*) aImage )
|
||||||
EXCHG( SOURCE->m_Pos, DEST->m_Pos );
|
EXCHG( SOURCE->m_Pos, DEST->m_Pos );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -163,8 +164,8 @@ void SwapData( EDA_BaseStruct* aItem, EDA_BaseStruct* aImage )
|
||||||
case DRAW_NOCONNECT_STRUCT_TYPE:
|
case DRAW_NOCONNECT_STRUCT_TYPE:
|
||||||
#undef SOURCE
|
#undef SOURCE
|
||||||
#undef DEST
|
#undef DEST
|
||||||
#define SOURCE ( (DrawNoConnectStruct*) aItem )
|
#define SOURCE ( (SCH_NO_CONNECT*) aItem )
|
||||||
#define DEST ( (DrawNoConnectStruct*) aImage )
|
#define DEST ( (SCH_NO_CONNECT*) aImage )
|
||||||
EXCHG( SOURCE->m_Pos, DEST->m_Pos );
|
EXCHG( SOURCE->m_Pos, DEST->m_Pos );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -179,12 +180,6 @@ void SwapData( EDA_BaseStruct* aItem, EDA_BaseStruct* aImage )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************/
|
|
||||||
void WinEDA_SchematicFrame::SaveCopyInUndoList( SCH_ITEM* aItem,
|
|
||||||
UndoRedoOpType aCommandType,
|
|
||||||
const wxPoint& aTransformPoint )
|
|
||||||
/***********************************************************************/
|
|
||||||
|
|
||||||
/** function SaveCopyInUndoList
|
/** function SaveCopyInUndoList
|
||||||
* Create a copy of the current schematic item, and put it in the undo list.
|
* Create a copy of the current schematic item, and put it in the undo list.
|
||||||
*
|
*
|
||||||
|
@ -195,17 +190,22 @@ void WinEDA_SchematicFrame::SaveCopyInUndoList( SCH_ITEM* aItem,
|
||||||
* UR_WIRE_IMAGE
|
* UR_WIRE_IMAGE
|
||||||
* UR_MOVED
|
* UR_MOVED
|
||||||
*
|
*
|
||||||
* If it is a delete command, items are put on list with the .Flags member set to UR_DELETED.
|
* If it is a delete command, items are put on list with the .Flags member
|
||||||
* When it will be really deleted, the EEDrawList and the subhierarchy will be deleted.
|
* set to UR_DELETED. When it will be really deleted, the EEDrawList and the
|
||||||
* If it is only a copy, the EEDrawList and the subhierarchy must NOT be deleted.
|
* sub-hierarchy will be deleted. If it is only a copy, the EEDrawList and the
|
||||||
|
* sub-hierarchy must NOT be deleted.
|
||||||
*
|
*
|
||||||
* Note:
|
* Note:
|
||||||
* Edit wires and busses is a bit complex.
|
* Edit wires and buses is a bit complex.
|
||||||
* because when a new wire is added, modifications in wire list
|
* because when a new wire is added, modifications in wire list
|
||||||
* (wire concatenation) there are modified items, deleted items and new items
|
* (wire concatenation) there are modified items, deleted items and new items
|
||||||
* so flag_type_command is UR_WIRE_IMAGE: the struct ItemToCopy is a list of wires
|
* so flag_type_command is UR_WIRE_IMAGE: the struct ItemToCopy is a list of
|
||||||
* saved in Undo List (for Undo or Redo commands, saved wires will be exchanged with current wire list
|
* wires saved in Undo List (for Undo or Redo commands, saved wires will be
|
||||||
|
* exchanged with current wire list
|
||||||
*/
|
*/
|
||||||
|
void WinEDA_SchematicFrame::SaveCopyInUndoList( SCH_ITEM* aItem,
|
||||||
|
UndoRedoOpType aCommandType,
|
||||||
|
const wxPoint& aTransformPoint )
|
||||||
{
|
{
|
||||||
/* Does not save a null item.
|
/* Does not save a null item.
|
||||||
* but if aCommandType == UR_WIRE_IMAGE, we must save null item.
|
* but if aCommandType == UR_WIRE_IMAGE, we must save null item.
|
||||||
|
@ -213,7 +213,7 @@ void WinEDA_SchematicFrame::SaveCopyInUndoList( SCH_ITEM* aItem,
|
||||||
* To undo this first command, the previous state is a NULL item,
|
* To undo this first command, the previous state is a NULL item,
|
||||||
* and we accept this
|
* and we accept this
|
||||||
*/
|
*/
|
||||||
if( aItem == NULL && (aCommandType != UR_WIRE_IMAGE) ) // Nothing to save
|
if( aItem == NULL && ( aCommandType != UR_WIRE_IMAGE ) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
SCH_ITEM* CopyOfItem;
|
SCH_ITEM* CopyOfItem;
|
||||||
|
@ -246,7 +246,8 @@ void WinEDA_SchematicFrame::SaveCopyInUndoList( SCH_ITEM* aItem,
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
wxString msg;
|
wxString msg;
|
||||||
msg.Printf( wxT( "SaveCopyInUndoList() error (unknown code %X)" ), aCommandType );
|
msg.Printf( wxT( "SaveCopyInUndoList() error (unknown code %X)" ),
|
||||||
|
aCommandType );
|
||||||
wxMessageBox( msg );
|
wxMessageBox( msg );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -267,7 +268,7 @@ void WinEDA_SchematicFrame::SaveCopyInUndoList( SCH_ITEM* aItem,
|
||||||
|
|
||||||
/** function SaveCopyInUndoList
|
/** function SaveCopyInUndoList
|
||||||
* @param aItemsList = a PICKED_ITEMS_LIST of items to save
|
* @param aItemsList = a PICKED_ITEMS_LIST of items to save
|
||||||
* @param aTypeCommand = type of comand ( UR_CHANGED, UR_NEW, UR_DELETED ...
|
* @param aTypeCommand = type of command ( UR_CHANGED, UR_NEW, UR_DELETED ...
|
||||||
*/
|
*/
|
||||||
void WinEDA_SchematicFrame::SaveCopyInUndoList( PICKED_ITEMS_LIST& aItemsList,
|
void WinEDA_SchematicFrame::SaveCopyInUndoList( PICKED_ITEMS_LIST& aItemsList,
|
||||||
UndoRedoOpType aTypeCommand,
|
UndoRedoOpType aTypeCommand,
|
||||||
|
@ -312,7 +313,8 @@ void WinEDA_SchematicFrame::SaveCopyInUndoList( PICKED_ITEMS_LIST& aItemsList,
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
wxString msg;
|
wxString msg;
|
||||||
msg.Printf( wxT( "SaveCopyInUndoList() error (unknown code %X)" ), command );
|
msg.Printf( wxT( "SaveCopyInUndoList() error (unknown code %X)" ),
|
||||||
|
command );
|
||||||
wxMessageBox( msg );
|
wxMessageBox( msg );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -334,17 +336,20 @@ void WinEDA_SchematicFrame::SaveCopyInUndoList( PICKED_ITEMS_LIST& aItemsList,
|
||||||
|
|
||||||
/** Function PutDataInPreviousState()
|
/** Function PutDataInPreviousState()
|
||||||
* Used in undo or redo command.
|
* Used in undo or redo command.
|
||||||
* Put data pointed by List in the previous state, i.e. the state memorised by List
|
* Put data pointed by List in the previous state, i.e. the state memorized
|
||||||
|
* by List
|
||||||
* @param aList = a PICKED_ITEMS_LIST pointer to the list of items to undo/redo
|
* @param aList = a PICKED_ITEMS_LIST pointer to the list of items to undo/redo
|
||||||
* @param aRedoCommand = a bool: true for redo, false for undo
|
* @param aRedoCommand = a bool: true for redo, false for undo
|
||||||
*/
|
*/
|
||||||
void WinEDA_SchematicFrame::PutDataInPreviousState( PICKED_ITEMS_LIST* aList, bool aRedoCommand )
|
void WinEDA_SchematicFrame::PutDataInPreviousState( PICKED_ITEMS_LIST* aList,
|
||||||
|
bool aRedoCommand )
|
||||||
{
|
{
|
||||||
SCH_ITEM* item;
|
SCH_ITEM* item;
|
||||||
SCH_ITEM* alt_item;
|
SCH_ITEM* alt_item;
|
||||||
|
|
||||||
// Undo in the reverse order of list creation: (this can allow stacked changes
|
// Undo in the reverse order of list creation: (this can allow stacked
|
||||||
// like the same item can be changes and deleted in the same complex command
|
// changes like the same item can be changes and deleted in the same
|
||||||
|
// complex command
|
||||||
for( int ii = aList->GetCount()-1; ii >= 0 ; ii-- )
|
for( int ii = aList->GetCount()-1; ii >= 0 ; ii-- )
|
||||||
{
|
{
|
||||||
ITEM_PICKER itemWrapper = aList->GetItemWrapper( ii );
|
ITEM_PICKER itemWrapper = aList->GetItemWrapper( ii );
|
||||||
|
@ -354,16 +359,16 @@ void WinEDA_SchematicFrame::PutDataInPreviousState( PICKED_ITEMS_LIST* aList, bo
|
||||||
SCH_ITEM* image = (SCH_ITEM*) itemWrapper.m_Link;
|
SCH_ITEM* image = (SCH_ITEM*) itemWrapper.m_Link;
|
||||||
switch( itemWrapper.m_UndoRedoStatus )
|
switch( itemWrapper.m_UndoRedoStatus )
|
||||||
{
|
{
|
||||||
case UR_CHANGED: /* Exchange old and new data for each item */
|
case UR_CHANGED: /* Exchange old and new data for each item */
|
||||||
SwapData( item, image );
|
SwapData( item, image );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case UR_NEW: /* new items are deleted */
|
case UR_NEW: /* new items are deleted */
|
||||||
aList->SetPickedItemStatus( UR_DELETED, ii );
|
aList->SetPickedItemStatus( UR_DELETED, ii );
|
||||||
GetScreen()->RemoveFromDrawList( item );
|
GetScreen()->RemoveFromDrawList( item );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case UR_DELETED: /* deleted items are put in EEdrawList, as new items */
|
case UR_DELETED: /* deleted items are put in EEdrawList, as new items */
|
||||||
aList->SetPickedItemStatus( UR_NEW, ii );
|
aList->SetPickedItemStatus( UR_NEW, ii );
|
||||||
item->SetNext( GetScreen()->EEDrawList );
|
item->SetNext( GetScreen()->EEDrawList );
|
||||||
GetScreen()->EEDrawList = item;
|
GetScreen()->EEDrawList = item;
|
||||||
|
@ -371,7 +376,8 @@ void WinEDA_SchematicFrame::PutDataInPreviousState( PICKED_ITEMS_LIST* aList, bo
|
||||||
|
|
||||||
case UR_MOVED:
|
case UR_MOVED:
|
||||||
item->m_Flags = aList->GetPickerFlags(ii);
|
item->m_Flags = aList->GetPickerFlags(ii);
|
||||||
item->Move( aRedoCommand ? aList->m_TransformPoint : - aList->m_TransformPoint );
|
item->Move( aRedoCommand ?
|
||||||
|
aList->m_TransformPoint : - aList->m_TransformPoint );
|
||||||
item->m_Flags = 0;
|
item->m_Flags = 0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -400,8 +406,7 @@ void WinEDA_SchematicFrame::PutDataInPreviousState( PICKED_ITEMS_LIST* aList, bo
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
wxString msg;
|
wxString msg;
|
||||||
msg.Printf( wxT(
|
msg.Printf( wxT( "PutDataInPreviousState() error (unknown code %X)" ),
|
||||||
"PutDataInPreviousState() error (unknown code %X)" ),
|
|
||||||
itemWrapper.m_UndoRedoStatus );
|
itemWrapper.m_UndoRedoStatus );
|
||||||
wxMessageBox( msg );
|
wxMessageBox( msg );
|
||||||
}
|
}
|
||||||
|
@ -411,16 +416,13 @@ void WinEDA_SchematicFrame::PutDataInPreviousState( PICKED_ITEMS_LIST* aList, bo
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**********************************************************/
|
|
||||||
void WinEDA_SchematicFrame::GetSchematicFromUndoList(wxCommandEvent& event)
|
|
||||||
/**********************************************************/
|
|
||||||
|
|
||||||
/** Function GetSchematicFromUndoList
|
/** Function GetSchematicFromUndoList
|
||||||
* Undo the last edition:
|
* Undo the last edition:
|
||||||
* - Save the current schematic in Redo list
|
* - Save the current schematic in Redo list
|
||||||
* - Get the previous version of the schematic from Unodo list
|
* - Get the previous version of the schematic from undo list
|
||||||
* @return none
|
* @return none
|
||||||
*/
|
*/
|
||||||
|
void WinEDA_SchematicFrame::GetSchematicFromUndoList(wxCommandEvent& event)
|
||||||
{
|
{
|
||||||
if( GetScreen()->GetUndoCommandCount() <= 0 )
|
if( GetScreen()->GetUndoCommandCount() <= 0 )
|
||||||
return;
|
return;
|
||||||
|
@ -445,9 +447,6 @@ void WinEDA_SchematicFrame::GetSchematicFromUndoList(wxCommandEvent& event)
|
||||||
DrawPanel->Refresh( );
|
DrawPanel->Refresh( );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**********************************************************/
|
|
||||||
void WinEDA_SchematicFrame::GetSchematicFromRedoList(wxCommandEvent& event)
|
|
||||||
/**********************************************************/
|
|
||||||
|
|
||||||
/** Function GetSchematicFromRedoList
|
/** Function GetSchematicFromRedoList
|
||||||
* Redo the last edition:
|
* Redo the last edition:
|
||||||
|
@ -455,6 +454,7 @@ void WinEDA_SchematicFrame::GetSchematicFromRedoList(wxCommandEvent& event)
|
||||||
* - Get the previous version from Redo list
|
* - Get the previous version from Redo list
|
||||||
* @return none
|
* @return none
|
||||||
*/
|
*/
|
||||||
|
void WinEDA_SchematicFrame::GetSchematicFromRedoList(wxCommandEvent& event)
|
||||||
{
|
{
|
||||||
if( GetScreen()->GetRedoCommandCount() == 0 )
|
if( GetScreen()->GetRedoCommandCount() == 0 )
|
||||||
return;
|
return;
|
||||||
|
@ -481,20 +481,19 @@ void WinEDA_SchematicFrame::GetSchematicFromRedoList(wxCommandEvent& event)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************************/
|
|
||||||
void SCH_SCREEN::ClearUndoORRedoList( UNDO_REDO_CONTAINER& aList, int aItemCount )
|
|
||||||
/**********************************************************************************/
|
|
||||||
|
|
||||||
/** Function ClearUndoORRedoList
|
/** Function ClearUndoORRedoList
|
||||||
* free the undo or redo list from List element
|
* free the undo or redo list from List element
|
||||||
* Wrappers are deleted.
|
* Wrappers are deleted.
|
||||||
* datas pointed by wrappers are deleted if not in use in schematic
|
* datas pointed by wrappers are deleted if not in use in schematic
|
||||||
* i.e. when they are copy of a schematic item or they are no more in use (DELETED)
|
* i.e. when they are copy of a schematic item or they are no more in use
|
||||||
|
* (DELETED)
|
||||||
* @param aList = the UNDO_REDO_CONTAINER to clear
|
* @param aList = the UNDO_REDO_CONTAINER to clear
|
||||||
* @param aItemCount = the count of items to remove. < 0 for all items
|
* @param aItemCount = the count of items to remove. < 0 for all items
|
||||||
* items (commands stored in list) are removed from the beginning of the list.
|
* items (commands stored in list) are removed from the beginning of the list.
|
||||||
* So this function can be called to remove old commands
|
* So this function can be called to remove old commands
|
||||||
*/
|
*/
|
||||||
|
void SCH_SCREEN::ClearUndoORRedoList( UNDO_REDO_CONTAINER& aList,
|
||||||
|
int aItemCount )
|
||||||
{
|
{
|
||||||
if( aItemCount == 0 )
|
if( aItemCount == 0 )
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -29,10 +29,6 @@
|
||||||
#include "libviewfrm.h"
|
#include "libviewfrm.h"
|
||||||
|
|
||||||
|
|
||||||
/*******************************/
|
|
||||||
/* class WinEDA_SchematicFrame */
|
|
||||||
/*******************************/
|
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE( WinEDA_SchematicFrame, WinEDA_DrawFrame )
|
BEGIN_EVENT_TABLE( WinEDA_SchematicFrame, WinEDA_DrawFrame )
|
||||||
EVT_SOCKET( ID_EDA_SOCKET_EVENT_SERV,
|
EVT_SOCKET( ID_EDA_SOCKET_EVENT_SERV,
|
||||||
WinEDA_DrawFrame::OnSockRequestServer )
|
WinEDA_DrawFrame::OnSockRequestServer )
|
||||||
|
@ -102,7 +98,8 @@ BEGIN_EVENT_TABLE( WinEDA_SchematicFrame, WinEDA_DrawFrame )
|
||||||
EVT_MENU( ID_KICAD_ABOUT, WinEDA_DrawFrame::GetKicadAbout )
|
EVT_MENU( ID_KICAD_ABOUT, WinEDA_DrawFrame::GetKicadAbout )
|
||||||
|
|
||||||
// Tools and buttons for vertical toolbar.
|
// Tools and buttons for vertical toolbar.
|
||||||
EVT_TOOL( ID_NO_SELECT_BUTT, WinEDA_SchematicFrame::Process_Special_Functions )
|
EVT_TOOL( ID_NO_SELECT_BUTT,
|
||||||
|
WinEDA_SchematicFrame::Process_Special_Functions )
|
||||||
EVT_TOOL_RANGE( ID_SCHEMATIC_VERTICAL_TOOLBAR_START,
|
EVT_TOOL_RANGE( ID_SCHEMATIC_VERTICAL_TOOLBAR_START,
|
||||||
ID_SCHEMATIC_VERTICAL_TOOLBAR_END,
|
ID_SCHEMATIC_VERTICAL_TOOLBAR_END,
|
||||||
WinEDA_SchematicFrame::Process_Special_Functions )
|
WinEDA_SchematicFrame::Process_Special_Functions )
|
||||||
|
@ -110,7 +107,6 @@ BEGIN_EVENT_TABLE( WinEDA_SchematicFrame, WinEDA_DrawFrame )
|
||||||
EVT_MENU_RANGE( ID_POPUP_START_RANGE, ID_POPUP_END_RANGE,
|
EVT_MENU_RANGE( ID_POPUP_START_RANGE, ID_POPUP_END_RANGE,
|
||||||
WinEDA_SchematicFrame::Process_Special_Functions )
|
WinEDA_SchematicFrame::Process_Special_Functions )
|
||||||
|
|
||||||
|
|
||||||
// Tools and buttons options toolbar
|
// Tools and buttons options toolbar
|
||||||
EVT_TOOL_RANGE( ID_TB_OPTIONS_START, ID_TB_OPTIONS_END,
|
EVT_TOOL_RANGE( ID_TB_OPTIONS_START, ID_TB_OPTIONS_END,
|
||||||
WinEDA_SchematicFrame::OnSelectOptionToolbar )
|
WinEDA_SchematicFrame::OnSelectOptionToolbar )
|
||||||
|
@ -139,9 +135,6 @@ BEGIN_EVENT_TABLE( WinEDA_SchematicFrame, WinEDA_DrawFrame )
|
||||||
WinEDA_SchematicFrame::OnUpdateUnits )
|
WinEDA_SchematicFrame::OnUpdateUnits )
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
/****************/
|
|
||||||
/* Constructor */
|
|
||||||
/****************/
|
|
||||||
|
|
||||||
WinEDA_SchematicFrame::WinEDA_SchematicFrame( wxWindow* father,
|
WinEDA_SchematicFrame::WinEDA_SchematicFrame( wxWindow* father,
|
||||||
const wxString& title,
|
const wxString& title,
|
||||||
|
@ -153,7 +146,7 @@ WinEDA_SchematicFrame::WinEDA_SchematicFrame( wxWindow* father,
|
||||||
m_FrameName = wxT( "SchematicFrame" );
|
m_FrameName = wxT( "SchematicFrame" );
|
||||||
m_Draw_Axis = FALSE; // TRUE to show axis
|
m_Draw_Axis = FALSE; // TRUE to show axis
|
||||||
m_Draw_Sheet_Ref = TRUE; // TRUE to show sheet references
|
m_Draw_Sheet_Ref = TRUE; // TRUE to show sheet references
|
||||||
m_CurrentSheet = new DrawSheetPath();
|
m_CurrentSheet = new SCH_SHEET_PATH();
|
||||||
m_CurrentField = NULL;
|
m_CurrentField = NULL;
|
||||||
m_Multiflag = 0;
|
m_Multiflag = 0;
|
||||||
m_TextFieldSize = DEFAULT_SIZE_TEXT;
|
m_TextFieldSize = DEFAULT_SIZE_TEXT;
|
||||||
|
@ -228,14 +221,10 @@ WinEDA_SchematicFrame::WinEDA_SchematicFrame( wxWindow* father,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***************/
|
|
||||||
/* Destructor */
|
|
||||||
/***************/
|
|
||||||
|
|
||||||
WinEDA_SchematicFrame::~WinEDA_SchematicFrame()
|
WinEDA_SchematicFrame::~WinEDA_SchematicFrame()
|
||||||
{
|
{
|
||||||
SAFE_DELETE( g_RootSheet );
|
SAFE_DELETE( g_RootSheet );
|
||||||
SAFE_DELETE( m_CurrentSheet ); //a DrawSheetPath, on the heap.
|
SAFE_DELETE( m_CurrentSheet ); //a SCH_SHEET_PATH, on the heap.
|
||||||
m_CurrentSheet = NULL;
|
m_CurrentSheet = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -246,37 +235,32 @@ BASE_SCREEN* WinEDA_SchematicFrame::GetBaseScreen() const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***************/
|
SCH_SHEET_PATH* WinEDA_SchematicFrame::GetSheet()
|
||||||
/* utility functions */
|
|
||||||
/***************/
|
|
||||||
DrawSheetPath* WinEDA_SchematicFrame::GetSheet()
|
|
||||||
{
|
{
|
||||||
return m_CurrentSheet;
|
return m_CurrentSheet;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/****************************************************/
|
|
||||||
void WinEDA_SchematicFrame::SetSheetNumberAndCount()
|
|
||||||
{
|
|
||||||
/****************************************************/
|
|
||||||
/** Function SetSheetNumberAndCount
|
/** Function SetSheetNumberAndCount
|
||||||
* Set the m_ScreenNumber and m_NumberOfScreen members for screens
|
* Set the m_ScreenNumber and m_NumberOfScreen members for screens
|
||||||
* must be called after a delete or add sheet command, and when entering a
|
* must be called after a delete or add sheet command, and when entering a
|
||||||
* sheet
|
* sheet
|
||||||
*/
|
*/
|
||||||
|
void WinEDA_SchematicFrame::SetSheetNumberAndCount()
|
||||||
|
{
|
||||||
SCH_SCREEN* screen = GetScreen();
|
SCH_SCREEN* screen = GetScreen();
|
||||||
EDA_ScreenList s_list;
|
EDA_ScreenList s_list;
|
||||||
|
|
||||||
/* Set the sheet count, and the sheet number (1 for root sheet)
|
/* Set the sheet count, and the sheet number (1 for root sheet)
|
||||||
*/
|
*/
|
||||||
int sheet_count = g_RootSheet->CountSheets();
|
int sheet_count = g_RootSheet->CountSheets();
|
||||||
int SheetNumber = 1;
|
int SheetNumber = 1;
|
||||||
wxString current_sheetpath = m_CurrentSheet->Path();
|
wxString current_sheetpath = m_CurrentSheet->Path();
|
||||||
EDA_SheetList SheetList;
|
SCH_SHEET_LIST SheetList;
|
||||||
|
|
||||||
// Examine all sheets path to find the current sheets path,
|
// Examine all sheets path to find the current sheets path,
|
||||||
// and count them from root to the current sheet path:
|
// and count them from root to the current sheet path:
|
||||||
DrawSheetPath* sheet;
|
SCH_SHEET_PATH* sheet;
|
||||||
|
|
||||||
for( sheet = SheetList.GetFirst(); sheet != NULL;
|
for( sheet = SheetList.GetFirst(); sheet != NULL;
|
||||||
sheet = SheetList.GetNext() )
|
sheet = SheetList.GetNext() )
|
||||||
|
@ -298,9 +282,7 @@ void WinEDA_SchematicFrame::SetSheetNumberAndCount()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***************************************************/
|
|
||||||
SCH_SCREEN* WinEDA_SchematicFrame::GetScreen() const
|
SCH_SCREEN* WinEDA_SchematicFrame::GetScreen() const
|
||||||
/***************************************************/
|
|
||||||
{
|
{
|
||||||
return m_CurrentSheet->LastScreen();
|
return m_CurrentSheet->LastScreen();
|
||||||
}
|
}
|
||||||
|
@ -337,11 +319,9 @@ void WinEDA_SchematicFrame::CreateScreens()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************/
|
|
||||||
void WinEDA_SchematicFrame::OnCloseWindow( wxCloseEvent& Event )
|
void WinEDA_SchematicFrame::OnCloseWindow( wxCloseEvent& Event )
|
||||||
{
|
{
|
||||||
/*****************************************************************/
|
SCH_SHEET_PATH* sheet;
|
||||||
DrawSheetPath* sheet;
|
|
||||||
|
|
||||||
if( m_LibeditFrame ) // Can close component editor ?
|
if( m_LibeditFrame ) // Can close component editor ?
|
||||||
{
|
{
|
||||||
|
@ -349,7 +329,7 @@ void WinEDA_SchematicFrame::OnCloseWindow( wxCloseEvent& Event )
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
EDA_SheetList SheetList;
|
SCH_SHEET_LIST SheetList;
|
||||||
|
|
||||||
for( sheet = SheetList.GetFirst(); sheet != NULL;
|
for( sheet = SheetList.GetFirst(); sheet != NULL;
|
||||||
sheet = SheetList.GetNext() )
|
sheet = SheetList.GetNext() )
|
||||||
|
@ -404,10 +384,8 @@ void WinEDA_SchematicFrame::OnCloseWindow( wxCloseEvent& Event )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/************************************/
|
|
||||||
int WinEDA_SchematicFrame::BestZoom()
|
int WinEDA_SchematicFrame::BestZoom()
|
||||||
{
|
{
|
||||||
/************************************/
|
|
||||||
int dx, dy;
|
int dx, dy;
|
||||||
wxSize size;
|
wxSize size;
|
||||||
double zoom;
|
double zoom;
|
||||||
|
@ -426,10 +404,6 @@ int WinEDA_SchematicFrame::BestZoom()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************/
|
|
||||||
wxString WinEDA_SchematicFrame::GetUniqueFilenameForCurrentSheet()
|
|
||||||
{
|
|
||||||
/*******************************************************************/
|
|
||||||
/** Function GetUniqueFilenameForCurrentSheet
|
/** Function GetUniqueFilenameForCurrentSheet
|
||||||
* @return a filename that can be used in plot and print functions
|
* @return a filename that can be used in plot and print functions
|
||||||
* for the current screen and sheet path.
|
* for the current screen and sheet path.
|
||||||
|
@ -442,6 +416,8 @@ wxString WinEDA_SchematicFrame::GetUniqueFilenameForCurrentSheet()
|
||||||
* and has no extension.
|
* and has no extension.
|
||||||
* However if filename is too long name is <sheet filename>-<sheet number>
|
* However if filename is too long name is <sheet filename>-<sheet number>
|
||||||
*/
|
*/
|
||||||
|
wxString WinEDA_SchematicFrame::GetUniqueFilenameForCurrentSheet()
|
||||||
|
{
|
||||||
wxFileName fn = g_RootSheet->GetFileName();
|
wxFileName fn = g_RootSheet->GetFileName();
|
||||||
wxString filename = fn.GetName();
|
wxString filename = fn.GetName();
|
||||||
|
|
||||||
|
@ -500,8 +476,8 @@ void WinEDA_SchematicFrame::OnUpdateSchematicRedo( wxUpdateUIEvent& event )
|
||||||
void WinEDA_SchematicFrame::OnUpdateBusOrientation( wxUpdateUIEvent& event )
|
void WinEDA_SchematicFrame::OnUpdateBusOrientation( wxUpdateUIEvent& event )
|
||||||
{
|
{
|
||||||
wxString tool_tip = g_HVLines ?
|
wxString tool_tip = g_HVLines ?
|
||||||
_( "Draw wires and busses in any direction" ) :
|
_( "Draw wires and buses in any direction" ) :
|
||||||
_( "Draw horizontal and vertical wires and busses only" );
|
_( "Draw horizontal and vertical wires and buses only" );
|
||||||
|
|
||||||
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_BUS_WIRES_ORIENT, g_HVLines );
|
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_BUS_WIRES_ORIENT, g_HVLines );
|
||||||
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_BUS_WIRES_ORIENT,
|
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_BUS_WIRES_ORIENT,
|
||||||
|
@ -544,10 +520,8 @@ void WinEDA_SchematicFrame::OnUpdateGrid( wxUpdateUIEvent& event )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**************************************************************/
|
|
||||||
void WinEDA_SchematicFrame::OnAnnotate( wxCommandEvent& event )
|
void WinEDA_SchematicFrame::OnAnnotate( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
/**************************************************************/
|
|
||||||
DIALOG_ANNOTATE* dlg = new DIALOG_ANNOTATE( this );
|
DIALOG_ANNOTATE* dlg = new DIALOG_ANNOTATE( this );
|
||||||
|
|
||||||
dlg->ShowModal();
|
dlg->ShowModal();
|
||||||
|
@ -555,10 +529,8 @@ void WinEDA_SchematicFrame::OnAnnotate( wxCommandEvent& event )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*********************************************************/
|
|
||||||
void WinEDA_SchematicFrame::OnErc( wxCommandEvent& event )
|
void WinEDA_SchematicFrame::OnErc( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
/*********************************************************/
|
|
||||||
DIALOG_ERC* dlg = new DIALOG_ERC( this );
|
DIALOG_ERC* dlg = new DIALOG_ERC( this );
|
||||||
|
|
||||||
dlg->ShowModal();
|
dlg->ShowModal();
|
||||||
|
@ -566,10 +538,8 @@ void WinEDA_SchematicFrame::OnErc( wxCommandEvent& event )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************/
|
|
||||||
void WinEDA_SchematicFrame::OnCreateNetlist( wxCommandEvent& event )
|
void WinEDA_SchematicFrame::OnCreateNetlist( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
/*******************************************************************/
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if( m_NetlistFormat < NET_TYPE_PCBNEW )
|
if( m_NetlistFormat < NET_TYPE_PCBNEW )
|
||||||
|
@ -586,10 +556,8 @@ void WinEDA_SchematicFrame::OnCreateNetlist( wxCommandEvent& event )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**********************************************************************/
|
|
||||||
void WinEDA_SchematicFrame::OnCreateBillOfMaterials( wxCommandEvent& )
|
void WinEDA_SchematicFrame::OnCreateBillOfMaterials( wxCommandEvent& )
|
||||||
{
|
{
|
||||||
/**********************************************************************/
|
|
||||||
DIALOG_BUILD_BOM* dlg = new DIALOG_BUILD_BOM( this );
|
DIALOG_BUILD_BOM* dlg = new DIALOG_BUILD_BOM( this );
|
||||||
|
|
||||||
dlg->ShowModal();
|
dlg->ShowModal();
|
||||||
|
@ -597,10 +565,8 @@ void WinEDA_SchematicFrame::OnCreateBillOfMaterials( wxCommandEvent& )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************/
|
|
||||||
void WinEDA_SchematicFrame::OnFindItems( wxCommandEvent& event )
|
void WinEDA_SchematicFrame::OnFindItems( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
/*******************************************************************/
|
|
||||||
this->DrawPanel->m_IgnoreMouseEvents = TRUE;
|
this->DrawPanel->m_IgnoreMouseEvents = TRUE;
|
||||||
WinEDA_FindFrame* dlg = new WinEDA_FindFrame( this );
|
WinEDA_FindFrame* dlg = new WinEDA_FindFrame( this );
|
||||||
dlg->ShowModal();
|
dlg->ShowModal();
|
||||||
|
@ -609,10 +575,8 @@ void WinEDA_SchematicFrame::OnFindItems( wxCommandEvent& event )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************/
|
|
||||||
void WinEDA_SchematicFrame::OnLoadFile( wxCommandEvent& event )
|
void WinEDA_SchematicFrame::OnLoadFile( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
/***************************************************************/
|
|
||||||
wxString fn;
|
wxString fn;
|
||||||
|
|
||||||
fn = GetFileFromHistory( event.GetId(), _( "Schematic" ) );
|
fn = GetFileFromHistory( event.GetId(), _( "Schematic" ) );
|
||||||
|
@ -625,35 +589,27 @@ void WinEDA_SchematicFrame::OnLoadFile( wxCommandEvent& event )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************/
|
|
||||||
void WinEDA_SchematicFrame::OnLoadStuffFile( wxCommandEvent& event )
|
void WinEDA_SchematicFrame::OnLoadStuffFile( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
/*******************************************************************/
|
|
||||||
ReadInputStuffFile();
|
ReadInputStuffFile();
|
||||||
DrawPanel->Refresh();
|
DrawPanel->Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************/
|
|
||||||
void WinEDA_SchematicFrame::OnNewProject( wxCommandEvent& event )
|
void WinEDA_SchematicFrame::OnNewProject( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
/****************************************************************/
|
|
||||||
LoadOneEEProject( wxEmptyString, true );
|
LoadOneEEProject( wxEmptyString, true );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************/
|
|
||||||
void WinEDA_SchematicFrame::OnLoadProject( wxCommandEvent& event )
|
void WinEDA_SchematicFrame::OnLoadProject( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
/*****************************************************************/
|
|
||||||
LoadOneEEProject( wxEmptyString, false );
|
LoadOneEEProject( wxEmptyString, false );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************/
|
|
||||||
void WinEDA_SchematicFrame::OnOpenPcbnew( wxCommandEvent& event )
|
void WinEDA_SchematicFrame::OnOpenPcbnew( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
/****************************************************************/
|
|
||||||
wxFileName fn = g_RootSheet->m_AssociatedScreen->m_FileName;
|
wxFileName fn = g_RootSheet->m_AssociatedScreen->m_FileName;
|
||||||
|
|
||||||
if( fn.IsOk() )
|
if( fn.IsOk() )
|
||||||
|
@ -666,10 +622,8 @@ void WinEDA_SchematicFrame::OnOpenPcbnew( wxCommandEvent& event )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************/
|
|
||||||
void WinEDA_SchematicFrame::OnOpenCvpcb( wxCommandEvent& event )
|
void WinEDA_SchematicFrame::OnOpenCvpcb( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
/***************************************************************/
|
|
||||||
wxFileName fn = g_RootSheet->m_AssociatedScreen->m_FileName;
|
wxFileName fn = g_RootSheet->m_AssociatedScreen->m_FileName;
|
||||||
|
|
||||||
fn.SetExt( NetlistFileExtension );
|
fn.SetExt( NetlistFileExtension );
|
||||||
|
@ -683,10 +637,8 @@ void WinEDA_SchematicFrame::OnOpenCvpcb( wxCommandEvent& event )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************/
|
|
||||||
void WinEDA_SchematicFrame::OnOpenLibraryViewer( wxCommandEvent& event )
|
void WinEDA_SchematicFrame::OnOpenLibraryViewer( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
/*************************************************************************/
|
|
||||||
if( m_ViewlibFrame )
|
if( m_ViewlibFrame )
|
||||||
{
|
{
|
||||||
m_ViewlibFrame->Show( TRUE );
|
m_ViewlibFrame->Show( TRUE );
|
||||||
|
@ -699,10 +651,8 @@ void WinEDA_SchematicFrame::OnOpenLibraryViewer( wxCommandEvent& event )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************/
|
|
||||||
void WinEDA_SchematicFrame::OnOpenLibraryEditor( wxCommandEvent& event )
|
void WinEDA_SchematicFrame::OnOpenLibraryEditor( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
/*************************************************************************/
|
|
||||||
if( m_LibeditFrame )
|
if( m_LibeditFrame )
|
||||||
{
|
{
|
||||||
m_LibeditFrame->Show( TRUE );
|
m_LibeditFrame->Show( TRUE );
|
||||||
|
|
|
@ -56,7 +56,7 @@ enum KICAD_T {
|
||||||
DRAW_BUSENTRY_STRUCT_TYPE,
|
DRAW_BUSENTRY_STRUCT_TYPE,
|
||||||
DRAW_SHEET_STRUCT_TYPE,
|
DRAW_SHEET_STRUCT_TYPE,
|
||||||
DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE,
|
DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE,
|
||||||
TYPE_MARKER_SCH,
|
TYPE_SCH_MARKER,
|
||||||
DRAW_NOCONNECT_STRUCT_TYPE,
|
DRAW_NOCONNECT_STRUCT_TYPE,
|
||||||
DRAW_PART_TEXT_STRUCT_TYPE,
|
DRAW_PART_TEXT_STRUCT_TYPE,
|
||||||
|
|
||||||
|
|
|
@ -16,23 +16,22 @@ class SCH_SCREEN;
|
||||||
class DRAWSEGMENT;
|
class DRAWSEGMENT;
|
||||||
class DrawPickedStruct;
|
class DrawPickedStruct;
|
||||||
class SCH_ITEM;
|
class SCH_ITEM;
|
||||||
class DrawNoConnectStruct;
|
class SCH_NO_CONNECT;
|
||||||
class CMP_LIBRARY;
|
class CMP_LIBRARY;
|
||||||
class LIB_COMPONENT;
|
class LIB_COMPONENT;
|
||||||
class CMP_LIB_ENTRY;
|
class CMP_LIB_ENTRY;
|
||||||
class LIB_DRAW_ITEM;
|
class LIB_DRAW_ITEM;
|
||||||
class EDA_BaseStruct;
|
class EDA_BaseStruct;
|
||||||
class DrawBusEntryStruct;
|
class SCH_BUS_ENTRY;
|
||||||
class SCH_GLOBALLABEL;
|
class SCH_GLOBALLABEL;
|
||||||
class SCH_TEXT;
|
class SCH_TEXT;
|
||||||
class EDA_DrawLineStruct;
|
|
||||||
class SCH_SHEET;
|
class SCH_SHEET;
|
||||||
class DrawSheetPath;
|
class SCH_SHEET_PATH;
|
||||||
class SCH_SHEET_PIN;
|
class SCH_SHEET_PIN;
|
||||||
class SCH_COMPONENT;
|
class SCH_COMPONENT;
|
||||||
class SCH_CMP_FIELD;
|
class SCH_FIELD;
|
||||||
class LIB_PIN;
|
class LIB_PIN;
|
||||||
class DrawJunctionStruct;
|
class SCH_JUNCTION;
|
||||||
|
|
||||||
/* enum used in RotationMiroir() */
|
/* enum used in RotationMiroir() */
|
||||||
enum fl_rot_cmp
|
enum fl_rot_cmp
|
||||||
|
@ -55,7 +54,7 @@ class WinEDA_SchematicFrame : public WinEDA_DrawFrame
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
WinEDAChoiceBox* m_SelPartBox;
|
WinEDAChoiceBox* m_SelPartBox;
|
||||||
DrawSheetPath* m_CurrentSheet; ///< which sheet we are presently working on.
|
SCH_SHEET_PATH* m_CurrentSheet; ///< which sheet we are presently working on.
|
||||||
int m_Multiflag;
|
int m_Multiflag;
|
||||||
int m_NetlistFormat;
|
int m_NetlistFormat;
|
||||||
bool m_ShowAllPins;
|
bool m_ShowAllPins;
|
||||||
|
@ -68,7 +67,7 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
wxString m_DefaultSchematicFileName;
|
wxString m_DefaultSchematicFileName;
|
||||||
SCH_CMP_FIELD* m_CurrentField;
|
SCH_FIELD* m_CurrentField;
|
||||||
int m_TextFieldSize;
|
int m_TextFieldSize;
|
||||||
bool m_ShowGrid;
|
bool m_ShowGrid;
|
||||||
PARAM_CFG_ARRAY m_projectFileParams;
|
PARAM_CFG_ARRAY m_projectFileParams;
|
||||||
|
@ -108,15 +107,15 @@ public:
|
||||||
int hotkey,
|
int hotkey,
|
||||||
EDA_BaseStruct* DrawStruct );
|
EDA_BaseStruct* DrawStruct );
|
||||||
|
|
||||||
SCH_CMP_FIELD* GetCurrentField() { return m_CurrentField; }
|
SCH_FIELD* GetCurrentField() { return m_CurrentField; }
|
||||||
|
|
||||||
void SetCurrentField( SCH_CMP_FIELD* aCurrentField )
|
void SetCurrentField( SCH_FIELD* aCurrentField )
|
||||||
{
|
{
|
||||||
m_CurrentField = aCurrentField;
|
m_CurrentField = aCurrentField;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
DrawSheetPath* GetSheet();
|
SCH_SHEET_PATH* GetSheet();
|
||||||
|
|
||||||
SCH_SCREEN* GetScreen() const;
|
SCH_SCREEN* GetScreen() const;
|
||||||
|
|
||||||
|
@ -279,21 +278,21 @@ private:
|
||||||
void OnUpdateBusOrientation( wxUpdateUIEvent& event );
|
void OnUpdateBusOrientation( wxUpdateUIEvent& event );
|
||||||
|
|
||||||
// Bus Entry
|
// Bus Entry
|
||||||
DrawBusEntryStruct* CreateBusEntry( wxDC* DC, int entry_type );
|
SCH_BUS_ENTRY* CreateBusEntry( wxDC* DC, int entry_type );
|
||||||
void SetBusEntryShape( wxDC* DC,
|
void SetBusEntryShape( wxDC* DC,
|
||||||
DrawBusEntryStruct* BusEntry,
|
SCH_BUS_ENTRY* BusEntry,
|
||||||
int entry_type );
|
int entry_type );
|
||||||
int GetBusEntryShape( DrawBusEntryStruct* BusEntry );
|
int GetBusEntryShape( SCH_BUS_ENTRY* BusEntry );
|
||||||
void StartMoveBusEntry( DrawBusEntryStruct* DrawLibItem,
|
void StartMoveBusEntry( SCH_BUS_ENTRY* DrawLibItem,
|
||||||
wxDC* DC );
|
wxDC* DC );
|
||||||
|
|
||||||
// NoConnect
|
// NoConnect
|
||||||
DrawNoConnectStruct* CreateNewNoConnectStruct( wxDC* DC );
|
SCH_NO_CONNECT* CreateNewNoConnectStruct( wxDC* DC );
|
||||||
|
|
||||||
// Junction
|
// Junction
|
||||||
DrawJunctionStruct* CreateNewJunctionStruct( wxDC* DC,
|
SCH_JUNCTION* CreateNewJunctionStruct( wxDC* DC,
|
||||||
const wxPoint& pos,
|
const wxPoint& pos,
|
||||||
bool PutInUndoList = FALSE );
|
bool PutInUndoList = FALSE );
|
||||||
|
|
||||||
// Text ,label, glabel
|
// Text ,label, glabel
|
||||||
SCH_TEXT* CreateNewText( wxDC* DC, int type );
|
SCH_TEXT* CreateNewText( wxDC* DC, int type );
|
||||||
|
@ -344,7 +343,7 @@ private:
|
||||||
SCH_SHEET_PIN* Import_PinSheet( SCH_SHEET* Sheet, wxDC* DC );
|
SCH_SHEET_PIN* Import_PinSheet( SCH_SHEET* Sheet, wxDC* DC );
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void DeleteSheetLabel( bool aRedraw,
|
void DeleteSheetLabel( bool aRedraw,
|
||||||
SCH_SHEET_PIN* aSheetLabelToDel );
|
SCH_SHEET_PIN* aSheetLabelToDel );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -358,7 +357,7 @@ private:
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void CmpRotationMiroir( SCH_COMPONENT* DrawComponent,
|
void CmpRotationMiroir( SCH_COMPONENT* DrawComponent,
|
||||||
wxDC* DC, int type_rotate );
|
wxDC* DC, int type_rotate );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void SelPartUnit( SCH_COMPONENT* DrawComponent,
|
void SelPartUnit( SCH_COMPONENT* DrawComponent,
|
||||||
|
@ -369,10 +368,10 @@ private:
|
||||||
wxDC* DC );
|
wxDC* DC );
|
||||||
void EditComponentValue( SCH_COMPONENT* DrawLibItem, wxDC* DC );
|
void EditComponentValue( SCH_COMPONENT* DrawLibItem, wxDC* DC );
|
||||||
void EditComponentFootprint( SCH_COMPONENT* DrawLibItem,
|
void EditComponentFootprint( SCH_COMPONENT* DrawLibItem,
|
||||||
wxDC* DC );
|
wxDC* DC );
|
||||||
void StartMoveCmpField( SCH_CMP_FIELD* Field, wxDC* DC );
|
void StartMoveCmpField( SCH_FIELD* Field, wxDC* DC );
|
||||||
void EditCmpFieldText( SCH_CMP_FIELD* Field, wxDC* DC );
|
void EditCmpFieldText( SCH_FIELD* Field, wxDC* DC );
|
||||||
void RotateCmpField( SCH_CMP_FIELD* Field, wxDC* DC );
|
void RotateCmpField( SCH_FIELD* Field, wxDC* DC );
|
||||||
|
|
||||||
void PasteListOfItems( wxDC* DC );
|
void PasteListOfItems( wxDC* DC );
|
||||||
|
|
||||||
|
@ -389,7 +388,7 @@ public:
|
||||||
*/
|
*/
|
||||||
void SaveCopyInUndoList( SCH_ITEM* aItemToCopy,
|
void SaveCopyInUndoList( SCH_ITEM* aItemToCopy,
|
||||||
UndoRedoOpType aTypeCommand,
|
UndoRedoOpType aTypeCommand,
|
||||||
const wxPoint& aTransformPoint = wxPoint(0,0) );
|
const wxPoint& aTransformPoint = wxPoint( 0, 0 ) );
|
||||||
|
|
||||||
/** Function SaveCopyInUndoList (overloaded).
|
/** Function SaveCopyInUndoList (overloaded).
|
||||||
* Creates a new entry in undo list of commands.
|
* Creates a new entry in undo list of commands.
|
||||||
|
@ -401,7 +400,7 @@ public:
|
||||||
*/
|
*/
|
||||||
void SaveCopyInUndoList( PICKED_ITEMS_LIST& aItemsList,
|
void SaveCopyInUndoList( PICKED_ITEMS_LIST& aItemsList,
|
||||||
UndoRedoOpType aTypeCommand,
|
UndoRedoOpType aTypeCommand,
|
||||||
const wxPoint& aTransformPoint = wxPoint(0,0) );
|
const wxPoint& aTransformPoint = wxPoint( 0, 0 ) );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/** Function PutDataInPreviousState()
|
/** Function PutDataInPreviousState()
|
||||||
|
|
|
@ -79,8 +79,10 @@ void WinEDA_BasePcbFrame::Genere_HPGL( const wxString& FullFileName, int Layer,
|
||||||
// Calculate the page size offset.
|
// Calculate the page size offset.
|
||||||
if( Center )
|
if( Center )
|
||||||
{
|
{
|
||||||
offset.x = BoardCenter.x - ( SheetSize.x / 2 ) / scale;
|
offset.x = wxRound( (double) BoardCenter.x -
|
||||||
offset.y = BoardCenter.y - ( SheetSize.y / 2 ) / scale;
|
( (double) SheetSize.x / 2.0 ) / scale );
|
||||||
|
offset.y = wxRound( (double) BoardCenter.y -
|
||||||
|
( (double) SheetSize.y / 2.0 ) / scale );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -84,8 +84,10 @@ void WinEDA_BasePcbFrame::Genere_PS( const wxString& FullFileName, int Layer,
|
||||||
|
|
||||||
if( Center )
|
if( Center )
|
||||||
{
|
{
|
||||||
offset.x = BoardCenter.x - ( PaperSize.x / 2 ) / scale;
|
offset.x = wxRound( (double) BoardCenter.x -
|
||||||
offset.y = BoardCenter.y - ( PaperSize.y / 2 ) / scale;
|
( (double) PaperSize.x / 2.0 ) / scale );
|
||||||
|
offset.y = wxRound( (double) BoardCenter.y -
|
||||||
|
( (double) PaperSize.y / 2.0 ) / scale );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue