public void DrawDebugViz()
    {
        bool _active = gameObject.activeInHierarchy;

        if (ImGui.Checkbox("gameobject active", ref _active))
        {
            gameObject.SetActive(_active);
        }

        ImGui.Spacing();

        ImGuiTabBarFlags f = ImGuiTabBarFlags.NoCloseWithMiddleMouseButton | ImGuiTabBarFlags.TabListPopupButton
                             | ImGuiTabBarFlags.FittingPolicyDefault | ImGuiTabBarFlags.Reorderable;

        if (ImGui.BeginTabBar(gameObject.name, f))
        {
            gameObject.SendMessage <IDebugViz>
                ((cmp) =>
            {
                if (ImGui.BeginTabItem(cmp.GetType().Name))
                {
                    cmp.DrawDebugViz();
                    ImGui.EndTabItem();
                }
            });
            ImGui.EndTabBar();
        }
    }
    private static void ImGuiUn_Layout()
    {
        if (!doDebugViz)
        {
            return;
        }

        ImGuiWindowFlags flags = ImGuiWindowFlags.NoNavFocus | ImGuiWindowFlags.NoFocusOnAppearing
                                 | ImGuiWindowFlags.HorizontalScrollbar;

        ImGui.SetNextWindowBgAlpha(0.35f);
        ImGui.SetNextWindowSize(new Vector2(400, 300), ImGuiCond.FirstUseEver);
        if (ImGui.Begin("debug viz", ref p_open, flags))
        {
            ImGuiTabBarFlags f = ImGuiTabBarFlags.NoCloseWithMiddleMouseButton | ImGuiTabBarFlags.TabListPopupButton;
            if (ImGui.BeginTabBar("debug_viz_tab", f))
            {
                foreach (var v in vizs)
                {
                    if (ImGui.BeginTabItem(v.gameObject.name))
                    {
                        v.DrawDebugViz();
                        ImGui.EndTabItem();
                    }
                }
                ImGui.EndTabBar();
            }

            ImGui.End();
        }
    }
Exemplo n.º 3
0
        private void ChatUI()
        {
            if (nulled)
            {
                sleep--;
                if (sleep > 0)
                {
                    return;
                }

                scan1 = pluginInterface.TargetModuleScanner.ScanText("E8 ?? ?? ?? ?? 41 b8 01 00 00 00 48 8d 15 ?? ?? ?? ?? 48 8b 48 20 e8 ?? ?? ?? ?? 48 8b cf");
                scan2 = pluginInterface.TargetModuleScanner.ScanText("e8 ?? ?? ?? ?? 48 8b cf 48 89 87 ?? ?? 00 00 e8 ?? ?? ?? ?? 41 b8 01 00 00 00");

                getBaseUIObj    = Marshal.GetDelegateForFunctionPointer <GetBaseUIObjDelegate>(scan1);
                getUI2ObjByName = Marshal.GetDelegateForFunctionPointer <GetUI2ObjByNameDelegate>(scan2);
                chatLog         = getUI2ObjByName(Marshal.ReadIntPtr(getBaseUIObj(), 0x20), "ChatLog", 1);

                if (chatLog != IntPtr.Zero)
                {
                    chatLogPanel_0 = getUI2ObjByName(Marshal.ReadIntPtr(getBaseUIObj(), 0x20), "ChatLogPanel_0", 1);
                    chatLogStuff   = Marshal.ReadIntPtr(chatLog, 0xc8);
                }
            }

            if (pluginInterface.ClientState.LocalPlayer == null || getUI2ObjByName(Marshal.ReadIntPtr(getBaseUIObj(), 0x20), "ChatLog", 1) == IntPtr.Zero)
            {
                if (getUI2ObjByName(Marshal.ReadIntPtr(getBaseUIObj(), 0x20), "ChatLog", 1) == IntPtr.Zero)
                {
                    sleep          = 1000;
                    nulled         = true;
                    chatLogStuff   = IntPtr.Zero;
                    chatLog        = IntPtr.Zero;
                    chatLogPanel_0 = IntPtr.Zero;
                }
            }
            else
            {
                nulled = false;
            }

            if (nulled)
            {
                return;
            }

            ImGuiWindowFlags chat_window_flags     = 0;
            ImGuiWindowFlags chat_sub_window_flags = 0;

            if (no_titlebar)
            {
                chat_window_flags |= ImGuiWindowFlags.NoTitleBar;
            }
            if (no_scrollbar)
            {
                chat_window_flags |= ImGuiWindowFlags.NoScrollbar;
            }
            if (no_scrollbar)
            {
                chat_sub_window_flags |= ImGuiWindowFlags.NoScrollbar;
            }
            if (!no_menu)
            {
                chat_window_flags |= ImGuiWindowFlags.MenuBar;
            }
            if (no_move)
            {
                chat_window_flags |= ImGuiWindowFlags.NoMove;
            }
            if (no_resize)
            {
                chat_window_flags |= ImGuiWindowFlags.NoResize;
            }
            if (no_collapse)
            {
                chat_window_flags |= ImGuiWindowFlags.NoCollapse;
            }
            if (no_nav)
            {
                chat_window_flags |= ImGuiWindowFlags.NoNav;
            }
            if (no_mouse)
            {
                chat_window_flags |= ImGuiWindowFlags.NoMouseInputs;
            }
            if (no_mouse2)
            {
                chat_sub_window_flags |= ImGuiWindowFlags.NoMouseInputs;
            }


            //otherwise update all the values
            if (chatLogStuff != IntPtr.Zero)
            {
                var chatLogProperties = Marshal.ReadIntPtr(chatLog, 0xC8);
                Marshal.Copy(chatLogProperties + 0x44, chatLogPosition, 0, 2);
                Width   = Marshal.ReadInt16(chatLogProperties + 0x90);
                Height  = Marshal.ReadInt16(chatLogProperties + 0x92);
                Alpha   = Marshal.ReadByte(chatLogProperties + 0x73);
                BoxHide = Marshal.ReadByte(chatLogProperties + 0x182);
            }
            //Get initial hooks in
            else
            {
                chatLog = getUI2ObjByName(Marshal.ReadIntPtr(getBaseUIObj(), 0x20), "ChatLog", 1);
                if (chatLog != IntPtr.Zero)
                {
                    chatLogPanel_0 = getUI2ObjByName(Marshal.ReadIntPtr(getBaseUIObj(), 0x20), "ChatLogPanel_0", 1);
                    chatLogStuff   = Marshal.ReadIntPtr(chatLog, 0xc8);
                }
            }

            if (!skipfont)
            {
                if (font.IsLoaded())
                {
                    ImGui.PushFont(font);
                    if (hideWithChat & Alpha.ToString() != "0")
                    {
                        if (chatWindow)
                        {
                            if (flickback)
                            {
                                no_mouse  = false;
                                flickback = false;
                            }
                            ImGui.SetNextWindowSize(new Num.Vector2(200, 100), ImGuiCond.FirstUseEver);
                            ImGui.SetNextWindowBgAlpha(alpha);
                            ImGui.Begin("Another Window", ref chatWindow, chat_window_flags);
                            ImGuiTabBarFlags tab_bar_flags = ImGuiTabBarFlags.None;

                            if (overrideChat)
                            {
                                ImGui.SetWindowPos(new Num.Vector2(chatLogPosition[0] + 15, chatLogPosition[1] + 10));
                                ImGui.SetWindowSize(new Num.Vector2(Width - 27, Height - 75));
                                //Marshal.WriteByte(chatLogPanel_0 + 0x182, BoxOff);
                            }
                            else
                            {
                                //Marshal.WriteByte(chatLogPanel_0 + 0x182, BoxOn);
                            }

                            if (ImGui.BeginTabBar("Tabs", tab_bar_flags))
                            {
                                int loop = 0;
                                foreach (var tab in items)
                                {
                                    if (tab.Enabled)
                                    {
                                        //WIP

                                        if (tab.sel)
                                        {
                                            ImGui.PushStyleColor(ImGuiCol.Tab, tab_sel);
                                            ImGui.PushStyleColor(ImGuiCol.Text, tab_sel_text);
                                            tab.sel = false;
                                        }
                                        else if (tab.msg)
                                        {
                                            ImGui.PushStyleColor(ImGuiCol.Tab, tab_ind);
                                            ImGui.PushStyleColor(ImGuiCol.Text, tab_ind_text);
                                        }
                                        else
                                        {
                                            ImGui.PushStyleColor(ImGuiCol.Tab, tab_norm);
                                            ImGui.PushStyleColor(ImGuiCol.Text, tab_norm_text);
                                        }



                                        if (ImGui.BeginTabItem(tab.Title))
                                        {
                                            tab.sel = true;

                                            float footer = (ImGui.GetStyle().ItemSpacing.Y) / 2 + ImGui.GetFrameHeightWithSpacing();
                                            if (!tab.FilterOn)
                                            {
                                                footer = 0;
                                            }
                                            ImGui.PushStyleVar(ImGuiStyleVar.ItemSpacing, new Num.Vector2(space_hor, space_ver));
                                            ImGui.BeginChild("scrolling", new Num.Vector2(0, -footer), false, chat_sub_window_flags);


                                            foreach (ChatText line in tab.Chat)
                                            {
                                                if (tab.FilterOn)
                                                {
                                                    if (ContainsText(line.Text, tab.Filter))
                                                    {
                                                        if (tab.Config[0])
                                                        {
                                                            if (fontShadow)
                                                            {
                                                                ShadowFont(line.Time + " ");
                                                            }
                                                            ImGui.TextColored(timeColour, line.Time + " "); ImGui.SameLine();
                                                        }
                                                        if (tab.Config[1] && tab.Chans[ConvertForArray(line.Channel)])
                                                        {
                                                            if (fontShadow)
                                                            {
                                                                ShadowFont(line.ChannelShort + " ");
                                                            }
                                                            ImGui.TextColored(chanColour[ConvertForArray(line.Channel)], line.ChannelShort + " "); ImGui.SameLine();
                                                        }
                                                        if (line.Sender.Length > 0)
                                                        {
                                                            if (fontShadow)
                                                            {
                                                                ShadowFont(line.Sender + ":");
                                                            }
                                                            ImGui.TextColored(nameColour, line.Sender + ":"); ImGui.SameLine();
                                                        }

                                                        int count = 0;
                                                        foreach (TextTypes textTypes in line.Text)
                                                        {
                                                            if (textTypes.Type == PayloadType.RawText)
                                                            {
                                                                ImGui.PushStyleColor(ImGuiCol.Text, logColour[line.ChannelColour]);
                                                                Wrap(textTypes.Text);
                                                                ImGui.PopStyleColor();
                                                            }

                                                            if (textTypes.Type == PayloadType.MapLink)
                                                            {
                                                                if (ImGui.GetContentRegionAvail().X - 5 - ImGui.CalcTextSize(textTypes.Text).X < 0)
                                                                {
                                                                    ImGui.Text("");
                                                                }
                                                                if (ImGui.SmallButton(textTypes.Text))
                                                                {
                                                                    this.pluginInterface.Framework.Gui.OpenMapWithMapLink((Dalamud.Game.Chat.SeStringHandling.Payloads.MapLinkPayload)textTypes.Payload);
                                                                }
                                                            }

                                                            if (count < (line.Text.Count - 1))
                                                            {
                                                                ImGui.SameLine(); count++;
                                                            }
                                                        }
                                                    }
                                                }
                                                else
                                                {
                                                    if (tab.Config[0])
                                                    {
                                                        if (fontShadow)
                                                        {
                                                            ShadowFont(line.Time + " ");
                                                        }
                                                        ImGui.TextColored(timeColour, line.Time + " "); ImGui.SameLine();
                                                    }
                                                    if (tab.Config[1] && tab.Chans[ConvertForArray(line.Channel)])
                                                    {
                                                        if (fontShadow)
                                                        {
                                                            ShadowFont(line.ChannelShort + " ");
                                                        }
                                                        ImGui.TextColored(chanColour[ConvertForArray(line.Channel)], line.ChannelShort + " "); ImGui.SameLine();
                                                    }
                                                    if (line.Sender.Length > 0)
                                                    {
                                                        if (fontShadow)
                                                        {
                                                            ShadowFont(line.Sender + ":");
                                                        }
                                                        ImGui.TextColored(nameColour, line.Sender + ":"); ImGui.SameLine();
                                                    }

                                                    int count = 0;
                                                    foreach (TextTypes textTypes in line.Text)
                                                    {
                                                        if (textTypes.Type == PayloadType.RawText)
                                                        {
                                                            ImGui.PushStyleColor(ImGuiCol.Text, logColour[line.ChannelColour]);
                                                            Wrap(textTypes.Text);
                                                            ImGui.PopStyleColor();
                                                        }

                                                        if (textTypes.Type == PayloadType.MapLink)
                                                        {
                                                            if (ImGui.GetContentRegionAvail().X - 5 - ImGui.CalcTextSize(textTypes.Text).X < 0)
                                                            {
                                                                ImGui.Text("");
                                                            }
                                                            if (ImGui.SmallButton(textTypes.Text))
                                                            {
                                                                this.pluginInterface.Framework.Gui.OpenMapWithMapLink((Dalamud.Game.Chat.SeStringHandling.Payloads.MapLinkPayload)textTypes.Payload);
                                                            }
                                                        }

                                                        if (count < (line.Text.Count - 1))
                                                        {
                                                            ImGui.SameLine();
                                                            count++;
                                                        }
                                                    }
                                                }
                                            }
                                            if (tab.Scroll == true)
                                            {
                                                ImGui.SetScrollHereY();
                                                tab.Scroll = false;
                                            }
                                            ImGui.PopStyleVar();
                                            ImGui.EndChild();

                                            if (tab.FilterOn)
                                            {
                                                ImGui.InputText("Filter Text", ref tab.Filter, 999);
                                                if (ImGui.IsItemHovered())
                                                {
                                                    ImGui.SetTooltip("Only show lines with this text.");
                                                }
                                            }

                                            if (no_mouse2 && !no_mouse)
                                            {
                                                Num.Vector2 vMin = ImGui.GetWindowContentRegionMin();
                                                Num.Vector2 vMax = ImGui.GetWindowContentRegionMax();

                                                vMin.X += ImGui.GetWindowPos().X;
                                                vMin.Y += ImGui.GetWindowPos().Y + 22;
                                                vMax.X += ImGui.GetWindowPos().X - 22;
                                                vMax.Y += ImGui.GetWindowPos().Y;

                                                if (ImGui.IsMouseHoveringRect(vMin, vMax))
                                                {
                                                    no_mouse = true; flickback = true;
                                                }
                                            }
                                            tab.msg = false;
                                            ImGui.EndTabItem();
                                        }
                                        ImGui.PopStyleColor();
                                        ImGui.PopStyleColor();
                                    }
                                    loop++;
                                }
                                ImGui.EndTabBar();
                                ImGui.End();
                            }
                        }
                    }
                    ImGui.PopFont();
                }
            }



            if (configWindow)
            {
                ImGui.SetNextWindowSize(new Num.Vector2(300, 500), ImGuiCond.FirstUseEver);
                ImGui.Begin("Chat Config", ref configWindow);
                ImGuiTabBarFlags tab_bar_flags = ImGuiTabBarFlags.None;

                float footer = (ImGui.GetStyle().ItemSpacing.Y) / 2 + ImGui.GetFrameHeightWithSpacing();
                ImGui.BeginChild("scrolling", new Num.Vector2(0, -footer), false);

                if (ImGui.BeginTabBar("Tabs", tab_bar_flags))
                {
                    if (ImGui.BeginTabItem("Config"))
                    {
                        ImGui.Text("");

                        ImGui.Columns(3);

                        ImGui.Checkbox("Show Chat Extender", ref chatWindow);
                        if (ImGui.IsItemHovered())
                        {
                            ImGui.SetTooltip("Enable/Disable the Chat Extender");
                        }
                        ImGui.NextColumn();
                        ImGui.Checkbox("Enable Translations", ref allowTranslation);
                        if (ImGui.IsItemHovered())
                        {
                            ImGui.SetTooltip("Enable Translations from JPN to ENG");
                        }
                        ImGui.NextColumn();
                        ImGui.Checkbox("Chat Bubbles", ref bubblesWindow);
                        if (ImGui.IsItemHovered())
                        {
                            ImGui.SetTooltip("Enable Chat Bubbles");
                        }
                        ImGui.NextColumn();

                        ImGui.Checkbox("24 Hour Time", ref hourTime);
                        if (ImGui.IsItemHovered())
                        {
                            ImGui.SetTooltip("Switch to 24 Hour (Military) time.");
                        }
                        ImGui.NextColumn();

                        //ImGui.Checkbox("Hide with FFXIV Chat", ref hideWithChat);
                        //if (ImGui.IsItemHovered()) { ImGui.SetTooltip("Spoopy"); }
                        ImGui.Text("");
                        ImGui.NextColumn();
                        ImGui.Text("");
                        ImGui.NextColumn();

                        ImGui.Checkbox("Hide Scrollbar", ref no_scrollbar);
                        if (ImGui.IsItemHovered())
                        {
                            ImGui.SetTooltip("Shows ScrollBar");
                        }
                        ImGui.NextColumn();
                        ImGui.Checkbox("Lock Window Position", ref no_move);
                        if (ImGui.IsItemHovered())
                        {
                            ImGui.SetTooltip("Lock/Unlock the position of the Chat Extender");
                        }
                        ImGui.NextColumn();
                        ImGui.Checkbox("Lock Window Size", ref no_resize);
                        if (ImGui.IsItemHovered())
                        {
                            ImGui.SetTooltip("Lock/Unlock the size of the Chat Extender");
                        }
                        ImGui.NextColumn();

                        ImGui.Checkbox("ClickThrough Tab Bar", ref no_mouse);
                        if (ImGui.IsItemHovered())
                        {
                            ImGui.SetTooltip("Enable/Disable being able to clickthrough the Tab Bar of the Chat Extender");
                        }
                        ImGui.NextColumn();
                        ImGui.Checkbox("ClickThrough Chat", ref no_mouse2);
                        if (ImGui.IsItemHovered())
                        {
                            ImGui.SetTooltip("Enable/Disable being able to clickthrough the Chat Extension chatbox");
                        }
                        ImGui.NextColumn();
                        ImGui.Text("");
                        ImGui.NextColumn();

                        ImGui.Columns(1);
                        ImGui.SliderFloat("Chat Extender Alpha", ref alpha, 0.001f, 0.999f);
                        if (ImGui.IsItemHovered())
                        {
                            ImGui.SetTooltip("Alter the Alpha of the Chat Extender");
                        }
                        ImGui.Text("");

                        ImGui.Text("");
                        ImGui.Text("Highlight Example");
                        HighlightText();
                        ImGui.InputText("##HighlightText", ref tempHigh, 999); if (ImGui.IsItemHovered())
                        {
                            ImGui.SetTooltip("Will highlight EXACT matches only. Seperate words with [,].");
                        }
                        ImGui.SameLine();
                        if (ImGui.Button("Apply"))
                        {
                            high.highlights = tempHigh.Split(',');
                        }
                        ImGui.Columns(4);
                        ImGui.SliderInt("Alpha", ref high.htA, 0, 255); ImGui.NextColumn();
                        ImGui.SliderInt("Blue", ref high.htB, 0, 255); ImGui.NextColumn();
                        ImGui.SliderInt("Green", ref high.htG, 0, 255); ImGui.NextColumn();
                        ImGui.SliderInt("Red", ref high.htR, 0, 255); ImGui.NextColumn();
                        ImGui.Columns(1);
                        ImGui.Text("");

                        ImGui.Columns(1);


                        ImGui.EndTabItem();
                    }


                    if (ImGui.BeginTabItem("Channels"))
                    {
                        ImGui.Columns(4);
                        ImGui.Text("Example"); ImGui.NextColumn();
                        ImGui.Text("Colour 1"); ImGui.NextColumn();
                        ImGui.Text("Colour 2"); ImGui.NextColumn();
                        ImGui.Text(""); ImGui.NextColumn();
                        ImGui.TextColored(timeColour, "[12:00]"); ImGui.NextColumn();
                        ImGui.ColorEdit4("Time Colour", ref timeColour, ImGuiColorEditFlags.NoInputs | ImGuiColorEditFlags.NoLabel); ImGui.NextColumn();
                        ImGui.Text(""); ImGui.NextColumn();
                        ImGui.Text(""); ImGui.NextColumn();
                        ImGui.TextColored(nameColour, "Player Names"); ImGui.NextColumn();
                        ImGui.ColorEdit4("Name Colour", ref nameColour, ImGuiColorEditFlags.NoInputs | ImGuiColorEditFlags.NoLabel); ImGui.NextColumn();
                        ImGui.Text(""); ImGui.NextColumn();
                        ImGui.Text(""); ImGui.NextColumn();
                        for (int i = 0; i < (Channels.Length); i++)
                        {
                            ImGui.InputText("##Tab Name" + i.ToString(), ref Chan[i], 99); ImGui.NextColumn();
                            ImGui.TextColored(chanColour[i], "[" + Channels[i] + "]"); ImGui.SameLine(); ImGui.TextColored(logColour[i], "Text"); ImGui.NextColumn();
                            ImGui.ColorEdit4(Channels[i] + " Colour1", ref chanColour[i], ImGuiColorEditFlags.NoInputs | ImGuiColorEditFlags.NoLabel); ImGui.NextColumn();
                            ImGui.ColorEdit4(Channels[i] + " Colour2", ref logColour[i], ImGuiColorEditFlags.NoInputs | ImGuiColorEditFlags.NoLabel); ImGui.NextColumn();
                        }
                        ImGui.Columns(1);
                        ImGui.EndTabItem();
                    }

                    if (ImGui.BeginTabItem("Tabs"))
                    {
                        if (ImGui.Button("Add New Tab"))
                        {
                            tempTitle = "New";

                            while (CheckDupe(items, tempTitle))
                            {
                                tempTitle += ".";
                            }

                            items.Add(new DynTab(tempTitle, new ConcurrentQueue <ChatText>(), true));
                            tempTitle = "Title";
                        }
                        if (ImGui.IsItemHovered())
                        {
                            ImGui.SetTooltip("Add a new Tab to the Chat Extender");
                        }

                        if (ImGui.TreeNode("Tab Order"))
                        {
                            ImGui.Columns(3);
                            ImGui.Text("Tab"); ImGui.NextColumn();
                            ImGui.Text(""); ImGui.NextColumn();
                            ImGui.Text(""); ImGui.NextColumn();

                            List <TabBase> temp_clone = new List <TabBase>();
                            temp_clone = CopyItems(items);
                            for (int i = 0; i < (items.Count); i++)
                            {
                                ImGui.Text(items[i].Title); ImGui.NextColumn();
                                if (i > 0)
                                {
                                    if (ImGui.Button("^##" + i.ToString()))
                                    {
                                        TabBase mover = temp_clone[i];
                                        temp_clone.RemoveAt(i);
                                        temp_clone.Insert(i - 1, mover);
                                    }
                                }
                                ImGui.NextColumn();
                                if (i < items.Count - 1)
                                {
                                    if (ImGui.Button("v##" + i.ToString()))
                                    {
                                        TabBase mover = temp_clone[i];
                                        temp_clone.RemoveAt(i);
                                        temp_clone.Insert(i + 1, mover);
                                    }
                                }
                                ImGui.NextColumn();
                            }
                            ImGui.Columns(1);
                            items = CopyItems(temp_clone);
                            ImGui.TreePop();
                        }

                        ImGui.Separator();
                        foreach (var tab in items)
                        {
                            if (tab.Enabled)
                            {
                                if (ImGui.TreeNode(tab.Title))
                                {
                                    float footer2 = (ImGui.GetStyle().ItemSpacing.Y) / 2 + ImGui.GetFrameHeightWithSpacing();
                                    ImGui.BeginChild("scrolling", new Num.Vector2(0, -footer2), false);
                                    ImGui.InputText("##Tab Name", ref tempTitle, bufSize);
                                    ImGui.SameLine();
                                    if (ImGui.Button("Set Tab Title"))
                                    {
                                        if (tempTitle.Length == 0)
                                        {
                                            tempTitle += ".";
                                        }

                                        while (CheckDupe(items, tempTitle))
                                        {
                                            tempTitle += ".";
                                        }

                                        tab.Title = tempTitle;
                                        tempTitle = "Title";
                                    }
                                    if (ImGui.IsItemHovered())
                                    {
                                        ImGui.SetTooltip("Change the title of the Tab");
                                    }

                                    ImGui.Columns(3);

                                    ImGui.Checkbox("Time Stamp", ref tab.Config[0]);
                                    if (ImGui.IsItemHovered())
                                    {
                                        ImGui.SetTooltip("Show Timestamps in this Tab");
                                    }
                                    ImGui.NextColumn();
                                    ImGui.Checkbox("Channel", ref tab.Config[1]);
                                    if (ImGui.IsItemHovered())
                                    {
                                        ImGui.SetTooltip("Show the Channel the message came from");
                                    }
                                    ImGui.NextColumn();
                                    ImGui.Checkbox("Translate", ref tab.Config[2]);
                                    if (ImGui.IsItemHovered())
                                    {
                                        ImGui.SetTooltip("Enable Japanese -> English translation");
                                    }
                                    ImGui.NextColumn();

                                    ImGui.Checkbox("AutoScroll", ref tab.AutoScroll);
                                    if (ImGui.IsItemHovered())
                                    {
                                        ImGui.SetTooltip("Enable the Chat to scroll automatically on a new message");
                                    }
                                    ImGui.NextColumn();
                                    ImGui.Checkbox("Save to file", ref tab.Config[3]);
                                    if (ImGui.IsItemHovered())
                                    {
                                        ImGui.SetTooltip("Write this tab to '\\My Documents\\FFXIV_ChatExtender\\Logs\\<YYYYMMDD>_TAB.txt");
                                    }
                                    ImGui.NextColumn();
                                    ImGui.Checkbox("Enable Filter", ref tab.FilterOn);
                                    if (ImGui.IsItemHovered())
                                    {
                                        ImGui.SetTooltip("Enable Filtering of text");
                                    }
                                    ImGui.NextColumn();

                                    ImGui.Columns(1);

                                    ImGui.Text("");


                                    //TODO: Add a confirm prompt

                                    if (EnabledTabs(items) > 1)
                                    {
                                        if (ImGui.Button("Delete Tab"))
                                        {
                                            tab.Enabled = false;
                                        }
                                    }
                                    if (ImGui.IsItemHovered())
                                    {
                                        ImGui.SetTooltip("Removes Tab");
                                    }



                                    ImGui.Columns(2);
                                    ImGui.Text("Channel"); ImGui.NextColumn();
                                    if (tab.Config[1])
                                    {
                                        ImGui.Text("Show Short");
                                    }
                                    else
                                    {
                                        ImGui.Text("");
                                    }
                                    ImGui.NextColumn();

                                    for (int i = 0; i < (Channels.Length); i++)
                                    {
                                        ImGui.PushStyleColor(ImGuiCol.Text, chanColour[i]);
                                        ImGui.Checkbox("[" + Channels[i] + "]", ref tab.Logs[i]); ImGui.NextColumn();
                                        if (tab.Config[1])
                                        {
                                            ImGui.Checkbox(Chan[i], ref tab.Chans[i]);
                                        }
                                        else
                                        {
                                            ImGui.Text("");
                                        }
                                        ImGui.NextColumn();
                                        ImGui.PopStyleColor();
                                    }
                                    ImGui.Columns(1);
                                    ImGui.EndChild();
                                    ImGui.TreePop();
                                }
                            }
                        }
                        ImGui.EndTabItem();
                    }

                    if (allowTranslation)
                    {
                        if (ImGui.BeginTabItem("Translator"))
                        {
                            ImGui.Checkbox("Inject Translation", ref injectChat);
                            if (ImGui.IsItemHovered())
                            {
                                ImGui.SetTooltip("Inject translated text into the normal FFXIV Chatbox");
                            }

                            ImGui.Text("Surrounds of Translated text");
                            ImGui.PushItemWidth(24);
                            ImGui.InputText("##Left", ref lTr, 3); ImGui.SameLine();
                            if (ImGui.IsItemHovered())
                            {
                                ImGui.SetTooltip("Alter the characters on the left of Translated text");
                            }
                            ImGui.PopItemWidth();
                            ImGui.Text("Translation"); ImGui.SameLine();
                            ImGui.PushItemWidth(24);
                            ImGui.InputText("##Right", ref rTr, 3);
                            if (ImGui.IsItemHovered())
                            {
                                ImGui.SetTooltip("Alter the characters on the right of Translated text");
                            }
                            ImGui.PopItemWidth();
                            ImGui.Text("");
                            ImGui.EndTabItem();

                            ImGui.InputText("Yandex Key", ref yandex, 999);
                            if (ImGui.IsItemHovered())
                            {
                                ImGui.SetTooltip("Key to allow the translator to use the Yandex service");
                            }

                            ImGui.Text("Translator");
                            if (translator == 1)
                            {
                                ImGui.Text("[Google] is set.");
                                if (ImGui.Button("Switch to Yandex"))
                                {
                                    translator = 2;
                                }
                            }

                            if (translator == 2)
                            {
                                ImGui.Text("[Yandex] is set.");
                                if (ImGui.Button("Switch to Google"))
                                {
                                    translator = 1;
                                }
                            }
                            ImGui.EndTabItem();
                        }
                    }

                    if (ImGui.BeginTabItem("Font"))
                    {
                        ImGui.Columns(3);
                        ImGui.PushItemWidth(124);
                        ImGui.InputInt("H Space", ref space_hor);
                        ImGui.PopItemWidth();
                        if (ImGui.IsItemHovered())
                        {
                            ImGui.SetTooltip("Horizontal spacing of chat text");
                        }
                        ImGui.NextColumn();
                        ImGui.PushItemWidth(124);
                        ImGui.InputInt("V Space", ref space_ver);
                        ImGui.PopItemWidth();
                        if (ImGui.IsItemHovered())
                        {
                            ImGui.SetTooltip("Vertical spacing of cha text");
                        }
                        ImGui.NextColumn();
                        ImGui.Text("");
                        ImGui.NextColumn();
                        ImGui.Columns(1);
                        ImGui.PushItemWidth(124);
                        ImGui.InputInt("Font Size", ref fontsize); ImGui.SameLine();
                        ImGui.PopItemWidth();
                        if (ImGui.SmallButton("Apply"))
                        {
                            UpdateFont();
                        }
                        ImGui.Checkbox("Font Shadow", ref fontShadow);
                        if (ImGui.IsItemHovered())
                        {
                            ImGui.SetTooltip("WARNING! This is a large tax on processing.\nIf you encounter slowdown, disable this!");
                        }
                        ImGui.EndTabItem();
                    }
                    if (bubblesWindow)
                    {
                        if (ImGui.BeginTabItem("Bubbles"))
                        {
                            ImGui.Columns(3);
                            //ImGui.Checkbox("Debug", ref drawDebug);
                            ImGui.Checkbox("Displacement Up", ref boolUp); ImGui.NextColumn();
                            if (ImGui.IsItemHovered())
                            {
                                ImGui.SetTooltip("When bubbles collide, move the newest one Up instead of Down.");
                            }
                            //ImGui.InputFloat("MinH", ref minH);
                            //ImGui.InputFloat("MaxH", ref maxH);
                            ImGui.Checkbox("Show Channel", ref bubblesChannel); ImGui.NextColumn();
                            if (ImGui.IsItemHovered())
                            {
                                ImGui.SetTooltip("Show Channel in the bubble.");
                            }
                            ImGui.PushItemWidth(80);
                            ImGui.InputInt("Duration", ref bubbleTime);
                            ImGui.PopItemWidth(); ImGui.NextColumn();
                            if (ImGui.IsItemHovered())
                            {
                                ImGui.SetTooltip("Seconds the bubbles exist for.");
                            }
                            //ImGui.InputInt("X Disp", ref xDisp);
                            //ImGui.InputInt("Y Disp", ref yDisp);
                            //ImGui.InputInt("X Cut", ref xCut);
                            //ImGui.InputInt("Y Cut", ref yCut);
                            //ImGui.ColorEdit4("Bubble Colour", ref bubbleColor, ImGuiColorEditFlags.NoInputs | ImGuiColorEditFlags.NoLabel);
                            //ImGui.InputFloat("Rounding", ref bubbleRounding);
                            ImGui.Separator();
                            ImGui.Text("Channel"); ImGui.NextColumn();
                            ImGui.Text("Enabled"); ImGui.NextColumn();
                            ImGui.Text("Colour"); ImGui.NextColumn();
                            for (int i = 0; i < (Channels.Length); i++)
                            {
                                ImGui.Text(Channels[i]); ImGui.SameLine(); ImGui.NextColumn();
                                ImGui.Checkbox("##" + Channels[i], ref bubbleEnable[i]); ImGui.NextColumn();
                                ImGui.ColorEdit4(Channels[i] + " ColourBubble", ref bubbleColour[i], ImGuiColorEditFlags.NoInputs | ImGuiColorEditFlags.NoLabel); ImGui.NextColumn();
                            }
                            ImGui.Columns(1);
                            ImGui.EndTabItem();
                        }
                    }
                }

                ImGui.EndTabBar();
                ImGui.EndChild();

                if (ImGui.Button("Save and Close Config"))
                {
                    SaveConfig();

                    configWindow = false;
                }
                if (ImGui.IsItemHovered())
                {
                    ImGui.SetTooltip("Changes will only be saved for the current session unless you do this!");
                }
                ImGui.End();
            }
        }
Exemplo n.º 4
0
        private static unsafe void SubmitUI()
        {
            // Demo code adapted from the official Dear ImGui demo program:
            // https://github.com/ocornut/imgui/blob/master/examples/example_win32_directx11/main.cpp#L172

            // 1. Show a simple window.
            // Tip: if we don't call ImGui.BeginWindow()/ImGui.EndWindow() the widgets automatically appears in a window called "Debug".
            {
                ImGui.Text("Hello, world!");                                     // Display some text (you can use a format string too)
                ImGui.SliderFloat("float", ref _f, 0, 1, _f.ToString("0.000"));  // Edit 1 float using a slider from 0.0f to 1.0f
                //ImGui.ColorEdit3("clear color", ref _clearColor);                   // Edit 3 floats representing a color

                ImGui.Text($"Mouse position: {ImGui.GetMousePos()}");

                ImGui.Checkbox("Demo Window", ref _showDemoWindow);                 // Edit bools storing our windows open/close state
                ImGui.Checkbox("Another Window", ref _showAnotherWindow);
                ImGui.Checkbox("Memory Editor", ref _showMemoryEditor);
                if (ImGui.Button("Button"))                                         // Buttons return true when clicked (NB: most widgets return true when edited/activated)
                {
                    _counter++;
                }
                ImGui.SameLine(0, -1);
                ImGui.Text($"counter = {_counter}");

                ImGui.DragInt("Draggable Int", ref _dragInt);

                float framerate = ImGui.GetIO().Framerate;
                ImGui.Text($"Application average {1000.0f / framerate:0.##} ms/frame ({framerate:0.#} FPS)");
            }

            // 2. Show another simple window. In most cases you will use an explicit Begin/End pair to name your windows.
            if (_showAnotherWindow)
            {
                ImGui.Begin("Another Window", ref _showAnotherWindow);
                ImGui.Text("Hello from another window!");
                if (ImGui.Button("Close Me"))
                {
                    _showAnotherWindow = false;
                }
                ImGui.End();
            }

            // 3. Show the ImGui demo window. Most of the sample code is in ImGui.ShowDemoWindow(). Read its code to learn more about Dear ImGui!
            if (_showDemoWindow)
            {
                // Normally user code doesn't need/want to call this because positions are saved in .ini file anyway.
                // Here we just want to make the demo initial state a bit more friendly!
                ImGui.SetNextWindowPos(new Vector2(650, 20), ImGuiCond.FirstUseEver);
                ImGui.ShowDemoWindow(ref _showDemoWindow);
            }

            if (ImGui.TreeNode("Tabs"))
            {
                if (ImGui.TreeNode("Basic"))
                {
                    ImGuiTabBarFlags tab_bar_flags = ImGuiTabBarFlags.None;
                    if (ImGui.BeginTabBar("MyTabBar", tab_bar_flags))
                    {
                        if (ImGui.BeginTabItem("Avocado"))
                        {
                            ImGui.Text("This is the Avocado tab!\nblah blah blah blah blah");
                            ImGui.EndTabItem();
                        }
                        if (ImGui.BeginTabItem("Broccoli"))
                        {
                            ImGui.Text("This is the Broccoli tab!\nblah blah blah blah blah");
                            ImGui.EndTabItem();
                        }
                        if (ImGui.BeginTabItem("Cucumber"))
                        {
                            ImGui.Text("This is the Cucumber tab!\nblah blah blah blah blah");
                            ImGui.EndTabItem();
                        }
                        ImGui.EndTabBar();
                    }
                    ImGui.Separator();
                    ImGui.TreePop();
                }

                if (ImGui.TreeNode("Advanced & Close Button"))
                {
                    // Expose a couple of the available flags. In most cases you may just call BeginTabBar() with no flags (0).
                    ImGui.CheckboxFlags("ImGuiTabBarFlags_Reorderable", ref s_tab_bar_flags, (uint)ImGuiTabBarFlags.Reorderable);
                    ImGui.CheckboxFlags("ImGuiTabBarFlags_AutoSelectNewTabs", ref s_tab_bar_flags, (uint)ImGuiTabBarFlags.AutoSelectNewTabs);
                    ImGui.CheckboxFlags("ImGuiTabBarFlags_NoCloseWithMiddleMouseButton", ref s_tab_bar_flags, (uint)ImGuiTabBarFlags.NoCloseWithMiddleMouseButton);
                    if ((s_tab_bar_flags & (uint)ImGuiTabBarFlags.FittingPolicyMask) == 0)
                    {
                        s_tab_bar_flags |= (uint)ImGuiTabBarFlags.FittingPolicyDefault;
                    }
                    if (ImGui.CheckboxFlags("ImGuiTabBarFlags_FittingPolicyResizeDown", ref s_tab_bar_flags, (uint)ImGuiTabBarFlags.FittingPolicyResizeDown))
                    {
                        s_tab_bar_flags &= ~((uint)ImGuiTabBarFlags.FittingPolicyMask ^ (uint)ImGuiTabBarFlags.FittingPolicyResizeDown);
                    }
                    if (ImGui.CheckboxFlags("ImGuiTabBarFlags_FittingPolicyScroll", ref s_tab_bar_flags, (uint)ImGuiTabBarFlags.FittingPolicyScroll))
                    {
                        s_tab_bar_flags &= ~((uint)ImGuiTabBarFlags.FittingPolicyMask ^ (uint)ImGuiTabBarFlags.FittingPolicyScroll);
                    }

                    // Tab Bar
                    string[] names = { "Artichoke", "Beetroot", "Celery", "Daikon" };

                    for (int n = 0; n < s_opened.Length; n++)
                    {
                        if (n > 0)
                        {
                            ImGui.SameLine();
                        }
                        ImGui.Checkbox(names[n], ref s_opened[n]);
                    }

                    // Passing a bool* to BeginTabItem() is similar to passing one to Begin(): the underlying bool will be set to false when the tab is closed.
                    if (ImGui.BeginTabBar("MyTabBar", (ImGuiTabBarFlags)s_tab_bar_flags))
                    {
                        for (int n = 0; n < s_opened.Length; n++)
                        {
                            if (s_opened[n] && ImGui.BeginTabItem(names[n], ref s_opened[n]))
                            {
                                ImGui.Text($"This is the {names[n]} tab!");
                                if ((n & 1) != 0)
                                {
                                    ImGui.Text("I am an odd tab.");
                                }
                                ImGui.EndTabItem();
                            }
                        }
                        ImGui.EndTabBar();
                    }
                    ImGui.Separator();
                    ImGui.TreePop();
                }
                ImGui.TreePop();
            }

            ImGuiIOPtr io = ImGui.GetIO();

            SetThing(out io.DeltaTime, 2f);

            if (_showMemoryEditor)
            {
                _memoryEditor.Draw("Memory Editor", _memoryEditorData, _memoryEditorData.Length);
            }
        }
Exemplo n.º 5
0
        private void RenderUI()
        {
            ImGuiWindowFlags chat_window_flags     = 0;
            ImGuiWindowFlags chat_sub_window_flags = 0;

            if (no_titlebar)
            {
                chat_window_flags |= ImGuiWindowFlags.NoTitleBar;
            }
            if (no_collapse)
            {
                chat_window_flags |= ImGuiWindowFlags.NoCollapse;
            }
            if (!no_menu)
            {
                chat_window_flags |= ImGuiWindowFlags.MenuBar;
            }
            if (no_nav)
            {
                chat_window_flags |= ImGuiWindowFlags.NoNav;
            }

            if (config.NoScrollBar)
            {
                chat_window_flags |= ImGuiWindowFlags.NoScrollbar;
            }
            if (config.NoScrollBar)
            {
                chat_sub_window_flags |= ImGuiWindowFlags.NoScrollbar;
            }
            if (config.NoMove)
            {
                chat_window_flags |= ImGuiWindowFlags.NoMove;
            }
            if (config.NoResize)
            {
                chat_window_flags |= ImGuiWindowFlags.NoResize;
            }
            if (config.NoMouse)
            {
                chat_window_flags |= ImGuiWindowFlags.NoMouseInputs;
            }
            if (config.NoMouse2)
            {
                chat_sub_window_flags |= ImGuiWindowFlags.NoMouseInputs;
            }

            if (fontsLoaded)
            {
                if (hideWithChat && Alpha != 0)
                {
                    if (config.ShowChatWindow)
                    {
                        if (flickback)
                        {
                            config.NoMouse = false;
                            flickback      = false;
                        }
                        ImGui.SetNextWindowSize(new Vector2(200, 100), ImGuiCond.FirstUseEver);
                        ImGui.SetNextWindowBgAlpha(config.Alpha);
                        ImGui.Begin("Another Window", ref config.ShowChatWindow, chat_window_flags);
                        ImGuiTabBarFlags tab_bar_flags = ImGuiTabBarFlags.None;

                        if (ImGui.BeginTabBar("Tabs", tab_bar_flags))
                        {
                            foreach (var tab in tabs)
                            {
                                if (ImGui.BeginTabItem(tab.Title))
                                {
                                    if (tab != activeTab)
                                    {
                                        activeTab = tab;
                                    }

                                    var prevWindowSize = windowSize;
                                    windowSize = ImGui.GetContentRegionMax();

                                    if (windowSize != prevWindowSize)
                                    {
                                        tab.needsRecomputeCumulativeLengths = true;
                                    }

                                    ImGui.PushStyleVar(ImGuiStyleVar.ItemSpacing, new Vector2(0, 0));

                                    RenderChatArea(tab, chat_sub_window_flags);

                                    ImGui.PopStyleVar();

                                    if (config.NoMouse2 && !config.NoMouse)
                                    {
                                        Vector2 vMin = ImGui.GetWindowContentRegionMin();
                                        Vector2 vMax = ImGui.GetWindowContentRegionMax();

                                        vMin.X += ImGui.GetWindowPos().X;
                                        vMin.Y += ImGui.GetWindowPos().Y + 22;
                                        vMax.X += ImGui.GetWindowPos().X - 22;
                                        vMax.Y += ImGui.GetWindowPos().Y;

                                        if (ImGui.IsMouseHoveringRect(vMin, vMax))
                                        {
                                            config.NoMouse = true; flickback = true;
                                        }
                                    }
                                    tab.msg = false;
                                    ImGui.EndTabItem();
                                }
                            }
                            ImGui.EndTabBar();
                            ImGui.End();
                        }
                    }
                }
            }

            RenderConfigWindow();
        }
Exemplo n.º 6
0
        private void RenderConfigWindow()
        {
            if (configWindow)
            {
                ImGui.SetNextWindowSize(new Vector2(300, 500), ImGuiCond.FirstUseEver);
                ImGui.Begin("Chat Config", ref configWindow);
                ImGuiTabBarFlags tab_bar_flags = ImGuiTabBarFlags.None;

                float footer = (ImGui.GetStyle().ItemSpacing.Y) / 2 + ImGui.GetFrameHeightWithSpacing();

                if (ImGui.BeginTabBar("Tabs", tab_bar_flags))
                {
                    if (ImGui.BeginTabItem("Config"))
                    {
                        ImGui.BeginChild("scrolling", new Vector2(0, -footer), false);

                        ImGui.SetCursorPosY(ImGui.GetCursorPosY() + 10);

                        ImGui.Columns(3);

                        ImGui.Checkbox("Show Chat Extender", ref config.ShowChatWindow);
                        if (ImGui.IsItemHovered())
                        {
                            ImGui.SetTooltip("Enable/Disable the Chat Extender");
                        }
                        ImGui.NextColumn();
                        ImGui.Checkbox("24 Hour Time", ref config.HourTime);
                        if (ImGui.IsItemHovered())
                        {
                            ImGui.SetTooltip("Switch to 24 Hour (Military) time.");
                        }
                        ImGui.NextColumn();
                        ImGui.Checkbox("Hide Scrollbar", ref config.NoScrollBar);
                        if (ImGui.IsItemHovered())
                        {
                            ImGui.SetTooltip("Shows ScrollBar");
                        }
                        ImGui.NextColumn();

                        ImGui.Checkbox("Lock Window Position", ref config.NoMove);
                        if (ImGui.IsItemHovered())
                        {
                            ImGui.SetTooltip("Lock/Unlock the position of the Chat Extender");
                        }
                        ImGui.NextColumn();
                        ImGui.Checkbox("Lock Window Size", ref config.NoResize);
                        if (ImGui.IsItemHovered())
                        {
                            ImGui.SetTooltip("Lock/Unlock the size of the Chat Extender");
                        }
                        ImGui.NextColumn();
                        ImGui.NextColumn();
                        ImGui.Checkbox("ClickThrough Tab Bar", ref config.NoMouse);
                        if (ImGui.IsItemHovered())
                        {
                            ImGui.SetTooltip("Enable/Disable being able to clickthrough the Tab Bar of the Chat Extender");
                        }
                        ImGui.NextColumn();
                        ImGui.Checkbox("ClickThrough Chat", ref config.NoMouse2);
                        if (ImGui.IsItemHovered())
                        {
                            ImGui.SetTooltip("Enable/Disable being able to clickthrough the Chat Extension chatbox");
                        }


                        ImGui.Columns(1);

                        ImGui.SetCursorPosY(ImGui.GetCursorPosY() + 30);
                        ImGui.SliderFloat("Chat Extender Alpha", ref config.Alpha, 0.001f, 0.999f);
                        if (ImGui.IsItemHovered())
                        {
                            ImGui.SetTooltip("Alter the Alpha of the Chat Extender");
                        }

                        ImGui.SetCursorPosY(ImGui.GetCursorPosY() + 50);
                        ImGui.Checkbox("Debug", ref debug);
                        if (debug)
                        {
                            ImGui.Checkbox("Output Error Json", ref outputErrorJsons);
                            ImGui.Checkbox("Output All Json", ref outputAllJsons);
                            ImGui.Text($"Lines in chat buffer: {chatBuffer.Count()}");
                            ImGui.Text($"Lines in current filter: {activeTab.FilteredLogs.Count()}");
                        }

                        ImGui.EndChild();
                        ImGui.EndTabItem();
                    }

                    if (ImGui.BeginTabItem("Channels"))
                    {
                        ImGui.BeginChild("scrolling", new Vector2(0, -footer), false);
                        ImGui.Columns(4);
                        ImGui.Text("Setting"); ImGui.NextColumn();
                        ImGui.Text("Example"); ImGui.NextColumn();
                        ImGui.Text("Color 1"); ImGui.NextColumn();
                        ImGui.Text("Color 2"); ImGui.NextColumn();

                        ImGui.SetCursorPosY(ImGui.GetCursorPosY() + 10); ImGui.NextColumn();
                        ImGui.SetCursorPosY(ImGui.GetCursorPosY() + 10); ImGui.NextColumn();
                        ImGui.SetCursorPosY(ImGui.GetCursorPosY() + 10); ImGui.NextColumn();
                        ImGui.SetCursorPosY(ImGui.GetCursorPosY() + 10); ImGui.NextColumn();

                        ImGui.Text("Time"); ImGui.NextColumn();

                        var cursorPos = ImGui.GetCursorPos();
                        ImGui.PushFont(outlineFont);
                        ImGui.TextColored(config.TimeShadowColor, "[12:00]");
                        ImGui.PopFont();

                        ImGui.SetCursorPos(cursorPos);
                        ImGui.PushFont(font);
                        ImGui.TextColored(config.TimeColor, "[12:00]");
                        ImGui.PopFont();

                        ImGui.NextColumn();


                        ImGui.ColorEdit4("Time Color", ref config.TimeColorRef.Color, ImGuiColorEditFlags.NoInputs | ImGuiColorEditFlags.NoLabel); ImGui.NextColumn();

                        ImGui.ColorEdit4("Time Outline Color", ref config.TimeColorShadowRef.Color, ImGuiColorEditFlags.NoInputs | ImGuiColorEditFlags.NoLabel); ImGui.NextColumn();

                        foreach (var key in ChannelSettingsTable.Keys)
                        {
                            var channelSettings = ChannelSettingsTable[key];
                            ImGui.PushItemWidth(50);
                            ImGui.InputText(channelSettings.Name, ref channelSettings.ShortName, 8); ImGui.NextColumn();
                            ImGui.PopItemWidth();

                            cursorPos = ImGui.GetCursorPos();
                            ImGui.PushFont(outlineFont);
                            ImGui.TextColored(channelSettings.OutlineColor, "[" + channelSettings.Name + "]");
                            ImGui.PopFont();
                            ImGui.SetCursorPos(cursorPos);

                            ImGui.PushFont(font);
                            ImGui.TextColored(channelSettings.FontColor, "[" + channelSettings.Name + "]"); ImGui.NextColumn();
                            ImGui.PopFont();

                            ImGui.ColorEdit4(channelSettings.Name + " Font Color", ref channelSettings.FontColorRef.Color, ImGuiColorEditFlags.NoInputs | ImGuiColorEditFlags.NoLabel); ImGui.NextColumn();
                            ImGui.ColorEdit4(channelSettings.Name + " Outline Color", ref channelSettings.OutlineColorRef.Color, ImGuiColorEditFlags.NoInputs | ImGuiColorEditFlags.NoLabel); ImGui.NextColumn();
                        }

                        ImGui.Columns(1);
                        ImGui.EndChild();
                        ImGui.EndTabItem();
                    }

                    if (ImGui.BeginTabItem("Tabs"))
                    {
                        ImGui.BeginChild("scrolling", new Vector2(0, -footer), false);
                        if (ImGui.Button("Add New Tab"))
                        {
                            int i = 1;
                            while (tabs.Any(x => x.Title == $"New Tab ({i})"))
                            {
                                i++;
                            }

                            tabs.Add(new TabBase
                            {
                                Title   = $"New Tab ({i})",
                                Enabled = true
                            });
                            tempTitle = "Title";
                        }
                        if (ImGui.IsItemHovered())
                        {
                            ImGui.SetTooltip("Add a new Tab to the Chat Extender");
                        }

                        if (ImGui.TreeNode("Tab Order"))
                        {
                            ImGui.Columns(3);
                            ImGui.Text("Tab"); ImGui.NextColumn();
                            ImGui.Text(""); ImGui.NextColumn();
                            ImGui.Text(""); ImGui.NextColumn();

                            for (int i = 0; i < tabs.Count; i++)
                            {
                                ImGui.Text(tabs[i].Title); ImGui.NextColumn();
                                if (i > 0)
                                {
                                    if (ImGui.Button("^##" + i.ToString()))
                                    {
                                        TabBase temp = tabs[i];
                                        tabs.RemoveAt(i);
                                        tabs.Insert(i - 1, temp);
                                    }
                                }
                                ImGui.NextColumn();
                                if (i < tabs.Count - 1)
                                {
                                    if (ImGui.Button("v##" + i.ToString()))
                                    {
                                        TabBase temp = tabs[i];
                                        tabs.RemoveAt(i);
                                        tabs.Insert(i + 1, temp);
                                    }
                                }
                                ImGui.NextColumn();
                            }
                            ImGui.Columns(1);
                            ImGui.TreePop();
                        }

                        ImGui.Separator();
                        foreach (var tab in tabs)
                        {
                            if (ImGui.TreeNode(tab.Title))
                            {
                                float footer2 = (ImGui.GetStyle().ItemSpacing.Y) / 2 + ImGui.GetFrameHeightWithSpacing();
                                ImGui.BeginChild("scrolling", new Vector2(0, -footer2), false);
                                ImGui.InputText("##Tab Name", ref tempTitle, bufSize);
                                ImGui.SameLine();
                                if (ImGui.Button("Set Tab Title"))
                                {
                                    if (tempTitle.Length == 0)
                                    {
                                        tempTitle += ".";
                                    }

                                    while (CheckDupe(tabs, tempTitle))
                                    {
                                        tempTitle += ".";
                                    }

                                    tab.Title = tempTitle;
                                    tempTitle = "Title";
                                }
                                if (ImGui.IsItemHovered())
                                {
                                    ImGui.SetTooltip("Change the title of the Tab");
                                }

                                ImGui.Columns(4);

                                ImGui.Checkbox("Time Stamp", ref tab.Timestamps);
                                if (ImGui.IsItemHovered())
                                {
                                    ImGui.SetTooltip("Show Timestamps in this Tab");
                                }
                                ImGui.NextColumn();
                                ImGui.Checkbox("Channel", ref tab.ShowChannelTagAll);
                                if (ImGui.IsItemHovered())
                                {
                                    ImGui.SetTooltip("Show the Channel the message came from");
                                }
                                ImGui.NextColumn();
                                ImGui.Checkbox("AutoScroll", ref tab.AutoScroll);
                                if (ImGui.IsItemHovered())
                                {
                                    ImGui.SetTooltip("Enable the Chat to scroll automatically on a new message");
                                }
                                ImGui.NextColumn();
                                if (ImGui.Checkbox("Enable Filter", ref tab.FilterOn))
                                {
                                    tab.UpdateFilteredLines();
                                }
                                if (ImGui.IsItemHovered())
                                {
                                    ImGui.SetTooltip("Enable Filtering of text");
                                }
                                ImGui.NextColumn();
                                ImGui.Columns(1);


                                //TODO: Add a confirm prompt

                                if (tabs.Count > 1)
                                {
                                    if (ImGui.Button("Delete Tab"))
                                    {
                                        tab.Enabled = false;
                                        tabs        = tabs.Where(x => x.Enabled).ToList();
                                        if (!activeTab.Enabled)
                                        {
                                            activeTab = tabs[0];
                                        }
                                    }
                                }
                                if (ImGui.IsItemHovered())
                                {
                                    ImGui.SetTooltip("Removes Tab");
                                }


                                ImGui.Columns(2);
                                ImGui.Text("Channel"); ImGui.NextColumn();
                                if (tab.ShowChannelTagAll)
                                {
                                    ImGui.Text("Show Short");
                                }
                                else
                                {
                                    ImGui.Text("");
                                }
                                ImGui.NextColumn();

                                foreach (var channelId in ChannelSettingsTable.Keys)
                                {
                                    var channelSettings = ChannelSettingsTable[channelId];
                                    var channelName     = channelSettings.Name;

                                    ImGui.PushStyleColor(ImGuiCol.Text, channelSettings.FontColor);

                                    if (ImGui.Checkbox("[" + channelSettings.Name + "]", ref tab.EnabledChannels[channelName].Value) && tab == activeTab)
                                    {
                                        tab.UpdateFilteredLines();
                                    }
                                    ImGui.NextColumn();

                                    if (tab.ShowChannelTagAll)
                                    {
                                        if (ImGui.Checkbox(channelSettings.ShortName, ref tab.ShowChannelTag[channelSettings.Name].Value))
                                        {
                                            tab.needsRecomputeCumulativeLengths = true;
                                        }
                                    }
                                    else
                                    {
                                        ImGui.Text("");
                                    }
                                    ImGui.NextColumn();

                                    ImGui.PopStyleColor();
                                }

                                ImGui.Columns(1);
                                ImGui.EndChild();
                                ImGui.TreePop();
                            }
                        }
                        ImGui.EndChild();
                        ImGui.EndTabItem();
                    }

                    if (ImGui.BeginTabItem("Font"))
                    {
                        ImGui.BeginChild("scrolling", new Vector2(0, -footer), false);
                        ImGui.Columns(1);
                        ImGui.PushItemWidth(124);
                        ImGui.InputFloat("Font Size", ref config.FontSize); ImGui.SameLine();
                        ImGui.PopItemWidth();
                        if (ImGui.SmallButton("Apply"))
                        {
                            UpdateFonts();
                        }

                        ImGui.EndChild();
                        ImGui.EndTabItem();
                    }

                    if (debug)
                    {
                        if (ImGui.BeginTabItem("Style Editor"))
                        {
                            ImGui.BeginChild("scrolling", new Vector2(0, -footer), false);
                            ImGui.ShowStyleEditor();
                            ImGui.EndChild();
                            ImGui.EndTabItem();
                        }
                    }
                }

                ImGui.EndTabBar();

                if (ImGui.Button("Save and Close Config"))
                {
                    SaveConfig();

                    configWindow = false;
                }
                if (ImGui.IsItemHovered())
                {
                    ImGui.SetTooltip("Changes will only be saved for the current session unless you do this!");
                }
                ImGui.End();
            }
        }
Exemplo n.º 7
0
        private static bool DrawCooldownTriggers(Configuration config, float scale, IEnumerable <ClassJob> jobs,
                                                 IReadOnlyCollection <FFXIVAction> allActions)
        {
            var changed = false;
            const FontAwesomeIcon dragDropMarker = FontAwesomeIcon.Sort;

            //if (!ImGui.CollapsingHeader("Cooldown Triggers (work only in combat)", ImGuiTreeNodeFlags.DefaultOpen)) return changed;
            ImGui.AlignTextToFramePadding();
            ImGui.Text("Only working in combat. Ordered by priority; to swap, Drag'n'Drop on");
            ImGui.SameLine();
            ImGui.PushFont(UiBuilder.IconFont);
            ImGui.Text(dragDropMarker.ToIconString());
            ImGui.PopFont();
            if (ImGui.Button("Add new Cooldown Trigger"))
            {
                var lastTrigger = config.CooldownTriggers.LastOrDefault();
                var firstAction =
                    allActions.First(a => a.ClassJobCategory.Value.HasClass(_currentJobTabId));
                config.CooldownTriggers.Add(
                    new CooldownTrigger(
                        _currentJobTabId,
                        firstAction.Name,
                        firstAction.RowId,
                        firstAction.CooldownGroup,
                        lastTrigger?.Priority + 1 ?? 0,
                        config.Patterns.FirstOrDefault() ?? new VibrationPattern()
                        ));
                changed = true;
            }

            int[] toSwap          = { 0, 0 };
            var   toRemoveTrigger = new List <CooldownTrigger>();

            const ImGuiTabBarFlags tabBarFlags = ImGuiTabBarFlags.Reorderable
                                                 | ImGuiTabBarFlags.TabListPopupButton
                                                 | ImGuiTabBarFlags.FittingPolicyScroll;

            if (ImGui.BeginTabBar("JobsTabs", tabBarFlags))
            {
                foreach (var job in jobs)
                {
                    changed |= DrawJobTabItem(config, scale, allActions, dragDropMarker, job, toSwap, toRemoveTrigger);
                }

                ImGui.EndTabBar();
            }

            if (toSwap[0] != toSwap[1])
            {
                var t = config.CooldownTriggers[toSwap[0]];
                config.CooldownTriggers[toSwap[0]]          = config.CooldownTriggers[toSwap[1]];
                config.CooldownTriggers[toSwap[1]]          = t;
                config.CooldownTriggers[toSwap[0]].Priority = toSwap[0];
                config.CooldownTriggers[toSwap[1]].Priority = toSwap[1];
                toSwap[0] = toSwap[1] = 0;
                changed   = true;
            }

            foreach (var trigger in toRemoveTrigger)
            {
                config.CooldownTriggers.Remove(trigger);
            }

            if (toRemoveTrigger.Count > 0)
            {
                for (var i = 0; i < config.CooldownTriggers.Count; i++)
                {
                    config.CooldownTriggers[i].Priority = i;
                }
            }
            ImGui.Spacing();

            return(changed);
        }
Exemplo n.º 8
0
        private void ChatUI()
        {
            if (loadWindow)
            {
                if (ImGui.Begin("Translator", ref loadWindow))
                {
                    ImGui.Text("-=Translator Plugin Loaded=-");
                    ImGui.Text("============================");
                    ImGui.Text("Try '/trn h' for help!");
                }
                ImGui.End();
            }

            /*
             * if (chatWindow)
             * {
             *  if (ImGui.Begin("Chat Log", ref chatWindow))
             *  {
             *      ImGui.TextUnformatted(this.chatText);
             *  }
             *  ImGui.End();
             * }
             */
            if (chatWindow)
            {
                ImGui.SetNextWindowSize(new Num.Vector2(200, 100), ImGuiCond.FirstUseEver);
                ImGui.SetNextWindowBgAlpha(0.2f);
                ImGui.Begin("Another Window", ref chatWindow, ImGuiWindowFlags.NoTitleBar);
                ImGuiTabBarFlags tab_bar_flags = ImGuiTabBarFlags.None;
                if (ImGui.BeginTabBar("Tabs", tab_bar_flags))
                {
                    foreach (var tab in items)
                    {
                        if (ImGui.BeginTabItem(tab.Title))
                        {
                            ImGui.Text($"{tab.Text}");
                            ImGui.EndTabItem();
                        }
                    }

                    if (ImGui.BeginTabItem("+"))
                    {
                        ImGui.Text("Config");

                        foreach (var tab in items)
                        {
                            if (ImGui.TreeNode(tab.Title))
                            {
                                ImGui.Text("Change Name of Tab");
                                ImGui.InputText("Tab Name", ref tempTitle, bufSize);
                                if (ImGui.Button("Set Tab Title"))
                                {
                                    if (tempTitle.Length == 0)
                                    {
                                        tempTitle += ".";
                                    }

                                    while (CheckDupe(items, tempTitle))
                                    {
                                        tempTitle += ".";
                                    }

                                    tab.Title = tempTitle;
                                    tempTitle = "Title";
                                }
                                ImGui.Text("Enable/Disable Text");
                                ImGui.Checkbox("None", ref tab.Logs[0]);
                                ImGui.Checkbox("Debug", ref tab.Logs[1]);
                                ImGui.Checkbox("Urgent", ref tab.Logs[2]);
                                ImGui.Checkbox("Notice", ref tab.Logs[3]);
                                ImGui.Checkbox("Say", ref tab.Logs[4]);
                                ImGui.Checkbox("Shout", ref tab.Logs[5]);
                                ImGui.Checkbox("Tell Outgoing", ref tab.Logs[6]);
                                ImGui.Checkbox("Tell Incoming", ref tab.Logs[7]);
                                ImGui.Checkbox("Party", ref tab.Logs[8]);
                                ImGui.Checkbox("Alliance", ref tab.Logs[9]);
                                ImGui.Checkbox("Link Shell 1", ref tab.Logs[10]);
                                ImGui.Checkbox("Link Shell 2", ref tab.Logs[11]);
                                ImGui.Checkbox("Link Shell 3", ref tab.Logs[12]);
                                ImGui.Checkbox("Link Shell 4", ref tab.Logs[13]);
                                ImGui.Checkbox("Link Shell 5", ref tab.Logs[14]);
                                ImGui.Checkbox("Link Shell 6", ref tab.Logs[15]);
                                ImGui.Checkbox("Link Shell 7", ref tab.Logs[16]);
                                ImGui.Checkbox("Link Shell 8", ref tab.Logs[17]);
                                ImGui.Checkbox("FreeCompany", ref tab.Logs[18]);
                                ImGui.Checkbox("Novice Network", ref tab.Logs[19]);
                                ImGui.Checkbox("Custom Emote", ref tab.Logs[20]);
                                ImGui.Checkbox("Standard Emote", ref tab.Logs[21]);
                                ImGui.Checkbox("Yell", ref tab.Logs[22]);
                                ImGui.Checkbox("Cross Party", ref tab.Logs[23]);
                                ImGui.Checkbox("PVP Team", ref tab.Logs[24]);
                                ImGui.Checkbox("CrossLinkShell 1", ref tab.Logs[25]);
                                ImGui.Checkbox("Echo", ref tab.Logs[26]);
                                ImGui.Checkbox("System Error", ref tab.Logs[27]);
                                ImGui.Checkbox("Gathering System Message", ref tab.Logs[28]);
                                ImGui.Checkbox("Retainor Sale", ref tab.Logs[29]);
                                ImGui.Checkbox("Cross Link Shell 2", ref tab.Logs[30]);
                                ImGui.Checkbox("Cross Link Shell 3", ref tab.Logs[31]);
                                ImGui.Checkbox("Cross Link Shell 4", ref tab.Logs[32]);
                                ImGui.Checkbox("Cross Link Shell 5", ref tab.Logs[33]);
                                ImGui.Checkbox("Cross Link Shell 6", ref tab.Logs[34]);
                                ImGui.Checkbox("Cross Link Shell 7", ref tab.Logs[35]);
                                ImGui.Checkbox("Cross Link Shell 8", ref tab.Logs[36]);
                                ImGui.TreePop();
                            }
                        }

                        if (ImGui.Button("New Tab"))
                        {
                            tempTitle = "New";

                            while (CheckDupe(items, tempTitle))
                            {
                                tempTitle += ".";
                            }

                            items.Add(new DynTab(tempTitle, "", true));
                            tempTitle = "Title";
                        }
                        ImGui.EndTabItem();
                    }
                    ImGui.EndTabBar();
                    ImGui.End();
                }
            }
        }
Exemplo n.º 9
0
        public void Draw(PlottedGraph LatestActiveGraph)
        {
            if (LatestActiveGraph == null)
            {
                return;
            }

            if (_ActiveGraph != LatestActiveGraph)
            {
                _ActiveGraph = LatestActiveGraph;
                ThreadHighlightSettings?foundHighlights;
                if (!graphSettings.TryGetValue(_ActiveGraph, out foundHighlights) || foundHighlights is null)
                {
                    foundHighlights = new ThreadHighlightSettings();
                    graphSettings.Add(_ActiveGraph, foundHighlights);
                }
                _activeHighlights = foundHighlights;
            }
            Vector2 Size = ImGui.GetWindowSize();

            Size.Y = ImGui.GetContentRegionAvail().Y;

            if (ImGui.BeginChild("#highlightControls", Size))
            {
                if (!PopoutHighlight && ImGui.Button("Popout"))
                {
                    ImGui.SetCursorPosX(ImGui.GetContentRegionAvail().X - 50);
                    PopoutHighlight          = true;
                    PopoutHighlightSkipFrame = true;
                }


                else
                {
                    ImGuiTabBarFlags tab_bar_flags = ImGuiTabBarFlags.AutoSelectNewTabs;
                    if (ImGui.BeginTabBar("Highlights Tab Bar", tab_bar_flags))
                    {
                        if (ImGui.BeginTabItem("Externals/Symbols"))
                        {
                            _activeHighlights.selectedHighlightTab = 0;
                            DrawSymbolsSelectBox(reserveSize: 40); //todo: unbadify this height choice
                            DrawSymbolsSelectControls(_ActiveGraph);
                            ImGui.EndTabItem();
                        }
                        if (ImGui.BeginTabItem("Addresses"))
                        {
                            _activeHighlights.selectedHighlightTab = 1;
                            DrawAddressSelectControls(_ActiveGraph);
                            if (_activeHighlights.SelectedAddresses.Any())
                            {
                                DrawAddressSelectBox(_ActiveGraph);
                            }
                            ImGui.EndTabItem();
                        }
                        if (ImGui.BeginTabItem("Exceptions"))
                        {
                            _activeHighlights.selectedHighlightTab = 2;
                            DrawExceptionSelectBox(_ActiveGraph);
                            DrawExceptionSelectControls(_ActiveGraph);
                            ImGui.EndTabItem();
                        }
                        ImGui.EndTabBar();
                    }
                }
                ImGui.EndChild();
            }
        }
Exemplo n.º 10
0
        private void ChatUI()
        {
            ImGuiWindowFlags chat_window_flags     = 0;
            ImGuiWindowFlags chat_sub_window_flags = 0;

            if (no_titlebar)
            {
                chat_window_flags |= ImGuiWindowFlags.NoTitleBar;
            }
            if (no_scrollbar)
            {
                chat_window_flags |= ImGuiWindowFlags.NoScrollbar;
            }
            if (no_scrollbar)
            {
                chat_sub_window_flags |= ImGuiWindowFlags.NoScrollbar;
            }
            if (!no_menu)
            {
                chat_window_flags |= ImGuiWindowFlags.MenuBar;
            }
            if (no_move)
            {
                chat_window_flags |= ImGuiWindowFlags.NoMove;
            }
            if (no_resize)
            {
                chat_window_flags |= ImGuiWindowFlags.NoResize;
            }
            if (no_collapse)
            {
                chat_window_flags |= ImGuiWindowFlags.NoCollapse;
            }
            if (no_nav)
            {
                chat_window_flags |= ImGuiWindowFlags.NoNav;
            }
            if (no_mouse)
            {
                chat_window_flags |= ImGuiWindowFlags.NoMouseInputs;
            }
            if (no_mouse2)
            {
                chat_sub_window_flags |= ImGuiWindowFlags.NoMouseInputs;
            }



            if (chatWindow)
            {
                if (flickback)
                {
                    no_mouse  = false;
                    flickback = false;
                }
                ImGui.SetNextWindowSize(new Num.Vector2(200, 100), ImGuiCond.FirstUseEver);
                ImGui.SetNextWindowBgAlpha(alpha);
                ImGui.Begin("Another Window", ref chatWindow, chat_window_flags);
                ImGuiTabBarFlags tab_bar_flags = ImGuiTabBarFlags.None;

                if (ImGui.BeginTabBar("Tabs", tab_bar_flags))
                {
                    int loop = 0;
                    foreach (var tab in items)
                    {
                        if (tab.Enabled)
                        {
                            //WIP

                            if (tab.sel)
                            {
                                ImGui.PushStyleColor(ImGuiCol.Tab, tab_sel);
                                ImGui.PushStyleColor(ImGuiCol.Text, tab_sel_text);
                                tab.sel = false;
                            }
                            else if (tab.msg)
                            {
                                ImGui.PushStyleColor(ImGuiCol.Tab, tab_ind);
                                ImGui.PushStyleColor(ImGuiCol.Text, tab_ind_text);
                            }
                            else
                            {
                                ImGui.PushStyleColor(ImGuiCol.Tab, tab_norm);
                                ImGui.PushStyleColor(ImGuiCol.Text, tab_norm_text);
                            }



                            if (ImGui.BeginTabItem(tab.Title))
                            {
                                tab.sel = true;
                                float footer = (ImGui.GetStyle().ItemSpacing.Y) / 2 + ImGui.GetFrameHeightWithSpacing();
                                ImGui.PushStyleVar(ImGuiStyleVar.ItemSpacing, new Num.Vector2(space_hor, space_ver));
                                ImGui.BeginChild("scrolling", new Num.Vector2(0, -footer), false, chat_sub_window_flags);


                                foreach (ChatText line in tab.Chat)
                                {
                                    if (tab.FilterOn)
                                    {
                                        if (ContainsText(line.Text, tab.Filter))
                                        {
                                            if (tab.Config[0])
                                            {
                                                ImGui.TextColored(timeColour, line.Time + " "); ImGui.SameLine();
                                            }
                                            if (tab.Config[1] && tab.Chans[ConvertForArray(line.Channel)])
                                            {
                                                ImGui.TextColored(chanColour[ConvertForArray(line.Channel)], line.ChannelShort + " "); ImGui.SameLine();
                                            }
                                            if (line.Sender.Length > 0)
                                            {
                                                ImGui.TextColored(nameColour, line.Sender + ":"); ImGui.SameLine();
                                            }

                                            int count = 0;
                                            foreach (TextTypes textTypes in line.Text)
                                            {
                                                if (textTypes.Type == PayloadType.RawText)
                                                {
                                                    ImGui.PushStyleColor(ImGuiCol.Text, logColour[line.ChannelColour]);
                                                    Wrap(textTypes.Text);
                                                    ImGui.PopStyleColor();
                                                }

                                                if (textTypes.Type == PayloadType.MapLink)
                                                {
                                                    if (ImGui.GetContentRegionAvail().X - 5 - ImGui.CalcTextSize(textTypes.Text).X < 0)
                                                    {
                                                        ImGui.Text("");
                                                    }
                                                    if (ImGui.SmallButton(textTypes.Text))
                                                    {
                                                        this.pluginInterface.Framework.Gui.OpenMapWithMapLink((Dalamud.Game.Chat.SeStringHandling.Payloads.MapLinkPayload)textTypes.Payload);
                                                    }
                                                }

                                                if (count < (line.Text.Count - 1))
                                                {
                                                    ImGui.SameLine(); count++;
                                                }
                                            }
                                        }
                                    }
                                    else
                                    {
                                        if (tab.Config[0])
                                        {
                                            ImGui.TextColored(timeColour, line.Time + " "); ImGui.SameLine();
                                        }
                                        if (tab.Config[1] && tab.Chans[ConvertForArray(line.Channel)])
                                        {
                                            ImGui.TextColored(chanColour[ConvertForArray(line.Channel)], line.ChannelShort + " "); ImGui.SameLine();
                                        }
                                        if (line.Sender.Length > 0)
                                        {
                                            ImGui.TextColored(nameColour, line.Sender + ":"); ImGui.SameLine();
                                        }

                                        int count = 0;
                                        foreach (TextTypes textTypes in line.Text)
                                        {
                                            if (textTypes.Type == PayloadType.RawText)
                                            {
                                                ImGui.PushStyleColor(ImGuiCol.Text, logColour[line.ChannelColour]);
                                                Wrap(textTypes.Text);
                                                ImGui.PopStyleColor();
                                            }

                                            if (textTypes.Type == PayloadType.MapLink)
                                            {
                                                if (ImGui.GetContentRegionAvail().X - 5 - ImGui.CalcTextSize(textTypes.Text).X < 0)
                                                {
                                                    ImGui.Text("");
                                                }
                                                if (ImGui.SmallButton(textTypes.Text))
                                                {
                                                    this.pluginInterface.Framework.Gui.OpenMapWithMapLink((Dalamud.Game.Chat.SeStringHandling.Payloads.MapLinkPayload)textTypes.Payload);
                                                }
                                            }

                                            if (count < (line.Text.Count - 1))
                                            {
                                                ImGui.SameLine();
                                                count++;
                                            }
                                        }
                                    }
                                }
                                if (tab.Scroll == true)
                                {
                                    ImGui.SetScrollHereY();
                                    tab.Scroll = false;
                                }
                                ImGui.PopStyleVar();
                                ImGui.EndChild();

                                if (tab.FilterOn)
                                {
                                    ImGui.InputText("Filter Text", ref tab.Filter, 999);
                                    if (ImGui.IsItemHovered())
                                    {
                                        ImGui.SetTooltip("Only show lines with this text.");
                                    }
                                }

                                if (no_mouse2 && !no_mouse)
                                {
                                    Num.Vector2 vMin = ImGui.GetWindowContentRegionMin();
                                    Num.Vector2 vMax = ImGui.GetWindowContentRegionMax();

                                    vMin.X += ImGui.GetWindowPos().X;
                                    vMin.Y += ImGui.GetWindowPos().Y + 22;
                                    vMax.X += ImGui.GetWindowPos().X - 22;
                                    vMax.Y += ImGui.GetWindowPos().Y;

                                    if (ImGui.IsMouseHoveringRect(vMin, vMax))
                                    {
                                        no_mouse = true; flickback = true;
                                    }
                                }
                                tab.msg = false;
                                ImGui.EndTabItem();
                            }
                            ImGui.PopStyleColor();
                            ImGui.PopStyleColor();
                        }
                        loop++;
                    }
                    ImGui.EndTabBar();
                    ImGui.End();
                }
            }



            if (configWindow)
            {
                //ImGui.PushFont(font);

                ImGui.SetNextWindowSize(new Num.Vector2(300, 500), ImGuiCond.FirstUseEver);
                ImGui.Begin("Chat Config", ref configWindow);
                ImGuiTabBarFlags tab_bar_flags = ImGuiTabBarFlags.None;
                if (ImGui.BeginTabBar("Tabs", tab_bar_flags))
                {
                    if (ImGui.BeginTabItem("Config"))
                    {
                        float footer1 = (ImGui.GetStyle().ItemSpacing.Y) / 2 + ImGui.GetFrameHeightWithSpacing();
                        ImGui.BeginChild("scrolling", new Num.Vector2(0, -footer1), false);
                        ImGui.Text("");

                        ImGui.Columns(3);

                        ImGui.Checkbox("Show Chat Extender", ref chatWindow);
                        if (ImGui.IsItemHovered())
                        {
                            ImGui.SetTooltip("Enable/Disable the Chat Extender");
                        }
                        ImGui.NextColumn();
                        ImGui.Text("");
                        ImGui.NextColumn();
                        ImGui.Text("");
                        ImGui.NextColumn();

                        ImGui.Checkbox("Scrollbar", ref no_scrollbar);
                        if (ImGui.IsItemHovered())
                        {
                            ImGui.SetTooltip("Shows ScrollBar");
                        }
                        ImGui.NextColumn();
                        ImGui.Checkbox("Lock Window Position", ref no_move);
                        if (ImGui.IsItemHovered())
                        {
                            ImGui.SetTooltip("Lock/Unlock the position of the Chat Extender");
                        }
                        ImGui.NextColumn();
                        ImGui.Checkbox("Lock Window Size", ref no_resize);
                        if (ImGui.IsItemHovered())
                        {
                            ImGui.SetTooltip("Lock/Unlock the size of the Chat Extender");
                        }
                        ImGui.NextColumn();

                        ImGui.Checkbox("ClickThrough Tab Bar", ref no_mouse);
                        if (ImGui.IsItemHovered())
                        {
                            ImGui.SetTooltip("Enable/Disable being able to clickthrough the Tab Bar of the Chat Extender");
                        }
                        ImGui.NextColumn();
                        ImGui.Checkbox("ClickThrough Chat", ref no_mouse2);
                        if (ImGui.IsItemHovered())
                        {
                            ImGui.SetTooltip("Enable/Disable being able to clickthrough the Chat Extension chatbox");
                        }
                        ImGui.NextColumn();
                        ImGui.Text("");
                        ImGui.NextColumn();

                        ImGui.Columns(1);
                        ImGui.SliderFloat("Chat Extender Alpha", ref alpha, 0.001f, 0.999f);
                        if (ImGui.IsItemHovered())
                        {
                            ImGui.SetTooltip("Alter the Alpha of the Chat Extender");
                        }
                        ImGui.Text("");

                        ImGui.Text("");
                        ImGui.Text("Highlight Example");
                        HighlightText();
                        ImGui.InputText("##HighlightText", ref tempHigh, 999); if (ImGui.IsItemHovered())
                        {
                            ImGui.SetTooltip("Will highlight EXACT matches only. Seperate words with [,].");
                        }
                        ImGui.SameLine();
                        if (ImGui.Button("Apply"))
                        {
                            high.highlights = tempHigh.Split(',');
                        }
                        ImGui.Columns(4);
                        ImGui.SliderInt("Alpha", ref high.htA, 0, 255); ImGui.NextColumn();
                        ImGui.SliderInt("Blue", ref high.htB, 0, 255); ImGui.NextColumn();
                        ImGui.SliderInt("Green", ref high.htG, 0, 255); ImGui.NextColumn();
                        ImGui.SliderInt("Red", ref high.htR, 0, 255); ImGui.NextColumn();
                        ImGui.Columns(1);
                        ImGui.Text("");

                        ImGui.Columns(1);

                        if (ImGui.Button("Save and Close Config"))
                        {
                            SaveConfig();

                            configWindow = false;
                        }
                        if (ImGui.IsItemHovered())
                        {
                            ImGui.SetTooltip("Changes will only be saved for the current session unless you do this!");
                        }
                        ImGui.EndChild();
                        ImGui.EndTabItem();
                    }


                    if (ImGui.BeginTabItem("Colours"))
                    {
                        ImGui.Columns(4);
                        ImGui.Text("Example"); ImGui.NextColumn();
                        ImGui.Text("Colour 1"); ImGui.NextColumn();
                        ImGui.Text("Colour 2"); ImGui.NextColumn();
                        ImGui.Text(""); ImGui.NextColumn();
                        ImGui.TextColored(timeColour, "[12:00]"); ImGui.NextColumn();
                        ImGui.ColorEdit4("Time Colour", ref timeColour, ImGuiColorEditFlags.NoInputs | ImGuiColorEditFlags.NoLabel); ImGui.NextColumn();
                        ImGui.Text(""); ImGui.NextColumn();
                        ImGui.Text(""); ImGui.NextColumn();
                        ImGui.TextColored(nameColour, "Mr E"); ImGui.NextColumn();
                        ImGui.ColorEdit4("Name Colour", ref nameColour, ImGuiColorEditFlags.NoInputs | ImGuiColorEditFlags.NoLabel); ImGui.NextColumn();
                        ImGui.Text(""); ImGui.NextColumn();
                        ImGui.Text(""); ImGui.NextColumn();
                        for (int i = 0; i < (Channels.Length); i++)
                        {
                            ImGui.InputText("##Tab Name" + i.ToString(), ref Chan[i], 99); ImGui.NextColumn();
                            ImGui.TextColored(chanColour[i], "[" + Channels[i] + "]"); ImGui.SameLine(); ImGui.TextColored(logColour[i], "Text"); ImGui.NextColumn();
                            ImGui.ColorEdit4(Channels[i] + " Colour1", ref chanColour[i], ImGuiColorEditFlags.NoInputs | ImGuiColorEditFlags.NoLabel); ImGui.NextColumn();
                            ImGui.ColorEdit4(Channels[i] + " Colour2", ref logColour[i], ImGuiColorEditFlags.NoInputs | ImGuiColorEditFlags.NoLabel); ImGui.NextColumn();
                        }
                        ImGui.Columns(1);

                        if (ImGui.Button("Save and Close Config"))
                        {
                            SaveConfig();

                            configWindow = false;
                        }
                        if (ImGui.IsItemHovered())
                        {
                            ImGui.SetTooltip("Changes will only be saved for the current session unless you do this!");
                        }

                        ImGui.EndTabItem();
                    }

                    if (ImGui.BeginTabItem("Tabs"))
                    {
                        if (ImGui.Button("Add New Tab"))
                        {
                            tempTitle = "New";

                            while (CheckDupe(items, tempTitle))
                            {
                                tempTitle += ".";
                            }

                            items.Add(new DynTab(tempTitle, new List <ChatText>(), true));
                            tempTitle = "Title";
                        }
                        if (ImGui.IsItemHovered())
                        {
                            ImGui.SetTooltip("Add a new Tab to the Chat Extender");
                        }

                        if (ImGui.TreeNode("Tab Order"))
                        {
                            ImGui.Columns(3);
                            ImGui.Text("Tab"); ImGui.NextColumn();
                            ImGui.Text(""); ImGui.NextColumn();
                            ImGui.Text(""); ImGui.NextColumn();

                            List <TabBase> temp_clone = new List <TabBase>();
                            temp_clone = CopyItems(items);
                            for (int i = 0; i < (items.Count); i++)
                            {
                                ImGui.Text(items[i].Title); ImGui.NextColumn();
                                if (i > 0)
                                {
                                    if (ImGui.Button("^##" + i.ToString()))
                                    {
                                        TabBase mover = temp_clone[i];
                                        temp_clone.RemoveAt(i);
                                        temp_clone.Insert(i - 1, mover);
                                    }
                                }
                                ImGui.NextColumn();
                                if (i < items.Count - 1)
                                {
                                    if (ImGui.Button("v##" + i.ToString()))
                                    {
                                        TabBase mover = temp_clone[i];
                                        temp_clone.RemoveAt(i);
                                        temp_clone.Insert(i + 1, mover);
                                    }
                                }
                                ImGui.NextColumn();
                            }
                            ImGui.Columns(1);
                            items = CopyItems(temp_clone);
                            ImGui.TreePop();
                        }


                        foreach (var tab in items)
                        {
                            if (tab.Enabled)
                            {
                                if (ImGui.TreeNode(tab.Title))
                                {
                                    float footer2 = (ImGui.GetStyle().ItemSpacing.Y) / 2 + ImGui.GetFrameHeightWithSpacing();
                                    ImGui.BeginChild("scrolling", new Num.Vector2(0, -footer2), false);
                                    ImGui.InputText("##Tab Name", ref tempTitle, bufSize);
                                    ImGui.SameLine();
                                    if (ImGui.Button("Set Tab Title"))
                                    {
                                        if (tempTitle.Length == 0)
                                        {
                                            tempTitle += ".";
                                        }

                                        while (CheckDupe(items, tempTitle))
                                        {
                                            tempTitle += ".";
                                        }

                                        tab.Title = tempTitle;
                                        tempTitle = "Title";
                                    }
                                    if (ImGui.IsItemHovered())
                                    {
                                        ImGui.SetTooltip("Change the title of the Tab");
                                    }

                                    ImGui.Columns(3);

                                    ImGui.Checkbox("Time Stamp", ref tab.Config[0]);
                                    if (ImGui.IsItemHovered())
                                    {
                                        ImGui.SetTooltip("Show Timestamps in this Tab");
                                    }
                                    ImGui.NextColumn();
                                    ImGui.Checkbox("Channel", ref tab.Config[1]);
                                    if (ImGui.IsItemHovered())
                                    {
                                        ImGui.SetTooltip("Show the Channel the message came from");
                                    }
                                    ImGui.NextColumn();
                                    ImGui.Checkbox("Translate", ref tab.Config[2]);
                                    if (ImGui.IsItemHovered())
                                    {
                                        ImGui.SetTooltip("Enable Japanese -> English translation");
                                    }
                                    ImGui.NextColumn();

                                    ImGui.Checkbox("AutoScroll", ref tab.AutoScroll);
                                    if (ImGui.IsItemHovered())
                                    {
                                        ImGui.SetTooltip("Enable the Chat to scroll automatically on a new message");
                                    }
                                    ImGui.NextColumn();
                                    ImGui.Checkbox("Save to file", ref tab.Config[3]);
                                    if (ImGui.IsItemHovered())
                                    {
                                        ImGui.SetTooltip("Write this tab to '\\My Documents\\FFXIV_ChatExtender\\Logs\\<YYYYMMDD>_TAB.txt");
                                    }
                                    ImGui.NextColumn();
                                    ImGui.Checkbox("Enable Filter", ref tab.FilterOn);
                                    if (ImGui.IsItemHovered())
                                    {
                                        ImGui.SetTooltip("Enable Filtering of text");
                                    }
                                    ImGui.NextColumn();

                                    ImGui.Columns(1);

                                    ImGui.Text("");


                                    //TODO: Add a confirm prompt

                                    if (EnabledTabs(items) > 1)
                                    {
                                        if (ImGui.Button("Delete Tab"))
                                        {
                                            tab.Enabled = false;
                                        }
                                    }
                                    if (ImGui.IsItemHovered())
                                    {
                                        ImGui.SetTooltip("Removes Tab");
                                    }



                                    ImGui.Columns(2);
                                    ImGui.Text("Channel"); ImGui.NextColumn();
                                    if (tab.Config[1])
                                    {
                                        ImGui.Text("Show Short");
                                    }
                                    else
                                    {
                                        ImGui.Text("");
                                    }
                                    ImGui.NextColumn();

                                    for (int i = 0; i < (Channels.Length); i++)
                                    {
                                        ImGui.PushStyleColor(ImGuiCol.Text, chanColour[i]);
                                        ImGui.Checkbox("[" + Channels[i] + "]", ref tab.Logs[i]); ImGui.NextColumn();
                                        if (tab.Config[1])
                                        {
                                            ImGui.Checkbox(Chan[i], ref tab.Chans[i]);
                                        }
                                        else
                                        {
                                            ImGui.Text("");
                                        }
                                        ImGui.NextColumn();
                                        ImGui.PopStyleColor();
                                    }
                                    ImGui.Columns(1);
                                    ImGui.EndChild();
                                }
                            }
                        }

                        if (ImGui.Button("Save and Close Config"))
                        {
                            SaveConfig();

                            configWindow = false;
                        }
                        if (ImGui.IsItemHovered())
                        {
                            ImGui.SetTooltip("Changes will only be saved for the current session unless you do this!");
                        }

                        ImGui.EndTabItem();
                    }


                    if (ImGui.BeginTabItem("Translator"))
                    {
                        ImGui.Checkbox("Inject Translation", ref injectChat);
                        if (ImGui.IsItemHovered())
                        {
                            ImGui.SetTooltip("Inject translated text into the normal FFXIV Chatbox");
                        }

                        ImGui.Text("Surrounds of Translated text");
                        ImGui.PushItemWidth(24);
                        ImGui.InputText("##Left", ref lTr, 3); ImGui.SameLine();
                        if (ImGui.IsItemHovered())
                        {
                            ImGui.SetTooltip("Alter the characters on the left of Translated text");
                        }
                        ImGui.PopItemWidth();
                        ImGui.Text("Translation"); ImGui.SameLine();
                        ImGui.PushItemWidth(24);
                        ImGui.InputText("##Right", ref rTr, 3);
                        if (ImGui.IsItemHovered())
                        {
                            ImGui.SetTooltip("Alter the characters on the right of Translated text");
                        }
                        ImGui.PopItemWidth();
                        ImGui.Text("");
                        ImGui.EndTabItem();
                    }

                    if (ImGui.BeginTabItem("Font"))
                    {
                        ImGui.Columns(3);
                        ImGui.InputInt("H Spacing", ref space_hor);
                        if (ImGui.IsItemHovered())
                        {
                            ImGui.SetTooltip("Horizontal spacing of chat text");
                        }
                        ImGui.NextColumn();
                        ImGui.InputInt("V Spacing", ref space_ver);
                        if (ImGui.IsItemHovered())
                        {
                            ImGui.SetTooltip("Vertical spacing of cha text");
                        }
                        ImGui.NextColumn();
                        ImGui.Text("");
                        ImGui.NextColumn();

                        ImGui.Columns(1);

                        ImGui.EndTabItem();
                    }
                }

                ImGui.EndTabBar();
                ImGui.EndChild();

                //ImGui.PopFont();
            }
        }
Exemplo n.º 11
0
 public static bool BeginTabBar(string str_id, ImGuiTabBarFlags flags)
 {
     return(ImGui.BeginTabBar(str_id, flags));
 }