diff --git a/mozilla/camino/PreferencePanes/Appearance/Appearance.h b/mozilla/camino/PreferencePanes/Appearance/Appearance.h index 660d389b5dd..e7bdbd42d38 100644 --- a/mozilla/camino/PreferencePanes/Appearance/Appearance.h +++ b/mozilla/camino/PreferencePanes/Appearance/Appearance.h @@ -62,16 +62,12 @@ IBOutlet NSTextField* mFontSampleMonospace; IBOutlet NSTextField* mProportionalSampleLabel; - IBOutlet NSTextField* mProportionalSubLabel; + IBOutlet NSPopUpButton* mMinFontSizePopup; + IBOutlet NSMatrix* mDefaultFontMatrix; IBOutlet NSButton* mUseMyFontsCheckbox; - // advanced panel stuff - IBOutlet NSPanel* mAdvancedFontsDialog; - IBOutlet NSPopUpButton* mMinFontSizePopup; - IBOutlet NSTextField* mAdvancedFontsLabel; - - IBOutlet NSMatrix* mDefaultFontMatrix; + IBOutlet NSView* mPreviousBottomControl; NSArray* mRegionMappingTable; @@ -93,8 +89,8 @@ - (IBAction)monospaceFontChoiceButtonClicked:(id)sender; - (IBAction)fontRegionPopupClicked:(id)sender; -- (IBAction)showAdvancedFontsDialog:(id)sender; -- (IBAction)advancedFontsDone:(id)sender; +- (IBAction)minFontSizePopupClicked:(id)sender; +- (IBAction)defaultFontTypeClicked:(id)sender; - (IBAction)resetToDefaults:(id)sender; diff --git a/mozilla/camino/PreferencePanes/Appearance/Appearance.mm b/mozilla/camino/PreferencePanes/Appearance/Appearance.mm index a0fa2a5a8e0..8e75c4e9089 100644 --- a/mozilla/camino/PreferencePanes/Appearance/Appearance.mm +++ b/mozilla/camino/PreferencePanes/Appearance/Appearance.mm @@ -71,6 +71,7 @@ - (void)setFontSampleOfType:(NSString*)fontType withFont:(NSFont*)font andDict:(NSDictionary*)regionDict; - (void)saveFont:(NSFont*)font toDict:(NSMutableDictionary*)regionDict forType:(NSString*)fontType; +- (void)updateAdvancedFontControls; - (void)updateFontSampleOfType:(NSString*)fontType; - (NSTextField*)fontSampleForType:(NSString*)fontType; - (NSString*)fontSizeType:(NSString*)fontType; @@ -130,13 +131,6 @@ [super dealloc]; } -- (id)initWithBundle:(NSBundle*)bundle -{ - self = [super initWithBundle:bundle]; - mFontButtonForEditor = nil; - return self; -} - - (void)mainViewDidLoad { // should save and restore this @@ -162,6 +156,7 @@ [self loadFontPrefs]; [self updateFontPreviews]; + [self updateAdvancedFontControls]; } - (void)didUnselect @@ -170,8 +165,28 @@ [self saveFontPrefs]; } +// The colors and fonts tab views are different heights. We need to resize +// the window when each is selected so the spacing looks correct. - (void)tabView:(NSTabView*)tabView didSelectTabViewItem:(NSTabViewItem*)tabViewItem { + NSControl* bottomControl = nil; + if ([[tabViewItem identifier] isEqualToString:@"colors"]) + bottomControl = mUseMyColorsCheckbox; + else if ([[tabViewItem identifier] isEqualToString:@"fonts"]) + bottomControl = mUseMyFontsCheckbox; + + if (bottomControl && bottomControl != mPreviousBottomControl) { + NSWindow* prefsWindow = [mTabView window]; + float heightChange = [mPreviousBottomControl frame].origin.y - + [bottomControl frame].origin.y; + + NSRect windowFrame = [prefsWindow frame]; + windowFrame.size.height += heightChange; + windowFrame.origin.y -= heightChange; + [prefsWindow setFrame:windowFrame display:YES animate:[prefsWindow isVisible]]; + + mPreviousBottomControl = bottomControl; + } } - (void)setupFontRegionPopup @@ -248,6 +263,7 @@ { // save the old values [self updateFontPreviews]; + [self updateAdvancedFontControls]; } - (void)loadFontPrefs @@ -656,15 +672,6 @@ NSString* propLabelString = [NSString stringWithFormat:[self localizedStringForKey:@"ProportionalLabelFormat"], [self localizedStringForKey:defaultFontType]]; [mProportionalSampleLabel setStringValue:propLabelString]; - - NSString* sublabelValue = [self localizedStringForKey:[defaultFontType stringByAppendingString:@"_note"]]; - [mProportionalSubLabel setStringValue:sublabelValue]; - - NSString* noteFontExample = [defaultFontType isEqualToString:@"serif"] ? @"Times" : @"Helvetica"; - [mProportionalSubLabel setFont:[[NSFontManager sharedFontManager] fontWithFamily:noteFontExample - traits:0 - weight:5 /* normal weight */ - size:[[mProportionalSubLabel font] pointSize]]]; [self setupFontSamplesFromDict:regionDict]; } @@ -674,15 +681,11 @@ const int kDefaultFontSerifTag = 0; const int kDefaultFontSansSerifTag = 1; -- (IBAction)showAdvancedFontsDialog:(id)sender +- (void)updateAdvancedFontControls { NSDictionary* regionDict = [self settingsForCurrentRegion]; if (!regionDict) return; - NSString* advancedLabel = [NSString stringWithFormat:[self localizedStringForKey:@"AdditionalFontsLabelFormat"], - [regionDict objectForKey:@"region"]]; - [mAdvancedFontsLabel setStringValue:advancedLabel]; - // set up min size popup int itemIndex = 0; NSMutableDictionary* fontSizeDict = [regionDict objectForKey:@"fontsize"]; @@ -693,24 +696,14 @@ const int kDefaultFontSansSerifTag = 1; itemIndex = 0; } [mMinFontSizePopup selectItemAtIndex:itemIndex]; - + // set up default font radio buttons (default to serif) NSString* defaultFontType = [self defaultProportionalFontTypeForCurrentRegion]; [mDefaultFontMatrix selectCellWithTag:([defaultFontType isEqualToString:@"sans-serif"] ? kDefaultFontSansSerifTag : kDefaultFontSerifTag)]; - - mFontPanelWasVisible = [[NSFontPanel sharedFontPanel] isVisible]; - [[NSFontPanel sharedFontPanel] orderOut:nil]; - - [NSApp beginSheet:mAdvancedFontsDialog - modalForWindow:[mTabView window] // any old window accessor - modalDelegate:self - didEndSelector:@selector(advancedFontsSheetDidEnd:returnCode:contextInfo:) - contextInfo:NULL]; } -- (IBAction)advancedFontsDone:(id)sender +- (IBAction)minFontSizePopupClicked:(id)sender { - // save settings NSDictionary* regionDict = [self settingsForCurrentRegion]; if (!regionDict) return; @@ -719,21 +712,21 @@ const int kDefaultFontSansSerifTag = 1; NSMutableDictionary* fontSizeDict = [regionDict objectForKey:@"fontsize"]; [fontSizeDict setObject:[NSNumber numberWithInt:(int)minSize] forKey:@"minimum"]; - // Save the default font type. + [self saveFontSizePrefsForRegion:regionDict]; + [self updateFontPreviews]; +} + +- (IBAction)defaultFontTypeClicked:(id)sender +{ + NSDictionary* regionDict = [self settingsForCurrentRegion]; + if (!regionDict) return; + NSMutableDictionary* defaultFontTypeDict = [regionDict objectForKey:@"defaultFontType"]; NSString* defaultFontType = ([[mDefaultFontMatrix selectedCell] tag] == kDefaultFontSerifTag) ? @"serif" : @"sans-serif"; [defaultFontTypeDict setObject:defaultFontType forKey:@"type"]; - - [mAdvancedFontsDialog orderOut:self]; - [NSApp endSheet:mAdvancedFontsDialog]; - - // Apply the changes for the current region. - [self saveAllFontPrefsForRegion:regionDict]; + [self saveDefaultFontTypePrefForRegion:regionDict]; [self updateFontPreviews]; - - if (mFontPanelWasVisible) - [[NSFontPanel sharedFontPanel] makeKeyAndOrderFront:self]; } - (IBAction)resetToDefaults:(id)sender { @@ -798,13 +791,10 @@ const int kDefaultFontSansSerifTag = 1; // Update the UI. Order is important here -- syncing the font panel depends on the // font previews being correct. [self updateFontPreviews]; + [self updateAdvancedFontControls]; [mUseMyFontsCheckbox setState:[self useMyFontsPref]]; } -- (void)advancedFontsSheetDidEnd:(NSWindow*)sheet returnCode:(int)returnCode contextInfo:(void*)contextInfo -{ -} - @end @implementation OrgMozillaCaminoPreferenceAppearance (FontManagerDelegate) @@ -839,10 +829,6 @@ const int kDefaultFontSansSerifTag = 1; - (void)changeFont:(id)sender { - // Ignore font panel changes if the advanced panel is up. - if ([mAdvancedFontsDialog isVisible]) - return; - NSDictionary* regionDict = [self settingsForCurrentRegion]; if (mFontButtonForEditor == mChooseProportionalFontButton) { diff --git a/mozilla/camino/PreferencePanes/Appearance/English.lproj/Appearance.nib/classes.nib b/mozilla/camino/PreferencePanes/Appearance/English.lproj/Appearance.nib/classes.nib index e3bed7c5e58..2eaf17f377b 100644 --- a/mozilla/camino/PreferencePanes/Appearance/English.lproj/Appearance.nib/classes.nib +++ b/mozilla/camino/PreferencePanes/Appearance/English.lproj/Appearance.nib/classes.nib @@ -1,83 +1,144 @@ -{ - IBClasses = ( - { - CLASS = FirstResponder; - LANGUAGE = ObjC; - SUPERCLASS = NSObject; - }, - { - CLASS = NSMenu; - LANGUAGE = ObjC; - SUPERCLASS = NSObject; - }, - { - CLASS = NSMenuItem; - LANGUAGE = ObjC; - SUPERCLASS = NSObject; - }, - { - CLASS = NSObject; - LANGUAGE = ObjC; - }, - { - CLASS = NSPreferencePane; - LANGUAGE = ObjC; - OUTLETS = { - "_firstKeyView" = id; - "_initialKeyView" = id; - "_lastKeyView" = id; - "_window" = id; - }; - SUPERCLASS = NSObject; - }, - { - CLASS = NSView; - LANGUAGE = ObjC; - SUPERCLASS = NSResponder; - }, - { - ACTIONS = { - advancedFontsDone = id; - buttonClicked = id; - colorChanged = id; - fontRegionPopupClicked = id; - monospaceFontChoiceButtonClicked = id; - proportionalFontChoiceButtonClicked = id; - resetToDefaults = id; - showAdvancedFontsDialog = id; - useMyFontsButtonClicked = id; - }; - CLASS = OrgMozillaCaminoPreferenceAppearance; - LANGUAGE = ObjC; - OUTLETS = { - mAdvancedFontsDialog = NSPanel; - mAdvancedFontsLabel = NSTextField; - mBackgroundColorWell = NSColorWell; - mChooseMonospaceFontButton = NSButton; - mChooseProportionalFontButton = NSButton; - mDefaultFontMatrix = NSMatrix; - mFontRegionPopup = NSPopUpButton; - mFontSampleMonospace = NSTextField; - mFontSampleProportional = NSTextField; - mMinFontSizePopup = NSPopUpButton; - mProportionalSampleLabel = NSTextField; - mProportionalSubLabel = NSTextField; - mResetButton = NSButton; - mTabView = NSTabView; - mTextColorWell = NSColorWell; - mUnderlineLinksCheckbox = NSButton; - mUnvisitedLinksColorWell = NSColorWell; - mUseMyColorsCheckbox = NSButton; - mUseMyFontsCheckbox = NSButton; - mVisitedLinksColorWell = NSColorWell; - }; - SUPERCLASS = PreferencePaneBase; - }, - { - CLASS = PreferencePaneBase; - LANGUAGE = ObjC; - SUPERCLASS = NSPreferencePane; - } - ); - IBVersion = 1; -} \ No newline at end of file + + + + + IBClasses + + + CLASS + PreferencePaneBase + LANGUAGE + ObjC + SUPERCLASS + NSPreferencePane + + + CLASS + NSView + LANGUAGE + ObjC + SUPERCLASS + NSResponder + + + CLASS + NSMenuItem + LANGUAGE + ObjC + SUPERCLASS + NSObject + + + CLASS + NSMenu + LANGUAGE + ObjC + SUPERCLASS + NSObject + + + CLASS + FirstResponder + LANGUAGE + ObjC + SUPERCLASS + NSObject + + + CLASS + NSObject + LANGUAGE + ObjC + + + CLASS + NSPreferencePane + LANGUAGE + ObjC + OUTLETS + + _firstKeyView + id + _initialKeyView + id + _lastKeyView + id + _window + id + + SUPERCLASS + NSObject + + + ACTIONS + + buttonClicked + id + colorChanged + id + defaultFontTypeClicked + id + fontRegionPopupClicked + id + minFontSizePopupClicked + id + monospaceFontChoiceButtonClicked + id + proportionalFontChoiceButtonClicked + id + resetToDefaults + id + useMyFontsButtonClicked + id + + CLASS + OrgMozillaCaminoPreferenceAppearance + LANGUAGE + ObjC + OUTLETS + + mBackgroundColorWell + NSColorWell + mChooseMonospaceFontButton + NSButton + mChooseProportionalFontButton + NSButton + mDefaultFontMatrix + NSMatrix + mFontRegionPopup + NSPopUpButton + mFontSampleMonospace + NSTextField + mFontSampleProportional + NSTextField + mMinFontSizePopup + NSPopUpButton + mPreviousBottomControl + NSView + mProportionalSampleLabel + NSTextField + mResetButton + NSButton + mTabView + NSTabView + mTextColorWell + NSColorWell + mUnderlineLinksCheckbox + NSButton + mUnvisitedLinksColorWell + NSColorWell + mUseMyColorsCheckbox + NSButton + mUseMyFontsCheckbox + NSButton + mVisitedLinksColorWell + NSColorWell + + SUPERCLASS + PreferencePaneBase + + + IBVersion + 1 + + diff --git a/mozilla/camino/PreferencePanes/Appearance/English.lproj/Appearance.nib/info.nib b/mozilla/camino/PreferencePanes/Appearance/English.lproj/Appearance.nib/info.nib index e7dbdbf1735..ef2c7f2bb2c 100644 --- a/mozilla/camino/PreferencePanes/Appearance/English.lproj/Appearance.nib/info.nib +++ b/mozilla/camino/PreferencePanes/Appearance/English.lproj/Appearance.nib/info.nib @@ -2,16 +2,18 @@ - IBDocumentLocation - 69 14 356 240 0 0 1440 878 IBFramework Version - 489.0 + 677 IBLastKnownRelativeProjectPath ../../../Camino.xcodeproj IBOldestOS 4 + IBOpenObjects + + 107 + IBSystem Version - 9J61 + 9L31a targetFramework IBCocoaFramework diff --git a/mozilla/camino/PreferencePanes/Appearance/English.lproj/Appearance.nib/keyedobjects.nib b/mozilla/camino/PreferencePanes/Appearance/English.lproj/Appearance.nib/keyedobjects.nib index fde4515e7a8..9e77a4c0e42 100644 Binary files a/mozilla/camino/PreferencePanes/Appearance/English.lproj/Appearance.nib/keyedobjects.nib and b/mozilla/camino/PreferencePanes/Appearance/English.lproj/Appearance.nib/keyedobjects.nib differ diff --git a/mozilla/camino/PreferencePanes/Appearance/English.lproj/Localizable.strings.in b/mozilla/camino/PreferencePanes/Appearance/English.lproj/Localizable.strings.in index 28ae44c21c1..82a0e4a8084 100644 --- a/mozilla/camino/PreferencePanes/Appearance/English.lproj/Localizable.strings.in +++ b/mozilla/camino/PreferencePanes/Appearance/English.lproj/Localizable.strings.in @@ -5,9 +5,6 @@ "ProportionalLabelFormat" = "Proportional (%@):"; "serif" = "Serif"; "sans-serif" = "Sans-serif"; -"AdditionalFontsLabelFormat" = "Additional fonts for %@ pages"; -"serif_note" = "(like Times)"; -"sans-serif_note" = "(like Helvetica)"; /* Displayed when there is no font specified in prefs for a given language group and type */ "NoFontSelected" = "No font selected";