示例#1
0
/* Callback called when a mouse button is pressed or released
   - b     : mouse button identifier [IUP_BUTTON1, IUP_BUTTON2 or IUP_BUTTON3]
   - press : 1 if the button has been pressed 0, if it has been released
   - x, y  : mouse position
   - r     : string containing which keys [SHIFT, CTRL and ALT] are pressed
*/
int iupTreeMouseButtonCB(Ihandle* ih, int b, int press, int x, int y, char* r)
{
  if(press)
  {
    /* The edit Kill Focus is not called when the user clicks in the parent
       canvas. So we have to compensate that. */
    iupTreeEditCheckHidden(ih);
  }

  if(b == IUP_BUTTON1)
  {
    if(!press && tree_drag)
    {
      int control = 0;
      int shift   = 0;

      if(ih->data->tree_ctrl == YES)
        control = iscontrol(r);
      if(ih->data->tree_shift == YES)
        shift = isshift(r);

      iTreeMouseDrop(ih, x, y, shift, control);
    }

    if((!press || isdouble(r)) && !tree_drag)
    {
      int dclick  = isdouble(r); 
      int control = 0;
      int shift   = 0;

      if(ih->data->tree_ctrl == YES)
        control = iscontrol(r);
      if(ih->data->tree_shift == YES)
        shift = isshift(r);

      iTreeMouseLeftPress(ih, x, y, shift, control, dclick);
    }

    if(press && !isdouble(r))
    {
      if(iupAttribGetInt(ih, "SHOWDRAGDROP"))
        iTreeMouseDrag(ih, x, y);
    }
  }

  if(b == IUP_BUTTON3)
  { 
    if(!press)
    {
      iTreeMouseRightPress(ih, x, y, r);
    }
  }

  return IUP_DEFAULT;
}
示例#2
0
文件: io.cpp 项目: jscrane/Apple1
void io::up(uint8_t scan) {
	if (isshift(scan)) {
		_shift = false;
		return;
	}
	enter(_shift? shiftmap[scan]: scanmap[scan]);
}
示例#3
0
/* label with the right state. */
void dpf_compile_atom(Atom a) {
	struct ir *ir;
	unsigned unchecked, aligned;

	ir = &a->ir;

	/*
 	 * If we have shifted on this path or the offset surpasses
 	 * the minimal amount of buffer space we are allocated,
 	 * emit a check to see if we have exceeded our memory.
 	 */
	unchecked 	= !ir->shiftp && (ir->u.eq.offset <= DPF_MINMSG);
	aligned      	= ((ir->alignment + ir->u.eq.offset) % 4 == 0);

	a->code[0] = (isshift(ir)) ?
		s_op(aligned, unchecked) :
		eq_op(aligned, unchecked, (a->ht != 0));
}
示例#4
0
static void dump(Atom p, int n) {
	if(!p) return;

	for(;; p = p->sibs.le_next) {

		if(iseq(&p->ir))
			dump_eqnode(p, n, p->ir.u.eq.nbits);
		else  {
			demand(isshift(&p->ir), bogus op);
			dump_shiftnode(p, n, p->ir.u.shift.nbits);
		}

		if(!p->sibs.le_next) 
			return;

		indent(n - 2);
		printf("OR\n");
	}
}
示例#5
0
static int interp(uint8 *msg, unsigned nbytes, Atom a, unsigned fail_pid) {
	struct ir *ir;
	unsigned lhs, off, pid;

	/* need to see if it ends. */
	for(; a; a = a->sibs.le_next) {
		ir = &a->ir;
		if(isshift(ir)) {
			/* msg += (msg[off]:nbits & mask) << shift */
			if(!load_lhs(&off, msg, nbytes, ir, 0, 0))
				continue;
			off <<= ir->u.shift.shift;
			if(off >= nbytes)
				continue;
			else if((pid = interp(msg+off, nbytes-off, a->kids.lh_first, a->pid)))
				return pid;
		} else if(!a->ht) {
			/* msg[off]:nbits & mask == val */
			if(!load_lhs(&lhs, msg, nbytes, ir, 0, 0))
				continue;
			else if(lhs != ir->u.eq.val)
				continue;
			else if((pid = interp(msg, nbytes, a->kids.lh_first, a->pid)))
				return pid;
		} else {
			Atom hte;

			if(!load_lhs(&lhs, msg, nbytes, ir, 0, 0))
				continue;
			if(!(hte = ht_lookup(a->ht, lhs)))
				continue;
			else if((pid = interp(msg, nbytes, hte->kids.lh_first, hte->pid)))
				return pid;
		}
	}
	return fail_pid;
}
示例#6
0
文件: io.cpp 项目: jscrane/Apple1
void io::down(uint8_t scan) {
	set_porta(0);
	if (isshift(scan))
		_shift = true;
}