mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-30 12:50:40 +00:00
Merge branch 'master' into NSStoryboard_refactor
This commit is contained in:
commit
e8d5653e47
9 changed files with 123 additions and 76 deletions
|
@ -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>
|
2025-02-11 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
* ANNOUNCE:
|
* ANNOUNCE:
|
||||||
|
|
|
@ -108,7 +108,7 @@
|
||||||
to be used to view application help.<br /> If this is not specified
|
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
|
(or is an empty string) the 'best' available viewer is used (an
|
||||||
application whose Info.plist says that it can view files of the
|
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
|
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
|
be used to view the help file, the help is displayed by the
|
||||||
shared help panel object built in to the application.
|
shared help panel object built in to the application.
|
||||||
|
|
|
@ -44,7 +44,13 @@ typedef enum _NSColorSpaceModel
|
||||||
NSRGBColorSpaceModel,
|
NSRGBColorSpaceModel,
|
||||||
NSCMYKColorSpaceModel,
|
NSCMYKColorSpaceModel,
|
||||||
NSLABColorSpaceModel,
|
NSLABColorSpaceModel,
|
||||||
NSDeviceNColorSpaceModel
|
NSDeviceNColorSpaceModel,
|
||||||
|
NSColorSpaceModelUnknown = NSUnknownColorSpaceModel,
|
||||||
|
NSColorSpaceModelGray = NSGrayColorSpaceModel,
|
||||||
|
NSColorSpaceModelRGB = NSRGBColorSpaceModel,
|
||||||
|
NSColorSpaceModelCMYK = NSCMYKColorSpaceModel,
|
||||||
|
NSColorSpaceModelLAB = NSLABColorSpaceModel,
|
||||||
|
NSColorSpaceModelDeviceN = NSDeviceNColorSpaceModel
|
||||||
} NSColorSpaceModel;
|
} NSColorSpaceModel;
|
||||||
|
|
||||||
APPKIT_EXPORT_CLASS
|
APPKIT_EXPORT_CLASS
|
||||||
|
|
|
@ -105,19 +105,19 @@ tFile=- -; else cat; fi"
|
||||||
*CloseUI: *PageRegion
|
*CloseUI: *PageRegion
|
||||||
|
|
||||||
*DefaultImageableArea: Letter
|
*DefaultImageableArea: Letter
|
||||||
*ImageableArea Letter/US Letter: "0 0 612 792"
|
*ImageableArea Letter/US Letter: "25 25 587 767"
|
||||||
*ImageableArea A4/A4: "0 0 595 842"
|
*ImageableArea A4/A4: "25 25 570 817"
|
||||||
*ImageableArea 11x17/11x17: "0 0 792 1224"
|
*ImageableArea 11x17/11x17: "30 30 762 1194"
|
||||||
*ImageableArea A3/A3: "0 0 842 1191"
|
*ImageableArea A3/A3: "25 25 817 1166"
|
||||||
*ImageableArea A5/A5: "0 0 421 595"
|
*ImageableArea A5/A5: "25 25 396 587"
|
||||||
*ImageableArea B5/B5 (JIS): "0 0 516 729"
|
*ImageableArea B5/B5 (JIS): "20 20 496 709"
|
||||||
*ImageableArea Env10/Envelope #10: "0 0 297 684"
|
*ImageableArea Env10/Envelope #10: "20 20 277 664"
|
||||||
*ImageableArea EnvC5/Envelope C5: "0 0 459 649"
|
*ImageableArea EnvC5/Envelope C5: "20 20 439 629"
|
||||||
*ImageableArea EnvDL/Envelope DL: "0 0 312 624"
|
*ImageableArea EnvDL/Envelope DL: "20 20 292 604"
|
||||||
*ImageableArea EnvISOB5/Envelope B5: "0 0 499 709"
|
*ImageableArea EnvISOB5/Envelope B5: "20 20 479 689"
|
||||||
*ImageableArea EnvMonarch/Envelope Monarch: "0 0 279 540"
|
*ImageableArea EnvMonarch/Envelope Monarch: "20 20 259 526"
|
||||||
*ImageableArea Executive/Executive: "0 0 522 756"
|
*ImageableArea Executive/Executive: "20 20 502 736"
|
||||||
*ImageableArea Legal/US Legal: "0 0 612 1008"
|
*ImageableArea Legal/US Legal: "25 25 587 983"
|
||||||
|
|
||||||
*DefaultPaperDimension: Letter
|
*DefaultPaperDimension: Letter
|
||||||
*PaperDimension Letter/US Letter: "612 792"
|
*PaperDimension Letter/US Letter: "612 792"
|
||||||
|
|
|
@ -1280,7 +1280,7 @@ typedef NSInteger GSLayoutViewAttribute;
|
||||||
RELEASE(_viewAlignmentRectByViewIndex);
|
RELEASE(_viewAlignmentRectByViewIndex);
|
||||||
RELEASE(_viewIndexByViewHash);
|
RELEASE(_viewIndexByViewHash);
|
||||||
RELEASE(_constraintsByViewIndex);
|
RELEASE(_constraintsByViewIndex);
|
||||||
RELEASE(_constraintsByViewIndex);
|
RELEASE(_layoutConstraintsBySolverConstraint);
|
||||||
RELEASE(_supportingConstraintsByConstraint);
|
RELEASE(_supportingConstraintsByConstraint);
|
||||||
RELEASE(_constraintsByAutoLayoutConstaintHash);
|
RELEASE(_constraintsByAutoLayoutConstaintHash);
|
||||||
RELEASE(_internalConstraintsByViewIndex);
|
RELEASE(_internalConstraintsByViewIndex);
|
||||||
|
|
|
@ -213,62 +213,82 @@
|
||||||
|
|
||||||
if ([viewer isEqual: @"NSHelpPanel"] == NO)
|
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)
|
if ([viewer length] == 0)
|
||||||
{
|
{
|
||||||
viewer = [ws getBestAppInRole: @"Viewer" forExtension: ext];
|
viewer = [ws getBestAppInRole: @"Viewer" forExtension: ext];
|
||||||
}
|
}
|
||||||
if (viewer != nil)
|
if (viewer != nil)
|
||||||
{
|
{
|
||||||
result = [[NSWorkspace sharedWorkspace] openFile: file
|
result = [ws openFile: file
|
||||||
withApplication: viewer];
|
withApplication: viewer];
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result == NO)
|
// external viewer succeeded
|
||||||
{
|
if (result)
|
||||||
NSHelpPanel *panel;
|
return;
|
||||||
NSTextView *tv;
|
|
||||||
id object = nil;
|
|
||||||
|
|
||||||
panel = [NSHelpPanel sharedHelpPanel];
|
// fallback to internal viewer
|
||||||
tv = [(NSScrollView*)[panel contentView] documentView];
|
{
|
||||||
if (ext == nil
|
NSHelpPanel *panel;
|
||||||
|
NSTextView *tv;
|
||||||
|
id object = nil;
|
||||||
|
|
||||||
|
panel = [NSHelpPanel sharedHelpPanel];
|
||||||
|
tv = [(NSScrollView*)[panel contentView] documentView];
|
||||||
|
if (ext == nil
|
||||||
|| [ext isEqualToString: @""]
|
|| [ext isEqualToString: @""]
|
||||||
|| [ext isEqualToString: @"txt"]
|
|| [ext isEqualToString: @"txt"]
|
||||||
|| [ext isEqualToString: @"text"])
|
|| [ext isEqualToString: @"text"])
|
||||||
{
|
{
|
||||||
object = [NSString stringWithContentsOfFile: file];
|
object = [NSString stringWithContentsOfFile: file];
|
||||||
}
|
}
|
||||||
else if ([ext isEqualToString: @"rtf"])
|
else if ([ext isEqualToString: @"rtf"])
|
||||||
{
|
{
|
||||||
NSData *data = [NSData dataWithContentsOfFile: file];
|
NSData *data = [NSData dataWithContentsOfFile: file];
|
||||||
|
|
||||||
object = [[NSAttributedString alloc] initWithRTF: data
|
object = [[NSAttributedString alloc] initWithRTF: data
|
||||||
documentAttributes: 0];
|
documentAttributes: 0];
|
||||||
AUTORELEASE (object);
|
AUTORELEASE (object);
|
||||||
}
|
}
|
||||||
else if ([ext isEqualToString: @"rtfd"])
|
else if ([ext isEqualToString: @"rtfd"])
|
||||||
{
|
{
|
||||||
NSFileWrapper *wrapper;
|
NSFileWrapper *wrapper;
|
||||||
|
|
||||||
wrapper = [[NSFileWrapper alloc] initWithPath: file];
|
wrapper = [[NSFileWrapper alloc] initWithPath: file];
|
||||||
AUTORELEASE (wrapper);
|
AUTORELEASE (wrapper);
|
||||||
object = [[NSAttributedString alloc]
|
object = [[NSAttributedString alloc]
|
||||||
initWithRTFDFileWrapper: wrapper
|
initWithRTFDFileWrapper: wrapper
|
||||||
documentAttributes: 0];
|
documentAttributes: 0];
|
||||||
AUTORELEASE (object);
|
AUTORELEASE (object);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (object != nil)
|
if (object != nil)
|
||||||
{
|
{
|
||||||
[[tv textStorage] setAttributedString: object];
|
[[tv textStorage] setAttributedString: object];
|
||||||
[tv sizeToFit];
|
[tv sizeToFit];
|
||||||
}
|
}
|
||||||
[tv setNeedsDisplay: YES];
|
[tv setNeedsDisplay: YES];
|
||||||
[panel makeKeyAndOrderFront: self];
|
[panel makeKeyAndOrderFront: self];
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -133,6 +133,20 @@ static NSPrintInfo *sharedPrintInfo = nil;
|
||||||
[[principalClass printInfoClass] setDefaultPrinter: printer];
|
[[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
|
// Instance methods
|
||||||
//
|
//
|
||||||
|
@ -143,8 +157,6 @@ static NSPrintInfo *sharedPrintInfo = nil;
|
||||||
{
|
{
|
||||||
NSPrinter *printer;
|
NSPrinter *printer;
|
||||||
NSString *pageSize;
|
NSString *pageSize;
|
||||||
NSRect imageRect;
|
|
||||||
NSSize paperSize;
|
|
||||||
|
|
||||||
if (!(self = [super init]))
|
if (!(self = [super init]))
|
||||||
{
|
{
|
||||||
|
@ -174,14 +186,10 @@ static NSPrintInfo *sharedPrintInfo = nil;
|
||||||
[self setPaperName: pageSize];
|
[self setPaperName: pageSize];
|
||||||
|
|
||||||
/* Set default margins. */
|
/* Set default margins. */
|
||||||
paperSize = [printer pageSizeForPaper: pageSize];
|
[self _updateMargins];
|
||||||
imageRect = [printer imageRectForPaper: pageSize];
|
|
||||||
[self setRightMargin: (paperSize.width - NSMaxX(imageRect))];
|
[self setOrientation: NSPortraitOrientation];
|
||||||
[self setLeftMargin: imageRect.origin.y];
|
|
||||||
[self setTopMargin: (paperSize.height - NSMaxY(imageRect))];
|
|
||||||
[self setBottomMargin: imageRect.origin.x];
|
|
||||||
[self setOrientation: NSPortraitOrientation];
|
|
||||||
|
|
||||||
if (aDict != nil)
|
if (aDict != nil)
|
||||||
{
|
{
|
||||||
[_info addEntriesFromDictionary: aDict];
|
[_info addEntriesFromDictionary: aDict];
|
||||||
|
@ -293,6 +301,7 @@ static NSPrintInfo *sharedPrintInfo = nil;
|
||||||
[_info setObject: [NSValue valueWithSize:
|
[_info setObject: [NSValue valueWithSize:
|
||||||
[NSPrintInfo sizeForPaperName: name]]
|
[NSPrintInfo sizeForPaperName: name]]
|
||||||
forKey: NSPrintPaperSize];
|
forKey: NSPrintPaperSize];
|
||||||
|
[self _updateMargins];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) setPaperSize: (NSSize)size
|
- (void) setPaperSize: (NSSize)size
|
||||||
|
|
|
@ -2830,9 +2830,14 @@ in the main thread.
|
||||||
|
|
||||||
- (void) _setNeedsDisplayInRect_real: (NSValue *)v
|
- (void) _setNeedsDisplayInRect_real: (NSValue *)v
|
||||||
{
|
{
|
||||||
NSRect invalidRect = [v rectValue];
|
NSRect invalidRect;
|
||||||
NSView *currentView = _super_view;
|
NSView *currentView = _super_view;
|
||||||
|
|
||||||
|
if (nil == v)
|
||||||
|
return;
|
||||||
|
|
||||||
|
invalidRect = [v rectValue];
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Limit to bounds, combine with old _invalidRect, and then check to see
|
* 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
|
* 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
|
- (void) layout
|
||||||
{
|
{
|
||||||
|
_needsLayout = NO;
|
||||||
|
|
||||||
GSAutoLayoutEngine *engine = [self _layoutEngine];
|
GSAutoLayoutEngine *engine = [self _layoutEngine];
|
||||||
if (!engine)
|
if (!engine)
|
||||||
{
|
{
|
||||||
|
@ -5307,7 +5314,6 @@ static NSView* findByTag(NSView *view, NSInteger aTag, NSUInteger *level)
|
||||||
if (_needsLayout)
|
if (_needsLayout)
|
||||||
{
|
{
|
||||||
[self layout];
|
[self layout];
|
||||||
_needsLayout = NO;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NSArray *subviews = [self subviews];
|
NSArray *subviews = [self subviews];
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
/* This tool opens the appropriate application from the command line
|
/* This tool opens the appropriate application from the command line
|
||||||
based on what type of file is being accessed.
|
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
|
Created: November 2001
|
||||||
|
|
||||||
This file is part of the GNUstep Project
|
This file is part of the GNUstep Project
|
||||||
|
@ -45,11 +46,12 @@
|
||||||
static NSString*
|
static NSString*
|
||||||
absolutePath(NSFileManager *fm, NSString *path)
|
absolutePath(NSFileManager *fm, NSString *path)
|
||||||
{
|
{
|
||||||
|
if (nil == path || [path length] == 0)
|
||||||
|
return path;
|
||||||
|
|
||||||
|
if (![path isAbsolutePath])
|
||||||
|
path = [[fm currentDirectoryPath] stringByAppendingPathComponent: path] ;
|
||||||
path = [path stringByStandardizingPath];
|
path = [path stringByStandardizingPath];
|
||||||
if ([path isAbsolutePath] == NO)
|
|
||||||
{
|
|
||||||
path = [[fm currentDirectoryPath] stringByAppendingPathComponent: path];
|
|
||||||
}
|
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,7 +102,8 @@ main(int argc, char** argv, char **env_c)
|
||||||
|
|
||||||
if (filetoopen)
|
if (filetoopen)
|
||||||
{
|
{
|
||||||
exists = [fm fileExistsAtPath: arg isDirectory: &isDir];
|
filetoopen = absolutePath(fm, filetoopen);
|
||||||
|
exists = [fm fileExistsAtPath: filetoopen isDirectory: &isDir];
|
||||||
if (exists == NO)
|
if (exists == NO)
|
||||||
{
|
{
|
||||||
if ([filetoopen hasPrefix: @"/"] == NO
|
if ([filetoopen hasPrefix: @"/"] == NO
|
||||||
|
@ -111,7 +114,6 @@ main(int argc, char** argv, char **env_c)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
filetoopen = absolutePath(fm, filetoopen);
|
|
||||||
[workspace openFile: filetoopen
|
[workspace openFile: filetoopen
|
||||||
withApplication: application];
|
withApplication: application];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue