From 00d2ec889f0d601ce20b928ab728f566b34a05a2 Mon Sep 17 00:00:00 2001 From: Toni Wilen Date: Sun, 27 Sep 2020 21:06:58 +0300 Subject: [PATCH] Statusline update. --- drawing.cpp | 2 +- include/statusline.h | 7 ++++--- od-win32/direct3d.cpp | 2 +- od-win32/direct3d11.cpp | 2 +- od-win32/picasso96_win.cpp | 2 +- od-win32/statusline_win32.cpp | 16 +++++++++------- od-win32/win32_scaler.cpp | 2 +- statusline.cpp | 28 ++++++++++++++++------------ 8 files changed, 34 insertions(+), 27 deletions(-) diff --git a/drawing.cpp b/drawing.cpp index abfe7419..8da58b10 100644 --- a/drawing.cpp +++ b/drawing.cpp @@ -3966,7 +3966,7 @@ static void draw_frame_extras(struct vidbuffer *vb, int y_start, int y_end) { if ((currprefs.leds_on_screen & STATUSLINE_CHIPSET) && softstatusline()) { int slx, sly; - int mult = statusline_get_multiplier(vb->monitor_id); + int mult = statusline_get_multiplier(vb->monitor_id) / 100; statusline_getpos(vb->monitor_id, &slx, &sly, vb->outwidth, vb->outheight); statusbar_y1 = sly + min_ypos_for_screen - 1; statusbar_y2 = statusbar_y1 + TD_TOTAL_HEIGHT * mult + 1; diff --git a/include/statusline.h b/include/statusline.h index f2234f66..355a2b94 100644 --- a/include/statusline.h +++ b/include/statusline.h @@ -3,8 +3,8 @@ #include "uae/types.h" -#define TD_PADX 4 -#define TD_PADY 2 +#define TD_DEFAULT_PADX 4 +#define TD_DEFAULT_PADY 2 #define TD_DEFAULT_WIDTH 30 #define TD_DEFAULT_LED_WIDTH 24 #define TD_DEFAULT_LED_HEIGHT 4 @@ -14,6 +14,7 @@ extern int td_numbers_pos; extern int td_numbers_width, td_numbers_height; +extern int td_numbers_padx, td_numbers_pady; extern const TCHAR *td_characters; extern int td_led_width; extern int td_width; @@ -21,7 +22,7 @@ extern int td_width; #define TD_DEFAULT_NUM_WIDTH 7 #define TD_DEFAULT_NUM_HEIGHT 7 -#define TD_TOTAL_HEIGHT (TD_PADY * 2 + td_numbers_height) +#define TD_TOTAL_HEIGHT (td_numbers_pady * 2 + td_numbers_height) #define NUMBERS_NUM 20 diff --git a/od-win32/direct3d.cpp b/od-win32/direct3d.cpp index 28f72ad1..344fce2b 100644 --- a/od-win32/direct3d.cpp +++ b/od-win32/direct3d.cpp @@ -1426,7 +1426,7 @@ static int createledtexture (struct d3dstruct *d3d) { struct AmigaMonitor *mon = &AMonitors[d3d - d3ddata]; - d3d->statusbar_hx = d3d->statusbar_vx = statusline_set_multiplier(mon->monitor_id, d3d->tout_w, d3d->tout_h); + d3d->statusbar_hx = d3d->statusbar_vx = statusline_set_multiplier(mon->monitor_id, d3d->tout_w, d3d->tout_h) / 100; d3d->ledwidth = d3d->window_w; d3d->ledheight = TD_TOTAL_HEIGHT * d3d->statusbar_vx; d3d->ledtexture = createtext(d3d, d3d->ledwidth, d3d->ledheight * d3d->statusbar_vx, D3DFMT_A8R8G8B8); diff --git a/od-win32/direct3d11.cpp b/od-win32/direct3d11.cpp index 3a16dd76..51fdc597 100644 --- a/od-win32/direct3d11.cpp +++ b/od-win32/direct3d11.cpp @@ -2003,7 +2003,7 @@ static bool CreateTexture(struct d3d11struct *d3d) UpdateVertexArray(d3d, d3d->m_vertexBuffer, 0, 0, 0, 0, 0, 0, 0, 0); - d3d->statusbar_hx = d3d->statusbar_vx = statusline_set_multiplier(mon->monitor_id, d3d->m_screenWidth, d3d->m_screenHeight); + d3d->statusbar_hx = d3d->statusbar_vx = statusline_set_multiplier(mon->monitor_id, d3d->m_screenWidth, d3d->m_screenHeight) / 100; d3d->ledwidth = d3d->m_screenWidth; d3d->ledheight = TD_TOTAL_HEIGHT * d3d->statusbar_vx; allocsprite(d3d, &d3d->osd, d3d->ledwidth, d3d->ledheight, true); diff --git a/od-win32/picasso96_win.cpp b/od-win32/picasso96_win.cpp index f1eeb6d2..498a200c 100644 --- a/od-win32/picasso96_win.cpp +++ b/od-win32/picasso96_win.cpp @@ -4215,7 +4215,7 @@ void picasso_statusline(int monid, uae_u8 *dst) if (currprefs.gfx_api) { statusline_render(monid, dst + sly * pitch, vidinfo->pixbytes, pitch, dst_width, dst_height, p96rc, p96gc, p96bc, NULL); } - int m = statusline_get_multiplier(monid); + int m = statusline_get_multiplier(monid) / 100; for (y = 0; y < TD_TOTAL_HEIGHT * m; y++) { uae_u8 *buf = dst + (y + sly) * pitch; draw_status_line_single(monid, buf, vidinfo->pixbytes, y, dst_width, p96rc, p96gc, p96bc, NULL); diff --git a/od-win32/statusline_win32.cpp b/od-win32/statusline_win32.cpp index f251ccad..8d7e4238 100644 --- a/od-win32/statusline_win32.cpp +++ b/od-win32/statusline_win32.cpp @@ -70,7 +70,8 @@ static void create_led_font(int monid) hdc = CreateCompatibleDC(NULL); if (hdc) { - int fontsize = -MulDiv(8, GetDeviceCaps(hdc, LOGPIXELSY), 72); + int y = GetDeviceCaps(hdc, LOGPIXELSY); + int fontsize = -MulDiv(6, y, 72); fontsize = fontsize * statusline_get_multiplier(monid) / 100; lp = (LOGPALETTE *)xcalloc(uae_u8, sizeof(LOGPALETTE) + 3 * sizeof(PALETTEENTRY)); if (lp) { @@ -102,7 +103,7 @@ static void create_led_font(int monid) RealizePalette(hdc); HFONT font = CreateFont(fontsize, 0, 0, 0, - FW_MEDIUM, + FW_NORMAL, FALSE, FALSE, FALSE, @@ -111,7 +112,7 @@ static void create_led_font(int monid) CLIP_DEFAULT_PRECIS, PROOF_QUALITY, FIXED_PITCH | FF_DONTCARE, - _T("Courier New")); + _T("Lucida Console")); if (font) { SelectObject(hdc, font); SetTextColor(hdc, PALETTEINDEX(2)); @@ -119,7 +120,7 @@ static void create_led_font(int monid) TEXTMETRIC tm; GetTextMetrics(hdc, &tm); int w = 0; - int h = tm.tmAscent; + int h = tm.tmAscent + 2; for (int i = 0; i < td_characters[i]; i++) { SIZE sz; if (GetTextExtentPoint32(hdc, &td_characters[i], 1, &sz)) { @@ -128,7 +129,8 @@ static void create_led_font(int monid) } } int offsetx = 10; - int offsety = 10 + (tm.tmDescent + 1) / 2; + int offsety = 10 - 1; + w += 1; td_new_numbers = xcalloc(char, w * h * NUMBERS_NUM); if (td_new_numbers) { for (int i = 0; i < td_characters[i]; i++) { @@ -290,10 +292,10 @@ void statusline_render(int monid, uae_u8 *buf, int bpp, int pitch, int width, in textwidth = size.cx; if (isfullscreen()) { if (td_numbers_pos & TD_RIGHT) { - bar_xstart = width - TD_PADX - VISIBLE_LEDS * td_width; + bar_xstart = width - td_numbers_padx - VISIBLE_LEDS * td_width; x = bar_xstart - textwidth - td_led_width; } else { - bar_xstart = TD_PADX; + bar_xstart = td_numbers_padx; x = bar_xstart + textwidth + td_led_width; } } diff --git a/od-win32/win32_scaler.cpp b/od-win32/win32_scaler.cpp index 63b9dc68..153c81ad 100644 --- a/od-win32/win32_scaler.cpp +++ b/od-win32/win32_scaler.cpp @@ -815,7 +815,7 @@ static void statusline(int monid) if (!(currprefs.leds_on_screen & STATUSLINE_CHIPSET) || !tempsurf) return; statusline_getpos(monid, &slx, &sly, dst_width, dst_height); - int m = statusline_get_multiplier(monid); + int m = statusline_get_multiplier(monid) / 100; lx = dst_width; ly = dst_height; SetRect(&sr, slx, 0, slx + lx, TD_TOTAL_HEIGHT * m); diff --git a/statusline.cpp b/statusline.cpp index 030885ff..def98150 100644 --- a/statusline.cpp +++ b/statusline.cpp @@ -52,6 +52,8 @@ void statusline_getpos(int monid, int *x, int *y, int width, int height) int td_numbers_pos = TD_RIGHT | TD_BOTTOM; int td_numbers_width = TD_DEFAULT_NUM_WIDTH; int td_numbers_height = TD_DEFAULT_NUM_HEIGHT; +int td_numbers_padx = TD_DEFAULT_PADX; +int td_numbers_pady = TD_DEFAULT_PADY; const TCHAR *td_characters = _T("0123456789CHD%+-PNKV"); int td_led_width = TD_DEFAULT_LED_WIDTH; static int td_led_height = TD_DEFAULT_LED_HEIGHT; @@ -115,6 +117,8 @@ void statusline_set_font(const char *newnumbers, int width, int height) { td_numbers_width = TD_DEFAULT_NUM_WIDTH; td_numbers_height = TD_DEFAULT_NUM_HEIGHT; + td_numbers_padx = TD_DEFAULT_PADX; + td_numbers_pady = TD_DEFAULT_PADY; td_led_width = TD_DEFAULT_LED_WIDTH; td_led_height = TD_DEFAULT_LED_HEIGHT; td_width = TD_DEFAULT_WIDTH; @@ -125,7 +129,7 @@ void statusline_set_font(const char *newnumbers, int width, int height) numbers = newnumbers; td_numbers_width = width; td_numbers_height = height; - td_led_width = td_numbers_width * 3; + td_led_width = td_numbers_width * 3 + td_numbers_width / 2; td_width = td_led_width + 10; td_custom = true; } @@ -135,8 +139,8 @@ int statusline_set_multiplier(int monid, int width, int height) struct amigadisplay *ad = &adisplays[monid]; int idx = ad->picasso_on ? 1 : 0; int mult = currprefs.leds_on_screen_multiplier[idx]; - if (mult < 100) { - mult = 100; + if (mult < 1 * 100) { + mult = 1 * 100; } if (mult > 4 * 100) { mult = 4 * 100; @@ -149,8 +153,8 @@ int statusline_get_multiplier(int monid) { struct amigadisplay *ad = &adisplays[monid]; int idx = ad->picasso_on ? 1 : 0; - if (statusline_mult[idx] <= 0) - return 1; + if (statusline_mult[idx] < 1 * 100) + return 1 * 100; return statusline_mult[idx]; } @@ -170,9 +174,9 @@ void draw_status_line_single(int monid, uae_u8 *buf, int bpp, int y, int totalwi c2 = ledcolor (0x00000000, rc, gc, bc, alpha); if (td_numbers_pos & TD_RIGHT) - x_start = totalwidth - (TD_PADX + VISIBLE_LEDS * td_width) * mult; + x_start = totalwidth - (td_numbers_padx + VISIBLE_LEDS * td_width) * mult; else - x_start = TD_PADX * mult; + x_start = td_numbers_padx * mult; for (led = 0; led < LED_MAX; led++) { int pos, num1 = -1, num2 = -1, num3 = -1, num4 = -1; @@ -387,21 +391,21 @@ void draw_status_line_single(int monid, uae_u8 *buf, int bpp, int y, int totalwi } } - if (y >= TD_PADY && y - TD_PADY < td_numbers_height) { + if (y >= td_numbers_pady && y - td_numbers_pady < td_numbers_height) { if (num3 >= 0) { x += (td_led_width - am * td_numbers_width) * mult / 2; if (num1 > 0) { - write_tdnumber(buf, bpp, x, y - TD_PADY, num1, pen_rgb, c2, mult); + write_tdnumber(buf, bpp, x, y - td_numbers_pady, num1, pen_rgb, c2, mult); x += td_numbers_width * mult; } if (num2 >= 0) { - write_tdnumber(buf, bpp, x, y - TD_PADY, num2, pen_rgb, c2, mult); + write_tdnumber(buf, bpp, x, y - td_numbers_pady, num2, pen_rgb, c2, mult); x += td_numbers_width * mult; } - write_tdnumber(buf, bpp, x, y - TD_PADY, num3, pen_rgb, c2, mult); + write_tdnumber(buf, bpp, x, y - td_numbers_pady, num3, pen_rgb, c2, mult); x += td_numbers_width * mult; if (num4 > 0) - write_tdnumber(buf, bpp, x, y - TD_PADY, num4, pen_rgb, c2, mult); + write_tdnumber(buf, bpp, x, y - td_numbers_pady, num4, pen_rgb, c2, mult); } } } -- 2.47.3