Exemplo n.º 1
0
bool TVPAcceptSaveAsTLG(void* formatdata, const ttstr & type, class iTJSDispatch2** dic )
{
    bool result = false;
    if( type.StartsWith(TJS_W("tlg")) ) result = true;
    else if( type == TJS_W(".tlg") ) result = true;
    else if( type == TJS_W(".tlg5") ) result = true;
    else if( type == TJS_W(".tlg6") ) result = true;
    if( result && dic ) {
        // mode : select text : opaque, alpha, add, sub, mul, dodge, darken, lighten, screen, addalpha
        //        psnormal, psadd, pssub, psmul, psscreen, psoverlay, pshlight, psslight, psdodge
        //        psdodge5, psburn, pslighten, psdarken, psdiff, psdiff5, psexcl, opaque
        // offs_x : integer
        // offs_y : integer
        // offs_unit : select text : pixel
        tTJSVariant result;
        TVPExecuteExpression(
            TJS_W("(const)%[")
            TJS_W("\"mode\"=>(const)%[\"type\"=>\"select text\",\"items\"=>")
            TJS_W("(const)[\"opaque\", \"alpha\", \"add\", \"sub\", \"mul\", \"dodge\", \"darken\", \"lighten\", \"screen\", \"addalpha\",")
            TJS_W("\"psnormal\", \"psadd\", \"pssub\", \"psmul\", \"psscreen\", \"psoverlay\", \"pshlight\", \"psslight\", \"psdodge\",")
            TJS_W("\"psdodge5\", \"psburn\", \"pslighten\", \"psdarken\", \"psdiff\", \"psdiff5\", \"psexcl\", \"opaque\"],")
            TJS_W("\"desc\"=>\"blending mode\",\"default\"=>\"alpha\"],")

            TJS_W("\"offs_x\"=>(const)%[\"type\"=>\"integer\",\"desc\"=>\"offset x\",\"default\"=>0],")
            TJS_W("\"offs_y\"=>(const)%[\"type\"=>\"integer\",\"desc\"=>\"offset y\",\"default\"=>0],")
            TJS_W("\"offs_unit\"=>(const)%[\"type\"=>\"select text\",\"items\"=>(const)[\"pixel\"],\"desc\"=>\"offset unit\",\"default\"=>\"pixel\"]")
            TJS_W("]"),
            NULL, &result );
        if( result.Type() == tvtObject ) {
            *dic = result.AsObject();
        }
    }
    return result;
}