Dillo v3.1.1-11-g8f0909b7
Loading...
Searching...
No Matches
menu.cc
Go to the documentation of this file.
1/*
2 * File: menu.cc
3 *
4 * Copyright (C) 2005-2007 Jorge Arellano Cid <jcid@dillo.org>
5 * Copyright (C) 2024 Rodrigo Arias Mallo <rodarima@gmail.com>
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 3 of the License, or
10 * (at your option) any later version.
11 */
12
18#include <FL/Fl.H>
19#include <FL/Fl_Menu_Item.H>
20
21#include "lout/misc.hh" /* SimpleVector */
22#include "msg.h"
23#include "menu.hh"
24#include "uicmd.hh"
25#include "history.h"
26#include "html.hh"
27#include "ui.hh" // for (UI *)
28#include "keys.hh"
29#include "timeout.hh"
30
31/*
32 * Local data types
33 */
34
35typedef struct {
36 const char *title;
37 const Fl_Menu_Item *picked;
38 const Fl_Menu_Item *menu;
39} Menu_popup_data_t;
40
41/*
42 * Local data
43 */
44
45// (This data can be encapsulated inside a class for each popup, but
46// as popups are modal, there's no need).
47static DilloUrl *popup_url = NULL;
48// Weak reference to the popup's bw
49static BrowserWindow *popup_bw = NULL;
50static void *popup_form = NULL;
51// Where to place the popup
52static int popup_x, popup_y;
53// History popup direction (-1 = back, 1 = forward).
54static int history_direction = -1;
55// History popup, list of URL-indexes.
56static int *history_list = NULL;
57
58
59//--------------------------------------------------------------------------
60static void Menu_nop_cb(Fl_Widget*, void*)
61{
62}
63
67static void filemenu_cb(Fl_Widget*, void *data)
68{
69 if (strcmp((char*)data, "nw") == 0) {
71 } else if (strcmp((char*)data, "nt") == 0) {
73 } else if (strcmp((char*)data, "of") == 0) {
75 } else if (strcmp((char*)data, "ou") == 0) {
77 } else if (strcmp((char*)data, "cw") == 0) {
79 } else if (strcmp((char*)data, "ed") == 0) {
81 }
82}
83
84
85static void Menu_copy_urlstr_cb(Fl_Widget*, void *user_data)
86{
87 if (user_data) {
88 DilloUrl *url = (DilloUrl *)user_data ;
90 }
91}
92
96static void Menu_open_url_cb(Fl_Widget*, void *user_data)
97{
98 DilloUrl *url = (DilloUrl *)user_data;
99 _MSG("Open URL cb: click! :-)\n");
101}
102
106static void Menu_open_url_nw_cb(Fl_Widget*, void *user_data)
107{
108 DilloUrl *url = (DilloUrl *)user_data;
109 _MSG("Open URL in new window cb: click! :-)\n");
111}
112
116static void Menu_open_url_nt_cb(Fl_Widget*, void *user_data)
117{
118 DilloUrl *url = (DilloUrl *)user_data;
119 int focus = prefs.focus_new_tab ? 1 : 0;
120 if (Fl::event_state(FL_SHIFT)) focus = !focus;
121 a_UIcmd_open_url_nt(popup_bw, url, focus);
122}
123
127static void Menu_add_bookmark_cb(Fl_Widget*, void *user_data)
128{
129 DilloUrl *url = (DilloUrl *)user_data;
131}
132
136static void Menu_find_text_cb(Fl_Widget*, void*)
137{
138 ((UI *)popup_bw->ui)->findbar_toggle(1);
139}
140
144static void Menu_save_link_cb(Fl_Widget*, void *user_data)
145{
146 DilloUrl *url = (DilloUrl *)user_data;
148}
149
153static void Menu_save_page_cb(Fl_Widget*, void*)
154{
156}
157
161static void Menu_view_page_source_cb(Fl_Widget*, void *user_data)
162{
163 DilloUrl *url = (DilloUrl *)user_data;
165}
166
170static void Menu_view_page_bugs_cb(Fl_Widget*, void*)
171{
173}
174
178static void Menu_load_images_cb(Fl_Widget*, void *user_data)
179{
180 DilloUrl *page_url = (DilloUrl *) user_data;
181 void *doc = a_Bw_get_url_doc(popup_bw, page_url);
182
183 if (doc)
185}
186
190static void Menu_form_submit_cb(Fl_Widget*, void*)
191{
192 void *doc = a_Bw_get_url_doc(popup_bw, popup_url);
193
194 if (doc)
196}
197
201static void Menu_form_reset_cb(Fl_Widget*, void*)
202{
203 void *doc = a_Bw_get_url_doc(popup_bw, popup_url);
204
205 if (doc)
207}
208
212static void Menu_form_hiddens_cb(Fl_Widget*, void *user_data)
213{
214 bool visible = *((bool *) user_data);
215 void *doc = a_Bw_get_url_doc(popup_bw, popup_url);
216
217 if (doc)
219}
220
221static void Menu_stylesheet_cb(Fl_Widget*, void *vUrl)
222{
223 int mb = Fl::event_button();
224 const DilloUrl *url = (const DilloUrl *) vUrl;
225
226 if (mb == 1) {
228 } else if (mb == 2) {
230 int focus = prefs.focus_new_tab ? 1 : 0;
231 if (Fl::event_state(FL_SHIFT)) focus = !focus;
232 a_UIcmd_open_url_nt(popup_bw, url, focus);
233 } else {
235 }
236 }
237}
238
239static void Menu_bugmeter_validate(const char *validator_url)
240{
241 if (popup_url &&
243 const char *popup_str = URL_STR(popup_url),
244 *ptr = strrchr(popup_str, '#');
245 char *no_fragment = ptr ? dStrndup(popup_str, ptr - popup_str)
246 : dStrdup(popup_str);
247 char *encoded = a_Url_encode_hex_str(no_fragment);
248 Dstr *dstr = dStr_sized_new(128);
249
250 dStr_sprintf(dstr, validator_url, encoded);
252 dStr_free(dstr, 1);
253 dFree(encoded);
254 dFree(no_fragment);
255 }
256}
257
261static void Menu_bugmeter_validate_w3c_nu_cb(Fl_Widget*, void*)
262{
264 "https://validator.w3.org/nu/"
265 "?useragent=Validator.nu%%2FLV+https%%3A%%2F%%2Fvalidator.w3.org%%2Fservices"
266 "&acceptlanguage="
267 "&doc=%s");
268}
269
273static void Menu_bugmeter_validate_w3c_cb(Fl_Widget*, void*)
274{
276 "https://validator.w3.org/check?uri=%s"
277 "&charset=%%28detect+automatically%%29"
278 "&doctype=Inline&group=0"
279 "&user-agent=W3C_Validator%%2F1.3+");
280}
281
285static void Menu_bugmeter_about_cb(Fl_Widget*, void*)
286{
287 a_UIcmd_open_urlstr(popup_bw, "https://dillo-browser.github.io/old/help/bug_meter.html");
288}
289
294static void Menu_history_cb(Fl_Widget*, void *data)
295{
296 int mb = Fl::event_button();
297 int offset = history_direction * VOIDP2INT(data);
298 const DilloUrl *url = a_History_get_url(history_list[VOIDP2INT(data)-1]);
299
300 if (mb == 1) {
301 a_UIcmd_nav_jump(popup_bw, offset, 0);
302 } else if (mb == 2) {
303 // Middle button, open in a new window/tab
305 int focus = prefs.focus_new_tab ? 1 : 0;
306 if (Fl::event_state(FL_SHIFT)) focus = !focus;
307 a_UIcmd_open_url_nt(popup_bw, url, focus);
308 } else {
310 }
311 }
312}
313
314/*
315 * Menus are popped-up from this timeout callback so the events
316 * associated with the button are gone when it pops. This way we
317 * avoid a segfault when a new page replaces the page that issued
318 * the popup menu.
319 */
320static void Menu_simple_popup_cb(void *data)
321{
322 const Fl_Menu_Item *m;
323
324 ((UI*)popup_bw->ui)->window()->cursor(FL_CURSOR_DEFAULT);
325
326 m = ((Fl_Menu_Item *)data)->popup(popup_x, popup_y);
327
328 if (m && m->callback())
329 m->do_callback((Fl_Widget *)data);
331}
332
333static void Menu_popup_cb(void *data)
334{
335 const Fl_Menu_Item *picked;
336 Menu_popup_data_t *d = (Menu_popup_data_t *)data;
337
338 ((UI*)popup_bw->ui)->window()->cursor(FL_CURSOR_DEFAULT);
339
340 picked = d->menu->popup(popup_x, popup_y, d->title, d->picked);
341 if (picked) {
342 d->picked = picked;
343 if (picked->callback())
344 picked->do_callback((Fl_Widget *)(d->menu));
345 }
347}
348
353 bool_t has_bugs, void *v_cssUrls)
354{
355 lout::misc::SimpleVector <DilloUrl*> *cssUrls =
356 (lout::misc::SimpleVector <DilloUrl*> *) v_cssUrls;
357 int j = 0;
358
359 static Fl_Menu_Item *stylesheets = NULL;
360 static Fl_Menu_Item pm[] = {
361 {"View page source", 0, Menu_view_page_source_cb,0,0,0,0,0,0},
362 {"View page bugs", 0, Menu_view_page_bugs_cb,0,0,0,0,0,0},
363 {"View stylesheets", 0, Menu_nop_cb,0,FL_SUBMENU_POINTER|FL_MENU_DIVIDER,
364 0,0,0,0},
365 {"Bookmark this page", 0,Menu_add_bookmark_cb,0,FL_MENU_DIVIDER,0,0,0,0},
366 {"Find text", 0, Menu_find_text_cb,0,0,0,0,0,0},
367 {"Save page as...", 0, Menu_save_page_cb,0,0,0,0,0,0},
368 {0,0,0,0,0,0,0,0,0}
369 };
370 static Menu_popup_data_t page_data = {"Page menu", NULL, pm};
371
372 popup_x = Fl::event_x();
373 popup_y = Fl::event_y();
374 popup_bw = bw;
376 popup_url = a_Url_dup(url);
377
378 has_bugs == TRUE ? pm[1].activate() : pm[1].deactivate();
379
380 if (dStrAsciiCasecmp(URL_SCHEME(url), "dpi") == 0 &&
381 strncmp(URL_PATH(url), "/vsource/", 9) == 0)
382 pm[0].deactivate();
383 else {
384 pm[0].activate();
385 pm[0].user_data(popup_url);
386 }
387
388 if (stylesheets) {
389 while (stylesheets[j].text) {
390 dFree((char *) stylesheets[j].label());
391 a_Url_free((DilloUrl *) stylesheets[j].user_data());
392 j++;
393 }
394 delete [] stylesheets;
395 stylesheets = NULL;
396 }
397
398 if (cssUrls && cssUrls->size () > 0) {
399 stylesheets = new Fl_Menu_Item[cssUrls->size() + 1];
400 memset(stylesheets, '\0', sizeof(Fl_Menu_Item[cssUrls->size() + 1]));
401
402 for (j = 0; j < cssUrls->size(); j++) {
403 DilloUrl *url = cssUrls->get(j);
404 const char *url_str = URL_STR(url);
405 const uint_t head_length = 30, tail_length = 40,
406 url_len = strlen(url_str);
407 char *label;
408
409 if (url_len > head_length + tail_length + 3) {
410 /* trim long URLs when making the label */
411 char *url_head = dStrndup(url_str, head_length);
412 const char *url_tail = url_str + (url_len - tail_length);
413 label = dStrconcat(url_head, "...", url_tail, NULL);
414 dFree(url_head);
415 } else {
416 label = dStrdup(url_str);
417 }
418
419 stylesheets[j].label(FL_NORMAL_LABEL, label);
420 stylesheets[j].callback(Menu_stylesheet_cb, a_Url_dup(url));
421 }
422
423 pm[2].user_data(stylesheets);
424 pm[2].activate();
425 } else {
426 pm[2].deactivate();
427 }
428 pm[3].user_data(popup_url);
429
430 a_Timeout_add(0.0, Menu_popup_cb, (void*)&page_data);
431}
432
433static Fl_Menu_Item link_menu[] = {
434 {"Open link in new tab", 0, Menu_open_url_nt_cb,0,0,0,0,0,0},
435 {"Open link in new window", 0, Menu_open_url_nw_cb,0,FL_MENU_DIVIDER,0,0,
436 0,0},
437 {"Bookmark this link", 0, Menu_add_bookmark_cb,0,0,0,0,0,0},
438 {"Copy link location", 0, Menu_copy_urlstr_cb,0,FL_MENU_DIVIDER,0,0,0,0},
439 {"Save link as...", 0, Menu_save_link_cb,0,0,0,0,0,0},
440 {0,0,0,0,0,0,0,0,0}
441};
442
443static void Menu_set_link_menu_user_data(void *user_data)
444{
445 int i;
446
447 for (i = 0; link_menu[i].label(); i++)
448 link_menu[i].user_data(user_data);
449}
450
455{
456 static Menu_popup_data_t link_data = {"Link menu", NULL, link_menu};
457
458 popup_x = Fl::event_x();
459 popup_y = Fl::event_y();
460 popup_bw = bw;
462 popup_url = a_Url_dup(url);
463
465
466 a_Timeout_add(0.0, Menu_popup_cb, (void*)&link_data);
467}
468
473 bool_t loaded_img, DilloUrl *page_url,
474 DilloUrl *link_url)
475{
476 static DilloUrl *popup_page_url = NULL;
477 static DilloUrl *popup_link_url = NULL;
478 static Fl_Menu_Item pm[] = {
479 {"Isolate image", 0, Menu_open_url_cb,0,0,0,0,0,0},
480 {"Open image in new tab", 0, Menu_open_url_nt_cb,0,0,0,0,0,0},
481 {"Open image in new window", 0, Menu_open_url_nw_cb, 0, FL_MENU_DIVIDER,
482 0,0,0,0},
483 {"Load image", 0, Menu_load_images_cb,0,0,0,0,0,0},
484 {"Bookmark this image", 0, Menu_add_bookmark_cb,0,0,0,0,0,0},
485 {"Copy image location", 0,Menu_copy_urlstr_cb,0,FL_MENU_DIVIDER,0,0,0,0},
486 {"Save image as...", 0, Menu_save_link_cb, 0, FL_MENU_DIVIDER,0,0,0,0},
487 {"Link menu", 0, Menu_nop_cb, link_menu, FL_SUBMENU_POINTER,0,0,0,0},
488 {0,0,0,0,0,0,0,0,0}
489 };
490 static Menu_popup_data_t image_data = {"Image menu", NULL, pm};
491
492 popup_x = Fl::event_x();
493 popup_y = Fl::event_y();
494 popup_bw = bw;
496 popup_url = a_Url_dup(url);
497 a_Url_free(popup_page_url);
498 popup_page_url = a_Url_dup(page_url);
499 a_Url_free(popup_link_url);
500 popup_link_url = a_Url_dup(link_url);
501
502
503 pm[0].user_data(popup_url);
504 pm[1].user_data(popup_url);
505 pm[2].user_data(popup_url);
506
507 if (loaded_img) {
508 pm[3].deactivate();
509 } else {
510 pm[3].activate();
511 pm[3].user_data(popup_page_url);
512 }
513
514 pm[4].user_data(popup_url);
515 pm[5].user_data(popup_url);
516 pm[6].user_data(popup_url);
517
518 if (link_url) {
519 pm[7].activate();
520 Menu_set_link_menu_user_data(popup_link_url);
521 } else {
522 pm[7].deactivate();
523 }
524
525 a_Timeout_add(0.0, Menu_popup_cb, (void*)&image_data);
526}
527
531void a_Menu_form_popup(BrowserWindow *bw, const DilloUrl *page_url,
532 void *formptr, bool_t hidvis)
533{
534 static bool hiddens_visible;
535 static Fl_Menu_Item pm[] = {
536 {"Submit form", 0, Menu_form_submit_cb,0,0,0,0,0,0},
537 {"Reset form", 0, Menu_form_reset_cb,0,0,0,0,0,0},
538 {0, 0, Menu_form_hiddens_cb, &hiddens_visible, 0,0,0,0,0},
539 {0,0,0,0,0,0,0,0,0}
540 };
541 static Menu_popup_data_t form_data = {"Form menu", NULL, pm};
542
543 popup_x = Fl::event_x();
544 popup_y = Fl::event_y();
545 popup_bw = bw;
547 popup_url = a_Url_dup(page_url);
548 popup_form = formptr;
549
550 hiddens_visible = hidvis;
551 pm[2].label(hiddens_visible ? "Hide hiddens": "Show hiddens");
552
553 a_Timeout_add(0.0, Menu_popup_cb, (void*)&form_data);
554}
555
559void a_Menu_file_popup(BrowserWindow *bw, void *v_wid)
560{
561 Fl_Widget *wid = (Fl_Widget*)v_wid;
562
563 static Fl_Menu_Item pm[] = {
565 (void*)"nt",0,0,0,0,0},
567 (void*)"nw", FL_MENU_DIVIDER,0,0,0,0},
568 {"Open file...", Keys::getShortcut(KEYS_OPEN), filemenu_cb,
569 (void*)"of",0,0,0,0,0},
570 {"Open URL...", Keys::getShortcut(KEYS_GOTO), filemenu_cb,
571 (void*)"ou",0,0,0,0,0},
573 (void*)"cw", FL_MENU_DIVIDER,0,0,0,0},
575 (void*)"ed",0,0,0,0,0},
576 {0,0,0,0,0,0,0,0,0}
577 };
578
579 popup_bw = bw;
580 popup_x = wid->x();
581 popup_y = wid->y() + wid->h();
583 popup_url = NULL;
584
585 //pm->label(wid->visible() ? NULL : "File");
586 a_Timeout_add(0.0, Menu_simple_popup_cb, (void*)pm);
587}
588
593{
594 static Fl_Menu_Item pm[] = {
595 {"Validate URL with W3C Nu validator (HTML5 only)", 0,
597 {"Validate URL with W3C validator (HTML 4.01 and older)", 0,
598 Menu_bugmeter_validate_w3c_cb,0,FL_MENU_DIVIDER,0,0,0,0},
599 {"About bug meter", 0,
600 Menu_bugmeter_about_cb,0,0,0,0,0,0},
601 {0,0,0,0,0,0,0,0,0}
602 };
603
604 popup_x = Fl::event_x();
605 popup_y = Fl::event_y();
606 popup_bw = bw;
608 popup_url = a_Url_dup(url);
609
610 a_Timeout_add(0.0, Menu_simple_popup_cb, (void*)pm);
611}
612
618void a_Menu_history_popup(BrowserWindow *bw, int x, int y, int direction)
619{
620 static Fl_Menu_Item *pm = 0;
621 int i, n;
622
623 popup_bw = bw;
624 popup_x = x;
625 popup_y = y;
626 history_direction = direction;
627
628 // TODO: hook popdown event with delete or similar.
629 if (pm)
630 delete [] pm;
631 if (history_list)
633
634 // Get a list of URLs for this popup
635 history_list = a_UIcmd_get_history(bw, direction);
636
637 for (n = 0; history_list[n] != -1; n++)
638 ;
639
640 pm = new Fl_Menu_Item[n + 1];
641 memset(pm, '\0', sizeof(Fl_Menu_Item[n + 1]));
642
643 for (i = 0; i < n; i++) {
644 pm[i].label(FL_NORMAL_LABEL, a_History_get_title(history_list[i], 1));
645 pm[i].callback(Menu_history_cb, INT2VOIDP(i+1));
646 }
647 a_Timeout_add(0.0, Menu_simple_popup_cb, (void*)pm);
648}
649
653static void Menu_remote_css_cb(Fl_Widget *wid, void*)
654{
655 Fl_Menu_Item *item = (Fl_Menu_Item*) wid;
656
657 item->flags ^= FL_MENU_VALUE;
658 prefs.load_stylesheets = item->flags & FL_MENU_VALUE ? 1 : 0;
660}
661
665static void Menu_embedded_css_cb(Fl_Widget *wid, void*)
666{
667 Fl_Menu_Item *item = (Fl_Menu_Item*) wid;
668
669 item->flags ^= FL_MENU_VALUE;
670 prefs.parse_embedded_css = item->flags & FL_MENU_VALUE ? 1 : 0;
672}
673
674
678static void Menu_force_https_cb(Fl_Widget *wid, void*)
679{
680 Fl_Menu_Item *item = (Fl_Menu_Item*) wid;
681
682 item->flags ^= FL_MENU_VALUE;
683 prefs.http_force_https = item->flags & FL_MENU_VALUE ? 1 : 0;
685}
686
687static void Menu_panel_change_cb(Fl_Widget*, void *user_data)
688{
689 UI *ui = (UI*)popup_bw->ui;
690
691 if (VOIDP2INT(user_data) == 10) /* small icons */
692 ui->change_panel(ui->get_panelsize(), !ui->get_smallicons());
693 else
694 ui->change_panel(VOIDP2INT(user_data), ui->get_smallicons());
695}
696
700static void Menu_imgload_toggle_cb(Fl_Widget *wid, void*)
701{
702 Fl_Menu_Item *item = (Fl_Menu_Item*) wid;
703
704 item->flags ^= FL_MENU_VALUE;
705
706 if ((prefs.load_images = item->flags & FL_MENU_VALUE ? 1 : 0)) {
707 void *doc = a_Bw_get_current_doc(popup_bw);
708
709 if (doc) {
710 DilloUrl *pattern = NULL;
711 a_Html_load_images(doc, pattern);
712 }
713 }
714}
715
719static void Menu_bgimg_load_toggle_cb(Fl_Widget *wid, void*)
720{
721 Fl_Menu_Item *item = (Fl_Menu_Item*) wid;
722
723 item->flags ^= FL_MENU_VALUE;
724 prefs.load_background_images = item->flags & FL_MENU_VALUE ? 1 : 0;
726}
727
731void a_Menu_tools_popup(BrowserWindow *bw, int x, int y)
732{
733 const Fl_Menu_Item *item;
734 UI *ui = (UI*)bw->ui;
735
736 static Fl_Menu_Item pm[] = {
737 {"Use remote CSS", 0, Menu_remote_css_cb, 0, FL_MENU_TOGGLE,0,0,0,0},
738 {"Use embedded CSS", 0, Menu_embedded_css_cb, 0,
739 FL_MENU_TOGGLE|FL_MENU_DIVIDER,0,0,0,0},
740 {"Load images", 0, Menu_imgload_toggle_cb, 0,
741 FL_MENU_TOGGLE,0,0,0,0},
742 {"Load background images", 0, Menu_bgimg_load_toggle_cb, 0,
743 FL_MENU_TOGGLE|FL_MENU_DIVIDER,0,0,0,0},
744 {"Force HTTPS", 0, Menu_force_https_cb, 0,
745 FL_MENU_TOGGLE|FL_MENU_DIVIDER,0,0,0,0},
746 {"Panel size", 0, Menu_nop_cb, (void*)"Submenu1", FL_SUBMENU,0,0,0,0},
747 {"tiny", 0,Menu_panel_change_cb,(void*)0,FL_MENU_RADIO,0,0,0,0},
748 {"small", 0,Menu_panel_change_cb,(void*)1,FL_MENU_RADIO,0,0,0,0},
749 {"medium",0,Menu_panel_change_cb,(void*)2,
750 FL_MENU_RADIO|FL_MENU_DIVIDER,0,0,0,0},
751 {"small icons", 0,Menu_panel_change_cb,(void*)10,
752 FL_MENU_TOGGLE,0,0,0,0},
753 {0,0,0,0,0,0,0,0,0},
754 {0,0,0,0,0,0,0,0,0}
755 };
756
757 popup_bw = bw;
758 int cur_panelsize = ui->get_panelsize();
759 int cur_smallicons = ui->get_smallicons();
760
762 pm[0].set();
764 pm[1].set();
765 if (prefs.load_images)
766 pm[2].set();
768 pm[3].set();
770 pm[4].set();
771 pm[6+cur_panelsize].setonly();
772 cur_smallicons ? pm[9].set() : pm[9].clear();
773
774 item = pm->popup(x, y);
775 if (item) {
776 ((Fl_Widget *)item)->do_callback();
777 }
778}
779
#define _MSG(...)
Definition bookmarks.c:45
void * a_Bw_get_url_doc(BrowserWindow *bw, const DilloUrl *url)
Get document by URL.
Definition bw.c:250
void * a_Bw_get_current_doc(BrowserWindow *bw)
Get current document.
Definition bw.c:231
static int getShortcut(KeysCommand_t cmd)
Given a keys command, return a shortcut for it, or 0 if there is none (e.g., for KEYS_NEW_WINDOW,...
Definition keys.cc:298
Definition ui.hh:123
int get_panelsize()
Definition ui.hh:173
void change_panel(int new_size, int small_icons)
On-the-fly panel style change.
Definition ui.cc:985
int get_smallicons()
Definition ui.hh:174
T get(int i) const
Return the one element, explicitly.
Definition misc.hh:201
int size() const
Return the number of elements put into this vector.
Definition misc.hh:141
unsigned int uint_t
Definition d_size.h:20
unsigned char bool_t
Definition d_size.h:21
char * dStrconcat(const char *s1,...)
Concatenate a NULL-terminated list of strings.
Definition dlib.c:100
void dFree(void *mem)
Definition dlib.c:66
int dStrAsciiCasecmp(const char *s1, const char *s2)
Definition dlib.c:201
char * dStrdup(const char *s)
Definition dlib.c:75
Dstr * dStr_sized_new(int sz)
Create a new string with a given size.
Definition dlib.c:252
void dStr_free(Dstr *ds, int all)
Free a dillo string.
Definition dlib.c:335
char * dStrndup(const char *s, size_t sz)
Definition dlib.c:86
void dStr_sprintf(Dstr *ds, const char *format,...)
Printf-like function.
Definition dlib.c:448
#define VOIDP2INT(p)
Definition dlib.h:43
#define TRUE
Definition dlib.h:23
#define INT2VOIDP(i)
Definition dlib.h:44
const DilloUrl * a_History_get_url(int idx)
Return the DilloUrl field (by index)
Definition history.c:80
const char * a_History_get_title(int idx, int force)
Return the title field (by index) ('force' returns URL_STR when there's no title)
Definition history.c:94
void a_Html_form_display_hiddens(void *v_html, void *v_form, bool_t display)
Used by the "Show/Hide hiddens" form menuitem.
Definition html.cc:278
void a_Html_form_submit(void *v_html, void *v_form)
Used by the "Submit form" form menuitem.
Definition html.cc:252
void a_Html_load_images(void *v_html, DilloUrl *pattern)
Used by the "Load images" page menuitem.
Definition html.cc:229
void a_Html_form_reset(void *v_html, void *v_form)
Used by the "Reset form" form menuitem.
Definition html.cc:265
@ KEYS_CLOSE_ALL
Definition keys.hh:36
@ KEYS_GOTO
Definition keys.hh:39
@ KEYS_OPEN
Definition keys.hh:20
@ KEYS_NEW_WINDOW
Definition keys.hh:21
@ KEYS_NEW_TAB
Definition keys.hh:22
@ KEYS_CLOSE_TAB
Definition keys.hh:25
static void Menu_copy_urlstr_cb(Fl_Widget *, void *user_data)
Definition menu.cc:85
static int popup_y
Definition menu.cc:52
static void Menu_add_bookmark_cb(Fl_Widget *, void *user_data)
Add bookmark.
Definition menu.cc:127
void a_Menu_page_popup(BrowserWindow *bw, const DilloUrl *url, bool_t has_bugs, void *v_cssUrls)
Page popup menu (construction & popup)
Definition menu.cc:352
static void Menu_panel_change_cb(Fl_Widget *, void *user_data)
Definition menu.cc:687
static void Menu_popup_cb(void *data)
Definition menu.cc:333
static Fl_Menu_Item link_menu[]
Definition menu.cc:433
void a_Menu_file_popup(BrowserWindow *bw, void *v_wid)
File popup menu (construction & popup)
Definition menu.cc:559
static void Menu_embedded_css_cb(Fl_Widget *wid, void *)
Toggle use of embedded CSS style.
Definition menu.cc:665
static void Menu_bugmeter_about_cb(Fl_Widget *, void *)
Show info page for the bug meter.
Definition menu.cc:285
static void Menu_bgimg_load_toggle_cb(Fl_Widget *wid, void *)
Toggle loading of background images.
Definition menu.cc:719
static void Menu_open_url_nw_cb(Fl_Widget *, void *user_data)
Open URL in new window.
Definition menu.cc:106
void a_Menu_tools_popup(BrowserWindow *bw, int x, int y)
Tools popup menu (construction & popup).
Definition menu.cc:731
static void Menu_open_url_cb(Fl_Widget *, void *user_data)
Open URL.
Definition menu.cc:96
static void Menu_save_link_cb(Fl_Widget *, void *user_data)
Save link.
Definition menu.cc:144
static void Menu_view_page_bugs_cb(Fl_Widget *, void *)
View current page's bugs.
Definition menu.cc:170
static void Menu_bugmeter_validate_w3c_nu_cb(Fl_Widget *, void *)
Validate URL with the W3C Nu validator (for HTML 5)
Definition menu.cc:261
static void Menu_stylesheet_cb(Fl_Widget *, void *vUrl)
Definition menu.cc:221
static void Menu_bugmeter_validate_w3c_cb(Fl_Widget *, void *)
Validate URL with the W3C legacy validator (HTML 4.01 and older)
Definition menu.cc:273
static void Menu_force_https_cb(Fl_Widget *wid, void *)
Toggle use of force https mode.
Definition menu.cc:678
static void Menu_form_hiddens_cb(Fl_Widget *, void *user_data)
Toggle display of 'hidden' form controls.
Definition menu.cc:212
static void Menu_form_submit_cb(Fl_Widget *, void *)
Submit form.
Definition menu.cc:190
static void Menu_save_page_cb(Fl_Widget *, void *)
Save current page.
Definition menu.cc:153
static void Menu_simple_popup_cb(void *data)
Definition menu.cc:320
static void filemenu_cb(Fl_Widget *, void *data)
Static function for File menu callbacks.
Definition menu.cc:67
static void Menu_bugmeter_validate(const char *validator_url)
Definition menu.cc:239
static void Menu_set_link_menu_user_data(void *user_data)
Definition menu.cc:443
static void Menu_form_reset_cb(Fl_Widget *, void *)
Reset form.
Definition menu.cc:201
static void Menu_view_page_source_cb(Fl_Widget *, void *user_data)
View current page source.
Definition menu.cc:161
static void * popup_form
Definition menu.cc:50
static void Menu_open_url_nt_cb(Fl_Widget *, void *user_data)
Open URL in new Tab.
Definition menu.cc:116
static void Menu_find_text_cb(Fl_Widget *, void *)
Find text.
Definition menu.cc:136
static void Menu_history_cb(Fl_Widget *, void *data)
Navigation History callback.
Definition menu.cc:294
static void Menu_load_images_cb(Fl_Widget *, void *user_data)
Load images on current page that match URL pattern.
Definition menu.cc:178
static int popup_x
Definition menu.cc:52
void a_Menu_image_popup(BrowserWindow *bw, const DilloUrl *url, bool_t loaded_img, DilloUrl *page_url, DilloUrl *link_url)
Image popup menu (construction & popup)
Definition menu.cc:472
void a_Menu_bugmeter_popup(BrowserWindow *bw, const DilloUrl *url)
Bugmeter popup menu (construction & popup)
Definition menu.cc:592
static int * history_list
Definition menu.cc:56
static void Menu_imgload_toggle_cb(Fl_Widget *wid, void *)
Toggle loading of images – and load them if enabling.
Definition menu.cc:700
void a_Menu_history_popup(BrowserWindow *bw, int x, int y, int direction)
Navigation History popup menu (construction & popup).
Definition menu.cc:618
static BrowserWindow * popup_bw
Definition menu.cc:49
static void Menu_remote_css_cb(Fl_Widget *wid, void *)
Toggle use of remote stylesheets.
Definition menu.cc:653
void a_Menu_form_popup(BrowserWindow *bw, const DilloUrl *page_url, void *formptr, bool_t hidvis)
Form popup menu (construction & popup)
Definition menu.cc:531
static int history_direction
Definition menu.cc:54
static void Menu_nop_cb(Fl_Widget *, void *)
Definition menu.cc:60
void a_Menu_link_popup(BrowserWindow *bw, const DilloUrl *url)
Link popup menu (construction & popup)
Definition menu.cc:454
static DilloUrl * popup_url
Definition menu.cc:47
DilloPrefs prefs
Global Data.
Definition prefs.c:33
Contains the specific data for a single window.
Definition bw.h:27
void * ui
Pointer to the UI object this bw belongs to.
Definition bw.h:29
bool_t parse_embedded_css
Definition prefs.h:99
bool_t load_images
Definition prefs.h:96
bool_t focus_new_tab
Definition prefs.h:74
bool_t load_background_images
Definition prefs.h:97
bool_t load_stylesheets
Definition prefs.h:98
bool_t http_force_https
Definition prefs.h:102
bool_t middle_click_opens_new_tab
Definition prefs.h:110
Definition url.h:88
Definition dlib.h:102
Dstr_char_t * str
Definition dlib.h:105
void a_Timeout_add(float t, TimeoutCb_t cb, void *cbdata)
Hook a one-time timeout function 'cb' after 't' seconds with 'cbdata" as its data.
Definition timeout.cc:25
void a_Timeout_remove()
Stop running a timeout function.
Definition timeout.cc:41
void a_UIcmd_copy_urlstr(BrowserWindow *bw, const char *urlstr)
Definition uicmd.cc:1255
void a_UIcmd_close_bw(void *vbw)
Definition uicmd.cc:655
int * a_UIcmd_get_history(BrowserWindow *bw, int direction)
Definition uicmd.cc:1324
void a_UIcmd_open_file(void *vbw)
Definition uicmd.cc:1102
void a_UIcmd_focus_location(void *vbw)
Definition uicmd.cc:1602
void a_UIcmd_open_url_nw(BrowserWindow *bw, const DilloUrl *url)
Definition uicmd.cc:798
void a_UIcmd_view_page_source(BrowserWindow *bw, const DilloUrl *url)
Definition uicmd.cc:1264
void a_UIcmd_view_page_bugs(void *vbw)
Definition uicmd.cc:1299
void a_UIcmd_nav_jump(BrowserWindow *bw, int offset, int new_bw)
Definition uicmd.cc:1348
void a_UIcmd_open_urlstr(void *vbw, const char *urlstr)
Definition uicmd.cc:722
void a_UIcmd_save(void *vbw)
Definition uicmd.cc:1059
void a_UIcmd_save_link(BrowserWindow *bw, const DilloUrl *url)
Definition uicmd.cc:1184
void a_UIcmd_repush(void *vbw)
Definition uicmd.cc:875
void a_UIcmd_close_all_bw(void *)
Definition uicmd.cc:676
void a_UIcmd_add_bookmark(BrowserWindow *bw, const DilloUrl *url)
Definition uicmd.cc:1202
void a_UIcmd_open_url(BrowserWindow *bw, const DilloUrl *url)
Definition uicmd.cc:763
void a_UIcmd_open_url_nt(void *vbw, const DilloUrl *url, int focus)
Definition uicmd.cc:814
char * a_Url_encode_hex_str(const char *str)
Urlencode 'str'.
Definition url.c:619
void a_Url_free(DilloUrl *url)
Free a DilloUrl.
Definition url.c:207
DilloUrl * a_Url_dup(const DilloUrl *ori)
Duplicate a Url structure.
Definition url.c:476
#define URL_PATH(u)
Definition url.h:72
#define URL_STR(u)
Definition url.h:76
#define URL_SCHEME(u)
Definition url.h:70