# FireEdit

By , 4 Apr 2006
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

For a binary release, go to DotNetFireball (SourceForge.net).

## Introduction

FireEdit is a small source code editor and is provided with basic editing functionalities. Since the idea is to extend it by the plugins system, as a basis FireEdit uses Fireball.Plugins, a class library developed for use as a base implementation for creating plugins system for any application. You can find the source of its dependencies here.

## Using the Code

The objective of this article is to introduce how to implement your own plugin for FireEdit.

As an example for this article, I can use the simple plugin that adds to the HTML editor a bottom toolstrip with two buttons for switching from code to preview and vice versa.

Implementing your own plugin is very simple. You only need to inherit from FireEditPlugin, that is the base class used by FireEdit. For initializing your events and other things when the plugin is executed, you need to put this code in the Execute method by overriding it. For example, in this plugin I need to understand when a new CodeEditing window was created. See the following code:

 public override bool Execute(Fireball.Plugins.PluginApplication application,
params object[] parameters)
{
((FireEditApplication)application).MainForm.NewCodeEditor +=
new EventHandler<NewCodeEditorEventArgs>(MainForm_NewCodeEditor);

return true;
}

The function must return true for informing FireEdit that the plugin was loaded correctly. Now you are able to say when a new code editor was instanced but you need to say when the HTML language was set! See this piece of code:

 void MainForm_NewCodeEditor(object sender, NewCodeEditorEventArgs e)
{
e.FireEditorTabItem.LanguageChanged += new EventHandler
<LanguageChangedEventArgs>(FireEditorTabItem_LanguageChanged);
}

Now you can say when the language is changed on the FireEditorTabItem_LanguageChanged method. Next you see the code for adding the new controls on the current TabStrip.

void FireEditorTabItem_LanguageChanged(object sender, LanguageChangedEventArgs e)
{
if (e.Language.Name == "HTML")
{
FireEditorTabItem tabItem = (FireEditorTabItem)sender;
ToolStrip myToolStrip = new ToolStrip();
myToolStrip.Name = "switchBar";
myToolStrip.Dock = DockStyle.Bottom;
ToolStripButton btnCode = new ToolStripButton();
btnCode.Checked = true;
btnCode.Text = "Html Code";
btnCode.CheckOnClick = true;
btnCode.Click += new EventHandler(btnCode_Click);
ToolStripButton btnPreview = new ToolStripButton();
btnPreview.Text = "Html Preview";
btnPreview.CheckOnClick = true;
btnPreview.Click += new EventHandler(btnPreview_Click);
WebBrowser browser = new WebBrowser();
browser.Name = "preview";
browser.Dock = DockStyle.Fill;
browser.Visible = false;
}
}

Most of the code of this plugin is here. The rest is in the source code. I can't add it here for clarity. If you need more help or if you have created your own plugin, post a message on my forum.

N.B. To try your plugin, you need to load it from the Menu Plugins->Configure Plugins and click on Browse and Load Now. If you want the plugins to be loaded at startup, click on Load at Startup and next on Save Config. If you don't save ,the config can't be stored.

## About the Author

Web Developer
Italy
No Biography provided

## Comments and Discussions

 View All Threads First Prev Next
 fireedit error nan0mit 31-Mar-08 23:23
 I have text file, named "test.tex". Content: \documentclass[12pt, unicode]{article} %\usepackage[screen, nooverlay]{ssu} \begin{document} \textbf{??????? ???????} "--- \textit{?? ?????, ??? ???? ???? ???????? ?????????????? ? ???? ??? ????? ?????? ??????? ????.} ??????????????? ???????? ???????... \end{document} * ? - i use Cyrillic Font, this site doesn’t support it, too   When i try to open it in editor, i see error message and my text looks like this: %\usepackage[screen, nooverlay]{ssu} \begin{document} \textbf{? } "--- \textit{ , .} ? , , , . , , . \end{document}   Can you help with this problem? Thanks.
 Last Visit: 31-Dec-99 18:00     Last Update: 18-Dec-13 6:06 Refresh 1

General    News    Suggestion    Question    Bug    Answer    Joke    Rant    Admin

| Advertise | Privacy | Mobile
Web04 | 2.7.131216.3 | Last Updated 4 Apr 2006
Article Copyright 2006 by dotnetfireball