Platon Technologies
not logged in Login Registration
EnglishSlovak
open source software development celebrating 10 years of open source development! Friday, October 16, 2026

Diff for dead/diplomovka/xgrafix/src/xgcommands.c between version 1.1 and 1.2

version 1.1, 2001/09/20 14:12:00 version 1.2, 2002/07/07 23:57:58
Line 24  void StartGraphics(void)
Line 24  void StartGraphics(void)
         int i;          int i;
         FILE *f;          FILE *f;
         char str[80];          char str[80];
         char xgdisfile[512];  #define TMP_LEN 1024
           char xgdisfile[TMP_LEN];
   
         sprintf(xgdisfile,"%s/.xgdisplay",getenv("HOME"));          if (snprintf(xgdisfile, TMP_LEN, "%s/.xgdisplay", getenv("HOME")) ==-1) {
                           fprintf(stderr, "Warning: xgdisfile truncated at %s:%d ('%s')\n",
                                           __FILE__, __LINE__, xgdisfile);
           }
   #undef TMP_LEN
         f = fopen(xgdisfile, "r");          f = fopen(xgdisfile, "r");
         if (f == NULL) {          if (f == NULL) {
                 printf("File %s could not be read.\n",xgdisfile);                  printf("File %s could not be read.\n",xgdisfile);
Line 57  void StartGraphics(void)
Line 62  void StartGraphics(void)
   
         /* Reinitialize the special dialog box. */          /* Reinitialize the special dialog box. */
         for (i=0; i<numberOfSpecials; i++) {          for (i=0; i<numberOfSpecials; i++) {
                 sprintf(TclCommand, "SetUpNewVar %d \"%s\" \"%s\"\n", i,                  if (snprintf(TclCommand, TclCommand_MAX, "SetUpNewVar %d \"%s\" \"%s\"\n", i,
                                                                 theSpecialArray[i]->Varname,                                          theSpecialArray[i]->Varname,
                                                                 ( theSpecialArray[i]->Type == INTEGER ) ?                                          ( theSpecialArray[i]->Type == INTEGER ) ?
                                                                 "integer" :                                          "integer" :
                                                                 (( theSpecialArray[i]->Type == FLOAT ) ?                                          (( theSpecialArray[i]->Type == FLOAT ) ?
                                                                  "float" :                                           "float" :
                                                                  (( theSpecialArray[i]->Type == DOUBLE ) ?                                           (( theSpecialArray[i]->Type == DOUBLE ) ?
                                                                   "double" : "char" )));                                            "double" : "char" ))) == -1) {
                           fprintf(stderr, "Warning: TclCommand truncated at %s:%d\n", __FILE__, __LINE__);
                   }
                 Tcl_Eval(interp, TclCommand);                  Tcl_Eval(interp, TclCommand);
         }          }
   
         /* Recreate all the diagnostic windows. */          /* Recreate all the diagnostic windows. */
         for (i=0; i<numberOfWindows; i++) {          for (i=0; i<numberOfWindows; i++) {
                 theWindow = theWindowArray[i];                  theWindow = theWindowArray[i];
                 sprintf(TclCommand, "SetupWindow \"%s\" %s %d %d %c %.3g %.3g %d"                  if (snprintf(TclCommand, TclCommand_MAX,
                                                                 " %.3g %.3g %d %.3g %.3g %d %s %.3g %.3g"                                          "SetupWindow \"%s\" %s %d %d %c %.3g %.3g %d"
                                                                 " %d %d %d %d %d %d %s \"%s\" \"%s\"\n",                                          " %.3g %.3g %d %.3g %.3g %d %s %.3g %.3g"
                                                                 theWindow->plot_title,                                          " %d %d %d %d %d %d %s \"%s\" \"%s\"\n",
                                                                 "closed",                                          theWindow->plot_title,
                                                                 theWindow->ulxc,                                          "closed",
                                                                 theWindow->ulyc,                                          theWindow->ulxc,
                                                                 theWindow->type,                                          theWindow->ulyc,
                                                                 theWindow->label->X_Min,                                          theWindow->type,
                                                                 theWindow->label->X_Max,                                          theWindow->label->X_Min,
                                                                 Is_X_AutoRescale(theWindow),                                          theWindow->label->X_Max,
                                                                 theWindow->label->Y_Min,                                          Is_X_AutoRescale(theWindow),
                                                                 theWindow->label->Y_Max,                                          theWindow->label->Y_Min,
                                                                 Is_Y_AutoRescale(theWindow),                                          theWindow->label->Y_Max,
                                                                 theWindow->label->Z_Min,                                          Is_Y_AutoRescale(theWindow),
                                                                 theWindow->label->Z_Max,                                          theWindow->label->Z_Min,
                                                                 Is_Z_AutoRescale(theWindow),                                          theWindow->label->Z_Max,
                                                                 theWindow->eps_file_name,                                          Is_Z_AutoRescale(theWindow),
                                                                 theWindow->theta,                                          theWindow->eps_file_name,
                                                                 theWindow->phi,Is_Shading_On(theWindow),                                          theWindow->theta,
                                                                 Is_ColorCode_On(theWindow),                                          theWindow->phi,Is_Shading_On(theWindow),
                                                                 Is_Grid_On(theWindow),                                          Is_ColorCode_On(theWindow),
                                                                 Is_X_Log(theWindow),                                          Is_Grid_On(theWindow),
                                                                 Is_Y_Log(theWindow),                                          Is_X_Log(theWindow),
                                                                 Is_Z_Log(theWindow),                                          Is_Y_Log(theWindow),
                                                                 theDumpFile,                                          Is_Z_Log(theWindow),
                                                                 theWindow->label->X_Label,                                          theDumpFile,
                                                                 theWindow->label->Y_Label);                                          theWindow->label->X_Label,
                                                                 if (Tcl_Eval(interp, TclCommand) != TCL_OK) {                                          theWindow->label->Y_Label) == -1) {
                                                                         printf("Error re-creating window.\n");                                                  fprintf(stderr, "Warning: "
                                                                 }                                                                  "TclCommand truncated at %s:%d\n", __FILE__, __LINE__);
                                           }
                                           if (Tcl_Eval(interp, TclCommand) != TCL_OK) {
                                                   printf("Error re-creating window.\n");
                                           }
         }          }
   
         theRunWithXFlag = TRUE;          theRunWithXFlag = TRUE;
Line 111  void StartGraphics(void)
Line 122  void StartGraphics(void)
 void DoGraphics(ClientData cl)  void DoGraphics(ClientData cl)
 {  {
         // printf("c doGraph\n");          // printf("c doGraph\n");
         sprintf(TclCommand,"UpdateTime %g ; update; DoGraphics; update idle tasks\n",          if (snprintf(TclCommand, TclCommand_MAX,
                                                         *theTimeStep);                                  "UpdateTime %g ; update; DoGraphics; update idle tasks\n",
                                   *theTimeStep) == -1) {
                   fprintf(stderr, "Warning: TclCommand truncated at %s:%d\n", __FILE__, __LINE__);
           }
         Tcl_Eval(interp,TclCommand);          Tcl_Eval(interp,TclCommand);
         if (theRunFlag==TRUE) {          if (theRunFlag==TRUE) {
                 Tcl_CreateTimerHandler(0, DoMain,(ClientData)NULL);                  Tcl_CreateTimerHandler(0, DoMain,(ClientData)NULL);
Line 123  Tcl_CreateTimerHandler(0, DoMain,(Client
Line 137  Tcl_CreateTimerHandler(0, DoMain,(Client
 #ifdef Tcl74_Tk40  #ifdef Tcl74_Tk40
 Tk_CreateTimerHandler(0, DoMain,(ClientData)NULL);  Tk_CreateTimerHandler(0, DoMain,(ClientData)NULL);
 #endif  #endif
                  */  */
         }          }
 } // }}}  } // }}}
 // Function void DoMain(ClientData cl) {{{  // Function void DoMain(ClientData cl) {{{
 void DoMain(ClientData cl)  void DoMain(ClientData cl)
 {  {
         sprintf(TclCommand,"update \n");          if (snprintf(TclCommand, TclCommand_MAX, "update \n") == -1) {
                   fprintf(stderr, "Warning: TclCommand truncated at %s:%d\n", __FILE__, __LINE__);
           }
         Tcl_Eval(interp,TclCommand);          Tcl_Eval(interp,TclCommand);
         /* printf("c domain\n"); */          /* printf("c domain\n"); */
         if (theNumberOfSteps==0 || theCurrentStep<=theNumberOfSteps) {          if (theNumberOfSteps==0 || theCurrentStep<=theNumberOfSteps) {
Line 144  Tcl_CreateTimerHandler(0, DoGraphics,(Cl
Line 160  Tcl_CreateTimerHandler(0, DoGraphics,(Cl
 #ifdef Tcl74_Tk40  #ifdef Tcl74_Tk40
 Tk_CreateTimerHandler(0, DoGraphics,(ClientData)NULL);  Tk_CreateTimerHandler(0, DoGraphics,(ClientData)NULL);
 #endif  #endif
                  */  */
                 if (theDumpPeriod != 0 && theCurrentStep%theDumpPeriod==0) {                  if (theDumpPeriod != 0 && theCurrentStep%theDumpPeriod==0) {
                         Dump(theDumpFile);                          Dump(theDumpFile);
                 }                  }
Line 174  void XGStart(void)
Line 190  void XGStart(void)
                                         printf("Error creating Special Dialog\n");                                          printf("Error creating Special Dialog\n");
                                         printf("%s\n",interp->result);                                          printf("%s\n",interp->result);
                                 }                                  }
                         sprintf(TclCommand,"UpdateTime %g ; DoGraphics; update idletasks\n",                          if (snprintf(TclCommand, TclCommand_MAX,
                                                                         *theTimeStep);                                                  "UpdateTime %g ; DoGraphics; update idletasks\n",
                                                   *theTimeStep) == -1) {
                                   fprintf(stderr, "Warning: TclCommand truncated at %s:%d\n", __FILE__, __LINE__);
                           }
                         /* Tcl_Eval(interp,TclCommand);  put bellow */                          /* Tcl_Eval(interp,TclCommand);  put bellow */
                         if (Tcl_Eval(interp,"Tk_XGStart\n") != TCL_OK) {                          if (Tcl_Eval(interp,"Tk_XGStart\n") != TCL_OK) {
                                 printf("Error calling Tk_XGStart\n");                                  printf("Error calling Tk_XGStart\n");
Line 194  void XGStart(void)
Line 213  void XGStart(void)
                         signal(SIGUSR1, (__sighandler_t) StartGraphics);                          signal(SIGUSR1, (__sighandler_t) StartGraphics);
   
                         while ((theNumberOfSteps==0 || theCurrentStep<=theNumberOfSteps) &&                          while ((theNumberOfSteps==0 || theCurrentStep<=theNumberOfSteps) &&
                                                                         (theRunWithXFlag == FALSE)) {                                          (theRunWithXFlag == FALSE)) {
                                 XGMainLoop();                                  XGMainLoop();
                                 if (theDumpPeriod != 0 && theCurrentStep%theDumpPeriod==0) {                                  if (theDumpPeriod != 0 && theCurrentStep%theDumpPeriod==0) {
                                         Dump(theDumpFile);                                          Dump(theDumpFile);
Line 266  Tcl_DoWhenIdle(DoMain,(ClientData)NULL);
Line 285  Tcl_DoWhenIdle(DoMain,(ClientData)NULL);
 #ifdef Tcl74_Tk40  #ifdef Tcl74_Tk40
 Tk_DoWhenIdle(DoMain,(ClientData)NULL);  Tk_DoWhenIdle(DoMain,(ClientData)NULL);
 #endif  #endif
          */  */
         return TCL_OK;          return TCL_OK;
 } // }}}  } // }}}
 // Function int C_StopProc(void) {{{  // Function int C_StopProc(void) {{{
Line 282  int C_KillGraphicsProc(void)
Line 301  int C_KillGraphicsProc(void)
   
         theRunWithXFlag = FALSE;          theRunWithXFlag = FALSE;
   
         for (i=0; i<numberOfWindows; i++) {  #ifdef DEBUG
           fprintf(stderr, "Freeing display(%p)\n");
   #endif
           for (i = 0; i < numberOfWindows; i++) {
   #ifdef DEBUG
                   fprintf(stderr, "\ttheWindowArray[%02d]('%s')->pixmap_buffer(%p)\n",
                                   i, theWindowArray[i], theWindowArray[i]->pixmap_buffer);
   #endif
                 XFreePixmap(theDisplay, theWindowArray[i]->pixmap_buffer);                  XFreePixmap(theDisplay, theWindowArray[i]->pixmap_buffer);
                 theWindowArray[i]->pixmap_buffer = 0;                  theWindowArray[i]->pixmap_buffer = 0;
         }          }
   
         sprintf(TclCommand, "set WaitVariable 2 ; destroy .\n");          if (snprintf(TclCommand, TclCommand_MAX, "set WaitVariable 2 ; destroy .\n") == -1) {
                   fprintf(stderr, "Warning: TclCommand truncated at %s:%d\n", __FILE__, __LINE__);
           }
         Tcl_Eval(interp, TclCommand);          Tcl_Eval(interp, TclCommand);
         return TCL_OK;          return TCL_OK;
 } // }}}  } // }}}
Line 311  Tcl_DoWhenIdle(DoMain,(ClientData)NULL);
Line 339  Tcl_DoWhenIdle(DoMain,(ClientData)NULL);
 #ifdef Tcl74_Tk40  #ifdef Tcl74_Tk40
 Tk_DoWhenIdle(DoMain,(ClientData)NULL);  Tk_DoWhenIdle(DoMain,(ClientData)NULL);
 #endif  #endif
          */  */
         return TCL_OK;          return TCL_OK;
 } // }}}  } // }}}
 // Function int C_SaveProc(ClientData cl, Tcl_Interp *interp, int argc, argv) {{{  // Function int C_SaveProc(ClientData cl, Tcl_Interp *interp, int argc, argv) {{{
Line 337  int C_pauseProc(ClientData cl, Tcl_Inter
Line 365  int C_pauseProc(ClientData cl, Tcl_Inter
 } // }}}  } // }}}
 // Function int C_RefreshGraphicsProc(ClientData cl, *interp, argc, argv) {{{  // Function int C_RefreshGraphicsProc(ClientData cl, *interp, argc, argv) {{{
 int C_RefreshGraphicsProc(ClientData cl, Tcl_Interp *interp, int argc,  int C_RefreshGraphicsProc(ClientData cl, Tcl_Interp *interp, int argc,
                                                 char **argv)                  char **argv)
 {  {
         WindowType Window = theWindowArray[atoi(argv[1])];          WindowType Window = theWindowArray[atoi(argv[1])];
   
Line 436  int C_PrintProc(ClientData cl, Tcl_Inter
Line 464  int C_PrintProc(ClientData cl, Tcl_Inter
   
 #ifdef XPMENABLED  #ifdef XPMENABLED
                         if (argv[6][0] != 'n' && (!Is_Trace_On(theWindow) ||                          if (argv[6][0] != 'n' && (!Is_Trace_On(theWindow) ||
                                                                                 Is_X_AutoRescale(theWindow) ||                                                  Is_X_AutoRescale(theWindow) ||
                                                                                 Is_Y_AutoRescale(theWindow))) {                                                  Is_Y_AutoRescale(theWindow))) {
                                 Iconic_Before(theWindow);                                  Iconic_Before(theWindow);
                                 C_RefreshGraphicsProc(NULL,NULL,1,argv);                                  C_RefreshGraphicsProc(NULL,NULL,1,argv);
                         }                          }
                         XpmWriteFileFromPixmap(theDisplay,argv[2],theWindow->pixmap_buffer,                          XpmWriteFileFromPixmap(theDisplay,argv[2],theWindow->pixmap_buffer,
                                                                         0,NULL);                                          0,NULL);
 #endif  #endif
   
                         break;                          break;
Line 468  int C_PrintProc(ClientData cl, Tcl_Inter
Line 496  int C_PrintProc(ClientData cl, Tcl_Inter
   
 #ifdef XPMENABLED  #ifdef XPMENABLED
                         if (argv[6][0] != 'n' && (!Is_Trace_On(theWindow) ||                          if (argv[6][0] != 'n' && (!Is_Trace_On(theWindow) ||
                                                                                 Is_X_AutoRescale(theWindow) ||                                                  Is_X_AutoRescale(theWindow) ||
                                                                                 Is_Y_AutoRescale(theWindow))) {                                                  Is_Y_AutoRescale(theWindow))) {
                                 Iconic_Before(theWindow);                                  Iconic_Before(theWindow);
                                 C_RefreshGraphicsProc(NULL,NULL,1,argv);                                  C_RefreshGraphicsProc(NULL,NULL,1,argv);
                         }                          }
                         XpmCreateDataFromPixmap(theDisplay,                          XpmCreateDataFromPixmap(theDisplay,
                                                                         &xpmData,                                          &xpmData,
                                                                         theWindow->pixmap_buffer,                                          theWindow->pixmap_buffer,
                                                                         0,0);                                          0,0);
                         XpmToGif(xpmData,argv[2]);                          XpmToGif(xpmData,argv[2]);
   
                         XpmFreeXpmImage((XpmImage *) xpmData);                          XpmFreeXpmImage((XpmImage *) xpmData);
Line 513  int C_3DViewProc(ClientData cl, Tcl_Inte
Line 541  int C_3DViewProc(ClientData cl, Tcl_Inte
 } // }}}  } // }}}
 // Function int C_GetSpecialValuesProc(ClientData cl, Tcl_Interp *interp, argc,{{{  // Function int C_GetSpecialValuesProc(ClientData cl, Tcl_Interp *interp, argc,{{{
 int C_GetSpecialValuesProc(ClientData cl, Tcl_Interp *interp, int argc,  int C_GetSpecialValuesProc(ClientData cl, Tcl_Interp *interp, int argc,
                                                 char **argv)                  char **argv)
 {  {
         int i;          int i;
         strcpy(TclCommand,"");          strcpy(TclCommand,"");
         for (i=0;i<numberOfSpecials;i++) {          for (i = 0; i < numberOfSpecials; i++) {
                 if (theSpecialArray[i]->Type == DOUBLE) {                  if (snprintf(TclCommand, TclCommand_MAX,
                         sprintf(TclCommand, "%s %g",                                          (theSpecialArray[i]->Type == DOUBLE  ) ? "%s %g" :
                                                                         TclCommand,                                          ((theSpecialArray[i]->Type == INTEGER) ? "%s %d" :
                                                                         *(double*)(theSpecialArray[i]->data));                                           ((theSpecialArray[i]->Type == FLOAT ) ? "%s %f" : "%s %c" )),
                 }                                          TclCommand,
                 else if (theSpecialArray[i]->Type == INTEGER) {                                          (theSpecialArray[i]->Type == DOUBLE  ) ? *(double *)(theSpecialArray[i]->data) :
                         sprintf(TclCommand, "%s %d",                                          ((theSpecialArray[i]->Type == INTEGER) ? *(int    *)(theSpecialArray[i]->data) :
                                                                         TclCommand,                                           ((theSpecialArray[i]->Type == FLOAT ) ? *(float  *)(theSpecialArray[i]->data) :
                                                                         *(int*)(theSpecialArray[i]->data));                                            *(char *)(theSpecialArray[i]->data) )) ) == -1) {
                 }                          fprintf(stderr, "Warning: TclCommand truncated at %s:%d\n", __FILE__, __LINE__);
                 else if (theSpecialArray[i]->Type == FLOAT) {  
                         sprintf(TclCommand, "%s %f",  
                                                                         TclCommand,  
                                                                         *(float*)(theSpecialArray[i]->data));  
                 }  
                 else {  
                         sprintf(TclCommand, "%s %c",  
                                                                         TclCommand,  
                                                                         *(char*)(theSpecialArray[i]->data));  
                 }                  }
   
                   /*
                      if (theSpecialArray[i]->Type == DOUBLE) {
                      if (snprintf(TclCommand, TclCommand_MAX, "%s %g",
                      TclCommand,
                    *(double*)(theSpecialArray[i]->data)) == -1) {
                    fprintf(stderr, "Warning: TclCommand truncated at %s:%d\n", __FILE__, __LINE__);
                    }
                    }
                    else if (theSpecialArray[i]->Type == INTEGER) {
                    if (snprintf(TclCommand, TclCommand_MAX, "%s %d",
                    TclCommand,
                    *(int*)(theSpecialArray[i]->data)) == -1) {
                    fprintf(stderr, "Warning: TclCommand truncated at %s:%d\n", __FILE__, __LINE__);
                    }
                    }
                    else if (theSpecialArray[i]->Type == FLOAT) {
                    if (snprintf(TclCommand, TclCommand_MAX, "%s %f",
                    TclCommand,
                    *(float*)(theSpecialArray[i]->data)) == -1) {
                    fprintf(stderr, "Warning: TclCommand truncated at %s:%d\n", __FILE__, __LINE__);
                    }
                    }
                    else {
                    if (snprintf(TclCommand, TclCommand_MAX, "%s %c",
                    TclCommand,
                    *(char*)(theSpecialArray[i]->data)) == -1) {
                    fprintf(stderr, "Warning: TclCommand truncated at %s:%d\n", __FILE__, __LINE__);
                    }
                    }
                    */
           }
           if (snprintf(TclCommand, TclCommand_MAX, "%s\n",TclCommand) == -1) {
                   fprintf(stderr, "Warning: TclCommand truncated at %s:%d\n", __FILE__, __LINE__);
         }          }
         sprintf(TclCommand,"%s\n",TclCommand);  
         interp->result = TclCommand;          interp->result = TclCommand;
         return TCL_OK;          return TCL_OK;
 } // }}}  } // }}}
 // Function int C_SetNewSpecialProc(ClientData cl, Tcl_Interp *interp, ) {{{  // Function int C_SetNewSpecialProc(ClientData cl, Tcl_Interp *interp, ) {{{
 int C_SetNewSpecialProc(ClientData cl, Tcl_Interp *interp, int argc,  int C_SetNewSpecialProc(ClientData cl, Tcl_Interp *interp, int argc,
                                                 char **argv)                  char **argv)
 {  {
         int index = atoi(argv[1]);          int index = atoi(argv[1]);
   
Line 571  int C_GetRangesProc(ClientData cl, Tcl_I
Line 623  int C_GetRangesProc(ClientData cl, Tcl_I
         WindowType theWindow = theWindowArray[atoi(argv[1])];          WindowType theWindow = theWindowArray[atoi(argv[1])];
         LabelType theLabel = theWindow->label;          LabelType theLabel = theWindow->label;
   
         sprintf(TclCommand, "%g %g %d %d %g %g %d %d %g %g %d %d\n",          if (snprintf(TclCommand, TclCommand_MAX,
                                                         theLabel->X_Min, theLabel->X_Max,                                  "%g %g %d %d %g %g %d %d %g %g %d %d\n",
                                                         theLabel->X_Auto_Rescale, Is_X_Log(theWindow),                                  theLabel->X_Min, theLabel->X_Max,
                                                         theLabel->Y_Min, theLabel->Y_Max,                                  theLabel->X_Auto_Rescale, Is_X_Log(theWindow),
                                                         theLabel->Y_Auto_Rescale, Is_Y_Log(theWindow),                                  theLabel->Y_Min, theLabel->Y_Max,
                                                         theLabel->Z_Min, theLabel->Z_Max,                                  theLabel->Y_Auto_Rescale, Is_Y_Log(theWindow),
                                                         theLabel->Z_Auto_Rescale, Is_Z_Log(theWindow));                                  theLabel->Z_Min, theLabel->Z_Max,
                                   theLabel->Z_Auto_Rescale, Is_Z_Log(theWindow)) == -1) {
                   fprintf(stderr, "Warning: TclCommand truncated at %s:%d\n", __FILE__, __LINE__);
           }
         interp->result = TclCommand;          interp->result = TclCommand;
         return TCL_OK;          return TCL_OK;
 } // }}}  } // }}}
Line 610  int C_3dCrossOffProc(ClientData cl, Tcl_
Line 665  int C_3dCrossOffProc(ClientData cl, Tcl_
 } // }}}  } // }}}
 // Function int C_ShouldRefreshProc(ClientData cl, Tcl_Interp *interp, argc, ) {{{  // Function int C_ShouldRefreshProc(ClientData cl, Tcl_Interp *interp, argc, ) {{{
 int C_ShouldRefreshProc(ClientData cl, Tcl_Interp *interp, int argc,  int C_ShouldRefreshProc(ClientData cl, Tcl_Interp *interp, int argc,
                                                 char **argv)                  char **argv)
 {  {
         WindowType theWindow = theWindowArray[atoi(argv[1])];          WindowType theWindow = theWindowArray[atoi(argv[1])];
   
         if (Is_Trace_On(theWindow) && !Is_X_AutoRescale(theWindow) &&          if (Is_Trace_On(theWindow) && !Is_X_AutoRescale(theWindow) &&
                                                         !Is_Y_AutoRescale(theWindow))                          !Is_Y_AutoRescale(theWindow))
                 TclCommand[0] = '1';                  TclCommand[0] = '1';
         else          else
                 TclCommand[0] = '0';                  TclCommand[0] = '0';
Line 665  int C_StretchBoxProc(ClientData cl, Tcl_
Line 720  int C_StretchBoxProc(ClientData cl, Tcl_
         theClientArea.width = Tk_Width(tkwin);          theClientArea.width = Tk_Width(tkwin);
         theClientArea.height = Tk_Height(tkwin);          theClientArea.height = Tk_Height(tkwin);
         XSetClipRectangles(theDisplay, theWindow->xwingc, 0, 0, &theClientArea,          XSetClipRectangles(theDisplay, theWindow->xwingc, 0, 0, &theClientArea,
                                                         1, Unsorted);                          1, Unsorted);
   
         pm = XCreatePixmap(theDisplay, Tk_WindowId(tkwin), Tk_Width(tkwin),          pm = XCreatePixmap(theDisplay, Tk_WindowId(tkwin), Tk_Width(tkwin),
                                                         Tk_Height(tkwin), Tk_Depth(tkwin));                          Tk_Height(tkwin), Tk_Depth(tkwin));
         XCopyArea(theDisplay, theWindow->pixmap_buffer, pm, theWindow->xwingc, 0,          XCopyArea(theDisplay, theWindow->pixmap_buffer, pm, theWindow->xwingc, 0,
                                                         0, Tk_Width(tkwin), Tk_Height(tkwin), 0, 0);                          0, Tk_Width(tkwin), Tk_Height(tkwin), 0, 0);
   
         x2 = atof(argv[2]);          x2 = atof(argv[2]);
         y2 = atof(argv[3]);          y2 = atof(argv[3]);
Line 691  int C_StretchBoxProc(ClientData cl, Tcl_
Line 746  int C_StretchBoxProc(ClientData cl, Tcl_
   
         XSetForeground(theDisplay, theWindow->xwingc, theWhitePixel);          XSetForeground(theDisplay, theWindow->xwingc, theWhitePixel);
         XDrawRectangle(theDisplay, pm, theWindow->xwingc, min(xtemp1,xtemp2),          XDrawRectangle(theDisplay, pm, theWindow->xwingc, min(xtemp1,xtemp2),
                                                         min(ytemp1,ytemp2), fabs(xtemp2 - xtemp1),                          min(ytemp1,ytemp2), fabs(xtemp2 - xtemp1),
                                                         fabs(ytemp2 - ytemp1));                          fabs(ytemp2 - ytemp1));
         XCopyArea(theDisplay, pm, Tk_WindowId(tkwin), theWindow->xwingc, 0, 0,          XCopyArea(theDisplay, pm, Tk_WindowId(tkwin), theWindow->xwingc, 0, 0,
                                                         Tk_Width(tkwin), Tk_Height(tkwin), 0, 0);                          Tk_Width(tkwin), Tk_Height(tkwin), 0, 0);
         XFlush(theDisplay);          XFlush(theDisplay);
         XFreePixmap(theDisplay, pm);          XFreePixmap(theDisplay, pm);
   
Line 711  int C_XGDebug (ClientData cl, Tcl_Interp
Line 766  int C_XGDebug (ClientData cl, Tcl_Interp
 void InitTclCommands(void)  void InitTclCommands(void)
 {  {
         Tcl_CreateCommand(interp,          Tcl_CreateCommand(interp,
                                                         "C_Run",                          "C_Run",
                                                         (Tcl_CmdProc *) C_RunProc,                          (Tcl_CmdProc *) C_RunProc,
                                                         (ClientData) NULL,                          (ClientData) NULL,
                                                         (void (*)()) NULL);                          (void (*)()) NULL);
         Tcl_CreateCommand(interp,          Tcl_CreateCommand(interp,
                                                         "C_Quit",                          "C_Quit",
                                                         (Tcl_CmdProc *) C_QuitProc,                          (Tcl_CmdProc *) C_QuitProc,
                                                         (ClientData) NULL,                          (ClientData) NULL,
                                                         (void (*)()) NULL);                          (void (*)()) NULL);
         Tcl_CreateCommand(interp,          Tcl_CreateCommand(interp,
                                                         "C_KillGraphics",                          "C_KillGraphics",
                                                         (Tcl_CmdProc *) C_KillGraphicsProc,                          (Tcl_CmdProc *) C_KillGraphicsProc,
                                                         (ClientData) NULL,                          (ClientData) NULL,
                                                         (void (*)()) NULL);                          (void (*)()) NULL);
         Tcl_CreateCommand(interp,          Tcl_CreateCommand(interp,
                                                         "C_Close",                          "C_Close",
                                                         (Tcl_CmdProc *) C_CloseProc,                          (Tcl_CmdProc *) C_CloseProc,
                                                         (ClientData) NULL,                          (ClientData) NULL,
                                                         (void (*)()) NULL);                          (void (*)()) NULL);
         Tcl_CreateCommand(interp,          Tcl_CreateCommand(interp,
                                                         "C_Open",                          "C_Open",
                                                         (Tcl_CmdProc *) C_OpenProc,                          (Tcl_CmdProc *) C_OpenProc,
                                                         (ClientData) NULL,                          (ClientData) NULL,
                                                         (void (*)()) NULL);                          (void (*)()) NULL);
         Tcl_CreateCommand(interp,          Tcl_CreateCommand(interp,
                                                         "C_Stop",                          "C_Stop",
                                                         (Tcl_CmdProc *) C_StopProc,                          (Tcl_CmdProc *) C_StopProc,
                                                         (ClientData) NULL,                          (ClientData) NULL,
                                                         (void (*)()) NULL);                          (void (*)()) NULL);
         Tcl_CreateCommand(interp,          Tcl_CreateCommand(interp,
                                                         "C_Step",                          "C_Step",
                                                         (Tcl_CmdProc *) C_StepProc,                          (Tcl_CmdProc *) C_StepProc,
                                                         (ClientData) NULL,                          (ClientData) NULL,
                                                         (void (*)()) NULL);                          (void (*)()) NULL);
         Tcl_CreateCommand(interp,          Tcl_CreateCommand(interp,
                                                         "C_Save",                          "C_Save",
                                                         (Tcl_CmdProc *) C_SaveProc,                          (Tcl_CmdProc *) C_SaveProc,
                                                         (ClientData) NULL,                          (ClientData) NULL,
                                                         (void (*)()) NULL);                          (void (*)()) NULL);
         Tcl_CreateCommand(interp,          Tcl_CreateCommand(interp,
                                                         "C_printf",                          "C_printf",
                                                         (Tcl_CmdProc *) C_printfProc,                          (Tcl_CmdProc *) C_printfProc,
                                                         (ClientData) NULL,                          (ClientData) NULL,
                                                         (void (*)()) NULL);                          (void (*)()) NULL);
         Tcl_CreateCommand(interp,          Tcl_CreateCommand(interp,
                                                         "C_pause",                          "C_pause",
                                                         (Tcl_CmdProc *) C_pauseProc,                          (Tcl_CmdProc *) C_pauseProc,
                                                         (ClientData) NULL,                          (ClientData) NULL,
                                                         (void (*)()) NULL);                          (void (*)()) NULL);
         Tcl_CreateCommand(interp,          Tcl_CreateCommand(interp,
                                                         "C_RefreshGraphics",                          "C_RefreshGraphics",
                                                         (Tcl_CmdProc *) C_RefreshGraphicsProc,                          (Tcl_CmdProc *) C_RefreshGraphicsProc,
                                                         (ClientData) NULL,                          (ClientData) NULL,
                                                         (void (*)()) NULL);                          (void (*)()) NULL);
         Tcl_CreateCommand(interp,          Tcl_CreateCommand(interp,
                                                         "C_Rescale",                          "C_Rescale",
                                                         (Tcl_CmdProc *) C_RescaleProc,                          (Tcl_CmdProc *) C_RescaleProc,
                                                         (ClientData) NULL,                          (ClientData) NULL,
                                                         (void (*)()) NULL);                          (void (*)()) NULL);
         Tcl_CreateCommand(interp,          Tcl_CreateCommand(interp,
                                                         "C_Trace",                          "C_Trace",
                                                         (Tcl_CmdProc *) C_TraceProc,                          (Tcl_CmdProc *) C_TraceProc,
                                                         (ClientData) NULL,                          (ClientData) NULL,
                                                         (void (*)()) NULL);                          (void (*)()) NULL);
         Tcl_CreateCommand(interp,          Tcl_CreateCommand(interp,
                                                         "C_Print",                          "C_Print",
                                                         (Tcl_CmdProc *) C_PrintProc,                          (Tcl_CmdProc *) C_PrintProc,
                                                         (ClientData) NULL,                          (ClientData) NULL,
                                                         (void (*)()) NULL);                          (void (*)()) NULL);
         Tcl_CreateCommand(interp,          Tcl_CreateCommand(interp,
                                                         "C_UpdateCrosshair",                          "C_UpdateCrosshair",
                                                         (Tcl_CmdProc *) C_UpdateCrosshairProc,                          (Tcl_CmdProc *) C_UpdateCrosshairProc,
                                                         (ClientData) NULL,                          (ClientData) NULL,
                                                         (void (*)()) NULL);                          (void (*)()) NULL);
         Tcl_CreateCommand(interp,          Tcl_CreateCommand(interp,
                                                         "C_SetCrosshairParameters",                          "C_SetCrosshairParameters",
                                                         (Tcl_CmdProc *) C_SetCrosshairParametersProc,                          (Tcl_CmdProc *) C_SetCrosshairParametersProc,
                                                         (ClientData) NULL,                          (ClientData) NULL,
                                                         (void (*)()) NULL);                          (void (*)()) NULL);
         Tcl_CreateCommand(interp,          Tcl_CreateCommand(interp,
                                                         "C_3DView",                          "C_3DView",
                                                         (Tcl_CmdProc *) C_3DViewProc,                          (Tcl_CmdProc *) C_3DViewProc,
                                                         (ClientData) NULL,                          (ClientData) NULL,
                                                         (void (*)()) NULL);                          (void (*)()) NULL);
         Tcl_CreateCommand(interp,          Tcl_CreateCommand(interp,
                                                         "C_GetSpecialValues",                          "C_GetSpecialValues",
                                                         (Tcl_CmdProc *) C_GetSpecialValuesProc,                          (Tcl_CmdProc *) C_GetSpecialValuesProc,
                                                         (ClientData) NULL,                          (ClientData) NULL,
                                                         (void (*)()) NULL);                          (void (*)()) NULL);
         Tcl_CreateCommand(interp,          Tcl_CreateCommand(interp,
                                                         "C_SetNewSpecials",                          "C_SetNewSpecials",
                                                         (Tcl_CmdProc *) C_SetNewSpecialProc,                          (Tcl_CmdProc *) C_SetNewSpecialProc,
                                                         (ClientData) NULL,                          (ClientData) NULL,
                                                         (void (*)()) NULL);                          (void (*)()) NULL);
         Tcl_CreateCommand(interp,          Tcl_CreateCommand(interp,
                                                         "C_GetRanges",                          "C_GetRanges",
                                                         (Tcl_CmdProc *) C_GetRangesProc,                          (Tcl_CmdProc *) C_GetRangesProc,
                                                         (ClientData) NULL,                          (ClientData) NULL,
                                                         (void (*)()) NULL);                          (void (*)()) NULL);
         Tcl_CreateCommand(interp,          Tcl_CreateCommand(interp,
                                                         "C_CreateWindow",                          "C_CreateWindow",
                                                         (Tcl_CmdProc *) C_CreateWindowProc,                          (Tcl_CmdProc *) C_CreateWindowProc,
                                                         (ClientData) NULL,                          (ClientData) NULL,
                                                         (void (*)()) NULL);                          (void (*)()) NULL);
         Tcl_CreateCommand(interp,          Tcl_CreateCommand(interp,
                                                         "C_3dCross",                          "C_3dCross",
                                                         (Tcl_CmdProc *) C_3dCrossProc,                          (Tcl_CmdProc *) C_3dCrossProc,
                                                         (ClientData) NULL,                          (ClientData) NULL,
                                                         (void (*)()) NULL);                          (void (*)()) NULL);
         Tcl_CreateCommand(interp,          Tcl_CreateCommand(interp,
                                                         "C_3dCrossOn",                          "C_3dCrossOn",
                                                         (Tcl_CmdProc *) C_3dCrossOnProc,                          (Tcl_CmdProc *) C_3dCrossOnProc,
                                                         (ClientData) NULL,                          (ClientData) NULL,
                                                         (void (*)()) NULL);                          (void (*)()) NULL);
         Tcl_CreateCommand(interp,          Tcl_CreateCommand(interp,
                                                         "C_3dCrossOff",                          "C_3dCrossOff",
                                                         (Tcl_CmdProc *) C_3dCrossOffProc,                          (Tcl_CmdProc *) C_3dCrossOffProc,
                                                         (ClientData) NULL,                          (ClientData) NULL,
                                                         (void (*)()) NULL);                          (void (*)()) NULL);
         Tcl_CreateCommand(interp,          Tcl_CreateCommand(interp,
                                                         "C_ShouldRefresh",                          "C_ShouldRefresh",
                                                         (Tcl_CmdProc *) C_ShouldRefreshProc,                          (Tcl_CmdProc *) C_ShouldRefreshProc,
                                                         (ClientData) NULL,                          (ClientData) NULL,
                                                         (void (*)()) NULL);                          (void (*)()) NULL);
         Tcl_CreateCommand(interp,          Tcl_CreateCommand(interp,
                                                         "C_DefineUL",                          "C_DefineUL",
                                                         (Tcl_CmdProc *) C_DefineULProc,                          (Tcl_CmdProc *) C_DefineULProc,
                                                         (ClientData) NULL,                          (ClientData) NULL,
                                                         (void (*)()) NULL);                          (void (*)()) NULL);
         Tcl_CreateCommand(interp,          Tcl_CreateCommand(interp,
                                                         "C_StretchBox",                          "C_StretchBox",
                                                         (Tcl_CmdProc *) C_StretchBoxProc,                          (Tcl_CmdProc *) C_StretchBoxProc,
                                                         (ClientData) NULL,                          (ClientData) NULL,
                                                         (void (*)()) NULL);                          (void (*)()) NULL);
         if (xgDebug == TRUE) {          if (xgDebug == TRUE) {
                 Tcl_CreateCommand(interp,                  Tcl_CreateCommand(interp,
                                                                 "C_XGDebug",                                  "C_XGDebug",
                                                                 (Tcl_CmdProc *) C_XGDebug,                                  (Tcl_CmdProc *) C_XGDebug,
                                                                 (ClientData) NULL,                                  (ClientData) NULL,
                                                                 (void (*)()) NULL);                                  (void (*)()) NULL);
         }          }
 } // }}}  } // }}}
 // Function void SortWindows(void) {{{  // Function void SortWindows(void) {{{
Line 874  void SortWindows(void)
Line 929  void SortWindows(void)
 // Function int Search(char *WinTitle) {{{  // Function int Search(char *WinTitle) {{{
 int Search(char *WinTitle)  int Search(char *WinTitle)
 {  {
         sprintf(TclCommand,"set temp \"\"; "          if (snprintf(TclCommand, TclCommand_MAX, "set temp \"\"; "
                                                         "set \"WinData([append temp . "                                  "set \"WinData([append temp . "
                                                         "[string tolower \"%s\"]],index)\"\n",WinTitle);                                  "[string tolower \"%s\"]],index)\"\n",WinTitle) == -1) {
                   fprintf(stderr, "Warning: TclCommand truncated at %s:%d\n", __FILE__, __LINE__);
           }
         Tcl_Eval(interp,TclCommand);          Tcl_Eval(interp,TclCommand);
         return atoi(interp->result);          return atoi(interp->result);
 } // }}}  } // }}}

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

Platon Group <platon@platon.org> http://platon.org/
Copyright © 2002-2006 Platon Group
Site powered by Metafox CMS
Go to Top