-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathMain.qml
More file actions
132 lines (103 loc) · 3.21 KB
/
Main.qml
File metadata and controls
132 lines (103 loc) · 3.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
import QtQuick
import QtQuick.Layouts
Window {
id: win
//width: 640
//height: 480
visible: true
title: "GoodASM"
onHeightChanged: update()
onWidthChanged: update()
// Inform the C++ world that the input changed.
signal updateSignal(msg: string)
function update(){
//We do assembly here.
textout.text=goodasm.updateSlot(edit.text);
//Set the font.
edit.font=fixedFont;
textout.font=fixedFont;
//Here we ensure that the input edit position is shown in both views.
flickedit.ensureVisible(edit.cursorRectangle);
flickout.ensureVisible(edit.cursorRectangle);
}
Flickable {
id: flickout
Layout.fillHeight: true
Layout.fillWidth: true
clip: true
function ensureVisible(r) {
if (contentX >= r.x)
contentX = r.x;
else if (contentX+width <= r.x+r.width)
contentX = r.x+r.width-width;
if (contentY >= r.y)
contentY = r.y;
else if (contentY+height <= r.y+r.height)
contentY = r.y+r.height-height;
}
Text {
id: textout
Layout.fillHeight: true
Layout.fillWidth: true
color: "steelblue"
text: "blue text\nblue text."
/*
font.family: "Courier" //macOS
font.features: font.Monospace
font.hintingPreference: font.Monospace
font.styleName: font.Monospace
//font.family: "DejaVu Sans Mono"
font.kerning: false
*/
}
}
Flickable {
id: flickedit
Layout.fillHeight: true
Layout.fillWidth: true
clip: true
function ensureVisible(r) {
if (contentX >= r.x)
contentX = r.x;
else if (contentX+width <= r.x+r.width)
contentX = r.x+r.width-width;
if (contentY >= r.y)
contentY = r.y;
else if (contentY+height <= r.y+r.height)
contentY = r.y+r.height-height;
}
TextEdit {
id: edit
Layout.fillHeight: true
Layout.fillWidth: true
focus: true
wrapMode: TextEdit.NoWrap
onCursorRectangleChanged: win.update()
onTextChanged: win.update()
//font.family: "Courier"
text: ".lang fcard\nloop:\n lda #0x99 ; famous 99\n jsr 0x1e7f ; send byte\n bra loop ; tx forever\n\n .ib 2d ; Disass\n\n"
}
}
GridLayout {
id: editgrid
anchors.fill: parent
columns: 1
//60 pixels at the top seems right for Android.
//iOS?
Rectangle {
id: filltop
Layout.preferredWidth: win.width
Layout.preferredHeight: 30
color: "#00414A"
}
LayoutItemProxy { target: flickedit }
LayoutItemProxy { target: flickout }
//Covers the Android keyboard.
//iOS? Windows?
Rectangle {
Layout.preferredWidth: win.width
Layout.preferredHeight: win.height/3-40
color: "#00414A"
}
}
}