ino_t RelayConfigs::parse( const char* fname, ino_t prev ) { ino_t inode = 0; if ( fname != NULL ) { struct stat sbuf; if ( 0 == stat( fname, &sbuf ) ) { inode = sbuf.st_ino; if ( inode != prev ) { FILE* f = fopen( fname, "r" ); if ( f != NULL ) { fprintf( stderr, "config: reading from %s\n", fname ); char line[MAX_LINE]; for ( ; ; ) { if ( !fgets( line, sizeof(line), f ) ) { break; } int len = strlen( line ); if ( line[len-1] == '\n' ) { line[--len] = '\0'; } if ( len == 0 || line[0] == '#' ) { continue; } char* value = strchr( line, '=' ); if ( value == NULL ) { continue; } *value++ = '\0'; /* terminate "key" substring */ SetValueFor( line, value ); } fclose( f ); } } } } return inode; } /* parse */
void BChannelSlider::_MouseMovedCommon(BPoint point, BPoint point2) { float floatValue = 0; int32 limitRange = MaxLimitList()[fCurrentChannel] - MinLimitList()[fCurrentChannel]; float range = ThumbRangeFor(fCurrentChannel); if (fIsVertical) floatValue = range - (point.y - fMinPoint); else floatValue = range + (point.x - fMinPoint); int32 value = (int32)(floatValue / range * limitRange) + MinLimitList()[fCurrentChannel]; if (fAllChannels) SetAllValue(value); else SetValueFor(fCurrentChannel, value); if (ModificationMessage()) _FinishChange(true); _DrawThumbs(); }