X Max & Y Min settings, redo stack reset option.
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Ad5001 2021-08-21 19:46:20 +02:00
parent 21f7ce3133
commit 6b70e6df9e
Signed by: Ad5001
GPG key ID: EF45F9C6AFE20160
10 changed files with 239 additions and 7 deletions

View file

@ -22,6 +22,7 @@ from json import load, dumps
DEFAULT_SETTINGS = {
"check_for_updates": True,
"reset_redo_stack": True,
"last_install_greet": "0",
"lang": "en"
}

View file

@ -113,6 +113,15 @@ MenuBar {
onTriggered: Helper.setSettingBool("check_for_updates", checked)
icon.name: 'update'
}
Action {
id: resetRedoStackMenuSetting
text: qsTr("Reset redo stack automaticly")
checkable: true
checked: Helper.getSettingBool("reset_redo_stack")
onTriggered: Helper.setSettingBool("reset_redo_stack", checked)
icon.name: 'history'
}
}
Menu {

View file

@ -97,6 +97,18 @@ Popup {
}
}
CheckBox {
id: resetRedoStackSetting
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: checkForUpdatesSetting.bottom
checked: Helper.getSettingBool("reset_redo_stack")
text: 'Reset redo stack when a new action is added to history'
onClicked: {
Helper.setSettingBool("reset_redo_stack", checked)
resetRedoStackMenuSetting.checked = checked
}
}
Button {
text: "Done"
font.pixelSize: 20
@ -107,7 +119,7 @@ Popup {
}
Timer {
running: Helper.getSetting("last_install_greet") != Helper.getVersion()
running: Helper.getSetting("last_install_greet") != Helper.getVersion()+"a"
repeat: false
interval: 50
onTriggered: greetingPopup.open()

View file

@ -67,8 +67,10 @@ Item {
console.log("Added new entry to history: " + action.getReadableString())
undoStack.push(action)
undoCount++;
redoStack = []
redoCount = 0
if(Helper.getSettingBool("reset_redo_stack")) {
redoStack = []
redoCount = 0
}
}
}

View file

@ -112,6 +112,7 @@ ApplicationWindow {
Settings {
id: settings
canvas: drawCanvas
onChanged: drawCanvas.requestPaint()
}

View file

@ -26,6 +26,7 @@ ScrollView {
signal changed()
property int settingWidth: settings.width - ScrollBar.vertical.width
property Canvas canvas
property double xzoom: 100
property double yzoom: 10
@ -73,7 +74,7 @@ ScrollView {
min: 1
icon: "icons/settings/xzoom.svg"
width: settings.settingWidth
defValue: settings.xzoom
value: settings.xzoom.toFixed(2)
onChanged: function(newValue) {
settings.xzoom = newValue
settings.changed()
@ -87,7 +88,7 @@ ScrollView {
label: "Y Zoom"
icon: "icons/settings/yzoom.svg"
width: settings.settingWidth
defValue: settings.yzoom
value: settings.yzoom.toFixed(2)
onChanged: function(newValue) {
settings.yzoom = newValue
settings.changed()
@ -105,8 +106,12 @@ ScrollView {
width: settings.settingWidth
defValue: settings.xmin
onChanged: function(newValue) {
settings.xmin = newValue
settings.changed()
if(parseFloat(maxX.value) > newValue) {
settings.xmin = newValue
settings.changed()
} else {
alert.show("Minimum x value must be inferior to maximum.")
}
}
}
@ -114,6 +119,7 @@ ScrollView {
id: maxY
height: 30
isDouble: true
min: -Infinity
label: "Max Y"
icon: "icons/settings/ymax.svg"
width: settings.settingWidth
@ -124,6 +130,44 @@ ScrollView {
}
}
TextSetting {
id: maxX
height: 30
isDouble: true
min: -Infinity
label: "Max X"
icon: "icons/settings/xmax.svg"
width: settings.settingWidth
value: canvas.px2x(canvas.canvasSize.width).toFixed(2)
onChanged: function(xvaluemax) {
if(xvaluemax > settings.xmin) {
settings.xzoom = settings.xzoom * canvas.canvasSize.width/(canvas.x2px(xvaluemax)) // Adjusting zoom to fit. = (end)/(px of current point)
settings.changed()
} else {
alert.show("Maximum x value must be superior to minimum.")
}
}
}
TextSetting {
id: minY
height: 30
isDouble: true
min: -Infinity
label: "Min Y"
icon: "icons/settings/ymin.svg"
width: settings.settingWidth
defValue: canvas.px2y(canvas.canvasSize.height).toFixed(2)
onChanged: function(yvaluemin) {
if(yvaluemin < settings.ymax) {
settings.yzoom = settings.yzoom * canvas.canvasSize.height/(canvas.y2px(yvaluemin)) // Adjusting zoom to fit. = (end)/(px of current point)
settings.changed()
} else {
alert.show("Minimum y value must be inferior to maximum.")
}
}
}
TextSetting {
id: xAxisStep
height: 30

View file

@ -30,6 +30,7 @@ Item {
property double min: -1
property string label
property string defValue
property alias value: input.text
property string icon: ""
Icon {

View file

@ -0,0 +1 @@
<svg width="24" height="24" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd"><path d="M5.829 21c-.412 1.165-1.524 2-2.829 2-1.656 0-3-1.344-3-3s1.344-3 3-3c1.305 0 2.417.835 2.829 2h3.342c.412-1.165 1.524-2 2.829-2 1.305 0 2.417.835 2.829 2h3.342c.412-1.165 1.524-2 2.829-2 1.656 0 3 1.344 3 3s-1.344 3-3 3c-1.305 0-2.417-.835-2.829-2h-3.342c-.412 1.165-1.524 2-2.829 2-1.305 0-2.417-.835-2.829-2h-3.342zm6.171-2c.552 0 1 .448 1 1s-.448 1-1 1-1-.448-1-1 .448-1 1-1zm0-18c-2.624 0-5 2.127-5 4.751 0 2.624 2.168 5.756 5 10.249 2.832-4.493 5-7.625 5-10.249 0-2.624-2.376-4.751-5-4.751zm0 7c-1.105 0-2-.895-2-2s.895-2 2-2 2 .895 2 2-.895 2-2 2z"/></svg>

After

Width:  |  Height:  |  Size: 675 B

View file

@ -0,0 +1,80 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="24.0px"
height="24.0px"
viewBox="0 0 24.0 24.0"
version="1.1"
id="SVGRoot"
sodipodi:docname="xmax.svg"
inkscape:version="1.0.2 (e86c870879, 2021-01-15)">
<defs
id="defs836" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="22.4"
inkscape:cx="7.9418411"
inkscape:cy="14.202968"
inkscape:document-units="px"
inkscape:current-layer="layer1"
inkscape:document-rotation="0"
showgrid="true"
inkscape:window-width="1920"
inkscape:window-height="1011"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="1">
<inkscape:grid
type="xygrid"
id="grid1406" />
</sodipodi:namedview>
<metadata
id="metadata839">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title />
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Calque 1"
inkscape:groupmode="layer"
id="layer1">
<rect
style="fill:#000000;fill-rule:evenodd;stroke-width:4.24264"
id="rect1418"
width="2"
height="18"
x="7"
y="3" />
<rect
style="fill:#000000;fill-rule:evenodd;stroke-width:3.65149"
id="rect1420"
width="20"
height="2"
x="2"
y="15" />
<rect
style="fill:#ff0000;fill-rule:evenodd;stroke-width:1.78884"
id="rect1413"
width="1"
height="8"
x="19"
y="12" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.1 KiB

View file

@ -0,0 +1,81 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="24.0px"
height="24.0px"
viewBox="0 0 24.0 24.0"
version="1.1"
id="SVGRoot"
sodipodi:docname="ymin.svg"
inkscape:version="1.0.2 (e86c870879, 2021-01-15)">
<defs
id="defs836" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="22.4"
inkscape:cx="7.9418411"
inkscape:cy="14.202968"
inkscape:document-units="px"
inkscape:current-layer="layer1"
inkscape:document-rotation="0"
showgrid="true"
inkscape:window-width="1920"
inkscape:window-height="1011"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="1">
<inkscape:grid
type="xygrid"
id="grid1406" />
</sodipodi:namedview>
<metadata
id="metadata839">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title />
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Calque 1"
inkscape:groupmode="layer"
id="layer1">
<rect
style="fill:#000000;fill-rule:evenodd;stroke-width:4.24264"
id="rect1418"
width="2"
height="18"
x="7"
y="3" />
<rect
style="fill:#000000;fill-rule:evenodd;stroke-width:3.65149"
id="rect1420"
width="20"
height="2"
x="2"
y="15" />
<rect
style="fill:#ff0000;fill-rule:evenodd;stroke-width:1.78884"
id="rect1413"
width="1"
height="8"
x="19"
y="-12"
transform="rotate(90)" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.1 KiB