aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeffrey Armstrong <jeff@approximatrix.com>2020-12-02 17:26:17 -0500
committerJeffrey Armstrong <jeff@approximatrix.com>2020-12-02 17:26:17 -0500
commit36bf9cd9fdfc06e12d88fdc647cc932d4a1c6452 (patch)
treea9c4bf087d64e8da84ea223b869e634c8fdbe264
parentd0529f621ac38f3deed6e02515445eac1f9fdd13 (diff)
downloadLR-87-36bf9cd9fdfc06e12d88fdc647cc932d4a1c6452.tar.gz
LR-87-36bf9cd9fdfc06e12d88fdc647cc932d4a1c6452.zip
Added a new abstract call for renderers to signal layout completion. Switch AppGraphics renderer to double-buffered for smooth display. Accelerated mouse wheel.
-rw-r--r--ag_render.f9066
-rw-r--r--dumb_render.f908
-rw-r--r--gemini-windows.prj6
-rw-r--r--layout.f902
-rw-r--r--render.f908
5 files changed, 74 insertions, 16 deletions
diff --git a/ag_render.f90 b/ag_render.f90
index 7cc091e..b3b76b1 100644
--- a/ag_render.f90
+++ b/ag_render.f90
@@ -97,6 +97,7 @@ implicit none
procedure :: initialize => ag_initialize
procedure :: new_page => ag_new_page
procedure :: prepare_for_layout => ag_prepare_for_layout
+ procedure :: layout_complete => ag_layout_complete
procedure :: text_width => ag_text_width
procedure :: text_height => ag_text_height
@@ -208,7 +209,7 @@ contains
integer::x, y
- scroll_position = scroll_position - (x/100)
+ scroll_position = scroll_position - (x/35)
if(scroll_position < 0) then
scroll_position = 0
else if(scroll_position > 100) then
@@ -264,6 +265,9 @@ contains
logical::myexpand
integer::x, address_width, label_x, ignored
+
+ ! Double-buffer
+ integer::i, active_page
! See below where this is used...
interface
@@ -282,10 +286,16 @@ contains
self%address_bar_height = 24
! Set up some address bar colors
- call setfillstyle(SOLID_FILL, LIGHTGRAY)
- call setbkcolor(LIGHTGRAY)
- call setcolor(BLACK)
- call settextstyle(SYMBOLS_FONT, HORIZ_DIR, 14)
+ active_page = getactivepage()
+ do i = 0,1
+ call setactivepage(i)
+
+ call setfillstyle(SOLID_FILL, LIGHTGRAY)
+ call setbkcolor(LIGHTGRAY)
+ call setcolor(BLACK)
+ call settextstyle(SYMBOLS_FONT, HORIZ_DIR, 14)
+ end do
+ call setactivepage(active_page)
! Draw the buttons first
x = 5
@@ -355,13 +365,19 @@ contains
! 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()
+ active_page = getactivepage()
+ do i = 0,1
+ call setactivepage(i)
- call settextstyle(WINDOWS_FONT, HORIZ_DIR, 12)
- call outtextxy(label_x, 5, "Address:")
+ call setviewport(0, 0, getmaxx()+1, self%address_bar_height+1, .true.)
+ call clearviewport()
- call resetviewport()
+ call settextstyle(WINDOWS_FONT, HORIZ_DIR, 12)
+ call outtextxy(label_x, 5, "Address:")
+
+ call resetviewport()
+ end do
+ call setactivepage(active_page)
end subroutine draw_address_bar
@@ -376,7 +392,6 @@ contains
call resetviewport()
- call setfillstyle(SOLID_FILL, LIGHTGRAY)
call setbkcolor(LIGHTGRAY)
call setcolor(BLACK)
call settextstyle(WINDOWS_FONT, HORIZ_DIR, 12)
@@ -434,7 +449,7 @@ contains
self%window_id = initwindow(default_width, default_height, "LR-87", &
DEFAULT_POSITION, DEFAULT_POSITION, &
- .FALSE., .FALSE.)
+ .TRUE., .FALSE.)
call setwindowsmallicon(1)
call setwindowlargeicon(1)
@@ -527,6 +542,16 @@ contains
self%initial_y = self%y
end subroutine ag_prepare_for_layout
+
+ subroutine ag_layout_complete(self)
+ use appgraphics, only: swapbuffers
+ implicit none
+
+ class(appgraphics_renderer)::self
+
+ call swapbuffers()
+
+ end subroutine ag_layout_complete
subroutine ag_new_page(self)
implicit none
@@ -833,9 +858,24 @@ contains
class(appgraphics_renderer)::self
character(*), intent(in)::text
-
+ character(64), save::last_text
+ integer::vp, ap
+
+ if(trim(last_text) == trim(text)) then
+ return
+ end if
+
+ vp = getvisualpage()
+ ap = getactivepage()
+
+ call setactivepage(vp)
+ call draw_status_bar(self, text)
+
+ call setactivepage(ap)
call draw_status_bar(self, text)
+ last_text = text
+
end subroutine ag_draw_status
function ag_action(self, text)
diff --git a/dumb_render.f90 b/dumb_render.f90
index 02a6e2a..64a3c40 100644
--- a/dumb_render.f90
+++ b/dumb_render.f90
@@ -43,6 +43,7 @@ implicit none
procedure :: initialize => dumb_initialize
procedure :: new_page => dumb_new_page
procedure :: prepare_for_layout => prepare_for_dumb_layout
+ procedure :: layout_complete => dumb_layout_complete
procedure :: text_width => dumb_text_width
procedure :: text_height => dumb_text_height
@@ -115,6 +116,13 @@ contains
end subroutine prepare_for_dumb_layout
+ subroutine dumb_layout_complete(self)
+ implicit none
+
+ class(dumb_renderer)::self
+
+ end subroutine dumb_layout_complete
+
function store_link(self, url)
implicit none
diff --git a/gemini-windows.prj b/gemini-windows.prj
index 59350f4..eb26b44 100644
--- a/gemini-windows.prj
+++ b/gemini-windows.prj
@@ -117,9 +117,9 @@
"Code Generation Options":{
"CPU Specific":"false",
"Processor":"generic",
- "Aggressive Loops":"false",
- "Debugging":"true",
- "Optimization Mode":0,
+ "Aggressive Loops":"true",
+ "Debugging":"false",
+ "Optimization Mode":2,
"Floating Point Trap":"false",
"Profiling":"false"
},
diff --git a/layout.f90 b/layout.f90
index 9946fd9..e28981d 100644
--- a/layout.f90
+++ b/layout.f90
@@ -78,6 +78,8 @@ contains
end if
end do
+
+ call rendering_engine%layout_complete()
end subroutine layout_lines
diff --git a/render.f90 b/render.f90
index 74b1406..9027f83 100644
--- a/render.f90
+++ b/render.f90
@@ -58,6 +58,7 @@ implicit none
procedure(initialize), deferred::initialize
procedure(prepare_for_layout), deferred::prepare_for_layout
+ procedure(layout_complete), deferred::layout_complete
procedure(new_page), deferred::new_page
procedure(calculate_width), deferred::text_width
@@ -107,6 +108,13 @@ implicit none
class(renderer)::self
end subroutine prepare_for_layout
end interface
+
+ abstract interface
+ subroutine layout_complete(self)
+ import::renderer
+ class(renderer)::self
+ end subroutine layout_complete
+ end interface
abstract interface
function calculate_width(self, text, text_type)