Commit a826420b authored by charras's avatar charras

Enhancements in Cvpcb libraries config dialog

parent 59782e2f
......@@ -137,24 +137,102 @@ void DIALOG_CVPCB_CONFIG::OnCloseWindow( wxCloseEvent& event )
}
/********************************************************************/
void DIALOG_CVPCB_CONFIG::OnButtonUpClick( wxCommandEvent& event )
/********************************************************************/
{
wxListBox * list = m_ListLibr;
if( (event.GetId() == ID_EQU_UP) || (event.GetId() == ID_EQU_DOWN) )
{
list = m_ListEquiv;
}
wxArrayInt selections;
list->GetSelections(selections);
if ( selections.GetCount() <= 0 ) // No selection.
return;
if( selections[0] == 0 ) // The first lib is selected. cannot move up it
return;
wxArrayString libnames = list->GetStrings();
for( size_t ii = 0; ii < selections.GetCount(); ii++ )
{
int jj = selections[ii];
EXCHG( libnames[jj], libnames[jj-1]);
}
list->Set(libnames);
// Reselect previously selected names
for( size_t ii = 0; ii < selections.GetCount(); ii++ )
{
int jj = selections[ii];
list->SetSelection(jj-1);
}
m_LibListChanged = TRUE;
}
/*********************************************************************/
void DIALOG_CVPCB_CONFIG::OnButtonDownClick( wxCommandEvent& event )
/*********************************************************************/
{
wxListBox * list = m_ListLibr;
if( (event.GetId() == ID_EQU_UP) || (event.GetId() == ID_EQU_DOWN) )
{
list = m_ListEquiv;
}
wxArrayInt selections;
list->GetSelections(selections);
if ( selections.GetCount() <= 0 ) // No selection.
return;
// The last lib is selected. cannot move down it
if( selections.Last() == (int)(list->GetCount()-1) )
return;
wxArrayString libnames = list->GetStrings();
for( int ii = selections.GetCount()-1; ii >= 0; ii-- )
{
int jj = selections[ii];
EXCHG( libnames[jj], libnames[jj+1]);
}
list->Set(libnames);
// Reselect previously selected names
for( size_t ii = 0; ii < selections.GetCount(); ii++ )
{
int jj = selections[ii];
list->SetSelection(jj+1);
}
m_LibListChanged = TRUE;
}
/* Remove a library to the library list.
* The real list (g_LibName_List) is not changed, so the change can be canceled
*/
void DIALOG_CVPCB_CONFIG::OnRemoveLibClick( wxCommandEvent& event )
{
int ii;
wxListBox * list = m_ListEquiv;
if( event.GetId() == ID_REMOVE_LIB )
list = m_ListLibr;
ii = list->GetSelection();
if( ii < 0 )
return;
wxArrayInt selections;
list->Delete( ii );
m_LibListChanged = TRUE;
list->GetSelections(selections);
for( int ii = selections.GetCount()-1; ii >= 0; ii-- )
{
list->Delete(selections[ii] );
m_LibListChanged = TRUE;
}
}
......@@ -182,8 +260,13 @@ void DIALOG_CVPCB_CONFIG::OnAddOrInsertLibClick( wxCommandEvent& event )
wildcard = ModuleFileWildcard;
}
ii = list->GetSelection();
if( ii == wxNOT_FOUND )
wxArrayInt selections;
list->GetSelections(selections);
ii = selections.GetCount();
if( ii > 0 )
ii = selections[0];
else
ii = 0;
wxString libpath;
......
......@@ -31,6 +31,8 @@ private:
void OnBrowseModDocFile( wxCommandEvent& event );
void OnAddOrInsertPath( wxCommandEvent& event );
void OnRemoveUserPath( wxCommandEvent& event );
void OnButtonUpClick( wxCommandEvent& event );
void OnButtonDownClick( wxCommandEvent& event );
public:
......
This diff is collapsed.
This diff is collapsed.
......@@ -38,9 +38,13 @@ class DIALOG_CVPCB_CONFIG_FBP : public wxDialog
ID_ADD_LIB = 1000,
ID_INSERT_LIB,
ID_REMOVE_LIB,
ID_LIB_UP,
ID_LIB_DOWN,
ID_ADD_EQU,
ID_INSERT_EQU,
ID_REMOVE_EQU,
ID_EQU_UP,
ID_EQU_DOWN,
ID_BROWSE_MOD_DOC,
ID_LIB_PATH_SEL,
ID_INSERT_PATH,
......@@ -51,10 +55,14 @@ class DIALOG_CVPCB_CONFIG_FBP : public wxDialog
wxButton* m_buttonAddLib;
wxButton* m_buttonInsLib;
wxButton* m_buttonRemoveLib;
wxButton* m_buttonLibUp;
wxButton* m_buttonLibDown;
wxListBox* m_ListEquiv;
wxButton* m_buttonAddEqu;
wxButton* m_buttonInsEqu;
wxButton* m_buttonRemoveEqu;
wxButton* m_buttonEquUp;
wxButton* m_buttonEquDown;
wxTextCtrl* m_TextHelpModulesFileName;
wxButton* m_buttonModDoc;
wxListBox* m_listUserPaths;
......@@ -71,6 +79,8 @@ class DIALOG_CVPCB_CONFIG_FBP : public wxDialog
virtual void OnCloseWindow( wxCloseEvent& event ){ event.Skip(); }
virtual void OnAddOrInsertLibClick( wxCommandEvent& event ){ event.Skip(); }
virtual void OnRemoveLibClick( wxCommandEvent& event ){ event.Skip(); }
virtual void OnButtonUpClick( wxCommandEvent& event ){ event.Skip(); }
virtual void OnButtonDownClick( wxCommandEvent& event ){ event.Skip(); }
virtual void OnBrowseModDocFile( wxCommandEvent& event ){ event.Skip(); }
virtual void OnAddOrInsertPath( wxCommandEvent& event ){ event.Skip(); }
virtual void OnRemoveUserPath( wxCommandEvent& event ){ event.Skip(); }
......@@ -79,7 +89,7 @@ class DIALOG_CVPCB_CONFIG_FBP : public wxDialog
public:
DIALOG_CVPCB_CONFIG_FBP( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
DIALOG_CVPCB_CONFIG_FBP( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 570,625 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_CVPCB_CONFIG_FBP();
};
......
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