Revision: 1989 http://geany.svn.sourceforge.net/geany/?rev=1989&view=rev Author: ntrel Date: 2007-10-29 09:53:40 -0700 (Mon, 29 Oct 2007)
Log Message: ----------- Make Fold All/Unfold All attempt to scroll the current line in view.
Modified Paths: -------------- trunk/ChangeLog trunk/src/document.c
Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2007-10-29 16:34:12 UTC (rev 1988) +++ trunk/ChangeLog 2007-10-29 16:53:40 UTC (rev 1989) @@ -13,6 +13,8 @@ Disable file and directory diff menu items if the current document has no filename. Disable project menu item when no project is open. + * src/document.c: + Make Fold All/Unfold All attempt to scroll the current line in view.
2007-10-28 Enrico Tröger enrico.troeger@uvena.de
Modified: trunk/src/document.c =================================================================== --- trunk/src/document.c 2007-10-29 16:34:12 UTC (rev 1988) +++ trunk/src/document.c 2007-10-29 16:53:40 UTC (rev 1989) @@ -1908,40 +1908,37 @@ }
-void document_unfold_all(gint idx) +static void fold_all(gint idx, gboolean want_fold) { - gint lines, pos, i; + gint lines, first, i;
- if (idx == -1 || ! doc_list[idx].is_valid) return; + if (! DOC_IDX_VALID(idx)) return;
lines = sci_get_line_count(doc_list[idx].sci); - pos = sci_get_current_position(doc_list[idx].sci); + first = sci_get_first_visible_line(doc_list[idx].sci);
for (i = 0; i < lines; i++) { - sci_ensure_line_is_visible(doc_list[idx].sci, i); + gint level = sci_get_fold_level(doc_list[idx].sci, i); + if (level & SC_FOLDLEVELHEADERFLAG) + { + if (sci_get_fold_expanded(doc_list[idx].sci, i) == want_fold) + sci_toggle_fold(doc_list[idx].sci, i); + } } + editor_scroll_to_line(doc_list[idx].sci, first, 0.0F); }
-void document_fold_all(gint idx) +void document_unfold_all(gint idx) { - gint lines, pos, i; + fold_all(idx, FALSE); +}
- if (idx == -1 || ! doc_list[idx].is_valid) return;
- lines = sci_get_line_count(doc_list[idx].sci); - pos = sci_get_current_position(doc_list[idx].sci); - - for (i = 0; i < lines; i++) - { - gint level = sci_get_fold_level(doc_list[idx].sci, i); - if (level & SC_FOLDLEVELHEADERFLAG) - { - if (sci_get_fold_expanded(doc_list[idx].sci, i)) - sci_toggle_fold(doc_list[idx].sci, i); - } - } +void document_fold_all(gint idx) +{ + fold_all(idx, TRUE); }
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.