Active Comments
The idea of Active Comments is to make comments alive and give old fashioned comments new meaning and look.
From now on, you can assign mouse event on your comments and 'tell' your comments what to do on each one. For example, on left mouse click, open some web address in your browser, on mouse over show some picture and on mouse double click open some file.
Let suppose we are writing a example for a GSM/GPSR module which is connected to EasyPIC6 and we would like to provide a photo of our hardware (jumpers, cables, etc.). within the example.
Also, it would be also nice to put some documentation about chip we are using and a GSM module extra board. Now we can have all those things defined in one single comment using Active Comment Editor.
New Active Comment
When you start Active Comment Editor for the first time (from the View menu, from editor's pop-up menu, or by pressing Ctrl + Alt + P) you will get an empty editor :
By clicking the button you are prompted to enter a name for the comment :
You can notice that when you start typing a name, properties pane is automatically displayed so you can edit properties if you wish. A Comment will be is created when you click button.
Properties are consisted of two major categories - Attributes and Events.
Attributes can be :
- URL - Valid web address.
- Image - Image has to be previously added to Project (Project Manager > Images).
- File - File has to be previously added to Project (Project Manager > Other Files).
There are four predefined event types you can apply to an Active Comment :
- OnLeftClick + Alt
- OnRightClick
- OnDoubleClick
- OnMouseOver
First three event types can have one of the following three actions :
- OpenUrl - Opens entered URL in default Web browser.
- OpenFile - Opens a file within a default program associated with the file extension (defined by Windows).
- None - Does nothing.
Fourth event, OnMouseOver, has only 2 actions :
- PreviewImage - Shows image when cursor is moved over a comment.
- None - Does nothing.
Attributes are tightly bounded with events. For example, you can not have OnLeftClick + Alt -> OpenFile if there is no file attribute set, or if there is no file added to project. Same behavior applies to image attribute.
Let's start editing our Active Comment by entering some valid web address in the URL field :
For every Active Comment a XML file will be created, containing all valid information regarding the Active Comment - attributes, events, etc. and it is automatically added to Project manager after saving it :
You can see the contents of the created XML file by expanding Active Comment Editor :
As we mentioned above you can add image or file which are already included in project. If the the desired image or file aren't added, you can do it directly from here by clicking the or button.
Next file dialog will be opened :
There, you should select the desired image to be added. In our example, Easy_GSM_GPRS.jpg
image will be added.
Selected picture is automatically added to the drop down list of the Image field in Active Comment Editor :
Now, when image has been selected, we can assign an event for it. For example, OnMouseOver will be used for PreviewImage action, and OnLeftClick + Alt will be assigned to OpenUrl action :
Now we can save our changes to Active Comment by clicking the Save button.
Once we have finished creating our active comment, we can notice that it has been added to source file on current caret position with ac:
prefix 'telling' IDE that it is active comment :
Now let's try it. If you LeftClick+Alt on it, URL in default Web browser will be opened. If you hover the mouse over it, you will see an Image preview:
There is another way to add an active comment to an active project. You can do it simply by typing a comment in old fashion way, except with ac:
prefix. So it would look like this :
Notice that when you stop typing, Add Comment To Project button will show. By clicking on it, you will open Active Comment Editor and comment name will be already set, so you need only to adjust attributes and settings.
After saving you can always edit your active comment by Active Comment Editor, and switch between comments directly from editor.
If you remove a file from the Project Manager or add an Active Comment File which contains information about the file which is no longer in project, and hover the mouse over the comment, you will be prompted to either add file to project or remove event definition from Active Comment for this file :
If you remove active comment file from the Project Manager, you'll receive this message:
Click on Yes button you'll prompted for an active comment file :
If you click No, comment will be removed from the source code.
Renaming Active Comment
When you click on rename button, you will be prompted to enter new name :
Now click again Rename button. Now you have renamed your Active Comment in such a way that its filename, source code name are changed :
Deleting Active Comment
Deleting active comment works similar like renaming it. By clicking on delete button, you will remove an active comment from both code and Project Manager.
What do you think about this topic ? Send us feedback!