From b1631fc77b88b12259db080f326186d5d442b2f3 Mon Sep 17 00:00:00 2001 From: "thomasvl@chromium.org" Date: Wed, 16 Sep 2009 15:08:35 +0000 Subject: Edit Search Engine fix up: Fix the class name to match a rename that happened before commit. Make the label size changes force the fields over, but not string the fields (window grows). Make the url description autosize to the text it gets. Make the window track the height needed for the url description field. BUG=21893 TEST= The url description text should stay under the url box in all languages. The labels should never clip or overlap the text fields. Review URL: http://codereview.chromium.org/195096 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@26342 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/app/nibs/EditSearchEngine.xib | 1342 +++++++------------- .../cocoa/edit_search_engine_cocoa_controller.h | 3 + .../cocoa/edit_search_engine_cocoa_controller.mm | 44 + 3 files changed, 512 insertions(+), 877 deletions(-) (limited to 'chrome') diff --git a/chrome/app/nibs/EditSearchEngine.xib b/chrome/app/nibs/EditSearchEngine.xib index e139fc9..c31701c 100644 --- a/chrome/app/nibs/EditSearchEngine.xib +++ b/chrome/app/nibs/EditSearchEngine.xib @@ -1,18 +1,14 @@ - + 1050 - 10A432 - 732 - 1038 - 437.00 - - com.apple.InterfaceBuilder.CocoaPlugin - 732 - + 9L30 + 677 + 949.54 + 353.00 YES - + YES @@ -20,7 +16,7 @@ YES - + YES @@ -30,7 +26,7 @@ YES - EditSearchEngineControllerCocoa + EditSearchEngineCocoaController FirstResponder @@ -39,229 +35,131 @@ NSApplication - 7 + 5 2 {{196, 343}, {396, 167}} 544735232 ^IDS_SEARCH_ENGINES_EDITOR_NEW_WINDOW_TITLE NSPanel - {1.79769e+308, 1.79769e+308} + {3.40282e+38, 3.40282e+38} 256 YES - + - 268 - {{91, 128}, {257, 22}} - - YES - - -1804468671 - 272630784 - - - LucidaGrande - 13 - 1044 - - - YES - - 6 - System - textBackgroundColor - - 3 - MQA + 289 + + YES + + + 289 + {{110, 12}, {96, 32}} + + YES + + 67239424 + 134217728 + ^IDS_OK + + LucidaGrande + 1.300000e+01 + 1044 + + + -2038284033 + 129 + + DQ + 200 + 25 - - 6 - System - textColor - - 3 - MAA + + + 289 + {{14, 12}, {96, 32}} + + YES + + 67239424 + 134217728 + ^IDS_CANCEL + + + -2038284033 + 129 + + Gw + 200 + 25 - - - - 268 - {{91, 78}, {257, 22}} - - YES - - -1804468671 - 272630784 - - - - YES - - - - - - - 268 - {{91, 103}, {257, 22}} - - YES - - -1804468671 - 272630784 - - - - YES - - - - - - - 268 - - YES - - YES - Apple PDF pasteboard type - Apple PICT pasteboard type - Apple PNG pasteboard type - NSFilenamesPboardType - NeXT Encapsulated PostScript v1.2 pasteboard type - NeXT TIFF v4.0 pasteboard type - - - {{356, 130}, {20, 20}} - - YES - - 130560 - 33554432 - 0 - 0 - 0 - NO - - YES - - - - 268 - - YES - - YES - Apple PDF pasteboard type - Apple PICT pasteboard type - Apple PNG pasteboard type - NSFilenamesPboardType - NeXT Encapsulated PostScript v1.2 pasteboard type - NeXT TIFF v4.0 pasteboard type - - - {{356, 105}, {20, 20}} - - YES - - 130560 - 33554432 - 0 - 0 - 0 - NO - - YES - - - - 268 - - YES - - YES - Apple PDF pasteboard type - Apple PICT pasteboard type - Apple PNG pasteboard type - NSFilenamesPboardType - NeXT Encapsulated PostScript v1.2 pasteboard type - NeXT TIFF v4.0 pasteboard type - - - {{356, 78}, {20, 20}} + {{176, 0}, {220, 49}} - YES - - 130560 - 33554432 - 0 - 0 - 0 - NO - - YES + GTMWidthBasedTweaker - + - 268 + 292 YES - - + + 265 - {{17, 27}, {69, 17}} - + {{17, 57}, {69, 17}} + YES - + 68288064 71304192 - ^IDS_SEARCH_ENGINES_EDITOR_KEYWORD_LABEL + ^IDS_SEARCH_ENGINES_EDITOR_DESCRIPTION_LABEL - + 6 System controlColor 3 - MC42NjY2NjY2NjY3AA + MC42NjY2NjY2OQA 6 System controlTextColor - + + 3 + MAA + - - + + 265 - {{17, 52}, {69, 17}} - + {{17, 32}, {69, 17}} + YES - + 68288064 71304192 - ^IDS_SEARCH_ENGINES_EDITOR_DESCRIPTION_LABEL + ^IDS_SEARCH_ENGINES_EDITOR_KEYWORD_LABEL - + - + 265 - {{17, 2}, {69, 17}} - + {{17, 7}, {69, 17}} + YES 68288064 @@ -274,86 +172,223 @@ - {{0, 78}, {93, 89}} + {{0, 73}, {89, 94}} GTMWidthBasedTweaker - + - 289 + 266 YES - - - 268 - {{179, 12}, {96, 32}} - - YES - - 67239424 - 134217728 - ^IDS_OK - - - -2038284033 - 129 - - DQ - 200 - 25 - - - - - 268 - {{83, 12}, {96, 32}} - - YES - - 67239424 - 134217728 - ^IDS_CANCEL - - - -2038284033 - 129 - - Gw - 200 - 25 + + + 256 + + YES + + + 265 + + YES + + YES + Apple PDF pasteboard type + Apple PICT pasteboard type + Apple PNG pasteboard type + NSFilenamesPboardType + NeXT Encapsulated PostScript v1.2 pasteboard type + NeXT TIFF v4.0 pasteboard type + + + {{275, 25}, {20, 20}} + + YES + + 130560 + 33554432 + 0 + 0 + 0 + NO + + YES + + + + 265 + + YES + + YES + Apple PDF pasteboard type + Apple PICT pasteboard type + Apple PNG pasteboard type + NSFilenamesPboardType + NeXT Encapsulated PostScript v1.2 pasteboard type + NeXT TIFF v4.0 pasteboard type + + + {{275, 77}, {20, 20}} + + YES + + 130560 + 33554432 + 0 + 0 + 0 + NO + + YES + + + + 266 + {{8, 75}, {259, 22}} + + YES + + -1804468671 + 272630784 + + + + YES + + 6 + System + textBackgroundColor + + 3 + MQA + + + + 6 + System + textColor + + + + + + + 266 + {{8, 25}, {259, 22}} + + YES + + -1804468671 + 272630784 + + + + YES + + + + + + + 266 + {{8, 50}, {259, 22}} + + YES + + -1804468671 + 272630784 + + + + YES + + + + + + + 265 + + YES + + YES + Apple PDF pasteboard type + Apple PICT pasteboard type + Apple PNG pasteboard type + NSFilenamesPboardType + NeXT Encapsulated PostScript v1.2 pasteboard type + NeXT TIFF v4.0 pasteboard type + + + {{275, 52}, {20, 20}} + + YES + + 130560 + 33554432 + 0 + 0 + 0 + NO + + YES + + + + 266 + {{6, 5}, {264, 17}} + + YES + + 67239424 + 272629760 + ^IDS_SEARCH_ENGINES_EDITOR_URL_DESCRIPTION_LABEL + + LucidaGrande + 1.100000e+01 + 16 + + + + + + + {313, 107} + - {{107, 0}, {289, 45}} - - GTMWidthBasedTweaker - - - - 264 - {{88, 46}, {265, 28}} + {{83, 53}, {313, 107}} - YES - + {0, 0} + 67239424 - 272629760 - ^IDS_SEARCH_ENGINES_EDITOR_URL_DESCRIPTION_LABEL + 0 + LucidaGrande - 11 - 16 + 1.100000e+01 + 3100 + + + + 3 + MCAwLjgwMDAwMDAxAA - - - + + 0 + 0 + 0 + NO {396, 167} {{0, 0}, {1680, 1028}} - {1.79769e+308, 1.79769e+308} + {3.40282e+38, 3.40282e+38} ChromeUILocalizer @@ -493,32 +528,74 @@ 51 + + + viewToSlideAndResize_ + + + + 57 + + + + viewToResize_ + + + + 58 + + + + fieldAndImageContainer_ + + + + 59 + + + + labelContainer_ + + + + 60 + + + + urlDescriptionField_ + + + + 61 + YES 0 - + + YES + -2 - - File's Owner + + RmlsZSdzIE93bmVyA -1 - + First Responder -3 - + Application @@ -528,124 +605,105 @@ YES - + 2 YES - - - - - - - - - + + + - 13 - + 45 + + + + + 49 + + + + + 54 + YES - + + - 14 - - - - - 15 - + 3 + YES - + - + - 16 - - + 4 + + - 17 - + 5 + YES - + - + - 18 - - + 6 + + - 19 - + 55 + YES - + + + - 20 - - - - - 21 - + 7 + YES - + - + - 22 - - + 8 + + - 23 - + 9 + YES - + - + - 24 - - - - - 45 - - - - - 46 - - - YES - - - - - + 10 + + 11 @@ -654,7 +712,7 @@ YES - + 12 @@ -662,75 +720,103 @@ - 7 - + 56 + YES - + + + + + + + - + - 8 - - + 23 + + + YES + + + - 9 - + 24 + + + + + 21 + YES - + - + - 10 - - + 22 + + - 48 - + 19 + YES - - + - + - 5 - + 20 + + + + + 13 + YES - + - + - 6 - - + 14 + + - 3 - + 17 + YES - + - + - 4 - - + 18 + + - 49 - - + 15 + + + YES + + + + + + 16 + + 52 @@ -739,7 +825,7 @@ YES - + 53 @@ -750,7 +836,7 @@ YES - + YES -1.IBPluginDependency -2.IBPluginDependency @@ -772,6 +858,7 @@ 18.IBPluginDependency 19.IBPluginDependency 2.IBPluginDependency + 2.IBUserGuides 20.IBPluginDependency 21.IBPluginDependency 22.IBPluginDependency @@ -811,6 +898,9 @@ com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin + + YES + com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -831,7 +921,9 @@ YES - + + YES + YES @@ -839,13 +931,15 @@ YES - + + YES + YES - 53 + 63 @@ -859,11 +953,11 @@ - EditSearchEngineControllerCocoa + EditSearchEngineCocoaController NSWindowController YES - + YES cancel: save: @@ -876,30 +970,36 @@ YES - + YES doneButton_ + fieldAndImageContainer_ keywordField_ keywordImage_ + labelContainer_ nameField_ nameImage_ + urlDescriptionField_ urlField_ urlImage_ YES NSButton + NSBox NSTextField NSImageView + NSView NSTextField NSImageView NSTextField + NSTextField NSImageView IBProjectSource - browser/cocoa/edit_search_engine_controller_cocoa.h + browser/cocoa/edit_search_engine_cocoa_controller.h @@ -907,7 +1007,7 @@ NSObject YES - + YES otherObjectToLocalize_ owner_ @@ -930,7 +1030,7 @@ NSObject YES - + YES localizerOwner_ localizer_ @@ -953,7 +1053,7 @@ NSView YES - + YES viewToResize_ viewToSlideAndResize_ @@ -983,520 +1083,8 @@ - - YES - - NSActionCell - NSCell - - IBFrameworkSource - AppKit.framework/Headers/NSActionCell.h - - - - NSApplication - NSResponder - - IBFrameworkSource - AppKit.framework/Headers/NSApplication.h - - - - NSApplication - - IBFrameworkSource - AppKit.framework/Headers/NSApplicationScripting.h - - - - NSApplication - - IBFrameworkSource - AppKit.framework/Headers/NSColorPanel.h - - - - NSApplication - - IBFrameworkSource - AppKit.framework/Headers/NSHelpManager.h - - - - NSApplication - - IBFrameworkSource - AppKit.framework/Headers/NSPageLayout.h - - - - NSApplication - - IBFrameworkSource - AppKit.framework/Headers/NSUserInterfaceItemSearching.h - - - - NSButton - NSControl - - IBFrameworkSource - AppKit.framework/Headers/NSButton.h - - - - NSButtonCell - NSActionCell - - IBFrameworkSource - AppKit.framework/Headers/NSButtonCell.h - - - - NSCell - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSCell.h - - - - NSControl - NSView - - IBFrameworkSource - AppKit.framework/Headers/NSControl.h - - - - NSFormatter - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSFormatter.h - - - - NSImageCell - NSCell - - IBFrameworkSource - AppKit.framework/Headers/NSImageCell.h - - - - NSImageView - NSControl - - IBFrameworkSource - AppKit.framework/Headers/NSImageView.h - - - - NSMenu - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSMenu.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSAccessibility.h - - - - NSObject - - - - NSObject - - - - NSObject - - - - NSObject - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSDictionaryController.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSDragging.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSFontManager.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSFontPanel.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSKeyValueBinding.h - - - - NSObject - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSNibLoading.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSOutlineView.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSPasteboard.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSSavePanel.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSTableView.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSToolbarItem.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSView.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSArchiver.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSClassDescription.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSError.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSFileManager.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyValueCoding.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyValueObserving.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyedArchiver.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSObject.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSObjectScripting.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSPortCoder.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSRunLoop.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSScriptClassDescription.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSScriptKeyValueCoding.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSScriptObjectSpecifiers.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSScriptWhoseTests.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSThread.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSURL.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSURLConnection.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSURLDownload.h - - - - NSObject - - IBFrameworkSource - QuartzCore.framework/Headers/CAAnimation.h - - - - NSObject - - IBFrameworkSource - QuartzCore.framework/Headers/CALayer.h - - - - NSObject - - IBFrameworkSource - QuartzCore.framework/Headers/CIImageProvider.h - - - - NSObject - - IBFrameworkSource - SecurityInterface.framework/Headers/SFAuthorizationView.h - - - - NSObject - - IBFrameworkSource - SecurityInterface.framework/Headers/SFCertificatePanel.h - - - - NSObject - - IBFrameworkSource - SecurityInterface.framework/Headers/SFChooseIdentityPanel.h - - - - NSPanel - NSWindow - - IBFrameworkSource - AppKit.framework/Headers/NSPanel.h - - - - NSResponder - - IBFrameworkSource - AppKit.framework/Headers/NSInterfaceStyle.h - - - - NSResponder - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSResponder.h - - - - NSTextField - NSControl - - IBFrameworkSource - AppKit.framework/Headers/NSTextField.h - - - - NSTextFieldCell - NSActionCell - - IBFrameworkSource - AppKit.framework/Headers/NSTextFieldCell.h - - - - NSView - - IBFrameworkSource - AppKit.framework/Headers/NSClipView.h - - - - NSView - - IBFrameworkSource - AppKit.framework/Headers/NSMenuItem.h - - - - NSView - - IBFrameworkSource - AppKit.framework/Headers/NSRulerView.h - - - - NSView - NSResponder - - - - NSWindow - - IBFrameworkSource - AppKit.framework/Headers/NSDrawer.h - - - - NSWindow - NSResponder - - IBFrameworkSource - AppKit.framework/Headers/NSWindow.h - - - - NSWindow - - IBFrameworkSource - AppKit.framework/Headers/NSWindowScripting.h - - - - NSWindowController - NSResponder - - showWindow: - id - - - IBFrameworkSource - AppKit.framework/Headers/NSWindowController.h - - - 0 - - com.apple.InterfaceBuilder.CocoaPlugin.macosx - - - - com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3 - - - YES ../../chrome.xcodeproj 3 diff --git a/chrome/browser/cocoa/edit_search_engine_cocoa_controller.h b/chrome/browser/cocoa/edit_search_engine_cocoa_controller.h index 7c8e57e..460a273 100644 --- a/chrome/browser/cocoa/edit_search_engine_cocoa_controller.h +++ b/chrome/browser/cocoa/edit_search_engine_cocoa_controller.h @@ -24,6 +24,9 @@ class TemplateURL; IBOutlet NSImageView* keywordImage_; IBOutlet NSImageView* urlImage_; IBOutlet NSButton* doneButton_; + IBOutlet NSTextField* urlDescriptionField_; + IBOutlet NSView* labelContainer_; + IBOutlet NSBox* fieldAndImageContainer_; // Refs to the good and bad images used in the interface validation. scoped_nsobject goodImage_; diff --git a/chrome/browser/cocoa/edit_search_engine_cocoa_controller.mm b/chrome/browser/cocoa/edit_search_engine_cocoa_controller.mm index 133e617..d159963 100644 --- a/chrome/browser/cocoa/edit_search_engine_cocoa_controller.mm +++ b/chrome/browser/cocoa/edit_search_engine_cocoa_controller.mm @@ -11,6 +11,17 @@ #include "chrome/browser/search_engines/template_url_model.h" #include "grit/app_resources.h" #include "grit/generated_resources.h" +#include "third_party/GTM/AppKit/GTMUILocalizerAndLayoutTweaker.h" + +namespace { + +void ShiftOriginY(NSView* view, CGFloat amount) { + NSPoint origin = [view frame].origin; + origin.y += amount; + [view setFrameOrigin:origin]; +} + +} // namespace @implementation EditSearchEngineCocoaController @@ -33,6 +44,39 @@ - (void)awakeFromNib { DCHECK([self window]); DCHECK_EQ(self, [[self window] delegate]); + + // Make sure the url description field fits the text in it. + CGFloat descriptionShift = [GTMUILocalizerAndLayoutTweaker + sizeToFitFixedWidthTextField:urlDescriptionField_]; + + // Move the label container above the url description. + ShiftOriginY(labelContainer_, descriptionShift); + // There was no way via view containment to use a helper view to move all + // the textfields and images at once, most move them all on their own so + // they stay above the url description. + ShiftOriginY(nameField_, descriptionShift); + ShiftOriginY(keywordField_, descriptionShift); + ShiftOriginY(urlField_, descriptionShift); + ShiftOriginY(nameImage_, descriptionShift); + ShiftOriginY(keywordImage_, descriptionShift); + ShiftOriginY(urlImage_, descriptionShift); + + // Resize the containing box for the name/keyword/url fields/images since it + // also contains the url description (which just grew). + [[fieldAndImageContainer_ contentView] setAutoresizesSubviews:NO]; + NSRect rect = [fieldAndImageContainer_ frame]; + rect.size.height += descriptionShift; + [fieldAndImageContainer_ setFrame:rect]; + [[fieldAndImageContainer_ contentView] setAutoresizesSubviews:YES]; + + // Resize the window. + NSWindow* window = [self window]; + [[window contentView] setAutoresizesSubviews:NO]; + rect = [window frame]; + rect.size.height += descriptionShift; + [window setFrame:rect display:NO]; + [[window contentView] setAutoresizesSubviews:YES]; + ResourceBundle& bundle = ResourceBundle::GetSharedInstance(); goodImage_.reset([bundle.GetNSImageNamed(IDR_INPUT_GOOD) retain]); badImage_.reset([bundle.GetNSImageNamed(IDR_INPUT_ALERT) retain]); -- cgit v1.1