19#include <FL/Fl_Menu_Item.H>
37 const Fl_Menu_Item *picked;
38 const Fl_Menu_Item *menu;
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) {
99 _MSG(
"Open URL cb: click! :-)\n");
109 _MSG(
"Open URL in new window cb: click! :-)\n");
120 if (Fl::event_state(FL_SHIFT)) focus = !focus;
214 bool visible = *((
bool *) user_data);
223 int mb = Fl::event_button();
228 }
else if (mb == 2) {
231 if (Fl::event_state(FL_SHIFT)) focus = !focus;
244 *ptr = strrchr(popup_str,
'#');
245 char *no_fragment = ptr ?
dStrndup(popup_str, ptr - popup_str)
264 "https://validator.w3.org/nu/"
265 "?useragent=Validator.nu%%2FLV+https%%3A%%2F%%2Fvalidator.w3.org%%2Fservices"
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+");
296 int mb = Fl::event_button();
302 }
else if (mb == 2) {
306 if (Fl::event_state(FL_SHIFT)) focus = !focus;
322 const Fl_Menu_Item *m;
324 ((
UI*)
popup_bw->
ui)->window()->cursor(FL_CURSOR_DEFAULT);
328 if (m && m->callback())
329 m->do_callback((Fl_Widget *)data);
335 const Fl_Menu_Item *picked;
336 Menu_popup_data_t *d = (Menu_popup_data_t *)data;
338 ((
UI*)
popup_bw->
ui)->window()->cursor(FL_CURSOR_DEFAULT);
343 if (picked->callback())
344 picked->do_callback((Fl_Widget *)(d->menu));
353 bool_t has_bugs,
void *v_cssUrls)
355 lout::misc::SimpleVector <DilloUrl*> *cssUrls =
356 (lout::misc::SimpleVector <DilloUrl*> *) v_cssUrls;
359 static Fl_Menu_Item *stylesheets = NULL;
360 static Fl_Menu_Item pm[] = {
363 {
"View stylesheets", 0,
Menu_nop_cb,0,FL_SUBMENU_POINTER|FL_MENU_DIVIDER,
370 static Menu_popup_data_t page_data = {
"Page menu", NULL, pm};
378 has_bugs ==
TRUE ? pm[1].activate() : pm[1].deactivate();
381 strncmp(
URL_PATH(url),
"/vsource/", 9) == 0)
389 while (stylesheets[j].text) {
390 dFree((
char *) stylesheets[j].label());
394 delete [] stylesheets;
398 if (cssUrls && cssUrls->
size () > 0) {
399 stylesheets =
new Fl_Menu_Item[cssUrls->
size() + 1];
400 memset(stylesheets,
'\0', (cssUrls->
size() + 1) *
sizeof(Fl_Menu_Item));
402 for (j = 0; j < cssUrls->
size(); 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);
409 if (url_len > head_length + tail_length + 3) {
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);
419 stylesheets[j].label(FL_NORMAL_LABEL, label);
423 pm[2].user_data(stylesheets);
456 static Menu_popup_data_t link_data = {
"Link menu", NULL,
link_menu};
476 static DilloUrl *popup_page_url = NULL;
477 static DilloUrl *popup_link_url = NULL;
478 static Fl_Menu_Item pm[] = {
490 static Menu_popup_data_t image_data = {
"Image menu", NULL, pm};
511 pm[3].user_data(popup_page_url);
532 void *formptr,
bool_t hidvis)
534 static bool hiddens_visible;
535 static Fl_Menu_Item pm[] = {
541 static Menu_popup_data_t form_data = {
"Form menu", NULL, pm};
550 hiddens_visible = hidvis;
551 pm[2].label(hiddens_visible ?
"Hide hiddens":
"Show hiddens");
561 Fl_Widget *wid = (Fl_Widget*)v_wid;
563 static Fl_Menu_Item pm[] = {
565 (
void*)
"nt",0,0,0,0,0},
567 (
void*)
"nw", FL_MENU_DIVIDER,0,0,0,0},
569 (
void*)
"of",0,0,0,0,0},
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},
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,
599 {
"About bug meter", 0,
620 static Fl_Menu_Item *pm = 0;
640 pm =
new Fl_Menu_Item[n + 1];
641 memset(pm,
'\0', (n + 1) *
sizeof(Fl_Menu_Item));
643 for (i = 0; i < n; i++) {
655 Fl_Menu_Item *item = (Fl_Menu_Item*) wid;
657 item->flags ^= FL_MENU_VALUE;
667 Fl_Menu_Item *item = (Fl_Menu_Item*) wid;
669 item->flags ^= FL_MENU_VALUE;
680 Fl_Menu_Item *item = (Fl_Menu_Item*) wid;
682 item->flags ^= FL_MENU_VALUE;
702 Fl_Menu_Item *item = (Fl_Menu_Item*) wid;
704 item->flags ^= FL_MENU_VALUE;
721 Fl_Menu_Item *item = (Fl_Menu_Item*) wid;
723 item->flags ^= FL_MENU_VALUE;
733 const Fl_Menu_Item *item;
736 static Fl_Menu_Item pm[] = {
739 FL_MENU_TOGGLE|FL_MENU_DIVIDER,0,0,0,0},
741 FL_MENU_TOGGLE,0,0,0,0},
743 FL_MENU_TOGGLE|FL_MENU_DIVIDER,0,0,0,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},
750 FL_MENU_RADIO|FL_MENU_DIVIDER,0,0,0,0},
752 FL_MENU_TOGGLE,0,0,0,0},
771 pm[6+cur_panelsize].setonly();
772 cur_smallicons ? pm[9].set() : pm[9].clear();
774 item = pm->popup(x, y);
776 ((Fl_Widget *)item)->do_callback();
void * a_Bw_get_url_doc(BrowserWindow *bw, const DilloUrl *url)
Get document by URL.
void * a_Bw_get_current_doc(BrowserWindow *bw)
Get current document.
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,...
void change_panel(int new_size, int small_icons)
On-the-fly panel style change.
T get(int i) const
Return the one element, explicitly.
int size() const
Return the number of elements put into this vector.
char * dStrconcat(const char *s1,...)
Concatenate a NULL-terminated list of strings.
int dStrAsciiCasecmp(const char *s1, const char *s2)
char * dStrdup(const char *s)
Dstr * dStr_sized_new(int sz)
Create a new string with a given size.
void dStr_free(Dstr *ds, int all)
Free a dillo string.
char * dStrndup(const char *s, size_t sz)
void dStr_sprintf(Dstr *ds, const char *format,...)
Printf-like function.
const DilloUrl * a_History_get_url(int idx)
Return the DilloUrl field (by index)
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)
void a_Html_form_display_hiddens(void *v_html, void *v_form, bool_t display)
Used by the "Show/Hide hiddens" form menuitem.
void a_Html_form_submit(void *v_html, void *v_form)
Used by the "Submit form" form menuitem.
void a_Html_load_images(void *v_html, DilloUrl *pattern)
Used by the "Load images" page menuitem.
void a_Html_form_reset(void *v_html, void *v_form)
Used by the "Reset form" form menuitem.
DilloPrefs prefs
Global Data.
Contains the specific data for a single window.
void * ui
Pointer to the UI object this bw belongs to.
bool_t parse_embedded_css
bool_t load_background_images
bool_t middle_click_opens_new_tab
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.
void a_Timeout_remove()
Stop running a timeout function.
void a_UIcmd_copy_urlstr(BrowserWindow *bw, const char *urlstr)
void a_UIcmd_close_bw(void *vbw)
int * a_UIcmd_get_history(BrowserWindow *bw, int direction)
void a_UIcmd_open_file(void *vbw)
void a_UIcmd_focus_location(void *vbw)
void a_UIcmd_open_url_nw(BrowserWindow *bw, const DilloUrl *url)
void a_UIcmd_view_page_source(BrowserWindow *bw, const DilloUrl *url)
void a_UIcmd_view_page_bugs(void *vbw)
void a_UIcmd_nav_jump(BrowserWindow *bw, int offset, int new_bw)
void a_UIcmd_open_urlstr(void *vbw, const char *urlstr)
void a_UIcmd_save(void *vbw)
void a_UIcmd_save_link(BrowserWindow *bw, const DilloUrl *url)
void a_UIcmd_repush(void *vbw)
void a_UIcmd_close_all_bw(void *)
void a_UIcmd_add_bookmark(BrowserWindow *bw, const DilloUrl *url)
void a_UIcmd_open_url(BrowserWindow *bw, const DilloUrl *url)
void a_UIcmd_open_url_nt(void *vbw, const DilloUrl *url, int focus)
char * a_Url_encode_hex_str(const char *str)
Urlencode 'str'.
void a_Url_free(DilloUrl *url)
Free a DilloUrl.
DilloUrl * a_Url_dup(const DilloUrl *ori)
Duplicate a Url structure.