comparison gui/win32/gui.c @ 36842:d8b2651bfeab

Remove unnecessary casts.
author ib
date Tue, 25 Feb 2014 16:12:33 +0000
parents eed2fb870f43
children 1078b8dd7625
comparison
equal deleted inserted replaced
36841:c659d33157e3 36842:d8b2651bfeab
627 627
628 rect_width = rd.right - rd.left; 628 rect_width = rd.right - rd.left;
629 rect_height = rd.bottom - rd.top; 629 rect_height = rd.bottom - rd.top;
630 630
631 /* maintain our aspect ratio */ 631 /* maintain our aspect ratio */
632 tmpheight = ((float)rect_width/video_aspect); 632 tmpheight = rect_width/video_aspect;
633 tmpheight += tmpheight % 2; 633 tmpheight += tmpheight % 2;
634 if(tmpheight > rect_height) 634 if(tmpheight > rect_height)
635 { 635 {
636 rect_width = ((float)rect_height*video_aspect); 636 rect_width = rect_height*video_aspect;
637 rect_width += rect_width % 2; 637 rect_width += rect_width % 2;
638 } 638 }
639 else rect_height = tmpheight; 639 else rect_height = tmpheight;
640 640
641 rd.right = rd.left + rect_width; 641 rd.right = rd.left + rect_width;
925 widget *item = gui->activewidget; 925 widget *item = gui->activewidget;
926 926
927 if(item->type == tyHpotmeter) 927 if(item->type == tyHpotmeter)
928 { 928 {
929 item->x = GET_X_LPARAM(lParam) - gui->mousewx; 929 item->x = GET_X_LPARAM(lParam) - gui->mousewx;
930 item->value = (float)((float)((item->x - item->wx) * 100.0f) / (float)(item->wwidth - item->width)); 930 item->value = ((item->x - item->wx) * 100.0f) / (float)(item->wwidth - item->width);
931 } 931 }
932 if(item->type == tyPotmeter) 932 if(item->type == tyPotmeter)
933 { 933 {
934 gui->mousewx = GET_X_LPARAM(lParam) - gui->activewidget->x; 934 gui->mousewx = GET_X_LPARAM(lParam) - gui->activewidget->x;
935 item->value = (float) (gui->mousewx * 100.0f) / (float) item->wwidth; 935 item->value = (gui->mousewx * 100.0f) / (float) item->wwidth;
936 } 936 }
937 937
938 if((item->type == tyPotmeter) || (item->type == tyHpotmeter) || (item->type == tyVpotmeter)) 938 if((item->type == tyPotmeter) || (item->type == tyHpotmeter) || (item->type == tyVpotmeter))
939 { 939 {
940 /* Bound checks */ 940 /* Bound checks */
942 item->value = 100.0f; 942 item->value = 100.0f;
943 else if(item->value < 0.0f) 943 else if(item->value < 0.0f)
944 item->value = 0.0f; 944 item->value = 0.0f;
945 945
946 if(item->msg == evSetVolume) 946 if(item->msg == evSetVolume)
947 guiInfo.Volume = (float) item->value; 947 guiInfo.Volume = item->value;
948 else if(item->msg == evSetMoviePosition) 948 else if(item->msg == evSetMoviePosition)
949 guiInfo.Position = (float) item->value; 949 guiInfo.Position = item->value;
950 else if(item->msg == evSetBalance) 950 else if(item->msg == evSetBalance)
951 { 951 {
952 /* make the range for 50% a bit bigger, because the sliders for balance usually suck */ 952 /* make the range for 50% a bit bigger, because the sliders for balance usually suck */
953 if((item->value - 50.0f < 1.5f) && (item->value - 50.0f > -1.5f)) 953 if((item->value - 50.0f < 1.5f) && (item->value - 50.0f > -1.5f))
954 item->value = 50.0f; 954 item->value = 50.0f;
955 guiInfo.Balance = (float) item->value; 955 guiInfo.Balance = item->value;
956 } 956 }
957 updatedisplay(gui, hWnd); 957 updatedisplay(gui, hWnd);
958 handlemsg(hWnd, item->msg); 958 handlemsg(hWnd, item->msg);
959 } 959 }
960 break; 960 break;