| 1 |
import QtQuick |
| 2 |
|
| 3 |
import Muse.UiComponents |
| 4 |
|
| 5 |
import Audacity.ProjectScene |
| 6 |
|
| 7 |
Rectangle { |
| 8 |
|
| 9 |
id: root |
| 10 |
|
| 11 |
property alias context: timelineContext |
| 12 |
property alias ruler: timelineRuler |
| 13 |
|
| 14 |
signal clicked(var mouse) |
| 15 |
|
| 16 |
color: ui.theme.backgroundSecondaryColor |
| 17 |
|
| 18 |
//! NOTE This element must be the same width as the track wave visible area. |
| 19 |
//! If this is different, than appropriate changes must be made. |
| 20 |
onWidthChanged: { |
| 21 |
timelineContext.onResizeFrameWidth(root.width) |
| 22 |
} |
| 23 |
|
| 24 |
function init() { |
| 25 |
timelineContext.init(root.width) |
| 26 |
} |
| 27 |
|
| 28 |
//! ~~~ TimelineContext ~~~ |
| 29 |
//! NOTE See comment in TimelineContext (.h) |
| 30 |
function onWheel(mouseX, pixelDelta, angleDelta) { |
| 31 |
return timelineContext.onWheel(mouseX, pixelDelta, angleDelta) |
| 32 |
} |
| 33 |
|
| 34 |
function onSelection(x1, x2) { |
| 35 |
timelineContext.onSelection(x1, x2) |
| 36 |
} |
| 37 |
|
| 38 |
function resetSelection() { |
| 39 |
timelineContext.resetSelection() |
| 40 |
} |
| 41 |
|
| 42 |
TimelineContextMenuModel { |
| 43 |
id: contextMenuModel |
| 44 |
} |
| 45 |
|
| 46 |
ContextMenuLoader { |
| 47 |
id: contextMenuLoader |
| 48 |
|
| 49 |
onHandleMenuItem: function(itemId) { |
| 50 |
contextMenuModel.handleMenuItem(itemId) |
| 51 |
} |
| 52 |
} |
| 53 |
|
| 54 |
TimelineContext { |
| 55 |
id: timelineContext |
| 56 |
} |
| 57 |
// ~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 58 |
|
| 59 |
TimelineRuler { |
| 60 |
id: timelineRuler |
| 61 |
anchors.fill: parent |
| 62 |
context: timelineContext |
| 63 |
} |
| 64 |
|
| 65 |
MouseArea { |
| 66 |
anchors.fill: parent |
| 67 |
acceptedButtons: Qt.LeftButton | Qt.RightButton |
| 68 |
onClicked: e => { |
| 69 |
if (e.button === Qt.LeftButton) { |
| 70 |
root.clicked(e) |
| 71 |
} else if (e.button === Qt.RightButton) { |
| 72 |
contextMenuModel.load() |
| 73 |
contextMenuLoader.show(Qt.point(e.x, e.y), contextMenuModel.items) |
| 74 |
} |
| 75 |
} |
| 76 |
} |
| 77 |
|
| 78 |
SeparatorLine { anchors.bottom: parent.bottom } |
| 79 |
} |