Exemplo n.º 1
0
void KCtree::sampleCtr(KMpoint c)		// sample a point
{
    initBasicGlobals(dim, n_pts, pts);		// initialize globals
    // TODO: bb_save check is just for debugging.
    KMorthRect bb_save(dim, bnd_box);		// save bounding box
    root->sampleCtr(c, bnd_box);		// start at root
    for (int i = 0; i < dim; i++) {		// check that bnd_box unchanged
	assert(bb_save.lo[i] == bnd_box.lo[i] &&
	       bb_save.hi[i] == bnd_box.hi[i]);
    }
}
Exemplo n.º 2
0
WORD fm_alert(WORD defbut, LONG palstr)
{
        register WORD   i;
        WORD            inm, nummsg, mlenmsg, numbut, mlenbut, image;
        LONG            tree;
        GRECT           d, t;
        OBJECT          *obj;

                                                /* init tree pointer    */
        tree = (LONG) rs_trees[DIALERT];

        gsx_mfset(ad_armice);

        fm_parse(tree, palstr, &inm, &nummsg, &mlenmsg, &numbut, &mlenbut);
        fm_build(tree, (inm != 0), nummsg, mlenmsg, numbut, mlenbut);

        if (defbut)
        {
          obj = ((OBJECT *)tree) + BUTOFF + defbut - 1;
          obj->ob_flags |= DEFAULT;
        }

        obj = ((OBJECT *)tree) + 1;

        if (inm != 0)
        {
          switch(inm) {
            case 1:
              image = NOTEBB;
              break;
            case 2:
              image = QUESTBB;
              break;
            default:
              image = STOPBB;
              break;
          }
          obj->ob_spec = (LONG) &rs_bitblk[image];
        }
                                                /* convert to pixels    */
        for(i=0; i<NUM_ALOBJS; i++)
          rs_obfix(tree, i);
                                                /* fix up icon, 32x32   */
        obj->ob_type = G_IMAGE;
        obj->ob_width = obj->ob_height = 32;
                                                /* center tree on screen*/
        ob_center(tree, &d);

        /* Fix 2003-09-25: Limit drawing to the screen! */
        rc_intersect(&gl_rscreen, &d);
                                                /* save screen under-   */
                                                /*   neath the alert    */
        wm_update(TRUE);
        gsx_gclip(&t);
        bb_save(&d);
                                                /* draw the alert       */
        gsx_sclip(&d);
        ob_draw(tree, ROOT, MAX_DEPTH);
                                                /* turn on the mouse    */
        ct_mouse(TRUE);
                                                /* let user pick button */
        i = fm_do(tree, 0);
                                                /* turn off mouse if necessary */
        ct_mouse(FALSE);
                                                /* restore saved screen */
        gsx_sclip(&d);
        bb_restore(&d);
        gsx_sclip(&t);
        wm_update(FALSE);
                                                /* return selection     */
        return( i - BUTOFF + 1 );
}