Skip to content

Commit

Permalink
Merge pull request #3 from grimmier378/dev
Browse files Browse the repository at this point in the history
Fix: main console.
background color is now set to black, and hover highlights are set to just a tad bit lighter.
accidently removed writing to main console. that is back

These settings are saved to the config so you can change them. I will probably add a color-picker for this at some point.
  • Loading branch information
grimmier378 committed Mar 16, 2024
2 parents 59e1002 + 6367319 commit cfa2c11
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 4 deletions.
6 changes: 6 additions & 0 deletions default_settings.lua
@@ -1,4 +1,10 @@
return {
['Colors'] = {
['color_header'] = {0,0,0,1},
['color_headHov'] = {0.05,0.05,0.05,0.9},
['color_headAct'] = {0.05,0.05,0.05,0.9},
['color_WinBg'] = {0,0,0,1},
},
['Channels'] = {
[1] = {
['Name'] = 'Exp AA pts',
Expand Down
42 changes: 38 additions & 4 deletions init.lua
Expand Up @@ -10,6 +10,10 @@ local serverName = string.gsub(mq.TLO.EverQuest.Server(), ' ', '_') or ''
local myName = mq.TLO.Me.DisplayName() or ''
local addChannel = false
local tempSettings = {}
local color_header = {0,0,0,1}
local color_headHov = {0.05,0.05,0.05,0.9}
local color_headAct = {0.05,0.05,0.05,0.9}
local color_WinBg = {0,0,0,1}
local ChatWin = {
SHOW = true,
openGUI = true,
Expand Down Expand Up @@ -71,7 +75,21 @@ local function loadSettings()
end
SetUpConsoles(channelID)
end
if ChatWin.Settings['Colors'] then
color_header = ChatWin.Settings['Colors']['color_header']
color_headHov = ChatWin.Settings['Colors']['color_headHov']
color_headAct = ChatWin.Settings['Colors']['color_headAct']
color_WinBg = ChatWin.Settings['Colors']['color_WinBg']
else
ChatWin.Settings['Colors'] = {}
ChatWin.Settings['Colors']['color_WinBg'] = color_header
ChatWin.Settings['Colors']['color_header'] = color_headHov
ChatWin.Settings['Colors']['color_headHov'] = color_headAct
ChatWin.Settings['Colors']['color_headAct'] = color_WinBg
writeSettings(ChatWin.SettingsFile, ChatWin.Settings)
end
tempSettings = ChatWin.Settings

end
local eventNames = {}
local function BuildEvents()
Expand Down Expand Up @@ -105,19 +123,29 @@ function ChatWin.EventChat(channelID, eventName, line)
color = colorVec,
text = line
}
console:AppendText(colorCode, line)
else
print("Error: txtBuffer is nil for channelID " .. channelID)
end
else
print("Error: ChatWin.Consoles[channelID] is nil for channelID " .. channelID)
end
end

end
-- Variable to track last scroll position
function ChatWin.GUI()


if not ChatWin.openGUI then return end
local windowName = 'My Chat##'..myName
ImGui.SetNextWindowSize(ImVec2(640, 480), ImGuiCond.FirstUseEver)
ImGui.PushStyleVar(ImGuiStyleVar.WindowPadding, ImVec2(1, 0));
ImGui.PushStyleColor(ImGuiCol.WindowBg,color_WinBg[1],color_WinBg[2],color_WinBg[3],color_WinBg[4])
ImGui.PushStyleColor(ImGuiCol.Header, color_header[1],color_header[2],color_header[3],color_header[4])
ImGui.PushStyleColor(ImGuiCol.HeaderHovered,color_headHov[1],color_headHov[2],color_headHov[3],color_headHov[4])
ImGui.PushStyleColor(ImGuiCol.HeaderActive,color_headAct[1],color_headAct[2],color_headAct[3],color_headAct[4])
ImGui.PushStyleColor(ImGuiCol.TableRowBg, color_WinBg[1],color_WinBg[2],color_WinBg[3],color_WinBg[4])
ImGui.PushStyleColor(ImGuiCol.TableRowBgAlt,color_WinBg[1],color_WinBg[2],color_WinBg[3],color_WinBg[4])
if ImGui.Begin(windowName, ChatWin.openGUI, ChatWin.winFlags) then
-- Main menu bar
if ImGui.BeginMenuBar() then
Expand Down Expand Up @@ -196,14 +224,20 @@ function ChatWin.GUI()
end
if zoom and ChatWin.Consoles[channelID].txtBuffer ~= '' then
ImGui.BeginChild("ZoomScrollRegion", ImVec2(contentSizeX, contentSizeY), ImGuiWindowFlags.HorizontalScrollbar)
ImGui.BeginTable('##channelID', 1, ImGuiTableFlags.NoBordersInBody)
ImGui.BeginTable('##channelID', 1, bit32.bor(ImGuiTableFlags.NoBordersInBody, ImGuiTableFlags.RowBg))
ImGui.TableSetupColumn("##txt", ImGuiTableColumnFlags.NoHeaderLabel)
ImGui.TableNextRow()
ImGui.TableSetColumnIndex(0)
ImGui.SetWindowFontScale(1.5)
for line, data in pairs(ChatWin.Consoles[channelID].txtBuffer) do
local color = ""
ImGui.PushStyleColor(ImGuiCol.Text, ImVec4(data.color[1], data.color[2], data.color[3], data.color[4]))
if ImGui.Selectable("##selectable" .. line, false, ImGuiSelectableFlags.None) then
-- ImGui.LogToClipboard()
-- ImGui.LogText(data.text)
-- ImGui.LogFinish()
end
ImGui.SameLine()
ImGui.SameLine()
ImGui.TextWrapped(data.text)
if ImGui.IsItemHovered() and ImGui.IsKeyDown(ImGuiMod.Ctrl) and ImGui.IsKeyDown(ImGuiKey.C) then
Expand Down Expand Up @@ -278,14 +312,14 @@ function ChatWin.GUI()
ImGui.SetKeyboardFocusHere(-1)
end
end
ImGui.PopStyleColor(6)
ImGui.End()
ImGui.PopStyleVar()
end
-- --- Configure Windows and Events GUI
local lastID = 0
local editChanID = 0
local editEventID = 0

local tempEventStrings = {}
local tempColors = {}
local newEvent = false
Expand Down Expand Up @@ -422,7 +456,7 @@ end
local function buildConfig()
-- Add a flag to track if a row is marked for deletion
local markedForDeletion = {}

if ImGui.BeginTable("Channel Events", 1, bit32.bor(ImGuiTableFlags.Resizable, ImGuiTableFlags.RowBg, ImGuiTableFlags.Borders)) then
ImGui.TableSetupColumn("", ImGuiTableColumnFlags.WidthStretch, bit32.bor(ImGui.GetContentRegionAvail(), ImGuiTableColumnFlags.NoHeaderLabel))
ImGui.TableHeadersRow()
Expand Down

0 comments on commit cfa2c11

Please sign in to comment.