Exemplo n.º 1
0
 public GrammarWindow(RuntimeThread runtimeThread) : base("Grammar")
 {
     runtimeThread.Runtime.Grammar.Trace.PatternDefinedEvent += OnGrammarPatternDefined;
     runtimeThread.Runtime.Grammar.Trace.PatternChangedEvent += OnGrammarPatternChanged;
     
     SetDefaultSize(250, 300);
     SkipPagerHint = true;
     SkipTaskbarHint = true;
     
     scroller = new ScrolledWindow();
     scroller.BorderWidth = 5;
     scroller.ShadowType = ShadowType.In;
     Add(scroller);
     
     store = new TreeStore(typeof(string), typeof(Source));
     
     // FIXME - only want to sort top level
     
     //TreeModelSort storeSort = new TreeModelSort(store);
     //storeSort.SetSortColumnId(0, SortType.Ascending);
     
     view = new TreeView(store);
     
     view.AppendColumn(null, new CellRendererText(), "text", VALUE_TEXT);
     view.HeadersVisible = false;
     view.RowActivated += OnTreeRowActivated;
     view.ButtonPressEvent += OnTreeButtonPress;
     scroller.Add(view);
     
     MenuBuilder menuBuilder = new MenuBuilder();
     menu = menuBuilder.StartMenu();
     menuBuilder.Add("Show source", OnMenuShowSource);
     menuBuilder.Add("Show object", OnMenuShowObject);
     menu.ShowAll();
 }
Exemplo n.º 2
0
 public ObjectWindow(RuntimeThread runtimeThread, object root)
     : base(GetTitle(root))
 {
     SetDefaultSize(250, 300);
     SkipPagerHint = true;
     SkipTaskbarHint = true;
     
     scroller = new ScrolledWindow();
     scroller.BorderWidth = 5;
     scroller.ShadowType = ShadowType.In;
     Add(scroller);
     
     store = new TreeStore(typeof(string), typeof(object), typeof(bool));
     
     //TreeModelSort storeSort = new TreeModelSort(store);
     //storeSort.SetSortColumnId(0, SortType.Ascending);
     
     view = new TreeView(store);
     view.AppendColumn(null, new CellRendererText(), "text", VALUE_TEXT);
     view.HeadersVisible = false;
     view.RowExpanded += OnTreeRowExpanded;
     view.RowCollapsed += OnTreeRowCollapsed;
     scroller.Add(view);
     
     Add(false, new TreeIter(), "", root, false, false);
     
     TreeIter first;
     store.GetIterFirst(out first);
     view.ExpandRow(store.GetPath(first), false);
 }
Exemplo n.º 3
0
 public ParseTreeWindow(RuntimeThread runtimeThread) : base("Parse Tree")
 {
     runtimeThread.Runtime.ParseTrace.ParsedEvent += OnParsed;
     
     SetDefaultSize(250, 300);
     SkipPagerHint = true;
     SkipTaskbarHint = true;
     
     scroller = new ScrolledWindow();
     scroller.BorderWidth = 5;
     scroller.ShadowType = ShadowType.In;
     Add(scroller);
     
     store = new TreeStore(typeof(string), typeof(object));
     
     view = new TreeView(store);
     column = view.AppendColumn(null, new CellRendererText(), "text", VALUE_TEXT);
     view.HeadersVisible = false;
     view.RowActivated += OnTreeRowActivated;
     view.ButtonPressEvent += OnTreeButtonPress;
     scroller.Add(view);
     
     MenuBuilder menuBuilder = new MenuBuilder();
     menu = menuBuilder.StartMenu();
     menuBuilder.Add("Show source", OnMenuShowSource);
     menuBuilder.Add("Show object", OnMenuShowObject);
     menu.ShowAll();
 }
Exemplo n.º 4
0
 public ParseTraceWindow(RuntimeThread runtimeThread) : base("Parse Trace")
 {
     runtimeThread.Runtime.ParseTrace.EnterEvent += OnEnter;
     runtimeThread.Runtime.ParseTrace.LeaveEvent += OnLeave;
     
     SetDefaultSize(250, 300);
     SkipPagerHint = true;
     SkipTaskbarHint = true;
     
     scroller = new ScrolledWindow();
     scroller.BorderWidth = 5;
     scroller.ShadowType = ShadowType.In;
     Add(scroller);
     
     store = new TreeStore(typeof(string), typeof(Source), typeof(GtkProofBox));
     
     view = new TreeView(store);
     column = view.AppendColumn(null, new CellRendererText(), "text", VALUE_TEXT);
     view.HeadersVisible = false;
     view.RowActivated += OnTreeRowActivated;
     scroller.Add(view);
     
     GLib.Timeout.Add(50, OnUpdatesTimeout);
     
     // TODO need a context menu for view source and follow link
 }
Exemplo n.º 5
0
        public bool NewSession(CommandLine commandLine)
        {
            NewSessionDialog newSessionDialog = new NewSessionDialog(this, commandLine);
            
            bool response = newSessionDialog.Run();
            
            if (response)
            {
                if (runtimeThread != null)
                    runtimeThread.Shutdown();
                
                Runtime runtime = new Runtime(
                    newSessionDialog.CompileParser,
                    newSessionDialog.DebugParser,
                    newSessionDialog.DebugParseTrees,
                    newSessionDialog.DebugGrammar,
                    true);
                
                runtimeThread = new RuntimeThread(runtime);
                runtimeThread.ImportStandard = newSessionDialog.ImportStandard;
                
                files = newSessionDialog.Files;

                runtimeThread.RunningEvent += OnRuntimeThreadRunning;
                runtimeThread.FinishedEvent += OnRuntimeThreadFinished;
                runtimeThread.RuntimeErrorEvent += OnRuntimeError;
                
                viewParseTrace.Visible = runtime.TraceParser;
                
                if (runtime.TraceParser)
                {
                    runtime.ParseTrace.ProgressChangedEvent += OnProgressChanged;
                    
                    parseTraceWindow = new ParseTraceWindow(runtimeThread);
                    parseTraceWindow.TransientFor = this;
                    
                    parseTraceWindow.SourceSelected += OnSourceSelected;
                    parseTraceWindow.Hidden += delegate { viewParseTrace.Active = false; };
                }
                
                viewParseTree.Visible = runtime.TraceParseTrees;
                
                if (runtime.TraceParseTrees)
                {
                    parseTreeWindow = new ParseTreeWindow(runtimeThread);
                    parseTreeWindow.TransientFor = this;
                    
                    parseTreeWindow.SourceSelected += OnSourceSelected;
                    parseTreeWindow.ObjectViewed += OnObjectViewed;
                    parseTreeWindow.Hidden += delegate { viewParseTree.Active = false; };
                }
                
                viewGrammar.Visible = runtime.TraceGrammar;
                
                if (runtime.TraceGrammar)
                {
                    grammarWindow = new GrammarWindow(runtimeThread);
                    grammarWindow.TransientFor = this;

                    grammarWindow.SourceSelected += OnSourceSelected;
                    grammarWindow.ObjectViewed += OnObjectViewed;
                    grammarWindow.Hidden += delegate { viewGrammar.Active = false; };
                }
            }
            
            newSessionDialog.Destroy();
            return response;
        }