static public void Read(ObjectWrapper wrapper, XmlElement elem) { string className = elem.GetAttribute("class"); if (className == null) { throw new GladeException("<widget> node with no class name"); } ClassDescriptor klass = Registry.LookupClassByName(className); if (klass == null) { throw new GladeException("No stetic ClassDescriptor for " + className); } Gtk.Widget widget = (Gtk.Widget)wrapper.Wrapped; if (widget == null) { widget = (Gtk.Widget)klass.CreateInstance(wrapper.Project); ObjectWrapper.Bind(wrapper.Project, klass, wrapper, widget, true); } widget.Name = elem.GetAttribute("id"); ReadMembers(klass, wrapper, widget, elem); if (!(widget is Gtk.Window)) { widget.ShowAll(); } }
protected override void Initialize(IPadWindow container) { base.Initialize(container); #if MAC toolbox = new Toolbox.MacToolbox(DesignerSupport.Service.ToolboxService, container); widget = GtkMacInterop.NSViewToGtkWidget(toolbox); widget.CanFocus = true; widget.Sensitive = true; widget.KeyPressEvent += toolbox.OnKeyPressed; widget.KeyReleaseEvent += toolbox.KeyReleased; widget.DragBegin += (o, args) => { if (!isDragging) { DesignerSupport.Service.ToolboxService.DragSelectedItem(widget, args.Context); isDragging = true; } }; widget.DragEnd += (o, args) => { isDragging = false; }; widget.Focused += (s, e) => { toolbox.FocusSelectedView(); }; toolbox.ContentFocused += (s, e) => { if (!widget.HasFocus) { widget.HasFocus = true; toolbox.FocusSelectedView(); } }; toolbox.DragSourceSet += (s, e) => { targets = new Gtk.TargetList(); targets.AddTable(e); }; toolbox.DragBegin += (object sender, EventArgs e) => { if (!isDragging) { Gtk.Drag.SourceUnset(widget); // Gtk.Application.CurrentEvent and other copied gdk_events seem to have a problem // when used as they use gdk_event_copy which seems to crash on de-allocating the private slice. IntPtr currentEvent = GtkWorkarounds.GetCurrentEventHandle(); Gtk.Drag.Begin(widget, targets, Gdk.DragAction.Copy | Gdk.DragAction.Move, 1, new Gdk.Event(currentEvent)); // gtk_drag_begin does not store the event, so we're okay GtkWorkarounds.FreeEvent(currentEvent); } }; widget.ShowAll(); #else widget = new Toolbox.Toolbox(DesignerSupport.Service.ToolboxService, container); #endif }
void ShowDocumentation(object ob) { if (docView != null) { paned.Remove(docView); docView.Destroy(); docView = null; } ITreeNavigator nav = tree.GetSelectedNode(); RegistryInfo regInfo = (RegistryInfo)nav.GetParentDataItem(typeof(RegistryInfo), true); AddinRegistry reg = regInfo.CachedRegistry; if (ob is AddinDescription) { AddinView view = new AddinView(); view.Fill((AddinDescription)ob); docView = view; } else if (ob is ExtensionPoint) { ExtensionPointView view = new ExtensionPointView(); view.Fill((ExtensionPoint)ob, reg); docView = view; } else if (ob is Extension) { ExtensionView view = new ExtensionView(); view.Fill((Extension)ob, nav); docView = view; } else if (ob is ExtensionNodeInfo) { ExtensionNodeView view = new ExtensionNodeView(); view.Fill(((ExtensionNodeInfo)ob).Node); docView = view; } if (docView == null) { docView = new Gtk.Label(); } docView.ShowAll(); paned.Add2(docView); }
protected void AddCustomWidget(Gtk.Widget w) { w.ShowAll(); book.AppendPage(w, null); book.Page = book.NPages - 1; if (initialized) { Gtk.Widget cw = book.GetNthPage(0); book.RemovePage(0); cw.Destroy(); } else { initialized = true; } }
public MGPad() { try { _application = new Application(Platforms.Gtk2); _application.Attach(); } catch { // Ok, Eto Forms extension already loaded a backend } DrawInfo.TextFont = new Font(".AppleSystemUIFont", 12); DrawInfo.TextHeight = (int)DrawInfo.TextFont.LineHeight; if (IdeApp.Preferences.UserInterfaceTheme == Theme.Dark) { DrawInfo.TextColor = new Color(0.843f, 0.843f, 0.843f); DrawInfo.BackColor = new Color(0.251f, 0.251f, 0.251f); DrawInfo.HoverTextColor = new Color(1f, 1f, 1f); DrawInfo.HoverBackColor = new Color(0.129f, 0.341f, 0.800f); DrawInfo.BorderColor = new Color(0.322f, 0.322f, 0.322f); } else { DrawInfo.TextColor = new Color(0.153f, 0.153f, 0.153f); DrawInfo.BackColor = new Color(1f, 1f, 1f); DrawInfo.HoverTextColor = new Color(1f, 1f, 1f); DrawInfo.HoverBackColor = new Color(0.129f, 0.341f, 0.800f); DrawInfo.BorderColor = new Color(0.871f, 0.871f, 0.871f); } DrawInfo.DisabledTextColor = DrawInfo.TextColor; DrawInfo.DisabledTextColor.A = 0.6f; _window = new MainWindow(); PipelineController.Create(_window); _control = _window.ToNative(true); _control.ShowAll(); }
public FigmaViewContent(FilePath fileName) { FigmaEnvirontment.SetAccessToken(FigmaRuntime.Token); this.fileName = fileName; ContentName = fileName; container = new NSStackView(); container.Spacing = 10; container.WantsLayer = true; container.Layer.BackgroundColor = NSColor.DarkGray.CGColor; container.Distribution = NSStackViewDistribution.Fill; container.Orientation = NSUserInterfaceLayoutOrientation.Vertical; _content = GtkMacInterop.NSViewToGtkWidget(container); _content.CanFocus = true; _content.Sensitive = true; var scrollView = new NSScrollView() { HasVerticalScroller = true, HasHorizontalScroller = true, }; scrollView.AutohidesScrollers = false; scrollView.BackgroundColor = NSColor.DarkGray; scrollView.ScrollerStyle = NSScrollerStyle.Legacy; renderer = new NSView(); scrollView.DocumentView = renderer; renderer.AutoresizingMask = NSViewResizingMask.WidthSizable | NSViewResizingMask.HeightSizable; container.AddArrangedSubview(scrollView); //IdeApp.Workbench.ActiveDocument.Editor.TextChanged += Editor_TextChanged; _content.ShowAll(); }
public SearchSource() : base(name, name, 190, "internet-archive-search") { IA.Search.UserAgent = Banshee.Web.Browser.UserAgent; IA.Search.TimeoutMs = 12 * 1000; search = new IA.Search() { NumResults = 100 }; Properties.SetStringList("Icon.Name", "search", "gtk-search"); Properties.SetString("ActiveSourceUIResource", "SearchSourceActiveUI.xml"); Properties.SetString("GtkActionPath", "/IaSearchSourcePopup"); if (header_widget == null) { header_widget = new HeaderFilters(this); header_widget.ShowAll(); Properties.Set <Gtk.Widget> ("Nereid.SourceContents.HeaderWidget", header_widget); } Properties.Set <Banshee.Sources.Gui.ISourceContents> ("Nereid.SourceContents", new Banshee.Sources.Gui.LazyLoadSourceContents <SearchView> (this)); }
public SearchSource() : base(name, name, 190, "internet-archive-search") { IA.Search.UserAgent = Banshee.Web.Browser.UserAgent; IA.Search.TimeoutMs = 12*1000; search = new IA.Search () { NumResults = 100 }; Properties.SetStringList ("Icon.Name", "search", "gtk-search"); Properties.SetString ("ActiveSourceUIResource", "SearchSourceActiveUI.xml"); Properties.SetString ("GtkActionPath", "/IaSearchSourcePopup"); if (header_widget == null) { header_widget = new HeaderFilters (this); header_widget.ShowAll (); Properties.Set<Gtk.Widget> ("Nereid.SourceContents.HeaderWidget", header_widget); } Properties.Set<Banshee.Sources.Gui.ISourceContents> ("Nereid.SourceContents", new Banshee.Sources.Gui.LazyLoadSourceContents<SearchView> (this)); }
protected override void Initialize(IPadWindow window) { this.window = window; dragPad = new FigmaDragAndDropContent(); window.PadContentHidden += Container_PadHidden; window.PadContentShown += Container_PadShown; widget = GtkMacInterop.NSViewToGtkWidget(dragPad); widget.CanFocus = true; widget.Sensitive = true; widget.DragBegin += (o, args) => { //if (!isDragging) //{ // var processedNode = dragPad.GetProcessedNode(dragPad.SelectedNode); // selected = new TemplateToolboxNode(new Ide.CodeTemplates.CodeTemplate() { Code = processedNode.Code }); // CurrentConsumer.DragItem(selected, widget, args.Context); // //DesignerSupport.Service.ToolboxService.DragSelectedItem(widget, args.Context); // isDragging = true; //} }; widget.DragEnd += (o, args) => { isDragging = false; }; widget.Focused += (s, e) => { // toolbox }; dragPad.SelectCode += (sender, e) => { if (!string.IsNullOrEmpty(e)) { try { var editor = IdeApp.Workbench.ActiveDocument.GetContent <ITextView>(); var position = editor.Caret.Position.BufferPosition.Position; editor.TextBuffer.Insert(position, e); } catch (Exception ex) { Console.WriteLine(ex); } } }; dragPad.DragSourceSet += (s, e) => { targets = new Gtk.TargetList(); targets.AddTable(e); }; dragPad.DragBegin += (object sender, EventArgs e) => { if (!isDragging) { Gtk.Drag.SourceUnset(widget); // Gtk.Application.CurrentEvent and other copied gdk_events seem to have a problem // when used as they use gdk_event_copy which seems to crash on de-allocating the private slice. IntPtr currentEvent = Components.GtkWorkarounds.GetCurrentEventHandle(); Gtk.Drag.Begin(widget, targets, Gdk.DragAction.Copy | Gdk.DragAction.Move, 1, new Gdk.Event(currentEvent)); // gtk_drag_begin does not store the event, so we're okay //Components.GtkWorkarounds.FreeEvent(currentEvent); } }; widget.ShowAll(); if (IdeApp.Workbench != null) { //IdeApp.Workbench.ActiveDocumentChanged += Workbench_ActiveDocumentChanged; IdeApp.Workbench.ActiveDocumentChanged += onActiveDocChanged; // += new EventHandler(onActiveDocChanged); onActiveDocChanged(null, null); } }
public SourceEditor(string filePath) { if(MainClass.Settings.SourceEditorSettings == null){ MainClass.Settings.SourceEditorSettings = new Moscrif.IDE.Option.Settings.SourceEditorSetting(); } errors = new List<ErrorMarker>(); lastPrecompile = DateTime.Now; control = new Gtk.ScrolledWindow(); (control as Gtk.ScrolledWindow).ShadowType = Gtk.ShadowType.Out; editorAction = new Gtk.ActionGroup("sourceeditor"); searchPattern = null; editor = new TextEdit(); LoadSetting(); SyntaxMode mode = new SyntaxMode(); string extension = System.IO.Path.GetExtension(filePath); //editor.AccelCanActivate switch (extension) { case ".ms": { try{ mode = SyntaxModeService.GetSyntaxMode("text/moscrif"); }catch(Exception ex){ MessageDialogs msd = new MessageDialogs(MessageDialogs.DialogButtonType.Ok, MainClass.Languages.Translate("error_load_syntax"), MainClass.Languages.Translate("error_load_syntax_f1"), Gtk.MessageType.Error,null); msd.ShowDialog(); Tool.Logger.Error(ex.Message); } isCompileExtension = true; (editor as ICompletionWidget).BanCompletion = false; break; } case ".js": { try{ mode = SyntaxModeService.GetSyntaxMode("text/x-java"); }catch(Exception ex){ MessageDialogs msd = new MessageDialogs(MessageDialogs.DialogButtonType.Ok, MainClass.Languages.Translate("error_load_syntax"), MainClass.Languages.Translate("error_load_syntax_f1"), Gtk.MessageType.Error,null); msd.ShowDialog(); Tool.Logger.Error(ex.Message); } isCompileExtension = true; (editor as ICompletionWidget).BanCompletion = false; break; } case ".mso": { try{ mode = SyntaxModeService.GetSyntaxMode("text/moscrif"); }catch(Exception ex){ MessageDialogs msd = new MessageDialogs(MessageDialogs.DialogButtonType.Ok, MainClass.Languages.Translate("error_load_syntax"), MainClass.Languages.Translate("error_load_syntax_f1"), Gtk.MessageType.Error,null); msd.ShowDialog(); Tool.Logger.Error(ex.Message); } isCompileExtension = true; break; } case ".xml": { mode = SyntaxModeService.GetSyntaxMode("application/xml"); break; } case ".txt": case ".app": break; default: break; } //editor.Document. editor.Document.SyntaxMode = mode; //modified = true; editor.Document.LineChanged += delegate(object sender, LineEventArgs e) { OnBookmarkUpdate(); OnModifiedChanged(true); }; editor.Caret.PositionChanged+= delegate(object sender, DocumentLocationEventArgs e) { OnWriteToStatusbar(String.Format(statusFormat,editor.Caret.Location.Line+1,editor.Caret.Location.Column,editor.Caret.Offset)); }; FileAttributes fa = File.GetAttributes(filePath); if ((fa & FileAttributes.ReadOnly) == FileAttributes.ReadOnly) { onlyRead = true; //editor.Document.ReadOnly= true; } try { using (StreamReader file = new StreamReader(filePath)) { editor.Document.Text = file.ReadToEnd(); file.Close(); file.Dispose(); } } catch (Exception ex) { MessageDialogs ms = new MessageDialogs(MessageDialogs.DialogButtonType.Ok, MainClass.Languages.Translate("file_cannot_open", filePath), ex.Message, Gtk.MessageType.Error,null); ms.ShowDialog(); return; } //Console.WriteLine(editor.Document.Text.Replace("\r","^").Replace("\n","$")); (control as Gtk.ScrolledWindow).Add(editor); control.ShowAll(); fileName = filePath; fileSeting = MainClass.Workspace.WorkspaceUserSetting.FilesSetting.Find(x=> x.FileName == fileName); if(fileSeting == null) fileSeting = new FileSetting( fileName ); editor.TextViewMargin.ButtonPressed += OnTextMarginButtonPress; editor.IconMargin.ButtonPressed += OnIconMarginButtonPress; //editor.KeyPressEvent += OnKeyPressEvent; editor.KeyReleaseEvent += OnKeyReleaseEvent; editor.ButtonPressEvent += OnButtonPressEvent; bookmarkActions = new IdeBookmarkActions(editor,fileSeting); breakpointActions = new IdeBreakpointActions(editor); autoCompleteActions = new IdeAutocompleteAction(editor, editor); editAction = new IdeEditAction(editor); Gtk.Action act = new Gtk.Action("sourceeditor_togglebookmark", ""); act.Activated += bookmarkActions.ToggleBookmark; editorAction.Add(act); Gtk.Action act2 = new Gtk.Action("sourceeditor_clearbookmark", ""); act2.Activated += bookmarkActions.ClearBookmarks; editorAction.Add(act2); Gtk.Action act3 = new Gtk.Action("sourceeditor_nextbookmark", ""); act3.Activated += bookmarkActions.NextBookmark; editorAction.Add(act3); Gtk.Action act4 = new Gtk.Action("sourceeditor_prevbookmark", ""); act4.Activated += bookmarkActions.PreviousBookmark; editorAction.Add(act4); Gtk.Action act5 = new Gtk.Action("sourceeditor_addbreakpoint", ""); act5.Activated += breakpointActions.AddBreakpoints; editorAction.Add(act5); Gtk.Action act6 = new Gtk.Action("sourceeditor_inserttemplate", ""); act6.Activated += autoCompleteActions.InsertTemplate; editorAction.Add(act6); Gtk.Action act7 = new Gtk.Action("sourceeditor_insertautocomplete", ""); act7.Activated += autoCompleteActions.InsertCompletion; editorAction.Add(act7); Gtk.Action act8 = new Gtk.Action("sourceeditor_pasteClipboard", ""); act8.Activated += editAction.PasteText; editorAction.Add(act8); Gtk.Action act9 = new Gtk.Action("sourceeditor_copyClipboard", ""); act9.Activated += editAction.CopyText; editorAction.Add(act9); Gtk.Action act10 = new Gtk.Action("sourceeditor_cutClipboard", ""); act10.Activated += editAction.CutText; editorAction.Add(act10); Gtk.Action act11 = new Gtk.Action("sourceeditor_gotoDefinition", ""); act11.Activated += editAction.GoToDefinition; editorAction.Add(act11); Gtk.Action act12 = new Gtk.Action("sourceeditor_commentUncomment", ""); act12.Activated += editAction.CommentUncomment; editorAction.Add(act12); List<FoldSegment> list = editor.GetFolding(); foreach(SettingValue sv in fileSeting.Folding){ FoldSegment foldS = list.Find(x=>x.Offset.ToString() == sv.Display); if(foldS != null){ bool isfolding = false; if( Boolean.TryParse(sv.Value, out isfolding)) foldS.IsFolded = isfolding; } } this.editor.Document.UpdateFoldSegments(list,true); //foreach (int bm in fileSeting.Bookmarks){ foreach (MyBookmark bm in fileSeting.Bookmarks2){ LineSegment ls = this.editor.Document.GetLine(bm.Line); if(ls != null) ls.IsBookmarked = true; //this.editor.Document.Lines[bm].IsBookmarked = true; } }
public SourceEditor(string filePath) { if (MainClass.Settings.SourceEditorSettings == null) { MainClass.Settings.SourceEditorSettings = new Moscrif.IDE.Option.Settings.SourceEditorSetting(); } errors = new List <ErrorMarker>(); lastPrecompile = DateTime.Now; control = new Gtk.ScrolledWindow(); (control as Gtk.ScrolledWindow).ShadowType = Gtk.ShadowType.Out; editorAction = new Gtk.ActionGroup("sourceeditor"); searchPattern = null; editor = new TextEdit(); LoadSetting(); SyntaxMode mode = new SyntaxMode(); string extension = System.IO.Path.GetExtension(filePath); //editor.AccelCanActivate switch (extension) { case ".ms": { try{ mode = SyntaxModeService.GetSyntaxMode("text/moscrif"); }catch (Exception ex) { MessageDialogs msd = new MessageDialogs(MessageDialogs.DialogButtonType.Ok, MainClass.Languages.Translate("error_load_syntax"), MainClass.Languages.Translate("error_load_syntax_f1"), Gtk.MessageType.Error, null); msd.ShowDialog(); Tool.Logger.Error(ex.Message); } isCompileExtension = true; (editor as ICompletionWidget).BanCompletion = false; break; } case ".js": { try{ mode = SyntaxModeService.GetSyntaxMode("text/x-java"); }catch (Exception ex) { MessageDialogs msd = new MessageDialogs(MessageDialogs.DialogButtonType.Ok, MainClass.Languages.Translate("error_load_syntax"), MainClass.Languages.Translate("error_load_syntax_f1"), Gtk.MessageType.Error, null); msd.ShowDialog(); Tool.Logger.Error(ex.Message); } isCompileExtension = true; (editor as ICompletionWidget).BanCompletion = false; break; } case ".mso": { try{ mode = SyntaxModeService.GetSyntaxMode("text/moscrif"); }catch (Exception ex) { MessageDialogs msd = new MessageDialogs(MessageDialogs.DialogButtonType.Ok, MainClass.Languages.Translate("error_load_syntax"), MainClass.Languages.Translate("error_load_syntax_f1"), Gtk.MessageType.Error, null); msd.ShowDialog(); Tool.Logger.Error(ex.Message); } isCompileExtension = true; break; } case ".xml": { mode = SyntaxModeService.GetSyntaxMode("application/xml"); break; } case ".txt": case ".app": break; default: break; } //editor.Document. editor.Document.SyntaxMode = mode; //modified = true; editor.Document.LineChanged += delegate(object sender, LineEventArgs e) { OnBookmarkUpdate(); OnModifiedChanged(true); }; editor.Caret.PositionChanged += delegate(object sender, DocumentLocationEventArgs e) { OnWriteToStatusbar(String.Format(statusFormat, editor.Caret.Location.Line + 1, editor.Caret.Location.Column, editor.Caret.Offset)); }; FileAttributes fa = File.GetAttributes(filePath); if ((fa & FileAttributes.ReadOnly) == FileAttributes.ReadOnly) { onlyRead = true; //editor.Document.ReadOnly= true; } try { using (StreamReader file = new StreamReader(filePath)) { editor.Document.Text = file.ReadToEnd(); file.Close(); file.Dispose(); } } catch (Exception ex) { MessageDialogs ms = new MessageDialogs(MessageDialogs.DialogButtonType.Ok, MainClass.Languages.Translate("file_cannot_open", filePath), ex.Message, Gtk.MessageType.Error, null); ms.ShowDialog(); return; } //Console.WriteLine(editor.Document.Text.Replace("\r","^").Replace("\n","$")); (control as Gtk.ScrolledWindow).Add(editor); control.ShowAll(); fileName = filePath; fileSeting = MainClass.Workspace.WorkspaceUserSetting.FilesSetting.Find(x => x.FileName == fileName); if (fileSeting == null) { fileSeting = new FileSetting(fileName); } editor.TextViewMargin.ButtonPressed += OnTextMarginButtonPress; editor.IconMargin.ButtonPressed += OnIconMarginButtonPress; //editor.KeyPressEvent += OnKeyPressEvent; editor.KeyReleaseEvent += OnKeyReleaseEvent; editor.ButtonPressEvent += OnButtonPressEvent; bookmarkActions = new IdeBookmarkActions(editor, fileSeting); breakpointActions = new IdeBreakpointActions(editor); autoCompleteActions = new IdeAutocompleteAction(editor, editor); editAction = new IdeEditAction(editor); Gtk.Action act = new Gtk.Action("sourceeditor_togglebookmark", ""); act.Activated += bookmarkActions.ToggleBookmark; editorAction.Add(act); Gtk.Action act2 = new Gtk.Action("sourceeditor_clearbookmark", ""); act2.Activated += bookmarkActions.ClearBookmarks; editorAction.Add(act2); Gtk.Action act3 = new Gtk.Action("sourceeditor_nextbookmark", ""); act3.Activated += bookmarkActions.NextBookmark; editorAction.Add(act3); Gtk.Action act4 = new Gtk.Action("sourceeditor_prevbookmark", ""); act4.Activated += bookmarkActions.PreviousBookmark; editorAction.Add(act4); Gtk.Action act5 = new Gtk.Action("sourceeditor_addbreakpoint", ""); act5.Activated += breakpointActions.AddBreakpoints; editorAction.Add(act5); Gtk.Action act6 = new Gtk.Action("sourceeditor_inserttemplate", ""); act6.Activated += autoCompleteActions.InsertTemplate; editorAction.Add(act6); Gtk.Action act7 = new Gtk.Action("sourceeditor_insertautocomplete", ""); act7.Activated += autoCompleteActions.InsertCompletion; editorAction.Add(act7); Gtk.Action act8 = new Gtk.Action("sourceeditor_pasteClipboard", ""); act8.Activated += editAction.PasteText; editorAction.Add(act8); Gtk.Action act9 = new Gtk.Action("sourceeditor_copyClipboard", ""); act9.Activated += editAction.CopyText; editorAction.Add(act9); Gtk.Action act10 = new Gtk.Action("sourceeditor_cutClipboard", ""); act10.Activated += editAction.CutText; editorAction.Add(act10); Gtk.Action act11 = new Gtk.Action("sourceeditor_gotoDefinition", ""); act11.Activated += editAction.GoToDefinition; editorAction.Add(act11); Gtk.Action act12 = new Gtk.Action("sourceeditor_commentUncomment", ""); act12.Activated += editAction.CommentUncomment; editorAction.Add(act12); List <FoldSegment> list = editor.GetFolding(); foreach (SettingValue sv in fileSeting.Folding) { FoldSegment foldS = list.Find(x => x.Offset.ToString() == sv.Display); if (foldS != null) { bool isfolding = false; if (Boolean.TryParse(sv.Value, out isfolding)) { foldS.IsFolded = isfolding; } } } this.editor.Document.UpdateFoldSegments(list, true); //foreach (int bm in fileSeting.Bookmarks){ foreach (MyBookmark bm in fileSeting.Bookmarks2) { LineSegment ls = this.editor.Document.GetLine(bm.Line); if (ls != null) { ls.IsBookmarked = true; } //this.editor.Document.Lines[bm].IsBookmarked = true; } }