mirror of
https://github.com/Swordfish90/cool-retro-term.git
synced 2025-02-21 20:39:00 +00:00
Removed unuseful comments from TerminalDisplay.cpp
This commit is contained in:
parent
bde7ed901c
commit
2ecff6276c
@ -479,18 +479,6 @@ void KTerminalDisplay::doPaste(QString text, bool appendReturn)
|
|||||||
if (appendReturn)
|
if (appendReturn)
|
||||||
text.append("\r");
|
text.append("\r");
|
||||||
|
|
||||||
// if (text.length() > 8000) {
|
|
||||||
// if (KMessageBox::warningContinueCancel(window(),
|
|
||||||
// i18np("Are you sure you want to paste %1 character?",
|
|
||||||
// "Are you sure you want to paste %1 characters?",
|
|
||||||
// text.length()),
|
|
||||||
// i18n("Confirm Paste"),
|
|
||||||
// KStandardGuiItem::cont(),
|
|
||||||
// KStandardGuiItem::cancel(),
|
|
||||||
// "ShowPasteHugeTextWarning") == KMessageBox::Cancel)
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
|
|
||||||
if (!text.isEmpty()) {
|
if (!text.isEmpty()) {
|
||||||
text.replace('\n', '\r');
|
text.replace('\n', '\r');
|
||||||
// if (bracketedPasteMode()) {
|
// if (bracketedPasteMode()) {
|
||||||
@ -549,8 +537,6 @@ void KTerminalDisplay::mousePressEvent(QPoint position, int but, int mod)
|
|||||||
// return;
|
// return;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
//if (!contentsRect().contains(ev->pos())) return;
|
|
||||||
|
|
||||||
if (!_screenWindow) return;
|
if (!_screenWindow) return;
|
||||||
|
|
||||||
int charLine;
|
int charLine;
|
||||||
@ -559,64 +545,31 @@ void KTerminalDisplay::mousePressEvent(QPoint position, int but, int mod)
|
|||||||
QPoint pos = QPoint(charColumn, charLine);
|
QPoint pos = QPoint(charColumn, charLine);
|
||||||
|
|
||||||
if (button == Qt::LeftButton) {
|
if (button == Qt::LeftButton) {
|
||||||
// request the software keyboard, if any
|
|
||||||
// if (qApp->autoSipEnabled()) {
|
|
||||||
// QStyle::RequestSoftwareInputPanel behavior = QStyle::RequestSoftwareInputPanel(
|
|
||||||
// style()->styleHint(QStyle::SH_RequestSoftwareInputPanel));
|
|
||||||
// if (hasFocus() || behavior == QStyle::RSIP_OnMouseClick) {
|
|
||||||
// QEvent event(QEvent::RequestSoftwareInputPanel);
|
|
||||||
// QApplication::sendEvent(this, &event);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
_lineSelectionMode = false;
|
_lineSelectionMode = false;
|
||||||
_wordSelectionMode = false;
|
_wordSelectionMode = false;
|
||||||
|
|
||||||
// The user clicked inside selected text
|
_preserveLineBreaks = !((modifiers & Qt::ControlModifier) && !(modifiers & Qt::AltModifier));
|
||||||
//bool selected = _screenWindow->isSelected(pos.x(), pos.y());
|
_columnSelectionMode = (modifiers & Qt::AltModifier) && (modifiers & Qt::ControlModifier);
|
||||||
|
|
||||||
// Drag only when the Control key is held
|
if (_mouseMarks || (modifiers == Qt::ShiftModifier)) {
|
||||||
// if ((!_ctrlRequiredForDrag || ev->modifiers() & Qt::ControlModifier) && selected) {
|
// Only extend selection for programs not interested in mouse
|
||||||
// _dragInfo.state = diPending;
|
if (_mouseMarks && (modifiers == Qt::ShiftModifier)) {
|
||||||
// _dragInfo.start = ev->pos();
|
extendSelection(position);
|
||||||
// } else {
|
|
||||||
// No reason to ever start a drag event
|
|
||||||
//_dragInfo.state = diNone;
|
|
||||||
|
|
||||||
_preserveLineBreaks = !((modifiers & Qt::ControlModifier) && !(modifiers & Qt::AltModifier));
|
|
||||||
_columnSelectionMode = (modifiers & Qt::AltModifier) && (modifiers & Qt::ControlModifier);
|
|
||||||
|
|
||||||
if (_mouseMarks || (modifiers == Qt::ShiftModifier)) {
|
|
||||||
// Only extend selection for programs not interested in mouse
|
|
||||||
if (_mouseMarks && (modifiers == Qt::ShiftModifier)) {
|
|
||||||
extendSelection(position);
|
|
||||||
} else {
|
|
||||||
_screenWindow->clearSelection();
|
|
||||||
|
|
||||||
//pos.ry() += _scrollBar->value();
|
|
||||||
_iPntSel = _pntSel = pos;
|
|
||||||
_actSel = 1; // left mouse button pressed but nothing selected yet.
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
emit mouseSignal(0, charColumn + 1, charLine + 1, 0);
|
_screenWindow->clearSelection();
|
||||||
//emit mouseSignal(0, charColumn + 1, charLine + 1 + _scrollBar->value() - _scrollBar->maximum() , 0);
|
|
||||||
|
//pos.ry() += _scrollBar->value();
|
||||||
|
_iPntSel = _pntSel = pos;
|
||||||
|
_actSel = 1; // left mouse button pressed but nothing selected yet.
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
// if (_underlineLinks && (_openLinksByDirectClick || (ev->modifiers() & Qt::ControlModifier))) {
|
emit mouseSignal(0, charColumn + 1, charLine + 1, 0);
|
||||||
// Filter::HotSpot* spot = _filterChain->hotSpotAt(charLine, charColumn);
|
}
|
||||||
// if (spot && spot->type() == Filter::HotSpot::Link) {
|
|
||||||
// QObject action;
|
|
||||||
// action.setObjectName("open-action");
|
|
||||||
// spot->activate(&action);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
} else if (button == Qt::MidButton) {
|
} else if (button == Qt::MidButton) {
|
||||||
processMidButtonClick(position, modifiers);
|
processMidButtonClick(position, modifiers);
|
||||||
} else if (button == Qt::RightButton) {
|
} else if (button == Qt::RightButton) {
|
||||||
if (!_mouseMarks)
|
if (!_mouseMarks)
|
||||||
emit mouseSignal(2, charColumn + 1, charLine + 1, 0);
|
emit mouseSignal(2, charColumn + 1, charLine + 1, 0);
|
||||||
//emit mouseSignal(2, charColumn + 1, charLine + 1 + _scrollBar->value() - _scrollBar->maximum() , 0);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -630,54 +583,6 @@ void KTerminalDisplay::mouseMoveEvent(QPoint position, int but, int buts, int mo
|
|||||||
int charColumn = 0;
|
int charColumn = 0;
|
||||||
getCharacterPosition(position, charLine, charColumn);
|
getCharacterPosition(position, charLine, charColumn);
|
||||||
|
|
||||||
// handle filters
|
|
||||||
// change link hot-spot appearance on mouse-over
|
|
||||||
// Filter::HotSpot* spot = _filterChain->hotSpotAt(charLine, charColumn);
|
|
||||||
// if (spot && spot->type() == Filter::HotSpot::Link) {
|
|
||||||
// if (_underlineLinks) {
|
|
||||||
// QRegion previousHotspotArea = _mouseOverHotspotArea;
|
|
||||||
// _mouseOverHotspotArea = QRegion();
|
|
||||||
// QRect r;
|
|
||||||
// if (spot->startLine() == spot->endLine()) {
|
|
||||||
// r.setCoords(spot->startColumn()*_fontWidth + _contentRect.left(),
|
|
||||||
// spot->startLine()*_fontHeight + _contentRect.top(),
|
|
||||||
// (spot->endColumn())*_fontWidth + _contentRect.left() - 1,
|
|
||||||
// (spot->endLine() + 1)*_fontHeight + _contentRect.top() - 1);
|
|
||||||
// _mouseOverHotspotArea |= r;
|
|
||||||
// } else {
|
|
||||||
// r.setCoords(spot->startColumn()*_fontWidth + _contentRect.left(),
|
|
||||||
// spot->startLine()*_fontHeight + _contentRect.top(),
|
|
||||||
// (_columns)*_fontWidth + _contentRect.left() - 1,
|
|
||||||
// (spot->startLine() + 1)*_fontHeight + _contentRect.top() - 1);
|
|
||||||
// _mouseOverHotspotArea |= r;
|
|
||||||
// for (int line = spot->startLine() + 1 ; line < spot->endLine() ; line++) {
|
|
||||||
// r.setCoords(0 * _fontWidth + _contentRect.left(),
|
|
||||||
// line * _fontHeight + _contentRect.top(),
|
|
||||||
// (_columns)*_fontWidth + _contentRect.left() - 1,
|
|
||||||
// (line + 1)*_fontHeight + _contentRect.top() - 1);
|
|
||||||
// _mouseOverHotspotArea |= r;
|
|
||||||
// }
|
|
||||||
// r.setCoords(0 * _fontWidth + _contentRect.left(),
|
|
||||||
// spot->endLine()*_fontHeight + _contentRect.top(),
|
|
||||||
// (spot->endColumn())*_fontWidth + _contentRect.left() - 1,
|
|
||||||
// (spot->endLine() + 1)*_fontHeight + _contentRect.top() - 1);
|
|
||||||
// _mouseOverHotspotArea |= r;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// if ((_openLinksByDirectClick || (ev->modifiers() & Qt::ControlModifier)) && (cursor().shape() != Qt::PointingHandCursor))
|
|
||||||
// setCursor(Qt::PointingHandCursor);
|
|
||||||
|
|
||||||
// update(_mouseOverHotspotArea | previousHotspotArea);
|
|
||||||
// }
|
|
||||||
// } else if (!_mouseOverHotspotArea.isEmpty()) {
|
|
||||||
// if ((_underlineLinks && (_openLinksByDirectClick || (ev->modifiers() & Qt::ControlModifier))) || (cursor().shape() == Qt::PointingHandCursor))
|
|
||||||
// setCursor(_mouseMarks ? Qt::IBeamCursor : Qt::ArrowCursor);
|
|
||||||
|
|
||||||
// update(_mouseOverHotspotArea);
|
|
||||||
// // set hotspot area to an invalid rectangle
|
|
||||||
// _mouseOverHotspotArea = QRegion();
|
|
||||||
// }
|
|
||||||
|
|
||||||
// for auto-hiding the cursor, we need mouseTracking
|
// for auto-hiding the cursor, we need mouseTracking
|
||||||
if (buttons == Qt::NoButton) return;
|
if (buttons == Qt::NoButton) return;
|
||||||
|
|
||||||
@ -693,40 +598,13 @@ void KTerminalDisplay::mouseMoveEvent(QPoint position, int but, int buts, int mo
|
|||||||
if (buttons & Qt::RightButton)
|
if (buttons & Qt::RightButton)
|
||||||
button = 2;
|
button = 2;
|
||||||
|
|
||||||
emit mouseSignal(button,
|
emit mouseSignal(button, charColumn + 1, charLine + 1, 1);
|
||||||
charColumn + 1,
|
|
||||||
charLine + 1,
|
|
||||||
1);
|
|
||||||
// emit mouseSignal(button,
|
|
||||||
// charColumn + 1,
|
|
||||||
// charLine + 1 + _scrollBar->value() - _scrollBar->maximum(),
|
|
||||||
// 1);
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (_dragInfo.state == diPending) {
|
|
||||||
// // we had a mouse down, but haven't confirmed a drag yet
|
|
||||||
// // if the mouse has moved sufficiently, we will confirm
|
|
||||||
|
|
||||||
// const int distance = KGlobalSettings::dndEventDelay();
|
|
||||||
// if (ev->x() > _dragInfo.start.x() + distance || ev->x() < _dragInfo.start.x() - distance ||
|
|
||||||
// ev->y() > _dragInfo.start.y() + distance || ev->y() < _dragInfo.start.y() - distance) {
|
|
||||||
// // we've left the drag square, we can start a real drag operation now
|
|
||||||
|
|
||||||
// _screenWindow->clearSelection();
|
|
||||||
// doDrag();
|
|
||||||
// }
|
|
||||||
// return;
|
|
||||||
// } else if (_dragInfo.state == diDragging) {
|
|
||||||
// // this isn't technically needed because mouseMoveEvent is suppressed during
|
|
||||||
// // Qt drag operations, replaced by dragMoveEvent
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
|
|
||||||
if (_actSel == 0) return;
|
if (_actSel == 0) return;
|
||||||
|
|
||||||
// don't extend selection while pasting
|
// don't extend selection while pasting
|
||||||
if (buttons & Qt::MidButton) return;
|
if (buttons & Qt::MidButton) return;
|
||||||
|
|
||||||
extendSelection(position);
|
extendSelection(position);
|
||||||
@ -863,12 +741,6 @@ void KTerminalDisplay::mouseDoubleClickEvent(QPoint position, int but, int mod)
|
|||||||
Qt::MouseButton button = (Qt::MouseButton) but;
|
Qt::MouseButton button = (Qt::MouseButton) but;
|
||||||
Qt::KeyboardModifier modifiers = (Qt::KeyboardModifier) mod;
|
Qt::KeyboardModifier modifiers = (Qt::KeyboardModifier) mod;
|
||||||
|
|
||||||
// Yes, successive middle click can trigger this event
|
|
||||||
// if (button == Qt::MidButton) {
|
|
||||||
// processMidButtonClick(position, modifiers);
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
|
|
||||||
if (button != Qt::LeftButton) return;
|
if (button != Qt::LeftButton) return;
|
||||||
if (!_screenWindow) return;
|
if (!_screenWindow) return;
|
||||||
|
|
||||||
@ -877,14 +749,9 @@ void KTerminalDisplay::mouseDoubleClickEvent(QPoint position, int but, int mod)
|
|||||||
|
|
||||||
getCharacterPosition(position, charLine, charColumn);
|
getCharacterPosition(position, charLine, charColumn);
|
||||||
|
|
||||||
// pass on double click as two clicks.
|
// If the application is interested in mouse events. They have already been forwarded.
|
||||||
if (!_mouseMarks && !(modifiers & Qt::ShiftModifier)) {
|
if (!_mouseMarks && !(modifiers & Qt::ShiftModifier))
|
||||||
// There is no need to pass other events.
|
|
||||||
/*emit mouseSignal(0, charColumn + 1,
|
|
||||||
charLine + 1 + _scrollBar->value() - _scrollBar->maximum(),
|
|
||||||
0); */ // left button
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
_screenWindow->clearSelection();
|
_screenWindow->clearSelection();
|
||||||
|
|
||||||
@ -894,7 +761,6 @@ void KTerminalDisplay::mouseDoubleClickEvent(QPoint position, int but, int mod)
|
|||||||
_iPntSel = QPoint(charColumn, charLine);
|
_iPntSel = QPoint(charColumn, charLine);
|
||||||
const QPoint bgnSel = findWordStart(_iPntSel);
|
const QPoint bgnSel = findWordStart(_iPntSel);
|
||||||
const QPoint endSel = findWordEnd(_iPntSel);
|
const QPoint endSel = findWordEnd(_iPntSel);
|
||||||
//_iPntSel.ry() += _scrollBar->value();
|
|
||||||
|
|
||||||
_screenWindow->setSelectionStart(bgnSel.x() , bgnSel.y() , false);
|
_screenWindow->setSelectionStart(bgnSel.x() , bgnSel.y() , false);
|
||||||
_screenWindow->setSelectionEnd(endSel.x() , endSel.y());
|
_screenWindow->setSelectionEnd(endSel.x() , endSel.y());
|
||||||
@ -918,9 +784,6 @@ void KTerminalDisplay::copyToX11Selection()
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
QGuiApplication::clipboard()->setText(text, QClipboard::Selection);
|
QGuiApplication::clipboard()->setText(text, QClipboard::Selection);
|
||||||
|
|
||||||
// if (_autoCopySelectedText)
|
|
||||||
// QApplication::clipboard()->setText(text, QClipboard::Clipboard);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -937,42 +800,24 @@ void KTerminalDisplay::mouseReleaseEvent(QPoint position, int but, int mod)
|
|||||||
getCharacterPosition(position, charLine, charColumn);
|
getCharacterPosition(position, charLine, charColumn);
|
||||||
|
|
||||||
if (button == Qt::LeftButton) {
|
if (button == Qt::LeftButton) {
|
||||||
// if (_dragInfo.state == diPending) {
|
if (_actSel > 1) {
|
||||||
// We had a drag event pending but never confirmed. Kill selection
|
copyToX11Selection();
|
||||||
// _screenWindow->clearSelection();
|
}
|
||||||
// } else {
|
|
||||||
if (_actSel > 1) {
|
|
||||||
copyToX11Selection();
|
|
||||||
}
|
|
||||||
|
|
||||||
_actSel = 0;
|
_actSel = 0;
|
||||||
|
|
||||||
//FIXME: emits a release event even if the mouse is
|
//FIXME: emits a release event even if the mouse is
|
||||||
// outside the range. The procedure used in `mouseMoveEvent'
|
// outside the range. The procedure used in `mouseMoveEvent'
|
||||||
// applies here, too.
|
// applies here, too.
|
||||||
|
|
||||||
if (!_mouseMarks && !(modifiers & Qt::ShiftModifier))
|
if (!_mouseMarks && !(modifiers & Qt::ShiftModifier))
|
||||||
emit mouseSignal(0,
|
emit mouseSignal(0, charColumn + 1, charLine + 1 , 2);
|
||||||
charColumn + 1,
|
|
||||||
charLine + 1 , 2);
|
|
||||||
// emit mouseSignal(0,
|
|
||||||
// charColumn + 1,
|
|
||||||
// charLine + 1 + _scrollBar->value() - _scrollBar->maximum() , 2);
|
|
||||||
// }
|
|
||||||
// _dragInfo.state = diNone;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_mouseMarks &&
|
if (!_mouseMarks &&
|
||||||
(button == Qt::RightButton || button == Qt::MidButton) &&
|
(button == Qt::RightButton || button == Qt::MidButton) &&
|
||||||
!(modifiers & Qt::ShiftModifier)) {
|
!(modifiers & Qt::ShiftModifier)) {
|
||||||
emit mouseSignal(button == Qt::MidButton ? 1 : 2,
|
emit mouseSignal(button == Qt::MidButton ? 1 : 2, charColumn + 1, charLine + 1, 2);
|
||||||
charColumn + 1,
|
|
||||||
charLine + 1,
|
|
||||||
2);
|
|
||||||
// emit mouseSignal(ev->button() == Qt::MidButton ? 1 : 2,
|
|
||||||
// charColumn + 1,
|
|
||||||
// charLine + 1 + _scrollBar->value() - _scrollBar->maximum() ,
|
|
||||||
// 2);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user