Example #1
0
        public Pango.TabArray Copy()
        {
            IntPtr raw_ret = pango_tab_array_copy(Handle);

            Pango.TabArray ret = raw_ret == IntPtr.Zero ? null : (Pango.TabArray)GLib.Opaque.GetOpaque(raw_ret, typeof(Pango.TabArray), true);
            return(ret);
        }
        public AddLogEntryDialog(Dictionary <string, ChangeLogEntry> entries)
        {
            Build();

            Pango.FontDescription font = Pango.FontDescription.FromString(DesktopService.DefaultMonospaceFont);
            textview.ModifyFont(font);
            textview.WrapMode   = WrapMode.None;
            textview.AcceptsTab = true;
            Pango.TabArray tabs = new Pango.TabArray(1, true);
            tabs.SetTab(0, Pango.TabAlign.Left, GetStringWidth(" ") * 4);
            textview.Tabs           = tabs;
            textview.SizeRequested += delegate(object o, SizeRequestedArgs args)
            {
                textview.WidthRequest = GetStringWidth(string.Empty.PadRight(80));
            };
            font.Dispose();

            store          = new ListStore(typeof(ChangeLogEntry), typeof(Gdk.Pixbuf), typeof(string));
            fileList.Model = store;

            fileList.AppendColumn(string.Empty, new CellRendererPixbuf(), "pixbuf", 1);
            fileList.AppendColumn(string.Empty, new CellRendererText(), "text", 2);

            foreach (ChangeLogEntry ce in entries.Values)
            {
                Gdk.Pixbuf pic;
                if (ce.CantGenerate)
                {
                    pic = ImageService.GetPixbuf(Gtk.Stock.DialogWarning, Gtk.IconSize.Menu);
                }
                else if (ce.IsNew)
                {
                    pic = ImageService.GetPixbuf(Gtk.Stock.New, Gtk.IconSize.Menu);
                }
                else
                {
                    pic = null;
                }
                store.AppendValues(ce, pic, ce.File);
            }
            fileList.Selection.Changed += OnSelectionChanged;
            textview.Buffer.Changed    += OnTextChanged;
            TreeIter it;

            editMark              = textview.Buffer.CreateMark(null, textview.Buffer.EndIter, false);
            oldTextTag            = new Gtk.TextTag("readonly");
            oldTextTag.Foreground = "gray";
            oldTextTag.Editable   = false;
            textview.Buffer.TagTable.Add(oldTextTag);

            if (store.GetIterFirst(out it))
            {
                fileList.Selection.SelectIter(it);
            }
        }
Example #3
0
        public AddLogEntryDialog(Dictionary <string, ChangeLogEntry> entries)
        {
            Build();

            textview.ModifyFont(FontService.MonospaceFont);
            textview.WrapMode   = WrapMode.None;
            textview.AcceptsTab = true;
            Pango.TabArray tabs = new Pango.TabArray(1, true);
            tabs.SetTab(0, Pango.TabAlign.Left, GetStringWidth(" ") * 4);
            textview.Tabs           = tabs;
            textview.SizeRequested += delegate {
                textview.WidthRequest = GetStringWidth(String.Empty.PadRight(80));
            };

            store          = new ListStore(typeof(ChangeLogEntry), typeof(Xwt.Drawing.Image), typeof(string));
            fileList.Model = store;

            fileList.AppendColumn(string.Empty, new CellRendererImage(), "image", 1);
            fileList.AppendColumn(string.Empty, new CellRendererText(), "text", 2);

            foreach (ChangeLogEntry ce in entries.Values)
            {
                Xwt.Drawing.Image pic;
                if (ce.CantGenerate)
                {
                    pic = ImageService.GetIcon(Ide.Gui.Stock.Warning, IconSize.Menu);
                }
                else if (ce.IsNew)
                {
                    pic = ImageService.GetIcon(Stock.New, IconSize.Menu);
                }
                else
                {
                    pic = null;
                }
                store.AppendValues(ce, pic, ce.File);
            }
            fileList.Selection.Changed += OnSelectionChanged;
            textview.Buffer.Changed    += OnTextChanged;
            TreeIter it;

            editMark              = textview.Buffer.CreateMark(null, textview.Buffer.EndIter, false);
            oldTextTag            = new TextTag("readonly");
            oldTextTag.Foreground = "gray";
            oldTextTag.Editable   = false;
            textview.Buffer.TagTable.Add(oldTextTag);

            if (store.GetIterFirst(out it))
            {
                fileList.Selection.SelectIter(it);
            }
        }
		public AddLogEntryDialog (Dictionary<string,ChangeLogEntry> entries)
		{
			Build ();
			
			Pango.FontDescription font = Pango.FontDescription.FromString (DesktopService.DefaultMonospaceFont);
			textview.ModifyFont (font);
			textview.WrapMode = WrapMode.None;
			textview.AcceptsTab = true;
			Pango.TabArray tabs = new Pango.TabArray (1, true);
			tabs.SetTab (0, Pango.TabAlign.Left, GetStringWidth (" ") * 4);
			textview.Tabs = tabs;
			textview.SizeRequested += delegate (object o, SizeRequestedArgs args) {
				textview.WidthRequest = GetStringWidth (string.Empty.PadRight (80));
			};
			font.Dispose ();
			
			store = new ListStore (typeof(ChangeLogEntry), typeof(Gdk.Pixbuf), typeof(string));
			fileList.Model = store;
			
			fileList.AppendColumn (string.Empty, new CellRendererPixbuf (), "pixbuf", 1);
			fileList.AppendColumn (string.Empty, new CellRendererText (), "text", 2);
			
			foreach (ChangeLogEntry ce in entries.Values) {
				Gdk.Pixbuf pic;
				if (ce.CantGenerate)
					pic = ImageService.GetPixbuf (Gtk.Stock.DialogWarning, Gtk.IconSize.Menu);
				else if (ce.IsNew)
					pic = ImageService.GetPixbuf (Gtk.Stock.New, Gtk.IconSize.Menu);
				else
					pic = null;
				store.AppendValues (ce, pic, ce.File);
			}
			fileList.Selection.Changed += OnSelectionChanged;
			textview.Buffer.Changed += OnTextChanged;
			TreeIter it;
			
			editMark = textview.Buffer.CreateMark (null, textview.Buffer.EndIter, false);
			oldTextTag = new Gtk.TextTag ("readonly");
			oldTextTag.Foreground = "gray";
			oldTextTag.Editable = false;
			textview.Buffer.TagTable.Add (oldTextTag);
			
			if (store.GetIterFirst (out it))
				fileList.Selection.SelectIter (it);
		}
		public AddLogEntryDialog (Dictionary<string,ChangeLogEntry> entries)
		{
			Build ();
			
			textview.ModifyFont (FontService.MonospaceFont);
			textview.WrapMode = WrapMode.None;
			textview.AcceptsTab = true;
			Pango.TabArray tabs = new Pango.TabArray (1, true);
			tabs.SetTab (0, Pango.TabAlign.Left, GetStringWidth (" ") * 4);
			textview.Tabs = tabs;
			textview.SizeRequested += delegate {
				textview.WidthRequest = GetStringWidth (String.Empty.PadRight (80));
			};
			
			store = new ListStore (typeof(ChangeLogEntry), typeof(Xwt.Drawing.Image), typeof(string));
			fileList.Model = store;
			
			fileList.AppendColumn (string.Empty, new CellRendererImage (), "image", 1);
			fileList.AppendColumn (string.Empty, new CellRendererText (), "text", 2);
			
			foreach (ChangeLogEntry ce in entries.Values) {
				Xwt.Drawing.Image pic;
				if (ce.CantGenerate)
					pic = ImageService.GetIcon (Ide.Gui.Stock.Warning, IconSize.Menu);
				else if (ce.IsNew)
					pic = ImageService.GetIcon (Stock.New, IconSize.Menu);
				else
					pic = null;
				store.AppendValues (ce, pic, ce.File);
			}
			fileList.Selection.Changed += OnSelectionChanged;
			textview.Buffer.Changed += OnTextChanged;
			TreeIter it;
			
			editMark = textview.Buffer.CreateMark (null, textview.Buffer.EndIter, false);
			oldTextTag = new TextTag ("readonly");
			oldTextTag.Foreground = "gray";
			oldTextTag.Editable = false;
			textview.Buffer.TagTable.Add (oldTextTag);
			
			if (store.GetIterFirst (out it))
				fileList.Selection.SelectIter (it);
		}
		internal protected override void OptionsChanged ()
		{
			Pango.Layout layout = new Pango.Layout (Editor.PangoContext);
			layout.FontDescription = Editor.Options.Font;
			string groupString = new string ('0', Editor.Options.GroupBytes * 2);
			layout.SetText (groupString + " ");
			int lineHeight;
			layout.GetPixelSize (out groupWidth, out lineHeight);
			Data.LineHeight = lineHeight;
			
			layout.SetText ("00");
			layout.GetPixelSize (out byteWidth, out lineHeight);
			
			layout.Dispose ();
			
			tabArray = new Pango.TabArray (1, true);
			tabArray.SetTab (0, Pango.TabAlign.Left, groupWidth);
			
			bgGC = GetGC (Style.HexDigitBg);
			fgGC = GetGC (Style.HexDigit);
		}
        internal protected override void OptionsChanged()
        {
            Pango.Layout layout = new Pango.Layout(Editor.PangoContext);
            layout.FontDescription = Editor.Options.Font;
            string groupString = new string ('0', Editor.Options.GroupBytes * 2);

            layout.SetText(groupString + " ");
            int lineHeight;

            layout.GetPixelSize(out groupWidth, out lineHeight);
            Data.LineHeight = lineHeight;

            layout.SetText("00");
            layout.GetPixelSize(out byteWidth, out lineHeight);

            layout.Dispose();

            tabArray = new Pango.TabArray(1, true);
            tabArray.SetTab(0, Pango.TabAlign.Left, groupWidth);

            bgGC = GetGC(Style.HexDigitBg);
            fgGC = GetGC(Style.HexDigit);
        }
		protected internal override void OptionsChanged ()
		{
			DisposeGCs ();

			var markerFont = textEditor.Options.Font.Copy ();
			markerFont.Size = markerFont.Size * 8 / 10;
			markerLayout.FontDescription = markerFont;
			markerLayout.FontDescription.Weight = Pango.Weight.Normal;
			markerLayout.FontDescription.Style = Pango.Style.Normal;

			defaultLayout.FontDescription = textEditor.Options.Font;
			using (var metrics = textEditor.PangoContext.GetMetrics (textEditor.Options.Font, textEditor.PangoContext.Language)) {
				this.textEditor.GetTextEditorData ().LineHeight = System.Math.Ceiling (0.5 + (metrics.Ascent + metrics.Descent) / Pango.Scale.PangoScale);
				this.charWidth = metrics.ApproximateCharWidth / Pango.Scale.PangoScale;
			}

			// Gutter font may be bigger
			using (var metrics = textEditor.PangoContext.GetMetrics (textEditor.Options.GutterFont, textEditor.PangoContext.Language)) {
				this.textEditor.GetTextEditorData ().LineHeight = System.Math.Max (this.textEditor.GetTextEditorData ().LineHeight, System.Math.Ceiling (0.5 + (metrics.Ascent + metrics.Descent) / Pango.Scale.PangoScale));
			}

			textEditor.LineHeight = System.Math.Max (1, LineHeight);

			if (eolMarkerLayout == null) {
				eolMarkerLayout = new Pango.Layout[8];
				eolMarkerLayoutRect = new Pango.Rectangle[8];
				for (int i = 0; i < eolMarkerLayout.Length; i++)
					eolMarkerLayout[i] = PangoUtil.CreateLayout (textEditor);
				eofEolLayout = PangoUtil.CreateLayout (textEditor);
			}

			var font = textEditor.Options.Font.Copy ();
			font.Size = font.Size * 3 / 4;

			Pango.Rectangle logRect;
			for (int i = 0; i < eolMarkerLayout.Length; i++) {
				var layout = eolMarkerLayout [i];
				layout.FontDescription = font;

				layout.SetText (markerTexts [i]);
				
				Pango.Rectangle tRect;
				layout.GetPixelExtents (out logRect, out tRect);
				eolMarkerLayoutRect [i] = tRect;
			}


			eofEolLayout.FontDescription = font;
			eofEolLayout.SetText ("<EOF>");
			eofEolLayout.GetPixelExtents (out logRect, out eofEolLayoutRect);

			DecorateLineBg -= DecorateMatchingBracket;
			if (textEditor.Options.HighlightMatchingBracket && !Document.ReadOnly)
				DecorateLineBg += DecorateMatchingBracket;

			if (tabArray != null) {
				tabArray.Dispose ();
				tabArray = null;
			}

			var tabWidthLayout = PangoUtil.CreateLayout (textEditor, (new string (' ', textEditor.Options.TabSize)));
			tabWidthLayout.Alignment = Pango.Alignment.Left;
			tabWidthLayout.FontDescription = textEditor.Options.Font;
			int tabWidth, h;
			tabWidthLayout.GetSize (out tabWidth, out h);
			tabWidthLayout.Dispose ();
			tabArray = new Pango.TabArray (1, false);
			tabArray.SetTab (0, Pango.TabAlign.Left, tabWidth);

			textEditor.UpdatePreeditLineHeight ();

			DisposeLayoutDict ();
			chunkDict.Clear ();
			caretX = caretY = -LineHeight;
		}
Example #9
0
		protected internal override void OptionsChanged ()
		{
			DisposeGCs ();

			var markerFont = textEditor.Options.Font.Copy ();
			markerFont.Size = markerFont.Size * 8 / 10;
			markerLayout.FontDescription = markerFont;
			markerLayout.FontDescription.Weight = Pango.Weight.Normal;
			markerLayout.FontDescription.Style = Pango.Style.Normal;

			if (textEditor.preeditString != null && textEditor.preeditAttrs != null) {
				using (var preeditLayout = PangoUtil.CreateLayout (textEditor)) {
					preeditLayout.SetText (textEditor.preeditString);
					preeditLayout.Attributes = textEditor.preeditAttrs;
				}
			}

			defaultLayout.FontDescription = textEditor.Options.Font;
			using (var metrics = textEditor.PangoContext.GetMetrics (textEditor.Options.Font, textEditor.PangoContext.Language)) {
				this.textEditor.GetTextEditorData ().LineHeight = System.Math.Ceiling (0.5 + (metrics.Ascent + metrics.Descent) / Pango.Scale.PangoScale);
				this.charWidth = metrics.ApproximateCharWidth / Pango.Scale.PangoScale;
			}

			// Gutter font may be bigger
			using (var metrics = textEditor.PangoContext.GetMetrics (textEditor.Options.GutterFont, textEditor.PangoContext.Language)) {
				this.textEditor.GetTextEditorData ().LineHeight = System.Math.Max (this.textEditor.GetTextEditorData ().LineHeight, System.Math.Ceiling (0.5 + (metrics.Ascent + metrics.Descent) / Pango.Scale.PangoScale));
			}

			textEditor.LineHeight = System.Math.Max (1, LineHeight);

			if (unixEolLayout == null) {
				unixEolLayout = PangoUtil.CreateLayout (textEditor);
				macEolLayout = PangoUtil.CreateLayout (textEditor);
				windowsEolLayout = PangoUtil.CreateLayout (textEditor);
				eofEolLayout = PangoUtil.CreateLayout (textEditor);
			}

			var font = textEditor.Options.Font.Copy ();
			font.Size = font.Size * 3 / 4;
			unixEolLayout.FontDescription = macEolLayout.FontDescription = windowsEolLayout.FontDescription = eofEolLayout.FontDescription = font;

			unixEolLayout.SetText ("\\n");
			Pango.Rectangle logRect;
			unixEolLayout.GetPixelExtents (out logRect, out unixEolLayoutRect);

			macEolLayout.SetText ("\\r");
			macEolLayout.GetPixelExtents (out logRect, out macEolLayoutRect);

			windowsEolLayout.SetText ("\\r\\n");
			windowsEolLayout.GetPixelExtents (out logRect, out windowsEolLayoutRect);

			eofEolLayout.SetText ("<EOF>");
			eofEolLayout.GetPixelExtents (out logRect, out eofEolLayoutRect);

			DecorateLineBg -= DecorateMatchingBracket;
			if (textEditor.Options.HighlightMatchingBracket && !Document.ReadOnly)
				DecorateLineBg += DecorateMatchingBracket;

			if (tabArray != null) {
				tabArray.Dispose ();
				tabArray = null;
			}

			var tabWidthLayout = PangoUtil.CreateLayout (textEditor, (new string (' ', textEditor.Options.TabSize)));
			tabWidthLayout.Alignment = Pango.Alignment.Left;
			tabWidthLayout.FontDescription = textEditor.Options.Font;
			int tabWidth, h;
			tabWidthLayout.GetSize (out tabWidth, out h);
			tabWidthLayout.Dispose ();
			tabArray = new Pango.TabArray (1, false);
			tabArray.SetTab (0, Pango.TabAlign.Left, tabWidth);

			DisposeLayoutDict ();
			chunkDict.Clear ();
			caretX = caretY = -LineHeight;
		}
Example #10
0
		protected internal override void OptionsChanged ()
		{
			DisposeGCs ();

			markerLayout.FontDescription = textEditor.Options.Font;
			markerLayout.FontDescription.Weight = Pango.Weight.Normal;
			markerLayout.FontDescription.Style = Pango.Style.Italic;
			markerLayout.SetText ("_");
			int w, h;
			markerLayout.GetSize (out w, out h);
			
			this.charWidth = w / Pango.Scale.PangoScale;
			if (textEditor.preeditString != null && textEditor.preeditAttrs != null) {
				using (var preeditLayout = PangoUtil.CreateLayout (textEditor)) {
					preeditLayout.SetText (textEditor.preeditString);
					preeditLayout.Attributes = textEditor.preeditAttrs;
					preeditLayout.GetSize (out w, out h);
				}
			}
			this.textEditor.GetTextEditorData ().LineHeight = System.Math.Ceiling (h / Pango.Scale.PangoScale);
			
			markerLayout.FontDescription.Weight = Pango.Weight.Normal;

			Pango.Font font = textEditor.PangoContext.LoadFont (markerLayout.FontDescription);
			if (font != null) {
				Pango.FontMetrics metrics = font.GetMetrics (null);
				this.charWidth = metrics.ApproximateCharWidth / Pango.Scale.PangoScale;

				font.Dispose ();
			}

			textEditor.LineHeight = System.Math.Max (1, LineHeight);

			if (textEditor.Options.ShowInvalidLines && invalidLineLayout == null) {
				invalidLineLayout = PangoUtil.CreateLayout (textEditor);
				invalidLineLayout.SetText ("~");
			}
			
			if (invalidLineLayout != null)
				invalidLineLayout.FontDescription = textEditor.Options.Font;
			
			if (textEditor.Options.ShowEolMarkers && unixEolLayout == null) {
				unixEolLayout = PangoUtil.CreateLayout (textEditor);
				unixEolLayout.SetText ("\\n");
				macEolLayout = PangoUtil.CreateLayout (textEditor);
				macEolLayout.SetText ("\\r");
				windowEolLayout = PangoUtil.CreateLayout (textEditor);
				windowEolLayout.SetText ("\\r\\n");
				eofEolLayout = PangoUtil.CreateLayout (textEditor);
				eofEolLayout.SetText ("<EOF>");
			}
			
			if (unixEolLayout != null)
				unixEolLayout.FontDescription = macEolLayout.FontDescription = windowEolLayout.FontDescription = eofEolLayout.FontDescription = textEditor.Options.Font;
			
			if (textEditor.Options.ShowTabs && tabMarkerLayout == null) {
				tabMarkerLayout = PangoUtil.CreateLayout (textEditor);
				tabMarkerLayout.SetText ("»");
			}
			if (tabMarkerLayout != null)
				tabMarkerLayout.FontDescription = textEditor.Options.Font;

			if (textEditor.Options.ShowSpaces && spaceMarkerLayout == null) {
				spaceMarkerLayout = PangoUtil.CreateLayout (textEditor);
				spaceMarkerLayout.SetText ("·");
			}
			if (spaceMarkerLayout != null)
				spaceMarkerLayout.FontDescription = textEditor.Options.Font;
			
			DecorateLineFg -= DecorateTabs;
			DecorateLineFg -= DecorateSpaces;
			DecorateLineFg -= DecorateTabsAndSpaces;
			
			if (textEditor.Options.ShowTabs && textEditor.Options.ShowSpaces) {
				DecorateLineFg += DecorateTabsAndSpaces;
			} else if (textEditor.Options.ShowTabs) {
				DecorateLineFg += DecorateTabs;
			} else if (textEditor.Options.ShowSpaces) {
				DecorateLineFg += DecorateSpaces;
			} 
			
			DecorateLineBg -= DecorateMatchingBracket;
			if (textEditor.Options.HighlightMatchingBracket && !Document.ReadOnly)
				DecorateLineBg += DecorateMatchingBracket;

			if (tabArray != null) {
				tabArray.Dispose ();
				tabArray = null;
			}

			var tabWidthLayout = PangoUtil.CreateLayout (textEditor, (new string (' ', textEditor.Options.TabSize)));
			tabWidthLayout.Alignment = Pango.Alignment.Left;
			tabWidthLayout.FontDescription = textEditor.Options.Font;
			int tabWidth;
			tabWidthLayout.GetSize (out tabWidth, out h);
			tabWidthLayout.Dispose ();
			tabArray = new Pango.TabArray (1, false);
			tabArray.SetTab (0, Pango.TabAlign.Left, tabWidth);

			DisposeLayoutDict ();
			chunkDict.Clear ();
		}
Example #11
0
		public override void Dispose ()
		{
			if (arrowCursor == null)
				return;
			CancelCodeSegmentTooltip ();
			DisposeHighightBackgroundWorker ();
			DisposeSearchPatternWorker ();
			lock (lockObject) {
				if (caretTimer != null) {
					StopCaretThread ();
					caretTimer.Elapsed -= UpdateCaret; 
					caretTimer.Dispose ();
					caretTimer = null;
				}
			}
			
			textEditor.Document.EndUndo -= UpdateBracketHighlighting;
			Caret.PositionChanged -= UpdateBracketHighlighting;

			textEditor.GetTextEditorData ().SearchChanged -= HandleSearchChanged;
			
			arrowCursor.Dispose ();
			xtermCursor.Dispose ();
			arrowCursor = xtermCursor = null;
			
			DisposeGCs ();
			if (caretGc != null) {
				caretGc.Dispose ();
				caretGc = null;
			}
			
			if (markerLayout != null) {
				markerLayout.Dispose ();
				markerLayout = null;
			}
			
			DisposeLayoutDict ();
			if (tabArray != null) {
				tabArray.Dispose ();
				tabArray = null;
			}
			
			layoutDict = null;
			base.Dispose ();
		}
Example #12
0
		protected internal override void OptionsChanged ()
		{
			DisposeGCs ();
			
			markerLayout.FontDescription = textEditor.Options.Font;
			markerLayout.FontDescription.Weight = Pango.Weight.Bold;
			markerLayout.SetText (" ");
			markerLayout.GetPixelSize (out this.charWidth, out this.lineHeight);
			markerLayout.FontDescription.Weight = Pango.Weight.Normal;
			
			Pango.Font font = textEditor.PangoContext.LoadFont (markerLayout.FontDescription);
			if (font != null) {
				Pango.FontMetrics metrics = font.GetMetrics (null);
				this.charWidth = (int)(metrics.ApproximateCharWidth / Pango.Scale.PangoScale);
				
				font.Dispose ();
			}
			
			CaretMoveActions.LineHeight = lineHeight = System.Math.Max (1, lineHeight);

			DecorateLineFg -= DecorateTabs;
			if (textEditor.Options.ShowTabs)
				DecorateLineFg += DecorateTabs;

			DecorateLineFg -= DecorateSpaces;
			if (textEditor.Options.ShowSpaces)
				DecorateLineFg += DecorateSpaces;

			DecorateLineBg -= DecorateMatchingBracket;
			if (textEditor.Options.HighlightMatchingBracket && !Document.ReadOnly)
				DecorateLineBg += DecorateMatchingBracket;
			
			if (tabArray != null) {
				tabArray.Dispose ();
				tabArray = null;
			}
			
			EnsureCaretGc ();
			
			var tabWidthLayout = PangoUtil.CreateLayout (textEditor, (new string (' ', textEditor.Options.TabSize)));
			tabWidthLayout.Alignment = Pango.Alignment.Left;
			tabWidthLayout.FontDescription = textEditor.Options.Font;
			int tabWidth, h;
			tabWidthLayout.GetSize (out tabWidth, out h);
			tabWidthLayout.Dispose ();
			tabArray = new Pango.TabArray (1, false);
			tabArray.SetTab (0, Pango.TabAlign.Left, tabWidth);
			
			DisposeLayoutDict ();
			chunkDict.Clear ();
		}