CamCalImportDialog::CamCalImportDialog(wxWindow *parent) :
    wxDialog(parent, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxCAPTION | wxCLOSE_BOX)
{
    wxBoxSizer* vSizer = new wxBoxSizer(wxVERTICAL);

    SetTitle(wxString::Format(_("Import Darks to Profile %s"), pConfig->GetCurrentProfile()));

    m_thisProfileId = pConfig->GetCurrentProfileId();
    m_profileNames = pConfig->ProfileNames();

    // Start with the dark library
    wxStaticBoxSizer* darksGroup = new wxStaticBoxSizer(wxVERTICAL, this, _("Dark Library"));

    wxStaticText* darksLabel = new wxStaticText(this, wxID_STATIC, _("Choose the profile with the dark library you want to use:"), wxDefaultPosition, wxDefaultSize, 0);
    darksGroup->Add(darksLabel, 0, wxALIGN_CENTER_HORIZONTAL | wxALL | wxADJUST_MINSIZE, 5);
    wxFlexGridSizer* drkGrid = new wxFlexGridSizer(2, 2, 0, 0);

    wxArrayString drkChoices;
    drkChoices.Add(_("None"));

    FindCompatibleDarks(&drkChoices);

    if (drkChoices.Count() > 1)
    {
        m_darksChoice = new wxChoice(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, drkChoices, 0, wxDefaultValidator, _("Darks Profiles"));
        m_darksChoice->SetSelection(0);
        m_darksChoice->Bind(wxEVT_COMMAND_CHOICE_SELECTED, &CamCalImportDialog::OnDarkProfileChoice, this);
        AddTableEntryPair(this, drkGrid, _("Import from profile"), m_darksChoice);
        m_darkCameraChoice = new wxStaticText(this, wxID_ANY, wxEmptyString, wxPoint(-1, -1), wxSize(-1, -1));
        AddTableEntryPair(this, drkGrid, _("Camera in profile"), m_darkCameraChoice);
        darksGroup->Add(drkGrid, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 10);
    }
    else
        darksLabel->SetLabelText(_("There are no compatible dark libraries available"));
    vSizer->Add(darksGroup, 0, wxALIGN_LEFT | wxALL, 10);

    // Now add the bad-pix map controls
    wxStaticBoxSizer* bpmGroup = new wxStaticBoxSizer(wxVERTICAL, this, _("Bad-pixel Map"));

    wxStaticText* bpmLabel = new wxStaticText(this, wxID_STATIC, _("Choose the profile with the bad-pixel map you want to use:"), wxDefaultPosition, wxDefaultSize, 0);
    bpmGroup->Add(bpmLabel, 0, wxALIGN_CENTER_HORIZONTAL | wxALL | wxADJUST_MINSIZE, 10);

    wxArrayString bpmChoices;
    bpmChoices.Add(_("None"));

    FindCompatibleBPMs(&bpmChoices);

    if (bpmChoices.Count() > 1)
    {
        m_bpmChoice = new wxChoice(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, bpmChoices, 0, wxDefaultValidator, _("Bad-pix Map Profiles"));
        m_bpmChoice->SetSelection(0);
        m_bpmChoice->Bind(wxEVT_COMMAND_CHOICE_SELECTED, &CamCalImportDialog::OnBPMProfileChoice, this);
        wxFlexGridSizer *bpmGrid = new wxFlexGridSizer(2, 2, 0, 0);
        AddTableEntryPair(this, bpmGrid, _("Import from profile"), m_bpmChoice);
        m_bpmCameraChoice = new wxStaticText(this, wxID_ANY, wxEmptyString, wxPoint(-1, -1), wxSize(-1, -1));
        AddTableEntryPair(this, bpmGrid, _("Camera in profile"), m_bpmCameraChoice);
        bpmGroup->Add(bpmGrid, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 10);
    }
    else
        bpmLabel->SetLabelText(_("There are no compatible bad-pixel maps available"));

    vSizer->Add(bpmGroup, 0, wxALIGN_LEFT | wxALL, 10);

    // Add the buttons
    wxBoxSizer* btnHSizer = new wxBoxSizer(wxHORIZONTAL);
    vSizer->Add(btnHSizer, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 10);

    wxButton* btnOk = new wxButton(this, wxID_ANY, _("OK"), wxDefaultPosition, wxDefaultSize, 0);
    btnOk->Bind(wxEVT_COMMAND_BUTTON_CLICKED, &CamCalImportDialog::OnOk, this);
    btnOk->SetDefault();
    btnHSizer->Add(btnOk, 0, wxALIGN_CENTER_VERTICAL | wxALL, 10);

    wxButton* btnCancel = new wxButton(this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0);
    btnHSizer->Add(btnCancel, 0, wxALIGN_CENTER_VERTICAL | wxALL, 10);

    //PopulateLBs(darksLB, bpmLB);
    SetSizerAndFit(vSizer);

    m_activeProfileName = pConfig->GetCurrentProfile();
    m_sourceDarksProfileId = -1;
    m_sourceBpmProfileId = -1;
}
示例#2
0
ProfileWizard::ProfileWizard(wxWindow *parent, bool firstLight) :
    wxDialog(parent, wxID_ANY, _("New Profile Wizard"), wxDefaultPosition, wxDefaultSize, wxCAPTION | wxCLOSE_BOX),
    m_launchDarks(true)
{
    TitlePrefix = _("New Profile Wizard - ");

    // Create overall vertical sizer
    m_pvSizer = new wxBoxSizer(wxVERTICAL);

#   include "icons/phd2_48.png.h"
    wxBitmap phd2(wxBITMAP_PNG_FROM_DATA(phd2_48));
    m_bitmaps[STATE_GREETINGS] = new wxBitmap(phd2);
    m_bitmaps[STATE_WRAPUP] = new wxBitmap(phd2);
#   include "icons/cam2.xpm"
    m_bitmaps[STATE_CAMERA] = new wxBitmap(cam_icon);
#   include "icons/scope1.xpm"
    m_bitmaps[STATE_MOUNT] = new wxBitmap(scope_icon);
    m_bitmaps[STATE_AUXMOUNT] = new wxBitmap(scope_icon);
#   include "icons/ao.xpm"
    m_bitmaps[STATE_AO] = new wxBitmap(ao_xpm);
#ifndef  __WXGTK__  // this resizing make a later crash in UpdateState with wxGtk
    m_bitmaps[STATE_CAMERA]->SetWidth(55);
    m_bitmaps[STATE_CAMERA]->SetHeight(55);
    m_bitmaps[STATE_MOUNT]->SetWidth(55);
    m_bitmaps[STATE_MOUNT]->SetHeight(55);
    m_bitmaps[STATE_AUXMOUNT]->SetWidth(55);
    m_bitmaps[STATE_AUXMOUNT]->SetHeight(55);
#endif // __WXGTK__

    // Build the superset of UI controls, minus state-specific labels and data
    // User instructions at top
    wxBoxSizer *instrSizer = new wxBoxSizer(wxHORIZONTAL);
    m_bitmap = new wxStaticBitmap(this, wxID_ANY, *m_bitmaps[STATE_GREETINGS], wxDefaultPosition, wxSize(55, 55));
    instrSizer->Add(m_bitmap, 0, wxALIGN_CENTER_VERTICAL | wxFIXED_MINSIZE, 5);

    m_pInstructions = new wxStaticText(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(DialogWidth, 75), wxALIGN_LEFT | wxST_NO_AUTORESIZE);
    wxFont font = m_pInstructions->GetFont();
    font.SetWeight(wxFONTWEIGHT_BOLD);
    m_pInstructions->SetFont(font);
    instrSizer->Add(m_pInstructions, wxSizerFlags().Border(wxALL, 10));
    m_pvSizer->Add(instrSizer);

    // Verbose help block
    m_pHelpGroup = new wxStaticBoxSizer(wxVERTICAL, this, _("More Info"));
    m_pHelpText = new wxStaticText(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(DialogWidth, -1));
    // Vertical sizing of help text will be handled in state machine
    m_pHelpGroup->Add(m_pHelpText, wxSizerFlags().Border(wxLEFT, 10).Border(wxBOTTOM, 10));
    m_pvSizer->Add(m_pHelpGroup, wxSizerFlags().Border(wxALL, 5));

    // Gear label and combo box
    m_pGearGrid = new wxFlexGridSizer(1, 2, 5, 15);
    m_pGearLabel = new wxStaticText(this, wxID_ANY, "Temp:", wxDefaultPosition, wxDefaultSize);
    m_pGearChoice = new wxChoice(this, ID_COMBO, wxDefaultPosition, wxDefaultSize,
                              GuideCamera::List(), 0, wxDefaultValidator, _("Gear"));
    m_pGearGrid->Add(m_pGearLabel, 1, wxALL, 5);
    m_pGearGrid->Add(m_pGearChoice, 1, wxLEFT, 10);
    m_pvSizer->Add(m_pGearGrid, wxSizerFlags().Center().Border(wxALL, 5));

    // Control for pixel-size and focal length
    m_pUserProperties = new wxFlexGridSizer(3, 2, 5, 15);
    m_pPixelSize = new wxSpinCtrlDouble(this, ID_PIXELSIZE, wxEmptyString, wxDefaultPosition,
                                          wxDefaultSize, wxSP_ARROW_KEYS, 0.0, 20.0, 0.0, 0.1);
    m_pPixelSize->SetDigits(2);
    m_PixelSize = m_pPixelSize->GetValue();
    m_pPixelSize->SetToolTip(_("Click Detect to read the pixel size from the camera. Otherwise, you can get this value from your camera documentation or from an online source.  You can use the up/down control "
        "or type in a value directly."));
    m_detectPixelSizeBtn = new wxButton(this, ID_DETECT_PIXELSIZE, _("Detect"));
    m_detectPixelSizeBtn->Enable(false);
    m_detectPixelSizeBtn->SetToolTip(_("Connect to camera and detect pixel size"));
    wxBoxSizer *sizer = new wxBoxSizer(wxHORIZONTAL);
    sizer->Add(m_pPixelSize, 1);
    sizer->Add(m_detectPixelSizeBtn, 0, wxLEFT, 10);
    AddTableEntryPair(this, m_pUserProperties, _("Guide camera un-binned pixel size (microns)"), sizer);
    m_pFocalLength = new wxSpinCtrlDouble(this, ID_FOCALLENGTH, _T("foo2"), wxDefaultPosition,
        wxDefaultSize, wxSP_ARROW_KEYS, 50, 3000, 300, 50);
    m_pFocalLength->SetValue(300);
    m_pFocalLength->SetDigits(0);
    m_pFocalLength->SetToolTip(_("This is the focal length of the guide scope - or the imaging scope if you are using an off-axis-guider or "
        "an adaptive optics device.  You can use the up/down control or type in a value directly."));
    m_FocalLength = (int) m_pFocalLength->GetValue();
    AddTableEntryPair(this, m_pUserProperties, _("Guide scope focal length (mm)"), m_pFocalLength);
    m_pGuideSpeed = new wxSpinCtrlDouble(this, ID_GUIDESPEED, wxEmptyString, wxDefaultPosition,
        wxDefaultSize, wxSP_ARROW_KEYS, 0.2, 1.0, 0.5, 0.1);
    m_pGuideSpeed->SetValue(0.5);
    m_GuideSpeed = 0.5;
    m_pGuideSpeed->SetDigits(2);
    m_pGuideSpeed->SetToolTip(_("The mount guide speed you will use for calibration and guiding, expressed as a multiple of the sidereal rate. If you "
        "don't know, leave the setting at the default value (0.5X)"));
    AddTableEntryPair(this, m_pUserProperties, _("Mount guide speed (n.n x sidereal)"), m_pGuideSpeed);
    m_pvSizer->Add(m_pUserProperties, wxSizerFlags().Center().Border(wxALL, 5));

    // Wrapup panel
    m_pWrapUp = new wxFlexGridSizer(2, 2, 5, 15);
    m_pProfileName = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(250,-1));
    m_pLaunchDarks = new wxCheckBox(this, wxID_ANY, _("Build dark library"));
    m_pLaunchDarks->SetValue(m_launchDarks);
    m_pLaunchDarks->SetToolTip(_("Check this to automatically start the process of building a dark library for this profile."));
    AddTableEntryPair(this, m_pWrapUp, _("Profile Name"), m_pProfileName);
    m_pWrapUp->Add(m_pLaunchDarks, wxSizerFlags().Border(wxTOP, 5).Border(wxLEFT, 10));
    m_pvSizer->Add(m_pWrapUp, wxSizerFlags().Border(wxALL, 10).Expand().Center());

    // Row of buttons for prev, help, next
    wxBoxSizer *pButtonSizer = new wxBoxSizer(wxHORIZONTAL);
    m_pPrevBtn = new wxButton(this, ID_PREV, _("< Back"));
    m_pPrevBtn->SetToolTip(_("Back up to the previous screen"));

    m_pNextBtn = new wxButton(this, ID_NEXT, _("Next >"));
    m_pNextBtn->SetToolTip(_("Move forward to next screen"));

    pButtonSizer->AddStretchSpacer();
    pButtonSizer->Add(
        m_pPrevBtn,
        wxSizerFlags(0).Align(0).Border(wxALL, 5));
    pButtonSizer->Add(
        m_pNextBtn,
        wxSizerFlags(0).Align(0).Border(wxALL, 5));
    m_pvSizer->Add(pButtonSizer, wxSizerFlags().Expand().Border(wxALL, 10));

    // Status bar for error messages
    m_pStatusBar = new wxStatusBar(this, -1);
    m_pStatusBar->SetFieldsCount(1);
    m_pvSizer->Add(m_pStatusBar, 0, wxGROW);

    SetAutoLayout(true);
    SetSizerAndFit(m_pvSizer);
    // Special cases - neither AuxMount nor AO requires an explicit user choice
    m_SelectedAuxMount = _("None");
    m_SelectedAO = _("None");
    if (firstLight)
        m_State = STATE_GREETINGS;
    else
        m_State = STATE_CAMERA;
    UpdateState(0);
}
示例#3
0
文件: camera.cpp 项目: knro/phd2
CameraConfigDialogPane::CameraConfigDialogPane(wxWindow *pParent, GuideCamera *pCamera)
    : ConfigDialogPane(_("Camera Settings"), pParent)
{
    assert(pCamera);

    m_pCamera = pCamera;

    if (m_pCamera->HasSubframes)
    {
        m_pUseSubframes = new wxCheckBox(pParent, wxID_ANY,_("Use Subframes"), wxPoint(-1,-1), wxSize(75,-1));
        DoAdd(m_pUseSubframes, _("Check to only download subframes (ROIs) if your camera supports it"));
    }

    int numRows = (int)m_pCamera->HasGainControl + (int)m_pCamera->HasDelayParam + (int)m_pCamera->HasPortNum + 1;

    wxFlexGridSizer *pCamControls = new wxFlexGridSizer(numRows, 2, 5, 15);

    int width = StringWidth(_T("0000")) + 30;
    // Pixel size always
    m_pPixelSize = NewSpinnerDouble(pParent, width, m_pCamera->GetCameraPixelSize(), 0.0, 99.9, 0.1,
        _("Guide camera pixel size in microns. Used with the guide telescope focal length to display guiding error in arc-seconds."));
    AddTableEntryPair(pParent, pCamControls, _("Pixel size"), m_pPixelSize);

    // Gain control
    if (m_pCamera->HasGainControl)
    {
        int width = StringWidth(_T("0000")) + 30;
        m_pCameraGain = NewSpinnerInt(pParent, width, 100, 0, 100, 1, _("Camera gain boost ? Default = 95 % , lower if you experience noise or wish to guide on a very bright star. Not available on all cameras."));
        AddTableEntryPair(pParent, pCamControls, _("Camera gain"), m_pCameraGain);
    }

    // Delay parameter
    if (m_pCamera->HasDelayParam)
    {
        int width = StringWidth(_T("0000")) + 30;
        m_pDelay = NewSpinnerInt(pParent, width, 5, 0, 250, 150, _("LE Read Delay (ms) , Adjust if you get dropped frames"));
        AddTableEntryPair(pParent, pCamControls, _("Delay"), m_pDelay);
    }

    // Port number
    if (m_pCamera->HasPortNum)
    {
        wxString port_choices[] = {
            _T("Port 378"), _T("Port 3BC"), _T("Port 278"), _T("COM1"), _T("COM2"), _T("COM3"), _T("COM4"),
            _T("COM5"), _T("COM6"), _T("COM7"), _T("COM8"), _T("COM9"), _T("COM10"), _T("COM11"), _T("COM12"),
            _T("COM13"), _T("COM14"), _T("COM15"), _T("COM16"),
        };

        int width = StringArrayWidth(port_choices, WXSIZEOF(port_choices));
        m_pPortNum = new wxChoice(pParent, wxID_ANY, wxPoint(-1, -1),
                                  wxSize(width + 35, -1), WXSIZEOF(port_choices), port_choices);
        m_pPortNum->SetToolTip(_("Port number for long-exposure control"));
        AddTableEntryPair(pParent, pCamControls, _("LE Port"), m_pPortNum);
    }

    // Watchdog timeout
    {
        int width = StringWidth(_T("0000")) + 30;
        m_timeoutVal = NewSpinnerInt(pParent, width, 5, 5, 9999, 1, wxString::Format(_("The camera will be disconnected if it fails to respond for this long. The default value, %d seconds, should be appropriate for most cameras."), DefaultGuideCameraTimeoutMs / 1000));
        AddTableEntryPair(pParent, pCamControls, _("Disconnect nonresponsive\ncamera after (seconds)"), m_timeoutVal);
    }

    Add(pCamControls);
}