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

Code cleanup and minor fix in viewlib.

parent a094f7d5
...@@ -105,10 +105,10 @@ void LIB_VIEW_FRAME::ReCreateHToolbar() ...@@ -105,10 +105,10 @@ void LIB_VIEW_FRAME::ReCreateHToolbar()
m_mainToolBar->AddSeparator(); m_mainToolBar->AddSeparator();
SelpartBox = new wxComboBox( m_mainToolBar, ID_LIBVIEW_SELECT_PART_NUMBER, m_selpartBox = new wxComboBox( m_mainToolBar, ID_LIBVIEW_SELECT_PART_NUMBER,
wxEmptyString, wxDefaultPosition, wxEmptyString, wxDefaultPosition,
wxSize( 150, -1 ), 0, NULL, wxCB_READONLY ); wxSize( 150, -1 ), 0, NULL, wxCB_READONLY );
m_mainToolBar->AddControl( SelpartBox ); m_mainToolBar->AddControl( m_selpartBox );
m_mainToolBar->AddSeparator(); m_mainToolBar->AddSeparator();
m_mainToolBar->AddTool( ID_LIBVIEW_VIEWDOC, wxEmptyString, m_mainToolBar->AddTool( ID_LIBVIEW_VIEWDOC, wxEmptyString,
...@@ -116,7 +116,7 @@ void LIB_VIEW_FRAME::ReCreateHToolbar() ...@@ -116,7 +116,7 @@ void LIB_VIEW_FRAME::ReCreateHToolbar()
_( "View component documents" ) ); _( "View component documents" ) );
m_mainToolBar->EnableTool( ID_LIBVIEW_VIEWDOC, false ); m_mainToolBar->EnableTool( ID_LIBVIEW_VIEWDOC, false );
if( m_Semaphore ) if( m_semaphore )
{ {
// The library browser is called from a "load component" command // The library browser is called from a "load component" command
m_mainToolBar->AddSeparator(); m_mainToolBar->AddSeparator();
...@@ -167,17 +167,17 @@ void LIB_VIEW_FRAME::ReCreateHToolbar() ...@@ -167,17 +167,17 @@ void LIB_VIEW_FRAME::ReCreateHToolbar()
if( component ) if( component )
parts_count = std::max( component->GetPartCount(), 1 ); parts_count = std::max( component->GetPartCount(), 1 );
SelpartBox->Clear(); m_selpartBox->Clear();
for( ii = 0; ii < parts_count; ii++ ) for( ii = 0; ii < parts_count; ii++ )
{ {
wxString msg; wxString msg;
msg.Printf( _( "Unit %c" ), 'A' + ii ); msg.Printf( _( "Unit %c" ), 'A' + ii );
SelpartBox->Append( msg ); m_selpartBox->Append( msg );
} }
SelpartBox->SetSelection( (m_unit > 0 ) ? m_unit - 1 : 0 ); m_selpartBox->SetSelection( (m_unit > 0 ) ? m_unit - 1 : 0 );
SelpartBox->Enable( parts_count > 1 ); m_selpartBox->Enable( parts_count > 1 );
m_mainToolBar->EnableTool( ID_LIBVIEW_VIEWDOC, m_mainToolBar->EnableTool( ID_LIBVIEW_VIEWDOC,
entry && ( entry->GetDocFileName() != wxEmptyString ) ); entry && ( entry->GetDocFileName() != wxEmptyString ) );
......
This diff is collapsed.
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com * Copyright (C) 2014 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2008-2011 Wayne Stambaugh <stambaughw@verizon.net> * Copyright (C) 2008-2014 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors. * Copyright (C) 2004-2014 KiCad Developers, see change_log.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
...@@ -48,20 +48,18 @@ class CMP_LIBRARY; ...@@ -48,20 +48,18 @@ class CMP_LIBRARY;
class LIB_VIEW_FRAME : public SCH_BASE_FRAME class LIB_VIEW_FRAME : public SCH_BASE_FRAME
{ {
private: private:
wxComboBox* SelpartBox; wxComboBox* m_selpartBox;
// List of libraries (for selection ) // List of libraries (for selection )
wxSashLayoutWindow* m_LibListWindow; wxListBox* m_libList; // The list of libs
wxListBox* m_LibList; // The list of libs int m_libListWidth; // Last width of the window
wxSize m_LibListSize; // size of the window
// List of components in the selected library // List of components in the selected library
wxSashLayoutWindow* m_CmpListWindow; wxListBox* m_cmpList; // The list of components
wxListBox* m_CmpList; // The list of components int m_cmpListWidth; // Last width of the window
wxSize m_CmpListSize; // size of the window
// Flags // Flags
wxSemaphore* m_Semaphore; // != NULL if the frame must emulate a modal dialog wxSemaphore* m_semaphore; // != NULL if the frame must emulate a modal dialog
wxString m_configPath; // subpath for configuration wxString m_configPath; // subpath for configuration
protected: protected:
...@@ -95,12 +93,6 @@ public: ...@@ -95,12 +93,6 @@ public:
void OnSize( wxSizeEvent& event ); void OnSize( wxSizeEvent& event );
/**
* Function OnSashDrag
* resizes the child windows when dragging a sash window border.
*/
void OnSashDrag( wxSashEvent& event );
/** /**
* Function ReCreateListLib * Function ReCreateListLib
* *
......
...@@ -70,7 +70,7 @@ void LIB_VIEW_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -70,7 +70,7 @@ void LIB_VIEW_FRAME::Process_Special_Functions( wxCommandEvent& event )
break; break;
case ID_LIBVIEW_SELECT_PART_NUMBER: case ID_LIBVIEW_SELECT_PART_NUMBER:
ii = SelpartBox->GetCurrentSelection(); ii = m_selpartBox->GetCurrentSelection();
if( ii < 0 ) if( ii < 0 )
return; return;
m_unit = ii + 1; m_unit = ii + 1;
...@@ -132,16 +132,16 @@ void LIB_VIEW_FRAME::SelectCurrentLibrary() ...@@ -132,16 +132,16 @@ void LIB_VIEW_FRAME::SelectCurrentLibrary()
m_libraryName = Lib->GetName(); m_libraryName = Lib->GetName();
DisplayLibInfos(); DisplayLibInfos();
if( m_LibList ) if( m_libList )
{ {
ReCreateListCmp(); ReCreateListCmp();
m_canvas->Refresh(); m_canvas->Refresh();
DisplayLibInfos(); DisplayLibInfos();
ReCreateHToolbar(); ReCreateHToolbar();
int id = m_LibList->FindString( m_libraryName.GetData() ); int id = m_libList->FindString( m_libraryName.GetData() );
if( id >= 0 ) if( id >= 0 )
m_LibList->SetSelection( id ); m_libList->SetSelection( id );
} }
} }
} }
...@@ -234,11 +234,11 @@ void LIB_VIEW_FRAME::ViewOneLibraryContent( CMP_LIBRARY* Lib, int Flag ) ...@@ -234,11 +234,11 @@ void LIB_VIEW_FRAME::ViewOneLibraryContent( CMP_LIBRARY* Lib, int Flag )
Zoom_Automatique( false ); Zoom_Automatique( false );
m_canvas->Refresh( ); m_canvas->Refresh( );
if( m_CmpList ) if( m_cmpList )
{ {
int id = m_CmpList->FindString( m_entryName.GetData() ); int id = m_cmpList->FindString( m_entryName.GetData() );
if( id >= 0 ) if( id >= 0 )
m_CmpList->SetSelection( id ); m_cmpList->SetSelection( id );
} }
ReCreateHToolbar(); ReCreateHToolbar();
} }
......
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