Add Cell, CellModel
diff --git a/ide/qml/InsertRow.qml b/ide/qml/InsertRow.qml
index b12896a..00bad8b 100644
--- a/ide/qml/InsertRow.qml
+++ b/ide/qml/InsertRow.qml
@@ -6,7 +6,7 @@
Rectangle {
id: root
- color: Material.color(Material.Grey, Material.Shade800)
+ color: Material.color(Material.Grey, Material.theme == Material.Dark ? Material.Shade800 : Material.Shade300)
height: 2
Layout.fillWidth: true
Layout.topMargin: 14
@@ -55,7 +55,7 @@
id: addButton
anchors.centerIn: parent
icon.source: "qrc:///icons/add.svg"
- icon.color: Material.color(Material.Grey, Material.Shade400)
+ icon.color: Material.color(Material.Grey, Material.theme == Material.Dark ? Material.Shade400 : Material.Shade600)
flat: true
}
}
diff --git a/ide/qml/Cell.qml b/ide/qml/NotebookCell.qml
similarity index 74%
rename from ide/qml/Cell.qml
rename to ide/qml/NotebookCell.qml
index d060dee..a441b73 100644
--- a/ide/qml/Cell.qml
+++ b/ide/qml/NotebookCell.qml
@@ -6,6 +6,9 @@
ColumnLayout {
id: root
+ required property string code
+ required property string result
+
RowLayout {
Layout.fillWidth: true
@@ -25,15 +28,21 @@
Layout.fillHeight: true
id: code
font.family: "monospace"
- text: "Hello"
+ text: root.code
selectByMouse: true
wrapMode: TextEdit.WrapAtWordBoundaryOrAnywhere
+
+ Keys.onTabPressed: {
+ var pos = cursorPosition + 4
+ text += " ";
+ cursorPosition = pos
+ }
}
Label {
Layout.fillWidth: true
font.family: "monospace"
- text: "Result\nasdfasdf\nasdad"
+ text: root.result
}
}
}
diff --git a/ide/qml/main.qml b/ide/qml/main.qml
index d3bca25..73a4581 100644
--- a/ide/qml/main.qml
+++ b/ide/qml/main.qml
@@ -3,6 +3,8 @@
import QtQuick.Controls.Material 2.0
import QtQuick.Layouts 1.3
+import sh.swisschili.REFAL 1.0
+
ApplicationWindow {
id: root
width: 1080
@@ -10,9 +12,19 @@
title: "Notebook"
visible: true
- Material.theme: Material.Dark
+ Material.theme: Material.Light
Material.accent: Material.Orange
+ CellModel {
+ id: model
+ }
+
+ Component.onCompleted: {
+ model.addCell("Refal { = Hi!; }", "");
+ model.addCell("<Refal>", "Hi!");
+ model.addCell("Hello there", "Hello there");
+ }
+
ColumnLayout {
id: column
anchors.fill: parent
@@ -45,10 +57,10 @@
id: codeEditor
SplitView.fillWidth: true
SplitView.minimumWidth: 400
- model: 3
+ model: model
clip: true
- delegate: Cell {
+ delegate: NotebookCell {
width: codeEditor.width - 5
}
}