update styles

This commit is contained in:
Vadim Lopatin 2015-01-21 16:17:00 +03:00
parent 9bcff67702
commit 27e4b4e9cb
4 changed files with 62 additions and 10 deletions

View File

@ -302,15 +302,14 @@
/>
<style id="TREE_ITEM"
padding="2,2,2,2"
margins="0,0,0,0"
padding="1,1,1,1"
minWidth="100"
minHeight="16"
layoutWidth="FILL_PARENT"
layoutHeight="WRAP_CONTENT"
fontFace="Arial"
fontFamily="SansSerif"
fontSize="16">
fontSize="12">
</style>
<style id="TREE_ITEM_EXPAND_ICON"
margins="2,0,2,0"
@ -333,6 +332,7 @@
layoutHeight="WRAP_CONTENT"
align="Left|VCenter"
textFlags="Parent"
fontSize="12"
/>
<style id="RESIZER_VERTICAL"
layoutWidth="FILL_PARENT"

View File

@ -98,10 +98,10 @@ class DockHost : WidgetGroupDefaultDrawing {
DockWindow[] left = getDockedWindowList(DockAlignment.Left);
DockWindow[] right = getDockedWindowList(DockAlignment.Right);
DockWindow[] bottom = getDockedWindowList(DockAlignment.Bottom);
_topSpace = top.length ? rc.height / 5 : 0;
_bottomSpace = bottom.length ? rc.height / 5 : 0;
_rightSpace = right.length ? rc.width / 5 : 0;
_leftSpace = left.length ? rc.width / 5 : 0;
_topSpace = top.length ? rc.height / 4 : 0;
_bottomSpace = bottom.length ? rc.height / 4 : 0;
_rightSpace = right.length ? rc.width / 4 : 0;
_leftSpace = left.length ? rc.width / 4 : 0;
if (_bodyWidget)
_bodyWidget.layout(Rect(rc.left + _leftSpace, rc.top + _topSpace, rc.right - _rightSpace, rc.bottom - _bottomSpace));
layoutDocked(top, Rect(rc.left + _leftSpace, rc.top, rc.right - _rightSpace, rc.top + _topSpace), Orientation.Horizontal);
@ -143,6 +143,7 @@ class DockHost : WidgetGroupDefaultDrawing {
}
}
/// dock alignment types
enum DockAlignment {
Left,
Right,
@ -177,11 +178,13 @@ class DockWindow : VerticalLayout {
protected HorizontalLayout _captionLayout;
protected TextWidget _caption;
protected ImageButton _closeButton;
this(string ID) {
super(ID);
_dockAlignment = DockAlignment.Right;
_dockAlignment = DockAlignment.Right; // default alignment is right
init();
}
protected bool onCloseButtonClick(Widget source) {
return true;
}

View File

@ -8,6 +8,7 @@ EditLine - single line editor.
EditBox - multiline editor
LogWidget - readonly text box for showing logs
Synopsis:
@ -530,6 +531,14 @@ class EditableContent {
return cast(dstring)buf;
}
/// append one or more lines at end
void appendLines(dstring[] lines...) {
TextRange rangeBefore;
rangeBefore.start = rangeBefore.end = lineEnd(_lines.length ? _lines.length - 1 : 0);
EditOperation op = new EditOperation(EditAction.Replace, rangeBefore, lines);
performOperation(op, this);
}
/// call listener to say that whole content is replaced e.g. by loading from file
void notifyContentReplaced() {
TextRange rangeBefore;
@ -2863,3 +2872,44 @@ class EditBox : EditWidgetBase {
}
}
/// Read only edit box for displaying logs with lines append operation
class LogWidget : EditBox {
protected int _maxLines;
/// max lines to show (when appended more than max lines, older lines will be truncated), 0 means no limit
@property int maxLines() { return _maxLines; }
/// set max lines to show (when appended more than max lines, older lines will be truncated), 0 means no limit
@property void maxLines(int n) { _maxLines = n; }
protected bool _scrollLock;
/// when true, automatically scrolls down when new lines are appended (usually being reset by scrollbar interaction)
@property bool scrollLock() { return _scrollLock; }
/// when true, automatically scrolls down when new lines are appended (usually being reset by scrollbar interaction)
@property void scrollLock(bool flg) { _scrollLock = flg; }
this(string ID) {
super(ID);
_scrollLock = true;
enabled = false;
fontSize = 12;
fontFace = "Consolas,Lucida Console,Courier New";
fontFamily = FontFamily.MonoSpace;
}
/// append lines to the end of text
void appendLines(dstring[] lines...) {
lines ~= ""d; // append new line after last line
content.appendLines(lines);
if (_maxLines > 0 && lineCount > _maxLines) {
TextRange range;
range.end.line = lineCount - _maxLines;
EditOperation op = new EditOperation(EditAction.Replace, range, [""d]);
_content.performOperation(op, this);
}
updateScrollBars();
if (_scrollLock) {
_caretPos = TextPosition(lineCount > 0 ? lineCount - 1 : 0, 0);
ensureCaretVisible();
}
}
}

View File

@ -27,8 +27,7 @@ class SourceEdit : EditBox {
super(ID);
fontFace = "Consolas,Lucida Console,Courier New";
fontFamily = FontFamily.MonoSpace;
fontSize = 14;
fontWeight = 300;
fontSize = 12;
layoutWidth(FILL_PARENT).layoutHeight(FILL_PARENT);
minFontSize(10).maxFontSize(75); // allow font zoom with Ctrl + MouseWheel
_showLineNumbers = true;