int inputInfoYesOrNo(int i) // 입력정보 선택 여부 확인 (입력값 i: 검색 or 수정 선택 변수) { int choice; // key: Yes or No 선택 변수 char input[2][5] = { "검색", "수정" }; while (1){ cursorOff(); textColor(16 * 10); gotoxy(0, 26); printf(" 위 정보로 %s하시겠습니까? 예 [→] 아니요 [←] ", input[i]); textColor(0); gotoxy(0, 27); choice = getche(); textColor(7); if (choice == 224){ choice = getch(); if (choice == 77){ gotoxy(43, 26); textColor(16 * 14 + 10); printf(" 예 [→] "); textColor(7); Sleep(TIME_OF_DELAY); cursorOn(); return 0; } else if (choice == 75){ gotoxy(55, 26); textColor(16 * 14 + 10); printf(" 아니요 [←] "); textColor(7); Sleep(TIME_OF_DELAY); cursorOn(); return -1; } else warningYesOrNo(); } else warningYesOrNo(); } return 0; }
// 7. 종료 함수 int saveCheck(void) // 종료 전 파일 저장 유무를 질문 (반환값: 입력여부) { int errorcheck = 0; while (1){ if (errorcheck != -1){ cursorOff(); textColor(16 * 10); gotoxy(0, 24); printf(" 수정한 내용을 저장하시겠습니까? 예 [→] 아니요 [←] "); textColor(7); errorcheck = checkSaveValue(); cursorOn(); if (errorcheck != -1) break; } else if (errorcheck == -1){ cursorOff(); textColor(16 * 10); gotoxy(0, 24); printf(" 수정한 내용을 저장하시겠습니까? 예 [→] 아니요 [←] "); warningYesOrNo(); textColor(7); errorcheck = checkSaveValue(); cursorOn(); if (errorcheck != -1) break; } } return errorcheck; }
void searchCancel(void) { cursorOff(); textColor(16 * 10); gotoxy(0, 26); printf(" < 회원정보 수정이 취소 되었습니다 > 아무 키나 누르세요 "); textColor(7); getch(); cursorOn(); }
int checkSaveValue(void) // 파일 저장 유무 시 유저가 입력한 값을 검증 { int choice; while (1){ gotoxy(0, 27); textColor(0); choice = getche(); textColor(7); if (choice == 224){ gotoxy(0, 27); textColor(0); choice = getch(); textColor(7); if (choice == 77){ gotoxy(43, 24); textColor(16 * 14 + 10); printf(" 예 [→] "); textColor(7); Sleep(TIME_OF_DELAY); cursorOn(); return 1; } else if (choice == 75){ gotoxy(55, 24); textColor(16 * 14 + 10); printf(" 아니요 [←] "); textColor(7); Sleep(TIME_OF_DELAY); cursorOn(); return 2; } else warningYesOrNo(); } else warningYesOrNo(); } return 0; }
void adjustInfoInputCellphone(Member_t *id, int i) { cursorOff(); textColor(16 * 10); gotoxy(0, 26); printf(" < 전화번호 수정이 완료 되었습니다 > 아무 키나 누르세요 "); textColor(7); getch(); cursorOn(); gotoxy(0, 16); lineClear(); gotoxy(0, 17); lineClear(); gotoxy(0, 18); lineClear(); gotoxy(0, 26); lineClear(); gotoxy(0, 28); lineClear(); case4PrintInfo(id, i); }
void adjustInfoInputStudentID(Member_t *id, int IDnum, int i) { id[i].Studentnum = IDnum; cursorOff(); textColor(16 * 10); gotoxy(0, 26); printf(" < 학번 수정이 완료 되었습니다 > 아무 키나 누르세요 "); textColor(7); getch(); cursorOn(); gotoxy(0, 16); lineClear(); gotoxy(0, 17); lineClear(); gotoxy(0, 18); lineClear(); gotoxy(0, 26); lineClear(); gotoxy(0, 28); lineClear(); case4PrintInfo(id, i); }
void case4PrintInfo(Member_t *id, int i) { if (i == -1){ textColor(12); gotoxy(21, 7); printf("검색한 정보가 존재하지 않습니다!"); cursorOff(); textColor(12 * 16); gotoxy(0, 28); printf(" Warning: 존재하지 않는 회원정보를 검색했습니다 (아무키나 누르세요) "); textColor(7); getch(); cursorOn(); } else{ textColor(15); gotoxy(12, 5); printf("① 학번 : %d", id[i].Studentnum); gotoxy(12, 7); printf("② 이름 : %s", id[i].Name); gotoxy(12, 9); printf("③ 주소 : %s", id[i].Address); gotoxy(12, 11); printf("④ 전화번호 : %s", id[i].Cellphone); textColor(7); } }
int repeatStudentIDCheck(Member_t *id, int IDnum) { int i; // for 문을 위한 변수 i for (i = 1; id[i].Studentnum != 0; i++){ if (id[i].Studentnum == IDnum){ cursorOff(); textColor(12 * 16); gotoxy(0, 28); printf(" Warning: 기존 회원과 중복되는 학번입니다 (아무키나 누르세요) "); textColor(7); getch(); cursorOn(); gotoxy(0, 16); lineClear(); gotoxy(0, 17); lineClear(); gotoxy(0, 18); lineClear(); gotoxy(0, 26); lineClear(); gotoxy(0, 28); lineClear(); IDnum = -1; break; } } return IDnum; }
void Wactivate_mouse(int (*move)(), int (*button)(), int (*quit)() ) { if (mouseReturn) { int (*tempFunc)(); tempFunc = mouseReturn; mouseReturn = NULL; /* Null out return function */ (*tempFunc)(); } mouseMove = move; mouseButton = button; mouseReturn = quit; isJMouse = 0; TPRINT3("Wactivate_mouse move=0x%x button=0x%x quit=0x%x\n" ,move,button,quit); #ifdef VNMRJ writelineToVnmrJ("mouse", "on"); #else cursorOn(MOUSE); /* turn cursor on */ /* positionCursor(300,300); */ #endif mouseIsActive = 1; }
void Jactivate_mouse(int (*drag)(), int (*pressRelease)(), int (*click)(), int (*gen)(), int (*quit)()) { if (aip_opened > 0) { if (aip_mouseReturn) { int (*tempFunc)(); tempFunc = aip_mouseReturn; aip_mouseReturn = NULL; /* Null out return function */ (*tempFunc)(); } aip_mouseMove = drag; aip_mouseButton = pressRelease; aip_mouseClick = click; aip_mouseGeneral = gen; aip_mouseReturn = quit; } else { if (mouseReturn) { int (*tempFunc)(); tempFunc = mouseReturn; mouseReturn = NULL; /* Null out return function */ (*tempFunc)(); } mouseMove = drag; mouseButton = pressRelease; mouseClick = click; mouseGeneral = gen; mouseReturn = quit; } cursorOn(MOUSE); /* turn cursor on */ curButton = 0; mouseIsActive = 1; isJMouse = 1; aspMouse = 1; #ifdef VNMRJ writelineToVnmrJ("mouse", "on"); #endif }
void Wactivate_buttons(int number, char *name[], PFI cmd[], PFI returnRoutine, char *menuname) { int i; TPRINT0("Wactivate_buttons: starting\n"); if (MAX_NUM_BUTS < number) { Werrprintf("Limit of %d buttons please",MAX_NUM_BUTS); return; } Wturnoff_buttonsCalled = OFF; /* do not clear buttons anymore */ clearFuncs(); /* null out previous functions */ /* erase existing buttons */ linelength = 80; header[0] = '\0'; for (i=0;i<number;i++) { TPRINT2("Wactivate_buttons:i=%d adding %s\n",i,name[i]); funcs[i] = cmd[i]; /* store function address */ if (linelength - (int) strlen(name[i]) - 2 < 0) { Werrprintf("adding %s but only %d left, buttons would run off page", name[i],linelength); return; } } if (menu_changed(number,name) ) { if (Wissun()) sendButtonToMaster( 0, NULL ); #ifndef VNMRJ else Wclearpos(1,1,1,80); /* clear top status line */ #endif for (i=0;i<number;i++) setUpFun(name[i],i); #ifdef VNMRJ sendButtonToMaster( -2, "doneButtons" ); /* button display complete */ #endif } returnFunc = returnRoutine; /* pointer to return function */ #ifndef VNMRJ if (Wisgraphon() || Wishds() || Wistek()) /* if we have terminal, print out header */ Wprintfpos(1,1,1,"%s",header); #endif /* last argument is the name of a help file. Lets make a copy */ strncpy(help_name,menuname,HELP_NAME_LEN); help_name[HELP_NAME_LEN-1] = '\0'; #ifdef DEBUG if (Tflag) { int i; for (i=0; i<number; i++) TPRINT2("name=%s func = 0x%x\n",name[i],funcs[i]); TPRINT1("return address is 0x%x\n",returnFunc); TPRINT1("help file name is %s\n",help_name); } #endif buttons_active = num_but = number; #ifndef VNMRJ cursorOn(BUTTONS); #endif }