view libgui/src/m-editor/octave-qscintilla.h @ 17635:7945344506ae

Add possibility to run selected text of the editor in the terminal * octave-qscintilla.cc(contextMenuEvent): new context menu for running selection (context_run): function for run selection action in editor file menu; (contextmenu_run): new slot for context menu run selection; * octave-qscintilla.h: new functions context_run, contextmenu_run * file-editor-tab.cc(context_run): new slot for run menu action * file-editor-tab.h: new slot context_run * file-editor.cc(request_context_run): new slot for run menu entry; (construct): new entry in run menu for running the selection in editor (add_file_editor_tab): connect new signal fetab_context_run to the new slot context_run in file_editor_tab; (set_shortcuts): enable/disable new shortcut when editor focus changes (check_actions): enable/disable new action depending on existing tabs * file-editor.h: new signal fetab_context_run, new slot request_context_edit, new run action
author Torsten <ttl@justmail.de>
date Fri, 11 Oct 2013 22:46:32 +0200
parents 99ffa521ecec
children ebb3ef964372
line wrap: on
line source

/*

Copyright (C) 2013 Torsten

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/>.

*/

// Author: Torsten <ttl@justmail.de>

#if !defined (octave_qscintilla_h)
#define octave_qscintilla_h 1

#include <Qsci/qsciscintilla.h>
#include <QMenu>
#include <QContextMenuEvent>

class octave_qscintilla : public QsciScintilla
{
  Q_OBJECT

public:

  octave_qscintilla (QWidget *p);
  ~octave_qscintilla ();

#ifdef HAVE_QSCI_VERSION_2_6_0
  virtual void contextMenuEvent (QContextMenuEvent *e);
#endif
  void context_help_doc (bool);
  void context_edit ();
  void context_run ();
  void get_global_textcursor_pos (QPoint *global_pos, QPoint *local_pos);
  bool get_actual_word ();

signals:

  void execute_command_in_terminal_signal (const QString&);

private slots:

  void contextmenu_help (bool);
  void contextmenu_doc (bool);
  void contextmenu_help_doc (bool);
  void contextmenu_edit (bool);
  void contextmenu_run (bool);

private:

  QString _word_at_cursor;

};

#endif