зеркало из https://github.com/mozilla/pjs.git
Fixing bug 152622: moving Close Window and Close Tab to the File menu, and making Command-W close tabs then windows, as appropriate. Also giving MainController members more concrete types, rather than 'id'.
This commit is contained in:
Родитель
16b083d259
Коммит
0f5b017305
|
@ -44,12 +44,14 @@
|
|||
CLASS = MainController;
|
||||
LANGUAGE = ObjC;
|
||||
OUTLETS = {
|
||||
mApplication = id;
|
||||
mBookmarksMenu = id;
|
||||
mBookmarksToolbarMenuItem = id;
|
||||
mFilterList = id;
|
||||
mFilterView = id;
|
||||
mOfflineMenuItem = id;
|
||||
mApplication = NSApplication;
|
||||
mBookmarksMenu = NSMenu;
|
||||
mBookmarksToolbarMenuItem = NSMenuItem;
|
||||
mCloseTabMenuItem = NSMenuItem;
|
||||
mCloseWindowMenuItem = NSMenuItem;
|
||||
mFilterList = NSPopUpButton;
|
||||
mFilterView = NSView;
|
||||
mOfflineMenuItem = NSMenuItem;
|
||||
};
|
||||
SUPERCLASS = NSObject;
|
||||
},
|
||||
|
|
|
@ -3,13 +3,13 @@
|
|||
<plist version="0.9">
|
||||
<dict>
|
||||
<key>IBDocumentLocation</key>
|
||||
<string>100 383 356 240 0 0 1152 848 </string>
|
||||
<string>96 99 356 240 0 0 1152 746 </string>
|
||||
<key>IBEditorPositions</key>
|
||||
<dict>
|
||||
<key>266</key>
|
||||
<string>418 452 277 90 0 0 1152 746 </string>
|
||||
<key>29</key>
|
||||
<string>9 803 446 44 0 0 1152 848 </string>
|
||||
<string>9 701 446 44 0 0 1152 746 </string>
|
||||
</dict>
|
||||
<key>IBFramework Version</key>
|
||||
<string>248.0</string>
|
||||
|
@ -29,10 +29,6 @@
|
|||
</dict>
|
||||
<key>IBLastGroupID</key>
|
||||
<string>2</string>
|
||||
<key>IBOpenObjects</key>
|
||||
<array>
|
||||
<integer>29</integer>
|
||||
</array>
|
||||
<key>IBSystem Version</key>
|
||||
<string>5S66</string>
|
||||
</dict>
|
||||
|
|
Двоичный файл не отображается.
|
@ -46,32 +46,34 @@ class BookmarksService;
|
|||
|
||||
@interface MainController : NSObject
|
||||
{
|
||||
IBOutlet id mApplication;
|
||||
IBOutlet NSApplication* mApplication;
|
||||
|
||||
// The following two items are used by the filter list when saving files.
|
||||
IBOutlet id mFilterView;
|
||||
IBOutlet id mFilterList;
|
||||
|
||||
IBOutlet id mOfflineMenuItem;
|
||||
IBOutlet NSView* mFilterView;
|
||||
IBOutlet NSPopUpButton* mFilterList;
|
||||
|
||||
IBOutlet NSMenuItem* mOfflineMenuItem;
|
||||
IBOutlet NSMenuItem* mCloseWindowMenuItem;
|
||||
IBOutlet NSMenuItem* mCloseTabMenuItem;
|
||||
|
||||
// The bookmarks menu.
|
||||
IBOutlet id mBookmarksMenu;
|
||||
IBOutlet NSMenu* mBookmarksMenu;
|
||||
|
||||
IBOutlet id mBookmarksToolbarMenuItem;
|
||||
IBOutlet NSMenuItem* mBookmarksToolbarMenuItem;
|
||||
|
||||
BOOL mOffline;
|
||||
BOOL mOffline;
|
||||
|
||||
CHSplashScreenWindow *mSplashScreen;
|
||||
CHSplashScreenWindow* mSplashScreen;
|
||||
|
||||
CHPreferenceManager* mPreferenceManager;
|
||||
CHPreferenceManager* mPreferenceManager;
|
||||
|
||||
BookmarksService *mMenuBookmarks;
|
||||
BookmarksService* mMenuBookmarks;
|
||||
|
||||
FindDlgController* mFindDialog;
|
||||
FindDlgController* mFindDialog;
|
||||
|
||||
MVPreferencesController *preferencesController;
|
||||
MVPreferencesController* preferencesController;
|
||||
|
||||
NSString* mStartURL;
|
||||
NSString* mStartURL;
|
||||
}
|
||||
|
||||
-(void)dealloc;
|
||||
|
@ -122,6 +124,10 @@ class BookmarksService;
|
|||
-(BrowserWindowController*)openBrowserWindowWithURL: (NSString*)aURL;
|
||||
- (void)openNewWindowOrTabWithURL:(NSString*)inURLString;
|
||||
|
||||
- (void)adjustCloseWindowMenuItemKeyEquivalent:(BOOL)inHaveTabs;
|
||||
- (void)adjustCloseTabMenuItemKeyEquivalent:(BOOL)inHaveTabs;
|
||||
- (void)fixCloseMenuItemKeyEquivalents;
|
||||
|
||||
-(NSWindow*)getFrontmostBrowserWindow;
|
||||
|
||||
- (MVPreferencesController *)preferencesController;
|
||||
|
|
|
@ -382,6 +382,8 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
|
|||
[controller openNewTabWithURL:inURLString loadInBackground:loadInBackground];
|
||||
}
|
||||
else {
|
||||
// should use BrowserWindowController openNewWindowWithURL, but that method
|
||||
// really needs to be on the MainController
|
||||
controller = [self openBrowserWindowWithURL: inURLString];
|
||||
}
|
||||
|
||||
|
@ -546,9 +548,38 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
|
|||
return [[[mApplication mainWindow] windowController] isMemberOfClass:[BrowserWindowController class]];
|
||||
}
|
||||
|
||||
- (void)adjustCloseWindowMenuItemKeyEquivalent:(BOOL)inHaveTabs
|
||||
{
|
||||
// capitalization of the key equivalent affects whether the shift modifer is used.
|
||||
[mCloseWindowMenuItem setKeyEquivalent: inHaveTabs ? @"W" : @"w"];
|
||||
}
|
||||
|
||||
- (void)adjustCloseTabMenuItemKeyEquivalent:(BOOL)inHaveTabs
|
||||
{
|
||||
if (inHaveTabs) {
|
||||
[mCloseTabMenuItem setKeyEquivalent:@"w"];
|
||||
[mCloseTabMenuItem setKeyEquivalentModifierMask:NSCommandKeyMask];
|
||||
}
|
||||
else {
|
||||
[mCloseTabMenuItem setKeyEquivalent:@""];
|
||||
[mCloseTabMenuItem setKeyEquivalentModifierMask:0];
|
||||
}
|
||||
}
|
||||
|
||||
// see if we have a window with tabs open, and adjust the key equivalents for
|
||||
// Close Tab/Close Window accordingly
|
||||
- (void)fixCloseMenuItemKeyEquivalents
|
||||
{
|
||||
BOOL windowWithMultipleTabs = ([[[[mApplication mainWindow] windowController] getTabBrowser] numberOfTabViewItems] > 1);
|
||||
|
||||
[self adjustCloseWindowMenuItemKeyEquivalent:windowWithMultipleTabs];
|
||||
[self adjustCloseTabMenuItemKeyEquivalent:windowWithMultipleTabs];
|
||||
}
|
||||
|
||||
-(BOOL)validateMenuItem: (NSMenuItem*)aMenuItem
|
||||
{
|
||||
//NSLog(@"validateMenuItem for %@ called on the MainController", [aMenuItem title]);
|
||||
|
||||
// disable items that aren't relevant if there's no main browser window open
|
||||
SEL action = [aMenuItem action];
|
||||
if (action == @selector(newTab:) ||
|
||||
|
@ -600,9 +631,11 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
|
|||
// only activate if we've got multiple tabs open.
|
||||
if ((action == @selector(closeTab:) ||
|
||||
action == @selector (nextTab:) ||
|
||||
action == @selector (previousTab:))) {
|
||||
action == @selector (previousTab:)))
|
||||
{
|
||||
if ([[[[mApplication mainWindow] windowController] getTabBrowser] numberOfTabViewItems] > 1)
|
||||
return YES;
|
||||
|
||||
return NO;
|
||||
}
|
||||
|
||||
|
|
|
@ -44,12 +44,14 @@
|
|||
CLASS = MainController;
|
||||
LANGUAGE = ObjC;
|
||||
OUTLETS = {
|
||||
mApplication = id;
|
||||
mBookmarksMenu = id;
|
||||
mBookmarksToolbarMenuItem = id;
|
||||
mFilterList = id;
|
||||
mFilterView = id;
|
||||
mOfflineMenuItem = id;
|
||||
mApplication = NSApplication;
|
||||
mBookmarksMenu = NSMenu;
|
||||
mBookmarksToolbarMenuItem = NSMenuItem;
|
||||
mCloseTabMenuItem = NSMenuItem;
|
||||
mCloseWindowMenuItem = NSMenuItem;
|
||||
mFilterList = NSPopUpButton;
|
||||
mFilterView = NSView;
|
||||
mOfflineMenuItem = NSMenuItem;
|
||||
};
|
||||
SUPERCLASS = NSObject;
|
||||
},
|
||||
|
|
|
@ -3,13 +3,13 @@
|
|||
<plist version="0.9">
|
||||
<dict>
|
||||
<key>IBDocumentLocation</key>
|
||||
<string>100 383 356 240 0 0 1152 848 </string>
|
||||
<string>96 99 356 240 0 0 1152 746 </string>
|
||||
<key>IBEditorPositions</key>
|
||||
<dict>
|
||||
<key>266</key>
|
||||
<string>418 452 277 90 0 0 1152 746 </string>
|
||||
<key>29</key>
|
||||
<string>9 803 446 44 0 0 1152 848 </string>
|
||||
<string>9 701 446 44 0 0 1152 746 </string>
|
||||
</dict>
|
||||
<key>IBFramework Version</key>
|
||||
<string>248.0</string>
|
||||
|
@ -29,10 +29,6 @@
|
|||
</dict>
|
||||
<key>IBLastGroupID</key>
|
||||
<string>2</string>
|
||||
<key>IBOpenObjects</key>
|
||||
<array>
|
||||
<integer>29</integer>
|
||||
</array>
|
||||
<key>IBSystem Version</key>
|
||||
<string>5S66</string>
|
||||
</dict>
|
||||
|
|
Двоичный файл не отображается.
|
@ -44,12 +44,14 @@
|
|||
CLASS = MainController;
|
||||
LANGUAGE = ObjC;
|
||||
OUTLETS = {
|
||||
mApplication = id;
|
||||
mBookmarksMenu = id;
|
||||
mBookmarksToolbarMenuItem = id;
|
||||
mFilterList = id;
|
||||
mFilterView = id;
|
||||
mOfflineMenuItem = id;
|
||||
mApplication = NSApplication;
|
||||
mBookmarksMenu = NSMenu;
|
||||
mBookmarksToolbarMenuItem = NSMenuItem;
|
||||
mCloseTabMenuItem = NSMenuItem;
|
||||
mCloseWindowMenuItem = NSMenuItem;
|
||||
mFilterList = NSPopUpButton;
|
||||
mFilterView = NSView;
|
||||
mOfflineMenuItem = NSMenuItem;
|
||||
};
|
||||
SUPERCLASS = NSObject;
|
||||
},
|
||||
|
|
|
@ -3,13 +3,13 @@
|
|||
<plist version="0.9">
|
||||
<dict>
|
||||
<key>IBDocumentLocation</key>
|
||||
<string>100 383 356 240 0 0 1152 848 </string>
|
||||
<string>96 99 356 240 0 0 1152 746 </string>
|
||||
<key>IBEditorPositions</key>
|
||||
<dict>
|
||||
<key>266</key>
|
||||
<string>418 452 277 90 0 0 1152 746 </string>
|
||||
<key>29</key>
|
||||
<string>9 803 446 44 0 0 1152 848 </string>
|
||||
<string>9 701 446 44 0 0 1152 746 </string>
|
||||
</dict>
|
||||
<key>IBFramework Version</key>
|
||||
<string>248.0</string>
|
||||
|
@ -29,10 +29,6 @@
|
|||
</dict>
|
||||
<key>IBLastGroupID</key>
|
||||
<string>2</string>
|
||||
<key>IBOpenObjects</key>
|
||||
<array>
|
||||
<integer>29</integer>
|
||||
</array>
|
||||
<key>IBSystem Version</key>
|
||||
<string>5S66</string>
|
||||
</dict>
|
||||
|
|
Двоичный файл не отображается.
|
@ -46,32 +46,34 @@ class BookmarksService;
|
|||
|
||||
@interface MainController : NSObject
|
||||
{
|
||||
IBOutlet id mApplication;
|
||||
IBOutlet NSApplication* mApplication;
|
||||
|
||||
// The following two items are used by the filter list when saving files.
|
||||
IBOutlet id mFilterView;
|
||||
IBOutlet id mFilterList;
|
||||
|
||||
IBOutlet id mOfflineMenuItem;
|
||||
IBOutlet NSView* mFilterView;
|
||||
IBOutlet NSPopUpButton* mFilterList;
|
||||
|
||||
IBOutlet NSMenuItem* mOfflineMenuItem;
|
||||
IBOutlet NSMenuItem* mCloseWindowMenuItem;
|
||||
IBOutlet NSMenuItem* mCloseTabMenuItem;
|
||||
|
||||
// The bookmarks menu.
|
||||
IBOutlet id mBookmarksMenu;
|
||||
IBOutlet NSMenu* mBookmarksMenu;
|
||||
|
||||
IBOutlet id mBookmarksToolbarMenuItem;
|
||||
IBOutlet NSMenuItem* mBookmarksToolbarMenuItem;
|
||||
|
||||
BOOL mOffline;
|
||||
BOOL mOffline;
|
||||
|
||||
CHSplashScreenWindow *mSplashScreen;
|
||||
CHSplashScreenWindow* mSplashScreen;
|
||||
|
||||
CHPreferenceManager* mPreferenceManager;
|
||||
CHPreferenceManager* mPreferenceManager;
|
||||
|
||||
BookmarksService *mMenuBookmarks;
|
||||
BookmarksService* mMenuBookmarks;
|
||||
|
||||
FindDlgController* mFindDialog;
|
||||
FindDlgController* mFindDialog;
|
||||
|
||||
MVPreferencesController *preferencesController;
|
||||
MVPreferencesController* preferencesController;
|
||||
|
||||
NSString* mStartURL;
|
||||
NSString* mStartURL;
|
||||
}
|
||||
|
||||
-(void)dealloc;
|
||||
|
@ -122,6 +124,10 @@ class BookmarksService;
|
|||
-(BrowserWindowController*)openBrowserWindowWithURL: (NSString*)aURL;
|
||||
- (void)openNewWindowOrTabWithURL:(NSString*)inURLString;
|
||||
|
||||
- (void)adjustCloseWindowMenuItemKeyEquivalent:(BOOL)inHaveTabs;
|
||||
- (void)adjustCloseTabMenuItemKeyEquivalent:(BOOL)inHaveTabs;
|
||||
- (void)fixCloseMenuItemKeyEquivalents;
|
||||
|
||||
-(NSWindow*)getFrontmostBrowserWindow;
|
||||
|
||||
- (MVPreferencesController *)preferencesController;
|
||||
|
|
|
@ -382,6 +382,8 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
|
|||
[controller openNewTabWithURL:inURLString loadInBackground:loadInBackground];
|
||||
}
|
||||
else {
|
||||
// should use BrowserWindowController openNewWindowWithURL, but that method
|
||||
// really needs to be on the MainController
|
||||
controller = [self openBrowserWindowWithURL: inURLString];
|
||||
}
|
||||
|
||||
|
@ -546,9 +548,38 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
|
|||
return [[[mApplication mainWindow] windowController] isMemberOfClass:[BrowserWindowController class]];
|
||||
}
|
||||
|
||||
- (void)adjustCloseWindowMenuItemKeyEquivalent:(BOOL)inHaveTabs
|
||||
{
|
||||
// capitalization of the key equivalent affects whether the shift modifer is used.
|
||||
[mCloseWindowMenuItem setKeyEquivalent: inHaveTabs ? @"W" : @"w"];
|
||||
}
|
||||
|
||||
- (void)adjustCloseTabMenuItemKeyEquivalent:(BOOL)inHaveTabs
|
||||
{
|
||||
if (inHaveTabs) {
|
||||
[mCloseTabMenuItem setKeyEquivalent:@"w"];
|
||||
[mCloseTabMenuItem setKeyEquivalentModifierMask:NSCommandKeyMask];
|
||||
}
|
||||
else {
|
||||
[mCloseTabMenuItem setKeyEquivalent:@""];
|
||||
[mCloseTabMenuItem setKeyEquivalentModifierMask:0];
|
||||
}
|
||||
}
|
||||
|
||||
// see if we have a window with tabs open, and adjust the key equivalents for
|
||||
// Close Tab/Close Window accordingly
|
||||
- (void)fixCloseMenuItemKeyEquivalents
|
||||
{
|
||||
BOOL windowWithMultipleTabs = ([[[[mApplication mainWindow] windowController] getTabBrowser] numberOfTabViewItems] > 1);
|
||||
|
||||
[self adjustCloseWindowMenuItemKeyEquivalent:windowWithMultipleTabs];
|
||||
[self adjustCloseTabMenuItemKeyEquivalent:windowWithMultipleTabs];
|
||||
}
|
||||
|
||||
-(BOOL)validateMenuItem: (NSMenuItem*)aMenuItem
|
||||
{
|
||||
//NSLog(@"validateMenuItem for %@ called on the MainController", [aMenuItem title]);
|
||||
|
||||
// disable items that aren't relevant if there's no main browser window open
|
||||
SEL action = [aMenuItem action];
|
||||
if (action == @selector(newTab:) ||
|
||||
|
@ -600,9 +631,11 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
|
|||
// only activate if we've got multiple tabs open.
|
||||
if ((action == @selector(closeTab:) ||
|
||||
action == @selector (nextTab:) ||
|
||||
action == @selector (previousTab:))) {
|
||||
action == @selector (previousTab:)))
|
||||
{
|
||||
if ([[[[mApplication mainWindow] windowController] getTabBrowser] numberOfTabViewItems] > 1)
|
||||
return YES;
|
||||
|
||||
return NO;
|
||||
}
|
||||
|
||||
|
|
|
@ -44,12 +44,14 @@
|
|||
CLASS = MainController;
|
||||
LANGUAGE = ObjC;
|
||||
OUTLETS = {
|
||||
mApplication = id;
|
||||
mBookmarksMenu = id;
|
||||
mBookmarksToolbarMenuItem = id;
|
||||
mFilterList = id;
|
||||
mFilterView = id;
|
||||
mOfflineMenuItem = id;
|
||||
mApplication = NSApplication;
|
||||
mBookmarksMenu = NSMenu;
|
||||
mBookmarksToolbarMenuItem = NSMenuItem;
|
||||
mCloseTabMenuItem = NSMenuItem;
|
||||
mCloseWindowMenuItem = NSMenuItem;
|
||||
mFilterList = NSPopUpButton;
|
||||
mFilterView = NSView;
|
||||
mOfflineMenuItem = NSMenuItem;
|
||||
};
|
||||
SUPERCLASS = NSObject;
|
||||
},
|
||||
|
|
|
@ -3,13 +3,13 @@
|
|||
<plist version="0.9">
|
||||
<dict>
|
||||
<key>IBDocumentLocation</key>
|
||||
<string>100 383 356 240 0 0 1152 848 </string>
|
||||
<string>96 99 356 240 0 0 1152 746 </string>
|
||||
<key>IBEditorPositions</key>
|
||||
<dict>
|
||||
<key>266</key>
|
||||
<string>418 452 277 90 0 0 1152 746 </string>
|
||||
<key>29</key>
|
||||
<string>9 803 446 44 0 0 1152 848 </string>
|
||||
<string>9 701 446 44 0 0 1152 746 </string>
|
||||
</dict>
|
||||
<key>IBFramework Version</key>
|
||||
<string>248.0</string>
|
||||
|
@ -29,10 +29,6 @@
|
|||
</dict>
|
||||
<key>IBLastGroupID</key>
|
||||
<string>2</string>
|
||||
<key>IBOpenObjects</key>
|
||||
<array>
|
||||
<integer>29</integer>
|
||||
</array>
|
||||
<key>IBSystem Version</key>
|
||||
<string>5S66</string>
|
||||
</dict>
|
||||
|
|
Двоичный файл не отображается.
|
@ -46,32 +46,34 @@ class BookmarksService;
|
|||
|
||||
@interface MainController : NSObject
|
||||
{
|
||||
IBOutlet id mApplication;
|
||||
IBOutlet NSApplication* mApplication;
|
||||
|
||||
// The following two items are used by the filter list when saving files.
|
||||
IBOutlet id mFilterView;
|
||||
IBOutlet id mFilterList;
|
||||
|
||||
IBOutlet id mOfflineMenuItem;
|
||||
IBOutlet NSView* mFilterView;
|
||||
IBOutlet NSPopUpButton* mFilterList;
|
||||
|
||||
IBOutlet NSMenuItem* mOfflineMenuItem;
|
||||
IBOutlet NSMenuItem* mCloseWindowMenuItem;
|
||||
IBOutlet NSMenuItem* mCloseTabMenuItem;
|
||||
|
||||
// The bookmarks menu.
|
||||
IBOutlet id mBookmarksMenu;
|
||||
IBOutlet NSMenu* mBookmarksMenu;
|
||||
|
||||
IBOutlet id mBookmarksToolbarMenuItem;
|
||||
IBOutlet NSMenuItem* mBookmarksToolbarMenuItem;
|
||||
|
||||
BOOL mOffline;
|
||||
BOOL mOffline;
|
||||
|
||||
CHSplashScreenWindow *mSplashScreen;
|
||||
CHSplashScreenWindow* mSplashScreen;
|
||||
|
||||
CHPreferenceManager* mPreferenceManager;
|
||||
CHPreferenceManager* mPreferenceManager;
|
||||
|
||||
BookmarksService *mMenuBookmarks;
|
||||
BookmarksService* mMenuBookmarks;
|
||||
|
||||
FindDlgController* mFindDialog;
|
||||
FindDlgController* mFindDialog;
|
||||
|
||||
MVPreferencesController *preferencesController;
|
||||
MVPreferencesController* preferencesController;
|
||||
|
||||
NSString* mStartURL;
|
||||
NSString* mStartURL;
|
||||
}
|
||||
|
||||
-(void)dealloc;
|
||||
|
@ -122,6 +124,10 @@ class BookmarksService;
|
|||
-(BrowserWindowController*)openBrowserWindowWithURL: (NSString*)aURL;
|
||||
- (void)openNewWindowOrTabWithURL:(NSString*)inURLString;
|
||||
|
||||
- (void)adjustCloseWindowMenuItemKeyEquivalent:(BOOL)inHaveTabs;
|
||||
- (void)adjustCloseTabMenuItemKeyEquivalent:(BOOL)inHaveTabs;
|
||||
- (void)fixCloseMenuItemKeyEquivalents;
|
||||
|
||||
-(NSWindow*)getFrontmostBrowserWindow;
|
||||
|
||||
- (MVPreferencesController *)preferencesController;
|
||||
|
|
|
@ -382,6 +382,8 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
|
|||
[controller openNewTabWithURL:inURLString loadInBackground:loadInBackground];
|
||||
}
|
||||
else {
|
||||
// should use BrowserWindowController openNewWindowWithURL, but that method
|
||||
// really needs to be on the MainController
|
||||
controller = [self openBrowserWindowWithURL: inURLString];
|
||||
}
|
||||
|
||||
|
@ -546,9 +548,38 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
|
|||
return [[[mApplication mainWindow] windowController] isMemberOfClass:[BrowserWindowController class]];
|
||||
}
|
||||
|
||||
- (void)adjustCloseWindowMenuItemKeyEquivalent:(BOOL)inHaveTabs
|
||||
{
|
||||
// capitalization of the key equivalent affects whether the shift modifer is used.
|
||||
[mCloseWindowMenuItem setKeyEquivalent: inHaveTabs ? @"W" : @"w"];
|
||||
}
|
||||
|
||||
- (void)adjustCloseTabMenuItemKeyEquivalent:(BOOL)inHaveTabs
|
||||
{
|
||||
if (inHaveTabs) {
|
||||
[mCloseTabMenuItem setKeyEquivalent:@"w"];
|
||||
[mCloseTabMenuItem setKeyEquivalentModifierMask:NSCommandKeyMask];
|
||||
}
|
||||
else {
|
||||
[mCloseTabMenuItem setKeyEquivalent:@""];
|
||||
[mCloseTabMenuItem setKeyEquivalentModifierMask:0];
|
||||
}
|
||||
}
|
||||
|
||||
// see if we have a window with tabs open, and adjust the key equivalents for
|
||||
// Close Tab/Close Window accordingly
|
||||
- (void)fixCloseMenuItemKeyEquivalents
|
||||
{
|
||||
BOOL windowWithMultipleTabs = ([[[[mApplication mainWindow] windowController] getTabBrowser] numberOfTabViewItems] > 1);
|
||||
|
||||
[self adjustCloseWindowMenuItemKeyEquivalent:windowWithMultipleTabs];
|
||||
[self adjustCloseTabMenuItemKeyEquivalent:windowWithMultipleTabs];
|
||||
}
|
||||
|
||||
-(BOOL)validateMenuItem: (NSMenuItem*)aMenuItem
|
||||
{
|
||||
//NSLog(@"validateMenuItem for %@ called on the MainController", [aMenuItem title]);
|
||||
|
||||
// disable items that aren't relevant if there's no main browser window open
|
||||
SEL action = [aMenuItem action];
|
||||
if (action == @selector(newTab:) ||
|
||||
|
@ -600,9 +631,11 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
|
|||
// only activate if we've got multiple tabs open.
|
||||
if ((action == @selector(closeTab:) ||
|
||||
action == @selector (nextTab:) ||
|
||||
action == @selector (previousTab:))) {
|
||||
action == @selector (previousTab:)))
|
||||
{
|
||||
if ([[[[mApplication mainWindow] windowController] getTabBrowser] numberOfTabViewItems] > 1)
|
||||
return YES;
|
||||
|
||||
return NO;
|
||||
}
|
||||
|
||||
|
|
|
@ -44,12 +44,14 @@
|
|||
CLASS = MainController;
|
||||
LANGUAGE = ObjC;
|
||||
OUTLETS = {
|
||||
mApplication = id;
|
||||
mBookmarksMenu = id;
|
||||
mBookmarksToolbarMenuItem = id;
|
||||
mFilterList = id;
|
||||
mFilterView = id;
|
||||
mOfflineMenuItem = id;
|
||||
mApplication = NSApplication;
|
||||
mBookmarksMenu = NSMenu;
|
||||
mBookmarksToolbarMenuItem = NSMenuItem;
|
||||
mCloseTabMenuItem = NSMenuItem;
|
||||
mCloseWindowMenuItem = NSMenuItem;
|
||||
mFilterList = NSPopUpButton;
|
||||
mFilterView = NSView;
|
||||
mOfflineMenuItem = NSMenuItem;
|
||||
};
|
||||
SUPERCLASS = NSObject;
|
||||
},
|
||||
|
|
|
@ -3,13 +3,13 @@
|
|||
<plist version="0.9">
|
||||
<dict>
|
||||
<key>IBDocumentLocation</key>
|
||||
<string>100 383 356 240 0 0 1152 848 </string>
|
||||
<string>96 99 356 240 0 0 1152 746 </string>
|
||||
<key>IBEditorPositions</key>
|
||||
<dict>
|
||||
<key>266</key>
|
||||
<string>418 452 277 90 0 0 1152 746 </string>
|
||||
<key>29</key>
|
||||
<string>9 803 446 44 0 0 1152 848 </string>
|
||||
<string>9 701 446 44 0 0 1152 746 </string>
|
||||
</dict>
|
||||
<key>IBFramework Version</key>
|
||||
<string>248.0</string>
|
||||
|
@ -29,10 +29,6 @@
|
|||
</dict>
|
||||
<key>IBLastGroupID</key>
|
||||
<string>2</string>
|
||||
<key>IBOpenObjects</key>
|
||||
<array>
|
||||
<integer>29</integer>
|
||||
</array>
|
||||
<key>IBSystem Version</key>
|
||||
<string>5S66</string>
|
||||
</dict>
|
||||
|
|
Двоичный файл не отображается.
|
@ -44,12 +44,14 @@
|
|||
CLASS = MainController;
|
||||
LANGUAGE = ObjC;
|
||||
OUTLETS = {
|
||||
mApplication = id;
|
||||
mBookmarksMenu = id;
|
||||
mBookmarksToolbarMenuItem = id;
|
||||
mFilterList = id;
|
||||
mFilterView = id;
|
||||
mOfflineMenuItem = id;
|
||||
mApplication = NSApplication;
|
||||
mBookmarksMenu = NSMenu;
|
||||
mBookmarksToolbarMenuItem = NSMenuItem;
|
||||
mCloseTabMenuItem = NSMenuItem;
|
||||
mCloseWindowMenuItem = NSMenuItem;
|
||||
mFilterList = NSPopUpButton;
|
||||
mFilterView = NSView;
|
||||
mOfflineMenuItem = NSMenuItem;
|
||||
};
|
||||
SUPERCLASS = NSObject;
|
||||
},
|
||||
|
|
|
@ -3,13 +3,13 @@
|
|||
<plist version="0.9">
|
||||
<dict>
|
||||
<key>IBDocumentLocation</key>
|
||||
<string>100 383 356 240 0 0 1152 848 </string>
|
||||
<string>96 99 356 240 0 0 1152 746 </string>
|
||||
<key>IBEditorPositions</key>
|
||||
<dict>
|
||||
<key>266</key>
|
||||
<string>418 452 277 90 0 0 1152 746 </string>
|
||||
<key>29</key>
|
||||
<string>9 803 446 44 0 0 1152 848 </string>
|
||||
<string>9 701 446 44 0 0 1152 746 </string>
|
||||
</dict>
|
||||
<key>IBFramework Version</key>
|
||||
<string>248.0</string>
|
||||
|
@ -29,10 +29,6 @@
|
|||
</dict>
|
||||
<key>IBLastGroupID</key>
|
||||
<string>2</string>
|
||||
<key>IBOpenObjects</key>
|
||||
<array>
|
||||
<integer>29</integer>
|
||||
</array>
|
||||
<key>IBSystem Version</key>
|
||||
<string>5S66</string>
|
||||
</dict>
|
||||
|
|
Двоичный файл не отображается.
|
@ -46,32 +46,34 @@ class BookmarksService;
|
|||
|
||||
@interface MainController : NSObject
|
||||
{
|
||||
IBOutlet id mApplication;
|
||||
IBOutlet NSApplication* mApplication;
|
||||
|
||||
// The following two items are used by the filter list when saving files.
|
||||
IBOutlet id mFilterView;
|
||||
IBOutlet id mFilterList;
|
||||
|
||||
IBOutlet id mOfflineMenuItem;
|
||||
IBOutlet NSView* mFilterView;
|
||||
IBOutlet NSPopUpButton* mFilterList;
|
||||
|
||||
IBOutlet NSMenuItem* mOfflineMenuItem;
|
||||
IBOutlet NSMenuItem* mCloseWindowMenuItem;
|
||||
IBOutlet NSMenuItem* mCloseTabMenuItem;
|
||||
|
||||
// The bookmarks menu.
|
||||
IBOutlet id mBookmarksMenu;
|
||||
IBOutlet NSMenu* mBookmarksMenu;
|
||||
|
||||
IBOutlet id mBookmarksToolbarMenuItem;
|
||||
IBOutlet NSMenuItem* mBookmarksToolbarMenuItem;
|
||||
|
||||
BOOL mOffline;
|
||||
BOOL mOffline;
|
||||
|
||||
CHSplashScreenWindow *mSplashScreen;
|
||||
CHSplashScreenWindow* mSplashScreen;
|
||||
|
||||
CHPreferenceManager* mPreferenceManager;
|
||||
CHPreferenceManager* mPreferenceManager;
|
||||
|
||||
BookmarksService *mMenuBookmarks;
|
||||
BookmarksService* mMenuBookmarks;
|
||||
|
||||
FindDlgController* mFindDialog;
|
||||
FindDlgController* mFindDialog;
|
||||
|
||||
MVPreferencesController *preferencesController;
|
||||
MVPreferencesController* preferencesController;
|
||||
|
||||
NSString* mStartURL;
|
||||
NSString* mStartURL;
|
||||
}
|
||||
|
||||
-(void)dealloc;
|
||||
|
@ -122,6 +124,10 @@ class BookmarksService;
|
|||
-(BrowserWindowController*)openBrowserWindowWithURL: (NSString*)aURL;
|
||||
- (void)openNewWindowOrTabWithURL:(NSString*)inURLString;
|
||||
|
||||
- (void)adjustCloseWindowMenuItemKeyEquivalent:(BOOL)inHaveTabs;
|
||||
- (void)adjustCloseTabMenuItemKeyEquivalent:(BOOL)inHaveTabs;
|
||||
- (void)fixCloseMenuItemKeyEquivalents;
|
||||
|
||||
-(NSWindow*)getFrontmostBrowserWindow;
|
||||
|
||||
- (MVPreferencesController *)preferencesController;
|
||||
|
|
|
@ -382,6 +382,8 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
|
|||
[controller openNewTabWithURL:inURLString loadInBackground:loadInBackground];
|
||||
}
|
||||
else {
|
||||
// should use BrowserWindowController openNewWindowWithURL, but that method
|
||||
// really needs to be on the MainController
|
||||
controller = [self openBrowserWindowWithURL: inURLString];
|
||||
}
|
||||
|
||||
|
@ -546,9 +548,38 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
|
|||
return [[[mApplication mainWindow] windowController] isMemberOfClass:[BrowserWindowController class]];
|
||||
}
|
||||
|
||||
- (void)adjustCloseWindowMenuItemKeyEquivalent:(BOOL)inHaveTabs
|
||||
{
|
||||
// capitalization of the key equivalent affects whether the shift modifer is used.
|
||||
[mCloseWindowMenuItem setKeyEquivalent: inHaveTabs ? @"W" : @"w"];
|
||||
}
|
||||
|
||||
- (void)adjustCloseTabMenuItemKeyEquivalent:(BOOL)inHaveTabs
|
||||
{
|
||||
if (inHaveTabs) {
|
||||
[mCloseTabMenuItem setKeyEquivalent:@"w"];
|
||||
[mCloseTabMenuItem setKeyEquivalentModifierMask:NSCommandKeyMask];
|
||||
}
|
||||
else {
|
||||
[mCloseTabMenuItem setKeyEquivalent:@""];
|
||||
[mCloseTabMenuItem setKeyEquivalentModifierMask:0];
|
||||
}
|
||||
}
|
||||
|
||||
// see if we have a window with tabs open, and adjust the key equivalents for
|
||||
// Close Tab/Close Window accordingly
|
||||
- (void)fixCloseMenuItemKeyEquivalents
|
||||
{
|
||||
BOOL windowWithMultipleTabs = ([[[[mApplication mainWindow] windowController] getTabBrowser] numberOfTabViewItems] > 1);
|
||||
|
||||
[self adjustCloseWindowMenuItemKeyEquivalent:windowWithMultipleTabs];
|
||||
[self adjustCloseTabMenuItemKeyEquivalent:windowWithMultipleTabs];
|
||||
}
|
||||
|
||||
-(BOOL)validateMenuItem: (NSMenuItem*)aMenuItem
|
||||
{
|
||||
//NSLog(@"validateMenuItem for %@ called on the MainController", [aMenuItem title]);
|
||||
|
||||
// disable items that aren't relevant if there's no main browser window open
|
||||
SEL action = [aMenuItem action];
|
||||
if (action == @selector(newTab:) ||
|
||||
|
@ -600,9 +631,11 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
|
|||
// only activate if we've got multiple tabs open.
|
||||
if ((action == @selector(closeTab:) ||
|
||||
action == @selector (nextTab:) ||
|
||||
action == @selector (previousTab:))) {
|
||||
action == @selector (previousTab:)))
|
||||
{
|
||||
if ([[[[mApplication mainWindow] windowController] getTabBrowser] numberOfTabViewItems] > 1)
|
||||
return YES;
|
||||
|
||||
return NO;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче