mirror of
https://github.com/brues-code/ClassicAPI.git
synced 2026-11-17 00:16:02 +00:00
Ports retail's Blizzard_Settings_Shared (Settings, categories, canvas and vertical layouts, the setting controls, key binding rows, SettingsPanel, SettingsInbound) as the one options window. Addons of both eras land in it: newer addons register through the Settings API, and the 3.3.5 InterfaceOptions_AddCategory API (Ace3's AddToBlizOptions) now registers a canvas category. Its panel protocol maps onto the window's: okay on commit (Close, Apply, Escape), default and refresh where the window calls OnDefault / OnRefresh, cancel only when the window closes without a commit. A panel's name is its category ID, as Ace3 and newer addons set it. The old InterfaceOptionsFrame* names alias the window's frames so addons that restyle or overlay them keep working. ClassicAPI's own pages are vertical layouts of Settings controls (cvar and proxy settings, key binding rows, a ClassicAPI number box for settings that take any number), so the window's search finds them. They are the window's game categories, at the root of its first tab, which reads ClassicAPI; addons go on the AddOns tab. C_SettingsUtil.OpenSettingsPanel and NotifySettingsLoaded fire SETTINGS_PANEL_OPEN and SETTINGS_LOADED through the engine's event dispatcher (Event::Custom::FireValues), passing the category ID as given. Also: slider:SetEnabled, Enum.BindingSet, C_CVar.GetCVar / GetCVarDefault / RegisterCVar, C_KeyBindings.GetBindingIndex and its two context answers, and retail's CvarUtil, BindingUtil, MinimalSlider, DropdownWithSteppers and ColorPickerFrame:SetupColorPickerAndShow. Engine changes the window needs: - CVAR_UPDATE(cvarName, value) for every change of a cvar Lua can see, from a hook on CVar::Set (0x0063DF50). 1.12 fires CVAR_UPDATE only from Script_SetCVar with a caller's token. The change is queued and fired at the head of the next UI frame, never inside the setter: the engine sets cvars mid-way through its own work while a script runs further up the stack. - Script SetParent (0x007A1550) shows a frame that is shown under a visible parent, as 3.3.5's CSimpleFrame::SetParent does; 1.12's (0x0076AB10) re-shows only a frame that was visible before. The key binding rows move their buttons onto an input blocker and back after the blocker is hidden. - The child walks of the frame show (0x0076AE10) and hide (0x0076AD50) run on a copy of the child list and skip a child that has left. Each child runs its OnShow / OnHide inside the walk, and 1.12 (and 3.3.5, and 4.3.4) read the next node only afterwards, from a node a reparenting script may have freed. Auctionator's options page opens another page from its OnShow, and the window takes the first out of its canvas with SetParent(nil) while the canvas is being shown. 1.12 specifics in the port: - ToggleGameMenu() without an argument is the Escape handler and can SpellStopCasting or ClearTarget, so closing returns to the game menu through ShowUIPanel(GameMenuFrame). - StaticPopup_EscapePressed runs OnCancel(data, "clicked"), so button2 is always the dialogs' no-op choice. Only Turtle's StaticPopup has button3 / OnAlt; stock 1.12 shows two buttons. - The layout-cache reader (0x4905e0) replaces a movable or resizable frame's anchors and size from a saved record, so the window is neither: it has no drag or size handle. - A $parent name under an unnamed frame takes the nearest named ancestor's name, so pooled rows avoid templates that anchor slices by name (UIPanelButtonTemplate2, InputBoxTemplate). - GetChecked returns 1 or nil, GetBinding has no category, and GetBindingText is FrameXML Lua that needs the "KEY_" prefix. - The slider rounds every value to its step in single-precision floats, and the rounding does not settle, so a value set from a setting does not report back as a change. - Retail's Options and control atlases do not exist; the controls use 1.12's checkbox, slider, dropdown and spellbook page arrows, the frames the tooltip backdrop. Retail's strings are added in all eight locales. Not ported yet: the Keybindings category.