Changeset 685

Show
Ignore:
Timestamp:
08/28/07 15:08:12 (1 year ago)
Author:
astrange
Message:

Add a checkbox to disable external subtitle loading. (closes #242)
Clean up SSA font name handling.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/CPFPerianPrefPaneController.h

    r607 r685  
    7171    IBOutlet NSSlider                   *slider_ac3DynamicRangeSlider; 
    7272         
     73        IBOutlet NSButton                                       *button_loadExternalSubtitles; 
     74         
    7375        //About 
    7476        IBOutlet NSTextView                                     *textView_about; 
     
    9799- (IBAction)updateCheck:(id)sender; 
    98100- (IBAction)setAutoUpdateCheck:(id)sender; 
     101- (IBAction)setLoadExternalSubtitles:(id)sender; 
    99102 
    100103//AC3 Settings 
  • trunk/CPFPerianPrefPaneController.m

    r676 r685  
    66#define LastInstalledVersionKey CFSTR("LastInstalledVersion") 
    77#define AC3TwoChannelModeKey CFSTR("twoChannelMode") 
     8#define ExternalSubtitlesKey CFSTR("LoadExternalSubtitles") 
    89 
    910//Old 
     
    893894} 
    894895 
     896#pragma mark Subtitles 
     897- (IBAction)setLoadExternalSubtitles:(id)sender 
     898{        
     899        [self setKey:ExternalSubtitlesKey forAppID:perianAppID fromBool:(BOOL)[sender state]]; 
     900} 
     901 
    895902#pragma mark About  
    896903- (IBAction)launchWebsite:(id)sender  
  • trunk/PerianPrefPane.nib/classes.nib

    r574 r685  
    1414                setAC3DynamicRangeValue = id;  
    1515                setAutoUpdateCheck = id;  
     16                setLoadExternalSubtitles = id;  
    1617                updateCheck = id;  
    1718            };  
     
    2324                "button_forum" = NSButton;  
    2425                "button_install" = NSButton;  
     26                "button_loadExternalSubtitles" = NSButton;  
    2527                "button_updateCheck" = NSButton;  
    2628                "button_website" = NSButton;  
  • trunk/Subtitles/SubATSUIRenderer.m

    r675 r685  
    220220static ATSUFontID GetFontIDForSSAName(NSString *name, ATSFontRef *_fontRef) 
    221221{ 
    222         ATSFontRef fontRef = ATSFontFindFromName((CFStringRef)name,kATSOptionFlagsDefault); 
    223         ATSUFontID font = FMGetFontFromATSFontRef(fontRef); 
    224  
     222        ByteCount nlen = [name length]; 
     223        unichar *uname = (unichar*)[name cStringUsingEncoding:NSUnicodeStringEncoding]; 
     224         
     225        ATSFontRef fontRef; 
     226        ATSUFontID font; 
     227         
     228        ATSUFindFontFromName(uname, nlen * sizeof(unichar), kFontFamilyName, kFontNoPlatformCode, kFontNoScript, kFontNoLanguage, &font); 
     229         
    225230        if (font == kATSUInvalidFontID) { 
    226                 const char *utf8 = [name UTF8String]; 
    227                 ATSUFindFontFromName(utf8, strlen(utf8), kFontFamilyName, kFontNoPlatformCode, kFontNoScript, kFontNoLanguage, &font); 
    228  
    229                 if (font == kATSUInvalidFontID) ATSUFindFontFromName(utf8, strlen(utf8), 18, kFontNoPlatformCode, kFontNoScript, kFontNoLanguage, &font); 
     231                fontRef = ATSFontFindFromName((CFStringRef)name,kATSOptionFlagsDefault); 
     232                font = FMGetFontFromATSFontRef(fontRef); 
    230233                 
    231234                if (font == kATSUInvalidFontID) { 
    232235                        fontRef = ATSFontFindFromName((CFStringRef)@"Helvetica",kATSOptionFlagsDefault); 
    233236                        font = FMGetFontFromATSFontRef(fontRef); 
    234                 } else fontRef = FMGetATSFontRefFromFont(font); 
    235         } 
     237                } 
     238        } else fontRef = FMGetATSFontRefFromFont(font); 
    236239         
    237240        *_fontRef = fontRef; 
  • trunk/Subtitles/SubImport.mm

    r680 r685  
    339339} 
    340340 
     341static Boolean ShouldLoadExternalSubtitles() 
     342{ 
     343        Boolean isSet, value; 
     344         
     345        value = CFPreferencesGetAppBooleanValue(CFSTR("LoadExternalSubtitles"),CFSTR("org.perian.Perian"),&isSet); 
     346         
     347        return isSet ? value : YES; 
     348} 
     349 
    341350ComponentResult LoadExternalSubtitles(const FSRef *theFile, Movie theMovie) 
    342351{ 
     
    350359        ItemCount filesFound; 
    351360        Boolean containerChanged; 
     361         
     362        if (!ShouldLoadExternalSubtitles()) return noErr; 
    352363         
    353364        err = FSGetCatalogInfo(theFile, kFSCatInfoNone, NULL, &hfsFilename, NULL, &parentDir);