2007-05-06 16:03:28 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: dialog_general_options.cpp
|
|
|
|
// Author: jean-pierre Charras
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
2009-11-14 22:15:22 +00:00
|
|
|
|
2008-12-21 16:54:27 +00:00
|
|
|
/* functions relatives to the dialogs opened from the main menu :
|
2009-11-14 22:15:22 +00:00
|
|
|
* Preferences/general
|
|
|
|
* Preferences/display
|
|
|
|
*/
|
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 "pcbnew.h"
|
2009-07-30 11:04:07 +00:00
|
|
|
#include "wxPcbStruct.h"
|
2009-10-28 11:48:47 +00:00
|
|
|
#include "class_board_design_settings.h"
|
2009-10-30 17:58:15 +00:00
|
|
|
#include "dialog_general_options.h"
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2009-09-22 12:27:57 +00:00
|
|
|
#include "pcbnew_id.h"
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2009-02-24 22:41:30 +00:00
|
|
|
|
2009-11-14 22:15:22 +00:00
|
|
|
Dialog_GeneralOptions::Dialog_GeneralOptions( WinEDA_PcbFrame* parent,
|
|
|
|
wxDC* DC ) :
|
|
|
|
DialogGeneralOptionsBoardEditor_base( parent )
|
2008-12-21 12:11:47 +00:00
|
|
|
{
|
|
|
|
m_Parent = parent;
|
2009-11-14 22:15:22 +00:00
|
|
|
m_DC = DC;
|
2009-02-24 22:41:30 +00:00
|
|
|
init();
|
2008-12-21 12:11:47 +00:00
|
|
|
}
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2009-11-14 22:15:22 +00:00
|
|
|
|
2009-02-24 22:41:30 +00:00
|
|
|
void Dialog_GeneralOptions::init()
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2009-02-24 22:41:30 +00:00
|
|
|
SetFocus();
|
2008-04-29 03:18:02 +00:00
|
|
|
|
2007-06-20 00:33:23 +00:00
|
|
|
/* Set display options */
|
2008-04-29 03:18:02 +00:00
|
|
|
m_PolarDisplay->SetSelection( DisplayOpt.DisplayPolarCood ? 1 : 0 );
|
2008-12-21 12:11:47 +00:00
|
|
|
m_UnitsSelection->SetSelection( g_UnitMetric ? 1 : 0 );
|
2009-04-05 20:49:15 +00:00
|
|
|
m_CursorShape->SetSelection( m_Parent->m_CursorShape ? 1 : 0 );
|
2008-04-29 03:18:02 +00:00
|
|
|
|
|
|
|
wxString timevalue;
|
2007-06-20 00:33:23 +00:00
|
|
|
timevalue << g_TimeOut / 60;
|
2008-04-29 03:18:02 +00:00
|
|
|
m_SaveTime->SetValue( timevalue );
|
2009-11-14 22:15:22 +00:00
|
|
|
|
2009-10-18 23:22:26 +00:00
|
|
|
/*
|
2009-11-14 22:15:22 +00:00
|
|
|
* int layer_count[] = {1,2,4,6,8,10,12,14,16};
|
|
|
|
* m_LayerNumber->SetSelection(1);
|
|
|
|
* for ( unsigned ii = 0; ii < sizeof(layer_count); ii++ )
|
|
|
|
* {
|
|
|
|
* if ( g_DesignSettings.m_CopperLayerCount != layer_count[ii] )
|
|
|
|
* continue;
|
|
|
|
* m_LayerNumber->SetSelection(ii);
|
|
|
|
* break;
|
|
|
|
* }
|
|
|
|
*/
|
2008-04-29 03:18:02 +00:00
|
|
|
m_MaxShowLinks->SetValue( g_MaxLinksShowed );
|
|
|
|
|
|
|
|
m_DrcOn->SetValue( Drc_On );
|
|
|
|
m_ShowModuleRatsnest->SetValue( g_Show_Module_Ratsnest );
|
|
|
|
m_ShowGlobalRatsnest->SetValue( g_Show_Ratsnest );
|
|
|
|
m_TrackAutodel->SetValue( g_AutoDeleteOldTrack );
|
|
|
|
m_Track_45_Only_Ctrl->SetValue( Track_45_Only );
|
|
|
|
m_Segments_45_Only_Ctrl->SetValue( Segments_45_Only );
|
|
|
|
m_AutoPANOpt->SetValue( m_Parent->DrawPanel->m_AutoPAN_Enable );
|
|
|
|
m_Segments_45_Only_Ctrl->SetValue( Segments_45_Only );
|
|
|
|
m_Track_DoubleSegm_Ctrl->SetValue( g_TwoSegmentTrackBuild );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2008-12-21 12:11:47 +00:00
|
|
|
m_MagneticPadOptCtrl->SetSelection( g_MagneticPadOption );
|
|
|
|
m_MagneticTrackOptCtrl->SetSelection( g_MagneticTrackOption );
|
2008-04-29 03:18:02 +00:00
|
|
|
|
|
|
|
if( GetSizer() )
|
2008-03-04 05:40:15 +00:00
|
|
|
{
|
2008-04-29 03:18:02 +00:00
|
|
|
GetSizer()->SetSizeHints( this );
|
2008-03-04 05:40:15 +00:00
|
|
|
}
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
2008-04-29 03:18:02 +00:00
|
|
|
|
2008-12-21 12:11:47 +00:00
|
|
|
void Dialog_GeneralOptions::OnCancelClick( wxCommandEvent& event )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2007-06-05 12:10:51 +00:00
|
|
|
event.Skip();
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
2008-04-29 03:18:02 +00:00
|
|
|
|
|
|
|
|
2008-12-21 12:11:47 +00:00
|
|
|
void Dialog_GeneralOptions::OnOkClick( wxCommandEvent& event )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2008-04-29 03:18:02 +00:00
|
|
|
int ii;
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2007-06-20 00:33:23 +00:00
|
|
|
DisplayOpt.DisplayPolarCood =
|
2009-11-14 22:15:22 +00:00
|
|
|
( m_PolarDisplay->GetSelection() == 0 ) ? FALSE : true;
|
2007-06-20 00:33:23 +00:00
|
|
|
ii = g_UnitMetric;
|
2009-11-14 22:15:22 +00:00
|
|
|
g_UnitMetric = ( m_UnitsSelection->GetSelection() == 0 ) ? 0 : 1;
|
2008-04-29 03:18:02 +00:00
|
|
|
if( ii != g_UnitMetric )
|
|
|
|
m_Parent->ReCreateAuxiliaryToolbar();
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2009-04-05 20:49:15 +00:00
|
|
|
m_Parent->m_CursorShape = m_CursorShape->GetSelection();
|
2007-06-20 00:33:23 +00:00
|
|
|
g_TimeOut = 60 * m_SaveTime->GetValue();
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2009-11-14 22:15:22 +00:00
|
|
|
/* Updating the combobox to display the active layer. */
|
2007-06-20 00:33:23 +00:00
|
|
|
g_MaxLinksShowed = m_MaxShowLinks->GetValue();
|
|
|
|
Drc_On = m_DrcOn->GetValue();
|
2008-04-29 03:18:02 +00:00
|
|
|
if( g_Show_Ratsnest != m_ShowGlobalRatsnest->GetValue() )
|
2007-06-20 00:33:23 +00:00
|
|
|
{
|
|
|
|
g_Show_Ratsnest = m_ShowGlobalRatsnest->GetValue();
|
2008-04-29 03:18:02 +00:00
|
|
|
m_Parent->Ratsnest_On_Off( m_DC );
|
2009-11-14 22:15:22 +00:00
|
|
|
m_Parent->RedrawActiveWindow( m_DC, true );
|
2007-06-20 00:33:23 +00:00
|
|
|
}
|
|
|
|
g_Show_Module_Ratsnest = m_ShowModuleRatsnest->GetValue();
|
2008-04-29 03:18:02 +00:00
|
|
|
g_AutoDeleteOldTrack = m_TrackAutodel->GetValue();
|
2007-06-20 00:33:23 +00:00
|
|
|
Segments_45_Only = m_Segments_45_Only_Ctrl->GetValue();
|
2008-04-29 03:18:02 +00:00
|
|
|
Track_45_Only = m_Track_45_Only_Ctrl->GetValue();
|
2007-06-20 00:33:23 +00:00
|
|
|
m_Parent->DrawPanel->m_AutoPAN_Enable = m_AutoPANOpt->GetValue();
|
2007-05-06 16:03:28 +00:00
|
|
|
g_TwoSegmentTrackBuild = m_Track_DoubleSegm_Ctrl->GetValue();
|
|
|
|
|
2009-11-14 22:15:22 +00:00
|
|
|
g_MagneticPadOption = m_MagneticPadOptCtrl->GetSelection();
|
2009-02-24 22:41:30 +00:00
|
|
|
g_MagneticTrackOption = m_MagneticTrackOptCtrl->GetSelection();
|
|
|
|
|
2008-04-29 03:18:02 +00:00
|
|
|
EndModal( 1 );
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#include "dialog_graphic_items_options.cpp"
|
|
|
|
|
2009-11-14 22:15:22 +00:00
|
|
|
|
2008-04-29 03:18:02 +00:00
|
|
|
void WinEDA_PcbFrame::InstallPcbOptionsFrame( const wxPoint& pos,
|
|
|
|
wxDC* DC, int id )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2008-04-29 03:18:02 +00:00
|
|
|
switch( id )
|
2007-06-20 00:33:23 +00:00
|
|
|
{
|
|
|
|
case ID_PCB_DRAWINGS_WIDTHS_SETUP:
|
2009-11-14 22:15:22 +00:00
|
|
|
{
|
|
|
|
WinEDA_GraphicItemsOptionsDialog dlg( this );
|
|
|
|
dlg.ShowModal();
|
|
|
|
}
|
|
|
|
break;
|
2007-06-20 00:33:23 +00:00
|
|
|
|
2009-10-30 17:58:15 +00:00
|
|
|
default:
|
2009-11-14 22:15:22 +00:00
|
|
|
wxMessageBox( wxT( "InstallPcbOptionsFrame() id error" ) );
|
2007-06-20 00:33:23 +00:00
|
|
|
break;
|
|
|
|
}
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-04-29 03:18:02 +00:00
|
|
|
void WinEDA_ModuleEditFrame::InstallOptionsFrame( const wxPoint& pos )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2009-10-30 17:58:15 +00:00
|
|
|
WinEDA_GraphicItemsOptionsDialog dlg( this );
|
2009-11-14 22:15:22 +00:00
|
|
|
|
2009-10-30 17:58:15 +00:00
|
|
|
dlg.ShowModal();
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
2008-12-21 16:54:27 +00:00
|
|
|
|
|
|
|
|
|
|
|
/* Must be called on a click on the left toolbar (options toolbar
|
2009-11-14 22:15:22 +00:00
|
|
|
* Update variables according to the tools states
|
2008-12-21 16:54:27 +00:00
|
|
|
*/
|
2009-11-14 22:15:22 +00:00
|
|
|
void WinEDA_PcbFrame::OnSelectOptionToolbar( wxCommandEvent& event )
|
2008-12-21 16:54:27 +00:00
|
|
|
{
|
|
|
|
int id = event.GetId();
|
|
|
|
|
|
|
|
|
|
|
|
switch( id )
|
|
|
|
{
|
|
|
|
case ID_TB_OPTIONS_DRC_OFF:
|
2009-10-01 16:46:13 +00:00
|
|
|
Drc_On = m_OptionsToolBar->GetToolState( id ) ? FALSE : true;
|
2008-12-21 16:54:27 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_TB_OPTIONS_SHOW_GRID:
|
2009-06-04 19:39:50 +00:00
|
|
|
m_Draw_Grid = m_OptionsToolBar->GetToolState( id );
|
2009-11-14 22:15:22 +00:00
|
|
|
DrawPanel->Refresh();
|
2008-12-21 16:54:27 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_TB_OPTIONS_SHOW_RATSNEST:
|
|
|
|
g_Show_Ratsnest = m_OptionsToolBar->GetToolState( id );
|
|
|
|
{
|
2009-11-14 22:15:22 +00:00
|
|
|
wxClientDC dc( DrawPanel );
|
|
|
|
DrawPanel->PrepareGraphicContext( &dc );
|
|
|
|
Ratsnest_On_Off( &dc );
|
|
|
|
RedrawActiveWindow( &dc, true );
|
2008-12-21 16:54:27 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_TB_OPTIONS_SHOW_MODULE_RATSNEST:
|
|
|
|
g_Show_Module_Ratsnest = m_OptionsToolBar->GetToolState( id );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_TB_OPTIONS_SELECT_UNIT_MM:
|
|
|
|
g_UnitMetric = MILLIMETRE;
|
|
|
|
|
|
|
|
case ID_TB_OPTIONS_SELECT_UNIT_INCH:
|
|
|
|
if( id == ID_TB_OPTIONS_SELECT_UNIT_INCH )
|
|
|
|
g_UnitMetric = INCHES;
|
2009-10-01 16:46:13 +00:00
|
|
|
m_TrackAndViasSizesList_Changed = true;
|
2009-11-14 22:15:22 +00:00
|
|
|
UpdateStatusBar();
|
2008-12-21 16:54:27 +00:00
|
|
|
ReCreateAuxiliaryToolbar();
|
|
|
|
DisplayUnitsMsg();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_TB_OPTIONS_SHOW_POLAR_COORD:
|
|
|
|
Affiche_Message( wxEmptyString );
|
|
|
|
DisplayOpt.DisplayPolarCood = m_OptionsToolBar->GetToolState( id );
|
2009-11-14 22:15:22 +00:00
|
|
|
UpdateStatusBar();
|
2008-12-21 16:54:27 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_TB_OPTIONS_SELECT_CURSOR:
|
2009-04-05 20:49:15 +00:00
|
|
|
m_CursorShape = m_OptionsToolBar->GetToolState( id );
|
2008-12-21 16:54:27 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_TB_OPTIONS_AUTO_DEL_TRACK:
|
|
|
|
g_AutoDeleteOldTrack = m_OptionsToolBar->GetToolState( id );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_TB_OPTIONS_SHOW_ZONES:
|
|
|
|
DisplayOpt.DisplayZonesMode = 0;
|
2009-11-14 22:15:22 +00:00
|
|
|
DrawPanel->Refresh();
|
2008-12-21 16:54:27 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_TB_OPTIONS_SHOW_ZONES_DISABLE:
|
|
|
|
DisplayOpt.DisplayZonesMode = 1;
|
2009-11-14 22:15:22 +00:00
|
|
|
DrawPanel->Refresh();
|
2008-12-21 16:54:27 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_TB_OPTIONS_SHOW_ZONES_OUTLINES_ONLY:
|
|
|
|
DisplayOpt.DisplayZonesMode = 2;
|
2009-11-14 22:15:22 +00:00
|
|
|
DrawPanel->Refresh();
|
2008-12-21 16:54:27 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_TB_OPTIONS_SHOW_PADS_SKETCH:
|
2009-05-21 17:42:42 +00:00
|
|
|
if( m_OptionsToolBar->GetToolState( id ) )
|
|
|
|
{
|
2009-05-31 08:56:35 +00:00
|
|
|
m_DisplayPadFill = DisplayOpt.DisplayPadFill = false;
|
2009-05-21 17:42:42 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-05-31 08:56:35 +00:00
|
|
|
m_DisplayPadFill = DisplayOpt.DisplayPadFill = true;
|
2009-05-21 17:42:42 +00:00
|
|
|
}
|
2009-11-14 22:15:22 +00:00
|
|
|
DrawPanel->Refresh();
|
2008-12-21 16:54:27 +00:00
|
|
|
break;
|
|
|
|
|
2009-09-29 04:44:35 +00:00
|
|
|
case ID_TB_OPTIONS_SHOW_VIAS_SKETCH:
|
|
|
|
if( m_OptionsToolBar->GetToolState( id ) )
|
|
|
|
{
|
|
|
|
m_DisplayViaFill = DisplayOpt.DisplayViaFill = false;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
m_DisplayViaFill = DisplayOpt.DisplayViaFill = true;
|
|
|
|
}
|
2009-11-14 22:15:22 +00:00
|
|
|
DrawPanel->Refresh();
|
2009-09-29 04:44:35 +00:00
|
|
|
break;
|
|
|
|
|
2008-12-21 16:54:27 +00:00
|
|
|
case ID_TB_OPTIONS_SHOW_TRACKS_SKETCH:
|
|
|
|
m_DisplayPcbTrackFill = DisplayOpt.DisplayPcbTrackFill =
|
|
|
|
!m_OptionsToolBar->GetToolState( id );
|
2009-11-14 22:15:22 +00:00
|
|
|
DrawPanel->Refresh();
|
2008-12-21 16:54:27 +00:00
|
|
|
break;
|
|
|
|
|
2009-06-19 20:13:22 +00:00
|
|
|
case ID_TB_OPTIONS_SHOW_HIGH_CONTRAST_MODE:
|
2008-12-21 16:54:27 +00:00
|
|
|
DisplayOpt.ContrastModeDisplay =
|
|
|
|
m_OptionsToolBar->GetToolState( id );
|
2009-11-14 22:15:22 +00:00
|
|
|
DrawPanel->Refresh();
|
2008-12-21 16:54:27 +00:00
|
|
|
break;
|
2009-11-14 22:15:22 +00:00
|
|
|
|
2009-06-19 20:13:22 +00:00
|
|
|
case ID_TB_OPTIONS_SHOW_INVISIBLE_TEXT_MODE:
|
2009-11-14 22:15:22 +00:00
|
|
|
g_DesignSettings.SetElementVisibility( MODULE_TEXT_NOV_VISIBLE,
|
|
|
|
m_OptionsToolBar->GetToolState( id ) );
|
|
|
|
DrawPanel->Refresh();
|
|
|
|
break;
|
2008-12-21 16:54:27 +00:00
|
|
|
|
|
|
|
case ID_TB_OPTIONS_SHOW_EXTRA_VERTICAL_TOOLBAR1:
|
2009-11-14 22:15:22 +00:00
|
|
|
|
2009-11-05 08:52:41 +00:00
|
|
|
#if !defined(KICAD_AUIMANAGER)
|
2009-11-14 22:15:22 +00:00
|
|
|
if( m_OptionsToolBar->GetToolState( id ) ) // show aux V toolbar
|
|
|
|
// (Microwave tool)
|
2008-12-21 16:54:27 +00:00
|
|
|
ReCreateAuxVToolbar();
|
|
|
|
else
|
|
|
|
{
|
|
|
|
delete m_AuxVToolBar;
|
|
|
|
m_AuxVToolBar = NULL;
|
|
|
|
}
|
|
|
|
{
|
|
|
|
wxSizeEvent SizeEv( GetSize() );
|
|
|
|
|
|
|
|
OnSize( SizeEv );
|
|
|
|
}
|
2009-11-02 22:24:55 +00:00
|
|
|
#else
|
2009-11-14 22:15:22 +00:00
|
|
|
m_auimgr.GetPane( wxT( "m_AuxVToolBar" ) ).Show( m_OptionsToolBar->GetToolState( id ) );
|
2009-11-02 22:24:55 +00:00
|
|
|
m_auimgr.Update();
|
|
|
|
#endif
|
2008-12-21 16:54:27 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
DisplayError( this,
|
2009-11-14 22:15:22 +00:00
|
|
|
wxT( "WinEDA_PcbFrame::OnSelectOptionToolbar error \n (event not handled!)" ) );
|
2008-12-21 16:54:27 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
SetToolbars();
|
|
|
|
}
|