Exemplo n.º 1
0
showMacroWin(void)
{
  int     num = macrocnt + 5;

  if (!macroWin)
    {
      if (maclevel == 0)
  {
    lineno = 0;
    filldist(0);
    num = lineno + 5;
  }

      /* we'll use GWINSIDE since it is (probably) less than or equal to *
       * TWINSIDE.  The smaller the better. */
      macroWin = W_MakeTextWindow("macrow", GWINSIDE + BORDER, BORDER,
          80, num, NULL, BORDER);

      W_ResizeTextWindow(macroWin, 80, num);
      W_DefineTrekCursor(macroWin);
      W_SetWindowExposeHandler(macroWin, fillmacro);
      W_SetWindowButtonHandler(macroWin, switchmacros);
      W_MapWindow(macroWin);
    }
  else if (W_IsMapped(macroWin))
    W_UnmapWindow(macroWin);
  else
    W_MapWindow(macroWin);
}
Exemplo n.º 2
0
void
newwin(char *hostmon, char *progname)
{
    int     i;
    W_Image *image;

    /* W_Initialize(hostmon); */
    getResources(progname);

    /* the x,y passwd to makewindow are the x,y of the top left corner of
       the border.  The actual window starts x+BORDER,y+BORDER down.  The
       given width is the width of the window WITHOUT the border, ie. 
       useable space.  [BDyess] */
    baseWin = W_MakeWindow("netrek", 0, YOFF, WINSIDE + MAPSIDE + 6 * BORDER,
			   WINSIDE + 9 * BORDER + 2 * MESSAGESIZE + 
			   23 * W_Textheight + 2*WIN_EDGE, NULL, 
			   "bomb here", /*no border*/ 0, gColor);
    image = getImage(I_ICON);
    iconWin = W_MakeWindow("netrek_icon", 0, 0, image->width,image->height,NULL,
			   (char *) 0, BORDER, gColor);
    W_SetIconWindow(baseWin, iconWin);
    w = W_MakeWindow("local", BORDER, BORDER, WINSIDE, WINSIDE, baseWin, 
                     (char *) 0, BORDER, foreColor);
    mapw = W_MakeWindow("map", WINSIDE + 3*BORDER, BORDER, MAPSIDE, MAPSIDE, 
                        baseWin, (char *) 0, BORDER, foreColor);
    tstatw = W_MakeWindow("tstat", BORDER, winside+3*BORDER, winside, 
                          STATSIZE, baseWin, "xterm", BORDER, foreColor);
/*    if(xpm) W_SetWindowBackgroundImage(tstatw, getImage(I_DASHBOARD_BG));*/
    warnw = W_MakeWindow("warn", winside+3*BORDER, mapside+3*BORDER, 
    			 mapside, MESSAGESIZE, baseWin, "xterm", BORDER,
			 foreColor);
    messagew = W_MakeWindow("message", winside+3*BORDER, 
               mapside + 5*BORDER + MESSAGESIZE, mapside, MESSAGESIZE, baseWin,
	       "xterm", BORDER, foreColor);
    planetw = W_MakeTextWindow("planet", 10, 10, 75, (MAXPLANETS + 16) / 2, w, 
                               (char *) 0, 2);
    planetw2 = W_MakeTextWindow("planet2", 10, 10, 75, (MAXPLANETS + 16) / 2, 
                                mapw, (char *) 0, 2);
    rankw = W_MakeTextWindow("rank", 50, 100, 65, nranks2 + 8, w, (char*) 0, 2);
    playerw = W_MakeTextWindow("Player", winside + 3*BORDER, 
                               mapside + 7 * BORDER + 2 * MESSAGESIZE,
			       (mapside-2*WIN_EDGE)/W_Textwidth/*82*/, 23,
			       baseWin, (char *) 0, 2);
    helpWin = W_MakeTextWindow("HELP!", 0, 
                               YOFF + winside + 2 * BORDER + 2 * MESSAGESIZE,
		               160, helpmessages / 4 + 1, NULL, (char *) 0, 
			       BORDER);

    initMessageWindows();

    pStats = W_MakeWindow("Network Statistics", 500, 4, pStatsWidth(), pStatsHeight(),
			  NULL, (char *) 0, 1, foreColor);
    udpWin = W_MakeMenu("UDP", winside + 10, -BORDER + 10, 40, UDP_NUMOPTS,
			NULL, 2);

    spWin = W_MakeMenu("network", winside + 10, -BORDER + 10, 40, SPK_NUMFIELDS,
		       NULL, 2);

  toolsWin = W_MakeScrollingWindow("tools", winside + BORDER, BORDER,
				   80, TOOLSWINLEN, NULL, "xterm", BORDER);

    motdWin = W_MakeWindow("Motd"
			   ,-BORDER, -BORDER, winside, winside, NULL,
			   (char *) 0, BORDER, foreColor);

    for (i = 0; i < 4; i++) {
	teamWin[i] = W_MakeWindow(teaminfo[i].shortname, i * (BOXSIDE+2*BORDER),
	                  0, BOXSIDE, BOXSIDE, mapw, (char *) 0, BORDER, 
			  foreColor);
    }
    qwin = W_MakeWindow("quit", 4 * (BOXSIDE+2*BORDER), 0, BOXSIDE, BOXSIDE, 
                        mapw, "pirate", BORDER, foreColor);

/*    statwin = W_MakeWindow("Stats", 422, 13, 160, 95, NULL, (char*)0,
      5, foreColor);*/
    statwin = W_MakeWindow("stats", 422, 13, 160, 80, NULL,
			   (char *) 0, 5, foreColor);
    newstatwin = W_MakeWindow("NewStats", 422, 13, 100 + 2*BORDER, 400+2*BORDER,
                              NULL, (char *) 0, BORDER, foreColor);

#define WARHEIGHT 2
#define WARWIDTH 20
#define WARBORDER BORDER

    war = W_MakeMenu("war", winside + 10, 10, WARWIDTH, 6, baseWin,
		     WARBORDER);


    /* needed to update constants now that local and map window sizes
       are dynamic [BDyess] */
    recalcWindowConstants();
    saveimages();
}
Exemplo n.º 3
0
void
        showdef(void)
{
  register i, j, x = 0, y = 0, xo = 0, yo = 0, max_desc = 0, height = 1,
          width = 1;
  register struct def *d;
  char   *val;

  name = getdefault("name");
  keymap = getdefault("keymap");
  ckeymap = getdefault("ckeymap");
  plist = getdefault("playerlist");
  cloak_chars = cloakChars;
  bmap = getdefault("buttonmap");

  if (!defWin)
    defWin = W_MakeTextWindow("xtrekrc_help", 1, 100, 174, 41, NULL, BORDER);

  for (i = 0, d = def_messages; i < DEFMESSAGES; i++, d++)
    {
      x = xo;
      y = yo;

      W_WriteText(defWin, x, y, W_Yellow, d->name, strlen(d->name),
      W_BoldFont);
      x += NAME_WIDTH;

      W_WriteText(defWin, x, y, textColor, d->desc, strlen(d->desc),
      W_RegularFont);
      if (strlen(d->desc) > max_desc)
  {
    max_desc = strlen(d->desc);
    width = MAX(width, x + max_desc);
  }
      y++;
      x = xo + INDENT;

      if (d->type != STR_DEF)
  {
    if (!d->values[0].desc && d->variable)
      {
        if (d->type == SINT_DEF)
    val = itos(*d->variable);
        else
    val = itos(d->values[0].i_value);

        W_WriteText(defWin, x, y, W_Green, val, strlen(val),
        W_RegularFont);
        y++;
      }
    for (j = 0; d->values[j].desc; j++)
      {
        switch (d->type)
    {
    case INT_DEF:
      val = itos(d->values[j].i_value);
      if (d->values[j].i_value == *d->variable)
        {
          W_WriteText(defWin, x, y, W_Green, val, strlen(val),
          W_BoldFont);
          if (W_Mono())
      {
        W_WriteText(defWin, x + 1, y, W_Green, "*", 1,
              W_RegularFont);
      }
        }
      else
        W_WriteText(defWin, x, y, textColor, val, strlen(val),
        W_RegularFont);
      x = xo + NAME_WIDTH;
      W_WriteText(defWin, x, y, textColor, d->values[j].desc,
            strlen(d->values[j].desc), W_RegularFont);
      y++;
      x = xo + INDENT;
      break;

    case BOOL_DEF:
      val = btoa(*d->variable);
      W_WriteText(defWin, x, y, W_Green, val, strlen(val),
            W_RegularFont);
      y++;
      x = xo + INDENT;
      break;
    default:
      fprintf(stderr, "Unknown type.\n");
      break;
    }
      }
  }
      else if (d->variable && *d->variable)
  {
    W_WriteText(defWin, x, y, W_Green, *((char **) d->variable),
          strlen(*((char **) d->variable)),
          W_RegularFont);
    y++;
  }

      height = MAX(height, y);
      if (y > MAX_VLINES)
  {
    yo = 0;
    xo += NAME_WIDTH + max_desc + 2;
    max_desc = 0;
  }
      else
  {
    yo = y + 1;
  }
    }

  W_ResizeTextWindow(defWin, width, height);
  W_MapWindow(defWin);
}