Add new palette to Gorm

This commit is contained in:
Gregory John Casamento 2025-01-29 14:23:36 -05:00
parent f39a2644f6
commit 3202fde0c5
21 changed files with 221 additions and 16 deletions

View file

@ -73,6 +73,7 @@ Gorm_RESOURCE_FILES = \
Palettes/2Controls/2Controls.palette \
Palettes/3Containers/3Containers.palette \
Palettes/4Data/4Data.palette \
Palettes/5Boxes/5Boxes.palette \
Images/FileIcon_gmodel.tiff \
Images/GormEHCoil.tiff \
Images/GormEHLine.tiff \

View file

@ -0,0 +1,16 @@
{
"## Comment" = "Do NOT change this file, Gorm maintains it";
BoxesPalette = {
Actions = (
);
Outlets = (
vview,
hview,
tview,
vimage,
himage,
timage
);
Super = IBPalette;
};
}

View file

@ -0,0 +1,15 @@
/* All Rights reserved */
#include <AppKit/AppKit.h>
#include <InterfaceBuilder/InterfaceBuilder.h>
@interface BoxesPalette : IBPalette
{
id vview;
id hview;
id tview;
id vimage;
id himage;
id timage;
}
@end

View file

@ -0,0 +1,50 @@
/* All Rights reserved */
#include <AppKit/AppKit.h>
#include <GNUstepGUI/GSTable.h>
#include "BoxesPalette.h"
@interface GSTable (GormDrawingExtension)
- (void) drawRect: (NSRect)rect;
@end
@implementation GSTable (GormDrawingExtension)
- (void) drawRect: (NSRect)aRect
{
// draw whatever the parent view contains.
[super drawRect: aRect];
if([(id<IB>)NSApp isTestingInterface] == NO)
{
CGFloat dot_dash[] = {1.0, 1.0};
NSGraphicsContext *ctxt = GSCurrentContext();
// Draw a green box;
[[NSColor blueColor] set];
DPSsetlinewidth(ctxt, 1.0);
DPSsetdash(ctxt, dot_dash, 4, 0.0);
DPSrectstroke(ctxt, NSMinX(aRect) + 0.5, NSMinY(aRect) + 0.5,
NSWidth(aRect) - 1.0, NSHeight(aRect) - 1.0);
}
}
@end
@implementation BoxesPalette
- (void)finishInstantiate
{
// make the associations...
[self associateObject: tview
type: IBViewPboardType
with: timage];
[self associateObject: hview
type: IBViewPboardType
with: himage];
[self associateObject: vview
type: IBViewPboardType
with: vimage];
}
@end

Binary file not shown.

View file

@ -0,0 +1,49 @@
# GNUmakefile
#
# Copyright (C) 1999 Free Software Foundation, Inc.
#
# Author: Richard Frith-Macdonald <richard@brainstorm.co.uk>
# Date: 1999
#
# This file is part of GNUstep.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
include $(GNUSTEP_MAKEFILES)/common.make
PALETTE_NAME = 5Boxes
5Boxes_PALETTE_ICON = BoxesPalette
5Boxes_OBJC_FILES = \
BoxesPalette.m \
GSTableInspector.m
5Boxes_PRINCIPAL_CLASS = BoxesPalette
5Boxes_RESOURCE_FILES = \
BoxesPalette.tiff \
BoxesPalette.gorm \
GSTableInspector.gorm \
palette.table
5Boxes_STANDARD_INSTALL = no
-include GNUmakefile.preamble
-include GNUmakefile.local
include $(GNUSTEP_MAKEFILES)/palette.make
-include GNUmakefile.postamble

View file

@ -0,0 +1,2 @@
# Additional include directories the compiler should search
ADDITIONAL_INCLUDE_DIRS += -I../../

View file

@ -0,0 +1,11 @@
{
"## Comment" = "Do NOT change this file, Gorm maintains it";
GSTableInspector = {
Actions = (
);
Outlets = (
matrix
);
Super = IBInspector;
};
}

View file

@ -0,0 +1,10 @@
/* All Rights reserved */
#include <AppKit/AppKit.h>
#include <InterfaceBuilder/InterfaceBuilder.h>
@interface GSTableInspector : IBInspector
{
id matrix;
}
@end

View file

@ -0,0 +1,49 @@
/* All Rights reserved */
#include <AppKit/AppKit.h>
#include "GSTableInspector.h"
#include <GNUstepGUI/GSTable.h>
@implementation GSTable (IBObjectAdditions)
- (NSString *)inspectorClassName
{
return @"GSTableInspector";
}
@end
@implementation GSTableInspector
- (id) init
{
if ([super init] == nil)
return nil;
if ([NSBundle loadNibNamed: @"GSTableInspector" owner: self] == NO)
{
NSLog(@"Could not load GSTableInspector");
return nil;
}
return self;
}
- (void) ok: (id)sender
{
[super ok: sender];
NSLog(@"Testing...");
if(sender == matrix)
{
[object setXBorder: [[sender cellAtIndex: 0] intValue]];
[object setYBorder: [[sender cellAtIndex: 1] intValue]];
[object setMinXBorder: [[sender cellAtIndex: 2] intValue]];
[object setMaxXBorder: [[sender cellAtIndex: 3] intValue]];
[object setMinYBorder: [[sender cellAtIndex: 4] intValue]];
[object setMaxYBorder: [[sender cellAtIndex: 5] intValue]];
}
}
- (void) setObject: (id)anobject
{
[super setObject: anobject];
}
@end

View file

@ -0,0 +1,6 @@
{
NibFile = "BoxesPalette";
Class = "BoxesPalette";
Icon = "BoxesPalette";
ExportClasses = ("GSTable","GSVbox","GSHbox");
}

View file

@ -32,7 +32,8 @@ SUBPROJECTS = \
1Windows \
2Controls \
3Containers \
4Data
4Data \
5Boxes
-include GNUmakefile.preamble

View file

@ -6,7 +6,8 @@
1Windows.palette,
2Controls.palette,
3Containers.palette,
4Data.palette
4Data.palette,
5Boxes.palette
);
BuiltinPlugins = (
Gorm.plugin,

View file

@ -38,16 +38,6 @@
@end
@implementation GormPalettePanel
/*
- (BOOL) canBecomeKeyWindow
{
return NO;
}
- (BOOL) canBecomeMainWindow
{
return YES;
}
*/
@end
@interface GormPaletteView : NSView
@ -363,13 +353,16 @@ static NSImage *dragImage = nil;
inDirectory: nil];
if ([array count] > 0)
{
unsigned index;
NSEnumerator *en = nil;
NSString *paletteName = nil;
array = [array sortedArrayUsingSelector: @selector(compare:)];
en = [array objectEnumerator];
for (index = 0; index < [array count]; index++)
while ((paletteName = [en nextObject]) != nil)
{
[self loadPalette: [array objectAtIndex: index]];
NSLog(@"Built in palette... %@", paletteName);
[self loadPalette: paletteName];
}
}
@ -380,6 +373,7 @@ static NSImage *dragImage = nil;
id paletteName = nil;
while((paletteName = [en nextObject]) != nil)
{
NSLog(@"User Palettes Loading... %@", paletteName);
[self loadPalette: paletteName];
}
}