From 7c7df53db25d775df582348164f2a4384cd256dd Mon Sep 17 00:00:00 2001 From: Torsten Lilge Date: Thu, 26 Dec 2024 22:43:13 +0100 Subject: [PATCH 1/3] ensure correct namespace when updating language files * update_ts_files: run lupdate on a temporary copy of the gui source files where namespacemacros are replaced by the native namespace syntax --- libgui/languages/build_ts/update_ts_files | 55 +++++++++++++++++++---- 1 file changed, 46 insertions(+), 9 deletions(-) diff --git a/libgui/languages/build_ts/update_ts_files b/libgui/languages/build_ts/update_ts_files index e8a44aa525..938390032b 100755 --- a/libgui/languages/build_ts/update_ts_files +++ b/libgui/languages/build_ts/update_ts_files @@ -2,9 +2,36 @@ # This scripts has to be called from the folder libgui/languages # where the *.ts files for each provided translation are located +echo "---------------------------------------------" +echo +echo " Updating language file from current sources " +echo +echo " Do NOT interrupt this script by Ctrl-C," +echo " use 'q' instead." +echo +echo "---------------------------------------------" + +# lupdate does not recognize the macro for the octave namespace. +# Therefore, the relevant sources are copied into a temporary +# directory where the macros for begining and edning a namespace +# are replaced by the original syntax. +echo +echo -n "Preparing temporary sources ... " + +OCTAVE_TEMP="__octave_temp_gui_sources__" +mkdir $OCTAVE_TEMP +cp -a ../graphics $OCTAVE_TEMP/ +cp -a ../qterminal $OCTAVE_TEMP/ +cp -a ../src $OCTAVE_TEMP/ + +find $OCTAVE_TEMP -type f -exec \ + sed -i -e 's/OCTAVE_BEGIN_NAMESPACE(\([^)]\+\))/namespace \1 \{/g'\ + -e 's/OCTAVE_END_NAMESPACE(\([^)]\+\))/\}/g' {} \; -# The paths with libgui sources to scan for text strings -SEARCH_PATH_COMMON="../graphics ../qterminal ../src" +echo "done" + +# Now set the search paths for lupdate to the temporary sources +SEARCH_PATH_COMMON="$OCTAVE_TEMP/graphics $OCTAVE_TEMP/qterminal $OCTAVE_TEMP/src" # Path to Qt and QScintilla files with strings that should also be # translated by octave in case that Qt or QScintilla does not provide @@ -15,7 +42,7 @@ SEARCH_PATH_QSCI="build_ts/octave-qsci" # The directory with translations provided by Qt and QScintilla # FIXME: This constant should not be hardcoded. Probably best if # it could be picked up from the configuration such as HAVE_QTX in config.h. -QT_VERSION="qt5" +QT_VERSION="qt6" QT_LANG_DIR=/usr/share/$QT_VERSION/translations # Now update all ts files @@ -52,15 +79,25 @@ do echo "$xx_yy: Existing translations for Qt: $T_QT, QSci: $T_QSCI" # Do the update after user's confirmation - echo " => scan for strings in following paths" - echo " => $SEARCH_PATH" - read -p " => Update (y/[n])? " ANS; - ANS=${ANS:-n} - if [ $ANS = "y" ]; then + echo " => scan for strings in following paths" + echo " => $SEARCH_PATH" + read -N 1 -p " => Update (y/[n]/q)? " ANS; + + if [[ $ANS = "q" ]]; then + break + fi + + if [[ $ANS = "y" ]]; then echo - lupdate -$QT_VERSION -no-obsolete -locations relative $SEARCH_PATH -ts $file + lupdate -no-obsolete -locations relative $SEARCH_PATH -ts $file fi done +# Remove temporary copy of source files +echo +echo +echo -n "Removing temporary sources ... " +rm -rf $OCTAVE_TEMP +echo "done" echo From 4971f428e8c78eaa0b7a4291897486b0d3e46f25 Mon Sep 17 00:00:00 2001 From: Torsten Lilge Date: Sun, 29 Dec 2024 17:03:04 +0100 Subject: [PATCH 2/3] translate shortcuts and descriptions in settings dialog (bug #66558) * gui-preferences-sc.cc: use the empty constructor for all shortcut objects for not already adding the untranslated descritpon to the hash with all shortcuts; (init_all_shortcuts): function for later adding description, key and key-sequence to all shortcuts * gui-preferences-sc.h; new function init_all_shortcuts * gui-preferences.cc (sc_pref::def_text): use option QKeySequence::NativeText resulting in translated strings for a key sequence * gui-settings.cc (sc_value): see gui-preferences.cc (sc_pref::def_text) * octave-qobject.cc: include gui-preferences-sc.h; (config_translators): call init_all_shortcuts for setting up shortcuts * shortcuts-tree-widget.cc (keyPressEvent): use QKeySequence::NativeText; (shortcuts_tree_widget): sort the shortcuts with respect to their descritpion, not with respect to their keys --- libgui/src/gui-preferences-sc.cc | 468 +++++++++++++++++++--------- libgui/src/gui-preferences-sc.h | 1 + libgui/src/gui-preferences.cc | 2 +- libgui/src/gui-settings.cc | 2 +- libgui/src/octave-qobject.cc | 3 + libgui/src/shortcuts-tree-widget.cc | 14 +- 6 files changed, 345 insertions(+), 145 deletions(-) diff --git a/libgui/src/gui-preferences-sc.cc b/libgui/src/gui-preferences-sc.cc index e2e350cf42..b4b3787be6 100644 --- a/libgui/src/gui-preferences-sc.cc +++ b/libgui/src/gui-preferences-sc.cc @@ -39,185 +39,371 @@ // by defining a macro won't work because lupdate won't know to look for // the macro. -sc_pref sc_dock_widget_dock (QCoreApplication::translate ("shortcuts", "Undock/Dock Widget"), sc_dock_widget + ":dock", OCTAVE_QT_KEYCOMBINATION (CTRL_ALT, Qt::Key_D)); -sc_pref sc_dock_widget_close (QCoreApplication::translate ("shortcuts", "Close Widget"), sc_dock_widget + ":close", OCTAVE_QT_KEYCOMBINATION (CTRL_ALT, Qt::Key_C)); +// The translations of the shortcut's descriptions require a more +// complicated structure. If already using the sc-pref constructor +// with the description as argument, this description is added to +// the hash all_shortcut_keys and the translation cannot be added +// later on. Therefore, all sc_pref objects are first declared with +// the empty constructor and description, key and shortcut are added +// later by calling init_all_shortcuts defined here. This function +// is calles in the constructor of the base qobject directly after +// loading the translators. + +// Dock widgets +sc_pref sc_dock_widget_dock; +sc_pref sc_dock_widget_close; // Main window menu // file -sc_pref sc_main_file_new_file (QCoreApplication::translate ("shortcuts", "New File"), sc_main_file + ":new_file", QKeySequence::New); -sc_pref sc_main_file_new_function (QCoreApplication::translate ("shortcuts", "New Function"), sc_main_file + ":new_function", OCTAVE_QT_KEYCOMBINATION (CTRL_SHIFT, Qt::Key_N)); -sc_pref sc_main_file_new_figure (QCoreApplication::translate ("shortcuts", "New Figure"), sc_main_file + ":new_figure", QKeySequence::UnknownKey); -sc_pref sc_main_file_open_file (QCoreApplication::translate ("shortcuts", "Open File"), sc_main_file + ":open_file", QKeySequence::Open); -sc_pref sc_main_file_load_workspace (QCoreApplication::translate ("shortcuts", "Load Workspace"), sc_main_file + ":load_workspace", QKeySequence::UnknownKey); -sc_pref sc_main_file_save_workspace (QCoreApplication::translate ("shortcuts", "Save Workspace As"), sc_main_file + ":save_workspace", QKeySequence::UnknownKey); -sc_pref sc_main_file_exit (QCoreApplication::translate ("shortcuts", "Exit Octave"), sc_main_file + ":exit", QKeySequence::Quit); +sc_pref sc_main_file_new_file; +sc_pref sc_main_file_new_function; +sc_pref sc_main_file_new_figure; +sc_pref sc_main_file_open_file; +sc_pref sc_main_file_load_workspace; +sc_pref sc_main_file_save_workspace; +sc_pref sc_main_file_exit; // edit -sc_pref sc_main_edit_copy (QCoreApplication::translate ("shortcuts", "Copy"), sc_main_edit + ":copy", QKeySequence::Copy); -sc_pref sc_main_edit_paste (QCoreApplication::translate ("shortcuts", "Paste"), sc_main_edit + ":paste", QKeySequence::Paste); -sc_pref sc_main_edit_undo (QCoreApplication::translate ("shortcuts", "Undo"), sc_main_edit + ":undo", QKeySequence::Undo); -sc_pref sc_main_edit_select_all (QCoreApplication::translate ("shortcuts", "Select All"), sc_main_edit + ":select_all", QKeySequence::SelectAll); -sc_pref sc_main_edit_clear_clipboard (QCoreApplication::translate ("shortcuts", "Clear Clipboard"), sc_main_edit + ":clear_clipboard", QKeySequence::UnknownKey); -sc_pref sc_main_edit_find_in_files (QCoreApplication::translate ("shortcuts", "Find in Files"), sc_main_edit + ":find_in_files", OCTAVE_QT_KEYCOMBINATION (CTRL_SHIFT, Qt::Key_F)); -sc_pref sc_main_edit_clear_command_window (QCoreApplication::translate ("shortcuts", "Clear Command Window"), sc_main_edit + ":clear_command_window", QKeySequence::UnknownKey); -sc_pref sc_main_edit_clear_history (QCoreApplication::translate ("shortcuts", "Clear Command History"), sc_main_edit + ":clear_history", QKeySequence::UnknownKey); -sc_pref sc_main_edit_clear_workspace (QCoreApplication::translate ("shortcuts", "Clear Workspace"), sc_main_edit + ":clear_workspace", QKeySequence::UnknownKey); -sc_pref sc_main_edit_set_path (QCoreApplication::translate ("shortcuts", "Set Path"), sc_main_edit + ":set_path", QKeySequence::UnknownKey); -sc_pref sc_main_edit_preferences (QCoreApplication::translate ("shortcuts", "Preferences"), sc_main_edit + ":preferences", QKeySequence::UnknownKey); +sc_pref sc_main_edit_copy; +sc_pref sc_main_edit_paste; +sc_pref sc_main_edit_undo; +sc_pref sc_main_edit_select_all; +sc_pref sc_main_edit_clear_clipboard; +sc_pref sc_main_edit_find_in_files; +sc_pref sc_main_edit_clear_command_window; +sc_pref sc_main_edit_clear_history; +sc_pref sc_main_edit_clear_workspace; +sc_pref sc_main_edit_set_path; +sc_pref sc_main_edit_preferences; // debug -sc_pref sc_main_debug_step_over (QCoreApplication::translate ("shortcuts", "Step"), sc_main_debug + ":step_over", OCTAVE_QT_KEYCOMBINATION (PRE, Qt::Key_F10)); -sc_pref sc_main_debug_step_into (QCoreApplication::translate ("shortcuts", "Step In"), sc_main_debug + ":step_into", OCTAVE_QT_KEYCOMBINATION (PRE, Qt::Key_F11)); -sc_pref sc_main_debug_step_out (QCoreApplication::translate ("shortcuts", "Step Out"), sc_main_debug + ":step_out", OCTAVE_QT_KEYCOMBINATION (PRE | Qt::ShiftModifier, Qt::Key_F11)); -sc_pref sc_main_debug_continue (QCoreApplication::translate ("shortcuts", "Continue"), sc_main_debug + ":continue", OCTAVE_QT_KEYCOMBINATION (PRE, Qt::Key_F5)); -sc_pref sc_main_debug_quit (QCoreApplication::translate ("shortcuts", "Quit Debug Mode"), sc_main_debug + ":quit", OCTAVE_QT_KEYCOMBINATION (PRE | Qt::ShiftModifier, Qt::Key_F5)); +sc_pref sc_main_debug_step_over; +sc_pref sc_main_debug_step_into; +sc_pref sc_main_debug_step_out; +sc_pref sc_main_debug_continue; +sc_pref sc_main_debug_quit; // tools -sc_pref sc_main_tools_start_profiler (QCoreApplication::translate ("shortcuts", "Start/Stop Profiler Session"), sc_main_tools + ":start_profiler", OCTAVE_QT_KEYCOMBINATION (CTRL_SHIFT, Qt::Key_P)); -sc_pref sc_main_tools_resume_profiler (QCoreApplication::translate ("shortcuts", "Resume Profiler Session"), sc_main_tools + ":resume_profiler", QKeySequence::UnknownKey); -sc_pref sc_main_tools_show_profiler (QCoreApplication::translate ("shortcuts", "Show Profile Data"), sc_main_tools + ":show_profiler", OCTAVE_QT_KEYCOMBINATION (Qt::AltModifier | Qt::ShiftModifier, Qt::Key_P)); - +sc_pref sc_main_tools_start_profiler; +sc_pref sc_main_tools_resume_profiler; +sc_pref sc_main_tools_show_profiler; // window -sc_pref sc_main_window_show_command (QCoreApplication::translate ("shortcuts", "Show Command Window"), sc_main_window + ":show_command", OCTAVE_QT_KEYCOMBINATION (PRE | CTRL_SHIFT, Qt::Key_0)); -sc_pref sc_main_window_show_history (QCoreApplication::translate ("shortcuts", "Show Command History"), sc_main_window + ":show_history", OCTAVE_QT_KEYCOMBINATION (PRE | CTRL_SHIFT, Qt::Key_1)); -sc_pref sc_main_window_show_file_browser (QCoreApplication::translate ("shortcuts", "Show File Browser"), sc_main_window + ":show_file_browser", OCTAVE_QT_KEYCOMBINATION (PRE | CTRL_SHIFT, Qt::Key_2)); -sc_pref sc_main_window_show_workspace (QCoreApplication::translate ("shortcuts", "Show Workspace"), sc_main_window + ":show_workspace", OCTAVE_QT_KEYCOMBINATION (PRE | CTRL_SHIFT, Qt::Key_3)); -sc_pref sc_main_window_show_editor (QCoreApplication::translate ("shortcuts", "Show Editor"), sc_main_window + ":show_editor", OCTAVE_QT_KEYCOMBINATION (PRE | CTRL_SHIFT, Qt::Key_4)); -sc_pref sc_main_window_show_doc (QCoreApplication::translate ("shortcuts", "Show Documentation"), sc_main_window + ":show_doc", OCTAVE_QT_KEYCOMBINATION (PRE | CTRL_SHIFT, Qt::Key_5)); -sc_pref sc_main_window_show_variable_editor (QCoreApplication::translate ("shortcuts", "Show Variable Editor"), sc_main_window + ":show_variable_editor", OCTAVE_QT_KEYCOMBINATION (PRE | CTRL_SHIFT, Qt::Key_6)); -sc_pref sc_main_window_command (QCoreApplication::translate ("shortcuts", "Command Window"), sc_main_window + ":command", OCTAVE_QT_KEYCOMBINATION (PRE | CTRL, Qt::Key_0)); -sc_pref sc_main_window_history (QCoreApplication::translate ("shortcuts", "Command History"), sc_main_window + ":history", OCTAVE_QT_KEYCOMBINATION (PRE | CTRL, Qt::Key_1)); -sc_pref sc_main_window_file_browser (QCoreApplication::translate ("shortcuts", "File Browser"), sc_main_window + ":file_browser", OCTAVE_QT_KEYCOMBINATION (PRE | CTRL, Qt::Key_2)); -sc_pref sc_main_window_workspace (QCoreApplication::translate ("shortcuts", "Workspace"), sc_main_window + ":workspace", OCTAVE_QT_KEYCOMBINATION (PRE | CTRL, Qt::Key_3)); -sc_pref sc_main_window_editor (QCoreApplication::translate ("shortcuts", "Editor"), sc_main_window + ":editor", OCTAVE_QT_KEYCOMBINATION (PRE | CTRL, Qt::Key_4)); -sc_pref sc_main_window_doc (QCoreApplication::translate ("shortcuts", "Documentation"), sc_main_window + ":doc", OCTAVE_QT_KEYCOMBINATION (PRE | CTRL, Qt::Key_5)); -sc_pref sc_main_window_variable_editor (QCoreApplication::translate ("shortcuts", "Variable Editor"), sc_main_window + ":variable_editor", OCTAVE_QT_KEYCOMBINATION (PRE | CTRL, Qt::Key_6)); -sc_pref sc_main_window_previous_dock (QCoreApplication::translate ("shortcuts", "Previous Widget"), sc_main_window + ":previous_widget", OCTAVE_QT_KEYCOMBINATION (PRE | CTRL_ALT, Qt::Key_P)); -sc_pref sc_main_window_reset (QCoreApplication::translate ("shortcuts", "Reset Default Window Layout"), sc_main_window + ":reset", QKeySequence::UnknownKey); +sc_pref sc_main_window_show_command; +sc_pref sc_main_window_show_history; +sc_pref sc_main_window_show_file_browser; +sc_pref sc_main_window_show_workspace; +sc_pref sc_main_window_show_editor; +sc_pref sc_main_window_show_doc; +sc_pref sc_main_window_show_variable_editor; +sc_pref sc_main_window_command; +sc_pref sc_main_window_history; +sc_pref sc_main_window_file_browser; +sc_pref sc_main_window_workspace; +sc_pref sc_main_window_editor; +sc_pref sc_main_window_doc; +sc_pref sc_main_window_variable_editor; +sc_pref sc_main_window_previous_dock; +sc_pref sc_main_window_reset; // help -sc_pref sc_main_help_ondisk_doc (QCoreApplication::translate ("shortcuts", "Show On-disk Documentation"), sc_main_help + ":ondisk_doc", QKeySequence::UnknownKey); -sc_pref sc_main_help_online_doc (QCoreApplication::translate ("shortcuts", "Show Online Documentation"), sc_main_help + ":online_doc", QKeySequence::UnknownKey); -sc_pref sc_main_help_report_bug (QCoreApplication::translate ("shortcuts", "Report Bug"), sc_main_help + ":report_bug", QKeySequence::UnknownKey); -sc_pref sc_main_help_packages (QCoreApplication::translate ("shortcuts", "Octave Packages"), sc_main_help + ":packages", QKeySequence::UnknownKey); -sc_pref sc_main_help_contribute (QCoreApplication::translate ("shortcuts", "Contribute to Octave"), sc_main_help + ":contribute", QKeySequence::UnknownKey); -sc_pref sc_main_help_developer (QCoreApplication::translate ("shortcuts", "Octave Developer Resources"), sc_main_help + ":developer", QKeySequence::UnknownKey); -sc_pref sc_main_help_about (QCoreApplication::translate ("shortcuts", "About Octave"), sc_main_help + ":about", QKeySequence::UnknownKey); +sc_pref sc_main_help_ondisk_doc; +sc_pref sc_main_help_online_doc; +sc_pref sc_main_help_report_bug; +sc_pref sc_main_help_packages; +sc_pref sc_main_help_contribute; +sc_pref sc_main_help_developer; +sc_pref sc_main_help_about; // news -sc_pref sc_main_news_release_notes (QCoreApplication::translate ("shortcuts", "Release Notes"), sc_main_news + ":release_notes", QKeySequence::UnknownKey); -sc_pref sc_main_news_community_news (QCoreApplication::translate ("shortcuts", "Community News"), sc_main_news + ":community_news", QKeySequence::UnknownKey); +sc_pref sc_main_news_release_notes; +sc_pref sc_main_news_community_news; // Tab handling // The following shortcuts are moved into a separate tab. The key names // are not change for preserving compatibility with older versions -sc_pref sc_edit_file_close (QCoreApplication::translate ("shortcuts", "Close Tab"), sc_edit_file_cl, QKeySequence::Close); -sc_pref sc_edit_file_close_all (QCoreApplication::translate ("shortcuts", "Close All Tabs"), sc_edit_file_cl + "_all", QKeySequence::UnknownKey); -sc_pref sc_edit_file_close_other (QCoreApplication::translate ("shortcuts", "Close Other Tabs"), sc_edit_file_cl + "_other", QKeySequence::UnknownKey); -sc_pref sc_edit_tabs_switch_left_tab (QCoreApplication::translate ("shortcuts", "Switch to Left Tab"), sc_edit_tabs + ":switch_left_tab", OCTAVE_QT_KEYCOMBINATION (CTRL, Qt::Key_PageUp)); -sc_pref sc_edit_tabs_switch_right_tab (QCoreApplication::translate ("shortcuts", "Switch to Right Tab"), sc_edit_tabs + ":switch_right_tab", OCTAVE_QT_KEYCOMBINATION (CTRL, Qt::Key_PageDown)); -sc_pref sc_edit_tabs_move_tab_left (QCoreApplication::translate ("shortcuts", "Move Tab Left"), sc_edit_tabs + ":move_tab_left", OCTAVE_QT_KEYCOMBINATION (Qt::AltModifier, Qt::Key_PageUp)); -sc_pref sc_edit_tabs_move_tab_right (QCoreApplication::translate ("shortcuts", "Move Tab Right"), sc_edit_tabs + ":move_tab_right", OCTAVE_QT_KEYCOMBINATION (Qt::AltModifier, Qt::Key_PageDown)); +sc_pref sc_edit_file_close; +sc_pref sc_edit_file_close_all; +sc_pref sc_edit_file_close_other; +sc_pref sc_edit_tabs_switch_left_tab; +sc_pref sc_edit_tabs_switch_right_tab; +sc_pref sc_edit_tabs_move_tab_left; +sc_pref sc_edit_tabs_move_tab_right; // Zooming -sc_pref sc_edit_view_zoom_in (QCoreApplication::translate ("shortcuts", "Zoom In"), sc_edit_view_zoom + "_in", QKeySequence::ZoomIn); -sc_pref sc_edit_view_zoom_out (QCoreApplication::translate ("shortcuts", "Zoom Out"), sc_edit_view_zoom + "_out", QKeySequence::ZoomOut); -#if defined (Q_OS_MAC) -sc_pref sc_edit_view_zoom_normal (QCoreApplication::translate ("shortcuts", "Zoom Normal"), sc_edit_view_zoom + "_normal", OCTAVE_QT_KEYCOMBINATION (CTRL, Qt::Key_Underscore)); -#else -sc_pref sc_edit_view_zoom_normal (QCoreApplication::translate ("shortcuts", "Zoom Normal"), sc_edit_view_zoom + "_normal", OCTAVE_QT_KEYCOMBINATION (CTRL, Qt::Key_Period)); -#endif +sc_pref sc_edit_view_zoom_in; +sc_pref sc_edit_view_zoom_out; +sc_pref sc_edit_view_zoom_normal; // Actions of the editor // file -sc_pref sc_edit_file_edit_function (QCoreApplication::translate ("shortcuts", "Edit Function"), sc_edit_file + ":edit_function", OCTAVE_QT_KEYCOMBINATION (CTRL, Qt::Key_E)); -sc_pref sc_edit_file_save (QCoreApplication::translate ("shortcuts", "Save File"), sc_edit_file + ":save", QKeySequence::Save); -sc_pref sc_edit_file_save_as (QCoreApplication::translate ("shortcuts", "Save File As"), sc_edit_file + ":save_as", QKeySequence::SaveAs); -sc_pref sc_edit_file_print (QCoreApplication::translate ("shortcuts", "Print"), sc_edit_file + ":print", QKeySequence::Print); +sc_pref sc_edit_file_edit_function; +sc_pref sc_edit_file_save; +sc_pref sc_edit_file_save_as; +sc_pref sc_edit_file_print; // edit -sc_pref sc_edit_edit_redo (QCoreApplication::translate ("shortcuts", "Redo"), sc_edit_edit + ":redo", QKeySequence::Redo); -sc_pref sc_edit_edit_cut (QCoreApplication::translate ("shortcuts", "Cut"), sc_edit_edit + ":cut", QKeySequence::Cut); -sc_pref sc_edit_edit_find_replace (QCoreApplication::translate ("shortcuts", "Find and Replace"), sc_edit_edit_find + "_replace", QKeySequence::Find); -sc_pref sc_edit_edit_find_next (QCoreApplication::translate ("shortcuts", "Find Next"), sc_edit_edit_find + "_next", QKeySequence::FindNext); -sc_pref sc_edit_edit_find_previous (QCoreApplication::translate ("shortcuts", "Find Previous"), sc_edit_edit_find + "_previous", QKeySequence::FindPrevious); -sc_pref sc_edit_edit_delete_start_word (QCoreApplication::translate ("shortcuts", "Delete to Start of Word"), sc_edit_edit + ":delete_start_word", QKeySequence::DeleteStartOfWord); -sc_pref sc_edit_edit_delete_end_word (QCoreApplication::translate ("shortcuts", "Delete to End of Word"), sc_edit_edit + ":delete_end_word", QKeySequence::DeleteEndOfWord); -sc_pref sc_edit_edit_delete_start_line (QCoreApplication::translate ("shortcuts", "Delete to Start of Line"), sc_edit_edit + ":delete_start_line", OCTAVE_QT_KEYCOMBINATION (CTRL_SHIFT, Qt::Key_Backspace)); -sc_pref sc_edit_edit_delete_end_line (QCoreApplication::translate ("shortcuts", "Delete to End of Line"), sc_edit_edit + ":delete_end_line", OCTAVE_QT_KEYCOMBINATION (CTRL_SHIFT, Qt::Key_Delete)); -sc_pref sc_edit_edit_delete_line (QCoreApplication::translate ("shortcuts", "Delete Line"), sc_edit_edit + ":delete_line", OCTAVE_QT_KEYCOMBINATION (CTRL_SHIFT, Qt::Key_L)); -sc_pref sc_edit_edit_copy_line (QCoreApplication::translate ("shortcuts", "Copy Line"), sc_edit_edit + ":copy_line", OCTAVE_QT_KEYCOMBINATION (CTRL_SHIFT, Qt::Key_C)); -sc_pref sc_edit_edit_cut_line (QCoreApplication::translate ("shortcuts", "Cut Line"), sc_edit_edit + ":cut_line", OCTAVE_QT_KEYCOMBINATION (CTRL_SHIFT, Qt::Key_X)); -sc_pref sc_edit_edit_duplicate_selection (QCoreApplication::translate ("shortcuts", "Duplicate Selection/Line"), sc_edit_edit + ":duplicate_selection", OCTAVE_QT_KEYCOMBINATION (CTRL, Qt::Key_D)); -sc_pref sc_edit_edit_transpose_line (QCoreApplication::translate ("shortcuts", "Transpose Line"), sc_edit_edit + ":transpose_line", OCTAVE_QT_KEYCOMBINATION (CTRL, Qt::Key_T)); -sc_pref sc_edit_edit_completion_list (QCoreApplication::translate ("shortcuts", "Show Completion List"), sc_edit_edit + ":completion_list", OCTAVE_QT_KEYCOMBINATION (CTRL, Qt::Key_Space)); - -sc_pref sc_edit_edit_comment_selection (QCoreApplication::translate ("shortcuts", "Comment Selection"), sc_edit_edit + ":comment_selection", OCTAVE_QT_KEYCOMBINATION (CTRL, Qt::Key_R)); -sc_pref sc_edit_edit_uncomment_selection (QCoreApplication::translate ("shortcuts", "Uncomment Selection"), sc_edit_edit + ":uncomment_selection", OCTAVE_QT_KEYCOMBINATION (CTRL_SHIFT, Qt::Key_R)); -sc_pref sc_edit_edit_comment_var_selection (QCoreApplication::translate ("shortcuts", "Comment Selection (Choosing String)"), sc_edit_edit + ":comment_var_selection", OCTAVE_QT_KEYCOMBINATION (CTRL_ALT, Qt::Key_R)); -sc_pref sc_edit_edit_upper_case (QCoreApplication::translate ("shortcuts", "Uppercase Selection"), sc_edit_edit + ":upper_case", OCTAVE_QT_KEYCOMBINATION (CTRL, Qt::Key_U)); -sc_pref sc_edit_edit_lower_case (QCoreApplication::translate ("shortcuts", "Lowercase Selection"), sc_edit_edit + ":lower_case", OCTAVE_QT_KEYCOMBINATION (CTRL_ALT, Qt::Key_U)); - -#if defined (Q_OS_MAC) -sc_pref sc_edit_edit_indent_selection (QCoreApplication::translate ("shortcuts", "Indent Selection Rigidly"), sc_edit_edit + ":indent_selection", OCTAVE_QT_KEYCOMBINATION (PRE, Qt::Key_Tab)); -sc_pref sc_edit_edit_unindent_selection (QCoreApplication::translate ("shortcuts", "Unindent Selection Rigidly"), sc_edit_edit + ":unindent_selection", OCTAVE_QT_KEYCOMBINATION (PRE | Qt::ShiftModifier, Qt::Key_Tab)); -#else -sc_pref sc_edit_edit_indent_selection (QCoreApplication::translate ("shortcuts", "Indent Selection Rigidly"), sc_edit_edit + ":indent_selection", OCTAVE_QT_KEYCOMBINATION (CTRL, Qt::Key_Tab)); -sc_pref sc_edit_edit_unindent_selection (QCoreApplication::translate ("shortcuts", "Unindent Selection Rigidly"), sc_edit_edit + ":unindent_selection", OCTAVE_QT_KEYCOMBINATION (CTRL_SHIFT, Qt::Key_Tab)); -#endif -sc_pref sc_edit_edit_smart_indent_line_or_selection (QCoreApplication::translate ("shortcuts", "Indent Code"), sc_edit_edit + ":smart_indent_line_or_selection", QKeySequence::UnknownKey); - -sc_pref sc_edit_edit_conv_eol_winows (QCoreApplication::translate ("shortcuts", "Convert Line Endings to Windows"), sc_edit_edit + ":conv_eol_winows", QKeySequence::UnknownKey); -sc_pref sc_edit_edit_conv_eol_unix (QCoreApplication::translate ("shortcuts", "Convert Line Endings to Unix"), sc_edit_edit + ":conv_eol_unix", QKeySequence::UnknownKey); -sc_pref sc_edit_edit_conv_eol_mac (QCoreApplication::translate ("shortcuts", "Convert Line Endings to Mac"), sc_edit_edit + ":conv_eol_mac", QKeySequence::UnknownKey); - -sc_pref sc_edit_edit_goto_line (QCoreApplication::translate ("shortcuts", "Goto Line"), sc_edit_edit + ":goto_line", OCTAVE_QT_KEYCOMBINATION (CTRL, Qt::Key_L)); -sc_pref sc_edit_edit_move_to_brace (QCoreApplication::translate ("shortcuts", "Move to Matching Brace"), sc_edit_edit + ":move_to_brace", OCTAVE_QT_KEYCOMBINATION (CTRL, Qt::Key_M)); -sc_pref sc_edit_edit_select_to_brace (QCoreApplication::translate ("shortcuts", "Select to Matching Brace"), sc_edit_edit + ":select_to_brace", OCTAVE_QT_KEYCOMBINATION (CTRL_SHIFT, Qt::Key_M)); -sc_pref sc_edit_edit_toggle_bookmark (QCoreApplication::translate ("shortcuts", "Toggle Bookmark"), sc_edit_edit + ":toggle_bookmark", OCTAVE_QT_KEYCOMBINATION (PRE, Qt::Key_F7)); -sc_pref sc_edit_edit_next_bookmark (QCoreApplication::translate ("shortcuts", "Next Bookmark"), sc_edit_edit + ":next_bookmark", OCTAVE_QT_KEYCOMBINATION (PRE, Qt::Key_F2)); -sc_pref sc_edit_edit_previous_bookmark (QCoreApplication::translate ("shortcuts", "Previous Bookmark"), sc_edit_edit + ":previous_bookmark", OCTAVE_QT_KEYCOMBINATION (PRE | Qt::ShiftModifier, Qt::Key_F2)); -sc_pref sc_edit_edit_remove_bookmark (QCoreApplication::translate ("shortcuts", "Remove All Bookmark"), sc_edit_edit + ":remove_bookmark", QKeySequence::UnknownKey); - -sc_pref sc_edit_edit_preferences (QCoreApplication::translate ("shortcuts", "Preferences"), sc_edit_edit + ":preferences", QKeySequence::UnknownKey); -sc_pref sc_edit_edit_styles_preferences (QCoreApplication::translate ("shortcuts", "Styles Preferences"), sc_edit_edit + ":styles_preferences", QKeySequence::UnknownKey); +sc_pref sc_edit_edit_redo; +sc_pref sc_edit_edit_cut; +sc_pref sc_edit_edit_find_replace; +sc_pref sc_edit_edit_find_next; +sc_pref sc_edit_edit_find_previous; +sc_pref sc_edit_edit_delete_start_word; +sc_pref sc_edit_edit_delete_end_word; +sc_pref sc_edit_edit_delete_start_line; +sc_pref sc_edit_edit_delete_end_line; +sc_pref sc_edit_edit_delete_line; +sc_pref sc_edit_edit_copy_line; +sc_pref sc_edit_edit_cut_line; +sc_pref sc_edit_edit_duplicate_selection; +sc_pref sc_edit_edit_transpose_line; +sc_pref sc_edit_edit_completion_list; + +sc_pref sc_edit_edit_comment_selection; +sc_pref sc_edit_edit_uncomment_selection; +sc_pref sc_edit_edit_comment_var_selection; +sc_pref sc_edit_edit_upper_case; +sc_pref sc_edit_edit_lower_case; + +sc_pref sc_edit_edit_indent_selection; +sc_pref sc_edit_edit_unindent_selection; +sc_pref sc_edit_edit_smart_indent_line_or_selection; + +sc_pref sc_edit_edit_conv_eol_winows; +sc_pref sc_edit_edit_conv_eol_unix; +sc_pref sc_edit_edit_conv_eol_mac; + +sc_pref sc_edit_edit_goto_line; +sc_pref sc_edit_edit_move_to_brace; +sc_pref sc_edit_edit_select_to_brace; +sc_pref sc_edit_edit_toggle_bookmark; +sc_pref sc_edit_edit_next_bookmark; +sc_pref sc_edit_edit_previous_bookmark; +sc_pref sc_edit_edit_remove_bookmark; + +sc_pref sc_edit_edit_preferences; +sc_pref sc_edit_edit_styles_preferences; // view -sc_pref sc_edit_view_show_line_numbers (QCoreApplication::translate ("shortcuts", "Show Line Numbers"), sc_edit_view + ":show_line_numbers", QKeySequence::UnknownKey); -sc_pref sc_edit_view_show_white_spaces (QCoreApplication::translate ("shortcuts", "Show Whitespace Characters"), sc_edit_view + ":show_white_spaces", QKeySequence::UnknownKey); -sc_pref sc_edit_view_show_eol_chars (QCoreApplication::translate ("shortcuts", "Show Line Endings"), sc_edit_view + ":show_eol_chars", QKeySequence::UnknownKey); -sc_pref sc_edit_view_show_ind_guides (QCoreApplication::translate ("shortcuts", "Show Indentation Guides"), sc_edit_view + ":show_ind_guides", QKeySequence::UnknownKey); -sc_pref sc_edit_view_show_long_line (QCoreApplication::translate ("shortcuts", "Show Long Line Marker"), sc_edit_view + ":show_long_line", QKeySequence::UnknownKey); -sc_pref sc_edit_view_show_toolbar (QCoreApplication::translate ("shortcuts", "Show Toolbar"), sc_edit_view + ":show_toolbar", QKeySequence::UnknownKey); -sc_pref sc_edit_view_show_statusbar (QCoreApplication::translate ("shortcuts", "Show Statusbar"), sc_edit_view + ":show_statusbar", QKeySequence::UnknownKey); -sc_pref sc_edit_view_show_hscrollbar (QCoreApplication::translate ("shortcuts", "Show Horizontal Scrollbar"), sc_edit_view + ":show_hscrollbar", QKeySequence::UnknownKey); -sc_pref sc_edit_view_sort_tabs (QCoreApplication::translate ("shortcuts", "Sort Tabs Alphabetically"), sc_edit_view + ":sort_tabs", QKeySequence::UnknownKey); +sc_pref sc_edit_view_show_line_numbers; +sc_pref sc_edit_view_show_white_spaces; +sc_pref sc_edit_view_show_eol_chars; +sc_pref sc_edit_view_show_ind_guides; +sc_pref sc_edit_view_show_long_line; +sc_pref sc_edit_view_show_toolbar; +sc_pref sc_edit_view_show_statusbar; +sc_pref sc_edit_view_show_hscrollbar; +sc_pref sc_edit_view_sort_tabs; // debug -sc_pref sc_edit_debug_toggle_breakpoint (QCoreApplication::translate ("shortcuts", "Toggle Breakpoint"), sc_edit_debug + ":toggle_breakpoint", QKeySequence::UnknownKey); -sc_pref sc_edit_debug_next_breakpoint (QCoreApplication::translate ("shortcuts", "Next Breakpoint"), sc_edit_debug + ":next_breakpoint", QKeySequence::UnknownKey); -sc_pref sc_edit_debug_previous_breakpoint (QCoreApplication::translate ("shortcuts", "Previous Breakpoint"), sc_edit_debug + ":previous_breakpoint", QKeySequence::UnknownKey); -sc_pref sc_edit_debug_remove_breakpoints (QCoreApplication::translate ("shortcuts", "Remove All Breakpoints"), sc_edit_debug + ":remove_breakpoints", QKeySequence::UnknownKey); +sc_pref sc_edit_debug_toggle_breakpoint; +sc_pref sc_edit_debug_next_breakpoint; +sc_pref sc_edit_debug_previous_breakpoint; +sc_pref sc_edit_debug_remove_breakpoints; // run -sc_pref sc_edit_run_run_file (QCoreApplication::translate ("shortcuts", "Run File"), sc_edit_run + ":run_file", OCTAVE_QT_KEYCOMBINATION (PRE, Qt::Key_F5)); -sc_pref sc_edit_run_run_selection (QCoreApplication::translate ("shortcuts", "Run Selection"), sc_edit_run + ":run_selection", OCTAVE_QT_KEYCOMBINATION (PRE, Qt::Key_F9)); -sc_pref sc_edit_run_run_tests (QCoreApplication::translate ("shortcuts", "Run Tests"), sc_edit_run + ":run_tests", OCTAVE_QT_KEYCOMBINATION (CTRL, Qt::Key_F5)); -sc_pref sc_edit_run_run_demos (QCoreApplication::translate ("shortcuts", "Run Demos"), sc_edit_run + ":run_demos", OCTAVE_QT_KEYCOMBINATION (CTRL_SHIFT, Qt::Key_F5)); +sc_pref sc_edit_run_run_file; +sc_pref sc_edit_run_run_selection; +sc_pref sc_edit_run_run_tests; +sc_pref sc_edit_run_run_demos; // help -sc_pref sc_edit_help_help_keyword (QCoreApplication::translate ("shortcuts", "Help on Keyword"), sc_edit_help + ":help_keyword", QKeySequence::HelpContents); -sc_pref sc_edit_help_doc_keyword (QCoreApplication::translate ("shortcuts", "Document on Keyword"), sc_edit_help + ":doc_keyword", OCTAVE_QT_KEYCOMBINATION (Qt::SHIFT, Qt::Key_F1)); - +sc_pref sc_edit_help_help_keyword; +sc_pref sc_edit_help_doc_keyword; // Documentation browser -sc_pref sc_doc_go_home (QCoreApplication::translate ("shortcuts", "Go to Homepage"), sc_doc + ":go_home", OCTAVE_QT_KEYCOMBINATION (Qt::AltModifier, Qt::Key_Home)); -sc_pref sc_doc_go_back (QCoreApplication::translate ("shortcuts", "Go Back one Page"), sc_doc + ":go_back", QKeySequence::Back); -sc_pref sc_doc_go_next (QCoreApplication::translate ("shortcuts", "Go Forward one Page"), sc_doc + ":go_next", QKeySequence::Forward); -sc_pref sc_doc_bookmark (QCoreApplication::translate ("shortcuts", "Bookmark this Page"), sc_doc + ":bookmark", OCTAVE_QT_KEYCOMBINATION (CTRL, Qt::Key_D)); +sc_pref sc_doc_go_home; +sc_pref sc_doc_go_back; +sc_pref sc_doc_go_next; +sc_pref sc_doc_bookmark; + + +void init_all_shortcuts (void) +{ + // Dock widget + sc_dock_widget_dock = sc_pref (QCoreApplication::translate ("shortcuts", "Undock/Dock Widget"), sc_dock_widget + ":dock", OCTAVE_QT_KEYCOMBINATION (CTRL_ALT, Qt::Key_D)); + sc_dock_widget_close = sc_pref (QCoreApplication::translate ("shortcuts", "Close Widget"), sc_dock_widget + ":close", OCTAVE_QT_KEYCOMBINATION (CTRL_ALT, Qt::Key_C)); + + // Main window menu + + // file + sc_main_file_new_file = sc_pref (QCoreApplication::translate ("shortcuts", "New File"), sc_main_file + ":new_file", QKeySequence::New); + sc_main_file_new_function = sc_pref (QCoreApplication::translate ("shortcuts", "New Function"), sc_main_file + ":new_function", OCTAVE_QT_KEYCOMBINATION (CTRL_SHIFT, Qt::Key_N)); + sc_main_file_new_figure = sc_pref (QCoreApplication::translate ("shortcuts", "New Figure"), sc_main_file + ":new_figure", QKeySequence::UnknownKey); + sc_main_file_open_file = sc_pref (QCoreApplication::translate ("shortcuts", "Open File"), sc_main_file + ":open_file", QKeySequence::Open); + sc_main_file_load_workspace = sc_pref (QCoreApplication::translate ("shortcuts", "Load Workspace"), sc_main_file + ":load_workspace", QKeySequence::UnknownKey); + sc_main_file_save_workspace = sc_pref (QCoreApplication::translate ("shortcuts", "Save Workspace As"), sc_main_file + ":save_workspace", QKeySequence::UnknownKey); + sc_main_file_exit = sc_pref (QCoreApplication::translate ("shortcuts", "Exit Octave"), sc_main_file + ":exit", QKeySequence::Quit); + + // edit + sc_main_edit_copy = sc_pref (QCoreApplication::translate ("shortcuts", "Copy"), sc_main_edit + ":copy", QKeySequence::Copy); + sc_main_edit_paste = sc_pref (QCoreApplication::translate ("shortcuts", "Paste"), sc_main_edit + ":paste", QKeySequence::Paste); + sc_main_edit_undo = sc_pref (QCoreApplication::translate ("shortcuts", "Undo"), sc_main_edit + ":undo", QKeySequence::Undo); + sc_main_edit_select_all = sc_pref (QCoreApplication::translate ("shortcuts", "Select All"), sc_main_edit + ":select_all", QKeySequence::SelectAll); + sc_main_edit_clear_clipboard = sc_pref (QCoreApplication::translate ("shortcuts", "Clear Clipboard"), sc_main_edit + ":clear_clipboard", QKeySequence::UnknownKey); + sc_main_edit_find_in_files = sc_pref (QCoreApplication::translate ("shortcuts", "Find in Files"), sc_main_edit + ":find_in_files", OCTAVE_QT_KEYCOMBINATION (CTRL_SHIFT, Qt::Key_F)); + sc_main_edit_clear_command_window = sc_pref (QCoreApplication::translate ("shortcuts", "Clear Command Window"), sc_main_edit + ":clear_command_window", QKeySequence::UnknownKey); + sc_main_edit_clear_history = sc_pref (QCoreApplication::translate ("shortcuts", "Clear Command History"), sc_main_edit + ":clear_history", QKeySequence::UnknownKey); + sc_main_edit_clear_workspace = sc_pref (QCoreApplication::translate ("shortcuts", "Clear Workspace"), sc_main_edit + ":clear_workspace", QKeySequence::UnknownKey); + sc_main_edit_set_path = sc_pref (QCoreApplication::translate ("shortcuts", "Set Path"), sc_main_edit + ":set_path", QKeySequence::UnknownKey); + sc_main_edit_preferences = sc_pref (QCoreApplication::translate ("shortcuts", "Preferences"), sc_main_edit + ":preferences", QKeySequence::UnknownKey); + + // debug + sc_main_debug_step_over = sc_pref (QCoreApplication::translate ("shortcuts", "Step"), sc_main_debug + ":step_over", OCTAVE_QT_KEYCOMBINATION (PRE, Qt::Key_F10)); + sc_main_debug_step_into = sc_pref (QCoreApplication::translate ("shortcuts", "Step In"), sc_main_debug + ":step_into", OCTAVE_QT_KEYCOMBINATION (PRE, Qt::Key_F11)); + sc_main_debug_step_out = sc_pref (QCoreApplication::translate ("shortcuts", "Step Out"), sc_main_debug + ":step_out", OCTAVE_QT_KEYCOMBINATION (PRE | Qt::ShiftModifier, Qt::Key_F11)); + sc_main_debug_continue = sc_pref (QCoreApplication::translate ("shortcuts", "Continue"), sc_main_debug + ":continue", OCTAVE_QT_KEYCOMBINATION (PRE, Qt::Key_F5)); + sc_main_debug_quit = sc_pref (QCoreApplication::translate ("shortcuts", "Quit Debug Mode"), sc_main_debug + ":quit", OCTAVE_QT_KEYCOMBINATION (PRE | Qt::ShiftModifier, Qt::Key_F5)); + + // tools + sc_main_tools_start_profiler = sc_pref (QCoreApplication::translate ("shortcuts", "Start/Stop Profiler Session"), sc_main_tools + ":start_profiler", OCTAVE_QT_KEYCOMBINATION (CTRL_SHIFT, Qt::Key_P)); + sc_main_tools_resume_profiler = sc_pref (QCoreApplication::translate ("shortcuts", "Resume Profiler Session"), sc_main_tools + ":resume_profiler", QKeySequence::UnknownKey); + sc_main_tools_show_profiler = sc_pref (QCoreApplication::translate ("shortcuts", "Show Profile Data"), sc_main_tools + ":show_profiler", OCTAVE_QT_KEYCOMBINATION (Qt::AltModifier | Qt::ShiftModifier, Qt::Key_P)); + + + // window + sc_main_window_show_command = sc_pref (QCoreApplication::translate ("shortcuts", "Show Command Window"), sc_main_window + ":show_command", OCTAVE_QT_KEYCOMBINATION (PRE | CTRL_SHIFT, Qt::Key_0)); + sc_main_window_show_history = sc_pref (QCoreApplication::translate ("shortcuts", "Show Command History"), sc_main_window + ":show_history", OCTAVE_QT_KEYCOMBINATION (PRE | CTRL_SHIFT, Qt::Key_1)); + sc_main_window_show_file_browser = sc_pref (QCoreApplication::translate ("shortcuts", "Show File Browser"), sc_main_window + ":show_file_browser", OCTAVE_QT_KEYCOMBINATION (PRE | CTRL_SHIFT, Qt::Key_2)); + sc_main_window_show_workspace = sc_pref (QCoreApplication::translate ("shortcuts", "Show Workspace"), sc_main_window + ":show_workspace", OCTAVE_QT_KEYCOMBINATION (PRE | CTRL_SHIFT, Qt::Key_3)); + sc_main_window_show_editor = sc_pref (QCoreApplication::translate ("shortcuts", "Show Editor"), sc_main_window + ":show_editor", OCTAVE_QT_KEYCOMBINATION (PRE | CTRL_SHIFT, Qt::Key_4)); + sc_main_window_show_doc = sc_pref (QCoreApplication::translate ("shortcuts", "Show Documentation"), sc_main_window + ":show_doc", OCTAVE_QT_KEYCOMBINATION (PRE | CTRL_SHIFT, Qt::Key_5)); + sc_main_window_show_variable_editor = sc_pref (QCoreApplication::translate ("shortcuts", "Show Variable Editor"), sc_main_window + ":show_variable_editor", OCTAVE_QT_KEYCOMBINATION (PRE | CTRL_SHIFT, Qt::Key_6)); + sc_main_window_command = sc_pref (QCoreApplication::translate ("shortcuts", "Command Window"), sc_main_window + ":command", OCTAVE_QT_KEYCOMBINATION (PRE | CTRL, Qt::Key_0)); + sc_main_window_history = sc_pref (QCoreApplication::translate ("shortcuts", "Command History"), sc_main_window + ":history", OCTAVE_QT_KEYCOMBINATION (PRE | CTRL, Qt::Key_1)); + sc_main_window_file_browser = sc_pref (QCoreApplication::translate ("shortcuts", "File Browser"), sc_main_window + ":file_browser", OCTAVE_QT_KEYCOMBINATION (PRE | CTRL, Qt::Key_2)); + sc_main_window_workspace = sc_pref (QCoreApplication::translate ("shortcuts", "Workspace"), sc_main_window + ":workspace", OCTAVE_QT_KEYCOMBINATION (PRE | CTRL, Qt::Key_3)); + sc_main_window_editor = sc_pref (QCoreApplication::translate ("shortcuts", "Editor"), sc_main_window + ":editor", OCTAVE_QT_KEYCOMBINATION (PRE | CTRL, Qt::Key_4)); + sc_main_window_doc = sc_pref (QCoreApplication::translate ("shortcuts", "Documentation"), sc_main_window + ":doc", OCTAVE_QT_KEYCOMBINATION (PRE | CTRL, Qt::Key_5)); + sc_main_window_variable_editor = sc_pref (QCoreApplication::translate ("shortcuts", "Variable Editor"), sc_main_window + ":variable_editor", OCTAVE_QT_KEYCOMBINATION (PRE | CTRL, Qt::Key_6)); + sc_main_window_previous_dock = sc_pref (QCoreApplication::translate ("shortcuts", "Previous Widget"), sc_main_window + ":previous_widget", OCTAVE_QT_KEYCOMBINATION (PRE | CTRL_ALT, Qt::Key_P)); + sc_main_window_reset = sc_pref (QCoreApplication::translate ("shortcuts", "Reset Default Window Layout"), sc_main_window + ":reset", QKeySequence::UnknownKey); + + // help + sc_main_help_ondisk_doc = sc_pref (QCoreApplication::translate ("shortcuts", "Show On-disk Documentation"), sc_main_help + ":ondisk_doc", QKeySequence::UnknownKey); + sc_main_help_online_doc = sc_pref (QCoreApplication::translate ("shortcuts", "Show Online Documentation"), sc_main_help + ":online_doc", QKeySequence::UnknownKey); + sc_main_help_report_bug = sc_pref (QCoreApplication::translate ("shortcuts", "Report Bug"), sc_main_help + ":report_bug", QKeySequence::UnknownKey); + sc_main_help_packages = sc_pref (QCoreApplication::translate ("shortcuts", "Octave Packages"), sc_main_help + ":packages", QKeySequence::UnknownKey); + sc_main_help_contribute = sc_pref (QCoreApplication::translate ("shortcuts", "Contribute to Octave"), sc_main_help + ":contribute", QKeySequence::UnknownKey); + sc_main_help_developer = sc_pref (QCoreApplication::translate ("shortcuts", "Octave Developer Resources"), sc_main_help + ":developer", QKeySequence::UnknownKey); + sc_main_help_about = sc_pref (QCoreApplication::translate ("shortcuts", "About Octave"), sc_main_help + ":about", QKeySequence::UnknownKey); + + // news + sc_main_news_release_notes = sc_pref (QCoreApplication::translate ("shortcuts", "Release Notes"), sc_main_news + ":release_notes", QKeySequence::UnknownKey); + sc_main_news_community_news = sc_pref (QCoreApplication::translate ("shortcuts", "Community News"), sc_main_news + ":community_news", QKeySequence::UnknownKey); + + // Tab handling + // The following shortcuts are moved into a separate tab. The key names + // are not change for preserving compatibility with older versions + sc_edit_file_close = sc_pref (QCoreApplication::translate ("shortcuts", "Close Tab"), sc_edit_file_cl, QKeySequence::Close); + sc_edit_file_close_all = sc_pref (QCoreApplication::translate ("shortcuts", "Close All Tabs"), sc_edit_file_cl + "_all", QKeySequence::UnknownKey); + sc_edit_file_close_other = sc_pref (QCoreApplication::translate ("shortcuts", "Close Other Tabs"), sc_edit_file_cl + "_other", QKeySequence::UnknownKey); + sc_edit_tabs_switch_left_tab = sc_pref (QCoreApplication::translate ("shortcuts", "Switch to Left Tab"), sc_edit_tabs + ":switch_left_tab", OCTAVE_QT_KEYCOMBINATION (CTRL, Qt::Key_PageUp)); + sc_edit_tabs_switch_right_tab = sc_pref (QCoreApplication::translate ("shortcuts", "Switch to Right Tab"), sc_edit_tabs + ":switch_right_tab", OCTAVE_QT_KEYCOMBINATION (CTRL, Qt::Key_PageDown)); + sc_edit_tabs_move_tab_left = sc_pref (QCoreApplication::translate ("shortcuts", "Move Tab Left"), sc_edit_tabs + ":move_tab_left", OCTAVE_QT_KEYCOMBINATION (Qt::AltModifier, Qt::Key_PageUp)); + sc_edit_tabs_move_tab_right = sc_pref (QCoreApplication::translate ("shortcuts", "Move Tab Right"), sc_edit_tabs + ":move_tab_right", OCTAVE_QT_KEYCOMBINATION (Qt::AltModifier, Qt::Key_PageDown)); + + // Zooming + sc_edit_view_zoom_in = sc_pref (QCoreApplication::translate ("shortcuts", "Zoom In"), sc_edit_view_zoom + "_in", QKeySequence::ZoomIn); + sc_edit_view_zoom_out = sc_pref (QCoreApplication::translate ("shortcuts", "Zoom Out"), sc_edit_view_zoom + "_out", QKeySequence::ZoomOut); + #if defined (Q_OS_MAC) + sc_edit_view_zoom_normal = sc_pref (QCoreApplication::translate ("shortcuts", "Zoom Normal"), sc_edit_view_zoom + "_normal", OCTAVE_QT_KEYCOMBINATION (CTRL, Qt::Key_Underscore)); + #else + sc_edit_view_zoom_normal = sc_pref (QCoreApplication::translate ("shortcuts", "Zoom Normal"), sc_edit_view_zoom + "_normal", OCTAVE_QT_KEYCOMBINATION (CTRL, Qt::Key_Period)); + #endif + + // Actions of the editor + + // file + sc_edit_file_edit_function = sc_pref (QCoreApplication::translate ("shortcuts", "Edit Function"), sc_edit_file + ":edit_function", OCTAVE_QT_KEYCOMBINATION (CTRL, Qt::Key_E)); + sc_edit_file_save = sc_pref (QCoreApplication::translate ("shortcuts", "Save File"), sc_edit_file + ":save", QKeySequence::Save); + sc_edit_file_save_as = sc_pref (QCoreApplication::translate ("shortcuts", "Save File As"), sc_edit_file + ":save_as", QKeySequence::SaveAs); + sc_edit_file_print = sc_pref (QCoreApplication::translate ("shortcuts", "Print"), sc_edit_file + ":print", QKeySequence::Print); + + // edit + sc_edit_edit_redo = sc_pref (QCoreApplication::translate ("shortcuts", "Redo"), sc_edit_edit + ":redo", QKeySequence::Redo); + sc_edit_edit_cut = sc_pref (QCoreApplication::translate ("shortcuts", "Cut"), sc_edit_edit + ":cut", QKeySequence::Cut); + sc_edit_edit_find_replace = sc_pref (QCoreApplication::translate ("shortcuts", "Find and Replace"), sc_edit_edit_find + "_replace", QKeySequence::Find); + sc_edit_edit_find_next = sc_pref (QCoreApplication::translate ("shortcuts", "Find Next"), sc_edit_edit_find + "_next", QKeySequence::FindNext); + sc_edit_edit_find_previous = sc_pref (QCoreApplication::translate ("shortcuts", "Find Previous"), sc_edit_edit_find + "_previous", QKeySequence::FindPrevious); + sc_edit_edit_delete_start_word = sc_pref (QCoreApplication::translate ("shortcuts", "Delete to Start of Word"), sc_edit_edit + ":delete_start_word", QKeySequence::DeleteStartOfWord); + sc_edit_edit_delete_end_word = sc_pref (QCoreApplication::translate ("shortcuts", "Delete to End of Word"), sc_edit_edit + ":delete_end_word", QKeySequence::DeleteEndOfWord); + sc_edit_edit_delete_start_line = sc_pref (QCoreApplication::translate ("shortcuts", "Delete to Start of Line"), sc_edit_edit + ":delete_start_line", OCTAVE_QT_KEYCOMBINATION (CTRL_SHIFT, Qt::Key_Backspace)); + sc_edit_edit_delete_end_line = sc_pref (QCoreApplication::translate ("shortcuts", "Delete to End of Line"), sc_edit_edit + ":delete_end_line", OCTAVE_QT_KEYCOMBINATION (CTRL_SHIFT, Qt::Key_Delete)); + sc_edit_edit_delete_line = sc_pref (QCoreApplication::translate ("shortcuts", "Delete Line"), sc_edit_edit + ":delete_line", OCTAVE_QT_KEYCOMBINATION (CTRL_SHIFT, Qt::Key_L)); + sc_edit_edit_copy_line = sc_pref (QCoreApplication::translate ("shortcuts", "Copy Line"), sc_edit_edit + ":copy_line", OCTAVE_QT_KEYCOMBINATION (CTRL_SHIFT, Qt::Key_C)); + sc_edit_edit_cut_line = sc_pref (QCoreApplication::translate ("shortcuts", "Cut Line"), sc_edit_edit + ":cut_line", OCTAVE_QT_KEYCOMBINATION (CTRL_SHIFT, Qt::Key_X)); + sc_edit_edit_duplicate_selection = sc_pref (QCoreApplication::translate ("shortcuts", "Duplicate Selection/Line"), sc_edit_edit + ":duplicate_selection", OCTAVE_QT_KEYCOMBINATION (CTRL, Qt::Key_D)); + sc_edit_edit_transpose_line = sc_pref (QCoreApplication::translate ("shortcuts", "Transpose Line"), sc_edit_edit + ":transpose_line", OCTAVE_QT_KEYCOMBINATION (CTRL, Qt::Key_T)); + sc_edit_edit_completion_list = sc_pref (QCoreApplication::translate ("shortcuts", "Show Completion List"), sc_edit_edit + ":completion_list", OCTAVE_QT_KEYCOMBINATION (CTRL, Qt::Key_Space)); + + sc_edit_edit_comment_selection = sc_pref (QCoreApplication::translate ("shortcuts", "Comment Selection"), sc_edit_edit + ":comment_selection", OCTAVE_QT_KEYCOMBINATION (CTRL, Qt::Key_R)); + sc_edit_edit_uncomment_selection = sc_pref (QCoreApplication::translate ("shortcuts", "Uncomment Selection"), sc_edit_edit + ":uncomment_selection", OCTAVE_QT_KEYCOMBINATION (CTRL_SHIFT, Qt::Key_R)); + sc_edit_edit_comment_var_selection = sc_pref (QCoreApplication::translate ("shortcuts", "Comment Selection (Choosing String)"), sc_edit_edit + ":comment_var_selection", OCTAVE_QT_KEYCOMBINATION (CTRL_ALT, Qt::Key_R)); + sc_edit_edit_upper_case = sc_pref (QCoreApplication::translate ("shortcuts", "Uppercase Selection"), sc_edit_edit + ":upper_case", OCTAVE_QT_KEYCOMBINATION (CTRL, Qt::Key_U)); + sc_edit_edit_lower_case = sc_pref (QCoreApplication::translate ("shortcuts", "Lowercase Selection"), sc_edit_edit + ":lower_case", OCTAVE_QT_KEYCOMBINATION (CTRL_ALT, Qt::Key_U)); + + #if defined (Q_OS_MAC) + sc_edit_edit_indent_selection = sc_pref (QCoreApplication::translate ("shortcuts", "Indent Selection Rigidly"), sc_edit_edit + ":indent_selection", OCTAVE_QT_KEYCOMBINATION (PRE, Qt::Key_Tab)); + sc_edit_edit_unindent_selection = sc_pref (QCoreApplication::translate ("shortcuts", "Unindent Selection Rigidly"), sc_edit_edit + ":unindent_selection", OCTAVE_QT_KEYCOMBINATION (PRE | Qt::ShiftModifier, Qt::Key_Tab)); + #else + sc_edit_edit_indent_selection = sc_pref (QCoreApplication::translate ("shortcuts", "Indent Selection Rigidly"), sc_edit_edit + ":indent_selection", OCTAVE_QT_KEYCOMBINATION (CTRL, Qt::Key_Tab)); + sc_edit_edit_unindent_selection = sc_pref (QCoreApplication::translate ("shortcuts", "Unindent Selection Rigidly"), sc_edit_edit + ":unindent_selection", OCTAVE_QT_KEYCOMBINATION (CTRL_SHIFT, Qt::Key_Tab)); + #endif + sc_edit_edit_smart_indent_line_or_selection = sc_pref (QCoreApplication::translate ("shortcuts", "Indent Code"), sc_edit_edit + ":smart_indent_line_or_selection", QKeySequence::UnknownKey); + + sc_edit_edit_conv_eol_winows = sc_pref (QCoreApplication::translate ("shortcuts", "Convert Line Endings to Windows"), sc_edit_edit + ":conv_eol_winows", QKeySequence::UnknownKey); + sc_edit_edit_conv_eol_unix = sc_pref (QCoreApplication::translate ("shortcuts", "Convert Line Endings to Unix"), sc_edit_edit + ":conv_eol_unix", QKeySequence::UnknownKey); + sc_edit_edit_conv_eol_mac = sc_pref (QCoreApplication::translate ("shortcuts", "Convert Line Endings to Mac"), sc_edit_edit + ":conv_eol_mac", QKeySequence::UnknownKey); + + sc_edit_edit_goto_line = sc_pref (QCoreApplication::translate ("shortcuts", "Goto Line"), sc_edit_edit + ":goto_line", OCTAVE_QT_KEYCOMBINATION (CTRL, Qt::Key_L)); + sc_edit_edit_move_to_brace = sc_pref (QCoreApplication::translate ("shortcuts", "Move to Matching Brace"), sc_edit_edit + ":move_to_brace", OCTAVE_QT_KEYCOMBINATION (CTRL, Qt::Key_M)); + sc_edit_edit_select_to_brace = sc_pref (QCoreApplication::translate ("shortcuts", "Select to Matching Brace"), sc_edit_edit + ":select_to_brace", OCTAVE_QT_KEYCOMBINATION (CTRL_SHIFT, Qt::Key_M)); + sc_edit_edit_toggle_bookmark = sc_pref (QCoreApplication::translate ("shortcuts", "Toggle Bookmark"), sc_edit_edit + ":toggle_bookmark", OCTAVE_QT_KEYCOMBINATION (PRE, Qt::Key_F7)); + sc_edit_edit_next_bookmark = sc_pref (QCoreApplication::translate ("shortcuts", "Next Bookmark"), sc_edit_edit + ":next_bookmark", OCTAVE_QT_KEYCOMBINATION (PRE, Qt::Key_F2)); + sc_edit_edit_previous_bookmark = sc_pref (QCoreApplication::translate ("shortcuts", "Previous Bookmark"), sc_edit_edit + ":previous_bookmark", OCTAVE_QT_KEYCOMBINATION (PRE | Qt::ShiftModifier, Qt::Key_F2)); + sc_edit_edit_remove_bookmark = sc_pref (QCoreApplication::translate ("shortcuts", "Remove All Bookmark"), sc_edit_edit + ":remove_bookmark", QKeySequence::UnknownKey); + + sc_edit_edit_preferences = sc_pref (QCoreApplication::translate ("shortcuts", "Preferences"), sc_edit_edit + ":preferences", QKeySequence::UnknownKey); + sc_edit_edit_styles_preferences = sc_pref (QCoreApplication::translate ("shortcuts", "Styles Preferences"), sc_edit_edit + ":styles_preferences", QKeySequence::UnknownKey); + + // view + sc_edit_view_show_line_numbers = sc_pref (QCoreApplication::translate ("shortcuts", "Show Line Numbers"), sc_edit_view + ":show_line_numbers", QKeySequence::UnknownKey); + sc_edit_view_show_white_spaces = sc_pref (QCoreApplication::translate ("shortcuts", "Show Whitespace Characters"), sc_edit_view + ":show_white_spaces", QKeySequence::UnknownKey); + sc_edit_view_show_eol_chars = sc_pref (QCoreApplication::translate ("shortcuts", "Show Line Endings"), sc_edit_view + ":show_eol_chars", QKeySequence::UnknownKey); + sc_edit_view_show_ind_guides = sc_pref (QCoreApplication::translate ("shortcuts", "Show Indentation Guides"), sc_edit_view + ":show_ind_guides", QKeySequence::UnknownKey); + sc_edit_view_show_long_line = sc_pref (QCoreApplication::translate ("shortcuts", "Show Long Line Marker"), sc_edit_view + ":show_long_line", QKeySequence::UnknownKey); + sc_edit_view_show_toolbar = sc_pref (QCoreApplication::translate ("shortcuts", "Show Toolbar"), sc_edit_view + ":show_toolbar", QKeySequence::UnknownKey); + sc_edit_view_show_statusbar = sc_pref (QCoreApplication::translate ("shortcuts", "Show Statusbar"), sc_edit_view + ":show_statusbar", QKeySequence::UnknownKey); + sc_edit_view_show_hscrollbar = sc_pref (QCoreApplication::translate ("shortcuts", "Show Horizontal Scrollbar"), sc_edit_view + ":show_hscrollbar", QKeySequence::UnknownKey); + sc_edit_view_sort_tabs = sc_pref (QCoreApplication::translate ("shortcuts", "Sort Tabs Alphabetically"), sc_edit_view + ":sort_tabs", QKeySequence::UnknownKey); + + // debug + sc_edit_debug_toggle_breakpoint = sc_pref (QCoreApplication::translate ("shortcuts", "Toggle Breakpoint"), sc_edit_debug + ":toggle_breakpoint", QKeySequence::UnknownKey); + sc_edit_debug_next_breakpoint = sc_pref (QCoreApplication::translate ("shortcuts", "Next Breakpoint"), sc_edit_debug + ":next_breakpoint", QKeySequence::UnknownKey); + sc_edit_debug_previous_breakpoint = sc_pref (QCoreApplication::translate ("shortcuts", "Previous Breakpoint"), sc_edit_debug + ":previous_breakpoint", QKeySequence::UnknownKey); + sc_edit_debug_remove_breakpoints = sc_pref (QCoreApplication::translate ("shortcuts", "Remove All Breakpoints"), sc_edit_debug + ":remove_breakpoints", QKeySequence::UnknownKey); + + // run + sc_edit_run_run_file = sc_pref (QCoreApplication::translate ("shortcuts", "Run File"), sc_edit_run + ":run_file", OCTAVE_QT_KEYCOMBINATION (PRE, Qt::Key_F5)); + sc_edit_run_run_selection = sc_pref (QCoreApplication::translate ("shortcuts", "Run Selection"), sc_edit_run + ":run_selection", OCTAVE_QT_KEYCOMBINATION (PRE, Qt::Key_F9)); + sc_edit_run_run_tests = sc_pref (QCoreApplication::translate ("shortcuts", "Run Tests"), sc_edit_run + ":run_tests", OCTAVE_QT_KEYCOMBINATION (CTRL, Qt::Key_F5)); + sc_edit_run_run_demos = sc_pref (QCoreApplication::translate ("shortcuts", "Run Demos"), sc_edit_run + ":run_demos", OCTAVE_QT_KEYCOMBINATION (CTRL_SHIFT, Qt::Key_F5)); + + // help + sc_edit_help_help_keyword = sc_pref (QCoreApplication::translate ("shortcuts", "Help on Keyword"), sc_edit_help + ":help_keyword", QKeySequence::HelpContents); + sc_edit_help_doc_keyword = sc_pref (QCoreApplication::translate ("shortcuts", "Document on Keyword"), sc_edit_help + ":doc_keyword", OCTAVE_QT_KEYCOMBINATION (Qt::SHIFT, Qt::Key_F1)); + + + // Documentation browser + sc_doc_go_home = sc_pref (QCoreApplication::translate ("shortcuts", "Go to Homepage"), sc_doc + ":go_home", OCTAVE_QT_KEYCOMBINATION (Qt::AltModifier, Qt::Key_Home)); + sc_doc_go_back = sc_pref (QCoreApplication::translate ("shortcuts", "Go Back one Page"), sc_doc + ":go_back", QKeySequence::Back); + sc_doc_go_next = sc_pref (QCoreApplication::translate ("shortcuts", "Go Forward one Page"), sc_doc + ":go_next", QKeySequence::Forward); + sc_doc_bookmark = sc_pref (QCoreApplication::translate ("shortcuts", "Bookmark this Page"), sc_doc + ":bookmark", OCTAVE_QT_KEYCOMBINATION (CTRL, Qt::Key_D)); +} + QString get_shortcut_section (const QString& key) diff --git a/libgui/src/gui-preferences-sc.h b/libgui/src/gui-preferences-sc.h index 553bff9aed..f457410407 100644 --- a/libgui/src/gui-preferences-sc.h +++ b/libgui/src/gui-preferences-sc.h @@ -282,6 +282,7 @@ sc_prevent_rl_conflicts ("shortcuts/prevent_readline_conflicts", QVariant (false const gui_pref sc_prevent_rl_conflicts_menu ("shortcuts/prevent_readline_conflicts_menu", QVariant (false)); +extern void init_all_shortcuts (void); extern QString get_shortcut_section (const QString& key); #endif diff --git a/libgui/src/gui-preferences.cc b/libgui/src/gui-preferences.cc index 0651f1e48a..21be884176 100644 --- a/libgui/src/gui-preferences.cc +++ b/libgui/src/gui-preferences.cc @@ -130,7 +130,7 @@ sc_pref::def_value () const QString sc_pref::def_text () const { - return def_value ().toString (); + return def_value ().toString (QKeySequence::NativeText); } all_shortcut_preferences *all_shortcut_preferences::s_instance = nullptr; diff --git a/libgui/src/gui-settings.cc b/libgui/src/gui-settings.cc index 05f3fb64e2..d602c58bec 100644 --- a/libgui/src/gui-settings.cc +++ b/libgui/src/gui-settings.cc @@ -204,7 +204,7 @@ gui_settings::sc_value (const sc_pref& scpref) const // Get the value from the settings where the key sequences are stored // as strings - return value (full_settings_key, key_seq.toString ()).toString (); + return value (full_settings_key, key_seq.toString (QKeySequence::NativeText)).toString (); } else return scpref.def_text (); diff --git a/libgui/src/octave-qobject.cc b/libgui/src/octave-qobject.cc index 871ea481b1..8295dd5cc9 100644 --- a/libgui/src/octave-qobject.cc +++ b/libgui/src/octave-qobject.cc @@ -49,6 +49,7 @@ #include "documentation-dock-widget.h" #include "files-dock-widget.h" #include "gui-settings.h" +#include "gui-preferences-sc.h" #include "history-dock-widget.h" #include "interpreter-qobject.h" #include "main-window.h" @@ -403,6 +404,8 @@ base_qobject::config_translators () m_qapplication->installTranslator (m_qsci_tr); m_translators_installed = true; + + init_all_shortcuts (); // after translators are loaded } void diff --git a/libgui/src/shortcuts-tree-widget.cc b/libgui/src/shortcuts-tree-widget.cc index f9b9e6a3fe..b6a5aab61b 100644 --- a/libgui/src/shortcuts-tree-widget.cc +++ b/libgui/src/shortcuts-tree-widget.cc @@ -81,7 +81,7 @@ enter_shortcut::keyPressEvent (QKeyEvent *e) if (modifiers & Qt::MetaModifier) key |= Qt::META; - setText (QKeySequence (key).toString ()); + setText (QKeySequence (key).toString (QKeySequence::NativeText)); } } @@ -456,7 +456,17 @@ shortcuts_tree_widget::shortcuts_tree_widget (QWidget *parent) QList shortcut_settings_keys = all_shortcut_preferences::keys (); - shortcut_settings_keys.sort (); + + // Sort the keys with respect to the desciption, by adding + // descriotions as keys and the settings keys as values to a map. + // Fir this, use QMultiMap since descriptions might not be unique. + QMultiMap shortcut_settings_map; + for (const auto& settings_key : shortcut_settings_keys) + { + const sc_pref scpref = all_shortcut_preferences::value (settings_key); + shortcut_settings_map.insert (scpref.description (), settings_key); + } + shortcut_settings_keys = shortcut_settings_map.values (); gui_settings settings; From e9314073ddc72e082dd6e13d5576cd62ada24fc1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=BCtzel?= Date: Sun, 29 Dec 2024 13:44:48 +0100 Subject: [PATCH 3/3] Instantiate octave_base_diag and octave_base_sparse template classes. * ov-base-diag-inst.cc: Add new file to explicitly instantiate template class octave_base_diag with types that need to be exported from liboctinterp. * ov-base-sparse-inst.cc: Add new file to explicitly instantiate template class octave_base_sparse with types that need to be exported from liboctinterp. * ov-base-diag.h, ov-base-sparse.h: Use macro for template export. Mark all member functions for export. * ov-bool-sparse.cc, ov-bool-sparse.h, ov-cx-diag.cc, ov-cx-diag.h, ov-cx-sparse.cc, ov-cx-sparse.h, ov-flt-cx-diag.cc, ov-flt-cx-diag.h, ov-flt-re-diag.cc, ov-flt-re-diag.h, ov-re-diag.cc, ov-re-diag.h, ov-re-sparse.cc, ov-re-sparse.h: Instantiate template classes octave_base_diag and octave_base_sparse only in one compilation unit. Move extern template class declarations to headers. * ov-base-sparse.cc: Include missing header. * libinterp/octave-value/module.mk: Add new files to build system. See: https://octave.discourse.group/t/6086 --- libinterp/octave-value/module.mk | 2 + libinterp/octave-value/ov-base-diag-inst.cc | 38 +++++++ libinterp/octave-value/ov-base-diag.h | 104 ++++++++++-------- libinterp/octave-value/ov-base-sparse-inst.cc | 36 ++++++ libinterp/octave-value/ov-base-sparse.cc | 1 + libinterp/octave-value/ov-base-sparse.h | 85 +++++++++----- libinterp/octave-value/ov-bool-sparse.cc | 6 - libinterp/octave-value/ov-bool-sparse.h | 3 + libinterp/octave-value/ov-cx-diag.cc | 5 - libinterp/octave-value/ov-cx-diag.h | 3 + libinterp/octave-value/ov-cx-sparse.cc | 6 - libinterp/octave-value/ov-cx-sparse.h | 3 + libinterp/octave-value/ov-flt-cx-diag.cc | 5 - libinterp/octave-value/ov-flt-cx-diag.h | 3 + libinterp/octave-value/ov-flt-re-diag.cc | 5 - libinterp/octave-value/ov-flt-re-diag.h | 3 + libinterp/octave-value/ov-re-diag.cc | 5 - libinterp/octave-value/ov-re-diag.h | 3 + libinterp/octave-value/ov-re-sparse.cc | 5 - libinterp/octave-value/ov-re-sparse.h | 3 + 20 files changed, 214 insertions(+), 110 deletions(-) create mode 100644 libinterp/octave-value/ov-base-diag-inst.cc create mode 100644 libinterp/octave-value/ov-base-sparse-inst.cc diff --git a/libinterp/octave-value/module.mk b/libinterp/octave-value/module.mk index 62a978eaff..24a1fc6756 100644 --- a/libinterp/octave-value/module.mk +++ b/libinterp/octave-value/module.mk @@ -97,9 +97,11 @@ OCTAVE_VALUE_SRC = \ %reldir%/cdef-package.cc \ %reldir%/cdef-property.cc \ %reldir%/cdef-utils.cc \ + %reldir%/ov-base-diag-inst.cc \ %reldir%/ov-base-int-inst.cc \ %reldir%/ov-base-mat-inst.cc \ %reldir%/ov-base-scalar-inst.cc \ + %reldir%/ov-base-sparse-inst.cc \ %reldir%/ov-base.cc \ %reldir%/ov-bool-mat.cc \ %reldir%/ov-bool.cc \ diff --git a/libinterp/octave-value/ov-base-diag-inst.cc b/libinterp/octave-value/ov-base-diag-inst.cc new file mode 100644 index 0000000000..c959154f3a --- /dev/null +++ b/libinterp/octave-value/ov-base-diag-inst.cc @@ -0,0 +1,38 @@ +//////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2024 The Octave Project Developers +// +// See the file COPYRIGHT.md in the top-level directory of this +// distribution or . +// +// 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 +// . +// +//////////////////////////////////////////////////////////////////////// + +#if defined (HAVE_CONFIG_H) +# include "config.h" +#endif + +#include "ov-base-diag.cc" + +// instantiate template class with types that need to be exported from library + +template class OCTINTERP_API octave_base_diag; +template class OCTINTERP_API octave_base_diag; +template class OCTINTERP_API octave_base_diag; +template class OCTINTERP_API octave_base_diag; + diff --git a/libinterp/octave-value/ov-base-diag.h b/libinterp/octave-value/ov-base-diag.h index 6af2753e83..30985202fc 100644 --- a/libinterp/octave-value/ov-base-diag.h +++ b/libinterp/octave-value/ov-base-diag.h @@ -43,28 +43,34 @@ // Real matrix values. template -class OCTINTERP_API octave_base_diag : public octave_base_value +class OCTINTERP_TEMPLATE_API octave_base_diag : public octave_base_value { public: + OCTINTERP_API octave_base_diag () : octave_base_value (), m_matrix (), m_dense_cache () { } + OCTINTERP_API octave_base_diag (const DMT& m) : octave_base_value (), m_matrix (m), m_dense_cache () { } + OCTINTERP_API octave_base_diag (const octave_base_diag& m) : octave_base_value (), m_matrix (m.m_matrix), m_dense_cache () { } - ~octave_base_diag () = default; + OCTINTERP_API ~octave_base_diag () = default; - std::size_t byte_size () const { return m_matrix.byte_size (); } + OCTINTERP_API std::size_t byte_size () const + { return m_matrix.byte_size (); } - octave_value squeeze () const { return m_matrix; } + OCTINTERP_API octave_value squeeze () const + { return m_matrix; } - octave_value full_value () const { return to_dense (); } + OCTINTERP_API octave_value full_value () const + { return to_dense (); } // We don't need to override all three forms of subsref. The using // declaration will avoid warnings about partially-overloaded virtual @@ -74,8 +80,9 @@ class OCTINTERP_API octave_base_diag : public octave_base_value OCTINTERP_API octave_value subsref (const std::string& type, const std::list& idx); - octave_value_list subsref (const std::string& type, - const std::list& idx, int) + OCTINTERP_API octave_value_list + subsref (const std::string& type, const std::list& idx, + int) { return subsref (type, idx); } OCTINTERP_API octave_value @@ -85,14 +92,17 @@ class OCTINTERP_API octave_base_diag : public octave_base_value subsasgn (const std::string& type, const std::list& idx, const octave_value& rhs); - dim_vector dims () const { return m_matrix.dims (); } + OCTINTERP_API dim_vector dims () const + { return m_matrix.dims (); } - octave_idx_type nnz () const { return diag ().nnz (); } + OCTINTERP_API octave_idx_type nnz () const + { return diag ().nnz (); } - octave_value reshape (const dim_vector& new_dims) const + OCTINTERP_API octave_value reshape (const dim_vector& new_dims) const { return to_dense ().reshape (new_dims); } - octave_value permute (const Array& vec, bool inv = false) const + OCTINTERP_API octave_value + permute (const Array& vec, bool inv = false) const { if (vec.numel () == 2 && ((vec.xelem (0) == 1 && vec.xelem (1) == 0) @@ -105,11 +115,15 @@ class OCTINTERP_API octave_base_diag : public octave_base_value OCTINTERP_API octave_value resize (const dim_vector& dv, bool fill = false) const; - octave_value all (int dim = 0) const { return MT (m_matrix).all (dim); } - octave_value any (int dim = 0) const { return MT (m_matrix).any (dim); } + OCTINTERP_API octave_value all (int dim = 0) const + { return MT (m_matrix).all (dim); } + + OCTINTERP_API octave_value any (int dim = 0) const + { return MT (m_matrix).any (dim); } - MatrixType matrix_type () const { return MatrixType::Diagonal; } - MatrixType matrix_type (const MatrixType&) const + OCTINTERP_API MatrixType matrix_type () const + { return MatrixType::Diagonal; } + OCTINTERP_API MatrixType matrix_type (const MatrixType&) const { return matrix_type (); } // We don't need to override both forms of the diag method. The using @@ -119,38 +133,42 @@ class OCTINTERP_API octave_base_diag : public octave_base_value OCTINTERP_API octave_value diag (octave_idx_type k = 0) const; - octave_value sort (octave_idx_type dim = 0, sortmode mode = ASCENDING) const + OCTINTERP_API octave_value + sort (octave_idx_type dim = 0, sortmode mode = ASCENDING) const { return to_dense ().sort (dim, mode); } - octave_value sort (Array& sidx, octave_idx_type dim = 0, - sortmode mode = ASCENDING) const + OCTINTERP_API octave_value + sort (Array& sidx, octave_idx_type dim = 0, + sortmode mode = ASCENDING) const { return to_dense ().sort (sidx, dim, mode); } - sortmode issorted (sortmode mode = UNSORTED) const + OCTINTERP_API sortmode issorted (sortmode mode = UNSORTED) const { return to_dense ().issorted (mode); } - Array sort_rows_idx (sortmode mode = ASCENDING) const + OCTINTERP_API Array + sort_rows_idx (sortmode mode = ASCENDING) const { return to_dense ().sort_rows_idx (mode); } - sortmode is_sorted_rows (sortmode mode = UNSORTED) const + OCTINTERP_API sortmode is_sorted_rows (sortmode mode = UNSORTED) const { return to_dense ().is_sorted_rows (mode); } - bool is_matrix_type () const { return true; } + OCTINTERP_API bool is_matrix_type () const { return true; } - bool isnumeric () const { return true; } + OCTINTERP_API bool isnumeric () const { return true; } - bool is_defined () const { return true; } + OCTINTERP_API bool is_defined () const { return true; } - bool is_constant () const { return true; } + OCTINTERP_API bool is_constant () const { return true; } OCTINTERP_API bool is_true () const; - bool is_diag_matrix () const { return true; } + OCTINTERP_API bool is_diag_matrix () const { return true; } OCTINTERP_API double double_value (bool = false) const; OCTINTERP_API float float_value (bool = false) const; - double scalar_value (bool frc_str_conv = false) const + OCTINTERP_API double + scalar_value (bool frc_str_conv = false) const { return double_value (frc_str_conv); } OCTINTERP_API octave::idx_vector @@ -187,29 +205,29 @@ class OCTINTERP_API octave_base_diag : public octave_base_value OCTINTERP_API SparseComplexMatrix sparse_complex_matrix_value (bool = false) const; - int8NDArray - int8_array_value () const { return to_dense ().int8_array_value (); } + OCTINTERP_API int8NDArray int8_array_value () const + { return to_dense ().int8_array_value (); } - int16NDArray - int16_array_value () const { return to_dense ().int16_array_value (); } + OCTINTERP_API int16NDArray int16_array_value () const + { return to_dense ().int16_array_value (); } - int32NDArray - int32_array_value () const { return to_dense ().int32_array_value (); } + OCTINTERP_API int32NDArray int32_array_value () const + { return to_dense ().int32_array_value (); } - int64NDArray - int64_array_value () const { return to_dense ().int64_array_value (); } + OCTINTERP_API int64NDArray int64_array_value () const + { return to_dense ().int64_array_value (); } - uint8NDArray - uint8_array_value () const { return to_dense ().uint8_array_value (); } + OCTINTERP_API uint8NDArray uint8_array_value () const + { return to_dense ().uint8_array_value (); } - uint16NDArray - uint16_array_value () const { return to_dense ().uint16_array_value (); } + OCTINTERP_API uint16NDArray uint16_array_value () const + { return to_dense ().uint16_array_value (); } - uint32NDArray - uint32_array_value () const { return to_dense ().uint32_array_value (); } + OCTINTERP_API uint32NDArray uint32_array_value () const + { return to_dense ().uint32_array_value (); } - uint64NDArray - uint64_array_value () const { return to_dense ().uint64_array_value (); } + OCTINTERP_API uint64NDArray uint64_array_value () const + { return to_dense ().uint64_array_value (); } OCTINTERP_API octave_value convert_to_str_internal (bool pad, bool force, char type) const; diff --git a/libinterp/octave-value/ov-base-sparse-inst.cc b/libinterp/octave-value/ov-base-sparse-inst.cc new file mode 100644 index 0000000000..026c4df231 --- /dev/null +++ b/libinterp/octave-value/ov-base-sparse-inst.cc @@ -0,0 +1,36 @@ +//////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2024 The Octave Project Developers +// +// See the file COPYRIGHT.md in the top-level directory of this +// distribution or . +// +// 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 +// . +// +//////////////////////////////////////////////////////////////////////// + +#if defined (HAVE_CONFIG_H) +# include "config.h" +#endif + +#include "ov-base-sparse.cc" + +// instantiate template class with types that need to be exported from library + +template class OCTINTERP_API octave_base_sparse; +template class OCTINTERP_API octave_base_sparse; +template class OCTINTERP_API octave_base_sparse; diff --git a/libinterp/octave-value/ov-base-sparse.cc b/libinterp/octave-value/ov-base-sparse.cc index 9e32923928..f943fb0eaf 100644 --- a/libinterp/octave-value/ov-base-sparse.cc +++ b/libinterp/octave-value/ov-base-sparse.cc @@ -38,6 +38,7 @@ #include "pr-output.h" #include "byte-swap.h" +#include "errwarn.h" #include "ls-oct-text.h" #include "ls-utils.h" #include "ls-hdf5.h" diff --git a/libinterp/octave-value/ov-base-sparse.h b/libinterp/octave-value/ov-base-sparse.h index 1bb5272912..4395897cd4 100644 --- a/libinterp/octave-value/ov-base-sparse.h +++ b/libinterp/octave-value/ov-base-sparse.h @@ -46,14 +46,16 @@ class octave_sparse_bool_matrix; template -class OCTINTERP_API octave_base_sparse : public octave_base_value +class OCTINTERP_TEMPLATE_API octave_base_sparse : public octave_base_value { public: + OCTINTERP_OVERRIDABLE_FUNC_API octave_base_sparse () : octave_base_value (), matrix (), typ (MatrixType ()) { } + OCTINTERP_OVERRIDABLE_FUNC_API octave_base_sparse (const T& a) : octave_base_value (), matrix (a), typ (MatrixType ()) { @@ -61,6 +63,7 @@ class OCTINTERP_API octave_base_sparse : public octave_base_value matrix.resize (dim_vector (0, 0)); } + OCTINTERP_OVERRIDABLE_FUNC_API octave_base_sparse (const T& a, const MatrixType& t) : octave_base_value (), matrix (a), typ (t) { @@ -68,22 +71,29 @@ class OCTINTERP_API octave_base_sparse : public octave_base_value matrix.resize (dim_vector (0, 0)); } + OCTINTERP_OVERRIDABLE_FUNC_API octave_base_sparse (const octave_base_sparse& a) : octave_base_value (), matrix (a.matrix), typ (a.typ) { } - ~octave_base_sparse () = default; + OCTINTERP_OVERRIDABLE_FUNC_API ~octave_base_sparse () = default; - octave_idx_type numel () const { return dims ().safe_numel (); } + OCTINTERP_OVERRIDABLE_FUNC_API octave_idx_type numel () const + { return dims ().safe_numel (); } - octave_idx_type nnz () const { return matrix.nnz (); } + OCTINTERP_OVERRIDABLE_FUNC_API octave_idx_type nnz () const + { return matrix.nnz (); } - octave_idx_type nzmax () const { return matrix.nzmax (); } + OCTINTERP_OVERRIDABLE_FUNC_API octave_idx_type nzmax () const + { return matrix.nzmax (); } - std::size_t byte_size () const { return matrix.byte_size (); } + OCTINTERP_OVERRIDABLE_FUNC_API std::size_t byte_size () const + { return matrix.byte_size (); } - octave_value squeeze () const { return matrix.squeeze (); } + OCTINTERP_OVERRIDABLE_FUNC_API octave_value squeeze () const + { return matrix.squeeze (); } - octave_value full_value () const { return matrix.matrix_value (); } + OCTINTERP_OVERRIDABLE_FUNC_API octave_value full_value () const + { return matrix.matrix_value (); } // We don't need to override all three forms of subsref. The using // declaration will avoid warnings about partially-overloaded virtual @@ -93,8 +103,9 @@ class OCTINTERP_API octave_base_sparse : public octave_base_value OCTINTERP_API octave_value subsref (const std::string& type, const std::list& idx); - octave_value_list subsref (const std::string& type, - const std::list& idx, int) + OCTINTERP_OVERRIDABLE_FUNC_API octave_value_list + subsref (const std::string& type, const std::list& idx, + int) { return subsref (type, idx); } OCTINTERP_API octave_value @@ -161,52 +172,63 @@ class OCTINTERP_API octave_base_sparse : public octave_base_value OCTINTERP_API void delete_elements (const octave_value_list& idx); - dim_vector dims () const { return matrix.dims (); } + OCTINTERP_OVERRIDABLE_FUNC_API dim_vector dims () const + { return matrix.dims (); } OCTINTERP_API octave_value do_index_op (const octave_value_list& idx, bool resize_ok = false); - octave_value reshape (const dim_vector& new_dims) const + OCTINTERP_OVERRIDABLE_FUNC_API octave_value reshape (const dim_vector& new_dims) const { return T (matrix.reshape (new_dims)); } - octave_value permute (const Array& vec, bool inv = false) const + OCTINTERP_OVERRIDABLE_FUNC_API octave_value + permute (const Array& vec, bool inv = false) const { return T (matrix.permute (vec, inv)); } OCTINTERP_API octave_value resize (const dim_vector& dv, bool = false) const; - octave_value all (int dim = 0) const { return matrix.all (dim); } - octave_value any (int dim = 0) const { return matrix.any (dim); } + OCTINTERP_OVERRIDABLE_FUNC_API octave_value all (int dim = 0) const + { return matrix.all (dim); } + + OCTINTERP_OVERRIDABLE_FUNC_API octave_value any (int dim = 0) const + { return matrix.any (dim); } // We don't need to override both forms of the diag method. The using // declaration will avoid warnings about partially-overloaded virtual // functions. using octave_base_value::diag; - octave_value diag (octave_idx_type k = 0) const + OCTINTERP_OVERRIDABLE_FUNC_API octave_value diag (octave_idx_type k = 0) const { return octave_value (matrix.diag (k)); } - octave_value sort (octave_idx_type dim = 0, sortmode mode = ASCENDING) const + OCTINTERP_OVERRIDABLE_FUNC_API octave_value + sort (octave_idx_type dim = 0, sortmode mode = ASCENDING) const { return octave_value (matrix.sort (dim, mode)); } - octave_value sort (Array& sidx, octave_idx_type dim = 0, - sortmode mode = ASCENDING) const + + OCTINTERP_OVERRIDABLE_FUNC_API octave_value + sort (Array& sidx, octave_idx_type dim = 0, + sortmode mode = ASCENDING) const { return octave_value (matrix.sort (sidx, dim, mode)); } - sortmode issorted (sortmode mode = UNSORTED) const + OCTINTERP_OVERRIDABLE_FUNC_API sortmode + issorted (sortmode mode = UNSORTED) const { return full_value ().issorted (mode); } - MatrixType matrix_type () const { return typ; } - MatrixType matrix_type (const MatrixType& _typ) const + OCTINTERP_OVERRIDABLE_FUNC_API MatrixType matrix_type () const + { return typ; } + OCTINTERP_OVERRIDABLE_FUNC_API MatrixType + matrix_type (const MatrixType& _typ) const { MatrixType ret = typ; typ = _typ; return ret; } - bool is_matrix_type () const { return true; } + OCTINTERP_OVERRIDABLE_FUNC_API bool is_matrix_type () const { return true; } - bool isnumeric () const { return true; } + OCTINTERP_OVERRIDABLE_FUNC_API bool isnumeric () const { return true; } - bool issparse () const { return true; } + OCTINTERP_OVERRIDABLE_FUNC_API bool issparse () const { return true; } - bool is_defined () const { return true; } + OCTINTERP_OVERRIDABLE_FUNC_API bool is_defined () const { return true; } - bool is_constant () const { return true; } + OCTINTERP_OVERRIDABLE_FUNC_API bool is_constant () const { return true; } OCTINTERP_API bool is_true () const; @@ -232,11 +254,14 @@ class OCTINTERP_API octave_base_sparse : public octave_base_value // These functions exists to support the MEX interface. // You should not use them anywhere else. - const void * mex_get_data () const { return matrix.data (); } + OCTINTERP_OVERRIDABLE_FUNC_API const void * mex_get_data () const + { return matrix.data (); } - const octave_idx_type * mex_get_ir () const { return matrix.ridx (); } + OCTINTERP_OVERRIDABLE_FUNC_API const octave_idx_type * mex_get_ir () const + { return matrix.ridx (); } - const octave_idx_type * mex_get_jc () const { return matrix.cidx (); } + OCTINTERP_OVERRIDABLE_FUNC_API const octave_idx_type * mex_get_jc () const + { return matrix.cidx (); } OCTINTERP_API octave_value fast_elem_extract (octave_idx_type n) const; diff --git a/libinterp/octave-value/ov-bool-sparse.cc b/libinterp/octave-value/ov-bool-sparse.cc index c1086e100f..0b71db9fe6 100644 --- a/libinterp/octave-value/ov-bool-sparse.cc +++ b/libinterp/octave-value/ov-bool-sparse.cc @@ -34,10 +34,6 @@ #include "dim-vector.h" #include "mxarray.h" -#include "ov-base.h" -#include "ov-scalar.h" -#include "ov-bool.h" -#include "ov-bool-mat.h" #include "errwarn.h" #include "ops.h" #include "oct-locbuf.h" @@ -51,8 +47,6 @@ #include "ov-base-sparse.h" #include "ov-base-sparse.cc" -template class octave_base_sparse; - DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_sparse_bool_matrix, "sparse bool matrix", "logical"); diff --git a/libinterp/octave-value/ov-bool-sparse.h b/libinterp/octave-value/ov-bool-sparse.h index 28a51a2ffa..ed66651e83 100644 --- a/libinterp/octave-value/ov-bool-sparse.h +++ b/libinterp/octave-value/ov-bool-sparse.h @@ -47,6 +47,9 @@ class octave_value_list; +extern template class OCTINTERP_EXTERN_TEMPLATE_API +octave_base_sparse; + class OCTINTERP_API octave_sparse_bool_matrix : public octave_base_sparse { public: diff --git a/libinterp/octave-value/ov-cx-diag.cc b/libinterp/octave-value/ov-cx-diag.cc index ab692ad849..3f769534bc 100644 --- a/libinterp/octave-value/ov-cx-diag.cc +++ b/libinterp/octave-value/ov-cx-diag.cc @@ -32,14 +32,9 @@ #include "ov-cx-diag.h" #include "ov-flt-cx-diag.h" #include "ov-re-diag.h" -#include "ov-base-diag.cc" #include "ov-complex.h" -#include "ov-cx-mat.h" #include "ls-utils.h" - -template class octave_base_diag; - DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_complex_diag_matrix, "complex diagonal matrix", "double"); diff --git a/libinterp/octave-value/ov-cx-diag.h b/libinterp/octave-value/ov-cx-diag.h index 6050edf586..00cfba976f 100644 --- a/libinterp/octave-value/ov-cx-diag.h +++ b/libinterp/octave-value/ov-cx-diag.h @@ -35,6 +35,9 @@ // Real diagonal matrix values. +extern template class OCTINTERP_EXTERN_TEMPLATE_API +octave_base_diag; + class octave_complex_diag_matrix : public octave_base_diag { diff --git a/libinterp/octave-value/ov-cx-sparse.cc b/libinterp/octave-value/ov-cx-sparse.cc index d5a4a06f1f..38b8c99212 100644 --- a/libinterp/octave-value/ov-cx-sparse.cc +++ b/libinterp/octave-value/ov-cx-sparse.cc @@ -36,9 +36,6 @@ #include "oct-locbuf.h" #include "mxarray.h" -#include "ov-base.h" -#include "ov-scalar.h" -#include "ov-complex.h" #include "errwarn.h" #include "oct-hdf5.h" @@ -51,9 +48,6 @@ #include "ov-bool-sparse.h" - -template class octave_base_sparse; - DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_sparse_complex_matrix, "sparse complex matrix", "double"); diff --git a/libinterp/octave-value/ov-cx-sparse.h b/libinterp/octave-value/ov-cx-sparse.h index 8637eb3fbc..8a215850af 100644 --- a/libinterp/octave-value/ov-cx-sparse.h +++ b/libinterp/octave-value/ov-cx-sparse.h @@ -47,6 +47,9 @@ class octave_value_list; +extern template class OCTINTERP_EXTERN_TEMPLATE_API +octave_base_sparse; + class OCTINTERP_API octave_sparse_complex_matrix : public octave_base_sparse { public: diff --git a/libinterp/octave-value/ov-flt-cx-diag.cc b/libinterp/octave-value/ov-flt-cx-diag.cc index d152dfc171..16c5846fda 100644 --- a/libinterp/octave-value/ov-flt-cx-diag.cc +++ b/libinterp/octave-value/ov-flt-cx-diag.cc @@ -30,15 +30,10 @@ #include "byte-swap.h" #include "ov-flt-cx-diag.h" -#include "ov-base-diag.cc" #include "ov-flt-re-diag.h" #include "ov-flt-complex.h" -#include "ov-flt-cx-mat.h" #include "ls-utils.h" - -template class octave_base_diag; - DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_float_complex_diag_matrix, "float complex diagonal matrix", "single"); diff --git a/libinterp/octave-value/ov-flt-cx-diag.h b/libinterp/octave-value/ov-flt-cx-diag.h index 9cb0c67bf9..6411a2c427 100644 --- a/libinterp/octave-value/ov-flt-cx-diag.h +++ b/libinterp/octave-value/ov-flt-cx-diag.h @@ -35,6 +35,9 @@ // Real diagonal matrix values. +extern template class OCTINTERP_EXTERN_TEMPLATE_API +octave_base_diag; + class OCTINTERP_API octave_float_complex_diag_matrix : public octave_base_diag { diff --git a/libinterp/octave-value/ov-flt-re-diag.cc b/libinterp/octave-value/ov-flt-re-diag.cc index 9fdb850b61..3480c5c6fc 100644 --- a/libinterp/octave-value/ov-flt-re-diag.cc +++ b/libinterp/octave-value/ov-flt-re-diag.cc @@ -30,14 +30,9 @@ #include "byte-swap.h" #include "ov-flt-re-diag.h" -#include "ov-base-diag.cc" #include "ov-float.h" -#include "ov-flt-re-mat.h" #include "ls-utils.h" - -template class octave_base_diag; - DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_float_diag_matrix, "float diagonal matrix", "single"); diff --git a/libinterp/octave-value/ov-flt-re-diag.h b/libinterp/octave-value/ov-flt-re-diag.h index 38ecf9b18b..e8ffc65e69 100644 --- a/libinterp/octave-value/ov-flt-re-diag.h +++ b/libinterp/octave-value/ov-flt-re-diag.h @@ -35,6 +35,9 @@ // Real diagonal matrix values. +extern template class OCTINTERP_EXTERN_TEMPLATE_API +octave_base_diag; + class OCTINTERP_API octave_float_diag_matrix : public octave_base_diag { diff --git a/libinterp/octave-value/ov-re-diag.cc b/libinterp/octave-value/ov-re-diag.cc index e4cab1d104..04cdb1e7ad 100644 --- a/libinterp/octave-value/ov-re-diag.cc +++ b/libinterp/octave-value/ov-re-diag.cc @@ -31,14 +31,9 @@ #include "ov-re-diag.h" #include "ov-flt-re-diag.h" -#include "ov-base-diag.cc" #include "ov-scalar.h" -#include "ov-re-mat.h" #include "ls-utils.h" - -template class octave_base_diag; - DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_diag_matrix, "diagonal matrix", "double"); diff --git a/libinterp/octave-value/ov-re-diag.h b/libinterp/octave-value/ov-re-diag.h index 634b9b59ae..b876054d04 100644 --- a/libinterp/octave-value/ov-re-diag.h +++ b/libinterp/octave-value/ov-re-diag.h @@ -35,6 +35,9 @@ // Real diagonal matrix values. +extern template class OCTINTERP_EXTERN_TEMPLATE_API +octave_base_diag; + class OCTINTERP_API octave_diag_matrix : public octave_base_diag { diff --git a/libinterp/octave-value/ov-re-sparse.cc b/libinterp/octave-value/ov-re-sparse.cc index 1ba08285e2..9a9f27405a 100644 --- a/libinterp/octave-value/ov-re-sparse.cc +++ b/libinterp/octave-value/ov-re-sparse.cc @@ -37,8 +37,6 @@ #include "oct-locbuf.h" #include "mxarray.h" -#include "ov-base.h" -#include "ov-scalar.h" #include "errwarn.h" #include "oct-hdf5.h" @@ -51,9 +49,6 @@ #include "ov-bool-sparse.h" - -template class octave_base_sparse; - DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_sparse_matrix, "sparse matrix", "double"); diff --git a/libinterp/octave-value/ov-re-sparse.h b/libinterp/octave-value/ov-re-sparse.h index f6acc62775..eca54a6ba8 100644 --- a/libinterp/octave-value/ov-re-sparse.h +++ b/libinterp/octave-value/ov-re-sparse.h @@ -48,6 +48,9 @@ class octave_value_list; +extern template class OCTINTERP_EXTERN_TEMPLATE_API +octave_base_sparse; + class OCTINTERP_API octave_sparse_matrix : public octave_base_sparse { public: