Ejemplo n.º 1
0
        public StatusBarIcon ShowStatusIcon(Xwt.Drawing.Image pixbuf)
        {
            DispatchService.AssertGuiThread();
            StatusIcon icon = new StatusIcon(this, pixbuf);

            statusIconBox.PackEnd(icon.box);
            statusIconBox.ShowAll();
            return(icon);
        }
Ejemplo n.º 2
0
        public string GetDocument()
        {
            DispatchService.AssertGuiThread();
            string doc = "";

            System.Diagnostics.Trace.WriteLine("Persisting document.");
            doc = host.PersistDocument();

            return(doc);
        }
Ejemplo n.º 3
0
//		public void LoadDocument (string document, string fileName)
//		{
//			System.Diagnostics.Trace.WriteLine ("Copying document to editor.");
//
//			//invoke in GUI thread as it catches and displays exceptions nicely
//			Gtk.Application.Invoke ( delegate {
//				designerHost.Reset ();
//				designerHost.Load (document, fileName);
//				designerHost.Activate ();
//			});
//		}

        public string GetDocument()
        {
            DispatchService.AssertGuiThread();
            string doc = "";

            System.Diagnostics.Trace.WriteLine("Persisting document.");
            //doc = designerHost.PersistDocument ();
            //doc = designerHost.GetEditableAspNetCode ();

            return(doc);
        }
Ejemplo n.º 4
0
        public void ShowMessage(IconId image, string message, bool isMarkup, NSColor color)
        {
            DispatchService.AssertGuiThread();

            bool changed = LoadText(message, isMarkup, color);

            LoadPixbuf(image);
            if (changed)
            {
                ReconstructString(updateTrackingAreas: true);
            }
        }
Ejemplo n.º 5
0
        void ShowMessageInner(IconId image, string message, bool isMarkup)
        {
            DispatchService.AssertGuiThread();

            if (image == StockIcons.StatusError)
            {
                // If the application doesn't have the focus, trigger the animation
                // again when it gains the focus
                if (!IdeApp.CommandService.ApplicationHasFocus)
                {
                    errorAnimPending = true;
                }
                TriggerErrorAnimation();
            }

            LoadText(message, isMarkup);
            LoadPixbuf(image);

            /* Hack for a compiler error - csc crashes on this:
             * this.Animate ("Text", easing: Easing.SinInOut,
             *            callback: x => renderArg.TextAnimationProgress = x,
             *            finished: x => { animPauseHandle = GLib.Timeout.Add (1000, () => {
             *              if (messageQueue.Count > 0) {
             *                      Message m = messageQueue.Dequeue();
             *                      ShowMessageInner (m.Icon, m.Text, m.IsMarkup);
             *              }
             *              animPauseHandle = 0;
             *              return false;
             *      });
             * });
             */
            this.Animate("Text",
                         x => renderArg.TextAnimationProgress = x,
                         easing: Easing.SinInOut,
                         finished: (x, b) => { animPauseHandle = GLib.Timeout.Add(1000, () => {
                    if (messageQueue.Count > 0)
                    {
                        Message m = messageQueue.Dequeue();
                        ShowMessageInner(m.Icon, m.Text, m.IsMarkup);
                    }
                    animPauseHandle = 0;
                    return(false);
                }); });


            if (renderArg.CurrentText == renderArg.LastText)
            {
                this.AbortAnimation("Text");
            }

            QueueDraw();
        }
Ejemplo n.º 6
0
        public MultiTaskProgressDialog(bool allowCancel, bool showDetails, IDictionary <string, string> taskLabelAliases)
        {
            DispatchService.AssertGuiThread();
            this.Build();
            this.allowCancel = allowCancel;

            this.taskLabelAliases = taskLabelAliases;
            detailsScroll.Visible = showDetails;

            buttonCancel.Visible  = allowCancel;
            buttonClose.Sensitive = false;

            progressTreeView.Model          = statusStore;
            progressTreeView.HeadersVisible = false;
            textRenderer          = new CellRendererText();
            textRenderer.WrapMode = Pango.WrapMode.WordChar;
            TreeViewColumn textColumn = new TreeViewColumn("Task", textRenderer, "markup", STORE_TaskLabel);

            textColumn.MinWidth = 292;             // total width 400 with progressColumn width
            progressTreeView.AppendColumn(textColumn);

            progressRenderer      = new CellRendererProgress();
            progressRenderer.Xpad = 4;
            progressRenderer.Ypad = 4;
            TreeViewColumn progressColumn = new TreeViewColumn("Progress", progressRenderer, "value", STORE_TaskProgress);

            progressColumn.MinWidth = 108;             // 1 pixel per step, plus padding
            progressTreeView.AppendColumn(progressColumn);

            buffer = detailsTextView.Buffer;

            bold        = new TextTag("bold");
            bold.Weight = Pango.Weight.Bold;
            buffer.TagTable.Add(bold);

            tag        = new TextTag("0");
            tag.Indent = 10;
            buffer.TagTable.Add(tag);
            tags.Add(tag);

            int w, h;

            GetSize(out w, out h);
            Resize(w, 1);
        }
Ejemplo n.º 7
0
        public void Initialise()
        {
            DispatchService.AssertGuiThread();
            System.Diagnostics.Trace.WriteLine("Loading document into DesignerHost");
            designerHost.LoadDocument();
            System.Diagnostics.Trace.WriteLine("Loaded document into DesignerHost");

            designerHost.Activate();
            System.Diagnostics.Trace.WriteLine("DesignerHost activated; getting designer view");

            IRootDesigner rootDesigner = (IRootDesigner)designerHost.GetDesigner(designerHost.RootComponent);

            designerView = (RootDesignerView)rootDesigner.GetView(ViewTechnology.Default);
//			designerView.Realized += delegate {
//				System.Diagnostics.Trace.WriteLine ("Designer view realized");
//			};
            designerView.Realized += new EventHandler(designerHost.RootDesignerView_Realized);
        }
Ejemplo n.º 8
0
        public bool RefillOutlineStore()
        {
            DispatchService.AssertGuiThread();
            Gdk.Threads.Enter();

            //refreshingOutline = false;
            if (TreeStore == null || !TreeView.IsRealized)
            {
                refillOutlineStoreId = 0;
                return(false);
            }

            outlineReady = false;
            TreeStore.Clear();
            try
            {
                if (SyntaxTree != null)
                {
                    var caretLocation = Document.Editor.Caret.Location;
                    BuildTreeChildren(TreeIter.Zero, SyntaxTree, new CodeLocation(caretLocation.Column, caretLocation.Line));


                    if (DCompilerService.Instance.Outline.ExpandAll)
                    {
                        TreeView.ExpandAll();
                    }
                }
            }
            catch (Exception ex)
            {
                LoggingService.LogError("Error while updating document outline panel", ex);
            }
            finally
            {
                outlineReady = true;
            }
            Gdk.Threads.Leave();

            //stop timeout handler
            refillOutlineStoreId = 0;
            return(false);
        }
        bool RefillOutlineStore()
        {
            DispatchService.AssertGuiThread();
            Gdk.Threads.Enter();
            refreshingOutline = false;
            if (outlineTreeStore == null || !outlineTreeView.IsRealized)
            {
                refillOutlineStoreId = 0;
                return(false);
            }

            outlineReady = false;
            outlineTreeStore.Clear();
            if (lastCU != null)
            {
                BuildTreeChildren(outlineTreeStore, TreeIter.Zero, lastCU);
                TreeIter it;
                if (IsSorting())
                {
                    if (outlineTreeModelSort.GetIterFirst(out it))
                    {
                        outlineTreeView.Selection.SelectIter(it);
                    }
                }
                else
                {
                    if (outlineTreeStore.GetIterFirst(out it))
                    {
                        outlineTreeView.Selection.SelectIter(it);
                    }
                }

                outlineTreeView.ExpandAll();
            }
            outlineReady = true;

            Gdk.Threads.Leave();

            //stop timeout handler
            refillOutlineStoreId = 0;
            return(false);
        }
Ejemplo n.º 10
0
        void refillOutlineStore()
        {
            DispatchService.AssertGuiThread();
            Gdk.Threads.Enter();
            refreshingOutline = false;
            if (outlineTreeStore == null || !outlineTreeView.IsRealized)
            {
                return;
            }
            outlineTreeStore.Clear();

            if (CU != null)
            {
                DateTime start = DateTime.Now;
                RefillOutlineStore(CU, outlineTreeStore);
                outlineTreeView.ExpandAll();
                outlineTreeView.ExpandAll();
                LoggingService.LogDebug("Built outline in {0}ms", (DateTime.Now - start).Milliseconds);
            }

            Gdk.Threads.Leave();
        }
Ejemplo n.º 11
0
        bool RefillOutlineStore()
        {
            DispatchService.AssertGuiThread();
            Gdk.Threads.Enter();
            refreshingOutline = false;
            if (outlineTreeStore == null || !outlineTreeView.IsRealized)
            {
                return(false);
            }

            outlineTreeStore.Clear();
            if (lastCU != null)
            {
                BuildTreeChildren(outlineTreeStore, TreeIter.Zero, lastCU);
                outlineTreeView.ExpandAll();
            }

            Gdk.Threads.Leave();

            //stop timeout handler
            return(false);
        }
Ejemplo n.º 12
0
        public void Refresh()
        {
            // GUI assert here is to catch Bug 434065 - Exception while going to the editor
            DispatchService.AssertGuiThread();

            if (toolboxService.Initializing)
            {
                toolboxWidget.CustomMessage = GettextCatalog.GetString("Initializing...");
                return;
            }

            ConfigureToolbar();

            toolboxWidget.CustomMessage = null;

            categories.Clear();
            AddItems(toolboxService.GetCurrentToolboxItems());

            Drag.SourceUnset(toolboxWidget);
            toolboxWidget.ClearCategories();

            var cats = categories.Values.ToList();

            cats.Sort((a, b) => a.Priority != b.Priority ? a.Priority.CompareTo(b.Priority) : a.Text.CompareTo(b.Text));
            cats.Reverse();
            foreach (Category category in cats)
            {
                category.IsExpanded = true;
                toolboxWidget.AddCategory(category);
            }
            toolboxWidget.QueueResize();
            Gtk.TargetEntry[] targetTable = toolboxService.GetCurrentDragTargetTable();
            if (targetTable != null)
            {
                Drag.SourceSet(toolboxWidget, Gdk.ModifierType.Button1Mask, targetTable, Gdk.DragAction.Copy | Gdk.DragAction.Move);
            }
            compactModeToggleButton.Visible = toolboxWidget.CanIconizeToolboxCategories;
        }
Ejemplo n.º 13
0
        public void Initialise(string document, string fileName)
        {
            DispatchService.AssertGuiThread();

            System.Diagnostics.Trace.WriteLine("Loading document into DesignerHost");
            if (document != null)
            {
                host.Load(document, fileName);
            }
            else
            {
                host.NewFile();
            }
            System.Diagnostics.Trace.WriteLine("Loaded document into DesignerHost");

            host.Activate();
            System.Diagnostics.Trace.WriteLine("DesignerHost activated; getting designer view");

            IRootDesigner rootDesigner = (IRootDesigner)host.GetDesigner(host.RootComponent);

            designerView           = (RootDesignerView)rootDesigner.GetView(ViewTechnology.Passthrough);
            designerView.Realized += delegate { System.Diagnostics.Trace.WriteLine("Designer view realized"); };
        }
Ejemplo n.º 14
0
 public void Pulse()
 {
     DispatchService.AssertGuiThread();
     OnProgressPulse(EventArgs.Empty);
 }
Ejemplo n.º 15
0
 public void SetProgressFraction(double work)
 {
     DispatchService.AssertGuiThread();
     OnProgressFraction(new FractionEventArgs(work));
 }
Ejemplo n.º 16
0
 public void ShowWarning(string warning)
 {
     DispatchService.AssertGuiThread();
     ShowMessage(StockIcons.StatusWarning, warning);
 }
Ejemplo n.º 17
0
        public bool RefillOutlineStore()
        {
            DispatchService.AssertGuiThread();
            Gdk.Threads.Enter();

            //refreshingOutline = false;
            if (TreeStore == null || !TreeView.IsRealized)
            {
                refillOutlineStoreId = 0;
                return(false);
            }

            outlineReady = false;

            // Save last selection
            int[]    lastSelectedItem;
            TreeIter i;

            if (TreeView.Selection.GetSelected(out i))
            {
                lastSelectedItem = TreeStore.GetPath(i).Indices;
            }
            else
            {
                lastSelectedItem = null;
            }

            // Save previously expanded items if wanted
            var lastExpanded = new List <int[]>();

            if (DCompilerService.Instance.Outline.ExpansionBehaviour == DocOutlineCollapseBehaviour.ReopenPreviouslyExpanded &&
                TreeStore.GetIterFirst(out i))
            {
                do
                {
                    var path = TreeStore.GetPath(i);
                    if (TreeView.GetRowExpanded(path))
                    {
                        lastExpanded.Add(path.Indices);
                    }
                }while(TreeStore.IterNext(ref i));
            }

            // Clear the tree
            TreeStore.Clear();

            try
            {
                // Build up new tree
                if (SyntaxTree != null)
                {
                    var caretLocation = Document.Editor.Caret.Location;
                    BuildTreeChildren(TreeIter.Zero, SyntaxTree, new CodeLocation(caretLocation.Column, caretLocation.Line));
                }
            }
            catch (Exception ex)
            {
                LoggingService.LogError("Error while updating document outline panel", ex);
            }
            finally
            {
                // Re-Expand tree items
                switch (DCompilerService.Instance.Outline.ExpansionBehaviour)
                {
                case DocOutlineCollapseBehaviour.ExpandAll:
                    TreeView.ExpandAll();
                    break;

                case DocOutlineCollapseBehaviour.ReopenPreviouslyExpanded:
                    foreach (var path in lastExpanded)
                    {
                        TreeView.ExpandToPath(new TreePath(path));
                    }
                    break;
                }

                // Restore selection
                if (lastSelectedItem != null)
                {
                    try
                    {
                        TreeView.ExpandToPath(new TreePath(lastSelectedItem));
                    }
                    catch { }
                }

                outlineReady = true;
            }
            Gdk.Threads.Leave();

            //stop timeout handler
            refillOutlineStoreId = 0;
            return(false);
        }