#pragma rtGlobals=3 // Use modern global access method and strict wave access. // Test for managing lots of graph windows. Assign graphs to "groups". // Can show/hide graphs based on group. Shift-click to select more than one group. // Use window note to store information on which group the graph belongs to. // Also show graphs that only have graph macros (graph has been closed) // When "Show" is clicked, also bring those windows to front. // Kill graphs that are being hidden that also have a graph macro??? Not done yet. // Ken Aikin // NOAA Chemical Sciences Division // 20151214 Menu "Macros" "---" // separate from other menu items if they are used by other macros that users have. "Init Manage Graphs" "Tile Graphs" "---" end macro InitManageGraphs() InitGraphGroups() ManageGraphsPanel() ButtonProc_updateGrList("") // call the function that updates the list of graphs and populates listbox1 end // Run once to set up at beginning of session. Creates DF and waves to contain info. macro InitGraphGroups() Silent 1 NewDataFolder/O root:GraphGroupStuff Make/T/O/N=1 root:GraphGroupStuff:GraphGroup_names="_none_" //waves for Graph Group listbox list0. Init value to "_none_" which is used for clearing assignment to selected graphs. Make/O/N=1 root:GraphGroupStuff:GraphGroup_selections Make/T/O/N=0 root:GraphGroupStuff:grListWave //waves for Graph listbox list1 Make/T/O/N=0 root:GraphGroupStuff:grTitleWave Make/O/N=0 root:GraphGroupStuff:grSelWave end // Loops thru every graph and prompts for which Group to assign it to. macro AssignGraphsToGroups_All() string wname, wlist, GraphGroupList silent 1 GraphGroupList = GraphGroupsToList() wlist = sortlist(WinList("*", ";", "WIN:1"), ";", 16) setWindowNotes(GraphGroupList, wlist) end // Loops thru all graphs that don't have a graph note and prompts for which Group to assign them to. function AssignGraphsToGroups() variable n,num string wname, wlist, GraphGroupList, unAssignedList="" GraphGroupList = GraphGroupsToList() // list of all groups in Groups List. wlist = sortlist(WinList("*", ";", "WIN:1"), ";", 16) //sort list alpha-numerically num = ItemsInList(wlist) for(n=0; n0) setWindowNotes(GraphGroupList, unAssignedList) // pass in list of all Groups, and un-assigned graphs. else DoAlert 0, "No un-assigned graphs found." endif end // Sets window note. Pass in list of Groups and list of graph windows. function setWindowNotes(GraphGroupList, wlist) string GraphGroupList, wlist variable n, num, origLeft, origRight, origTop, origBottom variable tempLeft, tempRight, tempTop, tempBottom string wname, groupStr num = ItemsInList(wlist) for(n=0; n