Loading change_log.txt +8 −0 Original line number Diff line number Diff line Loading @@ -4,6 +4,14 @@ Started 2007-June-11 Please add newer entries at the top, list the date and your name with email address. 2007-Oct-29 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr> ================================================================================ +cvpcb: listboxes.cpp problem solved: Workaround for a curious bug in wxWidgets: if we switch from a long list of footprints to a short list (a filtered footprint list), and if the selected item is near the end of the long list, the new list is not displayed from the top of the list box 2007-Oct-27 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr> ================================================================================ + all: Loading common/edaappl.cpp +26 −21 Original line number Diff line number Diff line Loading @@ -54,21 +54,21 @@ * The real font size will be computed at run time */ /*****************************/ /* Constructeur de WinEDA_App */ /*****************************/ /**************************/ /* WinEDA_App Constructor */ /**************************/ WinEDA_App::WinEDA_App() { m_Checker = NULL; m_MainFrame = NULL; m_PcbFrame = NULL; m_ModuleEditFrame = NULL; // Edition des modules m_SchematicFrame = NULL; // Edition des Schemas m_LibeditFrame = NULL; // Edition des composants m_ViewlibFrame = NULL; // Visualisation des composants m_ModuleEditFrame = NULL; // Frame for footprint edition m_SchematicFrame = NULL; // Frame for schematic edition m_LibeditFrame = NULL; // Frame for component edition m_ViewlibFrame = NULL; // Frame for browsing component libraries m_CvpcbFrame = NULL; m_GerberFrame = NULL; // ecran de visualisation GERBER m_GerberFrame = NULL; // Frame for the gerber viewer GERBVIEW m_LastProjectMaxCount = 10; m_HtmlCtrl = NULL; Loading @@ -83,15 +83,15 @@ WinEDA_App::WinEDA_App() } /*****************************/ /* Destructeur de WinEDA_App */ /*****************************/ /*************************/ /* WinEDA_App Destructor */ /*************************/ WinEDA_App::~WinEDA_App() { SaveSettings(); /* delete data non directement geree par wxAppl */ /* delete user datas */ delete g_Prj_Config; delete m_EDA_Config; delete m_EDA_CommonConfig; Loading @@ -116,10 +116,12 @@ void WinEDA_App::InitEDA_Appl( const wxString& name ) ident = name + wxT( "-" ) + wxGetUserId(); m_Checker = new wxSingleInstanceChecker( ident ); /* Init environnement * (KICAD definit le chemin de kicad ex: set KICAD=d:\kicad) */ /* Init kicad environment * the environment variable KICAD (if exists) gives the kicad path: * something like set KICAD=d:\kicad */ m_Env_Defined = wxGetEnv( wxT( "KICAD" ), &m_KicadEnv ); if( m_Env_Defined ) // m_KicadEnv doit finir par "/" ou "\" if( m_Env_Defined ) // ensure m_KicadEnv ends by "/" { m_KicadEnv.Replace( WIN_STRING_DIR_SEP, UNIX_STRING_DIR_SEP ); if( m_KicadEnv.Last() != '/' ) Loading @@ -129,13 +131,13 @@ void WinEDA_App::InitEDA_Appl( const wxString& name ) /* Prepare On Line Help */ m_HelpFileName = name + wxT( ".html" ); // Init parametres pour configuration // Init parameters for configuration SetVendorName( wxT( "kicad" ) ); SetAppName( name ); m_EDA_Config = new wxConfig( name ); m_EDA_CommonConfig = new wxConfig( wxT( "kicad_common" ) ); /* Creation des fontes utiles */ /* Create the fontes used in dialogs and messages */ g_StdFontPointSize = FONT_DEFAULT_SIZE; g_MsgFontPointSize = FONT_DEFAULT_SIZE; g_DialogFontPointSize = FONT_DEFAULT_SIZE; Loading @@ -155,12 +157,12 @@ void WinEDA_App::InitEDA_Appl( const wxString& name ) wxImage::AddHandler( new wxJPEGHandler ); wxFileSystem::AddHandler( new wxZipFSHandler ); // Analyse command line & init binary path // Analyse the command line & init binary path SetBinDir(); ReadPdfBrowserInfos(); // Internationalisation: chargement du Dictionnaire de kicad // Internationalisation: loading the kicad suitable Dictionnary m_EDA_CommonConfig->Read( wxT( "Language" ), &m_LanguageId, wxLANGUAGE_DEFAULT ); bool succes = SetLanguage( TRUE ); Loading Loading @@ -262,7 +264,7 @@ bool WinEDA_App::SetBinDir() void WinEDA_App::GetSettings() /*********************************/ /* Lit les infos utiles sauvees lors de la derniere utilisation du logiciel /* Get the last setup used (fontes, files opened...) */ { wxString Line, Ident; Loading Loading @@ -639,8 +641,11 @@ wxMenu* WinEDA_App::SetLanguageList( wxMenu* MasterMenu ) } /**********************/ int WinEDA_App::OnRun() /* Run init scripts */ /**********************/ /* Run init scripts */ { #ifdef KICAD_PYTHON PyHandler::GetInstance()->RunScripts(); Loading common/msgpanel.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -141,7 +141,7 @@ void WinEDA_MsgPanel::Affiche_1_Parametre( int pos_X, const wxString& texte_H, } void WinEDA_MsgPanel::showItem( wxWindowDC& dc, const MsgItem& aItem ) void WinEDA_MsgPanel::showItem( wxDC& dc, const MsgItem& aItem ) { int color = aItem.m_Color; Loading cvpcb/listboxes.cpp +307 −262 Original line number Diff line number Diff line Loading @@ -12,9 +12,10 @@ #include "protos.h" /************************************************************************/ /* Class (from wxListView) for displaying component and footprint lists */ /************************************************************************/ /******************************************************************************/ /* Basic class (from wxListView) for displaying component and footprint lists */ /* Not directly used: the 2 list boxes actually used are derived from it */ /******************************************************************************/ ListBoxBase::ListBoxBase( WinEDA_CvpcbFrame* parent, wxWindowID id, const wxPoint& loc, const wxSize& size ) : Loading @@ -28,14 +29,15 @@ ListBoxBase::ListBoxBase(WinEDA_CvpcbFrame * parent, } ListBoxBase::~ListBoxBase() { } /************************************************/ void ListBoxBase::OnSize( wxSizeEvent& event ) /************************************************/ // Ajust the column width to the entire available window width { wxSize size = GetClientSize(); Loading @@ -52,15 +54,16 @@ int width = 0; /*********************************/ int ListBoxBase::GetSelection() /*********************************/ // Return an index for the selected item { return GetFirstSelected(); } /************************************************************/ /* ListBox derivee pour l'affichage de la liste des Modules */ /************************************************************/ /***************************************/ /* ListBox handling the footprint list */ /***************************************/ FootprintListBox::FootprintListBox( WinEDA_CvpcbFrame* parent, wxWindowID id, const wxPoint& loc, const wxSize& size, Loading @@ -71,7 +74,6 @@ FootprintListBox::FootprintListBox(WinEDA_CvpcbFrame * parent, } FootprintListBox::~FootprintListBox() { } Loading @@ -80,6 +82,7 @@ FootprintListBox::~FootprintListBox() /**********************************/ int FootprintListBox::GetCount() /**********************************/ // Return number of items { return m_ActiveFootprintList->Count(); Loading @@ -89,16 +92,20 @@ int FootprintListBox::GetCount() /*****************************************************************************/ void FootprintListBox::SetString( unsigned linecount, const wxString& text ) /*****************************************************************************/ // Change an item text { if( linecount >= m_ActiveFootprintList->Count() ) linecount = m_ActiveFootprintList->Count() - 1; if ( linecount >= 0 ) (*m_ActiveFootprintList)[linecount] = text; if( linecount >= 0 ) (*m_ActiveFootprintList)[linecount] = text; } /***************************************************/ wxString FootprintListBox::GetSelectedFootprint() /***************************************************/ // Return an index for the selected item { wxString FootprintName; Loading @@ -118,6 +125,7 @@ int ii = GetFirstSelected(); /*********************************************************/ void FootprintListBox::AppendLine( const wxString& text ) /*********************************************************/ // Add an item at end of list { m_ActiveFootprintList->Add( text ); Loading @@ -128,19 +136,23 @@ void FootprintListBox::AppendLine(const wxString & text) /*********************************************************************/ wxString FootprintListBox::OnGetItemText( long item, long column ) const /*********************************************************************/ /* Overlayed function: MUST be provided in wxLC_VIRTUAL mode because real datas are not handled by ListBoxBase * because real datas are not handled by ListBoxBase */ { return m_ActiveFootprintList->Item( item ); } /*****************************************************************/ void FootprintListBox::SetSelection( unsigned index, bool State ) /*****************************************************************/ // Enable or disable an item { if ( (int) index >= GetCount() ) index = GetCount()-1; if( (int) index >= GetCount() ) index = GetCount() - 1; #ifndef __WXMAC__ Select( index, State ); Loading @@ -152,9 +164,9 @@ void FootprintListBox::SetSelection(unsigned index, bool State) } /***************************************************************/ /* ListBox derivee pour l'affichage de la liste des Composants */ /***************************************************************/ /**************************************************/ /* ListBox handling the schematic components list */ /**************************************************/ ListBoxCmp::ListBoxCmp( WinEDA_CvpcbFrame* parent, wxWindowID id, const wxPoint& loc, const wxSize& size, Loading @@ -164,16 +176,13 @@ ListBoxCmp::ListBoxCmp(WinEDA_CvpcbFrame * parent, wxWindowID id, } ListBoxCmp::~ListBoxCmp() { } /***********************************************************************/ /* Construction de la table des evenements pour la fenetre des composants */ /***********************************************************************/ /* Build the events table for the schematic components list box */ BEGIN_EVENT_TABLE( ListBoxCmp, LIST_BOX_TYPE ) EVT_SIZE( ListBoxBase::OnSize ) Loading @@ -183,32 +192,41 @@ END_EVENT_TABLE() /****************************/ void ListBoxCmp::Clear() /****************************/ // Reset ALL datas { m_ComponentList.Clear(); SetItemCount( 0 ); } /******************************/ int ListBoxCmp::GetCount() /******************************/ // Return number of items { return m_ComponentList.Count(); } /********************************************************************/ void ListBoxCmp::SetString( unsigned linecount, const wxString& text ) /********************************************************************/ // Change an item text { if( linecount >= m_ComponentList.Count() ) linecount = m_ComponentList.Count() - 1; if ( linecount >= 0 ) m_ComponentList[linecount] = text; if( linecount >= 0 ) m_ComponentList[linecount] = text; } /****************************************************/ void ListBoxCmp::AppendLine( const wxString& text ) /****************************************************/ // Add an item at end of list { m_ComponentList.Add( text ); Loading @@ -219,19 +237,23 @@ void ListBoxCmp::AppendLine(const wxString & text) /****************************************************************/ wxString ListBoxCmp::OnGetItemText( long item, long column ) const /****************************************************************/ /* Overlayed function: MUST be provided in wxLC_VIRTUAL mode because real datas are not handled by ListBoxBase * because real datas are not handled by ListBoxBase */ { return m_ComponentList.Item( item ); } /********************************************************/ void ListBoxCmp::SetSelection( unsigned index, bool State ) /*********************************************************/ // Enable or disable an item { if ( (int) index >= GetCount() ) index = GetCount()-1; if( (int) index >= GetCount() ) index = GetCount() - 1; #ifndef __WXMAC__ Select( index, State ); Loading @@ -242,14 +264,12 @@ void ListBoxCmp::SetSelection(unsigned index, bool State) #endif } /********************************************/ void WinEDA_CvpcbFrame::BuildCmpListBox() /********************************************/ /* Construit la fenetre d'affichage de la liste des composant. dimx et dimy sont les dimensions de la surface totale d'affichage et non les dims de la fenetre des Cmp Si la fenetre d'affichage a deja ete creee, il y a seulement mise a jour de la liste /* Create or update the schematic components list. */ { int ii; Loading @@ -276,20 +296,18 @@ wxSize size(10,10); Composant->m_Module.GetData() ); m_ListCmp->m_ComponentList.Add( msg ); } m_ListCmp->SetItemCount( m_ListCmp->m_ComponentList.Count() ); m_ListCmp->SetSelection( 0, TRUE ); } /*************************************************************/ /**********************************************/ void WinEDA_CvpcbFrame::BuildFootprintListBox() /*************************************************************/ /* Construit la fenetre d'affichage de la liste des Modules. dimx et dimy sont les dimensions de la surface totale d'affichage et non les dims de la fenetre des Modules Si la fenetre d'affichage a deja ete creee, il y a seulement mise a jour de la liste /**********************************************/ /* Create or update the footprint list. */ { wxString msg; Loading Loading @@ -336,6 +354,7 @@ int OldSelection = GetSelection(); Refresh(); } /**********************************************************************/ void FootprintListBox::SetFootprintFilteredList( STORECMP* Component ) /*********************************************************************/ Loading @@ -362,10 +381,10 @@ bool HasItem = FALSE; } } if ( HasItem ) SetActiveFootprintList(FALSE); else SetActiveFootprintList(TRUE); if( HasItem ) SetActiveFootprintList( FALSE ); else SetActiveFootprintList( TRUE ); if( (GetCount() == 0) || ( OldSelection >= GetCount() ) ) SetSelection( 0, TRUE ); Loading @@ -377,9 +396,30 @@ bool HasItem = FALSE; /**************************************************************************/ void FootprintListBox::SetActiveFootprintList( bool FullList, bool Redraw ) /**************************************************************************/ /** Set the footprint list. We can have 2 footprint list: * The full footprint list * The filtered footprint list (if the current selected component has a filter for footprints) * @param FullList true = full footprint list, false = filtered footprint list * @param Redraw = true to redraw the window */ { bool old_selection = m_UseFootprintFullList; /* Workaround for a curious bug in wxWidgets: * if we switch from a long list of footprints to a short list (a filtered footprint list), * and if the selected item is near the end of the long list, * the new list is not displayed from the top of the list box */ if ( m_ActiveFootprintList ) { bool new_selection; if( FullList ) new_selection = TRUE; else new_selection = FALSE; if( new_selection != old_selection ) SetSelection( 0, TRUE ); } if( FullList ) { m_UseFootprintFullList = TRUE; Loading Loading @@ -415,9 +455,10 @@ bool old_selection = m_UseFootprintFullList; m_Parent->SetStatusText( msg, 2 ); } /***********************************************************************/ /* Construction de la table des evenements pour la fenetre des modules */ /***********************************************************************/ /**************************************/ /* Event table for the footprint list */ /**************************************/ BEGIN_EVENT_TABLE( FootprintListBox, LIST_BOX_TYPE ) EVT_SIZE( ListBoxBase::OnSize ) Loading @@ -439,11 +480,13 @@ wxString FootprintName = GetSelectedFootprint(); m_Parent->CreateScreenCmp(); /* refresh general */ } if ( Module ) msg = Module->m_Doc; if( Module ) msg = Module->m_Doc; m_Parent->SetStatusText( msg, 0 ); msg = wxT( "KeyW: " ); if( Module ) msg += Module->m_KeyWord; if( Module ) msg += Module->m_KeyWord; m_Parent->SetStatusText( msg, 1 ); } Loading @@ -457,6 +500,7 @@ wxString FootprintName = GetSelectedFootprint(); m_Parent->SetNewPkg( FootprintName ); } /**************************************************************/ STOREMOD* GetModuleDescrByName( const wxString& FootprintName ) /**************************************************************/ Loading @@ -468,5 +512,6 @@ STOREMOD * FootprintItem = g_BaseListePkg; if( FootprintItem->m_Module == FootprintName ) break; // found ! } return FootprintItem; } include/wxstruct.h +1 −1 Original line number Diff line number Diff line Loading @@ -1409,7 +1409,7 @@ class WinEDA_MsgPanel : public wxPanel protected: std::vector<MsgItem> m_Items; void showItem( wxWindowDC& dc, const MsgItem& aItem ); void showItem( wxDC& dc, const MsgItem& aItem ); public: WinEDA_DrawFrame* m_Parent; Loading Loading
change_log.txt +8 −0 Original line number Diff line number Diff line Loading @@ -4,6 +4,14 @@ Started 2007-June-11 Please add newer entries at the top, list the date and your name with email address. 2007-Oct-29 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr> ================================================================================ +cvpcb: listboxes.cpp problem solved: Workaround for a curious bug in wxWidgets: if we switch from a long list of footprints to a short list (a filtered footprint list), and if the selected item is near the end of the long list, the new list is not displayed from the top of the list box 2007-Oct-27 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr> ================================================================================ + all: Loading
common/edaappl.cpp +26 −21 Original line number Diff line number Diff line Loading @@ -54,21 +54,21 @@ * The real font size will be computed at run time */ /*****************************/ /* Constructeur de WinEDA_App */ /*****************************/ /**************************/ /* WinEDA_App Constructor */ /**************************/ WinEDA_App::WinEDA_App() { m_Checker = NULL; m_MainFrame = NULL; m_PcbFrame = NULL; m_ModuleEditFrame = NULL; // Edition des modules m_SchematicFrame = NULL; // Edition des Schemas m_LibeditFrame = NULL; // Edition des composants m_ViewlibFrame = NULL; // Visualisation des composants m_ModuleEditFrame = NULL; // Frame for footprint edition m_SchematicFrame = NULL; // Frame for schematic edition m_LibeditFrame = NULL; // Frame for component edition m_ViewlibFrame = NULL; // Frame for browsing component libraries m_CvpcbFrame = NULL; m_GerberFrame = NULL; // ecran de visualisation GERBER m_GerberFrame = NULL; // Frame for the gerber viewer GERBVIEW m_LastProjectMaxCount = 10; m_HtmlCtrl = NULL; Loading @@ -83,15 +83,15 @@ WinEDA_App::WinEDA_App() } /*****************************/ /* Destructeur de WinEDA_App */ /*****************************/ /*************************/ /* WinEDA_App Destructor */ /*************************/ WinEDA_App::~WinEDA_App() { SaveSettings(); /* delete data non directement geree par wxAppl */ /* delete user datas */ delete g_Prj_Config; delete m_EDA_Config; delete m_EDA_CommonConfig; Loading @@ -116,10 +116,12 @@ void WinEDA_App::InitEDA_Appl( const wxString& name ) ident = name + wxT( "-" ) + wxGetUserId(); m_Checker = new wxSingleInstanceChecker( ident ); /* Init environnement * (KICAD definit le chemin de kicad ex: set KICAD=d:\kicad) */ /* Init kicad environment * the environment variable KICAD (if exists) gives the kicad path: * something like set KICAD=d:\kicad */ m_Env_Defined = wxGetEnv( wxT( "KICAD" ), &m_KicadEnv ); if( m_Env_Defined ) // m_KicadEnv doit finir par "/" ou "\" if( m_Env_Defined ) // ensure m_KicadEnv ends by "/" { m_KicadEnv.Replace( WIN_STRING_DIR_SEP, UNIX_STRING_DIR_SEP ); if( m_KicadEnv.Last() != '/' ) Loading @@ -129,13 +131,13 @@ void WinEDA_App::InitEDA_Appl( const wxString& name ) /* Prepare On Line Help */ m_HelpFileName = name + wxT( ".html" ); // Init parametres pour configuration // Init parameters for configuration SetVendorName( wxT( "kicad" ) ); SetAppName( name ); m_EDA_Config = new wxConfig( name ); m_EDA_CommonConfig = new wxConfig( wxT( "kicad_common" ) ); /* Creation des fontes utiles */ /* Create the fontes used in dialogs and messages */ g_StdFontPointSize = FONT_DEFAULT_SIZE; g_MsgFontPointSize = FONT_DEFAULT_SIZE; g_DialogFontPointSize = FONT_DEFAULT_SIZE; Loading @@ -155,12 +157,12 @@ void WinEDA_App::InitEDA_Appl( const wxString& name ) wxImage::AddHandler( new wxJPEGHandler ); wxFileSystem::AddHandler( new wxZipFSHandler ); // Analyse command line & init binary path // Analyse the command line & init binary path SetBinDir(); ReadPdfBrowserInfos(); // Internationalisation: chargement du Dictionnaire de kicad // Internationalisation: loading the kicad suitable Dictionnary m_EDA_CommonConfig->Read( wxT( "Language" ), &m_LanguageId, wxLANGUAGE_DEFAULT ); bool succes = SetLanguage( TRUE ); Loading Loading @@ -262,7 +264,7 @@ bool WinEDA_App::SetBinDir() void WinEDA_App::GetSettings() /*********************************/ /* Lit les infos utiles sauvees lors de la derniere utilisation du logiciel /* Get the last setup used (fontes, files opened...) */ { wxString Line, Ident; Loading Loading @@ -639,8 +641,11 @@ wxMenu* WinEDA_App::SetLanguageList( wxMenu* MasterMenu ) } /**********************/ int WinEDA_App::OnRun() /* Run init scripts */ /**********************/ /* Run init scripts */ { #ifdef KICAD_PYTHON PyHandler::GetInstance()->RunScripts(); Loading
common/msgpanel.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -141,7 +141,7 @@ void WinEDA_MsgPanel::Affiche_1_Parametre( int pos_X, const wxString& texte_H, } void WinEDA_MsgPanel::showItem( wxWindowDC& dc, const MsgItem& aItem ) void WinEDA_MsgPanel::showItem( wxDC& dc, const MsgItem& aItem ) { int color = aItem.m_Color; Loading
cvpcb/listboxes.cpp +307 −262 Original line number Diff line number Diff line Loading @@ -12,9 +12,10 @@ #include "protos.h" /************************************************************************/ /* Class (from wxListView) for displaying component and footprint lists */ /************************************************************************/ /******************************************************************************/ /* Basic class (from wxListView) for displaying component and footprint lists */ /* Not directly used: the 2 list boxes actually used are derived from it */ /******************************************************************************/ ListBoxBase::ListBoxBase( WinEDA_CvpcbFrame* parent, wxWindowID id, const wxPoint& loc, const wxSize& size ) : Loading @@ -28,14 +29,15 @@ ListBoxBase::ListBoxBase(WinEDA_CvpcbFrame * parent, } ListBoxBase::~ListBoxBase() { } /************************************************/ void ListBoxBase::OnSize( wxSizeEvent& event ) /************************************************/ // Ajust the column width to the entire available window width { wxSize size = GetClientSize(); Loading @@ -52,15 +54,16 @@ int width = 0; /*********************************/ int ListBoxBase::GetSelection() /*********************************/ // Return an index for the selected item { return GetFirstSelected(); } /************************************************************/ /* ListBox derivee pour l'affichage de la liste des Modules */ /************************************************************/ /***************************************/ /* ListBox handling the footprint list */ /***************************************/ FootprintListBox::FootprintListBox( WinEDA_CvpcbFrame* parent, wxWindowID id, const wxPoint& loc, const wxSize& size, Loading @@ -71,7 +74,6 @@ FootprintListBox::FootprintListBox(WinEDA_CvpcbFrame * parent, } FootprintListBox::~FootprintListBox() { } Loading @@ -80,6 +82,7 @@ FootprintListBox::~FootprintListBox() /**********************************/ int FootprintListBox::GetCount() /**********************************/ // Return number of items { return m_ActiveFootprintList->Count(); Loading @@ -89,16 +92,20 @@ int FootprintListBox::GetCount() /*****************************************************************************/ void FootprintListBox::SetString( unsigned linecount, const wxString& text ) /*****************************************************************************/ // Change an item text { if( linecount >= m_ActiveFootprintList->Count() ) linecount = m_ActiveFootprintList->Count() - 1; if ( linecount >= 0 ) (*m_ActiveFootprintList)[linecount] = text; if( linecount >= 0 ) (*m_ActiveFootprintList)[linecount] = text; } /***************************************************/ wxString FootprintListBox::GetSelectedFootprint() /***************************************************/ // Return an index for the selected item { wxString FootprintName; Loading @@ -118,6 +125,7 @@ int ii = GetFirstSelected(); /*********************************************************/ void FootprintListBox::AppendLine( const wxString& text ) /*********************************************************/ // Add an item at end of list { m_ActiveFootprintList->Add( text ); Loading @@ -128,19 +136,23 @@ void FootprintListBox::AppendLine(const wxString & text) /*********************************************************************/ wxString FootprintListBox::OnGetItemText( long item, long column ) const /*********************************************************************/ /* Overlayed function: MUST be provided in wxLC_VIRTUAL mode because real datas are not handled by ListBoxBase * because real datas are not handled by ListBoxBase */ { return m_ActiveFootprintList->Item( item ); } /*****************************************************************/ void FootprintListBox::SetSelection( unsigned index, bool State ) /*****************************************************************/ // Enable or disable an item { if ( (int) index >= GetCount() ) index = GetCount()-1; if( (int) index >= GetCount() ) index = GetCount() - 1; #ifndef __WXMAC__ Select( index, State ); Loading @@ -152,9 +164,9 @@ void FootprintListBox::SetSelection(unsigned index, bool State) } /***************************************************************/ /* ListBox derivee pour l'affichage de la liste des Composants */ /***************************************************************/ /**************************************************/ /* ListBox handling the schematic components list */ /**************************************************/ ListBoxCmp::ListBoxCmp( WinEDA_CvpcbFrame* parent, wxWindowID id, const wxPoint& loc, const wxSize& size, Loading @@ -164,16 +176,13 @@ ListBoxCmp::ListBoxCmp(WinEDA_CvpcbFrame * parent, wxWindowID id, } ListBoxCmp::~ListBoxCmp() { } /***********************************************************************/ /* Construction de la table des evenements pour la fenetre des composants */ /***********************************************************************/ /* Build the events table for the schematic components list box */ BEGIN_EVENT_TABLE( ListBoxCmp, LIST_BOX_TYPE ) EVT_SIZE( ListBoxBase::OnSize ) Loading @@ -183,32 +192,41 @@ END_EVENT_TABLE() /****************************/ void ListBoxCmp::Clear() /****************************/ // Reset ALL datas { m_ComponentList.Clear(); SetItemCount( 0 ); } /******************************/ int ListBoxCmp::GetCount() /******************************/ // Return number of items { return m_ComponentList.Count(); } /********************************************************************/ void ListBoxCmp::SetString( unsigned linecount, const wxString& text ) /********************************************************************/ // Change an item text { if( linecount >= m_ComponentList.Count() ) linecount = m_ComponentList.Count() - 1; if ( linecount >= 0 ) m_ComponentList[linecount] = text; if( linecount >= 0 ) m_ComponentList[linecount] = text; } /****************************************************/ void ListBoxCmp::AppendLine( const wxString& text ) /****************************************************/ // Add an item at end of list { m_ComponentList.Add( text ); Loading @@ -219,19 +237,23 @@ void ListBoxCmp::AppendLine(const wxString & text) /****************************************************************/ wxString ListBoxCmp::OnGetItemText( long item, long column ) const /****************************************************************/ /* Overlayed function: MUST be provided in wxLC_VIRTUAL mode because real datas are not handled by ListBoxBase * because real datas are not handled by ListBoxBase */ { return m_ComponentList.Item( item ); } /********************************************************/ void ListBoxCmp::SetSelection( unsigned index, bool State ) /*********************************************************/ // Enable or disable an item { if ( (int) index >= GetCount() ) index = GetCount()-1; if( (int) index >= GetCount() ) index = GetCount() - 1; #ifndef __WXMAC__ Select( index, State ); Loading @@ -242,14 +264,12 @@ void ListBoxCmp::SetSelection(unsigned index, bool State) #endif } /********************************************/ void WinEDA_CvpcbFrame::BuildCmpListBox() /********************************************/ /* Construit la fenetre d'affichage de la liste des composant. dimx et dimy sont les dimensions de la surface totale d'affichage et non les dims de la fenetre des Cmp Si la fenetre d'affichage a deja ete creee, il y a seulement mise a jour de la liste /* Create or update the schematic components list. */ { int ii; Loading @@ -276,20 +296,18 @@ wxSize size(10,10); Composant->m_Module.GetData() ); m_ListCmp->m_ComponentList.Add( msg ); } m_ListCmp->SetItemCount( m_ListCmp->m_ComponentList.Count() ); m_ListCmp->SetSelection( 0, TRUE ); } /*************************************************************/ /**********************************************/ void WinEDA_CvpcbFrame::BuildFootprintListBox() /*************************************************************/ /* Construit la fenetre d'affichage de la liste des Modules. dimx et dimy sont les dimensions de la surface totale d'affichage et non les dims de la fenetre des Modules Si la fenetre d'affichage a deja ete creee, il y a seulement mise a jour de la liste /**********************************************/ /* Create or update the footprint list. */ { wxString msg; Loading Loading @@ -336,6 +354,7 @@ int OldSelection = GetSelection(); Refresh(); } /**********************************************************************/ void FootprintListBox::SetFootprintFilteredList( STORECMP* Component ) /*********************************************************************/ Loading @@ -362,10 +381,10 @@ bool HasItem = FALSE; } } if ( HasItem ) SetActiveFootprintList(FALSE); else SetActiveFootprintList(TRUE); if( HasItem ) SetActiveFootprintList( FALSE ); else SetActiveFootprintList( TRUE ); if( (GetCount() == 0) || ( OldSelection >= GetCount() ) ) SetSelection( 0, TRUE ); Loading @@ -377,9 +396,30 @@ bool HasItem = FALSE; /**************************************************************************/ void FootprintListBox::SetActiveFootprintList( bool FullList, bool Redraw ) /**************************************************************************/ /** Set the footprint list. We can have 2 footprint list: * The full footprint list * The filtered footprint list (if the current selected component has a filter for footprints) * @param FullList true = full footprint list, false = filtered footprint list * @param Redraw = true to redraw the window */ { bool old_selection = m_UseFootprintFullList; /* Workaround for a curious bug in wxWidgets: * if we switch from a long list of footprints to a short list (a filtered footprint list), * and if the selected item is near the end of the long list, * the new list is not displayed from the top of the list box */ if ( m_ActiveFootprintList ) { bool new_selection; if( FullList ) new_selection = TRUE; else new_selection = FALSE; if( new_selection != old_selection ) SetSelection( 0, TRUE ); } if( FullList ) { m_UseFootprintFullList = TRUE; Loading Loading @@ -415,9 +455,10 @@ bool old_selection = m_UseFootprintFullList; m_Parent->SetStatusText( msg, 2 ); } /***********************************************************************/ /* Construction de la table des evenements pour la fenetre des modules */ /***********************************************************************/ /**************************************/ /* Event table for the footprint list */ /**************************************/ BEGIN_EVENT_TABLE( FootprintListBox, LIST_BOX_TYPE ) EVT_SIZE( ListBoxBase::OnSize ) Loading @@ -439,11 +480,13 @@ wxString FootprintName = GetSelectedFootprint(); m_Parent->CreateScreenCmp(); /* refresh general */ } if ( Module ) msg = Module->m_Doc; if( Module ) msg = Module->m_Doc; m_Parent->SetStatusText( msg, 0 ); msg = wxT( "KeyW: " ); if( Module ) msg += Module->m_KeyWord; if( Module ) msg += Module->m_KeyWord; m_Parent->SetStatusText( msg, 1 ); } Loading @@ -457,6 +500,7 @@ wxString FootprintName = GetSelectedFootprint(); m_Parent->SetNewPkg( FootprintName ); } /**************************************************************/ STOREMOD* GetModuleDescrByName( const wxString& FootprintName ) /**************************************************************/ Loading @@ -468,5 +512,6 @@ STOREMOD * FootprintItem = g_BaseListePkg; if( FootprintItem->m_Module == FootprintName ) break; // found ! } return FootprintItem; }
include/wxstruct.h +1 −1 Original line number Diff line number Diff line Loading @@ -1409,7 +1409,7 @@ class WinEDA_MsgPanel : public wxPanel protected: std::vector<MsgItem> m_Items; void showItem( wxWindowDC& dc, const MsgItem& aItem ); void showItem( wxDC& dc, const MsgItem& aItem ); public: WinEDA_DrawFrame* m_Parent; Loading