1 //////////////////////////////////////////////////////////////////////// 2 // 3 // Copyright (C) 2016-2021 The Octave Project Developers 4 // 5 // See the file COPYRIGHT.md in the top-level directory of this 6 // distribution or <https://octave.org/copyright/>. 7 // 8 // This file is part of Octave. 9 // 10 // Octave is free software: you can redistribute it and/or modify it 11 // under the terms of the GNU General Public License as published by 12 // the Free Software Foundation, either version 3 of the License, or 13 // (at your option) any later version. 14 // 15 // Octave is distributed in the hope that it will be useful, but 16 // WITHOUT ANY WARRANTY; without even the implied warranty of 17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 // GNU General Public License for more details. 19 // 20 // You should have received a copy of the GNU General Public License 21 // along with Octave; see the file COPYING. If not, see 22 // <https://www.gnu.org/licenses/>. 23 // 24 //////////////////////////////////////////////////////////////////////// 25 26 #if ! defined (octave_marker_h) 27 #define octave_marker_h 1 28 29 #include <QObject> 30 #include <Qsci/qsciscintilla.h> 31 32 // Defined for purposes of sending QList<int> as part of signal. 33 #include <QList> 34 typedef QList<int> QIntList; 35 36 // The breakpoint class keeps track of the debug line number that Octave core 37 // uses and the handle of the marker inside the editor file. If the editor 38 // contents is modified, the debug line number and editor line number can be 39 // out of alignment. The marker handle can be used to retrieve the editor 40 // line. 41 42 namespace octave 43 { 44 class marker : public QObject 45 { 46 Q_OBJECT 47 48 public: 49 50 // List of all marker types 51 // If multiple markers are on the same line, the first one listed 52 // is drawn at the back, so big ones should be first. 53 enum editor_markers 54 { 55 breakpoint, 56 cond_break, 57 unsure_breakpoint, 58 bookmark, 59 debugger_position, 60 unsure_debugger_position, 61 selection 62 }; 63 64 marker (QsciScintilla *edit_area, int original_linenr, 65 editor_markers marker_type, const QString& condition = ""); 66 67 marker (QsciScintilla *edit_area, int original_linenr, 68 editor_markers marker_type, int editor_linenr, 69 const QString& condition = ""); 70 71 ~marker (void) = default; 72 get_cond(void)73 const QString& get_cond (void) const { return m_condition; } 74 set_cond(const QString & cond)75 void set_cond (const QString& cond) { m_condition = cond; } 76 77 signals: 78 79 void request_remove (int original_linenr); 80 81 public slots: 82 83 void handle_remove_via_original_linenr (int original_linenr); 84 void handle_request_remove_via_editor_linenr (int editor_linenr); 85 void handle_remove (void); 86 void handle_find_translation (int original_linenr, int& editor_linenr, 87 marker*& bp); 88 void handle_find_just_before (int linenr, int& original_linenr, 89 int& editor_linenr); 90 void handle_find_just_after (int linenr, int& original_linenr, 91 int& editor_linenr); 92 /* void handle_lines_changed (void);*/ 93 void handle_marker_line_deleted (int mhandle); 94 void handle_marker_line_undeleted (int mhandle); 95 void handle_report_editor_linenr (QIntList& lines, QStringList& conditions); 96 97 private: 98 99 void construct (QsciScintilla *edit_area, int original_linenr, 100 editor_markers marker_type, int editor_linenr, 101 const QString& condition); 102 103 QsciScintilla *m_edit_area; 104 int m_original_linenr; 105 editor_markers m_marker_type; 106 int m_mhandle; 107 QString m_condition; 108 }; 109 } 110 111 #endif 112