diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/gmdocument.c | 2 | ||||
-rw-r--r-- | src/ui/window.c | 41 |
2 files changed, 34 insertions, 9 deletions
diff --git a/src/gmdocument.c b/src/gmdocument.c index 9fd56fce..cf30a081 100644 --- a/src/gmdocument.c +++ b/src/gmdocument.c | |||
@@ -416,7 +416,7 @@ static void doLayout_GmDocument_(iGmDocument *d) { | |||
416 | if (type == text_GmLineType && isFirstText) { | 416 | if (type == text_GmLineType && isFirstText) { |
417 | run.font = firstParagraph_FontId; | 417 | run.font = firstParagraph_FontId; |
418 | run.color = gray88_ColorId; | 418 | run.color = gray88_ColorId; |
419 | bigCount = 6; /* lines */ | 419 | bigCount = 15; /* max lines -- what if the whole document is one paragraph? */ |
420 | isFirstText = iFalse; | 420 | isFirstText = iFalse; |
421 | } | 421 | } |
422 | else if (type != header1_GmLineType) { | 422 | else if (type != header1_GmLineType) { |
diff --git a/src/ui/window.c b/src/ui/window.c index b438c301..add9d420 100644 --- a/src/ui/window.c +++ b/src/ui/window.c | |||
@@ -79,7 +79,25 @@ static const char *reloadCStr_ = "\U0001f503"; | |||
79 | static const char *stopCStr_ = orange_ColorEscape "\U0001f310"; | 79 | static const char *stopCStr_ = orange_ColorEscape "\U0001f310"; |
80 | 80 | ||
81 | static iBool handleNavBarCommands_(iWidget *navBar, const char *cmd) { | 81 | static iBool handleNavBarCommands_(iWidget *navBar, const char *cmd) { |
82 | if (equal_Command(cmd, "input.ended")) { | 82 | if (equal_Command(cmd, "window.resized")) { |
83 | const iBool isNarrow = width_Rect(bounds_Widget(navBar)) / gap_UI < 140; | ||
84 | if (isNarrow ^ ((flags_Widget(navBar) & tight_WidgetFlag) != 0)) { | ||
85 | setFlags_Widget(navBar, tight_WidgetFlag, isNarrow); | ||
86 | iForEach(ObjectList, i, navBar->children) { | ||
87 | iWidget *child = as_Widget(i.object); | ||
88 | setFlags_Widget( | ||
89 | child, tight_WidgetFlag, isNarrow || !cmp_String(id_Widget(child), "lock")); | ||
90 | if (isInstance_Object(i.object, &Class_LabelWidget)) { | ||
91 | iLabelWidget *label = (iLabelWidget *) i.object; | ||
92 | updateSize_LabelWidget(label); | ||
93 | } | ||
94 | } | ||
95 | } | ||
96 | arrange_Widget(navBar); | ||
97 | refresh_Widget(navBar); | ||
98 | return iFalse; | ||
99 | } | ||
100 | else if (equal_Command(cmd, "input.ended")) { | ||
83 | iInputWidget *url = findChild_Widget(navBar, "url"); | 101 | iInputWidget *url = findChild_Widget(navBar, "url"); |
84 | if (arg_Command(cmd) && pointer_Command(cmd) == url) { | 102 | if (arg_Command(cmd) && pointer_Command(cmd) == url) { |
85 | postCommandf_App( | 103 | postCommandf_App( |
@@ -179,16 +197,23 @@ static void setupUserInterface_Window(iWindow *d) { | |||
179 | addChild_Widget(div, iClob(navBar)); | 197 | addChild_Widget(div, iClob(navBar)); |
180 | setBackgroundColor_Widget(navBar, gray25_ColorId); | 198 | setBackgroundColor_Widget(navBar, gray25_ColorId); |
181 | setCommandHandler_Widget(navBar, handleNavBarCommands_); | 199 | setCommandHandler_Widget(navBar, handleNavBarCommands_); |
182 | addChild_Widget(navBar, iClob(new_LabelWidget(" \u25c4 ", 0, 0, "navigate.back"))); | 200 | addChild_Widget(navBar, iClob(newIcon_LabelWidget(" \U0001f860 ", 0, 0, "navigate.back"))); |
183 | addChild_Widget(navBar, iClob(new_LabelWidget(" \u25ba ", 0, 0, "navigate.forward"))); | 201 | addChild_Widget(navBar, iClob(newIcon_LabelWidget("\U0001f862", 0, 0, "navigate.forward"))); |
184 | addChild_Widget(navBar, iClob(new_LabelWidget("\U0001f3e0", 0, 0, "navigate.home"))); | 202 | addChild_Widget(navBar, iClob(newIcon_LabelWidget("\U0001f3e0", 0, 0, "navigate.home"))); |
203 | iLabelWidget *lock = addChildFlags_Widget(navBar, | ||
204 | iClob(newIcon_LabelWidget("\U0001f512", 0, 0, "cert.server")), | ||
205 | frameless_WidgetFlag | tight_WidgetFlag); | ||
206 | setId_Widget(as_Widget(lock), "lock"); | ||
207 | setFont_LabelWidget(lock, symbols_FontId); | ||
185 | iInputWidget *url = new_InputWidget(0); | 208 | iInputWidget *url = new_InputWidget(0); |
186 | setId_Widget(as_Widget(url), "url"); | 209 | setId_Widget(as_Widget(url), "url"); |
187 | setTextCStr_InputWidget(url, "gemini://"); | 210 | setTextCStr_InputWidget(url, "gemini://"); |
188 | addChildFlags_Widget(navBar, iClob(url), expand_WidgetFlag); | 211 | addChildFlags_Widget(navBar, iClob(url), expand_WidgetFlag); |
189 | setId_Widget( | 212 | setId_Widget( |
190 | addChild_Widget(navBar, iClob(new_LabelWidget(reloadCStr_, 0, 0, "navigate.reload"))), | 213 | addChild_Widget(navBar, iClob(newIcon_LabelWidget(reloadCStr_, 0, 0, "navigate.reload"))), |
191 | "reload"); | 214 | "reload"); |
215 | addChild_Widget(navBar, iClob(newIcon_LabelWidget("\U0001f464", 0, 0, "cert.client"))); | ||
216 | addChild_Widget(navBar, iClob(newIcon_LabelWidget("\U0001d362", 0, 0, "navbar.menu"))); | ||
192 | } | 217 | } |
193 | 218 | ||
194 | addChildFlags_Widget(div, iClob(new_DocumentWidget()), expand_WidgetFlag); | 219 | addChildFlags_Widget(div, iClob(new_DocumentWidget()), expand_WidgetFlag); |
@@ -207,9 +232,9 @@ static void setupUserInterface_Window(iWindow *d) { | |||
207 | iInputWidget *input = new_InputWidget(0); | 232 | iInputWidget *input = new_InputWidget(0); |
208 | setId_Widget(addChildFlags_Widget(searchBar, iClob(input), expand_WidgetFlag), | 233 | setId_Widget(addChildFlags_Widget(searchBar, iClob(input), expand_WidgetFlag), |
209 | "find.input"); | 234 | "find.input"); |
210 | addChild_Widget(searchBar, iClob(new_LabelWidget(" \U0001f86b ", 'g', KMOD_PRIMARY, "find.next"))); | 235 | addChild_Widget(searchBar, iClob(newIcon_LabelWidget(" \U0001f86b ", 'g', KMOD_PRIMARY, "find.next"))); |
211 | addChild_Widget(searchBar, iClob(new_LabelWidget(" \U0001f869 ", 'g', KMOD_PRIMARY | KMOD_SHIFT, "find.prev"))); | 236 | addChild_Widget(searchBar, iClob(newIcon_LabelWidget(" \U0001f869 ", 'g', KMOD_PRIMARY | KMOD_SHIFT, "find.prev"))); |
212 | addChild_Widget(searchBar, iClob(new_LabelWidget("\U0001f7a8", SDLK_ESCAPE, 0, "find.close"))); | 237 | addChild_Widget(searchBar, iClob(newIcon_LabelWidget("\U0001f7a8", SDLK_ESCAPE, 0, "find.close"))); |
213 | } | 238 | } |
214 | 239 | ||
215 | #if 0 | 240 | #if 0 |