From eaf5c5e01044d95c4dd72116671abc0738073844 Mon Sep 17 00:00:00 2001 From: kgv Date: Thu, 25 Sep 2014 13:14:45 +0400 Subject: [PATCH] 0025216: WNT_Window - remove unused fields and types (WNT_WindowData) Clean up InterfaceGraphic.hxx OpenGl_Window - do not use removed macros WINDOW Small correction of test case for issue CR25216 --- src/InterfaceGraphic/FILES | 6 - src/InterfaceGraphic/InterfaceGraphic.hxx | 31 +- .../InterfaceGraphic_Cocoa.hxx | 36 -- src/InterfaceGraphic/InterfaceGraphic_WNT.hxx | 77 ---- src/InterfaceGraphic/InterfaceGraphic_X11.hxx | 64 --- src/InterfaceGraphic/InterfaceGraphic_XWD.hxx | 30 -- .../InterfaceGraphic_cPrintf.cxx | 147 ------- .../InterfaceGraphic_wntio.hxx | 43 -- src/OpenGl/OpenGl_AVIWriter.hxx | 2 +- src/OpenGl/OpenGl_Window.cxx | 6 +- src/Visual3d/Visual3d_View.cxx | 5 +- src/Visual3d/Visual3d_ViewManager.cxx | 8 +- src/WNT/FILES | 1 - src/WNT/WNT.cdl | 4 - src/WNT/WNT_WClass.cxx | 4 +- src/WNT/WNT_Window.cdl | 39 +- src/WNT/WNT_Window.cxx | 385 +++++++----------- src/WNT/WNT_Window.lxx | 25 +- src/WNT/WNT_WindowData.hxx | 46 --- tests/offset/wire_closed_inside_0_025/D1 | 4 +- 20 files changed, 207 insertions(+), 756 deletions(-) delete mode 100644 src/InterfaceGraphic/InterfaceGraphic_Cocoa.hxx delete mode 100644 src/InterfaceGraphic/InterfaceGraphic_WNT.hxx delete mode 100644 src/InterfaceGraphic/InterfaceGraphic_X11.hxx delete mode 100644 src/InterfaceGraphic/InterfaceGraphic_XWD.hxx delete mode 100644 src/InterfaceGraphic/InterfaceGraphic_cPrintf.cxx delete mode 100644 src/InterfaceGraphic/InterfaceGraphic_wntio.hxx delete mode 100644 src/WNT/WNT_WindowData.hxx diff --git a/src/InterfaceGraphic/FILES b/src/InterfaceGraphic/FILES index ea3fe2cad5..acf3daabe0 100755 --- a/src/InterfaceGraphic/FILES +++ b/src/InterfaceGraphic/FILES @@ -2,11 +2,5 @@ InterfaceGraphic.hxx InterfaceGraphic_Aspect.hxx InterfaceGraphic_Graphic3d.hxx InterfaceGraphic_Visual3d.hxx -InterfaceGraphic_WNT.hxx -InterfaceGraphic_X11.hxx -InterfaceGraphic_Cocoa.hxx -InterfaceGraphic_XWD.hxx -InterfaceGraphic_wntio.hxx -InterfaceGraphic_cPrintf.cxx InterfaceGraphic_telem.hxx InterfaceGraphic_tgl_all.hxx diff --git a/src/InterfaceGraphic/InterfaceGraphic.hxx b/src/InterfaceGraphic/InterfaceGraphic.hxx index a2434bbc26..c59bd5d1a0 100644 --- a/src/InterfaceGraphic/InterfaceGraphic.hxx +++ b/src/InterfaceGraphic/InterfaceGraphic.hxx @@ -15,12 +15,31 @@ #ifndef __INTERFACE_GRAPHIC_HXX #define __INTERFACE_GRAPHIC_HXX -#ifdef WNT - #include -#elif defined(__APPLE__) && !defined(MACOSX_USE_GLX) - #include -#else - #include +#if defined(_WIN32) + +#include + +#ifdef DrawText + #undef DrawText +#endif + +#elif !defined(__ANDROID__) && (!defined(__APPLE__) || defined(MACOSX_USE_GLX)) + +#include + +#include +#include +#include +#include + +// workaround name conflicts with OCCT methods (in class TopoDS_Shape for example) +#ifdef Convex + #undef Convex +#endif +#ifdef Status + #undef Status +#endif + #endif #endif // __INTERFACE_GRAPHIC_HXX diff --git a/src/InterfaceGraphic/InterfaceGraphic_Cocoa.hxx b/src/InterfaceGraphic/InterfaceGraphic_Cocoa.hxx deleted file mode 100644 index 3497c88e7c..0000000000 --- a/src/InterfaceGraphic/InterfaceGraphic_Cocoa.hxx +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) 2013-2014 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#ifdef __APPLE__ - -#ifndef InterfaceGraphic_CocoaHeader -#define InterfaceGraphic_CocoaHeader - -#include - -#define WINDOW void* -#define DISPLAY void* -#define GLCONTEXT void* -#define GLDRAWABLE void* - -#define GET_GL_CONTEXT() NULL -#define GET_GLDEV_CONTEXT() NULL -#define GL_MAKE_CURRENT(a,b,c) {} - -#ifndef EXPORT - #define EXPORT -#endif - -#endif // InterfaceGraphic_CocoaHeader - -#endif // __APPLE__ diff --git a/src/InterfaceGraphic/InterfaceGraphic_WNT.hxx b/src/InterfaceGraphic/InterfaceGraphic_WNT.hxx deleted file mode 100644 index 4a879479d5..0000000000 --- a/src/InterfaceGraphic/InterfaceGraphic_WNT.hxx +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright (c) 1991-1999 Matra Datavision -// Copyright (c) 1999-2014 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#ifndef __INTERFACE_GRAPHIC_WNT_HXX -# define __INTERFACE_GRAPHIC_WNT_HXX - -#ifdef WNT -# include -# ifdef DrawText -# undef DrawText -# endif /* DrawText */ - - -//for common type naming -# define DISPLAY char -# define WINDOW HWND -# define GLCONTEXT HGLRC -# define GLDRAWABLE HDC - -# define GET_GL_CONTEXT() wglGetCurrentContext () -# define GET_GLDEV_CONTEXT() wglGetCurrentDC() -# define GL_MAKE_CURRENT(a,b,c) wglMakeCurrent(b,c) - -#ifdef DrawText -# undef DrawText -#endif /* DrawText */ - -#define WDF_NOERASEBKGRND 0x00000001 -#define WDF_FOREIGN 0x00000002 - -typedef struct window_data { - - void* WNT_Window_Ptr; // pointer to WNT_Window - void* WNT_WDriver_Ptr; // pointer to WNT_WDriver or Visual3d_View - void* WNT_VMgr; // pointer to Visual3d_ViewManager - HPALETTE hPal; // palette handle or NULL - HBITMAP hBmp; // double buffer bitmap handle or NULL - DWORD dwFlags; // additional information - -} WINDOW_DATA; - -#define faUnderlined 0x00000001 -#define faItalic 0x00000002 -#define faStrikeOut 0x00000004 -#define faBold 0x00000008 -#define faHeight 0x00000010 -#define faAngle 0x00000020 -#define faWidth 0x00000040 -#define faSlant 0x00000080 - -typedef struct font_data { - - BOOL fdUnderlined; - BOOL fdItalic; - BOOL fdStrikeOut; - LONG fdBold; - LONG fdHeight; - LONG fdOrientation; - LONG fdWidth; - LONG fdSlant; - -} FONT_DATA; - -#endif //WNT - -#endif /* __INTERFACE_GRAPHIC_WNT_HXX */ diff --git a/src/InterfaceGraphic/InterfaceGraphic_X11.hxx b/src/InterfaceGraphic/InterfaceGraphic_X11.hxx deleted file mode 100644 index 280bb9b6df..0000000000 --- a/src/InterfaceGraphic/InterfaceGraphic_X11.hxx +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright (c) 1991-1999 Matra Datavision -// Copyright (c) 1999-2014 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#ifndef _WIN32 -#ifndef InterfaceGraphic_X11Header -#define InterfaceGraphic_X11Header - -#include - -#include -#include -#include -#include - -#if defined (sun) || defined (SUNOS) || defined (__alpha) || defined (DECOSF1) || defined (sgi) || defined (IRIX) || defined (__hpux)|| defined (HPUX) - #ifndef icon_width - #include - #endif -#endif // SUNOS or DECOSF1 or SOLARIS or HPUX or IRIX -#if defined(ULTRIX) && !defined(icon_width) - #define icon_width 16 - #define icon_height 16 - static unsigned char icon_bits[] = - { - 0xff, 0xff, 0xab, 0xaa, 0x55, 0xd5, 0xab, 0xaa, 0x05, 0xd0, 0x0b, 0xa0, - 0x05, 0xd0, 0x0b, 0xa0, 0x05, 0xd0, 0x0b, 0xa0, 0x05, 0xd0, 0x0b, 0xa0, - 0x55, 0xd5, 0xab, 0xaa, 0x55, 0xd5, 0xff, 0xff - }; -#endif // ULTRIX - -// workaround name conflicts with OCCT methods (in class TopoDS_Shape for example) -#ifdef Convex - #undef Convex -#endif -#ifdef Status - #undef Status -#endif - -#define WINDOW Window -#define DISPLAY Display -#define GLCONTEXT GLXContext -#define GLDRAWABLE GLXDrawable - -#define GET_GL_CONTEXT() glXGetCurrentContext() -#define GET_GLDEV_CONTEXT() glXGetCurrentDrawable() -#define GL_MAKE_CURRENT(a,b,c) glXMakeCurrent(a,b,c) - -#ifndef EXPORT - #define EXPORT -#endif // EXPORT - -#endif // InterfaceGraphic_X11Header -#endif // _WIN32 diff --git a/src/InterfaceGraphic/InterfaceGraphic_XWD.hxx b/src/InterfaceGraphic/InterfaceGraphic_XWD.hxx deleted file mode 100644 index ce2f1ef971..0000000000 --- a/src/InterfaceGraphic/InterfaceGraphic_XWD.hxx +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (c) 1991-1999 Matra Datavision -// Copyright (c) 1999-2014 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#ifndef InterfaceGraphic_XWDHeader -#define InterfaceGraphic_XWDHeader - -/* - * InterfaceGraphic_SWAPTEST = 0 sur sun, sgi, hp - * 1 sur ao1 - */ - -#define InterfaceGraphic_SWAPTEST (*(char*)&InterfaceGraphic_swaptest) -static unsigned long InterfaceGraphic_swaptest = 1; - -#include - -#include - -#endif /* InterfaceGraphic_XWDHeader */ diff --git a/src/InterfaceGraphic/InterfaceGraphic_cPrintf.cxx b/src/InterfaceGraphic/InterfaceGraphic_cPrintf.cxx deleted file mode 100644 index eeb95e9194..0000000000 --- a/src/InterfaceGraphic/InterfaceGraphic_cPrintf.cxx +++ /dev/null @@ -1,147 +0,0 @@ -// Copyright (c) 1991-1999 Matra Datavision -// Copyright (c) 1999-2014 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#if defined (__osf__ ) || defined ( DECOSF1 ) -int DECOSF1_a_horreur_du_vide_a_la_compilation; -#endif -#if defined ( __hpux ) || defined ( HPUX ) -int HPUX_a_horreur_du_vide_a_la_compilation; -#endif - -#ifdef WNT - -#define STRICT -#include - -#include -#include - -#include - -typedef struct _env { - - DWORD len; - char* ptr; - -} ENV, *PENV; - -static DWORD tlsIndex; - -class Init_ { - -public: - - Init_ () { tlsIndex = TlsAlloc (); } - -}; // end Init_ - -static Init_ init; - -int cPrintf ( char* fmt, ... ) { - - static BOOL first = TRUE; - static HANDLE hConsole = NULL; - - char buffer[ 256 ]; - va_list argptr; - int cnt; - DWORD lpcchWritten; - - if ( first ) { - hConsole = GetStdHandle ( STD_OUTPUT_HANDLE ); - if ( hConsole == NULL ) { - AllocConsole (); - hConsole = GetStdHandle ( STD_OUTPUT_HANDLE ); - } /* end if */ - - first = FALSE; - - } /* end if */ - - va_start( argptr, fmt ); - cnt = vsprintf ( buffer, fmt, argptr ); - va_end ( argptr ); - WriteConsole ( hConsole, buffer, (DWORD) strlen ( buffer ), &lpcchWritten, NULL ); - return cnt; - -} /* end cPrintf */ - -int fcPrintf ( int /*dummy*/, char* fmt, ... ) { - - static BOOL first = TRUE; - static HANDLE hConsole = NULL; - - char buffer[ 256 ]; - va_list argptr; - int cnt; - DWORD lpcchWritten; - - if ( first ) { - hConsole = GetStdHandle ( STD_OUTPUT_HANDLE ); - if ( hConsole == NULL ) { - AllocConsole (); - hConsole = GetStdHandle ( STD_OUTPUT_HANDLE ); - } /* end if */ - - first = FALSE; - } /* end if */ - - va_start( argptr, fmt ); - cnt = vsprintf ( buffer, fmt, argptr ); - va_end ( argptr ); - WriteConsole ( hConsole, buffer, (DWORD )strlen ( buffer ), &lpcchWritten, NULL ); - - return cnt; - -} /* end fcPrintf */ - -char* GetEnv ( char* name ) { - - DWORD dwLen; - PENV env = ( PENV )TlsGetValue ( tlsIndex ); - - if ( env == NULL ) { - env = ( PENV )HeapAlloc ( - GetProcessHeap (), HEAP_GENERATE_EXCEPTIONS | HEAP_ZERO_MEMORY, - ( DWORD )sizeof ( ENV ) - ); - TlsSetValue ( tlsIndex, ( LPVOID )env ); - } /* end if */ - - SetLastError ( ERROR_SUCCESS ); - dwLen = GetEnvironmentVariable ( name, NULL, 0 ); - - if ( dwLen == 0 && GetLastError () != ERROR_SUCCESS ) return NULL; - - ++dwLen; - - if ( env -> len < dwLen ) { - if ( env -> ptr != NULL ) - env -> ptr = ( char* )HeapReAlloc ( - GetProcessHeap (), HEAP_GENERATE_EXCEPTIONS | HEAP_ZERO_MEMORY, - env -> ptr, dwLen - ); - else - env -> ptr = ( char* )HeapAlloc ( - GetProcessHeap (), HEAP_GENERATE_EXCEPTIONS | HEAP_ZERO_MEMORY, - dwLen - ); - env -> len = dwLen; - } /* end if */ - - GetEnvironmentVariable ( name, env -> ptr, dwLen ); - return env -> ptr; - -} /* end GetEnv */ -#endif /* WNT */ diff --git a/src/InterfaceGraphic/InterfaceGraphic_wntio.hxx b/src/InterfaceGraphic/InterfaceGraphic_wntio.hxx deleted file mode 100644 index 4645a3bc2a..0000000000 --- a/src/InterfaceGraphic/InterfaceGraphic_wntio.hxx +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) 1991-1999 Matra Datavision -// Copyright (c) 1999-2014 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#ifndef __WNTIO_H -# define __WNTIO_H - -# ifdef __cplusplus -extern "C" { -# endif /* __cplusplus */ - -# ifndef __InterfaceGraphic_API -# ifdef __InterfaceGraphic_DLL -# define __InterfaceGraphic_API __declspec( dllexport ) -# else -# define __InterfaceGraphic_API __declspec( dllimport ) -# endif /* __InterfaceGraphic_DLL */ -# endif /* __InterfaceGraphic_API */ - -__InterfaceGraphic_API int cPrintf ( char*, ... ); -__InterfaceGraphic_API int fcPrintf ( int, char*, ... ); -__InterfaceGraphic_API char* form ( char*, ... ); -__InterfaceGraphic_API char* GetEnv ( char* ); - -# ifdef __cplusplus -} -# endif /* __cplusplus */ - -# define printf cPrintf -# define fprintf fcPrintf -# define getenv GetEnv - -#endif /* __WNTIO_H */ diff --git a/src/OpenGl/OpenGl_AVIWriter.hxx b/src/OpenGl/OpenGl_AVIWriter.hxx index 95a5796644..2d0af0f914 100644 --- a/src/OpenGl/OpenGl_AVIWriter.hxx +++ b/src/OpenGl/OpenGl_AVIWriter.hxx @@ -19,7 +19,7 @@ #ifdef WNT #define THIS void -#include +#include #include #include #include diff --git a/src/OpenGl/OpenGl_Window.cxx b/src/OpenGl/OpenGl_Window.cxx index 04013efd4b..43e82457f7 100644 --- a/src/OpenGl/OpenGl_Window.cxx +++ b/src/OpenGl/OpenGl_Window.cxx @@ -353,9 +353,9 @@ OpenGl_Window::OpenGl_Window (const Handle(Aspect_DisplayConnection)& theDisplay myGlContext->Init ((Aspect_Handle )aWindow, (Aspect_Handle )aWindowDC, (Aspect_RenderingContext )aGContext); #else - WINDOW aParent = (WINDOW )theCWindow.XWindow; - WINDOW aWindow = 0; - + Window aParent = (Window )theCWindow.XWindow; + Window aWindow = 0; + Display* aDisp = theDisplayConnection->GetDisplay(); GLXContext aGContext = (GLXContext )theGContext; diff --git a/src/Visual3d/Visual3d_View.cxx b/src/Visual3d/Visual3d_View.cxx index 3a98b341c1..26761bde67 100644 --- a/src/Visual3d/Visual3d_View.cxx +++ b/src/Visual3d/Visual3d_View.cxx @@ -118,14 +118,13 @@ void Visual3d_View::SetWindow (const Handle(Aspect_Window)& theWindow) const Handle(WNT_Window) aWin = Handle(WNT_Window)::DownCast (theWindow); MyCView.DefWindow.XWindow = (HWND )(aWin->HWindow()); MyCView.DefWindow.XParentWindow = (HWND )(aWin->HParentWindow()); - WNT_WindowData* aWinData = (WNT_WindowData* )GetWindowLongPtr ((HWND )(aWin->HWindow()), GWLP_USERDATA); - aWinData->WNT_WDriver_Ptr = (void* )this; - aWinData->WNT_VMgr = myViewManager; #elif (defined(__APPLE__) && !defined(MACOSX_USE_GLX)) const Handle(Cocoa_Window) aWin = Handle(Cocoa_Window)::DownCast (theWindow); MyCView.DefWindow.XWindow = (Aspect_Drawable )aWin->HView(); MyCView.DefWindow.XParentWindow = NULL; //MyCView.DefWindow.XParentWindow = aWin->HParentWindow(); +#elif defined(__ANDROID__) + // #else const Handle(Xw_Window) aWin = Handle(Xw_Window)::DownCast (theWindow); MyCView.DefWindow.XWindow = aWin->XWindow(); diff --git a/src/Visual3d/Visual3d_ViewManager.cxx b/src/Visual3d/Visual3d_ViewManager.cxx index 3647783a0d..9943b824ab 100644 --- a/src/Visual3d/Visual3d_ViewManager.cxx +++ b/src/Visual3d/Visual3d_ViewManager.cxx @@ -444,12 +444,14 @@ Standard_Boolean Visual3d_ViewManager::ViewExists (const Handle(Aspect_Window)& // Parse the list of views to find // a view with the specified window -#if defined(_WIN32) || defined(__WIN32__) +#if defined(_WIN32) const Handle(WNT_Window) THEWindow = Handle(WNT_Window)::DownCast (AWindow); Aspect_Handle TheSpecifiedWindowId = THEWindow->HWindow (); #elif defined(__APPLE__) && !defined(MACOSX_USE_GLX) const Handle(Cocoa_Window) THEWindow = Handle(Cocoa_Window)::DownCast (AWindow); NSView* TheSpecifiedWindowId = THEWindow->HView(); +#elif defined(__ANDROID__) + int TheSpecifiedWindowId = -1; #else const Handle(Xw_Window) THEWindow = Handle(Xw_Window)::DownCast (AWindow); int TheSpecifiedWindowId = int (THEWindow->XWindow ()); @@ -461,12 +463,14 @@ Standard_Boolean Visual3d_ViewManager::ViewExists (const Handle(Aspect_Window)& { const Handle(Aspect_Window) AspectWindow = (MyDefinedView.Value(i))->Window(); -#if defined(_WIN32) || defined(__WIN32__) +#if defined(_WIN32) const Handle(WNT_Window) theWindow = Handle(WNT_Window)::DownCast (AspectWindow); Aspect_Handle TheWindowIdOfView = theWindow->HWindow (); #elif defined(__APPLE__) && !defined(MACOSX_USE_GLX) const Handle(Cocoa_Window) theWindow = Handle(Cocoa_Window)::DownCast (AspectWindow); NSView* TheWindowIdOfView = theWindow->HView(); +#elif defined(__ANDROID__) + int TheWindowIdOfView = 0; #else const Handle(Xw_Window) theWindow = Handle(Xw_Window)::DownCast (AspectWindow); int TheWindowIdOfView = int (theWindow->XWindow ()); diff --git a/src/WNT/FILES b/src/WNT/FILES index f9b8188e56..b69dfd05fe 100755 --- a/src/WNT/FILES +++ b/src/WNT/FILES @@ -4,4 +4,3 @@ WNT_CMPLRS.edl WNT_WOKUMake.edl WNT_Dword.hxx WNT_Uint.hxx -WNT_WindowData.hxx diff --git a/src/WNT/WNT.cdl b/src/WNT/WNT.cdl index 20410f27c7..7ed6aab1eb 100644 --- a/src/WNT/WNT.cdl +++ b/src/WNT/WNT.cdl @@ -78,10 +78,6 @@ package WNT imported Uint; ---Category: Imported types - imported WindowData; - ---Category: Imported types - - --------------------------------- -- Category: Pointers --------------------------------- diff --git a/src/WNT/WNT_WClass.cxx b/src/WNT/WNT_WClass.cxx index fe4117332e..ec03474547 100644 --- a/src/WNT/WNT_WClass.cxx +++ b/src/WNT/WNT_WClass.cxx @@ -16,7 +16,7 @@ #include #include -#include +#include #include @@ -43,7 +43,7 @@ WNT_WClass::WNT_WClass ( wc.style = aStyle; wc.lpfnWndProc = ( aWndProc ) ? ( WNDPROC )aWndProc : DefWindowProc; wc.cbClsExtra = aClassExtra; - wc.cbWndExtra = aWindowExtra + sizeof ( WINDOW_DATA* ); + wc.cbWndExtra = aWindowExtra; wc.hInstance = ( HINSTANCE )hInstance; wc.hIcon = ( anIcon ) ? ( HICON )anIcon : LoadIcon ( NULL, IDI_APPLICATION ); diff --git a/src/WNT/WNT_Window.cdl b/src/WNT/WNT_Window.cdl index bc5243860b..42f17794e5 100644 --- a/src/WNT/WNT_Window.cdl +++ b/src/WNT/WNT_Window.cdl @@ -27,8 +27,7 @@ class Window from WNT inherits Window from Aspect Ratio from Quantity, WClass from WNT, Uint from WNT, - Dword from WNT, - WindowData from WNT + Dword from WNT raises @@ -65,15 +64,6 @@ class Window from WNT inherits Window from Aspect ---Purpose: Creates a Window based on the existing window handle. -- This handle equals ( aPart1 << 16 ) + aPart2. - Create ( - aPart1 : Integer from Standard; - aPart2 : Integer from Standard; - aBackColor : NameOfColor from Quantity = Quantity_NOC_MATRAGRAY - ) - returns Window from WNT; - ---Level: Public - ---Purpose: Creates a Window based on the existing window . - Destroy ( me : mutable ) is virtual; ---Level: Public @@ -117,6 +107,7 @@ class Window from WNT inherits Window from Aspect DoMapping ( me ) returns Boolean from Standard raises WindowError from Aspect is virtual; + ---C++: inline ---Level: Advanced ---Purpose: Apply the mapping change to the window -- and returns TRUE if the window is mapped at screen. @@ -127,21 +118,6 @@ class Window from WNT inherits Window from Aspect ---Level: Internal ---Purpose: Changes variables due to window position. - SetFlags ( me : mutable; aFlags : Integer from Standard ) - is static; - ---Level: Public - ---Purpose: Sets user defined flags in the extra window data area. - -- Supported flags WDF_* are listed in InterfaceGraphic_WNT.hxx - -- In particular, the window backround can be turned off using this method. - - ResetFlags ( me : mutable; aFlags : Integer from Standard ) - is static; - ---Level: Public - ---Purpose: Reset specified flags in the extra window data area. - -- Supported flags WDF_* are listed in InterfaceGraphic_WNT.hxx - -- In particular, the window backround can be turned on using this method. - - ---------------------------- -- Category: Inquire methods ---------------------------- @@ -190,14 +166,6 @@ class Window from WNT inherits Window from Aspect ---Purpose: Returns the Windows NT handle parent of the created window . ---C++: inline - doCreate ( - me : mutable; - aHandle : Handle from Aspect; - aBackColor : NameOfColor from Quantity = Quantity_NOC_MATRAGRAY - ) is static private; - ---Level: Private - ---Purpose: private method - fields aXLeft : Integer from Standard is protected; -- Window coordinates @@ -207,7 +175,6 @@ class Window from WNT inherits Window from Aspect myWClass : WClass from WNT is protected; -- Window class myHWindow : Handle from Aspect is protected; -- Window handle myHParentWindow : Handle from Aspect is protected; -- Parent window handle - myExtraData : WindowData from WNT is protected; -- additional data - myUsrData : Address from Standard is protected; + myIsForeign : Boolean from Standard is protected; end Window; diff --git a/src/WNT/WNT_Window.cxx b/src/WNT/WNT_Window.cxx index 1db464096a..e38f2f6478 100644 --- a/src/WNT/WNT_Window.cxx +++ b/src/WNT/WNT_Window.cxx @@ -15,8 +15,6 @@ // include windows.h first to have all definitions available #include -// GG 07/03/00 Add MMSize() method - #include #include @@ -24,13 +22,10 @@ #include -//************************************************************************// -//***// -// callback function to manage window's background -extern LRESULT CALLBACK WNT_WndProc ( - HWND, UINT, WPARAM, LPARAM - ); - +// ======================================================================= +// function : WNT_Window +// purpose : +// ======================================================================= WNT_Window::WNT_Window (const Standard_CString theTitle, const Handle(WNT_WClass)& theClass, const WNT_Dword& theStyle, @@ -47,9 +42,9 @@ WNT_Window::WNT_Window (const Standard_CString theTitle, aYTop (thePxTop), aXRight (thePxLeft + thePxWidth), aYBottom (thePxTop + thePxHeight), - myWClass (theClass) + myWClass (theClass), + myIsForeign (Standard_False) { - ZeroMemory (&myExtraData, sizeof (WNT_WindowData)); DWORD dwStyle = theStyle; if (thePxWidth <= 0 || thePxHeight <= 0) @@ -96,121 +91,115 @@ WNT_Window::WNT_Window (const Standard_CString theTitle, myHParentWindow = theParent; SetBackground (theBackColor); +} - myUsrData = (Standard_Address )SetWindowLongPtr ((HWND )myHWindow, GWLP_USERDATA, (LONG_PTR )&myExtraData); +// ======================================================================= +// function : WNT_Window +// purpose : +// ======================================================================= +WNT_Window::WNT_Window (const Aspect_Handle theHandle, + const Quantity_NameOfColor theBackColor) +: myIsForeign (Standard_True) +{ + myHWindow = theHandle; + myHParentWindow = GetParent ((HWND )theHandle); - myExtraData.WNT_Window_Ptr = (void* )this; + SetBackground (theBackColor); - SetFlags (WDF_NOERASEBKGRND); + WINDOWPLACEMENT aPlace; + aPlace.length = sizeof (WINDOWPLACEMENT); + ::GetWindowPlacement ((HWND )myHWindow, &aPlace); + + aXLeft = aPlace.rcNormalPosition.left; + aYTop = aPlace.rcNormalPosition.top; + aXRight = aPlace.rcNormalPosition.right; + aYBottom = aPlace.rcNormalPosition.bottom; } -//***// -//************************* Constructor **********************************// -//***// -WNT_Window :: WNT_Window ( - const Aspect_Handle aHandle, - const Quantity_NameOfColor aBackColor - ) : Aspect_Window() -{ - doCreate (aHandle, aBackColor); - - /* Bug OCC20596 */ - SetFlags(WDF_NOERASEBKGRND); - -} // end constructor -//***// -//************************* Constructor **********************************// -//***// -WNT_Window :: WNT_Window ( - const Standard_Integer aPart1, - const Standard_Integer aPart2, - const Quantity_NameOfColor aBackColor - ) : Aspect_Window() +// ======================================================================= +// function : Destroy +// purpose : +// ======================================================================= +void WNT_Window::Destroy() { - Aspect_Handle aHandle = ( Aspect_Handle )( ( aPart1 << 16 ) + aPart2 ); + if (myHWindow == NULL + || myIsForeign) + { + return; + } - doCreate (aHandle, aBackColor); + DestroyWindow ((HWND )myHWindow); + myIsForeign = Standard_False; +} - /* Bug OCC20596 */ - SetFlags(WDF_NOERASEBKGRND); +// ======================================================================= +// function : SetCursor +// purpose : +// ======================================================================= +void WNT_Window::SetCursor (const Aspect_Handle theCursor) const +{ + ::SetClassLongPtr ((HWND )myHWindow, GCLP_HCURSOR, (LONG_PTR )theCursor); +} -} // end constructor -//***// -//***************************** Destroy **********************************// -//***// -void WNT_Window :: Destroy () +// ======================================================================= +// function : IsMapped +// purpose : +// ======================================================================= +Standard_Boolean WNT_Window::IsMapped() const { - if (myHWindow) + if (IsVirtual()) { - if (myUsrData != Standard_Address(-1)) - { - SetWindowLongPtr ((HWND )myHWindow, GWLP_USERDATA, (LONG_PTR )myUsrData); - } - - if (!( myExtraData.dwFlags & WDF_FOREIGN)) - { - DestroyWindow ((HWND )myHWindow); - } - } // end if -} // end WNT_Window :: Destroy - -//**************************** SetCursor *********************************// -//***// -void WNT_Window :: SetCursor ( const Aspect_Handle aCursor ) const { - SetClassLongPtr ((HWND)myHWindow, GCLP_HCURSOR, (LONG_PTR)aCursor); -} // end WNT_Window :: SetCursor - -//***// -//***************************** IsMapped *********************************// -//***// -Standard_Boolean WNT_Window :: IsMapped () const { - if (IsVirtual()) { return Standard_True; } - WINDOWPLACEMENT wp; - - wp.length = sizeof ( WINDOWPLACEMENT ); - GetWindowPlacement ( ( HWND )myHWindow, &wp ); - - return !( wp.showCmd == SW_HIDE || wp.showCmd == SW_MINIMIZE ); -} // WNT_Window :: IsMapped + WINDOWPLACEMENT aPlace; + aPlace.length = sizeof (WINDOWPLACEMENT); + ::GetWindowPlacement ((HWND )myHWindow, &aPlace); + return !(aPlace.showCmd == SW_HIDE + || aPlace.showCmd == SW_MINIMIZE); +} -//***// -//***************************** Map (1) **********************************// -//***// -void WNT_Window :: Map () const { - if (IsVirtual()) { - return; +// ======================================================================= +// function : Map +// purpose : +// ======================================================================= +void WNT_Window::Map() const +{ + if (!IsVirtual()) + { + Map (SW_SHOW); } - Map ( SW_SHOW ); -} // end WNT_Window :: Map - -//***// -//***************************** Map (2) **********************************// -//***// -void WNT_Window :: Map ( const Standard_Integer aMapMode ) const { - if (IsVirtual()) { +} + +// ======================================================================= +// function : Map +// purpose : +// ======================================================================= +void WNT_Window::Map (const Standard_Integer theMapMode) const +{ + if (IsVirtual()) + { return; } - ShowWindow ( ( HWND )myHWindow, aMapMode ); - UpdateWindow ( ( HWND )myHWindow ); - -} // end WNT_Window :: Map - -//***// -//**************************** Unmap *************************************// -//***// -void WNT_Window :: Unmap () const { - Map ( SW_HIDE ); + ::ShowWindow ((HWND )myHWindow, theMapMode); + ::UpdateWindow ((HWND )myHWindow); +} -} // end WNT_Window :: Unmap +// ======================================================================= +// function : Unmap +// purpose : +// ======================================================================= +void WNT_Window::Unmap() const +{ + Map (SW_HIDE); +} -//***// -//**************************** DoResize **********************************// -//***// -Aspect_TypeOfResize WNT_Window :: DoResize () const +// ======================================================================= +// function : DoResize +// purpose : +// ======================================================================= +Aspect_TypeOfResize WNT_Window::DoResize() const { int mask = 0; Aspect_TypeOfResize mode = Aspect_TOR_UNKNOWN; @@ -266,144 +255,70 @@ Aspect_TypeOfResize WNT_Window :: DoResize () const } return mode; - -} // end WNT_Window :: DoResize - -//***// -//**************************** DoMapping **********************************// -//***// -Standard_Boolean WNT_Window :: DoMapping () const { -// DO nothing on WNT. - return Standard_True; } -//***// -//******************************* Ratio **********************************// -//***// -Quantity_Ratio WNT_Window :: Ratio () const { - - RECT r; - - GetClientRect ( ( HWND )myHWindow, &r ); - - return ( Quantity_Ratio )( ( Quantity_Ratio )r.right / ( Quantity_Ratio )r.bottom ); - -} // end WNT_Window :: Ratio - -//***// -//**************************** Position (2) ******************************// -//***// -void WNT_Window :: Position ( - Standard_Integer& X1, Standard_Integer& Y1, - Standard_Integer& X2, Standard_Integer& Y2 - ) const { - - POINT ptl, ptr; - RECT r; - - GetClientRect ( ( HWND )myHWindow, &r ); - - ptl.x = ptl.y = 0; - ClientToScreen ( ( HWND )myHWindow, &ptl ); - ptr.x = r.right; - ptr.y = r.bottom; - ClientToScreen ( ( HWND )myHWindow, &ptr ); - - if ( myHParentWindow ) { - - ScreenToClient ( ( HWND )myHParentWindow, &ptl ); - ScreenToClient ( ( HWND )myHParentWindow, &ptr ); - - } // end if - - X1 = ptl.x; - X2 = ptr.x; - Y1 = ptl.y; - Y2 = ptr.y; - -} // end WNT_Window :: Position - -//***// -//******************************* Size (2) *******************************// -//***// -void WNT_Window :: Size ( - Standard_Integer& Width, Standard_Integer& Height - ) const { - - RECT r; - - GetClientRect ( ( HWND )myHWindow, &r ); - - Width = r.right; - Height = r.bottom; - -} // end WNT_Window :: Size - -//***// -//******************************* SetPos *********************************// -//***// -void WNT_Window :: SetPos ( - const Standard_Integer X, const Standard_Integer Y, - const Standard_Integer X1, const Standard_Integer Y1 - ) { - - aXLeft = X; - aYTop = Y; - aXRight = X1; - aYBottom = Y1; - -} // end WNT_Window :: SetPos - -//***// -//**************************** SetFlags **********************************// -//***// -void WNT_Window :: SetFlags ( const Standard_Integer aFlags ) { - - myExtraData.dwFlags |= aFlags; - -} // end WNT_Window :: SetFlags - -//***// -//*************************** ResetFlags *********************************// -//***// -void WNT_Window :: ResetFlags ( const Standard_Integer aFlags ) { - - myExtraData.dwFlags &= ~aFlags; - -} // end WNT_Window :: ResetFlags - -//***// -//*************************** doCreate **********************************// -//***// -void WNT_Window :: doCreate ( - const Aspect_Handle aHandle, - const Quantity_NameOfColor aBackColor - ) +// ======================================================================= +// function : Ratio +// purpose : +// ======================================================================= +Quantity_Ratio WNT_Window::Ratio() const { - ZeroMemory (&myExtraData, sizeof (WNT_WindowData)); - - myHWindow = aHandle; - myHParentWindow = GetParent ((HWND )aHandle); - LONG_PTR uData = GetWindowLongPtr ((HWND )aHandle, GWLP_USERDATA); - myUsrData = Standard_Address(-1); + RECT r; + GetClientRect ((HWND )myHWindow, &r); + return (Quantity_Ratio )((Quantity_Ratio )r.right / (Quantity_Ratio )r.bottom); +} - SetBackground (aBackColor); +// ======================================================================= +// function : Position +// purpose : +// ======================================================================= +void WNT_Window::Position (Standard_Integer& theX1, Standard_Integer& theY1, + Standard_Integer& theX2, Standard_Integer& theY2) const +{ + RECT aRect; + ::GetClientRect ((HWND )myHWindow, &aRect); - myExtraData.WNT_Window_Ptr = (void* )this; + POINT aPntLeft, aPntRight; + aPntLeft.x = aPntLeft.y = 0; + ::ClientToScreen ((HWND )myHWindow, &aPntLeft); + aPntRight.x = aRect.right; + aPntRight.y = aRect.bottom; + ::ClientToScreen ((HWND )myHWindow, &aPntRight); - if (uData != (LONG_PTR )&myExtraData) + if (myHParentWindow != NULL) { - myUsrData = (Standard_Address )SetWindowLongPtr ((HWND )myHWindow, GWLP_USERDATA, (LONG_PTR )&myExtraData); + ::ScreenToClient ((HWND )myHParentWindow, &aPntLeft); + ::ScreenToClient ((HWND )myHParentWindow, &aPntRight); } - myExtraData.dwFlags = WDF_FOREIGN; + theX1 = aPntLeft.x; + theX2 = aPntRight.x; + theY1 = aPntLeft.y; + theY2 = aPntRight.y; +} - WINDOWPLACEMENT wp; - wp.length = sizeof (WINDOWPLACEMENT); - GetWindowPlacement ((HWND )myHWindow, &wp); +// ======================================================================= +// function : Size +// purpose : +// ======================================================================= +void WNT_Window::Size (Standard_Integer& theWidth, + Standard_Integer& theHeight) const +{ + RECT aRect; + ::GetClientRect ((HWND )myHWindow, &aRect); + theWidth = aRect.right; + theHeight = aRect.bottom; +} - aXLeft = wp.rcNormalPosition.left; - aYTop = wp.rcNormalPosition.top; - aXRight = wp.rcNormalPosition.right; - aYBottom = wp.rcNormalPosition.bottom; -} // end WNT_Window :: doCreate +// ======================================================================= +// function : SetPos +// purpose : +// ======================================================================= +void WNT_Window::SetPos (const Standard_Integer theX, const Standard_Integer theY, + const Standard_Integer theX1, const Standard_Integer theY1) +{ + aXLeft = theX; + aYTop = theY; + aXRight = theX1; + aYBottom = theY1; +} diff --git a/src/WNT/WNT_Window.lxx b/src/WNT/WNT_Window.lxx index 4a1cc2c05b..8bd80f5337 100644 --- a/src/WNT/WNT_Window.lxx +++ b/src/WNT/WNT_Window.lxx @@ -12,17 +12,18 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -// GG RIC120302 Add a NEW HParentWindow method which enable -// to retrieve the parent of the actual Hwindow handle. +inline Standard_Boolean WNT_Window::DoMapping() const +{ + // DO nothing on WNT + return Standard_True; +} -inline Aspect_Handle WNT_Window :: HWindow () const { +inline Aspect_Handle WNT_Window::HWindow() const +{ + return myHWindow; +} - return myHWindow; - -} // end WNT_Window :: HWindow - -inline Aspect_Handle WNT_Window :: HParentWindow () const { - - return myHParentWindow; - -} // end WNT_Window :: HWindow +inline Aspect_Handle WNT_Window::HParentWindow() const +{ + return myHParentWindow; +} diff --git a/src/WNT/WNT_WindowData.hxx b/src/WNT/WNT_WindowData.hxx deleted file mode 100644 index 87540ff4f3..0000000000 --- a/src/WNT/WNT_WindowData.hxx +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) 1996-1999 Matra Datavision -// Copyright (c) 1999-2014 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#ifndef __WNT_WindowData_HeaderFile -# define __WNT_WindowData_HeaderFile - -// Purpose: Defines additional window data type. - -# ifndef __WINDOWS_H_INCLUDED -# define __WINDOWS_H_INCLUDED -# ifndef STRICT -# define STRICT -# endif // STRICT -# include -# include - -# ifdef DrawText -# undef DrawText -# endif // DrawText - -# ifdef THIS -# undef THIS -# endif // THIS -# endif // __WINDOWS_H_INCLUDED - -# ifndef __STANDARD_TYPE_HXX_INCLUDED -# define __STANDARD_TYPE_HXX_INCLUDED -# include -# endif // __STANDARD_TYPE_HXX_INCLUDED - -#include - -typedef WINDOW_DATA WNT_WindowData; - -#endif // __WNT_WindowData_HeaderFile diff --git a/tests/offset/wire_closed_inside_0_025/D1 b/tests/offset/wire_closed_inside_0_025/D1 index 896567b52d..e17fa7b69a 100644 --- a/tests/offset/wire_closed_inside_0_025/D1 +++ b/tests/offset/wire_closed_inside_0_025/D1 @@ -2,8 +2,8 @@ cpulimit 2400 puts "TODO ?OCC23068 ALL: Error : result is not a topological shape" puts "TODO ?OCC23068 ALL: Error : The offset cannot be built." puts "TODO ?OCC23748 ALL: Error: Offset is not done." -puts "TODO DEBUG_OCC24121 Debian60-64: Process killed by CPU limit" -puts "TODO DEBUG_OCC24121 Debian60-64: TEST INCOMPLETE" +puts "TODO ?DEBUG_OCC24121 Debian60-64: Process killed by CPU limit" +puts "TODO ?DEBUG_OCC24121 Debian60-64: TEST INCOMPLETE" restore [locate_data_file offset_wire_041.brep] s -- 2.39.5