Commit f930894d authored by jean-pierre charras's avatar jean-pierre charras

Common dialog file housekeeping. Code cleanup, and minor fixes.

parent 8257ebeb
include_directories(${CMAKE_CURRENT_SOURCE_DIR} include_directories(${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/dialogs
${Boost_INCLUDE_DIR} ${Boost_INCLUDE_DIR}
../3d-viewer ../3d-viewer
../pcbnew ../pcbnew
...@@ -9,6 +10,13 @@ set( COMMON_ABOUT_DLG_SRCS ...@@ -9,6 +10,13 @@ set( COMMON_ABOUT_DLG_SRCS
dialog_about/AboutDialog_main.cpp dialog_about/AboutDialog_main.cpp
dialog_about/dialog_about.cpp dialog_about/dialog_about.cpp
dialog_about/dialog_about_base.cpp dialog_about/dialog_about_base.cpp
dialogs/dialog_display_info_HTML_base.cpp
dialogs/dialog_get_component.cpp
dialogs/dialog_get_component_base.cpp
dialogs/dialog_hotkeys_editor.cpp
dialogs/dialog_hotkeys_editor_base.cpp
dialogs/dialog_load_error.cpp
dialogs/dialog_page_settings_base.cpp
) )
set(COMMON_SRCS set(COMMON_SRCS
...@@ -32,12 +40,7 @@ set(COMMON_SRCS ...@@ -32,12 +40,7 @@ set(COMMON_SRCS
common_plotDXF_functions.cpp common_plotDXF_functions.cpp
confirm.cpp confirm.cpp
copy_to_clipboard.cpp copy_to_clipboard.cpp
dialog_display_info_HTML_base.cpp
dialog_hotkeys_editor.cpp
dialog_hotkeys_editor_base.cpp
dialog_load_error.cpp
dcsvg.cpp dcsvg.cpp
dialog_page_settings_base.cpp
displlst.cpp displlst.cpp
dlist.cpp dlist.cpp
drawframe.cpp drawframe.cpp
...@@ -48,7 +51,6 @@ set(COMMON_SRCS ...@@ -48,7 +51,6 @@ set(COMMON_SRCS
eda_dde.cpp eda_dde.cpp
eda_doc.cpp eda_doc.cpp
gestfich.cpp gestfich.cpp
get_component_dialog.cpp
gr_basic.cpp gr_basic.cpp
hotkeys_basic.cpp hotkeys_basic.cpp
hotkey_grid_table.cpp hotkey_grid_table.cpp
......
/*********************************/ /*********************************/
/* get_component_dialog.cpp */ /* dialog_get_component.cpp */
/*********************************/ /*********************************/
#include "fctsys.h" #include "fctsys.h"
#include "gr_basic.h" //#include "gr_basic.h"
#include "common.h" #include "common.h"
#include "macros.h" #include "macros.h"
#include "wxstruct.h" #include "wxstruct.h"
#include "get_component_dialog.h" #include "dialog_get_component.h"
/****************************************************************************/ /****************************************************************************/
...@@ -18,120 +18,62 @@ ...@@ -18,120 +18,62 @@
static unsigned s_HistoryMaxCount = 8; // Max number of items displayed in history list static unsigned s_HistoryMaxCount = 8; // Max number of items displayed in history list
BEGIN_EVENT_TABLE( WinEDA_SelectCmp, wxDialog )
EVT_BUTTON( ID_ACCEPT_NAME, WinEDA_SelectCmp::Accept )
EVT_BUTTON( ID_ACCEPT_KEYWORD, WinEDA_SelectCmp::Accept )
EVT_BUTTON( wxID_CANCEL, WinEDA_SelectCmp::Accept )
EVT_BUTTON( ID_LIST_ALL, WinEDA_SelectCmp::Accept )
EVT_BUTTON( ID_EXTRA_TOOL, WinEDA_SelectCmp::GetExtraSelection )
EVT_LISTBOX( ID_SEL_BY_LISTBOX, WinEDA_SelectCmp::Accept )
END_EVENT_TABLE()
/* /*
* Dialog frame to choose a component or a footprint * Dialog frame to choose a component or a footprint
* This dialog shows an history of last selected items * This dialog shows an history of last selected items
*/ */
WinEDA_SelectCmp::WinEDA_SelectCmp( WinEDA_DrawFrame* parent, DIALOG_GET_COMPONENT::DIALOG_GET_COMPONENT( WinEDA_DrawFrame* parent,
const wxPoint& framepos, const wxPoint& framepos,
wxArrayString& HistoryList, wxArrayString& HistoryList,
const wxString& Title, const wxString& Title,
bool show_extra_tool ) : bool show_extra_tool ) :
wxDialog( parent, -1, Title, framepos, wxDefaultSize, DIALOG_STYLE ) DIALOG_GET_COMPONENT_BASE( parent, -1, Title, framepos )
{ {
m_AuxTool = show_extra_tool;
InitDialog( HistoryList ); #ifdef __WXMAC__
m_auxToolSelector = false;
#else
m_auxToolSelector = show_extra_tool;
#endif
initDialog( HistoryList );
GetSizer()->Fit( this ); GetSizer()->Fit( this );
GetSizer()->SetSizeHints( this ); GetSizer()->SetSizeHints( this );
} }
void WinEDA_SelectCmp::InitDialog( wxArrayString& aHistoryList ) void DIALOG_GET_COMPONENT::initDialog( wxArrayString& aHistoryList )
{ {
SetFocus();
wxButton* Button;
wxStaticText* Text;
m_GetExtraFunction = false; m_GetExtraFunction = false;
m_historyList->Append( aHistoryList );
wxBoxSizer* MainBoxSizer = new wxBoxSizer( wxHORIZONTAL ); if( !m_auxToolSelector )
SetSizer( MainBoxSizer );
wxBoxSizer* LeftBoxSizer = new wxBoxSizer( wxVERTICAL );
MainBoxSizer->Add( LeftBoxSizer,
0,
wxALIGN_CENTER_HORIZONTAL | wxALL | wxADJUST_MINSIZE,
5 );
wxBoxSizer* RightBoxSizer = new wxBoxSizer( wxVERTICAL );
MainBoxSizer->Add( RightBoxSizer, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 5 );
Text = new wxStaticText( this, -1, _( "Name:" ) );
LeftBoxSizer->Add( Text, 0, wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP, 5 );
m_TextCtrl = new wxTextCtrl( this, wxID_ANY );
m_TextCtrl->SetFocus(); // text value will be initialized later by calling GetComponentName()
LeftBoxSizer->Add( m_TextCtrl,
0,
wxGROW | wxLEFT | wxRIGHT | wxBOTTOM | wxADJUST_MINSIZE,
5 );
Text = new wxStaticText( this, -1, _( "History list:" ) );
LeftBoxSizer->Add( Text, 0, wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP, 5 );
m_List = new wxListBox( this, ID_SEL_BY_LISTBOX, wxDefaultPosition,
wxSize( 220, -1 ), aHistoryList, wxLB_SINGLE );
LeftBoxSizer->Add( m_List,
0,
wxGROW | wxLEFT | wxRIGHT | wxBOTTOM | wxADJUST_MINSIZE,
5 );
Button = new wxButton( this, ID_ACCEPT_NAME, _( "OK" ) );
Button->SetDefault();
RightBoxSizer->Add( Button,
0,
wxGROW | wxLEFT | wxRIGHT | wxTOP | wxBOTTOM,
5 );
Button = new wxButton( this, ID_ACCEPT_KEYWORD, _( "Search by Keyword" ) );
RightBoxSizer->Add( Button, 0, wxGROW | wxLEFT | wxRIGHT | wxBOTTOM, 5 );
Button = new wxButton( this, wxID_CANCEL, _( "Cancel" ) );
RightBoxSizer->Add( Button, 0, wxGROW | wxLEFT | wxRIGHT | wxBOTTOM, 5 );
Button = new wxButton( this, ID_LIST_ALL, _( "List All" ) );
RightBoxSizer->Add( Button, 0, wxGROW | wxLEFT | wxRIGHT | wxBOTTOM, 5 );
#ifndef __WXMAC__
if( m_AuxTool ) /* The selection can be done by an extra function */
{ {
Button = new wxButton( this, ID_EXTRA_TOOL, _( "Select by Browser" ) ); m_buttonBrowse->Show( false );
RightBoxSizer->Add( Button, 0, wxGROW | wxLEFT | wxRIGHT | wxBOTTOM, 5 ); m_buttonBrowse->Enable( false );
} }
#endif
} }
void WinEDA_SelectCmp::Accept( wxCommandEvent& event ) void DIALOG_GET_COMPONENT::OnCancel( wxCommandEvent& event )
{ {
int id = wxID_OK; m_Text = wxEmptyString;
EndModal( wxID_CANCEL );
}
void DIALOG_GET_COMPONENT::Accept( wxCommandEvent& event )
{
switch( event.GetId() ) switch( event.GetId() )
{ {
case ID_SEL_BY_LISTBOX: case ID_SEL_BY_LISTBOX:
m_Text = m_List->GetStringSelection(); m_Text = m_historyList->GetStringSelection();
break; break;
case ID_ACCEPT_NAME: case wxID_OK:
m_Text = m_TextCtrl->GetValue(); m_Text = m_textCmpNameCtrl->GetValue();
break; break;
case ID_ACCEPT_KEYWORD: case ID_ACCEPT_KEYWORD:
m_Text = wxT( "= " ) + m_TextCtrl->GetValue(); m_Text = wxT( "= " ) + m_textCmpNameCtrl->GetValue();
break;
case wxID_CANCEL:
m_Text = wxEmptyString;
id = wxID_CANCEL;
break; break;
case ID_LIST_ALL: case ID_LIST_ALL:
...@@ -142,27 +84,20 @@ void WinEDA_SelectCmp::Accept( wxCommandEvent& event ) ...@@ -142,27 +84,20 @@ void WinEDA_SelectCmp::Accept( wxCommandEvent& event )
m_Text.Trim( false ); // Remove blanks at beginning m_Text.Trim( false ); // Remove blanks at beginning
m_Text.Trim( true ); // Remove blanks at end m_Text.Trim( true ); // Remove blanks at end
if( IsModal() ) EndModal( wxID_OK );
EndModal( id );
else
Close( id );
} }
/* Get the component name by the extra function */ /* Get the component name by the extra function */
void WinEDA_SelectCmp::GetExtraSelection( wxCommandEvent& event ) void DIALOG_GET_COMPONENT::GetExtraSelection( wxCommandEvent& event )
{ {
m_GetExtraFunction = true; m_GetExtraFunction = true;
if( IsModal() )
EndModal( wxID_OK ); EndModal( wxID_OK );
else
Close( wxID_OK );
} }
// Return the component name selected by the dialog // Return the component name selected by the dialog
wxString WinEDA_SelectCmp::GetComponentName( void ) wxString DIALOG_GET_COMPONENT::GetComponentName( void )
{ {
return m_Text; return m_Text;
} }
...@@ -170,12 +105,12 @@ wxString WinEDA_SelectCmp::GetComponentName( void ) ...@@ -170,12 +105,12 @@ wxString WinEDA_SelectCmp::GetComponentName( void )
/* Initialize the default component name default choice /* Initialize the default component name default choice
*/ */
void WinEDA_SelectCmp::SetComponentName( const wxString& name ) void DIALOG_GET_COMPONENT::SetComponentName( const wxString& name )
{ {
if( m_TextCtrl ) if( m_textCmpNameCtrl )
{ {
m_TextCtrl->SetValue( name ); m_textCmpNameCtrl->SetValue( name );
m_TextCtrl->SetSelection(-1, -1); m_textCmpNameCtrl->SetSelection(-1, -1);
} }
} }
...@@ -206,37 +141,27 @@ wxPoint GetComponentDialogPosition( void ) ...@@ -206,37 +141,27 @@ wxPoint GetComponentDialogPosition( void )
/* /*
* Add the string "Name" to the history list HistoryList * Add the string "aName" to the history list aHistoryList
*/ */
void AddHistoryComponentName( wxArrayString& HistoryList, const wxString& Name ) void AddHistoryComponentName( wxArrayString& aHistoryList, const wxString& aName )
{ {
int ii, c_max; if( ( aHistoryList.GetCount() > 0 ) && ( aName == aHistoryList[0] ) )
if( HistoryList.GetCount() > 0 )
{
if( Name == HistoryList[0] )
return; return;
/* remove an old identical selection if exists */ /* remove an old identical name if exists */
for( ii = 1; (unsigned) ii < HistoryList.GetCount(); ii++ ) for( unsigned ii = 1; ii < aHistoryList.GetCount(); ii++ )
{ {
if( Name == HistoryList[ii] ) if( aName == aHistoryList[ii] )
{ {
HistoryList.RemoveAt( ii ); ii--; aHistoryList.RemoveAt( ii );
ii--;
} }
} }
/* shift the list */ // Add the new name at the beginning of the history list
if( HistoryList.GetCount() < s_HistoryMaxCount ) aHistoryList.Insert(aName, 0);
HistoryList.Add( wxT( "" ) );
c_max = HistoryList.GetCount() - 2; // Remove extra names
for( ii = c_max; ii >= 0; ii-- ) while( aHistoryList.GetCount() >= s_HistoryMaxCount )
HistoryList[ii + 1] = HistoryList[ii]; aHistoryList.RemoveAt( aHistoryList.GetCount()-1 );
/* Add the new name at the beginning of the history list */
HistoryList[0] = Name;
}
else
HistoryList.Add( Name );
} }
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Sep 8 2010)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "dialog_get_component_base.h"
///////////////////////////////////////////////////////////////////////////
DIALOG_GET_COMPONENT_BASE::DIALOG_GET_COMPONENT_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
wxBoxSizer* bSizerMain;
bSizerMain = new wxBoxSizer( wxHORIZONTAL );
wxBoxSizer* bSizerLeft;
bSizerLeft = new wxBoxSizer( wxVERTICAL );
m_staticTextName = new wxStaticText( this, wxID_ANY, _("Name:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextName->Wrap( -1 );
bSizerLeft->Add( m_staticTextName, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_textCmpNameCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
bSizerLeft->Add( m_textCmpNameCtrl, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_staticTextHistory = new wxStaticText( this, wxID_ANY, _("History list:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextHistory->Wrap( -1 );
bSizerLeft->Add( m_staticTextHistory, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_historyList = new wxListBox( this, ID_SEL_BY_LISTBOX, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 );
m_historyList->SetMinSize( wxSize( 200,100 ) );
bSizerLeft->Add( m_historyList, 1, wxALL|wxEXPAND, 5 );
bSizerMain->Add( bSizerLeft, 1, wxEXPAND, 5 );
wxBoxSizer* bSizerRight;
bSizerRight = new wxBoxSizer( wxVERTICAL );
m_buttonOK = new wxButton( this, wxID_OK, _("OK"), wxDefaultPosition, wxDefaultSize, 0 );
m_buttonOK->SetDefault();
bSizerRight->Add( m_buttonOK, 0, wxALL|wxEXPAND, 5 );
m_buttonKW = new wxButton( this, ID_ACCEPT_KEYWORD, _("Search by Keyword"), wxDefaultPosition, wxDefaultSize, 0 );
bSizerRight->Add( m_buttonKW, 0, wxALL|wxEXPAND, 5 );
m_buttonCancel = new wxButton( this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
bSizerRight->Add( m_buttonCancel, 0, wxALL|wxEXPAND, 5 );
m_buttonList = new wxButton( this, ID_LIST_ALL, _("List All"), wxDefaultPosition, wxDefaultSize, 0 );
bSizerRight->Add( m_buttonList, 0, wxALL|wxEXPAND, 5 );
m_buttonBrowse = new wxButton( this, ID_EXTRA_TOOL, _("Select by Browser"), wxDefaultPosition, wxDefaultSize, 0 );
bSizerRight->Add( m_buttonBrowse, 0, wxALL|wxEXPAND, 5 );
bSizerMain->Add( bSizerRight, 0, wxALIGN_CENTER_VERTICAL, 5 );
this->SetSizer( bSizerMain );
this->Layout();
this->Centre( wxBOTH );
// Connect Events
m_historyList->Connect( wxEVT_COMMAND_LISTBOX_SELECTED, wxCommandEventHandler( DIALOG_GET_COMPONENT_BASE::Accept ), NULL, this );
m_buttonOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GET_COMPONENT_BASE::Accept ), NULL, this );
m_buttonKW->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GET_COMPONENT_BASE::Accept ), NULL, this );
m_buttonCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GET_COMPONENT_BASE::OnCancel ), NULL, this );
m_buttonList->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GET_COMPONENT_BASE::Accept ), NULL, this );
m_buttonBrowse->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GET_COMPONENT_BASE::GetExtraSelection ), NULL, this );
}
DIALOG_GET_COMPONENT_BASE::~DIALOG_GET_COMPONENT_BASE()
{
// Disconnect Events
m_historyList->Disconnect( wxEVT_COMMAND_LISTBOX_SELECTED, wxCommandEventHandler( DIALOG_GET_COMPONENT_BASE::Accept ), NULL, this );
m_buttonOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GET_COMPONENT_BASE::Accept ), NULL, this );
m_buttonKW->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GET_COMPONENT_BASE::Accept ), NULL, this );
m_buttonCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GET_COMPONENT_BASE::OnCancel ), NULL, this );
m_buttonList->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GET_COMPONENT_BASE::Accept ), NULL, this );
m_buttonBrowse->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GET_COMPONENT_BASE::GetExtraSelection ), NULL, this );
}
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<wxFormBuilder_Project>
<FileVersion major="1" minor="10" />
<object class="Project" expanded="1">
<property name="class_decoration"></property>
<property name="code_generation">C++</property>
<property name="disconnect_events">1</property>
<property name="disconnect_mode">source_name</property>
<property name="disconnect_python_events">0</property>
<property name="encoding">UTF-8</property>
<property name="event_generation">connect</property>
<property name="file">dialog_get_component_base</property>
<property name="first_id">1000</property>
<property name="help_provider">none</property>
<property name="internationalize">1</property>
<property name="name">dialog_get_component_base</property>
<property name="namespace"></property>
<property name="path">.</property>
<property name="precompiled_header"></property>
<property name="relative_path">1</property>
<property name="skip_python_events">1</property>
<property name="use_enum">0</property>
<property name="use_microsoft_bom">0</property>
<object class="Dialog" expanded="1">
<property name="bg"></property>
<property name="center">wxBOTH</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="enabled">1</property>
<property name="event_handler">impl_virtual</property>
<property name="extra_style"></property>
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="name">DIALOG_GET_COMPONENT_BASE</property>
<property name="pos"></property>
<property name="size">375,210</property>
<property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>
<property name="subclass"></property>
<property name="title"></property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnActivate"></event>
<event name="OnActivateApp"></event>
<event name="OnChar"></event>
<event name="OnClose"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnHibernate"></event>
<event name="OnIconize"></event>
<event name="OnIdle"></event>
<event name="OnInitDialog"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizerMain</property>
<property name="orient">wxHORIZONTAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizerLeft</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxTOP|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="bg"></property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Name:</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="name">m_staticTextName</property>
<property name="permission">protected</property>
<property name="pos"></property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxTextCtrl" expanded="1">
<property name="bg"></property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="maximum_size"></property>
<property name="maxlength">0</property>
<property name="minimum_size"></property>
<property name="name">m_textCmpNameCtrl</property>
<property name="permission">protected</property>
<property name="pos"></property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="value"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnText"></event>
<event name="OnTextEnter"></event>
<event name="OnTextMaxLen"></event>
<event name="OnTextURL"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxTOP|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="bg"></property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">History list:</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="name">m_staticTextHistory</property>
<property name="permission">protected</property>
<property name="pos"></property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxListBox" expanded="1">
<property name="bg"></property>
<property name="choices"></property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">ID_SEL_BY_LISTBOX</property>
<property name="maximum_size"></property>
<property name="minimum_size">200,100</property>
<property name="name">m_historyList</property>
<property name="permission">protected</property>
<property name="pos"></property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnListBox">Accept</event>
<event name="OnListBoxDClick"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL</property>
<property name="proportion">0</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizerRight</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxButton" expanded="1">
<property name="bg"></property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default">1</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_OK</property>
<property name="label">OK</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="name">m_buttonOK</property>
<property name="permission">protected</property>
<property name="pos"></property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">Accept</event>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxButton" expanded="1">
<property name="bg"></property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">ID_ACCEPT_KEYWORD</property>
<property name="label">Search by Keyword</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="name">m_buttonKW</property>
<property name="permission">protected</property>
<property name="pos"></property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">Accept</event>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxButton" expanded="1">
<property name="bg"></property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_CANCEL</property>
<property name="label">Cancel</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="name">m_buttonCancel</property>
<property name="permission">protected</property>
<property name="pos"></property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">OnCancel</event>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxButton" expanded="1">
<property name="bg"></property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">ID_LIST_ALL</property>
<property name="label">List All</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="name">m_buttonList</property>
<property name="permission">protected</property>
<property name="pos"></property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">Accept</event>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxButton" expanded="1">
<property name="bg"></property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">ID_EXTRA_TOOL</property>
<property name="label">Select by Browser</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="name">m_buttonBrowse</property>
<property name="permission">protected</property>
<property name="pos"></property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">GetExtraSelection</event>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
</object>
</object>
</object>
</object>
</object>
</wxFormBuilder_Project>
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Sep 8 2010)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __dialog_get_component_base__
#define __dialog_get_component_base__
#include <wx/intl.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/listbox.h>
#include <wx/sizer.h>
#include <wx/button.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
#define ID_SEL_BY_LISTBOX 1000
#define ID_ACCEPT_KEYWORD 1001
#define ID_LIST_ALL 1002
#define ID_EXTRA_TOOL 1003
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_GET_COMPONENT_BASE
///////////////////////////////////////////////////////////////////////////////
class DIALOG_GET_COMPONENT_BASE : public wxDialog
{
private:
protected:
wxStaticText* m_staticTextName;
wxTextCtrl* m_textCmpNameCtrl;
wxStaticText* m_staticTextHistory;
wxListBox* m_historyList;
wxButton* m_buttonOK;
wxButton* m_buttonKW;
wxButton* m_buttonCancel;
wxButton* m_buttonList;
wxButton* m_buttonBrowse;
// Virtual event handlers, overide them in your derived class
virtual void Accept( wxCommandEvent& event ) { event.Skip(); }
virtual void OnCancel( wxCommandEvent& event ) { event.Skip(); }
virtual void GetExtraSelection( wxCommandEvent& event ) { event.Skip(); }
public:
DIALOG_GET_COMPONENT_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 375,210 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_GET_COMPONENT_BASE();
};
#endif //__dialog_get_component_base__
...@@ -140,7 +140,7 @@ set(EESCHEMA_SRCS ...@@ -140,7 +140,7 @@ set(EESCHEMA_SRCS
viewlibs.cpp) viewlibs.cpp)
set(EESCHEMA_EXTRA_SRCS set(EESCHEMA_EXTRA_SRCS
../common/dialog_page_settings.cpp ../common/dialogs/dialog_page_settings.cpp
../common/sch_item_struct.cpp ../common/sch_item_struct.cpp
) )
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
#include "sch_component.h" #include "sch_component.h"
#include "viewlib_frame.h" #include "viewlib_frame.h"
#include "get_component_dialog.h" #include "dialog_get_component.h"
#include <boost/foreach.hpp> #include <boost/foreach.hpp>
...@@ -51,7 +51,7 @@ wxString WinEDA_SchematicFrame::SelectFromLibBrowser( void ) ...@@ -51,7 +51,7 @@ wxString WinEDA_SchematicFrame::SelectFromLibBrowser( void )
wxMilliSleep( 50 ); wxMilliSleep( 50 );
} }
return m_ViewlibFrame->GetEntryName(); return m_ViewlibFrame->GetSelectedComponent();
} }
...@@ -97,7 +97,7 @@ SCH_COMPONENT* WinEDA_SchematicFrame::Load_Component( wxDC* DC, ...@@ -97,7 +97,7 @@ SCH_COMPONENT* WinEDA_SchematicFrame::Load_Component( wxDC* DC,
/* Ask for a component name or key words */ /* Ask for a component name or key words */
msg.Printf( _( "component selection (%d items loaded):" ), CmpCount ); msg.Printf( _( "component selection (%d items loaded):" ), CmpCount );
WinEDA_SelectCmp dlg( this, GetComponentDialogPosition(), HistoryList, DIALOG_GET_COMPONENT dlg( this, GetComponentDialogPosition(), HistoryList,
msg, UseLibBrowser ); msg, UseLibBrowser );
dlg.SetComponentName( lastCommponentName ); dlg.SetComponentName( lastCommponentName );
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
#include "general.h" #include "general.h"
#include "protos.h" #include "protos.h"
#include "dialog_display_info_HTML_base.h" #include "../common/dialogs/dialog_display_info_HTML_base.h"
#include "dialog_lib_edit_pin.h" #include "dialog_lib_edit_pin.h"
......
...@@ -24,6 +24,8 @@ ...@@ -24,6 +24,8 @@
*/ */
wxString WinEDA_ViewlibFrame::m_libraryName; wxString WinEDA_ViewlibFrame::m_libraryName;
wxString WinEDA_ViewlibFrame::m_entryName; wxString WinEDA_ViewlibFrame::m_entryName;
wxString WinEDA_ViewlibFrame::m_exportToEeschemaCmpName; // When the viewer is used to select a component
// in schematic, the selected component is here
int WinEDA_ViewlibFrame::m_unit = 1; int WinEDA_ViewlibFrame::m_unit = 1;
int WinEDA_ViewlibFrame::m_convert = 1; int WinEDA_ViewlibFrame::m_convert = 1;
wxSize WinEDA_ViewlibFrame::m_clientSize = wxSize( -1, -1 ); wxSize WinEDA_ViewlibFrame::m_clientSize = wxSize( -1, -1 );
...@@ -150,6 +152,8 @@ WinEDA_ViewlibFrame::WinEDA_ViewlibFrame( wxWindow* father, ...@@ -150,6 +152,8 @@ WinEDA_ViewlibFrame::WinEDA_ViewlibFrame( wxWindow* father,
m_LibListSize.x = 0; m_LibListSize.x = 0;
} }
m_exportToEeschemaCmpName.Clear();
// Creates the component window display // Creates the component window display
m_CmpListSize.y = size.y; m_CmpListSize.y = size.y;
win_pos.x = m_LibListSize.x; win_pos.x = m_LibListSize.x;
...@@ -486,9 +490,9 @@ void WinEDA_ViewlibFrame::ExportToSchematicLibraryPart( wxCommandEvent& event ) ...@@ -486,9 +490,9 @@ void WinEDA_ViewlibFrame::ExportToSchematicLibraryPart( wxCommandEvent& event )
int ii = m_CmpList->GetSelection(); int ii = m_CmpList->GetSelection();
if( ii >= 0 ) if( ii >= 0 )
m_entryName = m_CmpList->GetString( ii ); m_exportToEeschemaCmpName = m_CmpList->GetString( ii );
else else
m_entryName.Empty(); m_exportToEeschemaCmpName.Empty();
Close( TRUE ); Close( TRUE );
} }
...@@ -552,6 +556,10 @@ void WinEDA_ViewlibFrame::OnActivate( wxActivateEvent& event ) ...@@ -552,6 +556,10 @@ void WinEDA_ViewlibFrame::OnActivate( wxActivateEvent& event )
{ {
WinEDA_DrawFrame::OnActivate( event ); WinEDA_DrawFrame::OnActivate( event );
// Ensure we do not have old selection:
if( m_FrameIsActive )
m_exportToEeschemaCmpName.Empty();
if( m_LibList ) if( m_LibList )
ReCreateListLib(); ReCreateListLib();
DisplayLibInfos(); DisplayLibInfos();
......
...@@ -40,6 +40,8 @@ private: ...@@ -40,6 +40,8 @@ private:
protected: protected:
static wxString m_libraryName; static wxString m_libraryName;
static wxString m_entryName; static wxString m_entryName;
static wxString m_exportToEeschemaCmpName; // When the viewer is used to select a component
// in schematic, the selected component is here
static int m_unit; static int m_unit;
static int m_convert; static int m_convert;
static wxSize m_clientSize; static wxSize m_clientSize;
...@@ -75,6 +77,7 @@ public: ...@@ -75,6 +77,7 @@ public:
void SaveSettings(); void SaveSettings();
wxString& GetEntryName( void ) const { return m_entryName; } wxString& GetEntryName( void ) const { return m_entryName; }
wxString& GetSelectedComponent( void ) const { return m_exportToEeschemaCmpName; }
int GetUnit( void ) { return m_unit; } int GetUnit( void ) { return m_unit; }
int GetConvert( void ) { return m_convert; } int GetConvert( void ) { return m_convert; }
......
/** /**
* This file is part of the common libary. * This file is part of the common libary.
* @file get_component_dialog.h * @file dialog_get_component.h
* @see common.h
*/ */
#ifndef __INCLUDE__GET_COMPONENT_DIALOG_H__ #ifndef __INCLUDE_DIALOG_GET_COMPONENT_H__
#define __INCLUDE__GET_COMPONENT_DIALOG_H__ 1 #define __INCLUDE_DIALOG_GET_COMPONENT_H__
#include "../common/dialogs/dialog_get_component_base.h"
wxPoint GetComponentDialogPosition( void ); wxPoint GetComponentDialogPosition( void );
void AddHistoryComponentName( wxArrayString& HistoryList, void AddHistoryComponentName( wxArrayString& HistoryList,
const wxString& Name ); const wxString& Name );
/* Add the string "Name" to the history list */
enum selcmp_id {
ID_ACCEPT_NAME = 3900,
ID_ACCEPT_KEYWORD,
ID_LIST_ALL,
ID_EXTRA_TOOL,
ID_SEL_BY_LISTBOX
};
/* Dialog frame to choose a component name */ /* Dialog frame to choose a component name */
class WinEDA_SelectCmp : public wxDialog class DIALOG_GET_COMPONENT : public DIALOG_GET_COMPONENT_BASE
{ {
private: private:
bool m_AuxTool; bool m_auxToolSelector;
wxString m_Text; wxString m_Text;
wxTextCtrl* m_TextCtrl;
wxListBox* m_List;
public: public:
bool m_GetExtraFunction; bool m_GetExtraFunction;
public: public:
// Constructor and destructor // Constructor and destructor
WinEDA_SelectCmp( WinEDA_DrawFrame* parent, const wxPoint& framepos, DIALOG_GET_COMPONENT( WinEDA_DrawFrame* parent, const wxPoint& framepos,
wxArrayString& HistoryList, const wxString& Title, wxArrayString& HistoryList, const wxString& Title,
bool show_extra_tool ); bool show_extra_tool );
~WinEDA_SelectCmp() {}; ~DIALOG_GET_COMPONENT() {};
wxString GetComponentName( void ); wxString GetComponentName( void );
void SetComponentName( const wxString& name ); void SetComponentName( const wxString& name );
private: private:
void InitDialog( wxArrayString& aHistoryList ); void initDialog( wxArrayString& aHistoryList );
void OnCancel( wxCommandEvent& event );
void Accept( wxCommandEvent& event ); void Accept( wxCommandEvent& event );
void GetExtraSelection( wxCommandEvent& event ); void GetExtraSelection( wxCommandEvent& event );
DECLARE_EVENT_TABLE()
}; };
#endif /* __INCLUDE__GET_COMPONENT_DIALOG_H__ */ #endif /* __INCLUDE_DIALOG_GET_COMPONENT_H__ */
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
#include "hotkeys_basic.h" #include "hotkeys_basic.h"
#include "hotkey_grid_table.h" #include "hotkey_grid_table.h"
#include "wxstruct.h" #include "wxstruct.h"
#include "dialog_hotkeys_editor_base.h" #include "../common/dialogs/dialog_hotkeys_editor_base.h"
class HOTKEYS_EDITOR_DIALOG : public HOTKEYS_EDITOR_DIALOG_BASE class HOTKEYS_EDITOR_DIALOG : public HOTKEYS_EDITOR_DIALOG_BASE
{ {
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
Subclass of DIALOG_DISPLAY_HTML_TEXT_BASE, which is generated by wxFormBuilder. Subclass of DIALOG_DISPLAY_HTML_TEXT_BASE, which is generated by wxFormBuilder.
*/ */
#include "dialog_display_info_HTML_base.h" #include "../common/dialogs/dialog_display_info_HTML_base.h"
/** Implementing DIALOG_LOAD_ERROR */ /** Implementing DIALOG_LOAD_ERROR */
class DIALOG_LOAD_ERROR : public DIALOG_DISPLAY_HTML_TEXT_BASE class DIALOG_LOAD_ERROR : public DIALOG_DISPLAY_HTML_TEXT_BASE
......
...@@ -190,7 +190,7 @@ set(PCBNEW_SRCS ...@@ -190,7 +190,7 @@ set(PCBNEW_SRCS
# We need some extra sources from common # We need some extra sources from common
### ###
set(PCBNEW_EXTRA_SRCS set(PCBNEW_EXTRA_SRCS
../common/dialog_page_settings.cpp ../common/dialogs/dialog_page_settings.cpp
) )
### ###
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
#include "gestfich.h" #include "gestfich.h"
#include "pcbnew.h" #include "pcbnew.h"
#include "wxPcbStruct.h" #include "wxPcbStruct.h"
#include "../common/dialog_display_info_HTML_base.h" #include "../common/dialogs/dialog_display_info_HTML_base.h"
#include "dialog_freeroute_exchange.h" #include "dialog_freeroute_exchange.h"
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
#include "eda_doc.h" #include "eda_doc.h"
#include "kicad_string.h" #include "kicad_string.h"
#include "gestfich.h" #include "gestfich.h"
#include "get_component_dialog.h" #include "dialog_get_component.h"
#include "appl_wxstruct.h" #include "appl_wxstruct.h"
#include "pcbnew.h" #include "pcbnew.h"
...@@ -24,12 +24,12 @@ public: ...@@ -24,12 +24,12 @@ public:
ModList* Next; ModList* Next;
wxString m_Name, m_Doc, m_KeyWord; wxString m_Name, m_Doc, m_KeyWord;
public: ModList() public:
ModList()
{ {
Next = NULL; Next = NULL;
} }
~ModList() ~ModList()
{ {
} }
...@@ -104,7 +104,7 @@ MODULE* WinEDA_BasePcbFrame::Load_Module_From_Library( const wxString& library, ...@@ -104,7 +104,7 @@ MODULE* WinEDA_BasePcbFrame::Load_Module_From_Library( const wxString& library,
bool AllowWildSeach = TRUE; bool AllowWildSeach = TRUE;
/* Ask for a component name or key words */ /* Ask for a component name or key words */
WinEDA_SelectCmp dlg( this, GetComponentDialogPosition(), HistoryList, DIALOG_GET_COMPONENT dlg( this, GetComponentDialogPosition(), HistoryList,
_( "Place Module" ), false ); _( "Place Module" ), false );
dlg.SetComponentName( lastCommponentName ); dlg.SetComponentName( lastCommponentName );
......
...@@ -352,8 +352,9 @@ void WinEDA_ModuleEditFrame::SetToolbars() ...@@ -352,8 +352,9 @@ void WinEDA_ModuleEditFrame::SetToolbars()
GetScreen()->GetRedoCommandCount()>0 && active ); GetScreen()->GetRedoCommandCount()>0 && active );
menuBar->Enable( wxID_REDO, GetScreen()->GetRedoCommandCount()>0 && active ); menuBar->Enable( wxID_REDO, GetScreen()->GetRedoCommandCount()>0 && active );
m_HToolBar->EnableTool( ID_MODEDIT_LOAD_MODULE_FROM_BOARD, GetBoard()->m_Modules != NULL ); bool canLoadModuleFromBoard = frame->GetBoard()->m_Modules != NULL;
menuBar->Enable( ID_MODEDIT_LOAD_MODULE_FROM_BOARD, GetBoard()->m_Modules != NULL ); m_HToolBar->EnableTool( ID_MODEDIT_LOAD_MODULE_FROM_BOARD, canLoadModuleFromBoard );
menuBar->Enable( ID_MODEDIT_LOAD_MODULE_FROM_BOARD, canLoadModuleFromBoard );
m_HToolBar->Refresh(); m_HToolBar->Refresh();
......
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