Merge branch 'master' into NSStoryboard_refactor

This commit is contained in:
Gregory John Casamento 2025-05-10 10:44:38 -04:00
commit e8d5653e47
9 changed files with 123 additions and 76 deletions

View file

@ -1,3 +1,7 @@
2025-04-30 Gregory John Casamento <greg.casamento@gmail.com>
* Headers/AppKit/NSColorSpace.h: Add NSColorSpaceModel* enumerated values.
2025-02-11 Richard Frith-Macdonald <rfm@gnu.org>
* ANNOUNCE:

View file

@ -108,7 +108,7 @@
to be used to view application help.<br /> If this is not specified
(or is an empty string) the 'best' available viewer is used (an
application whose Info.plist says that it can view files of the
appropriate type ... usually rtp or rtfd files).<br />
appropriate type ... usually rtf or rtfd files).<br />
If this is set to <code>NSHelpPanel</code> or if no application can
be used to view the help file, the help is displayed by the
shared help panel object built in to the application.

View file

@ -44,7 +44,13 @@ typedef enum _NSColorSpaceModel
NSRGBColorSpaceModel,
NSCMYKColorSpaceModel,
NSLABColorSpaceModel,
NSDeviceNColorSpaceModel
NSDeviceNColorSpaceModel,
NSColorSpaceModelUnknown = NSUnknownColorSpaceModel,
NSColorSpaceModelGray = NSGrayColorSpaceModel,
NSColorSpaceModelRGB = NSRGBColorSpaceModel,
NSColorSpaceModelCMYK = NSCMYKColorSpaceModel,
NSColorSpaceModelLAB = NSLABColorSpaceModel,
NSColorSpaceModelDeviceN = NSDeviceNColorSpaceModel
} NSColorSpaceModel;
APPKIT_EXPORT_CLASS

View file

@ -105,19 +105,19 @@ tFile=- -; else cat; fi"
*CloseUI: *PageRegion
*DefaultImageableArea: Letter
*ImageableArea Letter/US Letter: "0 0 612 792"
*ImageableArea A4/A4: "0 0 595 842"
*ImageableArea 11x17/11x17: "0 0 792 1224"
*ImageableArea A3/A3: "0 0 842 1191"
*ImageableArea A5/A5: "0 0 421 595"
*ImageableArea B5/B5 (JIS): "0 0 516 729"
*ImageableArea Env10/Envelope #10: "0 0 297 684"
*ImageableArea EnvC5/Envelope C5: "0 0 459 649"
*ImageableArea EnvDL/Envelope DL: "0 0 312 624"
*ImageableArea EnvISOB5/Envelope B5: "0 0 499 709"
*ImageableArea EnvMonarch/Envelope Monarch: "0 0 279 540"
*ImageableArea Executive/Executive: "0 0 522 756"
*ImageableArea Legal/US Legal: "0 0 612 1008"
*ImageableArea Letter/US Letter: "25 25 587 767"
*ImageableArea A4/A4: "25 25 570 817"
*ImageableArea 11x17/11x17: "30 30 762 1194"
*ImageableArea A3/A3: "25 25 817 1166"
*ImageableArea A5/A5: "25 25 396 587"
*ImageableArea B5/B5 (JIS): "20 20 496 709"
*ImageableArea Env10/Envelope #10: "20 20 277 664"
*ImageableArea EnvC5/Envelope C5: "20 20 439 629"
*ImageableArea EnvDL/Envelope DL: "20 20 292 604"
*ImageableArea EnvISOB5/Envelope B5: "20 20 479 689"
*ImageableArea EnvMonarch/Envelope Monarch: "20 20 259 526"
*ImageableArea Executive/Executive: "20 20 502 736"
*ImageableArea Legal/US Legal: "25 25 587 983"
*DefaultPaperDimension: Letter
*PaperDimension Letter/US Letter: "612 792"

View file

@ -1280,7 +1280,7 @@ typedef NSInteger GSLayoutViewAttribute;
RELEASE(_viewAlignmentRectByViewIndex);
RELEASE(_viewIndexByViewHash);
RELEASE(_constraintsByViewIndex);
RELEASE(_constraintsByViewIndex);
RELEASE(_layoutConstraintsBySolverConstraint);
RELEASE(_supportingConstraintsByConstraint);
RELEASE(_constraintsByAutoLayoutConstaintHash);
RELEASE(_internalConstraintsByViewIndex);

View file

@ -213,62 +213,82 @@
if ([viewer isEqual: @"NSHelpPanel"] == NO)
{
if (viewer && [viewer length] > 0)
{
NSDictionary *apps = [ws infoForExtension: ext];
NSDictionary *appInfo;
// Let's try to be lenient if Viewer was set instead of Viewer.app
if ([[viewer pathExtension] length] == 0)
viewer = [viewer stringByAppendingPathExtension: @"app"];
appInfo = [apps objectForKey: viewer];
// We ingore the role, supposing both Editor and Viewer are fine
if (nil == appInfo)
{
NSWarnLog(@"Designated viewer %@ is not registered for %@", viewer, ext);
viewer = nil;
}
}
if ([viewer length] == 0)
{
viewer = [ws getBestAppInRole: @"Viewer" forExtension: ext];
}
if (viewer != nil)
{
result = [[NSWorkspace sharedWorkspace] openFile: file
withApplication: viewer];
return;
result = [ws openFile: file
withApplication: viewer];
}
}
if (result == NO)
{
NSHelpPanel *panel;
NSTextView *tv;
id object = nil;
// external viewer succeeded
if (result)
return;
panel = [NSHelpPanel sharedHelpPanel];
tv = [(NSScrollView*)[panel contentView] documentView];
if (ext == nil
// fallback to internal viewer
{
NSHelpPanel *panel;
NSTextView *tv;
id object = nil;
panel = [NSHelpPanel sharedHelpPanel];
tv = [(NSScrollView*)[panel contentView] documentView];
if (ext == nil
|| [ext isEqualToString: @""]
|| [ext isEqualToString: @"txt"]
|| [ext isEqualToString: @"text"])
{
object = [NSString stringWithContentsOfFile: file];
}
else if ([ext isEqualToString: @"rtf"])
{
NSData *data = [NSData dataWithContentsOfFile: file];
{
object = [NSString stringWithContentsOfFile: file];
}
else if ([ext isEqualToString: @"rtf"])
{
NSData *data = [NSData dataWithContentsOfFile: file];
object = [[NSAttributedString alloc] initWithRTF: data
documentAttributes: 0];
AUTORELEASE (object);
}
else if ([ext isEqualToString: @"rtfd"])
{
NSFileWrapper *wrapper;
object = [[NSAttributedString alloc] initWithRTF: data
documentAttributes: 0];
AUTORELEASE (object);
}
else if ([ext isEqualToString: @"rtfd"])
{
NSFileWrapper *wrapper;
wrapper = [[NSFileWrapper alloc] initWithPath: file];
AUTORELEASE (wrapper);
object = [[NSAttributedString alloc]
initWithRTFDFileWrapper: wrapper
documentAttributes: 0];
AUTORELEASE (object);
}
wrapper = [[NSFileWrapper alloc] initWithPath: file];
AUTORELEASE (wrapper);
object = [[NSAttributedString alloc]
initWithRTFDFileWrapper: wrapper
documentAttributes: 0];
AUTORELEASE (object);
}
if (object != nil)
{
[[tv textStorage] setAttributedString: object];
[tv sizeToFit];
}
[tv setNeedsDisplay: YES];
[panel makeKeyAndOrderFront: self];
return;
}
if (object != nil)
{
[[tv textStorage] setAttributedString: object];
[tv sizeToFit];
}
[tv setNeedsDisplay: YES];
[panel makeKeyAndOrderFront: self];
return;
}
}
}

View file

@ -133,6 +133,20 @@ static NSPrintInfo *sharedPrintInfo = nil;
[[principalClass printInfoClass] setDefaultPrinter: printer];
}
- (void) _updateMargins
{
NSPrinter *printer = [self printer];
NSRect imageableRect;
NSSize paperSize;
paperSize = [printer pageSizeForPaper: [self paperName]];
imageableRect = [printer imageRectForPaper: [self paperName]];
[self setRightMargin: (paperSize.width - NSMaxX(imageableRect))];
[self setLeftMargin: imageableRect.origin.y];
[self setTopMargin: (paperSize.height - NSMaxY(imageableRect))];
[self setBottomMargin: imageableRect.origin.x];
}
//
// Instance methods
//
@ -143,8 +157,6 @@ static NSPrintInfo *sharedPrintInfo = nil;
{
NSPrinter *printer;
NSString *pageSize;
NSRect imageRect;
NSSize paperSize;
if (!(self = [super init]))
{
@ -174,14 +186,10 @@ static NSPrintInfo *sharedPrintInfo = nil;
[self setPaperName: pageSize];
/* Set default margins. */
paperSize = [printer pageSizeForPaper: pageSize];
imageRect = [printer imageRectForPaper: pageSize];
[self setRightMargin: (paperSize.width - NSMaxX(imageRect))];
[self setLeftMargin: imageRect.origin.y];
[self setTopMargin: (paperSize.height - NSMaxY(imageRect))];
[self setBottomMargin: imageRect.origin.x];
[self setOrientation: NSPortraitOrientation];
[self _updateMargins];
[self setOrientation: NSPortraitOrientation];
if (aDict != nil)
{
[_info addEntriesFromDictionary: aDict];
@ -293,6 +301,7 @@ static NSPrintInfo *sharedPrintInfo = nil;
[_info setObject: [NSValue valueWithSize:
[NSPrintInfo sizeForPaperName: name]]
forKey: NSPrintPaperSize];
[self _updateMargins];
}
- (void) setPaperSize: (NSSize)size

View file

@ -2830,9 +2830,14 @@ in the main thread.
- (void) _setNeedsDisplayInRect_real: (NSValue *)v
{
NSRect invalidRect = [v rectValue];
NSRect invalidRect;
NSView *currentView = _super_view;
if (nil == v)
return;
invalidRect = [v rectValue];
/*
* Limit to bounds, combine with old _invalidRect, and then check to see
* if the result is the same as the old _invalidRect - if it isn't then
@ -5172,6 +5177,8 @@ static NSView* findByTag(NSView *view, NSInteger aTag, NSUInteger *level)
- (void) layout
{
_needsLayout = NO;
GSAutoLayoutEngine *engine = [self _layoutEngine];
if (!engine)
{
@ -5307,7 +5314,6 @@ static NSView* findByTag(NSView *view, NSInteger aTag, NSUInteger *level)
if (_needsLayout)
{
[self layout];
_needsLayout = NO;
}
NSArray *subviews = [self subviews];

View file

@ -1,9 +1,10 @@
/* This tool opens the appropriate application from the command line
based on what type of file is being accessed.
Copyright (C) 2001 Free Software Foundation, Inc.
Copyright (C) 2001-2025 Software Foundation, Inc.
Written by: Gregory Casamento <greg_casamento@yahoo.com>
Written by: Gregory Casamento <greg.casamento@gmail.com>
Riccardo Mottola <rm@gnu.org>
Created: November 2001
This file is part of the GNUstep Project
@ -45,11 +46,12 @@
static NSString*
absolutePath(NSFileManager *fm, NSString *path)
{
if (nil == path || [path length] == 0)
return path;
if (![path isAbsolutePath])
path = [[fm currentDirectoryPath] stringByAppendingPathComponent: path] ;
path = [path stringByStandardizingPath];
if ([path isAbsolutePath] == NO)
{
path = [[fm currentDirectoryPath] stringByAppendingPathComponent: path];
}
return path;
}
@ -100,7 +102,8 @@ main(int argc, char** argv, char **env_c)
if (filetoopen)
{
exists = [fm fileExistsAtPath: arg isDirectory: &isDir];
filetoopen = absolutePath(fm, filetoopen);
exists = [fm fileExistsAtPath: filetoopen isDirectory: &isDir];
if (exists == NO)
{
if ([filetoopen hasPrefix: @"/"] == NO
@ -111,7 +114,6 @@ main(int argc, char** argv, char **env_c)
}
else
{
filetoopen = absolutePath(fm, filetoopen);
[workspace openFile: filetoopen
withApplication: application];
}