Ejemplo n.º 1
0
static void create_menu(MathWindow* window)
{
    GtkAccelGroup* accel_group;
    GtkWidget* menu;
    GtkWidget* menu_item;
    GSList* group = NULL;

    accel_group = gtk_accel_group_new();
    gtk_window_add_accel_group(GTK_WINDOW(window), accel_group);

    /* Calculator menu */
    #define CALCULATOR_MENU_LABEL _("_Calculator")
    /* Mode menu */
    #define MODE_MENU_LABEL _("_Mode")
    /* Help menu label */
    #define HELP_MENU_LABEL _("_Help")
    /* Basic menu label */
    #define MODE_BASIC_LABEL _("_Basic")
    /* Advanced menu label */
    #define MODE_ADVANCED_LABEL _("_Advanced")
    /* Financial menu label */
    #define MODE_FINANCIAL_LABEL _("_Financial")
    /* Programming menu label */
    #define MODE_PROGRAMMING_LABEL _("_Programming")
    /* Help>Contents menu label */
    #define HELP_CONTENTS_LABEL _("_Contents")

    menu = add_menu(window->priv->menu_bar, CALCULATOR_MENU_LABEL);
    add_menu_item(menu, gtk_image_menu_item_new_from_stock(GTK_STOCK_COPY, accel_group), G_CALLBACK(copy_cb), window);
    add_menu_item(menu, gtk_image_menu_item_new_from_stock(GTK_STOCK_PASTE, accel_group), G_CALLBACK(paste_cb), window);
    menu_item = add_menu_item(menu, gtk_image_menu_item_new_from_stock(GTK_STOCK_UNDO, accel_group), G_CALLBACK(undo_cb), window);
    gtk_widget_add_accelerator(menu_item, "activate", accel_group, GDK_KEY_Z, GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE);
    menu_item = add_menu_item(menu, gtk_image_menu_item_new_from_stock(GTK_STOCK_REDO, accel_group), G_CALLBACK(redo_cb), window);
    gtk_widget_add_accelerator(menu_item, "activate", accel_group, GDK_KEY_Z, GDK_CONTROL_MASK | GDK_SHIFT_MASK, GTK_ACCEL_VISIBLE);
    add_menu_item(menu, gtk_separator_menu_item_new(), NULL, NULL);
    add_menu_item(menu, gtk_image_menu_item_new_from_stock(GTK_STOCK_PREFERENCES, accel_group), G_CALLBACK(show_preferences_cb), window);
    add_menu_item(menu, gtk_separator_menu_item_new(), NULL, NULL);
    menu_item = add_menu_item(menu, gtk_image_menu_item_new_from_stock(GTK_STOCK_QUIT, accel_group), G_CALLBACK(quit_cb), window);
    gtk_widget_add_accelerator(menu_item, "activate", accel_group, GDK_KEY_W, GDK_CONTROL_MASK, 0);

    menu = add_menu(window->priv->menu_bar, MODE_MENU_LABEL);
    window->priv->mode_basic_menu_item = add_menu_item(menu, radio_menu_item_new(&group, MODE_BASIC_LABEL), G_CALLBACK(mode_changed_cb), window);
    g_object_set_data(G_OBJECT(window->priv->mode_basic_menu_item), "calcmode", GINT_TO_POINTER(BASIC));
    window->priv->mode_advanced_menu_item = add_menu_item(menu, radio_menu_item_new(&group, MODE_ADVANCED_LABEL), G_CALLBACK(mode_changed_cb), window);
    g_object_set_data(G_OBJECT(window->priv->mode_advanced_menu_item), "calcmode", GINT_TO_POINTER(ADVANCED));
    window->priv->mode_financial_menu_item = add_menu_item(menu, radio_menu_item_new(&group, MODE_FINANCIAL_LABEL), G_CALLBACK(mode_changed_cb), window);
    g_object_set_data(G_OBJECT(window->priv->mode_financial_menu_item), "calcmode", GINT_TO_POINTER(FINANCIAL));
    window->priv->mode_programming_menu_item = add_menu_item(menu, radio_menu_item_new(&group, MODE_PROGRAMMING_LABEL), G_CALLBACK(mode_changed_cb), window);
    g_object_set_data(G_OBJECT(window->priv->mode_programming_menu_item), "calcmode", GINT_TO_POINTER(PROGRAMMING));

    menu = add_menu(window->priv->menu_bar, HELP_MENU_LABEL);
    menu_item = add_menu_item(menu, gtk_menu_item_new_with_mnemonic(HELP_CONTENTS_LABEL), G_CALLBACK(help_cb), window);
    gtk_widget_add_accelerator(menu_item, "activate", accel_group, GDK_KEY_F1, 0, GTK_ACCEL_VISIBLE);
    add_menu_item(menu, gtk_image_menu_item_new_from_stock(GTK_STOCK_ABOUT, accel_group), G_CALLBACK(about_cb), window);
}
Ejemplo n.º 2
0
	menu *menu::add_menu(int position, const wchar_t *caption, bool has_child /* =false */)
	{
		auto m = add_menu(position, menu_id, caption, has_child);
		if(m != nullptr)
			menu_id++;
		return m;
	}
Ejemplo n.º 3
0
/* Compute the Disks menu */
void compute_disks(struct s_hdt_menu *menu, struct diskinfo *disk_info, struct s_hardware *hardware)
{
  char buffer[MENULEN + 1];
  int nb_sub_disk_menu = 0;

  /* No need to compute that menu if no disks were detected */
  menu->disk_menu.items_count = 0;
  if (hardware->disks_count == 0) return;

  for (int i = 0; i < 0xff; i++) {
    if (compute_disk_module
        ((struct s_my_menu*) &(menu->disk_sub_menu), nb_sub_disk_menu, disk_info,
         i) == 0)
      nb_sub_disk_menu++;
  }

  menu->disk_menu.menu = add_menu(" Disks ", -1);

  for (int i = 0; i < nb_sub_disk_menu; i++) {
    snprintf(buffer, sizeof buffer, " Disk <%d> ", i);
    add_item(buffer, "Disk", OPT_SUBMENU, NULL,
       menu->disk_sub_menu[i].menu);
    menu->disk_menu.items_count++;
  }
  printf("MENU: Disks menu done (%d items)\n",
         menu->disk_menu.items_count);
}
Ejemplo n.º 4
0
nds_cmd_t nds_get_pan_direction()
{
  winid win;
  menu_item *sel;
  ANY_P ids[4];
  nds_cmd_t cmd;
  int res;

  win = create_nhwindow(NHW_MENU);
  start_menu(win);

  ids[0].a_int = CMD_PAN_UP;
  ids[1].a_int = CMD_PAN_DOWN;
  ids[2].a_int = CMD_PAN_LEFT;
  ids[3].a_int = CMD_PAN_RIGHT;

  add_menu(win, NO_GLYPH, &(ids[0]), 0, 0, 0, "Pan Up", 0);
  add_menu(win, NO_GLYPH, &(ids[1]), 0, 0, 0, "Pan Down", 0);
  add_menu(win, NO_GLYPH, &(ids[2]), 0, 0, 0, "Pan Left", 0);
  add_menu(win, NO_GLYPH, &(ids[3]), 0, 0, 0, "Pan Right", 0);

  end_menu(win, "What Direction?");
  res = select_menu(win, PICK_ONE, &sel);
  destroy_nhwindow(win);

  if (res <= 0) {
    cmd.f_char = -1;
    cmd.name = NULL;
  } else {
    cmd.f_char = sel->item.a_int;

    if (cmd.f_char == CMD_PAN_UP) {
      cmd.name = "Pan Up";
    } else if (cmd.f_char == CMD_PAN_DOWN) {
      cmd.name = "Pan Down";
    } else if (cmd.f_char == CMD_PAN_LEFT) {
      cmd.name = "Pan Left";
    } else if (cmd.f_char == CMD_PAN_RIGHT) {
      cmd.name = "Pan Right";
    }
  }

  NULLFREE(sel);

  return cmd;
}
Ejemplo n.º 5
0
void ReverbMenu::create_objects(BC_Hash *defaults)
{
    add_menu(filemenu = new BC_Menu(_("File")));
    filemenu->add_item(load = new ReverbLoad(reverb, this));
    filemenu->add_item(save = new ReverbSave(reverb, this));
    //filemenu->add_item(set_default = new ReverbSetDefault);
    load_defaults(defaults);
    prev_load_thread = new ReverbLoadPrevThread(reverb, this);
}
Ejemplo n.º 6
0
void ContextMenu::release()
{
// save the popup handle
 Popup pop(m_handle);
// create a top-level menu and add the popup to it...
 Menu::create();
 add_menu(pop);
// restore the popup handle and add it to the form
 m_handle = (Handle)pop;
 m_main_form->set_popup_menu(HMENU(m_handle));
 m_menu_handler->set_form(m_main_form);
 m_main_form->add_handler(m_menu_handler);
}
Ejemplo n.º 7
0
/* Computing Syslinux menu */
void compute_syslinuxmenu(struct s_my_menu *menu, struct s_hardware *hardware)
{
    char syslinux_fs_menu[24];
    char buffer[SUBMENULEN + 1];
    char statbuffer[STATLEN + 1];

    memset(syslinux_fs_menu, 0, sizeof syslinux_fs_menu);

    snprintf(syslinux_fs_menu, sizeof syslinux_fs_menu, " %s ",
	     hardware->syslinux_fs);
    menu->menu = add_menu(syslinux_fs_menu, -1);
    menu->items_count = 0;
    set_menu_pos(SUBMENU_Y, SUBMENU_X);

    snprintf(buffer, sizeof buffer, "Bootloader : %s", hardware->syslinux_fs);
    snprintf(statbuffer, sizeof statbuffer, "Bootloader: %s",
	     hardware->syslinux_fs);
    add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
    menu->items_count++;

    snprintf(buffer, sizeof buffer, "Version    : %s",
	     hardware->sv->version_string);
    snprintf(statbuffer, sizeof statbuffer, "Version: %s",
	     hardware->sv->version_string);
    add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
    menu->items_count++;

    snprintf(buffer, sizeof buffer, "Version    : %u", hardware->sv->version);
    snprintf(statbuffer, sizeof statbuffer, "Version: %u",
	     hardware->sv->version);
    add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
    menu->items_count++;

    snprintf(buffer, sizeof buffer, "Max API    : %u", hardware->sv->max_api);
    snprintf(statbuffer, sizeof statbuffer, "Max API: %u",
	     hardware->sv->max_api);
    add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
    menu->items_count++;

    add_item("", "", OPT_SEP, "", 0);

    snprintf(buffer, sizeof buffer, "%s", hardware->sv->copyright_string);
    /* Remove the trailing LF in the copyright string to avoid scrolling */
    snprintf(statbuffer, sizeof statbuffer, "%s",
	     remove_trailing_lf(hardware->sv->copyright_string));
    add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
    menu->items_count++;

    printf("MENU: Syslinux menu done (%d items)\n", menu->items_count);
}
Ejemplo n.º 8
0
/* Submenu for the vesa card */
static void compute_vesa_card(struct s_my_menu *menu,
			      struct s_hardware *hardware)
{
    char buffer[SUBMENULEN + 1];
    char statbuffer[STATLEN + 1];

    menu->menu = add_menu(" VESA Bios ", -1);
    menu->items_count = 0;
    set_menu_pos(SUBMENU_Y, SUBMENU_X);

    snprintf(buffer, sizeof buffer, "VESA Version: %d.%d",
	     hardware->vesa.major_version, hardware->vesa.minor_version);
    snprintf(statbuffer, sizeof statbuffer, "Version: %d.%d",
	     hardware->vesa.major_version, hardware->vesa.minor_version);
    add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
    menu->items_count++;

    snprintf(buffer, sizeof buffer, "Vendor      : %s", hardware->vesa.vendor);
    snprintf(statbuffer, sizeof statbuffer, "Vendor Name: %s",
	     hardware->vesa.vendor);
    add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
    menu->items_count++;

    snprintf(buffer, sizeof buffer, "Product     : %s", hardware->vesa.product);
    snprintf(statbuffer, sizeof statbuffer, "Product Name: %s",
	     hardware->vesa.product);
    add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
    menu->items_count++;

    snprintf(buffer, sizeof buffer, "Product Rev.: %s",
	     hardware->vesa.product_revision);
    snprintf(statbuffer, sizeof statbuffer, "Produt Revision: %s",
	     hardware->vesa.product_revision);
    add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
    menu->items_count++;

    snprintf(buffer, sizeof buffer, "Software Rev: %d",
	     hardware->vesa.software_rev);
    snprintf(statbuffer, sizeof statbuffer, "Software Revision: %d",
	     hardware->vesa.software_rev);
    add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
    menu->items_count++;

    snprintf(buffer, sizeof buffer, "Memory (KB) : %d",
	     hardware->vesa.total_memory * 64);
    snprintf(statbuffer, sizeof statbuffer, "Memory (KB): %d",
	     hardware->vesa.total_memory * 64);
    add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
    menu->items_count++;
}
Ejemplo n.º 9
0
const char *nds_get_bool_option()
{
  int i, j;
  int optcnt;

  winid win;
  menu_item *sel;
  ANY_P *ids;
  const char *res;

  for (i = 0, optcnt = 0; boolopt[i].name; i++) {
    if (boolopt[i].addr != NULL) {
      optcnt++;
    }
  }

  ids = (ANY_P *)malloc(sizeof(ANY_P) * optcnt);

  win = create_nhwindow(NHW_MENU);

  start_menu(win);

  for (i = 0, j = 0; boolopt[i].name; i++) {
    if ((boolopt[i].addr == NULL) || (boolopt[i].optflags != SET_IN_GAME)) {
      continue;
    }

    ids[j].a_int = i + 1;
    add_menu(win, NO_GLYPH, &(ids[j]), 0, 0, 0, boolopt[i].name, 0);

    j++;
  }

  end_menu(win, "Which Option Should Be Toggled?");

  if (select_menu(win, PICK_ONE, &sel) >= 0) {
    res = boolopt[sel->item.a_int - 1].name;
  } else {
    res = NULL;
  }

  destroy_nhwindow(win);
  NULLFREE(sel);
  NULLFREE(ids);

  return res;
}
Ejemplo n.º 10
0
/* Main VESA Menu*/
int compute_VESA(struct s_hdt_menu *hdt_menu, struct s_hardware *hardware)
{
    char buffer[15];
    compute_vesa_card(&hdt_menu->vesa_card_menu, hardware);
    compute_vesa_modes(&hdt_menu->vesa_modes_menu, hardware);
    hdt_menu->vesa_menu.menu = add_menu(" VESA ", -1);
    hdt_menu->vesa_menu.items_count = 0;

    add_item("VESA Bios", "VESA Bios", OPT_SUBMENU, NULL,
	     hdt_menu->vesa_card_menu.menu);
    hdt_menu->vesa_menu.items_count++;
    snprintf(buffer, sizeof buffer, "%s (%d)", "Modes",
	     hardware->vesa.vmi_count);
    add_item(buffer, "VESA Modes", OPT_SUBMENU, NULL,
	     hdt_menu->vesa_modes_menu.menu);
    hdt_menu->vesa_menu.items_count++;
    printf("MENU: VESA menu done (%d items)\n",
	   hdt_menu->vesa_menu.items_count);
    return 0;
}
Ejemplo n.º 11
0
/* Computing About menu*/
void compute_aboutmenu(struct s_my_menu *menu)
{
  char buffer[SUBMENULEN + 1];
  char statbuffer[STATLEN + 1];

  menu->menu = add_menu(" About ", -1);
  menu->items_count = 0;

  set_menu_pos(SUBMENU_Y, SUBMENU_X);

  snprintf(buffer, sizeof buffer, "Product     : %s", PRODUCT_NAME);
  snprintf(statbuffer, sizeof statbuffer, "Product : %s", PRODUCT_NAME);
  add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
  menu->items_count++;

  snprintf(buffer, sizeof buffer, "Version     : %s", VERSION);
  snprintf(statbuffer, sizeof statbuffer, "Version : %s", VERSION);
  add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
  menu->items_count++;

  snprintf(buffer, sizeof buffer, "Author      : %s", AUTHOR);
  snprintf(statbuffer, sizeof statbuffer, "Author  : %s", AUTHOR);
  add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
  menu->items_count++;

  snprintf(buffer, sizeof buffer, "Contact     : %s", CONTACT);
  snprintf(statbuffer, sizeof statbuffer, "Contact : %s", CONTACT);
  add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
  menu->items_count++;

  char *contributors[NB_CONTRIBUTORS] = CONTRIBUTORS;
  for (int c=0; c<NB_CONTRIBUTORS; c++) {
   snprintf(buffer, sizeof buffer, "Contributor : %s", contributors[c]);
   snprintf(statbuffer, sizeof statbuffer, "Contributor : %s", contributors[c]);
   add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
   menu->items_count++;
  }

  printf("MENU: About menu done (%d items)\n", menu->items_count);
}
Ejemplo n.º 12
0
static void
add_cb (GtkAction *action,
        PlacemarksPlugin *plugin)
{
  PlacemarksPluginPrivate *priv;
  gdouble lat, lon;
  gint zoom;
  GtkWidget *dialog;
  const gchar *name;
  gchar *id;
  gint response;
  GtkTreeIter iter;

  priv = PLACEMARKS_PLUGIN (plugin)->priv;
  dialog = add_dialog_new ();
  gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (priv->window));

  response = gtk_dialog_run (GTK_DIALOG (dialog));
  name = add_dialog_get_name (ADD_DIALOG (dialog));
  gtk_widget_hide (dialog);

  if (response != GTK_RESPONSE_OK)
    return;

  g_object_get (priv->map_view,
                "latitude", &lat,
                "longitude", &lon,
                "zoom-level", &zoom,
                NULL);

  id = g_strdup_printf ("Placemark%d", priv->placemark_count),

  iter = add_placemark (plugin, id, name, lat, lon, zoom);
  add_menu (plugin, id, name, &iter);

  save_placemarks (plugin);

  g_free (id);
}
Ejemplo n.º 13
0
static void
eom_detail_window_init(EomDetailWindow *self)
{
    GtkWidget *panarea;
    GtkWidget *clabel, *rlabel;
    GtkWidget *vbox;

    add_menu(self);

    panarea = hildon_pannable_area_new();
    g_object_set(G_OBJECT(panarea),
                 "mov-mode", HILDON_MOVEMENT_MODE_VERT,
                 NULL);
    gtk_container_add(GTK_CONTAINER(self), panarea);

    self->volsbox = gtk_hbox_new(TRUE, 5);
    hildon_pannable_area_add_with_viewport(HILDON_PANNABLE_AREA(panarea),
                                           self->volsbox);

    vbox = gtk_vbox_new(FALSE, 0);
    gtk_box_pack_start(GTK_BOX(self->volsbox), vbox, TRUE, TRUE, 0);

    clabel = gtk_label_new("Collected:");
    gtk_misc_set_alignment(GTK_MISC(clabel), 0.0, 0.5);
    gtk_box_pack_start(GTK_BOX(vbox), clabel, FALSE, FALSE, 0);

    self->ctable = gtk_table_new(0, 0, TRUE);
    gtk_box_pack_start(GTK_BOX(vbox), self->ctable, FALSE, FALSE, 0);

    vbox = gtk_vbox_new(FALSE, 0);
    gtk_box_pack_start(GTK_BOX(self->volsbox), vbox, TRUE, TRUE, 0);

    rlabel = gtk_label_new("Read:");
    gtk_misc_set_alignment(GTK_MISC(rlabel), 0.0, 0.5);
    gtk_box_pack_start(GTK_BOX(vbox), rlabel, FALSE, FALSE, 0);

    self->rtable = gtk_table_new(0, 0, TRUE);
    gtk_box_pack_start(GTK_BOX(vbox), self->rtable, FALSE, FALSE, 0);
}
Ejemplo n.º 14
0
static gboolean
load_menus (PlacemarksPlugin *plugin)
{
  GtkUIManager *manager;
  PlacemarksPluginPrivate *priv;
  GtkTreeIter iter;

  priv = PLACEMARKS_PLUGIN (plugin)->priv;
  manager = emerillon_window_get_ui_manager (priv->window);

  priv->menu_action_group = gtk_action_group_new ("PlacemarksGoActions");
  gtk_action_group_set_translation_domain (priv->menu_action_group,
                                           GETTEXT_PACKAGE);
  gtk_ui_manager_insert_action_group (manager,
                                      priv->menu_action_group,
                                      -1);

  if (gtk_tree_model_get_iter_first (priv->model, &iter))
    {
      do
        {
          gchar *name;
          gchar *id;

          gtk_tree_model_get (priv->model, &iter,
                              COL_ID, &id,
                              COL_NAME, &name,
                              -1 );

          add_menu (plugin, id, name, &iter);

          g_free (id);
          g_free (name);
        }
      while (gtk_tree_model_iter_next (priv->model, &iter));
    }
  return FALSE;
}
Ejemplo n.º 15
0
/* Submenu for the vesa card */
void compute_vesa_modes(struct s_my_menu *menu, struct s_hardware *hardware)
{
    char buffer[56];
    char statbuffer[STATLEN];

    menu->menu = add_menu(" VESA Modes ", -1);
    menu->items_count = 0;
    set_menu_pos(SUBMENU_Y, SUBMENU_X);
    for (int i = 0; i < hardware->vesa.vmi_count; i++) {
	struct vesa_mode_info *mi = &hardware->vesa.vmi[i].mi;
	/* Sometimes, vesa bios reports 0x0 modes
	 * We don't need to display that ones */
	if ((mi->h_res == 0) || (mi->v_res == 0))
	    continue;
	snprintf(buffer, sizeof buffer, "%4u x %4u x %2ubits vga=%3d",
		 mi->h_res, mi->v_res, mi->bpp,
		 hardware->vesa.vmi[i].mode + 0x200);
	snprintf(statbuffer, sizeof statbuffer, "%4ux%4ux%2ubits vga=%3d",
		 mi->h_res, mi->v_res, mi->bpp,
		 hardware->vesa.vmi[i].mode + 0x200);
	add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
	menu->items_count++;
    }
}
Ejemplo n.º 16
0
/* Compute Processor menu */
void compute_processor(struct s_my_menu *menu, struct s_hardware *hardware)
{
    char buffer[SUBMENULEN + 1];
    char buffer1[SUBMENULEN + 1];
    char statbuffer[STATLEN + 1];

    menu->menu = add_menu(" Main Processor ", -1);
    menu->items_count = 0;
    set_menu_pos(SUBMENU_Y, SUBMENU_X);

    snprintf(buffer, sizeof buffer, "Vendor    : %s", hardware->cpu.vendor);
    snprintf(statbuffer, sizeof statbuffer, "Vendor: %s", hardware->cpu.vendor);
    add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
    menu->items_count++;

    snprintf(buffer, sizeof buffer, "Model     : %s", hardware->cpu.model);
    snprintf(statbuffer, sizeof statbuffer, "Model: %s", hardware->cpu.model);
    add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
    menu->items_count++;

    snprintf(buffer, sizeof buffer, "CPU Cores : %d", hardware->cpu.num_cores);
    snprintf(statbuffer, sizeof statbuffer, "Number of CPU cores: %d",
	     hardware->cpu.num_cores);
    add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
    menu->items_count++;

    snprintf(buffer, sizeof buffer, "L1 Cache  : %dK + %dK (I+D)",
	     hardware->cpu.l1_instruction_cache_size,
	     hardware->cpu.l1_data_cache_size);
    snprintf(statbuffer, sizeof statbuffer,
	     "L1 Cache Size: %dK + %dK (Instruction + Data)",
	     hardware->cpu.l1_instruction_cache_size,
	     hardware->cpu.l1_data_cache_size);
    add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
    menu->items_count++;

    snprintf(buffer, sizeof buffer, "L2 Cache  : %dK",
	     hardware->cpu.l2_cache_size);
    snprintf(statbuffer, sizeof statbuffer, "L2 Cache Size: %dK",
	     hardware->cpu.l2_cache_size);
    add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
    menu->items_count++;

    snprintf(buffer, sizeof buffer, "Family ID : %d", hardware->cpu.family);
    snprintf(statbuffer, sizeof statbuffer, "Family ID: %d",
	     hardware->cpu.family);
    add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
    menu->items_count++;

    snprintf(buffer, sizeof buffer, "Model  ID : %d", hardware->cpu.model_id);
    snprintf(statbuffer, sizeof statbuffer, "Model  ID: %d",
	     hardware->cpu.model_id);
    add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
    menu->items_count++;

    snprintf(buffer, sizeof buffer, "Stepping  : %d", hardware->cpu.stepping);
    snprintf(statbuffer, sizeof statbuffer, "Stepping: %d",
	     hardware->cpu.stepping);
    add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
    menu->items_count++;

    if (hardware->is_dmi_valid) {
	snprintf(buffer, sizeof buffer, "FSB       : %d",
		 hardware->dmi.processor.external_clock);
	snprintf(statbuffer, sizeof statbuffer,
		 "Front Side Bus (MHz): %d",
		 hardware->dmi.processor.external_clock);
	add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
	menu->items_count++;

	snprintf(buffer, sizeof buffer, "Cur. Speed: %d",
		 hardware->dmi.processor.current_speed);
	snprintf(statbuffer, sizeof statbuffer,
		 "Current Speed (MHz): %d",
		 hardware->dmi.processor.current_speed);
	add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
	menu->items_count++;

	snprintf(buffer, sizeof buffer, "Max Speed : %d",
		 hardware->dmi.processor.max_speed);
	snprintf(statbuffer, sizeof statbuffer, "Max Speed (MHz): %d",
		 hardware->dmi.processor.max_speed);
	add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
	menu->items_count++;

	snprintf(buffer, sizeof buffer, "Upgrade   : %s",
		 hardware->dmi.processor.upgrade);
	snprintf(statbuffer, sizeof statbuffer, "Upgrade: %s",
		 hardware->dmi.processor.upgrade);
	add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
	menu->items_count++;

	snprintf(buffer, sizeof buffer, "Voltage   : %d.%02d",
		 hardware->dmi.processor.voltage_mv / 1000,
		 hardware->dmi.processor.voltage_mv -
		 ((hardware->dmi.processor.voltage_mv / 1000) * 1000));
	snprintf(statbuffer, sizeof statbuffer, "Voltage (V) : %d.%02d",
		 hardware->dmi.processor.voltage_mv / 1000,
		 hardware->dmi.processor.voltage_mv -
		 ((hardware->dmi.processor.voltage_mv / 1000) * 1000));
	add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
	menu->items_count++;
    }

    if (hardware->cpu.flags.smp) {
	snprintf(buffer, sizeof buffer, "SMP       : Yes");
	snprintf(statbuffer, sizeof statbuffer, "SMP: Yes");
    } else {
	snprintf(buffer, sizeof buffer, "SMP       : No");
	snprintf(statbuffer, sizeof statbuffer, "SMP: No");
    }
    add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
    menu->items_count++;

    if (hardware->cpu.flags.lm) {
	snprintf(buffer, sizeof buffer, "x86_64    : Yes");
	snprintf(statbuffer, sizeof statbuffer,
		 "x86_64 compatible processor: Yes");
    } else {
	snprintf(buffer, sizeof buffer, "X86_64    : No");
	snprintf(statbuffer, sizeof statbuffer,
		 "X86_64 compatible processor: No");
    }
    add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
    menu->items_count++;

    if ((hardware->cpu.flags.vmx) || (hardware->cpu.flags.svm)) {
	snprintf(buffer, sizeof buffer, "Hw Virt.  : Yes");
	snprintf(statbuffer, sizeof statbuffer,
		 "Hardware Virtualisation Capable: Yes");
    } else {
	snprintf(buffer, sizeof buffer, "Hw Virt.  : No");
	snprintf(statbuffer, sizeof statbuffer,
		 "Hardware Virtualisation Capabable : No");
    }
    add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
    menu->items_count++;

    memset(buffer1, 0, sizeof(buffer1));
    show_flag(menu, buffer1, hardware->cpu.flags.fpu, "fpu ", false);
    show_flag(menu, buffer1, hardware->cpu.flags.vme, "vme ", false);
    show_flag(menu, buffer1, hardware->cpu.flags.de, "de ", false);
    show_flag(menu, buffer1, hardware->cpu.flags.pse, "pse ", false);
    show_flag(menu, buffer1, hardware->cpu.flags.tsc, "tsc ", false);
    show_flag(menu, buffer1, hardware->cpu.flags.msr, "msr ", false);
    show_flag(menu, buffer1, hardware->cpu.flags.pae, "pae ", false);
    show_flag(menu, buffer1, hardware->cpu.flags.mce, "mce ", false);
    show_flag(menu, buffer1, hardware->cpu.flags.cx8, "cx8 ", false);
    show_flag(menu, buffer1, hardware->cpu.flags.apic, "apic ", false);
    show_flag(menu, buffer1, hardware->cpu.flags.sep, "sep ", false);
    show_flag(menu, buffer1, hardware->cpu.flags.mtrr, "mtrr ", false);
    show_flag(menu, buffer1, hardware->cpu.flags.pge, "pge ", false);
    show_flag(menu, buffer1, hardware->cpu.flags.mca, "mca ", false);
    show_flag(menu, buffer1, hardware->cpu.flags.cmov, "cmov ", false);
    show_flag(menu, buffer1, hardware->cpu.flags.pat, "pat ", false);
    show_flag(menu, buffer1, hardware->cpu.flags.pse_36, "pse_36 ", false);
    show_flag(menu, buffer1, hardware->cpu.flags.psn, "psn ", false);
    show_flag(menu, buffer1, hardware->cpu.flags.clflsh, "clflsh ", false);
    show_flag(menu, buffer1, hardware->cpu.flags.dts, "dts ", false);
    show_flag(menu, buffer1, hardware->cpu.flags.acpi, "acpi ", false);
    show_flag(menu, buffer1, hardware->cpu.flags.mmx, "mmx ", false);
    show_flag(menu, buffer1, hardware->cpu.flags.sse, "sse ", false);
    show_flag(menu, buffer1, hardware->cpu.flags.sse2, "sse2 ", false);
    show_flag(menu, buffer1, hardware->cpu.flags.ss, "ss ", false);
    show_flag(menu, buffer1, hardware->cpu.flags.htt, "ht ", false);
    show_flag(menu, buffer1, hardware->cpu.flags.acc, "acc ", false);
    show_flag(menu, buffer1, hardware->cpu.flags.syscall, "syscall ", false);
    show_flag(menu, buffer1, hardware->cpu.flags.mp, "mp ", false);
    show_flag(menu, buffer1, hardware->cpu.flags.nx, "nx ", false);
    show_flag(menu, buffer1, hardware->cpu.flags.mmxext, "mmxext ", false);
    show_flag(menu, buffer1, hardware->cpu.flags.lm, "lm ", false);
    show_flag(menu, buffer1, hardware->cpu.flags.nowext, "3dnowext ", false);
    show_flag(menu, buffer1, hardware->cpu.flags.now, "3dnow! ", false);
    show_flag(menu, buffer1, hardware->cpu.flags.svm, "svm ", false);
    show_flag(menu, buffer1, hardware->cpu.flags.vmx, "vmx ", false);
    show_flag(menu, buffer1, hardware->cpu.flags.pbe, "pbe ", false);
    show_flag(menu, buffer1, hardware->cpu.flags.fxsr_opt, "fxsr_opt ", false);
    show_flag(menu, buffer1, hardware->cpu.flags.gbpages, "gbpages ", false);
    show_flag(menu, buffer1, hardware->cpu.flags.rdtscp, "rdtscp ", false);
    show_flag(menu, buffer1, hardware->cpu.flags.pni, "pni ", false);
    show_flag(menu, buffer1, hardware->cpu.flags.pclmulqd, "pclmulqd ", false);
    show_flag(menu, buffer1, hardware->cpu.flags.dtes64, "dtes64 ", false);
    show_flag(menu, buffer1, hardware->cpu.flags.smx, "smx ", false);
    show_flag(menu, buffer1, hardware->cpu.flags.est, "est ", false);
    show_flag(menu, buffer1, hardware->cpu.flags.tm2, "tm2 ", false);
    show_flag(menu, buffer1, hardware->cpu.flags.sse3, "sse3 ", false);
    show_flag(menu, buffer1, hardware->cpu.flags.fma, "fma ", false);
    show_flag(menu, buffer1, hardware->cpu.flags.cx16, "cx16 ", false);
    show_flag(menu, buffer1, hardware->cpu.flags.xtpr, "xtpr ", false);
    show_flag(menu, buffer1, hardware->cpu.flags.pdcm, "pdcm ", false);
    show_flag(menu, buffer1, hardware->cpu.flags.dca, "dca ", false);
    show_flag(menu, buffer1, hardware->cpu.flags.xmm4_1, "xmm4_1 ", false);
    show_flag(menu, buffer1, hardware->cpu.flags.xmm4_2, "xmm4_2 ", false);
    show_flag(menu, buffer1, hardware->cpu.flags.x2apic, "x2apic ", false);
    show_flag(menu, buffer1, hardware->cpu.flags.movbe, "movbe ", false);
    show_flag(menu, buffer1, hardware->cpu.flags.popcnt, "popcnt ", false);
    show_flag(menu, buffer1, hardware->cpu.flags.aes, "aes ", false);
    show_flag(menu, buffer1, hardware->cpu.flags.xsave, "xsave ", false);
    show_flag(menu, buffer1, hardware->cpu.flags.osxsave, "osxsave ", false);
    show_flag(menu, buffer1, hardware->cpu.flags.avx, "avx ", false);
    show_flag(menu, buffer1, hardware->cpu.flags.hypervisor, "hypervisor ",
	      false);
    show_flag(menu, buffer1, hardware->cpu.flags.ace2, "ace2 ", false);
    show_flag(menu, buffer1, hardware->cpu.flags.ace2_en, "ace2_en ", false);
    show_flag(menu, buffer1, hardware->cpu.flags.phe, "phe ", false);
    show_flag(menu, buffer1, hardware->cpu.flags.phe_en, "phe_en ", false);
    show_flag(menu, buffer1, hardware->cpu.flags.pmm, "pmm ", false);
    show_flag(menu, buffer1, hardware->cpu.flags.pmm_en, "pmm_en ", false);
    show_flag(menu, buffer1, hardware->cpu.flags.extapic, "extapic ", false);
    show_flag(menu, buffer1, hardware->cpu.flags.cr8_legacy, "cr8_legacy ",
	      false);
    show_flag(menu, buffer1, hardware->cpu.flags.abm, "abm ", false);
    show_flag(menu, buffer1, hardware->cpu.flags.sse4a, "sse4a ", false);
    show_flag(menu, buffer1, hardware->cpu.flags.misalignsse, "misalignsse ",
	      false);
    show_flag(menu, buffer1, hardware->cpu.flags.nowprefetch, "3dnowprefetch ",
	      false);
    show_flag(menu, buffer1, hardware->cpu.flags.osvw, "osvw ", false);
    show_flag(menu, buffer1, hardware->cpu.flags.ibs, "ibs ", false);
    show_flag(menu, buffer1, hardware->cpu.flags.sse5, "sse5 ", false);
    show_flag(menu, buffer1, hardware->cpu.flags.skinit, "skinit ", false);
    show_flag(menu, buffer1, hardware->cpu.flags.wdt, "wdt ", false);
    show_flag(menu, buffer1, hardware->cpu.flags.ida, "ida ", false);
    show_flag(menu, buffer1, hardware->cpu.flags.arat, "arat ", false);
    show_flag(menu, buffer1, hardware->cpu.flags.tpr_shadow, "tpr_shadow ",
	      false);
    show_flag(menu, buffer1, hardware->cpu.flags.vnmi, "vnmi ", false);
    show_flag(menu, buffer1, hardware->cpu.flags.flexpriority, "flexpriority ",
	      false);
    show_flag(menu, buffer1, hardware->cpu.flags.ept, "ept ", false);
    show_flag(menu, buffer1, hardware->cpu.flags.vpid, "vpid ", false);

    /* Let's flush the remaining flags */
    show_flag(menu, buffer1, false, "", true);

    printf("MENU: Processor menu done (%d items)\n", menu->items_count);
}
Ejemplo n.º 17
0
void create_menu(){
	struct menu *main_menu = add_menu("Main menu\n", NULL);
		struct menu *sub = add_menu("Aasmund er kul\n", main_menu);
			struct menu *hehe = add_menu("Bare tulla\n", sub);
				add_menu("lol\n", hehe);
			add_menu("gunnarerkulere\n", sub);
			add_menu("jon er kulest\n", sub);
		add_menu("Gunnarliker is\n", main_menu);
		add_menu("Jonlikerdumle\n", main_menu);
		add_menu("Jonspiserfisk\n", main_menu);
		add_menu("hei\n", main_menu);
		add_menu("hallo\n", main_menu);
		add_menu("asdfjkjfsagf\n", main_menu);
		add_menu("menu scroll\n", main_menu);
}
Ejemplo n.º 18
0
/* Main Kernel menu */
void compute_PXE(struct s_my_menu *menu, struct s_hardware *hardware)
{
  char buffer[SUBMENULEN + 1];
  char infobar[STATLEN + 1];

  if (hardware->is_pxe_valid == false)
    return;

  menu->menu = add_menu(" PXE ", -1);
  menu->items_count = 0;
  set_menu_pos(SUBMENU_Y, SUBMENU_X);

  struct s_pxe *p = &hardware->pxe;

  if ((hardware->pci_ids_return_code == -ENOPCIIDS) || (p->pci_device==NULL))  {
    snprintf(buffer, sizeof buffer, "PCI Vendor    : %d",
       p->vendor_id);
    snprintf(infobar, sizeof infobar, "PCI Vendor    : %d",
       p->vendor_id);
    add_item(buffer, infobar, OPT_INACTIVE, NULL, 0);
    menu->items_count++;

    snprintf(buffer, sizeof buffer, "PCI Product   : %d",
       p->vendor_id);
    snprintf(infobar, sizeof infobar, "PCI Product   : %d",
       p->vendor_id);
    add_item(buffer, infobar, OPT_INACTIVE, NULL, 0);
    menu->items_count++;

    snprintf(buffer, sizeof buffer, "PCI SubVendor  : %d",
       p->subvendor_id);
    snprintf(infobar, sizeof infobar, "PCI SubVendor  : %d",
       p->subvendor_id);
    add_item(buffer, infobar, OPT_INACTIVE, NULL, 0);
    menu->items_count++;

    snprintf(buffer, sizeof buffer, "PCI SubProduct : %d",
       p->subproduct_id);
    snprintf(infobar, sizeof infobar, "PCI SubProduct : %d",
       p->subproduct_id);
    add_item(buffer, infobar, OPT_INACTIVE, NULL, 0);
    menu->items_count++;

    snprintf(buffer, sizeof buffer, "PCI Revision   : %d", p->rev);
    snprintf(infobar, sizeof infobar, "PCI Revision   : %d",
       p->rev);
    add_item(buffer, infobar, OPT_INACTIVE, NULL, 0);
    menu->items_count++;

    snprintf(buffer, sizeof buffer,
       "PCI Bus Pos.   : %02x:%02x.%02x", p->pci_bus,
       p->pci_dev, p->pci_func);
    snprintf(infobar, sizeof infobar,
       "PCI Bus Pos.   : %02x:%02x.%02x", p->pci_bus,
       p->pci_dev, p->pci_func);
    add_item(buffer, infobar, OPT_INACTIVE, NULL, 0);
    menu->items_count++;

  } else {

    snprintf(buffer, sizeof buffer, "Manufacturer : %s",
       p->pci_device->dev_info->vendor_name);
    snprintf(infobar, sizeof infobar, "Manufacturer : %s",
       p->pci_device->dev_info->vendor_name);
    add_item(buffer, infobar, OPT_INACTIVE, NULL, 0);
    menu->items_count++;

    snprintf(buffer, sizeof buffer, "Product      : %s",
       p->pci_device->dev_info->product_name);
    snprintf(infobar, sizeof infobar, "Product      : %s",
       p->pci_device->dev_info->product_name);
    add_item(buffer, infobar, OPT_INACTIVE, NULL, 0);
    menu->items_count++;
  }

  snprintf(buffer, sizeof buffer, "MAC Address  : %s", p->mac_addr);
  snprintf(infobar, sizeof infobar, "MAC Address  : %s", p->mac_addr);
  add_item(buffer, infobar, OPT_INACTIVE, NULL, 0);
  menu->items_count++;

  snprintf(buffer, sizeof buffer, "IP Address   : %d.%d.%d.%d",
     p->ip_addr[0], p->ip_addr[1], p->ip_addr[2], p->ip_addr[3]);
  snprintf(infobar, sizeof infobar, "IP Address   : %d.%d.%d.%d",
     p->ip_addr[0], p->ip_addr[1], p->ip_addr[2], p->ip_addr[3]);
  add_item(buffer, infobar, OPT_INACTIVE, NULL, 0);
  menu->items_count++;

  printf("MENU: PXE menu done (%d items)\n", menu->items_count);
}
Ejemplo n.º 19
0
MenuItem* ScenePicker::add_radio_menu(const char* name, Action* a, Menu* m) {
	MenuItem* mi = K::radio_menu_item(spi_->tg_, name);
	mi->action(new RadioSelect(name, a, spi_->scene_));
	return add_menu(name, mi, m);
}
Ejemplo n.º 20
0
MenuItem* ScenePicker::add_menu(const char* name, Action* a, Menu* m) {
	MenuItem* mi = K::menu_item(name);
	mi->action(a);
	return add_menu(name, mi, m);
}
Ejemplo n.º 21
0
/* Compute the disk submenu */
int compute_disk_module(struct s_my_menu *menu, int nb_sub_disk_menu,
                        struct diskinfo *d, int disk_number)
{
  char buffer[MENULEN + 1];
  char statbuffer[STATLEN + 1];

  /* No need to add no existing devices */
  if (strlen(d[disk_number].aid.model) <= 0)
    return -1;

  snprintf(buffer, sizeof buffer, " Disk <%d> ", nb_sub_disk_menu);
  menu[nb_sub_disk_menu].menu = add_menu(buffer, -1);
  menu[nb_sub_disk_menu].items_count = 0;

  snprintf(buffer, sizeof buffer, "Model        : %s",
     d[disk_number].aid.model);
  snprintf(statbuffer, sizeof statbuffer, "Model: %s",
     d[disk_number].aid.model);
  add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
  menu[nb_sub_disk_menu].items_count++;

  /* Compute device size */
  char previous_unit[3], unit[3]; //GB
  int previous_size, size = d[disk_number].sectors / 2; // Converting to bytes
  strlcpy(unit, "KB", 2);
  strlcpy(previous_unit, unit, 2);
  previous_size = size;
  if (size > 1000) {
    size = size / 1000;
    strlcpy(unit, "MB", 2);
    if (size > 1000) {
      previous_size = size;
      size = size / 1000;
      strlcpy(previous_unit, unit, 2);
      strlcpy(unit, "GB", 2);
      if (size > 1000) {
        previous_size = size;
        size = size / 1000;
        strlcpy(previous_unit, unit, 2);
        strlcpy(unit, "TB", 2);
      }
    }
  }

  snprintf(buffer, sizeof buffer, "Size         : %d %s (%d %s)", size,
     unit, previous_size, previous_unit);
  snprintf(statbuffer, sizeof statbuffer, "Size: %d %s (%d %s)", size,
     unit, previous_size, previous_unit);
  add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
  menu[nb_sub_disk_menu].items_count++;

  snprintf(buffer, sizeof buffer, "Firmware Rev.: %s",
     d[disk_number].aid.fw_rev);
  snprintf(statbuffer, sizeof statbuffer, "Firmware Revision: %s",
     d[disk_number].aid.fw_rev);
  add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
  menu[nb_sub_disk_menu].items_count++;

  snprintf(buffer, sizeof buffer, "Serial Number: %s",
     d[disk_number].aid.serial_no);
  snprintf(statbuffer, sizeof statbuffer, "Serial Number: %s",
     d[disk_number].aid.serial_no);
  add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
  menu[nb_sub_disk_menu].items_count++;

  snprintf(buffer, sizeof buffer, "Interface    : %s",
     d[disk_number].interface_type);
  snprintf(statbuffer, sizeof statbuffer, "Interface: %s",
     d[disk_number].interface_type);
  add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
  menu[nb_sub_disk_menu].items_count++;

  snprintf(buffer, sizeof buffer, "Host Bus     : %s",
     d[disk_number].host_bus_type);
  snprintf(statbuffer, sizeof statbuffer, "Host Bus Type: %s",
     d[disk_number].host_bus_type);
  add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
  menu[nb_sub_disk_menu].items_count++;

  snprintf(buffer, sizeof buffer, "Sectors      : %d",
     d[disk_number].sectors);
  snprintf(statbuffer, sizeof statbuffer, "Sectors: %d",
     d[disk_number].sectors);
  add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
  menu[nb_sub_disk_menu].items_count++;

  snprintf(buffer, sizeof buffer, "Heads        : %d",
     d[disk_number].heads);
  snprintf(statbuffer, sizeof statbuffer, "Heads: %d",
     d[disk_number].heads);
  add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
  menu[nb_sub_disk_menu].items_count++;

  snprintf(buffer, sizeof buffer, "Cylinders    : %d",
     d[disk_number].cylinders);
  snprintf(statbuffer, sizeof statbuffer, "Cylinders: %d",
     d[disk_number].cylinders);
  add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
  menu[nb_sub_disk_menu].items_count++;

  snprintf(buffer, sizeof buffer, "Sectors/Track: %d",
     d[disk_number].sectors_per_track);
  snprintf(statbuffer, sizeof statbuffer, "Sectors per Track: %d",
     d[disk_number].sectors_per_track);
  add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
  menu[nb_sub_disk_menu].items_count++;

  snprintf(buffer, sizeof buffer, "Port         : 0x%X", disk_number);
  snprintf(statbuffer, sizeof statbuffer, "Port: 0x%X", disk_number);
  add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
  menu[nb_sub_disk_menu].items_count++;

  snprintf(buffer, sizeof buffer, "EDD Version  : %s",
     d[disk_number].edd_version);
  snprintf(statbuffer, sizeof statbuffer, "EDD Version: %s",
     d[disk_number].edd_version);
  add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
  menu[nb_sub_disk_menu].items_count++;

  return 0;
}
Ejemplo n.º 22
0
/*
 *   Generic yes/no function. 'def' is the default (returned by space or
 *   return; 'esc' returns 'q', or 'n', or the default, depending on
 *   what's in the string. The 'query' string is printed before the user
 *   is asked about the string.
 *   If resp is NULL, any single character is accepted and returned.
 *   If not-NULL, only characters in it are allowed (exceptions:  the
 *   quitchars are always allowed, and if it contains '#' then digits
 *   are allowed); if it includes an <esc>, anything beyond that won't
 *   be shown in the prompt to the user but will be acceptable as input.
 */
char nds_yn_function(const char *ques, const char *cstr, CHAR_P def)
{
  char buffer[INPUT_BUFFER_SIZE];

  char *choices;
  ANY_P header_id;
  ANY_P *ids;
  winid win;
  menu_item *sel = NULL;
  int ret;
  int yn = 0;
  int ynaq = 0;
  char *direction_keys = nds_get_direction_keys();

  if ((strstr(ques, "In what direction") != NULL) ||
      (strstr(ques, "in what direction") != NULL)) {
    /*
     * We're going to use nh_poskey to get a command from the user.  However,
     * we must handle clicks specially.  Unlike normal movement, you can't
     * just click anywhere to pick a direction.  Instead, the user will be
     * expected to click in one of the adjacent squares around the player,
     * and the click will then be translated into a movement character.
     */
    while (1) {
      int x, y, mod;
      int sym;

      nds_draw_prompt("Tap an adjacent square or press a direction key.");
      nds_flush(0);
      sym = nds_get_input(&x, &y, &mod);
      nds_clear_prompt();

      if (mod == CLICK_1) {
        if ((x == u.ux - 1) && (y == u.uy - 1)) {
          return direction_keys[DIR_UP_LEFT];
        } else if ((x == u.ux) && (y == u.uy - 1)) {
          return direction_keys[DIR_UP];
        } else if ((x == u.ux + 1) && (y == u.uy - 1)) {
          return direction_keys[DIR_UP_RIGHT];
        } else if ((x == u.ux - 1) && (y == u.uy)) {
          return direction_keys[DIR_LEFT];
        } else if ((x == u.ux) && (y == u.uy)) {
          return direction_keys[DIR_WAIT];
        } else if ((x == u.ux + 1) && (y == u.uy)) {
          return direction_keys[DIR_RIGHT];
        } else if ((x == u.ux - 1) && (y == u.uy + 1)) {
          return direction_keys[DIR_DOWN_LEFT];
        } else if ((x == u.ux) && (y == u.uy + 1)) {
          return direction_keys[DIR_DOWN];
        } else if ((x == u.ux + 1) && (y == u.uy + 1)) {
          return direction_keys[DIR_DOWN_RIGHT];
        }
      } else if (mod == CLICK_2) {
        if ((x == u.ux) && (y == u.uy)) {
          return '>';
        }
      } else {
        return sym;
      }
    }
  } else if (! iflags.cmdwindow) {
    return nds_prompt_char(ques, cstr, 0);
  } else if (strstr(ques, "Adjust letter to what") != NULL) {
    return nds_prompt_char(ques, cstr, 0);
  } else if (strstr(ques, "What command?") != NULL) {
    nds_cmd_t cmd;
    
    nds_draw_prompt("Select a command.");
    nds_flush(0);
    cmd = nds_cmd_loop(CMDLOOP_WHATDOES);
    nds_clear_prompt();

    return cmd.f_char;
  } else if (strstr(ques, "What do you look for?") != NULL) {
    return nds_prompt_char(ques, cstr, 0);
  } else if (strstr(ques, "adjust?") != NULL) {
    cstr = ynchars;
  }

  if ((index(ques, '[') == NULL) && (cstr == NULL)) {
    nds_draw_prompt(ques);
    return '*';
  }

  win = create_nhwindow(NHW_MENU);

  start_menu(win);
  
  if ((cstr != NULL) && 
      ((strcasecmp(cstr, ynchars) == 0) ||
       (strcasecmp(cstr, ynqchars) == 0) ||
       ((ynaq = strcasecmp(cstr, ynaqchars)) == 0))) {

    ids = (ANY_P *)malloc(sizeof(ANY_P) * 2);

    yn = 1;

    ids[0].a_int = 'y';
    ids[1].a_int = 'n';

    add_menu(win, NO_GLYPH, &(ids[0]), 0, 0, 0, "Yes", 0);
    add_menu(win, NO_GLYPH, &(ids[1]), 0, 0, 0, "No", 0);

    if (ynaq) {
      ids[2].a_int = 'a';

      add_menu(win, NO_GLYPH, &(ids[2]), 0, 0, 0, "All", 0);
    }
  } else if ((cstr != NULL) && (strcasecmp(cstr, "rl") == 0)) {

    ids = (ANY_P *)malloc(sizeof(ANY_P) * 2);

    ids[0].a_int = 'r';
    ids[1].a_int = 'l';

    add_menu(win, NO_GLYPH, &(ids[0]), 0, 0, 0, "Right Hand", 0);
    add_menu(win, NO_GLYPH, &(ids[1]), 0, 0, 0, "Left Hand", 0);
  } else {
    int i;
    char curclass = -1;

    choices = _nds_parse_choices(ques);

    ids = (ANY_P *)malloc(sizeof(ANY_P) * strlen(choices));
    header_id.a_int = 0;

    for (i = 0; i < strlen(choices); i++) {

      ids[i].a_int = choices[i];

      if (choices[i] == ' ') {
        add_menu(win, NO_GLYPH, &(header_id), 0, 0, 0, "Other", 0);
      } else if (choices[i] == '*') {
        add_menu(win, NO_GLYPH, &(ids[i]), 0, 0, 0, "Something from your inventory", 0);
      } else if ((choices[i] == '-') || (choices[i] == '.')) {
        add_menu(win, NO_GLYPH, &(ids[i]), 0, 0, 0, "Nothing/your finger", 0);
      } else if (choices[i] == '?') {
        continue;
      } else {
        int oclass;
        char oname[BUFSZ];

        if (choices[i] == '$') {
          oclass = COIN_CLASS;
          sprintf(oname, "%ld gold piece%s", u.ugold, plur(u.ugold));
        } else {
          struct obj *otmp = obj_for_let(choices[i]);

          oclass = otmp->oclass;
          strcpy(oname, doname(otmp));
        }

        if (oclass != curclass) {
          add_menu(win, NO_GLYPH, &(header_id), 0, 0, 0, let_to_name(oclass, FALSE), 0);

          curclass = oclass;
        } 

        add_menu(win, NO_GLYPH, &(ids[i]), 0, 0, 0, oname, 0);
      }
    }
  }

  end_menu(win, ques);

  int mode = ((cstr == NULL) || (index(cstr, '#') != NULL)) ? PICK_ONE_TYPE : PICK_ONE;
  int cnt = select_menu(win, mode, &sel);

  if (cnt <= 0) {
    ret = yn ? 'n' : '\033';
  } else if ((mode == PICK_ONE) || (sel->count < 0)) {
    ret = sel->item.a_int;
  } else if (mode == PICK_ONE_TYPE) {
    sprintf(buffer, "%d%c", sel->count, sel->item.a_int);

    nds_input_buffer_append(buffer + 1);
    ret = *buffer;
  }

  if (sel != NULL) {
    free(sel);
  }

  free(ids);

  destroy_nhwindow(win);

  return ret;
}
Ejemplo n.º 23
0
/**
   Runs before player selection, and is used to determine which game
   mode to play in. If the choice is to continue or start a new game, it
   sets the character name to determine which (currently unused name for
   the player = new game, currently used name = continue that game);
   otherwise, it implements the choice itself then either loops or
   exits.

   This is based on the tty code, except that it uses a menu rather
   than rendering the game mode selection by hand.
*/
void
Sdlgl_game_mode_selection()
{
  int c;
  char** saved;
  char** sp;
  int plname_in_saved = 0;
  int plname_was_explicit = !!*plname;
  (void) plname_was_explicit; /* TODO: use this */

  winid menuwin;
  int n;
  menu_item *selected;
  anything any;

  saved = get_saved_games();

  if (*plname && saved && *saved) {
    for (sp = saved; *sp; sp++) {
      /* Note that this means that public servers need to prevent two
         users with the same name but different capitalisation. (If
         they aren't, it's likely to cause problems anyway...) */
      if (!strcmpi(plname, *sp)) {
        plname_in_saved = 1;
        /* Fix capitalisation of the name to match the saved game. */
        strncpy(plname, *sp, sizeof(plname)-1);
      }
    }
  } else if (*plname) {
    set_savefile_name();
    /* Let's just try to open the savefile directly to see if it exists */
    plname_in_saved = verify_savefile();
  }

retry_mode_selection:;
reread_char:
  menuwin = create_nhwindow(NHW_MENU);
  any.a_void = 0;
  start_menu(menuwin);

  any.a_int = 'c';
  add_menu(menuwin, NO_GLYPH, &any, 'c', 0, ATR_NONE,
           "Continue game", MENU_UNSELECTED);
  any.a_int = 'n';
  add_menu(menuwin, NO_GLYPH, &any, 'n', 0, ATR_NONE,
           "New game", MENU_UNSELECTED);
  any.a_int = 't';
  add_menu(menuwin, NO_GLYPH, &any, 't', 0, ATR_NONE,
           "Tutorial", MENU_UNSELECTED);
  any.a_int = 'm';
  add_menu(menuwin, NO_GLYPH, &any, 'm', 0, ATR_NONE,
           "Other modes", MENU_UNSELECTED);

  any.a_void = 0;
  add_menu(menuwin, NO_GLYPH, &any, 0, 0, ATR_NONE, "", FALSE);

  any.a_int = 's';
  add_menu(menuwin, NO_GLYPH, &any, 's', 0, ATR_NONE,
           "Continue game", MENU_UNSELECTED);
  any.a_int = 'o';
  add_menu(menuwin, NO_GLYPH, &any, 'o', 0, ATR_NONE,
           "New game", MENU_UNSELECTED);
  any.a_int = '?';
  add_menu(menuwin, NO_GLYPH, &any, '?', 0, ATR_NONE,
           "Tutorial", MENU_UNSELECTED);
  any.a_int = 'q';
  add_menu(menuwin, NO_GLYPH, &any, 'q', 0, ATR_NONE,
           "Other modes", MENU_UNSELECTED);

  end_menu(menuwin, "Welcome to AceHack!");
  n = select_menu(menuwin, PICK_ONE, &selected);
  destroy_nhwindow(menuwin);

  if (n > 0) {
    c = selected[0].item.a_int;
    free((genericptr_t)selected);
  } else goto retry_mode_selection;

#if 0
  /* TODO: This is tty code for graying out unavailable options;
     we should do that in SDL/GL code too */
  {
    if (c == 1) { /* gray out if there's no game to continue */
      if (!*plname && (!saved || !*saved)) xputs("\033[31m");
      else if (*plname && !plname_in_saved) xputs("\033[31m");
      /* and bold if there is */
      else xputs("\033[1m");
    }
    else if (c == 2) { /* gray out if a game must be continued */
      if (*plname && plname_in_saved) xputs("\033[31m");
    }
    else xputc(c); /* low-level as codes are in the file itself */
  }
#endif

  switch (c) {
  case 'c': /* continue game */
    if (*plname && plname_in_saved) break; /* just load by name */
    if (!saved || !*saved) goto reread_char;
    if (*plname && !plname_in_saved) goto reread_char;
    if (!saved[1]) {
      /* only one game to continue */
      (void) strncpy(plname, *saved, sizeof(plname)-1);
    } else {
      /* we'll have to ask which game to continue */
      winid win;
      win = create_nhwindow(NHW_MENU);
      start_menu(win);
      any.a_void = 0;
      for (sp = saved; *sp; sp++) {
        any.a_void = (void*) *sp;
        add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, *sp, MENU_UNSELECTED);
      }
      end_menu(win, "Continue which saved game?");
      c = select_menu(win, PICK_ONE, &selected);
      destroy_nhwindow(win);
      if (c != 1) {
        free((genericptr_t) selected);
        goto retry_mode_selection;
      }
      (void) strncpy(plname, (char*)selected[0].item.a_void, sizeof(plname)-1);
      free((genericptr_t) selected);
    }
    break;
  case 'n': case 't': case 'm': /* the new game options */
    /* if the name is forced by the -u option, don't give an option to
       start a new game, as we're forced onto the existing game */
    if (*plname && plname_in_saved) goto reread_char;
    if (!*plname) {
      Sdlgl_askname();
      if (saved)
        for (sp = saved; *sp; sp++) {
          if (!strcmpi(plname, *sp)) {
            pline("A game is running with that name already.");
            Sdlgl_dismiss_nhwindow(NHW_MESSAGE); /* force a --More-- */
            *plname = 0;
            goto retry_mode_selection;
          }
        }
    }
    if (c == 'm') {
      pline("TODO: implement game mode selection here");
      goto retry_mode_selection;
      do {
        c = 0; /* read from keyboard */
        switch(c) {
          /* -D, -X on command line are overriden by selecting a normal game
             explicitly */
        case 'n': wizard = FALSE; discover = FALSE; break;
        case 't': break;
        case 'd':
#ifdef WIZARD
          /* The rules here are a little complex:
             - with no -u (local play, private server play), anyone
               can enter debug mode;
             - with -u set (generally public server play), only an
               authorized user can enter debug mode.
             Thus people can enter it freely in their own compiles,
             but on public servers likely only the admin can enter it,
             as only they can tweak the command line. (-D works too
             to enter wizmode, whatever the -u option, as if it's
             given the player has control over the command line anyway.) */
          if (plname_was_explicit && strcmpi(plname,WIZARD)) {
            extern int wiz_error_flag; /* from unixmain.c */
            wiz_error_flag = TRUE;
          } else {
            wizard = TRUE;
            c = 'n';
            break;
          }
          /*FALLTHRU*/
#endif /* otherwise fall through, as debug mode isn't compiled in */
        case 'x': discover = TRUE; c = 'n'; break;
        case 's': solo = TRUE; c = 'n'; break;
        case '\033': goto retry_mode_selection;
        default: continue;
        }
      } while (c != 'n' && c != 't');
    }
    if (c == 't') flags.tutorial = 1;
    break;
  case 's': /* show high score list */
    prscore_interactive();
    goto retry_mode_selection;
  case 'o': /* options */
    doset();
    goto retry_mode_selection;
  case '?': /* help */
    dohelp();
    Sdlgl_dismiss_nhwindow(NHW_MESSAGE); /* force a --More-- */
    goto retry_mode_selection;
  case 'q': case '\033': /* exit */
    /* This is the standard Sdlgl method of exiting. */
    Sdlgl_exit_nhwindows(0);
    terminate(EXIT_SUCCESS);
    /*NOTREACHED*/
  default:
    goto reread_char;
  }

  if (saved) free_saved_games(saved);
}
Ejemplo n.º 24
0
GtkWidget *snd_as_widget(int argc, char **argv, GtkWidget *parent, void (*error_func)(const char *msg))
{

#else

void snd_doit(int argc, char **argv)
{
#endif
  GtkWidget *shell;
  int i;

#ifdef SND_AS_WIDGET
  set_error_display(error_func);
  ss = snd_main(argc, argv);
#else
  gtk_init(&argc, &argv);

#if (!HAVE_GTK_3)
#ifndef HAVE_OSX
  gdk_set_locale();
#endif
#endif

#endif

  ss->channel_min_height = CHANNEL_MIN_HEIGHT;
  ss->Graph_Cursor = DEFAULT_GRAPH_CURSOR;

#ifndef SND_AS_WIDGET
  shell = gtk_window_new(GTK_WINDOW_TOPLEVEL);
  sg_make_resizable(shell);
#endif

  auto_open_files = argc-1;
  if (argc > 1) auto_open_file_names = (char **)(argv + 1);
  ss->startup_title = mus_strdup("snd");
  set_sound_style(SOUNDS_VERTICAL);
  for (i = 1; i < argc; i++)
    if ((strcmp(argv[i], "-h") == 0) || 
	(strcmp(argv[i], "-horizontal") == 0) ||
	(strcmp(argv[i], "--horizontal") == 0))
      set_sound_style(SOUNDS_HORIZONTAL);
    else
      if ((strcmp(argv[i], "-v") == 0) || 
	  (strcmp(argv[i], "-vertical") == 0) ||
	  (strcmp(argv[i], "--vertical") == 0))
	set_sound_style(SOUNDS_VERTICAL);
      else
	if ((strcmp(argv[i], "-notebook") == 0) ||
	    (strcmp(argv[i], "--notebook") == 0))
	  set_sound_style(SOUNDS_IN_NOTEBOOK);
	else
	  if ((strcmp(argv[i], "-separate") == 0) ||
	      (strcmp(argv[i], "--separate") == 0))
	    set_sound_style(SOUNDS_IN_SEPARATE_WINDOWS);
	  else
	    if (strcmp(argv[i], "-noglob") == 0)
	      noglob = true;
	    else
	      if (strcmp(argv[i], "-noinit") == 0)
		noinit = true;
	      else
		if (strcmp(argv[i], "-nostdin") == 0)
		  nostdin = true;
		else
		  if ((strcmp(argv[i], "-b") == 0) || 
		      (strcmp(argv[i], "-batch") == 0) ||
		      (strcmp(argv[i], "--batch") == 0))
		    batch = true;
		  else
		    if (strcmp(argv[i], "--features") == 0) /* testing (compsnd) */
		      check_features_list(argv[i + 1]);

  ss->batch_mode = batch;
  set_auto_resize(AUTO_RESIZE_DEFAULT);
  ss->zoom_slider_width = ZOOM_SLIDER_WIDTH;
  ss->position_slider_width = POSITION_SLIDER_WIDTH;
  ss->channel_sash_indent = CHANNEL_SASH_INDENT; /* not currently used */
  ss->channel_sash_size = CHANNEL_SASH_SIZE;
  ss->sash_size = SASH_SIZE;
  ss->sash_indent = SASH_INDENT;
  ss->toggle_size = TOGGLE_SIZE;
  ss->graph_is_active = false;
  ss->bg_gradient = 0.05;

  ss->white =                         WHITE_COLOR;
  ss->black =                         BLACK_COLOR;
  ss->light_blue =                    LIGHT_BLUE_COLOR;
  ss->lighter_blue =                  LIGHTER_BLUE_COLOR;
  ss->red =                           RED_COLOR;
  ss->green =                         GREEN_COLOR;
  ss->blue =                          BLUE_COLOR;
  ss->yellow =                        YELLOW_COLOR;
  ss->highlight_color =               HIGHLIGHT_COLOR;
  ss->basic_color =                   BASIC_COLOR;
  ss->position_color =                POSITION_COLOR;
  ss->zoom_color =                    ZOOM_COLOR;
  ss->cursor_color =                  CURSOR_COLOR;
  ss->selection_color =               SELECTION_COLOR;
  ss->mix_color =                     MIX_COLOR;
  ss->enved_waveform_color =          ENVED_WAVEFORM_COLOR;
  ss->filter_control_waveform_color = FILTER_CONTROL_WAVEFORM_COLOR;
  ss->listener_color =                LISTENER_COLOR;
  ss->listener_text_color =           LISTENER_TEXT_COLOR;
  ss->graph_color =                   GRAPH_COLOR;
  ss->selected_graph_color =          SELECTED_GRAPH_COLOR;
  ss->data_color =                    DATA_COLOR;
  ss->selected_data_color =           SELECTED_DATA_COLOR;
  ss->mark_color =                    MARK_COLOR;
  ss->sash_color =                    SASH_COLOR;
  ss->text_focus_color =              TEXT_FOCUS_COLOR;

  ss->grid_color = get_in_between_color(ss->data_color, ss->graph_color);
  ss->selected_grid_color = get_in_between_color(ss->selected_data_color, ss->selected_graph_color);

  ss->axis_color_set = false;

  ss->orig_data_color = ss->data_color;
  ss->orig_selected_data_color = ss->selected_data_color;
  ss->orig_mark_color = ss->mark_color;
  ss->orig_mix_color = ss->mix_color;
  ss->orig_graph_color = ss->graph_color;
  ss->orig_selected_graph_color = ss->selected_graph_color;
  ss->orig_listener_color = ss->listener_color;
  ss->orig_listener_text_color = ss->listener_text_color;
  ss->orig_cursor_color = ss->cursor_color;
  ss->orig_basic_color = ss->basic_color;
  ss->orig_selection_color = ss->selection_color;
  ss->orig_zoom_color = ss->zoom_color;
  ss->orig_position_color = ss->position_color;
  ss->orig_highlight_color = ss->highlight_color;

  if ((!(set_tiny_font(DEFAULT_TINY_FONT))) &&
      (!(set_tiny_font(FALLBACK_FONT))))
    fprintf(stderr, "can't find tiny font: %s", DEFAULT_TINY_FONT);

  if ((!(set_axis_label_font(DEFAULT_AXIS_LABEL_FONT))) &&
      (!(set_axis_label_font(FALLBACK_FONT))))
    fprintf(stderr, "can't find axis label font: %s", DEFAULT_AXIS_LABEL_FONT);

  if ((!(set_axis_numbers_font(DEFAULT_AXIS_NUMBERS_FONT))) &&
      (!(set_axis_numbers_font(FALLBACK_FONT))))
    fprintf(stderr, "can't find axis numbers font: %s", DEFAULT_AXIS_NUMBERS_FONT);

  if ((!(set_peaks_font(DEFAULT_PEAKS_FONT))) &&
      (!(set_peaks_font(FALLBACK_FONT))))
    fprintf(stderr, "can't find peaks font: %s", DEFAULT_PEAKS_FONT);

  if ((!(set_bold_peaks_font(DEFAULT_BOLD_PEAKS_FONT))) &&
      (!(set_bold_peaks_font(FALLBACK_FONT))))
    fprintf(stderr, "can't find bold peaks font: %s", DEFAULT_BOLD_PEAKS_FONT);

  if (!(set_listener_font(FALLBACK_FONT)))
    fprintf(stderr, "can't find listener font: %s", FALLBACK_FONT);

  ss->orig_axis_label_font = mus_strdup(axis_label_font(ss));
  ss->orig_axis_numbers_font = mus_strdup(axis_numbers_font(ss));
  ss->orig_peaks_font = mus_strdup(peaks_font(ss));
  ss->orig_bold_peaks_font = mus_strdup(bold_peaks_font(ss));
  ss->orig_listener_font = mus_strdup(listener_font(ss));
  ss->orig_tiny_font = mus_strdup(tiny_font(ss));

#if (!HAVE_GTK_3)
  init_gtk();
#endif

  MAIN_PANE(ss) = gtk_vbox_new(false, 0); /* not homogenous, spacing 0 */

#if (HAVE_GTK_3)
  init_gtk();
#endif
  
#ifdef SND_AS_WIDGET
  MAIN_SHELL(ss) = parent;
  shell = MAIN_PANE(ss);
#else
  MAIN_SHELL(ss) = shell;
  gtk_container_add(GTK_CONTAINER(MAIN_SHELL(ss)), MAIN_PANE(ss));
#endif
  add_menu(); /* adds menubar to MAIN_PANE (via box_pack_start) */
  if (with_toolbar(ss)) show_toolbar();

  if (sound_style(ss) != SOUNDS_IN_SEPARATE_WINDOWS)
    {
      SOUND_PANE(ss) = gtk_vpaned_new();
      gtk_container_set_border_width(GTK_CONTAINER(SOUND_PANE(ss)), 0);
      gtk_container_add(GTK_CONTAINER(MAIN_PANE(ss)), SOUND_PANE(ss));
      if (sound_style(ss) == SOUNDS_IN_NOTEBOOK)
	{
	  SOUND_PANE_BOX(ss) = gtk_notebook_new();
	  gtk_notebook_set_tab_pos(GTK_NOTEBOOK(SOUND_PANE_BOX(ss)), GTK_POS_TOP);
          SG_SIGNAL_CONNECT(SOUND_PANE_BOX(ss), "switch_page", notebook_switch_page, NULL);
	}
      else 
	{
	  if (sound_style(ss) == SOUNDS_HORIZONTAL)
	    SOUND_PANE_BOX(ss) = gtk_hbox_new(false, 0);
	  else SOUND_PANE_BOX(ss) = gtk_vbox_new(false, 0);
	}
      gtk_paned_add1(GTK_PANED(SOUND_PANE(ss)), SOUND_PANE_BOX(ss));
      gtk_widget_show(SOUND_PANE_BOX(ss));
      gtk_widget_show(SOUND_PANE(ss));
    }
  gtk_widget_show(MAIN_PANE(ss));
  gtk_widget_show(MAIN_SHELL(ss));
  
#ifndef SND_AS_WIDGET
#if HAVE_GTK_ADJUSTMENT_GET_UPPER
  MAIN_WINDOW(ss) = gtk_widget_get_window(MAIN_SHELL(ss));
#else
  MAIN_WINDOW(ss) = MAIN_SHELL(ss)->window;
#endif
#else
  MAIN_WINDOW(ss) = gtk_widget_get_parent_window(MAIN_SHELL(ss));
#endif
  
  setup_gcs();
  if (batch) gtk_widget_hide(MAIN_SHELL(ss));
  else gdk_window_resize(WIDGET_TO_WINDOW(MAIN_SHELL(ss)), INITIAL_WINDOW_WIDTH, INITIAL_WINDOW_HEIGHT);
  startup_funcs();
  
#if HAVE_SETJMP_H
#if MUS_TRAP_SEGFAULT
  if (sigsetjmp(envHandleEventsLoop, 1))
    {
      if (!(ss->exiting))
	snd_error_without_format("Caught seg fault (will try to continue):\n");
      else
	{
	  snd_error_without_format("Caught seg fault while trying to exit.\n");
	  exit(0);
	}
    }
#endif
  if (setjmp(top_level_jump))
    {
      if (!(ss->jump_ok))
	snd_error_without_format("Caught top level error (will try to continue):\n");
      else ss->jump_ok = false;
    }
#endif
  
  if (ss->startup_errors)
    {
      post_it("Error in initialization", ss->startup_errors);
      free(ss->startup_errors);
      ss->startup_errors = NULL;
    }

#if HAVE_GTK_3
  set_basic_color(ss->basic_color);
  color_listener(ss->listener_color);

  color_chan_components(ss->zoom_color, COLOR_ZOOM);
  color_chan_components(ss->position_color, COLOR_POSITION);
#endif

#ifndef SND_AS_WIDGET
  set_up_icon();
  gtk_main();
#else
  return(shell);
#endif
}
Ejemplo n.º 25
0
void nds_player_selection()
{
  int i, k, n;
  char pick4u = 'n', thisch, lastch = 0;
  char pbuf[PROMPT_LAYER_WIDTH], plbuf[PROMPT_LAYER_WIDTH];
  winid win;
  anything any;
  menu_item *selected = 0;

  /* prevent an unnecessary prompt */
  rigid_role_checks();

  /* Should we randomly pick for the player? */
  if (!flags.randomall &&
      (flags.initrole == ROLE_NONE || flags.initrace == ROLE_NONE ||
       flags.initgend == ROLE_NONE || flags.initalign == ROLE_NONE)) {

    char *prompt = build_plselection_prompt(pbuf, PROMPT_LAYER_WIDTH, flags.initrole,
                                            flags.initrace, flags.initgend, flags.initalign);
    int res = _nds_display_yes_no_prompt(prompt);

    if (res < 0) {
give_up:
      return;
    }

    if (res) {
      pick4u = 'y';
    }
  }

  root_plselection_prompt(plbuf, PROMPT_LAYER_WIDTH - 1,
                          flags.initrole, flags.initrace, flags.initgend, flags.initalign);

  /* Select a role, if necessary */
  /* we'll try to be compatible with pre-selected race/gender/alignment,
   * but may not succeed */

  if (flags.initrole < 0) {
    char rolenamebuf[PROMPT_LAYER_WIDTH];

    /* Process the choice */
    if (pick4u == 'y' || flags.initrole == ROLE_RANDOM || flags.randomall) {
      /* Pick a random role */
      flags.initrole = pick_role(flags.initrace, flags.initgend,
                                 flags.initalign, PICK_RANDOM);
      if (flags.initrole < 0) {
        iprintf("Incompatible role!");

        flags.initrole = randrole();
      }
    } else {
      /* Prompt for a role */

      win = create_nhwindow(NHW_MENU);
      start_menu(win);

      any.a_void = 0;         /* zero out all bits */

      for (i = 0; roles[i].name.m; i++) {
        if (ok_role(i, flags.initrace, flags.initgend,
                    flags.initalign)) {

          any.a_int = i+1;	/* must be non-zero */
          thisch = lowc(roles[i].name.m[0]);

          if (thisch == lastch) thisch = highc(thisch);

          if (flags.initgend != ROLE_NONE && flags.initgend != ROLE_RANDOM) {
            if (flags.initgend == 1  && roles[i].name.f)
              Strcpy(rolenamebuf, roles[i].name.f);
            else
              Strcpy(rolenamebuf, roles[i].name.m);
          } else {
            if (roles[i].name.f) {
              Strcpy(rolenamebuf, roles[i].name.m);
              Strcat(rolenamebuf, "/");
              Strcat(rolenamebuf, roles[i].name.f);
            } else 
              Strcpy(rolenamebuf, roles[i].name.m);
          }	

          add_menu(win, NO_GLYPH, &any, thisch,
                   0, ATR_NONE, an(rolenamebuf), MENU_UNSELECTED);

          lastch = thisch;
        }
      }

      any.a_int = pick_role(flags.initrace, flags.initgend,
                            flags.initalign, PICK_RANDOM)+1;

      if (any.a_int == 0)	/* must be non-zero */
        any.a_int = randrole()+1;

      add_menu(win, NO_GLYPH, &any , '*', 0, ATR_NONE,
               "Random", MENU_UNSELECTED);

      any.a_int = i+1;	/* must be non-zero */

      add_menu(win, NO_GLYPH, &any , 'q', 0, ATR_NONE,
               "Quit", MENU_UNSELECTED);

      Sprintf(pbuf, "Pick a role for your %s", plbuf);

      end_menu(win, pbuf);

      n = select_menu(win, PICK_ONE, &selected);

      destroy_nhwindow(win);

      /* Process the choice */
      if (n != 1 || selected[0].item.a_int == any.a_int)
        goto give_up;		/* Selected quit */

      flags.initrole = selected[0].item.a_int - 1;
      free((genericptr_t) selected),	selected = 0;
    }

    (void)  root_plselection_prompt(plbuf, PROMPT_LAYER_WIDTH - 1,
                                    flags.initrole, flags.initrace, flags.initgend, flags.initalign);
  }

  /* Select a race, if necessary */
  /* force compatibility with role, try for compatibility with
   * pre-selected gender/alignment */

  if (flags.initrace < 0 || !validrace(flags.initrole, flags.initrace)) {
    /* pre-selected race not valid */

    if (pick4u == 'y' || flags.initrace == ROLE_RANDOM || flags.randomall) {
      flags.initrace = pick_race(flags.initrole, flags.initgend,
                                 flags.initalign, PICK_RANDOM);
      if (flags.initrace < 0) {
        iprintf("Incompatible race!");
        flags.initrace = randrace(flags.initrole);
      }
    } else {	/* pick4u == 'n' */
      /* Count the number of valid races */
      n = 0;	/* number valid */
      k = 0;	/* valid race */

      for (i = 0; races[i].noun; i++) {
        if (ok_race(flags.initrole, i, flags.initgend,
                    flags.initalign)) {
          n++;
          k = i;
        }
      }

      if (n == 0) {
        for (i = 0; races[i].noun; i++) {
          if (validrace(flags.initrole, i)) {
            n++;
            k = i;
          }
        }
      }

      /* Permit the user to pick, if there is more than one */
      if (n > 1) {
        win = create_nhwindow(NHW_MENU);

        start_menu(win);
        any.a_void = 0;         /* zero out all bits */

        for (i = 0; races[i].noun; i++)
          if (ok_race(flags.initrole, i, flags.initgend,
                      flags.initalign)) {
            any.a_int = i+1;	/* must be non-zero */
            add_menu(win, NO_GLYPH, &any, races[i].noun[0],
                     0, ATR_NONE, races[i].noun, MENU_UNSELECTED);
          }

        any.a_int = pick_race(flags.initrole, flags.initgend,
                              flags.initalign, PICK_RANDOM)+1;

        if (any.a_int == 0)	/* must be non-zero */
          any.a_int = randrace(flags.initrole)+1;

        add_menu(win, NO_GLYPH, &any , '*', 0, ATR_NONE,
                 "Random", MENU_UNSELECTED);

        any.a_int = i+1;	/* must be non-zero */

        add_menu(win, NO_GLYPH, &any , 'q', 0, ATR_NONE,
                 "Quit", MENU_UNSELECTED);

        Sprintf(pbuf, "Pick the race of your %s", plbuf);
        end_menu(win, pbuf);

        n = select_menu(win, PICK_ONE, &selected);
        destroy_nhwindow(win);

        if (n != 1 || selected[0].item.a_int == any.a_int)
          goto give_up;		/* Selected quit */

        k = selected[0].item.a_int - 1;
        free((genericptr_t) selected),	selected = 0;
      }

      flags.initrace = k;
    }

    (void)  root_plselection_prompt(plbuf, PROMPT_LAYER_WIDTH - 1,
                                    flags.initrole, flags.initrace, flags.initgend, flags.initalign);
  }

  /* Select a gender, if necessary */
  /* force compatibility with role/race, try for compatibility with
   * pre-selected alignment */
  if (flags.initgend < 0 || !validgend(flags.initrole, flags.initrace,
                                       flags.initgend)) {
    /* pre-selected gender not valid */
    if (pick4u == 'y' || flags.initgend == ROLE_RANDOM || flags.randomall) {
      flags.initgend = pick_gend(flags.initrole, flags.initrace,
                                 flags.initalign, PICK_RANDOM);
      if (flags.initgend < 0) {
        iprintf("Incompatible gender!");
        flags.initgend = randgend(flags.initrole, flags.initrace);
      }
    } else {	/* pick4u == 'n' */
      /* Count the number of valid genders */
      n = 0;	/* number valid */
      k = 0;	/* valid gender */

      for (i = 0; i < ROLE_GENDERS; i++) {
        if (ok_gend(flags.initrole, flags.initrace, i,
                    flags.initalign)) {
          n++;
          k = i;
        }
      }

      if (n == 0) {
        for (i = 0; i < ROLE_GENDERS; i++) {
          if (validgend(flags.initrole, flags.initrace, i)) {
            n++;
            k = i;
          }
        }
      }

      /* Permit the user to pick, if there is more than one */
      if (n > 1) {
        win = create_nhwindow(NHW_MENU);
        start_menu(win);

        any.a_void = 0;         /* zero out all bits */

        for (i = 0; i < ROLE_GENDERS; i++)
          if (ok_gend(flags.initrole, flags.initrace, i,
                      flags.initalign)) {
            any.a_int = i+1;
            add_menu(win, NO_GLYPH, &any, genders[i].adj[0],
                     0, ATR_NONE, genders[i].adj, MENU_UNSELECTED);
          }

        any.a_int = pick_gend(flags.initrole, flags.initrace,
                              flags.initalign, PICK_RANDOM)+1;

        if (any.a_int == 0)	/* must be non-zero */
          any.a_int = randgend(flags.initrole, flags.initrace)+1;

        add_menu(win, NO_GLYPH, &any , '*', 0, ATR_NONE,
                 "Random", MENU_UNSELECTED);

        any.a_int = i+1;	/* must be non-zero */

        add_menu(win, NO_GLYPH, &any , 'q', 0, ATR_NONE,
                 "Quit", MENU_UNSELECTED);

        Sprintf(pbuf, "Pick the gender of your %s", plbuf);
        end_menu(win, pbuf);

        n = select_menu(win, PICK_ONE, &selected);
        destroy_nhwindow(win);

        if (n != 1 || selected[0].item.a_int == any.a_int)
          goto give_up;		/* Selected quit */

        k = selected[0].item.a_int - 1;
        free((genericptr_t) selected),	selected = 0;
      }

      flags.initgend = k;
    }

    (void)  root_plselection_prompt(plbuf, PROMPT_LAYER_WIDTH - 1,
                                    flags.initrole, flags.initrace, flags.initgend, flags.initalign);
  }

  /* Select an alignment, if necessary */
  /* force compatibility with role/race/gender */
  if (flags.initalign < 0 || !validalign(flags.initrole, flags.initrace,
                                         flags.initalign)) {
    /* pre-selected alignment not valid */
    if (pick4u == 'y' || flags.initalign == ROLE_RANDOM || flags.randomall) {
      flags.initalign = pick_align(flags.initrole, flags.initrace,
                                   flags.initgend, PICK_RANDOM);
      if (flags.initalign < 0) {
        iprintf("Incompatible alignment!");
        flags.initalign = randalign(flags.initrole, flags.initrace);
      }
    } else {	/* pick4u == 'n' */
      /* Count the number of valid alignments */
      n = 0;	/* number valid */
      k = 0;	/* valid alignment */

      for (i = 0; i < ROLE_ALIGNS; i++) {
        if (ok_align(flags.initrole, flags.initrace, flags.initgend,
                     i)) {
          n++;
          k = i;
        }
      }

      if (n == 0) {
        for (i = 0; i < ROLE_ALIGNS; i++) {
          if (validalign(flags.initrole, flags.initrace, i)) {
            n++;
            k = i;
          }
        }
      }

      /* Permit the user to pick, if there is more than one */
      if (n > 1) {
        win = create_nhwindow(NHW_MENU);
        start_menu(win);

        any.a_void = 0;         /* zero out all bits */

        for (i = 0; i < ROLE_ALIGNS; i++)
          if (ok_align(flags.initrole, flags.initrace,
                       flags.initgend, i)) {
            any.a_int = i+1;
            add_menu(win, NO_GLYPH, &any, aligns[i].adj[0],
                     0, ATR_NONE, aligns[i].adj, MENU_UNSELECTED);
          }

        any.a_int = pick_align(flags.initrole, flags.initrace,
                               flags.initgend, PICK_RANDOM)+1;

        if (any.a_int == 0)	/* must be non-zero */
          any.a_int = randalign(flags.initrole, flags.initrace)+1;

        add_menu(win, NO_GLYPH, &any , '*', 0, ATR_NONE,
                 "Random", MENU_UNSELECTED);

        any.a_int = i+1;	/* must be non-zero */

        add_menu(win, NO_GLYPH, &any , 'q', 0, ATR_NONE,
                 "Quit", MENU_UNSELECTED);

        Sprintf(pbuf, "Pick the alignment of your %s", plbuf);
        end_menu(win, pbuf);

        n = select_menu(win, PICK_ONE, &selected);
        destroy_nhwindow(win);

        if (n != 1 || selected[0].item.a_int == any.a_int)
          goto give_up;		/* Selected quit */

        k = selected[0].item.a_int - 1;
        free((genericptr_t) selected),	selected = 0;
      }

      flags.initalign = k;
    }
  }
}
Ejemplo n.º 26
0
nds_cmd_t nds_get_direction()
{
  winid win;
  menu_item *sel;
  ANY_P ids[25];
  nds_cmd_t cmd;
  int i, j, k;
  int res;

  char tmp[2];
  char *direction_keys = nds_get_direction_keys();

  win = create_nhwindow(NHW_MENU);
  start_menu(win);

  ids[0].a_int = 0;

  for (i = 0, j = 1; i < 3; i++) {
    switch (i) {
      case 0:
        add_menu(win, NO_GLYPH, &(ids[0]), 0, 0, 0, "Walk", 0);
        break;

      case 1:
        add_menu(win, NO_GLYPH, &(ids[0]), 0, 0, 0, "Run", 0);
        break;

      case 2:
        add_menu(win, NO_GLYPH, &(ids[0]), 0, 0, 0, "Fight", 0);
        break;
    }

    for (k = 0; k < 8; j++, k++) {
      tmp[0] = direction_keys[k];
      tmp[1] = '\0';

      ids[j].a_int = j;

      add_menu(win, NO_GLYPH, &(ids[j]), 0, 0, 0, nds_command_to_string(tmp), 0);
    }
  }

  end_menu(win, "What Type of Movement?");
  res = select_menu(win, PICK_ONE, &sel);
  destroy_nhwindow(win);

  if (res <= 0) {
    cmd.f_char = -1;
    cmd.name = NULL;
  } else if (sel->item.a_int < 9) {
    tmp[0] = direction_keys[sel->item.a_int - 1];
    tmp[1] = '\0';

    cmd.f_char = direction_keys[sel->item.a_int - 1];
    cmd.name = nds_command_to_string(tmp);
  } else if (sel->item.a_int < 17) {
    nds_input_buffer_push(direction_keys[sel->item.a_int - 9]);

    cmd.f_char = 'g';
    cmd.name = nds_command_to_string(nds_input_buffer_shiftall());
  } else {
    nds_input_buffer_push(direction_keys[sel->item.a_int - 17]);

    cmd.f_char = 'F';
    cmd.name = nds_command_to_string(nds_input_buffer_shiftall());
  }

  NULLFREE(sel);

  return cmd;
}
Ejemplo n.º 27
0
nds_cmd_t nds_get_config_cmd(u16 key)
{
  winid win;
  menu_item *sel;
  ANY_P ids[15];
  nds_cmd_t cmd;
  char tmp[BUFSZ];
  int res;

  win = create_nhwindow(NHW_MENU);
  start_menu(win);

  ids[0].a_int = 1;
  ids[1].a_int = 2;
  ids[2].a_int = 3;
  ids[3].a_int = 4;
  ids[4].a_int = 5;

  add_menu(win, NO_GLYPH, &(ids[0]), 0, 0, 0, "Movement", 0);
  add_menu(win, NO_GLYPH, &(ids[1]), 0, 0, 0, "Game Command", 0);
  add_menu(win, NO_GLYPH, &(ids[2]), 0, 0, 0, "Toggle Option", 0);
  add_menu(win, NO_GLYPH, &(ids[3]), 0, 0, 0, "Map Panning", 0);
  add_menu(win, NO_GLYPH, &(ids[4]), 0, 0, 0, "No Command", 0);

  sprintf(tmp, "What do you want to assign to %s?", nds_key_to_string(key));
  end_menu(win, tmp);
  res = select_menu(win, PICK_ONE, &sel);
  destroy_nhwindow(win);

  if (res <= 0) {
    cmd.f_char = -1;
    cmd.name = NULL;
  } else {
    switch (sel->item.a_int) {
      case 1:
        cmd = nds_get_direction();
        break;

      case 2:
        nds_flush(0);
        cmd = nds_cmd_loop(CMDLOOP_CONFIG);
        break;

      case 3:
        {
          const char *tmp = nds_get_bool_option();

          if (tmp != NULL) {
            cmd.f_char = CMD_OPT_TOGGLE;
            cmd.name = "Toggle Option";

            nds_input_buffer_append((char *)tmp);
          } else {
            cmd.f_char = -1;
            cmd.name = NULL;
          }
        }

        break;

      case 4:
        cmd = nds_get_pan_direction();
        break;

      case 5:
        nds_flush(0);

        cmd.f_char = 0;
        cmd.name = NULL;
        break;
    }
  }

  NULLFREE(sel);

  return cmd;
}
Ejemplo n.º 28
0
int MainMenu::create_objects()
{
	BC_Menu *viewmenu, *windowmenu, *settingsmenu, *trackmenu;
	PreferencesMenuitem *preferences;

	recent_load = new BC_RecentList("PATH", mwindow->defaults);
SET_TRACE

	add_menu(filemenu = new BC_Menu(_("File")));
	filemenu->add_item(new_project = new New(mwindow));
	new_project->create_objects();

SET_TRACE
// file loaders
	filemenu->add_item(load_file = new Load(mwindow, this));
	load_file->create_objects();

SET_TRACE
// new and load can be undone so no need to prompt save
	Save *save;                   //  affected by saveas
	filemenu->add_item(save = new Save(mwindow));
	SaveAs *saveas;
	filemenu->add_item(saveas = new SaveAs(mwindow));
	save->create_objects(saveas);
	saveas->set_mainmenu(this);
	filemenu->add_item(record = new RecordMenuItem(mwindow));

	filemenu->add_item(render = new RenderItem(mwindow));
	filemenu->add_item(new ExportEDLItem(mwindow));
	filemenu->add_item(new BatchRenderMenuItem(mwindow));
	filemenu->add_item(new BC_MenuItem("-"));
	filemenu->add_item(quit_program = new Quit(mwindow));
	quit_program->create_objects(save);
	filemenu->add_item(new DumpEDL(mwindow));
	filemenu->add_item(new DumpPlugins(mwindow));
	filemenu->add_item(new LoadBackup(mwindow));
	filemenu->add_item(new SaveBackup(mwindow));

	BC_Menu *editmenu;
	add_menu(editmenu = new BC_Menu(_("Edit")));
	editmenu->add_item(undo = new Undo(mwindow));
	editmenu->add_item(redo = new Redo(mwindow));
	editmenu->add_item(new BC_MenuItem("-"));
	editmenu->add_item(new Cut(mwindow));
	editmenu->add_item(new Copy(mwindow));
	editmenu->add_item(new Paste(mwindow));
	editmenu->add_item(new Clear(mwindow));
	editmenu->add_item(new PasteSilence(mwindow));
	editmenu->add_item(new MuteSelection(mwindow));
	editmenu->add_item(new TrimSelection(mwindow));
	editmenu->add_item(new SelectAll(mwindow));
	editmenu->add_item(new BC_MenuItem("-"));
	editmenu->add_item(new ClearLabels(mwindow));

	BC_Menu *keyframemenu;
	add_menu(keyframemenu = new BC_Menu(_("Keyframes")));
	keyframemenu->add_item(new CutKeyframes(mwindow));
	keyframemenu->add_item(new CopyKeyframes(mwindow));
	keyframemenu->add_item(new PasteKeyframes(mwindow));
	keyframemenu->add_item(new ClearKeyframes(mwindow));
	keyframemenu->add_item(new StraightenKeyframes(mwindow));
	keyframemenu->add_item(new BC_MenuItem("-"));
	keyframemenu->add_item(new CopyDefaultKeyframe(mwindow));
	keyframemenu->add_item(new PasteDefaultKeyframe(mwindow));




	add_menu(audiomenu = new BC_Menu(_("Audio")));
	audiomenu->add_item(new AddAudioTrack(mwindow));
	audiomenu->add_item(new DefaultATransition(mwindow));
	audiomenu->add_item(new MapAudio1(mwindow));
	audiomenu->add_item(new MapAudio2(mwindow));
	audiomenu->add_item(aeffects = new MenuAEffects(mwindow));

	add_menu(videomenu = new BC_Menu(_("Video")));
	videomenu->add_item(new AddVideoTrack(mwindow));
	videomenu->add_item(new DefaultVTransition(mwindow));
	videomenu->add_item(veffects = new MenuVEffects(mwindow));

	add_menu(trackmenu = new BC_Menu(_("Tracks")));
	trackmenu->add_item(new MoveTracksUp(mwindow));
	trackmenu->add_item(new MoveTracksDown(mwindow));
	trackmenu->add_item(new DeleteTracks(mwindow));
	trackmenu->add_item(new DeleteTrack(mwindow));
	trackmenu->add_item(new ConcatenateTracks(mwindow));

	add_menu(settingsmenu = new BC_Menu(_("Settings")));

	settingsmenu->add_item(new SetFormat(mwindow));
	settingsmenu->add_item(preferences = new PreferencesMenuitem(mwindow));
	mwindow->preferences_thread = preferences->thread;
	settingsmenu->add_item(labels_follow_edits = new LabelsFollowEdits(mwindow));
	settingsmenu->add_item(plugins_follow_edits = new PluginsFollowEdits(mwindow));
	settingsmenu->add_item(cursor_on_frames = new CursorOnFrames(mwindow));
	settingsmenu->add_item(new SaveSettingsNow(mwindow));
	settingsmenu->add_item(loop_playback = new LoopPlayback(mwindow));
	settingsmenu->add_item(new SetBRenderStart(mwindow));
// set scrubbing speed
//	ScrubSpeed *scrub_speed;
//	settingsmenu->add_item(scrub_speed = new ScrubSpeed(mwindow));
//	if(mwindow->edl->session->scrub_speed == .5) 
//		scrub_speed->set_text(_("Fast Shuttle"));






	add_menu(viewmenu = new BC_Menu(_("View")));
	viewmenu->add_item(show_assets = new ShowAssets(mwindow, "0"));
	viewmenu->add_item(show_titles = new ShowTitles(mwindow, "1"));
	viewmenu->add_item(show_transitions = new ShowTransitions(mwindow, "2"));
	viewmenu->add_item(fade_automation = new ShowAutomation(mwindow, _("Fade"), "3", AUTOMATION_FADE));
	viewmenu->add_item(mute_automation = new ShowAutomation(mwindow, _("Mute"), "4", AUTOMATION_MUTE));
	viewmenu->add_item(mode_automation = new ShowAutomation(mwindow, _("Overlay mode"), "5", AUTOMATION_MODE));
	viewmenu->add_item(pan_automation = new ShowAutomation(mwindow, _("Pan"), "6", AUTOMATION_PAN));
	viewmenu->add_item(plugin_automation = new PluginAutomation(mwindow, "7"));
	viewmenu->add_item(mask_automation = new ShowAutomation(mwindow, _("Mask"), "8", AUTOMATION_MASK));
	viewmenu->add_item(camera_x = new ShowAutomation(mwindow, _("Camera X"), "", AUTOMATION_CAMERA_X));
	viewmenu->add_item(camera_y = new ShowAutomation(mwindow, _("Camera Y"), "", AUTOMATION_CAMERA_Y));
	viewmenu->add_item(camera_z = new ShowAutomation(mwindow, _("Camera Z"), "", AUTOMATION_CAMERA_Z));
	viewmenu->add_item(project_x = new ShowAutomation(mwindow, _("Projector X"), "", AUTOMATION_PROJECTOR_X));
	viewmenu->add_item(project_y = new ShowAutomation(mwindow, _("Projector Y"), "", AUTOMATION_PROJECTOR_Y));
	viewmenu->add_item(project_z = new ShowAutomation(mwindow, _("Projector Z"), "", AUTOMATION_PROJECTOR_Z));


	add_menu(windowmenu = new BC_Menu(_("Window")));
	windowmenu->add_item(show_vwindow = new ShowVWindow(mwindow));
	windowmenu->add_item(show_awindow = new ShowAWindow(mwindow));
	windowmenu->add_item(show_cwindow = new ShowCWindow(mwindow));
	windowmenu->add_item(show_gwindow = new ShowGWindow(mwindow));
	windowmenu->add_item(show_lwindow = new ShowLWindow(mwindow));
	windowmenu->add_item(new TileWindows(mwindow));

SET_TRACE
	return 0;
}
Ejemplo n.º 29
0
/**
 * compute_vpd - generate vpd menu
 **/
void compute_vpd(struct s_my_menu *menu, struct s_hardware *hardware)
{
	char buffer[SUBMENULEN + 1];
	char statbuffer[STATLEN + 1];	/* Status bar */

	menu->menu = add_menu(" VPD ", -1);
	menu->items_count = 0;
	set_menu_pos(SUBMENU_Y, SUBMENU_X);

	snprintf(buffer, sizeof buffer, "Address                  : %s",
		 hardware->vpd.base_address);
	snprintf(statbuffer, sizeof statbuffer, "Address: %s",
		 hardware->cpu.vendor);
	add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
	menu->items_count++;

	snprintf(buffer, sizeof buffer, "Bios Build ID            : %s",
		 hardware->vpd.bios_build_id);
	snprintf(statbuffer, sizeof statbuffer, "Bios Build ID: %s",
		 hardware->vpd.bios_build_id);
	add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
	menu->items_count++;

	snprintf(buffer, sizeof buffer, "Bios Release Date        : %s",
		 hardware->vpd.bios_release_date);
	snprintf(statbuffer, sizeof statbuffer, "Bios Release Date: %s",
		 hardware->vpd.bios_release_date);
	add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
	menu->items_count++;

	snprintf(buffer, sizeof buffer, "Bios Version             : %s",
		 hardware->vpd.bios_version);
	snprintf(statbuffer, sizeof statbuffer, "Bios Version: %s",
		 hardware->vpd.bios_version);
	add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
	menu->items_count++;

	snprintf(buffer, sizeof buffer, "Default Flash Filename   : %s",
		 hardware->vpd.default_flash_filename);
	snprintf(statbuffer, sizeof statbuffer, "Default Flash Filename: %s",
		 hardware->vpd.default_flash_filename);
	add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
	menu->items_count++;

	snprintf(buffer, sizeof buffer, "Box Serial Number        : %s",
		 hardware->vpd.box_serial_number);
	snprintf(statbuffer, sizeof statbuffer, "Box Serial Number: %s",
		 hardware->vpd.box_serial_number);
	add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
	menu->items_count++;

	snprintf(buffer, sizeof buffer, "Motherboard Serial Number: %s",
		 hardware->vpd.motherboard_serial_number);
	snprintf(statbuffer, sizeof statbuffer, "Motherboard Serial Number: %s",
		 hardware->vpd.motherboard_serial_number);
	add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
	menu->items_count++;

	snprintf(buffer, sizeof buffer, "Machine Type/Model       : %s",
		 hardware->vpd.machine_type_model);
	snprintf(statbuffer, sizeof statbuffer, "Machine Type/Model: %s",
		 hardware->vpd.machine_type_model);
	add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
	menu->items_count++;

	printf("MENU: VPD menu done (%d items)\n", menu->items_count);
}