Author: gcasa
Date: Tue May 27 09:27:32 2014
New Revision: 37912

URL: http://svn.gna.org/viewcvs/gnustep?rev=37912&view=rev
Log:
Fix for bug#28646

Modified:
    apps/gorm/trunk/ChangeLog
    apps/gorm/trunk/GormCore/GormInspectorsManager.m
    apps/gorm/trunk/Palettes/2Controls/GormMatrixAttributesInspector.h
    apps/gorm/trunk/Palettes/2Controls/GormMatrixAttributesInspector.m
    apps/gorm/trunk/Palettes/2Controls/GormNSMatrixInspector.gorm/data.classes
    apps/gorm/trunk/Palettes/2Controls/GormNSMatrixInspector.gorm/data.info
    apps/gorm/trunk/Palettes/2Controls/GormNSMatrixInspector.gorm/objects.gorm

Modified: apps/gorm/trunk/ChangeLog
URL: 
http://svn.gna.org/viewcvs/gnustep/apps/gorm/trunk/ChangeLog?rev=37912&r1=37911&r2=37912&view=diff
==============================================================================
--- apps/gorm/trunk/ChangeLog   (original)
+++ apps/gorm/trunk/ChangeLog   Tue May 27 09:27:32 2014
@@ -1,3 +1,10 @@
+2014-05-27 03:26-EDT Gregory John Casamento <[email protected]>
+
+       * GormCore/GormInspectorsManager.m
+       * Palettes/2Controls/GormMatrixAttributesInspector.h
+       * Palettes/2Controls/GormMatrixAttributesInspector.m
+       * Palettes/2Controls/GormNSMatrixInspector.gorm: Fix for bug #28646.
+
 2014-05-27 03:15-EDT Gregory John Casamento <[email protected]>
 
        * GormCore/GormDocument.m: Fix bug #39072: add retain to prevent

Modified: apps/gorm/trunk/GormCore/GormInspectorsManager.m
URL: 
http://svn.gna.org/viewcvs/gnustep/apps/gorm/trunk/GormCore/GormInspectorsManager.m?rev=37912&r1=37911&r2=37912&view=diff
==============================================================================
--- apps/gorm/trunk/GormCore/GormInspectorsManager.m    (original)
+++ apps/gorm/trunk/GormCore/GormInspectorsManager.m    Tue May 27 09:27:32 2014
@@ -392,8 +392,22 @@
        {   
          id initialResponder = [[inspector window] initialFirstResponder];
          NSView        *outer = [panel contentView];
-         NSRect        rect = [outer bounds];
-         
+         NSRect        rect = [panel frame];
+         /*
+           We should compute the delta between the heights of the old 
inspector view 
+           and the new one. The delta will be used to compute the size of the 
inspector 
+           panel. Is is needed because subsequent changes of object selection 
lead to 
+           the cluttered inspector's UI otherwise.
+          */
+         CGFloat delta = [newView frame].size.height - [oldView 
frame].size.height;
+
+         rect.size.height = rect.size.height + delta;
+         rect.origin.y = [panel frame].origin.y - delta;
+         //      [panel setContentSize: rect.size];
+         [panel setFrame: rect display: YES];
+
+         rect = [outer bounds];
+
          /* Set initialFirstResponder */
          if (buttonView != nil)
            {
@@ -401,7 +415,7 @@
              buttonView = nil;
            }
 
-         rect.size.height = [selectionView frame].origin.y - 3;
+         rect.size.height = [newView frame].size.height;
          if ([inspector wantsButtons] == YES)
            {
              NSRect    buttonsRect;
@@ -441,7 +455,7 @@
            }
          else
            {
-             rect.size.height = [selectionView frame].origin.y - 3;
+             rect.size.height = [newView frame].size.height;
              [buttonView removeFromSuperview];
            }
 
@@ -455,6 +469,7 @@
          RETAIN(oldView);
          [inspectorView setContentView: newView];
          [[prevInspector window] setContentView: oldView];
+         [outer setNeedsDisplay: YES];
          // RELEASE(oldView);
 
          /* Set the default First responder to the new View */

Modified: apps/gorm/trunk/Palettes/2Controls/GormMatrixAttributesInspector.h
URL: 
http://svn.gna.org/viewcvs/gnustep/apps/gorm/trunk/Palettes/2Controls/GormMatrixAttributesInspector.h?rev=37912&r1=37911&r2=37912&view=diff
==============================================================================
--- apps/gorm/trunk/Palettes/2Controls/GormMatrixAttributesInspector.h  
(original)
+++ apps/gorm/trunk/Palettes/2Controls/GormMatrixAttributesInspector.h  Tue May 
27 09:27:32 2014
@@ -40,6 +40,7 @@
 @class NSColorWell;
 @class NSForm;
 @class NSMatrix;
+@class NSStepper;
 
 @interface GormMatrixAttributesInspector:IBInspector
 {
@@ -52,6 +53,9 @@
   NSMatrix *prototypeMatrix;
   NSButton *selRectSwitch;
   NSForm *tagForm;
+  NSForm *dimensionsForm;
+  NSStepper *rowsStepper;
+  NSStepper *colsStepper;
 }
 @end
 

Modified: apps/gorm/trunk/Palettes/2Controls/GormMatrixAttributesInspector.m
URL: 
http://svn.gna.org/viewcvs/gnustep/apps/gorm/trunk/Palettes/2Controls/GormMatrixAttributesInspector.m?rev=37912&r1=37911&r2=37912&view=diff
==============================================================================
--- apps/gorm/trunk/Palettes/2Controls/GormMatrixAttributesInspector.m  
(original)
+++ apps/gorm/trunk/Palettes/2Controls/GormMatrixAttributesInspector.m  Tue May 
27 09:27:32 2014
@@ -53,6 +53,9 @@
 
 @implementation GormMatrixAttributesInspector
 
+NSUInteger rowsStepperValue;
+NSUInteger colsStepperValue;
+
 - (id) init
 {
   if ([super init] == nil)
@@ -64,6 +67,15 @@
       NSLog(@"Could not gorm GormMatrixInspector");
       return nil;
     }
+  /* It shouldn't break functionality of rows/columns number 
+     changing if someone will decide in the future to change 
+     the values of the corresponding steppers in the gorm file. 
+     So we stores those values from the gorm file in the auxillary 
+     variables to use its later in -[ok:]. 
+     (It allows us to avoid the values being hardcoded).
+   */
+  rowsStepperValue = [rowsStepper intValue];
+  colsStepperValue = [colsStepper intValue];
 
   return self;
 }
@@ -122,6 +134,93 @@
   else if (sender == tagForm)
     {
       [object setTag: [[sender cellAtIndex: 0] intValue]];
+    }
+  else if (sender == dimensionsForm)
+    {
+      int rows = [[sender cellAtIndex: 0] intValue];
+      int cols = [[sender cellAtIndex: 1] intValue];
+      int num;
+
+      while((num = [object numberOfRows]) != rows)
+       {
+         if(num > rows)
+           {
+             [object removeRow: num - 1]; // remove last row
+           }
+         else
+           {
+             [object addRow];
+           }
+       }
+      
+      while((num = [object numberOfColumns]) != cols)
+       {
+         if(num > cols)
+           {
+             [object removeColumn: num - 1]; // remove last column
+           }
+         else
+           {
+             [object addColumn];
+           }
+       }
+      //      [object sizeToCells];
+      [object setNeedsDisplay: YES];
+      [[object superview] setNeedsDisplay: YES];
+    }
+  else if(sender == rowsStepper)
+    {
+      int delta = [sender intValue] - rowsStepperValue;
+      int num = [object numberOfRows];
+      NSRect rect = [object frame];
+      NSSize cell = [object cellSize];
+      NSSize inter = [object intercellSpacing];
+
+      while(delta > 0)
+       {
+         [object addRow];
+         delta--;
+         num++;
+       }
+      while((delta < 0) && (num > 1))
+       {
+         [object removeRow: num - 1];
+         num--;
+         delta++;
+       }
+      cell.height = (rect.size.height + inter.height) / num - inter.height;
+      [object setCellSize: cell];
+      [[dimensionsForm cellAtIndex: 0] setIntValue: num];
+      [sender setIntValue: rowsStepperValue];
+      [dimensionsForm setNeedsDisplay: YES];
+      [object setNeedsDisplay: YES];
+    }
+  else if(sender == colsStepper)
+    {
+      int delta = [sender intValue] - colsStepperValue;
+      int num = [object numberOfColumns];
+      NSRect rect = [object frame];
+      NSSize cell = [object cellSize];
+      NSSize inter = [object intercellSpacing];
+
+      while(delta > 0)
+       {
+         [object addColumn];
+         delta--;
+         num++;
+       }
+      while((delta < 0) && (num > 1))
+       {
+         [object removeColumn: num - 1];
+         num--;
+         delta++;
+       }
+      cell.width = (rect.size.width + inter.width) / num - inter.width;
+      [object setCellSize: cell];
+      [[dimensionsForm cellAtIndex: 1] setIntValue: num];
+      [sender setIntValue: colsStepperValue];
+      [dimensionsForm setNeedsDisplay: YES];
+      [object setNeedsDisplay: YES];
     }
 
   /*
@@ -172,6 +271,8 @@
   [selRectSwitch setState: 
     ([object isSelectionByRect]) ? NSOnState : NSOffState];
   [[tagForm cellAtIndex: 0] setIntValue: [object tag]];
+  [[dimensionsForm cellAtIndex: 0] setIntValue: [object numberOfRows]];
+  [[dimensionsForm cellAtIndex: 1] setIntValue: [object numberOfColumns]];
 
   [super revert:sender];
 }

Modified: 
apps/gorm/trunk/Palettes/2Controls/GormNSMatrixInspector.gorm/data.classes
URL: 
http://svn.gna.org/viewcvs/gnustep/apps/gorm/trunk/Palettes/2Controls/GormNSMatrixInspector.gorm/data.classes?rev=37912&r1=37911&r2=37912&view=diff
==============================================================================
--- apps/gorm/trunk/Palettes/2Controls/GormNSMatrixInspector.gorm/data.classes  
(original)
+++ apps/gorm/trunk/Palettes/2Controls/GormNSMatrixInspector.gorm/data.classes  
Tue May 27 09:27:32 2014
@@ -12,7 +12,10 @@
            propagateSwitch,
            prototypeMatrix,
            selRectSwitch,
-           tagForm
+           tagForm,
+           dimensionsForm,
+           colsStepper,
+           rowsStepper
        );
        Super = IBInspector;
     };

Modified: 
apps/gorm/trunk/Palettes/2Controls/GormNSMatrixInspector.gorm/data.info
URL: 
http://svn.gna.org/viewcvs/gnustep/apps/gorm/trunk/Palettes/2Controls/GormNSMatrixInspector.gorm/data.info?rev=37912&r1=37911&r2=37912&view=diff
==============================================================================
Binary files - no diff available.

Modified: 
apps/gorm/trunk/Palettes/2Controls/GormNSMatrixInspector.gorm/objects.gorm
URL: 
http://svn.gna.org/viewcvs/gnustep/apps/gorm/trunk/Palettes/2Controls/GormNSMatrixInspector.gorm/objects.gorm?rev=37912&r1=37911&r2=37912&view=diff
==============================================================================
Binary files - no diff available.


_______________________________________________
Gnustep-cvs mailing list
[email protected]
https://mail.gna.org/listinfo/gnustep-cvs

Reply via email to