2013-05-08 20:47:23 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2013-12-03 08:50:58 +00:00
|
|
|
* Copyright (C) 2007 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
|
|
|
* Copyright (C) 2013 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
2013-05-08 20:47:23 +00:00
|
|
|
* Copyright (C) 1992-2013 KiCad Developers, see AUTHORS.txt for contributors.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, you may find one here:
|
|
|
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
|
|
* or you may search the http://www.gnu.org website for the version 2 license,
|
|
|
|
* or you may write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
2011-11-08 16:37:25 +00:00
|
|
|
/**
|
|
|
|
* @file displlst.cpp
|
|
|
|
*/
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <fctsys.h>
|
2013-11-17 06:04:20 +00:00
|
|
|
#include <macros.h>
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
#include <draw_frame.h>
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <kicad_string.h>
|
|
|
|
#include <dialog_helpers.h>
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2018-02-05 20:55:00 +00:00
|
|
|
|
|
|
|
// wxWidgets spends *far* too long calcuating column widths (most of it, believe it or
|
|
|
|
// not, in repeatedly creating/destorying a wxDC to do the measurement in).
|
|
|
|
// Use default column widths instead. (Note that these will be scaled down proportionally
|
|
|
|
// to fit the available space when the dialog is instantiated.)
|
|
|
|
static int DEFAULT_COL_WIDTHS[] = { 400, 200 };
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-09-06 19:42:46 +00:00
|
|
|
EDA_LIST_DIALOG::EDA_LIST_DIALOG( EDA_DRAW_FRAME* aParent, const wxString& aTitle,
|
2013-03-19 01:25:19 +00:00
|
|
|
const wxArrayString& aItemHeaders,
|
|
|
|
const std::vector<wxArrayString>& aItemList,
|
2013-11-18 19:27:27 +00:00
|
|
|
const wxString& aSelection,
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
void( *aCallBackFunction )( wxString&, void* ),
|
|
|
|
void* aCallBackFunctionData,
|
2013-01-10 12:18:43 +00:00
|
|
|
bool aSortList ) :
|
|
|
|
EDA_LIST_DIALOG_BASE( aParent, wxID_ANY, aTitle )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2013-03-19 01:25:19 +00:00
|
|
|
m_sortList = aSortList;
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
m_cb_func = aCallBackFunction;
|
|
|
|
m_cb_data = aCallBackFunctionData;
|
2013-01-10 12:18:43 +00:00
|
|
|
m_itemsListCp = &aItemList;
|
2007-12-11 23:12:37 +00:00
|
|
|
|
2014-11-19 14:22:47 +00:00
|
|
|
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();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-02-05 20:55:00 +00:00
|
|
|
void EDA_LIST_DIALOG::initDialog( const wxArrayString& aItemHeaders, const wxString& aSelection)
|
2014-11-19 14:22:47 +00:00
|
|
|
{
|
2013-03-19 01:25:19 +00:00
|
|
|
for( unsigned i = 0; i < aItemHeaders.Count(); i++ )
|
2018-02-05 20:55:00 +00:00
|
|
|
m_listBox->InsertColumn( i, aItemHeaders.Item( i ),
|
|
|
|
wxLIST_FORMAT_LEFT, DEFAULT_COL_WIDTHS[ i ] );
|
2013-05-08 20:47:23 +00:00
|
|
|
|
2014-11-19 14:22:47 +00:00
|
|
|
InsertItems( *m_itemsListCp, 0 );
|
2007-12-11 23:12:37 +00:00
|
|
|
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
if( m_cb_func == NULL )
|
2013-11-18 19:27:27 +00:00
|
|
|
{
|
|
|
|
m_messages->Show( false );
|
|
|
|
m_staticTextMsg->Show( false );
|
|
|
|
}
|
|
|
|
|
2018-02-22 00:17:04 +00:00
|
|
|
if( !aSelection.IsEmpty() )
|
2012-10-18 19:31:40 +00:00
|
|
|
{
|
2014-11-19 14:22:47 +00:00
|
|
|
for( unsigned row = 0; row < m_itemsListCp->size(); ++row )
|
2013-05-08 20:47:23 +00:00
|
|
|
{
|
2014-11-19 14:22:47 +00:00
|
|
|
if( (*m_itemsListCp)[row][0] == aSelection )
|
2012-10-18 19:31:40 +00:00
|
|
|
{
|
2013-11-18 19:27:27 +00:00
|
|
|
m_listBox->SetItemState( row, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED );
|
2018-02-22 00:17:04 +00:00
|
|
|
|
|
|
|
// Set to a small size so EnsureVisible() won't be foiled by later additions.
|
|
|
|
// ListBox will expand to fit later.
|
|
|
|
m_listBox->SetSize( m_listBox->GetSize().GetX(), 100 );
|
2013-11-18 19:27:27 +00:00
|
|
|
m_listBox->EnsureVisible( row );
|
2018-02-22 00:17:04 +00:00
|
|
|
|
2012-10-18 19:31:40 +00:00
|
|
|
break;
|
|
|
|
}
|
2013-05-08 20:47:23 +00:00
|
|
|
}
|
2012-10-18 19:31:40 +00:00
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-02-22 00:17:04 +00:00
|
|
|
void EDA_LIST_DIALOG::SetFilterLabel( const wxString& aLabel )
|
|
|
|
{
|
|
|
|
m_filterLabel->SetLabel( aLabel );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void EDA_LIST_DIALOG::SetListLabel( const wxString& aLabel )
|
|
|
|
{
|
|
|
|
m_listLabel->SetLabel( aLabel );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-01-10 12:18:43 +00:00
|
|
|
void EDA_LIST_DIALOG::textChangeInFilterBox( wxCommandEvent& event )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2013-01-10 12:18:43 +00:00
|
|
|
wxString filter;
|
|
|
|
wxString itemName;
|
2007-12-11 23:12:37 +00:00
|
|
|
|
2013-03-19 01:25:19 +00:00
|
|
|
filter = wxT( "*" ) + m_filterBox->GetLineText( 0 ).MakeLower() + wxT( "*" );
|
2007-12-11 23:12:37 +00:00
|
|
|
|
2013-03-19 01:25:19 +00:00
|
|
|
m_listBox->DeleteAllItems();
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2013-03-19 01:25:19 +00:00
|
|
|
for( unsigned i = 0; i < m_itemsListCp->size(); i++ )
|
2013-01-10 12:18:43 +00:00
|
|
|
{
|
2013-03-19 01:25:19 +00:00
|
|
|
itemName = (*m_itemsListCp)[i].Item( 0 );
|
2013-01-10 12:18:43 +00:00
|
|
|
|
2013-03-19 01:25:19 +00:00
|
|
|
if( itemName.MakeLower().Matches( filter ) )
|
2013-01-10 12:18:43 +00:00
|
|
|
{
|
2013-03-19 01:25:19 +00:00
|
|
|
Append( (*m_itemsListCp)[i] );
|
2013-01-10 12:18:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if( m_sortList )
|
|
|
|
sortList();
|
|
|
|
}
|
2007-12-11 23:12:37 +00:00
|
|
|
|
2013-05-08 20:47:23 +00:00
|
|
|
|
|
|
|
wxString EDA_LIST_DIALOG::GetTextSelection( int aColumn )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2013-11-26 17:08:07 +00:00
|
|
|
wxCHECK_MSG( unsigned( aColumn ) < unsigned( m_listBox->GetColumnCount() ), wxEmptyString,
|
2013-05-08 20:47:23 +00:00
|
|
|
wxT( "Invalid list control column." ) );
|
|
|
|
|
2013-11-26 17:08:07 +00:00
|
|
|
long item = m_listBox->GetNextItem( -1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED );
|
2013-05-08 20:47:23 +00:00
|
|
|
|
2013-11-26 17:08:07 +00:00
|
|
|
if( item >= 0 ) // if something is selected.
|
|
|
|
{
|
|
|
|
wxListItem info;
|
|
|
|
|
|
|
|
info.m_mask = wxLIST_MASK_TEXT;
|
|
|
|
info.m_itemId = item;
|
|
|
|
info.m_col = aColumn;
|
2013-05-08 20:47:23 +00:00
|
|
|
|
2013-11-26 17:08:07 +00:00
|
|
|
if( m_listBox->GetItem( info ) )
|
|
|
|
return info.m_text;
|
|
|
|
}
|
2013-05-08 20:47:23 +00:00
|
|
|
|
2013-11-26 17:08:07 +00:00
|
|
|
return wxEmptyString;
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-12-11 23:12:37 +00:00
|
|
|
|
2013-03-19 01:25:19 +00:00
|
|
|
void EDA_LIST_DIALOG::Append( const wxArrayString& itemList )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2013-03-19 01:25:19 +00:00
|
|
|
long itemIndex = m_listBox->InsertItem( m_listBox->GetItemCount(), itemList[0] );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2016-01-17 03:56:58 +00:00
|
|
|
m_listBox->SetItemPtrData( itemIndex, wxUIntPtr( &itemList[0] ) );
|
2013-05-08 20:47:23 +00:00
|
|
|
|
2013-03-19 01:25:19 +00:00
|
|
|
// Adding the next columns content
|
|
|
|
for( unsigned i = 1; i < itemList.size(); i++ )
|
|
|
|
{
|
|
|
|
m_listBox->SetItem( itemIndex, i, itemList[i] );
|
|
|
|
}
|
|
|
|
}
|
2007-12-11 23:12:37 +00:00
|
|
|
|
2013-05-08 20:47:23 +00:00
|
|
|
|
|
|
|
void EDA_LIST_DIALOG::InsertItems( const std::vector< wxArrayString >& itemList, int position )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2013-05-08 20:47:23 +00:00
|
|
|
for( unsigned row = 0; row < itemList.size(); row++ )
|
2013-03-19 01:25:19 +00:00
|
|
|
{
|
2013-05-08 20:47:23 +00:00
|
|
|
wxASSERT( (int) itemList[row].GetCount() == m_listBox->GetColumnCount() );
|
|
|
|
|
|
|
|
for( unsigned col = 0; col < itemList[row].GetCount(); col++ )
|
2013-03-19 01:25:19 +00:00
|
|
|
{
|
2018-02-05 20:55:00 +00:00
|
|
|
wxListItem info;
|
|
|
|
info.m_itemId = row + position;
|
|
|
|
info.m_col = col;
|
|
|
|
info.m_text = itemList[row].Item( col );
|
|
|
|
info.m_width = DEFAULT_COL_WIDTHS[ col ];
|
|
|
|
info.m_mask = wxLIST_MASK_TEXT | wxLIST_MASK_WIDTH;
|
2013-05-08 20:47:23 +00:00
|
|
|
|
|
|
|
if( col == 0 )
|
|
|
|
{
|
2018-02-05 20:55:00 +00:00
|
|
|
info.m_data = wxUIntPtr( &itemList[row].Item( col ) );
|
|
|
|
info.m_mask |= wxLIST_MASK_DATA;
|
|
|
|
|
|
|
|
m_listBox->InsertItem( info );
|
2013-05-08 20:47:23 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2018-02-05 20:55:00 +00:00
|
|
|
m_listBox->SetItem( info );
|
2013-05-08 20:47:23 +00:00
|
|
|
}
|
2013-03-19 01:25:19 +00:00
|
|
|
}
|
|
|
|
}
|
2013-01-10 12:18:43 +00:00
|
|
|
|
|
|
|
if( m_sortList )
|
|
|
|
sortList();
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2007-12-11 23:12:37 +00:00
|
|
|
|
2013-01-10 12:18:43 +00:00
|
|
|
void EDA_LIST_DIALOG::onCancelClick( wxCommandEvent& event )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2010-11-19 18:50:23 +00:00
|
|
|
EndModal( wxID_CANCEL );
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2007-12-11 23:12:37 +00:00
|
|
|
|
2013-03-19 01:25:19 +00:00
|
|
|
void EDA_LIST_DIALOG::onListItemSelected( wxListEvent& event )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
if( m_cb_func )
|
2007-12-11 23:12:37 +00:00
|
|
|
{
|
2010-11-19 18:50:23 +00:00
|
|
|
m_messages->Clear();
|
2013-03-19 01:25:19 +00:00
|
|
|
wxString text = GetTextSelection();
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
m_cb_func( text, m_cb_data );
|
2010-11-19 18:50:23 +00:00
|
|
|
m_messages->WriteText( text );
|
2007-12-11 23:12:37 +00:00
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2007-12-11 23:12:37 +00:00
|
|
|
|
2013-03-19 01:25:19 +00:00
|
|
|
void EDA_LIST_DIALOG::onListItemActivated( wxListEvent& event )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2010-11-19 18:50:23 +00:00
|
|
|
EndModal( wxID_OK );
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-01-10 12:18:43 +00:00
|
|
|
void EDA_LIST_DIALOG::onOkClick( wxCommandEvent& event )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2010-11-19 18:50:23 +00:00
|
|
|
EndModal( wxID_OK );
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2007-12-11 23:12:37 +00:00
|
|
|
|
2013-01-10 12:18:43 +00:00
|
|
|
void EDA_LIST_DIALOG::onClose( wxCloseEvent& event )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2010-11-19 18:50:23 +00:00
|
|
|
EndModal( wxID_CANCEL );
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-11-23 15:16:50 +00:00
|
|
|
/* Sort alphabetically, case insensitive.
|
2007-10-07 03:08:24 +00:00
|
|
|
*/
|
2015-07-24 10:23:34 +00:00
|
|
|
static int wxCALLBACK myCompareFunction( wxIntPtr aItem1, wxIntPtr aItem2,
|
|
|
|
wxIntPtr WXUNUSED( aSortData ) )
|
2013-05-08 20:47:23 +00:00
|
|
|
{
|
2013-03-19 01:25:19 +00:00
|
|
|
wxString* component1Name = (wxString*) aItem1;
|
|
|
|
wxString* component2Name = (wxString*) aItem2;
|
2013-05-08 20:47:23 +00:00
|
|
|
|
|
|
|
return StrNumCmp( *component1Name, *component2Name, INT_MAX, true );
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2013-05-08 20:47:23 +00:00
|
|
|
|
2013-01-10 12:18:43 +00:00
|
|
|
void EDA_LIST_DIALOG::sortList()
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2015-07-24 10:23:34 +00:00
|
|
|
m_listBox->SortItems( myCompareFunction, 0 );
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|