aboutsummaryrefslogtreecommitdiff
path: root/ag_render.f90
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 /ag_render.f90
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.
Diffstat (limited to 'ag_render.f90')
-rw-r--r--ag_render.f9066
1 files changed, 53 insertions, 13 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)