import "Explorer" //import "ecere" //import "Finder" class Panel : Label { //background = activeBorder; size = { 200, 40 }; isGroupBox = true; //background = activeBorder; bool OnMoving(int * x, int * y, int w, int h) { //if(((ExplorerWindow)master).userMode) // return false; return true; } } class PanelText : Panel { // IDEA: Would it be totally unreasonable for a group box to use client size // to set the actual size considering the size of the border? // Also, to have anchors be relative to the client size? clientSize = { 200, 40 }; size = { 200, 64 }; //background = activeBorder; EditBox editBox { this; //borderStyle = none; size = { 160, 20 }; anchor = { left = 8, top = 16, right = 8 }; }; char * GetText() { return editBox.contents; } } class PanelTextMatch : PanelText { clientSize = { 200, 40 }; size = { 200, 64 }; Button optionMatchCase { this; //toggle = true, inactive = true; isCheckbox = true; text = "Match Case", hotKey = Key { c, alt = true }; //size = { 40, 18 }; //anchor = { left = 4, top = 40, right = 0.508f }; anchor = { top = 38, right = 8 }; }; Button optionMatchWord { this; //toggle = true, inactive = true; isCheckbox = true; text = "Match Whole Word", hotKey = Key { w, alt = true }; //size = { 40, 18 }; position = Point { y = 62 }; //anchor = { left = 0.508f, top = 40, right = 4 }; anchor = { top = 38, right = 8 }; }; bool OnPostCreate() { optionMatchCase.anchor.right = (int)optionMatchWord.size.w + 8 + 2; return true; } /*void OnResize(int width, int height) { optionMatchCase.anchor.right = (int)optionMatchWord.size.w + 8 + 2; }*/ } class PanelFileName : PanelTextMatch { clientSize = { 200, 40 }; size = { 200, 64 }; text = "File Name"; hotKey = Key { n, alt = true }; #ifdef _DEBUG editBox.contents = "Ecere"; #endif } class PanelFileSize : Panel { clientSize = { 200, 40 }; size = { 200, 64 }; text = "File Size"; hotKey = Key { s, alt = true }; uint compare; EditBox editBox { this; //borderStyle = none; contents = "1024"; size = { 102, 18 }; anchor = { left = 8, top = 16, right = 130 }; bool NotifyModified(EditBox editBox) { UpdateCompare(); return true; } }; Button optionGB { this; toggle = true, inactive = true; text = "GB"; size = { 30, 18 }; anchor = { top = 16, right = 98 }; NotifyClicked = optionScale_NotifyClicked; }; Button optionMB { this; toggle = true, inactive = true; text = "MB"; size = { 30, 18 }; anchor = { top = 16, right = 66 }; NotifyClicked = optionScale_NotifyClicked; }; Button optionKB { this; toggle = true, checked = true, inactive = true; text = "KB"; size = { 30, 18 }; anchor = { top = 16, right = 34 }; NotifyClicked = optionScale_NotifyClicked; }; Button optionB { this; toggle = true, inactive = true; text = "B"; size = { 30, 18 }; anchor = { top = 16, right = 4 }; NotifyClicked = optionScale_NotifyClicked; }; Button optionSmaller { this; toggle = true, inactive = true; text = "Smaller"; size = { 74, 18 }; anchor = { left = 4, top = 41, right = 0.67f }; NotifyClicked = optionCompare_NotifyClicked }; Button optionEqual { this; toggle = true, inactive = true; text = "Equal"; size = { 74, 18 }; anchor = { left = 0.34f, top = 41, right = 0.34f }; NotifyClicked = optionCompare_NotifyClicked; }; Button optionGreater { this; toggle = true, checked = true, inactive = true; text = "Greater"; size = { 74, 18 }; anchor = { left = 0.67f, top = 41, right = 4 }; NotifyClicked = optionCompare_NotifyClicked; }; bool optionScale_NotifyClicked(Button button, int x, int y, Modifiers mods) { optionGB.checked = (button == optionGB); optionMB.checked = (button == optionMB); optionKB.checked = (button == optionKB); optionB.checked = (button == optionB); UpdateCompare(); return true; } bool optionCompare_NotifyClicked(Button button, int x, int y, Modifiers mods) { optionSmaller.checked = (button == optionSmaller); optionEqual.checked = (button == optionEqual); optionGreater.checked = (button == optionGreater); return true; } bool Match(uint size) { if(optionSmaller.checked) return size < compare; else if(optionEqual.checked) return size = compare; else if(optionGreater.checked) return size > compare; else return false; } void UpdateCompare() { if(optionGB.checked) compare = atoi(editBox.contents) * 1024 * 1024 * 1024; else if(optionMB.checked) compare = atoi(editBox.contents) * 1024 * 1024; else if(optionKB.checked) compare = atoi(editBox.contents) * 1024; else if(optionB.checked) compare = atoi(editBox.contents); } } class PanelFileTextContent : PanelTextMatch { clientSize = { 200, 40 }; size = { 200, 64 }; text = "Text Content"; hotKey = Key { x, alt = true }; } class PanelLocation : Panel { clientSize = { 200, 40 }; size = { 200, 44 }; text = "Location"; hotKey = Key { l, alt = true }; FileDialog fileDialog { master, master; type = selectDir; text = "Select Search Location..."; }; EditBox editBox { this; //borderStyle = none; contents = "/"; size = { 160, 20 }; anchor = { left = 8, top = 16, right = 2 + 24 + 8 }; }; ToolButton browse { this; anchor = { top = 14, right = 8 }; toolId = ExplorerToolId::browse; bool NotifyClicked(Button button, int x, int y, Modifiers mods) { fileDialog.currentDirectory = editBox.contents; if(fileDialog.Modal() == ok) editBox.contents = fileDialog.filePath; return true; } }; /*Button buttonBrowse { this; text = "Browse", hotKey = Key { b, alt = true }; size = { 160, 29 }; anchor = { left = 8, top = 41, right = 8 }; };*/ char * GetText() { return editBox.contents; } } class PanelOptions : Panel { clientSize = { 200, 60 }; size = { 200, 80 }; text = "Options"; hotKey = Key { o, alt = true }; Button subdirs { this; toggle = true, checked = true; text = "Search Sub Directories", hotKey = Key { d, alt = true }; size = { 160, 18 }; anchor = { left = 8, top = 16, right = 8 }; bool NotifyClicked(Button button, int x, int y, Modifiers mods) { if(button.checked) { tree.disabled = false; browser.disabled = false; } else { // I need a way to show this unchecked while keeping it original checked value tree.disabled = true; browser.disabled = true; } return true; } }; Button tree { this; toggle = true, checked = true, inactive = true; text = "Display Results With Tree", hotKey = Key { t, alt = true }; size = { 160, 18 }; anchor = { left = 8, top = 40, right = 8 }; bool NotifyClicked(Button button, int x, int y, Modifiers mods) { ExplorerSearch search = (ExplorerSearch)parent; search.OptTree(button.checked); return true; } }; Button browser { this; toggle = true, checked = true, inactive = true; text = "Show Browser", hotKey = Key { h, alt = true }; size = { 160, 18 }; anchor = { left = 8, top = 60, right = 8 }; }; } class PanelActions : Panel { clientSize = { 200, 38 }; size = { 200, 48 }; text = "Actions"; hotKey = Key { o, alt = true }; Button startStop { this; isDefault = true; text = "Start Search", hotKey = Key { s, alt = true }; size = { 80, 26 }; anchor = { top = 16, right = 92 }; bool NotifyClicked(Button button, int x, int y, Modifiers mods) { ExplorerSearch search = (ExplorerSearch)parent; //--//if(!finderWnd.SearchStop()) search.SearchStart(); return true; } }; Button clear { this; disabled = true; text = "Clear Results", hotKey = Key { c, alt = true }; size = { 80, 26 }; anchor = { top = 16, right = 8 }; bool NotifyClicked(Button button, int x, int y, Modifiers mods) { ExplorerSearch search = (ExplorerSearch)parent; search.SearchStop(); search.view.results.Clear(); search.view.browser.Clear(); button.disabled = true; return true; } }; }