src/news_gui.cpp
changeset 7824 5a63d41b59ea
parent 7598 626c6a804e6d
child 7849 0a1c0af2c96c
equal deleted inserted replaced
7823:7445cb71f080 7824:5a63d41b59ea
   104 	GfxFillRect(left, top, left, bottom, 0xD7);
   104 	GfxFillRect(left, top, left, bottom, 0xD7);
   105 	GfxFillRect(right, top, right, bottom, 0xD7);
   105 	GfxFillRect(right, top, right, bottom, 0xD7);
   106 	GfxFillRect(left, top, right, top, 0xD7);
   106 	GfxFillRect(left, top, right, top, 0xD7);
   107 	GfxFillRect(left, bottom, right, bottom, 0xD7);
   107 	GfxFillRect(left, bottom, right, bottom, 0xD7);
   108 
   108 
   109 	DrawString(left + 2, top + 1, STR_00C6, 0);
   109 	DrawString(left + 2, top + 1, STR_00C6, TC_FROMSTRING);
   110 }
   110 }
   111 
   111 
   112 static void NewsWindowProc(Window *w, WindowEvent *e)
   112 static void NewsWindowProc(Window *w, WindowEvent *e)
   113 {
   113 {
   114 	switch (e->event) {
   114 	switch (e->event) {
   124 		switch (ni->display_mode) {
   124 		switch (ni->display_mode) {
   125 			case NM_NORMAL:
   125 			case NM_NORMAL:
   126 			case NM_THIN: {
   126 			case NM_THIN: {
   127 				DrawNewsBorder(w);
   127 				DrawNewsBorder(w);
   128 
   128 
   129 				DrawString(2, 1, STR_00C6, 0);
   129 				DrawString(2, 1, STR_00C6, TC_FROMSTRING);
   130 
   130 
   131 				SetDParam(0, ni->date);
   131 				SetDParam(0, ni->date);
   132 				DrawStringRightAligned(428, 1, STR_01FF, 0);
   132 				DrawStringRightAligned(428, 1, STR_01FF, TC_FROMSTRING);
   133 
   133 
   134 				if (!(ni->flags & NF_VIEWPORT)) {
   134 				if (!(ni->flags & NF_VIEWPORT)) {
   135 					CopyInDParam(0, ni->params, lengthof(ni->params));
   135 					CopyInDParam(0, ni->params, lengthof(ni->params));
   136 					DrawStringMultiCenter(215, ni->display_mode == NM_NORMAL ? 76 : 56,
   136 					DrawStringMultiCenter(215, ni->display_mode == NM_NORMAL ? 76 : 56,
   137 						ni->string_id, w->width - 4);
   137 						ni->string_id, w->width - 4);
   702 		for (p = w->vscroll.pos; p < w->vscroll.pos + show; p++) {
   702 		for (p = w->vscroll.pos; p < w->vscroll.pos + show; p++) {
   703 			/* get news in correct order */
   703 			/* get news in correct order */
   704 			const NewsItem *ni = &_news_items[getNews(p)];
   704 			const NewsItem *ni = &_news_items[getNews(p)];
   705 
   705 
   706 			SetDParam(0, ni->date);
   706 			SetDParam(0, ni->date);
   707 			DrawString(4, y, STR_SHORT_DATE, 12);
   707 			DrawString(4, y, STR_SHORT_DATE, TC_WHITE);
   708 
   708 
   709 			DrawNewsString(82, y, 12, ni, w->width - 95);
   709 			DrawNewsString(82, y, TC_WHITE, ni, w->width - 95);
   710 			y += 12;
   710 			y += 12;
   711 		}
   711 		}
   712 		break;
   712 		break;
   713 	}
   713 	}
   714 
   714 
   830 
   830 
   831 			/* Draw the string of each setting on each button. */
   831 			/* Draw the string of each setting on each button. */
   832 			for (i = 0, y = 26; i < NT_END; i++, y += 12, val >>= 2) {
   832 			for (i = 0, y = 26; i < NT_END; i++, y += 12, val >>= 2) {
   833 				/* 51 comes from 13 + 89 (left and right of the button)+1, shiefted by one as to get division,
   833 				/* 51 comes from 13 + 89 (left and right of the button)+1, shiefted by one as to get division,
   834 				 * which will give centered position */
   834 				 * which will give centered position */
   835 				DrawStringCentered(51, y + 1, message_opt[val & 0x3], 0x10);
   835 				DrawStringCentered(51, y + 1, message_opt[val & 0x3], TC_BLACK);
   836 			}
   836 			}
   837 
   837 
   838 			/* Draw the general bottom button string as well */
   838 			/* Draw the general bottom button string as well */
   839 			DrawStringCentered(51, y + 10, message_opt[WP(w, def_d).data_1], 0x10);
   839 			DrawStringCentered(51, y + 10, message_opt[WP(w, def_d).data_1], TC_BLACK);
   840 		} break;
   840 		} break;
   841 
   841 
   842 		case WE_CLICK:
   842 		case WE_CLICK:
   843 			switch (e->we.click.widget) {
   843 			switch (e->we.click.widget) {
   844 				case WIDGET_NEWSOPT_BTN_SUMMARY:
   844 				case WIDGET_NEWSOPT_BTN_SUMMARY: