view libgui/src/m-editor/file-editor-interface.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 9d9270e2f98f
children 98e75f952a36
line wrap: on
line source

/*

Copyright (C) 2011-2015 Jacob Dawid

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 FILEEDITORINTERFACE_H
#define FILEEDITORINTERFACE_H

#include <QMenu>
#include <QToolBar>
#include "octave-dock-widget.h"

class file_editor_interface : public octave_dock_widget
{
  Q_OBJECT

public:
  file_editor_interface (QWidget *p)
    : octave_dock_widget (p)
  {
    setObjectName ("FileEditor");
  }

  virtual ~file_editor_interface () { }

  virtual QMenu *get_mru_menu () = 0;
  virtual QMenu *debug_menu () = 0;
  virtual QToolBar *toolbar () = 0;

  virtual void insert_global_actions (QAction*,QAction*,QAction*,QAction*,
                                        QAction*,QAction*,QAction*) = 0;
  virtual void handle_enter_debug_mode (void) = 0;
  virtual void handle_exit_debug_mode (void) = 0;

  virtual void
  handle_insert_debugger_pointer_request (const QString& file, int line) = 0;

  virtual void
  handle_delete_debugger_pointer_request (const QString& file, int line) = 0;

  virtual void
  handle_update_breakpoint_marker_request (bool insert, const QString& file,
                                           int line) = 0;

  virtual void handle_edit_file_request (const QString& file) = 0;

  virtual bool check_closing (void) = 0;

  virtual void empty_script (bool, bool) = 0;

  virtual void enable_menu_shortcuts (bool enable) = 0;

public slots:
  virtual void request_new_file (const QString& command = QString ()) = 0;
  virtual void request_new_script (const QString& command = QString ()) = 0;
  virtual void request_new_function (bool) = 0;
  virtual void request_open_file () = 0;
  virtual void request_open_file (const QString& openFileName,
                                  const QString& encoding = QString (),
                                  int line = -1,
                                  bool debug_pointer = false,
                                  bool breakpoint_marker = false,
                                  bool insert = true) = 0;
//signals:

//protected:

//protected slots:

};

#endif