annotate src/menu.cc @ 2149:9d1ff8be799c tip

disable 'Found font:' messages
author Johannes Hofmann <Johannes.Hofmann@gmx.de>
date Sun, 24 Jul 2011 22:17:57 +0200
parents a4188b1ca1b2
children
rev   line source
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
1 /*
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
2 * File: menu.cc
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
3 *
35
d9e7b35430de Updated copyright lines
jcid
parents: 26
diff changeset
4 * Copyright (C) 2005-2007 Jorge Arellano Cid <jcid@dillo.org>
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
5 *
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
6 * This program is free software; you can redistribute it and/or modify
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
7 * it under the terms of the GNU General Public License as published by
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
8 * the Free Software Foundation; either version 3 of the License, or
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
9 * (at your option) any later version.
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
10 */
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
11
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
12 // Functions/Methods for menus
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
13
1821
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
14 #include <FL/Fl.H>
1812
7088695ed035 trivial bits of menu
corvid <corvid@lavabit.com>
parents: 1806
diff changeset
15 #include <FL/Fl_Menu_Item.H>
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
16
958
1a26b2bd7138 [mq]: view-stylesheets
Jorge Arellano Cid <jcid@dillo.org>
parents: 930
diff changeset
17 #include "lout/misc.hh" /* SimpleVector */
22
571f09e42ab6 - Hooked "Activate" to the form_receiver.
jcid
parents: 11
diff changeset
18 #include "msg.h"
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
19 #include "menu.hh"
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
20 #include "uicmd.hh"
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
21 #include "history.h"
48
224c9f547b39 Implemented "Load Images" in the page menu and cleaned up html.hh.
jcid
parents: 35
diff changeset
22 #include "html.hh"
224
07d1e0d8463c - Replaced the findtext dialog with an in-window widget!
jcid
parents: 161
diff changeset
23 #include "ui.hh" // for (UI *)
1157
d4955772f3e0 Get key bindings for File menu
corvid <corvid@lavabit.com>
parents: 1109
diff changeset
24 #include "keys.hh"
356
81338758c3dd - Added a workaround for segfaulting popup menus.
jcid
parents: 353
diff changeset
25 #include "timeout.hh"
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
26
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
27 /*
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
28 * Local data
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
29 */
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
30
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
31 // (This data can be encapsulated inside a class for each popup, but
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
32 // as popups are modal, there's no need).
356
81338758c3dd - Added a workaround for segfaulting popup menus.
jcid
parents: 353
diff changeset
33 static DilloUrl *popup_url = NULL;
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
34 // Weak reference to the popup's bw
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
35 static BrowserWindow *popup_bw = NULL;
1821
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
36 static void *popup_form = NULL;
1974
2cfe42568366 comment
corvid <corvid@lavabit.com>
parents: 1957
diff changeset
37 // Where to place the popup
479
cd066a3f0405 Added some const quialifiers.
corvid <corvid@lavabit.com>
parents: 477
diff changeset
38 static int popup_x, popup_y;
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
39 // History popup direction (-1 = back, 1 = forward).
930
b277eed3119c whitespace cleanup: 's/ +$//g'
Jorge Arellano Cid <jcid@dillo.org>
parents: 926
diff changeset
40 static int history_direction = -1;
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
41 // History popup, list of URL-indexes.
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
42 static int *history_list = NULL;
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
43
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
44
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
45 //--------------------------------------------------------------------------
2068
e6a6cf3aab0f Switched menu item callbacks to Fl_Menu_Item (instead of Fl_Widget)
Jorge Arellano Cid <jcid@dillo.org>
parents: 2048
diff changeset
46 static void Menu_nop_cb(Fl_Widget*, void*)
2048
5060d415a85a clickable menu items (even those introducing submenus) MUST have callbacks
corvid <corvid@lavabit.com>
parents: 2024
diff changeset
47 {
5060d415a85a clickable menu items (even those introducing submenus) MUST have callbacks
corvid <corvid@lavabit.com>
parents: 2024
diff changeset
48 }
5060d415a85a clickable menu items (even those introducing submenus) MUST have callbacks
corvid <corvid@lavabit.com>
parents: 2024
diff changeset
49
400
31b866fdde87 - File menu as popup implementation.
jcid
parents: 356
diff changeset
50 /*
31b866fdde87 - File menu as popup implementation.
jcid
parents: 356
diff changeset
51 * Static function for File menu callbacks.
31b866fdde87 - File menu as popup implementation.
jcid
parents: 356
diff changeset
52 */
2068
e6a6cf3aab0f Switched menu item callbacks to Fl_Menu_Item (instead of Fl_Widget)
Jorge Arellano Cid <jcid@dillo.org>
parents: 2048
diff changeset
53 static void filemenu_cb(Fl_Widget*, void *data)
400
31b866fdde87 - File menu as popup implementation.
jcid
parents: 356
diff changeset
54 {
31b866fdde87 - File menu as popup implementation.
jcid
parents: 356
diff changeset
55 if (strcmp((char*)data, "nw") == 0) {
1957
2ac2b0e6aced Fixed button sensitivity when starting with an empty page
Jorge Arellano Cid <jcid@dillo.org>
parents: 1948
diff changeset
56 a_UIcmd_open_url_nw(popup_bw, NULL);
400
31b866fdde87 - File menu as popup implementation.
jcid
parents: 356
diff changeset
57 } else if (strcmp((char*)data, "nt") == 0) {
31b866fdde87 - File menu as popup implementation.
jcid
parents: 356
diff changeset
58 a_UIcmd_open_url_nt(popup_bw, NULL, 1);
31b866fdde87 - File menu as popup implementation.
jcid
parents: 356
diff changeset
59 } else if (strcmp((char*)data, "of") == 0) {
31b866fdde87 - File menu as popup implementation.
jcid
parents: 356
diff changeset
60 a_UIcmd_open_file(popup_bw);
31b866fdde87 - File menu as popup implementation.
jcid
parents: 356
diff changeset
61 } else if (strcmp((char*)data, "ou") == 0) {
31b866fdde87 - File menu as popup implementation.
jcid
parents: 356
diff changeset
62 a_UIcmd_focus_location(popup_bw);
31b866fdde87 - File menu as popup implementation.
jcid
parents: 356
diff changeset
63 } else if (strcmp((char*)data, "cw") == 0) {
31b866fdde87 - File menu as popup implementation.
jcid
parents: 356
diff changeset
64 a_Timeout_add(0.0, a_UIcmd_close_bw, popup_bw);
31b866fdde87 - File menu as popup implementation.
jcid
parents: 356
diff changeset
65 } else if (strcmp((char*)data, "ed") == 0) {
31b866fdde87 - File menu as popup implementation.
jcid
parents: 356
diff changeset
66 a_Timeout_add(0.0, a_UIcmd_close_all_bw, NULL);
31b866fdde87 - File menu as popup implementation.
jcid
parents: 356
diff changeset
67 }
31b866fdde87 - File menu as popup implementation.
jcid
parents: 356
diff changeset
68 }
31b866fdde87 - File menu as popup implementation.
jcid
parents: 356
diff changeset
69
31b866fdde87 - File menu as popup implementation.
jcid
parents: 356
diff changeset
70
1821
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
71 static void Menu_copy_urlstr_cb(Fl_Widget*, void*)
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
72 {
55
a1f38544fab6 copy image/link location
jcid
parents: 48
diff changeset
73 if (popup_url)
a1f38544fab6 copy image/link location
jcid
parents: 48
diff changeset
74 a_UIcmd_copy_urlstr(popup_bw, URL_STR(popup_url));
22
571f09e42ab6 - Hooked "Activate" to the form_receiver.
jcid
parents: 11
diff changeset
75 }
571f09e42ab6 - Hooked "Activate" to the form_receiver.
jcid
parents: 11
diff changeset
76
1812
7088695ed035 trivial bits of menu
corvid <corvid@lavabit.com>
parents: 1806
diff changeset
77 static void Menu_link_cb(Fl_Widget*, void *user_data)
22
571f09e42ab6 - Hooked "Activate" to the form_receiver.
jcid
parents: 11
diff changeset
78 {
571f09e42ab6 - Hooked "Activate" to the form_receiver.
jcid
parents: 11
diff changeset
79 DilloUrl *url = (DilloUrl *) user_data ;
1060
b455cecaac6c _MSG out some MSGs
corvid <corvid@lavalbit.com>
parents: 958
diff changeset
80 _MSG("Menu_link_cb: click! :-)\n");
22
571f09e42ab6 - Hooked "Activate" to the form_receiver.
jcid
parents: 11
diff changeset
81
571f09e42ab6 - Hooked "Activate" to the form_receiver.
jcid
parents: 11
diff changeset
82 if (url)
571f09e42ab6 - Hooked "Activate" to the form_receiver.
jcid
parents: 11
diff changeset
83 a_Menu_link_popup(popup_bw, url);
571f09e42ab6 - Hooked "Activate" to the form_receiver.
jcid
parents: 11
diff changeset
84 }
571f09e42ab6 - Hooked "Activate" to the form_receiver.
jcid
parents: 11
diff changeset
85
930
b277eed3119c whitespace cleanup: 's/ +$//g'
Jorge Arellano Cid <jcid@dillo.org>
parents: 926
diff changeset
86 /*
22
571f09e42ab6 - Hooked "Activate" to the form_receiver.
jcid
parents: 11
diff changeset
87 * Open URL
571f09e42ab6 - Hooked "Activate" to the form_receiver.
jcid
parents: 11
diff changeset
88 */
2068
e6a6cf3aab0f Switched menu item callbacks to Fl_Menu_Item (instead of Fl_Widget)
Jorge Arellano Cid <jcid@dillo.org>
parents: 2048
diff changeset
89 static void Menu_open_url_cb(Fl_Widget*, void*)
22
571f09e42ab6 - Hooked "Activate" to the form_receiver.
jcid
parents: 11
diff changeset
90 {
1060
b455cecaac6c _MSG out some MSGs
corvid <corvid@lavalbit.com>
parents: 958
diff changeset
91 _MSG("Open URL cb: click! :-)\n");
22
571f09e42ab6 - Hooked "Activate" to the form_receiver.
jcid
parents: 11
diff changeset
92 a_UIcmd_open_url(popup_bw, popup_url);
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
93 }
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
94
930
b277eed3119c whitespace cleanup: 's/ +$//g'
Jorge Arellano Cid <jcid@dillo.org>
parents: 926
diff changeset
95 /*
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
96 * Open URL in new window
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
97 */
2068
e6a6cf3aab0f Switched menu item callbacks to Fl_Menu_Item (instead of Fl_Widget)
Jorge Arellano Cid <jcid@dillo.org>
parents: 2048
diff changeset
98 static void Menu_open_url_nw_cb(Fl_Widget*, void*)
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
99 {
350
118fe0444e08 - Added the "middle_click_opens_new_tab" option to dillo2rc.
jcid
parents: 341
diff changeset
100 _MSG("Open URL in new window cb: click! :-)\n");
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
101 a_UIcmd_open_url_nw(popup_bw, popup_url);
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
102 }
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
103
930
b277eed3119c whitespace cleanup: 's/ +$//g'
Jorge Arellano Cid <jcid@dillo.org>
parents: 926
diff changeset
104 /*
350
118fe0444e08 - Added the "middle_click_opens_new_tab" option to dillo2rc.
jcid
parents: 341
diff changeset
105 * Open URL in new Tab
118fe0444e08 - Added the "middle_click_opens_new_tab" option to dillo2rc.
jcid
parents: 341
diff changeset
106 */
2068
e6a6cf3aab0f Switched menu item callbacks to Fl_Menu_Item (instead of Fl_Widget)
Jorge Arellano Cid <jcid@dillo.org>
parents: 2048
diff changeset
107 static void Menu_open_url_nt_cb(Fl_Widget*, void*)
350
118fe0444e08 - Added the "middle_click_opens_new_tab" option to dillo2rc.
jcid
parents: 341
diff changeset
108 {
118fe0444e08 - Added the "middle_click_opens_new_tab" option to dillo2rc.
jcid
parents: 341
diff changeset
109 int focus = prefs.focus_new_tab ? 1 : 0;
1791
corvid <corvid@lavabit.com>
parents: 1790
diff changeset
110 if (Fl::event_state(FL_SHIFT)) focus = !focus;
350
118fe0444e08 - Added the "middle_click_opens_new_tab" option to dillo2rc.
jcid
parents: 341
diff changeset
111 a_UIcmd_open_url_nt(popup_bw, popup_url, focus);
118fe0444e08 - Added the "middle_click_opens_new_tab" option to dillo2rc.
jcid
parents: 341
diff changeset
112 }
118fe0444e08 - Added the "middle_click_opens_new_tab" option to dillo2rc.
jcid
parents: 341
diff changeset
113
930
b277eed3119c whitespace cleanup: 's/ +$//g'
Jorge Arellano Cid <jcid@dillo.org>
parents: 926
diff changeset
114 /*
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
115 * Add bookmark
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
116 */
2068
e6a6cf3aab0f Switched menu item callbacks to Fl_Menu_Item (instead of Fl_Widget)
Jorge Arellano Cid <jcid@dillo.org>
parents: 2048
diff changeset
117 static void Menu_add_bookmark_cb(Fl_Widget*, void*)
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
118 {
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
119 a_UIcmd_add_bookmark(popup_bw, popup_url);
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
120 }
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
121
930
b277eed3119c whitespace cleanup: 's/ +$//g'
Jorge Arellano Cid <jcid@dillo.org>
parents: 926
diff changeset
122 /*
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
123 * Find text
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
124 */
2068
e6a6cf3aab0f Switched menu item callbacks to Fl_Menu_Item (instead of Fl_Widget)
Jorge Arellano Cid <jcid@dillo.org>
parents: 2048
diff changeset
125 static void Menu_find_text_cb(Fl_Widget*, void*)
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
126 {
1948
caf71cd30ec8 Made the findbar operative again (it has tricks and workarounds)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1877
diff changeset
127 ((UI *)popup_bw->ui)->findbar_toggle(1);
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
128 }
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
129
930
b277eed3119c whitespace cleanup: 's/ +$//g'
Jorge Arellano Cid <jcid@dillo.org>
parents: 926
diff changeset
130 /*
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
131 * Save link
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
132 */
2068
e6a6cf3aab0f Switched menu item callbacks to Fl_Menu_Item (instead of Fl_Widget)
Jorge Arellano Cid <jcid@dillo.org>
parents: 2048
diff changeset
133 static void Menu_save_link_cb(Fl_Widget*, void*)
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
134 {
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
135 a_UIcmd_save_link(popup_bw, popup_url);
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
136 }
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
137
930
b277eed3119c whitespace cleanup: 's/ +$//g'
Jorge Arellano Cid <jcid@dillo.org>
parents: 926
diff changeset
138 /*
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
139 * Save current page
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
140 */
2068
e6a6cf3aab0f Switched menu item callbacks to Fl_Menu_Item (instead of Fl_Widget)
Jorge Arellano Cid <jcid@dillo.org>
parents: 2048
diff changeset
141 static void Menu_save_page_cb(Fl_Widget*, void*)
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
142 {
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
143 a_UIcmd_save(popup_bw);
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
144 }
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
145
930
b277eed3119c whitespace cleanup: 's/ +$//g'
Jorge Arellano Cid <jcid@dillo.org>
parents: 926
diff changeset
146 /*
467
c029ea389ba7 Cleanup in Menu_load_images_cb()
Jorge Arellano Cid <jcid@dillo.org>
parents: 431
diff changeset
147 * View current page source
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
148 */
2068
e6a6cf3aab0f Switched menu item callbacks to Fl_Menu_Item (instead of Fl_Widget)
Jorge Arellano Cid <jcid@dillo.org>
parents: 2048
diff changeset
149 static void Menu_view_page_source_cb(Fl_Widget*, void*)
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
150 {
1569
24a5d37b09e1 Add the a_Capi_dpi_send_data() function
Jorge Arellano Cid <jcid@dillo.org>
parents: 1445
diff changeset
151 a_UIcmd_view_page_source(popup_bw, popup_url);
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
152 }
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
153
930
b277eed3119c whitespace cleanup: 's/ +$//g'
Jorge Arellano Cid <jcid@dillo.org>
parents: 926
diff changeset
154 /*
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
155 * View current page's bugs
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
156 */
2068
e6a6cf3aab0f Switched menu item callbacks to Fl_Menu_Item (instead of Fl_Widget)
Jorge Arellano Cid <jcid@dillo.org>
parents: 2048
diff changeset
157 static void Menu_view_page_bugs_cb(Fl_Widget*, void*)
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
158 {
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
159 a_UIcmd_view_page_bugs(popup_bw);
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
160 }
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
161
48
224c9f547b39 Implemented "Load Images" in the page menu and cleaned up html.hh.
jcid
parents: 35
diff changeset
162 /*
841
588625b87c6a Refactor cleanup in menu.cc (load images)
corvid <corvid@lavabit.com>
parents: 827
diff changeset
163 * Load images on current page that match URL pattern
588625b87c6a Refactor cleanup in menu.cc (load images)
corvid <corvid@lavabit.com>
parents: 827
diff changeset
164 */
1812
7088695ed035 trivial bits of menu
corvid <corvid@lavabit.com>
parents: 1806
diff changeset
165 static void Menu_load_images_cb(Fl_Widget*, void *user_data)
841
588625b87c6a Refactor cleanup in menu.cc (load images)
corvid <corvid@lavabit.com>
parents: 827
diff changeset
166 {
926
caf45b6c8535 Fixed the load image popup option. Also cleaned up the API a bit.
corvid <corvid@lavabit.com>
parents: 907
diff changeset
167 DilloUrl *page_url = (DilloUrl *) user_data;
caf45b6c8535 Fixed the load image popup option. Also cleaned up the API a bit.
corvid <corvid@lavabit.com>
parents: 907
diff changeset
168 void *doc = a_Bw_get_url_doc(popup_bw, page_url);
841
588625b87c6a Refactor cleanup in menu.cc (load images)
corvid <corvid@lavabit.com>
parents: 827
diff changeset
169
588625b87c6a Refactor cleanup in menu.cc (load images)
corvid <corvid@lavabit.com>
parents: 827
diff changeset
170 if (doc)
926
caf45b6c8535 Fixed the load image popup option. Also cleaned up the API a bit.
corvid <corvid@lavabit.com>
parents: 907
diff changeset
171 a_Html_load_images(doc, popup_url);
48
224c9f547b39 Implemented "Load Images" in the page menu and cleaned up html.hh.
jcid
parents: 35
diff changeset
172 }
224c9f547b39 Implemented "Load Images" in the page menu and cleaned up html.hh.
jcid
parents: 35
diff changeset
173
477
9a41a7db39f5 Added a popup menu to form's submit button
corvid <corvid@lavabit.com>
parents: 467
diff changeset
174 /*
9a41a7db39f5 Added a popup menu to form's submit button
corvid <corvid@lavabit.com>
parents: 467
diff changeset
175 * Submit form
9a41a7db39f5 Added a popup menu to form's submit button
corvid <corvid@lavabit.com>
parents: 467
diff changeset
176 */
2068
e6a6cf3aab0f Switched menu item callbacks to Fl_Menu_Item (instead of Fl_Widget)
Jorge Arellano Cid <jcid@dillo.org>
parents: 2048
diff changeset
177 static void Menu_form_submit_cb(Fl_Widget*, void*)
477
9a41a7db39f5 Added a popup menu to form's submit button
corvid <corvid@lavabit.com>
parents: 467
diff changeset
178 {
926
caf45b6c8535 Fixed the load image popup option. Also cleaned up the API a bit.
corvid <corvid@lavabit.com>
parents: 907
diff changeset
179 void *doc = a_Bw_get_url_doc(popup_bw, popup_url);
841
588625b87c6a Refactor cleanup in menu.cc (load images)
corvid <corvid@lavabit.com>
parents: 827
diff changeset
180
588625b87c6a Refactor cleanup in menu.cc (load images)
corvid <corvid@lavabit.com>
parents: 827
diff changeset
181 if (doc)
1821
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
182 a_Html_form_submit(doc, popup_form);
477
9a41a7db39f5 Added a popup menu to form's submit button
corvid <corvid@lavabit.com>
parents: 467
diff changeset
183 }
9a41a7db39f5 Added a popup menu to form's submit button
corvid <corvid@lavabit.com>
parents: 467
diff changeset
184
9a41a7db39f5 Added a popup menu to form's submit button
corvid <corvid@lavabit.com>
parents: 467
diff changeset
185 /*
9a41a7db39f5 Added a popup menu to form's submit button
corvid <corvid@lavabit.com>
parents: 467
diff changeset
186 * Reset form
9a41a7db39f5 Added a popup menu to form's submit button
corvid <corvid@lavabit.com>
parents: 467
diff changeset
187 */
2068
e6a6cf3aab0f Switched menu item callbacks to Fl_Menu_Item (instead of Fl_Widget)
Jorge Arellano Cid <jcid@dillo.org>
parents: 2048
diff changeset
188 static void Menu_form_reset_cb(Fl_Widget*, void*)
477
9a41a7db39f5 Added a popup menu to form's submit button
corvid <corvid@lavabit.com>
parents: 467
diff changeset
189 {
926
caf45b6c8535 Fixed the load image popup option. Also cleaned up the API a bit.
corvid <corvid@lavabit.com>
parents: 907
diff changeset
190 void *doc = a_Bw_get_url_doc(popup_bw, popup_url);
841
588625b87c6a Refactor cleanup in menu.cc (load images)
corvid <corvid@lavabit.com>
parents: 827
diff changeset
191
588625b87c6a Refactor cleanup in menu.cc (load images)
corvid <corvid@lavabit.com>
parents: 827
diff changeset
192 if (doc)
1821
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
193 a_Html_form_reset(doc, popup_form);
477
9a41a7db39f5 Added a popup menu to form's submit button
corvid <corvid@lavabit.com>
parents: 467
diff changeset
194 }
9a41a7db39f5 Added a popup menu to form's submit button
corvid <corvid@lavabit.com>
parents: 467
diff changeset
195
484
cdfdb006f193 Added a right-click menu to the form submit button (allows to show hiddens)
Jorge Arellano Cid <jcid@dillo.org>
parents: 482
diff changeset
196 /*
cdfdb006f193 Added a right-click menu to the form submit button (allows to show hiddens)
Jorge Arellano Cid <jcid@dillo.org>
parents: 482
diff changeset
197 * Toggle display of 'hidden' form controls.
cdfdb006f193 Added a right-click menu to the form submit button (allows to show hiddens)
Jorge Arellano Cid <jcid@dillo.org>
parents: 482
diff changeset
198 */
2068
e6a6cf3aab0f Switched menu item callbacks to Fl_Menu_Item (instead of Fl_Widget)
Jorge Arellano Cid <jcid@dillo.org>
parents: 2048
diff changeset
199 static void Menu_form_hiddens_cb(Fl_Widget*, void *user_data)
484
cdfdb006f193 Added a right-click menu to the form submit button (allows to show hiddens)
Jorge Arellano Cid <jcid@dillo.org>
parents: 482
diff changeset
200 {
cdfdb006f193 Added a right-click menu to the form submit button (allows to show hiddens)
Jorge Arellano Cid <jcid@dillo.org>
parents: 482
diff changeset
201 bool visible = *((bool *) user_data);
926
caf45b6c8535 Fixed the load image popup option. Also cleaned up the API a bit.
corvid <corvid@lavabit.com>
parents: 907
diff changeset
202 void *doc = a_Bw_get_url_doc(popup_bw, popup_url);
484
cdfdb006f193 Added a right-click menu to the form submit button (allows to show hiddens)
Jorge Arellano Cid <jcid@dillo.org>
parents: 482
diff changeset
203
841
588625b87c6a Refactor cleanup in menu.cc (load images)
corvid <corvid@lavabit.com>
parents: 827
diff changeset
204 if (doc)
1821
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
205 a_Html_form_display_hiddens(doc, popup_form, !visible);
484
cdfdb006f193 Added a right-click menu to the form submit button (allows to show hiddens)
Jorge Arellano Cid <jcid@dillo.org>
parents: 482
diff changeset
206 }
cdfdb006f193 Added a right-click menu to the form submit button (allows to show hiddens)
Jorge Arellano Cid <jcid@dillo.org>
parents: 482
diff changeset
207
2068
e6a6cf3aab0f Switched menu item callbacks to Fl_Menu_Item (instead of Fl_Widget)
Jorge Arellano Cid <jcid@dillo.org>
parents: 2048
diff changeset
208 static void Menu_stylesheet_cb(Fl_Widget*, void *vUrl)
958
1a26b2bd7138 [mq]: view-stylesheets
Jorge Arellano Cid <jcid@dillo.org>
parents: 930
diff changeset
209 {
1445
36a81b29a15e trim the labels of the stylesheet menu
Jeremy Henty <onepoint@starurchin.org>
parents: 1186
diff changeset
210 const DilloUrl *url = (const DilloUrl *) vUrl;
36a81b29a15e trim the labels of the stylesheet menu
Jeremy Henty <onepoint@starurchin.org>
parents: 1186
diff changeset
211 a_UIcmd_open_url(popup_bw, url);
958
1a26b2bd7138 [mq]: view-stylesheets
Jorge Arellano Cid <jcid@dillo.org>
parents: 930
diff changeset
212 }
1a26b2bd7138 [mq]: view-stylesheets
Jorge Arellano Cid <jcid@dillo.org>
parents: 930
diff changeset
213
930
b277eed3119c whitespace cleanup: 's/ +$//g'
Jorge Arellano Cid <jcid@dillo.org>
parents: 926
diff changeset
214 /*
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
215 * Validate URL with the W3C
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
216 */
2068
e6a6cf3aab0f Switched menu item callbacks to Fl_Menu_Item (instead of Fl_Widget)
Jorge Arellano Cid <jcid@dillo.org>
parents: 2048
diff changeset
217 static void Menu_bugmeter_validate_w3c_cb(Fl_Widget*, void*)
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
218 {
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
219 Dstr *dstr = dStr_sized_new(128);
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
220
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
221 dStr_sprintf(dstr, "http://validator.w3.org/check?uri=%s",
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
222 URL_STR(popup_url));
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
223 a_UIcmd_open_urlstr(popup_bw, dstr->str);
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
224 dStr_free(dstr, 1);
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
225 }
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
226
930
b277eed3119c whitespace cleanup: 's/ +$//g'
Jorge Arellano Cid <jcid@dillo.org>
parents: 926
diff changeset
227 /*
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
228 * Validate URL with the WDG
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
229 */
2068
e6a6cf3aab0f Switched menu item callbacks to Fl_Menu_Item (instead of Fl_Widget)
Jorge Arellano Cid <jcid@dillo.org>
parents: 2048
diff changeset
230 static void Menu_bugmeter_validate_wdg_cb(Fl_Widget*, void*)
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
231 {
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
232 Dstr *dstr = dStr_sized_new(128);
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
233
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
234 dStr_sprintf(dstr,
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
235 "http://www.htmlhelp.org/cgi-bin/validate.cgi?url=%s&warnings=yes",
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
236 URL_STR(popup_url));
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
237 a_UIcmd_open_urlstr(popup_bw, dstr->str);
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
238 dStr_free(dstr, 1);
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
239 }
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
240
930
b277eed3119c whitespace cleanup: 's/ +$//g'
Jorge Arellano Cid <jcid@dillo.org>
parents: 926
diff changeset
241 /*
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
242 * Show info page for the bug meter
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
243 */
2068
e6a6cf3aab0f Switched menu item callbacks to Fl_Menu_Item (instead of Fl_Widget)
Jorge Arellano Cid <jcid@dillo.org>
parents: 2048
diff changeset
244 static void Menu_bugmeter_about_cb(Fl_Widget*, void*)
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
245 {
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
246 a_UIcmd_open_urlstr(popup_bw, "http://www.dillo.org/help/bug_meter.html");
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
247 }
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
248
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
249 /*
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
250 * Navigation History callback.
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
251 * Go to selected URL.
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
252 */
2068
e6a6cf3aab0f Switched menu item callbacks to Fl_Menu_Item (instead of Fl_Widget)
Jorge Arellano Cid <jcid@dillo.org>
parents: 2048
diff changeset
253 static void Menu_history_cb(Fl_Widget*, void *data)
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
254 {
1994
3a714ff1fa37 Re-enabled middle click on history popups (Back and Forward buttons)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1987
diff changeset
255 int mb = Fl::event_button();
4
9a9338f78888 +- Connected signals to <li> elements (fixes links within lists).
jcid
parents: 0
diff changeset
256 int offset = history_direction * VOIDP2INT(data);
1661
0c5d982c92a0 Add const qualifier to a_History_get_url()
Jorge Arellano Cid <jcid@dillo.org>
parents: 1574
diff changeset
257 const DilloUrl *url = a_History_get_url(history_list[VOIDP2INT(data)-1]);
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
258
1994
3a714ff1fa37 Re-enabled middle click on history popups (Back and Forward buttons)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1987
diff changeset
259 if (mb == 1) {
3a714ff1fa37 Re-enabled middle click on history popups (Back and Forward buttons)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1987
diff changeset
260 a_UIcmd_nav_jump(popup_bw, offset, 0);
3a714ff1fa37 Re-enabled middle click on history popups (Back and Forward buttons)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1987
diff changeset
261 } else if (mb == 2) {
353
7217a61abc90 - Made the history popups use "focus_new_tab" & "middle_click_opens_new_tab"
jcid
parents: 350
diff changeset
262 // Middle button, open in a new window/tab
7217a61abc90 - Made the history popups use "focus_new_tab" & "middle_click_opens_new_tab"
jcid
parents: 350
diff changeset
263 if (prefs.middle_click_opens_new_tab) {
7217a61abc90 - Made the history popups use "focus_new_tab" & "middle_click_opens_new_tab"
jcid
parents: 350
diff changeset
264 int focus = prefs.focus_new_tab ? 1 : 0;
1791
corvid <corvid@lavabit.com>
parents: 1790
diff changeset
265 if (Fl::event_state(FL_SHIFT)) focus = !focus;
353
7217a61abc90 - Made the history popups use "focus_new_tab" & "middle_click_opens_new_tab"
jcid
parents: 350
diff changeset
266 a_UIcmd_open_url_nt(popup_bw, url, focus);
7217a61abc90 - Made the history popups use "focus_new_tab" & "middle_click_opens_new_tab"
jcid
parents: 350
diff changeset
267 } else {
7217a61abc90 - Made the history popups use "focus_new_tab" & "middle_click_opens_new_tab"
jcid
parents: 350
diff changeset
268 a_UIcmd_open_url_nw(popup_bw, url);
7217a61abc90 - Made the history popups use "focus_new_tab" & "middle_click_opens_new_tab"
jcid
parents: 350
diff changeset
269 }
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
270 }
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
271 }
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
272
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
273 /*
400
31b866fdde87 - File menu as popup implementation.
jcid
parents: 356
diff changeset
274 * Menus are popped-up from this timeout callback so the events
356
81338758c3dd - Added a workaround for segfaulting popup menus.
jcid
parents: 353
diff changeset
275 * associated with the button are gone when it pops. This way we
81338758c3dd - Added a workaround for segfaulting popup menus.
jcid
parents: 353
diff changeset
276 * avoid a segfault when a new page replaces the page that issued
81338758c3dd - Added a workaround for segfaulting popup menus.
jcid
parents: 353
diff changeset
277 * the popup menu.
81338758c3dd - Added a workaround for segfaulting popup menus.
jcid
parents: 353
diff changeset
278 */
81338758c3dd - Added a workaround for segfaulting popup menus.
jcid
parents: 353
diff changeset
279 static void Menu_popup_cb(void *data)
81338758c3dd - Added a workaround for segfaulting popup menus.
jcid
parents: 353
diff changeset
280 {
1821
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
281 const Fl_Menu_Item *m = ((Fl_Menu_Item *)data)->popup(popup_x, popup_y);
356
81338758c3dd - Added a workaround for segfaulting popup menus.
jcid
parents: 353
diff changeset
282
2068
e6a6cf3aab0f Switched menu item callbacks to Fl_Menu_Item (instead of Fl_Widget)
Jorge Arellano Cid <jcid@dillo.org>
parents: 2048
diff changeset
283 if (m && m->callback())
e6a6cf3aab0f Switched menu item callbacks to Fl_Menu_Item (instead of Fl_Widget)
Jorge Arellano Cid <jcid@dillo.org>
parents: 2048
diff changeset
284 m->do_callback((Fl_Widget *)data);
400
31b866fdde87 - File menu as popup implementation.
jcid
parents: 356
diff changeset
285 a_Timeout_remove();
31b866fdde87 - File menu as popup implementation.
jcid
parents: 356
diff changeset
286 }
31b866fdde87 - File menu as popup implementation.
jcid
parents: 356
diff changeset
287
31b866fdde87 - File menu as popup implementation.
jcid
parents: 356
diff changeset
288 /*
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
289 * Page popup menu (construction & popup)
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
290 */
930
b277eed3119c whitespace cleanup: 's/ +$//g'
Jorge Arellano Cid <jcid@dillo.org>
parents: 926
diff changeset
291 void a_Menu_page_popup(BrowserWindow *bw, const DilloUrl *url,
958
1a26b2bd7138 [mq]: view-stylesheets
Jorge Arellano Cid <jcid@dillo.org>
parents: 930
diff changeset
292 bool_t has_bugs, void *v_cssUrls)
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
293 {
958
1a26b2bd7138 [mq]: view-stylesheets
Jorge Arellano Cid <jcid@dillo.org>
parents: 930
diff changeset
294 lout::misc::SimpleVector <DilloUrl*> *cssUrls =
1a26b2bd7138 [mq]: view-stylesheets
Jorge Arellano Cid <jcid@dillo.org>
parents: 930
diff changeset
295 (lout::misc::SimpleVector <DilloUrl*> *) v_cssUrls;
1821
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
296 int j = 0;
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
297
1821
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
298 static Fl_Menu_Item *stylesheets = NULL;
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
299 static Fl_Menu_Item pm[] = {
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
300 {"View page source", 0, Menu_view_page_source_cb,0,0,0,0,0,0},
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
301 {"View page bugs", 0, Menu_view_page_bugs_cb,0,0,0,0,0,0},
2048
5060d415a85a clickable menu items (even those introducing submenus) MUST have callbacks
corvid <corvid@lavabit.com>
parents: 2024
diff changeset
302 {"View stylesheets", 0, Menu_nop_cb,0,FL_SUBMENU_POINTER|FL_MENU_DIVIDER,
5060d415a85a clickable menu items (even those introducing submenus) MUST have callbacks
corvid <corvid@lavabit.com>
parents: 2024
diff changeset
303 0,0,0,0},
1821
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
304 {"Bookmark this page", 0,Menu_add_bookmark_cb,0,FL_MENU_DIVIDER,0,0,0,0},
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
305 {"Find text", 0, Menu_find_text_cb,0,0,0,0,0,0},
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
306 {"Save page as...", 0, Menu_save_page_cb,0,0,0,0,0,0},
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
307 {0,0,0,0,0,0,0,0,0}
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
308 };
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
309
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
310 popup_x = Fl::event_x();
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
311 popup_y = Fl::event_y();
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
312 popup_bw = bw;
356
81338758c3dd - Added a workaround for segfaulting popup menus.
jcid
parents: 353
diff changeset
313 a_Url_free(popup_url);
81338758c3dd - Added a workaround for segfaulting popup menus.
jcid
parents: 353
diff changeset
314 popup_url = a_Url_dup(url);
48
224c9f547b39 Implemented "Load Images" in the page menu and cleaned up html.hh.
jcid
parents: 35
diff changeset
315
1821
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
316 has_bugs == TRUE ? pm[1].activate() : pm[1].deactivate();
48
224c9f547b39 Implemented "Load Images" in the page menu and cleaned up html.hh.
jcid
parents: 35
diff changeset
317
1574
da4dac7f14b1 Interim patch for view source
Jorge Arellano Cid <jcid@dillo.org>
parents: 1569
diff changeset
318 if (strncmp(URL_STR(url), "dpi:/vsource/", 13) == 0)
1821
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
319 pm[0].deactivate();
1574
da4dac7f14b1 Interim patch for view source
Jorge Arellano Cid <jcid@dillo.org>
parents: 1569
diff changeset
320 else
1821
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
321 pm[0].activate();
1574
da4dac7f14b1 Interim patch for view source
Jorge Arellano Cid <jcid@dillo.org>
parents: 1569
diff changeset
322
1821
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
323 if (stylesheets) {
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
324 while (stylesheets[j].text) {
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
325 dFree((char *) stylesheets[j].label());
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
326 a_Url_free((DilloUrl *) stylesheets[j].user_data());
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
327 j++;
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
328 }
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
329 delete [] stylesheets;
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
330 stylesheets = NULL;
958
1a26b2bd7138 [mq]: view-stylesheets
Jorge Arellano Cid <jcid@dillo.org>
parents: 930
diff changeset
331 }
1a26b2bd7138 [mq]: view-stylesheets
Jorge Arellano Cid <jcid@dillo.org>
parents: 930
diff changeset
332
1a26b2bd7138 [mq]: view-stylesheets
Jorge Arellano Cid <jcid@dillo.org>
parents: 930
diff changeset
333 if (cssUrls && cssUrls->size () > 0) {
1821
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
334 stylesheets = new Fl_Menu_Item[cssUrls->size() + 1];
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
335 memset(stylesheets, '\0', sizeof(Fl_Menu_Item[cssUrls->size() + 1]));
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
336
958
1a26b2bd7138 [mq]: view-stylesheets
Jorge Arellano Cid <jcid@dillo.org>
parents: 930
diff changeset
337 for (j = 0; j < cssUrls->size(); j++) {
1821
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
338
1445
36a81b29a15e trim the labels of the stylesheet menu
Jeremy Henty <onepoint@starurchin.org>
parents: 1186
diff changeset
339 /* may want ability to Load individual unloaded stylesheets as well */
958
1a26b2bd7138 [mq]: view-stylesheets
Jorge Arellano Cid <jcid@dillo.org>
parents: 930
diff changeset
340 const char *action = "View ";
1445
36a81b29a15e trim the labels of the stylesheet menu
Jeremy Henty <onepoint@starurchin.org>
parents: 1186
diff changeset
341 DilloUrl *url = cssUrls->get(j);
36a81b29a15e trim the labels of the stylesheet menu
Jeremy Henty <onepoint@starurchin.org>
parents: 1186
diff changeset
342 const char *url_str = URL_STR(url);
36a81b29a15e trim the labels of the stylesheet menu
Jeremy Henty <onepoint@starurchin.org>
parents: 1186
diff changeset
343 const uint_t head_length = 30, tail_length = 40,
36a81b29a15e trim the labels of the stylesheet menu
Jeremy Henty <onepoint@starurchin.org>
parents: 1186
diff changeset
344 url_len = strlen(url_str);;
36a81b29a15e trim the labels of the stylesheet menu
Jeremy Henty <onepoint@starurchin.org>
parents: 1186
diff changeset
345 char *label;
36a81b29a15e trim the labels of the stylesheet menu
Jeremy Henty <onepoint@starurchin.org>
parents: 1186
diff changeset
346
36a81b29a15e trim the labels of the stylesheet menu
Jeremy Henty <onepoint@starurchin.org>
parents: 1186
diff changeset
347 if (url_len > head_length + tail_length + 3) {
36a81b29a15e trim the labels of the stylesheet menu
Jeremy Henty <onepoint@starurchin.org>
parents: 1186
diff changeset
348 /* trim long URLs when making the label */
36a81b29a15e trim the labels of the stylesheet menu
Jeremy Henty <onepoint@starurchin.org>
parents: 1186
diff changeset
349 char *url_head = dStrndup(url_str, head_length);
36a81b29a15e trim the labels of the stylesheet menu
Jeremy Henty <onepoint@starurchin.org>
parents: 1186
diff changeset
350 const char *url_tail = url_str + (url_len - tail_length);
36a81b29a15e trim the labels of the stylesheet menu
Jeremy Henty <onepoint@starurchin.org>
parents: 1186
diff changeset
351 label = dStrconcat(action, url_head, "...", url_tail, NULL);
36a81b29a15e trim the labels of the stylesheet menu
Jeremy Henty <onepoint@starurchin.org>
parents: 1186
diff changeset
352 dFree(url_head);
36a81b29a15e trim the labels of the stylesheet menu
Jeremy Henty <onepoint@starurchin.org>
parents: 1186
diff changeset
353 } else {
36a81b29a15e trim the labels of the stylesheet menu
Jeremy Henty <onepoint@starurchin.org>
parents: 1186
diff changeset
354 label = dStrconcat(action, url_str, NULL);
36a81b29a15e trim the labels of the stylesheet menu
Jeremy Henty <onepoint@starurchin.org>
parents: 1186
diff changeset
355 }
36a81b29a15e trim the labels of the stylesheet menu
Jeremy Henty <onepoint@starurchin.org>
parents: 1186
diff changeset
356
1821
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
357 stylesheets[j].label(FL_NORMAL_LABEL, label);
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
358 stylesheets[j].callback(Menu_stylesheet_cb, a_Url_dup(url));
958
1a26b2bd7138 [mq]: view-stylesheets
Jorge Arellano Cid <jcid@dillo.org>
parents: 930
diff changeset
359 }
1821
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
360
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
361 pm[2].user_data(stylesheets);
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
362 pm[2].activate();
958
1a26b2bd7138 [mq]: view-stylesheets
Jorge Arellano Cid <jcid@dillo.org>
parents: 930
diff changeset
363 } else {
1821
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
364 pm[2].deactivate();
958
1a26b2bd7138 [mq]: view-stylesheets
Jorge Arellano Cid <jcid@dillo.org>
parents: 930
diff changeset
365 }
1a26b2bd7138 [mq]: view-stylesheets
Jorge Arellano Cid <jcid@dillo.org>
parents: 930
diff changeset
366
2068
e6a6cf3aab0f Switched menu item callbacks to Fl_Menu_Item (instead of Fl_Widget)
Jorge Arellano Cid <jcid@dillo.org>
parents: 2048
diff changeset
367 a_Timeout_add(0.0, Menu_popup_cb, (void*)pm);
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
368 }
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
369
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
370 /*
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
371 * Link popup menu (construction & popup)
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
372 */
11
4a5942beffdf Added some "const" qualifiers.
jcid
parents: 4
diff changeset
373 void a_Menu_link_popup(BrowserWindow *bw, const DilloUrl *url)
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
374 {
1821
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
375 static Fl_Menu_Item pm[] = {
2107
a4188b1ca1b2 menu: tab before window
corvid <corvid@lavabit.com>
parents: 2068
diff changeset
376 {"Open link in new tab", 0, Menu_open_url_nt_cb,0,0,0,0,0,0},
a4188b1ca1b2 menu: tab before window
corvid <corvid@lavabit.com>
parents: 2068
diff changeset
377 {"Open link in new window", 0, Menu_open_url_nw_cb,0,FL_MENU_DIVIDER,0,0,
a4188b1ca1b2 menu: tab before window
corvid <corvid@lavabit.com>
parents: 2068
diff changeset
378 0,0},
1821
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
379 {"Bookmark this link", 0, Menu_add_bookmark_cb,0,0,0,0,0,0},
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
380 {"Copy link location", 0, Menu_copy_urlstr_cb,0,FL_MENU_DIVIDER,0,0,0,0},
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
381 {"Save link as...", 0, Menu_save_link_cb,0,0,0,0,0,0},
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
382 {0,0,0,0,0,0,0,0,0}
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
383 };
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
384
1821
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
385 popup_x = Fl::event_x();
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
386 popup_y = Fl::event_y();
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
387 popup_bw = bw;
356
81338758c3dd - Added a workaround for segfaulting popup menus.
jcid
parents: 353
diff changeset
388 a_Url_free(popup_url);
81338758c3dd - Added a workaround for segfaulting popup menus.
jcid
parents: 353
diff changeset
389 popup_url = a_Url_dup(url);
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
390
2068
e6a6cf3aab0f Switched menu item callbacks to Fl_Menu_Item (instead of Fl_Widget)
Jorge Arellano Cid <jcid@dillo.org>
parents: 2048
diff changeset
391 a_Timeout_add(0.0, Menu_popup_cb, (void*)pm);
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
392 }
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
393
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
394 /*
22
571f09e42ab6 - Hooked "Activate" to the form_receiver.
jcid
parents: 11
diff changeset
395 * Image popup menu (construction & popup)
571f09e42ab6 - Hooked "Activate" to the form_receiver.
jcid
parents: 11
diff changeset
396 */
571f09e42ab6 - Hooked "Activate" to the form_receiver.
jcid
parents: 11
diff changeset
397 void a_Menu_image_popup(BrowserWindow *bw, const DilloUrl *url,
926
caf45b6c8535 Fixed the load image popup option. Also cleaned up the API a bit.
corvid <corvid@lavabit.com>
parents: 907
diff changeset
398 bool_t loaded_img, DilloUrl *page_url,
caf45b6c8535 Fixed the load image popup option. Also cleaned up the API a bit.
corvid <corvid@lavabit.com>
parents: 907
diff changeset
399 DilloUrl *link_url)
22
571f09e42ab6 - Hooked "Activate" to the form_receiver.
jcid
parents: 11
diff changeset
400 {
926
caf45b6c8535 Fixed the load image popup option. Also cleaned up the API a bit.
corvid <corvid@lavabit.com>
parents: 907
diff changeset
401 static DilloUrl *popup_page_url = NULL;
356
81338758c3dd - Added a workaround for segfaulting popup menus.
jcid
parents: 353
diff changeset
402 static DilloUrl *popup_link_url = NULL;
1821
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
403 static Fl_Menu_Item pm[] = {
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
404 {"Isolate image", 0, Menu_open_url_cb,0,0,0,0,0,0},
2107
a4188b1ca1b2 menu: tab before window
corvid <corvid@lavabit.com>
parents: 2068
diff changeset
405 {"Open image in new tab", 0, Menu_open_url_nt_cb,0,0,0,0,0,0},
a4188b1ca1b2 menu: tab before window
corvid <corvid@lavabit.com>
parents: 2068
diff changeset
406 {"Open image in new window", 0, Menu_open_url_nw_cb, 0, FL_MENU_DIVIDER,
1821
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
407 0,0,0,0},
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
408 {"Load image", 0, Menu_load_images_cb,0,0,0,0,0,0},
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
409 {"Bookmark this image", 0, Menu_add_bookmark_cb,0,0,0,0,0,0},
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
410 {"Copy image location", 0,Menu_copy_urlstr_cb,0,FL_MENU_DIVIDER,0,0,0,0},
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
411 {"Save image as...", 0, Menu_save_link_cb, 0, FL_MENU_DIVIDER,0,0,0,0},
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
412 {"Link menu", 0, Menu_link_cb,0,0,0,0,0,0},
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
413 {0,0,0,0,0,0,0,0,0}
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
414 };
22
571f09e42ab6 - Hooked "Activate" to the form_receiver.
jcid
parents: 11
diff changeset
415
1821
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
416 popup_x = Fl::event_x();
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
417 popup_y = Fl::event_y();
22
571f09e42ab6 - Hooked "Activate" to the form_receiver.
jcid
parents: 11
diff changeset
418 popup_bw = bw;
356
81338758c3dd - Added a workaround for segfaulting popup menus.
jcid
parents: 353
diff changeset
419 a_Url_free(popup_url);
81338758c3dd - Added a workaround for segfaulting popup menus.
jcid
parents: 353
diff changeset
420 popup_url = a_Url_dup(url);
926
caf45b6c8535 Fixed the load image popup option. Also cleaned up the API a bit.
corvid <corvid@lavabit.com>
parents: 907
diff changeset
421 a_Url_free(popup_page_url);
caf45b6c8535 Fixed the load image popup option. Also cleaned up the API a bit.
corvid <corvid@lavabit.com>
parents: 907
diff changeset
422 popup_page_url = a_Url_dup(page_url);
356
81338758c3dd - Added a workaround for segfaulting popup menus.
jcid
parents: 353
diff changeset
423 a_Url_free(popup_link_url);
81338758c3dd - Added a workaround for segfaulting popup menus.
jcid
parents: 353
diff changeset
424 popup_link_url = a_Url_dup(link_url);
930
b277eed3119c whitespace cleanup: 's/ +$//g'
Jorge Arellano Cid <jcid@dillo.org>
parents: 926
diff changeset
425
22
571f09e42ab6 - Hooked "Activate" to the form_receiver.
jcid
parents: 11
diff changeset
426
356
81338758c3dd - Added a workaround for segfaulting popup menus.
jcid
parents: 353
diff changeset
427 if (loaded_img) {
1821
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
428 pm[3].deactivate();
356
81338758c3dd - Added a workaround for segfaulting popup menus.
jcid
parents: 353
diff changeset
429 } else {
1821
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
430 pm[3].activate();
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
431 pm[3].user_data(popup_page_url);
356
81338758c3dd - Added a workaround for segfaulting popup menus.
jcid
parents: 353
diff changeset
432 }
22
571f09e42ab6 - Hooked "Activate" to the form_receiver.
jcid
parents: 11
diff changeset
433
571f09e42ab6 - Hooked "Activate" to the form_receiver.
jcid
parents: 11
diff changeset
434 if (link_url) {
1821
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
435 pm[7].activate();
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
436 pm[7].user_data(popup_link_url);
22
571f09e42ab6 - Hooked "Activate" to the form_receiver.
jcid
parents: 11
diff changeset
437 } else {
1821
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
438 pm[7].deactivate();
22
571f09e42ab6 - Hooked "Activate" to the form_receiver.
jcid
parents: 11
diff changeset
439 }
48
224c9f547b39 Implemented "Load Images" in the page menu and cleaned up html.hh.
jcid
parents: 35
diff changeset
440
2068
e6a6cf3aab0f Switched menu item callbacks to Fl_Menu_Item (instead of Fl_Widget)
Jorge Arellano Cid <jcid@dillo.org>
parents: 2048
diff changeset
441 a_Timeout_add(0.0, Menu_popup_cb, (void*)pm);
22
571f09e42ab6 - Hooked "Activate" to the form_receiver.
jcid
parents: 11
diff changeset
442 }
571f09e42ab6 - Hooked "Activate" to the form_receiver.
jcid
parents: 11
diff changeset
443
571f09e42ab6 - Hooked "Activate" to the form_receiver.
jcid
parents: 11
diff changeset
444 /*
477
9a41a7db39f5 Added a popup menu to form's submit button
corvid <corvid@lavabit.com>
parents: 467
diff changeset
445 * Form popup menu (construction & popup)
9a41a7db39f5 Added a popup menu to form's submit button
corvid <corvid@lavabit.com>
parents: 467
diff changeset
446 */
9a41a7db39f5 Added a popup menu to form's submit button
corvid <corvid@lavabit.com>
parents: 467
diff changeset
447 void a_Menu_form_popup(BrowserWindow *bw, const DilloUrl *page_url,
484
cdfdb006f193 Added a right-click menu to the form submit button (allows to show hiddens)
Jorge Arellano Cid <jcid@dillo.org>
parents: 482
diff changeset
448 void *formptr, bool_t hidvis)
477
9a41a7db39f5 Added a popup menu to form's submit button
corvid <corvid@lavabit.com>
parents: 467
diff changeset
449 {
484
cdfdb006f193 Added a right-click menu to the form submit button (allows to show hiddens)
Jorge Arellano Cid <jcid@dillo.org>
parents: 482
diff changeset
450 static bool hiddens_visible;
1821
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
451 static Fl_Menu_Item pm[] = {
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
452 {"Submit form", 0, Menu_form_submit_cb,0,0,0,0,0,0},
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
453 {"Reset form", 0, Menu_form_reset_cb,0,0,0,0,0,0},
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
454 {0, 0, Menu_form_hiddens_cb, &hiddens_visible, 0,0,0,0,0},
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
455 {0,0,0,0,0,0,0,0,0}
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
456 };
477
9a41a7db39f5 Added a popup menu to form's submit button
corvid <corvid@lavabit.com>
parents: 467
diff changeset
457
1821
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
458 popup_x = Fl::event_x();
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
459 popup_y = Fl::event_y();
477
9a41a7db39f5 Added a popup menu to form's submit button
corvid <corvid@lavabit.com>
parents: 467
diff changeset
460 popup_bw = bw;
9a41a7db39f5 Added a popup menu to form's submit button
corvid <corvid@lavabit.com>
parents: 467
diff changeset
461 a_Url_free(popup_url);
9a41a7db39f5 Added a popup menu to form's submit button
corvid <corvid@lavabit.com>
parents: 467
diff changeset
462 popup_url = a_Url_dup(page_url);
1821
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
463 popup_form = formptr;
477
9a41a7db39f5 Added a popup menu to form's submit button
corvid <corvid@lavabit.com>
parents: 467
diff changeset
464
484
cdfdb006f193 Added a right-click menu to the form submit button (allows to show hiddens)
Jorge Arellano Cid <jcid@dillo.org>
parents: 482
diff changeset
465 hiddens_visible = hidvis;
1821
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
466 pm[2].label(hiddens_visible ? "Hide hiddens": "Show hiddens");
484
cdfdb006f193 Added a right-click menu to the form submit button (allows to show hiddens)
Jorge Arellano Cid <jcid@dillo.org>
parents: 482
diff changeset
467
2068
e6a6cf3aab0f Switched menu item callbacks to Fl_Menu_Item (instead of Fl_Widget)
Jorge Arellano Cid <jcid@dillo.org>
parents: 2048
diff changeset
468 a_Timeout_add(0.0, Menu_popup_cb, (void*)pm);
477
9a41a7db39f5 Added a popup menu to form's submit button
corvid <corvid@lavabit.com>
parents: 467
diff changeset
469 }
9a41a7db39f5 Added a popup menu to form's submit button
corvid <corvid@lavabit.com>
parents: 467
diff changeset
470
9a41a7db39f5 Added a popup menu to form's submit button
corvid <corvid@lavabit.com>
parents: 467
diff changeset
471 /*
400
31b866fdde87 - File menu as popup implementation.
jcid
parents: 356
diff changeset
472 * File popup menu (construction & popup)
31b866fdde87 - File menu as popup implementation.
jcid
parents: 356
diff changeset
473 */
31b866fdde87 - File menu as popup implementation.
jcid
parents: 356
diff changeset
474 void a_Menu_file_popup(BrowserWindow *bw, void *v_wid)
31b866fdde87 - File menu as popup implementation.
jcid
parents: 356
diff changeset
475 {
1812
7088695ed035 trivial bits of menu
corvid <corvid@lavabit.com>
parents: 1806
diff changeset
476 Fl_Widget *wid = (Fl_Widget*)v_wid;
1821
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
477
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
478 static Fl_Menu_Item pm[] = {
2107
a4188b1ca1b2 menu: tab before window
corvid <corvid@lavabit.com>
parents: 2068
diff changeset
479 {"New tab", Keys::getShortcut(KEYS_NEW_TAB), filemenu_cb,
a4188b1ca1b2 menu: tab before window
corvid <corvid@lavabit.com>
parents: 2068
diff changeset
480 (void*)"nt",0,0,0,0,0},
1821
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
481 {"New window", Keys::getShortcut(KEYS_NEW_WINDOW), filemenu_cb,
2107
a4188b1ca1b2 menu: tab before window
corvid <corvid@lavabit.com>
parents: 2068
diff changeset
482 (void*)"nw", FL_MENU_DIVIDER,0,0,0,0},
1821
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
483 {"Open file...", Keys::getShortcut(KEYS_OPEN), filemenu_cb,
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
484 (void*)"of",0,0,0,0,0},
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
485 {"Open URL...", Keys::getShortcut(KEYS_GOTO), filemenu_cb,
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
486 (void*)"ou",0,0,0,0,0},
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
487 {"Close", Keys::getShortcut(KEYS_CLOSE_TAB), filemenu_cb,
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
488 (void*)"cw", FL_MENU_DIVIDER,0,0,0,0},
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
489 {"Exit Dillo", Keys::getShortcut(KEYS_CLOSE_ALL), filemenu_cb,
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
490 (void*)"ed",0,0,0,0,0},
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
491 {0,0,0,0,0,0,0,0,0}
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
492 };
400
31b866fdde87 - File menu as popup implementation.
jcid
parents: 356
diff changeset
493
31b866fdde87 - File menu as popup implementation.
jcid
parents: 356
diff changeset
494 popup_bw = bw;
31b866fdde87 - File menu as popup implementation.
jcid
parents: 356
diff changeset
495 popup_x = wid->x();
1877
b0ffc141dcc2 remove a FLTK2 workaround
corvid <corvid@lavabit.com>
parents: 1857
diff changeset
496 popup_y = wid->y() + wid->h();
400
31b866fdde87 - File menu as popup implementation.
jcid
parents: 356
diff changeset
497 a_Url_free(popup_url);
31b866fdde87 - File menu as popup implementation.
jcid
parents: 356
diff changeset
498 popup_url = NULL;
31b866fdde87 - File menu as popup implementation.
jcid
parents: 356
diff changeset
499
1821
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
500 //pm->label(wid->visible() ? NULL : "File");
2068
e6a6cf3aab0f Switched menu item callbacks to Fl_Menu_Item (instead of Fl_Widget)
Jorge Arellano Cid <jcid@dillo.org>
parents: 2048
diff changeset
501 a_Timeout_add(0.0, Menu_popup_cb, (void*)pm);
400
31b866fdde87 - File menu as popup implementation.
jcid
parents: 356
diff changeset
502 }
31b866fdde87 - File menu as popup implementation.
jcid
parents: 356
diff changeset
503
31b866fdde87 - File menu as popup implementation.
jcid
parents: 356
diff changeset
504 /*
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
505 * Bugmeter popup menu (construction & popup)
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
506 */
11
4a5942beffdf Added some "const" qualifiers.
jcid
parents: 4
diff changeset
507 void a_Menu_bugmeter_popup(BrowserWindow *bw, const DilloUrl *url)
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
508 {
1821
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
509 static Fl_Menu_Item pm[] = {
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
510 {"Validate URL with W3C", 0, Menu_bugmeter_validate_w3c_cb,0,0,0,0,0,0},
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
511 {"Validate URL with WDG", 0, Menu_bugmeter_validate_wdg_cb, 0,
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
512 FL_MENU_DIVIDER,0,0,0,0},
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
513 {"About bug meter", 0, Menu_bugmeter_about_cb,0,0,0,0,0,0},
2024
f542084fa707 rm spaces
corvid <corvid@lavabit.com>
parents: 1994
diff changeset
514 {0,0,0,0,0,0,0,0,0}
f542084fa707 rm spaces
corvid <corvid@lavabit.com>
parents: 1994
diff changeset
515 };
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
516
1821
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
517 popup_x = Fl::event_x();
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
518 popup_y = Fl::event_y();
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
519 popup_bw = bw;
356
81338758c3dd - Added a workaround for segfaulting popup menus.
jcid
parents: 353
diff changeset
520 a_Url_free(popup_url);
81338758c3dd - Added a workaround for segfaulting popup menus.
jcid
parents: 353
diff changeset
521 popup_url = a_Url_dup(url);
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
522
2068
e6a6cf3aab0f Switched menu item callbacks to Fl_Menu_Item (instead of Fl_Widget)
Jorge Arellano Cid <jcid@dillo.org>
parents: 2048
diff changeset
523 a_Timeout_add(0.0, Menu_popup_cb, (void*)pm);
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
524 }
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
525
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
526 /*
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
527 * Navigation History popup menu (construction & popup)
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
528 *
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
529 * direction: {backward = -1, forward = 1}
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
530 */
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
531 void a_Menu_history_popup(BrowserWindow *bw, int direction)
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
532 {
1821
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
533 static Fl_Menu_Item *pm = 0;
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
534 int i, n;
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
535
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
536 popup_bw = bw;
1857
b5825a55b34c better menu positioning
corvid <corvid@lavabit.com>
parents: 1853
diff changeset
537 popup_x = Fl::event_x();
b5825a55b34c better menu positioning
corvid <corvid@lavabit.com>
parents: 1853
diff changeset
538 popup_y = Fl::event_y();
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
539 history_direction = direction;
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
540
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
541 // TODO: hook popdown event with delete or similar.
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
542 if (pm)
1821
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
543 delete [] pm;
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
544 if (history_list)
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
545 dFree(history_list);
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
546
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
547 // Get a list of URLs for this popup
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
548 history_list = a_UIcmd_get_history(bw, direction);
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
549
1821
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
550 for (n = 0; history_list[n] != -1; n++)
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
551 ;
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
552
1821
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
553 pm = new Fl_Menu_Item[n + 1];
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
554 memset(pm, '\0', sizeof(Fl_Menu_Item[n + 1]));
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
555
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
556 for (i = 0; i < n; i++) {
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
557 pm[i].label(FL_NORMAL_LABEL, a_History_get_title(history_list[i], 1));
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
558 pm[i].callback(Menu_history_cb, INT2VOIDP(i+1));
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
559 }
2068
e6a6cf3aab0f Switched menu item callbacks to Fl_Menu_Item (instead of Fl_Widget)
Jorge Arellano Cid <jcid@dillo.org>
parents: 2048
diff changeset
560 a_Timeout_add(0.0, Menu_popup_cb, (void*)pm);
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
561 }
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
562
827
d513abcd4949 Implemented the tools button with CSS options. Also removed nav.h from html.cc
Jorge Arellano Cid <jcid@dillo.org>
parents: 783
diff changeset
563 /*
d513abcd4949 Implemented the tools button with CSS options. Also removed nav.h from html.cc
Jorge Arellano Cid <jcid@dillo.org>
parents: 783
diff changeset
564 * Toggle use of remote stylesheets
930
b277eed3119c whitespace cleanup: 's/ +$//g'
Jorge Arellano Cid <jcid@dillo.org>
parents: 926
diff changeset
565 */
1821
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
566 static void Menu_remote_css_cb(Fl_Widget *wid, void*)
827
d513abcd4949 Implemented the tools button with CSS options. Also removed nav.h from html.cc
Jorge Arellano Cid <jcid@dillo.org>
parents: 783
diff changeset
567 {
1821
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
568 Fl_Menu_Item *item = (Fl_Menu_Item*) wid;
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
569
1853
b8aa813dc9c2 tools popup menu
corvid <corvid@lavabit.com>
parents: 1826
diff changeset
570 item->flags ^= FL_MENU_VALUE;
b8aa813dc9c2 tools popup menu
corvid <corvid@lavabit.com>
parents: 1826
diff changeset
571 prefs.load_stylesheets = item->flags & FL_MENU_VALUE ? 1 : 0;
827
d513abcd4949 Implemented the tools button with CSS options. Also removed nav.h from html.cc
Jorge Arellano Cid <jcid@dillo.org>
parents: 783
diff changeset
572 a_UIcmd_repush(popup_bw);
d513abcd4949 Implemented the tools button with CSS options. Also removed nav.h from html.cc
Jorge Arellano Cid <jcid@dillo.org>
parents: 783
diff changeset
573 }
d513abcd4949 Implemented the tools button with CSS options. Also removed nav.h from html.cc
Jorge Arellano Cid <jcid@dillo.org>
parents: 783
diff changeset
574
d513abcd4949 Implemented the tools button with CSS options. Also removed nav.h from html.cc
Jorge Arellano Cid <jcid@dillo.org>
parents: 783
diff changeset
575 /*
d513abcd4949 Implemented the tools button with CSS options. Also removed nav.h from html.cc
Jorge Arellano Cid <jcid@dillo.org>
parents: 783
diff changeset
576 * Toggle use of embedded CSS style
930
b277eed3119c whitespace cleanup: 's/ +$//g'
Jorge Arellano Cid <jcid@dillo.org>
parents: 926
diff changeset
577 */
1821
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
578 static void Menu_embedded_css_cb(Fl_Widget *wid, void*)
827
d513abcd4949 Implemented the tools button with CSS options. Also removed nav.h from html.cc
Jorge Arellano Cid <jcid@dillo.org>
parents: 783
diff changeset
579 {
1821
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
580 Fl_Menu_Item *item = (Fl_Menu_Item*) wid;
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
581
1853
b8aa813dc9c2 tools popup menu
corvid <corvid@lavabit.com>
parents: 1826
diff changeset
582 item->flags ^= FL_MENU_VALUE;
b8aa813dc9c2 tools popup menu
corvid <corvid@lavabit.com>
parents: 1826
diff changeset
583 prefs.parse_embedded_css = item->flags & FL_MENU_VALUE ? 1 : 0;
827
d513abcd4949 Implemented the tools button with CSS options. Also removed nav.h from html.cc
Jorge Arellano Cid <jcid@dillo.org>
parents: 783
diff changeset
584 a_UIcmd_repush(popup_bw);
d513abcd4949 Implemented the tools button with CSS options. Also removed nav.h from html.cc
Jorge Arellano Cid <jcid@dillo.org>
parents: 783
diff changeset
585 }
d513abcd4949 Implemented the tools button with CSS options. Also removed nav.h from html.cc
Jorge Arellano Cid <jcid@dillo.org>
parents: 783
diff changeset
586
1983
ce68c58f2f82 Fix for e816e06ee901: it disabled the preceeding menuitems
Jorge Arellano Cid <jcid@dillo.org>
parents: 1977
diff changeset
587 static void Menu_panel_change_cb(Fl_Widget*, void *user_data)
ce68c58f2f82 Fix for e816e06ee901: it disabled the preceeding menuitems
Jorge Arellano Cid <jcid@dillo.org>
parents: 1977
diff changeset
588 {
ce68c58f2f82 Fix for e816e06ee901: it disabled the preceeding menuitems
Jorge Arellano Cid <jcid@dillo.org>
parents: 1977
diff changeset
589 UI *ui = (UI*)popup_bw->ui;
ce68c58f2f82 Fix for e816e06ee901: it disabled the preceeding menuitems
Jorge Arellano Cid <jcid@dillo.org>
parents: 1977
diff changeset
590
ce68c58f2f82 Fix for e816e06ee901: it disabled the preceeding menuitems
Jorge Arellano Cid <jcid@dillo.org>
parents: 1977
diff changeset
591 if (VOIDP2INT(user_data) == 10) /* small icons */
ce68c58f2f82 Fix for e816e06ee901: it disabled the preceeding menuitems
Jorge Arellano Cid <jcid@dillo.org>
parents: 1977
diff changeset
592 ui->change_panel(ui->get_panelsize(), !ui->get_smallicons());
ce68c58f2f82 Fix for e816e06ee901: it disabled the preceeding menuitems
Jorge Arellano Cid <jcid@dillo.org>
parents: 1977
diff changeset
593 else
ce68c58f2f82 Fix for e816e06ee901: it disabled the preceeding menuitems
Jorge Arellano Cid <jcid@dillo.org>
parents: 1977
diff changeset
594 ui->change_panel(VOIDP2INT(user_data), ui->get_smallicons());
ce68c58f2f82 Fix for e816e06ee901: it disabled the preceeding menuitems
Jorge Arellano Cid <jcid@dillo.org>
parents: 1977
diff changeset
595 }
ce68c58f2f82 Fix for e816e06ee901: it disabled the preceeding menuitems
Jorge Arellano Cid <jcid@dillo.org>
parents: 1977
diff changeset
596
827
d513abcd4949 Implemented the tools button with CSS options. Also removed nav.h from html.cc
Jorge Arellano Cid <jcid@dillo.org>
parents: 783
diff changeset
597 /*
907
35054b4e3b1b Switched load images on/off feature to the Tools menu
corvid <corvid@lavabit.com>
parents: 888
diff changeset
598 * Toggle loading of images -- and load them if enabling.
930
b277eed3119c whitespace cleanup: 's/ +$//g'
Jorge Arellano Cid <jcid@dillo.org>
parents: 926
diff changeset
599 */
1821
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
600 static void Menu_imgload_toggle_cb(Fl_Widget *wid, void*)
907
35054b4e3b1b Switched load images on/off feature to the Tools menu
corvid <corvid@lavabit.com>
parents: 888
diff changeset
601 {
1821
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
602 Fl_Menu_Item *item = (Fl_Menu_Item*) wid;
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
603
1853
b8aa813dc9c2 tools popup menu
corvid <corvid@lavabit.com>
parents: 1826
diff changeset
604 item->flags ^= FL_MENU_VALUE;
b8aa813dc9c2 tools popup menu
corvid <corvid@lavabit.com>
parents: 1826
diff changeset
605
b8aa813dc9c2 tools popup menu
corvid <corvid@lavabit.com>
parents: 1826
diff changeset
606 if ((prefs.load_images = item->flags & FL_MENU_VALUE ? 1 : 0)) {
926
caf45b6c8535 Fixed the load image popup option. Also cleaned up the API a bit.
corvid <corvid@lavabit.com>
parents: 907
diff changeset
607 void *doc = a_Bw_get_current_doc(popup_bw);
907
35054b4e3b1b Switched load images on/off feature to the Tools menu
corvid <corvid@lavabit.com>
parents: 888
diff changeset
608
35054b4e3b1b Switched load images on/off feature to the Tools menu
corvid <corvid@lavabit.com>
parents: 888
diff changeset
609 if (doc) {
35054b4e3b1b Switched load images on/off feature to the Tools menu
corvid <corvid@lavabit.com>
parents: 888
diff changeset
610 DilloUrl *pattern = NULL;
35054b4e3b1b Switched load images on/off feature to the Tools menu
corvid <corvid@lavabit.com>
parents: 888
diff changeset
611 a_Html_load_images(doc, pattern);
35054b4e3b1b Switched load images on/off feature to the Tools menu
corvid <corvid@lavabit.com>
parents: 888
diff changeset
612 }
35054b4e3b1b Switched load images on/off feature to the Tools menu
corvid <corvid@lavabit.com>
parents: 888
diff changeset
613 }
35054b4e3b1b Switched load images on/off feature to the Tools menu
corvid <corvid@lavabit.com>
parents: 888
diff changeset
614 }
35054b4e3b1b Switched load images on/off feature to the Tools menu
corvid <corvid@lavabit.com>
parents: 888
diff changeset
615
35054b4e3b1b Switched load images on/off feature to the Tools menu
corvid <corvid@lavabit.com>
parents: 888
diff changeset
616 /*
827
d513abcd4949 Implemented the tools button with CSS options. Also removed nav.h from html.cc
Jorge Arellano Cid <jcid@dillo.org>
parents: 783
diff changeset
617 * Tools popup menu (construction & popup)
d513abcd4949 Implemented the tools button with CSS options. Also removed nav.h from html.cc
Jorge Arellano Cid <jcid@dillo.org>
parents: 783
diff changeset
618 */
d513abcd4949 Implemented the tools button with CSS options. Also removed nav.h from html.cc
Jorge Arellano Cid <jcid@dillo.org>
parents: 783
diff changeset
619 void a_Menu_tools_popup(BrowserWindow *bw, void *v_wid)
d513abcd4949 Implemented the tools button with CSS options. Also removed nav.h from html.cc
Jorge Arellano Cid <jcid@dillo.org>
parents: 783
diff changeset
620 {
1853
b8aa813dc9c2 tools popup menu
corvid <corvid@lavabit.com>
parents: 1826
diff changeset
621 const Fl_Menu_Item *item;
1812
7088695ed035 trivial bits of menu
corvid <corvid@lavabit.com>
parents: 1806
diff changeset
622 Fl_Widget *wid = (Fl_Widget*)v_wid;
1977
e816e06ee901 Added a submenu to control the panel size (Tools)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1974
diff changeset
623 UI *ui = (UI*)bw->ui;
1821
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
624
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
625 static Fl_Menu_Item pm[] = {
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
626 {"Use remote CSS", 0, Menu_remote_css_cb, 0, FL_MENU_TOGGLE,0,0,0,0},
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
627 {"Use embedded CSS", 0, Menu_embedded_css_cb, 0,
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
628 FL_MENU_TOGGLE|FL_MENU_DIVIDER,0,0,0,0},
2024
f542084fa707 rm spaces
corvid <corvid@lavabit.com>
parents: 1994
diff changeset
629 {"Load images", 0, Menu_imgload_toggle_cb, 0,
1977
e816e06ee901 Added a submenu to control the panel size (Tools)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1974
diff changeset
630 FL_MENU_TOGGLE|FL_MENU_DIVIDER,0,0,0,0},
2048
5060d415a85a clickable menu items (even those introducing submenus) MUST have callbacks
corvid <corvid@lavabit.com>
parents: 2024
diff changeset
631 {"Panel size", 0, Menu_nop_cb, (void*)"Submenu1", FL_SUBMENU,0,0,0,0},
1983
ce68c58f2f82 Fix for e816e06ee901: it disabled the preceeding menuitems
Jorge Arellano Cid <jcid@dillo.org>
parents: 1977
diff changeset
632 {"tiny", 0,Menu_panel_change_cb,(void*)0,FL_MENU_RADIO,0,0,0,0},
ce68c58f2f82 Fix for e816e06ee901: it disabled the preceeding menuitems
Jorge Arellano Cid <jcid@dillo.org>
parents: 1977
diff changeset
633 {"small", 0,Menu_panel_change_cb,(void*)1,FL_MENU_RADIO,0,0,0,0},
ce68c58f2f82 Fix for e816e06ee901: it disabled the preceeding menuitems
Jorge Arellano Cid <jcid@dillo.org>
parents: 1977
diff changeset
634 {"medium",0,Menu_panel_change_cb,(void*)2,FL_MENU_RADIO,0,0,0,0},
ce68c58f2f82 Fix for e816e06ee901: it disabled the preceeding menuitems
Jorge Arellano Cid <jcid@dillo.org>
parents: 1977
diff changeset
635 {"large", 0,Menu_panel_change_cb,(void*)3,
ce68c58f2f82 Fix for e816e06ee901: it disabled the preceeding menuitems
Jorge Arellano Cid <jcid@dillo.org>
parents: 1977
diff changeset
636 FL_MENU_RADIO|FL_MENU_DIVIDER,0,0,0,0},
1984
dd26b1bebabc Fix for e816e06ee901: part 2 (missing callback)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1983
diff changeset
637 {"small icons", 0,Menu_panel_change_cb,(void*)10,
dd26b1bebabc Fix for e816e06ee901: part 2 (missing callback)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1983
diff changeset
638 FL_MENU_TOGGLE,0,0,0,0},
1987
cf8f1cb01f6a fix panel size menu
corvid <corvid@lavabit.com>
parents: 1984
diff changeset
639 {0,0,0,0,0,0,0,0,0},
1821
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
640 {0,0,0,0,0,0,0,0,0}
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
641 };
827
d513abcd4949 Implemented the tools button with CSS options. Also removed nav.h from html.cc
Jorge Arellano Cid <jcid@dillo.org>
parents: 783
diff changeset
642
d513abcd4949 Implemented the tools button with CSS options. Also removed nav.h from html.cc
Jorge Arellano Cid <jcid@dillo.org>
parents: 783
diff changeset
643 popup_bw = bw;
1977
e816e06ee901 Added a submenu to control the panel size (Tools)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1974
diff changeset
644 int cur_panelsize = ui->get_panelsize();
e816e06ee901 Added a submenu to control the panel size (Tools)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1974
diff changeset
645 int cur_smallicons = ui->get_smallicons();
827
d513abcd4949 Implemented the tools button with CSS options. Also removed nav.h from html.cc
Jorge Arellano Cid <jcid@dillo.org>
parents: 783
diff changeset
646
1821
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
647 if (prefs.load_stylesheets)
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
648 pm[0].set();
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
649 if (prefs.parse_embedded_css)
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
650 pm[1].set();
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
651 if (prefs.load_images)
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
652 pm[2].set();
1977
e816e06ee901 Added a submenu to control the panel size (Tools)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1974
diff changeset
653 pm[4+cur_panelsize].setonly();
e816e06ee901 Added a submenu to control the panel size (Tools)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1974
diff changeset
654 cur_smallicons ? pm[8].set() : pm[8].clear();
1821
fd414a3567e2 fair amount of menu
corvid <corvid@lavabit.com>
parents: 1812
diff changeset
655
1857
b5825a55b34c better menu positioning
corvid <corvid@lavabit.com>
parents: 1853
diff changeset
656 item = pm->popup(wid->x(), wid->y() + wid->h());
1977
e816e06ee901 Added a submenu to control the panel size (Tools)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1974
diff changeset
657 if (item) {
1983
ce68c58f2f82 Fix for e816e06ee901: it disabled the preceeding menuitems
Jorge Arellano Cid <jcid@dillo.org>
parents: 1977
diff changeset
658 ((Fl_Widget *)item)->do_callback();
1977
e816e06ee901 Added a submenu to control the panel size (Tools)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1974
diff changeset
659 }
827
d513abcd4949 Implemented the tools button with CSS options. Also removed nav.h from html.cc
Jorge Arellano Cid <jcid@dillo.org>
parents: 783
diff changeset
660 }
d513abcd4949 Implemented the tools button with CSS options. Also removed nav.h from html.cc
Jorge Arellano Cid <jcid@dillo.org>
parents: 783
diff changeset
661