Example #1
0
CHEWING_API void chewing_cand_Enumerate(ChewingContext *ctx)
{
    ChewingData *pgdata;

    if (!ctx) {
        return;
    }
    pgdata = ctx->data;

    LOG_API("");

    ctx->cand_no = ctx->output->pci->pageNo * ctx->output->pci->nChoicePerPage;
}
Example #2
0
CHEWING_API int chewing_cand_TotalChoice(const ChewingContext *ctx)
{
    const ChewingData *pgdata;

    if (!ctx) {
        return -1;
    }
    pgdata = ctx->data;

    LOG_API("");

    return (ctx->output->pci ? ctx->output->pci->nTotalChoice : 0);
}
Example #3
0
CHEWING_API int chewing_cand_CurrentPage(const ChewingContext *ctx)
{
    const ChewingData *pgdata;

    if (!ctx) {
        return -1;
    }
    pgdata = ctx->data;

    LOG_API("");

    return (ctx->output->pci ? ctx->output->pci->pageNo : -1);
}
Example #4
0
CHEWING_API int chewing_cand_CheckDone(const ChewingContext *ctx)
{
    const ChewingData *pgdata;

    if (!ctx) {
        return -1;
    }
    pgdata = ctx->data;

    LOG_API("");

    return (!ctx->output->pci);
}
Example #5
0
CHEWING_API int chewing_cursor_Current(const ChewingContext *ctx)
{
    const ChewingData *pgdata;

    if (!ctx) {
        return -1;
    }
    pgdata = ctx->data;

    LOG_API("");

    return (ctx->output->chiSymbolCursor);
}
Example #6
0
CHEWING_API int chewing_bopomofo_Check(const ChewingContext *ctx)
{
    const ChewingData *pgdata;

    if (!ctx) {
        return -1;
    }
    pgdata = ctx->data;

    LOG_API("");

    return ctx->output->bopomofoBuf[0] != 0;
}
Example #7
0
CHEWING_API int chewing_cand_hasNext(ChewingContext *ctx)
{
    ChewingData *pgdata;

    if (!ctx) {
        return -1;
    }
    pgdata = ctx->data;

    LOG_API("");

    return (ctx->cand_no < ctx->output->pci->nTotalChoice);
}
Example #8
0
CHEWING_API int chewing_aux_Length(const ChewingContext *ctx)
{
    const ChewingData *pgdata;

    if (!ctx) {
        return -1;
    }
    pgdata = ctx->data;

    LOG_API("");

    return (ctx->data->bShowMsg ? ctx->data->showMsgLen : 0);
}
Example #9
0
CHEWING_API char *chewing_buffer_String(const ChewingContext *ctx)
{
    const ChewingData *pgdata;

    if (!ctx) {
        return strdup("");
    }
    pgdata = ctx->data;

    LOG_API("");

    return strdup(ctx->output->preeditBuf);
}
Example #10
0
CHEWING_API const char *chewing_aux_String_static(const ChewingContext *ctx)
{
    const ChewingData *pgdata;

    if (!ctx) {
        return "";
    }
    pgdata = ctx->data;

    LOG_API("");

    return ctx->data->showMsg;
}
Example #11
0
/**
 * @param ctx handle to Chewing IM context
 * @retval TRUE if it currnet input state is at the "end-of-a-char"
 */
CHEWING_API int chewing_commit_Check(const ChewingContext *ctx)
{
    const ChewingData *pgdata;

    if (!ctx) {
        return -1;
    }
    pgdata = ctx->data;

    LOG_API("");

    return ! !(ctx->output->keystrokeRtn & KEYSTROKE_COMMIT);
}
Example #12
0
CHEWING_API char *chewing_aux_String(const ChewingContext *ctx)
{
    const ChewingData *pgdata;

    if (!ctx) {
        return strdup("");
    }
    pgdata = ctx->data;

    LOG_API("");

    return strdup(chewing_aux_String_static(ctx));
}
Example #13
0
CHEWING_API int chewing_aux_Check(const ChewingContext *ctx)
{
    const ChewingData *pgdata;

    if (!ctx) {
        return -1;
    }
    pgdata = ctx->data;

    LOG_API("");

    return (ctx->data->bShowMsg);
}
Example #14
0
/**
 * @param ctx handle to Chewing IM context
 *
 * Alwasy returns a const char pointer, you have to clone them immediately,
 * if you need.
 */
CHEWING_API const char *chewing_bopomofo_String_static(const ChewingContext *ctx)
{
    const ChewingData *pgdata;

    if (!ctx) {
        return "";
    }
    pgdata = ctx->data;

    LOG_API("");

    return ctx->output->bopomofoBuf;
}
Example #15
0
CHEWING_API int chewing_interval_hasNext(ChewingContext *ctx)
{
    ChewingData *pgdata;

    if (!ctx) {
        return -1;
    }
    pgdata = ctx->data;

    LOG_API("");

    return (ctx->it_no < ctx->output->nDispInterval);
}
Example #16
0
CHEWING_API void chewing_interval_Enumerate(ChewingContext *ctx)
{
    ChewingData *pgdata;

    if (!ctx) {
        return;
    }
    pgdata = ctx->data;

    LOG_API("");

    ctx->it_no = 0;
}
Example #17
0
HRESULT HookIDirect3DDevice9::CreateVolumeTexture(LPVOID _this,
												  UINT Width,
												  UINT Height,
												  UINT Depth,
												  UINT Levels,
												  DWORD Usage,
												  D3DFORMAT Format,
												  D3DPOOL Pool,
												  IDirect3DVolumeTexture9** ppVolumeTexture,
												  HANDLE* pSharedHandle)
{
	LOG_API();
	return pD3Dev->CreateVolumeTexture(Width, Height, Depth, Levels, Usage, Format, Pool, ppVolumeTexture, pSharedHandle);
}
static jint
nContextPeekMessage(JNIEnv *_env, jobject _this, RsContext con, jintArray auxData)
{
    LOG_API("nContextPeekMessage, con(%p)", con);
    jint *auxDataPtr = _env->GetIntArrayElements(auxData, NULL);
    size_t receiveLen;
    uint32_t subID;
    int id = dispatchTab.ContextPeekMessage(con, &receiveLen, sizeof(receiveLen),
                                  &subID, sizeof(subID));
    auxDataPtr[0] = (jint)subID;
    auxDataPtr[1] = (jint)receiveLen;
    _env->ReleaseIntArrayElements(auxData, auxDataPtr, 0);
    return id;
}
static void
nContextSendMessage(JNIEnv *_env, jobject _this, RsContext con, jint id, jintArray data)
{
    jint *ptr = NULL;
    jint len = 0;
    if (data) {
        len = _env->GetArrayLength(data);
        jint *ptr = _env->GetIntArrayElements(data, NULL);
    }
    LOG_API("nContextSendMessage, con(%p), id(%i), len(%i)", con, id, len);
    dispatchTab.ContextSendMessage(con, id, (const uint8_t *)ptr, len * sizeof(int));
    if (data) {
        _env->ReleaseIntArrayElements(data, ptr, JNI_ABORT);
    }
}
static void
nScriptSetTimeZone(JNIEnv *_env, jobject _this, RsContext con, jint script, jbyteArray timeZone)
{
    LOG_API("nScriptCSetTimeZone, con(%p), s(%p), timeZone(%s)", con, (void *)script, (const char *)timeZone);

    jint length = _env->GetArrayLength(timeZone);
    jbyte* timeZone_ptr;
    timeZone_ptr = (jbyte *) _env->GetPrimitiveArrayCritical(timeZone, (jboolean *)0);

    dispatchTab.ScriptSetTimeZone(con, (RsScript)script, (const char *)timeZone_ptr, length);

    if (timeZone_ptr) {
        _env->ReleasePrimitiveArrayCritical(timeZone, timeZone_ptr, 0);
    }
}
Example #21
0
HRESULT HookIDirect3DDevice9::CreateDepthStencilSurface(LPVOID _this,
														UINT Width,
														UINT Height,
														D3DFORMAT Format,
														D3DMULTISAMPLE_TYPE MultiSample,
														DWORD MultisampleQuality,
														BOOL Discard,
														IDirect3DSurface9** ppSurface,
														HANDLE* pSharedHandle)
{
	LOG_API();
	//Width *= 2;
	//Height *= 2;
	return pD3Dev->CreateDepthStencilSurface(Width, Height, Format, MultiSample, MultisampleQuality, Discard, ppSurface, pSharedHandle);
}
static jint
nScriptCCreate(JNIEnv *_env, jobject _this, RsContext con,
               jstring resName, jstring cacheDir,
               jbyteArray scriptRef, jint length)
{
    LOG_API("nScriptCCreate, con(%p)", con);

    AutoJavaStringToUTF8 resNameUTF(_env, resName);
    AutoJavaStringToUTF8 cacheDirUTF(_env, cacheDir);
    jint ret = 0;
    jbyte* script_ptr = NULL;
    jint _exception = 0;
    jint remaining;
    if (!scriptRef) {
        _exception = 1;
        //jniThrowException(_env, "java/lang/IllegalArgumentException", "script == null");
        goto exit;
    }
    if (length < 0) {
        _exception = 1;
        //jniThrowException(_env, "java/lang/IllegalArgumentException", "length < 0");
        goto exit;
    }
    remaining = _env->GetArrayLength(scriptRef);
    if (remaining < length) {
        _exception = 1;
        //jniThrowException(_env, "java/lang/IllegalArgumentException",
        //        "length > script.length - offset");
        goto exit;
    }
    script_ptr = (jbyte *)
        _env->GetPrimitiveArrayCritical(scriptRef, (jboolean *)0);

    //rsScriptCSetText(con, (const char *)script_ptr, length);

    ret = (jint)dispatchTab.ScriptCCreate(con,
                                resNameUTF.c_str(), resNameUTF.length(),
                                cacheDirUTF.c_str(), cacheDirUTF.length(),
                                (const char *)script_ptr, length);

exit:
    if (script_ptr) {
        _env->ReleasePrimitiveArrayCritical(scriptRef, script_ptr,
                _exception ? JNI_ABORT: 0);
    }

    return ret;
}
Example #23
0
int SingerList::keyPressEvent(QObject * obj, QKeyEvent * event)
{
    LOG_API();
    static QWidget * fakeFocus = singerIcon[0];
    int        new_idx = cur_idx;
    LOG_VERBOSE("cur hlt idx %d.\n", cur_idx);
    switch(event->key())
    {
        case Qt::Key_Select:
        case Qt::Key_Return:
            slotSingerSelected();
            return OK;
        case Qt::Key_Back:
        case Qt::Key_Escape:
            slotReturnButton();
            return OK;
        case Qt::Key_MediaPrevious:
            slotPagePrev();
            return OK;
        case Qt::Key_MediaNext:
            slotPageNext();
            return OK;
        case Qt::Key_Up:
            new_idx = abs(cur_idx-4)%8;
            break;
        case Qt::Key_Down:
            new_idx = (cur_idx+4)%8;
            break;
        case Qt::Key_Left:
            new_idx = abs(cur_idx-1)%8;
            break;
        case Qt::Key_Right:
            new_idx = (cur_idx+1)%8;
            break;
        default:
            break;
    }
    LOG_VERBOSE("new hlt idx %d.\n", new_idx);

    singerIcon[cur_idx]->highlight(false);
    singerIcon[new_idx]->highlight(true);
    fakeFocus = singerIcon[new_idx];
    cur_idx = new_idx;

    return OK;
}
Example #24
0
HRESULT HookIDirect3DDevice9::CreateRenderTarget(LPVOID _this,
												 UINT Width,
												 UINT Height,
												 D3DFORMAT Format,
												 D3DMULTISAMPLE_TYPE MultiSample,
												 DWORD MultisampleQuality,
												 BOOL Lockable,
												 IDirect3DSurface9** ppSurface,
												 HANDLE* pSharedHandle)
{
	LOG_API();
	logmsg("CreateRenderTarget: %dx%d\n", Width, Height);
	//Width *= 2;
	//Height *= 2;
	
	return pD3Dev->CreateRenderTarget(Width, Height, Format, MultiSample, MultisampleQuality, Lockable, ppSurface, pSharedHandle);
}
Example #25
0
Background::Background(QWidget * parent)
    : QWidget(parent)
{

    LOG_API();

#ifndef WINDOWS
    this->setWindowFlags(Qt::FramelessWindowHint);
#endif
    this->setFixedSize(SCREEN_WIDTH,SCREEN_HEIGHT);
    QDesktopWidget * desktop = QApplication::desktop();
    this->move((desktop->width()-this->width())/2, (desktop->height()-this->height())/2);
    this->setAutoFillBackground(true);
    QPalette palette = this->palette();
    palette.setBrush(QPalette::Background, QBrush(QPixmap(":/images/background_normal.png")));
    this->setPalette(palette);

}
static jstring
nContextGetErrorMessage(JNIEnv *_env, jobject _this, RsContext con)
{
    LOG_API("nContextGetErrorMessage, con(%p)", con);
    char buf[1024];

    size_t receiveLen;
    uint32_t subID;
    int id = dispatchTab.ContextGetMessage(con,
                                 buf, sizeof(buf),
                                 &receiveLen, sizeof(receiveLen),
                                 &subID, sizeof(subID));
    if (!id && receiveLen) {
        //        __android_log_print(ANDROID_LOG_VERBOSE, LOG_TAG,
        //            "message receive buffer too small.  %zu", receiveLen);
    }
    return _env->NewStringUTF(buf);
}
Example #27
0
CHEWING_API const char *chewing_cand_String_static(ChewingContext *ctx)
{
    ChewingData *pgdata;
    const char *s = "";

    if (!ctx) {
        return s;
    }
    pgdata = ctx->data;

    LOG_API("");

    if (chewing_cand_hasNext(ctx)) {
        s = ctx->output->pci->totalChoiceStr[ctx->cand_no];
        ctx->cand_no++;
    }

    return s;
}
Example #28
0
CHEWING_API void chewing_interval_Get(ChewingContext *ctx, IntervalType * it)
{
    ChewingData *pgdata;

    if (!ctx) {
        return;
    }
    pgdata = ctx->data;

    LOG_API("");

    if (chewing_interval_hasNext(ctx)) {
        if (it) {
            it->from = ctx->output->dispInterval[ctx->it_no].from;
            it->to = ctx->output->dispInterval[ctx->it_no].to;
        }
        ctx->it_no++;
    }
}
static void
nScriptForEachClipped(JNIEnv *_env, jobject _this, RsContext con,
                      jint script, jint slot, jint ain, jint aout,
                      jint xstart, jint xend,
                      jint ystart, jint yend, jint zstart, jint zend)
{
    LOG_API("nScriptForEachClipped, con(%p), s(%p), slot(%i)", con, (void *)script, slot);
    RsScriptCall sc;
    sc.xStart = xstart;
    sc.xEnd = xend;
    sc.yStart = ystart;
    sc.yEnd = yend;
    sc.zStart = zstart;
    sc.zEnd = zend;
    sc.strategy = RS_FOR_EACH_STRATEGY_DONT_CARE;
    sc.arrayStart = 0;
    sc.arrayEnd = 0;
    dispatchTab.ScriptForEach(con, (RsScript)script, slot, (RsAllocation)ain, (RsAllocation)aout, NULL, 0, &sc, sizeof(sc));
}
static jint
nContextGetUserMessage(JNIEnv *_env, jobject _this, RsContext con, jintArray data)
{
    jint len = _env->GetArrayLength(data);
    LOG_API("nContextGetMessage, con(%p), len(%i)", con, len);
    jint *ptr = _env->GetIntArrayElements(data, NULL);
    size_t receiveLen;
    uint32_t subID;
    int id = dispatchTab.ContextGetMessage(con,
                                 ptr, len * 4,
                                 &receiveLen, sizeof(receiveLen),
                                 &subID, sizeof(subID));
    if (!id && receiveLen) {
        //        __android_log_print(ANDROID_LOG_VERBOSE, LOG_TAG,
        //            "message receive buffer too small.  %zu", receiveLen);
    }
    _env->ReleaseIntArrayElements(data, ptr, 0);
    return id;
}