void process_tuple(Tuple *t) { int key = t->key; int value = t->value->uint8; char string_value[256]; strcpy(string_value, t->value->cstring); switch(key) { case OK: if (value == 1) { load = true; layer_set_hidden((Layer *)slide_start, true); set_slide(0); } break; case CPU: strcat(cpu, string_value); text_layer_set_text(cpu_text_layer, (char *) &cpu); break; case MEMORY: strcat(memory, string_value); text_layer_set_text(memory_text_layer, (char *) &memory); break; case MEMORY_P: progress_bar_layer_set_value(memory_bar, value); break; case SWAP: strcat(swap, string_value); text_layer_set_text(swap_text_layer, (char *) &swap); break; case SWAP_P: progress_bar_layer_set_value(swap_bar, value); break; case SDCARD: strcat(sdcard, string_value); text_layer_set_text(sdcard_text_layer, (char *) &sdcard); break; case SDCARD_P: progress_bar_layer_set_value(root_bar, value); break; case NET: strcat(net, string_value); text_layer_set_text(network_text_layer, (char *) &net); break; case VERSION: strcat(version, string_value); text_layer_set_text(version_text_layer, (char *) &version); break; } }
void coup_mu_button( short m_x, short m_y, short breturn ) { short obj_x, obj_y ; /* object x and y return values */ short no_exit ; char names[60] ; /* string in which to format names */ coup_form.next_object = objc_find( coup_form.fm_ptr, ROOT, MAX_DEPTH, m_x, m_y ) ; if( coup_form.next_object == NIL ) { Bconout( 2, '\a' ) ; objc_edit( coup_form.fm_ptr, coup_form.edit_object, 0, &(coup_form.cursor_position), ED_END ) ; coup_form.edit_object = 0 ; } else { no_exit = form_button( coup_form.fm_ptr, coup_form.next_object, breturn, &(coup_form.next_object) ) ; if( !no_exit ) { coup_form.next_object &= ~DOUBLE_CLICK ; /* deselect object if it an exit button */ if( coup_form.fm_ptr[coup_form.next_object].ob_flags & EXIT ) coup_form.fm_ptr[coup_form.next_object].ob_state &= ~SELECTED ; switch( coup_form.next_object ) { case C_CANCEL : close_couple() ; break ; case C_OK : save_couple( edit_coup_ref, edit_coup_block, edit_coup_cptr ) ; close_couple() ; break ; case C_DELETE : if( q_del_coup( edit_coup_ref, edit_coup_block, edit_coup_cptr ) ) close_couple() ; else objc_draw( coup_form.fm_ptr, C_DELETE, MAX_DEPTH, ELTS( coup_form.fm_box ) ) ; break ; case C_HELP : help( marriage_help ) ; objc_draw( coup_form.fm_ptr, C_HELP, 0, ELTS( coup_form.fm_box ) ) ; break ; case MALE : if( male = get_person_reference( NULL, FALSE ) ) { names_only( male, names, 40, FALSE ) ; strcpy( c_form_addrs.male, names ) ; objc_draw( coup_form.fm_ptr, MALE, 0, (int) coup_form.fm_box.g_x,(int) coup_form.fm_box.g_y, (int) coup_form.fm_box.g_w, (int) coup_form.fm_box.g_h ) ; sprintf( c_form_addrs.m_ref, "%10d", male ) ; objc_draw( coup_form.fm_ptr, M_REF, 0, (int) coup_form.fm_box.g_x,(int) coup_form.fm_box.g_y, (int) coup_form.fm_box.g_w, (int) coup_form.fm_box.g_h ) ; } break ; case FEMALE : if( female = get_person_reference( NULL, FALSE ) ) { names_only( female, names, 40, FALSE ) ; strcpy( c_form_addrs.female, names ) ; objc_draw( coup_form.fm_ptr, FEMALE, 0, (int) coup_form.fm_box.g_x,(int) coup_form.fm_box.g_y, (int) coup_form.fm_box.g_w, (int) coup_form.fm_box.g_h ) ; sprintf( c_form_addrs.f_ref, "%10d", female ) ; objc_draw( coup_form.fm_ptr, F_REF, 0, (int) coup_form.fm_box.g_x,(int) coup_form.fm_box.g_y, (int) coup_form.fm_box.g_w, (int) coup_form.fm_box.g_h ) ; } break ; case WED_QUALIFIER : popup_date_qualifier( c_form_addrs.wed_qual, coup_form.fm_ptr, WED_QUALIFIER ) ; break ; case C_SOURCE : wind_form_do( &co_src_form, WF_SOURCE ) ; break ; case C_DIVORCE : wind_form_do( &divorce_form, DI_DATE ) ; break ; case PROG0 : case PROG1 : case PROG2 : case PROG3 : case PROG4 : case PROG5 : case PROG6 : case PROG7 : case PROG8 : case PROG9 : select_progeny( coup_form.next_object - PROG0, coup_form.fm_box ) ; break ; case C_SLIDER : prog_oset = move_slide( coup_form.fm_ptr, C_SLIDER, C_SLIDERANGE, &coup_form.fm_box ) ; prog_oset = 30 * prog_oset / 1000 ; update_progeny() ; objc_draw( coup_form.fm_ptr, PROGENY, MAX_DEPTH, (int) coup_form.fm_box.g_x, (int) coup_form.fm_box.g_y, (int) coup_form.fm_box.g_w, (int) coup_form.fm_box.g_h ) ; break ; case C_UP : if( prog_oset > 0 ) { prog_oset-- ; set_slide( prog_oset, 30, coup_form.fm_ptr, C_SLIDER, C_SLIDERANGE, &coup_form.fm_box ) ; update_progeny() ; objc_draw( coup_form.fm_ptr, PROGENY, MAX_DEPTH, (int) coup_form.fm_box.g_x, (int) coup_form.fm_box.g_y, (int) coup_form.fm_box.g_w, (int) coup_form.fm_box.g_h ) ; } break ; case C_DOWN : if( prog_oset < 30 ) { prog_oset++ ; set_slide( prog_oset, 30, coup_form.fm_ptr, C_SLIDER, C_SLIDERANGE, &coup_form.fm_box ) ; update_progeny() ; objc_draw( coup_form.fm_ptr, PROGENY, MAX_DEPTH, (int) coup_form.fm_box.g_x, (int) coup_form.fm_box.g_y, (int) coup_form.fm_box.g_w, (int) coup_form.fm_box.g_h ) ; } break ; case C_SLIDERANGE : objc_offset( coup_form.fm_ptr, C_SLIDER, &obj_x, &obj_y ) ; if( m_y > obj_y ) { prog_oset += 9 ; if( prog_oset > 30 ) prog_oset = 30 ; } else { prog_oset -= 9 ; if( prog_oset < 0 ) prog_oset = 0 ; } set_slide( prog_oset, 30, coup_form.fm_ptr, C_SLIDER, C_SLIDERANGE, &coup_form.fm_box ) ; update_progeny() ; objc_draw( coup_form.fm_ptr, PROGENY, MAX_DEPTH, (int) coup_form.fm_box.g_x, (int) coup_form.fm_box.g_y, (int) coup_form.fm_box.g_w, (int) coup_form.fm_box.g_h ) ; break ; default : #ifndef NDEBUG report( 0x300 + coup_form.next_object ) ; #endif break ; } } } change_edit_object( &coup_form, MU_BUTTON ) ; }
void up_click_handler(ClickRecognizerRef recognizer, void *context) { if (slide > 0 && load) { set_slide(--slide); } }
void down_click_handler(ClickRecognizerRef recognizer, void *context) { if (slide < 3 && load) { set_slide(++slide); } }
short select_exports( short *type_ptr ) { int oset = 0 ; /* slider offset in numbers of people */ short done = FALSE ; short fdone ; short export = FALSE ; short button ; short m_x, m_y ; short dummy ; short obj_x, obj_y ; Filter filter ; short i, flag ; match_refs = (int *) pmalloc( sizeof (int) * next_person ) ; pcross_refs = (int *) pmalloc( sizeof (int) * next_person ) ; ccross_refs = (int *) pmalloc( sizeof (int) * next_couple ) ; total_people = 0 ; for( i=1; i<next_person; i++ ) { if( people[i].birth_date != DELETED_DATE ) matches[total_people++] = i ; } exp_selected = (char *) pmalloc( total_people ) ; if( !exp_selected || !match_refs || !pcross_refs || !ccross_refs ) { rsrc_form_alert( 1, NO_MEMORY ) ; if( exp_selected ) free( exp_selected ) ; if( match_refs ) free( match_refs ) ; if( pcross_refs ) free( pcross_refs ) ; if( ccross_refs ) free( ccross_refs ) ; return FALSE ; } qsort( matches, (size_t) total_people, (size_t) 4, pidx_compare ) ; /* initialise match_refs as not all of array is used */ for( i=0; i<next_person; i++ ) match_refs[i] = -1 ; /* load array to get from reference to match position */ for( i=0; i<total_people; i++ ) match_refs[matches[i]] = i ; for( i=0; i<total_people; i++ ) exp_selected[i] = FALSE ; if( total_people > 16 ) { if( total_people < 256 ) esel_ptr[ES_SLIDER].ob_height = esel_ptr[ES_SLIDE_RANGE].ob_height * 16 / total_people ; else esel_ptr[ES_SLIDER].ob_height = esel_ptr[ES_SLIDE_RANGE].ob_height / 16 ; set_slide( 0, total_people-16, esel_ptr, ES_SLIDER, ES_SLIDE_RANGE, app_modal_box() ) ; } else { esel_ptr[ES_SLIDER].ob_height = esel_ptr[ES_SLIDE_RANGE].ob_height ; set_slide( 0, 1, esel_ptr, ES_SLIDER, ES_SLIDE_RANGE, app_modal_box() ) ; } list_exportees( oset ) ; app_modal_init( esel_ptr, "Export", TITLED ) ; while( !done ) { button = app_modal_do() ; button &= ~DOUBLE_CLICK ; if( button && button != APP_MODAL_TERM ) esel_ptr[button].ob_state &= ~SELECTED ; switch( button ) { case ES_SLIDER : if( total_people > 16 ) { oset = move_slide( esel_ptr, ES_SLIDER, ES_SLIDE_RANGE, app_modal_box() ) ; oset = ( total_people - 16 ) * oset / 1000 ; } list_exportees( oset ) ; objc_draw( esel_ptr, ES_LIST, MAX_DEPTH, PTRS( app_modal_box() ) ) ; break ; case ES_UP : if( total_people > 16 && oset > 0 ) { oset-- ; set_slide( oset, total_people-16, esel_ptr, ES_SLIDER, ES_SLIDE_RANGE, app_modal_box() ) ; } list_exportees( oset ) ; objc_draw( esel_ptr, ES_LIST, MAX_DEPTH, PTRS( app_modal_box() ) ) ; break ; case ES_DOWN : if( total_people > 16 && oset < total_people - 16 ) { oset++ ; set_slide( oset, total_people - 16, esel_ptr, ES_SLIDER, ES_SLIDE_RANGE, app_modal_box() ) ; } list_exportees( oset ) ; objc_draw( esel_ptr, ES_LIST, MAX_DEPTH, PTRS( app_modal_box() ) ) ; break ; case ES_SLIDE_RANGE : if( total_people > 16 ) { graf_mkstate( &m_x, &m_y, &dummy, &dummy ) ; objc_offset( esel_ptr, ES_SLIDER, &obj_x, &obj_y ) ; if( m_y > obj_y ) { oset += 15 ; if( oset > total_people - 16 ) oset = total_people - 16 ; } else { oset -= 15 ; if( oset < 0 ) oset = 0 ; } set_slide( oset, total_people-16, esel_ptr, ES_SLIDER, ES_SLIDE_RANGE, app_modal_box() ) ; } list_exportees( oset ) ; objc_draw( esel_ptr, ES_LIST, MAX_DEPTH, PTRS( app_modal_box() ) ) ; break ; case ESEL0 : case ESEL1 : case ESEL2 : case ESEL3 : case ESEL4 : case ESEL5 : case ESEL6 : case ESEL7 : case ESEL8 : case ESEL9 : case ESEL10 : case ESEL11 : case ESEL12 : case ESEL13 : case ESEL14 : case ESEL15 : if( esel_ptr[ANCESTORS].ob_state & SELECTED ) { ancestor_select( matches[button-ESEL0 + oset] ) ; esel_ptr[ANCESTORS].ob_state &= ~SELECTED ; esel_ptr[DESCENDANTS].ob_state &= ~SELECTED ; list_exportees( oset ) ; objc_draw( esel_ptr, ROOT, MAX_DEPTH, PTRS( app_modal_box() ) ) ; } else if( esel_ptr[DESCENDANTS].ob_state & SELECTED ) { descendant_select( matches[button-ESEL0 + oset], 0, 0 ) ; esel_ptr[DESCENDANTS].ob_state &= ~SELECTED ; list_exportees( oset ) ; objc_draw( esel_ptr, ROOT, MAX_DEPTH, PTRS( app_modal_box() ) ) ; } else { if( !exp_selected[button-ESEL0 + oset] ) { exp_selected[button-ESEL0 + oset] = TRUE ; esel_ptr[button].ob_state |= CHECKED ; } else { exp_selected[button-ESEL0 + oset] = FALSE ; esel_ptr[button].ob_state &= ~CHECKED ; } objc_draw( esel_ptr, button, MAX_DEPTH, PTRS( app_modal_box() ) ) ; } break ; case ES_SEL_ALL : for( i=0; i<total_people; i++ ) exp_selected[i] = TRUE ; list_exportees( oset ) ; objc_draw( esel_ptr, ES_LIST, MAX_DEPTH, PTRS( app_modal_box() ) ) ; objc_draw( esel_ptr, ES_SEL_ALL, MAX_DEPTH, PTRS( app_modal_box() ) ) ; break ; case ES_DSEL_ALL : for( i=0; i<total_people; i++ ) exp_selected[i] = FALSE ; list_exportees( oset ) ; objc_draw( esel_ptr, ES_LIST, MAX_DEPTH, PTRS( app_modal_box() ) ) ; objc_draw( esel_ptr, ES_DSEL_ALL, MAX_DEPTH, PTRS( app_modal_box() ) ) ; break ; case ES_FILTER : clear_efil_form() ; clear_form_flags() ; for( i = 0 ; i <= FL_NOT8 - FL_NOT1 ; i+= FL_NOT2 - FL_NOT1 ) { set_to_ignore(FL_NOT1+i) ; flags_ptr[FL_NOT1+i].ob_state |= SELECTED ; } fdone = FALSE ; /* loop until filter done */ while( !fdone ) { button = do_sub_form( efil_ptr, "Export Filter", EXP_HELP, TITLED ) ; switch( button ) { case EXP_SEL : case EXP_DESEL : busy( BUSY_MORE ) ; update_filter( &filter, efil_form_addrs.efam_name, efil_form_addrs.eforename, efil_form_addrs.ebefore, efil_form_addrs.eafter, efil_form_addrs.eplace ) ; if( button == EXP_DESEL ) flag = FALSE ; else flag = TRUE ; for( i=0; i<total_people; i++ ) { if( test_match( &filter, matches[i] ) ) exp_selected[i] = flag ; } busy( BUSY_LESS ) ; case EXP_CANCEL : fdone = TRUE ; break ; case EXP_FLAGS : do_sub_form( flags_ptr, "Filter Flags", FL_HELP, TITLED ) ; break ; } } list_exportees( oset ) ; break ; case ES_CANCEL : case APP_MODAL_TERM : done = TRUE ; break ; case ES_OK : export = TRUE ; done = TRUE ; break ; case ES_HELP : help( export_help ) ; objc_draw( esel_ptr, ES_HELP, 0, PTRS( app_modal_box() ) ) ; break ; default : break ; } } esel_ptr[ANCESTORS].ob_state &= ~SELECTED ; esel_ptr[DESCENDANTS].ob_state &= ~SELECTED ; if( esel_ptr[GEDCOM].ob_state & SELECTED ) *type_ptr = GEDCOM_TYPE ; else if( esel_ptr[CSV].ob_state & SELECTED ) *type_ptr = CSV_TYPE ; else *type_ptr = FAMTREE_TYPE ; app_modal_end() ; return export ; }