misc_gui.c
changeset 4077 d4d440dd8925
parent 4000 4009d092b306
child 4091 ab386a12f137
equal deleted inserted replaced
4076:a6650b616430 4077:d4d440dd8925
   913 			InvalidateWidget(w, wid);
   913 			InvalidateWidget(w, wid);
   914 		break;
   914 		break;
   915 	case WKC_LEFT: case WKC_RIGHT: case WKC_END: case WKC_HOME:
   915 	case WKC_LEFT: case WKC_RIGHT: case WKC_END: case WKC_HOME:
   916 		if (MoveTextBufferPos(&string->text, we->keypress.keycode))
   916 		if (MoveTextBufferPos(&string->text, we->keypress.keycode))
   917 			InvalidateWidget(w, wid);
   917 			InvalidateWidget(w, wid);
   918   	break;
   918 		break;
   919 	default:
   919 	default:
   920 		if (IsValidAsciiChar(we->keypress.ascii)) {
   920 		if (IsValidAsciiChar(we->keypress.ascii)) {
   921 			if (InsertTextBufferChar(&string->text, we->keypress.ascii))
   921 			if (InsertTextBufferChar(&string->text, we->keypress.ascii))
   922 				InvalidateWidget(w, wid);
   922 				InvalidateWidget(w, wid);
   923 		} else // key wasn't caught
   923 		} else { // key wasn't caught
   924 			we->keypress.cont = true;
   924 			we->keypress.cont = true;
       
   925 		}
   925 	}
   926 	}
   926 
   927 
   927 	return 0;
   928 	return 0;
   928 }
   929 }
   929 
   930 
  1505 static void SelectScenarioWndProc(Window* w, WindowEvent* e)
  1506 static void SelectScenarioWndProc(Window* w, WindowEvent* e)
  1506 {
  1507 {
  1507 	const int list_start = 45;
  1508 	const int list_start = 45;
  1508 
  1509 
  1509 	switch (e->event) {
  1510 	switch (e->event) {
  1510 	case WE_PAINT:
  1511 	case WE_PAINT: {
  1511 	{
       
  1512 		int y,pos;
  1512 		int y,pos;
  1513 		const FiosItem *item;
  1513 		const FiosItem *item;
  1514 
  1514 
  1515 		if (_savegame_sort_dirty) {
  1515 		if (_savegame_sort_dirty) {
  1516 			_savegame_sort_dirty = false;
  1516 			_savegame_sort_dirty = false;
  1554 			_savegame_sort_dirty = true;
  1554 			_savegame_sort_dirty = true;
  1555 			SetWindowDirty(w);
  1555 			SetWindowDirty(w);
  1556 			break;
  1556 			break;
  1557 
  1557 
  1558 		case 6: /* Click the listbox */
  1558 		case 6: /* Click the listbox */
  1559 			if (e->click.pt.y < list_start)
  1559 			if (e->click.pt.y < list_start) {
  1560 				GenRandomNewGame(Random(), InteractiveRandom());
  1560 				GenRandomNewGame(Random(), InteractiveRandom());
  1561 			else {
  1561 			} else {
  1562 				char *name;
       
  1563 				int y = (e->click.pt.y - list_start) / 10;
  1562 				int y = (e->click.pt.y - list_start) / 10;
       
  1563 				const char* name;
  1564 				const FiosItem *file;
  1564 				const FiosItem *file;
  1565 
  1565 
  1566 				if (y < 0 || (y += w->vscroll.pos) >= w->vscroll.count)
  1566 				if (y < 0 || (y += w->vscroll.pos) >= w->vscroll.count) return;
  1567 					return;
       
  1568 
  1567 
  1569 				file = _fios_list + y;
  1568 				file = _fios_list + y;
  1570 
  1569 
  1571 				name = FiosBrowseTo(file);
  1570 				name = FiosBrowseTo(file);
  1572 				if (name != NULL) {
  1571 				if (name != NULL) {
  1576 					StartScenarioEditor(Random(), InteractiveRandom());
  1575 					StartScenarioEditor(Random(), InteractiveRandom());
  1577 				}
  1576 				}
  1578 			}
  1577 			}
  1579 			break;
  1578 			break;
  1580 		}
  1579 		}
  1581 	case WE_DESTROY:
       
  1582 		break;
       
  1583 
  1580 
  1584 	case WE_RESIZE: {
  1581 	case WE_RESIZE: {
  1585 		/* Widget 3 and 4 have to go with halve speed, make it so obiwan */
  1582 		/* Widget 3 and 4 have to go with halve speed, make it so obiwan */
  1586 		uint diff = e->sizing.diff.x / 2;
  1583 		uint diff = e->sizing.diff.x / 2;
  1587 		w->widget[3].right += diff;
  1584 		w->widget[3].right += diff;