|
From: <re...@us...> - 2007-06-17 18:42:13
|
Revision: 190
http://svn.sourceforge.net/modplug/?rev=190&view=rev
Author: rewbs
Date: 2007-06-17 11:42:09 -0700 (Sun, 17 Jun 2007)
Log Message:
-----------
+ <rewbs> Add name filter to plugin selection dialog. Useful when you have hundreds of plugins.
Modified Paths:
--------------
trunk/OpenMPT/mptrack/Vstplug.cpp
trunk/OpenMPT/mptrack/Vstplug.h
trunk/OpenMPT/mptrack/mptrack.rc
trunk/OpenMPT/mptrack/resource.h
Modified: trunk/OpenMPT/mptrack/Vstplug.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Vstplug.cpp 2007-06-17 16:24:14 UTC (rev 189)
+++ trunk/OpenMPT/mptrack/Vstplug.cpp 2007-06-17 18:42:09 UTC (rev 190)
@@ -985,10 +985,11 @@
//
BEGIN_MESSAGE_MAP(CSelectPluginDlg, CDialog)
- ON_NOTIFY(TVN_SELCHANGED, IDC_TREE1, OnSelChanged)
- ON_NOTIFY(NM_DBLCLK, IDC_TREE1, OnSelDblClk)
- ON_COMMAND(IDC_BUTTON1, OnAddPlugin)
- ON_COMMAND(IDC_BUTTON2, OnRemovePlugin)
+ ON_NOTIFY(TVN_SELCHANGED, IDC_TREE1, OnSelChanged)
+ ON_NOTIFY(NM_DBLCLK, IDC_TREE1, OnSelDblClk)
+ ON_COMMAND(IDC_BUTTON1, OnAddPlugin)
+ ON_COMMAND(IDC_BUTTON2, OnRemovePlugin)
+ ON_EN_CHANGE(IDC_NAMEFILTER, OnNameFilterChanged)
ON_WM_SIZE()
ON_WM_GETMINMAXINFO()
END_MESSAGE_MAP()
@@ -996,7 +997,9 @@
void CSelectPluginDlg::DoDataExchange(CDataExchange* pDX)
//-------------------------------------------------------
{
+ CDialog::DoDataExchange(pDX);
DDX_Control(pDX, IDC_TREE1, m_treePlugins);
+ DDX_Text(pDX, IDC_NAMEFILTER, m_sNameFilter);
}
@@ -1199,6 +1202,14 @@
CDialog::OnCancel();
}
+void CSelectPluginDlg::OnNameFilterChanged()
+//-------------------------------------
+{
+ GetDlgItem(IDC_NAMEFILTER)->GetWindowText(m_sNameFilter);
+ m_sNameFilter = m_sNameFilter.MakeLower();
+ UpdatePluginsList();
+}
+
VOID CSelectPluginDlg::UpdatePluginsList(DWORD forceSelect/*=0*/)
//---------------------------------------------------------------
{
@@ -1231,18 +1242,31 @@
PVSTPLUGINLIB p = pManager->GetFirstPlugin();
while (p)
{
- if (p->dwPluginId1 == kDmoMagic)
- {
+ if (p->dwPluginId1 == kDmoMagic) {
tvis.hParent = hDmo;
- } else
- {
+ } else {
tvis.hParent = (p->bIsInstrument) ? hSynth : hVst;
}
+
+ // Apply name filter
+ if (m_sNameFilter != "") {
+ CString displayName = p->szLibraryName;
+ if (displayName.MakeLower().Find(m_sNameFilter) == -1) {
+ p = p->pNext;
+ continue;
+ }
+ }
+
tvis.hInsertAfter = TVI_SORT;
tvis.item.pszText = p->szLibraryName;
tvis.item.lParam = (LPARAM)p;
HTREEITEM h = m_treePlugins.InsertItem(&tvis);
+ //If filter is active, expand nodes.
+ if (m_sNameFilter != "") {
+ m_treePlugins.EnsureVisible(h);
+ }
+
//Which plugin should be selected?
if (m_pPlugin) {
@@ -1279,8 +1303,7 @@
}
}
m_treePlugins.SetRedraw(TRUE);
- if (cursel)
- {
+ if (cursel) {
m_treePlugins.SelectItem(cursel);
m_treePlugins.SetItemState(cursel, TVIS_BOLD, TVIS_BOLD);
m_treePlugins.EnsureVisible(cursel);
@@ -1400,11 +1423,13 @@
void CSelectPluginDlg::OnSize(UINT nType, int cx, int cy)
+//-------------------------------------------------------
{
CDialog::OnSize(nType, cx, cy);
if (m_treePlugins) {
- m_treePlugins.MoveWindow(11,11, cx-105, cy-40, FALSE);
+ m_treePlugins.MoveWindow(11, 33, cx-105, cy-63, FALSE);
+ ::MoveWindow(GetDlgItem(IDC_NAMEFILTER)->m_hWnd, 50, 11, cx-145, 21, FALSE);
::MoveWindow(GetDlgItem(IDC_TEXT1)->m_hWnd, 11,cy-25, cx-22, 25, FALSE);
::MoveWindow(GetDlgItem(IDOK)->m_hWnd, cx-85, 11, 75, 23, FALSE);
::MoveWindow(GetDlgItem(IDCANCEL)->m_hWnd, cx-85, 39, 75, 23, FALSE);
Modified: trunk/OpenMPT/mptrack/Vstplug.h
===================================================================
--- trunk/OpenMPT/mptrack/Vstplug.h 2007-06-17 16:24:14 UTC (rev 189)
+++ trunk/OpenMPT/mptrack/Vstplug.h 2007-06-17 18:42:09 UTC (rev 190)
@@ -232,6 +232,7 @@
PSNDMIXPLUGIN m_pPlugin;
CModDoc *m_pModDoc;
CTreeCtrl m_treePlugins;
+ CString m_sNameFilter;
public:
CSelectPluginDlg(CModDoc *pModDoc, int nPlugSlot, CWnd *parent); //rewbs.plugDocAware
@@ -244,6 +245,7 @@
virtual VOID OnCancel();
afx_msg void OnAddPlugin();
afx_msg void OnRemovePlugin();
+ afx_msg void OnNameFilterChanged();
afx_msg void OnSelChanged(NMHDR *pNotifyStruct, LRESULT * result);
afx_msg void OnSelDblClk(NMHDR *pNotifyStruct, LRESULT * result);
DECLARE_MESSAGE_MAP()
Modified: trunk/OpenMPT/mptrack/mptrack.rc
===================================================================
--- trunk/OpenMPT/mptrack/mptrack.rc 2007-06-17 16:24:14 UTC (rev 189)
+++ trunk/OpenMPT/mptrack/mptrack.rc 2007-06-17 18:42:09 UTC (rev 190)
@@ -1621,14 +1621,16 @@
CAPTION "Mix Plugins"
FONT 8, "MS Sans Serif", 0, 0, 0x1
BEGIN
+ EDITTEXT IDC_NAMEFILTER,28,7,127,14,ES_AUTOHSCROLL
+ CONTROL "Tree1",IDC_TREE1,"SysTreeView32",TVS_DISABLEDRAGDROP |
+ TVS_SHOWSELALWAYS | WS_TABSTOP,7,21,148,126,
+ WS_EX_CLIENTEDGE
DEFPUSHBUTTON "Add to Song",IDOK,161,7,50,14
+ PUSHBUTTON "New plugin...",IDC_BUTTON1,161,46,50,14,BS_MULTILINE
+ PUSHBUTTON "Remove",IDC_BUTTON2,161,63,50,14
PUSHBUTTON "Cancel",IDCANCEL,161,132,50,14
LTEXT "",IDC_TEXT1,7,151,204,8
- PUSHBUTTON "New plugin...",IDC_BUTTON1,161,46,50,14,BS_MULTILINE
- PUSHBUTTON "Remove",IDC_BUTTON2,161,63,50,14
- CONTROL "Tree1",IDC_TREE1,"SysTreeView32",TVS_DISABLEDRAGDROP |
- TVS_SHOWSELALWAYS | WS_TABSTOP,7,7,148,140,
- WS_EX_CLIENTEDGE
+ LTEXT "Filter:",IDC_STATIC,8,9,18,8
END
IDD_PLUGINEDITOR DIALOGEX 0, 0, 187, 95
Modified: trunk/OpenMPT/mptrack/resource.h
===================================================================
--- trunk/OpenMPT/mptrack/resource.h 2007-06-17 16:24:14 UTC (rev 189)
+++ trunk/OpenMPT/mptrack/resource.h 2007-06-17 18:42:09 UTC (rev 190)
@@ -789,6 +789,7 @@
#define IDC_TEXT_RPB 2301
#define IDC_SPIN_RPB 2302
#define IDC_EDIT_RPB 2303
+#define IDC_NAMEFILTER 2304
#define ID_FILE_NEWMOD 32771
#define ID_FILE_NEWXM 32772
#define ID_FILE_NEWS3M 32773
@@ -1015,7 +1016,7 @@
#define _APS_3D_CONTROLS 1
#define _APS_NEXT_RESOURCE_VALUE 515
#define _APS_NEXT_COMMAND_VALUE 59211
-#define _APS_NEXT_CONTROL_VALUE 2304
+#define _APS_NEXT_CONTROL_VALUE 2305
#define _APS_NEXT_SYMED_VALUE 901
#endif
#endif
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|