1 #include "VMDemoTkInit.h"
3 #include "NewTclCommands.h"
6 int VMDemoTkInit ( Tcl_Interp *interp, int argc, char **argv)
8 // creating the interpreter for tcl application
10 interp = Tcl_CreateInterp();
13 printf("No interpretator\n");
17 // finding out application location
18 Tcl_FindExecutable(argv[0]);
20 // Here begins the first step on C and TCL
21 // integration: The Tcl/Tk initialization.
22 if (Tcl_Init(interp) == TCL_ERROR)
24 fprintf(stderr, "Tcl_Init failed: %s\n",
29 if (Tk_Init(interp) == TCL_ERROR)
31 fprintf(stderr, "Tk_Init failed: %s\n",
37 //The second step, creating new Tcl commands for user interface widgets.
39 // procedure for "set original windows position" button
40 Tcl_CreateCommand (interp, "CSetpos", TKVMDemo_Setposition,
41 (ClientData *) NULL, (Tcl_CmdDeleteProc *) NULL);
43 // fileopen dialog and procedure
44 Tcl_CreateCommand (interp, "Cfileopen", TKVMDemo_fileopen,
45 (ClientData *) NULL, (Tcl_CmdDeleteProc *) NULL);
48 Tcl_CreateCommand( interp, "Cscale", TKVMDemo_scale,
49 (ClientData *) NULL, (Tcl_CmdDeleteProc *) NULL);
51 // Command for showscanlines checkbutton
52 Tcl_CreateCommand( interp, "CShowScanlines", TKVMDemo_ShowScanlines,
53 (ClientData *) NULL, (Tcl_CmdDeleteProc *) NULL);
55 Tcl_CreateThreadExitHandler(OnExit, (ClientData *) NULL);
57 //Now we evaluate the user interface script
58 if(Tcl_EvalFile(interp, "interface.tcl") == TCL_ERROR)
60 printf("%s\nline %d\n", interp->result, interp->errorLine);
64 //Setting windows to the original position
65 Tcl_Eval(interp, "CSetpos");
67 cvvInitSystem(argc, argv);
68 cvvNamedWindow( "left", 0 );
69 cvvNamedWindow( "right", 0 );
70 cvvNamedWindow( "result", 0 );