2018-05-14 17:34:18 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2020-02-13 14:19:40 +00:00
|
|
|
* Copyright (C) 2009 Wayne Stambaugh <stambaughw@gmail.com>
|
|
|
|
* Copyright (C) 1992-2020 KiCad Developers, see AUTHORS.txt for contributors.
|
2018-05-14 17:34:18 +00:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, you may find one here:
|
|
|
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
|
|
* or you may search the http://www.gnu.org website for the version 2 license,
|
|
|
|
* or you may write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <fctsys.h>
|
|
|
|
#include <base_screen.h>
|
2018-08-29 18:31:43 +00:00
|
|
|
#include <sch_view.h>
|
2018-05-14 17:34:18 +00:00
|
|
|
#include <sch_edit_frame.h>
|
2018-08-29 18:31:43 +00:00
|
|
|
#include <sch_painter.h>
|
2018-05-14 17:34:18 +00:00
|
|
|
#include <class_libentry.h>
|
|
|
|
#include <panel_eeschema_display_options.h>
|
2018-09-04 00:00:17 +00:00
|
|
|
#include <widgets/gal_options_panel.h>
|
2018-09-09 23:04:42 +00:00
|
|
|
#include <sch_junction.h>
|
2020-01-09 00:13:02 +00:00
|
|
|
#include <gr_text.h>
|
2018-05-14 17:34:18 +00:00
|
|
|
|
|
|
|
PANEL_EESCHEMA_DISPLAY_OPTIONS::PANEL_EESCHEMA_DISPLAY_OPTIONS( SCH_EDIT_FRAME* aFrame,
|
|
|
|
wxWindow* aWindow ) :
|
|
|
|
PANEL_EESCHEMA_DISPLAY_OPTIONS_BASE( aWindow ),
|
2019-06-30 10:12:18 +00:00
|
|
|
m_frame( aFrame ),
|
|
|
|
m_busWidth( aFrame, m_busWidthLabel, m_busWidthCtrl, m_busWidthUnits, true ),
|
|
|
|
m_wireWidth( aFrame, m_wireWidthLabel, m_wireWidthCtrl, m_wireWidthUnits, true ),
|
|
|
|
m_junctionSize( aFrame, m_jctSizeLabel, m_jctSizeCtrl, m_jctSizeUnits, true )
|
2018-05-14 17:34:18 +00:00
|
|
|
{
|
2018-09-04 00:00:17 +00:00
|
|
|
KIGFX::GAL_DISPLAY_OPTIONS& galOptions = m_frame->GetGalDisplayOptions();
|
|
|
|
m_galOptsPanel = new GAL_OPTIONS_PANEL( this, galOptions );
|
2018-05-14 17:34:18 +00:00
|
|
|
|
2018-09-04 00:00:17 +00:00
|
|
|
m_galOptionsSizer->Add( m_galOptsPanel, 1, wxEXPAND, 0 );
|
2019-12-11 20:49:58 +00:00
|
|
|
|
|
|
|
wxFont infoFont = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT );
|
|
|
|
infoFont.SetSymbolicSize( wxFONTSIZE_SMALL );
|
|
|
|
m_highlightColorNote->SetFont( infoFont );
|
2018-09-04 00:00:17 +00:00
|
|
|
}
|
2018-05-14 17:34:18 +00:00
|
|
|
|
|
|
|
|
2018-09-04 00:00:17 +00:00
|
|
|
bool PANEL_EESCHEMA_DISPLAY_OPTIONS::TransferDataToWindow()
|
|
|
|
{
|
2018-05-14 17:34:18 +00:00
|
|
|
// Reference style one of: "A" ".A" "-A" "_A" ".1" "-1" "_1"
|
|
|
|
int refStyleSelection;
|
|
|
|
|
|
|
|
switch( LIB_PART::GetSubpartIdSeparator() )
|
|
|
|
{
|
|
|
|
default:
|
|
|
|
case 0: refStyleSelection = 0; break;
|
|
|
|
case '.': refStyleSelection = LIB_PART::GetSubpartFirstId() == '1' ? 4 : 1; break;
|
|
|
|
case '-': refStyleSelection = LIB_PART::GetSubpartFirstId() == '1' ? 5 : 2; break;
|
|
|
|
case '_': refStyleSelection = LIB_PART::GetSubpartFirstId() == '1' ? 6 : 3; break;
|
|
|
|
}
|
|
|
|
|
|
|
|
m_choiceSeparatorRefId->SetSelection( refStyleSelection );
|
|
|
|
|
2019-12-20 14:11:39 +00:00
|
|
|
m_busWidth.SetUnits( EDA_UNITS::INCHES, true );
|
|
|
|
m_wireWidth.SetUnits( EDA_UNITS::INCHES, true );
|
|
|
|
m_junctionSize.SetUnits( EDA_UNITS::INCHES, true );
|
2019-06-30 10:12:18 +00:00
|
|
|
|
|
|
|
m_busWidth.SetValue( GetDefaultBusThickness() );
|
|
|
|
m_wireWidth.SetValue( GetDefaultWireThickness() );
|
|
|
|
m_junctionSize.SetValue( SCH_JUNCTION::GetSymbolSize() );
|
2018-05-14 17:34:18 +00:00
|
|
|
m_checkShowHiddenPins->SetValue( m_frame->GetShowAllPins() );
|
2019-10-21 18:03:54 +00:00
|
|
|
|
2020-01-09 00:13:02 +00:00
|
|
|
int superSubFlags = ENABLE_SUBSCRIPT_MARKUP | ENABLE_SUPERSCRIPT_MARKUP;
|
2019-10-21 18:03:54 +00:00
|
|
|
|
|
|
|
m_checkSuperSub->SetValue( GetTextMarkupFlags() & superSubFlags );
|
|
|
|
|
2018-05-14 17:34:18 +00:00
|
|
|
m_checkPageLimits->SetValue( m_frame->ShowPageLimits() );
|
2018-09-04 00:00:17 +00:00
|
|
|
|
2019-11-21 15:48:44 +00:00
|
|
|
m_checkSelTextBox->SetValue( GetSelectionTextAsBox() );
|
|
|
|
m_checkSelDrawChildItems->SetValue( GetSelectionDrawChildItems() );
|
|
|
|
m_checkSelFillShapes->SetValue( GetSelectionFillShapes() );
|
2020-02-13 14:19:40 +00:00
|
|
|
m_selWidthCtrl->SetValue( Iu2Mils( GetSelectionThickness() ) );
|
2019-11-21 15:48:44 +00:00
|
|
|
|
2018-09-04 00:00:17 +00:00
|
|
|
m_galOptsPanel->TransferDataToWindow();
|
2018-05-14 17:34:18 +00:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool PANEL_EESCHEMA_DISPLAY_OPTIONS::TransferDataFromWindow()
|
|
|
|
{
|
|
|
|
// Reference style one of: "A" ".A" "-A" "_A" ".1" "-1" "_1"
|
|
|
|
int firstRefId, refSeparator;
|
|
|
|
|
|
|
|
switch( m_choiceSeparatorRefId->GetSelection() )
|
|
|
|
{
|
|
|
|
default:
|
|
|
|
case 0: firstRefId = 'A'; refSeparator = 0; break;
|
|
|
|
case 1: firstRefId = 'A'; refSeparator = '.'; break;
|
|
|
|
case 2: firstRefId = 'A'; refSeparator = '-'; break;
|
|
|
|
case 3: firstRefId = 'A'; refSeparator = '_'; break;
|
|
|
|
case 4: firstRefId = '1'; refSeparator = '.'; break;
|
|
|
|
case 5: firstRefId = '1'; refSeparator = '-'; break;
|
|
|
|
case 6: firstRefId = '1'; refSeparator = '_'; break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( refSeparator != LIB_PART::GetSubpartIdSeparator() ||
|
|
|
|
firstRefId != LIB_PART::GetSubpartFirstId() )
|
|
|
|
{
|
|
|
|
LIB_PART::SetSubpartIdNotation( refSeparator, firstRefId );
|
|
|
|
m_frame->SaveProjectSettings( false );
|
|
|
|
}
|
|
|
|
|
2019-06-30 10:12:18 +00:00
|
|
|
SetDefaultBusThickness( m_busWidth.GetValue() );
|
|
|
|
SetDefaultWireThickness( m_wireWidth.GetValue() );
|
|
|
|
SCH_JUNCTION::SetSymbolSize( m_junctionSize.GetValue() );
|
2018-05-14 17:34:18 +00:00
|
|
|
m_frame->SetShowAllPins( m_checkShowHiddenPins->GetValue() );
|
|
|
|
m_frame->SetShowPageLimits( m_checkPageLimits->GetValue() );
|
2019-11-21 15:48:44 +00:00
|
|
|
SetSelectionTextAsBox( m_checkSelTextBox->GetValue() );
|
|
|
|
SetSelectionDrawChildItems( m_checkSelDrawChildItems->GetValue() );
|
|
|
|
SetSelectionFillShapes( m_checkSelFillShapes->GetValue() );
|
2020-02-13 14:19:40 +00:00
|
|
|
SetSelectionThickness( Mils2iu( m_selWidthCtrl->GetValue() ) );
|
2018-05-14 17:34:18 +00:00
|
|
|
|
2018-09-02 20:19:22 +00:00
|
|
|
// Update canvas
|
|
|
|
m_frame->GetRenderSettings()->m_ShowHiddenPins = m_checkShowHiddenPins->GetValue();
|
2019-10-21 18:03:54 +00:00
|
|
|
|
2020-01-09 00:13:02 +00:00
|
|
|
int superSubFlags = ENABLE_SUBSCRIPT_MARKUP | ENABLE_SUPERSCRIPT_MARKUP;
|
2019-10-21 18:03:54 +00:00
|
|
|
|
|
|
|
if( m_checkSuperSub->GetValue() )
|
|
|
|
SetTextMarkupFlags( GetTextMarkupFlags() | superSubFlags );
|
|
|
|
else
|
|
|
|
SetTextMarkupFlags( GetTextMarkupFlags() & ~superSubFlags );
|
|
|
|
|
2018-11-08 08:57:16 +00:00
|
|
|
m_frame->GetRenderSettings()->SetShowPageLimits( m_checkPageLimits->GetValue() );
|
2018-09-02 20:19:22 +00:00
|
|
|
m_frame->GetCanvas()->GetView()->MarkDirty();
|
2019-02-20 02:17:14 +00:00
|
|
|
m_frame->GetCanvas()->GetView()->UpdateAllItems( KIGFX::REPAINT );
|
2018-09-02 20:19:22 +00:00
|
|
|
m_frame->GetCanvas()->Refresh();
|
2018-08-29 18:31:43 +00:00
|
|
|
|
2018-09-04 00:00:17 +00:00
|
|
|
m_galOptsPanel->TransferDataFromWindow();
|
|
|
|
|
2018-05-14 17:34:18 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|