Merge branch 'master' into implement_bindings

This commit is contained in:
Gregory John Casamento 2024-05-08 13:14:43 -04:00
commit 970d93e735
16 changed files with 312 additions and 38 deletions

99
.github/scripts/dependencies.sh vendored Executable file
View file

@ -0,0 +1,99 @@
#! /usr/bin/env sh
set -ex
install_gnustep_make() {
echo "::group::GNUstep Make"
cd $DEPS_PATH
git clone -q -b ${TOOLS_MAKE_BRANCH:-master} https://github.com/gnustep/tools-make.git
cd tools-make
MAKE_OPTS=
if [ -n "$HOST" ]; then
MAKE_OPTS="$MAKE_OPTS --host=$HOST"
fi
if [ -n "$RUNTIME_VERSION" ]; then
MAKE_OPTS="$MAKE_OPTS --with-runtime-abi=$RUNTIME_VERSION"
fi
./configure --prefix=$INSTALL_PATH --with-library-combo=$LIBRARY_COMBO $MAKE_OPTS || cat config.log
make install
echo Objective-C build flags:
$INSTALL_PATH/bin/gnustep-config --objc-flags
echo "::endgroup::"
}
install_libobjc2() {
echo "::group::libobjc2"
cd $DEPS_PATH
git clone -q https://github.com/gnustep/libobjc2.git
cd libobjc2
git submodule sync
git submodule update --init
mkdir build
cd build
cmake \
-DTESTS=off \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DGNUSTEP_INSTALL_TYPE=NONE \
-DCMAKE_INSTALL_PREFIX:PATH=$INSTALL_PATH \
../
make install
echo "::endgroup::"
}
install_libdispatch() {
echo "::group::libdispatch"
cd $DEPS_PATH
# will reference upstream after https://github.com/apple/swift-corelibs-libdispatch/pull/534 is merged
git clone -q -b system-blocksruntime https://github.com/ngrewe/swift-corelibs-libdispatch.git libdispatch
mkdir libdispatch/build
cd libdispatch/build
# -Wno-error=void-pointer-to-int-cast to work around build error in queue.c due to -Werror
cmake \
-DBUILD_TESTING=off \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_INSTALL_PREFIX:PATH=$INSTALL_PATH \
-DCMAKE_C_FLAGS="-Wno-error=void-pointer-to-int-cast" \
-DINSTALL_PRIVATE_HEADERS=1 \
-DBlocksRuntime_INCLUDE_DIR=$INSTALL_PATH/include \
-DBlocksRuntime_LIBRARIES=$INSTALL_PATH/lib/libobjc.so \
../
make install
echo "::endgroup::"
}
install_gnustep_gui() {
echo "::group::GNUstep GUI"
cd $DEPS_PATH
. $INSTALL_PATH/share/GNUstep/Makefiles/GNUstep.sh
git clone -q -b ${LIBS_GUI_BRANCH:-master} https://github.com/gnustep/libs-gui.git
cd libs-gui
./configure
make
make install
echo "::endgroup::"
}
install_gnustep_base() {
echo "::group::GNUstep Base"
cd $DEPS_PATH
. $INSTALL_PATH/share/GNUstep/Makefiles/GNUstep.sh
git clone -q -b ${LIBS_BASE_BRANCH:-master} https://github.com/gnustep/libs-base.git
cd libs-base
./configure
make
make install
echo "::endgroup::"
}
mkdir -p $DEPS_PATH
# Windows MSVC toolchain uses tools-windows-msvc scripts to install non-GNUstep dependencies
if [ "$LIBRARY_COMBO" = "ng-gnu-gnu" -a "$IS_WINDOWS_MSVC" != "true" ]; then
install_libobjc2
install_libdispatch
fi
install_gnustep_make
install_gnustep_base
install_gnustep_gui

126
.github/workflows/main.yml vendored Normal file
View file

@ -0,0 +1,126 @@
name: CI
on:
push:
pull_request:
workflow_dispatch:
inputs:
tools_make_branch:
description: "tools-make branch"
default: "master"
required: true
libs_base_branch:
description: "libs-base branch"
default: "master"
required: true
libs_back_branch:
description: "libs-back branch"
default: "master"
required: true
env:
APT_PACKAGES: >-
pkg-config
libgnutls28-dev
libffi-dev
libicu-dev
libxml2-dev
libxslt1-dev
libssl-dev
libavahi-client-dev
zlib1g-dev
gnutls-bin
libcurl4-gnutls-dev
libgmp-dev
libcairo2-dev
# packages for GCC Objective-C runtime
APT_PACKAGES_gcc: >-
libobjc-10-dev
libblocksruntime-dev
gobjc
# packages for libobjc2 / libdispatch
APT_PACKAGES_clang: >-
libpthread-workqueue-dev
jobs:
########### Linux ###########
linux:
name: ${{ matrix.name }}
runs-on: ubuntu-latest
# don't run pull requests from local branches twice
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository
strategy:
fail-fast: false
matrix:
include:
- name: Ubuntu x64 GCC
library-combo: gnu-gnu-gnu
CC: gcc
CXX: g++
- name: Ubuntu x64 Clang gnustep-1.9
library-combo: ng-gnu-gnu
runtime-version: gnustep-1.9
CC: clang
CXX: clang++
- name: Ubuntu x64 Clang gnustep-2.0
library-combo: ng-gnu-gnu
runtime-version: gnustep-2.0
CC: clang
CXX: clang++
env:
SRC_PATH: ${{ github.workspace }}/source
DEPS_PATH: ${{ github.workspace }}/dependencies
INSTALL_PATH: ${{ github.workspace }}/build
CC: ${{ matrix.CC }}
CXX: ${{ matrix.CXX }}
LIBRARY_COMBO: ${{ matrix.library-combo }}
RUNTIME_VERSION: ${{ matrix.runtime-version }}
defaults:
run:
working-directory: ${{ env.SRC_PATH }}
steps:
- uses: actions/checkout@v3
with:
path: ${{ env.SRC_PATH }}
- name: Install packages
run: |
sudo apt-get -q -y update
sudo apt-get -q -y install $APT_PACKAGES $APT_PACKAGES_${{ matrix.library-combo == 'ng-gnu-gnu' && 'clang' || 'gcc' }}
# gnustep-2.0 runtime requires ld.gold or lld
if [ "$RUNTIME_VERSION" = "gnustep-2.0" ]; then
sudo update-alternatives --install "/usr/bin/ld" "ld" "/usr/bin/ld.gold" 10
fi
- name: Install dependencies
env:
TOOLS_MAKE_BRANCH: ${{github.event.inputs.tools_make_branch}}
LIBS_BASE_BRANCH: ${{github.event.inputs.libs_base_branch}}
LIBS_GUI_BRANCH: ${{github.event.inputs.libs_gui_branch}}
run: ./.github/scripts/dependencies.sh
- name: Build source for Gorm
run: . $INSTALL_PATH/share/GNUstep/Makefiles/GNUstep.sh && make && make install
- name: Run tests
run: |
. $INSTALL_PATH/share/GNUstep/Makefiles/GNUstep.sh
make check
- name: Upload logs
uses: actions/upload-artifact@v3
if: always()
with:
name: Logs - ${{ matrix.name }}
path: |
${{ env.SRC_PATH }}/config.log
${{ env.SRC_PATH }}/Tests/tests.log

View file

@ -142,8 +142,6 @@ Gorm_RESOURCE_FILES = \
Images/tabbot_nib.tiff \
Images/tabtop_nib.tiff \
Images/titleOnly_nib.tiff \
Images/browserView.tiff \
Images/outlineView.tiff \
Images/LeftArr.tiff \
Images/RightArr.tiff \

View file

@ -24,7 +24,7 @@
{
NSName = "GSNibFileType";
NSHumanReadableName = "Cocoa Nib";
NSRole = Viewer;
NSRole = Editor;
NSDocumentClass = GormDocument;
NSUnixExtensions = ( "nib" );
NSIcon = "GormNib.tiff";

View file

@ -213,6 +213,8 @@ GormCore_RESOURCE_FILES = \
Images/GormUnknown.tiff \
Images/GormView.tiff \
Images/GormWindow.tiff \
Images/browserView.tiff \
Images/outlineView.tiff \
Resources/VersionProfiles.plist \
Resources/ClassInformation.plist

View file

@ -87,7 +87,7 @@ NSString *formatVersion(NSInteger version)
+ (int) currentVersion
{
return appVersion(1,3,1);
return appVersion(1,4,0);
}
- (void) awakeFromNib

View file

@ -31,6 +31,29 @@
#include "GormPalettesManager.h"
#include "GormResource.h"
@interface NSMatrix (GormResourceEditorPrivate)
- (BOOL **) _selectedCells;
- (id **) _cells;
- (void) _setSelectedCell: (id)c;
@end
@implementation NSMatrix (GormResourceEditorPrivate)
- (BOOL **) _selectedCells
{
return _selectedCells;
}
- (id **) _cells
{
return _cells;
}
- (void) _setSelectedCell: (id)c
{
_selectedCell = c;
}
@end
@implementation GormResourceEditor
- (BOOL) acceptsTypeFromArray: (NSArray*)types
@ -197,7 +220,10 @@
NSPoint lastLocation = [theEvent locationInWindow];
NSEvent* lastEvent = theEvent;
NSPoint initialLocation;
BOOL **selectedCells = [self _selectedCells];
id selectedCell = [self selectedCell];
id **cells = nil;
/*
* Pathological case -- ignore mouse down
*/
@ -215,21 +241,21 @@
column: &column
forPoint: lastLocation])
{
if ([_cells[row][column] isEnabled])
if ([cells[row][column] isEnabled])
{
if ((_mode == NSRadioModeMatrix) && _selectedCell != nil)
{
[_selectedCell setState: NSOffState];
[selectedCell setState: NSOffState];
[self drawCellAtRow: _selectedRow column: _selectedColumn];
_selectedCells[_selectedRow][_selectedColumn] = NO;
_selectedCell = nil;
selectedCells[_selectedRow][_selectedColumn] = NO;
selectedCell = nil;
_selectedRow = _selectedColumn = -1;
}
[_cells[row][column] setState: NSOnState];
[cells[row][column] setState: NSOnState];
[self drawCellAtRow: row column: column];
[_window flushWindow];
_selectedCells[row][column] = YES;
_selectedCell = _cells[row][column];
selectedCells[row][column] = YES;
[self _setSelectedCell: cells[row][column]];
_selectedRow = row;
_selectedColumn = column;
}

View file

@ -143,8 +143,6 @@
/*
* Special internal classes
*/
[u setClass: [GormObjectProxy class]
forClassName: @"NSCustomObject"];
[u setClass: [GormCustomView class]
forClassName: @"NSCustomView"];
[u setClass: [GormWindowTemplate class]
@ -185,7 +183,7 @@
//
// set the current class on the File's owner...
//
if([_nibFilesOwner isKindOfClass: [GormObjectProxy class]])
if([_nibFilesOwner isKindOfClass: [NSCustomObject class]])
{
[docFilesOwner setClassName: [_nibFilesOwner className]];
}
@ -200,9 +198,26 @@
NSString *objName = nil;
// skip the file's owner, it is handled above...
if(o == _nibFilesOwner)
continue;
if(o == _nibFilesOwner
|| o == [document firstResponder])
{
continue;
}
//
// If it's NSApplication (most likely the File's Owner)
// skip it...
//
if ([o isKindOfClass: [NSCustomObject class]])
{
if ([[o className] isEqualToString: @"NSApplication"])
{
continue;
}
customClassName = [o className];
}
//
// if it's a window template, then replace it with an actual window.
//
@ -218,14 +233,17 @@
[document setObject: obj isDeferred: isDeferred];
[document setObject: obj isVisibleAtLaunch: isVisible];
[document attachObject: obj
toParent: nil];
// record the custom class...
if([classManager isCustomClass: className])
{
customClassName = className;
}
}
if([self isTopLevelObject: obj])
{
[document attachObject: obj
@ -379,6 +397,11 @@
[obj setTarget: nil];
[obj setAction: NULL];
}
else if([obj isKindOfClass: [NSCustomObject class]])
{
GormObjectProxy *o = [[GormObjectProxy alloc] initWithClassName: [obj className]];
obj = o; // replace the object if it's an NSCustomObject...
}
return obj;
}

View file

@ -30,11 +30,6 @@
#include "GormXibWrapperLoader.h"
/*
* Forward declarations for classes
*/
@class GormNSWindow, GormNSMenu;
/*
* This allows us to retrieve the customClasses from the XIB unarchiver.
*/
@ -78,6 +73,11 @@
[super dealloc];
}
//
// This method returns the "real" object that should be used in gorm for either
// the custom object, its substitute, or a standin object such as file's owner
// or first responder.
//
- (id) _replaceProxyInstanceWithRealObject: (id)obj
classManager: (GormClassManager *)classManager
withID: (NSString *)theId
@ -128,6 +128,10 @@
return result;
}
//
// This method instantiates the custom class and inserts it into the document
// so that it can be referenced from elsewhere in the data.
//
- (void) _handleCustomClassWithObject: (id)obj
withDocument: (GormDocument *)doc
{
@ -266,22 +270,19 @@
//
// Special internal classes
//
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wreceiver-forward-class"
[u setClass: [GormCustomView class]
forClassName: @"NSCustomView"];
[u setClass: [GormWindowTemplate class]
forClassName: @"NSWindowTemplate"];
[u setClass: [GormNSWindow class]
forClassName: @"NSWindow"];
[u setClass: [GormNSMenu class]
forClassName: @"NSMenu"];
[u setClass: [IBUserDefinedRuntimeAttribute class]
forClassName: @"IBUserDefinedRuntimeAttribute5"];
#pragma GCC diagnostic pop
//
// Substitute any classes specified by the palettes...
// Substitute any classes specified by the palettes... Palettes can specify
// substitute classes to use in place of certain classes, among them is
// NSMenu, this is so that their standins can be automatically used.
//
en = [substituteClasses keyEnumerator];
while ((subClassName = [en nextObject]) != nil)
@ -305,7 +306,6 @@
IBConnectionRecord *cr = nil;
NSArray *rootObjects = nil;
id xibFirstResponder = nil;
// id xibFontManager = nil;
rootObjects = [u decodeObjectForKey: @"IBDocument.RootObjects"];
xibFirstResponder = [rootObjects objectAtIndex: 1];
@ -313,7 +313,6 @@
_customClasses = [u customClasses];
_nibFilesOwner = [rootObjects objectAtIndex: 0];
_decoded = [u decoded];
// xibFontManager = [self _findFontManager: rootObjects];
//
// set the current class on the File's owner...
@ -336,7 +335,6 @@
// skip the file's owner, it is handled above...
if ((obj == _nibFilesOwner)
|| (obj == xibFirstResponder))
// || (obj == xibFontManager))
{
continue;
}
@ -383,7 +381,8 @@
customClassName = className;
}
}
// Handle custom classes
if ([rootObjects containsObject: obj] && obj != nil &&
[obj isKindOfClass: [GormWindowTemplate class]] == NO)
{
@ -432,7 +431,6 @@
id src = [o source];
NSDebugLog(@"Initial connector = %@", o);
NSDebugLog(@"dest = %@, src = %@", dest, src);
// Replace files owner with the document files owner for loading...

View file

@ -1,4 +1,6 @@
# Gorm
# apps-gorm
[![CI](https://github.com/gnustep/apps-gorm/actions/workflows/main.yml/badge.svg)](https://github.com/gnustep/apps-gorm/actions/workflows/main.yml?query=branch%3Amaster)
## Introduction

View file

@ -10,6 +10,6 @@ GNUSTEP_CORE_VERSION=0.30.0
# The version number of this release.
MAJOR_VERSION=1
MINOR_VERSION=3
SUBMINOR_VERSION=1
MINOR_VERSION=4
SUBMINOR_VERSION=0
VERSION=${MAJOR_VERSION}.${MINOR_VERSION}.${SUBMINOR_VERSION}