| 1 | // File: inputpane.cppcxx . . $ `<file>/inputpane.cpp`/ |
| 2 | /* |
| 3 | Pep8-1 is a virtual machine for writing machine language and assembly |
| 4 | language programs. |
| 5 | |
| 6 | Copyright (C) 2009 J. Stanley Warford, Pepperdine University |
| 7 | |
| 8 | This program is free software: you can redistribute it and/or modify |
| 9 | it under the terms of the GNU General Public License as published by |
| 10 | the Free Software Foundation, either version 3 of the License, or |
| 11 | (at your option) any later version. |
| 12 | |
| 13 | This program is distributed in the hope that it will be useful, |
| 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 | GNU General Public License for more details. |
| 17 | |
| 18 | You should have received a copy of the GNU General Public License |
| 19 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 20 | */ |
| 21 | |
| 22 | #include <QFontDialog> |
| 23 | #include <QKeyEvent> |
| 24 | #include "inputpane.h"cxx . . $ `<file>/inputpane.h`/ |
| 25 | #include "ui_inputpane.h"cxx . . $ `<file>/ui_inputpane.h`/ |
| 26 | #include "pep.h"cxx . . $ `<file>/pep.h`/ |
| 27 | |
| 28 | InputPanecxx . . $ InputPane#::InputPanecxx . . $ InputPane#InputPane(108f35f7aa7f3cf9).(QWidgetcxx . . $ QWidget# *parent) : |
| 29 | QWidgetcxx . . $ QWidget#QWidget(872e7b0c281abd8d).(parent), |
| 30 | uicxx . . $ InputPane#ui.(new Uicxx . . $ Ui/::InputPanecxx . . $ Ui/InputPane#) |
| 31 | { |
| 32 | uicxx . . $ InputPane#ui.->setupUicxx . . $ Ui_InputPane#setupUi(108f35f7aa7f3cf9).(this); |
| 33 | |
| 34 | connectcxx . . $ QObject#connect(158df1d9a01a3410).(uicxx . . $ InputPane#ui.->plainTextEditcxx . . $ Ui_InputPane#plainTextEdit., SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:271:10`!(undoAvailable(bool)), this, SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:271:10`!(undoAvailable(bool))); |
| 35 | connectcxx . . $ QObject#connect(158df1d9a01a3410).(uicxx . . $ InputPane#ui.->plainTextEditcxx . . $ Ui_InputPane#plainTextEdit., SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:271:10`!(redoAvailable(bool)), this, SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:271:10`!(redoAvailable(bool))); |
| 36 | |
| 37 | uicxx . . $ InputPane#ui.->labelcxx . . $ Ui_InputPane#label.->setFontcxx . . $ QWidget#setFont(d0a4bd0c8524b912).(QFontcxx . . $ QFont#QFont(7ae16150a604556).(Pepcxx . . $ Pep#::labelFontcxx . . $ Pep#labelFont., Pepcxx . . $ Pep#::labelFontSizecxx . . $ Pep#labelFontSize.)); |
| 38 | uicxx . . $ InputPane#ui.->plainTextEditcxx . . $ Ui_InputPane#plainTextEdit.->setFontcxx . . $ QWidget#setFont(d0a4bd0c8524b912).(QFontcxx . . $ QFont#QFont(7ae16150a604556).(Pepcxx . . $ Pep#::codeFontcxx . . $ Pep#codeFont., Pepcxx . . $ Pep#::ioFontSizecxx . . $ Pep#ioFontSize.)); |
| 39 | } |
| 40 | |
| 41 | InputPanecxx . . $ InputPane#::~cxx . . $ InputPane#`~InputPane`(ced63f7c635d850d).InputPanecxx . . $ InputPane#() |
| 42 | { |
| 43 | delete uicxx . . $ InputPane#ui.; |
| 44 | } |
| 45 | |
| 46 | void InputPanecxx . . $ InputPane#::highlightOnFocuscxx . . $ InputPane#highlightOnFocus(49f6e7a06ebc5aa8).() |
| 47 | { |
| 48 | if (uicxx . . $ InputPane#ui.->plainTextEditcxx . . $ Ui_InputPane#plainTextEdit.->hasFocuscxx . . $ QWidget#hasFocus(50ce9a9e25b4a850).()) { |
| 49 | uicxx . . $ InputPane#ui.->labelcxx . . $ Ui_InputPane#label.->setAutoFillBackgroundcxx . . $ QWidget#setAutoFillBackground(b45ddcbc8423892c).(true); |
| 50 | } |
| 51 | else { |
| 52 | uicxx . . $ InputPane#ui.->labelcxx . . $ Ui_InputPane#label.->setAutoFillBackgroundcxx . . $ QWidget#setAutoFillBackground(b45ddcbc8423892c).(false); |
| 53 | } |
| 54 | } |
| 55 | |
| 56 | QStringcxx . . $ QString# InputPanecxx . . $ InputPane#::toPlainTextcxx . . $ InputPane#toPlainText(4365c3963150523e).() |
| 57 | { |
| 58 | return uicxx . . $ InputPane#ui.->plainTextEditcxx . . $ Ui_InputPane#plainTextEdit.->toPlainTextcxx . . $ QPlainTextEdit#toPlainText(6ef7b6c27b00b43d).(); |
| 59 | } |
| 60 | |
| 61 | void InputPanecxx . . $ InputPane#::setTextcxx . . $ InputPane#setText(7df51288a9ebd664).(QStringcxx . . $ QString# input) |
| 62 | { |
| 63 | uicxx . . $ InputPane#ui.->plainTextEditcxx . . $ Ui_InputPane#plainTextEdit.->setPlainTextcxx . . $ QPlainTextEdit#setPlainText(3520e46b33348bf6).(input); |
| 64 | } |
| 65 | |
| 66 | bool InputPanecxx . . $ InputPane#::hasFocuscxx . . $ InputPane#hasFocus(c9857a73d68e59ba).() |
| 67 | { |
| 68 | return uicxx . . $ InputPane#ui.->plainTextEditcxx . . $ Ui_InputPane#plainTextEdit.->hasFocuscxx . . $ QWidget#hasFocus(50ce9a9e25b4a850).(); |
| 69 | } |
| 70 | |
| 71 | void InputPanecxx . . $ InputPane#::undocxx . . $ InputPane#undo(49f6e7a06ebc5aa8).() |
| 72 | { |
| 73 | uicxx . . $ InputPane#ui.->plainTextEditcxx . . $ Ui_InputPane#plainTextEdit.->undocxx . . $ QPlainTextEdit#undo(49f6e7a06ebc5aa8).(); |
| 74 | } |
| 75 | |
| 76 | void InputPanecxx . . $ InputPane#::redocxx . . $ InputPane#redo(49f6e7a06ebc5aa8).() |
| 77 | { |
| 78 | uicxx . . $ InputPane#ui.->plainTextEditcxx . . $ Ui_InputPane#plainTextEdit.->redocxx . . $ QPlainTextEdit#redo(49f6e7a06ebc5aa8).(); |
| 79 | } |
| 80 | |
| 81 | bool InputPanecxx . . $ InputPane#::isUndoablecxx . . $ InputPane#isUndoable(c9857a73d68e59ba).() |
| 82 | { |
| 83 | return uicxx . . $ InputPane#ui.->plainTextEditcxx . . $ Ui_InputPane#plainTextEdit.->documentcxx . . $ QPlainTextEdit#document(f21741221844491e).()->isUndoAvailablecxx . . $ QTextDocument#isUndoAvailable(50ce9a9e25b4a850).(); |
| 84 | } |
| 85 | |
| 86 | bool InputPanecxx . . $ InputPane#::isRedoablecxx . . $ InputPane#isRedoable(c9857a73d68e59ba).() |
| 87 | { |
| 88 | return uicxx . . $ InputPane#ui.->plainTextEditcxx . . $ Ui_InputPane#plainTextEdit.->documentcxx . . $ QPlainTextEdit#document(f21741221844491e).()->isRedoAvailablecxx . . $ QTextDocument#isRedoAvailable(50ce9a9e25b4a850).(); |
| 89 | } |
| 90 | |
| 91 | void InputPanecxx . . $ InputPane#::cutcxx . . $ InputPane#cut(49f6e7a06ebc5aa8).() |
| 92 | { |
| 93 | uicxx . . $ InputPane#ui.->plainTextEditcxx . . $ Ui_InputPane#plainTextEdit.->cutcxx . . $ QPlainTextEdit#cut(49f6e7a06ebc5aa8).(); |
| 94 | } |
| 95 | |
| 96 | void InputPanecxx . . $ InputPane#::copycxx . . $ InputPane#copy(49f6e7a06ebc5aa8).() |
| 97 | { |
| 98 | uicxx . . $ InputPane#ui.->plainTextEditcxx . . $ Ui_InputPane#plainTextEdit.->copycxx . . $ QPlainTextEdit#copy(49f6e7a06ebc5aa8).(); |
| 99 | } |
| 100 | |
| 101 | void InputPanecxx . . $ InputPane#::pastecxx . . $ InputPane#paste(49f6e7a06ebc5aa8).() |
| 102 | { |
| 103 | uicxx . . $ InputPane#ui.->plainTextEditcxx . . $ Ui_InputPane#plainTextEdit.->pastecxx . . $ QPlainTextEdit#paste(49f6e7a06ebc5aa8).(); |
| 104 | } |
| 105 | |
| 106 | void InputPanecxx . . $ InputPane#::setReadOnlycxx . . $ InputPane#setReadOnly(b45ddcbc8423892c).(bool b) |
| 107 | { |
| 108 | uicxx . . $ InputPane#ui.->plainTextEditcxx . . $ Ui_InputPane#plainTextEdit.->setReadOnlycxx . . $ QPlainTextEdit#setReadOnly(b45ddcbc8423892c).(b); |
| 109 | } |
| 110 | |
| 111 | void InputPanecxx . . $ InputPane#::tabcxx . . $ InputPane#tab(49f6e7a06ebc5aa8).() |
| 112 | { |
| 113 | if (!uicxx . . $ InputPane#ui.->plainTextEditcxx . . $ Ui_InputPane#plainTextEdit.->isReadOnlycxx . . $ QPlainTextEdit#isReadOnly(50ce9a9e25b4a850).()) { |
| 114 | QTextCursorcxx . . $ QTextCursor# cursor = uicxx . . $ InputPane#ui.->plainTextEditcxx . . $ Ui_InputPane#plainTextEdit.->textCursorcxx . . $ QPlainTextEdit#textCursor(878247cba2fd3c00).(); |
| 115 | cursor.movePositioncxx . . $ QTextCursor#movePosition(e5e992d8a5d1c17e).(QTextCursorcxx . . $ QTextCursor#::StartOfLinecxx . . $ QTextCursor#StartOfLine.); |
| 116 | |
| 117 | int curLinePos = uicxx . . $ InputPane#ui.->plainTextEditcxx . . $ Ui_InputPane#plainTextEdit.->textCursorcxx . . $ QPlainTextEdit#textCursor(878247cba2fd3c00).().positioncxx . . $ QTextCursor#position(455f465bc33b4cdf).() - cursor.positioncxx . . $ QTextCursor#position(455f465bc33b4cdf).(); |
| 118 | |
| 119 | QStringcxx . . $ QString# stringcxx . . $ QString#QString(ced63f7c635d850d).; |
| 120 | int spaces; |
| 121 | spaces = 4 - (curLinePos % 4); |
| 122 | |
| 123 | for (int i = 0; i < spaces; i++) { |
| 124 | string.appendcxx . . $ QString#append(d02845eef0c33901).(" "); |
| 125 | } |
| 126 | |
| 127 | uicxx . . $ InputPane#ui.->plainTextEditcxx . . $ Ui_InputPane#plainTextEdit.->insertPlainTextcxx . . $ QPlainTextEdit#insertPlainText(3520e46b33348bf6).(string); |
| 128 | } |
| 129 | } |
| 130 | |
| 131 | void InputPanecxx . . $ InputPane#::onFontChangedcxx . . $ InputPane#onFontChanged(19c44da831d1de49).(QFontcxx . . $ QFont# font) |
| 132 | { |
| 133 | uicxx . . $ InputPane#ui.->plainTextEditcxx . . $ Ui_InputPane#plainTextEdit.->setFontcxx . . $ QWidget#setFont(d0a4bd0c8524b912).(font); |
| 134 | } |
| 135 | |
| 136 | void InputPanecxx . . $ InputPane#::mouseReleaseEventcxx . . $ InputPane#mouseReleaseEvent(702858a82d06265c).(QMouseEventcxx . . $ QMouseEvent# *) |
| 137 | { |
| 138 | uicxx . . $ InputPane#ui.->plainTextEditcxx . . $ Ui_InputPane#plainTextEdit.->setFocuscxx . . $ QWidget#setFocus(49f6e7a06ebc5aa8).(); |
| 139 | } |