diff options
Diffstat (limited to 'app/bin/chotbar.c')
| -rw-r--r-- | app/bin/chotbar.c | 365 | 
1 files changed, 197 insertions, 168 deletions
| diff --git a/app/bin/chotbar.c b/app/bin/chotbar.c index 379f31a..a0e6332 100644 --- a/app/bin/chotbar.c +++ b/app/bin/chotbar.c @@ -17,7 +17,7 @@   *   *  You should have received a copy of the GNU General Public License   *  along with this program; if not, write to the Free Software - *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA   */  #include "compound.h" @@ -41,27 +41,28 @@ static wMenu_p hotbarPopupM;  static wMenuList_p hotBarML = NULL;  static wIndex_t hotBarMLcnt = 0;  static drawCmd_t hotBarD = { -		NULL, -		&screenDrawFuncs, -		0, -		1.0, -		0.0, -		{0.0, 0.0}, {0.0, 0.0}, -		Pix2CoOrd, CoOrd2Pix }; +	NULL, +	&screenDrawFuncs, +	0, +	1.0, +	0.0, +	{0.0, 0.0}, {0.0, 0.0}, +	Pix2CoOrd, CoOrd2Pix +};  static wWinPix_t hotBarDrawHeight[] = {26, 32, 40}; -static wFontSize_t hotBarFontSize[] = {7, 8, 9}; +static wFontSize_t hotBarFontSize[] = {7, 11, 14};  typedef struct { -		DIST_T x; -		DIST_T w; -		DIST_T objectW; -		DIST_T labelW; -		coOrd size; -		coOrd orig; -		BOOL_T isFixed; -		void * context; -		hotBarProc_t proc; -		DIST_T barScale; -		} hotBarMap_t; +	DIST_T x; +	DIST_T w; +	DIST_T objectW; +	DIST_T labelW; +	coOrd size; +	coOrd orig; +	BOOL_T isFixed; +	void * context; +	hotBarProc_t proc; +	DIST_T barScale; +} hotBarMap_t;  static dynArr_t hotBarMap_da;  #define hotBarMap(N) DYNARR_N( hotBarMap_t, hotBarMap_da, N )  static int hotBarCurrSelects[2] = { -1, -1 }; @@ -74,23 +75,25 @@ static DIST_T hotBarWidth = 0.0;  static void HotBarHighlight( int inx, DIST_T fixed_x )  { -	if ( inx > 0 && ( inx < hotBarCurrStart || inx >= hotBarCurrEnd ) ) +	if ( inx > 0 && ( inx < hotBarCurrStart || inx >= hotBarCurrEnd ) ) {  		return; +	}  	coOrd orig, size;  	hotBarD.scale = 1; -	if ( inx == 0 && hotBarMap_da.cnt>0 && hotBarMap(0).isFixed) +	if ( inx == 0 && hotBarMap_da.cnt>0 && hotBarMap(0).isFixed) {  		orig.x = 0; -	else +	} else {  		orig.x = hotBarMap(inx).x-hotBarMap(hotBarCurrStart).x + (inx>0?fixed_x:0); +	}  	orig.y = 0;  	size.x = hotBarMap(inx).w - 2.0/hotBarD.dpi;  	size.y = toolbarHeight;  #ifdef LATER  	printf( "HotBarHilite fixed_x:%0.3f X0:%d/%0.3f X:%d/%0.3f+%0.3f X=%0.3f\n", -			fixed_x, -			hotBarCurrStart, hotBarMap(hotBarCurrStart).x, -			inx, hotBarMap(inx).x, hotBarMap(inx).w, -			orig.x ); +	        fixed_x, +	        hotBarCurrStart, hotBarMap(hotBarCurrStart).x, +	        inx, hotBarMap(inx).x, hotBarMap(inx).w, +	        orig.x );  #endif  	DrawRectangle( &hotBarD, orig, size, wDrawColorBlack, DRAW_TRANSPARENT );  } @@ -106,15 +109,18 @@ static void RedrawHotBar( wDraw_p dd, void * data, wWinPix_t w, wWinPix_t h  )  	coOrd orig;  	int inx;  	hotBarMap_t * tbm; -	DIST_T barHeight = (DIST_T)(wControlGetHeight( (wControl_p)hotBarD.d ) - 2)/hotBarD.dpi; -	DIST_T barWidth = (DIST_T)(wControlGetWidth( (wControl_p)hotBarD.d ) - 2)/hotBarD.dpi; +	DIST_T barHeight = (DIST_T)(wControlGetHeight( (wControl_p)hotBarD.d ) - +	                            2)/hotBarD.dpi; +	DIST_T barWidth = (DIST_T)(wControlGetWidth( (wControl_p)hotBarD.d ) - +	                           2)/hotBarD.dpi; +  	DIST_T barScale;  	DIST_T x;  	wDrawClear( hotBarD.d ); -	if (hotBarCurrStart >0) +	if (hotBarCurrStart >0) {  		wControlActive( (wControl_p)hotBarLeftB, TRUE ); -	else { +	} else {  		wButtonSetBusy(hotBarLeftB, FALSE);  		wControlActive( (wControl_p)hotBarLeftB, FALSE );  	} @@ -124,11 +130,13 @@ static void RedrawHotBar( wDraw_p dd, void * data, wWinPix_t w, wWinPix_t h  )  		wControlActive( (wControl_p)hotBarRightB, FALSE );  		return;  	} -	if ( hotBarLabels && !hotBarFp ) +	if ( hotBarLabels && !hotBarFp ) {  		hotBarFp = wStandardFont( F_HELV, FALSE, FALSE ); +	}  	DIST_T fixed_x = 0.0; -	if (hotBarCurrStart>0 && hotBarMap_da.cnt>0 && hotBarMap(0).isFixed) {				//Do fixed element first - Cornu +	if (hotBarCurrStart>0 && hotBarMap_da.cnt>0 +	    && hotBarMap(0).isFixed) {				//Do fixed element first - Cornu  		tbm = &hotBarMap(0);  		barScale = tbm->barScale;  		x = 0.0; @@ -138,8 +146,8 @@ static void RedrawHotBar( wDraw_p dd, void * data, wWinPix_t w, wWinPix_t h  )  			if ( tbm->labelW > tbm->objectW ) {  				fixed_x = tbm->labelW;  				x += (tbm->labelW-tbm->objectW)/2; -			} else fixed_x = tbm->objectW; -		} else fixed_x = tbm->objectW; +			} else { fixed_x = tbm->objectW; } +		} else { fixed_x = tbm->objectW; }  		x *= barScale;  		orig.x = x;  		hotBarD.scale = barScale; @@ -150,7 +158,8 @@ static void RedrawHotBar( wDraw_p dd, void * data, wWinPix_t w, wWinPix_t h  )  			hotBarD.scale = 1.0;  			orig.x = 0.0;  			orig.y = 2.0/hotBarD.dpi;	            //Draw Label under icon -			DrawString( &hotBarD, orig, 0.0, tbm->proc( HB_BARTITLE, tbm->context, NULL, NULL ), hotBarFp, hotBarFs, drawColorBlack ); +			DrawString( &hotBarD, orig, 0.0, tbm->proc( HB_BARTITLE, tbm->context, NULL, +			                NULL ), hotBarFp, hotBarFs, drawColorBlack );  		}  	} @@ -179,18 +188,21 @@ static void RedrawHotBar( wDraw_p dd, void * data, wWinPix_t w, wWinPix_t h  )  			hotBarD.scale = 1.0;  			orig.x = tbm->x - hotBarMap(hotBarCurrStart).x + fixed_x;  			orig.y = 2.0/hotBarD.dpi;	            //Draw Label under icon -			DrawString( &hotBarD, orig, 0.0, tbm->proc( HB_BARTITLE, tbm->context, NULL, NULL ), hotBarFp, hotBarFs, drawColorBlack ); +			DrawString( &hotBarD, orig, 0.0, tbm->proc( HB_BARTITLE, tbm->context, NULL, +			                NULL ), hotBarFp, hotBarFs, drawColorBlack );  		}  	}  	hotBarCurrEnd = inx;  	if ((hotBarCurrSelect==0 && hotBarMap_da.cnt>0 && hotBarMap(0).isFixed) || -		((hotBarCurrSelect >= hotBarCurrStart) && (hotBarCurrSelect < hotBarCurrEnd)) ) +	    ((hotBarCurrSelect >= hotBarCurrStart) +	     && (hotBarCurrSelect < hotBarCurrEnd)) ) {  		HotBarHighlight( hotBarCurrSelect, fixed_x ); -/*	  else -		hotBarCurrSelect = -1;*/ -	if (hotBarCurrEnd < hotBarMap_da.cnt) +	} +	/*	  else +			hotBarCurrSelect = -1;*/ +	if (hotBarCurrEnd < hotBarMap_da.cnt) {  		wControlActive( (wControl_p)hotBarRightB, TRUE ); -	else { +	} else {  		wButtonSetBusy(hotBarRightB, FALSE);  		wControlActive( (wControl_p)hotBarRightB, FALSE );  	} @@ -200,22 +212,26 @@ static void RedrawHotBar( wDraw_p dd, void * data, wWinPix_t w, wWinPix_t h  )  static void DoHotBarRight( void * data )  { -	DIST_T barWidth = ((DIST_T)wControlGetWidth( (wControl_p)hotBarD.d ) - 2.0)/hotBarD.dpi; +	DIST_T barWidth = ((DIST_T)wControlGetWidth( (wControl_p)hotBarD.d ) - +	                   2.0)/hotBarD.dpi;  	int inx = hotBarCurrStart; -	DIST_T lastX = hotBarMap(hotBarMap_da.cnt-1).x + hotBarMap(hotBarMap_da.cnt-1).w + 2.0/hotBarD.dpi; +	DIST_T lastX = hotBarMap(hotBarMap_da.cnt-1).x + hotBarMap( +	                       hotBarMap_da.cnt-1).w + 2.0/hotBarD.dpi;  	if (MyGetKeyState()&WKEY_SHIFT) {  		inx += hotBarMap_da.cnt/8;  	} else {  		inx++;  	} -	if ( inx >= hotBarMap_da.cnt ) +	if ( inx >= hotBarMap_da.cnt ) {  		inx = hotBarMap_da.cnt-1; +	}  	DIST_T fixed_x = 0.0;  	if (hotBarCurrStart>0 && hotBarMap(0).isFixed) {  		fixed_x = hotBarMap(0).w;  	} -	while ( (inx > 1) && ((lastX - hotBarMap(inx-1).x) < (barWidth - fixed_x)) ) -			 inx--; +	while ( (inx > 1) && ((lastX - hotBarMap(inx-1).x) < (barWidth - fixed_x)) ) { +		inx--; +	}  	if ( inx != hotBarCurrStart ) {  		hotBarCurrStart = inx;  		RedrawHotBar( hotBarD.d, NULL, 0, 0 ); @@ -231,8 +247,9 @@ static void DoHotBarLeft( void * data )  	} else {  		inx --;  	} -	if ( inx < 0 ) +	if ( inx < 0 ) {  		inx = 0; +	}  	if ( inx != hotBarCurrStart ) {  		hotBarCurrStart = inx;  		RedrawHotBar( hotBarD.d, NULL, 0, 0 ); @@ -245,17 +262,20 @@ static void DoHotBarJump( int inx )  	DIST_T x, barWidth;  	inx -= '0'; -	if (inx < 0 || inx > 9) +	if (inx < 0 || inx > 9) {  		return; -	if (inx == 0) +	} +	if (inx == 0) {  		inx = 9; -	else +	} else {  		inx--; +	}  	barWidth = (DIST_T)wControlGetWidth( (wControl_p)hotBarD.d )/hotBarD.dpi;  	x = (inx*(hotBarWidth-barWidth))/9.0;  	for ( inx=0; inx<hotBarMap_da.cnt; inx++ ) { -		if (x <= hotBarMap(inx).x) +		if (x <= hotBarMap(inx).x) {  			break; +		}  	}  	if ( hotBarCurrStart != inx ) {  		hotBarCurrStart = inx; @@ -264,21 +284,35 @@ static void DoHotBarJump( int inx )  } -static void SelectHotBar( wDraw_p d, void * context, wAction_t action, wDrawPix_t w, wDrawPix_t h ) +static void SelectHotBar( wDraw_p d, void * context, wAction_t action, +                          wDrawPix_t w, wDrawPix_t h )  {  	int inx; -	coOrd pos; +//	coOrd pos;  	DIST_T x;  	wWinPix_t px;  	hotBarMap_t * tbm;  	char * titleP; -	if ( hotBarMap_da.cnt <= 0 ) +	if ( hotBarMap_da.cnt <= 0 ) {  		return; +	}  #if 0 -	if ( !CommandEnabled( hotBarCmdInx ) ) +	if ( !CommandEnabled( hotBarCmdInx ) ) {  		return; +	}  #endif + +	if ( ( action & 0xff ) == wActionText ) { +		int key = (int)(action >> 8); +		if ( key >= '0' && key <= '9') { +			DoHotBarJump( key ); +		} else if ( key == 0x1B ) { +			ConfirmReset( FALSE ); +		} +		return; +	} +  	if ( (action&0xFF) ==  wActionRUp ) {  		wMenuPopupShow( hotbarPopupM );  		return; @@ -290,20 +324,21 @@ static void SelectHotBar( wDraw_p d, void * context, wAction_t action, wDrawPix_  		fixed_x = hotBarMap(0).w;  		x = w/hotBarD.dpi + hotBarMap(0).x;  		if ( (x>= hotBarMap(0).x) && -			 (x <=hotBarMap(0).w )) inx = 0;   //Match on fixed +		     (x <=hotBarMap(0).w )) { inx = 0; }   //Match on fixed  	} -	if (inx<0){																//NoMatch +	if (inx<0) {																//NoMatch  		x = w/hotBarD.dpi + hotBarMap(hotBarCurrStart).x;  		for ( inx=hotBarCurrStart; inx<hotBarCurrEnd; inx++ ) {  			if ((x >= hotBarMap(inx).x + fixed_x) &&						//leave spaces between buttons -				(x <= hotBarMap(inx).x + hotBarMap(inx).w + fixed_x )) { -					break; +			    (x <= hotBarMap(inx).x + hotBarMap(inx).w + fixed_x )) { +				break;  			}  		}  	} -	if (inx >= hotBarCurrEnd) +	if (inx >= hotBarCurrEnd) {  		return; +	}  	tbm = &hotBarMap(inx);  	if (inx==0) {  		px = (wWinPix_t)((tbm->x-hotBarMap(0).x)*hotBarD.dpi); @@ -316,8 +351,8 @@ static void SelectHotBar( wDraw_p d, void * context, wAction_t action, wDrawPix_  	wControlSetBalloon( (wControl_p)hotBarD.d, px, -20, titleP );  	switch (action & 0xff) {  	case wActionLDown: -		pos.x = mainD.size.x+mainD.orig.x; -		pos.y = mainD.size.y+mainD.orig.y; +//		pos.x = mainD.size.x+mainD.orig.x; +//		pos.y = mainD.size.y+mainD.orig.y;  		if ( hotBarCurrSelect >= 0 ) {  			//HotBarHighlight( hotBarCurrSelect );  			hotBarCurrSelect = -1; @@ -328,7 +363,8 @@ static void SelectHotBar( wDraw_p d, void * context, wAction_t action, wDrawPix_  		hotBarCurrSelect = inx;  		HotBarHighlight( hotBarCurrSelect, fixed_x );  		if (recordF) { -			fprintf( recordF, "HOTBARSELECT %s\n", tbm->proc( HB_FULLTITLE, tbm->context, NULL, NULL ) ); +			fprintf( recordF, "HOTBARSELECT %s\n", tbm->proc( HB_FULLTITLE, tbm->context, +			                NULL, NULL ) );  		}  		FakeDownMouseState();  		break; @@ -348,25 +384,6 @@ static void SelectHotBar( wDraw_p d, void * context, wAction_t action, wDrawPix_  			break;  		}  		break; -	case wActionText: -		switch (action >> 8) { -		case '0': -		case '1': -		case '2': -		case '3': -		case '4': -		case '5': -		case '6': -		case '7': -		case '8': -		case '9': -			DoHotBarJump( action >> 8 ); -			break; -		case 0x1B: -			ConfirmReset(FALSE); -			break; -		} -		break;  	}  } @@ -375,34 +392,32 @@ EXPORT void HotBarCancel( void )  {  	if ( hotBarCurrSelect >= 0 )  		//HotBarHighlight( hotBarCurrSelect ); -	hotBarCurrSelect = -1; +	{ +		hotBarCurrSelect = -1; +	}  	RedrawHotBar(hotBarD.d, NULL, 0, 0 );  }  static BOOL_T HotBarSelectPlayback( char * line )  { -	int inx; -	hotBarMap_t * tbm; -	while (*line && isspace((unsigned char)*line) ) line++; -	DIST_T fixed_x = 0; -	for ( inx=0; inx<hotBarMap_da.cnt; inx++ ) { -		tbm = &hotBarMap(inx); -		if (inx == 0 && hotBarMap_da.cnt>0 && hotBarMap(0).isFixed) { -			fixed_x = hotBarMap(0).w; -		} +	while (*line && isspace((unsigned char)*line) ) { line++; } +	for ( int inx=0; inx<hotBarMap_da.cnt; inx++ ) { +		hotBarMap_t * tbm = &hotBarMap(inx);  		if ( strcmp( tbm->proc( HB_FULLTITLE, tbm->context, NULL, NULL ), line) == 0) { -			if ( hotBarCurrSelect >= 0 ) { -				//HotBarHighlight( hotBarCurrSelect ); -				RedrawHotBar(hotBarD.d, NULL, 0, 0 ); -			} +			tbm->proc( HB_SELECT, hotBarMap(inx).context, NULL, NULL );  			hotBarCurrSelect = inx;  			if ( hotBarCurrSelect < hotBarCurrStart || hotBarCurrSelect > hotBarCurrEnd ) { +				// Shift the hotbar so the selected object is visible  				hotBarCurrStart = hotBarCurrSelect;  				RedrawHotBar( hotBarD.d, NULL, 0, 0 );  			} +			DIST_T fixed_x = 0.0; +			if ( inx > 0 && hotBarCurrStart > 0 && hotBarMap(0).isFixed ) { +				// Leave room for Flex object +				fixed_x = hotBarMap(0).w; +			}  			HotBarHighlight( hotBarCurrSelect, fixed_x ); -			hotBarMap(inx).proc( HB_SELECT, hotBarMap(inx).context, NULL, NULL );  			FakeDownMouseState();  			return TRUE;  		} @@ -427,58 +442,64 @@ static BOOL_T SetHotBarScale( char * line )  static char curContentsLabel[STR_SHORT_SIZE];  EXPORT void AddHotBarElement( -		char * contentsLabel, -		coOrd size, -		coOrd orig, -		BOOL_T isTrack, -		BOOL_T isFixed, -		DIST_T barScale, -		void * context, -		hotBarProc_t proc_p ) +        char * contentsLabel, +        coOrd size, +        coOrd orig, +        BOOL_T isTrack, +        BOOL_T isFixed, +        DIST_T barScale, +        void * context, +        hotBarProc_t proc_p )  {  	hotBarMap_t * tbm;  	coOrd textsize; -		if ( contentsLabel && strncmp(contentsLabel, curContentsLabel, sizeof curContentsLabel) != 0 && !isFixed ) { -			wMenuListAdd( hotBarML, hotBarMLcnt++, contentsLabel, I2VP(hotBarMap_da.cnt) ); -			strncpy( curContentsLabel, contentsLabel, sizeof curContentsLabel ); -		} -		if (barScale <= 0) { -			if (!isTrack) -				barScale = size.y/(((double)hotBarHeight-2.0)/hotBarD.dpi); -			else if (isTrack) { -				// size.y += 2.0 * trackGauge; -				barScale = (trackGauge>0.1)?trackGauge*(36-hotBarHeight/2):10.0; -				// barScale = 2.0 / ((hotBarHeight-2.0) / hotBarD.dpi); -				//if (size.y >= size.x) -				if (size.y/barScale > ((double)hotBarHeight-2.0)/hotBarD.dpi) -				   barScale = (size.y+2.0*trackGauge)/(((double)hotBarHeight-2.0)/hotBarD.dpi); +	if ( contentsLabel +	     && strncmp(contentsLabel, curContentsLabel, sizeof curContentsLabel) != 0 +	     && !isFixed ) { +		wMenuListAdd( hotBarML, hotBarMLcnt++, contentsLabel, I2VP(hotBarMap_da.cnt) ); +		strncpy( curContentsLabel, contentsLabel, sizeof(curContentsLabel)-1 ); +	} +	if (barScale <= 0) { +		if (!isTrack) { +			barScale = size.y/(((double)hotBarHeight-2.0)/hotBarD.dpi); +		} else if (isTrack) { +			// size.y += 2.0 * trackGauge; +			barScale = (trackGauge>0.1)?trackGauge*(36-hotBarHeight/2):10.0; +			// barScale = 2.0 / ((hotBarHeight-2.0) / hotBarD.dpi); +			//if (size.y >= size.x) +			if (size.y/barScale > ((double)hotBarHeight-2.0)/hotBarD.dpi) { +				barScale = (size.y+2.0*trackGauge)/(((double)hotBarHeight-2.0)/hotBarD.dpi);  			} -			// orig.y += 1.0/hotBarD.dpi;  		} -		DYNARR_APPEND( hotBarMap_t, hotBarMap_da, 10 ); -		tbm = &hotBarMap(hotBarMap_da.cnt-1); -		if (barScale < 1) -			barScale = 1; -		if (size.x > barScale) -			 barScale = size.x; -		tbm->context = context; -		tbm->size = size; -		tbm->orig = orig; -		tbm->proc = proc_p; -		tbm->barScale = barScale; -		tbm->isFixed = isFixed; -		tbm->w = tbm->objectW = size.x/barScale + 5.0/hotBarD.dpi; -		tbm->labelW = 0; -		tbm->x = hotBarWidth; -		if ( hotBarLabels ) { -			DrawTextSize( &hotBarD, proc_p( HB_BARTITLE, context, NULL, NULL), hotBarFp, hotBarFs, FALSE, &textsize ); -			tbm->labelW = textsize.x+5/hotBarD.dpi; -			if ( tbm->labelW > tbm->w ) { -				tbm->w = tbm->labelW; -			} +		// orig.y += 1.0/hotBarD.dpi; +	} +	DYNARR_APPEND( hotBarMap_t, hotBarMap_da, 10 ); +	tbm = &hotBarMap(hotBarMap_da.cnt-1); +	if (barScale < 1) { +		barScale = 1; +	} +	if (size.x > barScale) { +		barScale = size.x; +	} +	tbm->context = context; +	tbm->size = size; +	tbm->orig = orig; +	tbm->proc = proc_p; +	tbm->barScale = barScale; +	tbm->isFixed = isFixed; +	tbm->w = tbm->objectW = size.x/barScale + 5.0/hotBarD.dpi; +	tbm->labelW = 0; +	tbm->x = hotBarWidth; +	if ( hotBarLabels ) { +		DrawTextSize( &hotBarD, proc_p( HB_BARTITLE, context, NULL, NULL), hotBarFp, +		              hotBarFs, FALSE, &textsize ); +		tbm->labelW = textsize.x+5/hotBarD.dpi; +		if ( tbm->labelW > tbm->w ) { +			tbm->w = tbm->labelW;  		} -		hotBarWidth += tbm->w + 2/hotBarD.dpi; +	} +	hotBarWidth += tbm->w + 2/hotBarD.dpi;  } @@ -490,10 +511,12 @@ static void ChangeHotBar( long changes )  #endif  	static long programModeOld = 0; -	if ( (changes&(CHANGE_SCALE|CHANGE_PARAMS|CHANGE_TOOLBAR)) == 0 ) +	if ( (changes&(CHANGE_SCALE|CHANGE_PARAMS|CHANGE_TOOLBAR)) == 0 ) {  		return; -	if ( hotBarLabels && !hotBarFp ) +	} +	if ( hotBarLabels && !hotBarFp ) {  		hotBarFp = wStandardFont( F_HELV, FALSE, FALSE ); +	}  	if (hotBarLeftB != NULL && curScaleName) {  		hotBarWidth = 0.0;  		hotBarMLcnt = 0; @@ -501,8 +524,9 @@ static void ChangeHotBar( long changes )  		DYNARR_RESET( hotBarMap_t, hotBarMap_da );  		curContentsLabel[0] = '\0';  		if ( programMode == MODE_DESIGN ) { -			if (showFlexTrack) +			if (showFlexTrack) {  				AddHotBarCornu(); +			}  			AddHotBarTurnouts();  			AddHotBarStructures();  		} else { @@ -513,8 +537,10 @@ static void ChangeHotBar( long changes )  			hotBarCurrSelects[0] = hotBarCurrSelects[1] = -1;  			programModeOld = programMode;  		} -		if (hotBarMap_da.cnt > 0 && (hotBarCurrStart >= hotBarMap_da.cnt||hotBarCurrStart < 0)) +		if (hotBarMap_da.cnt > 0 && (hotBarCurrStart >= hotBarMap_da.cnt +		                             ||hotBarCurrStart < 0)) {  			hotBarCurrStart = 0; +		}  		RedrawHotBar( NULL, NULL, 0, 0 );  	}  } @@ -542,28 +568,25 @@ EXPORT void LayoutHotBar( void * redraw )  	BOOL_T initialize = FALSE;  	wWinGetSize( mainW, &winWidth, &winHeight ); -	/** @prefs [Preference] LargeIcons=1.5 Sets Icon scaling limits 1.0 to 2.0 */ -	double scaleicon; -	wPrefGetFloat(PREFSECTION, LARGEICON, &scaleicon, 1.0); -	if (scaleicon<1.0) scaleicon=1.0; -	if (scaleicon>2.0) scaleicon=2.0; -	//if (scaleicon>1.0) { -	//	hotBarHeight = (wWinPix_t)(hotBarHeight); -	//} -	hotBarTextHeight = (wWinPix_t)round(wMessageGetHeight(0L) * (0.5 + (double)iconSize / 10.0)); +	hotBarTextHeight = (wWinPix_t)round(wMessageGetHeight(0L) * (0.6 + 0.4 * +	                                    (double)iconSize));  	if ( hotBarLabels) { -	   hbHeight += hotBarTextHeight; +		hbHeight += hotBarTextHeight;  	}  	if (hotBarLeftB == NULL) {  		wIcon_p bm_p; -		if (winWidth < 50) +		if (winWidth < 50) {  			return; +		}  		bm_p = wIconCreateBitMap( 16, 16, turnbarl_bits, wDrawColorBlack ); -		hotBarLeftB = wButtonCreate( mainW, 0, 0, "hotBarLeft", (char*)bm_p, BO_ICON|BO_REPEAT, 0, DoHotBarLeft, NULL ); +		hotBarLeftB = wButtonCreate( mainW, 0, 0, "hotBarLeft", (char*)bm_p, +		                             BO_ICON|BO_REPEAT, 0, DoHotBarLeft, NULL );  		bm_p = wIconCreateBitMap( 16, 16, turnbarr_bits, wDrawColorBlack ); -		hotBarRightB = wButtonCreate( mainW, 0, 0, "hotBarRight", (char*)bm_p, BO_ICON|BO_REPEAT, 0, DoHotBarRight, NULL ); -		hotBarD.d = wDrawCreate( mainW, 0, 0, NULL, BD_NOCAPTURE|BD_NOFOCUS, 100, hbHeight, NULL, RedrawHotBar, SelectHotBar ); +		hotBarRightB = wButtonCreate( mainW, 0, 0, "hotBarRight", (char*)bm_p, +		                              BO_ICON|BO_REPEAT, 0, DoHotBarRight, NULL ); +		hotBarD.d = wDrawCreate( mainW, 0, 0, NULL, 0, 100, +		                         hbHeight, NULL, RedrawHotBar, SelectHotBar );  		hotBarD.dpi = wDrawGetDPI( hotBarD.d );  		hotBarD.scale = 1.0;  		wSetCursor(hotBarD.d,wCursorNormal); @@ -571,19 +594,25 @@ EXPORT void LayoutHotBar( void * redraw )  	}  	buttonWidth = wControlGetWidth((wControl_p)hotBarLeftB);  	buttonHeight = wControlGetHeight((wControl_p)hotBarLeftB); -	wControlSetPos( (wControl_p)hotBarLeftB, HOTBAR_LEFT, toolbarHeight+(hbHeight-buttonHeight)/2 ); -	wControlSetPos( (wControl_p)hotBarRightB, winWidth-20-buttonWidth+HOTBAR_LEFT+1, toolbarHeight+(hbHeight-buttonHeight)/2 ); -	wControlSetPos( (wControl_p)hotBarD.d, buttonWidth+HOTBAR_LEFT+1, toolbarHeight ); +	wControlSetPos( (wControl_p)hotBarLeftB, HOTBAR_LEFT, +	                toolbarHeight+(hbHeight-buttonHeight)/2 ); +	wControlSetPos( (wControl_p)hotBarRightB, winWidth-20-buttonWidth+HOTBAR_LEFT+1, +	                toolbarHeight+(hbHeight-buttonHeight)/2 ); +	wControlSetPos( (wControl_p)hotBarD.d, buttonWidth+HOTBAR_LEFT+1, +	                toolbarHeight );  	wDrawSetSize( hotBarD.d, winWidth-20-buttonWidth*2, hbHeight+2, redraw ); -	hotBarD.size.x = ((double)(winWidth-20-buttonWidth*2))/hotBarD.dpi*hotBarD.scale; -	hotBarD.size.y = (double)hotBarHeight/hotBarD.dpi*hotBarD.scale;  //Exclude Label from calc +	hotBarD.size.x = ((double)(winWidth-20 +	                           -buttonWidth*2))/hotBarD.dpi*hotBarD.scale; +	hotBarD.size.y = (double) +	                 hotBarHeight/hotBarD.dpi*hotBarD.scale;  //Exclude Label from calc  	wControlShow( (wControl_p)hotBarLeftB, TRUE );  	wControlShow( (wControl_p)hotBarRightB, TRUE );  	wControlShow( (wControl_p)hotBarD.d, TRUE ); -	if (initialize) +	if (initialize) {  		ChangeHotBar( CHANGE_PARAMS ); -	else if (!redraw) +	} else if (!redraw) {  		RedrawHotBar( NULL, NULL, 0, 0 ); +	}  	toolbarHeight += hbHeight+3;  } | 
