Gerbview: rename diff mode by forced opacity display mode and make opacity adjustable.
The diff mode (option in left toolbar) was never a differential display mode. It is actually an option to force the alpha channel (opacity) of layer colors to a given value. So change the name and tool tips to force opacity mode, and make the opacity parameter adjustable in preferences. Gerbview: cleanup: remove a old and dead code.
This commit is contained in:
parent
55b2c4dbf4
commit
93bd2c73ff
|
@ -59,6 +59,7 @@ void PANEL_GERBVIEW_DISPLAY_OPTIONS::loadSettings( GERBVIEW_SETTINGS* aCfg )
|
|||
m_OptDisplayLines->SetValue( !aCfg->m_Display.m_DisplayLinesFill );
|
||||
m_OptDisplayFlashedItems->SetValue( !aCfg->m_Display.m_DisplayFlashedItemsFill );
|
||||
m_OptDisplayDCodes->SetValue( aCfg->m_Appearance.show_dcodes );
|
||||
m_spOpacityCtrl->SetValue( aCfg->m_Display.m_OpacityModeAlphaValue );
|
||||
|
||||
for( unsigned i = 0; i < arrayDim( gerberPageSizeList ); ++i )
|
||||
{
|
||||
|
@ -98,6 +99,7 @@ bool PANEL_GERBVIEW_DISPLAY_OPTIONS::TransferDataFromWindow()
|
|||
|
||||
cfg->m_Appearance.page_type = gerberPageSizeList[ m_PageSize->GetSelection() ];
|
||||
cfg->m_Display.m_DisplayPageLimits = m_ShowPageLimitsOpt->GetValue();
|
||||
cfg->m_Display.m_OpacityModeAlphaValue = m_spOpacityCtrl->GetValue();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version 3.10.0-39-g3487c3cb)
|
||||
// C++ code generated with wxFormBuilder (version 4.0.0-0-g0efcecf02)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||
|
@ -58,14 +58,35 @@ PANEL_GERBVIEW_DISPLAY_OPTIONS_BASE::PANEL_GERBVIEW_DISPLAY_OPTIONS_BASE( wxWind
|
|||
bDrawingModeSizer = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_OptDisplayFlashedItems = new wxCheckBox( this, wxID_ANY, _("Sketch flashed items"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_OptDisplayFlashedItems->SetToolTip( _("Display flashed items (items drawn using standard or macro apertures) in outlines mode") );
|
||||
|
||||
bDrawingModeSizer->Add( m_OptDisplayFlashedItems, 0, wxALL, 5 );
|
||||
|
||||
m_OptDisplayLines = new wxCheckBox( this, wxID_ANY, _("Sketch lines"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bDrawingModeSizer->Add( m_OptDisplayLines, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_OptDisplayPolygons = new wxCheckBox( this, wxID_ANY, _("Sketch polygons"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_OptDisplayPolygons->SetValue(true);
|
||||
m_OptDisplayPolygons->SetToolTip( _("Display polygon items in outline mode") );
|
||||
|
||||
bDrawingModeSizer->Add( m_OptDisplayPolygons, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
wxStaticBoxSizer* sbSizerOpacity;
|
||||
sbSizerOpacity = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Forced Opacity Display Mode") ), wxHORIZONTAL );
|
||||
|
||||
m_staticTextOpacity = new wxStaticText( sbSizerOpacity->GetStaticBox(), wxID_ANY, _("Forced opacity:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticTextOpacity->Wrap( -1 );
|
||||
m_staticTextOpacity->SetToolTip( _("Opacity in forced opacity display mode") );
|
||||
|
||||
sbSizerOpacity->Add( m_staticTextOpacity, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
m_spOpacityCtrl = new wxSpinCtrlDouble( sbSizerOpacity->GetStaticBox(), wxID_ANY, wxT("0.6"), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0.2, 1, 0.600000, 0.1 );
|
||||
m_spOpacityCtrl->SetDigits( 2 );
|
||||
sbSizerOpacity->Add( m_spOpacityCtrl, 0, wxALL, 5 );
|
||||
|
||||
|
||||
bDrawingModeSizer->Add( sbSizerOpacity, 1, wxEXPAND|wxTOP, 5 );
|
||||
|
||||
|
||||
bRightSizer->Add( bDrawingModeSizer, 0, wxEXPAND|wxTOP|wxLEFT, 5 );
|
||||
|
||||
|
@ -106,7 +127,6 @@ PANEL_GERBVIEW_DISPLAY_OPTIONS_BASE::PANEL_GERBVIEW_DISPLAY_OPTIONS_BASE( wxWind
|
|||
|
||||
this->SetSizer( bDialogSizer );
|
||||
this->Layout();
|
||||
bDialogSizer->Fit( this );
|
||||
}
|
||||
|
||||
PANEL_GERBVIEW_DISPLAY_OPTIONS_BASE::~PANEL_GERBVIEW_DISPLAY_OPTIONS_BASE()
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,5 +1,5 @@
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version 3.10.0-39-g3487c3cb)
|
||||
// C++ code generated with wxFormBuilder (version 4.0.0-0-g0efcecf02)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||
|
@ -20,6 +20,8 @@
|
|||
#include <wx/settings.h>
|
||||
#include <wx/statline.h>
|
||||
#include <wx/checkbox.h>
|
||||
#include <wx/spinctrl.h>
|
||||
#include <wx/statbox.h>
|
||||
#include <wx/radiobox.h>
|
||||
#include <wx/panel.h>
|
||||
|
||||
|
@ -45,13 +47,15 @@ class PANEL_GERBVIEW_DISPLAY_OPTIONS_BASE : public RESETTABLE_PANEL
|
|||
wxCheckBox* m_OptDisplayFlashedItems;
|
||||
wxCheckBox* m_OptDisplayLines;
|
||||
wxCheckBox* m_OptDisplayPolygons;
|
||||
wxStaticText* m_staticTextOpacity;
|
||||
wxSpinCtrlDouble* m_spOpacityCtrl;
|
||||
wxStaticText* m_staticText3;
|
||||
wxStaticLine* m_staticline3;
|
||||
wxRadioBox* m_PageSize;
|
||||
|
||||
public:
|
||||
|
||||
PANEL_GERBVIEW_DISPLAY_OPTIONS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString );
|
||||
PANEL_GERBVIEW_DISPLAY_OPTIONS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 257,534 ), long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString );
|
||||
|
||||
~PANEL_GERBVIEW_DISPLAY_OPTIONS_BASE();
|
||||
|
||||
|
|
|
@ -40,13 +40,14 @@ public:
|
|||
bool m_DisplayPolygonsFill; ///< Option to draw polygons (filled/sketch)
|
||||
bool m_DisplayPageLimits;
|
||||
bool m_IsPrinting; ///< true when printing a page, false when drawing on screen
|
||||
bool m_DiffMode; ///< Display layers in diff mode
|
||||
bool m_ForceOpacityMode; ///< Display layers in transparency (alpha channel) forced mode
|
||||
bool m_XORMode; ///< Display layers in exclusive-or mode
|
||||
bool m_HighContrastMode; ///< High contrast mode (dim un-highlighted objects)
|
||||
bool m_FlipGerberView; ///< Display as a mirror image
|
||||
COLOR4D m_NegativeDrawColor; ///< The color used to draw negative objects, usually the
|
||||
///< background color, but not always, when negative objects
|
||||
///< must be visible
|
||||
double m_OpacityModeAlphaValue; ///< the alpha channel (opacity) value in opacity forced mode
|
||||
|
||||
public:
|
||||
GBR_DISPLAY_OPTIONS()
|
||||
|
@ -57,7 +58,8 @@ public:
|
|||
m_DisplayPageLimits = false;
|
||||
m_IsPrinting = false;
|
||||
m_NegativeDrawColor = COLOR4D( DARKGRAY );
|
||||
m_DiffMode = false;
|
||||
m_ForceOpacityMode = false;
|
||||
m_OpacityModeAlphaValue = 0.6;
|
||||
m_XORMode = false;
|
||||
m_HighContrastMode = false;
|
||||
m_FlipGerberView = false;
|
||||
|
|
|
@ -1146,10 +1146,10 @@ void GERBVIEW_FRAME::setupUIConditions()
|
|||
return gvconfig()->m_Appearance.show_dcodes;
|
||||
};
|
||||
|
||||
auto diffModeCond =
|
||||
auto forceOpacityModeCond =
|
||||
[this] ( const SELECTION& )
|
||||
{
|
||||
return gvconfig()->m_Display.m_DiffMode;
|
||||
return gvconfig()->m_Display.m_ForceOpacityMode;
|
||||
};
|
||||
|
||||
auto xorModeCond =
|
||||
|
@ -1181,7 +1181,7 @@ void GERBVIEW_FRAME::setupUIConditions()
|
|||
mgr->SetConditions( GERBVIEW_ACTIONS::polygonsDisplayOutlines, CHECK( polygonsFilledCond ) );
|
||||
mgr->SetConditions( GERBVIEW_ACTIONS::negativeObjectDisplay, CHECK( negativeObjectsCond ) );
|
||||
mgr->SetConditions( GERBVIEW_ACTIONS::dcodeDisplay, CHECK( dcodeCond ) );
|
||||
mgr->SetConditions( GERBVIEW_ACTIONS::toggleDiffMode, CHECK( diffModeCond ) );
|
||||
mgr->SetConditions( GERBVIEW_ACTIONS::toggleForceOpacityMode, CHECK( forceOpacityModeCond ) );
|
||||
mgr->SetConditions( GERBVIEW_ACTIONS::toggleXORMode, CHECK( xorModeCond ) );
|
||||
mgr->SetConditions( GERBVIEW_ACTIONS::flipGerberView, CHECK( flipGerberCond ) );
|
||||
mgr->SetConditions( ACTIONS::highContrastMode, CHECK( highContrastModeCond ) );
|
||||
|
|
|
@ -229,19 +229,11 @@ public:
|
|||
*/
|
||||
void OnSelectActiveLayer( wxCommandEvent& event );
|
||||
|
||||
/**
|
||||
* Called on a display mode selection.
|
||||
*
|
||||
* Mode selection can be fast display or exact mode with stacked images or with transparency.
|
||||
*/
|
||||
void OnSelectDisplayMode( wxCommandEvent& event );
|
||||
|
||||
/**
|
||||
* Called on request of application quit.
|
||||
*/
|
||||
void OnQuit( wxCommandEvent& event );
|
||||
|
||||
void OnUpdateDrawMode( wxUpdateUIEvent& aEvent );
|
||||
void OnUpdateSelectDCode( wxUpdateUIEvent& aEvent );
|
||||
void OnUpdateLayerSelectBox( wxUpdateUIEvent& aEvent );
|
||||
|
||||
|
|
|
@ -62,8 +62,8 @@ void GERBVIEW_RENDER_SETTINGS::LoadColors( const COLOR_SETTINGS* aSettings )
|
|||
{
|
||||
COLOR4D baseColor = aSettings->GetColor( i );
|
||||
|
||||
if( gvconfig()->m_Display.m_DiffMode )
|
||||
baseColor.a = 0.75;
|
||||
if( gvconfig()->m_Display.m_ForceOpacityMode )
|
||||
baseColor.a = gvconfig()->m_Display.m_OpacityModeAlphaValue;
|
||||
|
||||
m_layerColors[i] = baseColor;
|
||||
m_layerColorsHi[i] = baseColor.Brightened( 0.5 );
|
||||
|
|
|
@ -56,6 +56,9 @@ GERBVIEW_SETTINGS::GERBVIEW_SETTINGS() :
|
|||
m_params.emplace_back( new PARAM<bool>( "appearance.show_page_limit",
|
||||
&m_Display.m_DisplayPageLimits, false ) );
|
||||
|
||||
m_params.emplace_back( new PARAM<double>( "appearance.mode_opacity_value",
|
||||
&m_Display.m_OpacityModeAlphaValue, 0.6 ) );
|
||||
|
||||
m_params.emplace_back( new PARAM_LIST<wxString>( "system.drill_file_history",
|
||||
&m_DrillFileHistory, {} ) );
|
||||
|
||||
|
|
|
@ -195,7 +195,7 @@ void GERBVIEW_FRAME::doReCreateMenuBar()
|
|||
viewMenu->Add( GERBVIEW_ACTIONS::polygonsDisplayOutlines, ACTION_MENU::CHECK );
|
||||
viewMenu->Add( GERBVIEW_ACTIONS::dcodeDisplay, ACTION_MENU::CHECK );
|
||||
viewMenu->Add( GERBVIEW_ACTIONS::negativeObjectDisplay, ACTION_MENU::CHECK );
|
||||
viewMenu->Add( GERBVIEW_ACTIONS::toggleDiffMode, ACTION_MENU::CHECK );
|
||||
viewMenu->Add( GERBVIEW_ACTIONS::toggleForceOpacityMode, ACTION_MENU::CHECK );
|
||||
viewMenu->Add( GERBVIEW_ACTIONS::toggleXORMode, ACTION_MENU::CHECK );
|
||||
viewMenu->Add( ACTIONS::highContrastMode, ACTION_MENU::CHECK );
|
||||
viewMenu->Add( GERBVIEW_ACTIONS::flipGerberView, ACTION_MENU::CHECK );
|
||||
|
|
|
@ -256,7 +256,7 @@ void GERBVIEW_FRAME::ReCreateOptToolbar()
|
|||
m_optionsToolBar->Add( GERBVIEW_ACTIONS::negativeObjectDisplay, ACTION_TOOLBAR::TOGGLE );
|
||||
m_optionsToolBar->Add( GERBVIEW_ACTIONS::dcodeDisplay, ACTION_TOOLBAR::TOGGLE );
|
||||
m_optionsToolBar->AddScaledSeparator( this );
|
||||
m_optionsToolBar->Add( GERBVIEW_ACTIONS::toggleDiffMode, ACTION_TOOLBAR::TOGGLE );
|
||||
m_optionsToolBar->Add( GERBVIEW_ACTIONS::toggleForceOpacityMode, ACTION_TOOLBAR::TOGGLE );
|
||||
m_optionsToolBar->Add( GERBVIEW_ACTIONS::toggleXORMode, ACTION_TOOLBAR::TOGGLE );
|
||||
m_optionsToolBar->Add( ACTIONS::highContrastMode, ACTION_TOOLBAR::TOGGLE );
|
||||
m_optionsToolBar->Add( GERBVIEW_ACTIONS::flipGerberView, ACTION_TOOLBAR::TOGGLE );
|
||||
|
|
|
@ -228,11 +228,11 @@ TOOL_ACTION GERBVIEW_ACTIONS::dcodeDisplay( TOOL_ACTION_ARGS()
|
|||
.Tooltip( _( "Show dcode number" ) )
|
||||
.Icon( BITMAPS::show_dcodenumber ) );
|
||||
|
||||
TOOL_ACTION GERBVIEW_ACTIONS::toggleDiffMode( TOOL_ACTION_ARGS()
|
||||
.Name( "gerbview.Control.toggleDiffMode" )
|
||||
TOOL_ACTION GERBVIEW_ACTIONS::toggleForceOpacityMode( TOOL_ACTION_ARGS()
|
||||
.Name( "gerbview.Control.toggleForceOpacityMode" )
|
||||
.Scope( AS_GLOBAL )
|
||||
.FriendlyName( _( "Show in Differential Mode" ) )
|
||||
.Tooltip( _( "Show layers in differential compare mode" ) )
|
||||
.FriendlyName( _( "Show with Forced Opacity Mode" ) )
|
||||
.Tooltip( _( "Show layers using opacity color forced mode" ) )
|
||||
.Icon( BITMAPS::gbr_select_mode1 ) );
|
||||
|
||||
TOOL_ACTION GERBVIEW_ACTIONS::toggleXORMode( TOOL_ACTION_ARGS()
|
||||
|
|
|
@ -63,7 +63,7 @@ public:
|
|||
static TOOL_ACTION polygonsDisplayOutlines;
|
||||
static TOOL_ACTION negativeObjectDisplay;
|
||||
static TOOL_ACTION dcodeDisplay;
|
||||
static TOOL_ACTION toggleDiffMode;
|
||||
static TOOL_ACTION toggleForceOpacityMode;
|
||||
static TOOL_ACTION toggleXORMode;
|
||||
static TOOL_ACTION flipGerberView;
|
||||
|
||||
|
|
|
@ -300,11 +300,11 @@ int GERBVIEW_CONTROL::DisplayControl( const TOOL_EVENT& aEvent )
|
|||
{
|
||||
cfg->m_Display.m_HighContrastMode = !cfg->m_Display.m_HighContrastMode;
|
||||
}
|
||||
else if( aEvent.IsAction( &GERBVIEW_ACTIONS::toggleDiffMode ) )
|
||||
else if( aEvent.IsAction( &GERBVIEW_ACTIONS::toggleForceOpacityMode ) )
|
||||
{
|
||||
cfg->m_Display.m_DiffMode = !cfg->m_Display.m_DiffMode;
|
||||
cfg->m_Display.m_ForceOpacityMode = !cfg->m_Display.m_ForceOpacityMode;
|
||||
|
||||
if( cfg->m_Display.m_DiffMode && cfg->m_Display.m_XORMode )
|
||||
if( cfg->m_Display.m_ForceOpacityMode && cfg->m_Display.m_XORMode )
|
||||
cfg->m_Display.m_XORMode = false;
|
||||
|
||||
m_frame->UpdateXORLayers();
|
||||
|
@ -313,8 +313,8 @@ int GERBVIEW_CONTROL::DisplayControl( const TOOL_EVENT& aEvent )
|
|||
{
|
||||
cfg->m_Display.m_XORMode = !cfg->m_Display.m_XORMode;
|
||||
|
||||
if( cfg->m_Display.m_XORMode && cfg->m_Display.m_DiffMode )
|
||||
cfg->m_Display.m_DiffMode = false;
|
||||
if( cfg->m_Display.m_XORMode && cfg->m_Display.m_ForceOpacityMode )
|
||||
cfg->m_Display.m_ForceOpacityMode = false;
|
||||
|
||||
m_frame->UpdateXORLayers();
|
||||
}
|
||||
|
@ -541,7 +541,7 @@ void GERBVIEW_CONTROL::setTransitions()
|
|||
Go( &GERBVIEW_CONTROL::DisplayControl, GERBVIEW_ACTIONS::dcodeDisplay.MakeEvent() );
|
||||
Go( &GERBVIEW_CONTROL::DisplayControl, ACTIONS::highContrastMode.MakeEvent() );
|
||||
Go( &GERBVIEW_CONTROL::DisplayControl, ACTIONS::highContrastModeCycle.MakeEvent() );
|
||||
Go( &GERBVIEW_CONTROL::DisplayControl, GERBVIEW_ACTIONS::toggleDiffMode.MakeEvent() );
|
||||
Go( &GERBVIEW_CONTROL::DisplayControl, GERBVIEW_ACTIONS::toggleForceOpacityMode.MakeEvent() );
|
||||
Go( &GERBVIEW_CONTROL::DisplayControl, GERBVIEW_ACTIONS::toggleXORMode.MakeEvent() );
|
||||
Go( &GERBVIEW_CONTROL::DisplayControl, GERBVIEW_ACTIONS::flipGerberView.MakeEvent() );
|
||||
|
||||
|
|
Loading…
Reference in New Issue