From 5bc6d68fa3b3a44d181283cd93cb728860e9facb Mon Sep 17 00:00:00 2001 From: Bjorn Winckler Date: Sun, 26 Aug 2007 14:07:04 +0000 Subject: [PATCH] The font panel is updated when the font changes. git-svn-id: http://macvim.googlecode.com/svn/trunk@200 96c4425d-ca35-0410-94e5-3396d5c13a8f --- MMTextView.m | 37 +++++++++++++++++++++---------------- MMWindowController.m | 1 + 2 files changed, 22 insertions(+), 16 deletions(-) diff --git a/MMTextView.m b/MMTextView.m index 7ed96f43b9..88ca43146a 100644 --- a/MMTextView.m +++ b/MMTextView.m @@ -129,6 +129,21 @@ static float MMDragAreaSize = 73.0f; } } +- (void)keyDown:(NSEvent *)event +{ + // HACK! If a modifier is held, don't pass the event along to + // interpretKeyEvents: since some keys are bound to multiple commands which + // means doCommandBySelector: is called several times. + // + // TODO: Figure out a way to disable Cocoa key bindings entirely, without + // affecting input management. + + if ([event modifierFlags] & NSControlKeyMask) + [self dispatchKeyEvent:event]; + else + [super keyDown:event]; +} + - (void)insertText:(id)string { // NOTE! This method is called for normal key presses but also for @@ -526,7 +541,12 @@ static float MMDragAreaSize = 73.0f; - (void)resetCursorRects { - // No need to set up cursor rects...Vim is in control of cursor changes. + // No need to set up cursor rects since Vim handles cursor changes. +} + +- (void)updateFontPanel +{ + // The font panel is updated whenever the font is set. } @end // MMTextView @@ -592,21 +612,6 @@ static float MMDragAreaSize = 73.0f; return rect; } -- (void)keyDown:(NSEvent *)event -{ - // HACK! If a modifier is held, don't pass the event along to - // interpretKeyEvents: since some keys are bound to multiple commands which - // means doCommandBySelector: is called several times. - // - // TODO: Figure out a way to disable Cocoa key bindings entirely, without - // affecting input management. - - if ([event modifierFlags] & NSControlKeyMask) - [self dispatchKeyEvent:event]; - else - [super keyDown:event]; -} - - (void)dispatchKeyEvent:(NSEvent *)event { // Only handle the command if it came from a keyDown event diff --git a/MMWindowController.m b/MMWindowController.m index baef30b1db..d4a9b4192e 100644 --- a/MMWindowController.m +++ b/MMWindowController.m @@ -452,6 +452,7 @@ NSMutableArray *buildMenuAddress(NSMenu *menu) - (void)setFont:(NSFont *)font { + [[NSFontManager sharedFontManager] setSelectedFont:font isMultiple:NO]; [textStorage setFont:font]; [self updateResizeIncrements]; }