11
* This program is free software; you can redistribute it and/or modify
11
* This program is free software: you can redistribute it and/or modify
12
12
* it under the terms of the GNU General Public License as published by
13
* the Free Software Foundation; either version 2 of the License, or
13
* the Free Software Foundation; either version 3 of the License, or
14
14
* (at your option) any later version.
16
16
* This program is distributed in the hope that it will be useful,
19
19
* GNU General Public License for more details.
21
21
* You should have received a copy of the GNU General Public License
22
* along with this program; if not, write to the Free Software
23
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22
* along with this program. If not, see <http://www.gnu.org/licenses/>.
26
25
#include "config.h"
195
193
window_set_icons (window);
197
vbox = gtk_vbox_new (FALSE, 2);
195
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 2);
198
196
gtk_container_add (GTK_CONTAINER (window), vbox);
199
197
gtk_widget_show (vbox);
212
210
action = gtk_ui_manager_get_action (ui_manager,
213
211
"/ui/help-browser-popup/forward");
214
gtk_action_connect_proxy (action, GTK_WIDGET (item));
212
gtk_activatable_set_related_action (GTK_ACTIVATABLE (item), action);
215
213
g_object_notify (G_OBJECT (action), "tooltip");
216
214
button_next = GTK_WIDGET (item);
222
220
action = gtk_ui_manager_get_action (ui_manager,
223
221
"/ui/help-browser-popup/back");
224
gtk_action_connect_proxy (action, GTK_WIDGET (item));
222
gtk_activatable_set_related_action (GTK_ACTIVATABLE (item), action);
225
223
g_object_notify (G_OBJECT (action), "tooltip");
226
224
button_prev = GTK_WIDGET (item);
231
229
gtk_separator_tool_item_set_draw (GTK_SEPARATOR_TOOL_ITEM (item), FALSE);
232
230
gtk_tool_item_set_expand (item, TRUE);
234
button = gtk_ui_manager_get_widget (ui_manager,
235
"/help-browser-toolbar/website");
237
232
/* the horizontal paned */
238
paned = gtk_hpaned_new ();
233
paned = gtk_paned_new (GTK_ORIENTATION_HORIZONTAL);
239
234
gtk_box_pack_start (GTK_BOX (vbox), paned, TRUE, TRUE, 0);
240
235
gtk_widget_show (paned);
269
main_vbox = gtk_vbox_new (FALSE, 0);
264
main_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
270
265
gtk_widget_show (main_vbox);
271
266
gtk_paned_pack2 (GTK_PANED (paned), main_vbox, TRUE, TRUE);
356
351
sizes[i], NULL));
358
353
gtk_window_set_icon_list (GTK_WINDOW (window), list);
359
g_list_foreach (list, (GFunc) g_object_unref, NULL);
355
g_list_free_full (list, (GDestroyNotify) g_object_unref);
365
360
GimpHelpItem *item,
366
361
GimpHelpLocale *locale)
363
gchar *sort_key = item->title;
365
#if DEBUG_SORT_HELP_ITEMS
369
366
g_printerr ("%s: processing %s (parent %s)\n",
371
368
item->title ? item->title : "NULL",
372
369
item->parent ? item->parent : "NULL");
377
gchar **indices = g_strsplit (item->title, ".", -1);
373
g_regex_match_simple ("^[0-9]+([.][0-9]+)*$", item->sort, 0, 0))
375
sort_key = item->sort;
377
#if DEBUG_SORT_HELP_ITEMS
378
g_printerr ("%s: sort key = %s\n", G_STRFUNC, sort_key);
386
const gint max_tokens = GIMP_HELP_BROWSER_INDEX_MAX_DEPTH;
387
gchar* *indices = g_strsplit (sort_key, ".", max_tokens + 1);
380
for (i = 0; i < 5; i++)
390
for (i = 0; i < max_tokens; i++)
384
394
if (! indices[i])
396
/* make sure that all item->index's are comparable */
397
item->index <<= (8 * (max_tokens - i));
401
item->index <<= 8; /* NOP if i = 0 */
387
402
c = g_utf8_get_char (indices[i]);
389
403
if (g_unichar_isdigit (c))
391
item->index += atoi (indices[i]) << (8 * (5 - i));
405
item->index += atoi (indices[i]);
393
407
else if (g_utf8_strlen (indices[i], -1) == 1)
395
item->index += (c & 0xFF) << (8 * (5 - i));
409
item->index += (c & 0xFF);
399
413
g_strfreev (indices);
415
#if DEBUG_SORT_HELP_ITEMS
416
g_printerr ("%s: index = %lu\n", G_STRFUNC, item->index);
402
420
if (item->parent && strlen (item->parent))
839
857
show_index_callback (GtkAction *action,
842
if (gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)))
844
gtk_widget_show (sidebar);
848
gtk_widget_hide (sidebar);
860
gtk_widget_set_visible (sidebar,
861
gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)));
985
997
action = gtk_ui_manager_get_action (ui_manager,
986
998
"/ui/help-browser-popup/show-index");
987
999
gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action),
988
GTK_WIDGET_VISIBLE (sidebar));
1000
gtk_widget_get_visible (sidebar));
1028
1040
gtk_window_get_size (GTK_WINDOW (window), &data.width, &data.height);
1030
1042
data.paned_position = gtk_paned_get_position (GTK_PANED (paned));
1031
data.show_index = GTK_WIDGET_VISIBLE (sidebar);
1043
data.show_index = gtk_widget_get_visible (sidebar);
1033
1045
data.zoom = (view ?
1034
1046
webkit_web_view_get_zoom_level (WEBKIT_WEB_VIEW (view)) : 1.0);
1084
1096
view_button_press (GtkWidget *widget,
1085
1097
GdkEventButton *event)
1087
if (event->button == 3 && event->type == GDK_BUTTON_PRESS)
1099
if (gdk_event_triggers_context_menu ((GdkEvent *) event))
1088
1100
return view_popup_menu (widget, event);