-
Notifications
You must be signed in to change notification settings - Fork 57
Add Zeus and 3DEN comments #785
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 27 commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
d05a5f3
Show 3DEN comments in Zeus
Timi007 28e4f2f
Make icons smaller and hide line behind icon
Timi007 0935239
Spelling
Timi007 d2b1a84
Add tooltip to comments
Timi007 be9ba01
Fix 3DEN event handlers added again when returning from preview
Timi007 c6a094e
Save comment when starting preview
Timi007 58482f1
Move gui to file
Timi007 4e8bd2d
Add zeus comments
Timi007 83f9d1e
Allow deleting comments
Timi007 8256b2c
Add type for zeus/3DEN comment & cleanup
Timi007 d66d336
Merge to one package
Timi007 4c44b03
Remove module
Timi007 045bc1a
Allow editing and pick color of comments
Timi007 f346539
Adapt to be more consistent with area_markers
Timi007 e5bcece
Add 3DEN checkbox attribute for ignoring comments
Timi007 6359e65
Use LINKFUNC
Timi007 2fa657a
Fix obsolete param
Timi007 dbd3231
Add ability to move comment
Timi007 b3e916a
Cleanup
Timi007 f44d79c
Add documentation
Timi007 bdbc943
Remove module dependency
Timi007 98133f6
Fix JIP problems
Timi007 3bf6e7f
Fix spelling
Timi007 4e8d409
Add comment feature to README
Timi007 d1cc8c8
Add option to lock position
Timi007 3dc2d03
Use toolbox instead of checkbox
Timi007 4a4e223
Merge branch 'master' into comments
Timi007 9ddd08d
Update addons/comments/functions/fnc_moveComment.sqf
BrettMayson c7318ef
add events to docs
BrettMayson ed9faa5
remove the word comment
BrettMayson File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -50,6 +50,7 @@ PlayerBot | |
| Ryan180602 | ||
| shukari | ||
| SilentSpike | ||
| Timi007 | ||
| Toinane | ||
| Tuupertunut | ||
| veteran29 | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| x\zen\addons\comments |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| class Cfg3DEN { | ||
| class Attributes { | ||
| class Default; | ||
| class GVAR(hiddenAttribute): Default { | ||
| onLoad = QUOTE((ctrlParentControlsGroup ctrlParentControlsGroup (_this select 0)) ctrlShow false); | ||
| }; | ||
| }; | ||
|
|
||
| class Mission { | ||
| class Scenario { | ||
| class AttributeCategories { | ||
| class ADDON { | ||
| displayName = STR_DISPLAY_NAME; | ||
| collapsed = 1; | ||
|
|
||
| class Attributes { | ||
| class GVAR(3DENComments) { | ||
| displayName = STR_DISPLAY_NAME; | ||
| property = QGVAR(3DENComments); | ||
| control = QGVAR(hiddenAttribute); | ||
| tooltip = ""; | ||
| defaultValue = "[]"; | ||
| expression = ""; | ||
| wikiType = "[[Array]]"; | ||
| }; | ||
| }; | ||
| }; | ||
| }; | ||
| }; | ||
| }; | ||
|
|
||
| class EventHandlers { | ||
| class ADDON { | ||
| // Arguments are for debugging | ||
| onMissionSave = QUOTE(['onMissionSave'] call FUNC(save3DENComments)); | ||
| onMissionAutosave = QUOTE(['onMissionAutosave'] call FUNC(save3DENComments)); | ||
| onBeforeMissionPreview = QUOTE(['onBeforeMissionPreview'] call FUNC(save3DENComments)); | ||
| }; | ||
| }; | ||
|
|
||
| class Comment { | ||
| class AttributeCategories { | ||
| class ADDON { | ||
| displayName = ECSTRING(main,DisplayName); | ||
| collapsed = 0; | ||
|
|
||
| class Attributes { | ||
| class GVAR(showComment) { | ||
| displayName = CSTRING(ShowCommentInZeus); | ||
| tooltip = CSTRING(ShowCommentInZeus_Description); | ||
| property = QGVAR(showComment); | ||
| control = "CheckboxState"; | ||
| defaultValue = "true"; | ||
| expression = ""; | ||
| wikiType = "[[Bool]]"; | ||
| }; | ||
| }; | ||
| }; | ||
| }; | ||
| }; | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| class EGVAR(context_menu,actions) { | ||
| class GVAR(createComment) { | ||
| displayName = STR_CREATE_COMMENT; | ||
| icon = COMMENT_ICON; | ||
| condition = QGVAR(enabled); | ||
| statement = QUOTE([_position] call FUNC(openDialog)); | ||
| priority = 35; | ||
| }; | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| class Extended_PreStart_EventHandlers { | ||
| class ADDON { | ||
| init = QUOTE(call COMPILE_SCRIPT(XEH_preStart)); | ||
| }; | ||
| }; | ||
|
|
||
| class Extended_PreInit_EventHandlers { | ||
| class ADDON { | ||
| init = QUOTE(call COMPILE_SCRIPT(XEH_preInit)); | ||
| }; | ||
| }; | ||
|
|
||
| class Extended_PostInit_EventHandlers { | ||
| class ADDON { | ||
| init = QUOTE(call COMPILE_SCRIPT(XEH_postInit)); | ||
| }; | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| PREP(addDrawEventHandler); | ||
| PREP(createComment); | ||
| PREP(createIcon); | ||
| PREP(deleteComment); | ||
| PREP(deleteIcon); | ||
| PREP(drawComments); | ||
| PREP(is3DENComment); | ||
| PREP(moveComment); | ||
| PREP(onCommentCreated); | ||
| PREP(onCommentDeleted); | ||
| PREP(onCommentUpdated); | ||
| PREP(onDraw); | ||
| PREP(onDraw3D); | ||
| PREP(onKeyDown); | ||
| PREP(onMouseButtonDown); | ||
| PREP(onMouseButtonUp); | ||
| PREP(onMouseDblClick); | ||
| PREP(onMouseMoving); | ||
| PREP(onUnload); | ||
| PREP(openDialog); | ||
| PREP(save3DENComments); | ||
| PREP(updateComment); | ||
| PREP(updateIcon); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| #include "script_component.hpp" | ||
|
|
||
| if (isServer) then { | ||
| [QGVAR(createComment), LINKFUNC(createComment)] call CBA_fnc_addEventHandler; | ||
| [QGVAR(deleteComment), LINKFUNC(deleteComment)] call CBA_fnc_addEventHandler; | ||
| [QGVAR(updateComment), LINKFUNC(updateComment)] call CBA_fnc_addEventHandler; | ||
| }; | ||
|
|
||
| if (hasInterface) then { | ||
| GVAR(comments) = createHashMapFromArray getMissionConfigValue [QGVAR(3DENComments), []]; | ||
| TRACE_1("Loaded 3DEN Comments from mission",GVAR(comments)); | ||
|
|
||
| [QGVAR(commentCreated), LINKFUNC(onCommentCreated)] call CBA_fnc_addEventHandler; | ||
| [QGVAR(commentDeleted), LINKFUNC(onCommentDeleted)] call CBA_fnc_addEventHandler; | ||
| [QGVAR(commentUpdated), LINKFUNC(onCommentUpdated)] call CBA_fnc_addEventHandler; | ||
|
|
||
| ["zen_curatorDisplayLoaded", LINKFUNC(addDrawEventHandler)] call CBA_fnc_addEventHandler; | ||
| ["zen_curatorDisplayUnloaded", LINKFUNC(onUnload)] call CBA_fnc_addEventHandler; | ||
| }; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| #include "script_component.hpp" | ||
|
|
||
| ADDON = false; | ||
|
|
||
| PREP_RECOMPILE_START; | ||
| #include "XEH_PREP.hpp" | ||
| PREP_RECOMPILE_END; | ||
|
|
||
| if (isServer) then { | ||
| // Unique ID for creating comments | ||
| GVAR(nextID) = 0; | ||
| }; | ||
|
|
||
| if (hasInterface) then { | ||
| // Map of all comments | ||
| // Keys are comment IDs and values are the data | ||
| GVAR(comments) = createHashMap; | ||
| GVAR(icons) = createHashMap; | ||
|
|
||
| GVAR(draw3DAdded) = false; | ||
|
|
||
| GVAR(movingComment) = []; | ||
| }; | ||
|
|
||
| #include "initSettings.inc.sqf" | ||
|
|
||
| ADDON = true; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| #include "script_component.hpp" | ||
|
|
||
| #include "XEH_PREP.hpp" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| #include "script_component.hpp" | ||
|
|
||
| class CfgPatches { | ||
| class ADDON { | ||
| name = COMPONENT_NAME; | ||
| units[] = {}; | ||
| weapons[] = {}; | ||
| requiredVersion = REQUIRED_VERSION; | ||
| requiredAddons[] = {"zen_dialog"}; | ||
| author = ECSTRING(main,Author); | ||
| authors[] = {"Timi007"}; | ||
| url = ECSTRING(main,URL); | ||
| VERSION_CONFIG; | ||
| }; | ||
| }; | ||
|
|
||
| PRELOAD_ADDONS; | ||
|
|
||
| #include "CfgEventHandlers.hpp" | ||
| #include "Cfg3DEN.hpp" | ||
| #include "CfgContext.hpp" | ||
| #include "gui.hpp" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| #include "script_component.hpp" | ||
| /* | ||
| * Author: Timi007 | ||
| * Function triggered every time the Zeus/Curator display is opened. | ||
| * Adds the draw event handlers to display 3DEN comments in 3D and on the map. | ||
| * | ||
| * Arguments: | ||
| * 0: Zeus Display <DISPLAY> | ||
| * | ||
| * Return Value: | ||
| * None | ||
| * | ||
| * Example: | ||
| * [_display] call zen_comments_fnc_addDrawEventHandler | ||
| * | ||
| * Public: No | ||
| */ | ||
|
|
||
| params ["_display"]; | ||
| TRACE_1("Zeus display opened",_display); | ||
|
|
||
| if (!GVAR(enabled) && !GVAR(enabled3DEN)) exitWith {}; | ||
|
|
||
| [{ | ||
| {_x call FUNC(createIcon)} forEach GVAR(comments); | ||
| }] call CBA_fnc_execNextFrame; // Run next frame so display is loaded in FUNC(createIcon) | ||
|
|
||
| if (!GVAR(draw3DAdded)) then { | ||
| LOG("Adding Draw3D."); | ||
| addMissionEventHandler ["Draw3D", {call FUNC(onDraw3D)}]; | ||
| GVAR(draw3DAdded) = true; | ||
| }; | ||
|
|
||
| // MapDraw EH needs to be added every time the Zeus display is opened. | ||
| LOG("Adding map draw."); | ||
| private _ctrlMap = _display displayCtrl IDC_RSCDISPLAYCURATOR_MAINMAP; | ||
| _ctrlMap ctrlAddEventHandler ["Draw", {call FUNC(onDraw)}]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| #include "script_component.hpp" | ||
| /* | ||
| * Author: Timi007 | ||
| * Creates a new comment in Zeus. | ||
| * | ||
| * Arguments: | ||
| * 0: Position ASL <ARRAY> | ||
| * 1: Title <STRING> | ||
| * 2: Tooltip <STRING> (default: "") | ||
| * 3: Comment color (RGBA) <ARRAY> (default: yellow) | ||
| * 4: Creator <STRING> (default: "") | ||
| * 5: Lock position <BOOLEAN> (default: false) | ||
| * | ||
| * Return Value: | ||
| * Id of the created comment <STRING>. | ||
| * | ||
| * Example: | ||
| * [[0, 0, 0], "My Comment", "This is a nice comment", [1, 0, 0, 0.7], "Joe", false] call zen_comments_fnc_createComment | ||
| * | ||
| * Public: No | ||
| */ | ||
|
|
||
| if (!isServer) exitWith { | ||
| [QGVAR(createComment), _this] call CBA_fnc_serverEvent; | ||
| }; | ||
|
|
||
| params [ | ||
| ["_position", [0, 0, 0], [[]], 3], | ||
| ["_title", "", [""]], | ||
| ["_tooltip", "", [""]], | ||
| ["_color", DEFAULT_COLOR, [[]], 4], | ||
| ["_creator", "", [""]], | ||
| ["_lockPosition", false, [false]] | ||
| ]; | ||
|
|
||
| private _id = format ["%1:%2", COMMENT_TYPE_ZEUS, GVAR(nextID)]; | ||
| private _data = [_position, _title, _tooltip, _color, _creator, _lockPosition]; | ||
| GVAR(nextID) = GVAR(nextID) + 1; | ||
|
|
||
| private _jipId = format [QGVAR(%1), _id]; | ||
| [QGVAR(commentCreated), [_id, _data], _jipId] call CBA_fnc_globalEventJIP; | ||
| TRACE_2("Comment created",_id,_data); | ||
|
|
||
| _id |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| #include "script_component.hpp" | ||
| /* | ||
| * Author: Timi007 | ||
| * Creates an icon control for the comment. | ||
| * | ||
| * Arguments: | ||
| * 0: Unique comment id <STRING> | ||
| * | ||
| * Return Value: | ||
| * Icon control for the comment <CONTROL>. | ||
| * | ||
| * Example: | ||
| * ["zeus:0"] call zen_comments_fnc_createIcon | ||
| * | ||
| * Public: No | ||
| */ | ||
|
|
||
| params ["_id"]; | ||
|
|
||
| private _display = findDisplay IDD_RSCDISPLAYCURATOR; | ||
| if (isNull _display || !(_id in GVAR(comments))) exitWith {}; | ||
|
|
||
| (GVAR(comments) get _id) params ["", "", ["_tooltip", ""]]; | ||
|
|
||
| private _ctrlIcon = _display ctrlCreate [QGVAR(RscActiveCommentIcon), -1]; | ||
| _ctrlIcon setVariable [QGVAR(comment), _id]; | ||
| _ctrlIcon ctrlSetTooltip _tooltip; | ||
|
|
||
| GVAR(icons) set [_id, _ctrlIcon]; | ||
|
|
||
| _ctrlIcon |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| #include "script_component.hpp" | ||
| /* | ||
| * Author: Timi007 | ||
| * Deletes the comment. | ||
| * | ||
| * Arguments: | ||
| * 0: Comment id <STRING> | ||
| * | ||
| * Return Value: | ||
| * None | ||
| * | ||
| * Example: | ||
| * ["zeus:2"] call zen_comments_fnc_deleteComment | ||
| * | ||
| * Public: No | ||
| */ | ||
|
|
||
| if (!isServer) exitWith { | ||
| [QGVAR(deleteComment), _this] call CBA_fnc_serverEvent; | ||
| }; | ||
|
|
||
| params ["_id"]; | ||
|
|
||
| // JIP event IDs are globally unique. For 3DEN comments, there won't be a created | ||
| // event but for Zeus ones the created JIP event will be overwritten with this | ||
| // deleted event that shares the same JIP ID, meaning that we don't have to remove | ||
| // the created JIP event. | ||
| private _jipId = format [QGVAR(%1), _id]; | ||
| [QGVAR(commentDeleted), [_id], _jipId] call CBA_fnc_globalEventJIP; | ||
| TRACE_1("Comment deleted",_id); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| #include "script_component.hpp" | ||
| /* | ||
| * Author: Timi007 | ||
| * Deletes the icon control of comment. | ||
| * | ||
| * Arguments: | ||
| * 0: Comment id <STRING> | ||
| * | ||
| * Return Value: | ||
| * None | ||
| * | ||
| * Example: | ||
| * ["zeus:2"] call zen_comments_fnc_deleteIcon | ||
| * | ||
| * Public: No | ||
| */ | ||
|
|
||
| params ["_id"]; | ||
|
|
||
| if (_id in GVAR(icons)) then { | ||
| ctrlDelete (GVAR(icons) deleteAt _id); | ||
| }; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.