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> 2020-01-20 Fred Kiefer <FredKiefer@gmx.de>
* Headers/AppKit/NSAppearance.h, * Headers/AppKit/NSAppearance.h,

View file

@ -469,10 +469,7 @@ static BOOL _isInInterfaceBuilder = NO;
[aCoder encodeObject: _title forKey: @"NSWindowTitle"]; [aCoder encodeObject: _title forKey: @"NSWindowTitle"];
[aCoder encodeObject: _autosaveName forKey: @"NSFrameAutosaveName"]; [aCoder encodeObject: _autosaveName forKey: @"NSFrameAutosaveName"];
[aCoder encodeBool: _visibleAtLaunch forKey: @"visibleAtLaunch"]; [aCoder encodeBool: _visibleAtLaunch forKey: @"visibleAtLaunch"];
if (_toolbar != nil) [aCoder encodeObject: _toolbar forKey: @"NSToolbar"];
{
[aCoder encodeObject: _toolbar forKey: @"NSToolbar"];
}
} }
} }
@ -532,6 +529,10 @@ static BOOL _isInInterfaceBuilder = NO;
// FIXME: No idea what is going on here // FIXME: No idea what is going on here
[_realObject setToolbar: (NSToolbar*)_viewClass]; [_realObject setToolbar: (NSToolbar*)_viewClass];
} }
if (_toolbar)
{
[_realObject setToolbar: _toolbar];
}
[_realObject setContentMinSize: _minSize]; [_realObject setContentMinSize: _minSize];
[_realObject setContentMaxSize: _maxSize]; [_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... // The parent of connections array element is the object ID we need...
GSXibElement *parent = [stack objectAtIndex: [stack count] - 1]; GSXibElement *parent = [stack objectAtIndex: [stack count] - 1];
NSString *parentId = [parent attributeForKey: @"id"]; NSString *parentId = [parent attributeForKey: @"id"];
NSString *objKey = [@"IBActionConnection5" isEqualToString: [element attributeForKey: @"class"]] ? NSString *objKey = [@"action" isEqualToString: [element attributeForKey: @"key"]] ?
@"destination" : @"source"; @"destination" : @"source";
if (parentId == nil) if (parentId == nil)

View file

@ -288,6 +288,7 @@ static BOOL classInheritsFromNSMutableAttributedString (Class c)
instruction: (NSString*)instruction; instruction: (NSString*)instruction;
- (void) appendImage: (NSString*) string; - (void) appendImage: (NSString*) string;
- (void) reset; - (void) reset;
- (void) setEncoding: (NSStringEncoding)anEncoding;
@end @end
@implementation RTFConsumer @implementation RTFConsumer
@ -545,6 +546,11 @@ static BOOL classInheritsFromNSMutableAttributedString (Class c)
RELEASE(attr); RELEASE(attr);
} }
- (void) setEncoding: (NSStringEncoding)anEncoding
{
encoding = anEncoding;
}
- (RTFAttribute*) attr - (RTFAttribute*) attr
{ {
return [attrs lastObject]; return [attrs lastObject];
@ -571,7 +577,6 @@ static BOOL classInheritsFromNSMutableAttributedString (Class c)
CREATE_AUTORELEASE_POOL(pool); CREATE_AUTORELEASE_POOL(pool);
RTFscannerCtxt scanner; RTFscannerCtxt scanner;
StringContext stringCtxt; StringContext stringCtxt;
char buffer[5];
// We read in the first few characters to find out which // We read in the first few characters to find out which
// encoding we have // encoding we have
@ -580,26 +585,6 @@ static BOOL classInheritsFromNSMutableAttributedString (Class c)
// Too short to be an RTF // Too short to be an RTF
return nil; 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! // Reset this RFTConsumer, as it might already have been used!
_class = class; _class = class;
@ -1403,3 +1388,42 @@ void GSRTFaddField (void *ctxt, int start, const char *inst)
[(RTFDConsumer *)ctxt appendField: start instruction: fieldInstruction]; [(RTFDConsumer *)ctxt appendField: start instruction: fieldInstruction];
DESTROY(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); void GSRTFaddField (void *ctxt, int start, const char *inst);
/* set encoding */
void GSRTFencoding(void *ctxt, int encoding);
#endif #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 /* 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 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 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 This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */ 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 #ifndef YY_GSRTF_RTFGRAMMAR_TAB_H_INCLUDED
# define YY_GSRTF_RTFGRAMMAR_TAB_H_INCLUDED # define YY_GSRTF_RTFGRAMMAR_TAB_H_INCLUDED
/* Enabling traces. */ /* Debug traces. */
#ifndef YYDEBUG #ifndef YYDEBUG
# define YYDEBUG 0 # define YYDEBUG 0
#endif #endif
@ -40,153 +44,140 @@
extern int GSRTFdebug; extern int GSRTFdebug;
#endif #endif
/* Tokens. */ /* Token type. */
#ifndef YYTOKENTYPE #ifndef YYTOKENTYPE
# define YYTOKENTYPE # define YYTOKENTYPE
/* Put the tokens into the symbol table, so that GDB and other debuggers enum yytokentype
know about them. */ {
enum yytokentype { RTFtext = 258,
RTFtext = 258, RTFstart = 259,
RTFstart = 259, RTFansi = 260,
RTFansi = 260, RTFmac = 261,
RTFmac = 261, RTFpc = 262,
RTFpc = 262, RTFpca = 263,
RTFpca = 263, RTFignore = 264,
RTFignore = 264, RTFinfo = 265,
RTFinfo = 265, RTFstylesheet = 266,
RTFstylesheet = 266, RTFfootnote = 267,
RTFfootnote = 267, RTFheader = 268,
RTFheader = 268, RTFfooter = 269,
RTFfooter = 269, RTFpict = 270,
RTFpict = 270, RTFplain = 271,
RTFplain = 271, RTFparagraph = 272,
RTFparagraph = 272, RTFdefaultParagraph = 273,
RTFdefaultParagraph = 273, RTFrow = 274,
RTFrow = 274, RTFcell = 275,
RTFcell = 275, RTFtabulator = 276,
RTFtabulator = 276, RTFemdash = 277,
RTFemdash = 277, RTFendash = 278,
RTFendash = 278, RTFemspace = 279,
RTFemspace = 279, RTFenspace = 280,
RTFenspace = 280, RTFbullet = 281,
RTFbullet = 281, RTFfield = 282,
RTFfield = 282, RTFfldinst = 283,
RTFfldinst = 283, RTFfldalt = 284,
RTFfldalt = 284, RTFfldrslt = 285,
RTFfldrslt = 285, RTFflddirty = 286,
RTFflddirty = 286, RTFfldedit = 287,
RTFfldedit = 287, RTFfldlock = 288,
RTFfldlock = 288, RTFfldpriv = 289,
RTFfldpriv = 289, RTFfttruetype = 290,
RTFfttruetype = 290, RTFlquote = 291,
RTFlquote = 291, RTFrquote = 292,
RTFrquote = 292, RTFldblquote = 293,
RTFldblquote = 293, RTFrdblquote = 294,
RTFrdblquote = 294, RTFred = 295,
RTFred = 295, RTFgreen = 296,
RTFgreen = 296, RTFblue = 297,
RTFblue = 297, RTFcolorbg = 298,
RTFcolorbg = 298, RTFcolorfg = 299,
RTFcolorfg = 299, RTFunderlinecolor = 300,
RTFunderlinecolor = 300, RTFcolortable = 301,
RTFcolortable = 301, RTFfont = 302,
RTFfont = 302, RTFfontSize = 303,
RTFfontSize = 303, RTFNeXTGraphic = 304,
RTFNeXTGraphic = 304, RTFNeXTGraphicWidth = 305,
RTFNeXTGraphicWidth = 305, RTFNeXTGraphicHeight = 306,
RTFNeXTGraphicHeight = 306, RTFNeXTHelpLink = 307,
RTFNeXTHelpLink = 307, RTFNeXTHelpMarker = 308,
RTFNeXTHelpMarker = 308, RTFNeXTfilename = 309,
RTFNeXTfilename = 309, RTFNeXTmarkername = 310,
RTFNeXTmarkername = 310, RTFNeXTlinkFilename = 311,
RTFNeXTlinkFilename = 311, RTFNeXTlinkMarkername = 312,
RTFNeXTlinkMarkername = 312, RTFpaperWidth = 313,
RTFpaperWidth = 313, RTFpaperHeight = 314,
RTFpaperHeight = 314, RTFmarginLeft = 315,
RTFmarginLeft = 315, RTFmarginRight = 316,
RTFmarginRight = 316, RTFmarginTop = 317,
RTFmarginTop = 317, RTFmarginButtom = 318,
RTFmarginButtom = 318, RTFfirstLineIndent = 319,
RTFfirstLineIndent = 319, RTFleftIndent = 320,
RTFleftIndent = 320, RTFrightIndent = 321,
RTFrightIndent = 321, RTFalignCenter = 322,
RTFalignCenter = 322, RTFalignJustified = 323,
RTFalignJustified = 323, RTFalignLeft = 324,
RTFalignLeft = 324, RTFalignRight = 325,
RTFalignRight = 325, RTFlineSpace = 326,
RTFlineSpace = 326, RTFspaceAbove = 327,
RTFspaceAbove = 327, RTFstyle = 328,
RTFstyle = 328, RTFbold = 329,
RTFbold = 329, RTFitalic = 330,
RTFitalic = 330, RTFunderline = 331,
RTFunderline = 331, RTFunderlineDot = 332,
RTFunderlineDot = 332, RTFunderlineDash = 333,
RTFunderlineDash = 333, RTFunderlineDashDot = 334,
RTFunderlineDashDot = 334, RTFunderlineDashDotDot = 335,
RTFunderlineDashDotDot = 335, RTFunderlineDouble = 336,
RTFunderlineDouble = 336, RTFunderlineStop = 337,
RTFunderlineStop = 337, RTFunderlineThick = 338,
RTFunderlineThick = 338, RTFunderlineThickDot = 339,
RTFunderlineThickDot = 339, RTFunderlineThickDash = 340,
RTFunderlineThickDash = 340, RTFunderlineThickDashDot = 341,
RTFunderlineThickDashDot = 341, RTFunderlineThickDashDotDot = 342,
RTFunderlineThickDashDotDot = 342, RTFunderlineWord = 343,
RTFunderlineWord = 343, RTFstrikethrough = 344,
RTFstrikethrough = 344, RTFstrikethroughDouble = 345,
RTFstrikethroughDouble = 345, RTFunichar = 346,
RTFunichar = 346, RTFsubscript = 347,
RTFsubscript = 347, RTFsuperscript = 348,
RTFsuperscript = 348, RTFtabstop = 349,
RTFtabstop = 349, RTFfcharset = 350,
RTFfcharset = 350, RTFfprq = 351,
RTFfprq = 351, RTFcpg = 352,
RTFcpg = 352, RTFansicpg = 353,
RTFOtherStatement = 353, RTFOtherStatement = 354,
RTFfontListStart = 354, RTFfontListStart = 355,
RTFfamilyNil = 355, RTFfamilyNil = 356,
RTFfamilyRoman = 356, RTFfamilyRoman = 357,
RTFfamilySwiss = 357, RTFfamilySwiss = 358,
RTFfamilyModern = 358, RTFfamilyModern = 359,
RTFfamilyScript = 359, RTFfamilyScript = 360,
RTFfamilyDecor = 360, RTFfamilyDecor = 361,
RTFfamilyTech = 361, RTFfamilyTech = 362,
RTFfamilyBiDi = 362 RTFfamilyBiDi = 363
}; };
#endif #endif
/* Value type. */
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef union YYSTYPE union YYSTYPE
{ {
/* Line 2058 of yacc.c */ #line 82 "rtfGrammar.y"
#line 85 "rtfGrammar.y"
int number; int number;
const char *text; const char *text;
RTFcmd cmd; RTFcmd cmd;
#line 172 "rtfGrammar.tab.h"
/* Line 2058 of yacc.c */ };
#line 171 "rtfGrammar.tab.h" typedef union YYSTYPE YYSTYPE;
} YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1 # define YYSTYPE_IS_TRIVIAL 1
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1 # define YYSTYPE_IS_DECLARED 1
#endif #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); int GSRTFparse (void *ctxt, void *lctxt);
#else
int GSRTFparse ();
#endif
#endif /* ! YYPARSE_PARAM */
#endif /* !YY_GSRTF_RTFGRAMMAR_TAB_H_INCLUDED */ #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 */ /* we request for a reentrant parser */
%pure_parser %define api.pure
%{ %{
@ -60,10 +60,6 @@
/* this context is passed to the interface functions */ /* this context is passed to the interface functions */
typedef void *GSRTFctxt; 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*/ /*#undef YYLSP_NEEDED*/
#define CTXT ctxt #define CTXT ctxt
@ -81,6 +77,7 @@ int fieldStart = 0;
%parse-param {void *ctxt} %parse-param {void *ctxt}
%parse-param {void *lctxt} %parse-param {void *lctxt}
%lex-param {void *lctxt}
%union { %union {
int number; int number;
@ -184,6 +181,7 @@ int fieldStart = 0;
%token <cmd> RTFfcharset %token <cmd> RTFfcharset
%token <cmd> RTFfprq %token <cmd> RTFfprq
%token <cmd> RTFcpg %token <cmd> RTFcpg
%token <cmd> RTFansicpg
%token <cmd> RTFOtherStatement %token <cmd> RTFOtherStatement
%token RTFfontListStart %token RTFfontListStart
@ -209,11 +207,11 @@ int fieldStart = 0;
rtfFile: '{' { GSRTFstart(CTXT); } RTFstart rtfIngredients { GSRTFstop(CTXT); } '}' rtfFile: '{' { GSRTFstart(CTXT); } RTFstart rtfIngredients { GSRTFstop(CTXT); } '}'
; ;
/* FIXME: This should change the used encoding */ rtfCharset: RTFansi { GSRTFencoding(CTXT, 1); }
rtfCharset: RTFansi { $$ = 1; } | RTFmac { GSRTFencoding(CTXT, 2); }
| RTFmac { $$ = 2; } | RTFpc { GSRTFencoding(CTXT, $$ = 3); }
| RTFpc { $$ = 3; } | RTFpca { GSRTFencoding(CTXT, 4); }
| RTFpca { $$ = 4; } | rtfCharset RTFansicpg { GSRTFencoding(CTXT, $2.parameter); }
; ;
rtfIngredients: /* empty */ rtfIngredients: /* empty */

View file

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