Skip to content

Commit

Permalink
ide: revert back change in WHotSpotList::adjustScrollBars
Browse files Browse the repository at this point in the history
revert back change and add comment about scroll amount units
horizontaly is used graphicals units (pixels) and verticaly character units
  • Loading branch information
jmalak committed Jul 26, 2024
1 parent db82564 commit 70a0c43
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 25 deletions.
10 changes: 5 additions & 5 deletions bld/ide/ide/cpp/vlistbox.cpp
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 @@ -44,13 +44,13 @@ WEXPORT VListBox::~VListBox() {

void VListBox::insertString( const char *str ) {
WString *tmp;
int len;
int extentx;

tmp = new WString( str );
_strings.add( tmp );
len = getTextExtentX( *tmp, tmp->size() );
if( len > _maxWidth )
_maxWidth = len;
extentx = getTextExtentX( *tmp, tmp->size() );
if( _maxWidth < extentx )
_maxWidth = extentx;
adjustScrollBars();
// update();
performScroll( count(), true );
Expand Down
18 changes: 9 additions & 9 deletions bld/ide/ide/cpp/whotlist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,11 @@ void WHotSpotList::adjustScrollBars()
if( cnt > getRows() ) {
scrollrows = cnt;
}
/* vertical scroll and position is in character units */
setScrollTextRange( WScrollBarVertical, scrollrows );
setScrollTextPos( WScrollBarVertical, _topIndex );
setScrollTextRange( WScrollBarHorizontal, width() );
/* horizontal scroll is in graphical units */
setScrollRange( WScrollBarHorizontal, width() );
}

void WHotSpotList::resized( WOrdinal w, WOrdinal h )
Expand All @@ -95,7 +97,7 @@ bool WHotSpotList::paint()
int offset;
int maxRows = numDirtyRows() + _topIndex + firstDirtyRow();
int numElem = count();
int extent;
int extentx;
WRect r;

getClientRect( r );
Expand All @@ -118,15 +120,13 @@ bool WHotSpotList::paint()
} else {
offset = 0;
}
extent = r.w();
if( width() > extent )
extent = width();
extentx = r.w();
if( extentx < width() )
extentx = width();
if( i == _selected ) {
drawTextExtent( i - _topIndex, offset, str, WPaintAttrMenuActive,
extent );
drawTextExtent( i - _topIndex, offset, str, WPaintAttrMenuActive, extentx );
} else {
drawTextExtent( i - _topIndex, offset, str, WPaintAttrControlBackground,
extent );
drawTextExtent( i - _topIndex, offset, str, WPaintAttrControlBackground, extentx );
}
}

Expand Down
22 changes: 11 additions & 11 deletions bld/ide/ide/cpp/whotpbox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

WEXPORT WHotPickBox::WHotPickBox( WPickList &plist, cbs gname, icb gindex, bcb gincluded,
WWindow *win, const WRect& r, WHotSpots* hs )
/********************************************/
/****************************************************/
: WHotSpotList( win, r, NULL, hs )
, WView( &plist )
, _gname( gname )
Expand All @@ -59,7 +59,7 @@ WEXPORT WHotPickBox::~WHotPickBox()
}

void WEXPORT WHotPickBox::name( int index, WString &str )
/******************************************************/
/*******************************************************/
{
if( _gname != NULL ) {
(((WObject*)_tags[index])->*_gname)( str );
Expand All @@ -77,7 +77,7 @@ bool WHotPickBox::gettingFocus( WWindow * )
}

void WEXPORT WHotPickBox::fillBox()
/********************************/
/*********************************/
{
int i;

Expand Down Expand Up @@ -122,15 +122,15 @@ void* WEXPORT WHotPickBox::tagPtr( int index )
}

void WEXPORT WHotPickBox::setTagPtr( int index, void* ptr )
/********************************************/
/*********************************************************/
{
if( _tags && index < _tagsCount ) {
_tags[index] = ptr;
}
}

void * WEXPORT WHotPickBox::selectedTagPtr()
/*****************************************/
/******************************************/
{
int index = selected();
if( index >= 0 ) {
Expand All @@ -152,7 +152,7 @@ void WEXPORT WHotPickBox::selectSameTag( void* tag )


void WEXPORT WHotPickBox::updateView()
/***********************************/
/************************************/
{
if( _model ) {
int top = topIndex();
Expand All @@ -173,13 +173,13 @@ void WEXPORT WHotPickBox::updateView()


void WEXPORT WHotPickBox::modelGone()
/**********************************/
/***********************************/
{
reset();
}

int WEXPORT WHotPickBox::count()
/********************************************/
/******************************/
{
if( _model ) {
return( _tagsCount );
Expand All @@ -188,13 +188,13 @@ int WEXPORT WHotPickBox::count()
}

void WEXPORT WHotPickBox::setTopIndex( int top )
/********************************************/
/**********************************************/
{
performScroll( top, true );
}

const char * WEXPORT WHotPickBox::getString( int index )
/********************************************/
/******************************************************/
{
static WString n;
name( index, n );
Expand All @@ -207,7 +207,7 @@ int WEXPORT WHotPickBox::getHotOffset( int /*index*/ )
}

int WEXPORT WHotPickBox::getHotSpot( int index, bool /*pressed*/ )
/********************************************/
/****************************************************************/
{
if( _gindex ) {
return( (((WObject*)_tags[index])->*_gindex)() );
Expand Down

0 comments on commit 70a0c43

Please sign in to comment.