bug-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Fix: NSView


From: Georg Fleischmann
Subject: Fix: NSView
Date: Mon, 18 Dec 2000 00:23:52 +0100

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;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]