Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make Inspector's shortcuts available globally again #42

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions Applications/Gorm/GormAppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,28 @@
#import "GormAppDelegate.h"
#import "GormLanguageViewController.h"

@interface Gorm : NSApplication
@end
@implementation Gorm

/*
NSApplication override to make Inspector's shortcuts available globally
*/
- (void) sendEvent: (NSEvent *)theEvent
Copy link
Member

Choose a reason for hiding this comment

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

This change concerns me because it is not the default behavior in other applications. Why do the key equivalents of every inspector need to be handled GLOBALLY? Can you explain what bug this fixes for you, what is the use-case you're attempting to address?

Copy link
Member

Choose a reason for hiding this comment

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

The other issue here is that there was a reason I moved AWAY from making Gorm use an NSApplication subclass.

Copy link
Member Author

@trunkmaster trunkmaster Nov 10, 2024

Choose a reason for hiding this comment

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

This change concerns me because it is not the default behavior in other applications.

Any application can be subclassed from NSApplication and redefine default shortcuts handling. I see no problem here.

Why do the key equivalents of every inspector need to be handled GLOBALLY? Can you explain what bug this fixes for you, what is the use-case you're attempting to address?

There's no bug it's usability enhancement. For example, if user wants to see what connections selected object has (whithout focus switch) it's handy to press shortcut whithout moving mouse and selecting "Connections" sections of Inpector.

Copy link
Member Author

Choose a reason for hiding this comment

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

The other issue here is that there was a reason I moved AWAY from making Gorm use an NSApplication subclass.

Could you please explain that reason? It might be useful for development practice.

{
if ([theEvent type] == NSKeyDown)
{
NSPanel *inspector = [[_delegate inspectorsManager] panel];
if ([inspector performKeyEquivalent: theEvent] != NO)
{
[inspector orderFront: self];
return;
}
}
[super sendEvent: theEvent];
}
@end

@interface GormDocument (Private)

- (NSMutableArray *) _collectAllObjects;
Expand Down
2 changes: 1 addition & 1 deletion Applications/Gorm/GormInfo.plist
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
NSIcon = "Gorm.tiff";
NSMainNibFile = "Gorm.gorm";
NSPrincipalClass = "NSApplication";
NSPrincipalClass = "Gorm";
NSRole = "Editor";

NSTypes = (
Expand Down
Loading