Commit 9dce5b6a authored by Garth Corral's avatar Garth Corral

Merge trunk @ 5469

parents 1af93150 c7d04c3d
......@@ -569,6 +569,12 @@ set( BMAPS_BIG
wizard_add_fplib_icon
)
set( BMAPS_OTHER
tune_diff_pair_length_legend
tune_diff_pair_skew_legend
tune_single_track_length_legend
)
# @todo keep these in sync with .bzrignore
set( TMP_DIR "${CMAKE_CURRENT_SOURCE_DIR}/tmp" )
......@@ -742,5 +748,10 @@ foreach( bmn ${BMAPS_BIG} )
list( APPEND CPP_LIST cpp_48/${bmn}.cpp )
endforeach()
foreach( bmn ${BMAPS_OTHER} )
#message( "library add cpp_other/${bmn}.cpp" )
list( APPEND CPP_LIST cpp_other/${bmn}.cpp )
endforeach()
#add_library( bitmaps SHARED ${CPP_LIST} )
add_library( bitmaps STATIC ${CPP_LIST} )
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -204,7 +204,8 @@ set( COMMON_SRCS
wildcards_and_files_ext.cpp
worksheet.cpp
wxwineda.cpp
wxunittext.cpp
wx_unit_binder.cpp
wx_status_popup.cpp
xnode.cpp
zoom.cpp
)
......
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2015 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
......@@ -225,7 +225,7 @@ bool EDA_ITEM::operator<( const EDA_ITEM& aItem ) const
return false;
}
#ifdef USE_EDA_ITEM_OP_EQ // see base_struct.h for explanations
EDA_ITEM& EDA_ITEM::operator=( const EDA_ITEM& aItem )
{
if( &aItem != this )
......@@ -241,7 +241,7 @@ EDA_ITEM& EDA_ITEM::operator=( const EDA_ITEM& aItem )
return *this;
}
#endif
const BOX2I EDA_ITEM::ViewBBox() const
{
......
......@@ -226,24 +226,26 @@ void EDA_BASE_FRAME::LoadSettings( wxConfigBase* aCfg )
{
int maximized = 0;
wxString text = m_FrameName + wxT( "Pos_x" );
wxString baseCfgName = GetName();
wxString text = baseCfgName + wxT( "Pos_x" );
aCfg->Read( text, &m_FramePos.x );
text = m_FrameName + wxT( "Pos_y" );
text = baseCfgName + wxT( "Pos_y" );
aCfg->Read( text, &m_FramePos.y );
text = m_FrameName + wxT( "Size_x" );
text = baseCfgName + wxT( "Size_x" );
aCfg->Read( text, &m_FrameSize.x, 600 );
text = m_FrameName + wxT( "Size_y" );
text = baseCfgName + wxT( "Size_y" );
aCfg->Read( text, &m_FrameSize.y, 400 );
text = m_FrameName + wxT( "Maximized" );
text = baseCfgName + wxT( "Maximized" );
aCfg->Read( text, &maximized, 0 );
if( m_hasAutoSave )
{
text = m_FrameName + entryAutoSaveInterval;
text = baseCfgName + entryAutoSaveInterval;
aCfg->Read( text, &m_autoSaveInterval, DEFAULT_AUTO_SAVE_INTERVAL );
}
......@@ -261,7 +263,7 @@ void EDA_BASE_FRAME::LoadSettings( wxConfigBase* aCfg )
if( maximized )
Maximize();
aCfg->Read( m_FrameName + entryPerspective, &m_perspective );
aCfg->Read( baseCfgName + entryPerspective, &m_perspective );
}
......@@ -272,27 +274,29 @@ void EDA_BASE_FRAME::SaveSettings( wxConfigBase* aCfg )
if( IsIconized() )
return;
wxString baseCfgName = GetName();
m_FrameSize = GetSize();
m_FramePos = GetPosition();
text = m_FrameName + wxT( "Pos_x" );
text = baseCfgName + wxT( "Pos_x" );
aCfg->Write( text, (long) m_FramePos.x );
text = m_FrameName + wxT( "Pos_y" );
text = baseCfgName + wxT( "Pos_y" );
aCfg->Write( text, (long) m_FramePos.y );
text = m_FrameName + wxT( "Size_x" );
text = baseCfgName + wxT( "Size_x" );
aCfg->Write( text, (long) m_FrameSize.x );
text = m_FrameName + wxT( "Size_y" );
text = baseCfgName + wxT( "Size_y" );
aCfg->Write( text, (long) m_FrameSize.y );
text = m_FrameName + wxT( "Maximized" );
text = baseCfgName + wxT( "Maximized" );
aCfg->Write( text, IsMaximized() );
if( m_hasAutoSave )
{
text = m_FrameName + entryAutoSaveInterval;
text = baseCfgName + entryAutoSaveInterval;
aCfg->Write( text, m_autoSaveInterval );
}
......@@ -303,7 +307,7 @@ void EDA_BASE_FRAME::SaveSettings( wxConfigBase* aCfg )
// printf( "perspective(%s): %s\n",
// TO_UTF8( m_FrameName + entryPerspective ), TO_UTF8( perspective ) );
aCfg->Write( m_FrameName + entryPerspective, perspective );
aCfg->Write( baseCfgName + entryPerspective, perspective );
}
......
......@@ -251,7 +251,7 @@ void HOTKEY_SECTION_PAGE::Restore()
}
void InstallHotkeyFrame( EDA_DRAW_FRAME* aParent, EDA_HOTKEY_CONFIG* aHotkeys )
void InstallHotkeyFrame( EDA_BASE_FRAME* aParent, EDA_HOTKEY_CONFIG* aHotkeys )
{
HOTKEYS_EDITOR_DIALOG dialog( aParent, aHotkeys );
......@@ -264,7 +264,7 @@ void InstallHotkeyFrame( EDA_DRAW_FRAME* aParent, EDA_HOTKEY_CONFIG* aHotkeys )
}
HOTKEYS_EDITOR_DIALOG::HOTKEYS_EDITOR_DIALOG( EDA_DRAW_FRAME* aParent,
HOTKEYS_EDITOR_DIALOG::HOTKEYS_EDITOR_DIALOG( EDA_BASE_FRAME* aParent,
EDA_HOTKEY_CONFIG* aHotkeys ) :
HOTKEYS_EDITOR_DIALOG_BASE( aParent ),
m_parent( aParent ),
......
......@@ -642,17 +642,19 @@ void EDA_DRAW_FRAME::LoadSettings( wxConfigBase* aCfg )
{
EDA_BASE_FRAME::LoadSettings( aCfg );
aCfg->Read( m_FrameName + CursorShapeEntryKeyword, &m_cursorShape, ( long )0 );
wxString baseCfgName = GetName();
aCfg->Read( baseCfgName + CursorShapeEntryKeyword, &m_cursorShape, ( long )0 );
bool btmp;
if( aCfg->Read( m_FrameName + ShowGridEntryKeyword, &btmp ) )
if( aCfg->Read( baseCfgName + ShowGridEntryKeyword, &btmp ) )
SetGridVisibility( btmp );
int itmp;
if( aCfg->Read( m_FrameName + GridColorEntryKeyword, &itmp ) )
if( aCfg->Read( baseCfgName + GridColorEntryKeyword, &itmp ) )
SetGridColor( ColorFromInt( itmp ) );
aCfg->Read( m_FrameName + LastGridSizeIdKeyword, &m_LastGridSizeId, 0L );
aCfg->Read( baseCfgName + LastGridSizeIdKeyword, &m_LastGridSizeId, 0L );
// m_LastGridSizeId is an offset, expected to be >= 0
if( m_LastGridSizeId < 0 )
......@@ -664,10 +666,12 @@ void EDA_DRAW_FRAME::SaveSettings( wxConfigBase* aCfg )
{
EDA_BASE_FRAME::SaveSettings( aCfg );
aCfg->Write( m_FrameName + CursorShapeEntryKeyword, m_cursorShape );
aCfg->Write( m_FrameName + ShowGridEntryKeyword, IsGridVisible() );
aCfg->Write( m_FrameName + GridColorEntryKeyword, ( long ) GetGridColor() );
aCfg->Write( m_FrameName + LastGridSizeIdKeyword, ( long ) m_LastGridSizeId );
wxString baseCfgName = GetName();
aCfg->Write( baseCfgName + CursorShapeEntryKeyword, m_cursorShape );
aCfg->Write( baseCfgName + ShowGridEntryKeyword, IsGridVisible() );
aCfg->Write( baseCfgName + GridColorEntryKeyword, ( long ) GetGridColor() );
aCfg->Write( baseCfgName + LastGridSizeIdKeyword, ( long ) m_LastGridSizeId );
}
......
......@@ -227,15 +227,18 @@ static void DrawGraphicTextPline( EDA_RECT* aClipBox,
coord[ik + 1].x, coord[ik + 1].y );
}
}
else if( aSketchMode )
else if( aDC )
{
for( int ik = 0; ik < (point_count - 1); ik++ )
GRCSegm( aClipBox, aDC, coord[ik].x, coord[ik].y,
coord[ik + 1].x, coord[ik + 1].y, aWidth, aColor );
if( aSketchMode )
{
for( int ik = 0; ik < (point_count - 1); ik++ )
GRCSegm( aClipBox, aDC, coord[ik].x, coord[ik].y,
coord[ik + 1].x, coord[ik + 1].y, aWidth, aColor );
}
else
GRPoly( aClipBox, aDC, point_count, coord, 0,
aWidth, aColor, aColor );
}
else
GRPoly( aClipBox, aDC, point_count, coord, 0,
aWidth, aColor, aColor );
}
......
......@@ -60,6 +60,7 @@ bool SEG::PointCloserThan( const VECTOR2I& aP, int aDist ) const
if( num > ( dist_sq + 100 ) )
return false;
else if( num < ( dist_sq - 100 ) )
return true;
}
......
......@@ -419,7 +419,7 @@ int KeyCodeFromKeyName( const wxString& keyname )
* Displays the current hotkey list
* aList = a EDA_HOTKEY_CONFIG list(Null terminated)
*/
void DisplayHotkeyList( EDA_DRAW_FRAME* aFrame, struct EDA_HOTKEY_CONFIG* aDescList )
void DisplayHotkeyList( EDA_BASE_FRAME* aFrame, struct EDA_HOTKEY_CONFIG* aDescList )
{
wxString keyname;
EDA_HOTKEY** list;
......@@ -534,7 +534,9 @@ int EDA_BASE_FRAME::WriteHotkeyConfig( struct EDA_HOTKEY_CONFIG* aDescList,
}
else
{
wxConfigBase* config = GetNewConfig( m_FrameName );
wxFileName fn( GetName() );
fn.SetExt( DEFAULT_HOTKEY_FILENAME_EXT );
wxConfigBase* config = GetNewConfig( fn.GetFullPath() );
config->Write( HOTKEYS_CONFIG_KEY, msg );
delete config;
}
......@@ -546,7 +548,10 @@ int EDA_BASE_FRAME::WriteHotkeyConfig( struct EDA_HOTKEY_CONFIG* aDescList,
int EDA_BASE_FRAME::ReadHotkeyConfigFile( const wxString& aFilename,
struct EDA_HOTKEY_CONFIG* aDescList )
{
wxFile cfgfile( aFilename );
wxFileName fn( aFilename );
fn.SetExt( DEFAULT_HOTKEY_FILENAME_EXT );
wxFile cfgfile( fn.GetFullPath() );
if( !cfgfile.IsOpened() ) // There is a problem to open file
return 0;
......@@ -574,7 +579,10 @@ int EDA_BASE_FRAME::ReadHotkeyConfigFile( const wxString& aFilename,
void ReadHotkeyConfig( const wxString& Appname, struct EDA_HOTKEY_CONFIG* aDescList )
{
wxConfigBase* config = GetNewConfig( Appname );
wxFileName fn( Appname );
fn.SetExt( DEFAULT_HOTKEY_FILENAME_EXT );
wxConfigBase* config = GetNewConfig( fn.GetFullPath() );
if( !config->HasEntry( HOTKEYS_CONFIG_KEY ) )
{
......@@ -596,7 +604,7 @@ void ReadHotkeyConfig( const wxString& Appname, struct EDA_HOTKEY_CONFIG* aDescL
*/
int EDA_BASE_FRAME::ReadHotkeyConfig( struct EDA_HOTKEY_CONFIG* aDescList )
{
::ReadHotkeyConfig( m_FrameName, aDescList );
::ReadHotkeyConfig( GetName(), aDescList );
return 1;
}
......@@ -677,7 +685,8 @@ void ParseHotkeyConfig( const wxString& data,
}
void EDA_BASE_FRAME::ImportHotkeyConfigFromFile( EDA_HOTKEY_CONFIG* aDescList )
void EDA_BASE_FRAME::ImportHotkeyConfigFromFile( EDA_HOTKEY_CONFIG* aDescList,
const wxString& aDefaultShortname )
{
wxString ext = DEFAULT_HOTKEY_FILENAME_EXT;
wxString mask = wxT( "*." ) + ext;
......@@ -687,12 +696,12 @@ void EDA_BASE_FRAME::ImportHotkeyConfigFromFile( EDA_HOTKEY_CONFIG* aDescList )
#else
wxString path = wxGetCwd();
#endif
wxFileName fn( aDefaultShortname );
fn.SetExt( DEFAULT_HOTKEY_FILENAME_EXT );
wxString filename = Kiface().Name() + wxT( '.' ) + ext;
filename = EDA_FileSelector( _( "Read Hotkey Configuration File:" ),
wxString filename = EDA_FileSelector( _( "Read Hotkey Configuration File:" ),
path,
filename,
fn.GetFullPath(),
ext,
mask,
this,
......@@ -706,7 +715,8 @@ void EDA_BASE_FRAME::ImportHotkeyConfigFromFile( EDA_HOTKEY_CONFIG* aDescList )
}
void EDA_BASE_FRAME::ExportHotkeyConfigToFile( EDA_HOTKEY_CONFIG* aDescList )
void EDA_BASE_FRAME::ExportHotkeyConfigToFile( EDA_HOTKEY_CONFIG* aDescList,
const wxString& aDefaultShortname )
{
wxString ext = DEFAULT_HOTKEY_FILENAME_EXT;
wxString mask = wxT( "*." ) + ext;
......@@ -716,12 +726,12 @@ void EDA_BASE_FRAME::ExportHotkeyConfigToFile( EDA_HOTKEY_CONFIG* aDescList )
#else
wxString path = wxGetCwd();
#endif
wxFileName fn( aDefaultShortname );
fn.SetExt( DEFAULT_HOTKEY_FILENAME_EXT );
wxString filename = Kiface().Name() + wxT( "." ) + ext;
filename = EDA_FileSelector( _( "Write Hotkey Configuration File:" ),
wxString filename = EDA_FileSelector( _( "Write Hotkey Configuration File:" ),
path,
filename,
fn.GetFullPath(),
ext,
mask,
this,
......
......@@ -48,6 +48,7 @@ KIWAY_PLAYER::KIWAY_PLAYER( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrameType
m_modal_loop( 0 ), m_modal_resultant_parent( 0 )
{
// DBG( printf("KIWAY_EXPRESS::wxEVENT_ID:%d\n", KIWAY_EXPRESS::wxEVENT_ID );)
m_modal_ret_val = 0;
}
......
......@@ -564,7 +564,7 @@ struct VIEW::drawItem
bool operator()( VIEW_ITEM* aItem )
{
// Conditions that have te be fulfilled for an item to be drawn
bool drawCondition = aItem->ViewIsVisible() &&
bool drawCondition = aItem->isRenderable() &&
aItem->ViewGetLOD( layer ) < view->m_scale;
if( !drawCondition )
return true;
......
......@@ -29,17 +29,6 @@
using namespace KIGFX;
void VIEW_ITEM::ViewSetVisible( bool aIsVisible )
{
// update only if the visibility has really changed
if( m_visible != aIsVisible )
{
m_visible = aIsVisible;
ViewUpdate( APPEARANCE );
}
}
void VIEW_ITEM::ViewRelease()
{
if( m_view && m_view->IsDynamic() )
......
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2014-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
*/
/**
* Transient mouse following popup window implementation.
*/
#include <wx_status_popup.h>
#include <wxPcbStruct.h>
WX_STATUS_POPUP::WX_STATUS_POPUP( PCB_EDIT_FRAME* aParent ) :
wxPopupWindow( aParent )
{
m_panel = new wxPanel( this, wxID_ANY );
m_panel->SetBackgroundColour( *wxLIGHT_GREY );
m_topSizer = new wxBoxSizer( wxVERTICAL );
m_panel->SetSizer( m_topSizer );
}
void WX_STATUS_POPUP::updateSize()
{
m_topSizer->Fit( m_panel );
SetClientSize( m_panel->GetSize() );
}
WX_STATUS_POPUP::~WX_STATUS_POPUP()
{
}
void WX_STATUS_POPUP::Popup( wxWindow* )
{
Show( true );
Raise();
}
void WX_STATUS_POPUP::Move( const wxPoint& aWhere )
{
SetPosition ( aWhere );
}
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2014-2015 CERN
* Author: Maciej Suminski <maciej.suminski@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
*/
#include <wx/stattext.h>
#include <wx/sizer.h>
#include <wx/textctrl.h>
#include <limits>
#include <base_units.h>
#if wxCHECK_VERSION( 2, 9, 0 )
#include <wx/valnum.h>
#endif
#include <boost/optional.hpp>
#include "wx_unit_binder.h"
WX_UNIT_BINDER::WX_UNIT_BINDER( wxWindow* aParent, wxTextCtrl* aTextInput, wxStaticText* aUnitLabel, wxSpinButton* aSpinButton )
{
// Use the currently selected units
m_units = g_UserUnit;
m_textCtrl = aTextInput;
m_textCtrl->SetValue( wxT( "0" ) );
m_unitLabel = aUnitLabel;
m_unitLabel->SetLabel( GetAbbreviatedUnitsLabel( m_units ) );
}
WX_UNIT_BINDER::~WX_UNIT_BINDER()
{
}
void WX_UNIT_BINDER::SetValue( int aValue )
{
wxString s = StringFromValue( m_units, aValue, false );
m_textCtrl->SetValue( s );
m_unitLabel->SetLabel( GetAbbreviatedUnitsLabel( m_units ) );
}
int WX_UNIT_BINDER::GetValue() const
{
wxString s = m_textCtrl->GetValue();
return ValueFromString( m_units, s );
}
void WX_UNIT_BINDER::Enable( bool aEnable )
{
m_textCtrl->Enable( aEnable );
m_unitLabel->Enable( aEnable );
}
\ No newline at end of file
......@@ -76,7 +76,6 @@ DISPLAY_FOOTPRINTS_FRAME::DISPLAY_FOOTPRINTS_FRAME( KIWAY* aKiway, CVPCB_MAINFRA
wxDefaultPosition, wxDefaultSize,
KICAD_DEFAULT_DRAWFRAME_STYLE, FOOTPRINTVIEWER_FRAME_NAME )
{
m_FrameName = FOOTPRINTVIEWER_FRAME_NAME;
m_showAxis = true; // true to draw axis.
// Give an icon
......
......@@ -104,7 +104,6 @@ CVPCB_MAINFRAME::CVPCB_MAINFRAME( KIWAY* aKiway, wxWindow* aParent ) :
KIWAY_PLAYER( aKiway, aParent, FRAME_CVPCB, wxT( "CvPCB" ), wxDefaultPosition,
wxDefaultSize, KICAD_DEFAULT_DRAWFRAME_STYLE, CVPCB_MAINFRAME_NAME )
{
m_FrameName = CVPCB_MAINFRAME_NAME;
m_compListBox = NULL;
m_footprintListBox = NULL;
m_libListBox = NULL;
......
......@@ -258,7 +258,7 @@ void DIALOG_EESCHEMA_OPTIONS::OnDeleteButtonClick( wxCommandEvent& event )
// If the selectedField is still not in the templateField range now,
// make sure we stay in range and when there are no fields present
// move to -1
if( selectedField >= templateFields.size() )
if( selectedField >= int( templateFields.size() ) )
selectedField = templateFields.size() - 1;
// Update the display to reflect the new data
......
......@@ -44,13 +44,13 @@ protected:
* edit panel
* selectedField = -1 when no valid item selected
*/
size_t selectedField;
int selectedField;
/** @brief return true if aFieldId is a valid field selection
*/
bool fieldSelectionValid( size_t aFieldId )
bool fieldSelectionValid( int aFieldId )
{
return ( aFieldId >= 0 ) && ( aFieldId < templateFields.size() );
return ( aFieldId >= 0 ) && ( aFieldId < int( templateFields.size() ) );
}
/**
......
......@@ -116,7 +116,8 @@ SCH_TEXT* SCH_EDIT_FRAME::CreateNewText( wxDC* aDC, int aType )
lastTextItalic = textItem->IsItalic();
lastTextOrientation = textItem->GetOrientation();
if( (aType == SCH_GLOBAL_LABEL_T) || (aType == SCH_HIERARCHICAL_LABEL_T) )
if( ( textItem->Type() == SCH_GLOBAL_LABEL_T ) ||
( textItem->Type() == SCH_HIERARCHICAL_LABEL_T ) )
{
lastGlobalLabelShape = textItem->GetShape();
}
......
......@@ -229,7 +229,7 @@ bool IFACE::OnKifaceStart( PGM_BASE* aProgram, int aCtlBits )
// Must be called before creating the main frame in order to
// display the real hotkeys in menus or tool tips
ReadHotkeyConfig( wxT("SchematicFrame"), g_Eeschema_Hokeys_Descr );
ReadHotkeyConfig( SCH_EDIT_FRAME_NAME, g_Eeschema_Hokeys_Descr );
wxConfigLoadSetups( KifaceSettings(), cfg_params() );
......
......@@ -177,11 +177,11 @@ void LIB_EDIT_FRAME::Process_Config( wxCommandEvent& event )
break;
case ID_PREFERENCES_HOTKEY_EXPORT_CONFIG:
ExportHotkeyConfigToFile( g_Eeschema_Hokeys_Descr );
ExportHotkeyConfigToFile( g_Eeschema_Hokeys_Descr, wxT( "eeschema" ) );
break;
case ID_PREFERENCES_HOTKEY_IMPORT_CONFIG:
ImportHotkeyConfigFromFile( g_Eeschema_Hokeys_Descr );
ImportHotkeyConfigFromFile( g_Eeschema_Hokeys_Descr, wxT( "eeschema" ) );
break;
case ID_PREFERENCES_HOTKEY_SHOW_CURRENT_LIST:
......@@ -282,11 +282,11 @@ void SCH_EDIT_FRAME::Process_Config( wxCommandEvent& event )
// Hotkey IDs
case ID_PREFERENCES_HOTKEY_EXPORT_CONFIG:
ExportHotkeyConfigToFile( g_Eeschema_Hokeys_Descr );
ExportHotkeyConfigToFile( g_Eeschema_Hokeys_Descr, wxT( "eeschema" ) );
break;
case ID_PREFERENCES_HOTKEY_IMPORT_CONFIG:
ImportHotkeyConfigFromFile( g_Eeschema_Hokeys_Descr );
ImportHotkeyConfigFromFile( g_Eeschema_Hokeys_Descr, wxT( "eeschema" ) );
break;
case ID_PREFERENCES_HOTKEY_SHOW_EDITOR:
......
......@@ -296,12 +296,12 @@ void SCH_EDIT_FRAME::OnSelectUnit( wxCommandEvent& aEvent )
if( LIB_PART* part = Prj().SchLibs()->FindLibPart( component->GetPartName() ) )
{
wxCHECK_RET( (unit >= 1) && (unit <= part->GetUnitCount()),
int unitCount = part->GetUnitCount();
wxCHECK_RET( (unit >= 1) && (unit <= unitCount),
wxString::Format( wxT( "Cannot select unit %d from component " ), unit ) +
part->GetName() );
int unitCount = part->GetUnitCount();
if( unitCount <= 1 || component->GetUnit() == unit )
return;
......
......@@ -184,7 +184,6 @@ LIB_EDIT_FRAME::LIB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
{
wxASSERT( aParent );
m_FrameName = GetLibEditFrameName();
m_showAxis = true; // true to draw axis
m_configPath = wxT( "LibraryEditor" );
SetShowDeMorgan( false );
......
......@@ -115,6 +115,7 @@ SCH_COMPONENT::SCH_COMPONENT( const wxPoint& aPos, SCH_ITEM* aParent ) :
SCH_ITEM( aParent, SCH_COMPONENT_T )
{
Init( aPos );
m_currentSheetPath = NULL;
}
......@@ -128,6 +129,7 @@ SCH_COMPONENT::SCH_COMPONENT( LIB_PART& aPart, SCH_SHEET_PATH* sheet, int unit,
m_convert = convert;
m_part_name = aPart.GetName();
m_part = aPart.SharedPtr();
m_currentSheetPath = NULL;
SetTimeStamp( GetNewTimeStamp() );
......
......@@ -301,14 +301,12 @@ BEGIN_EVENT_TABLE( SCH_EDIT_FRAME, EDA_DRAW_FRAME )
END_EVENT_TABLE()
#define SCH_EDIT_FRAME_NAME wxT( "SchematicFrame" )
SCH_EDIT_FRAME::SCH_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ):
SCH_BASE_FRAME( aKiway, aParent, FRAME_SCH, wxT( "Eeschema" ),
wxDefaultPosition, wxDefaultSize, KICAD_DEFAULT_DRAWFRAME_STYLE, SCH_EDIT_FRAME_NAME ),
m_item_to_repeat( 0 )
{
m_FrameName = SCH_EDIT_FRAME_NAME;
m_showAxis = false; // true to show axis
m_showBorderAndTitleBlock = true; // true to show sheet references
m_CurrentSheet = new SCH_SHEET_PATH;
......
......@@ -30,6 +30,7 @@
#ifndef WX_EESCHEMA_STRUCT_H
#define WX_EESCHEMA_STRUCT_H
#include <sch_base_frame.h>
#include <config_params.h>
#include <class_undoredo_container.h>
......@@ -106,6 +107,8 @@ enum SCH_SEARCH_T {
};
#define SCH_EDIT_FRAME_NAME wxT( "SchematicFrame" )
/**
* Schematic editor (Eeschema) main window.
*/
......
......@@ -92,7 +92,6 @@ LIB_VIEW_FRAME::LIB_VIEW_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrame
if( aFrameType == FRAME_SCH_VIEWER_MODAL )
SetModal( true );
m_FrameName = GetLibViewerFrameName();
m_configPath = wxT( "LibraryViewer" );
// Give an icon
......
......@@ -140,7 +140,7 @@ bool IFACE::OnKifaceStart( PGM_BASE* aProgram, int aCtlBits )
// Must be called before creating the main frame in order to
// display the real hotkeys in menus or tool tips
ReadHotkeyConfig( wxT("GerberFrame"), s_Gerbview_Hokeys_Descr );
ReadHotkeyConfig( GERBVIEW_FRAME_NAME, s_Gerbview_Hokeys_Descr );
return true;
}
......
......@@ -55,11 +55,11 @@ void GERBVIEW_FRAME::Process_Config( wxCommandEvent& event )
{
// Hotkey IDs
case ID_PREFERENCES_HOTKEY_EXPORT_CONFIG:
ExportHotkeyConfigToFile( s_Gerbview_Hokeys_Descr );
ExportHotkeyConfigToFile( s_Gerbview_Hokeys_Descr, wxT( "gerbview" ) );
break;
case ID_PREFERENCES_HOTKEY_IMPORT_CONFIG:
ImportHotkeyConfigFromFile( s_Gerbview_Hokeys_Descr );
ImportHotkeyConfigFromFile( s_Gerbview_Hokeys_Descr, wxT( "gerbview" ) );
break;
case ID_PREFERENCES_HOTKEY_SHOW_EDITOR:
......
......@@ -62,8 +62,6 @@ static const wxString cfgShowBorderAndTitleBlock( wxT( "ShowBorderAndTitleBloc
/* class GERBVIEW_FRAME for GerbView */
/*************************************/
#define GERBVIEW_FRAME_NAME wxT( "GerberFrame" )
GERBVIEW_FRAME::GERBVIEW_FRAME( KIWAY* aKiway, wxWindow* aParent ):
EDA_DRAW_FRAME( aKiway, aParent, FRAME_GERBER, wxT( "GerbView" ),
wxDefaultPosition, wxDefaultSize, KICAD_DEFAULT_DRAWFRAME_STYLE, GERBVIEW_FRAME_NAME )
......@@ -78,7 +76,6 @@ GERBVIEW_FRAME::GERBVIEW_FRAME( KIWAY* aKiway, wxWindow* aParent ):
PAGE_INFO pageInfo( wxT( "GERBER" ) );
SetPageSettings( pageInfo );
m_FrameName = GERBVIEW_FRAME_NAME;
m_show_layer_manager_tools = true;
m_showAxis = true; // true to show X and Y axis on screen
......
......@@ -81,6 +81,8 @@ public:
* is the main window used in GerbView.
*/
#define GERBVIEW_FRAME_NAME wxT( "GerberFrame" )
class GERBVIEW_FRAME : public EDA_DRAW_FRAME // PCB_BASE_FRAME
{
GBR_LAYOUT* m_gerberLayout;
......
......@@ -146,6 +146,9 @@ public:
#define HIGHLIGHTED (1 << 25) ///< item is drawn in normal colors, when the rest is darkened
#define BRIGHTENED (1 << 26) ///< item is drawn with a bright contour
#define DP_COUPLED (1 << 27) ///< item is coupled with another item making a differential pair
///< (applies to segments only)
#define EDA_ITEM_ALL_FLAGS -1
typedef unsigned STATUS_FLAGS;
......@@ -488,6 +491,7 @@ public:
*/
static bool Sort( const EDA_ITEM* aLeft, const EDA_ITEM* aRight ) { return *aLeft < *aRight; }
#if 0
/**
* Operator assignment
* is used to assign the members of \a aItem to another object.
......@@ -496,6 +500,8 @@ public:
* as there is a known issue with wxString buffers.
*/
virtual EDA_ITEM& operator=( const EDA_ITEM& aItem );
#define USE_EDA_ITEM_OP_EQ
#endif
/// @copydoc VIEW_ITEM::ViewBBox()
virtual const BOX2I ViewBBox() const;
......
......@@ -546,5 +546,8 @@ EXTERN_BITMAP( zoom_out_xpm )
EXTERN_BITMAP( zoom_page_xpm )
EXTERN_BITMAP( zoom_selection_xpm )
EXTERN_BITMAP( zoom_xpm )
EXTERN_BITMAP( tune_diff_pair_length_legend_xpm )
EXTERN_BITMAP( tune_diff_pair_skew_legend_xpm )
EXTERN_BITMAP( tune_single_track_length_legend_xpm )
#endif // BITMAPS_H_
......@@ -31,6 +31,23 @@
#include <class_netclass.h>
#include <config_params.h>
// Some default values for the board editor and the fp editor (given in mm)
#define DEFAULT_TEXT_MODULE_SIZE 1.0
#define DEFAULT_GR_MODULE_THICKNESS 0.15 // given in mm
// Board thickness, mainly for 3D view:
#define DEFAULT_BOARD_THICKNESS_MM 1.6
// Default values for some board items (given in mm)
#define DEFAULT_TEXT_PCB_SIZE 1.5
#define DEFAULT_TEXT_PCB_THICKNESS 0.3
#define DEFAULT_PCB_EDGE_THICKNESS 0.15
#define DEFAULT_GRAPHIC_THICKNESS 0.2
#define DEFAULT_SOLDERMASK_CLEARANCE 0.2
#define DEFAULT_SOLDERMASK_MIN_WIDTH Millimeter2iu( 0.0 )
/**
* Struct VIA_DIMENSION
* is a small helper container to handle a stock of specific vias each with
......
......@@ -129,6 +129,23 @@ public:
m_List.erase( m_List.begin() + aIndex );
}
/**
* Function Remove
* removes the item aItem (if exists in the collector).
* @param aItem the item to be removed.
*/
void Remove( const EDA_ITEM* aItem )
{
for( size_t i = 0; i < m_List.size(); i++ )
{
if( m_List[i] == aItem )
{
m_List.erase( m_List.begin() + i);
return;
}
}
}
/**
* Function operator[int]
* is used for read only access and returns the object at \a aIndex.
......@@ -223,6 +240,22 @@ public:
else
return false;
}
/**
* Function CountType
* counts the number of items matching aType
* @param aType type we are interested in
* @return number of occurences
*/
int CountType( KICAD_T aType )
{
int cnt = 0;
for( size_t i = 0; i < m_List.size(); i++ )
{
if( m_List[i]->Type() == aType )
cnt++;
}
return cnt;
}
/**
* Function Collect
......
......@@ -198,13 +198,13 @@ public:
class HOTKEYS_EDITOR_DIALOG : public HOTKEYS_EDITOR_DIALOG_BASE
{
protected:
EDA_DRAW_FRAME* m_parent;
EDA_BASE_FRAME* m_parent;
struct EDA_HOTKEY_CONFIG* m_hotkeys;
std::vector<HOTKEY_SECTION_PAGE*> m_hotkeySectionPages;
public:
HOTKEYS_EDITOR_DIALOG( EDA_DRAW_FRAME* aParent, EDA_HOTKEY_CONFIG* aHotkeys );
HOTKEYS_EDITOR_DIALOG( EDA_BASE_FRAME* aParent, EDA_HOTKEY_CONFIG* aHotkeys );
~HOTKEYS_EDITOR_DIALOG() {};
......@@ -259,6 +259,6 @@ private:
* @param aParent is the parent window
* @param aHotkeys is the hotkey configuration array
*/
void InstallHotkeyFrame( EDA_DRAW_FRAME* aParent, EDA_HOTKEY_CONFIG* aHotkeys );
void InstallHotkeyFrame( EDA_BASE_FRAME* aParent, EDA_HOTKEY_CONFIG* aHotkeys );
#endif
......@@ -69,7 +69,7 @@ public:
/**
* Function GetVertices()
* areturn a pointer to the data used by the VERTEX_ITEM.
* Returns pointer to the data used by the VERTEX_ITEM.
*/
VERTEX* GetVertices() const;
......
......@@ -206,6 +206,13 @@ public:
return sqrt( SquaredDistance( aP ) );
}
void CanonicalCoefs( ecoord& qA, ecoord& qB, ecoord& qC ) const
{
qA = A.y - B.y;
qB = B.x - A.x;
qC = -qA * A.x - qB * A.y;
}
/**
* Function Collinear()
*
......@@ -215,9 +222,8 @@ public:
*/
bool Collinear( const SEG& aSeg ) const
{
ecoord qa = A.y - B.y;
ecoord qb = B.x - A.x;
ecoord qc = -qa * A.x - qb * A.y;
ecoord qa, qb, qc;
CanonicalCoefs( qa, qb, qc );
ecoord d1 = std::abs( aSeg.A.x * qa + aSeg.A.y * qb + qc );
ecoord d2 = std::abs( aSeg.B.x * qa + aSeg.B.y * qb + qc );
......@@ -225,6 +231,29 @@ public:
return ( d1 <= 1 && d2 <= 1 );
}
bool ApproxCollinear( const SEG& aSeg ) const
{
ecoord p, q, r;
CanonicalCoefs( p, q, r );
ecoord dist1 = ( p * aSeg.A.x + q * aSeg.A.y + r ) / sqrt( p * p + q * q );
ecoord dist2 = ( p * aSeg.B.x + q * aSeg.B.y + r ) / sqrt( p * p + q * q );
return std::abs( dist1 ) <= 1 && std::abs( dist2 ) <= 1;
}
bool ApproxParallel ( const SEG& aSeg ) const
{
ecoord p, q, r;
CanonicalCoefs( p, q, r );
ecoord dist1 = ( p * aSeg.A.x + q * aSeg.A.y + r ) / sqrt( p * p + q * q );
ecoord dist2 = ( p * aSeg.B.x + q * aSeg.B.y + r ) / sqrt( p * p + q * q );
return std::abs( dist1 - dist2 ) <= 1;
}
bool Overlaps( const SEG& aSeg ) const
{
if( aSeg.A == aSeg.B ) // single point corner case
......@@ -262,6 +291,8 @@ public:
return ( A - B ).SquaredEuclideanNorm();
}
ecoord TCoef( const VECTOR2I& aP ) const;
/**
* Function Index()
*
......@@ -277,7 +308,11 @@ public:
bool PointCloserThan( const VECTOR2I& aP, int aDist ) const;
// friend std::ostream& operator<<( std::ostream& stream, const SEG& aSeg );
void Reverse()
{
std::swap( A, B );
}
private:
bool ccw( const VECTOR2I& aA, const VECTOR2I& aB, const VECTOR2I &aC ) const;
......@@ -285,14 +320,21 @@ private:
int m_index;
};
inline VECTOR2I SEG::LineProject( const VECTOR2I& aP ) const
{
// fixme: numerical errors for large integers
assert( false );
return VECTOR2I( 0, 0 );
}
VECTOR2I d = B - A;
ecoord l_squared = d.Dot( d );
if( l_squared == 0 )
return A;
ecoord t = d.Dot( aP - A );
int xp = rescale( t, (ecoord)d.x, l_squared );
int yp = rescale( t, (ecoord)d.y, l_squared );
return A + VECTOR2I( xp, yp );
}
inline int SEG::LineDistance( const VECTOR2I& aP, bool aDetermineSide ) const
{
......@@ -305,6 +347,11 @@ inline int SEG::LineDistance( const VECTOR2I& aP, bool aDetermineSide ) const
return aDetermineSide ? dist : abs( dist );
}
inline SEG::ecoord SEG::TCoef( const VECTOR2I& aP ) const
{
VECTOR2I d = B - A;
return d.Dot( aP - A);
}
inline const VECTOR2I SEG::NearestPoint( const VECTOR2I& aP ) const
{
......@@ -327,7 +374,6 @@ inline const VECTOR2I SEG::NearestPoint( const VECTOR2I& aP ) const
return A + VECTOR2I( xp, yp );
}
inline std::ostream& operator<<( std::ostream& aStream, const SEG& aSeg )
{
aStream << "[ " << aSeg.A << " - " << aSeg.B << " ]";
......
......@@ -29,10 +29,10 @@
#ifndef HOTKEYS_BASIC_H
#define HOTKEYS_BASIC_H
#define DEFAULT_HOTKEY_FILENAME_EXT wxT( "key" )
#define DEFAULT_HOTKEY_FILENAME_EXT wxT( "hotkeys" )
class EDA_DRAW_FRAME;
class EDA_BASE_FRAME;
/* Identifiers (tags) in key code configuration file (or section names)
......@@ -116,7 +116,7 @@ public:
/* Functions:
*/
void AddHotkeyConfigMenu( wxMenu* menu );
void HandleHotkeyConfigMenuSelection( EDA_DRAW_FRAME* frame, int id );
void HandleHotkeyConfigMenuSelection( EDA_BASE_FRAME* frame, int id );
/**
* Function KeyNameFromKeyCode
......@@ -196,7 +196,7 @@ wxString AddHotkeyName( const wxString& aText,
* @param aFrame = current active frame
* @param aList = pointer to a EDA_HOTKEY_CONFIG list (Null terminated)
*/
void DisplayHotkeyList( EDA_DRAW_FRAME* aFrame, struct EDA_HOTKEY_CONFIG* aList );
void DisplayHotkeyList( EDA_BASE_FRAME* aFrame, struct EDA_HOTKEY_CONFIG* aList );
/**
* Function GetDescriptorFromHotkey
......
......@@ -30,6 +30,7 @@
#include <math/vector2d.h>
#include <limits>
#include <boost/optional.hpp>
/**
* Class BOX2
......@@ -467,6 +468,8 @@ public:
typedef BOX2<VECTOR2I> BOX2I;
typedef BOX2<VECTOR2D> BOX2D;
typedef boost::optional<BOX2I> OPT_BOX2I;
// FIXME should be removed to avoid multiple typedefs for the same type
typedef BOX2D DBOX;
......
......@@ -76,7 +76,16 @@ public:
ALL = 0xff
};
VIEW_ITEM() : m_view( NULL ), m_visible( true ), m_requiredUpdate( ALL ),
/**
* Enum VIEW_VISIBILITY_FLAGS.
* Defines the visibility of the item (temporarily hidden, invisible, etc).
*/
enum VIEW_VISIBILITY_FLAGS {
VISIBLE = 0x01, /// Item is visible (in general)
HIDDEN = 0x02 /// Item is temporarily hidden (e.g. being used by a tool). Overrides VISIBLE flag.
};
VIEW_ITEM() : m_view( NULL ), m_flags( VISIBLE ), m_requiredUpdate( ALL ),
m_groups( NULL ), m_groupsSize( 0 ) {}
/**
......@@ -128,7 +137,39 @@ public:
*
* @param aIsVisible: whether the item is visible (on all layers), or not.
*/
void ViewSetVisible( bool aIsVisible = true );
void ViewSetVisible( bool aIsVisible = true )
{
bool cur_visible = m_flags & VISIBLE;
if( cur_visible != aIsVisible )
{
if( aIsVisible )
m_flags |= VISIBLE;
else
m_flags &= ~VISIBLE;
ViewUpdate( APPEARANCE | COLOR );
}
}
/**
* Function ViewHide()
* Temporarily hides the item in the view (e.g. for overlaying)
*
* @param aHide: whether the item is hidden (on all layers), or not.
*/
void ViewHide( bool aHide = true )
{
if( !( m_flags & VISIBLE ) )
return;
if( aHide )
m_flags |= HIDDEN;
else
m_flags &= ~HIDDEN;
ViewUpdate( APPEARANCE );
}
/**
* Function ViewIsVisible()
......@@ -139,7 +180,7 @@ public:
*/
bool ViewIsVisible() const
{
return m_visible;
return m_flags & VISIBLE;
}
/**
......@@ -201,7 +242,7 @@ protected:
}
VIEW* m_view; ///< Current dynamic view the item is assigned to.
bool m_visible; ///< Are we visible in the current dynamic VIEW.
int m_flags; ///< Visibility flags
int m_requiredUpdate; ///< Flag required for updating
///* Helper for storing cached items group ids
......@@ -295,6 +336,15 @@ protected:
{
m_requiredUpdate = NONE;
}
/**
* Function isRenderable()
* Returns if the item should be drawn or not.
*/
bool isRenderable() const
{
return m_flags == VISIBLE;
}
};
} // namespace KIGFX
......
......@@ -658,6 +658,8 @@ public:
*/
void SetFastGrid2();
void ClearSelection();
DECLARE_EVENT_TABLE()
};
......
......@@ -73,6 +73,8 @@ namespace PCB { struct IFACE; } // KIFACE_I is in pcbnew.cpp
*
* See also class PCB_BASE_FRAME(): Basic class for Pcbnew and GerbView.
*/
#define PCB_EDIT_FRAME_NAME wxT( "PcbFrame" )
class PCB_EDIT_FRAME : public PCB_BASE_EDIT_FRAME
{
friend struct PCB::IFACE;
......
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2014-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 __WX_STATUS_POPUP_H_
#define __WX_STATUS_POPUP_H_
#include <common.h>
#include <wx/popupwin.h>
class PCB_EDIT_FRAME;
/**
* Class WX_STATUS_POPUP
*
* A tiny, headerless popup window used to display useful status (e.g. line length
* tuning info) next to the mouse cursor.
*/
class WX_STATUS_POPUP: public wxPopupWindow
{
public:
WX_STATUS_POPUP( PCB_EDIT_FRAME* aParent );
virtual ~WX_STATUS_POPUP();
virtual void Popup(wxWindow* aFocus = NULL);
virtual void Move( const wxPoint &aWhere );
protected:
void updateSize();
wxPanel* m_panel;
wxBoxSizer* m_topSizer;
};
#endif /* __WX_STATUS_POPUP_H_*/
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2014-2015 CERN
* Author: Maciej Suminski <maciej.suminski@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 __WX_UNIT_BINDER_H_
#define __WX_UNIT_BINDER_H_
#include <common.h>
#include <wx/spinbutt.h>
class wxTextCtrl;
class wxSpinButton;
class wxStaticText;
class WX_UNIT_BINDER
{
public:
/**
* Constructor.
* @param aParent is the parent window.
* @param aTextInput is the text input widget used to edit the given value.
* @param aUnitLabel is the units label displayed next to the text field.
* @param aSpinButton is an optional spin button (for adjusting the input value)
*/
WX_UNIT_BINDER( wxWindow* aParent, wxTextCtrl* aTextInput, wxStaticText* aUnitLabel, wxSpinButton* aSpinButton = NULL );
virtual ~WX_UNIT_BINDER();
/**
* Function SetValue
* Sets new value (in Internal Units) for the text field, taking care of units conversion.
* @param aValue is the new value.
*/
virtual void SetValue( int aValue );
/**
* Function GetValue
* Returns the current value in Internal Units.
*/
virtual int GetValue() const;
/**
* Function Enable
* Enables/diasables the binded widgets
*/
void Enable( bool aEnable );
protected:
void onTextChanged( wxEvent& aEvent );
///> Text input control.
wxTextCtrl* m_textCtrl;
///> Label showing currently used units.
wxStaticText* m_unitLabel;
///> Currently used units.
EDA_UNITS_T m_units;
///> Step size (added/subtracted difference if spin buttons are used).
int m_step;
int m_min;
int m_max;
///> Default value (or non-specified)
static const wxString DEFAULT_VALUE;
};
#endif /* __WX_UNIT_BINDER_H_ */
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2009-2015 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2009-2015 Jean-Pierre Charras, jp.charras wanadoo.fr
* Copyright (C) 2011-2015 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors.
*
......@@ -118,8 +118,7 @@ protected:
wxSize m_FrameSize;
wxAuiToolBar* m_mainToolBar; ///< Standard horizontal Toolbar
wxString m_FrameName; ///< name used for writing and reading setup
///< It is "SchematicFrame", "PcbFrame" ....
wxString m_AboutTitle; ///< Name of program displayed in About.
wxAuiManager m_auimgr;
......@@ -197,8 +196,6 @@ public:
int GetAutoSaveInterval() const { return m_autoSaveInterval; }
wxString GetName() const { return m_FrameName; }
bool IsType( FRAME_T aType ) const { return m_Ident == aType; }
void GetKicadHelp( wxCommandEvent& event );
......@@ -291,15 +288,21 @@ public:
* Function ImportHotkeyConfigFromFile
* Prompt the user for an old hotkey file to read, and read it.
* @param aDescList = current hotkey list descr. to initialize.
* @param aDefaultShortname = a default short name (extention not needed)
* like eechema, kicad...
*/
void ImportHotkeyConfigFromFile( EDA_HOTKEY_CONFIG* aDescList );
void ImportHotkeyConfigFromFile( EDA_HOTKEY_CONFIG* aDescList,
const wxString& aDefaultShortname );
/**
* Function ExportHotkeyConfigToFile
* Prompt the user for an old hotkey file to read, and read it.
* @param aDescList = current hotkey list descr. to initialize.
* @param aDefaultShortname = a default short name (extention not needed)
* like eechema, kicad...
*/
void ExportHotkeyConfigToFile( EDA_HOTKEY_CONFIG* aDescList );
void ExportHotkeyConfigToFile( EDA_HOTKEY_CONFIG* aDescList,
const wxString& aDefaultShortname );
/**
* Function GetFileFromHistory
......
......@@ -38,6 +38,7 @@
#include <online_help.h>
#include <wildcards_and_files_ext.h>
#include <boost/ptr_container/ptr_vector.hpp>
#include <hotkeys_basic.h>
#include <build_version.h>
......@@ -137,6 +138,11 @@ bool PGM_KICAD::OnPgmInit( wxApp* aWxApp )
//DBG( m_bm.m_search.Show( (std::string( __func__ ) + " SysSearch()").c_str() );)
}
// Must be called before creating the main frame in order to
// display the real hotkeys in menus or tool tips
extern struct EDA_HOTKEY_CONFIG kicad_Manager_Hokeys_Descr[];
ReadHotkeyConfig( KICAD_MANAGER_FRAME_NAME, kicad_Manager_Hokeys_Descr );
KICAD_MANAGER_FRAME* frame = new KICAD_MANAGER_FRAME( NULL, wxT( "KiCad" ),
wxDefaultPosition, wxDefaultSize );
App().SetTopWindow( frame );
......
......@@ -46,6 +46,8 @@
#define KICAD_USE_FILES_WATCHER
#endif
#define KICAD_MANAGER_FRAME_NAME wxT( "KicadFrame" )
class LAUNCHER_PANEL;
class TREEPROJECTFILES;
class TREE_PROJECT_FRAME;
......@@ -190,6 +192,9 @@ public:
void OnFileHistory( wxCommandEvent& event );
void OnExit( wxCommandEvent& event );
void Process_Preferences( wxCommandEvent& event );
void Process_Config( wxCommandEvent& event );
void ReCreateMenuBar();
void RecreateBaseHToolbar();
......@@ -292,6 +297,7 @@ private:
wxAuiToolBar* m_VToolBar; // Vertical toolbar (not used)
int m_leftWinWidth;
EDA_HOTKEY_CONFIG* m_manager_Hokeys_Descr;
void language_change( wxCommandEvent& event );
};
......
......@@ -40,17 +40,18 @@
#include <tree_project_frame.h>
#include <wildcards_and_files_ext.h>
#include <menus_helpers.h>
#include <dialog_hotkeys_editor.h>
#define TREE_FRAME_WIDTH_ENTRY wxT( "LeftWinWidth" )
KICAD_MANAGER_FRAME::KICAD_MANAGER_FRAME( wxWindow* parent,
const wxString& title, const wxPoint& pos, const wxSize& size ) :
EDA_BASE_FRAME( parent, KICAD_MAIN_FRAME_T, title, pos, size,
KICAD_DEFAULT_DRAWFRAME_STYLE, wxT( "KicadFrame" ) )
KICAD_DEFAULT_DRAWFRAME_STYLE, KICAD_MANAGER_FRAME_NAME )
{
m_leftWinWidth = 60;
m_manager_Hokeys_Descr = NULL;
// Create the status line (bottom of the frame
static const int dims[3] = { -1, -1, 100 };
......@@ -529,3 +530,33 @@ void KICAD_MANAGER_FRAME::PrintPrjInfo()
PrintMsg( msg );
}
void KICAD_MANAGER_FRAME::Process_Config( wxCommandEvent& event )
{
int id = event.GetId();
wxFileName fn;
switch( id )
{
// Hotkey IDs
case ID_PREFERENCES_HOTKEY_SHOW_EDITOR:
InstallHotkeyFrame( this, m_manager_Hokeys_Descr );
break;
case ID_PREFERENCES_HOTKEY_EXPORT_CONFIG:
ExportHotkeyConfigToFile( m_manager_Hokeys_Descr, wxT( "kicad" ) );
break;
case ID_PREFERENCES_HOTKEY_IMPORT_CONFIG:
ImportHotkeyConfigFromFile( m_manager_Hokeys_Descr, wxT( "kicad" ) );
break;
case ID_PREFERENCES_HOTKEY_SHOW_CURRENT_LIST:
// Display current hotkey list for LibEdit.
DisplayHotkeyList( this, m_manager_Hokeys_Descr );
break;
default:
wxFAIL_MSG( wxT( "KICAD_MANAGER_FRAME::Process_Config error" ) );
break;
}
}
This diff is collapsed.
......@@ -122,7 +122,7 @@ bool IFACE::OnKifaceStart( PGM_BASE* aProgram, int aCtlBits )
// Must be called before creating the main frame in order to
// display the real hotkeys in menus or tool tips
ReadHotkeyConfig( wxT("PlEditorFrame"), s_PlEditor_Hokeys_Descr );
ReadHotkeyConfig( PL_EDITOR_FRAME_NAME, s_PlEditor_Hokeys_Descr );
g_UserUnit = MILLIMETRES;
......@@ -159,7 +159,7 @@ bool MYFACE::OnKifaceStart( PGM_BASE* aProgram )
// Must be called before creating the main frame in order to
// display the real hotkeys in menus or tool tips
ReadHotkeyConfig( wxT("PlEditorFrame"), s_PlEditor_Hokeys_Descr );
ReadHotkeyConfig( PL_EDITOR_FRAME_NAME, s_PlEditor_Hokeys_Descr );
PL_EDITOR_FRAME * frame = new PL_EDITOR_FRAME( NULL, wxT( "PlEditorFrame" ), wxPoint( 0, 0 ), wxSize( 600, 400 ) );
......
......@@ -74,11 +74,11 @@ void PL_EDITOR_FRAME::Process_Config( wxCommandEvent& event )
break;
case ID_PREFERENCES_HOTKEY_EXPORT_CONFIG:
ExportHotkeyConfigToFile( s_PlEditor_Hokeys_Descr );
ExportHotkeyConfigToFile( s_PlEditor_Hokeys_Descr, wxT( "pl_editor" ) );
break;
case ID_PREFERENCES_HOTKEY_IMPORT_CONFIG:
ImportHotkeyConfigFromFile( s_PlEditor_Hokeys_Descr );
ImportHotkeyConfigFromFile( s_PlEditor_Hokeys_Descr, wxT( "pl_editor" ) );
break;
case ID_PREFERENCES_HOTKEY_SHOW_CURRENT_LIST:
......
......@@ -50,13 +50,10 @@
/* class PL_EDITOR_FRAME */
/*************************/
#define PL_EDITOR_FRAME_NAME wxT( "PlEditorFrame" )
PL_EDITOR_FRAME::PL_EDITOR_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
EDA_DRAW_FRAME( aKiway, aParent, FRAME_PL_EDITOR, wxT( "PlEditorFrame" ),
wxDefaultPosition, wxDefaultSize, KICAD_DEFAULT_DRAWFRAME_STYLE, PL_EDITOR_FRAME_NAME )
{
m_FrameName = PL_EDITOR_FRAME_NAME;
m_zoomLevelCoeff = 290.0; // Adjusted to roughly displays zoom level = 1
// when the screen shows a 1:1 image
// obviously depends on the monitor,
......
......@@ -45,6 +45,8 @@ class WORKSHEET_DATAITEM;
* Class PL_EDITOR_FRAME
* is the main window used in the page layout editor.
*/
#define PL_EDITOR_FRAME_NAME wxT( "PlEditorFrame" )
class PL_EDITOR_FRAME : public EDA_DRAW_FRAME
{
PL_EDITOR_LAYOUT m_pageLayout;
......
......@@ -108,6 +108,10 @@ set( PCBNEW_DIALOGS
dialogs/dialog_pns_settings_base.cpp
dialogs/dialog_move_exact.cpp
dialogs/dialog_move_exact_base.cpp
dialogs/dialog_pns_diff_pair_dimensions.cpp
dialogs/dialog_pns_diff_pair_dimensions_base.cpp
dialogs/dialog_pns_length_tuning_settings.cpp
dialogs/dialog_pns_length_tuning_settings_base.cpp
dialogs/dialog_non_copper_zones_properties.cpp
dialogs/dialog_non_copper_zones_properties_base.cpp
dialogs/dialog_pad_properties.cpp
......@@ -279,6 +283,8 @@ set( PCBNEW_CLASS_SRCS
tools/module_tools.cpp
tools/placement_tool.cpp
tools/common_actions.cpp
tools/grid_helper.cpp
tools/tools_common.cpp
)
set( PCBNEW_SRCS ${PCBNEW_AUTOROUTER_SRCS} ${PCBNEW_CLASS_SRCS} ${PCBNEW_DIALOGS} )
......
......@@ -752,23 +752,25 @@ void PCB_BASE_FRAME::LoadSettings( wxConfigBase* aCfg )
(m_LastGridSizeId > (ID_POPUP_GRID_USER - ID_POPUP_GRID_LEVEL_1000)) )
m_LastGridSizeId = ID_POPUP_GRID_LEVEL_500 - ID_POPUP_GRID_LEVEL_1000;
aCfg->Read( m_FrameName + UserGridSizeXEntry, &m_UserGridSize.x, 0.01 );
aCfg->Read( m_FrameName + UserGridSizeYEntry, &m_UserGridSize.y, 0.01 );
wxString baseCfgName = GetName();
aCfg->Read( baseCfgName + UserGridSizeXEntry, &m_UserGridSize.x, 0.01 );
aCfg->Read( baseCfgName + UserGridSizeYEntry, &m_UserGridSize.y, 0.01 );
long itmp;
aCfg->Read( m_FrameName + UserGridUnitsEntry, &itmp, ( long )INCHES );
aCfg->Read( baseCfgName + UserGridUnitsEntry, &itmp, ( long )INCHES );
m_UserGridUnit = (EDA_UNITS_T) itmp;
aCfg->Read( m_FrameName + DisplayPadFillEntry, &m_DisplayOptions.m_DisplayPadFill, true );
aCfg->Read( m_FrameName + DisplayViaFillEntry, &m_DisplayOptions.m_DisplayViaFill, true );
aCfg->Read( m_FrameName + DisplayPadNumberEntry, &m_DisplayOptions.m_DisplayPadNum, true );
aCfg->Read( m_FrameName + DisplayModuleEdgeEntry, &m_DisplayOptions.m_DisplayModEdgeFill, true );
aCfg->Read( baseCfgName + DisplayPadFillEntry, &m_DisplayOptions.m_DisplayPadFill, true );
aCfg->Read( baseCfgName + DisplayViaFillEntry, &m_DisplayOptions.m_DisplayViaFill, true );
aCfg->Read( baseCfgName + DisplayPadNumberEntry, &m_DisplayOptions.m_DisplayPadNum, true );
aCfg->Read( baseCfgName + DisplayModuleEdgeEntry, &m_DisplayOptions.m_DisplayModEdgeFill, true );
aCfg->Read( m_FrameName + FastGrid1Entry, &itmp, ( long )0);
aCfg->Read( baseCfgName + FastGrid1Entry, &itmp, ( long )0);
m_FastGrid1 = itmp;
aCfg->Read( m_FrameName + FastGrid2Entry, &itmp, ( long )0);
aCfg->Read( baseCfgName + FastGrid2Entry, &itmp, ( long )0);
m_FastGrid2 = itmp;
aCfg->Read( m_FrameName + DisplayModuleTextEntry, &m_DisplayOptions.m_DisplayModTextFill, true );
aCfg->Read( baseCfgName + DisplayModuleTextEntry, &m_DisplayOptions.m_DisplayModTextFill, true );
}
......@@ -776,16 +778,18 @@ void PCB_BASE_FRAME::SaveSettings( wxConfigBase* aCfg )
{
EDA_DRAW_FRAME::SaveSettings( aCfg );
aCfg->Write( m_FrameName + UserGridSizeXEntry, m_UserGridSize.x );
aCfg->Write( m_FrameName + UserGridSizeYEntry, m_UserGridSize.y );
aCfg->Write( m_FrameName + UserGridUnitsEntry, ( long )m_UserGridUnit );
aCfg->Write( m_FrameName + DisplayPadFillEntry, m_DisplayOptions.m_DisplayPadFill );
aCfg->Write( m_FrameName + DisplayViaFillEntry, m_DisplayOptions.m_DisplayViaFill );
aCfg->Write( m_FrameName + DisplayPadNumberEntry, m_DisplayOptions.m_DisplayPadNum );
aCfg->Write( m_FrameName + DisplayModuleEdgeEntry, m_DisplayOptions.m_DisplayModEdgeFill );
aCfg->Write( m_FrameName + DisplayModuleTextEntry, m_DisplayOptions.m_DisplayModTextFill );
aCfg->Write( m_FrameName + FastGrid1Entry, ( long )m_FastGrid1 );
aCfg->Write( m_FrameName + FastGrid2Entry, ( long )m_FastGrid2 );
wxString baseCfgName = GetName();
aCfg->Write( baseCfgName + UserGridSizeXEntry, m_UserGridSize.x );
aCfg->Write( baseCfgName + UserGridSizeYEntry, m_UserGridSize.y );
aCfg->Write( baseCfgName + UserGridUnitsEntry, ( long )m_UserGridUnit );
aCfg->Write( baseCfgName + DisplayPadFillEntry, m_DisplayOptions.m_DisplayPadFill );
aCfg->Write( baseCfgName + DisplayViaFillEntry, m_DisplayOptions.m_DisplayViaFill );
aCfg->Write( baseCfgName + DisplayPadNumberEntry, m_DisplayOptions.m_DisplayPadNum );
aCfg->Write( baseCfgName + DisplayModuleEdgeEntry, m_DisplayOptions.m_DisplayModEdgeFill );
aCfg->Write( baseCfgName + DisplayModuleTextEntry, m_DisplayOptions.m_DisplayModTextFill );
aCfg->Write( baseCfgName + FastGrid1Entry, ( long )m_FastGrid1 );
aCfg->Write( baseCfgName + FastGrid2Entry, ( long )m_FastGrid2 );
}
......
......@@ -387,7 +387,7 @@ void PCB_EDIT_FRAME::SaveCopyInUndoList( const PICKED_ITEMS_LIST& aItemsList,
BOARD_ITEM* item = (BOARD_ITEM*) commandToUndo->GetPickedItem( ii );
// For texts belonging to modules, we need to save state of the parent module
if( item->Type() == PCB_MODULE_TEXT_T )
if( item->Type() == PCB_MODULE_TEXT_T || item->Type() == PCB_PAD_T )
{
item = item->GetParent();
wxASSERT( item->Type() == PCB_MODULE_T );
......
......@@ -36,20 +36,6 @@
#include <class_track.h>
#include <convert_from_iu.h>
// Board thickness, mainly for 3D view:
#define DEFAULT_BOARD_THICKNESS_MM 1.6
// Default values for some board items
#define DEFAULT_TEXT_PCB_SIZE Millimeter2iu( 1.5 )
#define DEFAULT_TEXT_PCB_THICKNESS Millimeter2iu( 0.3 )
#define DEFAULT_PCB_EDGE_THICKNESS Millimeter2iu( 0.15 )
#define DEFAULT_GRAPHIC_THICKNESS Millimeter2iu( 0.2 )
#define DEFAULT_TEXT_MODULE_SIZE Millimeter2iu( 1.5 )
#define DEFAULT_GR_MODULE_THICKNESS Millimeter2iu( 0.15 )
#define DEFAULT_SOLDERMASK_CLEARANCE Millimeter2iu( 0.2 )
#define DEFAULT_SOLDERMASK_MIN_WIDTH Millimeter2iu( 0.0 )
BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS() :
m_Pad_Master( NULL )
......@@ -74,13 +60,13 @@ BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS() :
m_BlindBuriedViaAllowed = false; // true to allow blind/buried vias
m_MicroViasAllowed = false; // true to allow micro vias
m_DrawSegmentWidth = DEFAULT_GRAPHIC_THICKNESS; // current graphic line width (not EDGE layer)
m_DrawSegmentWidth = Millimeter2iu( DEFAULT_GRAPHIC_THICKNESS ); // current graphic line width (not EDGE layer)
m_EdgeSegmentWidth = DEFAULT_PCB_EDGE_THICKNESS; // current graphic line width (EDGE layer only)
m_PcbTextWidth = DEFAULT_TEXT_PCB_THICKNESS; // current Pcb (not module) Text width
m_EdgeSegmentWidth = Millimeter2iu( DEFAULT_PCB_EDGE_THICKNESS ); // current graphic line width (EDGE layer only)
m_PcbTextWidth = Millimeter2iu(DEFAULT_TEXT_PCB_THICKNESS ); // current Pcb (not module) Text width
m_PcbTextSize = wxSize( DEFAULT_TEXT_PCB_SIZE,
DEFAULT_TEXT_PCB_SIZE ); // current Pcb (not module) Text size
m_PcbTextSize = wxSize( Millimeter2iu( DEFAULT_TEXT_PCB_SIZE ),
Millimeter2iu( DEFAULT_TEXT_PCB_SIZE ) ); // current Pcb (not module) Text size
m_useCustomTrackVia = false;
m_customTrackWidth = DMils2iu( 100 );
......@@ -91,8 +77,8 @@ BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS() :
m_MicroViasMinDrill = DMils2iu( 50 ); // micro vias (not vias) min drill diameter
// Global mask margins:
m_SolderMaskMargin = DEFAULT_SOLDERMASK_CLEARANCE; // Solder mask margin
m_SolderMaskMinWidth = DEFAULT_SOLDERMASK_MIN_WIDTH; // Solder mask min width
m_SolderMaskMargin = Millimeter2iu( DEFAULT_SOLDERMASK_CLEARANCE ); // Solder mask margin
m_SolderMaskMinWidth = Millimeter2iu( DEFAULT_SOLDERMASK_MIN_WIDTH ); // Solder mask min width
m_SolderPasteMargin = 0; // Solder paste margin absolute value
m_SolderPasteMarginRatio = 0.0; // Solder pask margin ratio value of pad size
// The final margin is the sum of these 2 values
......@@ -106,10 +92,10 @@ BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS() :
// Default values for the footprint editor and fp creation
// (also covers footprints created on the fly by micor-waves tools)
m_ModuleTextSize = wxSize( DEFAULT_TEXT_MODULE_SIZE,
DEFAULT_TEXT_MODULE_SIZE );
m_ModuleTextWidth = DEFAULT_GR_MODULE_THICKNESS;
m_ModuleSegmentWidth = DEFAULT_GR_MODULE_THICKNESS;
m_ModuleTextSize = wxSize( Millimeter2iu( DEFAULT_TEXT_MODULE_SIZE ),
Millimeter2iu( DEFAULT_TEXT_MODULE_SIZE ) );
m_ModuleTextWidth = Millimeter2iu( DEFAULT_GR_MODULE_THICKNESS );
m_ModuleSegmentWidth = Millimeter2iu( DEFAULT_GR_MODULE_THICKNESS );
// These values will be overriden by config values after reading the config
// Default ref text on fp creation. if empty, use footprint name as default
......@@ -130,17 +116,17 @@ void BOARD_DESIGN_SETTINGS::AppendConfigs( PARAM_CFG_ARRAY* aResult )
aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "PcbTextSizeV" ),
&m_PcbTextSize.y,
DEFAULT_TEXT_PCB_SIZE, TEXTS_MIN_SIZE, TEXTS_MAX_SIZE,
Millimeter2iu( DEFAULT_TEXT_PCB_SIZE ), TEXTS_MIN_SIZE, TEXTS_MAX_SIZE,
NULL, MM_PER_IU ) );
aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "PcbTextSizeH" ),
&m_PcbTextSize.x,
DEFAULT_TEXT_PCB_SIZE, TEXTS_MIN_SIZE, TEXTS_MAX_SIZE,
Millimeter2iu( DEFAULT_TEXT_PCB_SIZE ), TEXTS_MIN_SIZE, TEXTS_MAX_SIZE,
NULL, MM_PER_IU ) );
aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "PcbTextThickness" ),
&m_PcbTextWidth,
DEFAULT_TEXT_PCB_THICKNESS,
Millimeter2iu(DEFAULT_TEXT_PCB_THICKNESS ),
Millimeter2iu( 0.01 ), Millimeter2iu( 5.0 ),
NULL, MM_PER_IU ) );
......@@ -156,34 +142,34 @@ void BOARD_DESIGN_SETTINGS::AppendConfigs( PARAM_CFG_ARRAY* aResult )
aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "ModuleTextSizeThickness" ),
&m_ModuleTextWidth,
DEFAULT_GR_MODULE_THICKNESS, 1, TEXTS_MAX_WIDTH,
Millimeter2iu( DEFAULT_GR_MODULE_THICKNESS ), 1, TEXTS_MAX_WIDTH,
NULL, MM_PER_IU ) );
aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "SolderMaskClearance" ),
&m_SolderMaskMargin,
DEFAULT_SOLDERMASK_CLEARANCE, 0, Millimeter2iu( 1.0 ),
Millimeter2iu( DEFAULT_SOLDERMASK_CLEARANCE ), 0, Millimeter2iu( 1.0 ),
NULL, MM_PER_IU ) );
aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "SolderMaskMinWidth" ),
&m_SolderMaskMinWidth,
DEFAULT_SOLDERMASK_MIN_WIDTH, 0, Millimeter2iu( 0.5 ),
Millimeter2iu( DEFAULT_SOLDERMASK_MIN_WIDTH ), 0, Millimeter2iu( 0.5 ),
NULL, MM_PER_IU ) );
aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "DrawSegmentWidth" ),
&m_DrawSegmentWidth,
DEFAULT_GRAPHIC_THICKNESS,
Millimeter2iu( DEFAULT_GRAPHIC_THICKNESS ),
Millimeter2iu( 0.01 ), Millimeter2iu( 5.0 ),
NULL, MM_PER_IU ) );
aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "BoardOutlineThickness" ),
&m_EdgeSegmentWidth,
DEFAULT_PCB_EDGE_THICKNESS,
Millimeter2iu( DEFAULT_PCB_EDGE_THICKNESS ),
Millimeter2iu( 0.01 ), Millimeter2iu( 5.0 ),
NULL, MM_PER_IU ) );
aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "ModuleOutlineThickness" ),
&m_ModuleSegmentWidth,
DEFAULT_GR_MODULE_THICKNESS,
Millimeter2iu( DEFAULT_GR_MODULE_THICKNESS ),
Millimeter2iu( 0.01 ), Millimeter2iu( 5.0 ),
NULL, MM_PER_IU ) );
}
......
......@@ -69,6 +69,11 @@ public:
/// skip the linked list stuff, and parent
const DRAWSEGMENT& operator = ( const DRAWSEGMENT& rhs );
static inline bool ClassOf( const EDA_ITEM* aItem )
{
return aItem && PCB_LINE_T == aItem->Type();
}
void SetWidth( int aWidth ) { m_Width = aWidth; }
int GetWidth() const { return m_Width; }
......
......@@ -57,7 +57,7 @@ MODULE::MODULE( BOARD* parent ) :
m_Attributs = MOD_DEFAULT;
m_Layer = F_Cu;
m_Orient = 0;
m_ModuleStatus = 0;
m_ModuleStatus = MODULE_PADS_LOCKED;
flag = 0;
m_CntRot90 = m_CntRot180 = 0;
m_Surface = 0.0;
......@@ -1035,13 +1035,11 @@ void MODULE::MoveAnchorPosition( const wxPoint& aMoveVector )
* but:
* - the footprint position is not modified.
* - the relative (local) coordinates of these items are modified
* - Draw coordinates are updated
*/
wxPoint footprintPos = GetPosition();
/* Update the relative coordinates:
* The coordinates are relative to the anchor point.
* Calculate deltaX and deltaY from the anchor. */
// Update (move) the relative coordinates relative to the new anchor point.
wxPoint moveVector = aMoveVector;
RotatePoint( &moveVector, -GetOrientation() );
......@@ -1243,3 +1241,20 @@ bool MODULE::IncrementReference( bool aFillSequenceGaps )
return success;
}
double MODULE::PadCoverageRatio() const
{
double padArea = 0.0;
double moduleArea = GetFootprintRect().GetArea();
for( D_PAD* pad = m_Pads; pad; pad = pad->Next() )
padArea += pad->GetBoundingBox().GetArea();
if( moduleArea == 0.0 )
return 1.0;
double ratio = padArea / moduleArea;
return std::min( ratio, 1.0 );
}
......@@ -232,6 +232,7 @@ public:
#define MODULE_is_LOCKED 0x01 ///< module LOCKED: no autoplace allowed
#define MODULE_is_PLACED 0x02 ///< In autoplace: module automatically placed
#define MODULE_to_PLACE 0x04 ///< In autoplace: module waiting for autoplace
#define MODULE_PADS_LOCKED 0x08 ///< In autoplace: module waiting for autoplace
bool IsLocked() const
......@@ -270,6 +271,16 @@ public:
m_ModuleStatus &= ~MODULE_to_PLACE;
}
bool PadsLocked() const { return ( m_ModuleStatus & MODULE_PADS_LOCKED ); }
void SetPadsLocked( bool aPadsLocked )
{
if( aPadsLocked )
m_ModuleStatus |= MODULE_PADS_LOCKED;
else
m_ModuleStatus &= ~MODULE_PADS_LOCKED;
}
void SetLastEditTime( time_t aTime ) { m_LastEditTime = aTime; }
void SetLastEditTime( ) { m_LastEditTime = time( NULL ); }
time_t GetLastEditTime() const { return m_LastEditTime; }
......@@ -606,6 +617,14 @@ public:
m_initial_comments = aInitialComments;
}
/**
* Function PadCoverageRatio
* Calculates the ratio of total area of the footprint pads to the area of the
* footprint. Used by selection tool heuristics.
* @return the ratio
*/
double PadCoverageRatio() const;
/// Return the initial comments block or NULL if none, without transfer of ownership.
const wxArrayString* GetInitialComments() const { return m_initial_comments; }
......
......@@ -177,7 +177,6 @@ const EDA_RECT D_PAD::GetBoundingBox() const
area.SetOrigin( m_Pos.x-dx, m_Pos.y-dy );
area.SetSize( 2*dx, 2*dy );
break;
break;
case PAD_RECT:
//Use two corners and track their rotation
......
......@@ -94,6 +94,11 @@ public:
///< used for edge board connectors
static LSET UnplatedHoleMask(); ///< layer set for a mechanical unplated through hole pad
static inline bool ClassOf( const EDA_ITEM* aItem )
{
return aItem && PCB_PAD_T == aItem->Type();
}
void Copy( D_PAD* source );
D_PAD* Next() const { return static_cast<D_PAD*>( Pnext ); }
......
......@@ -49,6 +49,11 @@ public:
~TEXTE_PCB();
static inline bool ClassOf( const EDA_ITEM* aItem )
{
return aItem && PCB_TEXT_T == aItem->Type();
}
virtual const wxPoint& GetPosition() const
{
return m_Pos;
......
......@@ -313,12 +313,19 @@ void DIALOG_MODULE_BOARD_EDITOR::InitModeditProperties()
break;
}
m_AutoPlaceCtrl->SetSelection( (m_CurrentModule->IsLocked()) ? 1 : 0 );
if( m_CurrentModule->IsLocked() )
m_AutoPlaceCtrl->SetSelection( 2 );
else if( m_CurrentModule->PadsLocked() )
m_AutoPlaceCtrl->SetSelection( 1 );
else
m_AutoPlaceCtrl->SetSelection( 0 );
m_AutoPlaceCtrl->SetItemToolTip( 0,
_( "Enable hotkey move commands and Auto Placement" ) );
_( "Component can be freely moved and auto placed. User can arbitrarily select and edit component's pads." ) );
m_AutoPlaceCtrl->SetItemToolTip( 1,
_( "Disable hotkey move commands and Auto Placement" ) );
_( "Component can be freely moved and auto placed, but its pads cannot be selected or edited." ) );
m_AutoPlaceCtrl->SetItemToolTip( 2,
_( "Component is locked: it cannot be freely moved or auto placed." ) );
m_CostRot90Ctrl->SetValue( m_CurrentModule->GetPlacementCost90() );
......@@ -583,7 +590,8 @@ void DIALOG_MODULE_BOARD_EDITOR::OnOkClick( wxCommandEvent& event )
modpos.x = ValueFromTextCtrl( *m_ModPositionX );
modpos.y = ValueFromTextCtrl( *m_ModPositionY );
m_CurrentModule->SetPosition( modpos );
m_CurrentModule->SetLocked( m_AutoPlaceCtrl->GetSelection() == 1 );
m_CurrentModule->SetLocked( m_AutoPlaceCtrl->GetSelection() == 2 );
m_CurrentModule->SetPadsLocked( m_AutoPlaceCtrl->GetSelection() == 1 );
switch( m_AttributsCtrl->GetSelection() )
{
......
......@@ -143,10 +143,10 @@ DIALOG_MODULE_BOARD_EDITOR_BASE::DIALOG_MODULE_BOARD_EDITOR_BASE( wxWindow* pare
m_AttributsCtrl->SetSelection( 0 );
bSizerAttrib->Add( m_AttributsCtrl, 1, wxALL|wxEXPAND, 5 );
wxString m_AutoPlaceCtrlChoices[] = { _("Free"), _("Locked") };
wxString m_AutoPlaceCtrlChoices[] = { _("Free"), _("Lock pads"), _("Lock module") };
int m_AutoPlaceCtrlNChoices = sizeof( m_AutoPlaceCtrlChoices ) / sizeof( wxString );
m_AutoPlaceCtrl = new wxRadioBox( m_PanelProperties, wxID_ANY, _("Move and Place"), wxDefaultPosition, wxDefaultSize, m_AutoPlaceCtrlNChoices, m_AutoPlaceCtrlChoices, 1, wxRA_SPECIFY_COLS );
m_AutoPlaceCtrl->SetSelection( 0 );
m_AutoPlaceCtrl->SetSelection( 1 );
bSizerAttrib->Add( m_AutoPlaceCtrl, 1, wxALL|wxEXPAND, 5 );
......
......@@ -2260,7 +2260,7 @@
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="choices">&quot;Free&quot; &quot;Locked&quot;</property>
<property name="choices">&quot;Free&quot; &quot;Lock pads&quot; &quot;Lock module&quot;</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
......@@ -2292,7 +2292,7 @@
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="selection">0</property>
<property name="selection">1</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style">wxRA_SPECIFY_COLS</property>
......
/*
* KiRouter - a push-and-(sometimes-)shove PCB router
*
* Copyright (C) 2014-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 3 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, see <http://www.gnu.org/licenses/>.
*/
/**
* Push and Shove diff pair dimensions (gap) settings dialog.
*/
#include "dialog_pns_diff_pair_dimensions.h"
#include <router/pns_sizes_settings.h>
DIALOG_PNS_DIFF_PAIR_DIMENSIONS::DIALOG_PNS_DIFF_PAIR_DIMENSIONS( wxWindow* aParent, PNS_SIZES_SETTINGS& aSizes ) :
DIALOG_PNS_DIFF_PAIR_DIMENSIONS_BASE( aParent ),
m_traceWidth( this, m_traceWidthText, m_traceWidthUnit ),
m_traceGap( this, m_traceGapText, m_traceGapUnit ),
m_viaGap( this, m_viaGapText, m_viaGapUnit ),
m_sizes( aSizes )
{
m_traceWidth.SetValue( aSizes.DiffPairWidth() );
m_traceGap.SetValue( aSizes.DiffPairGap() );
m_viaGap.SetValue( aSizes.DiffPairViaGap() );
m_viaTraceGapEqual->SetValue( m_sizes.DiffPairViaGapSameAsTraceGap() );
updateCheckbox();
}
void DIALOG_PNS_DIFF_PAIR_DIMENSIONS::updateCheckbox()
{
if( m_viaTraceGapEqual->GetValue() )
{
m_sizes.SetDiffPairViaGapSameAsTraceGap( true );
m_viaGapText->Disable();
m_viaGapLabel->Disable();
m_viaGapUnit->Disable();
} else {
m_sizes.SetDiffPairViaGapSameAsTraceGap( false );
m_viaGapText->Enable();
m_viaGapLabel->Enable();
m_viaGapUnit->Enable();
}
}
void DIALOG_PNS_DIFF_PAIR_DIMENSIONS::OnClose( wxCloseEvent& aEvent )
{
// Do nothing, it is result of ESC pressing
EndModal( 0 );
}
void DIALOG_PNS_DIFF_PAIR_DIMENSIONS::OnOkClick( wxCommandEvent& aEvent )
{
// Save widgets' values to settings
m_sizes.SetDiffPairGap ( m_traceGap.GetValue() );
m_sizes.SetDiffPairViaGap ( m_viaGap.GetValue() );
m_sizes.SetDiffPairWidth ( m_traceWidth.GetValue() );
// todo: verify against design rules
EndModal( 1 );
}
void DIALOG_PNS_DIFF_PAIR_DIMENSIONS::OnCancelClick( wxCommandEvent& aEvent )
{
// Do nothing
EndModal( 0 );
}
void DIALOG_PNS_DIFF_PAIR_DIMENSIONS::OnViaTraceGapEqualCheck( wxCommandEvent& event )
{
event.Skip();
updateCheckbox();
}
/*
* KiRouter - a push-and-(sometimes-)shove PCB router
*
* Copyright (C) 2014-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 3 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, see <http://www.gnu.or/licenses/>.
*/
/**
* Push and Shove diff pair dimensions (gap) settings dialog.
*/
#ifndef __dialog_diff_pair_dimensions_settings__
#define __dialog_diff_pair_dimensions_settings__
#include <wx_unit_binder.h>
#include "dialog_pns_diff_pair_dimensions_base.h"
class PNS_SIZES_SETTINGS;
class DIALOG_PNS_DIFF_PAIR_DIMENSIONS : public DIALOG_PNS_DIFF_PAIR_DIMENSIONS_BASE
{
public:
DIALOG_PNS_DIFF_PAIR_DIMENSIONS( wxWindow* aParent, PNS_SIZES_SETTINGS& aSizes );
virtual void OnClose( wxCloseEvent& aEvent );
virtual void OnOkClick( wxCommandEvent& aEvent );
virtual void OnCancelClick( wxCommandEvent& aEvent );
virtual void OnViaTraceGapEqualCheck( wxCommandEvent& event );
private:
void updateCheckbox();
WX_UNIT_BINDER m_traceWidth;
WX_UNIT_BINDER m_traceGap;
WX_UNIT_BINDER m_viaGap;
PNS_SIZES_SETTINGS& m_sizes;
};
#endif // __dialog_pns_settings__
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 6 2014)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "dialog_pns_diff_pair_dimensions_base.h"
///////////////////////////////////////////////////////////////////////////
DIALOG_PNS_DIFF_PAIR_DIMENSIONS_BASE::DIALOG_PNS_DIFF_PAIR_DIMENSIONS_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxSize( 400,-1 ), wxDefaultSize );
wxBoxSizer* bSizer7;
bSizer7 = new wxBoxSizer( wxVERTICAL );
wxFlexGridSizer* fgSizer1;
fgSizer1 = new wxFlexGridSizer( 0, 3, 0, 0 );
fgSizer1->AddGrowableCol( 1 );
fgSizer1->SetFlexibleDirection( wxBOTH );
fgSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_traceWidthLabel = new wxStaticText( this, wxID_ANY, _("Width:"), wxDefaultPosition, wxDefaultSize, 0 );
m_traceWidthLabel->Wrap( -1 );
fgSizer1->Add( m_traceWidthLabel, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT, 5 );
m_traceWidthText = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizer1->Add( m_traceWidthText, 0, wxALL|wxEXPAND, 5 );
m_traceWidthUnit = new wxStaticText( this, wxID_ANY, _("u"), wxDefaultPosition, wxDefaultSize, 0 );
m_traceWidthUnit->Wrap( -1 );
fgSizer1->Add( m_traceWidthUnit, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
m_traceGapLabel = new wxStaticText( this, wxID_ANY, _("Trace gap:"), wxDefaultPosition, wxDefaultSize, 0 );
m_traceGapLabel->Wrap( -1 );
fgSizer1->Add( m_traceGapLabel, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT, 5 );
m_traceGapText = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizer1->Add( m_traceGapText, 0, wxALL|wxEXPAND, 5 );
m_traceGapUnit = new wxStaticText( this, wxID_ANY, _("u"), wxDefaultPosition, wxDefaultSize, 0 );
m_traceGapUnit->Wrap( -1 );
m_traceGapUnit->SetMaxSize( wxSize( 40,-1 ) );
fgSizer1->Add( m_traceGapUnit, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
m_viaGapLabel = new wxStaticText( this, wxID_ANY, _("Via gap:"), wxDefaultPosition, wxDefaultSize, 0 );
m_viaGapLabel->Wrap( -1 );
m_viaGapLabel->Enable( false );
fgSizer1->Add( m_viaGapLabel, 0, wxALL|wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL, 5 );
m_viaGapText = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_viaGapText->Enable( false );
fgSizer1->Add( m_viaGapText, 0, wxALL|wxEXPAND, 5 );
m_viaGapUnit = new wxStaticText( this, wxID_ANY, _("u"), wxDefaultPosition, wxDefaultSize, 0 );
m_viaGapUnit->Wrap( -1 );
m_viaGapUnit->Enable( false );
m_viaGapUnit->SetMaxSize( wxSize( 40,-1 ) );
fgSizer1->Add( m_viaGapUnit, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
bSizer7->Add( fgSizer1, 0, wxEXPAND, 5 );
m_viaTraceGapEqual = new wxCheckBox( this, wxID_ANY, _("Via gap same as trace gap"), wxDefaultPosition, wxDefaultSize, 0 );
m_viaTraceGapEqual->SetValue(true);
bSizer7->Add( m_viaTraceGapEqual, 0, wxALL|wxEXPAND, 5 );
m_stdButtons = new wxStdDialogButtonSizer();
m_stdButtonsOK = new wxButton( this, wxID_OK );
m_stdButtons->AddButton( m_stdButtonsOK );
m_stdButtonsCancel = new wxButton( this, wxID_CANCEL );
m_stdButtons->AddButton( m_stdButtonsCancel );
m_stdButtons->Realize();
bSizer7->Add( m_stdButtons, 0, wxEXPAND, 5 );
this->SetSizer( bSizer7 );
this->Layout();
// Connect Events
this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_PNS_DIFF_PAIR_DIMENSIONS_BASE::OnClose ) );
m_viaTraceGapEqual->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_PNS_DIFF_PAIR_DIMENSIONS_BASE::onViaTraceGapEqualCheck ), NULL, this );
m_stdButtonsCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PNS_DIFF_PAIR_DIMENSIONS_BASE::OnCancelClick ), NULL, this );
m_stdButtonsOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PNS_DIFF_PAIR_DIMENSIONS_BASE::OnOkClick ), NULL, this );
}
DIALOG_PNS_DIFF_PAIR_DIMENSIONS_BASE::~DIALOG_PNS_DIFF_PAIR_DIMENSIONS_BASE()
{
// Disconnect Events
this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_PNS_DIFF_PAIR_DIMENSIONS_BASE::OnClose ) );
m_viaTraceGapEqual->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_PNS_DIFF_PAIR_DIMENSIONS_BASE::onViaTraceGapEqualCheck ), NULL, this );
m_stdButtonsCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PNS_DIFF_PAIR_DIMENSIONS_BASE::OnCancelClick ), NULL, this );
m_stdButtonsOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PNS_DIFF_PAIR_DIMENSIONS_BASE::OnOkClick ), NULL, this );
}
This diff is collapsed.
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 6 2014)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __DIALOG_PNS_DIFF_PAIR_DIMENSIONS_BASE_H__
#define __DIALOG_PNS_DIFF_PAIR_DIMENSIONS_BASE_H__
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
class DIALOG_SHIM;
#include "dialog_shim.h"
#include <wx/string.h>
#include <wx/stattext.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/textctrl.h>
#include <wx/sizer.h>
#include <wx/checkbox.h>
#include <wx/button.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_PNS_DIFF_PAIR_DIMENSIONS_BASE
///////////////////////////////////////////////////////////////////////////////
class DIALOG_PNS_DIFF_PAIR_DIMENSIONS_BASE : public DIALOG_SHIM
{
private:
protected:
wxStaticText* m_traceWidthLabel;
wxTextCtrl* m_traceWidthText;
wxStaticText* m_traceWidthUnit;
wxStaticText* m_traceGapLabel;
wxTextCtrl* m_traceGapText;
wxStaticText* m_traceGapUnit;
wxStaticText* m_viaGapLabel;
wxTextCtrl* m_viaGapText;
wxStaticText* m_viaGapUnit;
wxCheckBox* m_viaTraceGapEqual;
wxStdDialogButtonSizer* m_stdButtons;
wxButton* m_stdButtonsOK;
wxButton* m_stdButtonsCancel;
// Virtual event handlers, overide them in your derived class
virtual void OnClose( wxCloseEvent& event ) { event.Skip(); }
virtual void onViaTraceGapEqualCheck( wxCommandEvent& event ) { event.Skip(); }
virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnOkClick( wxCommandEvent& event ) { event.Skip(); }
public:
DIALOG_PNS_DIFF_PAIR_DIMENSIONS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Differential Pair Dimensions"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 400,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_PNS_DIFF_PAIR_DIMENSIONS_BASE();
};
#endif //__DIALOG_PNS_DIFF_PAIR_DIMENSIONS_BASE_H__
/*
* KiRouter - a push-and-(sometimes-)shove PCB router
*
* Copyright (C) 2014-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 3 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, see <http://www.gnu.org/licenses/>.
*/
/**
* Length tuner settings dialog.
*/
#include "dialog_pns_length_tuning_settings.h"
#include <router/pns_meander_placer.h>
DIALOG_PNS_LENGTH_TUNING_SETTINGS::DIALOG_PNS_LENGTH_TUNING_SETTINGS( wxWindow* aParent, PNS_MEANDER_SETTINGS& aSettings, PNS_ROUTER_MODE aMode ) :
DIALOG_PNS_LENGTH_TUNING_SETTINGS_BASE( aParent ),
m_minAmpl( this, m_minAmplText, m_minAmplUnit ),
m_maxAmpl( this, m_maxAmplText, m_maxAmplUnit ),
m_spacing( this, m_spacingText, m_spacingUnit ),
m_targetLength( this, m_targetLengthText, m_targetLengthUnit ),
m_settings( aSettings ),
m_mode( aMode )
{
m_miterStyle->Enable( false );
m_radiusText->Enable( aMode != PNS_MODE_TUNE_DIFF_PAIR );
//m_minAmpl.Enable ( aMode != PNS_MODE_TUNE_DIFF_PAIR_SKEW );
m_minAmpl.SetValue( m_settings.m_minAmplitude );
m_maxAmpl.SetValue( m_settings.m_maxAmplitude );
m_spacing.SetValue( m_settings.m_spacing );
m_radiusText->SetValue( wxString::Format( wxT( "%i" ), m_settings.m_cornerRadiusPercentage ) );
m_miterStyle->SetSelection( m_settings.m_cornerType == PNS_MEANDER_SETTINGS::ROUND ? 1 : 0 );
switch( aMode )
{
case PNS_MODE_TUNE_SINGLE:
SetTitle( _( "Single track length tuning" ) );
m_legend->SetBitmap( KiBitmap( tune_single_track_length_legend_xpm ) );
m_targetLength.SetValue( m_settings.m_targetLength );
break;
case PNS_MODE_TUNE_DIFF_PAIR:
SetTitle( _( "Differential pair length tuning" ) );
m_legend->SetBitmap( KiBitmap( tune_diff_pair_length_legend_xpm ) );
m_targetLength.SetValue( m_settings.m_targetLength );
break;
case PNS_MODE_TUNE_DIFF_PAIR_SKEW:
SetTitle( _( "Differential pair skew tuning" ) );
m_legend->SetBitmap( KiBitmap( tune_diff_pair_skew_legend_xpm ) );
m_targetLengthLabel->SetLabel( _( "Target skew: " ) );
m_targetLength.SetValue ( m_settings.m_targetSkew );
break;
default:
break;
}
m_stdButtonsOK->SetDefault();
m_targetLengthText->SetSelection( -1, -1 );
m_targetLengthText->SetFocus();
}
void DIALOG_PNS_LENGTH_TUNING_SETTINGS::OnClose( wxCloseEvent& aEvent )
{
// Do nothing, it is result of ESC pressing
EndModal( 0 );
}
void DIALOG_PNS_LENGTH_TUNING_SETTINGS::OnOkClick( wxCommandEvent& aEvent )
{
// fixme: use validators and TransferDataFromWindow
m_settings.m_minAmplitude = m_minAmpl.GetValue();
m_settings.m_maxAmplitude = m_maxAmpl.GetValue();
m_settings.m_spacing = m_spacing.GetValue();
m_settings.m_cornerRadiusPercentage = wxAtoi( m_radiusText->GetValue() );
if( m_mode == PNS_MODE_TUNE_DIFF_PAIR_SKEW )
m_settings.m_targetSkew = m_targetLength.GetValue();
else
m_settings.m_targetLength = m_targetLength.GetValue();
if( m_settings.m_maxAmplitude < m_settings.m_minAmplitude )
m_settings.m_maxAmplitude = m_settings.m_maxAmplitude;
m_settings.m_cornerType = m_miterStyle->GetSelection() ? PNS_MEANDER_SETTINGS::CHAMFER : PNS_MEANDER_SETTINGS::ROUND;
EndModal( 1 );
}
void DIALOG_PNS_LENGTH_TUNING_SETTINGS::OnCancelClick( wxCommandEvent& aEvent )
{
// Do nothing
EndModal( 0 );
}
/*
* KiRouter - a push-and-(sometimes-)shove PCB router
*
* Copyright (C) 2014 CERN
* Author: Maciej Suminski <maciej.suminski@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 3 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, see <http://www.gnu.or/licenses/>.
*/
/**
* Push and Shove router settings dialog.
*/
#ifndef __dialog_pns_length_tuning_settings__
#define __dialog_pns_length_tuning_settings__
#include "dialog_pns_length_tuning_settings_base.h"
#include <wx_unit_binder.h>
#include <router/pns_router.h>
class PNS_MEANDER_SETTINGS;
class DIALOG_PNS_LENGTH_TUNING_SETTINGS : public DIALOG_PNS_LENGTH_TUNING_SETTINGS_BASE
{
public:
DIALOG_PNS_LENGTH_TUNING_SETTINGS( wxWindow* aParent, PNS_MEANDER_SETTINGS& aSettings, PNS_ROUTER_MODE aMode );
virtual void OnClose( wxCloseEvent& aEvent );
virtual void OnOkClick( wxCommandEvent& aEvent );
virtual void OnCancelClick( wxCommandEvent& aEvent );
private:
WX_UNIT_BINDER m_minAmpl;
WX_UNIT_BINDER m_maxAmpl;
WX_UNIT_BINDER m_spacing;
WX_UNIT_BINDER m_targetLength;
PNS_MEANDER_SETTINGS& m_settings;
PNS_ROUTER_MODE m_mode;
};
#endif // __dialog_pns_settings__
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 6 2014)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "dialog_pns_length_tuning_settings_base.h"
///////////////////////////////////////////////////////////////////////////
DIALOG_PNS_LENGTH_TUNING_SETTINGS_BASE::DIALOG_PNS_LENGTH_TUNING_SETTINGS_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxSize( 345,668 ), wxDefaultSize );
wxBoxSizer* bMainSizer;
bMainSizer = new wxBoxSizer( wxVERTICAL );
wxStaticBoxSizer* sbSizer1;
sbSizer1 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Length/skew") ), wxVERTICAL );
wxFlexGridSizer* fgSizer4;
fgSizer4 = new wxFlexGridSizer( 0, 2, 0, 0 );
fgSizer4->AddGrowableCol( 1 );
fgSizer4->SetFlexibleDirection( wxBOTH );
fgSizer4->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_staticText4 = new wxStaticText( this, wxID_ANY, _("Tune from:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText4->Wrap( -1 );
fgSizer4->Add( m_staticText4, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
wxArrayString m_choicePathFromChoices;
m_choicePathFrom = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choicePathFromChoices, 0 );
m_choicePathFrom->SetSelection( 0 );
fgSizer4->Add( m_choicePathFrom, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
m_staticText15 = new wxStaticText( this, wxID_ANY, _("Tune to:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText15->Wrap( -1 );
fgSizer4->Add( m_staticText15, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
wxArrayString m_choice4Choices;
m_choice4 = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choice4Choices, 0 );
m_choice4->SetSelection( 0 );
fgSizer4->Add( m_choice4, 0, wxALL, 5 );
m_staticText3 = new wxStaticText( this, wxID_ANY, _("Constraint:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText3->Wrap( -1 );
fgSizer4->Add( m_staticText3, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
wxString m_constraintSourceChoices[] = { _("from Design Rules"), _("manual") };
int m_constraintSourceNChoices = sizeof( m_constraintSourceChoices ) / sizeof( wxString );
m_constraintSource = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_constraintSourceNChoices, m_constraintSourceChoices, 0 );
m_constraintSource->SetSelection( 1 );
m_constraintSource->Enable( false );
fgSizer4->Add( m_constraintSource, 1, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
m_targetLengthLabel = new wxStaticText( this, wxID_ANY, _("Target length:"), wxDefaultPosition, wxDefaultSize, 0 );
m_targetLengthLabel->Wrap( -1 );
fgSizer4->Add( m_targetLengthLabel, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
wxGridSizer* gSizer2;
gSizer2 = new wxGridSizer( 0, 2, 0, 0 );
m_targetLengthText = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
gSizer2->Add( m_targetLengthText, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
m_targetLengthUnit = new wxStaticText( this, wxID_ANY, _("unit"), wxDefaultPosition, wxDefaultSize, 0 );
m_targetLengthUnit->Wrap( -1 );
gSizer2->Add( m_targetLengthUnit, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
fgSizer4->Add( gSizer2, 1, wxEXPAND, 5 );
sbSizer1->Add( fgSizer4, 1, wxEXPAND, 5 );
bMainSizer->Add( sbSizer1, 0, wxEXPAND|wxALL, 5 );
wxStaticBoxSizer* sbSizer2;
sbSizer2 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Meandering") ), wxVERTICAL );
m_legend = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 );
sbSizer2->Add( m_legend, 1, wxALL|wxEXPAND, 5 );
wxFlexGridSizer* fgSizer3;
fgSizer3 = new wxFlexGridSizer( 0, 3, 0, 0 );
fgSizer3->AddGrowableCol( 2 );
fgSizer3->SetFlexibleDirection( wxBOTH );
fgSizer3->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_staticText9 = new wxStaticText( this, wxID_ANY, _("Min amplitude (Amin):"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText9->Wrap( -1 );
fgSizer3->Add( m_staticText9, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
m_minAmplText = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizer3->Add( m_minAmplText, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
m_minAmplUnit = new wxStaticText( this, wxID_ANY, _("unit"), wxDefaultPosition, wxDefaultSize, 0 );
m_minAmplUnit->Wrap( -1 );
fgSizer3->Add( m_minAmplUnit, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT, 5 );
m_staticText91 = new wxStaticText( this, wxID_ANY, _("Max amplitude (Amax):"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText91->Wrap( -1 );
fgSizer3->Add( m_staticText91, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
m_maxAmplText = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizer3->Add( m_maxAmplText, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
m_maxAmplUnit = new wxStaticText( this, wxID_ANY, _("unit"), wxDefaultPosition, wxDefaultSize, 0 );
m_maxAmplUnit->Wrap( -1 );
fgSizer3->Add( m_maxAmplUnit, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT, 5 );
m_staticText11 = new wxStaticText( this, wxID_ANY, _("Spacing (s):"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText11->Wrap( -1 );
fgSizer3->Add( m_staticText11, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
m_spacingText = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizer3->Add( m_spacingText, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
m_spacingUnit = new wxStaticText( this, wxID_ANY, _("unit"), wxDefaultPosition, wxDefaultSize, 0 );
m_spacingUnit->Wrap( -1 );
fgSizer3->Add( m_spacingUnit, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT, 5 );
m_staticText13 = new wxStaticText( this, wxID_ANY, _("Miter radius (r):"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText13->Wrap( -1 );
fgSizer3->Add( m_staticText13, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
m_radiusText = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizer3->Add( m_radiusText, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
m_radiusUnit = new wxStaticText( this, wxID_ANY, _("%"), wxDefaultPosition, wxDefaultSize, 0 );
m_radiusUnit->Wrap( -1 );
fgSizer3->Add( m_radiusUnit, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT, 5 );
m_staticText14 = new wxStaticText( this, wxID_ANY, _("Miter style:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText14->Wrap( -1 );
m_staticText14->Enable( false );
fgSizer3->Add( m_staticText14, 1, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
wxString m_miterStyleChoices[] = { _("45 degree"), _("arc") };
int m_miterStyleNChoices = sizeof( m_miterStyleChoices ) / sizeof( wxString );
m_miterStyle = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_miterStyleNChoices, m_miterStyleChoices, 0 );
m_miterStyle->SetSelection( 0 );
m_miterStyle->Enable( false );
fgSizer3->Add( m_miterStyle, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
sbSizer2->Add( fgSizer3, 1, wxEXPAND, 5 );
bMainSizer->Add( sbSizer2, 1, wxALL|wxEXPAND, 5 );
m_stdButtons = new wxStdDialogButtonSizer();
m_stdButtonsOK = new wxButton( this, wxID_OK );
m_stdButtons->AddButton( m_stdButtonsOK );
m_stdButtonsCancel = new wxButton( this, wxID_CANCEL );
m_stdButtons->AddButton( m_stdButtonsCancel );
m_stdButtons->Realize();
bMainSizer->Add( m_stdButtons, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 );
this->SetSizer( bMainSizer );
this->Layout();
// Connect Events
this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_PNS_LENGTH_TUNING_SETTINGS_BASE::OnClose ) );
m_stdButtonsCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PNS_LENGTH_TUNING_SETTINGS_BASE::OnCancelClick ), NULL, this );
m_stdButtonsOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PNS_LENGTH_TUNING_SETTINGS_BASE::OnOkClick ), NULL, this );
}
DIALOG_PNS_LENGTH_TUNING_SETTINGS_BASE::~DIALOG_PNS_LENGTH_TUNING_SETTINGS_BASE()
{
// Disconnect Events
this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_PNS_LENGTH_TUNING_SETTINGS_BASE::OnClose ) );
m_stdButtonsCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PNS_LENGTH_TUNING_SETTINGS_BASE::OnCancelClick ), NULL, this );
m_stdButtonsOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PNS_LENGTH_TUNING_SETTINGS_BASE::OnOkClick ), NULL, this );
}
This diff is collapsed.
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 6 2014)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __DIALOG_PNS_LENGTH_TUNING_SETTINGS_BASE_H__
#define __DIALOG_PNS_LENGTH_TUNING_SETTINGS_BASE_H__
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
class DIALOG_SHIM;
#include "dialog_shim.h"
#include <wx/string.h>
#include <wx/stattext.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/choice.h>
#include <wx/textctrl.h>
#include <wx/sizer.h>
#include <wx/statbox.h>
#include <wx/bitmap.h>
#include <wx/image.h>
#include <wx/icon.h>
#include <wx/statbmp.h>
#include <wx/button.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_PNS_LENGTH_TUNING_SETTINGS_BASE
///////////////////////////////////////////////////////////////////////////////
class DIALOG_PNS_LENGTH_TUNING_SETTINGS_BASE : public DIALOG_SHIM
{
private:
protected:
wxStaticText* m_staticText4;
wxChoice* m_choicePathFrom;
wxStaticText* m_staticText15;
wxChoice* m_choice4;
wxStaticText* m_staticText3;
wxChoice* m_constraintSource;
wxStaticText* m_targetLengthLabel;
wxTextCtrl* m_targetLengthText;
wxStaticText* m_targetLengthUnit;
wxStaticBitmap* m_legend;
wxStaticText* m_staticText9;
wxTextCtrl* m_minAmplText;
wxStaticText* m_minAmplUnit;
wxStaticText* m_staticText91;
wxTextCtrl* m_maxAmplText;
wxStaticText* m_maxAmplUnit;
wxStaticText* m_staticText11;
wxTextCtrl* m_spacingText;
wxStaticText* m_spacingUnit;
wxStaticText* m_staticText13;
wxTextCtrl* m_radiusText;
wxStaticText* m_radiusUnit;
wxStaticText* m_staticText14;
wxChoice* m_miterStyle;
wxStdDialogButtonSizer* m_stdButtons;
wxButton* m_stdButtonsOK;
wxButton* m_stdButtonsCancel;
// Virtual event handlers, overide them in your derived class
virtual void OnClose( wxCloseEvent& event ) { event.Skip(); }
virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnOkClick( wxCommandEvent& event ) { event.Skip(); }
public:
DIALOG_PNS_LENGTH_TUNING_SETTINGS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Trace length tuning"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 345,668 ), long style = wxDEFAULT_DIALOG_STYLE );
~DIALOG_PNS_LENGTH_TUNING_SETTINGS_BASE();
};
#endif //__DIALOG_PNS_LENGTH_TUNING_SETTINGS_BASE_H__
......@@ -31,14 +31,19 @@
DIALOG_TRACK_VIA_SIZE::DIALOG_TRACK_VIA_SIZE( wxWindow* aParent, BOARD_DESIGN_SETTINGS& aSettings ) :
DIALOG_TRACK_VIA_SIZE_BASE( aParent ),
m_trackWidth( aParent, m_trackWidthText, m_trackWidthLabel ),
m_viaDiameter( aParent, m_viaDiameterText, m_viaDiameterLabel ),
m_viaDrill( aParent, m_viaDrillText, m_viaDrillLabel ),
m_settings( aSettings )
{
// Load router settings to dialog fields
m_trackWidth->SetValue( To_User_Unit( m_trackWidth->GetUnits(), m_settings.GetCustomTrackWidth() ) );
m_viaDiameter->SetValue( To_User_Unit( m_viaDiameter->GetUnits(), m_settings.GetCustomViaSize() ) );
m_viaDrill->SetValue( To_User_Unit( m_viaDrill->GetUnits(), m_settings.GetCustomViaDrill() ) );
m_trackWidth.SetValue( m_settings.GetCustomTrackWidth() );
m_viaDiameter.SetValue( m_settings.GetCustomViaSize() );
m_viaDrill.SetValue( m_settings.GetCustomViaDrill() );
m_trackWidth->SetFocus();
m_trackWidthText->SetFocus();
m_trackWidthText->SetSelection( -1, -1 );
m_stdButtonsOK->SetDefault();
// Pressing ENTER when any of the text input fields is active applies changes
#if wxCHECK_VERSION( 3, 0, 0 )
......@@ -46,7 +51,7 @@ DIALOG_TRACK_VIA_SIZE::DIALOG_TRACK_VIA_SIZE( wxWindow* aParent, BOARD_DESIGN_SE
#else
Connect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DIALOG_TRACK_VIA_SIZE::onOkClick ), NULL, this );
#endif
Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_TRACK_VIA_SIZE::onClose ) );
}
......@@ -54,11 +59,11 @@ DIALOG_TRACK_VIA_SIZE::DIALOG_TRACK_VIA_SIZE( wxWindow* aParent, BOARD_DESIGN_SE
bool DIALOG_TRACK_VIA_SIZE::check()
{
// Wrong input
if( !m_trackWidth->GetValue() || !m_viaDiameter->GetValue() || !m_viaDrill->GetValue() )
if( m_trackWidth.GetValue() < 0 || m_viaDiameter.GetValue() < 0 || m_viaDrill.GetValue() < 0 )
return false;
// Via drill should be smaller than via diameter
if( m_viaDrill->GetValue() >= m_viaDiameter->GetValue() )
if( m_viaDrill.GetValue() >= m_viaDiameter.GetValue() )
return false;
return true;
......@@ -76,15 +81,15 @@ void DIALOG_TRACK_VIA_SIZE::onOkClick( wxCommandEvent& aEvent )
if( check() )
{
// Store dialog values to the router settings
m_settings.SetCustomTrackWidth( From_User_Unit( m_trackWidth->GetUnits(), *m_trackWidth->GetValue() ) );
m_settings.SetCustomViaSize( From_User_Unit( m_viaDiameter->GetUnits(), *m_viaDiameter->GetValue() ) );
m_settings.SetCustomViaDrill( From_User_Unit( m_viaDrill->GetUnits(), *m_viaDrill->GetValue() ) );
m_settings.SetCustomTrackWidth( m_trackWidth.GetValue() );
m_settings.SetCustomViaSize( m_viaDiameter.GetValue() );
m_settings.SetCustomViaDrill( m_viaDrill.GetValue() );
EndModal( 1 );
}
else
{
DisplayError( GetParent(), _( "Settings are incorrect" ) );
m_trackWidth->SetFocus();
m_trackWidthText->SetFocus();
}
}
......
......@@ -25,6 +25,8 @@
#ifndef __dialog_track_via_size__
#define __dialog_track_via_size__
#include <wx_unit_binder.h>
#include "dialog_track_via_size_base.h"
class BOARD_DESIGN_SETTINGS;
......@@ -32,21 +34,25 @@ class BOARD_DESIGN_SETTINGS;
/** Implementing DIALOG_TRACK_VIA_SIZE_BASE */
class DIALOG_TRACK_VIA_SIZE : public DIALOG_TRACK_VIA_SIZE_BASE
{
public:
/** Constructor */
DIALOG_TRACK_VIA_SIZE( wxWindow* aParent, BOARD_DESIGN_SETTINGS& aSettings );
public:
/** Constructor */
DIALOG_TRACK_VIA_SIZE( wxWindow* aParent, BOARD_DESIGN_SETTINGS& aSettings );
protected:
WX_UNIT_BINDER m_trackWidth;
WX_UNIT_BINDER m_viaDiameter;
WX_UNIT_BINDER m_viaDrill;
protected:
// Routings settings that are modified by the dialog.
BOARD_DESIGN_SETTINGS& m_settings;
// Routings settings that are modified by the dialog.
BOARD_DESIGN_SETTINGS& m_settings;
///> Checks if values given in the dialog are sensible.
bool check();
///> Checks if values given in the dialog are sensible.
bool check();
// Handlers for DIALOG_TRACK_VIA_SIZE_BASE events.
void onClose( wxCloseEvent& aEvent );
void onOkClick( wxCommandEvent& aEvent );
void onCancelClick( wxCommandEvent& aEvent );
// Handlers for DIALOG_TRACK_VIA_SIZE_BASE events.
void onClose( wxCloseEvent& aEvent );
void onOkClick( wxCommandEvent& aEvent );
void onCancelClick( wxCommandEvent& aEvent );
};
#endif // __dialog_track_via_size__
......@@ -16,14 +16,46 @@ DIALOG_TRACK_VIA_SIZE_BASE::DIALOG_TRACK_VIA_SIZE_BASE( wxWindow* parent, wxWind
wxBoxSizer* bSizes;
bSizes = new wxBoxSizer( wxVERTICAL );
m_trackWidth = new WX_UNIT_TEXT( this, _("Track width:") );
bSizes->Add( m_trackWidth, 0, wxALL|wxEXPAND, 5 );
wxFlexGridSizer* fgSizer1;
fgSizer1 = new wxFlexGridSizer( 0, 3, 0, 0 );
fgSizer1->SetFlexibleDirection( wxBOTH );
fgSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_viaDiameter = new WX_UNIT_TEXT( this, _("Via diameter:") );
bSizes->Add( m_viaDiameter, 0, wxALL|wxEXPAND, 5 );
m_staticText3 = new wxStaticText( this, wxID_ANY, _("Track width:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText3->Wrap( -1 );
fgSizer1->Add( m_staticText3, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
m_viaDrill = new WX_UNIT_TEXT( this, _("Via drill:") );
bSizes->Add( m_viaDrill, 0, wxALL|wxEXPAND, 5 );
m_trackWidthText = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizer1->Add( m_trackWidthText, 1, wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
m_trackWidthLabel = new wxStaticText( this, wxID_ANY, _("inch"), wxDefaultPosition, wxDefaultSize, 0 );
m_trackWidthLabel->Wrap( -1 );
fgSizer1->Add( m_trackWidthLabel, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
m_staticText5 = new wxStaticText( this, wxID_ANY, _("Via diameter:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText5->Wrap( -1 );
fgSizer1->Add( m_staticText5, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
m_viaDiameterText = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizer1->Add( m_viaDiameterText, 1, wxALL|wxEXPAND, 5 );
m_viaDiameterLabel = new wxStaticText( this, wxID_ANY, _("u"), wxDefaultPosition, wxDefaultSize, 0 );
m_viaDiameterLabel->Wrap( -1 );
fgSizer1->Add( m_viaDiameterLabel, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
m_staticText7 = new wxStaticText( this, wxID_ANY, _("Via drill:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText7->Wrap( -1 );
fgSizer1->Add( m_staticText7, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
m_viaDrillText = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizer1->Add( m_viaDrillText, 1, wxALL|wxEXPAND, 5 );
m_viaDrillLabel = new wxStaticText( this, wxID_ANY, _("u"), wxDefaultPosition, wxDefaultSize, 0 );
m_viaDrillLabel->Wrap( -1 );
fgSizer1->Add( m_viaDrillLabel, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
bSizes->Add( fgSizer1, 1, wxEXPAND|wxALL, 5 );
m_stdButtons = new wxStdDialogButtonSizer();
m_stdButtonsOK = new wxButton( this, wxID_OK );
......
......@@ -11,12 +11,13 @@
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
#include <wxunittext.h>
#include <wx/string.h>
#include <wx/stattext.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/string.h>
#include <wx/textctrl.h>
#include <wx/sizer.h>
#include <wx/button.h>
#include <wx/dialog.h>
......@@ -32,9 +33,15 @@ class DIALOG_TRACK_VIA_SIZE_BASE : public wxDialog
private:
protected:
WX_UNIT_TEXT* m_trackWidth;
WX_UNIT_TEXT* m_viaDiameter;
WX_UNIT_TEXT* m_viaDrill;
wxStaticText* m_staticText3;
wxTextCtrl* m_trackWidthText;
wxStaticText* m_trackWidthLabel;
wxStaticText* m_staticText5;
wxTextCtrl* m_viaDiameterText;
wxStaticText* m_viaDiameterLabel;
wxStaticText* m_staticText7;
wxTextCtrl* m_viaDrillText;
wxStaticText* m_viaDrillLabel;
wxStdDialogButtonSizer* m_stdButtons;
wxButton* m_stdButtonsOK;
wxButton* m_stdButtonsCancel;
......
......@@ -129,7 +129,6 @@ FOOTPRINT_WIZARD_FRAME::FOOTPRINT_WIZARD_FRAME( KIWAY* aKiway,
wxAcceleratorTable table( ACCEL_TABLE_CNT, accels );
m_FrameName = FOOTPRINT_WIZARD_FRAME_NAME;
m_configPath = wxT( "FootprintWizard" );
m_showAxis = true; // true to draw axis.
......
......@@ -1549,7 +1549,7 @@ void LEGACY_PLUGIN::loadPAD( MODULE* aModule )
else
attribute = PAD_STANDARD;
data = strtok_r( NULL, delims, &saveptr ); // skip BufCar
strtok_r( NULL, delims, &saveptr ); // skip BufCar
data = strtok_r( NULL, delims, &saveptr );
LEG_MASK layer_mask = hexParse( data );
......
......@@ -28,6 +28,8 @@
* @brief Footprints selection and loading functions.
*/
#include <boost/bind.hpp>
#include <fctsys.h>
#include <class_drawpanel.h>
#include <pcb_draw_panel_gal.h>
......@@ -61,6 +63,10 @@ static void DisplayCmpDoc( wxString& aName, void* aData );
static FOOTPRINT_LIST MList;
static void clearModuleItemFlags( BOARD_ITEM* aItem )
{
aItem->ClearFlags();
}
bool FOOTPRINT_EDIT_FRAME::Load_Module_From_BOARD( MODULE* aModule )
{
......@@ -92,9 +98,10 @@ bool FOOTPRINT_EDIT_FRAME::Load_Module_From_BOARD( MODULE* aModule )
aModule = newModule;
GetBoard()->Add( newModule );
newModule->ClearFlags();
newModule->RunOnChildren( boost::bind( &clearModuleItemFlags, _1 ) );
GetBoard()->Add( newModule );
// Clear references to any net info, because the footprint editor
// does know any thing about nets handled by the current edited board.
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -113,7 +113,6 @@ FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME( KIWAY* aKiway, wxWindow* aParent
if( aFrameType == FRAME_PCB_MODULE_VIEWER_MODAL )
SetModal( true );
m_FrameName = GetFootprintViewerFrameName();
m_configPath = wxT( "FootprintViewer" );
m_showAxis = true; // true to draw axis.
......
......@@ -207,7 +207,7 @@ void PCB_PAD::AddToModule( MODULE* aModule, int aRotation, bool aEncapsulatedPad
pad->SetDrillSize( wxSize( m_hole, m_hole ) );
pad->SetSize( wxSize( m_hole, m_hole ) );
pad->SetLayerSet( LSET::AllCuMask() | LSET( 3, B_Mask, F_Mask ) );
pad->SetLayerSet( LSET::AllCuMask() | LSET( 2, B_Mask, F_Mask ) );
}
else
{
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment