diff --git a/pcbnew/class_drawsegment.cpp b/pcbnew/class_drawsegment.cpp index f2e8f9d16f..0fb196bdb2 100644 --- a/pcbnew/class_drawsegment.cpp +++ b/pcbnew/class_drawsegment.cpp @@ -1,251 +1,251 @@ -/***************************************************/ -/* class and functions to handle a graphic segment */ -/****************************************************/ - -#include "fctsys.h" -#include "wxstruct.h" - -#include "gr_basic.h" - -#include "common.h" -#include "pcbnew.h" - -#ifdef CVPCB -#include "cvpcb.h" -#endif - -#include "trigo.h" - -/* DRAWSEGMENT: constructor */ -DRAWSEGMENT::DRAWSEGMENT( BOARD_ITEM* StructFather, KICAD_T idtype ) : - BOARD_ITEM( StructFather, idtype ) -{ - m_Width = m_Flags = m_Shape = m_Type = m_Angle = 0; -} - - -/* destructor */ -DRAWSEGMENT:: ~DRAWSEGMENT() -{ -} - - -void DRAWSEGMENT::UnLink() - -/** - * Function UnLink - * remove item from linked list. - */ -{ - /* ereas back link */ - if( Pback ) - { - if( Pback->Type() != TYPEPCB ) - { - Pback->Pnext = Pnext; - } - else /* Le chainage arriere pointe sur la structure "Pere" */ - { - ( (BOARD*) Pback )->m_Drawings = (BOARD_ITEM*) Pnext; - } - } - - /* erase forward link */ - if( Pnext ) - Pnext->Pback = Pback; - - Pnext = Pback = NULL; -} - - -/*******************************************/ -void DRAWSEGMENT::Copy( DRAWSEGMENT* source ) -/*******************************************/ -{ - m_Type = source->m_Type; - m_Layer = source->m_Layer; - m_Width = source->m_Width; - m_Start = source->m_Start; - m_End = source->m_End; - m_Shape = source->m_Shape; - m_Angle = source->m_Angle; - m_TimeStamp = source->m_TimeStamp; -} - - -bool DRAWSEGMENT::Save( FILE* aFile ) const -{ - if( GetState( DELETED ) ) - return true; - - bool rc = false; - - if( fprintf( aFile, "$DRAWSEGMENT\n" ) != sizeof("$DRAWSEGMENT\n") - 1 ) - goto out; - - fprintf( aFile, "Po %d %d %d %d %d %d\n", - m_Shape, - m_Start.x, m_Start.y, - m_End.x, m_End.y, m_Width ); - - fprintf( aFile, "De %d %d %d %lX %X\n", - m_Layer, m_Type, m_Angle, - m_TimeStamp, ReturnStatus() ); - - if( fprintf( aFile, "$EndDRAWSEGMENT\n" ) != sizeof("$EndDRAWSEGMENT\n") - 1 ) - goto out; - - rc = true; - -out: - return rc; -} - - -/******************************************************************/ -bool DRAWSEGMENT::ReadDrawSegmentDescr( FILE* File, int* LineNum ) -/******************************************************************/ - -/* Read a DRAWSEGMENT from a file - */ -{ - char Line[2048]; - - while( GetLine( File, Line, LineNum ) != NULL ) - { - if( strnicmp( Line, "$End", 4 ) == 0 ) - return TRUE; /* End of description */ - if( Line[0] == 'P' ) - { - sscanf( Line + 2, " %d %d %d %d %d %d", - &m_Shape, &m_Start.x, &m_Start.y, - &m_End.x, &m_End.y, &m_Width ); - if( m_Width < 0 ) - m_Width = 0; - } - - if( Line[0] == 'D' ) - { - int status; - sscanf( Line + 2, " %d %d %d %lX %X", - &m_Layer, &m_Type, &m_Angle, - &m_TimeStamp, &status ); - - if( m_Layer < FIRST_NO_COPPER_LAYER ) - m_Layer = FIRST_NO_COPPER_LAYER; - if( m_Layer > LAST_NO_COPPER_LAYER ) - m_Layer = LAST_NO_COPPER_LAYER; - - SetState( status, ON ); - } - } - - return FALSE; -} - - -// see pcbstruct.h -void DRAWSEGMENT::Display_Infos( WinEDA_DrawFrame* frame ) -{ - int itype; - wxString msg; - - frame->MsgPanel->EraseMsgBox(); - - itype = m_Type & 0x0F; - - msg = wxT( "DRAWING" ); - - Affiche_1_Parametre( frame, 1, _( "Type" ), msg, DARKCYAN ); - - Affiche_1_Parametre( frame, 16, _( "Shape" ), wxEmptyString, RED ); - - if( m_Shape == S_CIRCLE ) - Affiche_1_Parametre( frame, -1, wxEmptyString, _( "Circle" ), RED ); - - else if( m_Shape == S_ARC ) - { - Affiche_1_Parametre( frame, -1, wxEmptyString, _( " Arc " ), RED ); - msg.Printf( wxT( "%d" ), m_Angle ); - Affiche_1_Parametre( frame, 32, wxT( " l.arc " ), msg, RED ); - } - else - Affiche_1_Parametre( frame, -1, wxEmptyString, _( "Segment" ), RED ); - - Affiche_1_Parametre( frame, 48, _( "Layer" ), - ReturnPcbLayerName( m_Layer ), BROWN ); - - valeur_param( (unsigned) m_Width, msg ); - Affiche_1_Parametre( frame, 60, _( "Width" ), msg, DARKCYAN ); -} - - -/** - * Function HitTest - * tests if the given wxPoint is within the bounds of this object. - * @param ref_pos A wxPoint to test - * @return bool - true if a hit, else false - */ -bool DRAWSEGMENT::HitTest( const wxPoint& ref_pos ) -{ - int ux0 = m_Start.x; - int uy0 = m_Start.y; - - /* recalcul des coordonnees avec ux0, uy0 = origine des coordonnees */ - int dx = m_End.x - ux0; - int dy = m_End.y - uy0; - - int spot_cX = ref_pos.x - ux0; - int spot_cY = ref_pos.y - uy0; - - if( m_Shape==S_CIRCLE || m_Shape==S_ARC ) - { - int rayon, dist, stAngle, endAngle, mouseAngle; - - rayon = (int) hypot( (double) (dx), (double) (dy) ); - dist = (int) hypot( (double) (spot_cX), (double) (spot_cY) ); - - if( abs( rayon - dist ) <= (m_Width / 2) ) - { - if( m_Shape == S_CIRCLE ) - return true; - - /* pour un arc, controle complementaire */ - mouseAngle = (int) ArcTangente( spot_cY, spot_cX ); - stAngle = (int) ArcTangente( dy, dx ); - endAngle = stAngle + m_Angle; - - if( endAngle > 3600 ) - { - stAngle -= 3600; - endAngle -= 3600; - } - - if( mouseAngle >= stAngle && mouseAngle <= endAngle ) - return true; - } - } - else - { - if( DistanceTest( m_Width / 2, dx, dy, spot_cX, spot_cY ) ) - return true; - } - return false; -} - - -/** - * Function HitTest (overlayed) - * tests if the given EDA_Rect intersect this object. - * For now, an ending point must be inside this rect. - * @param refArea : the given EDA_Rect - * @return bool - true if a hit, else false - */ -bool DRAWSEGMENT::HitTest( EDA_Rect& refArea ) -{ - if( refArea.Inside( m_Start ) ) - return true; - if( refArea.Inside( m_End ) ) - return true; - return false; -} +/***************************************************/ +/* class and functions to handle a graphic segment */ +/****************************************************/ + +#include "fctsys.h" +#include "wxstruct.h" + +#include "gr_basic.h" + +#include "common.h" +#include "pcbnew.h" + +#ifdef CVPCB +#include "cvpcb.h" +#endif + +#include "trigo.h" + +/* DRAWSEGMENT: constructor */ +DRAWSEGMENT::DRAWSEGMENT( BOARD_ITEM* StructFather, KICAD_T idtype ) : + BOARD_ITEM( StructFather, idtype ) +{ + m_Width = m_Flags = m_Shape = m_Type = m_Angle = 0; +} + + +/* destructor */ +DRAWSEGMENT:: ~DRAWSEGMENT() +{ +} + + +void DRAWSEGMENT::UnLink() + +/** + * Function UnLink + * remove item from linked list. + */ +{ + /* ereas back link */ + if( Pback ) + { + if( Pback->Type() != TYPEPCB ) + { + Pback->Pnext = Pnext; + } + else /* Le chainage arriere pointe sur la structure "Pere" */ + { + ( (BOARD*) Pback )->m_Drawings = (BOARD_ITEM*) Pnext; + } + } + + /* erase forward link */ + if( Pnext ) + Pnext->Pback = Pback; + + Pnext = Pback = NULL; +} + + +/*******************************************/ +void DRAWSEGMENT::Copy( DRAWSEGMENT* source ) +/*******************************************/ +{ + m_Type = source->m_Type; + m_Layer = source->m_Layer; + m_Width = source->m_Width; + m_Start = source->m_Start; + m_End = source->m_End; + m_Shape = source->m_Shape; + m_Angle = source->m_Angle; + m_TimeStamp = source->m_TimeStamp; +} + + +bool DRAWSEGMENT::Save( FILE* aFile ) const +{ + if( GetState( DELETED ) ) + return true; + + bool rc = false; + + if( fprintf( aFile, "$DRAWSEGMENT\n" ) != sizeof("$DRAWSEGMENT\n") - 1 ) + goto out; + + fprintf( aFile, "Po %d %d %d %d %d %d\n", + m_Shape, + m_Start.x, m_Start.y, + m_End.x, m_End.y, m_Width ); + + fprintf( aFile, "De %d %d %d %lX %X\n", + m_Layer, m_Type, m_Angle, + m_TimeStamp, ReturnStatus() ); + + if( fprintf( aFile, "$EndDRAWSEGMENT\n" ) != sizeof("$EndDRAWSEGMENT\n") - 1 ) + goto out; + + rc = true; + +out: + return rc; +} + + +/******************************************************************/ +bool DRAWSEGMENT::ReadDrawSegmentDescr( FILE* File, int* LineNum ) +/******************************************************************/ + +/* Read a DRAWSEGMENT from a file + */ +{ + char Line[2048]; + + while( GetLine( File, Line, LineNum ) != NULL ) + { + if( strnicmp( Line, "$End", 4 ) == 0 ) + return TRUE; /* End of description */ + if( Line[0] == 'P' ) + { + sscanf( Line + 2, " %d %d %d %d %d %d", + &m_Shape, &m_Start.x, &m_Start.y, + &m_End.x, &m_End.y, &m_Width ); + if( m_Width < 0 ) + m_Width = 0; + } + + if( Line[0] == 'D' ) + { + int status; + sscanf( Line + 2, " %d %d %d %lX %X", + &m_Layer, &m_Type, &m_Angle, + &m_TimeStamp, &status ); + + if( m_Layer < FIRST_NO_COPPER_LAYER ) + m_Layer = FIRST_NO_COPPER_LAYER; + if( m_Layer > LAST_NO_COPPER_LAYER ) + m_Layer = LAST_NO_COPPER_LAYER; + + SetState( status, ON ); + } + } + + return FALSE; +} + + +// see pcbstruct.h +void DRAWSEGMENT::Display_Infos( WinEDA_DrawFrame* frame ) +{ + int itype; + wxString msg; + + frame->MsgPanel->EraseMsgBox(); + + itype = m_Type & 0x0F; + + msg = wxT( "DRAWING" ); + + Affiche_1_Parametre( frame, 1, _( "Type" ), msg, DARKCYAN ); + + Affiche_1_Parametre( frame, 16, _( "Shape" ), wxEmptyString, RED ); + + if( m_Shape == S_CIRCLE ) + Affiche_1_Parametre( frame, -1, wxEmptyString, _( "Circle" ), RED ); + + else if( m_Shape == S_ARC ) + { + Affiche_1_Parametre( frame, -1, wxEmptyString, _( " Arc " ), RED ); + msg.Printf( wxT( "%d" ), m_Angle ); + Affiche_1_Parametre( frame, 32, wxT( " l.arc " ), msg, RED ); + } + else + Affiche_1_Parametre( frame, -1, wxEmptyString, _( "Segment" ), RED ); + + Affiche_1_Parametre( frame, 48, _( "Layer" ), + ReturnPcbLayerName( m_Layer ), BROWN ); + + valeur_param( (unsigned) m_Width, msg ); + Affiche_1_Parametre( frame, 60, _( "Width" ), msg, DARKCYAN ); +} + + +/** + * Function HitTest + * tests if the given wxPoint is within the bounds of this object. + * @param ref_pos A wxPoint to test + * @return bool - true if a hit, else false + */ +bool DRAWSEGMENT::HitTest( const wxPoint& ref_pos ) +{ + int ux0 = m_Start.x; + int uy0 = m_Start.y; + + /* recalcul des coordonnees avec ux0, uy0 = origine des coordonnees */ + int dx = m_End.x - ux0; + int dy = m_End.y - uy0; + + int spot_cX = ref_pos.x - ux0; + int spot_cY = ref_pos.y - uy0; + + if( m_Shape==S_CIRCLE || m_Shape==S_ARC ) + { + int rayon, dist, stAngle, endAngle, mouseAngle; + + rayon = (int) hypot( (double) (dx), (double) (dy) ); + dist = (int) hypot( (double) (spot_cX), (double) (spot_cY) ); + + if( abs( rayon - dist ) <= (m_Width / 2) ) + { + if( m_Shape == S_CIRCLE ) + return true; + + /* pour un arc, controle complementaire */ + mouseAngle = (int) ArcTangente( spot_cY, spot_cX ); + stAngle = (int) ArcTangente( dy, dx ); + endAngle = stAngle + m_Angle; + + if( endAngle > 3600 ) + { + stAngle -= 3600; + endAngle -= 3600; + } + + if( mouseAngle >= stAngle && mouseAngle <= endAngle ) + return true; + } + } + else + { + if( DistanceTest( m_Width / 2, dx, dy, spot_cX, spot_cY ) ) + return true; + } + return false; +} + + +/** + * Function HitTest (overlayed) + * tests if the given EDA_Rect intersect this object. + * For now, an ending point must be inside this rect. + * @param refArea : the given EDA_Rect + * @return bool - true if a hit, else false + */ +bool DRAWSEGMENT::HitTest( EDA_Rect& refArea ) +{ + if( refArea.Inside( m_Start ) ) + return true; + if( refArea.Inside( m_End ) ) + return true; + return false; +} diff --git a/pcbnew/class_drawsegment.h b/pcbnew/class_drawsegment.h index efaaafbc0c..3669d08e59 100644 --- a/pcbnew/class_drawsegment.h +++ b/pcbnew/class_drawsegment.h @@ -1,91 +1,91 @@ -/*************************************/ -/* class to handle a graphic segment */ -/**************************************/ - -#ifndef CLASS_DRAWSEGMENT_H -#define CLASS_DRAWSEGMENT_H - -class DRAWSEGMENT : public BOARD_ITEM -{ -public: - int m_Width; // 0 = line. if > 0 = tracks, bus ... - wxPoint m_Start; // Line start point - wxPoint m_End; // Line end point - - int m_Shape; // Shape: line, Circle, Arc - int m_Type; // Used in complex associations ( Dimensions.. ) - int m_Angle; // Used only for Arcs: Arc angle in 1/10 deg - -public: - DRAWSEGMENT( BOARD_ITEM* StructFather, KICAD_T idtype = TYPEDRAWSEGMENT ); - ~DRAWSEGMENT(); - - - /** - * Function GetPosition - * returns the position of this object. - * Required by pure virtual BOARD_ITEM::GetPosition() - * @return const wxPoint& - The position of this object. - */ - wxPoint& GetPosition() - { - return m_Start; - } - - - /** - * Function Save - * writes the data structures for this object out to a FILE in "*.brd" format. - * @param aFile The FILE to write to. - * @return bool - true if success writing else false. - */ - bool Save( FILE* aFile ) const; - - bool ReadDrawSegmentDescr( FILE* File, int* LineNum ); - - /* remove this from the linked list */ - void UnLink(); - - void Copy( DRAWSEGMENT* source ); - - - /** - * Function Display_Infos - * has knowledge about the frame and how and where to put status information - * about this object into the frame's message panel. - * Is virtual from EDA_BaseStruct. - * @param frame A WinEDA_BasePcbFrame in which to print status information. - */ - void Display_Infos( WinEDA_DrawFrame* frame ); - - - /** - * Function HitTest - * tests if the given wxPoint is within the bounds of this object. - * @param ref_pos A wxPoint to test - * @return bool - true if a hit, else false - */ - bool HitTest( const wxPoint& ref_pos ); - - /** - * Function HitTest (overlayed) - * tests if the given EDA_Rect intersect this object. - * For now, an ending point must be inside this rect. - * @param refPos the given EDA_Rect to test - * @return bool - true if a hit, else false - */ - bool HitTest( EDA_Rect& refArea ); - - /** - * Function GetClass - * returns the class name. - * @return wxString - */ - wxString GetClass() const - { - return wxT( "DRAWSEGMENT" ); - } -}; - - -#endif // #ifndef CLASS_DRAWSEGMENT_H +/*************************************/ +/* class to handle a graphic segment */ +/**************************************/ + +#ifndef CLASS_DRAWSEGMENT_H +#define CLASS_DRAWSEGMENT_H + +class DRAWSEGMENT : public BOARD_ITEM +{ +public: + int m_Width; // 0 = line. if > 0 = tracks, bus ... + wxPoint m_Start; // Line start point + wxPoint m_End; // Line end point + + int m_Shape; // Shape: line, Circle, Arc + int m_Type; // Used in complex associations ( Dimensions.. ) + int m_Angle; // Used only for Arcs: Arc angle in 1/10 deg + +public: + DRAWSEGMENT( BOARD_ITEM* StructFather, KICAD_T idtype = TYPEDRAWSEGMENT ); + ~DRAWSEGMENT(); + + + /** + * Function GetPosition + * returns the position of this object. + * Required by pure virtual BOARD_ITEM::GetPosition() + * @return const wxPoint& - The position of this object. + */ + wxPoint& GetPosition() + { + return m_Start; + } + + + /** + * Function Save + * writes the data structures for this object out to a FILE in "*.brd" format. + * @param aFile The FILE to write to. + * @return bool - true if success writing else false. + */ + bool Save( FILE* aFile ) const; + + bool ReadDrawSegmentDescr( FILE* File, int* LineNum ); + + /* remove this from the linked list */ + void UnLink(); + + void Copy( DRAWSEGMENT* source ); + + + /** + * Function Display_Infos + * has knowledge about the frame and how and where to put status information + * about this object into the frame's message panel. + * Is virtual from EDA_BaseStruct. + * @param frame A WinEDA_BasePcbFrame in which to print status information. + */ + void Display_Infos( WinEDA_DrawFrame* frame ); + + + /** + * Function HitTest + * tests if the given wxPoint is within the bounds of this object. + * @param ref_pos A wxPoint to test + * @return bool - true if a hit, else false + */ + bool HitTest( const wxPoint& ref_pos ); + + /** + * Function HitTest (overlayed) + * tests if the given EDA_Rect intersect this object. + * For now, an ending point must be inside this rect. + * @param refPos the given EDA_Rect to test + * @return bool - true if a hit, else false + */ + bool HitTest( EDA_Rect& refArea ); + + /** + * Function GetClass + * returns the class name. + * @return wxString + */ + wxString GetClass() const + { + return wxT( "DRAWSEGMENT" ); + } +}; + + +#endif // #ifndef CLASS_DRAWSEGMENT_H diff --git a/pcbnew/dialog_gendrill.cpp b/pcbnew/dialog_gendrill.cpp index 5f356bcb9d..5fadb7122a 100644 --- a/pcbnew/dialog_gendrill.cpp +++ b/pcbnew/dialog_gendrill.cpp @@ -1,385 +1,385 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: dialog_gendrill.cpp -// Purpose: -// Author: jean-pierre Charras -// Modified by: -// Created: 13/01/2008 17:26:27 -// RCS-ID: -// Copyright: License GNU -// Licence: -///////////////////////////////////////////////////////////////////////////// - -// Generated by DialogBlocks (unregistered), 13/01/2008 17:26:27 - -// For compilers that support precompilation, includes "wx/wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ -#pragma hdrstop -#endif - -#ifndef WX_PRECOMP -#include "wx/wx.h" -#endif - -////@begin includes -////@end includes - -#include "dialog_gendrill.h" - -////@begin XPM images -////@end XPM images - - -/*! - * WinEDA_DrillFrame type definition - */ - -IMPLEMENT_DYNAMIC_CLASS( WinEDA_DrillFrame, wxDialog ) - - -/*! - * WinEDA_DrillFrame event table definition - */ - -BEGIN_EVENT_TABLE( WinEDA_DrillFrame, wxDialog ) - -////@begin WinEDA_DrillFrame event table entries - EVT_CLOSE( WinEDA_DrillFrame::OnCloseWindow ) - - EVT_RADIOBOX( ID_SEL_DRILL_UNITS, WinEDA_DrillFrame::OnSelDrillUnitsSelected ) - - EVT_RADIOBOX( ID_SEL_ZEROS_FMT, WinEDA_DrillFrame::OnSelZerosFmtSelected ) - - EVT_BUTTON( wxID_OK, WinEDA_DrillFrame::OnOkClick ) - - EVT_BUTTON( wxID_CLOSE, WinEDA_DrillFrame::OnCloseClick ) - -////@end WinEDA_DrillFrame event table entries - -END_EVENT_TABLE() - - -/*! - * WinEDA_DrillFrame constructors - */ - -WinEDA_DrillFrame::WinEDA_DrillFrame() -{ - Init(); -} - -WinEDA_DrillFrame::WinEDA_DrillFrame( WinEDA_PcbFrame* parent, wxWindowID id, - const wxString& caption, const wxPoint& pos, const wxSize& size, long style ) -{ - m_Parent = parent; - SetFont( *g_DialogFont ); - - SetReturnCode( 1 ); - Init(); - Create(parent, id, caption, pos, size, style); -} - - -/*! - * WinEDA_DrillFrame creator - */ - -bool WinEDA_DrillFrame::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style ) -{ -////@begin WinEDA_DrillFrame creation - SetExtraStyle(wxWS_EX_BLOCK_EVENTS); - wxDialog::Create( parent, id, caption, pos, size, style ); - - CreateControls(); - if (GetSizer()) - { - GetSizer()->SetSizeHints(this); - } - Centre(); -////@end WinEDA_DrillFrame creation - return true; -} - - -/*! - * WinEDA_DrillFrame destructor - */ - -WinEDA_DrillFrame::~WinEDA_DrillFrame() -{ -////@begin WinEDA_DrillFrame destruction -////@end WinEDA_DrillFrame destruction -} - - -/*! - * Member initialisation - */ - -void WinEDA_DrillFrame::Init() -{ -////@begin WinEDA_DrillFrame member initialisation - m_LeftBoxSizer = NULL; - m_Choice_Unit = NULL; - m_Choice_Zeros_Format = NULL; - m_Choice_Precision = NULL; - m_Choice_Drill_Offset = NULL; - m_Choice_Drill_Map = NULL; - m_Choice_Drill_Report = NULL; - m_PenSpeed = NULL; - m_PenNum = NULL; - m_Check_Mirror = NULL; - m_Check_Minimal = NULL; - m_DefaultViasDrillSizer = NULL; - m_ViaDrillValue = NULL; - m_MicroViasDrillSizer = NULL; - m_MicroViaDrillValue = NULL; - m_PadsCountInfoMsg = NULL; - m_ThroughViasInfoMsg = NULL; - m_MicroViasInfoMsg = NULL; - m_BuriedViasInfoMsg = NULL; -////@end WinEDA_DrillFrame member initialisation -} - - -/*! - * Control creation for WinEDA_DrillFrame - */ - -void WinEDA_DrillFrame::CreateControls() -{ -////@begin WinEDA_DrillFrame content construction - // Generated by DialogBlocks, 14/01/2008 08:32:06 (unregistered) - - WinEDA_DrillFrame* itemDialog1 = this; - - wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxHORIZONTAL); - itemDialog1->SetSizer(itemBoxSizer2); - - m_LeftBoxSizer = new wxBoxSizer(wxVERTICAL); - itemBoxSizer2->Add(m_LeftBoxSizer, 0, wxGROW|wxALL, 5); - - wxArrayString m_Choice_UnitStrings; - m_Choice_UnitStrings.Add(_("Millimeters")); - m_Choice_UnitStrings.Add(_("Inches")); - m_Choice_Unit = new wxRadioBox( itemDialog1, ID_SEL_DRILL_UNITS, _("Drill Units:"), wxDefaultPosition, wxDefaultSize, m_Choice_UnitStrings, 1, wxRA_SPECIFY_COLS ); - m_Choice_Unit->SetSelection(0); - m_LeftBoxSizer->Add(m_Choice_Unit, 0, wxGROW|wxALL, 5); - - wxArrayString m_Choice_Zeros_FormatStrings; - m_Choice_Zeros_FormatStrings.Add(_("decimal format")); - m_Choice_Zeros_FormatStrings.Add(_("suppress leading zeros")); - m_Choice_Zeros_FormatStrings.Add(_("suppress trailing zeros")); - m_Choice_Zeros_FormatStrings.Add(_("keep zeros")); - m_Choice_Zeros_Format = new wxRadioBox( itemDialog1, ID_SEL_ZEROS_FMT, _("Zeros Format"), wxDefaultPosition, wxDefaultSize, m_Choice_Zeros_FormatStrings, 1, wxRA_SPECIFY_COLS ); - m_Choice_Zeros_Format->SetSelection(0); - m_LeftBoxSizer->Add(m_Choice_Zeros_Format, 0, wxALIGN_LEFT|wxALL, 5); - - wxArrayString m_Choice_PrecisionStrings; - m_Choice_PrecisionStrings.Add(_("2:3")); - m_Choice_PrecisionStrings.Add(_("2:4")); - m_Choice_Precision = new wxRadioBox( itemDialog1, ID_SEL_PRECISION, _("Precision"), wxDefaultPosition, wxDefaultSize, m_Choice_PrecisionStrings, 1, wxRA_SPECIFY_COLS ); - m_Choice_Precision->SetSelection(0); - m_LeftBoxSizer->Add(m_Choice_Precision, 0, wxGROW|wxALL, 5); - - wxArrayString m_Choice_Drill_OffsetStrings; - m_Choice_Drill_OffsetStrings.Add(_("absolute")); - m_Choice_Drill_OffsetStrings.Add(_("auxiliary axis")); - m_Choice_Drill_Offset = new wxRadioBox( itemDialog1, ID_SEL_DRILL_SHEET, _("Drill Origin:"), wxDefaultPosition, wxDefaultSize, m_Choice_Drill_OffsetStrings, 1, wxRA_SPECIFY_COLS ); - m_Choice_Drill_Offset->SetSelection(0); - m_LeftBoxSizer->Add(m_Choice_Drill_Offset, 0, wxGROW|wxALL, 5); - - wxBoxSizer* itemBoxSizer8 = new wxBoxSizer(wxVERTICAL); - itemBoxSizer2->Add(itemBoxSizer8, 0, wxGROW|wxALL, 5); - - wxArrayString m_Choice_Drill_MapStrings; - m_Choice_Drill_MapStrings.Add(_("None")); - m_Choice_Drill_MapStrings.Add(_("drill sheet (HPGL)")); - m_Choice_Drill_MapStrings.Add(_("drill sheet (PostScript)")); - m_Choice_Drill_Map = new wxRadioBox( itemDialog1, ID_SEL_DRILL_SHEET, _("Drill Sheet:"), wxDefaultPosition, wxDefaultSize, m_Choice_Drill_MapStrings, 1, wxRA_SPECIFY_COLS ); - m_Choice_Drill_Map->SetSelection(0); - itemBoxSizer8->Add(m_Choice_Drill_Map, 0, wxGROW|wxALL, 5); - - wxArrayString m_Choice_Drill_ReportStrings; - m_Choice_Drill_ReportStrings.Add(_("None")); - m_Choice_Drill_ReportStrings.Add(_("Drill report")); - m_Choice_Drill_Report = new wxRadioBox( itemDialog1, ID_SEL_DRILL_REPORT, _("Drill Report:"), wxDefaultPosition, wxDefaultSize, m_Choice_Drill_ReportStrings, 1, wxRA_SPECIFY_COLS ); - m_Choice_Drill_Report->SetSelection(0); - itemBoxSizer8->Add(m_Choice_Drill_Report, 0, wxGROW|wxALL, 5); - - wxStaticBox* itemStaticBoxSizer11Static = new wxStaticBox(itemDialog1, wxID_ANY, _("HPGL plotter Options:")); - wxStaticBoxSizer* itemStaticBoxSizer11 = new wxStaticBoxSizer(itemStaticBoxSizer11Static, wxVERTICAL); - itemBoxSizer8->Add(itemStaticBoxSizer11, 0, wxGROW|wxALL, 5); - - wxStaticText* itemStaticText12 = new wxStaticText( itemDialog1, wxID_STATIC, _("Speed (cm/s)"), wxDefaultPosition, wxDefaultSize, 0 ); - itemStaticBoxSizer11->Add(itemStaticText12, 0, wxGROW|wxLEFT|wxRIGHT|wxTOP, 5); - - m_PenSpeed = new wxTextCtrl( itemDialog1, ID_TEXTCTRL2, _T(""), wxDefaultPosition, wxDefaultSize, 0 ); - itemStaticBoxSizer11->Add(m_PenSpeed, 0, wxGROW|wxLEFT|wxRIGHT|wxBOTTOM, 5); - - wxStaticText* itemStaticText14 = new wxStaticText( itemDialog1, wxID_STATIC, _("Pen Number"), wxDefaultPosition, wxDefaultSize, 0 ); - itemStaticBoxSizer11->Add(itemStaticText14, 0, wxGROW|wxLEFT|wxRIGHT|wxTOP, 5); - - m_PenNum = new wxTextCtrl( itemDialog1, ID_TEXTCTRL, _T(""), wxDefaultPosition, wxDefaultSize, 0 ); - itemStaticBoxSizer11->Add(m_PenNum, 0, wxGROW|wxLEFT|wxRIGHT|wxBOTTOM, 5); - - wxStaticBox* itemStaticBoxSizer16Static = new wxStaticBox(itemDialog1, wxID_ANY, _("Options:")); - wxStaticBoxSizer* itemStaticBoxSizer16 = new wxStaticBoxSizer(itemStaticBoxSizer16Static, wxVERTICAL); - itemStaticBoxSizer11->Add(itemStaticBoxSizer16, 0, wxGROW|wxALL, 5); - - m_Check_Mirror = new wxCheckBox( itemDialog1, ID_CHECKBOX2, _("mirror y axis"), wxDefaultPosition, wxDefaultSize, 0 ); - m_Check_Mirror->SetValue(false); - itemStaticBoxSizer16->Add(m_Check_Mirror, 0, wxGROW|wxALL, 5); - - m_Check_Minimal = new wxCheckBox( itemDialog1, ID_CHECKBOX3, _("minimal header"), wxDefaultPosition, wxDefaultSize, 0 ); - m_Check_Minimal->SetValue(false); - itemStaticBoxSizer16->Add(m_Check_Minimal, 0, wxGROW|wxALL, 5); - - wxBoxSizer* itemBoxSizer19 = new wxBoxSizer(wxVERTICAL); - itemBoxSizer2->Add(itemBoxSizer19, 0, wxGROW|wxALL, 5); - - wxStaticBox* itemStaticBoxSizer20Static = new wxStaticBox(itemDialog1, wxID_ANY, _("Info:")); - wxStaticBoxSizer* itemStaticBoxSizer20 = new wxStaticBoxSizer(itemStaticBoxSizer20Static, wxVERTICAL); - itemBoxSizer19->Add(itemStaticBoxSizer20, 0, wxGROW|wxALL, 5); - - m_DefaultViasDrillSizer = new wxStaticBox(itemDialog1, wxID_ANY, _("Default Vias Drill:")); - wxStaticBoxSizer* itemStaticBoxSizer21 = new wxStaticBoxSizer(m_DefaultViasDrillSizer, wxVERTICAL); - itemStaticBoxSizer20->Add(itemStaticBoxSizer21, 0, wxGROW|wxALL, 5); - - m_ViaDrillValue = new wxStaticText( itemDialog1, wxID_STATIC, _("Via Drill Value"), wxDefaultPosition, wxDefaultSize, 0 ); - itemStaticBoxSizer21->Add(m_ViaDrillValue, 0, wxGROW|wxALL, 5); - - m_MicroViasDrillSizer = new wxStaticBox(itemDialog1, wxID_ANY, _("Micro Vias Drill:")); - wxStaticBoxSizer* itemStaticBoxSizer23 = new wxStaticBoxSizer(m_MicroViasDrillSizer, wxVERTICAL); - itemStaticBoxSizer20->Add(itemStaticBoxSizer23, 0, wxGROW|wxALL, 5); - - m_MicroViaDrillValue = new wxStaticText( itemDialog1, wxID_STATIC, _("Micro Via Drill Value"), wxDefaultPosition, wxDefaultSize, 0 ); - itemStaticBoxSizer23->Add(m_MicroViaDrillValue, 0, wxGROW|wxALL, 5); - - wxStaticBox* itemStaticBoxSizer25Static = new wxStaticBox(itemDialog1, wxID_ANY, _("Holes Count:")); - wxStaticBoxSizer* itemStaticBoxSizer25 = new wxStaticBoxSizer(itemStaticBoxSizer25Static, wxVERTICAL); - itemStaticBoxSizer20->Add(itemStaticBoxSizer25, 0, wxGROW|wxALL, 5); - - m_PadsCountInfoMsg = new wxStaticText( itemDialog1, wxID_STATIC, _("Pads:"), wxDefaultPosition, wxDefaultSize, 0 ); - itemStaticBoxSizer25->Add(m_PadsCountInfoMsg, 0, wxGROW|wxALL, 5); - - m_ThroughViasInfoMsg = new wxStaticText( itemDialog1, wxID_STATIC, _("Through Vias:"), wxDefaultPosition, wxDefaultSize, 0 ); - itemStaticBoxSizer25->Add(m_ThroughViasInfoMsg, 0, wxGROW|wxALL, 5); - - m_MicroViasInfoMsg = new wxStaticText( itemDialog1, wxID_STATIC, _("Micro Vias:"), wxDefaultPosition, wxDefaultSize, 0 ); - itemStaticBoxSizer25->Add(m_MicroViasInfoMsg, 0, wxGROW|wxALL, 5); - - m_BuriedViasInfoMsg = new wxStaticText( itemDialog1, wxID_STATIC, _("Buried Vias:"), wxDefaultPosition, wxDefaultSize, 0 ); - itemStaticBoxSizer25->Add(m_BuriedViasInfoMsg, 0, wxGROW|wxALL, 5); - - itemBoxSizer19->Add(5, 5, 1, wxGROW|wxALL, 5); - - wxButton* itemButton31 = new wxButton( itemDialog1, wxID_OK, _("OK"), wxDefaultPosition, wxDefaultSize, 0 ); - itemButton31->SetForegroundColour(wxColour(156, 1, 5)); - itemBoxSizer19->Add(itemButton31, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); - - wxButton* itemButton32 = new wxButton( itemDialog1, wxID_CLOSE, _("&Close"), wxDefaultPosition, wxDefaultSize, 0 ); - itemButton32->SetForegroundColour(wxColour(16, 1, 205)); - itemBoxSizer19->Add(itemButton32, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); - - // Set validators - m_Choice_Unit->SetValidator( wxGenericValidator(& s_Unit_Drill_is_Inch) ); - m_Choice_Zeros_Format->SetValidator( wxGenericValidator(& s_Zeros_Format) ); - m_Check_Mirror->SetValidator( wxGenericValidator(& Mirror) ); - m_Check_Minimal->SetValidator( wxGenericValidator(& Minimal) ); -////@end WinEDA_DrillFrame content construction - - InitDisplayParams(); -} - - -/*! - * wxEVT_COMMAND_RADIOBOX_SELECTED event handler for ID_RADIOBOX - */ - -void WinEDA_DrillFrame::OnSelDrillUnitsSelected( wxCommandEvent& event ) -{ - UpdatePrecisionOptions(event); -} - - -/*! - * wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK - */ - -void WinEDA_DrillFrame::OnOkClick( wxCommandEvent& event ) -{ - GenDrillFiles(event); -} - - -/*! - * wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CLOSE - */ - -void WinEDA_DrillFrame::OnCloseClick( wxCommandEvent& event ) -{ - UpdateConfig(); /* Save drill options: */ - Close( true ); // true is to force the frame to close -} - - -/*! - * Should we show tooltips? - */ - -bool WinEDA_DrillFrame::ShowToolTips() -{ - return true; -} - -/*! - * Get bitmap resources - */ - -wxBitmap WinEDA_DrillFrame::GetBitmapResource( const wxString& name ) -{ - // Bitmap retrieval -////@begin WinEDA_DrillFrame bitmap retrieval - wxUnusedVar(name); - return wxNullBitmap; -////@end WinEDA_DrillFrame bitmap retrieval -} - -/*! - * Get icon resources - */ - -wxIcon WinEDA_DrillFrame::GetIconResource( const wxString& name ) -{ - // Icon retrieval -////@begin WinEDA_DrillFrame icon retrieval - wxUnusedVar(name); - return wxNullIcon; -////@end WinEDA_DrillFrame icon retrieval -} - - -/*! - * wxEVT_COMMAND_RADIOBOX_SELECTED event handler for ID_SEL_ZEROS_FMT - */ - -void WinEDA_DrillFrame::OnSelZerosFmtSelected( wxCommandEvent& event ) -{ - UpdatePrecisionOptions(event); -} - - -/*! - * wxEVT_CLOSE_WINDOW event handler for ID_WINEDA_DRILLFRAME - */ - -void WinEDA_DrillFrame::OnCloseWindow( wxCloseEvent& event ) -{ -////@begin wxEVT_CLOSE_WINDOW event handler for ID_WINEDA_DRILLFRAME in WinEDA_DrillFrame. - // Before editing this code, remove the block markers. - event.Skip(); -////@end wxEVT_CLOSE_WINDOW event handler for ID_WINEDA_DRILLFRAME in WinEDA_DrillFrame. -} - +///////////////////////////////////////////////////////////////////////////// +// Name: dialog_gendrill.cpp +// Purpose: +// Author: jean-pierre Charras +// Modified by: +// Created: 13/01/2008 17:26:27 +// RCS-ID: +// Copyright: License GNU +// Licence: +///////////////////////////////////////////////////////////////////////////// + +// Generated by DialogBlocks (unregistered), 13/01/2008 17:26:27 + +// For compilers that support precompilation, includes "wx/wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ +#pragma hdrstop +#endif + +#ifndef WX_PRECOMP +#include "wx/wx.h" +#endif + +////@begin includes +////@end includes + +#include "dialog_gendrill.h" + +////@begin XPM images +////@end XPM images + + +/*! + * WinEDA_DrillFrame type definition + */ + +IMPLEMENT_DYNAMIC_CLASS( WinEDA_DrillFrame, wxDialog ) + + +/*! + * WinEDA_DrillFrame event table definition + */ + +BEGIN_EVENT_TABLE( WinEDA_DrillFrame, wxDialog ) + +////@begin WinEDA_DrillFrame event table entries + EVT_CLOSE( WinEDA_DrillFrame::OnCloseWindow ) + + EVT_RADIOBOX( ID_SEL_DRILL_UNITS, WinEDA_DrillFrame::OnSelDrillUnitsSelected ) + + EVT_RADIOBOX( ID_SEL_ZEROS_FMT, WinEDA_DrillFrame::OnSelZerosFmtSelected ) + + EVT_BUTTON( wxID_OK, WinEDA_DrillFrame::OnOkClick ) + + EVT_BUTTON( wxID_CLOSE, WinEDA_DrillFrame::OnCloseClick ) + +////@end WinEDA_DrillFrame event table entries + +END_EVENT_TABLE() + + +/*! + * WinEDA_DrillFrame constructors + */ + +WinEDA_DrillFrame::WinEDA_DrillFrame() +{ + Init(); +} + +WinEDA_DrillFrame::WinEDA_DrillFrame( WinEDA_PcbFrame* parent, wxWindowID id, + const wxString& caption, const wxPoint& pos, const wxSize& size, long style ) +{ + m_Parent = parent; + SetFont( *g_DialogFont ); + + SetReturnCode( 1 ); + Init(); + Create(parent, id, caption, pos, size, style); +} + + +/*! + * WinEDA_DrillFrame creator + */ + +bool WinEDA_DrillFrame::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style ) +{ +////@begin WinEDA_DrillFrame creation + SetExtraStyle(wxWS_EX_BLOCK_EVENTS); + wxDialog::Create( parent, id, caption, pos, size, style ); + + CreateControls(); + if (GetSizer()) + { + GetSizer()->SetSizeHints(this); + } + Centre(); +////@end WinEDA_DrillFrame creation + return true; +} + + +/*! + * WinEDA_DrillFrame destructor + */ + +WinEDA_DrillFrame::~WinEDA_DrillFrame() +{ +////@begin WinEDA_DrillFrame destruction +////@end WinEDA_DrillFrame destruction +} + + +/*! + * Member initialisation + */ + +void WinEDA_DrillFrame::Init() +{ +////@begin WinEDA_DrillFrame member initialisation + m_LeftBoxSizer = NULL; + m_Choice_Unit = NULL; + m_Choice_Zeros_Format = NULL; + m_Choice_Precision = NULL; + m_Choice_Drill_Offset = NULL; + m_Choice_Drill_Map = NULL; + m_Choice_Drill_Report = NULL; + m_PenSpeed = NULL; + m_PenNum = NULL; + m_Check_Mirror = NULL; + m_Check_Minimal = NULL; + m_DefaultViasDrillSizer = NULL; + m_ViaDrillValue = NULL; + m_MicroViasDrillSizer = NULL; + m_MicroViaDrillValue = NULL; + m_PadsCountInfoMsg = NULL; + m_ThroughViasInfoMsg = NULL; + m_MicroViasInfoMsg = NULL; + m_BuriedViasInfoMsg = NULL; +////@end WinEDA_DrillFrame member initialisation +} + + +/*! + * Control creation for WinEDA_DrillFrame + */ + +void WinEDA_DrillFrame::CreateControls() +{ +////@begin WinEDA_DrillFrame content construction + // Generated by DialogBlocks, 14/01/2008 08:32:06 (unregistered) + + WinEDA_DrillFrame* itemDialog1 = this; + + wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxHORIZONTAL); + itemDialog1->SetSizer(itemBoxSizer2); + + m_LeftBoxSizer = new wxBoxSizer(wxVERTICAL); + itemBoxSizer2->Add(m_LeftBoxSizer, 0, wxGROW|wxALL, 5); + + wxArrayString m_Choice_UnitStrings; + m_Choice_UnitStrings.Add(_("Millimeters")); + m_Choice_UnitStrings.Add(_("Inches")); + m_Choice_Unit = new wxRadioBox( itemDialog1, ID_SEL_DRILL_UNITS, _("Drill Units:"), wxDefaultPosition, wxDefaultSize, m_Choice_UnitStrings, 1, wxRA_SPECIFY_COLS ); + m_Choice_Unit->SetSelection(0); + m_LeftBoxSizer->Add(m_Choice_Unit, 0, wxGROW|wxALL, 5); + + wxArrayString m_Choice_Zeros_FormatStrings; + m_Choice_Zeros_FormatStrings.Add(_("decimal format")); + m_Choice_Zeros_FormatStrings.Add(_("suppress leading zeros")); + m_Choice_Zeros_FormatStrings.Add(_("suppress trailing zeros")); + m_Choice_Zeros_FormatStrings.Add(_("keep zeros")); + m_Choice_Zeros_Format = new wxRadioBox( itemDialog1, ID_SEL_ZEROS_FMT, _("Zeros Format"), wxDefaultPosition, wxDefaultSize, m_Choice_Zeros_FormatStrings, 1, wxRA_SPECIFY_COLS ); + m_Choice_Zeros_Format->SetSelection(0); + m_LeftBoxSizer->Add(m_Choice_Zeros_Format, 0, wxALIGN_LEFT|wxALL, 5); + + wxArrayString m_Choice_PrecisionStrings; + m_Choice_PrecisionStrings.Add(_("2:3")); + m_Choice_PrecisionStrings.Add(_("2:4")); + m_Choice_Precision = new wxRadioBox( itemDialog1, ID_SEL_PRECISION, _("Precision"), wxDefaultPosition, wxDefaultSize, m_Choice_PrecisionStrings, 1, wxRA_SPECIFY_COLS ); + m_Choice_Precision->SetSelection(0); + m_LeftBoxSizer->Add(m_Choice_Precision, 0, wxGROW|wxALL, 5); + + wxArrayString m_Choice_Drill_OffsetStrings; + m_Choice_Drill_OffsetStrings.Add(_("absolute")); + m_Choice_Drill_OffsetStrings.Add(_("auxiliary axis")); + m_Choice_Drill_Offset = new wxRadioBox( itemDialog1, ID_SEL_DRILL_SHEET, _("Drill Origin:"), wxDefaultPosition, wxDefaultSize, m_Choice_Drill_OffsetStrings, 1, wxRA_SPECIFY_COLS ); + m_Choice_Drill_Offset->SetSelection(0); + m_LeftBoxSizer->Add(m_Choice_Drill_Offset, 0, wxGROW|wxALL, 5); + + wxBoxSizer* itemBoxSizer8 = new wxBoxSizer(wxVERTICAL); + itemBoxSizer2->Add(itemBoxSizer8, 0, wxGROW|wxALL, 5); + + wxArrayString m_Choice_Drill_MapStrings; + m_Choice_Drill_MapStrings.Add(_("None")); + m_Choice_Drill_MapStrings.Add(_("drill sheet (HPGL)")); + m_Choice_Drill_MapStrings.Add(_("drill sheet (PostScript)")); + m_Choice_Drill_Map = new wxRadioBox( itemDialog1, ID_SEL_DRILL_SHEET, _("Drill Sheet:"), wxDefaultPosition, wxDefaultSize, m_Choice_Drill_MapStrings, 1, wxRA_SPECIFY_COLS ); + m_Choice_Drill_Map->SetSelection(0); + itemBoxSizer8->Add(m_Choice_Drill_Map, 0, wxGROW|wxALL, 5); + + wxArrayString m_Choice_Drill_ReportStrings; + m_Choice_Drill_ReportStrings.Add(_("None")); + m_Choice_Drill_ReportStrings.Add(_("Drill report")); + m_Choice_Drill_Report = new wxRadioBox( itemDialog1, ID_SEL_DRILL_REPORT, _("Drill Report:"), wxDefaultPosition, wxDefaultSize, m_Choice_Drill_ReportStrings, 1, wxRA_SPECIFY_COLS ); + m_Choice_Drill_Report->SetSelection(0); + itemBoxSizer8->Add(m_Choice_Drill_Report, 0, wxGROW|wxALL, 5); + + wxStaticBox* itemStaticBoxSizer11Static = new wxStaticBox(itemDialog1, wxID_ANY, _("HPGL plotter Options:")); + wxStaticBoxSizer* itemStaticBoxSizer11 = new wxStaticBoxSizer(itemStaticBoxSizer11Static, wxVERTICAL); + itemBoxSizer8->Add(itemStaticBoxSizer11, 0, wxGROW|wxALL, 5); + + wxStaticText* itemStaticText12 = new wxStaticText( itemDialog1, wxID_STATIC, _("Speed (cm/s)"), wxDefaultPosition, wxDefaultSize, 0 ); + itemStaticBoxSizer11->Add(itemStaticText12, 0, wxGROW|wxLEFT|wxRIGHT|wxTOP, 5); + + m_PenSpeed = new wxTextCtrl( itemDialog1, ID_TEXTCTRL2, _T(""), wxDefaultPosition, wxDefaultSize, 0 ); + itemStaticBoxSizer11->Add(m_PenSpeed, 0, wxGROW|wxLEFT|wxRIGHT|wxBOTTOM, 5); + + wxStaticText* itemStaticText14 = new wxStaticText( itemDialog1, wxID_STATIC, _("Pen Number"), wxDefaultPosition, wxDefaultSize, 0 ); + itemStaticBoxSizer11->Add(itemStaticText14, 0, wxGROW|wxLEFT|wxRIGHT|wxTOP, 5); + + m_PenNum = new wxTextCtrl( itemDialog1, ID_TEXTCTRL, _T(""), wxDefaultPosition, wxDefaultSize, 0 ); + itemStaticBoxSizer11->Add(m_PenNum, 0, wxGROW|wxLEFT|wxRIGHT|wxBOTTOM, 5); + + wxStaticBox* itemStaticBoxSizer16Static = new wxStaticBox(itemDialog1, wxID_ANY, _("Options:")); + wxStaticBoxSizer* itemStaticBoxSizer16 = new wxStaticBoxSizer(itemStaticBoxSizer16Static, wxVERTICAL); + itemStaticBoxSizer11->Add(itemStaticBoxSizer16, 0, wxGROW|wxALL, 5); + + m_Check_Mirror = new wxCheckBox( itemDialog1, ID_CHECKBOX2, _("mirror y axis"), wxDefaultPosition, wxDefaultSize, 0 ); + m_Check_Mirror->SetValue(false); + itemStaticBoxSizer16->Add(m_Check_Mirror, 0, wxGROW|wxALL, 5); + + m_Check_Minimal = new wxCheckBox( itemDialog1, ID_CHECKBOX3, _("minimal header"), wxDefaultPosition, wxDefaultSize, 0 ); + m_Check_Minimal->SetValue(false); + itemStaticBoxSizer16->Add(m_Check_Minimal, 0, wxGROW|wxALL, 5); + + wxBoxSizer* itemBoxSizer19 = new wxBoxSizer(wxVERTICAL); + itemBoxSizer2->Add(itemBoxSizer19, 0, wxGROW|wxALL, 5); + + wxStaticBox* itemStaticBoxSizer20Static = new wxStaticBox(itemDialog1, wxID_ANY, _("Info:")); + wxStaticBoxSizer* itemStaticBoxSizer20 = new wxStaticBoxSizer(itemStaticBoxSizer20Static, wxVERTICAL); + itemBoxSizer19->Add(itemStaticBoxSizer20, 0, wxGROW|wxALL, 5); + + m_DefaultViasDrillSizer = new wxStaticBox(itemDialog1, wxID_ANY, _("Default Vias Drill:")); + wxStaticBoxSizer* itemStaticBoxSizer21 = new wxStaticBoxSizer(m_DefaultViasDrillSizer, wxVERTICAL); + itemStaticBoxSizer20->Add(itemStaticBoxSizer21, 0, wxGROW|wxALL, 5); + + m_ViaDrillValue = new wxStaticText( itemDialog1, wxID_STATIC, _("Via Drill Value"), wxDefaultPosition, wxDefaultSize, 0 ); + itemStaticBoxSizer21->Add(m_ViaDrillValue, 0, wxGROW|wxALL, 5); + + m_MicroViasDrillSizer = new wxStaticBox(itemDialog1, wxID_ANY, _("Micro Vias Drill:")); + wxStaticBoxSizer* itemStaticBoxSizer23 = new wxStaticBoxSizer(m_MicroViasDrillSizer, wxVERTICAL); + itemStaticBoxSizer20->Add(itemStaticBoxSizer23, 0, wxGROW|wxALL, 5); + + m_MicroViaDrillValue = new wxStaticText( itemDialog1, wxID_STATIC, _("Micro Via Drill Value"), wxDefaultPosition, wxDefaultSize, 0 ); + itemStaticBoxSizer23->Add(m_MicroViaDrillValue, 0, wxGROW|wxALL, 5); + + wxStaticBox* itemStaticBoxSizer25Static = new wxStaticBox(itemDialog1, wxID_ANY, _("Holes Count:")); + wxStaticBoxSizer* itemStaticBoxSizer25 = new wxStaticBoxSizer(itemStaticBoxSizer25Static, wxVERTICAL); + itemStaticBoxSizer20->Add(itemStaticBoxSizer25, 0, wxGROW|wxALL, 5); + + m_PadsCountInfoMsg = new wxStaticText( itemDialog1, wxID_STATIC, _("Pads:"), wxDefaultPosition, wxDefaultSize, 0 ); + itemStaticBoxSizer25->Add(m_PadsCountInfoMsg, 0, wxGROW|wxALL, 5); + + m_ThroughViasInfoMsg = new wxStaticText( itemDialog1, wxID_STATIC, _("Through Vias:"), wxDefaultPosition, wxDefaultSize, 0 ); + itemStaticBoxSizer25->Add(m_ThroughViasInfoMsg, 0, wxGROW|wxALL, 5); + + m_MicroViasInfoMsg = new wxStaticText( itemDialog1, wxID_STATIC, _("Micro Vias:"), wxDefaultPosition, wxDefaultSize, 0 ); + itemStaticBoxSizer25->Add(m_MicroViasInfoMsg, 0, wxGROW|wxALL, 5); + + m_BuriedViasInfoMsg = new wxStaticText( itemDialog1, wxID_STATIC, _("Buried Vias:"), wxDefaultPosition, wxDefaultSize, 0 ); + itemStaticBoxSizer25->Add(m_BuriedViasInfoMsg, 0, wxGROW|wxALL, 5); + + itemBoxSizer19->Add(5, 5, 1, wxGROW|wxALL, 5); + + wxButton* itemButton31 = new wxButton( itemDialog1, wxID_OK, _("OK"), wxDefaultPosition, wxDefaultSize, 0 ); + itemButton31->SetForegroundColour(wxColour(156, 1, 5)); + itemBoxSizer19->Add(itemButton31, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); + + wxButton* itemButton32 = new wxButton( itemDialog1, wxID_CLOSE, _("&Close"), wxDefaultPosition, wxDefaultSize, 0 ); + itemButton32->SetForegroundColour(wxColour(16, 1, 205)); + itemBoxSizer19->Add(itemButton32, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); + + // Set validators + m_Choice_Unit->SetValidator( wxGenericValidator(& s_Unit_Drill_is_Inch) ); + m_Choice_Zeros_Format->SetValidator( wxGenericValidator(& s_Zeros_Format) ); + m_Check_Mirror->SetValidator( wxGenericValidator(& Mirror) ); + m_Check_Minimal->SetValidator( wxGenericValidator(& Minimal) ); +////@end WinEDA_DrillFrame content construction + + InitDisplayParams(); +} + + +/*! + * wxEVT_COMMAND_RADIOBOX_SELECTED event handler for ID_RADIOBOX + */ + +void WinEDA_DrillFrame::OnSelDrillUnitsSelected( wxCommandEvent& event ) +{ + UpdatePrecisionOptions(event); +} + + +/*! + * wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK + */ + +void WinEDA_DrillFrame::OnOkClick( wxCommandEvent& event ) +{ + GenDrillFiles(event); +} + + +/*! + * wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CLOSE + */ + +void WinEDA_DrillFrame::OnCloseClick( wxCommandEvent& event ) +{ + UpdateConfig(); /* Save drill options: */ + Close( true ); // true is to force the frame to close +} + + +/*! + * Should we show tooltips? + */ + +bool WinEDA_DrillFrame::ShowToolTips() +{ + return true; +} + +/*! + * Get bitmap resources + */ + +wxBitmap WinEDA_DrillFrame::GetBitmapResource( const wxString& name ) +{ + // Bitmap retrieval +////@begin WinEDA_DrillFrame bitmap retrieval + wxUnusedVar(name); + return wxNullBitmap; +////@end WinEDA_DrillFrame bitmap retrieval +} + +/*! + * Get icon resources + */ + +wxIcon WinEDA_DrillFrame::GetIconResource( const wxString& name ) +{ + // Icon retrieval +////@begin WinEDA_DrillFrame icon retrieval + wxUnusedVar(name); + return wxNullIcon; +////@end WinEDA_DrillFrame icon retrieval +} + + +/*! + * wxEVT_COMMAND_RADIOBOX_SELECTED event handler for ID_SEL_ZEROS_FMT + */ + +void WinEDA_DrillFrame::OnSelZerosFmtSelected( wxCommandEvent& event ) +{ + UpdatePrecisionOptions(event); +} + + +/*! + * wxEVT_CLOSE_WINDOW event handler for ID_WINEDA_DRILLFRAME + */ + +void WinEDA_DrillFrame::OnCloseWindow( wxCloseEvent& event ) +{ +////@begin wxEVT_CLOSE_WINDOW event handler for ID_WINEDA_DRILLFRAME in WinEDA_DrillFrame. + // Before editing this code, remove the block markers. + event.Skip(); +////@end wxEVT_CLOSE_WINDOW event handler for ID_WINEDA_DRILLFRAME in WinEDA_DrillFrame. +} + diff --git a/pcbnew/dialog_gendrill.h b/pcbnew/dialog_gendrill.h index 08821b8035..f619cd3a08 100644 --- a/pcbnew/dialog_gendrill.h +++ b/pcbnew/dialog_gendrill.h @@ -1,163 +1,163 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: dialog_gendrill.h -// Purpose: -// Author: jean-pierre Charras -// Modified by: -// Created: 13/01/2008 17:26:27 -// RCS-ID: -// Copyright: License GNU -// Licence: -///////////////////////////////////////////////////////////////////////////// - -// Generated by DialogBlocks (unregistered), 13/01/2008 17:26:27 - -#ifndef _DIALOG_GENDRILL_H_ -#define _DIALOG_GENDRILL_H_ - - -/*! - * Includes - */ - -////@begin includes -#include "wx/valgen.h" -////@end includes - -/*! - * Forward declarations - */ - -////@begin forward declarations -class wxBoxSizer; -////@end forward declarations - -/*! - * Control identifiers - */ - -////@begin control identifiers -#define ID_WINEDA_DRILLFRAME 10000 -#define ID_SEL_DRILL_UNITS 10002 -#define ID_SEL_ZEROS_FMT 10001 -#define ID_SEL_PRECISION 10003 -#define ID_SEL_DRILL_SHEET 10004 -#define ID_SEL_DRILL_REPORT 10010 -#define ID_TEXTCTRL2 10007 -#define ID_TEXTCTRL 10006 -#define ID_CHECKBOX2 10011 -#define ID_CHECKBOX3 10012 -#define SYMBOL_WINEDA_DRILLFRAME_STYLE wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCLOSE_BOX|wxTAB_TRAVERSAL -#define SYMBOL_WINEDA_DRILLFRAME_TITLE _("WinEDA_DrillFrame") -#define SYMBOL_WINEDA_DRILLFRAME_IDNAME ID_WINEDA_DRILLFRAME -#define SYMBOL_WINEDA_DRILLFRAME_SIZE wxSize(400, 300) -#define SYMBOL_WINEDA_DRILLFRAME_POSITION wxDefaultPosition -////@end control identifiers - - -/*! - * WinEDA_DrillFrame class declaration - */ - -class WinEDA_DrillFrame: public wxDialog -{ - DECLARE_DYNAMIC_CLASS( WinEDA_DrillFrame ) - DECLARE_EVENT_TABLE() - -public: - /// Constructors - WinEDA_DrillFrame(); - WinEDA_DrillFrame( WinEDA_PcbFrame* parent, - wxWindowID id = SYMBOL_WINEDA_DRILLFRAME_IDNAME, - const wxString& caption = SYMBOL_WINEDA_DRILLFRAME_TITLE, - const wxPoint& pos = SYMBOL_WINEDA_DRILLFRAME_POSITION, - const wxSize& size = SYMBOL_WINEDA_DRILLFRAME_SIZE, - long style = SYMBOL_WINEDA_DRILLFRAME_STYLE ); - - /// Creation - bool Create( wxWindow* parent, wxWindowID id = SYMBOL_WINEDA_DRILLFRAME_IDNAME, const wxString& caption = SYMBOL_WINEDA_DRILLFRAME_TITLE, const wxPoint& pos = SYMBOL_WINEDA_DRILLFRAME_POSITION, const wxSize& size = SYMBOL_WINEDA_DRILLFRAME_SIZE, long style = SYMBOL_WINEDA_DRILLFRAME_STYLE ); - - /// Destructor - ~WinEDA_DrillFrame(); - - /// Initialises member variables - void Init(); - - /// Creates the controls and sizers - void CreateControls(); - -////@begin WinEDA_DrillFrame event handler declarations - - /// wxEVT_CLOSE_WINDOW event handler for ID_WINEDA_DRILLFRAME - void OnCloseWindow( wxCloseEvent& event ); - - /// wxEVT_COMMAND_RADIOBOX_SELECTED event handler for ID_SEL_DRILL_UNITS - void OnSelDrillUnitsSelected( wxCommandEvent& event ); - - /// wxEVT_COMMAND_RADIOBOX_SELECTED event handler for ID_SEL_ZEROS_FMT - void OnSelZerosFmtSelected( wxCommandEvent& event ); - - /// wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK - void OnOkClick( wxCommandEvent& event ); - - /// wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CLOSE - void OnCloseClick( wxCommandEvent& event ); - -////@end WinEDA_DrillFrame event handler declarations - -////@begin WinEDA_DrillFrame member function declarations - - /// Retrieves bitmap resources - wxBitmap GetBitmapResource( const wxString& name ); - - /// Retrieves icon resources - wxIcon GetIconResource( const wxString& name ); -////@end WinEDA_DrillFrame member function declarations - - /// Should we show tooltips? - static bool ShowToolTips(); - -////@begin WinEDA_DrillFrame member variables - wxBoxSizer* m_LeftBoxSizer; - wxRadioBox* m_Choice_Unit; - wxRadioBox* m_Choice_Zeros_Format; - wxRadioBox* m_Choice_Precision; - wxRadioBox* m_Choice_Drill_Offset; - wxRadioBox* m_Choice_Drill_Map; - wxRadioBox* m_Choice_Drill_Report; - wxTextCtrl* m_PenSpeed; - wxTextCtrl* m_PenNum; - wxCheckBox* m_Check_Mirror; - wxCheckBox* m_Check_Minimal; - wxStaticBox* m_DefaultViasDrillSizer; - wxStaticText* m_ViaDrillValue; - wxStaticBox* m_MicroViasDrillSizer; - wxStaticText* m_MicroViaDrillValue; - wxStaticText* m_PadsCountInfoMsg; - wxStaticText* m_ThroughViasInfoMsg; - wxStaticText* m_MicroViasInfoMsg; - wxStaticText* m_BuriedViasInfoMsg; -////@end WinEDA_DrillFrame member variables - -private: - WinEDA_PcbFrame* m_Parent; - int m_PadsHoleCount; - int m_ThroughViasCount; - int m_MicroViasCount; - int m_BlindOrBuriedViasCount; - -private: - void InitDisplayParams(void); - void SetParams(void); - void GenDrillFiles( wxCommandEvent& event ); - void GenDrillMap( int format ); - void UpdatePrecisionOptions( wxCommandEvent& event ); - void UpdateConfig(); - int Plot_Drill_PcbMap( DRILL_TOOL* buffer, int format ); - void GenDrillReport(); - int Gen_Liste_Forets( DRILL_TOOL* buffer, bool print_header ); - int Create_Drill_File_EXCELLON( DRILL_TOOL* buffer ); - void Init_Drill(); -}; - -#endif - // _DIALOG_GENDRILL_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: dialog_gendrill.h +// Purpose: +// Author: jean-pierre Charras +// Modified by: +// Created: 13/01/2008 17:26:27 +// RCS-ID: +// Copyright: License GNU +// Licence: +///////////////////////////////////////////////////////////////////////////// + +// Generated by DialogBlocks (unregistered), 13/01/2008 17:26:27 + +#ifndef _DIALOG_GENDRILL_H_ +#define _DIALOG_GENDRILL_H_ + + +/*! + * Includes + */ + +////@begin includes +#include "wx/valgen.h" +////@end includes + +/*! + * Forward declarations + */ + +////@begin forward declarations +class wxBoxSizer; +////@end forward declarations + +/*! + * Control identifiers + */ + +////@begin control identifiers +#define ID_WINEDA_DRILLFRAME 10000 +#define ID_SEL_DRILL_UNITS 10002 +#define ID_SEL_ZEROS_FMT 10001 +#define ID_SEL_PRECISION 10003 +#define ID_SEL_DRILL_SHEET 10004 +#define ID_SEL_DRILL_REPORT 10010 +#define ID_TEXTCTRL2 10007 +#define ID_TEXTCTRL 10006 +#define ID_CHECKBOX2 10011 +#define ID_CHECKBOX3 10012 +#define SYMBOL_WINEDA_DRILLFRAME_STYLE wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCLOSE_BOX|wxTAB_TRAVERSAL +#define SYMBOL_WINEDA_DRILLFRAME_TITLE _("WinEDA_DrillFrame") +#define SYMBOL_WINEDA_DRILLFRAME_IDNAME ID_WINEDA_DRILLFRAME +#define SYMBOL_WINEDA_DRILLFRAME_SIZE wxSize(400, 300) +#define SYMBOL_WINEDA_DRILLFRAME_POSITION wxDefaultPosition +////@end control identifiers + + +/*! + * WinEDA_DrillFrame class declaration + */ + +class WinEDA_DrillFrame: public wxDialog +{ + DECLARE_DYNAMIC_CLASS( WinEDA_DrillFrame ) + DECLARE_EVENT_TABLE() + +public: + /// Constructors + WinEDA_DrillFrame(); + WinEDA_DrillFrame( WinEDA_PcbFrame* parent, + wxWindowID id = SYMBOL_WINEDA_DRILLFRAME_IDNAME, + const wxString& caption = SYMBOL_WINEDA_DRILLFRAME_TITLE, + const wxPoint& pos = SYMBOL_WINEDA_DRILLFRAME_POSITION, + const wxSize& size = SYMBOL_WINEDA_DRILLFRAME_SIZE, + long style = SYMBOL_WINEDA_DRILLFRAME_STYLE ); + + /// Creation + bool Create( wxWindow* parent, wxWindowID id = SYMBOL_WINEDA_DRILLFRAME_IDNAME, const wxString& caption = SYMBOL_WINEDA_DRILLFRAME_TITLE, const wxPoint& pos = SYMBOL_WINEDA_DRILLFRAME_POSITION, const wxSize& size = SYMBOL_WINEDA_DRILLFRAME_SIZE, long style = SYMBOL_WINEDA_DRILLFRAME_STYLE ); + + /// Destructor + ~WinEDA_DrillFrame(); + + /// Initialises member variables + void Init(); + + /// Creates the controls and sizers + void CreateControls(); + +////@begin WinEDA_DrillFrame event handler declarations + + /// wxEVT_CLOSE_WINDOW event handler for ID_WINEDA_DRILLFRAME + void OnCloseWindow( wxCloseEvent& event ); + + /// wxEVT_COMMAND_RADIOBOX_SELECTED event handler for ID_SEL_DRILL_UNITS + void OnSelDrillUnitsSelected( wxCommandEvent& event ); + + /// wxEVT_COMMAND_RADIOBOX_SELECTED event handler for ID_SEL_ZEROS_FMT + void OnSelZerosFmtSelected( wxCommandEvent& event ); + + /// wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK + void OnOkClick( wxCommandEvent& event ); + + /// wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CLOSE + void OnCloseClick( wxCommandEvent& event ); + +////@end WinEDA_DrillFrame event handler declarations + +////@begin WinEDA_DrillFrame member function declarations + + /// Retrieves bitmap resources + wxBitmap GetBitmapResource( const wxString& name ); + + /// Retrieves icon resources + wxIcon GetIconResource( const wxString& name ); +////@end WinEDA_DrillFrame member function declarations + + /// Should we show tooltips? + static bool ShowToolTips(); + +////@begin WinEDA_DrillFrame member variables + wxBoxSizer* m_LeftBoxSizer; + wxRadioBox* m_Choice_Unit; + wxRadioBox* m_Choice_Zeros_Format; + wxRadioBox* m_Choice_Precision; + wxRadioBox* m_Choice_Drill_Offset; + wxRadioBox* m_Choice_Drill_Map; + wxRadioBox* m_Choice_Drill_Report; + wxTextCtrl* m_PenSpeed; + wxTextCtrl* m_PenNum; + wxCheckBox* m_Check_Mirror; + wxCheckBox* m_Check_Minimal; + wxStaticBox* m_DefaultViasDrillSizer; + wxStaticText* m_ViaDrillValue; + wxStaticBox* m_MicroViasDrillSizer; + wxStaticText* m_MicroViaDrillValue; + wxStaticText* m_PadsCountInfoMsg; + wxStaticText* m_ThroughViasInfoMsg; + wxStaticText* m_MicroViasInfoMsg; + wxStaticText* m_BuriedViasInfoMsg; +////@end WinEDA_DrillFrame member variables + +private: + WinEDA_PcbFrame* m_Parent; + int m_PadsHoleCount; + int m_ThroughViasCount; + int m_MicroViasCount; + int m_BlindOrBuriedViasCount; + +private: + void InitDisplayParams(void); + void SetParams(void); + void GenDrillFiles( wxCommandEvent& event ); + void GenDrillMap( int format ); + void UpdatePrecisionOptions( wxCommandEvent& event ); + void UpdateConfig(); + int Plot_Drill_PcbMap( DRILL_TOOL* buffer, int format ); + void GenDrillReport(); + int Gen_Liste_Forets( DRILL_TOOL* buffer, bool print_header ); + int Create_Drill_File_EXCELLON( DRILL_TOOL* buffer ); + void Init_Drill(); +}; + +#endif + // _DIALOG_GENDRILL_H_