1 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
4 * Copyright (C) 2003 Naba Kumar
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 #include <libanjuta/anjuta-ui.h>
22 #include <libanjuta/anjuta-utils.h>
24 #include <libanjuta/interfaces/ianjuta-markable.h>
25 #include <libanjuta/interfaces/ianjuta-editor.h>
26 #include <libanjuta/interfaces/ianjuta-editor-selection.h>
27 #include <libanjuta/interfaces/ianjuta-editor-convert.h>
28 #include <libanjuta/interfaces/ianjuta-editor-line-mode.h>
29 #include <libanjuta/interfaces/ianjuta-editor-view.h>
30 #include <libanjuta/interfaces/ianjuta-editor-folds.h>
31 #include <libanjuta/interfaces/ianjuta-file.h>
32 #include <libanjuta/interfaces/ianjuta-file-savable.h>
33 #include <libanjuta/interfaces/ianjuta-print.h>
34 #include <libanjuta/interfaces/ianjuta-editor-comment.h>
35 #include <libanjuta/interfaces/ianjuta-editor-zoom.h>
36 #include <libanjuta/interfaces/ianjuta-editor-goto.h>
37 #include <libanjuta/interfaces/ianjuta-editor-language.h>
38 #include <libanjuta/interfaces/ianjuta-editor-assist.h>
43 #include "anjuta-docman.h"
44 #include "action-callbacks.h"
46 #include "file_history.h"
47 #include "search-box.h"
48 #include "search-files.h"
49 #include "anjuta-bookmarks.h"
51 static IAnjutaDocument
*
52 get_current_document (gpointer user_data
)
56 plugin
= ANJUTA_PLUGIN_DOCMAN (user_data
);
57 docman
= ANJUTA_DOCMAN (plugin
->docman
);
59 return anjuta_docman_get_current_document (docman
);
63 get_current_focus_widget (gpointer user_data
)
67 plugin
= ANJUTA_PLUGIN_DOCMAN (user_data
);
68 docman
= ANJUTA_DOCMAN (plugin
->docman
);
70 return anjuta_docman_get_current_focus_widget (docman
);
74 get_current_popup_active (gpointer user_data
)
79 plugin
= ANJUTA_PLUGIN_DOCMAN (user_data
);
80 docman
= ANJUTA_DOCMAN (plugin
->docman
);
82 widget
= anjuta_docman_get_current_popup (docman
);
85 widget
= gtk_widget_get_toplevel (widget
);
86 if (gtk_widget_is_toplevel (widget
))
87 return gtk_window_has_toplevel_focus (GTK_WINDOW (widget
));
93 on_open_activate (GtkAction
*action
, gpointer user_data
)
97 plugin
= ANJUTA_PLUGIN_DOCMAN (user_data
);
98 docman
= ANJUTA_DOCMAN (plugin
->docman
);
99 anjuta_docman_open_file (docman
);
103 on_save_activate (GtkAction
*action
, gpointer user_data
)
105 IAnjutaDocument
*doc
;
106 AnjutaDocman
*docman
;
107 DocmanPlugin
*plugin
;
108 plugin
= ANJUTA_PLUGIN_DOCMAN (user_data
);
109 docman
= ANJUTA_DOCMAN (plugin
->docman
);
111 doc
= anjuta_docman_get_current_document (docman
);
113 anjuta_docman_save_document (docman
, doc
, NULL
);
117 on_save_as_activate (GtkAction
*action
, gpointer user_data
)
119 IAnjutaDocument
*doc
;
120 AnjutaDocman
*docman
;
121 DocmanPlugin
*plugin
;
123 plugin
= ANJUTA_PLUGIN_DOCMAN (user_data
);
124 docman
= ANJUTA_DOCMAN (plugin
->docman
);
126 doc
= anjuta_docman_get_current_document (docman
);
128 anjuta_docman_save_document_as (docman
, doc
, NULL
);
132 on_save_all_activate (GtkAction
*action
, gpointer user_data
)
134 GList
*buffers
, *node
;
135 AnjutaDocman
*docman
;
136 DocmanPlugin
*plugin
;
137 plugin
= ANJUTA_PLUGIN_DOCMAN (user_data
);
138 docman
= ANJUTA_DOCMAN (plugin
->docman
);
140 buffers
= anjuta_docman_get_all_doc_widgets (docman
);
143 for (node
= buffers
; node
!= NULL
; node
= g_list_next (node
))
145 IAnjutaDocument
*doc
;
146 doc
= IANJUTA_DOCUMENT (node
->data
);
149 /* known-uri test occurs downstream */
150 /* CHECKME test here and perform save-as when appropriate ? */
151 if (ianjuta_file_savable_is_dirty (IANJUTA_FILE_SAVABLE (doc
), NULL
))
153 ianjuta_file_savable_save (IANJUTA_FILE_SAVABLE (doc
), NULL
);
157 g_list_free (buffers
);
162 on_save_prompt_save_editor (AnjutaSavePrompt
*save_prompt
,
163 gpointer item
, gpointer user_data
)
165 AnjutaDocman
*docman
;
167 docman
= ANJUTA_DOCMAN (user_data
);
168 return anjuta_docman_save_document (docman
, IANJUTA_DOCUMENT (item
),
169 GTK_WIDGET (save_prompt
));
173 on_close_file_activate (GtkAction
*action
, gpointer user_data
)
175 IAnjutaDocument
*doc
;
176 AnjutaDocman
*docman
;
177 DocmanPlugin
*plugin
;
179 plugin
= ANJUTA_PLUGIN_DOCMAN (user_data
);
180 docman
= ANJUTA_DOCMAN (plugin
->docman
);
181 doc
= anjuta_docman_get_current_document (docman
);
185 if (ianjuta_file_savable_is_dirty(IANJUTA_FILE_SAVABLE (doc
), NULL
))
190 AnjutaSavePrompt
*save_prompt
;
192 parent
= gtk_widget_get_toplevel (GTK_WIDGET (doc
));
193 /* Prompt for unsaved data */
194 save_prompt
= anjuta_save_prompt_new (GTK_WINDOW (parent
));
195 file
= ianjuta_file_get_file (IANJUTA_FILE (doc
), NULL
);
198 uri
= g_file_get_uri (file
);
199 g_object_unref (file
);
204 anjuta_save_prompt_add_item (save_prompt
,
205 ianjuta_document_get_filename (doc
, NULL
),
206 uri
, doc
, on_save_prompt_save_editor
,
210 switch (gtk_dialog_run (GTK_DIALOG (save_prompt
)))
212 case ANJUTA_SAVE_PROMPT_RESPONSE_CANCEL
:
215 case ANJUTA_SAVE_PROMPT_RESPONSE_DISCARD
:
216 case ANJUTA_SAVE_PROMPT_RESPONSE_SAVE_CLOSE
:
218 anjuta_docman_remove_document (docman
, doc
);
221 gtk_widget_destroy (GTK_WIDGET (save_prompt
));
224 anjuta_docman_remove_document (docman
, doc
);
228 on_close_all_file_activate (GtkAction
*action
, gpointer user_data
)
231 AnjutaDocman
*docman
;
232 DocmanPlugin
*plugin
;
233 plugin
= ANJUTA_PLUGIN_DOCMAN (user_data
);
234 docman
= ANJUTA_DOCMAN (plugin
->docman
);
236 /* Close all 'saved' files */
237 buffers
= anjuta_docman_get_all_doc_widgets (docman
);
244 IAnjutaDocument
*doc
;
246 doc
= IANJUTA_DOCUMENT (node
->data
);
247 next
= g_list_next (node
); /* grab it now, as we may change it. */
250 if (!ianjuta_file_savable_is_dirty (IANJUTA_FILE_SAVABLE (doc
), NULL
))
252 anjuta_docman_remove_document (docman
, doc
);
257 g_list_free (buffers
);
262 on_close_other_file_activate (GtkAction
*action
, gpointer user_data
)
265 AnjutaDocman
*docman
;
266 IAnjutaDocument
*curr_doc
;
267 DocmanPlugin
*plugin
;
268 plugin
= ANJUTA_PLUGIN_DOCMAN (user_data
);
269 docman
= ANJUTA_DOCMAN (plugin
->docman
);
271 /* Close all 'saved' files */
272 buffers
= anjuta_docman_get_all_doc_widgets (docman
);
278 curr_doc
= anjuta_docman_get_current_document (docman
);
281 IAnjutaDocument
*doc
;
283 doc
= IANJUTA_DOCUMENT (node
->data
);
284 next
= g_list_next (node
); /* grab it now, as we may change it. */
285 if (doc
&& doc
!= curr_doc
)
287 if (!ianjuta_file_savable_is_dirty (IANJUTA_FILE_SAVABLE (doc
), NULL
))
289 anjuta_docman_remove_document (docman
, doc
);
294 g_list_free (buffers
);
299 on_reload_file_activate (GtkAction
*action
, gpointer user_data
)
301 IAnjutaDocument
*doc
;
305 gint reply
= GTK_RESPONSE_YES
;
307 doc
= get_current_document (user_data
);
311 parent
= gtk_widget_get_toplevel (GTK_WIDGET (doc
));
312 if (IANJUTA_IS_FILE_SAVABLE (doc
) && ianjuta_file_savable_is_dirty (IANJUTA_FILE_SAVABLE (doc
), NULL
))
314 msg
= g_strdup_printf (
315 _("Are you sure you want to reload '%s'?\nAny unsaved changes will be lost."),
316 ianjuta_document_get_filename (doc
, NULL
));
318 dialog
= gtk_message_dialog_new (GTK_WINDOW (parent
),
319 GTK_DIALOG_DESTROY_WITH_PARENT
,
320 GTK_MESSAGE_QUESTION
,
321 GTK_BUTTONS_NONE
, "%s", msg
);
322 gtk_dialog_add_button (GTK_DIALOG (dialog
),
323 GTK_STOCK_CANCEL
, GTK_RESPONSE_NO
);
324 anjuta_util_dialog_add_button (GTK_DIALOG (dialog
), _("_Reload"),
325 GTK_STOCK_REVERT_TO_SAVED
,
327 gtk_dialog_set_default_response (GTK_DIALOG (dialog
),
329 reply
= gtk_dialog_run (GTK_DIALOG (dialog
));
330 gtk_widget_destroy (dialog
);
334 if (reply
== GTK_RESPONSE_YES
)
337 file
= ianjuta_file_get_file (IANJUTA_FILE (doc
), NULL
);
340 ianjuta_file_open (IANJUTA_FILE (doc
), file
, NULL
);
341 g_object_unref(file
);
347 on_print_activate (GtkAction
*action
, gpointer user_data
)
349 IAnjutaDocument
*doc
;
351 doc
= get_current_document (user_data
);
353 ianjuta_print_print (IANJUTA_PRINT (doc
), NULL
);
357 on_print_preview_activate (GtkAction
*action
, gpointer user_data
)
359 IAnjutaDocument
*doc
;
361 doc
= get_current_document (user_data
);
363 ianjuta_print_print_preview (IANJUTA_PRINT (doc
), NULL
);
367 on_editor_command_upper_case_activate (GtkAction
*action
, gpointer user_data
)
369 IAnjutaDocument
*doc
;
371 doc
= get_current_document (user_data
);
374 if (ianjuta_editor_selection_has_selection (IANJUTA_EDITOR_SELECTION (doc
),
377 IAnjutaIterable
*start
, *end
;
378 start
= ianjuta_editor_selection_get_start (IANJUTA_EDITOR_SELECTION (doc
),
380 end
= ianjuta_editor_selection_get_end (IANJUTA_EDITOR_SELECTION (doc
), NULL
);
381 ianjuta_editor_convert_to_upper (IANJUTA_EDITOR_CONVERT (doc
),
383 g_object_unref (start
);
384 g_object_unref (end
);
390 on_editor_command_lower_case_activate (GtkAction
*action
, gpointer user_data
)
392 IAnjutaDocument
*doc
;
394 doc
= get_current_document (user_data
);
397 if (ianjuta_editor_selection_has_selection (IANJUTA_EDITOR_SELECTION (doc
), NULL
))
399 IAnjutaIterable
*start
, *end
;
400 start
= ianjuta_editor_selection_get_start (IANJUTA_EDITOR_SELECTION (doc
), NULL
);
401 end
= ianjuta_editor_selection_get_end (IANJUTA_EDITOR_SELECTION (doc
), NULL
);
402 ianjuta_editor_convert_to_lower (IANJUTA_EDITOR_CONVERT (doc
),
404 g_object_unref (start
);
405 g_object_unref (end
);
411 on_editor_command_eol_crlf_activate (GtkAction
*action
, gpointer user_data
)
413 IAnjutaDocument
*doc
;
415 doc
= get_current_document (user_data
);
417 ianjuta_editor_line_mode_convert (IANJUTA_EDITOR_LINE_MODE (doc
),
418 IANJUTA_EDITOR_LINE_MODE_CRLF
, NULL
);
422 on_editor_command_eol_lf_activate (GtkAction
*action
, gpointer user_data
)
424 IAnjutaDocument
*doc
;
426 doc
= get_current_document (user_data
);
428 ianjuta_editor_line_mode_convert (IANJUTA_EDITOR_LINE_MODE (doc
),
429 IANJUTA_EDITOR_LINE_MODE_LF
, NULL
);
433 on_editor_command_eol_cr_activate (GtkAction
*action
, gpointer user_data
)
435 IAnjutaDocument
*doc
;
437 doc
= get_current_document (user_data
);
439 ianjuta_editor_line_mode_convert (IANJUTA_EDITOR_LINE_MODE (doc
),
440 IANJUTA_EDITOR_LINE_MODE_CR
, NULL
);
444 on_editor_command_select_all_activate (GtkAction
*action
, gpointer user_data
)
448 widget
= get_current_focus_widget (user_data
);
450 if (widget
&& GTK_IS_EDITABLE (widget
))
452 gtk_editable_select_region (GTK_EDITABLE (widget
), 0, -1);
456 if (widget
/* editor text is focused */
457 || get_current_popup_active (user_data
))
459 IAnjutaDocument
*doc
;
461 doc
= get_current_document (user_data
);
463 ianjuta_editor_selection_select_all
464 (IANJUTA_EDITOR_SELECTION (doc
), NULL
);
470 on_editor_command_select_block_activate (GtkAction
*action
, gpointer user_data
)
472 IAnjutaDocument
*doc
;
474 doc
= get_current_document (user_data
);
476 ianjuta_editor_selection_select_block (IANJUTA_EDITOR_SELECTION (doc
), NULL
);
480 on_editor_command_match_brace_activate (GtkAction
*action
, gpointer user_data
)
482 IAnjutaDocument
*doc
;
484 doc
= get_current_document (user_data
);
486 ianjuta_editor_goto_matching_brace (IANJUTA_EDITOR_GOTO (doc
), NULL
);
490 on_editor_command_undo_activate (GtkAction
*action
, gpointer user_data
)
492 IAnjutaDocument
*doc
;
494 doc
= get_current_document (user_data
);
496 ianjuta_document_undo (doc
, NULL
);
500 on_editor_command_redo_activate (GtkAction
*action
, gpointer user_data
)
502 IAnjutaDocument
*doc
;
504 doc
= get_current_document (user_data
);
506 ianjuta_document_redo (doc
, NULL
);
510 on_editor_command_cut_activate (GtkAction
*action
, gpointer user_data
)
514 widget
= get_current_focus_widget (user_data
);
516 if (widget
&& GTK_IS_EDITABLE (widget
))
518 gtk_editable_cut_clipboard (GTK_EDITABLE (widget
));
522 if (widget
/* editor text is focused */
523 || get_current_popup_active (user_data
))
525 IAnjutaDocument
*doc
;
527 doc
= get_current_document (user_data
);
529 ianjuta_document_cut (doc
, NULL
);
535 on_editor_command_paste_activate (GtkAction
*action
, gpointer user_data
)
539 widget
= get_current_focus_widget (user_data
);
541 if (widget
&& GTK_IS_EDITABLE (widget
))
543 gtk_editable_paste_clipboard (GTK_EDITABLE (widget
));
547 if (widget
/* editor text is focused */
548 || get_current_popup_active (user_data
))
550 IAnjutaDocument
*doc
;
552 doc
= get_current_document (user_data
);
554 ianjuta_document_paste (doc
, NULL
);
560 on_editor_command_copy_activate (GtkAction
*action
, gpointer user_data
)
564 widget
= get_current_focus_widget (user_data
);
566 if (widget
&& GTK_IS_EDITABLE (widget
))
568 gtk_editable_copy_clipboard (GTK_EDITABLE (widget
));
572 if (widget
/* editor text is focused */
573 || get_current_popup_active (user_data
))
575 IAnjutaDocument
*doc
;
577 doc
= get_current_document (user_data
);
579 ianjuta_document_copy (doc
, NULL
);
585 on_editor_command_clear_activate (GtkAction
*action
, gpointer user_data
)
589 widget
= get_current_focus_widget (user_data
);
591 if (widget
&& GTK_IS_EDITABLE (widget
))
594 if (!gtk_editable_get_selection_bounds (GTK_EDITABLE (widget
), &start
, &end
))
596 start
= gtk_editable_get_position (GTK_EDITABLE (widget
));
599 gtk_editable_delete_text (GTK_EDITABLE (widget
), start
, end
);
601 else if (widget
/* editor text is focused */
602 || get_current_popup_active (user_data
))
604 IAnjutaDocument
*doc
;
606 doc
= get_current_document (user_data
);
608 ianjuta_document_clear (doc
, NULL
);
612 /* fold funcs are for scintilla only */
614 on_editor_command_close_folds_all_activate (GtkAction
*action
, gpointer user_data
)
616 IAnjutaDocument
*doc
;
618 doc
= get_current_document (user_data
);
620 ianjuta_editor_folds_close_all (IANJUTA_EDITOR_FOLDS (doc
), NULL
);
624 on_editor_command_open_folds_all_activate (GtkAction
*action
, gpointer user_data
)
626 IAnjutaDocument
*doc
;
628 doc
= get_current_document (user_data
);
630 ianjuta_editor_folds_open_all (IANJUTA_EDITOR_FOLDS (doc
), NULL
);
634 on_editor_command_toggle_fold_activate (GtkAction
*action
, gpointer user_data
)
636 IAnjutaDocument
*doc
;
638 doc
= get_current_document (user_data
);
640 ianjuta_editor_folds_toggle_current (IANJUTA_EDITOR_FOLDS (doc
), NULL
);
644 on_transform_eolchars1_activate (GtkAction
*action
, gpointer user_data
)
646 IAnjutaDocument
*doc
;
648 doc
= get_current_document (user_data
);
650 ianjuta_editor_line_mode_fix (IANJUTA_EDITOR_LINE_MODE (doc
), NULL
);
654 on_prev_history (GtkAction
*action
, gpointer user_data
)
656 AnjutaDocman
*docman
;
657 DocmanPlugin
*plugin
;
658 plugin
= ANJUTA_PLUGIN_DOCMAN (user_data
);
659 docman
= ANJUTA_DOCMAN (plugin
->docman
);
660 an_file_history_back (docman
);
664 on_next_history (GtkAction
*action
, gpointer user_data
)
666 AnjutaDocman
*docman
;
667 DocmanPlugin
*plugin
;
668 plugin
= ANJUTA_PLUGIN_DOCMAN (user_data
);
669 docman
= ANJUTA_DOCMAN (plugin
->docman
);
670 an_file_history_forward (docman
);
674 on_comment_block (GtkAction
*action
, gpointer user_data
)
676 IAnjutaDocument
*doc
;
678 doc
= get_current_document (user_data
);
680 ianjuta_editor_comment_block (IANJUTA_EDITOR_COMMENT (doc
), NULL
);
683 void on_comment_box (GtkAction
*action
, gpointer user_data
)
685 IAnjutaDocument
*doc
;
687 doc
= get_current_document (user_data
);
689 ianjuta_editor_comment_box (IANJUTA_EDITOR_COMMENT (doc
), NULL
);
692 void on_comment_stream (GtkAction
*action
, gpointer user_data
)
694 IAnjutaDocument
*doc
;
696 doc
= get_current_document (user_data
);
698 ianjuta_editor_comment_stream (IANJUTA_EDITOR_COMMENT (doc
), NULL
);
702 on_goto_line_no1_activate (GtkAction
*action
, gpointer user_data
)
704 DocmanPlugin
*plugin
;
706 plugin
= ANJUTA_PLUGIN_DOCMAN (user_data
);
708 gtk_widget_show (plugin
->search_box
);
709 search_box_grab_line_focus (SEARCH_BOX (plugin
->search_box
));
713 on_goto_block_start1_activate (GtkAction
*action
, gpointer user_data
)
715 IAnjutaDocument
*doc
;
717 doc
= get_current_document (user_data
);
719 ianjuta_editor_goto_start_block (IANJUTA_EDITOR_GOTO (doc
), NULL
);
723 on_goto_block_end1_activate (GtkAction
*action
, gpointer user_data
)
725 IAnjutaDocument
*doc
;
727 doc
= get_current_document (user_data
);
729 ianjuta_editor_goto_end_block (IANJUTA_EDITOR_GOTO (doc
), NULL
);
733 on_zoom_in_text_activate (GtkAction
*action
, gpointer user_data
)
735 IAnjutaDocument
*doc
;
737 doc
= get_current_document (user_data
);
739 ianjuta_editor_zoom_in (IANJUTA_EDITOR_ZOOM (doc
), NULL
);
743 on_zoom_out_text_activate (GtkAction
*action
, gpointer user_data
)
745 IAnjutaDocument
*doc
;
747 doc
= get_current_document (user_data
);
749 ianjuta_editor_zoom_out (IANJUTA_EDITOR_ZOOM (doc
), NULL
);
753 on_force_hilite_activate (GtkWidget
*menuitem
, gpointer user_data
)
755 IAnjutaDocument
*doc
;
757 doc
= get_current_document (user_data
);
760 const gchar
*language_code
;
761 language_code
= g_object_get_data (G_OBJECT (menuitem
), "language_code");
762 if (language_code
&& IANJUTA_IS_EDITOR_LANGUAGE (doc
))
763 ianjuta_editor_language_set_language (IANJUTA_EDITOR_LANGUAGE (doc
),
764 language_code
, NULL
);
769 on_show_search (GtkAction
*action
, gpointer user_data
)
771 DocmanPlugin
*plugin
;
772 GtkWidget
*search_box
;
774 plugin
= ANJUTA_PLUGIN_DOCMAN (user_data
);
776 search_box
= plugin
->search_box
;
778 search_box_fill_search_focus (SEARCH_BOX (search_box
), FALSE
);
779 gtk_widget_show (search_box
);
783 on_repeat_quicksearch (GtkAction
*action
, gpointer user_data
)
785 DocmanPlugin
*plugin
;
786 GtkWidget
*search_box
;
788 plugin
= ANJUTA_PLUGIN_DOCMAN (user_data
);
790 search_box
= plugin
->search_box
;
792 gtk_widget_show (search_box
);
793 search_box_incremental_search (SEARCH_BOX (search_box
), TRUE
, TRUE
, TRUE
);
797 on_search_previous (GtkAction
*action
, gpointer user_data
)
799 DocmanPlugin
*plugin
;
800 GtkWidget
*search_box
;
802 plugin
= ANJUTA_PLUGIN_DOCMAN (user_data
);
804 search_box
= plugin
->search_box
;
806 gtk_widget_show (search_box
);
807 search_box_incremental_search (SEARCH_BOX (search_box
), FALSE
, TRUE
, TRUE
);
811 on_search_and_replace (GtkAction
*action
, gpointer user_data
)
813 DocmanPlugin
*plugin
;
814 GtkWidget
*search_box
;
816 plugin
= ANJUTA_PLUGIN_DOCMAN (user_data
);
818 search_box
= plugin
->search_box
;
820 search_box_fill_search_focus (SEARCH_BOX (search_box
), TRUE
);
821 gtk_widget_show (search_box
);
825 on_search_popup_case_sensitive_toggle (GtkAction
*action
, gpointer user_data
)
827 DocmanPlugin
*plugin
;
828 GtkWidget
*search_box
;
830 gboolean case_sensitive_status
=
831 gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action
));
832 plugin
= ANJUTA_PLUGIN_DOCMAN (user_data
);
834 search_box
= plugin
->search_box
;
836 gtk_widget_show (search_box
);
837 search_box_toggle_case_sensitive (SEARCH_BOX (search_box
), case_sensitive_status
);
841 on_search_popup_highlight_toggle (GtkAction
*action
, gpointer user_data
)
843 DocmanPlugin
*plugin
;
844 GtkWidget
*search_box
;
846 gboolean highlight_status
= gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action
));
847 plugin
= ANJUTA_PLUGIN_DOCMAN (user_data
);
849 search_box
= plugin
->search_box
;
851 gtk_widget_show (search_box
);
852 search_box_toggle_highlight (SEARCH_BOX (search_box
), highlight_status
);
856 on_search_popup_clear_highlight (GtkAction
*action
, gpointer user_data
)
858 DocmanPlugin
*plugin
;
859 GtkWidget
*search_box
;
861 plugin
= ANJUTA_PLUGIN_DOCMAN (user_data
);
863 search_box
= plugin
->search_box
;
865 gtk_widget_show (search_box
);
866 search_box_clear_highlight (SEARCH_BOX (search_box
));
870 on_search_popup_regex_search (GtkAction
*action
, gpointer user_data
)
872 DocmanPlugin
*plugin
;
873 GtkWidget
*search_box
;
875 gboolean regex_active
= gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action
));
876 plugin
= ANJUTA_PLUGIN_DOCMAN (user_data
);
878 search_box
= plugin
->search_box
;
880 gtk_widget_show (search_box
);
881 search_box_toggle_regex (SEARCH_BOX (search_box
), regex_active
);
885 on_search_find_in_files (GtkAction
*action
, gpointer user_data
)
887 DocmanPlugin
*plugin
;
888 plugin
= ANJUTA_PLUGIN_DOCMAN (user_data
);
890 if (!plugin
->search_files
)
892 plugin
->search_files
= G_OBJECT (search_files_new (ANJUTA_DOCMAN (plugin
->docman
),
893 SEARCH_BOX(plugin
->search_box
)));
895 search_files_present (SEARCH_FILES(plugin
->search_files
));
899 on_editor_add_view_activate (GtkAction
*action
, gpointer user_data
)
901 IAnjutaDocument
*doc
;
902 doc
= get_current_document (user_data
);
904 ianjuta_editor_view_create (IANJUTA_EDITOR_VIEW (doc
), NULL
);
908 on_editor_remove_view_activate (GtkAction
*action
, gpointer user_data
)
910 IAnjutaDocument
*doc
;
911 doc
= get_current_document (user_data
);
913 ianjuta_editor_view_remove_current (IANJUTA_EDITOR_VIEW (doc
), NULL
);
917 on_next_document (GtkAction
*action
, gpointer user_data
)
919 AnjutaDocman
*docman
;
920 DocmanPlugin
*plugin
;
921 plugin
= ANJUTA_PLUGIN_DOCMAN (user_data
);
922 docman
= ANJUTA_DOCMAN (plugin
->docman
);
924 anjuta_docman_next_page (docman
);
928 on_previous_document (GtkAction
*action
, gpointer user_data
)
930 AnjutaDocman
*docman
;
931 DocmanPlugin
*plugin
;
932 plugin
= ANJUTA_PLUGIN_DOCMAN (user_data
);
933 docman
= ANJUTA_DOCMAN (plugin
->docman
);
935 anjuta_docman_previous_page (docman
);
939 on_bookmark_toggle_activate (GtkAction
*action
, gpointer user_data
)
941 IAnjutaDocument
*doc
;
942 DocmanPlugin
*plugin
;
943 doc
= get_current_document (user_data
);
944 plugin
= ANJUTA_PLUGIN_DOCMAN (user_data
);
945 if (doc
&& IANJUTA_IS_EDITOR(doc
))
947 IAnjutaEditor
* editor
= IANJUTA_EDITOR(doc
);
948 anjuta_bookmarks_toggle (ANJUTA_BOOKMARKS (plugin
->bookmarks
), editor
,
949 ianjuta_editor_get_lineno (editor
, NULL
));
954 on_bookmark_next_activate (GtkAction
*action
, gpointer user_data
)
956 IAnjutaDocument
*doc
;
957 DocmanPlugin
*plugin
;
958 doc
= get_current_document (user_data
);
959 plugin
= ANJUTA_PLUGIN_DOCMAN (user_data
);
960 if (doc
&& IANJUTA_IS_EDITOR(doc
))
962 IAnjutaEditor
* editor
= IANJUTA_EDITOR(doc
);
963 anjuta_bookmarks_next (ANJUTA_BOOKMARKS (plugin
->bookmarks
), editor
,
964 ianjuta_editor_get_lineno (editor
, NULL
));
969 on_bookmark_prev_activate (GtkAction
*action
, gpointer user_data
)
971 IAnjutaDocument
*doc
;
972 DocmanPlugin
*plugin
;
973 doc
= get_current_document (user_data
);
974 plugin
= ANJUTA_PLUGIN_DOCMAN (user_data
);
975 if (doc
&& IANJUTA_IS_EDITOR(doc
))
977 IAnjutaEditor
* editor
= IANJUTA_EDITOR(doc
);
978 anjuta_bookmarks_prev (ANJUTA_BOOKMARKS (plugin
->bookmarks
), editor
,
979 ianjuta_editor_get_lineno (editor
, NULL
));
984 on_bookmarks_clear_activate (GtkAction
*action
, gpointer user_data
)
986 DocmanPlugin
*plugin
;
987 plugin
= ANJUTA_PLUGIN_DOCMAN (user_data
);
988 anjuta_bookmarks_clear (ANJUTA_BOOKMARKS(plugin
->bookmarks
));
992 on_autocomplete_activate (GtkAction
*action
, gpointer user_data
)
994 IAnjutaDocument
*doc
;
995 doc
= get_current_document (user_data
);
996 if (doc
&& IANJUTA_IS_EDITOR_ASSIST(doc
))
998 IAnjutaEditorAssist
* assist
= IANJUTA_EDITOR_ASSIST (doc
);
999 ianjuta_editor_assist_invoke (assist
, NULL
, NULL
);