1 /*
2  * xed-ui.h
3  * This file is part of xed
4  *
5  * Copyright (C) 2005 - Paolo Maggi
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor,
20  * Boston, MA 02110-1301, USA.
21  */
22 
23 /*
24  * Modified by the xed Team, 2005. See the AUTHORS file for a
25  * list of people on the xed Team.
26  * See the ChangeLog files for a list of changes.
27  *
28  * $Id$
29  */
30 
31 #ifndef __XED_UI_H__
32 #define __XED_UI_H__
33 
34 #include <config.h>
35 #include <gtk/gtk.h>
36 
37 #include "xed-commands.h"
38 
39 G_BEGIN_DECLS
40 
41 static const GtkActionEntry xed_always_sensitive_menu_entries[] =
42 {
43 	/* Toplevel */
44 	{ "File", NULL, N_("_File") },
45 	{ "Edit", NULL, N_("_Edit") },
46 	{ "View", NULL, N_("_View") },
47 	{ "Search", NULL, N_("_Search") },
48 	{ "Tools", NULL, N_("_Tools") },
49 	{ "Documents", NULL, N_("_Documents") },
50 	{ "Help", NULL, N_("_Help") },
51     { "XAppFavoritesMenu", NULL, N_("Favorites")},
52     { "FileRecentsMenu", NULL, N_("Recents")},
53 
54 	/* File menu */
55 	{ "FileNew", "document-new-symbolic", N_("_New"), "<control>N",
56 	  N_("Create a new document"), G_CALLBACK (_xed_cmd_file_new) },
57 	{ "FileOpen", "document-open-symbolic", N_("_Open..."), "<control>O",
58 	  N_("Open a file"), G_CALLBACK (_xed_cmd_file_open) },
59 
60 	/* Edit menu */
61 	{ "EditPreferences", "preferences-other-symbolic", N_("Pr_eferences"), NULL,
62 	  N_("Configure the application"), G_CALLBACK (_xed_cmd_edit_preferences) },
63 
64 	/* Help menu */
65 	{"HelpContents", "help-contents-symbolic", N_("_Contents"), "F1",
66 	 N_("Open the xed manual"), G_CALLBACK (_xed_cmd_help_contents) },
67 	{ "HelpAbout", "help-about-symbolic", N_("_About"), NULL,
68 	 N_("About this application"), G_CALLBACK (_xed_cmd_help_about) },
69     { "HelpShortcuts", "preferences-desktop-keyboard-shortcuts-symbolic", N_("_Keyboard Shortcuts"), NULL,
70      N_("Show the keyboard shortcuts dialog"), G_CALLBACK (_xed_cmd_help_keyboard_shortcuts) },
71 
72 	/* Fullscreen toolbar */
73 	{ "LeaveFullscreen", "view-restore-symbolic", NULL,
74 	  NULL, N_("Leave fullscreen mode"),
75 	  G_CALLBACK (_xed_cmd_view_leave_fullscreen_mode) }
76 };
77 
78 static const GtkActionEntry xed_menu_entries[] =
79 {
80 	/* File menu */
81 	{ "FileSave", "document-save-symbolic", N_("_Save"), "<control>S",
82 	  N_("Save the current file"), G_CALLBACK (_xed_cmd_file_save) },
83 	{ "FileSaveAs", "document-save-as-symbolic", N_("Save _As..."), "<shift><control>S",
84 	  N_("Save the current file with a different name"), G_CALLBACK (_xed_cmd_file_save_as) },
85 	{ "FileRevert", "document-revert-symbolic", N_("Revert"), NULL,
86 	  N_("Revert to a saved version of the file"), G_CALLBACK (_xed_cmd_file_revert) },
87 	{ "FilePrintPreview", "document-print-preview-symbolic", N_("Print Previe_w"),"<control><shift>P",
88 	  N_("Print preview"), G_CALLBACK (_xed_cmd_file_print_preview) },
89 	 { "FilePrint", "document-print-symbolic", N_("_Print..."), "<control>P",
90 	  N_("Print the current page"), G_CALLBACK (_xed_cmd_file_print) },
91 
92 	/* Edit menu */
93 	{ "EditUndo", "edit-undo-symbolic", N_("_Undo"), "<control>Z",
94 	  N_("Undo the last action"), G_CALLBACK (_xed_cmd_edit_undo) },
95 	{ "EditRedo", "edit-redo-symbolic", N_("_Redo"), "<control>Y",
96 	  N_("Redo the last undone action"), G_CALLBACK (_xed_cmd_edit_redo) },
97 	{ "EditCut", "edit-cut-symbolic", N_("C_ut"), "<control>X",
98 	  N_("Cut the selection"), G_CALLBACK (_xed_cmd_edit_cut) },
99 	{ "EditCopy", "edit-copy-symbolic", N_("_Copy"), "<control>C",
100 	  N_("Copy the selection"), G_CALLBACK (_xed_cmd_edit_copy) },
101 	{ "EditPaste", "edit-paste-symbolic", N_("_Paste"), "<control>V",
102 	  N_("Paste the clipboard"), G_CALLBACK (_xed_cmd_edit_paste) },
103 	{ "EditDelete", "edit-delete-symbolic", N_("_Delete"), NULL,
104 	  N_("Delete the selected text"), G_CALLBACK (_xed_cmd_edit_delete) },
105 	{ "EditSelectAll", "edit-select-all-symbolic", N_("Select _All"), "<control>A",
106 	  N_("Select the entire document"), G_CALLBACK (_xed_cmd_edit_select_all) },
107     { "EditToggleComment", NULL, N_("_Toggle Comment"), "<control>slash",
108       N_("Comment"), G_CALLBACK (_xed_cmd_edit_toggle_comment) },
109     { "EditToggleCommentBlock", NULL, N_("Toggle Comment _Block"), "<shift><control>question",
110       N_("Comment Block"), G_CALLBACK (_xed_cmd_edit_toggle_comment_block) },
111 
112 	/* View menu */
113 	{ "ViewHighlightMode", NULL, N_("_Highlight Mode"), "<shift><control>H",
114 	  N_("Change syntax hightlight mode"),
115 	  G_CALLBACK (_xed_cmd_view_change_highlight_mode) },
116 
117 	/* Search menu */
118 	{ "SearchFind", "edit-find-symbolic", N_("_Find"), "<control>F",
119 	  N_("Search for text"), G_CALLBACK (_xed_cmd_search_find) },
120 	{ "SearchFindNext", NULL, N_("Find Ne_xt"), "<control>G",
121 	  N_("Search forwards for the same text"), G_CALLBACK (_xed_cmd_search_find_next) },
122 	{ "SearchFindPrevious", NULL, N_("Find Pre_vious"), "<shift><control>G",
123 	  N_("Search backwards for the same text"), G_CALLBACK (_xed_cmd_search_find_prev) },
124 	{ "SearchReplace", "edit-find-replace-symbolic", N_("_Replace"), "<control>H",
125 	  N_("Search for and replace text"), G_CALLBACK (_xed_cmd_search_replace) },
126 	{ "SearchGoToLine", "go-jump-symbolic", N_("Go to _Line..."), "<control>I",
127 	  N_("Go to a specific line"), G_CALLBACK (_xed_cmd_search_goto_line) },
128 
129 	/* Documents menu */
130 	{ "FileSaveAll", "document-save-symbolic", N_("_Save All"), "<shift><control>L",
131 	  N_("Save all open files"), G_CALLBACK (_xed_cmd_file_save_all) },
132 	{ "FileCloseAll", "window-close-symbolic", N_("_Close All"), "<shift><control>W",
133 	  N_("Close all open files"), G_CALLBACK (_xed_cmd_file_close_all) },
134 	{ "DocumentsPreviousDocument", NULL, N_("_Previous Document"), "<alt><control>Page_Up",
135 	  N_("Activate previous document"), G_CALLBACK (_xed_cmd_documents_previous_document) },
136 	{ "DocumentsNextDocument", NULL, N_("_Next Document"), "<alt><control>Page_Down",
137 	  N_("Activate next document"), G_CALLBACK (_xed_cmd_documents_next_document) },
138 	{ "DocumentsMoveToNewWindow", NULL, N_("_Move to New Window"), NULL,
139 	  N_("Move the current document to a new window"), G_CALLBACK (_xed_cmd_documents_move_to_new_window) }
140 };
141 
142 /* separate group, needs to be sensitive on OS X even when there are no tabs */
143 static const GtkActionEntry xed_close_menu_entries[] =
144 {
145 	{ "FileClose", "window-close-symbolic", N_("_Close"), "<control>W",
146 	  N_("Close the current file"), G_CALLBACK (_xed_cmd_file_close) }
147 };
148 
149 /* separate group, should be sensitive even when there are no tabs */
150 static const GtkActionEntry xed_quit_menu_entries[] =
151 {
152 	{ "FileQuit", "application-exit-symbolic", N_("_Quit"), "<control>Q",
153 	  N_("Quit the program"), G_CALLBACK (_xed_cmd_file_quit) }
154 };
155 
156 static const GtkToggleActionEntry xed_always_sensitive_toggle_menu_entries[] =
157 {
158 	{ "ViewToolbar", NULL, N_("_Toolbar"), NULL,
159 	  N_("Show or hide the toolbar in the current window"),
160 	  G_CALLBACK (_xed_cmd_view_show_toolbar), TRUE },
161 	{ "ViewMenubar", NULL, N_("_Menubar"), NULL,
162 	  N_("Show or hide the menubar in the current window"),
163 	  G_CALLBACK (_xed_cmd_view_show_menubar), TRUE },
164 	{ "ViewStatusbar", NULL, N_("_Statusbar"), NULL,
165 	  N_("Show or hide the statusbar in the current window"),
166 	  G_CALLBACK (_xed_cmd_view_show_statusbar), TRUE },
167 	{ "ViewFullscreen", "view-fullscreen", N_("Fullscreen"), "F11",
168 	  N_("Edit text in fullscreen"),
169 	  G_CALLBACK (_xed_cmd_view_toggle_fullscreen_mode), FALSE },
170     { "ViewWordWrap", NULL, N_("_Word wrap"), "<control>R",
171       N_("Set word wrap for the current document"),
172       G_CALLBACK (_xed_cmd_view_toggle_word_wrap), FALSE },
173     { "ViewOverviewMap", NULL, N_("_Overview Map"), NULL,
174       N_("Show or hide the overview map for the current view"),
175       G_CALLBACK (_xed_cmd_view_toggle_overview_map), FALSE }
176 };
177 
178 /* separate group, should be always sensitive except when there are no panes */
179 static const GtkToggleActionEntry xed_panes_toggle_menu_entries[] =
180 {
181 	{ "ViewSidePane", NULL, N_("Side _Pane"), "F9",
182 	  N_("Show or hide the side pane in the current window"),
183 	  G_CALLBACK (_xed_cmd_view_show_side_pane), FALSE },
184 	{ "ViewBottomPane", NULL, N_("_Bottom Pane"), "<control>F9",
185 	  N_("Show or hide the bottom pane in the current window"),
186 	  G_CALLBACK (_xed_cmd_view_show_bottom_pane), FALSE }
187 };
188 
189 G_END_DECLS
190 
191 #endif  /* __XED_UI_H__  */
192