2009-06-18 17:32:27 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: dialog_general_options.cpp
|
|
|
|
// Author: jean-pierre Charras
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
/* functions relatives to the dialog opened from the main menu :
|
|
|
|
Prefernces/display
|
|
|
|
*/
|
|
|
|
#include "fctsys.h"
|
|
|
|
#include "class_drawpanel.h"
|
|
|
|
#include "confirm.h"
|
|
|
|
#include "pcbnew.h"
|
2009-07-30 11:04:07 +00:00
|
|
|
#include "wxPcbStruct.h"
|
2011-09-23 13:57:12 +00:00
|
|
|
#include "pcbstruct.h"
|
|
|
|
#include "pcbcommon.h"
|
2009-06-18 17:32:27 +00:00
|
|
|
|
2009-09-22 12:27:57 +00:00
|
|
|
#include "pcbnew_id.h"
|
2009-06-18 17:32:27 +00:00
|
|
|
|
2010-01-17 20:25:10 +00:00
|
|
|
#include "dialog_display_options.h"
|
2009-06-18 17:32:27 +00:00
|
|
|
#include "dialog_display_options_base.h"
|
|
|
|
|
|
|
|
|
2011-03-01 19:26:17 +00:00
|
|
|
void PCB_EDIT_FRAME::InstallDisplayOptionsDialog( wxCommandEvent& aEvent )
|
2009-06-18 17:32:27 +00:00
|
|
|
{
|
2011-03-03 19:08:13 +00:00
|
|
|
DIALOG_DISPLAY_OPTIONS dlg( this );
|
|
|
|
dlg.ShowModal();
|
2009-06-18 17:32:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-03-03 19:08:13 +00:00
|
|
|
DIALOG_DISPLAY_OPTIONS::DIALOG_DISPLAY_OPTIONS( PCB_EDIT_FRAME* parent ) :
|
2011-03-14 15:17:18 +00:00
|
|
|
DIALOG_DISPLAY_OPTIONS_BASE( parent )
|
2009-06-18 17:32:27 +00:00
|
|
|
{
|
|
|
|
m_Parent = parent;
|
|
|
|
|
|
|
|
init();
|
2011-03-03 19:08:13 +00:00
|
|
|
|
2011-03-14 15:17:18 +00:00
|
|
|
m_buttonOK->SetDefault();
|
2011-03-03 19:08:13 +00:00
|
|
|
GetSizer()->SetSizeHints( this );
|
2009-06-18 17:32:27 +00:00
|
|
|
}
|
|
|
|
|
2011-03-03 19:08:13 +00:00
|
|
|
void DIALOG_DISPLAY_OPTIONS::init()
|
2009-06-18 17:32:27 +00:00
|
|
|
{
|
|
|
|
SetFocus();
|
|
|
|
|
|
|
|
if ( DisplayOpt.DisplayPcbTrackFill )
|
2011-09-24 18:33:28 +00:00
|
|
|
m_OptDisplayTracks->SetSelection( 1 );
|
2011-03-03 19:08:13 +00:00
|
|
|
else
|
2011-09-24 18:33:28 +00:00
|
|
|
m_OptDisplayTracks->SetSelection( 0 );
|
2009-06-18 17:32:27 +00:00
|
|
|
|
2009-06-18 20:51:01 +00:00
|
|
|
switch ( DisplayOpt.ShowTrackClearanceMode )
|
|
|
|
{
|
|
|
|
case DO_NOT_SHOW_CLEARANCE:
|
2011-09-24 18:33:28 +00:00
|
|
|
m_OptDisplayTracksClearance->SetSelection( 0 );
|
2009-06-18 20:51:01 +00:00
|
|
|
break;
|
2011-09-24 18:33:28 +00:00
|
|
|
|
2009-06-18 20:51:01 +00:00
|
|
|
case SHOW_CLEARANCE_NEW_TRACKS:
|
2011-09-24 18:33:28 +00:00
|
|
|
m_OptDisplayTracksClearance->SetSelection( 1 );
|
2009-06-18 20:51:01 +00:00
|
|
|
break;
|
2011-09-24 18:33:28 +00:00
|
|
|
|
2011-09-30 08:24:10 +00:00
|
|
|
case SHOW_CLEARANCE_NEW_AND_EDITED_TRACKS_AND_VIA_AREAS:
|
|
|
|
m_OptDisplayTracksClearance->SetSelection( 3 );
|
|
|
|
break;
|
|
|
|
|
2009-06-18 20:51:01 +00:00
|
|
|
default:
|
|
|
|
case SHOW_CLEARANCE_NEW_TRACKS_AND_VIA_AREAS:
|
2011-09-30 08:24:10 +00:00
|
|
|
m_OptDisplayTracksClearance->SetSelection( 2 );
|
2009-06-18 20:51:01 +00:00
|
|
|
break;
|
2011-09-24 18:33:28 +00:00
|
|
|
|
2009-06-18 20:51:01 +00:00
|
|
|
case SHOW_CLEARANCE_ALWAYS:
|
2011-09-30 08:24:10 +00:00
|
|
|
m_OptDisplayTracksClearance->SetSelection( 4 );
|
2009-06-18 20:51:01 +00:00
|
|
|
break;
|
|
|
|
}
|
2009-06-18 17:32:27 +00:00
|
|
|
|
|
|
|
if ( DisplayOpt.DisplayPadFill )
|
2011-09-30 08:24:10 +00:00
|
|
|
m_OptDisplayPads->SetSelection( 1 );
|
2009-06-18 17:32:27 +00:00
|
|
|
else
|
2011-09-30 08:24:10 +00:00
|
|
|
m_OptDisplayPads->SetSelection( 0 );
|
2009-06-18 17:32:27 +00:00
|
|
|
|
2009-09-29 04:44:35 +00:00
|
|
|
if ( DisplayOpt.DisplayViaFill )
|
2011-09-24 18:33:28 +00:00
|
|
|
m_OptDisplayVias->SetSelection( 1 );
|
2009-09-29 04:44:35 +00:00
|
|
|
else
|
2011-09-24 18:33:28 +00:00
|
|
|
m_OptDisplayVias->SetSelection( 0 );
|
2009-09-29 04:44:35 +00:00
|
|
|
|
2011-09-24 18:33:28 +00:00
|
|
|
m_Show_Page_Limits->SetSelection( g_ShowPageLimits ? 0 : 1 );
|
2009-06-18 17:32:27 +00:00
|
|
|
|
|
|
|
m_OptDisplayViaHole->SetSelection( DisplayOpt.m_DisplayViaMode );
|
|
|
|
m_OptDisplayModTexts->SetSelection( DisplayOpt.DisplayModText );
|
|
|
|
m_OptDisplayModEdges->SetSelection( DisplayOpt.DisplayModEdge );
|
|
|
|
m_OptDisplayPadClearence->SetValue( DisplayOpt.DisplayPadIsol );
|
|
|
|
m_OptDisplayPadNumber->SetValue( DisplayOpt.DisplayPadNum );
|
2011-09-24 18:33:28 +00:00
|
|
|
m_OptDisplayPadNoConn->SetValue( m_Parent->IsElementVisible( PCB_VISIBLE( NO_CONNECTS_VISIBLE ) ) );
|
2009-06-18 17:32:27 +00:00
|
|
|
m_OptDisplayDrawings->SetSelection( DisplayOpt.DisplayDrawItems );
|
2011-09-24 18:33:28 +00:00
|
|
|
m_ShowNetNamesOption->SetSelection( DisplayOpt.DisplayNetNamesMode );
|
2009-06-18 17:32:27 +00:00
|
|
|
}
|
|
|
|
|
2011-09-24 18:33:28 +00:00
|
|
|
|
2011-03-03 19:08:13 +00:00
|
|
|
void DIALOG_DISPLAY_OPTIONS::OnCancelClick( wxCommandEvent& event )
|
2009-06-18 17:32:27 +00:00
|
|
|
{
|
2011-09-24 18:33:28 +00:00
|
|
|
EndModal( 0 );
|
2009-06-18 17:32:27 +00:00
|
|
|
}
|
|
|
|
|
2011-09-24 18:33:28 +00:00
|
|
|
|
2009-06-18 17:32:27 +00:00
|
|
|
/* Update variables with new options
|
|
|
|
*/
|
2011-09-24 18:33:28 +00:00
|
|
|
void DIALOG_DISPLAY_OPTIONS::OnOkClick(wxCommandEvent& event)
|
2009-06-18 17:32:27 +00:00
|
|
|
{
|
2011-09-24 18:33:28 +00:00
|
|
|
if ( m_Show_Page_Limits->GetSelection() == 0 )
|
|
|
|
g_ShowPageLimits = true;
|
|
|
|
else
|
|
|
|
g_ShowPageLimits = FALSE;
|
2009-06-18 17:32:27 +00:00
|
|
|
|
2011-09-24 18:33:28 +00:00
|
|
|
if ( m_OptDisplayTracks->GetSelection() == 1 )
|
2011-03-03 19:08:13 +00:00
|
|
|
DisplayOpt.DisplayPcbTrackFill = true;
|
2011-09-24 18:33:28 +00:00
|
|
|
else
|
|
|
|
DisplayOpt.DisplayPcbTrackFill = FALSE;
|
2009-06-18 17:32:27 +00:00
|
|
|
|
|
|
|
m_Parent->m_DisplayPcbTrackFill = DisplayOpt.DisplayPcbTrackFill;
|
2011-09-24 18:33:28 +00:00
|
|
|
DisplayOpt.m_DisplayViaMode = (VIA_DISPLAY_MODE_T) m_OptDisplayViaHole->GetSelection();
|
2009-06-18 17:32:27 +00:00
|
|
|
|
|
|
|
switch ( m_OptDisplayTracksClearance->GetSelection() )
|
|
|
|
{
|
2009-06-18 20:51:01 +00:00
|
|
|
case 0:
|
|
|
|
DisplayOpt.ShowTrackClearanceMode = DO_NOT_SHOW_CLEARANCE;
|
2009-06-18 17:32:27 +00:00
|
|
|
break;
|
2011-09-24 18:33:28 +00:00
|
|
|
|
2009-06-18 17:32:27 +00:00
|
|
|
case 1:
|
2009-06-18 20:51:01 +00:00
|
|
|
DisplayOpt.ShowTrackClearanceMode = SHOW_CLEARANCE_NEW_TRACKS;
|
2009-06-18 17:32:27 +00:00
|
|
|
break;
|
2011-09-24 18:33:28 +00:00
|
|
|
|
2009-06-18 17:32:27 +00:00
|
|
|
case 2:
|
2009-06-18 20:51:01 +00:00
|
|
|
DisplayOpt.ShowTrackClearanceMode = SHOW_CLEARANCE_NEW_TRACKS_AND_VIA_AREAS;
|
2009-06-18 17:32:27 +00:00
|
|
|
break;
|
2011-09-24 18:33:28 +00:00
|
|
|
|
2009-06-18 20:51:01 +00:00
|
|
|
case 3:
|
2011-09-30 08:24:10 +00:00
|
|
|
DisplayOpt.ShowTrackClearanceMode = SHOW_CLEARANCE_NEW_AND_EDITED_TRACKS_AND_VIA_AREAS;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 4:
|
2009-06-18 20:51:01 +00:00
|
|
|
DisplayOpt.ShowTrackClearanceMode = SHOW_CLEARANCE_ALWAYS;
|
2009-06-18 17:32:27 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2011-09-24 18:33:28 +00:00
|
|
|
m_Parent->m_DisplayModText = DisplayOpt.DisplayModText = m_OptDisplayModTexts->GetSelection();
|
|
|
|
m_Parent->m_DisplayModEdge = DisplayOpt.DisplayModEdge = m_OptDisplayModEdges->GetSelection();
|
2009-06-18 17:32:27 +00:00
|
|
|
|
|
|
|
if (m_OptDisplayPads->GetSelection() == 1 )
|
|
|
|
DisplayOpt.DisplayPadFill = true;
|
|
|
|
else
|
|
|
|
DisplayOpt.DisplayPadFill = false;
|
|
|
|
|
2009-09-29 04:44:35 +00:00
|
|
|
if (m_OptDisplayVias->GetSelection() == 1 )
|
|
|
|
DisplayOpt.DisplayViaFill = true;
|
|
|
|
else
|
|
|
|
DisplayOpt.DisplayViaFill = false;
|
|
|
|
|
2009-06-18 17:32:27 +00:00
|
|
|
m_Parent->m_DisplayPadFill = DisplayOpt.DisplayPadFill;
|
2009-09-29 04:44:35 +00:00
|
|
|
m_Parent->m_DisplayViaFill = DisplayOpt.DisplayViaFill;
|
2009-06-18 17:32:27 +00:00
|
|
|
|
|
|
|
DisplayOpt.DisplayPadIsol = m_OptDisplayPadClearence->GetValue();
|
|
|
|
|
|
|
|
m_Parent->m_DisplayPadNum = DisplayOpt.DisplayPadNum = m_OptDisplayPadNumber->GetValue();
|
|
|
|
|
2010-01-30 20:17:56 +00:00
|
|
|
m_Parent->SetElementVisibility( PCB_VISIBLE(NO_CONNECTS_VISIBLE),
|
2011-09-24 18:33:28 +00:00
|
|
|
m_OptDisplayPadNoConn->GetValue() );
|
2009-06-18 17:32:27 +00:00
|
|
|
|
|
|
|
DisplayOpt.DisplayDrawItems = m_OptDisplayDrawings->GetSelection();
|
|
|
|
DisplayOpt.DisplayNetNamesMode = m_ShowNetNamesOption->GetSelection();
|
|
|
|
|
2011-12-22 13:28:11 +00:00
|
|
|
m_Parent->GetCanvas()->Refresh();
|
2009-06-18 17:32:27 +00:00
|
|
|
|
2011-09-24 18:33:28 +00:00
|
|
|
EndModal( 1 );
|
2009-06-18 17:32:27 +00:00
|
|
|
}
|