+ Event_Viewer_Data->current_event_index = Event_Viewer_Data->start_event_index;
+ get_events(Event_Viewer_Data, start, end, maxNum, &size);
+ Event_Viewer_Data->start_event_index = Event_Viewer_Data->current_event_index;
+
+ if(size < minNum && (start.tv_sec !=0 || start.tv_nsec !=0))
+ needBackwardAgain = TRUE;
+ else needBackwardAgain = FALSE;
+ if(size == 0){
+ count++;
+ }else{
+ count = 0;
+ }
+ }while(needBackwardAgain);
+ }
+ if(direction == SCROLL_STEP_UP)
+ Event_Number = Event_Viewer_Data->start_event_index - 1;
+ else
+ Event_Number = Event_Viewer_Data->start_event_index - List_Height;
+ break;
+ case SCROLL_STEP_DOWN:
+ if(Event_Viewer_Data->end_event_index == Event_Viewer_Data->Number_Of_Events - 1){
+ Event_Viewer_Data->append = TRUE;
+ first = Event_Viewer_Data->raw_trace_data_queue->head;
+ raw_data = (RawTraceData*)g_list_nth_data(first,Event_Viewer_Data->Number_Of_Events - 1);
+ start = raw_data->time;
+ start.tv_nsec++;
+ end.tv_sec = G_MAXULONG;
+ end.tv_nsec = G_MAXULONG;
+ get_events(Event_Viewer_Data, start, end, RESERVE_SMALL_SIZE, &size);
+ }else size = 1;
+ if(size > 0) Event_Number = Event_Viewer_Data->start_event_index + 1;
+ else Event_Number = Event_Viewer_Data->start_event_index;
+ break;
+ case SCROLL_PAGE_DOWN:
+ if(Event_Viewer_Data->end_event_index >= Event_Viewer_Data->Number_Of_Events - 1 - List_Height){
+ Event_Viewer_Data->append = TRUE;
+ first = Event_Viewer_Data->raw_trace_data_queue->head;
+ raw_data = (RawTraceData*)g_list_nth_data(first,Event_Viewer_Data->Number_Of_Events - 1);
+ start = raw_data->time;
+ start.tv_nsec++;
+ end.tv_sec = G_MAXULONG;
+ end.tv_nsec = G_MAXULONG;
+ get_events(Event_Viewer_Data, start, end, RESERVE_SMALL_SIZE,&size);
+ }
+ if(List_Height <= Event_Viewer_Data->Number_Of_Events - 1 - Event_Viewer_Data->end_event_index)
+ Event_Number = Event_Viewer_Data->start_event_index + List_Height - 1;
+ else
+ Event_Number = Event_Viewer_Data->Number_Of_Events - 1 - List_Height;
+ break;
+ case SCROLL_JUMP:
+ Event_Viewer_Data->append = TRUE;
+ remove_all_items_from_queue(Event_Viewer_Data->raw_trace_data_queue);
+ end.tv_sec = G_MAXULONG;
+ end.tv_nsec = G_MAXULONG;
+ start = Event_Viewer_Data->time_span.startTime;
+ value = (int)(time_value / NANSECOND_CONST);
+ start.tv_sec += value;
+ value = time_value / NANSECOND_CONST - value;
+ value *= NANSECOND_CONST;
+ start.tv_nsec += value;
+ if(start.tv_nsec > NANSECOND_CONST){
+ start.tv_sec++;
+ start.tv_nsec -= NANSECOND_CONST;
+ }
+ Event_Viewer_Data->previous_value = time_value;
+ get_events(Event_Viewer_Data, start, end, RESERVE_SMALL_SIZE,&size);
+ if(size < List_Height){
+ Event_Viewer_Data->append = FALSE;
+ first = Event_Viewer_Data->raw_trace_data_queue->head;
+ raw_data = (RawTraceData*)g_list_nth_data(first,0);
+ end = raw_data->time;
+ end.tv_nsec--;
+ ltt_event_position_get(&raw_data->ep, &block_num, &event_num, &tf);
+
+ if(event_num > List_Height - size){
+ backward_num = event_num > RESERVE_SMALL_SIZE
+ ? event_num - RESERVE_SMALL_SIZE : 1;
+ ltt_event_position_set(&raw_data->ep, block_num, backward_num);
+ ltt_tracefile_seek_position(tf, &raw_data->ep);
+ ev = ltt_tracefile_read(tf);
+ start = ltt_event_time(ev);
+ maxNum = G_MAXULONG;
+ Event_Viewer_Data->current_event_index = 0;
+ get_events(Event_Viewer_Data, start, end, maxNum, &size);
+ Event_Viewer_Data->start_event_index = Event_Viewer_Data->current_event_index;
+ }
+ Event_Number = Event_Viewer_Data->raw_trace_data_queue->length - List_Height;
+ }else{
+ Event_Number = 0;
+ }
+ break;
+ case SCROLL_NONE:
+ Event_Number = Event_Viewer_Data->current_event_index;
+ break;
+ default:
+ break;
+ }