First set of changes based on pathces by Josh Freeman

<pikopixel@twilightedge.com>


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@39004 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Fred Kiefer 2015-09-19 16:45:36 +00:00
parent ff61d4c642
commit 1d2c5d5ebd
10 changed files with 84 additions and 25 deletions

View file

@ -1,3 +1,20 @@
2015-09-19 Fred Kiefer <FredKiefer@gmx.de>
* Headers/AppKit/NSMenu.h,
* Source/externs.m: Add NSMenuDidEndTrackingNotification.
* Headers/AppKit/NSMatrix.h,
* Source/NSMatrix.m: Define delegate protocol and add (empty) tool
tip methods.
* Source/NSApplication.m: Send begin and end sheet notifications.
* Source/NSDocumentController.m: Replace all usages of
shouldCreateUI with the display parameter.
* Source/NSMenuItem.m: Decode atributes of separator item.
* Source/NSBitmapImageRep.m (-copyWithZone): Make a mutable copy
of the properties as well.
* Source/NSActionCell.m (-setAttributedStringValue:): Update the
control view.
Patches based on changes by Josh Freeman <pikopixel@twilightedge.com>
2015-09-13 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSTextView.m: Invalidate insertion point timer in

View file

@ -49,6 +49,9 @@ typedef enum _NSMatrixMode {
NSTrackModeMatrix
} NSMatrixMode;
@protocol NSMatrixDelegate <NSControlTextEditingDelegate>
@end
@interface NSMatrix : NSControl <NSCoding>
{
__strong id **_cells;
@ -304,6 +307,12 @@ typedef enum _NSMatrixMode {
*/
- (void) resetCursorRects;
/*
* Handling tool tips
*/
- (NSString *) toolTipForCell: (NSCell *)cell;
- (void) setToolTip: (NSString *)toolTipString forCell: (NSCell *)cell;
@end
#endif /* _GNUstep_H_NSMatrix */

View file

@ -820,5 +820,6 @@ APPKIT_EXPORT NSString* const NSMenuWillSendActionNotification;
APPKIT_EXPORT NSString* const NSMenuDidAddItemNotification;
APPKIT_EXPORT NSString* const NSMenuDidRemoveItemNotification;
APPKIT_EXPORT NSString* const NSMenuDidChangeItemNotification;
APPKIT_EXPORT NSString* const NSMenuDidEndTrackingNotification;
#endif // _GNUstep_H_NSMenu

View file

@ -268,6 +268,26 @@ static Class controlClass;
}
}
- (void) setAttributedStringValue: (NSAttributedString*)attribStr
{
[super setAttributedStringValue: attribStr];
if (_control_view)
{
if ([_control_view isKindOfClass: controlClass])
{
if (_cell.in_editing)
{
[self _updateFieldEditor:
[(NSControl *)_control_view currentEditor]];
}
else
{
[(NSControl *)_control_view updateCell: self];
}
}
}
}
/*
* Target and Action
*/

View file

@ -2017,6 +2017,9 @@ See -runModalForWindow:
[sheet setParentWindow: docWindow];
[docWindow setAttachedSheet: sheet];
[[NSNotificationCenter defaultCenter]
postNotificationName: NSWindowWillBeginSheetNotification
object: docWindow];
ret = [self runModalForWindow: sheet
relativeToWindow: docWindow];
@ -2031,6 +2034,9 @@ See -runModalForWindow:
[docWindow setAttachedSheet: nil];
[sheet setParentWindow: nil];
[[NSNotificationCenter defaultCenter]
postNotificationName: NSWindowDidEndSheetNotification
object: docWindow];
}
/**

View file

@ -1761,7 +1761,7 @@ _set_bit_value(unsigned char *base, long msb_off, int bit_width,
copy = (NSBitmapImageRep*)[super copyWithZone: zone];
copy->_properties = [_properties copyWithZone: zone];
copy->_properties = [_properties mutableCopyWithZone: zone];
copy->_imageData = [_imageData mutableCopyWithZone: zone];
copy->_imagePlanes = NSZoneMalloc(zone, sizeof(unsigned char*) * MAX_PLANES);
if (_imageData == nil)

View file

@ -505,13 +505,10 @@ TypeInfoForHumanReadableName (NSArray *types, NSString *typeName)
}
[self addDocument: document];
if ([self shouldCreateUI])
if (display)
{
[document makeWindowControllers];
if (display)
{
[document showWindows];
}
[document showWindows];
}
return document;
@ -520,7 +517,7 @@ TypeInfoForHumanReadableName (NSArray *types, NSString *typeName)
/**
* Creates an [NSDocument] object from the data at the absolute path
* given in fileName. Causes the document to be displayed if display
* is YES, unless the -shouldCreateUI method returns NO.
* is YES.
*/
- (id) openDocumentWithContentsOfFile: (NSString*)fileName
display: (BOOL)display
@ -540,7 +537,7 @@ TypeInfoForHumanReadableName (NSArray *types, NSString *typeName)
[self addDocument: document];
if ([self shouldCreateUI])
if (display)
{
[document makeWindowControllers];
}
@ -549,7 +546,7 @@ TypeInfoForHumanReadableName (NSArray *types, NSString *typeName)
// remember this document as opened
[self noteNewRecentDocument: document];
if (display && [self shouldCreateUI])
if (display)
{
[document showWindows];
}
@ -560,7 +557,7 @@ TypeInfoForHumanReadableName (NSArray *types, NSString *typeName)
/**
* Creates an [NSDocument] object from the data at the supplied url.<br />
* Causes the document to be displayed if display
* is YES, unless the -shouldCreateUI method returns NO.
* is YES.
*/
- (id) openDocumentWithContentsOfURL: (NSURL *)url display: (BOOL)display
{
@ -579,7 +576,7 @@ TypeInfoForHumanReadableName (NSArray *types, NSString *typeName)
[self addDocument: document];
if ([self shouldCreateUI])
if (display)
{
[document makeWindowControllers];
}
@ -588,7 +585,7 @@ TypeInfoForHumanReadableName (NSArray *types, NSString *typeName)
// remember this document as opened
[self noteNewRecentDocument: document];
if (display && [self shouldCreateUI])
if (display)
{
[document showWindows];
}
@ -596,7 +593,7 @@ TypeInfoForHumanReadableName (NSArray *types, NSString *typeName)
return document;
}
- (id) openUntitledDocumentAndDisplay: (BOOL)flag
- (id) openUntitledDocumentAndDisplay: (BOOL)display
error: (NSError **)err
{
NSString *type;
@ -605,7 +602,7 @@ TypeInfoForHumanReadableName (NSArray *types, NSString *typeName)
if (OVERRIDDEN(openUntitledDocumentOfType:display:))
{
return [self openUntitledDocumentOfType: type display: flag];
return [self openUntitledDocumentOfType: type display: display];
}
else
{
@ -618,13 +615,10 @@ TypeInfoForHumanReadableName (NSArray *types, NSString *typeName)
}
[self addDocument: document];
if ([self shouldCreateUI])
if (display)
{
[document makeWindowControllers];
if (flag)
{
[document showWindows];
}
[document showWindows];
}
return document;
@ -632,13 +626,13 @@ TypeInfoForHumanReadableName (NSArray *types, NSString *typeName)
}
- (id) openDocumentWithContentsOfURL: (NSURL *)url
display: (BOOL)flag
display: (BOOL)display
error: (NSError **)err
{
if (OVERRIDDEN(openDocumentWithContentsOfFile:display:) && [url isFileURL])
{
return [self openDocumentWithContentsOfFile: [url path]
display: flag];
display: display];
}
else
{
@ -664,7 +658,7 @@ TypeInfoForHumanReadableName (NSArray *types, NSString *typeName)
[self addDocument: document];
if ([self shouldCreateUI])
if (display)
{
[document makeWindowControllers];
}
@ -673,7 +667,7 @@ TypeInfoForHumanReadableName (NSArray *types, NSString *typeName)
// remember this document as opened
[self noteNewRecentDocument: document];
if (flag && [self shouldCreateUI])
if (display)
{
[document showWindows];
}

View file

@ -2717,6 +2717,17 @@ static SEL getSel;
}
}
- (NSString*) toolTipForCell: (NSCell*)cell
{
// FIXME
return @"";
}
- (void) setToolTip: (NSString*)toolTipString forCell: (NSCell*)cell
{
// FIXME
}
- (void) encodeWithCoder: (NSCoder*)aCoder
{
[super encodeWithCoder: aCoder];

View file

@ -651,7 +651,7 @@ static Class imageClass;
isSeparator = [aDecoder decodeBoolForKey: @"NSIsSeparator"];
}
if (isSeparator)
if (isSeparator && ![self isSeparatorItem])
{
RELEASE(self);
@ -660,7 +660,7 @@ static Class imageClass;
// should not be autoreleased. Do a retain
// to prevent it from being released automatically.
//
return RETAIN([NSMenuItem separatorItem]);
self = RETAIN([NSMenuItem separatorItem]);
}
//

View file

@ -416,6 +416,7 @@ NSString* const NSMenuWillSendActionNotification = @"NSMenuWillSendActionNotific
NSString* const NSMenuDidAddItemNotification = @"NSMenuDidAddItemNotification";
NSString* const NSMenuDidRemoveItemNotification = @"NSMenuDidRemoveItemNotification";
NSString* const NSMenuDidChangeItemNotification = @"NSMenuDidChangeItemNotification";
NSString* const NSMenuDidEndTrackingNotification = @"NSMenuDidEndTrackingNotification";
// NSPopUpButton notification
NSString *NSPopUpButtonWillPopUpNotification = @"NSPopUpButtonWillPopUpNotification";