Skip to content

Commit

Permalink
Add note tool
Browse files Browse the repository at this point in the history
Closes #136.
  • Loading branch information
mitchcurtis committed Oct 20, 2019
1 parent 66fb52d commit 923ec40
Show file tree
Hide file tree
Showing 48 changed files with 2,077 additions and 269 deletions.
8 changes: 8 additions & 0 deletions app/images/images.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@
<file>lock-splitter@2x.png</file>
<file>lock-splitter@3x.png</file>
<file>lock-splitter@4x.png</file>
<file>note.png</file>
<file>note@2x.png</file>
<file>note@3x.png</file>
<file>note@4x.png</file>
<file>opacity.png</file>
<file>opacity@2x.png</file>
<file>opacity@3x.png</file>
Expand All @@ -65,6 +69,10 @@
<file>show-guides@2x.png</file>
<file>show-guides@3x.png</file>
<file>show-guides@4x.png</file>
<file>show-notes.png</file>
<file>show-notes@2x.png</file>
<file>show-notes@3x.png</file>
<file>show-notes@4x.png</file>
<file>show-rulers.png</file>
<file>show-rulers@2x.png</file>
<file>show-rulers@3x.png</file>
Expand Down
Binary file added app/images/note.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
79 changes: 79 additions & 0 deletions app/images/note.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/images/note@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/images/note@3x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/images/note@4x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
46 changes: 21 additions & 25 deletions app/images/show-guides.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/images/show-notes.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
92 changes: 92 additions & 0 deletions app/images/show-notes.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/images/show-notes@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/images/show-notes@3x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/images/show-notes@4x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 19 additions & 0 deletions app/qml/main.qml
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,17 @@ ApplicationWindow {
Connections {
target: canvas
onErrorOccurred: errorPopup.showError(errorMessage)
onNoteCreationRequested: {
noteDialog.currentAction = Ui.NoteDialog.NoteAction.Create
noteDialog.newNoteX = canvas.cursorSceneX
noteDialog.newNoteY = canvas.cursorSceneY
noteDialog.open()
}
onNoteModificationRequested: {
noteDialog.currentAction = Ui.NoteDialog.NoteAction.Modify
noteDialog.modifyingNoteIndex = noteIndex
noteDialog.open()
}
}

Ui.UiStateSerialisation {
Expand Down Expand Up @@ -485,6 +496,14 @@ ApplicationWindow {
canvas: window.canvas
}

Ui.NoteDialog {
id: noteDialog
parent: Overlay.overlay
anchors.centerIn: parent
project: projectManager.project
canvas: window.canvas
}

Ui.AboutDialog {
id: aboutDialog
parent: Overlay.overlay
Expand Down
1 change: 1 addition & 0 deletions app/qml/qml.qbs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ Group {
"ui/NewLayeredImageProjectPopup.qml",
"ui/NewProjectPopup.qml",
"ui/NewTilesetProjectPopup.qml",
"ui/NoteDialog.qml",
"ui/OpacityDialog.qml",
"ui/OptionsDialog.qml",
"ui/Panel.qml",
Expand Down
1 change: 1 addition & 0 deletions app/qml/qml.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
<file>ui/NewLayeredImageProjectPopup.qml</file>
<file>ui/NewProjectPopup.qml</file>
<file>ui/NewTilesetProjectPopup.qml</file>
<file>ui/NoteDialog.qml</file>
<file>ui/OpacityDialog.qml</file>
<file>ui/OptionsDialog.qml</file>
<file>ui/Panel.qml</file>
Expand Down
45 changes: 23 additions & 22 deletions app/qml/ui/CanvasPaneRepeater.qml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ Repeater {
/*
The stacking order for child items of ImageCanvas is as follows:
+--------------------------+
| ImageCanvas (parent) |
| +--------------------------+
Expand All @@ -24,27 +23,29 @@ Repeater {
| | | +--------------------------+
| | | | Guides |
| | | | +--------------------------+
+---| | | | Selection Item
| | | | +--------------------------+
| 1 | | | | Selection Cursor Guide |
+---| | | | +--------------------------+
| 2 | | | | First Horizontal Ruler |
+---| | | | +--------------------------+
| 3 | | | | First Vertical Ruler |
+---| | | | +--------------------------+
| 4 | | | | Second Horizontal Ruler |
+---| | | | +--------------------------+
| 5 | | | | Second Vertical Ruler |
+---| | | | |
| 6 | | | |
+---| | | |
| 7 | | |
+---| | |
| 8 | |
+---| |
| 9 |
+--------------------------+
| | | | | Selection Item |
| | | | | +--------------------------+
+---| | | | | Selection Cursor Guide |
| | | | | +--------------------------+
| 1 | | | | | First Horizontal Ruler |
+---| | | | | +--------------------------+
| 2 | | | | | First Vertical Ruler |
+---| | | | | +--------------------------+
| 3 | | | | | Second Horizontal Ruler |
+---| | | | | +--------------------------+
| 4 | | | | | Second Vertical Ruler |
+---| | | | | +--------------------------+
| 5 | | | | | Notes |
+---| | | | | |
| 6 | | | | |
+---| | | | |
| 7 | | | |
+---| | | |
| 8 | | |
+---| | |
| 9 | |
+---| 10 |
|--------------------------+
Each item is a direct child of ImageCanvas.
Expand Down
4 changes: 2 additions & 2 deletions app/qml/ui/ImageTypeCanvas.qml
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ ImageCanvas {

readonly property int currentPaneZoomLevel: imageCanvas.currentPane ? imageCanvas.currentPane.integerZoomLevel : 1
readonly property point currentPaneOffset: imageCanvas.currentPane ? imageCanvas.currentPane.integerOffset : Qt.point(0, 0)
readonly property bool useCrosshairCursor: imageCanvas.tool === TileCanvas.SelectionTool
readonly property bool useCrosshairCursor: imageCanvas.tool === ImageCanvas.SelectionTool || imageCanvas.tool === ImageCanvas.NoteTool
|| (imageCanvas.toolSize < 4 && imageCanvas.currentPaneZoomLevel <= 3)
readonly property bool useIconCursor: imageCanvas.tool === TileCanvas.EyeDropperTool
readonly property bool useIconCursor: imageCanvas.tool === ImageCanvas.EyeDropperTool

onErrorOccurred: errorPopup.showError(errorMessage)

Expand Down
2 changes: 1 addition & 1 deletion app/qml/ui/LayeredImageTypeCanvas.qml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ LayeredImageCanvas {

readonly property int currentPaneZoomLevel: layeredCanvas.currentPane ? layeredCanvas.currentPane.integerZoomLevel : 1
readonly property point currentPaneOffset: layeredCanvas.currentPane ? layeredCanvas.currentPane.integerOffset : Qt.point(0, 0)
readonly property bool useCrosshairCursor: layeredCanvas.tool === ImageCanvas.SelectionTool
readonly property bool useCrosshairCursor: layeredCanvas.tool === ImageCanvas.SelectionTool || layeredCanvas.tool === ImageCanvas.NoteTool
|| (layeredCanvas.toolSize < 4 && layeredCanvas.currentPaneZoomLevel <= 3)
readonly property bool useIconCursor: layeredCanvas.tool === ImageCanvas.EyeDropperTool

Expand Down
Loading

0 comments on commit 923ec40

Please sign in to comment.