mirror of
https://github.com/gnustep/apps-gorm.git
synced 2025-02-23 19:51:00 +00:00
Fix for bug#28646
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/gorm/trunk@37912 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
3b78ac2018
commit
4ff11ce871
7 changed files with 135 additions and 5 deletions
|
@ -1,3 +1,10 @@
|
|||
2014-05-27 03:26-EDT Gregory John Casamento <greg.casamento@gmail.com>
|
||||
|
||||
* 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 <greg.casamento@gmail.com>
|
||||
|
||||
* GormCore/GormDocument.m: Fix bug #39072: add retain to prevent
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
@ -123,6 +135,93 @@
|
|||
{
|
||||
[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];
|
||||
}
|
||||
|
||||
/*
|
||||
* prototypeMatrix
|
||||
|
@ -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];
|
||||
}
|
||||
|
|
|
@ -12,7 +12,10 @@
|
|||
propagateSwitch,
|
||||
prototypeMatrix,
|
||||
selRectSwitch,
|
||||
tagForm
|
||||
tagForm,
|
||||
dimensionsForm,
|
||||
colsStepper,
|
||||
rowsStepper
|
||||
);
|
||||
Super = IBInspector;
|
||||
};
|
||||
|
|
Binary file not shown.
Binary file not shown.
Loading…
Reference in a new issue