Skip to content

Commit 2fd53c2

Browse files
committed
rtkconv, rtkpost: keep the start and end time in order
when they are first enabled. This helps default the end time to the start time if the start time is first set. This ordering is not enforced otherwise, but disabling and re-enabling a time will recheck the ordering.
1 parent 8caf06a commit 2fd53c2

4 files changed

Lines changed: 46 additions & 1 deletion

File tree

app/winapp/rtkconv/convmain.cpp

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -590,11 +590,33 @@ void __fastcall TMainWindow::BtnAboutClick(TObject *Sender)
590590
// callback on button-time-start --------------------------------------------
591591
void __fastcall TMainWindow::TimeStartFClick(TObject *Sender)
592592
{
593+
if (TimeStartF->Checked && TimeEndF->Checked) {
594+
// Initialize the start time to the end time if the start
595+
// time has just been enabled and is out of order.
596+
gtime_t ts={0},te={0};
597+
double tint=0.0,tunit=0.0;
598+
GetTime(&ts,&te,&tint,&tunit);
599+
if (timediff(te, ts) < 0.0) {
600+
TimeY1->Text = TimeY2->Text;
601+
TimeH1->Text = TimeH2->Text;
602+
}
603+
}
593604
UpdateEnable();
594605
}
595606
// callback on button-time-end ----------------------------------------------
596607
void __fastcall TMainWindow::TimeEndFClick(TObject *Sender)
597608
{
609+
if (TimeStartF->Checked && TimeEndF->Checked) {
610+
// Initialize the end time to the start time if the end time
611+
// has just been enabled and is out of order.
612+
gtime_t ts={0},te={0};
613+
double tint=0.0,tunit=0.0;
614+
GetTime(&ts,&te,&tint,&tunit);
615+
if (timediff(te, ts) < 0.0) {
616+
TimeY2->Text = TimeY1->Text;
617+
TimeH2->Text = TimeH1->Text;
618+
}
619+
}
598620
UpdateEnable();
599621
}
600622
// callback on button-time-interval -----------------------------------------

app/winapp/rtkpost/postmain.cpp

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -680,6 +680,28 @@ void __fastcall TMainForm::BtnKeywordClick(TObject *Sender)
680680
// callback on time-start/end check -----------------------------------------
681681
void __fastcall TMainForm::TimeStartClick(TObject *Sender)
682682
{
683+
if (TimeStart->Checked && TimeEnd->Checked) {
684+
// Initialize the start time to the end time if the start time
685+
// has just been enabled and is out of order.
686+
gtime_t ts=GetTime1(), te=GetTime2();
687+
if (timediff(te, ts) < 0.0) {
688+
TimeY1->Text = TimeY2->Text;
689+
TimeH1->Text = TimeH2->Text;
690+
}
691+
}
692+
UpdateEnable();
693+
}
694+
void __fastcall TMainForm::TimeEndClick(TObject *Sender)
695+
{
696+
if (TimeStart->Checked && TimeEnd->Checked) {
697+
// Initialize the end time to the start time if the end time has
698+
// just been enabled and is out of order.
699+
gtime_t ts=GetTime1(), te=GetTime2();
700+
if (timediff(te, ts) < 0.0) {
701+
TimeY2->Text = TimeY1->Text;
702+
TimeH2->Text = TimeH1->Text;
703+
}
704+
}
683705
UpdateEnable();
684706
}
685707
// callback on time-interval check ------------------------------------------

app/winapp/rtkpost/postmain.dfm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ object MainForm: TMainForm
225225
Height = 17
226226
Caption = 'Time End (GPST)'
227227
TabOrder = 5
228-
OnClick = TimeStartClick
228+
OnClick = TimeEndClick
229229
end
230230
object BtnTime2: TSpeedButton
231231
Left = 298

app/winapp/rtkpost/postmain.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ class TMainForm : public TForm
141141
void __fastcall BtnKeywordClick (TObject *Sender);
142142

143143
void __fastcall TimeStartClick (TObject *Sender);
144+
void __fastcall TimeEndClick (TObject *Sender);
144145
void __fastcall TimeIntFClick (TObject *Sender);
145146
void __fastcall TimeUnitFClick (TObject *Sender);
146147
void __fastcall InputFile1Change (TObject *Sender);

0 commit comments

Comments
 (0)