This commit is contained in:
Applevangelist
2025-12-17 11:31:07 +01:00
parent 7605c2f4f5
commit 49097649de
2 changed files with 31 additions and 18 deletions
+26 -13
View File
@@ -50,7 +50,7 @@ MARKEROPS_BASE = {
ClassName = "MARKEROPS", ClassName = "MARKEROPS",
Tag = "mytag", Tag = "mytag",
Keywords = {}, Keywords = {},
version = "0.1.4", version = "0.1.5",
debug = false, debug = false,
Casesensitive = true, Casesensitive = true,
} }
@@ -59,9 +59,8 @@ MARKEROPS_BASE = {
-- @param #MARKEROPS_BASE self -- @param #MARKEROPS_BASE self
-- @param #string Tagname Name to identify us from the event text. -- @param #string Tagname Name to identify us from the event text.
-- @param #table Keywords Table of keywords recognized from the event text. -- @param #table Keywords Table of keywords recognized from the event text.
-- @param #boolean Casesensitive (Optional) Switch case sensitive identification of Tagname. Defaults to true.
-- @return #MARKEROPS_BASE self -- @return #MARKEROPS_BASE self
function MARKEROPS_BASE:New(Tagname,Keywords,Casesensitive) function MARKEROPS_BASE:New(Tagname,Keywords)
-- Inherit FSM -- Inherit FSM
local self=BASE:Inherit(self, FSM:New()) -- #MARKEROPS_BASE local self=BASE:Inherit(self, FSM:New()) -- #MARKEROPS_BASE
@@ -72,11 +71,7 @@ function MARKEROPS_BASE:New(Tagname,Keywords,Casesensitive)
self.Keywords = Keywords or {} -- #table - might want to use lua regex here, too self.Keywords = Keywords or {} -- #table - might want to use lua regex here, too
self.debug = false self.debug = false
self.Casesensitive = true self.Casesensitive = true
if Casesensitive and Casesensitive == false then
self.Casesensitive = false
end
----------------------- -----------------------
--- FSM Transitions --- --- FSM Transitions ---
----------------------- -----------------------
@@ -145,7 +140,7 @@ function MARKEROPS_BASE:New(Tagname,Keywords,Casesensitive)
end end
--- (internal) Handle events. --- (Internal) Handle events.
-- @param #MARKEROPS_BASE self -- @param #MARKEROPS_BASE self
-- @param Core.Event#EVENTDATA Event -- @param Core.Event#EVENTDATA Event
function MARKEROPS_BASE:OnEventMark(Event) function MARKEROPS_BASE:OnEventMark(Event)
@@ -201,15 +196,17 @@ function MARKEROPS_BASE:OnEventMark(Event)
end end
end end
--- (internal) Match tag. --- (Internal) Match tag.
-- @param #MARKEROPS_BASE self -- @param #MARKEROPS_BASE self
-- @param #string Eventtext Text added to the marker. -- @param #string Eventtext Text added to the marker.
-- @return #boolean -- @return #boolean
function MARKEROPS_BASE:_MatchTag(Eventtext) function MARKEROPS_BASE:_MatchTag(Eventtext)
local matches = false local matches = false
if not self.Casesensitive then self:I(self.lid .. "Casesensitive "..tostring(self.Casesensitive))
if self.Casesensitive == false then
self:I(self.lid .. "Marker non-casesensitive "..Eventtext)
local type = string.lower(self.Tag) -- #string local type = string.lower(self.Tag) -- #string
if string.find(string.lower(Eventtext),type) then if string.find(string.lower(Eventtext),type,1,true) then
matches = true --event text contains tag matches = true --event text contains tag
end end
else else
@@ -221,7 +218,7 @@ function MARKEROPS_BASE:_MatchTag(Eventtext)
return matches return matches
end end
--- (internal) Match keywords table. --- (Internal) Match keywords table.
-- @param #MARKEROPS_BASE self -- @param #MARKEROPS_BASE self
-- @param #string Eventtext Text added to the marker. -- @param #string Eventtext Text added to the marker.
-- @return #table -- @return #table
@@ -286,6 +283,22 @@ function MARKEROPS_BASE:onenterStopped(From,Event,To)
self:UnHandleEvent(EVENTS.MarkRemoved) self:UnHandleEvent(EVENTS.MarkRemoved)
end end
--- Switch off case sensitive matching
-- @param #MARKEROPS_BASE self
-- @return self
function MARKEROPS_BASE:SwitchCaseSensitiveOff()
self.Casesensitive = false
return self
end
--- Switch on case sensitive matching
-- @param #MARKEROPS_BASE self
-- @return self
function MARKEROPS_BASE:SwitchCaseSensitiveOn()
self.Casesensitive = true
return self
end
-------------------------------------------------------------------------- --------------------------------------------------------------------------
-- MARKEROPS_BASE Class Definition End. -- MARKEROPS_BASE Class Definition End.
-------------------------------------------------------------------------- --------------------------------------------------------------------------
+5 -5
View File
@@ -4747,7 +4747,7 @@ function UTILS.DoStringIn(State,DoString)
end end
--- Show a picture on the screen to all --- Show a picture on the screen to all
-- @param #string FileName File name of the picture -- @param #string FilePath File name of the picture
-- @param #number Duration Duration in seconds, defaults to 10 -- @param #number Duration Duration in seconds, defaults to 10
-- @param #boolean ClearView If true, clears the view before showing the picture, defaults to false -- @param #boolean ClearView If true, clears the view before showing the picture, defaults to false
-- @param #number StartDelay Delay in seconds before showing the picture, defaults to 0 -- @param #number StartDelay Delay in seconds before showing the picture, defaults to 0
@@ -4770,7 +4770,7 @@ end
--- Show a picture on the screen to Coalition --- Show a picture on the screen to Coalition
-- @param #number Coalition Coalition ID, can be coalition.side.BLUE, coalition.side.RED or coalition.side.NEUTRAL -- @param #number Coalition Coalition ID, can be coalition.side.BLUE, coalition.side.RED or coalition.side.NEUTRAL
-- @param #string FileName File name of the picture -- @param #string FilePath File name of the picture
-- @param #number Duration Duration in seconds, defaults to 10 -- @param #number Duration Duration in seconds, defaults to 10
-- @param #boolean ClearView If true, clears the view before showing the picture, defaults to false -- @param #boolean ClearView If true, clears the view before showing the picture, defaults to false
-- @param #number StartDelay Delay in seconds before showing the picture, defaults to 0 -- @param #number StartDelay Delay in seconds before showing the picture, defaults to 0
@@ -4795,7 +4795,7 @@ end
--- Show a picture on the screen to Country --- Show a picture on the screen to Country
-- @param #number Country Country ID, can be country.id.USA, country.id.RUSSIA, etc. -- @param #number Country Country ID, can be country.id.USA, country.id.RUSSIA, etc.
-- @param #string FileName File name of the picture -- @param #string FilePath File name of the picture
-- @param #number Duration Duration in seconds, defaults to 10 -- @param #number Duration Duration in seconds, defaults to 10
-- @param #boolean ClearView If true, clears the view before showing the picture, defaults to false -- @param #boolean ClearView If true, clears the view before showing the picture, defaults to false
-- @param #number StartDelay Delay in seconds before showing the picture, defaults to 0 -- @param #number StartDelay Delay in seconds before showing the picture, defaults to 0
@@ -4818,7 +4818,7 @@ end
--- Show a picture on the screen to Group --- Show a picture on the screen to Group
-- @param Wrapper.Group#GROUP Group Group to show the picture to -- @param Wrapper.Group#GROUP Group Group to show the picture to
-- @param #string FileName File name of the picture -- @param #string FilePath File name of the picture
-- @param #number Duration Duration in seconds, defaults to 10 -- @param #number Duration Duration in seconds, defaults to 10
-- @param #boolean ClearView If true, clears the view before showing the picture, defaults to false -- @param #boolean ClearView If true, clears the view before showing the picture, defaults to false
-- @param #number StartDelay Delay in seconds before showing the picture, defaults to 0 -- @param #number StartDelay Delay in seconds before showing the picture, defaults to 0
@@ -4841,7 +4841,7 @@ end
--- Show a picture on the screen to Unit --- Show a picture on the screen to Unit
-- @param Wrapper.Unit#UNIT Unit Unit to show the picture to -- @param Wrapper.Unit#UNIT Unit Unit to show the picture to
-- @param #string FileName File name of the picture -- @param #string FilePath File name of the picture
-- @param #number Duration Duration in seconds, defaults to 10 -- @param #number Duration Duration in seconds, defaults to 10
-- @param #boolean ClearView If true, clears the view before showing the picture, defaults to false -- @param #boolean ClearView If true, clears the view before showing the picture, defaults to false
-- @param #number StartDelay Delay in seconds before showing the picture, defaults to 0 -- @param #number StartDelay Delay in seconds before showing the picture, defaults to 0