Developers Guide

Developers Guide

Introduction

CSSExplorer plug-in allows easy navigation and edit of CSS files with Notepad++.

 Main Features:

  1. TreeView: Allows easy navigation in CSS file.

  2. Validation Service: Check errors in CSS file, and provide detailed report.

  3. Web Page Preview: Test your work on CSS file immediately via HTML Web Page Preview Window.

  4. CSS Editor:  Add new parameters and design options to CSS file quickly and easily (support CSS 2.0 defines). 
     4 Design sections:
                                  
     1.  Text – Add text design to the CSS file.
     
    2.  Display – Add background, and choose position.
     3.  Border – Add Border Style and Width.
     
    4.  Dimension – Set Padding and Margin.

 Project Structure

 CSSExplorer plug-in has two main components:

  1. CSSExplorer Adapter (Adapter Component) – This component was written in C++ language. It provides an interface between C# component and Notepad++ program.

  2. CSSExplorer (C# Component) – This component was written in C# language. It is the brain behind the plug-in.


Notepad++ plugin system is based on Windows Message System. In our plug-in all the messages from Notepad++ are sent to Adapter Component, and the Adapter Component pass relevant data to C# Component. C# Component can send messages directly to Notepad++. It can also send messages to the C++ adapter.

 

Developing UI, for the plug-in, in C# language was one of the challenges in the project. Since we wrote our project in C# language, and Notepad++ was written in C++ language with pure Win32 API (without MFC), the integration of the C# window in Notepad++ was not so easy.


 .NET plugin for Notepad++ - How?

Our solution is based on exposing C# control to COM. We created UserControl project in C# and exposed it to COM as ActiveX control. Some of the ideas were taken from Morgan Skinner's article on CodeProject. C++ component of the project has dialog window that act in our project as a container of C# control. Notepad++ was developed without MFC with pure Win32 API, therefore to integrate ActiveX control we used Active Template Library (ATL)

We wrote detailed article on CodeProject that describes how we succeeded to integrate our .NET plug-in in Windows that build with pure Win32 API. We hope that this article will help others to develop combined C# & C++ projects.

Link to the article: http://www.codeproject.com/KB/cs/DotNetActiveX.aspx
(or download pdf file)

CSSExplorer Adapter Design


CSSExplorerAdapter – this is the start-up class, it initialize CSSExplorer Dialog and WebBrowser Dialog. It also provides information about the plug-in to Notepad++.

 

ATLContainerDlg – This is the parent class for CSSExplorerDlg and WebBrowserDlg, It responsible to display ActiveX control that was requested from the child. CSSExplorerDlg request C# ActiveX control and WebBrowserDlg request WebBrowser ActiveX control.

CSSExplorerDlg – This is the container for C# ActiveX control

WebBrowserDlg – This is the container for WebBrowser ActiveX control


References: 

  1. C# Programming Guide - Example COM Class (C# Programming Guide)

  2. How to add ATL control containment support to any window in Visual C++

  3. Exposing Windows Forms Controls as ActiveX controls
Comments