view libgui/src/m-editor/octave-qscintilla.h @ 20986:00835323fb44

prevent shortcut ambiguity between main and editor window * file-editor-interface.h: renamed insert_new_open_actions into insert_global_actions * file-editor-tab.h: no more signal for setting edit shortcuts * file-editor.cc (file_editor): initialize actions that will be copied from main window; (request_undo, request_copy, request_paste, request_selectall): remove slots for obsolete own action signals; (do_undo, copyClipboard, pasteClipboard, selectAll): and move the relevant code into these already existing slots of the related main window actions; (handle_tab_remove_request): make sure that the focus stays in editor window when tabs are closed; (edit_status_update, handle_editor_state_changed): only enable undo or copy action if already copied from main window; (insert_global_actions) renamed from insert_new_open_actions, insert some global actions and copy those global actions that are en/disabled depending on editor state; (enable_menu_shortcuts): when editor loses focus enable copy and undo action since these are alwys active in the main window; (construct): edit menu is stored in a class variable, actions that are copied from the main menu are not added to the menus here; (set_shortcuts): no shortcuts for the actions from the main menu; (check_actions): do not disable paste-/select-all-action when no tab is open; * file-editor.h: renamed insert_new_open_actions into insert_global_actions, no more slots for the action that are now copied from the main window, * octave-qscintilla.cc (octave_qscintilla): initialize undo and redo state for editor actions; (focusInEvent): emit undo and redo state for the editor actions; * octave-qscintilla.h: focusInEvent * main-window.cc (notice_settings): use renamed function for switching menu_bar accelerators between main window and editor; (construct): removed list and signal for adding common action to the dock widgets, since these action are globally valid; (construct_menu_bar): call function for inserting some action to the editor here and not in construct_file_menu; (disable_menu_shortcuts) renamed from enable_menu_shortcuts; (construct_edit_menu): global edit actions with ApplicationShortcut context; (set_global_edit_shortcuts): removed obsolete function since global edit actions now only exist once * main-window.h: removed obsolete function set_global_edit_shortcuts, renamed function enable_menu_shortcuts into disable_menu_shortcuts, * octave-dock-widget.cc (octave_dock_widget, add_actions): removed obsolete slot for adding actions from the main window * octave-dock-widget.h: removed slots add_actions * shortcut-manager.cc (do_init_data): remove shortcuts for obsolete editor actions which are now copied from the main window; (init): do not store widget name in the shortcut hash since duplicate shortcuts in different widgets are not possible anymore; (do_fill_treewidget): adapt check for duplicate shortcuts accordingly; (shortcut_dialog_finish): changes related to changed shortcut hash
author Torsten <ttl@justmail.de>
date Fri, 25 Dec 2015 22:31:23 +0100
parents f7084eae3318
children 65827e9cccb8
line wrap: on
line source

/*

Copyright (C) 2013-2015 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_octave_qscintilla_h)
#define octave_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 ();

  virtual void contextMenuEvent (QContextMenuEvent *e);

  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&);
  void create_context_menu_signal (QMenu*);
  void context_menu_edit_signal (const QString&);
  void qsci_has_focus_signal (bool);
  void status_update (bool,bool);
  void show_doc_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);

  void text_changed (void);

protected:

  void focusInEvent(QFocusEvent *focusEvent);

private:

  QString _word_at_cursor;

};

#endif