예제 #1
0
/**************************************************************************
  Update the information label which gives info on the current unit and the
  square under the current unit, for specified unit.  Note that in practice
  punit is almost always (or maybe strictly always?) the focus unit.
  Clears label if punit is NULL.
  Also updates the cursor for the map_canvas (this is related because the
  info label includes a "select destination" prompt etc).
  Also calls update_unit_pix_label() to update the icons for units on this
  square.
**************************************************************************/
void update_unit_info_label(struct unit_list *punitlist)
{
  char buffer[512];

  fc_snprintf(buffer, sizeof(buffer), "%s\n%s",
              get_unit_info_label_text1(punitlist),
              get_unit_info_label_text2(punitlist, 0));
  xaw_set_label(unit_info_label, buffer);

  if (punitlist && unit_list_size(punitlist) > 0) {
    switch (hover_state) {
    case HOVER_NONE:
      XUndefineCursor(display, XtWindow(map_canvas));
      break;
    case HOVER_PATROL:
      XDefineCursor(display, XtWindow(map_canvas), cursors[CURSOR_PATROL]);
      break;
    case HOVER_GOTO:
    case HOVER_CONNECT:
      XDefineCursor(display, XtWindow(map_canvas), cursors[CURSOR_GOTO]);
      break;
    case HOVER_NUKE:
      XDefineCursor(display, XtWindow(map_canvas), cursors[CURSOR_NUKE]);
      break;
    case HOVER_PARADROP:
      XDefineCursor(display, XtWindow(map_canvas), cursors[CURSOR_PARADROP]);
      break;
    }
  } else {
    xaw_set_label(unit_info_label, "");
    XUndefineCursor(display, XtWindow(map_canvas));
  }

  update_unit_pix_label(punitlist);
}
예제 #2
0
/**************************************************************************
  Update the information label which gives info on the current unit and the
  square under the current unit, for specified unit.  Note that in practice
  punit is always the focus unit.
  Clears label if punit is NULL.
  Also updates the cursor for the map_canvas (this is related because the
  info label includes a "select destination" prompt etc).
  Also calls update_unit_pix_label() to update the icons for units on this
  square.
**************************************************************************/
void update_unit_info_label(struct unit_list *punits)
{
  GtkWidget *label;

  label = gtk_frame_get_label_widget(GTK_FRAME(unit_info_frame));
  gtk_label_set_text(GTK_LABEL(label),
		     get_unit_info_label_text1(punits));

  gtk_label_set_text(GTK_LABEL(unit_info_label),
		     get_unit_info_label_text2(punits, 0));

  update_unit_pix_label(punits);
}
예제 #3
0
/**************************************************************************
  Called when the tileset is changed to reset unit pixmaps.
**************************************************************************/
void reset_unit_below_pixmaps(void)
{
  long i;

  for (i = 0; i < num_units_below; i++) {
    XFreePixmap(display, unit_below_pixmap[i]);
  }
  xaw_set_bitmap(more_arrow_label, None);
  fill_unit_below_pixmaps();

  set_unit_icons_more_arrow(FALSE);
  if (get_num_units_in_focus() == 1) {
    set_unit_icon(-1, head_of_units_in_focus());
  } else {
    set_unit_icon(-1, NULL);
  }
  update_unit_pix_label(get_units_in_focus());
}