mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-14 18:51:05 +00:00
In [setWidthTracksTextView:] and
[setHeightTracksTextView:] make sure that the view post changes and that notifications are only send once. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@8038 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
07b28f97da
commit
cd85ae9c86
1 changed files with 17 additions and 2 deletions
|
@ -137,6 +137,8 @@
|
||||||
if (_textView)
|
if (_textView)
|
||||||
{
|
{
|
||||||
[_textView setTextContainer: nil];
|
[_textView setTextContainer: nil];
|
||||||
|
// May we realy switch this off, as somebody else might be listening
|
||||||
|
// to those notifications?
|
||||||
[_textView setPostsFrameChangedNotifications: NO];
|
[_textView setPostsFrameChangedNotifications: NO];
|
||||||
[nc removeObserver: self name: NSViewFrameDidChangeNotification
|
[nc removeObserver: self name: NSViewFrameDidChangeNotification
|
||||||
object: _textView];
|
object: _textView];
|
||||||
|
@ -182,15 +184,22 @@
|
||||||
- (void) setWidthTracksTextView: (BOOL)flag
|
- (void) setWidthTracksTextView: (BOOL)flag
|
||||||
{
|
{
|
||||||
NSNotificationCenter *nc;
|
NSNotificationCenter *nc;
|
||||||
nc = [NSNotificationCenter defaultCenter];
|
BOOL old_observing = _observingFrameChanges;
|
||||||
|
|
||||||
_widthTracksTextView = flag;
|
_widthTracksTextView = flag;
|
||||||
_observingFrameChanges = _widthTracksTextView | _heightTracksTextView;
|
_observingFrameChanges = _widthTracksTextView | _heightTracksTextView;
|
||||||
|
|
||||||
if (_textView == nil)
|
if (_textView == nil)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (_observingFrameChanges == old_observing)
|
||||||
|
return;
|
||||||
|
|
||||||
|
nc = [NSNotificationCenter defaultCenter];
|
||||||
|
|
||||||
if (_observingFrameChanges)
|
if (_observingFrameChanges)
|
||||||
{
|
{
|
||||||
|
[_textView setPostsFrameChangedNotifications: YES];
|
||||||
[nc addObserver: self
|
[nc addObserver: self
|
||||||
selector: @selector(_textViewFrameChanged:)
|
selector: @selector(_textViewFrameChanged:)
|
||||||
name: NSViewFrameDidChangeNotification
|
name: NSViewFrameDidChangeNotification
|
||||||
|
@ -211,15 +220,21 @@
|
||||||
- (void) setHeightTracksTextView: (BOOL)flag
|
- (void) setHeightTracksTextView: (BOOL)flag
|
||||||
{
|
{
|
||||||
NSNotificationCenter *nc;
|
NSNotificationCenter *nc;
|
||||||
nc = [NSNotificationCenter defaultCenter];
|
BOOL old_observing = _observingFrameChanges;
|
||||||
|
|
||||||
_heightTracksTextView = flag;
|
_heightTracksTextView = flag;
|
||||||
_observingFrameChanges = _widthTracksTextView | _heightTracksTextView;
|
_observingFrameChanges = _widthTracksTextView | _heightTracksTextView;
|
||||||
if (_textView == nil)
|
if (_textView == nil)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (_observingFrameChanges == old_observing)
|
||||||
|
return;
|
||||||
|
|
||||||
|
nc = [NSNotificationCenter defaultCenter];
|
||||||
|
|
||||||
if (_observingFrameChanges)
|
if (_observingFrameChanges)
|
||||||
{
|
{
|
||||||
|
[_textView setPostsFrameChangedNotifications: YES];
|
||||||
[nc addObserver: self
|
[nc addObserver: self
|
||||||
selector: @selector(_textViewFrameChanged:)
|
selector: @selector(_textViewFrameChanged:)
|
||||||
name: NSViewFrameDidChangeNotification
|
name: NSViewFrameDidChangeNotification
|
||||||
|
|
Loading…
Reference in a new issue