mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 12:00:52 +00:00
Phase out the wraps NSCell attribute, since it is implied by the
lineBreakMode attribute. Note that with this change cells now wrap by default, as has always been the case on OS X. Also fix a related inconsistency where text that is wrapped by the cell was displayed in a single line during editing. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@29134 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
786f376f1b
commit
8b97af9ed3
5 changed files with 46 additions and 9 deletions
17
ChangeLog
17
ChangeLog
|
@ -1,3 +1,20 @@
|
|||
2009-12-17 Wolfgang Lux <wolfgang.lux@gmail.com>
|
||||
|
||||
* Source/NSCell.m (-wraps, -setWraps:, -setLineBreakMode:,
|
||||
-initWithCoder:): Phase out the wraps cell attribute since it is
|
||||
implied by the lineBreakMode attribute. Note that with this change
|
||||
cells now wrap by default, as has always been the case on OS X.
|
||||
|
||||
* Source/NSBrowserCell.m (-initTextCell:, -initImageCell:):
|
||||
* Source/NSTableColumn.m (-initWithIdentifier): Set default line
|
||||
break mode to NSLineBreakByTruncatingTail as on OS X.
|
||||
|
||||
* Source/NSCell.m (-setUpFieldEditorAttributes:): Set the typing
|
||||
attributes of the field editor so that it uses the same paragraph
|
||||
style and in particular the same line break mode as the edited
|
||||
cell. This fixes an inconsistency where wrapped text would be
|
||||
displayed in a single line during editing.
|
||||
|
||||
2009-12-17 Wolfgang Lux <wolfgang.lux@gmail.com>
|
||||
|
||||
* Source/NSCell.m (-_setupTextWithFrame:inView:editor:delegate:range):
|
||||
|
|
|
@ -140,7 +140,7 @@ enum {
|
|||
unsigned is_bordered: 1;
|
||||
unsigned is_bezeled: 1;
|
||||
unsigned is_scrollable: 1;
|
||||
unsigned wraps: 1;
|
||||
unsigned reserved: 1;
|
||||
unsigned text_align: 3; // 5 values
|
||||
unsigned is_selectable: 1;
|
||||
unsigned allows_mixed_state: 1;
|
||||
|
|
|
@ -109,6 +109,7 @@ static NSFont *_leafFont;
|
|||
//_alternateImage = nil;
|
||||
//_browsercell_is_leaf = NO;
|
||||
//_browsercell_is_loaded = NO;
|
||||
[self setLineBreakMode: NSLineBreakByTruncatingTail];
|
||||
|
||||
if (_gsFontifyCells)
|
||||
[self setFont: _nonLeafFont];
|
||||
|
@ -122,6 +123,7 @@ static NSFont *_leafFont;
|
|||
//_alternateImage = nil;
|
||||
//_browsercell_is_leaf = NO;
|
||||
//_browsercell_is_loaded = NO;
|
||||
[self setLineBreakMode: NSLineBreakByTruncatingTail];
|
||||
|
||||
if (_gsFontifyCells)
|
||||
[self setFont: _nonLeafFont];
|
||||
|
|
|
@ -173,6 +173,7 @@ static NSColor *dtxtCol;
|
|||
//_cell.is_scrollable = NO;
|
||||
//_cell.is_selectable = NO;
|
||||
//_cell.state = 0;
|
||||
//_cell.line_break_mode = NSLineBreakByWordWrapping;
|
||||
_action_mask = NSLeftMouseUpMask;
|
||||
_menu = [isa defaultMenu];
|
||||
[self setFocusRingType: [isa defaultFocusRingType]];
|
||||
|
@ -203,6 +204,7 @@ static NSColor *dtxtCol;
|
|||
//_cell.is_bezeled = NO;
|
||||
//_cell.is_scrollable = NO;
|
||||
//_cell.is_selectable = NO;
|
||||
//_cell.line_break_mode = NSLineBreakByWordWrapping;
|
||||
_action_mask = NSLeftMouseUpMask;
|
||||
_menu = [isa defaultMenu];
|
||||
[self setFocusRingType: [isa defaultFocusRingType]];
|
||||
|
@ -935,22 +937,22 @@ static NSColor *dtxtCol;
|
|||
|
||||
- (void) setWraps: (BOOL)flag
|
||||
{
|
||||
_cell.wraps = flag;
|
||||
|
||||
if (flag)
|
||||
{
|
||||
_cell.is_scrollable = NO;
|
||||
[self setLineBreakMode: NSLineBreakByWordWrapping];
|
||||
if (![self wraps])
|
||||
[self setLineBreakMode: NSLineBreakByWordWrapping];
|
||||
}
|
||||
else
|
||||
{
|
||||
[self setLineBreakMode: NSLineBreakByClipping];
|
||||
if ([self wraps])
|
||||
[self setLineBreakMode: NSLineBreakByClipping];
|
||||
}
|
||||
}
|
||||
|
||||
- (BOOL) wraps
|
||||
{
|
||||
return _cell.wraps;
|
||||
return _cell.line_break_mode == NSLineBreakByWordWrapping
|
||||
|| _cell.line_break_mode == NSLineBreakByCharWrapping;
|
||||
}
|
||||
|
||||
- (void) setAttributedStringValue: (NSAttributedString*)attribStr
|
||||
|
@ -1056,6 +1058,10 @@ static NSColor *dtxtCol;
|
|||
|
||||
- (void) setLineBreakMode: (NSLineBreakMode)mode
|
||||
{
|
||||
if (mode == NSLineBreakByCharWrapping || mode == NSLineBreakByWordWrapping)
|
||||
{
|
||||
_cell.is_scrollable = NO;
|
||||
}
|
||||
_cell.line_break_mode = mode;
|
||||
}
|
||||
|
||||
|
@ -2098,6 +2104,9 @@ static NSColor *dtxtCol;
|
|||
[textObject setRichText: [self allowsEditingTextAttributes]];
|
||||
[textObject setImportsGraphics: [self importsGraphics]];
|
||||
[(NSTextView*)textObject setAllowsUndo: [self allowsUndo]];
|
||||
NSDictionary *attr = [self _nonAutoreleasedTypingAttributes];
|
||||
[(NSTextView*)textObject setTypingAttributes: attr];
|
||||
RELEASE(attr);
|
||||
|
||||
return textObject;
|
||||
}
|
||||
|
@ -2534,7 +2543,7 @@ static NSColor *dtxtCol;
|
|||
}
|
||||
else
|
||||
{
|
||||
BOOL flag;
|
||||
BOOL flag, wraps;
|
||||
unsigned int tmp_int;
|
||||
id formatter, menu;
|
||||
int version = [aDecoder versionForClassName: @"NSCell"];
|
||||
|
@ -2575,7 +2584,9 @@ static NSColor *dtxtCol;
|
|||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &flag];
|
||||
_cell.allows_mixed_state = flag;
|
||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &flag];
|
||||
_cell.wraps = flag;
|
||||
/* The wraps attribute has been superseded by lineBreakMode. However,
|
||||
we may need it to set lineBreakMode when reading old archives. */
|
||||
wraps = flag;
|
||||
[aDecoder decodeValueOfObjCType: @encode(unsigned int) at: &tmp_int];
|
||||
_cell.text_align = tmp_int;
|
||||
[aDecoder decodeValueOfObjCType: @encode(unsigned int) at: &tmp_int];
|
||||
|
@ -2717,6 +2728,12 @@ static NSColor *dtxtCol;
|
|||
[aDecoder decodeValueOfObjCType: @encode(unsigned int) at: &tmp_int];
|
||||
_cell.base_writing_direction = tmp_int;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Backward compatibility: Derive lineBreakMode from the superseded
|
||||
wraps attribute. */
|
||||
[self setWraps: wraps];
|
||||
}
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
|
|
@ -114,6 +114,7 @@
|
|||
|
||||
_headerCell = [NSTableHeaderCell new];
|
||||
_dataCell = [NSTextFieldCell new];
|
||||
[_dataCell setLineBreakMode: NSLineBreakByTruncatingTail];
|
||||
_headerToolTip = nil;
|
||||
|
||||
_sortDescriptorPrototype = nil;
|
||||
|
|
Loading…
Reference in a new issue