annotate src/ui.cc @ 2012:bfb8bc9ddf62

Avoid lots of flicker while resizing the window (when "buffered_drawing" is set to 0 or 1)
author Jorge Arellano Cid <jcid@dillo.org>
date Fri, 13 May 2011 14:14:43 -0400
parents dec39f62be1c
children f542084fa707
rev   line source
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
1 /*
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
2 * File: ui.cc
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
3 *
35
d9e7b35430de Updated copyright lines
jcid
parents: 32
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 // UI for Dillo
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
13
1525
3c683905dbe3 Added a help button. It tries a local help file then dillo.org's one.
corvid, jcid
parents: 1343
diff changeset
14 #include <unistd.h>
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
15 #include <stdio.h>
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
16
1064
485acc9e60e2 Added configurable keybindings! (in ~/.dillo/keysrc) # part1
Jorge Arellano Cid <jcid@dillo.org>
parents: 946
diff changeset
17 #include "keys.hh"
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
18 #include "ui.hh"
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
19 #include "msg.h"
384
d33b55bb56c9 - Set menubar "close window" items from a timeout
jcid
parents: 383
diff changeset
20 #include "timeout.hh"
1103
94b9265663f6 New utility function: a_Utf8_end_of_char()
corvid <corvid@lavabit.com>
parents: 1102
diff changeset
21 #include "utf8.hh"
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
22
1822
a0ed332132e1 some more src/ui
corvid <corvid@lavabit.com>
parents: 1813
diff changeset
23 #include <FL/Fl.H>
a0ed332132e1 some more src/ui
corvid <corvid@lavabit.com>
parents: 1813
diff changeset
24 #include <FL/Fl_Pixmap.H>
a0ed332132e1 some more src/ui
corvid <corvid@lavabit.com>
parents: 1813
diff changeset
25 #include <FL/Fl_Box.H>
a0ed332132e1 some more src/ui
corvid <corvid@lavabit.com>
parents: 1813
diff changeset
26
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
27 // Include image data
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
28 #include "pixmaps.h"
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
29 #include "uicmd.hh"
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
30
374
fb3a62d1aab2 - Set UI's to share icons.
jcid
parents: 372
diff changeset
31 struct iconset {
1813
6a203275d317 a bit of src/ui
corvid <corvid@lavabit.com>
parents: 1806
diff changeset
32 Fl_Image *ImgMeterOK, *ImgMeterBug,
6a203275d317 a bit of src/ui
corvid <corvid@lavabit.com>
parents: 1806
diff changeset
33 *ImgHome, *ImgReload, *ImgSave, *ImgBook, *ImgTools,
1842
63bb7eefc5f6 deactivated toolbar buttons
corvid <corvid@lavabit.com>
parents: 1839
diff changeset
34 *ImgClear,*ImgSearch, *ImgHelp, *ImgLeft, *ImgLeftIn,
63bb7eefc5f6 deactivated toolbar buttons
corvid <corvid@lavabit.com>
parents: 1839
diff changeset
35 *ImgRight, *ImgRightIn, *ImgStop, *ImgStopIn;
374
fb3a62d1aab2 - Set UI's to share icons.
jcid
parents: 372
diff changeset
36 };
fb3a62d1aab2 - Set UI's to share icons.
jcid
parents: 372
diff changeset
37
fb3a62d1aab2 - Set UI's to share icons.
jcid
parents: 372
diff changeset
38 static struct iconset standard_icons = {
1822
a0ed332132e1 some more src/ui
corvid <corvid@lavabit.com>
parents: 1813
diff changeset
39 new Fl_Pixmap(mini_ok_xpm),
a0ed332132e1 some more src/ui
corvid <corvid@lavabit.com>
parents: 1813
diff changeset
40 new Fl_Pixmap(mini_bug_xpm),
a0ed332132e1 some more src/ui
corvid <corvid@lavabit.com>
parents: 1813
diff changeset
41 new Fl_Pixmap(home_xpm),
a0ed332132e1 some more src/ui
corvid <corvid@lavabit.com>
parents: 1813
diff changeset
42 new Fl_Pixmap(reload_xpm),
a0ed332132e1 some more src/ui
corvid <corvid@lavabit.com>
parents: 1813
diff changeset
43 new Fl_Pixmap(save_xpm),
a0ed332132e1 some more src/ui
corvid <corvid@lavabit.com>
parents: 1813
diff changeset
44 new Fl_Pixmap(bm_xpm),
a0ed332132e1 some more src/ui
corvid <corvid@lavabit.com>
parents: 1813
diff changeset
45 new Fl_Pixmap(tools_xpm),
a0ed332132e1 some more src/ui
corvid <corvid@lavabit.com>
parents: 1813
diff changeset
46 new Fl_Pixmap(new_s_xpm),
a0ed332132e1 some more src/ui
corvid <corvid@lavabit.com>
parents: 1813
diff changeset
47 new Fl_Pixmap(search_xpm),
a0ed332132e1 some more src/ui
corvid <corvid@lavabit.com>
parents: 1813
diff changeset
48 new Fl_Pixmap(help_xpm),
a0ed332132e1 some more src/ui
corvid <corvid@lavabit.com>
parents: 1813
diff changeset
49 new Fl_Pixmap(left_xpm),
1842
63bb7eefc5f6 deactivated toolbar buttons
corvid <corvid@lavabit.com>
parents: 1839
diff changeset
50 new Fl_Pixmap(left_i_xpm),
1822
a0ed332132e1 some more src/ui
corvid <corvid@lavabit.com>
parents: 1813
diff changeset
51 new Fl_Pixmap(right_xpm),
1842
63bb7eefc5f6 deactivated toolbar buttons
corvid <corvid@lavabit.com>
parents: 1839
diff changeset
52 new Fl_Pixmap(right_i_xpm),
1822
a0ed332132e1 some more src/ui
corvid <corvid@lavabit.com>
parents: 1813
diff changeset
53 new Fl_Pixmap(stop_xpm),
1842
63bb7eefc5f6 deactivated toolbar buttons
corvid <corvid@lavabit.com>
parents: 1839
diff changeset
54 new Fl_Pixmap(stop_i_xpm),
374
fb3a62d1aab2 - Set UI's to share icons.
jcid
parents: 372
diff changeset
55 };
fb3a62d1aab2 - Set UI's to share icons.
jcid
parents: 372
diff changeset
56
fb3a62d1aab2 - Set UI's to share icons.
jcid
parents: 372
diff changeset
57 static struct iconset small_icons = {
377
e22f6898fa6a - fix 2 for the iconset patch (smallicons)
jcid
parents: 375
diff changeset
58 standard_icons.ImgMeterOK,
e22f6898fa6a - fix 2 for the iconset patch (smallicons)
jcid
parents: 375
diff changeset
59 standard_icons.ImgMeterBug,
1822
a0ed332132e1 some more src/ui
corvid <corvid@lavabit.com>
parents: 1813
diff changeset
60 new Fl_Pixmap(home_s_xpm),
a0ed332132e1 some more src/ui
corvid <corvid@lavabit.com>
parents: 1813
diff changeset
61 new Fl_Pixmap(reload_s_xpm),
a0ed332132e1 some more src/ui
corvid <corvid@lavabit.com>
parents: 1813
diff changeset
62 new Fl_Pixmap(save_s_xpm),
a0ed332132e1 some more src/ui
corvid <corvid@lavabit.com>
parents: 1813
diff changeset
63 new Fl_Pixmap(bm_s_xpm),
a0ed332132e1 some more src/ui
corvid <corvid@lavabit.com>
parents: 1813
diff changeset
64 new Fl_Pixmap(tools_s_xpm),
a0ed332132e1 some more src/ui
corvid <corvid@lavabit.com>
parents: 1813
diff changeset
65 new Fl_Pixmap(new_s_xpm),
377
e22f6898fa6a - fix 2 for the iconset patch (smallicons)
jcid
parents: 375
diff changeset
66 standard_icons.ImgSearch,
1525
3c683905dbe3 Added a help button. It tries a local help file then dillo.org's one.
corvid, jcid
parents: 1343
diff changeset
67 standard_icons.ImgHelp,
1822
a0ed332132e1 some more src/ui
corvid <corvid@lavabit.com>
parents: 1813
diff changeset
68 new Fl_Pixmap(left_s_xpm),
1842
63bb7eefc5f6 deactivated toolbar buttons
corvid <corvid@lavabit.com>
parents: 1839
diff changeset
69 new Fl_Pixmap(left_si_xpm),
63bb7eefc5f6 deactivated toolbar buttons
corvid <corvid@lavabit.com>
parents: 1839
diff changeset
70 new Fl_Pixmap(right_i_xpm),
63bb7eefc5f6 deactivated toolbar buttons
corvid <corvid@lavabit.com>
parents: 1839
diff changeset
71 new Fl_Pixmap(right_si_xpm),
1822
a0ed332132e1 some more src/ui
corvid <corvid@lavabit.com>
parents: 1813
diff changeset
72 new Fl_Pixmap(stop_s_xpm),
1842
63bb7eefc5f6 deactivated toolbar buttons
corvid <corvid@lavabit.com>
parents: 1839
diff changeset
73 new Fl_Pixmap(stop_si_xpm),
374
fb3a62d1aab2 - Set UI's to share icons.
jcid
parents: 372
diff changeset
74 };
fb3a62d1aab2 - Set UI's to share icons.
jcid
parents: 372
diff changeset
75
fb3a62d1aab2 - Set UI's to share icons.
jcid
parents: 372
diff changeset
76
fb3a62d1aab2 - Set UI's to share icons.
jcid
parents: 372
diff changeset
77 static struct iconset *icons = &standard_icons;
fb3a62d1aab2 - Set UI's to share icons.
jcid
parents: 372
diff changeset
78
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
79 /*
382
jcid
parents: 381
diff changeset
80 * Local sub classes
jcid
parents: 381
diff changeset
81 */
jcid
parents: 381
diff changeset
82
jcid
parents: 381
diff changeset
83 //----------------------------------------------------------------------------
jcid
parents: 381
diff changeset
84
jcid
parents: 381
diff changeset
85 /*
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
86 * (Used to avoid certain shortcuts in the location bar)
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
87 */
1813
6a203275d317 a bit of src/ui
corvid <corvid@lavabit.com>
parents: 1806
diff changeset
88 class CustInput : public Fl_Input {
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
89 public:
341
215da0caf90b - Implemented tabbed browsing.
jcid
parents: 337
diff changeset
90 CustInput (int x, int y, int w, int h, const char* l=0) :
1813
6a203275d317 a bit of src/ui
corvid <corvid@lavabit.com>
parents: 1806
diff changeset
91 Fl_Input(x,y,w,h,l) {};
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
92 int handle(int e);
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
93 };
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
94
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
95 /*
1790
45b10f359e51 keys and mouse buttons
corvid <corvid@lavabit.com>
parents: 1591
diff changeset
96 * Disable keys: Up, Down, Page_Up, Page_Down and
45b10f359e51 keys and mouse buttons
corvid <corvid@lavabit.com>
parents: 1591
diff changeset
97 * CTRL+{o,r,Home,End}
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
98 */
341
215da0caf90b - Implemented tabbed browsing.
jcid
parents: 337
diff changeset
99 int CustInput::handle(int e)
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
100 {
1791
corvid <corvid@lavabit.com>
parents: 1790
diff changeset
101 int k = Fl::event_key();
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
102
341
215da0caf90b - Implemented tabbed browsing.
jcid
parents: 337
diff changeset
103 _MSG("CustInput::handle event=%d\n", e);
215da0caf90b - Implemented tabbed browsing.
jcid
parents: 337
diff changeset
104
215da0caf90b - Implemented tabbed browsing.
jcid
parents: 337
diff changeset
105 // We're only interested in some flags
1947
821e6262ead9 Keybindings and some variable name normalizations
Jorge Arellano Cid <jcid@dillo.org>
parents: 1945
diff changeset
106 unsigned modifier = Fl::event_state() & (FL_SHIFT | FL_CTRL | FL_ALT);
325
553e3b01eb5f - Fixed keyboard focus issues.
jcid
parents: 319
diff changeset
107
553e3b01eb5f - Fixed keyboard focus issues.
jcid
parents: 319
diff changeset
108 // Don't focus with arrow keys
1791
corvid <corvid@lavabit.com>
parents: 1790
diff changeset
109 if (e == FL_FOCUS &&
1790
45b10f359e51 keys and mouse buttons
corvid <corvid@lavabit.com>
parents: 1591
diff changeset
110 (k == FL_Up || k == FL_Down || k == FL_Left || k == FL_Right)) {
325
553e3b01eb5f - Fixed keyboard focus issues.
jcid
parents: 319
diff changeset
111 return 0;
1791
corvid <corvid@lavabit.com>
parents: 1790
diff changeset
112 } else if (e == FL_KEYBOARD) {
1948
caf71cd30ec8 Made the findbar operative again (it has tricks and workarounds)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1947
diff changeset
113 if (k == FL_Escape && modifier == 0) {
caf71cd30ec8 Made the findbar operative again (it has tricks and workarounds)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1947
diff changeset
114 // Let the parent group handle this Esc key
caf71cd30ec8 Made the findbar operative again (it has tricks and workarounds)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1947
diff changeset
115 return 0;
caf71cd30ec8 Made the findbar operative again (it has tricks and workarounds)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1947
diff changeset
116
caf71cd30ec8 Made the findbar operative again (it has tricks and workarounds)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1947
diff changeset
117 } else if (modifier == FL_CTRL) {
341
215da0caf90b - Implemented tabbed browsing.
jcid
parents: 337
diff changeset
118 if (k == 'l') {
215da0caf90b - Implemented tabbed browsing.
jcid
parents: 337
diff changeset
119 // Make text selected when already focused.
215da0caf90b - Implemented tabbed browsing.
jcid
parents: 337
diff changeset
120 position(size(), 0);
215da0caf90b - Implemented tabbed browsing.
jcid
parents: 337
diff changeset
121 return 1;
1947
821e6262ead9 Keybindings and some variable name normalizations
Jorge Arellano Cid <jcid@dillo.org>
parents: 1945
diff changeset
122 } else if (k == 'h' || k == 'o' || k == 'r' ||
821e6262ead9 Keybindings and some variable name normalizations
Jorge Arellano Cid <jcid@dillo.org>
parents: 1945
diff changeset
123 k == FL_Home || k == FL_End) {
821e6262ead9 Keybindings and some variable name normalizations
Jorge Arellano Cid <jcid@dillo.org>
parents: 1945
diff changeset
124 // Let these keys get to the UI
341
215da0caf90b - Implemented tabbed browsing.
jcid
parents: 337
diff changeset
125 return 0;
378
003d3ebfd78d - Made SHIFT + {Left, Right} work even with findbar focused.
jcid
parents: 377
diff changeset
126 }
1951
36e6563b8daa Assorted minor changes (see verbose log)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1950
diff changeset
127 } else if (modifier == 0) {
36e6563b8daa Assorted minor changes (see verbose log)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1950
diff changeset
128 if (k == FL_Down || k == FL_Up ||
36e6563b8daa Assorted minor changes (see verbose log)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1950
diff changeset
129 k == FL_Page_Down || k == FL_Page_Up) {
36e6563b8daa Assorted minor changes (see verbose log)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1950
diff changeset
130 // Give up focus and honor the key
36e6563b8daa Assorted minor changes (see verbose log)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1950
diff changeset
131 a_UIcmd_focus_main_area(a_UIcmd_get_bw_by_widget(this));
36e6563b8daa Assorted minor changes (see verbose log)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1950
diff changeset
132 return 0;
36e6563b8daa Assorted minor changes (see verbose log)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1950
diff changeset
133 }
341
215da0caf90b - Implemented tabbed browsing.
jcid
parents: 337
diff changeset
134 }
217
a27eafd634d1 - Made CTRL-l focus the location bar instead of popping up a dialog.
jcid
parents: 213
diff changeset
135 }
1947
821e6262ead9 Keybindings and some variable name normalizations
Jorge Arellano Cid <jcid@dillo.org>
parents: 1945
diff changeset
136
1813
6a203275d317 a bit of src/ui
corvid <corvid@lavabit.com>
parents: 1806
diff changeset
137 return Fl_Input::handle(e);
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
138 }
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
139
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
140 //----------------------------------------------------------------------------
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
141
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
142 /*
1959
648b1506e9aa Introduced class CustLightButton for visual feedback on panel buttons
Jorge Arellano Cid <jcid@dillo.org>
parents: 1954
diff changeset
143 * A button that highlights on mouse over
648b1506e9aa Introduced class CustLightButton for visual feedback on panel buttons
Jorge Arellano Cid <jcid@dillo.org>
parents: 1954
diff changeset
144 */
648b1506e9aa Introduced class CustLightButton for visual feedback on panel buttons
Jorge Arellano Cid <jcid@dillo.org>
parents: 1954
diff changeset
145 class CustLightButton : public Fl_Button {
648b1506e9aa Introduced class CustLightButton for visual feedback on panel buttons
Jorge Arellano Cid <jcid@dillo.org>
parents: 1954
diff changeset
146 Fl_Color norm_color;
648b1506e9aa Introduced class CustLightButton for visual feedback on panel buttons
Jorge Arellano Cid <jcid@dillo.org>
parents: 1954
diff changeset
147 public:
648b1506e9aa Introduced class CustLightButton for visual feedback on panel buttons
Jorge Arellano Cid <jcid@dillo.org>
parents: 1954
diff changeset
148 CustLightButton(int x, int y, int w, int h, const char *l=0) :
648b1506e9aa Introduced class CustLightButton for visual feedback on panel buttons
Jorge Arellano Cid <jcid@dillo.org>
parents: 1954
diff changeset
149 Fl_Button(x,y,w,h,l) { norm_color = color(); };
648b1506e9aa Introduced class CustLightButton for visual feedback on panel buttons
Jorge Arellano Cid <jcid@dillo.org>
parents: 1954
diff changeset
150 virtual int handle(int e);
648b1506e9aa Introduced class CustLightButton for visual feedback on panel buttons
Jorge Arellano Cid <jcid@dillo.org>
parents: 1954
diff changeset
151 };
648b1506e9aa Introduced class CustLightButton for visual feedback on panel buttons
Jorge Arellano Cid <jcid@dillo.org>
parents: 1954
diff changeset
152
648b1506e9aa Introduced class CustLightButton for visual feedback on panel buttons
Jorge Arellano Cid <jcid@dillo.org>
parents: 1954
diff changeset
153 int CustLightButton::handle(int e)
648b1506e9aa Introduced class CustLightButton for visual feedback on panel buttons
Jorge Arellano Cid <jcid@dillo.org>
parents: 1954
diff changeset
154 {
648b1506e9aa Introduced class CustLightButton for visual feedback on panel buttons
Jorge Arellano Cid <jcid@dillo.org>
parents: 1954
diff changeset
155 if (active()) {
648b1506e9aa Introduced class CustLightButton for visual feedback on panel buttons
Jorge Arellano Cid <jcid@dillo.org>
parents: 1954
diff changeset
156 if (e == FL_ENTER) {
648b1506e9aa Introduced class CustLightButton for visual feedback on panel buttons
Jorge Arellano Cid <jcid@dillo.org>
parents: 1954
diff changeset
157 color(51); // {17,26,51}
648b1506e9aa Introduced class CustLightButton for visual feedback on panel buttons
Jorge Arellano Cid <jcid@dillo.org>
parents: 1954
diff changeset
158 redraw();
648b1506e9aa Introduced class CustLightButton for visual feedback on panel buttons
Jorge Arellano Cid <jcid@dillo.org>
parents: 1954
diff changeset
159 } else if (e == FL_LEAVE || e == FL_RELEASE) {
648b1506e9aa Introduced class CustLightButton for visual feedback on panel buttons
Jorge Arellano Cid <jcid@dillo.org>
parents: 1954
diff changeset
160 color(norm_color);
648b1506e9aa Introduced class CustLightButton for visual feedback on panel buttons
Jorge Arellano Cid <jcid@dillo.org>
parents: 1954
diff changeset
161 redraw();
648b1506e9aa Introduced class CustLightButton for visual feedback on panel buttons
Jorge Arellano Cid <jcid@dillo.org>
parents: 1954
diff changeset
162 }
648b1506e9aa Introduced class CustLightButton for visual feedback on panel buttons
Jorge Arellano Cid <jcid@dillo.org>
parents: 1954
diff changeset
163 }
648b1506e9aa Introduced class CustLightButton for visual feedback on panel buttons
Jorge Arellano Cid <jcid@dillo.org>
parents: 1954
diff changeset
164 return Fl_Button::handle(e);
648b1506e9aa Introduced class CustLightButton for visual feedback on panel buttons
Jorge Arellano Cid <jcid@dillo.org>
parents: 1954
diff changeset
165 }
648b1506e9aa Introduced class CustLightButton for visual feedback on panel buttons
Jorge Arellano Cid <jcid@dillo.org>
parents: 1954
diff changeset
166
648b1506e9aa Introduced class CustLightButton for visual feedback on panel buttons
Jorge Arellano Cid <jcid@dillo.org>
parents: 1954
diff changeset
167 //----------------------------------------------------------------------------
648b1506e9aa Introduced class CustLightButton for visual feedback on panel buttons
Jorge Arellano Cid <jcid@dillo.org>
parents: 1954
diff changeset
168
648b1506e9aa Introduced class CustLightButton for visual feedback on panel buttons
Jorge Arellano Cid <jcid@dillo.org>
parents: 1954
diff changeset
169 /*
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
170 * Used to handle "paste" within the toolbar's Clear button.
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
171 */
1959
648b1506e9aa Introduced class CustLightButton for visual feedback on panel buttons
Jorge Arellano Cid <jcid@dillo.org>
parents: 1954
diff changeset
172 class CustPasteButton : public CustLightButton {
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
173 public:
1959
648b1506e9aa Introduced class CustLightButton for visual feedback on panel buttons
Jorge Arellano Cid <jcid@dillo.org>
parents: 1954
diff changeset
174 CustPasteButton(int x, int y, int w, int h, const char *l=0) :
648b1506e9aa Introduced class CustLightButton for visual feedback on panel buttons
Jorge Arellano Cid <jcid@dillo.org>
parents: 1954
diff changeset
175 CustLightButton(x,y,w,h,l) {};
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
176 int handle(int e);
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
177 };
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
178
1959
648b1506e9aa Introduced class CustLightButton for visual feedback on panel buttons
Jorge Arellano Cid <jcid@dillo.org>
parents: 1954
diff changeset
179 int CustPasteButton::handle(int e)
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
180 {
1791
corvid <corvid@lavabit.com>
parents: 1790
diff changeset
181 if (e == FL_PASTE) {
corvid <corvid@lavabit.com>
parents: 1790
diff changeset
182 const char* t = Fl::event_text();
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
183 if (t && *t) {
372
49886f14ffe1 - Committed the no bw as window user_data() patch.
jcid
parents: 368
diff changeset
184 a_UIcmd_set_location_text(a_UIcmd_get_bw_by_widget(this), t);
49886f14ffe1 - Committed the no bw as window user_data() patch.
jcid
parents: 368
diff changeset
185 a_UIcmd_open_urlstr(a_UIcmd_get_bw_by_widget(this), t);
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
186 return 1;
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
187 }
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
188 }
1959
648b1506e9aa Introduced class CustLightButton for visual feedback on panel buttons
Jorge Arellano Cid <jcid@dillo.org>
parents: 1954
diff changeset
189 return CustLightButton::handle(e);
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
190 }
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
191
75
4dfc78307039 Made progress bars resize automatically.
jcid
parents: 72
diff changeset
192 //----------------------------------------------------------------------------
4dfc78307039 Made progress bars resize automatically.
jcid
parents: 72
diff changeset
193
4dfc78307039 Made progress bars resize automatically.
jcid
parents: 72
diff changeset
194 /*
4dfc78307039 Made progress bars resize automatically.
jcid
parents: 72
diff changeset
195 * Used to resize the progress boxes automatically.
4dfc78307039 Made progress bars resize automatically.
jcid
parents: 72
diff changeset
196 */
1813
6a203275d317 a bit of src/ui
corvid <corvid@lavabit.com>
parents: 1806
diff changeset
197 class CustProgressBox : public Fl_Box {
1222
deffd7fc6d52 Fixed CustProgressBox() for systems without weak symbols (wrong semantics)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1209
diff changeset
198 int padding;
75
4dfc78307039 Made progress bars resize automatically.
jcid
parents: 72
diff changeset
199 public:
341
215da0caf90b - Implemented tabbed browsing.
jcid
parents: 337
diff changeset
200 CustProgressBox(int x, int y, int w, int h, const char *l=0) :
1813
6a203275d317 a bit of src/ui
corvid <corvid@lavabit.com>
parents: 1806
diff changeset
201 Fl_Box(x,y,w,h,l) { padding = 0; };
75
4dfc78307039 Made progress bars resize automatically.
jcid
parents: 72
diff changeset
202 void update_label(const char *lbl) {
2004
dec39f62be1c fl_measure expects w to be set
corvid <corvid@lavabit.com>
parents: 2003
diff changeset
203 int w = 0, h = 0;
75
4dfc78307039 Made progress bars resize automatically.
jcid
parents: 72
diff changeset
204 if (!padding) {
4dfc78307039 Made progress bars resize automatically.
jcid
parents: 72
diff changeset
205 copy_label("W");
4dfc78307039 Made progress bars resize automatically.
jcid
parents: 72
diff changeset
206 measure_label(w, h);
4dfc78307039 Made progress bars resize automatically.
jcid
parents: 72
diff changeset
207 padding = w > 2 ? w/2 : 1;
4dfc78307039 Made progress bars resize automatically.
jcid
parents: 72
diff changeset
208 }
4dfc78307039 Made progress bars resize automatically.
jcid
parents: 72
diff changeset
209 copy_label(lbl);
1924
998acefd6a51 Initial changes to make the tiny panel mode work
Jorge Arellano Cid <jcid@dillo.org>
parents: 1843
diff changeset
210 //measure_label(w,h);
998acefd6a51 Initial changes to make the tiny panel mode work
Jorge Arellano Cid <jcid@dillo.org>
parents: 1843
diff changeset
211 //size(w+padding,this->h());
75
4dfc78307039 Made progress bars resize automatically.
jcid
parents: 72
diff changeset
212 }
4dfc78307039 Made progress bars resize automatically.
jcid
parents: 72
diff changeset
213 };
4dfc78307039 Made progress bars resize automatically.
jcid
parents: 72
diff changeset
214
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
215 //
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
216 // Toolbar buttons -----------------------------------------------------------
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
217 //
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
218 //static const char *button_names[] = {
827
d513abcd4949 Implemented the tools button with CSS options. Also removed nav.h from html.cc
Jorge Arellano Cid <jcid@dillo.org>
parents: 479
diff changeset
219 // "Back", "Forward", "Home", "Reload", "Save", "Stop", "Bookmarks", "Tools",
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
220 // "Clear", "Search"
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
221 //};
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
222
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
223
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
224 //
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
225 // Callback functions --------------------------------------------------------
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
226 //
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
227
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
228 /*
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
229 * Callback for the search button.
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
230 */
1813
6a203275d317 a bit of src/ui
corvid <corvid@lavabit.com>
parents: 1806
diff changeset
231 static void search_cb(Fl_Widget *wid, void *data)
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
232 {
1843
8139561cd4cb more UI button event handling
corvid <corvid@lavabit.com>
parents: 1842
diff changeset
233 int b = Fl::event_button();
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
234
1843
8139561cd4cb more UI button event handling
corvid <corvid@lavabit.com>
parents: 1842
diff changeset
235 if (b == FL_LEFT_MOUSE) {
372
49886f14ffe1 - Committed the no bw as window user_data() patch.
jcid
parents: 368
diff changeset
236 a_UIcmd_search_dialog(a_UIcmd_get_bw_by_widget(wid));
1843
8139561cd4cb more UI button event handling
corvid <corvid@lavabit.com>
parents: 1842
diff changeset
237 } else if (b == FL_MIDDLE_MOUSE) {
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
238 ((UI*)data)->color_change_cb_i();
1843
8139561cd4cb more UI button event handling
corvid <corvid@lavabit.com>
parents: 1842
diff changeset
239 } else if (b == FL_RIGHT_MOUSE) {
1978
3172b6199fd1 Disabled the right-click-over-search-button hook that changed panel size
Jorge Arellano Cid <jcid@dillo.org>
parents: 1977
diff changeset
240 // nothing ATM
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
241 }
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
242 }
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
243
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
244 /*
1525
3c683905dbe3 Added a help button. It tries a local help file then dillo.org's one.
corvid, jcid
parents: 1343
diff changeset
245 * Callback for the help button.
1591
cf7f2d3312fb trim some spaces
corvid <corvid@lavabit.com>
parents: 1584
diff changeset
246 */
1813
6a203275d317 a bit of src/ui
corvid <corvid@lavabit.com>
parents: 1806
diff changeset
247 static void help_cb(Fl_Widget *w, void *)
1525
3c683905dbe3 Added a help button. It tries a local help file then dillo.org's one.
corvid, jcid
parents: 1343
diff changeset
248 {
3c683905dbe3 Added a help button. It tries a local help file then dillo.org's one.
corvid, jcid
parents: 1343
diff changeset
249 char *path = dStrconcat(DILLO_DOCDIR, "user_help.html", NULL);
3c683905dbe3 Added a help button. It tries a local help file then dillo.org's one.
corvid, jcid
parents: 1343
diff changeset
250 BrowserWindow *bw = a_UIcmd_get_bw_by_widget(w);
3c683905dbe3 Added a help button. It tries a local help file then dillo.org's one.
corvid, jcid
parents: 1343
diff changeset
251
3c683905dbe3 Added a help button. It tries a local help file then dillo.org's one.
corvid, jcid
parents: 1343
diff changeset
252 if (access(path, R_OK) == 0) {
3c683905dbe3 Added a help button. It tries a local help file then dillo.org's one.
corvid, jcid
parents: 1343
diff changeset
253 char *urlstr = dStrconcat("file:", path, NULL);
3c683905dbe3 Added a help button. It tries a local help file then dillo.org's one.
corvid, jcid
parents: 1343
diff changeset
254 a_UIcmd_open_urlstr(bw, urlstr);
3c683905dbe3 Added a help button. It tries a local help file then dillo.org's one.
corvid, jcid
parents: 1343
diff changeset
255 dFree(urlstr);
3c683905dbe3 Added a help button. It tries a local help file then dillo.org's one.
corvid, jcid
parents: 1343
diff changeset
256 } else {
1579
1d38bc37ae03 Fix fullwindow start (from CLI and dillorc)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1559
diff changeset
257 MSG("Can't read local help file at \"%s\"."
1d38bc37ae03 Fix fullwindow start (from CLI and dillorc)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1559
diff changeset
258 " Getting remote help...\n", path);
1525
3c683905dbe3 Added a help button. It tries a local help file then dillo.org's one.
corvid, jcid
parents: 1343
diff changeset
259 a_UIcmd_open_urlstr(bw, "http://www.dillo.org/dillo2-help.html");
3c683905dbe3 Added a help button. It tries a local help file then dillo.org's one.
corvid, jcid
parents: 1343
diff changeset
260 }
3c683905dbe3 Added a help button. It tries a local help file then dillo.org's one.
corvid, jcid
parents: 1343
diff changeset
261 dFree(path);
3c683905dbe3 Added a help button. It tries a local help file then dillo.org's one.
corvid, jcid
parents: 1343
diff changeset
262 }
3c683905dbe3 Added a help button. It tries a local help file then dillo.org's one.
corvid, jcid
parents: 1343
diff changeset
263
3c683905dbe3 Added a help button. It tries a local help file then dillo.org's one.
corvid, jcid
parents: 1343
diff changeset
264 /*
400
31b866fdde87 - File menu as popup implementation.
jcid
parents: 393
diff changeset
265 * Callback for the File menu button.
31b866fdde87 - File menu as popup implementation.
jcid
parents: 393
diff changeset
266 */
1813
6a203275d317 a bit of src/ui
corvid <corvid@lavabit.com>
parents: 1806
diff changeset
267 static void filemenu_cb(Fl_Widget *wid, void *)
400
31b866fdde87 - File menu as popup implementation.
jcid
parents: 393
diff changeset
268 {
1843
8139561cd4cb more UI button event handling
corvid <corvid@lavabit.com>
parents: 1842
diff changeset
269 int b = Fl::event_button();
8139561cd4cb more UI button event handling
corvid <corvid@lavabit.com>
parents: 1842
diff changeset
270 if (b == FL_LEFT_MOUSE || b == FL_RIGHT_MOUSE) {
400
31b866fdde87 - File menu as popup implementation.
jcid
parents: 393
diff changeset
271 a_UIcmd_file_popup(a_UIcmd_get_bw_by_widget(wid), wid);
31b866fdde87 - File menu as popup implementation.
jcid
parents: 393
diff changeset
272 }
31b866fdde87 - File menu as popup implementation.
jcid
parents: 393
diff changeset
273 }
31b866fdde87 - File menu as popup implementation.
jcid
parents: 393
diff changeset
274
31b866fdde87 - File menu as popup implementation.
jcid
parents: 393
diff changeset
275 /*
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
276 * Callback for the location's clear-button.
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
277 */
1813
6a203275d317 a bit of src/ui
corvid <corvid@lavabit.com>
parents: 1806
diff changeset
278 static void clear_cb(Fl_Widget *w, void *data)
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
279 {
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
280 UI *ui = (UI*)data;
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
281
1843
8139561cd4cb more UI button event handling
corvid <corvid@lavabit.com>
parents: 1842
diff changeset
282 int b = Fl::event_button();
8139561cd4cb more UI button event handling
corvid <corvid@lavabit.com>
parents: 1842
diff changeset
283 if (b == FL_LEFT_MOUSE) {
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
284 ui->set_location("");
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
285 ui->focus_location();
1843
8139561cd4cb more UI button event handling
corvid <corvid@lavabit.com>
parents: 1842
diff changeset
286 } if (b == FL_MIDDLE_MOUSE) {
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
287 ui->paste_url();
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
288 }
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
289 }
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
290
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
291 /*
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
292 * Change the color of the location bar.
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
293 *
1813
6a203275d317 a bit of src/ui
corvid <corvid@lavabit.com>
parents: 1806
diff changeset
294 static void color_change_cb(Fl_Widget *wid, void *data)
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
295 {
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
296 ((UI*)data)->color_change_cb_i();
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
297 }
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
298 */
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
299
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
300
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
301 /*
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
302 * Send the browser to the new URL in the location.
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
303 */
1813
6a203275d317 a bit of src/ui
corvid <corvid@lavabit.com>
parents: 1806
diff changeset
304 static void location_cb(Fl_Widget *wid, void *data)
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
305 {
1822
a0ed332132e1 some more src/ui
corvid <corvid@lavabit.com>
parents: 1813
diff changeset
306 Fl_Input *i = (Fl_Input*)wid;
341
215da0caf90b - Implemented tabbed browsing.
jcid
parents: 337
diff changeset
307 UI *ui = (UI*)data;
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
308
383
b619d3469c69 - insert workaround part2
jcid
parents: 382
diff changeset
309 _MSG("location_cb()\n");
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
310 /* This test is necessary because WHEN_ENTER_KEY also includes
41
jcid
parents: 35
diff changeset
311 * other events we're not interested in. For instance pressing
jcid
parents: 35
diff changeset
312 * The Back or Forward, buttons, or the first click on a rendered
jcid
parents: 35
diff changeset
313 * page. BUG: this must be investigated and reported to FLTK2 team */
1791
corvid <corvid@lavabit.com>
parents: 1790
diff changeset
314 if (Fl::event_key() == FL_Enter) {
372
49886f14ffe1 - Committed the no bw as window user_data() patch.
jcid
parents: 368
diff changeset
315 a_UIcmd_open_urlstr(a_UIcmd_get_bw_by_widget(i), i->value());
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
316 }
217
a27eafd634d1 - Made CTRL-l focus the location bar instead of popping up a dialog.
jcid
parents: 213
diff changeset
317 if (ui->get_panelmode() == UI_TEMPORARILY_SHOW_PANELS) {
a27eafd634d1 - Made CTRL-l focus the location bar instead of popping up a dialog.
jcid
parents: 213
diff changeset
318 ui->set_panelmode(UI_HIDDEN);
a27eafd634d1 - Made CTRL-l focus the location bar instead of popping up a dialog.
jcid
parents: 213
diff changeset
319 }
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
320 }
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
321
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
322
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
323 /*
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
324 * Callback handler for button press on the panel
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
325 */
1813
6a203275d317 a bit of src/ui
corvid <corvid@lavabit.com>
parents: 1806
diff changeset
326 static void b1_cb(Fl_Widget *wid, void *cb_data)
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
327 {
4
9a9338f78888 +- Connected signals to <li> elements (fixes links within lists).
jcid
parents: 0
diff changeset
328 int bn = VOIDP2INT(cb_data);
1843
8139561cd4cb more UI button event handling
corvid <corvid@lavabit.com>
parents: 1842
diff changeset
329 int b = Fl::event_button();
8139561cd4cb more UI button event handling
corvid <corvid@lavabit.com>
parents: 1842
diff changeset
330 if (b >= FL_LEFT_MOUSE && b <= FL_RIGHT_MOUSE) {
8139561cd4cb more UI button event handling
corvid <corvid@lavabit.com>
parents: 1842
diff changeset
331 _MSG("[%s], mouse button %d was pressed\n", button_names[bn], b);
8139561cd4cb more UI button event handling
corvid <corvid@lavabit.com>
parents: 1842
diff changeset
332 _MSG("mouse button %d was pressed\n", b);
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
333 }
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
334 switch (bn) {
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
335 case UI_BACK:
1843
8139561cd4cb more UI button event handling
corvid <corvid@lavabit.com>
parents: 1842
diff changeset
336 if (b == FL_LEFT_MOUSE) {
372
49886f14ffe1 - Committed the no bw as window user_data() patch.
jcid
parents: 368
diff changeset
337 a_UIcmd_back(a_UIcmd_get_bw_by_widget(wid));
1843
8139561cd4cb more UI button event handling
corvid <corvid@lavabit.com>
parents: 1842
diff changeset
338 } else if (b == FL_RIGHT_MOUSE) {
372
49886f14ffe1 - Committed the no bw as window user_data() patch.
jcid
parents: 368
diff changeset
339 a_UIcmd_back_popup(a_UIcmd_get_bw_by_widget(wid));
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
340 }
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
341 break;
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
342 case UI_FORW:
1843
8139561cd4cb more UI button event handling
corvid <corvid@lavabit.com>
parents: 1842
diff changeset
343 if (b == FL_LEFT_MOUSE) {
372
49886f14ffe1 - Committed the no bw as window user_data() patch.
jcid
parents: 368
diff changeset
344 a_UIcmd_forw(a_UIcmd_get_bw_by_widget(wid));
1843
8139561cd4cb more UI button event handling
corvid <corvid@lavabit.com>
parents: 1842
diff changeset
345 } else if (b == FL_RIGHT_MOUSE) {
372
49886f14ffe1 - Committed the no bw as window user_data() patch.
jcid
parents: 368
diff changeset
346 a_UIcmd_forw_popup(a_UIcmd_get_bw_by_widget(wid));
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
347 }
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
348 break;
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
349 case UI_HOME:
1843
8139561cd4cb more UI button event handling
corvid <corvid@lavabit.com>
parents: 1842
diff changeset
350 if (b == FL_LEFT_MOUSE) {
372
49886f14ffe1 - Committed the no bw as window user_data() patch.
jcid
parents: 368
diff changeset
351 a_UIcmd_home(a_UIcmd_get_bw_by_widget(wid));
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
352 }
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
353 break;
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
354 case UI_RELOAD:
1843
8139561cd4cb more UI button event handling
corvid <corvid@lavabit.com>
parents: 1842
diff changeset
355 if (b == FL_LEFT_MOUSE) {
372
49886f14ffe1 - Committed the no bw as window user_data() patch.
jcid
parents: 368
diff changeset
356 a_UIcmd_reload(a_UIcmd_get_bw_by_widget(wid));
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
357 }
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
358 break;
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
359 case UI_SAVE:
1843
8139561cd4cb more UI button event handling
corvid <corvid@lavabit.com>
parents: 1842
diff changeset
360 if (b == FL_LEFT_MOUSE) {
372
49886f14ffe1 - Committed the no bw as window user_data() patch.
jcid
parents: 368
diff changeset
361 a_UIcmd_save(a_UIcmd_get_bw_by_widget(wid));
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
362 }
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
363 break;
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
364 case UI_STOP:
1843
8139561cd4cb more UI button event handling
corvid <corvid@lavabit.com>
parents: 1842
diff changeset
365 if (b == FL_LEFT_MOUSE) {
372
49886f14ffe1 - Committed the no bw as window user_data() patch.
jcid
parents: 368
diff changeset
366 a_UIcmd_stop(a_UIcmd_get_bw_by_widget(wid));
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
367 }
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
368 break;
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
369 case UI_BOOK:
1843
8139561cd4cb more UI button event handling
corvid <corvid@lavabit.com>
parents: 1842
diff changeset
370 if (b == FL_LEFT_MOUSE) {
372
49886f14ffe1 - Committed the no bw as window user_data() patch.
jcid
parents: 368
diff changeset
371 a_UIcmd_book(a_UIcmd_get_bw_by_widget(wid));
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
372 }
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
373 break;
827
d513abcd4949 Implemented the tools button with CSS options. Also removed nav.h from html.cc
Jorge Arellano Cid <jcid@dillo.org>
parents: 479
diff changeset
374 case UI_TOOLS:
1843
8139561cd4cb more UI button event handling
corvid <corvid@lavabit.com>
parents: 1842
diff changeset
375 if (b == FL_LEFT_MOUSE || b == FL_RIGHT_MOUSE) {
827
d513abcd4949 Implemented the tools button with CSS options. Also removed nav.h from html.cc
Jorge Arellano Cid <jcid@dillo.org>
parents: 479
diff changeset
376 a_UIcmd_tools(a_UIcmd_get_bw_by_widget(wid), wid);
d513abcd4949 Implemented the tools button with CSS options. Also removed nav.h from html.cc
Jorge Arellano Cid <jcid@dillo.org>
parents: 479
diff changeset
377 }
d513abcd4949 Implemented the tools button with CSS options. Also removed nav.h from html.cc
Jorge Arellano Cid <jcid@dillo.org>
parents: 479
diff changeset
378 break;
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
379 default:
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
380 break;
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
381 }
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
382 }
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
383
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
384 /*
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
385 * Callback for the bug meter button.
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
386 */
1813
6a203275d317 a bit of src/ui
corvid <corvid@lavabit.com>
parents: 1806
diff changeset
387 static void bugmeter_cb(Fl_Widget *wid, void *data)
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
388 {
1843
8139561cd4cb more UI button event handling
corvid <corvid@lavabit.com>
parents: 1842
diff changeset
389 int b = Fl::event_button();
8139561cd4cb more UI button event handling
corvid <corvid@lavabit.com>
parents: 1842
diff changeset
390 if (b == FL_LEFT_MOUSE) {
372
49886f14ffe1 - Committed the no bw as window user_data() patch.
jcid
parents: 368
diff changeset
391 a_UIcmd_view_page_bugs(a_UIcmd_get_bw_by_widget(wid));
1843
8139561cd4cb more UI button event handling
corvid <corvid@lavabit.com>
parents: 1842
diff changeset
392 } else if (b == FL_RIGHT_MOUSE) {
372
49886f14ffe1 - Committed the no bw as window user_data() patch.
jcid
parents: 368
diff changeset
393 a_UIcmd_bugmeter_popup(a_UIcmd_get_bw_by_widget(wid));
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
394 }
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
395 }
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
396
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
397 //////////////////////////////////////////////////////////////////////////////
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
398 // UI class methods
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
399 //
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
400
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
401 //----------------------------
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
402 // Panel construction methods
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
403 //----------------------------
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
404
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
405 /*
1924
998acefd6a51 Initial changes to make the tiny panel mode work
Jorge Arellano Cid <jcid@dillo.org>
parents: 1843
diff changeset
406 * Make a generic navigation button
998acefd6a51 Initial changes to make the tiny panel mode work
Jorge Arellano Cid <jcid@dillo.org>
parents: 1843
diff changeset
407 */
1925
72bfd5e7edcd Added CustGroup class (it repositions child widgets when others are hidden)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1924
diff changeset
408 Fl_Button *UI::make_button(const char *label, Fl_Image *img, Fl_Image *deimg,
1924
998acefd6a51 Initial changes to make the tiny panel mode work
Jorge Arellano Cid <jcid@dillo.org>
parents: 1843
diff changeset
409 int b_n, int start)
998acefd6a51 Initial changes to make the tiny panel mode work
Jorge Arellano Cid <jcid@dillo.org>
parents: 1843
diff changeset
410 {
998acefd6a51 Initial changes to make the tiny panel mode work
Jorge Arellano Cid <jcid@dillo.org>
parents: 1843
diff changeset
411 if (start)
998acefd6a51 Initial changes to make the tiny panel mode work
Jorge Arellano Cid <jcid@dillo.org>
parents: 1843
diff changeset
412 p_xpos = 0;
998acefd6a51 Initial changes to make the tiny panel mode work
Jorge Arellano Cid <jcid@dillo.org>
parents: 1843
diff changeset
413
1959
648b1506e9aa Introduced class CustLightButton for visual feedback on panel buttons
Jorge Arellano Cid <jcid@dillo.org>
parents: 1954
diff changeset
414 Fl_Button *b = new CustLightButton(p_xpos, 0, bw, bh, (lbl) ? label : NULL);
1924
998acefd6a51 Initial changes to make the tiny panel mode work
Jorge Arellano Cid <jcid@dillo.org>
parents: 1843
diff changeset
415 if (img)
998acefd6a51 Initial changes to make the tiny panel mode work
Jorge Arellano Cid <jcid@dillo.org>
parents: 1843
diff changeset
416 b->image(img);
998acefd6a51 Initial changes to make the tiny panel mode work
Jorge Arellano Cid <jcid@dillo.org>
parents: 1843
diff changeset
417 if (deimg)
998acefd6a51 Initial changes to make the tiny panel mode work
Jorge Arellano Cid <jcid@dillo.org>
parents: 1843
diff changeset
418 b->deimage(deimg);
998acefd6a51 Initial changes to make the tiny panel mode work
Jorge Arellano Cid <jcid@dillo.org>
parents: 1843
diff changeset
419 b->callback(b1_cb, (void *)b_n);
998acefd6a51 Initial changes to make the tiny panel mode work
Jorge Arellano Cid <jcid@dillo.org>
parents: 1843
diff changeset
420 b->clear_visible_focus();
998acefd6a51 Initial changes to make the tiny panel mode work
Jorge Arellano Cid <jcid@dillo.org>
parents: 1843
diff changeset
421 b->labelsize(12);
1959
648b1506e9aa Introduced class CustLightButton for visual feedback on panel buttons
Jorge Arellano Cid <jcid@dillo.org>
parents: 1954
diff changeset
422 b->box(FL_FLAT_BOX);
648b1506e9aa Introduced class CustLightButton for visual feedback on panel buttons
Jorge Arellano Cid <jcid@dillo.org>
parents: 1954
diff changeset
423 b->down_box(FL_THIN_DOWN_FRAME);
1924
998acefd6a51 Initial changes to make the tiny panel mode work
Jorge Arellano Cid <jcid@dillo.org>
parents: 1843
diff changeset
424 p_xpos += bw;
998acefd6a51 Initial changes to make the tiny panel mode work
Jorge Arellano Cid <jcid@dillo.org>
parents: 1843
diff changeset
425 return b;
998acefd6a51 Initial changes to make the tiny panel mode work
Jorge Arellano Cid <jcid@dillo.org>
parents: 1843
diff changeset
426 }
998acefd6a51 Initial changes to make the tiny panel mode work
Jorge Arellano Cid <jcid@dillo.org>
parents: 1843
diff changeset
427
998acefd6a51 Initial changes to make the tiny panel mode work
Jorge Arellano Cid <jcid@dillo.org>
parents: 1843
diff changeset
428 /*
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
429 * Create the archetipic browser buttons
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
430 */
1924
998acefd6a51 Initial changes to make the tiny panel mode work
Jorge Arellano Cid <jcid@dillo.org>
parents: 1843
diff changeset
431 void UI::make_toolbar(int tw, int th)
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
432 {
1924
998acefd6a51 Initial changes to make the tiny panel mode work
Jorge Arellano Cid <jcid@dillo.org>
parents: 1843
diff changeset
433 Back = make_button("Back", icons->ImgLeft, icons->ImgLeftIn, UI_BACK, 1);
998acefd6a51 Initial changes to make the tiny panel mode work
Jorge Arellano Cid <jcid@dillo.org>
parents: 1843
diff changeset
434 Forw = make_button("Forw", icons->ImgRight, icons->ImgRightIn, UI_FORW);
998acefd6a51 Initial changes to make the tiny panel mode work
Jorge Arellano Cid <jcid@dillo.org>
parents: 1843
diff changeset
435 Home = make_button("Home", icons->ImgHome, NULL, UI_HOME);
998acefd6a51 Initial changes to make the tiny panel mode work
Jorge Arellano Cid <jcid@dillo.org>
parents: 1843
diff changeset
436 Reload = make_button("Reload", icons->ImgReload, NULL, UI_RELOAD);
998acefd6a51 Initial changes to make the tiny panel mode work
Jorge Arellano Cid <jcid@dillo.org>
parents: 1843
diff changeset
437 Save = make_button("Save", icons->ImgSave, NULL, UI_SAVE);
998acefd6a51 Initial changes to make the tiny panel mode work
Jorge Arellano Cid <jcid@dillo.org>
parents: 1843
diff changeset
438 Stop = make_button("Stop", icons->ImgStop, icons->ImgStopIn, UI_STOP);
998acefd6a51 Initial changes to make the tiny panel mode work
Jorge Arellano Cid <jcid@dillo.org>
parents: 1843
diff changeset
439 Bookmarks = make_button("Book", icons->ImgBook, NULL, UI_BOOK);
998acefd6a51 Initial changes to make the tiny panel mode work
Jorge Arellano Cid <jcid@dillo.org>
parents: 1843
diff changeset
440 Tools = make_button("Tools", icons->ImgTools, NULL, UI_TOOLS);
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
441
1343
16ed4ed58863 only set tooltips for UI if prefs.show_tooltip set
corvid <corvid@lavabit.com>
parents: 1308
diff changeset
442 if (prefs.show_tooltip) {
16ed4ed58863 only set tooltips for UI if prefs.show_tooltip set
corvid <corvid@lavabit.com>
parents: 1308
diff changeset
443 Back->tooltip("Previous page");
16ed4ed58863 only set tooltips for UI if prefs.show_tooltip set
corvid <corvid@lavabit.com>
parents: 1308
diff changeset
444 Forw->tooltip("Next page");
16ed4ed58863 only set tooltips for UI if prefs.show_tooltip set
corvid <corvid@lavabit.com>
parents: 1308
diff changeset
445 Home->tooltip("Go to the Home page");
16ed4ed58863 only set tooltips for UI if prefs.show_tooltip set
corvid <corvid@lavabit.com>
parents: 1308
diff changeset
446 Reload->tooltip("Reload");
16ed4ed58863 only set tooltips for UI if prefs.show_tooltip set
corvid <corvid@lavabit.com>
parents: 1308
diff changeset
447 Save->tooltip("Save this page");
16ed4ed58863 only set tooltips for UI if prefs.show_tooltip set
corvid <corvid@lavabit.com>
parents: 1308
diff changeset
448 Stop->tooltip("Stop loading");
16ed4ed58863 only set tooltips for UI if prefs.show_tooltip set
corvid <corvid@lavabit.com>
parents: 1308
diff changeset
449 Bookmarks->tooltip("View bookmarks");
16ed4ed58863 only set tooltips for UI if prefs.show_tooltip set
corvid <corvid@lavabit.com>
parents: 1308
diff changeset
450 Tools->tooltip("Settings");
16ed4ed58863 only set tooltips for UI if prefs.show_tooltip set
corvid <corvid@lavabit.com>
parents: 1308
diff changeset
451 }
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
452 }
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
453
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
454 /*
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
455 * Create the location box (Clear/Input/Search)
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
456 */
1924
998acefd6a51 Initial changes to make the tiny panel mode work
Jorge Arellano Cid <jcid@dillo.org>
parents: 1843
diff changeset
457 void UI::make_location(int ww)
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
458 {
1813
6a203275d317 a bit of src/ui
corvid <corvid@lavabit.com>
parents: 1806
diff changeset
459 Fl_Button *b;
1924
998acefd6a51 Initial changes to make the tiny panel mode work
Jorge Arellano Cid <jcid@dillo.org>
parents: 1843
diff changeset
460
1959
648b1506e9aa Introduced class CustLightButton for visual feedback on panel buttons
Jorge Arellano Cid <jcid@dillo.org>
parents: 1954
diff changeset
461 Clear = b = new CustPasteButton(p_xpos,0,16,lh,0);
374
fb3a62d1aab2 - Set UI's to share icons.
jcid
parents: 372
diff changeset
462 b->image(icons->ImgClear);
341
215da0caf90b - Implemented tabbed browsing.
jcid
parents: 337
diff changeset
463 b->callback(clear_cb, this);
1813
6a203275d317 a bit of src/ui
corvid <corvid@lavabit.com>
parents: 1806
diff changeset
464 b->clear_visible_focus();
1924
998acefd6a51 Initial changes to make the tiny panel mode work
Jorge Arellano Cid <jcid@dillo.org>
parents: 1843
diff changeset
465 b->box(FL_THIN_UP_BOX);
998acefd6a51 Initial changes to make the tiny panel mode work
Jorge Arellano Cid <jcid@dillo.org>
parents: 1843
diff changeset
466 p_xpos += b->w();
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
467
1924
998acefd6a51 Initial changes to make the tiny panel mode work
Jorge Arellano Cid <jcid@dillo.org>
parents: 1843
diff changeset
468 Fl_Input *i = Location = new CustInput(p_xpos,0,ww-p_xpos-32,lh,0);
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
469 i->color(CuteColor);
1794
corvid <corvid@lavabit.com>
parents: 1791
diff changeset
470 i->when(FL_WHEN_ENTER_KEY);
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
471 i->callback(location_cb, this);
1924
998acefd6a51 Initial changes to make the tiny panel mode work
Jorge Arellano Cid <jcid@dillo.org>
parents: 1843
diff changeset
472 p_xpos += i->w();
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
473
1959
648b1506e9aa Introduced class CustLightButton for visual feedback on panel buttons
Jorge Arellano Cid <jcid@dillo.org>
parents: 1954
diff changeset
474 Search = b = new CustLightButton(p_xpos,0,16,lh,0);
374
fb3a62d1aab2 - Set UI's to share icons.
jcid
parents: 372
diff changeset
475 b->image(icons->ImgSearch);
341
215da0caf90b - Implemented tabbed browsing.
jcid
parents: 337
diff changeset
476 b->callback(search_cb, this);
1813
6a203275d317 a bit of src/ui
corvid <corvid@lavabit.com>
parents: 1806
diff changeset
477 b->clear_visible_focus();
1924
998acefd6a51 Initial changes to make the tiny panel mode work
Jorge Arellano Cid <jcid@dillo.org>
parents: 1843
diff changeset
478 b->box(FL_THIN_UP_BOX);
998acefd6a51 Initial changes to make the tiny panel mode work
Jorge Arellano Cid <jcid@dillo.org>
parents: 1843
diff changeset
479 p_xpos += b->w();
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
480
1959
648b1506e9aa Introduced class CustLightButton for visual feedback on panel buttons
Jorge Arellano Cid <jcid@dillo.org>
parents: 1954
diff changeset
481 Help = b = new CustLightButton(p_xpos,0,16,lh,0);
1525
3c683905dbe3 Added a help button. It tries a local help file then dillo.org's one.
corvid, jcid
parents: 1343
diff changeset
482 b->image(icons->ImgHelp);
3c683905dbe3 Added a help button. It tries a local help file then dillo.org's one.
corvid, jcid
parents: 1343
diff changeset
483 b->callback(help_cb, this);
1813
6a203275d317 a bit of src/ui
corvid <corvid@lavabit.com>
parents: 1806
diff changeset
484 b->clear_visible_focus();
1924
998acefd6a51 Initial changes to make the tiny panel mode work
Jorge Arellano Cid <jcid@dillo.org>
parents: 1843
diff changeset
485 b->box(FL_THIN_UP_BOX);
998acefd6a51 Initial changes to make the tiny panel mode work
Jorge Arellano Cid <jcid@dillo.org>
parents: 1843
diff changeset
486 p_xpos += b->w();
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
487
1343
16ed4ed58863 only set tooltips for UI if prefs.show_tooltip set
corvid <corvid@lavabit.com>
parents: 1308
diff changeset
488 if (prefs.show_tooltip) {
16ed4ed58863 only set tooltips for UI if prefs.show_tooltip set
corvid <corvid@lavabit.com>
parents: 1308
diff changeset
489 Clear->tooltip("Clear the URL box.\nMiddle-click to paste a URL.");
16ed4ed58863 only set tooltips for UI if prefs.show_tooltip set
corvid <corvid@lavabit.com>
parents: 1308
diff changeset
490 Location->tooltip("Location");
16ed4ed58863 only set tooltips for UI if prefs.show_tooltip set
corvid <corvid@lavabit.com>
parents: 1308
diff changeset
491 Search->tooltip("Search the Web");
1525
3c683905dbe3 Added a help button. It tries a local help file then dillo.org's one.
corvid, jcid
parents: 1343
diff changeset
492 Help->tooltip("Help");
1343
16ed4ed58863 only set tooltips for UI if prefs.show_tooltip set
corvid <corvid@lavabit.com>
parents: 1308
diff changeset
493 }
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
494 }
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
495
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
496 /*
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
497 * Create the progress bars
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
498 */
1924
998acefd6a51 Initial changes to make the tiny panel mode work
Jorge Arellano Cid <jcid@dillo.org>
parents: 1843
diff changeset
499 void UI::make_progress_bars(int wide, int thin_up)
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
500 {
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
501 // Images
1924
998acefd6a51 Initial changes to make the tiny panel mode work
Jorge Arellano Cid <jcid@dillo.org>
parents: 1843
diff changeset
502 IProg = new CustProgressBox(p_xpos,p_ypos,pw,bh);
998acefd6a51 Initial changes to make the tiny panel mode work
Jorge Arellano Cid <jcid@dillo.org>
parents: 1843
diff changeset
503 IProg->labelsize(12);
1795
0099818bc45b some UI constants
corvid <corvid@lavabit.com>
parents: 1794
diff changeset
504 IProg->box(thin_up ? FL_THIN_UP_BOX : FL_EMBOSSED_BOX);
1823
ca17943888ad more src/ui
corvid <corvid@lavabit.com>
parents: 1822
diff changeset
505 IProg->labelcolor(FL_GRAY_RAMP + 2);
75
4dfc78307039 Made progress bars resize automatically.
jcid
parents: 72
diff changeset
506 IProg->update_label(wide ? "Images\n0 of 0" : "0 of 0");
1924
998acefd6a51 Initial changes to make the tiny panel mode work
Jorge Arellano Cid <jcid@dillo.org>
parents: 1843
diff changeset
507 p_xpos += pw;
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
508 // Page
1924
998acefd6a51 Initial changes to make the tiny panel mode work
Jorge Arellano Cid <jcid@dillo.org>
parents: 1843
diff changeset
509 PProg = new CustProgressBox(p_xpos,p_ypos,pw,bh);
998acefd6a51 Initial changes to make the tiny panel mode work
Jorge Arellano Cid <jcid@dillo.org>
parents: 1843
diff changeset
510 PProg->labelsize(12);
1795
0099818bc45b some UI constants
corvid <corvid@lavabit.com>
parents: 1794
diff changeset
511 PProg->box(thin_up ? FL_THIN_UP_BOX : FL_EMBOSSED_BOX);
1823
ca17943888ad more src/ui
corvid <corvid@lavabit.com>
parents: 1822
diff changeset
512 PProg->labelcolor(FL_GRAY_RAMP + 2);
75
4dfc78307039 Made progress bars resize automatically.
jcid
parents: 72
diff changeset
513 PProg->update_label(wide ? "Page\n0.0KB" : "0.0KB");
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
514 }
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
515
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
516 /*
400
31b866fdde87 - File menu as popup implementation.
jcid
parents: 393
diff changeset
517 * Create the "File" menu
31b866fdde87 - File menu as popup implementation.
jcid
parents: 393
diff changeset
518 * Static function for File menu callbacks.
384
d33b55bb56c9 - Set menubar "close window" items from a timeout
jcid
parents: 383
diff changeset
519 */
1813
6a203275d317 a bit of src/ui
corvid <corvid@lavabit.com>
parents: 1806
diff changeset
520 Fl_Widget *UI::make_filemenu_button()
384
d33b55bb56c9 - Set menubar "close window" items from a timeout
jcid
parents: 383
diff changeset
521 {
1813
6a203275d317 a bit of src/ui
corvid <corvid@lavabit.com>
parents: 1806
diff changeset
522 Fl_Button *btn;
2004
dec39f62be1c fl_measure expects w to be set
corvid <corvid@lavabit.com>
parents: 2003
diff changeset
523 int w = 0, h = 0, padding;
400
31b866fdde87 - File menu as popup implementation.
jcid
parents: 393
diff changeset
524
1924
998acefd6a51 Initial changes to make the tiny panel mode work
Jorge Arellano Cid <jcid@dillo.org>
parents: 1843
diff changeset
525 FileButton = btn = new Fl_Button(p_xpos,0,0,0,"W");
1970
7bfc11c78869 Set FL_FREE_LABELTYPE to interpret symbols and draw shortcut (for "File" menu)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1967
diff changeset
526 btn->labeltype(FL_FREE_LABELTYPE);
400
31b866fdde87 - File menu as popup implementation.
jcid
parents: 393
diff changeset
527 btn->measure_label(w, h);
31b866fdde87 - File menu as popup implementation.
jcid
parents: 393
diff changeset
528 padding = w;
31b866fdde87 - File menu as popup implementation.
jcid
parents: 393
diff changeset
529 btn->copy_label(PanelSize == P_tiny ? "&F" : "&File");
31b866fdde87 - File menu as popup implementation.
jcid
parents: 393
diff changeset
530 btn->measure_label(w,h);
1967
fa525b466aef Fixed offset bugs with panel tiny and large (also fullscreen mode for large)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1959
diff changeset
531 h = (PanelSize == P_large) ? mh : (PanelSize == P_tiny) ? bh : lh;
fa525b466aef Fixed offset bugs with panel tiny and large (also fullscreen mode for large)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1959
diff changeset
532 btn->size(w+padding, h);
1924
998acefd6a51 Initial changes to make the tiny panel mode work
Jorge Arellano Cid <jcid@dillo.org>
parents: 1843
diff changeset
533 p_xpos += btn->w();
400
31b866fdde87 - File menu as popup implementation.
jcid
parents: 393
diff changeset
534 _MSG("UI::make_filemenu_button w=%d h=%d padding=%d\n", w, h, padding);
1944
3d6b3abb3b68 Minor fixes for panel_size=large
Jorge Arellano Cid <jcid@dillo.org>
parents: 1930
diff changeset
535 btn->box(PanelSize == P_large ? FL_THIN_UP_BOX : FL_THIN_UP_BOX);
400
31b866fdde87 - File menu as popup implementation.
jcid
parents: 393
diff changeset
536 btn->callback(filemenu_cb, this);
1343
16ed4ed58863 only set tooltips for UI if prefs.show_tooltip set
corvid <corvid@lavabit.com>
parents: 1308
diff changeset
537 if (prefs.show_tooltip)
16ed4ed58863 only set tooltips for UI if prefs.show_tooltip set
corvid <corvid@lavabit.com>
parents: 1308
diff changeset
538 btn->tooltip("File menu");
1822
a0ed332132e1 some more src/ui
corvid <corvid@lavabit.com>
parents: 1813
diff changeset
539 btn->clear_visible_focus();
1980
95f3007dbbfc Made button visibility prefs work again for: search, help and file menu
Jorge Arellano Cid <jcid@dillo.org>
parents: 1978
diff changeset
540 if (!prefs.show_filemenu)
400
31b866fdde87 - File menu as popup implementation.
jcid
parents: 393
diff changeset
541 btn->hide();
31b866fdde87 - File menu as popup implementation.
jcid
parents: 393
diff changeset
542 return btn;
384
d33b55bb56c9 - Set menubar "close window" items from a timeout
jcid
parents: 383
diff changeset
543 }
d33b55bb56c9 - Set menubar "close window" items from a timeout
jcid
parents: 383
diff changeset
544
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
545
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
546 /*
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
547 * Create the control panel
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
548 */
1924
998acefd6a51 Initial changes to make the tiny panel mode work
Jorge Arellano Cid <jcid@dillo.org>
parents: 1843
diff changeset
549 void UI::make_panel(int ww)
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
550 {
1813
6a203275d317 a bit of src/ui
corvid <corvid@lavabit.com>
parents: 1806
diff changeset
551 Fl_Widget *w;
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
552
374
fb3a62d1aab2 - Set UI's to share icons.
jcid
parents: 372
diff changeset
553 if (Small_Icons)
fb3a62d1aab2 - Set UI's to share icons.
jcid
parents: 372
diff changeset
554 icons = &small_icons;
fb3a62d1aab2 - Set UI's to share icons.
jcid
parents: 372
diff changeset
555 else
fb3a62d1aab2 - Set UI's to share icons.
jcid
parents: 372
diff changeset
556 icons = &standard_icons;
930
b277eed3119c whitespace cleanup: 's/ +$//g'
Jorge Arellano Cid <jcid@dillo.org>
parents: 907
diff changeset
557
1924
998acefd6a51 Initial changes to make the tiny panel mode work
Jorge Arellano Cid <jcid@dillo.org>
parents: 1843
diff changeset
558 pw = 70;
998acefd6a51 Initial changes to make the tiny panel mode work
Jorge Arellano Cid <jcid@dillo.org>
parents: 1843
diff changeset
559 p_xpos = p_ypos = 0;
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
560 if (PanelSize == P_tiny) {
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
561 if (Small_Icons)
1947
821e6262ead9 Keybindings and some variable name normalizations
Jorge Arellano Cid <jcid@dillo.org>
parents: 1945
diff changeset
562 bw = 22, bh = 22, mh = 0, lh = 22, lbl = 0;
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
563 else
1947
821e6262ead9 Keybindings and some variable name normalizations
Jorge Arellano Cid <jcid@dillo.org>
parents: 1945
diff changeset
564 bw = 28, bh = 28, mh = 0, lh = 28, lbl = 0;
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
565 } else if (PanelSize == P_small) {
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
566 if (Small_Icons)
1947
821e6262ead9 Keybindings and some variable name normalizations
Jorge Arellano Cid <jcid@dillo.org>
parents: 1945
diff changeset
567 bw = 20, bh = 20, mh = 0, lh = 20, lbl = 0;
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
568 else
1947
821e6262ead9 Keybindings and some variable name normalizations
Jorge Arellano Cid <jcid@dillo.org>
parents: 1945
diff changeset
569 bw = 28, bh = 28, mh = 0, lh = 28, lbl = 0;
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
570 } else if (PanelSize == P_medium) {
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
571 if (Small_Icons)
1947
821e6262ead9 Keybindings and some variable name normalizations
Jorge Arellano Cid <jcid@dillo.org>
parents: 1945
diff changeset
572 bw = 42, bh = 36, mh = 0, lh = 22, lbl = 1;
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
573 else
1947
821e6262ead9 Keybindings and some variable name normalizations
Jorge Arellano Cid <jcid@dillo.org>
parents: 1945
diff changeset
574 bw = 45, bh = 45, mh = 0, lh = 28, lbl = 1;
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
575 } else { // P_large
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
576 if (Small_Icons)
1947
821e6262ead9 Keybindings and some variable name normalizations
Jorge Arellano Cid <jcid@dillo.org>
parents: 1945
diff changeset
577 bw = 42, bh = 36, mh = 22, lh = 22, lbl = 1;
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
578 else
1947
821e6262ead9 Keybindings and some variable name normalizations
Jorge Arellano Cid <jcid@dillo.org>
parents: 1945
diff changeset
579 bw = 45, bh = 45, mh = 24, lh = 28, lbl = 1;
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
580 }
1947
821e6262ead9 Keybindings and some variable name normalizations
Jorge Arellano Cid <jcid@dillo.org>
parents: 1945
diff changeset
581 nh = bh, fh = 28; sh = 20;
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
582
1975
06bbf0f0df1c Switched make_panel() to use insert() instead of begin()/end() pairs
Jorge Arellano Cid <jcid@dillo.org>
parents: 1972
diff changeset
583 current(0);
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
584 if (PanelSize == P_tiny) {
1967
fa525b466aef Fixed offset bugs with panel tiny and large (also fullscreen mode for large)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1959
diff changeset
585 NavBar = new CustGroup(0,0,ww,nh);
1927
e7abafb75d0e Made Dillo code follow my fltk1.3 UI prototype
Jorge Arellano Cid <jcid@dillo.org>
parents: 1925
diff changeset
586 NavBar->begin();
1924
998acefd6a51 Initial changes to make the tiny panel mode work
Jorge Arellano Cid <jcid@dillo.org>
parents: 1843
diff changeset
587 make_toolbar(ww,bh);
998acefd6a51 Initial changes to make the tiny panel mode work
Jorge Arellano Cid <jcid@dillo.org>
parents: 1843
diff changeset
588 make_filemenu_button();
998acefd6a51 Initial changes to make the tiny panel mode work
Jorge Arellano Cid <jcid@dillo.org>
parents: 1843
diff changeset
589 make_location(ww);
1927
e7abafb75d0e Made Dillo code follow my fltk1.3 UI prototype
Jorge Arellano Cid <jcid@dillo.org>
parents: 1925
diff changeset
590 NavBar->resizable(Location);
1924
998acefd6a51 Initial changes to make the tiny panel mode work
Jorge Arellano Cid <jcid@dillo.org>
parents: 1843
diff changeset
591 make_progress_bars(0,1);
1927
e7abafb75d0e Made Dillo code follow my fltk1.3 UI prototype
Jorge Arellano Cid <jcid@dillo.org>
parents: 1925
diff changeset
592 NavBar->box(FL_THIN_UP_FRAME);
e7abafb75d0e Made Dillo code follow my fltk1.3 UI prototype
Jorge Arellano Cid <jcid@dillo.org>
parents: 1925
diff changeset
593 NavBar->end();
1975
06bbf0f0df1c Switched make_panel() to use insert() instead of begin()/end() pairs
Jorge Arellano Cid <jcid@dillo.org>
parents: 1972
diff changeset
594 TopGroup->insert(*NavBar,0);
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
595 } else {
1924
998acefd6a51 Initial changes to make the tiny panel mode work
Jorge Arellano Cid <jcid@dillo.org>
parents: 1843
diff changeset
596 if (PanelSize == P_large) {
1967
fa525b466aef Fixed offset bugs with panel tiny and large (also fullscreen mode for large)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1959
diff changeset
597 MenuBar = new CustGroup(0,0,ww,mh);
fa525b466aef Fixed offset bugs with panel tiny and large (also fullscreen mode for large)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1959
diff changeset
598 MenuBar->begin();
fa525b466aef Fixed offset bugs with panel tiny and large (also fullscreen mode for large)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1959
diff changeset
599 MenuBar->box(FL_THIN_UP_BOX);
1927
e7abafb75d0e Made Dillo code follow my fltk1.3 UI prototype
Jorge Arellano Cid <jcid@dillo.org>
parents: 1925
diff changeset
600 Fl_Widget *bn = make_filemenu_button();
1967
fa525b466aef Fixed offset bugs with panel tiny and large (also fullscreen mode for large)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1959
diff changeset
601 MenuBar->add_resizable(*new Fl_Box(bn->w(),0,ww - bn->w(),mh));
fa525b466aef Fixed offset bugs with panel tiny and large (also fullscreen mode for large)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1959
diff changeset
602 MenuBar->end();
1975
06bbf0f0df1c Switched make_panel() to use insert() instead of begin()/end() pairs
Jorge Arellano Cid <jcid@dillo.org>
parents: 1972
diff changeset
603 TopGroup->insert(*MenuBar,0);
408
46ea0474adc6 . Minor update to README.
jcid
parents: 400
diff changeset
604
1944
3d6b3abb3b68 Minor fixes for panel_size=large
Jorge Arellano Cid <jcid@dillo.org>
parents: 1930
diff changeset
605 p_xpos = 0;
1927
e7abafb75d0e Made Dillo code follow my fltk1.3 UI prototype
Jorge Arellano Cid <jcid@dillo.org>
parents: 1925
diff changeset
606 LocBar = new CustGroup(0,0,ww,lh);
e7abafb75d0e Made Dillo code follow my fltk1.3 UI prototype
Jorge Arellano Cid <jcid@dillo.org>
parents: 1925
diff changeset
607 LocBar->begin();
e7abafb75d0e Made Dillo code follow my fltk1.3 UI prototype
Jorge Arellano Cid <jcid@dillo.org>
parents: 1925
diff changeset
608 make_location(ww);
1980
95f3007dbbfc Made button visibility prefs work again for: search, help and file menu
Jorge Arellano Cid <jcid@dillo.org>
parents: 1978
diff changeset
609 LocBar->resizable(Location);
1927
e7abafb75d0e Made Dillo code follow my fltk1.3 UI prototype
Jorge Arellano Cid <jcid@dillo.org>
parents: 1925
diff changeset
610 LocBar->end();
1975
06bbf0f0df1c Switched make_panel() to use insert() instead of begin()/end() pairs
Jorge Arellano Cid <jcid@dillo.org>
parents: 1972
diff changeset
611 TopGroup->insert(*LocBar,1);
1924
998acefd6a51 Initial changes to make the tiny panel mode work
Jorge Arellano Cid <jcid@dillo.org>
parents: 1843
diff changeset
612 } else {
1927
e7abafb75d0e Made Dillo code follow my fltk1.3 UI prototype
Jorge Arellano Cid <jcid@dillo.org>
parents: 1925
diff changeset
613 LocBar = new CustGroup(0,0,ww,lh);
1975
06bbf0f0df1c Switched make_panel() to use insert() instead of begin()/end() pairs
Jorge Arellano Cid <jcid@dillo.org>
parents: 1972
diff changeset
614 LocBar->begin();
1925
72bfd5e7edcd Added CustGroup class (it repositions child widgets when others are hidden)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1924
diff changeset
615 p_xpos = 0;
400
31b866fdde87 - File menu as popup implementation.
jcid
parents: 393
diff changeset
616 make_filemenu_button();
1924
998acefd6a51 Initial changes to make the tiny panel mode work
Jorge Arellano Cid <jcid@dillo.org>
parents: 1843
diff changeset
617 make_location(ww);
1927
e7abafb75d0e Made Dillo code follow my fltk1.3 UI prototype
Jorge Arellano Cid <jcid@dillo.org>
parents: 1925
diff changeset
618 LocBar->resizable(Location);
e7abafb75d0e Made Dillo code follow my fltk1.3 UI prototype
Jorge Arellano Cid <jcid@dillo.org>
parents: 1925
diff changeset
619 LocBar->end();
1975
06bbf0f0df1c Switched make_panel() to use insert() instead of begin()/end() pairs
Jorge Arellano Cid <jcid@dillo.org>
parents: 1972
diff changeset
620 TopGroup->insert(*LocBar,0);
1924
998acefd6a51 Initial changes to make the tiny panel mode work
Jorge Arellano Cid <jcid@dillo.org>
parents: 1843
diff changeset
621 }
930
b277eed3119c whitespace cleanup: 's/ +$//g'
Jorge Arellano Cid <jcid@dillo.org>
parents: 907
diff changeset
622
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
623 // Toolbar
1924
998acefd6a51 Initial changes to make the tiny panel mode work
Jorge Arellano Cid <jcid@dillo.org>
parents: 1843
diff changeset
624 p_ypos = 0;
1927
e7abafb75d0e Made Dillo code follow my fltk1.3 UI prototype
Jorge Arellano Cid <jcid@dillo.org>
parents: 1925
diff changeset
625 NavBar = new CustGroup(0,0,ww,bh);
e7abafb75d0e Made Dillo code follow my fltk1.3 UI prototype
Jorge Arellano Cid <jcid@dillo.org>
parents: 1925
diff changeset
626 NavBar->begin();
1924
998acefd6a51 Initial changes to make the tiny panel mode work
Jorge Arellano Cid <jcid@dillo.org>
parents: 1843
diff changeset
627 make_toolbar(ww,bh);
1929
5ce120292c22 Added code and made the necesary bindings so tabs start to be functional
Jorge Arellano Cid <jcid@dillo.org>
parents: 1928
diff changeset
628 w = new Fl_Box(p_xpos,0,ww-p_xpos-2*pw,bh);
1981
3640968ba259 Fixed a glitch with panel size change and redraw
Jorge Arellano Cid <jcid@dillo.org>
parents: 1980
diff changeset
629 w->box(FL_FLAT_BOX);
1927
e7abafb75d0e Made Dillo code follow my fltk1.3 UI prototype
Jorge Arellano Cid <jcid@dillo.org>
parents: 1925
diff changeset
630 NavBar->resizable(w);
1924
998acefd6a51 Initial changes to make the tiny panel mode work
Jorge Arellano Cid <jcid@dillo.org>
parents: 1843
diff changeset
631 p_xpos = ww - 2*pw;
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
632 if (PanelSize == P_small) {
1924
998acefd6a51 Initial changes to make the tiny panel mode work
Jorge Arellano Cid <jcid@dillo.org>
parents: 1843
diff changeset
633 make_progress_bars(0,0);
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
634 } else {
1924
998acefd6a51 Initial changes to make the tiny panel mode work
Jorge Arellano Cid <jcid@dillo.org>
parents: 1843
diff changeset
635 make_progress_bars(1,0);
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
636 }
1927
e7abafb75d0e Made Dillo code follow my fltk1.3 UI prototype
Jorge Arellano Cid <jcid@dillo.org>
parents: 1925
diff changeset
637 NavBar->end();
1975
06bbf0f0df1c Switched make_panel() to use insert() instead of begin()/end() pairs
Jorge Arellano Cid <jcid@dillo.org>
parents: 1972
diff changeset
638 TopGroup->insert(*NavBar,(MenuBar ? 2 : 1));
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
639 }
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
640 }
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
641
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
642 /*
946
f06d5c581f58 Moved creation of the UI's status panel into a function.
corvid <corvid@lavabit.com>
parents: 930
diff changeset
643 * Create the status panel
f06d5c581f58 Moved creation of the UI's status panel into a function.
corvid <corvid@lavabit.com>
parents: 930
diff changeset
644 */
1947
821e6262ead9 Keybindings and some variable name normalizations
Jorge Arellano Cid <jcid@dillo.org>
parents: 1945
diff changeset
645 void UI::make_status_bar(int ww, int wh)
946
f06d5c581f58 Moved creation of the UI's status panel into a function.
corvid <corvid@lavabit.com>
parents: 930
diff changeset
646 {
1945
b24a5b73ff10 Made the status bar visible and operative.
Jorge Arellano Cid <jcid@dillo.org>
parents: 1944
diff changeset
647 const int bm_w = 20;
1947
821e6262ead9 Keybindings and some variable name normalizations
Jorge Arellano Cid <jcid@dillo.org>
parents: 1945
diff changeset
648 StatusBar = new CustGroup(0, wh-sh, ww, sh);
946
f06d5c581f58 Moved creation of the UI's status panel into a function.
corvid <corvid@lavabit.com>
parents: 930
diff changeset
649
1945
b24a5b73ff10 Made the status bar visible and operative.
Jorge Arellano Cid <jcid@dillo.org>
parents: 1944
diff changeset
650 // Status box
b24a5b73ff10 Made the status bar visible and operative.
Jorge Arellano Cid <jcid@dillo.org>
parents: 1944
diff changeset
651 StatusOutput = new Fl_Output(0, wh-sh, ww-bm_w, sh);
1952
fb462b4abcfa www.dillo.org status value
corvid <corvid@lavabit.com>
parents: 1951
diff changeset
652 StatusOutput->value("http://www.dillo.org");
1945
b24a5b73ff10 Made the status bar visible and operative.
Jorge Arellano Cid <jcid@dillo.org>
parents: 1944
diff changeset
653 StatusOutput->labelsize(8);
b24a5b73ff10 Made the status bar visible and operative.
Jorge Arellano Cid <jcid@dillo.org>
parents: 1944
diff changeset
654 StatusOutput->box(FL_THIN_DOWN_BOX);
b24a5b73ff10 Made the status bar visible and operative.
Jorge Arellano Cid <jcid@dillo.org>
parents: 1944
diff changeset
655 StatusOutput->clear_visible_focus();
b24a5b73ff10 Made the status bar visible and operative.
Jorge Arellano Cid <jcid@dillo.org>
parents: 1944
diff changeset
656 StatusOutput->color(FL_GRAY_RAMP + 18);
946
f06d5c581f58 Moved creation of the UI's status panel into a function.
corvid <corvid@lavabit.com>
parents: 930
diff changeset
657
1945
b24a5b73ff10 Made the status bar visible and operative.
Jorge Arellano Cid <jcid@dillo.org>
parents: 1944
diff changeset
658 // Bug Meter
1959
648b1506e9aa Introduced class CustLightButton for visual feedback on panel buttons
Jorge Arellano Cid <jcid@dillo.org>
parents: 1954
diff changeset
659 BugMeter = new CustLightButton(ww-bm_w,wh-sh,bm_w,sh);
1945
b24a5b73ff10 Made the status bar visible and operative.
Jorge Arellano Cid <jcid@dillo.org>
parents: 1944
diff changeset
660 BugMeter->image(icons->ImgMeterOK);
1950
cd551611000a Made the bug meter number&icon display correctly
Jorge Arellano Cid <jcid@dillo.org>
parents: 1948
diff changeset
661 BugMeter->box(FL_THIN_DOWN_BOX);
cd551611000a Made the bug meter number&icon display correctly
Jorge Arellano Cid <jcid@dillo.org>
parents: 1948
diff changeset
662 BugMeter->align(FL_ALIGN_TEXT_NEXT_TO_IMAGE);
1945
b24a5b73ff10 Made the status bar visible and operative.
Jorge Arellano Cid <jcid@dillo.org>
parents: 1944
diff changeset
663 if (prefs.show_tooltip)
b24a5b73ff10 Made the status bar visible and operative.
Jorge Arellano Cid <jcid@dillo.org>
parents: 1944
diff changeset
664 BugMeter->tooltip("Show HTML bugs\n(right-click for menu)");
b24a5b73ff10 Made the status bar visible and operative.
Jorge Arellano Cid <jcid@dillo.org>
parents: 1944
diff changeset
665 BugMeter->callback(bugmeter_cb, this);
b24a5b73ff10 Made the status bar visible and operative.
Jorge Arellano Cid <jcid@dillo.org>
parents: 1944
diff changeset
666 BugMeter->clear_visible_focus();
b24a5b73ff10 Made the status bar visible and operative.
Jorge Arellano Cid <jcid@dillo.org>
parents: 1944
diff changeset
667
1947
821e6262ead9 Keybindings and some variable name normalizations
Jorge Arellano Cid <jcid@dillo.org>
parents: 1945
diff changeset
668 StatusBar->end();
821e6262ead9 Keybindings and some variable name normalizations
Jorge Arellano Cid <jcid@dillo.org>
parents: 1945
diff changeset
669 StatusBar->resizable(StatusOutput);
946
f06d5c581f58 Moved creation of the UI's status panel into a function.
corvid <corvid@lavabit.com>
parents: 930
diff changeset
670 }
f06d5c581f58 Moved creation of the UI's status panel into a function.
corvid <corvid@lavabit.com>
parents: 930
diff changeset
671
f06d5c581f58 Moved creation of the UI's status panel into a function.
corvid <corvid@lavabit.com>
parents: 930
diff changeset
672 /*
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
673 * User Interface constructor
930
b277eed3119c whitespace cleanup: 's/ +$//g'
Jorge Arellano Cid <jcid@dillo.org>
parents: 907
diff changeset
674 */
1928
261762bef174 Part of the UI wasn't visible. This minor changes fix it.
Jorge Arellano Cid <jcid@dillo.org>
parents: 1927
diff changeset
675 UI::UI(int x, int y, int ui_w, int ui_h, const char* label, const UI *cur_ui) :
261762bef174 Part of the UI wasn't visible. This minor changes fix it.
Jorge Arellano Cid <jcid@dillo.org>
parents: 1927
diff changeset
676 Fl_Pack(x, y, ui_w, ui_h, label)
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
677 {
438
29c514f5ce00 - Added the "middle_click_drags_page" dillorc option.
jcid
parents: 408
diff changeset
678 PointerOnLink = FALSE;
29c514f5ce00 - Added the "middle_click_drags_page" dillorc option.
jcid
parents: 408
diff changeset
679
1967
fa525b466aef Fixed offset bugs with panel tiny and large (also fullscreen mode for large)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1959
diff changeset
680 MenuBar = LocBar = NavBar = StatusBar = NULL;
1953
808ca0de6d8f Made fullscreen work again (Ctrl+Space)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1952
diff changeset
681
341
215da0caf90b - Implemented tabbed browsing.
jcid
parents: 337
diff changeset
682 Tabs = NULL;
215da0caf90b - Implemented tabbed browsing.
jcid
parents: 337
diff changeset
683 TabTooltip = NULL;
1924
998acefd6a51 Initial changes to make the tiny panel mode work
Jorge Arellano Cid <jcid@dillo.org>
parents: 1843
diff changeset
684 TopGroup = this;
998acefd6a51 Initial changes to make the tiny panel mode work
Jorge Arellano Cid <jcid@dillo.org>
parents: 1843
diff changeset
685 TopGroup->type(VERTICAL);
2012
bfb8bc9ddf62 Avoid lots of flicker while resizing the window
Jorge Arellano Cid <jcid@dillo.org>
parents: 2004
diff changeset
686 TopGroup->box(FL_NO_BOX);
1806
6e5e5125dd97 RAW_LABEL is SHORTCUT_LABEL
corvid <corvid@lavabit.com>
parents: 1795
diff changeset
687 clear_flag(SHORTCUT_LABEL);
930
b277eed3119c whitespace cleanup: 's/ +$//g'
Jorge Arellano Cid <jcid@dillo.org>
parents: 907
diff changeset
688
72
fbda2a94d998 - Made "New browser window" inherit the panel style of its parent.
jcid
parents: 61
diff changeset
689 if (cur_ui) {
fbda2a94d998 - Made "New browser window" inherit the panel style of its parent.
jcid
parents: 61
diff changeset
690 PanelSize = cur_ui->PanelSize;
fbda2a94d998 - Made "New browser window" inherit the panel style of its parent.
jcid
parents: 61
diff changeset
691 CuteColor = cur_ui->CuteColor;
fbda2a94d998 - Made "New browser window" inherit the panel style of its parent.
jcid
parents: 61
diff changeset
692 Small_Icons = cur_ui->Small_Icons;
1584
5d2db34381f9 don't inherit UI_TEMPORARILY_SHOW_PANELS, use UI_HIDDEN instead
Johannes Hofmann <Johannes.Hofmann@gmx.de>
parents: 1579
diff changeset
693 if (cur_ui->Panelmode == UI_HIDDEN ||
5d2db34381f9 don't inherit UI_TEMPORARILY_SHOW_PANELS, use UI_HIDDEN instead
Johannes Hofmann <Johannes.Hofmann@gmx.de>
parents: 1579
diff changeset
694 cur_ui->Panelmode == UI_TEMPORARILY_SHOW_PANELS)
5d2db34381f9 don't inherit UI_TEMPORARILY_SHOW_PANELS, use UI_HIDDEN instead
Johannes Hofmann <Johannes.Hofmann@gmx.de>
parents: 1579
diff changeset
695 Panelmode = UI_HIDDEN;
5d2db34381f9 don't inherit UI_TEMPORARILY_SHOW_PANELS, use UI_HIDDEN instead
Johannes Hofmann <Johannes.Hofmann@gmx.de>
parents: 1579
diff changeset
696 else
5d2db34381f9 don't inherit UI_TEMPORARILY_SHOW_PANELS, use UI_HIDDEN instead
Johannes Hofmann <Johannes.Hofmann@gmx.de>
parents: 1579
diff changeset
697 Panelmode = UI_NORMAL;
72
fbda2a94d998 - Made "New browser window" inherit the panel style of its parent.
jcid
parents: 61
diff changeset
698 } else {
fbda2a94d998 - Made "New browser window" inherit the panel style of its parent.
jcid
parents: 61
diff changeset
699 // Set some default values
fbda2a94d998 - Made "New browser window" inherit the panel style of its parent.
jcid
parents: 61
diff changeset
700 //PanelSize = P_tiny, CuteColor = 26, Small_Icons = 0;
82
ac9dd0d4c7b0 - Enabled panel_size in preferences.
jcid
parents: 75
diff changeset
701 PanelSize = prefs.panel_size;
ac9dd0d4c7b0 - Enabled panel_size in preferences.
jcid
parents: 75
diff changeset
702 Small_Icons = prefs.small_icons;
ac9dd0d4c7b0 - Enabled panel_size in preferences.
jcid
parents: 75
diff changeset
703 CuteColor = 206;
217
a27eafd634d1 - Made CTRL-l focus the location bar instead of popping up a dialog.
jcid
parents: 213
diff changeset
704 Panelmode = (UIPanelmode) prefs.fullwindow_start;
72
fbda2a94d998 - Made "New browser window" inherit the panel style of its parent.
jcid
parents: 61
diff changeset
705 }
fbda2a94d998 - Made "New browser window" inherit the panel style of its parent.
jcid
parents: 61
diff changeset
706
86
c6cecbed4727 - Made TopGroup a PackedGroup, simplifying UI code and removing workarounds.
jcid
parents: 82
diff changeset
707 // Control panel
1924
998acefd6a51 Initial changes to make the tiny panel mode work
Jorge Arellano Cid <jcid@dillo.org>
parents: 1843
diff changeset
708 TopGroup->begin();
1928
261762bef174 Part of the UI wasn't visible. This minor changes fix it.
Jorge Arellano Cid <jcid@dillo.org>
parents: 1927
diff changeset
709 make_panel(ui_w);
1924
998acefd6a51 Initial changes to make the tiny panel mode work
Jorge Arellano Cid <jcid@dillo.org>
parents: 1843
diff changeset
710
998acefd6a51 Initial changes to make the tiny panel mode work
Jorge Arellano Cid <jcid@dillo.org>
parents: 1843
diff changeset
711 // Render area
1967
fa525b466aef Fixed offset bugs with panel tiny and large (also fullscreen mode for large)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1959
diff changeset
712 int main_h = ui_h - (mh+(LocBar?lh:0)+nh+fh+sh);
fa525b466aef Fixed offset bugs with panel tiny and large (also fullscreen mode for large)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1959
diff changeset
713 Main = new Fl_Group(0,0,0,main_h,"Welcome...");
1928
261762bef174 Part of the UI wasn't visible. This minor changes fix it.
Jorge Arellano Cid <jcid@dillo.org>
parents: 1927
diff changeset
714 Main->align(FL_ALIGN_CENTER|FL_ALIGN_INSIDE);
1924
998acefd6a51 Initial changes to make the tiny panel mode work
Jorge Arellano Cid <jcid@dillo.org>
parents: 1843
diff changeset
715 Main->box(FL_FLAT_BOX);
998acefd6a51 Initial changes to make the tiny panel mode work
Jorge Arellano Cid <jcid@dillo.org>
parents: 1843
diff changeset
716 Main->color(FL_GRAY_RAMP + 3);
998acefd6a51 Initial changes to make the tiny panel mode work
Jorge Arellano Cid <jcid@dillo.org>
parents: 1843
diff changeset
717 Main->labelfont(FL_HELVETICA_BOLD_ITALIC);
998acefd6a51 Initial changes to make the tiny panel mode work
Jorge Arellano Cid <jcid@dillo.org>
parents: 1843
diff changeset
718 Main->labelsize(36);
998acefd6a51 Initial changes to make the tiny panel mode work
Jorge Arellano Cid <jcid@dillo.org>
parents: 1843
diff changeset
719 Main->labeltype(FL_SHADOW_LABEL);
998acefd6a51 Initial changes to make the tiny panel mode work
Jorge Arellano Cid <jcid@dillo.org>
parents: 1843
diff changeset
720 Main->labelcolor(FL_WHITE);
1975
06bbf0f0df1c Switched make_panel() to use insert() instead of begin()/end() pairs
Jorge Arellano Cid <jcid@dillo.org>
parents: 1972
diff changeset
721 TopGroup->add(Main);
1924
998acefd6a51 Initial changes to make the tiny panel mode work
Jorge Arellano Cid <jcid@dillo.org>
parents: 1843
diff changeset
722 TopGroup->resizable(Main);
998acefd6a51 Initial changes to make the tiny panel mode work
Jorge Arellano Cid <jcid@dillo.org>
parents: 1843
diff changeset
723 MainIdx = TopGroup->find(Main);
998acefd6a51 Initial changes to make the tiny panel mode work
Jorge Arellano Cid <jcid@dillo.org>
parents: 1843
diff changeset
724
998acefd6a51 Initial changes to make the tiny panel mode work
Jorge Arellano Cid <jcid@dillo.org>
parents: 1843
diff changeset
725 // Find text bar
1948
caf71cd30ec8 Made the findbar operative again (it has tricks and workarounds)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1947
diff changeset
726 FindBarSpace = 1;
caf71cd30ec8 Made the findbar operative again (it has tricks and workarounds)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1947
diff changeset
727 FindBar = new Findbar(ui_w, fh);
caf71cd30ec8 Made the findbar operative again (it has tricks and workarounds)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1947
diff changeset
728 TopGroup->add(FindBar);
1947
821e6262ead9 Keybindings and some variable name normalizations
Jorge Arellano Cid <jcid@dillo.org>
parents: 1945
diff changeset
729
1924
998acefd6a51 Initial changes to make the tiny panel mode work
Jorge Arellano Cid <jcid@dillo.org>
parents: 1843
diff changeset
730 // Status Panel
1947
821e6262ead9 Keybindings and some variable name normalizations
Jorge Arellano Cid <jcid@dillo.org>
parents: 1945
diff changeset
731 make_status_bar(ui_w, ui_h);
1948
caf71cd30ec8 Made the findbar operative again (it has tricks and workarounds)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1947
diff changeset
732 TopGroup->add(StatusBar);
22
571f09e42ab6 - Hooked "Activate" to the form_receiver.
jcid
parents: 18
diff changeset
733
1924
998acefd6a51 Initial changes to make the tiny panel mode work
Jorge Arellano Cid <jcid@dillo.org>
parents: 1843
diff changeset
734 TopGroup->end();
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
735
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
736 // Make the full screen button (to be attached to the viewport later)
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
737 // TODO: attach to the viewport
1813
6a203275d317 a bit of src/ui
corvid <corvid@lavabit.com>
parents: 1806
diff changeset
738 //FullScreen = new Fl_Button(0,0,15,15);
337
47c57c73dd2c - minor mem leak fix.
jcid
parents: 333
diff changeset
739 //FullScreen->image(ImgFullScreenOn);
47c57c73dd2c - minor mem leak fix.
jcid
parents: 333
diff changeset
740 //FullScreen->tooltip("Hide Controls");
341
215da0caf90b - Implemented tabbed browsing.
jcid
parents: 337
diff changeset
741 //FullScreen->callback(fullscreen_cb, this);
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
742
32
90c545de7201 - Enabled hiding widgets of the control panel from dillorc2.
jcid
parents: 30
diff changeset
743 customize(0);
90c545de7201 - Enabled hiding widgets of the control panel from dillorc2.
jcid
parents: 30
diff changeset
744
217
a27eafd634d1 - Made CTRL-l focus the location bar instead of popping up a dialog.
jcid
parents: 213
diff changeset
745 if (Panelmode) {
1924
998acefd6a51 Initial changes to make the tiny panel mode work
Jorge Arellano Cid <jcid@dillo.org>
parents: 1843
diff changeset
746 //Panel->hide();
1947
821e6262ead9 Keybindings and some variable name normalizations
Jorge Arellano Cid <jcid@dillo.org>
parents: 1945
diff changeset
747 //StatusBar->hide();
72
fbda2a94d998 - Made "New browser window" inherit the panel style of its parent.
jcid
parents: 61
diff changeset
748 }
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
749 }
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
750
301
da2c1fb876c8 - implemented UI's destructor (i.e. UI::~UI())
jcid
parents: 224
diff changeset
751 /*
da2c1fb876c8 - implemented UI's destructor (i.e. UI::~UI())
jcid
parents: 224
diff changeset
752 * UI destructor
da2c1fb876c8 - implemented UI's destructor (i.e. UI::~UI())
jcid
parents: 224
diff changeset
753 */
da2c1fb876c8 - implemented UI's destructor (i.e. UI::~UI())
jcid
parents: 224
diff changeset
754 UI::~UI()
da2c1fb876c8 - implemented UI's destructor (i.e. UI::~UI())
jcid
parents: 224
diff changeset
755 {
341
215da0caf90b - Implemented tabbed browsing.
jcid
parents: 337
diff changeset
756 _MSG("UI::~UI()\n");
215da0caf90b - Implemented tabbed browsing.
jcid
parents: 337
diff changeset
757 dFree(TabTooltip);
2003
fd842ba40164 FindBar leak
corvid <corvid@lavabit.com>
parents: 1997
diff changeset
758
fd842ba40164 FindBar leak
corvid <corvid@lavabit.com>
parents: 1997
diff changeset
759 if (!FindBarSpace)
fd842ba40164 FindBar leak
corvid <corvid@lavabit.com>
parents: 1997
diff changeset
760 delete FindBar;
301
da2c1fb876c8 - implemented UI's destructor (i.e. UI::~UI())
jcid
parents: 224
diff changeset
761 }
220
2b5b315bcf24 - Set key bindings to its modifiers when alone only.
jcid
parents: 217
diff changeset
762
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
763 /*
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
764 * FLTK event handler for this window.
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
765 */
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
766 int UI::handle(int event)
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
767 {
1791
corvid <corvid@lavabit.com>
parents: 1790
diff changeset
768 _MSG("UI::handle event=%d (%d,%d)\n", event, Fl::event_x(), Fl::event_y());
341
215da0caf90b - Implemented tabbed browsing.
jcid
parents: 337
diff changeset
769
1064
485acc9e60e2 Added configurable keybindings! (in ~/.dillo/keysrc) # part1
Jorge Arellano Cid <jcid@dillo.org>
parents: 946
diff changeset
770 int ret = 0;
1791
corvid <corvid@lavabit.com>
parents: 1790
diff changeset
771 if (event == FL_KEYBOARD) {
341
215da0caf90b - Implemented tabbed browsing.
jcid
parents: 337
diff changeset
772 return 0; // Receive as shortcut
1791
corvid <corvid@lavabit.com>
parents: 1790
diff changeset
773 } else if (event == FL_SHORTCUT) {
1158
752b1f8da34f KeysCommand_t
corvid <corvid@lavabit.com>
parents: 1122
diff changeset
774 KeysCommand_t cmd = Keys::getKeyCmd();
1064
485acc9e60e2 Added configurable keybindings! (in ~/.dillo/keysrc) # part1
Jorge Arellano Cid <jcid@dillo.org>
parents: 946
diff changeset
775 if (cmd == KEYS_NOP) {
485acc9e60e2 Added configurable keybindings! (in ~/.dillo/keysrc) # part1
Jorge Arellano Cid <jcid@dillo.org>
parents: 946
diff changeset
776 // Do nothing
1209
6b35322fb5f2 keybindings for scrolling
corvid <corvid@lavabit.com>
parents: 1195
diff changeset
777 } else if (cmd == KEYS_SCREEN_UP || cmd == KEYS_SCREEN_DOWN ||
6b35322fb5f2 keybindings for scrolling
corvid <corvid@lavabit.com>
parents: 1195
diff changeset
778 cmd == KEYS_LINE_UP || cmd == KEYS_LINE_DOWN ||
6b35322fb5f2 keybindings for scrolling
corvid <corvid@lavabit.com>
parents: 1195
diff changeset
779 cmd == KEYS_LEFT || cmd == KEYS_RIGHT ||
6b35322fb5f2 keybindings for scrolling
corvid <corvid@lavabit.com>
parents: 1195
diff changeset
780 cmd == KEYS_TOP || cmd == KEYS_BOTTOM) {
6b35322fb5f2 keybindings for scrolling
corvid <corvid@lavabit.com>
parents: 1195
diff changeset
781 a_UIcmd_scroll(a_UIcmd_get_bw_by_widget(this), cmd);
6b35322fb5f2 keybindings for scrolling
corvid <corvid@lavabit.com>
parents: 1195
diff changeset
782 ret = 1;
1064
485acc9e60e2 Added configurable keybindings! (in ~/.dillo/keysrc) # part1
Jorge Arellano Cid <jcid@dillo.org>
parents: 946
diff changeset
783 } else if (cmd == KEYS_BACK) {
485acc9e60e2 Added configurable keybindings! (in ~/.dillo/keysrc) # part1
Jorge Arellano Cid <jcid@dillo.org>
parents: 946
diff changeset
784 a_UIcmd_back(a_UIcmd_get_bw_by_widget(this));
485acc9e60e2 Added configurable keybindings! (in ~/.dillo/keysrc) # part1
Jorge Arellano Cid <jcid@dillo.org>
parents: 946
diff changeset
785 ret = 1;
485acc9e60e2 Added configurable keybindings! (in ~/.dillo/keysrc) # part1
Jorge Arellano Cid <jcid@dillo.org>
parents: 946
diff changeset
786 } else if (cmd == KEYS_FORWARD) {
485acc9e60e2 Added configurable keybindings! (in ~/.dillo/keysrc) # part1
Jorge Arellano Cid <jcid@dillo.org>
parents: 946
diff changeset
787 a_UIcmd_forw(a_UIcmd_get_bw_by_widget(this));
485acc9e60e2 Added configurable keybindings! (in ~/.dillo/keysrc) # part1
Jorge Arellano Cid <jcid@dillo.org>
parents: 946
diff changeset
788 ret = 1;
485acc9e60e2 Added configurable keybindings! (in ~/.dillo/keysrc) # part1
Jorge Arellano Cid <jcid@dillo.org>
parents: 946
diff changeset
789 } else if (cmd == KEYS_BOOKMARKS) {
485acc9e60e2 Added configurable keybindings! (in ~/.dillo/keysrc) # part1
Jorge Arellano Cid <jcid@dillo.org>
parents: 946
diff changeset
790 a_UIcmd_book(a_UIcmd_get_bw_by_widget(this));
485acc9e60e2 Added configurable keybindings! (in ~/.dillo/keysrc) # part1
Jorge Arellano Cid <jcid@dillo.org>
parents: 946
diff changeset
791 ret = 1;
485acc9e60e2 Added configurable keybindings! (in ~/.dillo/keysrc) # part1
Jorge Arellano Cid <jcid@dillo.org>
parents: 946
diff changeset
792 } else if (cmd == KEYS_FIND) {
1995
5c3180af5df3 Re-enabled "Find text" to select text when already shown
Jorge Arellano Cid <jcid@dillo.org>
parents: 1988
diff changeset
793 findbar_toggle(1);
1064
485acc9e60e2 Added configurable keybindings! (in ~/.dillo/keysrc) # part1
Jorge Arellano Cid <jcid@dillo.org>
parents: 946
diff changeset
794 ret = 1;
485acc9e60e2 Added configurable keybindings! (in ~/.dillo/keysrc) # part1
Jorge Arellano Cid <jcid@dillo.org>
parents: 946
diff changeset
795 } else if (cmd == KEYS_WEBSEARCH) {
485acc9e60e2 Added configurable keybindings! (in ~/.dillo/keysrc) # part1
Jorge Arellano Cid <jcid@dillo.org>
parents: 946
diff changeset
796 a_UIcmd_search_dialog(a_UIcmd_get_bw_by_widget(this));
485acc9e60e2 Added configurable keybindings! (in ~/.dillo/keysrc) # part1
Jorge Arellano Cid <jcid@dillo.org>
parents: 946
diff changeset
797 ret = 1;
485acc9e60e2 Added configurable keybindings! (in ~/.dillo/keysrc) # part1
Jorge Arellano Cid <jcid@dillo.org>
parents: 946
diff changeset
798 } else if (cmd == KEYS_GOTO) {
485acc9e60e2 Added configurable keybindings! (in ~/.dillo/keysrc) # part1
Jorge Arellano Cid <jcid@dillo.org>
parents: 946
diff changeset
799 focus_location();
485acc9e60e2 Added configurable keybindings! (in ~/.dillo/keysrc) # part1
Jorge Arellano Cid <jcid@dillo.org>
parents: 946
diff changeset
800 ret = 1;
1954
b0fd6feb8c51 Bound KEYS_HIDE_PANELS key to hide panels (escape)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1953
diff changeset
801 } else if (cmd == KEYS_HIDE_PANELS) {
b0fd6feb8c51 Bound KEYS_HIDE_PANELS key to hide panels (escape)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1953
diff changeset
802 fullscreen_toggle();
1064
485acc9e60e2 Added configurable keybindings! (in ~/.dillo/keysrc) # part1
Jorge Arellano Cid <jcid@dillo.org>
parents: 946
diff changeset
803 ret = 1;
1954
b0fd6feb8c51 Bound KEYS_HIDE_PANELS key to hide panels (escape)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1953
diff changeset
804 //if (get_panelmode() == UI_TEMPORARILY_SHOW_PANELS)
b0fd6feb8c51 Bound KEYS_HIDE_PANELS key to hide panels (escape)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1953
diff changeset
805 // set_panelmode(UI_HIDDEN);
1064
485acc9e60e2 Added configurable keybindings! (in ~/.dillo/keysrc) # part1
Jorge Arellano Cid <jcid@dillo.org>
parents: 946
diff changeset
806 } else if (cmd == KEYS_OPEN) {
485acc9e60e2 Added configurable keybindings! (in ~/.dillo/keysrc) # part1
Jorge Arellano Cid <jcid@dillo.org>
parents: 946
diff changeset
807 a_UIcmd_open_file(a_UIcmd_get_bw_by_widget(this));
485acc9e60e2 Added configurable keybindings! (in ~/.dillo/keysrc) # part1
Jorge Arellano Cid <jcid@dillo.org>
parents: 946
diff changeset
808 ret = 1;
485acc9e60e2 Added configurable keybindings! (in ~/.dillo/keysrc) # part1
Jorge Arellano Cid <jcid@dillo.org>
parents: 946
diff changeset
809 } else if (cmd == KEYS_HOME) {
485acc9e60e2 Added configurable keybindings! (in ~/.dillo/keysrc) # part1
Jorge Arellano Cid <jcid@dillo.org>
parents: 946
diff changeset
810 a_UIcmd_home(a_UIcmd_get_bw_by_widget(this));
485acc9e60e2 Added configurable keybindings! (in ~/.dillo/keysrc) # part1
Jorge Arellano Cid <jcid@dillo.org>
parents: 946
diff changeset
811 ret = 1;
485acc9e60e2 Added configurable keybindings! (in ~/.dillo/keysrc) # part1
Jorge Arellano Cid <jcid@dillo.org>
parents: 946
diff changeset
812 } else if (cmd == KEYS_RELOAD) {
485acc9e60e2 Added configurable keybindings! (in ~/.dillo/keysrc) # part1
Jorge Arellano Cid <jcid@dillo.org>
parents: 946
diff changeset
813 a_UIcmd_reload(a_UIcmd_get_bw_by_widget(this));
485acc9e60e2 Added configurable keybindings! (in ~/.dillo/keysrc) # part1
Jorge Arellano Cid <jcid@dillo.org>
parents: 946
diff changeset
814 ret = 1;
1195
3d823ef2f6e3 Added the "stop" keybinding (not bound!)
corvid <corvid@lavabit.com>
parents: 1186
diff changeset
815 } else if (cmd == KEYS_STOP) {
3d823ef2f6e3 Added the "stop" keybinding (not bound!)
corvid <corvid@lavabit.com>
parents: 1186
diff changeset
816 a_UIcmd_stop(a_UIcmd_get_bw_by_widget(this));
3d823ef2f6e3 Added the "stop" keybinding (not bound!)
corvid <corvid@lavabit.com>
parents: 1186
diff changeset
817 ret = 1;
1308
23900c1bdf8d 'save' key action
corvid <corvid@lavabit.com>
parents: 1222
diff changeset
818 } else if (cmd == KEYS_SAVE) {
23900c1bdf8d 'save' key action
corvid <corvid@lavabit.com>
parents: 1222
diff changeset
819 a_UIcmd_save(a_UIcmd_get_bw_by_widget(this));
23900c1bdf8d 'save' key action
corvid <corvid@lavabit.com>
parents: 1222
diff changeset
820 ret = 1;
1064
485acc9e60e2 Added configurable keybindings! (in ~/.dillo/keysrc) # part1
Jorge Arellano Cid <jcid@dillo.org>
parents: 946
diff changeset
821 } else if (cmd == KEYS_FULLSCREEN) {
1953
808ca0de6d8f Made fullscreen work again (Ctrl+Space)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1952
diff changeset
822 fullscreen_toggle();
1064
485acc9e60e2 Added configurable keybindings! (in ~/.dillo/keysrc) # part1
Jorge Arellano Cid <jcid@dillo.org>
parents: 946
diff changeset
823 ret = 1;
485acc9e60e2 Added configurable keybindings! (in ~/.dillo/keysrc) # part1
Jorge Arellano Cid <jcid@dillo.org>
parents: 946
diff changeset
824 } else if (cmd == KEYS_FILE_MENU) {
485acc9e60e2 Added configurable keybindings! (in ~/.dillo/keysrc) # part1
Jorge Arellano Cid <jcid@dillo.org>
parents: 946
diff changeset
825 a_UIcmd_file_popup(a_UIcmd_get_bw_by_widget(this), FileButton);
485acc9e60e2 Added configurable keybindings! (in ~/.dillo/keysrc) # part1
Jorge Arellano Cid <jcid@dillo.org>
parents: 946
diff changeset
826 ret = 1;
333
9b507e8840a2 - Reverted an accidental testing code commit.
jcid
parents: 332
diff changeset
827 }
1947
821e6262ead9 Keybindings and some variable name normalizations
Jorge Arellano Cid <jcid@dillo.org>
parents: 1945
diff changeset
828 }
821e6262ead9 Keybindings and some variable name normalizations
Jorge Arellano Cid <jcid@dillo.org>
parents: 1945
diff changeset
829 #if 0
1791
corvid <corvid@lavabit.com>
parents: 1790
diff changeset
830 } else if (event == FL_PUSH) {
438
29c514f5ce00 - Added the "middle_click_drags_page" dillorc option.
jcid
parents: 408
diff changeset
831 if (prefs.middle_click_drags_page == 0 &&
1791
corvid <corvid@lavabit.com>
parents: 1790
diff changeset
832 Fl::event_button() == FL_MIDDLE_MOUSE &&
438
29c514f5ce00 - Added the "middle_click_drags_page" dillorc option.
jcid
parents: 408
diff changeset
833 !a_UIcmd_pointer_on_link(a_UIcmd_get_bw_by_widget(this))) {
1823
ca17943888ad more src/ui
corvid <corvid@lavabit.com>
parents: 1822
diff changeset
834 if (Main->contains(Fl::belowmouse())) {
1559
3bafb7d27d78 allow pasting into form widgets when middle_click_drags_page=NO
corvid <corvid@lavabit.com>
parents: 1525
diff changeset
835 /* Offer the event to Main's children (form widgets) */
1823
ca17943888ad more src/ui
corvid <corvid@lavabit.com>
parents: 1822
diff changeset
836 /* TODO: Try just offering it to Fl::belowmouse() */
1813
6a203275d317 a bit of src/ui
corvid <corvid@lavabit.com>
parents: 1806
diff changeset
837 ret = ((Fl_Group *)Main)->Fl_Group::handle(event);
1559
3bafb7d27d78 allow pasting into form widgets when middle_click_drags_page=NO
corvid <corvid@lavabit.com>
parents: 1525
diff changeset
838 }
3bafb7d27d78 allow pasting into form widgets when middle_click_drags_page=NO
corvid <corvid@lavabit.com>
parents: 1525
diff changeset
839 if (!ret) {
3bafb7d27d78 allow pasting into form widgets when middle_click_drags_page=NO
corvid <corvid@lavabit.com>
parents: 1525
diff changeset
840 /* middle click was not on a link or a form widget */
3bafb7d27d78 allow pasting into form widgets when middle_click_drags_page=NO
corvid <corvid@lavabit.com>
parents: 1525
diff changeset
841 paste_url();
3bafb7d27d78 allow pasting into form widgets when middle_click_drags_page=NO
corvid <corvid@lavabit.com>
parents: 1525
diff changeset
842 ret = 1;
3bafb7d27d78 allow pasting into form widgets when middle_click_drags_page=NO
corvid <corvid@lavabit.com>
parents: 1525
diff changeset
843 }
438
29c514f5ce00 - Added the "middle_click_drags_page" dillorc option.
jcid
parents: 408
diff changeset
844 }
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
845 }
1929
5ce120292c22 Added code and made the necesary bindings so tabs start to be functional
Jorge Arellano Cid <jcid@dillo.org>
parents: 1928
diff changeset
846 #endif
1064
485acc9e60e2 Added configurable keybindings! (in ~/.dillo/keysrc) # part1
Jorge Arellano Cid <jcid@dillo.org>
parents: 946
diff changeset
847 if (!ret) {
1813
6a203275d317 a bit of src/ui
corvid <corvid@lavabit.com>
parents: 1806
diff changeset
848 ret = Fl_Group::handle(event);
1064
485acc9e60e2 Added configurable keybindings! (in ~/.dillo/keysrc) # part1
Jorge Arellano Cid <jcid@dillo.org>
parents: 946
diff changeset
849 }
485acc9e60e2 Added configurable keybindings! (in ~/.dillo/keysrc) # part1
Jorge Arellano Cid <jcid@dillo.org>
parents: 946
diff changeset
850
52
1c6b55026e84 Switched UI shortcuts from a global event handler to UI::handle.
jcid
parents: 51
diff changeset
851 return ret;
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
852 }
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
853
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
854
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
855 //----------------------------
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
856 // API for the User Interface
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
857 //----------------------------
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
858
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
859 /*
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
860 * Get the text from the location input-box.
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
861 */
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
862 const char *UI::get_location()
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
863 {
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
864 return Location->value();
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
865 }
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
866
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
867 /*
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
868 * Set a new URL in the location input-box.
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
869 */
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
870 void UI::set_location(const char *str)
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
871 {
381
a6e2a67f8393 - Avoid a valgrind detexcted illegal memory access.
jcid
parents: 378
diff changeset
872 if (!str) str = "";
1822
a0ed332132e1 some more src/ui
corvid <corvid@lavabit.com>
parents: 1813
diff changeset
873 Location->value(str);
381
a6e2a67f8393 - Avoid a valgrind detexcted illegal memory access.
jcid
parents: 378
diff changeset
874 Location->position(strlen(str));
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
875 }
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
876
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
877 /*
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
878 * Focus location entry.
341
215da0caf90b - Implemented tabbed browsing.
jcid
parents: 337
diff changeset
879 * If it's not visible, show it until the callback is done.
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
880 */
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
881 void UI::focus_location()
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
882 {
341
215da0caf90b - Implemented tabbed browsing.
jcid
parents: 337
diff changeset
883 if (get_panelmode() == UI_HIDDEN) {
215da0caf90b - Implemented tabbed browsing.
jcid
parents: 337
diff changeset
884 set_panelmode(UI_TEMPORARILY_SHOW_PANELS);
215da0caf90b - Implemented tabbed browsing.
jcid
parents: 337
diff changeset
885 }
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
886 Location->take_focus();
314
cf1216d236d4 - Reimplemented the menubar in a more ortodox way.
jcid
parents: 311
diff changeset
887 // Make text selected when already focused.
cf1216d236d4 - Reimplemented the menubar in a more ortodox way.
jcid
parents: 311
diff changeset
888 Location->position(Location->size(), 0);
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
889 }
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
890
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
891 /*
341
215da0caf90b - Implemented tabbed browsing.
jcid
parents: 337
diff changeset
892 * Focus Main area.
215da0caf90b - Implemented tabbed browsing.
jcid
parents: 337
diff changeset
893 */
215da0caf90b - Implemented tabbed browsing.
jcid
parents: 337
diff changeset
894 void UI::focus_main()
215da0caf90b - Implemented tabbed browsing.
jcid
parents: 337
diff changeset
895 {
215da0caf90b - Implemented tabbed browsing.
jcid
parents: 337
diff changeset
896 Main->take_focus();
215da0caf90b - Implemented tabbed browsing.
jcid
parents: 337
diff changeset
897 }
215da0caf90b - Implemented tabbed browsing.
jcid
parents: 337
diff changeset
898
215da0caf90b - Implemented tabbed browsing.
jcid
parents: 337
diff changeset
899 /*
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
900 * Set a new message in the status bar.
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
901 */
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
902 void UI::set_status(const char *str)
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
903 {
1822
a0ed332132e1 some more src/ui
corvid <corvid@lavabit.com>
parents: 1813
diff changeset
904 StatusOutput->value(str);
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
905 }
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
906
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
907 /*
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
908 * Set the page progress text
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
909 * cmd: 0 Deactivate, 1 Update, 2 Clear
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
910 */
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
911 void UI::set_page_prog(size_t nbytes, int cmd)
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
912 {
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
913 char str[32];
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
914
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
915 if (cmd == 0) {
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
916 PProg->deactivate();
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
917 } else {
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
918 PProg->activate();
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
919 if (cmd == 1) {
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
920 snprintf(str, 32, "%s%.1f KB",
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
921 (PanelSize == 0) ? "" : "Page\n", nbytes/1024.0);
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
922 } else if (cmd == 2) {
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
923 str[0] = '\0';
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
924 }
75
4dfc78307039 Made progress bars resize automatically.
jcid
parents: 72
diff changeset
925 PProg->update_label(str);
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
926 }
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
927 }
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
928
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
929 /*
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
930 * Set the image progress text
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
931 * cmd: 0 Deactivate, 1 Update, 2 Clear
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
932 */
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
933 void UI::set_img_prog(int n_img, int t_img, int cmd)
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
934 {
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
935 char str[32];
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
936
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
937 if (cmd == 0) {
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
938 IProg->deactivate();
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
939 } else {
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
940 IProg->activate();
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
941 if (cmd == 1) {
930
b277eed3119c whitespace cleanup: 's/ +$//g'
Jorge Arellano Cid <jcid@dillo.org>
parents: 907
diff changeset
942 snprintf(str, 32, "%s%d of %d",
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
943 (PanelSize == 0) ? "" : "Images\n", n_img, t_img);
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
944 } else if (cmd == 2) {
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
945 str[0] = '\0';
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
946 }
75
4dfc78307039 Made progress bars resize automatically.
jcid
parents: 72
diff changeset
947 IProg->update_label(str);
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
948 }
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
949 }
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
950
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
951 /*
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
952 * Set the bug meter progress text
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
953 */
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
954 void UI::set_bug_prog(int n_bug)
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
955 {
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
956 char str[32];
1950
cd551611000a Made the bug meter number&icon display correctly
Jorge Arellano Cid <jcid@dillo.org>
parents: 1948
diff changeset
957 int new_w = 20;
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
958
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
959 if (n_bug == 0) {
374
fb3a62d1aab2 - Set UI's to share icons.
jcid
parents: 372
diff changeset
960 BugMeter->image(icons->ImgMeterOK);
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
961 BugMeter->label("");
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
962 } else if (n_bug >= 1) {
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
963 if (n_bug == 1)
374
fb3a62d1aab2 - Set UI's to share icons.
jcid
parents: 372
diff changeset
964 BugMeter->image(icons->ImgMeterBug);
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
965 snprintf(str, 32, "%d", n_bug);
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
966 BugMeter->copy_label(str);
1950
cd551611000a Made the bug meter number&icon display correctly
Jorge Arellano Cid <jcid@dillo.org>
parents: 1948
diff changeset
967 new_w = strlen(str)*9 + 20;
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
968 }
1950
cd551611000a Made the bug meter number&icon display correctly
Jorge Arellano Cid <jcid@dillo.org>
parents: 1948
diff changeset
969 BugMeter->size(new_w, BugMeter->h());
cd551611000a Made the bug meter number&icon display correctly
Jorge Arellano Cid <jcid@dillo.org>
parents: 1948
diff changeset
970 StatusBar->rearrange();
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
971 }
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
972
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
973 /*
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
974 * Customize the UI's panel (show/hide buttons)
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
975 */
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
976 void UI::customize(int flags)
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
977 {
32
90c545de7201 - Enabled hiding widgets of the control panel from dillorc2.
jcid
parents: 30
diff changeset
978 // flags argument not currently used
90c545de7201 - Enabled hiding widgets of the control panel from dillorc2.
jcid
parents: 30
diff changeset
979
90c545de7201 - Enabled hiding widgets of the control panel from dillorc2.
jcid
parents: 30
diff changeset
980 if ( !prefs.show_back )
90c545de7201 - Enabled hiding widgets of the control panel from dillorc2.
jcid
parents: 30
diff changeset
981 Back->hide();
90c545de7201 - Enabled hiding widgets of the control panel from dillorc2.
jcid
parents: 30
diff changeset
982 if ( !prefs.show_forw )
90c545de7201 - Enabled hiding widgets of the control panel from dillorc2.
jcid
parents: 30
diff changeset
983 Forw->hide();
90c545de7201 - Enabled hiding widgets of the control panel from dillorc2.
jcid
parents: 30
diff changeset
984 if ( !prefs.show_home )
90c545de7201 - Enabled hiding widgets of the control panel from dillorc2.
jcid
parents: 30
diff changeset
985 Home->hide();
90c545de7201 - Enabled hiding widgets of the control panel from dillorc2.
jcid
parents: 30
diff changeset
986 if ( !prefs.show_reload )
90c545de7201 - Enabled hiding widgets of the control panel from dillorc2.
jcid
parents: 30
diff changeset
987 Reload->hide();
90c545de7201 - Enabled hiding widgets of the control panel from dillorc2.
jcid
parents: 30
diff changeset
988 if ( !prefs.show_save )
90c545de7201 - Enabled hiding widgets of the control panel from dillorc2.
jcid
parents: 30
diff changeset
989 Save->hide();
90c545de7201 - Enabled hiding widgets of the control panel from dillorc2.
jcid
parents: 30
diff changeset
990 if ( !prefs.show_stop )
90c545de7201 - Enabled hiding widgets of the control panel from dillorc2.
jcid
parents: 30
diff changeset
991 Stop->hide();
90c545de7201 - Enabled hiding widgets of the control panel from dillorc2.
jcid
parents: 30
diff changeset
992 if ( !prefs.show_bookmarks )
90c545de7201 - Enabled hiding widgets of the control panel from dillorc2.
jcid
parents: 30
diff changeset
993 Bookmarks->hide();
834
9a0725437bf1 Added the show_tools dillorc option
corvid <corvid@lavabit.com>
parents: 827
diff changeset
994 if ( !prefs.show_tools )
9a0725437bf1 Added the show_tools dillorc option
corvid <corvid@lavabit.com>
parents: 827
diff changeset
995 Tools->hide();
32
90c545de7201 - Enabled hiding widgets of the control panel from dillorc2.
jcid
parents: 30
diff changeset
996 if ( !prefs.show_clear_url )
90c545de7201 - Enabled hiding widgets of the control panel from dillorc2.
jcid
parents: 30
diff changeset
997 Clear->hide();
90c545de7201 - Enabled hiding widgets of the control panel from dillorc2.
jcid
parents: 30
diff changeset
998 if ( !prefs.show_url )
90c545de7201 - Enabled hiding widgets of the control panel from dillorc2.
jcid
parents: 30
diff changeset
999 Location->hide();
90c545de7201 - Enabled hiding widgets of the control panel from dillorc2.
jcid
parents: 30
diff changeset
1000 if ( !prefs.show_search )
90c545de7201 - Enabled hiding widgets of the control panel from dillorc2.
jcid
parents: 30
diff changeset
1001 Search->hide();
1525
3c683905dbe3 Added a help button. It tries a local help file then dillo.org's one.
corvid, jcid
parents: 1343
diff changeset
1002 if ( !prefs.show_help )
3c683905dbe3 Added a help button. It tries a local help file then dillo.org's one.
corvid, jcid
parents: 1343
diff changeset
1003 Help->hide();
1997
6debdc67273e Re-enabled "show_progress_box" dillorc preference
Jorge Arellano Cid <jcid@dillo.org>
parents: 1995
diff changeset
1004 if ( !prefs.show_progress_box ) {
6debdc67273e Re-enabled "show_progress_box" dillorc preference
Jorge Arellano Cid <jcid@dillo.org>
parents: 1995
diff changeset
1005 IProg->hide();
6debdc67273e Re-enabled "show_progress_box" dillorc preference
Jorge Arellano Cid <jcid@dillo.org>
parents: 1995
diff changeset
1006 PProg->hide();
6debdc67273e Re-enabled "show_progress_box" dillorc preference
Jorge Arellano Cid <jcid@dillo.org>
parents: 1995
diff changeset
1007 }
1927
e7abafb75d0e Made Dillo code follow my fltk1.3 UI prototype
Jorge Arellano Cid <jcid@dillo.org>
parents: 1925
diff changeset
1008
1980
95f3007dbbfc Made button visibility prefs work again for: search, help and file menu
Jorge Arellano Cid <jcid@dillo.org>
parents: 1978
diff changeset
1009 if (NavBar)
95f3007dbbfc Made button visibility prefs work again for: search, help and file menu
Jorge Arellano Cid <jcid@dillo.org>
parents: 1978
diff changeset
1010 NavBar->rearrange();
95f3007dbbfc Made button visibility prefs work again for: search, help and file menu
Jorge Arellano Cid <jcid@dillo.org>
parents: 1978
diff changeset
1011 if (LocBar)
95f3007dbbfc Made button visibility prefs work again for: search, help and file menu
Jorge Arellano Cid <jcid@dillo.org>
parents: 1978
diff changeset
1012 LocBar->rearrange();
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
1013 }
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
1014
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
1015 /*
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
1016 * On-the-fly panel style change
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
1017 */
1977
e816e06ee901 Added a submenu to control the panel size (Tools)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1976
diff changeset
1018 void UI::change_panel(int new_size, int small_icons)
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
1019 {
1976
041d4979092f Made on-the-fly control panel work again
Jorge Arellano Cid <jcid@dillo.org>
parents: 1975
diff changeset
1020 // Remove current panel's bars
041d4979092f Made on-the-fly control panel work again
Jorge Arellano Cid <jcid@dillo.org>
parents: 1975
diff changeset
1021 init_sizes();
041d4979092f Made on-the-fly control panel work again
Jorge Arellano Cid <jcid@dillo.org>
parents: 1975
diff changeset
1022 TopGroup->remove(MenuBar);
041d4979092f Made on-the-fly control panel work again
Jorge Arellano Cid <jcid@dillo.org>
parents: 1975
diff changeset
1023 Fl::delete_widget(MenuBar);
041d4979092f Made on-the-fly control panel work again
Jorge Arellano Cid <jcid@dillo.org>
parents: 1975
diff changeset
1024 TopGroup->remove(LocBar);
041d4979092f Made on-the-fly control panel work again
Jorge Arellano Cid <jcid@dillo.org>
parents: 1975
diff changeset
1025 Fl::delete_widget(LocBar);
041d4979092f Made on-the-fly control panel work again
Jorge Arellano Cid <jcid@dillo.org>
parents: 1975
diff changeset
1026 TopGroup->remove(NavBar);
041d4979092f Made on-the-fly control panel work again
Jorge Arellano Cid <jcid@dillo.org>
parents: 1975
diff changeset
1027 Fl::delete_widget(NavBar);
041d4979092f Made on-the-fly control panel work again
Jorge Arellano Cid <jcid@dillo.org>
parents: 1975
diff changeset
1028 MenuBar = LocBar = NavBar = NULL;
1927
e7abafb75d0e Made Dillo code follow my fltk1.3 UI prototype
Jorge Arellano Cid <jcid@dillo.org>
parents: 1925
diff changeset
1029
1978
3172b6199fd1 Disabled the right-click-over-search-button hook that changed panel size
Jorge Arellano Cid <jcid@dillo.org>
parents: 1977
diff changeset
1030 // Set internal vars for panel size
3172b6199fd1 Disabled the right-click-over-search-button hook that changed panel size
Jorge Arellano Cid <jcid@dillo.org>
parents: 1977
diff changeset
1031 PanelSize = new_size;
3172b6199fd1 Disabled the right-click-over-search-button hook that changed panel size
Jorge Arellano Cid <jcid@dillo.org>
parents: 1977
diff changeset
1032 Small_Icons = small_icons;
1977
e816e06ee901 Added a submenu to control the panel size (Tools)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1976
diff changeset
1033
1976
041d4979092f Made on-the-fly control panel work again
Jorge Arellano Cid <jcid@dillo.org>
parents: 1975
diff changeset
1034 // make a new panel
041d4979092f Made on-the-fly control panel work again
Jorge Arellano Cid <jcid@dillo.org>
parents: 1975
diff changeset
1035 make_panel(TopGroup->w());
32
90c545de7201 - Enabled hiding widgets of the control panel from dillorc2.
jcid
parents: 30
diff changeset
1036 customize(0);
1977
e816e06ee901 Added a submenu to control the panel size (Tools)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1976
diff changeset
1037 a_UIcmd_set_buttons_sens(a_UIcmd_get_bw_by_widget(this));
1976
041d4979092f Made on-the-fly control panel work again
Jorge Arellano Cid <jcid@dillo.org>
parents: 1975
diff changeset
1038
041d4979092f Made on-the-fly control panel work again
Jorge Arellano Cid <jcid@dillo.org>
parents: 1975
diff changeset
1039 // adjust Main's height
041d4979092f Made on-the-fly control panel work again
Jorge Arellano Cid <jcid@dillo.org>
parents: 1975
diff changeset
1040 int main_h = h() - (mh+(LocBar?lh:0)+nh+(FindBarSpace?fh:0)+sh);
041d4979092f Made on-the-fly control panel work again
Jorge Arellano Cid <jcid@dillo.org>
parents: 1975
diff changeset
1041 Main->size(Main->w(), main_h);
041d4979092f Made on-the-fly control panel work again
Jorge Arellano Cid <jcid@dillo.org>
parents: 1975
diff changeset
1042 redraw();
041d4979092f Made on-the-fly control panel work again
Jorge Arellano Cid <jcid@dillo.org>
parents: 1975
diff changeset
1043
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
1044 Location->take_focus();
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
1045 }
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
1046
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
1047 /*
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
1048 * On-the-fly color style change
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
1049 */
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
1050 void UI::color_change_cb_i()
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
1051 {
479
cd066a3f0405 Added some const quialifiers.
corvid <corvid@lavabit.com>
parents: 451
diff changeset
1052 const int cols[] = {7,17,26,51,140,156,205,206,215,-1};
cd066a3f0405 Added some const quialifiers.
corvid <corvid@lavabit.com>
parents: 451
diff changeset
1053 static int ncolor = 0;
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
1054
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
1055 ncolor = (cols[ncolor+1] < 0) ? 0 : ncolor + 1;
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
1056 CuteColor = cols[ncolor];
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
1057 MSG("Location color %d\n", CuteColor);
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
1058 Location->color(CuteColor);
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
1059 Location->redraw();
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
1060 }
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
1061
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
1062 /*
217
a27eafd634d1 - Made CTRL-l focus the location bar instead of popping up a dialog.
jcid
parents: 213
diff changeset
1063 * Set or remove the Panelmode flag and update the UI accordingly
a27eafd634d1 - Made CTRL-l focus the location bar instead of popping up a dialog.
jcid
parents: 213
diff changeset
1064 */
a27eafd634d1 - Made CTRL-l focus the location bar instead of popping up a dialog.
jcid
parents: 213
diff changeset
1065 void UI::set_panelmode(UIPanelmode mode)
a27eafd634d1 - Made CTRL-l focus the location bar instead of popping up a dialog.
jcid
parents: 213
diff changeset
1066 {
a27eafd634d1 - Made CTRL-l focus the location bar instead of popping up a dialog.
jcid
parents: 213
diff changeset
1067 if (mode == UI_HIDDEN) {
1924
998acefd6a51 Initial changes to make the tiny panel mode work
Jorge Arellano Cid <jcid@dillo.org>
parents: 1843
diff changeset
1068 //Panel->hide();
1947
821e6262ead9 Keybindings and some variable name normalizations
Jorge Arellano Cid <jcid@dillo.org>
parents: 1945
diff changeset
1069 StatusBar->hide();
217
a27eafd634d1 - Made CTRL-l focus the location bar instead of popping up a dialog.
jcid
parents: 213
diff changeset
1070 } else {
a27eafd634d1 - Made CTRL-l focus the location bar instead of popping up a dialog.
jcid
parents: 213
diff changeset
1071 /* UI_NORMAL or UI_TEMPORARILY_SHOW_PANELS */
1924
998acefd6a51 Initial changes to make the tiny panel mode work
Jorge Arellano Cid <jcid@dillo.org>
parents: 1843
diff changeset
1072 //Panel->show();
1947
821e6262ead9 Keybindings and some variable name normalizations
Jorge Arellano Cid <jcid@dillo.org>
parents: 1945
diff changeset
1073 StatusBar->show();
217
a27eafd634d1 - Made CTRL-l focus the location bar instead of popping up a dialog.
jcid
parents: 213
diff changeset
1074 }
a27eafd634d1 - Made CTRL-l focus the location bar instead of popping up a dialog.
jcid
parents: 213
diff changeset
1075 Panelmode = mode;
a27eafd634d1 - Made CTRL-l focus the location bar instead of popping up a dialog.
jcid
parents: 213
diff changeset
1076 }
a27eafd634d1 - Made CTRL-l focus the location bar instead of popping up a dialog.
jcid
parents: 213
diff changeset
1077
a27eafd634d1 - Made CTRL-l focus the location bar instead of popping up a dialog.
jcid
parents: 213
diff changeset
1078 /*
a27eafd634d1 - Made CTRL-l focus the location bar instead of popping up a dialog.
jcid
parents: 213
diff changeset
1079 * Get the value of the panelmode flag
a27eafd634d1 - Made CTRL-l focus the location bar instead of popping up a dialog.
jcid
parents: 213
diff changeset
1080 */
a27eafd634d1 - Made CTRL-l focus the location bar instead of popping up a dialog.
jcid
parents: 213
diff changeset
1081 UIPanelmode UI::get_panelmode()
a27eafd634d1 - Made CTRL-l focus the location bar instead of popping up a dialog.
jcid
parents: 213
diff changeset
1082 {
a27eafd634d1 - Made CTRL-l focus the location bar instead of popping up a dialog.
jcid
parents: 213
diff changeset
1083 return Panelmode;
a27eafd634d1 - Made CTRL-l focus the location bar instead of popping up a dialog.
jcid
parents: 213
diff changeset
1084 }
a27eafd634d1 - Made CTRL-l focus the location bar instead of popping up a dialog.
jcid
parents: 213
diff changeset
1085
a27eafd634d1 - Made CTRL-l focus the location bar instead of popping up a dialog.
jcid
parents: 213
diff changeset
1086 /*
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
1087 * Toggle the Control Panel out of the way
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
1088 */
217
a27eafd634d1 - Made CTRL-l focus the location bar instead of popping up a dialog.
jcid
parents: 213
diff changeset
1089 void UI::panelmode_cb_i()
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
1090 {
217
a27eafd634d1 - Made CTRL-l focus the location bar instead of popping up a dialog.
jcid
parents: 213
diff changeset
1091 set_panelmode((UIPanelmode) !Panelmode);
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
1092 }
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
1093
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
1094 /*
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
1095 * Set 'nw' as the main render area widget
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
1096 */
1945
b24a5b73ff10 Made the status bar visible and operative.
Jorge Arellano Cid <jcid@dillo.org>
parents: 1944
diff changeset
1097 void UI::set_render_layout(Fl_Group *nw)
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
1098 {
1945
b24a5b73ff10 Made the status bar visible and operative.
Jorge Arellano Cid <jcid@dillo.org>
parents: 1944
diff changeset
1099 // Resize layout widget to current height
b24a5b73ff10 Made the status bar visible and operative.
Jorge Arellano Cid <jcid@dillo.org>
parents: 1944
diff changeset
1100 nw->resize(0,0,0,Main->h());
b24a5b73ff10 Made the status bar visible and operative.
Jorge Arellano Cid <jcid@dillo.org>
parents: 1944
diff changeset
1101
b24a5b73ff10 Made the status bar visible and operative.
Jorge Arellano Cid <jcid@dillo.org>
parents: 1944
diff changeset
1102 TopGroup->insert(*nw, Main);
b24a5b73ff10 Made the status bar visible and operative.
Jorge Arellano Cid <jcid@dillo.org>
parents: 1944
diff changeset
1103 remove(Main);
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
1104 delete(Main);
1945
b24a5b73ff10 Made the status bar visible and operative.
Jorge Arellano Cid <jcid@dillo.org>
parents: 1944
diff changeset
1105 Main = nw;
1928
261762bef174 Part of the UI wasn't visible. This minor changes fix it.
Jorge Arellano Cid <jcid@dillo.org>
parents: 1927
diff changeset
1106 TopGroup->resizable(Main);
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
1107 }
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
1108
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
1109 /*
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
1110 * Set button sensitivity (Back/Forw/Stop)
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
1111 */
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
1112 void UI::button_set_sens(UIButton btn, int sens)
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
1113 {
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
1114 switch (btn) {
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
1115 case UI_BACK:
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
1116 (sens) ? Back->activate() : Back->deactivate();
1823
ca17943888ad more src/ui
corvid <corvid@lavabit.com>
parents: 1822
diff changeset
1117 // Back->redraw(DAMAGE_HIGHLIGHT);
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
1118 break;
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
1119 case UI_FORW:
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
1120 (sens) ? Forw->activate() : Forw->deactivate();
1823
ca17943888ad more src/ui
corvid <corvid@lavabit.com>
parents: 1822
diff changeset
1121 // Forw->redraw(DAMAGE_HIGHLIGHT);
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
1122 break;
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
1123 case UI_STOP:
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
1124 (sens) ? Stop->activate() : Stop->deactivate();
1823
ca17943888ad more src/ui
corvid <corvid@lavabit.com>
parents: 1822
diff changeset
1125 // Stop->redraw(DAMAGE_HIGHLIGHT);
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
1126 break;
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
1127 default:
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
1128 break;
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
1129 }
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
1130 }
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
1131
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
1132 /*
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
1133 * Paste a middle-click-selection into "Clear" button as URL
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
1134 */
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
1135 void UI::paste_url()
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
1136 {
1822
a0ed332132e1 some more src/ui
corvid <corvid@lavabit.com>
parents: 1813
diff changeset
1137 Fl::paste(*Clear, false);
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
1138 }
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
1139
224
07d1e0d8463c - Replaced the findtext dialog with an in-window widget!
jcid
parents: 221
diff changeset
1140 /*
1954
b0fd6feb8c51 Bound KEYS_HIDE_PANELS key to hide panels (escape)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1953
diff changeset
1141 * Adjust space for the findbar (if necessary) and show or remove it
224
07d1e0d8463c - Replaced the findtext dialog with an in-window widget!
jcid
parents: 221
diff changeset
1142 */
1948
caf71cd30ec8 Made the findbar operative again (it has tricks and workarounds)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1947
diff changeset
1143 void UI::findbar_toggle(bool add)
224
07d1e0d8463c - Replaced the findtext dialog with an in-window widget!
jcid
parents: 221
diff changeset
1144 {
1948
caf71cd30ec8 Made the findbar operative again (it has tricks and workarounds)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1947
diff changeset
1145 /* WORKAROUND:
caf71cd30ec8 Made the findbar operative again (it has tricks and workarounds)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1947
diff changeset
1146 * This is tricky: As fltk-1.3 resizes hidden widgets (which it
caf71cd30ec8 Made the findbar operative again (it has tricks and workarounds)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1947
diff changeset
1147 * doesn't resize when visible!). We need to go through hoops to
caf71cd30ec8 Made the findbar operative again (it has tricks and workarounds)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1947
diff changeset
1148 * get the desired behaviour.
caf71cd30ec8 Made the findbar operative again (it has tricks and workarounds)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1947
diff changeset
1149 * Most probably this is a bug in FLTK and we have to report it.
caf71cd30ec8 Made the findbar operative again (it has tricks and workarounds)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1947
diff changeset
1150 */
caf71cd30ec8 Made the findbar operative again (it has tricks and workarounds)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1947
diff changeset
1151
1995
5c3180af5df3 Re-enabled "Find text" to select text when already shown
Jorge Arellano Cid <jcid@dillo.org>
parents: 1988
diff changeset
1152 if (add) {
5c3180af5df3 Re-enabled "Find text" to select text when already shown
Jorge Arellano Cid <jcid@dillo.org>
parents: 1988
diff changeset
1153 if (!FindBarSpace) {
5c3180af5df3 Re-enabled "Find text" to select text when already shown
Jorge Arellano Cid <jcid@dillo.org>
parents: 1988
diff changeset
1154 // show
5c3180af5df3 Re-enabled "Find text" to select text when already shown
Jorge Arellano Cid <jcid@dillo.org>
parents: 1988
diff changeset
1155 Main->size(Main->w(), Main->h()-FindBar->h());
5c3180af5df3 Re-enabled "Find text" to select text when already shown
Jorge Arellano Cid <jcid@dillo.org>
parents: 1988
diff changeset
1156 insert(*FindBar, StatusBar);
5c3180af5df3 Re-enabled "Find text" to select text when already shown
Jorge Arellano Cid <jcid@dillo.org>
parents: 1988
diff changeset
1157 FindBar->show();
5c3180af5df3 Re-enabled "Find text" to select text when already shown
Jorge Arellano Cid <jcid@dillo.org>
parents: 1988
diff changeset
1158 FindBarSpace = 1;
5c3180af5df3 Re-enabled "Find text" to select text when already shown
Jorge Arellano Cid <jcid@dillo.org>
parents: 1988
diff changeset
1159 redraw();
5c3180af5df3 Re-enabled "Find text" to select text when already shown
Jorge Arellano Cid <jcid@dillo.org>
parents: 1988
diff changeset
1160 } else {
5c3180af5df3 Re-enabled "Find text" to select text when already shown
Jorge Arellano Cid <jcid@dillo.org>
parents: 1988
diff changeset
1161 // select text
5c3180af5df3 Re-enabled "Find text" to select text when already shown
Jorge Arellano Cid <jcid@dillo.org>
parents: 1988
diff changeset
1162 FindBar->show();
5c3180af5df3 Re-enabled "Find text" to select text when already shown
Jorge Arellano Cid <jcid@dillo.org>
parents: 1988
diff changeset
1163 }
1948
caf71cd30ec8 Made the findbar operative again (it has tricks and workarounds)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1947
diff changeset
1164 } else if (!add && FindBarSpace) {
caf71cd30ec8 Made the findbar operative again (it has tricks and workarounds)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1947
diff changeset
1165 // hide
caf71cd30ec8 Made the findbar operative again (it has tricks and workarounds)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1947
diff changeset
1166 Main->size(Main->w(), Main->h()+FindBar->h());
caf71cd30ec8 Made the findbar operative again (it has tricks and workarounds)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1947
diff changeset
1167 remove(FindBar);
caf71cd30ec8 Made the findbar operative again (it has tricks and workarounds)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1947
diff changeset
1168 FindBarSpace = 0;
1951
36e6563b8daa Assorted minor changes (see verbose log)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1950
diff changeset
1169 redraw(); /* Main->redraw(); is not enough */
224
07d1e0d8463c - Replaced the findtext dialog with an in-window widget!
jcid
parents: 221
diff changeset
1170 }
1953
808ca0de6d8f Made fullscreen work again (Ctrl+Space)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1952
diff changeset
1171 }
1948
caf71cd30ec8 Made the findbar operative again (it has tricks and workarounds)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1947
diff changeset
1172
1953
808ca0de6d8f Made fullscreen work again (Ctrl+Space)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1952
diff changeset
1173 /*
808ca0de6d8f Made fullscreen work again (Ctrl+Space)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1952
diff changeset
1174 * Make panels disappear growing the render area.
808ca0de6d8f Made fullscreen work again (Ctrl+Space)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1952
diff changeset
1175 * WORKAROUND: here we avoid hidden widgets resize by setting their
808ca0de6d8f Made fullscreen work again (Ctrl+Space)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1952
diff changeset
1176 * size to (0,0) while hidden.
808ca0de6d8f Made fullscreen work again (Ctrl+Space)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1952
diff changeset
1177 * (Already reported to FLTK team)
808ca0de6d8f Made fullscreen work again (Ctrl+Space)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1952
diff changeset
1178 */
808ca0de6d8f Made fullscreen work again (Ctrl+Space)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1952
diff changeset
1179 void UI::fullscreen_toggle()
808ca0de6d8f Made fullscreen work again (Ctrl+Space)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1952
diff changeset
1180 {
808ca0de6d8f Made fullscreen work again (Ctrl+Space)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1952
diff changeset
1181 int dh = 0;
808ca0de6d8f Made fullscreen work again (Ctrl+Space)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1952
diff changeset
1182 int hide = StatusBar->visible();
808ca0de6d8f Made fullscreen work again (Ctrl+Space)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1952
diff changeset
1183
808ca0de6d8f Made fullscreen work again (Ctrl+Space)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1952
diff changeset
1184 // hide/show panels
808ca0de6d8f Made fullscreen work again (Ctrl+Space)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1952
diff changeset
1185 init_sizes();
1967
fa525b466aef Fixed offset bugs with panel tiny and large (also fullscreen mode for large)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1959
diff changeset
1186 if (MenuBar) {
fa525b466aef Fixed offset bugs with panel tiny and large (also fullscreen mode for large)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1959
diff changeset
1187 dh += mh;
fa525b466aef Fixed offset bugs with panel tiny and large (also fullscreen mode for large)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1959
diff changeset
1188 hide ? MenuBar->size(0,0) : MenuBar->size(w(),mh);
fa525b466aef Fixed offset bugs with panel tiny and large (also fullscreen mode for large)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1959
diff changeset
1189 hide ? MenuBar->hide() : MenuBar->show();
fa525b466aef Fixed offset bugs with panel tiny and large (also fullscreen mode for large)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1959
diff changeset
1190 }
1953
808ca0de6d8f Made fullscreen work again (Ctrl+Space)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1952
diff changeset
1191 if (LocBar) {
808ca0de6d8f Made fullscreen work again (Ctrl+Space)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1952
diff changeset
1192 dh += lh;
808ca0de6d8f Made fullscreen work again (Ctrl+Space)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1952
diff changeset
1193 hide ? LocBar->size(0,0) : LocBar->size(w(),lh);
808ca0de6d8f Made fullscreen work again (Ctrl+Space)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1952
diff changeset
1194 hide ? LocBar->hide() : LocBar->show();
808ca0de6d8f Made fullscreen work again (Ctrl+Space)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1952
diff changeset
1195 }
808ca0de6d8f Made fullscreen work again (Ctrl+Space)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1952
diff changeset
1196 if (NavBar) {
808ca0de6d8f Made fullscreen work again (Ctrl+Space)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1952
diff changeset
1197 dh += nh;
808ca0de6d8f Made fullscreen work again (Ctrl+Space)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1952
diff changeset
1198 hide ? NavBar->size(0,0) : NavBar->size(w(),nh);
808ca0de6d8f Made fullscreen work again (Ctrl+Space)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1952
diff changeset
1199 hide ? NavBar->hide() : NavBar->show();
808ca0de6d8f Made fullscreen work again (Ctrl+Space)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1952
diff changeset
1200 }
808ca0de6d8f Made fullscreen work again (Ctrl+Space)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1952
diff changeset
1201 if (StatusBar) {
808ca0de6d8f Made fullscreen work again (Ctrl+Space)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1952
diff changeset
1202 dh += sh;
808ca0de6d8f Made fullscreen work again (Ctrl+Space)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1952
diff changeset
1203 hide ? StatusBar->size(0,0) : StatusBar->size(w(),sh);;
808ca0de6d8f Made fullscreen work again (Ctrl+Space)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1952
diff changeset
1204 hide ? StatusBar->hide() : StatusBar->show();;
808ca0de6d8f Made fullscreen work again (Ctrl+Space)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1952
diff changeset
1205 }
808ca0de6d8f Made fullscreen work again (Ctrl+Space)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1952
diff changeset
1206
808ca0de6d8f Made fullscreen work again (Ctrl+Space)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1952
diff changeset
1207 Main->size(Main->w(), Main->h() + (hide ? dh : -dh));
808ca0de6d8f Made fullscreen work again (Ctrl+Space)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1952
diff changeset
1208 redraw();
224
07d1e0d8463c - Replaced the findtext dialog with an in-window widget!
jcid
parents: 221
diff changeset
1209 }