WS_OVERLAPPEDWINDOW,
1,1,1,1,
NULL, NULL,::GetModuleHandle(NULL), NULL);
- SetWindowPos(aWin, HWND_TOPMOST, 1,1,1,1, SWP_NOMOVE);
- SetWindowPos(aWin, HWND_NOTOPMOST, 1,1,1,1, SWP_NOMOVE);
+ if (!Draw_VirtualWindows)
+ {
+ SetWindowPos(aWin, HWND_TOPMOST, 1,1,1,1, SWP_NOMOVE);
+ SetWindowPos(aWin, HWND_NOTOPMOST, 1,1,1,1, SWP_NOMOVE);
+ }
return aWin;
}
else {
DWORD IDThread;
HANDLE hThread;
console_semaphore = STOP_CONSOLE;
-
theCommands.Init();
interp = theCommands.Interp();
Tcl_Init(interp) ;
if(!RegisterAppClass(hInst))
return(Standard_False);
- if (Draw_VirtualWindows) {
- // main window will never shown
- Tcl_Eval(theCommands.Interp(), "wm withdraw .");
- }
-
/*
** Enter the application message-polling loop. This is the anchor for
** the application.
static DWORD WINAPI tkLoop(VOID)
{
Tcl_CreateExitHandler(exitProc, 0);
-
#if (TCL_MAJOR_VERSION > 8) || ((TCL_MAJOR_VERSION == 8) && (TCL_MINOR_VERSION >= 5))
Tcl_RegisterChannel(theCommands.Interp(), Tcl_GetStdChannel(TCL_STDIN));
Tcl_RegisterChannel(theCommands.Interp(), Tcl_GetStdChannel(TCL_STDOUT));
#endif
#ifdef _TK
- try {
- OCC_CATCH_SIGNALS
- Standard_Integer res = Tk_Init(interp) ;
- if (res != TCL_OK)
- cout << "tkLoop: error in Tk initialization. Tcl reported: " << interp->result << endl;
-
- } catch (Standard_Failure) {
- cout <<"tkLoop: exception in TK_Init "<<endl;
- }
- Tcl_StaticPackage(interp, "Tk", Tk_Init, (Tcl_PackageInitProc *) NULL);
-
- mainWindow =
- Tk_MainWindow(interp) ;
- if (mainWindow == NULL) {
- fprintf(stderr, "%s\n", interp->result);
- cout << "tkLoop: Tk_MainWindow() returned NULL. Exiting..." << endl;
- Tcl_Exit(0);
- }
- Tk_Name(mainWindow) =
- Tk_GetUid(Tk_SetAppName(mainWindow,
- "Draw")) ;
-
- if (Draw_VirtualWindows) {
- // main window will never shown
- Tcl_Eval(theCommands.Interp(), "wm withdraw .");
+ // initialize the Tk library if not in 'virtual windows' mode
+ // (virtual windows are created by OCCT with native APIs,
+ // thus Tk will be useless)
+ if (!Draw_VirtualWindows)
+ {
+ try
+ {
+ OCC_CATCH_SIGNALS
+ Standard_Integer res = Tk_Init (interp);
+ if (res != TCL_OK)
+ {
+ cout << "tkLoop: error in Tk initialization. Tcl reported: " << interp->result << endl;
+ }
+ }
+ catch (Standard_Failure)
+ {
+ cout << "tkLoop: exception in TK_Init\n";
+ }
+ Tcl_StaticPackage (interp, "Tk", Tk_Init, (Tcl_PackageInitProc* ) NULL);
+ mainWindow = Tk_MainWindow (interp);
+ if (mainWindow == NULL)
+ {
+ fprintf (stderr, "%s\n", interp->result);
+ cout << "tkLoop: Tk_MainWindow() returned NULL. Exiting...\n";
+ Tcl_Exit (0);
+ }
+ Tk_Name(mainWindow) = Tk_GetUid (Tk_SetAppName (mainWindow, "Draw"));
}
-#endif //#ifdef _TK
+#endif //#ifdef _TK
- // msv - 16/09/2004 - set signal handler in the new thread
+ // set signal handler in the new thread
OSD::SetSignal();
- // san - 06/08/2002 - inform the others that we have started
+ // inform the others that we have started
isTkLoopStarted = true;
while (console_semaphore == STOP_CONSOLE)
Prompt(interp, 0);
//process a command
-#ifdef _TK
- // san - 10/07/02 -- We should not exit until the Main Tk window is closed
- while (Tk_GetNumMainWindows() > 0) {
-#else
- while (1) {
-#endif
+ Standard_Boolean toLoop = Standard_True;
+ while (toLoop)
+ {
while(Tcl_DoOneEvent(TCL_ALL_EVENTS | TCL_DONT_WAIT));
- if (console_semaphore == HAS_CONSOLE_COMMAND) {
- if (Draw_Interprete(console_command))
- if (Draw_IsConsoleSubsystem) Prompt(interp, 0);
+ if (console_semaphore == HAS_CONSOLE_COMMAND)
+ {
+ if (Draw_Interprete (console_command))
+ {
+ if (Draw_IsConsoleSubsystem) Prompt (interp, 0);
+ }
else
- if (Draw_IsConsoleSubsystem) Prompt(interp, 1);
+ {
+ if (Draw_IsConsoleSubsystem) Prompt (interp, 1);
+ }
console_semaphore = WAIT_CONSOLE_COMMAND;
}
else
+ {
Sleep(100);
-
+ }
+ #ifdef _TK
+ // We should not exit until the Main Tk window is closed
+ toLoop = (Tk_GetNumMainWindows() > 0) || Draw_VirtualWindows;
+ #endif
}
-
Tcl_Exit(0);
-
return 0;
}
if { [info exists env(DRAWHOME) ] } {
set dir $env(DRAWHOME)
} else {
- if { [info exists env(CASROOT) ] } {
- set dir [file join $env(CASROOT) src DrawResources]
- } else {
- puts " CASROOT is Mandatory to Run OpenCascade"
- }
+ if { [info exists env(CASROOT) ] } {
+ set dir [file join $env(CASROOT) src DrawResources]
+ } else {
+ puts " CASROOT is Mandatory to Run OpenCascade"
+ }
}
# san - 02/08/2002 - In Tcl8.3 it is no longer necessary to load Tix explicitly on WNT
#}
if { [file exist $dir] } {
- source [file join $dir StandardCommands.tcl]
- source [file join $dir StandardViews.tcl]
- source [file join $dir Geometry.tcl]
- if [info exists tk_version] {source [file join $dir DrawTK.tcl]}
- if [file readable DrawAppliInit] {
- source DrawAppliInit
- }
- set stationname $tcl_platform(platform)
- if { ${stationname} == "windows" } {
+ source [file join $dir StandardCommands.tcl]
+ source [file join $dir StandardViews.tcl]
+ source [file join $dir Geometry.tcl]
+
+ set stationname $tcl_platform(platform)
+ if [info exists tk_version] {
+ source [file join $dir DrawTK.tcl]
+ # setup the icon for main window
+ if { ${stationname} == "windows" } {
wm iconbitmap . -default [file join $dir lamp.ico]
- }
+ }
+ }
+ if [file readable DrawAppliInit] {
+ source DrawAppliInit
+ }
}