Exemplo n.º 1
0
Arquivo: tzzoloq2.c Projeto: DeegC/10d
//:   VIEW TZZOLODO  REGISTERED AS TZZOLODO
zOPER_EXPORT zSHORT OPERATION
Cancel( zVIEW     vSubtask )
{
   zVIEW     TZZOLODO = 0; 
   zSHORT    RESULT; 

   RESULT = GetViewByName( &TZZOLODO, "TZZOLODO", vSubtask, zLEVEL_TASK );

   //:ResetView( TZZOLODO )
   ResetView( TZZOLODO );
   //:CancelSubobject( TZZOLODO, "LOD_EntityParent" )
   CancelSubobject( TZZOLODO, "LOD_EntityParent" );
   return( 0 );
// END
} 
Exemplo n.º 2
0
Arquivo: tzzoloq2.c Projeto: DeegC/10d
//:   VIEW TZZOLODO  REGISTERED AS TZZOLODO
zOPER_EXPORT zSHORT OPERATION
Prebuild( zVIEW     vSubtask )
{
   zVIEW     TZZOLODO = 0; 
   zSHORT    RESULT; 

   RESULT = GetViewByName( &TZZOLODO, "TZZOLODO", vSubtask, zLEVEL_TASK );

   //:ResetView( TZZOLODO )
   ResetView( TZZOLODO );
   //:CreateTemporalSubobjectVersion( TZZOLODO, "LOD_EntityParent" )
   CreateTemporalSubobjectVersion( TZZOLODO, "LOD_EntityParent" );
   return( 0 );
// END
} 
idGLDrawableView::idGLDrawableView() {
	material = NULL;
	modelDefHandle = -1;

	objectId = 0;
	showLights = true;
	realTime = 16;

	viewOrigin.Set( 0.f, 0.f, 0.f );
	viewRotation.Set( 0.f, 0.f, 0.f );
	viewDistance = -196.f;

	world = NULL;
	worldModel = NULL;

	ResetView();
}
Exemplo n.º 4
0
//:   VIEW TZZOLODO  REGISTERED AS TZZOLODO
zOPER_EXPORT zSHORT OPERATION
OK( zVIEW     vSubtask )
{
   zVIEW     TZZOLODO = 0; 
   zSHORT    RESULT; 

   RESULT = GetViewByName( &TZZOLODO, "TZZOLODO", vSubtask, zLEVEL_TASK );

   //://EntityAboutToBeChanged( vSubtask )

   //:ResetView( TZZOLODO )
   ResetView( TZZOLODO );
   //:AcceptSubobject( TZZOLODO, "LOD_EntityParent" )
   AcceptSubobject( TZZOLODO, "LOD_EntityParent" );
   return( 0 );
// END
} 
Exemplo n.º 5
0
void CPlaylist::RefreshPlaylist()
{
	if (playlist_mode) {
		u32 count = gf_cfg_get_key_count(m_user->config, "Playlist");
		ResetView();
		for (u32 i=0; i<count; i++) {
			const char *opt = gf_cfg_get_key_name(m_user->config, "Playlist", i);
			const char *sep = strrchr(opt, '\\');
			if (!sep) sep = strrchr(opt, '/');
			AddItem(sep ? (sep+1) : opt, 0);
		}
		if (!count) AddItem("[empty]", 0);

		FlushItemList();

		((COsmo4AppUi *) CEikonEnv::Static()->AppUi())->SetTitle("Playlist", 0);
	} else {
		ScanDirectory(szCurrentDir);
	}
}
Exemplo n.º 6
0
void C3dCamera::PositionCamera()
{
	if(m_bResetClippingPlanes)
	{
		// Reset our cameras clipping plane
		ResetView();
		m_bResetClippingPlanes = FALSE;
	}

	if(m_fRoll)
	{
		sgCMatrix matx;
		SG_VECTOR UpVector;

		matx.Rotate(zero_p, x_axe, m_fPitch/180.0*Pi);
		matx.Rotate(zero_p, y_axe, m_fRoll/180.0*Pi);
		matx.Rotate(zero_p, z_axe, -m_fYaw/180.0*Pi);
		
		UpVector = z_axe;
		matx.ApplyMatrixToVector(zero_p,UpVector);
		
		// Position the camera using the newly calculated 'Up' vector
		gluLookAt(m_fEyePos.x,    m_fEyePos.y,    m_fEyePos.z,
				  m_fLookAtPos.x, m_fLookAtPos.y, m_fLookAtPos.z,
				  UpVector.x,     UpVector.y,     UpVector.z);
	}
	else
	{
		// Since our 'Up' vector has already been calculated, all we need to do is
		// position the camera..
		gluLookAt(m_fEyePos.x,    m_fEyePos.y,    m_fEyePos.z,
				  m_fLookAtPos.x, m_fLookAtPos.y, m_fLookAtPos.z,
				  m_fUpVector.x,  m_fUpVector.y,  m_fUpVector.z);
	}

	// Save the Model view matrix.  This is used later for
	// conversion of mouse coordinates to world coordinates.
	glGetDoublev(GL_MODELVIEW_MATRIX, m_dModelViewMatrix);
}
Exemplo n.º 7
0
void C3dCamera::FitBounds(double minX, double minY, double minZ, 
						  double maxX, double maxY,double maxZ)
{
	boundingPlane boundsRight;
	boundingPlane boundsLeft;
	boundingPlane boundsTop;
	boundingPlane boundsBottom;
	boundingPlane boundsNear;
	boundingPlane boundsFar;
	SG_VECTOR boundsMax;
	SG_VECTOR boundsMin;
	SG_VECTOR vecCenter;
	SG_VECTOR vertices[8];
	SG_VECTOR vecOffset;
	sgCMatrix matrix;
	GLdouble focalLength;
	GLdouble fDepthWidth, fDepthHeight;
	GLdouble rx, ry, rz;
	GLdouble fTan;
	GLdouble fx, fz;

	// Initialize our function variables
	boundsRight.fDepth	= 0.0;
	boundsLeft.fDepth	= 0.0;
	boundsTop.fDepth	= 0.0;
	boundsBottom.fDepth	= 0.0;
	boundsNear.fDepth	= 0.0;
	boundsFar.fDepth	= 0.0;
	memset(&(boundsRight.vec),0,sizeof(SG_VECTOR));
	memset(&(boundsLeft.vec),0,sizeof(SG_VECTOR));
	memset(&(boundsTop.vec),0,sizeof(SG_VECTOR));
	memset(&(boundsBottom.vec),0,sizeof(SG_VECTOR));
	memset(&(boundsNear.vec),0,sizeof(SG_VECTOR));
	memset(&(boundsFar.vec),0,sizeof(SG_VECTOR));
	memset(&(vecOffset),0,sizeof(SG_VECTOR));
	memset(&(boundsMin),0,sizeof(SG_VECTOR));
	memset(&(boundsMax),0,sizeof(SG_VECTOR));
	memset(&(vecCenter),0,sizeof(SG_VECTOR));
	
	fTan = (double)tanf((float)Radiansf(m_fFovY/2));


	// Get the cameras rotatiom about the LookAt position, as we 
	// will use this to restore the rotation values after we move
	// the camera and it's focal length.
	GetRotationAboutLookAt(&rx, &ry, &rz);

	// Copy the bounds to our local variable
	boundsMin.x = minX;	boundsMin.y = minY;	boundsMin.z = minZ;
	boundsMax.x = maxX;	boundsMax.y = maxY;	boundsMax.z = maxZ;

	double spanX, spanY, spanZ;

	spanX = Diff(boundsMax.x, boundsMin.x);
	spanY = Diff(boundsMax.y, boundsMin.y);
	spanZ = Diff(boundsMax.z, boundsMin.z);

	vecCenter.x = boundsMax.x - fabs(spanX)/2;
	vecCenter.y = boundsMax.y - fabs(spanY)/2;
	vecCenter.z = boundsMax.z - fabs(spanZ)/2;

	boundsMax.x = spanX/2;
	boundsMax.y = spanY/2;
	boundsMax.z = spanZ/2;

	boundsMin.x = -spanX/2;
	boundsMin.y = -spanY/2;
	boundsMin.z = -spanZ/2;

	// Given the bounding box, fill in the missing vertices to complete our
	// cube
	vertices[0] = boundsMax;	// Left
vertices[1].x = boundsMax.x; vertices[1].y = boundsMax.y; vertices[1].z = boundsMin.x;
vertices[2].x = boundsMax.x; vertices[2].y = boundsMin.y; vertices[2].z = boundsMin.x;
vertices[3].x = boundsMax.x; vertices[3].y = boundsMin.y; vertices[3].z = boundsMax.x;
	
	vertices[4] = boundsMin;
vertices[5].x = boundsMin.x; vertices[5].y = boundsMin.y; vertices[5].z = boundsMax.x;
vertices[6].x = boundsMin.x; vertices[6].y = boundsMax.y; vertices[6].z = boundsMax.x;
vertices[7].x = boundsMin.x; vertices[7].y = boundsMax.y; vertices[7].z = boundsMin.x;

	// Get the cameras rotation matrix
	GetRotationMatrix(matrix);

	for(int i=0; i<8; i++)
	{
		// Transform the vertice by the camera rotation matrix.  Since we define the 
		// default 'Up' camera position as Z-axis Up, the coordinates map as follows:
		//		X maps to Width,
		//		Y maps to Depth
		//		Z mpas to Height
		zero_p.x  = zero_p.y  =zero_p.z  =0.0;
		matrix.ApplyMatrixToVector(zero_p, vertices[i]);

		// Calculate the focal length needed to fit the near bounding plane
		fDepthWidth  = (fabs(vertices[i].x)/fTan/m_fAspect)-vertices[i].y;
		fDepthHeight = (fabs(vertices[i].z)/fTan)-vertices[i].y;


		// Calculate the Near clipping bounds.  This will be used to fit Isometric views and
		// for calculating the Near/Far clipping m_fFrustum.
		if(vertices[i].y<0)
		{
			if( fabs(vertices[i].x) > fabs(boundsNear.vec.x) ||
			   (fabs(vertices[i].x) == boundsNear.vec.x && fabs(vertices[i].y) > fabs(boundsNear.vec.z)) )
			{
				boundsNear.vec.x = fabs(vertices[i].x);
				boundsNear.vec.z = fabs(vertices[i].y);
			}

			if( fabs(vertices[i].z) > fabs(boundsNear.vec.y) ||
			   (fabs(vertices[i].z) == boundsNear.vec.y) )
			{
				boundsNear.vec.y = fabs(vertices[i].z);
				//boundsNear.vec[W] = fabs(vertices[i].y);
			}

			// Get the bounding depth closest to the viewer
			if(fDepthWidth < boundsNear.fDepth || boundsNear.fDepth == 0)
				boundsNear.fDepth = fDepthWidth;
			if(fDepthHeight < boundsNear.fDepth || boundsNear.fDepth == 0)
				boundsNear.fDepth = fDepthHeight;
		}
		else
		{
			if( fabs(vertices[i].x) > fabs(boundsFar.vec.x) ||
			   (fabs(vertices[i].x) == boundsFar.vec.x && fabs(vertices[i].y) < fabs(boundsFar.vec.z)) )
			{
				boundsFar.vec.x = vertices[i].x;
				boundsFar.vec.z = vertices[i].y;
			}

			if( fabs(vertices[i].z) > fabs(boundsFar.vec.y) ||
			   (fabs(vertices[i].z) == fabs(boundsFar.vec.y)) )
			{
				boundsFar.vec.y = vertices[i].z;
				//boundsFar.vec[W] = vertices[i].y;
			}

			// Get the bounding depth furtherest from the viewer
			if(fDepthWidth > boundsFar.fDepth)
				boundsFar.fDepth = fDepthWidth;
			if(fDepthHeight > boundsFar.fDepth)
				boundsFar.fDepth = fDepthHeight;
		}


		// Calculate the Right, Left, Top and Bottom clipping bounds.  This will be used to fit
		// Perspective views.
		if(vertices[i].x > 0)
		{
			if(fDepthWidth > boundsRight.fDepth)
			{
				boundsRight.fDepth = fDepthWidth;
				boundsRight.vec.x = vertices[i].x;
				//boundsRight.vec[W] = vertices[i].y;
			}
		}
		if(vertices[i].x <= 0)
		{
			if(fDepthWidth > boundsLeft.fDepth)
			{
				boundsLeft.fDepth = fDepthWidth;
				boundsLeft.vec.x = vertices[i].x;
				//boundsLeft.vec[W] = vertices[i].y;
			}
		}
		if(vertices[i].z > 0)
		{
			if(fDepthHeight > boundsTop.fDepth)
			{
				boundsTop.fDepth = fDepthHeight;
				boundsTop.vec.x = vertices[i].x;
				//boundsTop.vec[W] = vertices[i].y;
			}
		}
		if(vertices[i].z <= 0)
		{
			if(fDepthHeight > boundsBottom.fDepth)
			{
				boundsBottom.fDepth = fDepthHeight;
				boundsBottom.vec.x = vertices[i].x;
				//boundsBottom.vec[W] = vertices[i].y;
			}
		}
	}

	// Now that we have the view clipping bounds, we can calculate the focal depth
	// required to fit the volumn and the offset necessary to center the volumn.
	if(m_bPerspective)
	{
		sgCMatrix invMatrix;

		if(boundsRight.fDepth == boundsLeft.fDepth &&
		   boundsTop.fDepth == boundsBottom.fDepth )
		{
			// Front, Side or Top view

			//  Since the bounds are symetric, just use the Right and Top focal depth.
			fx = boundsRight.fDepth;
			fz = boundsTop.fDepth;

			// No offset necessary
			vecOffset.x = vecOffset.y = vecOffset.z = 0.0;
		}
		else
		{
			// Calculate the average focal length needed to fit the bounding box
			fx = (boundsRight.fDepth + boundsLeft.fDepth)/2;
			fz = (boundsTop.fDepth + boundsBottom.fDepth)/2;

			// Calculate the offset necessary to center the bounding box.  Note that we
			// use a scaling factor for centering the non-limiting bounds to achieve a
			// more visually appealing center.
			if(fx > fz)
			{
				GLdouble fScale	= sqrt(boundsTop.fDepth/boundsBottom.fDepth);
				GLdouble fTop	= fTan*fx - fTan*boundsTop.fDepth;
				GLdouble fBottom = fTan*fx - fTan*boundsBottom.fDepth;

				vecOffset.x = (fTan*m_fAspect*boundsRight.fDepth - fTan*m_fAspect*fx);
				vecOffset.z = (fBottom-fTop*fScale)/2;
			}
			else
			{
				GLdouble fScale	= sqrt(boundsLeft.fDepth/boundsRight.fDepth);
				GLdouble fRight = fTan*m_fAspect*fz - fTan*m_fAspect*boundsRight.fDepth;
				GLdouble fLeft  = fTan*m_fAspect*fz - fTan*m_fAspect*boundsLeft.fDepth;

				vecOffset.z = (fTan*boundsTop.fDepth - fTan*fz);
				vecOffset.x = (fLeft - fRight*fScale)/2; 
			}
		}

		// Now that we have the offsets necessary to center the bounds, we must rotate
		// the vertices (camera coordinates) by the cameras inverse rotation matrix to
		// convert the offsets to world coordinates.
		GetInvRotationMatrix(invMatrix);
		zero_p.x  = zero_p.y  =zero_p.z  =0.0;

		invMatrix.ApplyMatrixToVector(zero_p,vecOffset);
	
	}
	else
	{
		// Isometric View
		// Calculate the focal length needed to fit the near bounding plane
		if(m_iScreenWidth <= m_iScreenHeight)
		{
			fx = boundsNear.vec.x/tanf((float)Radiansf(m_fFovY/2));
			fz = boundsNear.vec.y/tanf((float)Radiansf(m_fFovY/2))/((GLdouble)m_iScreenHeight/(GLdouble)m_iScreenWidth);
		}
		else
		{
			fx = boundsNear.vec.x/tanf((float)Radiansf(m_fFovY/2))/m_fAspect;
			fz = boundsNear.vec.y/tanf((float)Radiansf(m_fFovY/2));
		}
	}
	
	// Set the focal length equal to the largest length required to fit either the 
	// Width (Horizontal) or Height (Vertical)
	focalLength = (fx > fz? fx : fz);

	// Set the camera's new LookAt position to focus on the center
	// of the bounding box.
	SetLookAtPos(vecCenter.x+vecOffset.x, vecCenter.y+vecOffset.y, vecCenter.z+vecOffset.z);

	// Set the camera focal Length
	if(focalLength > m_fNear)
		SetFocalLength(focalLength, TRUE);

	// Adjust the Near clipping plane if necessary
//	if((boundsNear.fDepth/2) > 0.5f)
//		m_fNear = boundsNear.fDepth/2;

	// Adjust the Far clipping plane if necessary
	if(focalLength+boundsFar.fDepth > m_fFar)
		m_fFar = focalLength+boundsFar.fDepth;

	// Recalculate the camera view m_fFrustum;
	ResetView();

	// Restore the cameras rotation about the LookAt position
	SetRotationAboutLookAt(rx, ry, rz);
}
Exemplo n.º 8
0
/**
 * The main entry point for the application.
 */
int APIENTRY _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow)
{
	UNREFERENCED_PARAMETER(hPrevInstance);
	UNREFERENCED_PARAMETER(lpCmdLine);

	// Initialize global strings
	LoadString(hInstance, IDS_APP_TITLE, gWindowTitle, sizeof(gWindowTitle));
	LoadString(hInstance, IDC_STREAMING, gWindowClass, sizeof(gWindowClass));

	// Register the window class
	RegisterWindowClass(hInstance);

	// Perform application initialization:
	if ( !InitInstance(hInstance, nCmdShow) )
	{
		return FALSE;
	}

	// Set the view to the default position
	ResetView();

	// Cache the last mouse position
	GetCursorPos(&gLastMousePos);

	// Initialize the Twitch SDK
	InitializeStreaming("<username>", "<password>", "<clientId>", "<clientSecret>", GetIntelDllPath());

	// Main message loop
	MSG msg;
	while (true)
	{
		// Check to see if any messages are waiting in the queue
		while (PeekMessage(&msg, nullptr, 0, 0, PM_REMOVE))
		{
			// Process window messages
			TranslateMessage(&msg);
			DispatchMessage(&msg);

			// Received a quit message
			if (msg.message == WM_QUIT)
			{
				break;
			}
		}

		// Received a quit message so exit the app
		if (msg.message == WM_QUIT)
		{
			break;
		}

		if (gReinitializeRequired)
		{
			gReinitializeRequired = false;
			InitializeRendering();
		}

		// Draw the scene
		RenderScene();

		UpdateWaveMesh();

		// Process user input independent of the event queue
		if (gFocused)
		{
			HandleInput();
		}

		// Record the frame time
		unsigned __int64 curTime = GetSystemTimeMs();

		// Begin streaming when ready
		if (gStreamingDesired && 
			!IsStreaming() &&
			IsReadyToStream())
		{
			StartStreaming(gBroadcastWidth, gBroadcastHeight, gBroadcastFramesPerSecond);

			gLastCaptureTime = 0;
		}

		// If you send frames too quickly to the SDK (based on the broadcast FPS you configured) it will not be able 
		// to make use of them all.  In that case, it will simply release buffers without using them which means the
		// game wasted time doing the capture.  To mitigate this, the app should pace the captures to the broadcast FPS.
		unsigned __int64 captureDelta = curTime - gLastCaptureTime;
		bool isTimeForNextCapture = (captureDelta / 1000.0) >= (1.0 / gBroadcastFramesPerSecond);

		// streaming is in progress so try and capture a frame
		if (IsStreaming() && 
			!gPaused &&
			isTimeForNextCapture)
		{
			// capture a snapshot of the back buffer
			unsigned char* pBgraFrame = nullptr;
			int width = 0;
			int height = 0;
			bool gotFrame = false;

			switch (gCaptureMethod)
			{
			case CaptureMethod::Slow:
				gotFrame = CaptureFrame_Slow(gBroadcastWidth, gBroadcastHeight, pBgraFrame);
				break;
			case CaptureMethod::Fast:
				gotFrame = CaptureFrame_Fast(gBroadcastWidth, gBroadcastHeight, pBgraFrame, width, height);
				break;
			}

			// send a frame to the stream
			if (gotFrame)
			{
				SubmitFrame(pBgraFrame);
			}
		}

		// The SDK may generate events that need to be handled by the main thread so we should handle them
		FlushStreamingEvents();

		unsigned __int64 timePerFrame = curTime - gLastFrameTime;
		unsigned int fps = 0;
		if (timePerFrame > 0)
		{
			fps = static_cast<int>(1000 / timePerFrame);
		}
		gLastFrameTime = curTime;

		// Update the window title to show the state
		#undef STREAM_STATE
		#define STREAM_STATE(__state__) #__state__,

		char buffer[128];
		const char* streamStates[] = 
		{
			STREAM_STATE_LIST
		};
		#undef STREAM_STATE

		sprintf_s(buffer, sizeof(buffer), "Twitch Direct3D Streaming Sample - %s - %s    FPS=%d", GetUsername().c_str(), streamStates[GetStreamState()], fps);
		SetWindowTextA(gWindowHandle, buffer);
	}

	// Shutdown the Twitch SDK
	StopStreaming();
	ShutdownStreaming();

	// Cleanup the rendering method
	switch (gCaptureMethod)
	{
	case CaptureMethod::Slow:
		DeinitRendering_Slow();
		break;
	case CaptureMethod::Fast:
		DeinitRendering_Fast();
		break;
	}

	// Shutdown the app
	gGraphicsDevice->Release();
	gDirect3D->Release();

	// Cleanup the mesh
	DestroyWaveMesh();

	return (int)msg.wParam;
}
Exemplo n.º 9
0
//:DIALOG OPERATION
//:RemoveAll ( VIEW vSubtask )
//:   VIEW TZTENVRO      REGISTERED AS TZTENVRO
zOPER_EXPORT zSHORT OPERATION
RemoveAll( zVIEW     vSubtask )
{
   zVIEW     TZTENVRO = 0; 
   zSHORT    RESULT; 
   //:VIEW TZZOLODO      REGISTERED AS TZZOLODO
   zVIEW     TZZOLODO = 0; 
   //:VIEW TZZOLODO_Hier BASED ON LOD  TZZOLODO
   zVIEW     TZZOLODO_Hier = 0; 
   //:STRING ( 100 ) szEntityName
   zCHAR     szEntityName[ 101 ] = { 0 }; 
   //:SHORT          sReturnLevel
   zSHORT    sReturnLevel = 0; 
   //:SHORT          nRC
   zSHORT    nRC = 0; 
   //:INTEGER        lAbsPos
   zLONG     lAbsPos = 0; 
   //:INTEGER        lDataSourceZKey
   zLONG     lDataSourceZKey = 0; 

   RESULT = GetViewByName( &TZTENVRO, "TZTENVRO", vSubtask, zLEVEL_TASK );
   RESULT = GetViewByName( &TZZOLODO, "TZZOLODO", vSubtask, zLEVEL_TASK );

   //:CreateViewFromViewForTask( TZZOLODO, TZZOLODO, vSubtask )
   CreateViewFromViewForTask( &TZZOLODO, TZZOLODO, vSubtask );
   //:ResetView( TZZOLODO )
   ResetView( TZZOLODO );

   //:CreateViewFromViewForTask( TZZOLODO_Hier, TZZOLODO, vSubtask )
   CreateViewFromViewForTask( &TZZOLODO_Hier, TZZOLODO, vSubtask );

   //:szEntityName    = "LOD_EntityParent"
   ZeidonStringCopy( szEntityName, 1, 0, "LOD_EntityParent", 1, 0, 101 );
   //:lDataSourceZKey = TZTENVRO.TE_DBMS_Source.ZKey
   GetIntegerFromAttribute( &lDataSourceZKey, TZTENVRO, "TE_DBMS_Source", "ZKey" );

   //:nRC = DefineHierarchicalCursor( TZZOLODO_Hier, "LOD_EntityParent" )
   nRC = DefineHierarchicalCursor( TZZOLODO_Hier, "LOD_EntityParent" );
   //:LOOP WHILE nRC >= zCURSOR_SET
   while ( nRC >= zCURSOR_SET )
   { 

      //: IF nRC = zCURSOR_SET_RECURSIVECHILD
      if ( nRC == zCURSOR_SET_RECURSIVECHILD )
      { 
         //: SetViewToSubobject( TZZOLODO_Hier, "LOD_EntityChild" )
         SetViewToSubobject( TZZOLODO_Hier, "LOD_EntityChild" );
      } 

      //: END

      //: // Set up our temp view from the hier view.
      //: GetAbsolutePositionForEntity( lAbsPos, TZZOLODO_Hier, "LOD_EntityParent" )
      GetAbsolutePositionForEntity( &lAbsPos, TZZOLODO_Hier, "LOD_EntityParent" );
      //: SetCursorAbsolutePosition( szEntityName, TZZOLODO, lAbsPos )
      SetCursorAbsolutePosition( szEntityName, TZZOLODO, lAbsPos );

      //: IF szEntityName = "LOD_EntityParent"
      if ( ZeidonStringCompare( szEntityName, 1, 0, "LOD_EntityParent", 1, 0, 101 ) == 0 )
      { 

         //:  SET CURSOR FIRST TZZOLODO.POD_Entity
         //:             WHERE TZZOLODO.TE_DBMS_SourceForEntity.ZKey = lDataSourceZKey
         RESULT = SetCursorFirstEntity( TZZOLODO, "POD_Entity", "" );
         if ( RESULT > zCURSOR_UNCHANGED )
         { 
            while ( RESULT > zCURSOR_UNCHANGED && ( CompareAttributeToInteger( TZZOLODO, "TE_DBMS_SourceForEntity", "ZKey", lDataSourceZKey ) != 0 ) )
            { 
               RESULT = SetCursorNextEntity( TZZOLODO, "POD_Entity", "" );
            } 

         } 


         //:  IF RESULT >= zCURSOR_SET
         if ( RESULT >= zCURSOR_SET )
         { 
            //:  TZZOLODO.POD_Entity.SQL_JoinWithParent = "N"
            SetAttributeFromString( TZZOLODO, "POD_Entity", "SQL_JoinWithParent", "N" );
         } 

         //:  END
      } 

      //: END

      //: nRC = SetCursorNextEntityHierarchical( sReturnLevel, szEntityName, TZZOLODO_Hier )
      nRC = SetCursorNextEntityHierarchical( (zPUSHORT) &sReturnLevel, szEntityName, TZZOLODO_Hier );
   } 

   //:END

   //:DropView( TZZOLODO_Hier )
   DropView( TZZOLODO_Hier );
   //:DropView( TZZOLODO )
   DropView( TZZOLODO );

   //:RefreshCtrl( vSubtask, "JoinCheck" )
   RefreshCtrl( vSubtask, "JoinCheck" );
   return( 0 );
// END
} 
Exemplo n.º 10
0
void __fastcall TTestBedForm::FormResize(TObject *Sender)
{
  ResetView();
}
Exemplo n.º 11
0
/**
 * Handles user input.
 */
void HandleInput()
{
	float timeDelta = (GetSystemTimeMs() - gLastFrameTime) / 1000.0f;

	D3DXMATRIX tx;

	// handle camera rotation
	if (GetAsyncKeyState(VK_RBUTTON))
	{
		POINT last = gLastMousePos;
		GetCursorPos(&gLastMousePos);

		const float dampening = 10.0f;
		float dx = (gLastMousePos.x - last.x) / dampening;
		float dy = (gLastMousePos.y - last.y) / dampening;

		if (dx != 0)
		{
			D3DXMatrixRotationY(&tx, -D3DXToRadian(dx) * timeDelta * gCameraRotateSpeed);
			gViewMatrix = gViewMatrix * tx;
		}

		if (dy != 0)
		{
			D3DXMatrixRotationX(&tx, -D3DXToRadian(dy) * timeDelta * gCameraRotateSpeed);
			gViewMatrix = gViewMatrix * tx;
		}
	}

	// handle camera fly through
	FLOAT x = 0;
	FLOAT y = 0;
	FLOAT z = 0;
	if (GetAsyncKeyState('A'))
	{
		x += gCameraFlySpeed * timeDelta;
	}
	if (GetAsyncKeyState('D'))
	{
		x -= gCameraFlySpeed * timeDelta;
	}
	if (GetAsyncKeyState('E'))
	{
		y -= gCameraFlySpeed * timeDelta;
	}
	if (GetAsyncKeyState('Q'))
	{
		y += gCameraFlySpeed * timeDelta;
	}
	if (GetAsyncKeyState('W'))
	{
		z -= gCameraFlySpeed * timeDelta;
	}
	if (GetAsyncKeyState('S'))
	{
		z += gCameraFlySpeed * timeDelta;
	}

	D3DXMatrixTranslation(&tx, x, y, z);
	gViewMatrix = gViewMatrix * tx;

	// Reset the view
	if (GetAsyncKeyState('R'))
	{
		ResetView();
	}

	// Get the latest mouse position
	GetCursorPos(&gLastMousePos);

	// play a commercial
	if (GetAsyncKeyState('P'))
	{
		RunCommercial();
	}
}
Exemplo n.º 12
0
void Camera::Initialize()
{
    ResetView();
}
Exemplo n.º 13
0
void PlotDefC::ChangeView(const PC_View&  newView)
{
    plotViews.PushStack(newView);
    ResetView();
}
Exemplo n.º 14
0
///////////////////////////////////////////////////////////////////////
//
// PURPOSE:  This function paints the list attributes from the user spec
//           into the existing partition.
//
////////////////////////////////////////////////////////////////////////
zOPER_EXPORT zLONG OPERATION
ofnTZWDLGSO_AutoPntFldPartWLits( zVIEW  vSubtask,
                                 zVIEW  vUserSpec,
                                 zVIEW  vNewDialog,
                                 zPCHAR szListType )
{
   zVIEW  vAutoDesWk;
   zVIEW  vSubobject;
   zVIEW  vTempStyle;
   zVIEW  vCtrlDef;
   zLONG  k, j;
   zLONG  lCC, lCL;
   zLONG  lMaxLines;
   zLONG  lLine, lFirstPaintLine, lFieldsPainted, lColumn;
   zLONG  lMaxFieldDLG_X, lMaxText, lPush;
   zLONG  lGroupDLG_X, lGroupDLG_Y;
   zSHORT RESULT;
   zLONG  lLastPaintLine, lLastWindowLine, lMaxLength;
// zCHAR  cUsage[ 1 ];
   zCHAR  szMapEntity[ 33 ];
   zCHAR  szMapAttribute[ 33 ];
   zCHAR  szType[ 33 ];
   zCHAR  szWorkString[ 256 ];
   zCHAR  X_LOD_Attribute[ 16 ];
   zCHAR  X_ER_Attribute[ 15 ];

// TraceLineS( "IN", " AutoPaintPartitionWithFields" );

   // Set up variables to either I_LOD listbox or L_LOD listbox.
   if ( szListType[ 0 ] == 'I' )
   {
      zstrcpy( X_LOD_Attribute, "I_LOD_Attribute" );
      zstrcpy( X_ER_Attribute, "I_ER_Attribute" );
   }
   else
   {
      zstrcpy( X_LOD_Attribute, "L_LOD_Attribute" );
      zstrcpy( X_ER_Attribute, "L_ER_Attribute" );
   }

// TraceLineS( "IN", " AutoPaintPartitionWithFields" );

   GetViewByName( &vCtrlDef, "TZADCTLD", vNewDialog, zLEVEL_TASK );
   GetViewByName( &vAutoDesWk, "TZADWWKO", vNewDialog, zLEVEL_TASK );
   CreateViewFromViewForTask( &vSubobject, vNewDialog, 0 );

   lCL = 12;
   lCC = 5;

   /* Create a new view that will point to the UIS_ViewObjRef entity
      in the user spec object.  Sometimes vUserSpec is pointing to a
      recursive subobject and UI_ViewObjRef cannot be accessed. */
   CreateViewFromViewForTask( &vTempStyle, vUserSpec, 0 );
   ResetView( vTempStyle );

   SetViewToSubobject( vSubobject, "CtrlCtrl" );
   /* Delete any existing fields in the listbox */
   RESULT = SetCursorFirstEntity( vSubobject, "Control", "" );
   while ( RESULT > zCURSOR_UNCHANGED )
   {
      RESULT = DeleteEntity( vSubobject, "Control", zREPOS_NEXT );
   }

   GetIntegerFromAttribute( &lMaxLines, vNewDialog, "Control", "SZDLG_Y" );
   szMapEntity[ 0 ] = 0;

   lFirstPaintLine = 0;
   lLastPaintLine = 1;
   lLine          = 1;
   lMaxFieldDLG_X = 0;
   lMaxLength     = 0;
   lMaxText       = 0;
   lPush          = 0;
   lFieldsPainted = 0;

// cUsage[ 0 ] = 'U';

   /* If there is a paint object, loop through its attributes */
   RESULT = SetCursorFirstEntity( vUserSpec, X_LOD_Attribute, "" );
   while ( RESULT > zCURSOR_UNCHANGED )
   {
      /* The last line painted was at this posititon */
      lLastPaintLine = lLine;
      lColumn = 1;

      /* Create the Text Field for the Attribute */
      CreateMetaEntity( vSubtask, vSubobject, "Control", zPOS_AFTER );
      SetAttributeFromInteger( vSubobject, "Control",
                               "PSDLG_Y", lLine );
      if ( lFirstPaintLine == 0 )
         lFirstPaintLine = lLine;

      SetAttributeFromInteger( vSubobject, "Control",
                               "PSDLG_X", lColumn );
      /* Creating text field. */
      SetCursorFirstEntityByString( vCtrlDef, "ControlDef",
                                    "Tag", "Text", "" );
      IncludeSubobjectFromSubobject( vSubobject, "ControlDef",
                                     vCtrlDef, "ControlDef", zPOS_AFTER );
      // Remove the text border.
      SetAttributeFromInteger( vSubobject, "Control", "Subtype",
                               zCONTROL_BORDEROFF | zCONTROL_NOTABSTOP );
      GetStringFromAttribute( szWorkString, vUserSpec,
                              X_ER_Attribute, "ListPaintLit" );
      GetStringFromAttribute( szMapAttribute, vUserSpec,
                              X_ER_Attribute, "Name" );

      // If there is no paint literal for this attribute then
      // use the attribute name as the paint literal.
      if ( szWorkString[ 0 ] == 0 )
         zstrcpy( szWorkString, szMapAttribute );

      SetAttributeFromString( vSubobject, "Control", "Text", szWorkString );

      j = zstrlen( szWorkString );
      j = j * lCC;

      // Determine the size of the longest paint literal.
      if ( j > lMaxText )
         lMaxText = j;

      SetAttributeFromInteger( vSubobject, "Control", "SZDLG_X", j );
      SetAttributeFromInteger( vSubobject, "Control", "SZDLG_Y", lCL );

      /* Add the length of the longest paint literal
         to the column so the attribute field will be
         painted there */
      lColumn += j;
      lColumn = lColumn + lCC;

      // If there is no paint length for the field, then
      // use the field's length.
      j = ofnTZWDLGSO_GetSizeForListAttr( vSubtask, vUserSpec, szListType );

      j = j * lCC;

      // If there is no paint length for the field, then
      // use the field's length.
      if ( j > 100 )
         j = 100;
      else
      if ( j < 25 )
         j = 25;

      // Create the appropriate Data Field for the Attribute.
      CreateMetaEntity( vSubtask, vSubobject, "Control", zPOS_AFTER );

      SetAttributeFromInteger( vSubobject, "Control",
                               "PSDLG_Y",  lLine );
      SetAttributeFromInteger( vSubobject, "Control",
                               "PSDLG_X", lColumn );
      SetAttributeFromInteger( vSubobject, "Control",
                               "SZDLG_X", j );
      SetAttributeFromInteger( vSubobject, "Control",
                               "SZDLG_Y", lCL );
      // Determine the maximum column length.
      if ( lMaxFieldDLG_X < lColumn )
         lMaxFieldDLG_X = lColumn;

      lColumn += j;
      lColumn = lColumn - 1 * lCC;

      // Determine the maximum length of colum and literal.
      if ( lMaxLength < lColumn )
         lMaxLength = lColumn;

      SetCursorFirstEntityByString( vCtrlDef, "ControlDef",
                                    "Tag", "EditBox", "" );
      IncludeSubobjectFromSubobject( vSubobject, "ControlDef",
                                     vCtrlDef, "ControlDef", zPOS_AFTER );
   // SetAttributeFromInteger( vSubobject, "Control", "Type", 1010 );
      /*
      if ( cUsage[ 0 ] == 'U' )
      {
         GetStringFromAttribute( cWork, vUserSpec,
                                 X_LOD_Attribute, "DERIVEDF" );
         if ( cWork[ 0 ] != 0 )
            SetAttributeFromCharacter( vSubobject,
                                        "Control", "Type", 1000 );
      }
      */
      /* setting the group and field's ENAME and ANAME */
      CreateMetaEntity( vSubtask, vSubobject, "CtrlMap", zPOS_AFTER );

      /* set the partitions OI name */
      IncludeSubobjectFromSubobject( vSubobject, "CtrlMapView",
                                     vTempStyle, "UIS_ViewObjRef", zPOS_AFTER );
      IncludeSubobjectFromSubobject( vSubobject, "CtrlMapLOD_Attribute",
                                     vUserSpec, X_LOD_Attribute, zPOS_AFTER );
      lFieldsPainted++;
      lLine = lLine + lCL;

      RESULT = SetCursorNextEntity( vUserSpec, X_LOD_Attribute, "" );
   }

   lLastPaintLine = lLine;

   /* Get the dimensions of the partition. */
   GetIntegerFromAttribute( &lGroupDLG_X, vNewDialog, "Control", "SZDLG_X" );

   GetIntegerFromAttribute( &lGroupDLG_Y, vNewDialog, "Control", "SZDLG_Y" );

   RESULT = SetCursorFirstEntity( vSubobject, "Control", "" );
   while ( RESULT > zCURSOR_UNCHANGED )
   {
      GetIntegerFromAttribute( &lLine, vSubobject, "Control", "PSDLG_Y" );
      if ( lLine >= lFirstPaintLine && lLine <= lLastPaintLine )
      {
         GetStringFromAttribute( szType, vSubobject, "ControlDef", "Tag" );
         /* If the control is not a text control. */
         if ( zstrcmp( szType, "Text" ) != 0 )
         {
            GetIntegerFromAttribute( &j, vSubobject, "Control", "PSDLG_X" );
            GetIntegerFromAttribute( &k, vSubobject, "Control", "SZDLG_X" );

            if ( j < lMaxFieldDLG_X )
            {
               j = lMaxFieldDLG_X - j;
               if ( ( lMaxFieldDLG_X + k ) >
                    ( lMaxLength + lCC ) )
               {
                  if ( ( lMaxFieldDLG_X + k ) <= lGroupDLG_X )
                  {
                     lMaxLength = lMaxFieldDLG_X +( k - lCC );
                  }
                  else
                  {
                     j -=( ( lMaxFieldDLG_X + k ) -
                                          lGroupDLG_X );
                     if ( j > 0 )
                     {
                        AddToAttributeFromInteger( vSubobject, "Control",
                                                   "PSDLG_X", j );
                        lMaxLength = lGroupDLG_X - lCC;
                        j = -1;
                     }
                  }
               }

               if ( j > 0 )
               {
                  SetAttributeFromInteger( vSubobject, "Control",
                                           "PSDLG_X", lMaxFieldDLG_X );
               }
            }
         }

         GetIntegerFromAttribute( &j, vSubobject, "Control", "PSDLG_X" );
         GetIntegerFromAttribute( &k, vSubobject, "Control", "SZDLG_X" );
         if ( ( j + k ) >= lGroupDLG_X )
         {
            RESULT = SetCursorFirstEntity( vSubobject, "Control", "" );
            while ( RESULT > zCURSOR_UNCHANGED )
            {
               RESULT = DeleteEntity( vSubobject, "Control", zREPOS_NEXT );
            }

            MessageSend( vNewDialog, "AD10304", "Autodesigner",
                         "Partition too small( width )",
                         zMSGQ_OBJECT_CONSTRAINT_ERROR, zBEEP );

            /* the partition is not wide enough */
            return( -1 );
         }

         ///////////////////////////////////////////////////////////
         // Code to truncate fields which extend over the partition to
         // the right COMMENTED out. This is a 'too small' error as
         // noted above.
         // else
         // if ( (j + k) >= lGroupDLG_X )
         // {
         //    k =( lGroupDLG_X - 1 ) - j;
         //    SetAttributeFromInteger( vSubobject, "Control",
         //                             "SZDLG_X", k );
         // }
         ////////////////////////////////////////////////////////////
      }

      RESULT = SetCursorNextEntity( vSubobject, "Control", "" );
   }

   lLastWindowLine = lLine;

   /* If the window painted has too many lines for the
      terminal being used for painting. Attempt to
      compress the window into a more manageable size by combining
      painted fields which are located on separate lines            */

   /*
   for ( i = 1; i < 8; i++ )
   {
      if ( lLastWindowLine + 12 <= lMaxLines )
      {
         break;
      }
      fnCompressPartition( vNewDialog, i, lFirstPaintLine, lMaxText,
                           lMaxLines,
                           &lLastPaintLine, &lLastWindowLine,
                           &lMaxLength );
   }
   */

   if ( ( lLastWindowLine + lCL ) > lMaxLines )
   {
      RESULT = SetCursorFirstEntity( vSubobject, "Control", "" );
      while ( RESULT > zCURSOR_UNCHANGED )
      {
         RESULT = DeleteEntity( vSubobject, "Control", zREPOS_NEXT );
      }

      MessageSend( vNewDialog, "AD10305", "Autodesigner",
                   "Partition too small( height )",
                   zMSGQ_OBJECT_CONSTRAINT_ERROR, zBEEP );
      return( -1 );
   }

// TraceLineS( "END", " AutoPaintPartitionWithFields" );

   /* Return the last paint line for AutoDesign */
   return( lLastPaintLine );
}
Exemplo n.º 15
0
void PlotDefC:: ViewTop()
{
    plotViews.ClearStack();
    ResetView();
}
Exemplo n.º 16
0
void PlotDefC:: ViewPrev()
{
    plotViews.PopStack();
    ResetView();
}
Exemplo n.º 17
0
void Root::InitializeAsClient(const sf::VideoMode& video_mode, 
							  const std::string& window_title, 
							  const bool is_fullscreen,
							  const sf::IpAddress& server_ip, 
							  const sf::Uint16 server_port,
							  const std::string name,
							  bool is_verbose) {
    mIsServer = false;

	if(is_verbose)
		mLogger.SetShowLevels(0x00011111);
	else
		mLogger.SetShowLevels(0x00011100);

	Logger::Urgent(LogOrigin::ROOT, "Initializing Root as client.");

	// Request a 24 bits depth buffer
	// Request a 8 bits stencil buffer
	// Request 8 levels of antialiasing
	sf::ContextSettings Settings(24, 8, 8);
	
	mRenderWindow = boost::shared_ptr<sf::RenderWindow>(new sf::RenderWindow());

    // Create Render Window
    if(is_fullscreen)
        mRenderWindow->Create(video_mode, window_title, sf::Style::Fullscreen, Settings);
    else
		mRenderWindow->Create(video_mode, window_title, sf::Style::Close | sf::Style::Resize, Settings);

	// Create & initialize world view
	ResetView();

	// Load Engine Resources (Default GUI etc.)
	mResourceManager.AddImage(boost::filesystem::path("../engine/gui"),"default_gui.svg", 512.f/mWorldPixelsPerFloat, 512.f/mWorldPixelsPerFloat, "default_gui");
	GuiTexture default_gui_texture;
	default_gui_texture.LoadLayoutFile("../engine/gui/default_layout.info");
	mResourceManager.AddGuiTexture(default_gui_texture);

	int cursor_size = 24;
	mResourceManager.AddImage(boost::filesystem::path("../engine/gui"),"cursors.svg", cursor_size*16.f/mWorldPixelsPerFloat, cursor_size*16.f/mWorldPixelsPerFloat, "gui.default.cursors");

	AnimatedSprite arrow;
	arrow.SetImage(mResourceManager.GetImage("gui.default.cursors"));
	arrow.SetSubRectSize(sf::Vector2f(cursor_size,cursor_size));
	arrow.SetSubRectOffset(sf::Vector2f(0,0));
	arrow.SetFPS(0);
	arrow.SetNumFrames(1);
	mResourceManager.SetCursorSprite(arrow, MOUSECURSOR_ARROW);

	AnimatedSprite busy;
	busy.SetImage(mResourceManager.GetImage("gui.default.cursors"));
	busy.SetSubRectSize(sf::Vector2f(cursor_size,cursor_size));
	busy.SetSubRectOffset(sf::Vector2f(0,cursor_size));
	busy.SetFPS(8);
	busy.SetNumFrames(8);
	mResourceManager.SetCursorSprite(busy, MOUSECURSOR_BUSY);

	mResourceManager.SetCursor(MOUSECURSOR_ARROW);


    //mInputManager = InputManager();
    //mStateManager = StateManager();
    //mResourceManager = ResourceManager();

    // Create and Initialize Network Manager
    // mNetworkManager = NetworkManager();
    mClientName = name;
    mNetworkManager.InitializeAsClient(server_ip, server_port, name);

	mTakeScreenshot = false;
}
Exemplo n.º 18
0
MriWatcherGUI::MriWatcherGUI(QWidget *parent)
{
  setupUi(this);
  installEventFilter(this);
  setAcceptDrops(true);

  connect(g_loadimg, SIGNAL( clicked() ), this, SLOT( LoadImg() ) );
  connect(g_loadoverlay, SIGNAL( clicked() ), this, SLOT( LoadOverlay() ) );
  connect(g_loadimg2, SIGNAL( clicked() ), this, SLOT( LoadImg2() ) );
  connect(g_reset_view, SIGNAL( clicked() ), this, SLOT( ResetView() ) );
  connect(g_screenshot, SIGNAL( clicked() ), this, SLOT( ScreenShot() ) );
  connect(g_combine, SIGNAL( clicked() ), this, SLOT( Combine() ) );
  connect(g_help, SIGNAL( clicked() ), this, SLOT( Help() ) );
  connect(g_xview, SIGNAL( toggled(bool) ), this, SLOT( ChangeView() ) );
  connect(g_yview, SIGNAL( toggled(bool) ), this, SLOT( ChangeView() ) );
  connect(g_zview, SIGNAL( toggled(bool) ), this, SLOT( ChangeView() ) );
  connect(g_slice_slider, SIGNAL( sliderMoved(int) ), this, SLOT( ChangeSlice(int) ) );
//    connect(g_slice_slider, SIGNAL( valueChanged(int) ), this, SLOT( ChangeSlice(int) ));
  connect(g_overlay_alpha_slider, SIGNAL( valueChanged(int) ), this, SLOT( ChangeOverlayAlpha(int) ) );
  connect(g_draw_name, SIGNAL( stateChanged(int) ), this, SLOT( DrawImageName(int) ) );
  connect(g_draw_info, SIGNAL( stateChanged(int) ), this, SLOT( DrawImageInfo(int) ) );
  connect(g_draw_position, SIGNAL( stateChanged(int) ), this, SLOT( DrawImagePosition(int) ) );
  connect(g_draw_intensity, SIGNAL( stateChanged(int) ), this, SLOT( DrawImageIntensity(int) ) );
  connect(g_overlayzero, SIGNAL( stateChanged(int) ), this, SLOT( ChangeOverlayZero() ) );
  connect(g_intensity_min_slider, SIGNAL( valueChanged(int) ), this, SLOT( ChangeIntensityMin(int) ) );
  connect(g_intensity_max_slider, SIGNAL( valueChanged(int) ), this, SLOT( ChangeIntensityMax(int) ) );
  connect(g_blending_mode, SIGNAL( stateChanged(int) ), this, SLOT( SetBlendingMode() ) );
  connect(g_alpha, SIGNAL( valueChanged(int) ), this, SLOT( ChangeImageAlpha(int) ) );
  connect(g_viewall, SIGNAL( toggled(bool) ), this, SLOT( ViewOptions() ) );
  connect(g_viewcolumn, SIGNAL( toggled(bool) ), this, SLOT( ViewOptions() ) );
  // connect(g_nbcolumn, SIGNAL( returnPressed() ), this, SLOT( ViewOptions() ) );
  connect(g_nbcolumn, SIGNAL( valueChanged(int) ), this, SLOT( ChangeColumn() ));
  connect(g_overlaymin, SIGNAL( returnPressed() ), this, SLOT( ChangeOverlayMinMax() ) );
  connect(g_overlaymax, SIGNAL( returnPressed() ), this, SLOT( ChangeOverlayMinMax() ) );

  m_direction = 0;
  m_numberofimages = 0;
  m_maxsize[0] = 0;
  m_maxsize[1] = 0;
  m_maxsize[2] = 0;
  m_imagemin = 999999;
  m_imagemax = 0;
  m_keyalt = false;
  m_keyctrl = false;   // multiselection
  m_overlaymin = 0;
  m_overlaymax = 0;
  m_imagemanager.ChangeAlpha(100);

  g_slice_slider->setEnabled(false);
  g_overlay_alpha_slider->setEnabled(false);

  g_intensity_min_slider->setMinimum(0);
  g_intensity_max_slider->setMinimum(0);
  g_intensity_min_slider->setMaximum(static_cast<int>(MAX_PERCENTAGE) );
  g_intensity_max_slider->setMaximum(static_cast<int>(MAX_PERCENTAGE) );
  g_intensity_min_slider->setValue(0);
  g_intensity_max_slider->setValue(static_cast<int>(MAX_PERCENTAGE) );

  m_frame = new MriWatcherFrame(g_scrollArea);

  connect(m_frame, SIGNAL( UnSelectAll() ), this, SLOT( UnSelectAll() ) );
  connect(m_frame, SIGNAL( GetFiles(const QString &) ), this, SLOT( LoadFile(const QString &) ) );
  //   m_imageframelayout = new ImageFrameLayout();
  //   QBoxLayout* gm = new QVBoxLayout(m_frame);
  m_imageframelayout = new ImageFrameLayout();
//    g_scrollArea->setLayout(m_imageframelayout);
  g_scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
  g_scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  // g_scrollArea->verticalScrollBar()->setRange();
  g_scrollArea->setWidget(m_frame);
  m_frame->setLayout(m_imageframelayout);

  g_name_version->setText(QString("MriWatcher") + "  " + MriWatcher_VERSION);
  g_tips->setText(
    "\nQuick Tips:\n- Left mouse drag: Move image\n- Right mouse drag: Zoom in/out\n- Middle mouse: Pick one voxel\n- Control + mouse: Pick images\n- Shift + mouse: Global operatation\n- Left or right key: Switch order\n- Delete key: Remove image");
/*
     imageLabel = new QLabel;
     imageLabel->setBackgroundRole(QPalette::Base);
     imageLabel->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);
     imageLabel->setScaledContents(true);

     g_scrollArea->setBackgroundRole(QPalette::Dark);
     g_scrollArea->setWidget(imageLabel);
     */
}
Exemplo n.º 19
0
/////////////////////////////////////////////////////////////////////////////
//
// PURPOSE: This function places selected attributes in an already
// existing partition without the attributes text literals.
//
// vNewDialog - handle to the partition
// lFieldRow - offset row in the group
// lFieldCol - offset column in the group
// PartitionSize - length size for the group
//
// Return Codes:
//     0 - Everything is O.K. and the fields were placed into the
//         partition
//    -1 - The field widths exceeded the partitions width
//
/////////////////////////////////////////////////////////////////////////////
zOPER_EXPORT zSHORT OPERATION
ofnTZWDLGSO_AutoPaintListPart( zVIEW    vSubtask,
                               zVIEW    vUserSpec,
                               zVIEW    vNewDialog,
                               zLONG    lFieldRow,
                               zLONG    lFieldCol,
                               zLONG    PartitionSize,
                               zPCHAR   szListType )
{
   zVIEW    vAutoDesWk;
   zVIEW    vTempStyle;
   zVIEW    vSubobject;
   zVIEW    vCtrlDef;
   zLONG    lListAttributeLength;
   zLONG    lPaintLiteralLength;
   zLONG    lCC;
   zLONG    lCL;
   zCHAR    szControlType[ 33 ];
   zCHAR    szMapEntity[ 33 ];
   zCHAR    szParentName[ 33 ];
   zCHAR    szWorkString[ 65 ];
   zCHAR    szLiteralString[ 65 ];
   zLONG    lTempInteger_0;
   zSHORT   RESULT;
   zSHORT   lFieldsPainted;
   zLONG    lRC;
   zCHAR    X_LOD_Attribute[ 16 ];
   zCHAR    X_LOD_Entity[ 13 ];
   zCHAR    X_ER_Attribute[ 15 ];

// TraceLineS( "IN", "AutoPaintListPart W4" );

   // Set up variables to either I_LOD listbox or L_LOD listbox.
   if ( szListType[ 0 ] == 'I' )
   {
      zstrcpy( X_LOD_Attribute, "I_LOD_Attribute" );
      zstrcpy( X_LOD_Entity, "I_LOD_Entity" );
      zstrcpy( X_ER_Attribute, "I_ER_Attribute" );
   }
   else
   {
      zstrcpy( X_LOD_Attribute, "L_LOD_Attribute" );
      zstrcpy( X_LOD_Entity, "L_LOD_Entity" );
      zstrcpy( X_ER_Attribute, "L_ER_Attribute" );
   }

   lCL = 12;
   lCC = 5;

   GetViewByName( &vCtrlDef, "TZADCTLD", vNewDialog, zLEVEL_TASK );
   GetViewByName( &vAutoDesWk, "TZADWWKO", vNewDialog, zLEVEL_TASK );
   GetStringFromAttribute( szControlType, vNewDialog, "ControlDef", "Tag" );

   /* It is important to know whether the parent is a WINDOW(WDODs)
      or a SECTION(RODs). */
   zstrcpy( szParentName, "Window" );

   /* IF we are Autodesigning a ROD, set lCL to 8 so line
      skips do not take place */
   lTempInteger_0  = zstrcmp( szParentName, "SECTION" );
   if ( lTempInteger_0 == 0 )
   {
      lCL = 8;
   }

   /* Create a view that will point to the controls under the listbox. */
   CreateViewFromViewForTask( &vSubobject, vNewDialog, 0 );

   /* Set handle to the fields under the group */
   SetViewToSubobject( vSubobject, "CtrlCtrl" );

   /* Delete any existing fields in the listbox */
   RESULT = SetCursorFirstEntity( vSubobject, "Control", "" );
   while ( RESULT > zCURSOR_UNCHANGED )
   {
      RESULT = DeleteEntity( vSubobject, "Control", zREPOS_NEXT );
   }

   /* Create a new view that will point to the UIS_ViewObjRef entity
      in the user spec object.  Sometimes vUserSpec is pointing to a
      recursive subobject and UI_ViewObjRef cannot be accessed. */
   CreateViewFromViewForTask( &vTempStyle, vUserSpec, 0 );
   ResetView( vTempStyle );

   lFieldsPainted = 0;

   //// Paint the fields in the Partition //////////
   /* IF Attributes have been found to paint, paint them */
   RESULT = SetCursorFirstEntity( vUserSpec, X_LOD_Attribute, "" );
   while ( RESULT > zCURSOR_UNCHANGED )
   {
      // This gets the length of the field to be painted.
      lListAttributeLength = ofnTZWDLGSO_GetSizeForListAttr( vSubtask,
                                                             vUserSpec,
                                                             szListType );

      if ( lListAttributeLength == 0 )
         lListAttributeLength = 4;
      lListAttributeLength = lListAttributeLength * lCC;
      if ( lListAttributeLength > 100 )
         lListAttributeLength = 100;
      if ( lListAttributeLength < 25 )
         lListAttributeLength = 25;

      /* If there isn't a paint literal then use the entity name
         as the paint literal */
      GetStringFromAttribute( szLiteralString, vUserSpec,
                               X_ER_Attribute, "ListPaintLit" );
      if ( szLiteralString[ 0 ] == 0 )
         GetStringFromAttribute( szLiteralString, vUserSpec,
                                 X_ER_Attribute, "PromptPaintLit" );
      lPaintLiteralLength = zstrlen( szLiteralString );
      if ( szLiteralString[ 0 ] == 0 )
      {
         GetStringFromAttribute( szLiteralString, vUserSpec,
                                 X_ER_Attribute, "Name" );
         AddSpacesToString( szLiteralString );
         lPaintLiteralLength = zstrlen( szLiteralString ) + 1;
      }

      lPaintLiteralLength = lPaintLiteralLength * lCC;
      if ( lPaintLiteralLength > 100 )
         lPaintLiteralLength = 100;
      if ( lPaintLiteralLength < 25 )
         lPaintLiteralLength = 25;

      /* Do not continue to add fields into the partition if
         the field sizes exceed the size of the partition */
      /* If the field attribute length is greater than the text
         literal length, then add the field attribute length
         to lFieldCol. */
      if ( lPaintLiteralLength < lListAttributeLength )
      {
         /* If the length of lFieldCol is greater than the
            partition size, then delete all the fields that have
            been added and give a message to the user. */
         if ( lFieldCol + lListAttributeLength > PartitionSize )
         {
            RESULT = SetCursorFirstEntity( vSubobject, "Control", "" );
            while ( RESULT > zCURSOR_UNCHANGED )
            {
               DeleteEntity( vSubobject, "Control", zREPOS_NEXT );
               RESULT = SetCursorNextEntity( vSubobject, "Control", "" );
            }
            DropView( vSubobject );
            MessageSend( vUserSpec, "AD10302", "Autodesigner",
                         "Partition too small( width )",
                         zMSGQ_OBJECT_CONSTRAINT_ERROR, zBEEP );
            return( -1 );
         }
      }
      else
      {
      /* If the text literal length is greater than the field
         attribute length, then add the text literal length
         to lFieldCol. */

         /* If the length of lFieldCol is greater than the
            partition size, then delete all the fields that have
            been added and give a message to the user. */
         if ( lFieldCol + lPaintLiteralLength > PartitionSize )
         {
            RESULT = SetCursorFirstEntity( vSubobject, "Control", "" );
            while ( RESULT > zCURSOR_UNCHANGED )
            {
               DeleteEntity( vSubobject, "Control", zREPOS_NEXT );
               RESULT = SetCursorNextEntity( vSubobject, "Control", "" );
            }
            DropView( vSubobject );
            MessageSend( vUserSpec, "AD10303", "Autodesigner",
                         "Partition too small( width )",
                         zMSGQ_OBJECT_CONSTRAINT_ERROR, zBEEP );
            return( -1 );
         }
      }

      /* Create the partition's fields */
      CreateMetaEntity( vSubtask, vSubobject, "Control", zPOS_AFTER );
      SetAttributeFromString( vSubobject, "Control", "Text", szLiteralString );
      if ( zstrcmp( szControlType, "ListBox" ) == 0 )
      {
         SetCursorFirstEntityByString( vCtrlDef, "ControlDef",
                                       "Tag", "ListBoxCtl", "" );
         IncludeSubobjectFromSubobject( vSubobject, "ControlDef",
                                        vCtrlDef, "ControlDef", zPOS_AFTER );
      }
      else
      {
         SetCursorFirstEntityByString( vCtrlDef, "ControlDef",
                                       "Tag", "Text", "" );
         IncludeSubobjectFromSubobject( vSubobject, "ControlDef",
                                        vCtrlDef, "ControlDef", zPOS_AFTER );
      }
      // Set the tag
      ofnTZWDLGSO_AssignTag( vSubtask, vNewDialog, vSubobject, "ListCtrl" );
/*    GetStringFromAttribute( szTag, vUserSpec, X_ER_Attribute, "Name" );
      szTag[ 30 ] = 0;

      lFieldsPainted = lFieldsPainted + 1;
      zltoa( lFieldsPainted, szWork );
      zstrcat( szTag, szWork );
      SetAttributeFromString( vSubobject, "Control", "Tag", szTag );
*/
      SetAttributeFromInteger( vSubobject, "Control", "SZDLG_X",
                               lListAttributeLength );
      SetAttributeFromInteger( vSubobject, "Control", "SZDLG_Y",  lCL );

      /* If the domain is an integer or a long, then right justify. */
      /*
      IF vUserSpec.L_Domain.DerivedDataType = 'I' OR
         vUserSpec.L_Domain.DerivedDataType = 'L' OR
         vUserSpec.L_Domain.DerivedDataType = 'M'
         vNewDialog.FLAGFLD.RJUST = 'Y'
      END
      */

      GetStringFromAttribute( szMapEntity, vUserSpec, "LOD_Entity", "Name" );
      GetStringFromAttribute( szWorkString, vUserSpec, X_LOD_Entity, "Name" );
      /* If this LISTATTRIB is from a different ENTITY than the
         current ENTITY, then make sure the value gets mapped. */
      lRC = zstrcmp( szWorkString, "" );
      if ( lRC != 0 )
      {
         lRC = zstrcmp( szWorkString, szMapEntity );
         if ( lRC == 0 )
         {
            zstrcpy( szMapEntity, szWorkString );
         }
      }

      /* setting the group and field's ENAME and ANAME */
      CreateMetaEntity( vSubtask, vSubobject, "CtrlMap", zPOS_AFTER );

      /* set the partitions OI name */
      if ( szListType[ 0 ] == 'I' )
         IncludeSubobjectFromSubobject( vSubobject, "CtrlMapView",
                                        vUserSpec, "ListViewObjRef", zPOS_AFTER );
      else
         IncludeSubobjectFromSubobject( vSubobject, "CtrlMapView",
                                        vTempStyle, "UIS_ViewObjRef", zPOS_AFTER );

      IncludeSubobjectFromSubobject( vSubobject, "CtrlMapLOD_Attribute",
                                     vUserSpec, X_LOD_Attribute, zPOS_AFTER );

      /* lFieldRow should always stay the same */
      SetAttributeFromInteger( vSubobject, "Control", "PSDLG_X", lFieldCol );
      SetAttributeFromInteger( vSubobject, "Control", "PSDLG_Y", lFieldRow );

      /* If the field length is longer than the paint literal,
         then position the next field by using the field length,
         otherwise position the next field by using the paint
         literal length */
      if ( lPaintLiteralLength < lListAttributeLength )
      {
         lFieldCol = lFieldCol + lListAttributeLength + lCC;
      }
      else
      {
         lFieldCol = lFieldCol + lPaintLiteralLength + lCC;
      }
      RESULT = SetCursorNextEntity( vUserSpec, X_LOD_Attribute, "" );
   }

   DropView( vSubobject );
   DropView( vTempStyle );
// TraceLineS("END", "AutoPaintListPart W4" );
   return( 0 );
}
Exemplo n.º 20
0
Camera::Camera()
{	
	ResetView();
}
Exemplo n.º 21
0
void Camera::Event_ViewPointVisibilityChanged()
{
    if (!m_owner.HaveAtClient(GetBody()))
        ResetView();
}
Exemplo n.º 22
0
//---------------------------------------------------------------------------
void CFabAtHomeView::OnViewResetview()
//---------------------------------------------------------------------------
{
	ResetView();
	Invalidate();
}
Exemplo n.º 23
0
MolconvWindow::MolconvWindow(QMainWindow *parent)
    : QMainWindow(parent)
    , d(new MolconvWindowPrivate)
    , ui(new Ui::MolconvWindow)
{
    ui->setupUi(this);

    d->m_ImportDialog = new ImportDialog(this);
    d->m_ExportDialog = new ExportDialog(this);
    d->m_NewGroupDialog = new NewGroupDialog(this);
    d->m_setBasisDialog = new setBasisDialog(this);
    d->m_ListOfMolecules = new ListOfMolecules(this);
    d->m_MoleculeSettings = new MoleculeSettings(this);

    addDockWidget(Qt::BottomDockWidgetArea, d->m_ListOfMolecules);
    addDockWidget(Qt::LeftDockWidgetArea, d->m_MoleculeSettings);

    ui->actionSet_internal_basis->setEnabled(false);
    ui->actionDuplicate->setEnabled(false);
    ui->actionRemove->setEnabled(false);
    ui->actionZero_Coordinates->setEnabled(false);
    ui->actionReset_Coordinates->setEnabled(false);
    ui->actionProperties->setEnabled(false);
    ui->actionAdd_To_Group->setEnabled(false);
    ui->actionAlign->setEnabled(false);

    connect(qApp, SIGNAL(aboutToQuit()), SLOT(quit()));

    connect(ui->actionImport_Molecule, SIGNAL(triggered()), SLOT(startImportDialog()));
    connect(ui->actionExport_Molecule, SIGNAL(triggered()), SLOT(startExportDialog()));
    connect(ui->actionQuit, SIGNAL(triggered()), SLOT(quit()));
    connect(ui->actionAbout, SIGNAL(triggered()), SLOT(about()));
    connect(ui->actionNew_Molecule_Group, SIGNAL(triggered()), SLOT(startNewGroupDialog()));
    connect(ui->actionSet_internal_basis, SIGNAL(triggered()), SLOT(startBasisDialog()));
    connect(ui->actionDuplicate, SIGNAL(triggered()), SLOT(DuplicateActiveMolecule()));
    connect(ui->actionRemove, SIGNAL(triggered()), SLOT(removeActiveMolecule()));
    connect(ui->actionReset, SIGNAL(triggered()), SLOT(ResetView()));
    connect(ui->actionZero_Coordinates, SIGNAL(triggered()), SLOT(zeroCoords()));
    connect(ui->actionReset_Coordinates, SIGNAL(triggered()), SLOT(resetCoords()));
    connect(ui->actionAlign, SIGNAL(triggered()), d->m_ListOfMolecules, SLOT(alignMolecules()));
    connect(ui->actionNavigate, SIGNAL(triggered()), SLOT(useNavigateTool()));
    connect(ui->actionSelect, SIGNAL(triggered()), SLOT(useSelectTool()));

    connect(d->m_ImportDialog, SIGNAL(accepted()), SLOT(openFile()));
    connect(d->m_NewGroupDialog, SIGNAL(accepted()), this, SLOT(newGroup()));
    connect(d->m_setBasisDialog, SIGNAL(ready()), SLOT(changeOriginBasis()));
    connect(d->m_ListOfMolecules, SIGNAL(newMoleculeSelected(molconv::moleculePtr&)), d->m_MoleculeSettings, SLOT(setMolecule(molconv::moleculePtr&)));
    connect(d->m_ListOfMolecules, SIGNAL(newMoleculeSelected(molconv::moleculePtr&)), SLOT(updateActiveMolecule(molconv::moleculePtr&)));
    connect(d->m_ListOfMolecules, SIGNAL(newGroupSelected(molconv::MoleculeGroup*)), d->m_MoleculeSettings, SLOT(setGroup(molconv::MoleculeGroup*)));
    connect(d->m_MoleculeSettings, SIGNAL(basisChanged()), SLOT(updateAxes()));
    connect(d->m_MoleculeSettings, SIGNAL(basisChanged()), SLOT(updateSelection()));

    GraphicsAxisItem *axes = new GraphicsAxisItem;
    ui->molconv_graphicsview->addItem(axes);

    d->m_Selection = new GraphicsSelectionItem;
    ui->molconv_graphicsview->addItem(d->m_Selection);

    d->m_navigatetool = boost::make_shared<NavigateTool>();
    d->m_selecttool = boost::make_shared<SelectTool>(this);
    useNavigateTool();

    ui->molconv_graphicsview->update();
}
Exemplo n.º 24
0
bool CTerDocView::RealLoadDocument(bool bReset, bool bDisplayErrorDoc, const CStdString& sDocID, const CStdString& sDocName, bool bReloading /*= false*/)
{
	LOG_WS_FUNCTION_SCOPE_MSG(_T("Ter - RealLoadDocument Time"));
	bool bOK = true;
	m_bReset = bReset;

	CChildFrame* const pFrame = GetChildFrame();
	if (GetDocObject() == NULL || GetDocObject() == NULL)
		return false;	

	try
	{
		if (bReset || sDocName.IsEmpty()) 		
		{
			bOK = (GetDocObject()->Close(FALSE) != 0);

			if (bDisplayErrorDoc)
 				GetDocObject()->Open(_bstr_t(GetApp()->m_csProgramPath + _T("\\loadfail.rtf")), _T(""));/* TXTEX_IGNORE */
			
			SetIsLoaded(false);
		}
		else
		{
			if (!GetDVController(pFrame)->IsShowingProgress())
			{
				ShowProgress();
			}

			{
				bOK = (GetDocObject()->Open(_bstr_t(sDocName), _bstr_t(sDocID)) != 0); 
			}
			if (!bOK)
				ResetView();

			SetIsLoaded(bOK);
		}
	}
	catch (...)
	{   //if we are trying to reload the redline we don't want to screw up the view if the reload
		//fails, because the chances are the problem is just due to them not closing the rtf of the redline
		//in word - if this handling isn't tight enough we will have add some work to the wster interface
		if(bReloading)
			return false;
		_ASSERTE(!_T("Catch ... How did we get here?"));
		try
		{
			GetDocObject()->Close(VARIANT_FALSE);
		}
		catch (...)
		{
			_ASSERTE(!_T("Catch ... How did we get here?"));
		}

		ResetView();
		return false;
	}

	if (bOK)
	{
		PerformPostLoadActions();

		CChildFrame* const pFrame = GetChildFrame();
		pFrame->SetDocumentsZoomPerentage(Workshare::OptionApi::GetInt(L"DocumentViewZoom"));
	}

	return bOK;
}
Exemplo n.º 25
0
void Camera::Event_ViewPointVisibilityChanged()
{
    if (!m_owner.HaveAtClient(m_source))
        ResetView();
}
Exemplo n.º 26
0
void __fastcall TTestBedForm::FormShow(TObject *Sender)
{
  ResetView();
  DrawLayoutChanged(0);
  TestChanged();
}