comparison mac/dw.m @ 923:0ac67b62b594

Fix int to double conversion issues causing scrollbar issues on Mac. Use double internally for all calculations...only cast to int when talking to the API.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Fri, 22 Apr 2011 11:43:30 +0000
parents 07f9a73c6847
children 8a8d2699bd09
comparison
equal deleted inserted replaced
922:07f9a73c6847 923:0ac67b62b594
1071 -(float)visible { return visible; } 1071 -(float)visible { return visible; }
1072 -(void)setRange:(float)input1 andVisible:(float)input2 { range = input1; visible = input2; } 1072 -(void)setRange:(float)input1 andVisible:(float)input2 { range = input1; visible = input2; }
1073 -(void)scrollerChanged:(id)sender 1073 -(void)scrollerChanged:(id)sender
1074 { 1074 {
1075 double proportion = [self knobProportion]; 1075 double proportion = [self knobProportion];
1076 int page = (int)(proportion * range); 1076 double page = (proportion * range);
1077 int max = (int)(range - page); 1077 double max = (range - page);
1078 int result = (int)([self doubleValue] * max); 1078 double result = ([self doubleValue] * max);
1079 int newpos = result; 1079 double newpos = result;
1080 1080
1081 switch ([sender hitPart]) 1081 switch ([sender hitPart])
1082 { 1082 {
1083 1083
1084 case NSScrollerDecrementLine: 1084 case NSScrollerDecrementLine:
1114 default: 1114 default:
1115 ; /* do nothing */ 1115 ; /* do nothing */
1116 } 1116 }
1117 if(newpos != result) 1117 if(newpos != result)
1118 { 1118 {
1119 double newposd = (double)newpos/max; 1119 [self setDoubleValue:(newpos/max)];
1120 [self setDoubleValue:newposd]; 1120 }
1121 } 1121 _event_handler(self, (void *)(int)newpos, 14);
1122 _event_handler(self, (void *)newpos, 14);
1123 } 1122 }
1124 -(void)dealloc { UserData *root = userdata; _remove_userdata(&root, NULL, TRUE); [super dealloc]; } 1123 -(void)dealloc { UserData *root = userdata; _remove_userdata(&root, NULL, TRUE); [super dealloc]; }
1125 @end 1124 @end
1126 1125
1127 /* Subclass for a render area type */ 1126 /* Subclass for a render area type */