/// <summary> /// Fix a bug affecting how the window is sized when maximized: /// the window is slightly larger than it should be, causing well placed elements on the right and bottom edge /// to be offscreen and prevent an autohide taskbar to be shown like normal. /// </summary> private void SizingFix() { if (Settings.Default.AutoHideTaskBarFix) { // If Single, WindowInitialized() cause a display bug to minimize/maximize/close buttons this.WindowStyle = WindowStyle.None; WindowSizing.WindowInitialized(this); // Can also fix the taskbar problem, but the program's size must be lower than the screen size //this.MaxHeight = System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Height - 1; } }
protected override ConsoleWindow BuildInterface(string suggestedName = "") { var window = NewWindow(135315, "Build Mode Tools", WindowSizing.GetSizeCentral(0.3f, 0.9f)); window.DisplayTextPrompt = false; window.AllScreens.Clear(); window.AllScreens.Add(new BlockSearchTab(() => DeactivateGui(), window, _focus)); window.AllScreens.Add(new BlockCounterTab(window)); window.Screen = window.AllScreens[0]; return(window); }
protected override ConsoleWindow BuildInterface(string suggestedName = "") { ulong buildFrame = GameTimer.Instance.FrameCounter; var window = NewWindow(135316, "Calculator", WindowSizing.GetSizeCentral(0.5f, 0.8f)); window.DisplayTextPrompt = false; var seg1 = window.Screen.CreateStandardSegment(); seg1.AddInterpretter(new CodeDisplayArea <Calculator>(_focus, M.m <Calculator>(x => x.Log), M.m <Calculator>(x => x.LineNumber), M.m <Calculator>("Log"), M.m <Calculator>(new ToolTip("")))); var seg2 = window.Screen.CreateStandardSegment(); seg2.AddInterpretter(TextInputWithKeyListener <Calculator> .Quick(_focus, M.m <Calculator>(x => expression), "Expression", new ToolTip( "Math expression\n" + "Type \"help()\" to view a list of functions and variables\n" + "Press <Enter> to evaluate\n" + "Press <Up>/<Down> to use previous inputs\n" + "Use \"let <name> = <value>\" to define custom variable\n" + "The variable \"_\" is the last output"), (x, exp) => expression = exp, CreateKeyPressEventUniversal(ts => { _focus.Evaluate(expression); expression = ""; }, KeyCode.Return, KeyCode.KeypadEnter), CreateKeyPressEventUniversal(ts => expression = _focus.GetPreviousInput(), KeyCode.UpArrow), CreateKeyPressEventUniversal(ts => expression = _focus.GetNextInput(), KeyCode.DownArrow), CreateKeyPressEvent(ts => OnQuitPressed(), () => BtKeyMap.Instance.GetKeyDef(KeyInputsBt.Calculator)), CreateKeyPressEventUniversal(ts => OnQuitPressed(), KeyCode.Escape) )); return(window); void OnQuitPressed() { // GetKeyDef(KeyInputsBt.Calculator) may return true in the first frame the window opens if (GameTimer.Instance.FrameCounter != buildFrame) { DeactivateGui(); } } }
protected override ConsoleWindow BuildInterface(string suggestedName = "") { var window = NewWindow("Mod Notifier", WindowSizing.GetCentralNarrowTall()); var seg0 = window.Screen.CreateStandardSegment(); seg0.AddInterpretter(SubjectiveButton <ModNotifierBlock> .Quick(_focus, "Refresh mod list", new ToolTip(""), x => { _focus.Refresh(); TriggerRebuild(); })); foreach (var pair in _focus.mods) { var mod = pair.Value; window.Screen.CreateHeader(mod.name.ToString(), new ToolTip(pair.Key.ToString())); var seg1 = window.Screen.CreateStandardSegment(); seg1.AddInterpretter(SubjectiveToggle <ModNotifierBlock.Mod> .Quick(mod, "Is dependency", new ToolTip("Do our construct depend on this mod?"), (x, value) => x.enabled = value, x => x.enabled)); seg1.AddInterpretter(TextInput <ModNotifierBlock.Mod> .Quick(mod, M.m <ModNotifierBlock.Mod>(x => x.description), "Mod description", new ToolTip("You can include a description of the mod, why do we need this, what will not work if it's not installed, etc"), (x, value) => x.description = value)); seg1.AddInterpretter(TextInput <ModNotifierBlock.Mod> .Quick(mod, M.m <ModNotifierBlock.Mod>(x => x.manifest), "modmanifest.json URI", new ToolTip("Leave blank if the mod doesn't use FtdModManager"), (x, value) => x.manifest = value)); seg1.AddInterpretter(TextInput <ModNotifierBlock.Mod> .Quick(mod, M.m <ModNotifierBlock.Mod>(x => x.link), "External link", new ToolTip("An external link for the mod. Leave blank if you don't have one"), (x, value) => x.link = value)); } return(window); }
/// <summary> /// Default constructor /// </summary> public RibbonWindow() { this.SizeChanged += this.OnSizeChanged; this.windowSizing = new WindowSizing(this); }
protected override ConsoleWindow BuildInterface(string suggestedName = "") { var window = NewWindow(135317, "3D Hologram Projector", WindowSizing.GetSizeCentral(0.7f, 0.5f)); window.DisplayTextPrompt = false; window.Screen.CreateHeader("File", new ToolTip("Configure loading options")); var seg1 = window.Screen.CreateStandardSegment(); seg1.AddInterpretter(TextInput <Holo3D> .Quick(_focus, M.m <Holo3D>(x => x.Path), "Path", new ToolTip("Type a local path into the box below to load an .obj file for the hologram"), (x, value) => x.Path = value)); seg1.AddInterpretter(SubjectiveButton <Holo3D> .Quick(_focus, "Reload 3D Model", new ToolTip("Load the .obj and all related files and display the model as a hologram"), (x) => x.Reload())); var seg2 = window.Screen.CreateStandardHorizontalSegment(); seg2.AddInterpretter(SubjectiveToggle <Holo3D> .Quick(_focus, "Enabled", new ToolTip("Should the hologram display?"), (x, value) => x.Enabled = value, x => x.Enabled)); seg2.AddInterpretter(SubjectiveToggle <Holo3D> .Quick(_focus, "Display on start", new ToolTip("If turned off, the hologram will only load when you press the \"Reload\" button. " + "Otherwise, it will load immediately after the Construct is loaded (it may cause some serious lag)."), (x, value) => x.displayOnStart = value, x => x.displayOnStart)); var items = Holo3D.shaders.Select(x => new DropDownMenuAltItem <Shader> { Name = x.name, ObjectForAction = x, ToolTip = "Shader to use\nPress \"Reload 3D Model\" button to apply" }).ToArray(); var menu = new DropDownMenuAlt <Shader>(); menu.SetItems(items); seg2.AddInterpretter(new DropDown <Holo3D, Shader>(_focus, menu, (x, shader) => x.shader == shader, (x, shader) => x.shader = shader)); window.Screen.CreateHeader("Transform", new ToolTip("Configure position, rotation and scale")); var seg3 = window.Screen.CreateStandardSegment(); seg3.AddInterpretter(SubjectiveFloatClampedWithBarFromMiddle <Holo3D> .Quick(_focus, -100, 100, 0.1f, 0, M.m <Holo3D>(x => x.pos.z), "Forward/Back translation {0}m", (x, value) => { x.pos.z = value; x.SetLocalTransform(); }, new ToolTip("Position.z"))); seg3.AddInterpretter(SubjectiveFloatClampedWithBarFromMiddle <Holo3D> .Quick(_focus, -100, 100, 0.1f, 0, M.m <Holo3D>(x => x.pos.x), "Left/Right translation {0}m", (x, value) => { x.pos.x = value; x.SetLocalTransform(); }, new ToolTip("Position.x"))); seg3.AddInterpretter(SubjectiveFloatClampedWithBarFromMiddle <Holo3D> .Quick(_focus, -100, 100, 0.1f, 0, M.m <Holo3D>(x => x.pos.y), "Up/Down translation {0}m", (x, value) => { x.pos.y = value; x.SetLocalTransform(); }, new ToolTip("Position.y"))); seg3.AddInterpretter(SubjectiveFloatClampedWithBarFromMiddle <Holo3D> .Quick(_focus, -180, 180, 1, 0, M.m <Holo3D>(x => x.rot.x), "Pitch {0}°", (x, value) => { x.rot.x = value; x.SetLocalTransform(); }, new ToolTip("Rotation.x"))); seg3.AddInterpretter(SubjectiveFloatClampedWithBarFromMiddle <Holo3D> .Quick(_focus, -180, 180, 1, 0, M.m <Holo3D>(x => x.rot.z), "Roll {0}°", (x, value) => { x.rot.z = value; x.SetLocalTransform(); }, new ToolTip("Rotation.z"))); seg3.AddInterpretter(SubjectiveFloatClampedWithBarFromMiddle <Holo3D> .Quick(_focus, -180, 180, 1, 0, M.m <Holo3D>(x => x.rot.y), "Yaw {0}°", (x, value) => { x.rot.y = value; x.SetLocalTransform(); }, new ToolTip("Rotation.y"))); seg3.AddInterpretter(SubjectiveFloatClampedWithBarFromMiddle <Holo3D> .Quick(_focus, 0.01f, 100, 0.01f, 1, M.m <Holo3D>(x => x.scale.z), "Forward/Back scale {0}x", (x, value) => { x.scale.z = value; x.SetLocalTransform(); }, new ToolTip("Scale.z"))); seg3.AddInterpretter(SubjectiveFloatClampedWithBarFromMiddle <Holo3D> .Quick(_focus, 0.01f, 100, 0.01f, 1, M.m <Holo3D>(x => x.scale.x), "Left/Right scale {0}x", (x, value) => { x.scale.x = value; x.SetLocalTransform(); }, new ToolTip("Scale.x"))); seg3.AddInterpretter(SubjectiveFloatClampedWithBarFromMiddle <Holo3D> .Quick(_focus, 0.01f, 100, 0.01f, 1, M.m <Holo3D>(x => x.scale.y), "Up/Down scale {0}x", (x, value) => { x.scale.y = value; x.SetLocalTransform(); }, new ToolTip("Scale.y"))); return(window); }
public static extern void cvNamedWindow(string name, WindowSizing sizing);
void Window1_SourceInitialized(object sender, EventArgs e) { WindowSizing.WindowInitialized(this); }
protected override ConsoleWindow BuildInterface(string suggestedName = "") { var window1 = NewWindow("Mod List", WindowSizing.GetLhs()); window1.DisplayTextPrompt = false; var seg1 = window1.Screen.CreateStandardSegment(); foreach (var mod in _focus.mods) { var btn = seg1.AddInterpretter(SubjectiveButton <ModPreferences> .Quick(mod, mod.modName, new ToolTip(mod.basePath, 400), x => { selected = x; })); btn.Color = M.m <ModPreferences>(x => selected == x ? Color.green : Color.white); } var window2 = NewWindow("Mod Manager", WindowSizing.GetRhs()); window2.DisplayTextPrompt = false; window2.Screen.CreateHeader("Mod Options", new ToolTip("Options for the selected mod")); var seg2 = window2.Screen.CreateStandardSegment(); seg2.SetConditionalDisplay(() => selected != null); seg2.AddInterpretter(SubjectiveDisplay <Manager> .Quick(_focus, M.m <Manager>( x => { if (selected.Managed) { return("This mod is managed by FtdModManager"); } else { return("This mod is <b>not</b> managed by FtdModManager"); } } ), "Information about this mod")); var items = Enum.GetNames(typeof(UpdateType)).Select(x => new DropDownMenuAltItem <UpdateType> { Name = x, ToolTip = x }); var menu = new DropDownMenuAlt <UpdateType>(); menu.SetItems(items.ToArray()); seg2.AddInterpretter(new DropDown <Manager, UpdateType>(_focus, menu, (manager, x) => x == selected.updateType, (manager, x) => _focus.SetUpdateType(selected, x))); seg2.AddInterpretter(SubjectiveButton <Manager> .Quick(_focus, "Check update", new ToolTip("Check update"), x => { x.CheckUpdate(selected); })); seg2.AddInterpretter(SubjectiveButton <Manager> .Quick(_focus, "Uninstall", new ToolTip("Uninstall mod"), x => { _focus.DetectMods(); TriggerRebuild(); })); window2.Screen.CreateSpace(); window2.Screen.CreateHeader("Mod Installation", new ToolTip("Install mod, etc.")); var seg3 = window2.Screen.CreateStandardSegment(); seg3.AddInterpretter(SubjectiveButton <Manager> .Quick(_focus, "Install new mod", new ToolTip("Install new mod"), x => preparingInstall = true)) .SetConditionalDisplayFunction(() => !preparingInstall); seg3.AddInterpretter(TextInput <Manager> .Quick(_focus, M.m <Manager>(x => manifestUri), "Install URI", new ToolTip("Paste the URI of the modmanifest.json here"), (manager, x) => manifestUri = x)) .SetConditionalDisplayFunction(() => preparingInstall); seg3.AddInterpretter(TextInput <Manager> .Quick(_focus, M.m <Manager>(x => modDir), "Install path (Optional)", new ToolTip("The installation directory of the new mod. Leave empty to use default value"), (manager, x) => modDir = x)) .SetConditionalDisplayFunction(() => preparingInstall); var seg4 = window2.Screen.CreateStandardHorizontalSegment(); seg4.AddInterpretter(SubjectiveButton <Manager> .Quick(_focus, "Install", new ToolTip("Install new mod!"), x => { _focus.Install(manifestUri, modDir).ContinueWith(y => { isInstalling = false; preparingInstall = false; manifestUri = ""; modDir = ""; _focus.DetectMods(); TriggerRebuild(); }); })) .SetConditionalDisplayFunction(() => preparingInstall && !isInstalling); seg4.AddInterpretter(SubjectiveButton <Manager> .Quick(_focus, "Cancel", new ToolTip("Cancel mod installation"), x => preparingInstall = false)) .SetConditionalDisplayFunction(() => preparingInstall && !isInstalling); window2.Screen.CreateHeader("Miscellaneous", new ToolTip("Other useful operations")); var seg5 = window2.Screen.CreateStandardSegment(); (seg5.AddInterpretter(SubjectiveButton <Manager> .Quick(_focus, "Restart FtD", new ToolTip("Restart FtD in order to reload mods"), x => _focus.RestartGame())) .SetConditionalDisplayFunction(() => !isInstalling) as SubjectiveButton <Manager>) .Color = M.m <Manager>(new Color(255 / 255f, 179 / 255f, 179 / 255f)); //window.Screen.CreateSpace(); return(window1); }