Commit 0d57d670 authored by Wayne Stambaugh's avatar Wayne Stambaugh

Add user write permission tests to PCBNew and other minor fixes.

* Check user write permissions before saving project, board, and footprint
  library files.
* Append read only to file name and path in title bar when the user
  does not have write privileges.
* Rename class WinEDA_ModuleEditFrame to FOOTPRINT_EDIT_FRAME.
* Lot's of Doxygen comment and coding style policy fixes.
parent 5fd409f8
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
/* Forward declarations of classes. */ /* Forward declarations of classes. */
class WinEDA_CvpcbFrame; class WinEDA_CvpcbFrame;
class PCB_EDIT_FRAME; class PCB_EDIT_FRAME;
class WinEDA_ModuleEditFrame; class FOOTPRINT_EDIT_FRAME;
class BOARD; class BOARD;
class TEXTE_PCB; class TEXTE_PCB;
class MODULE; class MODULE;
...@@ -61,7 +61,7 @@ public: ...@@ -61,7 +61,7 @@ public:
wxRealPoint m_UserGridSize; wxRealPoint m_UserGridSize;
EDA_3D_FRAME* m_Draw3DFrame; EDA_3D_FRAME* m_Draw3DFrame;
WinEDA_ModuleEditFrame* m_ModuleEditFrame; FOOTPRINT_EDIT_FRAME* m_ModuleEditFrame;
protected: protected:
BOARD* m_Pcb; BOARD* m_Pcb;
...@@ -172,7 +172,6 @@ public: ...@@ -172,7 +172,6 @@ public:
*/ */
GENERAL_COLLECTORS_GUIDE GetCollectorsGuide(); GENERAL_COLLECTORS_GUIDE GetCollectorsGuide();
/** /**
* Function CursorGoto * Function CursorGoto
* positions the cursor at a given coordinate and reframes the drawing if * positions the cursor at a given coordinate and reframes the drawing if
...@@ -182,7 +181,6 @@ public: ...@@ -182,7 +181,6 @@ public:
*/ */
void CursorGoto( const wxPoint& aPos ); void CursorGoto( const wxPoint& aPos );
void place_marqueur( wxDC* DC, void place_marqueur( wxDC* DC,
const wxPoint& pos, const wxPoint& pos,
char* pt_bitmap, char* pt_bitmap,
...@@ -208,8 +206,14 @@ public: ...@@ -208,8 +206,14 @@ public:
bool aOverwrite, bool aOverwrite,
bool aDisplayDialog ); bool aDisplayDialog );
void Archive_Modules( const wxString& LibName, /**
bool NewModulesOnly ); * Function Archive_Modules
* Save in the library:
* All new modules (ie modules not found in this lib) (if NewModulesOnly == true)
* all modules (if NewModulesOnly == false)
*/
void Archive_Modules( const wxString& LibName, bool NewModulesOnly );
MODULE* GetModuleByName(); MODULE* GetModuleByName();
/** /**
...@@ -276,15 +280,17 @@ public: ...@@ -276,15 +280,17 @@ public:
wxDC* DC ); wxDC* DC );
void AddPad( MODULE* Module, bool draw ); void AddPad( MODULE* Module, bool draw );
/** /**
* Function DeletePad * Function DeletePad
* Delete the pad aPad. * Delete the pad aPad.
* Refresh the modified screen area * Refresh the modified screen area
* Refresh modified parameters of the parent module (bounding box, last date) * Refresh modified parameters of the parent module (bounding box, last date)
* @param aPad = the pad to delete * @param aPad = the pad to delete
* @param aQuery = true to promt for confirmation, false to delete silently * @param aQuery = true to prompt for confirmation, false to delete silently
*/ */
void DeletePad( D_PAD* aPad, bool aQuery = true ); void DeletePad( D_PAD* aPad, bool aQuery = true );
void StartMovePad( D_PAD* Pad, wxDC* DC ); void StartMovePad( D_PAD* Pad, wxDC* DC );
void RotatePad( D_PAD* Pad, wxDC* DC ); void RotatePad( D_PAD* Pad, wxDC* DC );
void PlacePad( D_PAD* Pad, wxDC* DC ); void PlacePad( D_PAD* Pad, wxDC* DC );
......
...@@ -19,7 +19,6 @@ ...@@ -19,7 +19,6 @@
/* Forward declarations of classes. */ /* Forward declarations of classes. */
class PCB_SCREEN; class PCB_SCREEN;
class WinEDA_ModuleEditFrame;
class BOARD; class BOARD;
class TEXTE_PCB; class TEXTE_PCB;
class MODULE; class MODULE;
...@@ -106,7 +105,7 @@ protected: ...@@ -106,7 +105,7 @@ protected:
* here and we do not want to do that. * here and we do not want to do that.
* </p> * </p>
*/ */
void syncLayerWidget( ); void syncLayerWidget();
virtual void unitsChangeRefresh(); virtual void unitsChangeRefresh();
...@@ -141,6 +140,10 @@ public: ...@@ -141,6 +140,10 @@ public:
*/ */
void ToPrinter( wxCommandEvent& event ); void ToPrinter( wxCommandEvent& event );
/**
* Function SVG_Print
* shows the print SVG file dialog.
*/
void SVG_Print( wxCommandEvent& event ); void SVG_Print( wxCommandEvent& event );
// User interface update command event handlers. // User interface update command event handlers.
...@@ -204,7 +207,7 @@ public: ...@@ -204,7 +207,7 @@ public:
virtual void SetGridColor(int aColor); virtual void SetGridColor(int aColor);
// Configurations: // Configurations:
void InstallConfigFrame( ); void InstallConfigFrame();
void Process_Config( wxCommandEvent& event ); void Process_Config( wxCommandEvent& event );
PARAM_CFG_ARRAY& GetProjectFileParameters(); PARAM_CFG_ARRAY& GetProjectFileParameters();
...@@ -341,13 +344,14 @@ public: ...@@ -341,13 +344,14 @@ public:
void ReCreateMenuBar(); void ReCreateMenuBar();
LAYER_BOX_SELECTOR* ReCreateLayerBox( EDA_TOOLBAR* parent ); LAYER_BOX_SELECTOR* ReCreateLayerBox( EDA_TOOLBAR* parent );
/** Virtual Function OnModify() /**
* Must be called after a board change * Function OnModify
* in order to set the "modify" flag of the current screen * must be called after a board change to set the modified flag.
* and prepare, if needed the refresh of the 3D frame showing the footprint * <p>
* do not forget to call the basic OnModify function to update auxiliary info * Reloads the 3D view if required and calls the base PCB_BASE_FRAME::OnModify function
* to update auxiliary information.
*/ */
virtual void OnModify( ); virtual void OnModify();
/** /**
* Function IsElementVisible * Function IsElementVisible
...@@ -375,7 +379,7 @@ public: ...@@ -375,7 +379,7 @@ public:
* Function SetVisibleAlls * Function SetVisibleAlls
* Set the status of all visible element categories and layers to VISIBLE * Set the status of all visible element categories and layers to VISIBLE
*/ */
void SetVisibleAlls( ); void SetVisibleAlls();
/** /**
* Function ReFillLayerWidget * Function ReFillLayerWidget
...@@ -384,12 +388,16 @@ public: ...@@ -384,12 +388,16 @@ public:
*/ */
void ReFillLayerWidget(); void ReFillLayerWidget();
/**
* Function Show3D_Frame
* displays the 3D view of current printed circuit board.
*/
void Show3D_Frame( wxCommandEvent& event ); void Show3D_Frame( wxCommandEvent& event );
void GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey = 0 ); void GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey = 0 );
/** /**
* Function ShowDesignRulesEditor * Function ShowDesignRulesEditor
* Display the Design Rules Editor. * displays the Design Rules Editor.
*/ */
void ShowDesignRulesEditor( wxCommandEvent& event ); void ShowDesignRulesEditor( wxCommandEvent& event );
...@@ -484,7 +492,7 @@ public: ...@@ -484,7 +492,7 @@ public:
virtual int ReturnBlockCommand( int aKey ); virtual int ReturnBlockCommand( int aKey );
/** /**
* Function HandleBlockPlace( ) * Function HandleBlockPlace()
* Called after HandleBlockEnd, when a block command needs to be * Called after HandleBlockEnd, when a block command needs to be
* executed after the block is moved to its new place * executed after the block is moved to its new place
* (bloc move, drag, copy .. ) * (bloc move, drag, copy .. )
...@@ -493,7 +501,7 @@ public: ...@@ -493,7 +501,7 @@ public:
virtual void HandleBlockPlace( wxDC* DC ); virtual void HandleBlockPlace( wxDC* DC );
/** /**
* Function HandleBlockEnd( ) * Function HandleBlockEnd()
* Handle the "end" of a block command, * Handle the "end" of a block command,
* i.e. is called at the end of the definition of the area of a block. * i.e. is called at the end of the definition of the area of a block.
* depending on the current block command, this command is executed * depending on the current block command, this command is executed
...@@ -567,11 +575,16 @@ public: ...@@ -567,11 +575,16 @@ public:
void ToPostProcess( wxCommandEvent& event ); void ToPostProcess( wxCommandEvent& event );
void OnFileHistory( wxCommandEvent& event ); void OnFileHistory( wxCommandEvent& event );
/**
* Function Files_io
* is the command event handler for read and write file commands.
*/
void Files_io( wxCommandEvent& event ); void Files_io( wxCommandEvent& event );
/** /**
* Function LoadOnePcbFile * Function LoadOnePcbFile
* Load a Kicad board (.brd) file. * loads a Kicad board (.brd) from \a aFileName.
* *
* @param aFileName - File name including path. If empty, a file dialog will * @param aFileName - File name including path. If empty, a file dialog will
* be displayed. * be displayed.
...@@ -595,7 +608,16 @@ public: ...@@ -595,7 +608,16 @@ public:
*/ */
int ReadPcbFile( LINE_READER* aReader, bool Append ); int ReadPcbFile( LINE_READER* aReader, bool Append );
bool SavePcbFile( const wxString& FileName ); /**
* Function SavePcbFile
* writes the board data structures to \a a aFileName
*
* @param aFileName The file name to write or wxEmptyString to prompt user for
* file name.
* @return True if file was saved successfully.
*/
bool SavePcbFile( const wxString& aFileName );
int SavePcbFormatAscii( FILE* File ); int SavePcbFormatAscii( FILE* File );
bool WriteGeneralDescrPcb( FILE* File ); bool WriteGeneralDescrPcb( FILE* File );
...@@ -643,7 +665,7 @@ public: ...@@ -643,7 +665,7 @@ public:
* @param aFullFileName = the full filename of the file to create * @param aFullFileName = the full filename of the file to create
* @param aScale = the general scaling factor. 1.0 to export in inches * @param aScale = the general scaling factor. 1.0 to export in inches
* @param aExport3DFiles = true to copy 3D shapes in the subir a3D_Subdir * @param aExport3DFiles = true to copy 3D shapes in the subir a3D_Subdir
* @param a3D_Subdir = sub directory where 3D sahpes files are copied * @param a3D_Subdir = sub directory where 3D shapes files are copied
* used only when aExport3DFiles == true * used only when aExport3DFiles == true
* @return true if Ok. * @return true if Ok.
*/ */
...@@ -761,11 +783,15 @@ public: ...@@ -761,11 +783,15 @@ public:
// Track and via edition: // Track and via edition:
void Via_Edit_Control( wxCommandEvent& event ); void Via_Edit_Control( wxCommandEvent& event );
/* Return true if a microvia can be put on board /**
* Function IsMicroViaAcceptable
* return true if a microvia can be placed on the board.
* <p>
* A microvia is a small via restricted to 2 near neighbor layers * A microvia is a small via restricted to 2 near neighbor layers
* because its is hole is made by laser which can penetrate only one layer * because its is hole is made by laser which can penetrate only one layer
* It is mainly used to connect BGA to the first inner layer * It is mainly used to connect BGA to the first inner layer
* And it is allowed from an external layer to the first inner layer * And it is allowed from an external layer to the first inner layer
* </p>
*/ */
bool IsMicroViaAcceptable( void ); bool IsMicroViaAcceptable( void );
...@@ -1158,6 +1184,17 @@ public: ...@@ -1158,6 +1184,17 @@ public:
*/ */
virtual void SetLanguage( wxCommandEvent& event ); virtual void SetLanguage( wxCommandEvent& event );
/**
* Function UpdateTitle
* sets the main window title bar text.
* <p>
* If file name defined by PCB_SCREEN::m_FileName is not set, the title is set to the
* application name appended with no file. Otherwise, the title is set to the full path
* and file name and read only is appended to the title if the user does not have write
* access to the file.
*/
void UpdateTitle();
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };
......
...@@ -36,11 +36,7 @@ static void RotateMarkedItems( MODULE* module, wxPoint offset ); ...@@ -36,11 +36,7 @@ static void RotateMarkedItems( MODULE* module, wxPoint offset );
static void DeleteMarkedItems( MODULE* module ); static void DeleteMarkedItems( MODULE* module );
/* Return the block command (BLOCK_MOVE, BLOCK_COPY...) corresponding to int FOOTPRINT_EDIT_FRAME::ReturnBlockCommand( int key )
* the key (ALT, SHIFT ALT ..) pressed when dragging mouse and left or
* middle button pressed
*/
int WinEDA_ModuleEditFrame::ReturnBlockCommand( int key )
{ {
int cmd; int cmd;
...@@ -83,17 +79,7 @@ int WinEDA_ModuleEditFrame::ReturnBlockCommand( int key ) ...@@ -83,17 +79,7 @@ int WinEDA_ModuleEditFrame::ReturnBlockCommand( int key )
} }
/** bool FOOTPRINT_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
* Function HandleBlockEnd( )
* Handle the "end" of a block command,
* i.e. is called at the end of the definition of the area of a block.
* depending on the current block command, this command is executed
* or parameters are initialized to prepare a call to HandleBlockPlace
* in GetScreen()->m_BlockLocate
* @return false if no item selected, or command finished,
* true if some items found and HandleBlockPlace must be called later
*/
bool WinEDA_ModuleEditFrame::HandleBlockEnd( wxDC* DC )
{ {
int itemsCount = 0; int itemsCount = 0;
bool nextcmd = false; bool nextcmd = false;
...@@ -121,8 +107,8 @@ bool WinEDA_ModuleEditFrame::HandleBlockEnd( wxDC* DC ) ...@@ -121,8 +107,8 @@ bool WinEDA_ModuleEditFrame::HandleBlockEnd( wxDC* DC )
case BLOCK_DRAG: /* Drag */ case BLOCK_DRAG: /* Drag */
case BLOCK_MOVE: /* Move */ case BLOCK_MOVE: /* Move */
case BLOCK_COPY: /* Copy */ case BLOCK_COPY: /* Copy */
itemsCount = MarkItemsInBloc( currentModule, itemsCount = MarkItemsInBloc( currentModule, GetScreen()->m_BlockLocate );
GetScreen()->m_BlockLocate );
if( itemsCount ) if( itemsCount )
{ {
nextcmd = true; nextcmd = true;
...@@ -147,8 +133,10 @@ bool WinEDA_ModuleEditFrame::HandleBlockEnd( wxDC* DC ) ...@@ -147,8 +133,10 @@ bool WinEDA_ModuleEditFrame::HandleBlockEnd( wxDC* DC )
case BLOCK_DELETE: /* Delete */ case BLOCK_DELETE: /* Delete */
itemsCount = MarkItemsInBloc( currentModule, GetScreen()->m_BlockLocate ); itemsCount = MarkItemsInBloc( currentModule, GetScreen()->m_BlockLocate );
if( itemsCount ) if( itemsCount )
SaveCopyInUndoList( currentModule, UR_MODEDIT ); SaveCopyInUndoList( currentModule, UR_MODEDIT );
DeleteMarkedItems( currentModule ); DeleteMarkedItems( currentModule );
break; break;
...@@ -158,8 +146,10 @@ bool WinEDA_ModuleEditFrame::HandleBlockEnd( wxDC* DC ) ...@@ -158,8 +146,10 @@ bool WinEDA_ModuleEditFrame::HandleBlockEnd( wxDC* DC )
case BLOCK_ROTATE: case BLOCK_ROTATE:
itemsCount = MarkItemsInBloc( currentModule, GetScreen()->m_BlockLocate ); itemsCount = MarkItemsInBloc( currentModule, GetScreen()->m_BlockLocate );
if( itemsCount ) if( itemsCount )
SaveCopyInUndoList( currentModule, UR_MODEDIT ); SaveCopyInUndoList( currentModule, UR_MODEDIT );
RotateMarkedItems( currentModule, GetScreen()->m_BlockLocate.Centre() ); RotateMarkedItems( currentModule, GetScreen()->m_BlockLocate.Centre() );
break; break;
...@@ -168,8 +158,10 @@ bool WinEDA_ModuleEditFrame::HandleBlockEnd( wxDC* DC ) ...@@ -168,8 +158,10 @@ bool WinEDA_ModuleEditFrame::HandleBlockEnd( wxDC* DC )
case BLOCK_MIRROR_Y: case BLOCK_MIRROR_Y:
case BLOCK_FLIP: /* mirror */ case BLOCK_FLIP: /* mirror */
itemsCount = MarkItemsInBloc( currentModule, GetScreen()->m_BlockLocate ); itemsCount = MarkItemsInBloc( currentModule, GetScreen()->m_BlockLocate );
if( itemsCount ) if( itemsCount )
SaveCopyInUndoList( currentModule, UR_MODEDIT ); SaveCopyInUndoList( currentModule, UR_MODEDIT );
MirrorMarkedItems( currentModule, GetScreen()->m_BlockLocate.Centre() ); MirrorMarkedItems( currentModule, GetScreen()->m_BlockLocate.Centre() );
break; break;
...@@ -202,15 +194,7 @@ bool WinEDA_ModuleEditFrame::HandleBlockEnd( wxDC* DC ) ...@@ -202,15 +194,7 @@ bool WinEDA_ModuleEditFrame::HandleBlockEnd( wxDC* DC )
} }
/******************************************************/ void FOOTPRINT_EDIT_FRAME::HandleBlockPlace( wxDC* DC )
void WinEDA_ModuleEditFrame::HandleBlockPlace( wxDC* DC )
/******************************************************/
/* Routine to handle the BLOCK PLACE command
* Last routine for block operation for:
* - block move & drag
* - block copy & paste
*/
{ {
MODULE* currentModule = GetBoard()->m_Modules; MODULE* currentModule = GetBoard()->m_Modules;
...@@ -326,6 +310,7 @@ static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wx ...@@ -326,6 +310,7 @@ static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wx
{ {
if( pad->m_Selected == 0 ) if( pad->m_Selected == 0 )
continue; continue;
pad->Draw( aPanel, aDC, g_XorMode, move_offset ); pad->Draw( aPanel, aDC, g_XorMode, move_offset );
} }
} }
...@@ -434,15 +419,18 @@ void MoveMarkedItems( MODULE* module, wxPoint offset ) ...@@ -434,15 +419,18 @@ void MoveMarkedItems( MODULE* module, wxPoint offset )
return; return;
D_PAD* pad = module->m_Pads; D_PAD* pad = module->m_Pads;
for( ; pad != NULL; pad = pad->Next() ) for( ; pad != NULL; pad = pad->Next() )
{ {
if( pad->m_Selected == 0 ) if( pad->m_Selected == 0 )
continue; continue;
pad->SetPosition( pad->GetPosition() + offset ); pad->SetPosition( pad->GetPosition() + offset );
pad->m_Pos0 += offset; pad->m_Pos0 += offset;
} }
item = module->m_Drawings; item = module->m_Drawings;
for( ; item != NULL; item = item->Next() ) for( ; item != NULL; item = item->Next() )
{ {
if( item->m_Selected == 0 ) if( item->m_Selected == 0 )
...@@ -485,20 +473,26 @@ void DeleteMarkedItems( MODULE* module ) ...@@ -485,20 +473,26 @@ void DeleteMarkedItems( MODULE* module )
return; return;
pad = module->m_Pads; pad = module->m_Pads;
for( ; pad != NULL; pad = next_pad ) for( ; pad != NULL; pad = next_pad )
{ {
next_pad = pad->Next(); next_pad = pad->Next();
if( pad->m_Selected == 0 ) if( pad->m_Selected == 0 )
continue; continue;
pad->DeleteStructure(); pad->DeleteStructure();
} }
item = module->m_Drawings; item = module->m_Drawings;
for( ; item != NULL; item = next_item ) for( ; item != NULL; item = next_item )
{ {
next_item = item->Next(); next_item = item->Next();
if( item->m_Selected == 0 ) if( item->m_Selected == 0 )
continue; continue;
item->DeleteStructure(); item->DeleteStructure();
} }
} }
...@@ -515,10 +509,12 @@ void MirrorMarkedItems( MODULE* module, wxPoint offset ) ...@@ -515,10 +509,12 @@ void MirrorMarkedItems( MODULE* module, wxPoint offset )
return; return;
D_PAD* pad = module->m_Pads; D_PAD* pad = module->m_Pads;
for( ; pad != NULL; pad = pad->Next() ) for( ; pad != NULL; pad = pad->Next() )
{ {
if( pad->m_Selected == 0 ) if( pad->m_Selected == 0 )
continue; continue;
SETMIRROR( pad->GetPosition().x ); SETMIRROR( pad->GetPosition().x );
pad->m_Pos0.x = pad->GetPosition().x; pad->m_Pos0.x = pad->GetPosition().x;
NEGATE( pad->m_Offset.x ); NEGATE( pad->m_Offset.x );
...@@ -528,6 +524,7 @@ void MirrorMarkedItems( MODULE* module, wxPoint offset ) ...@@ -528,6 +524,7 @@ void MirrorMarkedItems( MODULE* module, wxPoint offset )
} }
item = module->m_Drawings; item = module->m_Drawings;
for( ; item != NULL; item = item->Next() ) for( ; item != NULL; item = item->Next() )
{ {
if( item->m_Selected == 0 ) if( item->m_Selected == 0 )
...@@ -536,7 +533,8 @@ void MirrorMarkedItems( MODULE* module, wxPoint offset ) ...@@ -536,7 +533,8 @@ void MirrorMarkedItems( MODULE* module, wxPoint offset )
switch( item->Type() ) switch( item->Type() )
{ {
case TYPE_EDGE_MODULE: case TYPE_EDGE_MODULE:
{ EDGE_MODULE * edge = (EDGE_MODULE*) item; {
EDGE_MODULE * edge = (EDGE_MODULE*) item;
SETMIRROR( edge->m_Start.x ); SETMIRROR( edge->m_Start.x );
edge->m_Start0.x = edge->m_Start.x; edge->m_Start0.x = edge->m_Start.x;
SETMIRROR( edge->m_End.x ); SETMIRROR( edge->m_End.x );
...@@ -547,8 +545,7 @@ void MirrorMarkedItems( MODULE* module, wxPoint offset ) ...@@ -547,8 +545,7 @@ void MirrorMarkedItems( MODULE* module, wxPoint offset )
case TYPE_TEXTE_MODULE: case TYPE_TEXTE_MODULE:
SETMIRROR( ( (TEXTE_MODULE*) item )->GetPosition().x ); SETMIRROR( ( (TEXTE_MODULE*) item )->GetPosition().x );
( (TEXTE_MODULE*) item )->m_Pos0.x = ( (TEXTE_MODULE*) item )->m_Pos0.x = ( (TEXTE_MODULE*) item )->GetPosition().x;
( (TEXTE_MODULE*) item )->GetPosition().x;
break; break;
default: default:
...@@ -572,10 +569,12 @@ void RotateMarkedItems( MODULE* module, wxPoint offset ) ...@@ -572,10 +569,12 @@ void RotateMarkedItems( MODULE* module, wxPoint offset )
return; return;
D_PAD* pad = module->m_Pads; D_PAD* pad = module->m_Pads;
for( ; pad != NULL; pad = pad->Next() ) for( ; pad != NULL; pad = pad->Next() )
{ {
if( pad->m_Selected == 0 ) if( pad->m_Selected == 0 )
continue; continue;
ROTATE( pad->GetPosition() ); ROTATE( pad->GetPosition() );
pad->m_Pos0 = pad->GetPosition(); pad->m_Pos0 = pad->GetPosition();
pad->m_Orient += 900; pad->m_Orient += 900;
...@@ -583,6 +582,7 @@ void RotateMarkedItems( MODULE* module, wxPoint offset ) ...@@ -583,6 +582,7 @@ void RotateMarkedItems( MODULE* module, wxPoint offset )
} }
item = module->m_Drawings; item = module->m_Drawings;
for( ; item != NULL; item = item->Next() ) for( ; item != NULL; item = item->Next() )
{ {
if( item->m_Selected == 0 ) if( item->m_Selected == 0 )
...@@ -592,16 +592,14 @@ void RotateMarkedItems( MODULE* module, wxPoint offset ) ...@@ -592,16 +592,14 @@ void RotateMarkedItems( MODULE* module, wxPoint offset )
{ {
case TYPE_EDGE_MODULE: case TYPE_EDGE_MODULE:
ROTATE( ( (EDGE_MODULE*) item )->m_Start ); ROTATE( ( (EDGE_MODULE*) item )->m_Start );
( (EDGE_MODULE*) item )->m_Start0 = ( (EDGE_MODULE*) item )->m_Start0 = ( (EDGE_MODULE*) item )->m_Start;
( (EDGE_MODULE*) item )->m_Start;
ROTATE( ( (EDGE_MODULE*) item )->m_End ); ROTATE( ( (EDGE_MODULE*) item )->m_End );
( (EDGE_MODULE*) item )->m_End0 = ( (EDGE_MODULE*) item )->m_End; ( (EDGE_MODULE*) item )->m_End0 = ( (EDGE_MODULE*) item )->m_End;
break; break;
case TYPE_TEXTE_MODULE: case TYPE_TEXTE_MODULE:
ROTATE( ( (TEXTE_MODULE*) item )->GetPosition() ); ROTATE( ( (TEXTE_MODULE*) item )->GetPosition() );
( (TEXTE_MODULE*) item )->m_Pos0 = ( (TEXTE_MODULE*) item )->m_Pos0 = ( (TEXTE_MODULE*) item )->GetPosition();
( (TEXTE_MODULE*) item )->GetPosition();
( (TEXTE_MODULE*) item )->m_Orient += 900; ( (TEXTE_MODULE*) item )->m_Orient += 900;
break; break;
...@@ -622,10 +620,12 @@ void ClearMarkItems( MODULE* module ) ...@@ -622,10 +620,12 @@ void ClearMarkItems( MODULE* module )
return; return;
item = module->m_Drawings; item = module->m_Drawings;
for( ; item != NULL; item = item->Next() ) for( ; item != NULL; item = item->Next() )
item->m_Flags = item->m_Selected = 0; item->m_Flags = item->m_Selected = 0;
item = module->m_Pads; item = module->m_Pads;
for( ; item != NULL; item = item->Next() ) for( ; item != NULL; item = item->Next() )
item->m_Flags = item->m_Selected = 0; item->m_Flags = item->m_Selected = 0;
} }
...@@ -645,10 +645,12 @@ int MarkItemsInBloc( MODULE* module, EDA_RECT& Rect ) ...@@ -645,10 +645,12 @@ int MarkItemsInBloc( MODULE* module, EDA_RECT& Rect )
return 0; return 0;
pad = module->m_Pads; pad = module->m_Pads;
for( ; pad != NULL; pad = pad->Next() ) for( ; pad != NULL; pad = pad->Next() )
{ {
pad->m_Selected = 0; pad->m_Selected = 0;
pos = pad->GetPosition(); pos = pad->GetPosition();
if( Rect.Contains( pos ) ) if( Rect.Contains( pos ) )
{ {
pad->m_Selected = IS_SELECTED; pad->m_Selected = IS_SELECTED;
...@@ -657,6 +659,7 @@ int MarkItemsInBloc( MODULE* module, EDA_RECT& Rect ) ...@@ -657,6 +659,7 @@ int MarkItemsInBloc( MODULE* module, EDA_RECT& Rect )
} }
item = module->m_Drawings; item = module->m_Drawings;
for( ; item != NULL; item = item->Next() ) for( ; item != NULL; item = item->Next() )
{ {
item->m_Selected = 0; item->m_Selected = 0;
...@@ -669,15 +672,18 @@ int MarkItemsInBloc( MODULE* module, EDA_RECT& Rect ) ...@@ -669,15 +672,18 @@ int MarkItemsInBloc( MODULE* module, EDA_RECT& Rect )
item->m_Selected = IS_SELECTED; item->m_Selected = IS_SELECTED;
ItemsCount++; ItemsCount++;
} }
break; break;
case TYPE_TEXTE_MODULE: case TYPE_TEXTE_MODULE:
pos = ( (TEXTE_MODULE*) item )->GetPosition(); pos = ( (TEXTE_MODULE*) item )->GetPosition();
if( Rect.Contains( pos ) ) if( Rect.Contains( pos ) )
{ {
item->m_Selected = IS_SELECTED; item->m_Selected = IS_SELECTED;
ItemsCount++; ItemsCount++;
} }
break; break;
default: default:
......
...@@ -24,22 +24,19 @@ ...@@ -24,22 +24,19 @@
FOOTPRINT_LIBRARY::FOOTPRINT_LIBRARY( FILE * aFile, FILTER_READER * aReader ) FOOTPRINT_LIBRARY::FOOTPRINT_LIBRARY( FILE * aFile, FILTER_READER * aReader )
{ {
wxASSERT( m_reader || m_file ); wxASSERT( aFile != NULL );
m_file = aFile; m_file = aFile;
m_reader = aReader; m_reader = aReader;
m_LineNum = 0; m_LineNum = 0;
} }
/* function IsLibrary
* Read the library file Header
* return > 0 if this file is a footprint lib
* (currentlu return 1 but could be a value > 1 for future file formats
*/
int FOOTPRINT_LIBRARY::IsLibrary( ) int FOOTPRINT_LIBRARY::IsLibrary( )
{ {
char *line; char *line;
char buffer[1024]; char buffer[1024];
if( m_reader ) if( m_reader )
{ {
m_reader->ReadLine(); m_reader->ReadLine();
...@@ -52,6 +49,7 @@ int FOOTPRINT_LIBRARY::IsLibrary( ) ...@@ -52,6 +49,7 @@ int FOOTPRINT_LIBRARY::IsLibrary( )
} }
StrPurge( line ); StrPurge( line );
if( strnicmp( line, ENTETE_LIBRAIRIE, L_ENTETE_LIB ) == 0 ) if( strnicmp( line, ENTETE_LIBRAIRIE, L_ENTETE_LIB ) == 0 )
return 1; return 1;
...@@ -59,11 +57,6 @@ int FOOTPRINT_LIBRARY::IsLibrary( ) ...@@ -59,11 +57,6 @@ int FOOTPRINT_LIBRARY::IsLibrary( )
} }
/*
* function RebuildIndex
* Read the full library file and build the list od footprints found
* and do not use the $INDEX ... $EndINDEX section
*/
bool FOOTPRINT_LIBRARY::RebuildIndex() bool FOOTPRINT_LIBRARY::RebuildIndex()
{ {
m_List.Clear(); m_List.Clear();
...@@ -76,6 +69,7 @@ bool FOOTPRINT_LIBRARY::RebuildIndex() ...@@ -76,6 +69,7 @@ bool FOOTPRINT_LIBRARY::RebuildIndex()
{ {
char * line = m_reader->Line(); char * line = m_reader->Line();
StrPurge( line ); StrPurge( line );
if( strnicmp( line, "$MODULE", 7 ) == 0 ) if( strnicmp( line, "$MODULE", 7 ) == 0 )
{ {
sscanf( line + 7, " %s", name ); sscanf( line + 7, " %s", name );
...@@ -86,6 +80,7 @@ bool FOOTPRINT_LIBRARY::RebuildIndex() ...@@ -86,6 +80,7 @@ bool FOOTPRINT_LIBRARY::RebuildIndex()
else else
{ {
char line[1024]; char line[1024];
while( GetLine( m_file, line, &m_LineNum ) ) while( GetLine( m_file, line, &m_LineNum ) )
{ {
if( strnicmp( line, "$MODULE", 7 ) == 0 ) if( strnicmp( line, "$MODULE", 7 ) == 0 )
...@@ -99,29 +94,30 @@ bool FOOTPRINT_LIBRARY::RebuildIndex() ...@@ -99,29 +94,30 @@ bool FOOTPRINT_LIBRARY::RebuildIndex()
return true; return true;
} }
/* function ReadSectionIndex
* Read the $INDEX ... $EndINDEX section
* list of footprints is stored in m_List
*/
bool FOOTPRINT_LIBRARY::ReadSectionIndex() bool FOOTPRINT_LIBRARY::ReadSectionIndex()
{ {
// Some broken INDEX sections have more than one section // Some broken INDEX sections have more than one section
// So we must read the next line after $EndINDEX tag, // So we must read the next line after $EndINDEX tag,
// to see if this is not a new $INDEX tag. // to see if this is not a new $INDEX tag.
bool exit = false; bool exit = false;
if( m_reader ) if( m_reader )
{ {
while( m_reader->ReadLine() ) while( m_reader->ReadLine() )
{ {
char * line = m_reader->Line(); char * line = m_reader->Line();
StrPurge( line ); StrPurge( line );
if( strnicmp( line, "$INDEX", 6 ) == 0 ) if( strnicmp( line, "$INDEX", 6 ) == 0 )
{ {
exit = false; exit = false;
while( m_reader->ReadLine() ) while( m_reader->ReadLine() )
{ {
StrPurge( line ); StrPurge( line );
m_List.Add( FROM_UTF8( line ) ); m_List.Add( FROM_UTF8( line ) );
if( strnicmp( line, "$EndINDEX", 9 ) == 0 ) if( strnicmp( line, "$EndINDEX", 9 ) == 0 )
{ {
exit = true; exit = true;
...@@ -136,15 +132,18 @@ bool FOOTPRINT_LIBRARY::ReadSectionIndex() ...@@ -136,15 +132,18 @@ bool FOOTPRINT_LIBRARY::ReadSectionIndex()
else else
{ {
char line[1024]; char line[1024];
while( GetLine( m_file, line, &m_LineNum ) ) while( GetLine( m_file, line, &m_LineNum ) )
{ {
if( strnicmp( line, "$INDEX", 6 ) == 0 ) if( strnicmp( line, "$INDEX", 6 ) == 0 )
{ {
exit = false; exit = false;
while( GetLine( m_file, line, &m_LineNum ) ) while( GetLine( m_file, line, &m_LineNum ) )
{ {
StrPurge( line ); StrPurge( line );
m_List.Add( FROM_UTF8( line ) ); m_List.Add( FROM_UTF8( line ) );
if( strnicmp( line, "$EndINDEX", 9 ) == 0 ) if( strnicmp( line, "$EndINDEX", 9 ) == 0 )
{ {
exit = true; exit = true;
...@@ -153,16 +152,16 @@ bool FOOTPRINT_LIBRARY::ReadSectionIndex() ...@@ -153,16 +152,16 @@ bool FOOTPRINT_LIBRARY::ReadSectionIndex()
} }
} }
else if( exit ) else if( exit )
{
break; break;
}
} }
} }
return true; return true;
} }
/* Function WriteHeader
* Write the library header
*/
bool FOOTPRINT_LIBRARY::WriteHeader() bool FOOTPRINT_LIBRARY::WriteHeader()
{ {
char line[256]; char line[256];
...@@ -171,34 +170,28 @@ bool FOOTPRINT_LIBRARY::WriteHeader() ...@@ -171,34 +170,28 @@ bool FOOTPRINT_LIBRARY::WriteHeader()
return true; return true;
} }
/* Function WriteSectionIndex
* Write the $INDEX ... $EndINDEX section.
* This section is filled by names in m_List
*/
bool FOOTPRINT_LIBRARY::WriteSectionIndex() bool FOOTPRINT_LIBRARY::WriteSectionIndex()
{ {
fputs( "$INDEX\n", m_file ); fputs( "$INDEX\n", m_file );
for( unsigned ii = 0; ii < m_List.GetCount(); ii++ ) for( unsigned ii = 0; ii < m_List.GetCount(); ii++ )
{ {
fprintf( m_file, "%s\n", TO_UTF8( m_List[ii] ) ); fprintf( m_file, "%s\n", TO_UTF8( m_List[ii] ) );
} }
fputs( "$EndINDEX\n", m_file ); fputs( "$EndINDEX\n", m_file );
return true; return true;
} }
/* Function WriteEndOfFile
* Write the last line section.
*/
bool FOOTPRINT_LIBRARY::WriteEndOfFile() bool FOOTPRINT_LIBRARY::WriteEndOfFile()
{ {
fputs( "$EndLIBRARY\n", m_file ); fputs( "$EndLIBRARY\n", m_file );
return true; return true;
} }
/*
* Function FindInList
* Search for aName int m_List and return true if found
*/
bool FOOTPRINT_LIBRARY::FindInList( const wxString & aName ) bool FOOTPRINT_LIBRARY::FindInList( const wxString & aName )
{ {
for( unsigned ii = 0; ii < m_List.GetCount(); ii++ ) for( unsigned ii = 0; ii < m_List.GetCount(); ii++ )
...@@ -210,11 +203,7 @@ bool FOOTPRINT_LIBRARY::FindInList( const wxString & aName ) ...@@ -210,11 +203,7 @@ bool FOOTPRINT_LIBRARY::FindInList( const wxString & aName )
return false; return false;
} }
/**
* Function RemoveFromList
* Search for aName int m_List and remove it
* @return true if found and removed
*/
bool FOOTPRINT_LIBRARY::RemoveFromList( const wxString & aName ) bool FOOTPRINT_LIBRARY::RemoveFromList( const wxString & aName )
{ {
for( unsigned ii = 0; ii < m_List.GetCount(); ii++ ) for( unsigned ii = 0; ii < m_List.GetCount(); ii++ )
...@@ -229,10 +218,7 @@ bool FOOTPRINT_LIBRARY::RemoveFromList( const wxString & aName ) ...@@ -229,10 +218,7 @@ bool FOOTPRINT_LIBRARY::RemoveFromList( const wxString & aName )
return false; return false;
} }
/**
* Function SortList
* Sort m_List in alphabetic order
*/
void FOOTPRINT_LIBRARY::SortList() void FOOTPRINT_LIBRARY::SortList()
{ {
m_List.Sort(); m_List.Sort();
......
...@@ -14,7 +14,7 @@ public: ...@@ -14,7 +14,7 @@ public:
int m_LineNum; // the line count int m_LineNum; // the line count
private: private:
FILTER_READER * m_reader; // FILTER_READER to read file. id NULL, use m_file FILTER_READER * m_reader; // FILTER_READER to read file. If NULL, use m_file
FILE * m_file; // footprint file to read/write. FILE * m_file; // footprint file to read/write.
public: public:
...@@ -23,7 +23,7 @@ public: ...@@ -23,7 +23,7 @@ public:
* @param aFile = a FILE * pointer used for write operations, * @param aFile = a FILE * pointer used for write operations,
* and read operations when aReader = NULL * and read operations when aReader = NULL
* @param aReader = a FILTER_READER pointer used for read operations * @param aReader = a FILTER_READER pointer used for read operations
* If NULL, a direct aFILE read is used * If NULL, a direct aFile read is used
*/ */
FOOTPRINT_LIBRARY( FILE * aFile, FILTER_READER * aReader = NULL ); FOOTPRINT_LIBRARY( FILE * aFile, FILTER_READER * aReader = NULL );
...@@ -39,7 +39,7 @@ public: ...@@ -39,7 +39,7 @@ public:
/** /**
* function RebuildIndex * function RebuildIndex
* Read the full library file and build the list od footprints found * Read the full library file and build the list of footprints found
* Do not use the $INDEX ... $EndINDEX section * Do not use the $INDEX ... $EndINDEX section
*/ */
bool RebuildIndex(); bool RebuildIndex();
......
...@@ -143,7 +143,9 @@ BOARD_ITEM* PCB_BASE_FRAME::PcbGeneralLocateAndDisplay( int aHotKeyCode ) ...@@ -143,7 +143,9 @@ BOARD_ITEM* PCB_BASE_FRAME::PcbGeneralLocateAndDisplay( int aHotKeyCode )
ii--; ii--;
} }
else else
{
timestampzone = item->m_TimeStamp; timestampzone = item->m_TimeStamp;
}
} }
if( m_Collector->GetCount() <= 1 ) if( m_Collector->GetCount() <= 1 )
...@@ -152,7 +154,7 @@ BOARD_ITEM* PCB_BASE_FRAME::PcbGeneralLocateAndDisplay( int aHotKeyCode ) ...@@ -152,7 +154,7 @@ BOARD_ITEM* PCB_BASE_FRAME::PcbGeneralLocateAndDisplay( int aHotKeyCode )
SetCurItem( item ); SetCurItem( item );
} }
// If the count is 2, and first item is a pad or moduletext, and the 2nd item is its // If the count is 2, and first item is a pad or module text, and the 2nd item is its
// parent module: // parent module:
else if( m_Collector->GetCount() == 2 else if( m_Collector->GetCount() == 2
&& ( (*m_Collector)[0]->Type() == TYPE_PAD || (*m_Collector)[0]->Type() == && ( (*m_Collector)[0]->Type() == TYPE_PAD || (*m_Collector)[0]->Type() ==
...@@ -259,7 +261,7 @@ void PCB_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aH ...@@ -259,7 +261,7 @@ void PCB_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aH
} }
GetScreen()->SetFileName( tmpFileName ); GetScreen()->SetFileName( tmpFileName );
SetTitle( GetScreen()->GetFileName() ); UpdateTitle();
} }
oldpos = GetScreen()->GetCrossHairPosition(); oldpos = GetScreen()->GetCrossHairPosition();
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
#include "dialog_edit_module_for_Modedit.h" #include "dialog_edit_module_for_Modedit.h"
DIALOG_MODULE_MODULE_EDITOR::DIALOG_MODULE_MODULE_EDITOR( WinEDA_ModuleEditFrame* aParent, DIALOG_MODULE_MODULE_EDITOR::DIALOG_MODULE_MODULE_EDITOR( FOOTPRINT_EDIT_FRAME* aParent,
MODULE* aModule ) : MODULE* aModule ) :
DIALOG_MODULE_MODULE_EDITOR_BASE( aParent ) DIALOG_MODULE_MODULE_EDITOR_BASE( aParent )
{ {
......
...@@ -17,7 +17,7 @@ class DIALOG_MODULE_MODULE_EDITOR : public DIALOG_MODULE_MODULE_EDITOR_BASE ...@@ -17,7 +17,7 @@ class DIALOG_MODULE_MODULE_EDITOR : public DIALOG_MODULE_MODULE_EDITOR_BASE
{ {
private: private:
WinEDA_ModuleEditFrame* m_Parent; FOOTPRINT_EDIT_FRAME* m_Parent;
MODULE* m_CurrentModule; MODULE* m_CurrentModule;
TEXTE_MODULE* m_ReferenceCopy; TEXTE_MODULE* m_ReferenceCopy;
TEXTE_MODULE* m_ValueCopy; TEXTE_MODULE* m_ValueCopy;
...@@ -30,7 +30,7 @@ private: ...@@ -30,7 +30,7 @@ private:
public: public:
// Constructor and destructor // Constructor and destructor
DIALOG_MODULE_MODULE_EDITOR( WinEDA_ModuleEditFrame* aParent, MODULE* aModule ); DIALOG_MODULE_MODULE_EDITOR( FOOTPRINT_EDIT_FRAME* aParent, MODULE* aModule );
~DIALOG_MODULE_MODULE_EDITOR(); ~DIALOG_MODULE_MODULE_EDITOR();
private: private:
......
...@@ -25,7 +25,7 @@ void PCB_EDIT_FRAME::OnConfigurePcbOptions( wxCommandEvent& aEvent ) ...@@ -25,7 +25,7 @@ void PCB_EDIT_FRAME::OnConfigurePcbOptions( wxCommandEvent& aEvent )
} }
void WinEDA_ModuleEditFrame::InstallOptionsFrame( const wxPoint& pos ) void FOOTPRINT_EDIT_FRAME::InstallOptionsFrame( const wxPoint& pos )
{ {
DIALOG_GRAPHIC_ITEMS_OPTIONS dlg( this ); DIALOG_GRAPHIC_ITEMS_OPTIONS dlg( this );
dlg.ShowModal(); dlg.ShowModal();
......
...@@ -56,7 +56,7 @@ private: ...@@ -56,7 +56,7 @@ private:
/*************************************************************/ /*************************************************************/
void WinEDA_ModuleEditFrame::ToPrinter( wxCommandEvent& event ) void FOOTPRINT_EDIT_FRAME::ToPrinter( wxCommandEvent& event )
/*************************************************************/ /*************************************************************/
/* Virtual function: /* Virtual function:
* Display the print dialog * Display the print dialog
......
...@@ -20,21 +20,17 @@ ...@@ -20,21 +20,17 @@
static void ShowNewEdgeModule( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition, static void ShowNewEdgeModule( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
bool erase ); bool erase );
static void Abort_Move_ModuleOutline( EDA_DRAW_PANEL* Panel, wxDC* DC ); static void Abort_Move_ModuleOutline( EDA_DRAW_PANEL* Panel, wxDC* DC );
static void ShowCurrentOutlineWhileMoving( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition, static void ShowCurrentOutlineWhileMoving( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
bool aErase ); const wxPoint& aPosition, bool aErase );
int ArcValue = 900; int ArcValue = 900;
static wxPoint MoveVector; // Move vector for move edge static wxPoint MoveVector; // Move vector for move edge
static wxPoint CursorInitialPosition; // Mouse cursor inital position for static wxPoint CursorInitialPosition; // Mouse cursor initial position for move command
// move command
/* Function to initialise the move function params of a graphic item type void FOOTPRINT_EDIT_FRAME::Start_Move_EdgeMod( EDGE_MODULE* Edge, wxDC* DC )
* DRAWSEGMENT
*/
void WinEDA_ModuleEditFrame::Start_Move_EdgeMod( EDGE_MODULE* Edge, wxDC* DC )
{ {
if( Edge == NULL ) if( Edge == NULL )
return; return;
...@@ -49,10 +45,7 @@ void WinEDA_ModuleEditFrame::Start_Move_EdgeMod( EDGE_MODULE* Edge, wxDC* DC ) ...@@ -49,10 +45,7 @@ void WinEDA_ModuleEditFrame::Start_Move_EdgeMod( EDGE_MODULE* Edge, wxDC* DC )
} }
/* void FOOTPRINT_EDIT_FRAME::Place_EdgeMod( EDGE_MODULE* Edge )
* Function to place a graphic item type EDGE_MODULE currently moved
*/
void WinEDA_ModuleEditFrame::Place_EdgeMod( EDGE_MODULE* Edge )
{ {
if( Edge == NULL ) if( Edge == NULL )
return; return;
...@@ -75,7 +68,8 @@ void WinEDA_ModuleEditFrame::Place_EdgeMod( EDGE_MODULE* Edge ) ...@@ -75,7 +68,8 @@ void WinEDA_ModuleEditFrame::Place_EdgeMod( EDGE_MODULE* Edge )
/* Redraw the current moved graphic item when mouse is moving /* Redraw the current moved graphic item when mouse is moving
* Use this function to show an existing outline, in move command * Use this function to show an existing outline, in move command
*/ */
static void ShowCurrentOutlineWhileMoving( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition, bool aErase ) static void ShowCurrentOutlineWhileMoving( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
const wxPoint& aPosition, bool aErase )
{ {
BASE_SCREEN* screen = aPanel->GetScreen(); BASE_SCREEN* screen = aPanel->GetScreen();
EDGE_MODULE* Edge = (EDGE_MODULE*) screen->GetCurItem(); EDGE_MODULE* Edge = (EDGE_MODULE*) screen->GetCurItem();
...@@ -102,7 +96,7 @@ static void ShowCurrentOutlineWhileMoving( EDA_DRAW_PANEL* aPanel, wxDC* aDC, co ...@@ -102,7 +96,7 @@ static void ShowCurrentOutlineWhileMoving( EDA_DRAW_PANEL* aPanel, wxDC* aDC, co
* Use this function to show a new outline, in begin command * Use this function to show a new outline, in begin command
*/ */
static void ShowNewEdgeModule( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition, static void ShowNewEdgeModule( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
bool aErase ) bool aErase )
{ {
BASE_SCREEN* screen = aPanel->GetScreen(); BASE_SCREEN* screen = aPanel->GetScreen();
EDGE_MODULE* Edge = (EDGE_MODULE*) screen->GetCurItem(); EDGE_MODULE* Edge = (EDGE_MODULE*) screen->GetCurItem();
...@@ -129,14 +123,7 @@ static void ShowNewEdgeModule( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& ...@@ -129,14 +123,7 @@ static void ShowNewEdgeModule( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint&
} }
/** void FOOTPRINT_EDIT_FRAME::Edit_Edge_Width( EDGE_MODULE* aEdge )
* Function Edit_Edge_Width
* changes the width of module perimeter lines, EDGE_MODULEs.
* param ModuleSegmentWidth (global) = new width
* @param aEdge = edge to edit, or NULL. If aEdge == NULL change
* the width of all footprint's edges
*/
void WinEDA_ModuleEditFrame::Edit_Edge_Width( EDGE_MODULE* aEdge )
{ {
MODULE* Module = GetBoard()->m_Modules; MODULE* Module = GetBoard()->m_Modules;
...@@ -161,12 +148,7 @@ void WinEDA_ModuleEditFrame::Edit_Edge_Width( EDGE_MODULE* aEdge ) ...@@ -161,12 +148,7 @@ void WinEDA_ModuleEditFrame::Edit_Edge_Width( EDGE_MODULE* aEdge )
} }
/* Change the EDGE_MODULE Edge layer, (The new layer will be asked) void FOOTPRINT_EDIT_FRAME::Edit_Edge_Layer( EDGE_MODULE* Edge )
* if Edge == NULL change the layer of the entire footprint edges
* @param Edge = edge to edit, or NULL
* @param DC = current Device Context
*/
void WinEDA_ModuleEditFrame::Edit_Edge_Layer( EDGE_MODULE* Edge )
{ {
MODULE* Module = GetBoard()->m_Modules; MODULE* Module = GetBoard()->m_Modules;
int new_layer = SILKSCREEN_N_FRONT; int new_layer = SILKSCREEN_N_FRONT;
...@@ -176,9 +158,7 @@ void WinEDA_ModuleEditFrame::Edit_Edge_Layer( EDGE_MODULE* Edge ) ...@@ -176,9 +158,7 @@ void WinEDA_ModuleEditFrame::Edit_Edge_Layer( EDGE_MODULE* Edge )
/* Ask for the new layer */ /* Ask for the new layer */
new_layer = SelectLayer( new_layer, new_layer = SelectLayer( new_layer, FIRST_COPPER_LAYER, LAST_NO_COPPER_LAYER );
FIRST_COPPER_LAYER,
LAST_NO_COPPER_LAYER );
if( new_layer < 0 ) if( new_layer < 0 )
return; return;
...@@ -196,15 +176,19 @@ void WinEDA_ModuleEditFrame::Edit_Edge_Layer( EDGE_MODULE* Edge ) ...@@ -196,15 +176,19 @@ void WinEDA_ModuleEditFrame::Edit_Edge_Layer( EDGE_MODULE* Edge )
if( Edge == NULL ) if( Edge == NULL )
{ {
Edge = (EDGE_MODULE*) (BOARD_ITEM*) Module->m_Drawings; Edge = (EDGE_MODULE*) (BOARD_ITEM*) Module->m_Drawings;
for( ; Edge != NULL; Edge = Edge->Next() ) for( ; Edge != NULL; Edge = Edge->Next() )
{ {
if( Edge->Type() != TYPE_EDGE_MODULE ) if( Edge->Type() != TYPE_EDGE_MODULE )
continue; continue;
Edge->SetLayer( new_layer ); Edge->SetLayer( new_layer );
} }
} }
else else
{
Edge->SetLayer( new_layer ); Edge->SetLayer( new_layer );
}
OnModify(); OnModify();
Module->Set_Rectangle_Encadrement(); Module->Set_Rectangle_Encadrement();
...@@ -212,23 +196,16 @@ void WinEDA_ModuleEditFrame::Edit_Edge_Layer( EDGE_MODULE* Edge ) ...@@ -212,23 +196,16 @@ void WinEDA_ModuleEditFrame::Edit_Edge_Layer( EDGE_MODULE* Edge )
} }
/** void FOOTPRINT_EDIT_FRAME::Enter_Edge_Width( EDGE_MODULE* aEdge )
* Function Enter_Edge_Width
* Edition of width of module outlines
* Ask for a new width.
* Change the width of EDGE_MODULE aEdge if aEdge != NULL
* @param aEdge = edge to edit, or NULL
* changes g_ModuleSegmentWidth (global) = new width
*/
void WinEDA_ModuleEditFrame::Enter_Edge_Width( EDGE_MODULE* aEdge )
{ {
wxString buffer; wxString buffer;
buffer = ReturnStringFromValue( g_UserUnit, g_ModuleSegmentWidth, buffer = ReturnStringFromValue( g_UserUnit, g_ModuleSegmentWidth,
GetScreen()->GetInternalUnits() ); GetScreen()->GetInternalUnits() );
wxTextEntryDialog dlg( this, _( "New Width:" ), _( "Edge Width" ), buffer ); wxTextEntryDialog dlg( this, _( "New Width:" ), _( "Edge Width" ), buffer );
if( dlg.ShowModal() != wxID_OK ) if( dlg.ShowModal() != wxID_OK )
return; // cancelled by user return; // canceled by user
buffer = dlg.GetValue( ); buffer = dlg.GetValue( );
g_ModuleSegmentWidth = ReturnValueFromString( g_UserUnit, buffer, g_ModuleSegmentWidth = ReturnValueFromString( g_UserUnit, buffer,
...@@ -244,19 +221,14 @@ void WinEDA_ModuleEditFrame::Enter_Edge_Width( EDGE_MODULE* aEdge ) ...@@ -244,19 +221,14 @@ void WinEDA_ModuleEditFrame::Enter_Edge_Width( EDGE_MODULE* aEdge )
} }
/** void FOOTPRINT_EDIT_FRAME::Delete_Edge_Module( EDGE_MODULE* Edge )
* Function Delete_Edge_Module
* delete EDGE_MODULE Edge
* @param Edge = edge to delete
*/
void WinEDA_ModuleEditFrame::Delete_Edge_Module( EDGE_MODULE* Edge )
{ {
if( Edge == NULL ) if( Edge == NULL )
return; return;
if( Edge->Type() != TYPE_EDGE_MODULE ) if( Edge->Type() != TYPE_EDGE_MODULE )
{ {
DisplayError( this, DisplayError( this, wxT( "StructType error: TYPE_EDGE_MODULE expected" ) );
wxT( "StructType error: TYPE_EDGE_MODULE expected" ) );
return; return;
} }
...@@ -299,16 +271,9 @@ static void Abort_Move_ModuleOutline( EDA_DRAW_PANEL* Panel, wxDC* DC ) ...@@ -299,16 +271,9 @@ static void Abort_Move_ModuleOutline( EDA_DRAW_PANEL* Panel, wxDC* DC )
} }
/* Create a new edge item (line, arc ..). EDGE_MODULE* FOOTPRINT_EDIT_FRAME::Begin_Edge_Module( EDGE_MODULE* Edge,
* @param Edge = if NULL: create new edge else terminate edge and create a wxDC* DC,
* new edge int type_edge )
* @param DC = current Device Context
* @param type_edge = S_SEGMENT,S_ARC ..
* @return the new created edge.
*/
EDGE_MODULE* WinEDA_ModuleEditFrame::Begin_Edge_Module( EDGE_MODULE* Edge,
wxDC* DC,
int type_edge )
{ {
MODULE* module = GetBoard()->m_Modules; MODULE* module = GetBoard()->m_Modules;
int angle = 0; int angle = 0;
...@@ -339,16 +304,17 @@ EDGE_MODULE* WinEDA_ModuleEditFrame::Begin_Edge_Module( EDGE_MODULE* Edge, ...@@ -339,16 +304,17 @@ EDGE_MODULE* WinEDA_ModuleEditFrame::Begin_Edge_Module( EDGE_MODULE* Edge,
if( module->GetLayer() == LAYER_N_FRONT ) if( module->GetLayer() == LAYER_N_FRONT )
Edge->SetLayer( SILKSCREEN_N_FRONT ); Edge->SetLayer( SILKSCREEN_N_FRONT );
if( module->GetLayer() == LAYER_N_BACK ) if( module->GetLayer() == LAYER_N_BACK )
Edge->SetLayer( SILKSCREEN_N_BACK ); Edge->SetLayer( SILKSCREEN_N_BACK );
/* Initialise the starting point of the new segment or arc */ /* Initialize the starting point of the new segment or arc */
Edge->m_Start = GetScreen()->GetCrossHairPosition(); Edge->m_Start = GetScreen()->GetCrossHairPosition();
/* Initialise the ending point of the new segment or arc */ /* Initialize the ending point of the new segment or arc */
Edge->m_End = Edge->m_Start; Edge->m_End = Edge->m_Start;
/* Initialise the relative coordinates */ /* Initialize the relative coordinates */
Edge->m_Start0 = Edge->m_Start - module->m_Pos; Edge->m_Start0 = Edge->m_Start - module->m_Pos;
RotatePoint( &Edge->m_Start0, -module->m_Orient ); RotatePoint( &Edge->m_Start0, -module->m_Orient );
...@@ -360,7 +326,7 @@ EDGE_MODULE* WinEDA_ModuleEditFrame::Begin_Edge_Module( EDGE_MODULE* Edge, ...@@ -360,7 +326,7 @@ EDGE_MODULE* WinEDA_ModuleEditFrame::Begin_Edge_Module( EDGE_MODULE* Edge,
/* Segment creation in progress. /* Segment creation in progress.
* The ending coordinate is updated by the function * The ending coordinate is updated by the function
* ShowNewEdgeModule() called on move mouse event * ShowNewEdgeModule() called on move mouse event
* during the segment craetion * during the segment creation
*/ */
else else
{ {
...@@ -373,8 +339,7 @@ EDGE_MODULE* WinEDA_ModuleEditFrame::Begin_Edge_Module( EDGE_MODULE* Edge, ...@@ -373,8 +339,7 @@ EDGE_MODULE* WinEDA_ModuleEditFrame::Begin_Edge_Module( EDGE_MODULE* Edge,
EDGE_MODULE* newedge = new EDGE_MODULE( module ); EDGE_MODULE* newedge = new EDGE_MODULE( module );
newedge->Copy( Edge ); newedge->Copy( Edge );
// insert _after_ Edge, which is the same as inserting _before_ // insert _after_ Edge, which is the same as inserting before Edge->Next()
// Edge->Next()
module->m_Drawings.Insert( newedge, Edge->Next() ); module->m_Drawings.Insert( newedge, Edge->Next() );
Edge->m_Flags = 0; Edge->m_Flags = 0;
...@@ -398,25 +363,28 @@ EDGE_MODULE* WinEDA_ModuleEditFrame::Begin_Edge_Module( EDGE_MODULE* Edge, ...@@ -398,25 +363,28 @@ EDGE_MODULE* WinEDA_ModuleEditFrame::Begin_Edge_Module( EDGE_MODULE* Edge,
} }
} }
else else
{
wxMessageBox( wxT( "Begin_Edge() error" ) ); wxMessageBox( wxT( "Begin_Edge() error" ) );
}
} }
return Edge; return Edge;
} }
/* Terminate a move or create edge function void FOOTPRINT_EDIT_FRAME::End_Edge_Module( EDGE_MODULE* Edge )
*/
void WinEDA_ModuleEditFrame::End_Edge_Module( EDGE_MODULE* Edge )
{ {
MODULE* Module = GetBoard()->m_Modules; MODULE* Module = GetBoard()->m_Modules;
if( Edge ) if( Edge )
{ {
Edge->m_Flags = 0; Edge->m_Flags = 0;
/* If last segment length is 0: remove it */ /* If last segment length is 0: remove it */
if( Edge->m_Start == Edge->m_End ) if( Edge->m_Start == Edge->m_End )
Edge->DeleteStructure(); Edge->DeleteStructure();
} }
Module->Set_Rectangle_Encadrement(); Module->Set_Rectangle_Encadrement();
Module->m_LastEdit_Time = time( NULL ); Module->m_LastEdit_Time = time( NULL );
OnModify(); OnModify();
......
This diff is collapsed.
...@@ -39,10 +39,10 @@ void PCB_EDIT_FRAME::InstallModuleOptionsFrame( MODULE* Module, wxDC* DC ) ...@@ -39,10 +39,10 @@ void PCB_EDIT_FRAME::InstallModuleOptionsFrame( MODULE* Module, wxDC* DC )
{ {
if( m_ModuleEditFrame == NULL ) if( m_ModuleEditFrame == NULL )
{ {
m_ModuleEditFrame = new WinEDA_ModuleEditFrame( this, m_ModuleEditFrame = new FOOTPRINT_EDIT_FRAME( this,
_( "Module Editor" ), _( "Module Editor" ),
wxPoint( -1, -1 ), wxPoint( -1, -1 ),
wxSize( 600, 400 ) ); wxSize( 600, 400 ) );
} }
m_ModuleEditFrame->Load_Module_From_BOARD( Module ); m_ModuleEditFrame->Load_Module_From_BOARD( Module );
...@@ -57,7 +57,7 @@ void PCB_EDIT_FRAME::InstallModuleOptionsFrame( MODULE* Module, wxDC* DC ) ...@@ -57,7 +57,7 @@ void PCB_EDIT_FRAME::InstallModuleOptionsFrame( MODULE* Module, wxDC* DC )
/* /*
* Position anchor under the cursor. * Position anchor under the cursor.
*/ */
void WinEDA_ModuleEditFrame::Place_Ancre( MODULE* pt_mod ) void FOOTPRINT_EDIT_FRAME::Place_Ancre( MODULE* pt_mod )
{ {
wxPoint moveVector; wxPoint moveVector;
EDA_ITEM* PtStruct; EDA_ITEM* PtStruct;
...@@ -112,7 +112,7 @@ void WinEDA_ModuleEditFrame::Place_Ancre( MODULE* pt_mod ) ...@@ -112,7 +112,7 @@ void WinEDA_ModuleEditFrame::Place_Ancre( MODULE* pt_mod )
} }
void WinEDA_ModuleEditFrame::RemoveStruct( EDA_ITEM* Item ) void FOOTPRINT_EDIT_FRAME::RemoveStruct( EDA_ITEM* Item )
{ {
if( Item == NULL ) if( Item == NULL )
return; return;
...@@ -151,8 +151,7 @@ void WinEDA_ModuleEditFrame::RemoveStruct( EDA_ITEM* Item ) ...@@ -151,8 +151,7 @@ void WinEDA_ModuleEditFrame::RemoveStruct( EDA_ITEM* Item )
default: default:
{ {
wxString Line; wxString Line;
Line.Printf( wxT( " Remove: draw item type %d unknown." ), Line.Printf( wxT( " Remove: draw item type %d unknown." ), Item->Type() );
Item->Type() );
DisplayError( this, Line ); DisplayError( this, Line );
} }
break; break;
......
...@@ -34,8 +34,6 @@ void PCB_EDIT_FRAME::OnFileHistory( wxCommandEvent& event ) ...@@ -34,8 +34,6 @@ void PCB_EDIT_FRAME::OnFileHistory( wxCommandEvent& event )
} }
/* Handle the read/write file commands
*/
void PCB_EDIT_FRAME::Files_io( wxCommandEvent& event ) void PCB_EDIT_FRAME::Files_io( wxCommandEvent& event )
{ {
int id = event.GetId(); int id = event.GetId();
...@@ -78,6 +76,7 @@ void PCB_EDIT_FRAME::Files_io( wxCommandEvent& event ) ...@@ -78,6 +76,7 @@ void PCB_EDIT_FRAME::Files_io( wxCommandEvent& event )
else else
{ {
msg = _( "OK to load recovery file " ) + fn.GetFullPath(); msg = _( "OK to load recovery file " ) + fn.GetFullPath();
if( !IsOK( this, msg ) ) if( !IsOK( this, msg ) )
break; break;
} }
...@@ -85,7 +84,7 @@ void PCB_EDIT_FRAME::Files_io( wxCommandEvent& event ) ...@@ -85,7 +84,7 @@ void PCB_EDIT_FRAME::Files_io( wxCommandEvent& event )
LoadOnePcbFile( fn.GetFullPath(), false ); LoadOnePcbFile( fn.GetFullPath(), false );
fn.SetExt( PcbFileExtension ); fn.SetExt( PcbFileExtension );
GetScreen()->SetFileName( fn.GetFullPath() ); GetScreen()->SetFileName( fn.GetFullPath() );
SetTitle( GetScreen()->GetFileName() ); UpdateTitle();
break; break;
} }
...@@ -98,7 +97,7 @@ void PCB_EDIT_FRAME::Files_io( wxCommandEvent& event ) ...@@ -98,7 +97,7 @@ void PCB_EDIT_FRAME::Files_io( wxCommandEvent& event )
GetScreen()->GetFileName().Printf( wxT( "%s%cnoname%s" ), GetScreen()->GetFileName().Printf( wxT( "%s%cnoname%s" ),
GetChars( wxGetCwd() ), DIR_SEP, GetChars( wxGetCwd() ), DIR_SEP,
GetChars( PcbFileExtension ) ); GetChars( PcbFileExtension ) );
SetTitle( GetScreen()->GetFileName() ); UpdateTitle();
ReCreateLayerBox( NULL ); ReCreateLayerBox( NULL );
break; break;
...@@ -116,19 +115,6 @@ void PCB_EDIT_FRAME::Files_io( wxCommandEvent& event ) ...@@ -116,19 +115,6 @@ void PCB_EDIT_FRAME::Files_io( wxCommandEvent& event )
} }
/**
* Function LoadOnePcbFile
* Load a Kicad board (.brd) file.
*
* @param aFileName - File name including path. If empty, a file dialog will
* be displayed.
* @param aAppend - Append board file aFileName to the currently loaded file if true.
* Default = false.
* @param aForceFileDialog - Display the file open dialog even if aFullFileName is
* valid if true; Default = false.
*
* @return False if file load fails or is cancelled by the user, otherwise true.
*/
bool PCB_EDIT_FRAME::LoadOnePcbFile( const wxString& aFileName, bool aAppend, bool PCB_EDIT_FRAME::LoadOnePcbFile( const wxString& aFileName, bool aAppend,
bool aForceFileDialog ) bool aForceFileDialog )
{ {
...@@ -183,6 +169,7 @@ the changes?" ) ) ) ...@@ -183,6 +169,7 @@ the changes?" ) ) )
*/ */
source = wxFopen( GetScreen()->GetFileName(), wxT( "rt" ) ); source = wxFopen( GetScreen()->GetFileName(), wxT( "rt" ) );
if( source == NULL ) if( source == NULL )
{ {
msg.Printf( _( "File <%s> not found" ), GetChars( GetScreen()->GetFileName() ) ); msg.Printf( _( "File <%s> not found" ), GetChars( GetScreen()->GetFileName() ) );
...@@ -196,6 +183,7 @@ the changes?" ) ) ) ...@@ -196,6 +183,7 @@ the changes?" ) ) )
/* Read header and TEST if it is a PCB file format */ /* Read header and TEST if it is a PCB file format */
reader.ReadLine(); reader.ReadLine();
if( strncmp( reader.Line(), "PCBNEW-BOARD", 12 ) != 0 ) if( strncmp( reader.Line(), "PCBNEW-BOARD", 12 ) != 0 )
{ {
DisplayError( this, wxT( "Unknown file type" ) ); DisplayError( this, wxT( "Unknown file type" ) );
...@@ -204,6 +192,7 @@ the changes?" ) ) ) ...@@ -204,6 +192,7 @@ the changes?" ) ) )
int ver; int ver;
sscanf( reader.Line() , "PCBNEW-BOARD Version %d date", &ver ); sscanf( reader.Line() , "PCBNEW-BOARD Version %d date", &ver );
if ( ver > g_CurrentVersionPCB ) if ( ver > g_CurrentVersionPCB )
{ {
DisplayInfoMessage( this, _( "This file was created by a more recent \ DisplayInfoMessage( this, _( "This file was created by a more recent \
...@@ -220,7 +209,9 @@ this file again." ) ); ...@@ -220,7 +209,9 @@ this file again." ) );
wxSetWorkingDirectory( wxPathOnly( GetScreen()->GetFileName() ) ); wxSetWorkingDirectory( wxPathOnly( GetScreen()->GetFileName() ) );
if( aAppend ) if( aAppend )
{
ReadPcbFile( &reader, true ); ReadPcbFile( &reader, true );
}
else else
{ {
// Update the option toolbar // Update the option toolbar
...@@ -252,7 +243,7 @@ this file again." ) ); ...@@ -252,7 +243,7 @@ this file again." ) );
GetScreen()->GetFileName().Replace( WIN_STRING_DIR_SEP, UNIX_STRING_DIR_SEP ); GetScreen()->GetFileName().Replace( WIN_STRING_DIR_SEP, UNIX_STRING_DIR_SEP );
SetTitle( GetScreen()->GetFileName() ); UpdateTitle();
UpdateFileHistory( GetScreen()->GetFileName() ); UpdateFileHistory( GetScreen()->GetFileName() );
/* Rebuild the new pad list (for drc and ratsnet control ...) */ /* Rebuild the new pad list (for drc and ratsnet control ...) */
...@@ -309,9 +300,7 @@ this file again." ) ); ...@@ -309,9 +300,7 @@ this file again." ) );
} }
/* Write the board file bool PCB_EDIT_FRAME::SavePcbFile( const wxString& aFileName )
*/
bool PCB_EDIT_FRAME::SavePcbFile( const wxString& FileName )
{ {
wxFileName backupFileName; wxFileName backupFileName;
wxFileName pcbFileName; wxFileName pcbFileName;
...@@ -322,7 +311,7 @@ bool PCB_EDIT_FRAME::SavePcbFile( const wxString& FileName ) ...@@ -322,7 +311,7 @@ bool PCB_EDIT_FRAME::SavePcbFile( const wxString& FileName )
bool saveok = true; bool saveok = true;
FILE* dest; FILE* dest;
if( FileName == wxEmptyString ) if( aFileName == wxEmptyString )
{ {
wxFileDialog dlg( this, _( "Save Board File" ), wxEmptyString, wxFileDialog dlg( this, _( "Save Board File" ), wxEmptyString,
GetScreen()->GetFileName(), PcbFileWildcard, GetScreen()->GetFileName(), PcbFileWildcard,
...@@ -334,7 +323,9 @@ bool PCB_EDIT_FRAME::SavePcbFile( const wxString& FileName ) ...@@ -334,7 +323,9 @@ bool PCB_EDIT_FRAME::SavePcbFile( const wxString& FileName )
GetScreen()->SetFileName( dlg.GetPath() ); GetScreen()->SetFileName( dlg.GetPath() );
} }
else else
GetScreen()->SetFileName( FileName ); {
GetScreen()->SetFileName( aFileName );
}
/* If changes are made, update the board date */ /* If changes are made, update the board date */
if( GetScreen()->IsModify() ) if( GetScreen()->IsModify() )
...@@ -344,6 +335,9 @@ bool PCB_EDIT_FRAME::SavePcbFile( const wxString& FileName ) ...@@ -344,6 +335,9 @@ bool PCB_EDIT_FRAME::SavePcbFile( const wxString& FileName )
pcbFileName = GetScreen()->GetFileName(); pcbFileName = GetScreen()->GetFileName();
if( !IsWritable( pcbFileName ) )
return false;
/* Get the backup file name */ /* Get the backup file name */
backupFileName = pcbFileName; backupFileName = pcbFileName;
backupFileName.SetExt( BACKUP_FILE_EXT ); backupFileName.SetExt( BACKUP_FILE_EXT );
...@@ -356,10 +350,11 @@ bool PCB_EDIT_FRAME::SavePcbFile( const wxString& FileName ) ...@@ -356,10 +350,11 @@ bool PCB_EDIT_FRAME::SavePcbFile( const wxString& FileName )
/* rename the "old" file" from xxx.brd to xxx.000 */ /* rename the "old" file" from xxx.brd to xxx.000 */
if( backupFileName.FileExists() ) /* Remove the old file xxx.000 (if exists) */ if( backupFileName.FileExists() ) /* Remove the old file xxx.000 (if exists) */
wxRemoveFile( backupFileName.GetFullPath() ); wxRemoveFile( backupFileName.GetFullPath() );
if( !wxRenameFile( pcbFileName.GetFullPath(), backupFileName.GetFullPath() ) ) if( !wxRenameFile( pcbFileName.GetFullPath(), backupFileName.GetFullPath() ) )
{ {
msg = _( "Warning: unable to create backup file " ) + backupFileName.GetFullPath(); msg = _( "Warning: unable to create backup file " ) + backupFileName.GetFullPath();
DisplayError( this, msg, 15 ); DisplayError( this, msg );
saveok = false; saveok = false;
} }
} }
...@@ -382,7 +377,7 @@ bool PCB_EDIT_FRAME::SavePcbFile( const wxString& FileName ) ...@@ -382,7 +377,7 @@ bool PCB_EDIT_FRAME::SavePcbFile( const wxString& FileName )
if( dest ) if( dest )
{ {
GetScreen()->SetFileName( pcbFileName.GetFullPath() ); GetScreen()->SetFileName( pcbFileName.GetFullPath() );
SetTitle( GetScreen()->GetFileName() ); UpdateTitle();
SavePcbFormatAscii( dest ); SavePcbFormatAscii( dest );
fclose( dest ); fclose( dest );
...@@ -400,6 +395,7 @@ bool PCB_EDIT_FRAME::SavePcbFile( const wxString& FileName ) ...@@ -400,6 +395,7 @@ bool PCB_EDIT_FRAME::SavePcbFile( const wxString& FileName )
lowerTxt = _( "Wrote board file: " ); lowerTxt = _( "Wrote board file: " );
else else
lowerTxt = _( "Failed to create " ); lowerTxt = _( "Failed to create " );
lowerTxt += pcbFileName.GetFullPath(); lowerTxt += pcbFileName.GetFullPath();
ClearMsgPanel(); ClearMsgPanel();
......
...@@ -20,11 +20,8 @@ ...@@ -20,11 +20,8 @@
*/ */
/* Hot keys. Some commands are relative to the item under the mouse cursor void FOOTPRINT_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
* Commands are case insensitive EDA_ITEM* aItem )
*/
void WinEDA_ModuleEditFrame::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
EDA_ITEM* aItem )
{ {
if( aHotKey == 0 ) if( aHotKey == 0 )
return; return;
...@@ -35,7 +32,8 @@ void WinEDA_ModuleEditFrame::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aP ...@@ -35,7 +32,8 @@ void WinEDA_ModuleEditFrame::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aP
wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED ); wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
cmd.SetEventObject( this ); cmd.SetEventObject( this );
/* Convert lower to upper case (the usual toupper function has problem with non ascii codes like function keys */ /* Convert lower to upper case (the usual toupper function has problem with non ascii
* codes like function keys */
if( (aHotKey >= 'a') && (aHotKey <= 'z') ) if( (aHotKey >= 'a') && (aHotKey <= 'z') )
aHotKey += 'A' - 'a'; aHotKey += 'A' - 'a';
...@@ -90,8 +88,7 @@ void WinEDA_ModuleEditFrame::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aP ...@@ -90,8 +88,7 @@ void WinEDA_ModuleEditFrame::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aP
case HK_REDO: case HK_REDO:
if( ItemFree && !blockActive ) if( ItemFree && !blockActive )
{ {
wxCommandEvent event( wxEVT_COMMAND_TOOL_CLICKED, wxCommandEvent event( wxEVT_COMMAND_TOOL_CLICKED, HK_Descr->m_IdMenuEvent );
HK_Descr->m_IdMenuEvent );
wxPostEvent( this, event ); wxPostEvent( this, event );
} }
break; break;
...@@ -120,7 +117,7 @@ void WinEDA_ModuleEditFrame::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aP ...@@ -120,7 +117,7 @@ void WinEDA_ModuleEditFrame::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aP
} }
bool WinEDA_ModuleEditFrame::OnHotkeyEditItem( int aIdCommand ) bool FOOTPRINT_EDIT_FRAME::OnHotkeyEditItem( int aIdCommand )
{ {
BOARD_ITEM* item = GetCurItem(); BOARD_ITEM* item = GetCurItem();
bool itemCurrentlyEdited = item && item->m_Flags; bool itemCurrentlyEdited = item && item->m_Flags;
...@@ -136,7 +133,7 @@ bool WinEDA_ModuleEditFrame::OnHotkeyEditItem( int aIdCommand ) ...@@ -136,7 +133,7 @@ bool WinEDA_ModuleEditFrame::OnHotkeyEditItem( int aIdCommand )
SetCurItem( item ); SetCurItem( item );
int evt_type = 0; //Used to post a wxCommandEvent on demand int evt_type = 0; // Used to post a wxCommandEvent on demand
switch( item->Type() ) switch( item->Type() )
{ {
...@@ -172,7 +169,7 @@ bool WinEDA_ModuleEditFrame::OnHotkeyEditItem( int aIdCommand ) ...@@ -172,7 +169,7 @@ bool WinEDA_ModuleEditFrame::OnHotkeyEditItem( int aIdCommand )
} }
bool WinEDA_ModuleEditFrame::OnHotkeyDeleteItem( int aIdCommand ) bool FOOTPRINT_EDIT_FRAME::OnHotkeyDeleteItem( int aIdCommand )
{ {
BOARD_ITEM* item = GetCurItem(); BOARD_ITEM* item = GetCurItem();
bool itemCurrentlyEdited = item && item->m_Flags; bool itemCurrentlyEdited = item && item->m_Flags;
...@@ -188,7 +185,7 @@ bool WinEDA_ModuleEditFrame::OnHotkeyDeleteItem( int aIdCommand ) ...@@ -188,7 +185,7 @@ bool WinEDA_ModuleEditFrame::OnHotkeyDeleteItem( int aIdCommand )
SetCurItem( item ); SetCurItem( item );
int evt_type = 0; //Used to post a wxCommandEvent on demand int evt_type = 0; // Used to post a wxCommandEvent on demand
switch( item->Type() ) switch( item->Type() )
{ {
...@@ -224,7 +221,7 @@ bool WinEDA_ModuleEditFrame::OnHotkeyDeleteItem( int aIdCommand ) ...@@ -224,7 +221,7 @@ bool WinEDA_ModuleEditFrame::OnHotkeyDeleteItem( int aIdCommand )
} }
bool WinEDA_ModuleEditFrame::OnHotkeyMoveItem( int aIdCommand ) bool FOOTPRINT_EDIT_FRAME::OnHotkeyMoveItem( int aIdCommand )
{ {
BOARD_ITEM* item = GetCurItem(); BOARD_ITEM* item = GetCurItem();
bool itemCurrentlyEdited = item && item->m_Flags; bool itemCurrentlyEdited = item && item->m_Flags;
...@@ -240,7 +237,7 @@ bool WinEDA_ModuleEditFrame::OnHotkeyMoveItem( int aIdCommand ) ...@@ -240,7 +237,7 @@ bool WinEDA_ModuleEditFrame::OnHotkeyMoveItem( int aIdCommand )
SetCurItem( item ); SetCurItem( item );
int evt_type = 0; //Used to post a wxCommandEvent on demand int evt_type = 0; // Used to post a wxCommandEvent on demand
switch( item->Type() ) switch( item->Type() )
{ {
...@@ -276,7 +273,7 @@ bool WinEDA_ModuleEditFrame::OnHotkeyMoveItem( int aIdCommand ) ...@@ -276,7 +273,7 @@ bool WinEDA_ModuleEditFrame::OnHotkeyMoveItem( int aIdCommand )
} }
bool WinEDA_ModuleEditFrame::OnHotkeyRotateItem( int aIdCommand ) bool FOOTPRINT_EDIT_FRAME::OnHotkeyRotateItem( int aIdCommand )
{ {
BOARD_ITEM* item = GetCurItem(); BOARD_ITEM* item = GetCurItem();
bool itemCurrentlyEdited = item && item->m_Flags; bool itemCurrentlyEdited = item && item->m_Flags;
......
...@@ -72,12 +72,7 @@ bool PCB_EDIT_FRAME::Clear_Pcb( bool aQuery ) ...@@ -72,12 +72,7 @@ bool PCB_EDIT_FRAME::Clear_Pcb( bool aQuery )
/** bool FOOTPRINT_EDIT_FRAME::Clear_Pcb( bool aQuery )
* Function Clear_Pcb
* delete all and reinitialize the current board
* @param aQuery = true to prompt user for confirmation, false to initialize silently
*/
bool WinEDA_ModuleEditFrame::Clear_Pcb( bool aQuery )
{ {
if( GetBoard() == NULL ) if( GetBoard() == NULL )
return FALSE; return FALSE;
......
This diff is collapsed.
...@@ -24,13 +24,8 @@ static void DisplayCmpDoc( wxString& Name ); ...@@ -24,13 +24,8 @@ static void DisplayCmpDoc( wxString& Name );
static FOOTPRINT_LIST MList; static FOOTPRINT_LIST MList;
/**
* Function Load_Module_From_BOARD bool FOOTPRINT_EDIT_FRAME::Load_Module_From_BOARD( MODULE* Module )
* load in Modedit a footfrint from the main board
* @param Module = the module to load. If NULL, a module reference will we asked to user
* @return true if a module isloaded, false otherwise.
*/
bool WinEDA_ModuleEditFrame::Load_Module_From_BOARD( MODULE* Module )
{ {
MODULE* NewModule; MODULE* NewModule;
PCB_BASE_FRAME* parent = (PCB_BASE_FRAME*) GetParent(); PCB_BASE_FRAME* parent = (PCB_BASE_FRAME*) GetParent();
...@@ -109,8 +104,8 @@ MODULE* PCB_BASE_FRAME::Load_Module_From_Library( const wxString& library, wxDC* ...@@ -109,8 +104,8 @@ MODULE* PCB_BASE_FRAME::Load_Module_From_Library( const wxString& library, wxDC*
{ {
AllowWildSeach = false; AllowWildSeach = false;
keys = ModuleName.AfterFirst( '=' ); keys = ModuleName.AfterFirst( '=' );
ModuleName = Select_1_Module_From_List( this, library, wxEmptyString, ModuleName = Select_1_Module_From_List( this, library, wxEmptyString, keys );
keys );
if( ModuleName.IsEmpty() ) /* Cancel command */ if( ModuleName.IsEmpty() ) /* Cancel command */
{ {
DrawPanel->MoveCursorToCrossHair(); DrawPanel->MoveCursorToCrossHair();
...@@ -121,8 +116,7 @@ MODULE* PCB_BASE_FRAME::Load_Module_From_Library( const wxString& library, wxDC* ...@@ -121,8 +116,7 @@ MODULE* PCB_BASE_FRAME::Load_Module_From_Library( const wxString& library, wxDC*
|| ( ModuleName.Contains( wxT( "*" ) ) ) ) // Selection wild card || ( ModuleName.Contains( wxT( "*" ) ) ) ) // Selection wild card
{ {
AllowWildSeach = false; AllowWildSeach = false;
ModuleName = Select_1_Module_From_List( this, library, ModuleName, ModuleName = Select_1_Module_From_List( this, library, ModuleName, wxEmptyString );
wxEmptyString );
if( ModuleName.IsEmpty() ) if( ModuleName.IsEmpty() )
{ {
DrawPanel->MoveCursorToCrossHair(); DrawPanel->MoveCursorToCrossHair();
...@@ -137,15 +131,17 @@ MODULE* PCB_BASE_FRAME::Load_Module_From_Library( const wxString& library, wxDC* ...@@ -137,15 +131,17 @@ MODULE* PCB_BASE_FRAME::Load_Module_From_Library( const wxString& library, wxDC*
AllowWildSeach = false; AllowWildSeach = false;
wxString wildname = wxChar( '*' ) + ModuleName + wxChar( '*' ); wxString wildname = wxChar( '*' ) + ModuleName + wxChar( '*' );
ModuleName = wildname; ModuleName = wildname;
ModuleName = Select_1_Module_From_List( this, library, ModuleName, ModuleName = Select_1_Module_From_List( this, library, ModuleName, wxEmptyString );
wxEmptyString );
if( ModuleName.IsEmpty() ) if( ModuleName.IsEmpty() )
{ {
DrawPanel->MoveCursorToCrossHair(); DrawPanel->MoveCursorToCrossHair();
return NULL; /* Cancel command. */ return NULL; /* Cancel command. */
} }
else else
{
module = Get_Librairie_Module( library, ModuleName, true ); module = Get_Librairie_Module( library, ModuleName, true );
}
} }
GetScreen()->SetCrossHairPosition( curspos ); GetScreen()->SetCrossHairPosition( curspos );
...@@ -168,6 +164,7 @@ MODULE* PCB_BASE_FRAME::Load_Module_From_Library( const wxString& library, wxDC* ...@@ -168,6 +164,7 @@ MODULE* PCB_BASE_FRAME::Load_Module_From_Library( const wxString& library, wxDC*
* rebuild only the pad and list of nets ( faster) * rebuild only the pad and list of nets ( faster)
*/ */
// GetBoard()->m_Pcb->m_NetInfo->BuildListOfNets(); // GetBoard()->m_Pcb->m_NetInfo->BuildListOfNets();
RecalculateAllTracksNetcode(); RecalculateAllTracksNetcode();
...@@ -208,8 +205,7 @@ MODULE* PCB_BASE_FRAME::Get_Librairie_Module( const wxString& aLibraryFullFilena ...@@ -208,8 +205,7 @@ MODULE* PCB_BASE_FRAME::Get_Librairie_Module( const wxString& aLibraryFullFilena
if( one_lib ) if( one_lib )
fn = aLibraryFullFilename; fn = aLibraryFullFilename;
else else
fn = wxFileName( wxEmptyString, g_LibName_List[ii], fn = wxFileName( wxEmptyString, g_LibName_List[ii], ModuleFileExtension );
ModuleFileExtension );
tmp = wxGetApp().FindLibraryPath( fn ); tmp = wxGetApp().FindLibraryPath( fn );
...@@ -219,9 +215,9 @@ MODULE* PCB_BASE_FRAME::Get_Librairie_Module( const wxString& aLibraryFullFilena ...@@ -219,9 +215,9 @@ MODULE* PCB_BASE_FRAME::Get_Librairie_Module( const wxString& aLibraryFullFilena
{ {
msg.Printf( _( "PCB footprint library file <%s> not found in search paths." ), msg.Printf( _( "PCB footprint library file <%s> not found in search paths." ),
GetChars( fn.GetFullName() ) ); GetChars( fn.GetFullName() ) );
wxMessageBox( msg, _( "Library Load Error" ), wxMessageBox( msg, _( "Library Load Error" ), wxOK | wxICON_ERROR, this );
wxOK | wxICON_ERROR, this );
} }
continue; continue;
} }
...@@ -231,8 +227,7 @@ MODULE* PCB_BASE_FRAME::Get_Librairie_Module( const wxString& aLibraryFullFilena ...@@ -231,8 +227,7 @@ MODULE* PCB_BASE_FRAME::Get_Librairie_Module( const wxString& aLibraryFullFilena
{ {
msg.Printf( _( "Could not open PCB footprint library file <%s>." ), msg.Printf( _( "Could not open PCB footprint library file <%s>." ),
GetChars( tmp ) ); GetChars( tmp ) );
wxMessageBox( msg, _( "Library Load Error" ), wxMessageBox( msg, _( "Library Load Error" ), wxOK | wxICON_ERROR, this );
wxOK | wxICON_ERROR, this );
continue; continue;
} }
...@@ -249,8 +244,7 @@ MODULE* PCB_BASE_FRAME::Get_Librairie_Module( const wxString& aLibraryFullFilena ...@@ -249,8 +244,7 @@ MODULE* PCB_BASE_FRAME::Get_Librairie_Module( const wxString& aLibraryFullFilena
{ {
msg.Printf( _( "<%s> is not a valid Kicad PCB footprint library file." ), msg.Printf( _( "<%s> is not a valid Kicad PCB footprint library file." ),
GetChars( tmp ) ); GetChars( tmp ) );
wxMessageBox( msg, _( "Library Load Error" ), wxMessageBox( msg, _( "Library Load Error" ), wxOK | wxICON_ERROR, this );
wxOK | wxICON_ERROR, this );
return NULL; return NULL;
} }
...@@ -312,7 +306,7 @@ MODULE* PCB_BASE_FRAME::Get_Librairie_Module( const wxString& aLibraryFullFilena ...@@ -312,7 +306,7 @@ MODULE* PCB_BASE_FRAME::Get_Librairie_Module( const wxString& aLibraryFullFilena
* void, list all modules) * void, list all modules)
* @param aMask = Display filter (wildcard)( Mask = wxEmptyString if not used ) * @param aMask = Display filter (wildcard)( Mask = wxEmptyString if not used )
* @param aKeyWord = keyword list, to display a filtered list of module having * @param aKeyWord = keyword list, to display a filtered list of module having
* one (or more) of these keyworks in their keywork list * one (or more) of these keyworks in their keyword list
* ( aKeyWord = wxEmptyString if not used ) * ( aKeyWord = wxEmptyString if not used )
* *
* @return wxEmptyString if abort or fails, or the selected module name if Ok * @return wxEmptyString if abort or fails, or the selected module name if Ok
...@@ -350,13 +344,16 @@ wxString PCB_BASE_FRAME::Select_1_Module_From_List( EDA_DRAW_FRAME* aWindow, ...@@ -350,13 +344,16 @@ wxString PCB_BASE_FRAME::Select_1_Module_From_List( EDA_DRAW_FRAME* aWindow,
for( unsigned ii = 0; ii < MList.GetCount(); ii++ ) for( unsigned ii = 0; ii < MList.GetCount(); ii++ )
{ {
wxString& candidate = MList.GetItem(ii).m_Module; wxString& candidate = MList.GetItem(ii).m_Module;
if( WildCompareString( aMask, candidate, false ) ) if( WildCompareString( aMask, candidate, false ) )
footprint_names_list.Add( candidate ); footprint_names_list.Add( candidate );
} }
} }
else // Create the full list of modules else // Create the full list of modules
{
for( unsigned ii = 0; ii < MList.GetCount(); ii++ ) for( unsigned ii = 0; ii < MList.GetCount(); ii++ )
footprint_names_list.Add( MList.GetItem(ii).m_Module ); footprint_names_list.Add( MList.GetItem(ii).m_Module );
}
if( footprint_names_list.GetCount() ) if( footprint_names_list.GetCount() )
{ {
...@@ -401,16 +398,10 @@ static void DisplayCmpDoc( wxString& Name ) ...@@ -401,16 +398,10 @@ static void DisplayCmpDoc( wxString& Name )
} }
/** MODULE* FOOTPRINT_EDIT_FRAME::Select_1_Module_From_BOARD( BOARD* aPcb )
* Function Select_1_Module_From_BOARD
* Display the list of modules currently existing on the BOARD
* @return a pointer to a module if this module is selected or NULL otherwise
* @param aPcb = the board from modules can be loaded
*/
MODULE* WinEDA_ModuleEditFrame::Select_1_Module_From_BOARD( BOARD* aPcb )
{ {
MODULE* Module; MODULE* Module;
static wxString OldName; /* Save name of last module selectec. */ static wxString OldName; /* Save name of last module selected. */
wxString CmpName, msg; wxString CmpName, msg;
wxArrayString listnames; wxArrayString listnames;
...@@ -432,6 +423,7 @@ MODULE* WinEDA_ModuleEditFrame::Select_1_Module_From_BOARD( BOARD* aPcb ) ...@@ -432,6 +423,7 @@ MODULE* WinEDA_ModuleEditFrame::Select_1_Module_From_BOARD( BOARD* aPcb )
OldName = CmpName; OldName = CmpName;
Module = aPcb->m_Modules; Module = aPcb->m_Modules;
for( ; Module != NULL; Module = (MODULE*) Module->Next() ) for( ; Module != NULL; Module = (MODULE*) Module->Next() )
{ {
if( CmpName == Module->m_Reference->m_Text ) if( CmpName == Module->m_Reference->m_Text )
......
...@@ -13,10 +13,8 @@ ...@@ -13,10 +13,8 @@
#include "protos.h" #include "protos.h"
#include "pcbnew_id.h" #include "pcbnew_id.h"
/**
* @brief (Re)Create the menubar for the module editor frame void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar()
*/
void WinEDA_ModuleEditFrame::ReCreateMenuBar()
{ {
// Create and try to get the current menubar // Create and try to get the current menubar
wxMenuBar* menuBar = GetMenuBar(); wxMenuBar* menuBar = GetMenuBar();
...@@ -28,6 +26,7 @@ void WinEDA_ModuleEditFrame::ReCreateMenuBar() ...@@ -28,6 +26,7 @@ void WinEDA_ModuleEditFrame::ReCreateMenuBar()
// Delete all existing menus so they can be rebuilt. // Delete all existing menus so they can be rebuilt.
// This allows language changes of the menu text on the fly. // This allows language changes of the menu text on the fly.
menuBar->Freeze(); menuBar->Freeze();
while( menuBar->GetMenuCount() ) while( menuBar->GetMenuCount() )
delete menuBar->Remove(0); delete menuBar->Remove(0);
......
This diff is collapsed.
...@@ -19,9 +19,8 @@ ...@@ -19,9 +19,8 @@
#include "hotkeys.h" #include "hotkeys.h"
/* Handle the left click in footprint editor
*/ void FOOTPRINT_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
void WinEDA_ModuleEditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
{ {
BOARD_ITEM* item = GetCurItem(); BOARD_ITEM* item = GetCurItem();
...@@ -66,6 +65,7 @@ void WinEDA_ModuleEditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) ...@@ -66,6 +65,7 @@ void WinEDA_ModuleEditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
if( !wxGetKeyState( WXK_SHIFT ) && !wxGetKeyState( WXK_ALT ) if( !wxGetKeyState( WXK_SHIFT ) && !wxGetKeyState( WXK_ALT )
&& !wxGetKeyState( WXK_CONTROL ) ) && !wxGetKeyState( WXK_CONTROL ) )
item = ModeditLocateAndDisplay(); item = ModeditLocateAndDisplay();
SetCurItem( item ); SetCurItem( item );
} }
...@@ -83,6 +83,7 @@ void WinEDA_ModuleEditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) ...@@ -83,6 +83,7 @@ void WinEDA_ModuleEditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
if( GetToolId() == ID_MODEDIT_CIRCLE_TOOL ) if( GetToolId() == ID_MODEDIT_CIRCLE_TOOL )
shape = S_CIRCLE; shape = S_CIRCLE;
if( GetToolId() == ID_MODEDIT_ARC_TOOL ) if( GetToolId() == ID_MODEDIT_ARC_TOOL )
shape = S_ARC; shape = S_ARC;
...@@ -107,7 +108,9 @@ void WinEDA_ModuleEditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) ...@@ -107,7 +108,9 @@ void WinEDA_ModuleEditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
SetCurItem( Begin_Edge_Module( (EDGE_MODULE*) item, DC, 0 ) ); SetCurItem( Begin_Edge_Module( (EDGE_MODULE*) item, DC, 0 ) );
} }
else else
{
DisplayError( this, wxT( "ProcessCommand error: item flags error" ) ); DisplayError( this, wxT( "ProcessCommand error: item flags error" ) );
}
} }
break; break;
...@@ -171,7 +174,7 @@ void WinEDA_ModuleEditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) ...@@ -171,7 +174,7 @@ void WinEDA_ModuleEditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
break; break;
default: default:
DisplayError( this, wxT( "WinEDA_ModuleEditFrame::ProcessCommand error" ) ); DisplayError( this, wxT( "FOOTPRINT_EDIT_FRAME::ProcessCommand error" ) );
SetToolID( ID_NO_TOOL_SELECTED, DrawPanel->GetDefaultCursor(), wxEmptyString ); SetToolID( ID_NO_TOOL_SELECTED, DrawPanel->GetDefaultCursor(), wxEmptyString );
} }
...@@ -179,11 +182,7 @@ void WinEDA_ModuleEditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) ...@@ -179,11 +182,7 @@ void WinEDA_ModuleEditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
} }
/* Handle the right click in the footprint editor: bool FOOTPRINT_EDIT_FRAME::OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu )
* Create the pull up menu
* After this menu is built, the standard ZOOM menu is added
*/
bool WinEDA_ModuleEditFrame::OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu )
{ {
BOARD_ITEM* item = GetCurItem(); BOARD_ITEM* item = GetCurItem();
wxString msg; wxString msg;
...@@ -358,14 +357,14 @@ bool WinEDA_ModuleEditFrame::OnRightClick( const wxPoint& MousePos, wxMenu* PopM ...@@ -358,14 +357,14 @@ bool WinEDA_ModuleEditFrame::OnRightClick( const wxPoint& MousePos, wxMenu* PopM
case TYPE_SCREEN: case TYPE_SCREEN:
case TYPE_NOT_INIT: case TYPE_NOT_INIT:
case TYPE_PCB: case TYPE_PCB:
msg.Printf( wxT( "WinEDA_ModuleEditFrame::OnRightClick Error: illegal DrawType %d" ), msg.Printf( wxT( "FOOTPRINT_EDIT_FRAME::OnRightClick Error: illegal DrawType %d" ),
item->Type() ); item->Type() );
DisplayError( this, msg ); DisplayError( this, msg );
break; break;
default: default:
msg.Printf( wxT( "WinEDA_ModuleEditFrame::OnRightClick Error: unknown DrawType %d" ), msg.Printf( wxT( "FOOTPRINT_EDIT_FRAME::OnRightClick Error: unknown DrawType %d" ),
item->Type() ); item->Type() );
DisplayError( this, msg ); DisplayError( this, msg );
break; break;
} }
...@@ -386,10 +385,7 @@ bool WinEDA_ModuleEditFrame::OnRightClick( const wxPoint& MousePos, wxMenu* PopM ...@@ -386,10 +385,7 @@ bool WinEDA_ModuleEditFrame::OnRightClick( const wxPoint& MousePos, wxMenu* PopM
} }
/* Handle the double click in the footprint editor: void FOOTPRINT_EDIT_FRAME::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
* If the double clicked item is editable: call the corresponding editor.
*/
void WinEDA_ModuleEditFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
{ {
BOARD_ITEM* item = GetCurItem(); BOARD_ITEM* item = GetCurItem();
...@@ -420,6 +416,7 @@ void WinEDA_ModuleEditFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos ) ...@@ -420,6 +416,7 @@ void WinEDA_ModuleEditFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
int ret = dialog.ShowModal(); int ret = dialog.ShowModal();
GetScreen()->GetCurItem()->m_Flags = 0; GetScreen()->GetCurItem()->m_Flags = 0;
DrawPanel->MoveCursorToCrossHair(); DrawPanel->MoveCursorToCrossHair();
if( ret > 0 ) if( ret > 0 )
DrawPanel->Refresh(); DrawPanel->Refresh();
} }
......
...@@ -13,17 +13,9 @@ ...@@ -13,17 +13,9 @@
#include "protos.h" #include "protos.h"
/** void FOOTPRINT_EDIT_FRAME::SaveCopyInUndoList( BOARD_ITEM* aItem,
* Function SaveCopyInUndoList. UNDO_REDO_T aTypeCommand,
* Creates a new entry in undo list of commands. const wxPoint& aTransformPoint )
* add a picker to handle aItemToCopy
* @param aItem = the board item modified by the command to undo
* @param aTypeCommand = command type (see enum UNDO_REDO_T)
* @param aTransformPoint = the reference point of the transformation, for commands like move
*/
void WinEDA_ModuleEditFrame::SaveCopyInUndoList( BOARD_ITEM* aItem,
UNDO_REDO_T aTypeCommand,
const wxPoint& aTransformPoint )
{ {
EDA_ITEM* item; EDA_ITEM* item;
MODULE* CopyItem; MODULE* CopyItem;
...@@ -47,31 +39,16 @@ void WinEDA_ModuleEditFrame::SaveCopyInUndoList( BOARD_ITEM* aItem, ...@@ -47,31 +39,16 @@ void WinEDA_ModuleEditFrame::SaveCopyInUndoList( BOARD_ITEM* aItem,
} }
/** void FOOTPRINT_EDIT_FRAME::SaveCopyInUndoList( PICKED_ITEMS_LIST& aItemsList,
* Function SaveCopyInUndoList (overloaded). UNDO_REDO_T aTypeCommand,
* Creates a new entry in undo list of commands. const wxPoint& aTransformPoint )
* add a list of pickers to handle a list of items
* @param aItemsList = the list of items modified by the command to undo
* @param aTypeCommand = command type (see enum UNDO_REDO_T)
* @param aTransformPoint = the reference point of the transformation, for commands like move
*/
void WinEDA_ModuleEditFrame::SaveCopyInUndoList( PICKED_ITEMS_LIST& aItemsList,
UNDO_REDO_T aTypeCommand,
const wxPoint& aTransformPoint )
{ {
// Currently unused in modedit, because the module itself is saved for each change // Currently unused in modedit, because the module itself is saved for each change
wxMessageBox( wxT( "SaveCopyInUndoList( PICKED_ITEMS_LIST& aItemsList..) not yet in use" ) ); wxMessageBox( wxT( "SaveCopyInUndoList( PICKED_ITEMS_LIST& aItemsList..) not yet in use" ) );
} }
/********************************************************************************/ void FOOTPRINT_EDIT_FRAME::GetComponentFromRedoList( wxCommandEvent& event )
void WinEDA_ModuleEditFrame::GetComponentFromRedoList( wxCommandEvent& event )
/********************************************************************************/
/* Redo the last edition:
* - Place the current edited library component in undo list
* - Get old version of the current edited library component
*/
{ {
if( GetScreen()->GetRedoCommandCount() <= 0 ) if( GetScreen()->GetRedoCommandCount() <= 0 )
return; return;
...@@ -99,14 +76,7 @@ void WinEDA_ModuleEditFrame::GetComponentFromRedoList( wxCommandEvent& event ) ...@@ -99,14 +76,7 @@ void WinEDA_ModuleEditFrame::GetComponentFromRedoList( wxCommandEvent& event )
} }
/***************************************************************************/ void FOOTPRINT_EDIT_FRAME::GetComponentFromUndoList( wxCommandEvent& event )
void WinEDA_ModuleEditFrame::GetComponentFromUndoList( wxCommandEvent& event )
/***************************************************************************/
/* Undo the last edition:
* - Place the current edited library component in Redo list
* - Get old version of the current edited library component
*/
{ {
if( GetScreen()->GetUndoCommandCount() <= 0 ) if( GetScreen()->GetUndoCommandCount() <= 0 )
return; return;
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
#include "protos.h" #include "protos.h"
void WinEDA_ModuleEditFrame::OnSelectOptionToolbar( wxCommandEvent& event ) void FOOTPRINT_EDIT_FRAME::OnSelectOptionToolbar( wxCommandEvent& event )
{ {
int id = event.GetId(); int id = event.GetId();
...@@ -46,7 +46,7 @@ void WinEDA_ModuleEditFrame::OnSelectOptionToolbar( wxCommandEvent& event ) ...@@ -46,7 +46,7 @@ void WinEDA_ModuleEditFrame::OnSelectOptionToolbar( wxCommandEvent& event )
default: default:
DisplayError( this, DisplayError( this,
wxT( "WinEDA_ModuleEditFrame::OnSelectOptionToolbar error" ) ); wxT( "FOOTPRINT_EDIT_FRAME::OnSelectOptionToolbar error" ) );
break; break;
} }
} }
/*********************************************************/ /*****************************************************/
/* class WinEDA_ModuleEditFrame: public EDA_DRAW_FRAME */ /* class FOOTPRINT_EDIT_FRAME: public EDA_DRAW_FRAME */
/* Class for the footprint editor */ /* Class for the footprint editor */
/*********************************************************/ /*****************************************************/
#ifndef _MODULE_EDITOR_FRAME_H_ #ifndef _MODULE_EDITOR_FRAME_H_
#define _MODULE_EDITOR_FRAME_H_ #define _MODULE_EDITOR_FRAME_H_
class WinEDA_ModuleEditFrame : public PCB_BASE_FRAME class FOOTPRINT_EDIT_FRAME : public PCB_BASE_FRAME
{ {
public: public:
MODULE* CurrentModule; MODULE* CurrentModule;
public: public:
WinEDA_ModuleEditFrame( wxWindow* father, FOOTPRINT_EDIT_FRAME( wxWindow* father,
const wxString& title, const wxString& title,
const wxPoint& pos, const wxSize& size, const wxPoint& pos, const wxSize& size,
long style = KICAD_DEFAULT_DRAWFRAME_STYLE ); long style = KICAD_DEFAULT_DRAWFRAME_STYLE );
~WinEDA_ModuleEditFrame(); ~FOOTPRINT_EDIT_FRAME();
void InstallOptionsFrame( const wxPoint& pos ); void InstallOptionsFrame( const wxPoint& pos );
...@@ -27,24 +27,69 @@ public: ...@@ -27,24 +27,69 @@ public:
void CloseModuleEditor( wxCommandEvent& Event ); void CloseModuleEditor( wxCommandEvent& Event );
void Process_Special_Functions( wxCommandEvent& event ); void Process_Special_Functions( wxCommandEvent& event );
/**
* Function RedrawActiveWindoow
* daws the footprint editor BOARD, and others elements : axis, grid ..
*/
void RedrawActiveWindow( wxDC* DC, bool EraseBg ); void RedrawActiveWindow( wxDC* DC, bool EraseBg );
/**
* Function ReCreateHToolbar
* create the main horizontal toolbar for the footprint editor
*/
void ReCreateHToolbar(); void ReCreateHToolbar();
void ReCreateVToolbar(); void ReCreateVToolbar();
void ReCreateOptToolbar(); void ReCreateOptToolbar();
void ReCreateAuxiliaryToolbar(); void ReCreateAuxiliaryToolbar();
void OnLeftClick( wxDC* DC, const wxPoint& MousePos ); void OnLeftClick( wxDC* DC, const wxPoint& MousePos );
/**
* Function OnLeftDClick
* handles the double click in the footprint editor:
* If the double clicked item is editable: call the corresponding editor.
*/
void OnLeftDClick( wxDC* DC, const wxPoint& MousePos ); void OnLeftDClick( wxDC* DC, const wxPoint& MousePos );
/**
* Function OnRightClick
* handles the right mouse click in the footprint editor:
* Create the pop up menu
* After this menu is built, the standard ZOOM menu is added
*/
bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ); bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu );
/**
* @brief (Re)Create the menubar for the module editor frame
*/
void ReCreateMenuBar(); void ReCreateMenuBar();
void ToolOnRightClick( wxCommandEvent& event ); void ToolOnRightClick( wxCommandEvent& event );
void OnSelectOptionToolbar( wxCommandEvent& event ); void OnSelectOptionToolbar( wxCommandEvent& event );
/**
* Function OnHotKey
* handle hot key events.
* <p?
* Some commands are relative to the item under the mouse cursor. Commands are
* case insensitive
* </p>
*/
void OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, void OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
EDA_ITEM* aItem = NULL ); EDA_ITEM* aItem = NULL );
bool OnHotkeyEditItem( int aIdCommand ); bool OnHotkeyEditItem( int aIdCommand );
bool OnHotkeyDeleteItem( int aIdCommand ); bool OnHotkeyDeleteItem( int aIdCommand );
bool OnHotkeyMoveItem( int aIdCommand ); bool OnHotkeyMoveItem( int aIdCommand );
bool OnHotkeyRotateItem( int aIdCommand ); bool OnHotkeyRotateItem( int aIdCommand );
/**
* Function Show3D_Frame
* displays 3D view of the footprint (module) being edited.
*/
void Show3D_Frame( wxCommandEvent& event ); void Show3D_Frame( wxCommandEvent& event );
void GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey = 0 ); void GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey = 0 );
void OnVerticalToolbar( wxCommandEvent& aEvent ); void OnVerticalToolbar( wxCommandEvent& aEvent );
...@@ -58,12 +103,12 @@ public: ...@@ -58,12 +103,12 @@ public:
/** /**
* Function LoadModuleFromBoard * Function LoadModuleFromBoard
* called from the main toolbar * called from the main toolbar to load a footprint from board mainly to edit it.
* to load a footprint from board mainly to edit it
*/ */
void LoadModuleFromBoard( wxCommandEvent& event ); void LoadModuleFromBoard( wxCommandEvent& event );
/** Virtual Function OnModify() /**
* Virtual Function OnModify()
* Must be called after a footprint change * Must be called after a footprint change
* in order to set the "modify" flag of the current screen * in order to set the "modify" flag of the current screen
* and prepare, if needed the refresh of the 3D frame showing the footprint * and prepare, if needed the refresh of the 3D frame showing the footprint
...@@ -77,7 +122,8 @@ public: ...@@ -77,7 +122,8 @@ public:
*/ */
void ToPrinter( wxCommandEvent& event ); void ToPrinter( wxCommandEvent& event );
/** Virtual function PrintPage /**
* Virtual function PrintPage
* used to print a page * used to print a page
* Print the page pointed by ActiveScreen, set by the calling print function * Print the page pointed by ActiveScreen, set by the calling print function
* @param aDC = wxDC given by the calling print function * @param aDC = wxDC given by the calling print function
...@@ -93,14 +139,32 @@ public: ...@@ -93,14 +139,32 @@ public:
/** /**
* Function Clear_Pcb * Function Clear_Pcb
* delete all and reinitialize the current board * delete all and reinitialize the current board
* @param aQuery = true to prompt user for confirmation, false to * @param aQuery = true to prompt user for confirmation, false to initialize silently
* initialize silently
*/ */
bool Clear_Pcb( bool aQuery ); bool Clear_Pcb( bool aQuery );
/* handlers for block commands */ /* handlers for block commands */
virtual int ReturnBlockCommand( int key ); virtual int ReturnBlockCommand( int key );
/**
* Function HandleBlockPlace
* handles the BLOCK PLACE command
* Last routine for block operation for:
* - block move & drag
* - block copy & paste
*/
virtual void HandleBlockPlace( wxDC* DC ); virtual void HandleBlockPlace( wxDC* DC );
/**
* Function HandleBlockEnd( )
* Handle the "end" of a block command,
* i.e. is called at the end of the definition of the area of a block.
* depending on the current block command, this command is executed
* or parameters are initialized to prepare a call to HandleBlockPlace
* in GetScreen()->m_BlockLocate
* @return false if no item selected, or command finished,
* true if some items found and HandleBlockPlace must be called later
*/
virtual bool HandleBlockEnd( wxDC* DC ); virtual bool HandleBlockEnd( wxDC* DC );
BOARD_ITEM* ModeditLocateAndDisplay( int aHotKeyCode = 0 ); BOARD_ITEM* ModeditLocateAndDisplay( int aHotKeyCode = 0 );
...@@ -137,7 +201,20 @@ public: ...@@ -137,7 +201,20 @@ public:
private: private:
static wxString m_CurrentLib; static wxString m_CurrentLib;
/**
* Function GetComponentFromUndoList
* performs an undo operation on the last edition:
* - Place the current edited library component in Redo list
* - Get old version of the current edited library component
*/
void GetComponentFromUndoList( wxCommandEvent& event ); void GetComponentFromUndoList( wxCommandEvent& event );
/**
* Fucntion GetComponentFromRedoList
* performs a redo operation on the the last edition:
* - Place the current edited library component in undo list
* - Get old version of the current edited library component
*/
void GetComponentFromRedoList( wxCommandEvent& event ); void GetComponentFromRedoList( wxCommandEvent& event );
/** /**
...@@ -151,6 +228,11 @@ public: ...@@ -151,6 +228,11 @@ public:
// Footprint edition // Footprint edition
void Place_Ancre( MODULE* module ); void Place_Ancre( MODULE* module );
void RemoveStruct( EDA_ITEM* Item ); void RemoveStruct( EDA_ITEM* Item );
/**
* Function Transform
* performs a geometric transform on the current footprint.
*/
void Transform( MODULE* module, int transform ); void Transform( MODULE* module, int transform );
// importing / exporting Footprint // importing / exporting Footprint
...@@ -167,6 +249,7 @@ public: ...@@ -167,6 +249,7 @@ public:
* false = use current path or last used path to export the footprint * false = use current path or last used path to export the footprint
*/ */
void Export_Module( MODULE* aModule, bool aCreateSysLib ); void Export_Module( MODULE* aModule, bool aCreateSysLib );
/** /**
* Function Import_Module * Function Import_Module
* Read a file containing only one footprint. * Read a file containing only one footprint.
...@@ -178,7 +261,6 @@ public: ...@@ -178,7 +261,6 @@ public:
*/ */
MODULE* Import_Module( ); MODULE* Import_Module( );
/** /**
* Function Load_Module_From_BOARD * Function Load_Module_From_BOARD
* load in Modedit a footfrint from the main board * load in Modedit a footfrint from the main board
...@@ -205,10 +287,39 @@ public: ...@@ -205,10 +287,39 @@ public:
* the width of all footprint's edges * the width of all footprint's edges
*/ */
void Edit_Edge_Width( EDGE_MODULE* aEdge ); void Edit_Edge_Width( EDGE_MODULE* aEdge );
/**
* Function Edit_Edge_Layer
* changes the EDGE_MODULE Edge layer, (The new layer will be asked)
* if Edge == NULL change the layer of the entire footprint edges
* @param Edge = edge to edit, or NULL
*/
void Edit_Edge_Layer( EDGE_MODULE* Edge ); void Edit_Edge_Layer( EDGE_MODULE* Edge );
/**
* Function Delete_Edge_Module
* deletes EDGE_MODULE Edge
* @param Edge = edge to delete
*/
void Delete_Edge_Module( EDGE_MODULE* Edge ); void Delete_Edge_Module( EDGE_MODULE* Edge );
/**
* Function Begin_Edge_Module
* creates a new edge item (line, arc ..).
* @param Edge = if NULL: create new edge else terminate edge and create a
* new edge
* @param DC = current Device Context
* @param type_edge = S_SEGMENT,S_ARC ..
* @return the new created edge.
*/
EDGE_MODULE* Begin_Edge_Module( EDGE_MODULE* Edge, wxDC* DC, int type_edge ); EDGE_MODULE* Begin_Edge_Module( EDGE_MODULE* Edge, wxDC* DC, int type_edge );
/**
* Function End_Edge_Module
* terminates a move or create edge function
*/
void End_Edge_Module( EDGE_MODULE* Edge ); void End_Edge_Module( EDGE_MODULE* Edge );
/** /**
* Function Enter_Edge_Width * Function Enter_Edge_Width
* Edition of width of module outlines * Edition of width of module outlines
...@@ -218,7 +329,11 @@ public: ...@@ -218,7 +329,11 @@ public:
* changes ModuleSegmentWidth (global) = new width * changes ModuleSegmentWidth (global) = new width
*/ */
void Enter_Edge_Width( EDGE_MODULE* aEdge ); void Enter_Edge_Width( EDGE_MODULE* aEdge );
/* Function to initialise the move function params of a graphic item type DRAWSEGMENT */
void Start_Move_EdgeMod( EDGE_MODULE* drawitem, wxDC* DC ); void Start_Move_EdgeMod( EDGE_MODULE* drawitem, wxDC* DC );
/* Function to place a graphic item type EDGE_MODULE currently moved */
void Place_EdgeMod( EDGE_MODULE* drawitem ); void Place_EdgeMod( EDGE_MODULE* drawitem );
// handlers for libraries: // handlers for libraries:
......
This diff is collapsed.
...@@ -38,6 +38,7 @@ ...@@ -38,6 +38,7 @@
#include "pcbstruct.h" // enum PCB_VISIBLE #include "pcbstruct.h" // enum PCB_VISIBLE
#include "collectors.h" #include "collectors.h"
#include "bitmaps.h" #include "bitmaps.h"
#include "build_version.h"
#include "protos.h" #include "protos.h"
#include "pcbnew_id.h" #include "pcbnew_id.h"
#include "drc_stuff.h" #include "drc_stuff.h"
...@@ -477,9 +478,6 @@ void PCB_EDIT_FRAME::OnCloseWindow( wxCloseEvent& Event ) ...@@ -477,9 +478,6 @@ void PCB_EDIT_FRAME::OnCloseWindow( wxCloseEvent& Event )
} }
/**
* Display 3D frame of current printed circuit board.
*/
void PCB_EDIT_FRAME::Show3D_Frame( wxCommandEvent& event ) void PCB_EDIT_FRAME::Show3D_Frame( wxCommandEvent& event )
{ {
if( m_Draw3DFrame ) if( m_Draw3DFrame )
...@@ -502,9 +500,6 @@ void PCB_EDIT_FRAME::Show3D_Frame( wxCommandEvent& event ) ...@@ -502,9 +500,6 @@ void PCB_EDIT_FRAME::Show3D_Frame( wxCommandEvent& event )
} }
/**
* Display the Design Rules Editor.
*/
void PCB_EDIT_FRAME::ShowDesignRulesEditor( wxCommandEvent& event ) void PCB_EDIT_FRAME::ShowDesignRulesEditor( wxCommandEvent& event )
{ {
DIALOG_DESIGN_RULES dR_editor( this ); DIALOG_DESIGN_RULES dR_editor( this );
...@@ -574,54 +569,30 @@ void PCB_EDIT_FRAME::SaveSettings() ...@@ -574,54 +569,30 @@ void PCB_EDIT_FRAME::SaveSettings()
} }
/**
* Function IsGridVisible() , virtual
* @return true if the grid must be shown
*/
bool PCB_EDIT_FRAME::IsGridVisible() bool PCB_EDIT_FRAME::IsGridVisible()
{ {
return IsElementVisible( GRID_VISIBLE ); return IsElementVisible( GRID_VISIBLE );
} }
/**
* Function SetGridVisibility() , virtual
* It may be overloaded by derived classes
* if you want to store/retrieve the grid visibility in configuration.
* @param aVisible = true if the grid must be shown
*/
void PCB_EDIT_FRAME::SetGridVisibility(bool aVisible) void PCB_EDIT_FRAME::SetGridVisibility(bool aVisible)
{ {
SetElementVisibility( GRID_VISIBLE, aVisible ); SetElementVisibility( GRID_VISIBLE, aVisible );
} }
/**
* Function GetGridColor() , virtual
* @return the color of the grid
*/
int PCB_EDIT_FRAME::GetGridColor() int PCB_EDIT_FRAME::GetGridColor()
{ {
return GetBoard()->GetVisibleElementColor( GRID_VISIBLE ); return GetBoard()->GetVisibleElementColor( GRID_VISIBLE );
} }
/**
* Function SetGridColor() , virtual
* @param aColor = the new color of the grid
*/
void PCB_EDIT_FRAME::SetGridColor(int aColor) void PCB_EDIT_FRAME::SetGridColor(int aColor)
{ {
GetBoard()->SetVisibleElementColor( GRID_VISIBLE, aColor ); GetBoard()->SetVisibleElementColor( GRID_VISIBLE, aColor );
} }
/* Return true if a microvia can be put on board
* A microvia is a small via restricted to 2 near neighbor layers
* because its is hole is made by laser which can penetrate only one layer
* It is mainly used to connect BGA to the first inner layer
* And it is allowed from an external layer to the first inner layer
*/
bool PCB_EDIT_FRAME::IsMicroViaAcceptable( void ) bool PCB_EDIT_FRAME::IsMicroViaAcceptable( void )
{ {
int copperlayercnt = GetBoard()->GetCopperLayerCount( ); int copperlayercnt = GetBoard()->GetCopperLayerCount( );
...@@ -658,13 +629,6 @@ void PCB_EDIT_FRAME::unitsChangeRefresh() ...@@ -658,13 +629,6 @@ void PCB_EDIT_FRAME::unitsChangeRefresh()
} }
/**
* Function SetElementVisibility
* changes the visibility of an element category
* @param aPCB_VISIBLE is from the enum by the same name
* @param aNewState = The new visibility state of the element category
* @see enum PCB_VISIBLE
*/
void PCB_EDIT_FRAME::SetElementVisibility( int aPCB_VISIBLE, bool aNewState ) void PCB_EDIT_FRAME::SetElementVisibility( int aPCB_VISIBLE, bool aNewState )
{ {
GetBoard()->SetElementVisibility( aPCB_VISIBLE, aNewState ); GetBoard()->SetElementVisibility( aPCB_VISIBLE, aNewState );
...@@ -672,10 +636,6 @@ void PCB_EDIT_FRAME::SetElementVisibility( int aPCB_VISIBLE, bool aNewState ) ...@@ -672,10 +636,6 @@ void PCB_EDIT_FRAME::SetElementVisibility( int aPCB_VISIBLE, bool aNewState )
} }
/**
* Function SetVisibleAlls
* Set the status of all visible element categories and layers to VISIBLE
*/
void PCB_EDIT_FRAME::SetVisibleAlls( ) void PCB_EDIT_FRAME::SetVisibleAlls( )
{ {
GetBoard()->SetVisibleAlls( ); GetBoard()->SetVisibleAlls( );
...@@ -685,10 +645,6 @@ void PCB_EDIT_FRAME::SetVisibleAlls( ) ...@@ -685,10 +645,6 @@ void PCB_EDIT_FRAME::SetVisibleAlls( )
} }
/**
* Function SetLanguage
* called on a language menu selection
*/
void PCB_EDIT_FRAME::SetLanguage( wxCommandEvent& event ) void PCB_EDIT_FRAME::SetLanguage( wxCommandEvent& event )
{ {
EDA_DRAW_FRAME::SetLanguage( event ); EDA_DRAW_FRAME::SetLanguage( event );
...@@ -731,13 +687,6 @@ void PCB_EDIT_FRAME::SetLastNetListRead( const wxString& aLastNetListRead ) ...@@ -731,13 +687,6 @@ void PCB_EDIT_FRAME::SetLastNetListRead( const wxString& aLastNetListRead )
} }
/**
* Function OnModify() (virtual)
* Must be called after a change
* in order to set the "modify" flag of the current screen
* and prepare, if needed the refresh of the 3D frame showing the footprint
* do not forget to call the basic OnModify function to update auxiliary info
*/
void PCB_EDIT_FRAME::OnModify( ) void PCB_EDIT_FRAME::OnModify( )
{ {
PCB_BASE_FRAME::OnModify(); PCB_BASE_FRAME::OnModify();
...@@ -747,12 +696,32 @@ void PCB_EDIT_FRAME::OnModify( ) ...@@ -747,12 +696,32 @@ void PCB_EDIT_FRAME::OnModify( )
} }
/* Prepare the data structures of print management
* And displays the dialog window management of printing sheets
*/
void PCB_EDIT_FRAME::SVG_Print( wxCommandEvent& event ) void PCB_EDIT_FRAME::SVG_Print( wxCommandEvent& event )
{ {
DIALOG_SVG_PRINT frame( this ); DIALOG_SVG_PRINT frame( this );
frame.ShowModal(); frame.ShowModal();
} }
void PCB_EDIT_FRAME::UpdateTitle()
{
wxString title;
wxFileName fileName = GetScreen()->GetFileName();
if( fileName.IsOk() && fileName.FileExists() )
{
title = wxGetApp().GetTitle() + wxT( " " ) + GetBuildVersion() +
wxT( " " ) + fileName.GetFullPath();
if( !fileName.IsFileWritable() )
title += _( " [Read Only]" );
}
else
{
title = wxGetApp().GetTitle() + wxT( " " ) + GetBuildVersion() +
wxT( " " ) + _( " [no file]" );
}
SetTitle( title );
}
...@@ -83,7 +83,7 @@ void WinEDA_App::MacOpenFile( const wxString& fileName ) ...@@ -83,7 +83,7 @@ void WinEDA_App::MacOpenFile( const wxString& fileName )
if( !filename.FileExists() ) if( !filename.FileExists() )
return; return;
frame->LoadOnePcbFile( fileName, FALSE ); frame->LoadOnePcbFile( fileName, false );
} }
...@@ -96,7 +96,7 @@ bool WinEDA_App::OnInit() ...@@ -96,7 +96,7 @@ bool WinEDA_App::OnInit()
if( m_Checker && m_Checker->IsAnotherRunning() ) if( m_Checker && m_Checker->IsAnotherRunning() )
{ {
if( !IsOK( NULL, _( "Pcbnew is already running, Continue?" ) ) ) if( !IsOK( NULL, _( "PCBnew is already running, Continue?" ) ) )
return false; return false;
} }
...@@ -112,7 +112,7 @@ bool WinEDA_App::OnInit() ...@@ -112,7 +112,7 @@ bool WinEDA_App::OnInit()
if( fn.GetExt() != PcbFileExtension ) if( fn.GetExt() != PcbFileExtension )
{ {
wxLogDebug( wxT( "PcbNew file <%s> has the wrong extension. \ wxLogDebug( wxT( "PCBNew file <%s> has the wrong extension. \
Changing extension to .brd." ), GetChars( fn.GetFullPath() ) ); Changing extension to .brd." ), GetChars( fn.GetFullPath() ) );
fn.SetExt( PcbFileExtension ); fn.SetExt( PcbFileExtension );
} }
...@@ -123,12 +123,12 @@ Changing extension to .brd." ), GetChars( fn.GetFullPath() ) ); ...@@ -123,12 +123,12 @@ Changing extension to .brd." ), GetChars( fn.GetFullPath() ) );
g_DrawBgColor = BLACK; g_DrawBgColor = BLACK;
/* Must be called before creating the main frame in order to /* Must be called before creating the main frame in order to
* display the real hotkeys in menus or tool tips */ * display the real hotkeys in menus or tool tips */
ReadHotkeyConfig( wxT("PcbFrame"), g_Board_Editor_Hokeys_Descr ); ReadHotkeyConfig( wxT("PcbFrame"), g_Board_Editor_Hokeys_Descr );
frame = new PCB_EDIT_FRAME( NULL, wxT( "PcbNew" ), wxPoint( 0, 0 ), wxSize( 600, 400 ) ); frame = new PCB_EDIT_FRAME( NULL, wxT( "PCBNew" ), wxPoint( 0, 0 ), wxSize( 600, 400 ) );
frame->SetTitle( GetTitle() + wxT( " " ) + GetBuildVersion() ); frame->UpdateTitle();
SetTopWindow( frame ); SetTopWindow( frame );
frame->Show( true ); frame->Show( true );
...@@ -144,17 +144,17 @@ Changing extension to .brd." ), GetChars( fn.GetFullPath() ) ); ...@@ -144,17 +144,17 @@ Changing extension to .brd." ), GetChars( fn.GetFullPath() ) );
/* Load file specified in the command line. */ /* Load file specified in the command line. */
if( fn.IsOk() ) if( fn.IsOk() )
{ {
/* Note the first time Pcbnew is called after creating a new project /* Note the first time PCBnew is called after creating a new project
* the board file may not exists * the board file may not exists
* So we load settings only * So we load settings only
*/ */
if( fn.FileExists() ) if( fn.FileExists() )
frame->LoadOnePcbFile( fn.GetFullPath() ); frame->LoadOnePcbFile( fn.GetFullPath() );
else else
{ // File does not exists: prepare an empty board { // File does not exists: prepare an empty board
wxSetWorkingDirectory( fn.GetPath() ); wxSetWorkingDirectory( fn.GetPath() );
frame->GetScreen()->SetFileName( fn.GetFullPath( wxPATH_UNIX ) ); frame->GetScreen()->SetFileName( fn.GetFullPath( wxPATH_UNIX ) );
frame->SetTitle( frame->GetScreen()->GetFileName() ); frame->UpdateTitle();
frame->UpdateFileHistory( frame->GetScreen()->GetFileName() ); frame->UpdateFileHistory( frame->GetScreen()->GetFileName() );
frame->OnModify(); // Ready to save the new empty board frame->OnModify(); // Ready to save the new empty board
g_SaveTime = time( NULL ); // Init the time out to save the board g_SaveTime = time( NULL ); // Init the time out to save the board
......
...@@ -20,19 +20,10 @@ static void Print_Module( EDA_DRAW_PANEL* aPanel, wxDC* aDC, MODULE* aModule, ...@@ -20,19 +20,10 @@ static void Print_Module( EDA_DRAW_PANEL* aPanel, wxDC* aDC, MODULE* aModule,
int aDraw_mode, int aMasklayer, int aDraw_mode, int aMasklayer,
PRINT_PARAMETERS::DrillShapeOptT aDrillShapeOpt ); PRINT_PARAMETERS::DrillShapeOptT aDrillShapeOpt );
/** void FOOTPRINT_EDIT_FRAME::PrintPage( wxDC* aDC,
* Function PrintPage int aPrintMaskLayer,
* Used to print the board (on printer, or when creating SVF files). bool aPrintMirrorMode,
* Print the board, but only layers allowed by aPrintMaskLayer void * aData)
* @param aDC = the print device context
* @param aPrintMaskLayer = a 32 bits mask: bit n = 1 -> layer n is printed
* @param aPrintMirrorMode = true to plot mirrored
* @param aData = a pointer to an optional data (NULL if not used)
*/
void WinEDA_ModuleEditFrame::PrintPage( wxDC* aDC,
int aPrintMaskLayer,
bool aPrintMirrorMode,
void * aData)
{ {
MODULE* Module; MODULE* Module;
int drawmode = GR_COPY; int drawmode = GR_COPY;
...@@ -42,6 +33,7 @@ void WinEDA_ModuleEditFrame::PrintPage( wxDC* aDC, ...@@ -42,6 +33,7 @@ void WinEDA_ModuleEditFrame::PrintPage( wxDC* aDC,
PRINT_PARAMETERS * printParameters = (PRINT_PARAMETERS*) aData; // can be null PRINT_PARAMETERS * printParameters = (PRINT_PARAMETERS*) aData; // can be null
PRINT_PARAMETERS::DrillShapeOptT drillShapeOpt = PRINT_PARAMETERS::FULL_DRILL_SHAPE; PRINT_PARAMETERS::DrillShapeOptT drillShapeOpt = PRINT_PARAMETERS::FULL_DRILL_SHAPE;
if( printParameters ) if( printParameters )
defaultPenSize = printParameters->m_PenDefaultSize; defaultPenSize = printParameters->m_PenDefaultSize;
...@@ -67,9 +59,9 @@ void WinEDA_ModuleEditFrame::PrintPage( wxDC* aDC, ...@@ -67,9 +59,9 @@ void WinEDA_ModuleEditFrame::PrintPage( wxDC* aDC,
DrawPanel->m_PrintIsMirrored = aPrintMirrorMode; DrawPanel->m_PrintIsMirrored = aPrintMirrorMode;
// The OR mode is used in color mode, but be aware the backgroud *must be // The OR mode is used in color mode, but be aware the background *must be
// BLACK. In the print page dialog, we first print in BLACK, and after // BLACK. In the print page dialog, we first print in BLACK, and after
// reprint in color, on the black "local" backgroud, in OR mode the black // reprint in color, on the black "local" background, in OR mode the black
// print is not made before, only a white page is printed // print is not made before, only a white page is printed
if( GetGRForceBlackPenState() == false ) if( GetGRForceBlackPenState() == false )
drawmode = GR_OR; drawmode = GR_OR;
...@@ -92,6 +84,7 @@ void WinEDA_ModuleEditFrame::PrintPage( wxDC* aDC, ...@@ -92,6 +84,7 @@ void WinEDA_ModuleEditFrame::PrintPage( wxDC* aDC,
Print_Module( DrawPanel, aDC, Module, drawmode, aPrintMaskLayer, drillShapeOpt ); Print_Module( DrawPanel, aDC, Module, drawmode, aPrintMaskLayer, drillShapeOpt );
Module->Move( -offset ); Module->Move( -offset );
} }
D_PAD::m_PadSketchModePenSize = tmp; D_PAD::m_PadSketchModePenSize = tmp;
DrawPanel->m_PrintIsMirrored = false; DrawPanel->m_PrintIsMirrored = false;
...@@ -166,8 +159,8 @@ void PCB_EDIT_FRAME::PrintPage( wxDC* aDC, ...@@ -166,8 +159,8 @@ void PCB_EDIT_FRAME::PrintPage( wxDC* aDC,
} }
// pads on Silkscreen layer are usually plot in sketch mode: // pads on Silkscreen layer are usually plot in sketch mode:
if( (GetScreen()->m_Active_Layer == SILKSCREEN_N_BACK) || if( (GetScreen()->m_Active_Layer == SILKSCREEN_N_BACK)
(GetScreen()->m_Active_Layer == SILKSCREEN_N_FRONT) ) || (GetScreen()->m_Active_Layer == SILKSCREEN_N_FRONT) )
DisplayOpt.DisplayPadFill = false; DisplayOpt.DisplayPadFill = false;
} }
...@@ -181,8 +174,8 @@ void PCB_EDIT_FRAME::PrintPage( wxDC* aDC, ...@@ -181,8 +174,8 @@ void PCB_EDIT_FRAME::PrintPage( wxDC* aDC,
m_DisplayPadFill = DisplayOpt.DisplayPadFill; m_DisplayPadFill = DisplayOpt.DisplayPadFill;
m_DisplayViaFill = DisplayOpt.DisplayViaFill; m_DisplayViaFill = DisplayOpt.DisplayViaFill;
m_DisplayPadNum = DisplayOpt.DisplayPadNum = false; m_DisplayPadNum = DisplayOpt.DisplayPadNum = false;
bool nctmp = GetBoard()->IsElementVisible(NO_CONNECTS_VISIBLE); bool nctmp = GetBoard()->IsElementVisible( NO_CONNECTS_VISIBLE );
GetBoard()->SetElementVisibility(NO_CONNECTS_VISIBLE, false); GetBoard()->SetElementVisibility( NO_CONNECTS_VISIBLE, false );
DisplayOpt.DisplayPadIsol = false; DisplayOpt.DisplayPadIsol = false;
m_DisplayModEdge = DisplayOpt.DisplayModEdge = FILLED; m_DisplayModEdge = DisplayOpt.DisplayModEdge = FILLED;
m_DisplayModText = DisplayOpt.DisplayModText = FILLED; m_DisplayModText = DisplayOpt.DisplayModText = FILLED;
...@@ -194,15 +187,16 @@ void PCB_EDIT_FRAME::PrintPage( wxDC* aDC, ...@@ -194,15 +187,16 @@ void PCB_EDIT_FRAME::PrintPage( wxDC* aDC,
DrawPanel->m_PrintIsMirrored = aPrintMirrorMode; DrawPanel->m_PrintIsMirrored = aPrintMirrorMode;
// The OR mode is used in color mode, but be aware the backgroud *must be // The OR mode is used in color mode, but be aware the background *must be
// BLACK. In the print page dialog, we first print in BLACK, and after // BLACK. In the print page dialog, we first print in BLACK, and after
// reprint in color, on the black "local" backgroud, in OR mode the black // reprint in color, on the black "local" background, in OR mode the black
// print is not made before, only a white page is printed // print is not made before, only a white page is printed
if( GetGRForceBlackPenState() == false ) if( GetGRForceBlackPenState() == false )
drawmode = GR_OR; drawmode = GR_OR;
/* Print the pcb graphic items (texts, ...) */ /* Print the pcb graphic items (texts, ...) */
GRSetDrawMode( aDC, drawmode ); GRSetDrawMode( aDC, drawmode );
for( BOARD_ITEM* item = Pcb->m_Drawings; item; item = item->Next() ) for( BOARD_ITEM* item = Pcb->m_Drawings; item; item = item->Next() )
{ {
switch( item->Type() ) switch( item->Type() )
...@@ -225,10 +219,12 @@ void PCB_EDIT_FRAME::PrintPage( wxDC* aDC, ...@@ -225,10 +219,12 @@ void PCB_EDIT_FRAME::PrintPage( wxDC* aDC,
/* Print tracks */ /* Print tracks */
pt_piste = Pcb->m_Track; pt_piste = Pcb->m_Track;
for( ; pt_piste != NULL; pt_piste = pt_piste->Next() ) for( ; pt_piste != NULL; pt_piste = pt_piste->Next() )
{ {
if( ( aPrintMaskLayer & pt_piste->ReturnMaskLayer() ) == 0 ) if( ( aPrintMaskLayer & pt_piste->ReturnMaskLayer() ) == 0 )
continue; continue;
if( pt_piste->Type() == TYPE_VIA ) /* VIA encountered. */ if( pt_piste->Type() == TYPE_VIA ) /* VIA encountered. */
{ {
int rayon = pt_piste->m_Width >> 1; int rayon = pt_piste->m_Width >> 1;
...@@ -241,22 +237,26 @@ void PCB_EDIT_FRAME::PrintPage( wxDC* aDC, ...@@ -241,22 +237,26 @@ void PCB_EDIT_FRAME::PrintPage( wxDC* aDC,
0, color, color ); 0, color, color );
} }
else else
{
pt_piste->Draw( DrawPanel, aDC, drawmode ); pt_piste->Draw( DrawPanel, aDC, drawmode );
}
} }
pt_piste = Pcb->m_Zone; pt_piste = Pcb->m_Zone;
for( ; pt_piste != NULL; pt_piste = pt_piste->Next() ) for( ; pt_piste != NULL; pt_piste = pt_piste->Next() )
{ {
if( ( aPrintMaskLayer & pt_piste->ReturnMaskLayer() ) == 0 ) if( ( aPrintMaskLayer & pt_piste->ReturnMaskLayer() ) == 0 )
continue; continue;
pt_piste->Draw( DrawPanel, aDC, drawmode ); pt_piste->Draw( DrawPanel, aDC, drawmode );
} }
/* Draw filled areas (i.e. zones) */ /* Draw filled areas (i.e. zones) */
for( int ii = 0; ii < Pcb->GetAreaCount(); ii++ ) for( int ii = 0; ii < Pcb->GetAreaCount(); ii++ )
{ {
ZONE_CONTAINER* zone = Pcb->GetArea( ii ); ZONE_CONTAINER* zone = Pcb->GetArea( ii );
if( ( aPrintMaskLayer & ( 1 << zone->GetLayer() ) ) == 0 ) if( ( aPrintMaskLayer & ( 1 << zone->GetLayer() ) ) == 0 )
continue; continue;
...@@ -268,10 +268,12 @@ void PCB_EDIT_FRAME::PrintPage( wxDC* aDC, ...@@ -268,10 +268,12 @@ void PCB_EDIT_FRAME::PrintPage( wxDC* aDC,
Module = (MODULE*) Pcb->m_Modules; Module = (MODULE*) Pcb->m_Modules;
int tmp = D_PAD::m_PadSketchModePenSize; int tmp = D_PAD::m_PadSketchModePenSize;
D_PAD::m_PadSketchModePenSize = defaultPenSize; D_PAD::m_PadSketchModePenSize = defaultPenSize;
for( ; Module != NULL; Module = Module->Next() ) for( ; Module != NULL; Module = Module->Next() )
{ {
Print_Module( DrawPanel, aDC, Module, drawmode, aPrintMaskLayer, drillShapeOpt ); Print_Module( DrawPanel, aDC, Module, drawmode, aPrintMaskLayer, drillShapeOpt );
} }
D_PAD::m_PadSketchModePenSize = tmp; D_PAD::m_PadSketchModePenSize = tmp;
/* Print via holes in bg color: Not sure it is good for buried or blind /* Print via holes in bg color: Not sure it is good for buried or blind
...@@ -283,23 +285,28 @@ void PCB_EDIT_FRAME::PrintPage( wxDC* aDC, ...@@ -283,23 +285,28 @@ void PCB_EDIT_FRAME::PrintPage( wxDC* aDC,
bool blackpenstate = GetGRForceBlackPenState(); bool blackpenstate = GetGRForceBlackPenState();
GRForceBlackPen( false ); GRForceBlackPen( false );
GRSetDrawMode( aDC, GR_COPY ); GRSetDrawMode( aDC, GR_COPY );
for( ; pt_piste != NULL; pt_piste = pt_piste->Next() ) for( ; pt_piste != NULL; pt_piste = pt_piste->Next() )
{ {
if( ( aPrintMaskLayer & pt_piste->ReturnMaskLayer() ) == 0 ) if( ( aPrintMaskLayer & pt_piste->ReturnMaskLayer() ) == 0 )
continue; continue;
if( pt_piste->Type() == TYPE_VIA ) /* VIA encountered. */ if( pt_piste->Type() == TYPE_VIA ) /* VIA encountered. */
{ {
int diameter; int diameter;
if( drillShapeOpt == PRINT_PARAMETERS::SMALL_DRILL_SHAPE ) if( drillShapeOpt == PRINT_PARAMETERS::SMALL_DRILL_SHAPE )
diameter = min( SMALL_DRILL, pt_piste->GetDrillValue()); diameter = min( SMALL_DRILL, pt_piste->GetDrillValue() );
else else
diameter = pt_piste->GetDrillValue(); diameter = pt_piste->GetDrillValue();
GRFilledCircle( &DrawPanel->m_ClipBox, aDC, GRFilledCircle( &DrawPanel->m_ClipBox, aDC,
pt_piste->m_Start.x, pt_piste->m_Start.y, pt_piste->m_Start.x, pt_piste->m_Start.y,
diameter/2, diameter/2,
0, color, color ); 0, color, color );
} }
} }
GRForceBlackPen( blackpenstate ); GRForceBlackPen( blackpenstate );
} }
...@@ -333,8 +340,10 @@ static void Print_Module( EDA_DRAW_PANEL* aPanel, wxDC* aDC, MODULE* aModule, ...@@ -333,8 +340,10 @@ static void Print_Module( EDA_DRAW_PANEL* aPanel, wxDC* aDC, MODULE* aModule,
{ {
if( (pt_pad->m_Masque_Layer & aMasklayer ) == 0 ) if( (pt_pad->m_Masque_Layer & aMasklayer ) == 0 )
continue; continue;
// Manage hole according to the print drill option // Manage hole according to the print drill option
wxSize drill_tmp = pt_pad->m_Drill; wxSize drill_tmp = pt_pad->m_Drill;
switch ( aDrillShapeOpt ) switch ( aDrillShapeOpt )
{ {
case PRINT_PARAMETERS::NO_DRILL_SHAPE: case PRINT_PARAMETERS::NO_DRILL_SHAPE:
...@@ -348,6 +357,7 @@ static void Print_Module( EDA_DRAW_PANEL* aPanel, wxDC* aDC, MODULE* aModule, ...@@ -348,6 +357,7 @@ static void Print_Module( EDA_DRAW_PANEL* aPanel, wxDC* aDC, MODULE* aModule,
// Do nothing // Do nothing
break; break;
} }
pt_pad->Draw( aPanel, aDC, aDraw_mode ); pt_pad->Draw( aPanel, aDC, aDraw_mode );
pt_pad->m_Drill = drill_tmp; pt_pad->m_Drill = drill_tmp;
} }
...@@ -355,6 +365,7 @@ static void Print_Module( EDA_DRAW_PANEL* aPanel, wxDC* aDC, MODULE* aModule, ...@@ -355,6 +365,7 @@ static void Print_Module( EDA_DRAW_PANEL* aPanel, wxDC* aDC, MODULE* aModule,
/* Print footprint graphic shapes */ /* Print footprint graphic shapes */
PtStruct = aModule->m_Drawings; PtStruct = aModule->m_Drawings;
mlayer = g_TabOneLayerMask[aModule->GetLayer()]; mlayer = g_TabOneLayerMask[aModule->GetLayer()];
if( aModule->GetLayer() == LAYER_N_BACK ) if( aModule->GetLayer() == LAYER_N_BACK )
mlayer = SILKSCREEN_LAYER_BACK; mlayer = SILKSCREEN_LAYER_BACK;
else if( aModule->GetLayer() == LAYER_N_FRONT ) else if( aModule->GetLayer() == LAYER_N_FRONT )
...@@ -364,6 +375,7 @@ static void Print_Module( EDA_DRAW_PANEL* aPanel, wxDC* aDC, MODULE* aModule, ...@@ -364,6 +375,7 @@ static void Print_Module( EDA_DRAW_PANEL* aPanel, wxDC* aDC, MODULE* aModule,
{ {
if( !aModule->m_Reference->m_NoShow ) if( !aModule->m_Reference->m_NoShow )
aModule->m_Reference->Draw( aPanel, aDC, aDraw_mode ); aModule->m_Reference->Draw( aPanel, aDC, aDraw_mode );
if( !aModule->m_Value->m_NoShow ) if( !aModule->m_Value->m_NoShow )
aModule->m_Value->Draw( aPanel, aDC, aDraw_mode ); aModule->m_Value->Draw( aPanel, aDC, aDraw_mode );
} }
...@@ -373,7 +385,7 @@ static void Print_Module( EDA_DRAW_PANEL* aPanel, wxDC* aDC, MODULE* aModule, ...@@ -373,7 +385,7 @@ static void Print_Module( EDA_DRAW_PANEL* aPanel, wxDC* aDC, MODULE* aModule,
switch( PtStruct->Type() ) switch( PtStruct->Type() )
{ {
case TYPE_TEXTE_MODULE: case TYPE_TEXTE_MODULE:
if( (mlayer & aMasklayer ) == 0 ) if( ( mlayer & aMasklayer ) == 0 )
break; break;
TextMod = (TEXTE_MODULE*) PtStruct; TextMod = (TEXTE_MODULE*) PtStruct;
......
...@@ -20,8 +20,7 @@ ...@@ -20,8 +20,7 @@
#endif #endif
/* Create the main horizontal toolbar for the footprint editor */ void FOOTPRINT_EDIT_FRAME::ReCreateHToolbar()
void WinEDA_ModuleEditFrame::ReCreateHToolbar()
{ {
if( m_HToolBar != NULL ) if( m_HToolBar != NULL )
return; return;
...@@ -111,13 +110,12 @@ void WinEDA_ModuleEditFrame::ReCreateHToolbar() ...@@ -111,13 +110,12 @@ void WinEDA_ModuleEditFrame::ReCreateHToolbar()
wxBitmap( module_check_xpm ), wxBitmap( module_check_xpm ),
_( "Check module" ) ); _( "Check module" ) );
// after adding the buttons to the toolbar, must call Realize() to reflect // after adding the buttons to the toolbar, must call Realize() to reflect the changes
// the changes
m_HToolBar->Realize(); m_HToolBar->Realize();
} }
void WinEDA_ModuleEditFrame::ReCreateVToolbar() void FOOTPRINT_EDIT_FRAME::ReCreateVToolbar()
{ {
if( m_VToolBar ) if( m_VToolBar )
return; return;
...@@ -163,7 +161,7 @@ void WinEDA_ModuleEditFrame::ReCreateVToolbar() ...@@ -163,7 +161,7 @@ void WinEDA_ModuleEditFrame::ReCreateVToolbar()
} }
void WinEDA_ModuleEditFrame::ReCreateOptToolbar() void FOOTPRINT_EDIT_FRAME::ReCreateOptToolbar()
{ {
if( m_OptionsToolBar ) if( m_OptionsToolBar )
return; return;
...@@ -206,7 +204,7 @@ void WinEDA_ModuleEditFrame::ReCreateOptToolbar() ...@@ -206,7 +204,7 @@ void WinEDA_ModuleEditFrame::ReCreateOptToolbar()
} }
void WinEDA_ModuleEditFrame::ReCreateAuxiliaryToolbar() void FOOTPRINT_EDIT_FRAME::ReCreateAuxiliaryToolbar()
{ {
wxString msg; wxString msg;
......
...@@ -56,7 +56,7 @@ void PCB_EDIT_FRAME::ToolOnRightClick( wxCommandEvent& event ) ...@@ -56,7 +56,7 @@ void PCB_EDIT_FRAME::ToolOnRightClick( wxCommandEvent& event )
} }
void WinEDA_ModuleEditFrame::ToolOnRightClick( wxCommandEvent& event ) void FOOTPRINT_EDIT_FRAME::ToolOnRightClick( wxCommandEvent& event )
{ {
wxPoint pos; wxPoint pos;
int id = event.GetSelection(); int id = event.GetSelection();
......
...@@ -33,9 +33,7 @@ static void Trace_Pads_Only( EDA_DRAW_PANEL* panel, wxDC* DC, MODULE* Module, ...@@ -33,9 +33,7 @@ static void Trace_Pads_Only( EDA_DRAW_PANEL* panel, wxDC* DC, MODULE* Module,
int ox, int oy, int MasqueLayer, int draw_mode ); int ox, int oy, int MasqueLayer, int draw_mode );
/* Draw the footprint editor BOARD, and others elements : axis, grid .. void FOOTPRINT_EDIT_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg )
*/
void WinEDA_ModuleEditFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
{ {
PCB_SCREEN* screen = (PCB_SCREEN*)GetScreen(); PCB_SCREEN* screen = (PCB_SCREEN*)GetScreen();
...@@ -54,7 +52,7 @@ void WinEDA_ModuleEditFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg ) ...@@ -54,7 +52,7 @@ void WinEDA_ModuleEditFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
} }
#ifdef USE_WX_OVERLAY #ifdef USE_WX_OVERLAY
if(IsShown()) if( IsShown() )
{ {
DrawPanel->m_overlay.Reset(); DrawPanel->m_overlay.Reset();
wxDCOverlay overlaydc( DrawPanel->m_overlay, (wxWindowDC*)DC ); wxDCOverlay overlaydc( DrawPanel->m_overlay, (wxWindowDC*)DC );
...@@ -63,7 +61,7 @@ void WinEDA_ModuleEditFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg ) ...@@ -63,7 +61,7 @@ void WinEDA_ModuleEditFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
#endif #endif
if( DrawPanel->IsMouseCaptured() ) if( DrawPanel->IsMouseCaptured() )
DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, FALSE ); DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, false );
/* Redraw the cursor */ /* Redraw the cursor */
DrawPanel->DrawCrossHair( DC ); DrawPanel->DrawCrossHair( DC );
...@@ -99,7 +97,7 @@ void PCB_EDIT_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg ) ...@@ -99,7 +97,7 @@ void PCB_EDIT_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg )
#endif #endif
if( DrawPanel->IsMouseCaptured() ) if( DrawPanel->IsMouseCaptured() )
DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, FALSE ); DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, false );
// Redraw the cursor // Redraw the cursor
DrawPanel->DrawCrossHair( DC ); DrawPanel->DrawCrossHair( DC );
...@@ -107,8 +105,7 @@ void PCB_EDIT_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg ) ...@@ -107,8 +105,7 @@ void PCB_EDIT_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg )
/* Redraw the BOARD items but not cursors, axis or grid */ /* Redraw the BOARD items but not cursors, axis or grid */
void BOARD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* DC, void BOARD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* DC, int aDrawMode, const wxPoint& offset )
int aDrawMode, const wxPoint& offset )
{ {
/* The order of drawing is flexible on some systems and not on others. For /* The order of drawing is flexible on some systems and not on others. For
* OSes which use OR to draw, the order is not important except for the * OSes which use OR to draw, the order is not important except for the
...@@ -180,14 +177,14 @@ void BOARD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* DC, ...@@ -180,14 +177,14 @@ void BOARD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* DC,
if( !IsElementVisible( PCB_VISIBLE(MOD_FR_VISIBLE) ) ) if( !IsElementVisible( PCB_VISIBLE(MOD_FR_VISIBLE) ) )
{ {
if( module->GetLayer() == LAYER_N_FRONT ) if( module->GetLayer() == LAYER_N_FRONT )
display = FALSE; display = false;
layerMask &= ~LAYER_FRONT; layerMask &= ~LAYER_FRONT;
} }
if( !IsElementVisible( PCB_VISIBLE(MOD_BK_VISIBLE) ) ) if( !IsElementVisible( PCB_VISIBLE(MOD_BK_VISIBLE) ) )
{ {
if( module->GetLayer() == LAYER_N_BACK ) if( module->GetLayer() == LAYER_N_BACK )
display = FALSE; display = false;
layerMask &= ~LAYER_BACK; layerMask &= ~LAYER_BACK;
} }
...@@ -200,8 +197,7 @@ void BOARD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* DC, ...@@ -200,8 +197,7 @@ void BOARD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* DC,
if( IsHightLightNetON() ) if( IsHightLightNetON() )
DrawHighLight( aPanel, DC, GetHightLightNetCode() ); DrawHighLight( aPanel, DC, GetHightLightNetCode() );
// draw the BOARD's markers last, otherwise the high light will erase // draw the BOARD's markers last, otherwise the high light will erase any marker on a pad
// any marker on a pad
for( unsigned i=0; i < m_markers.size(); ++i ) for( unsigned i=0; i < m_markers.size(); ++i )
{ {
m_markers[i]->Draw( aPanel, DC, aDrawMode ); m_markers[i]->Draw( aPanel, DC, aDrawMode );
...@@ -220,6 +216,7 @@ void BOARD::DrawHighLight( EDA_DRAW_PANEL* aDrawPanel, wxDC* DC, int aNetCode ) ...@@ -220,6 +216,7 @@ void BOARD::DrawHighLight( EDA_DRAW_PANEL* aDrawPanel, wxDC* DC, int aNetCode )
// Redraw ZONE_CONTAINERS // Redraw ZONE_CONTAINERS
BOARD::ZONE_CONTAINERS& zones = m_ZoneDescriptorList; BOARD::ZONE_CONTAINERS& zones = m_ZoneDescriptorList;
for( BOARD::ZONE_CONTAINERS::iterator zc = zones.begin(); zc!=zones.end(); ++zc ) for( BOARD::ZONE_CONTAINERS::iterator zc = zones.begin(); zc!=zones.end(); ++zc )
{ {
if( (*zc)->GetNet() == aNetCode ) if( (*zc)->GetNet() == aNetCode )
...@@ -265,7 +262,7 @@ void Trace_Pads_Only( EDA_DRAW_PANEL* panel, wxDC* DC, MODULE* Module, ...@@ -265,7 +262,7 @@ void Trace_Pads_Only( EDA_DRAW_PANEL* panel, wxDC* DC, MODULE* Module,
frame = (PCB_BASE_FRAME*) panel->GetParent(); frame = (PCB_BASE_FRAME*) panel->GetParent();
tmp = frame->m_DisplayPadFill; tmp = frame->m_DisplayPadFill;
frame->m_DisplayPadFill = FALSE; frame->m_DisplayPadFill = false;
/* Draw pads. */ /* Draw pads. */
for( D_PAD* pad = Module->m_Pads; pad; pad = pad->Next() ) for( D_PAD* pad = Module->m_Pads; pad; pad = pad->Next() )
...@@ -278,4 +275,3 @@ void Trace_Pads_Only( EDA_DRAW_PANEL* panel, wxDC* DC, MODULE* Module, ...@@ -278,4 +275,3 @@ void Trace_Pads_Only( EDA_DRAW_PANEL* panel, wxDC* DC, MODULE* Module,
frame->m_DisplayPadFill = tmp; frame->m_DisplayPadFill = tmp;
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment