mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-03 17:56:21 +03:00
0023712: Remove dependency on Aspect_GraphicDevice from Aspect_Window
This commit is contained in:
parent
8db070a59d
commit
dc3fe572ec
@ -4,7 +4,7 @@
|
||||
#pragma warning( disable : 4800 )
|
||||
OCCViewer::OCCViewer(void)
|
||||
{
|
||||
myGraphicDevice=NULL;
|
||||
myGraphicDriver=NULL;
|
||||
myViewer=NULL;
|
||||
myView=NULL;
|
||||
myAISContext=NULL;
|
||||
@ -17,22 +17,27 @@ OCCViewer::~OCCViewer(void)
|
||||
|
||||
bool OCCViewer::InitViewer(void* wnd)
|
||||
{
|
||||
try {
|
||||
myGraphicDevice = new Graphic3d_WNTGraphicDevice();
|
||||
} catch (Standard_Failure) {
|
||||
return false;
|
||||
}
|
||||
TCollection_ExtendedString a3DName("Visu3D");
|
||||
myViewer = new V3d_Viewer( myGraphicDevice, a3DName.ToExtString(),"", 1000.0,
|
||||
V3d_XposYnegZpos, Quantity_NOC_GRAY30,
|
||||
V3d_ZBUFFER,V3d_GOURAUD,V3d_WAIT,
|
||||
Standard_True, Standard_False);
|
||||
try
|
||||
{
|
||||
Handle(Aspect_DisplayConnection) aDisplayConnection;
|
||||
myGraphicDriver = Graphic3d::InitGraphicDriver (aDisplayConnection);
|
||||
}
|
||||
catch (Standard_Failure)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
TCollection_ExtendedString a3DName("Visu3D");
|
||||
myViewer = new V3d_Viewer (myGraphicDriver, a3DName.ToExtString(),"", 1000.0,
|
||||
V3d_XposYnegZpos, Quantity_NOC_GRAY30,
|
||||
V3d_ZBUFFER,V3d_GOURAUD,V3d_WAIT,
|
||||
Standard_True, Standard_False);
|
||||
|
||||
myViewer->Init();
|
||||
myViewer->SetDefaultLights();
|
||||
myViewer->SetLightOn();
|
||||
myView = myViewer->CreateView();
|
||||
Handle(WNT_Window) aWNTWindow = new WNT_Window(myGraphicDevice, reinterpret_cast<HWND> (wnd));
|
||||
Handle(WNT_Window) aWNTWindow = new WNT_Window (reinterpret_cast<HWND> (wnd));
|
||||
myView->SetWindow(aWNTWindow);
|
||||
if (!aWNTWindow->IsMapped())
|
||||
aWNTWindow->Map();
|
||||
@ -543,9 +548,12 @@ void OCCViewer::CreateNewView(void* wnd)
|
||||
if (myAISContext.IsNull())
|
||||
return;
|
||||
myView = myAISContext->CurrentViewer()->CreateView();
|
||||
if (myGraphicDevice.IsNull())
|
||||
myGraphicDevice = new Graphic3d_WNTGraphicDevice();
|
||||
Handle(WNT_Window) aWNTWindow = new WNT_Window(myGraphicDevice, reinterpret_cast<HWND> (wnd));
|
||||
if (myGraphicDriver.IsNull())
|
||||
{
|
||||
Handle(Aspect_DisplayConnection) aDisplayConnection;
|
||||
myGraphicDriver = Graphic3d::InitGraphicDriver (aDisplayConnection);
|
||||
}
|
||||
Handle(WNT_Window) aWNTWindow = new WNT_Window (reinterpret_cast<HWND> (wnd));
|
||||
myView->SetWindow(aWNTWindow);
|
||||
Standard_Integer w=100, h=100;
|
||||
aWNTWindow->Size(w,h);
|
||||
|
@ -11,7 +11,7 @@ private:
|
||||
Handle_V3d_Viewer myViewer;
|
||||
Handle_V3d_View myView;
|
||||
Handle_AIS_InteractiveContext myAISContext;
|
||||
Handle_Graphic3d_WNTGraphicDevice myGraphicDevice;
|
||||
Handle_Graphic3d_GraphicDriver myGraphicDriver;
|
||||
public:
|
||||
__declspec(dllexport) bool InitViewer(void* wnd);
|
||||
__declspec(dllexport) bool ImportBRep(char* filename);
|
||||
|
@ -23,9 +23,11 @@
|
||||
#include <PTColStd_PersistentTransientMap.hxx>
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
//for OCC graphic
|
||||
#include <Aspect_DisplayConnection.hxx>
|
||||
#include <WNT_Window.hxx>
|
||||
#include <Graphic3d_WNTGraphicDevice.hxx>
|
||||
#include <Quantity_NameOfColor.hxx>
|
||||
#include <Graphic3d.hxx>
|
||||
#include <Graphic3d_GraphicDriver.hxx>
|
||||
#include <Graphic3d_NameOfMaterial.hxx>
|
||||
//for object display
|
||||
#include <V3d_Viewer.hxx>
|
||||
|
@ -28,7 +28,6 @@
|
||||
|
||||
#include <AIS_InteractiveContext.hxx>
|
||||
#include <AIS_Shape.hxx>
|
||||
#include <Graphic3d_WNTGraphicDevice.hxx>
|
||||
#include <V3d_Viewer.hxx>
|
||||
#include <V3d_View.hxx>
|
||||
#include <WNT_Window.hxx>
|
||||
|
@ -27,7 +27,6 @@
|
||||
#include <Standard.hxx>
|
||||
#include <AIS_InteractiveContext.hxx>
|
||||
#include <AIS_Shape.hxx>
|
||||
#include <Graphic3d_WNTGraphicDevice.hxx>
|
||||
#include <V3d_Viewer.hxx>
|
||||
#include <V3d_View.hxx>
|
||||
#include <WNT_Window.hxx>
|
||||
|
@ -126,8 +126,7 @@ CViewer3dView::CViewer3dView()
|
||||
myDegenerateModeIsOn=Standard_True;
|
||||
m_Pen = NULL;
|
||||
NbActiveLights=2; // There are 2 default active lights
|
||||
myGraphicDriver = Handle(Graphic3d_GraphicDriver)::DownCast(
|
||||
((CViewer3dApp*)AfxGetApp())->GetGraphicDevice()->GraphicDriver() );
|
||||
myGraphicDriver = ((CViewer3dApp*)AfxGetApp())->GetGraphicDriver();
|
||||
}
|
||||
|
||||
CViewer3dView::~CViewer3dView()
|
||||
@ -158,11 +157,7 @@ void CViewer3dView::OnInitialUpdate()
|
||||
// store for restore state after rotation (witch is in Degenerated mode)
|
||||
myDegenerateModeIsOn = Standard_True;
|
||||
|
||||
|
||||
Handle(Graphic3d_WNTGraphicDevice) theGraphicDevice =
|
||||
((CViewer3dApp*)AfxGetApp())->GetGraphicDevice();
|
||||
|
||||
Handle(WNT_Window) aWNTWindow = new WNT_Window(theGraphicDevice,GetSafeHwnd ());
|
||||
Handle(WNT_Window) aWNTWindow = new WNT_Window(GetSafeHwnd ());
|
||||
myView->SetWindow(aWNTWindow);
|
||||
if (!aWNTWindow->IsMapped()) aWNTWindow->Map();
|
||||
|
||||
|
@ -88,14 +88,12 @@
|
||||
#include <gp_Pnt2d.hxx>
|
||||
#include <gp_Vec.hxx>
|
||||
#include <gp_Vec2d.hxx>
|
||||
#include <Graphic3d_WNTGraphicDevice.hxx>
|
||||
#include <MMgt_TShared.hxx>
|
||||
#include <OSD_Environment.hxx>
|
||||
#include <Precision.hxx>
|
||||
#include <Prs3d_IsoAspect.hxx>
|
||||
#include <Prs3d_LineAspect.hxx>
|
||||
#include <Prs3d_Text.hxx>
|
||||
#include <PrsMgr_PresentationManager2d.hxx>
|
||||
#include <Quantity_Factor.hxx>
|
||||
#include <Quantity_Length.hxx>
|
||||
#include <Quantity_NameOfColor.hxx>
|
||||
@ -121,9 +119,6 @@
|
||||
#include <StdPrs_Curve.hxx>
|
||||
#include <StdPrs_Point.hxx>
|
||||
#include <StdPrs_PoleCurve.hxx>
|
||||
#include <StdSelect_SensitiveText2d.hxx>
|
||||
#include <StdSelect_TextProjector2d.hxx>
|
||||
#include <StdSelect_ViewerSelector2d.hxx>
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
#include <TColgp_Array1OfPnt2d.hxx>
|
||||
#include <TColgp_HArray1OfPnt2d.hxx>
|
||||
@ -145,7 +140,6 @@
|
||||
#include <UnitsAPI.hxx>
|
||||
#include <V3d_View.hxx>
|
||||
#include <V3d_Viewer.hxx>
|
||||
#include <WNT_WDriver.hxx>
|
||||
#include <WNT_Window.hxx>
|
||||
|
||||
// specific STEP
|
||||
|
@ -92,7 +92,6 @@
|
||||
#include <gp_Vec.hxx>
|
||||
#include <gp_Vec2d.hxx>
|
||||
#include <Graphic3d_NameOfMaterial.hxx>
|
||||
#include <Graphic3d_WNTGraphicDevice.hxx>
|
||||
#include <MMgt_TShared.hxx>
|
||||
#include <OSD_Environment.hxx>
|
||||
#include <Precision.hxx>
|
||||
@ -100,7 +99,6 @@
|
||||
#include <Prs3d_LineAspect.hxx>
|
||||
#include <Prs3d_Projector.hxx>
|
||||
#include <Prs3d_Text.hxx>
|
||||
#include <PrsMgr_PresentationManager2d.hxx>
|
||||
#include <Quantity_Factor.hxx>
|
||||
#include <Quantity_Length.hxx>
|
||||
#include <Quantity_NameOfColor.hxx>
|
||||
@ -126,9 +124,6 @@
|
||||
#include <StdPrs_Curve.hxx>
|
||||
#include <StdPrs_Point.hxx>
|
||||
#include <StdPrs_PoleCurve.hxx>
|
||||
#include <StdSelect_SensitiveText2d.hxx>
|
||||
#include <StdSelect_TextProjector2d.hxx>
|
||||
#include <StdSelect_ViewerSelector2d.hxx>
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
#include <TColgp_Array1OfPnt2d.hxx>
|
||||
#include <TColgp_HArray1OfPnt2d.hxx>
|
||||
@ -149,7 +144,6 @@
|
||||
#include <UnitsAPI.hxx>
|
||||
#include <V3d_View.hxx>
|
||||
#include <V3d_Viewer.hxx>
|
||||
#include <WNT_WDriver.hxx>
|
||||
#include <WNT_Window.hxx>
|
||||
#include <BRepPrimAPI_MakeBox.hxx>
|
||||
#include <BRepPrimAPI_MakeCylinder.hxx>
|
||||
|
@ -78,7 +78,6 @@
|
||||
|
||||
#include <AIS_InteractiveContext.hxx>
|
||||
#include <AIS_Shape.hxx>
|
||||
#include <Graphic3d_WNTGraphicDevice.hxx>
|
||||
#include <V3d_Viewer.hxx>
|
||||
#include <V3d_View.hxx>
|
||||
#include <WNT_Window.hxx>
|
||||
|
@ -49,11 +49,11 @@ CAnimationDoc::CAnimationDoc()
|
||||
StaticCount++;
|
||||
myCount = StaticCount;
|
||||
|
||||
Handle(Graphic3d_WNTGraphicDevice) theGraphicDevice =
|
||||
((CAnimationApp*)AfxGetApp())->GetGraphicDevice();
|
||||
Handle(Graphic3d_GraphicDriver) aGraphicDriver =
|
||||
((CAnimationApp*)AfxGetApp())->GetGraphicDriver();
|
||||
|
||||
TCollection_ExtendedString a3DName("Visu3D");
|
||||
myViewer = new V3d_Viewer(theGraphicDevice,a3DName.ToExtString(),"", 1000.0,
|
||||
myViewer = new V3d_Viewer(aGraphicDriver,a3DName.ToExtString(),"", 1000.0,
|
||||
V3d_XposYnegZpos, Quantity_NOC_GRAY30,
|
||||
V3d_ZBUFFER,V3d_GOURAUD,V3d_WAIT,
|
||||
Standard_True, Standard_False);
|
||||
@ -86,7 +86,7 @@ CAnimationDoc::CAnimationDoc()
|
||||
TCHAR tchBuf[80];
|
||||
|
||||
CString CASROOTValue = ((GetEnvironmentVariable("CASROOT", tchBuf, 80) > 0) ? tchBuf : NULL);
|
||||
aString = (CASROOTValue + "\\..\\data\\occ");
|
||||
aString = (CASROOTValue + "\\data\\occ");
|
||||
|
||||
char DataDirPath[200];
|
||||
strcpy_s(DataDirPath, aString);
|
||||
|
@ -152,10 +152,7 @@ void CAnimationView3D::OnInitialUpdate()
|
||||
// store for restore state after rotation (witch is in Degenerated mode)
|
||||
myDegenerateModeIsOn = myView->DegenerateModeIsOn();
|
||||
|
||||
Handle(Graphic3d_WNTGraphicDevice) theGraphicDevice =
|
||||
((CAnimationApp*)AfxGetApp())->GetGraphicDevice();
|
||||
|
||||
Handle(WNT_Window) aWNTWindow = new WNT_Window(theGraphicDevice,GetSafeHwnd ());
|
||||
Handle(WNT_Window) aWNTWindow = new WNT_Window(GetSafeHwnd ());
|
||||
myView->SetWindow(aWNTWindow);
|
||||
if (!aWNTWindow->IsMapped()) aWNTWindow->Map();
|
||||
|
||||
|
@ -154,36 +154,18 @@ enum CurrentAction3d {
|
||||
#include <gp_Pnt2d.hxx>
|
||||
#include <gp_Vec.hxx>
|
||||
#include <gp_Vec2d.hxx>
|
||||
#include <Graphic2d_Array1OfVertex.hxx>
|
||||
#include <Graphic2d_Buffer.hxx>
|
||||
#include <Graphic2d_CircleMarker.hxx>
|
||||
#include <Graphic2d_DisplayList.hxx>
|
||||
#include <Graphic2d_Drawer.hxx>
|
||||
#include <Graphic2d_PolyLine.hxx>
|
||||
#include <Graphic2d_Segment.hxx>
|
||||
#include <Graphic2d_SetOfCurves.hxx>
|
||||
#include <Graphic2d_SetOfSegments.hxx>
|
||||
#include <Graphic2d_Text.hxx>
|
||||
#include <Graphic2d_Vertex.hxx>
|
||||
#include <Graphic2d_View.hxx>
|
||||
#include <Graphic3d_WNTGraphicDevice.hxx>
|
||||
#include <MMgt_TShared.hxx>
|
||||
#include <OSD_Environment.hxx>
|
||||
#include <Precision.hxx>
|
||||
#include <Prs3d_IsoAspect.hxx>
|
||||
#include <Prs3d_LineAspect.hxx>
|
||||
#include <Prs3d_Text.hxx>
|
||||
#include <PrsMgr_PresentationManager2d.hxx>
|
||||
#include <Quantity_Factor.hxx>
|
||||
#include <Quantity_Length.hxx>
|
||||
#include <Quantity_NameOfColor.hxx>
|
||||
#include <Quantity_PhysicalQuantity.hxx>
|
||||
#include <Quantity_PlaneAngle.hxx>
|
||||
#include <Quantity_TypeOfColor.hxx>
|
||||
#include <Select2D_SensitiveArc.hxx>
|
||||
#include <Select2D_SensitiveBox.hxx>
|
||||
#include <Select2D_SensitiveEntity.hxx>
|
||||
#include <Select2D_SensitiveSegment.hxx>
|
||||
#include <SelectBasics_BasicTool.hxx>
|
||||
#include <SelectBasics_ListOfBox2d.hxx>
|
||||
#include <SelectMgr_EntityOwner.hxx>
|
||||
@ -207,9 +189,6 @@ enum CurrentAction3d {
|
||||
#include <StdPrs_Curve.hxx>
|
||||
#include <StdPrs_Point.hxx>
|
||||
#include <StdPrs_PoleCurve.hxx>
|
||||
#include <StdSelect_SensitiveText2d.hxx>
|
||||
#include <StdSelect_TextProjector2d.hxx>
|
||||
#include <StdSelect_ViewerSelector2d.hxx>
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
#include <TColgp_Array1OfPnt2d.hxx>
|
||||
#include <TColgp_HArray1OfPnt2d.hxx>
|
||||
@ -225,11 +204,8 @@ enum CurrentAction3d {
|
||||
#include <TopoDS_Solid.hxx>
|
||||
#include <TopTools_HSequenceOfShape.hxx>
|
||||
#include <UnitsAPI.hxx>
|
||||
#include <V2d_View.hxx>
|
||||
#include <V2d_Viewer.hxx>
|
||||
#include <V3d_View.hxx>
|
||||
#include <V3d_Viewer.hxx>
|
||||
#include <WNT_WDriver.hxx>
|
||||
#include <WNT_Window.hxx>
|
||||
#include "HLRAlgo_Projector.hxx"
|
||||
#include "Aspect_MarkMap.hxx"
|
||||
|
@ -33,7 +33,8 @@ COCCDemoApp::COCCDemoApp()
|
||||
SampleName = "";
|
||||
try
|
||||
{
|
||||
myGraphicDevice = new Graphic3d_WNTGraphicDevice;
|
||||
Handle(Aspect_DisplayConnection) aDisplayConnection;
|
||||
myGraphicDriver = Graphic3d::InitGraphicDriver (aDisplayConnection);
|
||||
}
|
||||
catch(Standard_Failure)
|
||||
{
|
||||
|
@ -25,8 +25,8 @@ class COCCDemoApp : public OCC_BaseApp
|
||||
{
|
||||
public:
|
||||
COCCDemoApp();
|
||||
Handle(Graphic3d_WNTGraphicDevice) GetGraphicDevice() const
|
||||
{ return myGraphicDevice; } ;
|
||||
Handle(Graphic3d_GraphicDriver) GetGraphicDriver() const
|
||||
{ return myGraphicDriver; } ;
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
@ -44,7 +44,7 @@ public:
|
||||
DECLARE_MESSAGE_MAP()
|
||||
|
||||
private:
|
||||
Handle(Graphic3d_WNTGraphicDevice) myGraphicDevice;
|
||||
Handle(Graphic3d_GraphicDriver) myGraphicDriver;
|
||||
|
||||
};
|
||||
|
||||
|
@ -43,10 +43,10 @@ END_MESSAGE_MAP()
|
||||
COCCDemoDoc::COCCDemoDoc()
|
||||
{
|
||||
// TODO: add one-time construction code here
|
||||
Handle(Graphic3d_WNTGraphicDevice) theGraphicDevice =
|
||||
((COCCDemoApp*)AfxGetApp())->GetGraphicDevice();
|
||||
Handle(Graphic3d_GraphicDriver) aGraphicDriver =
|
||||
((COCCDemoApp*)AfxGetApp())->GetGraphicDriver();
|
||||
|
||||
myViewer = new V3d_Viewer(theGraphicDevice,(short *) "Visu3D");
|
||||
myViewer = new V3d_Viewer(aGraphicDriver,(short *) "Visu3D");
|
||||
myViewer->SetDefaultLights();
|
||||
myViewer->SetLightOn();
|
||||
myViewer->SetDefaultBackgroundColor(Quantity_TOC_RGB, 0.,0.,0.);
|
||||
|
@ -70,8 +70,7 @@ COCCDemoView::COCCDemoView()
|
||||
myCurrentMode = CurAction3d_Nothing;
|
||||
myVisMode = VIS_SHADE;
|
||||
m_Pen = NULL;
|
||||
myGraphicDriver = Handle(Graphic3d_GraphicDriver)::DownCast(
|
||||
((COCCDemoApp*)AfxGetApp())->GetGraphicDevice()->GraphicDriver() );
|
||||
myGraphicDriver = ((COCCDemoApp*)AfxGetApp())->GetGraphicDriver();
|
||||
}
|
||||
|
||||
COCCDemoView::~COCCDemoView()
|
||||
@ -99,10 +98,7 @@ void COCCDemoView::OnInitialUpdate()
|
||||
|
||||
myView = GetDocument()->GetViewer()->CreateView();
|
||||
|
||||
Handle(Graphic3d_WNTGraphicDevice) theGraphicDevice =
|
||||
((COCCDemoApp*)AfxGetApp())->GetGraphicDevice();
|
||||
|
||||
Handle(WNT_Window) aWNTWindow = new WNT_Window(theGraphicDevice,GetSafeHwnd ());
|
||||
Handle(WNT_Window) aWNTWindow = new WNT_Window(GetSafeHwnd ());
|
||||
myView->SetWindow(aWNTWindow);
|
||||
if (!aWNTWindow->IsMapped()) aWNTWindow->Map();
|
||||
|
||||
|
@ -29,10 +29,11 @@
|
||||
|
||||
#include <Standard.hxx>
|
||||
|
||||
#include <Aspect_DisplayConnection.hxx>
|
||||
#include <AIS_InteractiveContext.hxx>
|
||||
#include <AIS_Shape.hxx>
|
||||
#include <AIS_Point.hxx>
|
||||
#include <Graphic3d_WNTGraphicDevice.hxx>
|
||||
#include <Graphic3d.hxx>
|
||||
#include <V3d_Viewer.hxx>
|
||||
#include <V3d_View.hxx>
|
||||
#include <WNT_Window.hxx>
|
||||
|
@ -11,7 +11,7 @@
|
||||
|
||||
#include "OCC_BaseApp.h"
|
||||
#include <Standard_Macro.hxx>
|
||||
#include <Handle_Graphic3d_WNTGraphicDevice.hxx>
|
||||
#include <Handle_Graphic3d_GraphicDriver.hxx>
|
||||
|
||||
class Standard_EXPORT OCC_3dApp : public OCC_BaseApp
|
||||
{
|
||||
@ -19,10 +19,10 @@ public:
|
||||
OCC_3dApp();
|
||||
virtual ~OCC_3dApp();
|
||||
|
||||
Handle_Graphic3d_WNTGraphicDevice GetGraphicDevice() const { return myGraphicDevice; } ;
|
||||
Handle_Graphic3d_GraphicDriver GetGraphicDriver() const { return myGraphicDriver; } ;
|
||||
|
||||
protected :
|
||||
Handle_Graphic3d_WNTGraphicDevice myGraphicDevice;
|
||||
Handle_Graphic3d_GraphicDriver myGraphicDriver;
|
||||
};
|
||||
|
||||
#endif // !defined(AFX_OCC_3DAPP_H__FC7278BF_390D_11D7_8611_0060B0EE281E__INCLUDED_)
|
||||
|
@ -9,13 +9,10 @@
|
||||
#include <Quantity_Factor.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <Standard_CString.hxx>
|
||||
#include <Handle_PrsMgr_PresentationManager2d.hxx>
|
||||
#include <Handle_Graphic2d_GraphicObject.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <Handle_SelectMgr_Selection.hxx>
|
||||
#include <Standard_OStream.hxx>
|
||||
#include <Standard_IStream.hxx>
|
||||
#include <AIS2D_InteractiveObject.hxx>
|
||||
|
||||
DEFINE_STANDARD_HANDLE(Sample2D_Image,AIS2D_InteractiveObject)
|
||||
class Sample2D_Image : public AIS2D_InteractiveObject {
|
||||
|
@ -24,27 +24,13 @@
|
||||
#include "Standard_ShortReal.hxx"
|
||||
#pragma warning( default : 4244 ) // Issue warning 4244
|
||||
|
||||
#include <V2d_Viewer.hxx>
|
||||
#include <V2d_View.hxx>
|
||||
#include <AIS2D_InteractiveContext.hxx>
|
||||
#include <WNT_WDriver.hxx>
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <AIS_InteractiveContext.hxx>
|
||||
#include <AIS_Shape.hxx>
|
||||
#include <Graphic3d_WNTGraphicDevice.hxx>
|
||||
#include <V3d_Viewer.hxx>
|
||||
#include <V3d_View.hxx>
|
||||
#include <WNT_Window.hxx>
|
||||
|
||||
#include <AIS2D_InteractiveObject.hxx>
|
||||
#include <Graphic2d_SetOfCurves.hxx>
|
||||
#include <Geom2d_TrimmedCurve.hxx>
|
||||
#include <Prs2d_AspectLine.hxx>
|
||||
#include <Graphic2d_Array1OfVertex.hxx>
|
||||
#include <Graphic2d_Polyline.hxx>
|
||||
#include <Graphic2d_Text.hxx>
|
||||
|
||||
#include <Prs3d_Drawer.hxx>
|
||||
#include <Prs3d_IsoAspect.hxx>
|
||||
#include <Prs3d_ShadingAspect.hxx>
|
||||
|
@ -9,14 +9,12 @@
|
||||
#include <QColor>
|
||||
#include <QColorDialog>
|
||||
|
||||
#ifndef WNT
|
||||
#include <Graphic3d_GraphicDevice.hxx>
|
||||
#else
|
||||
#include <Graphic3d_WNTGraphicDevice.hxx>
|
||||
#endif
|
||||
|
||||
#include <Aspect_DisplayConnection.hxx>
|
||||
#include <AIS_InteractiveObject.hxx>
|
||||
#include <Graphic3d.hxx>
|
||||
#include <Graphic3d_NameOfMaterial.hxx>
|
||||
#include <Graphic3d_GraphicDriver.hxx>
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
|
||||
Handle(V3d_Viewer) DocumentCommon::Viewer( const Standard_CString aDisplay,
|
||||
const Standard_ExtString aName,
|
||||
@ -26,21 +24,20 @@ Handle(V3d_Viewer) DocumentCommon::Viewer( const Standard_CString aDisplay,
|
||||
const Standard_Boolean ComputedMode,
|
||||
const Standard_Boolean aDefaultComputedMode )
|
||||
{
|
||||
#ifndef WNT
|
||||
static Handle(Graphic3d_GraphicDevice) defaultdevice;
|
||||
if( defaultdevice.IsNull() )
|
||||
defaultdevice = new Graphic3d_GraphicDevice( aDisplay );
|
||||
return new V3d_Viewer(defaultdevice,aName,aDomain,ViewSize,ViewProj,
|
||||
Quantity_NOC_GRAY30,V3d_ZBUFFER,V3d_GOURAUD,V3d_WAIT,
|
||||
ComputedMode,aDefaultComputedMode,V3d_TEX_NONE);
|
||||
#else
|
||||
static Handle(Graphic3d_WNTGraphicDevice) defaultdevice;
|
||||
if( defaultdevice.IsNull() )
|
||||
defaultdevice = new Graphic3d_WNTGraphicDevice();
|
||||
return new V3d_Viewer(defaultdevice,aName,aDomain,ViewSize,ViewProj,
|
||||
Quantity_NOC_GRAY30,V3d_ZBUFFER,V3d_GOURAUD,V3d_WAIT,
|
||||
ComputedMode,aDefaultComputedMode,V3d_TEX_NONE);
|
||||
static Handle(Graphic3d_GraphicDriver) aGraphicDriver;
|
||||
|
||||
if (aGraphicDriver.IsNull())
|
||||
{
|
||||
Handle(Aspect_DisplayConnection) aDisplayConnection;
|
||||
#if !defined(_WIN32) && !defined(__WIN32__) && (!defined(__APPLE__) || defined(MACOSX_USE_GLX))
|
||||
aDisplayConnection = new Aspect_DisplayConnection (aDisplay);
|
||||
#endif
|
||||
aGraphicDriver = Graphic3d::InitGraphicDriver (aDisplayConnection);
|
||||
}
|
||||
|
||||
return new V3d_Viewer(aGraphicDriver,aName,aDomain,ViewSize,ViewProj,
|
||||
Quantity_NOC_GRAY30,V3d_ZBUFFER,V3d_GOURAUD,V3d_WAIT,
|
||||
ComputedMode,aDefaultComputedMode,V3d_TEX_NONE);
|
||||
}
|
||||
|
||||
DocumentCommon::DocumentCommon( const int theIndex, ApplicationCommonWindow* app )
|
||||
|
@ -16,11 +16,11 @@
|
||||
|
||||
#include <Visual3d_View.hxx>
|
||||
#include <Graphic3d_ExportFormat.hxx>
|
||||
#include <Graphic3d_GraphicDriver.hxx>
|
||||
#include <QWindowsStyle>
|
||||
|
||||
#if defined(_WIN32) || defined(__WIN32__)
|
||||
#include <WNT_Window.hxx>
|
||||
#include <Graphic3d_WNTGraphicDevice.hxx>
|
||||
#elif defined(__APPLE__) && !defined(MACOSX_USE_GLX)
|
||||
#include <Cocoa_Window.hxx>
|
||||
#else
|
||||
@ -31,10 +31,11 @@
|
||||
#include <X11/Xmu/StdCmap.h>
|
||||
#include <X11/Xlib.h>
|
||||
#include <Xw_Window.hxx>
|
||||
#include <Graphic3d_GraphicDevice.hxx>
|
||||
#include <QColormap>
|
||||
#endif
|
||||
|
||||
#include <Aspect_DisplayConnection.hxx>
|
||||
|
||||
// the key for multi selection :
|
||||
#define MULTISELECTIONKEY Qt::ShiftModifier
|
||||
|
||||
@ -167,16 +168,14 @@ void View::init()
|
||||
myView = myContext->CurrentViewer()->CreateView();
|
||||
#if defined(_WIN32) || defined(__WIN32__)
|
||||
Aspect_Handle aWindowHandle = (Aspect_Handle )winId();
|
||||
Handle(WNT_Window) hWnd = new WNT_Window (Handle(Graphic3d_WNTGraphicDevice)::DownCast (myContext->CurrentViewer()->Device()),
|
||||
aWindowHandle);
|
||||
Handle(WNT_Window) hWnd = new WNT_Window (aWindowHandle);
|
||||
#elif defined(__APPLE__) && !defined(MACOSX_USE_GLX)
|
||||
NSView* aViewHandle = (NSView* )winId();
|
||||
Handle(Cocoa_Window) hWnd = new Cocoa_Window (aViewHandle);
|
||||
#else
|
||||
Aspect_Handle aWindowHandle = (Aspect_Handle )winId();
|
||||
Handle(Xw_Window) hWnd = new Xw_Window (Handle(Graphic3d_GraphicDevice)::DownCast (myContext->CurrentViewer()->Device()),
|
||||
aWindowHandle,
|
||||
Xw_WQ_SAMEQUALITY);
|
||||
Handle(Aspect_DisplayConnection) aDispConnection = myContext->CurrentViewer()->Driver()->GetDisplayConnection();
|
||||
Handle(Xw_Window) hWnd = new Xw_Window (aDispConnection, aWindowHandle);
|
||||
#endif // WNT
|
||||
myView->SetWindow (hWnd);
|
||||
if (!hWnd->IsMapped())
|
||||
|
@ -1,5 +1,7 @@
|
||||
@ECHO OFF
|
||||
|
||||
call ../../../env.bat %1 %2 %3
|
||||
|
||||
IF NOT DEFINED CASROOT GOTO ERR_CASROOT
|
||||
|
||||
IF NOT EXIST "%CASROOT%\win32\bin\TKernel.dll" GOTO ERR_CASCADE
|
||||
|
@ -35,6 +35,7 @@ unix {
|
||||
|
||||
!macx | equals(MACOSX_USE_GLX, true): INCLUDEPATH += $$QMAKE_INCDIR_X11 $$QMAKE_INCDIR_OPENGL $$QMAKE_INCDIR_THREAD
|
||||
!macx | equals(MACOSX_USE_GLX, true): DEFINES += LIN LININTEL
|
||||
equals(MACOSX_USE_GLX, true): DEFINES += MACOSX_USE_GLX
|
||||
DEFINES += OCC_CONVERT_SIGNALS HAVE_CONFIG_H HAVE_WOK_CONFIG_H QT_NO_STL
|
||||
!macx | equals(MACOSX_USE_GLX, true): LIBS += -L$$QMAKE_LIBDIR_X11 $$QMAKE_LIBS_X11 -L$$QMAKE_LIBDIR_OPENGL $$QMAKE_LIBS_OPENGL $$QMAKE_LIBS_THREAD
|
||||
LIBS += -lfreeimageplus
|
||||
|
@ -4,6 +4,10 @@ export aSamplePath="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
if [ -e "${aSamplePath}/env.sh" ]; then source "${aSamplePath}/env.sh"; fi
|
||||
cd $aSamplePath
|
||||
qmake IESample.pro
|
||||
if test `uname -s` != "Darwin"; then
|
||||
make
|
||||
if [ "$(uname -s)" != "Darwin" ] || [ "$MACOSX_USE_GLX" == "true" ]; then
|
||||
if [ "${CASDEB}" == "d" ]; then
|
||||
make debug
|
||||
else
|
||||
make release
|
||||
fi
|
||||
fi
|
||||
|
@ -10,7 +10,7 @@ STATION=$host
|
||||
RES_DIR="${aSamplePath}/res"
|
||||
|
||||
aSystem=`uname -s`
|
||||
if [ "$aSystem" == "Darwin" ]; then
|
||||
if [ "$aSystem" == "Darwin" ] && [ "$MACOSX_USE_GLX" != "true" ]; then
|
||||
if [ "${CASDEB}" == "d" ]; then
|
||||
BIN_DIR="${aSamplePath}/build/Debug/IESample.app/Contents/MacOS"
|
||||
else
|
||||
@ -30,7 +30,7 @@ export PATH
|
||||
|
||||
if test ! -r "${BIN_DIR}/IESample"; then
|
||||
echo "Executable \"${BIN_DIR}/IESample\" not found."
|
||||
if [ "$aSystem" == "Darwin" ]; then
|
||||
if [ "$aSystem" == "Darwin" ] && [ "$MACOSX_USE_GLX" != "true" ]; then
|
||||
echo "Probably you don't compile the application. Build it with Xcode."
|
||||
else
|
||||
echo "Probably you don't compile the application. Execute \"make\"."
|
||||
|
@ -37,6 +37,7 @@ unix {
|
||||
|
||||
!macx | equals(MACOSX_USE_GLX, true): INCLUDEPATH += $$QMAKE_INCDIR_X11 $$QMAKE_INCDIR_OPENGL $$QMAKE_INCDIR_THREAD
|
||||
!macx | equals(MACOSX_USE_GLX, true): DEFINES += LIN LININTEL
|
||||
equals(MACOSX_USE_GLX, true): DEFINES += MACOSX_USE_GLX
|
||||
DEFINES += OCC_CONVERT_SIGNALS HAVE_CONFIG_H HAVE_WOK_CONFIG_H QT_NO_STL
|
||||
!macx | equals(MACOSX_USE_GLX, true): LIBS += -L$$QMAKE_LIBDIR_X11 $$QMAKE_LIBS_X11 -L$$QMAKE_LIBDIR_OPENGL $$QMAKE_LIBS_OPENGL $$QMAKE_LIBS_THREAD
|
||||
LIBS += -lfreeimageplus
|
||||
|
@ -4,6 +4,10 @@ export aSamplePath="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
if [ -e "${aSamplePath}/env.sh" ]; then source "${aSamplePath}/env.sh"; fi
|
||||
cd $aSamplePath
|
||||
qmake Tutorial.pro
|
||||
if test `uname -s` != "Darwin"; then
|
||||
make
|
||||
if [ "$(uname -s)" != "Darwin" ] || [ "$MACOSX_USE_GLX" == "true" ]; then
|
||||
if [ "${CASDEB}" == "d" ]; then
|
||||
make debug
|
||||
else
|
||||
make release
|
||||
fi
|
||||
fi
|
||||
|
@ -10,7 +10,7 @@ STATION=$host
|
||||
RES_DIR="${aSamplePath}/res"
|
||||
|
||||
aSystem=`uname -s`
|
||||
if [ "$aSystem" == "Darwin" ]; then
|
||||
if [ "$aSystem" == "Darwin" ] && [ "$MACOSX_USE_GLX" != "true" ]; then
|
||||
if [ "${CASDEB}" == "d" ]; then
|
||||
BIN_DIR="${aSamplePath}/build/Debug/Tutorial.app/Contents/MacOS"
|
||||
else
|
||||
@ -30,7 +30,7 @@ export PATH
|
||||
|
||||
if test ! -r "${BIN_DIR}/Tutorial"; then
|
||||
echo "Executable \"${BIN_DIR}/Tutorial\" not found."
|
||||
if [ "$aSystem" == "Darwin" ]; then
|
||||
if [ "$aSystem" == "Darwin" ] && [ "$MACOSX_USE_GLX" != "true" ]; then
|
||||
echo "Probably you don't compile the application. Build it with Xcode."
|
||||
else
|
||||
echo "Probably you don't compile the application. Execute \"make\"."
|
||||
|
@ -8,26 +8,29 @@
|
||||
#include <QMouseEvent>
|
||||
|
||||
#include <WNT_Window.hxx>
|
||||
#include <Graphic3d_WNTGraphicDevice.hxx>
|
||||
|
||||
#include <Voxel_Prs.hxx>
|
||||
#include <AIS_ListOfInteractive.hxx>
|
||||
#include <AIS_ListIteratorOfListOfInteractive.hxx>
|
||||
#include <Aspect_DisplayConnection.hxx>
|
||||
#include <Graphic3d.hxx>
|
||||
#include <Graphic3d_GraphicDriver.hxx>
|
||||
|
||||
static Handle(Graphic3d_WNTGraphicDevice) device;
|
||||
static Handle(Graphic3d_GraphicDriver) Viewer_aGraphicDriver;
|
||||
|
||||
Viewer::Viewer(QWidget* parent):QWidget(parent)
|
||||
{
|
||||
if(device.IsNull())
|
||||
if (myGraphicDriver.IsNull())
|
||||
{
|
||||
device = new Graphic3d_WNTGraphicDevice();
|
||||
if (!device->GraphicDriver().IsNull())
|
||||
{
|
||||
myGraphicDriver = Handle(OpenGl_GraphicDriver)::DownCast(device->GraphicDriver());
|
||||
}
|
||||
if (Viewer_aGraphicDriver.IsNull())
|
||||
{
|
||||
Handle(Aspect_DisplayConnection) aDisplayConnection;
|
||||
Viewer_aGraphicDriver = Graphic3d::InitGraphicDriver (aDisplayConnection);
|
||||
}
|
||||
myGraphicDriver = Handle(OpenGl_GraphicDriver)::DownCast(Viewer_aGraphicDriver);
|
||||
}
|
||||
|
||||
Handle(V3d_Viewer) aViewer = new V3d_Viewer(device, TCollection_ExtendedString("Visu3D").ToExtString(), "",
|
||||
|
||||
Handle(V3d_Viewer) aViewer = new V3d_Viewer(myGraphicDriver, TCollection_ExtendedString("Visu3D").ToExtString(), "",
|
||||
1000, V3d_XposYnegZpos,
|
||||
Quantity_NOC_GRAY30, V3d_ZBUFFER, V3d_GOURAUD, V3d_WAIT,
|
||||
true, true, V3d_TEX_NONE);
|
||||
@ -39,13 +42,8 @@ Viewer::Viewer(QWidget* parent):QWidget(parent)
|
||||
myIC = new AIS_InteractiveContext(aViewer);
|
||||
myIC->SetDeviationCoefficient(1.e-3);
|
||||
|
||||
int windowHandle = (int) winId();
|
||||
short hi, lo;
|
||||
|
||||
lo = (short) windowHandle;
|
||||
hi = (short) (windowHandle >> 16);
|
||||
Handle(WNT_Window) hWnd =
|
||||
new WNT_Window(Handle(Graphic3d_WNTGraphicDevice)::DownCast(aViewer->Device()), (int) hi, (int) lo);
|
||||
Aspect_Handle aWindowHandle = (Aspect_Handle )winId();
|
||||
Handle(WNT_Window) hWnd = new WNT_Window (aWindowHandle);
|
||||
|
||||
myView->SetWindow(hWnd);
|
||||
if(!hWnd->IsMapped())
|
||||
|
@ -17,6 +17,8 @@
|
||||
|
||||
#include "VoxelClient_VisDrawer.h"
|
||||
|
||||
#include <OpenGl_GlCore11.hxx>
|
||||
|
||||
#include <ElSLib.hxx>
|
||||
#include <gp_Dir.hxx>
|
||||
#include <Geom_Plane.hxx>
|
||||
@ -29,9 +31,7 @@
|
||||
#include <OpenGl_Element.hxx>
|
||||
#include <OpenGl_GraphicDriver.hxx>
|
||||
#include <OpenGl_NamedStatus.hxx>
|
||||
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glu.h>
|
||||
#include <OpenGl_Workspace.hxx>
|
||||
|
||||
/**************************************************************************/
|
||||
|
||||
|
@ -195,6 +195,9 @@ is
|
||||
exception GraphicDeviceDefinitionError inherits OutOfRange;
|
||||
---Category: The exceptions
|
||||
|
||||
exception DisplayConnectionDefinitionError inherits OutOfRange;
|
||||
---Category: The exceptions
|
||||
|
||||
exception LineStyleDefinitionError inherits OutOfRange;
|
||||
---Category: Exceptions
|
||||
|
||||
@ -348,11 +351,6 @@ is
|
||||
deferred class Window;
|
||||
---Purpose: Defines a window.
|
||||
---Category: Classes
|
||||
|
||||
deferred class GraphicDevice;
|
||||
---Purpose: Defines a physical graphic device allowing to
|
||||
-- shares graphical ressources.
|
||||
---Category: Classes
|
||||
|
||||
deferred class Driver;
|
||||
---Purpose: Defines a virtual driver.
|
||||
@ -369,6 +367,12 @@ is
|
||||
deferred class ColorScale;
|
||||
---Purpose: Defines a color scale for viewer.
|
||||
|
||||
imported DisplayConnection;
|
||||
---Purpose: Creates and provides connection with X server.
|
||||
|
||||
imported DisplayConnection_Handle;
|
||||
---Purpose: Handle for DisplayConnection;
|
||||
|
||||
-------------------------
|
||||
-- Category: Enumerations
|
||||
-------------------------
|
||||
|
98
src/Aspect/Aspect_DisplayConnection.cxx
Normal file
98
src/Aspect/Aspect_DisplayConnection.cxx
Normal file
@ -0,0 +1,98 @@
|
||||
// Copyright (c) 2013 OPEN CASCADE SAS
|
||||
//
|
||||
// The content of this file is subject to the Open CASCADE Technology Public
|
||||
// License Version 6.5 (the "License"). You may not use the content of this file
|
||||
// except in compliance with the License. Please obtain a copy of the License
|
||||
// at http://www.opencascade.org and read it completely before using this file.
|
||||
//
|
||||
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
|
||||
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
|
||||
//
|
||||
// The Original Code and all software distributed under the License is
|
||||
// distributed on an "AS IS" basis, without warranty of any kind, and the
|
||||
// Initial Developer hereby disclaims all such warranties, including without
|
||||
// limitation, any warranties of merchantability, fitness for a particular
|
||||
// purpose or non-infringement. Please see the License for the specific terms
|
||||
// and conditions governing the rights and limitations under the License.
|
||||
|
||||
#include <Aspect_DisplayConnection.hxx>
|
||||
|
||||
#include <Aspect_DisplayConnectionDefinitionError.hxx>
|
||||
#include <OSD_Environment.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_HANDLE (Aspect_DisplayConnection, Standard_Transient)
|
||||
IMPLEMENT_STANDARD_RTTIEXT(Aspect_DisplayConnection, Standard_Transient)
|
||||
|
||||
// =======================================================================
|
||||
// function : Aspect_DisplayConnection
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Aspect_DisplayConnection::Aspect_DisplayConnection()
|
||||
{
|
||||
#if !defined(_WIN32) && !defined(__WIN32__) && (!defined(__APPLE__) || defined(MACOSX_USE_GLX))
|
||||
OSD_Environment anEnv ("DISPLAY");
|
||||
myDisplayName = anEnv.Value();
|
||||
Init();
|
||||
#endif
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : ~Aspect_DisplayConnection
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Aspect_DisplayConnection::~Aspect_DisplayConnection()
|
||||
{
|
||||
#if !defined(_WIN32) && !defined(__WIN32__) && (!defined(__APPLE__) || defined(MACOSX_USE_GLX))
|
||||
if (myDisplay != NULL)
|
||||
{
|
||||
XCloseDisplay (myDisplay);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#if !defined(_WIN32) && !defined(__WIN32__) && (!defined(__APPLE__) || defined(MACOSX_USE_GLX))
|
||||
// =======================================================================
|
||||
// function : Aspect_DisplayConnection
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Aspect_DisplayConnection::Aspect_DisplayConnection (const TCollection_AsciiString& theDisplayName)
|
||||
{
|
||||
myDisplayName = theDisplayName;
|
||||
Init();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : GetDisplay
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Display* Aspect_DisplayConnection::GetDisplay()
|
||||
{
|
||||
return myDisplay;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : GetDisplayName
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
TCollection_AsciiString Aspect_DisplayConnection::GetDisplayName()
|
||||
{
|
||||
return myDisplayName;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : Init
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Aspect_DisplayConnection::Init()
|
||||
{
|
||||
myDisplay = XOpenDisplay (myDisplayName.ToCString());
|
||||
|
||||
if (myDisplay == NULL)
|
||||
{
|
||||
TCollection_AsciiString aMessage;
|
||||
aMessage += "Can not connect to the server \"";
|
||||
aMessage += myDisplayName + "\"";
|
||||
Aspect_DisplayConnectionDefinitionError::Raise (aMessage.ToCString());
|
||||
}
|
||||
}
|
||||
#endif
|
82
src/Aspect/Aspect_DisplayConnection.hxx
Normal file
82
src/Aspect/Aspect_DisplayConnection.hxx
Normal file
@ -0,0 +1,82 @@
|
||||
// Copyright (c) 2013 OPEN CASCADE SAS
|
||||
//
|
||||
// The content of this file is subject to the Open CASCADE Technology Public
|
||||
// License Version 6.5 (the "License"). You may not use the content of this file
|
||||
// except in compliance with the License. Please obtain a copy of the License
|
||||
// at http://www.opencascade.org and read it completely before using this file.
|
||||
//
|
||||
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
|
||||
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
|
||||
//
|
||||
// The Original Code and all software distributed under the License is
|
||||
// distributed on an "AS IS" basis, without warranty of any kind, and the
|
||||
// Initial Developer hereby disclaims all such warranties, including without
|
||||
// limitation, any warranties of merchantability, fitness for a particular
|
||||
// purpose or non-infringement. Please see the License for the specific terms
|
||||
// and conditions governing the rights and limitations under the License.
|
||||
|
||||
#ifndef _Aspect_DisplayConnection_H__
|
||||
#define _Aspect_DisplayConnection_H__
|
||||
|
||||
#include <Standard_Transient.hxx>
|
||||
#include <Aspect_DisplayConnection_Handle.hxx>
|
||||
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
|
||||
#if !defined(_WIN32) && !defined(__WIN32__) && (!defined(__APPLE__) || defined(MACOSX_USE_GLX))
|
||||
#include <X11/Xlib.h>
|
||||
#endif
|
||||
|
||||
//! This class creates and provides connection with X server.
|
||||
//! Raises exception if can not connect to X server.
|
||||
//! On Windows and Mac OS X (in case when Cocoa used) platforms this class do nothing.
|
||||
//! WARRNING: Do not close display connection manualy!
|
||||
|
||||
class Aspect_DisplayConnection : public Standard_Transient
|
||||
{
|
||||
public:
|
||||
|
||||
//! Default constructor. Creates connection with display name taken from "DISPLAY" environment variable
|
||||
Standard_EXPORT Aspect_DisplayConnection();
|
||||
|
||||
//! Destructor. Close opened connection.
|
||||
Standard_EXPORT ~Aspect_DisplayConnection();
|
||||
|
||||
#if !defined(_WIN32) && !defined(__WIN32__) && (!defined(__APPLE__) || defined(MACOSX_USE_GLX))
|
||||
//! Constructor. Creates connection with display specified in theDisplayName.
|
||||
//! Display name should be in format "hostname:number" or "hostname:number.screen_number", where:
|
||||
//! hostname - Specifies the name of the host machine on which the display is physically attached.
|
||||
//! number - Specifies the number of the display server on that host machine.
|
||||
//! screen_number - Specifies the screen to be used on that server. Optional variable.
|
||||
Aspect_DisplayConnection (const TCollection_AsciiString& theDisplayName);
|
||||
|
||||
//! @return pointer to Display structure that serves as the connection to the X server.
|
||||
Display* GetDisplay();
|
||||
|
||||
//! @return display name for this connection.
|
||||
TCollection_AsciiString GetDisplayName();
|
||||
|
||||
private:
|
||||
|
||||
//! Open connection with display specified in myDisplayName class field.
|
||||
void Init();
|
||||
|
||||
private:
|
||||
|
||||
Display* myDisplay;
|
||||
TCollection_AsciiString myDisplayName;
|
||||
#endif
|
||||
|
||||
private:
|
||||
|
||||
//! To protect the connection from closing copying allowed only through the handles.
|
||||
Aspect_DisplayConnection (const Aspect_DisplayConnection& );
|
||||
Aspect_DisplayConnection& operator= (const Aspect_DisplayConnection& );
|
||||
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_RTTI(Aspect_DisplayConnection) // Type definition
|
||||
|
||||
};
|
||||
|
||||
#endif // _Aspect_DisplayConnection_H__
|
14
src/Aspect/Aspect_GraphicDevice.cxx → src/Aspect/Aspect_DisplayConnection_Handle.hxx
Executable file → Normal file
14
src/Aspect/Aspect_GraphicDevice.cxx → src/Aspect/Aspect_DisplayConnection_Handle.hxx
Executable file → Normal file
@ -1,7 +1,4 @@
|
||||
// Created on: 1993-10-19
|
||||
// Created by: Stephane CALLEGARI
|
||||
// Copyright (c) 1993-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2012 OPEN CASCADE SAS
|
||||
// Copyright (c) 2013 OPEN CASCADE SAS
|
||||
//
|
||||
// The content of this file is subject to the Open CASCADE Technology Public
|
||||
// License Version 6.5 (the "License"). You may not use the content of this file
|
||||
@ -18,8 +15,13 @@
|
||||
// purpose or non-infringement. Please see the License for the specific terms
|
||||
// and conditions governing the rights and limitations under the License.
|
||||
|
||||
#ifndef _Aspect_DisplayConnection_Handle_H__
|
||||
#define _Aspect_DisplayConnection_Handle_H__
|
||||
|
||||
#include <Handle_Standard_Transient.hxx>
|
||||
|
||||
#include <Aspect_GraphicDevice.ixx>
|
||||
class Aspect_DisplayConnection;
|
||||
DEFINE_STANDARD_HANDLE(Aspect_DisplayConnection, Standard_Transient)
|
||||
typedef Handle(Aspect_DisplayConnection) Aspect_DisplayConnection_Handle;
|
||||
|
||||
Aspect_GraphicDevice::Aspect_GraphicDevice () {}
|
||||
#endif // _Aspect_DisplayConnection_Handle_H__
|
@ -1,42 +0,0 @@
|
||||
-- Created on: 1993-10-19
|
||||
-- Created by: Jean-Louis FRENKEL
|
||||
-- Copyright (c) 1993-1999 Matra Datavision
|
||||
-- Copyright (c) 1999-2012 OPEN CASCADE SAS
|
||||
--
|
||||
-- The content of this file is subject to the Open CASCADE Technology Public
|
||||
-- License Version 6.5 (the "License"). You may not use the content of this file
|
||||
-- except in compliance with the License. Please obtain a copy of the License
|
||||
-- at http://www.opencascade.org and read it completely before using this file.
|
||||
--
|
||||
-- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
|
||||
-- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
|
||||
--
|
||||
-- The Original Code and all software distributed under the License is
|
||||
-- distributed on an "AS IS" basis, without warranty of any kind, and the
|
||||
-- Initial Developer hereby disclaims all such warranties, including without
|
||||
-- limitation, any warranties of merchantability, fitness for a particular
|
||||
-- purpose or non-infringement. Please see the License for the specific terms
|
||||
-- and conditions governing the rights and limitations under the License.
|
||||
|
||||
|
||||
|
||||
deferred class GraphicDevice from Aspect inherits TShared from MMgt
|
||||
|
||||
uses
|
||||
|
||||
GraphicDriver from Aspect
|
||||
|
||||
raises
|
||||
|
||||
GraphicDeviceDefinitionError from Aspect,
|
||||
BadAccess from Aspect
|
||||
|
||||
is
|
||||
|
||||
Initialize;
|
||||
|
||||
GraphicDriver ( me )
|
||||
returns GraphicDriver from Aspect
|
||||
is deferred;
|
||||
|
||||
end GraphicDevice from Aspect;
|
@ -17,30 +17,17 @@
|
||||
-- purpose or non-infringement. Please see the License for the specific terms
|
||||
-- and conditions governing the rights and limitations under the License.
|
||||
|
||||
-- Modified: GG 28/01/00 G004 Add gamma correction value in Dump methods.
|
||||
-- GG 07/03/00 G004 Add MMSize() method
|
||||
-- TCL 26/10/00 G002 SetBackground(aName: CString) method
|
||||
-- GG 28/11/00 G002 Add BackgroundImage(),
|
||||
-- BackgroundFillMethod(),
|
||||
-- HBackground() methods.
|
||||
-- SAV 24/11/01 SetBackground(Quantity_Color)
|
||||
|
||||
deferred class Window from Aspect
|
||||
|
||||
inherits
|
||||
TShared from MMgt
|
||||
|
||||
---Purpose: This class allows the definition of a window
|
||||
-- Warning: The position and size for the creation of the window
|
||||
-- are defined in Device Screen Unit (DSU)
|
||||
-- floating [0,1] space.
|
||||
|
||||
uses
|
||||
Background from Aspect,
|
||||
GradientBackground from Aspect,
|
||||
GraphicDevice from Aspect,
|
||||
TypeOfResize from Aspect,
|
||||
FillMethod from Aspect,
|
||||
GradientFillMethod from Aspect,
|
||||
Handle from Aspect,
|
||||
Ratio from Quantity,
|
||||
Parameter from Quantity,
|
||||
@ -53,7 +40,7 @@ raises
|
||||
WindowError from Aspect
|
||||
|
||||
is
|
||||
Initialize(aGraphicDevice: GraphicDevice from Aspect);
|
||||
Initialize;
|
||||
---Level: Public
|
||||
---Purpose: Initializes the datas of a Window.
|
||||
|
||||
@ -62,63 +49,35 @@ is
|
||||
---------------------------------------------------
|
||||
|
||||
SetBackground ( me : mutable;
|
||||
ABack : Background from Aspect ) is deferred;
|
||||
ABack : Background from Aspect );
|
||||
---Level: Public
|
||||
---Purpose: Modifies the window background.
|
||||
---Category: Methods to modify the class definition
|
||||
|
||||
SetBackground ( me : mutable ;
|
||||
BackColor : NameOfColor from Quantity ) is deferred;
|
||||
theNameOfColor : NameOfColor from Quantity );
|
||||
---Level: Public
|
||||
---Purpose: Modifies the window background from a Named Color.
|
||||
---Category: Methods to modify the class definition
|
||||
|
||||
SetBackground ( me : mutable; color : Color from Quantity ) is deferred;
|
||||
SetBackground ( me : mutable; color : Color from Quantity );
|
||||
---Level: Public
|
||||
---Purpose: Modifies the window background.
|
||||
---Category: Methods to modify the class definition
|
||||
|
||||
SetBackground( me: mutable;
|
||||
aName : CString from Standard;
|
||||
aMethod : FillMethod from Aspect = Aspect_FM_CENTERED)
|
||||
returns Boolean from Standard is deferred;
|
||||
---Level: Public
|
||||
---Purpose: Loads the window background from an image file <aName>
|
||||
-- defined with a supported format XWD,GIF or BMP
|
||||
-- and returns TRUE if the operation is successfull.
|
||||
---Category: Methods to modify the class definition
|
||||
|
||||
SetBackground( me: mutable;
|
||||
aBitmap: Handle from Aspect) is deferred;
|
||||
---Level: Advanced
|
||||
---Purpose: Loads the window background from a predefined bitmap.
|
||||
-- Warning: the bitmap and window must have the same depth.
|
||||
---Category: Methods to modify the class definition
|
||||
|
||||
SetBackground( me: mutable;
|
||||
ABackground: GradientBackground from Aspect) is deferred;
|
||||
ABackground: GradientBackground from Aspect);
|
||||
---Level: Public
|
||||
---Purpose: Modifies the window gradient background.
|
||||
---Category: Methods to modify the class definition
|
||||
|
||||
SetDoubleBuffer ( me : mutable ;
|
||||
DBmode : Boolean from Standard )
|
||||
---Level: Advanced
|
||||
---Purpose: Activates/Deactivates the Double Buffering capability
|
||||
-- for this window.
|
||||
-- Warning: Double Buffering is always DISABLE by default
|
||||
-- If there is not enought ressources to activate the
|
||||
-- double-buffering the DB mode flag can be set to FALSE.
|
||||
SetBackground( me: mutable;
|
||||
theFirstColor: Color from Quantity;
|
||||
theSecondColor: Color from Quantity;
|
||||
theFillMethod: GradientFillMethod from Aspect);
|
||||
---Level: Public
|
||||
---Purpose: Modifies the window gradient background.
|
||||
---Category: Methods to modify the class definition
|
||||
is deferred;
|
||||
|
||||
Flush ( me )
|
||||
---Level: Advanced
|
||||
---Purpose: Flushs all graphics to the screen and Swap the Double
|
||||
-- buffer if Enable
|
||||
---Category: Methods to modify the class definition
|
||||
---Trigger: Raises if Something is WRONG at Drawing Time.
|
||||
raises WindowError from Aspect is deferred;
|
||||
|
||||
Map ( me )
|
||||
raises WindowError from Aspect is deferred;
|
||||
@ -151,86 +110,6 @@ is
|
||||
---Purpose: Destroy the Window
|
||||
---Category: Methods to modify the class definition
|
||||
|
||||
Clear (me)
|
||||
raises WindowError from Aspect is deferred;
|
||||
---Level: Public
|
||||
---Purpose: Clear The Window in the Background Color
|
||||
---Category: Methods to modify the class definition
|
||||
|
||||
ClearArea (me;
|
||||
XCenter, YCenter: Integer from Standard;
|
||||
Width , Height: Integer from Standard)
|
||||
raises WindowError from Aspect is deferred;
|
||||
---Level: Public
|
||||
---Purpose: Clear The Window Area defined in PIXELS
|
||||
-- in the Background Color
|
||||
---Category: Methods to modify the class definition
|
||||
|
||||
Restore(me)
|
||||
---Level: Public
|
||||
---Purpose: Restore the BackingStored Window <me>.
|
||||
---Category: Methods to modify the class definition
|
||||
---Trigger: Raises if BackingStore() is disable.
|
||||
raises WindowError from Aspect is deferred;
|
||||
|
||||
RestoreArea (me;
|
||||
XCenter, YCenter: Integer from Standard;
|
||||
Width , Height: Integer from Standard)
|
||||
---Level: Public
|
||||
---Purpose: Restore the BackingStored Window Area
|
||||
-- defined in PIXELS.
|
||||
---Category: Methods to modify the class definition
|
||||
---Trigger: Raises if BackingStore() is disable.
|
||||
raises WindowError from Aspect is deferred;
|
||||
|
||||
Dump ( me ; aFilename : CString from Standard;
|
||||
aGammaValue: Real from Standard = 1.0) returns Boolean
|
||||
---Level: Advanced
|
||||
---Purpose: Dumps the Window to an image file (PNG, BMP, JPEG, GIF) with
|
||||
--an optional gamma correction value according to the graphic system
|
||||
--and returns TRUE if the dump occurs normaly.
|
||||
---Category: Methods to modify the class definition
|
||||
---Trigger: Raises if Window is not defined properly
|
||||
raises WindowError from Aspect is deferred;
|
||||
|
||||
DumpArea ( me ; aFilename : CString from Standard ;
|
||||
Xc, Yc : Integer from Standard ;
|
||||
Width, Height : Integer from Standard;
|
||||
aGammaValue: Real from Standard = 1.0 ) returns Boolean
|
||||
---Level: Advanced
|
||||
---Purpose: Dumps the Window Area defined by his center and PIXEL size
|
||||
-- to an image file with
|
||||
-- an optional gamma correction value according to the graphic system
|
||||
--and returns TRUE if the dump occurs normaly.
|
||||
---Category: Methods to modify the class definition
|
||||
---Trigger: Raises if Window is not defined properly
|
||||
-- or the area is out of the Window.
|
||||
raises WindowError from Aspect is deferred;
|
||||
|
||||
Load ( me ; aFilename : CString from Standard) returns Boolean
|
||||
---Level: Advanced
|
||||
---Purpose: Loads the XWD file to this Window.
|
||||
-- Returns TRUE if the loading occurs normaly.
|
||||
-- Warning: Note that the Window is enlarged automatically
|
||||
--when the image size is too large for this window.
|
||||
---Category: Methods to modify the class definition
|
||||
---Trigger: Raises if Window is not defined properly
|
||||
raises WindowError from Aspect is deferred;
|
||||
|
||||
LoadArea ( me ; aFilename : CString from Standard ;
|
||||
Xc, Yc : Integer from Standard ;
|
||||
Width, Height : Integer from Standard ) returns Boolean
|
||||
---Level: Advanced
|
||||
---Purpose: Loads the XWD file to Window Area defined by his center
|
||||
--and PIXEL size
|
||||
-- Returns TRUE if the loading occurs normaly.
|
||||
-- Warning: Note that the Image is zoomed automatically
|
||||
--when the image size is too large for this window area.
|
||||
---Category: Methods to modify the class definition
|
||||
---Trigger: Raises if Window is not defined properly
|
||||
-- or the area is out of the Window.
|
||||
raises WindowError from Aspect is deferred;
|
||||
|
||||
----------------------------
|
||||
-- Category: Inquire methods
|
||||
----------------------------
|
||||
@ -240,11 +119,6 @@ is
|
||||
---Purpose: Returns the window background.
|
||||
---Category: Inquire methods
|
||||
|
||||
BackgroundImage ( me ) returns CString from Standard;
|
||||
---Level: Public
|
||||
---Purpose: Returns the current image background string
|
||||
-- or NULL if nothing is defined.
|
||||
|
||||
BackgroundFillMethod( me ) returns FillMethod from Aspect;
|
||||
---Level: Public
|
||||
---Purpose: Returns the current image background fill mode.
|
||||
@ -253,18 +127,6 @@ is
|
||||
---Level: Public
|
||||
---Purpose: Returns the window gradient background.
|
||||
|
||||
HBackground ( me )
|
||||
returns Handle from Aspect;
|
||||
---Level: Advanced
|
||||
---Purpose: Returns the background bitmap handle or
|
||||
-- 0 when nothing is defined
|
||||
---C++: inline
|
||||
|
||||
GraphicDevice ( me ) returns GraphicDevice from Aspect;
|
||||
---Level: Public
|
||||
---Purpose: Returns the Graphic Device associated to this Window.
|
||||
---Category: Inquire methods
|
||||
|
||||
IsMapped ( me ) returns Boolean from Standard is deferred;
|
||||
---Level: Public
|
||||
---Purpose: Returns True if the window <me> is opened
|
||||
@ -288,13 +150,6 @@ is
|
||||
-- WIDTH/HEIGHT dimensions
|
||||
---Category: Inquire methods
|
||||
|
||||
Position ( me ;
|
||||
X1, Y1 ,X2, Y2 : out Parameter from Quantity)
|
||||
is deferred;
|
||||
---Level: Public
|
||||
---Purpose: Returns The Window POSITION in DSU
|
||||
---Category: Inquire methods
|
||||
|
||||
Position ( me ;
|
||||
X1, Y1, X2, Y2 : out Integer from Standard )
|
||||
is deferred;
|
||||
@ -302,13 +157,6 @@ is
|
||||
---Purpose: Returns The Window POSITION in PIXEL
|
||||
---Category: Inquire methods
|
||||
|
||||
Size ( me ;
|
||||
Width, Height : out Parameter from Quantity )
|
||||
is deferred;
|
||||
---Level: Public
|
||||
---Purpose: Returns The Window SIZE in DSU
|
||||
---Category: Inquire methods
|
||||
|
||||
Size ( me ;
|
||||
Width, Height : out Integer from Standard )
|
||||
is deferred;
|
||||
@ -316,61 +164,9 @@ is
|
||||
---Purpose: Returns The Window SIZE in PIXEL
|
||||
---Category: Inquire methods
|
||||
|
||||
MMSize ( me ;
|
||||
Width, Height : out Real from Standard )
|
||||
is deferred;
|
||||
---Level: Public
|
||||
---Purpose: Returns The Window SIZE in MM
|
||||
---Category: Inquire methods
|
||||
|
||||
Convert ( me ; PV : Integer from Standard )
|
||||
returns Parameter from Quantity is deferred;
|
||||
---Level: Public
|
||||
---Purpose: Returns the DSU value depending of the PIXEL value.
|
||||
---Category: Inquire methods
|
||||
|
||||
Convert ( me ; DV : Parameter from Quantity )
|
||||
returns Integer from Standard is deferred;
|
||||
---Level: Public
|
||||
---Purpose: Returns the PIXEL value depending of the DSU value.
|
||||
---Category: Inquire methods
|
||||
|
||||
Convert ( me ;
|
||||
PX, PY : Integer from Standard ;
|
||||
DX, DY : out Parameter from Quantity ) is deferred;
|
||||
---Level: Public
|
||||
---Purpose: Returns the DSU position depending of the PIXEL position.
|
||||
---Category: Inquire methods
|
||||
|
||||
Convert ( me ;
|
||||
DX, DY : Parameter from Quantity ;
|
||||
PX, PY : out Integer from Standard ) is deferred;
|
||||
---Level: Public
|
||||
---Purpose: Returns the PIXEL position depending of the DSU position.
|
||||
---Category: Inquire methods
|
||||
|
||||
BackingStore(me) returns Boolean from Standard is deferred;
|
||||
---Level: Advanced
|
||||
---Purpose: Returns the BackingStore capability for this Window .
|
||||
-- If Answer is True Exposure can be recovered by
|
||||
-- Restore RestoreArea methods .
|
||||
-- If Answer is False,Application must Redraw
|
||||
-- the exposed area.
|
||||
---Category: Inquire methods
|
||||
|
||||
DoubleBuffer ( me )
|
||||
returns Boolean from Standard is deferred;
|
||||
---Level: Advanced
|
||||
---Purpose: Returns the DoubleBuffer state.
|
||||
---Category: Inquire methods
|
||||
|
||||
fields
|
||||
MyGraphicDevice : GraphicDevice from Aspect is protected;
|
||||
MyBackground : Background from Aspect is protected;
|
||||
MyBackgroundImage : AsciiString from TCollection is protected;
|
||||
MyBackgroundFillMethod : FillMethod from Aspect is protected;
|
||||
MyHBackground : Handle from Aspect is protected;
|
||||
MyGradientBackground : GradientBackground from Aspect is protected;
|
||||
MyBackgroundFillMethod : FillMethod from Aspect is protected;
|
||||
MyIsVirtual : Boolean from Standard is protected;
|
||||
|
||||
end Window;
|
||||
|
@ -45,31 +45,18 @@
|
||||
|
||||
//-Constructors
|
||||
|
||||
Aspect_Window::Aspect_Window (const Handle(Aspect_GraphicDevice)& aGraphicDevice)
|
||||
: MyGraphicDevice(aGraphicDevice),
|
||||
MyBackground(),
|
||||
MyBackgroundImage(),
|
||||
Aspect_Window::Aspect_Window()
|
||||
: MyBackground(),
|
||||
MyGradientBackground(),
|
||||
MyBackgroundFillMethod(Aspect_FM_NONE),
|
||||
MyHBackground(0)
|
||||
MyBackgroundFillMethod(Aspect_FM_NONE)
|
||||
{
|
||||
}
|
||||
|
||||
Handle(Aspect_GraphicDevice) Aspect_Window::GraphicDevice() const
|
||||
{
|
||||
return MyGraphicDevice;
|
||||
}
|
||||
|
||||
Aspect_Background Aspect_Window::Background() const
|
||||
{
|
||||
return MyBackground;
|
||||
}
|
||||
|
||||
Standard_CString Aspect_Window::BackgroundImage() const
|
||||
{
|
||||
return MyBackgroundImage.ToCString();
|
||||
}
|
||||
|
||||
Aspect_FillMethod Aspect_Window::BackgroundFillMethod() const
|
||||
{
|
||||
return MyBackgroundFillMethod;
|
||||
@ -89,3 +76,32 @@ void Aspect_Window::SetVirtual (const Standard_Boolean theVirtual)
|
||||
{
|
||||
MyIsVirtual = theVirtual;
|
||||
}
|
||||
|
||||
void Aspect_Window::SetBackground (const Aspect_Background& theBackground)
|
||||
{
|
||||
SetBackground (theBackground.Color());
|
||||
}
|
||||
|
||||
void Aspect_Window::SetBackground (const Quantity_NameOfColor theNameOfColor)
|
||||
{
|
||||
MyBackground.SetColor (theNameOfColor);
|
||||
}
|
||||
|
||||
void Aspect_Window::SetBackground (const Quantity_Color& theColor)
|
||||
{
|
||||
MyBackground.SetColor (theColor);
|
||||
}
|
||||
|
||||
void Aspect_Window::SetBackground (const Aspect_GradientBackground& theBackground)
|
||||
{
|
||||
Quantity_Color aFirstColor, aSecondColor;
|
||||
theBackground.Colors (aFirstColor, aSecondColor);
|
||||
SetBackground (aFirstColor, aSecondColor, theBackground.BgGradientFillMethod());
|
||||
}
|
||||
|
||||
void Aspect_Window::SetBackground (const Quantity_Color& theFirstColor,
|
||||
const Quantity_Color& theSecondColor,
|
||||
const Aspect_GradientFillMethod theFillMethod)
|
||||
{
|
||||
MyGradientBackground.SetColors (theFirstColor, theSecondColor, theFillMethod);
|
||||
}
|
||||
|
@ -1,22 +0,0 @@
|
||||
// Copyright (c) 1999-2012 OPEN CASCADE SAS
|
||||
//
|
||||
// The content of this file is subject to the Open CASCADE Technology Public
|
||||
// License Version 6.5 (the "License"). You may not use the content of this file
|
||||
// except in compliance with the License. Please obtain a copy of the License
|
||||
// at http://www.opencascade.org and read it completely before using this file.
|
||||
//
|
||||
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
|
||||
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
|
||||
//
|
||||
// The Original Code and all software distributed under the License is
|
||||
// distributed on an "AS IS" basis, without warranty of any kind, and the
|
||||
// Initial Developer hereby disclaims all such warranties, including without
|
||||
// limitation, any warranties of merchantability, fitness for a particular
|
||||
// purpose or non-infringement. Please see the License for the specific terms
|
||||
// and conditions governing the rights and limitations under the License.
|
||||
|
||||
inline Aspect_Handle Aspect_Window :: HBackground () const {
|
||||
|
||||
return MyHBackground;
|
||||
|
||||
}
|
1
src/Aspect/EXTERNLIB
Normal file
1
src/Aspect/EXTERNLIB
Normal file
@ -0,0 +1 @@
|
||||
CSF_XwLibs
|
@ -1,3 +1,4 @@
|
||||
EXTERNLIB
|
||||
Aspect_WOKSteps.edl
|
||||
Aspect_CMPLRS.edl
|
||||
Aspect_FStream.hxx
|
||||
@ -19,3 +20,6 @@ Aspect_Drawable.hxx
|
||||
Aspect_PolygonOffsetMode.hxx
|
||||
Aspect_GradientBackground.cxx
|
||||
Aspect_Convert.hxx
|
||||
Aspect_DisplayConnection.hxx
|
||||
Aspect_DisplayConnection.cxx
|
||||
Aspect_DisplayConnection_Handle.hxx
|
||||
|
@ -71,36 +71,6 @@ public:
|
||||
Destroy();
|
||||
}
|
||||
|
||||
//! Modifies the window background
|
||||
Standard_EXPORT virtual void SetBackground (const Aspect_Background& theBackground);
|
||||
|
||||
//! Modifies the window background
|
||||
Standard_EXPORT virtual void SetBackground (const Quantity_NameOfColor theBackColor);
|
||||
|
||||
//! Modifies the window background
|
||||
Standard_EXPORT virtual void SetBackground (const Quantity_Color& theColor);
|
||||
|
||||
//! Modifies the window background
|
||||
Standard_EXPORT void SetBackground (const Aspect_Handle theBackPixmap);
|
||||
|
||||
//! Loads the window background from an image file
|
||||
Standard_EXPORT Standard_Boolean SetBackground (const Standard_CString theName,
|
||||
const Aspect_FillMethod theMethod = Aspect_FM_CENTERED);
|
||||
|
||||
//! Modifies the window gradient background
|
||||
Standard_EXPORT virtual void SetBackground (const Aspect_GradientBackground& theBackground);
|
||||
|
||||
//! Modifies the window gradient background
|
||||
Standard_EXPORT void SetBackground (const Quantity_Color& theCol1,
|
||||
const Quantity_Color& theCol2,
|
||||
const Aspect_GradientFillMethod theMethod = Aspect_GFM_HOR);
|
||||
|
||||
//! Activates/Deactivates the Double Buffering capability for this window
|
||||
Standard_EXPORT virtual void SetDoubleBuffer (const Standard_Boolean theDBmode);
|
||||
|
||||
//! Flushes all graphics to the screen and Swap the Double buffer
|
||||
Standard_EXPORT virtual void Flush() const;
|
||||
|
||||
//! Opens the window <me>
|
||||
Standard_EXPORT virtual void Map() const;
|
||||
|
||||
@ -113,101 +83,22 @@ public:
|
||||
//! Apply the mapping change to the window <me>
|
||||
Standard_EXPORT virtual Standard_Boolean DoMapping() const;
|
||||
|
||||
//! Clears the Window in the Background color
|
||||
Standard_EXPORT virtual void Clear() const;
|
||||
|
||||
//! Clears the Window Area defined by his center and PIXEL size in the Background color
|
||||
Standard_EXPORT virtual void ClearArea (const Standard_Integer theCenterX,
|
||||
const Standard_Integer theCenterY,
|
||||
const Standard_Integer theWidth,
|
||||
const Standard_Integer theHeight) const;
|
||||
|
||||
//! Restores The Window from the BackingStored Window
|
||||
Standard_EXPORT virtual void Restore() const;
|
||||
|
||||
//! Restores The Window Area defined by his center and PIXEL size from the BackingStored Window
|
||||
Standard_EXPORT virtual void RestoreArea (const Standard_Integer theCenterX,
|
||||
const Standard_Integer theCenterY,
|
||||
const Standard_Integer theWidth,
|
||||
const Standard_Integer theHeight) const;
|
||||
|
||||
//! Dumps the Window to file
|
||||
Standard_EXPORT virtual Standard_Boolean Dump (const Standard_CString theFilename,
|
||||
const Standard_Real theGammaValue = 1.0) const;
|
||||
|
||||
//! Dumps the Window Area defined by his center and PIXEL size to an image file
|
||||
Standard_EXPORT virtual Standard_Boolean DumpArea (const Standard_CString theFilename,
|
||||
const Standard_Integer theCenterX,
|
||||
const Standard_Integer theCenterY,
|
||||
const Standard_Integer theWidth,
|
||||
const Standard_Integer theHeight,
|
||||
const Standard_Real theGammaValue = 1.0) const;
|
||||
|
||||
//! Loads the image file to this Window
|
||||
//! @return TRUE if the loading occurs normaly
|
||||
Standard_EXPORT virtual Standard_Boolean Load (const Standard_CString theFilename) const;
|
||||
|
||||
//! Loads the image file to Window Area
|
||||
Standard_EXPORT virtual Standard_Boolean LoadArea (const Standard_CString theFilename,
|
||||
const Standard_Integer theCenterX,
|
||||
const Standard_Integer theCenterY,
|
||||
const Standard_Integer theWidth,
|
||||
const Standard_Integer theHeight) const;
|
||||
|
||||
//! Returns the BackingStore capability for this Window
|
||||
Standard_EXPORT virtual Standard_Boolean BackingStore() const;
|
||||
|
||||
//! Returns the DoubleBuffer state
|
||||
Standard_EXPORT virtual Standard_Boolean DoubleBuffer() const;
|
||||
|
||||
//! Returns True if the window <me> is opened
|
||||
Standard_EXPORT virtual Standard_Boolean IsMapped() const;
|
||||
|
||||
//! Returns The Window RATIO equal to the physical WIDTH/HEIGHT dimensions
|
||||
Standard_EXPORT virtual Quantity_Ratio Ratio() const;
|
||||
|
||||
//! Returns The Window POSITION in DSU
|
||||
Standard_EXPORT virtual void Position (Quantity_Parameter& X1,
|
||||
Quantity_Parameter& Y1,
|
||||
Quantity_Parameter& X2,
|
||||
Quantity_Parameter& Y2) const;
|
||||
|
||||
//! Returns The Window POSITION in PIXEL
|
||||
Standard_EXPORT virtual void Position (Standard_Integer& X1,
|
||||
Standard_Integer& Y1,
|
||||
Standard_Integer& X2,
|
||||
Standard_Integer& Y2) const;
|
||||
|
||||
//! Returns The Window SIZE in DSU
|
||||
Standard_EXPORT virtual void Size (Quantity_Parameter& theWidth,
|
||||
Quantity_Parameter& theHeight) const;
|
||||
|
||||
//! Returns The Window SIZE in PIXEL
|
||||
Standard_EXPORT virtual void Size (Standard_Integer& theWidth,
|
||||
Standard_Integer& theHeight) const;
|
||||
|
||||
//! Returns The Window SIZE in MM
|
||||
Standard_EXPORT virtual void MMSize (Standard_Real& theWidth,
|
||||
Standard_Real& theHeight) const;
|
||||
|
||||
//! Returns the DSU value depending of the PIXEL value
|
||||
Standard_EXPORT virtual Quantity_Parameter Convert (const Standard_Integer PV) const;
|
||||
|
||||
//! Returns the PIXEL value depending of the DSU value
|
||||
Standard_EXPORT virtual Standard_Integer Convert (const Quantity_Parameter DV) const;
|
||||
|
||||
//! Returns the DSU position depending of the PIXEL position
|
||||
Standard_EXPORT virtual void Convert (const Standard_Integer PX,
|
||||
const Standard_Integer PY,
|
||||
Quantity_Parameter& DX,
|
||||
Quantity_Parameter& DY) const;
|
||||
|
||||
//! Returns the PIXEL position depending of the DSU position
|
||||
Standard_EXPORT virtual void Convert (const Quantity_Parameter DX,
|
||||
const Quantity_Parameter DY,
|
||||
Standard_Integer& PX,
|
||||
Standard_Integer& PY) const;
|
||||
|
||||
//! @return associated NSView
|
||||
Standard_EXPORT NSView* HView() const;
|
||||
|
||||
|
@ -25,32 +25,11 @@
|
||||
|
||||
#include <Image_AlienPixMap.hxx>
|
||||
#include <Aspect_Convert.hxx>
|
||||
#include <Aspect_GraphicDevice.hxx>
|
||||
#include <Aspect_WindowDefinitionError.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_HANDLE (Cocoa_Window, Aspect_Window)
|
||||
IMPLEMENT_STANDARD_RTTIEXT(Cocoa_Window, Aspect_Window)
|
||||
|
||||
//! Dummy device class implementation
|
||||
class Cocoa_GraphicDevice : public Aspect_GraphicDevice
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
virtual Handle_Aspect_GraphicDriver GraphicDriver() const
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
DEFINE_STANDARD_RTTI(Cocoa_GraphicDevice)
|
||||
|
||||
};
|
||||
|
||||
DEFINE_STANDARD_HANDLE(Cocoa_GraphicDevice, Aspect_GraphicDevice)
|
||||
|
||||
IMPLEMENT_STANDARD_HANDLE (Cocoa_GraphicDevice, Aspect_GraphicDevice)
|
||||
IMPLEMENT_STANDARD_RTTIEXT(Cocoa_GraphicDevice, Aspect_GraphicDevice)
|
||||
|
||||
static Standard_Integer getScreenBottom()
|
||||
{
|
||||
Cocoa_LocalPool aLocalPool;
|
||||
@ -83,7 +62,7 @@ Cocoa_Window::Cocoa_Window (const Standard_CString theTitle,
|
||||
const Standard_Integer thePxTop,
|
||||
const Standard_Integer thePxWidth,
|
||||
const Standard_Integer thePxHeight)
|
||||
: Aspect_Window (new Cocoa_GraphicDevice()),
|
||||
: Aspect_Window (),
|
||||
myHWindow (NULL),
|
||||
myHView (NULL),
|
||||
myXLeft (thePxLeft),
|
||||
@ -131,7 +110,7 @@ Cocoa_Window::Cocoa_Window (const Standard_CString theTitle,
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Cocoa_Window::Cocoa_Window (NSView* theViewNS)
|
||||
: Aspect_Window (new Cocoa_GraphicDevice()),
|
||||
: Aspect_Window (),
|
||||
myHWindow (NULL),
|
||||
myHView ([theViewNS retain]),
|
||||
myXLeft (0),
|
||||
@ -189,101 +168,6 @@ void Cocoa_Window::SetHView (NSView* theView)
|
||||
myHView = [theView retain];
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : DoubleBuffer
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Standard_Boolean Cocoa_Window::DoubleBuffer() const
|
||||
{
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SetBackground
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Cocoa_Window::SetBackground (const Aspect_Background& theBackground)
|
||||
{
|
||||
SetBackground (theBackground.Color());
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SetBackground
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Cocoa_Window::SetBackground (const Quantity_NameOfColor theBackColor)
|
||||
{
|
||||
SetBackground (Quantity_Color (theBackColor));
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SetBackground
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Cocoa_Window::SetBackground (const Aspect_Handle theBackPixmap)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SetBackground
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Standard_Boolean Cocoa_Window::SetBackground (const Standard_CString theFileName,
|
||||
const Aspect_FillMethod theMethod)
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SetBackground
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Cocoa_Window::SetBackground (const Quantity_Color& theColor)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SetBackground
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Cocoa_Window::SetBackground (const Aspect_GradientBackground& theGrBackground)
|
||||
{
|
||||
Quantity_Color aColor1, aColor2;
|
||||
theGrBackground.Colors (aColor1, aColor2);
|
||||
SetBackground (aColor1, aColor2, theGrBackground.BgGradientFillMethod());
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SetBackground
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Cocoa_Window::SetBackground (const Quantity_Color& theColor1,
|
||||
const Quantity_Color& theColor2,
|
||||
const Aspect_GradientFillMethod theMethod)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SetDoubleBuffer
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Cocoa_Window::SetDoubleBuffer (const Standard_Boolean )
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : Flush
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Cocoa_Window::Flush() const
|
||||
{
|
||||
Restore();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : IsMapped
|
||||
// purpose :
|
||||
@ -376,122 +260,6 @@ Standard_Boolean Cocoa_Window::DoMapping() const
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : Clear
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Cocoa_Window::Clear() const
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : ClearArea
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Cocoa_Window::ClearArea (const Standard_Integer Xc,
|
||||
const Standard_Integer Yc,
|
||||
const Standard_Integer Width,
|
||||
const Standard_Integer Height) const
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : Restore
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Cocoa_Window::Restore() const
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : RestoreArea
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Cocoa_Window::RestoreArea (const Standard_Integer Xc,
|
||||
const Standard_Integer Yc,
|
||||
const Standard_Integer Width,
|
||||
const Standard_Integer Height) const
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : Dump
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Standard_Boolean Cocoa_Window::Dump (const Standard_CString theFilename,
|
||||
const Standard_Real theGammaValue) const
|
||||
{
|
||||
/*Image_AlienPixMap anImg;
|
||||
if (!ToPixMap (anImg) || anImg.IsEmpty())
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
if (Abs (theGammaValue - 1.0) > 0.001)
|
||||
{
|
||||
anImg.AdjustGamma (theGammaValue);
|
||||
}
|
||||
return anImg.Save (theFilename);*/
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : DumpArea
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Standard_Boolean Cocoa_Window::DumpArea (const Standard_CString theFilename,
|
||||
const Standard_Integer theCenterX,
|
||||
const Standard_Integer theCenterY,
|
||||
const Standard_Integer theWidth,
|
||||
const Standard_Integer theHeight,
|
||||
const Standard_Real theGammaValue) const
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : ToPixMap
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
/*Standard_Boolean Cocoa_Window::ToPixMap (Image_PixMap& thePixMap) const
|
||||
{
|
||||
return Standard_False;
|
||||
}*/
|
||||
|
||||
// =======================================================================
|
||||
// function : Load
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Standard_Boolean Cocoa_Window::Load (const Standard_CString theFilename) const
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : LoadArea
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Standard_Boolean Cocoa_Window::LoadArea (const Standard_CString theFilename,
|
||||
const Standard_Integer theCenterX,
|
||||
const Standard_Integer theCenterY,
|
||||
const Standard_Integer theWidth,
|
||||
const Standard_Integer theHeight) const
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : BackingStore
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Standard_Boolean Cocoa_Window::BackingStore() const
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : Ratio
|
||||
// purpose :
|
||||
@ -507,16 +275,6 @@ Quantity_Ratio Cocoa_Window::Ratio() const
|
||||
return Quantity_Ratio (aBounds.size.width / aBounds.size.height);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : Position
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Cocoa_Window::Position (Quantity_Parameter& X1, Quantity_Parameter& Y1,
|
||||
Quantity_Parameter& X2, Quantity_Parameter& Y2) const
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : Position
|
||||
// purpose :
|
||||
@ -527,16 +285,6 @@ void Cocoa_Window::Position (Standard_Integer& X1, Standard_Integer& Y1,
|
||||
//
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : Size
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Cocoa_Window::Size (Quantity_Parameter& theWidth,
|
||||
Quantity_Parameter& theHeight) const
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : Size
|
||||
// purpose :
|
||||
@ -553,55 +301,3 @@ void Cocoa_Window::Size (Standard_Integer& theWidth,
|
||||
theWidth = (Standard_Integer )aBounds.size.width;
|
||||
theHeight = (Standard_Integer )aBounds.size.height;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : MMSize
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Cocoa_Window::MMSize (Standard_Real& theWidth,
|
||||
Standard_Real& theHeight) const
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : Convert
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Quantity_Parameter Cocoa_Window::Convert (const Standard_Integer PV) const
|
||||
{
|
||||
return 0.0; ///
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : Convert
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Standard_Integer Cocoa_Window::Convert (const Quantity_Parameter DV) const
|
||||
{
|
||||
return 0; ////
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : Convert
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Cocoa_Window::Convert (const Standard_Integer PX,
|
||||
const Standard_Integer PY,
|
||||
Quantity_Parameter& DX,
|
||||
Quantity_Parameter& DY) const
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : Convert
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Cocoa_Window::Convert (const Quantity_Parameter DX,
|
||||
const Quantity_Parameter DY,
|
||||
Standard_Integer& PX,
|
||||
Standard_Integer& PY) const
|
||||
{
|
||||
//
|
||||
}
|
||||
|
@ -46,7 +46,6 @@ Graphic3d_CTransPersStruct.hxx
|
||||
Graphic3d_CTransPersStruct.cxx
|
||||
Graphic3d_NListOfHAsciiString.hxx
|
||||
Graphic3d_AspectText3d.cxx
|
||||
Graphic3d_WNTGraphicDevice.cxx
|
||||
Graphic3d_PtrFrameBuffer.hxx
|
||||
Graphic3d_BufferType.hxx
|
||||
Graphic3d_Vec2.hxx
|
||||
|
@ -467,15 +467,6 @@ is
|
||||
---Purpose: For grouping together primitives in a structure
|
||||
---Category: Classes
|
||||
|
||||
class GraphicDevice;
|
||||
---Purpose: Defines a physical graphic device allowing to
|
||||
-- shares graphical ressources.
|
||||
---Category: Classes
|
||||
|
||||
class WNTGraphicDevice;
|
||||
---Purpose: Defines a physical graphic device for Windows NT
|
||||
---Category: Classes
|
||||
|
||||
class MaterialAspect;
|
||||
---Purpose: Aspect attributes of a 3d face.
|
||||
---Category: Classes
|
||||
@ -615,4 +606,15 @@ is
|
||||
|
||||
end SortType;
|
||||
|
||||
----------------------------
|
||||
-- Category: Package methods
|
||||
----------------------------
|
||||
|
||||
InitGraphicDriver (theDisplayConnection: DisplayConnection_Handle from Aspect)
|
||||
returns GraphicDriver from Graphic3d
|
||||
raises DriverDefinitionError from Aspect;
|
||||
---Purpose: Initialize graphic driver and returns Handle to it.
|
||||
|
||||
|
||||
|
||||
end Graphic3d;
|
||||
|
83
src/Graphic3d/Graphic3d.cxx
Normal file
83
src/Graphic3d/Graphic3d.cxx
Normal file
@ -0,0 +1,83 @@
|
||||
// Copyright (c) 2013 OPEN CASCADE SAS
|
||||
//
|
||||
// The content of this file is subject to the Open CASCADE Technology Public
|
||||
// License Version 6.5 (the "License"). You may not use the content of this file
|
||||
// except in compliance with the License. Please obtain a copy of the License
|
||||
// at http://www.opencascade.org and read it completely before using this file.
|
||||
//
|
||||
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
|
||||
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
|
||||
//
|
||||
// The Original Code and all software distributed under the License is
|
||||
// distributed on an "AS IS" basis, without warranty of any kind, and the
|
||||
// Initial Developer hereby disclaims all such warranties, including without
|
||||
// limitation, any warranties of merchantability, fitness for a particular
|
||||
// purpose or non-infringement. Please see the License for the specific terms
|
||||
// and conditions governing the rights and limitations under the License.
|
||||
|
||||
#include <Graphic3d.ixx>
|
||||
|
||||
#include <Aspect_DisplayConnection.hxx>
|
||||
#include <Aspect_DriverDefinitionError.hxx>
|
||||
#include <OSD_Environment.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : InitGraphicDriver
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Handle(Graphic3d_GraphicDriver) Graphic3d::InitGraphicDriver (const Handle(Aspect_DisplayConnection)& theDisplayConnection)
|
||||
{
|
||||
#if !defined(_WIN32) && !defined(__WIN32__) && (!defined(__APPLE__) || defined(MACOSX_USE_GLX))
|
||||
if (theDisplayConnection.IsNull())
|
||||
{
|
||||
Aspect_DriverDefinitionError::Raise ("Null display connection.");
|
||||
}
|
||||
#endif
|
||||
|
||||
TCollection_AsciiString aGraphicLibName;
|
||||
|
||||
// Setting the library name. Depends on the platform.
|
||||
#if defined(_WIN32) || defined(__WIN32__)
|
||||
aGraphicLibName = "TKOpenGl.dll";
|
||||
#elif defined(__hpux) || defined(HPUX)
|
||||
aGraphicLibName = "libTKOpenGl.sl";
|
||||
#elif defined(__APPLE__)
|
||||
aGraphicLibName = "libTKOpenGl.dylib";
|
||||
#else
|
||||
aGraphicLibName = "libTKOpenGl.so";
|
||||
#endif
|
||||
|
||||
// Loading the library.
|
||||
OSD_SharedLibrary aSharedLibrary (aGraphicLibName.ToCString());
|
||||
if (!aSharedLibrary.DlOpen (OSD_RTLD_LAZY))
|
||||
{
|
||||
Aspect_DriverDefinitionError::Raise (aSharedLibrary.DlError());
|
||||
}
|
||||
|
||||
// Retrieving factory function pointer.
|
||||
typedef Handle(Graphic3d_GraphicDriver) (*GraphicDriverFactoryPointer) (Standard_CString);
|
||||
GraphicDriverFactoryPointer aGraphicDriverConstructor = (GraphicDriverFactoryPointer )aSharedLibrary.DlSymb ("MetaGraphicDriverFactory");
|
||||
if (aGraphicDriverConstructor == NULL)
|
||||
{
|
||||
Aspect_DriverDefinitionError::Raise (aSharedLibrary.DlError());
|
||||
}
|
||||
|
||||
// Creating driver instance.
|
||||
Handle(Graphic3d_GraphicDriver) aGraphicDriver = aGraphicDriverConstructor (aSharedLibrary.Name());
|
||||
|
||||
// Management of traces.
|
||||
OSD_Environment aTraceEnv ("CSF_GraphicTrace");
|
||||
TCollection_AsciiString aTrace = aTraceEnv.Value();
|
||||
if (aTrace.IsIntegerValue())
|
||||
{
|
||||
aGraphicDriver->SetTrace (aTrace.IntegerValue());
|
||||
}
|
||||
|
||||
// Starting graphic driver.
|
||||
if (!aGraphicDriver->Begin (theDisplayConnection))
|
||||
{
|
||||
Aspect_DriverDefinitionError::Raise ("Cannot connect to graphic library.");
|
||||
}
|
||||
|
||||
return aGraphicDriver;
|
||||
}
|
@ -1,94 +0,0 @@
|
||||
-- Created on: 1994-01-19
|
||||
-- Created by: CAL
|
||||
-- Copyright (c) 1994-1999 Matra Datavision
|
||||
-- Copyright (c) 1999-2012 OPEN CASCADE SAS
|
||||
--
|
||||
-- The content of this file is subject to the Open CASCADE Technology Public
|
||||
-- License Version 6.5 (the "License"). You may not use the content of this file
|
||||
-- except in compliance with the License. Please obtain a copy of the License
|
||||
-- at http://www.opencascade.org and read it completely before using this file.
|
||||
--
|
||||
-- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
|
||||
-- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
|
||||
--
|
||||
-- The Original Code and all software distributed under the License is
|
||||
-- distributed on an "AS IS" basis, without warranty of any kind, and the
|
||||
-- Initial Developer hereby disclaims all such warranties, including without
|
||||
-- limitation, any warranties of merchantability, fitness for a particular
|
||||
-- purpose or non-infringement. Please see the License for the specific terms
|
||||
-- and conditions governing the rights and limitations under the License.
|
||||
|
||||
-- Modified: GG RIC120302 add new constructor to pass Display structure
|
||||
-- directly instead the connexion name.
|
||||
|
||||
class GraphicDevice from Graphic3d inherits GraphicDevice from Xw
|
||||
|
||||
---Purpose: This class allows the definition of the Advanced
|
||||
-- Graphic Device
|
||||
-- Warning: An Graphic Device is defined by a connexion
|
||||
-- "host:server.screen"
|
||||
|
||||
|
||||
uses
|
||||
|
||||
SharedLibrary from OSD,
|
||||
GraphicDriver from Aspect,
|
||||
Display from Aspect,
|
||||
GraphicDriver from Graphic3d,
|
||||
TypeOfMapping from Xw,
|
||||
AsciiString from TCollection
|
||||
|
||||
raises
|
||||
|
||||
GraphicDeviceDefinitionError from Aspect
|
||||
|
||||
is
|
||||
|
||||
Create ( Connexion : CString from Standard;
|
||||
Mapping : TypeOfMapping from Xw = Xw_TOM_COLORCUBE;
|
||||
Ncolors : Integer from Standard = 0;
|
||||
UseDefault : Boolean from Standard = Standard_True )
|
||||
returns mutable GraphicDevice from Graphic3d
|
||||
---Level: Public
|
||||
---Purpose: Creates a GraphicDevice
|
||||
---Warning: Raises if the Device is badly defined
|
||||
raises GraphicDeviceDefinitionError from Aspect;
|
||||
|
||||
Create ( DisplayHandle : Display from Aspect)
|
||||
returns mutable GraphicDevice from Graphic3d
|
||||
---Level: Public
|
||||
---Purpose: Creates a GraphicDevice from the Display structure
|
||||
---Warning: Raises if the Device is badly defined
|
||||
raises GraphicDeviceDefinitionError from Aspect;
|
||||
|
||||
Destroy ( me : mutable )
|
||||
is redefined static;
|
||||
---Level: Public
|
||||
---Purpose: Deletes the GraphicDevice <me>.
|
||||
---C++: alias ~
|
||||
|
||||
GraphicDriver ( me )
|
||||
returns GraphicDriver from Aspect
|
||||
is redefined static;
|
||||
---Level: Public
|
||||
---Purpose: Returns the GraphicDriver.
|
||||
|
||||
SetGraphicDriver ( me : mutable )
|
||||
is private;
|
||||
---Level: Internal
|
||||
---Purpose: Sets the GraphicDriver.
|
||||
|
||||
ShrEnvString ( me )
|
||||
returns AsciiString from TCollection
|
||||
is private;
|
||||
---Level: Internal
|
||||
---Purpose: Returns the environment string for loading shared graphics library.
|
||||
-- The string can be defined in environment by corresponding variables,
|
||||
-- or default value will be used for loading from system library path
|
||||
-- Environment variables : CSF_GraphicShr
|
||||
|
||||
fields
|
||||
|
||||
MyGraphicDriver : GraphicDriver from Graphic3d;
|
||||
|
||||
end GraphicDevice from Graphic3d;
|
@ -1,205 +0,0 @@
|
||||
// Copyright (c) 1995-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2012 OPEN CASCADE SAS
|
||||
//
|
||||
// The content of this file is subject to the Open CASCADE Technology Public
|
||||
// License Version 6.5 (the "License"). You may not use the content of this file
|
||||
// except in compliance with the License. Please obtain a copy of the License
|
||||
// at http://www.opencascade.org and read it completely before using this file.
|
||||
//
|
||||
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
|
||||
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
|
||||
//
|
||||
// The Original Code and all software distributed under the License is
|
||||
// distributed on an "AS IS" basis, without warranty of any kind, and the
|
||||
// Initial Developer hereby disclaims all such warranties, including without
|
||||
// limitation, any warranties of merchantability, fitness for a particular
|
||||
// purpose or non-infringement. Please see the License for the specific terms
|
||||
// and conditions governing the rights and limitations under the License.
|
||||
|
||||
/***********************************************************************
|
||||
|
||||
FONCTION :
|
||||
----------
|
||||
Classe Graphic3d_GraphicDevice.cxx :
|
||||
|
||||
|
||||
HISTORIQUE DES MODIFICATIONS :
|
||||
--------------------------------
|
||||
Janvier 1994 : CAL ; Creation.
|
||||
04-02-97 : FMN ; Suppression appel call_tox_set_colormap_mapping()
|
||||
10-09-00 : GG ; NEW OpenGl driver loading specification
|
||||
when nothing is defined the driver libTKOpenGl[.so|.sl]
|
||||
is loading from the current PATH
|
||||
|
||||
************************************************************************/
|
||||
#if (!defined(_WIN32) && !defined(__WIN32__))
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sys/utsname.h>
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
/*
|
||||
* Includes
|
||||
*/
|
||||
|
||||
#include <Graphic3d_GraphicDevice.ixx>
|
||||
#include <Graphic3d_GraphicDriver.hxx>
|
||||
#include <OSD_Function.hxx>
|
||||
#include <OSD_Environment.hxx>
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
|
||||
#include <Xw_Cextern.hxx>
|
||||
|
||||
//-Static data definitions
|
||||
|
||||
static char LocalMessag[80] ;
|
||||
|
||||
//-Aliases
|
||||
|
||||
//-Global data definitions
|
||||
|
||||
//-Constructor
|
||||
|
||||
Graphic3d_GraphicDevice::Graphic3d_GraphicDevice (const Standard_CString Connexion, const Xw_TypeOfMapping /*Mapping*/, const Standard_Integer Ncolors, const Standard_Boolean UseDefault ):
|
||||
Xw_GraphicDevice () {
|
||||
Standard_CString connexion = (Connexion) ? Connexion : Standard_CString("") ;
|
||||
Standard_Boolean status ;
|
||||
|
||||
MyExtendedDisplay = Xw_open_display((Standard_PCharacter)connexion) ;
|
||||
|
||||
if( !MyExtendedDisplay ) {
|
||||
sprintf(LocalMessag,"Cannot connect to server '%s'",connexion) ;
|
||||
Aspect_GraphicDeviceDefinitionError::Raise (LocalMessag);
|
||||
}
|
||||
|
||||
SetGraphicDriver ();
|
||||
|
||||
status = MyGraphicDriver->Begin (connexion);
|
||||
|
||||
if( !status ) {
|
||||
sprintf(LocalMessag,"Cannot connect to graphic library from '%s'",
|
||||
connexion) ;
|
||||
Aspect_GraphicDeviceDefinitionError::Raise (LocalMessag);
|
||||
}
|
||||
|
||||
this->InitMaps (connexion,Xw_TOM_READONLY,Ncolors,UseDefault);
|
||||
|
||||
|
||||
}
|
||||
|
||||
Graphic3d_GraphicDevice::Graphic3d_GraphicDevice (const Aspect_Display pdisplay)
|
||||
: Xw_GraphicDevice ()
|
||||
{
|
||||
Standard_Boolean status ;
|
||||
|
||||
if( !pdisplay )
|
||||
Aspect_GraphicDeviceDefinitionError::Raise ("Bad display pointer");
|
||||
MyExtendedDisplay = Xw_set_display(pdisplay) ;
|
||||
Standard_CString connexion = Xw_get_display_name(MyExtendedDisplay);
|
||||
|
||||
if( !MyExtendedDisplay ) {
|
||||
if( connexion )
|
||||
sprintf(LocalMessag,"Cannot connect to server '%s'",connexion) ;
|
||||
else
|
||||
sprintf(LocalMessag,"Cannot connect to an UNKNOWN server") ;
|
||||
Aspect_GraphicDeviceDefinitionError::Raise (LocalMessag);
|
||||
}
|
||||
|
||||
SetGraphicDriver ();
|
||||
|
||||
status = MyGraphicDriver->Begin (pdisplay);
|
||||
|
||||
if( !status ) {
|
||||
sprintf(LocalMessag,"Cannot connect to graphic library from '%s'",
|
||||
connexion) ;
|
||||
Aspect_GraphicDeviceDefinitionError::Raise (LocalMessag);
|
||||
}
|
||||
|
||||
this->InitMaps (connexion,Xw_TOM_READONLY,0,Standard_True);
|
||||
}
|
||||
|
||||
// Destructor
|
||||
void Graphic3d_GraphicDevice::Destroy()
|
||||
{
|
||||
MyGraphicDriver->End();
|
||||
}
|
||||
|
||||
// Methods in order
|
||||
|
||||
Handle(Aspect_GraphicDriver) Graphic3d_GraphicDevice::GraphicDriver () const {
|
||||
|
||||
return MyGraphicDriver;
|
||||
|
||||
}
|
||||
|
||||
void Graphic3d_GraphicDevice::SetGraphicDriver () {
|
||||
|
||||
TCollection_AsciiString aShr = ShrEnvString ();
|
||||
|
||||
OSD_SharedLibrary TheSharedLibrary (aShr.ToCString());
|
||||
|
||||
Standard_Boolean Result = TheSharedLibrary.DlOpen (OSD_RTLD_LAZY);
|
||||
|
||||
if (! Result) {
|
||||
Aspect_GraphicDeviceDefinitionError::Raise
|
||||
(TheSharedLibrary.DlError ());
|
||||
}
|
||||
else {
|
||||
// Management of traces
|
||||
char *tracevalue = NULL;
|
||||
tracevalue = (char *)(getenv ("CSF_GraphicTrace"));
|
||||
if (tracevalue)
|
||||
cout << "Information : " << aShr << " loaded\n" << flush;
|
||||
|
||||
OSD_Function new_GLGraphicDriver =
|
||||
TheSharedLibrary.DlSymb ("MetaGraphicDriverFactory");
|
||||
if (tracevalue)
|
||||
cout << "Information : MetaGraphicDriverFactory "
|
||||
<< (new_GLGraphicDriver ? "found\n" : "not found\n") << flush;
|
||||
if (! new_GLGraphicDriver) {
|
||||
Aspect_GraphicDeviceDefinitionError::Raise
|
||||
(TheSharedLibrary.DlError ());
|
||||
}
|
||||
else {
|
||||
// Sequence :
|
||||
// new_GLGraphicDriver is OSD_Function :
|
||||
// typedef int (* OSD_Function)(...);
|
||||
// that is why good cast in GraphicDriver.
|
||||
Handle(Graphic3d_GraphicDriver)
|
||||
(*fp) (Standard_CString) = NULL;
|
||||
fp = (Handle(Graphic3d_GraphicDriver)
|
||||
(*) (Standard_CString)) new_GLGraphicDriver;
|
||||
if (tracevalue) cout << "FP == "<<(void *) fp<<endl;
|
||||
Standard_CString aSharedName = TheSharedLibrary.Name ();
|
||||
MyGraphicDriver = (*fp) (aSharedName);
|
||||
|
||||
// MyGraphicDriver = (*fp) (TheSharedLibrary.Name ());
|
||||
|
||||
// Management of traces
|
||||
if (tracevalue)
|
||||
MyGraphicDriver->SetTrace
|
||||
((Standard_Integer) atoi (tracevalue));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
TCollection_AsciiString Graphic3d_GraphicDevice::ShrEnvString() const
|
||||
{
|
||||
OSD_Environment aEnvShr ("CSF_GraphicShr");
|
||||
if (!aEnvShr.Value().IsEmpty())
|
||||
{
|
||||
return aEnvShr.Value();
|
||||
}
|
||||
|
||||
// load TKOpenGl using default searching mechanisms in system
|
||||
#if defined(__hpux) || defined(HPUX)
|
||||
return TCollection_AsciiString ("libTKOpenGl.sl");
|
||||
#elif defined(__APPLE__)
|
||||
return TCollection_AsciiString ("libTKOpenGl.dylib");
|
||||
#else
|
||||
return TCollection_AsciiString ("libTKOpenGl.so");
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif // !WNT
|
@ -57,6 +57,7 @@ uses
|
||||
Handle from Aspect,
|
||||
Display from Aspect,
|
||||
PrintAlgo from Aspect,
|
||||
DisplayConnection_Handle from Aspect,
|
||||
|
||||
AspectLine3d from Graphic3d,
|
||||
AspectMarker3d from Graphic3d,
|
||||
@ -107,17 +108,11 @@ is
|
||||
-- Category: Init methods
|
||||
-------------------------
|
||||
|
||||
Begin ( me : mutable;
|
||||
ADisplay : CString from Standard )
|
||||
returns Boolean from Standard
|
||||
is deferred;
|
||||
---Purpose: call_togl_begin
|
||||
|
||||
Begin ( me : mutable;
|
||||
ADisplay : Display from Aspect )
|
||||
returns Boolean from Standard
|
||||
is deferred;
|
||||
---Purpose: call_togl_begin_display
|
||||
Begin (me: mutable;
|
||||
theDisplayConnection: DisplayConnection_Handle from Aspect)
|
||||
returns Boolean from Standard
|
||||
is deferred;
|
||||
---Purpose: Starts graphic driver with given connection
|
||||
|
||||
End ( me : mutable )
|
||||
is deferred;
|
||||
@ -1071,9 +1066,16 @@ is
|
||||
-- returns Standard_False if fails
|
||||
-- ABD Integration support of system fonts (using FTGL and FreeType)
|
||||
|
||||
GetDisplayConnection (me)
|
||||
returns DisplayConnection_Handle from Aspect;
|
||||
---C++: return const &
|
||||
|
||||
---Purpose: returns Handle to display connection
|
||||
|
||||
fields
|
||||
|
||||
MyTraceLevel : Integer from Standard is protected;
|
||||
MySharedLibrary : SharedLibrary from OSD is protected;
|
||||
MyTraceLevel : Integer from Standard is protected;
|
||||
MySharedLibrary : SharedLibrary from OSD is protected;
|
||||
myDisplayConnection: DisplayConnection_Handle from Aspect is protected;
|
||||
|
||||
end GraphicDriver from Graphic3d;
|
||||
|
@ -237,3 +237,8 @@ Standard_Integer Graphic3d_GraphicDriver::Trace () const {
|
||||
return MyTraceLevel;
|
||||
|
||||
}
|
||||
|
||||
const Handle(Aspect_DisplayConnection)& Graphic3d_GraphicDriver::GetDisplayConnection() const
|
||||
{
|
||||
return myDisplayConnection;
|
||||
}
|
||||
|
@ -39,7 +39,6 @@
|
||||
#include <Graphic3d_Group.ixx>
|
||||
#include <Graphic3d_Group.pxx>
|
||||
|
||||
#include <Graphic3d_GraphicDevice.hxx>
|
||||
#include <Graphic3d_GraphicDriver.hxx>
|
||||
#include <Graphic3d_StructureManager.hxx>
|
||||
#include <Graphic3d_TransModeFlags.hxx>
|
||||
@ -101,10 +100,8 @@ MyListOfPArray()
|
||||
MyCGroup.PickId.IsSet = 0,
|
||||
MyCGroup.PickId.Value = 0;
|
||||
|
||||
Handle(Aspect_GraphicDriver) agd =
|
||||
((MyStructure->StructureManager ())->GraphicDevice ())->GraphicDriver ();
|
||||
MyGraphicDriver = (MyStructure->StructureManager())->GraphicDriver();
|
||||
|
||||
MyGraphicDriver = *(Handle(Graphic3d_GraphicDriver) *) &agd;
|
||||
|
||||
MyGraphicDriver->Group (MyCGroup);
|
||||
|
||||
|
@ -90,7 +90,6 @@
|
||||
#include <Graphic3d_Structure.ixx>
|
||||
#include <Graphic3d_Structure.pxx>
|
||||
|
||||
#include <Graphic3d_GraphicDevice.hxx>
|
||||
#include <Graphic3d_GraphicDriver.hxx>
|
||||
#include <Graphic3d_MaterialAspect.hxx>
|
||||
|
||||
@ -191,11 +190,8 @@ MyHighlightColor (Quantity_NOC_WHITE)
|
||||
MyCStructure.TransformPersistence.Point.y = 0.0;
|
||||
MyCStructure.TransformPersistence.Point.z = 0.0;
|
||||
/* ABD 29/10/04 Transform Persistence of Presentation( pan, zoom, rotate ) */
|
||||
Handle(Aspect_GraphicDriver) agd =
|
||||
(AManager->GraphicDevice ())->GraphicDriver ();
|
||||
|
||||
MyGraphicDriver = *(Handle(Graphic3d_GraphicDriver) *) &agd;
|
||||
|
||||
MyGraphicDriver = AManager->GraphicDriver();
|
||||
MyGraphicDriver->Structure (MyCStructure);
|
||||
|
||||
#ifdef TRACE
|
||||
|
@ -41,7 +41,6 @@ uses
|
||||
SequenceOfInteger from TColStd,
|
||||
|
||||
GenId from Aspect,
|
||||
GraphicDevice from Aspect,
|
||||
TypeOfHighlightMethod from Aspect,
|
||||
TypeOfUpdate from Aspect,
|
||||
|
||||
@ -52,7 +51,8 @@ uses
|
||||
AspectText3d from Graphic3d,
|
||||
Structure from Graphic3d,
|
||||
MapOfStructure from Graphic3d,
|
||||
SequenceOfStructure from Graphic3d
|
||||
SequenceOfStructure from Graphic3d,
|
||||
GraphicDriver from Graphic3d
|
||||
|
||||
raises
|
||||
|
||||
@ -60,7 +60,7 @@ raises
|
||||
|
||||
is
|
||||
|
||||
Initialize ( aDevice : GraphicDevice from Aspect )
|
||||
Initialize ( theDriver: GraphicDriver from Graphic3d )
|
||||
---Level: Public
|
||||
---Purpose: Initialises the ViewManager.
|
||||
-- Currently creating of more than 100 viewer instances
|
||||
@ -411,11 +411,12 @@ is
|
||||
---Purpose: Transforms the structure <AStructure>.
|
||||
---Category: Private methods
|
||||
|
||||
GraphicDevice ( me )
|
||||
returns GraphicDevice from Aspect;
|
||||
GraphicDriver ( me )
|
||||
returns GraphicDriver from Graphic3d;
|
||||
---Level: Internal
|
||||
---Purpose: Returns the graphic device of <me>.
|
||||
---Purpose: Returns the graphic driver of <me>.
|
||||
---Category: Private methods
|
||||
---C++: return const &
|
||||
|
||||
Invisible ( me : mutable;
|
||||
AStructure : Structure from Graphic3d )
|
||||
@ -530,7 +531,7 @@ fields
|
||||
MyStructGenId : GenId from Aspect is protected;
|
||||
|
||||
|
||||
MyGraphicDevice : GraphicDevice from Aspect is protected;
|
||||
MyGraphicDriver : GraphicDriver from Graphic3d is protected;
|
||||
|
||||
friends
|
||||
|
||||
|
@ -77,7 +77,7 @@ static Standard_Integer StructureManager_CurrentId = 0;
|
||||
|
||||
//-Constructors
|
||||
|
||||
Graphic3d_StructureManager::Graphic3d_StructureManager (const Handle(Aspect_GraphicDevice)& aDevice):
|
||||
Graphic3d_StructureManager::Graphic3d_StructureManager (const Handle(Graphic3d_GraphicDriver)& theDriver):
|
||||
MyDisplayedStructure (),
|
||||
MyHighlightedStructure (),
|
||||
MyVisibleStructure (),
|
||||
@ -130,7 +130,7 @@ Standard_Integer Limit = Graphic3d_StructureManager::Limit ();
|
||||
MyAspectFillArea3d = new Graphic3d_AspectFillArea3d ();
|
||||
|
||||
MyUpdateMode = Aspect_TOU_WAIT;
|
||||
MyGraphicDevice = aDevice;
|
||||
MyGraphicDriver = theDriver;
|
||||
|
||||
}
|
||||
|
||||
@ -392,8 +392,8 @@ Standard_Integer Graphic3d_StructureManager::CurrentId () {
|
||||
|
||||
}
|
||||
|
||||
Handle(Aspect_GraphicDevice) Graphic3d_StructureManager::GraphicDevice () const {
|
||||
const Handle(Graphic3d_GraphicDriver)& Graphic3d_StructureManager::GraphicDriver () const {
|
||||
|
||||
return (MyGraphicDevice);
|
||||
return (MyGraphicDriver);
|
||||
|
||||
}
|
||||
|
@ -19,7 +19,6 @@
|
||||
// and conditions governing the rights and limitations under the License.
|
||||
|
||||
#include <Graphic3d_TextureRoot.ixx>
|
||||
#include <Graphic3d_GraphicDevice.hxx>
|
||||
#include <Graphic3d_GraphicDriver.hxx>
|
||||
|
||||
#include <Image_AlienPixMap.hxx>
|
||||
|
@ -1,82 +0,0 @@
|
||||
-- Created on: 1996-02-15
|
||||
-- Created by: PLOTNIKOV Eugeny
|
||||
-- Copyright (c) 1996-1999 Matra Datavision
|
||||
-- Copyright (c) 1999-2012 OPEN CASCADE SAS
|
||||
--
|
||||
-- The content of this file is subject to the Open CASCADE Technology Public
|
||||
-- License Version 6.5 (the "License"). You may not use the content of this file
|
||||
-- except in compliance with the License. Please obtain a copy of the License
|
||||
-- at http://www.opencascade.org and read it completely before using this file.
|
||||
--
|
||||
-- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
|
||||
-- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
|
||||
--
|
||||
-- The Original Code and all software distributed under the License is
|
||||
-- distributed on an "AS IS" basis, without warranty of any kind, and the
|
||||
-- Initial Developer hereby disclaims all such warranties, including without
|
||||
-- limitation, any warranties of merchantability, fitness for a particular
|
||||
-- purpose or non-infringement. Please see the License for the specific terms
|
||||
-- and conditions governing the rights and limitations under the License.
|
||||
|
||||
|
||||
class WNTGraphicDevice from Graphic3d inherits GraphicDevice from WNT
|
||||
|
||||
---Purpose: This class initializes a Windows NT Graphic Device.
|
||||
|
||||
uses
|
||||
|
||||
Color from Quantity,
|
||||
ColorRef from WNT,
|
||||
Long from WNT,
|
||||
SharedLibrary from OSD,
|
||||
GraphicDriver from Aspect,
|
||||
GraphicDriver from Graphic3d
|
||||
|
||||
raises
|
||||
|
||||
GraphicDeviceDefinitionError from Aspect
|
||||
|
||||
is
|
||||
|
||||
Create
|
||||
returns mutable WNTGraphicDevice from Graphic3d
|
||||
---Purpose: Creates a class instance and provide initialization
|
||||
-- of the graphic library.
|
||||
-- Warning: Raises if something wrong.
|
||||
raises GraphicDeviceDefinitionError from Aspect;
|
||||
|
||||
Create ( graphicLib : CString from Standard )
|
||||
returns mutable WNTGraphicDevice from Graphic3d
|
||||
---Purpose: Creates a class instance and provide initialization
|
||||
-- of the graphic library defined by "graphicLib".
|
||||
-- Warning: Raises if something wrong.
|
||||
raises GraphicDeviceDefinitionError from Aspect;
|
||||
|
||||
Destroy ( me : mutable )
|
||||
is redefined static;
|
||||
---Purpose: Destroys all resources attached to the graphic device.
|
||||
---C++: alias~
|
||||
|
||||
GraphicDriver ( me )
|
||||
returns GraphicDriver from Aspect
|
||||
is redefined static;
|
||||
---Level: Public
|
||||
---Purpose: Returns the GraphicDriver.
|
||||
|
||||
SetGraphicDriver ( me : mutable )
|
||||
is private;
|
||||
---Level: Internal
|
||||
---Purpose: Sets the GraphicDriver.
|
||||
|
||||
SetGraphicDriver ( me : mutable;
|
||||
graphicLib : CString from Standard )
|
||||
is private;
|
||||
---Level: Internal
|
||||
---Purpose: Sets the GraphicDriver defined by "graphicLib".
|
||||
|
||||
fields
|
||||
|
||||
MyGraphicDriver : GraphicDriver from Graphic3d;
|
||||
MySharedLibrary : SharedLibrary from OSD;
|
||||
|
||||
end WNTGraphicDevice;
|
@ -1,123 +0,0 @@
|
||||
// Copyright (c) 1996-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2012 OPEN CASCADE SAS
|
||||
//
|
||||
// The content of this file is subject to the Open CASCADE Technology Public
|
||||
// License Version 6.5 (the "License"). You may not use the content of this file
|
||||
// except in compliance with the License. Please obtain a copy of the License
|
||||
// at http://www.opencascade.org and read it completely before using this file.
|
||||
//
|
||||
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
|
||||
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
|
||||
//
|
||||
// The Original Code and all software distributed under the License is
|
||||
// distributed on an "AS IS" basis, without warranty of any kind, and the
|
||||
// Initial Developer hereby disclaims all such warranties, including without
|
||||
// limitation, any warranties of merchantability, fitness for a particular
|
||||
// purpose or non-infringement. Please see the License for the specific terms
|
||||
// and conditions governing the rights and limitations under the License.
|
||||
|
||||
|
||||
#if (defined(_WIN32) || defined(__WIN32__))
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <Graphic3d_WNTGraphicDevice.ixx>
|
||||
#include <InterfaceGraphic_wntio.hxx>
|
||||
#include <OSD_Environment.hxx>
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
|
||||
// =======================================================================
|
||||
// function : Graphic3d_WNTGraphicDevice
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Graphic3d_WNTGraphicDevice::Graphic3d_WNTGraphicDevice()
|
||||
: WNT_GraphicDevice (Standard_True)
|
||||
{
|
||||
SetGraphicDriver();
|
||||
if (!MyGraphicDriver->Begin (""))
|
||||
Aspect_GraphicDeviceDefinitionError::Raise ("Cannot connect to graphic library");
|
||||
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : Graphic3d_WNTGraphicDevice
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Graphic3d_WNTGraphicDevice::Graphic3d_WNTGraphicDevice (const Standard_CString theGraphicLib)
|
||||
: WNT_GraphicDevice (Standard_True)
|
||||
{
|
||||
SetGraphicDriver (theGraphicLib);
|
||||
if (!MyGraphicDriver->Begin (""))
|
||||
Aspect_GraphicDeviceDefinitionError::Raise ("Cannot connect to graphic library");
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : Destroy
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Graphic3d_WNTGraphicDevice::Destroy()
|
||||
{
|
||||
MyGraphicDriver->End();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : GraphicDriver
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Handle(Aspect_GraphicDriver) Graphic3d_WNTGraphicDevice::GraphicDriver() const
|
||||
{
|
||||
return MyGraphicDriver;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SetGraphicDriver
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Graphic3d_WNTGraphicDevice::SetGraphicDriver()
|
||||
{
|
||||
Standard_CString aLibPath = getenv ("CSF_GraphicShr");
|
||||
if (aLibPath == NULL || strlen (aLibPath) == 0)
|
||||
aLibPath = "TKOpenGl.dll";
|
||||
|
||||
SetGraphicDriver (aLibPath);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SetGraphicDriver
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Graphic3d_WNTGraphicDevice::SetGraphicDriver (const Standard_CString theGraphicLib)
|
||||
{
|
||||
MyGraphicDriver.Nullify();
|
||||
|
||||
// load the library
|
||||
MySharedLibrary.SetName (theGraphicLib);
|
||||
if (!MySharedLibrary.DlOpen (OSD_RTLD_LAZY))
|
||||
{
|
||||
Aspect_GraphicDeviceDefinitionError::Raise (MySharedLibrary.DlError());
|
||||
}
|
||||
|
||||
// management of traces
|
||||
OSD_Environment aTraceEnv ("CSF_GraphicTrace");
|
||||
TCollection_AsciiString aTrace = aTraceEnv.Value();
|
||||
if (aTrace.Length() > 0)
|
||||
cout << "Information : " << theGraphicLib << " loaded\n" << flush;
|
||||
|
||||
// retrieve factory function pointer
|
||||
typedef Handle(Graphic3d_GraphicDriver) (*GET_DRIVER_PROC) (const char* );
|
||||
GET_DRIVER_PROC aGraphicDriverConstructor = (GET_DRIVER_PROC )MySharedLibrary.DlSymb ("MetaGraphicDriverFactory");
|
||||
if (aGraphicDriverConstructor == NULL)
|
||||
{
|
||||
Aspect_GraphicDeviceDefinitionError::Raise (MySharedLibrary.DlError());
|
||||
return;
|
||||
}
|
||||
|
||||
// create driver instance
|
||||
MyGraphicDriver = aGraphicDriverConstructor (theGraphicLib);
|
||||
|
||||
// management of traces
|
||||
if (aTrace.Length() > 0 && aTrace.IsIntegerValue())
|
||||
MyGraphicDriver->SetTrace (aTrace.IntegerValue());
|
||||
}
|
||||
|
||||
#endif // WNT
|
@ -21,7 +21,7 @@
|
||||
|
||||
#ifdef WNT
|
||||
#include <InterfaceGraphic_WNT.hxx>
|
||||
#elif defined(__APPLE__)
|
||||
#elif defined(__APPLE__) && !defined(MACOSX_USE_GLX)
|
||||
#include <InterfaceGraphic_Cocoa.hxx>
|
||||
#else
|
||||
#include <InterfaceGraphic_X11.hxx>
|
||||
|
@ -48,7 +48,7 @@ namespace
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
OpenGl_Display::OpenGl_Display (const Standard_CString theDisplay)
|
||||
OpenGl_Display::OpenGl_Display (const Handle(Aspect_DisplayConnection)& theDisplayConnection)
|
||||
: myDisplay(NULL),
|
||||
myFacilities(myDefaultFacilities),
|
||||
myDBuffer(Standard_True),
|
||||
@ -66,43 +66,7 @@ OpenGl_Display::OpenGl_Display (const Standard_CString theDisplay)
|
||||
#if (defined(_WIN32) || defined(__WIN32__)) || (defined(__APPLE__) && !defined(MACOSX_USE_GLX))
|
||||
myDisplay = TheDummyDisplay;
|
||||
#else
|
||||
if (theDisplay != NULL && *theDisplay != '\0')
|
||||
{
|
||||
OSD_Environment aDispEnv ("DISPLAY", theDisplay);
|
||||
aDispEnv.Build();
|
||||
}
|
||||
|
||||
// Specifies the hardware display name, which determines the
|
||||
// display and communications domain to be used.
|
||||
// On a POSIX system, if the display_name is NULL, it defaults
|
||||
// to the value of the DISPLAY environment variable.
|
||||
myDisplay = XOpenDisplay (NULL);
|
||||
#endif
|
||||
|
||||
Init();
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
OpenGl_Display::OpenGl_Display (const Aspect_Display theDisplay)
|
||||
: myDisplay(NULL),
|
||||
myFacilities(myDefaultFacilities),
|
||||
myDBuffer(Standard_True),
|
||||
myDither(Standard_True),
|
||||
myBackDither(Standard_False),
|
||||
myWalkthrough(Standard_False),
|
||||
mySymPerspective(Standard_False),
|
||||
myOffsetFactor(1.F),
|
||||
myOffsetUnits(0.F),
|
||||
myAntiAliasingMode(3),
|
||||
myLinestyleBase(0),
|
||||
myPatternBase(0),
|
||||
myMarkerBase(0)
|
||||
{
|
||||
#if (defined(_WIN32) || defined(__WIN32__))
|
||||
myDisplay = TheDummyDisplay;
|
||||
#else
|
||||
myDisplay = theDisplay;
|
||||
myDisplay = theDisplayConnection->GetDisplay();
|
||||
#endif
|
||||
|
||||
Init();
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include <NCollection_DataMap.hxx>
|
||||
|
||||
#include <Aspect_Display.hxx>
|
||||
#include <Aspect_DisplayConnection.hxx>
|
||||
#include <Aspect_Drawable.hxx>
|
||||
#include <Aspect_TypeOfLine.hxx>
|
||||
#include <Aspect_TypeOfMarker.hxx>
|
||||
@ -65,8 +66,7 @@ struct OpenGl_TextParam;
|
||||
class OpenGl_Display : public MMgt_TShared
|
||||
{
|
||||
public:
|
||||
OpenGl_Display (const Standard_CString ADisplay);
|
||||
OpenGl_Display (const Aspect_Display ADisplay);
|
||||
OpenGl_Display (const Handle(Aspect_DisplayConnection)& theDisplayConnection);
|
||||
virtual ~OpenGl_Display ();
|
||||
|
||||
Aspect_Display GetDisplay () const { return myDisplay; }
|
||||
|
@ -36,6 +36,7 @@
|
||||
#include <Handle_OpenGl_Workspace.hxx>
|
||||
|
||||
#include <Aspect_Display.hxx>
|
||||
#include <Aspect_DisplayConnection.hxx>
|
||||
#include <Aspect_GradientFillMethod.hxx>
|
||||
#include <Aspect_FillMethod.hxx>
|
||||
#include <Aspect_CLayer2d.hxx>
|
||||
@ -89,8 +90,7 @@ public:
|
||||
//! Constructor
|
||||
Standard_EXPORT OpenGl_GraphicDriver (const Standard_CString theShrName);
|
||||
|
||||
Standard_EXPORT Standard_Boolean Begin (const Standard_CString ADisplay);
|
||||
Standard_EXPORT Standard_Boolean Begin (const Aspect_Display ADisplay);
|
||||
Standard_EXPORT Standard_Boolean Begin (const Handle(Aspect_DisplayConnection)& theDisplayConnection);
|
||||
Standard_EXPORT void End ();
|
||||
Standard_EXPORT Standard_Integer InquireLightLimit ();
|
||||
Standard_EXPORT void InquireMat (const Graphic3d_CView& ACView, TColStd_Array2OfReal& AMatO, TColStd_Array2OfReal& AMatM);
|
||||
|
@ -28,32 +28,15 @@
|
||||
|
||||
//=======================================================================
|
||||
//function : Begin
|
||||
//purpose :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean OpenGl_GraphicDriver::Begin (const Standard_CString ADisplay)
|
||||
Standard_Boolean OpenGl_GraphicDriver::Begin (const Handle(Aspect_DisplayConnection)& theDisplayConnection)
|
||||
{
|
||||
myDisplayConnection = theDisplayConnection;
|
||||
try
|
||||
{
|
||||
openglDisplay = new OpenGl_Display(ADisplay);
|
||||
return Standard_True;
|
||||
}
|
||||
catch (Standard_Failure)
|
||||
{
|
||||
}
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Begin
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean OpenGl_GraphicDriver::Begin (const Aspect_Display ADisplay)
|
||||
{
|
||||
try
|
||||
{
|
||||
openglDisplay = new OpenGl_Display(ADisplay);
|
||||
openglDisplay = new OpenGl_Display (myDisplayConnection);
|
||||
return Standard_True;
|
||||
}
|
||||
catch (Standard_Failure)
|
||||
|
@ -34,24 +34,23 @@
|
||||
#include <TColStd_ListIteratorOfListOfInteger.hxx>
|
||||
#include <TColStd_HSequenceOfReal.hxx>
|
||||
#include <AIS_InteractiveContext.hxx>
|
||||
#include <Graphic3d_GraphicDevice.hxx>
|
||||
#include <Draw.hxx>
|
||||
#include <Draw_Window.hxx>
|
||||
#include <Draw_Viewer.hxx>
|
||||
#include <Aspect_WindowDriver.hxx>
|
||||
#include <stdio.h>
|
||||
#include <Aspect_DisplayConnection.hxx>
|
||||
#include <Graphic3d.hxx>
|
||||
|
||||
#if ! defined(WNT)
|
||||
#include <Xw_Window.hxx>
|
||||
//#include <Xm/Xm.h>
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
#include <Xw_GraphicDevice.hxx>
|
||||
#include <Xw_Cextern.hxx>
|
||||
#include <unistd.h>
|
||||
#else
|
||||
#include <WNT.h>
|
||||
#include <WNT_GraphicDevice.hxx>
|
||||
#include <WNT_Window.hxx>
|
||||
#include <io.h>
|
||||
#endif
|
||||
@ -479,14 +478,15 @@ static Standard_Integer QAAISGetColorCoord (Draw_Interpretor& di, Standard_Integ
|
||||
Standard_Integer QAAIS_WindowSize_X = 0;
|
||||
Standard_Integer QAAIS_WindowSize_Y = 0;
|
||||
QAAISWindow->Size(QAAIS_WindowSize_X, QAAIS_WindowSize_Y);
|
||||
Handle (Graphic3d_GraphicDevice) QAAIS_GraphicDevice = new Graphic3d_GraphicDevice (getenv ("DISPLAY"));
|
||||
Handle(Aspect_DisplayConnection) aDisplayConnection = new Aspect_DisplayConnection();
|
||||
Handle(Graphic3d_GraphicDriver) aGraphicDriver = Graphic3d::InitGraphicDriver (aDisplayConnection);
|
||||
|
||||
Draw_Window QAAIS_CoordWindow ("coordinate", 421, 205, 200, 60);
|
||||
QAAIS_CoordWindow.DisplayWindow ();
|
||||
QAAIS_CoordWindow.SetColor (12);
|
||||
|
||||
Handle (Xw_Window) QAAIS_ColorWindow = new Xw_Window (QAAIS_GraphicDevice, "color", 0.4074, 0.678, 0.1962, 0.06, Xw_WQ_3DQUALITY, Quantity_NOC_BLACK);
|
||||
Handle (V3d_Viewer) QAAIS_ColorViewer = new V3d_Viewer (QAAIS_GraphicDevice, Standard_ExtString ("COLOR"));
|
||||
Handle (Xw_Window) QAAIS_ColorWindow = new Xw_Window (aDisplayConnection, "color", 0.4074, 0.678, 0.1962, 0.06, Quantity_NOC_BLACK);
|
||||
Handle (V3d_Viewer) QAAIS_ColorViewer = new V3d_Viewer (aGraphicDriver, Standard_ExtString ("COLOR"));
|
||||
Handle (V3d_View) QAAIS_ColorView = QAAIS_ColorViewer -> CreateView ();
|
||||
QAAIS_ColorWindow -> Map ();
|
||||
QAAIS_ColorView -> SetWindow (QAAIS_ColorWindow);
|
||||
|
@ -1594,26 +1594,6 @@ is
|
||||
-- extension must be one of ".png",".bmp",".jpg",".gif".
|
||||
-- Returns FALSE when the dump has failed
|
||||
|
||||
Dump ( me: mutable;
|
||||
theFile : CString from Standard;
|
||||
theFormat : FormatOfSheetPaper from Aspect;
|
||||
theBufferType : BufferType from Graphic3d = Graphic3d_BT_RGB )
|
||||
returns Boolean from Standard;
|
||||
---Level: Public
|
||||
---Purpose: dump the full contents of the view with a
|
||||
-- different scale according to the required sheet
|
||||
-- paper size (format) and the ratio
|
||||
-- width/height of the view.
|
||||
-- and returns FALSE when the dump has failed
|
||||
-- Warning : the file name extension must be one of
|
||||
-- ".png",".bmp",".jpg",".gif"
|
||||
-- but make becarefull about the time to dump and
|
||||
-- resulting file size especially for the A0 format.
|
||||
-- NOTE that you can use after any standard system utility
|
||||
-- for editing or sending the image file to a laser printer.
|
||||
-- (i.e: Microsoft Photo Editor on Windows system
|
||||
-- or Image Viewer on SUN system)
|
||||
|
||||
Print (me; hPrnDC: Handle from Aspect = NULL;
|
||||
showDialog: Boolean = Standard_True;
|
||||
showBackground : Boolean = Standard_True;
|
||||
|
@ -3309,37 +3309,6 @@ Standard_Boolean V3d_View::Dump (const Standard_CString theFile,
|
||||
return ToPixMap (anImage, aWinWidth, aWinHeight, theBufferType) && anImage.Save (theFile);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
Standard_Boolean V3d_View::Dump (const Standard_CString theFile,
|
||||
const Aspect_FormatOfSheetPaper theFormat,
|
||||
const Graphic3d_BufferType& theBufferType)
|
||||
{
|
||||
// convert Aspect_FormatOfSheetPaper size to pixel ...
|
||||
Quantity_Length anSPWidth, anSPHeight;
|
||||
Aspect::ValuesOfFOSP (theFormat, anSPWidth, anSPHeight);
|
||||
|
||||
// adjusting to the ratio width/height ...
|
||||
Quantity_Length aWinWidth, aWinHeight;
|
||||
MyWindow->MMSize (aWinWidth, aWinHeight);
|
||||
Standard_Integer aPixelWidth, aPixelHeight;
|
||||
MyWindow->Size (aPixelWidth, aPixelHeight);
|
||||
|
||||
Quantity_Factor aScale = Min (anSPWidth / aWinWidth, anSPHeight / aWinHeight);
|
||||
aPixelWidth = Standard_Integer (aPixelWidth * aScale);
|
||||
aPixelHeight = Standard_Integer (aPixelHeight * aScale);
|
||||
|
||||
Image_AlienPixMap anImage;
|
||||
ToPixMap (anImage, aPixelWidth, aPixelHeight, theBufferType);
|
||||
OSD_Environment anEnvGamma ("CSF_GAMMA_CORRECTION");
|
||||
TCollection_AsciiString strGamma (anEnvGamma.Value());
|
||||
if (!anImage.IsEmpty() && !strGamma.IsEmpty())
|
||||
{
|
||||
Standard_Real aGammaValue = strGamma.RealValue();
|
||||
anImage.AdjustGamma (aGammaValue);
|
||||
}
|
||||
return anImage.Save (theFile);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
Standard_Boolean V3d_View::ToPixMap (Image_PixMap& theImage,
|
||||
const Standard_Integer theWidth,
|
||||
|
@ -47,7 +47,7 @@ inherits
|
||||
|
||||
uses
|
||||
|
||||
GraphicDevice from Aspect,
|
||||
GraphicDriver from Graphic3d,
|
||||
TypeOfUpdate from V3d,
|
||||
TypeOfVisualization from V3d,
|
||||
TypeOfShadingModel from V3d,
|
||||
@ -90,7 +90,7 @@ raises
|
||||
|
||||
is
|
||||
|
||||
Create ( Device : GraphicDevice from Aspect;
|
||||
Create ( theDriver : GraphicDriver from Graphic3d;
|
||||
aName : ExtString from Standard;
|
||||
aDomain : CString from Standard = "";
|
||||
ViewSize : Length from Quantity = 1000.0 ;
|
||||
@ -103,7 +103,7 @@ is
|
||||
DefaultComputedMode: Boolean from Standard = Standard_True;
|
||||
SurfaceDetail : TypeOfSurfaceDetail from V3d = V3d_TEX_NONE)
|
||||
returns mutable Viewer from V3d
|
||||
---Purpose: Create a Viewer on the given device with the given parameters or
|
||||
---Purpose: Create a Viewer with the given graphic driver and the given parameters or
|
||||
-- with their default values.
|
||||
-- Currently creating of more than 100 viewer instances
|
||||
-- is not supported and leads to an exception.
|
||||
@ -112,9 +112,7 @@ is
|
||||
---Purpose: If the size of the view is <= 0
|
||||
-- if ComputedMode is false, only the degenerate mode will be used.
|
||||
--
|
||||
-- Warning: Client must creates a graphic-device of type
|
||||
-- Graphic3d_GraphicDevice under UNIX
|
||||
-- or Graphic3d_WNTGraphicDevice under WindowsNT
|
||||
-- Warning: Client must creates a graphic driver
|
||||
|
||||
CreateView (me: mutable) returns mutable View from V3d;
|
||||
---Level: Public
|
||||
|
@ -49,15 +49,12 @@
|
||||
#include <Viewer_BadValue.hxx>
|
||||
#include <V3d_OrthographicView.hxx>
|
||||
#include <V3d_PerspectiveView.hxx>
|
||||
#ifdef WNT
|
||||
#include <WNT_GraphicDevice.hxx>
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
//-Constructor:
|
||||
V3d_Viewer::V3d_Viewer(const Handle(Aspect_GraphicDevice)& Device , const Standard_ExtString aName, const Standard_CString aDomain,const Standard_Real ViewSize , const V3d_TypeOfOrientation ViewProj , const Quantity_NameOfColor ViewBackground , const V3d_TypeOfVisualization Visualization , const V3d_TypeOfShadingModel ShadingModel , const V3d_TypeOfUpdate UpdateMode, const Standard_Boolean ComputedMode , const Standard_Boolean DefaultComputedMode , const V3d_TypeOfSurfaceDetail SurfaceDetail )
|
||||
:Viewer_Viewer(Device,aName,aDomain,-1),
|
||||
V3d_Viewer::V3d_Viewer(const Handle(Graphic3d_GraphicDriver)& theDriver , const Standard_ExtString aName, const Standard_CString aDomain,const Standard_Real ViewSize , const V3d_TypeOfOrientation ViewProj , const Quantity_NameOfColor ViewBackground , const V3d_TypeOfVisualization Visualization , const V3d_TypeOfShadingModel ShadingModel , const V3d_TypeOfUpdate UpdateMode, const Standard_Boolean ComputedMode , const Standard_Boolean DefaultComputedMode , const V3d_TypeOfSurfaceDetail SurfaceDetail )
|
||||
:Viewer_Viewer(theDriver,aName,aDomain,-1),
|
||||
MyDefinedViews(),
|
||||
MyActiveViews(),
|
||||
MyDefinedLights(),
|
||||
@ -78,7 +75,7 @@ myDisplayPlaneLength(ViewSize)
|
||||
#endif
|
||||
{
|
||||
|
||||
MyViewer = new Visual3d_ViewManager(Device) ;
|
||||
MyViewer = new Visual3d_ViewManager(theDriver) ;
|
||||
// san (16/09/2010): It has been decided to turn depth test ON
|
||||
// by default, as this is important for new font rendering
|
||||
// (without it, there are numerous texture rendering artefacts)
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
package Viewer
|
||||
|
||||
uses MMgt,TCollection,Aspect,Quantity
|
||||
uses MMgt,TCollection,Graphic3d,Quantity
|
||||
|
||||
is
|
||||
|
||||
|
@ -23,10 +23,10 @@ deferred class Viewer from Viewer inherits TShared from MMgt
|
||||
|
||||
uses
|
||||
AsciiString,ExtendedString from TCollection,
|
||||
GraphicDevice from Aspect
|
||||
GraphicDriver from Graphic3d
|
||||
|
||||
is
|
||||
Initialize( aDevice: GraphicDevice from Aspect;
|
||||
Initialize( aDriver: GraphicDriver from Graphic3d;
|
||||
aName: ExtString from Standard;
|
||||
aDomain: CString from Standard;
|
||||
aNextCount: Integer from Standard);
|
||||
@ -34,8 +34,9 @@ is
|
||||
Update(me: mutable) is deferred;
|
||||
|
||||
|
||||
Device(me) returns mutable GraphicDevice from Aspect
|
||||
Driver(me) returns mutable GraphicDriver from Graphic3d
|
||||
is static;
|
||||
---C++: return const &
|
||||
|
||||
NextName(me) returns ExtString from Standard
|
||||
is static;
|
||||
@ -49,5 +50,5 @@ fields
|
||||
myNextCount: Integer from Standard;
|
||||
myDomain: AsciiString from TCollection;
|
||||
myName: ExtendedString from TCollection;
|
||||
myDevice: GraphicDevice from Aspect;
|
||||
myDriver: GraphicDriver from Graphic3d;
|
||||
end Viewer from Viewer;
|
||||
|
@ -31,21 +31,21 @@ return nm;
|
||||
#define nm _nm()
|
||||
#endif // LOPTIM
|
||||
|
||||
Viewer_Viewer::Viewer_Viewer(const Handle(Aspect_GraphicDevice)& aDevice,
|
||||
Viewer_Viewer::Viewer_Viewer(const Handle(Graphic3d_GraphicDriver)& theDriver,
|
||||
const Standard_ExtString aName,
|
||||
const Standard_CString aDomain,
|
||||
const Standard_Integer aNextCount)
|
||||
:myNextCount(aNextCount),
|
||||
myDomain(TCollection_AsciiString(aDomain)),
|
||||
myName(TCollection_ExtendedString(aName)),
|
||||
myDevice(aDevice)
|
||||
myDriver(theDriver)
|
||||
{}
|
||||
|
||||
Standard_CString Viewer_Viewer::Domain() const {
|
||||
return myDomain.ToCString();
|
||||
}
|
||||
Handle(Aspect_GraphicDevice) Viewer_Viewer::Device() const {
|
||||
return myDevice;
|
||||
const Handle(Graphic3d_GraphicDriver)& Viewer_Viewer::Driver() const {
|
||||
return myDriver;
|
||||
}
|
||||
|
||||
Standard_ExtString Viewer_Viewer::NextName () const {
|
||||
|
@ -2494,7 +2494,6 @@ static int VDrawText (Draw_Interpretor& di, Standard_Integer argc, const char**
|
||||
#include <TShort_HArray1OfShortReal.hxx>
|
||||
|
||||
#include <AIS_Triangulation.hxx>
|
||||
#include <Aspect_GraphicDevice.hxx>
|
||||
#include <StdPrs_ToolShadedShape.hxx>
|
||||
#include <Poly_Connect.hxx>
|
||||
#include <TColgp_Array1OfDir.hxx>
|
||||
|
@ -23,7 +23,6 @@
|
||||
|
||||
#include <ViewerTest.hxx>
|
||||
|
||||
#include <Aspect_GraphicDevice.hxx>
|
||||
#include <AIS_InteractiveContext.hxx>
|
||||
#include <AIS_InteractiveObject.hxx>
|
||||
#include <Draw.hxx>
|
||||
@ -217,7 +216,7 @@ static Standard_Integer VUserDraw (Draw_Interpretor& di,
|
||||
return 1;
|
||||
}
|
||||
|
||||
Handle(OpenGl_GraphicDriver) aDriver = Handle(OpenGl_GraphicDriver)::DownCast (aContext->CurrentViewer()->Device()->GraphicDriver());
|
||||
Handle(OpenGl_GraphicDriver) aDriver = Handle(OpenGl_GraphicDriver)::DownCast (aContext->CurrentViewer()->Driver());
|
||||
if (aDriver.IsNull())
|
||||
{
|
||||
std::cerr << "Graphic driver not available.\n";
|
||||
@ -411,8 +410,8 @@ static int VImmediateFront (Draw_Interpretor& theDI,
|
||||
return 1;
|
||||
}
|
||||
|
||||
Handle(Graphic3d_GraphicDriver) aDriver =
|
||||
Handle(Graphic3d_GraphicDriver)::DownCast (aContextAIS->CurrentViewer()->Device()->GraphicDriver());
|
||||
Handle(Graphic3d_GraphicDriver) aDriver = aContextAIS->CurrentViewer()->Driver();
|
||||
|
||||
if (aDriver.IsNull())
|
||||
{
|
||||
std::cerr << "Graphic driver not available.\n";
|
||||
|
@ -33,14 +33,6 @@
|
||||
#include <Draw.hxx>
|
||||
#include <Draw_Appli.hxx>
|
||||
#include <DBRep.hxx>
|
||||
#include <Graphic3d_GraphicDevice.hxx>
|
||||
#include <Xw_GraphicDevice.hxx>
|
||||
#include <Xw_WindowQuality.hxx>
|
||||
#include <Xw_Window.hxx>
|
||||
#include <Graphic3d_GraphicDevice.hxx>
|
||||
#include <Xw_GraphicDevice.hxx>
|
||||
#include <Xw_WindowQuality.hxx>
|
||||
#include <Xw_Window.hxx>
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
#include <V3d_Viewer.hxx>
|
||||
#include <V3d_View.hxx>
|
||||
@ -55,75 +47,65 @@
|
||||
#include <AIS_ListIteratorOfListOfInteractive.hxx>
|
||||
#include <AIS_ListOfInteractive.hxx>
|
||||
#include <Aspect_Window.hxx>
|
||||
#include <Aspect_DisplayConnection.hxx>
|
||||
#include <Graphic3d.hxx>
|
||||
#include <Graphic3d_GraphicDriver.hxx>
|
||||
|
||||
|
||||
#ifndef WNT
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
#else
|
||||
#if defined(_WIN32) || defined(__WIN32__)
|
||||
#include <WNT_WClass.hxx>
|
||||
#include <WNT_Window.hxx>
|
||||
#include <Graphic3d_WNTGraphicDevice.hxx>
|
||||
#elif defined(__APPLE__) && !defined(MACOSX_USE_GLX)
|
||||
#include <Cocoa_Window.hxx>
|
||||
#else
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
#include <Xw_WindowQuality.hxx>
|
||||
#include <Xw_Window.hxx>
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//==============================================================================
|
||||
// GLOBAL VARIABLES
|
||||
//==============================================================================
|
||||
#define ZCLIPWIDTH 1.
|
||||
|
||||
#ifdef WNT
|
||||
|
||||
static Handle(Graphic3d_WNTGraphicDevice) GetDevice() {
|
||||
static Handle(Graphic3d_WNTGraphicDevice) myDevice;
|
||||
static int first = 1;
|
||||
if ( first ) myDevice = new Graphic3d_WNTGraphicDevice();
|
||||
first = 0;
|
||||
return myDevice;
|
||||
static Handle(Aspect_DisplayConnection)& GetDisplayConnection()
|
||||
{
|
||||
static Handle(Aspect_DisplayConnection) aDisplayConnection;
|
||||
static Standard_Boolean isFirst = Standard_True;
|
||||
if (isFirst)
|
||||
{
|
||||
aDisplayConnection = new Aspect_DisplayConnection();
|
||||
isFirst = Standard_False;
|
||||
}
|
||||
return aDisplayConnection;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
static Handle(Graphic3d_GraphicDevice)& GetDevice() {
|
||||
static Handle(Graphic3d_GraphicDevice) myDevice;
|
||||
static int first = 1;
|
||||
if ( first ) myDevice = new Graphic3d_GraphicDevice (getenv("DISPLAY"),Xw_TOM_READONLY);
|
||||
first = 0;
|
||||
return myDevice;
|
||||
}
|
||||
|
||||
//static Display *display;
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
Standard_IMPORT Standard_Boolean Draw_VirtualWindows;
|
||||
|
||||
//=======================================================================
|
||||
//function : MakeViewer
|
||||
//purpose :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(V3d_Viewer) ViewerTest_Tool::MakeViewer (const Standard_CString theTitle)
|
||||
{
|
||||
#ifdef WNT
|
||||
Handle(Aspect_Window) window = new WNT_Window (GetDevice(), theTitle,
|
||||
#if defined(_WIN32) || defined(__WIN32__)
|
||||
Handle(Aspect_Window) window = new WNT_Window (theTitle,
|
||||
Handle(WNT_WClass)::DownCast (ViewerTest::WClass()),
|
||||
WS_OVERLAPPEDWINDOW, 0, 460, 409, 409, Quantity_NOC_BLACK);
|
||||
#elif defined(__APPLE__) && !defined(MACOSX_USE_GLX)
|
||||
Handle(Aspect_Window) window = new Cocoa_Window (theTitle, 0, 460, 409, 409);
|
||||
#else
|
||||
Handle(Aspect_Window) window = new Xw_Window (GetDevice(), theTitle,
|
||||
0, 460, 409, 409, Xw_WQ_3DQUALITY, Quantity_NOC_BLACK);
|
||||
Handle(Aspect_Window) window = new Xw_Window (GetDisplayConnection(), theTitle,
|
||||
0, 460, 409, 409, Quantity_NOC_BLACK);
|
||||
#endif
|
||||
window->SetVirtual (Draw_VirtualWindows);
|
||||
window->Map();
|
||||
|
||||
// Viewer
|
||||
Handle(Aspect_GraphicDevice) theDevice = GetDevice();
|
||||
Handle(Graphic3d_GraphicDriver) aDriver = Graphic3d::InitGraphicDriver (GetDisplayConnection());
|
||||
TCollection_ExtendedString NameOfWindow("Visu3D");
|
||||
Handle(V3d_Viewer) a3DViewer = new V3d_Viewer(theDevice,NameOfWindow.ToExtString());
|
||||
Handle(V3d_Viewer) a3DViewer = new V3d_Viewer(aDriver,NameOfWindow.ToExtString());
|
||||
|
||||
a3DViewer->SetDefaultBackgroundColor(Quantity_NOC_BLACK);
|
||||
a3DViewer->SetDefaultLights();
|
||||
|
@ -56,6 +56,8 @@
|
||||
#include <V3d_LayerMgrPointer.hxx>
|
||||
#include <Aspect_TypeOfLine.hxx>
|
||||
#include <Image_Diff.hxx>
|
||||
#include <Aspect_DisplayConnection.hxx>
|
||||
#include <Graphic3d.hxx>
|
||||
|
||||
#ifdef WNT
|
||||
#undef DrawText
|
||||
@ -65,7 +67,6 @@
|
||||
#include <cstdlib>
|
||||
|
||||
#if defined(_WIN32) || defined(__WIN32__)
|
||||
#include <Graphic3d_WNTGraphicDevice.hxx>
|
||||
#include <WNT_WClass.hxx>
|
||||
#include <WNT_Window.hxx>
|
||||
|
||||
@ -74,12 +75,9 @@
|
||||
#pragma warning (disable:4996)
|
||||
#endif
|
||||
#elif defined(__APPLE__) && !defined(MACOSX_USE_GLX)
|
||||
#include <Graphic3d_GraphicDevice.hxx>
|
||||
#include <Cocoa_Window.hxx>
|
||||
#include <tk.h>
|
||||
#else
|
||||
#include <Graphic3d_GraphicDevice.hxx>
|
||||
#include <Xw_GraphicDevice.hxx>
|
||||
#include <Xw_WindowQuality.hxx>
|
||||
#include <Xw_Window.hxx>
|
||||
#include <X11/Xlib.h> /* contains some dangerous #defines such as Status, True etc. */
|
||||
@ -100,21 +98,11 @@ extern const Handle(NIS_InteractiveContext)& TheNISContext();
|
||||
extern ViewerTest_DoubleMapOfInteractiveAndName& GetMapOfAIS();
|
||||
|
||||
#if defined(_WIN32) || defined(__WIN32__)
|
||||
static Handle(Graphic3d_WNTGraphicDevice)& GetG3dDevice(){
|
||||
static Handle(Graphic3d_WNTGraphicDevice) GD;
|
||||
return GD;
|
||||
}
|
||||
|
||||
static Handle(WNT_Window)& VT_GetWindow() {
|
||||
static Handle(WNT_Window) WNTWin;
|
||||
return WNTWin;
|
||||
}
|
||||
#elif defined(__APPLE__) && !defined(MACOSX_USE_GLX)
|
||||
static Handle(Graphic3d_GraphicDevice)& GetG3dDevice()
|
||||
{
|
||||
static Handle(Graphic3d_GraphicDevice) aGraphicDevice;
|
||||
return aGraphicDevice;
|
||||
}
|
||||
static Handle(Cocoa_Window)& VT_GetWindow()
|
||||
{
|
||||
static Handle(Cocoa_Window) aWindow;
|
||||
@ -122,10 +110,6 @@ static Handle(Cocoa_Window)& VT_GetWindow()
|
||||
}
|
||||
extern void ViewerTest_SetCocoaEventManagerView (const Handle(Cocoa_Window)& theWindow);
|
||||
#else
|
||||
static Handle(Graphic3d_GraphicDevice)& GetG3dDevice(){
|
||||
static Handle(Graphic3d_GraphicDevice) GD;
|
||||
return GD;
|
||||
}
|
||||
static Handle(Xw_Window)& VT_GetWindow(){
|
||||
static Handle(Xw_Window) XWWin;
|
||||
return XWWin;
|
||||
@ -135,6 +119,12 @@ static Display *display;
|
||||
static void VProcessEvents(ClientData,int);
|
||||
#endif
|
||||
|
||||
static Handle(Graphic3d_GraphicDriver)& GetGraphicDriver()
|
||||
{
|
||||
static Handle(Graphic3d_GraphicDriver) aGraphicDriver;
|
||||
return aGraphicDriver;
|
||||
}
|
||||
|
||||
static Standard_Boolean DegenerateMode = Standard_True;
|
||||
|
||||
#define ZCLIPWIDTH 1.
|
||||
@ -218,15 +208,15 @@ void ViewerTest::ViewerInit (const Standard_Integer thePxLeft, const Standard_I
|
||||
|
||||
if (isFirst)
|
||||
{
|
||||
// Create the Graphic device
|
||||
Handle(Aspect_DisplayConnection) aDisplayConnection = new Aspect_DisplayConnection();
|
||||
if (GetGraphicDriver().IsNull())
|
||||
{
|
||||
GetGraphicDriver() = Graphic3d::InitGraphicDriver (aDisplayConnection);
|
||||
}
|
||||
#if defined(_WIN32) || defined(__WIN32__)
|
||||
if (GetG3dDevice().IsNull()) GetG3dDevice() = new Graphic3d_WNTGraphicDevice();
|
||||
if (VT_GetWindow().IsNull())
|
||||
{
|
||||
// Create the Graphic device and the window
|
||||
Handle(WNT_GraphicDevice) g_Device = new WNT_GraphicDevice();
|
||||
|
||||
VT_GetWindow() = new WNT_Window (g_Device, "Test3d",
|
||||
VT_GetWindow() = new WNT_Window ("Test3d",
|
||||
Handle(WNT_WClass)::DownCast (WClass()),
|
||||
WS_OVERLAPPEDWINDOW,
|
||||
aPxLeft, aPxTop,
|
||||
@ -234,10 +224,6 @@ void ViewerTest::ViewerInit (const Standard_Integer thePxLeft, const Standard_I
|
||||
Quantity_NOC_BLACK);
|
||||
}
|
||||
#elif defined(__APPLE__) && !defined(MACOSX_USE_GLX)
|
||||
if (GetG3dDevice().IsNull())
|
||||
{
|
||||
GetG3dDevice() = new Graphic3d_GraphicDevice (getenv ("DISPLAY"), Xw_TOM_READONLY);
|
||||
}
|
||||
if (VT_GetWindow().IsNull())
|
||||
{
|
||||
VT_GetWindow() = new Cocoa_Window ("Test3d",
|
||||
@ -246,15 +232,12 @@ void ViewerTest::ViewerInit (const Standard_Integer thePxLeft, const Standard_I
|
||||
ViewerTest_SetCocoaEventManagerView (VT_GetWindow());
|
||||
}
|
||||
#else
|
||||
if (GetG3dDevice().IsNull()) GetG3dDevice() =
|
||||
new Graphic3d_GraphicDevice (getenv ("DISPLAY"), Xw_TOM_READONLY);
|
||||
if (VT_GetWindow().IsNull())
|
||||
{
|
||||
VT_GetWindow() = new Xw_Window (GetG3dDevice(),
|
||||
VT_GetWindow() = new Xw_Window (aDisplayConnection,
|
||||
"Test3d",
|
||||
aPxLeft, aPxTop,
|
||||
aPxWidth, aPxHeight,
|
||||
Xw_WQ_3DQUALITY,
|
||||
Quantity_NOC_BLACK);
|
||||
}
|
||||
#endif
|
||||
@ -265,9 +248,9 @@ void ViewerTest::ViewerInit (const Standard_Integer thePxLeft, const Standard_I
|
||||
|
||||
TCollection_ExtendedString NameOfWindow("Visu3D");
|
||||
|
||||
a3DViewer = new V3d_Viewer(GetG3dDevice(), NameOfWindow.ToExtString());
|
||||
a3DViewer = new V3d_Viewer(GetGraphicDriver(), NameOfWindow.ToExtString());
|
||||
NameOfWindow = TCollection_ExtendedString("Collector");
|
||||
a3DCollector = new V3d_Viewer(GetG3dDevice(), NameOfWindow.ToExtString());
|
||||
a3DCollector = new V3d_Viewer(GetGraphicDriver(), NameOfWindow.ToExtString());
|
||||
a3DViewer->SetDefaultBackgroundColor(Quantity_NOC_BLACK);
|
||||
a3DCollector->SetDefaultBackgroundColor(Quantity_NOC_STEELBLUE);
|
||||
Handle(NIS_View) aView = Handle(NIS_View)::DownCast(ViewerTest::CurrentView());
|
||||
@ -1359,8 +1342,7 @@ static void OSWindowSetup()
|
||||
|
||||
Window window = VT_GetWindow()->XWindow();
|
||||
|
||||
Standard_Address theDisplay = GetG3dDevice()->XDisplay();
|
||||
display = (Display * ) theDisplay;
|
||||
display = GetGraphicDriver()->GetDisplayConnection()->GetDisplay();
|
||||
// display = (Display *)GetG3dDevice()->XDisplay();
|
||||
|
||||
XSynchronize(display, 1);
|
||||
@ -1475,12 +1457,11 @@ void ViewerTest_InitViewerTest (const Handle(AIS_InteractiveContext)& context)
|
||||
Handle(V3d_View) view = viewer->ActiveView();
|
||||
if (viewer->MoreActiveViews()) ViewerTest::CurrentView(view);
|
||||
ViewerTest::ResetEventManager();
|
||||
Handle(Aspect_GraphicDevice) device = viewer->Device();
|
||||
Handle(Aspect_Window) window = view->Window();
|
||||
#if !defined(_WIN32) && !defined(__WIN32__) && (!defined(__APPLE__) || defined(MACOSX_USE_GLX))
|
||||
// X11
|
||||
VT_GetWindow() = Handle(Xw_Window)::DownCast(window);
|
||||
GetG3dDevice() = Handle(Graphic3d_GraphicDevice)::DownCast(device);
|
||||
GetGraphicDriver() = viewer->Driver();
|
||||
OSWindowSetup();
|
||||
static int first = 1;
|
||||
if ( first ) {
|
||||
@ -2851,8 +2832,8 @@ static int VVbo (Draw_Interpretor& theDI,
|
||||
return 1;
|
||||
}
|
||||
|
||||
Handle(Graphic3d_GraphicDriver) aDriver =
|
||||
Handle(Graphic3d_GraphicDriver)::DownCast (aContextAIS->CurrentViewer()->Device()->GraphicDriver());
|
||||
Handle(Graphic3d_GraphicDriver) aDriver = aContextAIS->CurrentViewer()->Driver();
|
||||
|
||||
if (aDriver.IsNull())
|
||||
{
|
||||
std::cerr << "Graphic driver not available.\n";
|
||||
@ -2888,8 +2869,8 @@ static int VMemGpu (Draw_Interpretor& theDI,
|
||||
return 1;
|
||||
}
|
||||
|
||||
Handle(Graphic3d_GraphicDriver) aDriver =
|
||||
Handle(Graphic3d_GraphicDriver)::DownCast (aContextAIS->CurrentViewer()->Device()->GraphicDriver());
|
||||
Handle(Graphic3d_GraphicDriver) aDriver = aContextAIS->CurrentViewer()->Driver();
|
||||
|
||||
if (aDriver.IsNull())
|
||||
{
|
||||
std::cerr << "Graphic driver not available.\n";
|
||||
@ -3107,21 +3088,21 @@ static int VDiffImage (Draw_Interpretor& theDI, Standard_Integer theArgNb, const
|
||||
// 1) single click selection
|
||||
// 2) selection with rectangle having corners at pixel positions (x1,y1) and (x2,y2)
|
||||
// 3) selection with polygon having corners at
|
||||
// pixel positions (x1,y1),...,(xn,yn)
|
||||
// pixel positions (x1,y1),...,(xn,yn)
|
||||
// 4) any of these selections with shift button pressed
|
||||
//=======================================================================
|
||||
static Standard_Integer VSelect (Draw_Interpretor& di,
|
||||
Standard_Integer argc,
|
||||
const char ** argv)
|
||||
{
|
||||
if(argc < 3)
|
||||
if(argc < 3)
|
||||
{
|
||||
di << "Usage : " << argv[0] << " x1 y1 [x2 y2 [... xn yn]] [shift_selection = 1|0]" << "\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
Handle(AIS_InteractiveContext) myAIScontext = ViewerTest::GetAISContext();
|
||||
if(myAIScontext.IsNull())
|
||||
if(myAIScontext.IsNull())
|
||||
{
|
||||
di << "use 'vinit' command before " << argv[0] << "\n";
|
||||
return 1;
|
||||
@ -3166,20 +3147,20 @@ static Standard_Integer VSelect (Draw_Interpretor& di,
|
||||
|
||||
//=======================================================================
|
||||
//function : VMoveTo
|
||||
//purpose : Emulates cursor movement to defined pixel position
|
||||
//purpose : Emulates cursor movement to defined pixel position
|
||||
//=======================================================================
|
||||
static Standard_Integer VMoveTo (Draw_Interpretor& di,
|
||||
Standard_Integer argc,
|
||||
const char ** argv)
|
||||
{
|
||||
if(argc != 3)
|
||||
if(argc != 3)
|
||||
{
|
||||
di << "Usage : " << argv[0] << " x y" << "\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
|
||||
if(aContext.IsNull())
|
||||
if(aContext.IsNull())
|
||||
{
|
||||
di << "use 'vinit' command before " << argv[0] << "\n";
|
||||
return 1;
|
||||
@ -3190,19 +3171,19 @@ static Standard_Integer VMoveTo (Draw_Interpretor& di,
|
||||
|
||||
//=======================================================================
|
||||
//function : VViewParams
|
||||
//purpose : Gets or sets AIS View characteristics
|
||||
//purpose : Gets or sets AIS View characteristics
|
||||
//=======================================================================
|
||||
static Standard_Integer VViewParams (Draw_Interpretor& di,
|
||||
Standard_Integer argc,
|
||||
const char ** argv)
|
||||
{
|
||||
if ( argc != 1 && argc != 13)
|
||||
if ( argc != 1 && argc != 13)
|
||||
{
|
||||
di << "Usage : " << argv[0] << "\n";
|
||||
return 1;
|
||||
}
|
||||
Handle (V3d_View) anAISView = ViewerTest::CurrentView ();
|
||||
if ( anAISView.IsNull () )
|
||||
if ( anAISView.IsNull () )
|
||||
{
|
||||
di << "use 'vinit' command before " << argv[0] << "\n";
|
||||
return 1;
|
||||
@ -3255,7 +3236,7 @@ static Standard_Integer VViewParams (Draw_Interpretor& di,
|
||||
|
||||
//=======================================================================
|
||||
//function : VChangeSelected
|
||||
//purpose : Adds the shape to selection or remove one from it
|
||||
//purpose : Adds the shape to selection or remove one from it
|
||||
//=======================================================================
|
||||
static Standard_Integer VChangeSelected (Draw_Interpretor& di,
|
||||
Standard_Integer argc,
|
||||
@ -3289,7 +3270,7 @@ static Standard_Integer VChangeSelected (Draw_Interpretor& di,
|
||||
{
|
||||
aContext->AddOrRemoveSelected(anAISObject);
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
aContext->AddOrRemoveCurrentObject(anAISObject);
|
||||
}
|
||||
@ -3299,20 +3280,20 @@ static Standard_Integer VChangeSelected (Draw_Interpretor& di,
|
||||
|
||||
//=======================================================================
|
||||
//function : VZClipping
|
||||
//purpose : Gets or sets ZClipping mode, width and depth
|
||||
//purpose : Gets or sets ZClipping mode, width and depth
|
||||
//=======================================================================
|
||||
static Standard_Integer VZClipping (Draw_Interpretor& di,
|
||||
Standard_Integer argc,
|
||||
const char ** argv)
|
||||
{
|
||||
if(argc>4)
|
||||
if(argc>4)
|
||||
{
|
||||
di << "Usage : " << argv[0] << " [mode] [depth width]" << "\n"
|
||||
<<"mode = OFF|BACK|FRONT|SLICE depth = [0..1] width = [0..1]" << "\n";
|
||||
return -1;
|
||||
}
|
||||
Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
|
||||
if(aContext.IsNull())
|
||||
if(aContext.IsNull())
|
||||
{
|
||||
di << "use 'vinit' command before " << argv[0] << "\n";
|
||||
return 1;
|
||||
@ -3372,7 +3353,7 @@ static Standard_Integer VZClipping (Draw_Interpretor& di,
|
||||
di << "Bad mode; Usage : " << argv[0] << " [mode] [depth width]" << "\n"
|
||||
<< "mode = OFF|BACK|FRONT|SLICE depth = [0..1] width = [0..1]" << "\n";
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
aView->SetZClippingType(aZClippingMode);
|
||||
}
|
||||
if(argc >2)
|
||||
@ -3388,7 +3369,7 @@ static Standard_Integer VZClipping (Draw_Interpretor& di,
|
||||
aDepth = atof(argv[2]);
|
||||
aWidth = atof(argv[3]);
|
||||
}
|
||||
|
||||
|
||||
if(aDepth<0. || aDepth>1.)
|
||||
{
|
||||
di << "Bad depth; Usage : " << argv[0] << " [mode] [depth width]" << "\n"
|
||||
@ -3412,7 +3393,7 @@ static Standard_Integer VZClipping (Draw_Interpretor& di,
|
||||
|
||||
//=======================================================================
|
||||
//function : VNbSelected
|
||||
//purpose : Returns number of selected objects
|
||||
//purpose : Returns number of selected objects
|
||||
//=======================================================================
|
||||
static Standard_Integer VNbSelected (Draw_Interpretor& di,
|
||||
Standard_Integer argc,
|
||||
@ -3435,7 +3416,7 @@ static Standard_Integer VNbSelected (Draw_Interpretor& di,
|
||||
|
||||
//=======================================================================
|
||||
//function : VAntialiasing
|
||||
//purpose : Switches altialiasing on or off
|
||||
//purpose : Switches altialiasing on or off
|
||||
//=======================================================================
|
||||
static Standard_Integer VAntialiasing (Draw_Interpretor& di,
|
||||
Standard_Integer argc,
|
||||
@ -3466,7 +3447,7 @@ static Standard_Integer VAntialiasing (Draw_Interpretor& di,
|
||||
|
||||
//=======================================================================
|
||||
//function : VPurgeDisplay
|
||||
//purpose : Switches altialiasing on or off
|
||||
//purpose : Switches altialiasing on or off
|
||||
//=======================================================================
|
||||
static Standard_Integer VPurgeDisplay (Draw_Interpretor& di,
|
||||
Standard_Integer argc,
|
||||
@ -3580,7 +3561,7 @@ static Standard_Integer VTranslateView (Draw_Interpretor& di,
|
||||
Standard_Real Dy = atof(argv[2]);
|
||||
Standard_Real Dz = atof(argv[3]);
|
||||
Standard_Boolean aStart = Standard_True;
|
||||
if (argc == 5)
|
||||
if (argc == 5)
|
||||
{
|
||||
aStart = (atoi(argv[4]) > 0);
|
||||
}
|
||||
@ -3611,7 +3592,7 @@ static Standard_Integer VTurnView (Draw_Interpretor& di,
|
||||
Standard_Real Ay = atof(argv[2]);
|
||||
Standard_Real Az = atof(argv[3]);
|
||||
Standard_Boolean aStart = Standard_True;
|
||||
if (argc == 5)
|
||||
if (argc == 5)
|
||||
{
|
||||
aStart = (atoi(argv[4]) > 0);
|
||||
}
|
||||
@ -3771,7 +3752,7 @@ void ViewerTest::ViewerCommands(Draw_Interpretor& theCommands)
|
||||
"- gets or sets current view characteristics",
|
||||
__FILE__,VViewParams, group);
|
||||
theCommands.Add("vchangeselected",
|
||||
"vchangeselected shape"
|
||||
"vchangeselected shape"
|
||||
"- adds to shape to selection or remove one from it",
|
||||
__FILE__, VChangeSelected, group);
|
||||
theCommands.Add("vzclipping",
|
||||
|
@ -31,7 +31,6 @@ Novembre 1998 : CAL : Creation.
|
||||
// for the class
|
||||
#include <Visual3d_Layer.ixx>
|
||||
|
||||
#include <Graphic3d_GraphicDevice.hxx>
|
||||
#include <Graphic3d_TypeOfPrimitive.hxx>
|
||||
#include <Visual3d_ViewManager.hxx>
|
||||
|
||||
@ -55,13 +54,10 @@ Visual3d_Layer::Visual3d_Layer (const Handle(Visual3d_ViewManager)& AManager, co
|
||||
#endif
|
||||
MyPtrViewManager = (void *) AManager.operator->();
|
||||
|
||||
Handle(Aspect_GraphicDriver) agd =
|
||||
(MyViewManager->GraphicDevice ())->GraphicDriver ();
|
||||
|
||||
MyGraphicDriver = *(Handle(Graphic3d_GraphicDriver) *) &agd;
|
||||
MyGraphicDriver = MyViewManager->GraphicDriver();
|
||||
|
||||
MyCLayer.layerType = int (ALayerType);
|
||||
MyCLayer.ptrLayer = NULL;
|
||||
MyCLayer.ptrLayer = NULL;
|
||||
MyCLayer.ortho[0] = -1.0;
|
||||
MyCLayer.ortho[1] = 1.0;
|
||||
MyCLayer.ortho[2] = -1.0;
|
||||
|
@ -372,29 +372,34 @@ is
|
||||
-- An example when we have 1 view and 1 window
|
||||
-- -------------------------------------------
|
||||
--
|
||||
-- // Define a graphic device
|
||||
-- Handle(Graphic3d_GraphicDevice) GD =
|
||||
-- new Graphic3d_GraphicDevice ("dummy:0.0");
|
||||
-- Handle(Aspect_DisplayConnection) aDisplayConnection;
|
||||
--
|
||||
-- // Display connection initialization only needed on Linux platform
|
||||
-- // and on Mac OS X, in cases when you use Xlib for windows drawing.
|
||||
-- aDisplayConnection = new Aspect_DisplayConnection();
|
||||
--
|
||||
-- // Graphic driver initialization
|
||||
-- Handle(Graphic3d_GraphicDriver) aGraphicDriver =
|
||||
-- Graphic3d::InitGraphicDriver (aDisplayConnection);
|
||||
--
|
||||
-- // Define a view manager
|
||||
-- Handle(Visual3d_ViewManager) VM = new Visual3d_ViewManager (GD);
|
||||
-- Handle(Visual3d_ViewManager) aVisualManager = new Visual3d_ViewManager (aGraphicDriver);
|
||||
--
|
||||
-- // Define a view
|
||||
-- Handle(Visual3d_View) V = new Visual3d_View (VM);
|
||||
-- Handle(Visual3d_View) aView = new Visual3d_View (aVisaulManager);
|
||||
--
|
||||
-- // Define a window
|
||||
-- Handle(Xw_Window) W = new Xw_Window
|
||||
-- (GD, "Graphic View 1", 0.695, 0.695, 0.600, 0.600,
|
||||
-- Xw_WQ_3DQUALITY, Quantity_NOC_MATRAGRAY);
|
||||
-- Handle(Xw_Window) aWindow = new Xw_Window
|
||||
-- (aDisplayConnection, "Graphic View 1", 0.695, 0.695, 0.600, 0.600, Quantity_NOC_MATRAGRAY);
|
||||
--
|
||||
-- // Associate the view and the window
|
||||
-- V->SetWindow (W);
|
||||
-- aView->SetWindow (aWindow);
|
||||
--
|
||||
-- // Map the window
|
||||
-- W->Map ();
|
||||
-- aWindow->Map ();
|
||||
--
|
||||
-- // Activate the view
|
||||
-- V->Activate ();
|
||||
-- aView->Activate ();
|
||||
--
|
||||
|
||||
SetWindow ( me : mutable;
|
||||
@ -423,40 +428,6 @@ is
|
||||
raises ViewDefinitionError from Visual3d is static;
|
||||
---Purpose:
|
||||
-- After this call, each view is mapped in an unique window.
|
||||
--
|
||||
-- Programming example :
|
||||
--
|
||||
-- An example when we have 1 view and 1 widget
|
||||
-- -------------------------------------------
|
||||
--
|
||||
-- // Define a graphic device
|
||||
-- Handle(Graphic3d_GraphicDevice) GD =
|
||||
-- new Graphic3d_GraphicDevice ("dummy:0.0");
|
||||
--
|
||||
-- // Define a view manager
|
||||
-- Handle(Visual3d_ViewManager) VM = new Visual3d_ViewManager (GD);
|
||||
--
|
||||
-- // Define a view
|
||||
-- Handle(Visual3d_View) V = new Visual3d_View (VM);
|
||||
--
|
||||
-- // Define a widget
|
||||
-- Widget DA = GLwCreateMDrawingArea (Widget parent, char *name,
|
||||
-- ArgList arglist, Cardinal argcount);
|
||||
-- Handle(Xw_Window) W = new Xw_Window(DA);
|
||||
--
|
||||
-- // Define the graphic context
|
||||
-- GLXContext CTX = glXCreateContext(...)
|
||||
-- // Define the graphic call back and client data
|
||||
-- Handle(Object_View) myObject = new Object_View(...);
|
||||
-- static void DisplayCallback( Window w, XtPointer client_data,
|
||||
-- XtPointer call_data)
|
||||
-- { .... }
|
||||
-- // Associate the view and the widget
|
||||
-- V->SetWindow (W, CTX, DisplayCallback, myObject);
|
||||
--
|
||||
-- // Activate the view
|
||||
-- V->Activate ();
|
||||
--
|
||||
|
||||
Update ( me : mutable )
|
||||
is static;
|
||||
@ -1084,6 +1055,7 @@ is
|
||||
---Level: Internal
|
||||
---Purpose: Returns the associated GraphicDriver.
|
||||
---Category: Internal methods
|
||||
---C++: return const &
|
||||
|
||||
HaveTheSameOwner ( me;
|
||||
AStructure : Structure from Graphic3d )
|
||||
|
@ -142,7 +142,6 @@
|
||||
#include <Graphic3d_DataStructureManager.hxx>
|
||||
|
||||
#include <Graphic3d_GraphicDriver.hxx>
|
||||
#include <Graphic3d_GraphicDevice.hxx>
|
||||
|
||||
#include <Graphic3d_Vector.hxx>
|
||||
#include <Graphic3d_Vertex.hxx>
|
||||
@ -294,10 +293,7 @@ Standard_Real um, vm, uM, vM;
|
||||
MyCView.GDisplayCB = 0;
|
||||
MyCView.GClientData = 0;
|
||||
|
||||
Handle(Aspect_GraphicDriver) agd =
|
||||
(MyViewManager->GraphicDevice ())->GraphicDriver ();
|
||||
|
||||
MyGraphicDriver = *(Handle(Graphic3d_GraphicDriver) *) &agd;
|
||||
MyGraphicDriver = MyViewManager->GraphicDriver();
|
||||
|
||||
}
|
||||
|
||||
@ -430,10 +426,7 @@ Standard_Real um, vm, uM, vM;
|
||||
MyCView.GDisplayCB = 0;
|
||||
MyCView.GClientData = 0;
|
||||
|
||||
Handle(Aspect_GraphicDriver) agd =
|
||||
(MyViewManager->GraphicDevice ())->GraphicDriver ();
|
||||
|
||||
MyGraphicDriver = *(Handle(Graphic3d_GraphicDriver) *) &agd;
|
||||
MyGraphicDriver = MyViewManager->GraphicDriver();
|
||||
|
||||
}
|
||||
|
||||
@ -3529,7 +3522,7 @@ Standard_Boolean Visual3d_View::DegenerateModeIsOn () const {
|
||||
|
||||
}
|
||||
|
||||
Handle(Aspect_GraphicDriver) Visual3d_View::GraphicDriver () const {
|
||||
const Handle(Aspect_GraphicDriver)& Visual3d_View::GraphicDriver () const {
|
||||
|
||||
return MyGraphicDriver;
|
||||
|
||||
|
@ -35,7 +35,6 @@ uses
|
||||
MapOfInteger from TColStd,
|
||||
|
||||
GenId from Aspect,
|
||||
GraphicDevice from Aspect,
|
||||
Window from Aspect,
|
||||
TypeOfHighlightMethod from Aspect,
|
||||
|
||||
@ -55,7 +54,7 @@ uses
|
||||
|
||||
is
|
||||
|
||||
Create ( aDevice : GraphicDevice from Aspect)
|
||||
Create ( theDriver: GraphicDriver from Graphic3d)
|
||||
returns mutable ViewManager from Visual3d;
|
||||
---Level: Public
|
||||
---Purpose: Creates a 3D visualizer.
|
||||
|
@ -93,8 +93,8 @@
|
||||
|
||||
//-Constructors
|
||||
|
||||
Visual3d_ViewManager::Visual3d_ViewManager (const Handle(Aspect_GraphicDevice)& aDevice):
|
||||
Graphic3d_StructureManager (aDevice),
|
||||
Visual3d_ViewManager::Visual3d_ViewManager (const Handle(Graphic3d_GraphicDriver)& theDriver):
|
||||
Graphic3d_StructureManager (theDriver),
|
||||
MyDefinedView (),
|
||||
MyViewGenId (View_IDMIN+((View_IDMIN+View_IDMAX)/(Visual3d_ViewManager::Limit ()))*(Visual3d_ViewManager::CurrentId ()-1),View_IDMIN+((View_IDMIN+View_IDMAX)/(Visual3d_ViewManager::Limit ()))*Visual3d_ViewManager::CurrentId ()-1),
|
||||
MyZBufferAuto (Standard_False),
|
||||
@ -105,9 +105,7 @@ MyTransparency (Standard_False)
|
||||
myLayerIds.Add (0);
|
||||
myLayerSeq.Append (0);
|
||||
|
||||
Handle(Aspect_GraphicDriver) agd = aDevice->GraphicDriver ();
|
||||
|
||||
MyGraphicDriver = *(Handle(Graphic3d_GraphicDriver) *) &agd;
|
||||
MyGraphicDriver = theDriver;
|
||||
}
|
||||
|
||||
//-Destructors
|
||||
|
@ -21,10 +21,7 @@ W95_Allocator.cxx
|
||||
WNT_Allocator.cxx
|
||||
WNT_ColorRef.cxx
|
||||
WNT_Dword.cxx
|
||||
WNT_IconBox_1.cxx
|
||||
WNT_ImageProcessor.cxx
|
||||
WNT_LogFont.cxx
|
||||
WNT_Long.cxx
|
||||
WNT_Uint.cxx
|
||||
WNT_WindowData.cxx
|
||||
WNT_WndProc.cxx
|
||||
|
@ -52,11 +52,6 @@ package WNT
|
||||
-- Category: Classes
|
||||
--------------------
|
||||
|
||||
|
||||
class GraphicDevice;
|
||||
---Purpose: Creates the graphic device associated with DISPLAY.
|
||||
---Category: Classes
|
||||
|
||||
class Window;
|
||||
---Purpose: Creates the Window drawable.
|
||||
---Category: Classes
|
||||
@ -65,22 +60,10 @@ package WNT
|
||||
---Purpose: Creates a Windows NT window class.
|
||||
---Category: Classes
|
||||
|
||||
class IconBox;
|
||||
---Purpose: Creates the Icon Box window.
|
||||
---Category: Classes
|
||||
|
||||
class ImageManager;
|
||||
---Purpose: Creates and manages images and/or icons.
|
||||
---Category: Classes
|
||||
|
||||
class Image;
|
||||
---Purpose: Defines the class
|
||||
---Category: Classes
|
||||
|
||||
class Icon;
|
||||
---Purpose: Defines the class
|
||||
---Category: Classes
|
||||
|
||||
---------------------------
|
||||
-- Category: Enumerations
|
||||
---------------------------
|
||||
|
@ -1,190 +0,0 @@
|
||||
-- Created on: 1996-01-25
|
||||
-- Created by: LAVNIKOV Alexey & PLOTNIKOV Eugeny
|
||||
-- Copyright (c) 1996-1999 Matra Datavision
|
||||
-- Copyright (c) 1999-2012 OPEN CASCADE SAS
|
||||
--
|
||||
-- The content of this file is subject to the Open CASCADE Technology Public
|
||||
-- License Version 6.5 (the "License"). You may not use the content of this file
|
||||
-- except in compliance with the License. Please obtain a copy of the License
|
||||
-- at http://www.opencascade.org and read it completely before using this file.
|
||||
--
|
||||
-- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
|
||||
-- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
|
||||
--
|
||||
-- The Original Code and all software distributed under the License is
|
||||
-- distributed on an "AS IS" basis, without warranty of any kind, and the
|
||||
-- Initial Developer hereby disclaims all such warranties, including without
|
||||
-- limitation, any warranties of merchantability, fitness for a particular
|
||||
-- purpose or non-infringement. Please see the License for the specific terms
|
||||
-- and conditions governing the rights and limitations under the License.
|
||||
|
||||
|
||||
class GraphicDevice from WNT inherits GraphicDevice from Aspect
|
||||
|
||||
---Purpose: This class defines Windows NT display device.
|
||||
-- A Graphic Device defines color management. Windows can run in three
|
||||
-- different color modes depending of the installed graphic board:
|
||||
-- - Low color resolution which allows us to use 16 predefined pure
|
||||
-- colors for drawing lines and unlimited number of dithered colors
|
||||
-- for window's background, solid filled areas etc. Here Graphic Device
|
||||
-- will approximate requested colors by existing ones for line colors
|
||||
-- ( really this approximation is doing by Windows ). A dithering
|
||||
-- technique will be used for window's backgrounds, solid fills etc.
|
||||
-- ( this is doing by WIndows also ). A dithering techique will be use
|
||||
-- for solid fill.
|
||||
-- - Medium color resolution which requires a Windows palette manager.
|
||||
-- This mode takes after X window system's PseudoColor Visual. The
|
||||
-- application can create a LOGICAL PALETTE to represent 20 reserved
|
||||
-- by Windows colors and 236 programmable ones. It's possible to reserve
|
||||
-- odd entries in the palette for highlighting purposes ( but real
|
||||
-- technique is not the same as in X window system - see Windows manual ).
|
||||
-- It's possible to create several logical palettes. To do it create
|
||||
-- other GraphicDevice but in this case color "flicking" is possible.
|
||||
-- - High color resolution. Here 65 536 or 16 777 216 colors are available.
|
||||
-- Any color we like will be exactly displayed on the screen, but
|
||||
-- highlighting technique is not available. This mode often called
|
||||
-- TrueColor but it's not the same as X window TrueColor.
|
||||
-- A Graphic Device also defines physical dimensions of the screen.
|
||||
|
||||
uses
|
||||
|
||||
Color from Quantity,
|
||||
Length from Quantity,
|
||||
ColorMap from Aspect,
|
||||
Handle from Aspect,
|
||||
ColorRef from WNT,
|
||||
HColorTable from WNT,
|
||||
Long from WNT,
|
||||
GraphicDriver from Aspect
|
||||
|
||||
raises
|
||||
|
||||
GraphicDeviceDefinitionError from Aspect,
|
||||
BadAccess from Aspect
|
||||
|
||||
is
|
||||
|
||||
Create (
|
||||
aColorCube : Boolean from Standard = Standard_False;
|
||||
aDevContext : Handle from Aspect = 0
|
||||
)
|
||||
returns mutable GraphicDevice from WNT
|
||||
---Level: Public
|
||||
---Purpose: Creates a GraphicDevice and logical palette.
|
||||
-- Builds an OpenGL colorcube on that palette depending
|
||||
-- of the aColorCube flag and hardware.
|
||||
-- Warning: Raises if createion of the logical palette failed.
|
||||
raises GraphicDeviceDefinitionError from Aspect;
|
||||
|
||||
Create (
|
||||
aColorCube : Boolean from Standard;
|
||||
aDevContext : Integer from Standard
|
||||
) returns mutable GraphicDevice from WNT
|
||||
---Purpose: same as previous one (to provide access form CCL)
|
||||
raises GraphicDeviceDefinitionError from Aspect;
|
||||
|
||||
Destroy ( me : mutable ) is virtual;
|
||||
---Level: Public
|
||||
---Purpose: Destroies all ressources attached to the GraphicDevice.
|
||||
---C++: alias ~
|
||||
|
||||
SetColor (
|
||||
me : mutable;
|
||||
aColor : Color from Quantity;
|
||||
aHighlight : Boolean from Standard = Standard_False
|
||||
)
|
||||
returns ColorRef from WNT is static;
|
||||
---Level: Public
|
||||
---Purpose: Returns the color value in form specific to Windows NT.
|
||||
-- Sets the color values in the logical palette if the
|
||||
-- hardware supports it. If in this case there are not
|
||||
-- free cell in the logical palette then this method will
|
||||
-- search for nearest color in the palette.
|
||||
-- If <aHighlight> is True then sets a highlight color.
|
||||
|
||||
SetColor (
|
||||
me : mutable;
|
||||
aRed : Integer from Standard;
|
||||
aGreen : Integer from Standard;
|
||||
aBlue : Integer from Standard;
|
||||
aHighlight : Boolean from Standard = Standard_False
|
||||
)
|
||||
returns ColorRef from WNT is virtual;
|
||||
---Level: Public
|
||||
---Purpose: See above
|
||||
|
||||
SetColor ( me : mutable; aPixel : Long from WNT )
|
||||
is virtual;
|
||||
---Level: Internal
|
||||
---Purpose: Color allocation for images.
|
||||
|
||||
MapColors (
|
||||
me : mutable;
|
||||
aColorMap : ColorMap from Aspect;
|
||||
aColorTable : in out HColorTable from WNT
|
||||
) is static;
|
||||
---Level: Public
|
||||
---Purpose: Returns the color value in form specific to WIndows NT
|
||||
-- in the <aColorTable>. See SetColor method.
|
||||
-- Warning: The dimensions and index ranges of the <aColorMap> and
|
||||
-- <aColorTable> must be the same;
|
||||
|
||||
HPalette ( me ) returns Handle from Aspect is static;
|
||||
---Level: Public
|
||||
---Purpose: Returns logical palette handle attached to the
|
||||
-- GraphicDevice.
|
||||
---C++: inline
|
||||
|
||||
DisplaySize ( me; aWidth, aHeight : out Integer from Standard ) is static;
|
||||
---Level: Public
|
||||
---Purpose: Returns the Display size in PIXEL
|
||||
---C++: inline
|
||||
|
||||
DisplaySize ( me; aWidth, aHeight : out Length from Quantity ) is static;
|
||||
---Level: Public
|
||||
---Purpose: Returns the Display size in working units units
|
||||
---C++: inline
|
||||
|
||||
IsPaletteDevice ( me ) returns Boolean from Standard is static;
|
||||
---Level: Public
|
||||
---Purpose: Returns True if hardware is palette-compatible.
|
||||
---C++: inline
|
||||
|
||||
NumColors ( me ) returns Integer from Standard is static;
|
||||
---Level: Public
|
||||
---Purpose: Returns number of available colors.
|
||||
---C++: inline
|
||||
|
||||
HighlightColor ( me ) returns ColorRef from WNT is static;
|
||||
---Level: Public
|
||||
---Purpose: Returns highlight color.
|
||||
---C++: inline
|
||||
|
||||
GraphicDriver ( me ) returns GraphicDriver from Aspect is redefined;
|
||||
---Level: Public
|
||||
---Purpose: Dummy method
|
||||
|
||||
Init (
|
||||
me : mutable;
|
||||
aColorCube : Boolean from Standard;
|
||||
aDevContext : Handle from Aspect
|
||||
) is protected;
|
||||
|
||||
fields
|
||||
|
||||
myMWidth,
|
||||
myMHeight : Length from Quantity is protected;
|
||||
myWidth,
|
||||
myHeight,
|
||||
myNumColors : Integer from Standard is protected;
|
||||
myFreeIndex : Integer from Standard is protected;
|
||||
myPalette : Handle from Aspect is protected;
|
||||
myLogPal : Address from Standard is protected;
|
||||
myHighlightColor : ColorRef from WNT is protected;
|
||||
myOpenGLPalette : Boolean from Standard is protected;
|
||||
|
||||
friends
|
||||
|
||||
class Window from WNT
|
||||
|
||||
end GraphicDevice;
|
@ -1,725 +0,0 @@
|
||||
// Copyright (c) 1996-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2012 OPEN CASCADE SAS
|
||||
//
|
||||
// The content of this file is subject to the Open CASCADE Technology Public
|
||||
// License Version 6.5 (the "License"). You may not use the content of this file
|
||||
// except in compliance with the License. Please obtain a copy of the License
|
||||
// at http://www.opencascade.org and read it completely before using this file.
|
||||
//
|
||||
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
|
||||
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
|
||||
//
|
||||
// The Original Code and all software distributed under the License is
|
||||
// distributed on an "AS IS" basis, without warranty of any kind, and the
|
||||
// Initial Developer hereby disclaims all such warranties, including without
|
||||
// limitation, any warranties of merchantability, fitness for a particular
|
||||
// purpose or non-infringement. Please see the License for the specific terms
|
||||
// and conditions governing the rights and limitations under the License.
|
||||
|
||||
/***********************************************************************
|
||||
FONCTION :
|
||||
----------
|
||||
Classe WNT_GraphicDevice.cxx :
|
||||
|
||||
HISTORIQUE DES MODIFICATIONS :
|
||||
--------------------------------
|
||||
03-01-95 : EUG -> Creation.
|
||||
20-11-97 : FMN -> Portage WIN95
|
||||
MAR-98 : EUG -> Porting Win95
|
||||
JUN-98 : EUG -> Modifications to provide access to this class
|
||||
from CCL (second constructor + Init () method)
|
||||
SEP-98 : DCB -> Avoid memory crash when color indices do not follow
|
||||
each other or do not begin with '1'
|
||||
JAN-99 : EUG -> Modifications to provide treating display window
|
||||
as graphic device
|
||||
************************************************************************/
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
/*
|
||||
* Includes
|
||||
*/
|
||||
|
||||
// include windows.h first to have all definitions available
|
||||
#include <windows.h>
|
||||
|
||||
#include <WNT.h>
|
||||
#include <WNT_GraphicDevice.ixx>
|
||||
#include <Aspect_ColorMapEntry.hxx>
|
||||
#include <Aspect_GraphicDriver.hxx>
|
||||
#include <Aspect_Units.hxx>
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
/*
|
||||
* Constantes
|
||||
*/
|
||||
|
||||
#define PAL ((PLOGPALETTE)myLogPal)
|
||||
#define MAX_PAL_ERROR (3*256*256L)
|
||||
#define DEFAULT_GAMMA 1.4
|
||||
|
||||
static int __fastcall _createColorRamp ( HPALETTE* );
|
||||
static BOOL s_SysPalInUse;
|
||||
|
||||
extern HWINSTA ( WINAPI *NTOpenWindowStation ) ( LPTSTR, BOOL, DWORD );
|
||||
extern BOOL ( WINAPI *NTSetProcessWindowStation ) ( HWINSTA );
|
||||
extern HDESK ( WINAPI *NTOpenDesktop ) ( LPTSTR, DWORD, BOOL, DWORD );
|
||||
extern BOOL ( WINAPI *NTSetThreadDesktop ) ( HDESK );
|
||||
extern BOOL ( WINAPI *NTCloseDesktop ) ( HDESK );
|
||||
extern BOOL ( WINAPI *NTCloseWindowStation ) ( HWINSTA );
|
||||
|
||||
extern OSVERSIONINFO WNT_osVer;
|
||||
|
||||
//=======================================================================
|
||||
//function : WNT_GraphicDevice
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
WNT_GraphicDevice::WNT_GraphicDevice (
|
||||
const Standard_Boolean aColorCube,
|
||||
const Aspect_Handle aDevContext
|
||||
)
|
||||
{
|
||||
|
||||
Init ( aColorCube, aDevContext );
|
||||
|
||||
} // end constructor ( 1 )
|
||||
|
||||
//=======================================================================
|
||||
//function : WNT_GraphicDevice
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
WNT_GraphicDevice::WNT_GraphicDevice (
|
||||
const Standard_Boolean aColorCube,
|
||||
const Standard_Integer aDevContext
|
||||
)
|
||||
{
|
||||
|
||||
Init ( aColorCube, ( Aspect_Handle )aDevContext );
|
||||
|
||||
} // end constructor ( 2 )
|
||||
|
||||
//=======================================================================
|
||||
//function : Init
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void WNT_GraphicDevice::Init (
|
||||
const Standard_Boolean aColorCube,
|
||||
const Aspect_Handle aDevContext
|
||||
)
|
||||
{
|
||||
|
||||
HDC hDC;
|
||||
BOOL palDev;
|
||||
HWND hwnd = NULL;
|
||||
HBITMAP hBmp = NULL;
|
||||
int numRes, palSize, nPlanes, nBits;
|
||||
|
||||
hDC = ( aDevContext == NULL ) ? GetDC ( NULL ) :
|
||||
( HDC )aDevContext, hwnd = WindowFromDC ( ( HDC )aDevContext );
|
||||
|
||||
// It is found that the error occurs in the place in the source code that is
|
||||
// responsible for connecting to the desktop and window pointed by the environment
|
||||
// variable CSF_DISPLAY.
|
||||
// For the moment it is unclear at all what this code is needed for. Therefore it
|
||||
// is removed from the sources in order to fix this bug. This allowed to run the
|
||||
// code without problems on both win32 and win64 platforms.
|
||||
// It is needed to carry out special investigations about this subject. Probably it
|
||||
// can be used to connect to a virtual desktop in order to make snapshots on the
|
||||
// Windows station on which no user is logged in.
|
||||
//
|
||||
// if ( aDevContext == 0 && WNT_osVer.dwPlatformId == VER_PLATFORM_WIN32_NT ) {
|
||||
|
||||
// HWINSTA hWst = NULL;
|
||||
// HDESK hDsk = NULL;
|
||||
// DWORD dwLen, dwLenOrig;
|
||||
// LPTSTR buff = NULL;
|
||||
// LPTSTR sNam = NULL;
|
||||
// LPTSTR dNam = NULL;
|
||||
// BOOL fSts = FALSE;
|
||||
|
||||
// dwLenOrig = GetEnvironmentVariable( TEXT( "CSF_DISPLAY" ), NULL, 0 );
|
||||
|
||||
// if ( dwLenOrig == 0 )
|
||||
|
||||
// dwLen = sizeof ( TEXT( "WinSta0\\Default" ) );
|
||||
|
||||
// else
|
||||
|
||||
// dwLen = dwLenOrig + sizeof ( TCHAR );
|
||||
|
||||
// buff = ( LPTSTR )HeapAlloc (
|
||||
// GetProcessHeap (), HEAP_GENERATE_EXCEPTIONS | HEAP_ZERO_MEMORY, dwLen
|
||||
// );
|
||||
|
||||
// if ( dwLenOrig != 0 )
|
||||
|
||||
// GetEnvironmentVariable ( TEXT( "CSF_DISPLAY" ), buff, dwLen );
|
||||
|
||||
// else
|
||||
|
||||
// lstrcpy ( buff, TEXT( "WinSta0\\Default" ) );
|
||||
|
||||
// dwLen = 0;
|
||||
|
||||
// while ( buff[ dwLen ] != TEXT( '\\' ) && buff[ dwLen ] != TEXT( '\x00' ) ) ++dwLen;
|
||||
|
||||
// sNam = ( LPTSTR )HeapAlloc (
|
||||
// GetProcessHeap (), HEAP_GENERATE_EXCEPTIONS,
|
||||
// dwLen * sizeof ( TCHAR ) + sizeof ( TCHAR )
|
||||
// );
|
||||
|
||||
// dwLenOrig = 0;
|
||||
|
||||
// while ( dwLenOrig != dwLen ) {
|
||||
|
||||
// sNam[ dwLenOrig ] = buff[ dwLenOrig ];
|
||||
// ++dwLenOrig;
|
||||
|
||||
// } // end while
|
||||
|
||||
// sNam[ dwLenOrig ] = TEXT( '\x00' );
|
||||
|
||||
// if ( buff[ dwLen ] == TEXT( '\x00' ) ) goto leave;
|
||||
|
||||
// lstrcpy ( buff, &buff[ dwLen + 1 ] );
|
||||
|
||||
// dNam = ( LPTSTR )HeapAlloc (
|
||||
// GetProcessHeap (), HEAP_GENERATE_EXCEPTIONS,
|
||||
// lstrlen ( buff ) * sizeof ( TCHAR ) + sizeof ( TCHAR )
|
||||
// );
|
||||
|
||||
// lstrcpy ( dNam, buff );
|
||||
|
||||
// if ( ( hWst = ( *NTOpenWindowStation ) ( sNam, FALSE, MAXIMUM_ALLOWED ) ) == NULL ||
|
||||
// !( *NTSetProcessWindowStation ) ( hWst )
|
||||
// ) goto leave;
|
||||
|
||||
// if ( ( hDsk = ( *NTOpenDesktop ) ( dNam, 0, FALSE, MAXIMUM_ALLOWED ) ) == NULL ||
|
||||
// !( *NTSetThreadDesktop ) ( hDsk )
|
||||
// )
|
||||
|
||||
// if ( GetLastError () == ERROR_BUSY ) {
|
||||
|
||||
// if ( hDsk != NULL ) ( *NTCloseDesktop ) ( hDsk );
|
||||
// if ( hWst != NULL ) ( *NTCloseWindowStation ) ( hWst );
|
||||
|
||||
// } else goto leave;
|
||||
|
||||
// fSts = TRUE;
|
||||
//leave:
|
||||
// if ( sNam != NULL ) HeapFree ( GetProcessHeap (), 0, ( LPVOID )sNam );
|
||||
// if ( dNam != NULL ) HeapFree ( GetProcessHeap (), 0, ( LPVOID )dNam );
|
||||
// if ( buff != NULL ) HeapFree ( GetProcessHeap (), 0, ( LPVOID )buff );
|
||||
|
||||
// if ( !fSts ) {
|
||||
|
||||
// if ( hDsk != NULL ) ( *NTCloseDesktop ) ( hDsk );
|
||||
// if ( hWst != NULL ) ( *NTCloseWindowStation ) ( hWst );
|
||||
|
||||
// Aspect_GraphicDeviceDefinitionError :: Raise ( "Access to station is denied" );
|
||||
|
||||
// } // end if
|
||||
|
||||
// } // end if
|
||||
|
||||
palDev = ( GetDeviceCaps ( hDC, RASTERCAPS ) & RC_PALETTE ) ? TRUE : FALSE;
|
||||
numRes = GetDeviceCaps ( hDC, NUMRESERVED );
|
||||
palSize = ( palDev ) ? GetDeviceCaps ( hDC, SIZEPALETTE ) : 0;
|
||||
nPlanes = GetDeviceCaps ( hDC, PLANES );
|
||||
nBits = GetDeviceCaps ( hDC, BITSPIXEL );
|
||||
myWidth = GetDeviceCaps ( hDC, HORZRES );
|
||||
myHeight = GetDeviceCaps ( hDC, VERTRES );
|
||||
myMWidth = ( float )GetDeviceCaps ( hDC, HORZSIZE ) / ( 1. MILLIMETER );
|
||||
myMHeight = ( float )GetDeviceCaps ( hDC, VERTSIZE ) / ( 1. MILLIMETER );
|
||||
|
||||
if ( aDevContext != NULL && hwnd != NULL ) {
|
||||
|
||||
RECT r;
|
||||
|
||||
GetClientRect ( hwnd, &r );
|
||||
|
||||
myMWidth = myMWidth * r.right / myWidth;
|
||||
myMHeight = myMHeight * r.bottom / myHeight;
|
||||
myWidth = r.right;
|
||||
myHeight = r.bottom;
|
||||
|
||||
} else {
|
||||
|
||||
BITMAP bm;
|
||||
|
||||
hBmp = ( HBITMAP )GetCurrentObject ( hDC, OBJ_BITMAP );
|
||||
|
||||
if ( GetObject ( hBmp, sizeof ( BITMAP ), &bm ) ) {
|
||||
|
||||
myMWidth = myMWidth * bm.bmWidth / myWidth;
|
||||
myMHeight = myMHeight * bm.bmHeight / myHeight;
|
||||
// Tempory correction for Windows 98
|
||||
if ( WNT_osVer.dwPlatformId != VER_PLATFORM_WIN32_WINDOWS ) {
|
||||
//
|
||||
myWidth = bm.bmWidth;
|
||||
myHeight = bm.bmHeight;
|
||||
|
||||
} else hBmp = NULL;
|
||||
// Tempory correction for Windows 98
|
||||
}
|
||||
//
|
||||
|
||||
} // end else
|
||||
|
||||
if ( aDevContext == NULL ) ReleaseDC ( NULL, hDC );
|
||||
|
||||
myNumColors = ( 1 << ( nBits * nPlanes ) );
|
||||
|
||||
if ( palDev ) myNumColors -= numRes;
|
||||
|
||||
myFreeIndex = 0;
|
||||
myOpenGLPalette = aColorCube;
|
||||
|
||||
if ( palDev ) {
|
||||
|
||||
if ( hwnd == NULL && hBmp == NULL ) {
|
||||
|
||||
myLogPal = HeapAlloc (
|
||||
GetProcessHeap (), HEAP_ZERO_MEMORY,
|
||||
sizeof( LOGPALETTE ) +
|
||||
sizeof( PALETTEENTRY ) * myNumColors
|
||||
);
|
||||
|
||||
if ( !myLogPal )
|
||||
|
||||
Aspect_GraphicDeviceDefinitionError :: Raise ( "Out of memory" );
|
||||
|
||||
PAL -> palVersion = 0x300;
|
||||
PAL -> palNumEntries = 1;
|
||||
|
||||
myPalette = CreatePalette ( PAL );
|
||||
|
||||
if ( !myPalette ) {
|
||||
|
||||
HeapFree ( GetProcessHeap (), 0, myLogPal );
|
||||
Aspect_GraphicDeviceDefinitionError :: Raise ( "Unable to create user palette" );
|
||||
|
||||
} // end if
|
||||
|
||||
myFreeIndex = 0;
|
||||
|
||||
if ( myOpenGLPalette && !_createColorRamp ( ( HPALETTE* )&myPalette ) )
|
||||
|
||||
Aspect_GraphicDeviceDefinitionError :: Raise ( "Colorcube creation failed" );
|
||||
|
||||
} else {
|
||||
|
||||
myPalette = GetCurrentObject ( hDC, OBJ_PAL );
|
||||
myLogPal = NULL;
|
||||
|
||||
} // end else
|
||||
|
||||
} else { // not a palette device
|
||||
|
||||
myPalette = 0;
|
||||
myLogPal = NULL;
|
||||
|
||||
} // end else ( palDev . . . )
|
||||
|
||||
myHighlightColor = RGB( 255, 255, 255 );
|
||||
|
||||
} // end WNT_GraphicDevice :: Init
|
||||
|
||||
void WNT_GraphicDevice :: Destroy () {
|
||||
|
||||
if ( myPalette && myLogPal != NULL ) {
|
||||
|
||||
DeletePalette ( myPalette );
|
||||
HeapFree ( GetProcessHeap (), 0, myLogPal );
|
||||
|
||||
} // end if
|
||||
|
||||
} // end WNT_GraphicDevice :: Destroy
|
||||
|
||||
WNT_ColorRef WNT_GraphicDevice :: SetColor (
|
||||
const Quantity_Color& aColor,
|
||||
const Standard_Boolean aHighlight
|
||||
) {
|
||||
|
||||
Standard_Real r, g, b;
|
||||
Standard_Integer red, green, blue;
|
||||
|
||||
aColor.Values ( r, g, b, Quantity_TOC_RGB );
|
||||
|
||||
red = ( Standard_Integer )( 255. * r );
|
||||
green = ( Standard_Integer )( 255. * g );
|
||||
blue = ( Standard_Integer )( 255. * b );
|
||||
|
||||
return SetColor ( red, green, blue, aHighlight );
|
||||
|
||||
} // end WNT_GraphicDevice :: SetColor( 1 )
|
||||
|
||||
WNT_ColorRef WNT_GraphicDevice :: SetColor (
|
||||
const Standard_Integer aRed,
|
||||
const Standard_Integer aGreen,
|
||||
const Standard_Integer aBlue,
|
||||
const Standard_Boolean aHighlight
|
||||
) {
|
||||
|
||||
int i;
|
||||
WNT_ColorRef retVal;
|
||||
BYTE red, green, blue;
|
||||
|
||||
red = ( BYTE )aRed;
|
||||
green = ( BYTE )aGreen;
|
||||
blue = ( BYTE )aBlue;
|
||||
|
||||
if ( !myPalette )
|
||||
|
||||
retVal = RGB( red, green, blue );
|
||||
|
||||
else if ( myOpenGLPalette )
|
||||
|
||||
retVal = PALETTEINDEX(
|
||||
GetNearestPaletteIndex (
|
||||
( HPALETTE )myPalette, RGB( red, green, blue )
|
||||
)
|
||||
);
|
||||
|
||||
else {
|
||||
|
||||
if ( myFreeIndex < myNumColors ) {
|
||||
|
||||
for ( i = 0; i < myFreeIndex; ++i ) // avoid color duplication
|
||||
|
||||
if ( PAL -> palPalEntry[ i ].peRed == red &&
|
||||
PAL -> palPalEntry[ i ].peGreen == green &&
|
||||
PAL -> palPalEntry[ i ].peBlue == blue
|
||||
)
|
||||
|
||||
break;
|
||||
|
||||
if ( i == myFreeIndex ) { // add new color entry
|
||||
|
||||
PAL -> palPalEntry[ i ].peRed = red;
|
||||
PAL -> palPalEntry[ i ].peGreen = green;
|
||||
PAL -> palPalEntry[ i ].peBlue = blue;
|
||||
PAL -> palPalEntry[ i ].peFlags = 0;
|
||||
++myFreeIndex;
|
||||
ResizePalette ( ( HPALETTE )myPalette, myFreeIndex );
|
||||
SetPaletteEntries ( ( HPALETTE )myPalette, i, 1, &PAL -> palPalEntry[ i ] );
|
||||
|
||||
} // end if
|
||||
|
||||
retVal = PALETTEINDEX( i );
|
||||
|
||||
} else // get closest color
|
||||
|
||||
retVal = PALETTEINDEX(
|
||||
GetNearestPaletteIndex (
|
||||
( HPALETTE )myPalette, RGB( red, green, blue )
|
||||
)
|
||||
);
|
||||
|
||||
} // end else ( !myPalette . . . )
|
||||
|
||||
if ( aHighlight )
|
||||
|
||||
myHighlightColor = retVal;
|
||||
|
||||
return retVal;
|
||||
|
||||
} // end WNT_GraphicDevice :: SetColor(2)
|
||||
|
||||
void WNT_GraphicDevice :: SetColor ( const WNT_Long& aPixel ) {
|
||||
|
||||
if ( myPalette && !myOpenGLPalette && myFreeIndex < myNumColors ) {
|
||||
|
||||
int idx;
|
||||
BYTE red, green, blue;
|
||||
|
||||
blue = (BYTE) (aPixel & 0xFF);
|
||||
green = (BYTE) (( aPixel >> 8 ) & 0xFF);
|
||||
red = (BYTE) (( aPixel >> 16 ) & 0xFF);
|
||||
|
||||
idx = myFreeIndex;
|
||||
|
||||
for ( int i = 2; i < myFreeIndex; ++i ) // avoid color duplication
|
||||
|
||||
if ( PAL -> palPalEntry[ i ].peRed == red &&
|
||||
PAL -> palPalEntry[ i ].peGreen == green &&
|
||||
PAL -> palPalEntry[ i ].peBlue == blue
|
||||
)
|
||||
|
||||
return;
|
||||
|
||||
PAL -> palPalEntry[ idx ].peRed = red;
|
||||
PAL -> palPalEntry[ idx ].peGreen = green;
|
||||
PAL -> palPalEntry[ idx ].peBlue = blue;
|
||||
PAL -> palPalEntry[ idx ].peFlags = 0;
|
||||
++myFreeIndex;
|
||||
ResizePalette ( ( HPALETTE )myPalette, myFreeIndex );
|
||||
SetPaletteEntries ( ( HPALETTE )myPalette, idx, 1, &PAL -> palPalEntry[ idx ] );
|
||||
|
||||
} // end if ( myPalette . . . )
|
||||
|
||||
} // end WNT_GraphicDevice :: SetColor(3)
|
||||
|
||||
void WNT_GraphicDevice :: MapColors (
|
||||
const Handle( Aspect_ColorMap )& aColorMap,
|
||||
Handle( WNT_HColorTable )& aColorTable
|
||||
) {
|
||||
|
||||
Aspect_ColorMapEntry entry;
|
||||
Quantity_Color color;
|
||||
COLORREF dwColor;
|
||||
Standard_Real r, g, b;
|
||||
int i, index;
|
||||
|
||||
if ( myOpenGLPalette || !IsPaletteDevice () ) // readonly palette or no palette
|
||||
|
||||
for ( i = 1; i <= aColorMap -> Size (); ++i ) {
|
||||
|
||||
entry = aColorMap -> Entry ( i );
|
||||
color = entry.Color ();
|
||||
aColorTable -> SetValue ( entry.Index (), SetColor ( color ) );
|
||||
|
||||
} // end for
|
||||
|
||||
else { // writable palette
|
||||
|
||||
for ( i = 1; i <= aColorMap -> Size (); ++i ) {
|
||||
|
||||
entry = aColorMap -> Entry ( i );
|
||||
color = entry.Color ();
|
||||
dwColor = aColorTable -> Value ( i );
|
||||
index = dwColor & 0x01000000 ? dwColor & 0x00FFFFFF : 0xFFFFFFFF;
|
||||
|
||||
if ( index != 0xFFFFFFFF && index < myFreeIndex ) {
|
||||
|
||||
color.Values ( r, g, b, Quantity_TOC_RGB );
|
||||
PAL -> palPalEntry[ index ].peRed = ( BYTE )( 255. * r );
|
||||
PAL -> palPalEntry[ index ].peGreen = ( BYTE )( 255. * g );
|
||||
PAL -> palPalEntry[ index ].peBlue = ( BYTE )( 255. * b );
|
||||
|
||||
} else
|
||||
|
||||
aColorTable -> SetValue ( i, SetColor ( color ) );
|
||||
|
||||
} // end for
|
||||
|
||||
SetPaletteEntries (
|
||||
( HPALETTE )myPalette, 0, myFreeIndex, &PAL -> palPalEntry[ 0 ]
|
||||
);
|
||||
|
||||
} // end else
|
||||
|
||||
} // WNT_GraphicDevice :: MapColors
|
||||
|
||||
Handle( Aspect_GraphicDriver ) WNT_GraphicDevice :: GraphicDriver () const {
|
||||
|
||||
Handle( Aspect_GraphicDriver ) dummy;
|
||||
|
||||
return dummy;
|
||||
|
||||
} // WNT_GraphicDevice :: GraphicDriver
|
||||
//***//
|
||||
//*** Function to create RGB color map for use with OpenGL. ***//
|
||||
//*** For OpenGL RGB rendering we need to know red, green, & blue ***//
|
||||
//*** component bit sizes and positions. This program creates an RGB color ***//
|
||||
//*** cube with a default gamma of 1.4. ***//
|
||||
//*** Unfortunately, because the standard 20 colors in the system palette ***//
|
||||
//*** cannot be changed, if we select this palette into a display DC, ***//
|
||||
//*** we will not realize all of the logical palette. The function ***//
|
||||
//*** changes some of the entries in the logical palette to match enties in ***//
|
||||
//*** the system palette using a least-squares calculation to find which ***//
|
||||
//*** entries to replace. ***//
|
||||
//***//
|
||||
static int __fastcall _createColorRamp ( HPALETTE* pal ) {
|
||||
|
||||
int i, j;
|
||||
int sysPalSize, logPalSize;
|
||||
int red_max, green_max, blue_max,
|
||||
red_mask, green_mask, blue_mask;
|
||||
int iPf;
|
||||
HDC hDC;
|
||||
PIXELFORMATDESCRIPTOR pfd;
|
||||
PPALETTEENTRY sysPal, colorRamp;
|
||||
PBYTE gRed, gGreen, gBlue;
|
||||
BYTE inc;
|
||||
LONG error, min_error, error_index, delta;
|
||||
double dv, gamma;
|
||||
char buff[ 32 ];
|
||||
|
||||
ZeroMemory ( ( PVOID )&pfd, sizeof ( PIXELFORMATDESCRIPTOR ) );
|
||||
|
||||
pfd.nSize = sizeof ( PIXELFORMATDESCRIPTOR );
|
||||
pfd.nVersion = 1;
|
||||
pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL |
|
||||
PFD_DOUBLEBUFFER;
|
||||
pfd.iPixelType = PFD_TYPE_RGBA;
|
||||
pfd.cColorBits = 24;
|
||||
pfd.cDepthBits = 32;
|
||||
pfd.iLayerType = PFD_MAIN_PLANE;
|
||||
|
||||
hDC = GetDC ( NULL );
|
||||
|
||||
iPf = ChoosePixelFormat ( hDC, &pfd );
|
||||
i = DescribePixelFormat (
|
||||
hDC, iPf, sizeof ( PIXELFORMATDESCRIPTOR ), &pfd
|
||||
);
|
||||
|
||||
if ( !i ) {
|
||||
|
||||
ReleaseDC ( NULL, hDC );
|
||||
|
||||
return 0;
|
||||
|
||||
} // end if
|
||||
|
||||
sysPalSize = GetDeviceCaps ( hDC, NUMCOLORS );
|
||||
logPalSize = 1 << pfd.cColorBits;
|
||||
sysPal = new PALETTEENTRY[ sysPalSize + logPalSize ];
|
||||
colorRamp = sysPal + sysPalSize;
|
||||
GetSystemPaletteEntries ( hDC, 0, sysPalSize, sysPal );
|
||||
|
||||
ReleaseDC ( NULL, hDC );
|
||||
|
||||
red_max = 1 << pfd.cRedBits;
|
||||
green_max = 1 << pfd.cGreenBits;
|
||||
blue_max = 1 << pfd.cBlueBits;
|
||||
|
||||
red_mask = red_max - 1;
|
||||
green_mask = green_max - 1;
|
||||
blue_mask = blue_max - 1;
|
||||
|
||||
gRed = new BYTE[ red_max + green_max + blue_max ];
|
||||
gGreen = gRed + red_max;
|
||||
gBlue = gGreen + green_max;
|
||||
|
||||
inc = ( BYTE )( 255.0F / ( float )red_mask );
|
||||
|
||||
if ( GetEnvironmentVariable ( "CSF_GammaValue", buff, 32 ) ) {
|
||||
|
||||
gamma = Atof ( buff );
|
||||
|
||||
if ( gamma == 0.0 )
|
||||
|
||||
gamma = DEFAULT_GAMMA;
|
||||
|
||||
} else
|
||||
|
||||
gamma = DEFAULT_GAMMA;
|
||||
|
||||
for ( i = 0; i < red_max; ++i ) {
|
||||
|
||||
gRed[ i ] = ( i * inc ) & 0xFF;
|
||||
dv = ( 255. * pow ( gRed[ i ] / 255., 1. / gamma ) ) + 0.5;
|
||||
gRed[ i ] = ( BYTE )dv;
|
||||
|
||||
} // end for
|
||||
|
||||
inc = ( BYTE )( 255.0F / ( float )green_mask );
|
||||
|
||||
for ( i = 0; i < green_max; ++i ) {
|
||||
|
||||
gGreen[ i ] = ( i * inc ) & 0xFF;
|
||||
dv = ( 255. * pow ( gGreen[ i ] / 255., 1. / gamma ) ) + 0.5;
|
||||
gGreen[ i ] = ( BYTE )dv;
|
||||
|
||||
} // end for
|
||||
|
||||
inc = ( BYTE )( 255.0F / ( float )blue_mask );
|
||||
|
||||
for ( i = 0; i < blue_max; ++i ) {
|
||||
|
||||
gBlue[ i ] = ( i * inc ) & 0xFF;
|
||||
dv = ( 255. * pow ( gBlue[ i ] / 255., 1. / gamma ) ) + 0.5;
|
||||
gBlue[ i ] = ( BYTE )dv;
|
||||
|
||||
} // end for
|
||||
|
||||
for ( i = 0; i < logPalSize; ++i ) {
|
||||
|
||||
colorRamp[ i ].peRed =
|
||||
gRed[ ( i >> pfd.cRedShift ) & red_mask ];
|
||||
colorRamp[ i ].peGreen =
|
||||
gGreen[ ( i >> pfd.cGreenShift ) & green_mask ];
|
||||
colorRamp[ i ].peBlue =
|
||||
gBlue[ ( i >> pfd.cBlueShift ) & blue_mask ];
|
||||
colorRamp[ i ].peFlags = 0;
|
||||
|
||||
} // end for
|
||||
|
||||
if ( pfd.dwFlags & PFD_NEED_SYSTEM_PALETTE ) {
|
||||
|
||||
s_SysPalInUse = TRUE;
|
||||
|
||||
for ( i = 1; i < logPalSize - 1; ++i ) colorRamp[ i ].peFlags = PC_NOCOLLAPSE;
|
||||
|
||||
} else {
|
||||
|
||||
for ( i = 0; i < sysPalSize; ++i )
|
||||
|
||||
for ( j = 0; j < logPalSize; ++j )
|
||||
|
||||
if ( sysPal[ i ].peRed == colorRamp[ j ].peRed &&
|
||||
sysPal[ i ].peGreen == colorRamp[ j ].peRed &&
|
||||
sysPal[ i ].peBlue == colorRamp[ j ].peRed
|
||||
)
|
||||
|
||||
sysPal[ i ].peFlags = colorRamp[ i ].peFlags = 1;
|
||||
|
||||
else
|
||||
|
||||
sysPal[ i ].peFlags = colorRamp[ i ].peFlags = 0;
|
||||
|
||||
for ( i = 0; i < sysPalSize; ++i ) {
|
||||
|
||||
if ( sysPal[ i ].peFlags ) continue;
|
||||
|
||||
min_error = MAX_PAL_ERROR;
|
||||
|
||||
for ( j = 0; j < logPalSize; ++j ) {
|
||||
|
||||
if ( colorRamp[ j ].peFlags ) continue;
|
||||
|
||||
delta = colorRamp[ j ].peRed - sysPal[ i ].peRed;
|
||||
error = delta * delta;
|
||||
delta = colorRamp[ j ].peGreen - sysPal[ i ].peGreen;
|
||||
error += delta * delta;
|
||||
delta = colorRamp[ j ].peBlue - sysPal[ i ].peBlue;
|
||||
error += delta * delta;
|
||||
|
||||
if ( error < min_error ) {
|
||||
|
||||
error_index = j;
|
||||
min_error = error;
|
||||
|
||||
} // end if
|
||||
|
||||
} // end for ( j . . . )
|
||||
|
||||
colorRamp[ error_index ].peRed = sysPal[ i ].peRed;
|
||||
colorRamp[ error_index ].peGreen = sysPal[ i ].peGreen;
|
||||
colorRamp[ error_index ].peBlue = sysPal[ i ].peBlue;
|
||||
colorRamp[ error_index ].peFlags = PC_EXPLICIT;
|
||||
|
||||
} // end for ( i . . . )
|
||||
|
||||
} // end else
|
||||
|
||||
ResizePalette ( *pal, logPalSize );
|
||||
SetPaletteEntries ( *pal, 0, logPalSize, colorRamp );
|
||||
|
||||
delete [] gRed;
|
||||
delete [] sysPal;
|
||||
|
||||
return 1;
|
||||
|
||||
} // end createColorRamp
|
||||
|
||||
int WNT_SysPalInUse ( void ) {
|
||||
|
||||
return s_SysPalInUse;
|
||||
|
||||
} // end WNT_SysPalInUse
|
@ -1,59 +0,0 @@
|
||||
// Copyright (c) 1996-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2012 OPEN CASCADE SAS
|
||||
//
|
||||
// The content of this file is subject to the Open CASCADE Technology Public
|
||||
// License Version 6.5 (the "License"). You may not use the content of this file
|
||||
// except in compliance with the License. Please obtain a copy of the License
|
||||
// at http://www.opencascade.org and read it completely before using this file.
|
||||
//
|
||||
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
|
||||
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
|
||||
//
|
||||
// The Original Code and all software distributed under the License is
|
||||
// distributed on an "AS IS" basis, without warranty of any kind, and the
|
||||
// Initial Developer hereby disclaims all such warranties, including without
|
||||
// limitation, any warranties of merchantability, fitness for a particular
|
||||
// purpose or non-infringement. Please see the License for the specific terms
|
||||
// and conditions governing the rights and limitations under the License.
|
||||
|
||||
inline Aspect_Handle WNT_GraphicDevice :: HPalette () const {
|
||||
|
||||
return myPalette;
|
||||
|
||||
} // end WNT_GraphicDevice :: HPalette
|
||||
|
||||
inline void WNT_GraphicDevice :: DisplaySize (
|
||||
Standard_Integer& aWidth, Standard_Integer& aHeight
|
||||
) const {
|
||||
|
||||
aWidth = myWidth;
|
||||
aHeight = myHeight;
|
||||
|
||||
} // end WNT_GraphicDevice :: DisplaySize
|
||||
|
||||
inline void WNT_GraphicDevice :: DisplaySize (
|
||||
Quantity_Length& aWidth, Quantity_Length& aHeight
|
||||
) const {
|
||||
aWidth = myMWidth;
|
||||
aHeight = myMHeight;
|
||||
|
||||
} // end WNT_GraphicDevice :: DisplaySize
|
||||
|
||||
inline Standard_Boolean WNT_GraphicDevice :: IsPaletteDevice () const {
|
||||
|
||||
return ( myPalette != 0 );
|
||||
|
||||
} // end WNT_GraphicDevice :: IsPaletteDevice
|
||||
|
||||
inline Standard_Integer WNT_GraphicDevice :: NumColors () const {
|
||||
|
||||
return myNumColors;
|
||||
|
||||
} // end WNT_GraphicDevice :: NumColors
|
||||
|
||||
inline WNT_ColorRef WNT_GraphicDevice :: HighlightColor () const {
|
||||
|
||||
return myHighlightColor;
|
||||
|
||||
} // end WNT_GraphicDevice :: HighlightColor
|
||||
|
@ -1,59 +0,0 @@
|
||||
-- Created by: PLOTNIKOV Eugeny
|
||||
-- Copyright (c) 1996-1999 Matra Datavision
|
||||
-- Copyright (c) 1999-2012 OPEN CASCADE SAS
|
||||
--
|
||||
-- The content of this file is subject to the Open CASCADE Technology Public
|
||||
-- License Version 6.5 (the "License"). You may not use the content of this file
|
||||
-- except in compliance with the License. Please obtain a copy of the License
|
||||
-- at http://www.opencascade.org and read it completely before using this file.
|
||||
--
|
||||
-- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
|
||||
-- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
|
||||
--
|
||||
-- The Original Code and all software distributed under the License is
|
||||
-- distributed on an "AS IS" basis, without warranty of any kind, and the
|
||||
-- Initial Developer hereby disclaims all such warranties, including without
|
||||
-- limitation, any warranties of merchantability, fitness for a particular
|
||||
-- purpose or non-infringement. Please see the License for the specific terms
|
||||
-- and conditions governing the rights and limitations under the License.
|
||||
|
||||
|
||||
|
||||
class Icon from WNT inherits Image from WNT
|
||||
|
||||
---Purpose: Internal class for icon management
|
||||
|
||||
uses
|
||||
|
||||
Handle from Aspect
|
||||
|
||||
is
|
||||
|
||||
Create (
|
||||
aName : CString from Standard;
|
||||
aBitmap : Handle from Aspect;
|
||||
aHashCode : Integer from Standard
|
||||
)
|
||||
returns mutable Icon from WNT;
|
||||
---Purpose: Creates a class.
|
||||
|
||||
Destroy ( me : mutable ) is redefined;
|
||||
---Level: Public
|
||||
---Purpose: Destroys all resources attached to the Icon.
|
||||
---C++: alias ~
|
||||
|
||||
SetName ( me : mutable; aName : CString from Standard )
|
||||
is static;
|
||||
---Level: Public
|
||||
---Purpose: Sets a name for icon.
|
||||
|
||||
fields
|
||||
|
||||
myName : PCharacter from Standard is protected;
|
||||
|
||||
friends
|
||||
|
||||
class ImageManager from WNT,
|
||||
class IconBox from WNT
|
||||
|
||||
end Icon;
|
@ -1,68 +0,0 @@
|
||||
// Copyright (c) 1996-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2012 OPEN CASCADE SAS
|
||||
//
|
||||
// The content of this file is subject to the Open CASCADE Technology Public
|
||||
// License Version 6.5 (the "License"). You may not use the content of this file
|
||||
// except in compliance with the License. Please obtain a copy of the License
|
||||
// at http://www.opencascade.org and read it completely before using this file.
|
||||
//
|
||||
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
|
||||
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
|
||||
//
|
||||
// The Original Code and all software distributed under the License is
|
||||
// distributed on an "AS IS" basis, without warranty of any kind, and the
|
||||
// Initial Developer hereby disclaims all such warranties, including without
|
||||
// limitation, any warranties of merchantability, fitness for a particular
|
||||
// purpose or non-infringement. Please see the License for the specific terms
|
||||
// and conditions governing the rights and limitations under the License.
|
||||
|
||||
|
||||
#include <WNT_Icon.ixx>
|
||||
|
||||
//=======================================================================
|
||||
//function : WNT_Icon
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
WNT_Icon::WNT_Icon (
|
||||
const Standard_CString aName,
|
||||
const Aspect_Handle aBitmap,
|
||||
const Standard_Integer aHashCode
|
||||
) : WNT_Image ( aBitmap, aHashCode )
|
||||
{
|
||||
|
||||
myName = new char[ strlen ( aName ) + 1 ];
|
||||
|
||||
strcpy ( myName, aName );
|
||||
|
||||
} // end constructor
|
||||
|
||||
//=======================================================================
|
||||
//function : Destroy
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void WNT_Icon::Destroy () {
|
||||
|
||||
delete [] myName;
|
||||
|
||||
} // end WNT_Icon :: Destroy
|
||||
|
||||
//=======================================================================
|
||||
//function : SetName
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void WNT_Icon::SetName ( const Standard_CString aName ) {
|
||||
|
||||
if ( strlen ( myName ) < strlen ( aName ) ) {
|
||||
|
||||
delete [] myName;
|
||||
|
||||
myName = new char[ strlen ( aName ) + 1 ];
|
||||
|
||||
} // end if
|
||||
|
||||
strcpy ( myName, aName );
|
||||
|
||||
} // end WNT_Icon :: SetName
|
@ -1,195 +0,0 @@
|
||||
-- Created on: 1996-01-29
|
||||
-- Created by: PLOTNIKOV Eugeny
|
||||
-- Copyright (c) 1996-1999 Matra Datavision
|
||||
-- Copyright (c) 1999-2012 OPEN CASCADE SAS
|
||||
--
|
||||
-- The content of this file is subject to the Open CASCADE Technology Public
|
||||
-- License Version 6.5 (the "License"). You may not use the content of this file
|
||||
-- except in compliance with the License. Please obtain a copy of the License
|
||||
-- at http://www.opencascade.org and read it completely before using this file.
|
||||
--
|
||||
-- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
|
||||
-- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
|
||||
--
|
||||
-- The Original Code and all software distributed under the License is
|
||||
-- distributed on an "AS IS" basis, without warranty of any kind, and the
|
||||
-- Initial Developer hereby disclaims all such warranties, including without
|
||||
-- limitation, any warranties of merchantability, fitness for a particular
|
||||
-- purpose or non-infringement. Please see the License for the specific terms
|
||||
-- and conditions governing the rights and limitations under the License.
|
||||
|
||||
|
||||
|
||||
class IconBox from WNT inherits Window from WNT
|
||||
|
||||
---Purpose: This class defines a Windows NT icon box
|
||||
|
||||
uses
|
||||
|
||||
Handle from Aspect,
|
||||
GraphicDevice from WNT,
|
||||
WClass from WNT,
|
||||
Window from WNT,
|
||||
Uint from WNT,
|
||||
Long from WNT,
|
||||
Dword from WNT,
|
||||
NameOfColor from Quantity
|
||||
|
||||
raises
|
||||
|
||||
WindowDefinitionError from Aspect,
|
||||
WindowError from Aspect
|
||||
|
||||
is
|
||||
|
||||
Create (
|
||||
aDevice : GraphicDevice from WNT;
|
||||
aName : CString from Standard;
|
||||
aStyle : Dword from WNT = 0;
|
||||
Xc : Real from Standard = 0.5;
|
||||
Yc : Real from Standard = 0.5;
|
||||
aBkColor : NameOfColor from Quantity = Quantity_NOC_MATRAGRAY
|
||||
)
|
||||
returns mutable IconBox from WNT
|
||||
---Level: Public
|
||||
---Purpose: Creates an IconBox defined by his Center in DSU.
|
||||
-- ALL Icons are loaded from the Icon File Directory Name:
|
||||
-- "[$SYMBOL]xxxxxxx[.ifd]"
|
||||
-- Warning: Raises if the Position is out of the Screen Space
|
||||
-- or the Icon File Directory Name don't exist
|
||||
raises WindowDefinitionError from Aspect;
|
||||
|
||||
|
||||
---------------------------------------------------
|
||||
-- Category: Methods to modify the class definition
|
||||
---------------------------------------------------
|
||||
|
||||
|
||||
LoadIcons ( me : mutable; Name : CString from Standard )
|
||||
returns Integer from Standard is static;
|
||||
---Level: Public
|
||||
---Purpose: Loads Icon Box from an Other Icon File Directory Name
|
||||
-- and returns the loaded icons number.
|
||||
-- Warning: The Icons previously loaded are NOT cleared.
|
||||
|
||||
Show ( me ) is static;
|
||||
---Level: Public
|
||||
---Purpose: Shows Icon Box to the screen
|
||||
-- Warning: The Icon Box is displayed at the centered position
|
||||
-- specified at the creation time and the size depend
|
||||
-- of the Icon number really loaded inside.
|
||||
|
||||
UnloadIcons (
|
||||
me : mutable;
|
||||
Name : CString from Standard
|
||||
)
|
||||
returns Integer from Standard is static;
|
||||
---Level: Public
|
||||
---Purpose: Unloads All previously loaded Icons in the IconBox
|
||||
-- and returns the unloaded icons number.
|
||||
|
||||
Destroy ( me : mutable ) is redefined;
|
||||
---Level: Public
|
||||
---Purpose: Destroies the IconBox
|
||||
---C++: alias ~
|
||||
|
||||
AddIcon (
|
||||
me : mutable;
|
||||
W : Window from WNT;
|
||||
Name : CString from Standard;
|
||||
aWidth : Integer from Standard = 0;
|
||||
aHeight : Integer from Standard = 0
|
||||
) is static;
|
||||
---Level: Public
|
||||
---Purpose: Adds an Icon of Size aWidth,aHeight given in PIXEL
|
||||
-- to the Icon Box from a FULL Existing Window
|
||||
-- NOTE that if aWidth or aHeight is 0 the default icon size is taken.
|
||||
|
||||
SaveIcons ( me ) returns Integer from Standard is static;
|
||||
---Level: Public
|
||||
---Purpose: Save all new created Icons as iconname.xwd file in the user
|
||||
-- directory and returns the saved icons number.
|
||||
|
||||
SetDim (
|
||||
me : mutable;
|
||||
aWidth : Integer from Standard;
|
||||
aHeight : Integer from Standard
|
||||
) is static;
|
||||
---Level: Public
|
||||
---Purpose: Sets dimensions for icons which are visible in the box.
|
||||
|
||||
----------------------------
|
||||
-- Category: Inquire methods
|
||||
----------------------------
|
||||
|
||||
|
||||
IconNumber ( me )
|
||||
returns Integer from Standard is static;
|
||||
---Level: Public
|
||||
---Purpose: Returns the Number of Icons loaded in the Icon Box.
|
||||
|
||||
IconName ( me; Index : Integer from Standard )
|
||||
returns CString from Standard
|
||||
---Level: Public
|
||||
---Purpose: Returns the Name of the N ime Icon
|
||||
-- Warning: Raises if Index if out of range depending of the
|
||||
-- Number of Loaded Icons.
|
||||
raises WindowError from Aspect is static;
|
||||
|
||||
IconSize (
|
||||
me;
|
||||
Name : CString from Standard;
|
||||
Width, Height : out Integer from Standard
|
||||
)
|
||||
returns Boolean from Standard is static;
|
||||
---Level: Public
|
||||
---Purpose: Returns the Pixmap Size attached to the Icon Name
|
||||
-- Warning: May return FALSE if Icon doesn't exist in the IconBox.
|
||||
---Category: Inquire methods
|
||||
|
||||
IconPixmap ( me; Name : CString from Standard )
|
||||
returns Handle from Aspect is static;
|
||||
---Level: Public
|
||||
---Purpose: Returns the Pixmap attached to the Icon Name
|
||||
-- Warning: May return 0 if Icon doesn't exist in the IconBox.
|
||||
|
||||
IconPixmap (
|
||||
me;
|
||||
Name : CString from Standard;
|
||||
Width : Integer from Standard;
|
||||
Height : Integer from Standard
|
||||
) returns Handle from Aspect is static;
|
||||
---Level: Public
|
||||
---Purpose: Returns the Centered part of the Pixmap of required Size
|
||||
-- attached to the Icon Name
|
||||
-- Warning: May return 0 if Icon doesn't exist in the IconBox.
|
||||
|
||||
HandleEvent (
|
||||
me : mutable;
|
||||
hwnd : Handle from Aspect;
|
||||
uMsg : Uint from WNT;
|
||||
wParam : Dword from WNT;
|
||||
lParam : Dword from WNT
|
||||
)
|
||||
returns Long from WNT is static;
|
||||
---Level: Internal
|
||||
---Purpose: routine to process events sent to the icon box
|
||||
fields
|
||||
|
||||
myIconWidth : Integer from Standard is protected;
|
||||
myIconHeight : Integer from Standard is protected;
|
||||
myFont : Handle from Aspect is protected;
|
||||
myPen : Handle from Aspect is protected;
|
||||
|
||||
-- fields for event management
|
||||
|
||||
myDragging : Boolean from Standard is protected;
|
||||
myStart,
|
||||
myIncX,
|
||||
myIncY,
|
||||
myNX,
|
||||
myNY,
|
||||
myNPos,
|
||||
myMaxPos : Integer from Standard is protected;
|
||||
|
||||
end IconBox;
|
@ -1,542 +0,0 @@
|
||||
// Copyright (c) 1996-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2012 OPEN CASCADE SAS
|
||||
//
|
||||
// The content of this file is subject to the Open CASCADE Technology Public
|
||||
// License Version 6.5 (the "License"). You may not use the content of this file
|
||||
// except in compliance with the License. Please obtain a copy of the License
|
||||
// at http://www.opencascade.org and read it completely before using this file.
|
||||
//
|
||||
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
|
||||
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
|
||||
//
|
||||
// The Original Code and all software distributed under the License is
|
||||
// distributed on an "AS IS" basis, without warranty of any kind, and the
|
||||
// Initial Developer hereby disclaims all such warranties, including without
|
||||
// limitation, any warranties of merchantability, fitness for a particular
|
||||
// purpose or non-infringement. Please see the License for the specific terms
|
||||
// and conditions governing the rights and limitations under the License.
|
||||
|
||||
// include windows.h first to have all definitions available
|
||||
#include <windows.h>
|
||||
#include <windowsx.h>
|
||||
|
||||
#include <WNT_IconBox.ixx>
|
||||
|
||||
#include <WNT_WClass.hxx>
|
||||
#include <WNT_ImageManager.hxx>
|
||||
#include <WNT_Icon.hxx>
|
||||
|
||||
//***//
|
||||
static void __fastcall _get_filename ( char*, int, char*, char* );
|
||||
//***//
|
||||
HBITMAP LoadImageFromFile ( Handle( WNT_GraphicDevice )&, char*, HDC = NULL );
|
||||
int SaveBitmapToFile (
|
||||
Handle( WNT_GraphicDevice )& gDev,
|
||||
HBITMAP, char*, int, int, int, int
|
||||
);
|
||||
LRESULT CALLBACK WNT_IconBoxWndProc ( HWND, UINT, WPARAM, LPARAM );
|
||||
//***//
|
||||
//*************************** Constructor *******************************//
|
||||
//***//
|
||||
WNT_IconBox :: WNT_IconBox (
|
||||
const Handle( WNT_GraphicDevice )& aDevice,
|
||||
const Standard_CString aName,
|
||||
const WNT_Dword& aStyle,
|
||||
const Standard_Real Xc,
|
||||
const Standard_Real Yc,
|
||||
const Quantity_NameOfColor aBkColor
|
||||
) : WNT_Window (
|
||||
aDevice, aName,
|
||||
new WNT_WClass (
|
||||
"WNT_IconBoxClass", WNT_IconBoxWndProc,
|
||||
CS_HREDRAW | CS_VREDRAW
|
||||
),
|
||||
aStyle | WS_VSCROLL,
|
||||
Xc, Yc, 0.5, 0.2, aBkColor
|
||||
) {
|
||||
|
||||
if ( LoadIcons ( aName ) == 0 )
|
||||
|
||||
Aspect_WindowDefinitionError :: Raise ( "Unable to load icons" );
|
||||
|
||||
myFont = NULL;
|
||||
SetDim ( 70, 70 );
|
||||
myStart = 1;
|
||||
|
||||
myPen = CreatePen ( PS_SOLID, 3, RGB( 0, 255, 0 ) );
|
||||
|
||||
} // end constructor
|
||||
//***//
|
||||
//********************************* Destroy *****************************//
|
||||
//***//
|
||||
void WNT_IconBox :: Destroy () {
|
||||
|
||||
if ( myFont != NULL )
|
||||
|
||||
DeleteObject ( myFont );
|
||||
|
||||
if ( myPen != NULL )
|
||||
|
||||
DeleteObject ( myPen );
|
||||
|
||||
} // end WNT_IconBox :: Destroy
|
||||
//***//
|
||||
//******************************* LoadIcons *****************************//
|
||||
//***//
|
||||
Standard_Integer WNT_IconBox :: LoadIcons (
|
||||
const Standard_CString Name
|
||||
) {
|
||||
|
||||
int len;
|
||||
Standard_Integer retVal = 0;
|
||||
ifstream is;
|
||||
char fileName[ MAX_PATH ];
|
||||
char fName[ MAX_PATH ];
|
||||
char iName[ MAX_PATH ];
|
||||
Standard_Integer iHCode;
|
||||
HBITMAP hBmp;
|
||||
Handle( WNT_Icon ) icon;
|
||||
|
||||
Handle( WNT_GraphicDevice ) gDev = Handle( WNT_GraphicDevice ) ::
|
||||
DownCast ( GraphicDevice () );
|
||||
|
||||
_get_filename ( fileName, MAX_PATH, (Standard_PCharacter)Name, "ifd" );
|
||||
|
||||
is.open ( fileName );
|
||||
|
||||
if ( is ) {
|
||||
|
||||
while ( !is.eof () ) {
|
||||
|
||||
is >> fName >> iName;
|
||||
|
||||
if ( is.bad () ) break;
|
||||
|
||||
if ( fName[ 0 ] == '\x00' || iName[ 0 ] == '\x00' ) continue;
|
||||
|
||||
if ( fName[ 0 ] == '#' ) continue;
|
||||
|
||||
_get_filename ( fileName, MAX_PATH, fName, "" );
|
||||
|
||||
iHCode = myImages -> StringHashCode ( fileName );
|
||||
len = myImages -> Size ();
|
||||
int i;
|
||||
|
||||
for ( i = 1; i <= len; ++i )
|
||||
|
||||
if ( myImages -> HashCode ( i ) == iHCode ) {
|
||||
|
||||
icon = Handle( WNT_Icon ) :: DownCast ( myImages -> Image ( i ) );
|
||||
|
||||
if ( lstrcmp ( iName, icon -> myName ) ) {
|
||||
|
||||
i = len + 1;
|
||||
break;
|
||||
|
||||
} /* end if */
|
||||
|
||||
} /* end if */
|
||||
|
||||
if ( i > len ) {
|
||||
|
||||
hBmp = LoadImageFromFile ( gDev, fileName );
|
||||
|
||||
if ( hBmp ) {
|
||||
|
||||
icon = new WNT_Icon ( iName, hBmp, iHCode );
|
||||
myImages -> Add ( icon );
|
||||
|
||||
} // end if
|
||||
|
||||
} // end if ( i > len . . . )
|
||||
|
||||
fName[ 0 ] = iName[ 0 ] = '\x00';
|
||||
|
||||
} // end while
|
||||
|
||||
retVal = myImages -> Size ();
|
||||
|
||||
} // end if
|
||||
|
||||
return retVal;
|
||||
|
||||
} // end WNT_IconBox :: LoadIcons
|
||||
//***//
|
||||
//********************************** Show *******************************//
|
||||
//***//
|
||||
void WNT_IconBox :: Show () const {
|
||||
|
||||
Map ();
|
||||
|
||||
} // end WNT_IconBox :: Show
|
||||
//***//
|
||||
//******************************* UnloadIcons ***************************//
|
||||
//***//
|
||||
Standard_Integer WNT_IconBox :: UnloadIcons (
|
||||
const Standard_CString Name
|
||||
) {
|
||||
|
||||
Standard_Integer retVal = 0;
|
||||
ifstream is;
|
||||
char fileName[ MAX_PATH ];
|
||||
char fName[ MAX_PATH ];
|
||||
char iName[ MAX_PATH ];
|
||||
Handle( WNT_Icon ) icon;
|
||||
|
||||
Handle( WNT_GraphicDevice ) gDev = Handle( WNT_GraphicDevice ) ::
|
||||
DownCast ( GraphicDevice () );
|
||||
|
||||
_get_filename ( fileName, MAX_PATH, (Standard_PCharacter)Name, "ifd" );
|
||||
|
||||
is.open ( fileName );
|
||||
|
||||
if ( is ) {
|
||||
|
||||
while ( !is.eof () ) {
|
||||
|
||||
is >> fName >> iName;
|
||||
|
||||
if ( is.bad () ) break;
|
||||
|
||||
if ( fName[ 0 ] == '#' ) continue;
|
||||
|
||||
for ( int i = 1; i <= myImages -> Size (); ++i ) {
|
||||
|
||||
icon = Handle( WNT_Icon ) :: DownCast ( myImages -> Image ( i ) );
|
||||
|
||||
if ( icon.IsNull () ) continue;
|
||||
|
||||
if ( lstrcmp ( icon -> myName, iName ) ) continue;
|
||||
|
||||
myImages -> Delete ( i );
|
||||
++retVal;
|
||||
|
||||
} // end for
|
||||
|
||||
} // end while
|
||||
|
||||
} // end if
|
||||
|
||||
return retVal;
|
||||
|
||||
} // end WNT_IconBox :: UnloadIcons
|
||||
//***//
|
||||
//********************************* AddIcon *****************************//
|
||||
//***//
|
||||
void WNT_IconBox :: AddIcon (
|
||||
const Handle( WNT_Window )& W,
|
||||
const Standard_CString Name,
|
||||
const Standard_Integer aWidth,
|
||||
const Standard_Integer aHeight
|
||||
) {
|
||||
|
||||
Handle( WNT_Icon ) icon = W -> myIcon;
|
||||
|
||||
if ( !icon.IsNull () )
|
||||
|
||||
myImages -> Add ( W -> myIcon );
|
||||
|
||||
} // end WNT_IconBox :: AddIcon
|
||||
//***//
|
||||
//********************************* SaveIcons ***************************//
|
||||
//***//
|
||||
Standard_Integer WNT_IconBox :: SaveIcons () const {
|
||||
|
||||
int w, h;
|
||||
Standard_Integer retVal = 0;
|
||||
char ext[ 5 ];
|
||||
char fName[ MAX_PATH ];
|
||||
Handle( WNT_Icon ) icon;
|
||||
|
||||
Handle( WNT_GraphicDevice ) gDev = Handle( WNT_GraphicDevice ) ::
|
||||
DownCast ( GraphicDevice () );
|
||||
|
||||
switch ( myFormat ) {
|
||||
|
||||
case WNT_TOI_XWD:
|
||||
|
||||
strcpy ( ext, ".xwd" );
|
||||
|
||||
break;
|
||||
|
||||
case WNT_TOI_BMP:
|
||||
|
||||
strcpy ( ext, ".bmp" );
|
||||
|
||||
break;
|
||||
|
||||
case WNT_TOI_GIF:
|
||||
|
||||
strcpy ( ext, ".gif" );
|
||||
|
||||
} // end switch
|
||||
|
||||
for ( int i = 1; i <= myImages -> Size (); ++i ) {
|
||||
|
||||
icon = Handle( WNT_Icon ) :: DownCast ( myImages -> Image ( i ) );
|
||||
|
||||
if ( icon.IsNull () ) continue;
|
||||
|
||||
strcpy ( fName, icon -> myName );
|
||||
|
||||
if ( strchr ( fName, '.' ) == NULL )
|
||||
|
||||
strcat ( fName, ext );
|
||||
|
||||
myImages -> Dim ( i, w, h );
|
||||
|
||||
if ( SaveBitmapToFile (
|
||||
gDev, ( HBITMAP )( myImages -> ImageHandle ( i ) ), fName,
|
||||
0, 0, w, h
|
||||
)
|
||||
)
|
||||
|
||||
++retVal;
|
||||
|
||||
} // end for
|
||||
|
||||
return retVal;
|
||||
|
||||
} // end WNT_IconBox :: SaveIcons
|
||||
//***//
|
||||
//********************************* IconNumber **************************//
|
||||
//***//
|
||||
Standard_Integer WNT_IconBox :: IconNumber () const {
|
||||
|
||||
return myImages -> Size ();
|
||||
|
||||
} // end WNT_IconBox :: IconNumber
|
||||
//***//
|
||||
//********************************* IconName ****************************//
|
||||
//***//
|
||||
Standard_CString WNT_IconBox :: IconName (
|
||||
const Standard_Integer Index
|
||||
) const {
|
||||
|
||||
Handle( WNT_Icon ) icon = Handle( WNT_Icon ) :: DownCast (
|
||||
myImages -> Image ( Index )
|
||||
);
|
||||
|
||||
return icon -> myName;
|
||||
|
||||
} // end WNT_IconBox :: IconName
|
||||
//***//
|
||||
//********************************* IconSize ****************************//
|
||||
//***//
|
||||
Standard_Boolean WNT_IconBox :: IconSize (
|
||||
const Standard_CString Name,
|
||||
Standard_Integer& Width,
|
||||
Standard_Integer& Height
|
||||
) const {
|
||||
|
||||
int i, len = myImages -> Size ();
|
||||
Handle( WNT_Icon ) icon;
|
||||
|
||||
for ( i = 1; i <= len; ++i ) {
|
||||
|
||||
icon = Handle( WNT_Icon ) :: DownCast ( myImages -> Image ( i ) );
|
||||
|
||||
if ( !strcmp ( icon -> myName, Name ) ) break;
|
||||
|
||||
} // end for
|
||||
|
||||
return ( i > len ) ? Standard_False :
|
||||
myImages -> Dim ( i, Width, Height ), Standard_True;
|
||||
|
||||
} // end WNT_IconBox :: IconSize
|
||||
//***//
|
||||
//********************************* IconPixmap (1) **********************//
|
||||
//***//
|
||||
Aspect_Handle WNT_IconBox :: IconPixmap (
|
||||
const Standard_CString Name
|
||||
) const {
|
||||
|
||||
int i, len = myImages -> Size ();
|
||||
Handle( WNT_Icon ) icon;
|
||||
|
||||
for ( i = 1; i <= len; ++i ) {
|
||||
|
||||
icon = Handle( WNT_Icon ) :: DownCast ( myImages -> Image ( i ) );
|
||||
|
||||
if ( !strcmp ( icon -> myName, Name ) ) break;
|
||||
|
||||
} // end for
|
||||
|
||||
return ( i > len ) ? NULL : myImages -> ImageHandle ( i );
|
||||
|
||||
} // end WNT_IconBox :: IconPixmap
|
||||
//***//
|
||||
//********************************* IconPixmap (2) **********************//
|
||||
//***//
|
||||
Aspect_Handle WNT_IconBox :: IconPixmap (
|
||||
const Standard_CString Name,
|
||||
const Standard_Integer Width,
|
||||
const Standard_Integer Height
|
||||
) const {
|
||||
|
||||
HBITMAP retVal = NULL;
|
||||
int len = myImages -> Size ();
|
||||
int i, w, h;
|
||||
Handle( WNT_Icon ) icon;
|
||||
HPALETTE hOldPal;
|
||||
|
||||
Handle( WNT_GraphicDevice ) gDev = Handle( WNT_GraphicDevice ) ::
|
||||
DownCast ( GraphicDevice () );
|
||||
|
||||
for ( i = 1; i <= len; ++i ) {
|
||||
|
||||
icon = Handle( WNT_Icon ) :: DownCast ( myImages -> Image ( i ) );
|
||||
|
||||
if ( !strcmp ( icon -> myName, Name ) ) break;
|
||||
|
||||
} // end for
|
||||
|
||||
if ( i <= len ) {
|
||||
|
||||
HDC hDC, hDCmemSrc, hDCmemDst;
|
||||
|
||||
hDC = GetDC ( NULL );
|
||||
|
||||
if ( gDev -> IsPaletteDevice () ) {
|
||||
|
||||
hOldPal = SelectPalette ( hDC, ( HPALETTE )( gDev -> HPalette () ), FALSE );
|
||||
RealizePalette ( hDC );
|
||||
|
||||
} // end if
|
||||
|
||||
hDCmemSrc = CreateCompatibleDC ( hDC );
|
||||
hDCmemDst = CreateCompatibleDC ( hDC );
|
||||
|
||||
retVal = CreateCompatibleBitmap ( hDC, Width, Height );
|
||||
|
||||
if ( retVal != NULL ) {
|
||||
|
||||
myImages -> Dim ( i, w, h );
|
||||
|
||||
SelectBitmap ( hDCmemSrc, myImages -> ImageHandle ( i ) );
|
||||
SelectBitmap ( hDCmemDst, retVal );
|
||||
|
||||
BitBlt (
|
||||
hDCmemDst, 0, 0, Width, Height, hDCmemSrc,
|
||||
w / 2 - Width / 2, h / 2 - Height / 2, SRCCOPY
|
||||
);
|
||||
|
||||
} // end if
|
||||
|
||||
DeleteDC ( hDCmemDst );
|
||||
DeleteDC ( hDCmemSrc );
|
||||
|
||||
if ( gDev -> IsPaletteDevice () )
|
||||
|
||||
SelectPalette ( hDC, hOldPal, FALSE );
|
||||
|
||||
ReleaseDC ( NULL, hDC );
|
||||
|
||||
} // end if
|
||||
|
||||
return retVal;
|
||||
|
||||
} // end WNT_IconBox :: IconPixmap
|
||||
//***//
|
||||
//******************************* SetDim ********************************//
|
||||
//***//
|
||||
void WNT_IconBox :: SetDim (
|
||||
const Standard_Integer aWidth,
|
||||
const Standard_Integer aHeight
|
||||
) {
|
||||
|
||||
LOGFONT lf;
|
||||
|
||||
myIconWidth = aWidth;
|
||||
myIconHeight = aHeight;
|
||||
|
||||
ZeroMemory ( &lf, sizeof ( LOGFONT ) );
|
||||
|
||||
lf.lfHeight = myIconHeight / 5;
|
||||
strcpy ( lf.lfFaceName, "Modern" );
|
||||
|
||||
if ( myFont != NULL ) DeleteObject ( myFont );
|
||||
|
||||
myFont = CreateFontIndirect ( &lf );
|
||||
|
||||
} // end WNT_IconBox :: SetDim
|
||||
//***//
|
||||
//***********************************************************************//
|
||||
//***//
|
||||
static void __fastcall _get_filename ( char* retVal, int len, char* name, char* ext ) {
|
||||
|
||||
char* ptr, *ptr1;
|
||||
char eNameVal[ MAX_PATH ];
|
||||
char fNameVal[ MAX_PATH ];
|
||||
DWORD eNameLen;
|
||||
|
||||
len = Min ( MAX_PATH, len );
|
||||
|
||||
ZeroMemory ( ( PVOID )eNameVal, sizeof ( eNameVal ) );
|
||||
ZeroMemory ( ( PVOID )fNameVal, sizeof ( fNameVal ) );
|
||||
|
||||
if ( name != NULL ) {
|
||||
|
||||
strncpy ( fNameVal, name, len );
|
||||
|
||||
if ( *name == '$' ) {
|
||||
|
||||
ptr = strpbrk ( fNameVal, "\\/" );
|
||||
|
||||
if ( ptr != NULL ) {
|
||||
|
||||
*ptr++ = '\x00';
|
||||
ptr1 = fNameVal + 1;
|
||||
|
||||
if (
|
||||
( eNameLen = GetEnvironmentVariable ( ptr1, eNameVal, MAX_PATH ) ) != 0
|
||||
)
|
||||
|
||||
strncpy ( retVal, eNameVal, len );
|
||||
|
||||
strncat ( retVal, "\\", len );
|
||||
|
||||
} else
|
||||
|
||||
ptr = fNameVal;
|
||||
|
||||
strncat ( retVal, ptr, len );
|
||||
|
||||
} else
|
||||
|
||||
strncpy ( retVal, fNameVal, len );
|
||||
|
||||
if ( strpbrk ( retVal, "." ) == NULL ) {
|
||||
|
||||
strncat ( retVal, ".", len );
|
||||
strncat ( retVal, ext, len );
|
||||
|
||||
} // end if
|
||||
|
||||
ptr = retVal;
|
||||
|
||||
for ( int i = 0; i < ( int )( strlen ( retVal ) ); ++i )
|
||||
|
||||
if ( ptr[ i ] == '/' ) ptr[ i ] = '\\';
|
||||
|
||||
} // end if
|
||||
|
||||
} // end _get_filename
|
||||
//***//
|
||||
//***********************************************************************//
|
||||
//***//
|
||||
LRESULT CALLBACK WNT_IconBoxWndProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
WINDOW_DATA* wd = (WINDOW_DATA* )GetWindowLongPtr (hwnd, GWLP_USERDATA);
|
||||
if (wd != NULL)
|
||||
{
|
||||
WNT_IconBox* ib = (WNT_IconBox* )(wd->WNT_Window_Ptr);
|
||||
return ib->HandleEvent (hwnd, uMsg, wParam, lParam);
|
||||
}
|
||||
else
|
||||
{
|
||||
return DefWindowProc (hwnd, uMsg, wParam, lParam);
|
||||
}
|
||||
} // end WNT_IconBoxWndProc
|
||||
//***//
|
||||
//***********************************************************************//
|
@ -1,281 +0,0 @@
|
||||
// Copyright (c) 2008-2012 OPEN CASCADE SAS
|
||||
//
|
||||
// The content of this file is subject to the Open CASCADE Technology Public
|
||||
// License Version 6.5 (the "License"). You may not use the content of this file
|
||||
// except in compliance with the License. Please obtain a copy of the License
|
||||
// at http://www.opencascade.org and read it completely before using this file.
|
||||
//
|
||||
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
|
||||
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
|
||||
//
|
||||
// The Original Code and all software distributed under the License is
|
||||
// distributed on an "AS IS" basis, without warranty of any kind, and the
|
||||
// Initial Developer hereby disclaims all such warranties, including without
|
||||
// limitation, any warranties of merchantability, fitness for a particular
|
||||
// purpose or non-infringement. Please see the License for the specific terms
|
||||
// and conditions governing the rights and limitations under the License.
|
||||
|
||||
|
||||
#include <windows.h>
|
||||
#include <WNT_IconBox.hxx>
|
||||
|
||||
#include <WNT_GraphicDevice.hxx>
|
||||
#include <WNT_ImageManager.hxx>
|
||||
#include <WNT_Icon.hxx>
|
||||
|
||||
#define X_SPACING 10
|
||||
#define Y_SPACING 10
|
||||
|
||||
//=======================================================================
|
||||
//function : HandleEvent
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
WNT_Long WNT_IconBox::HandleEvent (
|
||||
const Aspect_Handle hwnd,
|
||||
const WNT_Uint& uMsg,
|
||||
const WNT_Dword& wParam,
|
||||
const WNT_Dword& lParam
|
||||
)
|
||||
{
|
||||
|
||||
switch ( uMsg ) {
|
||||
|
||||
case WM_SIZE : {
|
||||
|
||||
int len;
|
||||
RECT r;
|
||||
SCROLLINFO si;
|
||||
|
||||
GetClientRect ( ( HWND )hwnd, &r );
|
||||
|
||||
myIncX = myIconWidth + X_SPACING + 6;
|
||||
myNX = r.right / myIncX;
|
||||
|
||||
if ( myNX == 0 ) ++myNX;
|
||||
|
||||
myIncY = myIconHeight + Y_SPACING + 11 + myIconHeight / Y_SPACING;
|
||||
myNY = r.bottom / myIncY;
|
||||
|
||||
if ( myNY == 0 ) ++myNY;
|
||||
|
||||
len = myImages -> Size ();
|
||||
|
||||
if ( myNX * myNY >= len )
|
||||
|
||||
ShowScrollBar ( ( HWND )hwnd, SB_VERT, FALSE );
|
||||
|
||||
else {
|
||||
|
||||
si.cbSize = sizeof ( SCROLLINFO );
|
||||
si.fMask = SIF_POS | SIF_RANGE;
|
||||
si.nPos = myNPos = 0;
|
||||
si.nMin = 0;
|
||||
si.nMax = myMaxPos = len / myNX;
|
||||
|
||||
SetScrollInfo ( ( HWND )hwnd, SB_VERT, &si, TRUE );
|
||||
ShowScrollBar ( ( HWND )hwnd, SB_VERT, TRUE );
|
||||
myStart = 1;
|
||||
|
||||
} // end else
|
||||
|
||||
return 0;
|
||||
|
||||
} // WM_SIZE
|
||||
|
||||
case WM_VSCROLL : {
|
||||
|
||||
int nCurPos;
|
||||
int nScrollCode;
|
||||
int newStart;
|
||||
int len;
|
||||
SCROLLINFO si;
|
||||
|
||||
nScrollCode = ( Standard_Integer )LOWORD( wParam );
|
||||
len = myImages -> Size ();
|
||||
|
||||
switch ( nScrollCode ) {
|
||||
|
||||
case SB_LINEUP :
|
||||
case SB_PAGEUP :
|
||||
|
||||
newStart = myStart - myNX;
|
||||
myStart = newStart >= 1 ? --myNPos, newStart : ( ( myNPos = 0 ), 1 );
|
||||
|
||||
break;
|
||||
|
||||
case SB_LINEDOWN :
|
||||
case SB_PAGEDOWN :
|
||||
|
||||
newStart = myStart + myNX;
|
||||
myStart = ( newStart <= len - myNX + 1 ) ? ( ++myNPos, newStart ) :
|
||||
( ( myNPos = myMaxPos ),
|
||||
( len - myNX + 1 )
|
||||
);
|
||||
|
||||
break;
|
||||
|
||||
case SB_THUMBTRACK :
|
||||
|
||||
myNPos = ( Standard_Integer )HIWORD( wParam );
|
||||
myStart = myNPos * myNX;
|
||||
|
||||
break;
|
||||
|
||||
case SB_ENDSCROLL :
|
||||
|
||||
return 0;
|
||||
|
||||
} // end switch
|
||||
|
||||
if ( myStart == 0 ) ++myStart;
|
||||
|
||||
nCurPos = GetScrollPos ( ( HWND )hwnd, SB_VERT );
|
||||
|
||||
if ( nCurPos == myNPos ) return 0;
|
||||
|
||||
si.cbSize = sizeof ( SCROLLINFO );
|
||||
si.fMask = SIF_POS;
|
||||
si.nPos = myNPos;
|
||||
|
||||
SetScrollInfo ( ( HWND )hwnd, SB_VERT, &si, TRUE );
|
||||
InvalidateRect ( ( HWND )hwnd, NULL, TRUE );
|
||||
|
||||
return 0;
|
||||
|
||||
} // WM_VSCROLL
|
||||
|
||||
case WM_PAINT : {
|
||||
|
||||
HDC hDCsrc, hDCdst;
|
||||
PAINTSTRUCT ps;
|
||||
HPEN hOldPen;
|
||||
HFONT hOldFont;
|
||||
HPALETTE hOldPal;
|
||||
int i, j, x, y, ow, oh, cnt, len;
|
||||
|
||||
Handle( WNT_Icon ) icon;
|
||||
|
||||
Handle( WNT_GraphicDevice ) gDev = Handle( WNT_GraphicDevice ) ::
|
||||
DownCast ( GraphicDevice () );
|
||||
|
||||
if ( !myDragging ) {
|
||||
|
||||
hDCdst = BeginPaint ( ( HWND )hwnd, &ps );
|
||||
hDCsrc = CreateCompatibleDC ( hDCdst );
|
||||
|
||||
if ( gDev -> IsPaletteDevice () ) {
|
||||
|
||||
hOldPal = SelectPalette ( hDCdst, ( HPALETTE )( gDev -> HPalette () ), FALSE );
|
||||
RealizePalette ( hDCdst );
|
||||
|
||||
} // end if
|
||||
|
||||
len = myImages -> Size ();
|
||||
hOldPen = SelectPen ( hDCdst, myPen );
|
||||
hOldFont = SelectFont ( hDCdst, myFont );
|
||||
SetTextAlign ( hDCdst, TA_CENTER | TA_TOP );
|
||||
SetStretchBltMode ( hDCdst, COLORONCOLOR );
|
||||
|
||||
for ( i = 0, y = Y_SPACING, cnt = myStart; i < myNY; ++i, y += myIncY )
|
||||
|
||||
for ( j = 0, x = X_SPACING; j < myNX; ++j, ++cnt, x += myIncX ) {
|
||||
|
||||
if ( cnt > len ) goto exit_display;
|
||||
|
||||
icon = Handle( WNT_Icon ) :: DownCast ( myImages -> Image ( cnt ) );
|
||||
|
||||
if ( icon.IsNull () ) continue;
|
||||
|
||||
myImages -> Dim ( cnt, ow, oh );
|
||||
SelectBitmap ( hDCsrc, icon -> myImage );
|
||||
|
||||
Rectangle ( hDCdst, x, y, x + myIconWidth + 4, y + myIconHeight + 4 );
|
||||
TextOut (
|
||||
hDCdst, x + myIconWidth / 2, y + myIconHeight + 10,
|
||||
icon -> myName, strlen ( icon -> myName )
|
||||
);
|
||||
|
||||
StretchBlt (
|
||||
hDCdst, x + 2, y + 2, myIconWidth, myIconHeight,
|
||||
hDCsrc, 0, 0, ow, oh,
|
||||
SRCCOPY
|
||||
);
|
||||
|
||||
} // end for
|
||||
|
||||
exit_display:
|
||||
|
||||
SelectFont ( hDCdst, hOldFont );
|
||||
SelectPen ( hDCdst, hOldPen );
|
||||
|
||||
if ( gDev -> IsPaletteDevice () )
|
||||
|
||||
SelectPalette ( hDCdst, hOldPal, FALSE );
|
||||
|
||||
DeleteDC ( hDCsrc );
|
||||
EndPaint ( ( HWND )hwnd, &ps );
|
||||
|
||||
return 0;
|
||||
|
||||
} else
|
||||
|
||||
return DefWindowProc ( ( HWND )hwnd, uMsg, wParam, lParam );
|
||||
|
||||
} // WM_PAINT
|
||||
|
||||
case WM_ENTERSIZEMOVE :
|
||||
|
||||
myDragging = TRUE;
|
||||
|
||||
return 0;
|
||||
|
||||
case WM_EXITSIZEMOVE :
|
||||
|
||||
myDragging = FALSE;
|
||||
InvalidateRect ( ( HWND )hwnd, NULL, TRUE );
|
||||
|
||||
return 0;
|
||||
|
||||
case WM_QUERYNEWPALETTE: {
|
||||
|
||||
HDC hDC = GetDC ( ( HWND )hwnd );
|
||||
WINDOW_DATA* wd = (WINDOW_DATA* )GetWindowLongPtr ((HWND )hwnd, GWLP_USERDATA);
|
||||
|
||||
SelectPalette ( hDC, wd -> hPal, FALSE );
|
||||
|
||||
// if ( RealizePalette ( hDC ) );
|
||||
if ( RealizePalette ( hDC ) )
|
||||
InvalidateRect ( ( HWND )hwnd, NULL, FALSE );
|
||||
|
||||
ReleaseDC ( ( HWND )hwnd, hDC );
|
||||
|
||||
return TRUE;
|
||||
|
||||
} // WM_QUERYNEWPALETTE
|
||||
|
||||
case WM_PALETTECHANGED:
|
||||
|
||||
if ( hwnd != ( HWND )wParam ) {
|
||||
|
||||
HDC hDC = GetDC ( ( HWND )hwnd );
|
||||
WINDOW_DATA* wd = (WINDOW_DATA* )GetWindowLongPtr ((HWND )hwnd, GWLP_USERDATA);
|
||||
SelectPalette ( hDC, wd -> hPal, TRUE );
|
||||
|
||||
if ( RealizePalette ( hDC ) )
|
||||
|
||||
UpdateColors ( hDC );
|
||||
|
||||
ReleaseDC ( ( HWND )hwnd, hDC );
|
||||
|
||||
return 0;
|
||||
|
||||
} // end if
|
||||
|
||||
default:
|
||||
|
||||
return DefWindowProc ( ( HWND )hwnd, uMsg, wParam, lParam );
|
||||
|
||||
} // end switch
|
||||
|
||||
} // end WNT_IconBox :: HandleEvent
|
@ -53,8 +53,4 @@ class Image from WNT inherits TShared from MMgt
|
||||
myImage : Address from Standard is protected;
|
||||
myHashCode : Integer from Standard is protected;
|
||||
|
||||
friends
|
||||
|
||||
class ImageManager from WNT
|
||||
|
||||
end Image;
|
||||
|
@ -1,178 +0,0 @@
|
||||
-- Created on: 1996-03-11
|
||||
-- Created by: PLOTNIKOV Eugeny <eugeny@maniax>
|
||||
-- Copyright (c) 1996-1999 Matra Datavision
|
||||
-- Copyright (c) 1999-2012 OPEN CASCADE SAS
|
||||
--
|
||||
-- The content of this file is subject to the Open CASCADE Technology Public
|
||||
-- License Version 6.5 (the "License"). You may not use the content of this file
|
||||
-- except in compliance with the License. Please obtain a copy of the License
|
||||
-- at http://www.opencascade.org and read it completely before using this file.
|
||||
--
|
||||
-- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
|
||||
-- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
|
||||
--
|
||||
-- The Original Code and all software distributed under the License is
|
||||
-- distributed on an "AS IS" basis, without warranty of any kind, and the
|
||||
-- Initial Developer hereby disclaims all such warranties, including without
|
||||
-- limitation, any warranties of merchantability, fitness for a particular
|
||||
-- purpose or non-infringement. Please see the License for the specific terms
|
||||
-- and conditions governing the rights and limitations under the License.
|
||||
|
||||
-- Modifications: PLOTNIKOV Eugeny at July 1998 (BUC60286)
|
||||
|
||||
|
||||
class ImageManager from WNT inherits TShared from MMgt
|
||||
|
||||
---Purpose: This class defines image management
|
||||
|
||||
uses
|
||||
|
||||
Handle from Aspect,
|
||||
Window from WNT,
|
||||
SequenceOfImage from WNT,
|
||||
TypeOfImage from WNT,
|
||||
Image from WNT,
|
||||
WindowPtr from WNT
|
||||
|
||||
is
|
||||
|
||||
Create ( aWindow : WindowPtr from WNT )
|
||||
returns mutable ImageManager from WNT;
|
||||
---Purpose: Creates a class instance
|
||||
|
||||
Destroy ( me : mutable )
|
||||
is virtual;
|
||||
---Purpose: Deletes all resources associated with the class instance.
|
||||
---C++: alias ~
|
||||
|
||||
SetFormat ( me : mutable; aFormat : TypeOfImage from WNT = WNT_TOI_XWD )
|
||||
is static;
|
||||
---Purpose: Sets image format for output.
|
||||
|
||||
Add ( me : mutable; anImage : Image from WNT )
|
||||
is static;
|
||||
---Purpose: Adds <anImage> to manager.
|
||||
|
||||
Image ( me : mutable; anIndex : Integer from Standard )
|
||||
returns Image from WNT is static;
|
||||
---Purpose: returns Image stored at <anIndex>.
|
||||
|
||||
Load ( me : mutable; aFileName : CString from Standard )
|
||||
returns Integer from Standard
|
||||
is static;
|
||||
---Purpose: Loads image from file and returns its index in the
|
||||
-- sequence.
|
||||
-- Warning: Returns 0 if loading was failed.
|
||||
|
||||
Save (
|
||||
me;
|
||||
aFileName : CString from Standard;
|
||||
aX, aY, aWidth, aHeight : Integer from Standard
|
||||
)
|
||||
returns Boolean from Standard
|
||||
is static;
|
||||
---Purpose: Stories image to the file according to <myFormat>
|
||||
-- class field. Returns True on success, otherwise
|
||||
-- returns False.
|
||||
|
||||
SaveBuffer (
|
||||
me;
|
||||
aFileName : CString from Standard;
|
||||
aX, aY, aWidth, aHeight : Integer from Standard
|
||||
)
|
||||
returns Boolean from Standard
|
||||
is static;
|
||||
---Purpose: Stories contents of the double buffer window pixmap.
|
||||
-- See "Save" method.
|
||||
|
||||
Draw (
|
||||
me : mutable;
|
||||
anIndex : Integer from Standard;
|
||||
Xc, Yc : Integer from Standard;
|
||||
aWidth : Integer from Standard;
|
||||
aHeight : Integer from Standard;
|
||||
anAngle : Real from Standard = 0.0
|
||||
)
|
||||
is static;
|
||||
---Purpose: Displays the image according to the DoubleBuffer state
|
||||
-- of the associated window.
|
||||
|
||||
Delete ( me : mutable; anIndex : Integer from Standard )
|
||||
is static;
|
||||
---Purpose: Deletes an image at index <anIndex>.
|
||||
|
||||
Discard ( me : mutable; anIndex : Integer from Standard )
|
||||
is static;
|
||||
---Purpose: Places an image to the trash
|
||||
|
||||
Scale (
|
||||
me : mutable;
|
||||
anIndex : Integer from Standard;
|
||||
aScaleX : Real from Standard;
|
||||
aScaleY : Real from Standard;
|
||||
aReplace : Boolean from Standard = Standard_False
|
||||
) returns Handle from Aspect is static;
|
||||
---Purpose: Scales the specified image.
|
||||
|
||||
Size ( me ) returns Integer from Standard is static;
|
||||
---Purpose: Returns number of loaded images.
|
||||
|
||||
ImageHandle (
|
||||
me : mutable;
|
||||
anIndex : Integer from Standard
|
||||
) returns Handle from Aspect is static;
|
||||
---Purpose: Returns image handle.
|
||||
|
||||
Dim (
|
||||
me : mutable;
|
||||
anIndex : Integer from Standard;
|
||||
aWidth, aHeight : out Integer from Standard
|
||||
)
|
||||
is static;
|
||||
---Purpose: Returns image dimensions.
|
||||
|
||||
HashCode (
|
||||
me : mutable;
|
||||
anIndex : Integer from Standard
|
||||
)
|
||||
returns Integer from Standard is redefined static;
|
||||
---Purpose: Returns image's hash code.
|
||||
|
||||
Index (
|
||||
me : mutable;
|
||||
aHashCode : Integer from Standard
|
||||
)
|
||||
returns Integer from Standard is static;
|
||||
---Purpose: Returns image's index.
|
||||
|
||||
StringHashCode (
|
||||
me : mutable;
|
||||
aString : CString from Standard
|
||||
)
|
||||
returns Integer from Standard is static;
|
||||
---Purpose: Returns hash code of the string.
|
||||
|
||||
Open (
|
||||
me : mutable;
|
||||
aDC : Handle from Aspect;
|
||||
aWidth : Integer from Standard;
|
||||
aHeight : Integer from Standard;
|
||||
aHashCode : Integer from Standard
|
||||
)
|
||||
returns Integer from Standard is static;
|
||||
---Purpose: Creates new empty image and returns its index
|
||||
|
||||
fields
|
||||
|
||||
myWindow : Address from Standard is protected;
|
||||
myImages : SequenceOfImage from WNT is protected;
|
||||
myTrash : SequenceOfImage from WNT is protected;
|
||||
myFormat : TypeOfImage from WNT is protected;
|
||||
myLastImage : Image from WNT is protected;
|
||||
myLastIndex : Integer from Standard is protected;
|
||||
|
||||
friends
|
||||
|
||||
class Window from WNT
|
||||
|
||||
end ImageManager;
|
@ -1,594 +0,0 @@
|
||||
// Copyright (c) 1998-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2012 OPEN CASCADE SAS
|
||||
//
|
||||
// The content of this file is subject to the Open CASCADE Technology Public
|
||||
// License Version 6.5 (the "License"). You may not use the content of this file
|
||||
// except in compliance with the License. Please obtain a copy of the License
|
||||
// at http://www.opencascade.org and read it completely before using this file.
|
||||
//
|
||||
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
|
||||
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
|
||||
//
|
||||
// The Original Code and all software distributed under the License is
|
||||
// distributed on an "AS IS" basis, without warranty of any kind, and the
|
||||
// Initial Developer hereby disclaims all such warranties, including without
|
||||
// limitation, any warranties of merchantability, fitness for a particular
|
||||
// purpose or non-infringement. Please see the License for the specific terms
|
||||
// and conditions governing the rights and limitations under the License.
|
||||
|
||||
// Modifications: PLOTNIKOV Eugeny at July 1998 (BUC60286)
|
||||
|
||||
// include windows.h first to have all definitions available
|
||||
#include <windows.h>
|
||||
#include <windowsx.h>
|
||||
|
||||
#include <WNT_ImageManager.ixx>
|
||||
|
||||
#include <WNT_Image.hxx>
|
||||
#include <WNT_GraphicDevice.hxx>
|
||||
|
||||
#include <WNT_Bitmap.h>
|
||||
|
||||
#define TRASH_SIZE 8
|
||||
|
||||
#define PWND ( ( WNT_WindowPtr )myWindow )
|
||||
|
||||
HBITMAP LoadImageFromFile ( Handle( WNT_GraphicDevice )&, char*, HDC = NULL );
|
||||
int SaveWindowToFile (
|
||||
Handle( WNT_GraphicDevice )&, HWND, char*, int, int, int, int
|
||||
);
|
||||
int SaveBitmapToFile (
|
||||
Handle( WNT_GraphicDevice )&, HBITMAP, char*, int, int, int, int
|
||||
);
|
||||
void SetOutputFormat ( WNT_TypeOfImage );
|
||||
//***//
|
||||
//***************************** Constructor ******************************//
|
||||
//***//
|
||||
WNT_ImageManager :: WNT_ImageManager ( const WNT_WindowPtr& aWindow ) {
|
||||
|
||||
myWindow = aWindow;
|
||||
myLastIndex = 0;
|
||||
|
||||
} // end constructor
|
||||
//***//
|
||||
//******************************* Destroy ********************************//
|
||||
//***//
|
||||
void WNT_ImageManager :: Destroy () {
|
||||
|
||||
|
||||
} // end WNT_ImageManager :: Destroy
|
||||
//***//
|
||||
//******************************* SetFormat ******************************//
|
||||
//***//
|
||||
void WNT_ImageManager :: SetFormat ( const WNT_TypeOfImage aFormat ) {
|
||||
|
||||
myFormat = aFormat;
|
||||
SetOutputFormat ( aFormat );
|
||||
|
||||
} // end WNT_ImageManager :: SetFormat
|
||||
//***//
|
||||
//********************************** Load ********************************//
|
||||
//***//
|
||||
Standard_Integer WNT_ImageManager :: Load ( const Standard_CString aFileName ) {
|
||||
|
||||
Handle( WNT_Image ) image;
|
||||
Standard_Integer i, iHCode, len, retVal = 0;
|
||||
HBITMAP hBmp;
|
||||
|
||||
Handle( WNT_GraphicDevice ) gDev = Handle( WNT_GraphicDevice ) ::
|
||||
DownCast ( PWND -> GraphicDevice () );
|
||||
|
||||
iHCode = StringHashCode ( aFileName );
|
||||
|
||||
if ( myLastIndex && myLastImage -> myHashCode == iHCode ) return myLastIndex;
|
||||
|
||||
for ( i = 1; i <= myTrash.Length (); ++i )
|
||||
|
||||
if ( myTrash.Value ( i ) -> myHashCode == iHCode ) {
|
||||
|
||||
myLastImage = myTrash.Value ( i );
|
||||
retVal = -i;
|
||||
|
||||
goto end;
|
||||
|
||||
} /* end if */
|
||||
|
||||
len = myImages.Length ();
|
||||
|
||||
for ( i = 1; i <= len; ++i )
|
||||
|
||||
if ( myImages.Value ( i ) -> myHashCode == iHCode ) {
|
||||
|
||||
myLastImage = myImages.Value ( i );
|
||||
retVal = i;
|
||||
|
||||
goto end;
|
||||
|
||||
} // end if
|
||||
|
||||
hBmp = LoadImageFromFile ( gDev,(Standard_PCharacter) aFileName );
|
||||
|
||||
if ( hBmp ) {
|
||||
|
||||
myLastImage = new WNT_Image ( hBmp, iHCode );
|
||||
myImages.Append ( myLastImage );
|
||||
retVal = myImages.Length ();
|
||||
|
||||
} // end if
|
||||
end:
|
||||
return myLastIndex = retVal;
|
||||
|
||||
} // end WNT_ImageManager :: Load
|
||||
//***//
|
||||
//********************************** Save ********************************//
|
||||
//***//
|
||||
Standard_Boolean WNT_ImageManager :: Save (
|
||||
const Standard_CString aFileName,
|
||||
const Standard_Integer aX,
|
||||
const Standard_Integer aY,
|
||||
const Standard_Integer aWidth,
|
||||
const Standard_Integer aHeight
|
||||
) const {
|
||||
|
||||
Standard_Boolean retVal;
|
||||
|
||||
Handle( WNT_GraphicDevice ) gDev = Handle( WNT_GraphicDevice ) ::
|
||||
DownCast ( PWND -> GraphicDevice () );
|
||||
|
||||
retVal = SaveWindowToFile (
|
||||
gDev, ( HWND )( PWND -> HWindow () ),
|
||||
(Standard_PCharacter) aFileName, aX, aY, aWidth, aHeight
|
||||
);
|
||||
|
||||
return retVal;
|
||||
|
||||
} // end WNT_ImageManager :: Save
|
||||
//***//
|
||||
//****************************** SaveBuffer ******************************//
|
||||
//***//
|
||||
Standard_Boolean WNT_ImageManager :: SaveBuffer (
|
||||
const Standard_CString aFileName,
|
||||
const Standard_Integer aX,
|
||||
const Standard_Integer aY,
|
||||
const Standard_Integer aWidth,
|
||||
const Standard_Integer aHeight
|
||||
) const {
|
||||
|
||||
Standard_Boolean retVal;
|
||||
Handle( WNT_GraphicDevice ) gDev = Handle( WNT_GraphicDevice ) ::
|
||||
DownCast ( PWND -> GraphicDevice () );
|
||||
|
||||
retVal = SaveBitmapToFile (
|
||||
gDev, ( HBITMAP )( PWND -> HPixmap () ),
|
||||
(Standard_PCharacter)aFileName, aX, aY, aWidth, aHeight
|
||||
);
|
||||
|
||||
return retVal;
|
||||
|
||||
} // end WNT_ImageManager :: SaveBuffer
|
||||
//***//
|
||||
//********************************** Draw ********************************//
|
||||
//***//
|
||||
void WNT_ImageManager :: Draw (
|
||||
const Standard_Integer anIndex,
|
||||
const Standard_Integer Xc,
|
||||
const Standard_Integer Yc,
|
||||
const Standard_Integer aWidth,
|
||||
const Standard_Integer aHeight,
|
||||
const Standard_Real anAngle
|
||||
) {
|
||||
|
||||
HDC hDC, hDCmemSrc, hDCmemDst = 0;
|
||||
HPALETTE hPal, hOldPal;
|
||||
Standard_Integer iw, ih;
|
||||
|
||||
if ( myLastIndex != anIndex ) {
|
||||
|
||||
myLastIndex = anIndex;
|
||||
myLastImage = anIndex < 0 ? myTrash.Value ( -anIndex ) : myImages.Value ( anIndex );
|
||||
|
||||
} // end if
|
||||
|
||||
Handle( WNT_GraphicDevice ) gDev = Handle( WNT_GraphicDevice ) ::
|
||||
DownCast ( PWND -> GraphicDevice () );
|
||||
|
||||
Dim ( anIndex, iw, ih );
|
||||
|
||||
hDC = GetDC ( ( HWND )( PWND -> HWindow () ) );
|
||||
|
||||
if ( gDev -> IsPaletteDevice () ) {
|
||||
|
||||
hOldPal = SelectPalette (
|
||||
hDC, hPal = ( HPALETTE )( gDev -> HPalette () ), FALSE
|
||||
);
|
||||
|
||||
if ( RealizePalette ( hDC ) )
|
||||
|
||||
UpdateColors ( hDC );
|
||||
|
||||
} // end if
|
||||
|
||||
if ( PWND -> DoubleBuffer () ) {
|
||||
|
||||
hDCmemDst = CreateCompatibleDC ( hDC );
|
||||
SelectBitmap ( hDCmemDst, PWND -> HPixmap () );
|
||||
|
||||
} else
|
||||
|
||||
hDCmemDst = hDC;
|
||||
|
||||
hDCmemSrc = CreateCompatibleDC ( hDC );
|
||||
SetStretchBltMode ( hDCmemDst, COLORONCOLOR );
|
||||
|
||||
SelectBitmap (
|
||||
hDCmemSrc, ( ( PWNT_Bitmap )myLastImage -> myImage ) -> hBmp
|
||||
);
|
||||
|
||||
if ( aWidth == iw && aHeight == ih && anAngle == 0.0F )
|
||||
|
||||
BitBlt (
|
||||
hDCmemDst, Xc - aWidth / 2 - ( aWidth & 1 ),
|
||||
Yc - aHeight / 2, aWidth, aHeight,
|
||||
hDCmemSrc, 0, 0, SRCCOPY
|
||||
);
|
||||
|
||||
else if ( anAngle == 0.0F )
|
||||
|
||||
StretchBlt (
|
||||
hDCmemDst, Xc - aWidth / 2,
|
||||
Yc - aHeight / 2 + ( aHeight & 1 ), aWidth, aHeight,
|
||||
hDCmemSrc, 0, 0, iw, ih, SRCCOPY
|
||||
);
|
||||
|
||||
else {
|
||||
|
||||
XFORM x;
|
||||
POINT pivot;
|
||||
POINT pts[ 3 ];
|
||||
double sinVal, cosVal, angle;
|
||||
|
||||
SetGraphicsMode ( hDCmemDst, GM_ADVANCED );
|
||||
|
||||
angle = ( double )anAngle * ( M_PI / 180. );
|
||||
cosVal = Cos ( angle );
|
||||
sinVal = Sin ( angle );
|
||||
|
||||
pts[ 0 ].x = Xc - aWidth / 2;
|
||||
pts[ 0 ].y = Yc - aHeight / 2 + ( aHeight & 1 );
|
||||
|
||||
pts[ 1 ].x = Xc + aWidth / 2;
|
||||
pts[ 1 ].y = pts[ 0 ].y;
|
||||
|
||||
pts[ 2 ].x = pts[ 0 ].x;
|
||||
pts[ 2 ].y = Yc + aHeight / 2 + ( aHeight & 1 );
|
||||
|
||||
pivot.x = ( pts[ 1 ].x + pts[ 2 ].x ) / 2;
|
||||
pivot.y = ( pts[ 1 ].y + pts[ 2 ].y ) / 2;
|
||||
|
||||
x.eM11 = 1.0F; x.eM12 = 0.0F;
|
||||
x.eM21 = 0.0F; x.eM22 = 1.0F;
|
||||
x.eDx = ( float )-pivot.x;
|
||||
x.eDy = ( float )-pivot.y;
|
||||
ModifyWorldTransform ( hDCmemDst, &x, MWT_RIGHTMULTIPLY );
|
||||
|
||||
x.eM11 = ( float )cosVal; x.eM12 = ( float )-sinVal;
|
||||
x.eM21 = ( float )sinVal; x.eM22 = ( float ) cosVal;
|
||||
x.eDx = 0.0F;
|
||||
x.eDy = 0.0F;
|
||||
ModifyWorldTransform ( hDCmemDst, &x, MWT_RIGHTMULTIPLY );
|
||||
|
||||
x.eM11 = 1.0F; x.eM12 = 0.0F;
|
||||
x.eM21 = 0.0F; x.eM22 = 1.0F;
|
||||
x.eDx = ( float )pivot.x;
|
||||
x.eDy = ( float )pivot.y;
|
||||
ModifyWorldTransform ( hDCmemDst, &x, MWT_RIGHTMULTIPLY );
|
||||
|
||||
PlgBlt ( hDCmemDst, pts, hDCmemSrc, 0, 0, iw, ih, NULL, 0, 0 );
|
||||
|
||||
} // end else
|
||||
|
||||
DeleteDC ( hDCmemSrc );
|
||||
|
||||
if ( gDev -> IsPaletteDevice () )
|
||||
|
||||
SelectPalette ( hDC, hOldPal, FALSE );
|
||||
|
||||
if ( PWND -> DoubleBuffer () )
|
||||
|
||||
DeleteDC ( hDCmemDst );
|
||||
|
||||
ReleaseDC ( ( HWND )( PWND -> HWindow () ), hDC );
|
||||
|
||||
} // end WNT_ImageManager :: Draw
|
||||
//***//
|
||||
//********************************** Scale *******************************//
|
||||
//***//
|
||||
Aspect_Handle WNT_ImageManager :: Scale (
|
||||
const Standard_Integer anIndex,
|
||||
const Standard_Real aScaleX,
|
||||
const Standard_Real aScaleY,
|
||||
const Standard_Boolean aReplace
|
||||
) {
|
||||
|
||||
Standard_Integer iw, ih, iNw, iNh;
|
||||
HDC hDCmemSrc, hDCmemDst, hDC;
|
||||
HPALETTE hOldPal = NULL;
|
||||
HBITMAP hBitmap, hOldBitmap, hBmp;
|
||||
|
||||
if ( myLastIndex != anIndex ) {
|
||||
|
||||
myLastIndex = anIndex;
|
||||
myLastImage = anIndex < 0 ? myTrash.Value ( -anIndex ) : myImages.Value ( anIndex );
|
||||
|
||||
} // end if
|
||||
|
||||
Handle( WNT_GraphicDevice ) gDev = Handle( WNT_GraphicDevice ) ::
|
||||
DownCast ( PWND -> GraphicDevice () );
|
||||
|
||||
Dim ( anIndex, iw, ih );
|
||||
|
||||
iNw = ( Standard_Integer )( iw * aScaleX );
|
||||
iNh = ( Standard_Integer )( ih * aScaleY );
|
||||
|
||||
hDC = GetDC ( NULL );
|
||||
|
||||
if ( gDev -> IsPaletteDevice () )
|
||||
|
||||
hOldPal = SelectPalette ( hDC, ( HPALETTE )( gDev -> HPalette () ), FALSE );
|
||||
|
||||
hDCmemSrc = CreateCompatibleDC ( hDC );
|
||||
hDCmemDst = CreateCompatibleDC ( hDC );
|
||||
|
||||
SetStretchBltMode ( hDCmemDst, COLORONCOLOR );
|
||||
|
||||
hBitmap = CreateCompatibleBitmap ( hDC, iNw, iNh );
|
||||
|
||||
if ( hBitmap ) {
|
||||
|
||||
hBmp = ( ( PWNT_Bitmap )myLastImage -> myImage ) -> hBmp;
|
||||
hOldBitmap = SelectBitmap ( hDCmemSrc, hBmp );
|
||||
SelectBitmap ( hDCmemDst, hBitmap );
|
||||
|
||||
StretchBlt (
|
||||
hDCmemDst, 0, 0, iNw, iNh,
|
||||
hDCmemSrc, 0, 0, iw, ih, SRCCOPY
|
||||
);
|
||||
|
||||
SelectBitmap ( hDCmemSrc, hOldBitmap );
|
||||
|
||||
if ( aReplace ) {
|
||||
|
||||
DeleteObject ( hBmp );
|
||||
( ( PWNT_Bitmap )myLastImage -> myImage ) -> hBmp = hBitmap;
|
||||
|
||||
} // end if
|
||||
|
||||
} // end if
|
||||
|
||||
DeleteDC ( hDCmemDst );
|
||||
DeleteDC ( hDCmemSrc );
|
||||
|
||||
if ( hOldPal != NULL ) SelectPalette ( hDC, hOldPal, FALSE );
|
||||
|
||||
ReleaseDC ( NULL, hDC );
|
||||
|
||||
return ( Aspect_Handle )hBitmap;
|
||||
|
||||
} // end WNT_ImageManager :: Scale
|
||||
//***//
|
||||
//******************************** HashCode ******************************//
|
||||
//***//
|
||||
Standard_Integer WNT_ImageManager :: StringHashCode (
|
||||
const Standard_CString aString
|
||||
) {
|
||||
|
||||
Standard_Integer i, n, aHashCode = 0;
|
||||
|
||||
union {
|
||||
|
||||
char charPtr[ 80 ];
|
||||
int intPtr[ 20 ];
|
||||
|
||||
} u;
|
||||
|
||||
n = (Standard_Integer) strlen ( aString );
|
||||
|
||||
if ( n > 0 ) {
|
||||
|
||||
if ( n < 80 ) {
|
||||
|
||||
n = ( n + 3 ) / 4;
|
||||
u.intPtr[ n - 1 ] = 0;
|
||||
strcpy ( u.charPtr, aString );
|
||||
|
||||
} else {
|
||||
|
||||
n = 20;
|
||||
strncpy ( u.charPtr, aString, 80 );
|
||||
|
||||
} // end else
|
||||
|
||||
for ( i = 0; i < n; ++i )
|
||||
|
||||
aHashCode = aHashCode ^ u.intPtr[ i ];
|
||||
|
||||
} // end if
|
||||
|
||||
return Abs ( aHashCode ) + 1;
|
||||
|
||||
} // end WNT_ImageManager :: HashCode
|
||||
//***//
|
||||
//**************************** ImageHandle *******************************//
|
||||
//***//
|
||||
Aspect_Handle WNT_ImageManager :: ImageHandle (
|
||||
const Standard_Integer anIndex
|
||||
) {
|
||||
|
||||
if ( myLastIndex == anIndex ) return ( ( PWNT_Bitmap )myLastImage -> myImage ) -> hBmp;
|
||||
|
||||
myLastIndex = anIndex;
|
||||
myLastImage = anIndex < 0 ? myTrash.Value ( -anIndex ) : myImages.Value ( anIndex );
|
||||
|
||||
return ( ( PWNT_Bitmap )myLastImage -> myImage ) -> hBmp;
|
||||
|
||||
} // end WNT_ImageManager :: ImageHandle
|
||||
//***//
|
||||
//******************************** Dim ***********************************//
|
||||
//***//
|
||||
void WNT_ImageManager :: Dim (
|
||||
const Standard_Integer anIndex,
|
||||
Standard_Integer& aWidth,
|
||||
Standard_Integer& aHeight
|
||||
) {
|
||||
|
||||
BITMAP bmp;
|
||||
|
||||
if ( myLastIndex != anIndex ) {
|
||||
|
||||
myLastIndex = anIndex;
|
||||
myLastImage = anIndex < 0 ? myTrash.Value ( -anIndex ) : myImages.Value ( anIndex );
|
||||
|
||||
} // end if
|
||||
|
||||
GetObject (
|
||||
( ( PWNT_Bitmap )myLastImage -> myImage ) -> hBmp,
|
||||
sizeof ( BITMAP ), ( LPVOID )&bmp
|
||||
);
|
||||
|
||||
aWidth = bmp.bmWidth;
|
||||
aHeight = bmp.bmHeight;
|
||||
|
||||
} // WNT_ImageManager :: Dim
|
||||
//***//
|
||||
//****************************** HashCode ********************************//
|
||||
//***//
|
||||
Standard_Integer WNT_ImageManager :: HashCode (
|
||||
const Standard_Integer anIndex
|
||||
) {
|
||||
|
||||
if ( myLastIndex == anIndex ) return myLastImage -> myHashCode;
|
||||
|
||||
myLastIndex = anIndex;
|
||||
myLastImage = anIndex < 0 ? myTrash.Value ( -anIndex ) : myImages.Value ( anIndex );
|
||||
|
||||
return myLastImage -> myHashCode;
|
||||
|
||||
} // end WNT_ImageManager :: HashCode
|
||||
//***//
|
||||
//****************************** Index ***********************************//
|
||||
//***//
|
||||
Standard_Integer WNT_ImageManager :: Index (
|
||||
const Standard_Integer aHashCode
|
||||
) {
|
||||
|
||||
Standard_Integer retVal = 0;
|
||||
|
||||
if ( myLastImage -> myHashCode == aHashCode ) return myLastIndex;
|
||||
|
||||
for ( int i = 1; i <= myImages.Length (); ++i )
|
||||
|
||||
if ( myImages.Value ( i ) -> myHashCode == aHashCode ) {
|
||||
|
||||
myLastImage = myImages.Value ( retVal = myLastIndex = i );
|
||||
break;
|
||||
|
||||
} // end if
|
||||
|
||||
if ( retVal == 0 )
|
||||
|
||||
for ( int i = 1; i <= myTrash.Length (); ++i )
|
||||
|
||||
if ( myTrash.Value ( i ) -> myHashCode == aHashCode ) {
|
||||
|
||||
myLastImage = myImages.Value ( i );
|
||||
retVal = myLastIndex = -i;
|
||||
break;
|
||||
|
||||
} // end if
|
||||
|
||||
return retVal;
|
||||
|
||||
} // end WNT_ImageManager :: Index
|
||||
//***//
|
||||
//****************************** Delete **********************************//
|
||||
//***//
|
||||
void WNT_ImageManager :: Delete ( const Standard_Integer anIndex ) {
|
||||
|
||||
myImages.Remove ( anIndex );
|
||||
|
||||
if ( myLastIndex == anIndex ) myLastIndex = 0;
|
||||
|
||||
} // end WNT_ImageManager :: Delete
|
||||
//***//
|
||||
//****************************** Delete **********************************//
|
||||
//***//
|
||||
void WNT_ImageManager :: Discard ( const Standard_Integer anIndex ) {
|
||||
|
||||
if ( anIndex > 0 ) {
|
||||
|
||||
int len = myTrash.Length ();
|
||||
|
||||
if ( len == TRASH_SIZE ) myTrash.Remove ( len );
|
||||
|
||||
myTrash.Prepend ( myImages.Value ( anIndex ) );
|
||||
|
||||
myImages.Remove ( anIndex );
|
||||
|
||||
if ( myLastIndex == anIndex ) myLastIndex = 0;
|
||||
|
||||
} // end if
|
||||
|
||||
} // end WNT_ImageManager :: Delete
|
||||
//***//
|
||||
//******************************** Size **********************************//
|
||||
//***//
|
||||
Standard_Integer WNT_ImageManager :: Size () const {
|
||||
|
||||
return myImages.Length ();
|
||||
|
||||
} // end WNT_ImageManager :: Size
|
||||
//***//
|
||||
//******************************** Add ***********************************//
|
||||
//***//
|
||||
void WNT_ImageManager :: Add ( const Handle_WNT_Image& anImage ) {
|
||||
|
||||
myImages.Append ( myLastImage = anImage );
|
||||
|
||||
myLastIndex = myImages.Length ();
|
||||
|
||||
} // end WNT_ImageManager :: Add
|
||||
//***//
|
||||
//******************************** Image *********************************//
|
||||
//***//
|
||||
Handle( WNT_Image ) WNT_ImageManager :: Image (
|
||||
const Standard_Integer anIndex
|
||||
) {
|
||||
|
||||
if ( myLastIndex == anIndex ) return myLastImage;
|
||||
|
||||
myLastIndex = anIndex;
|
||||
myLastImage = anIndex < 0 ? myTrash.Value ( -anIndex ) : myImages.Value ( anIndex );
|
||||
|
||||
return myLastImage;
|
||||
|
||||
} // end WNT_ImageManager :: Image
|
||||
//***//
|
||||
//******************************** Open **********************************//
|
||||
//***//
|
||||
Standard_Integer WNT_ImageManager :: Open (
|
||||
const Aspect_Handle aDC,
|
||||
const Standard_Integer aWidth,
|
||||
const Standard_Integer aHeight,
|
||||
const Standard_Integer aHashCode
|
||||
) {
|
||||
|
||||
HDC hdc = ( HDC )aDC;
|
||||
HBITMAP hBmp = CreateCompatibleBitmap ( hdc, aWidth, aHeight );
|
||||
|
||||
myImages.Append ( myLastImage = new WNT_Image ( hBmp, aHashCode ) );
|
||||
|
||||
return myLastIndex = myImages.Length ();
|
||||
|
||||
} // end WNT_ImageMagager :: Open
|
||||
//***//
|
||||
//************************************************************************//
|
File diff suppressed because it is too large
Load Diff
@ -20,6 +20,7 @@
|
||||
#include <windows.h>
|
||||
#include <WNT_WClass.ixx>
|
||||
|
||||
#include <Standard_PCharacter.hxx>
|
||||
#include <InterfaceGraphic_WNT.hxx>
|
||||
|
||||
#include <string.h>
|
||||
|
@ -18,49 +18,22 @@
|
||||
-- purpose or non-infringement. Please see the License for the specific terms
|
||||
-- and conditions governing the rights and limitations under the License.
|
||||
|
||||
-- Modified: FMN - 23/01/98 -> Add DoMapping
|
||||
-- Modified : GG 28/01/00 G004
|
||||
-- Add gamma correction computation just before dumping an image.
|
||||
-- GG 07/03/00 G004 Add MMSize() method
|
||||
-- TCL 26/10/00 G002 SetBackground(aName: CString) method
|
||||
-- GG - RIC120302 Add NEW HParentWindow methods.
|
||||
-- SAV 24/11/01 SetBackground(Quantity_Color)
|
||||
|
||||
class Window from WNT inherits Window from Aspect
|
||||
|
||||
---Purpose: This class defines Windows NT window
|
||||
-- Warning: The position and size for the creation of the window
|
||||
-- are defined in Device Screen Unit (DSU)
|
||||
-- floating [0,1] space.
|
||||
--
|
||||
-- As 3D view window is the main purpose of this class,
|
||||
-- and 3D view does not need its background to be drawn
|
||||
-- by the system, by default the window background is not drawn.
|
||||
-- This can be overridden by calling ClearFlags( WDF_NOERASEBKGRND ).
|
||||
-- See also WNT_WndProc.cxx and InterfaceGraphic_WNT.hxx.
|
||||
|
||||
uses
|
||||
|
||||
Handle from Aspect,
|
||||
Background from Aspect,
|
||||
GradientBackground from Aspect,
|
||||
TypeOfResize from Aspect,
|
||||
FillMethod from Aspect,
|
||||
GradientFillMethod from Aspect,
|
||||
PixMap from Image,
|
||||
NameOfColor from Quantity,
|
||||
Color from Quantity,
|
||||
Parameter from Quantity,
|
||||
Ratio from Quantity,
|
||||
GraphicDevice from WNT,
|
||||
WClass from WNT,
|
||||
Uint from WNT,
|
||||
Long from WNT,
|
||||
Dword from WNT,
|
||||
WindowData from WNT,
|
||||
Icon from WNT,
|
||||
ImageManager from WNT,
|
||||
TypeOfImage from WNT
|
||||
WindowData from WNT
|
||||
|
||||
raises
|
||||
|
||||
@ -68,43 +41,8 @@ class Window from WNT inherits Window from Aspect
|
||||
WindowError from Aspect
|
||||
|
||||
is
|
||||
|
||||
Create (
|
||||
aDevice : GraphicDevice from WNT;
|
||||
aTitle : CString from Standard;
|
||||
aClass : WClass from WNT;
|
||||
aStyle : Dword from WNT = 0;
|
||||
Xc : Parameter from Quantity = 0.5;
|
||||
Yc : Parameter from Quantity = 0.5;
|
||||
aWidth : Parameter from Quantity = 0.5;
|
||||
aHeight : Parameter from Quantity = 0.5;
|
||||
aBackColor : NameOfColor from Quantity = Quantity_NOC_MATRAGRAY;
|
||||
aParent : Handle from Aspect = 0;
|
||||
aMenu : Handle from Aspect = 0;
|
||||
aClientStruct : Address from Standard = 0
|
||||
)
|
||||
returns mutable Window from WNT
|
||||
---Level: Public
|
||||
---Purpose: Creates a Window defined by his Center and his Size
|
||||
-- in DSU from the Parent Window. If <aParent> is 0 then
|
||||
-- creates a window without parent.
|
||||
-- Creation of an WNT_Window automatically determines the
|
||||
-- smaller dimension of the screen (usually the height)
|
||||
-- and parametrises it as 1.0.
|
||||
-- The smaller dimension of the window is limited to 1.0
|
||||
-- We can give a value greater than 1.0 to the larger
|
||||
-- dimension.
|
||||
-- No matter how large the values passed in argument, the
|
||||
-- window is automatically limited to the maximum size of
|
||||
-- the screen.
|
||||
-- The ratio of width to height of a conventional screen is
|
||||
-- of the order of 1.3.
|
||||
-- Trigger: Raises WindowDefinitionError if the Position out of the
|
||||
-- Screen Space or the window creation failed.
|
||||
raises WindowDefinitionError from Aspect;
|
||||
|
||||
Create (theDevice : GraphicDevice from WNT;
|
||||
theTitle : CString from Standard;
|
||||
|
||||
Create (theTitle : CString from Standard;
|
||||
theClass : WClass from WNT;
|
||||
theStyle : Dword from WNT;
|
||||
thePxLeft : Integer from Standard;
|
||||
@ -124,7 +62,6 @@ class Window from WNT inherits Window from Aspect
|
||||
raises WindowDefinitionError from Aspect;
|
||||
|
||||
Create (
|
||||
aDevice : GraphicDevice from WNT;
|
||||
aHandle : Handle from Aspect;
|
||||
aBackColor : NameOfColor from Quantity = Quantity_NOC_MATRAGRAY
|
||||
)
|
||||
@ -134,7 +71,6 @@ class Window from WNT inherits Window from Aspect
|
||||
-- This handle equals ( aPart1 << 16 ) + aPart2.
|
||||
|
||||
Create (
|
||||
aDevice : GraphicDevice from WNT;
|
||||
aPart1 : Integer from Standard;
|
||||
aPart2 : Integer from Standard;
|
||||
aBackColor : NameOfColor from Quantity = Quantity_NOC_MATRAGRAY
|
||||
@ -154,106 +90,12 @@ class Window from WNT inherits Window from Aspect
|
||||
-- Category: Methods to modify the class definition
|
||||
---------------------------------------------------
|
||||
|
||||
|
||||
SetBackground (
|
||||
me : mutable;
|
||||
Background : Background from Aspect
|
||||
)
|
||||
is virtual;
|
||||
---Level: Public
|
||||
---Purpose: Modifies the window background.
|
||||
|
||||
SetBackground (
|
||||
me : mutable;
|
||||
BackColor : NameOfColor from Quantity
|
||||
)
|
||||
is virtual;
|
||||
---Level: Public
|
||||
---Purpose: Modifies the window background.
|
||||
|
||||
SetBackground (
|
||||
me : mutable;
|
||||
color : Color from Quantity
|
||||
)
|
||||
is virtual;
|
||||
---Level: Public
|
||||
---Purpose: Modifies the window background.
|
||||
|
||||
|
||||
SetBackground (
|
||||
me : mutable;
|
||||
aBackPixmap : Handle from Aspect
|
||||
) is static;
|
||||
---Level: Public
|
||||
---Purpose: Modifies the window background.
|
||||
|
||||
SetBackground (
|
||||
me : mutable;
|
||||
aName : CString from Standard ;
|
||||
aMethod: FillMethod from Aspect = Aspect_FM_CENTERED
|
||||
) returns Boolean from Standard;
|
||||
---Level: Public
|
||||
---Purpose: Loads the window background from an image file <aName>
|
||||
-- defined with a supported format XWD,GIF or BMP
|
||||
-- and returns TRUE if the operation is successfull.
|
||||
-- Category: Methods to modify the class definition
|
||||
|
||||
SetBackground ( me : mutable ;
|
||||
Background : GradientBackground from Aspect ) is virtual;
|
||||
---Level: Public
|
||||
---Purpose: Modifies the window gradient background.
|
||||
-- Warning: the gradient background colours is ignored when the quality
|
||||
-- of this window is TRANSPARENT.
|
||||
---Category: Methods to modify the class definition
|
||||
|
||||
SetBackground( me : mutable;
|
||||
aCol1 : Color from Quantity;
|
||||
aCol2 : Color from Quantity;
|
||||
aMethod : GradientFillMethod from Aspect = Aspect_GFM_HOR);
|
||||
---Level: Public
|
||||
---Purpose: Modifies the window gradient background.
|
||||
-- Warning: the gradient background colours are ignored when the quality
|
||||
-- of this window is TRANSPARENT.
|
||||
---Category: Methods to modify the class definition
|
||||
|
||||
SetCursor ( me; aCursor : Handle from Aspect )
|
||||
is static;
|
||||
---Level: Public
|
||||
---Purpose: Sets cursor <aCursor> for ENTIRE WINDOW CLASS to which
|
||||
-- the Window belongs.
|
||||
|
||||
SetIcon (
|
||||
me : mutable;
|
||||
anIcon : Handle from Aspect;
|
||||
aName : CString from Standard = 0
|
||||
)
|
||||
is static;
|
||||
---Level: Public
|
||||
---Purpose: Sets icon <anIcon> for window
|
||||
|
||||
SetIconName ( me : mutable; aName : CString from Standard )
|
||||
is static;
|
||||
---Level: Public
|
||||
---Purpose: Sets name for window's icon
|
||||
|
||||
SetDoubleBuffer (
|
||||
me : mutable;
|
||||
DBmode : Boolean from Standard
|
||||
)
|
||||
---Level: Public
|
||||
---Purpose: Activates/Deactivates the Double Buffering capability
|
||||
-- for this window.
|
||||
-- Warning: Double Buffering is always DISABLE by default.
|
||||
-- Trigger: Raises if BackingStore () isn't allowed for this Window
|
||||
raises WindowError from Aspect is virtual;
|
||||
|
||||
Flush ( me )
|
||||
---Level: Public
|
||||
---Purpose: Flushes all graphics to the screen and Swap the Double
|
||||
-- buffer if Enable
|
||||
-- Trigger: Raises if Something is WRONG at Drawing Time.
|
||||
raises WindowError from Aspect is virtual;
|
||||
|
||||
Map ( me )
|
||||
is virtual;
|
||||
---Level: Public
|
||||
@ -285,115 +127,6 @@ class Window from WNT inherits Window from Aspect
|
||||
-- and returns TRUE if the window is mapped at screen.
|
||||
---Category: Methods to modify the class definition
|
||||
|
||||
|
||||
Clear ( me )
|
||||
is virtual;
|
||||
---Level: Public
|
||||
---Purpose: Clears the Window in the Background color.
|
||||
|
||||
ClearArea (
|
||||
me;
|
||||
Xc : Integer from Standard;
|
||||
Yc : Integer from Standard;
|
||||
Width : Integer from Standard;
|
||||
Height : Integer from Standard
|
||||
)
|
||||
---Level: Public
|
||||
---Purpose: Clears the Window Area defined by his center and PIXEL
|
||||
-- size in the Background color
|
||||
-- Trigger: Raises if Window is not defined properly
|
||||
raises WindowError from Aspect is virtual;
|
||||
|
||||
Restore ( me )
|
||||
---Level: Public
|
||||
---Purpose: Restores The Window from the BackingStored Window
|
||||
-- See BackingStore () method.
|
||||
raises WindowError from Aspect is virtual;
|
||||
|
||||
RestoreArea (
|
||||
me;
|
||||
Xc : Integer from Standard;
|
||||
Yc : Integer from Standard;
|
||||
Width : Integer from Standard;
|
||||
Height : Integer from Standard
|
||||
)
|
||||
---Level: Public
|
||||
---Purpose: Restores The Window Area defined by his center
|
||||
-- and PIXEL size from the BackingStored Window
|
||||
-- See BackingStore () method.
|
||||
raises WindowError from Aspect is virtual;
|
||||
|
||||
Dump (
|
||||
me;
|
||||
aFilename : CString from Standard;
|
||||
aGammaValue: Real from Standard = 1.0
|
||||
)
|
||||
returns Boolean
|
||||
---Level: Public
|
||||
---Purpose: Dumps the Window to an XWD,GIF or BMP filei with
|
||||
-- an optional gamma correction value according to the graphic system.
|
||||
-- and returns TRUE if the dump occurs normaly.
|
||||
-- Trigger: Raises if Window is not defined properly
|
||||
raises WindowError from Aspect is virtual;
|
||||
|
||||
DumpArea (
|
||||
me;
|
||||
aFilename : CString from Standard;
|
||||
Xc : Integer from Standard;
|
||||
Yc : Integer from Standard;
|
||||
Width : Integer from Standard;
|
||||
Height : Integer from Standard;
|
||||
aGammaValue: Real from Standard = 1.0
|
||||
)
|
||||
returns Boolean from Standard
|
||||
---Level: Public
|
||||
---Purpose: Dumps the Window Area defined by his center and PIXEL size
|
||||
-- to an image file with an optional gamma correction value
|
||||
-- and returns TRUE if the dump occurs normaly.
|
||||
-- Trigger: Raises if Window is not defined properly
|
||||
-- or the area is out of the Window.
|
||||
raises WindowError from Aspect is virtual;
|
||||
|
||||
ToPixMap ( me ; theImage : in out PixMap from Image )
|
||||
returns Boolean
|
||||
---Level : Public
|
||||
---Purpose : dump the full contents of the window to a pixmap.
|
||||
is virtual;
|
||||
|
||||
Load ( me; aFilename : CString from Standard )
|
||||
returns Boolean from Standard
|
||||
---Level: Public
|
||||
---Purpose: Loads the XWD file to this Window.
|
||||
-- Returns TRUE if the loading occurs normaly.
|
||||
-- Warning: Note that the Window is enlarged automatically
|
||||
-- when the image size is too large for this window.
|
||||
-- Trigger: Raises if Window is not defined properly
|
||||
raises WindowError from Aspect is virtual;
|
||||
|
||||
LoadArea (
|
||||
me;
|
||||
aFilename : CString from Standard;
|
||||
Xc : Integer from Standard;
|
||||
Yc : Integer from Standard;
|
||||
Width : Integer from Standard;
|
||||
Height : Integer from Standard
|
||||
)
|
||||
returns Boolean from Standard
|
||||
---Purpose: Loads the XWD file to Window Area defined by his center
|
||||
-- and PIXEL size.
|
||||
-- Returns TRUE if the loading occurs normaly.
|
||||
-- Warning: Note that the Image is zoomed automatically
|
||||
-- when the image size is too large for this window area.
|
||||
-- Trigger: Raises if Window is not defined properly
|
||||
-- or the area is out of the Window.
|
||||
raises WindowError from Aspect is virtual;
|
||||
|
||||
SetOutputFormat ( me : mutable; aFormat : TypeOfImage from WNT )
|
||||
is static;
|
||||
---Level: Public
|
||||
---Purpose: Sets format of the image file created by Dump or
|
||||
-- DumpArea methods.
|
||||
|
||||
SetPos ( me : mutable; X, Y, X1, Y1 : Integer from Standard )
|
||||
is static;
|
||||
---Level: Internal
|
||||
@ -418,22 +151,6 @@ class Window from WNT inherits Window from Aspect
|
||||
-- Category: Inquire methods
|
||||
----------------------------
|
||||
|
||||
|
||||
BackingStore ( me )
|
||||
returns Boolean from Standard is virtual;
|
||||
---Level: Public
|
||||
---Purpose: Returns the BackingStore capability for this Window.
|
||||
-- If Answer is True Exposure can be recovered by
|
||||
-- Restore RestoreArea methods.
|
||||
-- If Answer is False, Application must Redraw the
|
||||
-- exposed area.
|
||||
|
||||
DoubleBuffer ( me )
|
||||
returns Boolean from Standard is virtual;
|
||||
---Level: Public
|
||||
---Purpose: Returns the DoubleBuffer state.
|
||||
---C++: inline
|
||||
|
||||
IsMapped ( me )
|
||||
returns Boolean from Standard is virtual;
|
||||
---Level: Public
|
||||
@ -446,17 +163,6 @@ class Window from WNT inherits Window from Aspect
|
||||
---Purpose: Returns The Window RATIO equal to the physical
|
||||
-- WIDTH/HEIGHT dimensions.
|
||||
|
||||
Position (
|
||||
me;
|
||||
X1 : out Parameter from Quantity;
|
||||
Y1 : out Parameter from Quantity;
|
||||
X2 : out Parameter from Quantity;
|
||||
Y2 : out Parameter from Quantity
|
||||
)
|
||||
is virtual;
|
||||
---Level: Public
|
||||
---Purpose: Returns The Window POSITION in DSU
|
||||
|
||||
Position (
|
||||
me;
|
||||
X1 : out Integer from Standard;
|
||||
@ -468,15 +174,6 @@ class Window from WNT inherits Window from Aspect
|
||||
---Level: Public
|
||||
---Purpose: Returns The Window POSITION in PIXEL
|
||||
|
||||
Size (
|
||||
me;
|
||||
Width : out Parameter from Quantity;
|
||||
Height : out Parameter from Quantity
|
||||
)
|
||||
is virtual;
|
||||
---Level: Public
|
||||
---Purpose: Returns The Window SIZE in DSU
|
||||
|
||||
Size (
|
||||
me;
|
||||
Width : out Integer from Standard;
|
||||
@ -486,49 +183,6 @@ class Window from WNT inherits Window from Aspect
|
||||
---Level: Public
|
||||
---Purpose: Returns The Window SIZE in PIXEL
|
||||
|
||||
MMSize (
|
||||
me;
|
||||
Width : out Real from Standard;
|
||||
Height : out Real from Standard
|
||||
)
|
||||
is virtual;
|
||||
---Level: Public
|
||||
---Purpose: Returns The Window SIZE in MM
|
||||
|
||||
Convert (
|
||||
me;
|
||||
PV : Integer from Standard
|
||||
)
|
||||
returns Parameter from Quantity is virtual;
|
||||
---Level: Public
|
||||
---Purpose: Returns the DSU value depending of the PIXEL value.
|
||||
|
||||
Convert (
|
||||
me;
|
||||
DV : Parameter from Quantity
|
||||
)
|
||||
returns Integer from Standard is virtual;
|
||||
---Level: Public
|
||||
---Purpose: Returns the PIXEL value depending of the DSU value.
|
||||
|
||||
Convert (
|
||||
me;
|
||||
PX, PY : Integer from Standard;
|
||||
DX, DY : out Parameter from Quantity
|
||||
)
|
||||
is virtual;
|
||||
---Level: Public
|
||||
---Purpose: Returns the DSU position depending of the PIXEL position.
|
||||
|
||||
Convert (
|
||||
me;
|
||||
DX, DY : Parameter from Quantity;
|
||||
PX, PY : out Integer from Standard
|
||||
)
|
||||
is virtual;
|
||||
---Level: Public
|
||||
---Purpose: Returns the PIXEL position depending of the DSU position.
|
||||
|
||||
HWindow ( me )
|
||||
returns Handle from Aspect is static;
|
||||
---Level: Public
|
||||
@ -541,29 +195,8 @@ class Window from WNT inherits Window from Aspect
|
||||
---Purpose: Returns the Windows NT handle parent of the created window <me>.
|
||||
---C++: inline
|
||||
|
||||
HPixmap ( me )
|
||||
returns Handle from Aspect is static;
|
||||
---Level: Internal
|
||||
---Purpose: Returns the Windows NT double buffer pixmap handle
|
||||
-- of the created window <me>.
|
||||
-- If BackingStore () is permitted.
|
||||
---C++: inline
|
||||
|
||||
WndProc ( me )
|
||||
returns Address from Standard;
|
||||
---Level: Internal
|
||||
---Purpose: Returns address of the window procedure.
|
||||
---C++: inline
|
||||
|
||||
ImageManager ( me )
|
||||
returns ImageManager from WNT is static;
|
||||
---Level: Internal
|
||||
---Purpose: Returns ImageManager of the Window.
|
||||
---C++: inline
|
||||
|
||||
doCreate (
|
||||
me : mutable;
|
||||
aDevice : GraphicDevice from WNT;
|
||||
aHandle : Handle from Aspect;
|
||||
aBackColor : NameOfColor from Quantity = Quantity_NOC_MATRAGRAY
|
||||
) is static private;
|
||||
@ -579,17 +212,7 @@ 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
|
||||
myHPixmap : Handle from Aspect is protected; -- Bitmap handle
|
||||
myDoubleBuffer : Boolean from Standard is protected; -- DoubleBuffer flag
|
||||
myExtraData : WindowData from WNT is protected; -- additional data
|
||||
myFormat : TypeOfImage from WNT is protected; -- type of output image
|
||||
myImages : ImageManager from WNT is protected;
|
||||
myIcon : Icon from WNT is protected;
|
||||
myWndProc : Address from Standard is protected; -- address of window procedure
|
||||
myUsrData : Address from Standard is protected;
|
||||
|
||||
friends
|
||||
|
||||
class IconBox from WNT
|
||||
|
||||
end Window;
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -19,18 +19,6 @@
|
||||
// GG RIC120302 Add a NEW HParentWindow method which enable
|
||||
// to retrieve the parent of the actual Hwindow handle.
|
||||
|
||||
inline Standard_Address WNT_Window :: WndProc () const {
|
||||
|
||||
return myWndProc;
|
||||
|
||||
} // end WNT_Window :: WndProc
|
||||
|
||||
inline Standard_Boolean WNT_Window :: DoubleBuffer () const {
|
||||
|
||||
return myDoubleBuffer;
|
||||
|
||||
} // end WNT_Window :: DoubleBuffer
|
||||
|
||||
inline Aspect_Handle WNT_Window :: HWindow () const {
|
||||
|
||||
return myHWindow;
|
||||
@ -42,15 +30,3 @@ inline Aspect_Handle WNT_Window :: HParentWindow () const {
|
||||
return myHParentWindow;
|
||||
|
||||
} // end WNT_Window :: HWindow
|
||||
|
||||
inline Aspect_Handle WNT_Window :: HPixmap () const {
|
||||
|
||||
return myHPixmap;
|
||||
|
||||
} // end WNT_Window :: HPixmap
|
||||
|
||||
inline Handle_WNT_ImageManager WNT_Window :: ImageManager () const {
|
||||
|
||||
return myImages;
|
||||
|
||||
} // end WNT_Window :: ImageManager
|
||||
|
@ -1,85 +0,0 @@
|
||||
// Copyright (c) 1996-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2012 OPEN CASCADE SAS
|
||||
//
|
||||
// The content of this file is subject to the Open CASCADE Technology Public
|
||||
// License Version 6.5 (the "License"). You may not use the content of this file
|
||||
// except in compliance with the License. Please obtain a copy of the License
|
||||
// at http://www.opencascade.org and read it completely before using this file.
|
||||
//
|
||||
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
|
||||
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
|
||||
//
|
||||
// The Original Code and all software distributed under the License is
|
||||
// distributed on an "AS IS" basis, without warranty of any kind, and the
|
||||
// Initial Developer hereby disclaims all such warranties, including without
|
||||
// limitation, any warranties of merchantability, fitness for a particular
|
||||
// purpose or non-infringement. Please see the License for the specific terms
|
||||
// and conditions governing the rights and limitations under the License.
|
||||
|
||||
// include windows.h first to have all definitions available
|
||||
#include <windows.h>
|
||||
|
||||
#include <WNT_Window.hxx>
|
||||
|
||||
//***//
|
||||
//*** This window procedure provides management of the window background. ***//
|
||||
//*** Background belongs to the window class but we need that windows which ***//
|
||||
//*** are based on the same class have different backgrounds. So, we are ***//
|
||||
//*** using window subclassing technique to provide this ability. ***//
|
||||
//***//
|
||||
LRESULT CALLBACK WNT_WndProc (
|
||||
HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam
|
||||
) {
|
||||
|
||||
HDC hDC;
|
||||
HPALETTE hOldPal;
|
||||
WNDPROC lpfnWndProc;
|
||||
WINDOW_DATA* wd;
|
||||
WNT_Window* win;
|
||||
RECT invRect;
|
||||
|
||||
wd = (WINDOW_DATA* )GetWindowLongPtr (hwnd, GWLP_USERDATA);
|
||||
win = (WNT_Window* )wd->WNT_Window_Ptr;
|
||||
lpfnWndProc = (WNDPROC )win->WndProc();
|
||||
|
||||
if ( msg == WM_ERASEBKGND && !( wd -> dwFlags & WDF_NOERASEBKGRND ) ) {
|
||||
|
||||
hDC = ( HDC )wParam;
|
||||
|
||||
if ( wd -> hPal ) {
|
||||
|
||||
hOldPal = SelectPalette ( hDC, wd -> hPal, FALSE );
|
||||
|
||||
if ( RealizePalette ( hDC ) )
|
||||
|
||||
UpdateColors ( hDC );
|
||||
|
||||
} // end if
|
||||
|
||||
GetClipBox ( hDC, &invRect );
|
||||
FillRect ( hDC, &invRect, ( HBRUSH )( win -> HBackground () ) );
|
||||
|
||||
if ( wd -> hPal )
|
||||
|
||||
SelectPalette ( hDC, hOldPal, FALSE );
|
||||
|
||||
return TRUE;
|
||||
|
||||
} else if ( msg == WM_MOVE ) {
|
||||
|
||||
WINDOWPLACEMENT wp;
|
||||
|
||||
wp.length = sizeof ( WINDOWPLACEMENT );
|
||||
GetWindowPlacement ( hwnd, &wp );
|
||||
|
||||
win -> SetPos (
|
||||
wp.rcNormalPosition.left, wp.rcNormalPosition.top,
|
||||
wp.rcNormalPosition.right, wp.rcNormalPosition.bottom
|
||||
);
|
||||
|
||||
} // end else
|
||||
|
||||
return CallWindowProc ( lpfnWndProc, hwnd, msg, wParam, lParam );
|
||||
|
||||
} // end WNT_WndProc
|
||||
//***//
|
@ -70,14 +70,6 @@ is
|
||||
---Purpose: Creates the X Markmap
|
||||
---Category: Classes
|
||||
|
||||
class GraphicDevice;
|
||||
---Purpose: Creates the X Device (Connexion & Visual)
|
||||
---Category: Classes
|
||||
|
||||
class IconBox;
|
||||
---Purpose: Creates the X Icon Box
|
||||
---Category: Classes
|
||||
|
||||
-------------------------
|
||||
-- Category: Enumerations
|
||||
-------------------------
|
||||
|
@ -307,7 +307,6 @@ fields
|
||||
|
||||
friends
|
||||
|
||||
class GraphicDevice from Xw,
|
||||
class Window from Xw
|
||||
|
||||
end ColorMap;
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user