Fixed the uiMultilineEntry on OS X so that it now actually displays something. More TODOs.
This commit is contained in:
parent
11fe5deb73
commit
c5a5038382
|
@ -6,6 +6,7 @@
|
|||
// - tab on page 2 is glitched
|
||||
// - separators on page 4 have variable padding after them
|
||||
// - 10.8: if we switch to page 4, then switch back to page 1, check Spaced, and go back to page 4, some controls (progress bar, popup button) are clipped on the sides
|
||||
// - wrong padding between controls in the queuemaintest and the control gallery...
|
||||
|
||||
struct uiBox {
|
||||
uiDarwinControl c;
|
||||
|
|
|
@ -69,6 +69,7 @@ void uiMultilineEntrySetReadOnly(uiMultilineEntry *e, int readonly)
|
|||
uiMultilineEntry *uiNewMultilineEntry(void)
|
||||
{
|
||||
uiMultilineEntry *e;
|
||||
NSFont *font;
|
||||
|
||||
e = (uiMultilineEntry *) uiNewControl(uiMultilineEntryType());
|
||||
|
||||
|
@ -113,13 +114,177 @@ uiMultilineEntry *uiNewMultilineEntry(void)
|
|||
disableAutocorrect(e->tv);
|
||||
// this option is complex; just set it to the Interface Builder default
|
||||
[[e->tv layoutManager] setAllowsNonContiguousLayout:YES];
|
||||
// this will work because it's the same selector
|
||||
uiDarwinSetControlFont((NSControl *) (e->tv), NSRegularControlSize);
|
||||
// don't use uiDarwinSetControlFont() directly; we have to do a little extra work to set the font
|
||||
font = [NSFont systemFontOfSize:[NSFont systemFontSizeForControlSize:NSRegularControlSize]];
|
||||
[e->tv setTypingAttributes:[NSDictionary
|
||||
dictionaryWithObject:font
|
||||
forKey:NSFontAttributeName]];
|
||||
// e->tv font from Interface Builder is nil, but setFont:nil throws an exception
|
||||
// let's just set it to the standard control font anyway, just to be safe
|
||||
[e->tv setFont:font];
|
||||
|
||||
// TODO this (via https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/TextUILayer/Tasks/TextInScrollView.html) is the magic incantation needed to get things to show up; figure out why
|
||||
[e->tv setAutoresizingMask:NSViewWidthSizable];
|
||||
|
||||
//TODO [e->tv setTranslatesAutoresizingMaskIntoConstraints:NO];
|
||||
[e->sv setDocumentView:e->tv];
|
||||
|
||||
//TODO:void printinfo(NSScrollView *sv, NSTextView *tv);
|
||||
//printinfo(e->sv, e->tv);
|
||||
|
||||
uiMultilineEntryOnChanged(e, defaultOnChanged, NULL);
|
||||
|
||||
uiDarwinFinishNewControl(e, uiMultilineEntry);
|
||||
|
||||
return e;
|
||||
}
|
||||
|
||||
NSMutableString *s;
|
||||
static void add(const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
NSString *fmts;
|
||||
NSString *a;
|
||||
|
||||
va_start(ap, fmt);
|
||||
fmts = [NSString stringWithUTF8String:fmt];
|
||||
a = [[NSString alloc] initWithFormat:fmts arguments:ap];
|
||||
[s appendString:a];
|
||||
[s appendString:@"\n"];
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
static NSString *edgeInsetsStr(NSEdgeInsets i)
|
||||
{
|
||||
return [NSString
|
||||
stringWithFormat:@"left:%g top:%g right:%g bottom:%g",
|
||||
i.left, i.top, i.right, i.bottom];
|
||||
}
|
||||
|
||||
void printinfo(NSScrollView *sv, NSTextView *tv)
|
||||
{
|
||||
s = [NSMutableString new];
|
||||
|
||||
#define self _s
|
||||
struct {
|
||||
NSScrollView *sv;
|
||||
NSTextView *tv;
|
||||
} _s;
|
||||
_s.sv = sv;
|
||||
_s.tv = tv;
|
||||
|
||||
add("NSScrollView");
|
||||
add(" backgroundColor %@", [self.sv backgroundColor]);
|
||||
add(" drawsBackground %d", [self.sv drawsBackground]);
|
||||
add(" borderType %d", [self.sv borderType]);
|
||||
add(" documentCursor %@", [self.sv documentCursor]);
|
||||
add(" hasHorizontalScroller %d", [self.sv hasHorizontalScroller]);
|
||||
add(" hasVerticalScroller %d", [self.sv hasVerticalScroller]);
|
||||
add(" autohidesScrollers %d", [self.sv autohidesScrollers]);
|
||||
add(" hasHorizontalRuler %d", [self.sv hasHorizontalRuler]);
|
||||
add(" hasVerticalRuler %d", [self.sv hasVerticalRuler]);
|
||||
add(" rulersVisible %d", [self.sv rulersVisible]);
|
||||
add(" automaticallyAdjustsContentInsets %d",
|
||||
[self.sv automaticallyAdjustsContentInsets]);
|
||||
add(" contentInsets %@",
|
||||
edgeInsetsStr([self.sv contentInsets]));
|
||||
add(" scrollerInsets %@",
|
||||
edgeInsetsStr([self.sv scrollerInsets]));
|
||||
add(" scrollerKnobStyle %d", [self.sv scrollerKnobStyle]);
|
||||
add(" scrollerStyle %d", [self.sv scrollerStyle]);
|
||||
add(" lineScroll %g", [self.sv lineScroll]);
|
||||
add(" horizontalLineScroll %g", [self.sv horizontalLineScroll]);
|
||||
add(" verticalLineScroll %g", [self.sv verticalLineScroll]);
|
||||
add(" pageScroll %g", [self.sv pageScroll]);
|
||||
add(" horizontalPageScroll %g", [self.sv horizontalPageScroll]);
|
||||
add(" verticalPageScroll %g", [self.sv verticalPageScroll]);
|
||||
add(" scrollsDynamically %d", [self.sv scrollsDynamically]);
|
||||
add(" findBarPosition %d", [self.sv findBarPosition]);
|
||||
add(" usesPredominantAxisScrolling %d",
|
||||
[self.sv usesPredominantAxisScrolling]);
|
||||
add(" horizontalScrollElasticity %d",
|
||||
[self.sv horizontalScrollElasticity]);
|
||||
add(" verticalScrollElasticity %d",
|
||||
[self.sv verticalScrollElasticity]);
|
||||
add(" allowsMagnification %d", [self.sv allowsMagnification]);
|
||||
add(" magnification %g", [self.sv magnification]);
|
||||
add(" maxMagnification %g", [self.sv maxMagnification]);
|
||||
add(" minMagnification %g", [self.sv minMagnification]);
|
||||
|
||||
add("");
|
||||
|
||||
add("NSTextView");
|
||||
add(" textContainerInset %@",
|
||||
NSStringFromSize([self.tv textContainerInset]));
|
||||
add(" textContainerOrigin %@",
|
||||
NSStringFromPoint([self.tv textContainerOrigin]));
|
||||
add(" backgroundColor %@", [self.tv backgroundColor]);
|
||||
add(" drawsBackground %d", [self.tv drawsBackground]);
|
||||
add(" allowsDocumentBackgroundColorChange %d",
|
||||
[self.tv allowsDocumentBackgroundColorChange]);
|
||||
add(" allowedInputSourceLocales %@",
|
||||
[self.tv allowedInputSourceLocales]);
|
||||
add(" allowsUndo %d", [self.tv allowsUndo]);
|
||||
add(" isEditable %d", [self.tv isEditable]);
|
||||
add(" isSelectable %d", [self.tv isSelectable]);
|
||||
add(" isFieldEditor %d", [self.tv isFieldEditor]);
|
||||
add(" isRichText %d", [self.tv isRichText]);
|
||||
add(" importsGraphics %d", [self.tv importsGraphics]);
|
||||
add(" defaultParagraphStyle %@",
|
||||
[self.tv defaultParagraphStyle]);
|
||||
add(" allowsImageEditing %d", [self.tv allowsImageEditing]);
|
||||
add(" isAutomaticQuoteSubstitutionEnabled %d",
|
||||
[self.tv isAutomaticQuoteSubstitutionEnabled]);
|
||||
add(" isAutomaticLinkDetectionEnabled %d",
|
||||
[self.tv isAutomaticLinkDetectionEnabled]);
|
||||
add(" displaysLinkToolTips %d", [self.tv displaysLinkToolTips]);
|
||||
add(" usesRuler %d", [self.tv usesRuler]);
|
||||
add(" isRulerVisible %d", [self.tv isRulerVisible]);
|
||||
add(" usesInspectorBar %d", [self.tv usesInspectorBar]);
|
||||
add(" selectionAffinity %d", [self.tv selectionAffinity]);
|
||||
add(" selectionGranularity %d", [self.tv selectionGranularity]);
|
||||
add(" insertionPointColor %@", [self.tv insertionPointColor]);
|
||||
add(" selectedTextAttributes %@",
|
||||
[self.tv selectedTextAttributes]);
|
||||
add(" markedTextAttributes %@", [self.tv markedTextAttributes]);
|
||||
add(" linkTextAttributes %@", [self.tv linkTextAttributes]);
|
||||
add(" typingAttributes %@", [self.tv typingAttributes]);
|
||||
add(" smartInsertDeleteEnabled %d",
|
||||
[self.tv smartInsertDeleteEnabled]);
|
||||
add(" isContinuousSpellCheckingEnabled %d",
|
||||
[self.tv isContinuousSpellCheckingEnabled]);
|
||||
add(" isGrammarCheckingEnabled %d",
|
||||
[self.tv isGrammarCheckingEnabled]);
|
||||
add(" acceptsGlyphInfo %d", [self.tv acceptsGlyphInfo]);
|
||||
add(" usesFontPanel %d", [self.tv usesFontPanel]);
|
||||
add(" usesFindPanel %d", [self.tv usesFindPanel]);
|
||||
add(" enabledTextCheckingTypes %d",
|
||||
[self.tv enabledTextCheckingTypes]);
|
||||
add(" isAutomaticDashSubstitutionEnabled %d",
|
||||
[self.tv isAutomaticDashSubstitutionEnabled]);
|
||||
add(" isAutomaticDataDetectionEnabled %d",
|
||||
[self.tv isAutomaticDataDetectionEnabled]);
|
||||
add(" isAutomaticSpellingCorrectionEnabled %d",
|
||||
[self.tv isAutomaticSpellingCorrectionEnabled]);
|
||||
add(" isAutomaticTextReplacementEnabled %d",
|
||||
[self.tv isAutomaticTextReplacementEnabled]);
|
||||
add(" usesFindBar %d", [self.tv usesFindBar]);
|
||||
add(" isIncrementalSearchingEnabled %d",
|
||||
[self.tv isIncrementalSearchingEnabled]);
|
||||
add(" NSText:");
|
||||
add(" font %@", [self.tv font]);
|
||||
add(" textColor %@", [self.tv textColor]);
|
||||
add(" baseWritingDirection %d", [self.tv baseWritingDirection]);
|
||||
add(" maxSize %@",
|
||||
NSStringFromSize([self.tv maxSize]));
|
||||
add(" minSize %@",
|
||||
NSStringFromSize([self.tv minSize]));
|
||||
add(" isVerticallyResizable %d",
|
||||
[self.tv isVerticallyResizable]);
|
||||
add(" isHorizontallyResizable %d",
|
||||
[self.tv isHorizontallyResizable]);
|
||||
|
||||
#undef self
|
||||
|
||||
fprintf(stdout, "%s", [s UTF8String]);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue