diff --git a/Modules/jaspJags b/Modules/jaspJags index a40277b4a4..9f23814672 160000 --- a/Modules/jaspJags +++ b/Modules/jaspJags @@ -1 +1 @@ -Subproject commit a40277b4a404803a9e235bf9324bd6a9c70197d9 +Subproject commit 9f23814672ca7802318c0113e382a2da03d088b8 diff --git a/QMLComponents/components/JASP/Controls/JAGSTextArea.qml b/QMLComponents/components/JASP/Controls/JAGSTextArea.qml index 82693572fe..aa2ec73c76 100644 --- a/QMLComponents/components/JASP/Controls/JAGSTextArea.qml +++ b/QMLComponents/components/JASP/Controls/JAGSTextArea.qml @@ -5,4 +5,5 @@ import JASP 1.0 TextArea { textType: JASP.TextTypeJAGSmodel + showLineNumber: true } diff --git a/QMLComponents/components/JASP/Controls/TextArea.qml b/QMLComponents/components/JASP/Controls/TextArea.qml index 81c5118351..944dd37dbb 100644 --- a/QMLComponents/components/JASP/Controls/TextArea.qml +++ b/QMLComponents/components/JASP/Controls/TextArea.qml @@ -29,6 +29,7 @@ TextAreaBase property var undoModel property bool useTabAsSpaces : true property var nextTabItem + property bool showLineNumber : false Component.onCompleted: control.editingFinished.connect(editingFinished) @@ -86,16 +87,62 @@ TextAreaBase boundsBehavior: Flickable.StopAtBounds anchors.fill: parent + Rectangle + { + id: lineNumbersRect + anchors.top: parent.top + anchors.left: parent.left + anchors.topMargin: jaspTheme.contentMargin + anchors.leftMargin: 2 + visible: textArea.showLineNumber + width: lineNumbersRect.visible ? lineNumbers.width : 0 + height: Math.max(flickableRectangle.height, control.contentHeight) + 10 + color: "transparent" + + FontMetrics + { + font: jaspTheme.fontCode + id: lineNumberWidthDeterminer + } + + ListView + { + id: lineNumbers + width: lineNumberWidthDeterminer.advanceWidth(control.lineCount) + jaspTheme.itemPadding + height: parent.height + model: control.lineCount + delegate: Text + { + text: "%1".arg(index + 1) + font: jaspTheme.fontCode + color: jaspTheme.grayDarker + height: control.contentHeight / control.lineCount + anchors.right: parent.right + anchors.rightMargin: jaspTheme.itemPadding / 2 + } + } + + Rectangle + { + id: separator + anchors.top: parent.top + anchors.left: parent.right + width: 2 * preferencesModel.uiScale + height: Math.max(flickableRectangle.height, control.contentHeight) + 10 + color: jaspTheme.borderColor + } + } + QTC.TextArea.flickable: QTC.TextArea { id: control selectByMouse: true selectedTextColor: jaspTheme.white selectionColor: jaspTheme.itemSelectedColor - font: textArea.textType === JASP.TextTypeDefault || textArea.textType === JASP.TextTypeSource ? jaspTheme.font : jaspTheme.fontCode color: textArea.enabled ? jaspTheme.textEnabled : jaspTheme.textDisabled - + leftPadding: !textArea.showLineNumber ? 0 : lineNumbers.width + 2 * jaspTheme.contentMargin + Component.onCompleted: { if (textArea.nextTabItem)