From e9dfc0a04d1bdb018ae77f1d914bf0e77f3370b6 Mon Sep 17 00:00:00 2001 From: Jeffrey Armstrong Date: Tue, 11 Aug 2020 08:52:12 -0400 Subject: Favorites and internal pages are now working. Added symbols to buttons in Windows based on new AppGraphics release. --- ag_render.f90 | 46 +++++++++++++++++++++++++++++++++++++++------- 1 file changed, 39 insertions(+), 7 deletions(-) (limited to 'ag_render.f90') diff --git a/ag_render.f90 b/ag_render.f90 index 18f4014..211c718 100644 --- a/ag_render.f90 +++ b/ag_render.f90 @@ -44,6 +44,7 @@ implicit none integer, parameter::ag_render_event_resize = 6 integer, parameter::ag_render_event_mousemove = 7 integer, parameter::ag_render_event_favorite = 8 + integer, parameter::ag_render_event_internal = 9 type :: link integer, dimension(4)::location @@ -57,6 +58,7 @@ implicit none integer::go_button_id integer::back_button_id integer::fave_button_id + integer::internal_button_id integer::scroll_id integer::font_size @@ -164,6 +166,16 @@ contains end subroutine fave_button_callback + subroutine internal_button_callback() + use appgraphics, only: stopidle + implicit none + + ag_render_event = ag_render_event_internal + call stopidle() + + end subroutine internal_button_callback + + subroutine mouse_button_callback(x, y) use appgraphics, only: stopidle implicit none @@ -243,12 +255,12 @@ contains call setfillstyle(SOLID_FILL, LIGHTGRAY) call setbkcolor(LIGHTGRAY) call setcolor(BLACK) - call settextstyle(WINDOWS_FONT, HORIZ_DIR, 12) + call settextstyle(SYMBOLS_FONT, HORIZ_DIR, 14) ! Draw the buttons first - x = getmaxx()/4 - 40 + x = 5 if(self%back_button_id < 0) then - self%back_button_id = createbutton(x, 2, 40, 20, "Back", back_button_callback) + self%back_button_id = createbutton(x, 2, 40, 20, CHAR(231), back_button_callback) else call setbuttonposition(self%back_button_id, x, 2, 40, 20) end if @@ -256,6 +268,7 @@ contains x = x + 50 label_x = x + 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 @@ -268,26 +281,39 @@ contains ! Clears any drawing operations for controls quickly ignored = switch_to_thread() + call settextstyle(SYMBOLS_FONT, HORIZ_DIR, 14) + x = x + 10 + address_width if(self%go_button_id < 0) then - self%go_button_id = createbutton(x, 2, 40, 20, "Go!", go_button_callback) + self%go_button_id = createbutton(x, 2, 40, 20, CHAR(232), go_button_callback) else call setbuttonposition(self%go_button_id, x, 2, 40, 20) end if - x = x + 50 + call settextstyle(SYMBOLS_FONT, HORIZ_DIR, 18) + x = getmaxx() - 95 if(self%fave_button_id < 0) then - self%fave_button_id = createbutton(x, 2, 40, 20, "Wow!", fave_button_callback) + self%fave_button_id = createbutton(x, 2, 40, 20, CHAR(171), fave_button_callback) else call setbuttonposition(self%fave_button_id, x, 2, 40, 20) end if + x = x + 50 + if(self%internal_button_id < 0) then + self%internal_button_id = createbutton(x, 2, 40, 20, CHAR(62), internal_button_callback) + else + call setbuttonposition(self%internal_button_id, x, 2, 40, 20) + end if + ! Clears any drawing operations for controls quickly ignored = switch_to_thread() call setviewport(0, 0, getmaxx()+1, self%address_bar_height+1, .true.) call clearviewport() + + call settextstyle(WINDOWS_FONT, HORIZ_DIR, 12) call outtextxy(label_x, 5, "Address:") + call resetviewport() end subroutine draw_address_bar @@ -376,6 +402,7 @@ contains self%go_button_id = -1 self%back_button_id = -1 self%fave_button_id = -1 + self%internal_button_id = -1 self%scroll_id = -1 call draw_address_bar(self) @@ -827,6 +854,10 @@ contains case(ag_render_event_favorite) ag_action = render_action_favorite + + case(ag_render_event_internal) + text = "lr87://menu" + ag_action = render_action_goto end select @@ -856,6 +887,7 @@ contains subroutine ag_report_page(self, text) use appgraphics + use internal_links, only: internal_url implicit none class(appgraphics_renderer)::self @@ -863,7 +895,7 @@ contains call set_window_title(self, text) - if(index(text, "gemini://") > 0) then + if(index(text, "gemini://") > 0 .or. index(text, internal_url) > 0) then call settextboxcontents(self%address_id, trim(text)) end if -- cgit v1.2.3