diff --git a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/ObjectLists/ObjectRow.qml b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/ObjectLists/ObjectRow.qml index 617b67f..b13a293 100644 --- a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/ObjectLists/ObjectRow.qml +++ b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/ObjectLists/ObjectRow.qml @@ -46,8 +46,9 @@ Item { property var posPicker property alias objVisible: objVisibilityCheckBox.checked + property int minHeight: 40 - height: 40 + height: objDescription.height width: obj.typeList.width CheckBox { @@ -74,17 +75,18 @@ Item { id: objDescription anchors.left: objVisibilityCheckBox.right anchors.right: deleteButton.left - height: parent.height + height: LatexJS.enabled ? Math.max(parent.minHeight, latexDescription.height+4) : parent.minHeight verticalAlignment: TextInput.AlignVCenter text: LatexJS.enabled ? "" : obj.getReadableString() font.pixelSize: 14 Image { + id: latexDescription anchors.verticalCenter: parent.verticalCenter anchors.left: parent.left visible: LatexJS.enabled property double depth: 2 - property var ltxInfo: visible ? Latex.render(obj.getLatexLabel(), depth*parent.font.pixelSize, parent.color).split(",") : ["","0","0"] + property var ltxInfo: visible ? Latex.render(obj.getLatexString(), depth*parent.font.pixelSize+4, parent.color).split(",") : ["","0","0"] source: visible ? ltxInfo[0] : "" width: parseInt(ltxInfo[1])/depth height: parseInt(ltxInfo[2])/depth @@ -94,7 +96,7 @@ Item { anchors.fill: parent onClicked: { objEditor.obj = Objects.currentObjects[obj.type][index] - objEditor.obj.type = obj.type + objEditor.objType = obj.type objEditor.objIndex = index //objEditor.editingRow = objectRow objEditor.show() @@ -108,7 +110,7 @@ Item { height: width anchors.right: deleteButton.left anchors.rightMargin: 5 - anchors.topMargin: 5 + anchors.verticalCenter: parent.verticalCenter Setting.Icon { id: icon @@ -127,6 +129,7 @@ Item { ToolTip.text: qsTr("Set %1 %2 position").arg(obj.constructor.displayType()).arg(obj.name) onClicked: { + console.log(obj.type, obj.name) posPicker.objType = obj.type posPicker.objName = obj.name posPicker.pickX = hasXProp @@ -140,11 +143,11 @@ Item { Button { id: deleteButton - width: parent.height - 10 + width: parent.minHeight - 10 height: width anchors.right: colorPickRect.left anchors.rightMargin: 5 - anchors.topMargin: 5 + anchors.verticalCenter: parent.verticalCenter icon.name: 'delete' icon.source: '../icons/common/delete.svg' icon.color: sysPalette.buttonText @@ -164,9 +167,9 @@ Item { id: colorPickRect anchors.right: parent.right anchors.rightMargin: 5 - anchors.topMargin: 5 + anchors.verticalCenter: parent.verticalCenter color: obj.color - width: parent.height - 10 + width: parent.minHeight - 10 height: width radius: Math.min(width, height) border.width: 2 diff --git a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/Setting/Icon.qml b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/Setting/Icon.qml index 518aca0..7df012c 100644 --- a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/Setting/Icon.qml +++ b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/Setting/Icon.qml @@ -49,7 +49,7 @@ Item { //smooth: true visible: false sourceSize.width: width*2 - sourceSize.height: sourceSize.width + sourceSize.height: width*2 } ColorOverlay { anchors.fill: img diff --git a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/Setting/TextSetting.qml b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/Setting/TextSetting.qml index d9239c8..e361250 100644 --- a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/Setting/TextSetting.qml +++ b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/Setting/TextSetting.qml @@ -165,7 +165,6 @@ Item { "ₜ","¹","²","³","⁴","⁵","⁶", "⁷","⁸","⁹","⁰","₁","₂","₃", "₄","₅","₆","₇","₈","₉","₀" - ] Repeater { model: parent.insertChars.length diff --git a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/expr-eval.js b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/expr-eval.js index 5056ed2..16c3940 100644 --- a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/expr-eval.js +++ b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/expr-eval.js @@ -16,6 +16,19 @@ var IMEMBER = 'IMEMBER'; var IENDSTATEMENT = 'IENDSTATEMENT'; var IARRAY = 'IARRAY'; +// Additional variable characters. +var ADDITIONAL_VARCHARS = [ + "α","β","γ","δ","ε","ζ","η", + "π","θ","κ","λ","μ","ξ","ρ", + "ς","σ","τ","φ","χ","ψ","ω", + "Γ","Δ","Θ","Λ","Ξ","Π","Σ", + "Φ","Ψ","Ω","ₐ","ₑ","ₒ","ₓ", + "ₕ","ₖ","ₗ","ₘ","ₙ","ₚ","ₛ", + "ₜ","¹","²","³","⁴","⁵","⁶", + "⁷","⁸","⁹","⁰","₁","₂","₃", + "₄","₅","₆","₇","₈","₉","₀" + ] + function Instruction(type, value) { this.type = type; this.value = (value !== undefined && value !== null) ? value : 0; @@ -707,7 +720,7 @@ TokenStream.prototype.isName = function () { var hasLetter = false; for (; i < this.expression.length; i++) { var c = this.expression.charAt(i); - if (c.toUpperCase() === c.toLowerCase()) { + if (c.toUpperCase() === c.toLowerCase() && !ADDITIONAL_VARCHARS.includes(c)) { if (i === this.pos && (c === '$' || c === '_')) { if (c === '_') { hasLetter = true; diff --git a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/objs/common.js b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/objs/common.js index e37ad75..795d0a0 100644 --- a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/objs/common.js +++ b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/objs/common.js @@ -200,8 +200,10 @@ class DrawableObject { if(properties[property] == 'Expression' && this[property] != null) { // Expressions with dependencies for(let objName of this[property].requiredObjects()) { - this.requires.push(C.currentObjectsByName[objName]) - C.currentObjectsByName[objName].requiredBy.push(this) + if(objName in C.currentObjectsByName) { + this.requires.push(C.currentObjectsByName[objName]) + C.currentObjectsByName[objName].requiredBy.push(this) + } } if(this[property].cached && this[property].requiredObjects().length > 0) // Recalculate diff --git a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/objs/gainbode.js b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/objs/gainbode.js index a95f53e..265c9e9 100644 --- a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/objs/gainbode.js +++ b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/objs/gainbode.js @@ -52,11 +52,9 @@ class GainBode extends Common.ExecutableObject { om_0 = Objects.currentObjectsByName[om_0] if(om_0 == null) { // Create new point - om_0 = Objects.createNewRegisteredObject('Point') - om_0.name = Common.getNewName('ω') - om_0.labelContent = 'name' - om_0.color = this.color + om_0 = Objects.createNewRegisteredObject('Point', [Common.getNewName('ω'), true, this.color, 'name']) HistoryLib.history.addToHistory(new HistoryLib.CreateNewObject(om_0.name, 'Point', om_0.export())) + om_0.update() labelPosition = 'below' } om_0.requiredBy.push(this) diff --git a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/objs/phasebode.js b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/objs/phasebode.js index 63b01a6..5cbd4a9 100644 --- a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/objs/phasebode.js +++ b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/objs/phasebode.js @@ -51,10 +51,7 @@ class PhaseBode extends Common.ExecutableObject { om_0 = Objects.currentObjectsByName[om_0] if(om_0 == null) { // Create new point - om_0 = Objects.createNewRegisteredObject('Point') - om_0.name = Common.getNewName('ω') - om_0.color = this.color - om_0.labelContent = 'name' + om_0 = Objects.createNewRegisteredObject('Point', [Common.getNewName('ω'), this.color, 'name']) om_0.labelPosition = this.phase.execute() >= 0 ? 'above' : 'below' HistoryLib.history.addToHistory(new HistoryLib.CreateNewObject(om_0.name, 'Point', om_0.export())) labelPosition = 'below'