Skip to content

General GUI cleanup#92

Merged
luttje merged 24 commits intoKey2Joy:mainfrom
Aurumaker72:main
Nov 1, 2025
Merged

General GUI cleanup#92
luttje merged 24 commits intoKey2Joy:mainfrom
Aurumaker72:main

Conversation

@Aurumaker72
Copy link
Collaborator

@Aurumaker72 Aurumaker72 commented Oct 30, 2025

Summary

This PR does a general cleanup pass for the UI. Note that these changes are pretty strongly opinionated.

Connection UI/UX

The "Arm Mappings" checkbox is now a ToggleButton-like Checkbox that alternates its text between "Connect" and "Disconnect", and the mappings status label has been removed.

Device List

The device list has been enhanced to have a better placeholder, and device controls themselves have gotten a tighter layout.

The animation for device connecting/disconnecting has been removed, primarily because it didn't communicate any particularly important information. Given that this is an opinionated change, it can be reverted.

Menu

The "Save Profile" menu item has been removed, since it was just a vestige anyway.

The "Exit Program" menu item has been renamed to "Exit", and had accelerator text (Alt + F4) added.

The "User Configuration" menu item has been renamed to "Configuration".

Search Box

The search box has been moved above the listview and to the left of the profile textbox to make the UI flow more naturally. It has also been given a search icon.

Maximize Button

The maximize button has been re-enabled. Not sure why that was disabled.

Font Consistency

Some random bits and bobs used Arial instead of MS Sans Serif, so that has been changed to be more consistent.

Config Dialog

The save button has been shrunk and moved to the standard action button location (bottom right). It also no longer shows a messagebox after clicking it.

The dialog can now be resized, and its titlebar displays the text "Configuration" has no icon anymore.
The default positioning behaviour is now also centering to parent.

There is now a hotkey (Ctrl + ,) for opening the configuration dialog.

Other Stuff

There's a fix for a compilation error caused by a breaking change in Jint. Not sure how that happened.

@Aurumaker72 Aurumaker72 marked this pull request as ready for review October 30, 2025 22:58
Copilot AI review requested due to automatic review settings October 30, 2025 22:58
@Aurumaker72 Aurumaker72 marked this pull request as draft October 30, 2025 23:00
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request updates the UI layout and removes unused functionality from the Key2Joy application. The changes improve the interface by simplifying status indicators, relocating controls, and updating styling for better visual consistency.

  • Replaced status labels with a connect/disconnect button for clearer user interaction
  • Removed the "Save Profile" menu item and related functionality (as profiles auto-save)
  • Removed device activity animation/fade effect code
  • Updated API call from deprecated Environment.Realm.GlobalObject to Environment.Global

Reviewed Changes

Copilot reviewed 5 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
Key2Joy.Gui/MainForm.cs Removed ConfigureStatusLabels method and SaveProfileToolStripMenuItem_Click handler; updated SetStatusView to use button text instead of labels
Key2Joy.Gui/MainForm.Designer.cs Major UI layout changes: removed status labels, moved filter controls to profile panel, changed checkbox to button, removed save profile menu item, updated colors and sizes
Key2Joy.Gui/MainForm.resx Removed BOM character from XML declaration
Key2Joy.Gui/DeviceControl.cs Removed device activity animation feature including fade timer, paint handler, and color interpolation logic
Key2Joy.Gui/DeviceListControl.Designer.cs Updated panel colors from black/gold to transparent, adjusted sizes and margins
Key2Joy.Gui/DeviceListControl.resx Removed BOM character from XML declaration
Core/Key2Joy.Core/Mapping/Actions/Scripting/JavascriptScriptAction.cs Updated to use Environment.Global instead of Environment.Realm.GlobalObject
Files not reviewed (2)
  • Key2Joy.Gui/DeviceListControl.Designer.cs: Language not supported
  • Key2Joy.Gui/MainForm.Designer.cs: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

var methodInfo = exposedMethod.GetExecutorMethodInfo();
var @delegate = new DelegateWrapper(this.Environment, methodInfo.CreateDelegate(exposedMethod));
var currentObject = this.Environment.Realm.GlobalObject;
var currentObject = this.Environment.Global;
Copy link

Copilot AI Oct 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change from Environment.Realm.GlobalObject to Environment.Global suggests a Jint API update. Ensure that Environment.Global provides the same type and functionality as the previous Realm.GlobalObject. Verify that downstream usages (e.g., TryGetValue, FastSetProperty) remain compatible with the new property.

Suggested change
var currentObject = this.Environment.Global;
if (this.Environment.Global is not ObjectInstance globalObject)
throw new InvalidOperationException("Environment.Global is not an ObjectInstance. Cannot register scripting method.");
var currentObject = globalObject;

Copilot uses AI. Check for mistakes.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For reference: I was using a Jint preview build from a non-default NuGet registry since 3.0.0 didn't exist yet back when I worked on this.

Could you do me another favor and make 3.0.0 the version depended on in Core/Key2Joy.Core/Key2Joy.Core.csproj? It's currently set to 3.0.0-preview-488 which I guess resolves to 3.0.0 in your IDE, resulting in it working fine.

// chkArmed
//
this.chkArmed.AutoSize = true;
this.chkArmed.Appearance = System.Windows.Forms.Appearance.Button;
Copy link

Copilot AI Oct 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Converting the checkbox to a button appearance may affect keyboard accessibility. Ensure that space bar toggling still works as expected for users who navigate via keyboard, since button-styled checkboxes can sometimes behave differently from standard checkboxes.

Copilot uses AI. Check for mistakes.
Comment on lines 17 to 18
this.lblIndex.Text = $"#{device.Index}";
this.lblDevice.Text = device.Name;
Copy link

Copilot AI Oct 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The device parameter is no longer stored in the field (removed line this.device = device;), but the constructor still accepts it and uses it. If the device reference is needed later in the class lifecycle, removing this field assignment could cause issues. If it's truly unused, consider whether the event handler unsubscription device.ActivityOccurred -= ... is still handled elsewhere to prevent memory leaks.

Copilot uses AI. Check for mistakes.
use ms sans serif font everywhere instead of arial
now defined in the designer and has its visibility toggled programmatically

also the wording has been improved somewhat
@Aurumaker72 Aurumaker72 requested a review from Copilot October 30, 2025 23:52
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 7 out of 10 changed files in this pull request and generated 1 comment.

Files not reviewed (3)
  • Key2Joy.Gui/DeviceControl.Designer.cs: Language not supported
  • Key2Joy.Gui/DeviceListControl.Designer.cs: Language not supported
  • Key2Joy.Gui/MainForm.Designer.cs: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Aurumaker72 and others added 3 commits October 31, 2025 09:31
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
has no effect on functionality
@luttje
Copy link
Collaborator

luttje commented Nov 1, 2025

I don't recall enabling copilot as an automated reviewer @Aurumaker72. Let me know if it hinders you in getting work done and I will disable it. In any case: seeing you work on it this so actively is inspiring! Thanks again!

@Aurumaker72
Copy link
Collaborator Author

I don't recall enabling copilot as an automated reviewer @Aurumaker72. Let me know if it hinders you in getting work done and I will disable it. In any case: seeing you work on it this so actively is inspiring! Thanks again!

I think GitHub A/B tests it and it was just enabled for this repo as well. It's fine, though, pretty neat feature imo 😄

I will continue work on this PR and will mark it when it's ready 👍

@Aurumaker72 Aurumaker72 marked this pull request as ready for review November 1, 2025 11:43
@Aurumaker72 Aurumaker72 requested a review from Copilot November 1, 2025 11:43
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 9 out of 15 changed files in this pull request and generated 1 comment.

Files not reviewed (5)
  • Key2Joy.Gui/ConfigForm.Designer.cs: Language not supported
  • Key2Joy.Gui/DeviceControl.Designer.cs: Language not supported
  • Key2Joy.Gui/DeviceListControl.Designer.cs: Language not supported
  • Key2Joy.Gui/MainForm.Designer.cs: Language not supported
  • Key2Joy.Gui/Properties/Resources.Designer.cs: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

//
this.exitProgramToolStripMenuItem.Image = global::Key2Joy.Gui.Properties.Resources.door_out;
this.exitProgramToolStripMenuItem.Name = "exitProgramToolStripMenuItem";
this.exitProgramToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Alt | System.Windows.Forms.Keys.F4)));
Copy link

Copilot AI Nov 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alt+F4 is a system-wide shortcut for closing windows in Windows. Explicitly assigning it to the Exit menu item is unnecessary and could potentially interfere with the default behavior or create confusion if the shortcut is disabled. Consider removing this assignment to rely on the default system behavior.

Suggested change
this.exitProgramToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Alt | System.Windows.Forms.Keys.F4)));

Copilot uses AI. Check for mistakes.
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's no interference afaics, and it's just there to display the standard shortcut text (aka accelerator text)

@luttje luttje self-requested a review November 1, 2025 16:33
Copy link
Collaborator

@luttje luttje left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can follow the reasoning behind your UX changes. Thanks for lending your expertise on this matter. The changes LGTM, thanks!

I have one small request for a change, to do with the Jint version we depend on. If you can change that to 3.0.0 for us that'd be great.

After that I will approve and merge these changes. 👍

var methodInfo = exposedMethod.GetExecutorMethodInfo();
var @delegate = new DelegateWrapper(this.Environment, methodInfo.CreateDelegate(exposedMethod));
var currentObject = this.Environment.Realm.GlobalObject;
var currentObject = this.Environment.Global;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For reference: I was using a Jint preview build from a non-default NuGet registry since 3.0.0 didn't exist yet back when I worked on this.

Could you do me another favor and make 3.0.0 the version depended on in Core/Key2Joy.Core/Key2Joy.Core.csproj? It's currently set to 3.0.0-preview-488 which I guess resolves to 3.0.0 in your IDE, resulting in it working fine.

@Aurumaker72
Copy link
Collaborator Author

I can follow the reasoning behind your UX changes. Thanks for lending your expertise on this matter. The changes LGTM, thanks!

I have one small request for a change, to do with the Jint version we depend on. If you can change that to 3.0.0 for us that'd be great.

After that I will approve and merge these changes. 👍

Yeah, sure, I can do that :)

@luttje luttje merged commit fdfdfe1 into Key2Joy:main Nov 1, 2025
1 check passed
@luttje
Copy link
Collaborator

luttje commented Nov 1, 2025

Thanks for these contributions!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants