mirror of
https://github.com/macvim-dev/macvim.git
synced 2026-06-11 15:37:29 +02:00
Code cleanup
git-svn-id: http://macvim.googlecode.com/svn/trunk@161 96c4425d-ca35-0410-94e5-3396d5c13a8f
This commit is contained in:
+19
-98
@@ -15,9 +15,7 @@
|
||||
#import "MMTextStorage.h"
|
||||
|
||||
|
||||
//static NSString *AttentionToolbarItemID = @"Attention";
|
||||
static NSString *DefaultToolbarImageName = @"Attention";
|
||||
|
||||
static NSString *MMDefaultToolbarImageName = @"Attention";
|
||||
static int MMAlertTextFieldHeight = 22;
|
||||
|
||||
|
||||
@@ -32,8 +30,8 @@ static int MMAlertTextFieldHeight = 22;
|
||||
@interface MMVimController (Private)
|
||||
- (void)handleMessage:(int)msgid data:(NSData *)data;
|
||||
- (void)performBatchDrawWithData:(NSData *)data;
|
||||
- (void)panelDidEnd:(NSSavePanel *)panel code:(int)code
|
||||
context:(void *)context;
|
||||
- (void)savePanelDidEnd:(NSSavePanel *)panel code:(int)code
|
||||
context:(void *)context;
|
||||
- (void)alertDidEnd:(MMAlert *)alert code:(int)code context:(void *)context;
|
||||
- (NSMenuItem *)menuItemForTag:(int)tag;
|
||||
- (NSMenu *)menuForTag:(int)tag;
|
||||
@@ -46,14 +44,12 @@ static int MMAlertTextFieldHeight = 22;
|
||||
action:(NSString *)action atIndex:(int)idx;
|
||||
- (void)updateMainMenu;
|
||||
- (NSToolbarItem *)toolbarItemForTag:(int)tag index:(int *)index;
|
||||
- (IBAction)toolbarAction:(id)sender;
|
||||
- (void)addToolbarItemToDictionaryWithTag:(int)tag label:(NSString *)title
|
||||
toolTip:(NSString *)tip icon:(NSString *)icon;
|
||||
- (void)addToolbarItemWithTag:(int)tag label:(NSString *)label
|
||||
tip:(NSString *)tip icon:(NSString *)icon
|
||||
atIndex:(int)idx;
|
||||
- (void)connectionDidDie:(NSNotification *)notification;
|
||||
- (BOOL)executeActionWithName:(NSString *)name;
|
||||
@end
|
||||
|
||||
|
||||
@@ -108,13 +104,6 @@ static NSMenuItem *findMenuItemWithTagInMenu(NSMenu *root, int tag)
|
||||
|
||||
NSWindow *win = [windowController window];
|
||||
|
||||
#if 0
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
addObserver:self
|
||||
selector:@selector(windowWillClose:)
|
||||
name:NSWindowWillCloseNotification
|
||||
object:win];
|
||||
#endif
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
addObserver:self
|
||||
selector:@selector(windowDidBecomeMain:)
|
||||
@@ -219,13 +208,11 @@ static NSMenuItem *findMenuItemWithTagInMenu(NSMenu *root, int tag)
|
||||
{
|
||||
if (!isInitialized) return;
|
||||
|
||||
[windowController setStatusText:title];
|
||||
|
||||
if (saving) {
|
||||
[[NSSavePanel savePanel] beginSheetForDirectory:dir file:nil
|
||||
modalForWindow:[windowController window]
|
||||
modalDelegate:self
|
||||
didEndSelector:@selector(panelDidEnd:code:context:)
|
||||
didEndSelector:@selector(savePanelDidEnd:code:context:)
|
||||
contextInfo:NULL];
|
||||
} else {
|
||||
NSOpenPanel *panel = [NSOpenPanel openPanel];
|
||||
@@ -233,15 +220,16 @@ static NSMenuItem *findMenuItemWithTagInMenu(NSMenu *root, int tag)
|
||||
[panel beginSheetForDirectory:dir file:nil types:nil
|
||||
modalForWindow:[windowController window]
|
||||
modalDelegate:self
|
||||
didEndSelector:@selector(panelDidEnd:code:context:)
|
||||
didEndSelector:@selector(savePanelDidEnd:code:context:)
|
||||
contextInfo:NULL];
|
||||
}
|
||||
}
|
||||
|
||||
- (oneway void)presentDialogWithStyle:(int)style message:(NSString *)message
|
||||
informativeText:(NSString *)text
|
||||
buttonTitles:(NSArray *)buttonTitles
|
||||
textFieldString:(NSString *)textFieldString
|
||||
- (oneway void)presentDialogWithStyle:(int)style
|
||||
message:(in bycopy NSString *)message
|
||||
informativeText:(in bycopy NSString *)text
|
||||
buttonTitles:(in bycopy NSArray *)buttonTitles
|
||||
textFieldString:(in bycopy NSString *)textFieldString
|
||||
{
|
||||
if (!(windowController && buttonTitles && [buttonTitles count])) return;
|
||||
|
||||
@@ -256,7 +244,8 @@ static NSMenuItem *findMenuItemWithTagInMenu(NSMenu *root, int tag)
|
||||
if (message) {
|
||||
[alert setMessageText:message];
|
||||
} else {
|
||||
// If no message text is specified 'Alert' is used.
|
||||
// If no message text is specified 'Alert' is used, which we don't
|
||||
// want, so set an empty string as message text.
|
||||
[alert setMessageText:@""];
|
||||
}
|
||||
|
||||
@@ -364,20 +353,6 @@ static NSMenuItem *findMenuItemWithTagInMenu(NSMenu *root, int tag)
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
- (void)windowWillClose:(NSNotification *)notification
|
||||
{
|
||||
NSLog(@"%@ %s%@", [self className], _cmd, notification);
|
||||
|
||||
//[self cleanup];
|
||||
|
||||
// NOTE! This causes the call to removeVimController: to be delayed.
|
||||
[[NSApp delegate]
|
||||
performSelectorOnMainThread:@selector(removeVimController:)
|
||||
withObject:self waitUntilDone:NO];
|
||||
}
|
||||
#endif
|
||||
|
||||
- (void)windowDidBecomeMain:(NSNotification *)notification
|
||||
{
|
||||
if (isInitialized)
|
||||
@@ -388,8 +363,6 @@ static NSMenuItem *findMenuItemWithTagInMenu(NSMenu *root, int tag)
|
||||
itemForItemIdentifier:(NSString *)itemId
|
||||
willBeInsertedIntoToolbar:(BOOL)flag
|
||||
{
|
||||
//NSLog(@"%s", _cmd);
|
||||
|
||||
NSToolbarItem *item = [toolbarItemDict objectForKey:itemId];
|
||||
if (!item) {
|
||||
NSLog(@"WARNING: No toolbar item with id '%@'", itemId);
|
||||
@@ -400,13 +373,11 @@ static NSMenuItem *findMenuItemWithTagInMenu(NSMenu *root, int tag)
|
||||
|
||||
- (NSArray *)toolbarAllowedItemIdentifiers:(NSToolbar *)theToolbar
|
||||
{
|
||||
//NSLog(@"%s", _cmd);
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (NSArray *)toolbarDefaultItemIdentifiers:(NSToolbar *)theToolbar
|
||||
{
|
||||
//NSLog(@"%s", _cmd);
|
||||
return nil;
|
||||
}
|
||||
|
||||
@@ -423,8 +394,6 @@ static NSMenuItem *findMenuItemWithTagInMenu(NSMenu *root, int tag)
|
||||
if (OpenVimWindowMsgID == msgid) {
|
||||
[windowController openWindow];
|
||||
} else if (BatchDrawMsgID == msgid) {
|
||||
//NSLog(@"Received batch draw message from VimTask.");
|
||||
|
||||
[self performBatchDrawWithData:data];
|
||||
} else if (SelectTabMsgID == msgid) {
|
||||
#if 0 // NOTE: Tab selection is done inside updateTabsWithData:.
|
||||
@@ -434,13 +403,10 @@ static NSMenuItem *findMenuItemWithTagInMenu(NSMenu *root, int tag)
|
||||
[windowController selectTabWithIndex:idx];
|
||||
#endif
|
||||
} else if (UpdateTabBarMsgID == msgid) {
|
||||
//NSLog(@"Updating tabs");
|
||||
[windowController updateTabsWithData:data];
|
||||
} else if (ShowTabBarMsgID == msgid) {
|
||||
//NSLog(@"Showing tab bar");
|
||||
[windowController showTabBar:YES];
|
||||
} else if (HideTabBarMsgID == msgid) {
|
||||
//NSLog(@"Hiding tab bar");
|
||||
[windowController showTabBar:NO];
|
||||
} else if (SetTextDimensionsMsgID == msgid) {
|
||||
const void *bytes = [data bytes];
|
||||
@@ -490,9 +456,10 @@ static NSMenuItem *findMenuItemWithTagInMenu(NSMenu *root, int tag)
|
||||
|
||||
if (MenuToolbarType == parentTag) {
|
||||
if (!toolbar) {
|
||||
// NOTE! Each toolbar must have a unique identifier, else each
|
||||
// window will have the same toolbar.
|
||||
NSString *ident = [NSString stringWithFormat:@"%d.%d",
|
||||
(int)self, tag];
|
||||
//NSLog(@"Creating toolbar with identifier %@", ident);
|
||||
toolbar = [[NSToolbar alloc] initWithIdentifier:ident];
|
||||
|
||||
[toolbar setShowsBaselineSeparator:NO];
|
||||
@@ -580,7 +547,6 @@ static NSMenuItem *findMenuItemWithTagInMenu(NSMenu *root, int tag)
|
||||
[item retain];
|
||||
|
||||
if ([item menu] == [NSApp mainMenu] || ![item menu]) {
|
||||
//NSLog(@"Removing menu: %@", item);
|
||||
// NOTE: To be on the safe side we try to remove the item from
|
||||
// both arrays (it is ok to call removeObject: even if an array
|
||||
// does not contain the object to remove).
|
||||
@@ -724,9 +690,7 @@ static NSMenuItem *findMenuItemWithTagInMenu(NSMenu *root, int tag)
|
||||
|
||||
[textStorage beginEditing];
|
||||
|
||||
// TODO:
|
||||
// 1. Sanity check input
|
||||
// 2. Cache rgb -> NSColor lookups?
|
||||
// TODO: Sanity check input
|
||||
|
||||
while (bytes < end) {
|
||||
int type = *((int*)bytes); bytes += sizeof(int);
|
||||
@@ -796,10 +760,9 @@ static NSMenuItem *findMenuItemWithTagInMenu(NSMenu *root, int tag)
|
||||
[textStorage endEditing];
|
||||
}
|
||||
|
||||
- (void)panelDidEnd:(NSSavePanel *)panel code:(int)code context:(void *)context
|
||||
- (void)savePanelDidEnd:(NSSavePanel *)panel code:(int)code
|
||||
context:(void *)context
|
||||
{
|
||||
[windowController setStatusText:@""];
|
||||
|
||||
NSString *string = (code == NSOKButton) ? [panel filename] : nil;
|
||||
[backendProxy setDialogReturn:string];
|
||||
}
|
||||
@@ -946,7 +909,6 @@ static NSMenuItem *findMenuItemWithTagInMenu(NSMenu *root, int tag)
|
||||
|
||||
- (void)updateMainMenu
|
||||
{
|
||||
#if 1
|
||||
NSMenu *mainMenu = [NSApp mainMenu];
|
||||
|
||||
// Stop NSApp from updating the Window menu.
|
||||
@@ -981,7 +943,6 @@ static NSMenuItem *findMenuItemWithTagInMenu(NSMenu *root, int tag)
|
||||
[NSApp setWindowsMenu:windowMenu];
|
||||
}
|
||||
|
||||
#endif
|
||||
shouldUpdateMainMenu = NO;
|
||||
}
|
||||
|
||||
@@ -1002,11 +963,6 @@ static NSMenuItem *findMenuItemWithTagInMenu(NSMenu *root, int tag)
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (IBAction)toolbarAction:(id)sender
|
||||
{
|
||||
NSLog(@"%s%@", _cmd, sender);
|
||||
}
|
||||
|
||||
- (void)addToolbarItemToDictionaryWithTag:(int)tag label:(NSString *)title
|
||||
toolTip:(NSString *)tip icon:(NSString *)icon
|
||||
{
|
||||
@@ -1029,9 +985,9 @@ static NSMenuItem *findMenuItemWithTagInMenu(NSMenu *root, int tag)
|
||||
NSLog(@"WARNING: Could not find image with name '%@' to use as toolbar"
|
||||
" image for identifier '%@';"
|
||||
" using default toolbar icon '%@' instead.",
|
||||
icon, title, DefaultToolbarImageName);
|
||||
icon, title, MMDefaultToolbarImageName);
|
||||
|
||||
img = [NSImage imageNamed:DefaultToolbarImageName];
|
||||
img = [NSImage imageNamed:MMDefaultToolbarImageName];
|
||||
}
|
||||
|
||||
[item setImage:img];
|
||||
@@ -1083,41 +1039,6 @@ static NSMenuItem *findMenuItemWithTagInMenu(NSMenu *root, int tag)
|
||||
withObject:self waitUntilDone:NO];
|
||||
}
|
||||
|
||||
- (BOOL)executeActionWithName:(NSString *)name
|
||||
{
|
||||
#if 0
|
||||
static NSDictionary *actionDict = nil;
|
||||
|
||||
if (!actionDict) {
|
||||
NSBundle *mainBundle = [NSBundle mainBundle];
|
||||
NSString *path = [mainBundle pathForResource:@"Actions"
|
||||
ofType:@"plist"];
|
||||
if (path) {
|
||||
actionDict = [[NSDictionary alloc] initWithContentsOfFile:path];
|
||||
NSLog(@"Actions = %@", actionDict);
|
||||
} else {
|
||||
NSLog(@"WARNING: Failed to load dictionary of actions "
|
||||
"(Actions.plist).");
|
||||
return NO;
|
||||
}
|
||||
}
|
||||
|
||||
if ([actionDict objectForKey:name]) {
|
||||
NSLog(@"Executing action %@", name);
|
||||
SEL sel = NSSelectorFromString(name);
|
||||
|
||||
if ([NSApp sendAction:sel to:nil from:self])
|
||||
return YES;
|
||||
|
||||
NSLog(@"WARNING: Failed to send action");
|
||||
} else {
|
||||
NSLog(@"WARNING: Action with name '%@' cannot be executed.", name);
|
||||
}
|
||||
|
||||
#endif
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (NSString *)description
|
||||
{
|
||||
return [NSString stringWithFormat:@"%@ : isInitialized=%d inProcessCommandQueue=%d mainMenuItems=%@ popupMenuItems=%@ toolbar=%@", [self className], isInitialized, inProcessCommandQueue, mainMenuItems, popupMenuItems, toolbar];
|
||||
|
||||
+11
-18
@@ -11,8 +11,6 @@
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
|
||||
#define MM_USE_EMPTY_WINDOW 1
|
||||
|
||||
|
||||
@class PSMTabBarControl;
|
||||
@class MMTextView;
|
||||
@@ -21,21 +19,18 @@
|
||||
|
||||
|
||||
@interface MMWindowController : NSWindowController {
|
||||
IBOutlet PSMTabBarControl *tabBarControl;
|
||||
IBOutlet NSTabView *tabView;
|
||||
IBOutlet NSTextField *statusTextField;
|
||||
IBOutlet NSBox *statusSeparator;
|
||||
IBOutlet NSBox *tablineSeparator;
|
||||
PSMTabBarControl *tabBarControl;
|
||||
NSTabView *tabView;
|
||||
NSBox *tablineSeparator;
|
||||
|
||||
MMVimController *vimController;
|
||||
BOOL vimTaskSelectedTab;
|
||||
NSTimer *statusTimer;
|
||||
MMTextView *textView;
|
||||
MMTextStorage *textStorage;
|
||||
NSMutableArray *scrollbars;
|
||||
BOOL setupDone;
|
||||
BOOL shouldUpdateWindowSize;
|
||||
NSString *windowAutosaveKey;
|
||||
MMVimController *vimController;
|
||||
BOOL vimTaskSelectedTab;
|
||||
MMTextView *textView;
|
||||
MMTextStorage *textStorage;
|
||||
NSMutableArray *scrollbars;
|
||||
BOOL setupDone;
|
||||
BOOL shouldUpdateWindowSize;
|
||||
NSString *windowAutosaveKey;
|
||||
}
|
||||
|
||||
- (id)initWithVimController:(MMVimController *)controller;
|
||||
@@ -49,8 +44,6 @@
|
||||
- (void)updateTabsWithData:(NSData *)data;
|
||||
- (void)selectTabWithIndex:(int)idx;
|
||||
- (void)setTextDimensionsWithRows:(int)rows columns:(int)cols;
|
||||
- (void)setStatusText:(NSString *)text;
|
||||
- (void)flashStatusText:(NSString *)text;
|
||||
- (void)createScrollbarWithIdentifier:(long)ident type:(int)type;
|
||||
- (void)destroyScrollbarWithIdentifier:(long)ident;
|
||||
- (void)showScrollbarWithIdentifier:(long)ident state:(BOOL)visible;
|
||||
|
||||
+6
-110
@@ -57,7 +57,6 @@ static float StatusLineHeight = 16.0f;
|
||||
- (NSRect)fitWindowToFrame:(NSRect)frame;
|
||||
- (void)updateResizeIncrements;
|
||||
- (NSTabViewItem *)addNewTabViewItem;
|
||||
- (void)statusTimerFired:(NSTimer *)timer;
|
||||
- (int)representedIndexOfTabViewItem:(NSTabViewItem *)tvi;
|
||||
- (IBAction)vimMenuItemAction:(id)sender;
|
||||
- (MMScroller *)scrollbarForIdentifier:(long)ident index:(unsigned *)idx;
|
||||
@@ -98,12 +97,7 @@ NSMutableArray *buildMenuAddress(NSMenu *menu)
|
||||
|
||||
- (id)initWithVimController:(MMVimController *)controller
|
||||
{
|
||||
#if MM_USE_EMPTY_WINDOW
|
||||
if ((self = [super initWithWindowNibName:@"EmptyWindow"]))
|
||||
#else
|
||||
if ((self = [super initWithWindowNibName:@"VimWindow"]))
|
||||
#endif
|
||||
{
|
||||
if ((self = [super initWithWindowNibName:@"EmptyWindow"])) {
|
||||
vimController = controller;
|
||||
scrollbars = [[NSMutableArray alloc] init];
|
||||
|
||||
@@ -151,7 +145,6 @@ NSMutableArray *buildMenuAddress(NSMenu *menu)
|
||||
[tc release];
|
||||
[lm release];
|
||||
|
||||
#if MM_USE_EMPTY_WINDOW
|
||||
// Create the tabline separator (which may be visible when the tabline
|
||||
// is hidden).
|
||||
NSRect tabSepRect = [contentView frame];
|
||||
@@ -196,7 +189,6 @@ NSMutableArray *buildMenuAddress(NSMenu *menu)
|
||||
|
||||
[[self window] setDelegate:self];
|
||||
[[self window] setInitialFirstResponder:textView];
|
||||
#endif
|
||||
}
|
||||
|
||||
return self;
|
||||
@@ -206,19 +198,14 @@ NSMutableArray *buildMenuAddress(NSMenu *menu)
|
||||
{
|
||||
//NSLog(@"%@ %s", [self className], _cmd);
|
||||
|
||||
#if MM_USE_EMPTY_WINDOW
|
||||
[tabBarControl release]; tabBarControl = nil;
|
||||
[tabView release]; tabView = nil;
|
||||
[tablineSeparator release]; tablineSeparator = nil;
|
||||
#endif
|
||||
[windowAutosaveKey release]; windowAutosaveKey = nil;
|
||||
[scrollbars release]; scrollbars = nil;
|
||||
[textView release]; textView = nil;
|
||||
[textStorage release]; textStorage = nil;
|
||||
|
||||
//[tabBarControl release]; tabBarControl = nil;
|
||||
//[tabView release]; tabView = nil;
|
||||
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
@@ -227,34 +214,6 @@ NSMutableArray *buildMenuAddress(NSMenu *menu)
|
||||
return [NSString stringWithFormat:@"%@ : setupDone=%d windowAutosaveKey=%@ vimController=%@", [self className], setupDone, windowAutosaveKey, vimController];
|
||||
}
|
||||
|
||||
#if !MM_USE_EMPTY_WINDOW
|
||||
- (void)windowDidLoad
|
||||
{
|
||||
// Called after window nib file is loaded.
|
||||
|
||||
[tablineSeparator setHidden:([[self window] toolbar] == nil)];
|
||||
[tabBarControl setHidden:YES];
|
||||
|
||||
// NOTE: Size to fit looks good, but not many tabs will fit and there are
|
||||
// quite a few drawing bugs in this code, so it is disabled for now.
|
||||
//[tabBarControl setSizeCellsToFit:YES];
|
||||
|
||||
NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
|
||||
[tabBarControl setCellMinWidth:[ud integerForKey:MMTabMinWidthKey]];
|
||||
[tabBarControl setCellMaxWidth:[ud integerForKey:MMTabMaxWidthKey]];
|
||||
[tabBarControl setCellOptimumWidth:[ud integerForKey:MMTabOptimumWidthKey]];
|
||||
|
||||
[tabBarControl setAllowsDragBetweenWindows:NO];
|
||||
//[tabBarControl setShowAddTabButton:YES];
|
||||
//[[tabBarControl addTabButton] setTarget:self];
|
||||
//[[tabBarControl addTabButton] setAction:@selector(addNewTab:)];
|
||||
|
||||
// HACK! remove any tabs present in the nib
|
||||
[tabView removeAllTabViewItems];
|
||||
[tabView setHidden:YES];
|
||||
}
|
||||
#endif
|
||||
|
||||
- (MMVimController *)vimController
|
||||
{
|
||||
return vimController;
|
||||
@@ -302,10 +261,8 @@ NSMutableArray *buildMenuAddress(NSMenu *menu)
|
||||
// will come and gnaw at your feet while you are sleeping).
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:tabBarControl];
|
||||
|
||||
#if MM_USE_EMPTY_WINDOW
|
||||
[tabBarControl removeFromSuperviewWithoutNeedingDisplay];
|
||||
[tablineSeparator removeFromSuperviewWithoutNeedingDisplay];
|
||||
#endif
|
||||
[textView removeFromSuperviewWithoutNeedingDisplay];
|
||||
|
||||
unsigned i, count = [scrollbars count];
|
||||
@@ -325,17 +282,8 @@ NSMutableArray *buildMenuAddress(NSMenu *menu)
|
||||
|
||||
[self addNewTabViewItem];
|
||||
|
||||
// NOTE! This flag is set once the entire text system is set up.
|
||||
setupDone = YES;
|
||||
|
||||
#if !MM_USE_EMPTY_WINDOW
|
||||
BOOL statusOff = [[NSUserDefaults standardUserDefaults]
|
||||
boolForKey:MMStatuslineOffKey];
|
||||
[statusTextField setHidden:statusOff];
|
||||
[statusSeparator setHidden:statusOff];
|
||||
[self flashStatusText:@"Welcome to MacVim!"];
|
||||
#endif
|
||||
|
||||
[self updateResizeIncrements];
|
||||
[self resizeWindowToFit:self];
|
||||
[[self window] makeKeyAndOrderFront:self];
|
||||
@@ -422,37 +370,6 @@ NSMutableArray *buildMenuAddress(NSMenu *menu)
|
||||
shouldUpdateWindowSize = YES;
|
||||
}
|
||||
|
||||
- (void)setStatusText:(NSString *)text
|
||||
{
|
||||
#if !MM_USE_EMPTY_WINDOW
|
||||
if (text)
|
||||
[statusTextField setStringValue:text];
|
||||
else
|
||||
[statusTextField setStringValue:@""];
|
||||
#endif
|
||||
}
|
||||
|
||||
- (void)flashStatusText:(NSString *)text
|
||||
{
|
||||
#if !MM_USE_EMPTY_WINDOW
|
||||
if ([[NSUserDefaults standardUserDefaults] boolForKey:MMStatuslineOffKey])
|
||||
return;
|
||||
|
||||
[self setStatusText:text];
|
||||
|
||||
if (statusTimer) {
|
||||
[statusTimer invalidate];
|
||||
[statusTimer release];
|
||||
}
|
||||
|
||||
statusTimer = [[NSTimer scheduledTimerWithTimeInterval:3
|
||||
target:self
|
||||
selector:@selector(statusTimerFired:)
|
||||
userInfo:nil
|
||||
repeats:NO] retain];
|
||||
#endif
|
||||
}
|
||||
|
||||
- (void)createScrollbarWithIdentifier:(long)ident type:(int)type
|
||||
{
|
||||
//NSLog(@"Create scroller %d of type %d", ident, type);
|
||||
@@ -625,13 +542,6 @@ NSMutableArray *buildMenuAddress(NSMenu *menu)
|
||||
- (void)tabView:(NSTabView *)theTabView didSelectTabViewItem:
|
||||
(NSTabViewItem *)tabViewItem
|
||||
{
|
||||
#if !MM_USE_EMPTY_WINDOW
|
||||
// HACK! There seem to be a bug in NSTabView which results in the first
|
||||
// responder not being set to the view of the tab item so it is done
|
||||
// manually here.
|
||||
//[[self window] makeFirstResponder:[tabViewItem view]];
|
||||
#endif
|
||||
|
||||
// HACK! The selection message should not be propagated to the VimTask if
|
||||
// the VimTask selected the tab (e.g. as opposed the user clicking the
|
||||
// tab). The delegate method has no way of knowing who initiated the
|
||||
@@ -750,8 +660,6 @@ NSMutableArray *buildMenuAddress(NSMenu *menu)
|
||||
- (id)validRequestorForSendType:(NSString *)sendType
|
||||
returnType:(NSString *)returnType
|
||||
{
|
||||
//NSLog(@"validRequestorForSendType:%@ returnType:%@", sendType, returnType);
|
||||
|
||||
id backendProxy = [vimController backendProxy];
|
||||
|
||||
if ((!sendType || [sendType isEqual:NSStringPboardType])
|
||||
@@ -770,8 +678,6 @@ NSMutableArray *buildMenuAddress(NSMenu *menu)
|
||||
- (BOOL)writeSelectionToPasteboard:(NSPasteboard *)pboard
|
||||
types:(NSArray *)types
|
||||
{
|
||||
//NSLog(@"writeSelectionToPasteboard:%@ types:%@", pboard, types);
|
||||
|
||||
if (![types containsObject:NSStringPboardType])
|
||||
return NO;
|
||||
|
||||
@@ -946,13 +852,6 @@ NSMutableArray *buildMenuAddress(NSMenu *menu)
|
||||
return tvi;
|
||||
}
|
||||
|
||||
- (void)statusTimerFired:(NSTimer *)timer
|
||||
{
|
||||
[self setStatusText:@""];
|
||||
[statusTimer release];
|
||||
statusTimer = nil;
|
||||
}
|
||||
|
||||
- (int)representedIndexOfTabViewItem:(NSTabViewItem *)tvi
|
||||
{
|
||||
NSArray *tabViewItems = [tabBarControl representedTabViewItems];
|
||||
@@ -1029,13 +928,13 @@ NSMutableArray *buildMenuAddress(NSMenu *menu)
|
||||
boolForKey:MMStatuslineOffKey];
|
||||
|
||||
// HACK! Find the lowest left&right vertical scrollbars, as well as the
|
||||
// leftmost horizontal scrollbar. This hack continues further down.
|
||||
// rightmost horizontal scrollbar. This hack continues further down.
|
||||
//
|
||||
// TODO! Can there be no more than one horizontal scrollbar? If so, the
|
||||
// code can be simplified.
|
||||
unsigned lowestLeftSbIdx = (unsigned)-1;
|
||||
unsigned lowestRightSbIdx = (unsigned)-1;
|
||||
unsigned leftmostSbIdx = (unsigned)-1;
|
||||
unsigned rightmostSbIdx = (unsigned)-1;
|
||||
unsigned rowMaxLeft = 0, rowMaxRight = 0, colMax = 0;
|
||||
unsigned i, count = [scrollbars count];
|
||||
for (i = 0; i < count; ++i) {
|
||||
@@ -1053,7 +952,7 @@ NSMutableArray *buildMenuAddress(NSMenu *menu)
|
||||
} else if ([scroller type] == MMScrollerTypeBottom
|
||||
&& range.location >= colMax) {
|
||||
colMax = range.location;
|
||||
leftmostSbIdx = i;
|
||||
rightmostSbIdx = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1073,10 +972,10 @@ NSMutableArray *buildMenuAddress(NSMenu *menu)
|
||||
if (lsbVisible)
|
||||
rect.origin.x += [NSScroller scrollerWidth];
|
||||
|
||||
// HACK! Make sure the leftmost horizontal scrollbar covers the
|
||||
// HACK! Make sure the rightmost horizontal scrollbar covers the
|
||||
// text view all the way to the right, otherwise it looks ugly when
|
||||
// the user drags the window to resize.
|
||||
if (i == leftmostSbIdx) {
|
||||
if (i == rightmostSbIdx) {
|
||||
float w = NSMaxX(textViewFrame) - NSMaxX(rect);
|
||||
if (w > 0)
|
||||
rect.size.width += w;
|
||||
@@ -1177,9 +1076,6 @@ NSMutableArray *buildMenuAddress(NSMenu *menu)
|
||||
[textStorage fitToSize:tsSize rows:&dim[0] columns:&dim[1]];
|
||||
|
||||
if (dim[0] != rows || dim[1] != cols) {
|
||||
NSString *sdim = [NSString stringWithFormat:@"%dx%d", dim[1], dim[0]];
|
||||
[self flashStatusText:sdim];
|
||||
|
||||
//NSLog(@"Notify Vim that text storage dimensions changed to %dx%d",
|
||||
// dim[0], dim[1]);
|
||||
NSData *data = [NSData dataWithBytes:dim length:2*sizeof(int)];
|
||||
|
||||
@@ -36,10 +36,11 @@
|
||||
- (oneway void)showSavePanelForDirectory:(in bycopy NSString *)dir
|
||||
title:(in bycopy NSString *)title
|
||||
saving:(int)saving;
|
||||
- (oneway void)presentDialogWithStyle:(int)style message:(NSString *)message
|
||||
informativeText:(NSString *)text
|
||||
buttonTitles:(NSArray *)buttonTitles
|
||||
textFieldString:(NSString *)textFieldString;
|
||||
- (oneway void)presentDialogWithStyle:(int)style
|
||||
message:(in bycopy NSString *)message
|
||||
informativeText:(in bycopy NSString *)text
|
||||
buttonTitles:(in bycopy NSArray *)buttonTitles
|
||||
textFieldString:(in bycopy NSString *)textFieldString;
|
||||
@end
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user