Revision: 14453
http://harbour-project.svn.sourceforge.net/harbour-project/?rev=14453&view=rev
Author: vouchcac
Date: 2010-05-10 01:18:04 +0000 (Mon, 10 May 2010)
Log Message:
-----------
2010-05-09 17:21 UTC-0800 Pritpal Bedi ([email protected])
+ contrib/hbide/plugins
+ contrib/hbide/plugins/savebackup.hrb
+ contrib/hbide/plugins/savebackup.prg
+ Source and corresponding .hrb ( -gh ) plugin.
In practice .prg is never required for this purpose.
The source accompanying here is for demonstration purposes
which exposes elements to comprehend.
+ contrib/hbide/resources/selectionline.png
+ Image to be activated when "Line" selection mode is on.
* contrib/hbqt/hbqt_hbqplaintextedit.cpp
* contrib/hbide/hbide.hbp
+ Added ideplugin.prg
* contrib/hbide/idethemes.prg
+ Added more keywords for syntax-highlighting.
* contrib/hbide/hbide.prg
* contrib/hbide/idedocks.prg
* contrib/hbide/ideedit.prg
* contrib/hbide/ideeditor.prg
+ contrib/hbide/ideplugins.prg
+ Priliminary commit to handle plugins.
* contrib/hbide/ideshortcuts.prg
+ Implemented: a very simple yet powerful interface to hook plugins.
The idea got polished with Francesco Perillo's description of the thought.
Creating a hbIDE plugin
=======================
A .hrb ( compiled with -gh as the minimum ), i.e., savebackup.prg,
having two mandatory functions:
1. hrb_file_name_without_extension_plus_underscrore_plus_INIT()
savebackup_INIT( ... ) -> TRUE/FALSE
2. hrb_file_name_without_extension_plus_underscrore_plus_EXEC()
savebackup_EXEC( oIde, ... ) -> xValue
savebackup_INIT() will be used to establish hand-shake and it must
return a logical indicating success or failure. Currently it is
called with "1.0" as version no but is scheduled to be enhanced
in future.
If hand-shake is successful, means, savebackup_INIT( ... ) returns
with TRUE, savebackup_EXEC( oIde, ... ) is called as per user
request. oIDE is sent as the first argument followed by user supplied
arguments. Within this function in .hrb, all action takes place.
User can write n number of functions withing the same source but
all other functions will always be STATIC ones.
The whole hbIDE object is passed with each execution and hence
user is having utmost control over what he wants to accomplish.
Location of the Plugin
======================
All plugins ( .hrb ) must reside within "plugins" sub-folder from
hbIDE.exe
location. The location is determined with return value of
hb_dirBase() + hb_osPathSeparator() + "plugins" + hb_osPathSeparator().
Loading Plugins
===============
At startup hbIDE looks into "plugins" folder for all .hrb files.
It then tries to establish hand-shake with them. If successful, a
handle is retained in static array. When an execution request is
encountered, this static array is searched for and
savebackup_EXEC( oIDE, ... ) is called and return value is passed
back to the caller macro.
Executing Plugins in hbIDE
==========================
A public method ::execPlugin( cPlugin, ... ) is implemented under
"Keyboard Mappings". ::execPlugin is called with plugin name, which
essentially is the .hrb file name. So in demo example, it is
"savebackup". Final expression would be like :
::execPlugin( "savebackup", "saveas" )
Here "saveas" is the identifier which is used in this demo to invoke
STATIC FUNCTION savebackup_saveAs( oIde )
Author of plugin has to decide how and what he would like to pass
what and in how many. So simply build a macro to call a plugin
with parameters, that's it.
I am hopeful that you, brilliant programmers, with help extending hbIDE
to an amazing levels. Send your critics to the list to enrich this
thought.
Modified Paths:
--------------
trunk/harbour/ChangeLog
trunk/harbour/contrib/hbide/hbide.hbp
trunk/harbour/contrib/hbide/hbide.prg
trunk/harbour/contrib/hbide/idedocks.prg
trunk/harbour/contrib/hbide/ideedit.prg
trunk/harbour/contrib/hbide/ideeditor.prg
trunk/harbour/contrib/hbide/ideshortcuts.prg
trunk/harbour/contrib/hbide/idethemes.prg
trunk/harbour/contrib/hbqt/hbqt_hbqplaintextedit.cpp
Added Paths:
-----------
trunk/harbour/contrib/hbide/ideplugins.prg
trunk/harbour/contrib/hbide/plugins/
trunk/harbour/contrib/hbide/plugins/savebackup.hrb
trunk/harbour/contrib/hbide/plugins/savebackup.prg
trunk/harbour/contrib/hbide/resources/selectionline.png
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
_______________________________________________
Harbour mailing list (attachment size limit: 40KB)
[email protected]
http://lists.harbour-project.org/mailman/listinfo/harbour