~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Linux Cross Reference
Tina6/tina-tools/tinatool/draw/drawTv_activity.c

Version: ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /*********
  2  * Copyright (c) 2003, Division of Imaging Science and Biomedical Engineering,
  3  * University of Manchester, UK.  All rights reserved.
  4  * 
  5  * Redistribution and use in source and binary forms, with or without modification, 
  6  * are permitted provided that the following conditions are met:
  7  * 
  8  *   . Redistributions of source code must retain the above copyright notice, 
  9  *     this list of conditions and the following disclaimer.
 10  *    
 11  *   . Redistributions in binary form must reproduce the above copyright notice,
 12  *     this list of conditions and the following disclaimer in the documentation 
 13  *     and/or other materials provided with the distribution.
 14  * 
 15  *   . Neither the name of the University of Manchester nor the names of its
 16  *     contributors may be used to endorse or promote products derived from this 
 17  *     software without specific prior written permission.
 18  * 
 19  * 
 20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 
 21  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
 22  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
 23  * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
 24  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
 25  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
 26  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 27  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
 28  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
 29  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
 30  * POSSIBILITY OF SUCH DAMAGE.
 31  *
 32  **********
 33  *
 34  * Program :    TINA
 35  * File    :  $Source: /home/tina/cvs/tina-tools/tinatool/draw/drawTv_activity.c,v $
 36  * Date    :  $Date: 2003/10/01 16:02:47 $
 37  * Version :  $Revision: 1.3 $
 38  * CVS Id  :  $Id: drawTv_activity.c,v 1.3 2003/10/01 16:02:47 tony Exp $
 39  *
 40  * Author  : Legacy TINA
 41  *
 42  * Notes :
 43  *
 44  *********
 45 */
 46 
 47 #include "drawTv_activity.h"
 48 
 49 #if HAVE_CONFIG_H
 50   #include <config.h>
 51 #endif
 52 
 53 #include <tina/sys/sysDef.h>
 54 #include <tina/sys/sysPro.h>
 55 #include <tina/math/mathDef.h>
 56 #include <tinatool/draw/draw_TvDef.h>
 57 #include <tinatool/draw/draw_TvPro.h>
 58 
 59 int tv_set_activity(Tv * tv, int activity)
 60 {
 61   extern void tv_screen_set_activity_cursor();
 62   int oldactivity = 0;
 63 
 64   if (tv)
 65   {
 66     oldactivity = tv->activity;
 67     tv->activity = activity;
 68     (void) tv_set_activity_message(tv);
 69     if (tv->tv_screen)
 70     {
 71       tv_screen_set_activity_cursor(tv->tv_screen, activity);
 72     }
 73   }
 74   return (oldactivity);
 75 }
 76 
 77 void tv_set_activity_message(Tv * tv)
 78 {
 79   if (tv == NULL)
 80     return;
 81 
 82   switch (tv->activity)
 83   {
 84   case ZOOM:
 85     switch (tv->zoomlevel)
 86     {
 87     case IMZOOM:
 88       tv_set_message(tv, "imzoom : shift / scale / roi");
 89       break;
 90     case ZOOM2:
 91       tv_set_message(tv, "zoom2D : shift / scale-rot2D / null");
 92       break;
 93     case ZOOM3:
 94       tv_set_message(tv, "zoom3D : shift / zoom / rot");
 95       break;
 96     case ZOOM4:
 97       tv_set_message(tv, "zoom3D : rot / zoom / shift");
 98       break;
 99     }
100     break;
101   case ROI:
102     tv_set_message(tv, "rect : define / show / null");
103     break;
104   case POLYROI:
105     tv_set_message(tv, "poly : next / end (show) / restart");
106     break;
107   case POINT:
108     tv_set_message(tv, "point : move / delete / add");
109     break;
110   case GLOBAL:
111     tv_set_message(tv, "global : trans / scale / rotate");
112     break;
113   case PICK:
114     {
115       char *name = tv->pick.name;
116       char string[512];
117 
118       (void) string_append(string,
119                            "pick : choose / ", name, " / cancel",
120                            NULL);
121       tv_set_message(tv, string);
122     }
123     break;
124   case MOUSE:
125     {
126       Tv_mouse *mouse = &tv->mouse;
127       char string[512];
128 
129       (void) string_append(string,
130                            mouse->name, " : ",
131                            mouse->left_name, " / ",
132                            mouse->middle_name, " / ",
133                            mouse->right_name, NULL);
134       tv_set_message(tv, string);
135     }
136     break;
137   case 0:
138   default:
139     tv_set_message(tv, "null");
140   }
141 }
142 
143 /*
144  * Handle mouse events (not keyboard) in screen.  Meaning of an event
145  * * (eg mouse SELECT) depends on the tv->activity (zoom, roi, pick
146  * * mouse). 
147  */
148 void tv_activity_proc(Tv * tv, int state, Ipos pos)
149 {
150   switch (tv->activity)
151   {
152   case 0:
153     return;
154   case ZOOM:
155     tv_zoom_proc(tv, state, pos);
156     break;
157   case ROI:
158     tv_roi_proc(tv, state, pos);
159     break;
160   case POLYROI:
161     tv_polyroi_proc(tv, state, pos);
162     break;
163   case POINT:
164     tv_roipnt_proc(tv, state, pos);
165     break;
166   case GLOBAL:
167     tv_roigbl_proc(tv, state, pos);
168     break;
169   case PICK:
170     tv_pick_proc(tv, state, pos);
171     break;
172   case MOUSE:
173     tv_mouse_proc(tv, state, pos);
174     break;
175   }
176 }
177 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.