From 13c83de74b4bdde3ea216d5b088dcc8c2e2fb5a5 Mon Sep 17 00:00:00 2001 From: Jiri Malak Date: Mon, 19 Aug 2024 20:27:51 +0200 Subject: [PATCH] gui: cleanup code --- bld/gui/h/gui.h | 8 ++++---- bld/gui/ui/c/guidoscr.c | 18 +++++++++--------- bld/gui/ui/c/guiscrol.c | 4 ++-- bld/gui/win/c/guidoscr.c | 40 ++++++++++++++++++++-------------------- 4 files changed, 35 insertions(+), 35 deletions(-) diff --git a/bld/gui/h/gui.h b/bld/gui/h/gui.h index ee41fa289b..c50cf189e8 100644 --- a/bld/gui/h/gui.h +++ b/bld/gui/h/gui.h @@ -866,10 +866,10 @@ extern void GUIAPI GUISetHScrollRangeCols( gui_window *wnd, gui_text_ord ran extern void GUIAPI GUISetVScrollRangeRows( gui_window *wnd, gui_text_ord range ); extern gui_text_ord GUIAPI GUIGetHScrollRangeCols( gui_window *wnd ); extern gui_text_ord GUIAPI GUIGetVScrollRangeRows( gui_window *wnd ); -extern void GUIAPI GUIDoHScroll( gui_window *wnd, int cols ); -extern void GUIAPI GUIDoVScroll( gui_window *wnd, int rows ); -extern void GUIAPI GUIDoHScrollClip( gui_window *wnd, int cols, int start, int end ); -extern void GUIAPI GUIDoVScrollClip( gui_window *wnd, int rows, int start, int end ); +extern void GUIAPI GUIDoHScroll( gui_window *wnd, int cols_diff ); +extern void GUIAPI GUIDoVScroll( gui_window *wnd, int rows_diff ); +extern void GUIAPI GUIDoHScrollClip( gui_window *wnd, int cols_diff, int start_col, int end_col ); +extern void GUIAPI GUIDoVScrollClip( gui_window *wnd, int rows_diff, int start_row, int end_row ); /* deals in percent of range */ diff --git a/bld/gui/ui/c/guidoscr.c b/bld/gui/ui/c/guidoscr.c index 004de350f8..3c5d7f1469 100644 --- a/bld/gui/ui/c/guidoscr.c +++ b/bld/gui/ui/c/guidoscr.c @@ -2,7 +2,7 @@ * * Open Watcom Project * -* Copyright (c) 2002-2021 The Open Watcom Contributors. All Rights Reserved. +* Copyright (c) 2002-2024 The Open Watcom Contributors. All Rights Reserved. * Portions Copyright (c) 1983-2002 Sybase, Inc. All Rights Reserved. * * ======================================================================== @@ -95,22 +95,22 @@ static void DoScroll( gui_window *wnd, int diff, a_gadget_direction dir, int sta GUIWndUpdate( wnd ); } -void GUIAPI GUIDoHScroll( gui_window *wnd, int cols ) +void GUIAPI GUIDoHScroll( gui_window *wnd, int cols_diff ) { - DoScroll( wnd, cols, HORIZONTAL, -1, -1 ); + DoScroll( wnd, cols_diff, HORIZONTAL, -1, -1 ); } -void GUIAPI GUIDoVScroll( gui_window *wnd, int rows ) +void GUIAPI GUIDoVScroll( gui_window *wnd, int rows_diff ) { - DoScroll( wnd, rows, VERTICAL, -1, -1 ); + DoScroll( wnd, rows_diff, VERTICAL, -1, -1 ); } -void GUIAPI GUIDoHScrollClip( gui_window *wnd, int cols, int start, int end ) +void GUIAPI GUIDoHScrollClip( gui_window *wnd, int cols_diff, int start_col, int end_col ) { - DoScroll( wnd, cols, HORIZONTAL, start, end ); + DoScroll( wnd, cols_diff, HORIZONTAL, start_col, end_col ); } -void GUIAPI GUIDoVScrollClip( gui_window *wnd, int rows, int start, int end ) +void GUIAPI GUIDoVScrollClip( gui_window *wnd, int rows_diff, int start_row, int end_row ) { - DoScroll( wnd, rows, VERTICAL, start, end ); + DoScroll( wnd, rows_diff, VERTICAL, start_row, end_row ); } diff --git a/bld/gui/ui/c/guiscrol.c b/bld/gui/ui/c/guiscrol.c index ade83dcab6..689c24397c 100644 --- a/bld/gui/ui/c/guiscrol.c +++ b/bld/gui/ui/c/guiscrol.c @@ -2,7 +2,7 @@ * * Open Watcom Project * -* Copyright (c) 2002-2021 The Open Watcom Contributors. All Rights Reserved. +* Copyright (c) 2002-2024 The Open Watcom Contributors. All Rights Reserved. * Portions Copyright (c) 1983-2002 Sybase, Inc. All Rights Reserved. * * ======================================================================== @@ -96,7 +96,7 @@ static void InitScroll( p_gadget gadget, guix_ord scr_pos ) static void SetScroll( p_gadget gadget, guix_ord scr_pos ) { - GUIScroll( (int)scr_pos - gadget->pos, gadget ); + GUIScroll( scr_pos - gadget->pos, gadget ); } static void Scrl( p_gadget gadget, gui_ord scroll_pos, void (*fn)( p_gadget, guix_ord ) ) diff --git a/bld/gui/win/c/guidoscr.c b/bld/gui/win/c/guidoscr.c index fd2d881954..dd745709b5 100644 --- a/bld/gui/win/c/guidoscr.c +++ b/bld/gui/win/c/guidoscr.c @@ -39,7 +39,7 @@ #include "guidoscr.h" -static void DoScroll( gui_window *wnd, int rows, int cols, int start, int end, bool chars ) +static void DoScroll( gui_window *wnd, int rows_diff, int cols_diff, int start, int end, bool char_unit ) { int dx, dy; WPI_RECT wpi_rect; @@ -61,12 +61,12 @@ static void DoScroll( gui_window *wnd, int rows, int cols, int start, int end, b #endif multx = 1; multy = 1; - if( chars ) { + if( char_unit ) { multx = GUITextToScreenH( 1, wnd ); multy = GUITextToScreenV( 1, wnd ); } - dx = -cols * multx; - dy = -rows * multy; + dx = -cols_diff * multx; + dy = -rows_diff * multy; if( dy != 0 ) { #ifdef __OS2_PM__ start *= multy; @@ -131,38 +131,38 @@ static void DoScroll( gui_window *wnd, int rows, int cols, int start, int end, b _wpi_updatewindow( hwnd ); } -void GUIAPI GUIDoVScroll( gui_window *wnd, int rows ) +void GUIAPI GUIDoVScroll( gui_window *wnd, int rows_diff ) { - DoScroll( wnd, rows, 0, -1, -1, true ); + DoScroll( wnd, rows_diff, 0, -1, -1, true ); } -void GUIAPI GUIDoHScroll( gui_window *wnd, int cols ) +void GUIAPI GUIDoHScroll( gui_window *wnd, int cols_diff ) { - DoScroll( wnd, 0, cols, -1, -1, true ); + DoScroll( wnd, 0, cols_diff, -1, -1, true ); } -void GUIAPI GUIDoVScrollClip( gui_window *wnd, int rows, int start, int end ) +void GUIAPI GUIDoVScrollClip( gui_window *wnd, int rows_diff, int start_row, int end_row ) { - DoScroll( wnd, rows, 0, start, end, true ); + DoScroll( wnd, rows_diff, 0, start_row, end_row, true ); } -void GUIAPI GUIDoHScrollClip( gui_window *wnd, int cols, int start, int end ) +void GUIAPI GUIDoHScrollClip( gui_window *wnd, int cols_diff, int start_col, int end_col ) { - DoScroll( wnd, 0, cols, start, end, true ); + DoScroll( wnd, 0, cols_diff, start_col, end_col, true ); } -void GUIDoScroll( gui_window *wnd, int row_col, int bar ) +void GUIDoScroll( gui_window *wnd, int diff, int bar ) { - int rows; - int cols; + int cols_diff; + int rows_diff; - rows = 0; - cols = 0; if( bar == SB_HORZ ) { - cols = row_col; + cols_diff = diff; + rows_diff = 0; } else { - rows = row_col; + rows_diff = diff; + cols_diff = 0; } - DoScroll( wnd, rows, cols, -1, -1, false ); + DoScroll( wnd, rows_diff, cols_diff, -1, -1, false ); }