Example #1
0
void COptionSheet::BuildList()
{
	ASSERT(NULL != m_ListWindow);

	CWnd *wnd;
	int i;

	// Get the list control window
	wnd = GetListControlWnd();

	// Create the list control
	m_ListWindow->Create(this, IDC_PAGELIST);

	// Set the controls font
	wnd->SetFont(&m_Font);

	// Add the groups
	for(i = 0; i < GetPageCount(); i++) {
		if(TRUE == IsPageAGroup(i)) {
			m_ListWindow->AddGroup(GetPage(i));
		}
	}

	// Add the pages
	for(i = 0; i < GetPageCount(); i++) {
		if(FALSE == IsPageAGroup(i)) {
			m_ListWindow->AddPage(GetPage(i), GetPageGroup(i));
		}
	}

	wnd->ShowWindow(SW_SHOW);
}
Example #2
0
static void DrawSend(int ds, char *token)
{
  nPageGroups= 0;

  if (token && strcmp(token, "to")==0) {
    /* draw to  or send to  merely resets outDraw or outSend list */
    int i, n= 0;
    int *outDS= ds? outSend : outDraw;
    if (GetDeviceList(0, dsName[ds])) return;
    for (i=0 ; i<8 ; i++) if ((outDS[i]= outMark[i])) n++;
    if (!n) for (i=0 ; i<8 ; i++)
      outDS[i]= outEngines[i]? (ds? outTypes[i]<2 : outTypes[i]==2) : 0;
    return;

  } else if (token) {
    do {
      if (GetPageGroup(token)) return;
    } while ((token= strtok(0, " \t\n")));
  } else {
    nPage[0]= mPage[0]= CGMRelative(0);
    sPage[0]= 1;
    nPageGroups= 1;
  }

  ReadCGM(mPage, nPage, sPage, nPageGroups);
}
Example #3
0
int
on_launch(int argc, char *argv[])
{
  int i, j;
  char *arg;

  nOut= 0;
  for (i=0 ; i<8 ; i++) {
    outNames[i]= 0;
    outEngines[i]= 0;
    outDraw[i]= outSend[i]= outLengths[i]= 0;
  }
  noDisplay= amBatch= x_only= 0;
  defaultDPI= 100;
  inName= 0;

  p_quitter(&on_quit);
  p_idler(&on_idle);
  p_stdinit(&on_stdin);
  g_stdout = p_stdout;

  for (i=1 ; i<argc ; i++) {
    arg= argv[i];

    if (arg[0]=='-') {
      int fileType= -1;
      arg++;
      if (strcmp(arg, "cgm")==0) {
        fileType= 0;
        i++;
        if (i>=argc) return MessageAndExit("Missing file or display name");
        arg= argv[i];
      } else if (strcmp(arg, "ps")==0) {
        fileType= 1;
        i++;
        if (i>=argc) return MessageAndExit("Missing file or display name");
        arg= argv[i];
      } else if (strcmp(arg, "in")==0) {
        i++;
        if (i>=argc) return MessageAndExit("Missing file or display name");
        if (inName) return HelpAndExit();
        else inName= argv[i];
      } else if (strcmp(arg, "display")==0 || strcmp(arg, "d")==0) {
        fileType= 2;
        i++;
        if (i>=argc) return MessageAndExit("Missing file or display name");
        arg= argv[i];
      } else if (strcmp(arg, "f")==0) {
        amBatch= 1;
        fileType= 1;
        arg= "*stdout*";
      } else if (strcmp(arg, "nd")==0) noDisplay= 1;
      else if (strcmp(arg, "b")==0) amBatch= 1;
      else if (strcmp(arg, "nowarn")==0) no_warnings= 1;
      else if (strcmp(arg, "geometry")==0) {
        char *suffix;
        int w=0,h=0;
        i++;
        if (i>=argc) MessageAndExit("Missing geometry");
        arg = argv[i];
        w = (int)strtol(arg, &suffix, 10);
        if (suffix!=arg && *suffix=='x') {
          arg = suffix+1;
          h = (int)strtol(arg, &suffix, 10);
        }
        if (w < 10 || h < 10) MessageAndExit("Invalid geometry");
        gx75width = gx100width = w;
        gx75height = gx100height = h;
      } else if (strcmp(arg, "75")==0) defaultDPI= 75;
      else if (strcmp(arg, "100")==0) defaultDPI= 100;
      else if (strcmp(arg, "gks")==0) {
        gx75width= gx75height= 600;     /* 8x8 X window size */
        gx100width= gx100height= 800;   /* 8x8 X window size */
        cgmScaleToFit= 1;               /* 8x8 PostScript plotting area */
        gtDoEscapes= 0;
      } else if (strcmp(arg, "x")==0) x_only= 1;
      else if (strcmp(arg, "gks")==0) {
        cgmScaleToFit= 1;
        gtDoEscapes= 0;
      }
      else if (strcmp(arg, "fmbug")==0) epsFMbug= 1;
      else if (strcmp(arg, "bg0fg1")==0) bg0fg1= 1;
      else if (strcmp(arg, "esc0")==0) gtDoEscapes= 0;
      else if (strcmp(arg, "esc1")==0) gtDoEscapes= 1;
      else return HelpAndExit();

      if (fileType>=0) {
        if (nOut>=8)
          return MessageAndExit("At most 8 output files/displays allowed");
        for (j=0 ; j<nOut ; j++) if (strcmp(outNames[j], arg)==0)
          return MessageAndExit("Duplicate output filenames not allowed");
        outNames[nOut]= arg;
        outTypes[nOut]= fileType;
        nOut++;
      }

    } else if (arg[0]<='9' && arg[0]>='0') {
      if (GetPageGroup(arg)) return MessageAndExit("Try again");

    } else if (!inName) {
      inName= arg;

    } else {
      return HelpAndExit();
    }
  }

  if (inName && OpenCGM(inName)) inName= 0;

  if (amBatch) {
    if (!inName)
      return MessageAndExit("Must specify an input CGM file to use -b or -f");
    if (!nOut)
      return MessageAndExit("Must specify some output file to use -b");
    noDisplay= 1;
  }

  /* Create CGM and PostScript engines */
  for (i=0 ; i<nOut ; i++) {
    if (outTypes[i]==0) CreateCGM(i, outNames[i]);
    else if (outTypes[i]==1) CreatePS(i, outNames[i]);
  }

  /* If page list specified, do implied send command */
  if (amBatch && nPageGroups<=0) {
    mPage[0]= 1;
    nPage[0]= 32767;
    sPage[0]= 1;
    nPageGroups= 1;
  }
  if (nPageGroups>0) {
    for (i=0 ; i<8 ; i++) {
      if (!outSend[i]) GpDeactivate(outEngines[i]);
      if (outSend[i] && !GpActivate(outEngines[i])) n_active_groups++;
    }
  }

  g_initializer(&argc, argv);

  return 0;
}