int do_startup(void) { int i; did_startup = 1; if (!noDisplay) { int noX= 1; for (i=0 ; i<nOut ; i++) if (outTypes[i]==2) { if (!CreateX(i, outNames[i])) noX= 0; } if (noX && nOut<8) { if (!CreateX(nOut, 0)) { nOut++; noX= 0; } } noDisplay= noX; } if (noDisplay && x_only) return MessageAndExit("Must be an X display to use -x"); if (x_only && !inName) return MessageAndExit("Must specify an input CGM file to use -x"); if (n_active_groups) ReadCGM(mPage, nPage, sPage, nPageGroups); return 0; }
JBoolean GMessageTableDir::Create ( JXDirector* supervisor, const JString& mailfile, GMessageTableDir** dir, const JBoolean iconify ) { *dir = new GMessageTableDir(supervisor, mailfile); assert(*dir != NULL); if (iconify) { (*dir)->GetWindow()->Iconify(); } JBoolean success = CreateX(supervisor, mailfile, dir); if (success) { (*dir)->ListenTo((*dir)->GetWindow()); } if (iconify && success) { JXImage* icon = new JXImage(*((*dir)->itsNewMailIcon)); assert(icon != NULL); (*dir)->GetWindow()->SetIcon(icon); (*dir)->itsData->ShouldHaveNewMail(kJTrue); (*dir)->AdjustWindowTitle(); } return success; }
static int MakeX(int help) { char *token, *server; int dpi, device, defDPI; if (help) { p_stderr("gist: display command syntax:\n "); p_stderr("display host:server.screen [dpi]\n"); p_stderr(" Connects to the specified X server.\n"); p_stderr(" Subsequent draw commands will write to server,\n"); p_stderr(" unless the draw to list is modified (see draw).\n"); p_stderr(" If specified, 40<=dpi<=200 (default 100).\n"); return 0; } token= strtok(0, " \t\n"); if (!token) { p_stderr("gist: (SYNTAX) cgmoutput name missing in cgm command\n"); return 0; } server= token; token= strtok(0, " \t\n"); if (token) { char *suffix; dpi= (int)strtol(token, &suffix, 0); if (*suffix) { p_stderr("gist: (SYNTAX) dpi unintelligble in display command\n"); return 0; } if (dpi<40 && dpi>200) { p_stderr( "gist: (SYNTAX) dpi not between 40 and 200 in display command\n"); return 0; } if (CheckEOL("display")) return 0; } else { dpi= 100; } device= FindDevice(); if (device>=8) return 0; defDPI= defaultDPI; defaultDPI= dpi; CreateX(device, server); defaultDPI= defDPI; return 0; }
JBoolean GMessageTableDir::Create ( JXDirector* supervisor, JFileArray& fileArray, GMessageTableDir** dir, const JFileVersion& version ) { JFAID id = 1; std::string data; fileArray.GetElement(id, &data); std::istringstream is(data); JString mailfile; is >> mailfile; JString lockfile = JString(mailfile) + ".lock"; if (JFileExists(lockfile)) { JString report = "The mailbox \"" + JString(mailfile); report += "\" is locked. Do you want to forcibly remove the lock on mailbox"; JBoolean yes = JGetUserNotification()->AskUserYes(report); if (yes) { GUnlockFile(mailfile); } else { return kJFalse; } } *dir = new GMessageTableDir(supervisor, mailfile); assert(*dir != NULL); (*dir)->GetWindow()->ReadGeometry(is); JBoolean success = CreateX(supervisor, mailfile, dir); if (success) { (*dir)->ReadState(fileArray, version); (*dir)->ListenTo((*dir)->GetWindow()); } return success; }
static int Draw(int help) { int i, n; char *token; if (help) { p_stderr("gist: draw command syntax:\n draw [page list]\n"); p_stderr( " Copy the page(s) (default current page) from the current CGM input\n"); p_stderr(" to all display output devices.\n"); p_stderr(" By default, these are all X windows.\n"); p_stderr(" Use alternate syntax:\n draw to [device#1 ...]\n"); p_stderr(" to specify a particular list of devices to be used\n"); p_stderr(" by the draw command. Without any device numbers,\n"); p_stderr(" draw to restores the default list of devices.\n"); p_stderr(" (Use the info command to describe current device numbers.)\n"); p_stderr(" Page list syntax: group1 [group2 ...]\n"); p_stderr(" Page group syntax: n - just page n\n"); p_stderr(" m-n - pages n thru m\n"); p_stderr(" m-n-s - pages n thru m, step s\n"); return 0; } token= strtok(0, " \t\n"); if (token && strcmp(token, "to")==0) { DrawSend(1, token); return 0; } n= 0; for (i=0 ; i<8 ; i++) { if (!outDraw[i]) GpDeactivate(outEngines[i]); if (outDraw[i] && !GpActivate(outEngines[i])) n++; } if (!n && (i= FindDevice())<8) { if (!CreateX(i, 0) && !GpActivate(outEngines[i])) n++; } if (n) DrawSend(0, token); else Warning("no devices active for draw command", ""); return 0; }