00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #ifndef __SPM_SCANCONTROL_H
00031 #define __SPM_SCANCONTROL_H
00032
00033 typedef enum SCAN_DIR { SCAN_DIR_TOPDOWN, SCAN_DIR_TOPDOWN_BOTUP, SCAN_DIR_BOTUP };
00034 typedef enum SCAN_FLAG { SCAN_FLAG_READY, SCAN_FLAG_STOP, SCAN_FLAG_PAUSE, SCAN_FLAG_RUN };
00035 typedef enum SCAN_DT_TYPE { SCAN_LINESCAN, SCAN_FRAMECAPTURE };
00036
00037
00038
00039 class SPM_ScanControl : public AppBase{
00040 public:
00041 SPM_ScanControl();
00042 virtual ~SPM_ScanControl();
00043
00044 void update();
00045
00046 int free_scan_lists ();
00047
00048 int initialize_scan_lists ();
00049
00050
00051 int initialize_default_pid_src ();
00052 int initialize_pid_src ();
00053 int initialize_daq_srcs ();
00054
00055 int prepare_to_start_scan (SCAN_DT_TYPE st=SCAN_LINESCAN);
00056
00057
00058
00059
00060
00061
00062
00063 int setup_scan (int ch, const gchar *titleprefix,
00064 const gchar *name,
00065 const gchar *unit, const gchar *label,
00066 const gchar *vunit = NULL, const gchar *vlabel = NULL,
00067 const gchar *prbsrcs = NULL, int prboutp = 0);
00068
00069 void do_scanline (int init=FALSE);
00070 void run_probe (int ipx, int ipy);
00071 int do_scan ();
00072 int do_hscapture ();
00073 void set_subscan (int ix0=0, int num=0);
00074
00075
00076 void stop_scan () {
00077 if (scan_flag == SCAN_FLAG_RUN || scan_flag == SCAN_FLAG_PAUSE)
00078 scan_flag = SCAN_FLAG_STOP;
00079 };
00080 int pause_scan () {
00081 if (scan_flag == SCAN_FLAG_RUN)
00082 scan_flag = SCAN_FLAG_PAUSE;
00083 else
00084 if (scan_flag == SCAN_FLAG_PAUSE)
00085 scan_flag = SCAN_FLAG_RUN;
00086
00087 return scan_flag == SCAN_FLAG_PAUSE;
00088 };
00089 int scan_in_progress() {
00090 return scan_flag == SCAN_FLAG_RUN || scan_flag == SCAN_FLAG_PAUSE
00091 ? TRUE : FALSE;
00092 };
00093 int finish_scan ();
00094
00095
00096
00097
00098
00099 double update_status_info (int reset=FALSE);
00100 void autosave_check (double sec, int initvalue=0);
00101
00102 int set_x_lookup_value (int i, double lv);
00103 int set_y_lookup_value (int i, double lv);
00104 int set_l_lookup_value (int i, double lv);
00105
00106
00107 static void call_scan_start (Scan* sc, gpointer data){ sc->start (); };
00108 static void call_scan_draw_line (Scan* sc, gpointer data){
00109 sc->draw (((SPM_ScanControl*)data)->line2update, ((SPM_ScanControl*)data)->line2update+1);
00110 };
00111 static void call_scan_stop (Scan* sc, gpointer data){
00112 sc->stop (((SPM_ScanControl*)data)->scan_flag == SCAN_FLAG_STOP
00113 && ((SPM_ScanControl*)data)->last_scan_dir == SCAN_DIR_TOPDOWN,
00114 ((SPM_ScanControl*)data)->line);
00115 };
00116
00117 void SetScanDir (GtkWidget *w) {
00118 scan_dir = (SCAN_DIR) ((long) gtk_object_get_data ( GTK_OBJECT (w), "SCANDIR"));
00119 PI_DEBUG (DBG_L2, "SCM=" << scan_dir ); };
00120 void ClrScanDir (GtkWidget *w) { };
00121 int GetScanDir () {return last_scan_dir==SCAN_DIR_TOPDOWN?1:-1;};
00122 private:
00123 UnitObj *Unity;
00124
00125 Scan *master_scan;
00126 Scan *master_probescan;
00127
00128
00129 GSList *xp_scan_list, *xp_2nd_scan_list, *xp_prbscan_list;
00130 GSList *xm_scan_list, *xm_2nd_scan_list, *xm_prbscan_list;
00131
00132
00133 int xp_srcs, xm_srcs;
00134 int xp_2nd_srcs, xm_2nd_srcs;
00135
00136 int YOriginTop;
00137
00138
00139
00140 int yline;
00141
00142 int line, line2update;
00143 int ix0off;
00144 SCAN_FLAG scan_flag;
00145 SCAN_DIR scan_dir, last_scan_dir;
00146 gboolean do_probe;
00147 };
00148
00149 #endif