public ChatView(ChatModel chat) { Trace.Call(chat); _ChatModel = chat; _Name = _ChatModel.Name; ID = _ChatModel.ID; Name = _Name; MessageTextView tv = new MessageTextView(); _EndMark = tv.Buffer.CreateMark("end", tv.Buffer.EndIter, false); tv.ShowTimestamps = true; tv.ShowMarkerline = true; tv.Editable = false; tv.CursorVisible = true; tv.WrapMode = Gtk.WrapMode.Char; tv.MessageAdded += OnMessageTextViewMessageAdded; tv.MessageHighlighted += OnMessageTextViewMessageHighlighted; tv.PopulatePopup += OnMessageTextViewPopulatePopup; _OutputMessageTextView = 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(_OutputMessageTextView); _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(); _ThemeSettings = new ThemeSettings(); // OPT-TODO: this should use a TaskStack instead of TaskQueue _LastSeenHighlightQueue = new TaskQueue("LastSeenHighlightQueue("+_Name+")"); _LastSeenHighlightQueue.AbortedEvent += OnLastSeenHighlightQueueAbortedEvent; _LastSeenHighlightQueue.ExceptionEvent += OnLastSeenHighlightQueueExceptionEvent; }
public ChatView(ChatModel chat) { Trace.Call(chat); _ChatModel = chat; IsAutoScrolling = true; MessageTextView tv = new MessageTextView(); _EndMark = tv.Buffer.CreateMark("end", tv.Buffer.EndIter, false); tv.ShowTimestamps = true; tv.ShowMarkerline = true; tv.Editable = false; tv.CursorVisible = true; tv.WrapMode = Gtk.WrapMode.Char; tv.MessageAdded += OnMessageTextViewMessageAdded; tv.MessageHighlighted += OnMessageTextViewMessageHighlighted; tv.PopulatePopup += OnMessageTextViewPopulatePopup; tv.SizeRequested += delegate { AutoScroll(); }; tv.PersonClicked += OnMessageTextViewPersonClicked; _OutputMessageTextView = tv; Gtk.ScrolledWindow sw = new Gtk.ScrolledWindow(); _OutputScrolledWindow = sw; //sw.HscrollbarPolicy = Gtk.PolicyType.Never; sw.HscrollbarPolicy = Gtk.PolicyType.Automatic; sw.VscrollbarPolicy = Gtk.PolicyType.Always; sw.ShadowType = Gtk.ShadowType.In; sw.Vadjustment.ValueChanged += OnVadjustmentValueChanged; sw.Add(_OutputMessageTextView); // popup menu _TabMenu = new Gtk.Menu(); _TabMenu.Shown += OnTabMenuShown; //FocusChild = _OutputTextView; //CanFocus = false; _TabLabel = new Gtk.Label(); TabImage = DefaultTabImage; _TabHBox = new Gtk.HBox(); _TabHBox.PackEnd(new Gtk.Fixed(), true, true, 0); _TabHBox.PackEnd(_TabLabel, false, false, 0); _TabHBox.PackStart(TabImage, false, false, 2); _TabHBox.ShowAll(); _TabEventBox = new Gtk.EventBox(); _TabEventBox.VisibleWindow = false; _TabEventBox.ButtonPressEvent += new Gtk.ButtonPressEventHandler(OnTabButtonPress); _TabEventBox.Add(_TabHBox); _TabEventBox.ShowAll(); _ThemeSettings = new ThemeSettings(); // OPT-TODO: this should use a TaskStack instead of TaskQueue _LastSeenHighlightQueue = new TaskQueue("LastSeenHighlightQueue("+ID+")"); _LastSeenHighlightQueue.AbortedEvent += OnLastSeenHighlightQueueAbortedEvent; _LastSeenHighlightQueue.ExceptionEvent += OnLastSeenHighlightQueueExceptionEvent; }
public GroupChatView(GroupChatModel groupChat) : base(groupChat) { Trace.Call(groupChat); _GroupChatModel = groupChat; // person list Participants = new List<PersonModel>(); _OutputHPaned = new Gtk.HPaned(); Gtk.TreeView tv = new Gtk.TreeView(); _PersonTreeView = tv; Gtk.ScrolledWindow sw = new Gtk.ScrolledWindow(); PersonScrolledWindow = sw; sw.ShadowType = Gtk.ShadowType.None; sw.HscrollbarPolicy = Gtk.PolicyType.Never; //tv.CanFocus = false; tv.BorderWidth = 0; tv.Selection.Mode = Gtk.SelectionMode.Multiple; sw.Add(tv); Gtk.TreeViewColumn column; var cellr = new Gtk.CellRendererText() { Ellipsize = Pango.EllipsizeMode.End }; IdentityNameCellRenderer = cellr; column = new Gtk.TreeViewColumn(String.Empty, cellr); column.SortColumnId = 0; column.Spacing = 0; column.SortIndicator = false; column.Expand = true; column.Sizing = Gtk.TreeViewColumnSizing.Autosize; // FIXME: this callback leaks memory column.SetCellDataFunc(cellr, new Gtk.TreeCellDataFunc(RenderPersonIdentityName)); tv.AppendColumn(column); _IdentityNameColumn = column; Gtk.ListStore liststore = new Gtk.ListStore(typeof(PersonModel)); liststore.SetSortColumnId(0, Gtk.SortType.Ascending); liststore.SetSortFunc(0, new Gtk.TreeIterCompareFunc(SortPersonListStore)); _PersonListStore = liststore; tv.Model = liststore; tv.SearchColumn = 0; tv.SearchEqualFunc = (model, col, key, iter) => { var person = (PersonModel) model.GetValue(iter, col); // Ladies and gentlemen welcome to C // 0 means it matched but 0 as bool is false. So if it matches // we have to return false. Still not clear? true is false and // false is true, weirdo! If you think this is retarded, // yes it is. return !person.IdentityName.StartsWith(key, StringComparison.InvariantCultureIgnoreCase); }; tv.EnableSearch = true; tv.HeadersVisible = false; tv.RowActivated += new Gtk.RowActivatedHandler(OnPersonsRowActivated); tv.FocusOutEvent += OnPersonTreeViewFocusOutEvent; // popup menu _PersonMenu = new Gtk.Menu(); // don't loose the focus else we lose the selection too! // see OnPersonTreeViewFocusOutEvent() _PersonMenu.TakeFocus = false; _PersonMenu.Shown += OnPersonMenuShown; _PersonTreeView.ButtonPressEvent += _OnPersonTreeViewButtonPressEvent; _PersonTreeView.KeyPressEvent += OnPersonTreeViewKeyPressEvent; // frame needed for events when selecting something in the treeview _PersonTreeViewFrame = new Gtk.Frame() { ShadowType = Gtk.ShadowType.In }; _PersonTreeViewFrame.ButtonReleaseEvent += new Gtk.ButtonReleaseEventHandler(_OnUserListButtonReleaseEvent); _PersonTreeViewFrame.Add(sw); // topic // don't worry, ApplyConfig() will add us to the OutputVBox! _OutputVBox = new Gtk.VBox() { Spacing = 1 }; _TopicTextView = new MessageTextView(); _TopicTextView.Editable = false; _TopicTextView.WrapMode = Gtk.WrapMode.WordChar; _TopicScrolledWindow = new Gtk.ScrolledWindow(); _TopicScrolledWindow.ShadowType = Gtk.ShadowType.In; _TopicScrolledWindow.HscrollbarPolicy = Gtk.PolicyType.Never; _TopicScrolledWindow.Add(_TopicTextView); // make sure the topic is invisible and remains by default and // visible when a topic gets set _TopicScrolledWindow.ShowAll(); _TopicScrolledWindow.Visible = false; _TopicScrolledWindow.NoShowAll = true; _TopicScrolledWindow.SizeRequested += delegate(object o, Gtk.SizeRequestedArgs args) { // predict and set useful topic heigth int lineWidth, lineHeight; using (var layout = _TopicTextView.CreatePangoLayout("Test Topic")) { layout.GetPixelSize(out lineWidth, out lineHeight); } var lineSpacing = _TopicTextView.PixelsAboveLines + _TopicTextView.PixelsBelowLines; var it = _TopicTextView.Buffer.StartIter; int newLines = 1; // move to end of next visual line while (_TopicTextView.ForwardDisplayLineEnd(ref it)) { newLines++; // calling ForwardDisplayLineEnd repeatedly stays on the same position // therefor we move one cursor position further it.ForwardCursorPosition(); } newLines = Math.Min(newLines, 3); var bestSize = new Gtk.Requisition() { Height = ((lineHeight + lineSpacing) * newLines) + 4 }; args.Requisition = bestSize; }; Add(_OutputHPaned); //ApplyConfig(Frontend.UserConfig); ShowAll(); }
public GroupChatView(GroupChatModel groupChat) : base(groupChat) { Trace.Call(groupChat); _GroupChatModel = groupChat; // person list _OutputHPaned = new Gtk.HPaned(); Gtk.ScrolledWindow sw = new Gtk.ScrolledWindow(); _PersonScrolledWindow = sw; //sw.WidthRequest = 150; sw.HscrollbarPolicy = Gtk.PolicyType.Never; Gtk.TreeView tv = new Gtk.TreeView(); _PersonTreeView = tv; //tv.CanFocus = false; tv.BorderWidth = 0; tv.Selection.Mode = Gtk.SelectionMode.Multiple; sw.Add(tv); Gtk.TreeViewColumn column; Gtk.CellRendererText cellr = new Gtk.CellRendererText(); cellr.WidthChars = 12; column = new Gtk.TreeViewColumn(String.Empty, cellr); column.SortColumnId = 0; column.Spacing = 0; column.SortIndicator = false; column.Sizing = Gtk.TreeViewColumnSizing.Autosize; column.SetCellDataFunc(cellr, new Gtk.TreeCellDataFunc(RenderPersonIdentityName)); tv.AppendColumn(column); _IdentityNameColumn = column; Gtk.ListStore liststore = new Gtk.ListStore(typeof(PersonModel)); liststore.SetSortColumnId(0, Gtk.SortType.Ascending); liststore.SetSortFunc(0, new Gtk.TreeIterCompareFunc(SortPersonListStore)); _PersonListStore = liststore; tv.Model = liststore; tv.RowActivated += new Gtk.RowActivatedHandler(OnPersonsRowActivated); tv.FocusOutEvent += OnPersonTreeViewFocusOutEvent; // popup menu _PersonMenu = new Gtk.Menu(); // don't loose the focus else we lose the selection too! // see OnPersonTreeViewFocusOutEvent() _PersonMenu.TakeFocus = false; _PersonMenu.Shown += OnPersonMenuShown; _PersonTreeView.ButtonPressEvent += _OnPersonTreeViewButtonPressEvent; _PersonTreeView.KeyPressEvent += OnPersonTreeViewKeyPressEvent; // frame needed for events when selecting something in the treeview _PersonTreeViewFrame = new Gtk.Frame(); _PersonTreeViewFrame.ButtonReleaseEvent += new Gtk.ButtonReleaseEventHandler(_OnUserListButtonReleaseEvent); _PersonTreeViewFrame.Add(sw); // topic // don't worry, ApplyConfig() will add us to the OutputVBox! _OutputVBox = new Gtk.VBox(); _TopicTextView = new MessageTextView(); _TopicTextView.Editable = false; _TopicTextView.WrapMode = Gtk.WrapMode.WordChar; _TopicScrolledWindow = new Gtk.ScrolledWindow(); _TopicScrolledWindow.ShadowType = Gtk.ShadowType.In; // when using PolicyType.Never, it will try to grow but never shrinks! _TopicScrolledWindow.HscrollbarPolicy = Gtk.PolicyType.Automatic; _TopicScrolledWindow.VscrollbarPolicy = Gtk.PolicyType.Automatic; _TopicScrolledWindow.Add(_TopicTextView); // make sure the topic is invisible and remains by default and // visible when a topic gets set _TopicScrolledWindow.ShowAll(); _TopicScrolledWindow.Visible = false; _TopicScrolledWindow.NoShowAll = true; _TopicScrolledWindow.SizeRequested += delegate(object o, Gtk.SizeRequestedArgs args) { // predict and set useful topic heigth Pango.Layout layout = _TopicTextView.CreatePangoLayout("Test Topic"); int lineWidth, lineHeigth; layout.GetPixelSize(out lineWidth, out lineHeigth); var lineSpacing = _TopicTextView.PixelsAboveLines + _TopicTextView.PixelsBelowLines; var text = Topic != null ? Topic.ToString() : String.Empty; // hardcoded to 2 lines for now var newLines = text.Length > 0 ? 2 : 0; var bestSize = new Gtk.Requisition() { Height = ((lineHeigth + lineSpacing) * newLines) + 2 }; args.Requisition = bestSize; }; Add(_OutputHPaned); //ApplyConfig(Frontend.UserConfig); ShowAll(); }
public GroupChatView(GroupChatModel groupChat) : base(groupChat) { Trace.Call(groupChat); _GroupChatModel = groupChat; // person list _OutputHPaned = new Gtk.HPaned(); Gtk.ScrolledWindow sw = new Gtk.ScrolledWindow(); _PersonScrolledWindow = sw; //sw.WidthRequest = 150; sw.HscrollbarPolicy = Gtk.PolicyType.Never; Gtk.TreeView tv = new Gtk.TreeView(); _PersonTreeView = tv; //tv.CanFocus = false; tv.BorderWidth = 0; tv.Selection.Mode = Gtk.SelectionMode.Multiple; sw.Add(tv); Gtk.TreeViewColumn column; Gtk.CellRendererText cellr = new Gtk.CellRendererText(); cellr.WidthChars = 12; column = new Gtk.TreeViewColumn(String.Empty, cellr); column.SortColumnId = 0; column.Spacing = 0; column.SortIndicator = false; column.Sizing = Gtk.TreeViewColumnSizing.Autosize; column.SetCellDataFunc(cellr, new Gtk.TreeCellDataFunc(RenderPersonIdentityName)); tv.AppendColumn(column); _IdentityNameColumn = column; Gtk.ListStore liststore = new Gtk.ListStore(typeof(PersonModel)); liststore.SetSortColumnId(0, Gtk.SortType.Ascending); liststore.SetSortFunc(0, new Gtk.TreeIterCompareFunc(SortPersonListStore)); _PersonListStore = liststore; tv.Model = liststore; tv.RowActivated += new Gtk.RowActivatedHandler(OnPersonsRowActivated); tv.FocusOutEvent += OnPersonTreeViewFocusOutEvent; // popup menu _PersonMenu = new Gtk.Menu(); // don't loose the focus else we lose the selection too! // see OnPersonTreeViewFocusOutEvent() _PersonMenu.TakeFocus = false; _PersonMenu.Shown += OnPersonMenuShown; _PersonTreeView.ButtonPressEvent += _OnPersonTreeViewButtonPressEvent; _PersonTreeView.KeyPressEvent += OnPersonTreeViewKeyPressEvent; // frame needed for events when selecting something in the treeview _PersonTreeViewFrame = new Gtk.Frame(); _PersonTreeViewFrame.ButtonReleaseEvent += new Gtk.ButtonReleaseEventHandler(_OnUserListButtonReleaseEvent); _PersonTreeViewFrame.Add(sw); // topic // don't worry, ApplyConfig() will add us to the OutputVBox! _OutputVBox = new Gtk.VBox(); _TopicTextView = new MessageTextView(); _TopicTextView.Editable = false; _TopicTextView.WrapMode = Gtk.WrapMode.WordChar; _TopicScrolledWindow = new Gtk.ScrolledWindow(); _TopicScrolledWindow.ShadowType = Gtk.ShadowType.In; // when using PolicyType.Never, it will try to grow but never shrinks! _TopicScrolledWindow.HscrollbarPolicy = Gtk.PolicyType.Automatic; _TopicScrolledWindow.VscrollbarPolicy = Gtk.PolicyType.Automatic; _TopicScrolledWindow.Add(_TopicTextView); // make sure the topic is invisible and remains by default and // visible when a topic gets set _TopicScrolledWindow.ShowAll(); _TopicScrolledWindow.Visible = false; _TopicScrolledWindow.NoShowAll = true; Add(_OutputHPaned); //ApplyConfig(Frontend.UserConfig); ShowAll(); }
public ChatView(ChatModel chat) { Trace.Call(chat); _ChatModel = chat; IsAutoScrolling = true; MessageTextView tv = new MessageTextView(); _EndMark = tv.Buffer.CreateMark("end", tv.Buffer.EndIter, false); tv.ShowTimestamps = true; tv.ShowMarkerline = true; tv.Editable = false; tv.CursorVisible = true; tv.WrapMode = Gtk.WrapMode.Char; tv.MessageAdded += OnMessageTextViewMessageAdded; tv.MessageHighlighted += OnMessageTextViewMessageHighlighted; tv.PopulatePopup += OnMessageTextViewPopulatePopup; tv.SizeRequested += delegate { AutoScroll(); }; tv.PersonClicked += OnMessageTextViewPersonClicked; _OutputMessageTextView = tv; Gtk.ScrolledWindow sw = new Gtk.ScrolledWindow(); _OutputScrolledWindow = sw; //sw.HscrollbarPolicy = Gtk.PolicyType.Never; sw.HscrollbarPolicy = Gtk.PolicyType.Automatic; sw.VscrollbarPolicy = Gtk.PolicyType.Always; sw.ShadowType = Gtk.ShadowType.In; sw.Vadjustment.ValueChanged += OnVadjustmentValueChanged; sw.Add(_OutputMessageTextView); // popup menu _TabMenu = new Gtk.Menu(); CloseItem = new Gtk.ImageMenuItem(Gtk.Stock.Close, null); CloseItem.Activated += new EventHandler(OnTabMenuCloseActivated); _TabMenu.Append(CloseItem); _TabMenu.ShowAll(); //FocusChild = _OutputTextView; //CanFocus = false; _TabLabel = new Gtk.Label(); TabImage = DefaultTabImage; _TabHBox = new Gtk.HBox(); _TabHBox.PackEnd(new Gtk.Fixed(), true, true, 0); _TabHBox.PackEnd(_TabLabel, false, false, 0); _TabHBox.PackStart(TabImage, false, false, 2); _TabHBox.ShowAll(); _TabEventBox = new Gtk.EventBox(); _TabEventBox.VisibleWindow = false; _TabEventBox.ButtonPressEvent += new Gtk.ButtonPressEventHandler(OnTabButtonPress); _TabEventBox.Add(_TabHBox); _TabEventBox.ShowAll(); _ThemeSettings = new ThemeSettings(); // OPT-TODO: this should use a TaskStack instead of TaskQueue _LastSeenHighlightQueue = new TaskQueue("LastSeenHighlightQueue(" + ID + ")"); _LastSeenHighlightQueue.AbortedEvent += OnLastSeenHighlightQueueAbortedEvent; _LastSeenHighlightQueue.ExceptionEvent += OnLastSeenHighlightQueueExceptionEvent; }
public GroupChatView(GroupChatModel groupChat) : base(groupChat) { Trace.Call(groupChat); _GroupChatModel = groupChat; // person list Participants = new List <PersonModel>(); _OutputHPaned = new Gtk.HPaned(); _OutputHPaned.ButtonPressEvent += (sender, e) => {; // reset person list size on double click if (e.Event.Type == Gdk.EventType.TwoButtonPress && e.Event.Button == 1) { GLib.Timeout.Add(200, delegate { _OutputHPaned.Position = -1; return(false); }); } }; Gtk.TreeView tv = new Gtk.TreeView(); _PersonTreeView = tv; Gtk.ScrolledWindow sw = new Gtk.ScrolledWindow(); PersonScrolledWindow = sw; sw.HscrollbarPolicy = Gtk.PolicyType.Never; sw.SizeRequested += (o, args) => { // predict and set useful treeview width var persons = SyncedPersons; if (persons == null || persons.Count == 0) { return; } int longestNameWidth = 0; foreach (var person in persons.Values) { int lineWidth, lineHeigth; using (var layout = _PersonTreeView.CreatePangoLayout(person.IdentityName)) { layout.GetPixelSize(out lineWidth, out lineHeigth); } if (lineWidth > longestNameWidth) { longestNameWidth = lineWidth; } } var bestSize = new Gtk.Requisition() { Width = longestNameWidth }; args.Requisition = bestSize; }; //tv.CanFocus = false; tv.BorderWidth = 0; tv.Selection.Mode = Gtk.SelectionMode.Multiple; sw.Add(tv); Gtk.TreeViewColumn column; Gtk.CellRendererText cellr = new Gtk.CellRendererText(); IdentityNameCellRenderer = cellr; column = new Gtk.TreeViewColumn(String.Empty, cellr); column.SortColumnId = 0; column.Spacing = 0; column.SortIndicator = false; column.Sizing = Gtk.TreeViewColumnSizing.Autosize; // FIXME: this callback leaks memory column.SetCellDataFunc(cellr, new Gtk.TreeCellDataFunc(RenderPersonIdentityName)); tv.AppendColumn(column); _IdentityNameColumn = column; Gtk.ListStore liststore = new Gtk.ListStore(typeof(PersonModel)); liststore.SetSortColumnId(0, Gtk.SortType.Ascending); liststore.SetSortFunc(0, new Gtk.TreeIterCompareFunc(SortPersonListStore)); _PersonListStore = liststore; tv.Model = liststore; tv.SearchColumn = 0; tv.SearchEqualFunc = (model, col, key, iter) => { var person = (PersonModel)model.GetValue(iter, col); // Ladies and gentlemen welcome to C // 0 means it matched but 0 as bool is false. So if it matches // we have to return false. Still not clear? true is false and // false is true, weirdo! If you think this is retarded, // yes it is. return(!person.IdentityName.StartsWith(key, StringComparison.InvariantCultureIgnoreCase)); }; tv.EnableSearch = true; tv.RowActivated += new Gtk.RowActivatedHandler(OnPersonsRowActivated); tv.FocusOutEvent += OnPersonTreeViewFocusOutEvent; // popup menu _PersonMenu = new Gtk.Menu(); // don't loose the focus else we lose the selection too! // see OnPersonTreeViewFocusOutEvent() _PersonMenu.TakeFocus = false; _PersonMenu.Shown += OnPersonMenuShown; _PersonTreeView.ButtonPressEvent += _OnPersonTreeViewButtonPressEvent; _PersonTreeView.KeyPressEvent += OnPersonTreeViewKeyPressEvent; // frame needed for events when selecting something in the treeview _PersonTreeViewFrame = new Gtk.Frame(); _PersonTreeViewFrame.ButtonReleaseEvent += new Gtk.ButtonReleaseEventHandler(_OnUserListButtonReleaseEvent); _PersonTreeViewFrame.Add(sw); // topic // don't worry, ApplyConfig() will add us to the OutputVBox! _OutputVBox = new Gtk.VBox(); _TopicTextView = new MessageTextView(); _TopicTextView.Editable = false; _TopicTextView.WrapMode = Gtk.WrapMode.WordChar; _TopicScrolledWindow = new Gtk.ScrolledWindow(); _TopicScrolledWindow.ShadowType = Gtk.ShadowType.In; _TopicScrolledWindow.HscrollbarPolicy = Gtk.PolicyType.Never; _TopicScrolledWindow.Add(_TopicTextView); // make sure the topic is invisible and remains by default and // visible when a topic gets set _TopicScrolledWindow.ShowAll(); _TopicScrolledWindow.Visible = false; _TopicScrolledWindow.NoShowAll = true; _TopicScrolledWindow.SizeRequested += delegate(object o, Gtk.SizeRequestedArgs args) { // predict and set useful topic heigth int lineWidth, lineHeight; using (var layout = _TopicTextView.CreatePangoLayout("Test Topic")) { layout.GetPixelSize(out lineWidth, out lineHeight); } var lineSpacing = _TopicTextView.PixelsAboveLines + _TopicTextView.PixelsBelowLines; var it = _TopicTextView.Buffer.StartIter; int newLines = 1; // move to end of next visual line while (_TopicTextView.ForwardDisplayLineEnd(ref it)) { newLines++; // calling ForwardDisplayLineEnd repeatedly stays on the same position // therefor we move one cursor position further it.ForwardCursorPosition(); } newLines = Math.Min(newLines, 3); var bestSize = new Gtk.Requisition() { Height = ((lineHeight + lineSpacing) * newLines) + 4 }; args.Requisition = bestSize; }; Add(_OutputHPaned); //ApplyConfig(Frontend.UserConfig); ShowAll(); }