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 ) ...@@ -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. /* Remove a library to the library list.
* The real list (g_LibName_List) is not changed, so the change can be canceled * The real list (g_LibName_List) is not changed, so the change can be canceled
*/ */
void DIALOG_CVPCB_CONFIG::OnRemoveLibClick( wxCommandEvent& event ) void DIALOG_CVPCB_CONFIG::OnRemoveLibClick( wxCommandEvent& event )
{ {
int ii;
wxListBox * list = m_ListEquiv; wxListBox * list = m_ListEquiv;
if( event.GetId() == ID_REMOVE_LIB ) if( event.GetId() == ID_REMOVE_LIB )
list = m_ListLibr; list = m_ListLibr;
ii = list->GetSelection(); wxArrayInt selections;
if( ii < 0 )
return;
list->Delete( ii ); list->GetSelections(selections);
for( int ii = selections.GetCount()-1; ii >= 0; ii-- )
{
list->Delete(selections[ii] );
m_LibListChanged = TRUE; m_LibListChanged = TRUE;
}
} }
...@@ -182,8 +260,13 @@ void DIALOG_CVPCB_CONFIG::OnAddOrInsertLibClick( wxCommandEvent& event ) ...@@ -182,8 +260,13 @@ void DIALOG_CVPCB_CONFIG::OnAddOrInsertLibClick( wxCommandEvent& event )
wildcard = ModuleFileWildcard; wildcard = ModuleFileWildcard;
} }
ii = list->GetSelection(); wxArrayInt selections;
if( ii == wxNOT_FOUND ) list->GetSelections(selections);
ii = selections.GetCount();
if( ii > 0 )
ii = selections[0];
else
ii = 0; ii = 0;
wxString libpath; wxString libpath;
......
...@@ -31,6 +31,8 @@ private: ...@@ -31,6 +31,8 @@ private:
void OnBrowseModDocFile( wxCommandEvent& event ); void OnBrowseModDocFile( wxCommandEvent& event );
void OnAddOrInsertPath( wxCommandEvent& event ); void OnAddOrInsertPath( wxCommandEvent& event );
void OnRemoveUserPath( wxCommandEvent& event ); void OnRemoveUserPath( wxCommandEvent& event );
void OnButtonUpClick( wxCommandEvent& event );
void OnButtonDownClick( wxCommandEvent& event );
public: public:
......
This diff is collapsed.
This diff is collapsed.
...@@ -38,9 +38,13 @@ class DIALOG_CVPCB_CONFIG_FBP : public wxDialog ...@@ -38,9 +38,13 @@ class DIALOG_CVPCB_CONFIG_FBP : public wxDialog
ID_ADD_LIB = 1000, ID_ADD_LIB = 1000,
ID_INSERT_LIB, ID_INSERT_LIB,
ID_REMOVE_LIB, ID_REMOVE_LIB,
ID_LIB_UP,
ID_LIB_DOWN,
ID_ADD_EQU, ID_ADD_EQU,
ID_INSERT_EQU, ID_INSERT_EQU,
ID_REMOVE_EQU, ID_REMOVE_EQU,
ID_EQU_UP,
ID_EQU_DOWN,
ID_BROWSE_MOD_DOC, ID_BROWSE_MOD_DOC,
ID_LIB_PATH_SEL, ID_LIB_PATH_SEL,
ID_INSERT_PATH, ID_INSERT_PATH,
...@@ -51,10 +55,14 @@ class DIALOG_CVPCB_CONFIG_FBP : public wxDialog ...@@ -51,10 +55,14 @@ class DIALOG_CVPCB_CONFIG_FBP : public wxDialog
wxButton* m_buttonAddLib; wxButton* m_buttonAddLib;
wxButton* m_buttonInsLib; wxButton* m_buttonInsLib;
wxButton* m_buttonRemoveLib; wxButton* m_buttonRemoveLib;
wxButton* m_buttonLibUp;
wxButton* m_buttonLibDown;
wxListBox* m_ListEquiv; wxListBox* m_ListEquiv;
wxButton* m_buttonAddEqu; wxButton* m_buttonAddEqu;
wxButton* m_buttonInsEqu; wxButton* m_buttonInsEqu;
wxButton* m_buttonRemoveEqu; wxButton* m_buttonRemoveEqu;
wxButton* m_buttonEquUp;
wxButton* m_buttonEquDown;
wxTextCtrl* m_TextHelpModulesFileName; wxTextCtrl* m_TextHelpModulesFileName;
wxButton* m_buttonModDoc; wxButton* m_buttonModDoc;
wxListBox* m_listUserPaths; wxListBox* m_listUserPaths;
...@@ -71,6 +79,8 @@ class DIALOG_CVPCB_CONFIG_FBP : public wxDialog ...@@ -71,6 +79,8 @@ class DIALOG_CVPCB_CONFIG_FBP : public wxDialog
virtual void OnCloseWindow( wxCloseEvent& event ){ event.Skip(); } virtual void OnCloseWindow( wxCloseEvent& event ){ event.Skip(); }
virtual void OnAddOrInsertLibClick( wxCommandEvent& event ){ event.Skip(); } virtual void OnAddOrInsertLibClick( wxCommandEvent& event ){ event.Skip(); }
virtual void OnRemoveLibClick( 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 OnBrowseModDocFile( wxCommandEvent& event ){ event.Skip(); }
virtual void OnAddOrInsertPath( wxCommandEvent& event ){ event.Skip(); } virtual void OnAddOrInsertPath( wxCommandEvent& event ){ event.Skip(); }
virtual void OnRemoveUserPath( wxCommandEvent& event ){ event.Skip(); } virtual void OnRemoveUserPath( wxCommandEvent& event ){ event.Skip(); }
...@@ -79,7 +89,7 @@ class DIALOG_CVPCB_CONFIG_FBP : public wxDialog ...@@ -79,7 +89,7 @@ class DIALOG_CVPCB_CONFIG_FBP : public wxDialog
public: 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(); ~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