Example #1
0
File: intro.c Project: callaa/luola
/* Create the critter settings menu */
static struct Menu *make_critter_menu(struct Menu *parent) {
    struct Menu *m;
    struct MenuValue val = {NULL,0,0,1};
    struct MenuItem *item;

    /* Create menu */
    m = create_menu(0,parent,NULL,NULL,NULL,0);
    add_caption(m,"Critter settings");

    val.value = &game_settings.ls.critters;
    item = add_menu_item(m,MNU_ITEM_TOGGLE,1,
            menu_txt_label("Random critters are %s"),val);

    val.max = 50;
    val.value = &game_settings.ls.cows;
    item = add_menu_item(m,MNU_ITEM_VALUE,1,
            menu_txt_label("Cows: %d"),val);

    val.value = &game_settings.ls.birds;
    item = add_menu_item(m,MNU_ITEM_VALUE,1,
            menu_txt_label("Birds: %d"),val);

    val.value = &game_settings.ls.fish;
    item = add_menu_item(m,MNU_ITEM_VALUE,1,
            menu_txt_label("Fish: %d"),val);

    val.value = &game_settings.ls.bats;
    item = add_menu_item(m,MNU_ITEM_VALUE,1,
            menu_txt_label("Bats: %d"),val);

    add_ok(m);

    return m;

}
Example #2
0
/* This is called by the drop handler function clist_drag_data_received */
static void
create_drag_op_menu(gchar *dest_dir, gchar *file_list)
{
  GtkWidget *item;

  if (app.drag_op_menu != NULL)
    gtk_widget_destroy(app.drag_op_menu);

  app.drag_op_menu = gtk_menu_new();
  item = add_menu_item(app.drag_op_menu, _("Copy"), drag_op_cb, file_copy);
  gtk_object_set_data_full(GTK_OBJECT(item), "dest_dir", g_strdup(dest_dir),
                           free_data);
  gtk_object_set_data_full(GTK_OBJECT(item), "file_list", g_strdup(file_list),
                           free_data);
  item = add_menu_item(app.drag_op_menu, _("Move"), drag_op_cb, file_move);
  gtk_object_set_data_full(GTK_OBJECT(item), "dest_dir", g_strdup(dest_dir),
                           free_data);
  gtk_object_set_data_full(GTK_OBJECT(item), "file_list", g_strdup(file_list),
                           free_data);
  item = add_menu_item(app.drag_op_menu, _("SymLink"), drag_op_cb, file_symlink);
  gtk_object_set_data_full(GTK_OBJECT(item), "dest_dir", g_strdup(dest_dir),
                           free_data);
  gtk_object_set_data_full(GTK_OBJECT(item), "file_list", g_strdup(file_list),
                           free_data);

  gtk_menu_popup(GTK_MENU(app.drag_op_menu), NULL, NULL, NULL, NULL, 0, 0);
}
Example #3
0
static void down_click_handler_repeating(ClickRecognizerRef recognizer, void *context) {
  //text_layer_set_text(one_layer, "Down");
    if(layer_count_start == 0){
          if (dollars > 5)
      dollars = dollars - 5;
      
      //text_layer_destroy(layer_array[0]);
      add_menu_item(0,GRect(10,0,menu_item_width,menu_item_height));
      
    }else if(layer_count_start == 1){
          if (cents > 5)
            cents = cents - 5;
    //text_layer_destroy(layer_array[1]);
    add_menu_item(1,GRect(10,25,menu_item_width,menu_item_height));     
          

    }else if(layer_count_start == 2){
          if(tip_percent > 0)
            tip_percent--;
    //text_layer_destroy(layer_array[2]);
    add_menu_item(2,GRect(10,50,menu_item_width,menu_item_height));    
          

    }else{
       if (people > 0)
     people--;
     //text_layer_destroy(layer_array[3]);
     add_menu_item(3, GRect(10,75,menu_item_width,menu_item_height)); 
      
  }

  update_total();
}
Example #4
0
File: intro.c Project: callaa/luola
/* Create the ship settings menu */
static struct Menu *make_ship_menu(struct Menu *parent) {
    struct Menu *m;
    struct MenuValue val;
    struct MenuItem *item;

    /* Create menu */
    m = create_menu(0,parent,NULL,NULL,NULL,0);
    add_caption(m,"Ship settings");

    val.value = &game_settings.ship_collisions;
    item = add_menu_item(m,MNU_ITEM_TOGGLE,1,
            menu_txt_label("Ship collisions are %s"),val);

    val.value = &game_settings.coll_damage;
    add_menu_item(m,MNU_ITEM_TOGGLE,2,
            menu_txt_label("Collision damage is %s"),val);

    val.value = &game_settings.eject;
    item = add_menu_item(m,MNU_ITEM_TOGGLE,3,
            menu_txt_label("Pilot ejection is %s"),val);

    val.value = &game_settings.recall;
    item = add_menu_item(m,MNU_ITEM_TOGGLE,4,
            menu_txt_label("Ship recall is %s"),val);

    add_ok(m);

    return m;

}
Example #5
0
File: intro.c Project: callaa/luola
/* Create the startup settings menu */
static struct Menu *make_startup_menu(struct Menu *parent) {
    struct Menu *m;
    struct MenuText save,back;
    struct MenuValue val;
    struct MenuItem *item;

    /* Create some special menu item labels */
    save = menu_txt_label("Save settings");
    save.color = font_color_red;
    back = menu_txt_label("Return");
    back.color = font_color_green;

    /* Create menu */
    m = create_menu(0,parent,NULL,NULL,NULL,0);
    add_caption(m,"Default startup settings");

    val.value = &luola_options.fullscreen;
    item = add_menu_item(m,MNU_ITEM_TOGGLE,1,
            menu_txt_label("Start in %s mode"),val);
    item->text_enabled="fullscreen";
    item->text_disabled="windowed";

    val.value = &luola_options.hidemouse;
    item = add_menu_item(m,MNU_ITEM_TOGGLE,1,
            menu_txt_label("Mouse pointer is %s"),val);
    item->text_enabled="hidden";
    item->text_disabled="shown";

    val.value = &luola_options.joystick;
    item = add_menu_item(m,MNU_ITEM_TOGGLE,1,
            menu_txt_label("Gamepad support is %s"),val);

    val.value = &luola_options.sounds;
    item = add_menu_item(m,MNU_ITEM_TOGGLE,1,
            menu_txt_label("Sound support is %s"),val);

    val.value = &luola_options.sfont;
    item = add_menu_item(m,MNU_ITEM_TOGGLE,1,
            menu_txt_label("Font engine: %s"),val);
    item->text_enabled="SFont";
    item->text_disabled="SDL_ttf";

    val.value = &luola_options.mbg_anim;
    item = add_menu_item(m,MNU_ITEM_TOGGLE,1,
            menu_txt_label("Menu background animations are %s"),val);

    val.max = 2;
    val.min = 0;
    val.inc = 1;
    val.value = (int*)&luola_options.videomode;
    item = add_menu_item(m,MNU_ITEM_VALUE,0,
            menu_func_label(vmode_label),val);

    add_menu_item(m,MNU_ITEM_SEP,0,menu_txt_label("- - -"),MnuNullValue);
    add_menu_item(m,MNU_ITEM_LABEL,0,save,MnuNullValue)->action =
        save_startup_settings;
    add_menu_item(m,MNU_ITEM_PARENT,0,back,MnuNullValue);

    return m;
}
Example #6
0
File: intro.c Project: callaa/luola
/* Add a caption to a menu */
static void add_caption(struct Menu *menu, const char *caption) {
    struct MenuText txt = menu_txt_label(caption);
    txt.color = font_color_gray;
    txt.align = MNU_ALIGN_CENTER;
    add_menu_item(menu,MNU_ITEM_SEP,0,txt,MnuNullValue);
    add_menu_item(menu,MNU_ITEM_SEP,0,menu_txt_label(NULL),MnuNullValue);
}
Example #7
0
File: intro.c Project: callaa/luola
/* Create the options menu */
static struct Menu *make_options_menu(struct Menu *parent,struct MenuDrawingOptions *options) {
    struct MenuText save,back;
    struct Menu *opts;
    struct MenuItem *audiomenu;
    /* Create some special menu item labels */
    save = menu_txt_label("Save settings");
    save.color = font_color_red;
    back = menu_txt_label("Return");
    back.color = font_color_green;
    /* Create menu */
    opts = create_menu(0,parent,options,NULL,NULL,0);

    add_caption(opts,"Luola configuration");
    add_submenu(opts,1,"Input settings", make_input_menu(opts));
    add_submenu(opts,2,"Game settings", make_game_menu(opts));
    add_submenu(opts,3,"Level settings", make_level_menu(opts));
    audiomenu = add_submenu(opts,4,"Audio settings", make_audio_menu(opts));
    add_submenu(opts,5,"Startup settings", make_startup_menu(opts));
    add_menu_item(opts,MNU_ITEM_SEP,0,menu_txt_label("- - -"),MnuNullValue);
    add_menu_item(opts,MNU_ITEM_LABEL,0,save,MnuNullValue)->action = save_settings;
    add_menu_item(opts,MNU_ITEM_PARENT,0,back,MnuNullValue);

    if(SDL_WasInit(SDL_INIT_AUDIO)==0)
        audiomenu->sensitive = 0;

    return opts;
}
Example #8
0
File: w32menu.c Project: 0xAX/emacs
/* Construct native Windows menu(bar) based on widget_value tree.  */
static int
fill_in_menu (HMENU menu, widget_value *wv)
{
  for ( ; wv != NULL; wv = wv->next)
    {
      if (wv->contents)
	{
	  HMENU sub_menu = CreatePopupMenu ();

	  if (sub_menu == NULL)
	    return 0;

	  if (!fill_in_menu (sub_menu, wv->contents) ||
	      !add_menu_item (menu, wv, sub_menu))
	    {
	      DestroyMenu (sub_menu);
	      return 0;
	    }
	}
      else
	{
	  if (!add_menu_item (menu, wv, NULL))
	    return 0;
	}
    }
  return 1;
}
Example #9
0
int main(void){
   menu_t *games_list;
   int selected;
   PICvision_init();
   games_list=create_menu("SELECT GAME");
   add_menu_item("snake",1,games_list);
   add_menu_item("2048",2,games_list);
   //add_menu_item("game 3",3,games_list);
   //add_menu_item("etc...",4,games_list);
   while(1){
       clear_screen();
       selected=run_menu(games_list,10,(27-5)/2,PADDLE1);
       clear_screen();
       switch(selected){
           case 1:
               snake_game();
               break;
           case 2:
               gc_2048_game();
               break;
           case 3:
               set_curpos(0,0);
               print("game 3");
               wait_n_frame(60);
               break;
           case 4:
               set_curpos(0,0);
               print("autre jeux");
               wait_n_frame(60);
               break;
       }//switch
   }//while
   return 0;
}//main()
Example #10
0
// ---------------------------------------------------------------
// Constructor
//
// Sets up the view settings
//
// Preconditions:
//
// Parameters:
//
// Postconditions:
//
// Returns:
// ---------------------------------------------------------------
SGIView::SGIView(const BRect &frame, const char *name,
	uint32 resize, uint32 flags, TranslatorSettings *settings)
	:	BView(frame, name, resize, flags),
		fSettings(settings)
{
	SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
	SetLowColor(ViewColor());

	BPopUpMenu* menu = new BPopUpMenu("pick compression");

	uint32 currentCompression = fSettings->SetGetInt32(SGI_SETTING_COMPRESSION);
	// create the menu items with the various compression methods
	add_menu_item(menu, SGI_COMP_NONE, "None", currentCompression);
//	menu->AddSeparatorItem();
	add_menu_item(menu, SGI_COMP_RLE, "RLE", currentCompression);

// DON'T turn this on, it's so slow that I didn't wait long enough
// the one time I tested this. So I don't know if the code even works.
// Supposedly, this would look for an already written scanline, and
// modify the scanline tables so that the current row is not written
// at all...

//	add_menu_item(menu, SGI_COMP_ARLE, "Agressive RLE", currentCompression);

	BRect menuFrame = Bounds();
	menuFrame.bottom = menuFrame.top + menu->Bounds().Height();
	fCompressionMF = new BMenuField(menuFrame, "compression",
									"Use compression:", menu, true/*,
									B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP*/);
	if (fCompressionMF->MenuBar())
		fCompressionMF->MenuBar()->ResizeToPreferred();
	fCompressionMF->ResizeToPreferred();

	// figure out where the text ends
	font_height fh;
	be_bold_font->GetHeight(&fh);
	float xbold, ybold;
	xbold = fh.descent + 1;
	ybold = fh.ascent + fh.descent * 2 + fh.leading;

	font_height plainh;
	be_plain_font->GetHeight(&plainh);
	float yplain;
	yplain = plainh.ascent + plainh.descent * 2 + plainh.leading;

	// position the menu field below all the text we draw in Draw()
	BPoint textOffset(0.0, yplain * 2 + ybold);
	fCompressionMF->MoveTo(textOffset);

	AddChild(fCompressionMF);

	ResizeToPreferred();
}
Example #11
0
File: intro.c Project: callaa/luola
/* Create the input settings menu */
static struct Menu *make_input_menu(struct Menu *parent) {
    static const char *names[]={"Player 1 controller","Player 2 controller",
        "Player 3 controller", "Player 4 controller"};
    struct Menu *m;
    int r;

    /* Create menu */
    m = create_menu(0,parent,NULL,NULL,NULL,0);
    add_caption(m,"Input settings");

    for(r=0;r<4;r++) {
        struct MenuValue sub;
        struct MenuItem *item;
        struct MenuIcon *icon;
        sub.value = (int*)make_controller_menu(m,r,names[r]);
        item=add_menu_item(m,MNU_ITEM_SUBMENU,r+1,menu_txt_label(names[r]),sub);
        icon = menu_icon_draw(draw_input_icon);
        item->icons = dllist_append(NULL,icon);
    }

    add_ok(m);

    return m;

}
Example #12
0
/* display a selection menu for tilesets */
static void
select_tileset_value(union nh_optvalue *value, struct nh_option_desc *option)
{
    struct nh_menulist menu;
    int i;

    int tc;
    struct tileset_description *tilesets = get_tileset_descriptions(&tc);
    struct tileset_description tilesets_copy[tc];
    memcpy(tilesets_copy, tilesets, sizeof tilesets_copy);
    free(tilesets);

    init_menulist(&menu);

    add_menu_txt(&menu, option->helptxt, MI_TEXT);
    add_menu_txt(&menu, "", MI_TEXT);

    for (i = 0; i < tc; i++)
        add_menu_item(&menu, i + 1, tilesets_copy[i].desc, 0, 0);

    int pick_list[1];
    curses_display_menu(&menu, option->name, PICK_ONE, PLHINT_RIGHT, pick_list,
                        curses_menu_callback);

    const char *newname = option->value.s;
    if (pick_list[0] != CURSES_MENU_CANCELLED)
        newname = tilesets_copy[pick_list[0] - 1].basename;

    value->s = malloc(strlen(newname) + 1);
    strcpy(value->s, newname);
}
Example #13
0
/* display a selection menu for enum options */
static void
select_enum_value(union nh_optvalue *value, struct nh_option_desc *option)
{
    struct nh_menulist menu;
    int i, selectidx;

    init_menulist(&menu);

    add_menu_txt(&menu, option->helptxt, MI_TEXT);
    add_menu_txt(&menu, "", MI_TEXT);

    for (i = 0; i < option->e.numchoices; i++) {
        char capbuf[QBUFSZ];
        const char *cap;

        if (option->value.e == option->e.choices[i].id) {
            snprintf(capbuf, QBUFSZ, "%s (set)", option->e.choices[i].caption);
            cap = capbuf;
        } else {
            cap = option->e.choices[i].caption;
        }
        /* don't use the choice ids directly, 0 is a valid value for those */
        add_menu_item(&menu, i + 1, cap, 0, 0);
    }

    int pick_list[1];
    curses_display_menu(&menu, option->name, PICK_ONE, PLHINT_RIGHT, pick_list,
                        curses_menu_callback);

    value->e = option->value.e; /* in case of ESC */
    if (pick_list[0] != CURSES_MENU_CANCELLED) {
        selectidx = pick_list[0] - 1;
        value->e = option->e.choices[selectidx].id;
    }
}
Example #14
0
/* add a list of options to the given selection menu */
static int
menu_add_options(struct nh_menulist *menu, int listid,
                 struct nh_option_desc *options, enum nh_optbirth birth,
                 nh_bool read_only)
{
    int i, id;
    char optbuf[256];

    for (i = 0; options[i].name; i++) {
        id = (listid << 10) | i;
        if (options[i].birth_option != birth)
            continue;

        print_option_string(&options[i], optbuf);
        if (read_only)
            add_menu_txt(menu, optbuf, MI_TEXT);
        else
            add_menu_item(menu, id, optbuf, 0, 0);
    }

    /* add an empty line */
    add_menu_txt(menu, "", MI_TEXT);

    return i;
}
Example #15
0
bool
addMenuItem(const char * menupath, const char * name, const char * hotkey,
		int flags, IdaMenuItemListener * listener)
{
	return add_menu_item(menupath, name, hotkey, flags,
		wrap_add_menu_item_callback, reinterpret_cast<void *>(listener));
}
Example #16
0
void SeqStudioWindow::AddMainMenu(BRect f)
{
	BMenuBar*		menuBar;
	BMenu*			menu;
	BMenuItem*		item;
	menuBar = new BMenuBar(	f, NULL, B_FOLLOW_TOP | B_FOLLOW_LEFT_RIGHT,
							B_ITEMS_IN_ROW, FALSE);
	/* Entry Menu
	 */
	mPortMenu = new BMenu("MIDI Port", B_ITEMS_IN_COLUMN);
	add_menu_item(mPortMenu,	DELETE_STR,		DELETE_PORT_MSG,		'T');
	item = new BMenuItem(mPortMenu);
	menuBar->AddItem(mPortMenu, ENTRY_MENU_INDEX);

	/* Attributes Menu
	 */
	menu = new BMenu("Attributes", B_ITEMS_IN_COLUMN);
	item = new BMenuItem(menu);
	menuBar->AddItem(item, ATTRIBUTES_MENU_INDEX);
	add_attribute_item(menu, MIDI_PORT_STR);
	add_attribute_item(menu, TYPE_STR);
	add_attribute_item(menu, DEVICE_STR);
	add_attribute_item(menu, LABEL_STR);

	AddChild(menuBar);
	SetKeyMenuBar(menuBar);
}
Example #17
0
static PyObject *py_add_menu_item(
  const char *menupath,
  const char *name,
  const char *hotkey,
  int flags,
  PyObject *pyfunc,
  PyObject *args)
{
  PYW_GIL_CHECK_LOCKED_SCOPE();
  bool no_args;

  // No slash in the menu path?
  const char *p = strrchr(menupath, '/');
  if ( p == NULL )
    Py_RETURN_NONE;

  if ( args == Py_None )
  {
    no_args = true;
    args = PyTuple_New(0);
    if ( args == NULL )
      return NULL;
  }
  else if ( !PyTuple_Check(args) )
  {
    PyErr_SetString(PyExc_TypeError, "args must be a tuple or None");
    return NULL;
  }
  else
  {
    no_args = false;
  }

  // Form a tuple holding the function to be called and its arguments
  PyObject *cb_data = Py_BuildValue("(OO)", pyfunc, args);

  // If we created an empty tuple, then we must free it
  if ( no_args )
    Py_DECREF(args);

  // Add the menu item
  bool b = add_menu_item(menupath, name, hotkey, flags, py_menu_item_callback, (void *)cb_data);

  if ( !b )
  {
    Py_XDECREF(cb_data);
    Py_RETURN_NONE;
  }
  // Create a context (for the delete_menu_item())
  py_add_del_menu_item_ctx *ctx = new py_add_del_menu_item_ctx();

  // Form the complete menu path
  ctx->menupath.append(menupath, p - menupath + 1);
  ctx->menupath.append(name);
  // Save callback data
  ctx->cb_data = cb_data;

  // Return context to user
  return PyCObject_FromVoidPtr(ctx, NULL);
}
Example #18
0
Core::Core()
    : m_originalMangler(nullptr)
{
#if IDA_SDK_VERSION >= 670
    action_desc_t action = 
    {
        sizeof(action),
        "retypedef_open_name_subst_editor",
        "Edit name substitutions...",
        &m_optionsMenuItemClickedAction,
        &PLUGIN
    };

    register_action(action);
    attach_action_to_menu("Options/", "retypedef_open_name_subst_editor", 0);
#else
    add_menu_item("Options/", "Edit name substitutions...", nullptr, 0, 
        &Core::onOptionsMenuItemClicked, this);
#endif

    // First start? Initialize with default rules.
    Settings settings;
    if (settings.value(Settings::kFirstStart, true).toBool())
    {
        QSettings defaultRules(":/Misc/default_rules.ini", QSettings::IniFormat);
        SettingsImporterExporter importer(&m_substitutionManager, &defaultRules);
        importer.importRules();
        saveToSettings();
        settings.setValue(Settings::kFirstStart, false);
    }

    // Load rules from settings and subscribe to changes in the manager
    try
    {
        SettingsImporterExporter importer(&m_substitutionManager, &settings);
        importer.importRules();
    }
    catch (const SettingsImporterExporter::Error& e)
    {
        msg("[" PLUGIN_NAME "] Cannot load settings: %s\n", e.what());
    }
    connect(&m_substitutionManager, SIGNAL(entryAdded()), SLOT(saveToSettings()));
    connect(&m_substitutionManager, SIGNAL(entryDeleted()), SLOT(saveToSettings()));

    // Place demangler detour
    HMODULE hIdaWll = GetModuleHandleA("IDA.WLL");
    if (!hIdaWll)
        throw std::runtime_error("cannot find IDA.WLL");

    auto demangle = reinterpret_cast<demangler_t*>(GetProcAddress(hIdaWll, "demangle"));
    if (!demangle)
        throw std::runtime_error("cannot find exported function \"demangle\" in IDA.WLL");

    m_demanglerDetour.reset(new DemanglerDetour(demangle, &Core::demanglerHookCallback));
    m_demanglerDetour->attach(m_originalMangler);
}
Example #19
0
/* display a selecton menu for boolean options */
static void
select_boolean_value(union nh_optvalue *value, struct nh_option_desc *option)
{
    struct nh_menulist menu;
    int pick_list[1];

    init_menulist(&menu);

    add_menu_txt(&menu, option->helptxt, MI_TEXT);
    add_menu_txt(&menu, "", MI_TEXT);
    add_menu_item(&menu, 1, option->value.b ? "true (set)" : "true", 't', 0);
    add_menu_item(&menu, 2, option->value.b ? "false" : "false (set)", 'f', 0);

    curses_display_menu(&menu, option->name, PICK_ONE, PLHINT_RIGHT,
                        pick_list, curses_menu_callback);

    value->b = option->value.b; /* in case of ESC */
    if (pick_list[0] != CURSES_MENU_CANCELLED)
        value->b = pick_list[0] == 1;
}
Example #20
0
static void select_click_handler(ClickRecognizerRef recognizer, void *context) {
  
  
  //text_layer_set_text(layer_array[layer_count_start], "Select");
  layer_destroy(path_layer_array[0]);
  layer_destroy(path_layer_array[1]);
  layer_destroy(path_layer_array[2]);
  layer_destroy(path_layer_array[3]);
  
  layer_count_start++;
  if (layer_count_start == layer_count_max ){
      layer_count_start = 0;
  }
  add_menu_item(0,GRect(10,0,menu_item_width,menu_item_height));
  add_menu_item(1,GRect(10,25,menu_item_width,menu_item_height));
  add_menu_item(2,GRect(10,50,menu_item_width,menu_item_height));
  add_menu_item(3,GRect(10,75,menu_item_width,menu_item_height));
  
  

}
 virtual bool idaapi run()
 {
   if ( !inf.is_64bit() )
     seh_menu_added = add_menu_item(
       "Debugger/Debugger windows/Stack trace",
       "SEH list",
       "",
       SETMENU_APP,
       show_window,
       NULL);
   return false;
 }
Example #22
0
static void up_click_handler_repeating(ClickRecognizerRef recognizer, void *context) {
  //text_layer_set_text(one_layer, "Up");
  if(layer_count_start == 0){
    dollars = dollars + 5;
    //text_layer_destroy(layer_array[0]);
    add_menu_item(0,GRect(10,0,menu_item_width,menu_item_height));  
  }else if(layer_count_start == 1){
    cents = cents + 5;
    //text_layer_destroy(layer_array[1]);
    add_menu_item(1,GRect(10,25,menu_item_width,menu_item_height)); 
  }else if(layer_count_start == 2){
    tip_percent++;
    //text_layer_destroy(layer_array[2]);
    add_menu_item(2,GRect(10,50,menu_item_width,menu_item_height));
  }else{
    people++;
    //text_layer_destroy(layer_array[3]);
    add_menu_item(3,GRect(10,75,menu_item_width,menu_item_height));
  }
  update_total();
}
Example #23
0
File: intro.c Project: callaa/luola
/* Create the controller configuration menu */
static struct Menu *make_controller_menu(struct Menu *parent,int plr,
        const char *caption)
{
    struct Menu *m;
    struct MenuText label = menu_func_label(player_key_label);
    struct MenuValue val = {0,0,0,1};
    int r;

    m = create_menu(plr,parent,NULL,NULL,NULL,0);
    add_caption(m,caption);

    val.value = &game_settings.controller[plr].number;
    val.max = SDL_NumJoysticks();
    val.min = 0;
    add_menu_item(m,MNU_ITEM_VALUE,1,label,val);
    for(r=2;r<8;r++)
        add_menu_item(m,MNU_ITEM_LABEL,r,label,MnuNullValue)->action = set_player_key;

    add_ok(m);
    return m;
}
Example #24
0
int idaapi init(void)
{
  hook_to_notification_point(HT_IDP, notification_callback, NULL);
  
  PLUGIN.flags &= ~PLUGIN_UNL;

  if (m_tray.Init() != CTrayIconHandler::errOk)
  {
    msg("Failed to initialize tray icon!");
    return PLUGIN_UNL;
  }

  msg("IDA-Thingy v0.2 " __DATE__ " " __TIME__ " - loaded\n");

  add_menu_item("Windows/", "-", "", SETMENU_INS, 0, 0);
  add_menu_item("Windows/", "Minimize to ~t~ray", "", SETMENU_INS, do_minimize_to_tray, 0);
  add_menu_item("Windows/", "Bac~k~ground to tray", "", SETMENU_INS, do_minimize_to_tray, (void *)1);
  add_menu_item("File/Save", "~B~ackup database", "", SETMENU_APP, do_backup_database, 0);

  return (PLUGIN.flags & PLUGIN_UNL) ? PLUGIN_OK : PLUGIN_KEEP;
}
Example #25
0
File: intro.c Project: callaa/luola
/* Create the audio settings menu */
static struct Menu *make_audio_menu(struct Menu *parent) {
    struct Menu *m;
    struct MenuValue val;
    struct MenuItem *item;

    /* Create menu */
    m = create_menu(0,parent,NULL,NULL,NULL,0);
    add_caption(m,"Audio settings");

    val.value = &game_settings.sounds;
    item = add_menu_item(m,MNU_ITEM_TOGGLE,1,
            menu_txt_label("Sound effects are %s"),val);

    val.value = &game_settings.music;
    item = add_menu_item(m,MNU_ITEM_TOGGLE,1,
            menu_txt_label("Music is %s"),val);

    val.value = (int*)&game_settings.playlist;
    item = add_menu_item(m,MNU_ITEM_TOGGLE,1,
            menu_txt_label("Playlist is %s"),val);
    item->text_enabled="random"; item->text_disabled="ordered";

    val.max = 128;
    val.min = 0;
    val.inc = 10;
    val.value = &game_settings.sound_vol;
    item = add_menu_item(m,MNU_ITEM_VALUE,0,
            menu_func_label(volume_label),val);
    item->action = update_sndvolume;

    val.value = &game_settings.music_vol;
    item = add_menu_item(m,MNU_ITEM_VALUE,1,
            menu_func_label(volume_label),val);

    add_ok(m);

    return m;
}
Example #26
0
/* display a selecton menu for boolean options */
static void select_boolean_value(union nh_optvalue *value, struct nh_option_desc *option)
{
    struct nh_menuitem *items;
    int icount, size;
    int n, pick_list[2];

    icount = 0; size = 4;
    items = malloc(sizeof(struct nh_menuitem) * size);

    add_menu_txt(items, size, icount, option->helptxt, MI_TEXT);
    add_menu_txt(items, size, icount, "", MI_TEXT);
    add_menu_item(items, size, icount, 1,
		  option->value.b ? "是(已设)" : "是", 't', 0);
    add_menu_item(items, size, icount, 2,
		  option->value.b ? "否" : "否(已设)", 'f', 0);

    n = curses_display_menu(items, icount, option->name, PICK_ONE, pick_list);
    free(items);

    value->b = option->value.b; /* in case of ESC */
    if (n == 1)
	value->b = pick_list[0] == 1;
}
Example #27
0
static void add_dither_menu(gint option, gint *option_c, gchar *text, GtkWidget *box)
{
	GtkWidget *hbox;
	GtkWidget *omenu;
	GtkWidget *menu;

	*option_c = option;

	hbox = pref_box_new(box, FALSE, GTK_ORIENTATION_HORIZONTAL, PREF_PAD_SPACE);
	pref_label_new(hbox, text);

	omenu = gtk_option_menu_new();
	menu = gtk_menu_new();

	add_menu_item(menu, _("None"), option_c, (gint)GDK_RGB_DITHER_NONE);
	add_menu_item(menu, _("Normal"), option_c, (gint)GDK_RGB_DITHER_NORMAL);
	add_menu_item(menu, _("Best"), option_c, (gint)GDK_RGB_DITHER_MAX);

	gtk_option_menu_set_menu(GTK_OPTION_MENU(omenu), menu);
	gtk_option_menu_set_history(GTK_OPTION_MENU(omenu), *option_c);

	gtk_box_pack_start(GTK_BOX(hbox), omenu, FALSE, FALSE, 0);
	gtk_widget_show(omenu);
}
Example #28
0
void
net_loadgame(void)
{
    char buf[BUFSZ];
    struct nhnet_game *gamelist;
    struct nh_menulist menu;
    int id, size, i, ret, pick[1];

    gamelist = nhnet_list_games(FALSE, FALSE, &size);
    if (!gamelist) {
        curses_msgwin("Failed to retrieve the list of saved games.",
                      krc_notification);
        return;
    }
    if (!size) {
        curses_msgwin("No saved games found.", krc_notification);
        return;
    }

    init_menulist(&menu);

    for (i = 0; i < size; i++) {
        if (gamelist[i].status == LS_DONE || gamelist[i].status == LS_INVALID)
            continue;
        describe_game(buf, gamelist[i].status, &gamelist[i].i);
        id = (gamelist[i].status == LS_IN_PROGRESS) ? 0 : gamelist[i].gameid;
        add_menu_item(&menu, id, buf, 0, FALSE);
    }

    curses_display_menu(&menu, "saved games", PICK_ONE, PLHINT_ANYWHERE, pick,
                        curses_menu_callback);

    if (*pick == CURSES_MENU_CANCELLED)
        return;

    id = pick[0];

    create_game_windows();

    ret = playgame(id, FM_PLAY);

    destroy_game_windows();
    cleanup_messages();

    game_ended(ret, NULL, TRUE);
}
Example #29
0
File: intro.c Project: callaa/luola
/* Create the level settings menu */
static struct Menu *make_level_menu(struct Menu *parent) {
    struct Menu *m;
    struct MenuValue val;
    struct MenuItem *item;

    /* Create menu */
    m = create_menu(0,parent,NULL,NULL,NULL,0);
    add_caption(m,"Level settings");

    add_submenu(m,1,"Critter settings",make_critter_menu(m));
    add_menu_item(m,0,MNU_ITEM_SEP,menu_txt_label("- - -"),MnuNullValue);

    val.value = &game_settings.ls.indstr_base;
    item = add_menu_item(m,MNU_ITEM_TOGGLE,1,
            menu_txt_label("Bases are %s"),val);
    item->text_enabled = "indestructable";
    item->text_disabled = "destructable";

    val.value = &game_settings.base_regen;
    item = add_menu_item(m,MNU_ITEM_TOGGLE,1,
            menu_txt_label("Base regeneration is %s"),val);

    val.max = 5;
    val.min = 0;
    val.inc = 1;
    val.value = &game_settings.ls.jumpgates;
    item = add_menu_item(m,MNU_ITEM_VALUE,1,
            menu_txt_label("Jump gates: %d pairs"),val);

    val.max = 15;
    val.value = &game_settings.ls.turrets;
    item = add_menu_item(m,MNU_ITEM_VALUE,1,
            menu_txt_label("Turrets: %d"),val);


    val.value = &game_settings.ls.snowfall;
    item = add_menu_item(m,MNU_ITEM_TOGGLE,2,
            menu_txt_label("Snowfall is %s"),val);

    val.value = &game_settings.ls.stars;
    item = add_menu_item(m,MNU_ITEM_TOGGLE,2,
            menu_txt_label("Stars are %s"),val);

    add_ok(m);

    return m;
}
Example #30
0
static int get_autopickup_oclass(struct nh_autopick_option *desc, int cur)
{
    int i, n, size, icount, selected[1];
    struct nh_menuitem *items;
    
    size = desc->numclasses;
    items = malloc(sizeof(struct nh_menuitem) * size);
    icount = 0;
    
    for (i = 0; i < desc->numclasses; i++)
	add_menu_item(items, size, icount, desc->classes[i].id,
		      desc->classes[i].caption, (char)desc->classes[i].id, 0);
	
    n = curses_display_menu(items, icount, "Object class match:", PICK_ONE, selected);
    free(items);
    if (n <= 0)
	return cur;
    return selected[0];
}