summaryrefslogtreecommitdiff
path: root/Plugins/skins/SkinLib/V8Script.cpp
diff options
context:
space:
mode:
authorpescuma <pescuma@c086bb3d-8645-0410-b8da-73a8550f86e7>2009-01-24 17:15:14 +0000
committerpescuma <pescuma@c086bb3d-8645-0410-b8da-73a8550f86e7>2009-01-24 17:15:14 +0000
commitff31a97b260e955c7af6b88fe4d606282160073d (patch)
tree0947e28235d7e773803039d41316eefea3b8eb02 /Plugins/skins/SkinLib/V8Script.cpp
parentde4ef8a65afd0c38f8bbdfcb3b90ff82a98d1483 (diff)
skins: 0.0.0.2
* Fix for float numbers + Added valign (not used yet) + Added dialog info (allow clients to set script variables starting with info) + The zip will contain also the pdbs (at least until it is more stable) git-svn-id: http://pescuma.googlecode.com/svn/trunk/Miranda@134 c086bb3d-8645-0410-b8da-73a8550f86e7
Diffstat (limited to 'Plugins/skins/SkinLib/V8Script.cpp')
-rw-r--r--Plugins/skins/SkinLib/V8Script.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/Plugins/skins/SkinLib/V8Script.cpp b/Plugins/skins/SkinLib/V8Script.cpp
index ff31443..c761918 100644
--- a/Plugins/skins/SkinLib/V8Script.cpp
+++ b/Plugins/skins/SkinLib/V8Script.cpp
@@ -46,6 +46,7 @@ bool V8Script::compile(const TCHAR *source, Dialog *dlg)
context->Global()->Set(String::New("window"), wrappers->newDialogState(), ReadOnly);
context->Global()->Set(String::New("opts"), wrappers->newOptions(), ReadOnly);
+ context->Global()->Set(String::New("info"), wrappers->newDialogInfo(), ReadOnly);
for(unsigned int i = 0; i < dlg->getFieldCount(); i++)
{
Field *field = dlg->getField(i);
@@ -115,11 +116,12 @@ static Handle<Object> get(Handle<Object> obj, const char *field)
return scope.Close( Handle<Object>::Cast(v) );
}
-void V8Script::fillWrappers(DialogState *state, SkinOptions *opts, bool configure)
+void V8Script::fillWrappers(DialogState *state, SkinOptions *opts, DialogInfo *info, bool configure)
{
Local<Object> global = context->Global();
wrappers->fillOptions(get(global, "opts"), opts, configure);
wrappers->fillDialogState(get(global, "window"), state);
+ wrappers->fillDialogInfo(get(global, "info"), info);
for(unsigned int i = 0; i < state->fields.size(); i++)
{
FieldState *field = state->fields[i];
@@ -141,7 +143,7 @@ std::pair<SkinOptions *,DialogState *> V8Script::configure(Dialog *dlg)
Context::Scope context_scope(context);
- fillWrappers(state, opts, true);
+ fillWrappers(state, opts, dlg->getInfo(), true);
TryCatch try_catch;
Handle<Value> result = configureFunction->Call(context->Global(), 0, NULL);
@@ -157,7 +159,7 @@ std::pair<SkinOptions *,DialogState *> V8Script::configure(Dialog *dlg)
return std::pair<SkinOptions *,DialogState *>(opts, state);
}
-bool V8Script::run(DialogState * state, SkinOptions *opts)
+bool V8Script::run(DialogState * state, SkinOptions *opts, DialogInfo *info)
{
if (!isValid())
return false;
@@ -166,7 +168,7 @@ bool V8Script::run(DialogState * state, SkinOptions *opts)
Context::Scope context_scope(context);
- fillWrappers(state, opts, false);
+ fillWrappers(state, opts, info, false);
TryCatch try_catch;
Handle<Value> result = drawFunction->Call(context->Global(), 0, NULL);