mirror of https://gitlab.com/basile.b/dexed.git
give plug up
This commit is contained in:
parent
d50de4be99
commit
3780e76078
|
@ -1,140 +0,0 @@
|
||||||
module CoeditPlugApi;
|
|
||||||
|
|
||||||
alias void* Host_t;
|
|
||||||
alias void* Plugin_t;
|
|
||||||
|
|
||||||
// API version
|
|
||||||
immutable uint CE_PLG_API_VER = 0;
|
|
||||||
|
|
||||||
/// When passed to the Coedit dispatcher, it shows a 'hello plugin' message.
|
|
||||||
immutable uint HELLO_PLUGIN = 0xFFFFFFFF;
|
|
||||||
|
|
||||||
// Denotes the emiter and the message kind -------------------------------------
|
|
||||||
|
|
||||||
/// Coedit sends an event.
|
|
||||||
immutable uint HOST_EVENT = 0x10000000;
|
|
||||||
/// Coedit sends some data.
|
|
||||||
immutable uint HOST_DATA = 0x20000000;
|
|
||||||
/// The plug-in sends an event.
|
|
||||||
immutable uint PLUG_EVENT = 0x30000000;
|
|
||||||
/// The plug-in sends some data.
|
|
||||||
immutable uint PLUG_DATA = 0x40000000;
|
|
||||||
|
|
||||||
// Denotes the message context -------------------------------------------------
|
|
||||||
|
|
||||||
/// the dispatcher call is related to the project(s)
|
|
||||||
immutable uint CTXT_PROJ = 0x01000000;
|
|
||||||
/// the dispatcher call is related to the document(s)
|
|
||||||
immutable uint CTXT_DOCS = 0x02000000;
|
|
||||||
/// the dispatcher call is related to the edition of a document.
|
|
||||||
immutable uint CTXT_EDIT = 0x03000000;
|
|
||||||
/// the dispatcher call is related to the Coedit 'Message Widget'.
|
|
||||||
immutable uint CTXT_MSGS = 0x04000000;
|
|
||||||
/// the dispatcher call is related to the Coedit dialogs.
|
|
||||||
immutable uint CTXT_DLGS = 0x05000000;
|
|
||||||
|
|
||||||
// The events kinds ------------------------------------------------------------
|
|
||||||
|
|
||||||
/// somethings's just changed.
|
|
||||||
immutable uint EV_CHANGED = 0x00000001;
|
|
||||||
/// something's just been selected.
|
|
||||||
immutable uint EV_FOCUSED = 0x00000002;
|
|
||||||
/// something's just been closed.
|
|
||||||
immutable uint EV_CLOSED = 0x00000003;
|
|
||||||
/// something's just been created.
|
|
||||||
immutable uint EV_NEW = 0x00000004;
|
|
||||||
/// something gonna be compiled.
|
|
||||||
immutable uint EV_COMPILE = 0x00000005;
|
|
||||||
/// something gonna be executed.
|
|
||||||
immutable uint EV_RUN = 0x00000006;
|
|
||||||
|
|
||||||
// The data kinds --------------------------------------------------------------
|
|
||||||
|
|
||||||
/// data1 is used to set/get a filename. data1 is a PChar. data0 represents an index.
|
|
||||||
immutable uint DT_FNAME = 0x00000001;
|
|
||||||
/// data0 represents a count.
|
|
||||||
immutable uint DT_COUNT = 0x00000002;
|
|
||||||
|
|
||||||
/// data1 is used to set a message. data1 is a PChar.
|
|
||||||
immutable uint DT_ERR = 0x00000001;
|
|
||||||
/// ditto
|
|
||||||
immutable uint DT_INF = 0x00000002;
|
|
||||||
/// ditto
|
|
||||||
immutable uint DT_WARN = 0x00000003;
|
|
||||||
|
|
||||||
// terminal opCodes (emiter + context + event/data kind) -----------------------
|
|
||||||
|
|
||||||
/// Coedit says that the project's just been modified.
|
|
||||||
immutable uint HOST_PROJ_CHANGED = HOST_EVENT + CTXT_PROJ + EV_CHANGED;
|
|
||||||
|
|
||||||
/// opCode for asking for a document filename. data0 must be the document index.
|
|
||||||
immutable uint PLUG_WANT_DOC_NAME = PLUG_EVENT + CTXT_DOCS + DT_FNAME;
|
|
||||||
|
|
||||||
/// opCode for getting a document filenmae. data1 is a PChar to the filename.
|
|
||||||
immutable uint HOST_GIVE_DOC_NAME = HOST_DATA + CTXT_DOCS + DT_FNAME;
|
|
||||||
|
|
||||||
/// opCodes for displaying a message in a dialog box.
|
|
||||||
immutable uint PLUG_DLGS_ERR = PLUG_DATA + CTXT_DLGS + DT_ERR;
|
|
||||||
/// ditto.
|
|
||||||
immutable uint PLUG_DLGS_WARN = PLUG_DATA + CTXT_DLGS + DT_WARN;
|
|
||||||
/// ditto.
|
|
||||||
immutable uint PLUG_DLGS_INF = PLUG_DATA + CTXT_DLGS + DT_INF;
|
|
||||||
|
|
||||||
/// opCodes for displaying a message in the 'Message Widget'.
|
|
||||||
immutable uint PLUG_MSGS_ERR = PLUG_DATA + CTXT_MSGS + DT_ERR;
|
|
||||||
/// ditto.
|
|
||||||
immutable uint PLUG_MSGS_WARN = PLUG_DATA + CTXT_MSGS + DT_WARN;
|
|
||||||
/// ditto.
|
|
||||||
immutable uint PLUG_MSGS_INF = PLUG_DATA + CTXT_MSGS + DT_INF;
|
|
||||||
|
|
||||||
// host-side prototypes --------------------------------------------------------
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A plugin asks for some information or it passes data here.
|
|
||||||
* Data1 and data2 are some pointers to a particular variable type.
|
|
||||||
* In the plugin hostCreatePlugProc, a the location of COedit dispatcher is passed
|
|
||||||
* to the plugin.
|
|
||||||
*/
|
|
||||||
extern(C) alias plugDispatchToHostProc =
|
|
||||||
void function(Plugin_t aPlugin, uint opCode, uint data0, void* data1, void* data2);
|
|
||||||
|
|
||||||
// plugin-side prototypes-------------------------------------------------------
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Coedit initializes a plugin, the result is passed during the runtime as "aTarget".
|
|
||||||
* In the plugin implementation, it must be named 'createPlug'.
|
|
||||||
* If the result is null then the Plugin is not used at all.
|
|
||||||
* If the plugin is not warped in a class than the result must be set on something
|
|
||||||
* that can be pointed to (e.g: a global variable).
|
|
||||||
*/
|
|
||||||
extern(C) alias hostCreatePlugProc =
|
|
||||||
Plugin_t function (plugDispatchToHostProc aHost);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Coedit closes and aTarget can be destroyed.
|
|
||||||
* In the plugin implementation, it must be named 'destroyPlug'.
|
|
||||||
*/
|
|
||||||
extern(C) alias hostDestroyPlugProc =
|
|
||||||
void function (Plugin_t aTarget);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Coedit events and data are passed here. data1 and data2 can be casted according to opCode.
|
|
||||||
* In the plugin implementation, it must be named 'dispatchToPlug'.
|
|
||||||
*/
|
|
||||||
extern(C) alias hostDispatchToPlugProc =
|
|
||||||
void function(Plugin_t aPlugin, uint opCode, uint data0, void* data1, void* data2);
|
|
||||||
|
|
||||||
// helpers ---------------------------------------------------------------------
|
|
||||||
|
|
||||||
uint getEmiter(in uint opCode){
|
|
||||||
return opCode & 0xF0000000;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint getContext(in uint opCode){
|
|
||||||
return opCode & 0x0FF00000;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint getCommand(in uint opCode){
|
|
||||||
return opCode & 0x000FFFFF;
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,42 +0,0 @@
|
||||||
object CurrentProject: TCEProject
|
|
||||||
OptionsCollection = <
|
|
||||||
item
|
|
||||||
name = 'toPlugDir'
|
|
||||||
outputOptions.binaryKind = sharedlib
|
|
||||||
outputOptions.noBoundsCheck = False
|
|
||||||
outputOptions.boundsCheck = onAlways
|
|
||||||
outputOptions.optimizations = True
|
|
||||||
outputOptions.release = True
|
|
||||||
pathsOptions.outputFilename = '..\..\plugins\CoeditPlug.dll'
|
|
||||||
preBuildProcess.options = []
|
|
||||||
preBuildProcess.showWindow = swoNone
|
|
||||||
postBuildProcess.options = []
|
|
||||||
postBuildProcess.showWindow = swoNone
|
|
||||||
runOptions.options = []
|
|
||||||
runOptions.showWindow = swoNone
|
|
||||||
end
|
|
||||||
item
|
|
||||||
name = 'abovePlugDir'
|
|
||||||
outputOptions.binaryKind = sharedlib
|
|
||||||
outputOptions.inlining = True
|
|
||||||
outputOptions.noBoundsCheck = False
|
|
||||||
outputOptions.boundsCheck = onAlways
|
|
||||||
outputOptions.optimizations = True
|
|
||||||
outputOptions.release = True
|
|
||||||
pathsOptions.outputFilename = '..\..\plugins\temp\CoeditPlug.dll'
|
|
||||||
preBuildProcess.options = []
|
|
||||||
preBuildProcess.showWindow = swoNone
|
|
||||||
postBuildProcess.options = []
|
|
||||||
postBuildProcess.showWindow = swoNone
|
|
||||||
runOptions.options = []
|
|
||||||
runOptions.showWindow = swoNone
|
|
||||||
end>
|
|
||||||
Sources.Strings = (
|
|
||||||
'..\CoeditPlugApi.d'
|
|
||||||
'CoeditPlug.d'
|
|
||||||
)
|
|
||||||
ConfigurationIndex = 1
|
|
||||||
LibraryAliases.Strings = (
|
|
||||||
'iz'
|
|
||||||
)
|
|
||||||
end
|
|
|
@ -1,143 +0,0 @@
|
||||||
module CoeditPlug;
|
|
||||||
|
|
||||||
/*
|
|
||||||
Under linux:
|
|
||||||
|
|
||||||
Build:
|
|
||||||
1:dmd -c CoeditPlug.d ../CoeditPlugApi.d pathtoIZ/types.d -fPIC
|
|
||||||
(or with a coedit project, select outputKind : object (which is actually -c))
|
|
||||||
2:dmd -ofCOeditPlug.so <the three .o> -shared -defaultlib=libphobos2.so
|
|
||||||
|
|
||||||
Note about IZ:
|
|
||||||
|
|
||||||
The GC will make the plugin crash if coeditPlug is not an izObject
|
|
||||||
because (?). However since izObjects have their own, G.C free, de/allocators
|
|
||||||
it just instanciates fine.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
import std.stdio, std.string, std.conv;
|
|
||||||
import core.runtime;
|
|
||||||
import CoeditPlugApi;
|
|
||||||
import iz.types;
|
|
||||||
|
|
||||||
version(Posix)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
import std.c.windows.windows;
|
|
||||||
import core.sys.windows.dll;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
coeditPlug plugin;
|
|
||||||
|
|
||||||
class coeditPlug: izObject
|
|
||||||
{
|
|
||||||
protected
|
|
||||||
{
|
|
||||||
plugDispatchToHostProc fDispatcher;
|
|
||||||
Plugin_t asPlugin_t(){return cast(Plugin_t)this;}
|
|
||||||
}
|
|
||||||
public
|
|
||||||
{
|
|
||||||
static this()
|
|
||||||
{
|
|
||||||
Runtime.initialize();
|
|
||||||
}
|
|
||||||
|
|
||||||
static ~this()
|
|
||||||
{
|
|
||||||
Runtime.terminate();
|
|
||||||
}
|
|
||||||
|
|
||||||
this(plugDispatchToHostProc aDispatcher)
|
|
||||||
{
|
|
||||||
assert(aDispatcher, "the Coedit dispatcher is missing");
|
|
||||||
fDispatcher = aDispatcher;
|
|
||||||
version(none)
|
|
||||||
{
|
|
||||||
fDispatcher(asPlugin_t, HELLO_PLUGIN, 0, null, null);
|
|
||||||
}
|
|
||||||
auto msg = "simple Coedit plugin is created".toStringz;
|
|
||||||
fDispatcher(asPlugin_t, PLUG_MSGS_INF, 0, cast(void*)msg, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
void hostEvent(uint eventContext, uint eventKind)
|
|
||||||
{
|
|
||||||
auto msg = (to!string(eventContext) ~ " " ~ to!string(eventKind)).toStringz;
|
|
||||||
fDispatcher(asPlugin_t, PLUG_MSGS_INF, 0, cast(void*)msg, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
void hostData(uint dataContext, uint dataKind, uint data0, void* data1, void* data2)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
extern(C) export
|
|
||||||
Plugin_t createPlug(plugDispatchToHostProc aHost)
|
|
||||||
{
|
|
||||||
plugin = new coeditPlug(aHost);
|
|
||||||
return &plugin;
|
|
||||||
}
|
|
||||||
|
|
||||||
extern(C) export
|
|
||||||
void destroyPlug(Plugin_t aPlug)
|
|
||||||
{
|
|
||||||
delete plugin;
|
|
||||||
}
|
|
||||||
|
|
||||||
extern(C) export
|
|
||||||
void dispatchToPlug(Plugin_t aPlugin, uint opCode, uint data0, void* data1, void* data2)
|
|
||||||
{
|
|
||||||
assert(&plugin == aPlugin);
|
|
||||||
coeditPlug* plg = (cast(coeditPlug*) aPlugin);
|
|
||||||
|
|
||||||
auto emit = opCode.getEmiter;
|
|
||||||
auto ctxt = opCode.getContext;
|
|
||||||
auto comd = opCode.getCommand;
|
|
||||||
|
|
||||||
if (emit == HOST_EVENT)
|
|
||||||
plg.hostEvent(ctxt, comd);
|
|
||||||
else
|
|
||||||
plg.hostData(ctxt, comd, data0, data1, data2);
|
|
||||||
}
|
|
||||||
|
|
||||||
version(Posix)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
__gshared HINSTANCE g_hInst;
|
|
||||||
|
|
||||||
extern (Windows)
|
|
||||||
BOOL DllMain(HINSTANCE hInstance, ULONG ulReason, LPVOID pvReserved)
|
|
||||||
{
|
|
||||||
switch (ulReason)
|
|
||||||
{
|
|
||||||
case DLL_PROCESS_ATTACH:
|
|
||||||
g_hInst = hInstance;
|
|
||||||
dll_process_attach( hInstance, true );
|
|
||||||
break;
|
|
||||||
|
|
||||||
case DLL_PROCESS_DETACH:
|
|
||||||
dll_process_detach( hInstance, true );
|
|
||||||
break;
|
|
||||||
|
|
||||||
case DLL_THREAD_ATTACH:
|
|
||||||
dll_thread_attach( true, true );
|
|
||||||
break;
|
|
||||||
|
|
||||||
case DLL_THREAD_DETACH:
|
|
||||||
dll_thread_detach( true, true );
|
|
||||||
break;
|
|
||||||
|
|
||||||
default: break;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -140,7 +140,7 @@
|
||||||
<PackageName Value="LCL"/>
|
<PackageName Value="LCL"/>
|
||||||
</Item6>
|
</Item6>
|
||||||
</RequiredPackages>
|
</RequiredPackages>
|
||||||
<Units Count="36">
|
<Units Count="34">
|
||||||
<Unit0>
|
<Unit0>
|
||||||
<Filename Value="coedit.lpr"/>
|
<Filename Value="coedit.lpr"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
|
@ -245,124 +245,114 @@
|
||||||
<UnitName Value="ce_options"/>
|
<UnitName Value="ce_options"/>
|
||||||
</Unit16>
|
</Unit16>
|
||||||
<Unit17>
|
<Unit17>
|
||||||
<Filename Value="..\src\ce_plugin.pas"/>
|
|
||||||
<IsPartOfProject Value="True"/>
|
|
||||||
<UnitName Value="ce_plugin"/>
|
|
||||||
</Unit17>
|
|
||||||
<Unit18>
|
|
||||||
<Filename Value="..\src\ce_procinput.pas"/>
|
<Filename Value="..\src\ce_procinput.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<ComponentName Value="CEProcInputWidget"/>
|
<ComponentName Value="CEProcInputWidget"/>
|
||||||
<HasResources Value="True"/>
|
<HasResources Value="True"/>
|
||||||
<ResourceBaseClass Value="Form"/>
|
<ResourceBaseClass Value="Form"/>
|
||||||
<UnitName Value="ce_procinput"/>
|
<UnitName Value="ce_procinput"/>
|
||||||
</Unit18>
|
</Unit17>
|
||||||
<Unit19>
|
<Unit18>
|
||||||
<Filename Value="..\src\ce_projconf.pas"/>
|
<Filename Value="..\src\ce_projconf.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<ComponentName Value="CEProjectConfigurationWidget"/>
|
<ComponentName Value="CEProjectConfigurationWidget"/>
|
||||||
<HasResources Value="True"/>
|
<HasResources Value="True"/>
|
||||||
<ResourceBaseClass Value="Form"/>
|
<ResourceBaseClass Value="Form"/>
|
||||||
<UnitName Value="ce_projconf"/>
|
<UnitName Value="ce_projconf"/>
|
||||||
</Unit19>
|
</Unit18>
|
||||||
<Unit20>
|
<Unit19>
|
||||||
<Filename Value="..\src\ce_project.pas"/>
|
<Filename Value="..\src\ce_project.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<UnitName Value="ce_project"/>
|
<UnitName Value="ce_project"/>
|
||||||
</Unit20>
|
</Unit19>
|
||||||
<Unit21>
|
<Unit20>
|
||||||
<Filename Value="..\src\ce_projinspect.pas"/>
|
<Filename Value="..\src\ce_projinspect.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<ComponentName Value="CEProjectInspectWidget"/>
|
<ComponentName Value="CEProjectInspectWidget"/>
|
||||||
<HasResources Value="True"/>
|
<HasResources Value="True"/>
|
||||||
<ResourceBaseClass Value="Form"/>
|
<ResourceBaseClass Value="Form"/>
|
||||||
<UnitName Value="ce_projinspect"/>
|
<UnitName Value="ce_projinspect"/>
|
||||||
</Unit21>
|
</Unit20>
|
||||||
<Unit22>
|
<Unit21>
|
||||||
<Filename Value="..\src\ce_search.pas"/>
|
<Filename Value="..\src\ce_search.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<ComponentName Value="CESearchWidget"/>
|
<ComponentName Value="CESearchWidget"/>
|
||||||
<HasResources Value="True"/>
|
<HasResources Value="True"/>
|
||||||
<ResourceBaseClass Value="Form"/>
|
<ResourceBaseClass Value="Form"/>
|
||||||
<UnitName Value="ce_search"/>
|
<UnitName Value="ce_search"/>
|
||||||
</Unit22>
|
</Unit21>
|
||||||
<Unit23>
|
<Unit22>
|
||||||
<Filename Value="..\src\ce_staticexplorer.pas"/>
|
<Filename Value="..\src\ce_staticexplorer.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<ComponentName Value="CEStaticExplorerWidget"/>
|
<ComponentName Value="CEStaticExplorerWidget"/>
|
||||||
<HasResources Value="True"/>
|
<HasResources Value="True"/>
|
||||||
<ResourceBaseClass Value="Form"/>
|
<ResourceBaseClass Value="Form"/>
|
||||||
<UnitName Value="ce_staticexplorer"/>
|
<UnitName Value="ce_staticexplorer"/>
|
||||||
</Unit23>
|
</Unit22>
|
||||||
<Unit24>
|
<Unit23>
|
||||||
<Filename Value="..\src\ce_staticmacro.pas"/>
|
<Filename Value="..\src\ce_staticmacro.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<UnitName Value="ce_staticmacro"/>
|
<UnitName Value="ce_staticmacro"/>
|
||||||
</Unit24>
|
</Unit23>
|
||||||
<Unit25>
|
<Unit24>
|
||||||
<Filename Value="..\src\ce_symstring.pas"/>
|
<Filename Value="..\src\ce_symstring.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<UnitName Value="ce_symstring"/>
|
<UnitName Value="ce_symstring"/>
|
||||||
</Unit25>
|
</Unit24>
|
||||||
<Unit26>
|
<Unit25>
|
||||||
<Filename Value="..\src\ce_synmemo.pas"/>
|
<Filename Value="..\src\ce_synmemo.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<UnitName Value="ce_synmemo"/>
|
<UnitName Value="ce_synmemo"/>
|
||||||
</Unit26>
|
</Unit25>
|
||||||
<Unit27>
|
<Unit26>
|
||||||
<Filename Value="..\src\ce_tools.pas"/>
|
<Filename Value="..\src\ce_tools.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<UnitName Value="ce_tools"/>
|
<UnitName Value="ce_tools"/>
|
||||||
</Unit27>
|
</Unit26>
|
||||||
<Unit28>
|
<Unit27>
|
||||||
<Filename Value="..\src\ce_toolseditor.pas"/>
|
<Filename Value="..\src\ce_toolseditor.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<ComponentName Value="CEToolsEditorWidget"/>
|
<ComponentName Value="CEToolsEditorWidget"/>
|
||||||
<HasResources Value="True"/>
|
<HasResources Value="True"/>
|
||||||
<ResourceBaseClass Value="Form"/>
|
<ResourceBaseClass Value="Form"/>
|
||||||
<UnitName Value="ce_toolseditor"/>
|
<UnitName Value="ce_toolseditor"/>
|
||||||
</Unit28>
|
</Unit27>
|
||||||
<Unit29>
|
<Unit28>
|
||||||
<Filename Value="..\src\ce_txtsyn.pas"/>
|
<Filename Value="..\src\ce_txtsyn.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<UnitName Value="ce_txtsyn"/>
|
<UnitName Value="ce_txtsyn"/>
|
||||||
</Unit29>
|
</Unit28>
|
||||||
<Unit30>
|
<Unit29>
|
||||||
<Filename Value="..\src\ce_widget.pas"/>
|
<Filename Value="..\src\ce_widget.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<ComponentName Value="CEWidget"/>
|
<ComponentName Value="CEWidget"/>
|
||||||
<HasResources Value="True"/>
|
<HasResources Value="True"/>
|
||||||
<ResourceBaseClass Value="Form"/>
|
<ResourceBaseClass Value="Form"/>
|
||||||
<UnitName Value="ce_widget"/>
|
<UnitName Value="ce_widget"/>
|
||||||
</Unit30>
|
</Unit29>
|
||||||
<Unit31>
|
<Unit30>
|
||||||
<Filename Value="..\src\ce_writablecomponent.pas"/>
|
<Filename Value="..\src\ce_writablecomponent.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<UnitName Value="ce_writableComponent"/>
|
<UnitName Value="ce_writableComponent"/>
|
||||||
</Unit31>
|
</Unit30>
|
||||||
<Unit32>
|
<Unit31>
|
||||||
<Filename Value="..\src\ce_icons.pas"/>
|
<Filename Value="..\src\ce_icons.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<UnitName Value="ce_icons"/>
|
<UnitName Value="ce_icons"/>
|
||||||
</Unit32>
|
</Unit31>
|
||||||
<Unit33>
|
<Unit32>
|
||||||
<Filename Value="..\src\ce_todolist.pas"/>
|
<Filename Value="..\src\ce_todolist.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<ComponentName Value="CETodoListWidget"/>
|
<ComponentName Value="CETodoListWidget"/>
|
||||||
<HasResources Value="True"/>
|
<HasResources Value="True"/>
|
||||||
<ResourceBaseClass Value="Form"/>
|
<ResourceBaseClass Value="Form"/>
|
||||||
<UnitName Value="ce_todolist"/>
|
<UnitName Value="ce_todolist"/>
|
||||||
</Unit33>
|
</Unit32>
|
||||||
<Unit34>
|
<Unit33>
|
||||||
<Filename Value="..\src\ce_dubwrap.pas"/>
|
|
||||||
<IsPartOfProject Value="True"/>
|
|
||||||
<UnitName Value="ce_dubwrap"/>
|
|
||||||
</Unit34>
|
|
||||||
<Unit35>
|
|
||||||
<Filename Value="..\src\ce_inspectors.pas"/>
|
<Filename Value="..\src\ce_inspectors.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<UnitName Value="ce_inspectors"/>
|
<UnitName Value="ce_inspectors"/>
|
||||||
</Unit35>
|
</Unit33>
|
||||||
</Units>
|
</Units>
|
||||||
</ProjectOptions>
|
</ProjectOptions>
|
||||||
<CompilerOptions>
|
<CompilerOptions>
|
||||||
|
|
|
@ -8,7 +8,7 @@ uses
|
||||||
{$ENDIF}{$ENDIF}
|
{$ENDIF}{$ENDIF}
|
||||||
Interfaces, Forms, lazcontrols, runtimetypeinfocontrols, ce_observer, ce_libman,
|
Interfaces, Forms, lazcontrols, runtimetypeinfocontrols, ce_observer, ce_libman,
|
||||||
ce_tools, ce_dcd, ce_main, ce_writableComponent, ce_options, ce_symstring,
|
ce_tools, ce_dcd, ce_main, ce_writableComponent, ce_options, ce_symstring,
|
||||||
ce_staticmacro, ce_icons, ce_dubwrap, ce_inspectors;
|
ce_staticmacro, ce_icons, ce_inspectors;
|
||||||
|
|
||||||
{$R *.res}
|
{$R *.res}
|
||||||
|
|
||||||
|
|
113
src/ce_main.pas
113
src/ce_main.pas
|
@ -183,7 +183,6 @@ type
|
||||||
fProject: TCEProject;
|
fProject: TCEProject;
|
||||||
fProjMru: TMruFileList;
|
fProjMru: TMruFileList;
|
||||||
fFileMru: TMruFileList;
|
fFileMru: TMruFileList;
|
||||||
fPlugList: TCEPlugDescriptorList;
|
|
||||||
fWidgList: TCEWidgetList;
|
fWidgList: TCEWidgetList;
|
||||||
fMesgWidg: TCEMessagesWidget;
|
fMesgWidg: TCEMessagesWidget;
|
||||||
fEditWidg: TCEEditorWidget;
|
fEditWidg: TCEEditorWidget;
|
||||||
|
@ -234,13 +233,11 @@ type
|
||||||
procedure checkCompilo;
|
procedure checkCompilo;
|
||||||
procedure InitMRUs;
|
procedure InitMRUs;
|
||||||
procedure InitWidgets;
|
procedure InitWidgets;
|
||||||
procedure InitPlugins;
|
|
||||||
procedure InitDocking;
|
procedure InitDocking;
|
||||||
procedure InitSettings;
|
procedure InitSettings;
|
||||||
procedure SaveSettings;
|
procedure SaveSettings;
|
||||||
procedure LoadDocking;
|
procedure LoadDocking;
|
||||||
procedure SaveDocking;
|
procedure SaveDocking;
|
||||||
procedure KillPlugs;
|
|
||||||
procedure FreeRunnableProc;
|
procedure FreeRunnableProc;
|
||||||
|
|
||||||
// widget interfaces subroutines
|
// widget interfaces subroutines
|
||||||
|
@ -288,8 +285,6 @@ type
|
||||||
property processInput: TCEProcInputWidget read fPrInpWidg;
|
property processInput: TCEProcInputWidget read fPrInpWidg;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure PlugDispatchToHost(aPlugin: TCEPlugin; opCode: LongWord; data0: Integer; data1, data2: Pointer); cdecl;
|
|
||||||
|
|
||||||
var
|
var
|
||||||
CEMainForm: TCEMainForm;
|
CEMainForm: TCEMainForm;
|
||||||
|
|
||||||
|
@ -369,9 +364,6 @@ begin
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
value := application.GetOptionValue('plugs');
|
|
||||||
if value <> 'OFF' then
|
|
||||||
InitPlugins;
|
|
||||||
value := application.GetOptionValue('p', 'project');
|
value := application.GetOptionValue('p', 'project');
|
||||||
if (value <> '') and fileExists(value) then
|
if (value <> '') and fileExists(value) then
|
||||||
openProj(value);
|
openProj(value);
|
||||||
|
@ -402,53 +394,6 @@ begin
|
||||||
fFileMru.OnChange := @mruChange;
|
fFileMru.OnChange := @mruChange;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCEMainForm.InitPlugins;
|
|
||||||
var
|
|
||||||
pth: string;
|
|
||||||
fname: string;
|
|
||||||
i: NativeInt;
|
|
||||||
lst: TStringList;
|
|
||||||
hdl: TLibHandle;
|
|
||||||
plg: PPlugDescriptor;
|
|
||||||
begin
|
|
||||||
fPlugList := TCEPlugDescriptorList.Create;
|
|
||||||
pth := extractFilePath(application.ExeName) + 'plugins';
|
|
||||||
lst := TStringList.Create;
|
|
||||||
try
|
|
||||||
listFiles(lst, pth, false);
|
|
||||||
for i := 0 to lst.Count-1 do
|
|
||||||
begin
|
|
||||||
fname := lst.Strings[i];
|
|
||||||
if extractFileExt(fname) <> '.' + SharedSuffix then
|
|
||||||
continue;
|
|
||||||
hdl := LoadLibrary(fname);
|
|
||||||
if hdl = NilHandle then
|
|
||||||
continue;
|
|
||||||
|
|
||||||
plg := new(PPlugDescriptor);
|
|
||||||
plg^.Handle := hdl;
|
|
||||||
plg^.HostCreatePlug := THostCreatePlug(GetProcAddress(hdl, 'createPlug'));
|
|
||||||
plg^.HostDestroyPlug := THostDestroyPlug(GetProcAddress(hdl, 'destroyPlug'));
|
|
||||||
plg^.HostDispatchToPlug := THostDispatchToPlug(GetProcAddress(hdl, 'dispatchToPlug'));
|
|
||||||
if plg^.HostCreatePlug <> nil then
|
|
||||||
plg^.Plugin := plg^.HostCreatePlug(@PlugDispatchToHost);
|
|
||||||
|
|
||||||
if (plg^.HostCreatePlug = nil) or (plg^.HostDestroyPlug = nil) or
|
|
||||||
(plg^.HostDispatchToPlug = nil) then
|
|
||||||
begin
|
|
||||||
Dispose(plg);
|
|
||||||
{$IFDEF RELEASE}
|
|
||||||
FreeLibrary(Hdl);
|
|
||||||
{$ENDIF}
|
|
||||||
continue;
|
|
||||||
end;
|
|
||||||
fPlugList.addPlugin(plg);
|
|
||||||
end;
|
|
||||||
finally
|
|
||||||
lst.Free;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TCEMainForm.InitWidgets;
|
procedure TCEMainForm.InitWidgets;
|
||||||
var
|
var
|
||||||
widg: TCEWidget;
|
widg: TCEWidget;
|
||||||
|
@ -669,28 +614,6 @@ begin
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCEMainForm.KillPlugs;
|
|
||||||
var
|
|
||||||
descr: TPlugDescriptor;
|
|
||||||
i: NativeInt;
|
|
||||||
begin
|
|
||||||
if fPlugList = nil then exit;
|
|
||||||
for i := 0 to fPlugList.Count-1 do
|
|
||||||
begin
|
|
||||||
descr := fPlugList.plugin[i];
|
|
||||||
descr.HostDestroyPlug(descr.Plugin);
|
|
||||||
{$IFDEF RELEASE}
|
|
||||||
FreeLibrary(descr.Handle);
|
|
||||||
{$ENDIF}
|
|
||||||
end;
|
|
||||||
while fPlugList.Count <> 0 do
|
|
||||||
begin
|
|
||||||
Dispose(PPlugDescriptor(fPlugList.Items[fPlugList.Count-1]));
|
|
||||||
fPlugList.Delete(fPlugList.Count-1);
|
|
||||||
end;
|
|
||||||
fPlugList.Free;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TCEMainForm.FreeRunnableProc;
|
procedure TCEMainForm.FreeRunnableProc;
|
||||||
var
|
var
|
||||||
fname: string;
|
fname: string;
|
||||||
|
@ -710,8 +633,6 @@ destructor TCEMainForm.destroy;
|
||||||
begin
|
begin
|
||||||
SaveSettings;
|
SaveSettings;
|
||||||
//
|
//
|
||||||
KillPlugs;
|
|
||||||
//
|
|
||||||
fWidgList.Free;
|
fWidgList.Free;
|
||||||
fProjMru.Free;
|
fProjMru.Free;
|
||||||
fFileMru.Free;
|
fFileMru.Free;
|
||||||
|
@ -1782,40 +1703,6 @@ begin
|
||||||
end;
|
end;
|
||||||
{$ENDREGION}
|
{$ENDREGION}
|
||||||
|
|
||||||
procedure PlugDispatchToHost(aPlugin: TCEPlugin; opCode: LongWord; data0: Integer; data1, data2: Pointer); cdecl;
|
|
||||||
//var
|
|
||||||
//ctxt: NativeUint;
|
|
||||||
//oper: NativeUint;
|
|
||||||
begin
|
|
||||||
|
|
||||||
if opCode = HELLO_PLUGIN then begin
|
|
||||||
dlgOkInfo('Hello plugin');
|
|
||||||
exit;
|
|
||||||
end;
|
|
||||||
{
|
|
||||||
ctxt := opCode and $0F000000;
|
|
||||||
oper := opCode and $000FFFFF;
|
|
||||||
|
|
||||||
case ctxt of
|
|
||||||
CTXT_MSGS:
|
|
||||||
case oper of
|
|
||||||
//DT_ERR: CEMainForm.MessageWidget.addCeErr(PChar(data1));
|
|
||||||
//DT_INF: CEMainForm.MessageWidget.addCeInf(PChar(data1));
|
|
||||||
//DT_WARN: CEMainForm.MessageWidget.addCeWarn(PChar(data1));
|
|
||||||
//else CEMainForm.MessageWidget.addCeWarn('unsupported dispatcher opCode');
|
|
||||||
end;
|
|
||||||
CTXT_DLGS:
|
|
||||||
case oper of
|
|
||||||
DT_ERR: dlgOkError(PChar(data1));
|
|
||||||
DT_INF: dlgOkInfo(PChar(data1));
|
|
||||||
DT_WARN: dlgOkInfo(PChar(data1));
|
|
||||||
//else CEMainForm.MessageWidget.addCeWarn('unsupported dispatcher opCode');
|
|
||||||
end;
|
|
||||||
//else CEMainForm.MessageWidget.addCeWarn('unsupported dispatcher opCode');
|
|
||||||
end;}
|
|
||||||
|
|
||||||
end;
|
|
||||||
|
|
||||||
initialization
|
initialization
|
||||||
RegisterClasses([TCEOptions]);
|
RegisterClasses([TCEOptions]);
|
||||||
end.
|
end.
|
||||||
|
|
Loading…
Reference in New Issue