1
// Add a 'fixed width' item to the font styles menu.
2
// (C) 2006 Ryan Lortie <desrt@desrt.ca>, LGPL 2.1 or later.
11
class FixedWidthTag : NoteTag
13
public FixedWidthTag ()
18
public override void Initialize (string element_name)
20
base.Initialize (element_name);
27
class FixedWidthMenuItem : CheckMenuItem
32
public FixedWidthMenuItem (NotePlugin plugin)
33
: base ("<span font_family='monospace'>" +
34
Catalog.GetString ("_Fixed Width") +
37
((Label) Child).UseUnderline = true;
38
((Label) Child).UseMarkup = true;
41
Plugin.Window.TextMenu.Shown += MenuShown;
46
protected void MenuShown (object sender, EventArgs e)
49
Active = Plugin.Buffer.IsActiveTag ("monospace");
53
protected override void OnActivated ()
56
Plugin.Buffer.ToggleActiveTag ("monospace");
61
protected override void OnDestroyed ()
64
Plugin.Window.TextMenu.Shown -= MenuShown;
71
"Fixed Width Plugin", Defines.VERSION,
72
PluginInfoAttribute.OFFICIAL_AUTHOR,
73
"Adds fixed-width font style.",
74
WebSite = Defines.TOMBOY_WEBSITE
76
public class FixedWidthPlugin : NotePlugin
80
protected override void Initialize ()
82
// If a tag of this name already exists, don't install.
83
if (Note.TagTable.Lookup ("monospace") == null) {
84
tag = new FixedWidthTag ();
85
Note.TagTable.Add (tag);
89
protected override void Shutdown ()
91
// Remove the tag only if we installed it.
93
Note.TagTable.Remove (tag);
96
protected override void OnNoteOpened ()
98
// Add here instead of in Initialize to avoid creating unopened
99
// notes' windows/buffers.
100
AddTextMenuItem (new FixedWidthMenuItem (this));