Revision: 12602 http://sourceforge.net/p/skim-app/code/12602 Author: hofman Date: 2021-12-03 23:15:00 +0000 (Fri, 03 Dec 2021) Log Message: ----------- Allow getting note preferences from note type as string
Modified Paths: -------------- trunk/SKNotePrefs.m Modified: trunk/SKNotePrefs.m =================================================================== --- trunk/SKNotePrefs.m 2021-12-03 17:49:37 UTC (rev 12601) +++ trunk/SKNotePrefs.m 2021-12-03 23:15:00 UTC (rev 12602) @@ -46,6 +46,7 @@ @synthesize type; @dynamic scriptingColor, scriptingInteriorColor, lineWidth, scriptingBorderStyle, dashPattern, scriptingStartLineStyle, scriptingEndLineStyle, fontName, fontSize, scriptingFontColor, scriptingAlignment, scriptingIconType, scriptingProperties; +static NSDictionary *alternateTypes = nil; static NSDictionary *colorKeys = nil; static NSDictionary *interiorColorKeys = nil; static NSDictionary *lineWidthKeys = nil; @@ -55,6 +56,7 @@ + (void)initialize { SKINITIALIZE; + alternateTypes = [[NSDictionary alloc] initWithObjectsAndKeys:SKNFreeTextString, @"text note", SKNNoteString, @"anchored note", SKNCircleString, @"circle note", SKNSquareString, @"square note", SKNHighlightString, @"highlight note", SKNUnderlineString, @"underline note", SKNStrikeOutString, @"strike out note", SKNLineString, @"line note", SKNInkString, @"freehand note", nil]; colorKeys = [[NSDictionary alloc] initWithObjectsAndKeys:SKFreeTextNoteColorKey, SKNFreeTextString, SKAnchoredNoteColorKey, SKNNoteString, SKCircleNoteColorKey, SKNCircleString, SKSquareNoteColorKey, SKNSquareString, SKHighlightNoteColorKey, SKNHighlightString, SKUnderlineNoteColorKey, SKNUnderlineString, SKStrikeOutNoteColorKey, SKNStrikeOutString, SKLineNoteColorKey, SKNLineString, SKInkNoteColorKey, SKNInkString, nil]; interiorColorKeys = [[NSDictionary alloc] initWithObjectsAndKeys:SKCircleNoteInteriorColorKey, SKNCircleString, SKSquareNoteInteriorColorKey, SKNSquareString, SKLineNoteInteriorColorKey, SKNLineString, nil]; lineWidthKeys = [[NSDictionary alloc] initWithObjectsAndKeys:SKFreeTextNoteLineWidthKey, SKNFreeTextString, SKCircleNoteLineWidthKey, SKNCircleString, SKSquareNoteLineWidthKey, SKNSquareString, SKLineNoteLineWidthKey, SKNLineString, SKInkNoteLineWidthKey, SKNInkString, nil]; @@ -80,7 +82,9 @@ } - (id)initWithType:(NSString *)aType { - if (aType == nil || [propertyKeys objectForKey:aType] == nil) { + if (aType && [propertyKeys objectForKey:aType] == nil) + aType = [alternateTypes objectForKey:aType]; + if (aType == nil) { [self release]; self = nil; } else { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. _______________________________________________ Skim-app-commit mailing list Skim-app-commit@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/skim-app-commit