Added comments.
This commit is contained in:
@@ -1,24 +1,24 @@
|
||||
[Window][Sessions [Table View]]
|
||||
Pos=10,43
|
||||
Size=1477,280
|
||||
Size=1477,368
|
||||
Collapsed=0
|
||||
DockId=0x00000003,0
|
||||
|
||||
[Window][Listeners]
|
||||
Pos=10,325
|
||||
Size=1888,664
|
||||
Pos=10,413
|
||||
Size=1888,576
|
||||
Collapsed=0
|
||||
DockId=0x00000002,0
|
||||
|
||||
[Window][Eventlog]
|
||||
Pos=1489,43
|
||||
Size=409,280
|
||||
Size=409,368
|
||||
Collapsed=0
|
||||
DockId=0x00000004,0
|
||||
|
||||
[Window][Dear ImGui Demo]
|
||||
Pos=1489,43
|
||||
Size=409,280
|
||||
Size=409,368
|
||||
Collapsed=0
|
||||
DockId=0x00000004,1
|
||||
|
||||
@@ -28,16 +28,16 @@ Size=1908,999
|
||||
Collapsed=0
|
||||
|
||||
[Window][[FACEDEAD] bob@LAPTOP-02]
|
||||
Pos=10,325
|
||||
Size=1888,664
|
||||
Pos=10,413
|
||||
Size=1888,576
|
||||
Collapsed=0
|
||||
DockId=0x00000002,2
|
||||
DockId=0x00000002,1
|
||||
|
||||
[Window][[C9D8E7F6] charlie@SERVER-03]
|
||||
Pos=10,325
|
||||
Size=1888,664
|
||||
Pos=10,413
|
||||
Size=1888,576
|
||||
Collapsed=0
|
||||
DockId=0x00000002,2
|
||||
DockId=0x00000002,1
|
||||
|
||||
[Window][Debug##Default]
|
||||
Pos=60,60
|
||||
@@ -45,8 +45,8 @@ Size=400,400
|
||||
Collapsed=0
|
||||
|
||||
[Window][[G1H2I3J5] diana@WORKSTATION-04]
|
||||
Pos=10,325
|
||||
Size=1888,664
|
||||
Pos=10,413
|
||||
Size=1888,576
|
||||
Collapsed=0
|
||||
DockId=0x00000002,1
|
||||
|
||||
@@ -72,11 +72,16 @@ Pos=186,108
|
||||
Size=997,993
|
||||
Collapsed=0
|
||||
|
||||
[Window][Example: Log]
|
||||
Pos=119,266
|
||||
Size=1717,576
|
||||
Collapsed=0
|
||||
|
||||
[Table][0x32886A44,8]
|
||||
Column 0 Weight=0.6522
|
||||
Column 1 Weight=0.9755
|
||||
Column 2 Weight=0.6522
|
||||
Column 3 Weight=0.9639
|
||||
Column 2 Weight=0.5541
|
||||
Column 3 Weight=1.0620
|
||||
Column 4 Weight=1.7316
|
||||
Column 5 Weight=1.1486
|
||||
Column 6 Weight=0.3290
|
||||
@@ -88,8 +93,8 @@ Column 0 Sort=0v
|
||||
|
||||
[Docking][Data]
|
||||
DockSpace ID=0x85940918 Window=0x260A4489 Pos=10,43 Size=1888,946 Split=Y
|
||||
DockNode ID=0x00000001 Parent=0x85940918 SizeRef=1024,280 Split=X
|
||||
DockNode ID=0x00000001 Parent=0x85940918 SizeRef=1024,368 Split=X
|
||||
DockNode ID=0x00000003 Parent=0x00000001 SizeRef=613,159 CentralNode=1 Selected=0x61E02D75
|
||||
DockNode ID=0x00000004 Parent=0x00000001 SizeRef=409,159 Selected=0x5E5F7166
|
||||
DockNode ID=0x00000002 Parent=0x85940918 SizeRef=1024,664 Selected=0x8D780333
|
||||
DockNode ID=0x00000002 Parent=0x85940918 SizeRef=1024,576 Selected=0x65D642C0
|
||||
|
||||
|
||||
@@ -9,23 +9,20 @@ type
|
||||
showConsole*: bool
|
||||
inputBuffer: string
|
||||
consoleEntries: seq[string]
|
||||
console: ptr TextEditor
|
||||
|
||||
proc Console*(agent: Agent): ConsoleComponent =
|
||||
result = new ConsoleComponent
|
||||
result.agent = agent
|
||||
result.showConsole = true
|
||||
result.console = TextEditor_TextEditor()
|
||||
result.consoleEntries = @[
|
||||
"a",
|
||||
"a",
|
||||
"a",
|
||||
"a",
|
||||
"aAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
||||
"a",
|
||||
"a",
|
||||
"a",
|
||||
"a","a","a","a","a","a","a","a","a","a","a","a","a","a","a","a","a","a","a","a","a","a","a","a","a","a","a","a","a","a","a","a","a","a"
|
||||
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
|
||||
]
|
||||
|
||||
result.console.TextEditor_SetText(result.consoleEntries.join("\n") & '\0')
|
||||
|
||||
proc findLongestLength(text: string): float32 =
|
||||
var maxWidth = 0.0f
|
||||
for line in text.splitLines():
|
||||
@@ -42,6 +39,9 @@ proc draw*(component: ConsoleComponent) =
|
||||
defer: igEnd()
|
||||
|
||||
# Console text section
|
||||
# A InputTextMultiline component is placed within a Child Frame to enable both proper text selection and a horizontal scrollbar
|
||||
# The only thing missing from this implementation is the ability change the text color
|
||||
# https://github.com/ocornut/imgui/issues/383#issuecomment-2080346129
|
||||
let footerHeight = igGetStyle().ItemSpacing.y + igGetFrameHeightWithSpacing()
|
||||
let buffer = component.consoleEntries.join("\n") & '\0'
|
||||
|
||||
@@ -60,12 +60,20 @@ proc draw*(component: ConsoleComponent) =
|
||||
igSetScrollX_Float(1.0f) # This is required to prevent the horizontal scrolling from snapping in
|
||||
|
||||
# Retrieve the length of the longes console entry
|
||||
let width = findLongestLength(buffer)
|
||||
var width = findLongestLength(buffer)
|
||||
if width <= io.DisplaySize.x:
|
||||
width = -1.0f
|
||||
|
||||
# Set the Text edit background color and make it visible.
|
||||
igPushStyleColor_Vec4(ImGuiCol_FrameBg.int32, vec4(0.1f, 0.1f, 0.1f, 1.0f))
|
||||
igPushStyleColor_Vec4(ImGuiCol_ScrollbarBg.int32, vec4(0.1f, 0.1f, 0.1f, 1.0f))
|
||||
discard igInputTextMultiline("##ConsoleText", buffer, cast[csize_t](buffer.len()), vec2(width, -1.0f), ImGui_InputTextFlags_ReadOnly.int32 or ImGui_InputTextFlags_AllowTabInput.int32, nil, nil)
|
||||
|
||||
# Alternative: ImGuiColorTextEdit
|
||||
# component.console.TextEditor_SetReadOnlyEnabled(true)
|
||||
# component.console.TextEditor_SetShowLineNumbersEnabled(false)
|
||||
# component.console.TextEditor_Render("##ConsoleEntries", false, vec2(-1, -1), true)
|
||||
|
||||
igPopStyleColor(2)
|
||||
|
||||
igPopStyleColor(2)
|
||||
|
||||
Reference in New Issue
Block a user