//Edit Filter tool /* A longer comment about the function of the program. */ pragma runLim,0 DB EditFilterDB DBE FilterText DBE OldFilterDBE DBE FilterList DBE FilterLabel DBE BrowseToOtherModDBE string nullList[] = {} string TheFilter, OldFilter Filter NewFilter Module ThisMod= current string ThisView = currentView ThisMod #include void browseForFilter(DBE x){ Folder thisFolder = current string szModuleName = fnMiniExplorer(EditFilterDB, thisFolder, 4, "Filter Selector", "Choose a Formal Module") int Index = 0 //add the selected modules Filters if (module(szModuleName)) { set(FilterLabel,"Filters in the \"" szModuleName "\" module:" ) //open module dump in filters then close module Module Temp = read(szModuleName, true) string vn, MyFilt Filter F empty(FilterList) for vn in views Temp do { load view vn F = current if (! null F) { MyFilt = stringOf(Temp,F) insert(FilterList,Index, vn, null) set(FilterList, Index++, 1, MyFilt) } } if (Temp != ThisMod) close(Temp, false) current = ThisMod load view ThisView refresh ThisMod } } //dummy listview call back, I don't use the deselect and activate actions void dummy(DBE x, int y){} //An item has been selected in the listview void SendToTextElement(DBE TheListView, int SelOption) { string SelFilt =getColumnValue(TheListView,SelOption,1) set(FilterText,SelFilt) } //The Main action void ChangeFilter(DB) { current = ThisMod if(ThisView != currentView ThisMod) load view ThisView TheFilter = get FilterText if(OldFilter == TheFilter) { ack "The Current Filter has not been changed" } else { //turn the string into a filter NewFilter = parseFilter(TheFilter) //apply the new filter filtering off set NewFilter filtering on infoBox "The New Filter has been set, you will\nneed to save the current view to retain it" } refresh ThisMod } void GUI() { string DBName = "Edit Filter Utility (Works on the current View)" EditFilterDB = create(DBName,styleCentered) //get the current filter Filter F = current if(null F) OldFilter = "" else OldFilter = stringOf(ThisMod, F) string FiltTemp = "Current Filter for the \"" ThisView "\" view:" OldFilterDBE =text(EditFilterDB, FiltTemp, OldFilter, 800, 100, true) FiltTemp = "New Filter for the \"" ThisView "\" view:" FilterText = text(EditFilterDB, FiltTemp, OldFilter, 800, 100, false) FilterLabel = label(EditFilterDB, "Filters in the \"" fullName ThisMod "\" module:") FilterList = listView(EditFilterDB, 0, 800, 20, nullList) BrowseToOtherModDBE= button(EditFilterDB, "Browse for Another Module's Filters...", browseForFilter) ok(EditFilterDB, "Apply New Filter", ChangeFilter) //ok(EditFilterDB, "Break Filter into parts", ChangeFilter) realize EditFilterDB insertColumn(FilterList, 0, "View Name", 200, iconNone) insertColumn(FilterList, 1, "View's Filter", 600, iconNone) string vn int Index=0 string MyFilt for vn in views ThisMod do { load view vn F = current if (! null F) { MyFilt = stringOf(ThisMod,F) insert(FilterList,Index, vn, null) set(FilterList, Index++, 1, MyFilt) } } load view ThisView refresh ThisMod set(FilterList, SendToTextElement, dummy, dummy) show EditFilterDB } GUI() show EditFilterDB