00001 /* Gxsm - Gnome X Scanning Microscopy 00002 * universal STM/AFM/SARLS/SPALEED/... controlling and 00003 * data analysis software 00004 * 00005 * Copyright (C) 2003 Kristan Temme 00006 * 00007 * Authors: Kristan Temme <etptt@users.sf.net> 00008 * 00009 * WWW Home: http://gxsm.sf.net 00010 * 00011 * This program is free software; you can redistribute it and/or modify 00012 * it under the terms of the GNU General Public License as published by 00013 * the Free Software Foundation; either version 2 of the License, or 00014 * (at your option) any later version. 00015 * 00016 * This program is distributed in the hope that it will be useful, 00017 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00019 * GNU General Public License for more details. 00020 * * You should have received a copy of the GNU General Public License 00021 * along with this program; if not, write to the Free Software 00022 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. 00023 */ 00024 00025 /* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 8 c-style: "K&R" -*- */ 00026 00027 #include <gtk/gtk.h> 00028 #include <gnome.h> 00029 #include <math.h> 00030 00031 00032 00033 #define WINDOW_SIZE 100 00034 #define WINDOW_ORIGIN (WINDOW_SIZE/2) 00035 #define TO_CANVAS_X(var) (WINDOW_ORIGIN + ((var)*(WINDOW_SIZE/max_x))) 00036 #define TO_CANVAS_Y(var) (WINDOW_ORIGIN - ((var)*(WINDOW_SIZE/max_y))) 00037 #define TO_CANVAS_NORMAL_X(var) (WINDOW_ORIGIN + ((var)*WINDOW_SIZE)) 00038 #define TO_CANVAS_NORMAL_Y(var) (WINDOW_ORIGIN - ((var)*WINDOW_SIZE)) 00039 #define TO_RAD(var) (M_PI * ((var) / 180)) 00040 00041 class PanView : public GnomeAppService{ 00042 public: 00043 00044 PanView(GtkWidget *a); 00045 virtual ~PanView(); 00046 00047 void run (); 00048 void refresh (); 00049 void update_expanded_scan_limits (); 00050 void tip_refresh (); 00051 00052 void start_tip_monitor (); 00053 void stop_tip_monitor (); 00054 00055 gint finish (gint flg = -99) { if (flg != -99) tip_flag = flg; return tip_flag; }; 00056 00057 private: 00058 guint timer_id; 00059 gint tip_flag; 00060 00061 GtkWidget *canvas; 00062 00063 GnomeCanvasItem *tip_marker; 00064 GnomeCanvasItem *tip_marker_z; 00065 GnomeCanvasItem *pan_area; 00066 GnomeCanvasItem *pre_current_view; // scan area with prescan 00067 GnomeCanvasItem *current_view; // scan area without prescan 00068 00069 double point[4][2]; // edges of the scan area 00070 double pre_point[4][2]; // only x coordinate only important for pre_current_view 00071 00072 double max_x, min_x; 00073 double max_y, min_y; 00074 double max_z, min_z; 00075 double corn_oo, corn_ii; 00076 00077 void transform(double *dest, double *src, double rot, 00078 double y_off, 00079 double x_off); 00080 00081 };