2009-11-09 14:00:22 +00:00
|
|
|
/************************/
|
|
|
|
/* File options.cpp */
|
|
|
|
/************************/
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
|
|
/*
|
2009-11-22 20:55:05 +00:00
|
|
|
* Set some general options of Gerbview
|
2007-09-25 06:15:54 +00:00
|
|
|
*/
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
|
|
|
|
|
|
#include "fctsys.h"
|
|
|
|
#include "common.h"
|
2009-02-04 15:25:03 +00:00
|
|
|
#include "class_drawpanel.h"
|
|
|
|
#include "confirm.h"
|
|
|
|
|
2007-05-06 16:03:28 +00:00
|
|
|
#include "pcbplot.h"
|
2009-09-22 12:27:57 +00:00
|
|
|
#include "gerbview.h"
|
2007-05-06 16:03:28 +00:00
|
|
|
#include "protos.h"
|
2009-09-22 12:27:57 +00:00
|
|
|
|
2010-02-03 14:05:17 +00:00
|
|
|
#include "gerbview_id.h"
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
|
|
|
2007-11-02 09:58:42 +00:00
|
|
|
/** Function OnSelectOptionToolbar
|
|
|
|
* called to validate current choices
|
|
|
|
*/
|
2009-11-09 14:00:22 +00:00
|
|
|
void WinEDA_GerberFrame::OnSelectOptionToolbar( wxCommandEvent& event )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2009-02-04 15:25:03 +00:00
|
|
|
int id = event.GetId();
|
2010-02-03 14:05:17 +00:00
|
|
|
bool state;
|
|
|
|
switch( id )
|
|
|
|
{
|
|
|
|
case ID_MENU_GERBVIEW_SHOW_HIDE_LAYERS_MANAGER_DIALOG:
|
|
|
|
state = ! m_show_layer_manager_tools;
|
|
|
|
id = ID_TB_OPTIONS_SHOW_LAYERS_MANAGER_VERTICAL_TOOLBAR;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
state = m_OptionsToolBar->GetToolState( id );
|
|
|
|
break;
|
|
|
|
}
|
2009-02-04 15:25:03 +00:00
|
|
|
|
|
|
|
switch( id )
|
|
|
|
{
|
|
|
|
case ID_TB_OPTIONS_SHOW_GRID:
|
2010-02-03 14:05:17 +00:00
|
|
|
SetGridVisibility( state );
|
2009-02-04 15:25:03 +00:00
|
|
|
DrawPanel->Refresh( TRUE );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_TB_OPTIONS_SELECT_UNIT_MM:
|
2010-07-12 14:07:09 +00:00
|
|
|
g_UserUnit = MILLIMETRES;
|
2009-04-05 20:49:15 +00:00
|
|
|
UpdateStatusBar();
|
2009-02-04 15:25:03 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_TB_OPTIONS_SELECT_UNIT_INCH:
|
2010-07-12 14:07:09 +00:00
|
|
|
g_UserUnit = INCHES;
|
2009-04-05 20:49:15 +00:00
|
|
|
UpdateStatusBar();
|
2009-02-04 15:25:03 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_TB_OPTIONS_SHOW_POLAR_COORD:
|
|
|
|
Affiche_Message( wxEmptyString );
|
2010-02-03 14:05:17 +00:00
|
|
|
DisplayOpt.DisplayPolarCood = state;
|
2009-04-05 20:49:15 +00:00
|
|
|
UpdateStatusBar();
|
2009-02-04 15:25:03 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_TB_OPTIONS_SELECT_CURSOR:
|
2010-02-03 14:05:17 +00:00
|
|
|
m_CursorShape = state;
|
2009-02-04 15:25:03 +00:00
|
|
|
DrawPanel->Refresh( TRUE );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_TB_OPTIONS_SHOW_PADS_SKETCH:
|
2010-02-03 14:05:17 +00:00
|
|
|
if( state )
|
2009-02-04 15:25:03 +00:00
|
|
|
{
|
2009-05-21 17:42:42 +00:00
|
|
|
DisplayOpt.DisplayPadFill = m_DisplayPadFill = false;
|
2009-02-04 15:25:03 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-05-21 17:42:42 +00:00
|
|
|
DisplayOpt.DisplayPadFill = m_DisplayPadFill = true;
|
2009-02-04 15:25:03 +00:00
|
|
|
}
|
|
|
|
DrawPanel->Refresh( TRUE );
|
|
|
|
break;
|
|
|
|
|
2009-09-29 04:44:35 +00:00
|
|
|
case ID_TB_OPTIONS_SHOW_VIAS_SKETCH:
|
2010-02-03 14:05:17 +00:00
|
|
|
if( state )
|
2009-09-29 04:44:35 +00:00
|
|
|
{
|
|
|
|
DisplayOpt.DisplayViaFill = m_DisplayViaFill = false;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
DisplayOpt.DisplayViaFill = m_DisplayViaFill = true;
|
|
|
|
}
|
|
|
|
DrawPanel->Refresh( TRUE );
|
|
|
|
break;
|
|
|
|
|
2009-02-04 15:25:03 +00:00
|
|
|
case ID_TB_OPTIONS_SHOW_TRACKS_SKETCH:
|
2010-02-03 14:05:17 +00:00
|
|
|
if(state )
|
2009-02-04 15:25:03 +00:00
|
|
|
{
|
|
|
|
m_DisplayPcbTrackFill = FALSE;
|
|
|
|
DisplayOpt.DisplayPcbTrackFill = FALSE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
m_DisplayPcbTrackFill = TRUE;
|
|
|
|
DisplayOpt.DisplayPcbTrackFill = TRUE;
|
|
|
|
}
|
|
|
|
DrawPanel->Refresh( TRUE );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_TB_OPTIONS_SHOW_POLYGONS_SKETCH:
|
2010-02-03 14:05:17 +00:00
|
|
|
if( state ) // Polygons filled asked
|
2009-02-04 15:25:03 +00:00
|
|
|
g_DisplayPolygonsModeSketch = 1;
|
|
|
|
else
|
|
|
|
g_DisplayPolygonsModeSketch = 0;
|
|
|
|
DrawPanel->Refresh( TRUE );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_TB_OPTIONS_SHOW_DCODES:
|
2010-02-03 14:05:17 +00:00
|
|
|
SetElementVisibility( DCODES_VISIBLE, state );
|
2009-02-04 15:25:03 +00:00
|
|
|
DrawPanel->Refresh( TRUE );
|
|
|
|
break;
|
|
|
|
|
2010-02-03 14:05:17 +00:00
|
|
|
case ID_TB_OPTIONS_SHOW_LAYERS_MANAGER_VERTICAL_TOOLBAR:
|
|
|
|
// show/hide auxiliary Vertical layers and visibility manager toolbar
|
|
|
|
m_show_layer_manager_tools = state;
|
|
|
|
m_auimgr.GetPane( wxT( "m_LayersManagerToolBar" ) ).Show( m_show_layer_manager_tools );
|
|
|
|
m_auimgr.Update();
|
|
|
|
break;
|
|
|
|
|
2009-02-04 15:25:03 +00:00
|
|
|
default:
|
|
|
|
DisplayError( this,
|
2009-11-09 14:00:22 +00:00
|
|
|
wxT( "WinEDA_PcbFrame::OnSelectOptionToolbar error" ) );
|
2009-02-04 15:25:03 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
SetToolbars();
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-02-04 15:25:03 +00:00
|
|
|
class WinEDA_GerberGeneralOptionsFrame : public wxDialog
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
|
|
|
private:
|
|
|
|
|
2009-02-04 15:25:03 +00:00
|
|
|
WinEDA_BasePcbFrame* m_Parent;
|
|
|
|
wxRadioBox* m_PolarDisplay;
|
|
|
|
wxRadioBox* m_BoxUnits;
|
|
|
|
wxRadioBox* m_CursorShape;
|
|
|
|
wxRadioBox* m_GerberDefaultScale;
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
|
|
public:
|
2009-11-22 20:55:05 +00:00
|
|
|
WinEDA_GerberGeneralOptionsFrame( WinEDA_BasePcbFrame* parent );
|
2009-02-04 15:25:03 +00:00
|
|
|
~WinEDA_GerberGeneralOptionsFrame() {};
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
|
|
private:
|
2009-02-04 15:25:03 +00:00
|
|
|
void OnOkClick( wxCommandEvent& event );
|
|
|
|
void OnCancelClick( wxCommandEvent& event );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2009-02-04 15:25:03 +00:00
|
|
|
DECLARE_EVENT_TABLE()
|
2007-05-06 16:03:28 +00:00
|
|
|
};
|
2009-02-04 15:25:03 +00:00
|
|
|
|
2009-11-09 14:00:22 +00:00
|
|
|
|
2009-02-04 15:25:03 +00:00
|
|
|
BEGIN_EVENT_TABLE( WinEDA_GerberGeneralOptionsFrame, wxDialog )
|
|
|
|
EVT_BUTTON( wxID_OK, WinEDA_GerberGeneralOptionsFrame::OnOkClick )
|
|
|
|
EVT_BUTTON( wxID_CANCEL, WinEDA_GerberGeneralOptionsFrame::OnCancelClick )
|
2007-05-06 16:03:28 +00:00
|
|
|
END_EVENT_TABLE()
|
|
|
|
|
|
|
|
|
2009-02-04 15:25:03 +00:00
|
|
|
WinEDA_GerberGeneralOptionsFrame::WinEDA_GerberGeneralOptionsFrame(
|
2009-11-22 20:55:05 +00:00
|
|
|
WinEDA_BasePcbFrame* parent ) :
|
2009-02-04 15:25:03 +00:00
|
|
|
wxDialog( parent, -1, _( "Gerbview Options" ),
|
2009-11-22 20:55:05 +00:00
|
|
|
wxDefaultPosition, wxSize( 300, 240 ),
|
2009-02-04 15:25:03 +00:00
|
|
|
wxDEFAULT_DIALOG_STYLE | wxFRAME_FLOAT_ON_PARENT )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2009-02-04 15:25:03 +00:00
|
|
|
m_Parent = parent;
|
|
|
|
|
|
|
|
wxBoxSizer* MainBoxSizer = new wxBoxSizer( wxHORIZONTAL );
|
|
|
|
SetSizer( MainBoxSizer );
|
|
|
|
wxBoxSizer* RightBoxSizer = new wxBoxSizer( wxVERTICAL );
|
|
|
|
wxBoxSizer* MiddleBoxSizer = new wxBoxSizer( wxVERTICAL );
|
|
|
|
wxBoxSizer* LeftBoxSizer = new wxBoxSizer( wxVERTICAL );
|
|
|
|
MainBoxSizer->Add( LeftBoxSizer, 0, wxGROW | wxALL, 5 );
|
|
|
|
MainBoxSizer->Add( MiddleBoxSizer, 0, wxGROW | wxALL, 5 );
|
|
|
|
MainBoxSizer->Add( RightBoxSizer, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
|
|
|
|
|
|
|
|
wxButton* Button = new wxButton( this, wxID_OK, _( "OK" ) );
|
|
|
|
RightBoxSizer->Add( Button, 0, wxGROW | wxALL, 5 );
|
|
|
|
|
|
|
|
Button = new wxButton( this, wxID_CANCEL, _( "Cancel" ) );
|
|
|
|
RightBoxSizer->Add( Button, 0, wxGROW | wxALL, 5 );
|
|
|
|
|
|
|
|
/* Display / not display polar coordinates: */
|
|
|
|
wxString list_coord[2] =
|
|
|
|
{
|
|
|
|
_( "No Display" ),
|
|
|
|
_( "Display" )
|
|
|
|
};
|
|
|
|
m_PolarDisplay = new wxRadioBox( this, -1, _( "Display Polar Coord" ),
|
|
|
|
wxDefaultPosition, wxDefaultSize,
|
|
|
|
2, list_coord, 1 );
|
|
|
|
m_PolarDisplay->SetSelection( DisplayOpt.DisplayPolarCood ? 1 : 0 );
|
|
|
|
LeftBoxSizer->Add( m_PolarDisplay, 0, wxGROW | wxALL, 5 );
|
|
|
|
|
|
|
|
/* Selection of units */
|
|
|
|
wxString list_units[2] =
|
|
|
|
{
|
|
|
|
_( "Inches" ),
|
|
|
|
_( "millimeters" )
|
|
|
|
};
|
|
|
|
m_BoxUnits = new wxRadioBox( this, -1, _( "Units" ), wxDefaultPosition,
|
|
|
|
wxDefaultSize,
|
|
|
|
2, list_units, 1 );
|
2010-07-12 14:07:09 +00:00
|
|
|
m_BoxUnits->SetSelection( g_UserUnit ? 1 : 0 );
|
2009-02-04 15:25:03 +00:00
|
|
|
LeftBoxSizer->Add( m_BoxUnits, 0, wxGROW | wxALL, 5 );
|
|
|
|
|
|
|
|
/* Selection of cursor shape */
|
|
|
|
wxString list_cursors[2] = { _( "Small" ), _( "Big" ) };
|
|
|
|
m_CursorShape = new wxRadioBox( this, -1, _( "Cursor" ), wxDefaultPosition,
|
|
|
|
wxDefaultSize,
|
|
|
|
2, list_cursors, 1 );
|
2009-04-05 20:49:15 +00:00
|
|
|
m_CursorShape->SetSelection( parent->m_CursorShape ? 1 : 0 );
|
2009-02-04 15:25:03 +00:00
|
|
|
MiddleBoxSizer->Add( m_CursorShape, 0, wxGROW | wxALL, 5 );
|
|
|
|
|
|
|
|
/* Selection Default Scale (i.e. format 2.3 ou 3.4) */
|
|
|
|
wxString list_scales[2] = { _( "format: 2.3" ), _( "format 3.4" ) };
|
|
|
|
m_GerberDefaultScale = new wxRadioBox( this, -1, _( "Default format" ),
|
|
|
|
wxDefaultPosition, wxDefaultSize,
|
|
|
|
2, list_scales, 1 );
|
|
|
|
m_GerberDefaultScale->SetSelection(
|
|
|
|
(g_Default_GERBER_Format == 23) ? 0 : 1 );
|
|
|
|
MiddleBoxSizer->Add( m_GerberDefaultScale, 0, wxGROW | wxALL, 5 );
|
|
|
|
|
|
|
|
GetSizer()->Fit( this );
|
|
|
|
GetSizer()->SetSizeHints( this );
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
2007-09-25 06:15:54 +00:00
|
|
|
|
2009-02-04 15:25:03 +00:00
|
|
|
void WinEDA_GerberGeneralOptionsFrame::OnCancelClick(
|
|
|
|
wxCommandEvent& WXUNUSED(event) )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2007-10-07 03:08:24 +00:00
|
|
|
EndModal( -1 );
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-02-04 15:25:03 +00:00
|
|
|
void WinEDA_GerberGeneralOptionsFrame::OnOkClick( wxCommandEvent& event )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2009-02-04 15:25:03 +00:00
|
|
|
DisplayOpt.DisplayPolarCood =
|
|
|
|
(m_PolarDisplay->GetSelection() == 0) ? FALSE : TRUE;
|
2010-07-12 14:07:09 +00:00
|
|
|
g_UserUnit = (m_BoxUnits->GetSelection() == 0) ? INCHES : MILLIMETRES;
|
2009-04-05 20:49:15 +00:00
|
|
|
m_Parent->m_CursorShape = m_CursorShape->GetSelection();
|
2009-02-04 15:25:03 +00:00
|
|
|
g_Default_GERBER_Format =
|
|
|
|
(m_GerberDefaultScale->GetSelection() == 0) ? 23 : 34;
|
|
|
|
|
|
|
|
EndModal( 1 );
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-11-22 20:55:05 +00:00
|
|
|
void WinEDA_GerberFrame::InstallGerberGeneralOptionsFrame( wxCommandEvent& event )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2009-11-22 20:55:05 +00:00
|
|
|
WinEDA_GerberGeneralOptionsFrame dlg( this );
|
|
|
|
dlg.ShowModal();
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|