src/main_gui.cpp
branchnoai
changeset 9732 f8eb3e208514
parent 9724 b39bc69bb2f2
child 9826 9707ad4c9b60
equal deleted inserted replaced
9731:9b1552d0fd9b 9732:f8eb3e208514
   975 	if (HasBit(_display_opt, DO_SHOW_STATION_NAMES)) SetBit(x,  7);
   975 	if (HasBit(_display_opt, DO_SHOW_STATION_NAMES)) SetBit(x,  7);
   976 	if (HasBit(_display_opt, DO_SHOW_SIGNS))         SetBit(x,  8);
   976 	if (HasBit(_display_opt, DO_SHOW_SIGNS))         SetBit(x,  8);
   977 	if (HasBit(_display_opt, DO_WAYPOINTS))          SetBit(x,  9);
   977 	if (HasBit(_display_opt, DO_WAYPOINTS))          SetBit(x,  9);
   978 	if (HasBit(_display_opt, DO_FULL_ANIMATION))     SetBit(x, 10);
   978 	if (HasBit(_display_opt, DO_FULL_ANIMATION))     SetBit(x, 10);
   979 	if (HasBit(_display_opt, DO_FULL_DETAIL))        SetBit(x, 11);
   979 	if (HasBit(_display_opt, DO_FULL_DETAIL))        SetBit(x, 11);
   980 	if (IsTransparencySet(TO_HOUSES) && IsTransparencySet(TO_TREES)) SetBit(x, 12);
   980 	if (IsTransparencySet(TO_HOUSES))                SetBit(x, 12);
   981 	if (IsTransparencySet(TO_SIGNS))                     SetBit(x, 13);
   981 	if (IsTransparencySet(TO_SIGNS))                 SetBit(x, 13);
   982 	WP(w, menu_d).checked_items = x;
   982 	WP(w, menu_d).checked_items = x;
   983 }
   983 }
   984 
   984 
   985 
   985 
   986 static void ToolbarScenSaveOrLoad(Window *w)
   986 static void ToolbarScenSaveOrLoad(Window *w)
  1666 
  1666 
  1667 static bool DrawScrollingStatusText(const NewsItem *ni, int pos, int width)
  1667 static bool DrawScrollingStatusText(const NewsItem *ni, int pos, int width)
  1668 {
  1668 {
  1669 	char buf[512];
  1669 	char buf[512];
  1670 	StringID str;
  1670 	StringID str;
  1671 	const char *s;
  1671 	const char *s, *last;
  1672 	char *d;
  1672 	char *d;
  1673 	DrawPixelInfo tmp_dpi, *old_dpi;
  1673 	DrawPixelInfo tmp_dpi, *old_dpi;
  1674 	int x;
  1674 	int x;
  1675 	char buffer[256];
  1675 	char buffer[256];
  1676 
  1676 
  1683 
  1683 
  1684 	GetString(buf, str, lastof(buf));
  1684 	GetString(buf, str, lastof(buf));
  1685 
  1685 
  1686 	s = buf;
  1686 	s = buf;
  1687 	d = buffer;
  1687 	d = buffer;
       
  1688 	last = lastof(buffer);
  1688 
  1689 
  1689 	for (;;) {
  1690 	for (;;) {
  1690 		WChar c = Utf8Consume(&s);
  1691 		WChar c = Utf8Consume(&s);
  1691 		if (c == 0) {
  1692 		if (c == 0) {
  1692 			*d = '\0';
       
  1693 			break;
  1693 			break;
  1694 		} else if (*s == 0x0D) {
  1694 		} else if (c == 0x0D) {
       
  1695 			if (d + 4 >= last) break;
  1695 			d[0] = d[1] = d[2] = d[3] = ' ';
  1696 			d[0] = d[1] = d[2] = d[3] = ' ';
  1696 			d += 4;
  1697 			d += 4;
  1697 		} else if (IsPrintable(c)) {
  1698 		} else if (IsPrintable(c)) {
       
  1699 			if (d + Utf8CharLen(c) >= last) break;
  1698 			d += Utf8Encode(d, c);
  1700 			d += Utf8Encode(d, c);
  1699 		}
  1701 		}
  1700 	}
  1702 	}
       
  1703 	*d = '\0';
  1701 
  1704 
  1702 	if (!FillDrawPixelInfo(&tmp_dpi, 141, 1, width, 11)) return true;
  1705 	if (!FillDrawPixelInfo(&tmp_dpi, 141, 1, width, 11)) return true;
  1703 
  1706 
  1704 	old_dpi = _cur_dpi;
  1707 	old_dpi = _cur_dpi;
  1705 	_cur_dpi = &tmp_dpi;
  1708 	_cur_dpi = &tmp_dpi;
  1912 			case '4' | WKC_CTRL:
  1915 			case '4' | WKC_CTRL:
  1913 			case '5' | WKC_CTRL:
  1916 			case '5' | WKC_CTRL:
  1914 			case '6' | WKC_CTRL:
  1917 			case '6' | WKC_CTRL:
  1915 			case '7' | WKC_CTRL:
  1918 			case '7' | WKC_CTRL:
  1916 			case '8' | WKC_CTRL:
  1919 			case '8' | WKC_CTRL:
       
  1920 			case '9' | WKC_CTRL:
  1917 				/* Transparency toggle hot keys */
  1921 				/* Transparency toggle hot keys */
  1918 				ToggleTransparency((TransparencyOption)(e->we.keypress.keycode - ('1' | WKC_CTRL)));
  1922 				ToggleTransparency((TransparencyOption)(e->we.keypress.keycode - ('1' | WKC_CTRL)));
  1919 				MarkWholeScreenDirty();
  1923 				MarkWholeScreenDirty();
  1920 				break;
  1924 				break;
  1921 
  1925