diff --git a/libgui/src/main-window.cc b/libgui/src/main-window.cc --- a/libgui/src/main-window.cc +++ b/libgui/src/main-window.cc @@ -52,9 +52,7 @@ along with Octave; see the file COPYING. #include -#if defined (HAVE_QSCINTILLA) -# include "file-editor.h" -#endif +#include "file-editor.h" #include "main-window.h" #include "settings-dialog.h" #include "shortcut-manager.h" @@ -495,9 +493,8 @@ namespace octave m_octave_qt_link->lock (); // Close the file if opened -#if defined (HAVE_QSCINTILLA) - m_editor_window->handle_file_remove (o, n); -#endif + if (m_editor_window) + m_editor_window->handle_file_remove (o, n); // We are done: Unlock and wake the worker thread m_octave_qt_link->unlock (); @@ -862,10 +859,8 @@ namespace octave closenow = false; } -#if defined (HAVE_QSCINTILLA) - if (closenow) + if (closenow && m_editor_window) closenow = m_editor_window->check_closing (); -#endif return closenow; } @@ -998,9 +993,8 @@ namespace octave m_debug_step_out->setEnabled (true); m_debug_quit->setEnabled (true); -#if defined (HAVE_QSCINTILLA) - m_editor_window->handle_enter_debug_mode (); -#endif + if (m_editor_window) + m_editor_window->handle_enter_debug_mode (); } void main_window::handle_exit_debugger (void) @@ -1013,9 +1007,8 @@ namespace octave m_debug_step_out->setEnabled (false); m_debug_quit->setEnabled (false); -#if defined (HAVE_QSCINTILLA) - m_editor_window->handle_exit_debug_mode (); -#endif + if (m_editor_window) + m_editor_window->handle_exit_debug_mode (); } void main_window::debug_continue (void) @@ -1393,9 +1386,8 @@ namespace octave foreach (octave_dock_widget *widget, dock_widget_list ()) widget->connect_visibility_changed (); -#if defined (HAVE_QSCINTILLA) - m_editor_window->enable_menu_shortcuts (false); -#endif + if (m_editor_window) + m_editor_window->enable_menu_shortcuts (false); } void main_window::copyClipboard (void) @@ -1494,13 +1486,11 @@ namespace octave if (m_editor_window) { -#if defined (HAVE_QSCINTILLA) // Octave ready, determine whether to create an empty script. // This can not be done when the editor is created because all functions // must be known for the lexer's auto completion informations m_editor_window->empty_script (true, false); m_editor_window->restore_session (settings); -#endif } focus_command_window (); // make sure that the command window has focus @@ -1814,10 +1804,12 @@ namespace octave addDockWidget (Qt::RightDockWidgetArea, m_doc_browser_window); tabifyDockWidget (m_command_window, m_doc_browser_window); -#if defined (HAVE_QSCINTILLA) - addDockWidget (Qt::RightDockWidgetArea, m_editor_window); - tabifyDockWidget (m_command_window, m_editor_window); -#endif + if (m_editor_window) + { + addDockWidget (Qt::RightDockWidgetArea, m_editor_window); + tabifyDockWidget (m_command_window, m_editor_window); + } + addDockWidget (Qt::RightDockWidgetArea, m_variable_editor_window); tabifyDockWidget (m_command_window, m_variable_editor_window); @@ -1838,41 +1830,42 @@ namespace octave setStatusBar (m_status_bar); -#if defined (HAVE_QSCINTILLA) - connect (this, - SIGNAL (insert_debugger_pointer_signal (const QString&, int)), - m_editor_window, - SLOT (handle_insert_debugger_pointer_request (const QString&, - int))); - - connect (this, - SIGNAL (delete_debugger_pointer_signal (const QString&, int)), - m_editor_window, - SLOT (handle_delete_debugger_pointer_request (const QString&, - int))); - - connect (this, - SIGNAL (update_breakpoint_marker_signal (bool, const QString&, - int, const QString&)), - m_editor_window, - SLOT (handle_update_breakpoint_marker_request (bool, - const QString&, - int, - const QString&))); - - // Signals for removing/renaming files/dirs in the file browser - connect (m_file_browser_window, - SIGNAL (file_remove_signal (const QString&, const QString&)), - m_editor_window, - SLOT (handle_file_remove (const QString&, const QString&))); - - connect (m_file_browser_window, SIGNAL (file_renamed_signal (bool)), - m_editor_window, SLOT (handle_file_renamed (bool))); - - // Signals for removing/renaming files/dirs in the temrinal window - connect (m_octave_qt_link, SIGNAL (file_renamed_signal (bool)), - m_editor_window, SLOT (handle_file_renamed (bool))); -#endif + if (m_editor_window) + { + connect (this, + SIGNAL (insert_debugger_pointer_signal (const QString&, int)), + m_editor_window, + SLOT (handle_insert_debugger_pointer_request (const QString&, + int))); + + connect (this, + SIGNAL (delete_debugger_pointer_signal (const QString&, int)), + m_editor_window, + SLOT (handle_delete_debugger_pointer_request (const QString&, + int))); + + connect (this, + SIGNAL (update_breakpoint_marker_signal (bool, const QString&, + int, const QString&)), + m_editor_window, + SLOT (handle_update_breakpoint_marker_request (bool, + const QString&, + int, + const QString&))); + + // Signals for removing/renaming files/dirs in the file browser + connect (m_file_browser_window, + SIGNAL (file_remove_signal (const QString&, const QString&)), + m_editor_window, + SLOT (handle_file_remove (const QString&, const QString&))); + + connect (m_file_browser_window, SIGNAL (file_renamed_signal (bool)), + m_editor_window, SLOT (handle_file_renamed (bool))); + + // Signals for removing/renaming files/dirs in the temrinal window + connect (m_octave_qt_link, SIGNAL (file_renamed_signal (bool)), + m_editor_window, SLOT (handle_file_renamed (bool))); + } // Signals for removing/renaming files/dirs in the temrinal window connect (m_octave_qt_link, @@ -2023,20 +2016,21 @@ namespace octave construct_news_menu (menu_bar); -#if defined (HAVE_QSCINTILLA) - // call the editor to add actions which should also be available in the - // editor's menu and tool bar - QList shared_actions; - shared_actions << m_new_script_action - << m_new_function_action - << m_open_action - << m_find_files_action - << m_undo_action - << m_copy_action - << m_paste_action - <insert_global_actions (shared_actions); -#endif + if (m_editor_window) + { + // call the editor to add actions which should also be available in the + // editor's menu and tool bar + QList shared_actions; + shared_actions << m_new_script_action + << m_new_function_action + << m_open_action + << m_find_files_action + << m_undo_action + << m_copy_action + << m_paste_action + <insert_global_actions (shared_actions); + } } void main_window::construct_file_menu (QMenuBar *p) @@ -2051,9 +2045,8 @@ namespace octave m_open_action->setShortcutContext (Qt::ApplicationShortcut); m_open_action->setToolTip (tr ("Open an existing file in editor")); -#if defined (HAVE_QSCINTILLA) - file_menu->addMenu (m_editor_window->get_mru_menu ()); -#endif + if (m_editor_window) + file_menu->addMenu (m_editor_window->get_mru_menu ()); file_menu->addSeparator (); @@ -2208,10 +2201,11 @@ namespace octave action->setEnabled (false); -#if defined (HAVE_QSCINTILLA) - m_editor_window->debug_menu ()->addAction (action); - m_editor_window->toolbar ()->addAction (action); -#endif + if (m_editor_window) + { + m_editor_window->debug_menu ()->addAction (action); + m_editor_window->toolbar ()->addAction (action); + } return action; } @@ -2237,9 +2231,9 @@ namespace octave SLOT (debug_continue (void))); m_debug_menu->addSeparator (); -#if defined (HAVE_QSCINTILLA) - m_editor_window->debug_menu ()->addSeparator (); -#endif + + if (m_editor_window) + m_editor_window->debug_menu ()->addSeparator (); m_debug_quit = construct_debug_menu_item ( "db-stop", tr ("Quit Debug Mode"), @@ -2688,9 +2682,10 @@ namespace octave list.append (static_cast (m_history_window)); list.append (static_cast (m_file_browser_window)); list.append (static_cast (m_doc_browser_window)); -#if defined (HAVE_QSCINTILLA) - list.append (static_cast (m_editor_window)); -#endif + + if (m_editor_window) + list.append (static_cast (m_editor_window)); + list.append (static_cast (m_workspace_window)); list.append (static_cast (m_variable_editor_window)); return list;