/* -*- mode: c++ -*- */
#ifndef __ScanDialog_h__
#define __ScanDialog_h__
#include <string>
#include <gui/GladeApp.h>
#include <daq/ScanPoint.h>
class ScanDialog : public GladeApp
{
private:
bool do_scan;
bool do_burst;
double _delay;
double _rate;
bool _time;
int nevts;
// Original ScanList
const ScanList &sc0;
//Internal ScanList
ScanList scl;
// Current ScanPoint
ScanPoint sc;
GtkTreeIter *current;
static void on_OK(GtkWidget *w, ScanDialog *sc);
static void on_Cancel(GtkWidget *w, ScanDialog *sc);
static void on_Help(GtkWidget *w, ScanDialog *sc);
static void on_SaveScan(GtkWidget *w, ScanDialog *sc);
static void on_AddScan(GtkWidget *w, ScanDialog *sc);
static void on_DeleteScan(GtkWidget *w, ScanDialog *sc);
static void on_Delete(GtkWidget *w, ScanDialog *sc);
static void on_Add(GtkWidget *w, ScanDialog *sc);
static void on_Up(GtkWidget *w, ScanDialog *sc);
static void on_Down(GtkWidget *w, ScanDialog *sc);
static void on_doScan(GtkWidget *w, ScanDialog *sc);
static void on_ScanType(GtkTreeSelection *ts, ScanDialog *sc);
static void on_ScanChanged(GtkWidget *w, ScanDialog *sc);
static void on_Select(GtkTreeSelection *ts, ScanDialog *sc);
static void on_toggleBurst(GtkWidget *w, ScanDialog *sc);
static void on_toggleTime(GtkWidget *w, ScanDialog *sc);
static void on_Delay(GtkWidget *w, ScanDialog *sc);
static void on_Rate(GtkWidget *w, ScanDialog *sc);
void updateScanList(const char *which = 0);
gchar *get_scan_name();
gboolean findTest(GtkTreeModel **m, GtkTreeIter *it, int *tp);
void moveRow(gboolean up);
public:
ScanDialog(int n, const ScanList &s);
void auto_connect();
void user_init();
void process_text(const std::string &s, GtkWidget *w);
void set_values(int npts, double stp, double frm, double to);
void get_values(int &npts, double &stp, double &frm, double &to);
void copy_scan_list( ScanList &l )
{
l = scl;
}
void copy_scan_point( ScanPoint &s )
{
s = sc;
}
bool scan()
{
return do_scan;
}
void scan(bool x)
{
do_scan = x;
}
void set_scan_point( const std::string &s);
int get_nevts() const
{
return nevts;
}
bool burst() const
{
return do_burst;
}
void burst(bool x)
{
do_burst = x;
}
bool is_time() const
{
return _time;
}
void is_time(bool x)
{
_time = x;
}
double delay() const
{
return _delay;
}
void delay(double x)
{
_delay = x;
}
double rate() const
{
return _rate;
}
void rate(double x)
{
_rate = x;
}
};
#endif