aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md2
-rw-r--r--ag_render.f9091
-rw-r--r--favicon.f903
-rw-r--r--gemini-windows.prj7
-rw-r--r--internal.F902
-rw-r--r--main.F9025
-rw-r--r--render.f901
7 files changed, 105 insertions, 26 deletions
diff --git a/README.md b/README.md
index d8ec339..0f75fe1 100644
--- a/README.md
+++ b/README.md
@@ -93,5 +93,5 @@ AppGraphics library from Simply Fortran.
## License
-LR-87 is Copyright (c) 2020 Jeffrey Armstrong <jeff@rainbow-100.com>, and the software
+LR-87 is Copyright (c) 2020-2022 Jeffrey Armstrong <jeff@rainbow-100.com>, and the software
is licensed under the JSON license. See LICENSE.txt for more details.
diff --git a/ag_render.f90 b/ag_render.f90
index e964df3..b91a416 100644
--- a/ag_render.f90
+++ b/ag_render.f90
@@ -34,6 +34,7 @@ implicit none
integer, volatile::ag_render_event
integer, volatile::scroll_position
+ integer, volatile::wheel_movement
integer, parameter::ag_render_event_none = 0
integer, parameter::ag_render_event_closed = 1
@@ -85,6 +86,9 @@ implicit none
! Needed to compute document height
integer::initial_y
+
+ ! Page height
+ integer::page_height
! An error has occurred, so render blank
logical::render_blank
@@ -135,6 +139,9 @@ implicit none
procedure :: report_unsupported_protocol => ag_report_unsupported_protocol
procedure :: set_favicon => ag_set_favicon
+
+ procedure :: rendering_height_available => ag_rendering_height_available
+ procedure :: scroll_max_value => ag_scroll_max_value
end type appgraphics_renderer
@@ -214,13 +221,7 @@ contains
integer::x, y
- scroll_position = scroll_position - (x/35)
- if(scroll_position < 0) then
- scroll_position = 0
- else if(scroll_position > 100) then
- scroll_position = 100
- end if
-
+ wheel_movement = wheel_movement + x
ag_render_event = ag_render_event_wheel
call stopidle()
@@ -231,6 +232,7 @@ contains
implicit none
integer::x
+
scroll_position = x
ag_render_event = ag_render_event_scroll
call stopidle()
@@ -320,14 +322,16 @@ contains
call setfillstyle(SOLID_FILL, LIGHTGRAY)
call setbkcolor(LIGHTGRAY)
call setcolor(BLACK)
- call settextstyle(SYMBOLS_FONT, HORIZ_DIR, scaledpi(14))
+ call settextstyle(SANS_SERIF_FONT, HORIZ_DIR, scaledpi(18))
end do
call setactivepage(active_page)
! Draw the buttons first
x = 5
if(self%back_button_id < 0) then
- self%back_button_id = createbutton(x, 2, scaledpi(40), scaledpi(20), CHAR(231), back_button_callback)
+ self%back_button_id = createbutton(x, 2, scaledpi(40), scaledpi(20), &
+ ACHAR(240)//ACHAR(159)//ACHAR(161)//ACHAR(184), &
+ back_button_callback)
else
call setbuttonposition(self%back_button_id, x, 2, scaledpi(40), scaledpi(20))
end if
@@ -349,30 +353,36 @@ contains
! Clears any drawing operations for controls quickly
ignored = switch_to_thread()
- call settextstyle(SYMBOLS_FONT, HORIZ_DIR, 14)
+ call settextstyle(SANS_SERIF_FONT, HORIZ_DIR, scaledpi(18))
x = x + 10 + address_width
if(self%go_button_id < 0) then
- self%go_button_id = createbutton(x, 2, scaledpi(40), scaledpi(20), CHAR(232), go_button_callback)
+ self%go_button_id = createbutton(x, 2, scaledpi(40), scaledpi(20), &
+ ACHAR(240)//ACHAR(159)//ACHAR(161)//ACHAR(186), &
+ go_button_callback)
else
call setbuttonposition(self%go_button_id, x, 2, scaledpi(40), scaledpi(20))
end if
- call settextstyle(SYMBOLS_FONT, HORIZ_DIR, scaledpi(18))
+ call settextstyle(SANS_SERIF_FONT, HORIZ_DIR, scaledpi(20))
! If we're not expanding, just draw these buttons in order
if(.not. myexpand) then
x = getmaxx() - scaledpi(95)
if(self%fave_button_id < 0) then
- self%fave_button_id = createbutton(x, 2, scaledpi(40), scaledpi(20), CHAR(171), fave_button_callback)
+ self%fave_button_id = createbutton(x, 2, scaledpi(40), scaledpi(20), &
+ ACHAR(226)//ACHAR(152)//ACHAR(133), &
+ fave_button_callback)
else
call setbuttonposition(self%fave_button_id, x, 2, scaledpi(40), scaledpi(20))
end if
x = x + scaledpi(50)
if(self%internal_button_id < 0) then
- self%internal_button_id = createbutton(x, 2, scaledpi(40), scaledpi(20), CHAR(62), internal_button_callback)
+ self%internal_button_id = createbutton(x, 2, scaledpi(40), scaledpi(20), &
+ ACHAR(226)//ACHAR(156)//ACHAR(135), &
+ internal_button_callback)
else
call setbuttonposition(self%internal_button_id, x, 2, scaledpi(40), scaledpi(20))
end if
@@ -584,14 +594,44 @@ contains
end subroutine ag_prepare_for_layout
+ function ag_rendering_height_available(self)
+ use appgraphics, only: getmaxy
+ implicit none
+
+ class(appgraphics_renderer), intent(in)::self
+ integer::ag_rendering_height_available
+
+ ag_rendering_height_available = getmaxy() - self%status_bar_height - &
+ self%address_bar_height - 1
+
+ end function ag_rendering_height_available
+
+ function ag_scroll_max_value(self)
+ implicit none
+
+ class(appgraphics_renderer), intent(in)::self
+ integer::ag_scroll_max_value
+
+ ag_scroll_max_value = max(0, self%page_height - self%rendering_height_available())
+
+ end function ag_scroll_max_value
+
subroutine ag_layout_complete(self)
use appgraphics, only: swapbuffers
implicit none
class(appgraphics_renderer)::self
+ integer::nPages
call swapbuffers()
+ if(self%page_height == 0) then
+ self%page_height = self%y + self%initial_y
+ nPages = self%rendering_height_available()
+ call setscrollrange(self%scroll_id, 0, self%scroll_max_value()+nPages)
+ call setscrollpagesize(self%scroll_id, nPages)
+ end if
+
end subroutine ag_layout_complete
subroutine ag_new_page(self)
@@ -601,11 +641,13 @@ contains
self%y = 0
scroll_position = 0
+ wheel_movement = 0
call setscrollposition(self%scroll_id, 0)
ag_render_event = ag_render_event_none
self%title_guessed = .false.
+ self%page_height = 0
end subroutine ag_new_page
@@ -925,9 +967,6 @@ contains
logical::expanding_horizontally
- ! For scrolling
- integer::doclength
-
! Resize can be laggy, so ensure it actually was finalized
if(self%max_width /= compute_max_width(self)) then
ag_render_event = ag_render_event_resize
@@ -970,15 +1009,25 @@ contains
call clearmouseclick(MOUSE_MOVE)
case(ag_render_event_wheel)
+ scroll_position = scroll_position - &
+ (wheel_movement/120)* &
+ self%text_height("Scrolled Example", proportional_type_normal)
+
+ ! Limit
+ scroll_position = max(0, scroll_position)
+ scroll_position = min(self%scroll_max_value(), &
+ scroll_position)
+
call setscrollposition(self%scroll_id, scroll_position)
- doclength = self%y - self%initial_y
- self%y = (doclength * scroll_position) / (-100)
+ self%y = -1*scroll_position
ag_action = render_action_layout
+
+ wheel_movement = 0
case(ag_render_event_scroll)
- doclength = self%y - self%initial_y
- self%y = (doclength * scroll_position) / (-100)
+
+ self%y = -1*scroll_position
ag_action = render_action_layout
case(ag_render_event_resize)
diff --git a/favicon.f90 b/favicon.f90
index 6f800db..b398426 100644
--- a/favicon.f90
+++ b/favicon.f90
@@ -94,6 +94,9 @@ contains
character(len=4)::f
character(*), intent(in)::server
+
+
+
f = get_favicon_from_cache(server)
! Blank - request it
diff --git a/gemini-windows.prj b/gemini-windows.prj
index e33f253..967d11c 100644
--- a/gemini-windows.prj
+++ b/gemini-windows.prj
@@ -137,8 +137,8 @@
},
"Code Generation Options":{
"CPU Specific":"false",
- "Processor":"native",
- "Aggressive Loops":"true",
+ "Processor":"generic",
+ "Aggressive Loops":"false",
"Debugging":"false",
"Optimization Mode":2,
"Profiling":"false"
@@ -153,7 +153,8 @@
"Build Before Launch":"true"
},
"Build Options":{
- "Makefile":"Makefile",
+ "Auto Management":"true",
+ "Makefile":"Makefile.gemini-windows",
"Auto Makefile":"true"
},
"Linker Options":{
diff --git a/internal.F90 b/internal.F90
index b181d7a..2a899ff 100644
--- a/internal.F90
+++ b/internal.F90
@@ -144,7 +144,7 @@ contains
call write_header(unit_number, "About")
call write_no_space(unit_number, "## LR-87 - A Gemini Browser Written in Fortran")
- call write_no_space(unit_number, "Copyright 2020, 2021 Jeffrey Armstrong")
+ call write_no_space(unit_number, "Copyright 2020, 2021, 2022 Jeffrey Armstrong")
call write_no_space(unit_number, "=> http://git.rainbow-100.com/cgit.cgi/LR-87/about/ LR-87 Web Home Page")
call write_no_space(unit_number, "=> gemini://rainbow-100.com/software/lr87.gmi LR-87 Gemini Home Page")
diff --git a/main.F90 b/main.F90
index 0738bb0..7903ca7 100644
--- a/main.F90
+++ b/main.F90
@@ -154,6 +154,8 @@ implicit none
if(.not. loaded) then
+ call check_slashless_url(desired_url)
+
call r%clear_favicon()
call r%report_status("Requesting "//trim(desired_url))
@@ -385,5 +387,28 @@ contains
end if
end subroutine save_favorites
+
+ ! Checks to see if the url is just a server name with no
+ ! trailing slash, and fixes it
+ subroutine check_slashless_url(url)
+ implicit none
+
+ character(*), intent(inout)::url
+ integer::i, slash_count
+
+ slash_count = 0
+ if(index(url, "://") /= 0) then
+ do i = 1, len_trim(url)
+ if(url(i:i) == '/') then
+ slash_count = slash_count + 1
+ end if
+ end do
+
+ if(slash_count == 2) then
+ url(i:i) = "/"
+ end if
+ end if
+
+ end subroutine check_slashless_url
end program gemini
diff --git a/render.f90 b/render.f90
index bc77c4d..7a65127 100644
--- a/render.f90
+++ b/render.f90
@@ -505,6 +505,7 @@ contains
integer::startpos, endpos
integer::proportional_type
integer::break_index
+ integer::h
if(len_trim(text) == 0) then