Exemple #1
0
	/**
	 * エラーチェックをする(表示もする)
	 */
	void Test_error_check()
	{
	  int count = 0;
	  int i;
	  Examination * examination2;
	  Test * test2 = Test_get_test();
	  
	  err_start();
	  
	  while(count <= test.y){
	    term_clear();
	    
	    Test_disp_info(ERR_MESS_X+2, ERR_MESS_Y);
	    
	    term_gotoxy(ERR_MESS_X, ERR_MESS_Y+2);
	    term_rev_disp(ref("errchk_message"));
	    
	    Intprt_disp_guide(&test.intprt);
	    
	    //エラー結果を表示する
	    for (i=0; i < ref_i("err_correct_line") && count <= test.y; i++, count++){
	      term_gotoxy(ERR_DISP_X, ERR_DISP_Y+i*4);
	      term_disp(test.text_buf[count % test.text_no]);
	      term_gotoxy(ERR_DISP_X, ERR_DISP_Y+i*4+1);
	      term_disp(test.typed[count]);
	      term_gotoxy(ERR_DISP_X, ERR_DISP_Y+i*4+2);
	      term_disp(err_check(test.text_buf[count % test.text_no],
				  test.typed[count]));
	    }
	    
	    //HIDE_MODEでなければ誤字結果の詳細を表示する
	    examination2 = &(test2->examination);
		if(examination2->mode  == EXAM_MODE){//本番モードの場合
	      if(HIDE_ERR_MODE_EX==0){//エラーチェック画面を表示する
    	    Intprt_long_pause_core(&test.intprt, ref("long_pause_message_test"), FALSE);
	      }
	    }else{//練習モードの場合
	      if(HIDE_ERR_MODE_PRA==0){//エラーチェック画面を表示する
        	Intprt_long_pause_core(&test.intprt, ref("long_pause_message_test"), FALSE);
	      }
	    }
	    if (!test.intprt.status){
	      return;
	    }
	  }
	}
Exemple #2
0
/**
 * エラー表示し 終了する
 */
void term_error( char* message){

    term_gotoxy(0, 24);
    term_end();

    term_disp(message);
    kanji_out();

    exit(1);
}
Exemple #3
0
	/**
	 * 試験開始前の画面を表示する.
	 */
	void Test_begin()
	{
	  term_clear();
	  
	  term_gotoxy(ref_i("begin_x"),ref_i("begin_y"));
	  term_disp(ref("test_start_message"));
	  
	  Intprt_disp_guide(&test.intprt);
	  
	  Intprt_pause_core(&test.intprt, ref("test_pause_message"), FALSE);
	}
Exemple #4
0
void term_end()
{
#ifdef UNIX
#ifdef CURSES
    endwin();
#else
    system("stty -raw");
    system("stty echo");
#endif
#endif
    term_disp("\n\n");
}
Exemple #5
0
	/**
	 * タイピングの問題文を表示する
	 */
	void Test_disp_text()
	{
	  int tmp;
	  if (test.y < SCROLL_LINE){
	    tmp = TEST_Y + test.y * 2;
	  } else {
	    tmp = TEST_Y + SCROLL_LINE * 2 - 2;
	    term_scroll_up(TEST_X, TEST_Y, TEST_WIDTH, TEST_HEIGHT);
	    term_scroll_up(TEST_X, TEST_Y, TEST_WIDTH, TEST_HEIGHT);
	  }
	  
	  term_gotoxy(TEST_X, tmp);
	  term_disp(test.text_buf[test.y % test.text_no]);
	  if (ref_i("cursor")){
	    term_gotoxy(TEST_X, tmp+1);
	  } else {
	    term_gotoxy(0,0);
	  }
	}
Exemple #6
0
void term_center_disp(char *str, int y)
{
    term_gotoxy((TERM_W-strlen(str))/2, y);
    term_disp(str);
}
Exemple #7
0
void term_rev_disp( char* str)
{
    term_reverse(TRUE);
    term_disp(str);
    term_reverse(FALSE);
}
Exemple #8
0
	/**
	 * タイピングの結果を表示する.
	 */
	void Test_result()
	{
	  char buf[MAXSTRLEN];
	  int writeResult = TRUE;
	  Examination * examination2;
	  Test * test2 = Test_get_test();
	  
	  //合格情報を記録する for typingtestex拡張
	  Examination_writePassInfoAndShowResult(&(test.examination), &(test.user));
	 
	  term_clear();
	  
	  Test_disp_info(RESULT_X+2, RESULT_Y);
	  
	  term_gotoxy(RESULT_X, RESULT_Y+1);
	  term_rev_disp(ref("result_message"));
	  
	  //合否を表示
	  term_gotoxy(RESULT_X + 5, RESULT_Y + 3);
	  term_disp(ref("exam_result"));
	  if(exam_result(typing_second)==TRUE){    
	    term_disp(ref("pass_message"));
	  }else{
	    term_disp(ref("fail_message"));
	  }    
	  
	  //試験日を表示
	  term_gotoxy(RESULT_X + 5, RESULT_Y + 4);
	  term_disp(ref("exam_date"));
	  get_date(buf);
	  term_disp(buf);
	  
	  //タイピング時間を表示
	  term_gotoxy(RESULT_X + 5, RESULT_Y + 5);
	  term_disp(ref("typing_time"));
	  sprintf(buf, "%d ", typing_second);
	  term_disp(buf);
	  term_disp(ref("second_message"));
	  
	  //端末名を表示
	  term_gotoxy(RESULT_X + 5, RESULT_Y + 6);
	  term_disp(ref("machine_name"));
	  get_hostname(buf);
	  term_disp(buf);
	  
	  //正打鍵数を表示    
	  term_gotoxy(RESULT_X + 5, RESULT_Y + 7);
	  term_disp(ref("correct_type"));
	  sprintf(buf, "%d ", err_correct_type());
	  term_disp(buf);
	  term_disp(ref("word_message"));
	  
	  //ミスタッチ数を表示    
	  term_gotoxy(RESULT_X + 5, RESULT_Y + 8);
	  term_disp(ref("miss_count"));
	  sprintf(buf, "%d ", err_error_type());
	  term_disp(buf);
	  term_disp(ref("word_message"));
	  
	  //1分あたりの正しいタッチ数を表示    
	  term_gotoxy(RESULT_X + 5, RESULT_Y + 9);
	  term_disp(ref("correct_type_per_min"));
	  sprintf(buf, "%d ", correct_type_per_min(typing_second));
	  term_disp(buf);
	  term_disp(ref("per_min_message"));
	  
	  
	  //テキスト情報のタイトル表示
	  term_gotoxy(RESULT_X, RESULT_Y + 11);
	  term_rev_disp(ref("exam_info_message"));
	  
	  //問題名を表示
	  term_gotoxy(RESULT_X + 5, RESULT_Y + 13);
	  term_disp(ref("exam_title"));
	  term_disp(ref("title"));
	  
	  //最大誤字数
	  term_gotoxy(RESULT_X + 5, RESULT_Y + 14);
	  term_disp(ref("max_error_type_msg"));
	  term_disp(ref("max_error_type"));
	  term_disp(ref("word_message"));
	  
	  //制限時間
	  term_gotoxy(RESULT_X + 5, RESULT_Y + 15);
	  term_disp(ref("time_limit_msg"));
	  term_disp(ref("time_limit"));
	  term_disp(ref("second_message"));
	  
	  //テキスト総文字数
	  term_gotoxy(RESULT_X + 5, RESULT_Y + 16);
	  term_disp(ref("text_length_msg"));
	  term_disp(ref("total_text_length"));
	  term_disp(ref("word_message"));
	  
	  Intprt_disp_guide(&test.intprt);
	  
	  //次の画面遷移のメッセージを表示する
	  examination2 = &(test2->examination);
	  if(examination2->mode  == EXAM_MODE){//本番モードの場合
	    if(HIDE_ERR_MODE_EX){  
	      Intprt_pause_core(&test.intprt, ref("result_end_message"), FALSE);
	    }else{
      	  Intprt_pause_core(&test.intprt, ref("go_error_check_message"), FALSE);
	    }
	  }else{//練習モードの場合
	    if(HIDE_ERR_MODE_PRA){
	      Intprt_pause_core(&test.intprt, ref("result_end_message"), FALSE);
	    }else{
     	  Intprt_pause_core(&test.intprt, ref("go_error_check_message"), FALSE);
	    }
	  }
	}
Exemple #9
0
	/**
	 * タイピングを始めた時の処理
	 */
	void Test_typing()
	{
	  Bool cursor = ref_i("cursor");
	  Bool esc_begin = FALSE;//ESCシーケンスが始まったか
	  Bool fnc_begin = FALSE;//Fキーが始まったか
	  int test_time;
	  unsigned char code;
	  char dispcode[2] = {'\0','\0'};
	  Examination * examination;
	  
	  term_clear();
	  
	  test.x = 0;
	  test.y = 0;
	  
	  /*
	    if (ref_i("hand")){
	    Intprt_disp_hand_core(&test.intprt, TEST_HAND_X, TEST_HAND_Y);
	    }
	  */
	
	  //開始時間を記録する typingtestex用拡張
	  examination = &(test.examination);
	  Examination_setTestStartDate(examination);
	  
	  Test_disp_info(TEST_HAND_X+12, 2);
	  
	  Intprt_disp_guide(&test.intprt);
	  
	  time_start();
	  
	  Test_disp_text();
	  
	  test_time = ref_i("time_limit");
	  test.typed[test.y] = Test_alloc(MAX_TYPE+1);
	  while(1){
	    code = term_getkey();
	    typing_second = time_now();
	    
	    //時間が来たら終了する
	    if (time_now() >= test_time){
	      *(test.typed[test.y]+test.x) = '\0';
	      term_keyclear();
	      return;
	    }
	    
	    switch(code){
	    case 0xff://escape sequenseが始まった場合
	      esc_begin = TRUE;
	      continue;
	    case DEL:
	    case BS:
	      continue;
	    case ESC:
	      test.intprt.status = FALSE;
	      return;
	    case CR:
				//if (test.y < MAX_TYPE_LINE-1){//タイプの最大行を指定する時は使う      
	      if(test.text_no-1 <= test.y){
			return;
	      }
	      
	      *(test.typed[test.y]+test.x) = '\0';
	      test.x = 0;
	      test.y++;
	      test.typed[test.y] = Test_alloc(MAX_TYPE+1);
	      Test_disp_text(test);
	      
	      //} else{
	      //return;
	      //}
	      break;
	    default:
	      dispcode[0] = code;
	
	      //ESCシーケンスの場合無視する
    	  if(esc_begin == TRUE && 0x30 <= dispcode[0] && dispcode[0] < 0x40){//ファンクションキーの場合
			fnc_begin = TRUE;
			continue;
	 	  }else if(esc_begin == TRUE){
			esc_begin = FALSE;
			continue;
    	  }else if(fnc_begin == TRUE){
			esc_begin = FALSE;
			fnc_begin = FALSE;
		  }
	      
		  if (test.x < MAX_TYPE){//行内でタイプしている場合
		
		
			*(test.typed[test.y]+test.x) = code;
			test.x++;
			if (cursor){
				Examination * examination;
				Test * test = Test_get_test();
				examination = &(test->examination);
				if(examination->mode  == EXAM_MODE){//本番モードの場合
	  	            if(HIDE_TYPE_MODE_EX==1){//本番モードでタイプエコーを隠す場合
	     		        term_disp(" ");
	     	        }else{//本番モードでタイプエコーを隠さない場合				
	          		    term_disp(dispcode);
	           		}
	       		}else{//練習モードの場合
	            	if(HIDE_TYPE_MODE_PRA){//練習モードでタイプエコーを隠す場合
	             		term_disp(" ");
	            	}else{//練習モードでタイプエコーを隠さない場合
	            		term_disp(dispcode);
	           		}
	        	}
			}
		  }else{//行末にカーソルが行った場合
			*(test.typed[test.y]+test.x) = '\0';
			test.x = 0;
			test.y++;
			test.typed[test.y] = Test_alloc(MAX_TYPE+1);
			Test_disp_text(test);
		  }
		}
	  }
	}