From ffdfe6174df8588431820198205d01c1fa970627 Mon Sep 17 00:00:00 2001 From: Thomas Braun Date: Wed, 29 Jan 2025 16:56:03 +0100 Subject: [PATCH 1/6] WBP_ToggleAnalysisParamGUI: Prefer mode 9 over 4 This uses more intuitive shortcuts for selecting multiple cells. Although we don't need multiple cells here, it is much easier to use a mode which fill selWave. Which mode 1-2 don't do. --- Packages/MIES/MIES_WaveBuilderPanel.ipf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Packages/MIES/MIES_WaveBuilderPanel.ipf b/Packages/MIES/MIES_WaveBuilderPanel.ipf index df7273d5b9..1092004fbd 100644 --- a/Packages/MIES/MIES_WaveBuilderPanel.ipf +++ b/Packages/MIES/MIES_WaveBuilderPanel.ipf @@ -1829,7 +1829,7 @@ static Function WBP_ToggleAnalysisParamGUI() ListBox list_params, listWave=listWave ListBox list_params, selWave=selWave ListBox list_params, helpWave=helpWave - ListBox list_params, mode=4, widths={180, 60, 120, 60, 600}, userColumnResize=1 + ListBox list_params, mode=9, widths={180, 60, 120, 60, 600}, userColumnResize=1 ListBox list_params, userdata(ResizeControlsInfo)=A"!!,I!J,hkh!!#D1!!#B1z!!#N3Bk1ct Date: Wed, 29 Jan 2025 18:11:02 +0100 Subject: [PATCH 2/6] AnalysisBrowser: Prefer Listbox mode 9 This is more intuitive to use. As that mode sets either LISTBOX_SELECTED or LISTBOX_SHIFT_SELECTION for a seleted cell, we have to adapt the FindIndizes calls to search for that, and also search for it as bitmask. --- Packages/MIES/MIES_AnalysisBrowser.ipf | 20 ++++++++++---------- Packages/MIES/MIES_AnalysisBrowser_Macro.ipf | 4 ++-- Packages/MIES/MIES_Constants.ipf | 19 ++++++++++--------- 3 files changed, 22 insertions(+), 21 deletions(-) diff --git a/Packages/MIES/MIES_AnalysisBrowser.ipf b/Packages/MIES/MIES_AnalysisBrowser.ipf index 38e861c603..316aa1c484 100644 --- a/Packages/MIES/MIES_AnalysisBrowser.ipf +++ b/Packages/MIES/MIES_AnalysisBrowser.ipf @@ -1353,8 +1353,8 @@ static Function/WAVE AB_ReturnAndClearGUISelBits() WAVE expBrowserSel = GetExperimentBrowserGUISel() - Make/FREE/N=(DimSize(expBrowserSel, ROWS)) selBits = expBrowserSel[p][0] & LISTBOX_SELECTED - expBrowserSel[][0] = expBrowserSel[p][0] & ~LISTBOX_SELECTED + Make/FREE/N=(DimSize(expBrowserSel, ROWS)) selBits = expBrowserSel[p][0] & LISTBOX_SELECT_OR_SHIFT_SELECTION + expBrowserSel[][0] = expBrowserSel[p][0] & ~LISTBOX_SELECT_OR_SHIFT_SELECTION return selBits End @@ -1473,7 +1473,7 @@ static Function/WAVE AB_GetExpandedIndices() WAVE expBrowserSel = GetExperimentBrowserGUISel() // Our mode for the listbox stores the selection bit only in the first column - WAVE/Z wv = FindIndizes(expBrowserSel, var = 1, prop = PROP_MATCHES_VAR_BIT_MASK) + WAVE/Z wv = FindIndizes(expBrowserSel, var = LISTBOX_SELECT_OR_SHIFT_SELECTION, prop = PROP_MATCHES_VAR_BIT_MASK) if(!WaveExists(wv)) Make/FREE/N=0 wv return wv @@ -1488,12 +1488,12 @@ static Function/WAVE AB_GetExpandedIndices() // we have to refetch the selected entries if(!AB_ExpandIfCollapsed(row, EXPERIMENT_TREEVIEW_COLUMN)) - WAVE wv = FindIndizes(expBrowserSel, var = 1, prop = PROP_MATCHES_VAR_BIT_MASK) + WAVE wv = FindIndizes(expBrowserSel, var = LISTBOX_SELECT_OR_SHIFT_SELECTION, prop = PROP_MATCHES_VAR_BIT_MASK) i = 0 endif if(!AB_ExpandIfCollapsed(row, DEVICE_TREEVIEW_COLUMN)) - WAVE wv = FindIndizes(expBrowserSel, var = 1, prop = PROP_MATCHES_VAR_BIT_MASK) + WAVE wv = FindIndizes(expBrowserSel, var = LISTBOX_SELECT_OR_SHIFT_SELECTION, prop = PROP_MATCHES_VAR_BIT_MASK) i = 0 endif endfor @@ -2750,7 +2750,7 @@ Function AB_ButtonProc_Refresh(STRUCT WMButtonAction &ba) : ButtonControl WAVE/T folderList = GetAnalysisBrowserGUIFolderList() WAVE folderSelection = GetAnalysisBrowserGUIFolderSelection() - WAVE/Z indices = FindIndizes(folderSelection, col = 0, var = 0x1, prop = PROP_MATCHES_VAR_BIT_MASK) + WAVE/Z indices = FindIndizes(folderSelection, col = 0, var = LISTBOX_SELECT_OR_SHIFT_SELECTION, prop = PROP_MATCHES_VAR_BIT_MASK) if(!WaveExists(indices)) size = DimSize(folderList, ROWS) Make/FREE/N=(size) indices @@ -2985,7 +2985,7 @@ Function AB_ButtonProc_SelectStimSets(STRUCT WMButtonAction &ba) : ButtonControl WAVE/T expBrowserList = GetExperimentBrowserGUIList() WAVE expBrowserSel = GetExperimentBrowserGUISel() - WAVE/Z indizes = FindIndizes(expBrowserSel, var = 1) + WAVE/Z indizes = FindIndizes(expBrowserSel, var = LISTBOX_SELECT_OR_SHIFT_SELECTION, prop = PROP_MATCHES_VAR_BIT_MASK) if(!WaveExists(indizes) || DimSize(indizes, ROWS) != 1) print "Please select exactly one row to use this feature" @@ -3002,11 +3002,11 @@ Function AB_ButtonProc_SelectStimSets(STRUCT WMButtonAction &ba) : ButtonControl endif WAVE indizes = FindIndizes(expBrowserList, colLabel = "stim sets", str = selectedStimSet) - expBrowserSel[][] = expBrowserSel[p][q] & ~LISTBOX_SELECTED + expBrowserSel[][] = expBrowserSel[p][q] & ~(LISTBOX_SELECT_OR_SHIFT_SELECTION) numEntries = DimSize(indizes, ROWS) for(i = 0; i < numEntries; i += 1) - expBrowserSel[indizes[i]][] = expBrowserSel[p][q] | LISTBOX_SELECTED + expBrowserSel[indizes[i]][] = expBrowserSel[p][q] | LISTBOX_SELECT_OR_SHIFT_SELECTION endfor break @@ -3108,7 +3108,7 @@ Function AB_ButtonProc_OpenCommentNB(STRUCT WMButtonAction &ba) : ButtonControl WAVE expBrowserSel = GetExperimentBrowserGUISel() WAVE/T map = GetAnalysisBrowserMap() - WAVE/Z indizes = FindIndizes(expBrowserSel, var = 1) + WAVE/Z indizes = FindIndizes(expBrowserSel, var = LISTBOX_SELECT_OR_SHIFT_SELECTION, prop = PROP_MATCHES_VAR_BIT_MASK) if(!WaveExists(indizes) || DimSize(indizes, ROWS) != 1) print "Please select a sweep belonging to a device to use this feature" diff --git a/Packages/MIES/MIES_AnalysisBrowser_Macro.ipf b/Packages/MIES/MIES_AnalysisBrowser_Macro.ipf index ac2c356170..5408b27bab 100644 --- a/Packages/MIES/MIES_AnalysisBrowser_Macro.ipf +++ b/Packages/MIES/MIES_AnalysisBrowser_Macro.ipf @@ -21,7 +21,7 @@ Window AnalysisBrowser() : Panel ListBox list_experiment_contents, userdata(ResizeControlsInfo)=A"!!,FS!!#A%!!#E8J,htSz!!#](Aon\"Qzzzzzzzzzzzzzz!!#o2B4uAezz" ListBox list_experiment_contents, userdata(ResizeControlsInfo)+=A"zzzzzzzzzzzz!!#u:Du]k Date: Wed, 29 Jan 2025 18:39:28 +0100 Subject: [PATCH 3/6] Databrowser/SweepBrowser: Fix some more sweep/index confusion When loading multiple experiments from the analysis browser, we expect that the total number of sweeps in the display is correct. This was not the case as we used the last sweep number and not the number of sweeps. In addition it was not possible to select sweeps from the popupmenu from later experiments as it always selected the same sweep from the first experiment. --- .../MIES_AnalysisBrowser_SweepBrowser.ipf | 12 +++-- Packages/MIES/MIES_BrowserSettingsPanel.ipf | 49 ++++++------------- 2 files changed, 25 insertions(+), 36 deletions(-) diff --git a/Packages/MIES/MIES_AnalysisBrowser_SweepBrowser.ipf b/Packages/MIES/MIES_AnalysisBrowser_SweepBrowser.ipf index a75a5ec081..accbc796e1 100644 --- a/Packages/MIES/MIES_AnalysisBrowser_SweepBrowser.ipf +++ b/Packages/MIES/MIES_AnalysisBrowser_SweepBrowser.ipf @@ -630,10 +630,16 @@ Function SB_PopupMenuSelectSweep(STRUCT WMPopupAction &pa) : PopupMenuControl PGC_SetAndActivateControl(bsPanel, "check_BrowserSettings_DS", val = CHECKBOX_UNSELECTED) - WAVE sweeps = SB_GetPlainSweepList(win) newIndex = pa.popNum - 1 - newSweep = sweeps[newIndex] - SetSetVariable(win, "setvar_SweepControl_SweepNo", newSweep) + + if(BSP_IsDataBrowser(win)) + WAVE sweeps = SB_GetPlainSweepList(win) + newSweep = sweeps[newIndex] + + SetSetVariable(win, "setvar_SweepControl_SweepNo", newSweep) + else + SetSetVariable(win, "setvar_SweepControl_SweepNo", newIndex) + endif if(OVS_IsActive(win)) OVS_ChangeSweepSelectionState(win, CHECKBOX_SELECTED, index = newIndex) diff --git a/Packages/MIES/MIES_BrowserSettingsPanel.ipf b/Packages/MIES/MIES_BrowserSettingsPanel.ipf index b17d020ec3..12c9b1c2d0 100644 --- a/Packages/MIES/MIES_BrowserSettingsPanel.ipf +++ b/Packages/MIES/MIES_BrowserSettingsPanel.ipf @@ -876,8 +876,7 @@ End static Function BSP_UpdateSweepControls(string win, string ctrl, variable firstSweepOrIndex, variable lastSweepOrIndex) string graph, scPanel - variable currentSweep, newSweep, step, direction, ret - variable firstSweep, lastSweep, firstIndex, lastIndex, currentIndex, newIndex + variable currentSweepOrIndex, newSweepOrIndex, step, direction graph = GetMainWindow(win) scPanel = BSP_GetSweepControlsPanel(graph) @@ -895,38 +894,17 @@ static Function BSP_UpdateSweepControls(string win, string ctrl, variable firstS ASSERT(0, "unhandled control name") endif - if(BSP_IsDataBrowser(graph)) - firstSweep = firstSweepOrIndex - lastSweep = lastSweepOrIndex + currentSweepOrIndex = GetSetVariable(scPanel, "setvar_SweepControl_SweepNo") + newSweepOrIndex = currentSweepOrIndex + direction * step + newSweepOrIndex = limit(newSweepOrIndex, firstSweepOrIndex, lastSweepOrIndex) - currentSweep = GetSetVariable(scPanel, "setvar_SweepControl_SweepNo") - newSweep = currentSweep + direction * step - newSweep = limit(newSweep, firstSweep, lastSweep) + SetPopupMenuIndex(scPanel, "popup_SweepControl_Selector", newSweepOrIndex) - ret = newSweep - else - WAVE sweeps = SB_GetPlainSweepList(win) - firstIndex = 0 - lastIndex = DimSize(sweeps, ROWS) - 1 - - currentIndex = GetPopupMenuIndex(scPanel, "popup_SweepControl_Selector") - newIndex = currentIndex + direction * step - newIndex = limit(newIndex, firstIndex, lastIndex) - - newSweep = sweeps[newIndex] - firstSweep = sweeps[firstIndex] - lastSweep = sweeps[lastIndex] - - SetPopupMenuIndex(scPanel, "popup_SweepControl_Selector", newIndex) - - ret = newIndex - endif - - SetSetVariable(scPanel, "setvar_SweepControl_SweepNo", newSweep) - SetSetVariableLimits(scPanel, "setvar_SweepControl_SweepNo", firstSweep, lastSweep, step) - SetValDisplay(scPanel, "valdisp_SweepControl_LastSweep", var = lastSweep) + SetSetVariable(scPanel, "setvar_SweepControl_SweepNo", newSweepOrIndex) + SetSetVariableLimits(scPanel, "setvar_SweepControl_SweepNo", firstSweepOrIndex, lastSweepOrIndex, step) + SetValDisplay(scPanel, "valdisp_SweepControl_LastSweep", var = lastSweepOrIndex) - return ret + return newSweepOrIndex End /// @brief check if the specified setting is activated @@ -1378,7 +1356,8 @@ Function/WAVE BSP_FetchSelectedChannels(string graph, [variable index, variable return channelSel End -/// @brief Return the last and first sweep numbers +/// @brief Return the last and first sweep numbers for the databrowser or the +/// indizes for the sweepbrowser Function [variable first, variable last] BSP_FirstAndLastSweepAcquired(string win) string list @@ -1389,7 +1368,11 @@ Function [variable first, variable last] BSP_FirstAndLastSweepAcquired(string wi return [NaN, NaN] endif - return [sweeps[0], sweeps[DimSize(sweeps, ROWS) - 1]] + if(BSP_IsDataBrowser(win)) + return [sweeps[0], sweeps[DimSize(sweeps, ROWS) - 1]] + endif + + return [0, DimSize(sweeps, ROWS) - 1] End Function BSP_ButtonProc_ChangeSweep(STRUCT WMButtonAction &ba) : ButtonControl From 1785a7b63c5fe1ffe2be03165b1dac0990d6c487 Mon Sep 17 00:00:00 2001 From: Thomas Braun Date: Wed, 29 Jan 2025 18:49:14 +0100 Subject: [PATCH 4/6] MIES_AnalysisBrowser.ipf: Only search the first column for the selection bits This is faster. --- Packages/MIES/MIES_AnalysisBrowser.ipf | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Packages/MIES/MIES_AnalysisBrowser.ipf b/Packages/MIES/MIES_AnalysisBrowser.ipf index 316aa1c484..9ef3799c0a 100644 --- a/Packages/MIES/MIES_AnalysisBrowser.ipf +++ b/Packages/MIES/MIES_AnalysisBrowser.ipf @@ -1473,7 +1473,7 @@ static Function/WAVE AB_GetExpandedIndices() WAVE expBrowserSel = GetExperimentBrowserGUISel() // Our mode for the listbox stores the selection bit only in the first column - WAVE/Z wv = FindIndizes(expBrowserSel, var = LISTBOX_SELECT_OR_SHIFT_SELECTION, prop = PROP_MATCHES_VAR_BIT_MASK) + WAVE/Z wv = FindIndizes(expBrowserSel, col = 0, var = LISTBOX_SELECT_OR_SHIFT_SELECTION, prop = PROP_MATCHES_VAR_BIT_MASK) if(!WaveExists(wv)) Make/FREE/N=0 wv return wv @@ -1488,12 +1488,12 @@ static Function/WAVE AB_GetExpandedIndices() // we have to refetch the selected entries if(!AB_ExpandIfCollapsed(row, EXPERIMENT_TREEVIEW_COLUMN)) - WAVE wv = FindIndizes(expBrowserSel, var = LISTBOX_SELECT_OR_SHIFT_SELECTION, prop = PROP_MATCHES_VAR_BIT_MASK) + WAVE wv = FindIndizes(expBrowserSel, col = 0, var = LISTBOX_SELECT_OR_SHIFT_SELECTION, prop = PROP_MATCHES_VAR_BIT_MASK) i = 0 endif if(!AB_ExpandIfCollapsed(row, DEVICE_TREEVIEW_COLUMN)) - WAVE wv = FindIndizes(expBrowserSel, var = LISTBOX_SELECT_OR_SHIFT_SELECTION, prop = PROP_MATCHES_VAR_BIT_MASK) + WAVE wv = FindIndizes(expBrowserSel, col = 0, var = LISTBOX_SELECT_OR_SHIFT_SELECTION, prop = PROP_MATCHES_VAR_BIT_MASK) i = 0 endif endfor @@ -2985,7 +2985,7 @@ Function AB_ButtonProc_SelectStimSets(STRUCT WMButtonAction &ba) : ButtonControl WAVE/T expBrowserList = GetExperimentBrowserGUIList() WAVE expBrowserSel = GetExperimentBrowserGUISel() - WAVE/Z indizes = FindIndizes(expBrowserSel, var = LISTBOX_SELECT_OR_SHIFT_SELECTION, prop = PROP_MATCHES_VAR_BIT_MASK) + WAVE/Z indizes = FindIndizes(expBrowserSel, col = 0, var = LISTBOX_SELECT_OR_SHIFT_SELECTION, prop = PROP_MATCHES_VAR_BIT_MASK) if(!WaveExists(indizes) || DimSize(indizes, ROWS) != 1) print "Please select exactly one row to use this feature" @@ -3001,7 +3001,7 @@ Function AB_ButtonProc_SelectStimSets(STRUCT WMButtonAction &ba) : ButtonControl break endif - WAVE indizes = FindIndizes(expBrowserList, colLabel = "stim sets", str = selectedStimSet) + WAVE indizes = FindIndizes(expBrowserList, col = 0, colLabel = "stim sets", str = selectedStimSet) expBrowserSel[][] = expBrowserSel[p][q] & ~(LISTBOX_SELECT_OR_SHIFT_SELECTION) numEntries = DimSize(indizes, ROWS) @@ -3108,7 +3108,7 @@ Function AB_ButtonProc_OpenCommentNB(STRUCT WMButtonAction &ba) : ButtonControl WAVE expBrowserSel = GetExperimentBrowserGUISel() WAVE/T map = GetAnalysisBrowserMap() - WAVE/Z indizes = FindIndizes(expBrowserSel, var = LISTBOX_SELECT_OR_SHIFT_SELECTION, prop = PROP_MATCHES_VAR_BIT_MASK) + WAVE/Z indizes = FindIndizes(expBrowserSel, col = 0, var = LISTBOX_SELECT_OR_SHIFT_SELECTION, prop = PROP_MATCHES_VAR_BIT_MASK) if(!WaveExists(indizes) || DimSize(indizes, ROWS) != 1) print "Please select a sweep belonging to a device to use this feature" From 8b82e78926ff72cd4a9e8646ea152fc2688adb0f Mon Sep 17 00:00:00 2001 From: Thomas Braun Date: Wed, 29 Jan 2025 18:54:12 +0100 Subject: [PATCH 5/6] AB_GetExpandedIndices: Revert earlier optimization This reverts commit 8702208fc (AB_GetExpandedIndices: Avoid function call in for loop statement, 2023-03-31). As the comment clearly states we need to recalculate the wave size on each iteration as it might change. This was done to please check-code.sh, so we now also need a NOLINT --- Packages/MIES/MIES_AnalysisBrowser.ipf | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Packages/MIES/MIES_AnalysisBrowser.ipf b/Packages/MIES/MIES_AnalysisBrowser.ipf index 9ef3799c0a..04eea3d4d4 100644 --- a/Packages/MIES/MIES_AnalysisBrowser.ipf +++ b/Packages/MIES/MIES_AnalysisBrowser.ipf @@ -1469,7 +1469,7 @@ End /// @returns valid indizes wave on success static Function/WAVE AB_GetExpandedIndices() - variable i, row, numEntries + variable i, row WAVE expBrowserSel = GetExperimentBrowserGUISel() // Our mode for the listbox stores the selection bit only in the first column @@ -1482,8 +1482,7 @@ static Function/WAVE AB_GetExpandedIndices() // expand all selected treeviews // as indizes might change during the loop run we have to determine the // dimension size in the loop condition - numEntries = DimSize(wv, ROWS) - for(i = 0; i < numEntries; i += 1) + for(i = 0; i < DimSize(wv, ROWS); i += 1) // NOLINT row = wv[i] // we have to refetch the selected entries From 631a97ce9580ef9e57a92b7e2c09a6bae4d22940 Mon Sep 17 00:00:00 2001 From: Thomas Braun Date: Mon, 10 Feb 2025 22:00:39 +0100 Subject: [PATCH 6/6] Databrowser: Prefer mode 9 over 4 for dashboard listbox This is more intuitive to use. --- Packages/MIES/MIES_Constants.ipf | 2 +- Packages/MIES/MIES_DataBrowser_Macro.ipf | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Packages/MIES/MIES_Constants.ipf b/Packages/MIES/MIES_Constants.ipf index cd7875fb1c..c95f47825a 100644 --- a/Packages/MIES/MIES_Constants.ipf +++ b/Packages/MIES/MIES_Constants.ipf @@ -19,7 +19,7 @@ Constant DAQ_CONFIG_WAVE_VERSION = 3 /// Used to upgrade the GuiStateWave as well as the DA Ephys panel Constant DA_EPHYS_PANEL_VERSION = 64 -Constant DATA_SWEEP_BROWSER_PANEL_VERSION = 51 +Constant DATA_SWEEP_BROWSER_PANEL_VERSION = 52 Constant WAVEBUILDER_PANEL_VERSION = 14 Constant ANALYSISBROWSER_PANEL_VERSION = 6 Constant PSX_PLOT_PANEL_VERSION = 1 diff --git a/Packages/MIES/MIES_DataBrowser_Macro.ipf b/Packages/MIES/MIES_DataBrowser_Macro.ipf index f8628e39b1..35c30f2979 100644 --- a/Packages/MIES/MIES_DataBrowser_Macro.ipf +++ b/Packages/MIES/MIES_DataBrowser_Macro.ipf @@ -1008,7 +1008,7 @@ Window DataBrowser() : Graph ListBox list_dashboard, userdata(ResizeControlsInfo)+=A"zzzzzzzzzzzz!!#u:Du]k