From f64b282778467399055f53050948de83ffb2075d Mon Sep 17 00:00:00 2001 From: charras Date: Thu, 15 Jan 2009 08:12:03 +0000 Subject: [PATCH] BUGFIX: .mdc is incomplete after 'archive footprint' --- include/wxPcbStruct.h | 830 +++++++++++++++++++++--------------------- pcbnew/librairi.cpp | 183 +++++----- pcbnew/modedit.cpp | 26 +- 3 files changed, 530 insertions(+), 509 deletions(-) diff --git a/include/wxPcbStruct.h b/include/wxPcbStruct.h index 3c2f9c324a..b7533db231 100644 --- a/include/wxPcbStruct.h +++ b/include/wxPcbStruct.h @@ -11,7 +11,7 @@ #ifndef PCB_INTERNAL_UNIT -#define PCB_INTERNAL_UNIT 10000 +#define PCB_INTERNAL_UNIT 10000 #endif @@ -55,17 +55,17 @@ class WinEDA_BasePcbFrame : public WinEDA_DrawFrame public: - bool m_DisplayPadFill; // How show pads - bool m_DisplayPadNum; // show pads numbers + bool m_DisplayPadFill; // How show pads + bool m_DisplayPadNum; // show pads numbers - int m_DisplayModEdge; // How show module drawings - int m_DisplayModText; // How show module texts - bool m_DisplayPcbTrackFill; /* FALSE : tracks are show in sketch mode, TRUE = filled */ - WinEDA3D_DrawFrame* m_Draw3DFrame; - WinEDA_ModuleEditFrame* m_ModuleEditFrame; + int m_DisplayModEdge; // How show module drawings + int m_DisplayModText; // How show module texts + bool m_DisplayPcbTrackFill; /* FALSE : tracks are show in sketch mode, TRUE = filled */ + WinEDA3D_DrawFrame* m_Draw3DFrame; + WinEDA_ModuleEditFrame* m_ModuleEditFrame; protected: - GENERAL_COLLECTOR* m_Collector; + GENERAL_COLLECTOR* m_Collector; public: @@ -82,64 +82,65 @@ public: * BOARD. * @param aBoard The BOARD to put into the frame. */ - void SetBoard( BOARD* aBoard ); + void SetBoard( BOARD* aBoard ); - BOARD* GetBoard() + BOARD* GetBoard() { wxASSERT( m_Pcb ); // phasing out m_Pcb for gerbview return m_Pcb; } + // General - virtual void OnCloseWindow( wxCloseEvent& Event ) = 0; - virtual void Process_Special_Functions( wxCommandEvent& event ) = 0; - virtual void RedrawActiveWindow( wxDC* DC, bool EraseBg ) = 0; - virtual void ReCreateHToolbar() = 0; - virtual void ReCreateVToolbar() = 0; - virtual void OnLeftClick( wxDC* DC, const wxPoint& MousePos ) = 0; - virtual void OnLeftDClick( wxDC* DC, const wxPoint& MousePos ) = 0; - virtual bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ) = 0; - virtual void ReCreateMenuBar(); - virtual void SetToolID( int id, int new_cursor_id, - const wxString& title ); - virtual void Affiche_Status_Box(); + virtual void OnCloseWindow( wxCloseEvent& Event ) = 0; + virtual void Process_Special_Functions( wxCommandEvent& event ) = 0; + virtual void RedrawActiveWindow( wxDC* DC, bool EraseBg ) = 0; + virtual void ReCreateHToolbar() = 0; + virtual void ReCreateVToolbar() = 0; + virtual void OnLeftClick( wxDC* DC, const wxPoint& MousePos ) = 0; + virtual void OnLeftDClick( wxDC* DC, const wxPoint& MousePos ) = 0; + virtual bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ) = 0; + virtual void ReCreateMenuBar(); + virtual void SetToolID( int id, int new_cursor_id, + const wxString& title ); + virtual void Affiche_Status_Box(); - PCB_SCREEN* GetScreen() const { return (PCB_SCREEN*) WinEDA_DrawFrame::GetBaseScreen(); } + PCB_SCREEN* GetScreen() const { return (PCB_SCREEN*) WinEDA_DrawFrame::GetBaseScreen(); } - BASE_SCREEN* GetBaseScreen() const; + BASE_SCREEN* GetBaseScreen() const; - int BestZoom(); + int BestZoom(); - void Show3D_Frame( wxCommandEvent& event ); + void Show3D_Frame( wxCommandEvent& event ); - virtual void GeneralControle( wxDC* DC, wxPoint Mouse ); + virtual void GeneralControle( wxDC* DC, wxPoint Mouse ); // Undo and redo functions public: - virtual void SaveCopyInUndoList( EDA_BaseStruct* ItemToCopy, - int flag_type_command = 0 ); + virtual void SaveCopyInUndoList( EDA_BaseStruct* ItemToCopy, + int flag_type_command = 0 ); private: - virtual void GetComponentFromUndoList(); - virtual void GetComponentFromRedoList(); + virtual void GetComponentFromUndoList(); + virtual void GetComponentFromRedoList(); public: // Read/write fonctions: - EDA_BaseStruct* ReadDrawSegmentDescr( FILE* File, int* LineNum ); - int ReadListeSegmentDescr( FILE* File, - TRACK* PtSegm, int StructType, - int* LineNum, int NumSegm ); + EDA_BaseStruct* ReadDrawSegmentDescr( FILE* File, int* LineNum ); + int ReadListeSegmentDescr( FILE* File, + TRACK* PtSegm, int StructType, + int* LineNum, int NumSegm ); - int ReadSetup( FILE* File, int* LineNum ); - int ReadGeneralDescrPcb( FILE* File, int* LineNum ); + int ReadSetup( FILE* File, int* LineNum ); + int ReadGeneralDescrPcb( FILE* File, int* LineNum ); // PCB handling - bool Clear_Pcb( bool query ); + bool Clear_Pcb( bool query ); - void UnDeleteItem( wxDC* DC ); - BOARD_ITEM* SaveItemEfface( BOARD_ITEM* aItem, int nbitems ); + void UnDeleteItem( wxDC* DC ); + BOARD_ITEM* SaveItemEfface( BOARD_ITEM* aItem, int nbitems ); /** @@ -156,9 +157,9 @@ public: * type of search to be performed. If zero, then the mouse tools will be * tested instead. */ - BOARD_ITEM* PcbGeneralLocateAndDisplay( int aHotKeyCode = 0 ); + BOARD_ITEM* PcbGeneralLocateAndDisplay( int aHotKeyCode = 0 ); - void ProcessItemSelection( wxCommandEvent& event ); + void ProcessItemSelection( wxCommandEvent& event ); /** * Function SetCurItem @@ -169,14 +170,14 @@ public: * of selecting an item to displaying it using BOARD_ITEM::Display_Infos(). * @param aItem The BOARD_ITEM to make the selected item or NULL if none. */ - void SetCurItem( BOARD_ITEM* aItem ); - BOARD_ITEM* GetCurItem(); + void SetCurItem( BOARD_ITEM* aItem ); + BOARD_ITEM* GetCurItem(); /** * Function GetCollectorsGuide * @return GENERAL_COLLECTORS_GUIDE - that considers the global configuration options. */ - GENERAL_COLLECTORS_GUIDE GetCollectorsGuide(); + GENERAL_COLLECTORS_GUIDE GetCollectorsGuide(); /** @@ -185,126 +186,138 @@ public: * requested point is out of view. * @param aPos The point to go to. */ - void CursorGoto( const wxPoint& aPos ); + void CursorGoto( const wxPoint& aPos ); /* Place un repere sur l'ecran au point de coordonnees PCB pos */ - void place_marqueur( wxDC* DC, const wxPoint& pos, char* pt_bitmap, - int DrawMode, int color, int type ); + void place_marqueur( wxDC* DC, const wxPoint& pos, char* pt_bitmap, + int DrawMode, int color, int type ); // Gestion des modules - void InstallModuleOptionsFrame( MODULE* Module, - wxDC* DC, const wxPoint& pos ); - MODULE* Copie_Module( MODULE* module ); - MODULE* Exchange_Module( wxWindow* winaff, - MODULE* old_module, - MODULE* new_module ); - int Save_1_Module( const wxString& LibName, MODULE* Module, - bool Overwrite, bool DisplayDialog ); - void Archive_Modules( const wxString& LibName, bool NewModulesOnly ); - MODULE* Select_1_Module_From_BOARD( BOARD* Pcb ); - MODULE* GetModuleByName(); + void InstallModuleOptionsFrame( MODULE* Module, + wxDC* DC, const wxPoint& pos ); + MODULE* Copie_Module( MODULE* module ); + MODULE* Exchange_Module( wxWindow* winaff, + MODULE* old_module, + MODULE* new_module ); + + /** Function Save_Module_In_Library + * Save in an existing library a given footprint + * @param aLibName = name of the library to use + * @param aModule = the given footprint + * @param aOverwrite = true to overwrite an existing footprint, false to abort an existing footprint is found + * @param aDisplayDialog = true to display a dialog to enter or confirm the footprint name + * @param aCreateDocFile = true to creates the associated doc file + * @return : 1 if OK,0 if abort + */ + int Save_Module_In_Library( const wxString& aLibName, + MODULE* aModule, bool aOverwrite, + bool aDisplayDialog, bool aCreateDocFile ); + + void Archive_Modules( const wxString& LibName, bool NewModulesOnly ); + MODULE* Select_1_Module_From_BOARD( BOARD* Pcb ); + MODULE* GetModuleByName(); // Modules (footprints) - MODULE* Create_1_Module( wxDC* DC, const wxString& module_name ); - void Edit_Module( MODULE* module, wxDC* DC ); - void Rotate_Module( wxDC* DC, - MODULE* module, - int angle, - bool incremental ); - void Place_Module( MODULE* module, wxDC* DC ); - void InstallExchangeModuleFrame( MODULE* ExchangeModuleModule, - wxDC* DC, const wxPoint& pos ); + MODULE* Create_1_Module( wxDC* DC, const wxString& module_name ); + void Edit_Module( MODULE* module, wxDC* DC ); + void Rotate_Module( wxDC* DC, + MODULE* module, + int angle, + bool incremental ); + void Place_Module( MODULE* module, wxDC* DC ); + void InstallExchangeModuleFrame( MODULE* ExchangeModuleModule, + wxDC* DC, const wxPoint& pos ); + // Graphic items edition: - void InstallGraphicItemPropertiesDialog(DRAWSEGMENT * aItem, wxDC* aDC); + void InstallGraphicItemPropertiesDialog( DRAWSEGMENT* aItem, wxDC* aDC ); // module texts - void RotateTextModule( TEXTE_MODULE* Text, wxDC* DC ); - void DeleteTextModule( TEXTE_MODULE* Text, wxDC* DC ); - void PlaceTexteModule( TEXTE_MODULE* Text, wxDC* DC ); - void StartMoveTexteModule( TEXTE_MODULE* Text, wxDC* DC ); - TEXTE_MODULE* CreateTextModule( MODULE* Module, wxDC* DC ); + void RotateTextModule( TEXTE_MODULE* Text, wxDC* DC ); + void DeleteTextModule( TEXTE_MODULE* Text, wxDC* DC ); + void PlaceTexteModule( TEXTE_MODULE* Text, wxDC* DC ); + void StartMoveTexteModule( TEXTE_MODULE* Text, wxDC* DC ); + TEXTE_MODULE* CreateTextModule( MODULE* Module, wxDC* DC ); - void InstallPadOptionsFrame( D_PAD* pad, wxDC* DC, const wxPoint& pos ); - void InstallTextModOptionsFrame( TEXTE_MODULE* TextMod, - wxDC* DC, const wxPoint& pos ); + void InstallPadOptionsFrame( D_PAD* pad, wxDC* DC, const wxPoint& pos ); + void InstallTextModOptionsFrame( TEXTE_MODULE* TextMod, + wxDC* DC, const wxPoint& pos ); // Pads sur modules - void AddPad( MODULE* Module, bool draw ); - void DeletePad( D_PAD* Pad, wxDC* DC ); - void StartMovePad( D_PAD* Pad, wxDC* DC ); - void RotatePad( D_PAD* Pad, wxDC* DC ); - void PlacePad( D_PAD* Pad, wxDC* DC ); - void Export_Pad_Settings( D_PAD* aPad ); - void Import_Pad_Settings( D_PAD* aPad, bool aDraw ); - void Global_Import_Pad_Settings( D_PAD* aPad, bool aDraw ); + void AddPad( MODULE* Module, bool draw ); + void DeletePad( D_PAD* Pad, wxDC* DC ); + void StartMovePad( D_PAD* Pad, wxDC* DC ); + void RotatePad( D_PAD* Pad, wxDC* DC ); + void PlacePad( D_PAD* Pad, wxDC* DC ); + void Export_Pad_Settings( D_PAD* aPad ); + void Import_Pad_Settings( D_PAD* aPad, bool aDraw ); + void Global_Import_Pad_Settings( D_PAD* aPad, bool aDraw ); // loading footprints - MODULE* Get_Librairie_Module( wxWindow* winaff, - const wxString& library, - const wxString& ModuleName, - bool show_msg_err ); + MODULE* Get_Librairie_Module( wxWindow* winaff, + const wxString& library, + const wxString& ModuleName, + bool show_msg_err ); - wxString Select_1_Module_From_List( + wxString Select_1_Module_From_List( WinEDA_DrawFrame* active_window, const wxString& Library, const wxString& Mask, const wxString& KeyWord ); - MODULE* Load_Module_From_Library( const wxString& library, wxDC* DC ); + MODULE* Load_Module_From_Library( const wxString& library, wxDC* DC ); // ratsnest functions - void Compile_Ratsnest( wxDC* DC, bool affiche ); /* Recalcul complet du chevelu */ - void ReCompile_Ratsnest_After_Changes( wxDC* DC ); - int Test_1_Net_Ratsnest( wxDC* DC, int net_code ); - char* build_ratsnest_module( wxDC* DC, MODULE* Module ); - void trace_ratsnest_module( wxDC* DC ); - void Build_Board_Ratsnest( wxDC* DC ); - void DrawGeneralRatsnest( wxDC* DC, int net_code = 0 ); - void trace_ratsnest_pad( wxDC* DC ); - void recalcule_pad_net_code(); /* compute and update the PAD net codes */ - void build_liste_pads(); - int* build_ratsnest_pad( EDA_BaseStruct* ref, - const wxPoint& refpos, - bool init ); + void Compile_Ratsnest( wxDC* DC, bool affiche ); /* Recalcul complet du chevelu */ + void ReCompile_Ratsnest_After_Changes( wxDC* DC ); + int Test_1_Net_Ratsnest( wxDC* DC, int net_code ); + char* build_ratsnest_module( wxDC* DC, MODULE* Module ); + void trace_ratsnest_module( wxDC* DC ); + void Build_Board_Ratsnest( wxDC* DC ); + void DrawGeneralRatsnest( wxDC* DC, int net_code = 0 ); + void trace_ratsnest_pad( wxDC* DC ); + void recalcule_pad_net_code(); /* compute and update the PAD net codes */ + void build_liste_pads(); + int* build_ratsnest_pad( EDA_BaseStruct* ref, + const wxPoint& refpos, + bool init ); - void Tst_Ratsnest( wxDC* DC, int ref_netcode ); - void test_connexions( wxDC* DC ); - void test_1_net_connexion( wxDC* DC, int net_code ); - void reattribution_reference_piste( int affiche ); + void Tst_Ratsnest( wxDC* DC, int ref_netcode ); + void test_connexions( wxDC* DC ); + void test_1_net_connexion( wxDC* DC, int net_code ); + void reattribution_reference_piste( int affiche ); // Plotting - void ToPlotter( wxCommandEvent& event ); - void Plot_Serigraphie( int format_plot, FILE* File, int masque_layer ); - void Genere_GERBER( const wxString& FullFileName, int Layer, - bool PlotOriginIsAuxAxis ); - void Genere_HPGL( const wxString& FullFileName, int Layer ); - void Genere_PS( const wxString& FullFileName, int Layer, bool useA4 ); - void Plot_Layer_HPGL( FILE* File, int masque_layer, - int garde, int tracevia, int modetrace ); - void Plot_Layer_GERBER( FILE* File, int masque_layer, - int garde, int tracevia ); - void Plot_Layer_PS( FILE* File, int masque_layer, - int garde, int tracevia, int modetrace ); + void ToPlotter( wxCommandEvent& event ); + void Plot_Serigraphie( int format_plot, FILE* File, int masque_layer ); + void Genere_GERBER( const wxString& FullFileName, int Layer, + bool PlotOriginIsAuxAxis ); + void Genere_HPGL( const wxString& FullFileName, int Layer ); + void Genere_PS( const wxString& FullFileName, int Layer, bool useA4 ); + void Plot_Layer_HPGL( FILE* File, int masque_layer, + int garde, int tracevia, int modetrace ); + void Plot_Layer_GERBER( FILE* File, int masque_layer, + int garde, int tracevia ); + void Plot_Layer_PS( FILE* File, int masque_layer, + int garde, int tracevia, int modetrace ); /* Block operations: */ - void Block_Delete( wxDC* DC ); - void Block_Rotate( wxDC* DC ); - void Block_Invert( wxDC* DC ); - void Block_Move( wxDC* DC ); - void Block_Duplicate( wxDC* DC ); - + void Block_Delete( wxDC* DC ); + void Block_Rotate( wxDC* DC ); + void Block_Invert( wxDC* DC ); + void Block_Move( wxDC* DC ); + void Block_Duplicate( wxDC* DC ); // layerhandling: // (See pcbnew/sel_layer.cpp for description of why null_layer parameter is provided) - int SelectLayer( int default_layer, int min_layer, int max_layer, - bool null_layer = false ); - void SelectLayerPair(); - virtual void SwitchLayer( wxDC* DC, int layer ); + int SelectLayer( int default_layer, int min_layer, int max_layer, + bool null_layer = false ); + void SelectLayerPair(); + virtual void SwitchLayer( wxDC* DC, int layer ); // divers - void AddHistory( int value, KICAD_T type ); // Add value in data list history - void InstallGridFrame( const wxPoint& pos ); + void AddHistory( int value, KICAD_T type ); // Add value in data list history + void InstallGridFrame( const wxPoint& pos ); DECLARE_EVENT_TABLE() }; @@ -329,13 +342,13 @@ private: // we'll use lower case function names for private member functions. - void createPopUpMenuForZones( ZONE_CONTAINER* edge_zone, wxMenu* aPopMenu ); - void createPopUpMenuForFootprints( MODULE* aModule, wxMenu* aPopMenu ); - void createPopUpMenuForFpTexts( TEXTE_MODULE* aText, wxMenu* aPopMenu ); - void createPopUpMenuForFpPads( D_PAD* aPad, wxMenu* aPopMenu ); - void createPopupMenuForTracks( TRACK* aTrack, wxMenu* aPopMenu ); - void createPopUpMenuForTexts( TEXTE_PCB* Text, wxMenu* menu ); - void createPopUpBlockMenu( wxMenu* menu ); + void createPopUpMenuForZones( ZONE_CONTAINER* edge_zone, wxMenu* aPopMenu ); + void createPopUpMenuForFootprints( MODULE* aModule, wxMenu* aPopMenu ); + void createPopUpMenuForFpTexts( TEXTE_MODULE* aText, wxMenu* aPopMenu ); + void createPopUpMenuForFpPads( D_PAD* aPad, wxMenu* aPopMenu ); + void createPopupMenuForTracks( TRACK* aTrack, wxMenu* aPopMenu ); + void createPopUpMenuForTexts( TEXTE_PCB* Text, wxMenu* menu ); + void createPopUpBlockMenu( wxMenu* menu ); public: WinEDA_PcbFrame( wxWindow* father, const wxString& title, @@ -344,40 +357,40 @@ public: ~WinEDA_PcbFrame(); - void GetKicadAbout( wxCommandEvent& event ); + void GetKicadAbout( wxCommandEvent& event ); // Configurations: - void InstallConfigFrame( const wxPoint& pos ); - void Process_Config( wxCommandEvent& event ); - void Update_config( wxWindow* displayframe ); - void OnHotKey( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct ); - bool OnHotkeyDeleteItem( wxDC* DC, EDA_BaseStruct* DrawStruct ); + void InstallConfigFrame( const wxPoint& pos ); + void Process_Config( wxCommandEvent& event ); + void Update_config( wxWindow* displayframe ); + void OnHotKey( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct ); + bool OnHotkeyDeleteItem( wxDC* DC, EDA_BaseStruct* DrawStruct ); - void OnCloseWindow( wxCloseEvent& Event ); - void Process_Special_Functions( wxCommandEvent& event ); + void OnCloseWindow( wxCloseEvent& Event ); + void Process_Special_Functions( wxCommandEvent& event ); - void ProcessMuWaveFunctions( wxCommandEvent& event ); - void MuWaveCommand( wxDC* DC, const wxPoint& MousePos ); + void ProcessMuWaveFunctions( wxCommandEvent& event ); + void MuWaveCommand( wxDC* DC, const wxPoint& MousePos ); - void RedrawActiveWindow( wxDC* DC, bool EraseBg ); - void ReCreateHToolbar(); - void ReCreateAuxiliaryToolbar(); - void ReCreateVToolbar(); - void ReCreateAuxVToolbar(); - void ReCreateOptToolbar(); - void ReCreateMenuBar(); - WinEDAChoiceBox* ReCreateLayerBox( WinEDA_Toolbar* parent ); + void RedrawActiveWindow( wxDC* DC, bool EraseBg ); + void ReCreateHToolbar(); + void ReCreateAuxiliaryToolbar(); + void ReCreateVToolbar(); + void ReCreateAuxVToolbar(); + void ReCreateOptToolbar(); + void ReCreateMenuBar(); + WinEDAChoiceBox* ReCreateLayerBox( WinEDA_Toolbar* parent ); /** * Function UpdateToolbarLayerInfo * updates the currently selected layer in the layer listbox and * the colored icon in the toolbar. */ - void UpdateToolbarLayerInfo(); + void UpdateToolbarLayerInfo(); - void PrepareLayerIndicator(); - void OnLeftClick( wxDC* DC, const wxPoint& MousePos ); - void OnLeftDClick( wxDC* DC, const wxPoint& MousePos ); + void PrepareLayerIndicator(); + void OnLeftClick( wxDC* DC, const wxPoint& MousePos ); + void OnLeftDClick( wxDC* DC, const wxPoint& MousePos ); /** * Function OnRightClick @@ -386,35 +399,35 @@ public: * @param aMousePos The current mouse position * @param aPopMenu The menu to add to. */ - bool OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu ); + bool OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu ); - void OnSelectOptionToolbar( wxCommandEvent& event ); - void ToolOnRightClick( wxCommandEvent& event ); + void OnSelectOptionToolbar( wxCommandEvent& event ); + void ToolOnRightClick( wxCommandEvent& event ); /* Gestion generale des operations sur block */ - int ReturnBlockCommand( int key ); - void HandleBlockPlace( wxDC* DC ); - int HandleBlockEnd( wxDC* DC ); + int ReturnBlockCommand( int key ); + void HandleBlockPlace( wxDC* DC ); + int HandleBlockEnd( wxDC* DC ); - void SetToolbars(); - void Process_Settings( wxCommandEvent& event ); - void InstallPcbOptionsFrame( const wxPoint& pos, wxDC* DC, int id ); - void InstallPcbGlobalDeleteFrame( const wxPoint& pos ); + void SetToolbars(); + void Process_Settings( wxCommandEvent& event ); + void InstallPcbOptionsFrame( const wxPoint& pos, wxDC* DC, int id ); + void InstallPcbGlobalDeleteFrame( const wxPoint& pos ); - void GenModulesPosition( wxCommandEvent& event ); - void GenModuleReport( wxCommandEvent& event ); - void InstallDrillFrame( wxCommandEvent& event ); - void ToPostProcess( wxCommandEvent& event ); + void GenModulesPosition( wxCommandEvent& event ); + void GenModuleReport( wxCommandEvent& event ); + void InstallDrillFrame( wxCommandEvent& event ); + void ToPostProcess( wxCommandEvent& event ); - void Files_io( wxCommandEvent& event ); - int LoadOnePcbFile( const wxString& FileName, bool Append ); - int ReadPcbFile( FILE* File, bool Append ); - bool SavePcbFile( const wxString& FileName ); - int SavePcbFormatAscii( FILE* File ); - bool WriteGeneralDescrPcb( FILE* File ); - bool RecreateCmpFileFromBoard(); + void Files_io( wxCommandEvent& event ); + int LoadOnePcbFile( const wxString& FileName, bool Append ); + int ReadPcbFile( FILE* File, bool Append ); + bool SavePcbFile( const wxString& FileName ); + int SavePcbFormatAscii( FILE* File ); + bool WriteGeneralDescrPcb( FILE* File ); + bool RecreateCmpFileFromBoard(); - void ExportToGenCAD( wxCommandEvent& event ); + void ExportToGenCAD( wxCommandEvent& event ); /** * Function ExporttoSPECCTRA @@ -422,7 +435,7 @@ public: * See http://www.autotraxeda.com/docs/SPECCTRA/SPECCTRA.pdf for the * specification. */ - void ExportToSpecctra( wxCommandEvent& event ); + void ExportToSpecctra( wxCommandEvent& event ); /** * Function ImportSpecctraSession @@ -431,7 +444,7 @@ public: * See http://www.autotraxeda.com/docs/SPECCTRA/SPECCTRA.pdf for the * specification. */ - void ImportSpecctraSession( wxCommandEvent& event ); + void ImportSpecctraSession( wxCommandEvent& event ); /** * Function ImportSpecctraDesign @@ -440,55 +453,55 @@ public: * See http://www.autotraxeda.com/docs/SPECCTRA/SPECCTRA.pdf for the * specification. */ - void ImportSpecctraDesign( wxCommandEvent& event ); + void ImportSpecctraDesign( wxCommandEvent& event ); /** * Function Access_to_External_Tool * Run an external tool (like freeroute ) - */ - void Access_to_External_Tool( wxCommandEvent& event ); + */ + void Access_to_External_Tool( wxCommandEvent& event ); /* Fonctions specifiques */ - MODULE* ListAndSelectModuleName(); - void Liste_Equipot( wxCommandEvent& event ); - void Swap_Layers( wxCommandEvent& event ); - void Install_Test_DRC_Frame( wxDC* DC ); + MODULE* ListAndSelectModuleName(); + void Liste_Equipot( wxCommandEvent& event ); + void Swap_Layers( wxCommandEvent& event ); + void Install_Test_DRC_Frame( wxDC* DC ); // Handling texts on the board - void Rotate_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC ); - TEXTE_PCB* Create_Texte_Pcb( wxDC* DC ); - void Delete_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC ); - void StartMoveTextePcb( TEXTE_PCB* TextePcb, wxDC* DC ); - void Place_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC ); - void InstallTextPCBOptionsFrame( TEXTE_PCB* TextPCB, wxDC* DC ); + void Rotate_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC ); + TEXTE_PCB* Create_Texte_Pcb( wxDC* DC ); + void Delete_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC ); + void StartMoveTextePcb( TEXTE_PCB* TextePcb, wxDC* DC ); + void Place_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC ); + void InstallTextPCBOptionsFrame( TEXTE_PCB* TextPCB, wxDC* DC ); // Graphic Segments type DRAWSEGMENT - void Start_Move_DrawItem( DRAWSEGMENT* drawitem, wxDC* DC ); - void Place_DrawItem( DRAWSEGMENT* drawitem, wxDC* DC ); + void Start_Move_DrawItem( DRAWSEGMENT* drawitem, wxDC* DC ); + void Place_DrawItem( DRAWSEGMENT* drawitem, wxDC* DC ); // Footprint edition (see also WinEDA_BasePcbFrame) - void StartMove_Module( MODULE* module, wxDC* DC ); - bool Delete_Module( MODULE* module, wxDC* DC, bool aAskBeforeDeleting ); + void StartMove_Module( MODULE* module, wxDC* DC ); + bool Delete_Module( MODULE* module, wxDC* DC, bool aAskBeforeDeleting ); // loading modules: see WinEDA_BasePcbFrame // Board handling - void Erase_Zones( bool query ); - void Erase_Segments_Pcb( bool is_edges, bool query ); - void Erase_Pistes( wxDC* DC, int masque_type, bool query ); - void Erase_Modules( bool query ); - void Erase_Textes_Pcb( bool query ); - void Erase_Marqueurs(); - void RemoveStruct( BOARD_ITEM* Item, wxDC* DC ); - void Via_Edit_Control( wxDC* DC, int command_type, SEGVIA* via ); + void Erase_Zones( bool query ); + void Erase_Segments_Pcb( bool is_edges, bool query ); + void Erase_Pistes( wxDC* DC, int masque_type, bool query ); + void Erase_Modules( bool query ); + void Erase_Textes_Pcb( bool query ); + void Erase_Marqueurs(); + void RemoveStruct( BOARD_ITEM* Item, wxDC* DC ); + void Via_Edit_Control( wxDC* DC, int command_type, SEGVIA* via ); // Hightlight functions: - int Select_High_Light( wxDC* DC ); - void Hight_Light( wxDC* DC ); - void DrawHightLight( wxDC* DC, int NetCode ); + int Select_High_Light( wxDC* DC ); + void Hight_Light( wxDC* DC ); + void DrawHightLight( wxDC* DC, int NetCode ); // Track and via edition: - void DisplayTrackSettings(); + void DisplayTrackSettings(); /** * Function Other_Layer_Route @@ -502,30 +515,30 @@ public: * @return bool - true if the operation was successful, else false such as * the case where DRC would not allow a via. */ - bool Other_Layer_Route( TRACK* track, wxDC* DC ); - void Affiche_PadsNoConnect( wxDC* DC ); - void Affiche_Status_Net( wxDC* DC ); - TRACK* Delete_Segment( wxDC* DC, TRACK* Track ); - void Delete_Track( wxDC* DC, TRACK* Track ); - void Delete_net( wxDC* DC, TRACK* Track ); - void Remove_One_Track( wxDC* DC, TRACK* pt_segm ); - bool Resize_Pistes_Vias( wxDC* DC, bool Track, bool Via ); - void Edit_Net_Width( wxDC* DC, int Netcode ); - void Edit_Track_Width( wxDC* DC, TRACK* Track ); - int Edit_TrackSegm_Width( wxDC* DC, TRACK* segm ); - TRACK* Begin_Route( TRACK* track, wxDC* DC ); - void End_Route( TRACK* track, wxDC* DC ); - void ExChange_Track_Layer( TRACK* pt_segm, wxDC* DC ); - void Attribut_Segment( TRACK* track, wxDC* DC, bool Flag_On ); - void Attribut_Track( TRACK* track, wxDC* DC, bool Flag_On ); - void Attribut_net( wxDC* DC, int net_code, bool Flag_On ); - void Start_MoveOneNodeOrSegment( TRACK* track, wxDC* DC, int command ); - bool PlaceDraggedTrackSegment( TRACK* Track, wxDC* DC ); - bool MergeCollinearTracks( TRACK* track, wxDC* DC, int end ); - void Start_DragTrackSegmentAndKeepSlope( TRACK* track, wxDC* DC ); - void SwitchLayer( wxDC* DC, int layer ); - bool Add_45_degrees_Segment( wxDC* DC ); - bool Genere_Pad_Connexion( wxDC* DC, int layer ); + bool Other_Layer_Route( TRACK* track, wxDC* DC ); + void Affiche_PadsNoConnect( wxDC* DC ); + void Affiche_Status_Net( wxDC* DC ); + TRACK* Delete_Segment( wxDC* DC, TRACK* Track ); + void Delete_Track( wxDC* DC, TRACK* Track ); + void Delete_net( wxDC* DC, TRACK* Track ); + void Remove_One_Track( wxDC* DC, TRACK* pt_segm ); + bool Resize_Pistes_Vias( wxDC* DC, bool Track, bool Via ); + void Edit_Net_Width( wxDC* DC, int Netcode ); + void Edit_Track_Width( wxDC* DC, TRACK* Track ); + int Edit_TrackSegm_Width( wxDC* DC, TRACK* segm ); + TRACK* Begin_Route( TRACK* track, wxDC* DC ); + void End_Route( TRACK* track, wxDC* DC ); + void ExChange_Track_Layer( TRACK* pt_segm, wxDC* DC ); + void Attribut_Segment( TRACK* track, wxDC* DC, bool Flag_On ); + void Attribut_Track( TRACK* track, wxDC* DC, bool Flag_On ); + void Attribut_net( wxDC* DC, int net_code, bool Flag_On ); + void Start_MoveOneNodeOrSegment( TRACK* track, wxDC* DC, int command ); + bool PlaceDraggedTrackSegment( TRACK* Track, wxDC* DC ); + bool MergeCollinearTracks( TRACK* track, wxDC* DC, int end ); + void Start_DragTrackSegmentAndKeepSlope( TRACK* track, wxDC* DC ); + void SwitchLayer( wxDC* DC, int layer ); + bool Add_45_degrees_Segment( wxDC* DC ); + bool Genere_Pad_Connexion( wxDC* DC, int layer ); // zone handling @@ -536,8 +549,7 @@ public: * @param aZone = zone segment within the zone to delete. Can be NULL * @param aTimestamp = Timestamp for the zone to delete, used if aZone == NULL */ - void Delete_Zone_Fill( wxDC* DC, SEGZONE* Track, long aTimestamp = 0 ); - + void Delete_Zone_Fill( wxDC* DC, SEGZONE* Track, long aTimestamp = 0 ); /** Function Delete_LastCreatedCorner @@ -545,14 +557,14 @@ public: * Remove and delete the current outline segment in progress * @return 0 if no corner in list, or corner number */ - int Delete_LastCreatedCorner( wxDC* DC); + int Delete_LastCreatedCorner( wxDC* DC ); /** * Function Begin_Zone * initiates a zone edge creation process, * or terminates the current zone edge and creates a new zone edge stub */ - int Begin_Zone( wxDC* DC ); + int Begin_Zone( wxDC* DC ); /** * Function End_Zone @@ -560,7 +572,7 @@ public: * @param DC = current Device Context * @return true if Ok, false if DRC error */ - bool End_Zone( wxDC* DC ); + bool End_Zone( wxDC* DC ); /** Function Fill_Zone() * Calculate the zone filling for the outline zone_container @@ -572,7 +584,7 @@ public: * @param verbose = true to show error messages * @return error level (0 = no error) */ - int Fill_Zone( wxDC* DC, ZONE_CONTAINER* zone_container, bool verbose = TRUE ); + int Fill_Zone( wxDC* DC, ZONE_CONTAINER* zone_container, bool verbose = TRUE ); /** Function Fill_All_Zones() * Fill all zones on the board @@ -580,7 +592,7 @@ public: * @param verbose = true to show error messages * @return error level (0 = no error) */ - int Fill_All_Zones( bool verbose = TRUE ); + int Fill_All_Zones( bool verbose = TRUE ); /** @@ -589,7 +601,7 @@ public: * @param DC = current Device Context * @param zone_container = parent zone outline */ - void Add_Zone_Cutout( wxDC* DC, ZONE_CONTAINER* zone_container ); + void Add_Zone_Cutout( wxDC* DC, ZONE_CONTAINER* zone_container ); /** * Function Add_Similar_Zone @@ -598,13 +610,13 @@ public: * @param DC = current Device Context * @param zone_container = parent zone outline */ - void Add_Similar_Zone( wxDC* DC, ZONE_CONTAINER* zone_container ); + void Add_Similar_Zone( wxDC* DC, ZONE_CONTAINER* zone_container ); /** * Function Edit_Zone_Params * Edit params (layer, clearance, ...) for a zone outline */ - void Edit_Zone_Params( wxDC* DC, ZONE_CONTAINER* zone_container ); + void Edit_Zone_Params( wxDC* DC, ZONE_CONTAINER* zone_container ); /** * Function Start_Move_Zone_Corner @@ -612,18 +624,18 @@ public: * called from a move corner command (IsNewCorner = false), * or a create new cornet command (IsNewCorner = true ) */ - void Start_Move_Zone_Corner( wxDC* DC, - ZONE_CONTAINER* zone_container, - int corner_id, - bool IsNewCorner ); + void Start_Move_Zone_Corner( wxDC* DC, + ZONE_CONTAINER* zone_container, + int corner_id, + bool IsNewCorner ); /** * Function Start_Move_Zone_Corner * Prepares a drag edge in an existing zone outline, */ - void Start_Move_Zone_Drag_Outline_Edge( wxDC* DC, - ZONE_CONTAINER* zone_container, - int corner_id ); + void Start_Move_Zone_Drag_Outline_Edge( wxDC* DC, + ZONE_CONTAINER* zone_container, + int corner_id ); /** * Function End_Move_Zone_Corner_Or_Outlines @@ -631,14 +643,14 @@ public: * @param DC = current Device Context (can be NULL) * @param zone_container: the given zone */ - void End_Move_Zone_Corner_Or_Outlines( wxDC* DC, ZONE_CONTAINER* zone_container ); + void End_Move_Zone_Corner_Or_Outlines( wxDC* DC, ZONE_CONTAINER* zone_container ); /** * Function End_Move_Zone_Corner_Or_Outlines * Remove the currently selected corner in a zone outline * the .m_CornerSelection is used as corner selection */ - void Remove_Zone_Corner( wxDC* DC, ZONE_CONTAINER* zone_container ); + void Remove_Zone_Corner( wxDC* DC, ZONE_CONTAINER* zone_container ); /** Function Delete_Zone * Remove the zone which include the segment aZone, or the zone which have the given time stamp. @@ -649,7 +661,7 @@ public: * if the outline is the main outline, all the zone is removed * otherwise, the hole is deleted */ - void Delete_Zone_Contour( wxDC* DC, ZONE_CONTAINER* zone_container ); + void Delete_Zone_Contour( wxDC* DC, ZONE_CONTAINER* zone_container ); /** * Function Start_Move_Zone_Outlines @@ -657,67 +669,69 @@ public: * @param DC = current Device Context (can be NULL) * @param zone_container: the given zone to move */ - void Start_Move_Zone_Outlines( wxDC* DC, ZONE_CONTAINER* zone_container ); + void Start_Move_Zone_Outlines( wxDC* DC, ZONE_CONTAINER* zone_container ); - // Target handling - MIREPCB* Create_Mire( wxDC* DC ); - void Delete_Mire( MIREPCB* MirePcb, wxDC* DC ); - void StartMove_Mire( MIREPCB* MirePcb, wxDC* DC ); - void Place_Mire( MIREPCB* MirePcb, wxDC* DC ); - void InstallMireOptionsFrame( MIREPCB* MirePcb, wxDC* DC, const wxPoint& pos ); + // Target handling + MIREPCB* Create_Mire( wxDC* DC ); + void Delete_Mire( MIREPCB* MirePcb, wxDC* DC ); + void StartMove_Mire( MIREPCB* MirePcb, wxDC* DC ); + void Place_Mire( MIREPCB* MirePcb, wxDC* DC ); + void InstallMireOptionsFrame( MIREPCB* MirePcb, wxDC* DC, const wxPoint& pos ); // Graphic segments type DRAWSEGMENT handling: - DRAWSEGMENT* Begin_DrawSegment( DRAWSEGMENT* Segment, int shape, wxDC* DC ); - void End_Edge( DRAWSEGMENT* Segment, wxDC* DC ); - void Delete_Segment_Edge( DRAWSEGMENT* Segment, wxDC* DC ); - void Delete_Drawings_All_Layer( DRAWSEGMENT* Segment, wxDC* DC ); + DRAWSEGMENT* Begin_DrawSegment( DRAWSEGMENT* Segment, int shape, wxDC* DC ); + void End_Edge( DRAWSEGMENT* Segment, wxDC* DC ); + void Delete_Segment_Edge( DRAWSEGMENT* Segment, wxDC* DC ); + void Delete_Drawings_All_Layer( DRAWSEGMENT* Segment, wxDC* DC ); // Dimension handling: - void Install_Edit_Cotation( COTATION* Cotation, wxDC* DC, const wxPoint& pos ); - COTATION* Begin_Cotation( COTATION* Cotation, wxDC* DC ); - void Delete_Cotation( COTATION* Cotation, wxDC* DC ); + void Install_Edit_Cotation( COTATION* Cotation, wxDC* DC, const wxPoint& pos ); + COTATION* Begin_Cotation( COTATION* Cotation, wxDC* DC ); + void Delete_Cotation( COTATION* Cotation, wxDC* DC ); // netlist handling: - void InstallNetlistFrame( wxDC* DC, const wxPoint& pos ); + void InstallNetlistFrame( wxDC* DC, const wxPoint& pos ); // Autoplacement: - void AutoPlace( wxCommandEvent& event ); + void AutoPlace( wxCommandEvent& event ); + /** function OnOrientFootprints * install the dialog box for the comman Orient Footprints */ - void OnOrientFootprints( void ); + void OnOrientFootprints( void ); + /** function ReOrientModules * Set the orientation of footprints * @param ModuleMask = mask (wildcard allowed) selection * @param Orient = new orientation * @param include_fixe = true to orient locked footprints */ - void ReOrientModules( const wxString& ModuleMask, int Orient, - bool include_fixe ); - void FixeModule( MODULE* Module, bool Fixe ); - void AutoMoveModulesOnPcb( wxDC* DC, bool PlaceModulesHorsPcb ); - bool SetBoardBoundaryBoxFromEdgesOnly(); - void AutoPlaceModule( MODULE* Module, int place_mode, wxDC* DC ); - int RecherchePlacementModule( MODULE* Module, wxDC* DC ); - void GenModuleOnBoard( MODULE* Module ); - float Compute_Ratsnest_PlaceModule( wxDC* DC ); - int GenPlaceBoard(); - void DrawInfoPlace( wxDC* DC ); + void ReOrientModules( const wxString& ModuleMask, int Orient, + bool include_fixe ); + void FixeModule( MODULE* Module, bool Fixe ); + void AutoMoveModulesOnPcb( wxDC* DC, bool PlaceModulesHorsPcb ); + bool SetBoardBoundaryBoxFromEdgesOnly(); + void AutoPlaceModule( MODULE* Module, int place_mode, wxDC* DC ); + int RecherchePlacementModule( MODULE* Module, wxDC* DC ); + void GenModuleOnBoard( MODULE* Module ); + float Compute_Ratsnest_PlaceModule( wxDC* DC ); + int GenPlaceBoard(); + void DrawInfoPlace( wxDC* DC ); // Autorouting: - int Solve( wxDC* DC, int two_sides ); - void Reset_Noroutable( wxDC* DC ); - void Autoroute( wxDC* DC, int mode ); - void ReadAutoroutedTracks( wxDC* DC ); - void GlobalRoute( wxDC* DC ); + int Solve( wxDC* DC, int two_sides ); + void Reset_Noroutable( wxDC* DC ); + void Autoroute( wxDC* DC, int mode ); + void ReadAutoroutedTracks( wxDC* DC ); + void GlobalRoute( wxDC* DC ); // divers - void Show_1_Ratsnest( EDA_BaseStruct* item, wxDC* DC ); - void Ratsnest_On_Off( wxDC* DC ); - void Clean_Pcb( wxDC* DC ); + void Show_1_Ratsnest( EDA_BaseStruct* item, wxDC* DC ); + void Ratsnest_On_Off( wxDC* DC ); + void Clean_Pcb( wxDC* DC ); - void InstallFindFrame( const wxPoint& pos, wxDC* DC ); + void InstallFindFrame( const wxPoint& pos, wxDC* DC ); /** * Function SendMessageToEESCHEMA @@ -725,15 +739,15 @@ public: * to a part with the same reference as the objectToSync * @param objectToSync The object whose reference is used to syncronize eeschema. */ - void SendMessageToEESCHEMA( BOARD_ITEM* objectToSync ); + void SendMessageToEESCHEMA( BOARD_ITEM* objectToSync ); /* Micro waves functions */ - void Edit_Gap( wxDC* DC, MODULE* Module ); - MODULE* Create_MuWaveBasicShape( const wxString& name, int pad_count ); - MODULE* Create_MuWaveComponent( int shape_type ); - MODULE* Create_MuWavePolygonShape( ); - void Begin_Self( wxDC* DC ); - MODULE* Genere_Self( wxDC* DC ); + void Edit_Gap( wxDC* DC, MODULE* Module ); + MODULE* Create_MuWaveBasicShape( const wxString& name, int pad_count ); + MODULE* Create_MuWaveComponent( int shape_type ); + MODULE* Create_MuWavePolygonShape(); + void Begin_Self( wxDC* DC ); + MODULE* Genere_Self( wxDC* DC ); DECLARE_EVENT_TABLE() }; @@ -758,57 +772,57 @@ public: ~WinEDA_GerberFrame(); - void Update_config(); - void OnCloseWindow( wxCloseEvent& Event ); - void Process_Special_Functions( wxCommandEvent& event ); - void RedrawActiveWindow( wxDC* DC, bool EraseBg ); - void ReCreateHToolbar(); - void ReCreateVToolbar(); - void ReCreateOptToolbar(); - void ReCreateMenuBar(); - void OnLeftClick( wxDC* DC, const wxPoint& MousePos ); - void OnLeftDClick( wxDC* DC, const wxPoint& MousePos ); - bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ); - int BestZoom(); // Retourne le meilleur zoom - void OnSelectOptionToolbar( wxCommandEvent& event ); - void OnHotKey( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct ); + void Update_config(); + void OnCloseWindow( wxCloseEvent& Event ); + void Process_Special_Functions( wxCommandEvent& event ); + void RedrawActiveWindow( wxDC* DC, bool EraseBg ); + void ReCreateHToolbar(); + void ReCreateVToolbar(); + void ReCreateOptToolbar(); + void ReCreateMenuBar(); + void OnLeftClick( wxDC* DC, const wxPoint& MousePos ); + void OnLeftDClick( wxDC* DC, const wxPoint& MousePos ); + bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ); + int BestZoom(); // Retourne le meilleur zoom + void OnSelectOptionToolbar( wxCommandEvent& event ); + void OnHotKey( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct ); - BOARD_ITEM* GerberGeneralLocateAndDisplay(); - BOARD_ITEM* Locate( int typeloc ); + BOARD_ITEM* GerberGeneralLocateAndDisplay(); + BOARD_ITEM* Locate( int typeloc ); - void SetToolbars(); - void Process_Settings( wxCommandEvent& event ); - void Process_Config( wxCommandEvent& event ); - void InstallConfigFrame( const wxPoint& pos ); - void InstallPcbOptionsFrame( const wxPoint& pos, int id ); - void InstallPcbGlobalDeleteFrame( const wxPoint& pos ); + void SetToolbars(); + void Process_Settings( wxCommandEvent& event ); + void Process_Config( wxCommandEvent& event ); + void InstallConfigFrame( const wxPoint& pos ); + void InstallPcbOptionsFrame( const wxPoint& pos, int id ); + void InstallPcbGlobalDeleteFrame( const wxPoint& pos ); /* handlers for block commands */ - int ReturnBlockCommand( int key ); - virtual void HandleBlockPlace( wxDC* DC ); - virtual int HandleBlockEnd( wxDC* DC ); + int ReturnBlockCommand( int key ); + virtual void HandleBlockPlace( wxDC* DC ); + virtual int HandleBlockEnd( wxDC* DC ); - void InstallDrillFrame( wxCommandEvent& event ); - void ToPostProcess( wxCommandEvent& event ); - void Genere_HPGL( const wxString& FullFileName, int Layers ); - void Genere_GERBER( const wxString& FullFileName, int Layers ); - void Genere_PS( const wxString& FullFileName, int Layers ); - void Plot_Layer_HPGL( FILE* File, int masque_layer, - int garde, int tracevia, int modetrace ); - void Plot_Layer_GERBER( FILE* File, int masque_layer, - int garde, int tracevia ); - int Gen_D_CODE_File( const wxString& Name_File ); - void Plot_Layer_PS( FILE* File, int masque_layer, - int garde, int tracevia, int modetrace ); + void InstallDrillFrame( wxCommandEvent& event ); + void ToPostProcess( wxCommandEvent& event ); + void Genere_HPGL( const wxString& FullFileName, int Layers ); + void Genere_GERBER( const wxString& FullFileName, int Layers ); + void Genere_PS( const wxString& FullFileName, int Layers ); + void Plot_Layer_HPGL( FILE* File, int masque_layer, + int garde, int tracevia, int modetrace ); + void Plot_Layer_GERBER( FILE* File, int masque_layer, + int garde, int tracevia ); + int Gen_D_CODE_File( const wxString& Name_File ); + void Plot_Layer_PS( FILE* File, int masque_layer, + int garde, int tracevia, int modetrace ); - void Files_io( wxCommandEvent& event ); - int LoadOneGerberFile( const wxString& FileName, wxDC* DC, int mode ); - int ReadGerberFile( wxDC* DC, FILE* File, bool Append ); - bool Read_GERBER_File( wxDC* DC, - const wxString& GERBER_FullFileName, - const wxString& D_Code_FullFileName ); - bool SaveGerberFile( const wxString& FileName, wxDC* DC ); + void Files_io( wxCommandEvent& event ); + int LoadOneGerberFile( const wxString& FileName, wxDC* DC, int mode ); + int ReadGerberFile( wxDC* DC, FILE* File, bool Append ); + bool Read_GERBER_File( wxDC* DC, + const wxString& GERBER_FullFileName, + const wxString& D_Code_FullFileName ); + bool SaveGerberFile( const wxString& FileName, wxDC* DC ); /** @@ -831,36 +845,36 @@ public: * 0 = the \a D_Code_FullFileName is empty, no reading is done but an empty GERBER is put into g_GERBER_List[]
* 1 = read OK
*/ - int Read_D_Code_File( const wxString& D_Code_FullFileName ); - void CopyDCodesSizeToItems(); - void Liste_D_Codes( wxDC* DC ); + int Read_D_Code_File( const wxString& D_Code_FullFileName ); + void CopyDCodesSizeToItems(); + void Liste_D_Codes( wxDC* DC ); /* Fonctions specifiques */ - void Trace_Gerber( wxDC* DC, int draw_mode, int printmasklayer ); + void Trace_Gerber( wxDC* DC, int draw_mode, int printmasklayer ); // Copper texts - void Rotate_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC ); - TEXTE_PCB* Create_Texte_Pcb( wxDC* DC ); - void Delete_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC ); - void StartMoveTextePcb( TEXTE_PCB* TextePcb, wxDC* DC ); - void Place_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC ); + void Rotate_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC ); + TEXTE_PCB* Create_Texte_Pcb( wxDC* DC ); + void Delete_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC ); + void StartMoveTextePcb( TEXTE_PCB* TextePcb, wxDC* DC ); + void Place_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC ); // PCB handling - bool Clear_Pcb( bool query ); - void Erase_Current_Layer( bool query ); - void Erase_Zones( bool query ); - void Erase_Segments_Pcb( bool is_edges, bool query ); - void Erase_Pistes( int masque_type, bool query ); - void Erase_Textes_Pcb( bool query ); - void Delete_DCode_Items( wxDC* DC, int dcode_value, int layer_number ); + bool Clear_Pcb( bool query ); + void Erase_Current_Layer( bool query ); + void Erase_Zones( bool query ); + void Erase_Segments_Pcb( bool is_edges, bool query ); + void Erase_Pistes( int masque_type, bool query ); + void Erase_Textes_Pcb( bool query ); + void Delete_DCode_Items( wxDC* DC, int dcode_value, int layer_number ); - TRACK* Begin_Route( TRACK* track, wxDC* DC ); - void End_Route( TRACK* track, wxDC* DC ); - TRACK* Delete_Segment( wxDC* DC, TRACK* Track ); - int Edit_TrackSegm_Width( wxDC* DC, TRACK* segm ); + TRACK* Begin_Route( TRACK* track, wxDC* DC ); + void End_Route( TRACK* track, wxDC* DC ); + TRACK* Delete_Segment( wxDC* DC, TRACK* Track ); + int Edit_TrackSegm_Width( wxDC* DC, TRACK* segm ); // Conversion function - void ExportDataInPcbnewFormat( wxCommandEvent& event ); + void ExportDataInPcbnewFormat( wxCommandEvent& event ); DECLARE_EVENT_TABLE() }; @@ -885,65 +899,65 @@ public: ~WinEDA_ModuleEditFrame(); - void InstallOptionsFrame( const wxPoint& pos ); + void InstallOptionsFrame( const wxPoint& pos ); - void OnCloseWindow( wxCloseEvent& Event ); - void Process_Special_Functions( wxCommandEvent& event ); - void RedrawActiveWindow( wxDC* DC, bool EraseBg ); - void ReCreateHToolbar(); - void ReCreateVToolbar(); - void ReCreateOptToolbar(); - void ReCreateAuxiliaryToolbar(); - void OnLeftClick( wxDC* DC, const wxPoint& MousePos ); - void OnLeftDClick( wxDC* DC, const wxPoint& MousePos ); - bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ); - void SetToolbars(); - void ReCreateMenuBar(); - void ToolOnRightClick( wxCommandEvent& event ); - void OnSelectOptionToolbar( wxCommandEvent& event ); - void OnHotKey( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct ); + void OnCloseWindow( wxCloseEvent& Event ); + void Process_Special_Functions( wxCommandEvent& event ); + void RedrawActiveWindow( wxDC* DC, bool EraseBg ); + void ReCreateHToolbar(); + void ReCreateVToolbar(); + void ReCreateOptToolbar(); + void ReCreateAuxiliaryToolbar(); + void OnLeftClick( wxDC* DC, const wxPoint& MousePos ); + void OnLeftDClick( wxDC* DC, const wxPoint& MousePos ); + bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ); + void SetToolbars(); + void ReCreateMenuBar(); + void ToolOnRightClick( wxCommandEvent& event ); + void OnSelectOptionToolbar( wxCommandEvent& event ); + void OnHotKey( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct ); /* handlers for block commands */ - int ReturnBlockCommand( int key ); - virtual void HandleBlockPlace( wxDC* DC ); - virtual int HandleBlockEnd( wxDC* DC ); + int ReturnBlockCommand( int key ); + virtual void HandleBlockPlace( wxDC* DC ); + virtual int HandleBlockEnd( wxDC* DC ); - BOARD_ITEM* ModeditLocateAndDisplay( int aHotKeyCode = 0 ); + BOARD_ITEM* ModeditLocateAndDisplay( int aHotKeyCode = 0 ); /* Undo and redo functions */ public: - void SaveCopyInUndoList( EDA_BaseStruct* ItemToCopy, int flag_type_command = 0 ); + void SaveCopyInUndoList( EDA_BaseStruct* ItemToCopy, int flag_type_command = 0 ); private: - void GetComponentFromUndoList(); - void GetComponentFromRedoList(); + void GetComponentFromUndoList(); + void GetComponentFromRedoList(); public: // Footprint edition - void Place_Ancre( MODULE* module, wxDC* DC ); - void RemoveStruct( EDA_BaseStruct* Item, wxDC* DC ); - void Transform( MODULE* module, wxDC* DC, int transform ); + void Place_Ancre( MODULE* module, wxDC* DC ); + void RemoveStruct( EDA_BaseStruct* Item, wxDC* DC ); + void Transform( MODULE* module, wxDC* DC, int transform ); // loading Footprint - MODULE* Import_Module( wxDC* DC ); - void Export_Module( MODULE* ptmod, bool createlib ); - void Load_Module_Module_From_BOARD( MODULE* Module ); + MODULE* Import_Module( wxDC* DC ); + void Export_Module( MODULE* ptmod, bool createlib ); + void Load_Module_Module_From_BOARD( MODULE* Module ); // functions to edit footprint edges - void Edit_Edge_Width( EDGE_MODULE* Edge, wxDC* DC ); - void Edit_Edge_Layer( EDGE_MODULE* Edge, wxDC* DC ); - void Delete_Edge_Module( EDGE_MODULE* Edge, wxDC* DC ); - EDGE_MODULE* Begin_Edge_Module( EDGE_MODULE* Edge, wxDC* DC, int type_edge ); - void End_Edge_Module( EDGE_MODULE* Edge, wxDC* DC ); - void Enter_Edge_Width( EDGE_MODULE* Edge, wxDC* DC ); - void Start_Move_EdgeMod( EDGE_MODULE* drawitem, wxDC* DC ); - void Place_EdgeMod( EDGE_MODULE* drawitem, wxDC* DC ); + void Edit_Edge_Width( EDGE_MODULE* Edge, wxDC* DC ); + void Edit_Edge_Layer( EDGE_MODULE* Edge, wxDC* DC ); + void Delete_Edge_Module( EDGE_MODULE* Edge, wxDC* DC ); + EDGE_MODULE* Begin_Edge_Module( EDGE_MODULE* Edge, wxDC* DC, int type_edge ); + void End_Edge_Module( EDGE_MODULE* Edge, wxDC* DC ); + void Enter_Edge_Width( EDGE_MODULE* Edge, wxDC* DC ); + void Start_Move_EdgeMod( EDGE_MODULE* drawitem, wxDC* DC ); + void Place_EdgeMod( EDGE_MODULE* drawitem, wxDC* DC ); // handlers for libraries: - void Delete_Module_In_Library( const wxString& libname ); - int Create_Librairie( const wxString& LibName ); - void Select_Active_Library(); + void Delete_Module_In_Library( const wxString& libname ); + int Create_Librairie( const wxString& LibName ); + void Select_Active_Library(); DECLARE_EVENT_TABLE() }; diff --git a/pcbnew/librairi.cpp b/pcbnew/librairi.cpp index 854bd626a8..082e046f5d 100644 --- a/pcbnew/librairi.cpp +++ b/pcbnew/librairi.cpp @@ -21,9 +21,9 @@ * $EndLIBRARY */ -#define OLD_EXT wxT( ".bak" ) -#define FILETMP_EXT wxT( ".$$$" ) -#define EXPORT_IMPORT_LASTPATH_KEY wxT("import_last_path") +#define OLD_EXT wxT( ".bak" ) +#define FILETMP_EXT wxT( ".$$$" ) +#define EXPORT_IMPORT_LASTPATH_KEY wxT( "import_last_path" ) /* Fonctions locales */ static bool CreateDocLibrary( const wxString& LibName ); @@ -43,28 +43,29 @@ MODULE* WinEDA_ModuleEditFrame::Import_Module( wxDC* DC ) * @param DC = Current Device Context (can be NULL) */ { - int NbLine = 0; - char Line[1024]; - wxString CmpFullFileName; - FILE* dest; - MODULE* module = NULL; - bool Footprint_Is_GPCB_Format = false; - wxString mask = wxT("*.*;"); mask += EXT_CMP_MASK; - wxString LastOpenedPathForLoading; - wxConfig* Config = wxGetApp().m_EDA_Config; + int NbLine = 0; + char Line[1024]; + wxString CmpFullFileName; + FILE* dest; + MODULE* module = NULL; + bool Footprint_Is_GPCB_Format = false; + wxString mask = wxT( "*.*;" ); mask += EXT_CMP_MASK; + + wxString LastOpenedPathForLoading; + wxConfig* Config = wxGetApp().m_EDA_Config; if( Config ) Config->Read( EXPORT_IMPORT_LASTPATH_KEY, &LastOpenedPathForLoading ); /* Lecture Fichier module */ CmpFullFileName = EDA_FileSelector( _( "Import Module:" ), - LastOpenedPathForLoading, /* Chemin par defaut */ - wxEmptyString, /* nom fichier par defaut */ - wxEmptyString, /* extension par defaut */ - mask, /* Masque d'affichage */ + LastOpenedPathForLoading, /* Chemin par defaut */ + wxEmptyString, /* nom fichier par defaut */ + wxEmptyString, /* extension par defaut */ + mask, /* Masque d'affichage */ this, wxFD_OPEN, - TRUE + true ); if( CmpFullFileName == wxEmptyString ) @@ -78,7 +79,7 @@ MODULE* WinEDA_ModuleEditFrame::Import_Module( wxDC* DC ) return NULL; } - if( Config ) // Save file path + if( Config ) // Save file path { LastOpenedPathForLoading = wxPathOnly( CmpFullFileName ); Config->Write( EXPORT_IMPORT_LASTPATH_KEY, LastOpenedPathForLoading ); @@ -99,7 +100,7 @@ MODULE* WinEDA_ModuleEditFrame::Import_Module( wxDC* DC ) } /* Read file: Search the description starting line (skip lib header)*/ - if ( ! Footprint_Is_GPCB_Format ) + if( !Footprint_Is_GPCB_Format ) { while( GetLine( dest, Line, &NbLine ) != NULL ) { @@ -110,10 +111,10 @@ MODULE* WinEDA_ModuleEditFrame::Import_Module( wxDC* DC ) module = new MODULE( GetBoard() ); - if ( Footprint_Is_GPCB_Format ) + if( Footprint_Is_GPCB_Format ) { fclose( dest ); - module->Read_GPCB_Descr(CmpFullFileName); + module->Read_GPCB_Descr( CmpFullFileName ); } else { @@ -137,6 +138,7 @@ MODULE* WinEDA_ModuleEditFrame::Import_Module( wxDC* DC ) /************************************************************************/ void WinEDA_ModuleEditFrame::Export_Module( MODULE* ptmod, bool createlib ) /************************************************************************/ + /** * Function Export_Module * Create a file containing only one footprint. @@ -149,11 +151,11 @@ void WinEDA_ModuleEditFrame::Export_Module( MODULE* ptmod, bool createlib ) * false = use current path or last used path to export footprint */ { - wxString FullFileName, Mask( wxT( "*" ) ); - char Line[1025]; - FILE* dest; - wxString msg, path; - wxConfig* Config = wxGetApp().m_EDA_Config; + wxString FullFileName, Mask( wxT( "*" ) ); + char Line[1025]; + FILE* dest; + wxString msg, path; + wxConfig* Config = wxGetApp().m_EDA_Config; if( ptmod == NULL ) return; @@ -176,7 +178,7 @@ void WinEDA_ModuleEditFrame::Export_Module( MODULE* ptmod, bool createlib ) Mask, /* Masque d'affichage */ this, wxFD_SAVE, - TRUE + true ); if( FullFileName.IsEmpty() ) @@ -198,7 +200,7 @@ void WinEDA_ModuleEditFrame::Export_Module( MODULE* ptmod, bool createlib ) return; } - if( ! createlib && Config ) // Save file path + if( !createlib && Config ) // Save file path { path = wxPathOnly( FullFileName ); Config->Write( EXPORT_IMPORT_LASTPATH_KEY, path ); @@ -395,7 +397,7 @@ void WinEDA_BasePcbFrame::Archive_Modules( const wxString& LibName, /* * Sauve en Librairie: * tous les nouveaux modules ( c.a.d. les modules - * n'existant pas deja (si NewModulesOnly == TRUE) + * n'existant pas deja (si NewModulesOnly == true) * tous les modules (si NewModulesOnly == FALSE) */ { @@ -420,7 +422,7 @@ void WinEDA_BasePcbFrame::Archive_Modules( const wxString& LibName, Mask, /* Masque d'affichage */ this, wxFD_SAVE, - TRUE + true ); if( FullFileName.IsEmpty() ) @@ -448,7 +450,7 @@ void WinEDA_BasePcbFrame::Archive_Modules( const wxString& LibName, DisplayError( this, msg ); return; } - char Line[256]; + char Line[256]; fprintf( lib_module, "%s %s\n", ENTETE_LIBRAIRIE, DateAndTime( Line ) ); fputs( "$INDEX\n", lib_module ); fputs( "$EndINDEX\n", lib_module ); @@ -467,31 +469,33 @@ void WinEDA_BasePcbFrame::Archive_Modules( const wxString& LibName, Module = (MODULE*) GetBoard()->m_Modules; for( ii = 1; Module != NULL; ii++, Module = (MODULE*) Module->Next() ) { - if( Save_1_Module( FullFileName, Module, - NewModulesOnly ? FALSE : TRUE, FALSE ) == 0 ) + if( Save_Module_In_Library( FullFileName, Module, + NewModulesOnly ? FALSE : true, FALSE, false ) == 0 ) break; - DisplayActivity( (int) ( ii * Pas), wxEmptyString ); + DisplayActivity( (int) ( ii * Pas ), wxEmptyString ); /* Tst demande d'arret de sauvegarde ( key ESCAPE actionnee ) */ if( DrawPanel->m_AbortRequest ) break; } - CreateDocLibrary( LibName ); + CreateDocLibrary( FullFileName ); } /*****************************************************************/ -int WinEDA_BasePcbFrame::Save_1_Module( const wxString& LibName, - MODULE* Module, bool Overwrite, bool DisplayDialog ) +int WinEDA_BasePcbFrame::Save_Module_In_Library( const wxString& aLibName, + MODULE* aModule, bool aOverwrite, + bool aDisplayDialog, bool aCreateDocFile ) /*****************************************************************/ -/* - * sauve en Librairie le module Module: - * si no_replace == TRUE, s'il est nouveau. - * - * retourne - * 1 si OK - * 0 si abort ou probleme +/** Function Save_Module_In_Library + * Save in an existing library a given footprint + * @param aLibName = name of the library to use + * @param aModule = the given footprint + * @param aOverwrite = true to overwrite an existing footprint, false to abort an existing footprint is found + * @param aDisplayDialog = true to display a dialog to enter or confirm the footprint name + * @param aCreateDocFile = true to creates the associated doc file + * @return : 1 if OK, 0 if abort */ { int newmodule, end; @@ -500,49 +504,49 @@ int WinEDA_BasePcbFrame::Save_1_Module( const wxString& LibName, wxString Name_Cmp; wxString NewLib, OldLib, msg; FILE* lib_module, * dest; - bool added = TRUE; + bool added = true; - Module->Display_Infos( this ); + aModule->Display_Infos( this ); - if( !wxFileExists( LibName ) ) + if( !wxFileExists( aLibName ) ) { - msg.Printf( _( "Library %s not found" ), LibName.GetData() ); + msg.Printf( _( "Library %s not found" ), aLibName.GetData() ); DisplayError( this, msg ); return 0; } - /* Demande du nom du composant en librairie */ - Name_Cmp = Module->m_LibRef; + /* Ask for the footprint name in lib */ + Name_Cmp = aModule->m_LibRef; - if( DisplayDialog ) + if( aDisplayDialog ) { - Get_Message( _( "Name:" ), _("Save module"), Name_Cmp, this ); + Get_Message( _( "Name:" ), _( "Save module" ), Name_Cmp, this ); if( Name_Cmp.IsEmpty() ) return 0; - Name_Cmp.Trim( TRUE ); + Name_Cmp.Trim( true ); Name_Cmp.Trim( FALSE ); - Module->m_LibRef = Name_Cmp; + aModule->m_LibRef = Name_Cmp; } - if( ( lib_module = wxFopen( LibName, wxT( "rt" ) ) ) == NULL ) + if( ( lib_module = wxFopen( aLibName, wxT( "rt" ) ) ) == NULL ) { - msg.Printf( _( "Unable to open %s" ), LibName.GetData() ); + msg.Printf( _( "Unable to open %s" ), aLibName.GetData() ); DisplayError( this, msg ); return 0; } - /* lecture entete : ENTETE_LIBRAIRIE */ + /* lRead library file : library header */ GetLine( lib_module, Line, &LineNum ); if( strnicmp( Line, ENTETE_LIBRAIRIE, L_ENTETE_LIB ) != 0 ) { fclose( lib_module ); - msg.Printf( _( "File %s is not a eeschema library" ), LibName.GetData() ); + msg.Printf( _( "File %s is not a eeschema library" ), aLibName.GetData() ); DisplayError( this, msg ); return 0; } - /* lecture des noms des composants - verif si le module est deja existant */ + /* Reaf footprints in lib: - search for an existing footprint */ newmodule = 1; end = 0; while( !end && GetLine( lib_module, Line, &LineNum ) ) { @@ -560,17 +564,17 @@ int WinEDA_BasePcbFrame::Save_1_Module( const wxString& LibName, StrPurge( Line ); msg = CONV_FROM_UTF8( Line ); - if( Name_Cmp.CmpNoCase( msg ) == 0 ) /* composant trouve */ + if( Name_Cmp.CmpNoCase( msg ) == 0 ) /* an existing footprint is found */ { added = FALSE; newmodule = 0; - if( DisplayDialog ) + if( aDisplayDialog ) { msg = _( "Module exists\n Line: " ); msg << LineNum; Affiche_Message( msg ); } - if( !Overwrite ) /* le module n'est pas a sauver car deja existant */ + if( !aOverwrite ) /* lDo not save the given footprint: an old one exists */ { fclose( lib_module ); return 1; } @@ -581,15 +585,15 @@ int WinEDA_BasePcbFrame::Save_1_Module( const wxString& LibName, fclose( lib_module ); - /* Creation de la nouvelle librairie */ + /* Creates the new library */ - if( ( lib_module = wxFopen( LibName, wxT( "rt" ) ) ) == NULL ) + if( ( lib_module = wxFopen( aLibName, wxT( "rt" ) ) ) == NULL ) { DisplayError( this, wxT( "Librairi.cpp: Error oldlib not found" ) ); return 0; } - NewLib = LibName; + NewLib = aLibName; ChangeFileNameExt( NewLib, FILETMP_EXT ); if( ( dest = wxFopen( NewLib, wxT( "w+t" ) ) ) == NULL ) { @@ -601,7 +605,7 @@ int WinEDA_BasePcbFrame::Save_1_Module( const wxString& LibName, wxBeginBusyCursor(); - /* Creation de l'entete avec nouvelle date */ + /* Create the library header with a new date */ fprintf( dest, ENTETE_LIBRAIRIE ); fprintf( dest, " %s\n$INDEX\n", DateAndTime( Line ) ); @@ -629,7 +633,7 @@ int WinEDA_BasePcbFrame::Save_1_Module( const wxString& LibName, fprintf( dest, "$EndINDEX\n" ); - /* Copie des modules, jusqu'au module a supprimer */ + /* Copy footprints, until the old footprint to delete */ while( GetLine( lib_module, Line, &LineNum ) ) { StrPurge( Line ); @@ -641,7 +645,7 @@ int WinEDA_BasePcbFrame::Save_1_Module( const wxString& LibName, msg = CONV_FROM_UTF8( Name ); if( msg.CmpNoCase( Name_Cmp ) == 0 ) { - /* suppression ancien module */ + /* skip old footprint descr (delete from the lib)*/ while( GetLine( lib_module, Line, &LineNum ) ) { if( strnicmp( Line, "$EndMODULE", 9 ) == 0 ) @@ -654,40 +658,42 @@ int WinEDA_BasePcbFrame::Save_1_Module( const wxString& LibName, fprintf( dest, "%s\n", Line ); } - /* Ecriture du module ( en fin de librairie ) */ - tmp = Module->m_TimeStamp; Module->m_TimeStamp = 0; - Module->Save( dest ); + /* Write the new footprint ( append it to the list of footprint ) */ + tmp = aModule->m_TimeStamp; aModule->m_TimeStamp = 0; + aModule->Save( dest ); fprintf( dest, "$EndLIBRARY\n" ); - Module->m_TimeStamp = tmp; + aModule->m_TimeStamp = tmp; fclose( dest ); fclose( lib_module ); wxEndBusyCursor(); - /* L'ancien fichier librairie est renomme en .bak */ - OldLib = LibName; + /* The old library file is renamed .bak */ + OldLib = aLibName; ChangeFileNameExt( OldLib, OLD_EXT ); if( wxFileExists( OldLib ) ) wxRemoveFile( OldLib ); - if( !wxRenameFile( LibName, OldLib ) ) + if( !wxRenameFile( aLibName, OldLib ) ) DisplayError( this, wxT( "Librairi.cpp: rename .bak err" ) ); - /* Le nouveau fichier librairie est renomme */ - if( !wxRenameFile( NewLib, LibName ) ) + /* The new library file is renamed */ + if( !wxRenameFile( NewLib, aLibName ) ) { DisplayError( this, wxT( "Librairi.cpp: rename NewLib err" ) ); return 0; } - CreateDocLibrary( OldLib ); + /* creates the new .dcm doc file corresponding to the new library */ + if ( aCreateDocFile ) + CreateDocLibrary( aLibName ); - if( DisplayDialog ) + if( aDisplayDialog ) { msg = _( "Component " ); msg += Name_Cmp; msg += added ? _( " added in " ) : _( " replaced in " ); - msg += LibName; + msg += aLibName; Affiche_Message( msg ); } @@ -713,15 +719,15 @@ MODULE* WinEDA_BasePcbFrame::Create_1_Module( wxDC* DC, const wxString& module_n /* Ask fo the new module reference */ if( module_name.IsEmpty() ) { - if( Get_Message( _( "Module Reference:" ), _("Module Creation:"), Line, this ) != 0 ) + if( Get_Message( _( "Module Reference:" ), _( "Module Creation:" ), Line, this ) != 0 ) { - DisplayInfo(this, _("No reference, aborted")); + DisplayInfo( this, _( "No reference, aborted" ) ); return NULL; } } else Line = module_name; - Line.Trim( TRUE ); + Line.Trim( true ); Line.Trim( FALSE ); // Creates the new module and add it to the head of the linked list of modules @@ -747,7 +753,7 @@ MODULE* WinEDA_BasePcbFrame::Create_1_Module( wxDC* DC, const wxString& module_n Module->m_Value->SetWidth( ModuleTextWidth ); Module->m_Value->m_Size = ModuleTextSize; - Module->SetPosition( wxPoint(0, 0) ); + Module->SetPosition( wxPoint( 0, 0 ) ); Module->Display_Infos( this ); return Module; @@ -762,7 +768,8 @@ void WinEDA_ModuleEditFrame::Select_Active_Library() return; WinEDAListBox* LibListBox = new WinEDAListBox( this, _( "Active Lib:" ), - NULL, m_CurrentLib, NULL, wxColour( 200, 200, 255 ) ); + NULL, m_CurrentLib, NULL, + wxColour( 200, 200, 255 ) ); LibListBox->InsertItems( g_LibName_List ); @@ -783,7 +790,7 @@ int WinEDA_ModuleEditFrame::Create_Librairie( const wxString& LibName ) { FILE* lib_module; wxString msg; - char cbuf[256]; + char cbuf[256]; if( wxFileExists( LibName ) ) { @@ -887,7 +894,7 @@ static bool CreateDocLibrary( const wxString& LibName ) Doc = CONV_FROM_UTF8( StrPurge( Line + 3 ) ); } - if( (Name != wxEmptyString) && ( (Doc != wxEmptyString) || (KeyWord != wxEmptyString) ) )/* Generation de la doc du composant */ + if( (Name != wxEmptyString) && ( (Doc != wxEmptyString) || (KeyWord != wxEmptyString) ) ) /* Generation de la doc du composant */ { fprintf( LibDoc, "#\n$MODULE %s\n", CONV_TO_UTF8( Name ) ); fprintf( LibDoc, "Li %s\n", CONV_TO_UTF8( Name ) ); @@ -919,5 +926,5 @@ static bool CreateDocLibrary( const wxString& LibName ) fclose( LibMod ); fprintf( LibDoc, "#\n$EndLIBDOC\n" ); fclose( LibDoc ); - return TRUE; + return true; } diff --git a/pcbnew/modedit.cpp b/pcbnew/modedit.cpp index 56f041bdc4..3ea511a719 100644 --- a/pcbnew/modedit.cpp +++ b/pcbnew/modedit.cpp @@ -192,7 +192,7 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event ) switch( id ) // Traitement des commandes { case ID_EXIT: - Close( TRUE ); + Close( true ); break; case ID_LIBEDIT_SELECT_CURRENT_LIB: @@ -209,7 +209,7 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event ) case ID_MODEDIT_NEW_MODULE: { - Clear_Pcb( TRUE ); + Clear_Pcb( true ); GetScreen()->ClearUndoRedoList(); SetCurItem( NULL ); GetScreen()->m_Curseur = wxPoint( 0, 0 ); @@ -220,7 +220,7 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event ) module->SetPosition( wxPoint(0, 0) ); if( GetBoard()->m_Modules ) GetBoard()->m_Modules->m_Flags = 0; - Zoom_Automatique( TRUE ); + Zoom_Automatique( true ); } } break; @@ -229,7 +229,7 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event ) { wxString Line; Line = MakeFileName( g_RealLibDirBuffer, m_CurrentLib.GetData(), LibExtBuffer ); - Save_1_Module( Line, GetBoard()->m_Modules, TRUE, TRUE ); + Save_Module_In_Library( Line, GetBoard()->m_Modules, true, true, true ); GetScreen()->ClrModify(); } break; @@ -315,13 +315,13 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event ) case ID_LIBEDIT_IMPORT_PART: GetScreen()->ClearUndoRedoList(); SetCurItem( NULL ); - Clear_Pcb( TRUE ); + Clear_Pcb( true ); GetScreen()->m_Curseur = wxPoint( 0, 0 ); Import_Module( &dc ); if( GetBoard()->m_Modules ) GetBoard()->m_Modules->m_Flags = 0; GetScreen()->ClrModify(); - Zoom_Automatique( TRUE ); + Zoom_Automatique( true ); if( m_Draw3DFrame ) m_Draw3DFrame->NewDisplay(); break; @@ -333,7 +333,7 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event ) case ID_LIBEDIT_CREATE_NEW_LIB_AND_SAVE_CURRENT_PART: if( GetBoard()->m_Modules ) - Export_Module( GetBoard()->m_Modules, TRUE ); + Export_Module( GetBoard()->m_Modules, true ); break; case ID_MODEDIT_SHEET_SET: @@ -342,7 +342,7 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event ) case ID_MODEDIT_LOAD_MODULE: GetScreen()->ClearUndoRedoList(); SetCurItem( NULL ); - Clear_Pcb( TRUE ); + Clear_Pcb( true ); GetScreen()->m_Curseur = wxPoint( 0, 0 ); Load_Module_From_Library( m_CurrentLib, &dc ); if( GetBoard()->m_Modules ) @@ -365,7 +365,7 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event ) } } GetScreen()->ClrModify(); - Zoom_Automatique( TRUE ); + Zoom_Automatique( true ); if( m_Draw3DFrame ) m_Draw3DFrame->NewDisplay(); break; @@ -425,12 +425,12 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event ) case ID_POPUP_PCB_ROTATE_MODULE_COUNTERCLOCKWISE: DrawPanel->MouseToCursorSchema(); - Rotate_Module( &dc, (MODULE*) GetScreen()->GetCurItem(), 900, TRUE ); + Rotate_Module( &dc, (MODULE*) GetScreen()->GetCurItem(), 900, true ); break; case ID_POPUP_PCB_ROTATE_MODULE_CLOCKWISE: DrawPanel->MouseToCursorSchema(); - Rotate_Module( &dc, (MODULE*) GetScreen()->GetCurItem(), -900, TRUE ); + Rotate_Module( &dc, (MODULE*) GetScreen()->GetCurItem(), -900, true ); break; case ID_POPUP_PCB_EDIT_MODULE: @@ -587,12 +587,12 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event ) case ID_MODEDIT_UNDO: GetComponentFromUndoList(); - DrawPanel->Refresh( TRUE ); + DrawPanel->Refresh( true ); break; case ID_MODEDIT_REDO: GetComponentFromRedoList(); - DrawPanel->Refresh( TRUE ); + DrawPanel->Refresh( true ); break; case ID_POPUP_PLACE_BLOCK: