Revision 07d422a97efd13e2c9cc89135ae2b9c9c982136f authored by Mike Stewart on 07 August 2019, 06:38:15 UTC, committed by Mike Stewart on 07 August 2019, 06:38:15 UTC
1 parent 047a9d2
yaDSKYb1-widgetized.cpp
// -*- C++ -*-
//
// generated by wxGlade 0.6.8 on Sat Sep 10 08:02:28 2016
//
// Example for compiling a single file project under Linux using g++:
// g++ MyApp.cpp $(wx-config --libs) $(wx-config --cxxflags) -o MyApp
//
// Example for compiling a multi file project under Linux using g++:
// g++ main.cpp $(wx-config --libs) $(wx-config --cxxflags) -o MyApp Dialog1.cpp Frame1.cpp
//
#include <wx/stdpaths.h>
#include "yaDSKYb1.h"
// begin wxGlade: ::extracode
// end wxGlade
MyFrame* frame;
BEGIN_EVENT_TABLE(wxImagePanel, wxPanel)
EVT_PAINT(wxImagePanel::paintEvent)
END_EVENT_TABLE()
wxImagePanel::wxImagePanel(wxFrame* parent, wxString file, wxBitmapType format) :
wxPanel(parent)
{
// load the file... ideally add a check to see if loading was successful
image.LoadFile(file, format);
}
/*
* Called by the system of by wxWidgets when the panel needs
* to be redrawn. You can also trigger this call by
* calling Refresh()/Update().
*/
void
wxImagePanel::paintEvent(wxPaintEvent & evt)
{
// depending on your system you may need to look at double-buffered dcs
wxPaintDC dc(this);
render(dc);
}
/*
* Alternatively, you can use a clientDC to paint on the panel
* at any time. Using this generally does not free you from
* catching paint events, since it is possible that e.g. the window
* manager throws away your drawing when the window comes to the
* background, and expects you will redraw it when the window comes
* back (by sending a paint event).
*/
void
wxImagePanel::paintNow()
{
// depending on your system you may need to look at double-buffered dcs
wxClientDC dc(this);
render(dc);
}
/*
* Here we do the actual rendering. I put it in a separate
* method so that it can work no matter what type of DC
* (e.g. wxPaintDC or wxClientDC) is used.
*/
void
wxImagePanel::render(wxDC& dc)
{
dc.DrawBitmap(image, 0, 0, false);
}
MyFrame::MyFrame(wxWindow* parent, int id, const wxString& title,
const wxString& images, bool inNavBay, const wxPoint& pos,
const wxSize& size, long style) :
wxFrame(parent, id, title, pos, size, wxDEFAULT_FRAME_STYLE)
{
// begin wxGlade: MyFrame::MyFrame
imageDirectory = images;
navBay = inNavBay;
panel = new wxImagePanel(this,
imageDirectory
+ (navBay ?
wxT("Block1DSKYnav-face-bare.png") :
wxT("Block1DSKYmain-face-bare.png")), wxBITMAP_TYPE_PNG);
UpTelAccept = false;
flashing = false;
flashStateLit = true;
flashCounter = 0;
imageUpTelBlock = wxBitmap(imageDirectory + wxT("UpTel-block-20x40.png"),
wxBITMAP_TYPE_ANY);
imageUpTelAccept = wxBitmap(imageDirectory + wxT("UpTel-accept-20x40.png"),
wxBITMAP_TYPE_ANY);
image7Seg0 = wxBitmap(imageDirectory + wxT("7Seg-0-33x38.jpg"),
wxBITMAP_TYPE_ANY);
image7Seg15 = wxBitmap(imageDirectory + wxT("7Seg-15-33x38.jpg"),
wxBITMAP_TYPE_ANY);
image7Seg19 = wxBitmap(imageDirectory + wxT("7Seg-19-33x38.jpg"),
wxBITMAP_TYPE_ANY);
image7Seg21 = wxBitmap(imageDirectory + wxT("7Seg-21-33x38.jpg"),
wxBITMAP_TYPE_ANY);
image7Seg25 = wxBitmap(imageDirectory + wxT("7Seg-25-33x38.jpg"),
wxBITMAP_TYPE_ANY);
image7Seg27 = wxBitmap(imageDirectory + wxT("7Seg-27-33x38.jpg"),
wxBITMAP_TYPE_ANY);
image7Seg28 = wxBitmap(imageDirectory + wxT("7Seg-28-33x38.jpg"),
wxBITMAP_TYPE_ANY);
image7Seg29 = wxBitmap(imageDirectory + wxT("7Seg-29-33x38.jpg"),
wxBITMAP_TYPE_ANY);
image7Seg30 = wxBitmap(imageDirectory + wxT("7Seg-30-33x38.jpg"),
wxBITMAP_TYPE_ANY);
image7Seg31 = wxBitmap(imageDirectory + wxT("7Seg-31-33x38.jpg"),
wxBITMAP_TYPE_ANY);
image7Seg3 = wxBitmap(imageDirectory + wxT("7Seg-3-33x38.jpg"),
wxBITMAP_TYPE_ANY);
imagePlusMinusPlus = wxBitmap(
imageDirectory + wxT("PlusMinus-plus-28x38.jpg"), wxBITMAP_TYPE_ANY);
imagePlusMinusMinus = wxBitmap(
imageDirectory + wxT("PlusMinus-minus-28x38.jpg"), wxBITMAP_TYPE_ANY);
imagePlusMinusOff = wxBitmap(imageDirectory + wxT("PlusMinus-off-28x38.jpg"),
wxBITMAP_TYPE_ANY);
imageUptlOn = wxBitmap(imageDirectory + wxT("Uptl-on-43x37.png"),
wxBITMAP_TYPE_ANY);
imageUptlOff = wxBitmap(imageDirectory + wxT("Uptl-off-43x37.png"),
wxBITMAP_TYPE_ANY);
imageCompOn = wxBitmap(imageDirectory + wxT("Comp-on-43x37.png"),
wxBITMAP_TYPE_ANY);
imageCompOff = wxBitmap(imageDirectory + wxT("Comp-off-43x37.png"),
wxBITMAP_TYPE_ANY);
imageVerbLabelOn = wxBitmap(imageDirectory + (navBay ?
wxT("VerbLabel-nav-on-85x21.png") :
wxT("VerbLabel-on-85x21.png")),
wxBITMAP_TYPE_ANY);
imageVerbLabelOff = wxBitmap(
imageDirectory
+ (navBay ?
wxT("VerbLabel-nav-off-85x21.png") :
wxT("VerbLabel-off-85x21.png")), wxBITMAP_TYPE_ANY);
imageNounLabelOn =
wxBitmap(
imageDirectory
+ (navBay ?
wxT("NounLabel-nav-on-93x21.png") :
wxT("NounLabel-on-93x21.png")), wxBITMAP_TYPE_ANY);
imageNounLabelOff = wxBitmap(imageDirectory + (navBay ?
wxT("NounLabel-nav-off-93x21.png") :
wxT("NounLabel-off-93x21.png")),
wxBITMAP_TYPE_ANY);
imageCompFailOn = wxBitmap(imageDirectory + wxT("CompFail-on-63x44.png"),
wxBITMAP_TYPE_ANY);
imageCompFailOff = wxBitmap(imageDirectory + wxT("CompFail-off-63x44.png"),
wxBITMAP_TYPE_ANY);
imageCheckFailOn = wxBitmap(imageDirectory + wxT("CheckFail-on-63x44.png"),
wxBITMAP_TYPE_ANY);
imageCheckFailOff = wxBitmap(imageDirectory + wxT("CheckFail-off-63x44.png"),
wxBITMAP_TYPE_ANY);
imageProgAlmOn = wxBitmap(imageDirectory + wxT("ProgAlm-on-63x44.png"),
wxBITMAP_TYPE_ANY);
imageProgAlmOff = wxBitmap(imageDirectory + wxT("ProgAlm-off-63x44.png"),
wxBITMAP_TYPE_ANY);
imageCounterFailOn = wxBitmap(
imageDirectory + wxT("CounterFail-on-63x44.png"), wxBITMAP_TYPE_ANY);
imageCounterFailOff = wxBitmap(
imageDirectory + wxT("CounterFail-off-63x44.png"), wxBITMAP_TYPE_ANY);
imageRuptLockOn = wxBitmap(imageDirectory + wxT("RuptLock-on-63x44.png"),
wxBITMAP_TYPE_ANY);
imageRuptLockOff = wxBitmap(imageDirectory + wxT("RuptLock-off-63x44.png"),
wxBITMAP_TYPE_ANY);
imageTcTrapOn = wxBitmap(imageDirectory + wxT("TcTrap-on-63x44.png"),
wxBITMAP_TYPE_ANY);
imageTcTrapOff = wxBitmap(imageDirectory + wxT("TcTrap-off-63x44.png"),
wxBITMAP_TYPE_ANY);
imageScalerFailOn = wxBitmap(imageDirectory + wxT("ScalerFail-on-63x44.png"),
wxBITMAP_TYPE_ANY);
imageScalerFailOff = wxBitmap(
imageDirectory + wxT("ScalerFail-off-63x44.png"), wxBITMAP_TYPE_ANY);
imageTmFailOn = wxBitmap(imageDirectory + wxT("TmFail-on-63x44.png"),
wxBITMAP_TYPE_ANY);
imageTmFailOff = wxBitmap(imageDirectory + wxT("TmFail-off-63x44.png"),
wxBITMAP_TYPE_ANY);
imageKeyRlseOn = wxBitmap(imageDirectory + wxT("KeyRlse-on-63x44.png"),
wxBITMAP_TYPE_ANY);
imageKeyRlseOff = wxBitmap(imageDirectory + wxT("KeyRlse-off-63x44.png"),
wxBITMAP_TYPE_ANY);
imageBlankOn = wxBitmap(imageDirectory + wxT("Blank-on-63x44.png"),
wxBITMAP_TYPE_ANY);
imageBlankOff = wxBitmap(imageDirectory + wxT("Blank-off-63x44.png"),
wxBITMAP_TYPE_ANY);
imageParityFailOn = wxBitmap(imageDirectory + wxT("ParityFail-on-63x44.png"),
wxBITMAP_TYPE_ANY);
imageParityFailOff = wxBitmap(
imageDirectory + wxT("ParityFail-off-63x44.png"), wxBITMAP_TYPE_ANY);
indicatorCompFail = new wxStaticBitmap(panel, wxID_ANY, imageCompFailOff);
indicatorCheckFail = new wxStaticBitmap(panel, wxID_ANY, imageCheckFailOff);
indicatorProgAlm = new wxStaticBitmap(panel, wxID_ANY, imageProgAlmOff);
indicatorCounterFail = new wxStaticBitmap(panel, wxID_ANY,
imageCounterFailOff);
indicatorRuptLock = new wxStaticBitmap(panel, wxID_ANY, imageRuptLockOff);
indicatorTcTrap = new wxStaticBitmap(panel, wxID_ANY, imageTcTrapOff);
indicatorScalerFail = new wxStaticBitmap(panel, wxID_ANY, imageScalerFailOff);
indicatorTmFail = new wxStaticBitmap(panel, wxID_ANY, imageTmFailOff);
indicatorParityFail = new wxStaticBitmap(panel, wxID_ANY, imageParityFailOff);
indicatorKeyRlse = new wxStaticBitmap(panel, wxID_ANY, imageKeyRlseOff);
indicatorTopMiddle = new wxStaticBitmap(panel, wxID_ANY, imageBlankOff);
indicatorBottomLeft = new wxStaticBitmap(panel, wxID_ANY, imageBlankOff);
indicatorBottomRight = new wxStaticBitmap(panel, wxID_ANY, imageBlankOff);
indicatorUpTl = new wxStaticBitmap(panel, wxID_ANY, imageUptlOff);
indicatorComp = new wxStaticBitmap(panel, wxID_ANY, imageCompOff);
labelNoun = new wxStaticBitmap(panel, wxID_ANY, imageNounLabelOn);
labelVerb = new wxStaticBitmap(panel, wxID_ANY, imageVerbLabelOn);
digitProgramLeft = new wxStaticBitmap(panel, wxID_ANY, image7Seg0);
digitProgramRight = new wxStaticBitmap(panel, wxID_ANY, image7Seg0);
digitVerbLeft = new wxStaticBitmap(panel, wxID_ANY, image7Seg0);
digitVerbRight = new wxStaticBitmap(panel, wxID_ANY, image7Seg0);
digitNounLeft = new wxStaticBitmap(panel, wxID_ANY, image7Seg0);
digitNounRight = new wxStaticBitmap(panel, wxID_ANY, image7Seg0);
PlusMinusReg1 = new wxStaticBitmap(panel, wxID_ANY, imagePlusMinusOff);
Digit1Reg1 = new wxStaticBitmap(panel, wxID_ANY, image7Seg0);
Digit2Reg1 = new wxStaticBitmap(panel, wxID_ANY, image7Seg0);
Digit3Reg1 = new wxStaticBitmap(panel, wxID_ANY, image7Seg0);
Digit4Reg1 = new wxStaticBitmap(panel, wxID_ANY, image7Seg0);
Digit5Reg1 = new wxStaticBitmap(panel, wxID_ANY, image7Seg0);
PlusMinusReg2 = new wxStaticBitmap(panel, wxID_ANY, imagePlusMinusOff);
Digit1Reg2 = new wxStaticBitmap(panel, wxID_ANY, image7Seg0);
Digit2Reg2 = new wxStaticBitmap(panel, wxID_ANY, image7Seg0);
Digit3Reg2 = new wxStaticBitmap(panel, wxID_ANY, image7Seg0);
Digit4Reg2 = new wxStaticBitmap(panel, wxID_ANY, image7Seg0);
Digit5Reg2 = new wxStaticBitmap(panel, wxID_ANY, image7Seg0);
PlusMinusReg3 = new wxStaticBitmap(panel, wxID_ANY, imagePlusMinusOff);
Digit1Reg3 = new wxStaticBitmap(panel, wxID_ANY, image7Seg0);
Digit2Reg3 = new wxStaticBitmap(panel, wxID_ANY, image7Seg0);
Digit3Reg3 = new wxStaticBitmap(panel, wxID_ANY, image7Seg0);
Digit4Reg3 = new wxStaticBitmap(panel, wxID_ANY, image7Seg0);
Digit5Reg3 = new wxStaticBitmap(panel, wxID_ANY, image7Seg0);
SwitchUpTel = new wxBitmapButton(panel, ID_UPTELSWITCH, imageUpTelBlock);
ButtonKeyRlse = new wxBitmapButton(panel, ID_KEYRLSEBUTTON,
wxBitmap(imageDirectory + wxT("KeyRlse-60x60.png"), wxBITMAP_TYPE_ANY));
ButtonErrorReset = new wxBitmapButton(panel, ID_KEYRLSEBUTTON,
wxBitmap(imageDirectory + wxT("ErrorReset-60x60.png"),
wxBITMAP_TYPE_ANY));
ButtonTestAlarm = new wxBitmapButton(panel, ID_TESTALARMBUTTON,
wxBitmap(imageDirectory + wxT("TestAlarm-60x60.png"), wxBITMAP_TYPE_ANY));
ButtonClear = new wxBitmapButton(panel, ID_CLEARBUTTON,
wxBitmap(imageDirectory + wxT("Clear-60x60.png"), wxBITMAP_TYPE_ANY));
ButtonVerb = new wxBitmapButton(panel, ID_VERBBUTTON,
wxBitmap(imageDirectory + wxT("Verb-60x60.png"), wxBITMAP_TYPE_ANY));
ButtonNoun = new wxBitmapButton(panel, ID_NOUNBUTTON,
wxBitmap(imageDirectory + wxT("Noun-60x60.png"), wxBITMAP_TYPE_ANY));
ButtonEnter = new wxBitmapButton(panel, ID_ENTERBUTTON,
wxBitmap(imageDirectory + wxT("Enter-60x60.png"), wxBITMAP_TYPE_ANY));
ButtonPlus = new wxBitmapButton(panel, ID_PLUSBUTTON,
wxBitmap(imageDirectory + wxT("Plus-60x60.png"), wxBITMAP_TYPE_ANY));
Button7 = new wxBitmapButton(panel, ID_SEVENBUTTON,
wxBitmap(imageDirectory + wxT("7-60x60.png"), wxBITMAP_TYPE_ANY));
Button8 = new wxBitmapButton(panel, ID_EIGHTBUTTON,
wxBitmap(imageDirectory + wxT("8-60x60.png"), wxBITMAP_TYPE_ANY));
Button9 = new wxBitmapButton(panel, ID_NINEBUTTON,
wxBitmap(imageDirectory + wxT("9-60x60.png"), wxBITMAP_TYPE_ANY));
ButtonMinus = new wxBitmapButton(panel, ID_MINUSBUTTON,
wxBitmap(imageDirectory + wxT("Minus-60x60.png"), wxBITMAP_TYPE_ANY));
Button4 = new wxBitmapButton(panel, ID_FOURBUTTON,
wxBitmap(imageDirectory + wxT("4-60x60.png"), wxBITMAP_TYPE_ANY));
Button5 = new wxBitmapButton(panel, ID_FIVEBUTTON,
wxBitmap(imageDirectory + wxT("5-60x60.png"), wxBITMAP_TYPE_ANY));
Button6 = new wxBitmapButton(panel, ID_SIXBUTTON,
wxBitmap(imageDirectory + wxT("6-60x60.png"), wxBITMAP_TYPE_ANY));
Button0 = new wxBitmapButton(panel, ID_ZEROBUTTON,
wxBitmap(imageDirectory + wxT("0-60x60.png"), wxBITMAP_TYPE_ANY));
Button1 = new wxBitmapButton(panel, ID_ONEBUTTON,
wxBitmap(imageDirectory + wxT("1-60x60.png"), wxBITMAP_TYPE_ANY));
Button2 = new wxBitmapButton(panel, ID_TWOBUTTON,
wxBitmap(imageDirectory + wxT("2-60x60.png"), wxBITMAP_TYPE_ANY));
Button3 = new wxBitmapButton(panel, ID_THREEBUTTON,
wxBitmap(imageDirectory + wxT("3-60x60.png"), wxBITMAP_TYPE_ANY));
set_properties();
do_layout();
// end wxGlade
}
void
MyFrame::set_properties()
{
// begin wxGlade: MyFrame::set_properties
SetTitle(
navBay ? _("yaDSKY Block 1 Nav Bay") : _("yaDSKY Block 1 Control Panel"));
SetBackgroundColour(wxColour(214, 214, 214));
SwitchUpTel->SetSize(SwitchUpTel->GetBestSize());
ButtonKeyRlse->SetSize(wxSize(60, 60));
ButtonTestAlarm->SetSize(wxSize(60, 60));
ButtonErrorReset->SetSize(wxSize(60, 60));
ButtonClear->SetSize(wxSize(60, 60));
ButtonVerb->SetSize(wxSize(60, 60));
ButtonNoun->SetSize(wxSize(60, 60));
ButtonEnter->SetSize(wxSize(60, 60));
ButtonPlus->SetSize(wxSize(60, 60));
Button7->SetSize(wxSize(60, 60));
Button8->SetSize(wxSize(60, 60));
Button9->SetSize(wxSize(60, 60));
ButtonMinus->SetSize(wxSize(60, 60));
Button4->SetSize(wxSize(60, 60));
Button5->SetSize(wxSize(60, 60));
Button6->SetSize(wxSize(60, 60));
Button0->SetSize(wxSize(60, 60));
Button1->SetSize(wxSize(60, 60));
Button2->SetSize(wxSize(60, 60));
Button3->SetSize(wxSize(60, 60));
ButtonKeyRlse->SetMinSize(wxSize(60, 60));
ButtonTestAlarm->SetMinSize(wxSize(60, 60));
ButtonErrorReset->SetMinSize(wxSize(60, 60));
ButtonClear->SetMinSize(wxSize(60, 60));
ButtonVerb->SetMinSize(wxSize(60, 60));
ButtonNoun->SetMinSize(wxSize(60, 60));
ButtonEnter->SetMinSize(wxSize(60, 60));
ButtonPlus->SetMinSize(wxSize(60, 60));
Button7->SetMinSize(wxSize(60, 60));
Button8->SetMinSize(wxSize(60, 60));
Button9->SetMinSize(wxSize(60, 60));
ButtonMinus->SetMinSize(wxSize(60, 60));
Button4->SetMinSize(wxSize(60, 60));
Button5->SetMinSize(wxSize(60, 60));
Button6->SetMinSize(wxSize(60, 60));
Button0->SetMinSize(wxSize(60, 60));
Button1->SetMinSize(wxSize(60, 60));
Button2->SetMinSize(wxSize(60, 60));
Button3->SetMinSize(wxSize(60, 60));
panel->SetBackgroundColour(wxColour(0, 0, 0));
// end wxGlade
}
void
MyFrame::do_layout()
{
// For the main control panel, which was the first version I did, I used the
// stereotypical wxWidgets layout strategy, with sizer and what-not all over
// the place. It was extraordinarily complex to get that right, given that
// I didn't actually want anything to be resizable. (It doesn't *look* all that
// complex in the code, but there was endless pixel-by-pixel adjustment and
// readjustment to get it right.) With the nav-bay DSKY, I've gotten a little
// smarter. All the controls are simply positioned at absolute locations atop
// the background image at positions I just read off from the GIMP.
if (navBay)
{
int x, y, xStart, yStart, xDelta, yDelta;
indicatorCompFail->Show(false);
SwitchUpTel->Show(false);
SetSize(wxSize(346, 1151));
xDelta = 73;
yDelta = 48;
xStart = 69;
yStart = 81;
y = yStart;
x = xStart;
indicatorProgAlm->SetPosition(wxPoint(x, y));
x += xDelta;
indicatorTopMiddle->SetPosition(wxPoint(x, y));
x += xDelta;
indicatorCounterFail->SetPosition(wxPoint(x, y));
y += yDelta;
x = xStart;
indicatorRuptLock->SetPosition(wxPoint(x, y));
x += xDelta;
indicatorTcTrap->SetPosition(wxPoint(x, y));
x += xDelta;
indicatorScalerFail->SetPosition(wxPoint(x, y));
y += yDelta;
x = xStart;
indicatorParityFail->SetPosition(wxPoint(x, y));
x += xDelta;
indicatorTmFail->SetPosition(wxPoint(x, y));
x += xDelta;
indicatorCheckFail->SetPosition(wxPoint(x, y));
y += yDelta;
x = xStart;
indicatorBottomLeft->SetPosition(wxPoint(x, y));
x += xDelta;
indicatorKeyRlse->SetPosition(wxPoint(x, y));
x += xDelta;
indicatorBottomRight->SetPosition(wxPoint(x, y));
xDelta = 44;
yDelta = 0;
xStart = 72;
yStart = 346;
y = yStart;
x = xStart;
indicatorUpTl->SetPosition(wxPoint(x, y));
x += xDelta;
indicatorComp->SetPosition(wxPoint(x, y));
x += xDelta;
xDelta = 38;
yDelta = 0;
xStart = 197;
y = yStart;
x = xStart;
digitProgramLeft->SetPosition(wxPoint(x, y));
x += xDelta;
digitProgramRight->SetPosition(wxPoint(x, y));
x += xDelta;
xDelta = 38;
yDelta = 0;
xStart = 78;
yStart = 406;
y = yStart;
x = xStart;
digitVerbLeft->SetPosition(wxPoint(x, y));
x += xDelta;
digitVerbRight->SetPosition(wxPoint(x, y));
x += xDelta;
xDelta = 38;
yDelta = 0;
xStart = 197;
yStart = 406;
y = yStart;
x = xStart;
digitNounLeft->SetPosition(wxPoint(x, y));
x += xDelta;
digitNounRight->SetPosition(wxPoint(x, y));
x += xDelta;
xDelta = 33;
yDelta = 60;
xStart = 74;
yStart = 466;
y = yStart;
x = xStart;
PlusMinusReg1->SetPosition(wxPoint(x, y));
x += xDelta;
Digit1Reg1->SetPosition(wxPoint(x, y));
x += xDelta;
Digit2Reg1->SetPosition(wxPoint(x, y));
x += xDelta;
Digit3Reg1->SetPosition(wxPoint(x, y));
x += xDelta;
Digit4Reg1->SetPosition(wxPoint(x, y));
x += xDelta;
Digit5Reg1->SetPosition(wxPoint(x, y));
x += xDelta;
y += yDelta;
x = xStart;
PlusMinusReg2->SetPosition(wxPoint(x, y));
x += xDelta;
Digit1Reg2->SetPosition(wxPoint(x, y));
x += xDelta;
Digit2Reg2->SetPosition(wxPoint(x, y));
x += xDelta;
Digit3Reg2->SetPosition(wxPoint(x, y));
x += xDelta;
Digit4Reg2->SetPosition(wxPoint(x, y));
x += xDelta;
Digit5Reg2->SetPosition(wxPoint(x, y));
x += xDelta;
y += yDelta;
x = xStart;
PlusMinusReg3->SetPosition(wxPoint(x, y));
x += xDelta;
Digit1Reg3->SetPosition(wxPoint(x, y));
x += xDelta;
Digit2Reg3->SetPosition(wxPoint(x, y));
x += xDelta;
Digit3Reg3->SetPosition(wxPoint(x, y));
x += xDelta;
Digit4Reg3->SetPosition(wxPoint(x, y));
x += xDelta;
Digit5Reg3->SetPosition(wxPoint(x, y));
x += xDelta;
xDelta = 92;
yDelta = 0;
xStart = 51;
yStart = 823;
y = yStart;
x = xStart;
ButtonKeyRlse->SetPosition(wxPoint(x, y));
x += xDelta;
ButtonTestAlarm->SetPosition(wxPoint(x, y));
x += xDelta;
ButtonErrorReset->SetPosition(wxPoint(x, y));
x += xDelta;
xDelta = 61;
yDelta = 61;
xStart = 51;
yStart = 890;
y = yStart;
x = xStart;
ButtonClear->SetPosition(wxPoint(x, y));
x += xDelta;
ButtonVerb->SetPosition(wxPoint(x, y));
x += xDelta;
ButtonNoun->SetPosition(wxPoint(x, y));
x += xDelta;
ButtonEnter->SetPosition(wxPoint(x, y));
x += xDelta;
y += yDelta;
x = xStart;
ButtonPlus->SetPosition(wxPoint(x, y));
x += xDelta;
Button7->SetPosition(wxPoint(x, y));
x += xDelta;
Button8->SetPosition(wxPoint(x, y));
x += xDelta;
Button9->SetPosition(wxPoint(x, y));
x += xDelta;
y += yDelta;
x = xStart;
ButtonMinus->SetPosition(wxPoint(x, y));
x += xDelta;
Button4->SetPosition(wxPoint(x, y));
x += xDelta;
Button5->SetPosition(wxPoint(x, y));
x += xDelta;
Button6->SetPosition(wxPoint(x, y));
x += xDelta;
y += yDelta;
x = xStart;
Button0->SetPosition(wxPoint(x, y));
x += xDelta;
Button1->SetPosition(wxPoint(x, y));
x += xDelta;
Button2->SetPosition(wxPoint(x, y));
x += xDelta;
Button3->SetPosition(wxPoint(x, y));
x += xDelta;
labelVerb->SetPosition(wxPoint(71, 385));
labelNoun->SetPosition(wxPoint(188, 385));
}
else
{
// These are nav-bay widgets which aren't visible on the control-panel DSKY.
ButtonTestAlarm->Show(false);
indicatorProgAlm->Show(false);
indicatorCounterFail->Show(false);
indicatorRuptLock->Show(false);
indicatorTcTrap->Show(false);
indicatorScalerFail->Show(false);
indicatorTmFail->Show(false);
indicatorParityFail->Show(false);
indicatorKeyRlse->Show(false);
indicatorTopMiddle->Show(false);
indicatorBottomLeft->Show(false);
indicatorBottomRight->Show(false);
// begin wxGlade: MyFrame::do_layout
wxBoxSizer* sizer_1 = new wxBoxSizer(wxVERTICAL);
wxBoxSizer* sizer_2 = new wxBoxSizer(wxHORIZONTAL);
wxBoxSizer* sizer_4 = new wxBoxSizer(wxVERTICAL);
wxGridSizer* grid_sizer_1 = new wxGridSizer(4, 4, 2, 2); // Keypad
wxBoxSizer* sizer_5 = new wxBoxSizer(wxHORIZONTAL);
wxBoxSizer* sizer_6 = new wxBoxSizer(wxHORIZONTAL);
wxBoxSizer* sizer_3 = new wxBoxSizer(wxVERTICAL);
wxBoxSizer* sizer_7 = new wxBoxSizer(wxHORIZONTAL);
wxGridSizer* grid_sizer_2 = new wxGridSizer(3, 6, 22, 1); // Registers.
wxFlexGridSizer* grid_sizer_3 = new wxFlexGridSizer(3 /*2*/, 2, 0 /*21*/,
22); // Activity/Program/Verb/Noun
wxBoxSizer* sizer_12_copy_1 = new wxBoxSizer(wxHORIZONTAL);
wxBoxSizer* sizer_12_copy = new wxBoxSizer(wxHORIZONTAL);
wxBoxSizer* sizer_12 = new wxBoxSizer(wxHORIZONTAL);
wxBoxSizer* sizer_11 = new wxBoxSizer(wxHORIZONTAL);
wxBoxSizer* sizer_8 = new wxBoxSizer(wxHORIZONTAL);
sizer_2->Add(77, 20, 0, 0, 0); // Left margin
sizer_3->Add(20, 55, 0, 0, 0);
sizer_8->Add(39, 20, 0, 0, 0); // Left of CompFail.
sizer_8->Add(indicatorCompFail, 0, 0, 0);
sizer_8->Add(5, 20, 0, 0, 0); // Between CompFail and CheckFail
sizer_8->Add(indicatorCheckFail, 0, 0, 0);
sizer_8->Add(39, 20, 0, 0, 0); // Right of CheckFail
sizer_3->Add(sizer_8, 0, 0, 0);
sizer_3->Add(20, 113, 0, 0, 0);
sizer_11->Add(0, 20, 0, 0, 0);
sizer_11->Add(indicatorUpTl, 0, 0, 0);
sizer_11->Add(1, 20, 0, 0, 0);
sizer_11->Add(indicatorComp, 0, 0, 0);
sizer_11->Add(5, 20, 0, 0, 0);
grid_sizer_3->Add(sizer_11, 0, 0, 0);
sizer_12->Add(11, 20, 0, 0, 0);
sizer_12->Add(digitProgramLeft, 0, 0, 0);
sizer_12->Add(5, 20, 0, 0, 0);
sizer_12->Add(digitProgramRight, 0, 0, 0);
sizer_12->Add(12, 20, 0, 0, 0);
grid_sizer_3->Add(sizer_12, 0, 0, 0);
//grid_sizer_3->Add(20, 21, 0);
//grid_sizer_3->Add(20, 21, 0);
grid_sizer_3->Add(labelVerb, 0, 0, 0);
grid_sizer_3->Add(labelNoun, 0, 0, 0);
sizer_12_copy->Add(7, 20, 0, 0, 0);
sizer_12_copy->Add(digitVerbLeft, 0, 0, 0);
sizer_12_copy->Add(5, 20, 0, 0, 0);
sizer_12_copy->Add(digitVerbRight, 0, 0, 0);
sizer_12_copy->Add(12, 20, 0, 0, 0);
grid_sizer_3->Add(sizer_12_copy, 0, 0, 0);
sizer_12_copy_1->Add(11, 20, 0, 0, 0);
sizer_12_copy_1->Add(digitNounLeft, 0, 0, 0);
sizer_12_copy_1->Add(5, 20, 0, 0, 0);
sizer_12_copy_1->Add(digitNounRight, 0, 0, 0);
sizer_12_copy_1->Add(12, 20, 0, 0, 0);
grid_sizer_3->Add(sizer_12_copy_1, 0, 0, 0);
sizer_3->Add(grid_sizer_3, 0, wxALIGN_CENTER_VERTICAL, 0);
sizer_3->Add(20, 22, 0, 0, 0); // Between Reg1 and Verb/Noun
grid_sizer_2->Add(PlusMinusReg1, 0, 0, 0);
grid_sizer_2->Add(Digit1Reg1, 0, 0, 0);
grid_sizer_2->Add(Digit2Reg1, 0, 0, 0);
grid_sizer_2->Add(Digit3Reg1, 0, 0, 0);
grid_sizer_2->Add(Digit4Reg1, 0, 0, 0);
grid_sizer_2->Add(Digit5Reg1, 0, 0, 0);
grid_sizer_2->Add(PlusMinusReg2, 0, 0, 0);
grid_sizer_2->Add(Digit1Reg2, 0, 0, 0);
grid_sizer_2->Add(Digit2Reg2, 0, 0, 0);
grid_sizer_2->Add(Digit3Reg2, 0, 0, 0);
grid_sizer_2->Add(Digit4Reg2, 0, 0, 0);
grid_sizer_2->Add(Digit5Reg2, 0, 0, 0);
grid_sizer_2->Add(PlusMinusReg3, 0, 0, 0);
grid_sizer_2->Add(Digit1Reg3, 0, 0, 0);
grid_sizer_2->Add(Digit2Reg3, 0, 0, 0);
grid_sizer_2->Add(Digit3Reg3, 0, 0, 0);
grid_sizer_2->Add(Digit4Reg3, 0, 0, 0);
grid_sizer_2->Add(Digit5Reg3, 0, 0, 0);
sizer_7->Add(grid_sizer_2, 0, 0, 0);
sizer_3->Add(sizer_7, 0, 0, 0);
sizer_3->Add(20, 74, 0, 0, 0); // Below Reg3.
sizer_2->Add(sizer_3, 0, 0, 0);
sizer_2->Add(31, 20, 0, 0, 0); // Middle horizontal spacer.
sizer_4->Add(20, 46, 0, 0, 0); // Above SwitchUptel
sizer_6->Add(15, 20, 0, 0, 0); // Left of SwitchUptel
sizer_6->Add(SwitchUpTel, 0, 0, 0);
sizer_6->Add(184, 20, 0, 0, 0); // Right of SwitchUpTel
sizer_4->Add(sizer_6, 0, 0, 0);
sizer_4->Add(20, 101, 0, 0, 0); // Between KeyRlse and SwitchUpTel
sizer_5->Add(ButtonKeyRlse, 0, 0, 0);
sizer_5->Add(126, 20, 0, 0, 0); // Between KeyRlse and ErrorReset
sizer_5->Add(ButtonErrorReset, 0, 0, 0);
sizer_4->Add(sizer_5, 0, 0, 0);
sizer_4->Add(20, 6, 0, 0, 0); // Between KeyRlse and Keypad
grid_sizer_1->Add(ButtonClear, 0, 0, 0);
grid_sizer_1->Add(ButtonVerb, 0, 0, 0);
grid_sizer_1->Add(ButtonNoun, 0, 0, 0);
grid_sizer_1->Add(ButtonEnter, 0, 0, 0);
grid_sizer_1->Add(ButtonPlus, 0, 0, 0);
grid_sizer_1->Add(Button7, 0, 0, 0);
grid_sizer_1->Add(Button8, 0, 0, 0);
grid_sizer_1->Add(Button9, 0, 0, 0);
grid_sizer_1->Add(ButtonMinus, 0, 0, 0);
grid_sizer_1->Add(Button4, 0, 0, 0);
grid_sizer_1->Add(Button5, 0, 0, 0);
grid_sizer_1->Add(Button6, 0, 0, 0);
grid_sizer_1->Add(Button0, 0, 0, 0);
grid_sizer_1->Add(Button1, 0, 0, 0);
grid_sizer_1->Add(Button2, 0, 0, 0);
grid_sizer_1->Add(Button3, 0, 0, 0);
sizer_4->Add(grid_sizer_1, 0, 0, 0);
sizer_4->Add(20, 63, 0, 0, 0); // Below keypad
sizer_2->Add(sizer_4, 0, 0, 0);
sizer_2->Add(26, 20, 0, 0, 0);
panel->SetSizer(sizer_2);
sizer_1->Add(panel, 1, 0, 0);
SetSizer(sizer_1);
sizer_1->Fit(this);
Layout();
// end wxGlade
}
}
class MyApp : public wxApp
{
public:
bool
OnInit();
protected:
wxLocale m_locale; // locale we'll be using
};
IMPLEMENT_APP (MyApp)
bool
MyApp::OnInit()
{
wxString imageDirectory = wxT("images/");
bool navBay = false;
m_locale.Init();
#ifdef APP_LOCALE_DIR
m_locale.AddCatalogLookupPathPrefix(wxT(APP_LOCALE_DIR));
#endif
m_locale.AddCatalog(wxT(APP_CATALOG));
for (int i = 1; i < argc; i++)
{
wxString Arg = argv[i];
wxString ArgStart = Arg.BeforeFirst('=');
wxString ArgEnd = Arg.AfterFirst('=');
if (ArgStart.IsSameAs(wxT("--port")))
{
long lPortnum;
ArgEnd.ToLong(&lPortnum);
Portnum = lPortnum;
if (Portnum <= 0 || Portnum >= 0x10000)
{
printf("The --port switch is out of range. Must be 1-64K.\n");
goto Help;
}
}
else if (ArgStart.IsSameAs(wxT("--images")))
{
imageDirectory = ArgEnd;
}
else if (ArgStart.IsSameAs(wxT("--nav-bay")))
{
navBay = true;
}
else
{
Help: printf("USAGE:\n");
printf("\tyaDSKYb1 [OPTIONS]\n");
printf("The available options are:\n");
printf("--port=Portnumber\n");
printf(
"\tBy default, yaDSKYb1 attempts to connect to the yaAGCb1 program using port %d.\n",
Portnum);
printf(
"\tNote that by default, yaAGCb1 listens for new connections on ports 16971-16980.\n");
printf("--images=Directory\n");
printf(
"\tChanges the directory in which yaDSKYb1 finds its image resources from the\n");
printf("\tdefault (\"images/\"). Must have a trailing '/'.\n");
printf("--nav-bay\n");
printf(
"\tBy default, the main control-panel DSKY is shown. This selects the nav-bay DSKY.\n");
exit(1);
}
}
wxInitAllImageHandlers();
frame = new MyFrame(NULL, wxID_ANY, wxEmptyString, imageDirectory, navBay);
frame->Timer = new TimerClass();
frame->Timer->Start(PULSE_INTERVAL);
SetTopWindow(frame);
frame->Show();
return true;
}
![swh spinner](/static/img/swh-spinner.gif)
Computing file changes ...