Skip to content

Commit

Permalink
gui: cleanup code
Browse files Browse the repository at this point in the history
  • Loading branch information
jmalak committed Aug 19, 2024
1 parent 12afe6e commit 13c83de
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 35 deletions.
8 changes: 4 additions & 4 deletions bld/gui/h/gui.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */

Expand Down
18 changes: 9 additions & 9 deletions bld/gui/ui/c/guidoscr.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
* ========================================================================
Expand Down Expand Up @@ -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 );
}
4 changes: 2 additions & 2 deletions bld/gui/ui/c/guiscrol.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
* ========================================================================
Expand Down Expand Up @@ -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 ) )
Expand Down
40 changes: 20 additions & 20 deletions bld/gui/win/c/guidoscr.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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 );
}

0 comments on commit 13c83de

Please sign in to comment.