Skip to content

Commit

Permalink
Add option to display the DTG in short format (HHMMZ) (#86)
Browse files Browse the repository at this point in the history
* Increase identity button group height to fix rendering frame

* Add option to display the DTG in short format (HHMMZ)

* Fix time could be set to 24:00
  • Loading branch information
Timi007 authored Dec 17, 2023
1 parent dcbc74e commit 6eaa47f
Show file tree
Hide file tree
Showing 125 changed files with 231 additions and 90 deletions.
143 changes: 95 additions & 48 deletions addons/markers/CfgMarkers/CfgMarkersDateTimeGroup.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,32 @@ DTGMARKER(0,6);
DTGMARKER(0,7);
DTGMARKER(0,8);
DTGMARKER(0,9);
DTGMARKER(0,A);
DTGMARKER(0,B);
DTGMARKER(0,C);
DTGMARKER(0,D);
DTGMARKER(0,E);
DTGMARKER(0,F);
DTGMARKER(0,G);
DTGMARKER(0,H);
DTGMARKER(0,I);
DTGMARKER(0,J);
DTGMARKER(0,K);
DTGMARKER(0,L);
DTGMARKER(0,M);
DTGMARKER(0,N);
DTGMARKER(0,O);
DTGMARKER(0,P);
DTGMARKER(0,Q);
DTGMARKER(0,R);
DTGMARKER(0,S);
DTGMARKER(0,T);
DTGMARKER(0,U);
DTGMARKER(0,V);
DTGMARKER(0,W);
DTGMARKER(0,X);
DTGMARKER(0,Y);
DTGMARKER(0,Z);

DTGMARKER(1,0);
DTGMARKER(1,1);
Expand All @@ -25,63 +51,66 @@ DTGMARKER(1,7);
DTGMARKER(1,8);
DTGMARKER(1,9);

DTGMARKER(2,jan);
DTGMARKER(2,0);
DTGMARKER(2,1);
DTGMARKER(2,2);
DTGMARKER(2,3);
DTGMARKER(2,4);
DTGMARKER(2,5);
DTGMARKER(2,apr);
DTGMARKER(2,aug);
DTGMARKER(2,dec);
DTGMARKER(2,feb);
DTGMARKER(2,jan);
DTGMARKER(2,jul);
DTGMARKER(2,jun);
DTGMARKER(2,mar);
DTGMARKER(2,apr);
DTGMARKER(2,may);
DTGMARKER(2,jun);
DTGMARKER(2,jul);
DTGMARKER(2,aug);
DTGMARKER(2,sep);
DTGMARKER(2,oct);
DTGMARKER(2,nov);
DTGMARKER(2,dec);
DTGMARKER(2,oct);
DTGMARKER(2,sep);

DTGMARKER(3,A);
DTGMARKER(3,B);
DTGMARKER(3,C);
DTGMARKER(3,D);
DTGMARKER(3,E);
DTGMARKER(3,F);
DTGMARKER(3,G);
DTGMARKER(3,H);
DTGMARKER(3,I);
DTGMARKER(3,J);
DTGMARKER(3,K);
DTGMARKER(3,L);
DTGMARKER(3,M);
DTGMARKER(3,N);
DTGMARKER(3,O);
DTGMARKER(3,P);
DTGMARKER(3,Q);
DTGMARKER(3,R);
DTGMARKER(3,S);
DTGMARKER(3,T);
DTGMARKER(3,U);
DTGMARKER(3,V);
DTGMARKER(3,W);
DTGMARKER(3,X);
DTGMARKER(3,Y);
DTGMARKER(3,Z);
DTGMARKER(3,0);
DTGMARKER(3,1);
DTGMARKER(3,2);
DTGMARKER(3,3);
DTGMARKER(3,4);
DTGMARKER(3,5);
DTGMARKER(3,6);
DTGMARKER(3,7);
DTGMARKER(3,8);
DTGMARKER(3,9);

DTGMARKER(4,0);
DTGMARKER(4,1);
DTGMARKER(4,2);
DTGMARKER(4,3);
DTGMARKER(4,4);
DTGMARKER(4,5);
DTGMARKER(4,6);
DTGMARKER(4,7);
DTGMARKER(4,8);
DTGMARKER(4,9);

DTGMARKER(5,0);
DTGMARKER(5,1);
DTGMARKER(5,2);
DTGMARKER(5,3);
DTGMARKER(5,4);
DTGMARKER(5,5);
DTGMARKER(5,A);
DTGMARKER(5,B);
DTGMARKER(5,C);
DTGMARKER(5,D);
DTGMARKER(5,E);
DTGMARKER(5,F);
DTGMARKER(5,G);
DTGMARKER(5,H);
DTGMARKER(5,I);
DTGMARKER(5,J);
DTGMARKER(5,K);
DTGMARKER(5,L);
DTGMARKER(5,M);
DTGMARKER(5,N);
DTGMARKER(5,O);
DTGMARKER(5,P);
DTGMARKER(5,Q);
DTGMARKER(5,R);
DTGMARKER(5,S);
DTGMARKER(5,T);
DTGMARKER(5,U);
DTGMARKER(5,V);
DTGMARKER(5,W);
DTGMARKER(5,X);
DTGMARKER(5,Y);
DTGMARKER(5,Z);

DTGMARKER(6,0);
DTGMARKER(6,1);
Expand All @@ -97,6 +126,9 @@ DTGMARKER(6,9);
DTGMARKER(7,0);
DTGMARKER(7,1);
DTGMARKER(7,2);
DTGMARKER(7,3);
DTGMARKER(7,4);
DTGMARKER(7,5);

DTGMARKER(8,0);
DTGMARKER(8,1);
Expand All @@ -112,5 +144,20 @@ DTGMARKER(8,9);
DTGMARKER(9,0);
DTGMARKER(9,1);
DTGMARKER(9,2);
DTGMARKER(9,3);

DTGMARKER(10,0);
DTGMARKER(10,1);
DTGMARKER(10,2);
DTGMARKER(10,3);
DTGMARKER(10,4);
DTGMARKER(10,5);
DTGMARKER(10,6);
DTGMARKER(10,7);
DTGMARKER(10,8);
DTGMARKER(10,9);

DTGMARKER(11,0);
DTGMARKER(11,1);
DTGMARKER(11,2);
DTGMARKER(11,3);

Binary file added addons/markers/data/dtg/0/mts_markers_dtg_0_A.paa
Binary file not shown.
Binary file added addons/markers/data/dtg/0/mts_markers_dtg_0_B.paa
Binary file not shown.
Binary file added addons/markers/data/dtg/0/mts_markers_dtg_0_C.paa
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added addons/markers/data/dtg/0/mts_markers_dtg_0_J.paa
Binary file not shown.
Binary file added addons/markers/data/dtg/0/mts_markers_dtg_0_K.paa
Binary file not shown.
Binary file added addons/markers/data/dtg/0/mts_markers_dtg_0_L.paa
Binary file not shown.
Binary file not shown.
Binary file added addons/markers/data/dtg/0/mts_markers_dtg_0_N.paa
Binary file not shown.
Binary file not shown.
Binary file added addons/markers/data/dtg/0/mts_markers_dtg_0_P.paa
Binary file not shown.
Binary file added addons/markers/data/dtg/0/mts_markers_dtg_0_Q.paa
Binary file not shown.
Binary file added addons/markers/data/dtg/0/mts_markers_dtg_0_R.paa
Binary file not shown.
Binary file added addons/markers/data/dtg/0/mts_markers_dtg_0_S.paa
Binary file not shown.
Binary file not shown.
Binary file added addons/markers/data/dtg/0/mts_markers_dtg_0_U.paa
Binary file not shown.
Binary file added addons/markers/data/dtg/0/mts_markers_dtg_0_V.paa
Binary file not shown.
Binary file added addons/markers/data/dtg/0/mts_markers_dtg_0_W.paa
Binary file not shown.
Binary file added addons/markers/data/dtg/0/mts_markers_dtg_0_X.paa
Binary file not shown.
Binary file added addons/markers/data/dtg/0/mts_markers_dtg_0_Y.paa
Binary file not shown.
Binary file added addons/markers/data/dtg/0/mts_markers_dtg_0_Z.paa
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added addons/markers/data/dtg/2/mts_markers_dtg_2_0.paa
Binary file not shown.
Binary file added addons/markers/data/dtg/2/mts_markers_dtg_2_1.paa
Binary file not shown.
Binary file added addons/markers/data/dtg/2/mts_markers_dtg_2_2.paa
Binary file not shown.
Binary file added addons/markers/data/dtg/2/mts_markers_dtg_2_3.paa
Binary file not shown.
Binary file not shown.
Binary file added addons/markers/data/dtg/2/mts_markers_dtg_2_5.paa
Binary file not shown.
Binary file added addons/markers/data/dtg/3/mts_markers_dtg_3_0.paa
Binary file not shown.
Binary file not shown.
Binary file added addons/markers/data/dtg/3/mts_markers_dtg_3_2.paa
Binary file not shown.
Binary file added addons/markers/data/dtg/3/mts_markers_dtg_3_3.paa
Binary file not shown.
Binary file added addons/markers/data/dtg/3/mts_markers_dtg_3_4.paa
Binary file not shown.
Binary file added addons/markers/data/dtg/3/mts_markers_dtg_3_5.paa
Binary file not shown.
Binary file added addons/markers/data/dtg/3/mts_markers_dtg_3_6.paa
Binary file not shown.
Binary file added addons/markers/data/dtg/3/mts_markers_dtg_3_7.paa
Binary file not shown.
Binary file not shown.
Binary file added addons/markers/data/dtg/3/mts_markers_dtg_3_9.paa
Binary file not shown.
Binary file modified addons/markers/data/dtg/4/mts_markers_dtg_4_0.paa
Binary file not shown.
Binary file modified addons/markers/data/dtg/4/mts_markers_dtg_4_1.paa
Binary file not shown.
Binary file modified addons/markers/data/dtg/4/mts_markers_dtg_4_2.paa
Binary file not shown.
Binary file modified addons/markers/data/dtg/6/mts_markers_dtg_6_0.paa
Binary file not shown.
Binary file modified addons/markers/data/dtg/6/mts_markers_dtg_6_1.paa
Binary file not shown.
Binary file modified addons/markers/data/dtg/6/mts_markers_dtg_6_2.paa
Binary file not shown.
Binary file modified addons/markers/data/dtg/6/mts_markers_dtg_6_3.paa
Binary file not shown.
Binary file modified addons/markers/data/dtg/6/mts_markers_dtg_6_4.paa
Binary file not shown.
Binary file modified addons/markers/data/dtg/6/mts_markers_dtg_6_5.paa
Binary file not shown.
Binary file modified addons/markers/data/dtg/6/mts_markers_dtg_6_6.paa
Binary file not shown.
Binary file modified addons/markers/data/dtg/6/mts_markers_dtg_6_7.paa
Binary file not shown.
Binary file modified addons/markers/data/dtg/6/mts_markers_dtg_6_8.paa
Binary file not shown.
Binary file modified addons/markers/data/dtg/6/mts_markers_dtg_6_9.paa
Binary file not shown.
Binary file modified addons/markers/data/dtg/7/mts_markers_dtg_7_0.paa
Binary file not shown.
Binary file modified addons/markers/data/dtg/7/mts_markers_dtg_7_1.paa
Binary file not shown.
Binary file modified addons/markers/data/dtg/7/mts_markers_dtg_7_2.paa
Binary file not shown.
Binary file modified addons/markers/data/dtg/8/mts_markers_dtg_8_0.paa
Binary file not shown.
Binary file modified addons/markers/data/dtg/8/mts_markers_dtg_8_1.paa
Binary file not shown.
Binary file modified addons/markers/data/dtg/8/mts_markers_dtg_8_2.paa
Binary file not shown.
Binary file modified addons/markers/data/dtg/8/mts_markers_dtg_8_3.paa
Binary file not shown.
Binary file modified addons/markers/data/dtg/8/mts_markers_dtg_8_4.paa
Binary file not shown.
Binary file modified addons/markers/data/dtg/8/mts_markers_dtg_8_5.paa
Binary file not shown.
Binary file modified addons/markers/data/dtg/8/mts_markers_dtg_8_6.paa
Binary file not shown.
Binary file modified addons/markers/data/dtg/8/mts_markers_dtg_8_7.paa
Binary file not shown.
Binary file modified addons/markers/data/dtg/8/mts_markers_dtg_8_8.paa
Binary file not shown.
Binary file modified addons/markers/data/dtg/8/mts_markers_dtg_8_9.paa
Binary file not shown.
Binary file modified addons/markers/data/dtg/9/mts_markers_dtg_9_0.paa
Binary file not shown.
Binary file modified addons/markers/data/dtg/9/mts_markers_dtg_9_1.paa
Binary file not shown.
Binary file modified addons/markers/data/dtg/9/mts_markers_dtg_9_2.paa
Binary file not shown.
8 changes: 6 additions & 2 deletions addons/markers/functions/fnc_createMarkerLocal.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
* 7: ARRAY - Date-Time Group.
* 0: ARRAY - Date in format [year, month, day, hour, minute] (all NUMBER).
* 1: STRING - Time zone identifier.
* 2: BOOLEAN - Display in short format (HHMMZ).
* 8: STRING - Direction of Movement Arrow (N, NNE, NE, ENE, E, ESE, SE, SSE, S, SSW, SW, WSW, W, WNW, NW, NNW). Empty string for no direction.
* 4: NUMBER - Scale of the marker. (Optional, default: 1.3)
* 5: NUMBER - Alpha of the marker. (Optional, default: 1)
Expand Down Expand Up @@ -307,7 +308,10 @@ if ((count _dateTimeGroup) > 0) then {

// Iterate reversed because char pos starts closest to frameshape, meaning with the year.
// DDHHMMZmmmYY ┌───────┐
// Positions: 98765432 10 │ │
// Positions: ..98765 210 │ │
// └───────┘
// HHMMZ ┌───────┐
// Positions: 43210 │ │
// └───────┘
private _letterPos = 0;
{
Expand All @@ -321,7 +325,7 @@ if ((count _dateTimeGroup) > 0) then {

_markerFamily pushBack _markerDtg;

_letterPos = _letterPos + 1;
_letterPos = _letterPos + (count _x);
} forEachReversed _dtgCharacters;
};

Expand Down
6 changes: 4 additions & 2 deletions addons/markers/functions/fnc_getDTGUIData.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* None.
*
* Returns:
* ARRAY - Date-Time information in format [[year, month, day, hours, minutes], timezone].
* ARRAY - Date-Time information in format [[year, month, day, hours, minutes], timezone, short].
* The date elements are numbers; timeZone is a character.
*
* Example:
Expand All @@ -34,4 +34,6 @@ private _minutes = parseNumber (ctrlText (_dtgDisplay displayCtrl DTG_MINUTES_ED
private _timeZoneId = _timeZoneCtrl lbValue (lbCurSel _timeZoneCtrl);
private _timeZone = GVAR(alphanumCharacters) select _timeZoneId;

[[_year, _month, _day, _hours, _minutes], _timeZone]
private _displayShort = cbChecked (_dtgDisplay displayCtrl DTG_SHORT_FORMAT_CHECKBOX);

[[_year, _month, _day, _hours, _minutes], _timeZone, _displayShort]
4 changes: 2 additions & 2 deletions addons/markers/functions/fnc_initializeDTGUI.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ _dateYearCtrl ctrlAddEventHandler ["LBSelChanged", LINKFUNC(onDTGMonthSelChanged
_dateMonthCtrl ctrlAddEventHandler ["LBSelChanged", LINKFUNC(onDTGMonthSelChanged)];

private _min = 0;
private _max = 86400; // seconds in a day
private _max = 86400 - 1; // seconds in a day
private _range = _max - _min;
private _currentValue = 0;

Expand All @@ -91,7 +91,7 @@ _timeSliderCtrl ctrlAddEventHandler ["SliderPosChanged", LINKFUNC(onDTGTimeSlide
private _dateTimeGroup = (_parentDisplay displayCtrl DTG_BUTTON) getVariable [QGVAR(dateTimeGroup), []];
if (_dateTimeGroup isEqualTo []) then {
// Set local Arma time as default
[date] call FUNC(setDTGUIData);
[date, "J", GVAR(displayShortDTG)] call FUNC(setDTGUIData);
} else {
_dateTimeGroup call FUNC(setDTGUIData);
};
7 changes: 6 additions & 1 deletion addons/markers/functions/fnc_setDTGUIData.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* 0: ARRAY - Date-Time information in format [year, month, day, hours, minutes].
* The date elements must be numbers.
* 1: STRING - Time zone identifier as a single character.
* 2: BOOLEAN - Display in short format (Default is that format is not changed from selected one).
*
* Returns:
* Nothing.
Expand All @@ -18,7 +19,7 @@
*
*/

params [["_date", [], [[]], [5, 6, 7]], ["_timeZone", "J", [""]]];
params [["_date", [], [[]], [5, 6, 7]], ["_timeZone", "J", [""]], ["_displayShort", nil, [false]]];
TRACE_1("params", _this);

CHECK(_date isEqualTo []);
Expand All @@ -45,3 +46,7 @@ for "_index" from 0 to ((lbSize _timeZoneCtrl) - 1) step 1 do {
(_dtgDisplay displayCtrl DTG_TIME_SLIDER) sliderSetPosition (round (_hour * 3600 + _minute * 60));
(_dtgDisplay displayCtrl DTG_HOURS_EDIT) ctrlSetText ([_hour, 2] call CBA_fnc_formatNumber);
(_dtgDisplay displayCtrl DTG_MINUTES_EDIT) ctrlSetText ([_minute, 2] call CBA_fnc_formatNumber);

if (!isNil "_displayShort") then {
(_dtgDisplay displayCtrl DTG_SHORT_FORMAT_CHECKBOX) cbSetChecked _displayShort;
};
29 changes: 22 additions & 7 deletions addons/markers/functions/fnc_toDTGCharaters.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,19 @@
* Parameter(s):
* 0: ARRAY - Year, month, day, hours, minutes from date, systemTime or systemTimeUTC command.
* 1: STRING - Standard time zone identifier (one character).
* 2: BOOLEAN - Display in short format (HHMMZ) (Default: false).
*
* Returns:
* ARRAY - Date-Time Group charaters in format [D, D, H, H, M, M, Z, mmm, Y, Y].
* To get the equivalent stirng, just join the element with joinString "".
* ARRAY - Date-Time Group charaters in format [D, D, H, H, M, M, Z, mmm, Y, Y] (long) or [H, H, M, M, Z] (short).
* To get the equivalent string, just join the element with joinString "".
* Returns empty array on invalid date.
*
* Example:
* [[2023, 12, 7, 12, 35], "A"] call mts_markers_fnc_toDTGCharaters
*
*/

params [["_date", [], [[]], [5, 6, 7]], ["_timeZone", "J", [""]]];
params [["_date", [], [[]], [5, 6, 7]], ["_timeZone", "J", [""]], ["_displayShort", false, [false]]];
TRACE_2("params", _date, _timeZone);

CHECKRET((_date isEqualTo []) || (count _timeZone != 1), []);
Expand All @@ -28,14 +29,28 @@ _date params [["_year", MIN_YEAR, [0]], ["_month", 1, [0]], ["_day", 1, [0]], ["

CHECKRET(_month < 1 || _month > 12, []);
CHECKRET(_day < 1 || _day > 31, []);
CHECKRET(_day < 1 || _day > 31, []);
CHECKRET(_hour < 0 || _hour > 23, []);
CHECKRET(_minute < 0 || _minute > 59, []);

private _yearStr = [_year, 4] call CBA_fnc_formatNumber;
private _monthAbbrivation = GVAR(monthAbbreviations) get _month;
private _dayStr = [_day, 2] call CBA_fnc_formatNumber;
private _hourStr = [_hour, 2] call CBA_fnc_formatNumber;
private _minuteStr = [_minute, 2] call CBA_fnc_formatNumber;

if (_displayShort) exitWith {
// Short format only contains HHMMZ
[
_hourStr select [0, 1],
_hourStr select [1, 1],
_minuteStr select [0, 1],
_minuteStr select [1, 1],
toUpper _timeZone
]
};

private _dayStr = [_day, 2] call CBA_fnc_formatNumber;
private _monthAbbrivation = GVAR(monthAbbreviations) get _month;
private _yearStr = [_year, 4] call CBA_fnc_formatNumber;

// Long format DDHHMMZmmmYY
[
_dayStr select [0, 1],
_dayStr select [1, 1],
Expand Down
10 changes: 10 additions & 0 deletions addons/markers/initSettings.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,13 @@
0,
{}
] call CBA_settings_fnc_init;

[
QGVAR(displayShortDTG),
"CHECKBOX",
[LLSTRING(cba_settings_default_short_dtg), LLSTRING(cba_settings_default_short_dtg_tooltip)],
LLSTRING(cba_category_name),
true,
2,
{}
] call CBA_settings_fnc_init;
16 changes: 14 additions & 2 deletions addons/markers/stringtable.xml
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,8 @@
<German>Datum/Zeit-Gruppe entfernen</German>
</Key>
<Key ID="str_mts_markers_ui_general_dtgBTN_tooltip">
<Original>Set Date-Time Group (DDHHMMZmmmYY)</Original>
<German>Datum/Zeit-Gruppe setzen (DDHHMMZmmmYY)</German>
<Original>Set Date-Time Group (DDHHMMZmmmYY/HHMMZ)</Original>
<German>Datum/Zeit-Gruppe setzen (DDHHMMZmmmYY/HHMMZ)</German>
</Key>
<Key ID="str_mts_markers_ui_general_directionTXT">
<Original>Direction of Movement:</Original>
Expand Down Expand Up @@ -206,6 +206,10 @@
<Original>Set the time to the current UTC time of the system</Original>
<German>Setzt die Zeit auf die derzeitige UTC Zeit des Systems</German>
</Key>
<Key ID="str_mts_markers_ui_dtg_shortFormat">
<Original>Display in short format (HHMMZ)</Original>
<German>Zeige in Kurzform (HHMMZ) an</German>
</Key>
</Container>
<Container name="UI_direction">
<Key ID="str_mts_markers_ui_direction_empty">
Expand Down Expand Up @@ -961,6 +965,14 @@
<Original>Use Arma colors instead of APP-6(C) colors.</Original>
<German>Nutze Arma Farbschema anstelle des APP-6(C) Farbschemas.</German>
</Key>
<Key ID="str_mts_markers_cba_settings_default_short_dtg">
<Original>Use short DTG format</Original>
<German>Nutze kurzes DTG Format</German>
</Key>
<Key ID="str_mts_markers_cba_settings_default_short_dtg_tooltip">
<Original>Use the short Date-Time Group display format (HHMMZ) as default.</Original>
<German>Nutze das kurze Datum/Zeit-Gruppe Anzeigeformat (HHMMZ) standardmäßig.</German>
</Key>
</Container>
</Package>
</Project>
Loading

0 comments on commit 6eaa47f

Please sign in to comment.