示例#1
0
文件: tzvminaa.c 项目: DeegC/10d
zOPER_EXPORT zLONG OPERATION
GetExecModeByZKey( zVIEW  lpInterpSubtask,
                   zVIEW  lpAppSubtask,
                   zLONG  lZKey )

{
   zVIEW  vXChecker;
   zVIEW  CM_List;
   zCHAR  szExecDir[ zMAX_FILESPEC_LTH + 1 ];
   zSHORT nRC;

   nRC = GetViewByName( &vXChecker, "TZVSXCOO", lpInterpSubtask, zLEVEL_APPLICATION );

   if ( nRC != zLEVEL_APPLICATION )
   {
      nRC = GetViewByName( &CM_List, "TZCMWKSO", lpInterpSubtask, zLEVEL_APPLICATION );

      nRC = GetStringFromAttribute( szExecDir, zsizeof( szExecDir ), CM_List, "LPLR", "ExecDir" );

      ZeidonStringConcat( szExecDir, 1, 0, "\\TZVSXC01.POR", 1, 0, zMAX_FILESPEC_LTH + 1 );
      nRC = ActivateOI_FromFile( &vXChecker, "TZVSXCOO", lpAppSubtask, szExecDir, zSINGLE | zIGNORE_ATTRIB_ERRORS );
      if ( nRC != 0 )
         return( -1 );
   }

   nRC = SetCursorFirstEntityByInteger( vXChecker, "DialogOperation", "ZKey", lZKey, "APPLICATION" );
#if 0
   if ( nRC != zCURSOR_SET )
      return( -1 );
#else

   if ( nRC < zCURSOR_SET )
      nRC = SetCursorFirstEntityByInteger( vXChecker, "LOD_Operation", "ZKey", lZKey, "APPLICATION" );
   if ( nRC < zCURSOR_SET )
      nRC = SetCursorFirstEntityByInteger( vXChecker, "Operation", "ZKey", lZKey, "APPLICATION" );

   // why do this???
   if ( nRC < zCURSOR_SET )
      return( -1 );
#endif

   if ( nRC >= zCURSOR_SET )
   {
      nRC = SetAttributeFromInteger( vXChecker, "APPLICATION", "CurrentMode", zXC_SETUP_DEBUGGER );
      return( zXC_SETUP_DEBUGGER );
   }
   else
   {
      nRC = SetAttributeFromInteger( vXChecker, "APPLICATION", "CurrentMode", 1 );
      return( zXC_OPERATION_STAGED );
   }
}
示例#2
0
文件: tzvminaa.c 项目: DeegC/10d
zOPER_EXPORT zSHORT OPERATION
UpdateStackObjectFromViews( zVIEW  lpInterpSubtask,         // interp subtask
                            zVIEW  vXPG,                   // View to the XPG
                            zVIEW  vStmtView,        // View to the statement
                            zSHORT nIndex,       // index into the expression
                            zSHORT nStackOffset )      // index into the expression
{
   zSHORT nRC;                                          // a Return code
   zVIEW  vStackObject;                           // view to the stack object

   // Get the stack object as it was loaded with the XPG
   nRC =
      GetViewByName( &vStackObject,
                     "StackObject",
                     lpInterpSubtask,
                     zLEVEL_SUBTASK );
   if ( nRC != zLEVEL_SUBTASK )
   {
      return( -1 );
   }

   SfLockView( vXPG );
   SfLockView( vStmtView );

   // set the views
   nRC =
      SetAttributeFromInteger( vStackObject,
                               "OperationCall",
                               "XPGView",
                               (zLONG)vXPG );
   nRC =
      SetAttributeFromInteger( vStackObject,
                               "OperationCall",
                               "StackOffset",
                               nStackOffset );
   // set the views
   nRC =
      SetAttributeFromInteger( vStackObject,
                               "OperationCall",
                               "StatementView",
                               (zLONG)vStmtView );
   // set the offset
   nRC =
      SetAttributeFromInteger( vStackObject,
                               "OperationCall",
                               "StatementOffset",
                               nIndex );
   return( 0 );
}
示例#3
0
文件: tzadw4aw.c 项目: arksoftgit/10c
zOPER_EXPORT zSHORT OPERATION
ofnTZWDLGSO_AssignTag( zVIEW  vSubtask,
                       zVIEW  vDialog,
                       zVIEW  vControl,
                       zPCHAR szType )
{
   zVIEW vTmpDlg;
   zLONG lIdx;
   zSHORT nLth;
   zCHAR szTag[ 25 ];

   zstrcpy( szTag, szType );
   nLth = zstrlen( szTag );

   // Use a temp view for Dialog to make sure we are positioned on the
   // Window itself for getting ControlTagCounter and not on a subcontrol.
   CreateViewFromViewForTask( &vTmpDlg, vControl, 0 );
   ResetView( vTmpDlg );

   // Select next integer to make control tag unique.
   GetIntegerFromAttribute( &lIdx, vTmpDlg, "Window", "ControlTagCounter" );
   lIdx++;
   SetAttributeFromInteger( vTmpDlg, "Window", "ControlTagCounter", lIdx );
   zltoa( lIdx, &szTag[ nLth ] );
   DropView( vTmpDlg );

   SetAttributeFromString( vControl, "Control", "Tag", szTag );
   return( 0 );
}
示例#4
0
文件: tzerrord.c 项目: arksoftgit/10c
/////////////////////////////////////////////////////////////////////////////
//
//    OPERATION: zwTZERRORD_WriteErrorMsg
//
//
/////////////////////////////////////////////////////////////////////////////
zOPER_EXPORT zSHORT /*LOCAL */  OPERATION
zwTZERRORD_WriteErrorMsg( zVIEW  vSubtask,
                          zVIEW  vMetaView,
                          zPCHAR szMetaEntity,
                          zPCHAR szMetaAttribute,
                          zPCHAR szErrorMsg,
                          zSHORT nError )
{
   zVIEW  vTZERROR;
   zCHAR  szMsg[ 255 ];

   if ( GetViewByName( &vTZERROR, "TZERROR", vSubtask, zLEVEL_TASK ) < 0 )
   {
      zwTZERRORD_LoadErrorList( vSubtask );
      GetViewByName( &vTZERROR, "TZERROR", vSubtask, zLEVEL_TASK );
   }

   CreateEntity( vTZERROR, "ErrorMsg", zPOS_LAST );
   SetAttributeFromAttribute( vTZERROR, "ErrorMsg", "Name",
                              vMetaView, szMetaEntity, szMetaAttribute );

   if ( nError == 1 )
      zstrcpy( szMsg, "Error:   " );
   else
   if ( nError == 0 )
      zstrcpy( szMsg, "Warning:   " );

   zstrcat( szMsg, szErrorMsg );

   SetAttributeFromString( vTZERROR, "ErrorMsg", "ErrorText", szMsg );
   SetAttributeFromInteger( vTZERROR, "ErrorMsg", "Error", nError );
   return( 0 );

} // zwTZERRORD_WriteErrorMsg
示例#5
0
文件: tzadw4aw.c 项目: arksoftgit/10c
///////////////////////////////////////////////////////////////////////
//
// 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 );
}
示例#6
0
文件: tzadw4aw.c 项目: arksoftgit/10c
/////////////////////////////////////////////////////////////////////
//
// PURPOSE:  This routine paints selected fields in a list box
// or partition (all the fields are on one line) and paints the
// field literals above the listbox or partition.
//
/////////////////////////////////////////////////////////////////////
zOPER_EXPORT zSHORT OPERATION
ofnTZWDLGSO_AutoPaintListBox( zVIEW  vSubtask,
                              zVIEW  vUserSpec,
                              zVIEW  vNewDialog,
                              zPCHAR szListType )
{
   zLONG    lCC;
   zLONG    lCL;
   zSHORT   nRC;
   zLONG    lFieldRow;
   zLONG    lFieldCol;
   zLONG    lPartitionStartDLG_Y;
   zLONG    lPartitionStartDLG_X;
   zLONG    lPartitionSizeDLG_X;
   zLONG    lSubtype;
   zCHAR    szParentName[ 33 ];
   zLONG    lTempInteger_0;
   zSHORT   RESULT;
//BL   zLONG    lTempInteger_1;
   zCHAR    X_LOD_Attribute[ 16 ];

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

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

   lCL = 12;
   lCC = 5;
   zstrcpy( szParentName, "Window" );
   lTempInteger_0  = zstrcmp( szParentName, "SECTION" );
   /* If we are Autodesigning a ROD, set the lCL to 8 so line skips do
      not tak place. */
   if ( lTempInteger_0 == 0 )
   {
      lCL = 8;
   }
   else
   {
      lCL = 12;
   }

   // Set the Tag
   ofnTZWDLGSO_AssignTag( vSubtask, vNewDialog, vNewDialog, "ListBox" );
// SetAttributeFromAttribute( vNewDialog, "Control", "Tag",
//                            vUserSpec, "LOD_Entity", "Name" );

   /* Get the group's dimensions. */
   GetIntegerFromAttribute( &lPartitionStartDLG_Y, vNewDialog,
                            "Control", "PSDLG_Y" );
   GetIntegerFromAttribute( &lPartitionStartDLG_X, vNewDialog,
                            "Control", "PSDLG_X" );
   GetIntegerFromAttribute( &lPartitionSizeDLG_X, vNewDialog,
                            "Control", "SZDLG_X" );

   /* If the control is a group box not a listbox, then the output
      fields should be placed lower down then the listbox's output fields. */
   if ( CompareAttributeToString( vNewDialog, "ControlDef", "Tag",
                                  "ListBox" ) == 0 )
      lFieldRow = 2;
   else
      lFieldRow = 5;
   lFieldCol = 1;

   RESULT = SetCursorFirstEntity( vUserSpec, X_LOD_Attribute, "" );

   /* Paint the output fields into the listbox or partition. */
   nRC = ofnTZWDLGSO_AutoPaintListPart( vSubtask, vUserSpec, vNewDialog,
                                        lFieldRow, lFieldCol,
                                        lPartitionSizeDLG_X, szListType );

#if 0
   //* Eliminated 1999/04/23 for support of new listbox style.
   /* If the fields fit and there was no other problem, paint the lits. */
   if ( nRC > -1 )
   {
      /* The literals are going to be placed above the listbox
         or partition. */
      lFieldRow = lPartitionStartDLG_Y - nCL;
      lFieldCol = lPartitionStartDLG_X + nCC;

      RESULT = SetCursorFirstEntity( vUserSpec, X_LOD_Attribute, "" );

      /* Paint the literals above the listbox or partition. */
      lTempInteger_1 = zstrcmp( szParentName, "Window" );
      if ( lTempInteger_1 == 0 )
      {
         nRC = ofnTZWDLGSO_AutoPaintLstLitPart( vUserSpec, vNewDialog,
                                                lFieldRow, lFieldCol,
                                                lPartitionSizeDLG_X,
                                                szListType );
         if ( nRC == -1 )
            return( -1 );
      }
   }
   else
   {
      return( -1 );
   }
#endif

   // Set listbox to sort and disable first subcontrol.
   GetIntegerFromAttribute( &lSubtype, vNewDialog, "Control", "Subtype" );
   lSubtype |= zLISTBOX_SORTEDHEADERS;
   SetAttributeFromInteger( vNewDialog, "Control", "Subtype", lSubtype );
   SetCursorFirstEntity( vNewDialog, "CtrlCtrl", 0 );
   GetIntegerFromAttribute( &lSubtype, vNewDialog, "CtrlCtrl", "Subtype" );
   lSubtype |= zCONTROL_DISABLED;
   SetAttributeFromInteger( vNewDialog, "CtrlCtrl", "Subtype", lSubtype );

// TraceLineS("END", "AutoPaintListBox W4" );
   return( nRC );
}
示例#7
0
文件: tzadw4aw.c 项目: arksoftgit/10c
/////////////////////////////////////////////////////////////////////////////
//
// 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 );
}
示例#8
0
文件: tzadw4aw.c 项目: arksoftgit/10c
/////////////////////////////////////////////////////////////////////////////
//
// PURPOSE: This function places the paint literals of selected
// attributes above the fields in a partition or list box.
//
// vNewDialog - handle to the group
// OffsetDLG_Y - offset row to the group
// OffsetDLG_X - offset column to the group
// PartitionSize - length size of the group
//
// Return Codes:
//     0 - Everything is O.K. and the literals were placed into the
//         partition
//    -1 - The literal widths exceeded the partitions width
//
////////////////////////////////////////////////////////////////////
zOPER_EXPORT zSHORT OPERATION
ofnTZWDLGSO_AutoPaintLstLitPart( zVIEW    vSubtask,
                                 zVIEW    vUserSpec,
                                 zVIEW    vNewDialog,
                                 zLONG    OffsetDLG_Y,
                                 zLONG    OffsetDLG_X,
                                 zLONG    PartitionSize,
                                 zPCHAR   szListType )
{
   zVIEW    vCtrlDef;
   zLONG    lCC;
   zLONG    lCL;
   zLONG    lFieldCol;
   zLONG    lListAttributeLength;
   zLONG    lPaintLiteralLength;
   zCHAR    sPaintLiteral[ 65 ];
   zSHORT   RESULT;
   zLONG    lTempInteger_1;
   zLONG    lTempInteger_2;
   zCHAR    X_LOD_Attribute[ 16 ];
   zCHAR    X_ER_Attribute[ 15 ];

// TraceLineS("IN", "AutoPaintLstListPart 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_ER_Attribute, "I_ER_Attribute" );
   }
   else
   {
      zstrcpy( X_LOD_Attribute, "L_LOD_Attribute" );
      zstrcpy( X_ER_Attribute, "L_ER_Attribute" );
   }

   lCC = 5;
   lCL = 12;

   GetViewByName( &vCtrlDef, "TZADCTLD", vNewDialog, zLEVEL_TASK );

   lFieldCol = 1;

   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 );

      lListAttributeLength = lListAttributeLength * lCC;
      /* Limit the size of the attribute length. */
      if ( lListAttributeLength > 100 )
         lListAttributeLength = 100;
      if ( lListAttributeLength < 25 )
         lListAttributeLength = 25;

      /* Get the paint literal */
      GetStringFromAttribute( sPaintLiteral, vUserSpec,
                               X_ER_Attribute, "ListPaintLit" );
      if ( sPaintLiteral[ 0 ] == 0 )
         GetStringFromAttribute( sPaintLiteral, vUserSpec,
                                 X_ER_Attribute, "PromptPaintLit" );
      if ( sPaintLiteral[ 0 ] == 0 )
      {
         GetStringFromAttribute( sPaintLiteral, vUserSpec,
                                  X_ER_Attribute, "Name" );
         /* Add a ':' to the end. */
         zstrcat( sPaintLiteral, ":" );
         /* Add spaces before any capital letters. */
         AddSpacesToString( sPaintLiteral );
      }

      lPaintLiteralLength = zstrlen( sPaintLiteral );
      lPaintLiteralLength = lPaintLiteralLength * lCC;
      /* Limit the size of the literal length. */
      if ( lPaintLiteralLength > 100 )
         lPaintLiteralLength = 100;
      if ( lPaintLiteralLength < 25 )
         lPaintLiteralLength = 25;

      /*
      lTempInteger_1 = CheckForOverlappingFields( vNewDialog, OffsetDLG_Y,
                                                   OffsetDLG_Y + nCL,
                                                   lFieldCol + OffsetDLG_X - lCC, lFieldCol + OffsetDLG_X + lPaintLiteralLength - lCC );
      */

      lTempInteger_1 = 0;
      /* Check to see IF there is a field or group located above
         the listbox that would be in the way of painting the literals */
      if ( lTempInteger_1 == -1 )
      {
         /* Cannot place text fields above the listbox because of
            either a field or a group */
         /* InformationMessage( "Field literals can't fit because of FIELD or GROUP" ); */
         MessageSend( vUserSpec, "AD10301", "Autodesigner",
                      "Field literals can't fit because of FIELD or GROUP",
                      zMSGQ_OBJECT_CONSTRAINT_ERROR, zBEEP );
         return( -1 );
      }

      /* Add the listbox literals at the end of the client fields.
         This makes a difference in fnCompressWindow in autodesigning.*/
      SetCursorLastEntity( vNewDialog, "Control", "" );

      /* Do not continue to add fields into the list box if
         the field sizes exceed the size of the list box */
      /* 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 RETURN */
         if ( lFieldCol + lListAttributeLength > PartitionSize )
         {
            return( 1 );
         }
      }
      else
      {
         /* If the length of lFieldCol is greater than the
            partition size, then RETURN */
         if ( lFieldCol + lPaintLiteralLength > PartitionSize )
         {
            return( 1 );
         }
      }

      /* Create literals for the list box */
      CreateMetaEntity( vSubtask, vNewDialog, "Control", zPOS_AFTER );
      SetCursorFirstEntityByString( vCtrlDef, "ControlDef", "Tag", "Text", "" );
      IncludeSubobjectFromSubobject( vNewDialog, "ControlDef",
                                     vCtrlDef, "ControlDef", zPOS_AFTER );

      /* Remove the text border. */
      SetAttributeFromInteger( vNewDialog, "Control", "Subtype",
                               zCONTROL_BORDEROFF | zCONTROL_NOTABSTOP );
      SetAttributeFromInteger( vNewDialog, "Control",
                               "PSDLG_Y", OffsetDLG_Y );
      lTempInteger_2 = OffsetDLG_X + lFieldCol - lCC;
      SetAttributeFromInteger( vNewDialog, "Control",
                               "PSDLG_X", lTempInteger_2 );
      SetAttributeFromInteger( vNewDialog, "Control",
                               "SZDLG_X", lPaintLiteralLength );
      SetAttributeFromInteger( vNewDialog, "Control",
                               "SZDLG_Y", 10 );

      ofnTZWDLGSO_AssignTag( vSubtask, vNewDialog, vNewDialog, "ListText" );
      SetAttributeFromString( vNewDialog, "Control",
                              "Text", sPaintLiteral );

      /* 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, "" );
   }
// TraceLineS("END", "AutoPaintLstListPart W4" );

   return( 0 );
}
示例#9
0
文件: tzsixsko.c 项目: arksoftgit/10c
/////////////////////////////////////////////////////////////////////////////
//
// OPERATION: zofnTZSIXSKO_BldXSKChildEnt
//
// PURPOSE:
//
// TRIGGLODED BY:
//    WINDOW: TZZOLODD
//    ACTION: OPTION
//    NAME: File_Save
//
/////////////////////////////////////////////////////////////////////////////
zOPER_EXPORT zSHORT OPERATION
zofnTZSIXSKO_BldXSKChildEnt ( zVIEW vKZSIXSKO_Root,
                              zVIEW vKZSIXSKO, zVIEW vTZZOXOD1,
                              zVIEW vTZTENVRO_REF,
                              zSHORT nEntityFlag )
{
   zVIEW  vTZTENVRO_Parent;
   zSHORT nRC;
   zSHORT nRC2;
   zPCHAR szDBMS;
   zSHORT nEntImpls;
   zLONG  lEntityZKey;
   zSHORT nEntitySet    = nEntityFlag;
   zSHORT nSetViewToSubXsk = 0;

   nRC = CreateViewFromViewForTask( &vTZTENVRO_Parent, vTZTENVRO_REF, 0 );

   nRC = zCURSOR_SET;
   while ( nRC >= zCURSOR_SET )
   {
      nRC = SetViewToSubobject( vTZZOXOD1, "CHILDENTITY" );

      /* Check physik, if no, then do not process this entity */
      if ( (nRC = CheckExistenceOfEntity ( vTZZOXOD1, "DATARECORD" )) >= zCURSOR_SET )
      {

         nRC = GetIntegerFromAttribute( &lEntityZKey, vTZZOXOD1,
                                        "ENTITY", "ERENT_TOK" );
         nRC = SetCursorFirstEntityByInteger( vTZTENVRO_Parent, "ER_Entity",
                                              "ZKey", lEntityZKey,
                                              "TE_DBMS_Source" );
         if ( nRC < zCURSOR_SET )
         {
            GetAddrForAttribute( &szDBMS,
                                 vTZTENVRO_Parent, "TE_DBMS_Source", "DBMS" );
            nEntImpls = 0;
            for ( nRC = SetCursorFirstEntityByInteger( vTZTENVRO_Parent, "ER_Entity",
                                                "ZKey", lEntityZKey,
                                                "TE_DB_Environ" );
                  nRC > zCURSOR_UNCHANGED;
                  nRC = SetCursorNextEntityByInteger( vTZTENVRO_Parent, "ER_Entity",
                                                "ZKey", lEntityZKey,
                                                "TE_DB_Environ" ) )
            {
               if ( CompareAttributeToString( vTZTENVRO_Parent, "TE_DBMS_Source", "DBMS",
                               szDBMS ) == 0 )
               {
                  nEntImpls++;
               }
            }
            if ( nEntImpls == 1 )
            {
               nRC = zCURSOR_SET;
            }
            else
            if ( nEntImpls > 1 )
            {
              for ( nRC = SetCursorFirstEntityByInteger( vTZTENVRO_Parent, "ER_Entity",
                                                  "ZKey", lEntityZKey,
                                                  "TE_DB_Environ" );
                    nRC > zCURSOR_UNCHANGED;
                    nRC = SetCursorNextEntityByInteger( vTZTENVRO_Parent, "ER_Entity",
                                                  "ZKey", lEntityZKey,
                                                  "TE_DB_Environ" ) )
              {
                 if ( CompareAttributeToString( vTZTENVRO_Parent, "TE_DBMS_Source", "DBMS",
                                szDBMS ) == 0 )
                 {
                    zstrcpy( szMsg, "Do you want to use Data Source '" );
                    GetAddrForAttribute( &szMsgName,
                                         vTZTENVRO_Parent, "TE_DBMS_Source", "Name" );
                    zstrcat( szMsg, szMsgName );
                    zstrcat( szMsg, "' to implement ER Entity '" );
                    GetAddrForAttribute( &szMsgName,
                                         vTZTENVRO_Parent, "ER_Entity", "Name" );
                    zstrcat( szMsg, szMsgName );
                    zstrcat( szMsg, "'?" );
                    nRC = MessagePrompt ( vTZTENVRO_Parent, "XOD_06", "TE Choice",
                                          szMsg, 0, zBUTTONS_YESNO, 0, 0 );
                    if ( nRC == zRESPONSE_YES )
                        break;   // found Entity implemented in same DBMS
                 }
              }
            }

            if ( nRC < zCURSOR_SET )
            {
               zstrcpy( szMsg, "Unable to Find Entity in TE Data Source with same DBMS.\n\nEntity Name = " );
               GetAddrForAttribute( &szMsgName, vTZZOXOD1, "ER_EntityRec", "Name" );
               zstrcat( szMsg, szMsgName );
               nRC = MessagePrompt( vTZZOXOD1, "XOD_06", "Internal LOD Error", szMsg, 0,
                                    zBUTTONS_OK, 0, 0 );
               nRC = DropView( vTZTENVRO_Parent );
               return( 0 );
            }
         }

         //  new Entity found
         //  if SironGroup exists
         //     if SironKatalog exists
         //        create new Katalog
         //     create next ENTITY and ENTITYCOM entities
         //     create dependent ATTRIB and ATTRICOM entities
         nRC = CheckExistenceOfEntity ( vTZTENVRO_Parent, "SironGroup" );
         if ( nRC >= zCURSOR_SET )
         {
          nRC = CheckExistenceOfEntity ( vTZTENVRO_Parent, "SironKatalog" );
          if ( nRC >= zCURSOR_SET )
          {
            // Go back to KATALOG entity
            if ( nEntitySet )
            {
              while ( ResetViewFromSubobject( vKZSIXSKO_Root ) == 0 );
            }

            // Create new  KATALOG entity
            nRC = SetCursorLastEntity ( vKZSIXSKO_Root, "KATALOG", "" );
            nRC = CreateEntity ( vKZSIXSKO_Root, "KATALOG", zPOS_AFTER );
            SetMatchingAttributesByName(vKZSIXSKO_Root, "KATALOG",
                                        vTZTENVRO_Parent, "SironKatalog", zSET_ALL );

            for ( nRC = SetCursorFirstEntity( vTZTENVRO_Parent,
                                            "KatalogComment", "SironKatalog");
                  nRC > zCURSOR_UNCHANGED;
                  nRC = SetCursorNextEntity( vTZTENVRO_Parent,
                                             "KatalogComment", "SironKatalog") )
            {
              CreateEntity ( vKZSIXSKO_Root, "KATCOM", zPOS_AFTER );
              SetMatchingAttributesByName( vKZSIXSKO_Root, "KATCOM",
                                           vTZTENVRO_Parent, "KatalogComment", zSET_ALL );
            }
          }

          // ViewToSubobject only, if caller created an ENTITY entity
          if ( nEntitySet )
          {
            if ( CheckExistenceOfEntity( vKZSIXSKO_Root, "ENTITY" )
                                                             >= zCURSOR_SET )
            {
               SetViewToSubobject( vKZSIXSKO_Root, "ENTITYCHILD" );
               nSetViewToSubXsk = 1;
            }
          }

          // Create next ENTITY entity
          nRC = SetCursorLastEntity ( vKZSIXSKO_Root, "ENTITY", "" );
          nRC = CreateEntity ( vKZSIXSKO_Root, "ENTITY", zPOS_AFTER );
          nEntitySet = 1;
          SetMatchingAttributesByName(vKZSIXSKO_Root, "ENTITY",
                                      vTZTENVRO_Parent, "SironGroup", zSET_ALL );
          SetAttributeFromInteger( vKZSIXSKO_Root, "ENTITY", "ERENT_TOK",
                                   lEntityZKey );

          for ( nRC = SetCursorFirstEntity( vTZTENVRO_Parent, "GroupComment", "SironGroup");
                nRC > zCURSOR_UNCHANGED;
                nRC = SetCursorNextEntity( vTZTENVRO_Parent, "GroupComment", "SironGroup") )
          {
            CreateEntity ( vKZSIXSKO_Root, "ENTITYCOM", zPOS_AFTER );
            SetMatchingAttributesByName( vKZSIXSKO_Root, "ENTITYCOM",
                                         vTZTENVRO_Parent, "GroupComment", zSET_ALL );
          }

          // Create all dependent ATTRIB entities according to XOD ATTRIB
          // entities
          for ( nRC  = SetCursorFirstEntity( vTZZOXOD1, "ATTRIB", "ENTITY");
                nRC  > zCURSOR_UNCHANGED;
                nRC  = SetCursorNextEntity( vTZZOXOD1, "ATTRIB", "ENTITY") )
          {
             nRC = SetCursorFirstEntityByAttr( vTZTENVRO_Parent,
                                               "TE_FieldDataRel","Name",
                                               vTZZOXOD1, "ATTRIB", "NAME",
                                               "TE_TablRec");

             nRC = CheckExistenceOfEntity( vTZTENVRO_Parent, "SironField" );
             if ( nRC < zCURSOR_SET )
             {
               zstrcpy( szMsg,
       "Unable to Find SironField in TE Data Source .\n\nAttribute Name = " );
               GetAddrForAttribute( &szMsgName, vTZZOXOD1, "ATTRIB", "NAME" );
               zstrcat( szMsg, szMsgName );
               nRC = MessagePrompt ( vTZZOXOD1, "XOD_06",
                                     "Internal XOD Error", szMsg,
                                     0, zBUTTONS_OK, 0, 0 );
               nRC = DropView( vTZTENVRO_Parent );
               return( 0 );
             }

             CreateEntity( vKZSIXSKO_Root, "ATTRIB", zPOS_AFTER );
             SetMatchingAttributesByName( vKZSIXSKO_Root, "ATTRIB",
                                          vTZTENVRO_Parent, "SironField", zSET_ALL );
             SetAttributeFromAttribute( vKZSIXSKO_Root, "ATTRIB", "XVAATT_TOK",
                                        vTZZOXOD1,      "ATTRIB", "XVAATT_TOK" );

             // Create all dependent ATTRIBCOM entities
             for ( nRC = SetCursorFirstEntity( vTZTENVRO_Parent,
                                               "SironFieldComment","SironField");
                   nRC > zCURSOR_UNCHANGED;
                   nRC = SetCursorNextEntity( vTZTENVRO_Parent,
                                              "SironFieldComment","SironField"))
             {
               CreateEntity ( vKZSIXSKO_Root, "ATTRIBCOM", zPOS_AFTER );
               SetMatchingAttributesByName( vKZSIXSKO_Root, "ATTRIBCOM",
                                            vTZTENVRO_Parent, "SironFieldComment",
                                            zSET_ALL );
             }
          }
        }
      }

      // Abstieg des Pfades
      nRC = CheckExistenceOfEntity( vTZZOXOD1, "CHILDENTITY" );
      if ( nRC >= zCURSOR_SET )
              zofnTZSIXSKO_BldXSKChildEnt( vKZSIXSKO_Root, vKZSIXSKO,
                   vTZZOXOD1, vTZTENVRO_Parent, nEntitySet );

      nRC2 = ResetViewFromSubobject( vTZZOXOD1 );
      if ( nSetViewToSubXsk )
      {
        nRC2 = ResetViewFromSubobject( vKZSIXSKO_Root );
        nSetViewToSubXsk = 0;
      }

      nRC  = SetCursorNextEntity( vTZZOXOD1, "CHILDENTITY", "" );
   }

   if ( vTZTENVRO_Parent )
      nRC = DropView( vTZTENVRO_Parent );

   return( 0 );
}
示例#10
0
/////////////////////////////////////////////////////////////////////////////
//
// ENTRY:
//
// PURPOSE:    Create a HK if one doesn't exist for current LPLR.
//
/////////////////////////////////////////////////////////////////////////////
zOPER_EXPORT zSHORT OPERATION
zwTZHKEYAD_InitHK_ForLPLR( zVIEW vSubtask )
{
   zVIEW vCM_List;
   zVIEW vKZHKEYSO;
   zVIEW vTaskLPLR;
   zCHAR  szFileSpec[ zMAX_FILESPEC_LTH + 1 ];
// zSHORT nRC;

   RetrieveViewForMetaList( vSubtask, &vCM_List, zREFER_GO_META );
   SetNameForView( vCM_List, "CM_List", vSubtask, zLEVEL_TASK );
#if 0
   // Get File list of Presentation Environments (only one).
   nRC = RetrieveViewForMetaList( vSubtask, &vCM_List, zREFER_HKEY_META );

   // Always have a Named List of PPE's (even though there can only be One)!
   // This is done to be consistent with other dialogs.  The only time the
   // that the named List will not exist is during a SwithLPLR.
   // This fact is used a "flag" to the ReturnFromSubWnd logic.
   nRC = SetNameForView( vCM_List, "CM_HK_List", vSubtask, zLEVEL_TASK );

   // See if one exists.
   nRC = SetCursorFirstEntity( vCM_List, "W_MetaDef", "" );

   // If not, create one, else open it.
   if ( nRC == zCURSOR_NULL )
   {
   // oTZPESRCO_GrayOptions( vSubtask );
   }
   else
   {
      nRC = ActivateMetaOI( vSubtask, &vKZHKEYSO, vCM_List, zREFER_HKEY_META, zSINGLE );
      SetNameForView( vKZHKEYSO, "TZPESRCV", vSubtask, zLEVEL_TASK );
      CreateViewFromViewForTask( &vCtrlList, vKZHKEYSO, 0 );
      SetNameForView( vCtrlList, "TZPECTRL", vSubtask, zLEVEL_TASK );
      SetAttributeFromInteger( vKZHKEYSO, "ApplHKyDef", "CtrlFontDel", 0 );
   }
#endif

   // Get the directory.
   GetViewByName( &vTaskLPLR, "TaskLPLR", vSubtask, zLEVEL_TASK );
   if ( vTaskLPLR == 0 )
   {
      MessageSend( vSubtask, "HK00101", "Hot Keys",
                   "Can't locate LPLR?",
                   zMSGQ_OBJECT_CONSTRAINT_ERROR, zBEEP );
      return( 0 );
   }

   GetStringFromAttribute( szFileSpec, vTaskLPLR, "LPLR", "MetaSrcDir" );
   zstrcat( szFileSpec, "\\ZEIDON.PHK" );
   TraceLineS( "Hotkey Dialog opening file: ", szFileSpec );

   // Load the HKEY object.
   if ( ActivateOI_FromFile( &vKZHKEYSO, "KZHKEYSO", vSubtask, szFileSpec,
            zIGNORE_ERRORS | zSINGLE | zLEVEL_APPLICATION | zNOI_OKAY ) < 0 )
   {
      CreateEntity( vKZHKEYSO, "Application", zPOS_AFTER );
      CommitOI_ToFile( vKZHKEYSO, szFileSpec, zASCII );
   }

   SetNameForView( vKZHKEYSO, "KZHKEYSO", vSubtask, zLEVEL_TASK );
   return( 0 );
}
示例#11
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 );
}
示例#12
0
文件: tzadwexp.c 项目: arksoftgit/10c
/*************************************************************************************************
**
**    OPERATION: SetRptShapeFromBlob
**
*************************************************************************************************/
zOPER_EXPORT zLONG /*GLOBAL */  OPERATION
SetRptShapeFromBlob( zVIEW vReportDef )
{

   zCHAR   szBlob[ 8 + (6 * sizeof( zLONG )) ];
// zVIEW   vReport;
// zLONG   lSubtype;
   zULONG  ulPenColor = 0xFF000000;
   zULONG  ulShapeColor = 0xFF000000;
   zULONG  ulLth = sizeof( szBlob );

   zmemset( szBlob, 0, ulLth );
   GetBlobFromAttribute( szBlob, &ulLth, vReportDef, "Control", "CtrlBOI" );
// TraceLineI( "Shape control blob lth = ", ulLth );
   if ( ulLth == sizeof( szBlob ) ||
        ulLth == sizeof( szBlob ) - (1 * sizeof( zLONG )) || // remove this soon
        ulLth == sizeof( szBlob ) - (2 * sizeof( zLONG )) )
   {
      zLONG   lPenWidth;
      zLONG   lPenType;
      zLONG   lRoundValue;
      zLONG   lFlags = 0;

      if ( szBlob[ 4 ] == TRUE )
      {
         TraceLineI( "****   Horizontal Line    **** ", szBlob[ 4 ] );
         SetAttributeFromInteger( vReportDef, "Control", "BorderBottom", szBlob[ 4 ] );
      }

/*
      SetCtrlState( vSubtask, "Rectangle", zCONTROL_STATUS_CHECKED,
                    szBlob[ 0 ] ? TRUE : FALSE );
      SetCtrlState( vSubtask, "RoundRect", zCONTROL_STATUS_CHECKED,
                    szBlob[ 1 ] ? TRUE : FALSE );
      SetCtrlState( vSubtask, "Ellipse", zCONTROL_STATUS_CHECKED,
                    szBlob[ 2 ] ? TRUE : FALSE );
      SetCtrlState( vSubtask, "Diamond", zCONTROL_STATUS_CHECKED,
                    szBlob[ 3 ] ? TRUE : FALSE );
      SetCtrlState( vSubtask, "HorizontalLine", zCONTROL_STATUS_CHECKED,
                    szBlob[ 4 ] ? TRUE : FALSE );
      SetCtrlState( vSubtask, "VerticalLine", zCONTROL_STATUS_CHECKED,
                    szBlob[ 5 ] ? TRUE : FALSE );
      SetCtrlState( vSubtask, "DiagonalDescend", zCONTROL_STATUS_CHECKED,
                    szBlob[ 6 ] ? TRUE : FALSE );
      SetCtrlState( vSubtask, "DiagonalAscend", zCONTROL_STATUS_CHECKED,
                    szBlob[ 7 ] ? TRUE : FALSE );
*/

      lPenWidth = *((zPLONG) (szBlob + 8));
      lPenType = *((zPLONG) (szBlob + 8 + sizeof( zLONG )));
      ulPenColor = *((zPLONG) (szBlob + 8 + (2 * sizeof( zLONG ))));
      lRoundValue = *((zPLONG) (szBlob + 8 + (3 * sizeof( zLONG ))));
      if ( ulLth == sizeof( szBlob ) )
      {
         ulShapeColor = *((zPULONG) (szBlob + 8 + (4 * sizeof( zLONG ))));
         lFlags = *((zPLONG) (szBlob + 8 + (5 * sizeof( zLONG ))));
      }

      zltoa( ulPenColor, szBlob );
      SetAttributeFromString( vReportDef, "Control", "wLineColorText", szBlob );
      SetAttributeFromInteger( vReportDef, "Control", "wLineColorInt", ulPenColor );
      SetAttributeFromInteger( vReportDef, "Control", "BorderWidth", lPenWidth );
      switch ( lPenType )
      {
         case 1:
            SetAttributeFromInteger( vReportDef, "Control", "BorderStyle", 1 );
            break;

         case 2:
            SetAttributeFromInteger( vReportDef, "Control", "BorderStyle", 2 );
            break;

         case 3:
            SetAttributeFromInteger( vReportDef, "Control", "BorderStyle", 3 );
            break;

         case 4:
            SetAttributeFromInteger( vReportDef, "Control", "BorderStyle", 4 );
            break;

         default:
            SetAttributeFromInteger( vReportDef, "Control", "BorderStyle", 0 );
            break;
      }


      zltoa( lRoundValue, szBlob );
      //SetCtrlText( vSubtask, "RoundValue", szBlob );
   }
   else
   {
      //SetCtrlState( vSubtask, "Rectangle", zCONTROL_STATUS_CHECKED, TRUE );
      //SetCtrlText( vSubtask, "PenWidth", "1" );
   }

   /*
   SetCtrlProperty( vSubtask, "__ColorLine",
                    zCONTROL_PROPERTY_INTEGER_DATA,
                    ulPenColor, 0 );
   SetCtrlProperty( vSubtask, "__ColorShape",
                    zCONTROL_PROPERTY_INTEGER_DATA,
                    ulShapeColor, 0 );
   */

   return( 0 );
} // SetRptShapeFromBlob
示例#13
0
文件: tzvminaa.c 项目: DeegC/10d
//
// OPERATION: SetStackObjectFromViews
//
// DESCRIPTION: SetStackObjectFromViews creates an operation entity in the
//    Stack call object an copies all of the variable data thers as well.
//
//
//
zOPER_EXPORT zSHORT OPERATION
SetStackObjectFromViews( zVIEW  lpInterpSubtask,            // interp subtask
                         zVIEW  vXPG,                      // View to the XPG
                         zVIEW  vStmtView,           // View to the statement
                         zSHORT nIndex )         // index into the expression
{
   zSHORT nRC;                                          // a Return code
   //zSHORT nPrevOperation;                                       // a ret code
   zVIEW  vStackObject;                           // view to the stack object
   //zVIEW  vPriorOperation; // view to the prior operation in the stack object

   // Get the stack object as it was loaded with the XPG
   nRC =
      GetViewByName( &vStackObject,
                     "StackObject",
                     lpInterpSubtask,
                     zLEVEL_SUBTASK );
   if ( nRC != zLEVEL_SUBTASK )
   {
      return( -1 );
   }

   SfLockView( vXPG );
   SfLockView( vStmtView );

// DGC 8/19/02
// vPriorOperation doesn't appear to be used outside of this function, so
// I'm removing the code.
#if 0
   nRC =
      CreateViewFromViewForTask( &vPriorOperation,
                          vStackObject, 0 );


   nPrevOperation =
      SetCursorPrevEntity( vPriorOperation,
                           "OperationCall", "" );
#endif

   if ( SetCursorFirstEntityByAttr( vStackObject, "OperationCall", "Name",
                                    vXPG, "Operation", "Name", 0 ) < zCURSOR_SET )
   {
      // create an operation entity at the end of the list ( stack )
      CreateEntity( vStackObject, "OperationCall", zPOS_AFTER );


      // set the name of the operation that was called.
      SetAttributeFromAttribute( vStackObject, "OperationCall", "Name",
                                 vXPG, "Operation", "Name" );
   }

   // set the views
   SetAttributeFromInteger( vStackObject, "OperationCall", "XPGView",
                            (zLONG) vXPG );

   // set the views
   SetAttributeFromInteger( vStackObject, "OperationCall", "StatementView",
                            (zLONG) vStmtView );
   // set the offset
   SetAttributeFromInteger( vStackObject, "OperationCall", "StatementOffset",
                            nIndex );

   // now loop through and do all of the variables
   for ( nRC = SetCursorFirstEntity( vXPG, "Variable", "" );
         nRC >= zCURSOR_SET;
         nRC = SetCursorNextEntity( vXPG, "Variable", "" ) )
   {
      // Check to see if the variable already exists in the stack object.  It
      // will exist if the interpreter is being called from a different app
      // (like Core) and the app has set up the arguments already.
      if ( SetCursorFirstEntityByAttr( vStackObject, "Variable", "Name",
                                       vXPG, "Variable", "Name", 0 ) < zCURSOR_SET )
      {
         CreateEntity( vStackObject, "Variable", zPOS_LAST );
      }

      SetMatchingAttributesByName( vStackObject, "Variable",
                                   vXPG, "Variable", zSET_NULL );
   }

   SetCursorFirstEntity( vStackObject, "Variable", "" );
   SetCursorFirstEntity( vXPG, "Variable", "" );

// DropView( vPriorOperation );
   return( 0 );
}
示例#14
0
文件: tzvminaa.c 项目: DeegC/10d
zOPER_EXPORT zLONG OPERATION
GetExecMode( zVIEW  lpInterpSubtask,
             zVIEW  lpAppSubtask,
             zPCHAR szSrcDLLName,
             zPCHAR szOperationName,
             zPCHAR szMetaType )
{
   zVIEW  vXChecker;
   zVIEW  CM_List;
   zCHAR  szExecDir[ zMAX_FILESPEC_LTH + 1 ];
   zCHAR  szScopeMeta[ 33 ];
   zCHAR  szSourceFileMeta1[ 33 ];
   zCHAR  szSourceFileMeta2[ 33 ];
   zCHAR  szOperationMeta[ 33 ];
   zSHORT nRC;

   if ( !szMetaType || !*szMetaType )
      return( -1 );

   nRC = GetViewByName( &vXChecker, "TZVSXCOO",
                             lpInterpSubtask, zLEVEL_APPLICATION );

   if ( nRC != zLEVEL_APPLICATION )
   {
      GetViewByName( &CM_List, "TZCMWKSO", lpInterpSubtask, zLEVEL_APPLICATION );

      // If CM_List is 0 then we must have been called from Core at runtime.
      // In this case all operations are run natively so don't bother checking
      // the exec mode.
      if ( CM_List == 0 )
         return( -1 );

      GetStringFromAttribute( szExecDir, zsizeof( szExecDir ), CM_List, "LPLR", "ExecDir" );
      ZeidonStringConcat( szExecDir, 1, 0, "\\TZVSXC01.POR", 1, 0, zMAX_FILESPEC_LTH+1 );
      nRC = ActivateOI_FromFile( &vXChecker, "TZVSXCOO",
                                 lpAppSubtask, szExecDir,
                                 zSINGLE | zIGNORE_ATTRIB_ERRORS );
      if ( nRC != 0 )
         return( -1 );
   }

   // set up the Operation Meta Name
   if ( zstrcmp( szMetaType, "Dialog" ) == 0 )
   {
      strcpy_s( szSourceFileMeta1, zsizeof( szSourceFileMeta1 ), "DialogSourceFile" );
      strcpy_s( szSourceFileMeta2, zsizeof( szSourceFileMeta2 ), "Dialog" );
      strcpy_s( szOperationMeta, zsizeof( szOperationMeta ), "DialogOperation" );
      strcpy_s( szScopeMeta, zsizeof( szScopeMeta), "Dialogs" );
   }
   else
   if ( zstrcmp( szMetaType, "LOD" ) == 0 )
   {
      strcpy_s( szSourceFileMeta1, zsizeof( szSourceFileMeta1 ), "LODSourceFile" );
      strcpy_s( szSourceFileMeta2, zsizeof( szSourceFileMeta2 ), "LOD" );
      strcpy_s( szOperationMeta, zsizeof( szOperationMeta ), "LOD_Operation" );
      strcpy_s( szScopeMeta, zsizeof( szScopeMeta), "LODs" );
   }
   else
   {
      strcpy_s( szSourceFileMeta1, zsizeof( szSourceFileMeta1 ), "GlobalSourceFile" );
      strcpy_s( szSourceFileMeta2, zsizeof( szSourceFileMeta2 ), "GlobalOperation" );
      strcpy_s( szOperationMeta, zsizeof( szOperationMeta ), "Operation" );
      strcpy_s( szScopeMeta, zsizeof( szScopeMeta), "GlobalOperations" );
   }

   nRC = SetCursorFirstEntityByString( vXChecker, szSourceFileMeta1,
                                       "Name", szSrcDLLName, szScopeMeta );
#if 0
   if ( nRC < zCURSOR_SET )
   {
      nRC = SetCursorFirstEntityByString( vXChecker, szSourceFileMeta2,
                                          "Name", szSrcDLLName, szScopeMeta );
      if ( nRC == zCURSOR_SET )
      {
         nRC = SetAttributeFromInteger( vXChecker, "APPLICATION", "CurrentMode", 1 );
         return( zXC_OPERATION_STAGED );
      }
      else
         return( -1 );
   }
#endif

   if ( nRC < zCURSOR_SET )
      return( -1 );

   nRC = SetCursorFirstEntityByString( vXChecker, szOperationMeta, "Name", szOperationName, "" );

   if ( nRC >= zCURSOR_SET )
   {
      nRC = SetAttributeFromInteger( vXChecker, "APPLICATION", "CurrentMode", zXC_SETUP_DEBUGGER );
      return( zXC_SETUP_DEBUGGER );
   }
   else
   {
      nRC = SetAttributeFromInteger( vXChecker, "APPLICATION", "CurrentMode", 1 );
      return( zXC_OPERATION_STAGED );
   }
}
示例#15
0
文件: tzadw3aw.c 项目: DeegC/10d
/////////////////////////////////////////////////////////////////////////////
//
// ENTRY:   CreateListBox
//
// PURPOSE: This function creates a listbox with the given
//          specifications and then autodesigns this listbox with
//          the LISTATTRIB attributes for the listbox's entity.
//          In addition to auto designing the listbox's fields, any
//          actions defined for the listbox(in the style object)
//          get autodesigned.
//
/////////////////////////////////////////////////////////////////////////////
zOPER_EXPORT zSHORT OPERATION
ofnTZWDLGSO_CreateListBox( zVIEW    vSubtask,
                           zVIEW    vNewDialog,
                           zVIEW    vUserSpec,
                           zLONG    lStart_X,
                           zLONG    lStart_Y,
                           zLONG    lHeight,
                           zPCHAR   szListType )
{
   zVIEW    vCtrlDef;
   zVIEW    vTZPNCTWO;
   zLONG    lTotalLth;
   zLONG    lAttribLth;
   zLONG    lPaintLth;
   zLONG    lCC;
   zLONG    lCL;
   zSHORT   RESULT;
   zCHAR    szPaintStr[ 50 ];
   zCHAR    X_LOD_Attribute[ 16 ];
   zCHAR    X_ER_Attribute[ 15 ];

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

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

   lCC = 5;
   lCL = 12;
   GetViewByName( &vCtrlDef, "TZADCTLD", vNewDialog, zLEVEL_TASK );

// TraceLineS("IN", "CreateListBox W3" );
   /* Create the listbox. */
   CreateMetaEntity( vSubtask, vNewDialog, "Control", zPOS_AFTER );

   SetCursorFirstEntityByString( vCtrlDef, "ControlDef", "Tag", "ListBox", "" );
   IncludeSubobjectFromSubobject( vNewDialog, "ControlDef",
                                  vCtrlDef, "ControlDef", zPOS_AFTER );
   SetAttributeFromInteger( vNewDialog, "Control", "PSDLG_X", lStart_X );
   SetAttributeFromInteger( vNewDialog, "Control", "PSDLG_Y", lStart_Y );

   // We must set the CtrlBOI.
   ActivateEmptyObjectInstance( &vTZPNCTWO, "TZPNCTWO",
                                vUserSpec, zSINGLE );
   CreateEntity( vTZPNCTWO, "TZPNCTWO", zPOS_AFTER );
   CreateEntity( vTZPNCTWO, "ListBox", zPOS_AFTER );
   SetAttributeFromInteger( vTZPNCTWO, "ListBox", "Subtype", 8192 );

   // Set Control.CtrlBOI from work entity GroupBox
   SetBlobFromEntityAttributes( vNewDialog, "Control",
                                 "CtrlBOI", vTZPNCTWO, "ListBox" );
   DropView( vTZPNCTWO );

   // Set the control subtype to 0(Single).
   SetAttributeFromInteger( vNewDialog, "Control", "Subtype", 8192 );

   lTotalLth = 0;

   if ( CheckExistenceOfEntity ( vUserSpec, X_LOD_Attribute ) != 0 )
      lTotalLth = 5;

   // Loop through the L_LOD_Attribute and find the total width needed
   // for this listbox.
   RESULT = SetCursorFirstEntity( vUserSpec, X_LOD_Attribute, "" );
   while ( RESULT > zCURSOR_UNCHANGED )
   {
      lAttribLth = ofnTZWDLGSO_GetSizeForListAttr( vSubtask, vUserSpec,
                                                   szListType );

      if ( lAttribLth > 20 )
         lAttribLth = 20;

      if ( lAttribLth < 5 )
         lAttribLth = 5;

      GetStringFromAttribute( szPaintStr, zsizeof( szPaintStr ), vUserSpec,
                              X_ER_Attribute, "ListPaintLit" );
      if ( szPaintStr[ 0 ] == 0 )
      {
         GetStringFromAttribute( szPaintStr, zsizeof( szPaintStr ), vUserSpec,
                                 X_ER_Attribute, "PromptPaintLit" );
      }
      if ( szPaintStr[ 0 ] == 0 )
      {
         GetStringFromAttribute( szPaintStr, zsizeof( szPaintStr ), vUserSpec,
                                 X_ER_Attribute, "Name" );
         /* Add a ':' to the end. */
         strcat_s( szPaintStr, zsizeof( szPaintStr ), ":" );
         /* Add spaces before any capital letters. */
         AddSpacesToString( szPaintStr );
      }
      lPaintLth = zstrlen( szPaintStr );
      if ( lPaintLth > 20 )
         lPaintLth = 20;
      if ( lPaintLth < 5 )
         lPaintLth = 5;

      if ( lAttribLth > lPaintLth )
         lTotalLth = lTotalLth + lAttribLth + 1;
      else
         lTotalLth = lTotalLth + lPaintLth + 1;

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

   lTotalLth ++;

   SetAttributeFromInteger( vNewDialog, "Control",
                            "SZDLG_X", lTotalLth * lCC );
   SetAttributeFromInteger( vNewDialog, "Control", "SZDLG_Y", lHeight );

// TraceLineS("END", "CreateListBox W3" );
   return( 0 );
}
示例#16
0
zOPER_EXPORT zLONG OPERATION
SyntaxError( zVIEW vSubtask, zLONG lErrorNumber, zPCHAR szErrorString )
{
   zVIEW vError;
   zVIEW vSearchError;
   zBOOL bFound;
   zBOOL bDone;
   zCHAR szMessage[ 256 ];
   zCHAR szNum[ 10 ];
   zLONG lRC;

   if ( GetViewByName( &vError, "TZVMEROO", vSubtask, zLEVEL_TASK ) > 0 )
   {
   // IssueError( vError, 0, 0, "Syntax Error" );

      // build msc type error message
      GetStringFromAttribute( szMessage, vError, "Root", "SourceFileName" );
      zstrcat( szMessage, "(" );
      zltoa( qqlineno, szNum );
      zstrcat( szMessage, szNum );
      zstrcat( szMessage, ") : error " );
      zltoa( lErrorNumber, szNum );
      zstrcat( szMessage, szNum );
      zstrcat( szMessage, ": " );
      zstrcat( szMessage, g_szMessages[ lErrorNumber - 501 ] );
      switch ( lErrorNumber )
      {
         case eQINVALIDFUNCTIONPARAM /*553*/:
         case eQINVALIDFUNCTIONDEF /*554*/  :
         case 556:
            break;
         default:
            zstrcat( szMessage, " Last Token " );
            if ( !szErrorString || !szErrorString[ 0 ] )
               zstrcat( szMessage, sQToken.szToken );
      }

      zstrcat( szMessage, szErrorString );

      // look to see if a similar error message has been posted
      // we need to match both nErrorNumber and szErrorString
      CreateViewFromViewForTask( &vSearchError, vError, 0 );

      bFound = FALSE;
      bDone = FALSE;

      // Try to find 1st occurrence of current Last Token
      lRC = SetCursorFirstEntityByString( vSearchError, "Error", "LastToken", szErrorString, "" );

      // if none was found, skip the following loop
      if ( lRC < zCURSOR_SET )
         bDone = TRUE;

      while ( !bDone )
      {
         // If we have found an occurrence of current Last Token
         if ( lRC >= zCURSOR_SET )
         {
            // check error number
            lRC = CompareAttributeToInteger( vSearchError, "Error", "ErrorNumber", lErrorNumber );
            // if a match
            if ( lRC == 0 )
            {
               bDone = TRUE;
               bFound = TRUE;
            }

            // otherwise, look again
            else
            {
               lRC = SetCursorNextEntityByString( vSearchError, "Error", "LastToken",
                                                  szErrorString, "" );
            }
         }
         // otherwise, no more occurrences of szErrorString found
         else
         {
            // so we quit looking
            bDone = TRUE;
         }
      }

      // if a simlar error was NOT previously issued
      if ( bFound == FALSE )
      {
         // put the error in error LOD
         CreateEntity( vError, "Error", zPOS_AFTER );
         SetAttributeFromString ( vError, "Error", "String", szMessage );
         SetAttributeFromString ( vError, "Error", "LastToken", szErrorString );
         SetAttributeFromInteger( vError, "Error", "ErrorNumber", lErrorNumber );

      // SysWriteLine( g_lfErrorHandle, "------" );
      // SysWriteLine( g_lfErrorHandle, "------" );
         SysWriteLine( vError, g_lfErrorHandle, szMessage );
      }

      // drop the search view
      DropView( vSearchError );
   }

   // some errors require the parsing process to be stopped,
   //  because Object Engine errors would come up.
   switch ( lErrorNumber )
   {
      case eQNOOPERATIONNAMEGIVEN:
         SkipRemainingFile( );
         TraceLineS( "VML Parsing STOPPED on ERROR --", szMessage );
         break;

      default:
         TraceLineS( "VML Parsing ERROR --", szMessage );
         break;
   }

   return( 0 );
}
示例#17
0
文件: TzCtlTAB.cpp 项目: DeegC/10d
/////////////////////////////////////////////////////////////////////////////
//
//  CONSTRUCTOR: Tab sub-control (to group controls at the tab level)
//
/////////////////////////////////////////////////////////////////////////////
// ctor
TZNotePage::TZNotePage( TZPainterWindow *pPainterWindow,
                        TZPainterCtrl   *pCtrlParent,
                        CWnd    *pWndParent,
                        CRect&  rect,
                        zVIEW   vCtrl,
                        zLONG   lType,
                        zBOOL   bPlaceHolder,
                        zLONG   lZKey,
                        zLONG   lTabStopNbr,
                        zLONG   lCtrlID,
                        zPCHAR  pchTag,
                        zPCHAR  pchText ) :
            CWnd( ),
            TZPainterCtrl( pPainterWindow, pCtrlParent, pWndParent,
                           rect, vCtrl, this, pchTag, pchText,
                           lType, bPlaceHolder, lZKey, lTabStopNbr, lCtrlID )
{
#ifdef DEBUG_ALL
   TraceLineS( "TZNotePage::ctor ", m_csTag );
#endif
   m_pNext = 0;
   m_uVisible = 0x0100;

   m_lSubtype = 0;

   m_pZNoteBook = DYNAMIC_DOWNCAST( TZNoteBook, pWndParent );
   if ( m_pZNoteBook == 0 )
      return;

   zPCHAR pch;
   zLONG  lTabNbr;
   zLONG  lLth;

   if ( vCtrl )
   {
      GetAddrForAttribute( &pch, vCtrl, szlControl, szlText );
      lLth = zstrlen( pch ) + 1;
      m_pchCaption = new char[ lLth ];
      strcpy_s( m_pchCaption, lLth, pch );
      GetIntegerFromAttribute( &lTabNbr, vCtrl, szlControl, szlType );
      if ( lTabNbr == 0 )
      {
         zVIEW vTemp;

         m_pZNoteBook->m_nTabNbrMax++;
         CreateViewFromViewForTask( &vTemp, vCtrl, pPainterWindow->m_vDialog );
         ResetViewFromSubobject( vTemp );
         while ( SetCursorFirstEntityByInteger( vTemp, szlCtrlCtrl, szlType,
                                                m_pZNoteBook->m_nTabNbrMax, 0 ) == zCURSOR_SET )
         {
            m_pZNoteBook->m_nTabNbrMax++;
         }

         SetAttributeFromInteger( vCtrl, szlControl, szlType, m_pZNoteBook->m_nTabNbrMax );
         m_lSubtype = m_pZNoteBook->m_nTabNbrMax;
         DropView( vTemp );
      }
      else
      {
         if ( lTabNbr > m_pZNoteBook->m_nTabNbrMax )
            m_pZNoteBook->m_nTabNbrMax = (zSHORT) lTabNbr;

         m_lSubtype = m_pZNoteBook->m_nTabNbrMax;
      }

      if ( MiGetUpdateForView( vCtrl ) > 0 )
      {
         SetAttributeFromAttribute( vCtrl, szlControl, szlSyncKey, vCtrl, szlControl, szlType );
      }
   }
   else
   {
      m_pZNoteBook->m_nTabNbrMax++;
      m_lSubtype = m_pZNoteBook->m_nTabNbrMax;
      lTabNbr = m_pZNoteBook->m_nTabNbrMax;
      lLth = zstrlen( pchText ) + 1;
      m_pchCaption = new char[ lLth ];
      strcpy_s( m_pchCaption, lLth, pchText );
   }

// TraceRect( "TabCtl rect ", rect );
// TraceLineI( "    Attr.X ", Attr.X );
// TraceLineI( "    Attr.Y ", Attr.Y );
// TraceLineI( "    Attr.W ", Attr.W );
// TraceLineI( "    Attr.H ", Attr.H );

   // Build sub-controls on demand (only when visible or selectable).
   m_bBuildOnDemand = TRUE;

   if ( m_pZNoteBook->m_pZNotePage )
   {
      m_nTabIdx = 1;
      TZNotePage *pCurrNotePage = m_pZNoteBook->m_pZNotePage;
      while ( pCurrNotePage->m_pNext )
      {
         m_nTabIdx++;
         pCurrNotePage = pCurrNotePage->m_pNext;
      }

      pCurrNotePage->m_pNext = this;
   }
   else
   {
      m_nTabIdx = 0;
      m_pZNoteBook->m_pZNotePage = this;
   }

// m_nTabNbr = (zSHORT) lTabNbr;
   m_nTabNbr = m_nTabIdx + 1;
   m_pZNoteBook->m_nPageCnt++;

   TC_ITEM TabCtrlItem;
   TabCtrlItem.mask = TCIF_TEXT;
   TabCtrlItem.pszText = m_pchCaption;
#ifdef DEBUG_ALL
   TraceLineS( "Adding TabCtrlItem: ", m_pchCaption );
#endif
   m_pZNoteBook->InsertItem( m_nTabIdx, &TabCtrlItem );

//?Attr.StyleEx = WS_EX_TRANSPARENT;
//?Attr.Style &= ~(WS_CLIPSIBLINGS | WS_CLIPCHILDREN);

   CreateZ( );
}