diff --git a/ChangeLog b/ChangeLog index 3b8d19893..a252970ef 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,83 @@ +2008-09-08 Fred Kiefer + + * Source/GSInfoPanel.m (-keyDown:, -copy:): Added functionality to + copy the text content of the info panel to the pasteboard. + Fixes #23831. + +2008-09-08 Fred Kiefer + + * Source/NSSavePanel.m (-browser:createRowsForColumn:inMatrix:): + Use flushWindow instead of [GSCurrentContext() flushGraphics]. + Should fix #24200. + +2008-08-30 13:33-EDT Gregory John Casamento + + * ChangeLog + * Images/GNUmakefile: Remove reference to Images copyright file + reference since they images are now under the GPL. + +2008-08-30 13:32-EDT Gregory John Casamento + + * Images/GNUmakefile + * Source/GSNibTemplates.m + +2008-08-21 Yavor Doganov (tiny change) + + * Source/GNUmakefile.preamble (LIBRARIES_DEPEND_UPON): + Unconditionally link against $(OBJC_LIBS) on all platforms to + avoid undefined symbols. + Reported by Funda Wang (bug #24109). + +2008-08-21 Richard Frith-Macdonald + + * Source/NSBezierPath.m: ([transformUsingAffineTransform:]) corrected + code which was casting an array of items of one type to be an array + of items of another type whose size differs on 64bit machines. + +2008-08-15 Fred Kiefer + + * Source/NSWindow.m (-makeKeyAndOrderFront:): Unhide the application. + * Source/NSApplication.m (-hide:, -unhideWithoutActivation): + Better handling for miniaturized windows. + Patch by Hubert Chathi . + +2008-08-11 Fred Kiefer + + * Source/NSWindow.m (-endEditingFor:): Change the first responder + first to avoid recusion. + +2008-08-08 Adam Fedor + + * Source/NSBitmapImageRep+JPEG.m: Handle patched jpeg library + found on CYGWIN. + +2008-08-02 Fred Kiefer + + * Source/NSScrollView.m (-initWithCoder:): Handle non-retained + ivars correctly. + * Source/NSWindowController.m (-loadWindow): Release the loaded + window once, as it got retained by the NIB loading mechanism. + +2008-07-13 Fred Kiefer + + * Source/NSGlyphGenerator.m (-generateGlyphsForGlyphStorage:...): + Add fallback glyph when no glyph can be found for current character. + +2008-07-13 Fred Kiefer + + * Source/GSLayoutManager.m: Protect all access to the glyph arrays. + +2008-07-12 Fred Kiefer + + * Source/GSLayoutManager.m (-_glyphForCharacter:index:positions::), + * Source/NSGlyphGenerator.m (-generateGlyphsForGlyphStorage:...): + Add some more protection against inconsistent state. + +2008-07-12 Fred Kiefer + + * Source/NSSavePanel.m (-ok:): Standardize path before checking + for existance. + 2008-07-08 16:15-EDT Gregory John Casamento * Source/NSMenu.m: Beginning of support for windows style menus on the diff --git a/Images/GNUmakefile b/Images/GNUmakefile index 46b6d0fef..b8df0c4f1 100644 --- a/Images/GNUmakefile +++ b/Images/GNUmakefile @@ -33,7 +33,6 @@ include ../Version imagedir = $(GNUSTEP_LIBRARY)/Images IMAGE_FILES = \ -GNUstep_Images_Copyright \ LogoGNUstep.tiff \ common_3DArrowUp.tiff \ common_3DArrowLeft.tiff \ diff --git a/Source/GNUmakefile.preamble b/Source/GNUmakefile.preamble index a3f868a34..7d7154346 100644 --- a/Source/GNUmakefile.preamble +++ b/Source/GNUmakefile.preamble @@ -90,12 +90,5 @@ ADDITIONAL_INSTALL_DIRS = $(GNUSTEP_HEADERS)/AppKit $(GNUSTEP_HEADERS)/Cocoa # systems where building a shared library requires to pass to the linker # all the libraries the target library depends upon. -LIBRARIES_DEPEND_UPON = -l$(FOUNDATION_LIBRARY_NAME) $(ADDITIONAL_DEPENDS) - -ifeq ($(GNUSTEP_TARGET_OS),mingw32) -libgnustep-gui_LIBRARIES_DEPEND_UPON += -lobjc -endif -ifeq ($(GNUSTEP_TARGET_OS),cygwin) -libgnustep-gui_LIBRARIES_DEPEND_UPON += -lobjc -endif - +LIBRARIES_DEPEND_UPON = -l$(FOUNDATION_LIBRARY_NAME) $(ADDITIONAL_DEPENDS) \ + $(OBJC_LIBS) diff --git a/Source/GSInfoPanel.m b/Source/GSInfoPanel.m index a2d8ef703..94c47a7f3 100644 --- a/Source/GSInfoPanel.m +++ b/Source/GSInfoPanel.m @@ -28,6 +28,7 @@ #include #include +#include #include #include @@ -37,6 +38,7 @@ #include "AppKit/NSFont.h" #include "AppKit/NSImage.h" #include "AppKit/NSImageView.h" +#include "AppKit/NSPasteboard.h" #include "AppKit/NSTextField.h" #include "GNUstepGUI/GSInfoPanel.h" #include "GNUstepGUI/GSTheme.h" @@ -645,4 +647,50 @@ new_label (NSString *value) return self; } +- (void) copy: (id)sender +{ + NSArray *types = [NSArray arrayWithObject: NSStringPboardType]; + NSPasteboard *pboard = [NSPasteboard generalPasteboard]; + NSMutableString *text = [[NSMutableString alloc] init]; + NSView *cv = [self contentView]; + NSEnumerator *enumerator = [[cv subviews] objectEnumerator]; + NSView *subview; + + // Loop over all the text subviews and collect the information + while ((subview = [enumerator nextObject]) != nil) + { + if ([subview isKindOfClass: [NSTextField class]]) + { + [text appendString: [(NSTextField*)subview stringValue]]; + [text appendString: @"\n"]; + } + } + + [pboard declareTypes: types owner: self]; + [pboard setString: text + forType: NSStringPboardType]; + RELEASE(text); +} + +- (void) keyDown: (NSEvent*)theEvent +{ + NSString *characters = [theEvent characters]; + unichar character = 0; + + if ([characters length] > 0) + { + character = [characters characterAtIndex: 0]; + } + + // FIXME: Hard coded + if (character == 'c' && + [theEvent modifierFlags] & NSCommandKeyMask) + { + [self copy: nil]; + return; + } + + [super keyDown: theEvent]; +} + @end diff --git a/Source/GSLayoutManager.m b/Source/GSLayoutManager.m index c0f008d11..b4fc45157 100644 --- a/Source/GSLayoutManager.m +++ b/Source/GSLayoutManager.m @@ -769,7 +769,20 @@ Fills in all glyph holes up to last. only looking at levels below level r = run_for_character_index(target, glyphs, &pos, &cpos); if (!r) - return NULL; + { + [NSException raise: NSRangeException + format: @"%s character index %d out of range", __PRETTY_FUNCTION__, target]; + return NULL; + } + + if (!r->glyphs) + { + // range, but no glyphs, may be an empty glyph run + *rindex = i; + *rpos = pos; + *rcpos = cpos; + return r; + } target -= cpos; @@ -848,7 +861,7 @@ Fills in all glyph holes up to last. only looking at levels below level } r = run_for_glyph_index(glyphIndex, glyphs, &pos, NULL); - if (!r) /* shouldn't happen */ + if (!r || !r->glyphs) /* shouldn't happen */ return NSNullGlyph; *isValidIndex = YES; @@ -960,6 +973,11 @@ Fills in all glyph holes up to last. only looking at levels below level return 0; } + if (r->head.glyph_length <= glyphIndex - pos) + { + return cpos; + } + return cpos + r->glyphs[glyphIndex - pos].char_offset; } @@ -998,7 +1016,14 @@ Fills in all glyph holes up to last. only looking at levels below level return NSMakeRange(0, 0); } - j = cpos + r->glyphs[glyphRange.location - pos].char_offset; + if (r->head.glyph_length <= glyphRange.location - pos) + { + j = cpos; + } + else + { + j = cpos + r->glyphs[glyphRange.location - pos].char_offset; + } char_range.location = j; /* scan backwards to find the real first glyph */ @@ -1011,7 +1036,8 @@ Fills in all glyph holes up to last. only looking at levels below level r2 = r; adj = pos; cadj = cpos; - while (r2->glyphs[i].char_offset + cadj == j) + while ((r2->head.glyph_length > i) && + (r2->glyphs[i].char_offset + cadj == j)) { i--; while (i < 0) @@ -1040,7 +1066,14 @@ Fills in all glyph holes up to last. only looking at levels below level return NSMakeRange(0, 0); } - j = cpos + r->glyphs[glyphRange.location + glyphRange.length - 1 - pos].char_offset; + if (r->head.glyph_length <= glyphRange.location + glyphRange.length - 1 - pos) + { + j = cpos; + } + else + { + j = cpos + r->glyphs[glyphRange.location + glyphRange.length - 1 - pos].char_offset; + } /* scan forwards to find the real last glyph */ { @@ -1053,7 +1086,8 @@ Fills in all glyph holes up to last. only looking at levels below level r2 = r; adj = pos; cadj = cpos; - while (r2->glyphs[i].char_offset + cadj == j) + while ((r2->head.glyph_length > i) && + (r2->glyphs[i].char_offset + cadj == j)) { GLYPH_STEP_FORWARD(r2,i,adj,cadj) if (i==r2->head.glyph_length) @@ -1062,7 +1096,14 @@ Fills in all glyph holes up to last. only looking at levels below level goto found; } } - last = r2->glyphs[i].char_offset + cadj; + if (r2->head.glyph_length > i) + { + last = r2->glyphs[i].char_offset + cadj; + } + else + { + last = j; + } found: real_range.length = i + adj - real_range.location; char_range.length = last - char_range.location; @@ -1120,17 +1161,26 @@ Fills in all glyph holes up to last. only looking at levels below level index: &i positions: &pos : &cpos]; glyph_range.location = i + pos; - char_range.location = r->glyphs[i].char_offset + cpos; + if (r->head.glyph_length > i) + { + char_range.location = r->glyphs[i].char_offset + cpos; + } + else + { + char_range.location = cpos; + } target = NSMaxRange(charRange) - 1; r = [self _glyphForCharacter: target index: &i positions: &pos : &cpos]; - - GLYPH_SCAN_FORWARD(r, i, pos, cpos, r->glyphs[i].char_offset + cpos <= target) + if (r->head.glyph_length > i) + { + GLYPH_SCAN_FORWARD(r, i, pos, cpos, r->glyphs[i].char_offset + cpos <= target) + } glyph_range.length = i + pos - glyph_range.location; - if (i == r->head.glyph_length) + if (i >= r->head.glyph_length) char_range.length = glyphs->char_length - char_range.location; else char_range.length = r->glyphs[i].char_offset + cpos - char_range.location; diff --git a/Source/NSApplication.m b/Source/NSApplication.m index e7b7a5b67..798f8a276 100644 --- a/Source/NSApplication.m +++ b/Source/NSApplication.m @@ -2247,7 +2247,7 @@ image.

See Also: -applicationIconImage

while ((win = [iter nextObject])) { - if ([win isVisible] == NO) + if ([win isVisible] == NO && ![win isMiniaturized]) { continue; /* Already invisible */ } @@ -2335,9 +2335,14 @@ image.

See Also: -applicationIconImage

count = [_hidden count]; for (i = 0; i < count; i++) - { - [[_hidden objectAtIndex: i] orderFrontRegardless]; - } + { + NSWindow *win = [_hidden objectAtIndex: i]; + [win orderFrontRegardless]; + if ([win isMiniaturized]) + { + [GSServerForWindow(win) miniwindow: [win windowNumber]]; + } + } [_hidden removeAllObjects]; [[_app_icon_window contentView] setNeedsDisplay: YES]; diff --git a/Source/NSBezierPath.m b/Source/NSBezierPath.m index 2cd9f6238..ea5e8167b 100644 --- a/Source/NSBezierPath.m +++ b/Source/NSBezierPath.m @@ -1966,40 +1966,36 @@ static NSPoint point_on_curve(double t, NSPoint a, NSPoint b, NSPoint c, { NSBezierPathElement type; int i, count; - PathElement *elments = (PathElement *)GSIArrayItems(pathElements); + GSIArrayItem *elments = GSIArrayItems(pathElements); SEL transformPointSel = @selector(transformPoint:); NSPoint (*transformPointImp)(NSAffineTransform*, SEL, NSPoint); transformPointImp = (NSPoint (*)(NSAffineTransform*, SEL, NSPoint)) - [transform methodForSelector: transformPointSel]; + [transform methodForSelector: transformPointSel]; count = GSIArrayCount(pathElements); for (i = 0; i < count; i++) { - type = elments[i].type; + type = elments[i].ext.type; switch(type) { case NSMoveToBezierPathElement: case NSLineToBezierPathElement: - elments[i].points[0] = (*transformPointImp)(transform, - transformPointSel, - elments[i].points[0]); - break; + elments[i].ext.points[0] = (*transformPointImp)(transform, + transformPointSel, elments[i].ext.points[0]); + break; case NSCurveToBezierPathElement: - elments[i].points[0] = (*transformPointImp)(transform, - transformPointSel, - elments[i].points[0]); - elments[i].points[1] = (*transformPointImp)(transform, - transformPointSel, - elments[i].points[1]); - elments[i].points[2] = (*transformPointImp)(transform, - transformPointSel, - elments[i].points[2]); - break; + elments[i].ext.points[0] = (*transformPointImp)(transform, + transformPointSel, elments[i].ext.points[0]); + elments[i].ext.points[1] = (*transformPointImp)(transform, + transformPointSel, elments[i].ext.points[1]); + elments[i].ext.points[2] = (*transformPointImp)(transform, + transformPointSel, elments[i].ext.points[2]); + break; case NSClosePathBezierPathElement: - break; + break; default: - break; + break; } } INVALIDATE_CACHE(); diff --git a/Source/NSBitmapImageRep+JPEG.m b/Source/NSBitmapImageRep+JPEG.m index 145354a40..b437a9dd6 100644 --- a/Source/NSBitmapImageRep+JPEG.m +++ b/Source/NSBitmapImageRep+JPEG.m @@ -50,6 +50,10 @@ #endif #endif #include +#if defined(__CYGWIN__) +/* Cygwin uses a patched jpeg */ +#define GSTEP_PROGRESSIVE_CODEC +#endif #include @@ -465,7 +469,11 @@ static void gs_jpeg_memory_dest_destroy (j_compress_ptr cinfo) } } +#ifdef GSTEP_PROGRESSIVE_CODEC + isProgressive = (cinfo.process == JPROC_PROGRESSIVE); +#else isProgressive = cinfo.progressive_mode; +#endif /* done */ jpeg_finish_decompress(&cinfo); @@ -599,7 +607,12 @@ static void gs_jpeg_memory_dest_destroy (j_compress_ptr cinfo) progressiveNumber = [properties objectForKey: NSImageProgressive]; if (progressiveNumber != nil) { +#ifdef GSTEP_PROGRESSIVE_CODEC + if ([progressiveNumber boolValue]) + cinfo.process = JPROC_PROGRESSIVE; +#else cinfo.progressive_mode = [progressiveNumber boolValue]; +#endif } diff --git a/Source/NSGlyphGenerator.m b/Source/NSGlyphGenerator.m index 0ac057b70..c22f63850 100644 --- a/Source/NSGlyphGenerator.m +++ b/Source/NSGlyphGenerator.m @@ -110,12 +110,19 @@ fb04 'ffl' = (BOOL(*)(id, SEL, unichar)) [cs methodForSelector: cim_sel]; SEL gfc_sel = @selector(glyphForCharacter:); NSGlyph (*glyphForCharacter)(id, SEL, unichar); + NSGlyph fallback = NSNullGlyph; [[attrstr string] getCharacters: buf range: maxRange]; attributes = [attrstr attributesAtIndex: *index longestEffectiveRange: &curRange inRange: maxRange]; fi = [[self fontForCharactersWithAttributes: attributes] fontInfo]; + if (!fi) + { + [NSException raise: NSGenericException + format: @"Glyph generation with no font."]; + return; + } glyphForCharacter = (NSGlyph(*)(id, SEL, unichar)) [fi methodForSelector: gfc_sel]; n = [attributes objectForKey: NSLigatureAttributeName]; @@ -232,8 +239,11 @@ fb04 'ffl' g++; if (surr) SEND_GLYPHS(); + + continue; } - else if (ch < 0x10000) + + if (ch < 0x10000) { unichar *decomp; @@ -251,13 +261,24 @@ fb04 'ffl' g++; SEND_GLYPHS(); } + + continue; } } - else + + // No glyph found add fallback + if (fallback == NSNullGlyph) { - // On a NSNullGLyph, send all previous glyphs - SEND_GLYPHS(); + // FIXME: Find a suitable fallback glyph + unichar uc = '?'; + + fallback = glyphForCharacter(fi, gfc_sel, uc); } + *g = fallback; + g++; + + // On a NSNullGLyph, send all previous glyphs + SEND_GLYPHS(); } // Send all remaining glyphs diff --git a/Source/NSSavePanel.m b/Source/NSSavePanel.m index def972470..359203971 100644 --- a/Source/NSSavePanel.m +++ b/Source/NSSavePanel.m @@ -1124,15 +1124,11 @@ selectCellWithString: (NSString*)title ASSIGN (_directory, pathToColumn(_browser, [_browser lastColumn])); filename = [[_form cellAtIndex: 0] stringValue]; - if ([filename isAbsolutePath] == YES) + if ([filename isAbsolutePath] == NO) { - ASSIGN (_fullFileName, filename); - } - else - { - ASSIGN (_fullFileName, [_directory stringByAppendingPathComponent: - filename]); + filename = [_directory stringByAppendingPathComponent: filename]; } + ASSIGN (_fullFileName, [filename stringByStandardizingPath]); if (_delegateHasUserEnteredFilename) { @@ -1561,7 +1557,7 @@ createRowsForColumn: (int)column progressString = [@"Reading Directory " stringByAppendingString: path]; [super setTitle: progressString]; // Is the following really safe? - [GSCurrentContext() flushGraphics]; + [self flushWindow]; } //TODO: Sort after creation of matrix so we do not sort @@ -1580,12 +1576,12 @@ createRowsForColumn: (int)column { // Update displayed message if needed if (display_progress && (i > (base_frac * (reached_frac + 1)))) - { - reached_frac++; - progressString = [progressString stringByAppendingString: @"."]; - [super setTitle: progressString]; - [GSCurrentContext() flushGraphics]; - } + { + reached_frac++; + progressString = [progressString stringByAppendingString: @"."]; + [super setTitle: progressString]; + [self flushWindow]; + } // Now the real code file = [files objectAtIndex: i]; extension = [file pathExtension]; @@ -1635,7 +1631,7 @@ createRowsForColumn: (int)column if (display_progress) { [super setTitle: @""]; - [GSCurrentContext() flushGraphics]; + [self flushWindow]; } RELEASE (pool); diff --git a/Source/NSScrollView.m b/Source/NSScrollView.m index 43f8910af..1e9aff61b 100644 --- a/Source/NSScrollView.m +++ b/Source/NSScrollView.m @@ -254,6 +254,14 @@ static float scrollerWidth; { _contentView = nil; } + if (aView == _headerClipView) + { + _headerClipView = nil; + } + if (aView == _cornerView) + { + _cornerView = nil; + } [super removeSubview: aView]; } @@ -1511,12 +1519,7 @@ static float scrollerWidth; [content setFrame: frame]; } - // FIXME: No idea what is going on here. - // retain the view and reset the content view... - RETAIN(content); [self setContentView: content]; - RELEASE(content); - ASSIGN(_contentView, content); } if (hScroller != nil && _hasHorizScroller) @@ -1533,8 +1536,7 @@ static float scrollerWidth; { _hasHeaderView = YES; _hasCornerView = YES; - ASSIGN(_headerClipView, - [aDecoder decodeObjectForKey: @"NSHeaderClipView"]); + _headerClipView = [aDecoder decodeObjectForKey: @"NSHeaderClipView"]; } [self tile]; @@ -1543,7 +1545,7 @@ static float scrollerWidth; { int version = [aDecoder versionForClassName: @"NSScrollView"]; NSDebugLLog(@"NSScrollView", @"NSScrollView: start decoding\n"); - [aDecoder decodeValueOfObjCType: @encode(id) at: &_contentView]; + _contentView = [aDecoder decodeObject]; [aDecoder decodeValueOfObjCType: @encode(NSBorderType) at: &_borderType]; [aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_scrollsDynamically]; [aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_rulersVisible]; @@ -1572,7 +1574,7 @@ static float scrollerWidth; { [aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_hasHeaderView]; if (_hasHeaderView) - [aDecoder decodeValueOfObjCType: @encode(id) at: &_headerClipView]; + _headerClipView = [aDecoder decodeObject]; [aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_hasCornerView]; } diff --git a/Source/NSWindow.m b/Source/NSWindow.m index 5aaa844c5..a6e0d7a31 100644 --- a/Source/NSWindow.m +++ b/Source/NSWindow.m @@ -1371,13 +1371,14 @@ many times. if (t && (_firstResponder == t)) { + // Change first responder first to avoid recusion. + _firstResponder = self; + [_firstResponder becomeFirstResponder]; [nc postNotificationName: NSTextDidEndEditingNotification object: t]; [t setText: @""]; [t setDelegate: nil]; [t removeFromSuperview]; - _firstResponder = self; - [_firstResponder becomeFirstResponder]; } } @@ -1542,6 +1543,12 @@ many times. - (void) makeKeyAndOrderFront: (id)sender { [self deminiaturize: self]; + /* + * If a window is ordered in, make sure that the application isn't hidden, + * and is active. + */ + if ([self canBecomeKeyWindow]) + [NSApp unhide: self]; [self orderFrontRegardless]; [self makeKeyWindow]; /* diff --git a/Source/NSWindowController.m b/Source/NSWindowController.m index f38dd076e..57567c857 100644 --- a/Source/NSWindowController.m +++ b/Source/NSWindowController.m @@ -444,8 +444,13 @@ if (_window == nil && _document != nil && _owner == _document) { - [self setWindow: [_document _transferWindowOwnership]]; - } + [self setWindow: [_document _transferWindowOwnership]]; + } + else + { + // The window was already retained by the NIB loading. + RELEASE(_window); + } } else {