tools: added TOOL_SETTINGS class for storing persistent tool settings in config file (just a wrapper for wxConfigBase) router: free angle mode (mark obstacles only) & persistent settings
This commit is contained in:
parent
7724c581fd
commit
a86fda1d37
|
@ -25,6 +25,8 @@
|
|||
#include <tool/tool_event.h>
|
||||
#include <tool/tool_manager.h>
|
||||
|
||||
#include <wxPcbStruct.h> // LAME!
|
||||
|
||||
KIGFX::VIEW* TOOL_BASE::getView() const
|
||||
{
|
||||
return m_toolMgr->GetView();
|
||||
|
@ -47,3 +49,43 @@ EDA_ITEM* TOOL_BASE::getModelInt() const
|
|||
{
|
||||
return m_toolMgr->GetModel();
|
||||
}
|
||||
|
||||
void TOOL_BASE::attachManager( TOOL_MANAGER* aManager )
|
||||
{
|
||||
m_toolMgr = aManager;
|
||||
m_toolSettings = TOOL_SETTINGS ( this );
|
||||
}
|
||||
|
||||
TOOL_SETTINGS::TOOL_SETTINGS ( TOOL_BASE *aTool )
|
||||
{
|
||||
m_tool = aTool;
|
||||
|
||||
if(!aTool)
|
||||
{
|
||||
m_config = NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
// fixme: make independent of pcbnew (post-stable)
|
||||
PCB_EDIT_FRAME *frame = aTool->getEditFrame<PCB_EDIT_FRAME> ();
|
||||
|
||||
m_config = frame->GetSettings();
|
||||
}
|
||||
|
||||
TOOL_SETTINGS::~TOOL_SETTINGS ()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
TOOL_SETTINGS& TOOL_BASE::GetSettings()
|
||||
{
|
||||
return m_toolSettings;
|
||||
}
|
||||
|
||||
wxString TOOL_SETTINGS::getKeyName(const wxString& entryName) const
|
||||
{
|
||||
wxString key ( m_tool->GetName() );
|
||||
key += wxT(".");
|
||||
key += entryName;
|
||||
return key;
|
||||
}
|
||||
|
|
|
@ -236,7 +236,7 @@ void TOOL_MANAGER::RegisterTool( TOOL_BASE* aTool )
|
|||
m_toolIdIndex[aTool->GetId()] = st;
|
||||
m_toolTypes[typeid( *aTool ).name()] = st->theTool;
|
||||
|
||||
aTool->m_toolMgr = this;
|
||||
aTool->attachManager( this );
|
||||
|
||||
if( !aTool->Init() )
|
||||
{
|
||||
|
|
|
@ -29,6 +29,8 @@
|
|||
#include <base_struct.h> // for KICAD_T
|
||||
|
||||
#include <tool/tool_event.h>
|
||||
#include <tool/tool_settings.h>
|
||||
|
||||
#include <tool/delegate.h>
|
||||
|
||||
class EDA_ITEM;
|
||||
|
@ -147,8 +149,11 @@ public:
|
|||
*/
|
||||
virtual void SetTransitions() {};
|
||||
|
||||
TOOL_SETTINGS& GetSettings();
|
||||
|
||||
protected:
|
||||
friend class TOOL_MANAGER;
|
||||
friend class TOOL_SETTINGS;
|
||||
|
||||
/**
|
||||
* Function attachManager()
|
||||
|
@ -209,6 +214,7 @@ protected:
|
|||
///> (eg. pcbnew.InteractiveSelection).
|
||||
std::string m_toolName;
|
||||
TOOL_MANAGER* m_toolMgr;
|
||||
TOOL_SETTINGS m_toolSettings;
|
||||
|
||||
private:
|
||||
// hide the implementation to avoid spreading half of
|
||||
|
|
|
@ -0,0 +1,74 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2015 CERN
|
||||
* @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __TOOL_SETTINGS_H
|
||||
#define __TOOL_SETTINGS_H
|
||||
|
||||
#include <wx/confbase.h>
|
||||
|
||||
/**
|
||||
* Class TOOL_SETTINGS
|
||||
*
|
||||
* Manages persistent settings for a tool (just a simple wrapper to wxConfigBase)
|
||||
*/
|
||||
class TOOL_BASE;
|
||||
|
||||
class TOOL_SETTINGS
|
||||
{
|
||||
public:
|
||||
TOOL_SETTINGS ( TOOL_BASE *aTool = NULL );
|
||||
~TOOL_SETTINGS ();
|
||||
|
||||
template <class T>
|
||||
T Get( const wxString& aName, T aDefaultValue ) const
|
||||
{
|
||||
if(!m_config)
|
||||
return aDefaultValue;
|
||||
|
||||
T tmp = aDefaultValue;
|
||||
|
||||
m_config->Read ( getKeyName( aName ), &tmp );
|
||||
return tmp;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void Set( const wxString& aName, const T &aValue )
|
||||
{
|
||||
if(!m_config)
|
||||
return;
|
||||
|
||||
m_config->Write ( getKeyName( aName ), aValue );
|
||||
}
|
||||
|
||||
private:
|
||||
wxString getKeyName(const wxString& entryName) const;
|
||||
|
||||
wxConfigBase *m_config;
|
||||
TOOL_BASE *m_tool;
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif
|
|
@ -395,6 +395,8 @@ public:
|
|||
|
||||
void SaveSettings( wxConfigBase* aCfg ); // override virtual
|
||||
|
||||
wxConfigBase *GetSettings() { return config(); };
|
||||
|
||||
/**
|
||||
* Get the last net list read with the net list dialog box.
|
||||
*
|
||||
|
|
|
@ -41,6 +41,8 @@ DIALOG_PNS_SETTINGS::DIALOG_PNS_SETTINGS( wxWindow* aParent, PNS_ROUTING_SETTING
|
|||
m_effort->SetValue( m_settings.OptimizerEffort() );
|
||||
m_smoothDragged->SetValue( m_settings.SmoothDraggedSegments() );
|
||||
m_violateDrc->SetValue( m_settings.CanViolateDRC() );
|
||||
m_freeAngleMode->SetValue( m_settings.GetFreeAngleMode() );
|
||||
|
||||
|
||||
SetDefaultItem( m_stdButtonsOK );
|
||||
GetSizer()->Fit( this );
|
||||
|
@ -67,6 +69,7 @@ void DIALOG_PNS_SETTINGS::OnOkClick( wxCommandEvent& aEvent )
|
|||
m_settings.SetOptimizerEffort( (PNS_OPTIMIZATION_EFFORT) m_effort->GetValue() );
|
||||
m_settings.SetSmoothDraggedSegments( m_smoothDragged->GetValue() );
|
||||
m_settings.SetCanViolateDRC( m_violateDrc->GetValue() );
|
||||
m_settings.SetFreeAngleMode( m_freeAngleMode->GetValue() );
|
||||
|
||||
EndModal( 1 );
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version Jun 5 2014)
|
||||
// C++ code generated with wxFormBuilder (version Jun 6 2014)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO "NOT" EDIT THIS FILE!
|
||||
|
@ -25,7 +25,31 @@ DIALOG_PNS_SETTINGS_BASE::DIALOG_PNS_SETTINGS_BASE( wxWindow* parent, wxWindowID
|
|||
wxStaticBoxSizer* bOptions;
|
||||
bOptions = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Options") ), wxVERTICAL );
|
||||
|
||||
wxFlexGridSizer* fgSizer1;
|
||||
fgSizer1 = new wxFlexGridSizer( 0, 2, 0, 0 );
|
||||
fgSizer1->AddGrowableCol( 1 );
|
||||
fgSizer1->SetFlexibleDirection( wxBOTH );
|
||||
fgSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
|
||||
|
||||
m_staticText4 = new wxStaticText( this, wxID_ANY, _("Mouse drag behaviour:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticText4->Wrap( -1 );
|
||||
fgSizer1->Add( m_staticText4, 0, wxTOP|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
wxString m_dragToolModeChoices[] = { _("move item"), _("interactive drag") };
|
||||
int m_dragToolModeNChoices = sizeof( m_dragToolModeChoices ) / sizeof( wxString );
|
||||
m_dragToolMode = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_dragToolModeNChoices, m_dragToolModeChoices, 0 );
|
||||
m_dragToolMode->SetSelection( 0 );
|
||||
fgSizer1->Add( m_dragToolMode, 1, wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT|wxLEFT|wxEXPAND, 5 );
|
||||
|
||||
|
||||
bOptions->Add( fgSizer1, 1, wxEXPAND, 5 );
|
||||
|
||||
m_freeAngleMode = new wxCheckBox( this, wxID_ANY, _("Free angle mode (no shove/walkaround)"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bOptions->Add( m_freeAngleMode, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_shoveVias = new wxCheckBox( this, wxID_ANY, _("Shove vias"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_shoveVias->Enable( false );
|
||||
|
||||
bOptions->Add( m_shoveVias, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_backPressure = new wxCheckBox( this, wxID_ANY, _("Jump over obstacles"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
|
@ -112,6 +136,7 @@ DIALOG_PNS_SETTINGS_BASE::DIALOG_PNS_SETTINGS_BASE( wxWindow* parent, wxWindowID
|
|||
|
||||
// Connect Events
|
||||
this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_PNS_SETTINGS_BASE::OnClose ) );
|
||||
m_freeAngleMode->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_PNS_SETTINGS_BASE::onFreeAngleModeChange ), NULL, this );
|
||||
m_stdButtonsCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PNS_SETTINGS_BASE::OnCancelClick ), NULL, this );
|
||||
m_stdButtonsOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PNS_SETTINGS_BASE::OnOkClick ), NULL, this );
|
||||
}
|
||||
|
@ -120,6 +145,7 @@ DIALOG_PNS_SETTINGS_BASE::~DIALOG_PNS_SETTINGS_BASE()
|
|||
{
|
||||
// Disconnect Events
|
||||
this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_PNS_SETTINGS_BASE::OnClose ) );
|
||||
m_freeAngleMode->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_PNS_SETTINGS_BASE::onFreeAngleModeChange ), NULL, this );
|
||||
m_stdButtonsCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PNS_SETTINGS_BASE::OnCancelClick ), NULL, this );
|
||||
m_stdButtonsOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PNS_SETTINGS_BASE::OnOkClick ), NULL, this );
|
||||
|
||||
|
|
|
@ -195,6 +195,283 @@
|
|||
<property name="orient">wxVERTICAL</property>
|
||||
<property name="permission">none</property>
|
||||
<event name="OnUpdateUI"></event>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND</property>
|
||||
<property name="proportion">1</property>
|
||||
<object class="wxFlexGridSizer" expanded="1">
|
||||
<property name="cols">2</property>
|
||||
<property name="flexible_direction">wxBOTH</property>
|
||||
<property name="growablecols">1</property>
|
||||
<property name="growablerows"></property>
|
||||
<property name="hgap">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">fgSizer1</property>
|
||||
<property name="non_flexible_grow_mode">wxFLEX_GROWMODE_SPECIFIED</property>
|
||||
<property name="permission">none</property>
|
||||
<property name="rows">0</property>
|
||||
<property name="vgap">0</property>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxTOP|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxStaticText" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Mouse drag behaviour:</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_staticText4</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass"></property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<property name="wrap">-1</property>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
<event name="OnKeyDown"></event>
|
||||
<event name="OnKeyUp"></event>
|
||||
<event name="OnKillFocus"></event>
|
||||
<event name="OnLeaveWindow"></event>
|
||||
<event name="OnLeftDClick"></event>
|
||||
<event name="OnLeftDown"></event>
|
||||
<event name="OnLeftUp"></event>
|
||||
<event name="OnMiddleDClick"></event>
|
||||
<event name="OnMiddleDown"></event>
|
||||
<event name="OnMiddleUp"></event>
|
||||
<event name="OnMotion"></event>
|
||||
<event name="OnMouseEvents"></event>
|
||||
<event name="OnMouseWheel"></event>
|
||||
<event name="OnPaint"></event>
|
||||
<event name="OnRightDClick"></event>
|
||||
<event name="OnRightDown"></event>
|
||||
<event name="OnRightUp"></event>
|
||||
<event name="OnSetFocus"></event>
|
||||
<event name="OnSize"></event>
|
||||
<event name="OnUpdateUI"></event>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT|wxLEFT|wxEXPAND</property>
|
||||
<property name="proportion">1</property>
|
||||
<object class="wxChoice" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="choices">"move item" "interactive drag"</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_dragToolMode</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="selection">0</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass"></property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="validator_data_type"></property>
|
||||
<property name="validator_style">wxFILTER_NONE</property>
|
||||
<property name="validator_type">wxDefaultValidator</property>
|
||||
<property name="validator_variable"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnChoice"></event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
<event name="OnKeyDown"></event>
|
||||
<event name="OnKeyUp"></event>
|
||||
<event name="OnKillFocus"></event>
|
||||
<event name="OnLeaveWindow"></event>
|
||||
<event name="OnLeftDClick"></event>
|
||||
<event name="OnLeftDown"></event>
|
||||
<event name="OnLeftUp"></event>
|
||||
<event name="OnMiddleDClick"></event>
|
||||
<event name="OnMiddleDown"></event>
|
||||
<event name="OnMiddleUp"></event>
|
||||
<event name="OnMotion"></event>
|
||||
<event name="OnMouseEvents"></event>
|
||||
<event name="OnMouseWheel"></event>
|
||||
<event name="OnPaint"></event>
|
||||
<event name="OnRightDClick"></event>
|
||||
<event name="OnRightDown"></event>
|
||||
<event name="OnRightUp"></event>
|
||||
<event name="OnSetFocus"></event>
|
||||
<event name="OnSize"></event>
|
||||
<event name="OnUpdateUI"></event>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxTOP|wxRIGHT|wxLEFT</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxCheckBox" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="checked">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Free angle mode (no shove/walkaround)</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_freeAngleMode</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass"></property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="validator_data_type"></property>
|
||||
<property name="validator_style">wxFILTER_NONE</property>
|
||||
<property name="validator_type">wxDefaultValidator</property>
|
||||
<property name="validator_variable"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnCheckBox">onFreeAngleModeChange</event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
<event name="OnKeyDown"></event>
|
||||
<event name="OnKeyUp"></event>
|
||||
<event name="OnKillFocus"></event>
|
||||
<event name="OnLeaveWindow"></event>
|
||||
<event name="OnLeftDClick"></event>
|
||||
<event name="OnLeftDown"></event>
|
||||
<event name="OnLeftUp"></event>
|
||||
<event name="OnMiddleDClick"></event>
|
||||
<event name="OnMiddleDown"></event>
|
||||
<event name="OnMiddleUp"></event>
|
||||
<event name="OnMotion"></event>
|
||||
<event name="OnMouseEvents"></event>
|
||||
<event name="OnMouseWheel"></event>
|
||||
<event name="OnPaint"></event>
|
||||
<event name="OnRightDClick"></event>
|
||||
<event name="OnRightDown"></event>
|
||||
<event name="OnRightUp"></event>
|
||||
<event name="OnSetFocus"></event>
|
||||
<event name="OnSize"></event>
|
||||
<event name="OnUpdateUI"></event>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="0">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxTOP|wxRIGHT|wxLEFT</property>
|
||||
|
@ -221,7 +498,7 @@
|
|||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="enabled">0</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version Jun 5 2014)
|
||||
// C++ code generated with wxFormBuilder (version Jun 6 2014)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO "NOT" EDIT THIS FILE!
|
||||
|
@ -20,11 +20,12 @@ class DIALOG_SHIM;
|
|||
#include <wx/font.h>
|
||||
#include <wx/colour.h>
|
||||
#include <wx/settings.h>
|
||||
#include <wx/stattext.h>
|
||||
#include <wx/choice.h>
|
||||
#include <wx/sizer.h>
|
||||
#include <wx/checkbox.h>
|
||||
#include <wx/statline.h>
|
||||
#include <wx/stattext.h>
|
||||
#include <wx/slider.h>
|
||||
#include <wx/sizer.h>
|
||||
#include <wx/statbox.h>
|
||||
#include <wx/button.h>
|
||||
#include <wx/dialog.h>
|
||||
|
@ -41,6 +42,9 @@ class DIALOG_PNS_SETTINGS_BASE : public DIALOG_SHIM
|
|||
|
||||
protected:
|
||||
wxRadioBox* m_mode;
|
||||
wxStaticText* m_staticText4;
|
||||
wxChoice* m_dragToolMode;
|
||||
wxCheckBox* m_freeAngleMode;
|
||||
wxCheckBox* m_shoveVias;
|
||||
wxCheckBox* m_backPressure;
|
||||
wxCheckBox* m_removeLoops;
|
||||
|
@ -59,6 +63,7 @@ class DIALOG_PNS_SETTINGS_BASE : public DIALOG_SHIM
|
|||
|
||||
// Virtual event handlers, overide them in your derived class
|
||||
virtual void OnClose( wxCloseEvent& event ) { event.Skip(); }
|
||||
virtual void onFreeAngleModeChange( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnOkClick( wxCommandEvent& event ) { event.Skip(); }
|
||||
|
||||
|
|
|
@ -1029,7 +1029,12 @@ bool PNS_LINE_PLACER::buildInitialLine( const VECTOR2I& aP, PNS_LINE& aHead )
|
|||
{
|
||||
l.Clear();
|
||||
} else {
|
||||
l = m_direction.BuildInitialTrace( m_p_start, aP );
|
||||
if( Settings().GetFreeAngleMode() && Settings().Mode() == RM_MarkObstacles )
|
||||
{
|
||||
l = SHAPE_LINE_CHAIN ( m_p_start, aP );
|
||||
} else {
|
||||
l = m_direction.BuildInitialTrace( m_p_start, aP );
|
||||
}
|
||||
|
||||
if( l.SegmentCount() > 1 && m_orthoMode )
|
||||
{
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <tool/tool_settings.h>
|
||||
|
||||
#include "pns_routing_settings.h"
|
||||
#include "direction.h"
|
||||
|
||||
|
@ -37,8 +39,44 @@ PNS_ROUTING_SETTINGS::PNS_ROUTING_SETTINGS()
|
|||
m_jumpOverObstacles = false;
|
||||
m_smoothDraggedSegments = true;
|
||||
m_canViolateDRC = false;
|
||||
m_freeAngleMode = false;
|
||||
}
|
||||
|
||||
void PNS_ROUTING_SETTINGS::Save ( TOOL_SETTINGS& aSettings ) const
|
||||
{
|
||||
aSettings.Set( "Mode", (int)m_routingMode );
|
||||
aSettings.Set( "OptimizerEffort", (int) m_optimizerEffort );
|
||||
aSettings.Set( "RemoveLoops", m_removeLoops );
|
||||
aSettings.Set( "SmartPads", m_smartPads );
|
||||
aSettings.Set( "ShoveVias", m_shoveVias );
|
||||
aSettings.Set( "StartDiagonal", m_startDiagonal );
|
||||
aSettings.Set( "ShoveTimeLimit", m_shoveTimeLimit.Get() );
|
||||
aSettings.Set( "ShoveIterationLimit", m_shoveIterationLimit );
|
||||
aSettings.Set( "WalkaroundIterationLimit", m_walkaroundIterationLimit );
|
||||
aSettings.Set( "JumpOverObstacles", m_jumpOverObstacles );
|
||||
aSettings.Set( "SmoothDraggedSegments", m_smoothDraggedSegments );
|
||||
aSettings.Set( "CanViolateDRC", m_canViolateDRC );
|
||||
aSettings.Set( "SuggestFinish", m_suggestFinish );
|
||||
aSettings.Set( "FreeAngleMode", m_freeAngleMode );
|
||||
}
|
||||
|
||||
void PNS_ROUTING_SETTINGS::Load ( const TOOL_SETTINGS& aSettings )
|
||||
{
|
||||
m_routingMode = (PNS_MODE) aSettings.Get( "Mode", (int) RM_Walkaround );
|
||||
m_optimizerEffort = (PNS_OPTIMIZATION_EFFORT) aSettings.Get( "OptimizerEffort", (int) OE_MEDIUM );
|
||||
m_removeLoops = aSettings.Get( "RemoveLoops", true );
|
||||
m_smartPads = aSettings.Get( "SmartPads", true );
|
||||
m_shoveVias = aSettings.Get( "ShoveVias", true );
|
||||
m_startDiagonal = aSettings.Get( "StartDiagonal", false );
|
||||
m_shoveTimeLimit.Set( aSettings.Get( "ShoveTimeLimit", 1000 ) );
|
||||
m_shoveIterationLimit = aSettings.Get( "ShoveIterationLimit", 250 );
|
||||
m_walkaroundIterationLimit = aSettings.Get( "WalkaroundIterationLimit", 50 );
|
||||
m_jumpOverObstacles = aSettings.Get( "JumpOverObstacles", false );
|
||||
m_smoothDraggedSegments = aSettings.Get( "SmoothDraggedSegments", true );
|
||||
m_canViolateDRC = aSettings.Get( "CanViolateDRC", false );
|
||||
m_suggestFinish = aSettings.Get( "SuggestFinish", false );
|
||||
m_freeAngleMode = aSettings.Get( "FreeAngleMode", false );
|
||||
}
|
||||
|
||||
const DIRECTION_45 PNS_ROUTING_SETTINGS::InitialDirection() const
|
||||
{
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include "time_limit.h"
|
||||
|
||||
class DIRECTION_45;
|
||||
class TOOL_SETTINGS;
|
||||
|
||||
///> Routing modes
|
||||
enum PNS_MODE
|
||||
|
@ -55,6 +56,9 @@ class PNS_ROUTING_SETTINGS
|
|||
public:
|
||||
PNS_ROUTING_SETTINGS();
|
||||
|
||||
void Load ( const TOOL_SETTINGS& where );
|
||||
void Save ( TOOL_SETTINGS& where ) const;
|
||||
|
||||
///> Returns the routing mode.
|
||||
PNS_MODE Mode() const { return m_routingMode; }
|
||||
|
||||
|
@ -114,6 +118,10 @@ public:
|
|||
bool CanViolateDRC() const { return m_canViolateDRC; }
|
||||
void SetCanViolateDRC( bool aViolate ) { m_canViolateDRC = aViolate; }
|
||||
|
||||
bool GetFreeAngleMode() const { return m_freeAngleMode; }
|
||||
|
||||
void SetFreeAngleMode( bool aEnable ) { m_freeAngleMode = aEnable; }
|
||||
|
||||
const DIRECTION_45 InitialDirection() const;
|
||||
|
||||
int ShoveIterationLimit() const;
|
||||
|
@ -133,6 +141,7 @@ private:
|
|||
bool m_jumpOverObstacles;
|
||||
bool m_smoothDraggedSegments;
|
||||
bool m_canViolateDRC;
|
||||
bool m_freeAngleMode;
|
||||
|
||||
PNS_MODE m_routingMode;
|
||||
PNS_OPTIMIZATION_EFFORT m_optimizerEffort;
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
|
||||
#include <tool/context_menu.h>
|
||||
#include <tool/tool_manager.h>
|
||||
#include <tool/tool_settings.h>
|
||||
#include <tools/common_actions.h>
|
||||
|
||||
#include <ratsnest_data.h>
|
||||
|
@ -260,6 +261,13 @@ public:
|
|||
|
||||
ROUTER_TOOL::~ROUTER_TOOL()
|
||||
{
|
||||
m_savedSettings.Save( GetSettings() );
|
||||
}
|
||||
|
||||
bool ROUTER_TOOL::Init()
|
||||
{
|
||||
m_savedSettings.Load( GetSettings() );
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@ public:
|
|||
ROUTER_TOOL();
|
||||
~ROUTER_TOOL();
|
||||
|
||||
bool Init();
|
||||
void Reset( RESET_REASON aReason );
|
||||
|
||||
int RouteSingleTrace ( const TOOL_EVENT& aEvent );
|
||||
|
|
|
@ -33,6 +33,7 @@ public:
|
|||
void Restart();
|
||||
|
||||
void Set( int aMilliseconds );
|
||||
int Get () const { return m_limitMs; }
|
||||
|
||||
private:
|
||||
int m_limitMs;
|
||||
|
|
Loading…
Reference in New Issue