Fix bug 289549: don't use -alternateTitle to store the type of proprotional font, because it can be changed by localizers. Instead, get the font type from the region dictionary.

Also fix the updating of the proportional font labels when you change font type, and fix the project so that it knows that the strings file is UTF-16.
This commit is contained in:
smfr%smfr.org 2005-05-26 05:31:34 +00:00
Родитель 61182238f3
Коммит 789c075a6f
7 изменённых файлов: 52 добавлений и 34 удалений

Просмотреть файл

@ -13329,7 +13329,7 @@
sourceTree = "<group>";
};
F53849040349779901A80166 = {
fileEncoding = 30;
fileEncoding = 10;
isa = PBXFileReference;
lastKnownFileType = text.plist.strings;
name = Localizable.strings;

Просмотреть файл

@ -63,6 +63,7 @@
IBOutlet NSTextField* mFontSampleMonospace;
IBOutlet NSTextField* mProportionalSampleLabel;
IBOutlet NSTextField* mProportionalSubLabel;
IBOutlet NSButton* mFontsResetButton;

Просмотреть файл

@ -50,6 +50,9 @@
- (NSMutableDictionary *)makeDefaultFontTypeDictFromPrefsForRegion:(NSString*)regionCode;
- (NSMutableDictionary *)makeFontSizesDictFromPrefsForRegion:(NSString*)regionCode;
- (NSMutableDictionary*)settingsForCurrentRegion;
- (NSString*)defaultProportionalFontTypeForCurrentRegion;
- (void)saveFontNamePrefsForRegion:(NSDictionary*)regionDict forFontType:(NSString*)fontType;
- (void)saveDefaultFontTypePrefForRegion:(NSDictionary*)entryDict;
- (void)saveFontSizePrefsForRegion:(NSDictionary*)entryDict;
@ -206,7 +209,10 @@
- (IBAction)proportionalFontChoiceButtonClicked:(id)sender
{
NSFontManager *fontManager = [NSFontManager sharedFontManager];
NSFont *newFont = [[self getFontSampleForType:[mChooseProportionalFontButton alternateTitle]] font];
NSString* defaultFontType = [self defaultProportionalFontTypeForCurrentRegion];
NSFont *newFont = [[self getFontSampleForType:defaultFontType] font];
mFontButtonForEditor = mChooseProportionalFontButton;
[fontManager setSelectedFont:newFont isMultiple:NO];
[[fontManager fontPanel:YES] makeKeyAndOrderFront:self];
@ -215,7 +221,7 @@
- (IBAction)monospaceFontChoiceButtonClicked:(id)sender
{
NSFontManager *fontManager = [NSFontManager sharedFontManager];
NSFont *newFont = [[self getFontSampleForType:[mChooseMonospaceFontButton alternateTitle]] font];
NSFont *newFont = [[self getFontSampleForType:@"monospace"] font];
mFontButtonForEditor = mChooseMonospaceFontButton;
[fontManager setSelectedFont:newFont isMultiple:NO];
[[fontManager fontPanel:YES] makeKeyAndOrderFront:self];
@ -374,6 +380,21 @@
return fontDict;
}
- (NSMutableDictionary*)settingsForCurrentRegion
{
int selectedRegion = [mFontRegionPopup indexOfSelectedItem];
if (selectedRegion == -1)
return nil;
return [mRegionMappingTable objectAtIndex:selectedRegion];
}
- (NSString*)defaultProportionalFontTypeForCurrentRegion
{
NSDictionary* regionDict = [self settingsForCurrentRegion];
return [[regionDict objectForKey:@"defaultFontType"] objectForKey:@"type"];
}
- (void)saveFontNamePrefsForRegion:(NSDictionary*)regionDict forFontType:(NSString*)fontType
{
NSString *regionCode = [regionDict objectForKey:@"code"];
@ -548,11 +569,8 @@
- (void)updateFontSampleOfType:(NSString *)fontType
{
int selectedRegion = [mFontRegionPopup indexOfSelectedItem];
if (selectedRegion == -1)
return;
NSMutableDictionary *regionDict = [mRegionMappingTable objectAtIndex:selectedRegion];
NSMutableDictionary* regionDict = [self settingsForCurrentRegion];
if (!regionDict) return;
NSTextField *sampleCell = [self getFontSampleForType:fontType];
NSFont *sampleFont = [[NSFontManager sharedFontManager] convertFont:[sampleCell font]];
@ -584,19 +602,17 @@
- (void)updateFontPreviews
{
int selectedRegion = [mFontRegionPopup indexOfSelectedItem];
if (selectedRegion == -1)
return;
NSDictionary *regionDict = [mRegionMappingTable objectAtIndex:selectedRegion];
NSString *defaultFontType = [[regionDict objectForKey:@"defaultFontType"] objectForKey:@"type"];
[mChooseProportionalFontButton setAlternateTitle:defaultFontType];
NSDictionary* regionDict = [self settingsForCurrentRegion];
if (!regionDict) return;
NSString* defaultFontType = [self defaultProportionalFontTypeForCurrentRegion];
// make sure the 'proportional' label matches
NSString* propLabelString = [NSString stringWithFormat:[self getLocalizedString:@"ProportionalLableFormat"], [self getLocalizedString:defaultFontType]];
NSString* propLabelString = [NSString stringWithFormat:[self getLocalizedString:@"ProportionalLabelFormat"], [self getLocalizedString:defaultFontType]];
[mProportionalSampleLabel setStringValue:propLabelString];
NSString* sublabelValue = [self getLocalizedString:[defaultFontType stringByAppendingString:@"_note"]];
[mProportionalSubLabel setStringValue:sublabelValue];
[self setupFontSamplesFromDict:regionDict];
}
@ -607,11 +623,8 @@ const int kDefaultFontSansSerifTag = 1;
- (IBAction)showAdvancedFontsDialog:(id)sender
{
int selectedRegion = [mFontRegionPopup indexOfSelectedItem];
if (selectedRegion == -1)
return;
NSDictionary *regionDict = [mRegionMappingTable objectAtIndex:selectedRegion];
NSDictionary* regionDict = [self settingsForCurrentRegion];
if (!regionDict) return;
NSString* advancedLabel = [NSString stringWithFormat:[self getLocalizedString:@"AdditionalFontsLabelFormat"], [regionDict objectForKey:@"region"]];
[mAdvancedFontsLabel setStringValue:advancedLabel];
@ -634,7 +647,7 @@ const int kDefaultFontSansSerifTag = 1;
[mMinFontSizePopup selectItemAtIndex:itemIndex];
// set up default font radio buttons (default to serif)
NSString *defaultFontType = [[regionDict objectForKey:@"defaultFontType"] objectForKey:@"type"];
NSString* defaultFontType = [self defaultProportionalFontTypeForCurrentRegion];
[mDefaultFontMatrix selectCellWithTag:([defaultFontType isEqualToString:@"sans-serif"] ? kDefaultFontSansSerifTag : kDefaultFontSerifTag)];
[NSApp beginSheet:mAdvancedFontsDialog
@ -647,11 +660,8 @@ const int kDefaultFontSansSerifTag = 1;
- (IBAction)advancedFontsDone:(id)sender
{
// save settings
int selectedRegion = [mFontRegionPopup indexOfSelectedItem];
if (selectedRegion == -1)
return;
NSDictionary *regionDict = [mRegionMappingTable objectAtIndex:selectedRegion];
NSDictionary* regionDict = [self settingsForCurrentRegion];
if (!regionDict) return;
[self getFontFromPopup:mSerifFontPopup forType:@"serif" intoDict:regionDict];
[self getFontFromPopup:mSansSerifFontPopup forType:@"sans-serif" intoDict:regionDict];
@ -664,8 +674,8 @@ const int kDefaultFontSansSerifTag = 1;
[fontSizeDict setObject:[NSNumber numberWithInt:(int)minSize] forKey:@"minimum"];
// save the default font type
NSDictionary *defaultFontTypeDict = [regionDict objectForKey:@"defaultFontType"];
NSString *defaultFontType = ([[mDefaultFontMatrix selectedCell] tag] == kDefaultFontSerifTag) ? @"serif" : @"sans-serif";
NSMutableDictionary* defaultFontTypeDict = [regionDict objectForKey:@"defaultFontType"];
NSString* defaultFontType = ([[mDefaultFontMatrix selectedCell] tag] == kDefaultFontSerifTag) ? @"serif" : @"sans-serif";
[defaultFontTypeDict setObject:defaultFontType forKey:@"type"];
[mAdvancedFontsDialog orderOut:self];
@ -866,10 +876,16 @@ const int kMissingFontPopupItemTag = 9999;
- (void)changeFont:(id)sender
{
if (mFontButtonForEditor) {
NSString *fontType = [mFontButtonForEditor alternateTitle];
if (mFontButtonForEditor == mChooseProportionalFontButton)
{
NSString* fontType = [self defaultProportionalFontTypeForCurrentRegion];
[self updateFontSampleOfType:fontType];
}
else if (mFontButtonForEditor == mChooseMonospaceFontButton)
{
[self updateFontSampleOfType:@"monospace"];
}
}
- (BOOL)fontManager:(id)theFontManager willIncludeFont:(NSString *)fontName

Просмотреть файл

@ -49,6 +49,7 @@
mFontsResetButton = NSButton;
mMinFontSizePopup = NSPopUpButton;
mProportionalSampleLabel = NSTextField;
mProportionalSubLabel = NSTextField;
mSansSerifFontPopup = NSPopUpButton;
mSerifFontPopup = NSPopUpButton;
mTabView = NSTabView;

Просмотреть файл

@ -3,7 +3,7 @@
<plist version="1.0">
<dict>
<key>IBDocumentLocation</key>
<string>656 44 458 263 0 0 1600 1002 </string>
<string>110 65 458 263 0 0 1600 1002 </string>
<key>IBEditorPositions</key>
<dict>
<key>214</key>
@ -12,6 +12,6 @@
<key>IBFramework Version</key>
<string>364.0</string>
<key>IBSystem Version</key>
<string>7U16</string>
<string>7W98</string>
</dict>
</plist>

Двоичные данные
camino/PreferencePanes/Appearance/English.lproj/Appearance.nib/keyedobjects.nib сгенерированный

Двоичный файл не отображается.

Двоичный файл не отображается.