Dialog work and other minor changes.

* Replace EESchema sheet properties dialog with wxFormBuilder version.
* Editing an existing sheet now marks schematic as modified.
* Code style updates for some of my previous work.
* Improvements to the CMP_LIB_ENTRY object.
* Replaced symbol edit export fprintf code with wxFFile implementation.
* GCC compiler warning fix in pcbnew/drc.cpp.
This commit is contained in:
stambaughw 2009-12-15 21:11:05 +00:00
parent 867737e2f4
commit 014d852bc6
32 changed files with 2710 additions and 3413 deletions

View File

@ -65,6 +65,8 @@ set(EESCHEMA_SRCS
dialog_lib_new_component_base.cpp dialog_lib_new_component_base.cpp
dialog_print_using_printer_base.cpp dialog_print_using_printer_base.cpp
dialog_print_using_printer.cpp dialog_print_using_printer.cpp
dialog_sch_sheet_props.cpp
dialog_sch_sheet_props_base.cpp
dialog_SVG_print.cpp dialog_SVG_print.cpp
dialog_SVG_print_base.cpp dialog_SVG_print_base.cpp
edit_component_in_lib.cpp edit_component_in_lib.cpp

View File

@ -75,7 +75,7 @@ void ReAnnotatePowerSymbolsOnly( void )
LIB_COMPONENT* Entry = LIB_COMPONENT* Entry =
CMP_LIBRARY::FindLibraryComponent( DrawLibItem->m_ChipName ); CMP_LIBRARY::FindLibraryComponent( DrawLibItem->m_ChipName );
if( (Entry == NULL) || (Entry->m_Options != ENTRY_POWER) ) if( ( Entry == NULL ) || !Entry->isPower() )
continue; continue;
//DrawLibItem->ClearAnnotation(sheet); this clears all annotation :( //DrawLibItem->ClearAnnotation(sheet); this clears all annotation :(

File diff suppressed because it is too large Load Diff

View File

@ -38,19 +38,26 @@ enum LibrEntryOptions
*/ */
class CMP_LIB_ENTRY : public EDA_BaseStruct class CMP_LIB_ENTRY : public EDA_BaseStruct
{ {
public:
LibrEntryType Type; /* Type = ROOT; protected:
* = ALIAS pour struct LibraryAliasType */ wxString name;
wxString m_Doc; /* documentation for info */
wxString m_KeyWord; /* keyword list (used to select a group of /** Library object that entry is attached to. */
CMP_LIBRARY* library;
/** Entry type, either ROOT or ALIAS. */
LibrEntryType type;
wxString description; /* documentation for info */
wxString keyWords; /* keyword list (used for search for
* components by keyword) */ * components by keyword) */
wxString m_DocFile; /* Associate doc file name */ wxString docFileName; /* Associate doc file name */
LibrEntryOptions m_Options; // special features (i.e. Entry is a POWER) LibrEntryOptions options; // special features (i.e. Entry is a POWER)
public: public:
CMP_LIB_ENTRY( LibrEntryType CmpType, const wxString& name, CMP_LIB_ENTRY( LibrEntryType aType, const wxString& aName,
CMP_LIBRARY* lib = NULL ); CMP_LIBRARY* aLibrary = NULL );
CMP_LIB_ENTRY( CMP_LIB_ENTRY& entry, CMP_LIBRARY* lib = NULL ); CMP_LIB_ENTRY( CMP_LIB_ENTRY& aEntry, CMP_LIBRARY* aLibrary = NULL );
virtual ~CMP_LIB_ENTRY(); virtual ~CMP_LIB_ENTRY();
@ -61,9 +68,42 @@ public:
wxString GetLibraryName(); wxString GetLibraryName();
virtual const wxString& GetName() const { return m_Name; } virtual const wxString& GetName() const { return name; }
virtual void SetName( const wxString& name ) { m_Name = name; } virtual void SetName( const wxString& aName ) { name = aName; }
bool isComponent() { return type == ROOT; }
bool isAlias() { return type == ALIAS; }
int GetType() { return type; }
bool isPower() { return options == ENTRY_POWER; }
bool isNormal() { return options == ENTRY_NORMAL; }
void SetPower() { options = ENTRY_POWER; }
void SetNormal() { options = ENTRY_NORMAL; }
void SetDescription( const wxString& aDescription )
{
description = aDescription;
}
wxString GetDescription() { return description; }
void SetKeyWords( const wxString& aKeyWords )
{
keyWords = aKeyWords;
}
wxString GetKeyWords() { return keyWords; }
void SetDocFileName( const wxString& aDocFileName )
{
docFileName = aDocFileName;
}
wxString GetDocFileName() { return docFileName; }
/** /**
* Write the entry document information to a FILE in "*.dcm" format. * Write the entry document information to a FILE in "*.dcm" format.
@ -76,26 +116,19 @@ public:
/** /**
* Case insensitive comparison of the component entry name. * Case insensitive comparison of the component entry name.
*/ */
bool operator==( const wxChar* name ) const; bool operator==( const wxChar* aName ) const;
bool operator!=( const wxChar* name ) const bool operator!=( const wxChar* aName ) const
{ {
return !( *this == name ); return !( *this == aName );
} }
protected:
wxString m_Name;
/** Library object that entry is attached to. */
CMP_LIBRARY* m_lib;
}; };
typedef boost::ptr_vector< CMP_LIB_ENTRY > LIB_ENTRY_LIST; typedef boost::ptr_vector< CMP_LIB_ENTRY > LIB_ENTRY_LIST;
extern bool operator<( const CMP_LIB_ENTRY& item1, const CMP_LIB_ENTRY& item2 ); extern bool operator<( const CMP_LIB_ENTRY& aItem1, const CMP_LIB_ENTRY& aItem2 );
extern int LibraryEntryCompare( const CMP_LIB_ENTRY* LE1, extern int LibraryEntryCompare( const CMP_LIB_ENTRY* aItem1, const CMP_LIB_ENTRY* aItem2 );
const CMP_LIB_ENTRY* LE2 );
/** /**
@ -126,8 +159,8 @@ public:
long m_LastDate; // Last change Date long m_LastDate; // Last change Date
protected: protected:
int m_UnitCount; /* Units (or sections) per package */ int unitCount; /* Units (parts) per package */
LIB_DRAW_ITEM_LIST m_Drawings; /* How to draw this part */ LIB_DRAW_ITEM_LIST drawings; /* How to draw this part */
public: public:
virtual wxString GetClass() const virtual wxString GetClass() const
@ -136,21 +169,21 @@ public:
} }
virtual void SetName( const wxString& name ) virtual void SetName( const wxString& aName )
{ {
CMP_LIB_ENTRY::SetName( name ); CMP_LIB_ENTRY::SetName( aName );
GetValueField().m_Text = name; GetValueField().m_Text = aName;
} }
LIB_COMPONENT( const wxString& name, CMP_LIBRARY* lib = NULL ); LIB_COMPONENT( const wxString& aName, CMP_LIBRARY* aLibrary = NULL );
LIB_COMPONENT( LIB_COMPONENT& component, CMP_LIBRARY* lib = NULL ); LIB_COMPONENT( LIB_COMPONENT& aComponent, CMP_LIBRARY* aLibrary = NULL );
~LIB_COMPONENT(); ~LIB_COMPONENT();
EDA_Rect GetBoundaryBox( int Unit, int Convert ); EDA_Rect GetBoundaryBox( int aUnit, int aConvert );
bool SaveDateAndTime( FILE* ExportFile ); bool SaveDateAndTime( FILE* aFile );
bool LoadDateAndTime( char* Line ); bool LoadDateAndTime( char* aLine );
/** /**
* Write the data structures out to a FILE in "*.lib" format. * Write the data structures out to a FILE in "*.lib" format.
@ -161,21 +194,21 @@ public:
bool Save( FILE* aFile ); bool Save( FILE* aFile );
/** /**
* Load component definition from file. * Load component definition from /a aFile.
* *
* @param file - File descriptor of file to load form. * @param aFile - File descriptor of file to load form.
* @param line - The first line of the component definition. * @param aLine - The first line of the component definition.
* @param lineNum - The current line number in the file. * @param aLineNum - The current line number in the file.
* @param errorMsg - Description of error on load failure. * @param aErrorMsg - Description of error on load failure.
* @return True if the load was successful, false if there was an error. * @return True if the load was successful, false if there was an error.
*/ */
bool Load( FILE* file, char* line, int* lineNum, wxString& errorMsg ); bool Load( FILE* aFile, char* aLine, int* aLineNum, wxString& aErrorMsg );
bool LoadField( char* line, wxString& errorMsg ); bool LoadField( char* aLine, wxString& aErrorMsg );
bool LoadDrawEntries( FILE* f, char* line, bool LoadDrawEntries( FILE* aFile, char* aLine,
int* lineNum, wxString& errorMsg ); int* aLineNum, wxString& aErrorMsg );
bool LoadAliases( char* line, wxString& Error ); bool LoadAliases( char* aLine, wxString& aErrorMsg );
bool LoadFootprints( FILE* file, char* line, bool LoadFootprints( FILE* aFile, char* aLine,
int* lineNum, wxString& errorMsg ); int* aLineNum, wxString& aErrorMsg );
/** /**
* Initialize fields from a vector of fields. * Initialize fields from a vector of fields.
@ -187,90 +220,90 @@ public:
/** /**
* Return list of field references of component. * Return list of field references of component.
* *
* @param list - List to add field references to. * @param aList - List to add field references to.
*/ */
void GetFields( LIB_FIELD_LIST& list ); void GetFields( LIB_FIELD_LIST& aList );
/** /**
* Return pointer to the requested field. * Return pointer to the requested field.
* *
* @param id - Id of field to return. * @param aId - Id of field to return.
* @return The field if found, otherwise NULL. * @return The field if found, otherwise NULL.
*/ */
LIB_FIELD* GetField( int id ); LIB_FIELD* GetField( int aId );
/** Return reference to the value field. */ /** Return reference to the value field. */
LIB_FIELD& GetValueField( void ); LIB_FIELD& GetValueField();
/** Return reference to the reference designator field. */ /** Return reference to the reference designator field. */
LIB_FIELD& GetReferenceField( void ); LIB_FIELD& GetReferenceField();
/** /**
* Draw component. * Draw component.
* *
* @param panel - Window to draw on. * @param aPanel - Window to draw on.
* @param dc - Device context to draw on. * @param aDc - Device context to draw on.
* @param offset - Position to component. * @param aOffset - Position to component.
* @param multi - Component unit if multiple parts per component. * @param aMulti - Component unit if multiple parts per component.
* @param convert - Component conversion (DeMorgan) if available. * @param aConvert - Component conversion (DeMorgan) if available.
* @param drawMode - Device context drawing mode, see wxDC. * @param aDrawMode - Device context drawing mode, see wxDC.
* @param color - Color to draw component. * @param aColor - Color to draw component.
* @param transformMatrix - Coordinate adjustment settings. * @param aTransformMatrix - Coordinate adjustment settings.
* @param showPinText - Show pin text if true. * @param aShowPinText - Show pin text if true.
* @param drawFields - Draw field text if true otherwise just draw * @param aDrawFields - Draw field text if true otherwise just draw
* body items (useful to draw a body in schematic, * body items (useful to draw a body in schematic,
* because fields of schematic components replace * because fields of schematic components replace
* the lib component fields). * the lib component fields).
* @param onlySelected - Draws only the body items that are selected. * @param aOnlySelected - Draws only the body items that are selected.
* Used for block move redraws. * Used for block move redraws.
*/ */
void Draw( WinEDA_DrawPanel* panel, wxDC* dc, const wxPoint& offset, void Draw( WinEDA_DrawPanel* aPanel, wxDC* aDc, const wxPoint& aOffset,
int multi, int convert, int drawMode, int color = -1, int aMulti, int aConvert, int aDrawMode, int aColor = -1,
const int transformMatrix[2][2] = DefaultTransformMatrix, const int aTransform[2][2] = DefaultTransformMatrix,
bool showPinText = true, bool drawFields = true, bool aShowPinText = true, bool aDrawFields = true,
bool onlySelected = false ); bool aOnlySelected = false );
/** /**
* Plot component to plotter. * Plot component to plotter.
* *
* @param plotter - Plotter object to plot to. * @param aPlotter - Plotter object to plot to.
* @param unit - Component part to plot. * @param aUnit - Component part to plot.
* @param convert - Component alternate body style to plot. * @param aConvert - Component alternate body style to plot.
* @param transform - Component plot transform matrix. * @param aTransform - Component plot transform matrix.
*/ */
void Plot( PLOTTER* plotter, int unit, int convert, const wxPoint& offset, void Plot( PLOTTER* aPlotter, int aUnit, int aConvert, const wxPoint& aOffset,
const int transform[2][2] ); const int aTransform[2][2] );
/** /**
* Add a new draw item to the draw object list. * Add a new draw /a aItem to the draw object list.
* *
* @param item - New draw object to add to component. * @param item - New draw object to add to component.
*/ */
void AddDrawItem( LIB_DRAW_ITEM* item ); void AddDrawItem( LIB_DRAW_ITEM* aItem );
/** /**
* Remove draw item from list. * Remove draw /a aItem from list.
* *
* @param item - Draw item to remove from list. * @param aItem - Draw item to remove from list.
* @param panel - Panel to remove part from. * @param aPanel - Panel to remove part from.
* @param dc - Device context to remove part from. * @param aDc - Device context to remove part from.
*/ */
void RemoveDrawItem( LIB_DRAW_ITEM* item, void RemoveDrawItem( LIB_DRAW_ITEM* aItem,
WinEDA_DrawPanel* panel = NULL, WinEDA_DrawPanel* aPanel = NULL,
wxDC* dc = NULL ); wxDC* aDc = NULL );
/** /**
* Return the next draw object pointer. * Return the next draw object pointer.
* *
* @param item - Pointer to the current draw item. Setting item NULL * @param aItem - Pointer to the current draw item. Setting item NULL
* with return the first item of type in the list. * with return the first item of type in the list.
* @param type - type of searched item (filter). * @param aType - type of searched item (filter).
* if TYPE_NOT_INIT search for all items types * if TYPE_NOT_INIT search for all items types
* @return - The next drawing object in the list if found, otherwise NULL. * @return - The next drawing object in the list if found, otherwise NULL.
*/ */
LIB_DRAW_ITEM* GetNextDrawItem( LIB_DRAW_ITEM* item = NULL, LIB_DRAW_ITEM* GetNextDrawItem( LIB_DRAW_ITEM* aItem = NULL,
KICAD_T type = TYPE_NOT_INIT ); KICAD_T aType = TYPE_NOT_INIT );
/** /**
* Return the next pin object from the draw list. * Return the next pin object from the draw list.
@ -281,9 +314,9 @@ public:
* first pin in the draw object list. * first pin in the draw object list.
* @return - The next pin object in the list if found, otherwise NULL. * @return - The next pin object in the list if found, otherwise NULL.
*/ */
LIB_PIN* GetNextPin( LIB_PIN* item = NULL ) LIB_PIN* GetNextPin( LIB_PIN* aItem = NULL )
{ {
return (LIB_PIN*) GetNextDrawItem( (LIB_DRAW_ITEM*) item, return (LIB_PIN*) GetNextDrawItem( (LIB_DRAW_ITEM*) aItem,
COMPONENT_PIN_DRAW_TYPE ); COMPONENT_PIN_DRAW_TYPE );
} }
@ -295,32 +328,32 @@ public:
* Deleting any of the objects will leave list in a unstable state * Deleting any of the objects will leave list in a unstable state
* and will likely segfault when the list is destroyed. * and will likely segfault when the list is destroyed.
* *
* @param list - Pin list to place pin object pointers into. * @param aList - Pin list to place pin object pointers into.
* @param unit - Unit number of pin to add to list. Set to 0 to * @param aUnit - Unit number of pin to add to list. Set to 0 to
* get pins from any component part. * get pins from any component part.
* @param convert - Convert number of pin to add to list. Set to 0 to * @param aConvert - Convert number of pin to add to list. Set to 0 to
* get pins from any convert of component. * get pins from any convert of component.
*/ */
void GetPins( LIB_PIN_LIST& pins, int unit = 0, int convert = 0 ); void GetPins( LIB_PIN_LIST& aList, int aUnit = 0, int aConvert = 0 );
/** /**
* Return pin object with the requested pin number. * Return pin object with the requested pin /a aNumber.
* *
* @param number - Number of the pin to find. * @param aNumber - Number of the pin to find.
* @param unit - Unit of the component to find. Set to 0 if a specific * @param aUnit - Unit of the component to find. Set to 0 if a specific
* unit number is not required. * unit number is not required.
* @param convert - Alternate body style filter (DeMorgan). Set to 0 if * @param aConvert - Alternate body style filter (DeMorgan). Set to 0 if
* no alternate body style is required. * no alternate body style is required.
* @return The pin object if found. Otherwise NULL. * @return The pin object if found. Otherwise NULL.
*/ */
LIB_PIN* GetPin( const wxString& number, int unit = 0, int convert = 0 ); LIB_PIN* GetPin( const wxString& aNumber, int aUnit = 0, int aConvert = 0 );
/** /**
* Move the component offset. * Move the component /a aOffset.
* *
* @param offset - Offset displacement. * @param aOffset - Offset displacement.
*/ */
void SetOffset( const wxPoint& offset ); void SetOffset( const wxPoint& aOffset );
/** /**
* Remove duplicate draw items from list. * Remove duplicate draw items from list.
@ -335,23 +368,23 @@ public:
bool HasConversion() const; bool HasConversion() const;
/** /**
* Test if alias name is in component alias list. * Test if alias /a aName is in component alias list.
* *
* Alias name comparisons are case insensitive. * Alias name comparisons are case insensitive.
* *
* @param name - Name of alias. * @param aName - Name of alias.
* @return True if alias name in alias list. * @return True if alias name in alias list.
*/ */
bool HasAlias( const wxChar* name ) bool HasAlias( const wxChar* aName )
{ {
wxASSERT( name != NULL ); wxASSERT( aName != NULL );
return m_AliasList.Index( name ) != wxNOT_FOUND; return m_AliasList.Index( aName ) != wxNOT_FOUND;
} }
/** /**
* Clears the status flag all draw objects in this component. * Clears the status flag all draw objects in this component.
*/ */
void ClearStatus( void ); void ClearStatus();
/** /**
* Checks all draw objects of component to see if they are with block. * Checks all draw objects of component to see if they are with block.
@ -359,21 +392,21 @@ public:
* Use this method to mark draw objects as selected during block * Use this method to mark draw objects as selected during block
* functions. * functions.
* *
* @param rect - The bounding rectangle to test in draw items are inside. * @param aRect - The bounding rectangle to test in draw items are inside.
* @param unit - The current unit number to test against. * @param aUnit - The current unit number to test against.
* @param convert - Are the draw items being selected a conversion. * @param aConvert - Are the draw items being selected a conversion.
* @param editPinByPin - Used to ignore pin selections when in edit pin * @param aEditPinByPin - Used to ignore pin selections when in edit pin
* by pin mode is enabled. * by pin mode is enabled.
* @return The number of draw objects found inside the block select * @return The number of draw objects found inside the block select
* rectangle. * rectangle.
*/ */
int SelectItems( EDA_Rect& rect, int unit, int convert, int SelectItems( EDA_Rect& aRect, int aUnit, int aConvert,
bool editPinByPin ); bool aEditPinByPin );
/** /**
* Clears all the draw items marked by a block select. * Clears all the draw items marked by a block select.
*/ */
void ClearSelectedItems( void ); void ClearSelectedItems();
/** /**
* Deletes the select draw items marked by a block select. * Deletes the select draw items marked by a block select.
@ -382,12 +415,12 @@ public:
* minimum drawing items required for any component. Their properties * minimum drawing items required for any component. Their properties
* can be changed but the cannot be removed. * can be changed but the cannot be removed.
*/ */
void DeleteSelectedItems( void ); void DeleteSelectedItems();
/** /**
* Move the selected draw items marked by a block select. * Move the selected draw items marked by a block select.
*/ */
void MoveSelectedItems( const wxPoint& offset ); void MoveSelectedItems( const wxPoint& aOffset );
/** /**
* Make a copy of the selected draw items marked by a block select. * Make a copy of the selected draw items marked by a block select.
@ -396,47 +429,47 @@ public:
* Copying fields would result in duplicate fields which does not * Copying fields would result in duplicate fields which does not
* make sense in this context. * make sense in this context.
*/ */
void CopySelectedItems( const wxPoint& offset ); void CopySelectedItems( const wxPoint& aOffset );
/** /**
* Horizontally (X axis) mirror selected draw items about a point. * Horizontally (X axis) mirror selected draw items about a point.
* *
* @param center - Center point to mirror around. * @param aCenter - Center point to mirror around.
*/ */
void MirrorSelectedItemsH( const wxPoint& center ); void MirrorSelectedItemsH( const wxPoint& aCenter );
/** /**
* Locate a draw object. * Locate a draw object.
* *
* @param unit - Unit number of draw item. * @param aUnit - Unit number of draw item.
* @param convert - Body style of draw item. * @param aConvert - Body style of draw item.
* @param type - Draw object type, set to 0 to search for any type. * @param aType - Draw object type, set to 0 to search for any type.
* @param pt - Coordinate for hit testing. * @param aPoint - Coordinate for hit testing.
* @return The draw object if found. Otherwise NULL. * @return The draw object if found. Otherwise NULL.
*/ */
LIB_DRAW_ITEM* LocateDrawItem( int unit, int convert, KICAD_T type, LIB_DRAW_ITEM* LocateDrawItem( int aUnit, int aConvert, KICAD_T aType,
const wxPoint& pt ); const wxPoint& aPoint );
/** /**
* Locate a draw object (overlaid) * Locate a draw object (overlaid)
* *
* @param unit - Unit number of draw item. * @param aUnit - Unit number of draw item.
* @param convert - Body style of draw item. * @param aConvert - Body style of draw item.
* @param type - Draw object type, set to 0 to search for any type. * @param aType - Draw object type, set to 0 to search for any type.
* @param pt - Coordinate for hit testing. * @param aPoint - Coordinate for hit testing.
* @param aTransMat = the transform matrix * @param aTransform = the transform matrix
* @return The draw object if found. Otherwise NULL. * @return The draw object if found. Otherwise NULL.
*/ */
LIB_DRAW_ITEM* LocateDrawItem( int unit, int convert, KICAD_T type, LIB_DRAW_ITEM* LocateDrawItem( int aUnit, int aConvert, KICAD_T aType,
const wxPoint& pt, const wxPoint& aPoint,
const int aTransMat[2][2] ); const int aTransfrom[2][2] );
/** /**
* Return a reference to the draw item list. * Return a reference to the draw item list.
* *
* @return LIB_DRAW_ITEM_LIST& - Reference to the draw item object list. * @return LIB_DRAW_ITEM_LIST& - Reference to the draw item object list.
*/ */
LIB_DRAW_ITEM_LIST& GetDrawItemList( void ) { return m_Drawings; } LIB_DRAW_ITEM_LIST& GetDrawItemList() { return drawings; }
/** /**
* Set the part per package count. * Set the part per package count.
@ -450,7 +483,7 @@ public:
*/ */
void SetPartCount( int count ); void SetPartCount( int count );
int GetPartCount( void ) { return m_UnitCount; } int GetPartCount() { return unitCount; }
/** /**
* Set or clear the alternate body style (DeMorgan) for the component. * Set or clear the alternate body style (DeMorgan) for the component.
@ -461,9 +494,9 @@ public:
* asConvert is true, than the base draw items are duplicated and * asConvert is true, than the base draw items are duplicated and
* added to the component. * added to the component.
* *
* @param asConvert - Set or clear the component alternate body style. * @param aSetConvert - Set or clear the component alternate body style.
*/ */
void SetConversion( bool asConvert ); void SetConversion( bool aSetConvert );
}; };
@ -476,12 +509,19 @@ public:
class LIB_ALIAS : public CMP_LIB_ENTRY class LIB_ALIAS : public CMP_LIB_ENTRY
{ {
protected: protected:
LIB_COMPONENT* m_root; /* Root component of the alias. */ /**
* The actual component of the alias.
*
* @note - Do not delete the root component. The root component is owned
* by library the component is part of. Deleting the root component
* will likely cause EESchema to crash.
*/
LIB_COMPONENT* root;
public: public:
LIB_ALIAS( const wxString& name, LIB_COMPONENT* root, LIB_ALIAS( const wxString& aName, LIB_COMPONENT* aComponent,
CMP_LIBRARY* lib = NULL ); CMP_LIBRARY* aLibrary = NULL );
LIB_ALIAS( LIB_ALIAS& alias, CMP_LIBRARY* lib = NULL ); LIB_ALIAS( LIB_ALIAS& aAlias, CMP_LIBRARY* aLibrary = NULL );
~LIB_ALIAS(); ~LIB_ALIAS();
virtual wxString GetClass() const virtual wxString GetClass() const
@ -492,15 +532,15 @@ public:
/** /**
* Get the alias root component. * Get the alias root component.
*/ */
LIB_COMPONENT* GetComponent( void ) const LIB_COMPONENT* GetComponent() const
{ {
return m_root; return root;
} }
/** /**
* Set the alias root component. * Set the alias root component.
*/ */
void SetComponent( LIB_COMPONENT* component ); void SetComponent( LIB_COMPONENT* aComponent );
}; };

File diff suppressed because it is too large Load Diff

View File

@ -61,15 +61,13 @@ class CMP_LIBRARY
{ {
public: public:
int m_Type; /* type indicator */ int m_Type; /* type indicator */
wxString m_Header; /* first line of loaded library. */ int m_Flags;
unsigned long m_TimeStamp; // Signature temporelle
int m_Flags; // variable used in some functions
public: public:
CMP_LIBRARY( int type, const wxFileName& fullname ); CMP_LIBRARY( int aType, const wxFileName& aFileName );
CMP_LIBRARY( int type, const wxString& fullname ) CMP_LIBRARY( int aType, const wxString& aFileName )
{ {
CMP_LIBRARY( type, wxFileName( fullname ) ); CMP_LIBRARY( aType, wxFileName( aFileName ) );
} }
~CMP_LIBRARY(); ~CMP_LIBRARY();
@ -86,12 +84,12 @@ public:
* component library already exists, it is backup up in file *.bak. * component library already exists, it is backup up in file *.bak.
* *
* @param aFullFileName - The library filename with path. * @param aFullFileName - The library filename with path.
* @param oldDocFormat - Save the document information in a separate * @param aOldDocFormat - Save the document information in a separate
* file if true. The default is to save as the * file if true. The default is to save as the
* current library file format. * current library file format.
* @return True if success writing else false. * @return True if success writing else false.
*/ */
bool Save( const wxString& aFullFileName, bool oldDocFormat = false ); bool Save( const wxString& aFullFileName, bool aOldDocFormat = false );
/** /**
* Save library document information to file. * Save library document information to file.
@ -102,25 +100,25 @@ public:
* @param aFullFileName - The library filename with path. * @param aFullFileName - The library filename with path.
* @return True if success writing else false. * @return True if success writing else false.
*/ */
bool SaveDocFile( const wxString& FullFileName ); bool SaveDocFile( const wxString& aFullFileName );
/** /**
* Load library from file. * Load library from file.
* *
* @param errMsg - Error message if load fails. * @param aErrorMsg - Error message if load fails.
* @return True if load was successful otherwise false. * @return True if load was successful otherwise false.
*/ */
bool Load( wxString& errMsg ); bool Load( wxString& aErrorMsg );
bool LoadDocs( wxString& errMsg ); bool LoadDocs( wxString& aErrorMsg );
private: private:
bool SaveHeader( FILE* file ); bool SaveHeader( FILE* aFile );
bool LoadHeader( FILE* file, int* LineNum ); bool LoadHeader( FILE* aFile, int* aLineNum );
void LoadAliases( LIB_COMPONENT* component ); void LoadAliases( LIB_COMPONENT* aComponent );
void RemoveEntry( const wxString& name ); void RemoveEntry( const wxString& aName );
public: public:
/** /**
@ -130,7 +128,7 @@ public:
*/ */
bool IsEmpty() const bool IsEmpty() const
{ {
return m_Entries.empty(); return entries.empty();
} }
/** /**
@ -140,29 +138,29 @@ public:
*/ */
int GetCount() const int GetCount() const
{ {
return m_Entries.size(); return entries.size();
} }
bool IsModified() const bool IsModified() const
{ {
return m_IsModified; return isModified;
} }
bool IsCache() const { return m_IsCache; } bool IsCache() const { return isCache; }
void SetModified( void ) { m_IsModified = true; } void SetModified( void ) { isModified = true; }
void SetCache( void ) { m_IsCache = true; } void SetCache( void ) { isCache = true; }
/** /**
* Load a string array with the names of all the entries in this library. * Load a string array with the names of all the entries in this library.
* *
* @param names - String array to place entry names into. * @param aNames - String array to place entry names into.
* @param sort - Sort names if true. * @param aSort - Sort names if true.
* @param makeUpperCase - Force entry names to upper case. * @param aMakeUpperCase - Force entry names to upper case.
*/ */
void GetEntryNames( wxArrayString& names, bool sort = true, void GetEntryNames( wxArrayString& aNames, bool aSort = true,
bool makeUpperCase = true ); bool aMakeUpperCase = true );
/** /**
* Load string array with entry names matching name and/or key word. * Load string array with entry names matching name and/or key word.
@ -171,72 +169,70 @@ public:
* WildCompareString(). The names array will be populated with the * WildCompareString(). The names array will be populated with the
* library entry names that meat the search criteria on exit. * library entry names that meat the search criteria on exit.
* *
* @param names - String array to place entry names into. * @param aNames - String array to place entry names into.
* @param nameSearch - Name wild card search criteria. * @param aNameSearch - Name wild card search criteria.
* @param keySearch - Key word search criteria. * @param aKeySearch - Key word search criteria.
* @param sort - Sort names if true. * @param aSort - Sort names if true.
*/ */
void SearchEntryNames( wxArrayString& names, void SearchEntryNames( wxArrayString& aNames,
const wxString& nameSearch = wxEmptyString, const wxString& aNameSearch = wxEmptyString,
const wxString& keySearch = wxEmptyString, const wxString& aKeySearch = wxEmptyString,
bool sort = true ); bool aSort = true );
/** /**
* Find components in library by key word regular expression search. * Find components in library by key word regular expression search.
* *
* @param names - String array to place found component names into. * @param aNames - String array to place found component names into.
* @param re - Regular expression used to seach component key words. * @param aRe - Regular expression used to seach component key words.
* @param sort - Sort component name list. * @param aSort - Sort component name list.
*/ */
void SearchEntryNames( wxArrayString& names, const wxRegEx& re, void SearchEntryNames( wxArrayString& aNames, const wxRegEx& aRe,
bool sort = true ); bool aSort = true );
/** /**
* Find entry by name. * Find entry by name.
* *
* @param name - Name of entry, case insensitive. * @param aName - Name of entry, case insensitive.
* @return Pointer to entry if found. NULL if not found. * @return Entry if found. NULL if not found.
*/ */
CMP_LIB_ENTRY* FindEntry( const wxChar* name ); CMP_LIB_ENTRY* FindEntry( const wxChar* aName );
/** /**
* Find entry by name and type. * Find entry by /a aName and /a aType.
* *
* @param name - Name of entry, case insensitive. * @param aName - Name of entry, case insensitive.
* @param type - Type of entry, root or alias. * @param aType - Type of entry, root or alias.
* @return Pointer to entry if found. NULL if not found. * @return Entry if found. NULL if not found.
*/ */
CMP_LIB_ENTRY* FindEntry( const wxChar* name, LibrEntryType type ); CMP_LIB_ENTRY* FindEntry( const wxChar* aName, LibrEntryType aType );
/** /**
* Find component by name. * Find component by /a aName.
* *
* This is a helper for FindEntry so casting a CMP_LIB_ENTRY pointer to * This is a helper for FindEntry so casting a CMP_LIB_ENTRY pointer to
* a LIB_COMPONENT pointer is not required. * a LIB_COMPONENT pointer is not required.
* *
* @param name - Name of component, case insensitive. * @param aName - Name of component, case insensitive.
* @param searchAliases - Searches for component by alias name as well as * @return Component if found. NULL if not found.
* component name if true.
* @return Pointer to component if found. NULL if not found.
*/ */
LIB_COMPONENT* FindComponent( const wxChar* name ); LIB_COMPONENT* FindComponent( const wxChar* aName );
/** /**
* Find alias by name. * Find alias by /a nName.
* *
* This is a helper for FindEntry so casting a CMP_LIB_ENTRY pointer to * This is a helper for FindEntry so casting a CMP_LIB_ENTRY pointer to
* a LIB_ALIAS pointer is not required. * a LIB_ALIAS pointer is not required.
* *
* @param name - Name of alias, case insensitive. * @param aName - Name of alias, case insensitive.
* @return Pointer to alias if found. NULL if not found. * @return Alias if found. NULL if not found.
*/ */
LIB_ALIAS* FindAlias( const wxChar* name ) LIB_ALIAS* FindAlias( const wxChar* aName )
{ {
return (LIB_ALIAS*) FindEntry( name, ALIAS ); return (LIB_ALIAS*) FindEntry( aName, ALIAS );
} }
/** /**
* Add a new alias entry to the library. * Add a new /a aAlias entry to the library.
* *
* First check if a component or alias with the same name already exists * First check if a component or alias with the same name already exists
* in the library and add alias if no conflict occurs. Once the alias * in the library and add alias if no conflict occurs. Once the alias
@ -244,21 +240,21 @@ public:
* alias pointer will render the library unstable. Use RemoveEntry to * alias pointer will render the library unstable. Use RemoveEntry to
* remove the alias from the library. * remove the alias from the library.
* *
* @param alias - Alias to add to library. * @param aAlias - Alias to add to library.
* @return True if alias added to library. False if conflict exists. * @return True if alias added to library. False if a conflict exists.
*/ */
bool AddAlias( LIB_ALIAS* alias ); bool AddAlias( LIB_ALIAS* aAlias );
/** /**
* Add component entry to library. * Add /a aComponent entry to library.
* *
* @param cmp - Component to add. * @param aComponent - Component to add.
* @return Pointer to added component if successful. * @return Added component if successful.
*/ */
LIB_COMPONENT* AddComponent( LIB_COMPONENT* cmp ); LIB_COMPONENT* AddComponent( LIB_COMPONENT* aComponent );
/** /**
* Remove an entry from the library. * Remove an /a aEntry from the library.
* *
* If the entry is an alias, the alias is removed from the library and from * If the entry is an alias, the alias is removed from the library and from
* the alias list of the root component. If the entry is a root component * the alias list of the root component. If the entry is a root component
@ -267,18 +263,18 @@ public:
* the first alias and the root name for all remaining aliases are updated * the first alias and the root name for all remaining aliases are updated
* to reflect the new root name. * to reflect the new root name.
* *
* @param entry - Entry to remove from library. * @param aEntry - Entry to remove from library.
*/ */
void RemoveEntry( CMP_LIB_ENTRY* entry ); void RemoveEntry( CMP_LIB_ENTRY* aEntry );
/** /**
* Replace an existing component entry in the library. * Replace an existing component entry in the library.
* *
* @param oldComponent - The component to replace. * @param aOldComponent - The component to replace.
* @param newComponent - The new component. * @param aNewComponent - The new component.
*/ */
LIB_COMPONENT* ReplaceComponent( LIB_COMPONENT* oldComponent, LIB_COMPONENT* ReplaceComponent( LIB_COMPONENT* aOldComponent,
LIB_COMPONENT* newComponent ); LIB_COMPONENT* aNewComponent );
/** /**
* Return the first entry in the library. * Return the first entry in the library.
@ -287,55 +283,55 @@ public:
*/ */
CMP_LIB_ENTRY* GetFirstEntry() CMP_LIB_ENTRY* GetFirstEntry()
{ {
return &m_Entries.front(); return &entries.front();
} }
/** /**
* Find next library entry by name. * Find next library entry by /a aName.
* *
* If the name of the entry is the last entry in the library, the first * If the name of the entry is the last entry in the library, the first
* entry in the list is returned. * entry in the list is returned.
* *
* @param name - Name of current entry. * @param aName - Name of current entry.
* @return Pointer to next entry if entry name is found. Otherwise NULL. * @return Next entry if entry name is found. Otherwise NULL.
*/ */
CMP_LIB_ENTRY* GetNextEntry( const wxChar* name ); CMP_LIB_ENTRY* GetNextEntry( const wxChar* aName );
/** /**
* Find previous library entry by name. * Find previous library entry by /a aName.
* *
* If the name of the entry is the first entry in the library, the last * If the name of the entry is the first entry in the library, the last
* entry in the list is returned. * entry in the list is returned.
* *
* @param name - Name of current entry. * @param aName - Name of current entry.
* @return Previous entry if entry name is found, otherwise NULL. * @return Previous entry if entry name is found, otherwise NULL.
*/ */
CMP_LIB_ENTRY* GetPreviousEntry( const wxChar* name ); CMP_LIB_ENTRY* GetPreviousEntry( const wxChar* aName );
/** /**
* Return the file name without path or extension. * Return the file name without path or extension.
* *
* @return Name of library file. * @return Name of library file.
*/ */
wxString GetName() const { return m_fileName.GetName(); } wxString GetName() const { return fileName.GetName(); }
/** /**
* Return the full file library name with path and extension. * Return the full file library name with path and extension.
* *
* @return Full library file name with path and extension. * @return Full library file name with path and extension.
*/ */
wxString GetFullFileName() { return m_fileName.GetFullPath(); } wxString GetFullFileName() { return fileName.GetFullPath(); }
/** /**
* Set the component library file name. * Set the component library file name.
* *
* @param fileName - New library file name. * @param aFileName - New library file name.
*/ */
void SetFileName( const wxFileName fileName ) void SetFileName( const wxFileName aFileName )
{ {
if( fileName != m_fileName ) if( aFileName != fileName )
m_fileName = fileName; fileName = aFileName;
} }
/* /*
@ -348,57 +344,57 @@ public:
/** /**
* Load a component library file. * Load a component library file.
* *
* @param fileName - File name of the component library to load. * @param aFileName - File name of the component library to load.
* @param errMsg - Error message if the component library failed to load. * @param aErrorMsg - Error message if the component library failed to load.
* @return Library object if library file loaded successfully, * @return Library object if library file loaded successfully,
* otherwise NULL. * otherwise NULL.
*/ */
static CMP_LIBRARY* LoadLibrary( const wxFileName& fileName, static CMP_LIBRARY* LoadLibrary( const wxFileName& aFileName,
wxString& errMsg ); wxString& aErrorMsg );
/** /**
* Add a compnent library to the library list. * Add a compnent library to the library list.
* *
* @param fileName - File name object of component library. * @param aFileName - File name object of component library.
* @param errMsg - Error message if the component library failed to load. * @param aErrorMsg - Error message if the component library failed to load.
* @return True if library loaded properly otherwise false. * @return True if library loaded properly otherwise false.
*/ */
static bool AddLibrary( const wxFileName& fileName, wxString& errMsg ); static bool AddLibrary( const wxFileName& aFileName, wxString& aErrorMsg );
/** /**
* Insert a compnent library to the library list. * Insert a compnent library to the library list.
* *
* @param fileName - File name object of component library. * @param aFileName - File name object of component library.
* @param errMsg - Error message if the component library failed to load. * @param aErrerMsg - Error message if the component library failed to load.
* @param i - Iterator to insert library in front of. * @param aIteratir - Iterator to insert library in front of.
* @return True if library loaded properly otherwise false. * @return True if library loaded properly otherwise false.
*/ */
static bool AddLibrary( const wxFileName& fileName, wxString& errMsg, static bool AddLibrary( const wxFileName& aFileName, wxString& aErrorMsg,
CMP_LIBRARY_LIST::iterator& i ); CMP_LIBRARY_LIST::iterator& aIterator );
/** /**
* Remove component library from the library list. * Remove component library from the library list.
* *
* @param name - Name of component library to remove. * @param aName - Name of component library to remove.
*/ */
static void RemoveLibrary( const wxString& name ); static void RemoveLibrary( const wxString& aName );
/** /**
* Find component library by name. * Find component library by /a aName.
* *
* @param name - Library file name without path or extension to find. * @param aName - Library file name without path or extension to find.
* @return Pointer to component library if found, otherwise NULL. * @return Component library if found, otherwise NULL.
*/ */
static CMP_LIBRARY* FindLibrary( const wxString& name ); static CMP_LIBRARY* FindLibrary( const wxString& aName );
/** /**
* Get the list of component library file names without path and extension. * Get the list of component library file names without path and extension.
* *
* @param sorted - Sort the list of name if true. Otherwise use the * @param aSorted - Sort the list of name if true. Otherwise use the
* library load order. * library load order.
* @return The list of library names. * @return The list of library names.
*/ */
static wxArrayString GetLibraryNames( bool sorted = true ); static wxArrayString GetLibraryNames( bool aSorted = true );
/** /**
* Search all libraries in the list for a component. * Search all libraries in the list for a component.
@ -406,60 +402,60 @@ public:
* A component object will always be returned. If the entry found * A component object will always be returned. If the entry found
* is an alias. The root component will be found and returned. * is an alias. The root component will be found and returned.
* *
* @param name - Name of component to search for. * @param aCompoentName - Name of component to search for.
* @param libNaem - Name of the library to search for component. * @param aLibraryName - Name of the library to search for component.
* @return The component object if found, otherwise NULL. * @return The component object if found, otherwise NULL.
*/ */
static LIB_COMPONENT* FindLibraryComponent( static LIB_COMPONENT* FindLibraryComponent( const wxString& aComponentName,
const wxString& name, const wxString& libName = wxEmptyString ); const wxString& aLibraryName = wxEmptyString );
/** /**
* Search all libraries in the list for an entry. * Search all libraries in the list for an entry.
* *
* The object can be either a component or an alias. * The object can be either a component or an alias.
* *
* @param name - Name of component to search for. * @param aEntryName - Name of entry to search for.
* @param libNaem - Name of the library to search for entry. * @param aLibraryName - Name of the library to search.
* @return The entry object if found, otherwise NULL. * @return The entry object if found, otherwise NULL.
*/ */
static CMP_LIB_ENTRY* FindLibraryEntry( static CMP_LIB_ENTRY* FindLibraryEntry( const wxString& aEntryName,
const wxString& name, const wxString& aLibraryName = wxEmptyString );
const wxString& libName = wxEmptyString );
/** /**
* Remove all cache libraries from library list. * Remove all cache libraries from library list.
*/ */
static void RemoveCacheLibrary( void ); static void RemoveCacheLibrary();
static int GetLibraryCount( void ) { return m_LibraryList.size(); } static int GetLibraryCount() { return libraryList.size(); }
static CMP_LIBRARY_LIST& GetLibraryList( void ) static CMP_LIBRARY_LIST& GetLibraryList()
{ {
return m_LibraryList; return libraryList;
} }
static void SetSortOrder( const wxArrayString& sortOrder ) static void SetSortOrder( const wxArrayString& aSortOrder )
{ {
m_LibraryListSortOrder = sortOrder; libraryListSortOrder = aSortOrder;
} }
static wxArrayString& GetSortOrder( void ) static wxArrayString& GetSortOrder( void )
{ {
return m_LibraryListSortOrder; return libraryListSortOrder;
} }
protected: protected:
wxFileName m_fileName; /* Library file name. */ wxFileName fileName; /* Library file name. */
wxDateTime m_DateTime; /* Library save time and date. */ wxDateTime timeStamp; /* Library save time and date. */
int m_verMajor; /* Library major version number. */ int versionMajor; /* Library major version number. */
int m_verMinor; /* Library minor version number. */ int versionMinor; /* Library minor version number. */
LIB_ENTRY_LIST m_Entries; /* Parts themselves are saved here. */ LIB_ENTRY_LIST entries; /* Parts themselves are saved here. */
bool m_IsModified; /* Library modification status. */ bool isModified; /* Library modification status. */
bool m_IsCache; /* False for the "standard" libraries, bool isCache; /* False for the "standard" libraries,
* True for the library cache */ * True for the library cache */
wxString header; /* first line of loaded library. */
static CMP_LIBRARY_LIST m_LibraryList; static CMP_LIBRARY_LIST libraryList;
static wxArrayString m_LibraryListSortOrder; static wxArrayString libraryListSortOrder;
friend class CMP_LIB_ENTRY; friend class CMP_LIB_ENTRY;
}; };
@ -468,7 +464,7 @@ protected:
/** /**
* Case insensitive library name comparison. * Case insensitive library name comparison.
*/ */
extern bool operator==( const CMP_LIBRARY& lib, const wxChar* name ); extern bool operator==( const CMP_LIBRARY& aLibrary, const wxChar* aName );
extern bool operator!=( const CMP_LIBRARY& lib, const wxChar* name ); extern bool operator!=( const CMP_LIBRARY& aLibrary, const wxChar* aName );
#endif // CLASS_LIBRARY_H #endif // CLASS_LIBRARY_H

View File

@ -525,7 +525,7 @@ LIB_PIN* SCH_COMPONENT::GetPin( const wxString& number )
if( Entry == NULL ) if( Entry == NULL )
return NULL; return NULL;
wxASSERT( Entry->Type == ROOT ); wxASSERT( Entry->isComponent() );
return Entry->GetPin( number, m_Multi, m_Convert ); return Entry->GetPin( number, m_Multi, m_Convert );
} }
@ -1099,7 +1099,7 @@ void SCH_COMPONENT::DisplayInfo( WinEDA_DrawFrame* frame )
GetRef(((WinEDA_SchematicFrame*)frame)->GetSheet()), GetRef(((WinEDA_SchematicFrame*)frame)->GetSheet()),
DARKCYAN ); DARKCYAN );
if( Entry->m_Options == ENTRY_POWER ) if( Entry->isPower() )
msg = _( "Power symbol" ); msg = _( "Power symbol" );
else else
msg = _( "Name" ); msg = _( "Name" );
@ -1110,8 +1110,8 @@ void SCH_COMPONENT::DisplayInfo( WinEDA_DrawFrame* frame )
msg = Entry->GetLibraryName(); msg = Entry->GetLibraryName();
frame->AppendMsgPanel( _( "Library" ), msg, DARKRED ); frame->AppendMsgPanel( _( "Library" ), msg, DARKRED );
frame->AppendMsgPanel( _( "Description" ), Entry->m_Doc, DARKCYAN ); frame->AppendMsgPanel( _( "Description" ), Entry->GetDescription(), DARKCYAN );
frame->AppendMsgPanel( _( "Key words" ), Entry->m_KeyWord, DARKCYAN ); frame->AppendMsgPanel( _( "Key words" ), Entry->GetKeyWords(), DARKCYAN );
} }
/** virtual function Mirror_Y /** virtual function Mirror_Y

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -82,9 +82,9 @@ void DisplayCmpDoc( wxString& Name )
return; return;
wxLogDebug( wxT( "Selected component <%s>, m_Doc: <%s>, m_KeyWord: <%s>." ), wxLogDebug( wxT( "Selected component <%s>, m_Doc: <%s>, m_KeyWord: <%s>." ),
GetChars( Name ), GetChars( CmpEntry->m_Doc ), GetChars( Name ), GetChars( CmpEntry->GetDescription() ),
GetChars( CmpEntry->m_KeyWord ) ); GetChars( CmpEntry->GetKeyWords() ) );
Name = wxT( "Description: " ) + CmpEntry->m_Doc; Name = wxT( "Description: " ) + CmpEntry->GetDescription();
Name += wxT( "\nKey Words: " ) + CmpEntry->m_KeyWord; Name += wxT( "\nKey Words: " ) + CmpEntry->GetKeyWords();
} }

View File

@ -114,10 +114,10 @@ void WinEDA_CreateCmpDialog::SetComponentData( LIB_COMPONENT & component )
else else
component.m_TextInside = m_SetSkew->GetValue(); component.m_TextInside = m_SetSkew->GetValue();
if ( m_IsPowerSymbol->GetValue() == TRUE) if ( m_IsPowerSymbol->GetValue() == TRUE )
component.m_Options = ENTRY_POWER; component.SetPower();
else else
component.m_Options = ENTRY_NORMAL; component.SetNormal();
/* Set the option "Units locked". /* Set the option "Units locked".
Obviously, cannot be TRUE if there is only one part */ Obviously, cannot be TRUE if there is only one part */

View File

@ -267,7 +267,7 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnOKButtonClick( wxCommandEvent& event
LIB_COMPONENT* entry = LIB_COMPONENT* entry =
CMP_LIBRARY::FindLibraryComponent( m_Cmp->m_ChipName ); CMP_LIBRARY::FindLibraryComponent( m_Cmp->m_ChipName );
if( entry && entry->m_Options == ENTRY_POWER ) if( entry && entry->isPower() )
m_FieldsBuf[VALUE].m_Text = m_Cmp->m_ChipName; m_FieldsBuf[VALUE].m_Text = m_Cmp->m_ChipName;
// copy all the fields back, and change the length of m_Fields. // copy all the fields back, and change the length of m_Fields.
@ -527,7 +527,7 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copySelectedFieldToPanel()
// For power symbols, the value is NOR editable, because value and pin // For power symbols, the value is NOR editable, because value and pin
// name must be same 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->isPower() )
fieldValueTextCtrl->Enable( false ); fieldValueTextCtrl->Enable( false );
else else
fieldValueTextCtrl->Enable( true ); fieldValueTextCtrl->Enable( true );

View File

@ -0,0 +1,7 @@
#include "dialog_sch_sheet_props.h"
DIALOG_SCH_SHEET_PROPS::DIALOG_SCH_SHEET_PROPS( wxWindow* parent ) :
DIALOG_SCH_SHEET_PROPS_BASE( parent )
{
m_textFileName->SetFocus();
}

View File

@ -0,0 +1,681 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<wxFormBuilder_Project>
<FileVersion major="1" minor="9" />
<object class="Project" expanded="1">
<property name="class_decoration"></property>
<property name="code_generation">C++</property>
<property name="disconnect_events">1</property>
<property name="encoding">UTF-8</property>
<property name="event_generation">table</property>
<property name="file">dialog_sch_sheet_props_base</property>
<property name="first_id">1000</property>
<property name="help_provider">none</property>
<property name="internationalize">1</property>
<property name="name">dialog_sch_sheet_props</property>
<property name="namespace"></property>
<property name="path">.</property>
<property name="precompiled_header"></property>
<property name="relative_path">1</property>
<property name="use_enum">1</property>
<property name="use_microsoft_bom">0</property>
<object class="Dialog" expanded="1">
<property name="bg"></property>
<property name="center">wxBOTH</property>
<property name="context_help"></property>
<property name="enabled">1</property>
<property name="extra_style"></property>
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="name">DIALOG_SCH_SHEET_PROPS_BASE</property>
<property name="pos"></property>
<property name="size"></property>
<property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>
<property name="subclass"></property>
<property name="title">Schematic Sheet Properties</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnActivate"></event>
<event name="OnActivateApp"></event>
<event name="OnChar"></event>
<event name="OnClose"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnHibernate"></event>
<event name="OnIconize"></event>
<event name="OnIdle"></event>
<event name="OnInitDialog"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">mainSizer</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">12</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxFlexGridSizer" expanded="1">
<property name="cols">6</property>
<property name="flexible_direction">wxBOTH</property>
<property name="growablecols">1</property>
<property name="growablerows"></property>
<property name="hgap">0</property>
<property name="minimum_size"></property>
<property name="name">fgSizer1</property>
<property name="non_flexible_grow_mode">wxFLEX_GROWMODE_SPECIFIED</property>
<property name="permission">none</property>
<property name="rows">2</property>
<property name="vgap">0</property>
<object class="sizeritem" expanded="1">
<property name="border">3</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALL</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="bg"></property>
<property name="context_help"></property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">&amp;File name:</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="name">m_staticText1</property>
<property name="permission">protected</property>
<property name="pos"></property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">3</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND</property>
<property name="proportion">5</property>
<object class="wxTextCtrl" expanded="1">
<property name="bg"></property>
<property name="context_help"></property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="maximum_size"></property>
<property name="maxlength">0</property>
<property name="minimum_size"></property>
<property name="name">m_textFileName</property>
<property name="permission">protected</property>
<property name="pos"></property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="tooltip"></property>
<property name="value"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnText"></event>
<event name="OnTextEnter"></event>
<event name="OnTextMaxLen"></event>
<event name="OnTextURL"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">3</property>
<property name="flag">wxALIGN_CENTER_HORIZONTAL|wxALL</property>
<property name="proportion">1</property>
<object class="spacer" expanded="1">
<property name="height">0</property>
<property name="permission">protected</property>
<property name="width">0</property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">3</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALL</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="bg"></property>
<property name="context_help"></property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Te&amp;xt size:</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="name">m_staticText2</property>
<property name="permission">protected</property>
<property name="pos"></property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">3</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALL</property>
<property name="proportion">0</property>
<object class="wxTextCtrl" expanded="1">
<property name="bg"></property>
<property name="context_help"></property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="maximum_size"></property>
<property name="maxlength">0</property>
<property name="minimum_size"></property>
<property name="name">m_textFileNameSize</property>
<property name="permission">protected</property>
<property name="pos"></property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="tooltip"></property>
<property name="value"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnText"></event>
<event name="OnTextEnter"></event>
<event name="OnTextMaxLen"></event>
<event name="OnTextURL"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">3</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALL</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="bg"></property>
<property name="context_help"></property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">units</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="name">m_staticFileNameSizeUnits</property>
<property name="permission">protected</property>
<property name="pos"></property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">3</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALL</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="bg"></property>
<property name="context_help"></property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">&amp;Sheet name:</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="name">m_staticText4</property>
<property name="permission">protected</property>
<property name="pos"></property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">3</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND</property>
<property name="proportion">5</property>
<object class="wxTextCtrl" expanded="1">
<property name="bg"></property>
<property name="context_help"></property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="maximum_size"></property>
<property name="maxlength">0</property>
<property name="minimum_size"></property>
<property name="name">m_textSheetName</property>
<property name="permission">protected</property>
<property name="pos"></property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="tooltip"></property>
<property name="value"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnText"></event>
<event name="OnTextEnter"></event>
<event name="OnTextMaxLen"></event>
<event name="OnTextURL"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">3</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALL</property>
<property name="proportion">1</property>
<object class="spacer" expanded="1">
<property name="height">0</property>
<property name="permission">protected</property>
<property name="width">0</property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">3</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALL</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="bg"></property>
<property name="context_help"></property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">&amp;Text size:</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="name">m_staticText5</property>
<property name="permission">protected</property>
<property name="pos"></property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">3</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALL</property>
<property name="proportion">0</property>
<object class="wxTextCtrl" expanded="1">
<property name="bg"></property>
<property name="context_help"></property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="maximum_size"></property>
<property name="maxlength">0</property>
<property name="minimum_size"></property>
<property name="name">m_textSheetNameSize</property>
<property name="permission">protected</property>
<property name="pos"></property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="tooltip"></property>
<property name="value"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnText"></event>
<event name="OnTextEnter"></event>
<event name="OnTextMaxLen"></event>
<event name="OnTextURL"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">3</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALL</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="bg"></property>
<property name="context_help"></property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">units</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="name">m_staticSheetNameSizeUnits</property>
<property name="permission">protected</property>
<property name="pos"></property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">0</property>
<object class="spacer" expanded="1">
<property name="height">0</property>
<property name="permission">protected</property>
<property name="width">0</property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">12</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxStdDialogButtonSizer" expanded="1">
<property name="Apply">0</property>
<property name="Cancel">1</property>
<property name="ContextHelp">0</property>
<property name="Help">0</property>
<property name="No">0</property>
<property name="OK">1</property>
<property name="Save">0</property>
<property name="Yes">0</property>
<property name="minimum_size"></property>
<property name="name">m_sdbSizer1</property>
<property name="permission">protected</property>
<event name="OnApplyButtonClick"></event>
<event name="OnCancelButtonClick"></event>
<event name="OnContextHelpButtonClick"></event>
<event name="OnHelpButtonClick"></event>
<event name="OnNoButtonClick"></event>
<event name="OnOKButtonClick"></event>
<event name="OnSaveButtonClick"></event>
<event name="OnYesButtonClick"></event>
</object>
</object>
</object>
</object>
</object>
</wxFormBuilder_Project>

View File

@ -0,0 +1,53 @@
#ifndef __dialog_sch_sheet_props__
#define __dialog_sch_sheet_props__
/**
* @file
* Subclass of DIALOG_SCH_SHEET_PROPS_BASE, which is generated by wxFormBuilder.
*/
#include "dialog_sch_sheet_props_base.h"
/** Implementing DIALOG_SCH_SHEET_PROPS_BASE */
class DIALOG_SCH_SHEET_PROPS : public DIALOG_SCH_SHEET_PROPS_BASE
{
public:
/** Constructor */
DIALOG_SCH_SHEET_PROPS( wxWindow* parent );
void SetFileName( const wxString& aFileName )
{
m_textFileName->SetValue( aFileName );
}
wxString GetFileName() { return m_textFileName->GetValue(); }
void SetSheetName( const wxString& aSheetName )
{
m_textSheetName->SetValue( aSheetName );
}
wxString GetSheetName() { return m_textSheetName->GetValue(); }
void SetFileNameTextSize( const wxString& aTextSize )
{
m_textFileNameSize->SetValue( aTextSize );
}
wxString GetFileNameTextSize() { return m_textFileNameSize->GetValue(); }
void SetSheetNameTextSize( const wxString& aTextSize )
{
m_textSheetNameSize->SetValue( aTextSize );
}
wxString GetSheetNameTextSize() { return m_textSheetNameSize->GetValue(); }
void SetFileNameTextSizeUnits(const wxString& aUnits)
{
m_staticFileNameSizeUnits->SetLabel( aUnits );
}
void SetSheetNameTextSizeUnits(const wxString& aUnits)
{
m_staticSheetNameSizeUnits->SetLabel( aUnits );
}
};
#endif // __dialog_sch_sheet_props__

View File

@ -0,0 +1,89 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 16 2008)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "dialog_sch_sheet_props_base.h"
///////////////////////////////////////////////////////////////////////////
DIALOG_SCH_SHEET_PROPS_BASE::DIALOG_SCH_SHEET_PROPS_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
wxBoxSizer* mainSizer;
mainSizer = new wxBoxSizer( wxVERTICAL );
wxFlexGridSizer* fgSizer1;
fgSizer1 = new wxFlexGridSizer( 2, 6, 0, 0 );
fgSizer1->AddGrowableCol( 1 );
fgSizer1->SetFlexibleDirection( wxBOTH );
fgSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_staticText1 = new wxStaticText( this, wxID_ANY, _("&File name:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText1->Wrap( -1 );
fgSizer1->Add( m_staticText1, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
m_textFileName = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizer1->Add( m_textFileName, 5, wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND, 3 );
fgSizer1->Add( 0, 0, 1, wxALIGN_CENTER_HORIZONTAL|wxALL|wxEXPAND, 3 );
m_staticText2 = new wxStaticText( this, wxID_ANY, _("Te&xt size:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText2->Wrap( -1 );
fgSizer1->Add( m_staticText2, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
m_textFileNameSize = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizer1->Add( m_textFileNameSize, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
m_staticFileNameSizeUnits = new wxStaticText( this, wxID_ANY, _("units"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticFileNameSizeUnits->Wrap( -1 );
fgSizer1->Add( m_staticFileNameSizeUnits, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
m_staticText4 = new wxStaticText( this, wxID_ANY, _("&Sheet name:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText4->Wrap( -1 );
fgSizer1->Add( m_staticText4, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
m_textSheetName = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizer1->Add( m_textSheetName, 5, wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND, 3 );
fgSizer1->Add( 0, 0, 1, wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND, 3 );
m_staticText5 = new wxStaticText( this, wxID_ANY, _("&Text size:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText5->Wrap( -1 );
fgSizer1->Add( m_staticText5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
m_textSheetNameSize = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizer1->Add( m_textSheetNameSize, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
m_staticSheetNameSizeUnits = new wxStaticText( this, wxID_ANY, _("units"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticSheetNameSizeUnits->Wrap( -1 );
fgSizer1->Add( m_staticSheetNameSizeUnits, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
mainSizer->Add( fgSizer1, 1, wxALL|wxEXPAND, 12 );
mainSizer->Add( 0, 0, 0, wxALL|wxEXPAND, 5 );
m_sdbSizer1 = new wxStdDialogButtonSizer();
m_sdbSizer1OK = new wxButton( this, wxID_OK );
m_sdbSizer1->AddButton( m_sdbSizer1OK );
m_sdbSizer1Cancel = new wxButton( this, wxID_CANCEL );
m_sdbSizer1->AddButton( m_sdbSizer1Cancel );
m_sdbSizer1->Realize();
mainSizer->Add( m_sdbSizer1, 0, wxALL|wxEXPAND, 12 );
this->SetSizer( mainSizer );
this->Layout();
mainSizer->Fit( this );
this->Centre( wxBOTH );
}
DIALOG_SCH_SHEET_PROPS_BASE::~DIALOG_SCH_SHEET_PROPS_BASE()
{
}

View File

@ -0,0 +1,57 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 16 2008)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __dialog_sch_sheet_props_base__
#define __dialog_sch_sheet_props_base__
#include <wx/intl.h>
#include <wx/string.h>
#include <wx/stattext.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/textctrl.h>
#include <wx/sizer.h>
#include <wx/button.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_SCH_SHEET_PROPS_BASE
///////////////////////////////////////////////////////////////////////////////
class DIALOG_SCH_SHEET_PROPS_BASE : public wxDialog
{
private:
protected:
wxStaticText* m_staticText1;
wxTextCtrl* m_textFileName;
wxStaticText* m_staticText2;
wxTextCtrl* m_textFileNameSize;
wxStaticText* m_staticFileNameSizeUnits;
wxStaticText* m_staticText4;
wxTextCtrl* m_textSheetName;
wxStaticText* m_staticText5;
wxTextCtrl* m_textSheetNameSize;
wxStaticText* m_staticSheetNameSizeUnits;
wxStdDialogButtonSizer* m_sdbSizer1;
wxButton* m_sdbSizer1OK;
wxButton* m_sdbSizer1Cancel;
public:
DIALOG_SCH_SHEET_PROPS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Schematic Sheet Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_SCH_SHEET_PROPS_BASE();
};
#endif //__dialog_sch_sheet_props_base__

View File

@ -75,9 +75,9 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::InitPanelDoc()
return; return;
} }
m_Doc->SetValue( entry->m_Doc ); m_Doc->SetValue( entry->GetDescription() );
m_Keywords->SetValue( entry->m_KeyWord ); m_Keywords->SetValue( entry->GetKeyWords() );
m_Docfile->SetValue( entry->m_DocFile ); m_Docfile->SetValue( entry->GetDocFileName() );
} }
@ -109,7 +109,7 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::InitBasicPanel()
m_PinsNameInsideButt->SetValue( component->m_TextInside != 0 ); m_PinsNameInsideButt->SetValue( component->m_TextInside != 0 );
m_SelNumberOfUnits->SetValue( component->GetPartCount() ); m_SelNumberOfUnits->SetValue( component->GetPartCount() );
m_SetSkew->SetValue( component->m_TextInside ); m_SetSkew->SetValue( component->m_TextInside );
m_OptionPower->SetValue( component->m_Options == ENTRY_POWER ); m_OptionPower->SetValue( component->isPower() );
m_OptionPartsLocked->SetValue( component->m_UnitSelectionLocked ); m_OptionPartsLocked->SetValue( component->m_UnitSelectionLocked );
} }
@ -152,9 +152,9 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnOkClick( wxCommandEvent& event )
} }
else else
{ {
entry->m_Doc = m_Doc->GetValue(); entry->SetDescription( m_Doc->GetValue() );
entry->m_KeyWord = m_Keywords->GetValue(); entry->SetKeyWords( m_Keywords->GetValue() );
entry->m_DocFile = m_Docfile->GetValue(); entry->SetDocFileName( m_Docfile->GetValue() );
} }
if( m_PartAliasList->GetStrings() != component->m_AliasList ) if( m_PartAliasList->GetStrings() != component->m_AliasList )
@ -230,9 +230,9 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnOkClick( wxCommandEvent& event )
} }
if( m_OptionPower->GetValue() == true ) if( m_OptionPower->GetValue() == true )
component->m_Options = ENTRY_POWER; component->SetPower();
else else
component->m_Options = ENTRY_NORMAL; component->SetNormal();
/* Set the option "Units locked". /* Set the option "Units locked".
* Obviously, cannot be true if there is only one part */ * Obviously, cannot be true if there is only one part */
@ -257,9 +257,9 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::CopyDocToAlias( wxCommandEvent& WXUNUSED
if( component == NULL || m_Parent->GetAliasName().IsEmpty() ) if( component == NULL || m_Parent->GetAliasName().IsEmpty() )
return; return;
m_Doc->SetValue( component->m_Doc ); m_Doc->SetValue( component->GetDescription() );
m_Docfile->SetValue( component->m_DocFile ); m_Docfile->SetValue( component->GetDocFileName() );
m_Keywords->SetValue( component->m_KeyWord ); m_Keywords->SetValue( component->GetKeyWords() );
} }

View File

@ -102,7 +102,7 @@ void WinEDA_SchematicFrame::EditCmpFieldText( SCH_FIELD* Field, wxDC* DC )
{ {
Entry = CMP_LIBRARY::FindLibraryComponent( Cmp->m_ChipName ); Entry = CMP_LIBRARY::FindLibraryComponent( Cmp->m_ChipName );
if( Entry && (Entry->m_Options == ENTRY_POWER) ) if( Entry && Entry->isPower() )
{ {
DisplayInfoMessage( this, _( "Part is a POWER, value cannot be \ DisplayInfoMessage( this, _( "Part is a POWER, value cannot be \
modified!\nYou must create a new power" ) ); modified!\nYou must create a new power" ) );

View File

@ -138,12 +138,12 @@ bool WinEDA_LibeditFrame::LoadOneLibraryPartAux( CMP_LIB_ENTRY* LibEntry,
cmpName = LibEntry->GetName(); cmpName = LibEntry->GetName();
m_aliasName.Empty(); m_aliasName.Empty();
if( LibEntry->Type != ROOT ) if( LibEntry->isAlias() )
{ {
LIB_ALIAS* alias = (LIB_ALIAS*) LibEntry; LIB_ALIAS* alias = (LIB_ALIAS*) LibEntry;
component = alias->GetComponent(); component = alias->GetComponent();
wxASSERT( component != NULL && component->Type == ROOT ); wxASSERT( component != NULL && component->isComponent() );
wxLogDebug( wxT( "\"<%s>\" is alias of \"<%s>\"" ), wxLogDebug( wxT( "\"<%s>\" is alias of \"<%s>\"" ),
GetChars( cmpName ), GetChars( cmpName ),
@ -326,7 +326,7 @@ void WinEDA_LibeditFrame::DisplayCmpDoc()
AppendMsgPanel( _( "Body" ), msg, GREEN, 8 ); AppendMsgPanel( _( "Body" ), msg, GREEN, 8 );
if( m_component->m_Options == ENTRY_POWER ) if( m_component->isPower() )
msg = _( "Power Symbol" ); msg = _( "Power Symbol" );
else else
msg = _( "Component" ); msg = _( "Component" );
@ -334,16 +334,16 @@ void WinEDA_LibeditFrame::DisplayCmpDoc()
AppendMsgPanel( _( "Type" ), msg, MAGENTA, 8 ); AppendMsgPanel( _( "Type" ), msg, MAGENTA, 8 );
if( alias != NULL ) if( alias != NULL )
msg = alias->m_Doc; msg = alias->GetDescription();
else else
msg = m_component->m_Doc; msg = m_component->GetDescription();
AppendMsgPanel( _( "Description" ), msg, CYAN, 8 ); AppendMsgPanel( _( "Description" ), msg, CYAN, 8 );
if( alias != NULL ) if( alias != NULL )
msg = alias->m_KeyWord; msg = alias->GetKeyWords();
else else
msg = m_component->m_KeyWord; msg = m_component->GetKeyWords();
AppendMsgPanel( _( "Key words" ), msg, DARKDARKGRAY ); AppendMsgPanel( _( "Key words" ), msg, DARKDARKGRAY );
} }
@ -542,8 +542,11 @@ created. Aborted" ) );
component->m_TextInside = 1; component->m_TextInside = 1;
} }
else else
{
component->m_TextInside = 0; component->m_TextInside = 0;
component->m_Options = ( dlg.GetPowerSymbol() ) ? ENTRY_POWER : ENTRY_NORMAL; }
( dlg.GetPowerSymbol() ) ? component->SetPower() : component->SetNormal();
component->m_DrawPinNum = dlg.GetShowPinNumber(); component->m_DrawPinNum = dlg.GetShowPinNumber();
component->m_DrawPinName = dlg.GetShowPinName(); component->m_DrawPinName = dlg.GetShowPinName();
component->m_UnitSelectionLocked = dlg.GetLockItems(); component->m_UnitSelectionLocked = dlg.GetLockItems();
@ -612,7 +615,7 @@ void WinEDA_LibeditFrame::SaveOnePartInMemory()
m_drawItem = m_lastDrawItem = NULL; m_drawItem = m_lastDrawItem = NULL;
wxASSERT( m_component->Type == ROOT ); wxASSERT( m_component->isComponent() );
if( oldComponent != NULL ) if( oldComponent != NULL )
Component = m_library->ReplaceComponent( oldComponent, m_component ); Component = m_library->ReplaceComponent( oldComponent, m_component );

View File

@ -457,9 +457,9 @@ void WinEDA_LibeditFrame::OnUpdateViewDoc( wxUpdateUIEvent& event )
CMP_LIB_ENTRY* entry = m_library->FindEntry( m_aliasName ); CMP_LIB_ENTRY* entry = m_library->FindEntry( m_aliasName );
if( entry != NULL ) if( entry != NULL )
enable = !entry->m_DocFile.IsEmpty(); enable = !entry->GetDocFileName().IsEmpty();
} }
else if( !m_component->m_DocFile.IsEmpty() ) else if( !m_component->GetDocFileName().IsEmpty() )
{ {
enable = true; enable = true;
} }
@ -572,11 +572,11 @@ void WinEDA_LibeditFrame::OnViewEntryDoc( wxCommandEvent& event )
m_library->FindEntry( m_aliasName ); m_library->FindEntry( m_aliasName );
if( entry != NULL ) if( entry != NULL )
fileName = entry->m_DocFile; fileName = entry->GetDocFileName();
} }
else else
{ {
fileName = m_component->m_DocFile; fileName = m_component->GetDocFileName();
} }
if( !fileName.IsEmpty() ) if( !fileName.IsEmpty() )

View File

@ -255,7 +255,7 @@ void AddMenusForComponent( wxMenu* PopMenu, SCH_COMPONENT* Component )
if( libEntry ) if( libEntry )
{ {
if( libEntry->Type == ALIAS ) if( libEntry->isAlias() )
libComponent = ( (LIB_ALIAS*) libEntry )->GetComponent(); libComponent = ( (LIB_ALIAS*) libEntry )->GetComponent();
else else
libComponent = (LIB_COMPONENT*) libEntry; libComponent = (LIB_COMPONENT*) libEntry;
@ -300,7 +300,7 @@ void AddMenusForComponent( wxMenu* PopMenu, SCH_COMPONENT* Component )
ADD_MENUITEM( editmenu, ID_POPUP_SCH_EDIT_CMP, msg, ADD_MENUITEM( editmenu, ID_POPUP_SCH_EDIT_CMP, msg,
edit_component_xpm ); edit_component_xpm );
if( libEntry && libEntry->m_Options != ENTRY_POWER ) if( libEntry && libEntry->isNormal() )
{ {
msg = AddHotkeyName( _( "Value " ), s_Schematic_Hokeys_Descr, msg = AddHotkeyName( _( "Value " ), s_Schematic_Hokeys_Descr,
HK_EDIT_COMPONENT_VALUE ); HK_EDIT_COMPONENT_VALUE );
@ -348,7 +348,7 @@ void AddMenusForComponent( wxMenu* PopMenu, SCH_COMPONENT* Component )
_( "Delete Component" ), delete_xpm ); _( "Delete Component" ), delete_xpm );
} }
if( libEntry && !libEntry->m_DocFile.IsEmpty() ) if( libEntry && !libEntry->GetDocFileName().IsEmpty() )
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DISPLAYDOC_CMP, _( "Doc" ), ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DISPLAYDOC_CMP, _( "Doc" ),
datasheet_xpm ); datasheet_xpm );
} }

View File

@ -379,7 +379,8 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
break; break;
case ID_POPUP_SCH_EDIT_SHEET: case ID_POPUP_SCH_EDIT_SHEET:
EditSheet( (SCH_SHEET*) screen->GetCurItem(), &dc ); if( EditSheet( (SCH_SHEET*) screen->GetCurItem(), &dc ) )
screen->SetModify();
break; break;
case ID_POPUP_IMPORT_GLABEL: case ID_POPUP_IMPORT_GLABEL:
@ -645,10 +646,10 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
LibEntry = CMP_LIBRARY::FindLibraryEntry( LibEntry = CMP_LIBRARY::FindLibraryEntry(
( (SCH_COMPONENT*) screen->GetCurItem() )->m_ChipName ); ( (SCH_COMPONENT*) screen->GetCurItem() )->m_ChipName );
if( LibEntry && LibEntry->m_DocFile != wxEmptyString ) if( LibEntry && LibEntry->GetDocFileName() != wxEmptyString )
{ {
GetAssociatedDocument( this, LibEntry->m_DocFile , GetAssociatedDocument( this, LibEntry->GetDocFileName(),
& wxGetApp().GetLibraryPathList() ); &wxGetApp().GetLibraryPathList() );
} }
} }
break; break;

View File

@ -69,6 +69,9 @@ int DisplayComponentsNamesInLib( WinEDA_DrawFrame* frame,
ListNames = (const wxChar**) MyZMalloc( ( nameList.GetCount() + 1 ) * ListNames = (const wxChar**) MyZMalloc( ( nameList.GetCount() + 1 ) *
sizeof( wxChar* ) ); sizeof( wxChar* ) );
if( ListNames == NULL )
return 0;
for( i = 0; i < nameList.GetCount(); i++ ) for( i = 0; i < nameList.GetCount(); i++ )
ListNames[i] = (const wxChar*) nameList[i]; ListNames[i] = (const wxChar*) nameList[i];

View File

@ -1,24 +1,14 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// Name: sheet.cpp // Name: sheet.cpp
// Purpose: // Purpose:
// Author: jean-pierre Charras // Author: jean-pierre Charras
// Modified by: // Modified by: Wayne Stambaugh
// Created: 08/02/2006 18:37:02 // Created: 08/02/2006 18:37:02
// RCS-ID: // RCS-ID:
// Copyright: License GNU // Copyright: License GNU
// License: // License:
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// Generated by DialogBlocks (unregistered), 08/02/2006 18:37:02
#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
#pragma implementation "sheet.h"
#endif
////@begin includes
////@end includes
#include "fctsys.h" #include "fctsys.h"
#include "gr_basic.h" #include "gr_basic.h"
#include "common.h" #include "common.h"
@ -30,407 +20,240 @@
#include "general.h" #include "general.h"
#include "protos.h" #include "protos.h"
#include "dialog_sch_sheet_props.h"
static void ExitSheet( WinEDA_DrawPanel* Panel, wxDC* DC );
static void DeplaceSheet( WinEDA_DrawPanel* panel, wxDC* DC, bool erase );
static int s_SheetMindx, s_SheetMindy; static int s_PreviousSheetWidth;
static int s_PreviousSheetHeight;
static wxPoint s_OldPos; /* Former position for cancellation or move ReSize */ static wxPoint s_OldPos; /* Former position for cancellation or move ReSize */
#include "sheet.h" /* Routine to edit the SheetName and the FileName for the sheet "Sheet" */
bool WinEDA_SchematicFrame::EditSheet( SCH_SHEET* aSheet, wxDC* aDC )
////@begin XPM images
////@end XPM images
/*!
* WinEDA_SheetPropertiesFrame type definition
*/
IMPLEMENT_DYNAMIC_CLASS( WinEDA_SheetPropertiesFrame, wxDialog )
/*!
* WinEDA_SheetPropertiesFrame event table definition
*/
BEGIN_EVENT_TABLE( WinEDA_SheetPropertiesFrame, wxDialog )
////@begin WinEDA_SheetPropertiesFrame event table entries
EVT_BUTTON( wxID_CANCEL, WinEDA_SheetPropertiesFrame::OnCancelClick )
EVT_BUTTON( wxID_OK, WinEDA_SheetPropertiesFrame::OnOkClick )
////@end WinEDA_SheetPropertiesFrame event table entries
END_EVENT_TABLE()
/*!
* WinEDA_SheetPropertiesFrame constructors
*/
WinEDA_SheetPropertiesFrame::WinEDA_SheetPropertiesFrame()
{ {
} bool edit = true;
if( aSheet == NULL )
return false;
WinEDA_SheetPropertiesFrame::WinEDA_SheetPropertiesFrame( /* Get the new texts */
WinEDA_SchematicFrame* parent, RedrawOneStruct( DrawPanel, aDC, aSheet, g_XorMode );
SCH_SHEET* currentsheet,
wxWindowID id,
const wxString& caption,
const wxPoint& pos,
const wxSize& size,
long style )
{
m_Parent = parent;
m_CurrentSheet = currentsheet;
Create( parent, id, caption, pos, size, style );
AddUnitSymbol( *m_SheetNameTextSize ); DrawPanel->m_IgnoreMouseEvents = true;
PutValueInLocalUnits( *m_SheetNameSize, m_CurrentSheet->m_SheetNameSize,
m_Parent->m_InternalUnits );
AddUnitSymbol( *m_FileNameTextSize ); DIALOG_SCH_SHEET_PROPS dlg( this );
PutValueInLocalUnits( *m_FileNameSize, m_CurrentSheet->m_FileNameSize,
m_Parent->m_InternalUnits );
}
wxString units = GetUnitsLabel( g_UnitMetric );
dlg.SetFileName( aSheet->GetFileName() );
dlg.SetFileNameTextSize( ReturnStringFromValue( g_UnitMetric,
aSheet->m_FileNameSize,
m_InternalUnits ) );
dlg.SetFileNameTextSizeUnits( units );
dlg.SetSheetName( aSheet->m_SheetName );
dlg.SetSheetNameTextSize( ReturnStringFromValue( g_UnitMetric,
aSheet->m_SheetNameSize,
m_InternalUnits ) );
dlg.SetSheetNameTextSizeUnits( units );
/*! /* This ugly hack fixes a bug in wxWidgets 2.8.7 and likely earlier
* WinEDA_SheetPropertiesFrame creator * versions for the flex grid sizer in wxGTK that prevents the last
* column from being sized correctly. It doesn't cause any problems
* on win32 so it doesn't need to wrapped in ugly #ifdef __WXGTK__
* #endif.
*/ */
dlg.Layout();
dlg.Fit();
dlg.SetMinSize( dlg.GetSize() );
bool WinEDA_SheetPropertiesFrame::Create( wxWindow* parent, if( dlg.ShowModal() == wxID_OK )
wxWindowID id,
const wxString& caption,
const wxPoint& pos,
const wxSize& size,
long style )
{
////@begin WinEDA_SheetPropertiesFrame member initialisation
m_FileNameWin = NULL;
m_SheetNameWin = NULL;
m_FileNameTextSize = NULL;
m_FileNameSize = NULL;
m_SheetNameTextSize = NULL;
m_SheetNameSize = NULL;
m_btClose = NULL;
////@end WinEDA_SheetPropertiesFrame member initialisation
////@begin WinEDA_SheetPropertiesFrame creation
SetExtraStyle( wxWS_EX_BLOCK_EVENTS );
wxDialog::Create( parent, id, caption, pos, size, style );
CreateControls();
if( GetSizer() )
{ {
GetSizer()->SetSizeHints( this ); wxFileName fileName;
}
Centre();
////@end WinEDA_SheetPropertiesFrame creation
return true;
}
/*!
* Control creation for WinEDA_SheetPropertiesFrame
*/
void WinEDA_SheetPropertiesFrame::CreateControls()
{
////@begin WinEDA_SheetPropertiesFrame content construction
// Generated by DialogBlocks, 24/04/2009 14:25:43 (unregistered)
WinEDA_SheetPropertiesFrame* itemDialog1 = this;
wxBoxSizer* itemBoxSizer2 = new wxBoxSizer( wxVERTICAL );
itemDialog1->SetSizer( itemBoxSizer2 );
wxBoxSizer* itemBoxSizer3 = new wxBoxSizer( wxHORIZONTAL );
itemBoxSizer2->Add( itemBoxSizer3, 0, wxGROW | wxALL, 5 );
wxBoxSizer* itemBoxSizer4 = new wxBoxSizer( wxVERTICAL );
itemBoxSizer3->Add( itemBoxSizer4, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
wxStaticText* itemStaticText5 = new wxStaticText( itemDialog1,
wxID_STATIC,
_( "Filename:" ),
wxDefaultPosition,
wxDefaultSize,
0 );
itemBoxSizer4->Add( itemStaticText5,
0,
wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP |
wxADJUST_MINSIZE,
5 );
m_FileNameWin =
new wxTextCtrl( itemDialog1, ID_TEXTCTRL1, _T( "" ), wxDefaultPosition,
wxSize( 300, - 1 ), wxTE_PROCESS_ENTER );
itemBoxSizer4->Add( m_FileNameWin,
0,
wxALIGN_LEFT | wxLEFT | wxRIGHT | wxBOTTOM,
5 );
wxStaticText* itemStaticText7 = new wxStaticText( itemDialog1,
wxID_STATIC,
_( "Sheetname:" ),
wxDefaultPosition,
wxDefaultSize,
0 );
itemBoxSizer4->Add( itemStaticText7,
0,
wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP |
wxADJUST_MINSIZE,
5 );
m_SheetNameWin =
new wxTextCtrl( itemDialog1, ID_TEXTCTRL, _T( "" ), wxDefaultPosition,
wxSize( 300, -1 ), 0 );
itemBoxSizer4->Add( m_SheetNameWin,
0,
wxALIGN_LEFT | wxLEFT | wxRIGHT | wxBOTTOM,
5 );
wxBoxSizer* itemBoxSizer9 = new wxBoxSizer( wxVERTICAL );
itemBoxSizer3->Add( itemBoxSizer9, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
m_FileNameTextSize = new wxStaticText( itemDialog1, wxID_STATIC,
_( "Size" ), wxDefaultPosition,
wxDefaultSize, 0 );
itemBoxSizer9->Add( m_FileNameTextSize,
0,
wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP |
wxADJUST_MINSIZE,
5 );
m_FileNameSize = new wxTextCtrl( itemDialog1, ID_TEXTCTRL2, _T( "" ),
wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer9->Add( m_FileNameSize,
0,
wxALIGN_LEFT | wxLEFT | wxRIGHT | wxBOTTOM,
5 );
m_SheetNameTextSize = new wxStaticText( itemDialog1, wxID_STATIC,
_( "Size" ), wxDefaultPosition,
wxDefaultSize, 0 );
itemBoxSizer9->Add( m_SheetNameTextSize,
0,
wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP |
wxADJUST_MINSIZE,
5 );
m_SheetNameSize = new wxTextCtrl( itemDialog1, ID_TEXTCTRL3, _T( "" ),
wxDefaultPosition,
wxDefaultSize, 0 );
itemBoxSizer9->Add( m_SheetNameSize,
0,
wxALIGN_LEFT | wxLEFT | wxRIGHT | wxBOTTOM,
5 );
itemBoxSizer2->Add( 5, 5, 1, wxGROW | wxALL, 5 );
wxBoxSizer* itemBoxSizer15 = new wxBoxSizer( wxHORIZONTAL );
itemBoxSizer2->Add( itemBoxSizer15,
0,
wxALIGN_CENTER_HORIZONTAL | wxALL,
5 );
m_btClose = new wxButton( itemDialog1, wxID_CANCEL, _( "&Cancel" ),
wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer15->Add( m_btClose, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
wxButton* itemButton17 = new wxButton( itemDialog1, wxID_OK,
_( "&OK" ), wxDefaultPosition,
wxDefaultSize, 0 );
itemButton17->SetDefault();
itemBoxSizer15->Add( itemButton17, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
// Set validators
m_SheetNameWin->SetValidator( wxTextValidator( wxFILTER_NONE,
&m_CurrentSheet->m_SheetName ) );
////@end WinEDA_SheetPropertiesFrame content construction
m_btClose->SetFocus();
m_FileNameWin->SetValue( m_CurrentSheet->GetFileName() );
}
/*!
* Should we show tooltips?
*/
bool WinEDA_SheetPropertiesFrame::ShowToolTips()
{
return true;
}
/*!
* Get bitmap resources
*/
wxBitmap WinEDA_SheetPropertiesFrame::GetBitmapResource( const wxString& name )
{
// Bitmap retrieval
////@begin WinEDA_SheetPropertiesFrame bitmap retrieval
wxUnusedVar( name );
return wxNullBitmap;
////@end WinEDA_SheetPropertiesFrame bitmap retrieval
}
/*!
* Get icon resources
*/
wxIcon WinEDA_SheetPropertiesFrame::GetIconResource( const wxString& name )
{
// Icon retrieval
////@begin WinEDA_SheetPropertiesFrame icon retrieval
wxUnusedVar( name );
return wxNullIcon;
////@end WinEDA_SheetPropertiesFrame icon retrieval
}
/** Function SheetPropertiesAccept
* Set the new sheets properties:
* sheetname and filename (text and size)
*/
void WinEDA_SheetPropertiesFrame::SheetPropertiesAccept( wxCommandEvent& event )
{
wxFileName fn;
wxString msg; wxString msg;
fn = m_FileNameWin->GetValue(); fileName = dlg.GetFileName();
if( !fn.IsOk() ) if( !fileName.IsOk() )
{ {
DisplayError( this, _( "No Filename! Aborted" ) ); DisplayError( this, _( "File name is not valid! Aborted" ) );
EndModal( FALSE ); edit = false;
return;
} }
else
{
fileName.SetExt( SchematicFileExtension );
fn.SetExt( SchematicFileExtension ); /* m_CurrentSheet->m_AssociatedScreen must be a valid screen, and the
/* m_CurrentSheet->m_AssociatedScreen must be a valide screen, and the
* sheet must have a valid associated filename, * sheet must have a valid associated filename,
* so we must call m_CurrentSheet->ChangeFileName to set a filename, * so we must call m_CurrentSheet->ChangeFileName to set a filename,
* AND always when a new sheet is created ( when * AND always when a new sheet is created ( when
* m_CurrentSheet->m_AssociatedScreen is null ), * m_CurrentSheet->m_AssociatedScreen is null ),
* to create or set an Associated Screen * to create or set an Associated Screen
*/ */
if( ( fn.GetFullPath() != m_CurrentSheet->GetFileName() ) if( ( fileName.GetFullPath() != aSheet->GetFileName() )
|| ( m_CurrentSheet->m_AssociatedScreen == NULL) ) || ( aSheet->m_AssociatedScreen == NULL ) )
{ {
msg = _( "Changing a Filename can change all the schematic \ msg = _( "Changing the sheet file name can change all the schematic \
structures and cannot be undone.\nOk to continue renaming?" ); structures and cannot be undone.\nOk to continue renaming?" );
if( m_CurrentSheet->m_AssociatedScreen == NULL || IsOK( NULL, msg ) ) if( aSheet->m_AssociatedScreen == NULL || IsOK( NULL, msg ) )
{ {
// do not prompt on a new sheet. in fact, we should not allow a // do not prompt on a new sheet. in fact, we should not allow a
// sheet to be created without a valid associated filename to be // sheet to be created without a valid associated filename to be
// read from. // read from.
m_Parent->GetScreen()->ClearUndoRedoList(); GetScreen()->ClearUndoRedoList();
// set filename and the associated screen // set filename and the associated screen
m_CurrentSheet->ChangeFileName( m_Parent, fn.GetFullPath() ); aSheet->ChangeFileName( this, fileName.GetFullPath() );
} }
} }
msg = m_FileNameSize->GetValue(); aSheet->m_FileNameSize = ReturnValueFromString( g_UnitMetric,
m_CurrentSheet->m_FileNameSize = dlg.GetFileNameTextSize(),
ReturnValueFromString( g_UnitMetric, m_InternalUnits );
msg, m_Parent->m_InternalUnits );
m_CurrentSheet->m_SheetName = m_SheetNameWin->GetValue(); aSheet->m_SheetName = dlg.GetSheetName();
msg = m_SheetNameSize->GetValue(); aSheet->m_SheetNameSize = ReturnValueFromString( g_UnitMetric,
m_CurrentSheet->m_SheetNameSize = dlg.GetSheetNameTextSize(),
ReturnValueFromString( g_UnitMetric, m_InternalUnits );
msg, m_Parent->m_InternalUnits );
if( ( m_CurrentSheet->m_SheetName.IsEmpty() ) ) if( aSheet->m_SheetName.IsEmpty() )
{ {
m_CurrentSheet->m_SheetName.Printf( wxT( "Sheet%8.8lX" ), aSheet->m_SheetName.Printf( wxT( "Sheet%8.8lX" ), GetTimeStamp() );
GetTimeStamp() ); }
}
}
else
{
edit = false;
} }
DrawPanel->MouseToCursorSchema();
DrawPanel->m_IgnoreMouseEvents = false;
EndModal( TRUE ); RedrawOneStruct( DrawPanel, aDC, aSheet, GR_DEFAULT_DRAWMODE );
return edit;
} }
/* Routine to edit the SheetName and the FileName for the sheet "Sheet" */ /* Move selected sheet with the cursor.
bool WinEDA_SchematicFrame::EditSheet( SCH_SHEET* Sheet, wxDC* DC ) * Callback function use by ManageCurseur.
*/
static void MoveSheet( WinEDA_DrawPanel* aPanel, wxDC* aDC, bool aErase )
{ {
WinEDA_SheetPropertiesFrame* frame; wxPoint moveVector;
bool edit = TRUE; SCH_SHEET_PIN* sheetLabel;
BASE_SCREEN* screen = aPanel->GetScreen();
SCH_SHEET* sheet = (SCH_SHEET*) screen->GetCurItem();
if( Sheet == NULL ) if( aErase )
return FALSE; RedrawOneStruct( aPanel, aDC, sheet, g_XorMode );
/* Get the new texts */ if( sheet->m_Flags & IS_RESIZED )
RedrawOneStruct( DrawPanel, DC, Sheet, g_XorMode ); {
sheet->m_Size.x = MAX( s_PreviousSheetWidth, screen->m_Curseur.x - sheet->m_Pos.x );
sheet->m_Size.y = MAX( s_PreviousSheetHeight, screen->m_Curseur.y - sheet->m_Pos.y );
sheetLabel = sheet->m_Label;
DrawPanel->m_IgnoreMouseEvents = TRUE; while( sheetLabel )
frame = new WinEDA_SheetPropertiesFrame( this, Sheet ); {
edit = frame->ShowModal(); frame->Destroy(); if( sheetLabel->m_Edge )
DrawPanel->MouseToCursorSchema(); sheetLabel->m_Pos.x = sheet->m_Pos.x + sheet->m_Size.x;
DrawPanel->m_IgnoreMouseEvents = FALSE; sheetLabel = sheetLabel->Next();
}
}
else /* Move Sheet */
{
moveVector = screen->m_Curseur - sheet->m_Pos;
sheet->Move( moveVector );
}
RedrawOneStruct( DrawPanel, DC, Sheet, GR_DEFAULT_DRAWMODE ); RedrawOneStruct( aPanel, aDC, sheet, g_XorMode );
return edit; }
/* Complete sheet move. */
static void ExitSheet( WinEDA_DrawPanel* aPanel, wxDC* aDC )
{
SCH_SCREEN* screen = (SCH_SCREEN*) aPanel->GetScreen();
SCH_SHEET* sheet = (SCH_SHEET*) screen->GetCurItem();
if( sheet == NULL )
return;
if( sheet->m_Flags & IS_NEW )
{
RedrawOneStruct( aPanel, aDC, sheet, g_XorMode );
SAFE_DELETE( sheet );
}
else if( sheet->m_Flags & IS_RESIZED )
{
/* Resize in progress, cancel move. */
RedrawOneStruct( aPanel, aDC, sheet, g_XorMode );
sheet->m_Size.x = s_OldPos.x;
sheet->m_Size.y = s_OldPos.y;
RedrawOneStruct( aPanel, aDC, sheet, GR_DEFAULT_DRAWMODE );
sheet->m_Flags = 0;
}
else if( sheet->m_Flags & IS_MOVED )
{
wxPoint curspos = screen->m_Curseur;
aPanel->GetScreen()->m_Curseur = s_OldPos;
MoveSheet( aPanel, aDC, true );
RedrawOneStruct( aPanel, aDC, sheet, GR_DEFAULT_DRAWMODE );
sheet->m_Flags = 0;
screen->m_Curseur = curspos;
}
else
{
sheet->m_Flags = 0;
}
screen->SetCurItem( NULL );
aPanel->ManageCurseur = NULL;
aPanel->ForceCloseManageCurseur = NULL;
} }
#define SHEET_MIN_WIDTH 500 #define SHEET_MIN_WIDTH 500
#define SHEET_MIN_HEIGHT 150 #define SHEET_MIN_HEIGHT 150
/* Create hierarchy sheet. */ /* Create hierarchy sheet. */
SCH_SHEET* WinEDA_SchematicFrame::CreateSheet( wxDC* DC ) SCH_SHEET* WinEDA_SchematicFrame::CreateSheet( wxDC* aDC )
{ {
g_ItemToRepeat = NULL; g_ItemToRepeat = NULL;
SCH_SHEET* Sheet = new SCH_SHEET( GetScreen()->m_Curseur ); SCH_SHEET* sheet = new SCH_SHEET( GetScreen()->m_Curseur );
Sheet->m_Flags = IS_NEW | IS_RESIZED; sheet->m_Flags = IS_NEW | IS_RESIZED;
Sheet->m_TimeStamp = GetTimeStamp(); sheet->m_TimeStamp = GetTimeStamp();
Sheet->SetParent( GetScreen() ); sheet->SetParent( GetScreen() );
Sheet->m_AssociatedScreen = NULL; sheet->m_AssociatedScreen = NULL;
s_SheetMindx = SHEET_MIN_WIDTH; s_PreviousSheetWidth = SHEET_MIN_WIDTH;
s_SheetMindy = SHEET_MIN_HEIGHT; s_PreviousSheetHeight = SHEET_MIN_HEIGHT;
//need to check if this is being added to the EEDrawList. // need to check if this is being added to the EEDrawList.
//also need to update the hierarchy, if we are adding // also need to update the hierarchy, if we are adding
// a sheet to a screen that already has multiple instances (!) // a sheet to a screen that already has multiple instances (!)
GetScreen()->SetCurItem( Sheet ); GetScreen()->SetCurItem( sheet );
DrawPanel->ManageCurseur = DeplaceSheet; DrawPanel->ManageCurseur = MoveSheet;
DrawPanel->ForceCloseManageCurseur = ExitSheet; DrawPanel->ForceCloseManageCurseur = ExitSheet;
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE ); DrawPanel->ManageCurseur( DrawPanel, aDC, false );
return Sheet; return sheet;
} }
void WinEDA_SchematicFrame::ReSizeSheet( SCH_SHEET* Sheet, wxDC* DC ) void WinEDA_SchematicFrame::ReSizeSheet( SCH_SHEET* aSheet, wxDC* aDC )
{ {
SCH_SHEET_PIN* sheetlabel; SCH_SHEET_PIN* sheetLabel;
if( Sheet == NULL ) if( aSheet == NULL || aSheet->m_Flags & IS_NEW )
return;
if( Sheet->m_Flags & IS_NEW )
return; return;
if( Sheet->Type() != DRAW_SHEET_STRUCT_TYPE ) if( aSheet->Type() != DRAW_SHEET_STRUCT_TYPE )
{ {
DisplayError( this, DisplayError( this,
wxT( "WinEDA_SchematicFrame::ReSizeSheet: Bad SructType" ) ); wxT( "WinEDA_SchematicFrame::ReSizeSheet: Bad SructType" ) );
@ -438,142 +261,44 @@ void WinEDA_SchematicFrame::ReSizeSheet( SCH_SHEET* Sheet, wxDC* DC )
} }
GetScreen()->SetModify(); GetScreen()->SetModify();
Sheet->m_Flags |= IS_RESIZED; aSheet->m_Flags |= IS_RESIZED;
s_OldPos.x = Sheet->m_Size.x; s_OldPos.x = aSheet->m_Size.x;
s_OldPos.y = Sheet->m_Size.y; s_OldPos.y = aSheet->m_Size.y;
s_SheetMindx = SHEET_MIN_WIDTH; s_PreviousSheetWidth = SHEET_MIN_WIDTH;
s_SheetMindy = SHEET_MIN_HEIGHT; s_PreviousSheetHeight = SHEET_MIN_HEIGHT;
sheetlabel = Sheet->m_Label; sheetLabel = aSheet->m_Label;
while( sheetlabel )
while( sheetLabel )
{ {
s_SheetMindx = MAX( s_SheetMindx, s_PreviousSheetWidth = MAX( s_PreviousSheetWidth,
(int) ( ( sheetlabel->GetLength() + 1 ) * (int) ( ( sheetLabel->GetLength() + 1 ) *
sheetlabel->m_Size.x ) ); sheetLabel->m_Size.x ) );
s_SheetMindy = MAX( s_SheetMindy, sheetlabel->m_Pos.y - Sheet->m_Pos.y ); s_PreviousSheetHeight = MAX( s_PreviousSheetHeight,
sheetlabel = sheetlabel->Next(); sheetLabel->m_Pos.y - aSheet->m_Pos.y );
sheetLabel = sheetLabel->Next();
} }
DrawPanel->ManageCurseur = DeplaceSheet; DrawPanel->ManageCurseur = MoveSheet;
DrawPanel->ForceCloseManageCurseur = ExitSheet; DrawPanel->ForceCloseManageCurseur = ExitSheet;
DrawPanel->ManageCurseur( DrawPanel, DC, TRUE ); DrawPanel->ManageCurseur( DrawPanel, aDC, true );
} }
void WinEDA_SchematicFrame::StartMoveSheet( SCH_SHEET* Sheet, wxDC* DC ) void WinEDA_SchematicFrame::StartMoveSheet( SCH_SHEET* aSheet, wxDC* aDC )
{ {
if( ( Sheet == NULL ) || ( Sheet->Type() != DRAW_SHEET_STRUCT_TYPE ) ) if( ( aSheet == NULL ) || ( aSheet->Type() != DRAW_SHEET_STRUCT_TYPE ) )
return; return;
DrawPanel->CursorOff( DC ); DrawPanel->CursorOff( aDC );
GetScreen()->m_Curseur = Sheet->m_Pos; GetScreen()->m_Curseur = aSheet->m_Pos;
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
s_OldPos = Sheet->m_Pos; s_OldPos = aSheet->m_Pos;
Sheet->m_Flags |= IS_MOVED; aSheet->m_Flags |= IS_MOVED;
DrawPanel->ManageCurseur = DeplaceSheet; DrawPanel->ManageCurseur = MoveSheet;
DrawPanel->ForceCloseManageCurseur = ExitSheet; DrawPanel->ForceCloseManageCurseur = ExitSheet;
DrawPanel->ManageCurseur( DrawPanel, DC, TRUE ); DrawPanel->ManageCurseur( DrawPanel, aDC, true );
DrawPanel->CursorOn( aDC );
DrawPanel->CursorOn( DC );
}
/* Move selected sheet with the cursor.
* Callback function use by ManageCurseur.
*/
static void DeplaceSheet( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
{
wxPoint move_vector;
SCH_SHEET_PIN* SheetLabel;
BASE_SCREEN* screen = panel->GetScreen();
SCH_SHEET* Sheet = (SCH_SHEET*) screen->GetCurItem();
if( erase )
RedrawOneStruct( panel, DC, Sheet, g_XorMode );
if( Sheet->m_Flags & IS_RESIZED )
{
Sheet->m_Size.x =
MAX( s_SheetMindx, screen->m_Curseur.x - Sheet->m_Pos.x );
Sheet->m_Size.y =
MAX( s_SheetMindy, screen->m_Curseur.y - Sheet->m_Pos.y );
SheetLabel = Sheet->m_Label;
while( SheetLabel )
{
if( SheetLabel->m_Edge )
SheetLabel->m_Pos.x = Sheet->m_Pos.x + Sheet->m_Size.x;
SheetLabel = SheetLabel->Next();
}
}
else /* Move Sheet */
{
move_vector = screen->m_Curseur - Sheet->m_Pos;
Sheet->Move( move_vector );
}
RedrawOneStruct( panel, DC, Sheet, g_XorMode );
}
/* Complete sheet move. */
static void ExitSheet( WinEDA_DrawPanel* Panel, wxDC* DC )
{
SCH_SCREEN* Screen = (SCH_SCREEN*) Panel->GetScreen();
SCH_SHEET* Sheet = (SCH_SHEET*) Screen->GetCurItem();
if( Sheet == NULL )
return;
if( Sheet->m_Flags & IS_NEW )
{
RedrawOneStruct( Panel, DC, Sheet, g_XorMode );
SAFE_DELETE( Sheet );
}
else if( Sheet->m_Flags & IS_RESIZED )
{
/* Resize in progress, cancel move. */
RedrawOneStruct( Panel, DC, Sheet, g_XorMode );
Sheet->m_Size.x = s_OldPos.x;
Sheet->m_Size.y = s_OldPos.y;
RedrawOneStruct( Panel, DC, Sheet, GR_DEFAULT_DRAWMODE );
Sheet->m_Flags = 0;
}
else if( Sheet->m_Flags & IS_MOVED )
{
wxPoint curspos = Screen->m_Curseur;
Panel->GetScreen()->m_Curseur = s_OldPos;
DeplaceSheet( Panel, DC, TRUE );
RedrawOneStruct( Panel, DC, Sheet, GR_DEFAULT_DRAWMODE );
Sheet->m_Flags = 0;
Screen->m_Curseur = curspos;
}
else
Sheet->m_Flags = 0;
Screen->SetCurItem( NULL );
Panel->ManageCurseur = NULL;
Panel->ForceCloseManageCurseur = NULL;
}
/*!
* wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL
*/
void WinEDA_SheetPropertiesFrame::OnCancelClick( wxCommandEvent& event )
{
EndModal( 0 );
}
/*!
* wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK
*/
void WinEDA_SheetPropertiesFrame::OnOkClick( wxCommandEvent& event )
{
SheetPropertiesAccept( event );
} }

View File

@ -1,125 +0,0 @@
/////////////////////////////////////////////////////////////////////////////
// Name: sheet.h
// Purpose:
// Author: jean-pierre Charras
// Modified by:
// Created: 08/02/2006 18:37:02
// RCS-ID:
// Copyright: License GNU
// Licence:
/////////////////////////////////////////////////////////////////////////////
// Generated by DialogBlocks (unregistered), 08/02/2006 18:37:02
#ifndef _SHEET_H_
#define _SHEET_H_
#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
#pragma interface "sheet.h"
#endif
/*!
* Includes
*/
////@begin includes
#include "wx/valtext.h"
////@end includes
/*!
* Forward declarations
*/
////@begin forward declarations
////@end forward declarations
/*!
* Control identifiers
*/
////@begin control identifiers
#define ID_DIALOG 10000
#define ID_TEXTCTRL1 10002
#define ID_TEXTCTRL 10001
#define ID_TEXTCTRL2 10003
#define ID_TEXTCTRL3 10004
#define SYMBOL_WINEDA_SHEETPROPERTIESFRAME_STYLE wxCAPTION|wxSYSTEM_MENU|wxCLOSE_BOX|MAYBE_RESIZE_BORDER
#define SYMBOL_WINEDA_SHEETPROPERTIESFRAME_TITLE _("Sheet properties")
#define SYMBOL_WINEDA_SHEETPROPERTIESFRAME_IDNAME ID_DIALOG
#define SYMBOL_WINEDA_SHEETPROPERTIESFRAME_SIZE wxSize(400, 300)
#define SYMBOL_WINEDA_SHEETPROPERTIESFRAME_POSITION wxDefaultPosition
////@end control identifiers
/*!
* Compatibility
*/
#ifndef wxCLOSE_BOX
#define wxCLOSE_BOX 0x1000
#endif
/*!
* WinEDA_SheetPropertiesFrame class declaration
*/
class WinEDA_SheetPropertiesFrame: public wxDialog
{
DECLARE_DYNAMIC_CLASS( WinEDA_SheetPropertiesFrame )
DECLARE_EVENT_TABLE()
public:
/// Constructors
WinEDA_SheetPropertiesFrame( );
WinEDA_SheetPropertiesFrame( WinEDA_SchematicFrame* parent,
SCH_SHEET * currentsheet,
wxWindowID id = SYMBOL_WINEDA_SHEETPROPERTIESFRAME_IDNAME,
const wxString& caption = SYMBOL_WINEDA_SHEETPROPERTIESFRAME_TITLE,
const wxPoint& pos = SYMBOL_WINEDA_SHEETPROPERTIESFRAME_POSITION,
const wxSize& size = SYMBOL_WINEDA_SHEETPROPERTIESFRAME_SIZE,
long style = SYMBOL_WINEDA_SHEETPROPERTIESFRAME_STYLE );
/// Creation
bool Create( wxWindow* parent, wxWindowID id = SYMBOL_WINEDA_SHEETPROPERTIESFRAME_IDNAME, const wxString& caption = SYMBOL_WINEDA_SHEETPROPERTIESFRAME_TITLE, const wxPoint& pos = SYMBOL_WINEDA_SHEETPROPERTIESFRAME_POSITION, const wxSize& size = SYMBOL_WINEDA_SHEETPROPERTIESFRAME_SIZE, long style = SYMBOL_WINEDA_SHEETPROPERTIESFRAME_STYLE );
/// Creates the controls and sizers
void CreateControls();
////@begin WinEDA_SheetPropertiesFrame event handler declarations
/// wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL
void OnCancelClick( wxCommandEvent& event );
/// wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK
void OnOkClick( wxCommandEvent& event );
////@end WinEDA_SheetPropertiesFrame event handler declarations
////@begin WinEDA_SheetPropertiesFrame member function declarations
/// Retrieves bitmap resources
wxBitmap GetBitmapResource( const wxString& name );
/// Retrieves icon resources
wxIcon GetIconResource( const wxString& name );
////@end WinEDA_SheetPropertiesFrame member function declarations
/// Should we show tooltips?
static bool ShowToolTips();
void SheetPropertiesAccept(wxCommandEvent& event);
////@begin WinEDA_SheetPropertiesFrame member variables
wxTextCtrl* m_FileNameWin;
wxTextCtrl* m_SheetNameWin;
wxStaticText* m_FileNameTextSize;
wxTextCtrl* m_FileNameSize;
wxStaticText* m_SheetNameTextSize;
wxTextCtrl* m_SheetNameSize;
wxButton* m_btClose;
////@end WinEDA_SheetPropertiesFrame member variables
WinEDA_SchematicFrame * m_Parent;
SCH_SHEET* m_CurrentSheet;
};
#endif
// _SHEET_H_

File diff suppressed because it is too large Load Diff

View File

@ -1 +0,0 @@
#include "wx/msw/wx.rc"

View File

@ -20,6 +20,7 @@
#include "class_library.h" #include "class_library.h"
#include <boost/foreach.hpp> #include <boost/foreach.hpp>
#include <wx/ffile.h>
/* /*
@ -32,7 +33,6 @@
void WinEDA_LibeditFrame::LoadOneSymbol( void ) void WinEDA_LibeditFrame::LoadOneSymbol( void )
{ {
LIB_COMPONENT* Component; LIB_COMPONENT* Component;
FILE* ImportFile;
wxString msg, err; wxString msg, err;
CMP_LIBRARY* Lib; CMP_LIBRARY* Lib;
@ -58,17 +58,6 @@ void WinEDA_LibeditFrame::LoadOneSymbol( void )
wxFileName fn = dlg.GetPath(); wxFileName fn = dlg.GetPath();
wxGetApp().SaveLastVisitedLibraryPath( fn.GetPath() ); wxGetApp().SaveLastVisitedLibraryPath( fn.GetPath() );
/* Load data */
ImportFile = wxFopen( fn.GetFullPath(), wxT( "rt" ) );
if( ImportFile == NULL )
{
msg.Printf( _( "Failed to open Symbol File <%s>" ),
GetChars( fn.GetFullPath() ) );
DisplayError( this, msg );
return;
}
Lib = new CMP_LIBRARY( LIBRARY_TYPE_SYMBOL, fn ); Lib = new CMP_LIBRARY( LIBRARY_TYPE_SYMBOL, fn );
if( !Lib->Load( err ) ) if( !Lib->Load( err ) )
@ -76,13 +65,10 @@ void WinEDA_LibeditFrame::LoadOneSymbol( void )
msg.Printf( _( "Error <%s> occurred loading symbol library <%s>." ), msg.Printf( _( "Error <%s> occurred loading symbol library <%s>." ),
GetChars( err ), GetChars( fn.GetName() ) ); GetChars( err ), GetChars( fn.GetName() ) );
DisplayError( this, msg ); DisplayError( this, msg );
fclose( ImportFile );
delete Lib; delete Lib;
return; return;
} }
fclose( ImportFile );
if( Lib->IsEmpty() ) if( Lib->IsEmpty() )
{ {
msg.Printf( _( "No components found in symbol library <%s>." ), msg.Printf( _( "No components found in symbol library <%s>." ),
@ -92,7 +78,11 @@ void WinEDA_LibeditFrame::LoadOneSymbol( void )
} }
if( Lib->GetCount() > 1 ) if( Lib->GetCount() > 1 )
DisplayError( this, _( "Warning: more than 1 part in symbol file." ) ); {
msg.Printf( _( "More than one part in symbol file <%s>." ),
GetChars( fn.GetName() ) );
wxMessageBox( msg, _( "Warning" ), wxOK | wxICON_EXCLAMATION, this );
}
Component = (LIB_COMPONENT*) Lib->GetFirstEntry(); Component = (LIB_COMPONENT*) Lib->GetFirstEntry();
LIB_DRAW_ITEM_LIST& drawList = Component->GetDrawItemList(); LIB_DRAW_ITEM_LIST& drawList = Component->GetDrawItemList();
@ -113,10 +103,7 @@ void WinEDA_LibeditFrame::LoadOneSymbol( void )
m_component->AddDrawItem( newItem ); m_component->AddDrawItem( newItem );
} }
// Remove duplicated drawings:
m_component->RemoveDuplicateDrawItems(); m_component->RemoveDuplicateDrawItems();
// Clear flags
m_component->ClearSelectedItems(); m_component->ClearSelectedItems();
GetScreen()->SetModify(); GetScreen()->SetModify();
@ -127,7 +114,7 @@ void WinEDA_LibeditFrame::LoadOneSymbol( void )
/* /*
* Save in file the current symbol. * Save the current symbol to a file.
* *
* The symbol file format is like the standard libraries, but there is only * The symbol file format is like the standard libraries, but there is only
* one symbol. * one symbol.
@ -137,7 +124,6 @@ void WinEDA_LibeditFrame::LoadOneSymbol( void )
void WinEDA_LibeditFrame::SaveOneSymbol() void WinEDA_LibeditFrame::SaveOneSymbol()
{ {
wxString msg; wxString msg;
FILE* ExportFile;
if( m_component->GetDrawItemList().empty() ) if( m_component->GetDrawItemList().empty() )
return; return;
@ -160,50 +146,57 @@ void WinEDA_LibeditFrame::SaveOneSymbol()
wxGetApp().SaveLastVisitedLibraryPath( fn.GetPath() ); wxGetApp().SaveLastVisitedLibraryPath( fn.GetPath() );
ExportFile = wxFopen( fn.GetFullPath(), wxT( "wt" ) ); wxFFile file( fn.GetFullPath(), wxT( "wt" ) );
if( ExportFile == NULL ) if( !file.IsOpened() )
{ {
msg.Printf( _( "Unable to create <%s>" ), msg.Printf( _( "Unable to create file <%s>" ),
GetChars( fn.GetFullPath() ) ); GetChars( fn.GetFullPath() ) );
DisplayError( this, msg ); DisplayError( this, msg );
return; return;
} }
msg.Printf( _( "Save Symbol in [%s]" ), GetChars( fn.GetPath() ) ); msg.Printf( _( "Saving symbol in [%s]" ), GetChars( fn.GetPath() ) );
Affiche_Message( msg ); Affiche_Message( msg );
char Line[256]; wxString line;
fprintf( ExportFile, "%s %d.%d %s Date: %s\n", LIBFILE_IDENT,
LIB_VERSION_MAJOR, LIB_VERSION_MINOR,
"SYMBOL", DateAndTime( Line ) );
/* Component name. */ /* File header */
fprintf( ExportFile, "# SYMBOL %s\n#\n", line << wxT( LIBFILE_IDENT ) << wxT( " " ) << LIB_VERSION_MAJOR
CONV_TO_UTF8( m_component->GetName() ) ); << wxT( "." ) << LIB_VERSION_MINOR << wxT( " SYMBOL " )
<< wxT( "Date: " ) << DateAndTime() << wxT( "\n" );
/* Component name comment and definition. */
line << wxT( "# SYMBOL " ) << m_component->GetName() << wxT( "\n#\nDEF " )
<< m_component->GetName() << wxT( " " );
fprintf( ExportFile, "DEF %s",
CONV_TO_UTF8( m_component->GetName() ) );
if( !m_component->GetReferenceField().m_Text.IsEmpty() ) if( !m_component->GetReferenceField().m_Text.IsEmpty() )
fprintf( ExportFile, " %s", line << m_component->GetReferenceField().m_Text << wxT( " " );
CONV_TO_UTF8( m_component->GetReferenceField().m_Text ) );
else else
fprintf( ExportFile, " ~" ); line << wxT( "~ " );
fprintf( ExportFile, " %d %d %c %c %d %d %c\n", line << 0 << wxT( " " ) << m_component->m_TextInside << wxT( " " );
0, /* unused */
m_component->m_TextInside,
m_component->m_DrawPinNum ? 'Y' : 'N',
m_component->m_DrawPinName ? 'Y' : 'N',
1, 0 /* unused */, 'N' );
m_component->GetReferenceField().Save( ExportFile ); if( m_component->m_DrawPinNum )
m_component->GetValueField().Save( ExportFile ); line << wxT( "Y " );
else
line << wxT( "N " );
if( m_component->m_DrawPinName )
line << wxT( "Y " );
else
line << wxT( "N " );
line << wxT( "1 0 N\n" );
if( !file.Write( line )
|| !m_component->GetReferenceField().Save( file.fp() )
|| !m_component->GetValueField().Save( file.fp() )
|| !file.Write( wxT( "DRAW\n" ) ) )
return;
LIB_DRAW_ITEM_LIST& drawList = m_component->GetDrawItemList(); LIB_DRAW_ITEM_LIST& drawList = m_component->GetDrawItemList();
fprintf( ExportFile, "DRAW\n" );
BOOST_FOREACH( LIB_DRAW_ITEM& item, drawList ) BOOST_FOREACH( LIB_DRAW_ITEM& item, drawList )
{ {
if( item.Type() == COMPONENT_FIELD_DRAW_TYPE ) if( item.Type() == COMPONENT_FIELD_DRAW_TYPE )
@ -214,19 +207,20 @@ void WinEDA_LibeditFrame::SaveOneSymbol()
if( m_convert && item.m_Convert && ( item.m_Convert != m_convert ) ) if( m_convert && item.m_Convert && ( item.m_Convert != m_convert ) )
continue; continue;
item.Save( ExportFile ); if( !item.Save( file.fp() ) )
return;
} }
fprintf( ExportFile, "ENDDRAW\n" ); if( !file.Write( wxT( "ENDDRAW\n" ) )
fprintf( ExportFile, "ENDDEF\n" ); || !file.Write( wxT( "ENDDEF\n" ) ) )
fclose( ExportFile ); return;
} }
/* /*
* Place anchor reference coordinators for current component * Place anchor reference coordinators for current component
* *
* All coordinates of the object are offset to the cursor position * / * All coordinates of the object are offset to the cursor position.
*/ */
void WinEDA_LibeditFrame::PlaceAncre() void WinEDA_LibeditFrame::PlaceAncre()
{ {

View File

@ -159,7 +159,7 @@ void WinEDA_ViewlibFrame::ReCreateHToolbar()
SelpartBox->Enable( parts_count > 1 ); SelpartBox->Enable( parts_count > 1 );
m_HToolBar->EnableTool( ID_LIBVIEW_VIEWDOC, m_HToolBar->EnableTool( ID_LIBVIEW_VIEWDOC,
entry && ( entry->m_DocFile != wxEmptyString ) ); entry && ( entry->GetDocFileName() != wxEmptyString ) );
} }

View File

@ -51,8 +51,8 @@ void WinEDA_ViewlibFrame::Process_Special_Functions( wxCommandEvent& event )
LibEntry = CMP_LIBRARY::FindLibraryEntry( m_entryName, LibEntry = CMP_LIBRARY::FindLibraryEntry( m_entryName,
m_libraryName ); m_libraryName );
if( LibEntry && ( !LibEntry->m_DocFile.IsEmpty() ) ) if( LibEntry && ( !LibEntry->GetDocFileName().IsEmpty() ) )
GetAssociatedDocument( this, LibEntry->m_DocFile, GetAssociatedDocument( this, LibEntry->GetDocFileName(),
&wxGetApp().GetLibraryPathList() ); &wxGetApp().GetLibraryPathList() );
break; break;
@ -280,12 +280,12 @@ void WinEDA_ViewlibFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
DrawPanel->DrawBackGround( DC ); DrawPanel->DrawBackGround( DC );
if( entry->Type != ROOT ) if( entry->isAlias() )
{ {
LIB_ALIAS* alias = (LIB_ALIAS*) entry; LIB_ALIAS* alias = (LIB_ALIAS*) entry;
component = alias->GetComponent(); component = alias->GetComponent();
wxASSERT( component != NULL && component->Type == ROOT ); wxASSERT( component != NULL && component->isComponent() );
msg = alias->GetName(); msg = alias->GetName();
@ -313,8 +313,8 @@ void WinEDA_ViewlibFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
ClearMsgPanel(); ClearMsgPanel();
AppendMsgPanel( _( "Part" ), component->GetName(), BLUE, 6 ); AppendMsgPanel( _( "Part" ), component->GetName(), BLUE, 6 );
AppendMsgPanel( _( "Alias" ), msg, RED, 6 ); AppendMsgPanel( _( "Alias" ), msg, RED, 6 );
AppendMsgPanel( _( "Description" ), entry->m_Doc, CYAN, 6 ); AppendMsgPanel( _( "Description" ), entry->GetDescription(), CYAN, 6 );
AppendMsgPanel( _( "Key words" ), entry->m_KeyWord, DARKDARKGRAY ); AppendMsgPanel( _( "Key words" ), entry->GetKeyWords(), DARKDARKGRAY );
DrawPanel->Trace_Curseur( DC ); DrawPanel->Trace_Curseur( DC );
} }

View File

@ -1234,15 +1234,14 @@ bool DRC::doPadToPadsDrc( D_PAD* aRefPad, LISTE_PAD* aStart, LISTE_PAD* aEnd,
wxPoint rotate( wxPoint p, int angle ) wxPoint rotate( wxPoint p, int angle )
{ {
wxPoint n; wxPoint n;
float theta = M_PI * angle/1800; double theta = M_PI * (double) angle / 1800.0;
n.x = float(p.x) * cos(theta) - float(p.y) * sin(theta); n.x = wxRound( (double ) p.x * cos( theta ) - (double) p.y * sin( theta ) );
n.y = p.x * sin(theta) + p.y * cos(theta); n.y = wxRound( p.x * sin( theta ) + p.y * cos( theta ) );
return n; return n;
} }
/**************************************************************************************/
bool DRC::checkClearancePadToPad( D_PAD* aRefPad, D_PAD* aPad ) bool DRC::checkClearancePadToPad( D_PAD* aRefPad, D_PAD* aPad )
/***************************************************************************************/
{ {
wxPoint rel_pos; wxPoint rel_pos;
int dist;; int dist;;