#pragma once

// AT grabber parameters dialog
class LucidHeliosDialog : public CDialog
{
public:
  LucidHeliosDialog(std::string expo, std::string mode, bool filter, int accumulation, int mind, int maxd) : CDialog(IDD_LUCID_PARAMETERS),
    exposure_time_selector(expo), operating_mode(mode), spatial_filter_enable(filter), image_accumulation(accumulation),
    min_depth(mind), max_depth(maxd)
  {}

protected:
  DECLARE_MESSAGE_MAP()

  virtual BOOL OnInitDialog()
  {
    CDialog::OnInitDialog();

    ((CEdit*)GetDlgItem(IDC_EXPOSURETIME))->SetWindowText(CString(exposure_time_selector.c_str()));
    ((CEdit*)GetDlgItem(IDC_OPERATINGMODE))->SetWindowText(CString(operating_mode.c_str()));
    ((CButton*)GetDlgItem(IDC_SPATIALFILTER))->SetCheck(spatial_filter_enable);
    ((CEdit*)GetDlgItem(IDC_IMAGEACCUMUL))->SetWindowText(std::to_wstring(image_accumulation).c_str());
    ((CEdit*)GetDlgItem(IDC_MINDEPTH))->SetWindowText(std::to_wstring(min_depth).c_str());
    ((CEdit*)GetDlgItem(IDC_MAXDEPTH))->SetWindowText(std::to_wstring(max_depth).c_str());

    return TRUE;
  }

  void OnOK()
  {
    CString str;
    ((CEdit*)GetDlgItem(IDC_EXPOSURETIME))->GetWindowText(str);
    exposure_time_selector = CT2CA(str);

    ((CEdit*)GetDlgItem(IDC_OPERATINGMODE))->GetWindowText(str);
    operating_mode = CT2CA(str);

    spatial_filter_enable = ((CButton*)GetDlgItem(IDC_SPATIALFILTER))->GetCheck();

    ((CEdit*)GetDlgItem(IDC_IMAGEACCUMUL))->GetWindowText(str);
    image_accumulation = _wtoi(str);

    ((CEdit*)GetDlgItem(IDC_MINDEPTH))->GetWindowText(str);
    min_depth = _wtoi(str);

    ((CEdit*)GetDlgItem(IDC_MAXDEPTH))->GetWindowText(str);
    max_depth = _wtoi(str);

    CDialog::EndDialog(1);
  }

public:
  std::string exposure_time_selector;
  std::string operating_mode;
  bool spatial_filter_enable;
  int image_accumulation;
  int min_depth;
  int max_depth;
};

BEGIN_MESSAGE_MAP(LucidHeliosDialog, CDialog)
END_MESSAGE_MAP()
