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,10 +469,7 @@ 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"];
}
[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,19 +1,20 @@
/* 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
the Free Software Foundation, either version 3 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, see <http://www.gnu.org/licenses/>. */
@ -26,13 +27,16 @@
special exception, which will cause the skeleton and the resulting
Bison output files to be licensed under the GNU General Public
License without this special exception.
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,153 +44,140 @@
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 {
RTFtext = 258,
RTFstart = 259,
RTFansi = 260,
RTFmac = 261,
RTFpc = 262,
RTFpca = 263,
RTFignore = 264,
RTFinfo = 265,
RTFstylesheet = 266,
RTFfootnote = 267,
RTFheader = 268,
RTFfooter = 269,
RTFpict = 270,
RTFplain = 271,
RTFparagraph = 272,
RTFdefaultParagraph = 273,
RTFrow = 274,
RTFcell = 275,
RTFtabulator = 276,
RTFemdash = 277,
RTFendash = 278,
RTFemspace = 279,
RTFenspace = 280,
RTFbullet = 281,
RTFfield = 282,
RTFfldinst = 283,
RTFfldalt = 284,
RTFfldrslt = 285,
RTFflddirty = 286,
RTFfldedit = 287,
RTFfldlock = 288,
RTFfldpriv = 289,
RTFfttruetype = 290,
RTFlquote = 291,
RTFrquote = 292,
RTFldblquote = 293,
RTFrdblquote = 294,
RTFred = 295,
RTFgreen = 296,
RTFblue = 297,
RTFcolorbg = 298,
RTFcolorfg = 299,
RTFunderlinecolor = 300,
RTFcolortable = 301,
RTFfont = 302,
RTFfontSize = 303,
RTFNeXTGraphic = 304,
RTFNeXTGraphicWidth = 305,
RTFNeXTGraphicHeight = 306,
RTFNeXTHelpLink = 307,
RTFNeXTHelpMarker = 308,
RTFNeXTfilename = 309,
RTFNeXTmarkername = 310,
RTFNeXTlinkFilename = 311,
RTFNeXTlinkMarkername = 312,
RTFpaperWidth = 313,
RTFpaperHeight = 314,
RTFmarginLeft = 315,
RTFmarginRight = 316,
RTFmarginTop = 317,
RTFmarginButtom = 318,
RTFfirstLineIndent = 319,
RTFleftIndent = 320,
RTFrightIndent = 321,
RTFalignCenter = 322,
RTFalignJustified = 323,
RTFalignLeft = 324,
RTFalignRight = 325,
RTFlineSpace = 326,
RTFspaceAbove = 327,
RTFstyle = 328,
RTFbold = 329,
RTFitalic = 330,
RTFunderline = 331,
RTFunderlineDot = 332,
RTFunderlineDash = 333,
RTFunderlineDashDot = 334,
RTFunderlineDashDotDot = 335,
RTFunderlineDouble = 336,
RTFunderlineStop = 337,
RTFunderlineThick = 338,
RTFunderlineThickDot = 339,
RTFunderlineThickDash = 340,
RTFunderlineThickDashDot = 341,
RTFunderlineThickDashDotDot = 342,
RTFunderlineWord = 343,
RTFstrikethrough = 344,
RTFstrikethroughDouble = 345,
RTFunichar = 346,
RTFsubscript = 347,
RTFsuperscript = 348,
RTFtabstop = 349,
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
};
enum yytokentype
{
RTFtext = 258,
RTFstart = 259,
RTFansi = 260,
RTFmac = 261,
RTFpc = 262,
RTFpca = 263,
RTFignore = 264,
RTFinfo = 265,
RTFstylesheet = 266,
RTFfootnote = 267,
RTFheader = 268,
RTFfooter = 269,
RTFpict = 270,
RTFplain = 271,
RTFparagraph = 272,
RTFdefaultParagraph = 273,
RTFrow = 274,
RTFcell = 275,
RTFtabulator = 276,
RTFemdash = 277,
RTFendash = 278,
RTFemspace = 279,
RTFenspace = 280,
RTFbullet = 281,
RTFfield = 282,
RTFfldinst = 283,
RTFfldalt = 284,
RTFfldrslt = 285,
RTFflddirty = 286,
RTFfldedit = 287,
RTFfldlock = 288,
RTFfldpriv = 289,
RTFfttruetype = 290,
RTFlquote = 291,
RTFrquote = 292,
RTFldblquote = 293,
RTFrdblquote = 294,
RTFred = 295,
RTFgreen = 296,
RTFblue = 297,
RTFcolorbg = 298,
RTFcolorfg = 299,
RTFunderlinecolor = 300,
RTFcolortable = 301,
RTFfont = 302,
RTFfontSize = 303,
RTFNeXTGraphic = 304,
RTFNeXTGraphicWidth = 305,
RTFNeXTGraphicHeight = 306,
RTFNeXTHelpLink = 307,
RTFNeXTHelpMarker = 308,
RTFNeXTfilename = 309,
RTFNeXTmarkername = 310,
RTFNeXTlinkFilename = 311,
RTFNeXTlinkMarkername = 312,
RTFpaperWidth = 313,
RTFpaperHeight = 314,
RTFmarginLeft = 315,
RTFmarginRight = 316,
RTFmarginTop = 317,
RTFmarginButtom = 318,
RTFfirstLineIndent = 319,
RTFleftIndent = 320,
RTFrightIndent = 321,
RTFalignCenter = 322,
RTFalignJustified = 323,
RTFalignLeft = 324,
RTFalignRight = 325,
RTFlineSpace = 326,
RTFspaceAbove = 327,
RTFstyle = 328,
RTFbold = 329,
RTFitalic = 330,
RTFunderline = 331,
RTFunderlineDot = 332,
RTFunderlineDash = 333,
RTFunderlineDashDot = 334,
RTFunderlineDashDotDot = 335,
RTFunderlineDouble = 336,
RTFunderlineStop = 337,
RTFunderlineThick = 338,
RTFunderlineThickDot = 339,
RTFunderlineThickDash = 340,
RTFunderlineThickDashDot = 341,
RTFunderlineThickDashDotDot = 342,
RTFunderlineWord = 343,
RTFstrikethrough = 344,
RTFstrikethroughDouble = 345,
RTFunichar = 346,
RTFsubscript = 347,
RTFsuperscript = 348,
RTFtabstop = 349,
RTFfcharset = 350,
RTFfprq = 351,
RTFcpg = 352,
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)},