Changeset 170
- Timestamp:
- 06/09/07 08:44:22 (1 year ago)
- Files:
-
- trunk/src/ui.c (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/src/ui.c
r169 r170 374 374 static char scroll_get_tag(menu_type *menu, int pos) 375 375 { 376 if (menu->selections)376 if (menu->selections) 377 377 return menu->selections[pos - menu->top]; 378 378 379 return 0; 379 380 } … … 433 434 static char column_get_tag(menu_type *menu, int pos) 434 435 { 435 if (menu->selections)436 if (menu->selections) 436 437 return menu->selections[pos]; 438 437 439 return 0; 438 440 } … … 594 596 region *loc = &menu->boundary; 595 597 int oid = menu->cursor; 598 596 599 if (menu->object_list && menu->cursor >= 0) 597 600 oid = menu->object_list[oid]; … … 601 604 if (menu->title) 602 605 Term_putstr(loc->col, loc->row, loc->width, TERM_WHITE, menu->title); 606 603 607 if (menu->prompt) 604 608 Term_putstr(loc->col, loc->row + loc->page_rows - 1, loc->width, … … 673 677 out.index = m_curs; 674 678 675 if (*cursor == m_curs || !(menu->flags & MN_DBL_TAP)) { 676 if(*cursor != m_curs) { 679 if (*cursor == m_curs || !(menu->flags & MN_DBL_TAP)) 680 { 681 if (*cursor != m_curs) 682 { 677 683 *cursor = m_curs; 678 684 menu_refresh(menu); … … 681 687 } 682 688 else 689 { 683 690 out.type = EVT_MOVE; 691 } 684 692 685 693 *cursor = m_curs; … … 713 721 else if (c >= 0) 714 722 { 715 if(menu->cursor != c) { 723 if (menu->cursor != c) 724 { 716 725 menu->cursor = c; 717 726 menu_refresh(menu); 718 727 } 728 719 729 out.type = EVT_SELECT; 720 730 out.index = c; 731 721 732 break; 722 733 } … … 727 738 return FALSE; 728 739 729 if (i sspace(in->key)&& (menu->flags & MN_PAGE))740 if (in->key == ' ' && (menu->flags & MN_PAGE)) 730 741 { 731 742 /* Go to start of next page */ 732 743 *cursor += menu->active.page_rows - (*cursor % menu->active.page_rows); 733 if(*cursor >= menu->filter_count) 744 745 if (*cursor >= menu->filter_count) 734 746 *cursor = 0; 747 735 748 out.type = EVT_MOVE; 736 749 out.index = *cursor; 750 737 751 break; 738 752 } 739 753 740 /* cursor movement */754 /* Cursor movement */ 741 755 dir = target_dir(in->key); 742 756 757 /* Handle Enter */ 758 if (in->key == '\n' || in->key == '\r') 759 { 760 out.type = EVT_SELECT; 761 out.index = *cursor; 762 } 743 763 /* Reject diagonals */ 744 if (ddx[dir] && ddy[dir])764 else if (ddx[dir] && ddy[dir]) 745 765 { 746 766 return FALSE; 747 767 } 768 /* Forward/back */ 748 769 else if (ddx[dir]) 749 770 { … … 1082 1103 const menu_skin *skin = find_menu_skin(skin_id); 1083 1104 const menu_iter *iter = find_menu_iter(iter_id); 1105 1084 1106 if (!iter || !skin) 1085 1107 { 1086 msg_print(format 1087 ("could not find menu VTAB (%d, %d)!", skin_id, iter_id)); 1108 msg_format("could not find menu VTAB (%d, %d)!", skin_id, iter_id); 1088 1109 return FALSE; 1089 1110 } 1111 1090 1112 return menu_init2(menu, skin, iter, loc); 1091 1113 } … … 1093 1115 void menu_destroy(menu_type *menu) 1094 1116 { 1095 if (menu->object_list) FREE((void *)menu->object_list); 1117 if (menu->object_list) 1118 FREE(menu->object_list); 1096 1119 } 1097 1120
