Merge from master and fix issue with window.

This commit is contained in:
Gregory John Casamento 2020-01-24 03:15:20 -05:00
commit 5591db7ce9
9 changed files with 1699 additions and 1763 deletions

View file

@ -1,3 +1,19 @@
2020-01-22 Fred Kiefer <FredKiefer@gmx.de>
* Source/GSXib5KeyedUnarchiver.m,
* Headers/Additions/GNUstepGUI/GSNibLoading.h,
* Source/GSXibLoading.m: Move toolbar ivar from NSWindowTemplate5
to NSWindowTemplate.
2020-01-22 Fred Kiefer <FredKiefer@gmx.de>
* TextConverters/RTF/rtfScanner.m: Add RTFansicpg.
* TextConverters/RTF/rtfGrammar.y: Handle encoding and code pages.
* TextConverters/RTF/rtfGrammar.tab.h,
* TextConverters/RTF/rtfGrammar.tab.m: Regenerated.
* TextConverters/RTF/RTFConsumerFunctions.h,
* TextConverters/RTF/RTFConsumer.m: Add code to handle encoding.
2020-01-20 Fred Kiefer <FredKiefer@gmx.de>
* Headers/AppKit/NSAppearance.h,

View file

@ -469,11 +469,8 @@ static BOOL _isInInterfaceBuilder = NO;
[aCoder encodeObject: _title forKey: @"NSWindowTitle"];
[aCoder encodeObject: _autosaveName forKey: @"NSFrameAutosaveName"];
[aCoder encodeBool: _visibleAtLaunch forKey: @"visibleAtLaunch"];
if (_toolbar != nil)
{
[aCoder encodeObject: _toolbar forKey: @"NSToolbar"];
}
}
}
/**
@ -532,6 +529,10 @@ static BOOL _isInInterfaceBuilder = NO;
// FIXME: No idea what is going on here
[_realObject setToolbar: (NSToolbar*)_viewClass];
}
if (_toolbar)
{
[_realObject setToolbar: _toolbar];
}
[_realObject setContentMinSize: _minSize];
[_realObject setContentMaxSize: _maxSize];

View file

@ -516,7 +516,7 @@ static NSArray *XmlBoolDefaultYes = nil;
// The parent of connections array element is the object ID we need...
GSXibElement *parent = [stack objectAtIndex: [stack count] - 1];
NSString *parentId = [parent attributeForKey: @"id"];
NSString *objKey = [@"IBActionConnection5" isEqualToString: [element attributeForKey: @"class"]] ?
NSString *objKey = [@"action" isEqualToString: [element attributeForKey: @"key"]] ?
@"destination" : @"source";
if (parentId == nil)

View file

@ -288,6 +288,7 @@ static BOOL classInheritsFromNSMutableAttributedString (Class c)
instruction: (NSString*)instruction;
- (void) appendImage: (NSString*) string;
- (void) reset;
- (void) setEncoding: (NSStringEncoding)anEncoding;
@end
@implementation RTFConsumer
@ -545,6 +546,11 @@ static BOOL classInheritsFromNSMutableAttributedString (Class c)
RELEASE(attr);
}
- (void) setEncoding: (NSStringEncoding)anEncoding
{
encoding = anEncoding;
}
- (RTFAttribute*) attr
{
return [attrs lastObject];
@ -571,7 +577,6 @@ static BOOL classInheritsFromNSMutableAttributedString (Class c)
CREATE_AUTORELEASE_POOL(pool);
RTFscannerCtxt scanner;
StringContext stringCtxt;
char buffer[5];
// We read in the first few characters to find out which
// encoding we have
@ -580,26 +585,6 @@ static BOOL classInheritsFromNSMutableAttributedString (Class c)
// Too short to be an RTF
return nil;
}
[rtfData getBytes: buffer range: NSMakeRange(7, 3)];
if (strncmp(buffer, "mac", 3) == 0)
{
encoding = NSMacOSRomanStringEncoding;
}
else if (strncmp(buffer, "pc", 2) == 0)
{
// FIXME: Code page 437 kCFStringEncodingDOSLatinUS
encoding = NSISOLatin1StringEncoding;
}
else if (strncmp(buffer, "pca", 3) == 0)
{
// FIXME: Code page 850 kCFStringEncodingDOSLatin1
encoding = NSISOLatin1StringEncoding;
}
else
{
encoding = NSISOLatin1StringEncoding;
}
// Reset this RFTConsumer, as it might already have been used!
_class = class;
@ -1403,3 +1388,42 @@ void GSRTFaddField (void *ctxt, int start, const char *inst)
[(RTFDConsumer *)ctxt appendField: start instruction: fieldInstruction];
DESTROY(fieldInstruction);
}
void GSRTFencoding(void *ctxt, int encoding)
{
switch (encoding)
{
case 1:
[(RTFDConsumer *)ctxt setEncoding: NSISOLatin1StringEncoding];
break;
case 2:
[(RTFDConsumer *)ctxt setEncoding: NSMacOSRomanStringEncoding];
break;
case 3:
// FIXME: Code page 437 kCFStringEncodingDOSLatinUS
[(RTFDConsumer *)ctxt setEncoding: NSISOLatin1StringEncoding];
break;
case 4:
// FIXME: Code page 850 kCFStringEncodingDOSLatin1
[(RTFDConsumer *)ctxt setEncoding: NSISOLatin1StringEncoding];
break;
case 1250:
[(RTFDConsumer *)ctxt setEncoding: NSWindowsCP1250StringEncoding];
break;
case 1251:
[(RTFDConsumer *)ctxt setEncoding: NSWindowsCP1251StringEncoding];
break;
case 1252:
[(RTFDConsumer *)ctxt setEncoding: NSWindowsCP1252StringEncoding];
break;
case 1253:
[(RTFDConsumer *)ctxt setEncoding: NSWindowsCP1253StringEncoding];
break;
case 1254:
[(RTFDConsumer *)ctxt setEncoding: NSWindowsCP1254StringEncoding];
break;
default:
NSLog(@"Setting unknown encoding %d", encoding);
break;
}
}

View file

@ -152,5 +152,8 @@ void GSRTFNeXTHelpMarker(void *ctxt, int num, const char *markername);
void GSRTFaddField (void *ctxt, int start, const char *inst);
/* set encoding */
void GSRTFencoding(void *ctxt, int encoding);
#endif

View file

@ -1,8 +1,9 @@
/* A Bison parser, made by GNU Bison 2.7. */
/* A Bison parser, made by GNU Bison 3.5. */
/* Bison interface for Yacc-like parsers in C
Copyright (C) 1984, 1989-1990, 2000-2012 Free Software Foundation, Inc.
Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2019 Free Software Foundation,
Inc.
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
@ -30,9 +31,12 @@
This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */
/* Undocumented macros, especially those whose name start with YY_,
are private implementation details. Do not rely on them. */
#ifndef YY_GSRTF_RTFGRAMMAR_TAB_H_INCLUDED
# define YY_GSRTF_RTFGRAMMAR_TAB_H_INCLUDED
/* Enabling traces. */
/* Debug traces. */
#ifndef YYDEBUG
# define YYDEBUG 0
#endif
@ -40,12 +44,11 @@
extern int GSRTFdebug;
#endif
/* Tokens. */
/* Token type. */
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
/* Put the tokens into the symbol table, so that GDB and other debuggers
know about them. */
enum yytokentype {
enum yytokentype
{
RTFtext = 258,
RTFstart = 259,
RTFansi = 260,
@ -141,52 +144,40 @@ extern int GSRTFdebug;
RTFfcharset = 350,
RTFfprq = 351,
RTFcpg = 352,
RTFOtherStatement = 353,
RTFfontListStart = 354,
RTFfamilyNil = 355,
RTFfamilyRoman = 356,
RTFfamilySwiss = 357,
RTFfamilyModern = 358,
RTFfamilyScript = 359,
RTFfamilyDecor = 360,
RTFfamilyTech = 361,
RTFfamilyBiDi = 362
RTFansicpg = 353,
RTFOtherStatement = 354,
RTFfontListStart = 355,
RTFfamilyNil = 356,
RTFfamilyRoman = 357,
RTFfamilySwiss = 358,
RTFfamilyModern = 359,
RTFfamilyScript = 360,
RTFfamilyDecor = 361,
RTFfamilyTech = 362,
RTFfamilyBiDi = 363
};
#endif
/* Value type. */
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef union YYSTYPE
union YYSTYPE
{
/* Line 2058 of yacc.c */
#line 85 "rtfGrammar.y"
#line 82 "rtfGrammar.y"
int number;
const char *text;
RTFcmd cmd;
#line 172 "rtfGrammar.tab.h"
/* Line 2058 of yacc.c */
#line 171 "rtfGrammar.tab.h"
} YYSTYPE;
};
typedef union YYSTYPE YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
#endif
#ifdef YYPARSE_PARAM
#if defined __STDC__ || defined __cplusplus
int GSRTFparse (void *YYPARSE_PARAM);
#else
int GSRTFparse ();
#endif
#else /* ! YYPARSE_PARAM */
#if defined __STDC__ || defined __cplusplus
int GSRTFparse (void *ctxt, void *lctxt);
#else
int GSRTFparse ();
#endif
#endif /* ! YYPARSE_PARAM */
#endif /* !YY_GSRTF_RTFGRAMMAR_TAB_H_INCLUDED */

File diff suppressed because it is too large Load diff

View file

@ -31,7 +31,7 @@
*/
/* we request for a reentrant parser */
%pure_parser
%define api.pure
%{
@ -60,10 +60,6 @@
/* this context is passed to the interface functions */
typedef void *GSRTFctxt;
// Two parameters are not supported by some bison versions. The declaration of
// yyparse in the .c file must be corrected to be able to compile it.
/*#define YYPARSE_PARAM ctxt, void *lctxt*/
#define YYLEX_PARAM lctxt
/*#undef YYLSP_NEEDED*/
#define CTXT ctxt
@ -81,6 +77,7 @@ int fieldStart = 0;
%parse-param {void *ctxt}
%parse-param {void *lctxt}
%lex-param {void *lctxt}
%union {
int number;
@ -184,6 +181,7 @@ int fieldStart = 0;
%token <cmd> RTFfcharset
%token <cmd> RTFfprq
%token <cmd> RTFcpg
%token <cmd> RTFansicpg
%token <cmd> RTFOtherStatement
%token RTFfontListStart
@ -209,11 +207,11 @@ int fieldStart = 0;
rtfFile: '{' { GSRTFstart(CTXT); } RTFstart rtfIngredients { GSRTFstop(CTXT); } '}'
;
/* FIXME: This should change the used encoding */
rtfCharset: RTFansi { $$ = 1; }
| RTFmac { $$ = 2; }
| RTFpc { $$ = 3; }
| RTFpca { $$ = 4; }
rtfCharset: RTFansi { GSRTFencoding(CTXT, 1); }
| RTFmac { GSRTFencoding(CTXT, 2); }
| RTFpc { GSRTFencoding(CTXT, $$ = 3); }
| RTFpca { GSRTFencoding(CTXT, 4); }
| rtfCharset RTFansicpg { GSRTFencoding(CTXT, $2.parameter); }
;
rtfIngredients: /* empty */

View file

@ -163,6 +163,7 @@ LexKeyword RTFcommands[] =
{"NeXTHelpLink",token(RTFNeXTHelpLink)},
{"NeXTHelpMarker",token(RTFNeXTHelpMarker)},
{"ansi", token(RTFansi)},
{"ansicpg", token(RTFansicpg)},
{"b", token(RTFbold)},
{"blue", token(RTFblue)},
{"bullet", token(RTFbullet)},