mirror of
https://git.code.sf.net/p/fldigi/flmsg
synced 2026-08-13 17:30:58 -04:00
Calendar widget
* Fix to year display bug
This commit is contained in:
parent
99633feb6a
commit
1a5b433b3e
4 changed files with 72 additions and 32 deletions
|
|
@ -1519,6 +1519,7 @@ Fl_Round_Button *btn_dtformat0 = (Fl_Round_Button *)0;
|
|||
Fl_Round_Button *btn_dtformat1 = (Fl_Round_Button *)0;
|
||||
Fl_Round_Button *btn_dtformat2 = (Fl_Round_Button *)0;
|
||||
Fl_Round_Button *btn_dtformat3 = (Fl_Round_Button *)0;
|
||||
Fl_Round_Button *btn_dtformat4 = (Fl_Round_Button *)0;
|
||||
Fl_Round_Button *btn_utc_format0 = (Fl_Round_Button *)0;
|
||||
Fl_Round_Button *btn_utc_format1 = (Fl_Round_Button *)0;
|
||||
Fl_Round_Button *btn_utc_format2 = (Fl_Round_Button *)0;
|
||||
|
|
@ -1561,46 +1562,75 @@ void set_datetime_widgets()
|
|||
|
||||
static void cb_btn_dtformat0(Fl_Round_Button* o, void*)
|
||||
{
|
||||
btn_dtformat3->value(0);
|
||||
btn_dtformat1->value(0);
|
||||
btn_dtformat2->value(0);
|
||||
btn_dtformat4->value(0);
|
||||
if (o->value()) {
|
||||
progStatus.dtformat = 0;
|
||||
btn_dtformat1->value(0);
|
||||
btn_dtformat2->value(0);
|
||||
btn_dtformat3->value(0);
|
||||
set_datetime_widgets();
|
||||
} else {
|
||||
btn_dtformat4->value(1);
|
||||
progStatus.dtformat = 4;
|
||||
}
|
||||
set_datetime_widgets();
|
||||
}
|
||||
|
||||
static void cb_btn_dtformat1(Fl_Round_Button* o, void*)
|
||||
{
|
||||
btn_dtformat0->value(0);
|
||||
btn_dtformat3->value(0);
|
||||
btn_dtformat2->value(0);
|
||||
btn_dtformat4->value(0);
|
||||
if (o->value()) {
|
||||
progStatus.dtformat = 1;
|
||||
btn_dtformat0->value(0);
|
||||
btn_dtformat2->value(0);
|
||||
btn_dtformat3->value(0);
|
||||
set_datetime_widgets();
|
||||
} else {
|
||||
btn_dtformat4->value(1);
|
||||
progStatus.dtformat = 4;
|
||||
}
|
||||
set_datetime_widgets();
|
||||
}
|
||||
|
||||
static void cb_btn_dtformat2(Fl_Round_Button* o, void*)
|
||||
{
|
||||
btn_dtformat0->value(0);
|
||||
btn_dtformat1->value(0);
|
||||
btn_dtformat3->value(0);
|
||||
btn_dtformat4->value(0);
|
||||
if (o->value()) {
|
||||
progStatus.dtformat = 2;
|
||||
btn_dtformat0->value(0);
|
||||
btn_dtformat1->value(0);
|
||||
btn_dtformat3->value(0);
|
||||
set_datetime_widgets();
|
||||
} else {
|
||||
btn_dtformat4->value(1);
|
||||
progStatus.dtformat = 4;
|
||||
}
|
||||
set_datetime_widgets();
|
||||
}
|
||||
|
||||
static void cb_btn_dtformat3(Fl_Round_Button* o, void*)
|
||||
{
|
||||
btn_dtformat0->value(0);
|
||||
btn_dtformat1->value(0);
|
||||
btn_dtformat2->value(0);
|
||||
btn_dtformat4->value(0);
|
||||
if (o->value()) {
|
||||
progStatus.dtformat = 3;
|
||||
btn_dtformat0->value(0);
|
||||
btn_dtformat1->value(0);
|
||||
btn_dtformat2->value(0);
|
||||
set_datetime_widgets();
|
||||
} else {
|
||||
btn_dtformat4->value(1);
|
||||
progStatus.dtformat = 4;
|
||||
}
|
||||
set_datetime_widgets();
|
||||
}
|
||||
|
||||
static void cb_btn_dtformat4(Fl_Round_Button* o, void*)
|
||||
{
|
||||
btn_dtformat0->value(0);
|
||||
btn_dtformat1->value(0);
|
||||
btn_dtformat2->value(0);
|
||||
btn_dtformat3->value(0);
|
||||
btn_dtformat4->value(1);
|
||||
|
||||
progStatus.dtformat = 4;
|
||||
|
||||
set_datetime_widgets();
|
||||
}
|
||||
|
||||
static void cb_btn_utc_format0(Fl_Round_Button* o, void*)
|
||||
|
|
@ -1785,7 +1815,12 @@ Fl_Group *create_tab_date_time(int X, int Y, int W, int H, const char *title)
|
|||
btn_dtformat2->callback((Fl_Callback*)cb_btn_dtformat2);
|
||||
if (progStatus.dtformat == 2) btn_dtformat2->value(1); else btn_dtformat2->value(0);
|
||||
|
||||
btn_caplocal = new Fl_Check_Button(X, Y+118, 70, 20, _("CAP Local time"));
|
||||
btn_dtformat4 = new Fl_Round_Button(X, Y+96, 70, 20, _("YYYYMMDD"));
|
||||
btn_dtformat4->down_box(FL_ROUND_DOWN_BOX);
|
||||
btn_dtformat4->callback((Fl_Callback*)cb_btn_dtformat4);
|
||||
if (progStatus.dtformat == 4) btn_dtformat4->value(1); else btn_dtformat4->value(0);
|
||||
|
||||
btn_caplocal = new Fl_Check_Button(X, Y+140, 70, 20, _("CAP Local date/time"));
|
||||
btn_caplocal->tooltip(_("Check to use local date/time\ndefault Zulu"));
|
||||
btn_caplocal->callback((Fl_Callback*)cb_caplocal);
|
||||
|
||||
|
|
|
|||
|
|
@ -127,6 +127,7 @@ extern Fl_Round_Button *btn_dtformat0;
|
|||
extern Fl_Round_Button *btn_dtformat1;
|
||||
extern Fl_Round_Button *btn_dtformat2;
|
||||
extern Fl_Round_Button *btn_dtformat3;
|
||||
extern Fl_Round_Button *btn_dtformat4;
|
||||
extern Fl_Round_Button *btn_utc_format0;
|
||||
extern Fl_Round_Button *btn_utc_format1;
|
||||
extern Fl_Round_Button *btn_utc_format2;
|
||||
|
|
|
|||
|
|
@ -521,8 +521,7 @@ Fl_DateInput::fl_popcal()
|
|||
sscanf(Input->value(),"%4d%2d%2d", &y, &m, &d);
|
||||
break;
|
||||
}
|
||||
if (y < 10) y+=2000;
|
||||
if (y < 100) y+=1900;
|
||||
if (y < 100) y+=2000;
|
||||
Cal->setDate (m,d,y);
|
||||
|
||||
Cal->popcalfmt (popcalfmt_);
|
||||
|
|
|
|||
|
|
@ -39,18 +39,18 @@ const int Date::jdays[2][13] = {
|
|||
|
||||
const char *Date::month_name[] =
|
||||
{
|
||||
"January",
|
||||
"Febuary",
|
||||
"March",
|
||||
"April",
|
||||
"Jan",
|
||||
"Feb",
|
||||
"Mar",
|
||||
"Apr",
|
||||
"May",
|
||||
"June",
|
||||
"July",
|
||||
"August",
|
||||
"September",
|
||||
"October",
|
||||
"November",
|
||||
"December"
|
||||
"Jun",
|
||||
"Jul",
|
||||
"Aug",
|
||||
"Sep",
|
||||
"Oct",
|
||||
"Nov",
|
||||
"Dec"
|
||||
};
|
||||
|
||||
bool date_local_ = false;
|
||||
|
|
@ -141,7 +141,6 @@ bool Date::leapYear( int y )
|
|||
|
||||
bool Date::isvalid( int m, int d, int y )
|
||||
{
|
||||
if( y > 2035 ) return false;
|
||||
if( m < 1 || m > 12 ) return false;
|
||||
if( d < 1 ) return false;
|
||||
if( leapYear( y ) ){
|
||||
|
|
@ -276,11 +275,17 @@ char *Date::szDate (int fmt)
|
|||
month);
|
||||
break;
|
||||
case 4 :
|
||||
snprintf (temp, sizeof(temp), "%4d%02d%02d",
|
||||
year,
|
||||
month,
|
||||
day);
|
||||
break;
|
||||
case 5 :
|
||||
strcpy (szMonth, month_name [month - 1]);
|
||||
szMonth[3] = 0;
|
||||
snprintf (temp, sizeof(temp), "%s %2d, %4d", szMonth, day, year);
|
||||
break;
|
||||
case 5 :
|
||||
case 6 :
|
||||
strcpy (szMonth, month_name [month - 1]);
|
||||
szMonth[3] = 0;
|
||||
for (int i = 0; i < 3; i++) szMonth[i] = toupper(szMonth[i]);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue