Exemple #1
0
void    metawindow()
/* Show the meta server menu window */
{
  int i, height;
  char *header;
  static int lastHeight = 0;

  if (!metaWin) {
    height = 250 + metaHeight * (W_Textheight + 8) + 4 * (metaHeight - 1);
    metaWin = W_MakeWindow("Netrek Server List", 0, 0, 716, height, NULL, 2,
                           foreColor);
    W_SetBackgroundImage(metaWin, "Misc/map_back.png");
    logo = W_ReadImage(metaWin, "netrek-green-white-300px.png");
    metaList = W_MakeMenu("metalist", 50, 200, LINE, metaHeight, metaWin, 1);
    lastHeight = metaHeight;
    make_help();
  } else {
    if (metaHeight > lastHeight) {
      W_ReinitMenu(metaList, LINE, metaHeight);
      W_ResizeMenu(metaList, LINE, metaHeight);
      lastHeight = metaHeight;
    }
    // FIXME: handle metaList growing beyond metaWin
  }

  header = "Server                                           Status        Type      Age";
  W_WriteText(metaList, 0, 0, W_Cyan, header, -1, 0);

  for (i = 0; i < metaHeight; i++) redraw(i);

  /* Give the window the right name */
  W_RenameWindow(metaWin, metaWindowName);

  /* Add additional options */
  W_WriteText(metaList, 0, metaHeight-B_REFRESH, W_Yellow,
              "Refresh                                           (r)",
              -1, 0);
  add_redraw();
  W_WriteText(metaList, 0, metaHeight-B_HELP, W_Yellow,
                "Help & Tips                                       (h)",
              -1, 0);
  W_WriteText(metaList, 0, metaHeight-B_QUIT, W_Yellow,
                "Quit                                              (q)",
              -1, 0);

  /* Map window */
  W_MapWindow(metaList);
  W_MapWindow(metaWin);
}
Exemple #2
0
/* Set up the option menus and window. */
optionwindow(void)
{
  register int i;

  /* Init not done flag */
  notdone = 1;

  *newkeys = '\0';
  if (FirstMenu == NULL)
    {
      MaxOptions = InitOptionMenus();
      if (MaxOptions < 0)
  {
    fprintf(stderr, "InitOptionMenus() error %s!\n", MaxOptions);
    notdone = 0;
    return;
  }
    }

  /* Create window big enough to hold option windows */
  if (optionWin == NULL)
    {

      optionWin = W_MakeMenu("option", TWINSIDE + 10, -BORDER + 10, OPTIONLEN,
           MaxOptions, baseWin, OPTIONBORDER);
      W_SetWindowKeyDownHandler(optionWin, optionaction);
      W_SetWindowButtonHandler(optionWin, optionaction);
      W_DefineArrowCursor(optionWin);
      CurrentMenu = FirstMenu;

      RefreshOptions();
    }

  /* Map window */
  W_MapWindow(optionWin);
}
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();
}