Mercurial > octave
comparison libgui/src/m-editor/file-editor-tab.cc @ 31181:c6c4c6f04170
also restore bookmarks when restoring an editor session at startup
* gui-preferences-ed.h: add setting for storing bookmarks of editor files
* file-editor-interface.h: additional argument in request_open_file
* file-editor-tab.cc (get_all_bookmarks): new function collecting all
bookmarks and returning it in a list of numbers in a string;
* file-editor-tab.h: new function get_all_bookmarks
* file-editor.cc (restore_session): get list of bookmarks from settings
file and them as argument to request_open_file;
(save_session): collect all bookmarks of open files and store them
into the settings file;
(request_open_file): string with bookmarks as new argument,
if string id non-empty, add all contained bookmarks to the file
* file-editor.h: add bookmarks to session_data, new string argument
with bookmarks for request_open_file
author | Torsten Lilge <ttl-octave@mailbox.org> |
---|---|
date | Wed, 10 Aug 2022 22:24:58 +0200 |
parents | f0343b3685df |
children | d3231a604a62 |
comparison
equal
deleted
inserted
replaced
31180:6203e303c5ac | 31181:c6c4c6f04170 |
---|---|
1130 if (prevline == -1) | 1130 if (prevline == -1) |
1131 prevline = m_edit_area->markerFindPrevious (m_edit_area->lines (), | 1131 prevline = m_edit_area->markerFindPrevious (m_edit_area->lines (), |
1132 (1 << marker::bookmark)); | 1132 (1 << marker::bookmark)); |
1133 | 1133 |
1134 m_edit_area->setCursorPosition (prevline, 0); | 1134 m_edit_area->setCursorPosition (prevline, 0); |
1135 } | |
1136 | |
1137 | |
1138 QString file_editor_tab::get_all_bookmarks () | |
1139 { | |
1140 QString bmlist; | |
1141 int line = 0; | |
1142 | |
1143 while (line > -1) | |
1144 { | |
1145 line = m_edit_area->markerFindNext (line, (1 << marker::bookmark)); | |
1146 if (line > -1) | |
1147 { | |
1148 if (! bmlist.isEmpty ()) | |
1149 bmlist += ","; | |
1150 bmlist += QString::number (line); | |
1151 line++; // search from next line, otherwise same line found again | |
1152 } | |
1153 } | |
1154 | |
1155 return bmlist; | |
1135 } | 1156 } |
1136 | 1157 |
1137 void file_editor_tab::remove_bookmark (const QWidget *ID) | 1158 void file_editor_tab::remove_bookmark (const QWidget *ID) |
1138 { | 1159 { |
1139 if (ID != this) | 1160 if (ID != this) |