parent
0bd8f6f7e0
commit
5b9cd0b2e5
|
@ -75,9 +75,9 @@ bool findStrNoCase(const generic_string & strHaystack, const generic_string & st
|
||||||
return (it != strHaystack.end());
|
return (it != strHaystack.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PluginsAdminDlg::isFoundInAvailableListFromIndex(int index, const generic_string& str2search, bool inWhichPart) const
|
bool PluginsAdminDlg::isFoundInAvailableListFromIndex(const PluginViewList& inWhichList, int index, const generic_string& str2search, bool inWhichPart) const
|
||||||
{
|
{
|
||||||
PluginUpdateInfo* pui = _availableList.getPluginInfoFromUiIndex(index);
|
PluginUpdateInfo* pui = inWhichList.getPluginInfoFromUiIndex(index);
|
||||||
generic_string searchIn;
|
generic_string searchIn;
|
||||||
if (inWhichPart == _inNames)
|
if (inWhichPart == _inNames)
|
||||||
searchIn = pui->_displayName;
|
searchIn = pui->_displayName;
|
||||||
|
@ -87,17 +87,17 @@ bool PluginsAdminDlg::isFoundInAvailableListFromIndex(int index, const generic_s
|
||||||
return (findStrNoCase(searchIn, str2search));
|
return (findStrNoCase(searchIn, str2search));
|
||||||
}
|
}
|
||||||
|
|
||||||
long PluginsAdminDlg::searchFromCurrentSel(const generic_string& str2search, bool inWhichPart, bool isNextMode) const
|
long PluginsAdminDlg::searchFromCurrentSel(const PluginViewList& inWhichList, const generic_string& str2search, bool inWhichPart, bool isNextMode) const
|
||||||
{
|
{
|
||||||
// search from curent selected item or from the beginning
|
// search from curent selected item or from the beginning
|
||||||
long currentIndex = _availableList.getSelectedIndex();
|
long currentIndex = inWhichList.getSelectedIndex();
|
||||||
int nbItem = static_cast<int>(_availableList.nbItem());
|
int nbItem = static_cast<int>(inWhichList.nbItem());
|
||||||
if (currentIndex == -1)
|
if (currentIndex == -1)
|
||||||
{
|
{
|
||||||
// no selection, let's search from 0 to the end
|
// no selection, let's search from 0 to the end
|
||||||
for (int i = 0; i < nbItem; ++i)
|
for (int i = 0; i < nbItem; ++i)
|
||||||
{
|
{
|
||||||
if (isFoundInAvailableListFromIndex(i, str2search, inWhichPart))
|
if (isFoundInAvailableListFromIndex(inWhichList, i, str2search, inWhichPart))
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -106,14 +106,14 @@ long PluginsAdminDlg::searchFromCurrentSel(const generic_string& str2search, boo
|
||||||
// from current position to the end
|
// from current position to the end
|
||||||
for (int i = currentIndex + (isNextMode ? 1 : 0); i < nbItem; ++i)
|
for (int i = currentIndex + (isNextMode ? 1 : 0); i < nbItem; ++i)
|
||||||
{
|
{
|
||||||
if (isFoundInAvailableListFromIndex(i, str2search, inWhichPart))
|
if (isFoundInAvailableListFromIndex(inWhichList, i, str2search, inWhichPart))
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
// from to begining to current position
|
// from to begining to current position
|
||||||
for (int i = 0; i < currentIndex + (isNextMode ? 1 : 0); ++i)
|
for (int i = 0; i < currentIndex + (isNextMode ? 1 : 0); ++i)
|
||||||
{
|
{
|
||||||
if (isFoundInAvailableListFromIndex(i, str2search, inWhichPart))
|
if (isFoundInAvailableListFromIndex(inWhichList, i, str2search, inWhichPart))
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1072,14 +1072,36 @@ bool PluginsAdminDlg::searchInPlugins(bool isNextMode) const
|
||||||
if (lstrlen(txt2search) < 2)
|
if (lstrlen(txt2search) < 2)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
long foundIndex = searchInNamesFromCurrentSel(txt2search, isNextMode);
|
HWND tabHandle = _tab.getHSelf();
|
||||||
|
int inWhichTab = int(::SendMessage(tabHandle, TCM_GETCURSEL, 0, 0));
|
||||||
|
|
||||||
|
const PluginViewList* inWhichList = nullptr;
|
||||||
|
switch (inWhichTab)
|
||||||
|
{
|
||||||
|
case 3:
|
||||||
|
inWhichList = &_incompatibleList;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
inWhichList = &_installedList;
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
inWhichList = &_updateList;
|
||||||
|
break;
|
||||||
|
case 0:
|
||||||
|
default:
|
||||||
|
inWhichList = &_availableList;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
long foundIndex = searchInNamesFromCurrentSel(*inWhichList, txt2search, isNextMode);
|
||||||
if (foundIndex == -1)
|
if (foundIndex == -1)
|
||||||
foundIndex = searchInDescsFromCurrentSel(txt2search, isNextMode);
|
foundIndex = searchInDescsFromCurrentSel(*inWhichList, txt2search, isNextMode);
|
||||||
|
|
||||||
if (foundIndex == -1)
|
if (foundIndex == -1)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
_availableList.setSelection(foundIndex);
|
inWhichList->setSelection(foundIndex);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -212,14 +212,14 @@ private :
|
||||||
bool searchInPlugins(bool isNextMode) const;
|
bool searchInPlugins(bool isNextMode) const;
|
||||||
const bool _inNames = true;
|
const bool _inNames = true;
|
||||||
const bool _inDescs = false;
|
const bool _inDescs = false;
|
||||||
bool isFoundInAvailableListFromIndex(int index, const generic_string& str2search, bool inWhichPart) const;
|
bool isFoundInAvailableListFromIndex(const PluginViewList& inWhichList,int index, const generic_string& str2search, bool inWhichPart) const;
|
||||||
long searchFromCurrentSel(const generic_string& str2search, bool inWhichPart, bool isNextMode) const;
|
long searchFromCurrentSel(const PluginViewList& inWhichList, const generic_string& str2search, bool inWhichPart, bool isNextMode) const;
|
||||||
long searchInNamesFromCurrentSel(const generic_string& str2search, bool isNextMode) const {
|
long searchInNamesFromCurrentSel(const PluginViewList& inWhichList, const generic_string& str2search, bool isNextMode) const {
|
||||||
return searchFromCurrentSel(str2search, _inNames, isNextMode);
|
return searchFromCurrentSel(inWhichList, str2search, _inNames, isNextMode);
|
||||||
};
|
};
|
||||||
|
|
||||||
long searchInDescsFromCurrentSel(const generic_string& str2search, bool isNextMode) const {
|
long searchInDescsFromCurrentSel(const PluginViewList& inWhichList, const generic_string& str2search, bool isNextMode) const {
|
||||||
return searchFromCurrentSel(str2search, _inDescs, isNextMode);
|
return searchFromCurrentSel(inWhichList, str2search, _inDescs, isNextMode);
|
||||||
};
|
};
|
||||||
|
|
||||||
bool initAvailablePluginsViewFromList();
|
bool initAvailablePluginsViewFromList();
|
||||||
|
|
Loading…
Reference in New Issue