Exemple #1
0
        public MessageTextView()
        {
            Trace.Call();

            _MessageTextTagTable = BuildTagTable();
            _ThemeSettings = new ThemeSettings();

            Buffer = new Gtk.TextBuffer(_MessageTextTagTable);
            MotionNotifyEvent += OnMotionNotifyEvent;
            PopulatePopup += OnPopulatePopup;
            ExposeEvent += OnExposeEvent;
        }
Exemple #2
0
        public MessageTextView()
        {
            Trace.Call();

            _MessageTextTagTable = BuildTagTable();
            _ThemeSettings       = new ThemeSettings();

            Buffer             = new Gtk.TextBuffer(_MessageTextTagTable);
            MotionNotifyEvent += OnMotionNotifyEvent;
            PopulatePopup     += OnPopulatePopup;
            ExposeEvent       += OnExposeEvent;
        }
Exemple #3
0
 public Buffer(Gtk.TextTagTable table) : base(IntPtr.Zero)
 {
     if (GetType() != typeof(Buffer))
     {
         var vals  = new List <GLib.Value> ();
         var names = new List <string> ();
         CreateNativeObject(names.ToArray(), vals.ToArray());
         return;
     }
     owned = true;
     Raw   = gtk_source_buffer_new(table == null ? IntPtr.Zero : table.Handle);
 }
        void InitTagTable()
        {
            table = new Gtk.TextTagTable();
            table.Add(new Gtk.TextTag("bold")
            {
                Weight = Pango.Weight.Bold
            });
            table.Add(new Gtk.TextTag("italic")
            {
                Style = Pango.Style.Italic
            });
            table.Add(new Gtk.TextTag("tt")
            {
                Family = "Monospace"
            });
            table.Add(new Gtk.TextTag("li")
            {
                LeftMargin = 14
            });
            table.Add(new Gtk.TextTag("h1")
            {
                Weight = Pango.Weight.Bold,
                Scale  = Pango.Scale.XXLarge
            });
            table.Add(new Gtk.TextTag("h2")
            {
                Weight = Pango.Weight.Bold,
                Scale  = Pango.Scale.XLarge
            });
            table.Add(new Gtk.TextTag("h3")
            {
                Weight = Pango.Weight.Bold,
                Scale  = Pango.Scale.Large
            });
            table.Add(new Gtk.TextTag("h4")
            {
                Scale = Pango.Scale.Large
            });
            table.Add(new Gtk.TextTag("pre")
            {
                Family   = "Monospace",
                Indent   = 14,
                WrapMode = Gtk.WrapMode.None
            });
            table.Add(new Gtk.TextTag("p")
            {
                SizePoints = Math.Max(LineSpacing, ParagraphSpacing),
            });

            table.Add(new Gtk.TextTag("textColor"));
        }
Exemple #5
0
        /*
         * Helper methods
         */
        private Gtk.TextTagTable BuildTagTable()
        {
            // TextTags
            Gtk.TextTagTable      ttt = new Gtk.TextTagTable();
            Gtk.TextTag           tt;
            Pango.FontDescription fd;

            // WARNING: the insertion order of tags MATTERS!
            // The attributes of the text tags are applied in the order of
            // insertion to the text table, and not in which order the tags
            // applied in the buffer. This is sick IMHO.
            tt          = new Gtk.TextTag("bold");
            fd          = new Pango.FontDescription();
            fd.Weight   = Pango.Weight.Bold;
            tt.FontDesc = fd;
            BoldTag     = tt;
            ttt.Add(tt);

            tt          = new Gtk.TextTag("italic");
            fd          = new Pango.FontDescription();
            fd.Style    = Pango.Style.Italic;
            tt.FontDesc = fd;
            ItalicTag   = tt;
            ttt.Add(tt);

            tt           = new Gtk.TextTag("underline");
            tt.Underline = Pango.Underline.Single;
            UnderlineTag = tt;
            ttt.Add(tt);

            tt            = new Gtk.TextTag("event");
            tt.Foreground = "darkgray";
            EventTag      = tt;
            ttt.Add(tt);

            tt            = new Gtk.TextTag("link");
            tt.Underline  = Pango.Underline.Single;
            tt.Foreground = "darkblue";
            LinkTag       = tt;
            ttt.Add(tt);

            tt        = new Gtk.TextTag("person");
            PersonTag = tt;
            ttt.Add(tt);

            return(ttt);
        }
Exemple #6
0
 void InitTagTable()
 {
     table = new Gtk.TextTagTable();
     table.Add(new Gtk.TextTag("bold")
     {
         Weight = Pango.Weight.Bold
     });
     table.Add(new Gtk.TextTag("italic")
     {
         Style = Pango.Style.Italic
     });
     table.Add(new Gtk.TextTag("tt")
     {
         Family = "Monospace"
     });
     table.Add(new Gtk.TextTag("li")
     {
         LeftMargin = 14
     });
     table.Add(new Gtk.TextTag("h1")
     {
         Weight = Pango.Weight.Bold,
         Scale  = Pango.Scale.XXLarge
     });
     table.Add(new Gtk.TextTag("h2")
     {
         Weight = Pango.Weight.Bold,
         Scale  = Pango.Scale.XLarge
     });
     table.Add(new Gtk.TextTag("h3")
     {
         Weight = Pango.Weight.Bold,
         Scale  = Pango.Scale.Large
     });
     table.Add(new Gtk.TextTag("h4")
     {
         Scale = Pango.Scale.Large
     });
     table.Add(new Gtk.TextTag("pre")
     {
         Family   = "Monospace",
         Indent   = 14,
         WrapMode = Gtk.WrapMode.None
     });
 }
Exemple #7
0
        public MessageTextView()
        {
            Trace.Call();

            _MessageTextTagTable = BuildTagTable();
            _ThemeSettings = new ThemeSettings();

            Buffer = new Gtk.TextBuffer(_MessageTextTagTable);
            MotionNotifyEvent += OnMotionNotifyEvent;
            PopulatePopup += OnPopulatePopup;
            ExposeEvent += OnExposeEvent;
            Realized += delegate {
                CheckStyle();
            };
            StyleSet += delegate(object o, Gtk.StyleSetArgs args) {
                if (!IsRealized) {
                    // HACK: avoid GTK+ crash in gtk_text_attributes_copy_values()
                    return;
                }
                CheckStyle();
            };
        }
Exemple #8
0
        public MessageTextView()
        {
            Trace.Call();

            _MessageTextTagTable = BuildTagTable();
            _ThemeSettings       = new ThemeSettings();

            Buffer             = new Gtk.TextBuffer(_MessageTextTagTable);
            MotionNotifyEvent += OnMotionNotifyEvent;
            PopulatePopup     += OnPopulatePopup;
            ExposeEvent       += OnExposeEvent;
            Realized          += delegate {
                CheckStyle();
            };
            StyleSet += delegate(object o, Gtk.StyleSetArgs args) {
                if (!IsRealized)
                {
                    // HACK: avoid GTK+ crash in gtk_text_attributes_copy_values()
                    return;
                }
                CheckStyle();
            };
        }
Exemple #9
0
        /*
         * Helper methods
         */
        private Gtk.TextTagTable BuildTagTable()
        {
            // TextTags
            Gtk.TextTagTable      ttt = new Gtk.TextTagTable();
            Gtk.TextTag           tt;
            Pango.FontDescription fd;

            tt          = new Gtk.TextTag("bold");
            fd          = new Pango.FontDescription();
            fd.Weight   = Pango.Weight.Bold;
            tt.FontDesc = fd;
            ttt.Add(tt);

            tt          = new Gtk.TextTag("italic");
            fd          = new Pango.FontDescription();
            fd.Style    = Pango.Style.Italic;
            tt.FontDesc = fd;
            ttt.Add(tt);

            tt           = new Gtk.TextTag("underline");
            tt.Underline = Pango.Underline.Single;
            ttt.Add(tt);

            tt            = new Gtk.TextTag("link");
            tt.Underline  = Pango.Underline.Single;
            tt.Foreground = "darkblue";
            fd            = new Pango.FontDescription();
            tt.FontDesc   = fd;
            ttt.Add(tt);

            tt            = new Gtk.TextTag("event");
            tt.Foreground = "darkgray";
            ttt.Add(tt);

            return(ttt);
        }
Exemple #10
0
		void InitTagTable ()
		{
			table = new Gtk.TextTagTable ();
			table.Add (new Gtk.TextTag ("bold") {
				Weight = Pango.Weight.Bold
			});
			table.Add (new Gtk.TextTag ("italic") {
				Style = Pango.Style.Italic
			});
			table.Add (new Gtk.TextTag ("tt") {
				Family = "Monospace"
			});
			table.Add (new Gtk.TextTag ("li") {
				LeftMargin = 14
			});
			table.Add (new Gtk.TextTag ("h1") {
				Weight = Pango.Weight.Bold,
				Scale = Pango.Scale.XXLarge
			});
			table.Add (new Gtk.TextTag ("h2") {
				Weight = Pango.Weight.Bold,
				Scale = Pango.Scale.XLarge
			});
			table.Add (new Gtk.TextTag ("h3") {
				Weight = Pango.Weight.Bold,
				Scale = Pango.Scale.Large
			});
			table.Add (new Gtk.TextTag ("h4") {
				Scale = Pango.Scale.Large
			});
			table.Add (new Gtk.TextTag ("pre") {
				Family = "Monospace",
				Indent = 14,
				WrapMode = Gtk.WrapMode.None
			});
		}
Exemple #11
0
        /*
         * Helper methods
         */
        private Gtk.TextTagTable BuildTagTable()
        {
            // TextTags
            Gtk.TextTagTable ttt = new Gtk.TextTagTable();
            Gtk.TextTag tt;
            Pango.FontDescription fd;

            // WARNING: the insertion order of tags MATTERS!
            // The attributes of the text tags are applied in the order of
            // insertion to the text table, and not in which order the tags
            // applied in the buffer. This is sick IMHO.
            tt = new Gtk.TextTag("bold");
            fd = new Pango.FontDescription();
            fd.Weight = Pango.Weight.Bold;
            tt.FontDesc = fd;
            BoldTag = tt;
            ttt.Add(tt);

            tt = new Gtk.TextTag("italic");
            fd = new Pango.FontDescription();
            fd.Style = Pango.Style.Italic;
            tt.FontDesc = fd;
            ItalicTag = tt;
            ttt.Add(tt);

            tt = new Gtk.TextTag("underline");
            tt.Underline = Pango.Underline.Single;
            UnderlineTag = tt;
            ttt.Add(tt);

            tt = new Gtk.TextTag("event");
            tt.Foreground = "darkgray";
            EventTag = tt;
            ttt.Add(tt);

            tt = new Gtk.TextTag("link");
            tt.Underline = Pango.Underline.Single;
            tt.Foreground = "darkblue";
            LinkTag = tt;
            ttt.Add(tt);

            tt = new Gtk.TextTag("person");
            PersonTag = tt;
            ttt.Add(tt);

            return ttt;
        }
Exemple #12
0
        /*
         * Helper methods
         */
        private Gtk.TextTagTable BuildTagTable()
        {
            // TextTags
            Gtk.TextTagTable ttt = new Gtk.TextTagTable();
            Gtk.TextTag tt;
            Pango.FontDescription fd;

            tt = new Gtk.TextTag("bold");
            fd = new Pango.FontDescription();
            fd.Weight = Pango.Weight.Bold;
            tt.FontDesc = fd;
            ttt.Add(tt);

            tt = new Gtk.TextTag("italic");
            fd = new Pango.FontDescription();
            fd.Style = Pango.Style.Italic;
            tt.FontDesc = fd;
            ttt.Add(tt);

            tt = new Gtk.TextTag("underline");
            tt.Underline = Pango.Underline.Single;
            ttt.Add(tt);

            tt = new Gtk.TextTag("url");
            tt.Underline = Pango.Underline.Single;
            tt.Foreground = "darkblue";
            tt.TextEvent += OnTextTagUrlTextEvent;
            fd = new Pango.FontDescription();
            tt.FontDesc = fd;
            ttt.Add(tt);

            tt = new Gtk.TextTag("event");
            tt.Foreground = "darkgray";
            ttt.Add(tt);

            return ttt;
        }
Exemple #13
0
 public RichTextBuffer(Gtk.TextTagTable table) : base(table)
 {
     Links       = new Dictionary <Gtk.TextTag, Link> ();
     openHeaders = new Stack <StartState> ();
     openLinks   = new Stack <Link> ();
 }
Exemple #14
0
        public ChatView(ChatModel chat)
        {
            Trace.Call(chat);

            _ChatModel = chat;
            _Name = _ChatModel.Name;
            Name = _Name;

            // TextTags
            Gtk.TextTagTable ttt = new Gtk.TextTagTable();
            _OutputTextTagTable = ttt;
            Gtk.TextTag tt;
            Pango.FontDescription fd;

            tt = new Gtk.TextTag("bold");
            fd = new Pango.FontDescription();
            fd.Weight = Pango.Weight.Bold;
            tt.FontDesc = fd;
            ttt.Add(tt);

            tt = new Gtk.TextTag("italic");
            fd = new Pango.FontDescription();
            fd.Style = Pango.Style.Italic;
            tt.FontDesc = fd;
            ttt.Add(tt);

            tt = new Gtk.TextTag("underline");
            tt.Underline = Pango.Underline.Single;
            ttt.Add(tt);

            tt = new Gtk.TextTag("url");
            tt.Underline = Pango.Underline.Single;
            tt.Foreground = "darkblue";
            tt.TextEvent += new Gtk.TextEventHandler(_OnTextTagUrlTextEvent);
            fd = new Pango.FontDescription();
            tt.FontDesc = fd;
            ttt.Add(tt);

            Gtk.TextView tv = new Gtk.TextView();
            tv.Buffer = new Gtk.TextBuffer(ttt);
            _EndMark = tv.Buffer.CreateMark("end", tv.Buffer.EndIter, false);
            tv.Editable = false;
            //tv.CursorVisible = false;
            tv.CursorVisible = true;
            tv.WrapMode = Gtk.WrapMode.Char;
            tv.Buffer.Changed += new EventHandler(_OnTextBufferChanged);
            tv.MotionNotifyEvent += new Gtk.MotionNotifyEventHandler(_OnMotionNotifyEvent);
            _OutputTextView = tv;

            Gtk.ScrolledWindow sw = new Gtk.ScrolledWindow();
            //sw.HscrollbarPolicy = Gtk.PolicyType.Never;
            sw.HscrollbarPolicy = Gtk.PolicyType.Automatic;
            sw.VscrollbarPolicy = Gtk.PolicyType.Always;
            sw.ShadowType = Gtk.ShadowType.In;
            sw.Add(_OutputTextView);
            _OutputScrolledWindow = sw;

            // popup menu
            _TabMenu = new Gtk.Menu();

            Gtk.ImageMenuItem close_item = new Gtk.ImageMenuItem(Gtk.Stock.Close, null);
            close_item.Activated += new EventHandler(OnTabMenuCloseActivated);
            _TabMenu.Append(close_item);

            //FocusChild = _OutputTextView;
            //CanFocus = false;

            _TabLabel = new Gtk.Label();
            _TabLabel.Text = _Name;

            _TabHBox = new Gtk.HBox();
            _TabHBox.PackEnd(new Gtk.Fixed(), true, true, 0);
            _TabHBox.PackEnd(_TabLabel, false, false, 0);
            _TabHBox.ShowAll();

            _TabEventBox = new Gtk.EventBox();
            _TabEventBox.VisibleWindow = false;
            _TabEventBox.ButtonPressEvent += new Gtk.ButtonPressEventHandler(OnTabButtonPress);
            _TabEventBox.Add(_TabHBox);
            _TabEventBox.ShowAll();
        }
Exemple #15
0
 public ChopBuffer(Gtk.TextTagTable table)
     : base(table)
 {
 }