mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-10-10 10:42:19 +00:00
Deploying to gh-pages from @ cappuccino/cappuccino@b296f17d2b 🚀
This commit is contained in:
1 parent
6d46a04866
commit
791d2cf64d
4 files changed
+3265
-767
No files matched your search
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -8,33 +8,41 @@
|
||||
@import <Foundation/Foundation.j>
|
||||
@import <AppKit/CPTextView.j>
|
||||
@import <AppKit/CPFontPanel.j>
|
||||
@import <AppKit/CPRulerView.j>
|
||||
@import <AppKit/CPSplitView.j>
|
||||
@import <AppKit/CPButton.j>
|
||||
@import <AppKit/CPTextField.j>
|
||||
@import <AppKit/CPScrollView.j>
|
||||
@import <AppKit/CPParagraphStyle.j>
|
||||
|
||||
@implementation AppController : CPObject
|
||||
{
|
||||
CPTextView _textView;
|
||||
CPTextView _textView2;
|
||||
CPTextView _textView;
|
||||
CPTextView _textView2;
|
||||
CPScrollView _scrollView;
|
||||
CPScrollView _scrollView2;
|
||||
}
|
||||
|
||||
|
||||
|
||||
- (void) openSheet:(id)sender
|
||||
- (void)openSheet:(id)sender
|
||||
{
|
||||
var plusPopover =[CPPopover new];
|
||||
var plusPopover = [CPPopover new];
|
||||
[plusPopover setDelegate:self];
|
||||
[plusPopover setAnimates:NO];
|
||||
[plusPopover setBehavior:CPPopoverBehaviorTransient];
|
||||
[plusPopover setAppearance:CPPopoverAppearanceMinimal];
|
||||
var myViewController=[CPViewController new];
|
||||
|
||||
var myViewController = [CPViewController new];
|
||||
[plusPopover setContentViewController:myViewController];
|
||||
|
||||
var textView = [[CPTextView alloc] initWithFrame:CGRectMake(0, 0, 200, 10)];
|
||||
[textView setBackgroundColor:[CPColor whiteColor]];
|
||||
|
||||
var scrollView = [[CPScrollView alloc] initWithFrame:CGRectMake(0, 0, 200, 150)];
|
||||
|
||||
[scrollView setDocumentView:textView];
|
||||
|
||||
[myViewController setView:scrollView];
|
||||
[plusPopover showRelativeToRect:NULL ofView:sender preferredEdge:nil];
|
||||
[[textView window] makeFirstResponder:textView];
|
||||
|
||||
}
|
||||
|
||||
- (void)orderFrontFontPanel:(id)sender
|
||||
@@ -42,100 +50,282 @@
|
||||
[[CPFontManager sharedFontManager] orderFrontFontPanel:self];
|
||||
}
|
||||
|
||||
- (void)toggleRuler:(id)sender
|
||||
{
|
||||
[_scrollView setRulersVisible:![_scrollView rulersVisible]];
|
||||
}
|
||||
|
||||
- (void)alignLeft:(id)sender
|
||||
{
|
||||
[_textView alignLeft:self];
|
||||
}
|
||||
|
||||
- (void)alignCenter:(id)sender
|
||||
{
|
||||
[_textView alignCenter:self];
|
||||
}
|
||||
|
||||
- (void)alignRight:(id)sender
|
||||
{
|
||||
[_textView alignRight:self];
|
||||
}
|
||||
|
||||
- (void)alignJustified:(id)sender
|
||||
{
|
||||
[_textView alignJustified:self];
|
||||
}
|
||||
|
||||
- (void)insertAttachment:(id)sender
|
||||
{
|
||||
// Insert modern spinner image attachment
|
||||
var tempImageView = [[CPImageView alloc] initWithFrame:CGRectMake(0, 0, 32, 32)];
|
||||
[tempImageView setImage:[[CPImage alloc] initWithContentsOfFile:@"Resources/spinner.gif" size:CGSizeMake(32, 32)]];
|
||||
[_textView insertText:[CPTextStorage attributedStringWithAttachment:tempImageView]];
|
||||
[_textView insertText:@" "];
|
||||
|
||||
// Insert an interactive button attachment
|
||||
var tempButton = [[CPButton alloc] initWithFrame:CGRectMake(0, 0, 80, 28)];
|
||||
[tempButton setTitle:@"Click Me"];
|
||||
[_textView insertText:[CPTextStorage attributedStringWithAttachment:tempButton]];
|
||||
[_textView insertText:@" "];
|
||||
}
|
||||
|
||||
- (void)applicationDidFinishLaunching:(CPNotification)aNotification
|
||||
{
|
||||
// CPLogRegister(CPLogConsole);
|
||||
|
||||
var theWindow = [[CPWindow alloc] initWithContentRect:CGRectMakeZero() styleMask:CPBorderlessBridgeWindowMask],
|
||||
contentView = [theWindow contentView];
|
||||
|
||||
[contentView setBackgroundColor:[CPColor colorWithWhite:0.95 alpha:1.0]];
|
||||
|
||||
var mybutton=[[CPButton alloc] initWithFrame:CGRectMake(0, 0, 250, 25)];
|
||||
[mybutton setTitle:"Open sheet (must not be triggered by return)"]
|
||||
[mybutton setTarget:self];
|
||||
[mybutton setAction:@selector(openSheet:)];
|
||||
[mybutton setKeyEquivalent:@"\r"];
|
||||
// 1. Clean visual header / toolbar area
|
||||
var toolbarView = [[CPView alloc] initWithFrame:CGRectMake(0, 0, CGRectGetWidth([contentView bounds]), 60)];
|
||||
[toolbarView setAutoresizingMask:CPViewWidthSizable];
|
||||
[toolbarView setBackgroundColor:[CPColor colorWithWhite:0.88 alpha:1.0]];
|
||||
[contentView addSubview:toolbarView];
|
||||
|
||||
[contentView addSubview:mybutton];
|
||||
var currentX = 15;
|
||||
|
||||
// Popover Trigger
|
||||
var sheetButton = [[CPButton alloc] initWithFrame:CGRectMake(currentX, 15, 145, 30)];
|
||||
[sheetButton setTitle:@"Open Popover Sheet"];
|
||||
[sheetButton setTarget:self];
|
||||
[sheetButton setAction:@selector(openSheet:)];
|
||||
[toolbarView addSubview:sheetButton];
|
||||
currentX += 155;
|
||||
|
||||
_textView = [[CPTextView alloc] initWithFrame:CGRectMake(0, 0, 500, 200)];
|
||||
// Font Panel Trigger
|
||||
var fontButton = [[CPButton alloc] initWithFrame:CGRectMake(currentX, 15, 125, 30)];
|
||||
[fontButton setTitle:@"Show Font Panel"];
|
||||
[fontButton setTarget:self];
|
||||
[fontButton setAction:@selector(orderFrontFontPanel:)];
|
||||
[toolbarView addSubview:fontButton];
|
||||
currentX += 135;
|
||||
|
||||
// Toggle Ruler Trigger
|
||||
var rulerButton = [[CPButton alloc] initWithFrame:CGRectMake(currentX, 15, 120, 30)];
|
||||
[rulerButton setTitle:@"Toggle Ruler"];
|
||||
[rulerButton setTarget:self];
|
||||
[rulerButton setAction:@selector(toggleRuler:)];
|
||||
[toolbarView addSubview:rulerButton];
|
||||
currentX += 130;
|
||||
|
||||
// RTF Roundtrip Trigger
|
||||
var rtfButton = [[CPButton alloc] initWithFrame:CGRectMake(currentX, 15, 150, 30)];
|
||||
[rtfButton setTitle:@"RTF Round-trip ➔"];
|
||||
[rtfButton setTarget:self];
|
||||
[rtfButton setAction:@selector(makeRTF:)];
|
||||
[toolbarView addSubview:rtfButton];
|
||||
currentX += 160;
|
||||
|
||||
// Insert Attachment Trigger
|
||||
var attachButton = [[CPButton alloc] initWithFrame:CGRectMake(currentX, 15, 140, 30)];
|
||||
[attachButton setTitle:@"Insert Attachment"];
|
||||
[attachButton setTarget:self];
|
||||
[attachButton setAction:@selector(insertAttachment:)];
|
||||
[toolbarView addSubview:attachButton];
|
||||
currentX += 150;
|
||||
|
||||
// Text Alignment Group
|
||||
var labelAlign = [[CPTextField alloc] initWithFrame:CGRectMake(currentX, 22, 45, 20)];
|
||||
[labelAlign setStringValue:@"Align:"];
|
||||
[labelAlign setFont:[CPFont systemFontOfSize:12]];
|
||||
[toolbarView addSubview:labelAlign];
|
||||
currentX += 45;
|
||||
|
||||
var alignLeftBtn = [[CPButton alloc] initWithFrame:CGRectMake(currentX, 15, 50, 30)];
|
||||
[alignLeftBtn setTitle:@"Left"];
|
||||
[alignLeftBtn setTarget:self];
|
||||
[alignLeftBtn setAction:@selector(alignLeft:)];
|
||||
[toolbarView addSubview:alignLeftBtn];
|
||||
currentX += 55;
|
||||
|
||||
var alignCenterBtn = [[CPButton alloc] initWithFrame:CGRectMake(currentX, 15, 60, 30)];
|
||||
[alignCenterBtn setTitle:@"Center"];
|
||||
[alignCenterBtn setTarget:self];
|
||||
[alignCenterBtn setAction:@selector(alignCenter:)];
|
||||
[toolbarView addSubview:alignCenterBtn];
|
||||
currentX += 65;
|
||||
|
||||
var alignRightBtn = [[CPButton alloc] initWithFrame:CGRectMake(currentX, 15, 55, 30)];
|
||||
[alignRightBtn setTitle:@"Right"];
|
||||
[alignRightBtn setTarget:self];
|
||||
[alignRightBtn setAction:@selector(alignRight:)];
|
||||
[toolbarView addSubview:alignRightBtn];
|
||||
currentX += 60;
|
||||
|
||||
var alignJustifyBtn = [[CPButton alloc] initWithFrame:CGRectMake(currentX, 15, 65, 30)];
|
||||
[alignJustifyBtn setTitle:@"Justify"];
|
||||
[alignJustifyBtn setTarget:self];
|
||||
[alignJustifyBtn setAction:@selector(alignJustified:)];
|
||||
[toolbarView addSubview:alignJustifyBtn];
|
||||
|
||||
// Default return key target test
|
||||
var returnButton = [[CPButton alloc] initWithFrame:CGRectMake(CGRectGetWidth([contentView bounds]) - 270, 15, 250, 30)];
|
||||
[returnButton setAutoresizingMask:CPViewMinXMargin];
|
||||
[returnButton setTitle:@"Key Return Target"];
|
||||
[returnButton setTarget:self];
|
||||
[returnButton setAction:@selector(openSheet:)];
|
||||
[returnButton setKeyEquivalent:@"\r"];
|
||||
[toolbarView addSubview:returnButton];
|
||||
|
||||
// 2. Main content area: Split View Layout for side-by-side comparison
|
||||
var splitView = [[CPSplitView alloc] initWithFrame:CGRectMake(0, 60, CGRectGetWidth([contentView bounds]), CGRectGetHeight([contentView bounds]) - 60)];
|
||||
[splitView setVertical:YES];
|
||||
[splitView setAutoresizingMask:CPViewWidthSizable | CPViewHeightSizable];
|
||||
|
||||
var leftContainer = [[CPView alloc] initWithFrame:CGRectMake(0, 0, CGRectGetWidth([splitView bounds]) / 2, CGRectGetHeight([splitView bounds]))];
|
||||
[leftContainer setAutoresizingMask:CPViewWidthSizable | CPViewHeightSizable];
|
||||
|
||||
var rightContainer = [[CPView alloc] initWithFrame:CGRectMake(0, 0, CGRectGetWidth([splitView bounds]) / 2, CGRectGetHeight([splitView bounds]))];
|
||||
[rightContainer setAutoresizingMask:CPViewWidthSizable | CPViewHeightSizable];
|
||||
|
||||
[splitView addSubview:leftContainer];
|
||||
[splitView addSubview:rightContainer];
|
||||
[contentView addSubview:splitView];
|
||||
|
||||
// Left Container: label & Scroll/TextView containing Ruler
|
||||
var leftLabel = [[CPTextField alloc] initWithFrame:CGRectMake(15, 10, CGRectGetWidth([leftContainer bounds]) - 30, 20)];
|
||||
[leftLabel setStringValue:@"Rich Text Editor"];
|
||||
[leftLabel setFont:[CPFont boldSystemFontOfSize:14]];
|
||||
[leftLabel setAutoresizingMask:CPViewWidthSizable];
|
||||
[leftContainer addSubview:leftLabel];
|
||||
|
||||
_textView = [[CPTextView alloc] initWithFrame:CGRectMake(0, 0, CGRectGetWidth([leftContainer bounds]) - 30, CGRectGetHeight([leftContainer bounds]) - 70)];
|
||||
[_textView setRichText:YES];
|
||||
|
||||
_textView2 = [[CPTextView alloc] initWithFrame:CGRectMake(0, 0, 1000, 200)];
|
||||
_textView2._isRichText = NO;
|
||||
[_textView setBackgroundColor:[CPColor whiteColor]];
|
||||
|
||||
_scrollView = [[CPScrollView alloc] initWithFrame:CGRectMake(15, 40, CGRectGetWidth([leftContainer bounds]) - 30, CGRectGetHeight([leftContainer bounds]) - 65)];
|
||||
[_scrollView setAutoresizingMask:CPViewWidthSizable | CPViewHeightSizable];
|
||||
[_scrollView setDocumentView:_textView];
|
||||
|
||||
// ATTACH THE NEW CPRULERVIEW SYSTEM
|
||||
[_scrollView setHasHorizontalRuler:YES];
|
||||
[_scrollView setRulersVisible:YES];
|
||||
[leftContainer addSubview:_scrollView];
|
||||
|
||||
// Right Container: RTF Plain-Text Source and Parser Window
|
||||
var rightLabel = [[CPTextField alloc] initWithFrame:CGRectMake(15, 10, CGRectGetWidth([rightContainer bounds]) - 30, 20)];
|
||||
[rightLabel setStringValue:@"RTF Raw Output & Source Parser Window"];
|
||||
[rightLabel setFont:[CPFont boldSystemFontOfSize:14]];
|
||||
[rightLabel setAutoresizingMask:CPViewWidthSizable];
|
||||
[rightContainer addSubview:rightLabel];
|
||||
|
||||
_textView2 = [[CPTextView alloc] initWithFrame:CGRectMake(0, 0, CGRectGetWidth([rightContainer bounds]) - 30, CGRectGetHeight([rightContainer bounds]) - 70)];
|
||||
_textView2._isRichText = NO;
|
||||
[_textView2 setBackgroundColor:[CPColor whiteColor]];
|
||||
|
||||
var scrollView = [[CPScrollView alloc] initWithFrame:CGRectMake(20, 70, 520, 220)];
|
||||
var scrollView2 = [[CPScrollView alloc] initWithFrame:CGRectMake(20, 550, 1020, 220)];
|
||||
_scrollView2 = [[CPScrollView alloc] initWithFrame:CGRectMake(15, 40, CGRectGetWidth([rightContainer bounds]) - 30, CGRectGetHeight([rightContainer bounds]) - 65)];
|
||||
[_scrollView2 setAutoresizingMask:CPViewWidthSizable | CPViewHeightSizable];
|
||||
[_scrollView2 setDocumentView:_textView2];
|
||||
[rightContainer addSubview:_scrollView2];
|
||||
|
||||
[scrollView setDocumentView:_textView];
|
||||
[scrollView2 setDocumentView:_textView2];
|
||||
// 3. Build application Main Menu
|
||||
var mainMenu = [CPApp mainMenu];
|
||||
|
||||
[contentView addSubview: scrollView];
|
||||
[contentView addSubview: scrollView2];
|
||||
while ([mainMenu numberOfItems] > 0)
|
||||
[mainMenu removeItemAtIndex:0];
|
||||
|
||||
// build our menu
|
||||
var mainMenu = [CPApp mainMenu];
|
||||
var item = [mainMenu insertItemWithTitle:@"Edit" action:nil keyEquivalent:nil atIndex:0],
|
||||
editMenu = [[CPMenu alloc] initWithTitle:@"Edit Menu"];
|
||||
|
||||
while ([mainMenu numberOfItems] > 0)
|
||||
[mainMenu removeItemAtIndex:0];
|
||||
[editMenu addItemWithTitle:@"Cut" action:@selector(cut:) keyEquivalent:@"x"];
|
||||
[editMenu addItemWithTitle:@"Copy" action:@selector(copy:) keyEquivalent:@"c"];
|
||||
[editMenu addItemWithTitle:@"Paste" action:@selector(paste:) keyEquivalent:@"v"];
|
||||
[editMenu addItemWithTitle:@"Delete" action:@selector(delete:) keyEquivalent:@""];
|
||||
[editMenu addItemWithTitle:@"Select All" action:@selector(selectAll:) keyEquivalent:@"a"];
|
||||
[editMenu addItemWithTitle:@"Undo" action:@selector(undo:) keyEquivalent:@"z"];
|
||||
[editMenu addItemWithTitle:@"Redo" action:@selector(redo:) keyEquivalent:@"Z"];
|
||||
[mainMenu setSubmenu:editMenu forItem:item];
|
||||
|
||||
var item = [mainMenu insertItemWithTitle:@"Edit" action:nil keyEquivalent:nil atIndex:0],
|
||||
editMenu = [[CPMenu alloc] initWithTitle:@"Edit Menu"];
|
||||
item = [mainMenu insertItemWithTitle:@"Format" action:nil keyEquivalent:nil atIndex:0];
|
||||
// Format Menu
|
||||
item = [mainMenu insertItemWithTitle:@"Format" action:nil keyEquivalent:nil atIndex:0];
|
||||
var formatMenu = [[CPMenu alloc] initWithTitle:@"Format Menu"];
|
||||
|
||||
[formatMenu addItemWithTitle:@"Font panel" action:@selector(orderFrontFontPanel:) keyEquivalent:@"t"];
|
||||
[formatMenu addItem:[CPMenuItem separatorItem]];
|
||||
// Styles
|
||||
[formatMenu addItemWithTitle:@"Bold" action:@selector(bold:) keyEquivalent:@"b"];
|
||||
[formatMenu addItemWithTitle:@"Italic" action:@selector(italic:) keyEquivalent:@"i"];
|
||||
[formatMenu addItemWithTitle:@"Underline" action:@selector(underline:) keyEquivalent:@"u"];
|
||||
[formatMenu addItem:[CPMenuItem separatorItem]];
|
||||
// Alignment
|
||||
[formatMenu addItemWithTitle:@"Align Left" action:@selector(alignLeft:) keyEquivalent:@"{"];
|
||||
[formatMenu addItemWithTitle:@"Center" action:@selector(alignCenter:) keyEquivalent:@"|"];
|
||||
[formatMenu addItemWithTitle:@"Align Right" action:@selector(alignRight:) keyEquivalent:@"}"];
|
||||
[formatMenu addItemWithTitle:@"Justify" action:@selector(alignJustified:) keyEquivalent:@""];
|
||||
[mainMenu setSubmenu:formatMenu forItem:item];
|
||||
|
||||
[editMenu addItemWithTitle:@"Cut" action:@selector(cut:) keyEquivalent:@"x"];
|
||||
[editMenu addItemWithTitle:@"Copy" action:@selector(copy:) keyEquivalent:@"c"];
|
||||
[editMenu addItemWithTitle:@"Paste" action:@selector(paste:) keyEquivalent:@"v"];
|
||||
[editMenu addItemWithTitle:@"Delete" action:@selector(delete:) keyEquivalent:@""];
|
||||
[editMenu addItemWithTitle:@"Select All" action:@selector(selectAll:) keyEquivalent:@"a"];
|
||||
[editMenu addItemWithTitle:@"Undo" action:@selector(undo:) keyEquivalent:@"z"];
|
||||
[editMenu addItemWithTitle:@"Redo" action:@selector(redo:) keyEquivalent:@"Z"];
|
||||
// 4. Load Rich Sample Text content
|
||||
[_textView insertText:@"123 456 "];
|
||||
|
||||
[mainMenu setSubmenu:editMenu forItem:item];
|
||||
|
||||
item = [mainMenu insertItemWithTitle:@"Format" action:nil keyEquivalent:nil atIndex:0];
|
||||
var formatMenu = [[CPMenu alloc] initWithTitle:@"Format Menu"];
|
||||
[formatMenu addItemWithTitle:@"Font panel" action:@selector(orderFrontFontPanel:) keyEquivalent:@"f"];
|
||||
[formatMenu addItemWithTitle:@"Underline" action:@selector(underline:) keyEquivalent:@"u"];
|
||||
[mainMenu setSubmenu:formatMenu forItem:item];
|
||||
|
||||
[_textView insertText:"123"];
|
||||
var tempImageView = [[CPImageView alloc] initWithFrame:CGRectMake(0, 0, 32, 32)];
|
||||
[tempImageView setImage:[[CPImage alloc] initWithContentsOfFile:@"Resources/spinner.gif" size:CGSizeMake(32, 32)]]
|
||||
|
||||
[_textView insertText:[CPTextStorage attributedStringWithAttachment:tempImageView]];
|
||||
[_textView insertText:" 456 "];
|
||||
|
||||
var tempButton = [[CPButton alloc] initWithFrame:CGRectMake(0, 0, 64, 28)]
|
||||
[_textView insertText:[CPTextStorage attributedStringWithAttachment:tempButton]];
|
||||
|
||||
var centeredParagraph=[CPParagraphStyle new];
|
||||
[centeredParagraph setAlignment: CPCenterTextAlignment];
|
||||
[_textView insertText:"\n"];
|
||||
[_textView insertText:[[CPAttributedString alloc] initWithString:@"Fusce\n"
|
||||
attributes:[CPDictionary dictionaryWithObjects:[centeredParagraph, [CPFont boldFontWithName:"Arial" size:18], [CPColor redColor], [CPColor yellowColor]]
|
||||
// Elegant Slate-Blue & Soft Light Blue paragraph
|
||||
var centeredParagraph = [CPMutableParagraphStyle new];
|
||||
[centeredParagraph setAlignment:CPCenterTextAlignment];
|
||||
[_textView insertText:@"\n"];
|
||||
|
||||
var elegantForeground = [CPColor colorWithRed:0.18 green:0.24 blue:0.35 alpha:1.0]; // Slate Blue
|
||||
var elegantBackground = [CPColor colorWithRed:0.92 green:0.95 blue:0.98 alpha:1.0]; // Soft Sky Blue tint
|
||||
|
||||
[_textView insertText:[[CPAttributedString alloc] initWithString:@"My Headline with blue background\n"
|
||||
attributes:[CPDictionary dictionaryWithObjects:[centeredParagraph, [CPFont boldFontWithName:@"Arial" size:18], elegantForeground, elegantBackground]
|
||||
forKeys:[CPParagraphStyleAttributeName, CPFontAttributeName, CPForegroundColorAttributeName, CPBackgroundColorAttributeName]]]];
|
||||
|
||||
[_textView insertText:"\n"];
|
||||
[_textView insertText:[[CPAttributedString alloc] initWithString:@"Yellow\n"
|
||||
attributes:[CPDictionary dictionaryWithObjects:[[CPFont boldFontWithName:"Arial" size:25], [CPColor yellowColor]]
|
||||
forKeys:[CPFontAttributeName, CPBackgroundColorAttributeName]]]];
|
||||
[theWindow orderFront:self];
|
||||
// [_textView setEditable:NO];
|
||||
[CPMenu setMenuBarVisible:YES];
|
||||
// Highlighted Heading - Pine & Sage Green tones
|
||||
[_textView insertText:@"\n"];
|
||||
var showcaseForeground = [CPColor colorWithRed:0.15 green:0.25 blue:0.15 alpha:1.0]; // Forest Green
|
||||
var showcaseBackground = [CPColor colorWithRed:0.94 green:0.97 blue:0.92 alpha:1.0]; // Light Sage Green
|
||||
|
||||
[_textView insertText:[[CPAttributedString alloc] initWithString:@"Interactive Ruler Showcase\n"
|
||||
attributes:[CPDictionary dictionaryWithObjects:[[CPFont boldFontWithName:@"Arial" size:22], showcaseForeground, showcaseBackground]
|
||||
forKeys:[CPFontAttributeName, CPForegroundColorAttributeName, CPBackgroundColorAttributeName]]]];
|
||||
|
||||
console.log([[CPFont systemFontOfSize:12] cssString])
|
||||
var context = document.createElement("canvas").getContext("2d");
|
||||
context.font = '12px Arial, sans-serif';
|
||||
var testingText = 'A A A A A A A A';
|
||||
console.log(ROUND(context.measureText(testingText).width));
|
||||
console.log(ROUND([CPPlatformString sizeOfString:testingText withFont:[CPFont systemFontOfSize:12] forWidth:NULL].width));
|
||||
// DEMONSTRATION OF CPRULERVIEW TAB MARKERS
|
||||
var tabParagraph = [[CPParagraphStyle defaultParagraphStyle] mutableCopy];
|
||||
var tab1 = [[CPTextTab alloc] initWithType:CPLeftTextAlignment location:100.0];
|
||||
var tab2 = [[CPTextTab alloc] initWithType:CPCenterTextAlignment location:220.0];
|
||||
var tab3 = [[CPTextTab alloc] initWithType:CPRightTextAlignment location:340.0];
|
||||
[tabParagraph setTabStops:[tab1, tab2, tab3]];
|
||||
|
||||
[_textView insertText:@"\n"];
|
||||
[_textView insertText:[[CPAttributedString alloc] initWithString:@"\tTab1\tTab2\tTab3\n\tLeftAlign\tCenterAlign\tRightAlign\n"
|
||||
attributes:[CPDictionary dictionaryWithObject:tabParagraph forKey:CPParagraphStyleAttributeName]]];
|
||||
|
||||
// DEMONSTRATION OF INDENTATION MARKERS
|
||||
var indentParagraph = [[CPParagraphStyle defaultParagraphStyle] mutableCopy];
|
||||
[indentParagraph setFirstLineHeadIndent:30.0];
|
||||
[indentParagraph setHeadIndent:50.0];
|
||||
[indentParagraph setTailIndent:-30.0];
|
||||
|
||||
[_textView insertText:@"\n"];
|
||||
[_textView insertText:[[CPAttributedString alloc] initWithString:@"This paragraph has a first-line indent of 30pt, a head indent of 50pt, and a tail indent of -30pt. Check the horizontal ruler above to see how the indent markers align with this paragraph, and adjust them directly!\n"
|
||||
attributes:[CPDictionary dictionaryWithObject:indentParagraph forKey:CPParagraphStyleAttributeName]]];
|
||||
|
||||
[theWindow orderFront:self];
|
||||
[CPMenu setMenuBarVisible:YES];
|
||||
}
|
||||
|
||||
- (void) makeRTF:(id)sender
|
||||
- (void)makeRTF:(id)sender
|
||||
{
|
||||
[_textView2 setString: [_CPRTFProducer produceRTF:[_textView textStorage] documentAttributes: @{}] ];
|
||||
var tc = [_CPRTFParser new];
|
||||
|
||||
+145
-145
@@ -1,145 +1,145 @@
|
||||
1779685236085|ArrayController1|
|
||||
1779685236098|ArrayControllerInitialSelectionTest|
|
||||
1779685236111|ArrayControllerRemovingFirstTest|
|
||||
1779685236124|AttachedSheet|
|
||||
1779685236137|AttachedSheet2|
|
||||
1779685236149|Bindings|
|
||||
1779685236162|CGCanvasContext|
|
||||
1779685236175|CGPath|
|
||||
1779685236188|CPAlertTest|
|
||||
1779685236201|CPAnimatablePropertyContainerTest|
|
||||
1779685236214|CPAnimationContextTest|
|
||||
1779685236227|CPAnimationTest|
|
||||
1779685236240|CPBinder-echo-bug|
|
||||
1779685236253|CPBoxCibTest|
|
||||
1779685236266|CPBoxTest|
|
||||
1779685236279|CPBrowserTest|
|
||||
1779685236292|CPButtonBarTest|
|
||||
1779685236305|CPButtonKeyEquivalentDefaultTest|
|
||||
1779685236318|CPButtonTest|
|
||||
1779685236331|CPByteCountFormatter|
|
||||
1779685236343|CPCollectionViewNibTest|
|
||||
1779685236356|CPColor-CPImage-description|
|
||||
1779685236369|CPColorWellBindings|
|
||||
1779685236382|CPComboBoxTest|
|
||||
1779685236395|CPControlPerformClickExceptionTest|
|
||||
1779685236408|CPControlSize|
|
||||
1779685236421|CPCursor|
|
||||
1779685236434|CPDateFormatterTest|
|
||||
1779685236446|CPDatePickerTest|
|
||||
1779685236459|CPDictionaryControllerTest|
|
||||
1779685236472|CPDocumentControllerTest|
|
||||
1779685236485|CPFormatterTest|
|
||||
1779685236498|CPGraphicsTest|
|
||||
1779685236511|CPImageAndTextViewImageScaling|
|
||||
1779685236524|CPImageViewAlignmentScaling|
|
||||
1779685236537|CPImageViewTest|
|
||||
1779685236549|CPImageViewbindingsTest|
|
||||
1779685236562|CPLevelIndicator|
|
||||
1779685236575|CPLocalizationTest|
|
||||
1779685236588|CPLogTest|
|
||||
1779685236601|CPMenuCALayerTest|
|
||||
1779685236614|CPMenuEnabledBindingsTest|
|
||||
1779685236627|CPMenuKeyEquivalents|
|
||||
1779685236640|CPMenuRemoveAllTest|
|
||||
1779685236652|CPMenuSubmenuPlacementConstraints|
|
||||
1779685236665|CPMenuTest|
|
||||
1779685236678|CPOutlineViewCibTest|
|
||||
1779685236691|CPOutlineViewTest|
|
||||
1779685236704|CPOutlineViewViewBasedCibTest|
|
||||
1779685236717|CPPanelTest|
|
||||
1779685236730|CPPlatformWindow|
|
||||
1779685236743|CPPlattformWindowMinSize|
|
||||
1779685236755|CPPopUpButtonBindings|
|
||||
1779685236768|CPPopUpButtonTest|
|
||||
1779685236781|CPPopover|
|
||||
1779685236794|CPPredicateEditorCibTest|
|
||||
1779685236807|CPProgressIndicator|
|
||||
1779685236820|CPPropertyListSerializationTest|
|
||||
1779685236832|CPRadioBindings|
|
||||
1779685236845|CPRuleEditorCibTest|
|
||||
1779685236858|CPScrollView|
|
||||
1779685236871|CPScrollView2|
|
||||
1779685236884|CPSearchField|
|
||||
1779685236897|CPSearchFieldPredicateBinding|
|
||||
1779685236910|CPSegmentedControlBindings|
|
||||
1779685236923|CPSegmentedControlTest|
|
||||
1779685236935|CPSoundTest|
|
||||
1779685236948|CPSplitViewDivider|
|
||||
1779685236961|CPSplitViewTest|
|
||||
1779685236974|CPStackViewTest|
|
||||
1779685236987|CPStepperBindings|
|
||||
1779685237000|CPStepperNibTest|
|
||||
1779685237013|CPTabView2|
|
||||
1779685237025|CPTabViewBindings|
|
||||
1779685237038|CPTabViewNib|
|
||||
1779685237051|CPTableViewGroupRows|
|
||||
1779685237064|CPTextField|
|
||||
1779685237077|CPTextFieldEditingStyleTest|
|
||||
1779685237090|CPTextFieldHeightTest|
|
||||
1779685237102|CPTextFieldMovementsTest|
|
||||
1779685237115|CPTextFieldMultiline|
|
||||
1779685237128|CPTextView|
|
||||
1779685237141|CPTextViewCibTest|
|
||||
1779685237154|CPTextViewDelegateAndNotifications|
|
||||
1779685237167|CPTimeZone|
|
||||
1779685237179|CPTokenFieldTest|
|
||||
1779685237192|CPToolTip|
|
||||
1779685237205|CPToolbarTest|
|
||||
1779685237218|CPTreeControllerTest|
|
||||
1779685237231|CPURLConnectionAsyncTest|
|
||||
1779685237243|CPURLConnectionSynchronousTest|
|
||||
1779685237256|CPUserDefaults|
|
||||
1779685237269|CPUserDefaultsControllerTest|
|
||||
1779685237282|CPUserNotificationTest|
|
||||
1779685237295|CPViewController|
|
||||
1779685237308|CPVisualEffectViewTest|
|
||||
1779685237321|CPWebViewTest|
|
||||
1779685237333|CPWebViewTest2|
|
||||
1779685237346|CPWindowLiveResizeTest|
|
||||
1779685237359|CPWindowMovableTest|
|
||||
1779685237372|CPWindowResizeStyle|
|
||||
1779685237385|ChildWindows|
|
||||
1779685237398|CompilationTests|
|
||||
1779685237411|ContinuouslyUpdatesValueBinding|
|
||||
1779685237424|CopyAndPaste|
|
||||
1779685237436|CrossOriginTest|
|
||||
1779685237449|FF4096Test|
|
||||
1779685237462|FontEnhancementTest|
|
||||
1779685237475|FontMetricsExplorer|
|
||||
1779685237488|KeyEquivalents|
|
||||
1779685237501|KeyViewLoopTest|
|
||||
1779685237514|KeyWindowInTheBackgroundActivation|
|
||||
1779685237526|LayoutTest|
|
||||
1779685237539|LoadTimeTest|
|
||||
1779685237552|LongBindings|
|
||||
1779685237565|MobileTest|
|
||||
1779685237578|MultipleValueBindings|
|
||||
1779685237591|NSBoxTest|
|
||||
1779685237604|NSBrowserTest|
|
||||
1779685237616|NewTextFieldBezel|
|
||||
1779685237629|Nib2CibAlignment|
|
||||
1779685237642|Nib2CibBaselineAlignementTest|
|
||||
1779685237655|Nib2CibSubviewsOrderTest|
|
||||
1779685237668|NibAppRemixed|
|
||||
1779685237680|PatternFillTest|
|
||||
1779685237693|PlatformWindows|
|
||||
1779685237706|PopUpButtonEscTest|
|
||||
1779685237719|ScalingTest|
|
||||
1779685237732|ScalingTest2|
|
||||
1779685237744|ScrollviewTheming|
|
||||
1779685237757|SheetWindowOrderFrontIssue|
|
||||
1779685237770|SimpleBindings2|
|
||||
1779685237783|SmartFoldersDemo|
|
||||
1779685237796|TableTest|
|
||||
1779685237809|ThemeBrowser|
|
||||
1779685237821|ThemeKitchenSink|
|
||||
1779685237834|TrackingArea|
|
||||
1779685237847|UndoRedoWithMenuUpdate|
|
||||
1779685237860|UserlandNSTest|
|
||||
1779685237873|layoutEphemeralSubviewTest|
|
||||
1779685237886|loadDynamicFrameworks|
|
||||
1779685237899|performKeyEquivalentTest|
|
||||
1779685237912|predicateWithFormat|
|
||||
1779685237925|resignFirstResponder-CPControlTextDidEndEditing|
|
||||
1779685237938|sizeToFitFix|
|
||||
1780146588255|ArrayController1|
|
||||
1780146588269|ArrayControllerInitialSelectionTest|
|
||||
1780146588283|ArrayControllerRemovingFirstTest|
|
||||
1780146588296|AttachedSheet|
|
||||
1780146588310|AttachedSheet2|
|
||||
1780146588324|Bindings|
|
||||
1780146588338|CGCanvasContext|
|
||||
1780146588352|CGPath|
|
||||
1780146588365|CPAlertTest|
|
||||
1780146588378|CPAnimatablePropertyContainerTest|
|
||||
1780146588392|CPAnimationContextTest|
|
||||
1780146588405|CPAnimationTest|
|
||||
1780146588419|CPBinder-echo-bug|
|
||||
1780146588433|CPBoxCibTest|
|
||||
1780146588447|CPBoxTest|
|
||||
1780146588460|CPBrowserTest|
|
||||
1780146588474|CPButtonBarTest|
|
||||
1780146588488|CPButtonKeyEquivalentDefaultTest|
|
||||
1780146588501|CPButtonTest|
|
||||
1780146588515|CPByteCountFormatter|
|
||||
1780146588529|CPCollectionViewNibTest|
|
||||
1780146588542|CPColor-CPImage-description|
|
||||
1780146588556|CPColorWellBindings|
|
||||
1780146588569|CPComboBoxTest|
|
||||
1780146588583|CPControlPerformClickExceptionTest|
|
||||
1780146588596|CPControlSize|
|
||||
1780146588609|CPCursor|
|
||||
1780146588623|CPDateFormatterTest|
|
||||
1780146588636|CPDatePickerTest|
|
||||
1780146588649|CPDictionaryControllerTest|
|
||||
1780146588663|CPDocumentControllerTest|
|
||||
1780146588676|CPFormatterTest|
|
||||
1780146588689|CPGraphicsTest|
|
||||
1780146588703|CPImageAndTextViewImageScaling|
|
||||
1780146588716|CPImageViewAlignmentScaling|
|
||||
1780146588729|CPImageViewTest|
|
||||
1780146588743|CPImageViewbindingsTest|
|
||||
1780146588756|CPLevelIndicator|
|
||||
1780146588769|CPLocalizationTest|
|
||||
1780146588783|CPLogTest|
|
||||
1780146588796|CPMenuCALayerTest|
|
||||
1780146588809|CPMenuEnabledBindingsTest|
|
||||
1780146588823|CPMenuKeyEquivalents|
|
||||
1780146588836|CPMenuRemoveAllTest|
|
||||
1780146588850|CPMenuSubmenuPlacementConstraints|
|
||||
1780146588863|CPMenuTest|
|
||||
1780146588876|CPOutlineViewCibTest|
|
||||
1780146588890|CPOutlineViewTest|
|
||||
1780146588903|CPOutlineViewViewBasedCibTest|
|
||||
1780146588917|CPPanelTest|
|
||||
1780146588930|CPPlatformWindow|
|
||||
1780146588943|CPPlattformWindowMinSize|
|
||||
1780146588957|CPPopUpButtonBindings|
|
||||
1780146588970|CPPopUpButtonTest|
|
||||
1780146588984|CPPopover|
|
||||
1780146588997|CPPredicateEditorCibTest|
|
||||
1780146589011|CPProgressIndicator|
|
||||
1780146589024|CPPropertyListSerializationTest|
|
||||
1780146589038|CPRadioBindings|
|
||||
1780146589052|CPRuleEditorCibTest|
|
||||
1780146589065|CPScrollView|
|
||||
1780146589079|CPScrollView2|
|
||||
1780146589093|CPSearchField|
|
||||
1780146589106|CPSearchFieldPredicateBinding|
|
||||
1780146589120|CPSegmentedControlBindings|
|
||||
1780146589135|CPSegmentedControlTest|
|
||||
1780146589148|CPSoundTest|
|
||||
1780146589161|CPSplitViewDivider|
|
||||
1780146589175|CPSplitViewTest|
|
||||
1780146589189|CPStackViewTest|
|
||||
1780146589203|CPStepperBindings|
|
||||
1780146589216|CPStepperNibTest|
|
||||
1780146589230|CPTabView2|
|
||||
1780146589243|CPTabViewBindings|
|
||||
1780146589257|CPTabViewNib|
|
||||
1780146589271|CPTableViewGroupRows|
|
||||
1780146589285|CPTextField|
|
||||
1780146589298|CPTextFieldEditingStyleTest|
|
||||
1780146589313|CPTextFieldHeightTest|
|
||||
1780146589327|CPTextFieldMovementsTest|
|
||||
1780146589341|CPTextFieldMultiline|
|
||||
1780146589355|CPTextView|
|
||||
1780146589368|CPTextViewCibTest|
|
||||
1780146589382|CPTextViewDelegateAndNotifications|
|
||||
1780146589396|CPTimeZone|
|
||||
1780146589409|CPTokenFieldTest|
|
||||
1780146589423|CPToolTip|
|
||||
1780146589438|CPToolbarTest|
|
||||
1780146589452|CPTreeControllerTest|
|
||||
1780146589466|CPURLConnectionAsyncTest|
|
||||
1780146589479|CPURLConnectionSynchronousTest|
|
||||
1780146589493|CPUserDefaults|
|
||||
1780146589507|CPUserDefaultsControllerTest|
|
||||
1780146589520|CPUserNotificationTest|
|
||||
1780146589534|CPViewController|
|
||||
1780146589547|CPVisualEffectViewTest|
|
||||
1780146589560|CPWebViewTest|
|
||||
1780146589574|CPWebViewTest2|
|
||||
1780146589588|CPWindowLiveResizeTest|
|
||||
1780146589602|CPWindowMovableTest|
|
||||
1780146589616|CPWindowResizeStyle|
|
||||
1780146589629|ChildWindows|
|
||||
1780146589642|CompilationTests|
|
||||
1780146589656|ContinuouslyUpdatesValueBinding|
|
||||
1780146589669|CopyAndPaste|
|
||||
1780146589683|CrossOriginTest|
|
||||
1780146589696|FF4096Test|
|
||||
1780146589710|FontEnhancementTest|
|
||||
1780146589723|FontMetricsExplorer|
|
||||
1780146589737|KeyEquivalents|
|
||||
1780146589750|KeyViewLoopTest|
|
||||
1780146589764|KeyWindowInTheBackgroundActivation|
|
||||
1780146589777|LayoutTest|
|
||||
1780146589791|LoadTimeTest|
|
||||
1780146589804|LongBindings|
|
||||
1780146589818|MobileTest|
|
||||
1780146589831|MultipleValueBindings|
|
||||
1780146589845|NSBoxTest|
|
||||
1780146589858|NSBrowserTest|
|
||||
1780146589872|NewTextFieldBezel|
|
||||
1780146589885|Nib2CibAlignment|
|
||||
1780146589898|Nib2CibBaselineAlignementTest|
|
||||
1780146589912|Nib2CibSubviewsOrderTest|
|
||||
1780146589925|NibAppRemixed|
|
||||
1780146589938|PatternFillTest|
|
||||
1780146589952|PlatformWindows|
|
||||
1780146589965|PopUpButtonEscTest|
|
||||
1780146589979|ScalingTest|
|
||||
1780146589993|ScalingTest2|
|
||||
1780146590006|ScrollviewTheming|
|
||||
1780146590019|SheetWindowOrderFrontIssue|
|
||||
1780146590033|SimpleBindings2|
|
||||
1780146590046|SmartFoldersDemo|
|
||||
1780146590059|TableTest|
|
||||
1780146590073|ThemeBrowser|
|
||||
1780146590087|ThemeKitchenSink|
|
||||
1780146590100|TrackingArea|
|
||||
1780146590113|UndoRedoWithMenuUpdate|
|
||||
1780146590127|UserlandNSTest|
|
||||
1780146590141|layoutEphemeralSubviewTest|
|
||||
1780146590154|loadDynamicFrameworks|
|
||||
1780146590168|performKeyEquivalentTest|
|
||||
1780146590181|predicateWithFormat|
|
||||
1780146590195|resignFirstResponder-CPControlTextDidEndEditing|
|
||||
1780146590209|sizeToFitFix|
|
||||
Reference in new issue
Block a user