From 4ca7fb458df1ecca69cf39b42ad0d8c26e71bce0 Mon Sep 17 00:00:00 2001 From: "eugene.tretyak" Date: Tue, 20 Jul 2021 16:06:26 +0300 Subject: [PATCH 01/10] Ability to reset marker direction/scale slider to default position by RMB click - Handles RMB click over direction and scale sliders and resets sliders to default value (0 and 1) --- addons/markers/XEH_PREP.hpp | 2 ++ .../functions/fnc_initInsertMarker.sqf | 4 +++ .../fnc_onSliderMouseButtonUpAngle.sqf | 25 ++++++++++++++ .../fnc_onSliderMouseButtonUpScale.sqf | 25 ++++++++++++++ addons/markers/stringtable.xml | 34 ++++++++++++++++++- 5 files changed, 89 insertions(+), 1 deletion(-) create mode 100644 addons/markers/functions/fnc_onSliderMouseButtonUpAngle.sqf create mode 100644 addons/markers/functions/fnc_onSliderMouseButtonUpScale.sqf diff --git a/addons/markers/XEH_PREP.hpp b/addons/markers/XEH_PREP.hpp index 02214231ecb..113b48bb82d 100644 --- a/addons/markers/XEH_PREP.hpp +++ b/addons/markers/XEH_PREP.hpp @@ -6,7 +6,9 @@ PREP(onLBSelChangedChannel); PREP(onLBSelChangedColor); PREP(onLBSelChangedShape); PREP(onSliderPosChangedAngle); +PREP(onSliderMouseButtonUpAngle); PREP(onSliderPosChangedScale); +PREP(onSliderMouseButtonUpScale); PREP(placeMarker); PREP(sendMarkersJIP); PREP(setMarkerJIP); diff --git a/addons/markers/functions/fnc_initInsertMarker.sqf b/addons/markers/functions/fnc_initInsertMarker.sqf index c5fa330c85b..7f4f1d518e7 100644 --- a/addons/markers/functions/fnc_initInsertMarker.sqf +++ b/addons/markers/functions/fnc_initInsertMarker.sqf @@ -332,10 +332,12 @@ private _curSelAngle = GETGVAR(currentMarkerAngle,0); _aceAngleSlider sliderSetPosition _curSelAngle; + _aceAngleSlider ctrlSetTooltip LLSTRING(MarkerDirectionSlider_Tooltip); //Update now and add eventHandler: [_aceAngleSlider, _curSelAngle] call FUNC(onSliderPosChangedAngle); _aceAngleSlider ctrlAddEventHandler ["SliderPosChanged", {_this call FUNC(onSliderPosChangedAngle)}]; + _aceAngleSlider ctrlAddEventHandler ["MouseButtonUp", {_this call FUNC(onSliderMouseButtonUpAngle)}]; //////////////////// // init marker scale slider @@ -348,8 +350,10 @@ private _curSelScale = GETGVAR(currentMarkerScale,1); _aceScaleSlider sliderSetPosition _curSelScale; + _aceScaleSlider ctrlSetTooltip LLSTRING(MarkerScaleSlider_Tooltip); //Update now and add eventHandler: [_aceScaleSlider, _curSelScale] call FUNC(onSliderPosChangedScale); _aceScaleSlider ctrlAddEventHandler ["SliderPosChanged", {_this call FUNC(onSliderPosChangedScale)}]; + _aceScaleSlider ctrlAddEventHandler ["MouseButtonUp", {_this call FUNC(onSliderMouseButtonUpScale)}]; }, _this] call CBA_fnc_execNextFrame; diff --git a/addons/markers/functions/fnc_onSliderMouseButtonUpAngle.sqf b/addons/markers/functions/fnc_onSliderMouseButtonUpAngle.sqf new file mode 100644 index 00000000000..d6da4ab9ad9 --- /dev/null +++ b/addons/markers/functions/fnc_onSliderMouseButtonUpAngle.sqf @@ -0,0 +1,25 @@ +#include "script_component.hpp" +/* + * Author: 10Dozen + * Angle slider clicked handler. Resets slider pos to 0 on RMB button up. + * + * Arguments: + * 0: Slider (idc 1210) is expected + * 1: Button released (0 - Left mouse btn, 1 - Right mouse btn) + * + * Return Value: + * None + * + * Example: + * [Slider, 1] call ace_markers_fnc_onSliderMouseButtonUpAngle; + * + * Public: No + */ + +params ["_aceAngleSlider", "_button", "", "", "", "", ""]; +TRACE_2("params",_aceAngleSlider,_button); + +if (_button != 1) exitWith {}; + +_aceAngleSlider sliderSetPosition 0; +[_aceAngleSlider, 0] call FUNC(onSliderPosChangedAngle); diff --git a/addons/markers/functions/fnc_onSliderMouseButtonUpScale.sqf b/addons/markers/functions/fnc_onSliderMouseButtonUpScale.sqf new file mode 100644 index 00000000000..4db3971325a --- /dev/null +++ b/addons/markers/functions/fnc_onSliderMouseButtonUpScale.sqf @@ -0,0 +1,25 @@ +#include "script_component.hpp" +/* + * Author: 10Dozen + * Scale slider clicked handler. Resets slider pos to 1 on RMB button up. + * + * Arguments: + * 0: Slider (idc 1420) is expected + * 1: Button released (0 - Left mouse btn, 1 - Right mouse btn) + * + * Return Value: + * None + * + * Example: + * [Slider, 1] call ace_markers_fnc_onSliderMouseButtonUpScale; + * + * Public: No + */ + +params ["_aceScaleSlider", "_button", "", "", "", "", ""]; +TRACE_2("params",_aceAngleSlider,_button); + +if (_button != 1) exitWith {}; + +_aceScaleSlider sliderSetPosition 1; +[_aceScaleSlider, 1] call FUNC(onSliderPosChangedScale); diff --git a/addons/markers/stringtable.xml b/addons/markers/stringtable.xml index 1c6af7d7218..59fb40acd59 100644 --- a/addons/markers/stringtable.xml +++ b/addons/markers/stringtable.xml @@ -24,7 +24,39 @@ 方位: %1° Yön: %1° - + + Click RMB to reset to 0 + Click RMB to reset to 0 + Click RMB to reset to 0 + Click RMB to reset to 0 + Click RMB to reset to 0 + Click RMB to reset to 0 + Click RMB to reset to 0 + Click RMB to reset to 0 + Кликните ПКМ чтобы сбросить на 0 + Click RMB to reset to 0 + Click RMB to reset to 0 + Click RMB to reset to 0 + Click RMB to reset to 0 + Click RMB to reset to 0 + + + Click RMB to reset to 1 + Click RMB to reset to 1 + Click RMB to reset to 1 + Click RMB to reset to 1 + Click RMB to reset to 1 + Click RMB to reset to 1 + Click RMB to reset to 1 + Click RMB to reset to 1 + Кликните ПКМ чтобы сбросить на 1 + Click RMB to reset to 1 + Click RMB to reset to 1 + Click RMB to reset to 1 + Click RMB to reset to 1 + Click RMB to reset to 1 + + Markers Markierungen マーカー From 8475b1a748d71905e7f5ca6d825860707c2ab4fb Mon Sep 17 00:00:00 2001 From: "eugene.tretyak" Date: Tue, 20 Jul 2021 16:09:10 +0300 Subject: [PATCH 02/10] Tabs replaced with spaces --- addons/markers/functions/fnc_initInsertMarker.sqf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/markers/functions/fnc_initInsertMarker.sqf b/addons/markers/functions/fnc_initInsertMarker.sqf index 7f4f1d518e7..cdd42a83eb8 100644 --- a/addons/markers/functions/fnc_initInsertMarker.sqf +++ b/addons/markers/functions/fnc_initInsertMarker.sqf @@ -332,7 +332,7 @@ private _curSelAngle = GETGVAR(currentMarkerAngle,0); _aceAngleSlider sliderSetPosition _curSelAngle; - _aceAngleSlider ctrlSetTooltip LLSTRING(MarkerDirectionSlider_Tooltip); + _aceAngleSlider ctrlSetTooltip LLSTRING(MarkerDirectionSlider_Tooltip); //Update now and add eventHandler: [_aceAngleSlider, _curSelAngle] call FUNC(onSliderPosChangedAngle); @@ -350,7 +350,7 @@ private _curSelScale = GETGVAR(currentMarkerScale,1); _aceScaleSlider sliderSetPosition _curSelScale; - _aceScaleSlider ctrlSetTooltip LLSTRING(MarkerScaleSlider_Tooltip); + _aceScaleSlider ctrlSetTooltip LLSTRING(MarkerScaleSlider_Tooltip); //Update now and add eventHandler: [_aceScaleSlider, _curSelScale] call FUNC(onSliderPosChangedScale); From 6f4c472a5d653428c373ce5060a5cc6785bc9ca5 Mon Sep 17 00:00:00 2001 From: "eugene.tretyak" Date: Tue, 20 Jul 2021 16:11:23 +0300 Subject: [PATCH 03/10] Added to AUTHORS.txt --- AUTHORS.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/AUTHORS.txt b/AUTHORS.txt index c0fbda03240..90c49cb9663 100644 --- a/AUTHORS.txt +++ b/AUTHORS.txt @@ -173,3 +173,4 @@ zGuba Fyuran dabako Frank +10Dozen a.k.a Dusin From b5d706574df3a6361bd93af77f7fb2e9cb55fec7 Mon Sep 17 00:00:00 2001 From: "eugene.tretyak" Date: Tue, 20 Jul 2021 16:14:33 +0300 Subject: [PATCH 04/10] Syntax tweaks Replaced != with isNotEqualTo --- addons/markers/functions/fnc_onSliderMouseButtonUpAngle.sqf | 2 +- addons/markers/functions/fnc_onSliderMouseButtonUpScale.sqf | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/markers/functions/fnc_onSliderMouseButtonUpAngle.sqf b/addons/markers/functions/fnc_onSliderMouseButtonUpAngle.sqf index d6da4ab9ad9..15addbfd951 100644 --- a/addons/markers/functions/fnc_onSliderMouseButtonUpAngle.sqf +++ b/addons/markers/functions/fnc_onSliderMouseButtonUpAngle.sqf @@ -19,7 +19,7 @@ params ["_aceAngleSlider", "_button", "", "", "", "", ""]; TRACE_2("params",_aceAngleSlider,_button); -if (_button != 1) exitWith {}; +if (_button isNotEqualTo 1) exitWith {}; _aceAngleSlider sliderSetPosition 0; [_aceAngleSlider, 0] call FUNC(onSliderPosChangedAngle); diff --git a/addons/markers/functions/fnc_onSliderMouseButtonUpScale.sqf b/addons/markers/functions/fnc_onSliderMouseButtonUpScale.sqf index 4db3971325a..e82f8e633ee 100644 --- a/addons/markers/functions/fnc_onSliderMouseButtonUpScale.sqf +++ b/addons/markers/functions/fnc_onSliderMouseButtonUpScale.sqf @@ -19,7 +19,7 @@ params ["_aceScaleSlider", "_button", "", "", "", "", ""]; TRACE_2("params",_aceAngleSlider,_button); -if (_button != 1) exitWith {}; +if (_button isNotEqualTo 1) exitWith {}; _aceScaleSlider sliderSetPosition 1; [_aceScaleSlider, 1] call FUNC(onSliderPosChangedScale); From d58f9f8d56e2404c122ef15d1dbe7cac89c9d1f6 Mon Sep 17 00:00:00 2001 From: "eugene.tretyak" Date: Tue, 20 Jul 2021 16:16:56 +0300 Subject: [PATCH 05/10] Remove tabs from stringtable.xml --- addons/markers/stringtable.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/markers/stringtable.xml b/addons/markers/stringtable.xml index 59fb40acd59..b7340f5f599 100644 --- a/addons/markers/stringtable.xml +++ b/addons/markers/stringtable.xml @@ -56,7 +56,7 @@ Click RMB to reset to 1 Click RMB to reset to 1 - + Markers Markierungen マーカー From b0522b37c7675e8cd50fc2ec9986ee8f58796e5b Mon Sep 17 00:00:00 2001 From: "eugene.tretyak" Date: Tue, 20 Jul 2021 23:03:15 +0300 Subject: [PATCH 06/10] Removed excessive lines from stringtable --- .../functions/fnc_initInsertMarker.sqf | 4 +-- addons/markers/stringtable.xml | 34 ++----------------- 2 files changed, 5 insertions(+), 33 deletions(-) diff --git a/addons/markers/functions/fnc_initInsertMarker.sqf b/addons/markers/functions/fnc_initInsertMarker.sqf index cdd42a83eb8..2aa7a0155eb 100644 --- a/addons/markers/functions/fnc_initInsertMarker.sqf +++ b/addons/markers/functions/fnc_initInsertMarker.sqf @@ -332,7 +332,7 @@ private _curSelAngle = GETGVAR(currentMarkerAngle,0); _aceAngleSlider sliderSetPosition _curSelAngle; - _aceAngleSlider ctrlSetTooltip LLSTRING(MarkerDirectionSlider_Tooltip); + _aceAngleSlider ctrlSetTooltip LLSTRING(MarkerDirectionScaleSlider_Tooltip); //Update now and add eventHandler: [_aceAngleSlider, _curSelAngle] call FUNC(onSliderPosChangedAngle); @@ -350,7 +350,7 @@ private _curSelScale = GETGVAR(currentMarkerScale,1); _aceScaleSlider sliderSetPosition _curSelScale; - _aceScaleSlider ctrlSetTooltip LLSTRING(MarkerScaleSlider_Tooltip); + _aceScaleSlider ctrlSetTooltip LLSTRING(MarkerDirectionScaleSlider_Tooltip); //Update now and add eventHandler: [_aceScaleSlider, _curSelScale] call FUNC(onSliderPosChangedScale); diff --git a/addons/markers/stringtable.xml b/addons/markers/stringtable.xml index b7340f5f599..53c9ce56009 100644 --- a/addons/markers/stringtable.xml +++ b/addons/markers/stringtable.xml @@ -24,37 +24,9 @@ 方位: %1° Yön: %1° - - Click RMB to reset to 0 - Click RMB to reset to 0 - Click RMB to reset to 0 - Click RMB to reset to 0 - Click RMB to reset to 0 - Click RMB to reset to 0 - Click RMB to reset to 0 - Click RMB to reset to 0 - Кликните ПКМ чтобы сбросить на 0 - Click RMB to reset to 0 - Click RMB to reset to 0 - Click RMB to reset to 0 - Click RMB to reset to 0 - Click RMB to reset to 0 - - - Click RMB to reset to 1 - Click RMB to reset to 1 - Click RMB to reset to 1 - Click RMB to reset to 1 - Click RMB to reset to 1 - Click RMB to reset to 1 - Click RMB to reset to 1 - Click RMB to reset to 1 - Кликните ПКМ чтобы сбросить на 1 - Click RMB to reset to 1 - Click RMB to reset to 1 - Click RMB to reset to 1 - Click RMB to reset to 1 - Click RMB to reset to 1 + + Click RMB to reset + Нажми ПКМ чтобы сбросить Markers From 768caaccba68bc9fdf5099b597a900926574a5ce Mon Sep 17 00:00:00 2001 From: 10Dozen Date: Thu, 22 Jul 2021 20:42:23 +0300 Subject: [PATCH 07/10] Update addons/markers/functions/fnc_onSliderMouseButtonUpScale.sqf Co-authored-by: PabstMirror --- addons/markers/functions/fnc_onSliderMouseButtonUpScale.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/markers/functions/fnc_onSliderMouseButtonUpScale.sqf b/addons/markers/functions/fnc_onSliderMouseButtonUpScale.sqf index e82f8e633ee..00e32a0b6c1 100644 --- a/addons/markers/functions/fnc_onSliderMouseButtonUpScale.sqf +++ b/addons/markers/functions/fnc_onSliderMouseButtonUpScale.sqf @@ -17,7 +17,7 @@ */ params ["_aceScaleSlider", "_button", "", "", "", "", ""]; -TRACE_2("params",_aceAngleSlider,_button); +TRACE_2("params",_aceScaleSlider,_button); if (_button isNotEqualTo 1) exitWith {}; From 477b612c781fcdeeb3e4e7084ccd7ef6f023f311 Mon Sep 17 00:00:00 2001 From: 10Dozen Date: Fri, 23 Jul 2021 13:40:16 +0300 Subject: [PATCH 08/10] Update addons/markers/functions/fnc_onSliderMouseButtonUpAngle.sqf Co-authored-by: mharis001 <34453221+mharis001@users.noreply.github.com> --- addons/markers/functions/fnc_onSliderMouseButtonUpAngle.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/markers/functions/fnc_onSliderMouseButtonUpAngle.sqf b/addons/markers/functions/fnc_onSliderMouseButtonUpAngle.sqf index 15addbfd951..17cfbab1565 100644 --- a/addons/markers/functions/fnc_onSliderMouseButtonUpAngle.sqf +++ b/addons/markers/functions/fnc_onSliderMouseButtonUpAngle.sqf @@ -16,7 +16,7 @@ * Public: No */ -params ["_aceAngleSlider", "_button", "", "", "", "", ""]; +params ["_aceAngleSlider", "_button"]; TRACE_2("params",_aceAngleSlider,_button); if (_button isNotEqualTo 1) exitWith {}; From 147499c95b5cb89be3cfc5b1c5afe4238cc944d6 Mon Sep 17 00:00:00 2001 From: 10Dozen Date: Fri, 23 Jul 2021 13:40:22 +0300 Subject: [PATCH 09/10] Update addons/markers/functions/fnc_onSliderMouseButtonUpScale.sqf Co-authored-by: mharis001 <34453221+mharis001@users.noreply.github.com> --- addons/markers/functions/fnc_onSliderMouseButtonUpScale.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/markers/functions/fnc_onSliderMouseButtonUpScale.sqf b/addons/markers/functions/fnc_onSliderMouseButtonUpScale.sqf index 00e32a0b6c1..fdcc1b09acc 100644 --- a/addons/markers/functions/fnc_onSliderMouseButtonUpScale.sqf +++ b/addons/markers/functions/fnc_onSliderMouseButtonUpScale.sqf @@ -16,7 +16,7 @@ * Public: No */ -params ["_aceScaleSlider", "_button", "", "", "", "", ""]; +params ["_aceScaleSlider", "_button"]; TRACE_2("params",_aceScaleSlider,_button); if (_button isNotEqualTo 1) exitWith {}; From ce11096625cef16771cd68408726357fe3d5eb50 Mon Sep 17 00:00:00 2001 From: jonpas Date: Fri, 23 Jul 2021 14:58:01 +0200 Subject: [PATCH 10/10] Apply suggestions from code review --- addons/markers/functions/fnc_onSliderMouseButtonUpAngle.sqf | 2 +- addons/markers/functions/fnc_onSliderMouseButtonUpScale.sqf | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/markers/functions/fnc_onSliderMouseButtonUpAngle.sqf b/addons/markers/functions/fnc_onSliderMouseButtonUpAngle.sqf index 17cfbab1565..b6c29cfd1ac 100644 --- a/addons/markers/functions/fnc_onSliderMouseButtonUpAngle.sqf +++ b/addons/markers/functions/fnc_onSliderMouseButtonUpAngle.sqf @@ -11,7 +11,7 @@ * None * * Example: - * [Slider, 1] call ace_markers_fnc_onSliderMouseButtonUpAngle; + * [Slider, 1] call ace_markers_fnc_onSliderMouseButtonUpAngle * * Public: No */ diff --git a/addons/markers/functions/fnc_onSliderMouseButtonUpScale.sqf b/addons/markers/functions/fnc_onSliderMouseButtonUpScale.sqf index fdcc1b09acc..144f1c49096 100644 --- a/addons/markers/functions/fnc_onSliderMouseButtonUpScale.sqf +++ b/addons/markers/functions/fnc_onSliderMouseButtonUpScale.sqf @@ -11,7 +11,7 @@ * None * * Example: - * [Slider, 1] call ace_markers_fnc_onSliderMouseButtonUpScale; + * [Slider, 1] call ace_markers_fnc_onSliderMouseButtonUpScale * * Public: No */