Add groupSelectionInMatrix

This commit is contained in:
Gregory John Casamento 2021-03-27 01:44:49 -04:00
parent b777e0e383
commit 5d699dd353
8 changed files with 67 additions and 1 deletions

View file

@ -1,3 +1,12 @@
2021-03-27 Gregory John Casamento <greg.casamento@gmail.com>
* English.lproj/Gorm.gorm/data.classes: Add action on class.
* GormCore/GormGenericEditor.h: Add declaration
* GormCore/GormViewWithContentViewEditor.h:
* GormCore/GormViewWithContentViewEditor.m: Add implementation of
groupSelectionInMatrix method.
* Gorm.m: Add groupSelectionInMatrix: IBAction.
2020-04-17 14:45-EDT Gregory John Casamento <greg.casamento@gmail.com>
* ANNOUNCE

View file

@ -6,6 +6,7 @@
"arrangeSelectedObjects:",
"exportStrings:",
"groupSelectionInView:",
"groupSelectionInMatrix:",
"orderFrontFontPanel:",
"translate:"
);
@ -45,7 +46,8 @@
"preferencesPanel:",
"guideline:",
"print:",
"groupSelectionInView:"
"groupSelectionInView:",
"groupSelectionInMatrix:"
);
Outlets = (
gormMenu,

Binary file not shown.

Binary file not shown.

7
Gorm.m
View file

@ -826,6 +826,13 @@
[(GormGenericEditor *)selectionOwner groupSelectionInScrollView];
}
- (void) groupSelectionInMatrix: (id)sender
{
if ([selectionOwner respondsToSelector: @selector(groupSelectionInMatrix)] == NO)
return;
[(GormGenericEditor *)selectionOwner groupSelectionInMatrix];
}
- (void) ungroup: (id)sender
{
// NSLog(@"ungroup: selectionOwner %@", selectionOwner);

View file

@ -87,6 +87,7 @@
- (void) groupSelectionInSplitView;
- (void) groupSelectionInBox;
- (void) groupSelectionInView;
- (void) groupSelectionInMatrix;
- (void) ungroup;
- (void) setEditor: (id)anEditor forDocument: (id<IBDocuments>)doc;
- (id) changeSelection: (id)sender;

View file

@ -36,6 +36,7 @@
- (void) postDrawForView: (GormViewEditor *) viewEditor;
- (void) groupSelectionInSplitView;
- (void) groupSelectionInBox;
- (void) groupSelectionInMatrix;
- (void) groupSelectionInView;
- (void) ungroup;
- (void) pasteInView: (NSView *)view;

View file

@ -501,6 +501,52 @@ NSComparisonResult _sortViews(id view1, id view2, void *context)
[self selectObjects: [NSArray arrayWithObject: editor]];
}
- (void) groupSelectionInMatrix
{
GormViewEditor *editor = nil;
NSMatrix *matrix = nil;
if ([selection count] < 1)
{
return;
}
// For an NSMatrix there can only be one prototype cell.
if ([selection count] == 1)
{
GormViewEditor *s = [selection objectAtIndex: 0];
id editedObject = [s editedObject];
NSCell *cell = [editedObject cell];
NSRect rect = [editedObject frame];
NSView *superview = [s superview];
// Create the matrix
matrix = [[NSMatrix alloc] initWithFrame: rect
mode: NSRadioModeMatrix
prototype: cell
numberOfRows: 1
numberOfColumns: 1];
rect = NSUnionRect(rect, [s frame]);
[s deactivate];
NSLog(@"editedObject = %@,\n\nsuperview = %@,\n\nmatrix = %@",editedObject, superview, matrix);
[matrix setPrototype: cell];
[matrix setCellClass: [cell class]];
[editedObject removeFromSuperview];
[document attachObject: matrix
toParent: _editedObject];
[superview addSubview: matrix];
}
editor = (GormViewEditor *)[document editorForObject: matrix
inEditor: self
create: YES];
[self selectObjects: [NSArray arrayWithObject: editor]];
}
- (void) groupSelectionInScrollView
{
NSEnumerator *enumerator = nil;