예제 #1
0
 MRESULT EXPENTRY icqFrameWindow(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
 {
    switch(msg)
    {
    case WM_DDE_INITIATEACK:
       return (MRESULT) icqDDEInitiateAck(hwnd, (HWND)mp1, (PDDEINIT)mp2);

    case WM_DDE_DATA:
       DBGMessage("WM_DDE_DATA");
       icqDDEData(hwnd, (PDDESTRUCT) mp2);
       break;

    case WM_CLOSE:
       DBGMessage("WM_CLOSE");
       close(hwnd);
       break;

    case WM_CREATE:
       icqskin_cfgWindow(hwnd,ICQFRAME,0);
       break;

    case WM_DESTROY:
       destroy(hwnd);
       break;

    case WM_ERASEBACKGROUND:
       erase(hwnd,(HPS) mp1, (PRECTL) mp2);
       break;

    case WM_SIZE:
       resize(hwnd,SHORT1FROMMP(mp2),SHORT2FROMMP(mp2));
       broadcast(hwnd,WMICQ_AUTOSIZE,0,0);
       break;

    case WM_PAINT:
       paint(hwnd);
       break;

    case WM_SETICON:
       WinSendMsg(WinQueryWindow(hwnd,QW_PARENT),msg,mp1,mp2);
       break;

    case WM_COMMAND:
       action(hwnd,SHORT1FROMMP(mp1), SHORT1FROMMP(mp2));
       break;

    case WM_PRESPARAMCHANGED:
       ppchanged(hwnd,LONGFROMMP(mp1));
       break;

    case WM_SETWINDOWPARAMS:
       return setparm(hwnd, PVOIDFROMMP(mp1), mp2);

    case WMICQ_SETNAME:
//       strncpy( ((ICQFRAME *) WinQueryWindowPtr(hwnd,0))->name, (const char *) mp1, 19);
       ((ICQFRAME *) WinQueryWindowPtr(hwnd,0))->name = (const char *) mp1;
       break;

    case WMICQ_SETICQHANDLE:
       DBGTracex(mp1);
       ((ICQFRAME *) WinQueryWindowPtr(hwnd,0))->icq = (HICQ) mp1;
       break;

    case WMICQ_GETICQHANDLE:
       return (MRESULT) ((ICQFRAME *) WinQueryWindowPtr(hwnd,0))->icq;

    case WMICQ_SETBUTTONTBL:
       setbuttons(hwnd,(const struct icqButtonTable *) mp1, (int) mp2);
       break;

    case WMICQ_QUERYPALLETE:
       return (MRESULT) ((ICQFRAME *) WinQueryWindowPtr(hwnd,0))->pal;

    case WMICQ_EVENT:  // MP1 = type,code,user  MP2 = parm
       event(hwnd,CHAR3FROMMP(mp1),CHAR4FROMMP(mp1),SHORT1FROMMP(mp1),(ULONG) mp2);
       break;

    case WMICQ_SELECTPAL:
       icqskin_loadPallete( (HPS) mp1, 0, ((ICQFRAME *) WinQueryWindowPtr(hwnd,0))->pal);
       break;

    case 0x041E:
       return WinDefWindowProc(hwnd, msg, mp1, mp2);

    case 0x041F:
       return WinDefWindowProc(hwnd, msg, mp1, mp2);

    case WM_BEGINDRAG:
       return beginDrag(hwnd, (POINTS *) &mp1);

    case WM_ENDDRAG:
       return endDrag(hwnd);

    case WM_TIMER:
       timer(hwnd);
       break;

#ifdef SKINNED_GUI
    case WMICQ_QUERYBGIMAGE:
       return (MRESULT) ((ICQFRAME *) WinQueryWindowPtr(hwnd,0))->bg;
#else
    case WMICQ_QUERYBGIMAGE:
       return (MRESULT) NO_IMAGE;
#endif

    case WM_OWNERPOSCHANGE:
       DBGMessage("WM_OWNERPOSCHANGE");
       return WinDefWindowProc(hwnd,msg,mp1,mp2);

    case WM_MOUSEMOVE:
       if(WinQueryCapture(HWND_DESKTOP) == hwnd);
          saveMouse(hwnd,SHORT1FROMMP(mp1),SHORT2FROMMP(mp1));
       return WinDefWindowProc(hwnd,msg,mp1,mp2);

    case WMICQ_CLEAR:
       clearSkin( (ICQFRAME *) WinQueryWindowPtr(hwnd,0));
       break;

    case WMICQ_LOADSKIN:
       loadSkin(hwnd,(const char *) mp1, (SKINFILESECTION *) mp2);
       break;

    case WMICQ_SKINCHILDS:
       loadSkin4Childs(hwnd,(const char *) mp1, (SKINFILESECTION *) mp2);
       break;

    case WMICQ_RESTORE:
       restoreWindow(hwnd,(const char *) mp1,SHORT1FROMMP(mp2),SHORT2FROMMP(mp2));
       break;

    case WMICQ_STORE:
       storeWindow(hwnd,(const char *) mp1);
       break;

    case WMICQ_CONFIGURE:
       configure(hwnd,(int) mp1);
       break;

    case WMICQ_SETMSGCHILD:
       createchild(hwnd, (const MSGCHILD *) mp1, SHORT1FROMMP(mp2));
       break;

    case WMICQ_SKINELEMENT:
       skinElement(hwnd,(HWND) mp1, (const char **) mp2);
       break;

    case WMICQ_DRAWCONTENTS:
       break;

    case WMICQ_AUTOSIZE:
       autoSize(hwnd);
       break;

    case WMICQ_SIZEBUTTONS:
       return (MRESULT) sizeButtonBar(hwnd,SHORT1FROMMP(mp1),SHORT2FROMMP(mp1),(const USHORT *) mp2);

    case WMICQ_INVALIDATE:
       DBGMessage("WMICQ_INVALIDATE");
       WinInvalidateRect(hwnd,NULL,TRUE);
       break;

    /*---[ SysTray ]--------------------------------------------*/

    case WM_BUTTON2CLICK | 0x2000:
       icqShowPopupMenu(((ICQFRAME *) WinQueryWindowPtr(hwnd,0))->icq, 0, ICQMNU_MODES, 0, 0);
       return (MRESULT) TRUE;

    case WM_BUTTON1CLICK | 0x2000:
       openMessage(((ICQFRAME *) WinQueryWindowPtr(hwnd,0))->icq);
       return (MRESULT) TRUE;

    case WM_TRAYEXIT:	// When tray exits/crashes, it posts WM_TRAYEXIT (0xCD20) to all tray windows.
       icqDisableSysTray(((ICQFRAME *) WinQueryWindowPtr(hwnd,0))->icq);
       return (MRESULT) TRUE;

    /*---[ Default window processing ]--------------------------*/

    default:
       return WinDefWindowProc(hwnd,msg,mp1,mp2);
    }
    return 0;
 }
예제 #2
0
void BinnedMap::binnedmap() {
    KstVectorPtr x = *_inputVectors.find(VECTOR_X);
    KstVectorPtr y = *_inputVectors.find(VECTOR_Y);
    KstVectorPtr z = *_inputVectors.find(VECTOR_Z);
    KstMatrixPtr map = *_outputMatrices.find(MAP);
    KstMatrixPtr hitsMap = *_outputMatrices.find(HITSMAP);
    KstScalarPtr autobin = *_inputScalars.find(AUTOBIN);

    if (autobin) {
        if (autobin->value() != 0.0) {
            _autoBin = true;
        } else {
            _autoBin = false;
        }
    }

    if (_autoBin) {
        double minx, miny, maxx, maxy;
        int nx, ny;

        autoSize(X(), Y(), &nx, &minx, &maxx, &ny, &miny, &maxy);

        setNX(nx);
        setNY(ny);
        setXMin(minx);
        setXMax(maxx);
        setYMin(miny);
        setYMax(maxy);
    } else {
        KstScalarPtr xmin = *_inputScalars.find(XMIN);
        KstScalarPtr xmax = *_inputScalars.find(XMAX);
        KstScalarPtr ymin = *_inputScalars.find(YMIN);
        KstScalarPtr ymax = *_inputScalars.find(YMAX);
        KstScalarPtr nx = *_inputScalars.find(NX);
        KstScalarPtr ny = *_inputScalars.find(NY);

        if (xmin) {
            _xMin = xmin->value();
        }
        if (xmax) {
            _xMax = xmax->value();
        }
        if (ymin) {
            _yMin = ymin->value();
        }
        if (ymax) {
            _yMax = ymax->value();
        }
        if (nx) {
            _nx = (int)nx->value();
        }
        if (ny) {
            _ny = (int)ny->value();
        }
    }

    bool needsresize = false;

    if (_nx < 2) {
        _nx = 2;
        needsresize = true;
    }
    if (_ny < 2) {
        _ny = 2;
        needsresize = true;
    }

    if ((map->xNumSteps() != _nx) || (map->yNumSteps() != _ny) ||
            (map->minX() != _xMin) || (map->minY() != _yMin)) {
        needsresize = true;
    }

    if (map->xStepSize() != (_xMax - _xMin)/double(_nx-1)) {
        needsresize = true;
    }
    if (map->yStepSize() != (_yMax - _yMin)/double(_ny-1)) {
        needsresize = true;
    }

    if (needsresize) {
        map->change(map->tag(), _nx, _ny, _xMin, _yMin,
                    (_xMax - _xMin)/double(_nx-1), (_yMax - _yMin)/double(_ny-1));
        map->resize(_nx, _ny);
        hitsMap->change(hitsMap->tag(), _nx, _ny, _xMin, _yMin,
                        (_xMax - _xMin)/double(_nx-1), (_yMax - _yMin)/double(_ny-1));
        hitsMap->resize(_nx, _ny);
    }

    map->zero();
    hitsMap->zero();

    int ns = z->length(); // the z vector defines the number of points.
    double n,p, x0, y0, z0;

    for (int i=0; i<ns; i++) {
        x0 = x->interpolate(i, ns);
        y0 = y->interpolate(i, ns);
        z0 = z->interpolate(i, ns);
        p = map->value(x0, y0)+z0;
        map->setValue(x0, y0, p);
        n = hitsMap->value(x0, y0)+1;
        hitsMap->setValue(x0, y0, n);
    }

    for (int i=0; i<_nx; i++) {
        for (int j=0; j<_ny; j++) {
            p = map->valueRaw(i, j);
            n = hitsMap->valueRaw(i, j);
            if (n>0) {
                map->setValueRaw(i, j, p/n);
            } else {
                map->setValueRaw(i, j, KST::NOPOINT);
            }
        }
    }
}