Rename lib viewer frame files to use the class name

This commit is contained in:
Ian McInerney 2019-12-19 14:05:46 +00:00
parent 1e42d6abeb
commit 3ca231aa78
15 changed files with 129 additions and 164 deletions

View File

@ -160,6 +160,7 @@ set( EESCHEMA_SRCS
lib_polyline.cpp
lib_rectangle.cpp
lib_text.cpp
lib_view_frame.cpp
libarch.cpp
menubar.cpp
netlist_generator.cpp
@ -206,11 +207,9 @@ set( EESCHEMA_SRCS
symbol_tree_model_adapter.cpp
symbol_tree_synchronizing_adapter.cpp
template_fieldnames.cpp
toolbars_lib_view.cpp
toolbars_sch_editor.cpp
toolbars_viewlib.cpp
transform.cpp
viewlib_frame.cpp
viewlibs.cpp
netlist_exporters/netlist_exporter.cpp
netlist_exporters/netlist_exporter_cadstar.cpp

View File

@ -32,6 +32,7 @@
#include <wx_html_report_panel.h>
#include <class_library.h>
#include <lib_view_frame.h>
#include <project_rescue.h>
#include <sch_io_mgr.h>
#include <sch_sheet.h>
@ -39,7 +40,6 @@
#include <sch_screen.h>
#include <sch_edit_frame.h>
#include <symbol_lib_table.h>
#include <viewlib_frame.h>
#include <env_paths.h>
#include <dialog_symbol_remap.h>

View File

@ -35,8 +35,8 @@
#include <wildcards_and_files_ext.h>
#include <env_paths.h>
#include <lib_edit_frame.h>
#include <lib_view_frame.h>
#include <sch_edit_frame.h>
#include <viewlib_frame.h>
#include <kiway.h>
#include <sch_screen.h>

View File

@ -31,7 +31,7 @@
#include <eda_dde.h>
#include <sch_edit_frame.h>
#include <lib_edit_frame.h>
#include <viewlib_frame.h>
#include <lib_view_frame.h>
#include <general.h>
#include <class_libentry.h>
#include <transform.h>

View File

@ -38,7 +38,7 @@
#include <class_library.h>
#include <sch_component.h>
#include <lib_edit_frame.h>
#include <viewlib_frame.h>
#include <lib_view_frame.h>
#include <eeschema_id.h>
#include <symbol_lib_table.h>

View File

@ -23,21 +23,25 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <fctsys.h>
#include <kiface_i.h>
#include <pgm_base.h>
#include <sch_view.h>
#include <msgpanel.h>
#include <bitmaps.h>
#include <eeschema_id.h>
#include <viewlib_frame.h>
#include <symbol_lib_table.h>
#include <dialog_helpers.h>
#include <class_libentry.h>
#include <class_library.h>
#include <view/view_controls.h>
#include <sch_painter.h>
#include <confirm.h>
#include <dialog_helpers.h>
#include <dialog_choose_component.h>
#include <eda_doc.h>
#include <eeschema_id.h>
#include <fctsys.h>
#include <kiface_i.h>
#include <kiway.h>
#include <lib_view_frame.h>
#include <msgpanel.h>
#include <sch_draw_panel.h>
#include <sch_view.h>
#include <sch_painter.h>
#include <symbol_lib_table.h>
#include <symbol_tree_model_adapter.h>
#include <pgm_base.h>
#include <tool/tool_manager.h>
#include <tool/action_toolbar.h>
#include <tool/tool_dispatcher.h>
@ -47,6 +51,7 @@
#include <tools/ee_actions.h>
#include <tools/lib_control.h>
#include <tools/ee_inspection_tool.h>
#include <view/view_controls.h>
// Save previous component library viewer state.
wxString LIB_VIEW_FRAME::m_libraryName;
@ -726,3 +731,103 @@ void LIB_VIEW_FRAME::FinishModal()
Close( true );
}
void LIB_VIEW_FRAME::OnSelectSymbol( wxCommandEvent& aEvent )
{
std::unique_lock<std::mutex> dialogLock( DIALOG_CHOOSE_COMPONENT::g_Mutex, std::defer_lock );
// One CHOOSE_COMPONENT dialog at a time. User probaby can't handle more anyway.
if( !dialogLock.try_lock() )
return;
// Container doing search-as-you-type.
SYMBOL_LIB_TABLE* libs = Prj().SchSymbolLibTable();
auto adapterPtr( SYMBOL_TREE_MODEL_ADAPTER::Create( libs ) );
auto adapter = static_cast<SYMBOL_TREE_MODEL_ADAPTER*>( adapterPtr.get() );
const auto libNicknames = libs->GetLogicalLibs();
adapter->AddLibraries( libNicknames, this );
LIB_PART* current = GetSelectedSymbol();
LIB_ID id;
int unit = 0;
if( current )
{
id = current->GetLibId();
adapter->SetPreselectNode( id, unit );
}
wxString dialogTitle;
dialogTitle.Printf( _( "Choose Symbol (%d items loaded)" ), adapter->GetItemCount() );
DIALOG_CHOOSE_COMPONENT dlg( this, dialogTitle, adapterPtr, m_convert, false, false, false );
if( dlg.ShowQuasiModal() == wxID_CANCEL )
return;
id = dlg.GetSelectedLibId( &unit );
if( !id.IsValid() )
return;
SetSelectedLibrary( id.GetLibNickname() );
SetSelectedComponent( id.GetLibItemName() );
SetUnitAndConvert( unit, 1 );
}
void LIB_VIEW_FRAME::onSelectNextSymbol( wxCommandEvent& aEvent )
{
wxCommandEvent evt( wxEVT_COMMAND_LISTBOX_SELECTED, ID_LIBVIEW_CMP_LIST );
int ii = m_cmpList->GetSelection();
// Select the next symbol or stop at the end of the list.
if( ii != wxNOT_FOUND || ii != (int)m_cmpList->GetCount() - 1 )
ii += 1;
m_cmpList->SetSelection( ii );
ProcessEvent( evt );
}
void LIB_VIEW_FRAME::onSelectPreviousSymbol( wxCommandEvent& aEvent )
{
wxCommandEvent evt( wxEVT_COMMAND_LISTBOX_SELECTED, ID_LIBVIEW_CMP_LIST );
int ii = m_cmpList->GetSelection();
// Select the previous symbol or stop at the beginning of list.
if( ii != wxNOT_FOUND && ii != 0 )
ii -= 1;
m_cmpList->SetSelection( ii );
ProcessEvent( evt );
}
void LIB_VIEW_FRAME::onSelectSymbolUnit( wxCommandEvent& aEvent )
{
int ii = m_unitChoice->GetSelection();
if( ii < 0 )
return;
m_unit = ii + 1;
updatePreviewSymbol();
}
void LIB_VIEW_FRAME::DisplayLibInfos()
{
if( m_libList && !m_libList->IsEmpty() && !m_libraryName.IsEmpty() )
{
const SYMBOL_LIB_TABLE_ROW* row = Prj().SchSymbolLibTable()->FindRow( m_libraryName );
wxString title = wxString::Format( _( "Symbol Library Browser -- %s" ),
row ? row->GetFullURI() : _( "no library selected" ) );
SetTitle( title );
}
}

View File

@ -28,12 +28,12 @@
#include <connection_graph.h>
#include <invoke_sch_dialog.h>
#include <kiway.h>
#include <lib_view_frame.h>
#include <project_rescue.h>
#include <sch_component.h>
#include <sch_sheet.h>
#include <sch_edit_frame.h>
#include <symbol_lib_table.h>
#include <viewlib_frame.h>
#include <wildcards_and_files_ext.h>
#include <cctype>

View File

@ -33,7 +33,7 @@
#include <class_library.h>
#include <eeschema_id.h>
#include <lib_edit_frame.h>
#include <viewlib_frame.h>
#include <lib_view_frame.h>
#include <sch_base_frame.h>
#include <symbol_lib_table.h>
#include <tool/action_toolbar.h>

View File

@ -41,7 +41,7 @@
#include <symbol_lib_table.h>
#include <reporter.h>
#include <lib_edit_frame.h>
#include <viewlib_frame.h>
#include <lib_view_frame.h>
#include <eeschema_config.h>
#include <sch_sheet.h>
#include <sim/sim_plot_frame.h>

View File

@ -25,7 +25,7 @@
#include "class_library.h"
#include "eeschema_id.h"
#include "general.h"
#include "viewlib_frame.h"
#include "lib_view_frame.h"
#include <symbol_lib_table.h>
#include <tool/action_toolbar.h>
#include <tool/conditional_menu.h>

View File

@ -40,7 +40,7 @@
#include <sch_view.h>
#include <sch_edit_frame.h>
#include <lib_edit_frame.h>
#include <viewlib_frame.h>
#include <lib_view_frame.h>
#include <eda_doc.h>
#include <invoke_sch_dialog.h>
#include <project.h>

View File

@ -30,7 +30,7 @@
#include <sch_base_frame.h>
#include <sch_edit_frame.h>
#include <lib_edit_frame.h>
#include <viewlib_frame.h>
#include <lib_view_frame.h>
#include <sch_component.h>
#include <sch_sheet.h>
#include <sch_field.h>

View File

@ -30,7 +30,7 @@
#include <tools/lib_control.h>
#include <eeschema_id.h>
#include <lib_edit_frame.h>
#include <viewlib_frame.h>
#include <lib_view_frame.h>
#include <wildcards_and_files_ext.h>
#include <gestfich.h>
#include <project.h>

View File

@ -1,139 +0,0 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2015-2019 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
*/
#include <fctsys.h>
#include <kiway.h>
#include <pgm_base.h>
#include <sch_draw_panel.h>
#include <sch_view.h>
#include <confirm.h>
#include <eda_doc.h>
#include <viewlib_frame.h>
#include <eeschema_id.h>
#include <class_libentry.h>
#include <class_library.h>
#include <dialog_helpers.h>
#include <dialog_choose_component.h>
#include <symbol_tree_model_adapter.h>
#include <symbol_lib_table.h>
void LIB_VIEW_FRAME::OnSelectSymbol( wxCommandEvent& aEvent )
{
std::unique_lock<std::mutex> dialogLock( DIALOG_CHOOSE_COMPONENT::g_Mutex, std::defer_lock );
// One CHOOSE_COMPONENT dialog at a time. User probaby can't handle more anyway.
if( !dialogLock.try_lock() )
return;
// Container doing search-as-you-type.
SYMBOL_LIB_TABLE* libs = Prj().SchSymbolLibTable();
auto adapterPtr( SYMBOL_TREE_MODEL_ADAPTER::Create( libs ) );
auto adapter = static_cast<SYMBOL_TREE_MODEL_ADAPTER*>( adapterPtr.get() );
const auto libNicknames = libs->GetLogicalLibs();
adapter->AddLibraries( libNicknames, this );
LIB_PART* current = GetSelectedSymbol();
LIB_ID id;
int unit = 0;
if( current )
{
id = current->GetLibId();
adapter->SetPreselectNode( id, unit );
}
wxString dialogTitle;
dialogTitle.Printf( _( "Choose Symbol (%d items loaded)" ), adapter->GetItemCount() );
DIALOG_CHOOSE_COMPONENT dlg( this, dialogTitle, adapterPtr, m_convert, false, false, false );
if( dlg.ShowQuasiModal() == wxID_CANCEL )
return;
id = dlg.GetSelectedLibId( &unit );
if( !id.IsValid() )
return;
SetSelectedLibrary( id.GetLibNickname() );
SetSelectedComponent( id.GetLibItemName() );
SetUnitAndConvert( unit, 1 );
}
void LIB_VIEW_FRAME::onSelectNextSymbol( wxCommandEvent& aEvent )
{
wxCommandEvent evt( wxEVT_COMMAND_LISTBOX_SELECTED, ID_LIBVIEW_CMP_LIST );
int ii = m_cmpList->GetSelection();
// Select the next symbol or stop at the end of the list.
if( ii != wxNOT_FOUND || ii != (int)m_cmpList->GetCount() - 1 )
ii += 1;
m_cmpList->SetSelection( ii );
ProcessEvent( evt );
}
void LIB_VIEW_FRAME::onSelectPreviousSymbol( wxCommandEvent& aEvent )
{
wxCommandEvent evt( wxEVT_COMMAND_LISTBOX_SELECTED, ID_LIBVIEW_CMP_LIST );
int ii = m_cmpList->GetSelection();
// Select the previous symbol or stop at the beginning of list.
if( ii != wxNOT_FOUND && ii != 0 )
ii -= 1;
m_cmpList->SetSelection( ii );
ProcessEvent( evt );
}
void LIB_VIEW_FRAME::onSelectSymbolUnit( wxCommandEvent& aEvent )
{
int ii = m_unitChoice->GetSelection();
if( ii < 0 )
return;
m_unit = ii + 1;
updatePreviewSymbol();
}
void LIB_VIEW_FRAME::DisplayLibInfos()
{
if( m_libList && !m_libList->IsEmpty() && !m_libraryName.IsEmpty() )
{
const SYMBOL_LIB_TABLE_ROW* row = Prj().SchSymbolLibTable()->FindRow( m_libraryName );
wxString title = wxString::Format( _( "Symbol Library Browser -- %s" ),
row ? row->GetFullURI() : _( "no library selected" ) );
SetTitle( title );
}
}