// create (or re-create) a mini-window
long CMUSHclientDoc::WindowCreate(LPCTSTR Name, 
                                  long Left, long Top, 
                                  long Width, long Height, 
                                  short Position, 
                                  long Flags, 
                                  long BackgroundColour) 
  {

  if (strlen (Name) == 0) 
    return eNoNameSpecified;    // empty name throws out various things

  if (Width < 0 || Height < 0)
    return eBadParameter;

  MiniWindowMapIterator it = m_MiniWindows.find (Name);

  CMiniWindow * pMiniWindow = NULL;

  if (it == m_MiniWindows.end ())
    {
    pMiniWindow = new CMiniWindow ();
    m_MiniWindows [Name] = pMiniWindow;
    }
  else
    pMiniWindow = it->second;

  pMiniWindow->Create (Left, Top, Width, Height,
                       Position, Flags, 
                       BackgroundColour);

  SortWindows ();  // need to re-make sorted list in Z-order
  UpdateAllViews (NULL);

	return eOK;
}     // end of CMUSHclientDoc::WindowCreate
Esempio n. 2
0
void XGStart()
{
  char thePDumpFile[80], thePDFRoot[80];

  strncpy(thePDFRoot,theDumpFile,findlen(theDumpFile));
  thePDFRoot[findlen(theDumpFile)] = '\0';
  while (!theExitFlag) {
    if (theRunWithXFlag == TRUE) {
      SortWindows();
      if(numberOfSpecials!=0)
	if(Tcl_Eval(interp,"CreateSpecialDialog\n")!=TCL_OK) {
	  printf("Error creating Special Dialog\n");
	  printf("%s\n",interp->result);
	}
      sprintf(TclCommand,"UpdateTime %g ; DoGraphics; update idletasks\n",*theTimeStep);
      /* Tcl_Eval(interp,TclCommand);  put below */
      if(Tcl_Eval(interp,"Tk_XGStart\n")!=TCL_OK) {
	printf("Error calling Tk_XGStart\n");
      }
      Tcl_Eval(interp,TclCommand); 

      if (theNumberOfSteps != 0) {
	Tcl_Eval(interp,".lbframe.run invoke\n");
      }
      
      /* Change the procedure for the HUP signal. */
      signal(SIGUSR1, Signal_KillGraphicsProc);

      Tk_MainLoop();
    }
    
    if (theRunWithXFlag == FALSE) {
      signal(SIGUSR1, Signal_RestoreGraphicsProc);
      
      while ((theNumberOfSteps==0 || theCurrentStep<=theNumberOfSteps) && 
	     (theRunWithXFlag == FALSE)) {
	XGMainLoop();
	if (theDumpPeriod!=0 && theCurrentStep%theDumpPeriod==0) {
	  sprintf(thePDumpFile,"%s%d%s",thePDFRoot,
		  theCurrentStep/theDumpPeriod,theDumpExtension);
	  if (theIDumpFlag) Dump(thePDumpFile);
	  else Dump(theDumpFile);
	}
	theCurrentStep++;
      }
      if ((theDumpPeriod!=0) && (theCurrentStep%theDumpPeriod==0)) {
	sprintf(thePDumpFile,"%s%d%s",thePDFRoot,
		theCurrentStep/theDumpPeriod,theDumpExtension);
	if (theIDumpFlag) Dump(thePDumpFile);
	else Dump(theDumpFile);
      }
      if(theCurrentStep>theNumberOfSteps && (theRunWithXFlag == FALSE)) {
	XG_Quit();
      }
      if (theRunWithXFlag == TRUE) StartGraphics();
    }
  }
  XG_Quit();
}
long CMUSHclientDoc::WindowSetZOrder(LPCTSTR Name, long Order) 
{
  MiniWindowMapIterator it = m_MiniWindows.find (Name);
    
  if (it == m_MiniWindows.end ())
    return eNoSuchWindow;

  long status = it->second->SetZOrder (Order);

  SortWindows ();   // need to re-make sorted list in Z-order

  return status;   // now we can return status

}   // end of CMUSHclientDoc::WindowSetZOrder
long CMUSHclientDoc::WindowDelete(LPCTSTR Name) 
{
  MiniWindowMapIterator it = m_MiniWindows.find (Name);
    
  if (it == m_MiniWindows.end ())
    return eNoSuchWindow;

  if (it->second->m_bExecutingScript)
    return eItemInUse;

  delete it->second;

  m_MiniWindows.erase (it);

  SortWindows ();   // need to re-make sorted list in Z-order

  UpdateAllViews (NULL);

	return eOK;
}    // end of CMUSHclientDoc::WindowDelete