changeset 21310:fc6a9bd59094

backout changeset e8c3590da9ff
author Lachlan Andrew <lachlanbis@gmail.com>
date Sun, 14 Feb 2016 13:16:05 +1100
parents 7fbecef105ca
children 718332a58d35
files libgui/src/m-editor/file-editor-tab.cc libgui/src/m-editor/file-editor-tab.h libgui/src/m-editor/file-editor.cc libgui/src/main-window.cc libgui/src/main-window.h libgui/src/octave-cmd.cc libgui/src/octave-cmd.h libgui/src/octave-qt-link.cc libgui/src/octave-qt-link.h
diffstat 9 files changed, 14 insertions(+), 28 deletions(-) [+]
line wrap: on
line diff
--- a/libgui/src/m-editor/file-editor-tab.cc	Fri Feb 19 21:27:03 2016 -0800
+++ b/libgui/src/m-editor/file-editor-tab.cc	Sun Feb 14 13:16:05 2016 +1100
@@ -61,14 +61,14 @@
 #include <QDialogButtonBox>
 #include <QPushButton>
 
-#include "file-ops.h"
-
 #include "resource-manager.h"
 #include "file-editor-tab.h"
 #include "file-editor.h"
 #include "octave-txt-lexer.h"
 #include "marker.h"
 
+#include "file-ops.h"
+
 #include "debug.h"
 #include "octave-qt-link.h"
 #include "version.h"
@@ -87,15 +87,13 @@
  */
 // Make parent null for the file editor tab so that warning
 // WindowModal messages don't affect grandparents.
-file_editor_tab::file_editor_tab (octave_dock_widget *editor,
-                                  const QString& directory_arg)
+file_editor_tab::file_editor_tab (const QString& directory_arg)
 {
   _lexer_apis = 0;
   _is_octave_file = true;
   _lines_changed = false;
 
   _ced = directory_arg;
-  _main_win = static_cast<main_window*> (editor->parent ());
 
   _file_name = "";
   _file_system_watcher.setObjectName ("_qt_autotest_force_engine_poller");
@@ -335,7 +333,7 @@
   // Ensure editor line numbers match Octave core's line numbers.
   // Give users the option to save modifications if necessary.
   if (! unchanged_or_saved ()
-     || !(_main_win->get_octave_qt_link ()->file_in_path (info.file, info.dir)))
+     || !(octave_qt_link::file_in_path (info.file, info.dir)))
     return;
 
   // Search for previous condition.  FIXME -- is there a more direct way?
@@ -929,7 +927,7 @@
   bp_table::intmap line_info;
   line_info[0] = info.line;
 
-  if (_main_win->get_octave_qt_link ()->file_in_path (info.file, info.dir))
+  if (octave_qt_link::file_in_path (info.file, info.dir))
     bp_table::add_breakpoint (info.function_name, line_info, info.condition);
 }
 
@@ -939,14 +937,14 @@
   bp_table::intmap line_info;
   line_info[0] = info.line;
 
-  if (_main_win->get_octave_qt_link ()->file_in_path (info.file, info.dir))
+  if (octave_qt_link::file_in_path (info.file, info.dir))
     bp_table::remove_breakpoint (info.function_name, line_info);
 }
 
 void
 file_editor_tab::remove_all_breakpoints_callback (const bp_info& info)
 {
-  if (_main_win->get_octave_qt_link ()->file_in_path (info.file, info.dir))
+  if (octave_qt_link::file_in_path (info.file, info.dir))
     bp_table::remove_all_breakpoints_in_file (info.function_name, true);
 }
 
--- a/libgui/src/m-editor/file-editor-tab.h	Fri Feb 19 21:27:03 2016 -0800
+++ b/libgui/src/m-editor/file-editor-tab.h	Sun Feb 14 13:16:05 2016 +1100
@@ -43,7 +43,6 @@
 #include "find-dialog.h"
 #include "octave-qscintilla.h"
 #include "builtin-defun-decls.h"
-#include "main-window.h"
 
 #include "marker.h" /* Only needed for typedef of "QIntList", which may be
                        typedefed elsewhere.  Could use common location. */
@@ -57,7 +56,7 @@
 
 public:
 
-  file_editor_tab (octave_dock_widget *editor, const QString& directory = "");
+  file_editor_tab (const QString& directory = "");
 
   ~file_editor_tab (void);
 
@@ -258,7 +257,6 @@
   void update_eol_indicator ();
 
   octave_qscintilla *_edit_area;
-  main_window *_main_win;
 
   QStatusBar *_status_bar;
   QLabel *_row_indicator;
--- a/libgui/src/m-editor/file-editor.cc	Fri Feb 19 21:27:03 2016 -0800
+++ b/libgui/src/m-editor/file-editor.cc	Sun Feb 14 13:16:05 2016 +1100
@@ -201,7 +201,7 @@
   // editor tab has yet to be created and there is no object to
   // pass a signal to.  Hence, functionality is here.
 
-  file_editor_tab *fileEditorTab = new file_editor_tab (this, ced);
+  file_editor_tab *fileEditorTab = new file_editor_tab (ced);
   if (fileEditorTab)
     {
       add_file_editor_tab (fileEditorTab, "");  // new tab with empty title
@@ -454,7 +454,7 @@
         }
       else
         {
-          file_editor_tab *fileEditorTab = new file_editor_tab (this);
+          file_editor_tab *fileEditorTab = new file_editor_tab ();
           if (fileEditorTab)
             {
               fileEditorTab->set_encoding (encoding);
--- a/libgui/src/main-window.cc	Fri Feb 19 21:27:03 2016 -0800
+++ b/libgui/src/main-window.cc	Sun Feb 14 13:16:05 2016 +1100
@@ -338,7 +338,7 @@
 void
 main_window::run_file_callback (const QFileInfo& info)
 {
-  octave_cmd_eval *cmd = new octave_cmd_eval (info, _octave_qt_link);
+  octave_cmd_eval *cmd = new octave_cmd_eval (info);
   _cmd_queue.add_cmd (cmd);
 }
 
--- a/libgui/src/main-window.h	Fri Feb 19 21:27:03 2016 -0800
+++ b/libgui/src/main-window.h	Sun Feb 14 13:16:05 2016 +1100
@@ -82,8 +82,6 @@
 
   void focus_command_window (void);
 
-  octave_qt_link* get_octave_qt_link () { return _octave_qt_link; };
-
 signals:
 
   void active_dock_changed (octave_dock_widget *, octave_dock_widget *);
--- a/libgui/src/octave-cmd.cc	Fri Feb 19 21:27:03 2016 -0800
+++ b/libgui/src/octave-cmd.cc	Sun Feb 14 13:16:05 2016 +1100
@@ -33,7 +33,6 @@
 #include "builtin-defun-decls.h"
 #include "utils.h"
 
-#include "main-window.h"
 
 // ---------------------------------------------------------------------
 //  class octave_cmd_exec: executing a command
@@ -66,7 +65,7 @@
     {
       // valid identifier: call as function with possibility to debug
       std::string path = _info.absolutePath ().toStdString ();
-      if (_octave_qt_link->file_in_path (file_path, path))
+      if (octave_qt_link::file_in_path (file_path, path))
         command_editor::replace_line (function_name.toStdString ());
     }
   else
--- a/libgui/src/octave-cmd.h	Fri Feb 19 21:27:03 2016 -0800
+++ b/libgui/src/octave-cmd.h	Sun Feb 14 13:16:05 2016 +1100
@@ -66,18 +66,12 @@
 {
 public:
 
-  octave_cmd_eval (const QFileInfo& info,
-                   octave_qt_link* octave_qt_link) : octave_cmd ()
-    { _info = info;
-      _octave_qt_link = octave_qt_link;
-    };
-
+  octave_cmd_eval (const QFileInfo& info) : octave_cmd () { _info = info; };
   void execute ();
 
 protected:
 
   QFileInfo _info;
-  octave_qt_link *_octave_qt_link;
 };
 
 
--- a/libgui/src/octave-qt-link.cc	Fri Feb 19 21:27:03 2016 -0800
+++ b/libgui/src/octave-qt-link.cc	Sun Feb 14 13:16:05 2016 +1100
@@ -610,7 +610,6 @@
         {
         case 1:
           Fcd (ovl (dir));
-          update_directory ();
           ok = true;
           break;
 
--- a/libgui/src/octave-qt-link.h	Fri Feb 19 21:27:03 2016 -0800
+++ b/libgui/src/octave-qt-link.h	Sun Feb 14 13:16:05 2016 +1100
@@ -130,7 +130,7 @@
   void do_set_default_prompts (std::string& ps1, std::string& ps2,
                                std::string& ps4);
 
-  bool file_in_path (const std::string& file, const std::string& dir);
+  static bool file_in_path (const std::string& file, const std::string& dir);
 
   void do_show_preferences (void);