コード例 #1
0
ファイル: ZDrCtl.cpp プロジェクト: arksoftgit/10c
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 );
}
コード例 #2
0
ファイル: tzadw4aw.c プロジェクト: arksoftgit/10c
zOPER_EXPORT zSHORT OPERATION
ofnTZWDLGSO_AssignTag( zVIEW  vSubtask,
                       zVIEW  vDialog,
                       zVIEW  vControl,
                       zPCHAR szType )
{
   zVIEW vTmpDlg;
   zLONG lIdx;
   zSHORT nLth;
   zCHAR szTag[ 25 ];

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

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

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

   SetAttributeFromString( vControl, "Control", "Tag", szTag );
   return( 0 );
}
コード例 #3
0
ファイル: tzedcwzd.c プロジェクト: DeegC/ZeidonTools
/*

   The user selected a LOD in the Object list.  Load the LOD meta and copy
   all object operations to the editor work object.

*/
zOPER_EXPORT zSHORT OPERATION
ObjList_AddObjOpersToWorkList( zVIEW vSubtask )
{
   zVIEW  vObjList;
   zVIEW  vLOD;
   zVIEW  vEdWrk;
   zSHORT nRC;
   zSHORT nLth;
   zCHAR  szOpName[ 255 ];

   GetWorkView( &vEdWrk );

   GetViewByName( &vObjList, "TZEDCWZD_TZCMLPLO_List", vSubtask, zLEVEL_TASK );
   ActivateMetaOI( vSubtask, &vLOD, vObjList, zREFER_LOD_META, 0 );
   GetStringFromAttribute( szOpName, vObjList, "W_MetaDef", "Name" );
   zstrcat( szOpName, "." );
   nLth = zstrlen( szOpName );

   for ( nRC = SetCursorFirstEntity( vLOD, "OperationList", 0 );
         nRC == zCURSOR_SET;
         nRC = SetCursorNextEntity( vLOD, "OperationList", 0 ) )
   {
      GetStringFromAttribute( &szOpName[ nLth ],
                              vLOD, "OperationList", "Name" );

      CreateEntity( vEdWrk, "Oper", zPOS_LAST );
      SetAttributeFromString( vEdWrk, "Oper", "Name", szOpName );
   }

   DropMetaOI( vSubtask, vLOD );
   DropView( vObjList );

   return( 0 );

} // ObjList_AddObjOpersToWorkList
コード例 #4
0
ファイル: tzcmrptd.c プロジェクト: arksoftgit/10c
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
コード例 #5
0
ファイル: netio_http.c プロジェクト: sksushilkumar/p2pship
/* callback on tcp connections */
static void 
__netio_http_cb_conn(int s, void *obj)
{
	netio_http_conn_t *h = (netio_http_conn_t*)obj;
	char *buf;

	if (!netio_http_conn_lock(h))
		return;
	
	/* write the data! */
	if ((buf = mallocz(strlen(post_header) + strlen(h->url) + 
			   zstrlen(h->content_type) + strlen(h->host) + 64 + h->data_len))) {
		int len = 0;
		if (h->buf) {
			sprintf(buf, post_header, h->url, h->host, h->data_len, h->content_type);
			len = strlen(buf);
			memcpy(buf + len, h->buf, h->data_len);
		} else {
			sprintf(buf, get_header, h->url, h->host);
			len = strlen(buf);
		}
		netio_send(s, buf, len + h->data_len);
		freez(buf);
		h->data_len = 0;
		ship_unlock(h);
	} else {
		netio_http_conn_close(h);
	}
}
コード例 #6
0
ファイル: tzcmrptd.c プロジェクト: arksoftgit/10c
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
コード例 #7
0
ファイル: ZDrVCtrl.cpp プロジェクト: DeegC/ZeidonTools
// 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 );
}
コード例 #8
0
ファイル: ZDrCtl.cpp プロジェクト: arksoftgit/10c
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 );
}
コード例 #9
0
ファイル: ZDrCtl.cpp プロジェクト: arksoftgit/10c
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 );
}
コード例 #10
0
ファイル: tzerrord.c プロジェクト: arksoftgit/10c
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" );
}
コード例 #11
0
ファイル: tzcmwkso.c プロジェクト: DeegC/10d
void OPERATION
ofnTZCMWKSO_AppendSlash( zPCHAR pchDirectory )
{
   zLONG k;

   k = zstrlen( pchDirectory );
   if ( pchDirectory[ k - 1 ] != '\\' )
   {
      pchDirectory[ k ] = '\\';
      pchDirectory[ k + 1 ] = 0;
   }
}
コード例 #12
0
ファイル: ZDrCtl.cpp プロジェクト: arksoftgit/10c
zOPER_EXPORT void OPERATION
MakeShortString( CDC *pDC, zPCHAR pchReturn, zLONG lMaxReturnLth,
                 zCPCHAR cpcString, zLONG lColLth, zLONG lOffset )
{
   static const _TCHAR szThreeDots[ ] = _T( "..." );

   if ( lMaxReturnLth == 0 )
   {
      pchReturn[ 0 ] = 0;
      return;
   }

   zstrncpy( pchReturn, cpcString, lMaxReturnLth );
   pchReturn[ lMaxReturnLth ] = 0;
   zSHORT nStringLth = zstrlen( cpcString );
   CSize  size;
   zSHORT k;

   zCHAR szFontFace[ 32 ];

   GetTextFace( pDC->m_hDC, sizeof( szFontFace ), szFontFace );
   GetTextFace( pDC->m_hAttribDC, sizeof( szFontFace ), szFontFace );
   GetTextExtentPoint32( pDC->m_hDC, cpcString, nStringLth, &size );
   if ( pDC->m_bPrinting )
      GetTextExtentPoint32( pDC->m_hAttribDC, cpcString, nStringLth, &size );

   if ( nStringLth == 0 || (size.cx + lOffset) <= lColLth )
      return;

   GetTextExtentPoint32( pDC->m_hDC, szThreeDots,
                         sizeof( szThreeDots ), &size );
   zLONG lAddLth = size.cx;

   for ( k = nStringLth - 1; k > 0; k-- )
   {
      pchReturn[ k ] = 0;
      GetTextExtentPoint32( pDC->m_hDC, pchReturn, k, &size );
      if ( pDC->m_bPrinting )
         GetTextExtentPoint32( pDC->m_hAttribDC, pchReturn, k, &size );

      if ( (size.cx + lOffset + lAddLth) <= lColLth )
         break;
   }

   zstrcat( pchReturn, szThreeDots );
}
コード例 #13
0
ファイル: xwdgen.c プロジェクト: arksoftgit/10c
/****************************************************************************

    FUNCTION: MainWndProc(HWND, UINT, WPARAM, LPARAM)

    Processes messages

****************************************************************************/
long APIENTRY MainWndProc(HWND hWnd,   /* window handle                 */
                UINT   message,   /* type of message               */
                WPARAM wParam,    /* additional information        */
                LPARAM lParam)    /* additional information        */

{
   HDC hdc;
   PAINTSTRUCT tPaint;

   switch (message)
   {
      case WM_CREATE:       /* message: command from application menu */
         // At this time the message loop is not setup.
         PostMessage( hWnd, WM_COMMAND, CMD_RUN, 0 );
         return( 0 )

      case WM_DESTROY:          /* message: window being destroyed */
         PostQuitMessage(0);
         return( 0 )

      case WM_COMMAND:
         // now the message loop is ok
         if ( wParam == CMD_RUN )
         {
            // Run the Application
            RunAppl( hWnd );
            PostQuitMessage(0);
         }
         return( 0 )

     case WM_PAINT:
         hdc = BeginPaint( hWnd, &tPaint );
         SelectObject( hdc, GetStockObject (SYSTEM_FIXED_FONT) );
         TextOut( hdc, 0, 0, szOutLine, zstrlen(szOutLine) );
         EndPaint( hWnd, &tPaint );

         return( 0 )

   }

    return DefWindowProc (hWnd, message, wParam, lParam);
} // MainWndProc
コード例 #14
0
ファイル: tzdmxgpo.c プロジェクト: arksoftgit/10c
/////////////////////////////////////////////////////////////////////////////
//
// OPERATION: oTZDMXGPO_CommitXDM
//
// PURPOSE:   Commit the current XDM to the DOMAINS.XDM file.
//
/////////////////////////////////////////////////////////////////////////////
zOPER_EXPORT zSHORT OPERATION
oTZDMXGPO_CommitXDM( zVIEW vSubtask, zVIEW vTZDMXGPO )
{
   zVIEW  vT;
   zCHAR  szXDM_FileName[ zMAX_FILESPEC_LTH + 1 ];
   zCHAR  szApplExecDir[ zMAX_FILESPEC_LTH + 1 ];
   zSHORT nRC;

// Set up the XDM File Name

   GetViewByName( &vT, "TaskLPLR", vSubtask, zLEVEL_TASK );
   GetStringFromAttribute( szXDM_FileName, vT, "LPLR", "ExecDir" );

   GetApplDirectoryFromView( szApplExecDir, vT, 2, zMAX_FILESPEC_LTH+1 );
   szApplExecDir[ zstrlen( szApplExecDir ) - 1 ] = 0;

   zstrcat( szXDM_FileName, "\\zeidon.xdm" );
   nRC = CommitOI_ToFile( vTZDMXGPO, szXDM_FileName, zASCII );
   return( nRC );
}
コード例 #15
0
ファイル: ZdCtlHot.cpp プロジェクト: DeegC/10d
// "GotoURL" function by Stuart Patterson
// As seen in the August, 1997 Windows Developer's Journal.
HINSTANCE
CHyperLink::GotoURL( zCPCHAR cpcURL, int nShowCmd )
{
   TCHAR pchKey[ MAX_PATH + MAX_PATH ];

   // First try ShellExecute( ).
   HINSTANCE hInst = ShellExecute( 0, _T( "open" ), cpcURL, 0, 0, nShowCmd );

   // If it failed, get the .htm regkey and lookup the program.
   if ( (UINT) hInst <= HINSTANCE_ERROR )
   {
      if ( GetRegKey( HKEY_CLASSES_ROOT, _T( ".htm" ), pchKey ) == ERROR_SUCCESS )
      {
         strcat_s( pchKey, _T( "\\shell\\open\\command" ) );

         if ( GetRegKey( HKEY_CLASSES_ROOT, pchKey, pchKey ) == ERROR_SUCCESS )
         {
            TCHAR *pos;
            pos = _tcsstr( pchKey, _T( "\"%1\"" ) );
            if ( pos == 0 )
            {
               // No quotes found
               pos = zstrstr( pchKey, _T( "%1" ) ); // check for %1 without quotes
               if ( pos == 0 )                      // no parameter at all ...
                  pos = pchKey + zstrlen( pchKey ) - 1;
               else
                  *pos = 0;                  // remove the parameter
            }
            else
               *pos = 0;                     // remove the parameter

            strcat_s( pos, MAX_PATH + MAX_PATH - (pos - pchKey), _T( " " ) );
            strcat_s( pos, MAX_PATH + MAX_PATH - (pos - pchKey), cpcURL );
            hInst = (HINSTANCE) WinExec( pchKey, nShowCmd );
         }
      }
   }

   return( hInst );
}
コード例 #16
0
ファイル: tzedcwzd.c プロジェクト: DeegC/ZeidonTools
/*

   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
コード例 #17
0
ファイル: tzsioprs.c プロジェクト: arksoftgit/10c
zOPER_EXPORT zSHORT OPERATION
CreateSironWorkObjectList( zPCHAR szDirectoryPath, zVIEW vSubtask )
{
   zVIEW  vImportList;
   zSHORT nRC;
   HWND   hWndList;
   zSHORT i, nCount;
   zCHAR  szMetaName[ 13 ];
   HWND   hWnd;
   HINSTANCE hInst;

   nRC = GetViewByName( &vImportList, "TZSIIMLO", NULL, zLEVEL_TASK );
   if ( nRC < 0 )
   {
      // Initialize empty list object.
      ActivateEmptyObjectInstance( &vImportList, "TZSIIMLO",
                                   vSubtask, zSINGLE );
      CreateEntity( vImportList, "Root", zPOS_AFTER );
      SetNameForView( vImportList, "TZSIIMLO",NULL, zLEVEL_TASK );
   }

   // Using the Windows interface, create an invisible window which
   // contains the list of all files in the directory pased of type *.wsk.
   // The *.wsk is passed to Windows to delineate the files listed.

   zstrcat( szDirectoryPath, "*.WSK" );

   GetWindowHandle( (zPULONG) &hWnd, 0, vSubtask, 0 );
   hInst = (HINSTANCE) GetApplicationInstance( vSubtask );

   hWndList = CreateWindow( "ListBox", NULL, WS_CHILD | LBS_SORT, 1, 1, 1, 1,
                            hWnd, (HMENU) 101, (HANDLE) hInst, NULL );

   SendMessage( hWndList, WM_SETREDRAW, FALSE, 0L );
   SendMessage( hWndList, LB_DIR,
                0x0000, (LONG)(LPSTR) szDirectoryPath );
   nCount = (int) SendMessage( hWndList, LB_GETCOUNT, 0, 0L );

   if ( nCount <= 0 )
   {
      // If there doesn't exist a WSK file disable the buttons OK and Delete
      SetCtrlState(vSubtask, "ImportWSK", zCONTROL_STATUS_ENABLED, FALSE);
      SetCtrlState(vSubtask, "DeleteWSK", zCONTROL_STATUS_ENABLED, FALSE);

      return( 0 );
   }

   for ( i = 0; i < nCount; i++ )
   {
      SendMessage( hWndList, LB_GETTEXT, i, (LONG)(LPSTR) szMetaName );
      TraceLineS( "//// List Meta Name: ", szMetaName );
      /*
       * remove 4 Bytes at the end of the string (.wsk)
       */
      *(szMetaName + zstrlen(szMetaName) -4 ) = 0;

      // Create the List entity
      CreateEntity( vImportList, "KatalogFile", zPOS_AFTER );
      SetAttributeFromString( vImportList, "KatalogFile", "Name", szMetaName );
   }

   return( 0 );
}
コード例 #18
0
ファイル: ZdCtlHDN.cpp プロジェクト: DeegC/10d
void
HyphenateHD_Text( zCPCHAR cpcText, zPCHAR pchReturn, zLONG lMaxLth, zLONG lIdx )
{
   zBOOL bGoodBreak = FALSE;
   zLONG k;

   strcpy_s( pchReturn, lMaxLth, cpcText );
// if ( zstrcmp( cpcText, "M_InsertTextKeywordTitleDU" ) == 0 )
//    TraceLineS( "HyphenateCheck ", cpcText );

   while ( lIdx > 5 && lIdx > (zLONG) (zstrlen( cpcText ) / 2) )  // purist's goto
   {
      zPCHAR  pchTemp;
      zPCHAR  pch;

      // check for lowercase/uppercase change
      k = lIdx + 1;
      while ( k > lIdx - 5 )
      {
         if ( pchReturn[ k ] == '_' || (isupper( pchReturn[ k ] ) && islower( pchReturn[ k - 1 ] )) )
         {
            if ( k <= lIdx )
            {
               bGoodBreak = TRUE;
               if ( pchReturn[ k ] == '_' )
                  lIdx = k;
               else
                  lIdx = k - 1;

               break;
            }
         }

         k--;
      }

      if ( k > lIdx - 5 )
         break;  // we found a good place to break

      // check for standard endings that would make a good place to break the text
      pchTemp = pchReturn + lIdx - 5;
      if ( (pch = zstrstr( pchTemp, "ing" )) != 0 ||
           (pch = zstrstr( pchTemp, "able" )) != 0 ||
           (pch = zstrstr( pchTemp, "tion" )) != 0 ||
           (pch = zstrstr( pchTemp, "bute" )) != 0 ||
           (pch = zstrstr( pchTemp, "er" )) != 0 )
      {
         if ( pch < pchReturn + lIdx )
         {
            k = pchReturn + lIdx - pch;
            lIdx -= k;
         }
      }

      break;  // get out of purist's goto (while)
   }

   k = ++lIdx;
   if ( bGoodBreak == FALSE )
      pchReturn[ lIdx++ ] = '-';

   pchReturn[ lIdx++ ] = '\n';
   strcpy_s( pchReturn + lIdx, lMaxLth - lIdx, cpcText + k );
}
コード例 #19
0
ファイル: currency.c プロジェクト: DeegC/10d
//./ ADD NAME=fnFormatDecimalString
// Source Module=tzapdmac.c
////////////////////////////////////////////////
//
//  ENTRY:      fnFormatDecimalString
//
//  PURPOSE:    Decorate a decimal string with 'commas' and 'periods'
//
//  PARAMETERS:
//              pchDecString - in/out decimal string
//              pchThou     - points to the thousands character separator
//              pchDecPt    - points to the decimal point character
//              lPrecision - desired number of characters to the right
//                           of the decimal point.  Note that -1 indicates
//                           variable precision.
//
//  RETURNS:
//
//              0 - Always this for now...
//
////////////////////////////////////////////////
//./ END + 5
zSHORT
fnFormatDecimalString( zPCHAR pchDecString,
                       zPCHAR pchThou,
                       zPCHAR pchDecPt,
                       zLONG  lPrecision )
{
   zPCHAR psz;
   zPCHAR psz2;
   zLONG  l;

   // Determine size of input string.
   l = zstrlen( pchDecString );

   // Locate the decimal point.
   psz = zstrchr( pchDecString, '.' );
   if ( psz )
   {
      *psz = *pchDecPt;     // decimal point, as the user likes it

      // A negative lPrecision value means variable decimal placement.
      if ( lPrecision >= 0 )
      {
         zLONG los; // desired length of string for precision

         los = (zLONG) (psz - pchDecString) +
                                          (lPrecision ? 1 : 0) + lPrecision;
         if ( los > l )
         {
            psz2 = (zPCHAR) (pchDecString + l);
            while ( los > l )
            {
               *psz2++ = '0';    // pad with trailing zeros
               l++;              // adjust string length
            }

            *psz2 = 0;           // null terminator for string
         }
         else
         {
            // This is for rounding ...
            if ( l > los)
            {
               psz2 = pchDecString;

               // Does the string need to be rounded?
               if ( *(psz2 + los + (lPrecision == 0 ? 1 : 0)) > '4' )
               {
                  l = los - 1;
                  while ( l != 0 &&
                          *(psz2 + l) == '9' || *(psz2 + l) == *pchDecPt )
                  {
                     l--;
                  }

                  if ( *(psz2 + l) == '-' )
                     l++;

                  // If the string is all 9's, add a '1' at the beginning of
                  // the string and propagate the rest of the string with 0's.
                  if ( *(psz2 + l) == '9' )
                  {
                     *(psz2 + l++) = '1';
                     while ( *(psz2 + l) != *pchDecPt && *(psz2 + l) )
                        *(psz2 + l++) = '0';

                     *(psz2 + l++) = '0';
                     // If we are at the decimal point and the attribute
                     // is not defined as whole number, add a ".0".
                     if ( lPrecision )
                     {
                        psz = psz2; // position of decimal point
                        *(psz2 + l++) = *pchDecPt;
                        *(psz2 + l++) = '0';
                        while ( l <= los )
                           *(psz2 + l++) = '0';
                     }
                     los = l;
                  }
                  else
                  {
                     // The string has a digit which requires rounding up,
                     // Round up the digit and change subsequent digits
                     // within the precision (if any) from '9' to '0'.
                     (*(psz2 + l++))++;
                     while ( l < los )
                     {
                        if ( *(psz2 + l) == *pchDecPt )
                        {
                           // if we are at the decimal point and the attribute
                           // is defined as whole number, quit
                           if ( lPrecision == 0 )
                              break;
                        }
                        else
                           *(psz2 + l) = '0';

                        l++;
                     }

                     los = l;
                  }
               }
            }

            *(psz + (lPrecision ? 1 : 0) + lPrecision) = 0; // truncate string
            l = los;             // adjust string length
         }
      }
   }
   else
   {
      // There is no decimal point in string.
      if ( lPrecision > 0 )
      {
         zLONG los; // desired length of string for precision

         /* but we want decimal fraction to show ... */
         psz = (pchDecString + l++); // point to terminator, bump str length
         *psz = *pchDecPt;        // append decimal pt
         los = (zLONG) (psz - pchDecString) + 1 + lPrecision;
         psz2 = (zPCHAR) (pchDecString + l);
         while ( los > l )
         {
            *psz2++ = '0';    // pad with trailing zeros
            l++;              // adjust string length
         }

         *psz2 = 0;           // null terminator for string.
      }
      else
         psz = pchDecString + l;  // point to string end
   }

   // psz is now pointing to decimal point or string end.

   // If there is a thousands character, add it.
   if ( pchThou != 0 )
   {
      while ( psz - pchDecString > 3 )
      {
         zPCHAR psz3;
         psz -= 3;
         if ( isdigit( *(psz - 1) ) )
         {
            /* shuffle down ... point at terminator ... bump string length */
            psz2 = (zPCHAR) (pchDecString + l++);
            psz3 = psz2 + 1;
            while ( psz3 > psz )
            {
               *psz3-- = *psz2--; // move to the right
            }

            *psz = *pchThou;       // insert thousands separator
         }
         else
            break;
      }
   }

   return( 0 );
}
コード例 #20
0
ファイル: tzadw4aw.c プロジェクト: arksoftgit/10c
///////////////////////////////////////////////////////////////////////
//
// PURPOSE:  This function paints the list attributes from the user spec
//           into the existing partition.
//
////////////////////////////////////////////////////////////////////////
zOPER_EXPORT zLONG OPERATION
ofnTZWDLGSO_AutoPntFldPartWLits( zVIEW  vSubtask,
                                 zVIEW  vUserSpec,
                                 zVIEW  vNewDialog,
                                 zPCHAR szListType )
{
   zVIEW  vAutoDesWk;
   zVIEW  vSubobject;
   zVIEW  vTempStyle;
   zVIEW  vCtrlDef;
   zLONG  k, j;
   zLONG  lCC, lCL;
   zLONG  lMaxLines;
   zLONG  lLine, lFirstPaintLine, lFieldsPainted, lColumn;
   zLONG  lMaxFieldDLG_X, lMaxText, lPush;
   zLONG  lGroupDLG_X, lGroupDLG_Y;
   zSHORT RESULT;
   zLONG  lLastPaintLine, lLastWindowLine, lMaxLength;
// zCHAR  cUsage[ 1 ];
   zCHAR  szMapEntity[ 33 ];
   zCHAR  szMapAttribute[ 33 ];
   zCHAR  szType[ 33 ];
   zCHAR  szWorkString[ 256 ];
   zCHAR  X_LOD_Attribute[ 16 ];
   zCHAR  X_ER_Attribute[ 15 ];

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

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

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

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

   lCL = 12;
   lCC = 5;

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

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

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

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

// cUsage[ 0 ] = 'U';

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

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

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

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

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

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

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

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

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

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

      j = j * lCC;

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

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

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

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

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

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

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

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

   lLastPaintLine = lLine;

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

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

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

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

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

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

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

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

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

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

   lLastWindowLine = lLine;

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

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

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

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

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

   /* Return the last paint line for AutoDesign */
   return( lLastPaintLine );
}
コード例 #21
0
ファイル: tzadw3aw.c プロジェクト: DeegC/10d
/////////////////////////////////////////////////////////////////////////////
//
// ENTRY:   CreateListBox
//
// PURPOSE: This function creates a listbox with the given
//          specifications and then autodesigns this listbox with
//          the LISTATTRIB attributes for the listbox's entity.
//          In addition to auto designing the listbox's fields, any
//          actions defined for the listbox(in the style object)
//          get autodesigned.
//
/////////////////////////////////////////////////////////////////////////////
zOPER_EXPORT zSHORT OPERATION
ofnTZWDLGSO_CreateListBox( zVIEW    vSubtask,
                           zVIEW    vNewDialog,
                           zVIEW    vUserSpec,
                           zLONG    lStart_X,
                           zLONG    lStart_Y,
                           zLONG    lHeight,
                           zPCHAR   szListType )
{
   zVIEW    vCtrlDef;
   zVIEW    vTZPNCTWO;
   zLONG    lTotalLth;
   zLONG    lAttribLth;
   zLONG    lPaintLth;
   zLONG    lCC;
   zLONG    lCL;
   zSHORT   RESULT;
   zCHAR    szPaintStr[ 50 ];
   zCHAR    X_LOD_Attribute[ 16 ];
   zCHAR    X_ER_Attribute[ 15 ];

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

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

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

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

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

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

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

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

   lTotalLth = 0;

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

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

      if ( lAttribLth > 20 )
         lAttribLth = 20;

      if ( lAttribLth < 5 )
         lAttribLth = 5;

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

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

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

   lTotalLth ++;

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

// TraceLineS("END", "CreateListBox W3" );
   return( 0 );
}
コード例 #22
0
ファイル: tzadw4aw.c プロジェクト: arksoftgit/10c
/////////////////////////////////////////////////////////////////////////////
//
// PURPOSE: This function places the paint literals of selected
// attributes above the fields in a partition or list box.
//
// vNewDialog - handle to the group
// OffsetDLG_Y - offset row to the group
// OffsetDLG_X - offset column to the group
// PartitionSize - length size of the group
//
// Return Codes:
//     0 - Everything is O.K. and the literals were placed into the
//         partition
//    -1 - The literal widths exceeded the partitions width
//
////////////////////////////////////////////////////////////////////
zOPER_EXPORT zSHORT OPERATION
ofnTZWDLGSO_AutoPaintLstLitPart( zVIEW    vSubtask,
                                 zVIEW    vUserSpec,
                                 zVIEW    vNewDialog,
                                 zLONG    OffsetDLG_Y,
                                 zLONG    OffsetDLG_X,
                                 zLONG    PartitionSize,
                                 zPCHAR   szListType )
{
   zVIEW    vCtrlDef;
   zLONG    lCC;
   zLONG    lCL;
   zLONG    lFieldCol;
   zLONG    lListAttributeLength;
   zLONG    lPaintLiteralLength;
   zCHAR    sPaintLiteral[ 65 ];
   zSHORT   RESULT;
   zLONG    lTempInteger_1;
   zLONG    lTempInteger_2;
   zCHAR    X_LOD_Attribute[ 16 ];
   zCHAR    X_ER_Attribute[ 15 ];

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

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

   lCC = 5;
   lCL = 12;

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

   lFieldCol = 1;

   RESULT = SetCursorFirstEntity( vUserSpec, X_LOD_Attribute, "" );
   while ( RESULT > zCURSOR_UNCHANGED )
   {
      /* This gets the length of the field to be painted */
      lListAttributeLength = ofnTZWDLGSO_GetSizeForListAttr( vSubtask,
                                                             vUserSpec,
                                                             szListType );

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

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

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

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

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

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

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

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

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

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

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

   return( 0 );
}
コード例 #23
0
ファイル: currency.c プロジェクト: DeegC/10d
zSHORT
fnFormatCurrencyText( zVIEW  vSubtask,
                      zPCHAR pchDecString,
                      zPCHAR pchThou,
                      zPCHAR pchDecPt,
                      zLONG  lPrecision )
{
   char   szCurrencyText[ zMAX_DECIMAL_STRING ];
   zPCHAR pcDecimal;
   zPCHAR pch;
   zSHORT nLth;
   zSHORT nCurrencyLth;
   zSHORT nPlace;
   zSHORT nPower;

   // Check if there is a decimal point
   pcDecimal = zstrchr( pchDecString, '.' );
   if ( pcDecimal )
   {
      *pcDecimal = 0;
      pcDecimal++;
   }
   else
   {
      pcDecimal = pchDecString + zstrlen( pchDecString );
   }

   // Remove leading blanks or zeros.
   pch = pchDecString;
   while ( *pch == ' ' || *pch == '0' )
      pch++;

   // Handle case of no nonzero value.
   nLth = zstrlen( pch );
   if ( nLth == 0 )
   {
      strcpy_s( szCurrencyText, zsizeof( szCurrencyText ), pcDecimal );
      strcpy_s( pchDecString, "0" );
      strcpy_s( pchDecString + 2, szCurrencyText );
      pch = pchDecString;
      pcDecimal = pchDecString + 2;
      nLth = 1;
   }

   // Leading zeros have been eliminated except for the essential one in
   // the one's place.

   // Process whole number part of decimal.
   szCurrencyText[ 0 ] = 0;
   nCurrencyLth = 0;
   while ( nLth )
   {
      nPlace = (nLth - 1) / 3;
      nPower = nLth % 3;    // Hundreds = 3, Tens = 2, Ones = 1
      if ( nPower == 0 )
         nPower = 3;

      switch ( nPlace )
      {
         case zPLACE_TRILLIONS:
         {
            nCurrencyLth += HundredsTensOnes( vSubtask,
                                              szCurrencyText + nCurrencyLth,
                                              pch, IDS_TRILLION, nPower );
            break;
         }

         case zPLACE_BILLIONS:
         {
            nCurrencyLth += HundredsTensOnes( vSubtask,
                                              szCurrencyText + nCurrencyLth,
                                              pch, IDS_BILLION, nPower );
            break;
         }

         case zPLACE_MILLIONS:
         {
            nCurrencyLth += HundredsTensOnes( vSubtask,
                                              szCurrencyText + nCurrencyLth,
                                              pch, IDS_MILLION, nPower );
            break;
         }

         case zPLACE_THOUSANDS:
         {
            nCurrencyLth += HundredsTensOnes( vSubtask,
                                              szCurrencyText + nCurrencyLth,
                                              pch, IDS_THOUSAND, nPower );
            break;
         }

         case zPLACE_ONES:
         {
            nCurrencyLth += HundredsTensOnes( vSubtask,
                                              szCurrencyText + nCurrencyLth,
                                              pch, 0, nPower );
            break;
         }

         default:
         {
            fnFormatDecimalString( pchDecString, pchThou,
                                   pchDecPt, lPrecision );
            return( 1 );
         }
      }

      pch += nPower;
      nLth -= nPower;
      while ( *pch == '0' )
      {
         pch++;
         nLth--;
      }
   }

   // Add "AND" between whole number & decimal part.
   nCurrencyLth += fnLoadString( vSubtask,
                                 "domainc", IDS_AND,
                                 szCurrencyText + nCurrencyLth,
                                 zMAX_DECIMAL_STRING - nCurrencyLth );
   szCurrencyText[ nCurrencyLth++ ] = ' ';


   // Process decimal part of number.

   // If the decimal portion is not filled with digits, fill it with zeros.
   if ( *pcDecimal == 0 )
   {
      *pcDecimal = '0';
      *(pcDecimal + 1) = '0';
   }
   else
   if ( *(pcDecimal + 1) == 0 )
   {
      *(pcDecimal + 1) = '0';
   }

   *(pcDecimal + 2) = 0;
   nCurrencyLth += TensOnes( vSubtask, szCurrencyText + nCurrencyLth,
                             pcDecimal, 2 );
   nCurrencyLth += fnLoadString( vSubtask,
                                 "domainc", IDS_HUNDRETHS_DOLLARS,
                                 szCurrencyText + nCurrencyLth,
                                 zMAX_DECIMAL_STRING - nCurrencyLth );

   strcpy_s( pchDecString, szCurrencyText );
   return( 0 );
}
コード例 #24
0
ファイル: ZDrVCtrl.cpp プロジェクト: DeegC/ZeidonTools
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
//
//    OPERATION: CreateCommaSeparatedList
//
//    N.B.  The user is responsible for calling DeleteCommaSeparatedList
//          with the handle returned from this call.  If not, a memory
//          leak will occur!!!
//
//    lFlags - 0x00000001 ==> use only selected entities
//             0x00000002 ==> use only parent-selected entities
//             0x00000004 ==> use semi-colon to separate (rather than comma)
//
/////////////////////////////////////////////////////////////////////////////
zOPER_EXPORT zLONG OPERATION
CreateCommaSeparatedList( zVIEW   v,
                          zCPCHAR cpcEntityName,
                          zCPCHAR cpcAttributeName,
                          zCPCHAR cpcContext,
                          zCPCHAR cpcScope,
                          zLONG   lFlags )
{
   zCHAR  szParentEntity[ 33 ];
   zPCHAR lpMemory;
   zLONG  lEntityCnt;
   zULONG ulAttributeLth;
   zLONG  lTotalSize;
   zLONG  lLth = 0;
   zCHAR  cSeparator;

   zSHORT nRC;

   if ( (lFlags & 0x00000002) )
   {
      MiGetParentEntityNameForView( szParentEntity, v, cpcEntityName );
   // if ( szParentEntity[ 0 ] )
   //    SetCursorFirstEntity( v, szParentEntity, cpcScope );
   }

   if ( (lFlags & 0x00000004) == 0 )
      cSeparator = ',';
   else
      cSeparator = ';';

   lEntityCnt = CountEntitiesForView( v, cpcEntityName );
   GetAttributeDisplayLength( &ulAttributeLth, v, cpcEntityName,
                              cpcAttributeName, cpcContext );
   lTotalSize = lEntityCnt * (zLONG) ulAttributeLth;  // a starting point
   DrAllocTaskMemory( (zCOREMEM) &lpMemory, lTotalSize + 1 );

   // For each entity, append the specified data to the list.
// nRC = SetCursorFirstEntity( v, cpcEntityName, cpcScope );
   nRC = SetEntityCursor( v, cpcEntityName, 0, zPOS_FIRST,
                          0, 0, 0, 0, cpcScope, 0 );
   while ( nRC > zCURSOR_UNCHANGED )
   {
      if ( (lFlags & 0x00000001) == 0 ||
           ((lFlags & 0x00000001) &&
            GetSelectStateOfEntity( v, cpcEntityName ) != 0) ||
           ((lFlags & 0x00000002) &&
            GetSelectStateOfEntity( v, szParentEntity ) != 0) )
      {
         GetVariableFromAttribute( lpMemory + lLth, 0, zTYPE_STRING,
                                   lTotalSize - lLth - 1, v,
                                   cpcEntityName, cpcAttributeName,
                                   cpcContext,
                                   cpcContext && *cpcContext ?
                                      0: zUSE_DEFAULT_CONTEXT );
         lLth = zstrlen( lpMemory );
         while ( lLth > 0 && lpMemory[ lLth - 1 ] == ' ' )
         {
            lLth--;
            lpMemory[ lLth ] = 0;
         }
      }

   // nRC = SetCursorNextEntity( v, cpcEntityName, cpcScope );
      nRC = SetEntityCursor( v, cpcEntityName, 0, zPOS_NEXT,
                             0, 0, 0, 0, cpcScope, 0 );
      if ( nRC > zCURSOR_UNCHANGED )
      {
      // lLth = zstrlen( lpMemory );
         if ( lTotalSize - lLth < (zLONG) ulAttributeLth )
         {
            zPCHAR lpTemp;

            lEntityCnt *= 2;
            lTotalSize = lEntityCnt * (zLONG) ulAttributeLth;

            DrAllocTaskMemory( (zCOREMEM) &lpTemp, lTotalSize + 1 );
            zmemcpy( lpTemp, lpMemory, lLth );
            DrFreeTaskMemory( lpMemory );
            lpMemory = lpTemp;
         }

         if ( lLth > 0 && lpMemory[ lLth - 1 ] != cSeparator )
         {
            lpMemory[ lLth++ ] = cSeparator;
            lpMemory[ lLth ] = 0;
         }
      }
   }

   return( (zLONG) lpMemory );
}
コード例 #25
0
ファイル: sipp_mp.c プロジェクト: sksushilkumar/p2pship
/* dumps the current status of all mediaproxies as a json blob */
int
sipp_mp_dump_json(char **msg)
{
	int buflen = 0, datalen = 0;
	char *buf = 0;
	void *ptr = 0, *ptr2 = 0;
        sipp_media_proxy_t *mp = NULL;
	char *tmpaddr1 = 0, *tmpaddr2 = 0, *tmp = 0;
	ship_list_t *callids = 0;
	char *str = 0;
	int ret = -1;
	ship_lock(sipp_mps);
	
	/* collect callids */
	ASSERT_TRUE(callids = ship_list_new(), err);
	while ((mp = ship_list_next(sipp_mps, &ptr))) {
		int found = 0;
		while (!found && (str = ship_list_next(callids, &ptr2))) {
			if (!strcmp(str, mp->callid))
				found = 1;
		}
		
		if (!found) {
			ship_list_add(callids, mp->callid);
		}
	}
	
	/* for each call id .. */
	ASSERT_TRUE(buf = append_str("var p2pship_mps = {\n", buf, &buflen, &datalen), err);
	ptr2 = 0;
	while ((str = ship_list_next(callids, &ptr2))) {
		ASSERT_TRUE(buf = append_str("     \"", buf, &buflen, &datalen), err);
		ASSERT_TRUE(buf = append_str(str, buf, &buflen, &datalen), err);
		ASSERT_TRUE(buf = append_str("\" : [\n", buf, &buflen, &datalen), err);

		ptr = 0;
		while ((mp = ship_list_next(sipp_mps, &ptr))) {
			int len = 0;
			
			if (!strcmp(mp->callid, str)) {
				ASSERT_ZERO(ident_addr_addr_to_str(&(mp->local_addr), &tmpaddr1), err);
				ASSERT_ZERO(ident_addr_addr_to_str(&(mp->remote_addr), &tmpaddr2), err);
				
				len = zstrlen(mp->sip_aor) + zstrlen(tmpaddr1) + zstrlen(mp->remote_aor) + zstrlen(tmpaddr2) + 
					zstrlen(mp->callid) + zstrlen(mp->mediatype) + 512;
				ASSERT_TRUE(tmp = mallocz(len), err);
				
				sprintf(tmp, "         [ \"%s\", \"%s\", \"%s\", \"%s\", \"%s\",\n           \"%s\", \"%s\", \"%d\", \"%d\", \"%d\", \"%d\" ],\n",
					mp->sip_aor, tmpaddr1, mp->remote_aor, tmpaddr2, sipp_mp_sendby_str(mp->sendby),
					mp->callid, mp->mediatype,
					mp->started, (int)mp->start_time, (int)mp->last, mp->counter);
				
				ASSERT_TRUE(buf = append_str(tmp, buf, &buflen, &datalen), err);
				freez(tmp);
				freez(tmpaddr1);
				freez(tmpaddr2);
			}
		}
		ASSERT_TRUE(replace_end(buf, &buflen, &datalen, ",\n", "\n"), err);
		ASSERT_TRUE(buf = append_str("     ],\n", buf, &buflen, &datalen), err);
	}

	ASSERT_TRUE(replace_end(buf, &buflen, &datalen, ",\n", "\n"), err);
	ASSERT_TRUE(buf = append_str("};\n", buf, &buflen, &datalen), err);
	*msg = buf;
	buf = 0;
	ret = 0;
 err:
	ship_unlock(sipp_mps);
	ship_list_free(callids);
	freez(buf);
	freez(tmpaddr1);
	freez(tmpaddr2);
	freez(tmp);
	return ret;
}
コード例 #26
0
ファイル: currency.c プロジェクト: DeegC/10d
zSHORT
fnGetCurrencyText( LPDOMAINDATA lpDomainData )
{
   LPDOMAIN    lpDomain;
   zLPCONTEXT  lpContext;
   zSHORT      nRC;
   zCHAR       sz[ 200 ];
   zPCHAR      lpAttrValue;
   zCHAR       cAttrType;
   zULONG      uAttrLength;
   zBOOL       bWasNull = FALSE;
   zCHAR       szThou[ 10 ];
   zCHAR       szDecPt[ 10 ];
   zLONG       lPrecision;
   zDECIMAL    dDecimal;
   zDECIMAL    dNullDecimal;

   lpDomain = (LPDOMAIN) SysGetPointerFromHandle( lpDomainData->lpViewAttribute->hDomain );
   SysAssignDecimalFromNull( &dNullDecimal );

   if ( lpDomainData->lpViewAttribute->cType != zTYPE_DECIMAL )
   {
      *sz = lpDomainData->lpViewAttribute->cType;
      *(sz + 1) = 0;
      strcat_s( sz, zsizeof( sz ), ", " );
      strcat_s( sz, zsizeof( sz ), lpDomainData->lpViewEntity->szName );
      MessageSend( lpDomainData->zView, "", "Domain System Error",
                   sz, zMSGQ_DOMAIN_ERROR, 0 );
      return( zCALL_ERROR );
   }

   // determine output data type
   switch ( lpDomainData->cType )
   {
    case zTYPE_STRING:

      // Get a pointer to the attribute value.
      nRC = GetValueFromRecord( lpDomainData->zView,
                                lpDomainData->lpViewEntity,
                                lpDomainData->lpViewAttribute,
                                &lpAttrValue, &cAttrType, &uAttrLength );
      if ( nRC )
         return( zCALL_ERROR );

      // if there is no lpRecord, lpAttrValue returns a null...
      if ( lpAttrValue == 0 )
         lpAttrValue = (zPCHAR) &dNullDecimal;

      // Get the decimal characteristics.
      if ( lpDomainData->pszContextName && *lpDomainData->pszContextName )
      {
         if ( GetContext( &lpContext, lpDomain, lpDomainData->pszContextName ) )
         {
            // Get the formatting characters.
            nRC = fnGetDecimalFmtStrings( lpContext, szThou, szDecPt,
                                          &lPrecision );


         }
         else
         {
            MessageSend( lpDomainData->zView, "", "Domain System Error",
                         "Invalid Context for Currency Text",
                         zMSGQ_DOMAIN_ERROR, 0 );
            return( zCALL_ERROR );
         }
      }
      else
      {
         GetDefaultContext( &lpContext, lpDomain );
         fnGetDecimalFmtStrings( lpContext, szThou, szDecPt, &lPrecision );
      }

      // Convert the decimal to a basic string.
      if ( SysCompareDecimalToNull( (zPDECIMAL) lpAttrValue ) == 0 )
      {
         *((zPCHAR) lpDomainData->lpData) = 0;
         strcpy_s( sz, zsizeof( sz ), "0.0" );
         bWasNull = TRUE;
      }
      else
      {
         SysAssignDecimalFromDecimal( &dDecimal, (zPDECIMAL) lpAttrValue );
         SysConvertDecimalToString( &dDecimal, sz, (zSHORT) lPrecision );
      }

      // Convert the decimal string to correct precision and international
      // formatting characters.
      if ( szThou[ 0 ] == 0 )
      {
         if ( szDecPt[ 0 ] == 0 )
            fnFormatDecimalString( sz, 0, 0, lpDomain->lDecimalFormat );
         else
            fnFormatDecimalString( sz, 0, szDecPt, lPrecision );
      }
      // Convert the string decimal to the character string.
      fnFormatCurrencyText( lpDomainData->zView, sz,
                            szThou, szDecPt, lPrecision );
      // Return the formatted decimal, unless the return area is not
      // large enough, in that case fill it with '*'.
      if ( lpDomainData->uMaxStringLength && zstrlen( sz ) > lpDomainData->uMaxStringLength )
      {
         zmemset( (zPCHAR) lpDomainData->lpData, '*', lpDomainData->uMaxStringLength );
         *((zPCHAR) lpDomainData->lpData + lpDomainData->uMaxStringLength) = 0;
         nRC = zCALL_ERROR;
      }
      else
      {
         strcpy_s( (zPCHAR) lpDomainData->lpData, lpDomainData->uMaxStringLength, sz );
         nRC = bWasNull ? -1 : 0;
      }

      break;


    default:
      *sz = lpDomainData->cType;
      *(sz + 1) = 0;
      strcat_s( sz, zsizeof( sz ), ", " );
      strcat_s( sz, zsizeof( sz ), lpDomainData->lpViewEntity->szName );
      MessageSend( lpDomainData->zView, "", "Domain System Error",
                   sz, zMSGQ_DOMAIN_ERROR, 0 );
      return( zCALL_ERROR );
   }

   return( 0 );
}
コード例 #27
0
ファイル: ZdCtlChk.cpp プロジェクト: arksoftgit/10c
// ZCheckBox - ctor
ZCheckBox::ZCheckBox( ZSubtask *pZSubtask,
                      CWnd     *pWndParent,
                      ZMapAct  *pzmaComposite,
                      zVIEW    vDialog,
                      zSHORT   nOffsetX,
                      zSHORT   nOffsetY,
                      zKZWDLGXO_Ctrl_DEF *pCtrlDef ) :
           CButton( ),
           ZMapAct( pZSubtask,            // base class ctor
                    pzmaComposite,
                    pWndParent,
                    this,
                    vDialog,
                    nOffsetX,
                    nOffsetY,
                    pCtrlDef,
                    "CheckBox" )
{
#ifdef DEBUG_ALL
   TraceLineI( "In ctor for CheckBox", (zLONG) this );
#endif

   if ( pCtrlDef->Subtype & zCONTROL_SIZEABLEBORDER )
      Attr.Style |= WS_THICKFRAME;
   else
   if ( !(pCtrlDef->Subtype & zCONTROL_BORDEROFF) )
      Attr.Style |= WS_BORDER;

   if ( pCtrlDef->Subtype & zCONTROL_NOTABSTOP )
      Attr.Style &= ~WS_TABSTOP;
   else
      Attr.Style |= WS_TABSTOP;

   m_pzsValueOn = 0;
   m_pzsValueOff = 0;

   zPCHAR pch = (zPCHAR) pCtrlDef->CtrlBOI;
   if ( pch == 0 )      // there is no CtrlBOI
      return;

   zPCHAR pchAmpersand = zstrchr( *m_pzsText, '&' );
   while ( pchAmpersand )
   {
      pchAmpersand++;
      if ( *pchAmpersand == '&' )
         pchAmpersand++;
      else
      {
         m_chQuickKey = toupper( *pchAmpersand );
         break;
      }

      pchAmpersand = zstrchr( pchAmpersand, '&' );
   }

   m_pzsValueOn = new CString( pch );
   pch += zstrlen( pch ) + 1;
   m_pzsValueOff = new CString( pch );

   BOX_SIZE = 13;  // ASSERT( BOX_SIZE > 1 );  ASSERT( BOX_SIZE < 30 );
   if ( pCtrlDef->Subtype & zCHECKBOX_XCHECK )
      m_resID = IDB_CB_XCHECK;
   else
   if ( pCtrlDef->Subtype & zCHECKBOX_LED )
   {
      m_resID = IDB_CB_LED;
      BOX_SIZE = 11;
   }
   else
      m_resID = IDB_CB_CHECKMARK;

   // load state bitmaps
   m_bmpSrc = LoadBitmap( AfxGetResourceHandle( ), MAKEINTRESOURCE( m_resID ) );
   ASSERT( m_bmpSrc ); // bitmap resource ID valid?

   m_bLeftText = FALSE;
   m_bDisabled = FALSE;
   m_bChecked  = FALSE;
   m_lState    = BOX_OFF;

   m_bInRect    = FALSE;
   m_bSpaceDown = FALSE;
   m_bMouseDown = FALSE;

   m_brush = 0;
   m_clr = CLR_INVALID;
   m_bHasFocus = FALSE;
   m_bPrepareBitmaps = TRUE;

   for ( int k = 0; k < 6; k++ )
      m_bitmaps[ k ] = 0;

#ifndef zREMOTE_SERVER
   if ( pzmaComposite == 0 ||
        (pzmaComposite->m_ulMapActFlag2 & zMAPACT_CREATE_CHILDREN) )
#endif
   {
      CreateZ( );
   }
}
コード例 #28
0
ファイル: tzadw4aw.c プロジェクト: arksoftgit/10c
/////////////////////////////////////////////////////////////////////////////
//
// PURPOSE: This function places selected attributes in an already
// existing partition without the attributes text literals.
//
// vNewDialog - handle to the partition
// lFieldRow - offset row in the group
// lFieldCol - offset column in the group
// PartitionSize - length size for the group
//
// Return Codes:
//     0 - Everything is O.K. and the fields were placed into the
//         partition
//    -1 - The field widths exceeded the partitions width
//
/////////////////////////////////////////////////////////////////////////////
zOPER_EXPORT zSHORT OPERATION
ofnTZWDLGSO_AutoPaintListPart( zVIEW    vSubtask,
                               zVIEW    vUserSpec,
                               zVIEW    vNewDialog,
                               zLONG    lFieldRow,
                               zLONG    lFieldCol,
                               zLONG    PartitionSize,
                               zPCHAR   szListType )
{
   zVIEW    vAutoDesWk;
   zVIEW    vTempStyle;
   zVIEW    vSubobject;
   zVIEW    vCtrlDef;
   zLONG    lListAttributeLength;
   zLONG    lPaintLiteralLength;
   zLONG    lCC;
   zLONG    lCL;
   zCHAR    szControlType[ 33 ];
   zCHAR    szMapEntity[ 33 ];
   zCHAR    szParentName[ 33 ];
   zCHAR    szWorkString[ 65 ];
   zCHAR    szLiteralString[ 65 ];
   zLONG    lTempInteger_0;
   zSHORT   RESULT;
   zSHORT   lFieldsPainted;
   zLONG    lRC;
   zCHAR    X_LOD_Attribute[ 16 ];
   zCHAR    X_LOD_Entity[ 13 ];
   zCHAR    X_ER_Attribute[ 15 ];

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

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

   lCL = 12;
   lCC = 5;

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

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

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

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

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

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

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

   lFieldsPainted = 0;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

   DropView( vSubobject );
   DropView( vTempStyle );
// TraceLineS("END", "AutoPaintListPart W4" );
   return( 0 );
}
コード例 #29
0
ファイル: TzCtlTAB.cpp プロジェクト: DeegC/10d
/////////////////////////////////////////////////////////////////////////////
//
//  CONSTRUCTOR: Tab sub-control (to group controls at the tab level)
//
/////////////////////////////////////////////////////////////////////////////
// ctor
TZNotePage::TZNotePage( TZPainterWindow *pPainterWindow,
                        TZPainterCtrl   *pCtrlParent,
                        CWnd    *pWndParent,
                        CRect&  rect,
                        zVIEW   vCtrl,
                        zLONG   lType,
                        zBOOL   bPlaceHolder,
                        zLONG   lZKey,
                        zLONG   lTabStopNbr,
                        zLONG   lCtrlID,
                        zPCHAR  pchTag,
                        zPCHAR  pchText ) :
            CWnd( ),
            TZPainterCtrl( pPainterWindow, pCtrlParent, pWndParent,
                           rect, vCtrl, this, pchTag, pchText,
                           lType, bPlaceHolder, lZKey, lTabStopNbr, lCtrlID )
{
#ifdef DEBUG_ALL
   TraceLineS( "TZNotePage::ctor ", m_csTag );
#endif
   m_pNext = 0;
   m_uVisible = 0x0100;

   m_lSubtype = 0;

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

   zPCHAR pch;
   zLONG  lTabNbr;
   zLONG  lLth;

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

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

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

         m_lSubtype = m_pZNoteBook->m_nTabNbrMax;
      }

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

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

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

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

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

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

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

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

   CreateZ( );
}
コード例 #30
0
ファイル: tzvminaa.c プロジェクト: DeegC/10d
//
// OPERATION: LoadXPG
//
// DESCRIPTION: LoadXPG Gets the executable directory from the TaskLPLR.
//    It then creates a file name from which to load the pared instance file.
//    If the load is successful then the view is names in the interp
//    subtask as XPG.
//
zOPER_EXPORT zSHORT OPERATION
LoadXPG( zVIEW  lpInterpSubtask,                      // interpretor subtask
         zVIEW  vSubtask,                             // application subtask
         zPCHAR szSrcDLLName,                         // source dllname
         zCPCHAR cpcGenLang )
{

   zVIEW  vViewObject;                                       // task view
   zCHAR  szExecDir[ zMAX_FILESPEC_LTH + 1 ];                // dir string
   zCHAR  szMessage[ zMAX_MESSAGE_LTH + 1 ];
   zLONG  lParserVersion = 0;
   zSHORT nLth;                                              // string length
   zSHORT nRC;

   // First check to see if it already exists.
   GetViewByName( &g_vXPGView, "XPG", lpInterpSubtask, zLEVEL_SUBTASK );
   if ( g_vXPGView != 0 )
      return( 0 );

   // get a view to the Task LPLR
   if ( GetViewByName( &vViewObject, "TaskLPLR", vSubtask, zLEVEL_TASK ) != zLEVEL_TASK )
   {
      return( -1 );
   }

   // get the exec directory
   GetStringFromAttribute( szExecDir, zsizeof( szExecDir ), vViewObject, "LPLR", "ExecDir" );

   // be sure it was terminated with a '\'
   nLth = (zSHORT) zstrlen( szExecDir );
   if ( szExecDir[ nLth ] != '\\' )
   {
      szExecDir[ nLth ] = '\\';
      szExecDir[ nLth + 1 ] = 0;
   }

   // concat the name. and the .XPG extention
   strcat_s( szExecDir, zsizeof( szExecDir ), szSrcDLLName );
   if ( cpcGenLang[ 0 ] == 'J' )
      strcat_s( szExecDir, zsizeof( szExecDir ), ".XPJ" );
   else
      strcat_s( szExecDir, zsizeof( szExecDir ), ".XPG" );

   // activate the file
   nRC = ActivateOI_FromFile( &g_vXPGView,
                                   "TZVSPOOO",
                                   lpInterpSubtask,
                                   szExecDir,
                                   zSINGLE | zNOI_OKAY |
                                   zIGNORE_ATTRIB_ERRORS );

   if ( nRC != 0 ) //  failed
   {
      strcpy_s( szMessage, zsizeof( szMessage ), "Source VML :" );
      strcat_s( szMessage, zsizeof( szMessage ), szSrcDLLName );
      strcat_s( szMessage, zsizeof( szMessage ), " must be parsed prior to execution" );
      MessageSend( lpInterpSubtask, "VM03002", "VML Interpretor",
                   szMessage,
                   zMSGQ_OBJECT_CONSTRAINT_ERROR, zBEEP );
      TraceLineS( "Could Not Load ", szExecDir );
      return( -1 );
   }
   // do the Parser Version Compatibility Check
#define PARSER_VERSION_REQUIRED 1
   nRC = GetIntegerFromAttribute( &lParserVersion, g_vXPGView,
                                       "VML_XSource",  "ParserVersion" );
   if ( nRC != 0 || lParserVersion < PARSER_VERSION_REQUIRED )
   {
      // the XPG is too old, and not compatible with the current
      //  interpreter.
      strcpy_s( szMessage, zsizeof( szMessage ), "Source VML :" );
      strcat_s( szMessage, zsizeof( szMessage ), szSrcDLLName );
      strcat_s( szMessage, zsizeof( szMessage ),
         " is outdated and must be re-parsed prior to execution" );
      MessageSend( lpInterpSubtask, "VM03002", "VML Interpretor",
                   szMessage,
                   zMSGQ_OBJECT_CONSTRAINT_ERROR, zBEEP );
      TraceLineS( "Program File Outdated : ", szExecDir );
      return( -1 );
   }

   // name the view to the interpretor subtask
   SetNameForView( g_vXPGView, "XPG", lpInterpSubtask, zLEVEL_SUBTASK );

   return( 0 );
}