From b9b810879853563ee40eee168cf81c9694efc6a2 Mon Sep 17 00:00:00 2001 From: Jeffrey Armstrong Date: Mon, 8 Mar 2021 14:44:44 -0500 Subject: Favicons are now printed to the window's title bar --- ag_render.f90 | 35 +++++++++++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 4 deletions(-) diff --git a/ag_render.f90 b/ag_render.f90 index 68cd0d8..49aecb2 100644 --- a/ag_render.f90 +++ b/ag_render.f90 @@ -91,6 +91,9 @@ implicit none ! A title was guessed and set logical::title_guessed + + ! Text of the title + character(len=256)::title_text contains @@ -131,6 +134,8 @@ implicit none procedure :: report_unsupported_protocol => ag_report_unsupported_protocol + procedure :: set_favicon => ag_set_favicon + end type appgraphics_renderer contains @@ -241,6 +246,18 @@ contains end subroutine resize_callback + subroutine ag_set_favicon(self, f) + implicit none + + class(appgraphics_renderer)::self + character(*), intent(in)::f + + self%favicon = f + + call set_window_title(self, self%title_text) + + end subroutine ag_set_favicon + subroutine set_window_title(self, text) use appgraphics, only: setwindowtitle implicit none @@ -248,8 +265,18 @@ contains type(appgraphics_renderer)::self character(*), intent(in)::text - if(len_trim(text) > 0) then - call setwindowtitle("LR-87 :: "//trim(text)) + if(len_trim(text) > 256) then + self%title_text = text(1:250)//"..." + else + self%title_text = text + end if + + if(len_trim(self%title_text) > 0) then + if(len_trim(self%favicon) > 0) then + call setwindowtitle("LR-87 :: "//self%favicon//" "//trim(self%title_text)) + else + call setwindowtitle("LR-87 :: "//trim(self%title_text)) + end if else call setwindowtitle("LR-87") end if @@ -311,6 +338,7 @@ contains call settextstyle(WINDOWS_FONT, HORIZ_DIR, 12) x = x + textwidth("Address:") + 5 address_width = getmaxx()/2 - textwidth("Address:") - 5 + if(self%address_id < 0) then self%address_id = createtextbox(x, 2, address_width, 20) call settextboxentercallback(self%address_id, go_button_callback) @@ -406,7 +434,6 @@ contains call clearviewport() call outtextxy(5, 2, trim(text)) - end do call setactivepage(active_page) call resetviewport() @@ -701,7 +728,7 @@ contains case (proportional_type_heading_1) ! The first level 1 heading can be guessed as the page title if(.not. self%title_guessed) then - + call set_window_title(self, text) self%title_guessed = .true. -- cgit v1.2.3