Fixing a LOT of issues stemming from X cursor
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
92594f5af3
commit
0075c03c9d
6 changed files with 50 additions and 20 deletions
|
@ -224,8 +224,6 @@ ApplicationWindow {
|
||||||
settings.linewidth = data["linewidth"]
|
settings.linewidth = data["linewidth"]
|
||||||
if("textsize" in data)
|
if("textsize" in data)
|
||||||
settings.textsize = data["textsize"]
|
settings.textsize = data["textsize"]
|
||||||
if("history" in data)
|
|
||||||
history.unserialize(...data["history"])
|
|
||||||
root.height = data["height"]
|
root.height = data["height"]
|
||||||
root.width = data["width"]
|
root.width = data["width"]
|
||||||
|
|
||||||
|
@ -242,6 +240,11 @@ ApplicationWindow {
|
||||||
error += qsTr("Unknown object type: %1.").arg(objType) + "\n";
|
error += qsTr("Unknown object type: %1.").arg(objType) + "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Importing history
|
||||||
|
if("history" in data)
|
||||||
|
history.unserialize(...data["history"])
|
||||||
|
|
||||||
// Refreshing sidebar
|
// Refreshing sidebar
|
||||||
if(sidebarSelector.currentIndex == 0) {
|
if(sidebarSelector.currentIndex == 0) {
|
||||||
// For some reason, if we load a file while the tab is on object,
|
// For some reason, if we load a file while the tab is on object,
|
||||||
|
|
|
@ -179,9 +179,13 @@ D.Dialog {
|
||||||
icon: visible ? `icons/settings/custom/${parent.label}.svg` : ''
|
icon: visible ? `icons/settings/custom/${parent.label}.svg` : ''
|
||||||
// True to select an object of type, false for enums.
|
// True to select an object of type, false for enums.
|
||||||
property bool selectObjMode: paramTypeIn(modelData[1], ['ObjectType'])
|
property bool selectObjMode: paramTypeIn(modelData[1], ['ObjectType'])
|
||||||
|
property bool isRealObject: !selectedObj || (modelData[1].objType != "ExecutableObject" && modelData[1].objType != "DrawableObject")
|
||||||
|
|
||||||
property var baseModel: visible ?
|
property var baseModel: visible ?
|
||||||
(selectObjMode ? Objects.getObjectsName(modelData[1].objType).concat([qsTr("+ Create new %1").arg(modelData[1].objType)]) : modelData[1].values)
|
(selectObjMode ? Objects.getObjectsName(modelData[1].objType)
|
||||||
|
.concat(
|
||||||
|
isRealObject ? [qsTr("+ Create new %1").arg(modelData[1].objType)] : [])
|
||||||
|
: modelData[1].values)
|
||||||
: []
|
: []
|
||||||
// Translate the model if necessary.
|
// Translate the model if necessary.
|
||||||
model: selectObjMode ? baseModel : baseModel.map(x => qsTr(x))
|
model: selectObjMode ? baseModel : baseModel.map(x => qsTr(x))
|
||||||
|
@ -193,16 +197,20 @@ D.Dialog {
|
||||||
// This is only done when what we're selecting are Objects.
|
// This is only done when what we're selecting are Objects.
|
||||||
// Setting object property.
|
// Setting object property.
|
||||||
var selectedObj = Objects.getObjectByName(baseModel[newIndex], modelData[1].objType)
|
var selectedObj = Objects.getObjectByName(baseModel[newIndex], modelData[1].objType)
|
||||||
if(selectedObj == null) {
|
if(newIndex != 0) {
|
||||||
// Creating new object.
|
// Make sure we don't set the object to null.
|
||||||
selectedObj = Objects.createNewRegisteredObject(modelData[1].objType)
|
if(selectedObj == null) {
|
||||||
history.addToHistory(new HistoryLib.CreateNewObject(selectedObj.name, modelData[1].objType, selectedObj.export()))
|
// Creating new object.
|
||||||
baseModel = Objects.getObjectsName(modelData[1].objType).concat([qsTr("+ Create new %1").arg(Objects.types[modelData[1].objType].displayType())])
|
selectedObj = Objects.createNewRegisteredObject(modelData[1].objType)
|
||||||
currentIndex = baseModel.indexOf(selectedObj.name)
|
history.addToHistory(new HistoryLib.CreateNewObject(selectedObj.name, modelData[1].objType, selectedObj.export()))
|
||||||
|
baseModel = Objects.getObjectsName(modelData[1].objType).concat(
|
||||||
|
isRealObject ? [qsTr("+ Create new %1").arg(modelData[1].objType)] : [])
|
||||||
|
currentIndex = baseModel.indexOf(selectedObj.name)
|
||||||
|
}
|
||||||
|
selectedObj.requiredBy.push(Objects.currentObjects[objEditor.objType][objEditor.objIndex])
|
||||||
|
//Objects.currentObjects[objEditor.objType][objEditor.objIndex].requiredBy = objEditor.obj[modelData[0]].filter((obj) => objEditor.obj.name != obj.name)
|
||||||
}
|
}
|
||||||
//Objects.currentObjects[objEditor.objType][objEditor.objIndex].requiredBy = objEditor.obj[modelData[0]].filter((obj) => objEditor.obj.name != obj.name)
|
|
||||||
objEditor.obj.requiredBy = objEditor.obj.requiredBy.filter((obj) => objEditor.obj.name != obj.name)
|
objEditor.obj.requiredBy = objEditor.obj.requiredBy.filter((obj) => objEditor.obj.name != obj.name)
|
||||||
selectedObj.requiredBy.push(Objects.currentObjects[objEditor.objType][objEditor.objIndex])
|
|
||||||
history.addToHistory(new HistoryLib.EditedProperty(
|
history.addToHistory(new HistoryLib.EditedProperty(
|
||||||
objEditor.obj.name, objEditor.objType, modelData[0],
|
objEditor.obj.name, objEditor.objType, modelData[0],
|
||||||
objEditor.obj[modelData[0]], selectedObj
|
objEditor.obj[modelData[0]], selectedObj
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
.pragma library
|
.pragma library
|
||||||
|
|
||||||
.import "objects.js" as Objects
|
.import "objects.js" as Objects
|
||||||
|
.import "objs/common.js" as Common
|
||||||
.import "utils.js" as Utils
|
.import "utils.js" as Utils
|
||||||
.import "mathlib.js" as MathLib
|
.import "mathlib.js" as MathLib
|
||||||
|
|
||||||
|
@ -106,8 +107,17 @@ class EditedProperty extends Action {
|
||||||
this.previousValue = previousValue
|
this.previousValue = previousValue
|
||||||
this.newValue = newValue
|
this.newValue = newValue
|
||||||
if(valueIsExpressionNeedingImport) {
|
if(valueIsExpressionNeedingImport) {
|
||||||
this.previousValue = new MathLib.Expression(this.previousValue);
|
if(targetType == "Expression") {
|
||||||
this.newValue = new MathLib.Expression(this.newValue);
|
this.previousValue = new MathLib.Expression(this.previousValue);
|
||||||
|
this.newValue = new MathLib.Expression(this.newValue);
|
||||||
|
} else if(targetType == "Domain") {
|
||||||
|
this.previousValue = MathLib.parseDomain(this.previousValue);
|
||||||
|
this.newValue = MathLib.parseDomain(this.newValue);
|
||||||
|
} else {
|
||||||
|
// Objects
|
||||||
|
this.previousValue = Objects.getObjectByName(this.previousValue);
|
||||||
|
this.newValue = Objects.getObjectByName(this.newValue);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -122,6 +132,9 @@ class EditedProperty extends Action {
|
||||||
export() {
|
export() {
|
||||||
if(this.previousValue instanceof MathLib.Expression) {
|
if(this.previousValue instanceof MathLib.Expression) {
|
||||||
return [this.targetName, this.targetType, this.targetProperty, this.previousValue.toEditableString(), this.newValue.toEditableString(), true]
|
return [this.targetName, this.targetType, this.targetProperty, this.previousValue.toEditableString(), this.newValue.toEditableString(), true]
|
||||||
|
} else if(this.previousValue instanceof Common.DrawableObject) {
|
||||||
|
return [this.targetName, this.targetType, this.targetProperty, this.previousValue.name, this.newValue.name, true]
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
return [this.targetName, this.targetType, this.targetProperty, this.previousValue, this.newValue, false]
|
return [this.targetName, this.targetType, this.targetProperty, this.previousValue, this.newValue, false]
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@ var currentObjects = {}
|
||||||
|
|
||||||
function getObjectByName(objName, objType = null) {
|
function getObjectByName(objName, objType = null) {
|
||||||
var objectTypes = Object.keys(currentObjects)
|
var objectTypes = Object.keys(currentObjects)
|
||||||
if(typeof objType == 'string') {
|
if(typeof objType == 'string' && objType != "") {
|
||||||
if(objType == "ExecutableObject") {
|
if(objType == "ExecutableObject") {
|
||||||
objectTypes = getExecutableTypes()
|
objectTypes = getExecutableTypes()
|
||||||
} else if(currentObjects[objType] != undefined) {
|
} else if(currentObjects[objType] != undefined) {
|
||||||
|
@ -37,12 +37,14 @@ function getObjectByName(objName, objType = null) {
|
||||||
}
|
}
|
||||||
if(Array.isArray(objType)) objectTypes = objType
|
if(Array.isArray(objType)) objectTypes = objType
|
||||||
var retObj = null
|
var retObj = null
|
||||||
objectTypes.forEach(function(objType){
|
if(objName != "" && objName != null) {
|
||||||
if(currentObjects[objType] == undefined) return null
|
objectTypes.forEach(function(objType){
|
||||||
currentObjects[objType].forEach(function(obj){
|
if(currentObjects[objType] == undefined) return null
|
||||||
if(obj.name == objName) retObj = obj
|
currentObjects[objType].forEach(function(obj){
|
||||||
|
if(obj.name == objName) retObj = obj
|
||||||
|
})
|
||||||
})
|
})
|
||||||
})
|
}
|
||||||
return retObj
|
return retObj
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -110,6 +110,10 @@ class DrawableObject {
|
||||||
}
|
}
|
||||||
|
|
||||||
draw(canvas, ctx) {}
|
draw(canvas, ctx) {}
|
||||||
|
|
||||||
|
toString() {
|
||||||
|
return this.name;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class ExecutableObject extends DrawableObject {
|
class ExecutableObject extends DrawableObject {
|
||||||
|
|
|
@ -6,7 +6,7 @@ bash release.sh
|
||||||
cd ../../
|
cd ../../
|
||||||
|
|
||||||
# Deb
|
# Deb
|
||||||
python3 setup.py --remove-git-version --command-packages=stdeb.command sdist_dsc \
|
sudo python3 setup.py --remove-git-version --command-packages=stdeb.command sdist_dsc \
|
||||||
--package logarithmplotter --copyright-file linux/debian/copyright --suite impish --depends3 "$(cat linux/debian/depends)" --section science \
|
--package logarithmplotter --copyright-file linux/debian/copyright --suite impish --depends3 "$(cat linux/debian/depends)" --section science \
|
||||||
bdist_deb
|
bdist_deb
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue