Add item-monster selection palette which fills the same space as the terrain palette
- Removed the item/monster menus in the scenario editor (they weren't function anyway) - Scrollbars can now have a maximum value of 0; if this is the case, they do not draw a thumb
This commit is contained in:
@@ -13,15 +13,12 @@
|
||||
|
||||
using MenuHandle = NSMenu*;
|
||||
MenuHandle menu_bar_handle;
|
||||
MenuHandle item_menu[5], mon_menu[4];
|
||||
MenuHandle file_menu, edit_menu, app_menu, scen_menu, town_menu, out_menu, help_menu;
|
||||
|
||||
extern cScenario scenario;
|
||||
|
||||
@interface MenuHandler : NSObject
|
||||
-(void) menuChoice:(id) sender;
|
||||
-(void) itemMenu:(id) sender;
|
||||
-(void) monstMenu:(id) sender;
|
||||
@end
|
||||
|
||||
static void setMenuCallback(NSMenuItem* item, id targ, SEL selector, int num) {
|
||||
@@ -46,15 +43,6 @@ void init_menubar() {
|
||||
town_menu = [[menu_bar_handle itemWithTitle: @"Town"] submenu];
|
||||
out_menu = [[menu_bar_handle itemWithTitle: @"Outdoors"] submenu];
|
||||
help_menu = [[menu_bar_handle itemWithTitle: @"Help"] submenu];
|
||||
item_menu[0] = [[menu_bar_handle itemWithTitle: @"I1"] submenu];
|
||||
item_menu[1] = [[menu_bar_handle itemWithTitle: @"I2"] submenu];
|
||||
item_menu[2] = [[menu_bar_handle itemWithTitle: @"I3"] submenu];
|
||||
item_menu[3] = [[menu_bar_handle itemWithTitle: @"I4"] submenu];
|
||||
item_menu[4] = [[menu_bar_handle itemWithTitle: @"I5"] submenu];
|
||||
mon_menu[0] = [[menu_bar_handle itemWithTitle: @"M1"] submenu];
|
||||
mon_menu[1] = [[menu_bar_handle itemWithTitle: @"M2"] submenu];
|
||||
mon_menu[2] = [[menu_bar_handle itemWithTitle: @"M3"] submenu];
|
||||
mon_menu[3] = [[menu_bar_handle itemWithTitle: @"M4"] submenu];
|
||||
|
||||
static const eMenu file_choices[] = {
|
||||
eMenu::FILE_NEW, eMenu::FILE_OPEN, eMenu::NONE, eMenu::FILE_CLOSE, eMenu::FILE_SAVE, eMenu::FILE_REVERT,
|
||||
@@ -115,15 +103,6 @@ void shut_down_menus(short mode) {
|
||||
[[menu_bar_handle itemWithTitle: @"Scenario"] setEnabled: NO];
|
||||
[[menu_bar_handle itemWithTitle: @"Town"] setEnabled: NO];
|
||||
[[menu_bar_handle itemWithTitle: @"Outdoors"] setEnabled: NO];
|
||||
[[menu_bar_handle itemWithTitle: @"I1"] setEnabled: NO];
|
||||
[[menu_bar_handle itemWithTitle: @"I2"] setEnabled: NO];
|
||||
[[menu_bar_handle itemWithTitle: @"I3"] setEnabled: NO];
|
||||
[[menu_bar_handle itemWithTitle: @"I4"] setEnabled: NO];
|
||||
[[menu_bar_handle itemWithTitle: @"I5"] setEnabled: NO];
|
||||
[[menu_bar_handle itemWithTitle: @"M1"] setEnabled: NO];
|
||||
[[menu_bar_handle itemWithTitle: @"M2"] setEnabled: NO];
|
||||
[[menu_bar_handle itemWithTitle: @"M3"] setEnabled: NO];
|
||||
[[menu_bar_handle itemWithTitle: @"M4"] setEnabled: NO];
|
||||
}
|
||||
if(mode == 4) {
|
||||
[[file_menu itemWithTitle: @"Save"] setEnabled: YES];
|
||||
@@ -138,30 +117,12 @@ void shut_down_menus(short mode) {
|
||||
for(id item in [out_menu itemArray])
|
||||
if(![[item title] isEqualToString: @"Advanced:"])
|
||||
[item setEnabled: YES];
|
||||
[[menu_bar_handle itemWithTitle: @"I1"] setEnabled: YES];
|
||||
[[menu_bar_handle itemWithTitle: @"I2"] setEnabled: YES];
|
||||
[[menu_bar_handle itemWithTitle: @"I3"] setEnabled: YES];
|
||||
[[menu_bar_handle itemWithTitle: @"I4"] setEnabled: YES];
|
||||
[[menu_bar_handle itemWithTitle: @"I5"] setEnabled: YES];
|
||||
[[menu_bar_handle itemWithTitle: @"M1"] setEnabled: YES];
|
||||
[[menu_bar_handle itemWithTitle: @"M2"] setEnabled: YES];
|
||||
[[menu_bar_handle itemWithTitle: @"M3"] setEnabled: YES];
|
||||
[[menu_bar_handle itemWithTitle: @"M4"] setEnabled: YES];
|
||||
}
|
||||
if((mode == 1) || (mode == 3)) {
|
||||
MenuHandle town_menu = [[menu_bar_handle itemWithTitle: @"Town"] submenu];
|
||||
for(id item in [town_menu itemArray])
|
||||
if([[item title] length] > 0 && [[item title] characterAtIndex: 0] != ' ')
|
||||
[item setEnabled: NO];
|
||||
[[menu_bar_handle itemWithTitle: @"I1"] setEnabled: NO];
|
||||
[[menu_bar_handle itemWithTitle: @"I2"] setEnabled: NO];
|
||||
[[menu_bar_handle itemWithTitle: @"I3"] setEnabled: NO];
|
||||
[[menu_bar_handle itemWithTitle: @"I4"] setEnabled: NO];
|
||||
[[menu_bar_handle itemWithTitle: @"I5"] setEnabled: NO];
|
||||
[[menu_bar_handle itemWithTitle: @"M1"] setEnabled: NO];
|
||||
[[menu_bar_handle itemWithTitle: @"M2"] setEnabled: NO];
|
||||
[[menu_bar_handle itemWithTitle: @"M3"] setEnabled: NO];
|
||||
[[menu_bar_handle itemWithTitle: @"M4"] setEnabled: NO];
|
||||
}
|
||||
if((mode == 2) || (mode == 3)) {
|
||||
MenuHandle out_menu = [[menu_bar_handle itemWithTitle: @"Outdoors"] submenu];
|
||||
@@ -171,40 +132,8 @@ void shut_down_menus(short mode) {
|
||||
}
|
||||
}
|
||||
|
||||
void update_item_menu() {
|
||||
MenuHandler* targ = [[file_menu itemAtIndex: 0] target];
|
||||
short i,j;
|
||||
|
||||
for(j = 0; j < 5; j++) {
|
||||
[item_menu[j] removeAllItems];
|
||||
for(i = 0; i < 80; i++) {
|
||||
NSString* title = [NSString stringWithCString: scenario.scen_items[i + j * 80].full_name.c_str() encoding: NSASCIIStringEncoding];
|
||||
NSMenuItem* newItem = [item_menu[j] addItemWithTitle: title action: @selector(itemMenu:) keyEquivalent:@""];
|
||||
[newItem setTarget: targ];
|
||||
}
|
||||
}
|
||||
for(j = 0; j < 4; j++) {
|
||||
[mon_menu[j] removeAllItems];
|
||||
for(i = 0; i < 64; i++) {
|
||||
NSString* title = [NSString stringWithCString: scenario.scen_monsters[i + j * 64].m_name.c_str() encoding: NSASCIIStringEncoding];
|
||||
NSMenuItem* newItem = [mon_menu[j] addItemWithTitle: title action: @selector(monstMenu:) keyEquivalent: @""];
|
||||
[newItem setTarget: targ];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@implementation MenuHandler
|
||||
-(void) menuChoice:(id) sender {
|
||||
handle_menu_choice(eMenu([[sender representedObject] intValue]));
|
||||
}
|
||||
|
||||
// TODO: Monster and item menus
|
||||
-(void) itemMenu:(id) sender {
|
||||
(void) sender; // Suppress "unused parameter" warning
|
||||
}
|
||||
|
||||
-(void) monstMenu:(id) sender {
|
||||
(void) sender; // Suppress "unused parameter" warning
|
||||
}
|
||||
@end
|
||||
|
Reference in New Issue
Block a user