Example #1
0
void PAGE::InitDlgControl ( void )
{
	char 	name[OBJECTNAMESIZE+1];
	RECT	lorect;
  POINT	pt;

	data0 = LockPageData0(objectId);

  snap = data0->snap;
	CheckDlgButton(hDialog, PAGEGRID, data0->snap);

	AObjGetName(objectId, name, OBJECTNAMESIZE);
	SetWindowText(hDialog, name);

	hRemoveButton   = GetDlgItem(hDialog, PAGEREMOVE);
	hAddButton      = GetDlgItem(hDialog, PAGEADD);
	hEditButton     = GetDlgItem(hDialog, PAGEEDIT);
  hPageLayout			= GetDlgItem(hDialog, PAGELOUT);  

	SetFocus(hAddButton);

	GetClientRect(hDialog, &dialogRect);

	// key layout to the position of the label "Page Layout"
	GetWindowRect(hPageLayout, &lorect);
	pt.x = lorect.left;
  pt.y = lorect.bottom;
	ScreenToClient(hDialog, &pt);
  dialogRect.top = pt.y + 1;
  dialogRect.left = pt.x;

	grid_height = dialogRect.bottom - dialogRect.top;

	// make sure grid increments are even numbers
	// otherwise snap to grid will not work
	grid_inc_y = grid_height/14;
	grid_inc_x = grid_inc_y*(float(aspecty)/float(aspectx));

	grid_inc_y = (grid_inc_y % 2) ? grid_inc_y-1 : grid_inc_y;
	grid_inc_x = (grid_inc_x % 2) ? grid_inc_x-1 : grid_inc_x;

	grid_height = grid_inc_y * 14;
	grid_width  = (grid_inc_x * 8.5)+4;

	pixinch_x = grid_inc_x;
	pixinch_y = grid_inc_y;

	CreateLayoutClass();
	CreateLayoutWindow();
	FontSetup();

	WindowList();

	CreateObjectClass();
	SelectedList();

	UpdateRemoveButton();
	UpdateEditButton();
	UpdateAddButton();

	UnlockPageData0(objectId);
}
Example #2
0
main(int argc, char **argv)
{
  int i = 1, not_emit = 0, mem_debug = 0;
  char *vid, filename[256], *name, *oz_root, class_sc, *cpath = NULL;
#if 0
  int shared = 0;
#endif

  Mode = NORMAL;

  while (i < argc && *argv[i] == '-')
    {
      if (!strcmp(argv[i], "-d")) 
	{
	  Debug = 1;
	}
      else if (!strcmp(argv[i], "-d2")) 
	{
	  Debug = 2;
	}
      else if (!strcmp (argv[i], "-n"))
	{
	  not_emit = 1;
	}
      else if (!strcmp (argv[i], "-g"))
	{
	  int j, num = atoi(argv[++i]);

	  for (j = 0; j < num; j++)
	    SetTypeParameter (argv[++i]);

	  Generic = 1;
	}
#if 0
      else if (!strcmp (argv[i], "-s"))
	{
	  shared = 1;
	}
#endif
      else if (!strcmp (argv[i], "-c"))
	{
	  ClassPath = argv[++i];
	}
      else if (!strcmp (argv[i], "-p0"))
	{
	  Mode = THIS_CLASS;
	}
      else if (!strcmp (argv[i], "-p1"))
	{
	  Mode = USED_CLASSES;
	}
      else if (!strcmp (argv[i], "-p2"))
	{
	  Mode = INHERITED_CLASSES;
	}
      else if (!strcmp (argv[i], "-p3"))
	{
	  Mode = ALL_CLASSES;
	}
      else if (!strcmp (argv[i], "-pg"))
	{
	  Generic = 1;
	  Mode = GENERIC_PARAMS;
	}
      else if (!strcmp (argv[i], "-object"))
	{
	  Object = 1;
	}
#ifdef NONISHIOKA
      else if (!strcmp (argv[i], "-md"))
	{
	  mem_debug = atoi (argv[++i]);
	}
#else
#ifdef MALLOC_DEBUG
      else if (!strcmp (argv[i], "-md"))
	{
	  mem_debug = atoi (argv[++i]);
	}
#endif
#endif
      i++;
    }

#ifdef NONISHIOKA
  malloc_debug (mem_debug);
#else
#ifdef MALLOC_DEBUG
  malloc_debug (mem_debug);
#endif
#endif

  if (!(oz_root = getenv ("OZROOT")))
    {
      fprintf (stderr, "You must set OZROOT\n");
      exit (1);
    }
  if (!ClassPath)
    {
      cpath = "lib/boot-class";
      ClassPath = (char *) malloc (strlen (oz_root) + strlen (cpath) + 1);
      sprintf (ClassPath, "%s/%s", oz_root, cpath);
    }

  Pass = 0;
  Part = NOT_PART;

  if (Mode != NORMAL)
    {
#if 0
      if (shared)
	{
	  if (Mode == INHERITED_CLASSES)
	    {
	      print_usage ();
	      exit (1);
	    }
	  
	  yyfile = argv[i];
	  Part = PUBLIC_PART;
	}
      else if (Mode == GENERIC_PARAMS)
#endif
      if (Mode == GENERIC_PARAMS)
	{
	  yyfile = argv[i];
	}
      else if (Mode == USED_CLASSES || Mode == ALL_CLASSES)
	{
	  if (i + 1 == argc)
	    {
	      print_usage ();
	      exit (1);
	    }
	  
	  if (!strchr (argv[i], '.'))
	    {
	      Part = atoi (argv[i++]);
	      yyfile = argv[i];
	    }
	  else
	    {
	      yyfile = argv[i++];
	      LoadSchool (argv[i++]);
	      Part = PRIVATE_PART;
	    }
	}
      else
	yyfile = argv[i];

      if (!(yyin = fopen (yyfile, "r")))
	{
	  fprintf(stderr, "cannot open file: %s\n", argv[i]);
	  exit(1);
	}

      /* octal escaping */
      yyin = EucToOctalEscape (yyin, oz_root);

      yyparse ();

      if (Part == PRIVATE_PART)
	{
	  Pass = 1;
	  yylineno = 1;
	  rewind (yyin);
	  yyparse ();
	}

      fclose (yyin);

      return Error;
    }

#if 0
  if ((shared && i + 2 >= argc) || (!shared && i + 3 >= argc))
#endif
  if (i + 3 >= argc)
    {
      print_usage ();
      exit(1);
    }
  
#if 0
  if (shared)
    {
      Part = PUBLIC_PART;
      name = argv[i++];
    }
  else
    {
#endif
      Part = atoi (argv [i++]);
      name = argv[i++];
  
      if (Object && strcmp (name, "Object"))
	{
	  fprintf (stderr, "this class not `Object'\n");
	  exit (1);
	}
#if 0
    }
#endif

  yyfile = argv[i++];
  LoadSchool (argv[i]);

  vid = GetVID (name, Part);

  if (Debug)
    PrintSchool (-1, 0);

  if (!not_emit)
    switch (Part) 
      {
      case PUBLIC_PART:
	sprintf (filename, "%s/%s/public.z", ClassPath, vid);
	PublicOutputFileZ = file_open (filename);
	
	sprintf (filename, "%s/%s/public.h", ClassPath, vid);
	PublicOutputFileH = file_open (filename);

	class_sc = GetClassSC (name);

	if (class_sc == SC_RECORD || class_sc == SC_STATIC) 
	  {
	    if (class_sc == SC_STATIC)
	      {
		sprintf (filename, "%s/%s/private.i", ClassPath, vid);
		PrivateOutputFileI = file_open (filename);
	      }

	    sprintf (filename, "%s/%s/private.l", ClassPath, vid);
	    PrivateOutputFileL = file_open (filename);
#if 0
	    vid = GetVID (name, 2);
#endif
	    sprintf (filename, "%s/%s/private.c", ClassPath, vid);
	    PrivateOutputFileC = file_open (filename);
	  }

	if (class_sc && class_sc != SC_ABSTRACT)
	  {
	    sprintf (filename, "%s/%s/private.d", ClassPath, vid);
	    PrivateOutputFileD = file_open (filename);
	  }

	break;

      case PROTECTED_PART:
	sprintf (filename, "%s/%s/protected.z", ClassPath, vid);
	ProtectedOutputFileZ = file_open (filename);
	
	sprintf (filename, "%s/%s/protected.h", ClassPath, vid);
	ProtectedOutputFileH = file_open (filename);
	break;

    case PRIVATE_PART:
	sprintf (filename, "%s/%s/private.l", ClassPath, vid);
	PrivateOutputFileL = file_open (filename);
	
	sprintf (filename, "%s/%s/private.i", ClassPath, vid);
	PrivateOutputFileI = file_open (filename);
	      
	sprintf (filename, "%s/%s/private.d", ClassPath, vid);
	PrivateOutputFileD = file_open (filename);
	  
	sprintf (filename, "%s/%s/private.h", ClassPath, vid);
	PrivateOutputFileH = file_open (filename);
	      
	sprintf (filename, "%s/%s/private.c", ClassPath, vid);
	PrivateOutputFileC = file_open (filename);
	break;
      }

  CreateObjectClass ();
  LoadClass (yyfile, name, oz_root);

  if (!not_emit)
    switch (Part)
      {
      case PUBLIC_PART:
	if (!Error)
	  {
	    EmitClassFileZ (ThisClass, Part);
	    EmitHeader (ThisClass);
	    if (ThisClass->cl == TC_StaticObject)
	      {
		EmitClassFileI (ThisClass);
		fclose (PrivateOutputFileI);
	      }
	  }

	if (ThisClass->cl == TC_Record || ThisClass->cl == TC_StaticObject)
	  {
	    fclose (PrivateOutputFileL);
	    fclose (PrivateOutputFileC);
	  }

	if (ThisClass->cl != TC_Object)
	  fclose (PrivateOutputFileD);

	fclose (PublicOutputFileZ);
	fclose (PublicOutputFileH);
	break;
      case PROTECTED_PART:
	if (!Error)
	  {
	    EmitClassFileZ (ThisClass, Part);
	    EmitHeader (ThisClass);
	  }
	fclose (ProtectedOutputFileZ);
	fclose (ProtectedOutputFileH);
	break;
      case PRIVATE_PART:
	if (!Error)
	  {
	    EmitClassFileI (ThisClass);
	    EmitHeader (ThisClass);
	  }
	fclose (PrivateOutputFileL);
	fclose (PrivateOutputFileI);
	fclose (PrivateOutputFileD);
	fclose (PrivateOutputFileH);
	fclose (PrivateOutputFileC);
	break;
      }

  return Error;
}