mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-10-25 17:45:36 +00:00
nib2cib ignored the text view's Uses Ruler setting, and CPTextView, CPRulerView and CPRulerMarker archived none of their ruler state, so a ruler could not be configured in Interface Builder or survive archiving. * CPScrollView.j: Set itself as the scroll view of decoded rulers. * CPTextView/CPRulerMarker.j: Archive the marker's ruler, location, image and image origin, movability, removability and represented object. * CPTextView/CPRulerView.j: Archive the ruler's orientation, client view, accessory view, markers, thicknesses, origin offset and measurement units. * CPTextView/CPTextView.j: Archive usesRuler. * Tools/nib2cib/NSTextView.j, Tools/nib2cib/NSTextViewSharedData.j: Read the Uses Ruler flag. * Tests/AppKit/CPRulerViewTest.j: Add tests for ruler layout, measurement units, archiving and the Uses Ruler setting. * Tests/Manual/TextEditor/Resources/MainMenu.xib, Resources/MainMenu.cib: Add the standard Format menu, whose Text submenu shows and hides the ruler. * Tests/Manual/TextEditor/Resources/DocumentWindow.xib, Resources/DocumentWindow.cib: Rebuild the cib with the ruler setting, and adjust the window's initial position.
103 lines
2.8 KiB
Plaintext
103 lines
2.8 KiB
Plaintext
/*
|
|
* NSTextView.j
|
|
* nib2cib
|
|
*
|
|
* Created by Alexendre Wilhelm.
|
|
* Copyright 2014 The Cappuccino Foundation.
|
|
*
|
|
* This library is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
* License as published by the Free Software Foundation; either
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
*
|
|
* This library is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
* Lesser General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
* License along with this library; if not, write to the Free Software
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
*/
|
|
|
|
@import <Foundation/Foundation.j>
|
|
@import <AppKit/CPColor.j>
|
|
@import <AppKit/CPParagraphStyle.j>
|
|
|
|
@class Nib2Cib
|
|
|
|
@implementation CPTextViewSharedData : CPObject
|
|
{
|
|
BOOL _allowsUndo @accessors(getter=allowsUndo);
|
|
BOOL _editable @accessors(getter=isEditable);
|
|
BOOL _richText @accessors(getter=isRichText);
|
|
BOOL _selectable @accessors(getter=isSelectable);
|
|
BOOL _usesFontPanel @accessors(getter=usesFontPanel);
|
|
BOOL _usesRuler @accessors(getter=usesRuler);
|
|
CPColor _backgroundColor @accessors(getter=backgroundColor);
|
|
CPColor _insertionColor @accessors(getter=insertionColor);
|
|
CPDictionary _selectedTextAttributes @accessors(getter=selectedTextAttributes);
|
|
}
|
|
|
|
- (id)init
|
|
{
|
|
if (self = [super init])
|
|
{
|
|
|
|
}
|
|
|
|
return self;
|
|
}
|
|
|
|
@end
|
|
|
|
|
|
@implementation CPTextViewSharedData (NSCoding)
|
|
|
|
- (id)NS_initWithCoder:(CPCoder)aCoder
|
|
{
|
|
if (self = [super init])
|
|
{
|
|
var flags = [aCoder decodeIntForKey:@"NSFlags"];
|
|
|
|
_allowsUndo = (flags & 0x0000400) ? YES : NO;
|
|
_editable = (flags & 0x00000002) ? YES : NO;
|
|
_richText = (flags & 0x00000004) ? YES : NO;
|
|
_selectable = (flags & 0x00000001) ? YES : NO;
|
|
_usesFontPanel = (flags & 0x00000020) ? YES : NO;
|
|
_usesRuler = (flags & 0x00000040) ? YES : NO;
|
|
|
|
_backgroundColor = [aCoder decodeObjectForKey:@"NSBackgroundColor"];
|
|
_insertionColor = [aCoder decodeObjectForKey:@"NSInsertionColor"];
|
|
_selectedTextAttributes = [aCoder decodeObjectForKey:@"NSSelectedAttributes"];
|
|
}
|
|
|
|
return self;
|
|
}
|
|
|
|
@end
|
|
|
|
@implementation NSTextViewSharedData : CPTextViewSharedData
|
|
{
|
|
|
|
}
|
|
|
|
- (id)initWithCoder:(CPCoder)aCoder
|
|
{
|
|
self = [self NS_initWithCoder:aCoder];
|
|
|
|
if (self)
|
|
{
|
|
|
|
}
|
|
|
|
return self;
|
|
}
|
|
|
|
- (Class)classForKeyedArchiver
|
|
{
|
|
return [CPTextViewSharedData class];
|
|
}
|
|
|
|
@end
|