Пример #1
0
/////////////////////////////////////////////////////////////////////////////
//
//  DIALOG OPERATION: GetCurrentState
//                                              07/08/99 Modified: 07/08/99
//
//  PURPOSE:   To get the Dialog, Window, and Current Operation names for
//             the specified subtask.
//
//  PARAMETERS: vSubtask     - subtask view for the desired window
//              pchDlgTag    - return dialog tag
//              pchWndTag    - return window tag
//              pchOperation - name of the current operation (if any)
//
//  RETURNS:    -1  - Error locating window
//               0  - OK
//
/////////////////////////////////////////////////////////////////////////////
//./ END + 5
zOPER_EXPORT zSHORT OPERATION
GetCurrentState( zVIEW  vSubtask,
                 zPCHAR pchDlgTag,
                 zPCHAR pchWndTag,
                 zPCHAR pchOperation )
{
   ZSubtask *pZSubtask;

   if ( GetWindowAndCtrl( &pZSubtask, 0, vSubtask, 0 ) == 0 )
   {
      zstrcpy( pchDlgTag, *(pZSubtask->m_pzsDlgTag) );
      zstrcpy( pchWndTag, *(pZSubtask->m_pzsWndTag) );
      if ( pZSubtask->m_cpcCurrOper )
         zstrcpy( pchOperation, pZSubtask->m_cpcCurrOper );
      else
         pchOperation[ 0 ] = 0;

      return( 0 );
   }

   pchDlgTag[ 0 ] = 0;
   pchWndTag[ 0 ] = 0;
   pchOperation[ 0 ] = 0;
   return( -1 );
}
Пример #2
0
zOPER_EXPORT void OPERATION
TraceRect( zCPCHAR cpcMessage,
           RECT&   rect )
{
   zCHAR  szBuffer[ 256 ];
   zSHORT nLth;

   nLth = zstrlen( cpcMessage );
   if ( nLth < sizeof( szBuffer ) - 32 )
      zstrcpy( szBuffer, cpcMessage );
   else
      nLth = 0;

   zstrcpy( szBuffer + nLth, " X:" );
   zltoa( rect.left, szBuffer + nLth + 3 );
   nLth = zstrlen( szBuffer );
   zstrcpy( szBuffer + nLth, " Y:" );
   zltoa( rect.top, szBuffer + nLth + 3 );
   nLth = zstrlen( szBuffer );
   zstrcpy( szBuffer + nLth, " W:" );
   zltoa( rect.right - rect.left, szBuffer + nLth + 3 );
   nLth = zstrlen( szBuffer );
   zstrcpy( szBuffer + nLth, " H:" );
// zltoa( rect.bottom - rect.top, szBuffer + nLth + 3 );
   TraceLineI( szBuffer, rect.bottom - rect.top );
}
Пример #3
0
/////////////////////////////////////////////////////////////////////////////
//
//    OPERATION: zwTZERRORD_WriteErrorMsg
//
//
/////////////////////////////////////////////////////////////////////////////
zOPER_EXPORT zSHORT /*LOCAL */  OPERATION
zwTZERRORD_WriteErrorMsg( zVIEW  vSubtask,
                          zVIEW  vMetaView,
                          zPCHAR szMetaEntity,
                          zPCHAR szMetaAttribute,
                          zPCHAR szErrorMsg,
                          zSHORT nError )
{
   zVIEW  vTZERROR;
   zCHAR  szMsg[ 255 ];

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

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

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

   zstrcat( szMsg, szErrorMsg );

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

} // zwTZERRORD_WriteErrorMsg
Пример #4
0
ZAction::ZAction( zLONG lActType, zCPCHAR cpcAction,
                  zCPCHAR cpcActDlg, zCPCHAR cpcActWnd )
{
   m_lActType = lActType; // type of action requested in code for this window

   // data for requested action (e.g.  Y, 1, 2 ...)
   if ( cpcAction && cpcAction[ 0 ] )
      zstrcpy( m_szAction, cpcAction );
   else
      m_szAction[ 0 ] = 0;

   // name of dialog for the action type
   if ( cpcActDlg && cpcActDlg[ 0 ] )
      zstrcpy( m_szActDlg, cpcActDlg );
   else
      m_szActDlg[ 0 ] = 0;

   // name of window for the action type
   if ( cpcActWnd && cpcActWnd[ 0 ] )
      zstrcpy( m_szActWnd, cpcActWnd );
   else
      m_szActWnd[ 0 ] = 0;

   m_pNextAction = 0;
}
Пример #5
0
zOPER_EXPORT zSHORT OPERATION
zwTZCMRPTD_RefreshSelComponents( zVIEW vSubtask )
{
   zVIEW    vTZCMLPLO;
   zVIEW    vTZCMRPTO;
   zVIEW    vCompList;
   zVIEW    vTZCMRPTO_New;
   zCHAR    szName[ 33 ];
   zCHAR    szERR_Msg[ 254 ];

   SetNameForView( vSubtask,"TZCM_ChkInWindow", vSubtask, zLEVEL_TASK );
   GetViewByName( &vTZCMRPTO, "TZCMRPTO", vSubtask, zLEVEL_TASK );

   if ( SetCursorFirstSelectedEntity( vTZCMRPTO, "ReportLine",
                                      "" ) < zCURSOR_SET )
   {
      zstrcpy( szERR_Msg, "No Component selected to Refresh." );
      MessageSend( vSubtask, "CM00241", "Configuration Management",
                   szERR_Msg, zMSGQ_OBJECT_CONSTRAINT_WARNING, zBEEP );
      return( 0 );
   }

   if ( zwTZCMLPLD_OptionRefreshFromRepo( vSubtask, &vTZCMLPLO,
                                          szName, zRefreshUserDefined ) < 0 )
   {
      return( -1 );
   }

   GetViewByName( &vTZCMRPTO_New, "TZCMRPTO_New", vSubtask, zLEVEL_TASK );

   // if component refreshed?
   if ( CompareAttributeToInteger( vTZCMRPTO_New, "CPLR",
                                   "ComponentRefreshed", 1 ) == 0 )
   {
      zstrcpy( szERR_Msg, "Project '" );
      GetStringFromAttribute( &szERR_Msg[ zstrlen( szERR_Msg ) ], vTZCMLPLO,
                              "LPLR", "Name" );
      zstrcat( szERR_Msg, "' has been successfully refreshed \nfrom CPLR '" );
      zstrcat( szERR_Msg, szName );
      zstrcat( szERR_Msg, "'." );
      MessageSend( vSubtask, "CM00279", "Configuration Management",
                   szERR_Msg,
                   zMSGQ_OBJECT_CONSTRAINT_INFORMATION, zBEEP );
   }

   if ( GetViewByName( &vTZCMRPTO, "TZCMRPTO", vSubtask, zLEVEL_TASK ) > 0 )
      DropObjectInstance( vTZCMRPTO );

   // Build new Refresh List
   if ( zwTZCMLPLD_RefreshUserDefined( vSubtask ) < 1 )
      return( -1 );

   RefreshWindow( vSubtask );

   if ( GetViewByName( &vCompList, "CompList", vSubtask, zLEVEL_TASK ) >= 0 )
      RefreshWindow( vCompList );

   return( 0 );
} // zwTZCMRPTD_RefreshSelComponents
Пример #6
0
// Parameters:  cpcString - address of string to add
//              lFlag - 0 ==> just add string as is
//                      1 ==> add string surrounded by single quotes
//                      2 ==> add string surrounded by double quotes
//                      4 ==> add string terminated by CRLF
// Returns: Resultant length of string in memory
zLONG
ZDrMemory::AddStringToMemory( zCPCHAR cpcString, zLONG lFlag )
{
   zLONG lLth = zstrlen( cpcString );
   zLONG lAddedLth = 0;
   zCHAR chQuote = 0;

   if ( lFlag & 3 )
   {
      lAddedLth += 2;
      if ( lFlag & 1 )
         chQuote = '\'';
      else
         chQuote = '"';
   }

   if ( lLth & 4 )
      lAddedLth += 2;

   if ( lLth + m_lUsed + lAddedLth >= m_lMemorySize )
   {
      zPCHAR pch;
      zLONG  lTemp;

      if ( lLth > m_lMemorySize )
         lTemp = lLth * 2 + lAddedLth;
      else
         lTemp = m_lMemorySize * 2 + lAddedLth;

      DrAllocTaskMemory( (zCOREMEM) &pch, lTemp + 1 );
      zstrcpy( pch, m_pchMemory );
      DrFreeTaskMemory( m_pchMemory );
      m_pchMemory = pch;
   }

   if ( chQuote )
      m_pchMemory[ m_lUsed++ ] = chQuote;

   zstrcpy( m_pchMemory + m_lUsed, cpcString );
   m_lUsed += lLth;
   if ( chQuote )
   {
      m_pchMemory[ m_lUsed++ ] = chQuote;
      m_pchMemory[ m_lUsed ] = 0;
   }

   if ( lLth & 4 )
   {
      m_pchMemory[ m_lUsed++ ] = '\r';
      m_pchMemory[ m_lUsed++ ] = '\n';
      m_pchMemory[ m_lUsed ] = 0;
   }

   return( m_lUsed );
}
Пример #7
0
/////////////////////////////////////////////////////////////////////////////
//
//    OPERATION: zwTZERRORD_SetCountError
//
//
/////////////////////////////////////////////////////////////////////////////
zOPER_EXPORT zSHORT /*DIALOG */  OPERATION
zwTZERRORD_SetCountError( zVIEW vSubtask )
{
   zVIEW     vTZERROR;
   zLONG     lCountError;
   zLONG     lCountWarning;
   zSHORT    nRC;
   zCHAR     szCount[ 10 ];
   zCHAR     szControlText[ 100 ];

   if ( GetViewByName( &vTZERROR, "TZERROR", vSubtask, zLEVEL_TASK ) < 0 )
      return( -1 );

   if ( CheckExistenceOfEntity( vTZERROR, "ErrorList" ) >= zCURSOR_SET )
   {
      // Set Count Errors to Textfield
      lCountError   = 0;
      lCountWarning = 0;

      for ( nRC = SetCursorFirstEntity( vTZERROR, "ErrorMsg", "" );
            nRC >= zCURSOR_SET;
            nRC = SetCursorNextEntity( vTZERROR, "ErrorMsg", "" ) )
      {
         if ( CompareAttributeToInteger( vTZERROR, "ErrorMsg", "Error",
                                         1 ) == 0 )
            lCountError++;
         else
            lCountWarning++;
      }

      zltoa( lCountError, szCount );
      zstrcpy( szControlText, "  " );
      zstrcat( szControlText, szCount );
      zstrcat( szControlText, " Error(s) " );

      if ( lCountWarning > 0 )
      {
         zltoa( lCountWarning, szCount );
         zstrcat( szControlText, ",  " );
         zstrcat( szControlText, szCount );
         zstrcat( szControlText, " Warning(s) " );
      }

      zstrcat( szControlText, "found" );
   }
   else
   {
      zstrcpy( szControlText, "  No Errors" );
   }

   SetCtrlText( vSubtask, "txtCountError", szControlText );
   return( 0 );

} // zwTZERRORD_SetCountError
Пример #8
0
void
fnGetRootEntityName( zVIEW vObject, zPCHAR pchEntity )
{
   zCHAR szParentEntity[ 33 ];
   zstrcpy( szParentEntity, pchEntity );

   while ( szParentEntity[ 0 ] )
   {
      zstrcpy( pchEntity, szParentEntity );
      MiGetParentEntityNameForView( szParentEntity, vObject, pchEntity );
   }
}
Пример #9
0
static void
zwfnTZERRORD_WriteErrorListToFile( zVIEW vTZERROR, zLONG  FileHandle,
                                   zPCHAR szTool, zPCHAR szName, zLONG lLen )
{
   zSHORT nRC;
   zCHAR  szMsg[500];
   zCHAR  szTemp[ 255 ];
   zLONG  i;

   // write Tool and DateTime
   zstrcpy( szMsg, "Zeidon:  " );
   zstrcat( szMsg, szTool );
   zstrcat( szMsg, " Error List from " );
   GetStringFromAttributeByContext( szTemp, vTZERROR, "ErrorList",
                                    "DateTime", "DD.MM.YYYY HH:MM:SS", 20 );
   zstrcat( szMsg, szTemp );
   SysWriteLine( FileHandle, szMsg );
   SysWriteLine( FileHandle, "" );

   // write LPLR Name
   GetStringFromAttribute( szTemp, vTZERROR, "ErrorList", "LPLR_Name" );
   if ( szTemp[ 0 ] )
   {
      zstrcpy( szMsg, "Project: " );
      zstrcat( szMsg, szTemp );
      SysWriteLine( FileHandle, szMsg );
      SysWriteLine( FileHandle, "" );
   }

   // write Error Message
   for ( nRC = SetCursorFirstEntity( vTZERROR, "ErrorMsg", "" );
         nRC >= zCURSOR_SET;
         nRC = SetCursorNextEntity( vTZERROR, "ErrorMsg", "" ) )
   {
      GetStringFromAttribute( szTemp, vTZERROR, "ErrorMsg", "Name" );
      if ( zstrcmp( szTemp, "" ) != 0 )
      {
         zstrcpy( szMsg, szName );
         zstrcat( szMsg, ": " );
         zstrcat( szMsg, szTemp );
         for ( i = zstrlen( szTemp ); i < lLen; i++ )
            zstrcat( szMsg, " " );
      }

      zstrcat( szMsg, "  " );
      GetStringFromAttribute( szTemp, vTZERROR, "ErrorMsg", "ErrorText" );
      zstrcat( szMsg, szTemp );
      SysWriteLine( FileHandle, szMsg );
   }

   SysWriteLine( FileHandle, "" );
   SysWriteLine( FileHandle, "End of Error List" );
}
Пример #10
0
zOPER_EXPORT zSHORT OPERATION
OpIns_RebuildOperList( zVIEW vSubtask )
{
   zCHAR  szCurrentType[ 5 ];
   zVIEW  vProfileXFER;
   zVIEW  vEdWrk;

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

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

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

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

   return( 0 );

} // OpIns_RebuildOperList
Пример #11
0
/////////////////////////////////////////////////////////////////////////////
//
// ENTRY:
//
// PURPOSE:
//
/////////////////////////////////////////////////////////////////////////////
zOPER_EXPORT zSHORT OPERATION
zwTZHKEYAD_ExitAppl( zVIEW vSubtask )
{
   zVIEW  vKZHKEYSO;
   zSHORT nRC;

   // Get Access to current HK Object and prompt for Save.
   nRC = GetViewByName( &vKZHKEYSO, "KZHKEYSO", vSubtask, zLEVEL_ANY );
   if ( nRC > 0 && ObjectInstanceUpdatedFromFile( vKZHKEYSO ) == 1 )
   {
      zCHAR  szMsg[ 300 ];

      zstrcpy( szMsg, "Do you wish to save current Application Hotkeys?" );
      nRC = MessagePrompt( vSubtask, "HK00104",
                           "Hot Keys",
                            szMsg,
                            zBEEP, zBUTTONS_YESNOCANCEL,
                            zRESPONSE_NO,  0 );
      if ( nRC == zRESPONSE_CANCEL )
      {
         SetWindowActionBehavior( vSubtask, zWAB_ReturnToTopWindow,
                                  "TZHKEYAD", "Application" );
         return( 0 );
      }
      else
      {
         if ( nRC == zRESPONSE_YES )
            zwTZHKEYAD_SaveHK_ForLPLR( vSubtask );
      }
   }

//xTerminateLPLR( vSubtask );
   return( 0 );
}
Пример #12
0
zOPER_EXPORT void OPERATION
SetOleDateTimeFromZeidonDate( COleDateTime& DateTime, zCPCHAR cpcDate )
{
   zCHAR  szDate[ 20 ];

   // cpcDate looks like this:  YYYYMMDDhhmmssttt
   zstrcpy( szDate, cpcDate );
// DateTime.wMilliseconds = atoi( cpcDate + 14 );
   szDate[ 14 ] = 0;
   int nSecond = atoi( szDate + 12 );
   szDate[ 12 ] = 0;
   int nMinute = atoi( szDate + 10 );
   szDate[ 10 ] = 0;
   int nHour = atoi( szDate + 8 );
   szDate[ 8 ] = 0;
   int nDay = atoi( szDate + 6 );
   szDate[ 6 ] = 0;
   int nMonth = atoi( szDate + 4 );
   szDate[ 4 ] = 0;
   int nYear = atoi( szDate );

   if ( nYear == 1900 && nMonth == 1 && nDay == 1 )  // Zeidon 0-date
      DateTime.SetTime( nHour, nMinute, nSecond );
   else
   if ( nHour == 0 && nMinute == 0 && nSecond == 0 )
      DateTime.SetDate( nYear, nMonth, nDay );
   else
      DateTime.SetDateTime( nYear, nMonth, nDay, nHour, nMinute, nSecond );

   DateTime.SetStatus( COleDateTime::valid );
}
Пример #13
0
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 );
}
Пример #14
0
zOPER_EXPORT zSHORT OPERATION
zwTZCMRPTD_RefreshAllComponents( zVIEW vSubtask )
{
   zVIEW    vTZCMLPLO;
   zVIEW    vTZCMRPTO;
   zVIEW    vCompList;
   zCHAR    szName[ 33 ];
   zCHAR    szERR_Msg[ 254 ];

   if ( GetViewByName( &vTZCMRPTO, "TZCMRPTO", vSubtask, zLEVEL_TASK ) > 0 )
      DropObjectInstance( vTZCMRPTO );

   if ( zwTZCMLPLD_OptionRefreshFromRepo( vSubtask, &vTZCMLPLO,
                                          szName, zRefreshLPLR ) < 0 )
   {
      return( -1 );
   }

   zstrcpy( szERR_Msg, "Project '" );
   GetStringFromAttribute( &szERR_Msg[ zstrlen( szERR_Msg ) ], vTZCMLPLO,
                           "LPLR", "Name" );
   zstrcat( szERR_Msg, "' has been successfully refreshed." );
   MessageSend( vSubtask, "CM00279", "Configuration Management",
                szERR_Msg,
                zMSGQ_OBJECT_CONSTRAINT_INFORMATION, zBEEP );

   if ( GetViewByName( &vCompList, "CompList", vSubtask, zLEVEL_TASK ) >= 0 )
      RefreshWindow( vCompList );

   return( 0 );
} // zwTZCMRPTD_RefreshAllComponents
Пример #15
0
// Function to process the controls in order.
void
fnOrderedCtrls( const ZMapAct *pzma,
                WPARAM wParam,
                LPARAM lParam )
{
   zCHAR szBuffer[ 64 ];
   zstrcpy( szBuffer, *(pzma->m_pzsTag) );
   zstrcat( szBuffer, ": " );
   TraceLineI( szBuffer, pzma->m_nIdNbr );
}
Пример #16
0
zOPER_EXPORT void OPERATION
TracePoint( zCPCHAR cpcMessage,
            POINT&  pt )
{
   zCHAR  szBuffer[ 256 ];
   zSHORT nLth;

   nLth = zstrlen( cpcMessage );
   if ( nLth < sizeof( szBuffer ) - 32 )
      zstrcpy( szBuffer, cpcMessage );
   else
      nLth = 0;

   zstrcpy( szBuffer + nLth, " X=" );
   zltoa( pt.x, szBuffer + nLth + 3 );
   nLth = zstrlen( szBuffer );
   zstrcpy( szBuffer + nLth, " Y=" );
// zltoa( pt.y, szBuffer + nLth + 3 );
   TraceLineI( szBuffer, pt.y );
}
Пример #17
0
zOPER_EXPORT void OPERATION
TraceSize( zCPCHAR cpcMessage,
           SIZE&   size )
{
   zCHAR  szBuffer[ 256 ];
   zSHORT nLth;

   nLth = zstrlen( cpcMessage );
   if ( nLth < sizeof( szBuffer ) - 32 )
      zstrcpy( szBuffer, cpcMessage );
   else
      nLth = 0;

   zstrcpy( szBuffer + nLth, " cX=" );
   zltoa( size.cx, szBuffer + nLth + 4 );
   nLth = zstrlen( szBuffer );
   zstrcpy( szBuffer + nLth, " cY=" );
// zltoa( size.cy, szBuffer + nLth + 4 );
   TraceLineI( szBuffer, size.cy );
}
Пример #18
0
/////////////////////////////////////////////////////////////////////////////
//
//    OPERATION: zwTZERRORD_SetTitle
//
//
/////////////////////////////////////////////////////////////////////////////
zOPER_EXPORT zSHORT /*LOCAAL */  OPERATION
zwTZERRORD_SetTitle( zVIEW vSubtask )
{
   zVIEW  vTZERROR;
   zCHAR  szTitle[ 100 ];
   zCHAR  szColumnName[50];
   zLONG  lType;

   if ( GetViewByName( &vTZERROR, "TZERROR", vSubtask, zLEVEL_TASK ) < 0 )
      return( -1 );

   GetIntegerFromAttribute( &lType, vTZERROR, "ErrorList", "MetaType" );

   if ( lType == zSOURCE_ERD_META )
   {
      zstrcpy( szTitle, "Data Model Error List" );
      zstrcpy( szColumnName, "Entity" );
   }
   else
   if ( lType == zSOURCE_REPLACE_BMP )
   {
      zstrcpy( szTitle, "Bitmap Error List" );
      zstrcpy( szColumnName, "Dialog" );
   }
   else
   {
      zstrcpy( szTitle, "" );
      zstrcpy( szColumnName, "" );
   }

   SetCtrlRowColText( vSubtask, "lbErrorList", 0, 1, szColumnName );
   SetWindowCaptionTitle( vSubtask, szTitle, "" );
   return( 0 );

} // zwTZERRORD_SetTitle
Пример #19
0
/////////////////////////////////////////////////////////////////////////////
//
//    OPERATION: zwTZCMRPTD_SetCPLR_Desc
//
//
/////////////////////////////////////////////////////////////////////////////
zOPER_EXPORT zSHORT /*DIALOG */  OPERATION
zwTZCMRPTD_SetCPLR_Desc( zVIEW vSubtask )
{
   zVIEW   vTZCMRPTO;
   zCHAR   szDesc[ 255 ];
   zCHAR   szControlText[270];

   if ( GetViewByName( &vTZCMRPTO, "TZCMRPTO", vSubtask, zLEVEL_TASK ) < 0 )
      return( -1 );

   GetStringFromAttribute( szDesc, vTZCMRPTO, "CPLR", "Desc" );
   zstrcpy( szControlText, " Desc: " );
   zstrcat( szControlText, szDesc );

   SetCtrlText( vSubtask, "txtDesc", szControlText );

   return( 0 );
} // zwTZCMRPTD_SetCPLR_Desc
Пример #20
0
/////////////////////////////////////////////////////////////////////////////
//
//    OPERATION: oTZWDLGSO_ConvertCtrlTextToWeb
//
//
/////////////////////////////////////////////////////////////////////////////
zOPER_EXPORT zSHORT /*TRANSFORMATION */  OPERATION
oTZWDLGSO_ConvertCtrlTextToWeb( zVIEW vTZWDLGSO  /*  BASED ON LOD TZWDLGSO  */ )
{
   zCHAR  NewText[ 255 ];
   zCHAR  OrigText[ 255 ];
   zPCHAR pszIn;
   zPCHAR pszOutEnd;
   zPCHAR pszOut;

   // Convert the Control Text attribute to Web characters.
   // Initially, that is converting "&&" to "&amp;".
   GetVariableFromAttribute( OrigText, 0, 'S', 254,
                             vTZWDLGSO, "Control", "Text", "", 0 );
   pszIn     = OrigText;
   pszOut    = NewText;
   pszOutEnd = pszOut + 254;
   while ( pszOut < pszOutEnd && *pszIn != 0 )
   {
      if ( *pszIn == '&' )
         if ( *(pszIn + 1) == '&' )
         {
            // This is a double apersand, so convert to "&amp;".
            zstrcpy( pszOut, "&amp;" );
            pszIn  = pszIn + 2;
            pszOut = pszOut + 5;
         }
         else
         {
            // This is a single apersand, so remove it.
            pszIn++;
         }
      else
      {
         // This is reqular character, so copy it.
         *pszOut = *pszIn;
         pszOut++;
         pszIn++;
      }
   }
   *pszOut = 0;
   SetAttributeFromString( vTZWDLGSO, "Control", "Text", NewText );

   return( 0 );
} // oTZWDLGSO_ConvertCtrlTextToWeb
Пример #21
0
/////////////////////////////////////////////////////////////////////////////
//
//    OPERATION: zwTZCMRPTD_LoadNewAudittrail
//
/////////////////////////////////////////////////////////////////////////////
zOPER_EXPORT zSHORT /*DIALOG */  OPERATION
zwTZCMRPTD_LoadNewAudittrail( zVIEW vSubtask )
{
   zVIEW   vTZCMCPL;
   zVIEW   vTZBRAU2O;
   zVIEW   vParentWindow;
   zULONG  ulZKey;
   zULONG  ulZKeyCPLR;
   zCHAR   szName[ 33 ];
   zCHAR   szControlText[40];

   GetViewByName( &vTZCMCPL, "TZCMCPL", vSubtask, zLEVEL_TASK );

   GetIntegerFromAttribute( (zPLONG) &ulZKey, vTZCMCPL, "CPLR", "ZKey" );
   GetStringFromAttribute( szName, vTZCMCPL, "CPLR", "Name" );

   if ( GetViewByName( &vTZBRAU2O, "TZBRAU2O", vSubtask, zLEVEL_TASK ) > 0 )
   {
      GetIntegerFromAttribute( (zPLONG) &ulZKeyCPLR, vTZBRAU2O, "CPLR", "ZKey" );
      if ( ulZKey == ulZKeyCPLR )
         return( 0 );
      else
         DropObjectInstance( vTZBRAU2O );
   }

   if ( zwfnTZCMRPTD_LoadNewAudittrail( vSubtask, &vTZBRAU2O ) < 0 )
   {
      return( -1 );
   }

   GetStringFromAttribute( szName, vTZCMCPL, "CPL", "Name" );
   zstrcpy( szControlText, " CPL: " );
   zstrcat( szControlText, szName );
   SetCtrlText( vSubtask, "txtCPL", szControlText );

   GetParentWindow( &vParentWindow, vSubtask );
   RefreshCtrl( vParentWindow, "lbCPLRList" );

   return( 0 );
} // zwTZCMRPTD_LoadNewAudittrail
Пример #22
0
void
fnGetImageURL( ZSubtask *pZSubtask, zPCHAR pchImageURL, zSHORT nMaxLth )
{
#ifdef zREMOTE_SERVER

   if ( pZSubtask->m_pzsImageURL == 0 )
   {
      // Get Resource Image and URL names if specified.
      GetAppOrWorkstationValue( pZSubtask->m_vDialog,
                                "ExecutableRemoteImageURL",
                                pchImageURL, nMaxLth );
      pZSubtask->m_pzsImageURL = new CString( pchImageURL );
   }

   zstrcpy( pchImageURL, *(pZSubtask->m_pzsImageURL) );

#else

   pchImageURL[ 0 ] = 0;

#endif
}
Пример #23
0
zSHORT
fnRefreshComponentList( zVIEW vSubtask, zPCHAR szListType )
{
   zVIEW vListWindow;
   zVIEW vList;
   zCHAR szListView[ 10 ];

   vListWindow = 0;
   GetViewByName( &vListWindow, "APCMLIST", vSubtask, zLEVEL_TASK );
   if ( !szListType )
   {
      if ( GetViewByName( &vList, "TZLPLRLS", vSubtask, zLEVEL_TASK ) > 0 )
         DropNameForView( vList, "TZLPLRLS", vSubtask, zLEVEL_TASK );
   }
   else
   if ( szListType[ 0 ] )
   {
      zstrcpy( szListView, "TZ" );
      zstrcat( szListView, szListType );
      if ( vListWindow &&
            GetCtrlState( vListWindow, "Refer",
                                          zCONTROL_STATUS_CHECKED ) > 0 )
      {
         zstrcat( szListView, "R" );
      }
      else
         zstrcat( szListView, "S" );
      GetViewByName( &vList, szListView, vSubtask, zLEVEL_TASK );
      SetNameForView( vList, "TZLPLRLS", vSubtask, zLEVEL_TASK );
   }

   if ( vListWindow )
      RefreshWindow( vListWindow );

   return( 0 );
}
Пример #24
0
zOPER_EXPORT zSHORT OPERATION
AEQ_ClearViews( zVIEW vSubtask )
{
   zVIEW  vEdWrk;
   zSHORT nRC;

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

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

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

   AEQ_RefreshAEQ( vSubtask );

   return( 0 );
}
Пример #25
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 );
}
Пример #26
0
/////////////////////////////////////////////////////////////////////////////
//
//    OPERATION: zwTZERRORD_ErrorListSaveToFile
//
//
/////////////////////////////////////////////////////////////////////////////
zOPER_EXPORT zSHORT /*DIALOG */  OPERATION
zwTZERRORD_ErrorListSaveToFile( zVIEW vSubtask )
{
   zVIEW  vTZERROR;
   zULONG ulZFlags = 0;
   zLONG  lLth;
   zLONG  FileHandle;
   zCHAR  szMsg[300];
   zCHAR  szTool[50];
   zCHAR  szTitle[ 100 ];
   zCHAR  szName[ 33 ];
   zCHAR  szFileName[ zMAX_FILENAME_LTH + 1];

   if ( GetViewByName( &vTZERROR, "TZERROR", vSubtask, zLEVEL_TASK ) < 0 )
      return( -1 );

   if ( CompareAttributeToInteger( vTZERROR, "ErrorList", "MetaType",
                                   zSOURCE_ERD_META ) == 0 )
   {
      zstrcpy( szTool, "Data Model" );
      zstrcpy( szName, "Entity" );
      lLth = 32;
   }
   else
   if ( CompareAttributeToInteger( vTZERROR, "ErrorList", "MetaType",
                                   zSOURCE_REPLACE_BMP ) == 0 )
   {
      zstrcpy( szTool, "Bitmap" );
      zstrcpy( szName, "Dialog" );
      lLth = 8;
   }
   else
   {
      zstrcpy( szTool, "" );
      zstrcpy( szName, "" );
      lLth = 1;
   }

   szFileName[ 0 ] = 0;
   ulZFlags = zOFN_OVERWRITEPROMPT | zOFN_CREATEPROMPT | zOFN_SAVEAS | zOFN_HIDEREADONLY;

   if ( OperatorPromptForFile( vSubtask, szFileName, sizeof( szFileName ),
                               "Text Files (*.txt)|*.txt|", "txt", ulZFlags ) == 1 )
   {
      FileHandle = SysOpenFile( vSubtask, szFileName, COREFILE_WRITE );

      if ( FileHandle == -1 )
      {
         zstrcpy( szMsg, "Unable to open " );
         zstrcat( szMsg, szFileName );
         zstrcpy( szTitle, szTool );
         zstrcat( szTitle, " Maintenance" );
         MessageSend( vSubtask, "FEH001", szTitle, szMsg,
                      zMSGQ_OBJECT_CONSTRAINT_ERROR, 0 );
         return( -1 );
      }

      zwfnTZERRORD_WriteErrorListToFile( vTZERROR, FileHandle, szTool, szName, lLth );
      SysCloseFile( vSubtask, FileHandle, 0 );
   }

   return( 0 );

} // zwTZERRORD_ErrorListSaveToFile
Пример #27
0
// geoCountryCanada          39   Canada
// geoCountryUnitedStates   244   United States
zOPER_EXPORT zSHORT OPERATION
MapPointValidateAddress( zPCHAR pchStreet, zPCHAR pchCity, zPCHAR pchOtherCity,
                         zPCHAR pchRegion, zPCHAR pchPostalCode,
                         zCPCHAR cpcStreetAddress, zLONG lFlag )
{
   AFX_MANAGE_STATE( AfxGetStaticModuleState( ) );
   SHORT nRC = 0;
   ZMapPointApp *pApp = (ZMapPointApp *) ::AfxGetApp( );

   *pchStreet = 0;
   *pchCity = 0;
   *pchOtherCity = 0;
   *pchRegion = 0;
   *pchPostalCode = 0;
   if ( pApp )
   {
      TRY
      {
         if ( pApp->GetMapPointState( ) == 0 )  // not active
            return( zCALL_ERROR );

         _Application *pMP = pApp->GetMapPointApplication( );
         if ( pMP == 0 )
         {
            nRC = zCALL_ERROR;
         }
         else
         {
            _Map Map = pMP->GetActiveMap( );
         // if ( pMap == 0 )
         //    nRC = zCALL_ERROR;
         // else
            {
            // Item    item;
               zLONG   lCnt;
               VARIANT a;
               a.vt = VT_I4;
               a.lVal = 244; // geoMapNorthAmerica!
            // a.lVal = 1; // geoMapNorthAmerica!
            // a.lVal = 2; // geoMapEurope!

               StreetAddress SA = Map.ParseStreetAddress( cpcStreetAddress );
               zstrcpy( pchStreet, SA.GetStreet( ) );
               zstrcpy( pchCity, SA.GetCity( ) );
               zstrcpy( pchOtherCity, SA.GetOtherCity( ) );
               zstrcpy( pchRegion, SA.GetRegion( ) );
               zstrcpy( pchPostalCode, SA.GetPostalCode( ) );
               FindResults FR = Map.FindAddressResults( pchStreet, pchCity,
                                                        pchOtherCity,
                                                        pchRegion,
                                                        pchPostalCode, a );
               TraceLineI( "FindAddressResults Quality: ", FR.GetResultsQuality( ) );
               lCnt = FR.GetCount( );
               TraceLineI( "FindAddressResults Count: ", lCnt );
#if 0
               for ( int k = 1; k <= lCnt; k++ )
               {
                  a.lVal = k;
                  Location L = FR.GetItem( &a );
                  long lType = L.GetType( );
                  long lX = Map.LocationToX( L );
                  long lY = Map.LocationToY( L );
                  TraceLine( "Location Name: %s  Type: %d  X: %d  Y: %d",
                             L.GetName( ), lType, lX, lY );

                  Map.AddPushpin( L, L.GetName( ) );
                  PlaceCategory PC = L.GetPlaceCategory( );
                  TraceLineS( "The Place Category is: ", PC.GetName( ) );
               }
#endif
            }
         }
      }
      CATCH_ALL( e )
      {
         nRC = zCALL_ERROR;
      }
      END_CATCH_ALL
   }

   return( nRC );
}
Пример #28
0
///////////////////////////////////////////////////////////////////////
//
// PURPOSE:  This function paints the list attributes from the user spec
//           into the existing partition.
//
////////////////////////////////////////////////////////////////////////
zOPER_EXPORT zLONG OPERATION
ofnTZWDLGSO_AutoPntFldPartWLits( zVIEW  vSubtask,
                                 zVIEW  vUserSpec,
                                 zVIEW  vNewDialog,
                                 zPCHAR szListType )
{
   zVIEW  vAutoDesWk;
   zVIEW  vSubobject;
   zVIEW  vTempStyle;
   zVIEW  vCtrlDef;
   zLONG  k, j;
   zLONG  lCC, lCL;
   zLONG  lMaxLines;
   zLONG  lLine, lFirstPaintLine, lFieldsPainted, lColumn;
   zLONG  lMaxFieldDLG_X, lMaxText, lPush;
   zLONG  lGroupDLG_X, lGroupDLG_Y;
   zSHORT RESULT;
   zLONG  lLastPaintLine, lLastWindowLine, lMaxLength;
// zCHAR  cUsage[ 1 ];
   zCHAR  szMapEntity[ 33 ];
   zCHAR  szMapAttribute[ 33 ];
   zCHAR  szType[ 33 ];
   zCHAR  szWorkString[ 256 ];
   zCHAR  X_LOD_Attribute[ 16 ];
   zCHAR  X_ER_Attribute[ 15 ];

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

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

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

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

   lCL = 12;
   lCC = 5;

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

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

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

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

// cUsage[ 0 ] = 'U';

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

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

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

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

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

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

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

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

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

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

      j = j * lCC;

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

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

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

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

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

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

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

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

   lLastPaintLine = lLine;

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

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

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

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

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

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

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

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

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

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

   lLastWindowLine = lLine;

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

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

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

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

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

   /* Return the last paint line for AutoDesign */
   return( lLastPaintLine );
}
Пример #29
0
static void ProcessXwds( HWND hWnd, zVIEW vSubtask, zCHAR *cLogFile,
                         zCHAR cRemReadOnly)
{
   FILE *fLog=NULL;
   zVIEW vLPLR;
   zVIEW vDialog;
   zSHORT nRC;
   RECT rect;

   zCHAR szDialogName[32];
   zCHAR szMsg[256];
   zPCHAR pszPath;
   zCHAR szOrder[512];
   zCHAR szTargetPath[128];
   zCHAR szSourcePath[128];

   if ( cLogFile && cLogFile[0] )
      fLog = fopen( cLogFile, "w");

   if (cRemReadOnly == 'Y')
   {
      /* The program was called with parameter -r to remove the
      ** readonly attribute for all PWD-files. First we build a
      ** TMP-directory to save the original files. Then we remove
      ** the readonly attribute.
      */

      pszPath = getenv ("KZD");
      strcpy (szTargetPath, pszPath);
      strcat (szTargetPath, ":\\");
      pszPath = getenv ("KZV");
      strcat (szTargetPath, pszPath);
      strcpy (szSourcePath, szTargetPath);
      strcat (szTargetPath, "\\savexwd");
      strcat (szSourcePath, "\\a\\bin\\sys");

      strcpy (szOrder, "mkdir ");
      strcat (szOrder, szTargetPath);

      if (RunSystem (szOrder, hWnd, fLog) == -1)
      {
         if (fLog)
            fclose (fLog);
         return;
      }

      strcpy (szOrder, "xcopy ");
      strcat (szOrder, szSourcePath);
      strcat (szOrder, "\\*.pwd ");
      strcat (szOrder, szTargetPath);
      strcat (szOrder, " /K /Q");
      if (RunSystem (szOrder, hWnd, fLog) == -1)
      {
         if (fLog)
            fclose (fLog);
         return;
      }

      strcpy (szOrder, "attrib -r ");
      strcat (szOrder, szSourcePath);
      strcat (szOrder, "\\*.pwd");
      if (RunSystem (szOrder, hWnd, fLog) == -1)
      {
         if (fLog)
            fclose (fLog);
         return;
      }
   }

   RetrieveViewForMetaList( vSubtask, vSubtask, &vLPLR, zSOURCE_DIALOG_META );

   nRC = SetCursorFirstEntity( vLPLR, "W_MetaDef", "" );
   while ( nRC >= zCURSOR_SET )
   {
      GetStringFromAttribute( szDialogName,
                              vLPLR, "W_MetaDef", "Name" );

      nRC = ActivateMetaOI( &vDialog, vLPLR, zSOURCE_DIALOG_META, zSINGLE );
      if ( nRC < 0 )
      {
         zstrcpy( szMsg, "Could not Activate Dialog: " );
         zstrcat( szMsg, szDialogName );
         zstrcat( szMsg, ".\nAborting Build" );

         MessageBox( hWnd,
                  szMsg,
                  "Error Running xwdgen",
                  MB_OK | MB_ICONSTOP | MB_APPLMODAL );

         zstrcat( szMsg, "\n" );
         if ( fLog )
         {
            fputs( szMsg,fLog );
            fclose (fLog);
         }

         return ;
      }
      else
      {
         /* The dialog ACCOUNT.PWD isn't ok. Therefore we get an error message
         ** while saving the dialog and the releasebuilding system isn't running.
         ** We don't save the dialog ACCOUNT.PWD until the bug is fixed. This dialog
         ** is an example and not needed for a release.  RG, 17.12.1999
         */
         if (   strncmp (szDialogName, "TZ", 2) == 0
             || strncmp (szDialogName, "tz", 2) == 0
            )
         {
            // Send message that we are saving the XWD.
            strcpy( szMsg, "Saving Dialog: " );
            strcat( szMsg, szDialogName );
            strcpy( szOutLine, szMsg );
            GetClientRect( hWnd, &rect );
            InvalidateRect( hWnd, &rect, TRUE );
            UpdateWindow( hWnd );

            TraceLineS( "xwdgen: ", szMsg );

            if ( fLog )
            {
               zstrcat( szMsg, "\n" );
               fputs( szMsg,fLog );
            }
            else
               TraceLineS( szMsg, "" );

            SetCursorFirstEntity( vDialog, "Window", "" );
            CommitMetaOI( vDialog, zSOURCE_DIALOG_META );
            DropView( vDialog );
         }
         nRC = SetCursorNextEntity( vLPLR, "W_MetaDef", "" );
      }
   }

   if (cRemReadOnly == 'Y')
   {
      /* After saving the PWD and XWD files we have to get
      ** back the original files with readonly attribute
      */
      strcpy (szOrder, "xcopy ");
      strcat (szOrder, szTargetPath);
      strcat (szOrder, "\\*.pwd ");
      strcat (szOrder, szSourcePath);
      strcat (szOrder, " /K /Q");
      if (RunSystem (szOrder, hWnd, fLog) == -1)
      {
         if (fLog)
            fclose (fLog);
         return;
      }

      strcpy (szOrder, "rmdir /S /Q ");
      strcat (szOrder, szTargetPath);
      RunSystem (szOrder, hWnd, fLog);
   }

   if (fLog)
      fclose (fLog);
   else
      TraceLineS( "Completed XWD build", "" );

   return;

}
Пример #30
0
/////////////////////////////////////////////////////////////////////
//
// PURPOSE:  This routine paints selected fields in a list box
// or partition (all the fields are on one line) and paints the
// field literals above the listbox or partition.
//
/////////////////////////////////////////////////////////////////////
zOPER_EXPORT zSHORT OPERATION
ofnTZWDLGSO_AutoPaintListBox( zVIEW  vSubtask,
                              zVIEW  vUserSpec,
                              zVIEW  vNewDialog,
                              zPCHAR szListType )
{
   zLONG    lCC;
   zLONG    lCL;
   zSHORT   nRC;
   zLONG    lFieldRow;
   zLONG    lFieldCol;
   zLONG    lPartitionStartDLG_Y;
   zLONG    lPartitionStartDLG_X;
   zLONG    lPartitionSizeDLG_X;
   zLONG    lSubtype;
   zCHAR    szParentName[ 33 ];
   zLONG    lTempInteger_0;
   zSHORT   RESULT;
//BL   zLONG    lTempInteger_1;
   zCHAR    X_LOD_Attribute[ 16 ];

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

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

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

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

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

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

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

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

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

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

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

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

// TraceLineS("END", "AutoPaintListBox W4" );
   return( nRC );
}