protected override void OnDestroyed()
 {
     if (Child != null)
     {
         Child.Destroy();
     }
     if (vAdjustment != null)
     {
         vAdjustment.Changed -= HandleAdjustmentChanged;
         vAdjustment.Destroy();
         vAdjustment = null;
     }
     if (hAdjustment != null)
     {
         hAdjustment.Changed -= HandleAdjustmentChanged;
         hAdjustment.Destroy();
         hAdjustment = null;
     }
     if (vScrollBar != null)
     {
         vScrollBar.Destroy();
         vScrollBar = null;
     }
     if (hScrollBar != null)
     {
         hScrollBar.Destroy();
         hScrollBar = null;
     }
     foreach (var c in children)
     {
         c.Child.Destroy();
     }
     base.OnDestroyed();
 }
示例#2
0
        public BlameWidget(VersionControlDocumentInfo info)
        {
            this.info = info;

            vAdjustment          = new Adjustment(0, 0, 0, 0, 0, 0);
            vAdjustment.Changed += HandleAdjustmentChanged;

            vScrollBar = new VScrollbar(vAdjustment);
            AddChild(vScrollBar);

            hAdjustment          = new Adjustment(0, 0, 0, 0, 0, 0);
            hAdjustment.Changed += HandleAdjustmentChanged;

            hScrollBar = new HScrollbar(hAdjustment);
            AddChild(hScrollBar);

            editor = new TextEditor(info.Document.TextEditorData.Document, info.Document.TextEditorData.Options);
            AddChild(editor);
            editor.SetScrollAdjustments(hAdjustment, vAdjustment);

            overview = new BlameRenderer(this);
            AddChild(overview);

            this.DoubleBuffered          = true;
            editor.ExposeEvent          += HandleEditorExposeEvent;
            editor.EditorOptionsChanged += delegate {
                overview.OptionsChanged();
            };
        }
示例#3
0
        public BlameWidget(VersionControlDocumentInfo info)
        {
            GtkWorkarounds.FixContainerLeak(this);

            this.info = info;
            var sourceEditor = info.Document.GetContent <MonoDevelop.SourceEditor.SourceEditorView> ();

            vAdjustment = new Adjustment(
                sourceEditor.TextEditor.VAdjustment.Value,
                sourceEditor.TextEditor.VAdjustment.Lower,
                sourceEditor.TextEditor.VAdjustment.Upper,
                sourceEditor.TextEditor.VAdjustment.StepIncrement,
                sourceEditor.TextEditor.VAdjustment.PageIncrement,
                sourceEditor.TextEditor.VAdjustment.PageSize);
            vAdjustment.Changed += HandleAdjustmentChanged;

            vScrollBar = new VScrollbar(vAdjustment);
            AddChild(vScrollBar);

            hAdjustment = new Adjustment(
                sourceEditor.TextEditor.HAdjustment.Value,
                sourceEditor.TextEditor.HAdjustment.Lower,
                sourceEditor.TextEditor.HAdjustment.Upper,
                sourceEditor.TextEditor.HAdjustment.StepIncrement,
                sourceEditor.TextEditor.HAdjustment.PageIncrement,
                sourceEditor.TextEditor.HAdjustment.PageSize);
            hAdjustment.Changed += HandleAdjustmentChanged;

            hScrollBar = new HScrollbar(hAdjustment);
            AddChild(hScrollBar);

            var doc = new TextDocument(sourceEditor.TextEditor.Document.Text)
            {
                IsReadOnly = true,
                MimeType   = sourceEditor.TextEditor.Document.MimeType,
            };

            editor = new MonoTextEditor(doc, sourceEditor.TextEditor.Options);
            AddChild(editor);
            editor.SetScrollAdjustments(hAdjustment, vAdjustment);

            overview = new BlameRenderer(this);
            AddChild(overview);

            this.DoubleBuffered          = true;
            editor.Painted              += HandleEditorExposeEvent;
            editor.EditorOptionsChanged += delegate {
                overview.OptionsChanged();
            };
            editor.Caret.PositionChanged += ComparisonWidget.CaretPositionChanged;
            editor.FocusInEvent          += ComparisonWidget.EditorFocusIn;
            editor.Document.Folded       += delegate {
                QueueDraw();
            };
            editor.Document.FoldTreeUpdated += delegate {
                QueueDraw();
            };
            editor.DoPopupMenu = ShowPopup;
            Show();
        }
示例#4
0
        public BlameWidget(VersionControlDocumentInfo info)
        {
            GtkWorkarounds.FixContainerLeak(this);

            this.info = info;
            var textView = info.Controller.GetContent <ITextView> ();

            vAdjustment          = new Adjustment(0, 0, 0, 0, 0, 0);
            vAdjustment.Changed += HandleAdjustmentChanged;

            vScrollBar = new VScrollbar(vAdjustment);
            AddChild(vScrollBar);

            hAdjustment          = new Adjustment(0, 0, 0, 0, 0, 0);
            hAdjustment.Changed += HandleAdjustmentChanged;

            hScrollBar = new HScrollbar(hAdjustment);
            AddChild(hScrollBar);

            var doc = new TextDocument(textView.TextSnapshot.GetText())
            {
                IsReadOnly = true,
                MimeType   = IdeServices.DesktopService.GetMimeTypeForContentType(textView.TextBuffer.ContentType)
            };
            var options = new CustomEditorOptions(DefaultSourceEditorOptions.Instance);

            options.TabsToSpaces = false;

            editor = new MonoTextEditor(doc, new SourceEditor.StyledSourceEditorOptions(options));

            AddChild(editor);
            editor.SetScrollAdjustments(hAdjustment, vAdjustment);

            overview = new BlameRenderer(this);
            AddChild(overview);

            this.DoubleBuffered          = true;
            editor.Painted              += HandleEditorExposeEvent;
            editor.EditorOptionsChanged += delegate {
                overview.OptionsChanged();
            };
            editor.Caret.PositionChanged += ComparisonWidget.CaretPositionChanged;
            editor.FocusInEvent          += ComparisonWidget.EditorFocusIn;
            editor.Document.Folded       += delegate {
                QueueDraw();
            };
            editor.Document.FoldTreeUpdated += delegate {
                QueueDraw();
            };
            editor.DoPopupMenu = ShowPopup;
            Show();
        }
        public SmartScrolledWindow()
        {
            vAdjustment          = new Adjustment(0, 0, 0, 0, 0, 0);
            vAdjustment.Changed += HandleAdjustmentChanged;

            vScrollBar        = new VScrollbar(vAdjustment);
            vScrollBar.Parent = this;
            vScrollBar.Show();

            hAdjustment          = new Adjustment(0, 0, 0, 0, 0, 0);
            hAdjustment.Changed += HandleAdjustmentChanged;

            hScrollBar        = new HScrollbar(hAdjustment);
            hScrollBar.Parent = this;
            hScrollBar.Show();
        }
示例#6
0
		public SmartScrolledWindow (Gtk.Widget vScrollBar = null)
		{
			vAdjustment = new Adjustment (0, 0, 0, 0, 0, 0);
			vAdjustment.Changed += HandleAdjustmentChanged;
			
			this.vScrollBar = vScrollBar ?? new VScrollbar (vAdjustment);
			this.vScrollBar.Parent = this;
			this.vScrollBar.Show ();
			
			hAdjustment = new Adjustment (0, 0, 0, 0, 0, 0);
			hAdjustment.Changed += HandleAdjustmentChanged;
			
			hScrollBar = new HScrollbar (hAdjustment);
			hScrollBar.Parent = this;
			hScrollBar.Show ();
		}
		public SmartScrolledWindow ()
		{
			vAdjustment = new Adjustment (0, 0, 0, 0, 0, 0);
			vAdjustment.Changed += HandleAdjustmentChanged;
			
			vScrollBar = new VScrollbar (vAdjustment);
			vScrollBar.Parent = this;
			vScrollBar.Show ();
			
			hAdjustment = new Adjustment (0, 0, 0, 0, 0, 0);
			hAdjustment.Changed += HandleAdjustmentChanged;
			
			hScrollBar = new HScrollbar (hAdjustment);
			hScrollBar.Parent = this;
			hScrollBar.Show ();
		}
示例#8
0
        public SmartScrolledWindow(Gtk.Widget vScrollBar = null)
        {
            vAdjustment          = new Adjustment(0, 0, 0, 0, 0, 0);
            vAdjustment.Changed += HandleAdjustmentChanged;

            this.vScrollBar        = vScrollBar ?? new VScrollbar(vAdjustment);
            this.vScrollBar.Parent = this;
            this.vScrollBar.Show();

            hAdjustment          = new Adjustment(0, 0, 0, 0, 0, 0);
            hAdjustment.Changed += HandleAdjustmentChanged;

            hScrollBar        = new HScrollbar(hAdjustment);
            hScrollBar.Parent = this;
            hScrollBar.Show();
        }
        public SmartScrolledWindow(Gtk.Widget vScrollBar = null)
        {
            GtkWorkarounds.FixContainerLeak(this);

            vAdjustment          = new Adjustment(0, 0, 0, 0, 0, 0);
            vAdjustment.Changed += HandleAdjustmentChanged;

            this.vScrollBar        = vScrollBar ?? new VScrollbar(vAdjustment);
            this.vScrollBar.Parent = this;
            this.vScrollBar.Show();

            hAdjustment          = new Adjustment(0, 0, 0, 0, 0, 0);
            hAdjustment.Changed += HandleAdjustmentChanged;

            hScrollBar        = new HScrollbar(hAdjustment);
            hScrollBar.Parent = this;
            hScrollBar.Show();
        }
		public SmartScrolledWindow (Gtk.Widget vScrollBar = null)
		{
			GtkWorkarounds.FixContainerLeak (this);
			
			vAdjustment = new Adjustment (0, 0, 0, 0, 0, 0);
			vAdjustment.Changed += HandleAdjustmentChanged;
			
			this.vScrollBar = vScrollBar ?? new VScrollbar (vAdjustment);
			this.vScrollBar.Parent = this;
			this.vScrollBar.Show ();
			
			hAdjustment = new Adjustment (0, 0, 0, 0, 0, 0);
			hAdjustment.Changed += HandleAdjustmentChanged;
			
			hScrollBar = new HScrollbar (hAdjustment);
			hScrollBar.Parent = this;
			hScrollBar.Show ();
		}
    public ScrollBarRenderView(RenderView renderview)
        : base(2, 2, false)
    {
        this.renderview = renderview;
        Attach(renderview, 0, 1, 0, 1,
               AttachOptions.Expand | AttachOptions.Fill,
               AttachOptions.Expand | AttachOptions.Fill, 0, 0);

        Adjustment hadjustment = new Adjustment(0, -10, 10, 1, 2, 2);
        HScrollbar hscroll = new HScrollbar(hadjustment);
        Attach(hscroll, 0, 1, 1, 2,
                 AttachOptions.Expand | AttachOptions.Fill, 0, 0, 0);

        Adjustment vadjustment = new Adjustment(0, -10, 10, 1, 2, 2);
        VScrollbar vscroll = new VScrollbar(vadjustment);
        Attach(vscroll, 1, 2, 0, 1,
                 0, AttachOptions.Expand | AttachOptions.Fill, 0, 0);

        renderview.SetAdjustments(hadjustment, vadjustment);
    }
示例#12
0
 public MyControl()
 {
     Events = Gdk.EventMask.AllEventsMask;
     var vb = new VBox();
     var hScrollBar = new HScrollbar(new Adjustment(1, 1, 100, 1, 20, 10));
     hScrollBar.ChangeValue += (o, args) =>
     {
         //Console.WriteLine("Arg.Value: {0}", args.Args[1]);
         Console.WriteLine("scrollBar.Value: {0}", hScrollBar.Value);
         Console.WriteLine("scrollBar.OldValue: {0}", sbOldValue);
         sbOldValue = hScrollBar.Value;
     };
     hScrollBar.ValueChanged += (o, args) =>
     {
         Console.WriteLine("scrollBar.Value: {0}", hScrollBar.Value);
     };
     vb.PackEnd(hScrollBar, false, false, 0);
     Add(vb);
     ShowAll();
 }
示例#13
0
        public BlameWidget(VersionControlDocumentInfo info)
        {
            this.info = info;
            var sourceEditor = info.Document.GetContent <MonoDevelop.SourceEditor.SourceEditorView> ();

            vAdjustment          = new Adjustment(0, 0, 0, 0, 0, 0);
            vAdjustment.Changed += HandleAdjustmentChanged;

            vScrollBar = new VScrollbar(vAdjustment);
            AddChild(vScrollBar);

            hAdjustment          = new Adjustment(0, 0, 0, 0, 0, 0);
            hAdjustment.Changed += HandleAdjustmentChanged;

            hScrollBar = new HScrollbar(hAdjustment);
            AddChild(hScrollBar);

            editor = new TextEditor(sourceEditor.TextEditor.Document, sourceEditor.TextEditor.Options);
            AddChild(editor);
            editor.SetScrollAdjustments(hAdjustment, vAdjustment);

            overview = new BlameRenderer(this);
            AddChild(overview);

            this.DoubleBuffered          = true;
            editor.Painted              += HandleEditorExposeEvent;
            editor.EditorOptionsChanged += delegate {
                overview.OptionsChanged();
            };
            editor.Caret.PositionChanged += ComparisonWidget.CaretPositionChanged;
            editor.FocusInEvent          += ComparisonWidget.EditorFocusIn;
            editor.Document.Folded       += delegate {
                QueueDraw();
            };
            editor.Document.FoldTreeUpdated += delegate {
                QueueDraw();
            };
            editor.ButtonPressEvent += OnPopupMenu;
            Show();
        }
示例#14
0
		public BlameWidget (VersionControlDocumentInfo info)
		{
			this.info = info;
			
			vAdjustment = new Adjustment (0, 0, 0, 0, 0, 0);
			vAdjustment.Changed += HandleAdjustmentChanged;
			
			vScrollBar = new VScrollbar (vAdjustment);
			AddChild (vScrollBar);
			
			hAdjustment = new Adjustment (0, 0, 0, 0, 0, 0);
			hAdjustment.Changed += HandleAdjustmentChanged;
			
			hScrollBar = new HScrollbar (hAdjustment);
			AddChild (hScrollBar);
			
			editor = new TextEditor (info.Document.Editor.Document, info.Document.Editor.Options);
			AddChild (editor);
			editor.SetScrollAdjustments (hAdjustment, vAdjustment);
			
			overview = new BlameRenderer (this);
			AddChild (overview);
			
			this.DoubleBuffered = true;
			editor.Painted += HandleEditorExposeEvent;
			editor.EditorOptionsChanged += delegate {
				overview.OptionsChanged ();
			};
			editor.Caret.PositionChanged += ComparisonWidget.CaretPositionChanged;
			editor.FocusInEvent += ComparisonWidget.EditorFocusIn;
			editor.Document.Folded += delegate {
				QueueDraw ();
			};
			editor.Document.FoldTreeUpdated += delegate {
				QueueDraw ();
			};
			editor.ButtonPressEvent += OnPopupMenu;
			Show ();
		}
示例#15
0
		public BlameWidget (VersionControlDocumentInfo info)
		{
			this.info = info;
			
			vAdjustment = new Adjustment (0, 0, 0, 0, 0, 0);
			vAdjustment.Changed += HandleAdjustmentChanged;
			
			vScrollBar = new VScrollbar (vAdjustment);
			AddChild (vScrollBar);
			
			hAdjustment = new Adjustment (0, 0, 0, 0, 0, 0);
			hAdjustment.Changed += HandleAdjustmentChanged;
			
			hScrollBar = new HScrollbar (hAdjustment);
			AddChild (hScrollBar);
			
			editor = new TextEditor (info.Document.TextEditorData.Document, info.Document.TextEditorData.Options);
			AddChild (editor);
			editor.SetScrollAdjustments (hAdjustment, vAdjustment);
			
			overview = new BlameRenderer (this);
			AddChild (overview);
			
			this.DoubleBuffered = true;
			editor.ExposeEvent += HandleEditorExposeEvent;
			editor.EditorOptionsChanged += delegate {
				overview.OptionsChanged ();
			};
		}
示例#16
0
 public ScrolledUserControl()
     : base()
 {
     Remove(this.drawingArea);
     this.scrollbar = new HScrollbar(new Adjustment(0, 0, 100, 1, 20, 20));
     var vb = new VBox();
     vb.PackStart(this.drawingArea, true, true, 0);
     vb.PackStart(this.scrollbar, false, true, 0);
     Add(vb);
     ShowAll();
 }
示例#17
0
		public ComparisonWidget (VersionControlDocumentInfo info)
		{
			this.info = info;
			vAdjustment = new Adjustment (0, 0, 0, 0, 0, 0);
			vAdjustment.Changed += HandleAdjustmentChanged;
			leftVAdjustment = new Adjustment (0, 0, 0, 0, 0, 0);
			Connect (leftVAdjustment, vAdjustment);
			
			rightVAdjustment =  new Adjustment (0, 0, 0, 0, 0, 0);
			Connect (rightVAdjustment, vAdjustment);
			
			vScrollBar = new VScrollbar (vAdjustment);
			AddChild (vScrollBar);
			vScrollBar.Hide ();
			
			hAdjustment = new Adjustment (0, 0, 0, 0, 0, 0);
			hAdjustment.Changed += HandleAdjustmentChanged;
			leftHAdjustment = new Adjustment (0, 0, 0, 0, 0, 0);
			Connect (leftHAdjustment, hAdjustment);
			
			rightHAdjustment =  new Adjustment (0, 0, 0, 0, 0, 0);
			Connect (rightHAdjustment, hAdjustment);
			
			leftHScrollBar = new HScrollbar (hAdjustment);
			AddChild (leftHScrollBar);
			
			rightHScrollBar = new HScrollbar (hAdjustment);
			AddChild (rightHScrollBar);
			
			originalEditor = new TextEditor ();
			originalEditor.Caret.PositionChanged += CaretPositionChanged;
			originalEditor.FocusInEvent += EditorFocusIn;
			AddChild (originalEditor);
			originalEditor.SetScrollAdjustments (leftHAdjustment, leftVAdjustment);
			
			originalComboBox = new DropDownBox ();
			originalComboBox.WindowRequestFunc = CreateComboBoxSelector;
			originalComboBox.Text = "Local";
			originalComboBox.Tag = originalEditor;
			AddChild (originalComboBox);
			
			diffEditor = new TextEditor ();
			diffEditor.Caret.PositionChanged += CaretPositionChanged;
			diffEditor.FocusInEvent += EditorFocusIn;
			
			AddChild (diffEditor);
			diffEditor.Document.ReadOnly = true;
			diffEditor.SetScrollAdjustments (leftHAdjustment, leftVAdjustment);
			this.vAdjustment.ValueChanged += delegate {
				middleArea.QueueDraw ();
			};
			
			diffComboBox = new DropDownBox ();
			diffComboBox.WindowRequestFunc = CreateComboBoxSelector;
			diffComboBox.Text = "Base";
			diffComboBox.Tag = diffEditor;
			AddChild (diffComboBox);
			
			
			overview = new OverviewRenderer (this);
			AddChild (overview);
			
			middleArea = new MiddleArea (this);
			AddChild (middleArea);
			
			prev = new Button ();
			prev.Add (new Arrow (ArrowType.Up, ShadowType.None));
			AddChild (prev);
			prev.ShowAll ();
			prev.Clicked += delegate {
				if (this.Diff == null)
					return;
				originalEditor.GrabFocus ();
				
				int line = originalEditor.Caret.Line;
				int max  = -1, searched = -1;
				foreach (Diff.Hunk hunk in this.Diff) {
					if (hunk.Same)
						continue;
					max = System.Math.Max (hunk.Right.Start, max);
					if (hunk.Right.Start < line)
						searched = System.Math.Max (hunk.Right.Start, searched);
				}
				if (max >= 0) {
					originalEditor.Caret.Line = searched < 0 ? max : searched;
					originalEditor.CenterToCaret ();
				}
			};
			
			next = new Button ();
			next.BorderWidth = 0;
			next.Add (new Arrow (ArrowType.Down, ShadowType.None));
			next.Clicked += delegate {
				if (this.Diff == null)
					return;
				originalEditor.GrabFocus ();
				
				int line = originalEditor.Caret.Line;
				int min  = Int32.MaxValue, searched = Int32.MaxValue;
				foreach (Diff.Hunk hunk in this.Diff) {
					if (hunk.Same)
						continue;
					min = System.Math.Min (hunk.Right.Start, min);
					if (hunk.Right.Start > line)
						searched = System.Math.Min (hunk.Right.Start, searched);
				}
				if (min < Int32.MaxValue) {
					originalEditor.Caret.Line = searched == Int32.MaxValue ? min : searched;
					originalEditor.CenterToCaret ();
				}
			};
			AddChild (next);
			next.ShowAll ();
			
			this.DoubleBuffered = true;
			originalEditor.ExposeEvent += HandleLeftEditorExposeEvent;
			diffEditor.ExposeEvent += HandleRightEditorExposeEvent;
			info.Document.Editor.Document.TextReplaced += HandleInfoDocumentTextEditorDataDocumentTextReplaced;
		}
示例#18
0
        public ComparisonWidget(VersionControlDocumentInfo info)
        {
            vAdjustment          = new Adjustment(0, 0, 0, 0, 0, 0);
            vAdjustment.Changed += HandleAdjustmentChanged;

            vScrollBar = new VScrollbar(vAdjustment);
            AddChild(vScrollBar);
            vScrollBar.Hide();

            hAdjustment          = new Adjustment(0, 0, 0, 0, 0, 0);
            hAdjustment.Changed += HandleAdjustmentChanged;

            leftHScrollBar = new HScrollbar(hAdjustment);
            AddChild(leftHScrollBar);

            rightHScrollBar = new HScrollbar(hAdjustment);
            AddChild(rightHScrollBar);

            originalComboBox      = new DropDownBox();
            originalComboBox.Text = "Local";
            AddChild(originalComboBox);

            originalEditor = new TextEditor();
            AddChild(originalEditor);
            originalEditor.SetScrollAdjustments(hAdjustment, vAdjustment);

            diffComboBox      = new DropDownBox();
            diffComboBox.Text = "Base";
            AddChild(diffComboBox);

            diffEditor = new TextEditor();

            AddChild(diffEditor);
            diffEditor.Document.ReadOnly = true;
            diffEditor.SetScrollAdjustments(hAdjustment, vAdjustment);
            this.vAdjustment.ValueChanged += delegate {
                middleArea.QueueDraw();
            };

            overview = new OverviewRenderer(this);
            AddChild(overview);

            middleArea = new MiddleArea(this);
            AddChild(middleArea);

            prev = new Button();
            prev.Add(new Arrow(ArrowType.Up, ShadowType.None));
            AddChild(prev);
            prev.ShowAll();
            prev.Clicked += delegate {
                if (this.Diff == null)
                {
                    return;
                }
                originalEditor.GrabFocus();

                int line = originalEditor.Caret.Line;
                int max = -1, searched = -1;
                foreach (Diff.Hunk hunk in this.Diff)
                {
                    if (hunk.Same)
                    {
                        continue;
                    }
                    max = System.Math.Max(hunk.Left.Start, max);
                    if (hunk.Left.Start < line)
                    {
                        searched = System.Math.Max(hunk.Left.Start, searched);
                    }
                }
                if (max >= 0)
                {
                    originalEditor.Caret.Line = searched < 0 ? max : searched;
                    originalEditor.CenterToCaret();
                }
            };

            next             = new Button();
            next.BorderWidth = 0;
            next.Add(new Arrow(ArrowType.Down, ShadowType.None));
            next.Clicked += delegate {
                if (this.Diff == null)
                {
                    return;
                }
                originalEditor.GrabFocus();

                int line = originalEditor.Caret.Line;
                int min = Int32.MaxValue, searched = Int32.MaxValue;
                foreach (Diff.Hunk hunk in this.Diff)
                {
                    if (hunk.Same)
                    {
                        continue;
                    }
                    min = System.Math.Min(hunk.Left.Start, min);
                    if (hunk.Left.Start > line)
                    {
                        searched = System.Math.Min(hunk.Left.Start, searched);
                    }
                }
                if (min < Int32.MaxValue)
                {
                    originalEditor.Caret.Line = searched == Int32.MaxValue ? min : searched;
                    originalEditor.CenterToCaret();
                }
            };
            AddChild(next);
            next.ShowAll();

            this.DoubleBuffered         = true;
            originalEditor.ExposeEvent += HandleLeftEditorExposeEvent;
            diffEditor.ExposeEvent     += HandleRightEditorExposeEvent;
        }
		protected void Intialize ()
		{
			CreateComponents ();

			vAdjustment = new Adjustment (0, 0, 0, 0, 0, 0);
			attachedVAdjustments = new Adjustment[editors.Length];
			attachedHAdjustments = new Adjustment[editors.Length];
			for (int i = 0; i < editors.Length; i++) {
				attachedVAdjustments[i] = new Adjustment (0, 0, 0, 0, 0, 0);
				attachedHAdjustments[i] = new Adjustment (0, 0, 0, 0, 0, 0);
			}

			foreach (var attachedAdjustment in attachedVAdjustments) {
				Connect (attachedAdjustment, vAdjustment);
			}

			hAdjustment = new Adjustment (0, 0, 0, 0, 0, 0);
			foreach (var attachedAdjustment in attachedHAdjustments) {
				Connect (attachedAdjustment, hAdjustment);
			}

			hScrollBars = new Gtk.HScrollbar[attachedHAdjustments.Length];
			for (int i = 0; i < hScrollBars.Length; i++) {
				hScrollBars[i] = new HScrollbar (hAdjustment);
				Add (hScrollBars[i]);
			}

			for (int i = 0; i < editors.Length; i++) {
				var editor = editors[i];
				Add (editor);
				editor.ButtonPressEvent += OnPopupMenu;
				editor.Caret.PositionChanged += CaretPositionChanged;
				editor.FocusInEvent += EditorFocusIn;
				editor.SetScrollAdjustments (attachedHAdjustments[i], attachedVAdjustments[i]);
			}

			if (editors.Length == 2) {
				editors[0].Painted +=  delegate (object sender, PaintEventArgs args) {
					var myEditor = (TextEditor)sender;
					PaintEditorOverlay (myEditor, args, LeftDiff, true);
				};

				editors[1].Painted +=  delegate (object sender, PaintEventArgs args) {
					var myEditor = (TextEditor)sender;
					PaintEditorOverlay (myEditor, args, LeftDiff, false);
				};

				rightDiffScrollBar = new DiffScrollbar (this, editors[1], true, true);
				Add (rightDiffScrollBar);
			} else {
				editors[0].Painted +=  delegate (object sender, PaintEventArgs args) {
					var myEditor = (TextEditor)sender;
					PaintEditorOverlay (myEditor, args, LeftDiff, true);
				};
				editors[1].Painted +=  delegate (object sender, PaintEventArgs args) {
					var myEditor = (TextEditor)sender;
					PaintEditorOverlay (myEditor, args, LeftDiff, false);
					PaintEditorOverlay (myEditor, args, RightDiff, false);
				};
				editors[2].Painted +=  delegate (object sender, PaintEventArgs args) {
					var myEditor = (TextEditor)sender;
					PaintEditorOverlay (myEditor, args, RightDiff, true);
				};
				rightDiffScrollBar = new DiffScrollbar (this, editors[2], false, false);
				Add (rightDiffScrollBar);
			}
			
			leftDiffScrollBar = new DiffScrollbar (this, editors[0], true, false);
			Add (leftDiffScrollBar);
			if (headerWidgets != null) {
				foreach (var widget in headerWidgets) {
					Add (widget);
				}
			}

			middleAreas = new MiddleArea [editors.Length - 1];
			if (middleAreas.Length <= 0 || middleAreas.Length > 2)
				throw new NotSupportedException ();

			middleAreas[0] = new MiddleArea (this, editors[0], MainEditor, true);
			Add (middleAreas[0]);

			if (middleAreas.Length == 2) {
				middleAreas[1] = new MiddleArea (this, editors[2], MainEditor, false);
				Add (middleAreas[1]);
			}
			this.MainEditor.EditorOptionsChanged += HandleMainEditorhandleEditorOptionsChanged;
		}
示例#20
0
 public MainWindow()
     : base("MainWindow")
 {
     // create the table and pack into the window
     Table table = new Table(2, 3, false);
     Add(table);
     // Initialze DGraphics
     GTKHelper.InitGraphics();
     // create DViewerControl and attach to table
     GTKViewerControl dvc = new GTKViewerControl();
     table.Attach(dvc, 0, 1, 0, 1, AttachOptions.Fill | AttachOptions.Expand,
                  AttachOptions.Fill | AttachOptions.Expand, 0, 0);
     // create the scrollbars and pack into the table
     VScrollbar vsb = new VScrollbar(null);
     table.Attach(vsb, 1, 2, 0, 1, AttachOptions.Fill|AttachOptions.Shrink,
                  AttachOptions.Fill|AttachOptions.Shrink, 0, 0);
     HScrollbar hsb = new HScrollbar(null);
     table.Attach(hsb, 0, 1, 1, 2, AttachOptions.Fill|AttachOptions.Shrink,
                  AttachOptions.Fill|AttachOptions.Shrink, 0, 0);
     // tell the scrollbars to use the DViewerControl widget's adjustments
     vsb.Adjustment = dvc.Vadjustment;
     hsb.Adjustment = dvc.Hadjustment;
     // create debuging label
     l = new Label("debug");
     table.Attach(l, 0, 1, 2, 3, AttachOptions.Fill|AttachOptions.Shrink,
                  AttachOptions.Fill|AttachOptions.Shrink, 0, 0);
     // create DViewer and DEngine
     dv = new GTKViewer(dvc);
     dv.EditFigures = true;
     #if DEBUG
     dv.DebugMessage += new DebugMessageHandler(DebugMessage);
     #endif
     de = new DEngine(null);
     de.AddViewer(dv);
     de.HsmState = DHsmState.Select;
     #if DEBUG
     de.DebugMessage += new DebugMessageHandler(DebugMessage);
     #endif
     de.ContextClick += new ClickHandler(de_ContextClick);
     // add figures
     de.UndoRedo.Start("add initial figures");
     de.AddFigure(new EllipseFigure(new DRect(20, 30, 100, 100), 0));
     RectFigure rf = new RectFigure(new DRect(10, 20, 100, 100), 0);
     rf.Alpha = 0.7;
     rf.Fill = new DColor(80, 80, 80);
     de.AddFigure(rf);
     TextFigure tf = new TextFigure(new DPoint(150, 30), "hello", 0);
     tf.FontName = "Arial";
     tf.Underline = true;
     tf.Strikethrough = true;
     tf.Italics = true;
     de.AddFigure(tf);
     // compositing figure
     Figure f = new CompositedExampleFigure();
     f.Rect = new DRect(20, 150, 50, 50);
     de.AddFigure(f);
     // clock (IEditable) figure
     f = new ClockFigure();
     f.Rect = new DRect(200, 200, 100, 100);
     de.AddFigure(f);
     // triangle figure
     f = new TriangleFigure();
     f.Rect = new DRect(200, 100, 100, 100);
     ((TriangleFigure)f).StrokeWidth = 10;
     de.AddFigure(f);
     // line figure
     f = new LineFigure2(new DPoint(100, 100), new DPoint(200, 200));
     ((LineFigure2)f).StrokeStyle = DStrokeStyle.DashDot;
     ((LineFigure2)f).StrokeWidth = 5;
     de.AddFigure(f);
     de.UndoRedo.Commit();
     de.UndoRedo.ClearHistory();
     // resize window
     Resize(400, 300);
 }
示例#21
0
		public BlameWidget (VersionControlDocumentInfo info)
		{
			GtkWorkarounds.FixContainerLeak (this);
			
			this.info = info;
			var sourceEditor = info.Document.GetContent<MonoDevelop.SourceEditor.SourceEditorView> ();
			
			vAdjustment = new Adjustment (0, 0, 0, 0, 0, 0);
			vAdjustment.Changed += HandleAdjustmentChanged;
			
			vScrollBar = new VScrollbar (vAdjustment);
			AddChild (vScrollBar);
			
			hAdjustment = new Adjustment (0, 0, 0, 0, 0, 0);
			hAdjustment.Changed += HandleAdjustmentChanged;

			hScrollBar = new HScrollbar (hAdjustment);
			AddChild (hScrollBar);
			
			editor = new TextEditor (sourceEditor.TextEditor.Document, sourceEditor.TextEditor.Options);
			AddChild (editor);
			editor.SetScrollAdjustments (hAdjustment, vAdjustment);
			
			overview = new BlameRenderer (this);
			AddChild (overview);
			
			this.DoubleBuffered = true;
			editor.Painted += HandleEditorExposeEvent;
			editor.EditorOptionsChanged += delegate {
				overview.OptionsChanged ();
			};
			editor.Caret.PositionChanged += ComparisonWidget.CaretPositionChanged;
			editor.FocusInEvent += ComparisonWidget.EditorFocusIn;
			editor.Document.Folded += delegate {
				QueueDraw ();
			};
			editor.Document.FoldTreeUpdated += delegate {
				QueueDraw ();
			};
			editor.DoPopupMenu = ShowPopup;
			Show ();
		}
示例#22
0
		public static Gtk.Window Create ()
		{
			window = new Window ("GtkRange");
			window.SetDefaultSize (250, 200);

			VBox box1 = new VBox (false, 0);
			window.Add (box1);

			VBox box2 = new VBox (false, 0);
			box2.BorderWidth = 10;
			box1.PackStart (box2, true, true, 0);

			Adjustment adjustment = new Adjustment (0.0, 0.0, 101.0, 0.1, 1.0, 1.0);

			HScale hscale = new HScale (adjustment);
			hscale.SetSizeRequest (150, -1);

			hscale.Digits = 1;
			hscale.DrawValue = true;
			box2.PackStart (hscale, true, true, 0);

			HScrollbar hscrollbar = new HScrollbar (adjustment);
			box2.PackStart (hscrollbar, true, true, 0);

			hscale = new HScale (adjustment);
			hscale.DrawValue = true;
			hscale.FormatValue += new FormatValueHandler (reformat_value);

			box2.PackStart (hscale, true, true, 0);

			HBox hbox = new HBox (false, 0);
			VScale vscale = new VScale (adjustment);
			vscale.SetSizeRequest (-1, 200);
			vscale.Digits = 2;
			vscale.DrawValue = true;
			hbox.PackStart (vscale, true, true, 0);
			
			vscale = new VScale (adjustment);
			vscale.SetSizeRequest (-1, 200);
			vscale.Digits = 2;
			vscale.DrawValue = true;
			((Range) vscale).Inverted = true;
			hbox.PackStart (vscale, true, true, 0);

			vscale = new VScale (adjustment);
			vscale.DrawValue = true;
			vscale.FormatValue += new FormatValueHandler (reformat_value);
			hbox.PackStart (vscale, true, true, 0);

			box2.PackStart (hbox, true, true, 0);

			box1.PackStart (new HSeparator (), false, true, 0);

			box2 = new VBox (false, 10);
			box2.BorderWidth = 10;
			box1.PackStart (box2, false, true, 0);

			Button button = new Button (Stock.Close);
			button.Clicked += new EventHandler (Close_Button);
			box2.PackStart (button, true, true, 0);
			button.CanDefault = true;
			button.GrabDefault ();
			
			window.ShowAll ();
			return window;
		}
示例#23
0
		protected override void OnDestroyed ()
		{
			if (Child != null)
				Child.Destroy ();
			if (vAdjustment != null) {
				vAdjustment.Changed -= HandleAdjustmentChanged;
				vAdjustment.Destroy ();
				vAdjustment = null;
			}
			if (hAdjustment != null) {
				hAdjustment.Changed -= HandleAdjustmentChanged;
				hAdjustment.Destroy ();
				hAdjustment = null;
			}
			if (vScrollBar != null) {
				vScrollBar.Destroy ();
				vScrollBar = null;
			}
			if (hScrollBar != null) {
				hScrollBar.Destroy ();
				hScrollBar = null;
			}
			foreach (var c in children) {
				c.Child.Destroy ();
			}
			base.OnDestroyed ();
		}