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 ); }
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 ); }
zOPER_EXPORT zLONG OPERATION LoadSourceForMetaList( zVIEW vSubtask, zPVIEW pvSource, zVIEW vMetaListView, zLONG lMetaType ) { zVIEW vMeta; zVIEW vTempList; zLONG lRC; lRC = CheckExistenceOfEntity( vMetaListView, "W_MetaDef" ); if ( lRC == zCURSOR_UNCHANGED ) { return( 1 ); } // activate it from configuration management. // Use vTempList instead of vMetaListView for the Activate because ActivateMetaOI // modifies the position on the CM list for global operations. CreateViewFromViewForTask( &vTempList, vMetaListView, 0 ); lRC = ActivateMetaOI( vSubtask, &vMeta, vTempList, (zSHORT) lMetaType, zSINGLE ); DropView( vTempList ); // lRC = LoadSourceForMeta( pvSource, vMeta ); // DropMetaOI( vSubtask, vMeta ); *pvSource = vMeta; if ( lRC != 0 ) return( 1 ); return( 0 ); }
zOPER_EXPORT zSHORT OPERATION UpgradeDialog1( zVIEW vSubtask, zVIEW OrigW ) { #if 0 zVIEW OrigWC; zVIEW vPE; zVIEW vType; zVIEW LOD_List; zSHORT nZRetCode; zLONG lTempInteger_0; zSHORT RESULT; nZRetCode = RetrieveViewForMetaList( vSubtask, &LOD_List, 2013 ); nZRetCode = ActivateMetaOI( vSubtask, &vPE, LOD_List, 2013, zSINGLE ); nZRetCode = ActivateOI_FromFile( &vType, "TZPACTLO", vSubtask, "c:\\10c\\W\\BIN\\SYS\\TZPACTLI.POR", zSINGLE ); lTempInteger_0 = CheckExistenceOfEntity( OrigW, "SourceFile" ); if ( lTempInteger_0 < 0 ) { nZRetCode = CreateMetaEntity( vSubtask, OrigW, "SourceFile", zPOS_AFTER ); SetAttributeFromAttribute( OrigW, "SourceFile", "Name", OrigW, "Dialog", "Tag" ); } SetNameForView( vType, "vType", vSubtask, zLEVEL_TASK ); SetNameForView( vPE, "vPE", vSubtask, zLEVEL_TASK ); RESULT = SetCursorFirstEntity( OrigW, "Window", "" ); while ( RESULT > zCURSOR_UNCHANGED ) { nZRetCode = CreateViewFromViewForTask( &OrigWC, OrigW, 0 ); nZRetCode = SetNameForView( OrigWC, "OrigWC", vSubtask, zLEVEL_TASK ); RESULT = SetCursorFirstEntity( OrigW, "Action", "" ); // while ( RESULT > zLEVEL_TASK ) while ( RESULT >= 0 ) { nZRetCode = UpgradeAction( vSubtask, OrigW ); RESULT = SetCursorNextEntity( OrigW, "Action", "" ); } RESULT = SetCursorFirstEntity( OrigWC, "Control", "" ); while ( RESULT >= 0 ) { nZRetCode = UpgradeControl( vSubtask, OrigW, OrigWC, vType, vPE ); RESULT = SetCursorNextEntity( OrigWC, "Control", "" ); } nZRetCode = DropView( OrigWC ); RESULT = SetCursorNextEntity( OrigW, "Window", "" ); } #endif return( 0 ); }
///////////////////////////////////////////////////////////////////////////// // // OPERATION: oTZVSPOOO_C_GenOperationName // // PURPOSE: For Object and Local operations, concatenate the LOD // name in front of the VML operation name. // For others, just use the regular operation name. // The Type for a Local Oper is L. // The Types for Object operations are either O, T, C, E or A. // ///////////////////////////////////////////////////////////////////////////// zOPER_EXPORT zSHORT OPERATION oTZVSPOOO_C_GenOperationName( zVIEW PIView, LPVIEWENTITY EntityStructure, LPVIEWATTRIB AttributeStructure, zSHORT nGetOrSetFlag ) { zCHAR szTempName1[ 64 ]; zCHAR szTempName2[ 32 ]; zCHAR szType[ 2 ]; zLONG lZKey; zVIEW vTempView; // Set up a temporary view so that PIView remains unchanged CreateViewFromViewForTask( &vTempView, PIView, 0 ); // Position on the corresponding OperationSource for Operation entity GetIntegerFromAttribute( &lZKey, vTempView, "Operation", "ZKey" ); SetCursorFirstEntityByInteger( vTempView, "OperationSource", "ZKey", lZKey, "VML_XSource" ); GetStringFromAttribute( szType, vTempView, "Operation", "Type" ); if ( szType[ 0 ] == 'L' || szType[ 0 ] == 'O' || szType[ 0 ] == 'T' || szType[ 0 ] == 'C' || szType[ 0 ] == 'E' || szType[ 0 ] == 'A' ) { szTempName1[ 0 ] = 'o'; GetStringFromAttribute( szTempName1 + 1, vTempView, "VML_XSource", "MetaName" ); zstrcat( szTempName1, "_" ); GetStringFromAttribute( szTempName2, vTempView, "Operation", "Name" ); zstrcat( szTempName1, szTempName2 ); } else GetStringFromAttribute( szTempName1, vTempView, "Operation", "Name" ); StoreValueInRecord( vTempView, EntityStructure, AttributeStructure, szTempName1, 0 ); // Get rid of temporary view DropView( vTempView ); return( 0 ); }
zOPER_EXPORT zLONG OPERATION LoadSourceForMeta( zVIEW vSubtask, zPVIEW pvSource, zVIEW vMetaView ) { zLONG lRC; lRC = CheckExistenceOfEntity( vMetaView, "SourceFile" ); if ( lRC != 0 ) { return( 1 ); } // Just create a new source view from the meta view, since the meta // now contains the source information. CreateViewFromViewForTask( pvSource, vMetaView, 0 ); return( 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 ); }
// // 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 ); }
zOPER_EXPORT zSHORT OPERATION zwTZVSDBAD_SetBreakPoint( zVIEW vSubtask ) { zVIEW XPG; zVIEW XPG2; zVIEW lpZeidonVML; zLONG FoundFlag; zSHORT nZRetCode; zSHORT RESULT; zLONG lTempInteger_0; nZRetCode = GetViewByName( &lpZeidonVML, "ZeidonVML", vSubtask, zLEVEL_TASK ); nZRetCode = GetViewByName( &XPG, "XPG", lpZeidonVML, zLEVEL_SUBTASK ); nZRetCode = CreateViewFromViewForTask( &XPG2, XPG, 0 ); nZRetCode = GetIntegerFromAttribute( &lTempInteger_0, XPG2, "OperationSource", "ZKey" ); RESULT = SetCursorFirstEntityByInteger( XPG2, "Operation", "ZKey", lTempInteger_0, "" ); FoundFlag = zwTZVSDBAD_FindStatement( XPG2, XPG ); if ( FoundFlag == 1 ) { nZRetCode = SetWindowActionBehavior( vSubtask, zWAB_StayOnWindowWithRefresh, "", "" ); } return( 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 ); }
///////////////////////////////////////////////////////////////////////////// // // 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 ); }
//:DIALOG OPERATION //:RemoveAll ( VIEW vSubtask ) //: VIEW TZTENVRO REGISTERED AS TZTENVRO zOPER_EXPORT zSHORT OPERATION RemoveAll( zVIEW vSubtask ) { zVIEW TZTENVRO = 0; zSHORT RESULT; //:VIEW TZZOLODO REGISTERED AS TZZOLODO zVIEW TZZOLODO = 0; //:VIEW TZZOLODO_Hier BASED ON LOD TZZOLODO zVIEW TZZOLODO_Hier = 0; //:STRING ( 100 ) szEntityName zCHAR szEntityName[ 101 ] = { 0 }; //:SHORT sReturnLevel zSHORT sReturnLevel = 0; //:SHORT nRC zSHORT nRC = 0; //:INTEGER lAbsPos zLONG lAbsPos = 0; //:INTEGER lDataSourceZKey zLONG lDataSourceZKey = 0; RESULT = GetViewByName( &TZTENVRO, "TZTENVRO", vSubtask, zLEVEL_TASK ); RESULT = GetViewByName( &TZZOLODO, "TZZOLODO", vSubtask, zLEVEL_TASK ); //:CreateViewFromViewForTask( TZZOLODO, TZZOLODO, vSubtask ) CreateViewFromViewForTask( &TZZOLODO, TZZOLODO, vSubtask ); //:ResetView( TZZOLODO ) ResetView( TZZOLODO ); //:CreateViewFromViewForTask( TZZOLODO_Hier, TZZOLODO, vSubtask ) CreateViewFromViewForTask( &TZZOLODO_Hier, TZZOLODO, vSubtask ); //:szEntityName = "LOD_EntityParent" ZeidonStringCopy( szEntityName, 1, 0, "LOD_EntityParent", 1, 0, 101 ); //:lDataSourceZKey = TZTENVRO.TE_DBMS_Source.ZKey GetIntegerFromAttribute( &lDataSourceZKey, TZTENVRO, "TE_DBMS_Source", "ZKey" ); //:nRC = DefineHierarchicalCursor( TZZOLODO_Hier, "LOD_EntityParent" ) nRC = DefineHierarchicalCursor( TZZOLODO_Hier, "LOD_EntityParent" ); //:LOOP WHILE nRC >= zCURSOR_SET while ( nRC >= zCURSOR_SET ) { //: IF nRC = zCURSOR_SET_RECURSIVECHILD if ( nRC == zCURSOR_SET_RECURSIVECHILD ) { //: SetViewToSubobject( TZZOLODO_Hier, "LOD_EntityChild" ) SetViewToSubobject( TZZOLODO_Hier, "LOD_EntityChild" ); } //: END //: // Set up our temp view from the hier view. //: GetAbsolutePositionForEntity( lAbsPos, TZZOLODO_Hier, "LOD_EntityParent" ) GetAbsolutePositionForEntity( &lAbsPos, TZZOLODO_Hier, "LOD_EntityParent" ); //: SetCursorAbsolutePosition( szEntityName, TZZOLODO, lAbsPos ) SetCursorAbsolutePosition( szEntityName, TZZOLODO, lAbsPos ); //: IF szEntityName = "LOD_EntityParent" if ( ZeidonStringCompare( szEntityName, 1, 0, "LOD_EntityParent", 1, 0, 101 ) == 0 ) { //: SET CURSOR FIRST TZZOLODO.POD_Entity //: WHERE TZZOLODO.TE_DBMS_SourceForEntity.ZKey = lDataSourceZKey RESULT = SetCursorFirstEntity( TZZOLODO, "POD_Entity", "" ); if ( RESULT > zCURSOR_UNCHANGED ) { while ( RESULT > zCURSOR_UNCHANGED && ( CompareAttributeToInteger( TZZOLODO, "TE_DBMS_SourceForEntity", "ZKey", lDataSourceZKey ) != 0 ) ) { RESULT = SetCursorNextEntity( TZZOLODO, "POD_Entity", "" ); } } //: IF RESULT >= zCURSOR_SET if ( RESULT >= zCURSOR_SET ) { //: TZZOLODO.POD_Entity.SQL_JoinWithParent = "N" SetAttributeFromString( TZZOLODO, "POD_Entity", "SQL_JoinWithParent", "N" ); } //: END } //: END //: nRC = SetCursorNextEntityHierarchical( sReturnLevel, szEntityName, TZZOLODO_Hier ) nRC = SetCursorNextEntityHierarchical( (zPUSHORT) &sReturnLevel, szEntityName, TZZOLODO_Hier ); } //:END //:DropView( TZZOLODO_Hier ) DropView( TZZOLODO_Hier ); //:DropView( TZZOLODO ) DropView( TZZOLODO ); //:RefreshCtrl( vSubtask, "JoinCheck" ) RefreshCtrl( vSubtask, "JoinCheck" ); return( 0 ); // END }
/////////////////////////////////////////////////////////////////////// // // 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 ); }
///////////////////////////////////////////////////////////////////////////// // // 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 ); }
///////////////////////////////////////////////////////////////////////////// // // OPERATION: zofnTZSIXSKO_BldXSK // ///////////////////////////////////////////////////////////////////////////// zOPER_EXPORT zSHORT OPERATION zofnTZSIXSKO_BldXSK ( zVIEW vKZSIXSKO_Root, zVIEW vKZSIXSKO, zVIEW vTZZOXODO, zVIEW vTZTENVRO_REF ) { zVIEW vTZZOXOD1; zVIEW vTZZOXOD_TestWorkAttrib; zVIEW vTZTENVR1; zPCHAR szDBMS; zSHORT nEntImpls; zSHORT nRC; zLONG lEntityZKey; zSHORT nAttrCount = 0; zSHORT nEntitySet = 0; nRC = CreateViewFromViewForTask( &vTZTENVR1, vTZTENVRO_REF, 0 ); nRC = CreateViewFromViewForTask( &vTZZOXOD1, vTZZOXODO, 0 ); nRC = SetCursorFirstEntity( vTZZOXOD1, "ENTITY", "" ); /*=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=? ?? Was ist hier mit Work Entities ? ?? Wie koennen diese umgangen werden ?? natuerlich auch fuer Kinder beruecksichtigen **=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?*/ /* Check physik, if no, then do not process this entity */ if ( (nRC = CheckExistenceOfEntity( vTZZOXOD1, "DATARECORD" )) >= zCURSOR_SET ) { // Suche SironKatalog in TE nRC = GetIntegerFromAttribute( &lEntityZKey, vTZZOXOD1, "ENTITY", "ERENT_TOK" ); nRC = SetCursorFirstEntityByInteger( vTZTENVR1, "ER_Entity", "ZKey", lEntityZKey, "TE_DBMS_Source" ); if ( nRC < zCURSOR_SET ) { GetAddrForAttribute( &szDBMS, vTZTENVR1, "TE_DBMS_Source", "DBMS" ); nEntImpls = 0; for ( nRC = SetCursorFirstEntityByInteger( vTZTENVR1, "ER_Entity", "ZKey", lEntityZKey, "TE_DB_Environ" ); nRC > zCURSOR_UNCHANGED; nRC = SetCursorNextEntityByInteger( vTZTENVR1, "ER_Entity", "ZKey", lEntityZKey, "TE_DB_Environ" ) ) { if ( CompareAttributeToString( vTZTENVR1, "TE_DBMS_Source", "DBMS", szDBMS ) == 0 ) { nEntImpls++; } } if ( nEntImpls == 1 ) { nRC = zCURSOR_SET; } else if ( nEntImpls > 1 ) { for ( nRC = SetCursorFirstEntityByInteger( vTZTENVR1, "ER_Entity", "ZKey", lEntityZKey, "TE_DB_Environ" ); nRC > zCURSOR_UNCHANGED; nRC = SetCursorNextEntityByInteger( vTZTENVR1, "ER_Entity", "ZKey", lEntityZKey, "TE_DB_Environ" ) ) { if ( CompareAttributeToString( vTZTENVR1, "TE_DBMS_Source", "DBMS", szDBMS ) == 0 ) { zstrcpy( szMsg, "Do you want to use Data Source '" ); GetAddrForAttribute( &szMsgName, vTZTENVR1, "TE_DBMS_Source", "Name" ); zstrcat( szMsg, szMsgName ); zstrcat( szMsg, "' to implement ER Entity '" ); GetAddrForAttribute( &szMsgName, vTZTENVR1, "ER_Entity", "Name" ); zstrcat( szMsg, szMsgName ); zstrcat( szMsg, "'?" ); nRC = MessagePrompt ( vTZTENVR1, "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, "ENTITY", "NAME" ); zstrcat( szMsg, szMsgName ); nRC = MessagePrompt( vTZZOXOD1, "XOD_03", "Internal LOD Error", szMsg, 0, zBUTTONS_OK, 0, 0 ); return( 0 ); } } // Now: First Entity found // if SironKatalog Exits // create KATALOG and KATCOM entities // create first ENTITY and ENTITYCOM entities // create dependent ATTRIB and ATTRICOM entities nRC = CheckExistenceOfEntity ( vTZTENVR1, "SironKatalog" ); if ( nRC >= zCURSOR_SET ) { // Create KATALOG entity nRC = CreateEntity ( vKZSIXSKO_Root, "KATALOG", zPOS_AFTER ); SetMatchingAttributesByName(vKZSIXSKO_Root, "KATALOG", vTZTENVR1, "SironKatalog", zSET_ALL ); for ( nRC = SetCursorFirstEntity( vTZTENVR1, "KatalogComment", "SironKatalog"); nRC > zCURSOR_UNCHANGED; nRC = SetCursorNextEntity( vTZTENVR1, "KatalogComment", "SironKatalog") ) { CreateEntity ( vKZSIXSKO_Root, "KATCOM", zPOS_AFTER ); SetMatchingAttributesByName( vKZSIXSKO_Root, "KATCOM", vTZTENVR1, "KatalogComment", zSET_ALL ); } // Create first ENTITY entity nRC = CreateEntity ( vKZSIXSKO_Root, "ENTITY", zPOS_AFTER ); nEntitySet = 1; SetMatchingAttributesByName(vKZSIXSKO_Root, "ENTITY", vTZTENVR1, "OrigSironField", zSET_ALL ); SetAttributeFromAttribute( vKZSIXSKO_Root, "ENTITY", "ERENT_TOK", vTZZOXOD1, "ENTITY", "ERENT_TOK" ); for ( nRC = SetCursorFirstEntity( vTZTENVR1, "FieldComment", "OrigSironField"); nRC > zCURSOR_UNCHANGED; nRC = SetCursorNextEntity( vTZTENVR1, "FieldComment", "OrigSironField") ) { CreateEntity ( vKZSIXSKO_Root, "ENTITYCOM", zPOS_AFTER ); SetMatchingAttributesByName( vKZSIXSKO_Root, "ENTITYCOM", vTZTENVR1, "FieldComment", 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") ) { // If the Attribute is a Workattribute there is no Datafield. // Do not save the Workattributes in the XSK-file. nRC = CreateViewFromViewForTask( &vTZZOXOD_TestWorkAttrib, vTZZOXOD1, 0 ); nRC = SetCursorFirstEntityByAttr (vTZZOXOD_TestWorkAttrib, "DATAFIELD", "FLDNAME", vTZZOXOD1, "ATTRIB", "NAME", ""); if (nRC == zCURSOR_SET) { nRC = SetCursorFirstEntityByAttr ( vTZTENVR1, "TE_FieldDataRel", "Name", vTZZOXOD1, "ATTRIB", "NAME", "TE_TablRec"); CreateEntity ( vKZSIXSKO_Root, "ATTRIB", zPOS_AFTER ); SetMatchingAttributesByName( vKZSIXSKO_Root, "ATTRIB", vTZTENVR1, "SironField", zSET_ALL ); SetAttributeFromAttribute( vKZSIXSKO_Root, "ATTRIB", "XVAATT_TOK", vTZZOXOD1, "ATTRIB", "XVAATT_TOK" ); // Create all dependent ATTRIBCOM entities for ( nRC = SetCursorFirstEntity( vTZTENVR1,"SironFieldComment","SironField"); nRC > zCURSOR_UNCHANGED; nRC = SetCursorNextEntity( vTZTENVR1,"SironFieldComment","SironField") ) { CreateEntity ( vKZSIXSKO_Root, "ATTRIBCOM", zPOS_AFTER ); SetMatchingAttributesByName( vKZSIXSKO_Root, "ATTRIBCOM", vTZTENVR1, "SironFieldComment", zSET_ALL ); } } DropView( vTZZOXOD_TestWorkAttrib ); } } } nRC = CheckExistenceOfEntity( vTZZOXOD1, "CHILDENTITY" ); if ( nRC >= zCURSOR_SET ) zofnTZSIXSKO_BldXSKChildEnt( vKZSIXSKO_Root, vKZSIXSKO, vTZZOXOD1, vTZTENVRO_REF, nEntitySet ); nRC = DropView( vTZZOXOD1 ); nRC = DropView( vTZTENVR1 ); return( 0 ); }
// // 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 ); }
zOPER_EXPORT zLONG OPERATION InvokeInterp( zVIEW lpInterpSubtask, // Interpretor's subtask zVIEW lpAppSubtask, // application's subtask zPCHAR szSrcDLLName, // name of the dialog zPCHAR szOperationName, // operation to interp zPLONG plRC ) { zVIEW vXChecker; zSHORT nRC; zLONG lStepRC; zVIEW vStackObject; // view to the stack object zVIEW vS_View; zVIEW vZ_View; zVIEW vSO; zVIEW vSubtask = 0; zVIEW vTaskLPLR; zPVOID hWRKS = NULL; // Check to make sure the LPLR is active. GetViewByName( &vTaskLPLR, "TaskLPLR", lpAppSubtask, zLEVEL_TASK ); if ( vTaskLPLR == 0 ) InitializeLPLR( lpInterpSubtask, "" ); aInterpreterSave[ lMultiple ].vSubtask = lpInterpSubtask; if ( lMultiple > 0 ) { if ( lMultiple >= MAX_INTEPRETER_ENTRY ) { // Error, because number of recursive entries // is greater than MAX_INTEPRETER_ENTRY return( -99 ); } vSubtask = aInterpreterSave[ lMultiple -1 ].vSubtask; // save the global variables aInterpreterSave[ lMultiple -1 ].nStackPtr = g_nStackPtr; g_nStackPtr = 0; memcpy( aInterpreterSave[ lMultiple -1 ].nCallStack, g_nCallStack, zsizeof( g_nCallStack ) ); memset( g_nCallStack, 0, zsizeof( g_nCallStack ) ); aInterpreterSave[ lMultiple -1 ].vXPGView = g_vXPGView; g_vXPGView = 0; GetViewByName( &g_vStatementView, "StatementView", vSubtask, zLEVEL_SUBTASK ); aInterpreterSave[ lMultiple -1 ].vStatementView = g_vStatementView; g_vStatementView = 0; GetViewByName( &vSO, "StackObject", vSubtask, zLEVEL_SUBTASK ); aInterpreterSave[ lMultiple -1 ].vStackObject = vSO; memcpy( aInterpreterSave[ lMultiple -1 ].sValueStack, sValueStack, zsizeof( sValueStack ) ); memset( sValueStack, 0, zsizeof( sValueStack ) ); } lMultiple++; // see if we can load the XPG. if not, don't parse for now, exit out nRC = InitInterp( lpInterpSubtask, lpAppSubtask, szSrcDLLName ); if ( nRC < 0 ) { lStepRC = 1; // if the init failed return. goto EndOfInvokeInterp; } // Initialize the Working Storage Manager if ( WRKS_Init( &hWRKS ) < 0 ) { // Error in WRKS system MessageSend( vSubtask, "VM03002", "VML Interpretor", "Error Initializing Work Storage", zMSGQ_OBJECT_CONSTRAINT_ERROR, zBEEP ); TraceLineS( "VML Interpreter Error ","Initializing Work Storage" ); lStepRC = 1; // if the init failed return. goto EndOfInvokeInterp; } if ( setjmp( g_jbWRKS ) != 0 ) { // Error return from longjmp WRKS_Close( &hWRKS ); lStepRC = 1; goto EndOfInvokeInterp; } // get the program object as it was loaded by the init function. GetViewByName( &g_vXPGView, "XPG", lpInterpSubtask, zLEVEL_SUBTASK ); // try to position at the correct operation in the Subtask nRC = SetCursorFirstEntityByString( g_vXPGView, "Operation", "Name", szOperationName, "" ); if ( nRC != zCURSOR_SET ) { // no error message here, as we assume that the operation // to be called is a C operation. // Returning -1, the driver will try to load it from the DLL lStepRC = -1; goto EndOfInvokeInterp; } SetCursorFirstEntityByEntityCsr( g_vXPGView, "SourceFile", g_vXPGView, "SourceFileOfOperation", "" ); SetCursorFirstEntityByEntityCsr( g_vXPGView, "OperationSource", g_vXPGView, "Operation", "" ); SetCursorFirstEntity( g_vXPGView, "OperationText", "" ); SetCursorFirstEntity( g_vXPGView, "Statement", "" ); CreateViewFromViewForTask( &g_vStatementView, g_vXPGView, 0 ); // Create all of the entities needed in the stack object SetStackObjectFromViews( lpInterpSubtask, g_vXPGView, // View to the XPG g_vStatementView, // View to the statement 0 ); // index into the expression // Get the stack object as it was loaded with the XPG GetViewByName( &vStackObject, "StackObject", lpInterpSubtask, zLEVEL_SUBTASK ); // ###blob SetAttributeFromInteger( vStackObject, // "Variable", "Value", (zLONG)lpAppSubtask ); SetAttributeFromBlob( vStackObject, "Variable", "Value", &lpAppSubtask, sizeof( void * ) ); SetNameForView( g_vStatementView, "StatementView", lpInterpSubtask, zLEVEL_SUBTASK ); SetNameForView( lpAppSubtask, "ApplicationView", lpInterpSubtask, zLEVEL_SUBTASK ); GetViewByName( &vXChecker, "TZVSXCOO", lpInterpSubtask, zLEVEL_APPLICATION ); if ( vXChecker != 0 ) { nRC = SetCursorFirstEntityByString( vXChecker, "DialogOperation", "Name", szOperationName, "" ); if ( nRC == zCURSOR_SET ) { GetViewByName( &vZ_View, "ZeidonVML", vSubtask, zLEVEL_TASK ); GetViewByName( &vS_View, "XPG", vZ_View, zLEVEL_SUBTASK ); SetAttributeFromString( vS_View, "Operation", "CurrentDebugFlag", "Y" ); lStepRC = zXC_SETUP_DEBUGGER; goto EndOfInvokeInterp; } } // lStepRC = zXC_STEP_EXECUTED; #if 0 OperationCount( 3 ); OperationCount( 1 ); #endif // Loop through each statement using the Go function. lStepRC = Go( lpAppSubtask, hWRKS, plRC ); EndOfInvokeInterp: // close work storage manager if ( hWRKS ) WRKS_Close( &hWRKS ); lMultiple--; if ( lMultiple > 0 ) { vSubtask = aInterpreterSave[ lMultiple - 1 ].vSubtask; // restore the global variables g_nStackPtr = aInterpreterSave[ lMultiple - 1 ].nStackPtr; memcpy( g_nCallStack, aInterpreterSave[ lMultiple -1 ].nCallStack, zsizeof( g_nCallStack ) ); g_vXPGView = aInterpreterSave[ lMultiple - 1 ].vXPGView; SetNameForView( g_vXPGView, "XPG", vSubtask, zLEVEL_SUBTASK ); g_vStatementView = aInterpreterSave[ lMultiple - 1 ].vStatementView; SetNameForView( g_vStatementView, "StatementView", vSubtask, zLEVEL_SUBTASK ); vSO = aInterpreterSave[ lMultiple - 1 ].vStackObject; SetNameForView( vSO, "StackObject", vSubtask, zLEVEL_SUBTASK ); memcpy( sValueStack, aInterpreterSave[ lMultiple - 1 ].sValueStack, zsizeof( sValueStack ) ); } return( lStepRC ); }
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 ); }
///////////////////////////////////////////////////////////////////////////// // // 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 ); }
// // 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 ); }
///////////////////////////////////////////////////////////////////////////// // // 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 ); }
///////////////////////////////////////////////////////////////////////////// // // bSubcontrol - TRUE - add controls to existing pZSubtask->m_pZMIXCtrl // FALSE - delete existing pZSubtask->m_pZMIXCtrl and start // a new list // ///////////////////////////////////////////////////////////////////////////// void OPERATION CreateZeidonCtrls( zVIEW vSubobject, ZSubtask *pZSubtask, CWnd *pWndParent, ZMapAct *pzmaComposite, zSHORT nOffsetX, zSHORT nOffsetY, zBOOL bSubcontrol ) { zKZWDLGXO_Ctrl_DEF CtrlDef; zFARPROC_CONTROL lpfnCtrlProc; LPLIBRARY hCCtlLibrary; zPCHAR pchDLL_Name; zPCHAR pchCOP; zSHORT nRC; #ifdef DEBUG_ALL TraceLineX( "CreateZeidonCtrls parent - ", (zLONG) pZSubtask ); #endif nRC = CheckExistenceOfEntity( vSubobject, szlCtrl ); if ( bSubcontrol == FALSE ) { mDeleteInit( pZSubtask->m_pZMIXCtrl ); if ( nRC > zCURSOR_UNCHANGED ) { zLONG lTempCtrlCnt; // just to get the long temporarily GetIntegerFromAttribute( &lTempCtrlCnt, pZSubtask->m_vDialog, szlWnd, "CtrlCnt" ); // TraceLineI( "CreateZeidonCtrls count ", lTempCtrlCnt ); pZSubtask->m_pZMIXCtrl = new ZMultiIdxSet( (fnCOMPARE) fnCompareCtrlNodes, (fnCOMPARE) fnSeekCtrlNode, lTempCtrlCnt ); // Instead of having ZMultiIdxSet delete the nodes itself, we call // a recursive routine (fnDeleteCtrls) to guarantee the child // controls are deleted before their parents. } else pZSubtask->m_pZMIXCtrl = 0; CreateViewFromViewForTask( &(pZSubtask->m_vPE), pZSubtask->m_pZTask->m_vPE, pZSubtask->m_vDialog ); } #ifdef DEBUG_LODSTRUCT zmemset( CtrlDef.Tag, 0xFE, sizeof( CtrlDef ) ); // CtrlDef.CheckByte = 0xFE; #endif while ( nRC > zCURSOR_UNCHANGED ) { // Get the structure of attributes for this control. zPCHAR pch = 0; // for derived Text attribute GetStructFromEntityAttrs( (zPCHAR) CtrlDef.Tag, vSubobject, szlCtrl ); #ifdef DEBUG_LODSTRUCT if ( CtrlDef.CheckByte != 0xFE ) MessageBox( 0, "CtrlDef Structure Length Error", "GetStructFromEntityAttrs", MB_OK ); // zPCHAR pchCheckByte = (zPCHAR) &(CtrlDef.CheckByte); // pchCheckByte--; // if ( *pchCheckByte == (char) 0xFE ) // TraceLineS( "zdrctl CtrlDef CheckByte error??", "" ); #endif GetAddrForAttribute( (zPCHAR *) &pch, vSubobject, szlCtrl, szlD_Text ); if ( *pch ) zstrcpy( CtrlDef.Text, pch ); #ifdef DEBUG_ALL TraceLineS( "Tag ", CtrlDef.Tag ); TraceLineI( "Type ", CtrlDef.Type ); TraceLineI( "IdNbr ", CtrlDef.IdNbr ); TraceLineI( "PSDLG_X ", CtrlDef.PSDLG_X ); TraceLineI( "PSDLG_Y ", CtrlDef.PSDLG_Y ); TraceLineI( "SZDLG_X ", CtrlDef.SZDLG_X ); TraceLineI( "SZDLG_Y ", CtrlDef.SZDLG_Y ); #endif // The token is validated by the painter and/or conversion to // the executable object, but we check here anyway. nRC = SetCursorFirstEntityByInteger( pZSubtask->m_pZTask->m_vPE, szlCtrl, szlKey, CtrlDef.Type, 0 ); if ( nRC != zCURSOR_SET ) { TraceLine( "(drvr) ID (%d) not found (%d) in PPE for Ctrl: %s.%s.%s", CtrlDef.Type, nRC, pZSubtask->m_pzsDlgTag ? *(pZSubtask->m_pzsDlgTag) : "?", pZSubtask->m_pzsWndTag ? *(pZSubtask->m_pzsWndTag) : "?", CtrlDef.Tag ); DisplayEntityInstance( pZSubtask->m_pZTask->m_vPE, szlCtrl ); DisplayObjectInstance( pZSubtask->m_pZTask->m_vPE, 0, 0 ); // Skip this one and try the next. nRC = SetCursorNextEntity( vSubobject, szlCtrl, 0 ); continue; } GetAddrForAttribute( (zPCHAR *) &pchDLL_Name, pZSubtask->m_pZTask->m_vPE, szlCtrl, szlDLL ); GetAddrForAttribute( (zPCHAR *) &pchCOP, pZSubtask->m_pZTask->m_vPE, szlCtrl, szlCOP ); // If the DLL name is added to the list, this is the first time it // has been encountered ... so call its initialization routine. pZSubtask->m_pZTask->AddApplicationDLL( pZSubtask, pchDLL_Name ); hCCtlLibrary = 0; // set to zero for GetOperationDynamicCallAddress lpfnCtrlProc = (zFARPROC_CONTROL) GetOperationDynamicCallAddress( pZSubtask->m_vDialog, (LPLPLIBRARY) &hCCtlLibrary, pchDLL_Name, pchCOP, "(drvr) Ctrl" ); try { if ( lpfnCtrlProc ) // && (k % 2) == 0 ) { // TraceLineS( "Create Control: ", pchCOP ); (*lpfnCtrlProc)( pZSubtask, pWndParent, pzmaComposite, vSubobject, nOffsetX, nOffsetY, &CtrlDef ); } } #if 0 catch( CResourceException *e ) { zCHAR szMsg[ 256 ]; e->GetErrorMessage( szMsg, sizeof( szMsg ) ); zstrcat( szMsg, } #endif catch( CException *e ) { zCHAR szMsg[ 256 ]; e->GetErrorMessage( szMsg, sizeof( szMsg ) ); MessageSend( pZSubtask->m_vDialog, 0, "Zeidon Control", szMsg, zMSGQ_MODAL_ERROR, FALSE ); break; } nRC = SetCursorNextEntity( vSubobject, szlCtrl, 0 ); } // end of: while ( nRC == zCURSOR_UNCHANGED ) looping thru controls if ( bSubcontrol == FALSE ) { DropView( pZSubtask->m_vPE ); pZSubtask->m_vPE = 0; // using this to determine Ctrls have been created // Ctrl creation is complete ... notify each ctrl. if ( pZSubtask->m_pZMIXCtrl ) { pZSubtask->m_pZMIXCtrl->VisitInorder( (fnVISIT_INORDER) fnPostCreateCtrls, 0, 0, 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 ); }
///////////////////////////////////////////////////////////////////////////// // // OPERATION: oTZDMXGPO_GetViewForXDM // // PURPOSE: Get access to XDM View. Activate if not loaded // and get at application level if loaded. // ///////////////////////////////////////////////////////////////////////////// zOPER_EXPORT zSHORT OPERATION oTZDMXGPO_GetViewForXDM( zVIEW vSubtask, zPVIEW pvTZDMXGPO, zSHORT nCurrentOrReload ) { zVIEW vT; zVIEW vTask; zCHAR szXDM_FileName[ zMAX_FILESPEC_LTH + 1 ]; zCHAR szAppViewName[ 66 ] = "dmDOMAINS."; zSHORT nRScope; zSHORT nRC; // Set up the XDM File Name and the View Name GetViewByName( &vTask, "TaskLPLR", vSubtask, zLEVEL_TASK ); GetStringFromAttribute( &szAppViewName[ 10 ], vTask, "LPLR", "Name" ); GetStringFromAttribute( szXDM_FileName, vTask, "LPLR", "ExecDir" ); zstrcat( szXDM_FileName, "\\zeidon.xdm" ); // See if XDM View is at the Application level nRScope = GetViewByName( &vT, szAppViewName, vTask, zLEVEL_APPLICATION ); if ( nRScope == zCALL_ERROR ) return( zCALL_ERROR ); if ( nRScope == zLEVEL_APPLICATION && nCurrentOrReload == zFORCE_RELOAD ) { nRC = DropObjectInstance( vT ); nRScope = -1; } if ( nRScope != zLEVEL_APPLICATION ) { // Load it from a file or create a new one if file is missing. if ( ActivateOI_FromFile( &vT, "TZDMXGPO", vTask, szXDM_FileName, zSINGLE | zLEVEL_APPLICATION | zNOI_OKAY ) != 0 ) { ActivateEmptyObjectInstance( &vT, "TZDMXGPO", vTask, zSINGLE | zLEVEL_APPLICATION ); CreateEntity( vT, "DomainGroup", zPOS_AFTER ); SetAttributeFromString( vT, "DomainGroup", "Name", &szAppViewName[ 10 ] ); SetNameForView( vT, szAppViewName, 0, zLEVEL_APPLICATION ); CommitOI_ToFile( vT, szXDM_FileName, zASCII ); // MessageSend( vT, "DM00201", "Domain Management", // "The Executable Domain File was not found. " // "An empty one is being created. You may want " // "to save all Domains OR re-Initialze the LPLR.", // zMSGQ_OBJECT_CONSTRAINT_WARNING, zBEEP ); nRC = 1; } else { SetNameForView( vT, szAppViewName, 0, zLEVEL_APPLICATION ); nRC = 0; } } else { nRC = 0; } CreateViewFromViewForTask( pvTZDMXGPO, vT, 0 ); return( nRC ); }
///////////////////////////////////////////////////////////////////////////// // // 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 ); }
/* This operation builds the operation list for the OperationList window. Depending on what the value is for vProfileXFER.ED.OpIns_CurrentType we build different operations lists. */ zOPER_EXPORT zSHORT OPERATION OpIns_BuildOperList( zVIEW vSubtask ) { #define DISP_SELECT_SET 1 #define SEL_SELECT_SET 2 zCHAR szCurrentType[ 5 ]; zVIEW vProfileXFER; zVIEW vEdWrk; zSHORT nRC; zCHAR szKeyword[ 255 ]; zLONG lSelectCount = 0; 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 we obviously don't need to load them again. if ( SetCursorFirstEntityByString( vEdWrk, "OperListType", "Type", szCurrentType, 0 ) != zCURSOR_SET ) { // Operations haven't been loaded yet, so load 'em up. CreateEntity( vEdWrk, "OperListType", zPOS_LAST ); SetAttributeFromString( vEdWrk, "OperListType", "Type", szCurrentType ); switch ( *szCurrentType ) { case 'Z': { zVIEW vTZOPSIGK; // Get list of Zeidon operations. // Check to see if we've already activated the Zeidon opers list. // If not, activate it and save the view. GetViewByName( &vTZOPSIGK, "TZOPSIGK", vSubtask, zLEVEL_TASK ); if ( !vTZOPSIGK ) { oTZOPGRPO_GetViewForXGO( vSubtask, &vTZOPSIGK, zSYS_CURRENT_OI ); SetNameForView( vTZOPSIGK, "TZOPSIGK", vSubtask, zLEVEL_TASK ); } // Now copy each of the operations to the editor work object. for ( nRC = SetCursorFirstEntity( vTZOPSIGK, "Operation", 0 ); nRC == zCURSOR_SET; nRC = SetCursorNextEntity( vTZOPSIGK, "Operation", 0 ) ) { CreateEntity( vEdWrk, "Oper", zPOS_LAST ); SetMatchingAttributesByName( vEdWrk, "Oper", vTZOPSIGK, "Operation", zSET_ALL ); } break; } // Case 'Z'... case 'G': { zVIEW vOp; // Get list of Global operations. RetrieveViewForMetaList( vSubtask, &vOp, zREFER_GO_META ); // Now copy each of the operations to the editor work object. for ( nRC = SetCursorFirstEntity( vOp, "W_MetaDef", 0 ); nRC == zCURSOR_SET; nRC = SetCursorNextEntity( vOp, "W_MetaDef", 0 ) ) { CreateEntity( vEdWrk, "Oper", zPOS_LAST ); SetMatchingAttributesByName( vEdWrk, "Oper", vOp, "W_MetaDef", zSET_ALL ); } DropView( vOp ); break; } // Case 'G'... case 'L': { zVIEW vMeta; zLONG lMetaType; // Get list of "Local" operations. "Local" operations in this // case mean all operations that are for the current meta. // For example, if the current meta is a Dialog, then the "Local" // operations include local and Dialog operations. // Get the source view and the meta type. GetIntegerFromAttribute( (zPLONG) &vMeta, vEdWrk, "Buffer", "SourceViewID" ); GetIntegerFromAttribute( &lMetaType, vEdWrk, "Buffer", "MetaType" ); // Create a new, temp view of the meta so that we can muck around // with the cursors. CreateViewFromViewForTask( &vMeta, vMeta, 0 ); // // Now copy the "Local" meta operations to vEdWrk. // if ( lMetaType == zREFER_DIALOG_META || lMetaType == zREFER_LOD_META ) { // Make sure we are reading the "Local" operations for // the current source file. SetCursorFirstEntityByAttr( vMeta, "SourceFile", "Name", vEdWrk, "Buffer", "SourceFileName", 0 ); } // Copy all the operations to vEdWrk for ( nRC = SetCursorFirstEntity( vMeta, "Operation", 0 ); nRC == zCURSOR_SET; nRC = SetCursorNextEntity( vMeta, "Operation", 0 ) ) { CreateEntity( vEdWrk, "Oper", zPOS_LAST ); SetMatchingAttributesByName( vEdWrk, "Oper", vMeta, "Operation", zSET_ALL ); } DropView( vMeta ); break; } // Case 'L'... case 'O': { // Since we load the object operations by object, we don't have // to do anything here. break; } // Case 'O'... default: SysMessageBox( "Zeidon Internal", "This operation type not yet supported", 0 ); break; } // switch ( *szCurrentType )... // Now that we've loaded the operations, sort them. OrderEntityForView( vEdWrk, "Oper", "Name A" ); } // if ( SetCursor...)... // Disable the "Objects" button unless we are showing object operations. if ( *szCurrentType == 'O' ) SetCtrlState( vSubtask, "ListObjects", zCONTROL_STATUS_ENABLED, TRUE ); else SetCtrlState( vSubtask, "ListObjects", zCONTROL_STATUS_ENABLED, FALSE ); // Now set the select states depending on the keyword values. GetStringFromAttribute( szKeyword, vProfileXFER, "ED", "OpIns_Keyword" ); if ( *szKeyword && CompareAttributeToString( vProfileXFER, "ED", "OpIns_UseKeyword", "Y" ) == 0 ) { zCHAR szIgnoreCase[ 5 ]; zPCHAR pszKeyword; zBOOL bStartColOne; zSHORT nKeywordLth; // De-select all operations. SetAllSelectStatesForEntity( vEdWrk, "Oper", FALSE, 0 ); GetStringFromAttribute( szIgnoreCase, vProfileXFER, "ED", "OpIns_KeywordIgnoreCase" ); if ( *szIgnoreCase == 'Y' ) { for ( pszKeyword = szKeyWord; *pszKeyword; pszKeyword++ ) *pszKeyword = ztoupper( *pszKeyword ); } // If the keyword starts with a "/", then the keyword search starts // with the first zCHAR (e.g. column) ONLY. pszKeyword = szKeyword; if ( *pszKeyword == '/' ) { pszKeyword++; bStartColOne = TRUE; nKeywordLth = zstrlen( pszKeyword ); } else bStartColOne = FALSE; for ( nRC = SetCursorFirstEntity( vEdWrk, "Oper", 0 ); nRC == zCURSOR_SET; nRC = SetCursorNextEntity( vEdWrk, "Oper", 0 ) ) { zCHAR szOperName[ 255 ]; GetStringFromAttribute( szOperName, vEdWrk, "Oper", "Name" ); if ( *szIgnoreCase == 'Y' ) strupr( szOperName ); if ( bStartColOne ) { if ( zstrncmp( szOperName, pszKeyword, nKeywordLth ) == 0 ) { SetSelectStateOfEntity( vEdWrk, "Oper", TRUE ); lSelectCount++; } } else { if ( strstr( szOperName, pszKeyword ) ) { SetSelectStateOfEntity( vEdWrk, "Oper", TRUE ); lSelectCount++; } } } // for... } else { // Select all operations. SetAllSelectStatesForEntity( vEdWrk, "Oper", TRUE, 0 ); lSelectCount = CountEntitiesForView( vEdWrk, "Oper" ); } //SetSelectSetForView( vEdWrk, nOldSelectSet ); SetCursorFirstSelectedEntity( vEdWrk, "Oper", 0 ); LB_SetDisplaySelectSet( vSubtask, "OperationList", DISP_SELECT_SET ); LB_SetSelectSelectSet( vSubtask, "OperationList", SEL_SELECT_SET ); // Re-use szKeyword to set the message... sprintf( szKeyword, "%d Operations listed", lSelectCount ); MB_SetMessage( vSubtask, 0, szKeyword ); RefreshWindow( vSubtask ); return( 0 ); } // OpIns_BuildOperList
//: VIEW SourceView zOPER_EXPORT zSHORT OPERATION oKZXMLPGO_AddWebControlSubobject( zVIEW vKZXMLPGO, zPCHAR ControlName, zPCHAR ControlType, zPCHAR ControlContext, zPCHAR SourceViewName, zPCHAR SourceEntity, zPCHAR SourceAttribute, zPCHAR AutoComboBoxExternalValue ) { zVIEW SourceView = 0; //:VIEW SourceView2 zVIEW SourceView2 = 0; //:SHORT nRC zSHORT nRC = 0; //:INTEGER CursorPos zLONG CursorPos = 0; //:STRING ( 2000 ) ExternalValue zCHAR ExternalValue[ 2001 ] = { 0 }; //:STRING ( 200 ) CurrentValue zCHAR CurrentValue[ 201 ] = { 0 }; zSHORT RESULT; zCHAR szTempString_0[ 255 ]; zCHAR szTempString_1[ 32001 ]; //:// Create a Control entity for the data passed. //:// If the Control is a ListBox or ComboBox, also create the SubControl entries for each list value. //:CREATE ENTITY vKZXMLPGO.Control RESULT = CreateEntity( vKZXMLPGO, "Control", zPOS_AFTER ); //:vKZXMLPGO.Control.Name = ControlName SetAttributeFromString( vKZXMLPGO, "Control", "Name", ControlName ); //:vKZXMLPGO.Control.Type = ControlType SetAttributeFromString( vKZXMLPGO, "Control", "Type", ControlType ); //:// If the Named View does not exist or the EntityName doesn't exist, simply return. //:GET VIEW SourceView NAMED SourceViewName RESULT = GetViewByName( &SourceView, SourceViewName, vKZXMLPGO, zLEVEL_TASK ); //:IF RESULT < 0 if ( RESULT < 0 ) { //:// There is no mapping, so return having just created the entity, with Name and Type, //:// unless the Control is Text, in which case we'll add the Text value, which is passed as //:// AutoComboBoxExternalValue. //:IF vKZXMLPGO.Control.Type = "Text" OR //: vKZXMLPGO.Control.Type = "PushBtn" if ( CompareAttributeToString( vKZXMLPGO, "Control", "Type", "Text" ) == 0 || CompareAttributeToString( vKZXMLPGO, "Control", "Type", "PushBtn" ) == 0 ) { //:vKZXMLPGO.Control.CurrentValue = AutoComboBoxExternalValue SetAttributeFromString( vKZXMLPGO, "Control", "CurrentValue", AutoComboBoxExternalValue ); } //:END //:RETURN return( 0 ); } //:END //:IF SourceEntity != "" if ( ZeidonStringCompare( SourceEntity, 1, 0, "", 1, 0, 33 ) != 0 ) { //:nRC = CheckExistenceOfEntity( SourceView, SourceEntity ) nRC = CheckExistenceOfEntity( SourceView, SourceEntity ); //:IF nRC < 0 if ( nRC < 0 ) { //:RETURN return( 0 ); } //:END } //:END //:// If there is mapping, process according to Control Type //:IF vKZXMLPGO.Control.Type = "EditBox" OR //: vKZXMLPGO.Control.Type = "Text" OR //: vKZXMLPGO.Control.Type = "CheckBox" if ( CompareAttributeToString( vKZXMLPGO, "Control", "Type", "EditBox" ) == 0 || CompareAttributeToString( vKZXMLPGO, "Control", "Type", "Text" ) == 0 || CompareAttributeToString( vKZXMLPGO, "Control", "Type", "CheckBox" ) == 0 ) { //:GetStringFromAttributeByContext( ExternalValue, //: SourceView, SourceEntity, SourceAttribute, ControlContext, 2000 ) GetStringFromAttributeByContext( ExternalValue, SourceView, SourceEntity, SourceAttribute, ControlContext, 2000 ); //:vKZXMLPGO.Control.CurrentValue = ExternalValue SetAttributeFromString( vKZXMLPGO, "Control", "CurrentValue", ExternalValue ); //:ELSE } else { //:IF vKZXMLPGO.Control.Type = "MLEdit" if ( CompareAttributeToString( vKZXMLPGO, "Control", "Type", "MLEdit" ) == 0 ) { //:SetAttributeFromAttribute( vKZXMLPGO, "Control", "CurrentValue", //: SourceView, SourceEntity, SourceAttribute ) SetAttributeFromAttribute( vKZXMLPGO, "Control", "CurrentValue", SourceView, SourceEntity, SourceAttribute ); //:ELSE } else { //:IF vKZXMLPGO.Control.Type = "ComboBox" if ( CompareAttributeToString( vKZXMLPGO, "Control", "Type", "ComboBox" ) == 0 ) { //:// Build the list of selection values from the Domain table entries. //:GetStringFromAttributeByContext( CurrentValue, //: SourceView, SourceEntity, SourceAttribute, ControlContext, 200 ) GetStringFromAttributeByContext( CurrentValue, SourceView, SourceEntity, SourceAttribute, ControlContext, 200 ); //:vKZXMLPGO.Control.CurrentValue = CurrentValue SetAttributeFromString( vKZXMLPGO, "Control", "CurrentValue", CurrentValue ); //:nRC = GetFirstTableEntryForAttribute( ExternalValue, //: SourceView, SourceEntity, SourceAttribute, //: ControlContext, CursorPos ) nRC = GetFirstTableEntryForAttribute( ExternalValue, SourceView, SourceEntity, SourceAttribute, ControlContext, &CursorPos ); //:LOOP WHILE nRC >= 0 while ( nRC >= 0 ) { //:CREATE ENTITY vKZXMLPGO.ComboValue RESULT = CreateEntity( vKZXMLPGO, "ComboValue", zPOS_AFTER ); //:vKZXMLPGO.ComboValue.ExternalValue = ExternalValue SetAttributeFromString( vKZXMLPGO, "ComboValue", "ExternalValue", ExternalValue ); //:IF ExternalValue = CurrentValue if ( ZeidonStringCompare( ExternalValue, 1, 0, CurrentValue, 1, 0, 2001 ) == 0 ) { //:SetSelectStateOfEntity( vKZXMLPGO, "ComboValue", 1 ) SetSelectStateOfEntity( vKZXMLPGO, "ComboValue", 1 ); //:ELSE } else { //:SetSelectStateOfEntity( vKZXMLPGO, "ComboValue", 0 ) SetSelectStateOfEntity( vKZXMLPGO, "ComboValue", 0 ); } //:END //:nRC = GetNextTableEntryForAttribute( ExternalValue, //: SourceView, SourceEntity, SourceAttribute, //: ControlContext, CursorPos ) nRC = GetNextTableEntryForAttribute( ExternalValue, SourceView, SourceEntity, SourceAttribute, ControlContext, &CursorPos ); } //:END //:ELSE } else { //:IF vKZXMLPGO.Control.Type = "ComboBoxAuto" if ( CompareAttributeToString( vKZXMLPGO, "Control", "Type", "ComboBoxAuto" ) == 0 ) { //:// Build the list of selection values from the list of entities. //:// Note that the entry selected is defined by the AutoComboBoxExternalValue passed, which //:// was set from the value of the Edit Mapping. //:vKZXMLPGO.Control.CurrentValue = AutoComboBoxExternalValue SetAttributeFromString( vKZXMLPGO, "Control", "CurrentValue", AutoComboBoxExternalValue ); //:nRC = SetCursorFirstEntity( SourceView, SourceEntity, "" ) nRC = SetCursorFirstEntity( SourceView, SourceEntity, "" ); //:LOOP WHILE nRC >= 0 while ( nRC >= 0 ) { //:CREATE ENTITY vKZXMLPGO.ComboValue RESULT = CreateEntity( vKZXMLPGO, "ComboValue", zPOS_AFTER ); //:GetStringFromAttributeByContext( ExternalValue, //: SourceView, SourceEntity, SourceAttribute, "", 2000 ) GetStringFromAttributeByContext( ExternalValue, SourceView, SourceEntity, SourceAttribute, "", 2000 ); //:vKZXMLPGO.ComboValue.ExternalValue = ExternalValue SetAttributeFromString( vKZXMLPGO, "ComboValue", "ExternalValue", ExternalValue ); //:IF ExternalValue = AutoComboBoxExternalValue if ( ZeidonStringCompare( ExternalValue, 1, 0, AutoComboBoxExternalValue, 1, 0, 2001 ) == 0 ) { //:SetSelectStateOfEntity( vKZXMLPGO, "ComboValue", 1 ) SetSelectStateOfEntity( vKZXMLPGO, "ComboValue", 1 ); //:ELSE } else { //:SetSelectStateOfEntity( vKZXMLPGO, "ComboValue", 0 ) SetSelectStateOfEntity( vKZXMLPGO, "ComboValue", 0 ); } //:END //:nRC = SetCursorNextEntity( SourceView, SourceEntity, "" ) nRC = SetCursorNextEntity( SourceView, SourceEntity, "" ); } //:END //:ELSE } else { //:IF vKZXMLPGO.Control.Type = "ComboBoxList" if ( CompareAttributeToString( vKZXMLPGO, "Control", "Type", "ComboBoxList" ) == 0 ) { //:// Build the list of selection values from the list of entities. //:// Note that the entry selected is defined by the cursor position. //:CreateViewFromViewForTask( SourceView2, SourceView, vKZXMLPGO ) CreateViewFromViewForTask( &SourceView2, SourceView, vKZXMLPGO ); //:GetStringFromAttributeByContext( CurrentValue, //: SourceView, SourceEntity, SourceAttribute, "", 2000 ) GetStringFromAttributeByContext( CurrentValue, SourceView, SourceEntity, SourceAttribute, "", 2000 ); //:vKZXMLPGO.Control.CurrentValue = CurrentValue SetAttributeFromString( vKZXMLPGO, "Control", "CurrentValue", CurrentValue ); //:nRC = SetCursorFirstEntity( SourceView2, SourceEntity, "" ) nRC = SetCursorFirstEntity( SourceView2, SourceEntity, "" ); //:LOOP WHILE nRC >= 0 while ( nRC >= 0 ) { //:CREATE ENTITY vKZXMLPGO.ComboValue RESULT = CreateEntity( vKZXMLPGO, "ComboValue", zPOS_AFTER ); //:GetStringFromAttributeByContext( ExternalValue, //: SourceView2, SourceEntity, SourceAttribute, "", 2000 ) GetStringFromAttributeByContext( ExternalValue, SourceView2, SourceEntity, SourceAttribute, "", 2000 ); //:vKZXMLPGO.ComboValue.ExternalValue = ExternalValue SetAttributeFromString( vKZXMLPGO, "ComboValue", "ExternalValue", ExternalValue ); //:IF ExternalValue = CurrentValue if ( ZeidonStringCompare( ExternalValue, 1, 0, CurrentValue, 1, 0, 2001 ) == 0 ) { //:SetSelectStateOfEntity( vKZXMLPGO, "ComboValue", 1 ) SetSelectStateOfEntity( vKZXMLPGO, "ComboValue", 1 ); //:ELSE } else { //:SetSelectStateOfEntity( vKZXMLPGO, "ComboValue", 0 ) SetSelectStateOfEntity( vKZXMLPGO, "ComboValue", 0 ); } //:END //:nRC = SetCursorNextEntity( SourceView2, SourceEntity, "" ) nRC = SetCursorNextEntity( SourceView2, SourceEntity, "" ); } //:END //:DropView( SourceView2 ) DropView( SourceView2 ); } //:END } //:END } //:END } //:END } //:END //:TraceLineS( "AddWebControlSubobject Type: ", vKZXMLPGO.Control.Type ) GetStringFromAttribute( szTempString_0, vKZXMLPGO, "Control", "Type" ); TraceLineS( "AddWebControlSubobject Type: ", szTempString_0 ); //:TraceLineS( " =============== Value: ", vKZXMLPGO.Control.CurrentValue ) GetStringFromAttribute( szTempString_1, vKZXMLPGO, "Control", "CurrentValue" ); TraceLineS( " =============== Value: ", szTempString_1 ); return( 0 ); // /* vKZXMLPGO.Control.Type = "EditBox" OR // vKZXMLPGO.Control.Type = "ListBox" OR // vKZXMLPGO.Control.Type = "Text" OR // vKZXMLPGO.Control.Type = "CheckBox" OR // vKZXMLPGO.Control.Type = "ListBox" OR // vKZXMLPGO.Control.Type = "MLE" OR // vKZXMLPGO.Control.Type = "Outliner" OR // vKZXMLPGO.Control.Type = "RadioBtnGroup" */ // END }
///////////////////////////////////////////////////////////////////////////// // // 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( ); }