From 313ea185e0b3e43b5d464cbce4ccf2db953e4da7 Mon Sep 17 00:00:00 2001 From: Jeffrey Armstrong Date: Tue, 9 Mar 2021 16:25:04 -0500 Subject: Implemented everything using hi DPI. --- ag_render.f90 | 55 +++++++++++++++++++++++++++--------------------------- gemini-windows.prj | 3 +++ 2 files changed, 31 insertions(+), 27 deletions(-) diff --git a/ag_render.f90 b/ag_render.f90 index 49aecb2..e964df3 100644 --- a/ag_render.f90 +++ b/ag_render.f90 @@ -310,7 +310,7 @@ contains myexpand = .false. endif - self%address_bar_height = 24 + self%address_bar_height = scaledpi(24) ! Set up some address bar colors active_page = getactivepage() @@ -320,30 +320,30 @@ contains call setfillstyle(SOLID_FILL, LIGHTGRAY) call setbkcolor(LIGHTGRAY) call setcolor(BLACK) - call settextstyle(SYMBOLS_FONT, HORIZ_DIR, 14) + call settextstyle(SYMBOLS_FONT, HORIZ_DIR, scaledpi(14)) 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, 40, 20, CHAR(231), back_button_callback) + self%back_button_id = createbutton(x, 2, scaledpi(40), scaledpi(20), CHAR(231), back_button_callback) else - call setbuttonposition(self%back_button_id, x, 2, 40, 20) + call setbuttonposition(self%back_button_id, x, 2, scaledpi(40), scaledpi(20)) end if - x = x + 50 + x = x + scaledpi(50) label_x = x - call settextstyle(WINDOWS_FONT, HORIZ_DIR, 12) + call settextstyle(WINDOWS_FONT, HORIZ_DIR, scaledpi(14)) 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) + self%address_id = createtextbox(x, 2, address_width, scaledpi(20)) call settextboxentercallback(self%address_id, go_button_callback) else - call settextboxposition(self%address_id, x, 2, address_width, 20) + call settextboxposition(self%address_id, x, 2, address_width, scaledpi(20)) end if ! Clears any drawing operations for controls quickly @@ -353,28 +353,28 @@ contains x = x + 10 + address_width if(self%go_button_id < 0) then - self%go_button_id = createbutton(x, 2, 40, 20, CHAR(232), go_button_callback) + self%go_button_id = createbutton(x, 2, scaledpi(40), scaledpi(20), CHAR(232), go_button_callback) else - call setbuttonposition(self%go_button_id, x, 2, 40, 20) + call setbuttonposition(self%go_button_id, x, 2, scaledpi(40), scaledpi(20)) end if - call settextstyle(SYMBOLS_FONT, HORIZ_DIR, 18) + call settextstyle(SYMBOLS_FONT, HORIZ_DIR, scaledpi(18)) ! If we're not expanding, just draw these buttons in order if(.not. myexpand) then - x = getmaxx() - 95 + x = getmaxx() - scaledpi(95) if(self%fave_button_id < 0) then - self%fave_button_id = createbutton(x, 2, 40, 20, CHAR(171), fave_button_callback) + self%fave_button_id = createbutton(x, 2, scaledpi(40), scaledpi(20), CHAR(171), fave_button_callback) else - call setbuttonposition(self%fave_button_id, x, 2, 40, 20) + call setbuttonposition(self%fave_button_id, x, 2, scaledpi(40), scaledpi(20)) end if - x = x + 50 + x = x + scaledpi(50) if(self%internal_button_id < 0) then - self%internal_button_id = createbutton(x, 2, 40, 20, CHAR(62), internal_button_callback) + self%internal_button_id = createbutton(x, 2, scaledpi(40), scaledpi(20), CHAR(62), internal_button_callback) else - call setbuttonposition(self%internal_button_id, x, 2, 40, 20) + call setbuttonposition(self%internal_button_id, x, 2, scaledpi(40), scaledpi(20)) end if ! If expanding due to resize, we need to draw the rightmost first. @@ -382,11 +382,11 @@ contains ! check for that anymore else - x = getmaxx() - 45 - call setbuttonposition(self%internal_button_id, x, 2, 40, 20) + x = getmaxx() - scaledpi(45) + call setbuttonposition(self%internal_button_id, x, 2, scaledpi(40), scaledpi(20)) - x = x - 50 - call setbuttonposition(self%fave_button_id, x, 2, 40, 20) + x = x - scaledpi(50) + call setbuttonposition(self%fave_button_id, x, 2, scaledpi(40), scaledpi(20)) end if @@ -400,7 +400,7 @@ contains call setviewport(0, 0, getmaxx()+1, self%address_bar_height+1, .true.) call clearviewport() - call settextstyle(WINDOWS_FONT, HORIZ_DIR, 12) + call settextstyle(WINDOWS_FONT, HORIZ_DIR, scaledpi(14)) call outtextxy(label_x, 5, "Address:") call resetviewport() @@ -422,14 +422,14 @@ contains call resetviewport() call setviewport(0, getmaxy()-self%status_bar_height, getmaxx()+1, getmaxy()+1, .true.) active_page = getactivepage() - self%status_bar_height = 16 + self%status_bar_height = scaledpi(16) do i = 0, 1 call setactivepage(i) call setbkcolor(LIGHTGRAY) call setcolor(BLACK) - call settextstyle(WINDOWS_FONT, HORIZ_DIR, 12) + call settextstyle(WINDOWS_FONT, HORIZ_DIR, scaledpi(14)) call clearviewport() @@ -486,14 +486,15 @@ contains class(appgraphics_renderer)::self - self%window_id = initwindow(default_width, default_height, "LR-87", & + call setapplicationdpiaware() + + self%window_id = initwindow(scaledpi(default_width), scaledpi(default_height), "LR-87", & DEFAULT_POSITION, DEFAULT_POSITION, & .TRUE., .FALSE.) call setwindowsmallicon(1) call setwindowlargeicon(1) - call setwindowclosecallback(window_closing_callback) call registermousehandler(MOUSE_LB_UP, mouse_button_callback) call registermousehandler(MOUSE_MOVE, mouse_move_callback) @@ -520,7 +521,7 @@ contains self%link_color = BLUE self%max_width = compute_max_width(self) - self%font_size = default_font_size + self%font_size = scaledpi(default_font_size) self%default_font = SERIF_FONT self%line_spacing = 2 self%left_border = 15 diff --git a/gemini-windows.prj b/gemini-windows.prj index d9d673a..e33f253 100644 --- a/gemini-windows.prj +++ b/gemini-windows.prj @@ -60,6 +60,9 @@ },{ "filename":".\\escape.f90", "enabled":"1" + },{ + "filename":".\\favicon.f90", + "enabled":"1" },{ "filename":".\\favorites.f90", "enabled":"1" -- cgit v1.2.3