Moved to old version on yat due to crashes. Disabled scrolling due to glitches.
This commit is contained in:
@@ -28,19 +28,15 @@ Item {
|
||||
|
||||
property real characterWidth: 0
|
||||
property real characterHeight: 0
|
||||
property int screenWidth: 0
|
||||
property int screenWidth: width / characterWidth
|
||||
|
||||
property int startX
|
||||
property int startY
|
||||
|
||||
property int endX
|
||||
property int endY
|
||||
property point start
|
||||
property point end
|
||||
|
||||
property color color: "grey"
|
||||
|
||||
y: startY * characterHeight
|
||||
width: parent.width
|
||||
height: (endY - startY + 1) * characterHeight
|
||||
height: parent.height
|
||||
|
||||
opacity: 0.8
|
||||
|
||||
@@ -75,29 +71,27 @@ Item {
|
||||
onCharacterHeightChanged: calculateRectangles();
|
||||
onScreenWidthChanged: calculateRectangles();
|
||||
|
||||
onStartXChanged: calculateRectangles();
|
||||
onStartYChanged: calculateRectangles();
|
||||
onEndXChanged: calculateRectangles();
|
||||
onEndYChanged: calculateRectangles();
|
||||
onStartChanged: calculateRectangles();
|
||||
onEndChanged: calculateRectangles();
|
||||
|
||||
function calculateRectangles() {
|
||||
highlightArea.y = startY * characterHeight;
|
||||
begginning_rectangle.x = startX * characterWidth;
|
||||
if (startY === endY) {
|
||||
highlightArea.y = start.y * characterHeight;
|
||||
begginning_rectangle.x = start.x * characterWidth;
|
||||
if (start.y === end.y) {
|
||||
middle_rectangle.visible = false;
|
||||
end_rectangle.visible = false
|
||||
begginning_rectangle.width = (endX - startX) * characterWidth;
|
||||
begginning_rectangle.width = (end.x - start.x) * characterWidth;
|
||||
} else {
|
||||
begginning_rectangle.width = (screenWidth - startX) * characterWidth;
|
||||
if (startY === endY - 1) {
|
||||
begginning_rectangle.width = (screenWidth - start.x) * characterWidth;
|
||||
if (start.y === end.y - 1) {
|
||||
middle_rectangle.height = 0;
|
||||
middle_rectangle.visible = false;
|
||||
}else {
|
||||
middle_rectangle.visible = true;
|
||||
middle_rectangle.height = (endY - startY - 1) * characterHeight;
|
||||
middle_rectangle.height = (end.y - start.y - 1) * characterHeight;
|
||||
}
|
||||
end_rectangle.visible = true;
|
||||
end_rectangle.width = endX * characterWidth;
|
||||
end_rectangle.width = end.x * characterWidth;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
*******************************************************************************/
|
||||
|
||||
import QtQuick 2.0
|
||||
import QtQuick.Controls 1.1
|
||||
|
||||
import org.yat 1.0
|
||||
|
||||
@@ -40,17 +39,6 @@ TerminalScreen {
|
||||
font.family: "menlo"
|
||||
focus: true
|
||||
|
||||
Action {
|
||||
id: copyAction
|
||||
shortcut: "Ctrl+Shift+C"
|
||||
onTriggered: screen.selection.sendToClipboard()
|
||||
}
|
||||
Action {
|
||||
id: paseAction
|
||||
shortcut: "Ctrl+Shift+V"
|
||||
onTriggered: screen.selection.pasteFromClipboard()
|
||||
}
|
||||
|
||||
onActiveFocusChanged: {
|
||||
if (activeFocus) {
|
||||
Qt.inputMethod.show();
|
||||
@@ -90,22 +78,7 @@ TerminalScreen {
|
||||
anchors.fill: parent
|
||||
color: terminal.screen.defaultBackgroundColor
|
||||
}
|
||||
|
||||
HighlightArea {
|
||||
characterHeight: fontHeight
|
||||
characterWidth: fontWidth
|
||||
screenWidth: terminalWindow.width
|
||||
|
||||
startX: screen.selection.startX
|
||||
startY: screen.selection.startY
|
||||
|
||||
endX: screen.selection.endX
|
||||
endY: screen.selection.endY
|
||||
|
||||
visible: screen.selection.enable
|
||||
}
|
||||
}
|
||||
|
||||
onContentYChanged: {
|
||||
if (!atYEnd) {
|
||||
var top_line = Math.floor(Math.max(contentY,0) / screenItem.fontHeight);
|
||||
@@ -195,6 +168,16 @@ TerminalScreen {
|
||||
}
|
||||
}
|
||||
|
||||
HighlightArea {
|
||||
characterHeight: fontHeight
|
||||
characterWidth: fontWidth
|
||||
|
||||
start: screen.selectionAreaStart
|
||||
end: screen.selectionAreaEnd
|
||||
|
||||
visible: screen.selectionEnabled
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: flash
|
||||
z: 1.2
|
||||
@@ -221,49 +204,39 @@ TerminalScreen {
|
||||
MouseArea {
|
||||
id:mousArea
|
||||
|
||||
property int drag_start_x
|
||||
property int drag_start_y
|
||||
property point drag_start
|
||||
|
||||
anchors.fill: parent
|
||||
acceptedButtons: Qt.LeftButton | Qt.MiddleButton
|
||||
onPressed: {
|
||||
if (mouse.button == Qt.LeftButton) {
|
||||
hoverEnabled = true;
|
||||
var transformed_mouse = mapToItem(textContainer, mouse.x, mouse.y);
|
||||
var character = Math.floor((transformed_mouse.x / fontWidth));
|
||||
var line = Math.floor(transformed_mouse.y / fontHeight);
|
||||
var character = Math.floor((mouse.x / screen.charWidth));
|
||||
var line = Math.floor(mouse.y / screen.lineHeight);
|
||||
var start = Qt.point(character,line);
|
||||
drag_start_x = character;
|
||||
drag_start_y = line;
|
||||
screen.selection.startX = character;
|
||||
screen.selection.startY = line;
|
||||
screen.selection.endX = character;
|
||||
screen.selection.endY = line;
|
||||
drag_start = start;
|
||||
screen.selectionAreaStart = start;
|
||||
screen.selectionAreaEnd = start;
|
||||
}
|
||||
}
|
||||
|
||||
onPositionChanged: {
|
||||
var transformed_mouse = mapToItem(textContainer, mouse.x, mouse.y);
|
||||
var character = Math.floor(transformed_mouse.x / fontWidth);
|
||||
var line = Math.floor(transformed_mouse.y / fontHeight);
|
||||
var character = Math.floor(mouse.x / screen.charWidth);
|
||||
var line = Math.floor(mouse.y / screen.lineHeight);
|
||||
var current_pos = Qt.point(character,line);
|
||||
if (line < drag_start_y || (line === drag_start_y && character < drag_start_x)) {
|
||||
screen.selection.startX = character;
|
||||
screen.selection.startY = line;
|
||||
screen.selection.endX = drag_start_x;
|
||||
screen.selection.endY = drag_start_y;
|
||||
if (line < drag_start.y || (line === drag_start.y && character < drag_start.x)) {
|
||||
screen.selectionAreaStart = current_pos;
|
||||
screen.selectionAreaEnd = drag_start;
|
||||
}else {
|
||||
screen.selection.startX = drag_start_x;
|
||||
screen.selection.startY = drag_start_y;
|
||||
screen.selection.endX = character;
|
||||
screen.selection.endY = line;
|
||||
screen.selectionAreaEnd = current_pos;
|
||||
screen.selectionAreaStart = drag_start;
|
||||
}
|
||||
}
|
||||
|
||||
onReleased: {
|
||||
if (mouse.button == Qt.LeftButton) {
|
||||
hoverEnabled = false;
|
||||
screen.selection.sendToSelection();
|
||||
screen.sendSelectionToSelection();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -272,12 +245,10 @@ TerminalScreen {
|
||||
screen.pasteFromSelection();
|
||||
}
|
||||
}
|
||||
|
||||
onDoubleClicked: {
|
||||
if (mouse.button == Qt.LeftButton) {
|
||||
var transformed_mouse = mapToItem(textContainer, mouse.x, mouse.y);
|
||||
var character = Math.floor(transformed_mouse.x / fontWidth);
|
||||
var line = Math.floor(transformed_mouse.y / fontHeight);
|
||||
var character = Math.floor(mouse.x / screen.charWidth);
|
||||
var line = Math.floor(mouse.y / screen.lineHeight);
|
||||
screen.doubleClicked(Qt.point(character,line));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user