char* read_indi(int *individual_count, char *line, FILE *fp, Individual *individuals) { char *ptr, name[80]; individuals[*individual_count].INDI = get_ID(line); while((ptr = fgets(line, 1000, fp)) != NULL && line[0] != '0') { if((ptr = strstr(line, "NAME")) != NULL) { strtok(ptr, "\r /"); name[0] = '\0'; ptr = strtok(NULL, " /\n\r"); if(ptr) strcpy(name, ptr); while((ptr = strtok(NULL, " /\n\r")) != NULL) sprintf(name, "%s %s", name, ptr); individuals[*individual_count].NAME = (char*) malloc(strlen(name) + 1); strcpy(individuals[*individual_count].NAME, name); } // if a NAME tagged line else // not NAME if(strstr(line, "FAMC")) individuals[*individual_count].FAMC = get_ID(line); else if(strstr(line, "FAMS")) individuals[*individual_count].FAMS = get_ID(line); } // while more in the record (*individual_count)++; return ptr; } // read_indi()
void J_Text_Box::broadcast_current_state()const{ J_UI_Box::broadcast_current_state(); s_ui_model->notify_text_string(get_ID(), M_multi_string); s_ui_model->notify_clickable_status(get_ID(), clickable_status()); s_ui_model->notify_text_cursor(get_ID(), M_cursor_pos); s_ui_model->notify_text_cursor_color(get_ID(), M_cursor_color); }
void SWTypeExt::ExtData::LoadFromRulesFile(CCINIClass *pINI) { auto pThis = this->OwnerObject(); const char * section = pThis->get_ID(); if(!pINI->GetSection(section)) { return; } INI_EX exINI(pINI); if(exINI.ReadString(section, "Action") && !_strcmpi(exINI.value(), "Custom")) { pThis->Action = Actions::SuperWeaponAllowed; } if(exINI.ReadString(section, "Type")) { auto customType = NewSWType::FindIndex(exINI.value()); if(customType > SuperWeaponType::Invalid) { pThis->Type = customType; } } // find a NewSWType that handles this original one. if(this->IsOriginalType()) { this->HandledByNewSWType = NewSWType::FindHandler(pThis->Type); } // if this is handled by a NewSWType, initialize it. if(auto pNewSWType = this->GetNewSWType()) { pThis->Action = Actions::SuperWeaponAllowed; pNewSWType->Initialize(this, pThis); } this->LastAction = pThis->Action; }
void J_Text_Box::set_cursor_pos(j_size_t i_cursor_pos){ assert(between_inclusive(i_cursor_pos, J_SIZE_T_ZERO, M_multi_string.size())); M_cursor_pos = i_cursor_pos; s_ui_model->notify_text_cursor(get_ID(), M_cursor_pos); set_cursor_on(); }
void J_Text_Box::set_string(const J_UI_String& irk_string){ M_multi_string = J_UI_Multi_String(irk_string); s_ui_model->notify_text_string(get_ID(), irk_string); set_cursor_on(); M_cursor_pos = static_cast<int>(irk_string.size()); }
void J_Text_Box::delete_char(){ if(M_multi_string.size() == M_cursor_pos){ return; } M_multi_string.erase(M_cursor_pos,1); s_ui_model->notify_char_delete(get_ID(), M_cursor_pos); set_cursor_on(); }
bool J_Text_Box::insert_char(J_UI_Char i_char){ M_multi_string.insert(M_cursor_pos, i_char); s_ui_model->notify_char_add(get_ID(), M_cursor_pos, i_char); move_cursor(1); set_cursor_on(); return true; }
void J_Text_Box::backspace(){ if(0 == M_cursor_pos){ return; } M_multi_string.erase(--M_cursor_pos, 1); s_ui_model->notify_char_delete(get_ID(), M_cursor_pos); set_cursor_on(); }
void J_Text_Box::update(){ j_dbl time = j_get_time(); if((time - M_last_cursor_switch) > M_cursor_switch_time){ //cerr << '\n' << time << " Last Cursor: " << M_last_cursor_switch << " Switch Time: " << M_cursor_switch_time; J_Color_RGBA<j_float> color = !M_curser_on_switch ? M_cursor_color : J_Color::Clear; s_ui_model->notify_text_cursor_color(get_ID(), color); M_curser_on_switch = !M_curser_on_switch; M_last_cursor_switch = time; } }
char* read_family(int *family_count, char *line, FILE *fp, Family *families) { char *ptr; families[*family_count].FAM = get_ID(line); while((ptr = fgets(line, 1000, fp)) != NULL && line[0] != '0') { if(strstr(line, "HUSB")) families[*family_count].HUSB = get_ID(line); if(strstr(line, "WIFE")) families[*family_count].WIFE = get_ID(line); if(strstr(line, "CHIL")) add_child(line, &families[*family_count]); } // while more in record (*family_count)++; return ptr; } // read_indi()
void J_Text_Box::move_cursor(j_size_t i_amt){ j_size_t new_cursor = M_cursor_pos + i_amt; if(new_cursor < 0){ M_cursor_pos = 0; }else if(new_cursor > M_multi_string.size()){ M_cursor_pos = static_cast<int>(M_multi_string.size()); }else{ M_cursor_pos = new_cursor; } s_ui_model->notify_text_cursor(get_ID(), M_cursor_pos); set_cursor_on(); }
void add_child(char *line, Family *family) { int i; char **temp; temp = (char**) malloc((family->chil_count + 1) * sizeof(char*)); for(i = 0; i < family->chil_count; i++) temp[i] = family->CHILs[i]; temp[i] = get_ID(line); free(family->CHILs); family->CHILs = temp; family->chil_count++; } // add_child()
int getBlock_Int(){ // block 4: SondeID, internalTemp, battery unsigned byte; unsigned checksum; int chk = 0; byte = check16(frame_bytes+pos_chkInt-21, 21); checksum = (frame_bytes[pos_chkInt]<<8) | frame_bytes[pos_chkInt+1]; if (byte != checksum) chk |= (0x1 << 4); get_ID(); //if (option_verbose) get_Sensors2(); return chk; }
int set_MENU(vm_t *vm, int menu) { assert((vm->state).domain == DVD_DOMAIN_VMGM || (vm->state).domain == DVD_DOMAIN_VTSMenu); return set_PGCN(vm, get_ID(vm, menu)); }
void J_Text_Box::set_cursor_color(const J_Color_RGBA<j_float> i_color){ M_cursor_color = i_color; set_cursor_on(); s_ui_model->notify_text_cursor_color(get_ID(), i_color); }
void J_Text_Box::change_color_at_pos(int i_pos, J_UI_Color i_color){ M_multi_string.get_string_holding_index(i_pos)->set_color(i_color); s_ui_model->notify_text_string(get_ID(), M_multi_string); }
void J_Text_Box::set_cursor_on(){ j_dbl time = j_get_time(); M_curser_on_switch = true; M_last_cursor_switch = time- M_cursor_switch_time*0.5; s_ui_model->notify_text_cursor_color(get_ID(), M_cursor_color); }
/*void erase_chars(int pos, int size)*/ void J_Text_Box::erase_chars(j_size_t i_pos, j_size_t i_size){ set_cursor_pos(i_pos); M_multi_string.erase(i_pos, i_size); s_ui_model->notify_erase_chars(get_ID(), M_cursor_pos, i_size); }