static void CPROC OnSliderUpdateProc(uintptr_t psv, PSI_CONTROL pc, int val) //Update current value { PSLIDER_INFO info = (PSLIDER_INFO)psv; // lprintf( "OnSliderUpdateProc: info=%X val=%d", info, val); if(!info) return; if( info->flags.skip_update ) return; { INDEX idx; struct my_button *button; LIST_FORALL( l.buttons, idx, struct my_button *, button ) { if( button->ID == info->ID ) { if( button->file ) ffmpeg_SeekFile( button->file, (uint64_t)val * 1000 ); } } } info->current = val; LabelVariableChanged( info->label ); }
void UpdatePositionCallback( uintptr_t psv, uint64_t tick ) { struct my_button *button = (struct my_button*)psv; if( button->slider ) { button->slider->flags.skip_update = 1; button->slider->current = tick/1000; SetSliderValues( button->slider->control, button->slider->min, (int)(tick / 1000), button->slider->max ); button->slider->flags.skip_update = 0; LabelVariableChanged( button->slider->label ); } }
static void CPROC CheckFiles( uintptr_t psv ) { INDEX idx; struct input_file *file; if( l.flags.bLog ) lprintf( WIDE("Check Files...") ); LIST_FORALL( l.files, idx, struct input_file*, file ) { FILE *input; static TEXTCHAR buf[256]; if( l.flags.bLog ) lprintf( WIDE("check %s"), file->filename ); input = sack_fopen( 0, file->filename, WIDE("rt") ); if( input ) { INDEX var_idx = 0; while( fgets( buf, sizeof( buf ), input ) ) { size_t end; struct variable_tracker *var =(struct variable_tracker*)GetLink( &file->vars, var_idx ); //lprintf( WIDE("buf .. %s"), buf ); while( ( end = strlen(buf) ) && ( buf[end-1] == '\n' ) ) buf[end-1] = 0; if( l.flags.bLog ) lprintf( WIDE("Content %p %s"), var, buf ); if( !var ) { TEXTCHAR tmp_name[128]; snprintf( tmp_name, sizeof( tmp_name ), WIDE("<File %s.%d>"), file->varname, var_idx+1 ); var = New( struct variable_tracker ); var->var_content = StrDup( buf ); var->var_name = StrDup( tmp_name ); lprintf( WIDE("Newvar %s=%s"), tmp_name, buf ); var->variable = CreateLabelVariable( tmp_name, LABEL_TYPE_STRING, &var->var_content ); SetLink( &file->vars, var_idx, var ); } else { if( StrCmp( var->var_content, buf ) ) { Release( var->var_content ); var->var_content = StrDup( buf ); lprintf( WIDE("Change var %s=%s"), var->var_name, buf ); LabelVariableChanged( var->variable ); } } var_idx++; } sack_fclose( input ); }