Loading gerbview/dcode.cpp +0 −128 Original line number Diff line number Diff line Loading @@ -154,134 +154,6 @@ int D_CODE::GetShapeDim( GERBER_DRAW_ITEM* aParent ) } int GERBVIEW_FRAME::ReadDCodeDefinitionFile( const wxString& D_Code_FullFileName ) { int current_Dcode, ii; char* ptcar; int dimH, dimV, drill, dummy; float fdimH, fdimV, fdrill; char c_type_outil[256]; char line[GERBER_BUFZ]; wxString msg; D_CODE* dcode; FILE* dest; LAYER_NUM layer = getActiveLayer(); int type_outil; if( g_GERBER_List[layer] == NULL ) g_GERBER_List[layer] = new GERBER_IMAGE( this, layer ); GERBER_IMAGE* gerber = g_GERBER_List[layer]; /* Updating gerber scale: */ double dcode_scale = IU_PER_MILS; // By uniting dCode = mil, // internal unit = IU_PER_MILS current_Dcode = 0; if( D_Code_FullFileName.IsEmpty() ) return 0; dest = wxFopen( D_Code_FullFileName, wxT( "rt" ) ); if( dest == 0 ) { msg.Printf( _( "File <%s> not found" ), GetChars( D_Code_FullFileName ) ); DisplayError( this, msg, 10 ); return -1; } gerber->InitToolTable(); while( fgets( line, sizeof(line) - 1, dest ) != NULL ) { if( *line == ';' ) continue; if( strlen( line ) < 10 ) continue; /* Skip blank line. */ dcode = NULL; current_Dcode = 0; /* Determine of the type of file from D_Code. */ ptcar = line; ii = 0; while( *ptcar ) if( *(ptcar++) == ',' ) ii++; if( ii >= 6 ) /* value in mils */ { sscanf( line, "%d,%d,%d,%d,%d,%d,%d", &ii, &dimH, &dimV, &drill, &dummy, &dummy, &type_outil ); dimH = KiROUND( dimH * dcode_scale ); dimV = KiROUND( dimV * dcode_scale ); drill = KiROUND( drill * dcode_scale ); if( ii < 1 ) ii = 1; current_Dcode = ii - 1 + FIRST_DCODE; } else /* Values in inches are converted to mils. */ { fdrill = 0; current_Dcode = 0; sscanf( line, "%f,%f,%1s", &fdimV, &fdimH, c_type_outil ); ptcar = line; while( *ptcar ) { if( *ptcar == 'D' ) { sscanf( ptcar + 1, "%d,%f", ¤t_Dcode, &fdrill ); break; } else { ptcar++; } } dimH = KiROUND( fdimH * dcode_scale * 1000 ); dimV = KiROUND( fdimV * dcode_scale * 1000 ); drill = KiROUND( fdrill * dcode_scale * 1000 ); if( strchr( "CLROP", c_type_outil[0] ) ) { type_outil = (APERTURE_T) c_type_outil[0]; } else { fclose( dest ); return -2; } } /* Update the list of d_codes if consistent. */ if( current_Dcode < FIRST_DCODE ) continue; if( current_Dcode >= TOOLS_MAX_COUNT ) continue; dcode = gerber->GetDCODE( current_Dcode ); dcode->m_Size.x = dimH; dcode->m_Size.y = dimV; dcode->m_Shape = (APERTURE_T) type_outil; dcode->m_Drill.x = dcode->m_Drill.y = drill; dcode->m_Defined = true; } fclose( dest ); return 1; } void GERBVIEW_FRAME::CopyDCodesSizeToItems() { static D_CODE dummy( 999 ); //Used if D_CODE not found in list Loading gerbview/events_called_functions.cpp +0 −1 Original line number Diff line number Diff line Loading @@ -29,7 +29,6 @@ BEGIN_EVENT_TABLE( GERBVIEW_FRAME, EDA_DRAW_FRAME ) EVT_TOOL( wxID_FILE, GERBVIEW_FRAME::Files_io ) EVT_TOOL( ID_GERBVIEW_ERASE_ALL, GERBVIEW_FRAME::Files_io ) EVT_TOOL( ID_GERBVIEW_LOAD_DRILL_FILE, GERBVIEW_FRAME::Files_io ) EVT_TOOL( ID_GERBVIEW_LOAD_DCODE_FILE, GERBVIEW_FRAME::Files_io ) EVT_TOOL( ID_NEW_BOARD, GERBVIEW_FRAME::Files_io ) EVT_TOOL( ID_GERBVIEW_SET_PAGE_BORDER, GERBVIEW_FRAME::Process_Special_Functions ) Loading gerbview/files.cpp +0 −31 Original line number Diff line number Diff line Loading @@ -90,11 +90,6 @@ void GERBVIEW_FRAME::Files_io( wxCommandEvent& event ) m_canvas->Refresh(); break; case ID_GERBVIEW_LOAD_DCODE_FILE: LoadDCodeFile( wxEmptyString ); m_canvas->Refresh(); break; default: wxFAIL_MSG( wxT( "File_io: unexpected command id" ) ); break; Loading Loading @@ -290,29 +285,3 @@ bool GERBVIEW_FRAME::LoadExcellonFiles( const wxString& aFullFileName ) return true; } bool GERBVIEW_FRAME::LoadDCodeFile( const wxString& aFullFileName ) { wxString wildcard; wxFileName fn = aFullFileName; if( !fn.IsOk() ) { wildcard = _( "Gerber DCODE files" ); wildcard += wxT(" ") + AllFilesWildcard; fn = m_lastFileName; wxFileDialog dlg( this, _( "Load GERBER DCODE File" ), fn.GetPath(), fn.GetFullName(), wildcard, wxFD_OPEN | wxFD_FILE_MUST_EXIST ); if( dlg.ShowModal() == wxID_CANCEL ) return false; fn = dlg.GetPath(); } ReadDCodeDefinitionFile( fn.GetFullPath() ); CopyDCodesSizeToItems(); return true; } gerbview/gerbview.cpp +1 −2 Original line number Diff line number Diff line Loading @@ -31,7 +31,6 @@ #include <class_drawpanel.h> #include <confirm.h> #include <gestfich.h> //#include <gr_basic.h> #include <gerbview.h> #include <gerbview_id.h> Loading gerbview/gerbview_frame.h +11 −46 Original line number Diff line number Diff line Loading @@ -379,14 +379,14 @@ public: /** * Function ReFillLayerWidget * changes out all the layers in m_Layers and may be called upon * loading a new BOARD. * loading new gerber files. */ void ReFillLayerWidget(); /** * Function setActiveLayer * will change the currently active layer to \a aLayer and also * update the PCB_LAYER_WIDGET. * update the GERBER_LAYER_WIDGET. */ void setActiveLayer( LAYER_NUM aLayer, bool doLayerWidgetUpdate = true ); Loading @@ -412,7 +412,7 @@ public: /** * Function syncLayerWidget * updates the currently "selected" layer within the PCB_LAYER_WIDGET. * updates the currently "selected" layer within the GERBER_LAYER_WIDGET. * The currently active layer is defined by the return value of getActiveLayer(). * <p> * This function cannot be inline without including layer_widget.h in Loading Loading @@ -453,10 +453,11 @@ public: /** * Load applications settings specific to the Pcbnew. * * This overrides the base class PCB_BASE_FRAME::LoadSettings() to * This overrides the base class EDA_DRAW_FRAME::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 * calls down to the base class to load settings common to all * EDA_DRAW_FRAME type drawing frames. * Please put your application settings for Pcbnew here * to avoid having application settings loaded all over the place. */ virtual void LoadSettings(); Loading @@ -464,10 +465,10 @@ public: /** * Save applications settings common to PCB draw frame objects. * * This overrides the base class PCB_BASE_FRAME::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 * This overrides the base class EDA_DRAW_FRAME::SaveSettings() to * save settings specific to the gerbview application main window. It * calls down to the base class to save settings common to all * drawing frames. Please put your application settings for Gerbview here * to avoid having application settings saved all over the place. */ virtual void SaveSettings(); Loading Loading @@ -638,42 +639,6 @@ public: void GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey = 0 ); /** * Read a DCode file (not used with RX274X files , just with RS274D old files). * Note: there is no standard for DCode file. * Just read a file format created by early versions of Pcbnew. * @return false if file not read (cancellation) * true if OK * @ aparm aFullFileName = name of file to load. * if empty, or if the file does not exist, a file dialog is opened */ bool LoadDCodeFile( const wxString& aFullFileName ); /** * Function ReadDCodeDefinitionFile * reads in a dcode file assuming ALSPCB file format with ';' indicating * comments. * <p> * Format is like CSV but with optional ';' delineated comments:<br> * tool, Horiz, Vert, drill, vitesse, acc. ,Type ; [DCODE (commentaire)]<br> * ex: 1, 12, 12, 0, 0, 0, 3 ; D10 * <p> * Format:<br> * Ver, Hor, Type, Tool [,Drill]<br> * example: 0.012, 0.012, L , D10<br> * * Load all found dcodes into a table of D_CODE instantiations. * @param D_Code_FullFileName The name of the file to read from. * @return int - <br> * -1 = file not found<br> * -2 = parsing problem<br> * 0 = the \a D_Code_FullFileName is empty, no reading * is done but an empty GERBER is put into * g_GERBER_List[]<br> * 1 = read OK<br> */ int ReadDCodeDefinitionFile( const wxString& D_Code_FullFileName ); /** * Set Size Items (Lines, Flashes) from DCodes List */ Loading Loading
gerbview/dcode.cpp +0 −128 Original line number Diff line number Diff line Loading @@ -154,134 +154,6 @@ int D_CODE::GetShapeDim( GERBER_DRAW_ITEM* aParent ) } int GERBVIEW_FRAME::ReadDCodeDefinitionFile( const wxString& D_Code_FullFileName ) { int current_Dcode, ii; char* ptcar; int dimH, dimV, drill, dummy; float fdimH, fdimV, fdrill; char c_type_outil[256]; char line[GERBER_BUFZ]; wxString msg; D_CODE* dcode; FILE* dest; LAYER_NUM layer = getActiveLayer(); int type_outil; if( g_GERBER_List[layer] == NULL ) g_GERBER_List[layer] = new GERBER_IMAGE( this, layer ); GERBER_IMAGE* gerber = g_GERBER_List[layer]; /* Updating gerber scale: */ double dcode_scale = IU_PER_MILS; // By uniting dCode = mil, // internal unit = IU_PER_MILS current_Dcode = 0; if( D_Code_FullFileName.IsEmpty() ) return 0; dest = wxFopen( D_Code_FullFileName, wxT( "rt" ) ); if( dest == 0 ) { msg.Printf( _( "File <%s> not found" ), GetChars( D_Code_FullFileName ) ); DisplayError( this, msg, 10 ); return -1; } gerber->InitToolTable(); while( fgets( line, sizeof(line) - 1, dest ) != NULL ) { if( *line == ';' ) continue; if( strlen( line ) < 10 ) continue; /* Skip blank line. */ dcode = NULL; current_Dcode = 0; /* Determine of the type of file from D_Code. */ ptcar = line; ii = 0; while( *ptcar ) if( *(ptcar++) == ',' ) ii++; if( ii >= 6 ) /* value in mils */ { sscanf( line, "%d,%d,%d,%d,%d,%d,%d", &ii, &dimH, &dimV, &drill, &dummy, &dummy, &type_outil ); dimH = KiROUND( dimH * dcode_scale ); dimV = KiROUND( dimV * dcode_scale ); drill = KiROUND( drill * dcode_scale ); if( ii < 1 ) ii = 1; current_Dcode = ii - 1 + FIRST_DCODE; } else /* Values in inches are converted to mils. */ { fdrill = 0; current_Dcode = 0; sscanf( line, "%f,%f,%1s", &fdimV, &fdimH, c_type_outil ); ptcar = line; while( *ptcar ) { if( *ptcar == 'D' ) { sscanf( ptcar + 1, "%d,%f", ¤t_Dcode, &fdrill ); break; } else { ptcar++; } } dimH = KiROUND( fdimH * dcode_scale * 1000 ); dimV = KiROUND( fdimV * dcode_scale * 1000 ); drill = KiROUND( fdrill * dcode_scale * 1000 ); if( strchr( "CLROP", c_type_outil[0] ) ) { type_outil = (APERTURE_T) c_type_outil[0]; } else { fclose( dest ); return -2; } } /* Update the list of d_codes if consistent. */ if( current_Dcode < FIRST_DCODE ) continue; if( current_Dcode >= TOOLS_MAX_COUNT ) continue; dcode = gerber->GetDCODE( current_Dcode ); dcode->m_Size.x = dimH; dcode->m_Size.y = dimV; dcode->m_Shape = (APERTURE_T) type_outil; dcode->m_Drill.x = dcode->m_Drill.y = drill; dcode->m_Defined = true; } fclose( dest ); return 1; } void GERBVIEW_FRAME::CopyDCodesSizeToItems() { static D_CODE dummy( 999 ); //Used if D_CODE not found in list Loading
gerbview/events_called_functions.cpp +0 −1 Original line number Diff line number Diff line Loading @@ -29,7 +29,6 @@ BEGIN_EVENT_TABLE( GERBVIEW_FRAME, EDA_DRAW_FRAME ) EVT_TOOL( wxID_FILE, GERBVIEW_FRAME::Files_io ) EVT_TOOL( ID_GERBVIEW_ERASE_ALL, GERBVIEW_FRAME::Files_io ) EVT_TOOL( ID_GERBVIEW_LOAD_DRILL_FILE, GERBVIEW_FRAME::Files_io ) EVT_TOOL( ID_GERBVIEW_LOAD_DCODE_FILE, GERBVIEW_FRAME::Files_io ) EVT_TOOL( ID_NEW_BOARD, GERBVIEW_FRAME::Files_io ) EVT_TOOL( ID_GERBVIEW_SET_PAGE_BORDER, GERBVIEW_FRAME::Process_Special_Functions ) Loading
gerbview/files.cpp +0 −31 Original line number Diff line number Diff line Loading @@ -90,11 +90,6 @@ void GERBVIEW_FRAME::Files_io( wxCommandEvent& event ) m_canvas->Refresh(); break; case ID_GERBVIEW_LOAD_DCODE_FILE: LoadDCodeFile( wxEmptyString ); m_canvas->Refresh(); break; default: wxFAIL_MSG( wxT( "File_io: unexpected command id" ) ); break; Loading Loading @@ -290,29 +285,3 @@ bool GERBVIEW_FRAME::LoadExcellonFiles( const wxString& aFullFileName ) return true; } bool GERBVIEW_FRAME::LoadDCodeFile( const wxString& aFullFileName ) { wxString wildcard; wxFileName fn = aFullFileName; if( !fn.IsOk() ) { wildcard = _( "Gerber DCODE files" ); wildcard += wxT(" ") + AllFilesWildcard; fn = m_lastFileName; wxFileDialog dlg( this, _( "Load GERBER DCODE File" ), fn.GetPath(), fn.GetFullName(), wildcard, wxFD_OPEN | wxFD_FILE_MUST_EXIST ); if( dlg.ShowModal() == wxID_CANCEL ) return false; fn = dlg.GetPath(); } ReadDCodeDefinitionFile( fn.GetFullPath() ); CopyDCodesSizeToItems(); return true; }
gerbview/gerbview.cpp +1 −2 Original line number Diff line number Diff line Loading @@ -31,7 +31,6 @@ #include <class_drawpanel.h> #include <confirm.h> #include <gestfich.h> //#include <gr_basic.h> #include <gerbview.h> #include <gerbview_id.h> Loading
gerbview/gerbview_frame.h +11 −46 Original line number Diff line number Diff line Loading @@ -379,14 +379,14 @@ public: /** * Function ReFillLayerWidget * changes out all the layers in m_Layers and may be called upon * loading a new BOARD. * loading new gerber files. */ void ReFillLayerWidget(); /** * Function setActiveLayer * will change the currently active layer to \a aLayer and also * update the PCB_LAYER_WIDGET. * update the GERBER_LAYER_WIDGET. */ void setActiveLayer( LAYER_NUM aLayer, bool doLayerWidgetUpdate = true ); Loading @@ -412,7 +412,7 @@ public: /** * Function syncLayerWidget * updates the currently "selected" layer within the PCB_LAYER_WIDGET. * updates the currently "selected" layer within the GERBER_LAYER_WIDGET. * The currently active layer is defined by the return value of getActiveLayer(). * <p> * This function cannot be inline without including layer_widget.h in Loading Loading @@ -453,10 +453,11 @@ public: /** * Load applications settings specific to the Pcbnew. * * This overrides the base class PCB_BASE_FRAME::LoadSettings() to * This overrides the base class EDA_DRAW_FRAME::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 * calls down to the base class to load settings common to all * EDA_DRAW_FRAME type drawing frames. * Please put your application settings for Pcbnew here * to avoid having application settings loaded all over the place. */ virtual void LoadSettings(); Loading @@ -464,10 +465,10 @@ public: /** * Save applications settings common to PCB draw frame objects. * * This overrides the base class PCB_BASE_FRAME::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 * This overrides the base class EDA_DRAW_FRAME::SaveSettings() to * save settings specific to the gerbview application main window. It * calls down to the base class to save settings common to all * drawing frames. Please put your application settings for Gerbview here * to avoid having application settings saved all over the place. */ virtual void SaveSettings(); Loading Loading @@ -638,42 +639,6 @@ public: void GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey = 0 ); /** * Read a DCode file (not used with RX274X files , just with RS274D old files). * Note: there is no standard for DCode file. * Just read a file format created by early versions of Pcbnew. * @return false if file not read (cancellation) * true if OK * @ aparm aFullFileName = name of file to load. * if empty, or if the file does not exist, a file dialog is opened */ bool LoadDCodeFile( const wxString& aFullFileName ); /** * Function ReadDCodeDefinitionFile * reads in a dcode file assuming ALSPCB file format with ';' indicating * comments. * <p> * Format is like CSV but with optional ';' delineated comments:<br> * tool, Horiz, Vert, drill, vitesse, acc. ,Type ; [DCODE (commentaire)]<br> * ex: 1, 12, 12, 0, 0, 0, 3 ; D10 * <p> * Format:<br> * Ver, Hor, Type, Tool [,Drill]<br> * example: 0.012, 0.012, L , D10<br> * * Load all found dcodes into a table of D_CODE instantiations. * @param D_Code_FullFileName The name of the file to read from. * @return int - <br> * -1 = file not found<br> * -2 = parsing problem<br> * 0 = the \a D_Code_FullFileName is empty, no reading * is done but an empty GERBER is put into * g_GERBER_List[]<br> * 1 = read OK<br> */ int ReadDCodeDefinitionFile( const wxString& D_Code_FullFileName ); /** * Set Size Items (Lines, Flashes) from DCodes List */ Loading