public StatusBarContextHandler (StatusBar statusBar)
		{
			StatusBar = statusBar;
			mainContext = new MainStatusBarContextImpl (this);
			activeContext = mainContext;
			contexts.Add (mainContext);
		}
Пример #2
0
        public StatusBarContext CreateContext()
        {
            StatusBarContextImpl ctx = new StatusBarContextImpl(this);

            contexts.Add(ctx);
            return(ctx);
        }
		public void Remove (StatusBarContextImpl ctx)
		{
			if (ctx == mainContext)
				return;

			StatusBarContextImpl oldActive = activeContext;
			contexts.Remove (ctx);
			UpdateActiveContext ();
			if (oldActive != activeContext) {
				// Removed the active context. Update the status bar.
				activeContext.Update ();
			}
		}
Пример #4
0
 internal void UpdateActiveContext()
 {
     for (int n = contexts.Count - 1; n >= 0; n--)
     {
         StatusBarContextImpl ctx = contexts [n];
         if (ctx.StatusChanged)
         {
             if (ctx != activeContext)
             {
                 activeContext = ctx;
                 activeContext.Update();
             }
             return;
         }
     }
     throw new InvalidOperationException();              // There must be at least the main context
 }
Пример #5
0
        internal void Remove(StatusBarContextImpl ctx)
        {
            if (ctx == mainContext)
            {
                return;
            }

            StatusBarContextImpl oldActive = activeContext;

            contexts.Remove(ctx);
            UpdateActiveContext();
            if (oldActive != activeContext)
            {
                // Removed the active context. Update the status bar.
                activeContext.Update();
            }
        }
Пример #6
0
		internal MonoDevelopStatusBar ()
		{
			mainContext = new MainStatusBarContextImpl (this);
			activeContext = mainContext;
			contexts.Add (mainContext);
			
			Frame originalFrame = (Frame)Children [0];
//			originalFrame.WidthRequest = 8;
//			originalFrame.Shadow = ShadowType.In;
//			originalFrame.BorderWidth = 0;
			
			BorderWidth = 0;
			Spacing = 0;
			
			// Feedback button
			
			if (FeedbackService.Enabled) {
				CustomFrame fr = new CustomFrame (0, 0, 1, 1);
				Gdk.Pixbuf px = Gdk.Pixbuf.LoadFromResource ("balloon.png");
				HBox b = new HBox (false, 3);
				b.PackStart (new Gtk.Image (px));
				b.PackStart (new Gtk.Label ("Feedback"));
				Gtk.Alignment al = new Gtk.Alignment (0f, 0f, 1f, 1f);
				al.RightPadding = 5;
				al.LeftPadding = 3;
				al.Add (b);
				feedbackButton = new MiniButton (al);
				//feedbackButton.BackroundColor = new Gdk.Color (200, 200, 255);
				fr.Add (feedbackButton);
				PackStart (fr, false, false, 0);
				feedbackButton.Clicked += HandleFeedbackButtonClicked;
				feedbackButton.ButtonPressEvent += HandleFeedbackButtonButtonPressEvent;
				;
				feedbackButton.ClickOnRelease = true;
				FeedbackService.FeedbackPositionGetter = delegate {
					int x, y;
					feedbackButton.GdkWindow.GetOrigin (out x, out y);
					x += feedbackButton.Allocation.Width;
					y -= 6;
					return new Gdk.Point (x, y);
				};
			}
			
			// Dock area
			
			DefaultWorkbench wb = (DefaultWorkbench)IdeApp.Workbench.RootWindow;
			wb.DockFrame.ShadedContainer.Add (this);
			Gtk.Widget dockBar = wb.DockFrame.ExtractDockBar (PositionType.Bottom);
			dockBar.NoShowAll = true;
			PackStart (dockBar, false, false, 0);
			
			// Status panels
			
			progressBar = new ProgressBar ();
			progressBar.PulseStep = 0.1;
			progressBar.SizeRequest ();
			progressBar.HeightRequest = 1;
			
			statusBox = new HBox (false, 0);
			statusBox.BorderWidth = 0;
			
			statusLabel = new Label ();
			statusLabel.SetAlignment (0, 0.5f);
			statusLabel.Wrap = false;
			int w, h;
			Gtk.Icon.SizeLookup (IconSize.Menu, out w, out h);
			statusLabel.HeightRequest = h;
			statusLabel.SetPadding (0, 0);
			
			EventBox eventMessageBox = new EventBox ();
			messageBox = new HBox ();
			messageBox.PackStart (progressBar, false, false, 0);
			messageBox.PackStart (statusLabel, true, true, 0);
			eventMessageBox.Add (messageBox);
			statusBox.PackStart (eventMessageBox, true, true, 0);
			eventMessageBox.ButtonPressEvent += HandleEventMessageBoxButtonPressEvent;
			
			textStatusBarPanel.BorderWidth = 0;
			textStatusBarPanel.ShadowType = ShadowType.None;
			textStatusBarPanel.Add (statusBox);
			
			var eventCaretBox = new EventBox ();
			var caretStatusBox = new HBox ();
			modeLabel = new Label (" ");
			caretStatusBox.PackEnd (modeLabel, false, false, 8);
			
			cursorLabel = new CaretStatusLabel (" ");
			caretStatusBox.PackEnd (cursorLabel, false, false, 0);
			
			caretStatusBox.GetSizeRequest (out w, out h);
			caretStatusBox.WidthRequest = w;
			caretStatusBox.HeightRequest = h;
			eventCaretBox.Add (caretStatusBox);
			statusBox.PackEnd (eventCaretBox, false, false, 0);
			
			statusIconBox = new HBox ();
			statusIconBox.BorderWidth = 0;
			statusIconBox.Spacing = 3;
			statusBox.PackEnd (statusIconBox, false, false, 4);
			
			this.PackStart (textStatusBarPanel, true, true, 0);
			
			ShowReady ();
			Gtk.Box.BoxChild boxChild = (Gtk.Box.BoxChild)this[textStatusBarPanel];
			boxChild.Position = 0;
			boxChild.Expand = boxChild.Fill = true;
			
	//		boxChild = (Gtk.Box.BoxChild)this[originalFrame];
	//		boxChild.Padding = 0;
	//		boxChild.Expand = boxChild.Fill = false;
			
			this.progressBar.Fraction = 0.0;
			this.ShowAll ();
			statusIconBox.HideAll ();
			
			originalFrame.HideAll ();
			progressBar.Visible = false;
			
			StatusBarContext completionStatus = null;
			
			// todo: Move this to the CompletionWindowManager when it's possible.
			CompletionWindowManager.WindowShown += delegate {
				CompletionListWindow wnd = CompletionWindowManager.Wnd;
				if (wnd != null && wnd.List != null && wnd.List.CategoryCount > 1) {
					if (completionStatus == null)
						completionStatus = CreateContext ();
					completionStatus.ShowMessage (string.Format (GettextCatalog.GetString ("To toggle categorized completion mode press {0}."), IdeApp.CommandService.GetCommandInfo (Commands.TextEditorCommands.ShowCompletionWindow).AccelKey));
				}
			};
			
			CompletionWindowManager.WindowClosed += delegate {
				if (completionStatus != null) {
					completionStatus.Dispose ();
					completionStatus = null;
				}
			};
		}
Пример #7
0
		public StatusBarContext CreateContext ()
		{
			StatusBarContextImpl ctx = new StatusBarContextImpl (this);
			contexts.Add (ctx);
			return ctx;
		}
Пример #8
0
		internal void UpdateActiveContext ()
		{
			for (int n = contexts.Count - 1; n >= 0; n--) {
				StatusBarContextImpl ctx = contexts [n];
				if (ctx.StatusChanged) {
					if (ctx != activeContext) {
						activeContext = ctx;
						activeContext.Update ();
					}
					return;
				}
			}
			throw new InvalidOperationException (); // There must be at least the main context
		}
Пример #9
0
		internal bool IsCurrentContext (StatusBarContextImpl ctx)
		{
			return ctx == activeContext;
		}
Пример #10
0
        internal MonoDevelopStatusBar()
        {
            mainContext   = new MainStatusBarContextImpl(this);
            activeContext = mainContext;
            contexts.Add(mainContext);

            Frame originalFrame = (Frame)Children[0];

//			originalFrame.WidthRequest = 8;
//			originalFrame.Shadow = ShadowType.In;
//			originalFrame.BorderWidth = 0;

            BorderWidth = 0;
            Spacing     = 0;

            // Feedback button

            CustomFrame fr = new CustomFrame(0, 0, 1, 1);

            Gdk.Pixbuf px = Gdk.Pixbuf.LoadFromResource("balloon.png");
            HBox       b  = new HBox(false, 3);

            b.PackStart(new Gtk.Image(px));
            b.PackStart(new Gtk.Label("Feedback"));
            Gtk.Alignment al = new Gtk.Alignment(0f, 0f, 1f, 1f);
            al.RightPadding = 5;
            al.LeftPadding  = 3;
            al.Add(b);
            feedbackButton = new MiniButton(al);
            //feedbackButton.BackroundColor = new Gdk.Color (200, 200, 255);
            fr.Add(feedbackButton);
            PackStart(fr, false, false, 0);
            feedbackButton.Clicked                += HandleFeedbackButtonClicked;
            feedbackButton.ButtonPressEvent       += HandleFeedbackButtonButtonPressEvent;;
            feedbackButton.ClickOnRelease          = true;
            FeedbackService.FeedbackPositionGetter = delegate {
                int x, y;
                feedbackButton.GdkWindow.GetOrigin(out x, out y);
                x += feedbackButton.Allocation.Width;
                y -= 6;
                return(new Gdk.Point(x, y));
            };

            // Dock area

            DefaultWorkbench wb = (DefaultWorkbench)IdeApp.Workbench.RootWindow;

            wb.DockFrame.ShadedContainer.Add(this);
            Gtk.Widget dockBar = wb.DockFrame.ExtractDockBar(PositionType.Bottom);
            dockBar.NoShowAll = true;
            PackStart(dockBar, false, false, 0);

            // Status panels

            progressBar           = new ProgressBar();
            progressBar.PulseStep = 0.1;
            progressBar.SizeRequest();
            progressBar.HeightRequest = 1;

            statusBox             = new HBox(false, 0);
            statusBox.BorderWidth = 0;

            statusLabel = new Label();
            statusLabel.SetAlignment(0, 0.5f);
            statusLabel.Wrap = false;
            int w, h;

            Gtk.Icon.SizeLookup(IconSize.Menu, out w, out h);
            statusLabel.HeightRequest = h;
            statusLabel.SetPadding(0, 0);

            EventBox eventMessageBox = new EventBox();

            messageBox = new HBox();
            messageBox.PackStart(progressBar, false, false, 0);
            messageBox.PackStart(statusLabel, true, true, 0);
            eventMessageBox.Add(messageBox);
            statusBox.PackStart(eventMessageBox, true, true, 0);
            eventMessageBox.ButtonPressEvent += HandleEventMessageBoxButtonPressEvent;

            textStatusBarPanel.BorderWidth = 0;
            textStatusBarPanel.ShadowType  = ShadowType.None;
            textStatusBarPanel.Add(statusBox);
            Label fillerLabel = new Label();

            fillerLabel.WidthRequest = 8;
            statusBox.PackEnd(fillerLabel, false, false, 0);

            modeLabel = new Label(" ");
            statusBox.PackEnd(modeLabel, false, false, 8);

            cursorLabel = new Label(" ");
            statusBox.PackEnd(cursorLabel, false, false, 0);

            statusIconBox             = new HBox();
            statusIconBox.BorderWidth = 0;
            statusIconBox.Spacing     = 3;
            statusBox.PackEnd(statusIconBox, false, false, 4);

            this.PackStart(textStatusBarPanel, true, true, 0);

            ShowReady();
            Gtk.Box.BoxChild boxChild = (Gtk.Box.BoxChild) this[textStatusBarPanel];
            boxChild.Position = 0;
            boxChild.Expand   = boxChild.Fill = true;

            //		boxChild = (Gtk.Box.BoxChild)this[originalFrame];
            //		boxChild.Padding = 0;
            //		boxChild.Expand = boxChild.Fill = false;

            this.progressBar.Fraction = 0.0;
            this.ShowAll();
            statusIconBox.HideAll();

            originalFrame.HideAll();
            progressBar.Visible = false;

            StatusBarContext completionStatus = null;

            // todo: Move this to the CompletionWindowManager when it's possible.
            CompletionWindowManager.WindowShown += delegate {
                CompletionListWindow wnd = CompletionWindowManager.Wnd;
                if (wnd != null && wnd.List != null && wnd.List.CategoryCount > 1)
                {
                    if (completionStatus == null)
                    {
                        completionStatus = CreateContext();
                    }
                    completionStatus.ShowMessage(string.Format(GettextCatalog.GetString("To toggle categorized completion mode press {0}."), IdeApp.CommandService.GetCommandInfo(Commands.TextEditorCommands.ShowCompletionWindow).AccelKey));
                }
            };

            CompletionWindowManager.WindowClosed += delegate {
                if (completionStatus != null)
                {
                    completionStatus.Dispose();
                    completionStatus = null;
                }
            };
        }
Пример #11
0
 internal bool IsCurrentContext(StatusBarContextImpl ctx)
 {
     return(ctx == activeContext);
 }
Пример #12
0
        public StatusArea()
        {
            theme = new StatusAreaTheme ();
            renderArg = new RenderArg ();

            mainContext = new MainStatusBarContextImpl (this);
            activeContext = mainContext;
            contexts.Add (mainContext);

            VisibleWindow = false;
            NoShowAll = true;
            WidgetFlags |= Gtk.WidgetFlags.AppPaintable;

            statusIconBox.BorderWidth = 0;
            statusIconBox.Spacing = 3;

            Action<bool> animateProgressBar =
                showing => this.Animate ("ProgressBarFade",
                                         val => renderArg.ProgressBarAlpha = val,
                                         renderArg.ProgressBarAlpha,
                                         showing ? 1.0f : 0.0f,
                                         easing: Easing.CubicInOut);

            ProgressBegin += delegate {
                renderArg.ShowProgressBar = true;
            //				StartBuildAnimation ();
                renderArg.ProgressBarFraction = 0;
                QueueDraw ();
                animateProgressBar (true);
            };

            ProgressEnd += delegate {
                renderArg.ShowProgressBar = false;
            //				StopBuildAnimation ();
                QueueDraw ();
                animateProgressBar (false);
            };

            ProgressFraction += delegate(object sender, FractionEventArgs e) {
                renderArg.ProgressBarFraction = (float)e.Work;
                QueueDraw ();
            };

            contentBox.PackStart (messageBox, true, true, 0);
            contentBox.PackEnd (statusIconBox, false, false, 0);
            contentBox.PackEnd (statusIconSeparator = new StatusAreaSeparator (), false, false, 0);
            contentBox.PackEnd (buildResultWidget = CreateBuildResultsWidget (Orientation.Horizontal), false, false, 0);

            HasTooltip = true;
            QueryTooltip += messageBoxToolTip;

            mainAlign = new Alignment (0, 0.5f, 1, 0);
            mainAlign.LeftPadding = 12;
            mainAlign.RightPadding = 8;
            mainAlign.Add (contentBox);
            Add (mainAlign);

            mainAlign.ShowAll ();
            statusIconBox.Hide ();
            statusIconSeparator.Hide ();
            buildResultWidget.Hide ();
            Show ();

            this.ButtonPressEvent += delegate {
                if (sourcePad != null)
                    sourcePad.BringToFront (true);
            };

            statusIconBox.Shown += delegate {
                UpdateSeparators ();
            };

            statusIconBox.Hidden += delegate {
                UpdateSeparators ();
            };

            messageQueue = new Queue<Message> ();

            tracker = new MouseTracker(this);
            tracker.MouseMoved += (sender, e) => QueueDraw ();
            tracker.HoveredChanged += (sender, e) => {
                this.Animate ("Hovered",
                              x => renderArg.HoverProgress = x,
                              renderArg.HoverProgress,
                              tracker.Hovered ? 1.0f : 0.0f,
                              easing: Easing.SinInOut);
            };

            IdeApp.FocusIn += delegate {
                // If there was an error while the application didn't have the focus,
                // trigger the error animation again when it gains the focus
                if (errorAnimPending) {
                    errorAnimPending = false;
                    TriggerErrorAnimation ();
                }
            };
        }
		internal MonoDevelopStatusBar()
		{
			mainContext = new MainStatusBarContextImpl (this);
			activeContext = mainContext;
			contexts.Add (mainContext);
			
			Frame originalFrame = (Frame)Children[0];
//			originalFrame.WidthRequest = 8;
//			originalFrame.Shadow = ShadowType.In;
//			originalFrame.BorderWidth = 0;
			
			BorderWidth = 0;
			
			DefaultWorkbench wb = (DefaultWorkbench) IdeApp.Workbench.RootWindow;
			wb.DockFrame.ShadedContainer.Add (this);
			Gtk.Widget dockBar = wb.DockFrame.ExtractDockBar (PositionType.Bottom);
			dockBar.NoShowAll = true;
			PackStart (dockBar, false, false, 0);
			
			progressBar = new ProgressBar ();
			progressBar.PulseStep = 0.1;
			progressBar.SizeRequest ();
			progressBar.HeightRequest = 1;
			
			statusBox = new HBox (false, 0);
			statusBox.BorderWidth = 0;
			
			statusLabel = new Label ();
			statusLabel.SetAlignment (0, 0.5f);
			statusLabel.Wrap = false;
			int w, h;
			Gtk.Icon.SizeLookup (IconSize.Menu, out w, out h);
			statusLabel.HeightRequest = h;
			statusLabel.SetPadding (0, 0);
			
			EventBox eventMessageBox = new EventBox ();
			messageBox = new HBox ();
			messageBox.PackStart (progressBar, false, false, 0);
			messageBox.PackStart (statusLabel, true, true, 0);
			eventMessageBox.Add (messageBox);
			statusBox.PackStart (eventMessageBox, true, true, 0);
			eventMessageBox.ButtonPressEvent += HandleEventMessageBoxButtonPressEvent;
			
			textStatusBarPanel.BorderWidth = 0;
			textStatusBarPanel.ShadowType = ShadowType.None;
			textStatusBarPanel.Add (statusBox);
			Label fillerLabel = new Label ();
			fillerLabel.WidthRequest = 8;
			statusBox.PackEnd (fillerLabel, false, false, 0);
			
			modeLabel = new Label (" ");
			statusBox.PackEnd (modeLabel, false, false, 8);
			
			cursorLabel = new Label (" ");
			statusBox.PackEnd (cursorLabel, false, false, 0);
			
			statusIconBox = new HBox ();
			statusIconBox.BorderWidth = 0;
			statusIconBox.Spacing = 3;
			statusBox.PackEnd (statusIconBox, false, false, 4);
			
			this.PackStart (textStatusBarPanel, true, true, 0);
			
			ShowReady ();
			Gtk.Box.BoxChild boxChild = (Gtk.Box.BoxChild)this[textStatusBarPanel];
			boxChild.Position = 0;
			boxChild.Expand = boxChild.Fill = true;
			
	//		boxChild = (Gtk.Box.BoxChild)this[originalFrame];
	//		boxChild.Padding = 0;
	//		boxChild.Expand = boxChild.Fill = false;
			
			this.progressBar.Fraction = 0.0;
			this.ShowAll ();
			statusIconBox.HideAll ();
			
			originalFrame.HideAll ();
			progressBar.Visible = false;
			
			StatusBarContext completionStatus = null;
			
			// todo: Move this to the CompletionWindowManager when it's possible.
			CompletionWindowManager.WindowShown += delegate {
				CompletionListWindow wnd = CompletionWindowManager.Wnd;
				if (wnd != null && wnd.List != null && wnd.List.CategoryCount > 1) {
					if (completionStatus == null)
						completionStatus = CreateContext ();
					completionStatus.ShowMessage (string.Format (GettextCatalog.GetString ("To toggle categorized completion mode press {0}."), IdeApp.CommandService.GetCommandInfo (Commands.TextEditorCommands.ShowCompletionWindow).AccelKey));
				}
			};
			
			CompletionWindowManager.WindowClosed += delegate {
				if (completionStatus != null) {
					completionStatus.Dispose ();
					completionStatus = null;
				}
			};
		}
        internal MonoDevelopStatusBar()
        {
            mainContext   = new MainStatusBarContextImpl(this);
            activeContext = mainContext;
            contexts.Add(mainContext);

            Frame originalFrame = (Frame)Children[0];

//			originalFrame.WidthRequest = 8;
//			originalFrame.Shadow = ShadowType.In;
//			originalFrame.BorderWidth = 0;

            BorderWidth = 0;

            DefaultWorkbench wb = (DefaultWorkbench)IdeApp.Workbench.RootWindow;

            wb.DockFrame.ShadedContainer.Add(this);
            Gtk.Widget dockBar = wb.DockFrame.ExtractDockBar(PositionType.Bottom);
            dockBar.NoShowAll = true;
            PackStart(dockBar, false, false, 0);

            progressBar           = new ProgressBar();
            progressBar.PulseStep = 0.1;
            progressBar.SizeRequest();
            progressBar.HeightRequest = 1;

            statusBox             = new HBox(false, 0);
            statusBox.BorderWidth = 0;

            statusLabel = new Label();
            statusLabel.SetAlignment(0, 0.5f);
            statusLabel.Wrap = false;
            int w, h;

            Gtk.Icon.SizeLookup(IconSize.Menu, out w, out h);
            statusLabel.HeightRequest = h;
            statusLabel.SetPadding(0, 0);

            EventBox eventMessageBox = new EventBox();

            messageBox = new HBox();
            messageBox.PackStart(progressBar, false, false, 0);
            messageBox.PackStart(statusLabel, true, true, 0);
            eventMessageBox.Add(messageBox);
            statusBox.PackStart(eventMessageBox, true, true, 0);
            eventMessageBox.ButtonPressEvent += HandleEventMessageBoxButtonPressEvent;

            textStatusBarPanel.BorderWidth = 0;
            textStatusBarPanel.ShadowType  = ShadowType.None;
            textStatusBarPanel.Add(statusBox);
            Label fillerLabel = new Label();

            fillerLabel.WidthRequest = 8;
            statusBox.PackEnd(fillerLabel, false, false, 0);

            modeLabel = new Label(" ");
            statusBox.PackEnd(modeLabel, false, false, 8);

            cursorLabel = new Label(" ");
            statusBox.PackEnd(cursorLabel, false, false, 0);

            statusIconBox             = new HBox();
            statusIconBox.BorderWidth = 0;
            statusIconBox.Spacing     = 3;
            statusBox.PackEnd(statusIconBox, false, false, 4);

            this.PackStart(textStatusBarPanel, true, true, 0);

            ShowReady();
            Gtk.Box.BoxChild boxChild = (Gtk.Box.BoxChild) this[textStatusBarPanel];
            boxChild.Position = 0;
            boxChild.Expand   = boxChild.Fill = true;

            //		boxChild = (Gtk.Box.BoxChild)this[originalFrame];
            //		boxChild.Padding = 0;
            //		boxChild.Expand = boxChild.Fill = false;

            this.progressBar.Fraction = 0.0;
            this.ShowAll();
            statusIconBox.HideAll();

            originalFrame.HideAll();
            progressBar.Visible = false;

            StatusBarContext completionStatus = null;

            // todo: Move this to the CompletionWindowManager when it's possible.
            CompletionWindowManager.WindowShown += delegate {
                CompletionListWindow wnd = CompletionWindowManager.Wnd;
                if (wnd != null && wnd.List != null && wnd.List.CategoryCount > 1)
                {
                    if (completionStatus == null)
                    {
                        completionStatus = CreateContext();
                    }
                    completionStatus.ShowMessage(string.Format(GettextCatalog.GetString("To toggle categorized completion mode press {0}."), IdeApp.CommandService.GetCommandInfo(Commands.TextEditorCommands.ShowCompletionWindow).AccelKey));
                }
            };

            CompletionWindowManager.WindowClosed += delegate {
                if (completionStatus != null)
                {
                    completionStatus.Dispose();
                    completionStatus = null;
                }
            };
        }