Beispiel #1
0
int
TRACE::tap_cb(CGESTUREptr& gest, DrawState*& s) 
{
   assert (gest->is_tap());
   
   if (_calib_mode_flag) {
      // we are in calibration point
      XYpt sample = gest->end();
      _samples[_cur_calib_pt_index] = sample;
      cerr << "recorded sample " << _cur_calib_pt_index << endl;
      _cur_calib_pt_index++;
      /* seems impractical to distort image, leaving this at 2 - alexni
         if (_cur_calib_pt_index == 4) {
      */
      if (_cur_calib_pt_index == 2) {
         // if we have sampled four points, we are done with calibration
         _calib_mode_flag = false;
         _calibrated = true;

         WORLD::message("Calibration complete");
      }
      return 1;
   } else return 0;

}
Beispiel #2
0
int
SELECT_WIDGET::tap_cb(CGESTUREptr& g, DrawState*& s)
{
   err_adv(debug, "SELECT_WIDGET::tap_cb()");

   assert(g && g->is_tap());


   if (_mode==SLASH_SEL)
   {
	   //pattern editing
		Bface* f = find_face(g->start(),0.25,MIN_PIX_AREA);
		if (f) {
			if (select_list.contains(f)||select_list.contains(f->quad_partner()))
			{
	
				//get whichever part of the quad is in the selection list
				int temp = select_list.contains(f) ? select_list.get_index(f)+1 : select_list.get_index(f->quad_partner())+1 ;


				if (temp>end_face) //user selected the end face
				{
					end_face=temp;
				}
				else //user is selecting a pattern
				{
					if (pattern<temp)
						pattern=temp;

					//select/deselect face
					if (temp < MAX_PATTERN_SIZE)
					pattern_array[temp]=!pattern_array[temp];

				}
				return 1;
			}
			else
				cerr << "tap found a NULL face !" << endl;
		}

		return cancel_cb(g,s);


   }
   else
   {
   // Tap a selected face near the middle to deselect it:
	if (try_deselect_face(g->center(), 0.25))
		  return 1;

   // Tap edge to deselect
	if (try_deselect_edge(g->center()))
		  return 1;

   }
   // Otherwise, turn off SELECT_WIDGET
   
   return cancel_cb(g,s);
}