Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/monodevelop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'main/src/core/MonoDevelop.Ide')
-rw-r--r--main/src/core/MonoDevelop.Ide/Makefile.am5
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Fonts/FontChooserPanel.cs48
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Fonts/FontChooserPanelWidget.cs111
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Fonts/FontDescriptionCodon.cs61
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Fonts/FontService.cs103
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.addin.xml12
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.csproj6
7 files changed, 346 insertions, 0 deletions
diff --git a/main/src/core/MonoDevelop.Ide/Makefile.am b/main/src/core/MonoDevelop.Ide/Makefile.am
index 5edd95d8fc..02f91c078e 100644
--- a/main/src/core/MonoDevelop.Ide/Makefile.am
+++ b/main/src/core/MonoDevelop.Ide/Makefile.am
@@ -40,6 +40,7 @@ FILES = \
gtk-gui/MonoDevelop.Ide.ExternalTools.ExternalToolPanelWidget.cs \
gtk-gui/MonoDevelop.Ide.FindInFiles.FindInFilesDialog.cs \
gtk-gui/MonoDevelop.Ide.FindInFiles.SearchResultWidget.cs \
+ gtk-gui/MonoDevelop.Ide.Fonts.FontChooserPanelWidget.cs \
gtk-gui/MonoDevelop.Ide.Gui.Components.ExecutionModeComboBox.cs \
gtk-gui/MonoDevelop.Ide.Gui.Components.StringTagSelectorButton.cs \
gtk-gui/MonoDevelop.Ide.Gui.Dialogs.AddinLoadErrorDialog.cs \
@@ -370,6 +371,10 @@ FILES = \
MonoDevelop.Ide.FindInFiles/SearchResult.cs \
MonoDevelop.Ide.FindInFiles/SearchResultPad.cs \
MonoDevelop.Ide.FindInFiles/SearchResultWidget.cs \
+ MonoDevelop.Ide.Fonts/FontChooserPanel.cs \
+ MonoDevelop.Ide.Fonts/FontChooserPanelWidget.cs \
+ MonoDevelop.Ide.Fonts/FontDescriptionCodon.cs \
+ MonoDevelop.Ide.Fonts/FontService.cs \
MonoDevelop.Ide.Gui.Components/CellRendererPixbuf.cs \
MonoDevelop.Ide.Gui.Components/CustomCommandTargetAttribute.cs \
MonoDevelop.Ide.Gui.Components/DragOperation.cs \
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Fonts/FontChooserPanel.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Fonts/FontChooserPanel.cs
new file mode 100644
index 0000000000..810820ff66
--- /dev/null
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Fonts/FontChooserPanel.cs
@@ -0,0 +1,48 @@
+//
+// FontChooserPanel.cs
+//
+// Author:
+// Mike Krüger <mkrueger@novell.com>
+//
+// Copyright (c) 2010 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+using System;
+using Gtk;
+using MonoDevelop.Ide.Gui.Dialogs;
+
+namespace MonoDevelop.Ide.Fonts
+{
+ public class FontChooserPanel : OptionsPanel
+ {
+ FontChooserPanelWidget widget;
+
+ public override Widget CreatePanelWidget ()
+ {
+
+ return widget = new FontChooserPanelWidget ();
+ }
+
+ public override void ApplyChanges ()
+ {
+ widget.Store ();
+ }
+ }
+}
+
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Fonts/FontChooserPanelWidget.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Fonts/FontChooserPanelWidget.cs
new file mode 100644
index 0000000000..489709de2b
--- /dev/null
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Fonts/FontChooserPanelWidget.cs
@@ -0,0 +1,111 @@
+//
+// FontChooserPanelWidget.cs
+//
+// Author:
+// Mike Krüger <mkrueger@novell.com>
+//
+// Copyright (c) 2010 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+using System;
+using MonoDevelop.Core;
+using Gtk;
+
+namespace MonoDevelop.Ide.Fonts
+{
+ [System.ComponentModel.ToolboxItem(true)]
+ public partial class FontChooserPanelWidget : Gtk.Bin
+ {
+ TreeStore fontStore;
+ ListStore comboBoxStore;
+
+ Gtk.CellRendererText textRenderer = new Gtk.CellRendererText ();
+ Gtk.CellRendererCombo comboRenderer = new Gtk.CellRendererCombo ();
+
+ public FontChooserPanelWidget ()
+ {
+ this.Build ();
+ fontStore = new TreeStore (typeof (string), typeof (string), typeof (string));
+ treeviewFonts.Model = fontStore;
+
+ treeviewFonts.AppendColumn (GettextCatalog.GetString ("Name"), textRenderer, "text", colDisplayName);
+
+ comboRenderer.Edited += delegate(object o, Gtk.EditedArgs args) {
+ TreeIter iter;
+ if (!fontStore.GetIterFromString (out iter, args.Path))
+ return;
+ string fontName = (string)fontStore.GetValue (iter, colName);
+ if (args.NewText == GettextCatalog.GetString ("Default")) {
+ FontService.SetFont (fontName, FontService.GetFont (fontName).FontDescription);
+ return;
+ }
+ var selection = new FontSelectionDialog (GettextCatalog.GetString ("Select Font"));
+
+ if (MessageService.ShowCustomDialog (selection) == (int)Gtk.ResponseType.Ok) {
+ FontService.SetFont (fontName, selection.FontName);
+ fontStore.SetValue (iter, 2, selection.FontName);
+ }
+ selection.Destroy ();
+ };
+
+ var fontCol = new TreeViewColumn ();
+
+ comboRenderer.HasEntry = false;
+ comboRenderer.Mode = CellRendererMode.Activatable;
+ comboRenderer.TextColumn = 0;
+ comboRenderer.Editable = true;
+ fontCol.PackStart (comboRenderer, true);
+
+ fontCol.SetCellDataFunc (comboRenderer, delegate (Gtk.TreeViewColumn tree_column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter) {
+ string fontValue = (string)fontStore.GetValue (iter, colValue);
+ string fontName = (string)fontStore.GetValue (iter, colName);
+ var d = FontService.GetFont (fontName);
+ comboBoxStore.Clear ();
+ if (d == null || d.FontDescription != fontValue)
+ comboBoxStore.AppendValues (fontValue);
+ comboBoxStore.AppendValues (GettextCatalog.GetString ("Default"));
+ comboBoxStore.AppendValues (GettextCatalog.GetString ("Edit..."));
+ });
+
+ treeviewFonts.AppendColumn (fontCol);
+
+ comboBoxStore = new ListStore (typeof (string));
+
+ comboRenderer.Model = comboBoxStore;
+
+ LoadFonts ();
+ }
+
+ const int colDisplayName = 0;
+ const int colValue = 1;
+ const int colName = 2;
+
+ public void LoadFonts ()
+ {
+ foreach (var desc in FontService.FontDescriptions) {
+ fontStore.AppendValues (GettextCatalog.GetString (desc.DisplayName), FontService.GetFontDescriptionName (desc.Name), desc.Name);
+ }
+ }
+
+ public void Store ()
+ {
+ }
+ }
+}
+
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Fonts/FontDescriptionCodon.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Fonts/FontDescriptionCodon.cs
new file mode 100644
index 0000000000..4aae160243
--- /dev/null
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Fonts/FontDescriptionCodon.cs
@@ -0,0 +1,61 @@
+//
+// FontDescriptionCodon.cs
+//
+// Author:
+// Mike Krüger <mkrueger@novell.com>
+//
+// Copyright (c) 2010 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+using System;
+using Mono.Addins;
+
+
+namespace MonoDevelop.Ide.Fonts
+{
+ [ExtensionNode (Description="A template for color and syntax shemes.")]
+ public class FontDescriptionCodon : ExtensionNode
+ {
+ [NodeAttribute("name", "Name of the font.")]
+ string name;
+ public string Name {
+ get {
+ return this.name;
+ }
+ }
+
+ [NodeAttribute("_displayName", "Name of the font displayed to the user.")]
+ string displayName;
+ public string DisplayName {
+ get {
+ return this.displayName;
+ }
+ }
+
+ [NodeAttribute("default", "Default font to use.")]
+ string fontDescription;
+ public string FontDescription {
+ get {
+ return this.fontDescription;
+ }
+ }
+
+ }
+}
+
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Fonts/FontService.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Fonts/FontService.cs
new file mode 100644
index 0000000000..560fd52239
--- /dev/null
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Fonts/FontService.cs
@@ -0,0 +1,103 @@
+//
+// FontService.cs
+//
+// Author:
+// Mike Krüger <mkrueger@novell.com>
+//
+// Copyright (c) 2010 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using Mono.Addins;
+using MonoDevelop.Core;
+using Pango;
+
+namespace MonoDevelop.Ide.Fonts
+{
+ public static class FontService
+ {
+ static List<FontDescriptionCodon> fontDescriptions = new List<FontDescriptionCodon> ();
+ static Dictionary<string, FontDescription> loadedFonts = new Dictionary<string, FontDescription> ();
+ static Properties fontProperties;
+
+ public static IEnumerable<FontDescriptionCodon> FontDescriptions {
+ get {
+ return fontDescriptions;
+ }
+ }
+
+ static FontService ()
+ {
+ fontProperties = PropertyService.Get ("FontProperties", new Properties ());
+
+ AddinManager.AddExtensionNodeHandler ("/MonoDevelop/Ide/Fonts", delegate(object sender, ExtensionNodeEventArgs args) {
+ var codon = (FontDescriptionCodon)args.ExtensionNode;
+ switch (args.Change) {
+ case ExtensionChange.Add:
+ fontDescriptions.Add (codon);
+ break;
+ case ExtensionChange.Remove:
+ fontDescriptions.Remove (codon);
+ if (loadedFonts.ContainsKey (codon.Name))
+ loadedFonts.Remove (codon.Name);
+ break;
+ }
+ });
+ }
+
+ static FontDescription LoadFont (string name)
+ {
+ if (name == "_DEFAULT_MONOSPACE")
+ return Pango.FontDescription.FromString (DesktopService.DefaultMonospaceFont);
+ return Pango.FontDescription.FromString (name);
+ }
+
+ public static string GetFontDescriptionName (string name)
+ {
+ return fontProperties.Get<string> (name) ?? GetFont (name).FontDescription;
+ }
+
+ public static FontDescription GetFontDescription (string name)
+ {
+ if (loadedFonts.ContainsKey (name))
+ return loadedFonts [name];
+ return loadedFonts [name] = LoadFont (GetFontDescriptionName (name));
+ }
+
+ public static FontDescriptionCodon GetFont (string name)
+ {
+ foreach (var d in fontDescriptions) {
+ if (d.Name == name)
+ return d;
+ }
+ LoggingService.LogError ("Font " + name + " not found.");
+ return null;
+ }
+
+ public static void SetFont (string name, string value)
+ {
+ if (loadedFonts.ContainsKey (name))
+ loadedFonts.Remove (name);
+ fontProperties.Set (name, value);
+ }
+ }
+} \ No newline at end of file
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.addin.xml b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.addin.xml
index 6b97cbde6b..dd6a418ce2 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.addin.xml
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.addin.xml
@@ -291,6 +291,13 @@
<ExtensionNode name="Tool" type="MonoDevelop.Ide.Extensions.CustomToolExtensionNode"/>
</ExtensionPoint>
+ <ExtensionPoint path = "/MonoDevelop/Ide/Fonts" name = "IDE Fonts">
+ <Description>Addins can register own fonts to be configured.</Description>
+ <ExtensionNode name="Font" type="MonoDevelop.Ide.Fonts.FontDescriptionCodon"/>
+ </ExtensionPoint>
+
+
+
<!-- Extensions -->
<Extension path = "/MonoDevelop/Core/Applications">
@@ -1822,6 +1829,7 @@
<Section id = "Style" _label = "Visual Style" icon="md-visual-style" class = "MonoDevelop.Ide.Gui.OptionPanels.IDEStyleOptionsPanel" />
<Section id = "KeyBindings" _label = "Key Bindings" fill="true" icon="md-keyboard-shortcuts" class = "MonoDevelop.Ide.Gui.OptionPanels.KeyBindingsPanel" />
<Section id = "LoadSave" _label = "Load/Save" icon="gtk-harddisk" class = "MonoDevelop.Ide.Gui.OptionPanels.LoadSavePanel" />
+<!-- <Section id = "Fonts" _label = "Fonts" fill="true" class = "MonoDevelop.Ide.Fonts.FontChooserPanel"/>-->
<Section id = "Build" _label = "Build" icon="md-build-current-selected-project" class = "MonoDevelop.Ide.Gui.OptionPanels.BuildPanel">
<Panel id = "BuildMessages" _label = "Errors and Warnings" class = "MonoDevelop.Ide.Gui.OptionPanels.BuildMessagePanel" />
<Panel id = "Directories" _label = "Assembly Folders" class = "MonoDevelop.Ide.Gui.OptionPanels.AssemblyFoldersPanel" />
@@ -2279,4 +2287,8 @@
<Customizer id="MonoDevelop.Ide.Execution.CustomArgsCustomizer" _name="Arguments" />
<Customizer id="MonoDevelop.Ide.Execution.MonoExecutionCustomizer" _name="Mono Options" />
</Extension>
+
+ <Extension path = "/MonoDevelop/Ide/Fonts">
+ <Font name ="Editor" _displayName="Text Editor" default ="_DEFAULT_MONOSPACE"/>
+ </Extension>
</Addin>
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.csproj b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.csproj
index 576734529f..a52bd2d2a4 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.csproj
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.csproj
@@ -1361,6 +1361,11 @@
<Compile Include="MonoDevelop.Components\DropDownBox.cs" />
<Compile Include="MonoDevelop.Ide.CodeCompletion\CompletionMatcher.cs" />
<Compile Include="MonoDevelop.Components\Tabstrip.cs" />
+ <Compile Include="MonoDevelop.Ide.Fonts\FontChooserPanelWidget.cs" />
+ <Compile Include="gtk-gui\MonoDevelop.Ide.Fonts.FontChooserPanelWidget.cs" />
+ <Compile Include="MonoDevelop.Ide.Fonts\FontChooserPanel.cs" />
+ <Compile Include="MonoDevelop.Ide.Fonts\FontService.cs" />
+ <Compile Include="MonoDevelop.Ide.Fonts\FontDescriptionCodon.cs" />
</ItemGroup>
<ItemGroup>
<None Include="ChangeLog" />
@@ -1422,5 +1427,6 @@
<Folder Include="MonoDevelop.Ide.NavigateToDialog\" />
<Folder Include="MonoDevelop.Ide.Navigation\" />
<Folder Include="MonoDevelop.Components.AutoTest\" />
+ <Folder Include="MonoDevelop.Ide.Fonts\" />
</ItemGroup>
</Project>