Esempio n. 1
0
int
Cam_int::down(
   CEvent &e, 
   State *&s
   )
{
   if (debug_fsa)
      cerr << "Cam_int::down"
           << endl;

   DEVice_buttons *btns = (DEVice_buttons *)e._d;
   DEVice_2d      *ptr  = btns->ptr2d();
   VIEWptr         view(e.view());
   bool            is_dot = _camwidg.anchor_displayed();
   int             x, y; view->get_size(x,y);
   PIXEL           curpix(ptr->cur());
   XYpt            curpt (curpix[0]/x*2-1, curpix[1]/y*2-1);

   predown(e,s);

   // Did we click on a camera icon?
   CamIcon *icon = CamIcon::intersect_all(ptr->cur()); 
   if (icon) {

      // XXX - fix

      _icon = icon;
      switch (icon->test_down(e, s)) {
       case CamIcon::RESIZE :
         _resizing = true;
         // drops through to next case:
       case CamIcon::FOCUS  :
         s = &_icon_click;
         break;
       case CamIcon::MOVE   :
         s = &_move_view;
         return move(e, s);
      }
      return 0;
   } else if ((fabs(curpt[0]) > .85 || fabs(curpt[1]) > .9) || is_dot) {
      if (is_dot)
         view->cam()->data()->set_center(_camwidg.anchor_wpt());
      _do_reset = is_dot;

      if (!is_dot){
         /* alexni- is there a better way to handle this?  we want to
          * save the camera if we're going to enter a mode that causes
          * change to the camera
          */
         _view->save_cam();
      }

      s = &_cam_rot;
      return 0;
   }

   return 0;
}
Esempio n. 2
0
int
Cam_int_fp::down(
   CEvent &e, 
   State *&s
   )
{
   DEVice_buttons *btns = (DEVice_buttons *)e._d;
   DEVice_2d      *ptr  = btns->ptr2d();
   VIEWptr         view(e.view());
   int             is_dot = _camwidg.anchor_displayed();
   int             x, y; view->get_size(x,y);
   PIXEL           curpix(ptr->cur());
   XYpt            curpt (curpix[0]/x*2-1, curpix[1]/y*2-1);

   //set timer...
   _clock.set();

   predown(e,s);
   if(CamBreathe::cur()) CamBreathe::cur()->pause();


   // Did we click on a camera icon?
   CamIcon *icon = CamIcon::intersect_all(ptr->cur()); 
   if (icon) {
      // XXX - fix
      _icon = icon;
      switch (icon->test_down(e, s)) {
       case CamIcon::RESIZE : _resizing = true;
       case CamIcon::FOCUS  : s = &_icon_click;
         brcase CamIcon::MOVE   : {
            s = &_move_view;
            return move(e, s);
         }
      }
      return 0;
   } else
      {
         if (is_dot)