Module 04_LogDisplay

Log Display for Lua Errors

This is a little fake actor class meant for displaying lines of a log. It's placed inside Def, but it's actually just an ActorFrame with some children and special commands. LogDisplay listens for several messages that control its behavior. The name given to the LogDisplay is added to the name of the message to make the messages unique to this LogDisplay. So to issue a command to the LogDisplay, broadcast the message "". For a LogDisplay named "Foo", you would broadcase "Foo" to add to the log, "ToggleFoo" to toggle whether it's shown or hidden, and so on. Some of the control messages take tables of args. Arg elements of the form "name= type" are named, and must be a value of the given type. Arg elements of the form "name" are unnamed. The messages are: : params= {message= string, dont_show= bool}

Adds message to the log to be shown when revealing.
If dont_show is false, then Show will be automatically executed with
auto_hide= true.
Messages with line breaks will take up multiple lines.
The newest message in the log has index 1.

Toggle: No params

Executes either Show or Hide, depending on the current state.

Show: params= {range= {lastmessage, lines}, autohide= bool}

Shows the messages currently in the log.
range[1] is the index of the last message to show.
range[2] is the max number of lines to show.
range[1] defaults to a cleavage shot.
range[2] defaults to MaxDisplayLines.
If auto_hide is non-nil, Hide will be execuated after a short time.
If auto_hide is a number, it will be used as the time to wait before
  hiding.  Otherwise, the Times.show will be used.

Query: No params

Broadcasts "<name>Response" message with a table containing:
  {log_len= number, hidden= bool}
  log_len is the number of messages currently in the log.
  hidden is whether the LogDisplay is currently hidden.

Hide: No params

Hides the LogDisplay.

Clear: params= {messages}

Clears the messages in the log.  If messages is a number, only clears
that many messages, oldest first.

params to Def.LogDisplay(): { Name= string

The name will be used as the name of the main ActorFrame and to
control what messages the LogDisplay listens for.

MaxLogLen= number

The maximum number of messages to store in the log.

MaxDisplayLines= number

The maximum number of lines that can be displayed at a time.

ReplaceLinesWhenHidden= bool

If this is true, any messages recieved while the LogDisplay is hidden
will replace the message currently at the front of the log.
If this is false, messages recieved while the LogDisplay is hidden
will push other messages back.  Messages pushed past MaxLines will be
removed.

IgnoreIdentical= bool

If true, then a message that is identical to one already in the log
will be ignored.

Font= font name

The name of the font to use.  This will be passed to THEME:GetPathF,
so it should not be a path.

LineHeight= number

The height in pixels to use between lines.

LineWidth= number

The width that lines should be limited to.

TextZoom= number

The zoom factor to apply to the text.

TextColor= color

The color to use for the text.

Times= {show= number, hide= number}

show is the amount of time to wait before automatically hiding when
Show is executed with AutoHide == true.  It's passed as a table, so
if you keep a copy of the table, you should be able to modify it to
change the time.
hide is used as the time for the default hide command to hide.

Indent= number

The amount in pixels to indent lines that were part of a multi-line
message.

Hide= function(self)

This command will be executed when the LogDisplay needs to be hidden.
Hide will also be executed during the InitCommand, so the
LogDisplay will start in the hidden state.

Show= function(self, Lines)

This command will be executed when the LogDisplay needs to be shown.
Lines is the number of lines to show.

} Any actors placed in params will be used and drawn behind the text. If there are no actors in params, a quad filling the area will be used. Reasonable defaults are provided for everything except Name. If Name is blank, you get nothing. Defaults assume the LogDisplay should fill the screen when in use.



generated by LDoc 1.5.0 Last updated 2024-10-02 05:06:53