Skip to content

Commit

Permalink
WIP - Leo's plantary changes from https://github.com/Eyeke2/phd2.plan…
Browse files Browse the repository at this point in the history
  • Loading branch information
agalasso committed Jan 13, 2025
1 parent 0927de6 commit 090ad38
Show file tree
Hide file tree
Showing 29 changed files with 4,379 additions and 385 deletions.
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,10 @@ set(phd2_SRC
${phd_src_dir}/phdupdate.h
${phd_src_dir}/pierflip_tool.cpp
${phd_src_dir}/pierflip_tool.h
${phd_src_dir}/planetary_tool.cpp
${phd_src_dir}/planetary_tool.h
${phd_src_dir}/planetary.cpp
${phd_src_dir}/planetary.h
${phd_src_dir}/polardrift_tool.h
${phd_src_dir}/polardrift_toolwin.h
${phd_src_dir}/polardrift_toolwin.cpp
Expand Down
Binary file added icons/eclipse.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
322 changes: 322 additions & 0 deletions icons/eclipse.png.h

Large diffs are not rendered by default.

32 changes: 17 additions & 15 deletions src/aui_controls.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -382,15 +382,19 @@ SBStarIndicators::SBStarIndicators(SBPanel *panel, std::vector<int>& fldWidths)

int txtHeight;
panel->GetTextExtent(_("SNR"), &snrLabelWidth, &txtHeight);
panel->GetTextExtent("999.9", &snrValueWidth, &txtHeight);
panel->GetTextExtent(_("SAT"), &satWidth, &txtHeight);
panel->GetTextExtent("99999.9", &snrValueWidth, &txtHeight);
panel->GetTextExtent(_("OBJECT"), &satWidth, &txtHeight);
fldWidths.push_back(satWidth + 1 * panel->emWidth);
fldWidths.push_back(snrLabelWidth + snrValueWidth + 2 * panel->emWidth);

// Use default positions for control creation - positioning is handled explicitly in PositionControls()
txtStarInfo = new wxStaticText(panel, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(satWidth, -1));
txtStarInfo->SetBackgroundColour(*wxBLACK);
txtStarInfo->SetForegroundColour(*wxWHITE);
txtStarInfo->SetToolTip(_("In multiple star mode, displays the number of guiding stars out of the total detected. "
"In single star mode, shows 'STAR*' (or 'SAT' if the star is saturated), and 'OBJECT' in "
"solar/planetary detection mode."));

// Label and value fields separated to allow different foreground colors for each
txtSNRLabel = new wxStaticText(panel, wxID_ANY, _("SNR"), wxDefaultPosition, wxDefaultSize);
txtSNRValue = new wxStaticText(panel, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(snrValueWidth, 3), wxALIGN_RIGHT);
Expand Down Expand Up @@ -432,21 +436,19 @@ void SBStarIndicators::UpdateState(double MassPct, double SNR, bool Saturated)
txtSNRValue->SetForegroundColour(*wxRED);
}
m_parentPanel->ShowControl(txtSNRLabel, true);
txtSNRValue->SetLabelText(wxString::Format("%3.1f", SNR));
txtSNRValue->SetLabelText(wxString::Format("%4.1f", SNR));
m_parentPanel->ShowControl(txtStarInfo, true);
m_parentPanel->ShowControl(txtSNRValue, true);
if (pFrame->pGuider->GetMultiStarMode())
{
wxString txtCount = pFrame->pGuider->GetStarCount();
txtStarInfo->SetLabelText(txtCount);
}

// Update the star info text
wxString starText;
if (pFrame->GetStarFindMode() == Star::FIND_PLANET)
starText = _T("OBJECT");
else if (pFrame->pGuider->GetMultiStarMode())
starText = pFrame->pGuider->GetStarCount();
else
{
if (Saturated)
txtStarInfo->SetLabelText("SAT");
else
txtStarInfo->SetLabelText(wxEmptyString);
}
starText = Saturated ? _T(" SAT ") : _T("STAR*");
txtStarInfo->SetLabelText(starText);
}
else
{
Expand Down Expand Up @@ -521,7 +523,7 @@ void SBGuideIndicators::PositionControls()
wxPoint decPosition = m_parentPanel->FieldLoc(fieldNum);
txtDecAmounts->SetPosition(decPosition);

decPosition.x += txtWidth + 8;
decPosition.x += txtWidth + 18;
decPosition.y -= 1;
bitmapDec->SetPosition(decPosition);
}
Expand Down
3 changes: 3 additions & 0 deletions src/camera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -696,6 +696,9 @@ bool GuideCamera::SetCameraGain(int cameraGain)

pConfig->Profile.SetInt("/camera/gain", GuideCameraGain);

if (pFrame)
pFrame->UpdateCameraSettings();

return bError;
}

Expand Down
26 changes: 26 additions & 0 deletions src/comdispatch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,24 @@ bool DispatchObj::PutProp(DISPID dispid, double val)
return SUCCEEDED(hr);
}

bool DispatchObj::PutProp(DISPID dispid, LONG val)
{
VARIANTARG rgvarg[1];
rgvarg[0].vt = VT_I4;
rgvarg[0].lVal = val;
DISPID dispidNamed = DISPID_PROPERTYPUT;
DISPPARAMS dispParms;
dispParms.cArgs = 1;
dispParms.rgvarg = rgvarg;
dispParms.cNamedArgs = 1;
dispParms.rgdispidNamedArgs = &dispidNamed;
Variant res;
HRESULT hr = m_idisp->Invoke(dispid, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_PROPERTYPUT, &dispParms, &res, &m_excep, NULL);
if (FAILED(hr))
Debug.AddLine(wxString::Format("putprop: [%x] %s", hr, _com_error(hr).ErrorMessage()));
return SUCCEEDED(hr);
}

bool DispatchObj::PutProp(OLECHAR *name, bool val)
{
DISPID dispid;
Expand All @@ -285,6 +303,14 @@ bool DispatchObj::PutProp(OLECHAR *name, bool val)
return PutProp(dispid, val);
}

bool DispatchObj::PutProp(OLECHAR *name, double val)
{
DISPID dispid;
if (!GetDispatchId(&dispid, name))
return false;
return PutProp(dispid, val);
}

bool DispatchObj::InvokeMethod(Variant *res, OLECHAR *name, OLECHAR *arg)
{
DISPID dispid;
Expand Down
2 changes: 2 additions & 0 deletions src/comdispatch.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,9 @@ class DispatchObj
bool PutProp(OLECHAR *name, OLECHAR *val);
bool PutProp(DISPID dispid, bool val);
bool PutProp(DISPID dispid, double val);
bool PutProp(DISPID dispid, LONG val);
bool PutProp(OLECHAR *name, bool val);
bool PutProp(OLECHAR *name, double val);
bool InvokeMethod(Variant *res, OLECHAR *name);
bool InvokeMethod(Variant *res, OLECHAR *name, OLECHAR *arg);
bool InvokeMethod(Variant *res, OLECHAR *name, double arg1, double arg2);
Expand Down
7 changes: 7 additions & 0 deletions src/gear_dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
*/

#include "phd.h"
#include "planetary.h"
#include "profile_wizard.h"

#include <wx/gbsizer.h>
Expand Down Expand Up @@ -1106,6 +1107,9 @@ bool GearDialog::DoConnectCamera(bool autoReconnecting)
throw THROW_INFO("DoConnectCamera: connect failed");
}

// Notify solar/planetary module of camera connect
pFrame->pGuider->m_SolarSystemObject->NotifyCameraConnect(true);

// update camera pixel size from the driver, cam must be connected for reliable results
double prevPixelSize = m_pCamera->GetProfilePixelSize();
double pixelSize;
Expand Down Expand Up @@ -1264,6 +1268,9 @@ void GearDialog::OnButtonDisconnectCamera(wxCommandEvent& event)

m_pCamera->Disconnect();

// Notify solar/planetary module of camera disconnect
pFrame->pGuider->m_SolarSystemObject->NotifyCameraConnect(false);

if (m_pScope && m_pScope->RequiresCamera() && m_pScope->IsConnected())
{
Debug.Write("gear_dialog: scope requires camera so disconnecting scope\n");
Expand Down
Loading

0 comments on commit 090ad38

Please sign in to comment.