private void buildGui() { //var groupBoxes = this.add_SplitContainer_2x2("Directory","WebEditor","Config","HtmlCode",true, 100,40,40); var groupBoxes = this.add_1x1("WebEditor (Edit on page)","HtmlCode (see results in code)"); browser = groupBoxes[0].add_WebBrowserWithLocationBar(); htmlCode = groupBoxes[1].add_SourceCodeViewer(); //directory = groupBoxes[0].add_Directory(startDir); //browser = groupBoxes[1].add_WebBrowserWithLocationBar(); //htmlCode = groupBoxes[3].add_SourceCodeViewer(); htmlCode.astDetails(false); // build config /*groupBoxes[2].add_Link("toggle edit mode", 20 ,10,()=> setEditMode(!getEditMode()) ); groupBoxes[2].add_Link("refresh", 40 ,10,()=> updateHtmlPage() ); groupBoxes[2].add_Link("take screenshot", 60 ,10,()=> takeScreenShot() ); pictureBox = groupBoxes[2].add_PictureBox(70,10); pictureBox.anchor_All(); takeScreenShot(); // setup controls events directory._onDirectoryDoubleClick+=selectedFileOrFolder; */ browser.onDocumentCompleted +=onDocumentCompleted; //htmlCode.eDocumentDataChanged += htmlTextChanged; // fine tune loaded controls behaviour //directory._WatchFolder = true; //directory.AllowDrop = false; htmlCode.editor().colorCodeForExtension(".html"); // remove on next code Sync ((O2BrowserIE)browser).AllowWebBrowserDrop = false; }
public static TreeView CreateTreeViewFor_MethodMappingsView(this Control targetControl, ascx_SourceCodeViewer sourceCodeViewer) { targetControl.clear(); var treeView = targetControl.add_TreeView() .sort(); Action<MethodMapping> showMethodMapping = (methodMapping)=>{ if (methodMapping.File.valid()) { sourceCodeViewer.open(methodMapping.File); sourceCodeViewer.editor().clearMarkers(); sourceCodeViewer.editor().caret(methodMapping.Start_Line,methodMapping.Start_Column); sourceCodeViewer.editor().selectTextWithColor(methodMapping.Start_Line, methodMapping.Start_Column, methodMapping.End_Line, methodMapping.End_Column); } }; treeView.afterSelect<MethodMapping>(showMethodMapping); treeView.afterSelect<List<MethodMapping>>( (methodMappings)=>showMethodMapping(methodMappings[0])); return treeView; }
public ascx_HtmlTagViewer buildGui(bool addLoadUrlTextBox, bool addHtmlCodeViewer) { //return (ascx_HtmlTagViewer)this.invokeOnThread( // ()=>{ var TopPanel = this.add_Panel(); HtmlTags_TreeView = TopPanel.add_TreeView_for_HtmlTags() .showSelection(); if (addHtmlCodeViewer) { HtmlCodeViewer = HtmlTags_TreeView.insert_Left<Panel>(TopPanel.width()/2).add_SourceCodeViewer(); HtmlTags_TreeView.after_TagSelect_showIn_SouceCodeViewer(HtmlCodeViewer); var optionsPanel = HtmlCodeViewer.insert_Below<Panel>(50); optionsPanel.add_CheckBox("View as Xml",0,5, (value)=>{ ViewAsXml = value; reloadPage(); }) .append_Label("Search html code:") .top(5) .append_TextBox("") .onTextChange((text)=> HtmlCodeViewer.editor().invoke("searchForTextInTextEditor_findNext",text)) .onEnter((text)=> HtmlCodeViewer.editor().invoke("searchForTextInTextEditor_findNext",text)) .align_Right(optionsPanel); optionsPanel.add_Link("Refresh tags",30,0,()=> show(HtmlCodeViewer.get_Text())); } if (addLoadUrlTextBox) { PageToOpen = TopPanel.insert_Above<Panel>(20).add_TextBox().fill(); var propertyGrid = HtmlTags_TreeView.insert_Right<Panel>(150).add_PropertyGrid(); HtmlTags_TreeView.afterSelect<HtmlAgilityPack.HtmlNode>( (htmlNode)=> propertyGrid.show(htmlNode)); PageToOpen.onEnter( (text)=>{ if (text.fileExists()) show(text.fileContents()); else show(text.uri()); }); } HtmlNodeFilter = HtmlTags_TreeView.insert_Below_HtmlTagFilter((filter) => show(HtmlCode, filter) ); return this; //}); }
public static TreeView after_TagSelect_showIn_SouceCodeViewer(this TreeView htmlTags_TreeView, ascx_SourceCodeViewer htmlCodeViewer) { htmlTags_TreeView.afterSelect<HtmlAgilityPack.HtmlNode>( (htmlNode) => { try { htmlCodeViewer.showHtmlNodeLocation(htmlNode); htmlCodeViewer.editor().caret(htmlNode.Line, htmlNode.LinePosition); } catch (Exception ex) { "[after_TagSelect_showIn_SouceCodeViewer] Error: {0}".error(ex.Message); } }); return htmlTags_TreeView; }
public static ascx_TraceTreeView afterSelect_ShowTraceInCodeViewer(this ascx_TraceTreeView traceViewer , ascx_SourceCodeViewer codeViewer) { return traceViewer.afterSelect_ShowTraceInCodeEditor(codeViewer.editor()); }
public static ascx_FindingsViewer afterSelect_ShowTraceInCodeViewer(this ascx_FindingsViewer findingsViewer , ascx_SourceCodeViewer codeViewer) { findingsViewer._onFindingSelected += (o2Finding)=>{ codeViewer.show(o2Finding); Application.DoEvents(); findingsViewer.focus(); }; findingsViewer._onTraceSelected += (o2Trace)=>{ codeViewer.show(o2Trace); Application.DoEvents(); findingsViewer.focus(); }; return findingsViewer; }
public static ascx_FindingsViewer set_CodeViewer(this ascx_FindingsViewer findingsViewer, ascx_SourceCodeViewer codeViewer) { return findingsViewer.set_CodeEditor(codeViewer.editor()); }
//bool putJavaScriptCodeViewerOnTheLeft, public ascx_Javascript_AST buildGui( bool addUrlLoadTextBox) { var mainGui = this.add_1x1("Files or ScriptBlocks","Javascript Source (you can edit this code and see the results in realtime)"); var splitContainer = this.controls<SplitContainer>(); if (addUrlLoadTextBox) { showJavascriptsFromUrl = splitContainer.insert_Above<Panel>(25) .add_LabelAndComboBoxAndButton("Enter Url to load Javascripts","","Open", loadJavascriptsFromUrl) .controls<ComboBox>(); } /*if (putJavaScriptCodeViewerOnTheLeft) { splitContainer.splitterDistance(this.width()/3); javascriptCode = mainGui[1].add_TreeView().showSelection().sort(); sourceCode = mainGui[0].add_SourceCodeViewer(); } else {*/ javascriptCode = mainGui[0].add_TreeView().showSelection().sort(); sourceCode = mainGui[1].add_SourceCodeViewer(); //} pagesVisited = javascriptCode.insert_Above<ComboBox>(25).dropDownList(); codeSnippet = sourceCode.insert_Below<TextBox>(100).multiLine().scrollBars(); tabControl = javascriptCode.insert_Below<TabControl>(); jsAST = tabControl.add_Tab("Javascript - View Ast Tree") .add_TreeView() .showSelection(); jsFunctions = tabControl.add_Tab("JScript: Functions") .add_TreeView() .showSelection() .sort(); jsIdentifiers = tabControl.add_Tab("JScript: Identifiers") .add_TreeView() .showSelection() .sort(); jsValues = tabControl.add_Tab("JScript: Values") .add_TreeView() .showSelection() .sort(); allAST = tabControl.add_Tab("Javascript - View Ast Elements") .add_TreeView() .showSelection() .sort(); var searchTab = tabControl.add_Tab("Search in Code") .add_LabelAndComboBoxAndButton("search for (case sensitive)","","show", (text)=> { sourceCode.editor().invoke("searchForTextInTextEditor_findNext", text); }); //tabControl.select_Tab(searchTab); javaScriptLoadMessage = javascriptCode.insert_Below<Panel>(20); allAST.insert_Below<Panel>(25) .add_CheckBox("Render this view (some performace impact on large scripts)", 0,0, (value)=>{ RenderViewAstElementsTreeView = value; processJavascript(); }) .autoSize(); allAST.jint_configure_showSelectionDetails(sourceCode, codeSnippet); jsFunctions.jint_configure_showSelectionDetails(sourceCode, codeSnippet); jsIdentifiers.jint_configure_showSelectionDetails(sourceCode, codeSnippet); jsValues.jint_configure_showSelectionDetails(sourceCode, codeSnippet); javascriptCode.afterSelect<string>( (jsCode) => { sourceCode.editor().clearBookmarksAndMarkers(); sourceCode.set_Text(jsCode,"*.js"); sourceCode.editor().refresh(); }); sourceCode.onTextChanged(processJavascript); pagesVisited.onSelection<IE_HtmlPage>( (htmlPage)=>{ var allScriptsCompiledOk = javascriptCode.populateWithHtmlPageScripts(htmlPage); javascriptCode.add_Node("zzz [Original Html Code for: {0}]".format(htmlPage.PageUri.str()),htmlPage.PageSource); handleCompilationResult(allScriptsCompiledOk); }); pagesVisited.onSelection<Jint_Wrapper>( (jintWrapper)=>{ var allScriptsCompiledOk = javascriptCode.populateWithHtmlPageScripts(jintWrapper.JavaScripts); javascriptCode.add_Node("zzz_[Original Code for: {0}]".format(jintWrapper.Uri.str()),jintWrapper.Html); handleCompilationResult(allScriptsCompiledOk); }); javascriptCode.onDrop( (fileOrFolder)=>{ if (fileOrFolder.fileExists()) javascriptCode.add_Node(fileOrFolder.str(), fileOrFolder.fileContents()); else if (fileOrFolder.dirExists()) { javascriptCode.clear(); foreach(var file in fileOrFolder.files("*.js",true)) javascriptCode.add_Node(file.str(), file.fileContents()); } }); this.add_ContextMenu().add_MenuItem("Show log viewer",()=> this.insert_Below<Panel>(90).add_LogViewer()); return this; }