Beispiel #1
0
        internal void DrawChangedItem(string name, object?data, float itemIdOffset = 0)
        {
            var ret = ImGui.Selectable(name) ? MouseButton.Left : MouseButton.None;

            ret = ImGui.IsItemClicked(ImGuiMouseButton.Right) ? MouseButton.Right : ret;
            ret = ImGui.IsItemClicked(ImGuiMouseButton.Middle) ? MouseButton.Middle : ret;

            if (ret != MouseButton.None)
            {
                _penumbra.Api.InvokeClick(ret, data);
            }

            if (_penumbra.Api.HasTooltip && ImGui.IsItemHovered())
            {
                ImGui.BeginTooltip();
                using var tooltip = ImGuiRaii.DeferredEnd(ImGui.EndTooltip);
                _penumbra.Api.InvokeTooltip(data);
            }

            if (data is Item it)
            {
                var modelId = $"({( ( Quad )it.ModelMain ).A})";
                var offset  = ImGui.CalcTextSize(modelId).X - ImGui.GetStyle().ItemInnerSpacing.X + itemIdOffset;

                ImGui.SameLine(ImGui.GetWindowContentRegionWidth() - offset);
                ImGui.TextColored(new Vector4(0.5f, 0.5f, 0.5f, 1), modelId);
            }
        }
Beispiel #2
0
        protected override void renderSelf()
        {
            bool show = ImGui.TreeNodeEx(Text, Flags);

            if (ImGui.IsItemClicked())
            {
                OnSelect?.Invoke(this);
                internalOnSelect();
            }

            if (_tooltip != null && ImGui.IsItemHovered())
            {
                ImGui.BeginTooltip();
                _tooltip();
                ImGui.EndTooltip();
            }

            _contextMenu?.Render();

            if (show)
            {
                renderChildren();
                ImGui.TreePop();
            }
        }
Beispiel #3
0
        // Website button with On-Hover address if valid http(s), otherwise text.
        private void DrawWebsiteText()
        {
            if ((_selectedMod.Mod.Meta.Website?.Length ?? 0) <= 0)
            {
                return;
            }

            var validUrl = Uri.TryCreate(_selectedMod.Mod.Meta.Website, UriKind.Absolute, out Uri uriResult) &&
                           (uriResult.Scheme == Uri.UriSchemeHttps || uriResult.Scheme == Uri.UriSchemeHttp);

            ImGui.SameLine();
            if (validUrl)
            {
                if (ImGui.SmallButton("Open Website"))
                {
                    Process.Start(_selectedMod.Mod.Meta.Website);
                }

                if (ImGui.IsItemHovered())
                {
                    ImGui.BeginTooltip();
                    ImGui.Text(_selectedMod.Mod.Meta.Website);
                    ImGui.EndTooltip();
                }
            }
            else
            {
                ImGui.TextColored(new Vector4(1f, 1f, 1f, 0.66f), "from");
                ImGui.SameLine();
                ImGui.Text(_selectedMod.Mod.Meta.Website);
            }
        }
        private static bool DrawGeneralTab(Configuration config, float scale)
        {
            if (!ImGui.BeginTabItem("General"))
            {
                return(false);
            }
            var changed = ImGui.Checkbox("Disable cooldown trigger while casting.",
                                         ref config.NoVibrationDuringCasting);

            changed |= ImGui.Checkbox("Disable cooldown trigger while weapon is sheathed.",
                                      ref config.NoVibrationWithSheathedWeapon);
            changed |= ImGui.Checkbox("Sense Aether Currents (out of combat).", ref config.SenseAetherCurrents);
            if (ImGui.IsItemHovered())
            {
                ImGui.BeginTooltip();
                ImGui.Text($"Gradually stronger vibration the closer you are to an Aether Current.");
                ImGui.EndTooltip();
            }

            if (config.SenseAetherCurrents)
            {
                ImGui.Indent();
                ImGui.SetNextItemWidth(250 * scale);
                var distance = (int)Math.Sqrt(config.MaxAetherCurrentSenseDistanceSquared);
                changed |= ImGui.SliderInt("##AetherSenseDistance", ref distance, 5, 115,
                                           "Max Sense Distance %d");
                config.MaxAetherCurrentSenseDistanceSquared = distance * distance;
                ImGui.Unindent();
            }

            ImGui.EndTabItem();
            return(changed);
        }
Beispiel #5
0
 public void SubmitUI(float deltaTime, InputSnapshot inputSnapshot)
 {
     if (showUI)
     {
         SubmitMainMenu(deltaTime);
         SubmitEditorWindow();
         SubmitResourcesWindow();
         SubmitMetadataWindow();
     }
     else
     {
         if (hideUIHelpTextDelta < HIDEUIHELPTEXTDURATION)
         {
             hideUIHelpTextDelta += deltaTime;
             ImGui.GetStyle().Alpha = 1;
             ImGui.BeginTooltip();
             ImGui.Text("Press space to show UI");
             ImGui.EndTooltip();
         }
         foreach (KeyEvent keyEvent in inputSnapshot.KeyEvents)
         {
             if (keyEvent.Down && keyEvent.Key == Key.Space)
             {
                 ImGui.GetStyle().Alpha = RuntimeOptions.Current.UiAlpha;
                 showUI = true;
                 break;
             }
         }
     }
 }
        public override void DrawEditor()
        {
            ImGui.SetNextItemWidth(-20 * ImGui.GetIO().FontGlobalScale);
            if (PluginConfig.AutoFocus && ImGui.IsWindowAppearing())
            {
                ImGui.SetKeyboardFocusHere();
            }
            ImGui.InputText("##ItemNameSearchFilter", ref searchText, 256);
            ImGui.SameLine();
            ImGui.TextDisabled("(?)");
            if (ImGui.IsItemHovered())
            {
                ImGui.BeginTooltip();
                ImGui.Text("Type an item name to search for items by name.");
                ImGui.SameLine();
                ImGui.TextDisabled("\"OMG\"");
                ImGui.Text("Type an item id to search for item by its ID.");
                ImGui.SameLine();
                ImGui.TextDisabled("\"23991\"");
                ImGui.Text("Start input with '$' to search for an item by its description.");
                ImGui.SameLine();
                ImGui.TextDisabled("\"$Weird.\"");
                ImGui.Text("Start and end with '/' to search using regex.");
                ImGui.SameLine();
                ImGui.TextDisabled("\"/^.M.$/\"");


                ImGui.EndTooltip();
            }
        }
Beispiel #7
0
 /// <summary>
 /// if there is a tooltip and the item is hovered this will display it
 /// </summary>
 protected void handleTooltip()
 {
     if (!string.IsNullOrEmpty(_tooltip) && ImGui.IsItemHovered())
     {
         ImGui.BeginTooltip();
         ImGui.Text(_tooltip);
         ImGui.EndTooltip();
     }
 }
Beispiel #8
0
 /// <summary>
 /// Show a simple text tooltip if hovered.
 /// </summary>
 /// <param name="text">Text to display.</param>
 public static void TextTooltip(string text)
 {
     if (ImGui.IsItemHovered())
     {
         ImGui.BeginTooltip();
         ImGui.TextUnformatted(text);
         ImGui.EndTooltip();
     }
 }
Beispiel #9
0
 // Displays a tooltip with specified text when mouse is hovered on the last item.
 public static void DisplayTooltipOnHover(string text)
 {
     if (ImGui.IsItemHovered())
     {
         ImGui.BeginTooltip();
         ImGui.SetTooltip(text);
         ImGui.EndTooltip();
     }
 }
Beispiel #10
0
 /// <summary>
 /// Displays a tooltip when the user hovers over the previously created widget.
 /// </summary>
 /// <param name="msg">The tooltip to display.</param>
 public static void Tooltip(string msg)
 {
     if (ImGui.IsItemHovered())
     {
         ImGui.BeginTooltip();
         ImGui.Text(msg);
         ImGui.EndTooltip();
     }
 }
Beispiel #11
0
 /// <summary>
 /// shows a tooltip informing the user they can right click
 /// </summary>
 public static void ShowContextMenuTooltip()
 {
     if (ImGui.IsItemHovered())
     {
         ImGui.BeginTooltip();
         ImGui.Text("Right click for more options");
         ImGui.EndTooltip();
     }
 }
Beispiel #12
0
        private void SubmitResourcesWindow()
        {
            if (!showResources)
            {
                return;
            }
            ImGui.PushStyleVar(ImGuiStyleVar.WindowRounding, 0);
            Vector2 size         = RuntimeOptions.Current.GetScaledSize(RESOURCESWINDOWWIDTH, RESOURCESWINDOWHEIGHT);
            float   quarterWidth = size.X / 4;

            ImGui.SetNextWindowSize(size);
            if (ImGui.Begin("Resources", ref showResources, ImGuiWindowFlags.NoResize))
            {
                if (ImGui.Button("Add resource", new Vector2(size.X - 16, 30 * RuntimeOptions.Current.UiScale)))
                {
                    Controller.LoadResource();
                }
                ImGui.PushFont(RuntimeOptions.Current.EditorFont);
                if (ImGui.BeginChild("Resource list", Vector2.Zero, false))
                {
                    for (int i = 0; i < Controller.Context.ImguiTextures.Count; i++)
                    {
                        YALCTShaderResource resource = Controller.Context.ImguiTextures[i];
                        if (ImGui.BeginChild($"resprops_{resource.UID}", new Vector2(0, quarterWidth), false))
                        {
                            ImGui.Image(resource.ImguiBinding, new Vector2(quarterWidth, quarterWidth));
                            if (ImGui.IsItemHovered())
                            {
                                ImGui.GetStyle().Alpha = 1;
                                ImGui.BeginTooltip();
                                float scaler = resource.Size.X > resource.Size.Y ?
                                               resource.Size.X / MAXTEXPREVIEWSIZE : resource.Size.Y / MAXTEXPREVIEWSIZE;
                                ImGui.Image(resource.ImguiBinding, resource.Size / scaler);
                                ImGui.EndTooltip();
                                ImGui.GetStyle().Alpha = RuntimeOptions.Current.UiAlpha;
                            }
                            ImGui.SameLine(quarterWidth + 5);
                            if (ImGui.BeginChild($"resdata_{resource.UID}", new Vector2(0, quarterWidth), false))
                            {
                                ImGui.Text($"InputTex{i}");
                                ImGui.Text($"{resource.Size.X}x{resource.Size.Y}");
                                if (ImGui.Button("Remove"))
                                {
                                    Controller.Context.RemoveTexture(resource);
                                    return;
                                }
                                ImGui.EndChild();
                            }
                            ImGui.EndChild();
                        }
                    }
                    ImGui.EndChild();
                }
                ImGui.PopFont();
            }
            ImGui.PopStyleVar();
        }
Beispiel #13
0
 private unsafe void SubmitEditorWindow()
 {
     ImGui.PushStyleVar(ImGuiStyleVar.WindowRounding, 0);
     ImGui.SetNextWindowSizeConstraints(Vector2.One * 500 * RuntimeOptions.Current.UiScale, Vector2.One * Controller.Context.Width);
     if (ImGui.Begin("Shader Editor"))
     {
         ImGui.PushFont(RuntimeOptions.Current.EditorFont);
         if (ImGui.BeginTabBar("editor mode"))
         {
             if (ImGui.BeginTabItem("Advanced"))
             {
                 basicMode = false;
                 SubmitAdvancedEditor();
                 ImGui.EndTabItem();
             }
             if (ImGui.BeginTabItem("Basic"))
             {
                 basicMode = true;
                 if (ImGui.BeginChild("editor basic", Vector2.Zero, true))
                 {
                     Vector2 editorWindowSize = ImGui.GetWindowSize();
                     float   textSize         = ImGui.CalcTextSize(fragmentCode).Y + 32;
                     ImGui.PushItemWidth(-1);
                     ImGui.InputTextMultiline("",
                                              ref fragmentCode,
                                              MAXEDITORSTRINGLENGTH,
                                              new Vector2(editorWindowSize.X - 16, textSize > editorWindowSize.Y ? textSize : editorWindowSize.Y - 16),
                                              ImGuiInputTextFlags.AllowTabInput);
                     ImGui.PopItemWidth();
                 }
                 ImGui.EndTabItem();
             }
             ImGui.EndTabBar();
         }
         ImGui.PopFont();
         ImGui.End();
     }
     if (errorMessages.Count != 0)
     {
         ImGui.SetNextWindowSizeConstraints(new Vector2(500, 16), new Vector2(500, 500));
         ImGui.BeginTooltip();
         ImGui.PushTextWrapPos();
         for (int i = 0; i < errorMessages.Count; i++)
         {
             string errorMessage = errorMessages[i];
             if (string.IsNullOrWhiteSpace(errorMessage))
             {
                 continue;
             }
             ImGui.TextColored(RgbaFloat.Red.ToVector4(), errorMessage);
         }
         ImGui.PopTextWrapPos();
         ImGui.EndTooltip();
     }
     ImGui.PopStyleVar();
 }
 public static void HelpMarker(string desc)
 {
     ImGui.TextDisabled("(?)");
     if (ImGui.IsItemHovered())
     {
         ImGui.BeginTooltip();
         ImGui.PushTextWrapPos(ImGui.GetFontSize() * 35.0f);
         ImGui.TextUnformatted(desc);
         ImGui.PopTextWrapPos();
         ImGui.EndTooltip();
     }
 }
Beispiel #15
0
        public void Draw()
        {
            if (!IsVisible)
            {
                return;
            }
            var flags = ImGuiWindowFlags.NoResize | ImGuiWindowFlags.NoTitleBar | ImGuiWindowFlags.AlwaysAutoResize;

            ImGui.SetNextWindowSizeConstraints(new Vector2(250, 100), new Vector2(1000, 1000));
            ImGui.Begin("config", flags);
            if (ImGui.SliderFloat("Opacity", ref opacity, 0.0f, 1.0f))
            {
                config.Opacity = opacity;
            }
            if (ImGui.Checkbox("Enable clickthrough", ref isClickthrough))
            {
                config.IsClickthrough = isClickthrough;
            }
            ImGui.NewLine();
            if (ImGui.Button("Save"))
            {
                IsVisible = false;
                config.Save();
            }
            ImGui.SameLine();
            var c = ImGui.GetCursorPos();

            ImGui.SetCursorPosX(ImGui.GetWindowContentRegionWidth() - ImGui.CalcTextSize("<3    Support on Ko-fi").X);
            ImGui.SmallButton("<3");
            ImGui.SetCursorPos(c);
            if (ImGui.IsItemHovered())
            {
                ImGui.BeginTooltip();
                ImGui.PushTextWrapPos(400f);
                ImGui.TextWrapped("Thanks to the Deep Dungeons Discord server for a lot of clarification and information. Special shoutouts to Maygi for writing the best Deep Dungeon guides out there!");
                ImGui.PopTextWrapPos();
                ImGui.EndTooltip();
            }
            ;
            ImGui.SameLine();
            ImGui.PushStyleColor(ImGuiCol.Button, 0xFF5E5BFF);
            ImGui.PushStyleColor(ImGuiCol.ButtonActive, 0xFF5E5BAA);
            ImGui.PushStyleColor(ImGuiCol.ButtonHovered, 0xFF5E5BDD);
            c = ImGui.GetCursorPos();
            ImGui.SetCursorPosX(ImGui.GetWindowContentRegionWidth() - ImGui.CalcTextSize("Support on Ko-fi").X);
            if (ImGui.SmallButton("Support on Ko-fi"))
            {
                Process.Start("https://ko-fi.com/strati");
            }
            ImGui.SetCursorPos(c);
            ImGui.PopStyleColor(3);
            ImGui.End();
        }
Beispiel #16
0
        public override void Draw()
        {
            ImGui.BeginChild("ConsoleInner", new Vector2(-1, -64));
            ImGui.PushFont(ImGuiManager.Instance.MonospacedFont);

            foreach (var logEntry in Logging.LogEntries.TakeLast(logLimit))
            {
                if (!string.IsNullOrWhiteSpace(currentConsoleFilter) && !GetFilterMatch(logEntry, currentConsoleFilter))
                {
                    continue;
                }

                ImGui.TextWrapped(logEntry.timestamp.TimeOfDay.ToString());
                ImGui.SameLine();
                ImGui.PushStyleColor(ImGuiCol.Text, SeverityToColor(logEntry.severity));
                ImGui.TextWrapped(logEntry.str);
                ImGui.PopStyleColor();

                if (ImGui.IsItemHovered())
                {
                    ImGui.SetNextWindowSize(new Vector2(GameSettings.GameResolutionX / 2f, -1));

                    ImGui.BeginTooltip();

                    ImGui.Text("Stack Trace:");
                    ImGui.TextWrapped(logEntry.stackTrace.ToString());

                    ImGui.EndTooltip();
                }

                ImGui.Separator();
            }

            if (scrollQueued)
            {
                ImGui.SetScrollHereY(1.0f);
                scrollQueued = false;
            }

            ImGui.PopFont();
            ImGui.EndChild();

            ImGui.InputText("Filter", ref currentConsoleFilter, 256);

            ImGui.InputText("Input", ref currentConsoleInput, 256);
            ImGui.SameLine();
            if (ImGui.Button("Submit"))
            {
                CommandRegistry.ParseAndExecute(currentConsoleInput);
                currentConsoleInput = "";
            }
        }
Beispiel #17
0
		private static void ToolTip(string desc)
		{
			if (ImGui.IsItemHovered())
			{
				ImGui.PushFont(UiBuilder.DefaultFont);
				ImGui.BeginTooltip();
				ImGui.PushTextWrapPos(ImGui.GetFontSize() * 35.0f);
				ImGui.TextUnformatted(desc);
				ImGui.PopTextWrapPos();
				ImGui.EndTooltip();
				ImGui.PopFont();
			}
		}
 private void DrawBgmTooltip(BgmInfo bgm)
 {
     ImGui.BeginTooltip();
     ImGui.PushTextWrapPos(GuiScale(400f));
     ImGui.TextColored(new Vector4(0, 1, 0, 1), "Song Info");
     ImGui.TextWrapped($"Title: {bgm.Title}");
     ImGui.TextWrapped(string.IsNullOrEmpty(bgm.Location) ? "Location: Unknown" : $"Location: {bgm.Location}");
     if (!string.IsNullOrEmpty(bgm.AdditionalInfo))
     {
         ImGui.TextWrapped($"Info: {bgm.AdditionalInfo}");
     }
     ImGui.Text($"File path: {bgm.FilePath}");
     ImGui.PopTextWrapPos();
     ImGui.EndTooltip();
 }
Beispiel #19
0
        public static void WrappedTextTooltip(string text, float wrapWidth)
        {
            if (ImGui.IsItemHovered())
            {
                var style = ImGui.GetStyle();
                var size  = ImGui.CalcTextSize(text, wrapWidth);
                size += style.FramePadding * 2;

                ImGui.SetNextWindowSize(size);

                ImGui.BeginTooltip();
                ImGui.TextWrapped(text);
                ImGui.EndTooltip();
            }
        }
Beispiel #20
0
        private static void DisplayImageWithTooltip(IntPtr texturePointer, string name, Num.Vector2 size)
        {
            var io = ImGui.GetIO();

            ImGui.Text(name);
            ImGui.Image(texturePointer, size, Num.Vector2.Zero, Num.Vector2.One, Num.Vector4.One, Num.Vector4.One);
            var pos = ImGui.GetCursorScreenPos();

            if (ImGui.IsItemHovered())
            {
                ImGui.BeginTooltip();

                const float regionSize = 48.0f;

                var regionX = io.MousePos.X - pos.X - regionSize * 0.5f;
                if (regionX < 0.0f)
                {
                    regionX = 0.0f;
                }
                else if (regionX > size.X - regionSize)
                {
                    regionX = size.X - regionSize;
                }

                var regionY = (io.MousePos.Y - pos.Y + (size.Y + 6)) - regionSize * 0.5f;
                if (regionY < 0.0f)
                {
                    regionY = 0.0f;
                }
                else if (regionY > size.Y - regionSize)
                {
                    regionY = size.Y - regionSize;
                }

                var zoom = Game1.ScreenResolutionX / size.X;

                var uv0 = new Num.Vector2((regionX) / size.X, (regionY) / size.Y);
                var uv1 = new Num.Vector2((regionX + regionSize) / size.X, (regionY + regionSize) / size.Y);

                ImGui.Image(texturePointer,
                            new Num.Vector2(regionSize * zoom, regionSize * zoom),
                            uv0, uv1,
                            new Num.Vector4(1.0f, 1.0f, 1.0f, 1.0f),
                            new Num.Vector4(1.0f, 1.0f, 1.0f, 0.5f));

                ImGui.EndTooltip();
            }
        }
        private void BuildUI()
        {
            try {
                if (started)
                {
                    if (PluginInterface.ClientState.LocalPlayer == null)
                    {
                        Shutdown();
                        return;
                    }

                    if (gotAddress && !manuallyUnlocked)
                    {
                        if (PluginInterface.ClientState.KeyState[vkHotkey])
                        {
                            SetHotbarLock.Original(IntPtr.Add(param1Address, 0x18A48), 0, 1);
                            ImGui.BeginTooltip();
                            ImGui.Text("Hotbar Unlocked!");
                            ImGui.End();
                        }
                        else
                        {
                            SetHotbarLock.Original(IntPtr.Add(param1Address, 0x18A48), 1, 1);
                        }
                    }
                }
                else
                {
                    if (PluginInterface.ClientState.LocalPlayer != null)
                    {
                        if (delayedStart > 100)
                        {
                            Startup();
                        }
                        else
                        {
                            delayedStart += 1;
                        }
                    }
                    else
                    {
                        delayedStart = 0;
                    }
                }
            } catch (Exception ex) {
                PluginLog.LogError(ex.ToString());
            }
        }
        public static void HelpMarker(params string[] descriptions)
        {
            ImGui.TextDisabled("(?)");

            if (ImGui.IsItemHovered())
            {
                ImGui.BeginTooltip();
                ImGui.PushTextWrapPos(ImGui.GetFontSize() * 35.0f);
                foreach (var description in descriptions)
                {
                    ImGui.TextUnformatted(description);
                }
                ImGui.PopTextWrapPos();
                ImGui.EndTooltip();
            }
        }
 /// <summary>
 /// HelpMarker component to add a help icon with text on hover.
 /// </summary>
 /// <param name="helpText">The text to display on hover.</param>
 public static void HelpMarker(string helpText)
 {
     ImGui.SameLine();
     ImGui.PushFont(UiBuilder.IconFont);
     ImGui.TextDisabled(FontAwesomeIcon.InfoCircle.ToIconString());
     ImGui.PopFont();
     if (!ImGui.IsItemHovered())
     {
         return;
     }
     ImGui.BeginTooltip();
     ImGui.PushTextWrapPos(ImGui.GetFontSize() * 35.0f);
     ImGui.TextUnformatted(helpText);
     ImGui.PopTextWrapPos();
     ImGui.EndTooltip();
 }
Beispiel #24
0
		//[SecurityPermission(SecurityAction.Demand, ControlThread = true)]
		//private static void KillTheThread()
		//{
		//	BrowseThread.Abort();
		//}
		//private static Thread BrowseThread;


		private static void HelpMarker(string desc, bool sameline = true)
		{
			if (sameline) ImGui.SameLine();
			//ImGui.PushFont(UiBuilder.IconFont);
			ImGui.TextDisabled("(?)");
			//ImGui.PopFont();
			if (ImGui.IsItemHovered())
			{
				ImGui.PushFont(UiBuilder.DefaultFont);
				ImGui.BeginTooltip();
				ImGui.PushTextWrapPos(ImGui.GetFontSize() * 35.0f);
				ImGui.TextUnformatted(desc);
				ImGui.PopTextWrapPos();
				ImGui.EndTooltip();
				ImGui.PopFont();
			}
		}
Beispiel #25
0
        public void Render()
        {
            ImGui.BeginChild("Log", Vector2.Zero, false);
            ReadOnlySpan <LogEvent> logEvents = _logEventRecorder.LogEvents;
            ImDrawListPtr           drawList  = ImGui.GetWindowDrawList();

            foreach (LogEvent logEvent in logEvents)
            {
                Vector4 color = logEvent.LogLevel switch
                {
                    LogLevel.Information => Vector4.One,
                    LogLevel.Warning => new Vector4(1, 1, 0, 1),
                    LogLevel.Error => new Vector4(1, 0, 0, 1),
                    _ => ThrowHelper.Unreachable <Vector4>()
                };

                Vector2 topLeft  = ImGui.GetCursorScreenPos();
                Vector2 textSize = ImGui.CalcTextSize(logEvent.Message);
                ImGui.TextColored(color, logEvent.Message);
                if (ImGui.IsItemHovered())
                {
                    ImGui.BeginTooltip();
                    ImGui.Text("Copy to clipboard");
                    ImGui.EndTooltip();
                    drawList.AddRectFilled(
                        a: topLeft,
                        b: topLeft + textSize,
                        ImGui.GetColorU32(ImGuiCol.FrameBgHovered)
                        );
                }
                if (ImGui.IsItemClicked())
                {
                    ImGui.SetClipboardText(logEvent.Message);
                }
            }

            if (logEvents.Length > _prevEventCount)
            {
                ImGui.SetScrollHereY();
            }

            _prevEventCount = logEvents.Length;
            ImGui.EndChild();
        }
    }
        public static bool DelegateButton(string id, string text, string descr = null, Action <string> callback = null)
        {
            var buttonPressed = ImGui.Button(text);

            if (!string.IsNullOrEmpty(descr) && ImGui.IsItemHovered())
            {
                ImGui.BeginTooltip();
                ImGui.Text(descr);
                ImGui.EndTooltip();
            }

            if (buttonPressed)
            {
                callback?.Invoke(id);
            }

            return(buttonPressed);
        }
        private static bool DrawDeleteButton(FontAwesomeIcon buttonLabel, Vector2?buttonSize = null,
                                             string?tooltipText = null)
        {
            ImGui.PushStyleColor(ImGuiCol.Button, Vector4.Zero);
            ImGui.PushFont(UiBuilder.IconFont);
            var isButtonPressed = buttonSize is null
                ? ImGui.Button(buttonLabel.ToIconString())
                : ImGui.Button(buttonLabel.ToIconString(), buttonSize.Value);

            ImGui.PopFont();
            ImGui.PopStyleColor();
            if (isButtonPressed)
            {
                ImGui.OpenPopup("Sure?");
            }
            if (tooltipText is not null && ImGui.IsItemHovered())
            {
                ImGui.BeginTooltip();
                ImGui.Text(tooltipText);
                ImGui.EndTooltip();
            }

            if (!ImGui.BeginPopup("Sure?"))
            {
                return(false);
            }
            var consent = false;

            ImGui.Text("Really delete?");
            if (ImGui.Button("Yes"))
            {
                consent = true;
                ImGui.CloseCurrentPopup();
            }

            ImGui.EndPopup();
            return(consent);
        }
        public static bool ToggleButton(string id, string descr, ref bool toggled)
        {
            uint backgroundColor = toggled ? ImGui.GetColorU32(ImGuiCol.ButtonActive)
                : ImGui.GetColorU32(ImGuiCol.Button);

            ImGui.PushStyleColor(ImGuiCol.Button, backgroundColor);
            var pressed = ImGui.Button(id);

            if (pressed)
            {
                toggled = !toggled;
            }

            ImGui.PopStyleColor();

            if (!string.IsNullOrEmpty(descr) && ImGui.IsItemHovered())
            {
                ImGui.BeginTooltip();
                ImGui.Text(descr);
                ImGui.EndTooltip();
            }

            return(pressed);
        }
Beispiel #29
0
        protected override void DrawContent()
        {
            Vector2 windowSize           = ImGui.GetWindowSize();
            bool    showCurrentStatement = false;

            ImGui.PushItemWidth(-10);
            ImGui.InputTextMultiline("", ref _currentScriptExec, 1000 * 10, new Vector2(windowSize.X - 30, windowSize.Y - 100), ImGuiInputTextFlags.ReadOnly);
            showCurrentStatement = ImGui.IsItemHovered();

            if (_canStepInto)
            {
                bool step = ImGui.Button("Step Into");
                showCurrentStatement = showCurrentStatement || ImGui.IsItemHovered();
                if (step)
                {
                    _stepFunction(StepMode.Into);
                }
            }

            if (_canStepOut)
            {
                bool step = ImGui.Button("Step Out");
                showCurrentStatement = showCurrentStatement || ImGui.IsItemHovered();
                if (step)
                {
                    _stepFunction(StepMode.Out);
                }
            }

            if (showCurrentStatement)
            {
                ImGui.BeginTooltip();
                ImGui.TextColored(new Vector4(1, 0, 0, 1), _currentStatement);
                ImGui.EndTooltip();
            }
        }
Beispiel #30
0
        private static void DrawThreadSelectorCombo(TraceRecord?trace, out PlottedGraph?selectedGraph, bool abbreviate)
        {
            selectedGraph = null;
            ProtoGraph?graph = rgatState.ActiveGraph?.InternalProtoGraph;

            if (trace is not null && graph is not null)
            {
                string selString = $"{(abbreviate ? "TID" : "Thread")} {graph.ThreadID}: {graph.FirstInstrumentedModuleName}";
                if (graph.NodeCount == 0)
                {
                    selString += " [Uninstrumented]";
                }
                List <PlottedGraph> graphs = trace.GetPlottedGraphs();
                if (ImGui.TableNextColumn())
                {
                    ImGui.AlignTextToFramePadding();
                    ImGuiUtils.DrawHorizCenteredText($"{graphs.Count}x");
                    SmallWidgets.MouseoverText($"This trace has {graphs.Count} thread{(graphs.Count != 1 ? 's' : "")}");
                }

                if (ImGui.TableNextColumn())
                {
                    ImGui.SetNextItemWidth(ImGui.GetContentRegionAvail().X - 35);
                    if (ImGui.BeginCombo("##SelectorThreadCombo", selString))
                    {
                        foreach (PlottedGraph selectablegraph in graphs)
                        {
                            string caption   = $"{selectablegraph.TID}: {selectablegraph.InternalProtoGraph.FirstInstrumentedModuleName}";
                            int    nodeCount = selectablegraph.GraphNodeCount();
                            if (nodeCount == 0)
                            {
                                ImGui.PushStyleColor(ImGuiCol.Text, Themes.GetThemeColourUINT(Themes.eThemeColour.Dull1));
                                caption += " [Uninstrumented]";
                            }
                            else
                            {
                                ImGui.PushStyleColor(ImGuiCol.Text, Themes.GetThemeColourUINT(Themes.eThemeColour.WindowText));
                                caption += $" [{nodeCount} nodes]";
                            }

                            if (ImGui.Selectable(caption, graph.ThreadID == selectablegraph.TID) && nodeCount > 0)
                            {
                                selectedGraph = selectablegraph;
                            }
                            if (ImGui.IsItemHovered())
                            {
                                ImGui.BeginTooltip();
                                ImGui.Text($"Thread Start: 0x{selectablegraph.InternalProtoGraph.StartAddress:X} [{selectablegraph.InternalProtoGraph.StartModuleName}]");
                                if (selectablegraph.InternalProtoGraph.NodeList.Count > 0)
                                {
                                    NodeData?n = selectablegraph.InternalProtoGraph.GetNode(0);
                                    if (n is not null)
                                    {
                                        string insBase = System.IO.Path.GetFileName(graph.ProcessData.GetModulePath(n.GlobalModuleID));
                                        ImGui.Text($"First Instrumented: 0x{n.Address:X} [{insBase}]");
                                    }
                                }
                                ImGui.EndTooltip();
                            }
                            ImGui.PopStyleColor();
                        }
                        ImGui.EndCombo();
                    }
                    ImGui.SameLine();
                    ImGui.Text($"{ImGuiController.FA_ICON_COG}");
                }
            }
        }