mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-07 21:43:24 +00:00
Register for undo/redo notifications so we can hide the suggestions
list. Fixes the urlbar font size. (bug 159606)
This commit is contained in:
parent
14da5c905d
commit
ef17840fcd
@ -85,6 +85,7 @@
|
|||||||
- (void) onRowClicked:(NSNotification *)aNote;
|
- (void) onRowClicked:(NSNotification *)aNote;
|
||||||
- (void) onBlur:(NSNotification *)aNote;
|
- (void) onBlur:(NSNotification *)aNote;
|
||||||
- (void) onResize:(NSNotification *)aNote;
|
- (void) onResize:(NSNotification *)aNote;
|
||||||
|
- (void) onUndoOrRedo:(NSNotification *)aNote;
|
||||||
|
|
||||||
- (void) setStringUndoably:(NSString*)aString fromLocation:(unsigned int)aLocation;
|
- (void) setStringUndoably:(NSString*)aString fromLocation:(unsigned int)aLocation;
|
||||||
- (id) fieldEditor;
|
- (id) fieldEditor;
|
||||||
|
@ -91,6 +91,7 @@ NS_IMPL_ISUPPORTS1(AutoCompleteListener, nsIAutoCompleteListener)
|
|||||||
mListener = (nsIAutoCompleteListener *)new AutoCompleteListener(self);
|
mListener = (nsIAutoCompleteListener *)new AutoCompleteListener(self);
|
||||||
NS_IF_ADDREF(mListener);
|
NS_IF_ADDREF(mListener);
|
||||||
|
|
||||||
|
[self setFont:[NSFont controlContentFontOfSize:0]];
|
||||||
[self setDelegate: self];
|
[self setDelegate: self];
|
||||||
|
|
||||||
// XXX the owner of the textfield should set this
|
// XXX the owner of the textfield should set this
|
||||||
@ -151,6 +152,14 @@ NS_IMPL_ISUPPORTS1(AutoCompleteListener, nsIAutoCompleteListener)
|
|||||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onResize:)
|
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onResize:)
|
||||||
name:NSWindowDidResizeNotification object:nil];
|
name:NSWindowDidResizeNotification object:nil];
|
||||||
|
|
||||||
|
// listen for Undo/Redo to make sure autocomplete doesn't get horked.
|
||||||
|
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onUndoOrRedo:)
|
||||||
|
name:NSUndoManagerDidRedoChangeNotification
|
||||||
|
object:[[self fieldEditor] undoManager]];
|
||||||
|
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onUndoOrRedo:)
|
||||||
|
name:NSUndoManagerDidUndoChangeNotification
|
||||||
|
object:[[self fieldEditor] undoManager]];
|
||||||
|
|
||||||
// read the user default on if we should auto-complete the text field as the user
|
// read the user default on if we should auto-complete the text field as the user
|
||||||
// types or make them pick something from a list (a-la mozilla).
|
// types or make them pick something from a list (a-la mozilla).
|
||||||
mCompleteWhileTyping = [[NSUserDefaults standardUserDefaults] boolForKey:USER_DEFAULTS_AUTOCOMPLETE_WHILE_TYPING];
|
mCompleteWhileTyping = [[NSUserDefaults standardUserDefaults] boolForKey:USER_DEFAULTS_AUTOCOMPLETE_WHILE_TYPING];
|
||||||
@ -501,6 +510,11 @@ NS_IMPL_ISUPPORTS1(AutoCompleteListener, nsIAutoCompleteListener)
|
|||||||
[self resizePopup];
|
[self resizePopup];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void) onUndoOrRedo:(NSNotification *)aNote
|
||||||
|
{
|
||||||
|
[self clearResults];
|
||||||
|
}
|
||||||
|
|
||||||
// NSTextField delegate //////////////////////////////////
|
// NSTextField delegate //////////////////////////////////
|
||||||
- (void)controlTextDidChange:(NSNotification *)aNote
|
- (void)controlTextDidChange:(NSNotification *)aNote
|
||||||
{
|
{
|
||||||
|
@ -85,6 +85,7 @@
|
|||||||
- (void) onRowClicked:(NSNotification *)aNote;
|
- (void) onRowClicked:(NSNotification *)aNote;
|
||||||
- (void) onBlur:(NSNotification *)aNote;
|
- (void) onBlur:(NSNotification *)aNote;
|
||||||
- (void) onResize:(NSNotification *)aNote;
|
- (void) onResize:(NSNotification *)aNote;
|
||||||
|
- (void) onUndoOrRedo:(NSNotification *)aNote;
|
||||||
|
|
||||||
- (void) setStringUndoably:(NSString*)aString fromLocation:(unsigned int)aLocation;
|
- (void) setStringUndoably:(NSString*)aString fromLocation:(unsigned int)aLocation;
|
||||||
- (id) fieldEditor;
|
- (id) fieldEditor;
|
||||||
|
@ -91,6 +91,7 @@ NS_IMPL_ISUPPORTS1(AutoCompleteListener, nsIAutoCompleteListener)
|
|||||||
mListener = (nsIAutoCompleteListener *)new AutoCompleteListener(self);
|
mListener = (nsIAutoCompleteListener *)new AutoCompleteListener(self);
|
||||||
NS_IF_ADDREF(mListener);
|
NS_IF_ADDREF(mListener);
|
||||||
|
|
||||||
|
[self setFont:[NSFont controlContentFontOfSize:0]];
|
||||||
[self setDelegate: self];
|
[self setDelegate: self];
|
||||||
|
|
||||||
// XXX the owner of the textfield should set this
|
// XXX the owner of the textfield should set this
|
||||||
@ -151,6 +152,14 @@ NS_IMPL_ISUPPORTS1(AutoCompleteListener, nsIAutoCompleteListener)
|
|||||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onResize:)
|
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onResize:)
|
||||||
name:NSWindowDidResizeNotification object:nil];
|
name:NSWindowDidResizeNotification object:nil];
|
||||||
|
|
||||||
|
// listen for Undo/Redo to make sure autocomplete doesn't get horked.
|
||||||
|
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onUndoOrRedo:)
|
||||||
|
name:NSUndoManagerDidRedoChangeNotification
|
||||||
|
object:[[self fieldEditor] undoManager]];
|
||||||
|
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onUndoOrRedo:)
|
||||||
|
name:NSUndoManagerDidUndoChangeNotification
|
||||||
|
object:[[self fieldEditor] undoManager]];
|
||||||
|
|
||||||
// read the user default on if we should auto-complete the text field as the user
|
// read the user default on if we should auto-complete the text field as the user
|
||||||
// types or make them pick something from a list (a-la mozilla).
|
// types or make them pick something from a list (a-la mozilla).
|
||||||
mCompleteWhileTyping = [[NSUserDefaults standardUserDefaults] boolForKey:USER_DEFAULTS_AUTOCOMPLETE_WHILE_TYPING];
|
mCompleteWhileTyping = [[NSUserDefaults standardUserDefaults] boolForKey:USER_DEFAULTS_AUTOCOMPLETE_WHILE_TYPING];
|
||||||
@ -501,6 +510,11 @@ NS_IMPL_ISUPPORTS1(AutoCompleteListener, nsIAutoCompleteListener)
|
|||||||
[self resizePopup];
|
[self resizePopup];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void) onUndoOrRedo:(NSNotification *)aNote
|
||||||
|
{
|
||||||
|
[self clearResults];
|
||||||
|
}
|
||||||
|
|
||||||
// NSTextField delegate //////////////////////////////////
|
// NSTextField delegate //////////////////////////////////
|
||||||
- (void)controlTextDidChange:(NSNotification *)aNote
|
- (void)controlTextDidChange:(NSNotification *)aNote
|
||||||
{
|
{
|
||||||
|
@ -85,6 +85,7 @@
|
|||||||
- (void) onRowClicked:(NSNotification *)aNote;
|
- (void) onRowClicked:(NSNotification *)aNote;
|
||||||
- (void) onBlur:(NSNotification *)aNote;
|
- (void) onBlur:(NSNotification *)aNote;
|
||||||
- (void) onResize:(NSNotification *)aNote;
|
- (void) onResize:(NSNotification *)aNote;
|
||||||
|
- (void) onUndoOrRedo:(NSNotification *)aNote;
|
||||||
|
|
||||||
- (void) setStringUndoably:(NSString*)aString fromLocation:(unsigned int)aLocation;
|
- (void) setStringUndoably:(NSString*)aString fromLocation:(unsigned int)aLocation;
|
||||||
- (id) fieldEditor;
|
- (id) fieldEditor;
|
||||||
|
@ -91,6 +91,7 @@ NS_IMPL_ISUPPORTS1(AutoCompleteListener, nsIAutoCompleteListener)
|
|||||||
mListener = (nsIAutoCompleteListener *)new AutoCompleteListener(self);
|
mListener = (nsIAutoCompleteListener *)new AutoCompleteListener(self);
|
||||||
NS_IF_ADDREF(mListener);
|
NS_IF_ADDREF(mListener);
|
||||||
|
|
||||||
|
[self setFont:[NSFont controlContentFontOfSize:0]];
|
||||||
[self setDelegate: self];
|
[self setDelegate: self];
|
||||||
|
|
||||||
// XXX the owner of the textfield should set this
|
// XXX the owner of the textfield should set this
|
||||||
@ -151,6 +152,14 @@ NS_IMPL_ISUPPORTS1(AutoCompleteListener, nsIAutoCompleteListener)
|
|||||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onResize:)
|
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onResize:)
|
||||||
name:NSWindowDidResizeNotification object:nil];
|
name:NSWindowDidResizeNotification object:nil];
|
||||||
|
|
||||||
|
// listen for Undo/Redo to make sure autocomplete doesn't get horked.
|
||||||
|
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onUndoOrRedo:)
|
||||||
|
name:NSUndoManagerDidRedoChangeNotification
|
||||||
|
object:[[self fieldEditor] undoManager]];
|
||||||
|
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onUndoOrRedo:)
|
||||||
|
name:NSUndoManagerDidUndoChangeNotification
|
||||||
|
object:[[self fieldEditor] undoManager]];
|
||||||
|
|
||||||
// read the user default on if we should auto-complete the text field as the user
|
// read the user default on if we should auto-complete the text field as the user
|
||||||
// types or make them pick something from a list (a-la mozilla).
|
// types or make them pick something from a list (a-la mozilla).
|
||||||
mCompleteWhileTyping = [[NSUserDefaults standardUserDefaults] boolForKey:USER_DEFAULTS_AUTOCOMPLETE_WHILE_TYPING];
|
mCompleteWhileTyping = [[NSUserDefaults standardUserDefaults] boolForKey:USER_DEFAULTS_AUTOCOMPLETE_WHILE_TYPING];
|
||||||
@ -501,6 +510,11 @@ NS_IMPL_ISUPPORTS1(AutoCompleteListener, nsIAutoCompleteListener)
|
|||||||
[self resizePopup];
|
[self resizePopup];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void) onUndoOrRedo:(NSNotification *)aNote
|
||||||
|
{
|
||||||
|
[self clearResults];
|
||||||
|
}
|
||||||
|
|
||||||
// NSTextField delegate //////////////////////////////////
|
// NSTextField delegate //////////////////////////////////
|
||||||
- (void)controlTextDidChange:(NSNotification *)aNote
|
- (void)controlTextDidChange:(NSNotification *)aNote
|
||||||
{
|
{
|
||||||
|
@ -85,6 +85,7 @@
|
|||||||
- (void) onRowClicked:(NSNotification *)aNote;
|
- (void) onRowClicked:(NSNotification *)aNote;
|
||||||
- (void) onBlur:(NSNotification *)aNote;
|
- (void) onBlur:(NSNotification *)aNote;
|
||||||
- (void) onResize:(NSNotification *)aNote;
|
- (void) onResize:(NSNotification *)aNote;
|
||||||
|
- (void) onUndoOrRedo:(NSNotification *)aNote;
|
||||||
|
|
||||||
- (void) setStringUndoably:(NSString*)aString fromLocation:(unsigned int)aLocation;
|
- (void) setStringUndoably:(NSString*)aString fromLocation:(unsigned int)aLocation;
|
||||||
- (id) fieldEditor;
|
- (id) fieldEditor;
|
||||||
|
@ -91,6 +91,7 @@ NS_IMPL_ISUPPORTS1(AutoCompleteListener, nsIAutoCompleteListener)
|
|||||||
mListener = (nsIAutoCompleteListener *)new AutoCompleteListener(self);
|
mListener = (nsIAutoCompleteListener *)new AutoCompleteListener(self);
|
||||||
NS_IF_ADDREF(mListener);
|
NS_IF_ADDREF(mListener);
|
||||||
|
|
||||||
|
[self setFont:[NSFont controlContentFontOfSize:0]];
|
||||||
[self setDelegate: self];
|
[self setDelegate: self];
|
||||||
|
|
||||||
// XXX the owner of the textfield should set this
|
// XXX the owner of the textfield should set this
|
||||||
@ -151,6 +152,14 @@ NS_IMPL_ISUPPORTS1(AutoCompleteListener, nsIAutoCompleteListener)
|
|||||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onResize:)
|
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onResize:)
|
||||||
name:NSWindowDidResizeNotification object:nil];
|
name:NSWindowDidResizeNotification object:nil];
|
||||||
|
|
||||||
|
// listen for Undo/Redo to make sure autocomplete doesn't get horked.
|
||||||
|
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onUndoOrRedo:)
|
||||||
|
name:NSUndoManagerDidRedoChangeNotification
|
||||||
|
object:[[self fieldEditor] undoManager]];
|
||||||
|
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onUndoOrRedo:)
|
||||||
|
name:NSUndoManagerDidUndoChangeNotification
|
||||||
|
object:[[self fieldEditor] undoManager]];
|
||||||
|
|
||||||
// read the user default on if we should auto-complete the text field as the user
|
// read the user default on if we should auto-complete the text field as the user
|
||||||
// types or make them pick something from a list (a-la mozilla).
|
// types or make them pick something from a list (a-la mozilla).
|
||||||
mCompleteWhileTyping = [[NSUserDefaults standardUserDefaults] boolForKey:USER_DEFAULTS_AUTOCOMPLETE_WHILE_TYPING];
|
mCompleteWhileTyping = [[NSUserDefaults standardUserDefaults] boolForKey:USER_DEFAULTS_AUTOCOMPLETE_WHILE_TYPING];
|
||||||
@ -501,6 +510,11 @@ NS_IMPL_ISUPPORTS1(AutoCompleteListener, nsIAutoCompleteListener)
|
|||||||
[self resizePopup];
|
[self resizePopup];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void) onUndoOrRedo:(NSNotification *)aNote
|
||||||
|
{
|
||||||
|
[self clearResults];
|
||||||
|
}
|
||||||
|
|
||||||
// NSTextField delegate //////////////////////////////////
|
// NSTextField delegate //////////////////////////////////
|
||||||
- (void)controlTextDidChange:(NSNotification *)aNote
|
- (void)controlTextDidChange:(NSNotification *)aNote
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user