public DisassemblyView () { ContentName = GettextCatalog.GetString ("Disassembly"); sw = new Gtk.ScrolledWindow (); editor = new TextEditor (); editor.Document.ReadOnly = true; editor.Options = new CommonTextEditorOptions { ShowLineNumberMargin = false, }; sw.Add (editor); sw.HscrollbarPolicy = Gtk.PolicyType.Automatic; sw.VscrollbarPolicy = Gtk.PolicyType.Automatic; sw.ShowAll (); sw.Vadjustment.ValueChanged += OnScrollEditor; sw.VScrollbar.ButtonPressEvent += OnPress; sw.VScrollbar.ButtonReleaseEvent += OnRelease; sw.VScrollbar.Events |= Gdk.EventMask.ButtonPressMask | Gdk.EventMask.ButtonReleaseMask; sw.ShadowType = Gtk.ShadowType.In; sw.Sensitive = false; currentDebugLineMarker = new CurrentDebugLineTextMarker (editor); DebuggingService.StoppedEvent += OnStop; }
public static void CreateUICanvasButtonAddTab(Gtk.Window window, Gtk.Notebook parentNotebook, Gtk.ButtonReleaseEventHandler buttonPressEvent) { Gtk.ScrolledWindow scrolledWindow = new Gtk.ScrolledWindow(); scrolledWindow.Name = "_scrolledWindow" + nextGeneratedTabIndex; scrolledWindow.ShadowType = ((Gtk.ShadowType)(1)); scrolledWindow.ShowAll(); Gtk.Image buttonAddTabImage = new Gtk.Image(); buttonAddTabImage.Pixbuf = global::Stetic.IconLoader.LoadIcon(window, "gtk-add", Gtk.IconSize.Button); buttonAddTabImage.ShowAll(); Gtk.Button buttonAddTab = new Gtk.Button(); buttonAddTab.CanFocus = true; buttonAddTab.Name = "_buttonAddhostEntry"; buttonAddTab.Image = buttonAddTabImage; buttonAddTab.ShowAll(); buttonAddTab.ButtonReleaseEvent += buttonPressEvent; Gtk.Viewport viewportLabel = new Gtk.Viewport(); viewportLabel.ShadowType = ((Gtk.ShadowType)(0)); viewportLabel.Add(buttonAddTab); parentNotebook.Add(scrolledWindow); parentNotebook.SetTabLabel(scrolledWindow, viewportLabel); }
public DisassemblyView() { UntitledName = GettextCatalog.GetString("Disassembly"); sw = new Gtk.ScrolledWindow(); editor = new Mono.TextEditor.TextEditor(); editor.Document.ReadOnly = true; editor.Options = new MonoDevelop.Ide.Gui.CommonTextEditorOptions() { ShowEolMarkers = false, ShowInvalidLines = false, ShowLineNumberMargin = false, }; sw.Add(editor); sw.HscrollbarPolicy = Gtk.PolicyType.Automatic; sw.VscrollbarPolicy = Gtk.PolicyType.Automatic; sw.ShowAll(); sw.Vadjustment.ValueChanged += OnScrollEditor; sw.VScrollbar.ButtonPressEvent += OnPress; sw.VScrollbar.ButtonReleaseEvent += OnRelease; sw.VScrollbar.Events |= Gdk.EventMask.ButtonPressMask | Gdk.EventMask.ButtonReleaseMask; sw.ShadowType = Gtk.ShadowType.In; sw.Sensitive = false; currentDebugLineMarker = new CurrentDebugLineTextMarker(editor); DebuggingService.StoppedEvent += OnStop; }
public override Gtk.Widget GetVisualizerWidget(ObjectValue val) { var ops = DebuggingService.DebuggerSession.EvaluationOptions.Clone(); string file = Path.GetTempFileName(); Gdk.Pixbuf pixbuf; ops.AllowTargetInvoke = true; try { var pix = (RawValue)val.GetRawValue(ops); pix.CallMethod("Save", file, "png"); pixbuf = new Gdk.Pixbuf(file); } finally { File.Delete(file); } var sc = new Gtk.ScrolledWindow(); sc.ShadowType = Gtk.ShadowType.In; sc.HscrollbarPolicy = Gtk.PolicyType.Automatic; sc.VscrollbarPolicy = Gtk.PolicyType.Automatic; var image = new Gtk.Image(pixbuf); sc.AddWithViewport(image); sc.ShowAll(); return(sc); }
void IPlugin.Init(object context) { solidIDE = context as ISolidIDE; mainWindow = solidIDE.GetMainWindow(); // Dock with PropertyGrid Gtk.ScrolledWindow inspectorGridScrollWindow = new Gtk.ScrolledWindow(); Gtk.Viewport inspectorGridViewport = new Gtk.Viewport(); inspectorGridScrollWindow.Add(inspectorGridViewport); inspectorGrid = new SolidV.Gtk.InspectorGrid.InspectorGrid(); inspectorGridViewport.Add(inspectorGrid); inspectorGridScrollWindow.ShowAll(); InspectorDockItem = mainWindow.DockFrame.AddItem("Inspector"); InspectorDockItem.Behavior = DockItemBehavior.Normal; InspectorDockItem.Expand = true; InspectorDockItem.DrawFrame = true; InspectorDockItem.Label = "Inspector"; InspectorDockItem.Content = inspectorGridScrollWindow; InspectorDockItem.DefaultVisible = true; InspectorDockItem.Visible = true; IServiceContainer plugins = solidIDE.GetServiceContainer(); IDesigner designer = plugins.GetService <IDesigner>(); designer.CurrentSheetChanged += HandleDesignerCurrentSheetChanged; // Menu var viewMenuItem = solidIDE.GetMenuItem <Gtk.ImageMenuItem>("View"); var InspectorMenuItem = solidIDE.GetMenuItem <Gtk.ImageMenuItem>("View", "Inspector"); InspectorMenuItem.Activated += HandleShowInspectorActivated; }
public override Gtk.Widget GetVisualizerWidget (ObjectValue val) { var ops = DebuggingService.DebuggerSession.EvaluationOptions.Clone (); string file = Path.GetTempFileName (); Gdk.Pixbuf pixbuf; ops.AllowTargetInvoke = true; try { var pix = (RawValue) val.GetRawValue (ops); pix.CallMethod ("Save", file, "png"); pixbuf = new Gdk.Pixbuf (file); } finally { File.Delete (file); } var sc = new Gtk.ScrolledWindow (); sc.ShadowType = Gtk.ShadowType.In; sc.HscrollbarPolicy = Gtk.PolicyType.Automatic; sc.VscrollbarPolicy = Gtk.PolicyType.Automatic; var image = new Gtk.Image (pixbuf); sc.AddWithViewport (image); sc.ShowAll (); return sc; }
public DisassemblyView () { UntitledName = GettextCatalog.GetString ("Disassembly"); sw = new Gtk.ScrolledWindow (); editor = new Mono.TextEditor.TextEditor (); editor.Document.ReadOnly = true; TextEditorOptions options = new TextEditorOptions (); options.CopyFrom (TextEditorOptions.DefaultOptions); options.ShowEolMarkers = false; options.ShowInvalidLines = false; options.ShowLineNumberMargin = false; editor.Options = options; sw.Add (editor); sw.HscrollbarPolicy = Gtk.PolicyType.Automatic; sw.VscrollbarPolicy = Gtk.PolicyType.Automatic; sw.ShowAll (); sw.Vadjustment.ValueChanged += OnScrollEditor; sw.VScrollbar.ButtonPressEvent += OnPress; sw.VScrollbar.ButtonReleaseEvent += OnRelease; sw.VScrollbar.Events |= Gdk.EventMask.ButtonPressMask | Gdk.EventMask.ButtonReleaseMask; sw.ShadowType = Gtk.ShadowType.In; sw.Sensitive = false; currentDebugLineMarker = new CurrentDebugLineTextMarker (editor); DebuggingService.StoppedEvent += OnStop; }
Gtk.Widget IOutlinedDocument.GetOutlineWidget() { if (outlineTreeView != null) { return(outlineTreeView); } outlineTreeStore = new Gtk.TreeStore(typeof(string), typeof(Gdk.Color), typeof(Mono.TextTemplating.ISegment)); outlineTreeView = new MonoDevelop.Ide.Gui.Components.PadTreeView(outlineTreeStore); outlineTreeView.Realized += delegate { RefillOutlineStore(); }; outlineTreeView.TextRenderer.Xpad = 0; outlineTreeView.TextRenderer.Ypad = 0; outlineTreeView.AppendColumn("Node", outlineTreeView.TextRenderer, "text", 0, "foreground-gdk", 1); outlineTreeView.HeadersVisible = false; outlineTreeView.Selection.Changed += delegate { Gtk.TreeIter iter; if (!outlineTreeView.Selection.GetSelected(out iter)) { return; } SelectSegment((Mono.TextTemplating.ISegment)outlineTreeStore.GetValue(iter, 2)); }; RefillOutlineStore(); Gtk.ScrolledWindow sw = new Gtk.ScrolledWindow(); sw.Add(outlineTreeView); sw.ShowAll(); return(sw); }
public override void Initialize(IPadWindow window) { base.Initialize(window); // Call ctors inputEditor = new TextEditor() { Name = "input", Events = Gdk.EventMask.AllEventsMask, HeightRequest = 80 }; editor = new TextEditor() { Name = "output", Events = Gdk.EventMask.AllEventsMask }; vpaned = new Gtk.VPaned(); var scr1 = new Gtk.ScrolledWindow(); var scr2 = new Gtk.ScrolledWindow(); // Init layout scr1.ShadowType = Gtk.ShadowType.In; scr1.Child = inputEditor; vpaned.Add1(scr1); scr1.ShowAll(); inputEditor.ShowAll(); scr2.ShadowType = Gtk.ShadowType.In; scr2.Child = editor; vpaned.Add2(scr2); scr2.ShowAll(); editor.ShowAll(); vpaned.ShowAll(); // Init editors var o = editor.Options; inputEditor.Options = o; o.ShowLineNumberMargin = false; o.ShowFoldMargin = false; o.ShowIconMargin = false; editor.Document.ReadOnly = true; inputEditor.Text = PropertyService.Get(lastInputStringPropId, string.Empty); editor.Text = string.Empty; editor.Document.SyntaxMode = new Highlighting.DSyntaxMode(); inputEditor.Document.SyntaxMode = new Highlighting.DSyntaxMode(); editor.Document.MimeType = Formatting.DCodeFormatter.MimeType; inputEditor.Document.MimeType = Formatting.DCodeFormatter.MimeType; // Init toolbar var tb = window.GetToolbar(Gtk.PositionType.Top); executeButton = new Gtk.Button(); executeButton.Image = new Gtk.Image(Gtk.Stock.Execute, Gtk.IconSize.Menu); executeButton.TooltipText = "Evaluates the expression typed in the upper input editor."; executeButton.Clicked += Execute; tb.Add(executeButton); abortButton = new Gtk.Button(); abortButton.Sensitive = false; abortButton.Image = new Gtk.Image(Gtk.Stock.Stop, Gtk.IconSize.Menu); abortButton.TooltipText = "Stops the evaluation."; abortButton.Clicked += (object sender, EventArgs e) => AbortExecution(); tb.Add(abortButton); tb.ShowAll(); }
void IPlugin.Init(object context) { solidIDE = context as ISolidIDE; mainWindow = solidIDE.GetMainWindow(); // Dock with Tree Gtk.ScrolledWindow treeViewScrollWindow = new Gtk.ScrolledWindow(); Gtk.Viewport treeViewViewport = new Gtk.Viewport(); treeViewScrollWindow.Add(treeViewViewport); treeView = new Gtk.TreeView(); treeViewViewport.Add(treeView); treeViewScrollWindow.ShowAll(); Gtk.TreeViewColumn col = new Gtk.TreeViewColumn(); Gtk.CellRendererText colAssemblyCell = new Gtk.CellRendererText(); col.PackStart(colAssemblyCell, true); col.AddAttribute(colAssemblyCell, "text", 0); treeView.AppendColumn(col); treeView.Model = new Gtk.TreeStore(typeof(string), typeof(Tool <Gdk.Event, Cairo.Context, Model>), typeof(Shape)); treeView.RowActivated += HandleRowActivated; treeView.CursorChanged += HandleCursorChanged; Gtk.Drag.SourceSet( treeView, Gdk.ModifierType.Button1Mask, new Gtk.TargetEntry[] { new Gtk.TargetEntry("application/x-solidide.shape", Gtk.TargetFlags.App, 0) }, Gdk.DragAction.Copy ); /*treeView.EnableModelDragSource( * Gdk.ModifierType.None, * new Gtk.TargetEntry[] { new TargetEntry("application/SolidIDE", 0, 0) }, * Gdk.DragAction.Default);*/ treeView.DragBegin += HandleTreeViewDragBegin; treeView.DragDataGet += HandleTreeViewDragDataGet; //treeView.DragDrop += HandleTreeViewDragDrop; toolboxDockItem = mainWindow.DockFrame.AddItem("Toolbox"); toolboxDockItem.Behavior = DockItemBehavior.Normal; toolboxDockItem.Expand = true; toolboxDockItem.DrawFrame = true; toolboxDockItem.Label = "Toolbox"; toolboxDockItem.Content = treeViewScrollWindow; toolboxDockItem.DefaultVisible = true; toolboxDockItem.Visible = true; UpdateToolbox(); // Menu var viewMenuItem = solidIDE.GetMenuItem <Gtk.ImageMenuItem>("View"); solidIDE.GetMenuItem <Gtk.TearoffMenuItem>("View", "TearoffView"); var toolboxMenuItem = solidIDE.GetMenuItem <Gtk.ImageMenuItem>("View", "Toolbox"); toolboxMenuItem.Activated += HandleShowToolboxActivated; }
void IPlugin.Init(object context) { reflector = context as ISolidReflector; mainWindow = reflector.GetMainWindow(); Gtk.MenuBar mainMenuBar = reflector.GetMainMenu(); reflector.OnShutDown += HandleOnShutDown; Gtk.MenuItem fileMenu = null; // Find the File menu if present foreach (Gtk.Widget w in mainMenuBar.Children) { if (w.Name == "FileAction") { fileMenu = w as Gtk.MenuItem; } } // If not present - create it if (fileMenu == null) { Gtk.Menu menu = new Gtk.Menu(); fileMenu = new Gtk.MenuItem("File"); fileMenu.Submenu = menu; mainMenuBar.Append(fileMenu); } // Setting up the Open menu item in File Gtk.MenuItem open = new Gtk.MenuItem("Open"); open.Activated += OnActivated; (fileMenu.Submenu as Gtk.Menu).Prepend(open); // Setting up the window scrollers Gtk.ScrolledWindow scrollWindow = new Gtk.ScrolledWindow(); Gtk.Viewport viewport = new Gtk.Viewport(); scrollWindow.Add(viewport); viewport.Add(assemblyTree); scrollWindow.ShowAll(); // Attaching the current dockItem in the DockFrame dockItem = mainWindow.DockFrame.AddItem("AssemblyBrowser"); dockItem.DrawFrame = true; dockItem.Label = "Assembly"; dockItem.Content = scrollWindow; LoadEnvironment(); assemblyTree.RowActivated += HandleRowActivated; assemblyTree.Realized += delegate(object sender, EventArgs e) { LoadSelectedAssembliesTreePaths(); }; }
public HexEditorView() { window.Child = hexEditor; window.ShowAll(); hexEditor.HexEditorStyle = new MonoDevelopHexEditorStyle(hexEditor); SetOptions(); MonoDevelop.SourceEditor.DefaultSourceEditorOptions.Instance.Changed += delegate { SetOptions(); }; hexEditor.HexEditorData.Replaced += delegate { this.IsDirty = true; }; }
public static UITabPage CreateUICanvasTab(Gtk.Notebook parentNotebook, GameConfigDB gameConfigDB, bool isInitializing = false) { Gtk.ScrolledWindow scrolledWindow = new Gtk.ScrolledWindow(); scrolledWindow.Name = "_scrolledWindow" + nextGeneratedTabIndex; scrolledWindow.ShadowType = ((Gtk.ShadowType)(1)); scrolledWindow.ShowAll(); Gtk.Viewport viewport = new Gtk.Viewport(); viewport.ShadowType = ((Gtk.ShadowType)(0)); Gtk.Fixed canvas = new Gtk.Fixed(); canvas.WidthRequest = 800; canvas.HeightRequest = 600; canvas.Name = "_gameCanvas" + nextGeneratedTabIndex; canvas.HasWindow = false; canvas.ShowAll(); viewport.Add(canvas); viewport.ShowAll(); scrolledWindow.Add(viewport); Gtk.Viewport viewportLabel = new Gtk.Viewport(); viewportLabel.ShadowType = ((Gtk.ShadowType)(0)); viewportLabel.WidthRequest = 80; viewportLabel.HeightRequest = 30; Gtk.Label label = new Gtk.Label(); label.Name = "label1"; label.LabelProp = global::Mono.Unix.Catalog.GetString(gameConfigDB.GetName()); label.ShowAll(); viewportLabel.Add(label); if (parentNotebook.NPages <= 0 || isInitializing) { parentNotebook.Add(scrolledWindow); parentNotebook.SetTabLabel(scrolledWindow, viewportLabel); } else { parentNotebook.InsertPage(scrolledWindow, viewportLabel, parentNotebook.NPages - 1); parentNotebook.Page = parentNotebook.NPages - 2; } UITabPage tabPage = new UITabPage(gameConfigDB, scrolledWindow, viewport, label, canvas); tabPage.InitDropEvent(); scrolledWindow.Data.Add("UITabPage", tabPage); return(tabPage); }
public override void Initialize(IPadWindow pad) { base.Initialize(pad); // Init editor outputEditor = new TextEditor(); outputEditor.Events = Gdk.EventMask.AllEventsMask; outputEditor.Name = "outputEditor"; outputEditor.TabsToSpaces = false; scrolledWindow = new Gtk.ScrolledWindow(); scrolledWindow.Child = outputEditor; scrolledWindow.ShadowType = Gtk.ShadowType.In; scrolledWindow.ShowAll(); outputEditor.ShowAll(); var o = outputEditor.Options; outputEditor.Document.MimeType = Formatting.DCodeFormatter.MimeType; o.ShowLineNumberMargin = false; o.ShowFoldMargin = false; o.ShowIconMargin = false; outputEditor.Document.ReadOnly = true; // Init toolbar var tb = pad.GetToolbar(Gtk.PositionType.Top); var ch = new Gtk.ToggleButton(); ch.Image = new Gtk.Image(Gtk.Stock.Refresh, Gtk.IconSize.Menu); ch.Active = EnableCaretTracking; ch.TooltipText = "Toggle automatic update after the caret has been moved."; ch.Toggled += (object s, EventArgs ea) => EnableCaretTracking = ch.Active; tb.Add(ch); abortButton = new Gtk.Button(); abortButton.Sensitive = false; abortButton.Image = new Gtk.Image(Gtk.Stock.Stop, Gtk.IconSize.Menu); abortButton.TooltipText = "Stops the evaluation."; abortButton.Clicked += (object sender, EventArgs e) => AbortExecution(); tb.Add(abortButton); tb.ShowAll(); Instance = this; }
public override void Initialize(IPadWindow pad) { base.Initialize(pad); // Init editor outputEditor = new TextEditor(); outputEditor.Events = Gdk.EventMask.AllEventsMask; outputEditor.Name = "outputEditor"; outputEditor.TabsToSpaces = false; scrolledWindow = new Gtk.ScrolledWindow(); scrolledWindow.Child = outputEditor; scrolledWindow.ShadowType = Gtk.ShadowType.In; scrolledWindow.ShowAll(); outputEditor.ShowAll(); var o = outputEditor.Options; outputEditor.Document.MimeType = Formatting.DCodeFormatter.MimeType; o.ShowLineNumberMargin = false; o.ShowFoldMargin = false; o.ShowIconMargin = false; outputEditor.Document.ReadOnly = true; // Init toolbar var tb = pad.GetToolbar(Gtk.PositionType.Top); var ch = new Gtk.ToggleButton(); ch.Image = new Gtk.Image(Gtk.Stock.Refresh, Gtk.IconSize.Menu); ch.Active = EnableCaretTracking; ch.TooltipText = "Toggle automatic update after the caret has been moved."; ch.Toggled += (object s, EventArgs ea) => EnableCaretTracking = ch.Active; tb.Add(ch); abortButton = new Gtk.Button(); abortButton.Sensitive = false; abortButton.Image = new Gtk.Image(Gtk.Stock.Stop, Gtk.IconSize.Menu); abortButton.TooltipText = "Stops the evaluation."; abortButton.Clicked += (object sender, EventArgs e) => AbortExecution(); tb.Add(abortButton); tb.ShowAll(); Instance = this; }
private static void RunModalDialog(string title, string format, params object [] args) { Gtk.Dialog dlg = new Gtk.Dialog ("Tomboy.InsertImage - " + Catalog.GetString(title), null, Gtk.DialogFlags.Modal | Gtk.DialogFlags.DestroyWithParent); var text = new Gtk.TextView (); text.WrapMode = Gtk.WrapMode.Word; text.Editable = false; if (args.Length > 0) format = string.Format (format, args); text.Buffer.Text = format; var scroll = new Gtk.ScrolledWindow (); scroll.Add (text); dlg.AddButton (Catalog.GetString("Close"), Gtk.ResponseType.Close); dlg.VBox.PackStart (scroll, true, true, 0); dlg.SetSizeRequest (300, 240); scroll.ShowAll (); dlg.Run (); dlg.Destroy (); }
public override Gtk.Widget GetVisualizerWidget (ObjectValue val) { Gdk.Pixbuf pixbuf; string file = Path.GetTempFileName (); try { RawValue pix = (RawValue) val.GetRawValue (); pix.CallMethod ("Save", file, "png"); pixbuf = new Gdk.Pixbuf (file); } finally { File.Delete (file); } Gtk.ScrolledWindow sc = new Gtk.ScrolledWindow (); sc.ShadowType = Gtk.ShadowType.In; sc.HscrollbarPolicy = Gtk.PolicyType.Automatic; sc.VscrollbarPolicy = Gtk.PolicyType.Automatic; Gtk.Image image = new Gtk.Image (pixbuf); sc.AddWithViewport (image); sc.ShowAll (); return sc; }
public Gtk.Widget GetVisualizerWidget(ObjectValue val) { Gdk.Pixbuf pixbuf; string file = Path.GetTempFileName(); try { RawValue pix = (RawValue)val.GetRawValue(); pix.CallMethod("Save", file, "png"); pixbuf = new Gdk.Pixbuf(file); } finally { File.Delete(file); } Gtk.ScrolledWindow sc = new Gtk.ScrolledWindow(); sc.ShadowType = Gtk.ShadowType.In; sc.HscrollbarPolicy = Gtk.PolicyType.Automatic; sc.VscrollbarPolicy = Gtk.PolicyType.Automatic; Gtk.Image image = new Gtk.Image(pixbuf); sc.AddWithViewport(image); sc.ShowAll(); return(sc); }
void IPlugin.Init(object context) { ISampleTool SampleTool = context as ISampleTool; DockFrame frame = SampleTool.GetMainWindow().DockFrame; Gtk.ScrolledWindow treeViewScrollWindow = new Gtk.ScrolledWindow(); Gtk.Viewport treeViewViewport = new Gtk.Viewport(); treeViewScrollWindow.Add(treeViewViewport); treeViewViewport.Add(treeView); treeViewScrollWindow.ShowAll(); Gtk.ScrolledWindow textEditorScrollWindow = new Gtk.ScrolledWindow(); Gtk.Viewport textEditorViewport = new Gtk.Viewport(); textEditorScrollWindow.Add(textEditorViewport); textEditorViewport.Add(nb); textEditorScrollWindow.ShowAll(); Gtk.TreeViewColumn col = new Gtk.TreeViewColumn(); Gtk.CellRendererText colAssemblyCell = new Gtk.CellRendererText(); col.PackStart(colAssemblyCell, true); col.AddAttribute(colAssemblyCell, "text", 0); if (treeView.GetColumn(0) != null) { treeView.Columns[0] = col; } else { treeView.AppendColumn(col); } treeView.Model = new Gtk.TreeStore(typeof(string)); treeView.Model = homeSubFolders(Environment.GetFolderPath(Environment.SpecialFolder.Personal)); treeView.RowActivated += HandleRowActivated; DockItem treeViewDock = frame.AddItem("TreeViewDock"); treeViewDock.Behavior = DockItemBehavior.Normal; treeViewDock.Expand = true; treeViewDock.DrawFrame = true; treeViewDock.Label = "Files"; treeViewDock.Content = treeViewScrollWindow; treeViewDock.DefaultVisible = true; treeViewDock.Visible = true; DockItem textEditorDock = frame.AddItem("TextEditorDock"); textEditorDock.Behavior = DockItemBehavior.Normal; textEditorDock.Expand = true; textEditorDock.DrawFrame = true; textEditorDock.Label = "Text Editor"; textEditorDock.Content = textEditorScrollWindow; textEditorDock.DefaultVisible = true; textEditorDock.Visible = true; Gtk.MenuBar mainMenuBar = SampleTool.GetMainMenu(); Gtk.MenuItem fileMenu = null; // Find the File menu if present foreach (Gtk.Widget w in mainMenuBar.Children) { if (w.Name == "FileAction") { fileMenu = w as Gtk.MenuItem; } } // If not present - create it if (fileMenu == null) { Gtk.Menu menu = new Gtk.Menu(); fileMenu = new Gtk.MenuItem("File"); fileMenu.Submenu = menu; mainMenuBar.Append(fileMenu); } // Setting up the Close menu item in File Gtk.MenuItem close = new Gtk.MenuItem("Close"); close.Activated += HandleActivated; (fileMenu.Submenu as Gtk.Menu).Prepend(close); // Setting up the Save menu item in File Gtk.MenuItem save = new Gtk.MenuItem("Save"); save.Activated += HandleSaveActivated; (fileMenu.Submenu as Gtk.Menu).Prepend(save); }
public override void Initialize(IPadWindow window) { base.Initialize(window); // Call ctors inputEditor = new TextEditor() { Name = "input", Events = Gdk.EventMask.AllEventsMask, HeightRequest = 80 }; editor = new TextEditor() { Name = "output", Events = Gdk.EventMask.AllEventsMask }; vpaned = new Gtk.VPaned(); var scr1 = new Gtk.ScrolledWindow(); var scr2 = new Gtk.ScrolledWindow(); // Init layout scr1.ShadowType = Gtk.ShadowType.In; scr1.Child = inputEditor; vpaned.Add1(scr1); scr1.ShowAll(); inputEditor.ShowAll(); scr2.ShadowType = Gtk.ShadowType.In; scr2.Child = editor; vpaned.Add2(scr2); scr2.ShowAll(); editor.ShowAll(); vpaned.ShowAll(); // Init editors var o = editor.Options; inputEditor.Options = o; o.ShowLineNumberMargin = false; o.ShowFoldMargin = false; o.ShowIconMargin = false; editor.Document.ReadOnly = true; inputEditor.Text = PropertyService.Get(lastInputStringPropId, string.Empty); editor.Text = string.Empty; editor.Document.SyntaxMode = new Highlighting.DSyntaxMode(); inputEditor.Document.SyntaxMode = new Highlighting.DSyntaxMode(); editor.Document.MimeType = Formatting.DCodeFormatter.MimeType; inputEditor.Document.MimeType = Formatting.DCodeFormatter.MimeType; // Init toolbar var tb = window.GetToolbar(Gtk.PositionType.Top); executeButton = new Gtk.Button(); executeButton.Image = new Gtk.Image(Gtk.Stock.Execute, Gtk.IconSize.Menu); executeButton.TooltipText = "Evaluates the expression typed in the upper input editor."; executeButton.Clicked += Execute; tb.Add(executeButton); abortButton = new Gtk.Button(); abortButton.Sensitive = false; abortButton.Image = new Gtk.Image(Gtk.Stock.Stop, Gtk.IconSize.Menu); abortButton.TooltipText = "Stops the evaluation."; abortButton.Clicked += (object sender, EventArgs e) => AbortExecution(); tb.Add(abortButton); tb.ShowAll(); }
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 CueSheetsView(CueSheetsSource ms) { MySource=ms; basedir=MySource.getCueSheetDir (); store = new CS_TrackListModel(); view = new CS_TrackListView(this); { ColumnController colc=view.ColumnController; int i,N; for(i=0,N=colc.Count;i<N;i++) { CS_Column col=(CS_Column) colc[i]; col.WidthChanged+=delegate(object sender,EventArgs args) { Hyena.Log.Information ("set-column-sizes="+_set_column_sizes); if (_set_column_sizes<=0) { _set_column_sizes=0; MySource.setColumnWidth (col.id(),MySource.getSheet ().id (),col.Width); } else { _set_column_sizes-=1; } }; } } view.SetModel(store); this.setColumnSizes(null); Hyena.Log.Information("New albumlist"); aview=new CS_AlbumListView(this); aaview=new CS_ArtistListView(); ccview=new CS_ComposerListView(); gview=new CS_GenreListView(); try { plsview=new CS_PlayListsView(this); } catch (System.Exception ex) { Hyena.Log.Error (ex.ToString ()); } Hyena.Log.Information("init models"); aview.SetModel (MySource.getAlbumModel ()); aaview.SetModel (MySource.getArtistModel ()); gview.SetModel (MySource.getGenreModel ()); ccview.SetModel (MySource.getComposerModel()); plsview.SetModel(MySource.getPlayListsModel()); plsadmin=new CS_PlayListAdmin(plsview,MySource.getPlayListsModel(),MySource.getPlayListCollection()); MySource.getGenreModel(); Hyena.Log.Information("model albumlist"); Hyena.Log.Information("albumlist initialized"); aview.RowActivated+=new Hyena.Data.Gui.RowActivatedHandler<AlbumInfo>(EvtRowActivated); aview.Selection.Changed += HandleAviewSelectionChanged; gview.RowActivated+=new Hyena.Data.Gui.RowActivatedHandler<CS_GenreInfo>(EvtGenreActivated); aaview.RowActivated+=new Hyena.Data.Gui.RowActivatedHandler<ArtistInfo>(EvtArtistActivated); ccview.RowActivated+=new Hyena.Data.Gui.RowActivatedHandler<CS_ComposerInfo>(EvtComposerActivated); plsview.RowActivated+=new Hyena.Data.Gui.RowActivatedHandler<CS_PlayList>(EvtPlayListActivated); view.RowActivated+=new RowActivatedHandler<CueSheetEntry>(EvtTrackRowActivated); bar=new Gtk.Toolbar(); if (basedir==null) { Hyena.Log.Information("basedir="+basedir); Gtk.Label lbl=new Gtk.Label(); lbl.Markup="<b>You need to configure the CueSheets music directory first, using the right mouse button on the extension</b>"; bar.Add (lbl); } filling=new Gtk.Label(); bar.Add (filling); ascroll=new Gtk.ScrolledWindow(); ascroll.Add (aview); aascroll=new Gtk.ScrolledWindow(); aascroll.Add (aaview); tscroll=new Gtk.ScrolledWindow(); tscroll.Add (view); gscroll=new Gtk.ScrolledWindow(); gscroll.Add (gview); ccscroll=new Gtk.ScrolledWindow(); ccscroll.Add(ccview); bool view_artist=true; Gtk.VBox vac=new Gtk.VBox(); Gtk.Button vab=new Gtk.Button("Artists"); vab.Clicked+=delegate(object sender,EventArgs args) { if (view_artist) { view_artist=false; vab.Label="Composers"; vac.Remove (aascroll); vac.PackEnd (ccscroll); ccscroll.ShowAll (); } else { view_artist=true; vab.Label="Artists"; vac.Remove (ccscroll); vac.PackEnd (aascroll); aascroll.ShowAll (); } }; vac.PackStart (vab,false,false,0); vac.PackEnd (aascroll); hb=new Gtk.HPaned(); hb.Add(gscroll); hb.Add (vac); hb1=new Gtk.HPaned(); hb1.Add (hb); hb1.Add (ascroll); vp=new Gtk.VPaned(); vp.Add (hb1); vp.Add (tscroll); Gtk.HPaned hppls=new Gtk.HPaned(); hppls.Add1 (vp); hppls.Add2 (plsadmin); hbpls=hppls; { int hb_pls,hb_p,hb1_p,vp_p; MySource.getPositions (out hb_pls,out hb_p,out hb1_p,out vp_p); hppls.Position=hb_pls; hb.Position=hb_p; hb1.Position=hb1_p; vp.Position=vp_p; } box = new Gtk.VBox(); box.PackStart (bar,false,true,0); box.PackStart (hppls); box.ShowAll(); GLib.Timeout.Add ((uint) 1000,(GLib.TimeoutHandler) GardDividers); GLib.Timeout.Add ((uint) timeout,(GLib.TimeoutHandler) PositionDisplay); fill (); }
Gtk.Widget IOutlinedDocument.GetOutlineWidget() { if (outlineTreeView != null) return outlineTreeView; outlineTreeStore = new Gtk.TreeStore (typeof(string), typeof (Gdk.Color), typeof (Mono.TextTemplating.ISegment)); outlineTreeView = new MonoDevelop.Ide.Gui.Components.PadTreeView (outlineTreeStore); outlineTreeView.Realized += delegate { RefillOutlineStore (); }; outlineTreeView.TextRenderer.Xpad = 0; outlineTreeView.TextRenderer.Ypad = 0; outlineTreeView.AppendColumn ("Node", outlineTreeView.TextRenderer, "text", 0, "foreground-gdk", 1); outlineTreeView.HeadersVisible = false; outlineTreeView.Selection.Changed += delegate { Gtk.TreeIter iter; if (!outlineTreeView.Selection.GetSelected (out iter)) return; SelectSegment ((Mono.TextTemplating.ISegment )outlineTreeStore.GetValue (iter, 2)); }; RefillOutlineStore (); Gtk.ScrolledWindow sw = new Gtk.ScrolledWindow (); sw.Add (outlineTreeView); sw.ShowAll (); return sw; }
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(); }
void IPlugin.Init(object context) { mainApp = context as ISolidIDE; mainWindow = mainApp.GetMainWindow(); DockFrame frame = mainWindow.DockFrame; // Tree View treeView = new Gtk.TreeView(); Gtk.TreeViewColumn col = new Gtk.TreeViewColumn(); Gtk.CellRendererText colAssemblyCell = new Gtk.CellRendererText(); col.PackStart(colAssemblyCell, true); col.AddAttribute(colAssemblyCell, "text", 0); if (treeView.GetColumn(0) != null) { treeView.Columns[0] = col; } else { treeView.AppendColumn(col); } treeView.Model = new Gtk.TreeStore(typeof(string)); treeView.Model = homeSubFolders(Environment.GetFolderPath(Environment.SpecialFolder.Personal)); treeView.RowActivated += HandleRowActivated; Gtk.ScrolledWindow treeViewScrollWindow = new Gtk.ScrolledWindow(); Gtk.Viewport treeViewViewport = new Gtk.Viewport(); treeViewScrollWindow.Add(treeViewViewport); treeViewViewport.Add(treeView); treeViewScrollWindow.ShowAll(); DockItem treeViewDock = frame.AddItem("TreeViewDock"); treeViewDock.Behavior = DockItemBehavior.Normal; treeViewDock.Expand = true; treeViewDock.DrawFrame = true; treeViewDock.Label = "Files"; treeViewDock.Content = treeViewScrollWindow; treeViewDock.DefaultVisible = true; treeViewDock.Visible = true; // Text Editor Notebook noteBook = new Gtk.Notebook(); Gtk.ScrolledWindow textEditorScrollWindow = new Gtk.ScrolledWindow(); Gtk.Viewport textEditorViewport = new Gtk.Viewport(); textEditorScrollWindow.Add(textEditorViewport); textEditorViewport.Add(noteBook); textEditorScrollWindow.ShowAll(); DockItem textEditorDock = frame.AddItem("TextEditorDock"); textEditorDock.Behavior = DockItemBehavior.Normal; textEditorDock.Expand = true; textEditorDock.DrawFrame = true; textEditorDock.Label = "Text Editor"; textEditorDock.Content = textEditorScrollWindow; textEditorDock.DefaultVisible = true; textEditorDock.Visible = true; // Menu var fileMenuItem = mainApp.GetMenuItem <Gtk.ImageMenuItem>("File"); var saveMenuItem = mainApp.GetMenuItem <Gtk.ImageMenuItem>("File", "Save"); saveMenuItem.Activated += HandleSaveActivated; var closeMenuItem = mainApp.GetMenuItem <Gtk.ImageMenuItem>("File", "Close"); closeMenuItem.Activated += HandleCloseActivated; var exitMenuItem = mainApp.GetMenuItem <Gtk.ImageMenuItem>("File", "Exit"); exitMenuItem.Activated += HandleExitActivated; /* * mainApp.GetMenuItem<Gtk.SeparatorMenuItem>("View", ""); * mainApp.GetMenuItem<Gtk.CheckMenuItem>("View", "CheckTest1"); * mainApp.GetMenuItem<Gtk.CheckMenuItem>("View", "CheckTest2"); * //mainApp.GetMenuItem<Gtk.RadioMenuItem>("View", "RadioTest1"); * //mainApp.GetMenuItem<Gtk.RadioMenuItem>("View", "RadioTest2"); * //mainApp.GetMenuItem<Gtk.RadioMenuItem>("View", "RadioTest3"); */ }
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(); }
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 CueSheetsView(CueSheetsSource ms) { MySource = ms; basedir = MySource.getCueSheetDir(); store = new CS_TrackListModel(); view = new CS_TrackListView(this); { ColumnController colc = view.ColumnController; int i, N; for (i = 0, N = colc.Count; i < N; i++) { CS_Column col = (CS_Column)colc[i]; col.WidthChanged += delegate(object sender, EventArgs args) { Hyena.Log.Information("set-column-sizes=" + _set_column_sizes); if (_set_column_sizes <= 0) { _set_column_sizes = 0; MySource.setColumnWidth(col.id(), MySource.getSheet().id(), col.Width); } else { _set_column_sizes -= 1; } }; } } view.SetModel(store); this.setColumnSizes(null); Hyena.Log.Information("New albumlist"); aview = new CS_AlbumListView(this); aaview = new CS_ArtistListView(); ccview = new CS_ComposerListView(); gview = new CS_GenreListView(); try { plsview = new CS_PlayListsView(this); } catch (System.Exception ex) { Hyena.Log.Error(ex.ToString()); } Hyena.Log.Information("init models"); aview.SetModel(MySource.getAlbumModel()); aaview.SetModel(MySource.getArtistModel()); gview.SetModel(MySource.getGenreModel()); ccview.SetModel(MySource.getComposerModel()); plsview.SetModel(MySource.getPlayListsModel()); plsadmin = new CS_PlayListAdmin(plsview, MySource.getPlayListsModel(), MySource.getPlayListCollection()); MySource.getGenreModel(); Hyena.Log.Information("model albumlist"); Hyena.Log.Information("albumlist initialized"); aview.RowActivated += new Hyena.Data.Gui.RowActivatedHandler <AlbumInfo>(EvtRowActivated); aview.Selection.Changed += HandleAviewSelectionChanged; gview.RowActivated += new Hyena.Data.Gui.RowActivatedHandler <CS_GenreInfo>(EvtGenreActivated); aaview.RowActivated += new Hyena.Data.Gui.RowActivatedHandler <ArtistInfo>(EvtArtistActivated); ccview.RowActivated += new Hyena.Data.Gui.RowActivatedHandler <CS_ComposerInfo>(EvtComposerActivated); plsview.RowActivated += new Hyena.Data.Gui.RowActivatedHandler <CS_PlayList>(EvtPlayListActivated); view.RowActivated += new RowActivatedHandler <CueSheetEntry>(EvtTrackRowActivated); bar = new Gtk.Toolbar(); if (basedir == null) { Hyena.Log.Information("basedir=" + basedir); Gtk.Label lbl = new Gtk.Label(); lbl.Markup = "<b>You need to configure the CueSheets music directory first, using the right mouse button on the extension</b>"; bar.Add(lbl); } filling = new Gtk.Label(); bar.Add(filling); ascroll = new Gtk.ScrolledWindow(); ascroll.Add(aview); aascroll = new Gtk.ScrolledWindow(); aascroll.Add(aaview); tscroll = new Gtk.ScrolledWindow(); tscroll.Add(view); gscroll = new Gtk.ScrolledWindow(); gscroll.Add(gview); ccscroll = new Gtk.ScrolledWindow(); ccscroll.Add(ccview); bool view_artist = true; Gtk.VBox vac = new Gtk.VBox(); Gtk.Button vab = new Gtk.Button("Artists"); vab.Clicked += delegate(object sender, EventArgs args) { if (view_artist) { view_artist = false; vab.Label = "Composers"; vac.Remove(aascroll); vac.PackEnd(ccscroll); ccscroll.ShowAll(); } else { view_artist = true; vab.Label = "Artists"; vac.Remove(ccscroll); vac.PackEnd(aascroll); aascroll.ShowAll(); } }; vac.PackStart(vab, false, false, 0); vac.PackEnd(aascroll); hb = new Gtk.HPaned(); hb.Add(gscroll); hb.Add(vac); hb1 = new Gtk.HPaned(); hb1.Add(hb); hb1.Add(ascroll); vp = new Gtk.VPaned(); vp.Add(hb1); vp.Add(tscroll); Gtk.HPaned hppls = new Gtk.HPaned(); hppls.Add1(vp); hppls.Add2(plsadmin); hbpls = hppls; { int hb_pls, hb_p, hb1_p, vp_p; MySource.getPositions(out hb_pls, out hb_p, out hb1_p, out vp_p); hppls.Position = hb_pls; hb.Position = hb_p; hb1.Position = hb1_p; vp.Position = vp_p; } box = new Gtk.VBox(); box.PackStart(bar, false, true, 0); box.PackStart(hppls); box.ShowAll(); GLib.Timeout.Add((uint)1000, (GLib.TimeoutHandler)GardDividers); GLib.Timeout.Add((uint)timeout, (GLib.TimeoutHandler)PositionDisplay); fill(); }
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(); }