void user_interface( ){ // window dimensions int maxX, maxY, cursor = 0; // iterate until its time to exit while( true ){ // get the window size maxX = getmaxx(stdscr); maxY = getmaxy(stdscr); // clear the screen clear(); // print the header print_header("Task Listing", maxX); // print the table print_table( maxX, maxY, 4 , cursor); // print the footer print_footer( GUI, maxX, maxY ); // get the input int arg = getch(); // exit the program if( arg == 27 ) break; // create a new task else if( arg == 'c' || arg == 'C' ){ create_task( ); } // view the selected task else if( arg == 'V' || arg == 'v' ){ view_task( ); } // move the cursor up else if( arg == KEY_UP ){ cursor--; if( cursor < 0 ){ cursor = options.tasks.size()-1; } } // move the cursor down else if( arg == KEY_DOWN ){ cursor++; if( cursor >= options.tasks.size() ) cursor = 0; } } }
static gboolean show_task(TraceViewStore *store, struct pevent *pevent, struct record *record, gint pid) { gint event_id; if (view_task(store, pid)) return TRUE; event_id = pevent_data_type(pevent, record); if (store->sched_switch_next_field && event_id == store->sched_switch_event->id) { /* show sched switch to task */ pid = get_next_pid(store, pevent, record); if (view_task(store, pid)) return TRUE; } if (store->sched_wakeup_pid_field && event_id == store->sched_wakeup_event->id) { /* show sched switch to task */ pid = get_wakeup_pid(store, pevent, record); if (view_task(store, pid)) return TRUE; } if (store->sched_wakeup_new_pid_field && event_id == store->sched_wakeup_new_event->id) { /* show sched switch to task */ pid = get_wakeup_new_pid(store, pevent, record); if (view_task(store, pid)) return TRUE; } return FALSE; }
void key_tasklist_view() /* {{{ */ { /* run task info on a task and display in pager */ view_task(get_task_by_position(selline)); } /* }}} */