ACE3/addons/markers/functions/fnc_onButtonClickConfirm.sqf

75 lines
2.1 KiB
Plaintext
Raw Normal View History

#include "..\script_component.hpp"
/*
Markers - Add the option for UTC/System time timestamps (#9121) * Markers - Add setting for system timestamps * Moved time zone to different setting Added UTC Time zone Added UTC time offset slider Added translation in stringtable * Update fnc_onButtonClickConfirm.sqf Fixed mistake that added offset twice * - Removed tabs - Fixed calculating error * - Fixed tab problem Was a bit enthusiastic with removing tabs. This should to the trick. * - Changed tabs to spaces (Finaly) - Checked SQF with sqf_validator.py - Fixed decimal error by CBA menu * Delete build/_deps directory - This does not belong here * Update fnc_onButtonClickConfirm.sqf Added empty line back * Update addons/markers/functions/fnc_onButtonClickConfirm.sqf Formatting update Co-authored-by: Grim <69561145+LinkIsGrim@users.noreply.github.com> * Update addons/markers/functions/fnc_onButtonClickConfirm.sqf Formatting update Co-authored-by: Grim <69561145+LinkIsGrim@users.noreply.github.com> * Update initSettings.sqf Added newline at end of file * Update fnc_onButtonClickConfirm.sqf Fixed fnc header formatting * Update addons/markers/functions/fnc_onButtonClickConfirm.sqf Formatting Co-authored-by: Grim <69561145+LinkIsGrim@users.noreply.github.com> * Update fnc_onButtonClickConfirm.sqf Updated formatting * Implemented review changes * Review suggestion * Bugfix return absolute positive number with modulo * Updated script to allow offset to exeed midnight in the past * Updated script to allow offset to exeed midnight in the past * Updated script to allow offset to exeed midnight in the past * Updated hour offset calculation * Add support for UTC+13 and +14 timezone * Add minutes UTC offset to timestamp * Add UTC minutes offset setting * Add translation for UTC minute offset setting * Prevent timestamp going over 24 after adding minutes offset * Modify english description for offset settings * Update addons/markers/initSettings.sqf * Properly handle minute offset with negative timezone * Implemented better solution to handle negative timestamp seconds offset * reverted 'Implemented better solution to handle negative timestamp seconds offset' * Revert "Implemented better solution to handle negative timestamp seconds offset" This reverts commit d2599bd9aa6d954552bc01ca05a17901dfa1df06. * Update timestamp calculation comments * Update timestamp calculation comments * Update documentation in UTC timestamp calculation --------- Co-authored-by: PabstMirror <pabstmirror@gmail.com> Co-authored-by: Grim <69561145+LinkIsGrim@users.noreply.github.com> Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com>
2024-01-07 18:06:35 +00:00
* Author: Freddo, Daniël H.
* When the confirm button is pressed.
*
* Arguments:
* 0: Confirm button <CONTROL>
*
* Return Value:
* None
*
* Example:
* [_buttonOk] call ACE_markers_fnc_onButtonClickConfirm
*
* Public: No
*/
params ["_buttonOk"];
private _display = ctrlParent _buttonOk;
Markers - Add the option for UTC/System time timestamps (#9121) * Markers - Add setting for system timestamps * Moved time zone to different setting Added UTC Time zone Added UTC time offset slider Added translation in stringtable * Update fnc_onButtonClickConfirm.sqf Fixed mistake that added offset twice * - Removed tabs - Fixed calculating error * - Fixed tab problem Was a bit enthusiastic with removing tabs. This should to the trick. * - Changed tabs to spaces (Finaly) - Checked SQF with sqf_validator.py - Fixed decimal error by CBA menu * Delete build/_deps directory - This does not belong here * Update fnc_onButtonClickConfirm.sqf Added empty line back * Update addons/markers/functions/fnc_onButtonClickConfirm.sqf Formatting update Co-authored-by: Grim <69561145+LinkIsGrim@users.noreply.github.com> * Update addons/markers/functions/fnc_onButtonClickConfirm.sqf Formatting update Co-authored-by: Grim <69561145+LinkIsGrim@users.noreply.github.com> * Update initSettings.sqf Added newline at end of file * Update fnc_onButtonClickConfirm.sqf Fixed fnc header formatting * Update addons/markers/functions/fnc_onButtonClickConfirm.sqf Formatting Co-authored-by: Grim <69561145+LinkIsGrim@users.noreply.github.com> * Update fnc_onButtonClickConfirm.sqf Updated formatting * Implemented review changes * Review suggestion * Bugfix return absolute positive number with modulo * Updated script to allow offset to exeed midnight in the past * Updated script to allow offset to exeed midnight in the past * Updated script to allow offset to exeed midnight in the past * Updated hour offset calculation * Add support for UTC+13 and +14 timezone * Add minutes UTC offset to timestamp * Add UTC minutes offset setting * Add translation for UTC minute offset setting * Prevent timestamp going over 24 after adding minutes offset * Modify english description for offset settings * Update addons/markers/initSettings.sqf * Properly handle minute offset with negative timezone * Implemented better solution to handle negative timestamp seconds offset * reverted 'Implemented better solution to handle negative timestamp seconds offset' * Revert "Implemented better solution to handle negative timestamp seconds offset" This reverts commit d2599bd9aa6d954552bc01ca05a17901dfa1df06. * Update timestamp calculation comments * Update timestamp calculation comments * Update documentation in UTC timestamp calculation --------- Co-authored-by: PabstMirror <pabstmirror@gmail.com> Co-authored-by: Grim <69561145+LinkIsGrim@users.noreply.github.com> Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com>
2024-01-07 18:06:35 +00:00
private _description = _display displayCtrl IDC_INSERT_MARKER;
private _aceTimestamp = _display displayCtrl IDC_ACE_INSERT_MARKER_TIMESTAMP;
// handle timestamp
if (cbChecked _aceTimestamp && {ACE_player call FUNC(canTimestamp)}) then {
Markers - Add the option for UTC/System time timestamps (#9121) * Markers - Add setting for system timestamps * Moved time zone to different setting Added UTC Time zone Added UTC time offset slider Added translation in stringtable * Update fnc_onButtonClickConfirm.sqf Fixed mistake that added offset twice * - Removed tabs - Fixed calculating error * - Fixed tab problem Was a bit enthusiastic with removing tabs. This should to the trick. * - Changed tabs to spaces (Finaly) - Checked SQF with sqf_validator.py - Fixed decimal error by CBA menu * Delete build/_deps directory - This does not belong here * Update fnc_onButtonClickConfirm.sqf Added empty line back * Update addons/markers/functions/fnc_onButtonClickConfirm.sqf Formatting update Co-authored-by: Grim <69561145+LinkIsGrim@users.noreply.github.com> * Update addons/markers/functions/fnc_onButtonClickConfirm.sqf Formatting update Co-authored-by: Grim <69561145+LinkIsGrim@users.noreply.github.com> * Update initSettings.sqf Added newline at end of file * Update fnc_onButtonClickConfirm.sqf Fixed fnc header formatting * Update addons/markers/functions/fnc_onButtonClickConfirm.sqf Formatting Co-authored-by: Grim <69561145+LinkIsGrim@users.noreply.github.com> * Update fnc_onButtonClickConfirm.sqf Updated formatting * Implemented review changes * Review suggestion * Bugfix return absolute positive number with modulo * Updated script to allow offset to exeed midnight in the past * Updated script to allow offset to exeed midnight in the past * Updated script to allow offset to exeed midnight in the past * Updated hour offset calculation * Add support for UTC+13 and +14 timezone * Add minutes UTC offset to timestamp * Add UTC minutes offset setting * Add translation for UTC minute offset setting * Prevent timestamp going over 24 after adding minutes offset * Modify english description for offset settings * Update addons/markers/initSettings.sqf * Properly handle minute offset with negative timezone * Implemented better solution to handle negative timestamp seconds offset * reverted 'Implemented better solution to handle negative timestamp seconds offset' * Revert "Implemented better solution to handle negative timestamp seconds offset" This reverts commit d2599bd9aa6d954552bc01ca05a17901dfa1df06. * Update timestamp calculation comments * Update timestamp calculation comments * Update documentation in UTC timestamp calculation --------- Co-authored-by: PabstMirror <pabstmirror@gmail.com> Co-authored-by: Grim <69561145+LinkIsGrim@users.noreply.github.com> Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com>
2024-01-07 18:06:35 +00:00
// determine marker timestamp based on time settings
private _time = switch (GVAR(timestampTimezone)) do {
case 1: {
systemTime params ["", "", "", "_hour", "_min", "_sec"];
_hour + _min/60 + _sec/3600
};
case 2: {
systemTimeUTC params ["", "", "", "_hour", "_min", "_sec"];
_hourOffset = round (GVAR(timestampUTCOffset));
_hour = _hour + _hourOffset;
// add or subtract minutes offset based on the negative or positive timezone
_min = if (_hourOffset < 0) then { _min - GVAR(timestampUTCMinutesOffset) } else { _min + GVAR(timestampUTCMinutesOffset) };
// prevent the timestamp from exceeding 24 hours or going below 0 hours
_time = ((_hour + _min/60 + _sec/3600) % 24 + 24) % 24;
_time
};
default {
dayTime
};
};
// add timestamp suffix
private _periodPostfix = "";
if (GVAR(timestampHourFormat) == 12) then {
if (floor _time == 0) exitWith {
_time = _time + 12;
_periodPostfix = " am";
};
if (floor _time == 12) exitWith {
_periodPostfix = " pm";
};
if (_time < 12) then {
_periodPostfix = " am";
} else {
_time = _time - 12;
_periodPostfix = " pm";
};
};
_description ctrlSetText format [
"%1 [%2%3]",
ctrlText _description,
[_time, GVAR(timestampFormat)] call BIS_fnc_timeToString,
_periodPostfix
];
};