public EditTemplateDialog(CodeTemplate template, bool isNew) { this.Build(); this.Title = isNew ? GettextCatalog.GetString("New template") : GettextCatalog.GetString("Edit template"); this.template = template; this.entryShortcut1.Text = template.Shortcut ?? ""; this.comboboxentryGroups.Entry.Text = template.Group ?? ""; this.comboboxentryMime.Entry.Text = template.MimeType ?? ""; this.entryDescription.Text = template.Description ?? ""; this.textEditor.Document.MimeType = template.MimeType; this.textEditor.Document.Text = template.Code; checkbuttonExpansion.Active = (template.CodeTemplateType & CodeTemplateType.Expansion) == CodeTemplateType.Expansion; checkbuttonSurroundWith.Active = (template.CodeTemplateType & CodeTemplateType.SurroundsWith) == CodeTemplateType.SurroundsWith; scrolledwindow1.Child = textEditor; textEditor.ShowAll(); textEditor.Caret.PositionChanged += CaretPositionChanged; options = new Mono.TextEditor.TextEditorOptions(); options.ShowLineNumberMargin = false; options.ShowFoldMargin = false; options.ShowIconMargin = false; options.ShowInvalidLines = false; options.ShowSpaces = options.ShowTabs = options.ShowEolMarkers = false; options.ColorScheme = PropertyService.Get("ColorScheme", "Default"); textEditor.Options = options; HashSet <string> mimeTypes = new HashSet <string> (); HashSet <string> groups = new HashSet <string> (); foreach (CodeTemplate ct in CodeTemplateService.Templates) { mimeTypes.Add(ct.MimeType); groups.Add(ct.Group); } comboboxentryMime.AppendText(""); foreach (string mime in mimeTypes) { comboboxentryMime.AppendText(mime); } comboboxentryGroups.AppendText(""); foreach (string group in groups) { comboboxentryGroups.AppendText(group); } textEditor.Document.TextReplaced += DocumentTextReplaced; this.buttonOk.Clicked += ButtonOkClicked; checkbuttonWhiteSpaces.Toggled += CheckbuttonWhiteSpacesToggled; variablesListStore = new ListStore(typeof(string), typeof(CodeTemplateVariable)); comboboxVariables.Model = variablesListStore; comboboxVariables.Changed += ComboboxVariablesChanged; variableStore = new TreeStore(typeof(string), typeof(CodeTemplateVariable), typeof(string), typeof(int)); treeviewVariable.Model = variableStore; treeviewVariable.HeadersVisible = false; treeviewVariable.AppendColumn("", new Gtk.CellRendererText(), "text", 0); CellRendererText nameRenderer = new CellRendererText(); treeviewVariable.AppendColumn("", nameRenderer, delegate(TreeViewColumn col, CellRenderer cell, TreeModel model, TreeIter iter) { nameRenderer.Markup = ((string)model.GetValue(iter, 2)); }); grid = new MonoDevelop.Components.PropertyGrid.PropertyGrid(); grid.PropertySort = MonoDevelop.Components.PropertyGrid.PropertySort.Alphabetical; grid.ShowHelp = true; grid.ShowAll(); grid.ShowToolbar = false; vbox4.Remove(scrolledwindow2); vbox4.PackEnd(grid, true, true, 0); UpdateVariables(); }
void Build () { Spacing = 6; listView = new TreeView { CanFocus = true, HeadersVisible = false }; scrolledWindow = new ScrolledWindow { ShadowType = ShadowType.In, Child = listView }; buttonAdd = new Button (Stock.Add); buttonRemove = new Button (Stock.Remove); labelScopes = new Label { Xalign = 0F, Text = GettextCatalog.GetString ("Enter one or several xpath expressions to which this format applies:") }; tableScopes = new Table (3, 3, false) { RowSpacing = 6, ColumnSpacing = 6 }; propertyGrid = new MonoDevelop.Components.PropertyGrid.PropertyGrid { ShowToolbar = false, ShowHelp = false }; buttonAdvanced = new Button { Label = GettextCatalog.GetString ("Advanced Settings"), CanFocus = true, UseUnderline = true }; var buttonBox = new HBox (false, 6); buttonBox.PackStart (buttonAdd, false, false, 0); buttonBox.PackStart (buttonRemove, false, false, 0); boxScopes = new VBox (false, 6); boxScopes.PackStart (scrolledWindow, true, true, 0); boxScopes.PackStart (buttonBox, false, false, 0); var rightVBox = new VBox (false, 6); rightVBox.PackStart (labelScopes, false, false, 0); rightVBox.PackStart (tableScopes, false, false, 0); rightVBox.PackStart (propertyGrid, true, true, 0); var mainBox = new HBox (false, 6); mainBox.PackStart (boxScopes, false, false, 0); mainBox.PackStart (rightVBox, true, true, 0); var abbBox = new HBox (false, 6); abbBox.PackStart (buttonAdvanced, false, false, 0); PackStart (mainBox, true, true, 0); PackStart (abbBox, false, false, 0); ShowAll (); buttonAdd.Clicked += OnButtonAddClicked; buttonRemove.Clicked += OnButtonRemoveClicked; buttonAdvanced.Clicked += OnButtonAdvancedClicked; }
public EditTemplateDialog (CodeTemplate template, bool isNew) { this.Build(); this.Title = isNew ? GettextCatalog.GetString ("New template") : GettextCatalog.GetString ("Edit template"); this.template = template; this.entryShortcut1.Text = template.Shortcut ?? ""; this.comboboxentryGroups.Entry.Text = template.Group ?? ""; this.comboboxentryMime.Entry.Text = template.MimeType ?? ""; this.entryDescription.Text = template.Description ?? ""; this.textEditor.MimeType = template.MimeType; this.textEditor.Text = template.Code ?? ""; checkbuttonExpansion.Active = (template.CodeTemplateType & CodeTemplateType.Expansion) == CodeTemplateType.Expansion; checkbuttonSurroundWith.Active = (template.CodeTemplateType & CodeTemplateType.SurroundsWith) == CodeTemplateType.SurroundsWith; Gtk.Widget control = textEditor; scrolledwindow1.Child = control; control.ShowAll (); textEditor.CaretPositionChanged += CaretPositionChanged; textEditor.Options = DefaultSourceEditorOptions.PlainEditor; var mimeTypes = new HashSet<string> (); var groups = new HashSet<string> (); foreach (CodeTemplate ct in CodeTemplateService.Templates) { mimeTypes.Add (ct.MimeType); groups.Add (ct.Group); } comboboxentryMime.AppendText (""); foreach (string mime in mimeTypes) { comboboxentryMime.AppendText (mime); } comboboxentryGroups.AppendText (""); foreach (string group in groups) { comboboxentryGroups.AppendText (group); } textEditor.TextChanged += DocumentTextReplaced; this.buttonOk.Clicked += ButtonOkClicked; checkbuttonWhiteSpaces.Hide (); variablesListStore = new ListStore (typeof (string), typeof (CodeTemplateVariable)); comboboxVariables.Model = variablesListStore; comboboxVariables.Changed += ComboboxVariablesChanged; variableStore = new TreeStore (typeof (string), typeof (CodeTemplateVariable), typeof (string), typeof (int)); treeviewVariable.Model = variableStore; treeviewVariable.HeadersVisible = false; treeviewVariable.AppendColumn ("", new Gtk.CellRendererText (), "text", 0); CellRendererText nameRenderer = new CellRendererText (); treeviewVariable.AppendColumn ("", nameRenderer, delegate (TreeViewColumn col, CellRenderer cell, TreeModel model, TreeIter iter) { nameRenderer.Markup = ((string)model.GetValue (iter, 2)); }); grid = new MonoDevelop.Components.PropertyGrid.PropertyGrid (); grid.PropertySort = MonoDevelop.Components.PropertyGrid.PropertySort.Alphabetical; grid.ShowHelp = true; grid.ShowAll (); grid.ShowToolbar = false; vbox4.Remove (scrolledwindow2); vbox4.PackEnd (grid, true, true, 0); UpdateVariables (); }
void Build() { Spacing = 6; listView = new TreeView { CanFocus = true, HeadersVisible = false }; scrolledWindow = new ScrolledWindow { ShadowType = ShadowType.In, Child = listView }; buttonAdd = new Button(Stock.Add); buttonRemove = new Button(Stock.Remove); labelScopes = new Label { Xalign = 0F, Text = GettextCatalog.GetString("Enter one or more XPath expressions to which this format applies") }; tableScopes = new Table(3, 3, false) { RowSpacing = 6, ColumnSpacing = 6 }; propertyGrid = new MonoDevelop.Components.PropertyGrid.PropertyGrid { ShowToolbar = false, ShowHelp = false }; buttonAdvanced = new Button { Label = GettextCatalog.GetString("Advanced Settings"), CanFocus = true, UseUnderline = true }; var buttonBox = new HBox(false, 6); buttonBox.PackStart(buttonAdd, false, false, 0); buttonBox.PackStart(buttonRemove, false, false, 0); boxScopes = new VBox(false, 6); boxScopes.PackStart(scrolledWindow, true, true, 0); boxScopes.PackStart(buttonBox, false, false, 0); var rightVBox = new VBox(false, 6); rightVBox.PackStart(labelScopes, false, false, 0); rightVBox.PackStart(tableScopes, false, false, 0); rightVBox.PackStart(propertyGrid, true, true, 0); var mainBox = new HBox(false, 6); mainBox.PackStart(boxScopes, false, false, 0); mainBox.PackStart(rightVBox, true, true, 0); var abbBox = new HBox(false, 6); abbBox.PackStart(buttonAdvanced, false, false, 0); PackStart(mainBox, true, true, 0); PackStart(abbBox, false, false, 0); ShowAll(); buttonAdd.Clicked += OnButtonAddClicked; buttonRemove.Clicked += OnButtonRemoveClicked; buttonAdvanced.Clicked += OnButtonAdvancedClicked; }