1 ////////////////////////////////////////////////////////////////////////
2 //
3 // Copyright (C) 2011-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_file_editor_interface_h)
27 #define octave_file_editor_interface_h 1
28 
29 #include <QMenu>
30 #include <QToolBar>
31 
32 #include "gui-settings.h"
33 #include "octave-dock-widget.h"
34 
35 namespace octave
36 {
37   class base_qobject;
38 
39   class file_editor_interface : public octave_dock_widget
40   {
41     Q_OBJECT
42 
43   public:
44 
file_editor_interface(QWidget * p,base_qobject & oct_qobj)45     file_editor_interface (QWidget *p, base_qobject& oct_qobj)
46       : octave_dock_widget ("FileEditor", p, oct_qobj)
47     { }
48 
49     virtual ~file_editor_interface (void) = default;
50 
51     virtual QMenu * get_mru_menu (void) = 0;
52     virtual QMenu * debug_menu (void) = 0;
53     virtual QToolBar * toolbar (void) = 0;
54 
55     virtual void insert_global_actions (QList<QAction*>) = 0;
56     virtual void handle_enter_debug_mode (void) = 0;
57     virtual void handle_exit_debug_mode (void) = 0;
58 
59     virtual void
60     handle_insert_debugger_pointer_request (const QString& file, int line) = 0;
61 
62     virtual void
63     handle_delete_debugger_pointer_request (const QString& file, int line) = 0;
64 
65     virtual void
66     handle_update_breakpoint_marker_request (bool insert, const QString& file,
67                                              int line, const QString& cond) = 0;
68 
69     virtual void handle_edit_file_request (const QString& file) = 0;
70 
71     virtual bool check_closing (void) = 0;
72 
73     virtual void empty_script (bool, bool) = 0;
74 
75     virtual void restore_session (gui_settings *) = 0;
76 
77     virtual void enable_menu_shortcuts (bool enable) = 0;
78 
79   public slots:
80 
81     virtual void toplevel_change (bool) = 0;
82 
83     virtual void handle_file_remove (const QString& o, const QString& n) = 0;
84 
85     virtual void request_new_file (const QString& command = QString ()) = 0;
86 
87     virtual void request_open_file (const QString& openFileName,
88                                     const QString& encoding = QString (),
89                                     int line = -1,
90                                     bool debug_pointer = false,
91                                     bool breakpoint_marker = false,
92                                     bool insert = true,
93                                     const QString& cond = "",
94                                     int index = -1) = 0;
95   };
96 }
97 
98 #endif
99