mirror of
https://github.com/gnustep/apps-gorm.git
synced 2025-02-24 03:51:22 +00:00
* GormWindowEditor.m ([GormWindowEditor -_validateFrame:forViewPtr:
withEvent:update:update]): fixed checks for non-matrix control. Allow the matrix to reduce rows and columns. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/gorm/trunk@10232 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
45339a9685
commit
39410f2c64
2 changed files with 34 additions and 15 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
2001-06-24 Mirko Viviani <mirko.viviani@rccr.cremona.it>
|
||||||
|
|
||||||
|
* GormWindowEditor.m ([GormWindowEditor -_validateFrame:forViewPtr:
|
||||||
|
withEvent:update:update]): fixed checks for non-matrix control. Allow
|
||||||
|
the matrix to reduce rows and columns.
|
||||||
|
|
||||||
2001-06-20 Adam Fedor <fedor@gnu.org>
|
2001-06-20 Adam Fedor <fedor@gnu.org>
|
||||||
|
|
||||||
* GormDocument.m (-beginArchiving): Add filesOwner class name to
|
* GormDocument.m (-beginArchiving): Add filesOwner class name to
|
||||||
|
|
|
@ -357,16 +357,11 @@ static BOOL done_editing;
|
||||||
|
|
||||||
if (!isMatrix)
|
if (!isMatrix)
|
||||||
{
|
{
|
||||||
/* Check if it is already too small and we're just making it bigger */
|
/* Check if it is too small*/
|
||||||
NSRect oldFrame = [view frame];
|
if (NSWidth(frame) < minSize.width
|
||||||
if (NSWidth(frame) >= NSWidth(oldFrame)
|
|| NSHeight(frame) < minSize.height)
|
||||||
&& NSHeight(frame) >= NSHeight(oldFrame))
|
|
||||||
return YES;
|
|
||||||
/* Otherwise check if it is too small */
|
|
||||||
if (NSWidth(frame) < minSize.width)
|
|
||||||
return NO;
|
|
||||||
if (NSHeight(frame) < minSize.height)
|
|
||||||
return NO;
|
return NO;
|
||||||
|
|
||||||
if (([theEvent modifierFlags] & NSAlternateKeyMask)
|
if (([theEvent modifierFlags] & NSAlternateKeyMask)
|
||||||
!= NSAlternateKeyMask || isControl == NO)
|
!= NSAlternateKeyMask || isControl == NO)
|
||||||
return YES;
|
return YES;
|
||||||
|
@ -406,6 +401,7 @@ static BOOL done_editing;
|
||||||
/* If possible convert the object to a matrix with the cell given by the
|
/* If possible convert the object to a matrix with the cell given by the
|
||||||
current object. If already a matrix, set the number of rows/cols
|
current object. If already a matrix, set the number of rows/cols
|
||||||
based on the frame size. */
|
based on the frame size. */
|
||||||
|
|
||||||
if (!isMatrix)
|
if (!isMatrix)
|
||||||
{
|
{
|
||||||
/* Convert to a matrix object */
|
/* Convert to a matrix object */
|
||||||
|
@ -415,6 +411,9 @@ static BOOL done_editing;
|
||||||
prototype: [view cell]
|
prototype: [view cell]
|
||||||
numberOfRows: 1
|
numberOfRows: 1
|
||||||
numberOfColumns: 1];
|
numberOfColumns: 1];
|
||||||
|
|
||||||
|
cellSize.width = [view frame].size.width;
|
||||||
|
cellSize.height = [view frame].size.height;
|
||||||
/* Remove this view and add the new matrix */
|
/* Remove this view and add the new matrix */
|
||||||
[edit_view addSubview: AUTORELEASE(matrix)];
|
[edit_view addSubview: AUTORELEASE(matrix)];
|
||||||
//[self makeSelectionVisible: NO];
|
//[self makeSelectionVisible: NO];
|
||||||
|
@ -426,16 +425,12 @@ static BOOL done_editing;
|
||||||
*view_ptr = view = matrix;
|
*view_ptr = view = matrix;
|
||||||
cols = rows = 1;
|
cols = rows = 1;
|
||||||
}
|
}
|
||||||
if (NSWidth(frame) < (cellSize.width+intercellSpace.width)*cols
|
|
||||||
- intercellSpace.width)
|
|
||||||
return NO;
|
|
||||||
if (NSHeight(frame) < (cellSize.height+intercellSpace.height)*rows
|
|
||||||
- intercellSpace.height)
|
|
||||||
return NO;
|
|
||||||
new_cols = (NSWidth(frame)+intercellSpace.width)
|
new_cols = (NSWidth(frame)+intercellSpace.width)
|
||||||
/ (cellSize.width + intercellSpace.width);
|
/ (cellSize.width + intercellSpace.width);
|
||||||
new_rows = (NSHeight(frame)+intercellSpace.height)
|
new_rows = (NSHeight(frame)+intercellSpace.height)
|
||||||
/ (cellSize.height+intercellSpace.height);
|
/ (cellSize.height+intercellSpace.height);
|
||||||
|
|
||||||
if (new_rows < 0 || new_rows-rows > 50
|
if (new_rows < 0 || new_rows-rows > 50
|
||||||
|| new_cols < 0 || new_cols-cols > 50)
|
|| new_cols < 0 || new_cols-cols > 50)
|
||||||
{
|
{
|
||||||
|
@ -457,6 +452,15 @@ static BOOL done_editing;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (new_cols < cols)
|
||||||
|
{
|
||||||
|
int num = [view numberOfColumns] - 1;
|
||||||
|
|
||||||
|
if (num <= 0)
|
||||||
|
return NO;
|
||||||
|
|
||||||
|
[view removeColumn: num];
|
||||||
|
}
|
||||||
if (new_rows > rows)
|
if (new_rows > rows)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
@ -469,6 +473,15 @@ static BOOL done_editing;
|
||||||
[view addRow];
|
[view addRow];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (new_rows < rows)
|
||||||
|
{
|
||||||
|
int num = [view numberOfRows] - 1;
|
||||||
|
|
||||||
|
if (num <= 0)
|
||||||
|
return NO;
|
||||||
|
|
||||||
|
[view removeRow: num];
|
||||||
|
}
|
||||||
if (redisplay)
|
if (redisplay)
|
||||||
{
|
{
|
||||||
/* Redisplay regardless of 'update, since number of cells changed */
|
/* Redisplay regardless of 'update, since number of cells changed */
|
||||||
|
|
Loading…
Reference in a new issue