Ejemplo n.º 1
0
void CAppConfig::Save(LPCTSTR config_path)
{
	CFile file;
	if (! file.Open(config_path, CFile::modeWrite | CFile::modeCreate))
		return;

//	General Setting
	fprintf(file, "[General]\r\n");
	fprintf(file, "multiple_instance=%d\r\n", multiple_instance);
	fprintf(file, "scrolltab=%d\r\n", scrolltab);
	fprintf(file, "close_query=%d\r\n", close_query);
	fprintf(file, "dblclk_close=%d\r\n", dblclk_close);
	fprintf(file, "tab_add_number=%d\r\n", tab_add_number);
	fprintf(file, "tab_button=%d\r\n", tab_button);
	fprintf(file, "showtb=%d\r\n", showtb);
	fprintf(file, "showsb=%d\r\n", showsb);
	fprintf(file, "showtab=%d\r\n", showtab);
	fprintf(file, "showads=%d\r\n", showads);
	fprintf(file, "showclose=%d\r\n", showclose);
	fprintf(file, "use_ansi_bar=%d\r\n", use_ansi_bar);
	fprintf(file, "kktab=%d\r\n", kktab);
	fprintf(file, "is_full_scr=%d\r\n", is_full_scr);
	fprintf(file, "use_MouseCTL=%d\r\n", use_MouseCTL);

	fprintf(file, "fullscr_showtb=%d\r\n", fullscr_showtb);
	fprintf(file, "fullscr_showsb=%d\r\n", fullscr_showsb);
	fprintf(file, "fullscr_showtab=%d\r\n", fullscr_showtab);
	fprintf(file, "fullscr_showads=%d\r\n", fullscr_showads);
	fprintf(file, "fullscr_showclose=%d\r\n", fullscr_showclose);
	fprintf(file, "full_use_ansi_bar=%d\r\n", full_use_ansi_bar);
	fprintf(file, "m_bNewTab_InNowTabNei=%d\r\n", m_bNewTab_InNowTabNei);
	

	fprintf(file, "minimize_to_tray=%d\r\n", minimize_to_tray);
	fprintf(file, "pcman_hotkey=%d\r\n", pcman_hotkey);
	fprintf(file, "pcman_hotkey_mod=%d\r\n", pcman_hotkey_mod);

	fprintf(file, "max_history=%d\r\n", max_history);

	file.Write("\r\n", 2);

//	BBS Setttings
	fprintf(file, "[BBS]\r\n");
	fprintf(file, "auto_cancelsel=%d\r\n", auto_cancelsel);
	fprintf(file, "auto_copy=%d\r\n", auto_copy);
	fprintf(file, "enter_reconnect=%d\r\n", enter_reconnect);
	fprintf(file, "nocon_enter_reconnect=%d\r\n", nocon_enter_reconnect);
	fprintf(file, "auto_close=%d\r\n", auto_close);
	fprintf(file, "auto_font=%d\r\n", auto_font);
	fprintf(file, "bbs_close_query=%d\r\n", bbs_close_query);
	fprintf(file, "auto_switch=%d\r\n", auto_switch);
	fprintf(file, "flash_window=%d\r\n", flash_window);
	fprintf(file, "smooth_draw=%d\r\n", smooth_draw);

	fprintf(file, "bktype=%d\r\n", bktype);
	fprintf(file, "bkratio=%d\r\n", bkratio);		//	ratio/10*100%
	fprintf(file, "sound=%d\r\n", sound);		//type of beep
	fprintf(file, "old_textout=%d\r\n", old_textout);
	fprintf(file, "save_session=%d\r\n", save_session);
	fprintf(file, "switch_back_on_close=%d\r\n", switch_back_on_close);
	fprintf(file, "dblclk_select=%d\r\n", 1);
	fprintf(file, "bkpath=%s\r\n", LPCTSTR(bkpath));	//背景圖路徑
	fprintf(file, "wavepath=%s\r\n", LPCTSTR(wavepath));

//	AnsiEditor Settings
	fprintf(file, "ed_cols_per_page=%d\r\n", ed_cols_per_page);
	fprintf(file, "ed_lines_per_page=%d\r\n", ed_lines_per_page);

//	HyperLink Settings
	fprintf(file, "link_underline=%d\r\n", link_underline);
	fprintf(file, "link_autoswitch=%d\r\n", link_autoswitch);

	file.Write("\r\n", 2);

	fprintf(file, "[Font]\r\n");
	fprintf(file, "face=%s\r\n", font_info.lfFaceName);
	fprintf(file, "height=%d\r\n",  font_info.lfHeight);
	fprintf(file, "width=%d\r\n",  font_info.lfWidth);
	fprintf(file, "esc=%d\r\n",  font_info.lfEscapement);
	fprintf(file, "orient=%d\r\n",  font_info.lfOrientation);
	fprintf(file, "weight=%d\r\n",  font_info.lfWeight);
	fprintf(file, "italic=%d\r\n",  font_info.lfItalic);
	fprintf(file, "underline=%d\r\n",  font_info.lfUnderline);
	fprintf(file, "charset=%d\r\n",  font_info.lfCharSet);
	fprintf(file, "oprec=%d\r\n",  font_info.lfOutPrecision);
	fprintf(file, "cprec=%d\r\n",  font_info.lfClipPrecision);
	fprintf(file, "quality=%d\r\n",  font_info.lfQuality);
	fprintf(file, "pitch=%d\r\n",  font_info.lfPitchAndFamily);
	file.Write("\r\n", 2);

	site_settings.WriteFile(file);
	file.Write("\r\n", 2);

	hyper_links.Save(file);
	file.Write("\r\n", 2);

	fprintf(file, "[Color]\r\n");
	fprint_color(file, "black", colormap[0]);
	fprint_color(file, "dark_red", colormap[1]);
	fprint_color(file, "dark_green", colormap[2]);
	fprint_color(file, "brown", colormap[3]);
	fprint_color(file, "dark_blue", colormap[4]);
	fprint_color(file, "dark_magenta", colormap[5]);
	fprint_color(file, "dark_cyan", colormap[6]);
	fprint_color(file, "light_gray", colormap[7]);
	fprint_color(file, "gray", colormap[8]);
	fprint_color(file, "red", colormap[9]);
	fprint_color(file, "green", colormap[10]);
	fprint_color(file, "yellow", colormap[11]);
	fprint_color(file, "blue", colormap[12]);
	fprint_color(file, "magenta", colormap[13]);
	fprint_color(file, "cyan", colormap[14]);
	fprint_color(file, "white", colormap[15]);
	fprint_color(file, "active_tab_textcolor", active_tab_textcolor);
	file.Write("\r\n", 2);

	fprintf(file, "[Window]\r\n");
// Window position
	fprint_wndstate(file, "main", mainwnd_state);
	fprint_wndstate(file, "site_list", sitelist_state);
	fprint_wndstate(file, "freq_str", freqstr_state);
// Customize toolbar buttons
	fprint_toolbarinf(file, "main_toolbar", main_toolbar_inf);

	if (IsCombo)
		fprint_toolbarinf(file, "web_bar", webbar_inf);

// ReBar Position
	fprint_rebar(file, "rebar0", rebar_bands[0]);	// id=1
	fprint_rebar(file, "rebar1", rebar_bands[2]);	// id=3
	fprint_rebar(file, "rebar2", rebar_bands[3]);	// id=4
	fprint_rebar(file, "rebar3", rebar_bands[1]);	// id=2

	if (IsCombo)
	{
		fprint_rebar(file, "rebar4", rebar_bands[4]);	// id=5
		fprintf(file, "rebar5=6,160,336\r\n");	//id=6
	}
	last_bbslist_item.Replace(';', '\\');
	fprintf(file, "last_bbslist_item=%s\r\n", last_bbslist_item);
	file.Write("\r\n", 2);

//	Web Settings
	if (IsCombo)
	{
		fprintf(file, "[Web]\r\n");
		fprintf(file, "ads_open_new=%d\r\n", ads_open_new);
		fprintf(file, "disable_popup=%d\r\n", disable_popup);
		fprintf(file, "showwb=%d\r\n", showwb);
		fprintf(file, "fullscr_showwb=%d\r\n", fullscr_showwb);
		fprintf(file, "showsearchbar=%d\r\n", 1);
		fprintf(file, "fullscr_showsearchbar=%d\r\n", 1);
		fprintf(file, "autosort_favorite=%d\r\n", autosort_favorite);
		fprintf(file, "disable_script_error=%d\r\n", disable_script_error);
		fprintf(file, "use_ie_fav=%d\r\n", use_ie_fav);
		fprintf(file, "autowrap_favorite=%d\r\n", autowrap_favorite);
		file.Write("\r\n", 2);
	}
}
Ejemplo n.º 2
0
void halma_game_board_print_stream_without_grid(const tab_2d_char* tab_2d,const halma_game_players* players, FILE * stream)
{
#if defined(__unix__) || defined(__unix) || (defined(__APPLE__) && defined(__MACH__))
  system("clear");
#elif defined(_WIN32)
  system("cls");
#endif
  halma_game_end(tab_2d,players);
  printf("--------------------------------------------------\n\t\t\tMenu:\n--------------------------------------------------\n\tn or next : To move.\n\tnew       : To start a new game.\n\tq or quit : To exit the game.\n\tp or print: To display the game board.\n--------------------------------------------------\n");
  printf("Scores:\n Player -%s-:%d\n",players->tab[0].name,players->tab[0].score);
  printf(" Player -%s-:%d\n",players->tab[1].name,players->tab[1].score);
  printf(" Player -%s-:%d\n",players->tab[2].name,players->tab[2].score);
  if(players->nb !=3){
    printf(" Player -%s-:%d\n",players->tab[3].name,players->tab[3].score);
  }
  printf("--------------------------------------------------\n");
  printf("   ");
  for(int i=0;i<10;i++){
    printf("%d  ",i);
  }
  for(int i=10;i<16;i++){
    printf("%d ",i);
  }
  printf("\n");
  if(tab_2d != NULL && tab_2d->tab != NULL)
    {
      for(size_t line=0, column; line < tab_2d->nb_lines; ++line)
	{
	  if(line<10)
	    printf("%u  ",line);
	  else if(line>=10)
	    printf("%d ",line);

	  for(column=0; column < tab_2d->nb_columns; ++column)
	    {
	      if(tab_2d_char_get_element_value_unsafe(tab_2d, line, column) == players->tab[0].char_pawn)
		{
		  fprint_color(stream, "31");
		  fputc(tab_2d_char_get_element_value_unsafe(tab_2d, line, column), stream);
		  fputc(32,stream);
		  fputc(32,stream);
		  fprint_color(stream, "0");
		}
	      else if(tab_2d_char_get_element_value_unsafe(tab_2d, line, column) == players->tab[1].char_pawn)
		{
		  fprint_color(stream, "32");
		  fputc(tab_2d_char_get_element_value_unsafe(tab_2d, line, column), stream);
		  fputc(32,stream);
		  fputc(32,stream);
		  fprint_color(stream, "0");
		}
	      else if(tab_2d_char_get_element_value_unsafe(tab_2d, line, column) == players->tab[2].char_pawn)
		{
		  fprint_color(stream, "34");
		  fputc(tab_2d_char_get_element_value_unsafe(tab_2d, line, column), stream);
		  fputc(32,stream);
		  fputc(32,stream);
		  fprint_color(stream, "0");
		}
	      else if(players->nb != 3 && tab_2d_char_get_element_value_unsafe(tab_2d, line, column) == players->tab[3].char_pawn)
		{
		  fprint_color(stream, "35");
		  fputc(tab_2d_char_get_element_value_unsafe(tab_2d, line, column), stream);
		  fputc(32,stream);
		  fputc(32,stream);		  
		  fprint_color(stream, "0");
		}
	      else
		{
		  fputc(tab_2d_char_get_element_value_unsafe(tab_2d, line, column), stream);
		  fputc(32,stream);
		  fputc(32,stream);
		}
	    }
	  if(line<10)
	    printf("%u  ",line);
	  else if(line>=10)
	    printf("%d ",line);

	  fprintf(stream, "\n");
	}
      printf("   ");
      for(int i=0;i<10;i++){
	printf("%d  ",i);
      }
      for(int i=10;i<16;i++){
	printf("%d ",i);
      }
      printf("\n");
    }
}