# include "Ximage.h"
# define PAD 40

/* general initialization for things not specific to X */
void DefineLayout (int argc, char **argv) {

  int i;
  
  /** initiate connection with server **/
  if (!FOREGROUND) {	
    if (argc < 2) {
      fprintf (stderr, "socket path not specified\n");
      exit (0);
    }
    sock = KiiWait (argv[1]);
  }

  InitRotFonts ();

  /** set up defaults for display region **/
  /* default startup uses one graphic region, filling the window */
  
  Nsection = 1;
  ALLOCATE (section, Layout, Nsection);
  TheSection = 0;

  /* set up axis positions */
  for (i = 0; i < 4; i++) {
    section[0].axis[i].min = 0.0;
    section[0].axis[i].max = 1.0;
    section[0].axis[i].isaxis = FALSE;
    section[0].axis[i].areticks = FALSE;
    section[0].axis[i].islabel = FALSE;
  }    
  for (i = 0; i < 8; i++) {
    strcpy (section[0].label[i].text, "");
  }
  section[0].x  = 0;
  section[0].dx = 1; 
  section[0].y  = 0; 
  section[0].dy = 1; 
  strcpy (section[0].name, "default");

  PositionPicture (&section[0]);

  section[0].Nobjects = 0;
  section[0].Nptext = 0;

  ALLOCATE (section[0].objects, Gobjects, 1);  /* allocate so later free will not crash! */
  section[0].objects[0].x   = section[0].objects[0].y   = section[0].objects[0].z = (float *) NULL;
  section[0].objects[0].dxm = section[0].objects[0].dxp = (float *) NULL;
  section[0].objects[0].dym = section[0].objects[0].dyp = (float *) NULL;
  
  ALLOCATE (section[0].ptext, Label, 1);       /* allocate so later free will not crash! */

}
