NSConnection defaultConnection
Hello, In NSConnection.m, +(NSConnection*)defaultConnection 'newPort' is used uninitialized here. The following line (or something like that) should be added in line 305: newPort = [default_receive_port_class newForReceiving]; I just started to port my first big app to GNUstep: Cenon - it's a software for computer-aided manufacturing. So this is my first input in this group. I really appreciate the GNUstep project. Georg vhf interservice http://www.vhf.de
GMAppKit.m, createObjectForModelUnarchiver:
Hello, 2000-05-04 Georg Fleischmann * gui/Model/GMAppKit.m ([NSWindow -createObjectForModelUnarchiver:]): use self instead of NSWindow class to allow creation of subclasses of NSWindow *** gui/Model/GMAppKit.m.oldThu May 4 18:08:40 2000 --- gui/Model/GMAppKit.mThu May 4 17:43:34 2000 *** *** 1166,1172 unsigned styleMask = [unarchiver decodeUnsignedIntWithName:@"styleMask"]; NSRect ctRect = [unarchiver decodeRectWithName:@"contentFrame"]; ! NSWindow* win = [[[NSWindow allocWithZone:[unarchiver objectZone]] initWithContentRect:ctRect styleMask:styleMask backing:backingType defer:YES] autorelease]; --- 1166,1172 unsigned styleMask = [unarchiver decodeUnsignedIntWithName:@"styleMask"]; NSRect ctRect = [unarchiver decodeRectWithName:@"contentFrame"]; ! NSWindow* win = [[[self allocWithZone:[unarchiver objectZone]] initWithContentRect:ctRect styleMask:styleMask backing:backingType defer:YES] autorelease]; --- Georg Fleischmann vhf interservice http://www.vhf.de
Fix: NSScrollView
Hello, here is a bug fix for unarchiving a NSScrollView from a gmodel file: When a NSScrollView is beeing unarchived from a gmodel file, the unarchiving of the documentView overwrites the backgroundColor which has already been unarchived! The bugfix simply unarchives the backgroundColor of NSScrollView after setting the documentView. However, it could be a better solution to remove the setting of the backgroundColor in [NSScrollView -setDocumentView:] ??? 2000-05-12 Georg Fleischmann * gui/Model/GMAppKit.m ([NSScrollView(GMArchiverMethods) -initWithModelUnarchiver:]): move unarchiving of backgroundColor behind documentView *** gui/Model/GMAppKit.m.oldFri May 12 15:13:06 2000 --- gui/Model/GMAppKit.mFri May 12 14:58:53 2000 *** *** 487,494 [self setContentView: AUTORELEASE([NSClipView new])]; - [self setBackgroundColor: - [unarchiver decodeObjectWithName: @"backgroundColor"]]; [self setBorderType: [unarchiver decodeIntWithName: @"borderType"]]; [self setHasHorizontalScroller: --- 487,492 *** *** 497,502 --- 495,502 [unarchiver decodeBOOLWithName: @"hasVerticalScroller"]]; [self setDocumentView: [unarchiver decodeObjectWithName: @"documentView"]]; + [self setBackgroundColor: + [unarchiver decodeObjectWithName: @"backgroundColor"]]; return self; } --- Georg Fleischmann vhf interservice http://www.vhf.de
Fix: XGFontInfo, Memory leak
Hello, here is a bug fix that fixes a memory leak in XGFontInfo: The fix renames fontDictionary to myFontDictionary, because fontDictionary was declared twice (static in XGFont.m and as instance variable in GSFontInfo). The compiler took the instance variable, so no fontInfo was ever released nor reused. 2000-05-22 Georg Fleischmann * xgps/Source/XGFont.m ([XGFont(XGFontInfo) initWithFontName:matrix:]): renamed fontDictionary to myFontDictionary ([XGFont(XGFontInfo) dealloc]): check font_info before unloading fonts *** xgps/Source/XGFont.m.oldMon May 22 16:05:45 2000 --- xgps/Source/XGFont.mMon May 22 21:31:07 2000 *** *** 41,47 /* * class global dictionary of existing fonts */ ! static NSMutableDictionary*fontDictionary = nil; @implementation XGFontInfo --- 41,47 /* * class global dictionary of existing fonts */ ! static NSMutableDictionary*myFontDictionary = nil; @implementation XGFontInfo *** *** 66,82 * Do we have an already contructed XGFontInfo for this request? If yes we * return it. */ ! if (fontDictionary == nil) ! fontDictionary = [NSMutableDictionary new]; ! if ((fontinfo = [fontDictionary objectForKey: xfontname])) { RELEASE(self); ! return fontinfo; } // Now we create an XGFontInfo to add to the original fontDict. [super init]; ! [fontDictionary setObject: self forKey: xfontname]; // Load X font and get font info structure. if (xdpy) --- 66,82 * Do we have an already contructed XGFontInfo for this request? If yes we * return it. */ ! if (myFontDictionary == nil) ! myFontDictionary = [NSMutableDictionary new]; ! if ((fontinfo = [myFontDictionary objectForKey: xfontname])) { RELEASE(self); ! return [fontinfo retain]; } // Now we create an XGFontInfo to add to the original fontDict. [super init]; ! [myFontDictionary setObject: self forKey: xfontname]; // Load X font and get font info structure. if (xdpy) *** *** 116,122 - (void) dealloc { ! XUnloadFont([XGContext currentXDisplay], font_info->fid); [super dealloc]; } --- 116,123 - (void) dealloc { ! if (font_info != NULL) ! XUnloadFont([XGContext currentXDisplay], font_info->fid); [super dealloc]; } --- Georg Fleischmann vhf interservice http://www.vhf.de
Fix: NSMatrix (GMArchiverMethods)
Hello, here is a bug fix for unarchiving gmodels. It selects selected cells in the matrix too. 2000-05-24 Georg Fleischmann * gui/Model/GMAppKit.m ([NSScrollView(GMArchiverMethods) -initWithModelUnarchiver:]): select selected cells in matrix too *** gui/Model/GMAppKit.m.oldMon May 22 18:22:27 2000 --- gui/Model/GMAppKit.mWed May 24 18:08:05 2000 *** *** 434,441 nc = [unarchiver decodeIntWithName:@"numberOfColumns"]; cell_array = [unarchiver decodeObjectWithName:@"cells"]; [self renewRows:nr columns:nc]; ! for (i = 0; (i < [cell_array count]) && (i < nr*nc); i++) { ! [self putCell:[cell_array objectAtIndex:i] atRow:i/nc column:i%nc]; } decodedDelegate = [unarchiver decodeObjectWithName:@"delegate"]; --- 434,446 nc = [unarchiver decodeIntWithName:@"numberOfColumns"]; cell_array = [unarchiver decodeObjectWithName:@"cells"]; [self renewRows:nr columns:nc]; ! for (i = 0; (i < [cell_array count]) && (i < nr*nc); i++) ! { ! idcell = [cell_array objectAtIndex:i]; ! ! [self putCell:cell atRow:i/nc column:i%nc]; ! if ([cell state]) ! [self selectCellAtRow:i/nc column:i%nc]; } decodedDelegate = [unarchiver decodeObjectWithName:@"delegate"]; --- Georg Fleischmann vhf interservice http://www.vhf.de
Fix: NSTabView
Hello, here is a bug fix for NSTabView (latest snapshot 000508): 'tab_font' isn't retained, and -dealloc is missing completely. 2000-05-09 Georg Fleischmann * gui/Source/NSTabView.m ([-initWithFram:]): retain tab_font ([-dealloc]): new method diff -c gui/Source/NSTabView.m.old gui/Source/NSTabView.m *** gui/Source/NSTabView.m.old Mon May 8 23:45:30 2000 --- gui/Source/NSTabView.m Tue May 9 00:01:41 2000 *** *** 15,21 // setup variables tab_items = [NSMutableArray new]; ! tab_font = [NSFont systemFontOfSize:12]; tab_selected = nil; return self; --- 15,21 // setup variables tab_items = [NSMutableArray new]; ! tab_font = [[NSFont systemFontOfSize:12] retain]; tab_selected = nil; return self; *** *** 611,614 --- 611,622 return self; } + + - (void) dealloc + { + RELEASE(tab_items); + RELEASE(tab_font); + [super dealloc]; + } + @end --- Georg Fleischmann vhf interservice http://www.vhf.de
Fix (hack): Menu weirdness?
--- "Philippe C.D. Robert" <[EMAIL PROTECTED]> wrote: >while porting PC.app to use hardcoded UI instead of gmodels, I noticed that >menus seem to be broken. I use the latest CVS stuff, and the menus are still >gmodel based - could this be the reason? I have attached a small image that >shows the misbehaviour. I had the same problem and traced it down to the xgps backend a few days ago: It has nothing to do with gmodels. It's a general problem of window drawing using the xgps backend. The xgps backend doesn't give the X Window system enough time to finish resizing before it starts drawing to the window. The problem only shows in Menus because Menus draw a lot of Windows in series. In xgps/Source/SharedX/XGContextWindow.m, [XGContextWindow -_updateWindowParameters:] the window parameters for drawing (especially the width and height) are updated before X has finished the resizing of the window (started in -DPSplacewindow:)! I tried XFlush() and XSync(), but both functions wouldn't wait as expected :-( I have no clue about X, so what I did (in -_updateWindowParameters:) is get the window geometry in a loop, until the values actually changed. This works, but there should be a better solution. There is another hack in [XGContextWindow DPSplacewindow:] which sends a resize notification to the NSWindow, in case X wouldn't send a notification. Maybe this would be the right place to wait for X. Here is my patch (hack): *** XGContextWindow.m 2000/05/05 21:15:16 1.60 --- XGContextWindow.m 2000/05/26 18:24:19 *** *** 489,497 return; XFlush (XDPY); ! XGetGeometry(XDPY, window->ident, &window->root, &x, &y, &width, &height, &window->border, &window->depth); window->xframe.size.width = width; window->xframe.size.height = height; --- 489,513 return; XFlush (XDPY); ! ! /* hack: !* wait until a resize of window is finished (especially for NSMenu) !* is there any way to wait until X finished it's stuff? !* XSync(), XFlush() doesn't do the job! !*/ ! { int i = 0; ! ! do ! { ! XGetGeometry(XDPY, window->ident, &window->root, &x, &y, &width, &height, &window->border, &window->depth); + } + while( i++<10 && height != window->siz_hints.height ); + } window->xframe.size.width = width; window->xframe.size.height = height; --- Georg Fleischmann vhf interservice http://www.vhf.de
Fix: NSText
Hello, here are some bug fixes for NSText (cvs version from 2000-08-14). - [NSText sizeToFit], line 2148: I removed the 'else' to allow resize of height and width (OpenStep 4.2 does it this way). - scanRange() line 1032: I added 1 to the scannerPosition to avoid an infinite loop for a singe character text. - scanRange() line 1011, and 1047: I removed the '=' in the comparison of width ('> width' instead of '>= width') this avoids a linebreak of the last character in a text which actually should fit. I'm not entirely sure about the side effects of the last two changes, since I have no overview over scanRange(). As far as I can see NSText does a much better job with these changes. 2000-08-15 Georg Fleischmann * gui/Source/NSText.m ([NSText sizeToFit:]): 'else' removed to allow resize of height and width * gui/Source/NSText.m scanRange(): line 1032: +1 to avoid infinit loop for single character line 1011, 1047: '>' instead of '>=' *** gui/Source/NSText.m Tue Aug 15 18:53:09 2000 --- gui/Source/NSText.m.old Tue Aug 15 18:14:00 2000 *** *** 1008,1014 // handle case where single word is broader than width // (buckle word) unfinished and untested // for richText (absolute position see above) ! if (advanceSize.width > width) { if (isBuckled) { --- 1008,1014 // handle case where single word is broader than width // (buckle word) unfinished and untested // for richText (absolute position see above) ! if (advanceSize.width >= width) { if (isBuckled) { *** *** 1029,1035 inBuckling = YES; scannerPosition = localLineStartIndex ! + (lastVisibleCharIndex - startingLineCharIndex)+1; currentLineRect.size.width = advanceSize.width = width; } else --- 1029,1035 inBuckling = YES; scannerPosition = localLineStartIndex ! + (lastVisibleCharIndex - startingLineCharIndex); currentLineRect.size.width = advanceSize.width = width; } else *** *** 1044,1050 // end of line -> word wrap // >= : wichtig fur abknicken (isBuckled) ! if (currentLineRect.size.width > width || isBuckled) { _GNULineLayoutInfo *ghostInfo = nil, *thisInfo; --- 1044,1050 // end of line -> word wrap // >= : wichtig fur abknicken (isBuckled) ! if (currentLineRect.size.width >= width || isBuckled) { _GNULineLayoutInfo *ghostInfo = nil, *thisInfo; *** *** 2145,2151 { newWidth = textRect.size.width; } ! if (_tf.is_vertically_resizable) { newHeight = textRect.size.height; } --- 2145,2151 { newWidth = textRect.size.width; } ! else if (_tf.is_vertically_resizable) { newHeight = textRect.size.height; } --- * Georg Fleischmann * vhf interservice GmbH * research and development on self-similarity and geometry of fractals * [EMAIL PROTECTED]
Fix: NSView, removeSubview:
Hello, here is a fix for NSView (cvs version from 2000-08-14): [NSView removeFromSubview:] checks if aSubview is the first responder. With the patch the method checks if any subview of aSubview is the first responder. This happens for TextFields, Cells ... 2000-08-19 Georg Fleischmann * gui/Source/NSView.m ([NSView removeSubview:]): check if any superview of the first responder is the view to be removed *** gui/Source/NSView.m Sat Aug 19 17:08:57 2000 --- gui/Source/NSView.m.old Sat Aug 19 16:32:55 2000 *** *** 396,417 } - (void) removeSubview: (NSView*)aSubview ! { id view; ! /* * This must be first because it invokes -resignFirstResponder:, * which assumes the view is still in the view hierarchy */ ! for( view = [_window firstResponder]; !view != nil && [view respondsToSelector:@selector(superview)]; !view = [view superview] ) ! { ! if (view == aSubview) { [_window makeFirstResponder: _window]; - break; } - } aSubview->_super_view = nil; [aSubview viewWillMoveToWindow: nil]; [_sub_views removeObjectIdenticalTo: aSubview]; --- 396,410 } - (void) removeSubview: (NSView*)aSubview ! { /* * This must be first because it invokes -resignFirstResponder:, * which assumes the view is still in the view hierarchy */ ! if ([_window firstResponder] == aSubview) { [_window makeFirstResponder: _window]; } aSubview->_super_view = nil; [aSubview viewWillMoveToWindow: nil]; [_sub_views removeObjectIdenticalTo: aSubview]; --- * Georg Fleischmann * vhf interservice GmbH * research and development on self-similarity and geometry of fractals * [EMAIL PROTECTED]
Fix (Performance): NSApplication
Hello, here is a performance fix for NSApplication: 2000-08-26 Georg Fleischmann * gui/Source/NSApplication.m [NSApplication run]: no menu update for NSPeriodic and NSMouseMoved events (too expensive) *** gui/Source/NSApplication.m Sat Aug 26 18:19:59 2000 --- gui/Source/NSApplication.m.old Sat Aug 26 17:57:50 2000 *** *** 883,898 inMode: NSDefaultRunLoopMode dequeue: YES]; if (e) ! { ! [self sendEvent: e]; ! // update (en/disable) the services menu's items ! if( !([e type] & (NSPeriodic|NSMouseMoved)) ) ! { ! [listener updateServicesMenu]; ! [main_menu update]; ! } ! } // send an update message to all visible windows if (windows_need_update) --- 883,893 inMode: NSDefaultRunLoopMode dequeue: YES]; if (e) ! [self sendEvent: e]; ! // update (en/disable) the services menu's items ! [listener updateServicesMenu]; ! [main_menu update]; // send an update message to all visible windows if (windows_need_update) --- * Georg Fleischmann * vhf interservice GmbH * research and development on self-similarity and geometry of fractals * [EMAIL PROTECTED]
Fix (Performance): NSApplication - Correction
Hello, I mixed up event masks and types in my last mail. So here is the corrected version of the fix: 2000-08-26 Georg Fleischmann * gui/Source/NSApplication.m [NSApplication run]: no menu update for NSPeriodic and NSMouseMoved events (too expensive) *** gui/Source/NSApplication.m Sun Aug 27 13:40:07 2000 --- gui/Source/NSApplication.m.old Sat Aug 26 17:57:50 2000 *** *** 883,899 inMode: NSDefaultRunLoopMode dequeue: YES]; if (e) ! { NSEventType type = [e type]; ! [self sendEvent: e]; ! ! // update (en/disable) the services menu's items ! if (type != NSPeriodic && type != NSMouseMoved) ! { ! [listener updateServicesMenu]; ! [main_menu update]; ! } ! } // send an update message to all visible windows if (windows_need_update) --- 883,893 inMode: NSDefaultRunLoopMode dequeue: YES]; if (e) ! [self sendEvent: e]; ! // update (en/disable) the services menu's items ! [listener updateServicesMenu]; ! [main_menu update]; // send an update message to all visible windows if (windows_need_update) --- * Georg Fleischmann * vhf interservice GmbH * research and development on self-similarity and geometry of fractals * [EMAIL PROTECTED]
Fix: NSForm (GMArchiverMethods)
Hello, here is a patch for loading NSForms from a gmodel file. Following the discussions, it seems, I'm the only one using gmodels :-) I think they do a pretty good job. 2000-08-29 Georg Fleischmann * gui/Model/GMAppKit.m [NSForm (GMArchiverMethods) initWithModelUnarchiver:]: new, allows auto alignment of form titles *** gui/Model/GMAppKit.m.oldTue Aug 29 22:30:06 2000 --- gui/Model/GMAppKit.mTue Aug 29 22:45:50 2000 *** *** 1539,1544 --- 1539,1562 @end /* NSTextFieldCell (GMArchiverMethods) */ + @implementation NSForm (GMArchiverMethods) + + - (id)initWithModelUnarchiver:(GMUnarchiver*)unarchiver + { int i; + + self = [super initWithModelUnarchiver:unarchiver]; + [self setValidateSize: YES]; + for (i=[self numberOfRows]-1; i>=0; i--) + [[NSNotificationCenter defaultCenter] + addObserver: self + selector: @selector(_setTitleWidthNeedsUpdate:) + name: _NSFormCellDidChangeTitleWidthNotification + object: [self cellAtIndex:i]]; + return self; + } + + @end /* NSForm (GMArchiverMethods) */ + @implementation NSFormCell (GMArchiverMethods) - (void)encodeWithModelArchiver:(GMArchiver*)archiver --- * Georg Fleischmann * vhf interservice GmbH * research and development on self-similarity and geometry of fractals * [EMAIL PROTECTED]
Fix: NSTabView, drawRect:
Hello, here is a fix for [NSTabView drawRect:] Without the patch the method takes the parameter 'rect' for positioning instead of just clipping the drawing area. This fails when called from [NSView displayIfNeededIgnoringOpacity] with an invalidRect != bounds. The patch just takes the bounds to redraw. 2000-08-30 Georg Fleischmann * gui/NSTabView.m [NSTabView drawRect:]: redraw using bounds instead of rect *** gui/Source/NSTabView.m.old Wed Aug 30 18:56:24 2000 --- gui/Source/NSTabView.m Wed Aug 30 18:59:23 2000 *** *** 319,325 NSRect previousRect; int previousState = 0; ! rect = NSIntersectionRect(_bounds, rect); DPSgsave(ctxt); --- 319,325 NSRect previousRect; int previousState = 0; ! rect = _bounds; DPSgsave(ctxt); --- * Georg Fleischmann * vhf interservice GmbH * research and development on self-similarity and geometry of fractals * [EMAIL PROTECTED]
Fix: NSTextView, setTextContainer:
Hi, here is a fix for NSTextView (cvs version from 2000-09-07): The patch just sets the textView for the textContainer. With the patch NSTextContainer will set itself as observer using the textView as notification object (not nil). 2000-09-10 Georg Fleischmann * gui/Source/NSTextView.m ([NSTextView setTextContainer:]): set text view for text container *** gui/Source/NSTextView.m.old Sat Sep 9 23:39:35 2000 --- gui/Source/NSTextView.m Sun Sep 10 14:00:29 2000 *** *** 99,105 - (void) setTextContainer: (NSTextContainer*)aTextContainer { ! ASSIGN(_textContainer, aTextContainer); // FIXME: Could also get a reference to the layout manager //ASSIGN(_textStorage, [[aTextContainer layoutManager] textStorage]); } --- 99,109 - (void) setTextContainer: (NSTextContainer*)aTextContainer { ! if( _textContainer != aTextContainer ) ! { ! ASSIGN(_textContainer, aTextContainer); ! [aTextContainer setTextView:self]; ! } // FIXME: Could also get a reference to the layout manager //ASSIGN(_textStorage, [[aTextContainer layoutManager] textStorage]); } --- * Georg Fleischmann * vhf interservice GmbH * research and development on self-similarity and geometry of fractals * [EMAIL PROTECTED]
Fix: NSMenuItem, NSMenu (GMArchiverMethods)
Hi, the recent changes in NSMenuItem created problems loading gmodel files. The following changes work for me: The first modification prevents NSMenuItem to set it's target = nil, in case mi_menu isn't set yet. The second modification avoids calling [NSMenuItem setSubmenu:] a second time (raises), by just setting the menu of the item. 2000-09-10 Georg Fleischmann * gui/Source/NSMenuItem.m ([NSMenuItem setSubmenu:]): set target only if mi_menu != nil * gui/Model/GMAppKit.m ([NSMenu(GMArchiverMethods) initWithModelUnarchiver:]): set menu of item, and don't call setSubmenu: any more *** gui/Source/NSMenuItem.m.old Sun Sep 10 21:45:32 2000 --- gui/Source/NSMenuItem.m Sun Sep 10 22:36:41 2000 *** *** 134,146 - (void) setSubmenu: (NSMenu*)submenu { - NSLog(@"setSubmenu: title=%@ submenu=%@", [self title], submenu); if ([submenu supermenu] != nil) [NSException raise: NSInvalidArgumentException format: @"submenu already has supermenu: "]; ASSIGN(mi_submenu, submenu); [submenu setSupermenu: mi_menu]; ! [self setTarget: mi_menu]; [self setAction: @selector(submenuAction:)]; } --- 134,146 - (void) setSubmenu: (NSMenu*)submenu { if ([submenu supermenu] != nil) [NSException raise: NSInvalidArgumentException format: @"submenu already has supermenu: "]; ASSIGN(mi_submenu, submenu); [submenu setSupermenu: mi_menu]; ! if (mi_menu != nil) ! [self setTarget: mi_menu]; [self setAction: @selector(submenuAction:)]; } *** gui/Model/GMAppKit.m.oldSun Sep 10 20:43:59 2000 --- gui/Model/GMAppKit.mSun Sep 10 22:40:28 2000 *** *** 871,878 { id item = [itemArray objectAtIndex:i]; ! if ([item hasSubmenu]) ! [self setSubmenu:[item submenu] forItem:item]; } [self setAutoenablesItems: --- 871,877 { id item = [itemArray objectAtIndex:i]; ! [item setMenu:self]; } [self setAutoenablesItems: --- * Georg Fleischmann * vhf interservice GmbH * research and development on self-similarity and geometry of fractals * [EMAIL PROTECTED]
Re: Fix: NSMenuItem, NSMenu (GMArchiverMethods)
Hi Nicola, >I am still puzzled >by the fact that (AFAIK) in OPENSTEP the target of the submenuAction: >is the submenu to be detached, while in GNUstep it seems we are >using the menu itselfI checked it: In OpenStep the target of the submenuAction: is the menu itself (no difference to GNustep). >We can >even spare an instance variable, since we can store the submenu in >the target ivar (according to an old comment I added to the gmodel code, >someone reported to me that this is how what happens on OPENSTEP). OpenStep has no submenu ivar, whereas the MacOSX specs now show one. I have no idea how this ivar is used in MacOSX, though. Georg
Re: Fix: NSMenuItem, NSMenu (GMArchiverMethods)
Hi Nicola, >Ahm - my assertion is mainly based on the fact that in all gmodels >I saw, the target is the submenu. Actually, that is the way the You're right. I missdescribed my observations... The target of the NSMenuItem on OpenStep points to the submenu. Just like it is in the gmodel files you have. So of course it's clear why MacOSX needs the submenu ivar. Are you going to implement it like OpenStep or like MacOSX ? Georg
Re: Fix: NSMenuItem, NSMenu (GMArchiverMethods)
Hi Nicola, >Ahm - you mean because targets should not be retained while of course >you need to retain the submenu somewhere ? I meant that if the target would point to the super menu, you need the extra submenu entry. I don't know where the target points on MacOSX, though. >unfortunately I don't rememeber >which gmodels come from OPENSTEP - and which versions - and which from >macosx. gmodel files generated on OpenStep 4.2 don't contain a submenu entry at all (only target). Georg
NSTabView, drawRect:
Hello, I had to realize that a bug in [NSTabView drawRect:] is back again, which I have send a tiny fix for a few months ago (just rect = _bounds). Maybe I introduced a new bug with my fix ? Now the problem in [NSTabView drawRect:rect] is that the method draws to the origin of 'rect', instead of drawing to the origin of the bounds, and just using 'rect' to decide whether things have to be drawn at all. 'rect' just specifies the area which needs to be redrawn. I hope this helps to finally fix this little bug. Georg Fleischmann [EMAIL PROTECTED] ___ Bug-gnustep mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/bug-gnustep
Fix: NSTabViewItem, setView:
Hello, here is a fix for [NSTabViewItem setView:]. The patch just removes a release which is one too much, since ASSIGN() already manages retain and release. 2000-11-21 Georg Fleischmann * gui/NSTabViewItem.m [NSTabViewItem setView:]: TEST_RELEASE() removed, since ASSIGN() manages retain/release *** gui/Source/NSTabViewItem.m.old Mon Oct 23 15:38:28 2000 --- gui/Source/NSTabViewItem.m Tue Nov 21 18:19:16 2000 *** *** 69,77 - (void)setView:(NSView *)view { - if (item_view) - TEST_RELEASE(item_view); - ASSIGN(item_view, view); } --- 69,74 --- * Georg Fleischmann, vhf interservice GmbH * research on environmental self-similarity and geometry of fractals * [EMAIL PROTECTED] http://www.vhf.de ___ Bug-gnustep mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/bug-gnustep
Fix: subproject.make
Hello, here is a fix for the subproject.make file. Since the framework support was added, the subproject makefile produces errors in some for loops with empty list. The patch adds the same workaround used in all the other loops. Georg 2000-12-04 Georg Fleischmann * Makefiles/subproject.make workaround for empty list in for loops added *** Makefiles/subproject.make.old Sun Nov 19 21:14:06 2000 --- Makefiles/subproject.make Mon Dec 4 19:50:45 2000 *** *** 95,122 fi; \ done; \ fi; \ ! fi; framework-components:: @(if [ "$(FRAMEWORK_NAME)" != "" ]; then \ if [ "$(COMPONENTS)" != "" ]; then \ echo "Copying components into the framework wrapper..."; \ cd $(FRAMEWORK_VERSION_DIR_NAME)/Resources; \ ! for component in $(COMPONENTS); do \ ! if [ -d ../../../../$(SUBPROJECT_ROOT_DIR)/$$component ]; then \ ! cp -r ../../../../$(SUBPROJECT_ROOT_DIR)/$$component ./; \ fi; \ done; \ echo "Copying localized components into the framework wrapper..."; \ ! for l in $(LANGUAGES); do \ ! if [ ! -f $$l.lproj ]; then \ ! $(MKDIRS) $$l.lproj; \ fi; \ cd $$l.lproj; \ ! for f in $(COMPONENTS); do \ ! if [ -d ../../../../../$(SUBPROJECT_ROOT_DIR)/$$l.lproj/$$f ]; then \ ! cp -r ../../../../../$(SUBPROJECT_ROOT_DIR)/$$l.lproj/$$f .;\ ! fi; \ done; \ cd ..; \ done;\ --- 95,128 fi; \ done; \ fi; \ ! fi framework-components:: @(if [ "$(FRAMEWORK_NAME)" != "" ]; then \ if [ "$(COMPONENTS)" != "" ]; then \ echo "Copying components into the framework wrapper..."; \ cd $(FRAMEWORK_VERSION_DIR_NAME)/Resources; \ ! for component in $(COMPONENTS) __done; do \ ! if [ $$component != __done ]; then \ ! if [ -d ../../../../$(SUBPROJECT_ROOT_DIR)/$$component ]; then \ ! cp -r ../../../../$(SUBPROJECT_ROOT_DIR)/$$component ./; \ ! fi; \ fi; \ done; \ echo "Copying localized components into the framework wrapper..."; \ ! for l in $(LANGUAGES) __done; do \ ! if [ $$l != __done ]; then \ ! if [ ! -f $$l.lproj ]; then \ ! $(MKDIRS) $$l.lproj; \ ! fi; \ fi; \ cd $$l.lproj; \ ! for f in $(COMPONENTS) __done; do \ ! if [ $$f != __done ]; then \ ! if [ -d ../../../../../$(SUBPROJECT_ROOT_DIR)/$$l.lproj/$$f ]; then \ ! cp -r ../../../../../$(SUBPROJECT_ROOT_DIR)/$$l.lproj/$$f .; \ ! fi; \ ! fi; \ done; \ cd ..; \ done;\ *** *** 138,151 @(if [ "$(FRAMEWORK_NAME)" != "" ]; then \ if [ "$(LOCALIZED_RESOURCE_FILES)" != "" ]; then \ echo "Copying localized resources into the framework wrapper..."; \ ! for l in $(LANGUAGES); do \ ! if [ ! -f $$l.lproj ]; then \ ! $(MKDIRS) $(FRAMEWORK_VERSION_DIR_NAME)/Resources/$$l.lproj; \ fi; \ ! for f in $(LOCALIZED_RESOURCE_FILES); do \ ! if [ -f $$l.lproj/$$f ]; then \ ! cp -r $$l.lproj/$$f $(FRAMEWORK_VERSION_DIR_NAME)/Resources/$$l.lproj; \ ! fi; \ done; \ done; \ fi; \ --- 144,161 @(if [ "$(FRAMEWORK_NAME)" != "" ]; then \ if [ "$(LOCALIZED_RESOURCE_FILES)" != "" ]; then \ echo "Copying localized resources into the framework wrapper..."; \ ! for l in $(LANGUAGES) __done; do \ ! if [ $$l != __done ]; then \ ! if [ ! -f $$l.lproj ]; then \ ! $(MKDIRS) $(FRAMEWORK_VERSION_DIR_NAME)/Resources/$$l.lproj; \ ! fi; \ fi; \ ! for f in $(LOCALIZED_RESOURCE_FILES) __done; do \ ! if [ $$f != __done ]; then \ ! if [ -f $$l.lproj/$$f ]; then \ ! cp -r $$l.lproj/$$f $(FRAMEWORK_VERSION_DIR_NAME)/Resources/$$l.lproj; \ ! fi; \ ! fi; \ done; \ done; \ fi; \ *** *** 164,172 @(if [ "$(WEBSERVER_RESOURCE_FILES)" != "" ]; then \ echo "Copying webserver resources into the framework wrapper..."; \ cd $(FRAMEWORK_VERSION_DIR_NAME)/WebServerResour
Fix: NSTabView, drawRect:
Hi, ok, here is the fix for the problem in [NSTabView drawRect:]. The problem is that the method draws to the origin of 'rect', instead of drawing to the origin of the bounds. 'rect' should be used only to decide whether things have to be drawn at all. Georg 2000-12-05 Georg Fleischmann * gui/Source/NSTabView.m ([NSTabView -drawRect:rect]): using aRect (bounds) instead of rect to draw *** gui/Source/NSTabView.m.old Mon Oct 23 15:38:28 2000 --- gui/Source/NSTabView.m Tue Dec 5 19:44:44 2000 *** *** 348,374 { case NSTopTabsBezelBorder: aRect.size.height -= 16; - rect.size.height -= 16; NSDrawButton(aRect, NSZeroRect); borderThickness = 2; break; case NSBottomTabsBezelBorder: ! rect.size.height -= 16; ! rect.origin.y += 16; ! NSDrawButton(rect, rect); ! rect.origin.y -= 16; borderThickness = 2; break; case NSNoTabsBezelBorder: ! NSDrawButton(rect, rect); borderThickness = 2; break; case NSNoTabsLineBorder: [[NSColor controlDarkShadowColor] set]; ! NSFrameRect(rect); borderThickness = 1; break; --- 348,373 { case NSTopTabsBezelBorder: aRect.size.height -= 16; NSDrawButton(aRect, NSZeroRect); borderThickness = 2; break; case NSBottomTabsBezelBorder: ! aRect.size.height -= 16; ! aRect.origin.y += 16; ! NSDrawButton(aRect, aRect); ! aRect.origin.y -= 16; borderThickness = 2; break; case NSNoTabsBezelBorder: ! NSDrawButton(aRect, aRect); borderThickness = 2; break; case NSNoTabsLineBorder: [[NSColor controlDarkShadowColor] set]; ! NSFrameRect(aRect); borderThickness = 1; break; *** *** 404,411 if (i == 0) { int iFlex = 0; ! iP.x = rect.origin.x; ! iP.y = rect.origin.y; if (itemState == NSSelectedTab) { --- 403,410 if (i == 0) { int iFlex = 0; ! iP.x = aRect.origin.x; ! iP.y = aRect.origin.y; if (itemState == NSSelectedTab) { *** *** 425,432 else NSLog(@"Not finished yet. Luff ya.\n"); ! r.origin.x = rect.origin.x + 13; ! r.origin.y = rect.origin.y + 2; r.size.width = s.width; r.size.height = 15 + iFlex; --- 424,431 else NSLog(@"Not finished yet. Luff ya.\n"); ! r.origin.x = aRect.origin.x + 13; ! r.origin.y = aRect.origin.y + 2; r.size.width = s.width; r.size.height = 15 + iFlex; *** *** 446,452 int iFlex = 0; iP.x = previousRect.origin.x + previousRect.size.width; ! iP.y = rect.origin.y; if (itemState == NSSelectedTab) { --- 445,451 int iFlex = 0; iP.x = previousRect.origin.x + previousRect.size.width; ! iP.y = aRect.origin.y; if (itemState == NSSelectedTab) { *** *** 482,488 NSLog(@"Not finished yet. Luff ya.\n"); r.origin.x = iP.x + 13; ! r.origin.y = rect.origin.y + 2; r.size.width = s.width; r.size.height = 15 + iFlex; // was 15 --- 481,487 NSLog(@"Not finished yet. Luff ya.\n"); r.origin.x = iP.x + 13; ! r.origin.y = aRect.origin.y + 2; r.size.width = s.width; r.size.height = 15 + iFlex; // was 15 *** *** 536,543 if (i == 0) { ! iP.x = rect.origin.x; ! iP.y = rect.size.height; if (itemState == NSSelectedTab) { --- 535,542 if (i == 0) { ! iP.x = aRect.origin.x; ! iP.y = aRect.size.height; if (itemState == NSSelectedTab) { *** *** 551,558 else NSLog(@"Not finished yet. Luff ya.\n"); ! r.origin.x = rect.origin.x + 13; ! r.origin.y = rect.size.height; r.size.width = s.width; r.size.height = 15; --- 550,557 else NSLog(@"Not finished yet. Luff ya.\n"); ! r.origin.x = aRect.origin.x + 13; ! r.origin.y = aRect.size.height; r.size.width = s.width; r.size.height = 15; *** *** 570,
Fix: NSFormCell, copyWithZone:
Hi, here is a fix for NSFormCell (CVS 2000-12-15). It applies the recent changes of NSCell to NSFormCell too. Georg 2000-12-16 Georg Fleischmann * gui/Source/NSFormCell.m ([NSFormCell -copyWithZone:]): created to retain _titleCell *** gui/Source/NSFormCell.m.old Sat Dec 16 01:06:10 2000 --- gui/Source/NSFormCell.m Sat Dec 16 01:09:05 2000 *** *** 283,288 --- 283,303 [self drawInteriorWithFrame: cellFrame inView: controlView]; } + /* + * Copying + */ + - (id) copyWithZone: (NSZone*)zone + { + NSCell *c = [super copyWithZone:zone]; + + /* Because of performance issues (and because so the doc says) only + pointers to the objects are copied. We need to RETAIN them all + though. */ + TEST_RETAIN (_titleCell); + + return c; + } + - (void) encodeWithCoder: (NSCoder*)aCoder { BOOL tmp; ___ Bug-gnustep mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/bug-gnustep
Fix: GSTextStorage, setAttributes:range:
Hi, here is a fix for GSTextStorage. It ensures that the first attribute starts at location = 0. Otherwise _attributesAtIndexEffectiveRange() would raise. Georg 2000-12-16 Georg Fleischmann * gui/Source/GSTextStorage.m ([GSTextStorage -setAttributes:range:]): first attribute always starts at loc = 0 *** gui/Source/GSTextStorage.m.old Sat Dec 16 19:25:08 2000 --- gui/Source/GSTextStorage.m Sat Dec 16 19:25:31 2000 *** *** 621,627 info = OBJECTAT(arrayIndex); if (info->loc >= beginRangeLoc || info->attrs == attributes) { ! info->loc = beginRangeLoc; unCacheAttributes(info->attrs); RELEASE(info->attrs); info->attrs = attributes; --- 621,630 info = OBJECTAT(arrayIndex); if (info->loc >= beginRangeLoc || info->attrs == attributes) { ! if (arrayIndex == 0) ! info->loc = 0; ! else ! info->loc = beginRangeLoc; unCacheAttributes(info->attrs); RELEASE(info->attrs); info->attrs = attributes; ___ Bug-gnustep mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/bug-gnustep
Fix: NSView
Hi, here is a fix for NSView (CVS 2000-12-16) with two modifications to improve scaling: The first change in [NSView -setFrameSize:] scales the bounds as necessary. The second part is a little modification of [NSView -scaleUnitSquareToSize:] to make it behave the same like on OpenStep. (Unfortunately the specs are not clear in this point, and the current implementation would make sense too). Georg 2000-12-17 Georg Fleischmann * gui/Source/NSView.m ([NSView -setFrameSize:]): scale bounds, if necessary * gui/Source/NSView.m ([NSView -scaleUnitSquareSize:]): scale from bounds instead of frame (like OpenStep) *** gui/Source/NSView.m.old Sat Dec 16 15:29:16 2000 --- gui/Source/NSView.m Sun Dec 17 23:28:21 2000 *** *** 699,705 { (*invalidateImp)(self, invalidateSel); } ! _frame.size = _bounds.size = newSize; [self resizeSubviewsWithOldSize: old_size]; if (_post_frame_changes) --- 699,716 { (*invalidateImp)(self, invalidateSel); } ! ! if (_is_rotated_or_scaled_from_base) ! { ! float sx = _bounds.size.width / _frame.size.width; ! float sy = _bounds.size.height / _frame.size.height; ! ! _frame.size = newSize; ! _bounds.size.width = _frame.size.width * sx; ! _bounds.size.height = _frame.size.height * sy; ! } ! else ! _frame.size = _bounds.size = newSize; [self resizeSubviewsWithOldSize: old_size]; if (_post_frame_changes) *** *** 761,768 { (*invalidateImp)(self, invalidateSel); } ! _bounds.size.width = _frame.size.width / newSize.width; ! _bounds.size.height = _frame.size.height / newSize.height; _is_rotated_or_scaled_from_base = YES; --- 772,779 { (*invalidateImp)(self, invalidateSel); } ! _bounds.size.width = _bounds.size.width / newSize.width; ! _bounds.size.height = _bounds.size.height / newSize.height; _is_rotated_or_scaled_from_base = YES; ___ Bug-gnustep mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/bug-gnustep
Re: Fix: GSTextStorage, setAttributes:range:
Hi Richard, > Hmm ... I'm not convinced. > 1. As far as I can see, it should be impossible for info-loc to be greater > than beginRangeLoc and for arrayIndex to be zero - so the change would have > no effect. (of course, I could have missed something here). Ok, in the case I'm looking into, beginRangeLoc is 1 and thus already greater than info-loc (0). I take it, that it isn't legal that the method is called with a range.location > loc (of the only attribute)? This is what happens. Here is the situation at the beginning of the method: range.location = 1 [textChars length] = 2 infoArray contains only one attribute with loc = 0 If this is illegal, I would continue my search where the method is called. Georg ___ Bug-gnustep mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/bug-gnustep
Re: Fix: GSTextStorage, setAttributes:range:
Hi Richard, > I committed a fix for this - perhaps it cures whatever > problems you are having? Thanks, that works. Georg ___ Bug-gnustep mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/bug-gnustep
Fix: NSBezierPath, appendBezierPathWithArcWithCenter:
Hi, attached is a patch with a bunch of fixes for NSBezierPath to make arcs being displayed. With the patch arcs should now work in any direction and angle. I also added a few lines of discription which I found in the ghostscript code. Georg 2001-02-26 Georg Fleischmann * gui/Source/NSBezierPath.m [NSBezierPath appendBezierPathWithArcWithCenter: ...]: several fixes to make it work diff -c gui/Source/NSBezierPath.m.old gui/Source/NSBezierPath.m diff
Fix: XGGState, DPSarc and DPSarcn
Hi, attached is a patch to make the radius of arcs scale. The fix is not perfect in that it still does not create ellipsis for unequal scale factors in x and y direction (if this case is needed at all). Anyway, I hope it helps. Georg 2001-02-27 Georg Fleischmann * xgps/Source/XGGState.m [XGGState DPSarc:], [XGGState DPSarcn:]: apply transformation matrix to radius diff -c xgps/Source/XGGState.m.old xgps/Source/XGGState.m diff-226-1
Re: Fix: NSBezierPath, appendBezierPathWithArcWithCenter:
Hi Nicola, > Thanks - I read your patch and it made lot of sense - so I applied it. I > did not test it nor did I check on books the formula used to build the > bezier path for the last bit of the arc, so I hope you did. :-) Yes, I have tested it. Anyway, I had to realized another little problem in the same method, so since it isn't committed yet, I will send a new patch covering this remaining issue too. > Ahm - just a quick note - before committing, I sligthly simplified the > formula used for F - not that I changed it (unless I made a typo) - just > did some trivial algebraic/trigonometric simplifications. But as I didn't > test it, please tell me if I did something wrong. Can you send me your changes, so I can test it ? Or did I miss something ? Thanks, Georg ___ Bug-gnustep mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/bug-gnustep
Fix: NSBezierPath, appendBezierPathWithArcWithCenter (2)
> I sligthly simplified the > formula used for F - not that I changed it (unless I made a typo) - just > did some trivial algebraic/trigonometric simplifications. But as I didn't > test it, please tell me if I did something wrong. It works fine. Now, here is the fix for the remaining problem, I mentioned. It also makes the code a little bit shorter. The problem was that circles (360 degree arcs) collapsed to zero in some cases. Georg 2001-03-05 Georg Fleischmann * gui/Source/NSBezierPath.m [NSBezierPath appendBezierPathWithArcWithCenter: ...]: Rearranged handling of start/end angles to avoid collapsing of 360 degree arcs. diff -u gui/Source/NSBezierPath.m.old gui/Source/NSBezierPath.m --- gui/Source/NSBezierPath.m.old Thu Mar 1 16:34:52 2001 +++ gui/Source/NSBezierPath.m Mon Mar 5 16:04:01 2001 @@ -849,10 +849,18 @@ while (startAngle > 360) startAngle = startAngle - 360; - while (endAngle < 0) -endAngle = endAngle + 360; - while (endAngle > 360) -endAngle = endAngle - 360; + if (clockwise) +{ + while (startAngle < endAngle) +endAngle -= 360; + diff = -PI / 2; +} + else +{ + while (endAngle < startAngle) +endAngle += 360; + diff = PI / 2; +} /* Convert the angles to radians */ startAngle_rad = PI * startAngle / 180; @@ -862,23 +870,6 @@ p0 = NSMakePoint (center.x + radius * cos (startAngle_rad), center.y + radius * sin (startAngle_rad)); [self moveToPoint: p0]; - - if (clockwise) -{ - diff = -PI / 2; - if (startAngle_rad < endAngle_rad) - { - startAngle_rad += 2 * PI; - } -} - else -{ - diff = PI / 2; - if (startAngle_rad > endAngle_rad) - { - startAngle_rad -= 2 * PI; - } -} while ((clockwise) ? (startAngle_rad > endAngle_rad) : (startAngle_rad < endAngle_rad)) ___ Bug-gnustep mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/bug-gnustep
Re: Fix: NSBezierPath, appendBezierPathWithArcWithCenter (2)
Hi Nicola, > So - I'd rather propose the following change (I also added lots of > comments to help future bug fixings) - if you can test it and it's Ok, we > could use this one - I tested it: it doesn't do the job. > startAngle = 0 > endAngle = -450 > clockwise > > it wouldn't work... from -90 to 0> Thats exactly what it does, and I think its the correct behavior. To confirm this, I checked the following PostScript code on my OpenStep machine as well as on ghostscript: 200 100 moveto 100 100 100 0 -450 arcn stroke This draws a full circumference. I also took a look at the ghostscript code, and they are doing the same in their arc/arcn code, as my patch does. So I think, it would be the correct thing to do. Another thing, I realized: If the current point is not the start point of the arc, PostScript draws a line from the current position to the start of the arc. To get this behavior in GNUstep, appendBezierPathWithArcWithCenter just has to perform a lineto instead of a moveto to the start position of the arc (if a current point is defined). Georg ___ Bug-gnustep mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/bug-gnustep
Re: Fix: NSBezierPath, appendBezierPathWithArcWithCenter (2)
Hi Nicola, > Does this patch look right to you ? Absolutely, and it works for all I've tested. > ...but I > think the macos-x doc for NSBezierPath says that we should not draw the > line in NSBezierPath. I need to look at it - but if the backend is using > NSBezierPath to draw the arc, then what we need to do is adding the line > in the backend before it draws the arc using NSBezierPath. The macos-x doc doesn't say too much, but as far as I interpret the design of NSBezierPath it was designed with the PostScript architecture in mind (eg the arc command has the same weird parameters as PostScript has for arcs). Without the line segment, the parameters would be extremely overdetermined (eg center and angle would be enough). > To add to the confusion, the macos-x doc for NSBezier path says that the > `clockwise' argument determines whether angles are measured clockwise or > counterclockwise, while postscript operators and common sense push us to I have interpreted 'angle' as the angle between the start angle and the end angle, so I have never seen any conflicts in the descriptions :-) > I won't bother you with the explanation of why I don't like this > prescription at all (but eg :-), try drawing an arc between angles 0 and > -{a little number} (such as -0.1) using arc - the result will be either a > full circle or nothing depending on how little the number is - on my > system -0.001 generates a full circle, while -0.0001 generates nothing - > it is the hardware which determines whether your arc command draws a full > circle or nothing...) On OpenStep this created a circle, even with -0.1. With ghostscript I have the same results as you have. Georg ___ Bug-gnustep mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/bug-gnustep
Fix: NSView, setBoundsOrigin:
Hi, here is a patch for NSView to renew the gstate after setting a new origin. I hope it is useful ... Georg 2001-04-09 Georg Fleischmann * gui/Source/NSView.m [NSView setBoundsOrigin:]: renew gstate diff -u gui/Source/NSView.m.old gui/Source/NSView.m --- gui/Source/NSView.m.old Mon Apr 9 22:37:28 2001 +++ gui/Source/NSView.m Mon Apr 9 22:38:38 2001 @@ -851,6 +851,11 @@ } [_boundsMatrix setFrameOrigin: NSMakePoint(-newOrigin.x, -newOrigin.y)]; + /* renew gstate */ + if (_allocate_gstate && _gstate) +PSundefineuserobject(_gstate); + _gstate = 0; + if (_post_bounds_changes) { [nc postNotificationName: NSViewBoundsDidChangeNotification ___ Bug-gnustep mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/bug-gnustep
Fix, IMConnectors, establishConnection
Hi, here is a patch for [IMOutletConnector establishConnection] which removes a retain, which I think is one too much. My graphic application (being ported from OpenStep) uses gmodels extensivly, and it now frees closed Windows as expected. Georg 2001-04-11 Georg Fleischmann * gui/Model/IMConnectors.m [IMOutletConnector establishConnection:]: retain removed diff -u gui/Model/IMConnectors.m.old gui/Model/IMConnectors.m --- gui/Model/IMConnectors.m.oldWed Apr 11 19:35:57 2001 +++ gui/Model/IMConnectors.mWed Apr 11 19:38:15 2001 @@ -128,10 +128,7 @@ if (setSelector && [_source respondsToSelector:setSelector]) [_source performSelector:setSelector withObject:_destination]; else -{ - [_destination retain]; GSSetInstanceVariable(_source, label, &_destination); -} } @end /* IMOutletConnector */ ___ Bug-gnustep mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/bug-gnustep
Re: Fix, IMConnectors, establishConnection
Hi Nicola, > Ahm - I'm not convinced by the fix - but the problem is - I don't know > exactly what problem you are having ! :-) Your right. Your fix looks much more promising, and in my tests it gives the same positive results. My problem was, that windows created from a gmodel file, were never dealloced. The retainCount was 2 instead of 1, after loading the model (and releasing the autorelease pool, ofcourse). It seems that there is at least one more problem of this kind with a subclass of scroll view. I will have a closer look at this, if you don't have a suspicion already. Georg ___ Bug-gnustep mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/bug-gnustep
Re: Fix, IMConnectors, establishConnection
> I have a suspicion - but I don't have the time to look into it deeply > enough to confirm it now - anyway - here is a quickly hacked patch - it > might help you. Yes, this helped greatly, thanks. But... I had to realize that my compiler hasn't compiled IMConnectors after removing my patch :-( This lead me to the wrong assumption that your first patch fixed my first problem. It didn't. Now it is clear that the patch, I proposed for IMConnectors is still important (no retain on _destination). Sorry for the confusion. I try to explain my test results: With the retain, the (observed) objects loaded from a gmodel file have a retainCount = 2. On OpenStep retainCount = 1. Without the retain in IMConnectors, the retainCounts are the same as on OpenStep (1), and eg. closing a window results in deallocating objects as expected. I don't get any crash resulting from that change, so I'm pretty sure now that my patch does exactly the right thing. Georg ___ Bug-gnustep mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/bug-gnustep
Fix, GSTextStorage, replaceCharactersInRange:withString:
Hi, here is a fix for GSTextStorage (snapshot from 2001-04-19). The patch fixes a problem when replacing a range with a string of zero length: It recalculates the effective range to match the modified set of attributes before comparing with the effective range. If this is not done and there were more than one attribute in the range which is being replaced, the (old) effective range wouldn't match the range being replaced, and a range of zero length would remain... Georg 2001-04-22 Georg Fleischmann * gui/Source/GSTextStorage.m [GSTextStorage.m replaceCharactersInRange:withString:]: recalculate effective range after removing attributes diff -u gui/Source/GSTextStorage.m.old gui/Source/GSTextStorage.m --- gui/Source/GSTextStorage.m.old Sat Jan 13 21:33:32 2001 +++ gui/Source/GSTextStorage.m Sun Apr 22 21:36:40 2001 @@ -738,18 +738,25 @@ } moveLocations = [aString length] - range.length; - if (effectiveRange.location == range.location -&& effectiveRange.length == range.length -&& (moveLocations + range.length) == 0) + + /* + * If we are replacing a range with a zero length string and the + * range we are using matches the range replaced, then we must + * remove it from the array to avoid getting a zero length range. + */ + if ((moveLocations + range.length) == 0) { - /* - * If we are replacing a range with a zero length string and the - * range we are using matches the range replaced, then we must - * remove it from the array to avoid getting a zero length range. - */ - arrayIndex--; - REMOVEAT(arrayIndex); - arraySize--; + attrs = _attributesAtIndexEffectiveRange(start, &effectiveRange, +tmpLength, _infoArray, &arrayIndex); + arrayIndex ++; + + if (effectiveRange.location == range.location +&& effectiveRange.length == range.length) +{ + arrayIndex--; + REMOVEAT(arrayIndex); + arraySize--; +} } /* ___ Bug-gnustep mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/bug-gnustep
Inconsistency: NSCalendarDate, dateWithString:calendarFormat:
Hi, there is a little inconsistency with [NSCalendarDate -dateWithString:calendarFormat:] compared to OpenStep: If the string applied does not provide all values of the date (eg. minutes missing), GNUstep fills them with values of the current date. OpenStep uses zero values instead. Just to let you know. Georg ___ Bug-gnustep mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/bug-gnustep
Bug, application.make
Hi, Compiling todays snapshot (2001-07-19), I realized that the application makefile creates an error on my system: make[1]: Entering directory `/usr/local/src/GNUstep/core/gui/Model' /usr/GNUstep/System/Makefiles/application.make:61: *** missing separator. Stop. make[1]: Leaving directory `/usr/local/src/GNUstep/core/gui/Model' make: *** [internal-all] Error 2 It's the following line: (warning APP_EXTENSION is $(APP_EXTENSION)) I just removed the line to make it work again. Georg ___ Bug-gnustep mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/bug-gnustep
Fix, GSSimpleLayoutManager
Hi, here is a fix for [GSSimpleLayoutManager boundingRectForGlyphRange:inTextContainer:]. For a zero range the method now returns a zero width. For a nonzero range the range is not inverted any more. I have no idea what the inversion was intended for, but it seemed wrong to me. Now it works as expected. To be sure, I compared the results of the method with OpenStep, and obtained the same return values (except for the height of a zero range). So, I'm quite sure I did it the right way. Georg 2001-07-19 Georg Fleischmann * gui/Source/GSSimpleLayoutManager.m [GSSimpleLayoutManager boundingRectForGlyphRange:inTextContainer:]: no inversion of rect.width (width - rect.size.width) diff -u gui/Source/GSSimpleLayoutManager.m.old gui/Source/GSSimpleLayoutManager.m --- gui/Source/GSSimpleLayoutManager.m.old Tue Jul 10 04:30:27 2001 +++ gui/Source/GSSimpleLayoutManager.m Thu Jul 19 22:06:19 2001 @@ -323,7 +323,7 @@ if (![_textStorage length] || ![_lineLayoutInformation count]) { - return NSMakeRect(0, 0, width, 12); + return NSMakeRect(0, 0, 0, 12); } i1 = [self lineLayoutIndexForGlyphIndex: aRange.location]; @@ -339,7 +339,6 @@ rect1 = NSUnionRect(rect1, currentInfo->usedRect); } - rect1.size.width = width - rect1.origin.x; return rect1; } ___ Bug-gnustep mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/bug-gnustep
Fix, attributedStringConsumer
here is a patch for GSRTFcolorfg() to allow parsing of RTF streams created on OpenStep. OpenStep doesn't add a color list to rtf streams, if the color is just black. The attached patch simply sets the color to black, if the color index is out of bounds. Georg 2001-07-24 Georg Fleischmann * gui/Source/Parsers/attributedStringConsumer.m attributedStringConsumer.m, GSRTFcolorfg(): set color to black if index is out of bounds diff -u gui/Source/Parsers/attributedStringConsumer.m.old gui/Source/Parsers/attributedStringConsumer.m --- gui/Source/Parsers/attributedStringConsumer.m.old Tue Oct 24 01:23:34 2000 +++ gui/Source/Parsers/attributedStringConsumer.m Tue Jul 24 23:09:44 2001 @@ -764,7 +764,10 @@ void GSRTFcolorfg(void *ctxt, int color) { - ASSIGN(FGCOLOUR, [COLOURS objectAtIndex: color]); + if ([COLOURS count] <= color) +ASSIGN(FGCOLOUR, [NSColor blackColor]); + else +ASSIGN(FGCOLOUR, [COLOURS objectAtIndex: color]); } void GSRTFsubscript(void *ctxt, int script) ___ Bug-gnustep mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/bug-gnustep
Fix, XGGState, DPSrectstroke
here is a simple patch for XGGState, DPSrectstroke. The fix avoids drawing of a very large rect for zero width or height. 2001-07-26 Georg Fleischmann * xgps/Source/XGGState.m: allow drawing of zero rectangles diff -u xgps/Source/XGGState.m.old xgps/Source/XGGState.m --- xgps/Source/XGGState.m.old Tue May 22 04:31:42 2001 +++ xgps/Source/XGGState.m Thu Jul 26 23:35:11 2001 @@ -1602,8 +1602,10 @@ DPS_ERROR(DPSinvalidid, @"No Drawable defined"); bounds = XGViewRectToX(self, NSMakeRect(x, y, w, h)); - bounds.width--; - bounds.height--; + if (bounds.width > 0) +bounds.width--; + if (bounds.height > 0) +bounds.height--; XDrawRectangle(XDPY, draw, xgcntxt, bounds.x, bounds.y, bounds.width, bounds.height); ___ Bug-gnustep mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/bug-gnustep
Fix, NSWindow, initWithContentRect...
Hi, here is a little patch for NSWindows -initWithContentRect... to constrain the window frame to the screen. Otherwise a newly created window would never be checked against the screen. Georg 2001-07-27 Georg Fleischmann * gui/Source/NSWindow.m [NSWindow initWithContentRect:styleMask:backing:defer:screen:]: constrain frame rect to screen diff -u gui/Source/NSWindow.m.old gui/Source/NSWindow.m --- gui/Source/NSWindow.m.old Fri Jul 27 23:09:12 2001 +++ gui/Source/NSWindow.m Fri Jul 27 23:07:56 2001 @@ -677,6 +677,7 @@ _styleMask = aStyle; _frame = [NSWindow frameRectForContentRect: contentRect styleMask: aStyle]; + _frame = [self constrainFrameRect:_frame toScreen:[self screen]]; _minimumSize = NSMakeSize(_frame.size.width - contentRect.size.width + 1, _frame.size.height - contentRect.size.height + 1); _maximumSize = NSMakeSize (10e4, 10e4); ___ Bug-gnustep mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/bug-gnustep
Fix, NSWindow, constrain
Hi, I had to realize that my latest patch for NSWindow produced some problems with GWorkspace. After reading the specs more carefully, the constrain should be better applied to the [NSWindow orderWindow:relativeTo:] method, giving off screen windows the chance to be placed anywhere. I think it would be correct to remove the constrain in [NSWindow setFrame:] too. 2001-07-30 Georg Fleischmann * gui/Source/NSWindow.m [NSWindow orderWindow:relativeTo:]: constrain added [NSWindow initWithContentRect:styleMask:backing:defer:screen:] and [NSWindow setFrame:]: constrain removed diff -u gui/Source/NSWindow.m.old gui/Source/NSWindow.m --- gui/Source/NSWindow.m.old Mon Jul 30 14:41:05 2001 +++ gui/Source/NSWindow.m Mon Jul 30 14:50:40 2001 @@ -677,7 +677,6 @@ _styleMask = aStyle; _frame = [NSWindow frameRectForContentRect: contentRect styleMask: aStyle]; - _frame = [self constrainFrameRect:_frame toScreen:[self screen]]; _minimumSize = NSMakeSize(_frame.size.width - contentRect.size.width + 1, _frame.size.height - contentRect.size.height + 1); _maximumSize = NSMakeSize (10e4, 10e4); @@ -1140,6 +1139,7 @@ } else { + _frame = [self constrainFrameRect:_frame toScreen:[self screen]]; // create deferred window if(_windowNum == 0) { @@ -1336,8 +1336,6 @@ - (void) setFrame: (NSRect)frameRect display: (BOOL)flag { NSNotificationCenter *nc = [NSNotificationCenter defaultCenter]; - - frameRect = [self constrainFrameRect: frameRect toScreen: [self screen]]; if (_maximumSize.width > 0 && frameRect.size.width > _maximumSize.width) { ___ Bug-gnustep mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/bug-gnustep
Re: Fix, attributedStringConsumer
Hi Nicola, > sorry to be late in answering - can you send us a little RTF showing your > problem ? thanks. Here is an rtf stream containing just "text" and attached is the same as rtf file (both created on OpenStep). You can load the rtf file with Ink.app and should get the mentioned index out of bounds exception. Georg <7b5c7274 66305c61 6e73697b 5c666f6e 7474626c 5c66305c 66737769 73732048 656c7665 74696361 3b7d0a5c 70617264 5c747835 36305c74 78313132 305c7478 31363830 5c747832 3234305c 74783238 30305c74 7836 305c7478 33393230 5c747834 3438305c 74783530 34305c74 78353630 305c7478 36313630 5c747836 3732300a 0a5c6630 5c667332 34205c63 66302074 6578747d 0a> TXT.rtf
Fix, NSBezierPath, appendBezierPathWithArc...
Hi, here is a little patch for [NSBezierPath appendBezierPathWithArc...]. It draws a line segment to the start point of the arc. A move is only used if the arc is the first element in the path. This makes the method more complient to the PostScript specs, and is needed to make complex paths work at all. Georg 2001-08-01 Georg Fleischmann * gui/Source/NSBezierPath.m [NSBezierPath appendBezierPathWithArc...]: draw lineto to start point of arc diff -u gui/Source/NSBezierPath.m.old gui/Source/NSBezierPath.m --- gui/Source/NSBezierPath.m.old Sat May 19 04:31:27 2001 +++ gui/Source/NSBezierPath.m Wed Aug 1 18:06:06 2001 @@ -911,7 +911,14 @@ /* Start point */ p0 = NSMakePoint (center.x + radius * cos (startAngle_rad), center.y + radius * sin (startAngle_rad)); - [self moveToPoint: p0]; + if (![self elementCount]) +[self moveToPoint: p0]; + else + { +NSPoint ps = [self currentPoint]; +if (p0.x != ps.x || p0.y != ps.y) + [self lineToPoint: p0]; + } while ((clockwise) ? (startAngle_rad > endAngle_rad) : (startAngle_rad < endAngle_rad)) ___ Bug-gnustep mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/bug-gnustep
XGGState, filled complex paths
Hi, I have written a method to display filled bezier paths of higher complexity for XGGState. The patch provides correct display of paths with separated path elements, eg. a circle in a circle in a circle. For stroked paths, clipping, and for simple paths the old _doPath is still called. Only more complex paths use the new _doComplexPath method. I have created a screenshot which shows some paths: http://www.vhf.de/products/cenon/GNUstep1.jpg Georg 2001-08-01 Georg Fleischmann * xgps/Source/XGGState.m [XGGState _paintPath:]: more complex path handling added [XGGState _doComplexPath:]: new, fill complex bezier paths diff -u xgps/Source/XGGState.m.old xgps/Source/XGGState.m --- xgps/Source/XGGState.m.old Thu Jul 26 23:35:11 2001 +++ xgps/Source/XGGState.m Wed Aug 1 19:13:24 2001 @@ -912,26 +912,132 @@ } } +/* fill a complex path. All coordinates should already + have been transformed to device coordinates. */ +- (void) _doComplexPath: (XPoint*)pts : (int*)types : (int)count + ll: (XPoint)ll ur: (XPoint)ur draw: (ctxt_object_t)type +{ + int x, y, i, j, cnt, nseg = 0; + XSegment segments[count]; + Window root_rtn; + unsigned int width, height, b_rtn, d_rtn; + + COPY_GC_ON_CHANGE; + if (draw == 0) +DPS_ERROR(DPSinvalidid, @"No Drawable defined"); + + XGetGeometry(XDPY, draw, &root_rtn, &x, &y, &width, &height, + &b_rtn, &d_rtn); + if (ur.x < x || ll.x > x + (int)width) +return; + + if (ll.y < y) +ll.y = y; + if (ur.y > y + height) +ur.y = y + height; + + /* draw horicontal lines from the bottom to the top of the path */ + for (y = ll.y; y <= ur.y; y++) +{ + intx[count], w[count], y0, y1; + intyh = y * 2 + 1; // shift y of horicontal line + XPoint lastP, p1; + + /* intersect horicontal line with path */ + for (i = 0, cnt = 0; i < count-1; i++) + { + if (types[i] == 0)// move (new subpath) + lastP = pts[i]; + if (types[i+1] == 0) // last line of subpath + { + if (lastP.y == pts[i].y) + continue; + p1 = lastP; // close subpath + } + else + p1 = pts[i+1]; + y0 = pts[i].y * 2, y1 = p1.y * 2; + if ((y0 < yh && yh < y1) || (y1 < yh && yh < y0) ) + { + int dy = yh - pts[i].y * 2; + int ldy = y1 - y0; + int ldx = (p1.x - pts[i].x) * 2; + + x[cnt] = pts[i].x + (ldx * dy / ldy) / 2; + /* sum up winding directions */ + if (type == path_fill) + w[cnt] = ((cnt) ? w[cnt-1] : 0) + (y0 < y1) ? -1 : 1; + cnt++; + } + } + + /* sort intersections */ + for (i = 0; i < cnt-1; i++) + { + for (j=i+1; j start line on odd intersection count + * winding fill -> start line on odd winding count + */ + if ((type == path_eofill && !(i%2)) || (type == path_fill && w[i])) + { + segments[nseg].x1 = x[i]; + segments[nseg].x2 = x[i+1]; + segments[nseg].y1 = segments[nseg].y2 = y; + nseg++; + } + } + + XDrawSegments(XDPY, draw, xgcntxt, segments, nseg); + if (drawingAlpha) + { +xr_device_color_t old_color; +NSAssert(alpha_buffer, NSInternalInconsistencyException); + +old_color = color; +[self DPSsetgray: color.field[AINDEX]]; +XDrawSegments(XDPY, alpha_buffer, xgcntxt, segments, nseg); +[self setColor: old_color]; + } + nseg = 0; +} // for y +} + - (void) _paintPath: (ctxt_object_t) drawType { unsigned count; - NSBezierPath *flatPath; + NSBezierPath *flatPath; + XPoint ll, ur; if (!path) return; + ll.x = ll.y = 0x7FFF; + ur.x = ur.y = 0; flatPath = [path bezierPathByFlatteningPath]; count = [flatPath elementCount]; if (count) { XPoint pts[count]; + int ts[count]; unsigned j, i = 0; NSBezierPathElement type; - NSPoint points[3]; - BOOL first = YES; - NSPoint p, last_p; - BOOL doit; - + NSPoint points[3]; + BOOL first = YES; + NSPoint p, last_p; + BOOL doit; + BOOL complex = NO; + for(j = 0; j < count; j++) { doit = NO; @@ -939,16 +1045,23 @@ switch(type) { case NSMoveToBezierPathElement: - if (i > 1) - { - [self _doPath: pts : i draw: drawType]; - } - i = 0; + if (drawType != path_eofill && drawType != path_fill) + { + if (i > 1) +
Re: Fix: NSTextView.m, -setSelectedRange:...
Hi Nicola, > thanks for the bug report - I tried your patches but they didn't look > like making any difference to me with regards to this problem ... and > to me it looked like a bug in replaceCharactersInRange: etc so I fixed > that one. Let me know if you have problems with the fix applied to > CVS, it works for me. Your fix does it right. However, the first part of my patch is still needed. It prevents [NSTextView setSelectedRange...] from asking a text storage of zero length for attributes. In this case, the text storage will always return an empty dictionary, thus setting the attributes of the text view to zero. On OpenStep, asking a zero text storage for attributes would raise an exception. Here is the shortened patch: --- gui/Source/NSTextView.m.origTue Aug 14 04:30:39 2001 +++ gui/Source/NSTextView.m Wed Aug 15 21:35:03 2001 @@ -1358,7 +1358,7 @@ } else /* no selection, only insertion point */ { - if (_tf.is_rich_text) + if (_tf.is_rich_text && [_textStorage length]) { NSDictionary *dict; ___ Bug-gnustep mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/bug-gnustep
Re: Fix: NSTextView.m, -setSelectedRange:...
> Perhaps we might want to fix this too ... ? I think an exception would be more reasonable than returning an empty dictionary. Georg ___ Bug-gnustep mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/bug-gnustep
Re: Transparency issues
Hi Marko, I have taken a look at this some time ago, and found the following: Transparency in GNUstep is done by setting the background color of the image. This 'hack' is used in NSButtonCell but not in NSCell (yet?). So, if you have an image in an NSButton, the same image is displayed with this background in cells too. But if you only use NSCell the background of the image remains white. Georg ___ Bug-gnustep mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/bug-gnustep
Fix: NSCalendarDate, descriptionWithCalendarFormat:locale:
Hi, here is a little patch to make the millisec output of the description method work. Georg 2001-08-28 Georg Fleischmann * base/Source/NSCalendarDate.m [NSCalendarDate descriptionWithCalendarFormat:locale:]: make milliseconds works (%F) diff -u base/Source/NSCalendarDate.m.orig base/Source/NSCalendarDate.m --- base/Source/NSCalendarDate.m.orig Tue Aug 28 19:59:49 2001 +++ base/Source/NSCalendarDate.mTue Aug 28 20:06:43 2001 @@ -1334,10 +1334,10 @@ s = ([self dayOfCommonEra] - GREGORIAN_REFERENCE) * 86400.0; s -= (_seconds_since_ref + [_time_zone secondsFromGMTForDate: self]); - s = abs(s); + s = fabs(s); s -= floor(s); ++i; - k = VSPRINTF_LENGTH(sprintf(&(buf[j]), "%03d", (int)s*1000)); + k = VSPRINTF_LENGTH(sprintf(&(buf[j]), "%03d", (int)(s*1000))); j += k; break; ___ Bug-gnustep mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/bug-gnustep
Fix: NSView, view clipping
Hi, here are a bunch of patches related to a small problem with the view clipping in NSView. The fix promises to solve the following problems: - sporadically blank areas in panels, especially inside of a Matrix - problems with drawing when NSTextViews are mixed with PS-Operators Every lockFocus of a view sets the view clipping rectangle to the bounds of the view, but doesn't restore the view clipping area afterwards. This isn't a problem as long as only views are drawn. However, if subviews (eg. NSTextView) are drawn before PS-Operators, this may result in wrong clipping. The easiest way to solve the problem was to reset the clipping area after an unlockFocus by just adding DPSinitviewclip(ctxt) at the end of unlockFocusWithFlush:. This seems to work. I decided to use the DPSsave and DPSrestore functions to restore the viewclipping area instead. I think this is what should happen. Unfortunately they were not defined, and so my little fix grew through 9 files :-( The following patches need a complete recompile (make clean) of xgps and gui. Also some applications using DPS methods need a recompile. I'm sorry, it's quite a bunch of many little changes. If someone has a better idea, I'm not angry at all. Georg 2001-08-31 Georg Fleischmann * gui/Source/NSView.m [NSView lockFocusInRect:]: DPSsave(ctxt) added [NSView unlockFocusWithFlush:]: DPSrestore(ctxt) added * gui/Headers/gnustep/gui/DPSOperators.h DPSrestore() and DPSsave(): new * gui/Headers/gnustep/gui/GSMethodTable.h DPSrestore and DPSsave added * gui/Headers/gnustep/gui/NSGraphicsContext.h -DPSrestore and -DPSsave added * gui/Source/NSGraphicsContext.m [NSGraphicContext _inittializeMethodTable]: DPSrestore and DPSsave added [NSGraphicsContext DPSrestore]: new [NSGraphicsContext DPSsave]: new * xgps/Headers/gnustep/xgps/XGContext.h VM_STACKSIZE, vcstack and vmstackTop added * xgps/Source/XGContext.m [XGContext DPSrestore]: new [XGContext DPSsave]: new * xgps/Headers/gnustep/xgps/XGGState.h declaration of setClipMask added * xgps/Source/XGGState.m private declaration of setClipMask removed --- gui/Source/NSView.m.origWed Aug 29 22:06:39 2001 +++ gui/Source/NSView.m Thu Aug 30 23:56:42 2001 @@ -1328,6 +1328,7 @@ return; } + DPSsave(ctxt); [ctxt lockFocusView: self inRect: rect]; wrect = [self convertRect: rect toView: nil]; NSDebugLLog(@"NSView", @"Displaying rect \n\t%@\n\t window %p", @@ -1416,6 +1417,7 @@ } [window_t->_rectsBeingDrawn removeLastObject]; [ctxt unlockFocusView: self needsFlush: YES ]; + DPSrestore(ctxt); } - (void) lockFocus --- gui/Headers/gnustep/gui/DPSOperators.h.orig Fri Apr 21 00:17:41 2000 +++ gui/Headers/gnustep/gui/DPSOperators.h Thu Aug 30 18:00:23 2001 @@ -668,6 +668,17 @@ __attribute__((unused)); /* --- */ +/* System ops */ +/* --- */ +static inline void +DPSrestore(GSCTXT *ctxt) +__attribute__((unused)); + +static inline void +DPSsave(GSCTXT *ctxt) +__attribute__((unused)); + +/* --- */ /* Window system ops */ /* --- */ static inline void @@ -2177,6 +2188,23 @@ { (ctxt->methods->DPScurrentalpha_) (ctxt, @selector(DPScurrentalpha:), a); +} + +/* --- */ +/* System ops */ +/* --- */ +static inline void +DPSrestore(GSCTXT *ctxt) +{ + (ctxt->methods->DPSrestore) +(ctxt, @selector(DPSrestore)); +} + +static inline void +DPSsave(GSCTXT *ctxt) +{ + (ctxt->methods->DPSsave) +(ctxt, @selector(DPSsave)); } /* --- */ --- gui/Headers/gnustep/gui/GSMethodTable.h.origSat May 5 04:30:46 2001 +++ gui/Headers/gnustep/gui/GSMethodTable.h Thu Aug 30 18:51:44 2001 @@ -369,6 +369,14 @@ void (*DPSviewclippath) (NSGraphicsContext*, SEL); /* --- */ +/* System ops */ +/* --- */ + void (*DPSrestore) + (NSGraphicsContext*, SEL); + void (*DPSsave) + (NSGraphicsContext*, SEL); + +/* --- */ /* Window system ops */ /* --- */ void (*DPScurrentdrawingfunction_) --- gui/Headers/gnustep/gui/NSGraphicsCont
Re: Fix: NSView, view clipping
Hi Fred, > I am having the same drawing problems, where sometimes parts of a window > is missing (e.g. in the Box test of GSTest). Adam already mailed me, and he is checking the options to solve the problem. > I had a look at your clipping code and did not quite > understand it. Your code seems to add another stack to the graphics > context, while we already use a stack for the gstates, which should be > handling the clipping as well. I don't think that we should introduce a > new PS call for this functionality, it should already be possible to > implement this by correcting our current code. The problem is, that view clipping is not handled by the graphics state. That's why I added this little extra stack to the context. If view clipping is really needed, an additional stack is necessary. Here is the excerpt from the PostScript Reference: ... The view clipping path is part of the PostScript execution context, not the graphics state. A context initially has no view clipping path. The operators that alter the view clipping path do not affect the clipping path in the graphics state or vice versa. The view clipping path is not affected by gsave and grestore. However, a restore will reinstate the view clipping path that was in effect at the time of the matching save. View clips do not nest; rather, a new view clipping path replaces the existing one. ... > First of all [NSView lockFocusInRect:] looks wrong. It only uses the > given rect to set the clipping when there is no gstate for the current > view. This are, as far as I see it, two independent operations, the True, the rectangle is never used for clipping when there is a gstate. Maybe this should be fixed too. > Perhaps solving this would make your problem disappear. If > not the problem is with the gstate itself and we should have a closer > look on this. It makes it worse, because the view clipping won't be restored. Georg ___ Bug-gnustep mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/bug-gnustep
Re: Fix: NSView, view clipping
> lockFocus. The problem with this is that user objects (such as gstates) > are stored in local VM, and a restore invalidates anything in local VM. Was rectviewclip designed for use in root views only ? > The only other alternative is to go back to gsave/grestore. I did a quick test and found one problem in using rectclip: DPSimage depends on the viewclip for clipping. Clipping an image against the clipping path in gstate could become quite complicated. Just using the window bounds would result in problems with images which should be clipped to a view. Georg ___ Bug-gnustep mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/bug-gnustep
Fix: XGContextEvent, initialize_keyboard()
Hi, here is a little patch which defines the right Alt key for some European (and maybe other) keyboards. These keyboards use Mode_switch instead of ALT_R for the right Alternate key (I have no idea or deeper insight what is the reason for this). I'm aware that you can set the right Alt key in the default database, but I think there should be a default for these keyboards too. Georg 2001-09-14 Georg Fleischmann * xgps/Source/SharedX/XGContextEvent.m initialize_keyboard(): if ALT_R is not defined check for Mode_switch --- xgps/Source/SharedX/XGContextEvent.m.orig Thu Sep 13 21:57:35 2001 +++ xgps/Source/SharedX/XGContextEvent.mThu Sep 13 22:00:22 2001 @@ -1348,7 +1348,11 @@ _alt_keycodes[1] = default_key_code (display, defaults, @"GSFirstAlternateKey"); if (_alt_keycodes[1] == 1) -_alt_keycodes[1] = XKeysymToKeycode (display, XK_Alt_R); +{ + _alt_keycodes[1] = XKeysymToKeycode (display, XK_Alt_R); + if (_alt_keycodes[1] == 0) +_alt_keycodes[1] = XKeysymToKeycode (display, XK_Mode_switch); +} _alt_keycodes[2] = default_key_code (display, defaults, @"GSSecondAlternateKey"); if (_alt_keycodes[2] == 1) ___ Bug-gnustep mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/bug-gnustep
Fix: NSTextView, -drawRect:
Hi, here is a patch for NSTextView that redraws the background correctly when characters are deleted. Georg 2001-09-14 Georg Fleischmann * gui/Source/NSTextView.m ([NSTextView -drawRect:]): redraw background for entire rect not just glyph range --- gui/Source/NSTextView.m.origFri Aug 31 04:30:41 2001 +++ gui/Source/NSTextView.m Fri Sep 14 19:30:40 2001 @@ -2538,8 +2538,8 @@ inTextContainer: _textContainer]; if (_tf.draws_background) { - [_layoutManager drawBackgroundForGlyphRange: drawnRange - atPoint: _textContainerOrigin]; + [[self backgroundColor] set]; + NSRectFill(rect); } [_layoutManager drawGlyphsForGlyphRange: drawnRange ___ Bug-gnustep mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/bug-gnustep
Re: Fix: NSTextView, -drawRect:
Hi Fred, seems that I missed this issue before. > I will have to reject the changes you suggest for NSTextView the same as > I did some time ago for a similar change by Ludovic. Here is the mail I > did send at that time to Ludovic: Hmm, I'm still sure that my patch from July does the right thing. I have compared the results of boundingRectForGlyphRange with the results on OpenStep to make sure that I did it right. But, I agree that this triggered the redraw problem: There was this inversion of the glyph width (rect1.size.width = width - rect1.origin.x) in boundingRectForGlyphRange, which (in most cases) accidently increased the glyph width, and thus made the rectangle sufficient big for deleting the background of deleted characters. Anyway, this wasn't correct. Now, the glyph bounds are calculated correctly, but when deleting a character, the glyph bounds (in drawRect) do not include the deleted character(s) any more. The only place where the glyph bounds of a deleted range are known is before deleting the characters (as far as I can see). As the delete methods doesn't seem to be the right place for a redraw, maybe the affected glyph bounds (before delete) should be remembered, until the next call of drawRect? Then the optimal area could be redrawn. What do you think? Georg ___ Bug-gnustep mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/bug-gnustep
Fix: Printing
Hi, here are three patches which fix a bunch of bugs for printing. With the fixes [NSView -dataWithEPSInsideRect:] is now working for my application. The changes in NSPrintOperation create a context and deliver the results for writing EPSData. For all print operations, the context will be removed from the context list after the printing has been finished. The change in XGStreamContext just closes the stream. This can't be done in dealloc, because the written file is needed before the autorelease pool has been released. I have added a subclass of -destroyContext to close the stream. The change in NSView removes the transformations to the window for printing, because the printed view has to be the base. I'm not sure if this one is really done in a wise way (Opinions?). For now, I have added this to -dataWithEPSInsideRect only, but it has to be done for all printing operations. Georg 2001-09-16 Georg Fleischmann * gui/Source/NSPrintOperation.m [NSPrintOperation -destroyContext:]: remove context from the context list. Otherwise we will never get dealloced. [NSPrintOperation -_print:]: use displayRectIgnoringOpacity to avoid drawing of our ancestors. [GSEPSPrintOperation -createContext:]: create a context. [GSEPSPrintOperation -deliverResult:]: add contents of written file to data object. * gui/Source/XGStreamContext.m [XGStreamContext -destroyContext:]: new, to close the stream [XGStreamContext -dealloc:]: closing of stream removed. This has to be done earlier (before we deliver the results). * gui/Source/NSView.m [NSView -dataWithEPSInsideRect:]: remove transformations to window during the printing operation. --- gui/Source/NSPrintOperation.m.orig Tue Jul 31 04:30:34 2001 +++ gui/Source/NSPrintOperation.m Sun Sep 16 20:48:03 2001 @@ -318,6 +318,7 @@ - (void)destroyContext { + [_context destroyContext]; DESTROY(_context); } @@ -465,7 +466,7 @@ - (void) _print { // This is the actual printing - [_view displayRect: _rect]; + [_view displayRectIgnoringOpacity: _rect]; } @end @@ -554,14 +555,24 @@ - (NSGraphicsContext*)createContext { - // FIXME - return nil; + NSMutableDictionary *info = [_printInfo dictionary]; + NSGraphicsContext *psContext; + + [info setObject: _path forKey: @"NSOutputFile"]; + psContext = [NSGraphicsContext postscriptContextWithInfo: info]; + + return psContext; } - (BOOL)deliverResult { - if (_data != nil && _path != nil && [_data length]) -return [_data writeToFile: _path atomically: NO]; + if (_data != nil && _path != nil) +{ + NSString *eps; + + eps = [NSString stringWithContentsOfFile: _path]; + [_data setData: [eps dataUsingEncoding:NSASCIIStringEncoding]]; +} return YES; } --- xgps/Source/XGStreamContext.m.orig Sun Sep 16 16:44:37 2001 +++ xgps/Source/XGStreamContext.m Sun Sep 16 16:52:28 2001 @@ -61,6 +61,13 @@ return NULL; } +- (void) destroyContext; +{ + if (gstream) +fclose(gstream); + [super destroyContext]; +} + - initWithContextInfo: (NSDictionary *)info { NSZone *zone = GSObjCZone(self); @@ -106,8 +113,6 @@ - (void) dealloc { - if (gstream) -fclose(gstream); RELEASE(opstack); RELEASE(gstack); RELEASE(glist); --- gui/Source/NSView.m.origFri Sep 7 04:30:41 2001 +++ gui/Source/NSView.m Sun Sep 16 21:29:25 2001 @@ -2409,10 +2409,22 @@ - (NSData*) dataWithEPSInsideRect: (NSRect)aRect { NSMutableData *data = [NSMutableData data]; - + NSView *superview = _super_view; + + /* for printing we have to get rid of any transformations + * to our superviews and window. + */ + [self _invalidateCoordinates]; + _super_view = nil; + [self _rebuildCoordinates]; + _super_view = superview; + [[NSPrintOperation EPSOperationWithView: self insideRect: aRect toData: data] runOperation]; + + _coordinates_valid = NO; + return data; } ___ Bug-gnustep mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/bug-gnustep
Re: Fix: Printing
> I added this patch although I completely rewrote the NSView changes. > There's more that needs to be done when printing that just reseting the > coordinates so I tried to account for that. It seemed to work for me but > perhaps you can test it again. I finally tested the changes: The changes for NSView are not working for subviews. The reason is that in [NSView displayRectIgnoringOpacity:] unlockFocus is called before the subviews are drawn, thus recalculating _matrixToWindow. The attached patch unlocks the focus after drawing the subviews of the view. Georg --- gui/Source/NSView.m.origWed Sep 26 05:47:20 2001 +++ gui/Source/NSView.m Fri Oct 5 02:46:15 2001 @@ -1728,7 +1728,6 @@ */ [self lockFocusInRect: aRect]; [self drawRect: aRect]; - [self unlockFocusNeedsFlush: YES]; } if (_rFlags.has_subviews == YES) @@ -1786,6 +1785,11 @@ } } } +} + + if (NSIsEmptyRect(aRect) == NO) +{ + [self unlockFocusNeedsFlush: YES]; } /* ___ Bug-gnustep mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/bug-gnustep
Re: NSApplication bug
> I think we should verify how Blink works under MacOS-X and OPENSTEP to see > if we need to generate an event to get the window updated. Here is a backstrace of a blinking cursor on OpenStep with a breakpoint in flushWindow (update is never called in this case). 'DocWindow' is a direct subclass of NSWindow. Georg #0 -[DocWindow flushWindow] (self=0x103098c, _cmd=0x1403580c) at DocWindow.m:34 #1 0x6025495 in -[NSView _displayRectIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:] () #2 0x601ec5d in -[NSView displayIfNeeded] () #3 0x6044b58 in -[NSWindow displayIfNeeded] () #4 0x60513d3 in -[NSWindow _handleWindowNeedsDisplay:] () #5 0x1800a987 in -[NSObject performSelector:withObject:] () #6 0x1801f3f8 in -[NSPerformTimer fire] () #7 0x1800c112 in -[NSRunLoop _doPerformersForMode:reclaim:] () #8 0x1801df89 in -[NSRunLoop _nextTimerInterval:forMode:modeInfo:] () #9 0x1801726e in -[NSRunLoop limitDateForMode:] () #10 0x600a7d5 in _DPSNextEvent () #11 0x6016c58 in -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] () #12 0x602197e in -[NSApplication run] () #13 0x61c704e in NSApplicationMain () #14 0x74e15 in main (argc=1, argv=0xbdfc) at Cenon_main.m:4 #15 0x3d3e in start () at crt0.c:144 ___ Bug-gnustep mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/bug-gnustep
Re: NSPopUpButton
Enrico Sersale wrote: > Actually, is the NSPopUpButton code to be considered stable? With the cvs version from Oct 4th pop up menus still seem quite unreliable to me. Additionally pop up menu items loaded from a gmodel file appear disabled. Georg ___ Bug-gnustep mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/bug-gnustep
Fix: NSBezierPath, +bezierPath
Hi, here are two little patches for a memory leak in NSBezierPath. I think +bezierPath should return an autoreleased object (Mac OS X does). To make this change work, the shared path in XGGState needs a retain. Georg 2002-02-23 Georg Fleischmann * gui/Source/NSBezierPath.m [NSBezierPath +bezierPath]: return autoreleased object * xgps/Source/XGGState.m retain shared path --- gui/Source/NSBezierPath.m.old Tue Feb 12 19:01:16 2002 +++ gui/Source/NSBezierPath.m Sat Feb 23 21:12:00 2002 @@ -94,7 +94,7 @@ + (id)bezierPath { - return [[NSBezierPath_concrete_class alloc] init]; + return AUTORELEASE([[NSBezierPath_concrete_class alloc] init]); } + (NSBezierPath *)bezierPathWithRect:(NSRect)aRect --- xgps/Source/XGGState.m.old Tue Feb 12 19:01:42 2002 +++ xgps/Source/XGGState.m Sat Feb 23 21:49:50 2002 @@ -55,7 +55,7 @@ #define CHECK_PATH \ if (!path) \ { \ - path = [NSBezierPath bezierPath]; \ + path = RETAIN([NSBezierPath bezierPath]); \ } // How could we test if there is a current point? ___ Bug-gnustep mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/bug-gnustep
Fix, nib2gmodel: GMAppKit.m
Hi, here is a little patch for nib2gmodel, which adds the NSTitledWindowMask to the styleMask of windows which are not borderless. The Interface Builder (at least on OpenStep) doesn't set NSTitledWindowMask, even if other styles are included. I think that's a bug in OpenStep. At least the window constrain stuff of GNUstep depends on this flag set. Georg 2002-04-19 Georg Fleischmann * gui/Model/GMAppKit.m [NSWindow encodeWithModelArchiver:]: add NSTitledWindowMask for non borderless windows. *** gui/Model/GMAppKit.m.oldSat Mar 10 01:31:19 2001 --- gui/Model/GMAppKit.mFri Apr 19 19:56:06 2002 *** *** 1169,1174 --- 1169,1175 { NSPoint wnOrigin = [self frame].origin; NSRect ctFrame = [[self contentView] frame]; + int style; ctFrame.origin = wnOrigin; *** *** 1189,1195 [archiver encodeBOOL:[self hidesOnDeactivate] withName:@"hidesOnDeactivate"]; [archiver encodeObject:[self backgroundColor] withName:@"backgroundColor"]; ! [archiver encodeUnsignedInt:[self styleMask] withName:@"styleMask"]; [archiver encodeUnsignedInt:[self backingType] withName:@"backingType"]; [archiver encodeConditionalObject:[self initialFirstResponder] withName:@"initialFirstResponder"]; --- 1190,1199 [archiver encodeBOOL:[self hidesOnDeactivate] withName:@"hidesOnDeactivate"]; [archiver encodeObject:[self backgroundColor] withName:@"backgroundColor"]; ! style = [self styleMask]; ! if (style != NSBorderlessWindowMask) ! style |= NSTitledWindowMask; ! [archiver encodeUnsignedInt:style withName:@"styleMask"]; [archiver encodeUnsignedInt:[self backingType] withName:@"backingType"]; [archiver encodeConditionalObject:[self initialFirstResponder] withName:@"initialFirstResponder"]; ___ Bug-gnustep mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/bug-gnustep
Fix: GMAppKit.m for NSMenuItem
Hi, here is a patch to fix a problem with PopUpMenus loaded from a gmodel file. The PopUpMenus were always disabled and their action always set to "submenuAction:". The patch simply sets the action after setSubmenu. Menus and Submenus are still working with the patch. Alternatively, a check for submenu before setting the submenu would work too. Georg 2002-04-21 Georg Fleischmann * gui/Model/GMAppKit.m [NSMenuItem initWithModelUnarchiver:]: setAction after setSubmenu. *** gui/Model/GMAppKit.m.oldSun Apr 21 23:09:38 2002 --- gui/Model/GMAppKit.mSun Apr 21 23:05:02 2002 *** *** 802,808 decodeObjectWithName:@"mixedStateImage"]]; [self setKeyEquivalent:[unarchiver decodeStringWithName:@"keyEquivalent"]]; [self setState:[unarchiver decodeIntWithName:@"state"]]; - [self setAction:[unarchiver decodeSelectorWithName:@"action"]]; [self setTag:[unarchiver decodeIntWithName:@"tag"]]; [self setEnabled:[unarchiver decodeBOOLWithName:@"isEnabled"]]; [self setChangesState:[unarchiver decodeBOOLWithName:@"changesState"]]; --- 802,807 *** *** 826,833 /* Safety assignment. */ [self setMenu: nil]; ! /* Set submenu. If submenu is nil, this will set target to nil too. */ [self setSubmenu: [unarchiver decodeObjectWithName: @"submenu"]]; /* Set target. This does not touch submenu. */ [self setTarget: [unarchiver decodeObjectWithName: @"target"]]; --- 825,836 /* Safety assignment. */ [self setMenu: nil]; ! /* Set submenu. If submenu is nil, this will set target to nil too, !* and action to submenuAction. !*/ [self setSubmenu: [unarchiver decodeObjectWithName: @"submenu"]]; + /* Set action. This does not touch submenu. */ + [self setAction:[unarchiver decodeSelectorWithName:@"action"]]; /* Set target. This does not touch submenu. */ [self setTarget: [unarchiver decodeObjectWithName: @"target"]]; ___ Bug-gnustep mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/bug-gnustep
Fix: XGGState, DPSsetlinewidth
Hi, here is a little patch to scale the line width in the X backend. Georg 2002-04-22 Georg Fleischmann * back/Source/xlib/XGGState.m [XGGState DPSsetlinewidth:]: scale line width. *** back/Source/xlib/XGGState.m.old Mon Apr 15 20:18:00 2002 --- back/Source/xlib/XGGState.m Mon Apr 22 20:43:59 2002 *** *** 1520,1525 --- 1520,1529 - (void)DPSsetlinewidth: (float)width { int w; + NSSize ws; + + ws = [ctm sizeInMatrixSpace: NSMakeSize(width,width)]; + width = (ws.width + ws.height) / 2; /* * Evil hack to get drawing to work - with a line thickness of 1, the ___ Bug-gnustep mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/bug-gnustep
Re: Fix: GMAppKit.m for NSMenuItem
Hi Nicola, > I thought we had fixed this long ago ... looks like these bugs are > resurrecting again and again. Argh. This one has never been fixed. I just had no time to react on it. > I tried implementing this second approach on CVS - as usual I can't really > test gmodels, so please let me know if I did anything wrong :-) It works :-) Georg ___ Bug-gnustep mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/bug-gnustep
Fix, NSPrintOperation
Hi, here is a patch for [NSPrintOperation (GSEPSPrintOperation) -createContext:]. I fixed the problem before (in a different way), but it's now back again. The problem is, that GSStreamContext doesn't close it's file stream before the application has returned to the runloop, but the contents of the file is needed earlier in deliverResults. The patch adds a local AutoreleasePool for the EPS context to get rid of the autorelease. Georg 2002-05-13 Georg Fleischmann * gui/Source/NSPrintOperation.m [NSPrintOperation(GSEPSPrintOperation) -createContext:]: add local autorelease pool to remove autorelease of context *** gui/Source/NSPrintOperation.m.old Fri Apr 12 23:06:51 2002 --- gui/Source/NSPrintOperation.m Mon May 13 23:08:48 2002 *** *** 1212,1217 --- 1212,1218 - (NSGraphicsContext*)createContext { NSMutableDictionary *info; + NSAutoreleasePool *pool; if (_context) return _context; *** *** 1220,1226 --- 1221,1231 [info setObject: _path forKey: @"NSOutputFile"]; [info setObject: NSGraphicsContextPSFormat forKey: NSGraphicsContextRepresentationFormatAttributeName]; + /* We have to remove the autorelease from the context, because we need the + contents of the file before the next return to the run loop */ + pool = [NSAutoreleasePool new]; _context = RETAIN([NSGraphicsContext graphicsContextWithAttributes: info]); + [pool release]; return _context; } ___ Bug-gnustep mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/bug-gnustep
Fix, GSSimpleLayoutManager
Hi, here are some small fixes for GSSimpleLayoutManager which check the array count of _lineLayoutInformation before accessing the array. The modifications allow (for example) a text box of zero size without getting an exception. Georg 2002-05-17 Georg Fleischmann * gui/Source/GSSimpleLayoutManager.m [GSSimpleLayoutManager -lineLayoutIndexForPoint:]: cast the count of _lineLayoutInformation to integer in MAX(). test if max is zero. [GSSimpleLayoutManager -glyphRangeForLineLayoutRange:]: test if count of _lineLayoutInformation is zero [GSSimpleLayoutManager -drawLinesInLineRange:]: test if count of _lineLayoutInformation is inside range *** gui/Source/GSSimpleLayoutManager.m.old Tue Mar 26 20:00:18 2002 --- gui/Source/GSSimpleLayoutManager.m Fri May 17 20:27:44 2002 *** *** 542,553 { int i; int min = 0; ! int max = MAX(0, [_lineLayoutInformation count] - 1); float y = point.y; ! float fmin = NSMinY([[_lineLayoutInformation objectAtIndex: 0] lineFragmentRect]); ! float fmax = NSMaxY([[_lineLayoutInformation lastObject] lineFragmentRect]); NSRect rect; if (y >= fmax) return max; --- 542,559 { int i; int min = 0; ! int max = MAX(0, (int)[_lineLayoutInformation count] - 1); float y = point.y; ! float fmin; ! float fmax; NSRect rect; + if (!max) + return 0; + + fmin = NSMinY([[_lineLayoutInformation objectAtIndex: 0] lineFragmentRect]); + fmax = NSMaxY([[_lineLayoutInformation lastObject] lineFragmentRect]); + if (y >= fmax) return max; *** *** 636,641 --- 642,649 unsigned startIndex; unsigned endIndex; + if ([_lineLayoutInformation count] == 0) + return NSMakeRange(0, 0); if (startLine >= [_lineLayoutInformation count]) currentInfo = [_lineLayoutInformation lastObject]; else *** *** 727,736 // relies on _lineLayoutInformation - (void) drawLinesInLineRange: (NSRange)aRange; { ! NSArray *linesToDraw = [_lineLayoutInformation subarrayWithRange: aRange]; NSEnumerator *lineEnum; _GNULineLayoutInfo *currentInfo; for ((lineEnum = [linesToDraw objectEnumerator]); (currentInfo = [lineEnum nextObject]);) { --- 735,747 // relies on _lineLayoutInformation - (void) drawLinesInLineRange: (NSRange)aRange; { ! NSArray *linesToDraw; NSEnumerator *lineEnum; _GNULineLayoutInfo *currentInfo; + if ([_lineLayoutInformation count] < aRange.location+aRange.length) + return; + linesToDraw = [_lineLayoutInformation subarrayWithRange: aRange]; for ((lineEnum = [linesToDraw objectEnumerator]); (currentInfo = [lineEnum nextObject]);) { ___ Bug-gnustep mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/bug-gnustep
Fix: Default Locale
Hi, here are two small patches to fix a problem with the default locale. My problem was that if the environment is set to German, the results of methods using the default locale change: The Decimal Separator may be komma or dot depending on the environment. My OpenStep docs say that the default locale is US English. The 1st patch changes NSObject to set the default locale to en_US instead of using the environment. The 2nd patch for NSUserDefaults sets the default locale back to en_US after reading the environment settings. Georg 2002-05-30 Georg Fleischmann * base/Source/NSObject.m [NSObject +initialize]: set default locale to US English * base/Source/NSUserDefaults.m [NSUserDefaults +userLanguages]: set locale back to default *** base/Source/NSObject.m.old Thu May 30 18:19:48 2002 --- base/Source/NSObject.m Thu May 30 18:12:17 2002 *** *** 713,719 } #endif ! GSSetLocaleC(""); // Set up locale from environment. // Create the global lock gnustep_global_lock = [[NSRecursiveLock alloc] init]; --- 713,719 } #endif ! GSSetLocaleC("en_US"); // Set up default locale (US English). // Create the global lock gnustep_global_lock = [[NSRecursiveLock alloc] init]; *** base/Source/NSUserDefaults.m.oldTue Mar 26 20:00:07 2002 --- base/Source/NSUserDefaults.mThu May 30 19:46:36 2002 *** *** 450,455 --- 450,456 } userLanguages = RETAIN([NSMutableArray arrayWithCapacity: 5]); locale = GSSetLocale(@""); + GSSetLocale(@"en_US"); if (sharedDefaults == nil) { /* Create our own defaults to get "NSLanguages" since sharedDefaults ___ Bug-gnustep mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/bug-gnustep
Fix: GMAppKit.m (NSCell), -encodeWithModelArchiver:
Hi, here is a patch for model archiving (nib2gmodel) which fixes the encoding of [NSCell isContinuous] (and -sendActionMask:). The actionMask is now restored after reading (and nullifying) it with sendActionOn:0. This change makes sure the values are still valid, when written in the second pass. Georg 2002-06-07 Georg Fleischmann * gui/Model/GMAppKit.m [NSCell -encodeWithModelArchiver:]: restore sendActionMask *** gui/Model/GMAppKit.m.oldWed Apr 24 15:37:45 2002 --- gui/Model/GMAppKit.mThu Jun 6 19:52:47 2002 *** *** 229,235 @implementation NSCell (GMArchiverMethods) - (void)encodeWithModelArchiver:(GMArchiver*)archiver ! { [archiver encodeInt:[self type] withName:@"type"]; [archiver encodeObject:[self font] withName:@"font"]; [archiver encodeString:[self stringValue] withName:@"stringValue"]; --- 229,236 @implementation NSCell (GMArchiverMethods) - (void)encodeWithModelArchiver:(GMArchiver*)archiver ! { int actionMask; ! [archiver encodeInt:[self type] withName:@"type"]; [archiver encodeObject:[self font] withName:@"font"]; [archiver encodeString:[self stringValue] withName:@"stringValue"]; *** *** 245,251 [archiver encodeBOOL:[self isSelectable] withName:@"isSelectable"]; [archiver encodeBOOL:[self isScrollable] withName:@"isScrollable"]; [archiver encodeBOOL:[self isContinuous] withName:@"isContinuous"]; ! [archiver encodeInt:[self sendActionOn:0] withName:@"sendActionMask"]; } - (id)initWithModelUnarchiver:(GMUnarchiver*)unarchiver --- 246,254 [archiver encodeBOOL:[self isSelectable] withName:@"isSelectable"]; [archiver encodeBOOL:[self isScrollable] withName:@"isScrollable"]; [archiver encodeBOOL:[self isContinuous] withName:@"isContinuous"]; ! actionMask = [self sendActionOn:0]; ! [archiver encodeInt:actionMask withName:@"sendActionMask"]; ! [self sendActionOn:actionMask]; } - (id)initWithModelUnarchiver:(GMUnarchiver*)unarchiver ___ Bug-gnustep mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/bug-gnustep
Fix: NSControl.m, -mouseDown:
Hi, here is another patch to make continuous buttons/controls work. I just switched the if/else, so the NSPeriodicMask is set for continuous cells. Georg 2002-06-07 Georg Fleischmann * gui/Source/NSControl.m [NSControl -mouseDown:]: set NSPeriodicMask for continuous cells, and 0 otherwise *** gui/Source/NSControl.m.old Fri Apr 12 23:06:50 2002 --- gui/Source/NSControl.m Fri Jun 7 20:35:52 2002 *** *** 505,513 } if ([_cell isContinuous]) - oldActionMask = [_cell sendActionOn: 0]; - else oldActionMask = [_cell sendActionOn: NSPeriodicMask]; [_window _captureMouse: self]; --- 505,513 } if ([_cell isContinuous]) oldActionMask = [_cell sendActionOn: NSPeriodicMask]; + else + oldActionMask = [_cell sendActionOn: 0]; [_window _captureMouse: self]; ___ Bug-gnustep mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/bug-gnustep
Fix: NSMenu.m, -performActionForItemAtIndex:
Hi again, here is a patch for PopUp Menus, which selects the item also for actions send from the item (not only for actions send by the popUpButtonCell). That's it. Thanks for the Color-Panel, that's a great improvement :-) Georg 2002-06-11 Georg Fleischmann * gui/Source/NSMenu.m [NSMenu -performActionForItemAtIndex:]: select item for any kind of popup action *** gui/Source/NSMenu.m.old Mon Jun 3 23:23:33 2002 --- gui/Source/NSMenu.m Tue Jun 11 21:31:46 2002 *** *** 735,740 --- 735,743 [nc postNotificationName: NSMenuWillSendActionNotification object: self userInfo: d]; + // Tell the popup button, which item was selected + if (_popUpButtonCell != nil) + [_popUpButtonCell selectItemAtIndex: index]; if (NULL != (action = [item action])) { [NSApp sendAction: action *** *** 743,750 } else if (_popUpButtonCell != nil) { - // Tell the popup button, which item was selected - [_popUpButtonCell selectItemAtIndex: index]; if (NULL != (action = [_popUpButtonCell action])) [NSApp sendAction: action to: [_popUpButtonCell target] --- 746,751 ___ Bug-gnustep mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/bug-gnustep
Fix: NSMenuView.m, -itemAdded:
here is a patch for NSMenuView to highlight/unhighlight the items correctly, when an item is added. Georg 2002-06-11 Georg Fleischmann * gui/Source/NSMenuView.m [NSMenuView -itemAdded:]: highlighting corrected *** gui/Source/NSMenuView.m.old Tue Jun 11 21:36:51 2002 --- gui/Source/NSMenuView.m Wed Jun 12 00:06:47 2002 *** *** 309,314 --- 309,315 { int index = [[[notification userInfo] objectForKey: @"NSMenuItemIndex"] intValue]; + int hIndex = [self highlightedItemIndex]; NSMenuItem *anItem = [_items_link objectAtIndex: index]; id aCell = [NSMenuItemCell new]; *** *** 316,327 [aCell setMenuView: self]; [aCell setFont: _font]; ! if ([self highlightedItemIndex] == index) ! [aCell setHighlighted: YES]; ! else ! [aCell setHighlighted: NO]; [_itemCells insertObject: aCell atIndex: index]; [aCell setNeedsSizing: YES]; RELEASE(aCell); --- 317,330 [aCell setMenuView: self]; [aCell setFont: _font]; ! if (hIndex != -1) ! [[_itemCells objectAtIndex: hIndex] setHighlighted: NO]; [_itemCells insertObject: aCell atIndex: index]; + + if (hIndex != -1) + [[_itemCells objectAtIndex: hIndex] setHighlighted: YES]; + [aCell setNeedsSizing: YES]; RELEASE(aCell); ___ Bug-gnustep mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/bug-gnustep
Fix: XGServerWindow.m, -windowDevice:
Hi, here is a patch that fixes an occasional problem with displaced drawing of (the items of) menus and popup menus. The problem turned up especially if menu items were removed. The patch replaces a hack in the X backend code which doesn't do it too well. I played around with the problem and finally replaced the hack with a usleep(1) - that did it :-) Georg 2002-06-11 Georg Fleischmann * back/Source/x11/XGServerWindow.m [XGServerWindow windowDevice]: use usleep(1) to wait for X Server *** back/Source/x11/XGServerWindow.m.oldTue Jun 11 20:46:25 2002 --- back/Source/x11/XGServerWindow.mTue Jun 11 21:00:01 2002 *** *** 24,29 --- 24,32 #include "config.h" #include + #ifdef HAVE_UNISTD_H + #include + #endif #include #include #include *** *** 1344,1364 XFlush (dpy); ! /* hack: !* wait until a resize of window is finished (especially for NSMenu) !* is there any way to wait until X finished it's stuff? !* XSync(), XFlush() doesn't do the job! !*/ ! { ! int i = 0; ! do ! { ! XGetGeometry(dpy, window->ident, &window->root, !&x, &y, &width, &height, !&window->border, &window->depth); ! } ! while( i++<10 && height != window->siz_hints.height ); ! } window->xframe.size.width = width; window->xframe.size.height = height; --- 1347,1357 XFlush (dpy); ! usleep(1); // wait until X Server finished resizing the window ! XGetGeometry(dpy, window->ident, &window->root, ! &x, &y, &width, &height, ! &window->border, &window->depth); ! window->xframe.size.width = width; window->xframe.size.height = height; ___ Bug-gnustep mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/bug-gnustep
Re: Fix: XGServerWindow.m, -windowDevice: (updated fix)
> Isn't the correct way to do this is to wait for a ConfigureNotify event > with something like XWindowEvent? No doubt, that's correct. But this means that there is a disorder in the calls of methods disregarding the event loop. If I wait for a ConfigureNotify event in -devicewindow, the program hangs (as expected), because the method is not always called with a resize event pending. So, that's not the way to go. The problematic call of -devicewindow comes as a result of [XGServerWindow -placewindow]. There is some code titled "Failsafe - if X hasn't told us ...". This sends a resize event to NSWindow and bypasses the X event loop. If I remove the failsafe event, there appears a bunch of drawing problems. So, with my current overview, I don't see an easy solution to this problem. If noone has a better idea I suggest to use the attached patch which now adds the usleep(1) to the old hack (That's even more safe as a single usleep). I also added a FIXME with short information (as far as I understand the problem). Georg 2002-06-14 Georg Fleischmann * back/Source/x11/XGServerWindow.m [XGServerWindow -windowDevice]: usleep(1) and FIXME added to hack *** back/Source/x11/XGServerWindow.m.oldTue Jun 11 20:46:25 2002 --- back/Source/x11/XGServerWindow.mFri Jun 14 20:42:25 2002 *** *** 24,29 --- 24,32 #include "config.h" #include + #ifdef HAVE_UNISTD_H + #include + #endif #include #include #include *** *** 1345,1358 XFlush (dpy); /* hack: !* wait until a resize of window is finished (especially for NSMenu) !* is there any way to wait until X finished it's stuff? !* XSync(), XFlush() doesn't do the job! */ { int i = 0; do { XGetGeometry(dpy, window->ident, &window->root, &x, &y, &width, &height, &window->border, &window->depth); --- 1348,1364 XFlush (dpy); /* hack: !* wait until the resize of window is finished (especially for NSMenu) !* FIXME: Actually this method shouldn't be called before the event !* loop gets a ConfigureNotify event. !* The problem is initiated by -placewindow which sends a failsafe event, !* to allow drawing before the return to the event loop. */ { int i = 0; do { + usleep(1); // wait until X Server finished resizing the window XGetGeometry(dpy, window->ident, &window->root, &x, &y, &width, &height, &window->border, &window->depth); ___ Bug-gnustep mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/bug-gnustep
Re: Fix: NSMenu.m, -performActionForItemAtIndex:
Hi Nicola, > thanks - looking at the code and API, wouldn't maybe be better that > -performActionForItemAtIndex: does not perform any highlighting, and the > caller performs it instead ? > > do you think it would be a good change ? The performAction is called from [NSMenuView -trackWithEvent:] (for mouse actions), and it's important that the item will be selected before the action is performed. The key action comes directly from [NSPopUpButton -keyDown:]. This would mean more than one place to perform the action and still a check for PopUpButton. Apple seems to have removed the NSMenuView from their menu code completely. Probably it was just too confusing. Does this mean Apple is back to the OpenStep implementation of menus/popup-menus ? Note: NSMenuItemCell and NSMenuView are deprecated and are no longer used to draw menus. Calling their methods will not affect the appearance of your menus. Georg ___ Bug-gnustep mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/bug-gnustep
Bug in Alpha compositing
Hi, I realized a new bug with alpha compositing. I found out that the problem appeared with the changes in XGGState.m -setColor:state: and -setAlphaColor: in May. If I use an earlier version of XGGState.m it works. As I don't have an idea of the changes and not much time at the moment, I thought I just post what I know. Here is what I'm doing: I use a window which I fill transparent, and then I draw opaque graphics (Line, Arc...) to it, like this. [betaView lockFocus]; [[NSColor colorWithDeviceWhite:1.0 alpha:0.0] set]; NSRectFill(rect_start); [obj draw:self]; [betaView unlockFocus]; I then composite this window using NSCompositeSourceOver. All I get is a white opaque rectangle. PScomposite(NSMinX(rect_start), NSMinY(rect_start), NSWidth(rect_start), NSHeight(rect_start), [betaView gState], NSMinX(rect_now), NSMinY(rect_now), NSCompositeSourceOver); If I use a composite with NSCompositeCopy instead, the graphic is copied (but on a white opaque background): NSCopyBits([betaView gState], rect_start, rect_now.origin); Georg ___ Bug-gnustep mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/bug-gnustep
Fix: NSWindow, setFrameFromString and stringWithSavedFrame
Hi, I noticed that GNUstep uses flipped coordinates for the frame string in -setFrameFromString and -stringWithSavedFrame. On OpenStep the methods use normal coordinates. The attached patch removes the flipping. Georg 2002-07-28 Georg Fleischmann * gui/Source/NSWindow [-setFrameFromString:], [-stringWithSavedFrame:]: don't flip coordinates to make it compatible with OpenStep *** gui/Source/NSWindow.m.old Mon Jul 22 18:38:35 2002 --- gui/Source/NSWindow.m Sun Jul 28 22:02:28 2002 *** *** 3518,3528 } /* -* Convert frame from flipped to normal coordinates. -*/ - fRect.origin.y -= fRect.size.height; - - /* * Check and set frame. */ if (_maximumSize.width > 0 && fRect.size.width > _maximumSize.width) --- 3518,3523 *** *** 3574,3580 NSRect sRect; fRect = _frame; - fRect.origin.y += fRect.size.height;/* Make flipped */ /* * FIXME - the screen rectangle should give the area of the screen in which * the window could be placed (ie a rectangle excluding the dock), but --- 3569,3574 ___ Bug-gnustep mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/bug-gnustep
Re: Fix: NSWindow, setFrameFromString and stringWithSavedFrame
Hi Nicola, > I don't have an openstep system (nor a macosx) to test what actually > happens in other systems - can someone else confirm that we really need to > change the way we convert window frames into strings in order to be > compatible ? I checked on Mac OS X, and it saves the lower/left corner (like OpenStep). Georg ___ Bug-gnustep mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/bug-gnustep
Fix: RTFConsumer, -currentFont
Hi, here is a fix which corrects the RTFConsumer to return the correct font for composite fontNames such as Futura-Light or Futura-Book. Georg 2002-08-30 Georg Fleischmann * gui/TextConverters/RTF/RTFConsumer.m [-currentFont]: allow composite font names like 'FontFamily-Face' *** gui/TextConverters/RTF/RTFConsumer.m.oldTue Jun 11 21:36:51 2002 --- gui/TextConverters/RTF/RTFConsumer.mFri Aug 30 17:31:17 2002 *** *** 115,120 --- 115,130 NSFont *font; NSFontTraitMask traits = 0; int weight; + NSRange range; + NSString *fontFamily; + + /* Check, whether fontName is composite, and extract fontFamily +*/ + range = [fontName rangeOfString:@"-"]; + if (range.length) + fontFamily = [fontName substringToIndex:range.location]; + else + fontFamily = fontName; if (bold) { *** *** 136,145 traits |= NSUnitalicFontMask; } ! font = [[NSFontManager sharedFontManager] fontWithFamily: fontName traits: traits weight: weight size: fontSize]; if (font == nil) { NSDebugMLLog(@"RTFParser", --- 146,165 traits |= NSUnitalicFontMask; } ! font = [[NSFontManager sharedFontManager] fontWithFamily: fontFamily traits: traits weight: weight size: fontSize]; + /* set the typeface for composite names, if it is not correct. +*/ + if ( font && range.length +&& ![[font fontName] rangeOfString:fontName].length ) + { + font = [[NSFontManager sharedFontManager] convertFont:font + toFace:fontName]; + font = [[NSFontManager sharedFontManager] convertFont:font + toHaveTrait:traits]; + } if (font == nil) { NSDebugMLLog(@"RTFParser", ___ Bug-gnustep mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/bug-gnustep
Re: Fix: RTFConsumer, -currentFont
Hi Nicola, > What about taking a completely different approach in the method, and > instead doing a > > [NSFont fontWithName: fontName size: fontSize]; Well, this brought up a problem with [NSFont fontWithName:size:]: If the desired font is not available, the method returns a default font instead of nil (OpenStep 4.2 returns nil in this case). Consequently, further up the chain, [NSFontManager convertFont:toFace:] returns the default font too. This should return the unmodified font, if the face is not avalable (and it indeed would, if the above method would return nil). If I modify [NSFont fontWithName:size:] to return nil, all the places show up (seg fault), which can't handle the nil font. Quite some places... Anyway, I feel this should to be fixed, before further optimizing the font handling in the RTFConsumer. What do you think ? Georg ___ Bug-gnustep mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/bug-gnustep
Re: Fix: RTFConsumer, -currentFont
> Looks like [NSFont -initWithName:matrix:] is our own extension, and likely > it should return nil if the font can't be found (it now returns the > default font if I understand correctly). The class method [NSFont fontWithName:size:] (and matrix) is implemented independant of [NSFont -initWithName:matrix:]. > In that case I suppose we need to change GSFontInfo to return nil (rather > than a font info for a default font) if the font is not found. > > We then need to update all callers for the new semantics ... which > hopefully should not be too many. > > I think it is exactly what you were proposing. Yup. Georg ___ Bug-gnustep mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/bug-gnustep
Re: Fix: RTFConsumer, -currentFont
> On my CVS I've got the following - which definitely creates the fonts > using -initWithName:matrix: - > > since -initWithName:matrix: will never return nil, fontWithName:matrix: > will never know if the font is available or not, and can't return nil. My mistake, it's all correct. Georg ___ Bug-gnustep mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/bug-gnustep
Fix: NSWindow, constrainFrameRect
Hi, here is a little fix for NSWindow's constrain method. The patch brings the window back inside screen, if the window has dropped through the bottom of the screen (window top < screen). Without the patch only windows with the top above the top of the screen are moved into the screen. Georg 2002-08-30 Georg Fleischmann * gui/Source/NSWindow.m [-constrainFrameRect]: move window inside screen, if window top is below screen *** gui/Source/NSWindow.m.old Sun Oct 6 19:27:30 2002 --- gui/Source/NSWindow.m Wed Oct 9 18:57:44 2002 *** *** 1508,1514 - (NSRect) constrainFrameRect: (NSRect)frameRect toScreen: screen { NSRect screenRect = [screen frame]; ! float difference; /* Move top edge of the window inside the screen */ difference = NSMaxY (frameRect) - NSMaxY (screenRect); --- 1508,1514 - (NSRect) constrainFrameRect: (NSRect)frameRect toScreen: screen { NSRect screenRect = [screen frame]; ! float difference, diff1; /* Move top edge of the window inside the screen */ difference = NSMaxY (frameRect) - NSMaxY (screenRect); *** *** 1517,1523 { frameRect.origin.y -= difference; } ! /* If the window is resizable, resize it (if needed) so that the bottom edge is on the screen too */ if (_styleMask & NSResizableWindowMask) --- 1517,1530 { frameRect.origin.y -= difference; } ! else if (NSMaxY (frameRect) < NSMinY (screenRect)) ! { ! diff1 = NSMinY (frameRect) - NSMinY (screenRect); ! /* move bottom inside the screen, but keep top inside screen */ ! frameRect.origin.y -= MAX(difference, diff1); ! difference = NSMaxY (frameRect) - NSMaxY (screenRect); ! } ! /* If the window is resizable, resize it (if needed) so that the bottom edge is on the screen too */ if (_styleMask & NSResizableWindowMask) ___ Bug-gnustep mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/bug-gnustep
Fix, NSFont, XGFont (was RTFConsumer)
Hi Nicola, Well, here is the long waiting change for NSFont. It's most exactly how you suggested. > Looks like [NSFont -initWithName:matrix:] is our own extension, and likely > it should return nil if the font can't be found (it now returns the > default font if I understand correctly). > > In that case I suppose we need to change GSFontInfo to return nil (rather > than a font info for a default font) if the font is not found. > > NSFont -initWithName:matrix: will then check the created font info, and if > it's nil, it will destroy self and return (nil) as well. Now, with the changes NSFontManager's -convertFont methods work as they should. All seems to work fine - I got no crash :-) My suggested RTFConsumer changes work much better, too. I will send the RTFConsumer patch in a separate mail with some additional comments. Georg 2002-10-09 Georg Fleischmann * gui/Source/NSFont.m [-initWithName:matrix:fix:]: return nil, if fontInfo == nil. This makes [NSFontManager -convertFont:...] work. * back/Source/x11/XGFont.m [-setupAttributes]: return NO, if fontName is not available *** gui/Source/NSFont.m.old Wed Oct 9 17:49:01 2002 --- gui/Source/NSFont.m Wed Oct 9 22:05:57 2002 *** *** 602,607 --- 602,612 matrixExplicitlySet = explicitlySet; fontInfo = RETAIN([GSFontInfo fontInfoForFontName: fontName matrix: fontMatrix]); + if ( !fontInfo ) + { + [self release]; + return nil; + } /* Cache the font for later use */ NSMapInsert(globalFontMap, (void*)nameWithMatrix, (void*)self); } *** back/Source/xlib/XGFont.m.old Sat Jun 29 23:33:20 2002 --- back/Source/xlib/XGFont.m Wed Oct 9 22:09:41 2002 *** *** 250,264 if ((xfontname == nil) || (font_info = XLoadQueryFont(xdpy, [xfontname cString])) == NULL) { ! NSLog(@"Selected font: %@ at %f (%@) is not available.\n" ! @"Using system fixed font instead", fontName, matrix[0], xfontname); ! ! // Try default font ! if ((font_info = XLoadQueryFont(xdpy, "9x15")) == NULL) ! { ! NSLog(@"Unable to open fixed font"); ! return NO; ! } } else NSDebugLog(@"Loaded font: %@", xfontname); --- 250,258 if ((xfontname == nil) || (font_info = XLoadQueryFont(xdpy, [xfontname cString])) == NULL) { ! NSLog(@"XGFont: Selected font: %@ at %f (%@) is not available.", ! fontName, matrix[0], xfontname); ! return NO; } else NSDebugLog(@"Loaded font: %@", xfontname); ___ Bug-gnustep mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/bug-gnustep
Fix: RTFConsumer, -currentFont
Hi Nicola, here is my suggestion for a fix, which corrects the RTFConsumer to return the correct font for composite fontNames such as Helvetica-Light or Futura-Book. I didn't succeed to implement your approach (using -fontWithName: and then patching up the font by adding the traits), because -fontWithName: would return nil for a composite fontName, if it doesn't exist (or at least not the desired font-family). Example: If the desired fontName would be Futura-Condensed which is not installed, then fontWithName would return nil. By using -fontWithFamily: we have at least a font with the desired family. So this approach seems a lot more tolerant to me. Maybe there is yet another and better way, but I have no idea at the moment. Georg 2002-10-09 Georg Fleischmann * gui/TextConverters/RTF/RTFConsumer.m [-currentFont]: allow composite font names like 'FontFamily-Face' *** gui/TextConverters/RTF/RTFConsumer.m.oldTue Jun 11 21:36:51 2002 --- gui/TextConverters/RTF/RTFConsumer.mThu Oct 10 00:53:05 2002 *** *** 115,120 --- 115,130 NSFont *font; NSFontTraitMask traits = 0; int weight; + NSRange range; + NSString *fontFamily; + + /* Check, whether fontName is composite, and extract fontFamily +*/ + range = [fontName rangeOfString:@"-"]; + if (range.length) + fontFamily = [fontName substringToIndex:range.location]; + else + fontFamily = fontName; if (bold) { *** *** 136,145 traits |= NSUnitalicFontMask; } ! font = [[NSFontManager sharedFontManager] fontWithFamily: fontName traits: traits weight: weight size: fontSize]; if (font == nil) { NSDebugMLLog(@"RTFParser", --- 146,166 traits |= NSUnitalicFontMask; } ! font = [[NSFontManager sharedFontManager] fontWithFamily: fontFamily traits: traits weight: weight size: fontSize]; + + /* set the typeface for composite names, if it is not correct. +*/ + if ( font && range.length +&& ![[font fontName] rangeOfString:fontName].length ) + { + font = [[NSFontManager sharedFontManager] convertFont:font + toFace:fontName]; + font = [[NSFontManager sharedFontManager] convertFont:font + toHaveTrait:traits]; + } if (font == nil) { NSDebugMLLog(@"RTFParser", ___ Bug-gnustep mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/bug-gnustep
Re: Fix, NSFont, XGFont (was RTFConsumer)
> Most of this patch looks fine for me. What is missing is the special > handling now needed for the getNSFont() function. Here we should make > sure, that we always return a usefull font. As the only font we can be > sure about is the user font in the default size we should return this, > if any font is missing here. Not returning any font here will screw up > the system as we always expect the font attribute to be set to usable value. Well, I added a line to getNSFont() to load the defaultFont with default size. Please take a look at the attached patch, because I'm not sure, if this is exactly what you meant. Thanks. Georg *** gui/Source/NSFont.m.old Wed Oct 9 22:05:57 2002 --- gui/Source/NSFont.m Thu Oct 10 17:21:15 2002 *** *** 144,149 --- 144,150 getNSFont(NSString* key, NSString* defaultFontName, float fontSize) { NSString* fontName; + NSFont* font; fontName = [defaults objectForKey: key]; if (fontName == nil) *** *** 155,161 [NSString stringWithFormat: @"%@Size", key]]; } ! return [NSFontClass fontWithName: fontName size: fontSize]; } void --- 156,169 [NSString stringWithFormat: @"%@Size", key]]; } ! font = [NSFontClass fontWithName: fontName size: fontSize]; ! if (!font) ! { ! fontSize = [defaults floatForKey: ! [NSString stringWithFormat: @"%@Size", key]]; ! font = [NSFontClass fontWithName: defaultFontName size: fontSize]; ! } ! return font; } void ___ Bug-gnustep mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/bug-gnustep
nib2gmodel 0.8.6 on OpenStep (compiler errors)
Hi, trying to compile nib2gmodel 0.8.6 on OpenStep, I get the following errors. I just removed the problems and continued compiling. Making all for bundle libgmodel... /LocalDeveloper/Projects/Linux/GNUstep/nib2gmodel-0.8.6/usr/GNUstep/System/Library/Makefiles/common.make:347: *** unterminated variable reference. Stop. gnumake[1]: *** [libgmodel.all.bundle.variables] Error 2 I removed the line Making all for bundle libgmodel... Creating libgmodel.bundle/ix86/openstep4/gnu-gnu-gnu... Compiling file ./IMCustomObject.m ... cc1obj: Invalid option `-fno-strict-aliasing' gnumake[2]: *** [shared_obj/ix86/openstep4/gnu-gnu-gnu/IMCustomObject.o] Error 1 I removed the option Making all for bundle libgmodel... Compiling file ./IMCustomObject.m ... Compiling file ./IMConnectors.m ... ./IMConnectors.m:29: header file 'gnustep/base/GSObjCRuntime.h' not found gnumake[2]: *** [shared_obj/ix86/openstep4/gnu-gnu-gnu/IMConnectors.o] Error 1 I removed the include Compiling file ./GMArchiver.m ... Linking bundle libgmodel ... /bin/sh: -o: not found gnumake[2]: *** [libgmodel.bundle/ix86/openstep4/gnu-gnu-gnu/libgmodel] Error 1 gnumake[1]: *** [libgmodel.all.bundle.variables] Error 2 gnumake: *** [subproj-all] Error 2 Well, here I'm stuck. Georg ___ Bug-gnustep mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/bug-gnustep
Fix, NSLayoutManager
Hi, here is a little patch for the NSLayoutManager fixing a problem with layout_char. layout_char is unsigned but may become "negative", thus flipping over to huge positive. The huge positive value then is not sattisfying the '<' comparison. Georg 2004-03-10 Georg Fleischmann * gui/Source/NSLayoutManager.m [NSLayoutManager textStorage:...]: keep (unsigned) layout_char in legal range, in case it becomes < 0 *** gui/Source/NSLayoutManager.m.old2004-02-15 19:23:13.0 +0100 --- gui/Source/NSLayoutManager.m2004-03-10 19:30:38.0 +0100 *** *** 1800,1806 if (layout_char > r.location) { layout_char += lengthChange; ! if (layout_char < r.location) layout_char = r.location; } --- 1800,1806 if (layout_char > r.location) { layout_char += lengthChange; ! if (layout_char < r.location || layout_char > r.location + r.length) layout_char = r.location; } ___ Bug-gnustep mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/bug-gnustep
Re: Fix, NSLayoutManager
Hi Fred, > I think you did spot a real problem here, but your solution just doesn't > look right. An unsigned number never should be allowed to wrap around. > What about a check like this: With casts like this it works: if (layout_char > r.location) { if ((int)layout_char + lengthChange < (int)r.location) { layout_char = r.location; } else { layout_char += lengthChange; } } The attached patch also works for the current CVS version. Georg *** gui/Source/NSLayoutManager.m.old2004-03-14 01:15:46.0 +0100 --- gui/Source/NSLayoutManager.m2004-03-14 01:41:56.0 +0100 *** *** 1798,1804 if (layout_char > r.location) { ! if (layout_char >= r.location + r.length) layout_char += lengthChange; else { --- 1798,1804 if (layout_char > r.location) { ! if ((int)layout_char + lengthChange >= (int)r.location) layout_char += lengthChange; else { ___ Bug-gnustep mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/bug-gnustep
Fix, NSAffineTransform (Text Rotation)
Hi, here is the second patch to make text rotation work. It is for NSAffineTransform -rotationAngle. The patch just corrects the sign of the angle and always returns positive angles. Georg 2004-03-14 Georg Fleischmann * gui/Source/NSAffineTransform.m [NSView rotationAngle]: change sign of angle, and always return positive angles *** gui/Source/NSAffineTransform.m.old 2004-03-11 18:34:41.0 +0100 --- gui/Source/NSAffineTransform.m 2004-03-14 00:57:54.0 +0100 *** *** 435,443 - (float) rotationAngle { ! /* FIXME - this is not correct in general! */ ! float rotationAngle = atan2(C, A); rotationAngle *= 180.0 / pi; return rotationAngle; } --- 435,444 - (float) rotationAngle { ! float rotationAngle = atan2(-C, A); rotationAngle *= 180.0 / pi; + if (rotationAngle < 0.0) + rotationAngle += 360.0; return rotationAngle; } ___ Bug-gnustep mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/bug-gnustep
Fix, NSView (Text Rotation)
Hi, here is one of two patches to make text rotation work with Cenon and the Art backend. This is a patch for NSView. The other patch for NSAffineTransform is in a second mail. Now, the first problem in NSView was that the visible rect wasn't rotated/flipped correctly. As a result, the rotated text was clipped from the screen. The second problem was in lockFocusInRect. There was an extra function call just for rotated views, which only destroyed the rect. I only tested text rotation with Cenon, as I'm not aware of any other application using rotated text. Georg 2004-03-14 Georg Fleischmann * gui/Source/NSView.m [NSView convertRect:fromView:]: better conversion of flipped + rotated views * gui/Source/NSView.m [NSView lockFocus:inRect:]: removed a problematic bounding rect call for rotated views *** gui/Source/NSView.m.old 2004-03-14 01:10:15.0 +0100 --- gui/Source/NSView.m 2004-03-14 01:12:09.0 +0100 *** *** 1250,1262 { matrix = [self _matrixFromWindow]; } - r.origin = [matrix pointInMatrixSpace: r.origin]; - r.size = [matrix sizeInMatrixSpace: r.size]; ! if (aView->_rFlags.flipped_view != _rFlags.flipped_view) { ! r.origin.y -= r.size.height; } return r; } --- 1250,1285 { matrix = [self _matrixFromWindow]; } ! if (aView->_rFlags.flipped_view != _rFlags.flipped_view) ! { NSPoint p[4]; ! ! if (aView->_rFlags.flipped_view) // aView is flipped ! { ! r.origin.y -= r.size.height; ! } ! ! p[0] = r.origin; ! p[1] = NSMakePoint(r.origin.x + r.size.width, r.origin.y); ! p[2] = NSMakePoint(r.origin.x + r.size.width, r.origin.y + r.size.height); ! p[3] = NSMakePoint(r.origin.x, r.origin.y + r.size.height); ! ! p[0] = [matrix pointInMatrixSpace: p[0]]; ! p[1] = [matrix pointInMatrixSpace: p[1]]; ! p[2] = [matrix pointInMatrixSpace: p[2]]; ! p[3] = [matrix pointInMatrixSpace: p[3]]; ! ! r.origin.x = MIN( MIN( MIN(p[0].x, p[1].x), p[2].x), p[3].x); ! r.origin.y = MIN( MIN( MIN(p[0].y, p[1].y), p[2].y), p[3].y); ! r.size.width = MAX( MAX( MAX(p[0].x, p[1].x), p[2].x), p[3].x) - r.origin.x; ! r.size.height = MAX( MAX( MAX(p[0].y, p[1].y), p[2].y), p[3].y) - r.origin.y; ! } ! else { ! r.origin = [matrix pointInMatrixSpace: r.origin]; ! r.size = [matrix sizeInMatrixSpace: r.size]; } + return r; } *** *** 1597,1606 { NSAffineTransform *matrix; matrix = [self _matrixToWindow]; - if ([matrix isRotated]) - { - [matrix boundingRectFor: rect result: &rect]; - } if (_gstate) { --- 1620,1625 ___ Bug-gnustep mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/bug-gnustep
Re: Fix, NSView (Text Rotation)
Pete French wrote: > I use rotated text a lot - I'll try and find some time to test these > patches (though I hadnt really had any problems with rotated text anyway) Cenon uses a flipped view to display rotated text. Georg ___ Bug-gnustep mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/bug-gnustep
Re: Fix, NSView (Text Rotation)
Alexander Malmberg wrote: > Unfortunately, the patch looks messed up here, and patch complains that > it's malformed. Could you try sending it again as plain (not enriched) > text? (FWIW, the NSAffineTransform patch arrived ok.) Sure, here is a second try. Two lines are 85 characters wide. Maybe this is the problem. Georg 2004-03-14 Georg Fleischmann * gui/Source/NSView.m [NSView convertRect:fromView:]: better conversion of flipped + rotated views * gui/Source/NSView.m [NSView lockFocus:inRect:]: removed a problematic bounding rect call for rotated views *** gui/Source/NSView.m.old 2004-03-14 01:10:15.0 +0100 --- gui/Source/NSView.m 2004-03-14 01:12:09.0 +0100 *** *** 1250,1262 { matrix = [self _matrixFromWindow]; } - r.origin = [matrix pointInMatrixSpace: r.origin]; - r.size = [matrix sizeInMatrixSpace: r.size]; ! if (aView->_rFlags.flipped_view != _rFlags.flipped_view) { ! r.origin.y -= r.size.height; } return r; } --- 1250,1285 { matrix = [self _matrixFromWindow]; } ! if (aView->_rFlags.flipped_view != _rFlags.flipped_view) ! { NSPoint p[4]; ! ! if (aView->_rFlags.flipped_view)// aView is flipped ! { ! r.origin.y -= r.size.height; ! } ! ! p[0] = r.origin; ! p[1] = NSMakePoint(r.origin.x + r.size.width, r.origin.y); ! p[2] = NSMakePoint(r.origin.x + r.size.width, r.origin.y + r.size.height); ! p[3] = NSMakePoint(r.origin.x, r.origin.y + r.size.height); ! ! p[0] = [matrix pointInMatrixSpace: p[0]]; ! p[1] = [matrix pointInMatrixSpace: p[1]]; ! p[2] = [matrix pointInMatrixSpace: p[2]]; ! p[3] = [matrix pointInMatrixSpace: p[3]]; ! ! r.origin.x = MIN( MIN( MIN(p[0].x, p[1].x), p[2].x), p[3].x); ! r.origin.y = MIN( MIN( MIN(p[0].y, p[1].y), p[2].y), p[3].y); ! r.size.width = MAX( MAX( MAX(p[0].x, p[1].x), p[2].x), p[3].x) - r.origin.x; ! r.size.height = MAX( MAX( MAX(p[0].y, p[1].y), p[2].y), p[3].y) - r.origin.y; ! } ! else { ! r.origin = [matrix pointInMatrixSpace: r.origin]; ! r.size = [matrix sizeInMatrixSpace: r.size]; } + return r; } *** *** 1597,1606 { NSAffineTransform *matrix; matrix = [self _matrixToWindow]; - if ([matrix isRotated]) - { - [matrix boundingRectFor: rect result: &rect]; - } if (_gstate) { --- 1620,1625 ___ Bug-gnustep mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/bug-gnustep
Re: Fix, NSLayoutManager
Alexander Malmberg wrote: > However, in the original patch, the wrap-around is just ugly; it isn't > really a problem since the wrap-around behavior of unsigned ints is > defined by the c standard. It may not please the educated eye, but it works :-) Also, the patch doesn't need a cast which would limit the possible length of strings. In fact, I think it is a clean way to solve the problem, as it simply checks if layout_char is in the legal range. This is absolutely safe, straigth forward and easy to understand. > I've committed a slightly different patch that's both pretty and safe, > > if (layout_char > r.location) >{ > if (layout_char >= r.location + r.length) >layout_char += lengthChange; > else >layout_char = r.location; >} Well, it doesn't work. That's all I can say, as I have not much knowledge of the internals here. Here are the involved variables of the method for my test case: layout_char = 26 r.location = 0 r.length = 1 lengthChange = -29 Georg ___ Bug-gnustep mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/bug-gnustep
Fix, NSCalendarDate
Hi, here is a little fix for NSCalendarDate. It avoids exceptions, when the time zone is created from an abbreviation. Georg 2004-04-11 Georg Fleischmann * base/Source/NSCalendarDate.m [NSCalendarDate initWithString:calendarFormat:locale:]: avoid exception with time zone abbreviations *** base/Source/NSCalendarDate.m.old2004-03-09 17:59:59.0 +0100 --- base/Source/NSCalendarDate.m2004-04-11 02:20:22.0 +0200 *** *** 1083,1093 { NSString *z = [NSString stringWithCString: tmpStr]; ! tz = [NSTimeZone timeZoneWithName: z]; ! if (tz == nil) { tz = [NSTimeZone timeZoneWithAbbreviation: z]; } } break; --- 1083,1096 { NSString *z = [NSString stringWithCString: tmpStr]; ! if ([[NSTimeZone abbreviationDictionary] objectForKey: z]) { tz = [NSTimeZone timeZoneWithAbbreviation: z]; } + else + { + tz = [NSTimeZone timeZoneWithName: z]; + } } break; ___ Bug-gnustep mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/bug-gnustep
Fix, nib2gmodel [GMAppKit encodeWithModelArchiver:]
Hi, here is a little patch for GMAppKit to remove the height of the title bar and resize bar from 'minSize' of a window. This is now necessary with version 0.9.4 of GNUstep to keep the panels within the desired size. Georg 2004-10-11 Georg Fleischmann * gui/Model/GMAppKit.m [-encodeWithModelArchiver:] remove title bar and resize bar from 'minSize' *** gui/Model/GMAppKit.m.oldThu Jan 22 11:19:08 2004 --- gui/Model/GMAppKit.mSun Oct 10 19:35:09 2004 *** *** 1224,1237 - (void)encodeWithModelArchiver:(GMArchiver*)archiver { NSPoint wnOrigin = [self frame].origin; ! NSRect ctFrame = [[self contentView] frame]; unsigned int style; ctFrame.origin = wnOrigin; [archiver encodeRect:ctFrame withName:@"contentFrame"]; [archiver encodeSize:[self maxSize] withName:@"maxSize"]; ! [archiver encodeSize:[self minSize] withName:@"minSize"]; [archiver encodeString:[self frameAutosaveName] withName:@"frameAutosaveName"]; [archiver encodeInt:[self level] withName:@"level"]; --- 1224,1243 - (void)encodeWithModelArchiver:(GMArchiver*)archiver { NSPoint wnOrigin = [self frame].origin; ! NSRect ctFrame = [[self contentView] frame], minRect; unsigned int style; ctFrame.origin = wnOrigin; + /* convert minSize to GNUstep frame (without title bar and resize bar) */ + minRect.origin = wnOrigin; + minRect.size = [self minSize]; + minRect = [NSWindow contentRectForFrameRect:minRect + styleMask:[self styleMask]]; + [archiver encodeRect:ctFrame withName:@"contentFrame"]; [archiver encodeSize:[self maxSize] withName:@"maxSize"]; ! [archiver encodeSize:minRect.size withName:@"minSize"]; [archiver encodeString:[self frameAutosaveName] withName:@"frameAutosaveName"]; [archiver encodeInt:[self level] withName:@"level"]; ___ Bug-gnustep mailing list [EMAIL PROTECTED] http://lists.gnu.org/mailman/listinfo/bug-gnustep
Re: ANN: nib2gmodel version 0.9.0
Hi Adam, > I want to make a few other changes then I'll probably > package it up and have you try it out again... Ok. I also got an exception with popup buttons (on OpenStep) and now figured out how to fix it. Attached is the exception I got and the patch. [[self selectedItem] title] works, but [self title] didn't work at this point. Georg Oct 13 17:13:19 nib2gmodel[19038] *** -[NSMenuTemplate count]: selector not recognized Oct 13 17:15:01 nib2gmodel[19038] *** Uncaught exception: *** -[NSMenuTemplate count]: selector not recognized *** gui/Model/GMAppKit.m.oldMon Oct 11 17:38:53 2004 --- gui/Model/GMAppKit.mWed Oct 13 17:46:20 2004 *** *** 983,989 #endif //[archiver encodeString:[self titleOfSelectedItem] withName:@"selectedItem"]; ! [archiver encodeString:[self title] withName:@"selectedItem"]; } + (id)createObjectForModelUnarchiver:(GMUnarchiver*)unarchiver --- 983,989 #endif //[archiver encodeString:[self titleOfSelectedItem] withName:@"selectedItem"]; ! [archiver encodeString:[[self selectedItem] title] withName:@"selectedItem"]; } + (id)createObjectForModelUnarchiver:(GMUnarchiver*)unarchiver ___ Bug-gnustep mailing list [EMAIL PROTECTED] http://lists.gnu.org/mailman/listinfo/bug-gnustep
Re: ANN: nib2gmodel version 0.9.0
Hi Adam, downloaded the new nib2gmodel. The link on the download page is missing a slash after gnustep: ftp://ftp.gnustep.org/pub/gnustepdev-apps/ (on this page: http://wwwmain.gnustep.org/resources/downloads.php?site=ftp%3A%2F%2Fftp.gnustep.org%2Fpub%2Fgnustep) Here are my compiling results on OpenStep 4.2 using ./configure gnumake GNUmakefile:28: /LocalDeveloper/Projects/Linux/GNUstep/nib2gmodel-0.9.0/usr/GNUstep/System/Library/Makefiles/common.make: No such file or directory [some more of these] /usr/local/GNUstep was created but not /usr/GNUstep. After making the dir and a dirty link, compiling stopped here: Compiling file ./IMCustomObject.m ... cc1obj: Invalid option `-fno-strict-aliasing' gnumake[2]: *** [static_obj/IMCustomObject.o] Error 1 gnumake[1]: *** [libgmodel.all.library.variables] Error 2 gnumake: *** [subproj-all] Error 2 I removed this flag from common.make to continue. Now compilation succeeded :-) Georg ___ Bug-gnustep mailing list [EMAIL PROTECTED] http://lists.gnu.org/mailman/listinfo/bug-gnustep