view libgui/src/m-editor/marker.h @ 21158:65827e9cccb8

Gui support for enhancement of dbstop. * octave-qscintilla.cc (contextMenuEvent): Capture right-click in the left margins to show a context menu for "dbstop if...". * octave-qscintilla.{cc,h} (contextmenu_break_condition): new function * file-editor-interface.h: pass condition to handle_update_breakpoint_marker_request * file-editor-tab.{cc,h}: (file_editor_tab, bp_info, handle_request_add_breakpoint, next_breakpoint, previous_breakpoint, do_breakpoint_marker, add_breakpoint_callback): Allow conditional breakpoint markers * file-editor-tab.cc (handle_context_menu_break_condition): new function * file-editor.{cc,h} (request_open_file, add_file_editor_tab, handle_delete_debugger_pointer_request): pass bp conditions. * marker.{cc,h} (marker, construct, handle_report_editor_linenr): pass breakpoint conditions * main-window.{cc,h} (handle_update_breakpoint_marker_request): pass breakpoint condition. * octave-link.h (update_breakpoint): pass breakpoint condition. * octave-qt-link.{cc,h} (do_update_breakpoint): pass breakpoint condition.
author Lachlan Andrew <lachlanbis@gmail.com>
date Sat, 30 Jan 2016 10:13:34 +1100
parents ea50940c362f
children aba2e6293dd8
line wrap: on
line source

/*
Copyright (C) 2015 Daniel J. Sebald

This file is part of Octave.

Octave is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 3 of the License, or (at your
option) any later version.

Octave is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
for more details.

You should have received a copy of the GNU General Public License
along with Octave; see the file COPYING.  If not, see
<http://www.gnu.org/licenses/>.

*/

#ifndef MARKER_H
#define MARKER_H

#include <Qsci/qsciscintilla.h>
#include <QObject>

// Defined for purposes of sending QList<int> as part of signal.
#include <QList>
typedef QList<int> QIntList;

// The breakpoint class keeps track of the debug line number that Octave core
// uses and the handle of the marker inside the editor file.  If the editor
// contents is modified, the debug line number and editor line number can be
// out of alignment.  The marker handle can be used to retrieve the editor
// line.

class marker;
class marker : public QObject
{
  Q_OBJECT

public:

  enum editor_markers
    {
      bookmark,
      breakpoint,
      cond_break,
      unsure_breakpoint,
      debugger_position,
      unsure_debugger_position
    };

  marker (QsciScintilla *edit_area, int original_linenr,
          editor_markers marker_type, const QString& condition = "");
  marker (QsciScintilla *edit_area, int original_linenr,
          editor_markers marker_type, int editor_linenr,
          const QString& condition = "");
  ~marker (void);

  const QString& get_cond (void) const { return _condition; }

  void set_cond (const QString& cond) { _condition = cond; }

public slots:
  void handle_remove_via_original_linenr (int original_linenr);
  void handle_request_remove_via_editor_linenr (int editor_linenr);
  void handle_remove (void);
  void handle_find_translation (int original_linenr, int& editor_linenr,
                                marker*& bp);
  void handle_find_just_before (int linenr, int& original_linenr, int& editor_linenr);
  void handle_find_just_after (int linenr, int& original_linenr, int& editor_linenr);
/*  void handle_lines_changed (void);*/
  void handle_marker_line_deleted (int mhandle);
  void handle_marker_line_undeleted (int mhandle);
  void handle_report_editor_linenr (QIntList& lines, QStringList& conditions);

signals:
  void request_remove (int original_linenr);

private:
  void construct (QsciScintilla *edit_area, int original_linenr,
                  editor_markers marker_type, int editor_linenr,
                  const QString& condition);

  QsciScintilla *       _edit_area;
  int                   _original_linenr;
  editor_markers        _marker_type;
  int                   _mhandle;
  QString               _condition;
};

#endif // MARKER_H