Exemplo n.º 1
0
zOPER_EXPORT zSHORT OPERATION
oTZERSASO_RefreshOneSA_Entity( zVIEW    vSubjectArea,
                               zVIEW    vEntpModel )
{
   zVIEW    vEntpModel_Wrk;
   zLONG    lEntityZKey;
   zSHORT   nRC;

   CreateViewFromViewForTask( &vEntpModel_Wrk, vEntpModel, 0 );
   GetIntegerFromAttribute( &lEntityZKey, vSubjectArea,
                            "ER_Entity", "ZKey" );
   nRC = SetCursorFirstEntityByInteger( vEntpModel_Wrk, "ER_Entity",
                                        "ZKey", lEntityZKey, "" );
   if ( nRC > zCURSOR_UNCHANGED )
   {
      ExcludeEntity( vSubjectArea, "ER_Entity" );
//    SetCursorPrevEntity( vSubjectArea, "SA_Entity", "" );
      IncludeSubobjectFromSubobject( vSubjectArea, "ER_Entity",
                                     vEntpModel_Wrk, "ER_Entity", zPOS_AFTER );
      nRC = 0;
   }
   else
   {
      DeleteEntity( vSubjectArea, "SA_Entity" );
      nRC = 1;
   }

   DropView( vEntpModel_Wrk );
   return( nRC );
}
Exemplo n.º 2
0
//:TRANSFORMATION OPERATION
zOPER_EXPORT zSHORT OPERATION
oKZXMLPGO_InitWebPage( zVIEW     vKZXMLPGO,
                       zPCHAR    DialogName,
                       zPCHAR    WindowName )
{
   zSHORT    RESULT; 

   //:InitWebPage( VIEW vKZXMLPGO BASED ON LOD KZXMLPGO,
   //:          STRING ( 32 ) DialogName,
   //:          STRING ( 32 ) WindowName )

   //:// Delete any existing Page entry and initialize a new one.
   //:SET CURSOR FIRST vKZXMLPGO.Page
   RESULT = SetCursorFirstEntity( vKZXMLPGO, "Page", "" );
   //:IF RESULT >= zCURSOR_SET
   if ( RESULT >= zCURSOR_SET )
   { 
      //:DELETE ENTITY vKZXMLPGO.Page NONE
      RESULT = DeleteEntity( vKZXMLPGO, "Page", zREPOS_NONE );
   } 

   //:END
   //:CREATE ENTITY vKZXMLPGO.Page
   RESULT = CreateEntity( vKZXMLPGO, "Page", zPOS_AFTER );
   //:vKZXMLPGO.Page.DialogName = DialogName
   SetAttributeFromString( vKZXMLPGO, "Page", "DialogName", DialogName );
   //:vKZXMLPGO.Page.WindowName = WindowName
   SetAttributeFromString( vKZXMLPGO, "Page", "WindowName", WindowName );
   return( 0 );
// END
} 
Exemplo n.º 3
0
zOPER_EXPORT zSHORT OPERATION
OpIns_RebuildOperList( zVIEW vSubtask )
{
   zCHAR  szCurrentType[ 5 ];
   zVIEW  vProfileXFER;
   zVIEW  vEdWrk;

   GetWorkView( &vEdWrk );
   GetProfileView( &vProfileXFER );
   GetStringFromAttribute( szCurrentType, vProfileXFER, "ED",
                           "OpIns_CurrentType" );

   // Default of CurrentType is 'Z'...
   if ( *szCurrentType == 0 )
   {
      zstrcpy( szCurrentType, "Z" );
      SetAttributeFromString( vProfileXFER, "ED", "OpIns_CurrentType",
                              szCurrentType );
   }

   // Check to see if the operations for the current type are already
   // loaded. If they are, then delete the list.
   if ( SetCursorFirstEntityByString( vEdWrk, "OperListType", "Type",
                                      szCurrentType, 0 ) == zCURSOR_SET )
   {
      DeleteEntity( vEdWrk, "OperListType", zREPOS_FIRST );
   } // if ( SetCursor...)...

   // Now call BuildOperList to rebuild the oper list.
   OpIns_BuildOperList( vSubtask );

   return( 0 );

} // OpIns_RebuildOperList
Exemplo n.º 4
0
void ETHBucketManager::ResolveMoveRequests()
{
    for (std::list<ETHBucketMoveRequest>::iterator iter = m_moveRequests.begin();
            iter != m_moveRequests.end(); ++iter)
    {
        // if it's dead, no use in moving it. Let's just discard
        if (!iter->IsAlive())
        {
            DeleteEntity(iter->GetID());
            continue;
        }
        MoveEntity(iter->GetID(), iter->GetOldBucket(), iter->GetNewBucket());
    }
    m_moveRequests.clear();
}
ff::EntityDomain::~EntityDomain()
{
	for (EntityEntry &entityEntry: _entities)
	{
		if (entityEntry._valid)
		{
			DeleteEntity(entityEntry.ToEntity());
		}
	}

	for (SystemEntry &systemEntry: _systems)
	{
		ClearSystem(systemEntry);
	}

	FlushDeletedEntities();
	FlushDeletedSystems();
}
Exemplo n.º 6
0
//
// OPERATION: CreateIntegerExpression
//
// DESCRIPTION: CreateIntegerExpression
//
zOPER_EXPORT zLONG OPERATION
CreateIntegerExpression( zVIEW  vSubtask,
                         zLONG  lTargetID,
                         zLONG  lOperatorType,
                         zLONG  lEntry1Class,
                         zLONG  lEntry1Value,
                         zLONG  lOper1Value,
                         zLONG  lEntry2Class,
                         zPCHAR pchEntry2Value )
{
   zVIEW vTargetView;

   CreateEntity( g_lpExprView, "Expression", zPOS_AFTER );
   CreateViewFromViewForTask( &vTargetView, g_lpExprView, 0 );
   //SetViewToSubobject( vTargetView, "Expression" );

   // Insert new bottom of stack.
   AddOperatorToView( vSubtask, vTargetView, -2 );

   AddExprNodeEntityToView( vSubtask, vTargetView, qVARIABLE, qNUMERIC,
                            qTINTEGER, "", lTargetID, 0 );
   AddExprNodeEntityToView( vSubtask, vTargetView, qOPERATOR, qNUMERIC,
                            qTINTEGER, "", lOperatorType, 0 );
   AddExprNodeEntityToView( vSubtask, vTargetView, lEntry1Class, qNUMERIC,
                            qTINTEGER, "", lEntry1Value, 0 );
   AddExprNodeEntityToView( vSubtask, vTargetView, qOPERATOR, qNUMERIC,
                            qTINTEGER, "", lOper1Value, 0 );
   AddExprNodeEntityToView( vSubtask, vTargetView, lEntry2Class, qNUMERIC,
                            qTINTEGER, pchEntry2Value, 0, 0 );

   // Dump the expression from the stack.
   AddOperatorToView( vSubtask, vTargetView, -1 );

   AddStatementEntityToPI( vSubtask, qEXPRESSION, qqlineno, vTargetView, zPOS_AFTER );

   DeleteEntity( vTargetView, "Expression", zREPOS_NONE );
   DropView( vTargetView );

   return( 0 );
}
Exemplo n.º 7
0
//
// OPERATION: AddResultCondEqual
//
//    e.g. if ( RESULT > zCURSOR_UNCHANGED )
//
zOPER_EXPORT zLONG OPERATION
AddResultCondEqual( zVIEW  vSubtask,
                    zLONG  lStatementType,
                    zPCHAR pchCompareValue )
{
   zLONG lResultID;
   zLONG lDefineZKey;
   zLONG lVarDataType;
   zVIEW vTargetView;

   CreateEntity( g_lpExprView, "Expression", zPOS_AFTER );
   CreateViewFromViewForTask( &vTargetView, g_lpExprView, 0 );

   // Insert new bottom of stack.
   AddOperatorToView( vSubtask, vTargetView, -2 );

   lResultID = AddResult( vSubtask );

   AddExprNodeEntityToView( vSubtask, vTargetView, qOPERATOR, 0,
                            qTINTEGER, "(", qLPAREN, 0 );
   AddExprNodeEntityToView( vSubtask, vTargetView, qVARIABLE, qNUMERIC,
                            qTSHORT, "", lResultID, 0 );
   AddExprNodeEntityToView( vSubtask, vTargetView, qOPERATOR, qNUMERIC,
                            qTINTEGER, ">", qGREATERTHAN, 0 );
   lDefineZKey = GetDefineZKey( vSubtask, &lVarDataType, pchCompareValue );
   AddExprNodeEntityToView( vSubtask, vTargetView, qDEFINE, qZEIDONOPERATION,
                            qTINTEGER, pchCompareValue, lDefineZKey, 0 );
   AddExprNodeEntityToView( vSubtask, vTargetView, qOPERATOR, 0,
                            qTINTEGER, ")", qRPAREN, 0 );

   // Dump the expression from the stack.
   AddOperatorToView( vSubtask, vTargetView, -1 );

   AddStatementEntityToPI( vSubtask, lStatementType, qqlineno, vTargetView, zPOS_AFTER );

   DeleteEntity( vTargetView, "Expression", zREPOS_NONE );
   DropView( vTargetView );

   return( 0 );
}
Exemplo n.º 8
0
zOPER_EXPORT zSHORT OPERATION
VML_CreateText_DeleteAll( zVIEW vSubtask )
{
   zVIEW  vProfileXFER;
   zSHORT nRC;

   if ( MessagePrompt( vSubtask, "ED0101", "Zeidon Editor",
                       "Delete All VML Keywords?", 0, zBUTTONS_YESNO,
                       zRESPONSE_NO, zICON_QUESTION ) == zRESPONSE_NO )
   {
      return( 0 );
   }

   GetProfileView( &vProfileXFER );
   for ( nRC = SetCursorFirstEntity( vProfileXFER, "VML_Text", 0 );
         nRC == zCURSOR_SET;
         nRC = SetCursorNextEntity( vProfileXFER, "VML_Text", 0 ) )
   {
      DeleteEntity( vProfileXFER, "VML_Text", zREPOS_NONE );
   }

   return( 0 );
} // VML_CreateText_DeleteAll
Exemplo n.º 9
0
zOPER_EXPORT zSHORT OPERATION
AEQ_ClearViews( zVIEW vSubtask )
{
   zVIEW  vEdWrk;
   zSHORT nRC;

   GetWorkView( &vEdWrk );
   if ( vEdWrk == 0 )
   {
      zCHAR sz[ 200 ];

      zstrcpy( sz, "TZEDWRKO not Available at AEQ_ClearViews." );
      OperatorPrompt( 0, "ED - Error", sz, 0, zBUTTONS_OK, 0, zICON_STOP );
      return( zCALL_ERROR );
   }

   nRC = SetCursorFirstEntity( vEdWrk, "View", "" );
   while ( nRC == zCURSOR_SET )
      nRC = DeleteEntity( vEdWrk, "View", zREPOS_NEXT );

   AEQ_RefreshAEQ( vSubtask );

   return( 0 );
}
Exemplo n.º 10
0
/////////////////////////////////////////////////////////////////////////////
//
// OPERATION: oTZEREMDO_DeleteEntity
//
// PURPOSE:   Delete Relationship from ER Model
//
/////////////////////////////////////////////////////////////////////////////
zOPER_EXPORT zSHORT OPERATION
oTZEREMDO_DeleteEntity( zVIEW  vTZEREMDO,
                        zSHORT nReposition )
{
   zVIEW    vTZEREMD1;
   zVIEW    vTZERSASO;
   zVIEW    vSubtask;   // to refresh ER Diagram
   zSHORT   nRC;
   zLONG    lEntityZKey;
   LPLIBRARY hLibrary = 0;  // used for dynamic call to ER control func's
   zFARPROC_RemoveFunc lpfn = 0;

//  Position and determine if there are any relationships involving
//  this Entity prior to deleting the Entity.
   nRC = CreateViewFromViewForTask( &vTZEREMD1, vTZEREMDO, 0 );
   nRC = GetIntegerFromAttribute( &lEntityZKey, vTZEREMD1, "ER_Entity", "ZKey" );
   nRC = SetCursorFirstEntityByInteger( vTZEREMD1, "ER_Entity_2",
                                        "ZKey", lEntityZKey,
                                        "EntpER_Model" );

//  Delete the entity if it is involved in any relationships.
   if ( nRC >= zCURSOR_SET )
   {
      //  Loop and Delete all ER RelLinks
      for ( nRC = SetCursorFirstEntity( vTZEREMDO, "ER_RelLink", "" );
            nRC >= zCURSOR_SET;
            nRC = SetCursorNextEntity( vTZEREMDO, "ER_RelLink", "" ) )
      {
         oTZEREMDO_DeleteRelationship( vTZEREMDO, zREPOS_NONE, 1 );
      }
      //  Check to if all relationships were deleted.
      if ( SetCursorFirstEntityByInteger( vTZEREMD1, "ER_Entity_2",
                                          "ZKey", lEntityZKey,
                                          "EntpER_Model" ) >= zCURSOR_SET )
      {
         DropView( vTZEREMD1 );
         return( -1 );
      }
   }

// Delete ER Entity
   if ( GetViewByName( &vSubtask, "TZEREMDD", vTZEREMDO, zLEVEL_TASK ) > 0 )
   {
      lpfn = (zFARPROC_RemoveFunc)
             GetOperationDynamicCallAddress( vSubtask,
                                             (LPLPLIBRARY) &hLibrary,
                                             "TZCTL", "RemoveEntity",
                                             "(tzlooprs)" );
      if ( lpfn )
        (*lpfn)( vSubtask, "ERD", 0, 0 );
   }

   nRC = DeleteEntity( vTZEREMDO, "ER_Entity", nReposition );

   // It is possible that the ER_Entity we just deleted is part of an
   // opened Subject Area.  If so, we must be sure that Subject Area doesn't
   // have hanging SA_Entity entities.
   if ( GetViewByName( &vTZERSASO, "TZERSASO", vTZEREMDO, zLEVEL_TASK ) > 0 )
   {
      nRC = SetCursorFirstEntity( vTZERSASO, "SA_Entity", 0 );
      while ( nRC >= zCURSOR_SET )
      {
         if ( CheckExistenceOfEntity( vTZERSASO, "ER_Entity" ) < zCURSOR_SET )
         {
            if ( GetViewByName( &vSubtask, "SAVIEW", vTZEREMDO, zLEVEL_TASK ) > 0 )
            {
               if ( lpfn == 0 )   // only get func addr once
               {
                  lpfn = (zFARPROC_RemoveFunc)
                     GetOperationDynamicCallAddress( vSubtask,
                                                     (LPLPLIBRARY) &hLibrary,
                                                     "TZCTL", "RemoveEntity",
                                                     "(tzlooprs)" );
               }
               if ( lpfn )
               (*lpfn)( vSubtask, "ERD", 0, 0 );
            }

            DeleteEntity( vTZERSASO, "SA_Entity", zREPOS_NONE );
         }

         nRC = SetCursorNextEntity( vTZERSASO, "SA_Entity", 0 );
      }
   }

   DropView( vTZEREMD1 );
   return( 0 );
}
Exemplo n.º 11
0
//-----------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------
void CEntityList::DeleteEntity( CBaseEntity *pEnt )
{
	DeleteEntity( pEnt->GetIndex() );
}
Exemplo n.º 12
0
//-----------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------
void CEntityList::DeleteEntity( const char *pName )
{
	DeleteEntity( GetEntity(pName)->GetIndex() );
}
Exemplo n.º 13
0
/////////////////////////////////////////////////////////////////////////////
//
//   OPERATION:   EnqueueInstance
//
//   PARAMETERS:  zVIEW  vInstance - View to the instance to be enqueued
//                zPCHAR szEntityNames - A string containing 1 or
//                                  more entity names on which to enqueue
//                                  the instance. The first entity name
//                                  MUST BE the root of the object and
//                                  the remaining entity names MUST be
//                                  separated by the plus '+' character.
//
//   RETURN CODES:  0 - Enqueue successful
//                  1 - Enqueue unsuccessful, the instance is already
//                      Enqueued
//                 zCALL_ERROR - Enqueue unsuccessful, error in processing
//
/////////////////////////////////////////////////////////////////////////////
zSHORT OPERATION
EnqueueInstance( zVIEW vInstance, zPCHAR szEntityNames )
{
   zVIEW  vEnqueue;
   zVIEW  vEnqueueHolder;
   zVIEW  vQual;
   zVIEW  vWkInstance;
   zPCHAR szEntityNamePtr;
   zCHAR  szCurrentEntity[ 34 ];
   zCHAR  szLevel[ 2 ];
   zSHORT nEntity, nEnqueue, nIdx, nRC, nRetries;
   zLONG  lER_Token;
   zCHAR  szTimestamp[ 6 ];
   zCHAR  szObjectName[ 34 ];
   zCHAR  szUserID[ 34 ];
   zCHAR  szPassword[ 34 ];
   zCHAR  szKey[ 64 ];
   zCHAR  szMsg[ 256 ];

   // We put the enqueue logic in a for loop so we can restart the
   // enqueue if the enqueue fails and we cannot find the owner of
   // the enqueue.
   nRetries = 4;
   if ( MiGetObjectNameForView( szObjectName, vInstance ) < 0 )
      return( zCALL_ERROR );

   for ( ; ; )
   {
      // Set up work variables
      szEntityNamePtr = szEntityNames;
      _fstrcpy( szLevel, "R" );
      nEntity = nEnqueue = 0;

      // Set up a multiple root instance for enqueueing
      if ( ActivateEmptyObjectInstance( &vEnqueue, szlCGENQUEU,
                                        vInstance, zMULTIPLE ) != 0 )
      {
         return( zCALL_ERROR );
      }

      // Create a view on the instance so we do not step on the applications
      // cursor positions.
      CreateViewFromViewForTask( &vWkInstance, vInstance, 0 );

      // Get timestamp and user information for enqueue
      MiGetDateTimeForOI( szTimestamp, vWkInstance );
      SysGetUserID( vInstance, szUserID, szPassword );
      if ( szUserID[ 0 ] == 0 )
         _fstrcpy( szUserID, "(null)" );

      // Loop for each entity type to be enqueued
      while ( szEntityNamePtr[ 0 ] )
      {
         // Gather the next entity name on which to enqueue
         nIdx = 0;
         while ( szEntityNamePtr[ 0 ] && szEntityNamePtr[ 0 ] != '+' )
         {
            szCurrentEntity[ nIdx++ ] = szEntityNamePtr[ 0 ];
            szEntityNamePtr++;
         }

         szCurrentEntity[ nIdx ] = 0;
         if ( szEntityNamePtr[ 0 ] == '+' )
            szEntityNamePtr++;

         nEntity++;

         // Now that an entity name has been gathered, troll the instance
         // for every occurrence of that entity type and create an
         // enqueue instance for it
         nRC = SetCursorFirstEntity( vWkInstance, szCurrentEntity,
                                     zSCOPE_OI );
         if ( nRC == zCALL_ERROR )
         {
            DropView( vWkInstance );
            DropObjectInstance( vEnqueue );
            return( zCALL_ERROR );
         }

         if ( nRC >= zCURSOR_SET )
         {
            lER_Token = MiGetERTokenForEntity( vWkInstance, szCurrentEntity );
            do
            {
               // Set up an enqueue instance, The ER_Token and the Instance
               // key are the unique keys to the object, a duplicate instance
               // on the database will result in an enqueue failure with the
               // instance in use. The UserID combined with the Timestamp is
               // the non-unique key for deletion of a logical enqueue.

               // The object name and level ( 'R' - root, 'C' - child ) are
               // informational only.

               CreateEntity( vEnqueue, szlEnqueue, zPOS_AFTER );
               SetAttributeFromInteger( vEnqueue,
                           szlEnqueue, szlER_Token, lER_Token );
               MiGetKeyFromInstance( szKey, 61, vWkInstance, szCurrentEntity );
               SetAttributeFromString( vEnqueue, szlEnqueue, szlInstanceKey,
                                       szKey );
               SetAttributeFromVariable( vEnqueue, szlEnqueue, szlTimestamp,
                                       szTimestamp, zTYPE_DATETIME,
                                       6, 0, 0 );
               SetAttributeFromString( vEnqueue, szlEnqueue, szlType,
                                       "U" );
               SetAttributeFromString( vEnqueue, szlEnqueue, szlUser,
                                       szUserID );
               SetAttributeFromString( vEnqueue, szlEnqueue, szlObject,
                                       szObjectName );
               SetAttributeFromString( vEnqueue, szlEnqueue, szlLevel,
                                       szLevel );
               nEnqueue++;
            }  while ( SetCursorNextEntity( vWkInstance, szCurrentEntity,
                                            zSCOPE_OI ) >= zCURSOR_SET );
         }

         // After processing an entity type, all other enqueues are at the
         // child level
         szLevel[ 0 ] = 'C';
      }

      // Now that we're done gathering the enqueue information, we can drop
      // the view to the instance
      DropView( vWkInstance );

      // The enqueue instance has been built, now it is time to insert it
      // into the database for locking the instance.
      nRC = CommitObjectInstance( vEnqueue );
      if ( nRC != zDUPLICATE_ROOT )
      {
         DropObjectInstance( vEnqueue );
         return( nRC );
      }

      // The enqueue failed, now we will determine the owner of the enqueue
      // to see if we are conflicting with ourself or to report the owner
      // to the enqueue requestor
      SetCursorFirstEntity( vEnqueue, szlEnqueue, 0 );
      do
      {
         fnBuildQualForEnqueue( vEnqueue, &vQual );
         nRC = ActivateObjectInstance( &vEnqueueHolder, szlCGENQUEU,
                                       vInstance, vQual, zSINGLE );
         DropObjectInstance( vQual );
         if ( nRC < -1 )
            return( zCALL_ERROR );
         else
         if ( nRC >= 0 )
            break;
         else
            DropObjectInstance( vEnqueueHolder );

      } while ( SetCursorNextEntity( vEnqueue, szlEnqueue, 0 ) >= zCURSOR_SET );

      // If the enqueue holder was not found, then the enqueue may have
      // disappeared while trying to find the holder, retry the enqueue
      // operation.
      nRetries--;
      if ( nRC == -1 )
      {
         if ( nRetries == 0 )
            return( zCALL_ERROR );
      }

      // Report on the enqueue holder
      GetStringFromAttribute( szKey, vEnqueueHolder, szlEnqueue, szlUser );
      GetStringFromAttribute( &szKey[ 30 ],
                              vEnqueueHolder, szlEnqueue, szlObject );

      // if the current enqueue holder is the current user for the
      // same object type, then offer to drop the previous enqueue and
      // re-establish the enqueue for the current user
      if ( _fstrcmp( szUserID, szKey ) == 0 &&
           _fstrcmp( szObjectName, &szKey[ 30 ] ) == 0 && nRetries )
      {
         // we will retry this once and once only
         nRetries = 1;
         _fstrcpy( szMsg, "The " );
         _fstrcat( szMsg, szObjectName );
         _fstrcat( szMsg, " is already enqueued by you in this session or"
                          " a previous session. Would you like to release"
                          " the previously held enqueue?" );
         nRC = MessagePrompt( vInstance, "1", szlEnqueue, szMsg, 0,
                              zBUTTONS_YESNO, zRESPONSE_YES,
                              zICON_QUESTION );
         if ( nRC == zRESPONSE_NO )
         {
            DropObjectInstance( vEnqueue );
            DropObjectInstance( vEnqueueHolder );
            return( 1 );
         }

         // The user wants to delete a previous enqueue for the same
         // object type, build the qualification for the delete and remove
         // the prior enqueue.
         fnBuildQualForEnqueueDelete( vEnqueueHolder, &vQual );
         DropObjectInstance( vEnqueueHolder );
         nRC = ActivateObjectInstance( &vEnqueueHolder, szlCGENQUEU,
                                       vInstance, vQual, zMULTIPLE );
         DropObjectInstance( vQual );
         if ( nRC < 0 )
            return( zCALL_ERROR );

         nRC = SetCursorFirstEntity( vEnqueueHolder, szlEnqueue, 0 );
         while ( nRC >= zCURSOR_SET )
            nRC = DeleteEntity( vEnqueueHolder, szlEnqueue, zREPOS_NEXT );

         nRC = CommitObjectInstance( vEnqueueHolder );
         DropObjectInstance( vEnqueueHolder );

         // If the attempt to reuse the enqueue failed on a database error,
         // return that error. Otherwise, return zero ==> the enqueue was
         // reused.
         if ( nRC < 0 )
            return( zCALL_ERROR );
         else
            return( 0 );
      }
      else
      {
         // Report on the owner of the enqueue
         _fstrcpy( szMsg, "The " );
         _fstrcat( szMsg, szObjectName );
         _fstrcat( szMsg, " is currently in use by " );
         _fstrcat( szMsg, szKey );
         if ( _fstrcmp( szObjectName, &szKey[ 30 ] ) != 0 )
         {
            _fstrcat( szMsg, " under the object " );
            _fstrcat( szMsg, &szKey[ 30 ] );
         }
         _fstrcat( szMsg, "." );
         MessagePrompt( vInstance, "1", szlEnqueue, szMsg, 0,
                        zBUTTONS_OK, zRESPONSE_OK, 0 );
         DropObjectInstance( vEnqueue );
         DropObjectInstance( vEnqueueHolder );
         return( 1 );
      }
   }  // End of for loop for enqueueing

   // If we reach here, then the enqueue was in use and failed.
   return( 1 );
}
Exemplo n.º 14
0
bool CNNM2ECC::DeleteEccEntity(word id)
{
	return DeleteEntity(id.getword());
}
Exemplo n.º 15
0
//
// OPERATION: AddGetOrSetAttribute
//
// DESCRIPTION: AddGetOrSetAttribute creates a call to an operation
//    with the result of the operation being put in nZRetCode
//
zOPER_EXPORT zLONG OPERATION
AddGetOrSetAttribute( zVIEW  vSubtask,
                      zPCHAR pchOperationName,
                      zLONG  lViewID,
                      zLONG  lUseVariable,
                      zLONG  lVariableDataType,
                      zLONG  lVariableID,
                      zPCHAR pchEntityName,
                      zLONG  lEntityID,
                      zPCHAR pchAttributeName,
                      zLONG  lAttributeID,
                      zLONG  lUseExtra,
                      zPCHAR pchExtra,
                      zLONG  lExtra,
                      zLONG  lExtraClass )
{
   zLONG sParmList[ PARM_LIST_SIZE ] = { 0 };
   zLONG sParmListExt[ PARM_LIST_SIZE ] = { 0 };
   zLONG lParmListIndex = 0;
   zLONG lRCID;
   zLONG lOperZKey;
   zVIEW vTargetView;

// memset( sParmListExt, 0, sizeof( sParmListExt ) );

   CreateEntity( g_lpExprView, "Expression", zPOS_AFTER );
   CreateViewFromViewForTask( &vTargetView, g_lpExprView, 0 );
   //SetViewToSubobject( vTargetView, "Expression" );

   // Insert new bottom of stack.
   AddOperatorToView( vSubtask, vTargetView, -2 );

   lRCID = AddRetCode( vSubtask );
   lOperZKey = GetOperationZKey( vSubtask, qZEIDONOPERATION, pchOperationName );

   // add result
   AddExprNodeEntityToView( vSubtask, vTargetView, qVARIABLE, qNUMERIC,
                            qTSHORT, "RCID", lRCID, 0 );

   // add EQUAL
   AddExprNodeEntityToView( vSubtask, vTargetView, qOPERATOR, qNUMERIC,
                            qTINTEGER, "=", qEQUAL, 0 );

   // add operation name
   AddExprNodeEntityToView( vSubtask, vTargetView, qOPERATIONCALL, qZEIDONOPERATION,
                            qTSHORT, pchOperationName, lOperZKey, 0 );

   GetOperationParmListPM( vSubtask, sParmList, sParmListExt, lOperZKey, qZEIDONOPERATION );
   lParmListIndex = 1;

   AddExprNodeEntityToView( vSubtask, vTargetView, qOPERATOR, qNUMERIC,
                            qTINTEGER, "(", qOPENOPER, 0 );

   if ( lUseVariable == 0 )
   {
      if ( sParmList[ lParmListIndex ] < 0 )
         lVariableID *= -1;

      AddExprNodeEntityToView( vSubtask, vTargetView, qVARIABLE, 0,
                               lVariableDataType, "", lVariableID, sParmListExt[ lParmListIndex ] );
      lParmListIndex++;
      AddExprNodeEntityToView( vSubtask, vTargetView, qOPERATOR, qNUMERIC,
                               qTINTEGER, ",", qCOMMA, 0 );
   }

   if ( sParmList[ lParmListIndex] < 0 )
      lViewID *= -1;

   AddExprNodeEntityToView( vSubtask, vTargetView, qVARIABLE, qNUMERIC,
                            qTVIEW, "", lViewID, sParmListExt[ lParmListIndex ] );
   lParmListIndex++;
   AddExprNodeEntityToView( vSubtask, vTargetView, qOPERATOR, qNUMERIC,
                            qTINTEGER, ",", qCOMMA, 0 );

   if ( lEntityID > 0 ) // is a var
   {
      if ( sParmList[ lParmListIndex ] < 0 )
         lEntityID *= -1;

      AddExprNodeEntityToView( vSubtask, vTargetView, qVARIABLE, qTEXT, qTENTITYNAME,
                               "", lEntityID, sParmListExt[ lParmListIndex ] );
      lParmListIndex++;
   }
   else  // is a string constant
   {
      lParmListIndex++;
      AddExprNodeEntityToView( vSubtask, vTargetView, qCONSTANT, qTEXT,
                               qTENTITYNAME, pchEntityName, lEntityID, 0 );
   }

   AddExprNodeEntityToView( vSubtask, vTargetView, qOPERATOR, qNUMERIC,
                            qTINTEGER, ",", qCOMMA, 0 );
   if ( lAttributeID > 0 ) // is a var
   {
      if ( sParmList[ lParmListIndex++ ] < 0 )
         lAttributeID *= -1;

      AddExprNodeEntityToView( vSubtask, vTargetView, qVARIABLE, qTEXT,
                               qTATTRIBUTENAME, "", lAttributeID, sParmListExt[ lParmListIndex ] );
      lParmListIndex++;
   }
   else  // is a string constant
   {
      lParmListIndex++;
      AddExprNodeEntityToView( vSubtask, vTargetView, qCONSTANT, qTEXT,
                               qTATTRIBUTENAME, pchAttributeName, lAttributeID, 0 );
   }

   if ( lUseVariable == 1 )
   {
      AddExprNodeEntityToView( vSubtask, vTargetView, qOPERATOR, qNUMERIC,
                               qTINTEGER, ",", qCOMMA, 0 );
      if ( sParmList[ lParmListIndex ] < 0 )
         lVariableID *= -1;

      AddExprNodeEntityToView( vSubtask, vTargetView, qVARIABLE, 0,
                               lVariableDataType, "", lVariableID, sParmListExt[ lParmListIndex ] );
      lParmListIndex++;
   }

   if ( lUseExtra > 0 ) // use the extra parameter
   {
      AddExprNodeEntityToView( vSubtask, vTargetView, qOPERATOR, qNUMERIC,
                               qTINTEGER, ",", qCOMMA, 0 );
      if ( lExtraClass == qDEFINE )
      {
         AddExprNodeEntityToView( vSubtask, vTargetView, qDEFINE, 0,
                                  lUseExtra, pchExtra, lExtra, 0 );
      }
      else
      {
         AddExprNodeEntityToView( vSubtask, vTargetView, qCONSTANT, 0,
                                  lUseExtra, pchExtra, lExtra, 0 );
      }
   }

   AddExprNodeEntityToView( vSubtask, vTargetView, qOPERATOR, qNUMERIC,
                            qTINTEGER, ")", qCLOSEOPER, 0 );

   // Dump the expression from the stack.
   AddOperatorToView( vSubtask, vTargetView, -1 );

   AddStatementEntityToPI( vSubtask, qEXPRESSION, qqlineno, vTargetView, zPOS_AFTER );

   DeleteEntity( vTargetView, "Expression", zREPOS_NONE );
   DropView( vTargetView );

   return( 0 );
}
Exemplo n.º 16
0
void WorldRenderer::OnEvent( Event* e )
{
	if ( WorldDeletedEvent* WDE = dynamic_cast<WorldDeletedEvent*>(e) )
	{
		zWorld->RemoveObserver(this);
		zWorld = 0;
	}
	else if ( WorldLoadedEvent* WLE = dynamic_cast<WorldLoadedEvent*>(e) )
	{
		zGraphics->SetSunLightProperties(
			WLE->world->GetSunDir(),
			WLE->world->GetSunColor(),
			WLE->world->GetSunIntensity() );
	}
	else if ( WaterQuadCreatedEvent* WQCE = dynamic_cast<WaterQuadCreatedEvent*>(e) )
	{
		zWaterQuads[WQCE->zQuad] = zGraphics->CreateWaterPlane(Vector3(0.0f, 0.0f, 0.0f), "Media/WaterTexture.png");
		WQCE->zQuad->AddObserver(this);
		UpdateWaterBoxes(WQCE->zQuad);
	}
	else if ( WaterQuadLoadedEvent* WQLE = dynamic_cast<WaterQuadLoadedEvent*>(e) )
	{
		zWaterQuads[WQLE->zQuad] = zGraphics->CreateWaterPlane(Vector3(0.0f, 0.0f, 0.0f), "Media/WaterTexture.png");
		WQLE->zQuad->AddObserver(this);

		for( unsigned int x=0; x<4; ++x )
		{
			zWaterQuads[WQLE->zQuad]->SetVertexPosition(WQLE->zQuad->GetPosition(x), x);
		}
		
		UpdateWaterBoxes(WQLE->zQuad);
	}
	else if ( WaterQuadEditedEvent* WQEE = dynamic_cast<WaterQuadEditedEvent*>(e) )
	{
		auto i = zWaterQuads.find(WQEE->zQuad);
		if ( i != zWaterQuads.end() )
		{
			for( unsigned int x=0; x<4; ++x )
			{
				i->second->SetVertexPosition(WQEE->zQuad->GetPosition(x), x);
			}
		}
		UpdateWaterBoxes(WQEE->zQuad);
	}
	else if ( WaterQuadDeletedEvent* WQDE = dynamic_cast<WaterQuadDeletedEvent*>(e) )
	{
		// Find Water Plane
		auto i = zWaterQuads.find(WQDE->zQuad);
		zGraphics->DeleteWaterPlane(i->second);
		zWaterQuads.erase(i);

		// Delete Boxes
		auto boxI = zWaterBoxes.find(WQDE->zQuad);
		if ( boxI != zWaterBoxes.end() ) 
		{
			zGraphics->DeleteMesh(boxI->second.zCubes[0]);
			zGraphics->DeleteMesh(boxI->second.zCubes[1]);
			zGraphics->DeleteMesh(boxI->second.zCubes[2]);
			zGraphics->DeleteMesh(boxI->second.zCubes[3]);
			zWaterBoxes.erase(boxI);
		}
	}
	else if ( WorldSunChanged* WSC = dynamic_cast<WorldSunChanged*>(e) )
	{
		zGraphics->SetSunLightProperties(
			WSC->world->GetSunDir(),
			WSC->world->GetSunColor(),
			WSC->world->GetSunIntensity() );
	}
	else if ( SectorUnloadedEvent* SUE = dynamic_cast<SectorUnloadedEvent*>(e) )
	{
		UPDATEENUM& u = zUpdatesRequired[Vector2UINT(SUE->sectorX, SUE->sectorY)];
		u = (UPDATEENUM)(u | UPDATE_DELETE);
	}
	else if ( SectorLoadedEvent* SLE = dynamic_cast<SectorLoadedEvent*>(e) )
	{
		UPDATEENUM& u = zUpdatesRequired[Vector2UINT(SLE->x, SLE->y)];
		u = UPDATE_ALL;
	}
	else if ( SectorHeightMapChanged* SHMC = dynamic_cast<SectorHeightMapChanged*>(e) )
	{
		UPDATEENUM& u = zUpdatesRequired[ Vector2UINT(SHMC->sectorx, SHMC->sectory) ];
		u = (UPDATEENUM)(u | UPDATE_HEIGHTMAP);
	}
	else if ( SectorNormalChanged* SNC = dynamic_cast<SectorNormalChanged*>(e) )
	{
		UPDATEENUM& u = zUpdatesRequired[ Vector2UINT(SNC->sectorx, SNC->sectory) ];
		u = (UPDATEENUM)(u | UPDATE_HEIGHTMAP);
	}
	else if ( SectorBlendMapChanged* SHMC = dynamic_cast<SectorBlendMapChanged*>(e) )
	{
		UPDATEENUM& u = zUpdatesRequired[ Vector2UINT(SHMC->sectorx, SHMC->sectory) ];
		u = (UPDATEENUM)(u | UPDATE_BLENDMAP);
	}
	else if ( SectorBlendTexturesChanged* SBTC = dynamic_cast<SectorBlendTexturesChanged*>(e) )
	{
		UPDATEENUM& u = zUpdatesRequired[ Vector2UINT(SBTC->sectorX, SBTC->sectorY) ];
		u = (UPDATEENUM)(u | UPDATE_TEXTURES);
	}
	else if ( SectorAIGridChanged* SBTC = dynamic_cast<SectorAIGridChanged*>(e) )
	{
		UPDATEENUM& u = zUpdatesRequired[ Vector2UINT(SBTC->sectorX, SBTC->sectorY) ];
		u = (UPDATEENUM)(u | UPDATE_AIGRID);
	}
	else if ( EntityChangedTypeEvent* ECTE = dynamic_cast<EntityChangedTypeEvent*>(e) )
	{
		zEntsToUpdate.insert(ECTE->entity);
	}
	else if ( EntityLoadedEvent* ELE = dynamic_cast<EntityLoadedEvent*>(e) )
	{
		zEntsToUpdate.insert(ELE->entity);
	}
	else if ( EntityUpdatedEvent* EUE = dynamic_cast<EntityUpdatedEvent*>(e) )
	{
		SetEntityTransformation(EUE->entity);
	}
	else if ( EntityRemovedEvent* ERE = dynamic_cast<EntityRemovedEvent*>(e) )
	{
		DeleteEntity(ERE->entity);
	}
	else if ( EntityDeletedEvent* EDE = dynamic_cast<EntityDeletedEvent*>(e) )
	{
		DeleteEntity(EDE->entity);
	}
}
Exemplo n.º 17
0
/////////////////////////////////////////////////////////////////////////////
//
// OPERATION: oTZEREMDO_DeleteRelationship
//
// PURPOSE:   Delete Relationship from ER Model
//
/////////////////////////////////////////////////////////////////////////////
zOPER_EXPORT zSHORT OPERATION
oTZEREMDO_DeleteRelationship( zVIEW  vTZEREMDO,
                              zSHORT nReposition,
                              zSHORT nQuietMode )
{
   zVIEW          vTZERSASO;
   zVIEW          vSubtask;
   zVIEW          vERD;
   zSHORT         nRC;
   unsigned long  ulZKey;
   LPLIBRARY      hLibrary = 0;  // used for dynamic call to ER control func's
   zFARPROC_RemoveFunc lpfn = 0;

   //  Positon on ER_RelType on Right Side( side representing relationships
   //  only ) thus allowing a single Delete to cascade and Delete all
   //  representations of the Relationship on both sides of the Object.
   nRC = SetCursorFirstEntityByEntityCsr( vTZEREMDO, "ER_RelType",
                                          vTZEREMDO, "ER_RelType_1",
                                          "EntpER_Model" );

   if ( GetViewByName( &vSubtask, "TZEREMDD", vTZEREMDO, zLEVEL_TASK ) > 0 )
   {
      if ( lpfn == 0 )   // only get func addr once
      {
         lpfn =(zFARPROC_RemoveFunc)
                  GetOperationDynamicCallAddress( vSubtask,(LPLPLIBRARY) &hLibrary,
                     "TZCTL", "RemoveRelationship", "(tzlooprs)" );
      }

      if ( lpfn )
        (*lpfn)( vSubtask, "ERD", 0, 0 );
   }

   // if delete Relationship and this Relationship is a part of the
   // Identifier, then delete the Relationship from the Identifier
   CreateViewFromViewForTask( &vERD, vTZEREMDO, 0 );

   for ( nRC = SetCursorFirstEntity( vERD, "ER_RelLink_2", "" );
         nRC >= zCURSOR_SET;
         nRC = SetCursorNextEntity( vERD, "ER_RelLink_2", "" ) )
   {
      GetIntegerFromAttribute( &ulZKey, vERD, "ER_RelLink_2", "ZKey" );
      for ( nRC = SetCursorFirstEntityByInteger( vERD, "ER_RelLinkIdentifier",
                  "ZKey", ulZKey, "EntpER_Model" );
            nRC >= zCURSOR_SET;
            nRC = SetCursorNextEntityByInteger( vERD, "ER_RelLinkIdentifier",
                  "ZKey", ulZKey, "EntpER_Model" ))
      {
         if ( CheckExistenceOfEntity( vERD, "ER_AttributeIdentifier" ) == zCURSOR_NULL )
         {

            DeleteEntity( vERD, "ER_FactType", zREPOS_NONE );
         }

      }
   }

   DropView( vERD );

   nRC = DeleteEntity( vTZEREMDO, "ER_RelType", nReposition );
   if ( nReposition != zREPOS_NONE )
   {
      if ( nReposition == zREPOS_NEXT )
         SetCursorNextEntity( vTZEREMDO, "ER_RelLink", "" );
      else
         SetCursorPrevEntity( vTZEREMDO, "ER_RelLink", "" );
   }

   // It is possible that the ER_RelType we just deleted is part of an
   // opened Subject Area.  If so, we must be sure that Subject Area doesn't
   // have hanging SA_RelType entities that result from the deleted
   // relationships.
   if ( GetViewByName( &vTZERSASO, "TZERSASO", vTZEREMDO, zLEVEL_TASK ) > 0 )
   {
      nRC = SetCursorFirstEntity( vTZERSASO, "SA_RelType", 0 );
      while ( nRC >= zCURSOR_SET )
      {
         if ( CheckExistenceOfEntity( vTZERSASO, "ER_RelType" ) < zCURSOR_SET )
         {
            if ( GetViewByName( &vSubtask, "SAVIEW", vTZEREMDO, zLEVEL_TASK ) > 0 )
            {
               if ( lpfn == 0 )   // only get func addr once
               {
                  lpfn = (zFARPROC_RemoveFunc)
                     GetOperationDynamicCallAddress( vSubtask,
                                                     (LPLPLIBRARY) &hLibrary,
                                                     "TZCTL",
                                                     "RemoveRelationship",
                                                     "(tzlooprs)" );
               }
               if ( lpfn )
               (*lpfn)( vSubtask, "ERD", 0, 0 );
            }

            DeleteEntity( vTZERSASO, "SA_RelType", zREPOS_NONE );
         }

         nRC = SetCursorNextEntity( vTZERSASO, "SA_RelType", 0 );
      }
   }

   return( 0 );
}
Exemplo n.º 18
0
void RMouseDownPick() {
	DeleteEntity();
}
Exemplo n.º 19
0
Entity::~Entity() {
	DeleteEntity(this);
}
Exemplo n.º 20
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.º 21
0
/////////////////////////////////////////////////////////////////////////////
//
// OPERATION: zoTZSIXSKO_SaveXSK
//
// PURPOSE:
//
// TRIGGLODED BY:
//    WINDOW: TZZOLODD
//    ACTION: OPTION
//    NAME: File_Save
//
/////////////////////////////////////////////////////////////////////////////
zOPER_EXPORT zSHORT OPERATION
zoTZSIXSKO_SaveXSK( zVIEW vTZZOXODO, zVIEW vTZTENVRO )
{
   zVIEW  vKZSIXSKO;
   zVIEW  vKZSIXSKO_Root;
   zVIEW  vTZTENVRO_REF = 0;
   zVIEW  vTZTENVR1 = 0;
   zVIEW  vTaskLPLR;
   zSHORT nRC;
   zCHAR  szFileName[ zMAX_FILESPEC_LTH + 1 ];
   zCHAR  szMetaName[ 33 ];
   zLONG  lTE_ZKey = 0;
   zSHORT nAttrCount = 0;
   zSHORT nDS_Count = 0;

   /*=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?
   ?? Hier muss noch der oder die Siron Kennungen abgehandelt
   ?? werden
   **=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?*/

//  Check access to TE Object
   if ( !vTZTENVRO )
   {
      nRC = MessagePrompt( vTZZOXODO, "XOD_02", "Internal LOD Error",
                    "Unable to Load related TE.\n\nOpen or Create TE First.",
                    0, zBUTTONS_OK, 0, 0 );
      vKZSIXSKO = 0;  // initialize to something DKS 2000.03.09?
      DeleteEntity( vKZSIXSKO, "OBJECT", zREPOS_NONE );
      return( 0 );
   }

   nRC = ActivateEmptyObjectInstance( &vKZSIXSKO, "KZSIXSKO", vTZZOXODO,
                                      zMULTIPLE | zLEVEL_APPLICATION );
   if ( nRC < 0 )
   {
      nRC = MessagePrompt( vTZZOXODO, "XOD_01", "Internal LOD Error",
                           "Unable to Activate Empty XSK.\n\nSeek help.",
                            0, zBUTTONS_OK, 0, 0 );
      return( 0 );
   }

   nRC = SetNameForView( vKZSIXSKO, "KZSIXSKO", vTZZOXODO, zLEVEL_TASK );
   nRC = CreateEntity( vKZSIXSKO, "OBJECT", zPOS_AFTER );

   nRC = SetAttributeFromAttribute( vKZSIXSKO, "OBJECT", "Name",
                                    vTZZOXODO, "OBJECT", "NAME" );
   nRC = SetAttributeFromAttribute( vKZSIXSKO, "OBJECT", "ZKey",
                                    vTZZOXODO, "OBJECT", "ZKey" );

   CreateViewFromViewForTask( &vKZSIXSKO_Root, vKZSIXSKO, 0 );
   zofnTZSIXSKO_BldXSK( vKZSIXSKO_Root, vKZSIXSKO, vTZZOXODO, vTZTENVRO );

   // Commit the XSK to a file named the same as the XOD,
   // except with suffix ".XSK".
   GetViewByName( &vTaskLPLR, "TaskLPLR", vTZZOXODO, zLEVEL_TASK );
   GetStringFromAttribute( szFileName, vTaskLPLR, "LPLR", "ExecDir" );
   zstrcat( szFileName, "\\" );
   GetStringFromAttribute( szMetaName, vTZZOXODO, "OBJECT", "NAME" );
   zstrcat( szFileName, szMetaName );
   zstrcat( szFileName, ".XSK" );
   CommitOI_ToFile( vKZSIXSKO, szFileName, zASCII );

   DropView( vKZSIXSKO_Root );

   return( 0 );
}
Exemplo n.º 22
0
   //:VIEW OperationXOG    BASED ON LOD TZZOXOGO
zOPER_EXPORT zSHORT OPERATION
oTZOGSRCO_GenerateXOG( zVIEW     OperationGroup )
{
   zVIEW     OperationXOG = 0; 
   //:VIEW OperationGroupT BASED ON LOD TZOGSRCO
   zVIEW     OperationGroupT = 0; 
   //:VIEW CurrentLPLR     BASED ON LOD TZCMLPLO
   zVIEW     CurrentLPLR = 0; 
   //:STRING ( 513 ) XOG_FileName 
   zCHAR     XOG_FileName[ 514 ] = { 0 }; 
   //:STRING ( 513 ) POG_FileName
   zCHAR     POG_FileName[ 514 ] = { 0 }; 
   //:STRING ( 200 ) szMsg
   zCHAR     szMsg[ 201 ] = { 0 }; 
   //:INTEGER        lFile
   zLONG     lFile = 0; 
   //:SHORT          nRC                 
   zSHORT    nRC = 0; 
   zSHORT    RESULT; 
   zCHAR     szTempString_0[ 33 ]; 
   zCHAR     szTempString_1[ 33 ]; 


   //:// Build the executable Global Object executable for all Operations in the LPLR.

   //:// Activate or initialize the XOG executable object.
   //:GET VIEW CurrentLPLR NAMED "TaskLPLR"
   RESULT = GetViewByName( &CurrentLPLR, "TaskLPLR", OperationGroup, zLEVEL_TASK );
   //:XOG_FileName = CurrentLPLR.LPLR.ExecDir + "\" + CurrentLPLR.LPLR.Name + ".XOG"
   GetStringFromAttribute( XOG_FileName, CurrentLPLR, "LPLR", "ExecDir" );
   ZeidonStringConcat( XOG_FileName, 1, 0, "\\", 1, 0, 514 );
   GetVariableFromAttribute( szTempString_0, 0, 'S', 33, CurrentLPLR, "LPLR", "Name", "", 0 );
   ZeidonStringConcat( XOG_FileName, 1, 0, szTempString_0, 1, 0, 514 );
   ZeidonStringConcat( XOG_FileName, 1, 0, ".XOG", 1, 0, 514 );
   //:lFile = SysOpenFile( OperationGroup, XOG_FileName, COREFILE_READ )
   lFile = SysOpenFile( OperationGroup, XOG_FileName, COREFILE_READ );
   //:IF lFile < 0
   if ( lFile < 0 )
   { 
      //:// Executable has not yet been generated.
      //:ACTIVATE OperationXOG EMPTY 
      RESULT = ActivateEmptyObjectInstance( &OperationXOG, "TZZOXOGO", OperationGroup, zSINGLE );
      //:CREATE ENTITY OperationXOG.TZZOXOGO 
      RESULT = CreateEntity( OperationXOG, "TZZOXOGO", zPOS_AFTER );
      //:OperationXOG.TZZOXOGO.NAME = CurrentLPLR.LPLR.Name
      SetAttributeFromAttribute( OperationXOG, "TZZOXOGO", "NAME", CurrentLPLR, "LPLR", "Name" );
      //:ELSE
   } 
   else
   { 
      //:SysCloseFile( OperationGroup, lFile, 0 )
      SysCloseFile( OperationGroup, lFile, 0 );
      //:// Get current executable File.
      //:ActivateOI_FromFile( OperationXOG, "TZZOXOGO", OperationGroup, XOG_FileName, zSINGLE )
      ActivateOI_FromFile( &OperationXOG, "TZZOXOGO", OperationGroup, XOG_FileName, zSINGLE );

      //:// Delete current source file entries.
      //:FOR EACH OperationXOG.GLOBALOPERATIONSOURCEFILE 
      RESULT = SetCursorFirstEntity( OperationXOG, "GLOBALOPERATIONSOURCEFILE", "" );
      while ( RESULT > zCURSOR_UNCHANGED )
      { 
         //:DELETE ENTITY OperationXOG.GLOBALOPERATIONSOURCEFILE NONE 
         RESULT = DeleteEntity( OperationXOG, "GLOBALOPERATIONSOURCEFILE", zREPOS_NONE );
         RESULT = SetCursorNextEntity( OperationXOG, "GLOBALOPERATIONSOURCEFILE", "" );
      } 

      //:END
   } 

   //:END
   //:NAME VIEW OperationXOG "OperationXOG"
   SetNameForView( OperationXOG, "OperationXOG", 0, zLEVEL_TASK );

   //:// Build the executable components from each POG Operation.
   //:SET CURSOR FIRST CurrentLPLR.W_MetaType WHERE CurrentLPLR.W_MetaType.Type = 14   // 14 is Global Operation Group 
   RESULT = SetCursorFirstEntityByInteger( CurrentLPLR, "W_MetaType", "Type", 14, "" );
   //:FOR EACH CurrentLPLR.W_MetaDef 
   RESULT = SetCursorFirstEntity( CurrentLPLR, "W_MetaDef", "" );
   while ( RESULT > zCURSOR_UNCHANGED )
   { 
      //:POG_FileName = CurrentLPLR.LPLR.MetaSrcDir + "\" + CurrentLPLR.W_MetaDef.Name + ".POG"
      GetStringFromAttribute( POG_FileName, CurrentLPLR, "LPLR", "MetaSrcDir" );
      ZeidonStringConcat( POG_FileName, 1, 0, "\\", 1, 0, 514 );
      GetVariableFromAttribute( szTempString_1, 0, 'S', 33, CurrentLPLR, "W_MetaDef", "Name", "", 0 );
      ZeidonStringConcat( POG_FileName, 1, 0, szTempString_1, 1, 0, 514 );
      ZeidonStringConcat( POG_FileName, 1, 0, ".POG", 1, 0, 514 );
      //:nRC = ActivateOI_FromFile( OperationGroupT, "TZOGSRCO", OperationGroup, POG_FileName, zSINGLE + 8192 )
      nRC = ActivateOI_FromFile( &OperationGroupT, "TZOGSRCO", OperationGroup, POG_FileName, zSINGLE + 8192 );
      //:IF nRC < 0
      if ( nRC < 0 )
      { 
         //:szMsg = "Can't open POG file, " + POG_FileName
         ZeidonStringCopy( szMsg, 1, 0, "Can't open POG file, ", 1, 0, 201 );
         ZeidonStringConcat( szMsg, 1, 0, POG_FileName, 1, 0, 201 );
         //:IssueError( OperationGroup,0,0, szMsg )
         IssueError( OperationGroup, 0, 0, szMsg );
         //:RETURN -1
         return( -1 );
      } 

      //:END
      //:// Create Source file entry.
      //:CREATE ENTITY OperationXOG.GLOBALOPERATIONSOURCEFILE 
      RESULT = CreateEntity( OperationXOG, "GLOBALOPERATIONSOURCEFILE", zPOS_AFTER );
      //:OperationXOG.GLOBALOPERATIONSOURCEFILE.NAME         = OperationGroupT.GlobalOperationGroup.Name 
      SetAttributeFromAttribute( OperationXOG, "GLOBALOPERATIONSOURCEFILE", "NAME", OperationGroupT, "GlobalOperationGroup", "Name" );
      //:OperationXOG.GLOBALOPERATIONSOURCEFILE.LANGUAGETYPE = OperationGroupT.GlobalOperationGroup.LanguageType 
      SetAttributeFromAttribute( OperationXOG, "GLOBALOPERATIONSOURCEFILE", "LANGUAGETYPE", OperationGroupT, "GlobalOperationGroup", "LanguageType" );

      //:// Create each Operation entry.
      //:FOR EACH OperationGroupT.Operation 
      RESULT = SetCursorFirstEntity( OperationGroupT, "Operation", "" );
      while ( RESULT > zCURSOR_UNCHANGED )
      { 
         //:CREATE ENTITY OperationXOG.OPERATION 
         RESULT = CreateEntity( OperationXOG, "OPERATION", zPOS_AFTER );
         //:OperationXOG.OPERATION.NAME = OperationGroupT.Operation.Name 
         SetAttributeFromAttribute( OperationXOG, "OPERATION", "NAME", OperationGroupT, "Operation", "Name" );
         //:OperationXOG.OPERATION.TYPE = OperationGroupT.Operation.Type 
         SetAttributeFromAttribute( OperationXOG, "OPERATION", "TYPE", OperationGroupT, "Operation", "Type" );

         //:FOR EACH OperationGroupT.Parameter 
         RESULT = SetCursorFirstEntity( OperationGroupT, "Parameter", "" );
         while ( RESULT > zCURSOR_UNCHANGED )
         { 
            //:CREATE ENTITY OperationXOG.PARAMETER 
            RESULT = CreateEntity( OperationXOG, "PARAMETER", zPOS_AFTER );
            //:OperationXOG.PARAMETER.NAME     = OperationGroupT.Parameter.ShortDesc 
            SetAttributeFromAttribute( OperationXOG, "PARAMETER", "NAME", OperationGroupT, "Parameter", "ShortDesc" );
            //:OperationXOG.PARAMETER.DATATYPE = OperationGroupT.Parameter.DataType 
            SetAttributeFromAttribute( OperationXOG, "PARAMETER", "DATATYPE", OperationGroupT, "Parameter", "DataType" );
            RESULT = SetCursorNextEntity( OperationGroupT, "Parameter", "" );
         } 

         RESULT = SetCursorNextEntity( OperationGroupT, "Operation", "" );
         //:END 
      } 

      RESULT = SetCursorNextEntity( CurrentLPLR, "W_MetaDef", "" );
      //:END
   } 

   //:END
   //:CommitOI_ToFile( OperationXOG, XOG_FileName, zASCII )
   CommitOI_ToFile( OperationXOG, XOG_FileName, zASCII );
   //:DropObjectInstance( OperationXOG )
   DropObjectInstance( OperationXOG );
   return( 0 );
// END
} 
Exemplo n.º 23
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.º 24
0
/////////////////////////////////////////////////////////////////////////////
//
//   OPERATION:   DequeueInstance
//
//   PARAMETERS:  zVIEW  vInstance - View to the instance to be dequeued
//                zSHORT nCheckOnly - 0 to dequeue
//                                  - non-zero to check the instance is
//                                    enqueued only.
//
//   RETURN CODES:  0 - Dequeue successful
//                  1 - Enqueue not found
//                  zCALL_ERROR - Dequeue unsuccessful, error in processing
//
/////////////////////////////////////////////////////////////////////////////
zSHORT OPERATION
DequeueInstance( zVIEW vInstance, zSHORT nCheckOnly )
{
   zVIEW  vEnqueue;
   zVIEW  vQual;
   zLONG  lActivateFlags;
   zCHAR  szObjectName[ 34 ];
   zCHAR  szUserID[ 34 ];
   zCHAR  szPassword[ 34 ];
   zCHAR  szTimestamp[ 6 ];
   zSHORT nRC;

   if ( MiGetObjectNameForView( szObjectName, vInstance ) < 0 )
      return( zCALL_ERROR );

   // Set up a an enqueue instance for building the qual object
   if ( ActivateEmptyObjectInstance( &vEnqueue, szlCGENQUEU,
                                     vInstance, zSINGLE ) != 0 )
   {
      return( zCALL_ERROR );
   }

   SysGetUserID( vInstance, szUserID, szPassword );
   if ( szUserID[ 0 ] == 0 )
      zstrcpy( szUserID, "(null)" );

   MiGetDateTimeForOI( szTimestamp, vInstance );
   if ( nCheckOnly )
      lActivateFlags = zSINGLE;
   else
      lActivateFlags = zMULTIPLE;

   // Build a partial enqueue instance for passing to the qualification
   // build function fnBuildQualForEnqueueDelete.
   CreateEntity( vEnqueue, szlEnqueue, zPOS_FIRST );
   SetAttributeFromVariable( vEnqueue, szlEnqueue, szlTimestamp,
                           szTimestamp, zTYPE_DATETIME,
                           6, 0, 0 );
   SetAttributeFromString( vEnqueue, szlEnqueue, szlUser,
                           szUserID );
   fnBuildQualForEnqueueDelete( vEnqueue, &vQual );
   DropObjectInstance( vEnqueue );
   nRC = ActivateObjectInstance( &vEnqueue, szlCGENQUEU,
                                 vInstance, vQual, lActivateFlags );
   DropObjectInstance( vQual );
   if ( nRC < -1 )
      return( zCALL_ERROR );
   else
   if ( nRC == -1 )
   {
      DropObjectInstance( vEnqueue );
      return( 1 );
   }

   // The enqueue was found, if it is a check only, drop the instance
   // and return 0, otherwise, delete the enqueue.
   if ( nCheckOnly )
   {
      DropObjectInstance( vEnqueue );
      return( 0 );
   }

   nRC = SetCursorFirstEntity( vEnqueue, szlEnqueue, 0 );
   while ( nRC >= zCURSOR_SET )
      nRC = DeleteEntity( vEnqueue, szlEnqueue, zREPOS_NEXT );

   nRC = CommitObjectInstance( vEnqueue );
   DropObjectInstance( vEnqueue );
   if ( nRC < 0 )
      return( zCALL_ERROR );

   return( 0 );
}
Exemplo n.º 25
0
ProcessControls()
{
  int xmax, ymax;

  xmax = (layer[0].sizex * 16) - sx;
  ymax = (layer[0].sizey * 16) - sy;

  if (key[SCAN_F5]) { key[SCAN_F5]=0; ShellMAP(); }
  if (key[SCAN_F6]) { key[SCAN_F6]=0; CompileAll(); }
  if (key[SCAN_F8]) { key[SCAN_F8]=0; ShellVERGE(); }
  if (key[SCAN_ALT] && key[SCAN_D]) { key[SCAN_D]=0; ShellToDOS(); }
  if (key[SCAN_ALT] && key[SCAN_L]) LoadMAPDialog();
  if (key[SCAN_ALT] && key[SCAN_V]) ShellEditMAP();
  if (key[SCAN_ALT] && key[SCAN_S]) ShellEditSystem();
  if (key[SCAN_ALT] && key[SCAN_N]) NewMAP();
  if (key[SCAN_ALT] && key[SCAN_P]) MPDialog();
  if (!key[SCAN_ALT] && key[SCAN_P]) { pasting^=1; key[SCAN_P]=0; } // aen

  if (key[SCAN_A] && el<6)
  {
    lt++;
    if (lt==numtiles) lt=0;
    key[SCAN_A]=0;
  }
  if (key[SCAN_Z] && el<6)
  {
    if (lt) lt--;
    else lt=numtiles-1;
    key[SCAN_Z]=0;
  }
  if (key[SCAN_A] && el==7)
  {
    curzone++;
    key[SCAN_A]=0;
  }
  if (key[SCAN_Z] && el==7)
  {
    curzone--;
    key[SCAN_Z]=0;
  }
  if (key[SCAN_S])
  {
    rt++;
    if (rt==numtiles) rt=0;
    key[SCAN_S]=0;
  }
  if (key[SCAN_X])
  {
    if (rt) rt--;
    else rt=numtiles-1;
    key[SCAN_X]=0;
  }
  if (key[SCAN_F10])
  {
    key[SCAN_F10]=0;
    if (random(0,255)<15) HAL();
    SaveMAP(mapname);
    SaveVSP(vspname);
    CompileMAP();
    Message("MAP/VSP saved.",100);
    modified=0;
  }
  if (key[SCAN_C])
  {
    key[SCAN_C]=0;
    sprintf(strbuf,"Left: %d Right: %d", lt, rt);
    Message(strbuf, 300);
  }
  if (key[SCAN_M])
  {
    key[SCAN_M]=0;
    GenerateMiniVSP();
    MiniMAP();
  }
  if (key[SCAN_H])
  {
    key[SCAN_H]=0;
    mh=mh^1;
    if (mh) Message("MAP Tile Highlight enabled.",100);
       else Message("MAP Tile Highlight disabled.",100);
  }

  // ***
  // movement code moved to PollMovement()
  // ***

  if (key[SCAN_PGUP])
  {
    key[SCAN_PGUP]=0;
    ywin -= sy;
    if (ywin < 0)
      ywin = 0;
  }
  if (key[SCAN_HOME])
  {
    key[SCAN_HOME]=0;
    xwin -= sx;
    if (xwin < 0)
      xwin = 0;
  }
  if (key[SCAN_END])
  {
    key[SCAN_END]=0;
    xwin += sx;
    if (xwin > xmax)
      xwin = xmax;
  }
  if (key[SCAN_PGDN])
  {
    key[SCAN_PGDN]=0;
    ywin += sy;
    if (ywin > ymax)
      ywin = ymax;
  }

  if (key[SCAN_CTRL] && el<6)
  {
    key[SCAN_CTRL]=0;
    TileSelector();
  }
  if (key[SCAN_CTRL] && el==7)
  {
    key[SCAN_CTRL]=0;
    ZoneEdDialog();
  }

  if (key[SCAN_TAB])
  {
    key[SCAN_TAB]=0;
    if (scrollmode)
    {
      scrollmode=0;
      xwin=xwin/16; xwin=xwin*16;
      ywin=ywin/16; ywin=ywin*16;
      Message("Tile scroll.",150);
    }
    else
    {
      scrollmode=1;
      Message("Pixel scroll.",150);
    }
  }

  if (key[SCAN_1])
  {
     if (key[SCAN_LSHIFT] || key[SCAN_RSHIFT])
     {
       layertoggle[0]=0;
       return;
     }
     layertoggle[0]=1;
     layertoggle[6]=0; layertoggle[7]=0;
     layertoggle[8]=0; layertoggle[9]=0;
     el=0;
     key[SCAN_1]=0;
  }
  if (key[SCAN_2])
  {
     if (key[SCAN_LSHIFT] || key[SCAN_RSHIFT])
     {
       layertoggle[1]=0;
       return;
     }
     key[SCAN_2]=0;
     layertoggle[6]=0; layertoggle[7]=0;
     layertoggle[8]=0; layertoggle[9]=0;
     if (numlayers>1)
     { layertoggle[1]=1;
       el=1; }
  }
  if (key[SCAN_3])
  {
     if (key[SCAN_LSHIFT] || key[SCAN_RSHIFT])
     {
       layertoggle[2]=0;
       return;
     }
     key[SCAN_3]=0;
     layertoggle[6]=0; layertoggle[7]=0;
     layertoggle[8]=0; layertoggle[9]=0;
     if (numlayers>2)
     { layertoggle[2]=1;
       el=2; }
  }
  if (key[SCAN_4])
  {
     if (key[SCAN_LSHIFT] || key[SCAN_RSHIFT])
     {
       layertoggle[3]=0;
       return;
     }
     key[SCAN_4]=0;
     layertoggle[6]=0; layertoggle[7]=0;
     layertoggle[8]=0; layertoggle[9]=0;
     if (numlayers>3)
     { layertoggle[3]=1;
       el=3; }
  }
  if (key[SCAN_5])
  {
     if (key[SCAN_LSHIFT] || key[SCAN_RSHIFT])
     {
       layertoggle[4]=0;
       return;
     }
     key[SCAN_5]=0;
     layertoggle[6]=0; layertoggle[7]=0;
     layertoggle[8]=0; layertoggle[9]=0;
     if (numlayers>4)
     { layertoggle[4]=1;
       el=4; }
  }
  if (key[SCAN_6])
  {
     if (key[SCAN_LSHIFT] || key[SCAN_RSHIFT])
     {
       layertoggle[5]=0;
       return;
     }
     key[SCAN_6]=0;
     layertoggle[6]=0; layertoggle[7]=0;
     layertoggle[8]=0; layertoggle[9]=0;
     if (numlayers>5)
     { layertoggle[5]=1;
       el=5; }
  }
  if (key[SCAN_O])
  {
     key[SCAN_O]=0;
     layertoggle[6]=1; layertoggle[7]=0;
     layertoggle[8]=0; layertoggle[9]=0;
     el=6;
  }
  if (key[SCAN_N])
  {
     key[SCAN_N]=0;
     layertoggle[6]=0; layertoggle[7]=1;
     layertoggle[8]=0; layertoggle[9]=0;
     el=7;
  }
  if (key[SCAN_E])
  {
     key[SCAN_E]=0;
     layertoggle[6]=0; layertoggle[7]=0;
     layertoggle[8]=1; layertoggle[9]=0;
     el=8;
  }
  if (key[SCAN_T])
  {
     key[SCAN_T]=0;
     layertoggle[6]=0; layertoggle[7]=0;
     layertoggle[8]=0; layertoggle[9]=1;
     el=9;
  }
  if (key[SCAN_F9])
  { // aen
    key[SCAN_F9]=0;
    mouse_scroll^=1;
    sprintf(strbuf,"Mouse scroll %sabled.", mouse_scroll ? "en" : "dis");
    Message(strbuf, 100);
  }
  if (key[SCAN_F11])
  {
    key[SCAN_F11]=0;
    ScreenShot();
    Message("Screen capture saved.",300);
  }
  if (key[SCAN_F12])
  {
    key[SCAN_F12]=0;
    OutputVSPpcx();
    Message("PCX file exported.",300);
  }
  if (key[SCAN_LANGLE])
  {
      key[SCAN_LANGLE]=0;
      ShutdownVideo();
      vm=0;
      InitVideo(0);
      set_intensity(63);
      InitMouse();

      // aen -- gotta recalc this if you're in a lower res at the bottom of
      //        the map and jump to a higher res.
      xmax = (layer[0].sizex * 16) - sx;
      ymax = (layer[0].sizey * 16) - sy;
      if (xwin > xmax) xwin=xmax;
      if (ywin > ymax) ywin=ymax;
  }
  if (key[SCAN_RANGLE])
  {
      key[SCAN_RANGLE]=0;
      ShutdownVideo();
      vm=1;
      InitVideo(1);
      set_intensity(63);
      InitMouse();

      // aen -- gotta recalc this if you're in a lower res at the bottom of
      //        the map and jump to a higher res.
      xmax = (layer[0].sizex * 16) - sx;
      ymax = (layer[0].sizey * 16) - sy;
      if (xwin > xmax) xwin=xmax;
      if (ywin > ymax) ywin=ymax;
  }

  if (CheckMouseTabs()) return;

  if (mb>=3) MainMenu(mx-4,my-5);
  if (key[SCAN_ESC]) DoMainMenu();

  if (mb==1 && key[SCAN_SLASH] && el<6)
  {
    lt=layers[el][((((ywin*layer[el].pmulty/layer[el].pdivy)+my-16)/16) *
             layer[el].sizex)+(((xwin*layer[el].pmultx/layer[el].pdivx)+mx-16)/16)];

    return;
  }

  if (mb==2 && key[SCAN_SLASH] && el<6)
  {
    rt=layers[el][((((ywin*layer[el].pmulty/layer[el].pdivy)+my-16)/16) *
             layer[el].sizex)+(((xwin*layer[el].pmultx/layer[el].pdivx)+mx-16)/16)];
    return;
  }

  // aen; these must come before the tile plotting code just below
  // to work correctly.
  if (mb && el<6 && key[SCAN_LSHIFT] && !shifted)
  {
    selx1=(((xwin*layer[el].pmultx/layer[el].pdivx)+mx-16)/16);
    sely1=(((ywin*layer[el].pmulty/layer[el].pdivy)+my-16)/16);
    selx2=selx1;
    sely2=sely1;
    shifted=mb;
    return;
  }
  if (mb && el<6 && shifted)
  {
    selx2=(((xwin*layer[el].pmultx/layer[el].pdivx)+mx-16)/16);
    sely2=(((ywin*layer[el].pmulty/layer[el].pdivy)+my-16)/16);
    return;
  }
  if (!mb && el<6 && shifted)
  { int i,j;
    int x1,y1,x2,y2;

    x1=selx1;
    y1=sely1;
    x2=selx2;
    y2=sely2;

    if (x2<x1) x2^=x1,x1^=x2,x2^=x1;
    if (y2<y1) y2^=y1,y1^=y2,y2^=y1;

    copybuf_wide=x2-x1+1;
    copybuf_deep=y2-y1+1;

    if (shifted==2)
    {
      // block fill
      modified=1;
      for (j=0; j<copybuf_deep; j++)
      {
        for (i=0; i<copybuf_wide; i++)
          layers[el][((y1+j)*layer[el].sizex)+(x1+i)]=lt;
      }
    }

    if (shifted==1)
    {
      modified=1;
      if (copybuf) vfree(copybuf);
      copybuf=(word *)valloc(copybuf_wide*copybuf_deep*2, "copybuf", 0);

      // copy
      for (j=0; j<copybuf_deep; j++)
      {
        for (i=0; i<copybuf_wide; i++)
          copybuf[(j*copybuf_wide)+i]=layers[el][((y1+j)*layer[el].sizex)+(x1+i)];
      }
      pasting=1;
    }
    selx1=sely1=0;
    selx2=sely2=0;
    shifted=0;
  }
  if (mb==1 && el<6 && !shifted && pasting)
  { int a,b,i,j;

    a=(((xwin*layer[el].pmultx/layer[el].pdivx)+mx-16)/16);
    b=(((ywin*layer[el].pmulty/layer[el].pdivy)+my-16)/16);

    // paste
    for (j=0; j<copybuf_deep; j++)
    {
      for (i=0; i<copybuf_wide; i++)
      {
        if (b+j<layer[el].sizey && a+i<layer[el].sizex)
          layers[el][((b+j)*layer[el].sizex)+(a+i)]=copybuf[(j*copybuf_wide)+i];
      }
    }
  }

  if (mb==1 && el<6 && !shifted && !pasting)
  {
    if (mx>335) mx=334;
    modified=1;
    layers[el][((((ywin*layer[el].pmulty/layer[el].pdivy)+my-16)/16) *
               layer[el].sizex)+(((xwin*layer[el].pmultx/layer[el].pdivx)+mx-16)
               /16)]=lt;
  }
  if (mb==2 && el<6 && !shifted)
  {
    if (mx>335) mx=334;
    modified=1;
    layers[el][((((ywin*layer[el].pmulty/layer[el].pdivy)+my-16)/16) *
               layer[el].sizex)+(((xwin*layer[el].pmultx/layer[el].pdivx)+mx-16)
               /16)]=rt;
  }

  if (mb==1 && el==6)
  {
   modified=1;
   obstruct[((((ywin*layer[0].pmulty/layer[0].pdivy)+my-16)/16) *
               layer[0].sizex)+(((xwin*layer[0].pmultx/layer[0].pdivx)+mx-16)
               /16)]=1;
  }
  if (mb==2 && el==6)
  {
   modified=1;
   obstruct[((((ywin*layer[0].pmulty/layer[0].pdivy)+my-16)/16) *
               layer[0].sizex)+(((xwin*layer[0].pmultx/layer[0].pdivx)+mx-16)
               /16)]=0;
  }
  if (mb==1 && el==7 && (key[SCAN_LSHIFT] || key[SCAN_RSHIFT]))
  {
   curzone=zone[((((ywin*layer[0].pmulty/layer[0].pdivy)+my-16)/16) *
               layer[0].sizex)+(((xwin*layer[0].pmultx/layer[0].pdivx)+mx-16)
               /16)];
   WaitRelease();
   ZoneEdDialog();
   return;
  }
  if (mb==1 && el==7)
  {
   modified=1;
   zone[((((ywin*layer[0].pmulty/layer[0].pdivy)+my-16)/16) *
               layer[0].sizex)+(((xwin*layer[0].pmultx/layer[0].pdivx)+mx-16)
               /16)]=curzone;
  }
  if (mb==2 && el==7)
  {
   modified=1;
   zone[((((ywin*layer[0].pmulty/layer[0].pdivy)+my-16)/16) *
               layer[0].sizex)+(((xwin*layer[0].pmultx/layer[0].pdivx)+mx-16)
               /16)]=0;
  }
  if (mb==1 && el==8)
  {
     WaitRelease();
     ProcessEntity((xwin+(mx-16))/16,(ywin+(my-16))/16);
     modified=1;
  }
  if (el==8 && EntityThere((mx-16+xwin)/16,(my+ywin-16)/16) &&
      key[SCAN_DEL])
  {
    WaitRelease();
    DeleteEntity((mx-16+xwin)/16,(my-16+ywin)/16);
    modified=1;
  }
}
Exemplo n.º 26
0
//:   VIEW OldOperGrp  BASED ON LOD TZOGSRCO
zOPER_EXPORT zSHORT OPERATION
oTZOGSRCO_GlobalOperGrpMigrate( zVIEW     NewOperGrp,
                                zPCHAR    OperGroupMetaName,
                                zVIEW     SourceLPLR,
                                zVIEW     vSubtask )
{
   zVIEW     OldOperGrp = 0; 
   //:VIEW CurrentLPLR BASED ON LOD TZCMLPLO
   zVIEW     CurrentLPLR = 0; 

   //:STRING ( 513 ) SourceFileName                    // size according to zMAX_FILESPEC+1
   zCHAR     SourceFileName[ 514 ] = { 0 }; 
   //:STRING ( 513 ) SourceFileName2                   // size according to zMAX_FILESPEC+1
   zCHAR     SourceFileName2[ 514 ] = { 0 }; 
   //:STRING ( 36 ) SourceName
   zCHAR     SourceName[ 37 ] = { 0 }; 
   zSHORT    lTempInteger_0; 
   zSHORT    RESULT; 
   zCHAR     szTempString_0[ 33 ]; 


   //:// Activate existing source meta OldOperGroup
   //:SourceFileName = SourceLPLR.LPLR.MetaSrcDir + "\" + OperGroupMetaName + ".POG"
   GetStringFromAttribute( SourceFileName, SourceLPLR, "LPLR", "MetaSrcDir" );
   ZeidonStringConcat( SourceFileName, 1, 0, "\\", 1, 0, 514 );
   ZeidonStringConcat( SourceFileName, 1, 0, OperGroupMetaName, 1, 0, 514 );
   ZeidonStringConcat( SourceFileName, 1, 0, ".POG", 1, 0, 514 );
   //:// zIGNORE_ATTRIB_ERRORS=8192
   //:ActivateOI_FromFile( OldOperGrp, "TZOGSRCO", SourceLPLR,
   //:                     SourceFileName, zSINGLE + 8192 )
   ActivateOI_FromFile( &OldOperGrp, "TZOGSRCO", SourceLPLR, SourceFileName, zSINGLE + 8192 );
   //:NAME VIEW OldOperGrp "OldOperGrp"
   SetNameForView( OldOperGrp, "OldOperGrp", 0, zLEVEL_TASK );
   //://ActivateEmptyMetaOI( vSubtask, NewOperGrp, 14, zSINGLE ) // 14 is zSOURCE_GOPGRP_META
   //://NAME VIEW NewOperGrp "NewOperGrp"

   //:IF NewOperGrp.GlobalOperationGroup DOES NOT EXIST
   lTempInteger_0 = CheckExistenceOfEntity( NewOperGrp, "GlobalOperationGroup" );
   if ( lTempInteger_0 != 0 )
   { 

      //:// The Global Operation Group does not exist in the target, so simply copy everything over.

      //:CreateMetaEntity( vSubtask, NewOperGrp, "GlobalOperationGroup", zPOS_AFTER )
      CreateMetaEntity( vSubtask, NewOperGrp, "GlobalOperationGroup", zPOS_AFTER );
      //:SetMatchingAttributesByName( NewOperGrp, "GlobalOperationGroup", OldOperGrp, "GlobalOperationGroup", zSET_NULL )
      SetMatchingAttributesByName( NewOperGrp, "GlobalOperationGroup", OldOperGrp, "GlobalOperationGroup", zSET_NULL );

      //:// Copy over the source file to the new LPLR directory, if there is a source file.
      //:// We will assume a source file exists if the SourceFile.Extension is not null.  If there
      //:// is actually no source file, the CopyFile does no harm.
      //:IF OldOperGrp.GlobalOperationGroup.Extension != ""
      if ( CompareAttributeToString( OldOperGrp, "GlobalOperationGroup", "Extension", "" ) != 0 )
      { 
         //:RetrieveViewForMetaList( vSubtask, CurrentLPLR, zSOURCE_ERD_META ) // Get view for directory info.
         RetrieveViewForMetaList( vSubtask, &CurrentLPLR, zSOURCE_ERD_META );
         //:ResetViewFromSubobject( CurrentLPLR )
         ResetViewFromSubobject( CurrentLPLR );
         //:IF OldOperGrp.GlobalOperationGroup.Extension = "C"
         if ( CompareAttributeToString( OldOperGrp, "GlobalOperationGroup", "Extension", "C" ) == 0 )
         { 
            //:SourceName = OperGroupMetaName + ".C"
            ZeidonStringCopy( SourceName, 1, 0, OperGroupMetaName, 1, 0, 37 );
            ZeidonStringConcat( SourceName, 1, 0, ".C", 1, 0, 37 );
            //:ELSE
         } 
         else
         { 
            //:SourceName = OperGroupMetaName + ".VML"
            ZeidonStringCopy( SourceName, 1, 0, OperGroupMetaName, 1, 0, 37 );
            ZeidonStringConcat( SourceName, 1, 0, ".VML", 1, 0, 37 );
         } 

         //:END
         //:SourceFileName = SourceLPLR.LPLR.PgmSrcDir + "\" + SourceName
         GetStringFromAttribute( SourceFileName, SourceLPLR, "LPLR", "PgmSrcDir" );
         ZeidonStringConcat( SourceFileName, 1, 0, "\\", 1, 0, 514 );
         ZeidonStringConcat( SourceFileName, 1, 0, SourceName, 1, 0, 514 );
         //:SourceFileName2 = CurrentLPLR.LPLR.PgmSrcDir + "\" + SourceName
         GetStringFromAttribute( SourceFileName2, CurrentLPLR, "LPLR", "PgmSrcDir" );
         ZeidonStringConcat( SourceFileName2, 1, 0, "\\", 1, 0, 514 );
         ZeidonStringConcat( SourceFileName2, 1, 0, SourceName, 1, 0, 514 );
         //:SysCopyFile( vSubtask, SourceFileName, SourceFileName2, TRUE )
         SysCopyFile( vSubtask, SourceFileName, SourceFileName2, TRUE );
         //:DropMetaOI( vSubtask, CurrentLPLR )
         DropMetaOI( vSubtask, CurrentLPLR );
      } 

      //:END

      //:FOR EACH OldOperGrp.Operation
      RESULT = SetCursorFirstEntity( OldOperGrp, "Operation", "" );
      while ( RESULT > zCURSOR_UNCHANGED )
      { 

         //:CreateMetaEntity( vSubtask, NewOperGrp, "Operation", zPOS_AFTER )
         CreateMetaEntity( vSubtask, NewOperGrp, "Operation", zPOS_AFTER );
         //:SetMatchingAttributesByName ( NewOperGrp, "Operation", OldOperGrp,
         //:                              "Operation", zSET_NULL )
         SetMatchingAttributesByName( NewOperGrp, "Operation", OldOperGrp, "Operation", zSET_NULL );

         //:FOR EACH OldOperGrp.Parameter
         RESULT = SetCursorFirstEntity( OldOperGrp, "Parameter", "" );
         while ( RESULT > zCURSOR_UNCHANGED )
         { 
            //:// Make sure the ShortDesc in the Parameter is not null.
            //:IF OldOperGrp.Parameter.ShortDesc = ""
            if ( CompareAttributeToString( OldOperGrp, "Parameter", "ShortDesc", "" ) == 0 )
            { 
               //:OldOperGrp.Parameter.ShortDesc = "Parm"
               SetAttributeFromString( OldOperGrp, "Parameter", "ShortDesc", "Parm" );
            } 

            //:END
            //:CreateMetaEntity( vSubtask, NewOperGrp, "Parameter", zPOS_AFTER )
            CreateMetaEntity( vSubtask, NewOperGrp, "Parameter", zPOS_AFTER );
            //:SetMatchingAttributesByName( NewOperGrp, "Parameter", OldOperGrp,
            //:                             "Parameter", zSET_NULL )
            SetMatchingAttributesByName( NewOperGrp, "Parameter", OldOperGrp, "Parameter", zSET_NULL );
            RESULT = SetCursorNextEntity( OldOperGrp, "Parameter", "" );
         } 

         RESULT = SetCursorNextEntity( OldOperGrp, "Operation", "" );
         //:END
      } 


      //:END

      //:ELSE
   } 
   else
   { 

      //:// The Global Operation Group exists in the target, so merge in any new Operations.
      //:// We will force over any Operations (both prototype and code) for any Operations not flagged as modified in target LPLR.

      //:FOR EACH OldOperGrp.Operation
      RESULT = SetCursorFirstEntity( OldOperGrp, "Operation", "" );
      while ( RESULT > zCURSOR_UNCHANGED )
      { 

         //:SET CURSOR FIRST NewOperGrp.Operation WHERE NewOperGrp.Operation.Name = OldOperGrp.Operation.Name
         GetStringFromAttribute( szTempString_0, OldOperGrp, "Operation", "Name" );
         RESULT = SetCursorFirstEntityByString( NewOperGrp, "Operation", "Name", szTempString_0, "" );
         //:IF RESULT < zCURSOR_SET
         if ( RESULT < zCURSOR_SET )
         { 
            //:CreateMetaEntity( vSubtask, NewOperGrp, "Operation", zPOS_AFTER )
            CreateMetaEntity( vSubtask, NewOperGrp, "Operation", zPOS_AFTER );
            //:SetMatchingAttributesByName ( NewOperGrp, "Operation", OldOperGrp, "Operation", zSET_NULL )
            SetMatchingAttributesByName( NewOperGrp, "Operation", OldOperGrp, "Operation", zSET_NULL );
         } 

         //:END

         //:// If the operation is new or modifiable, set new parameters and operation code.
         //:IF NewOperGrp.Operation.DoNotMergeFlag = ""
         if ( CompareAttributeToString( NewOperGrp, "Operation", "DoNotMergeFlag", "" ) == 0 )
         { 
            //:FOR EACH NewOperGrp.Parameter
            RESULT = SetCursorFirstEntity( NewOperGrp, "Parameter", "" );
            while ( RESULT > zCURSOR_UNCHANGED )
            { 
               //:DELETE ENTITY NewOperGrp.Parameter NONE
               RESULT = DeleteEntity( NewOperGrp, "Parameter", zREPOS_NONE );
               RESULT = SetCursorNextEntity( NewOperGrp, "Parameter", "" );
            } 

            //:END
            //:FOR EACH OldOperGrp.Parameter
            RESULT = SetCursorFirstEntity( OldOperGrp, "Parameter", "" );
            while ( RESULT > zCURSOR_UNCHANGED )
            { 
               //:// Make sure the ShortDesc in the Parameter is not null.
               //:IF OldOperGrp.Parameter.ShortDesc = ""
               if ( CompareAttributeToString( OldOperGrp, "Parameter", "ShortDesc", "" ) == 0 )
               { 
                  //:OldOperGrp.Parameter.ShortDesc = "Parm"
                  SetAttributeFromString( OldOperGrp, "Parameter", "ShortDesc", "Parm" );
               } 

               //:END
               //:CreateMetaEntity( vSubtask, NewOperGrp, "Parameter", zPOS_AFTER )
               CreateMetaEntity( vSubtask, NewOperGrp, "Parameter", zPOS_AFTER );
               //:SetMatchingAttributesByName( NewOperGrp, "Parameter", OldOperGrp, "Parameter", zSET_NULL )
               SetMatchingAttributesByName( NewOperGrp, "Parameter", OldOperGrp, "Parameter", zSET_NULL );
               RESULT = SetCursorNextEntity( OldOperGrp, "Parameter", "" );
            } 

            //:END
         } 

         RESULT = SetCursorNextEntity( OldOperGrp, "Operation", "" );

         //:   // Add new Operation Code.
         //:   // CopyOperationCode

         //:END
      } 


      //:END
   } 


   //:END



   //:DropObjectInstance( OldOperGrp )
   DropObjectInstance( OldOperGrp );
   //:CommitMetaOI( vSubtask, NewOperGrp, 14 )   // 14 is zSOURCE_GOPGRP_META
   CommitMetaOI( vSubtask, NewOperGrp, 14 );

   //:// Build the prototypes in zeidon.h file.
   //:RetrieveViewForMetaList( vSubtask, CurrentLPLR, zSOURCE_GOPGRP_META ) // Get view for Merge oper.
   RetrieveViewForMetaList( vSubtask, &CurrentLPLR, zSOURCE_GOPGRP_META );
   //:ResetViewFromSubobject( CurrentLPLR )
   ResetViewFromSubobject( CurrentLPLR );
   //:MergeGlobalPrototypes( NewOperGrp,
   //:                       NewOperGrp.GlobalOperationGroup.Name,
   //:                       "GlobalOperationGroup",
   //:                       CurrentLPLR )
   GetStringFromAttribute( szTempString_0, NewOperGrp, "GlobalOperationGroup", "Name" );
   MergeGlobalPrototypes( NewOperGrp, szTempString_0, "GlobalOperationGroup", CurrentLPLR );
   //:DropMetaOI( vSubtask, CurrentLPLR )
   DropMetaOI( vSubtask, CurrentLPLR );
   return( 0 );
// END
}