Commit 668c3b76 authored by Garth Corral's avatar Garth Corral

Merge trunk @ 5297

parents 79a10860 0c1a87ca
...@@ -151,7 +151,7 @@ BM2CMP_FRAME_BASE::BM2CMP_FRAME_BASE( wxWindow* parent, wxWindowID id, const wxS ...@@ -151,7 +151,7 @@ BM2CMP_FRAME_BASE::BM2CMP_FRAME_BASE( wxWindow* parent, wxWindowID id, const wxS
int m_radio_PCBLayerNChoices = sizeof( m_radio_PCBLayerChoices ) / sizeof( wxString ); int m_radio_PCBLayerNChoices = sizeof( m_radio_PCBLayerChoices ) / sizeof( wxString );
m_radio_PCBLayer = new wxRadioBox( m_panelRight, wxID_ANY, _("Board Layer for Outline:"), wxDefaultPosition, wxDefaultSize, m_radio_PCBLayerNChoices, m_radio_PCBLayerChoices, 1, wxRA_SPECIFY_COLS ); m_radio_PCBLayer = new wxRadioBox( m_panelRight, wxID_ANY, _("Board Layer for Outline:"), wxDefaultPosition, wxDefaultSize, m_radio_PCBLayerNChoices, m_radio_PCBLayerChoices, 1, wxRA_SPECIFY_COLS );
m_radio_PCBLayer->SetSelection( 0 ); m_radio_PCBLayer->SetSelection( 0 );
m_radio_PCBLayer->SetToolTip( _("Choose the board layer to place the outline.\nThe 2 invisible fields reference and value and always placed on the silk screen layer.") ); m_radio_PCBLayer->SetToolTip( _("Choose the board layer to place the outline.\nThe 2 invisible fields reference and value are always placed on the silk screen layer.") );
brightSizer->Add( m_radio_PCBLayer, 0, wxALL|wxEXPAND, 5 ); brightSizer->Add( m_radio_PCBLayer, 0, wxALL|wxEXPAND, 5 );
......
...@@ -2412,7 +2412,7 @@ ...@@ -2412,7 +2412,7 @@
<property name="style">wxRA_SPECIFY_COLS</property> <property name="style">wxRA_SPECIFY_COLS</property>
<property name="subclass"></property> <property name="subclass"></property>
<property name="toolbar_pane">0</property> <property name="toolbar_pane">0</property>
<property name="tooltip">Choose the board layer to place the outline.&#x0A;The 2 invisible fields reference and value and always placed on the silk screen layer.</property> <property name="tooltip">Choose the board layer to place the outline.&#x0A;The 2 invisible fields reference and value are always placed on the silk screen layer.</property>
<property name="validator_data_type"></property> <property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property> <property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property> <property name="validator_type">wxDefaultValidator</property>
......
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Nov 5 2013) // C++ code generated with wxFormBuilder (version Jun 5 2014)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO "NOT" EDIT THIS FILE! // PLEASE DO "NOT" EDIT THIS FILE!
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
EDA_LIST_DIALOG_BASE::EDA_LIST_DIALOG_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style ) EDA_LIST_DIALOG_BASE::EDA_LIST_DIALOG_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( wxDefaultSize, wxDefaultSize ); this->SetSizeHints( wxSize( 400,400 ), wxDefaultSize );
wxBoxSizer* bSizerMain; wxBoxSizer* bSizerMain;
bSizerMain = new wxBoxSizer( wxVERTICAL ); bSizerMain = new wxBoxSizer( wxVERTICAL );
...@@ -55,7 +55,6 @@ EDA_LIST_DIALOG_BASE::EDA_LIST_DIALOG_BASE( wxWindow* parent, wxWindowID id, con ...@@ -55,7 +55,6 @@ EDA_LIST_DIALOG_BASE::EDA_LIST_DIALOG_BASE( wxWindow* parent, wxWindowID id, con
this->SetSizer( bSizerMain ); this->SetSizer( bSizerMain );
this->Layout(); this->Layout();
bSizerMain->Fit( this );
this->Centre( wxBOTH ); this->Centre( wxBOTH );
......
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<wxFormBuilder_Project> <wxFormBuilder_Project>
<FileVersion major="1" minor="11" /> <FileVersion major="1" minor="13" />
<object class="Project" expanded="1"> <object class="Project" expanded="1">
<property name="class_decoration"></property> <property name="class_decoration"></property>
<property name="code_generation">C++</property> <property name="code_generation">C++</property>
...@@ -41,10 +41,10 @@ ...@@ -41,10 +41,10 @@
<property name="hidden">0</property> <property name="hidden">0</property>
<property name="id">wxID_ANY</property> <property name="id">wxID_ANY</property>
<property name="maximum_size"></property> <property name="maximum_size"></property>
<property name="minimum_size"></property> <property name="minimum_size">400,400</property>
<property name="name">EDA_LIST_DIALOG_BASE</property> <property name="name">EDA_LIST_DIALOG_BASE</property>
<property name="pos"></property> <property name="pos"></property>
<property name="size">-1,-1</property> <property name="size">400,400</property>
<property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property> <property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>
<property name="subclass">DIALOG_SHIM; dialog_shim.h</property> <property name="subclass">DIALOG_SHIM; dialog_shim.h</property>
<property name="title"></property> <property name="title"></property>
......
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Nov 5 2013) // C++ code generated with wxFormBuilder (version Jun 5 2014)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO "NOT" EDIT THIS FILE! // PLEASE DO "NOT" EDIT THIS FILE!
...@@ -58,7 +58,7 @@ class EDA_LIST_DIALOG_BASE : public DIALOG_SHIM ...@@ -58,7 +58,7 @@ class EDA_LIST_DIALOG_BASE : public DIALOG_SHIM
public: public:
EDA_LIST_DIALOG_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); EDA_LIST_DIALOG_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 400,400 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~EDA_LIST_DIALOG_BASE(); ~EDA_LIST_DIALOG_BASE();
}; };
......
...@@ -47,6 +47,27 @@ EDA_LIST_DIALOG::EDA_LIST_DIALOG( EDA_DRAW_FRAME* aParent, const wxString& aTitl ...@@ -47,6 +47,27 @@ EDA_LIST_DIALOG::EDA_LIST_DIALOG( EDA_DRAW_FRAME* aParent, const wxString& aTitl
m_cb_data = aCallBackFunctionData; m_cb_data = aCallBackFunctionData;
m_itemsListCp = &aItemList; m_itemsListCp = &aItemList;
initDialog( aItemHeaders, aSelection );
// DIALOG_SHIM needs a unique hash_key because classname is not sufficient
// because so many dialogs share this same class, with different numbers of
// columns, different column names, and column widths.
m_hash_key = TO_UTF8( aTitle );
m_filterBox->SetFocus();
// this line fixes an issue on Linux Ubuntu using Unity (dialog not shown),
// and works fine on all systems
GetSizer()->Fit( this );
Centre();
}
void EDA_LIST_DIALOG::initDialog( const wxArrayString& aItemHeaders,
const wxString& aSelection)
{
for( unsigned i = 0; i < aItemHeaders.Count(); i++ ) for( unsigned i = 0; i < aItemHeaders.Count(); i++ )
{ {
wxListItem column; wxListItem column;
...@@ -57,7 +78,7 @@ EDA_LIST_DIALOG::EDA_LIST_DIALOG( EDA_DRAW_FRAME* aParent, const wxString& aTitl ...@@ -57,7 +78,7 @@ EDA_LIST_DIALOG::EDA_LIST_DIALOG( EDA_DRAW_FRAME* aParent, const wxString& aTitl
m_listBox->InsertColumn( i, column ); m_listBox->InsertColumn( i, column );
} }
InsertItems( aItemList, 0 ); InsertItems( *m_itemsListCp, 0 );
if( m_cb_func == NULL ) if( m_cb_func == NULL )
{ {
...@@ -112,14 +133,11 @@ EDA_LIST_DIALOG::EDA_LIST_DIALOG( EDA_DRAW_FRAME* aParent, const wxString& aTitl ...@@ -112,14 +133,11 @@ EDA_LIST_DIALOG::EDA_LIST_DIALOG( EDA_DRAW_FRAME* aParent, const wxString& aTitl
} }
#endif #endif
Fit();
Centre();
if( !!aSelection ) if( !!aSelection )
{ {
for( unsigned row = 0; row < aItemList.size(); ++row ) for( unsigned row = 0; row < m_itemsListCp->size(); ++row )
{ {
if( aItemList[row][0] == aSelection ) if( (*m_itemsListCp)[row][0] == aSelection )
{ {
m_listBox->SetItemState( row, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED ); m_listBox->SetItemState( row, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED );
m_listBox->EnsureVisible( row ); m_listBox->EnsureVisible( row );
...@@ -127,13 +145,6 @@ EDA_LIST_DIALOG::EDA_LIST_DIALOG( EDA_DRAW_FRAME* aParent, const wxString& aTitl ...@@ -127,13 +145,6 @@ EDA_LIST_DIALOG::EDA_LIST_DIALOG( EDA_DRAW_FRAME* aParent, const wxString& aTitl
} }
} }
} }
// DIALOG_SHIM needs a unique hash_key because classname is not sufficient
// because so many dialogs share this same class, with different numbers of
// columns, different column names, and column widths.
m_hash_key = TO_UTF8( aTitle );
m_filterBox->SetFocus();
} }
......
...@@ -96,7 +96,10 @@ bool KIWAY_PLAYER::ShowModal( wxString* aResult, wxWindow* aResultantFocusWindow ...@@ -96,7 +96,10 @@ bool KIWAY_PLAYER::ShowModal( wxString* aResult, wxWindow* aResultantFocusWindow
m_modal_resultant_parent = aResultantFocusWindow; m_modal_resultant_parent = aResultantFocusWindow;
Raise(); // Needed on Ubuntu-14/Unity to display the frame
Show( true ); Show( true );
SetFocus(); SetFocus();
{ {
......
...@@ -292,21 +292,19 @@ void TOOL_MANAGER::UnregisterAction( TOOL_ACTION* aAction ) ...@@ -292,21 +292,19 @@ void TOOL_MANAGER::UnregisterAction( TOOL_ACTION* aAction )
} }
bool TOOL_MANAGER::RunAction( const std::string& aActionName, bool aNow ) bool TOOL_MANAGER::RunAction( const std::string& aActionName, bool aNow, void* aParam )
{ {
TOOL_ACTION* action = m_actionMgr->FindAction( aActionName ); TOOL_ACTION* action = m_actionMgr->FindAction( aActionName );
if( action ) if( action )
{ {
TOOL_EVENT event = action->MakeEvent();
event.SetParameter( aParam );
if( aNow ) if( aNow )
{
TOOL_EVENT event = action->MakeEvent();
ProcessEvent( event ); ProcessEvent( event );
}
else else
{ PostEvent( event );
PostEvent( action->MakeEvent() );
}
return true; return true;
} }
...@@ -315,17 +313,15 @@ bool TOOL_MANAGER::RunAction( const std::string& aActionName, bool aNow ) ...@@ -315,17 +313,15 @@ bool TOOL_MANAGER::RunAction( const std::string& aActionName, bool aNow )
} }
void TOOL_MANAGER::RunAction( const TOOL_ACTION& aAction, bool aNow ) void TOOL_MANAGER::RunAction( const TOOL_ACTION& aAction, bool aNow, void* aParam )
{ {
TOOL_EVENT event = aAction.MakeEvent();
event.SetParameter( aParam );
if( aNow ) if( aNow )
{
TOOL_EVENT event = aAction.MakeEvent();
ProcessEvent( event ); ProcessEvent( event );
}
else else
{ PostEvent( event );
PostEvent( aAction.MakeEvent() );
}
} }
......
...@@ -199,7 +199,7 @@ DIALOG_BOM::DIALOG_BOM( SCH_EDIT_FRAME* parent ) : ...@@ -199,7 +199,7 @@ DIALOG_BOM::DIALOG_BOM( SCH_EDIT_FRAME* parent ) :
m_config = Kiface().KifaceSettings(); m_config = Kiface().KifaceSettings();
installPluginsList(); installPluginsList();
GetSizer()->SetSizeHints( this ); GetSizer()->Fit( this );
Centre(); Centre();
} }
......
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Oct 8 2012) // C++ code generated with wxFormBuilder (version Jun 5 2014)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO "NOT" EDIT THIS FILE! // PLEASE DO "NOT" EDIT THIS FILE!
......
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<wxFormBuilder_Project> <wxFormBuilder_Project>
<FileVersion major="1" minor="11" /> <FileVersion major="1" minor="13" />
<object class="Project" expanded="1"> <object class="Project" expanded="1">
<property name="class_decoration"></property> <property name="class_decoration"></property>
<property name="code_generation">C++</property> <property name="code_generation">C++</property>
...@@ -20,8 +20,10 @@ ...@@ -20,8 +20,10 @@
<property name="path">.</property> <property name="path">.</property>
<property name="precompiled_header"></property> <property name="precompiled_header"></property>
<property name="relative_path">1</property> <property name="relative_path">1</property>
<property name="skip_lua_events">1</property>
<property name="skip_php_events">1</property> <property name="skip_php_events">1</property>
<property name="skip_python_events">1</property> <property name="skip_python_events">1</property>
<property name="ui_table">UI</property>
<property name="use_enum">1</property> <property name="use_enum">1</property>
<property name="use_microsoft_bom">0</property> <property name="use_microsoft_bom">0</property>
<object class="Dialog" expanded="1"> <object class="Dialog" expanded="1">
......
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Oct 8 2012) // C++ code generated with wxFormBuilder (version Jun 5 2014)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO "NOT" EDIT THIS FILE! // PLEASE DO "NOT" EDIT THIS FILE!
......
...@@ -24,7 +24,6 @@ ...@@ -24,7 +24,6 @@
#include <dialog_choose_component.h> #include <dialog_choose_component.h>
#include <set> #include <set>
#include <boost/foreach.hpp>
#include <wx/tokenzr.h> #include <wx/tokenzr.h>
#include <class_library.h> #include <class_library.h>
...@@ -36,15 +35,14 @@ static wxTreeItemId GetPrevItem( const wxTreeCtrl& tree, const wxTreeItemId& ite ...@@ -36,15 +35,14 @@ static wxTreeItemId GetPrevItem( const wxTreeCtrl& tree, const wxTreeItemId& ite
static wxTreeItemId GetNextItem( const wxTreeCtrl& tree, const wxTreeItemId& item ); static wxTreeItemId GetNextItem( const wxTreeCtrl& tree, const wxTreeItemId& item );
DIALOG_CHOOSE_COMPONENT::DIALOG_CHOOSE_COMPONENT( SCH_BASE_FRAME* aParent, const wxString& aTitle, DIALOG_CHOOSE_COMPONENT::DIALOG_CHOOSE_COMPONENT( SCH_BASE_FRAME* aParent, const wxString& aTitle,
COMPONENT_TREE_SEARCH_CONTAINER* aContainer, COMPONENT_TREE_SEARCH_CONTAINER* const aContainer,
int aDeMorganConvert ) int aDeMorganConvert )
: DIALOG_CHOOSE_COMPONENT_BASE( aParent, wxID_ANY, aTitle ), : DIALOG_CHOOSE_COMPONENT_BASE( aParent, wxID_ANY, aTitle ), m_search_container( aContainer )
m_search_container( aContainer ),
m_deMorganConvert( aDeMorganConvert >= 0 ? aDeMorganConvert : 0 ),
m_external_browser_requested( false ),
m_received_doubleclick_in_tree( false )
{ {
m_parent = aParent; m_parent = aParent;
m_deMorganConvert = aDeMorganConvert >= 0 ? aDeMorganConvert : 0;
m_external_browser_requested = false;
m_received_doubleclick_in_tree = false;
m_search_container->SetTree( m_libraryComponentTree ); m_search_container->SetTree( m_libraryComponentTree );
m_searchBox->SetFocus(); m_searchBox->SetFocus();
m_componentDetails->SetEditable( false ); m_componentDetails->SetEditable( false );
...@@ -59,6 +57,11 @@ DIALOG_CHOOSE_COMPONENT::DIALOG_CHOOSE_COMPONENT( SCH_BASE_FRAME* aParent, const ...@@ -59,6 +57,11 @@ DIALOG_CHOOSE_COMPONENT::DIALOG_CHOOSE_COMPONENT( SCH_BASE_FRAME* aParent, const
wxFont font = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT ); wxFont font = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT );
m_libraryComponentTree->SetFont( wxFont( font.GetPointSize(), m_libraryComponentTree->SetFont( wxFont( font.GetPointSize(),
wxFONTFAMILY_MODERN, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL ) ); wxFONTFAMILY_MODERN, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL ) );
// this line fixes an issue on Linux Ubuntu using Unity (dialog not shown),
// and works fine on all systems
GetSizer()->Fit( this );
Centre();
} }
......
...@@ -36,7 +36,7 @@ class DIALOG_CHOOSE_COMPONENT : public DIALOG_CHOOSE_COMPONENT_BASE ...@@ -36,7 +36,7 @@ class DIALOG_CHOOSE_COMPONENT : public DIALOG_CHOOSE_COMPONENT_BASE
{ {
SCH_BASE_FRAME* m_parent; SCH_BASE_FRAME* m_parent;
COMPONENT_TREE_SEARCH_CONTAINER* const m_search_container; COMPONENT_TREE_SEARCH_CONTAINER* const m_search_container;
const int m_deMorganConvert; int m_deMorganConvert;
bool m_external_browser_requested; bool m_external_browser_requested;
bool m_received_doubleclick_in_tree; bool m_received_doubleclick_in_tree;
...@@ -51,7 +51,7 @@ public: ...@@ -51,7 +51,7 @@ public:
* @param aDeMorganConvert preferred deMorgan conversion (TODO: should happen in dialog) * @param aDeMorganConvert preferred deMorgan conversion (TODO: should happen in dialog)
*/ */
DIALOG_CHOOSE_COMPONENT( SCH_BASE_FRAME* aParent, const wxString& aTitle, DIALOG_CHOOSE_COMPONENT( SCH_BASE_FRAME* aParent, const wxString& aTitle,
COMPONENT_TREE_SEARCH_CONTAINER* aSearchContainer, COMPONENT_TREE_SEARCH_CONTAINER* const aSearchContainer,
int aDeMorganConvert ); int aDeMorganConvert );
virtual ~DIALOG_CHOOSE_COMPONENT(); virtual ~DIALOG_CHOOSE_COMPONENT();
......
...@@ -165,6 +165,8 @@ DIALOG_PRINT_USING_PRINTER::DIALOG_PRINT_USING_PRINTER( SCH_EDIT_FRAME* aParent ...@@ -165,6 +165,8 @@ DIALOG_PRINT_USING_PRINTER::DIALOG_PRINT_USING_PRINTER( SCH_EDIT_FRAME* aParent
// Problems with modal on wx-2.9 - Anyway preview is standard for OSX // Problems with modal on wx-2.9 - Anyway preview is standard for OSX
m_buttonPreview->Hide(); m_buttonPreview->Hide();
#endif #endif
GetSizer()->Fit( this );
} }
...@@ -274,6 +276,7 @@ void DIALOG_PRINT_USING_PRINTER::OnPrintPreview( wxCommandEvent& event ) ...@@ -274,6 +276,7 @@ void DIALOG_PRINT_USING_PRINTER::OnPrintPreview( wxCommandEvent& event )
preview->SetZoom( 100 ); preview->SetZoom( 100 );
SCH_PREVIEW_FRAME* frame = new SCH_PREVIEW_FRAME( preview, this, title ); SCH_PREVIEW_FRAME* frame = new SCH_PREVIEW_FRAME( preview, this, title );
frame->SetMinSize( wxSize( 550, 350 ) );
// on first invocation in this runtime session, set to 2/3 size of my parent, // on first invocation in this runtime session, set to 2/3 size of my parent,
// but will be changed in Show() if not first time as will position. // but will be changed in Show() if not first time as will position.
...@@ -281,6 +284,8 @@ void DIALOG_PRINT_USING_PRINTER::OnPrintPreview( wxCommandEvent& event ) ...@@ -281,6 +284,8 @@ void DIALOG_PRINT_USING_PRINTER::OnPrintPreview( wxCommandEvent& event )
frame->Center(); frame->Center();
frame->Initialize(); frame->Initialize();
frame->Raise(); // Needed on Ubuntu/Unity to display the frame
frame->Show( true ); frame->Show( true );
} }
......
...@@ -33,6 +33,8 @@ DIALOG_SCH_SHEET_PROPS::DIALOG_SCH_SHEET_PROPS( wxWindow* parent ) : ...@@ -33,6 +33,8 @@ DIALOG_SCH_SHEET_PROPS::DIALOG_SCH_SHEET_PROPS( wxWindow* parent ) :
m_textFileName->SetValidator( FILE_NAME_WITH_PATH_CHAR_VALIDATOR() ); m_textFileName->SetValidator( FILE_NAME_WITH_PATH_CHAR_VALIDATOR() );
m_textFileName->SetFocus(); m_textFileName->SetFocus();
m_sdbSizer1OK->SetDefault(); m_sdbSizer1OK->SetDefault();
GetSizer()->Fit( this );
} }
......
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<wxFormBuilder_Project> <wxFormBuilder_Project>
<FileVersion major="1" minor="11" /> <FileVersion major="1" minor="13" />
<object class="Project" expanded="1"> <object class="Project" expanded="1">
<property name="class_decoration"></property> <property name="class_decoration"></property>
<property name="code_generation">C++</property> <property name="code_generation">C++</property>
...@@ -41,10 +41,10 @@ ...@@ -41,10 +41,10 @@
<property name="hidden">0</property> <property name="hidden">0</property>
<property name="id">wxID_ANY</property> <property name="id">wxID_ANY</property>
<property name="maximum_size"></property> <property name="maximum_size"></property>
<property name="minimum_size"></property> <property name="minimum_size">500,150</property>
<property name="name">DIALOG_SCH_SHEET_PROPS_BASE</property> <property name="name">DIALOG_SCH_SHEET_PROPS_BASE</property>
<property name="pos"></property> <property name="pos"></property>
<property name="size">519,198</property> <property name="size">519,187</property>
<property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property> <property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>
<property name="subclass">DIALOG_SHIM; dialog_shim.h</property> <property name="subclass">DIALOG_SHIM; dialog_shim.h</property>
<property name="title">Schematic Sheet Properties</property> <property name="title">Schematic Sheet Properties</property>
...@@ -103,7 +103,7 @@ ...@@ -103,7 +103,7 @@
<property name="orient">wxVERTICAL</property> <property name="orient">wxVERTICAL</property>
<property name="permission">none</property> <property name="permission">none</property>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
<property name="border">12</property> <property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property> <property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">1</property> <property name="proportion">1</property>
<object class="wxFlexGridSizer" expanded="1"> <object class="wxFlexGridSizer" expanded="1">
...@@ -1472,7 +1472,7 @@ ...@@ -1472,7 +1472,7 @@
</object> </object>
</object> </object>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
<property name="border">12</property> <property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property> <property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="wxStdDialogButtonSizer" expanded="1"> <object class="wxStdDialogButtonSizer" expanded="1">
......
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Nov 6 2013) // C++ code generated with wxFormBuilder (version Jun 5 2014)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO "NOT" EDIT THIS FILE! // PLEASE DO "NOT" EDIT THIS FILE!
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
DIALOG_SCH_SHEET_PROPS_BASE::DIALOG_SCH_SHEET_PROPS_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style ) DIALOG_SCH_SHEET_PROPS_BASE::DIALOG_SCH_SHEET_PROPS_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( wxDefaultSize, wxDefaultSize ); this->SetSizeHints( wxSize( 500,150 ), wxDefaultSize );
wxBoxSizer* mainSizer; wxBoxSizer* mainSizer;
mainSizer = new wxBoxSizer( wxVERTICAL ); mainSizer = new wxBoxSizer( wxVERTICAL );
...@@ -99,7 +99,7 @@ DIALOG_SCH_SHEET_PROPS_BASE::DIALOG_SCH_SHEET_PROPS_BASE( wxWindow* parent, wxWi ...@@ -99,7 +99,7 @@ DIALOG_SCH_SHEET_PROPS_BASE::DIALOG_SCH_SHEET_PROPS_BASE( wxWindow* parent, wxWi
fgSizer1->Add( m_textCtrlTimeStamp, 0, wxEXPAND|wxTOP|wxBOTTOM|wxALIGN_CENTER_VERTICAL, 5 ); fgSizer1->Add( m_textCtrlTimeStamp, 0, wxEXPAND|wxTOP|wxBOTTOM|wxALIGN_CENTER_VERTICAL, 5 );
bupperSizer->Add( fgSizer1, 1, wxALL|wxEXPAND, 12 ); bupperSizer->Add( fgSizer1, 1, wxALL|wxEXPAND, 5 );
mainSizer->Add( bupperSizer, 0, wxEXPAND, 5 ); mainSizer->Add( bupperSizer, 0, wxEXPAND, 5 );
...@@ -117,7 +117,7 @@ DIALOG_SCH_SHEET_PROPS_BASE::DIALOG_SCH_SHEET_PROPS_BASE( wxWindow* parent, wxWi ...@@ -117,7 +117,7 @@ DIALOG_SCH_SHEET_PROPS_BASE::DIALOG_SCH_SHEET_PROPS_BASE( wxWindow* parent, wxWi
m_sdbSizer1->AddButton( m_sdbSizer1Cancel ); m_sdbSizer1->AddButton( m_sdbSizer1Cancel );
m_sdbSizer1->Realize(); m_sdbSizer1->Realize();
mainSizer->Add( m_sdbSizer1, 0, wxALL|wxEXPAND, 12 ); mainSizer->Add( m_sdbSizer1, 0, wxALL|wxEXPAND, 5 );
this->SetSizer( mainSizer ); this->SetSizer( mainSizer );
......
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Nov 6 2013) // C++ code generated with wxFormBuilder (version Jun 5 2014)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO "NOT" EDIT THIS FILE! // PLEASE DO "NOT" EDIT THIS FILE!
...@@ -57,7 +57,7 @@ class DIALOG_SCH_SHEET_PROPS_BASE : public DIALOG_SHIM ...@@ -57,7 +57,7 @@ class DIALOG_SCH_SHEET_PROPS_BASE : public DIALOG_SHIM
public: public:
DIALOG_SCH_SHEET_PROPS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Schematic Sheet Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 519,198 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); DIALOG_SCH_SHEET_PROPS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Schematic Sheet Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 519,187 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_SCH_SHEET_PROPS_BASE(); ~DIALOG_SCH_SHEET_PROPS_BASE();
}; };
......
...@@ -90,6 +90,8 @@ DIALOG_SCH_FIND::DIALOG_SCH_FIND( wxWindow* aParent, wxFindReplaceData* aData, ...@@ -90,6 +90,8 @@ DIALOG_SCH_FIND::DIALOG_SCH_FIND( wxWindow* aParent, wxFindReplaceData* aData,
} }
SetSize( size ); SetSize( size );
GetSizer()->Fit( this ); // Needed on Ubuntu/Unity to display the dialog
} }
......
...@@ -62,10 +62,12 @@ bool SCH_EDIT_FRAME::EditSheet( SCH_SHEET* aSheet, wxDC* aDC ) ...@@ -62,10 +62,12 @@ bool SCH_EDIT_FRAME::EditSheet( SCH_SHEET* aSheet, wxDC* aDC )
* column from being sized correctly. It doesn't cause any problems * column from being sized correctly. It doesn't cause any problems
* on win32 so it doesn't need to wrapped in ugly #ifdef __WXGTK__ * on win32 so it doesn't need to wrapped in ugly #ifdef __WXGTK__
* #endif. * #endif.
* Still presen in wxWidgets 3.0.2
*/ */
dlg.Layout(); dlg.Layout();
dlg.Fit(); dlg.Fit();
dlg.SetMinSize( dlg.GetSize() ); dlg.SetMinSize( dlg.GetSize() );
dlg.GetSizer()->Fit( &dlg );
if( dlg.ShowModal() == wxID_CANCEL ) if( dlg.ShowModal() == wxID_CANCEL )
return false; return false;
......
...@@ -133,6 +133,8 @@ DIALOG_PRINT_USING_PRINTER::DIALOG_PRINT_USING_PRINTER( GERBVIEW_FRAME* parent ) ...@@ -133,6 +133,8 @@ DIALOG_PRINT_USING_PRINTER::DIALOG_PRINT_USING_PRINTER( GERBVIEW_FRAME* parent )
/* Problems with modal on wx-2.9 - Anyway preview is standard for OSX */ /* Problems with modal on wx-2.9 - Anyway preview is standard for OSX */
m_buttonPreview->Hide(); m_buttonPreview->Hide();
#endif #endif
GetSizer()->Fit( this );
} }
...@@ -368,8 +370,11 @@ void DIALOG_PRINT_USING_PRINTER::OnPrintPreview( wxCommandEvent& event ) ...@@ -368,8 +370,11 @@ void DIALOG_PRINT_USING_PRINTER::OnPrintPreview( wxCommandEvent& event )
wxSize WSize = m_Parent->GetSize(); wxSize WSize = m_Parent->GetSize();
wxPreviewFrame* frame = new wxPreviewFrame( preview, this, title, WPos, WSize ); wxPreviewFrame* frame = new wxPreviewFrame( preview, this, title, WPos, WSize );
frame->SetMinSize( wxSize( 550, 350 ) );
frame->Initialize(); frame->Initialize();
frame->Raise(); // Needed on Ubuntu/Unity to display the frame
frame->Show( true ); frame->Show( true );
} }
......
...@@ -94,8 +94,10 @@ private: ...@@ -94,8 +94,10 @@ private:
void onListItemSelected( wxListEvent& event ); void onListItemSelected( wxListEvent& event );
void onListItemActivated( wxListEvent& event ); void onListItemActivated( wxListEvent& event );
void textChangeInFilterBox(wxCommandEvent& event); void textChangeInFilterBox(wxCommandEvent& event);
void sortList();
void initDialog( const wxArrayString& aItemHeaders,
const wxString& aSelection);
void sortList();
bool m_sortList; bool m_sortList;
void (* m_cb_func)( wxString& text, void* data ); void (* m_cb_func)( wxString& text, void* data );
void* m_cb_data; void* m_cb_data;
......
...@@ -165,7 +165,8 @@ public: ...@@ -165,7 +165,8 @@ public:
m_scope( aScope ), m_scope( aScope ),
m_mouseButtons( 0 ), m_mouseButtons( 0 ),
m_keyCode( 0 ), m_keyCode( 0 ),
m_modifiers( 0 ) {} m_modifiers( 0 ),
m_param( NULL ) {}
TOOL_EVENT( TOOL_EVENT_CATEGORY aCategory, TOOL_ACTIONS aAction, int aExtraParam, TOOL_EVENT( TOOL_EVENT_CATEGORY aCategory, TOOL_ACTIONS aAction, int aExtraParam,
TOOL_ACTION_SCOPE aScope = AS_GLOBAL ) : TOOL_ACTION_SCOPE aScope = AS_GLOBAL ) :
...@@ -174,7 +175,8 @@ public: ...@@ -174,7 +175,8 @@ public:
m_scope( aScope ), m_scope( aScope ),
m_mouseButtons( 0 ), m_mouseButtons( 0 ),
m_keyCode( 0 ), m_keyCode( 0 ),
m_modifiers( 0 ) m_modifiers( 0 ),
m_param( NULL )
{ {
if( aCategory == TC_MOUSE ) if( aCategory == TC_MOUSE )
{ {
...@@ -202,7 +204,8 @@ public: ...@@ -202,7 +204,8 @@ public:
m_scope( aScope ), m_scope( aScope ),
m_mouseButtons( 0 ), m_mouseButtons( 0 ),
m_keyCode( 0 ), m_keyCode( 0 ),
m_modifiers( 0 ) m_modifiers( 0 ),
m_param( NULL )
{ {
if( aCategory == TC_COMMAND || aCategory == TC_MESSAGE ) if( aCategory == TC_COMMAND || aCategory == TC_MESSAGE )
m_commandStr = aExtraParam; m_commandStr = aExtraParam;
...@@ -352,6 +355,27 @@ public: ...@@ -352,6 +355,27 @@ public:
*/ */
bool IsAction( const TOOL_ACTION* aAction ) const; bool IsAction( const TOOL_ACTION* aAction ) const;
/**
* Function Parameter()
* Returns a non-standard parameter assigned to the event. Its meaning depends on the
* target tool.
*/
void* Parameter() const
{
return m_param;
}
/**
* Function SetParameter()
* Sets a non-standard parameter assigned to the event. Its meaning depends on the
* target tool.
* @param aParam is the new parameter.
*/
void SetParameter(void* aParam)
{
m_param = aParam;
}
boost::optional<int> GetCommandId() const boost::optional<int> GetCommandId() const
{ {
return m_commandId; return m_commandId;
...@@ -388,6 +412,9 @@ private: ...@@ -388,6 +412,9 @@ private:
///> State of key modifierts (Ctrl/Alt/etc.) ///> State of key modifierts (Ctrl/Alt/etc.)
int m_modifiers; int m_modifiers;
///> Generic parameter used for passing non-standard data.
void* m_param;
boost::optional<int> m_commandId; boost::optional<int> m_commandId;
boost::optional<std::string> m_commandStr; boost::optional<std::string> m_commandStr;
}; };
......
...@@ -108,9 +108,11 @@ public: ...@@ -108,9 +108,11 @@ public:
* @param aActionName is the name of action to be invoked. * @param aActionName is the name of action to be invoked.
* @param aNow decides if the action has to be run immediately or after the current coroutine * @param aNow decides if the action has to be run immediately or after the current coroutine
* is preemptied. * is preemptied.
* @param aParam is an optional parameter that might be used by the invoked action. Its meaning
* depends on the action.
* @return False if the action was not found. * @return False if the action was not found.
*/ */
bool RunAction( const std::string& aActionName, bool aNow = false ); bool RunAction( const std::string& aActionName, bool aNow = false, void* aParam = NULL );
/** /**
* Function RunAction() * Function RunAction()
...@@ -119,8 +121,10 @@ public: ...@@ -119,8 +121,10 @@ public:
* @param aAction is the action to be invoked. * @param aAction is the action to be invoked.
* @param aNow decides if the action has to be run immediately or after the current coroutine * @param aNow decides if the action has to be run immediately or after the current coroutine
* is preemptied. * is preemptied.
* @param aParam is an optional parameter that might be used by the invoked action. Its meaning
* depends on the action.
*/ */
void RunAction( const TOOL_ACTION& aAction, bool aNow = false ); void RunAction( const TOOL_ACTION& aAction, bool aNow = false, void* aParam = NULL );
/** /**
* Function FindTool() * Function FindTool()
......
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
#define OPTKEY_OUTPUT_UNIT wxT( "VrmlExportUnit" ) #define OPTKEY_OUTPUT_UNIT wxT( "VrmlExportUnit" )
#define OPTKEY_3DFILES_OPT wxT( "VrmlExportCopyFiles" ) #define OPTKEY_3DFILES_OPT wxT( "VrmlExportCopyFiles" )
#define OPTKEY_USE_ABS_PATHS wxT( "VrmlUseRelativePaths" ) #define OPTKEY_USE_RELATIVE_PATHS wxT( "VrmlUseRelativePaths" )
class DIALOG_EXPORT_3DFILE : public DIALOG_EXPORT_3DFILE_BASE class DIALOG_EXPORT_3DFILE : public DIALOG_EXPORT_3DFILE_BASE
...@@ -61,10 +61,10 @@ public: ...@@ -61,10 +61,10 @@ public:
m_filePicker->SetFocus(); m_filePicker->SetFocus();
m_config->Read( OPTKEY_OUTPUT_UNIT, &m_unitsOpt ); m_config->Read( OPTKEY_OUTPUT_UNIT, &m_unitsOpt );
m_config->Read( OPTKEY_3DFILES_OPT, &m_copy3DFilesOpt ); m_config->Read( OPTKEY_3DFILES_OPT, &m_copy3DFilesOpt );
m_config->Read( OPTKEY_USE_ABS_PATHS, &m_useRelativePathsOpt ); m_config->Read( OPTKEY_USE_RELATIVE_PATHS, &m_useRelativePathsOpt );
m_rbSelectUnits->SetSelection( m_unitsOpt ); m_rbSelectUnits->SetSelection( m_unitsOpt );
m_cbCopyFiles->SetValue( m_copy3DFilesOpt ); m_cbCopyFiles->SetValue( m_copy3DFilesOpt );
m_cbUseAbsolutePaths->SetValue( m_useRelativePathsOpt ); m_cbUseRelativePaths->SetValue( m_useRelativePathsOpt );
wxButton* okButton = (wxButton*) FindWindowByLabel( wxT( "OK" ) ); wxButton* okButton = (wxButton*) FindWindowByLabel( wxT( "OK" ) );
if( okButton ) if( okButton )
...@@ -74,7 +74,7 @@ public: ...@@ -74,7 +74,7 @@ public:
Centre(); Centre();
Connect( ID_USE_ABS_PATH, wxEVT_UPDATE_UI, Connect( ID_USE_ABS_PATH, wxEVT_UPDATE_UI,
wxUpdateUIEventHandler( DIALOG_EXPORT_3DFILE::OnUpdateUseAbsolutPath ) ); wxUpdateUIEventHandler( DIALOG_EXPORT_3DFILE::OnUpdateUseRelativePath ) );
} }
~DIALOG_EXPORT_3DFILE() ~DIALOG_EXPORT_3DFILE()
...@@ -83,7 +83,7 @@ public: ...@@ -83,7 +83,7 @@ public:
m_copy3DFilesOpt = GetCopyFilesOption(); m_copy3DFilesOpt = GetCopyFilesOption();
m_config->Write( OPTKEY_OUTPUT_UNIT, m_unitsOpt ); m_config->Write( OPTKEY_OUTPUT_UNIT, m_unitsOpt );
m_config->Write( OPTKEY_3DFILES_OPT, m_copy3DFilesOpt ); m_config->Write( OPTKEY_3DFILES_OPT, m_copy3DFilesOpt );
m_config->Write( OPTKEY_USE_ABS_PATHS, m_useRelativePathsOpt ); m_config->Write( OPTKEY_USE_RELATIVE_PATHS, m_useRelativePathsOpt );
}; };
void SetSubdir( const wxString & aDir ) void SetSubdir( const wxString & aDir )
...@@ -111,12 +111,12 @@ public: ...@@ -111,12 +111,12 @@ public:
return m_copy3DFilesOpt = m_cbCopyFiles->GetValue(); return m_copy3DFilesOpt = m_cbCopyFiles->GetValue();
} }
bool GetUseAbsolutePathsOption() bool GetUseRelativePathsOption()
{ {
return m_useRelativePathsOpt = m_cbUseAbsolutePaths->GetValue(); return m_useRelativePathsOpt = m_cbUseRelativePaths->GetValue();
} }
void OnUpdateUseAbsolutPath( wxUpdateUIEvent& event ) void OnUpdateUseRelativePath( wxUpdateUIEvent& event )
{ {
// Making path relative or absolute has no meaning when VRML files are not copied. // Making path relative or absolute has no meaning when VRML files are not copied.
event.Enable( m_cbCopyFiles->GetValue() ); event.Enable( m_cbCopyFiles->GetValue() );
...@@ -157,7 +157,7 @@ void PCB_EDIT_FRAME::OnExportVRML( wxCommandEvent& event ) ...@@ -157,7 +157,7 @@ void PCB_EDIT_FRAME::OnExportVRML( wxCommandEvent& event )
double scale = scaleList[dlg.GetUnits()]; // final scale export double scale = scaleList[dlg.GetUnits()]; // final scale export
bool export3DFiles = dlg.GetCopyFilesOption(); bool export3DFiles = dlg.GetCopyFilesOption();
bool useRelativePaths = dlg.GetUseAbsolutePathsOption(); bool useRelativePaths = dlg.GetUseRelativePathsOption();
wxString fullFilename = dlg.FilePicker()->GetPath(); wxString fullFilename = dlg.FilePicker()->GetPath();
wxFileName modelPath = fullFilename; wxFileName modelPath = fullFilename;
wxBusyCursor dummy; wxBusyCursor dummy;
......
...@@ -47,9 +47,10 @@ DIALOG_EXPORT_3DFILE_BASE::DIALOG_EXPORT_3DFILE_BASE( wxWindow* parent, wxWindow ...@@ -47,9 +47,10 @@ DIALOG_EXPORT_3DFILE_BASE::DIALOG_EXPORT_3DFILE_BASE( wxWindow* parent, wxWindow
m_cbCopyFiles->SetValue(true); m_cbCopyFiles->SetValue(true);
bSizer4->Add( m_cbCopyFiles, 0, wxALL, 5 ); bSizer4->Add( m_cbCopyFiles, 0, wxALL, 5 );
m_cbUseAbsolutePaths = new wxCheckBox( this, ID_USE_ABS_PATH, _("Use absolute paths to model files in board VRML file"), wxDefaultPosition, wxDefaultSize, 0 ); m_cbUseRelativePaths = new wxCheckBox( this, ID_USE_ABS_PATH, _("Use relative paths to model files in board VRML file"), wxDefaultPosition, wxDefaultSize, 0 );
m_cbUseAbsolutePaths->SetValue(true); m_cbUseRelativePaths->SetToolTip( _("Use paths for model files in board VRML file relative to the vrml file") );
bSizer4->Add( m_cbUseAbsolutePaths, 0, wxALL, 5 );
bSizer4->Add( m_cbUseRelativePaths, 0, wxALL, 5 );
bLowerSizer->Add( bSizer4, 3, wxEXPAND, 5 ); bLowerSizer->Add( bSizer4, 3, wxEXPAND, 5 );
......
...@@ -574,7 +574,7 @@ ...@@ -574,7 +574,7 @@
<property name="caption"></property> <property name="caption"></property>
<property name="caption_visible">1</property> <property name="caption_visible">1</property>
<property name="center_pane">0</property> <property name="center_pane">0</property>
<property name="checked">1</property> <property name="checked">0</property>
<property name="close_button">1</property> <property name="close_button">1</property>
<property name="context_help"></property> <property name="context_help"></property>
<property name="context_menu">1</property> <property name="context_menu">1</property>
...@@ -589,7 +589,7 @@ ...@@ -589,7 +589,7 @@
<property name="gripper">0</property> <property name="gripper">0</property>
<property name="hidden">0</property> <property name="hidden">0</property>
<property name="id">ID_USE_ABS_PATH</property> <property name="id">ID_USE_ABS_PATH</property>
<property name="label">Use absolute paths to model files in board VRML file</property> <property name="label">Use relative paths to model files in board VRML file</property>
<property name="max_size"></property> <property name="max_size"></property>
<property name="maximize_button">0</property> <property name="maximize_button">0</property>
<property name="maximum_size"></property> <property name="maximum_size"></property>
...@@ -597,7 +597,7 @@ ...@@ -597,7 +597,7 @@
<property name="minimize_button">0</property> <property name="minimize_button">0</property>
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="moveable">1</property> <property name="moveable">1</property>
<property name="name">m_cbUseAbsolutePaths</property> <property name="name">m_cbUseRelativePaths</property>
<property name="pane_border">1</property> <property name="pane_border">1</property>
<property name="pane_position"></property> <property name="pane_position"></property>
<property name="pane_size"></property> <property name="pane_size"></property>
...@@ -610,7 +610,7 @@ ...@@ -610,7 +610,7 @@
<property name="style"></property> <property name="style"></property>
<property name="subclass"></property> <property name="subclass"></property>
<property name="toolbar_pane">0</property> <property name="toolbar_pane">0</property>
<property name="tooltip"></property> <property name="tooltip">Use paths for model files in board VRML file relative to the vrml file</property>
<property name="validator_data_type"></property> <property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property> <property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property> <property name="validator_type">wxDefaultValidator</property>
......
...@@ -49,7 +49,7 @@ class DIALOG_EXPORT_3DFILE_BASE : public DIALOG_SHIM ...@@ -49,7 +49,7 @@ class DIALOG_EXPORT_3DFILE_BASE : public DIALOG_SHIM
wxStaticText* m_staticText3; wxStaticText* m_staticText3;
wxTextCtrl* m_SubdirNameCtrl; wxTextCtrl* m_SubdirNameCtrl;
wxCheckBox* m_cbCopyFiles; wxCheckBox* m_cbCopyFiles;
wxCheckBox* m_cbUseAbsolutePaths; wxCheckBox* m_cbUseRelativePaths;
wxRadioBox* m_rbSelectUnits; wxRadioBox* m_rbSelectUnits;
wxStaticLine* m_staticline1; wxStaticLine* m_staticline1;
wxStdDialogButtonSizer* m_sdbSizer1; wxStdDialogButtonSizer* m_sdbSizer1;
......
...@@ -151,6 +151,7 @@ private: ...@@ -151,6 +151,7 @@ private:
void PadPropertiesAccept( wxCommandEvent& event ); void PadPropertiesAccept( wxCommandEvent& event );
}; };
void PCB_BASE_FRAME::InstallPadOptionsFrame( D_PAD* aPad ) void PCB_BASE_FRAME::InstallPadOptionsFrame( D_PAD* aPad )
{ {
DIALOG_PAD_PROPERTIES dlg( this, aPad ); DIALOG_PAD_PROPERTIES dlg( this, aPad );
...@@ -245,14 +246,41 @@ void DIALOG_PAD_PROPERTIES::OnPaintShowPanel( wxPaintEvent& event ) ...@@ -245,14 +246,41 @@ void DIALOG_PAD_PROPERTIES::OnPaintShowPanel( wxPaintEvent& event )
dc.SetDeviceOrigin( dc_size.x / 2, dc_size.y / 2 ); dc.SetDeviceOrigin( dc_size.x / 2, dc_size.y / 2 );
// Calculate a suitable scale to fit the available draw area // Calculate a suitable scale to fit the available draw area
int dim = m_dummyPad->GetSize().x + std::abs( m_dummyPad->GetDelta().y); int dim = m_dummyPad->GetSize().x + std::abs( m_dummyPad->GetDelta().y );
// Invalid x size. User could enter zero, or have deleted all text prior to
// entering a new value; this is also treated as zero. If dim is left at
// zero, the drawing scale is zero and we get a crash.
if( dim == 0 )
{
// If drill size has been set, use that. Otherwise default to 1mm.
dim = m_dummyPad->GetDrillSize().x;
if( dim == 0 )
dim = 1000000;
}
if( m_dummyPad->GetLocalClearance() > 0 ) if( m_dummyPad->GetLocalClearance() > 0 )
dim += m_dummyPad->GetLocalClearance() * 2; dim += m_dummyPad->GetLocalClearance() * 2;
double scale = (double) dc_size.x / dim; double scale = (double) dc_size.x / dim;
dim = m_dummyPad->GetSize().y + std::abs( m_dummyPad->GetDelta().x); // If the pad is a circle, use the x size here instead.
int ysize;
if( m_dummyPad->GetShape() == PAD_CIRCLE )
ysize = m_dummyPad->GetSize().x;
else
ysize = m_dummyPad->GetSize().y;
dim = ysize + std::abs( m_dummyPad->GetDelta().x );
// Invalid y size. See note about x size above.
if( dim == 0 )
{
dim = m_dummyPad->GetDrillSize().y;
if( dim == 0 )
dim = 1000000;
}
if( m_dummyPad->GetLocalClearance() > 0 ) if( m_dummyPad->GetLocalClearance() > 0 )
dim += m_dummyPad->GetLocalClearance() * 2; dim += m_dummyPad->GetLocalClearance() * 2;
...@@ -666,13 +694,13 @@ void DIALOG_PAD_PROPERTIES::setPadLayersList( LSET layer_mask ) ...@@ -666,13 +694,13 @@ void DIALOG_PAD_PROPERTIES::setPadLayersList( LSET layer_mask )
LSET cu_set = layer_mask & LSET::AllCuMask(); LSET cu_set = layer_mask & LSET::AllCuMask();
if( cu_set == LSET( F_Cu ) ) if( cu_set == LSET( F_Cu ) )
m_rbCopperLayersSel->SetSelection(0); m_rbCopperLayersSel->SetSelection( 0 );
else if( cu_set == LSET( B_Cu ) ) else if( cu_set == LSET( B_Cu ) )
m_rbCopperLayersSel->SetSelection(1); m_rbCopperLayersSel->SetSelection( 1 );
else if( cu_set.any() ) else if( cu_set.any() )
m_rbCopperLayersSel->SetSelection(2); m_rbCopperLayersSel->SetSelection( 2 );
else else
m_rbCopperLayersSel->SetSelection(3); m_rbCopperLayersSel->SetSelection( 3 );
m_PadLayerAdhCmp->SetValue( layer_mask[F_Adhes] ); m_PadLayerAdhCmp->SetValue( layer_mask[F_Adhes] );
m_PadLayerAdhCu->SetValue( layer_mask[B_Adhes] ); m_PadLayerAdhCu->SetValue( layer_mask[B_Adhes] );
...@@ -710,6 +738,12 @@ bool DIALOG_PAD_PROPERTIES::padValuesOK() ...@@ -710,6 +738,12 @@ bool DIALOG_PAD_PROPERTIES::padValuesOK()
wxString msg; wxString msg;
// Test for incorrect values // Test for incorrect values
if( (m_dummyPad->GetSize().x <= 0) ||
((m_dummyPad->GetSize().y <= 0) && (m_dummyPad->GetShape() != PAD_CIRCLE)) )
{
error_msgs.Add( _( "Pad size must be greater than zero" ) );
}
if( (m_dummyPad->GetSize().x < m_dummyPad->GetDrillSize().x) || if( (m_dummyPad->GetSize().x < m_dummyPad->GetDrillSize().x) ||
(m_dummyPad->GetSize().y < m_dummyPad->GetDrillSize().y) ) (m_dummyPad->GetSize().y < m_dummyPad->GetDrillSize().y) )
{ {
...@@ -730,10 +764,10 @@ bool DIALOG_PAD_PROPERTIES::padValuesOK() ...@@ -730,10 +764,10 @@ bool DIALOG_PAD_PROPERTIES::padValuesOK()
if( m_dummyPad->GetAttribute() == PAD_HOLE_NOT_PLATED ) if( m_dummyPad->GetAttribute() == PAD_HOLE_NOT_PLATED )
{ {
msg += wxT("<br><br><i>"); msg += wxT( "<br><br><i>" );
msg += _( "For NPTH pad, set pad size value to pad drill value," msg += _( "For NPTH pad, set pad size value to pad drill value,"
" if you do not want this pad plotted in gerber files" " if you do not want this pad plotted in gerber files"
); );
} }
error_msgs.Add( msg ); error_msgs.Add( msg );
......
...@@ -25,7 +25,6 @@ ...@@ -25,7 +25,6 @@
/* File: dialog_print_for_modedit.cpp */ /* File: dialog_print_for_modedit.cpp */
#include <fctsys.h> #include <fctsys.h>
//#include <pgm_base.h>
#include <kiface_i.h> #include <kiface_i.h>
#include <class_drawpanel.h> #include <class_drawpanel.h>
#include <confirm.h> #include <confirm.h>
...@@ -116,6 +115,7 @@ DIALOG_PRINT_FOR_MODEDIT::DIALOG_PRINT_FOR_MODEDIT( PCB_BASE_FRAME* parent ) : ...@@ -116,6 +115,7 @@ DIALOG_PRINT_FOR_MODEDIT::DIALOG_PRINT_FOR_MODEDIT( PCB_BASE_FRAME* parent ) :
m_buttonPrint->SetDefault(); m_buttonPrint->SetDefault();
GetSizer()->SetSizeHints( this ); GetSizer()->SetSizeHints( this );
GetSizer()->Fit( this ); // Needed on Ubuntu/Unity to display the dialog
} }
...@@ -188,8 +188,11 @@ void DIALOG_PRINT_FOR_MODEDIT::OnPrintPreview( wxCommandEvent& event ) ...@@ -188,8 +188,11 @@ void DIALOG_PRINT_FOR_MODEDIT::OnPrintPreview( wxCommandEvent& event )
wxSize WSize = m_parent->GetSize(); wxSize WSize = m_parent->GetSize();
wxPreviewFrame* frame = new wxPreviewFrame( preview, this, title, WPos, WSize ); wxPreviewFrame* frame = new wxPreviewFrame( preview, this, title, WPos, WSize );
frame->SetMinSize( wxSize( 550, 350 ) );
frame->Initialize(); frame->Initialize();
frame->Raise(); // Needed on Ubuntu/Unity to display the frame
frame->Show( true ); frame->Show( true );
} }
......
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
//#define wxTEST_POSTSCRIPT_IN_MSW 1 //#define wxTEST_POSTSCRIPT_IN_MSW 1
#include <fctsys.h> #include <fctsys.h>
//#include <pgm_base.h>
#include <kiface_i.h> #include <kiface_i.h>
#include <class_drawpanel.h> #include <class_drawpanel.h>
#include <confirm.h> #include <confirm.h>
...@@ -146,22 +145,18 @@ DIALOG_PRINT_USING_PRINTER::DIALOG_PRINT_USING_PRINTER( PCB_EDIT_FRAME* parent ) ...@@ -146,22 +145,18 @@ DIALOG_PRINT_USING_PRINTER::DIALOG_PRINT_USING_PRINTER( PCB_EDIT_FRAME* parent )
{ {
m_parent = parent; m_parent = parent;
m_config = Kiface().KifaceSettings(); m_config = Kiface().KifaceSettings();
memset( m_BoxSelectLayer, 0, sizeof( m_BoxSelectLayer ) ); memset( m_BoxSelectLayer, 0, sizeof( m_BoxSelectLayer ) );
initValues( ); initValues( );
if( GetSizer() ) GetSizer()->SetSizeHints( this );
{
GetSizer()->SetSizeHints( this );
}
Center(); Center();
#ifdef __WXMAC__ #ifdef __WXMAC__
/* Problems with modal on wx-2.9 - Anyway preview is standard for OSX */ /* Problems with modal on wx-2.9 - Anyway preview is standard for OSX */
m_buttonPreview->Hide(); m_buttonPreview->Hide();
#endif #endif
GetSizer()->Fit( this );
} }
...@@ -469,8 +464,11 @@ void DIALOG_PRINT_USING_PRINTER::OnPrintPreview( wxCommandEvent& event ) ...@@ -469,8 +464,11 @@ void DIALOG_PRINT_USING_PRINTER::OnPrintPreview( wxCommandEvent& event )
preview->SetZoom( 100 ); preview->SetZoom( 100 );
wxPreviewFrame* frame = new wxPreviewFrame( preview, this, title, WPos, WSize ); wxPreviewFrame* frame = new wxPreviewFrame( preview, this, title, WPos, WSize );
frame->SetMinSize( wxSize( 550, 350 ) );
frame->Initialize(); frame->Initialize();
frame->Raise(); // Needed on Ubuntu/Unity to display the frame
frame->Show( true ); frame->Show( true );
} }
......
...@@ -32,7 +32,15 @@ TOOL_ACTION COMMON_ACTIONS::selectionActivate( "pcbnew.InteractiveSelection", ...@@ -32,7 +32,15 @@ TOOL_ACTION COMMON_ACTIONS::selectionActivate( "pcbnew.InteractiveSelection",
AS_GLOBAL, 0, AS_GLOBAL, 0,
"", "", AF_ACTIVATE ); // No description, it is not supposed to be shown anywhere "", "", AF_ACTIVATE ); // No description, it is not supposed to be shown anywhere
TOOL_ACTION COMMON_ACTIONS::selectionSingle( "pcbnew.InteractiveSelection.Single", TOOL_ACTION COMMON_ACTIONS::selectionCursor( "pcbnew.InteractiveSelection.Cursor",
AS_GLOBAL, 0,
"", "" ); // No description, it is not supposed to be shown anywhere
TOOL_ACTION COMMON_ACTIONS::selectItem( "pcbnew.InteractiveSelection.SelectItem",
AS_GLOBAL, 0,
"", "" ); // No description, it is not supposed to be shown anywhere
TOOL_ACTION COMMON_ACTIONS::unselectItem( "pcbnew.InteractiveSelection.UnselectItem",
AS_GLOBAL, 0, AS_GLOBAL, 0,
"", "" ); // No description, it is not supposed to be shown anywhere "", "" ); // No description, it is not supposed to be shown anywhere
......
...@@ -41,11 +41,17 @@ public: ...@@ -41,11 +41,17 @@ public:
static TOOL_ACTION selectionActivate; static TOOL_ACTION selectionActivate;
/// Select a single item under the cursor position /// Select a single item under the cursor position
static TOOL_ACTION selectionSingle; static TOOL_ACTION selectionCursor;
/// Clears the current selection /// Clears the current selection
static TOOL_ACTION selectionClear; static TOOL_ACTION selectionClear;
/// Selects an item (specified as the event parameter).
static TOOL_ACTION selectItem;
/// Unselects an item (specified as the event parameter).
static TOOL_ACTION unselectItem;
// Edit Tool // Edit Tool
/// Activation of the edit tool /// Activation of the edit tool
static TOOL_ACTION editActivate; static TOOL_ACTION editActivate;
......
...@@ -581,7 +581,7 @@ wxPoint EDIT_TOOL::getModificationPoint( const SELECTION& aSelection ) ...@@ -581,7 +581,7 @@ wxPoint EDIT_TOOL::getModificationPoint( const SELECTION& aSelection )
bool EDIT_TOOL::makeSelection( const SELECTION& aSelection ) bool EDIT_TOOL::makeSelection( const SELECTION& aSelection )
{ {
if( aSelection.Empty() ) // Try to find an item that could be modified if( aSelection.Empty() ) // Try to find an item that could be modified
m_toolMgr->RunAction( COMMON_ACTIONS::selectionSingle, true ); m_toolMgr->RunAction( COMMON_ACTIONS::selectionCursor, true );
return !aSelection.Empty(); return !aSelection.Empty();
} }
......
...@@ -233,7 +233,7 @@ int POINT_EDITOR::OnSelectionChange( TOOL_EVENT& aEvent ) ...@@ -233,7 +233,7 @@ int POINT_EDITOR::OnSelectionChange( TOOL_EVENT& aEvent )
{ {
if( !m_editPoints || if( !m_editPoints ||
evt->Matches( m_selectionTool->ClearedEvent ) || evt->Matches( m_selectionTool->ClearedEvent ) ||
evt->Matches( m_selectionTool->DeselectedEvent ) || evt->Matches( m_selectionTool->UnselectedEvent ) ||
evt->Matches( m_selectionTool->SelectedEvent ) ) evt->Matches( m_selectionTool->SelectedEvent ) )
{ {
break; break;
...@@ -783,7 +783,7 @@ void POINT_EDITOR::breakOutline( const VECTOR2I& aBreakPoint ) ...@@ -783,7 +783,7 @@ void POINT_EDITOR::breakOutline( const VECTOR2I& aBreakPoint )
void POINT_EDITOR::setTransitions() void POINT_EDITOR::setTransitions()
{ {
Go( &POINT_EDITOR::OnSelectionChange, m_selectionTool->SelectedEvent ); Go( &POINT_EDITOR::OnSelectionChange, m_selectionTool->SelectedEvent );
Go( &POINT_EDITOR::OnSelectionChange, m_selectionTool->DeselectedEvent ); Go( &POINT_EDITOR::OnSelectionChange, m_selectionTool->UnselectedEvent );
} }
......
...@@ -52,7 +52,7 @@ ...@@ -52,7 +52,7 @@
SELECTION_TOOL::SELECTION_TOOL() : SELECTION_TOOL::SELECTION_TOOL() :
TOOL_INTERACTIVE( "pcbnew.InteractiveSelection" ), TOOL_INTERACTIVE( "pcbnew.InteractiveSelection" ),
SelectedEvent( TC_MESSAGE, TA_ACTION, "pcbnew.InteractiveSelection.selected" ), SelectedEvent( TC_MESSAGE, TA_ACTION, "pcbnew.InteractiveSelection.selected" ),
DeselectedEvent( TC_MESSAGE, TA_ACTION, "pcbnew.InteractiveSelection.deselected" ), UnselectedEvent( TC_MESSAGE, TA_ACTION, "pcbnew.InteractiveSelection.unselected" ),
ClearedEvent( TC_MESSAGE, TA_ACTION, "pcbnew.InteractiveSelection.cleared" ), ClearedEvent( TC_MESSAGE, TA_ACTION, "pcbnew.InteractiveSelection.cleared" ),
m_frame( NULL ), m_additive( false ), m_multiple( false ), m_frame( NULL ), m_additive( false ), m_multiple( false ),
m_editModules( false ), m_locked( true ) m_editModules( false ), m_locked( true )
...@@ -111,7 +111,7 @@ int SELECTION_TOOL::Main( TOOL_EVENT& aEvent ) ...@@ -111,7 +111,7 @@ int SELECTION_TOOL::Main( TOOL_EVENT& aEvent )
if( !m_additive ) if( !m_additive )
clearSelection(); clearSelection();
selectSingle( evt->Position() ); selectCursor( evt->Position() );
} }
} }
...@@ -119,7 +119,7 @@ int SELECTION_TOOL::Main( TOOL_EVENT& aEvent ) ...@@ -119,7 +119,7 @@ int SELECTION_TOOL::Main( TOOL_EVENT& aEvent )
else if( evt->IsClick( BUT_RIGHT ) ) else if( evt->IsClick( BUT_RIGHT ) )
{ {
if( m_selection.Empty() ) if( m_selection.Empty() )
selectSingle( evt->Position() ); selectCursor( evt->Position() );
generateMenu(); generateMenu();
} }
...@@ -128,7 +128,7 @@ int SELECTION_TOOL::Main( TOOL_EVENT& aEvent ) ...@@ -128,7 +128,7 @@ int SELECTION_TOOL::Main( TOOL_EVENT& aEvent )
else if( evt->IsDblClick( BUT_LEFT ) ) else if( evt->IsDblClick( BUT_LEFT ) )
{ {
if( m_selection.Empty() ) if( m_selection.Empty() )
selectSingle( evt->Position() ); selectCursor( evt->Position() );
m_toolMgr->RunAction( COMMON_ACTIONS::properties ); m_toolMgr->RunAction( COMMON_ACTIONS::properties );
} }
...@@ -143,7 +143,7 @@ int SELECTION_TOOL::Main( TOOL_EVENT& aEvent ) ...@@ -143,7 +143,7 @@ int SELECTION_TOOL::Main( TOOL_EVENT& aEvent )
else if( m_selection.Empty() ) else if( m_selection.Empty() )
{ {
// There is nothing selected, so try to select something // There is nothing selected, so try to select something
if( !selectSingle( getView()->ToWorld( getViewControls()->GetMousePosition() ), false ) ) if( !selectCursor( getView()->ToWorld( getViewControls()->GetMousePosition() ), false ) )
{ {
// If nothings has been selected or user wants to select more // If nothings has been selected or user wants to select more
// draw the selection box // draw the selection box
...@@ -171,10 +171,10 @@ int SELECTION_TOOL::Main( TOOL_EVENT& aEvent ) ...@@ -171,10 +171,10 @@ int SELECTION_TOOL::Main( TOOL_EVENT& aEvent )
} }
} }
else if( evt->IsAction( &COMMON_ACTIONS::selectionSingle ) ) else if( evt->IsAction( &COMMON_ACTIONS::selectionCursor ) )
{ {
// GetMousePosition() is used, as it is independent of snapping settings // GetMousePosition() is used, as it is independent of snapping settings
selectSingle( getView()->ToWorld( getViewControls()->GetMousePosition() ) ); selectCursor( getView()->ToWorld( getViewControls()->GetMousePosition() ) );
} }
else if( evt->IsAction( &COMMON_ACTIONS::find ) ) else if( evt->IsAction( &COMMON_ACTIONS::find ) )
...@@ -187,6 +187,16 @@ int SELECTION_TOOL::Main( TOOL_EVENT& aEvent ) ...@@ -187,6 +187,16 @@ int SELECTION_TOOL::Main( TOOL_EVENT& aEvent )
findMove( *evt ); findMove( *evt );
} }
else if( evt->IsAction( &COMMON_ACTIONS::selectItem ) )
{
SelectItem( *evt );
}
else if( evt->IsAction( &COMMON_ACTIONS::unselectItem ) )
{
UnselectItem( *evt );
}
else if( evt->IsCancel() || evt->Action() == TA_UNDO_REDO || else if( evt->IsCancel() || evt->Action() == TA_UNDO_REDO ||
evt->IsAction( &COMMON_ACTIONS::selectionClear ) ) evt->IsAction( &COMMON_ACTIONS::selectionClear ) )
{ {
...@@ -221,11 +231,11 @@ void SELECTION_TOOL::toggleSelection( BOARD_ITEM* aItem ) ...@@ -221,11 +231,11 @@ void SELECTION_TOOL::toggleSelection( BOARD_ITEM* aItem )
{ {
if( aItem->IsSelected() ) if( aItem->IsSelected() )
{ {
deselect( aItem ); unselect( aItem );
// Inform other potentially interested tools // Inform other potentially interested tools
TOOL_EVENT deselectEvent( DeselectedEvent ); TOOL_EVENT unselectEvent( UnselectedEvent );
m_toolMgr->ProcessEvent( deselectEvent ); m_toolMgr->ProcessEvent( unselectEvent );
} }
else else
{ {
...@@ -245,7 +255,7 @@ void SELECTION_TOOL::toggleSelection( BOARD_ITEM* aItem ) ...@@ -245,7 +255,7 @@ void SELECTION_TOOL::toggleSelection( BOARD_ITEM* aItem )
} }
bool SELECTION_TOOL::selectSingle( const VECTOR2I& aWhere, bool aAllowDisambiguation ) bool SELECTION_TOOL::selectCursor( const VECTOR2I& aWhere, bool aAllowDisambiguation )
{ {
BOARD_ITEM* item; BOARD_ITEM* item;
GENERAL_COLLECTORS_GUIDE guide = m_frame->GetCollectorsGuide(); GENERAL_COLLECTORS_GUIDE guide = m_frame->GetCollectorsGuide();
...@@ -395,8 +405,10 @@ bool SELECTION_TOOL::selectMultiple() ...@@ -395,8 +405,10 @@ bool SELECTION_TOOL::selectMultiple()
void SELECTION_TOOL::setTransitions() void SELECTION_TOOL::setTransitions()
{ {
Go( &SELECTION_TOOL::Main, COMMON_ACTIONS::selectionActivate.MakeEvent() ); Go( &SELECTION_TOOL::Main, COMMON_ACTIONS::selectionActivate.MakeEvent() );
Go( &SELECTION_TOOL::SingleSelection, COMMON_ACTIONS::selectionSingle.MakeEvent() ); Go( &SELECTION_TOOL::CursorSelection, COMMON_ACTIONS::selectionCursor.MakeEvent() );
Go( &SELECTION_TOOL::ClearSelection, COMMON_ACTIONS::selectionClear.MakeEvent() ); Go( &SELECTION_TOOL::ClearSelection, COMMON_ACTIONS::selectionClear.MakeEvent() );
Go( &SELECTION_TOOL::SelectItem, COMMON_ACTIONS::selectItem.MakeEvent() );
Go( &SELECTION_TOOL::UnselectItem, COMMON_ACTIONS::unselectItem.MakeEvent() );
Go( &SELECTION_TOOL::find, COMMON_ACTIONS::find.MakeEvent() ); Go( &SELECTION_TOOL::find, COMMON_ACTIONS::find.MakeEvent() );
Go( &SELECTION_TOOL::findMove, COMMON_ACTIONS::findMove.MakeEvent() ); Go( &SELECTION_TOOL::findMove, COMMON_ACTIONS::findMove.MakeEvent() );
} }
...@@ -444,9 +456,9 @@ bool SELECTION_TOOL::CheckLock() ...@@ -444,9 +456,9 @@ bool SELECTION_TOOL::CheckLock()
} }
int SELECTION_TOOL::SingleSelection( TOOL_EVENT& aEvent ) int SELECTION_TOOL::CursorSelection( TOOL_EVENT& aEvent )
{ {
selectSingle( getView()->ToWorld( getViewControls()->GetMousePosition() ) ); selectCursor( getView()->ToWorld( getViewControls()->GetMousePosition() ) );
setTransitions(); setTransitions();
return 0; return 0;
...@@ -461,6 +473,43 @@ int SELECTION_TOOL::ClearSelection( TOOL_EVENT& aEvent ) ...@@ -461,6 +473,43 @@ int SELECTION_TOOL::ClearSelection( TOOL_EVENT& aEvent )
return 0; return 0;
} }
int SELECTION_TOOL::SelectItem( TOOL_EVENT& aEvent )
{
// Check if there is an item to be selected
BOARD_ITEM* item = static_cast<BOARD_ITEM*>( aEvent.Parameter() );
if( item )
{
select( item );
// Inform other potentially interested tools
TOOL_EVENT select( SelectedEvent );
m_toolMgr->ProcessEvent( select );
}
setTransitions();
return 0;
}
int SELECTION_TOOL::UnselectItem( TOOL_EVENT& aEvent )
{
// Check if there is an item to be selected
BOARD_ITEM* item = static_cast<BOARD_ITEM*>( aEvent.Parameter() );
if( item )
{
unselect( item );
// Inform other potentially interested tools
TOOL_EVENT unselect( UnselectedEvent );
m_toolMgr->ProcessEvent( unselect );
}
setTransitions();
return 0;
}
void SELECTION_TOOL::findCallback( BOARD_ITEM* aItem ) void SELECTION_TOOL::findCallback( BOARD_ITEM* aItem )
{ {
...@@ -525,8 +574,6 @@ void SELECTION_TOOL::clearSelection() ...@@ -525,8 +574,6 @@ void SELECTION_TOOL::clearSelection()
// Inform other potentially interested tools // Inform other potentially interested tools
TOOL_EVENT clearEvent( ClearedEvent ); TOOL_EVENT clearEvent( ClearedEvent );
m_toolMgr->ProcessEvent( clearEvent ); m_toolMgr->ProcessEvent( clearEvent );
return;
} }
...@@ -734,17 +781,17 @@ void SELECTION_TOOL::select( BOARD_ITEM* aItem ) ...@@ -734,17 +781,17 @@ void SELECTION_TOOL::select( BOARD_ITEM* aItem )
} }
void SELECTION_TOOL::deselect( BOARD_ITEM* aItem ) void SELECTION_TOOL::unselect( BOARD_ITEM* aItem )
{ {
// Modules are treated in a special way - when they are selected, we have to // Modules are treated in a special way - when they are selected, we have to
// deselect all the parts that make the module, not the module itself // unselect all the parts that make the module, not the module itself
if( aItem->Type() == PCB_MODULE_T ) if( aItem->Type() == PCB_MODULE_T )
{ {
MODULE* module = static_cast<MODULE*>( aItem ); MODULE* module = static_cast<MODULE*>( aItem );
module->RunOnChildren( boost::bind( &SELECTION_TOOL::deselectVisually, this, _1 ) ); module->RunOnChildren( boost::bind( &SELECTION_TOOL::unselectVisually, this, _1 ) );
} }
deselectVisually( aItem ); unselectVisually( aItem );
int itemIdx = m_selection.items.FindItem( aItem ); int itemIdx = m_selection.items.FindItem( aItem );
if( itemIdx >= 0 ) if( itemIdx >= 0 )
...@@ -757,8 +804,8 @@ void SELECTION_TOOL::deselect( BOARD_ITEM* aItem ) ...@@ -757,8 +804,8 @@ void SELECTION_TOOL::deselect( BOARD_ITEM* aItem )
} }
// Inform other potentially interested tools // Inform other potentially interested tools
TOOL_EVENT deselected( DeselectedEvent ); TOOL_EVENT unselected( UnselectedEvent );
m_toolMgr->ProcessEvent( deselected ); m_toolMgr->ProcessEvent( unselected );
} }
...@@ -772,7 +819,7 @@ void SELECTION_TOOL::selectVisually( BOARD_ITEM* aItem ) const ...@@ -772,7 +819,7 @@ void SELECTION_TOOL::selectVisually( BOARD_ITEM* aItem ) const
} }
void SELECTION_TOOL::deselectVisually( BOARD_ITEM* aItem ) const void SELECTION_TOOL::unselectVisually( BOARD_ITEM* aItem ) const
{ {
m_selection.group->Remove( aItem ); m_selection.group->Remove( aItem );
......
...@@ -151,24 +151,30 @@ public: ...@@ -151,24 +151,30 @@ public:
///> Checks if the user has agreed to modify locked items for the given selection. ///> Checks if the user has agreed to modify locked items for the given selection.
bool CheckLock(); bool CheckLock();
///> Select single item event handler. ///> Select a single item under cursor event handler.
int SingleSelection( TOOL_EVENT& aEvent ); int CursorSelection( TOOL_EVENT& aEvent );
///> Clear current selection event handler. ///> Clear current selection event handler.
int ClearSelection( TOOL_EVENT& aEvent ); int ClearSelection( TOOL_EVENT& aEvent );
///> Item selection event handler.
int SelectItem( TOOL_EVENT& aEvent );
///> Item unselection event handler.
int UnselectItem( TOOL_EVENT& aEvent );
///> Event sent after an item is selected. ///> Event sent after an item is selected.
const TOOL_EVENT SelectedEvent; const TOOL_EVENT SelectedEvent;
///> Event sent after an item is deselected. ///> Event sent after an item is unselected.
const TOOL_EVENT DeselectedEvent; const TOOL_EVENT UnselectedEvent;
///> Event sent after selection is cleared. ///> Event sent after selection is cleared.
const TOOL_EVENT ClearedEvent; const TOOL_EVENT ClearedEvent;
private: private:
/** /**
* Function selectSingle() * Function selectCursor()
* Selects an item pointed by the parameter aWhere. If there is more than one item at that * Selects an item pointed by the parameter aWhere. If there is more than one item at that
* place, there is a menu displayed that allows to choose the item. * place, there is a menu displayed that allows to choose the item.
* *
...@@ -177,7 +183,7 @@ private: ...@@ -177,7 +183,7 @@ private:
* a menu is shown, otherise function finishes without selecting anything. * a menu is shown, otherise function finishes without selecting anything.
* @return True if an item was selected, false otherwise. * @return True if an item was selected, false otherwise.
*/ */
bool selectSingle( const VECTOR2I& aWhere, bool aAllowDisambiguation = true ); bool selectCursor( const VECTOR2I& aWhere, bool aAllowDisambiguation = true );
/** /**
* Function selectMultiple() * Function selectMultiple()
...@@ -208,7 +214,7 @@ private: ...@@ -208,7 +214,7 @@ private:
/** /**
* Function disambiguationMenu() * Function disambiguationMenu()
* Handles the menu that allows to select one of many items in case there is more than one * Handles the menu that allows to select one of many items in case there is more than one
* item at the selected point (@see selectSingle()). * item at the selected point (@see selectCursor()).
* *
* @param aItems contains list of items that are displayed to the user. * @param aItems contains list of items that are displayed to the user.
*/ */
...@@ -247,26 +253,26 @@ private: ...@@ -247,26 +253,26 @@ private:
void select( BOARD_ITEM* aItem ); void select( BOARD_ITEM* aItem );
/** /**
* Function deselectItem() * Function unselectItem()
* Takes necessary action mark an item as deselected. * Takes necessary action mark an item as unselected.
* *
* @param aItem is an item to be deselected. * @param aItem is an item to be unselected.
*/ */
void deselect( BOARD_ITEM* aItem ); void unselect( BOARD_ITEM* aItem );
/** /**
* Function deselectVisually() * Function unselectVisually()
* Marks item as selected, but does not add it to the ITEMS_PICKED_LIST. * Marks item as selected, but does not add it to the ITEMS_PICKED_LIST.
* @param aItem is an item to be be marked. * @param aItem is an item to be be marked.
*/ */
void selectVisually( BOARD_ITEM* aItem ) const; void selectVisually( BOARD_ITEM* aItem ) const;
/** /**
* Function deselectVisually() * Function unselectVisually()
* Marks item as selected, but does not add it to the ITEMS_PICKED_LIST. * Marks item as selected, but does not add it to the ITEMS_PICKED_LIST.
* @param aItem is an item to be be marked. * @param aItem is an item to be be marked.
*/ */
void deselectVisually( BOARD_ITEM* aItem ) const; void unselectVisually( BOARD_ITEM* aItem ) const;
/** /**
* Function containsSelected() * Function containsSelected()
......
...@@ -26,8 +26,9 @@ net = kicad_netlist_reader.netlist(sys.argv[1]) ...@@ -26,8 +26,9 @@ net = kicad_netlist_reader.netlist(sys.argv[1])
try: try:
f = open(sys.argv[2], 'w') f = open(sys.argv[2], 'w')
except IOError: except IOError:
e = "Can't open output file for writing: " + sys.argv[2]
print(__file__, ":", e, file=sys.stderr) print(__file__, ":", e, file=sys.stderr)
f = stdout f = sys.stdout
# subset the components to those wanted in the BOM, controlled # subset the components to those wanted in the BOM, controlled
# by <configure> block in kicad_netlist_reader.py # by <configure> block in kicad_netlist_reader.py
......
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