2011-10-16 08:02:36 +00:00
|
|
|
/**
|
|
|
|
* @file gerbview_dialog_display_options_frame.cpp
|
|
|
|
* Set some display options for GerbView
|
2009-11-22 20:55:05 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#include "fctsys.h"
|
|
|
|
#include "common.h"
|
|
|
|
#include "class_drawpanel.h"
|
|
|
|
|
|
|
|
#include "pcbplot.h"
|
|
|
|
#include "gerbview.h"
|
|
|
|
#include "gerbview_dialog_display_options_frame_base.h"
|
|
|
|
|
|
|
|
|
|
|
|
/*******************************************/
|
|
|
|
/* Dialog frame to select display options */
|
|
|
|
/*******************************************/
|
|
|
|
class DIALOG_DISPLAY_OPTIONS : public DIALOG_DISPLAY_OPTIONS_BASE
|
|
|
|
{
|
|
|
|
private:
|
2011-03-12 09:50:21 +00:00
|
|
|
GERBVIEW_FRAME* m_Parent;
|
2009-11-22 20:55:05 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
|
2011-03-12 09:50:21 +00:00
|
|
|
DIALOG_DISPLAY_OPTIONS( GERBVIEW_FRAME* parent );
|
2009-11-22 20:55:05 +00:00
|
|
|
~DIALOG_DISPLAY_OPTIONS() {};
|
|
|
|
|
|
|
|
private:
|
|
|
|
void OnOKBUttonClick( wxCommandEvent& event );
|
|
|
|
void OnCancelButtonClick( wxCommandEvent& event );
|
2010-10-09 11:03:03 +00:00
|
|
|
void initOptDialog( );
|
2009-11-22 20:55:05 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2011-03-12 09:50:21 +00:00
|
|
|
void GERBVIEW_FRAME::InstallGerberOptionsDialog( wxCommandEvent& event )
|
2009-11-22 20:55:05 +00:00
|
|
|
{
|
|
|
|
DIALOG_DISPLAY_OPTIONS dlg( this );
|
|
|
|
int opt = dlg.ShowModal();
|
|
|
|
if (opt > 0 )
|
|
|
|
DrawPanel->Refresh();
|
|
|
|
}
|
|
|
|
|
2011-03-12 09:50:21 +00:00
|
|
|
DIALOG_DISPLAY_OPTIONS::DIALOG_DISPLAY_OPTIONS( GERBVIEW_FRAME *parent) :
|
2009-11-22 20:55:05 +00:00
|
|
|
DIALOG_DISPLAY_OPTIONS_BASE( parent, wxID_ANY )
|
|
|
|
{
|
|
|
|
m_Parent = parent;
|
|
|
|
SetFocus();
|
2010-10-09 11:03:03 +00:00
|
|
|
initOptDialog( );
|
2009-11-22 20:55:05 +00:00
|
|
|
|
2010-10-09 11:03:03 +00:00
|
|
|
GetSizer()->Fit( this );
|
|
|
|
GetSizer()->SetSizeHints( this );
|
|
|
|
Center();
|
2011-03-14 15:17:18 +00:00
|
|
|
m_sdbSizer1OK->SetDefault();
|
2010-10-09 11:03:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-12-18 18:47:58 +00:00
|
|
|
void DIALOG_DISPLAY_OPTIONS::OnCancelButtonClick( wxCommandEvent& event )
|
2010-10-09 11:03:03 +00:00
|
|
|
{
|
|
|
|
EndModal( 0 );
|
|
|
|
}
|
|
|
|
|
|
|
|
void DIALOG_DISPLAY_OPTIONS::initOptDialog( )
|
|
|
|
{
|
2009-11-22 20:55:05 +00:00
|
|
|
|
2010-10-09 11:03:03 +00:00
|
|
|
m_PolarDisplay->SetSelection( DisplayOpt.DisplayPolarCood ? 1 : 0 );
|
|
|
|
m_BoxUnits->SetSelection( g_UserUnit ? 1 : 0 );
|
|
|
|
m_CursorShape->SetSelection( m_Parent->m_CursorShape ? 1 : 0 );
|
2009-11-22 20:55:05 +00:00
|
|
|
|
2010-10-09 11:03:03 +00:00
|
|
|
// Show Option Draw Lines. We use DisplayPcbTrackFill as Lines draw option
|
|
|
|
m_OptDisplayLines->SetSelection( DisplayOpt.DisplayPcbTrackFill ? 1 : 0 );
|
|
|
|
m_OptDisplayFlashedItems->SetSelection( DisplayOpt.DisplayPadFill ? 1 : 0);
|
2009-11-22 20:55:05 +00:00
|
|
|
// Show Option Draw polygons
|
2010-10-09 11:03:03 +00:00
|
|
|
m_OptDisplayPolygons->SetSelection( g_DisplayPolygonsModeSketch ? 0 : 1 );
|
2009-11-22 20:55:05 +00:00
|
|
|
|
|
|
|
m_ShowPageLimits->SetSelection(0);
|
|
|
|
if( m_Parent->m_Draw_Sheet_Ref )
|
|
|
|
{
|
|
|
|
for( int ii = 1; g_GerberPageSizeList[ii] != NULL; ii++ )
|
|
|
|
{
|
|
|
|
if( m_Parent->GetScreen()->m_CurrentSheetDesc == g_GerberPageSizeList[ii] )
|
|
|
|
{
|
|
|
|
m_ShowPageLimits->SetSelection(ii);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-02-03 14:05:17 +00:00
|
|
|
m_OptDisplayDCodes->SetValue( m_Parent->IsElementVisible( DCODES_VISIBLE ) );
|
2009-11-22 20:55:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void DIALOG_DISPLAY_OPTIONS::OnOKBUttonClick( wxCommandEvent& event )
|
|
|
|
{
|
2010-10-09 11:03:03 +00:00
|
|
|
DisplayOpt.DisplayPolarCood =
|
|
|
|
(m_PolarDisplay->GetSelection() == 0) ? FALSE : TRUE;
|
|
|
|
g_UserUnit = (m_BoxUnits->GetSelection() == 0) ? INCHES : MILLIMETRES;
|
|
|
|
m_Parent->m_CursorShape = m_CursorShape->GetSelection();
|
|
|
|
|
2009-11-22 20:55:05 +00:00
|
|
|
if( m_OptDisplayLines->GetSelection() == 1 )
|
|
|
|
DisplayOpt.DisplayPcbTrackFill = TRUE;
|
|
|
|
else
|
|
|
|
DisplayOpt.DisplayPcbTrackFill = FALSE;
|
|
|
|
|
|
|
|
if( m_OptDisplayFlashedItems->GetSelection() == 1 )
|
|
|
|
{
|
|
|
|
DisplayOpt.DisplayPadFill = true;
|
|
|
|
DisplayOpt.DisplayViaFill = true;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
DisplayOpt.DisplayViaFill = false;
|
|
|
|
DisplayOpt.DisplayPadFill = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if( m_OptDisplayPolygons->GetSelection() == 0 )
|
|
|
|
g_DisplayPolygonsModeSketch = 1;
|
|
|
|
else
|
|
|
|
g_DisplayPolygonsModeSketch = 0;
|
|
|
|
|
2010-02-03 14:05:17 +00:00
|
|
|
m_Parent->SetElementVisibility( DCODES_VISIBLE, m_OptDisplayDCodes->GetValue() );
|
2009-11-22 20:55:05 +00:00
|
|
|
|
|
|
|
m_Parent->m_DisplayPadFill = m_Parent->m_DisplayViaFill =
|
|
|
|
DisplayOpt.DisplayViaFill;
|
|
|
|
m_Parent->m_DisplayPcbTrackFill = DisplayOpt.DisplayPcbTrackFill;
|
|
|
|
|
|
|
|
int idx = m_ShowPageLimits->GetSelection();
|
|
|
|
if( idx > 0 )
|
|
|
|
m_Parent->m_Draw_Sheet_Ref = true;
|
|
|
|
else
|
|
|
|
m_Parent->m_Draw_Sheet_Ref = false;
|
|
|
|
|
|
|
|
m_Parent->GetScreen()->m_CurrentSheetDesc = g_GerberPageSizeList[idx];
|
|
|
|
|
|
|
|
EndModal( 1 );
|
|
|
|
}
|
|
|
|
|