2009-07-29 13:10:36 +00:00
|
|
|
/***********************************************************/
|
2009-11-09 14:00:22 +00:00
|
|
|
/* wxGerberStruct.h: */
|
2009-07-29 13:10:36 +00:00
|
|
|
/***********************************************************/
|
|
|
|
|
|
|
|
#ifndef WX_GERBER_STRUCT_H
|
|
|
|
#define WX_GERBER_STRUCT_H
|
|
|
|
|
2009-09-22 12:27:57 +00:00
|
|
|
|
|
|
|
#include "id.h"
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Command IDs for the gerber file viewer.
|
|
|
|
*
|
|
|
|
* Please add IDs that are unique to the gerber file viewer here and not in the
|
|
|
|
* global id.h file. This will prevent the entire project from being rebuilt
|
|
|
|
* when adding new command to the gerber file viewer.
|
|
|
|
*/
|
|
|
|
enum id_gerbview_frm
|
|
|
|
{
|
|
|
|
ID_GERBVIEW_SHOW_LIST_DCODES,
|
|
|
|
ID_GERBVIEW_LOAD_DRILL_FILE,
|
|
|
|
ID_GERBVIEW_LOAD_DCODE_FILE,
|
|
|
|
ID_TOOLBARH_GERBER_SELECT_TOOL,
|
|
|
|
ID_MENU_INC_LAYER_AND_APPEND_FILE,
|
|
|
|
ID_INC_LAYER_AND_APPEND_FILE,
|
|
|
|
ID_GERBVIEW_SHOW_SOURCE,
|
|
|
|
ID_GERBVIEW_EXPORT_TO_PCBNEW,
|
|
|
|
ID_GERBVIEW_POPUP_DELETE_DCODE_ITEMS,
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2009-07-29 13:10:36 +00:00
|
|
|
/******************************************************************
|
|
|
|
class WinEDA_GerberFrame: this is the main window used in gerbview
|
|
|
|
******************************************************************/
|
|
|
|
|
|
|
|
class WinEDA_GerberFrame : public WinEDA_BasePcbFrame
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
WinEDAChoiceBox* m_SelLayerBox;
|
|
|
|
WinEDAChoiceBox* m_SelLayerTool;
|
|
|
|
|
|
|
|
public:
|
|
|
|
WinEDA_GerberFrame( wxWindow* father, const wxString& title,
|
|
|
|
const wxPoint& pos, const wxSize& size,
|
|
|
|
long style = KICAD_DEFAULT_DRAWFRAME_STYLE );
|
|
|
|
|
|
|
|
~WinEDA_GerberFrame();
|
|
|
|
|
|
|
|
void Update_config();
|
|
|
|
void OnCloseWindow( wxCloseEvent& Event );
|
2009-11-22 20:55:05 +00:00
|
|
|
/**
|
|
|
|
* Load applications settings specific to the PCBNew.
|
|
|
|
*
|
|
|
|
* This overrides the base class WinEDA_BasePcbFrame::LoadSettings() to
|
|
|
|
* handle settings specific common to the PCB layout application. It
|
|
|
|
* calls down to the base class to load settings common to all PCB type
|
|
|
|
* drawing frames. Please put your application settings for PCBNew here
|
|
|
|
* to avoid having application settings loaded all over the place.
|
|
|
|
*/
|
|
|
|
virtual void LoadSettings();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Save applications settings common to PCB draw frame objects.
|
|
|
|
*
|
|
|
|
* This overrides the base class WinEDA_BasePcbFrame::SaveSettings() to
|
|
|
|
* save settings specific to the PCB layout application main window. It
|
|
|
|
* calls down to the base class to save settings common to all PCB type
|
|
|
|
* drawing frames. Please put your application settings for PCBNew here
|
|
|
|
* to avoid having application settings saved all over the place.
|
|
|
|
*/
|
|
|
|
virtual void SaveSettings();
|
|
|
|
|
2009-07-29 13:10:36 +00:00
|
|
|
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 );
|
2009-11-09 14:00:22 +00:00
|
|
|
int BestZoom();
|
2009-07-29 13:10:36 +00:00
|
|
|
void OnSelectOptionToolbar( wxCommandEvent& event );
|
|
|
|
void OnHotKey( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct );
|
|
|
|
|
|
|
|
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 );
|
2009-11-22 20:55:05 +00:00
|
|
|
void InstallGerberGeneralOptionsFrame( wxCommandEvent& event );
|
|
|
|
void InstallGerberDisplayOptionsDialog( wxCommandEvent& event );
|
2009-07-29 13:10:36 +00:00
|
|
|
void InstallPcbGlobalDeleteFrame( const wxPoint& pos );
|
|
|
|
|
|
|
|
/* handlers for block commands */
|
|
|
|
int ReturnBlockCommand( int key );
|
|
|
|
virtual void HandleBlockPlace( wxDC* DC );
|
|
|
|
virtual int HandleBlockEnd( wxDC* DC );
|
|
|
|
|
2009-07-31 05:33:11 +00:00
|
|
|
/* Block operations: */
|
|
|
|
/**
|
|
|
|
* Function Block_Delete
|
|
|
|
* deletes all tracks and segments within the selected block.
|
|
|
|
* Defined separately in pcbnew and gerbview
|
|
|
|
*
|
|
|
|
* @param DC A device context to draw on.
|
|
|
|
*/
|
2009-09-22 12:27:57 +00:00
|
|
|
void Block_Delete( wxDC* DC );
|
|
|
|
void Block_Rotate( wxDC* DC );
|
|
|
|
void Block_Invert( wxDC* DC );
|
|
|
|
|
2009-07-31 05:33:11 +00:00
|
|
|
/**
|
|
|
|
* Function Block_Move
|
|
|
|
* moves all tracks and segments within the selected block.
|
2009-09-22 12:27:57 +00:00
|
|
|
* New location is determined by the current offset from the selected
|
|
|
|
* block's original location.
|
2009-07-31 05:33:11 +00:00
|
|
|
* Defined separately in pcbnew and gerbview
|
|
|
|
*
|
|
|
|
* @param DC A device context to draw on.
|
|
|
|
*/
|
2009-09-22 12:27:57 +00:00
|
|
|
void Block_Move( wxDC* DC );
|
|
|
|
|
2009-07-31 05:33:11 +00:00
|
|
|
/**
|
|
|
|
* Function Block_Mirror_X
|
2009-09-22 12:27:57 +00:00
|
|
|
* mirrors all tracks and segments within the currently selected block
|
|
|
|
* in the X axis.
|
2009-07-31 05:33:11 +00:00
|
|
|
*
|
|
|
|
* @param DC A device context to draw on.
|
|
|
|
*/
|
2009-09-22 12:27:57 +00:00
|
|
|
void Block_Mirror_X( wxDC* DC );
|
2009-07-31 05:33:11 +00:00
|
|
|
/**
|
|
|
|
* Function Block_Duplicate
|
|
|
|
* copies-and-moves all tracks and segments within the selected block.
|
2009-09-22 12:27:57 +00:00
|
|
|
* New location is determined by the current offset from the selected
|
|
|
|
* block's original location.
|
2009-07-31 05:33:11 +00:00
|
|
|
* Defined separately in pcbnew and gerbview
|
|
|
|
*
|
|
|
|
* @param DC A device context to draw on.
|
|
|
|
*/
|
2009-09-22 12:27:57 +00:00
|
|
|
void Block_Duplicate( wxDC* DC );
|
2009-07-31 05:33:11 +00:00
|
|
|
|
2009-07-29 13:10:36 +00:00
|
|
|
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,
|
2009-09-22 12:27:57 +00:00
|
|
|
int garde, bool trace_via,
|
|
|
|
GRTraceMode trace_mode );
|
2009-07-29 13:10:36 +00:00
|
|
|
void Plot_Layer_GERBER( FILE* File, int masque_layer,
|
2009-09-22 12:27:57 +00:00
|
|
|
int garde, bool trace_via,
|
|
|
|
GRTraceMode trace_mode );
|
2009-07-29 13:10:36 +00:00
|
|
|
int Gen_D_CODE_File( const wxString& Name_File );
|
|
|
|
void Plot_Layer_PS( FILE* File, int masque_layer,
|
2009-09-22 12:27:57 +00:00
|
|
|
int garde, bool trace_via,
|
|
|
|
GRTraceMode trace_mode );
|
2009-07-29 13:10:36 +00:00
|
|
|
|
|
|
|
void Files_io( wxCommandEvent& event );
|
|
|
|
void OnFileHistory( wxCommandEvent& event );
|
2009-11-21 20:44:19 +00:00
|
|
|
bool LoadOneGerberFile( const wxString& FileName, int mode );
|
|
|
|
int ReadGerberFile( FILE* File, bool Append );
|
|
|
|
bool Read_GERBER_File( const wxString& GERBER_FullFileName,
|
2009-07-29 13:10:36 +00:00
|
|
|
const wxString& D_Code_FullFileName );
|
2009-11-21 20:44:19 +00:00
|
|
|
bool SaveGerberFile( const wxString& FileName );
|
2009-07-29 13:10:36 +00:00
|
|
|
|
|
|
|
void GeneralControle( wxDC* DC, wxPoint Mouse );
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function Read_D_Code_File
|
2009-09-22 12:27:57 +00:00
|
|
|
* reads in a dcode file assuming ALSPCB file format with ';' indicating
|
|
|
|
* comments.
|
2009-07-29 13:10:36 +00:00
|
|
|
* <p>
|
|
|
|
* Format is like CSV but with optional ';' delineated comments:<br>
|
2009-09-22 12:27:57 +00:00
|
|
|
* tool, Horiz, Vert, drill, vitesse, acc. ,Type ; [DCODE (commentaire)]<br>
|
|
|
|
* ex: 1, 12, 12, 0, 0, 0, 3 ; D10
|
2009-07-29 13:10:36 +00:00
|
|
|
* <p>
|
|
|
|
* Format:<br>
|
|
|
|
* Ver, Hor, Type, Tool [,Drill]<br>
|
2009-09-22 12:27:57 +00:00
|
|
|
* example: 0.012, 0.012, L , D10<br>
|
2009-07-29 13:10:36 +00:00
|
|
|
*
|
|
|
|
* Categorize all found dcodes into a table of D_CODE instantiations.
|
|
|
|
* @param D_CodeFullFileName The name of the file to read from.
|
|
|
|
* @return int - <br>
|
|
|
|
* -1 = file not found<br>
|
|
|
|
* -2 = parsing problem<br>
|
2009-09-22 12:27:57 +00:00
|
|
|
* 0 = the \a D_Code_FullFileName is empty, no reading
|
|
|
|
* is done but an empty GERBER is put into
|
|
|
|
* g_GERBER_List[]<br>
|
2009-07-29 13:10:36 +00:00
|
|
|
* 1 = read OK<br>
|
|
|
|
*/
|
|
|
|
int Read_D_Code_File( const wxString& D_Code_FullFileName );
|
|
|
|
void CopyDCodesSizeToItems();
|
|
|
|
void Liste_D_Codes( wxDC* DC );
|
|
|
|
|
|
|
|
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 );
|
|
|
|
|
|
|
|
// 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 );
|
|
|
|
|
|
|
|
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 );
|
|
|
|
|
|
|
|
/* SaveCopyInUndoList() virtual
|
|
|
|
* currently: do nothing in gerbview.
|
|
|
|
* but but be defined because it is a pure virtual in WinEDA_BasePcbFrame
|
|
|
|
*/
|
2009-09-22 12:27:57 +00:00
|
|
|
virtual void SaveCopyInUndoList(
|
|
|
|
BOARD_ITEM* aItemToCopy,
|
|
|
|
UndoRedoOpType aTypeCommand = UR_UNSPECIFIED,
|
|
|
|
const wxPoint& aTransformPoint = wxPoint(0,0) ) { }
|
|
|
|
|
2009-08-03 18:54:48 +00:00
|
|
|
/** Function SaveCopyInUndoList (overloaded).
|
|
|
|
* Creates a new entry in undo list of commands.
|
|
|
|
* 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 UndoRedoOpType)
|
2009-09-22 12:27:57 +00:00
|
|
|
* @param aTransformPoint = the reference point of the transformation,
|
|
|
|
* for commands like move
|
2009-08-03 18:54:48 +00:00
|
|
|
*/
|
2009-09-22 12:27:57 +00:00
|
|
|
virtual void SaveCopyInUndoList(
|
|
|
|
PICKED_ITEMS_LIST& aItemsList,
|
|
|
|
UndoRedoOpType aTypeCommand,
|
|
|
|
const wxPoint& aTransformPoint = wxPoint(0,0) )
|
2009-08-03 18:54:48 +00:00
|
|
|
{
|
|
|
|
// currently: do nothing in gerbview.
|
|
|
|
}
|
2009-07-29 13:10:36 +00:00
|
|
|
|
|
|
|
|
|
|
|
DECLARE_EVENT_TABLE()
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* WX_GERBER_STRUCT_H */
|