예제 #1
0
void
fnMapCtrlsFromOI( ZMapAct *pzma,
                  WPARAM  wParam,
                  LPARAM  lParam )
{
#ifdef DEBUG_ALL
   TraceLineS( "MapCtrlsFromOI: ", *(pzma->m_pzsTag) );
   if ( zstrcmp( *(pzma->m_pzsTag), "Text42" ) == 0 )
      TraceLineS( "Before MapCtrlsFromOI: ", *(pzma->m_pzsTag) );
#endif

   // Map all except the one(s) specified (if any).
   if ( pzma &&
        (lParam == 0 || fnFindCtrlInList( pzma, (zCPCHAR) lParam ) == FALSE) )
   {
#ifdef DEBUG_ALL
      if ( zstrcmp( *(pzma->m_pZSubtask->m_pzsWndTag), "Invoice" ) == 0 &&
           pzma->m_pzsAName && pzma->m_pzsEName )
      {
         zVIEW vApp;

         GetViewByName( &vApp, "mInvO",
                        pzma->m_pZSubtask->m_vDialog, zLEVEL_ANY );
      // GetViewByName( &vApp, *(pzma->m_pzsVName),
      //                pzma->m_pZSubtask->m_vDialog, zLEVEL_ANY );
         if ( vApp )
         {
            DisplayEntityInstance( vApp, "ReceiptApplied" );
         // DisplayEntityInstance( vApp, *(pzma->m_pzsEName) );
         }
      }
#endif

      pzma->MapFromOI( wParam );

#ifdef DEBUG_ALL
   // if ( zstrcmp( *(pzma->m_pzsTag), "Text42" ) == 0 ||
   //      zstrcmp( *(pzma->m_pzsTag), "Text44" ) == 0 )
      if ( zstrcmp( *(pzma->m_pZSubtask->m_pzsWndTag), "Invoice" ) == 0 &&
           pzma->m_pzsAName && pzma->m_pzsEName )
      {
         zVIEW vApp;

         TraceLineS( "After MapCtrlsFromOI: ", *(pzma->m_pzsTag) );
         GetViewByName( &vApp, "mInvO",
                        pzma->m_pZSubtask->m_vDialog, zLEVEL_ANY );
         if ( vApp )
            DisplayEntityInstance( vApp, "ReceiptApplied" );
      }
#endif
   }
}
예제 #2
0
// Function to process the controls in order for mapping to the OI.
void
fnMapCtrlsToOI( ZMapAct *pzma,
                WPARAM  wParam,
                LPARAM  lParam )
{
#if 0 //def DEBUG_ALL lots of messages
   if ( pzma )
   {
      TraceLineS( "Map to OI from control: ", *(pzma->m_pzsTag) );
      if ( zstrcmp( *(pzma->m_pZSubtask->m_pzsWndTag), "Invoice" ) == 0 &&
           pzma->m_pzsAName && pzma->m_pzsEName )
      {
         zVIEW vApp;

         GetViewByName( &vApp, "mInvO",
                        pzma->m_pZSubtask->m_vDialog, zLEVEL_ANY );
      // GetViewByName( &vApp, *(pzma->m_pzsVName),
      //                pzma->m_pZSubtask->m_vDialog, zLEVEL_ANY );
         if ( vApp )
         {
            DisplayEntityInstance( vApp, "ReceiptApplied" );
         // DisplayEntityInstance( vApp, *(pzma->m_pzsEName) );
         }
      }
   }
#endif
   // This code lets only one mapping error occur per iteration.
   if ( pzma &&
        pzma->m_pZSubtask->m_pZMIXCtrl->m_pvNodeErr == 0 &&
        pzma->MapToOI( ) < 0 )
   {
      pzma->SetZCtrlState( zCONTROL_STATUS_ERROR, TRUE );
      pzma->m_pZSubtask->m_pZMIXCtrl->m_pvNodeErr = (zPVOID) pzma;
   }
}
예제 #3
0
// Function to process the controls in order for mapping from the OI.
// lParam is a pointer to the unique name of the control which is NOT
// to be refreshed.  This may be a semi-colon separated list of controls
// if the first character is a tab character.
zBOOL
fnFindCtrlInList( ZMapAct *pzma, zCPCHAR cpcCtrlList )
{
   if ( cpcCtrlList && *cpcCtrlList )
   {
      if ( *cpcCtrlList == '\t' )
      {
         zPCHAR pch = (zPCHAR) cpcCtrlList + 1;
         zPCHAR pchSemi;
         while ( pch && *pch )
         {
            pchSemi = zstrchr( pch, ';' );
            if ( pchSemi )
               *pchSemi = 0;

            if ( zstrcmp( *(pzma->m_pzsTag), pch ) == 0 )
            {
               if ( pchSemi )
                  *pchSemi = ';';

               return( TRUE );
            }

            if ( pchSemi )
            {
               *pchSemi = ';';
               pch = pchSemi + 1;
            }
            else
               pch = 0;
         }
      }
      else
      {
         if ( zstrcmp( *(pzma->m_pzsTag), cpcCtrlList ) == 0 )
            return( TRUE );
      }
   }

   return( FALSE );
}
예제 #4
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" );
}
예제 #5
0
파일: ZdCtlChk.cpp 프로젝트: arksoftgit/10c
// Get the data from the OI and use it to set the check for the check button
// appropriately.
zSHORT
ZCheckBox::MapFromOI( WPARAM wFlag )
{
// if ( zstrcmp( *m_pzsTag, "CheckAutoCreateActOnCatChg" ) == 0 )
//    TraceLineS( "ZCheckBox::MapFromOI ", *m_pzsTag );

   // If the control is not Visible, do not do mapping.
   if ( IsVisibleForMapFromOI( ) == FALSE )
      return( 0 );

   m_ulMapActFlag2 |= zMAPACT_MAPPED_FROM_OI1;
   if ( m_pzsVName && m_pzsEName && m_pzsAName )
   {
      zPCHAR pch;
      zBOOL  bCheck = FALSE;
      zULONG ulLth;
      zCHAR  szMap[ 256 ];
      zVIEW  vApp;

      zUSHORT uMapState = GetMappingAutoGray( &vApp, *m_pzsVName,
                                              *m_pzsEName,
                                              *m_pzsAName );
      if ( vApp && (uMapState & zMAPACT_ENTITY_EXISTS) )
      {
         GetAttributeLength( &ulLth, vApp, *m_pzsEName, *m_pzsAName );
         if ( ulLth >= sizeof( szMap ) )
         {
            GetAddrForAttribute( (zPCHAR *) &pch, vApp,
                                 *m_pzsEName, *m_pzsAName );
         }
         else
         {
            GetVariableFromAttribute( szMap, 0, zTYPE_STRING, 256,
                                      vApp, *m_pzsEName,
                                      *m_pzsAName, *m_pzsContext, 0 );
            pch = szMap;
         }

         // determine check or uncheck
         bCheck = (zstrcmp( pch, *m_pzsValueOn ) ? 0 : 1);
      }

      SetCheck( bCheck );
      return( 0 );
   }

   return( -1 );
}
예제 #6
0
UNUSED static struct MenuItem *
FindSpecialMenuItem(struct MenuItem *first, STRPTR label)
{
	struct MenuItem *item = first;
	
	while (item) {
		// ToDo: check item type
		//if (item->
		if (!zstrcmp(((struct IntuiText *)item->ItemFill)->IText, label))
			return item;

		item = item->NextItem;
	}
	
	return NULL;
}
예제 #7
0
파일: tzsioprs.c 프로젝트: arksoftgit/10c
////////////////////////////////////////////////////////////////////////////////////////////////////////
//
//    OPERATION: BuildWSK
//
zOPER_EXPORT zSHORT OPERATION
BuildWSK( zVIEW vSubtask, zVIEW vAktView, zPCHAR szServerName,
          zPCHAR szCatFile, zPCHAR szCatalogName, zPCHAR pszFilename )
{
   void  *ptCatalog = NULL;
   zSHORT nRC;

   zCHAR szLocalServer[ MAX_COMPUTERNAME_LENGTH + 1 ];
   zLONG lLocalLength;
   zCHAR szActualServer[ 9 ];

   // First we have to see, if the catalogs should be loaded locally or from
   // the server
   lLocalLength = MAX_COMPUTERNAME_LENGTH + 1;
   memset( szLocalServer, 0, MAX_COMPUTERNAME_LENGTH + 1 );
   if ( GetComputerName( szLocalServer, &lLocalLength ) == 0 )
      return( -3 );

   GetStringFromAttribute( szActualServer, vAktView, "TZSIIMWK", "wkServerName");
   if ( zstrcmp( szActualServer, szLocalServer ) == 0 )
   {
      // First we have to read the actual catalogdata
      nRC = pfnReadCatalog( szCatFile, szCatalogName, &ptCatalog );
      if ( nRC )
      {
         pfnFreeCatalogStructs( ptCatalog );
         return( nRC );
      }
   }
   else
   {
       nRC = pfnReadServerCatalog (szActualServer, szCatFile, szCatalogName,
                                   &ptCatalog, "", "");
       if ( nRC )
       {
           // Speicher freigeben
           pfnFreeCatalogStructs (ptCatalog);
           return( nRC );
       }
   }

   // Next Step: Write the WSK-File
   nRC = pfnWriteWSK (ptCatalog, vSubtask, pszFilename);

   pfnFreeCatalogStructs (ptCatalog);
   return( nRC );
} // BuildWSK
예제 #8
0
zOPER_EXPORT zSHORT OPERATION
OpIns_RefreshSelectButton( zVIEW vSubtask )
{
   zVIEW  vEdWrk;
   zCHAR  szCurrentType[ 5 ];

   GetWorkView( &vEdWrk );
   GetStringFromAttribute( szCurrentType /* Returned String */,
                           vEdWrk /* View Id */,
                           "OperListType" /* Entity Name */,
                           "Type" /* Attribute Name */ );
   if ( zstrcmp( szCurrentType, "Z" ) == 0 )
   {
      MB_SetMessage( vSubtask, 0, "Press F1 for Help on the operation." );
   }

   RefreshCtrl( vSubtask, "SelectButton" );
   return( 0 );
}
예제 #9
0
파일: tzsioprs.c 프로젝트: arksoftgit/10c
////////////////////////////////////////////////////////////////////////////////////////////////////////
//
//    OPERATION: GetAllCatalogNames
//
zOPER_EXPORT zSHORT  OPERATION
GetAllCatalogNames( zVIEW vSubtask, zVIEW vvAktView )
{
   zCHAR szLocalServer[MAX_COMPUTERNAME_LENGTH + 1];
   zLONG lLocalLength;
   zCHAR szActualServer[9];

   // First we have to see, if the catalogs should be loaded locally or from
   // the server
   lLocalLength = MAX_COMPUTERNAME_LENGTH + 1;
   memset(szLocalServer, 0, MAX_COMPUTERNAME_LENGTH + 1);
   if (GetComputerName( szLocalServer, &lLocalLength ) == 0 )
      return( -3);

   GetStringFromAttribute( szActualServer, vvAktView, "TZSIIMWK", "wkServerName");
   if ( zstrcmp( szActualServer, szLocalServer ) == 0 )
      return( GetLocalCatalogs( vSubtask, vvAktView ) );
   else
      return( GetCatalogs( vSubtask, vvAktView ) );
} // GetAllCatalogNames
예제 #10
0
파일: tzadw4aw.c 프로젝트: arksoftgit/10c
/////////////////////////////////////////////////////////////////////
//
// PURPOSE:  This routine paints selected fields in a list box
// or partition (all the fields are on one line) and paints the
// field literals above the listbox or partition.
//
/////////////////////////////////////////////////////////////////////
zOPER_EXPORT zSHORT OPERATION
ofnTZWDLGSO_AutoPaintListBox( zVIEW  vSubtask,
                              zVIEW  vUserSpec,
                              zVIEW  vNewDialog,
                              zPCHAR szListType )
{
   zLONG    lCC;
   zLONG    lCL;
   zSHORT   nRC;
   zLONG    lFieldRow;
   zLONG    lFieldCol;
   zLONG    lPartitionStartDLG_Y;
   zLONG    lPartitionStartDLG_X;
   zLONG    lPartitionSizeDLG_X;
   zLONG    lSubtype;
   zCHAR    szParentName[ 33 ];
   zLONG    lTempInteger_0;
   zSHORT   RESULT;
//BL   zLONG    lTempInteger_1;
   zCHAR    X_LOD_Attribute[ 16 ];

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

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

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

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

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

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

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

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

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

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

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

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

// TraceLineS("END", "AutoPaintListBox W4" );
   return( nRC );
}
예제 #11
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 );
}
예제 #12
0
파일: tzvminaa.c 프로젝트: DeegC/10d
zOPER_EXPORT zLONG OPERATION
GetExecMode( zVIEW  lpInterpSubtask,
             zVIEW  lpAppSubtask,
             zPCHAR szSrcDLLName,
             zPCHAR szOperationName,
             zPCHAR szMetaType )
{
   zVIEW  vXChecker;
   zVIEW  CM_List;
   zCHAR  szExecDir[ zMAX_FILESPEC_LTH + 1 ];
   zCHAR  szScopeMeta[ 33 ];
   zCHAR  szSourceFileMeta1[ 33 ];
   zCHAR  szSourceFileMeta2[ 33 ];
   zCHAR  szOperationMeta[ 33 ];
   zSHORT nRC;

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

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

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

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

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

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

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

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

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

   if ( nRC >= zCURSOR_SET )
   {
      nRC = SetAttributeFromInteger( vXChecker, "APPLICATION", "CurrentMode", zXC_SETUP_DEBUGGER );
      return( zXC_SETUP_DEBUGGER );
   }
   else
   {
      nRC = SetAttributeFromInteger( vXChecker, "APPLICATION", "CurrentMode", 1 );
      return( zXC_OPERATION_STAGED );
   }
}
예제 #13
0
파일: currency.c 프로젝트: DeegC/10d
/////////////////////////////////////////////////////////////////////////////
//
//  OPERATION: AlphaNumericUpperStrip
//
// Strip all non-alphanumerics and upper case all characters
//
/////////////////////////////////////////////////////////////////////////////
zOPER_EXPORT zLONG OPERATION
AlphaNumericUpperStrip( zLONG lEntryType,
            LPDOMAINDATA lpDomainData )
{
   zSHORT         nRC;
   zSHORT         nWChar;
   zCHAR          szWorkString[ 512 ];
   zPCHAR         pszStringToStore;
   zPLONG         lplInteger;
   zLONG          lWork;
   LPDOMAIN       lpDomain;
   zCHAR          szNullS[ 2 ];
   zLONG          lNullInteger = -2147483647 - 1;

   nRC = zDME_NOT_HANDLED;         // Default to not-handled.
   szNullS[ 0 ] = 0;

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

   switch ( lEntryType )
   {
      case zDME_VALIDATE_LPDATA:
      case zDME_SET_ATTRIBUTE:
         if ( lpDomainData->lpViewAttribute->cType == zTYPE_STRING )
         {
            szWorkString[ 0 ] = 0;

            // determine input data type
            switch ( lpDomainData->cType )
            {
               case zTYPE_STRING:
                  // string to string
                  pszStringToStore = (zPCHAR) lpDomainData->lpData;
                  if ( lpDomainData->lpData == 0 )
                     pszStringToStore = szWorkString;

                  break;

               case zTYPE_INTEGER:
                  // convert long to a string
                  lplInteger = (zPLONG) lpDomainData->lpData;
                  if ( *lplInteger != lNullInteger )
                     zltoa( *lplInteger, szWorkString );

                  pszStringToStore = szWorkString;
                  break;

               case zTYPE_DATETIME:
                  // convert DateTime to String
                  nRC = UfDateTimeToString( (LPDATETIME) lpDomainData->lpData,
                                            szWorkString, 18 );
                  if ( nRC == zCALL_ERROR )
                     return( nRC );

                  pszStringToStore = szWorkString;
                  break;

               default:
                  szWorkString[ 0 ] = lpDomainData->cType;
                  szWorkString[ 1 ] = 0;
                  strcat_s( szWorkString, zsizeof( szWorkString ), ", " );
                  strcat_s( szWorkString, zsizeof( szWorkString ), lpDomainData->lpViewEntity->szName );
                  // "TZDME001 - Invalid Input Data Type"
                  SendDomainError( lpDomainData->zView, lpDomain, 8, 1, 0,
                                   szWorkString,
                                   lpDomainData->lpViewAttribute->szName );
                  return( zCALL_ERROR );
            }

            // transfer all alphanumeric characters
            zPCHAR  psz;
            nWChar = 0;

            for ( psz = (zPCHAR) lpDomainData->lpData; *psz; psz++ )
            {
               if ( zisalnum( *psz ) )
               {
                  szWorkString[ nWChar++ ] = ztoupper( *psz );
               }
            }

            szWorkString[ nWChar ] = 0;

            // finally store it
            if ( lEntryType == zDME_SET_ATTRIBUTE )
            {
               nRC = StoreValueInRecord( lpDomainData->zView,
                                         lpDomainData->lpViewEntity,
                                         lpDomainData->lpViewAttribute,
                                         szWorkString, 0 );
            }
            else
               nRC = 0;
         }
         else
         {
            szWorkString[ 0 ] = lpDomainData->lpViewAttribute->cType;
            szWorkString[ 1 ] = 0;
            strcat_s( szWorkString, zsizeof( szWorkString ), ", " );
            strcat_s( szWorkString, zsizeof( szWorkString ), lpDomainData->lpViewEntity->szName );

            // "TZDME003 - Attribute Type invalid for this Domain"
            SendDomainError( lpDomainData->zView, lpDomain, 8, 3, 0,
                             szWorkString,
                             lpDomainData->lpViewAttribute->szName );
            return( zCALL_ERROR );
         }

         break;

      case zDME_GET_VARIABLE:

         if ( lpDomainData->lpViewAttribute->cType == zTYPE_STRING )
         {
            zPCHAR   lpAttrAddr;
            zCHAR    cAttrType;
            zULONG   uAttrLength;

            if ( lpDomainData->cType != zTYPE_PIC )
            {
               nRC = GetValueFromRecord( lpDomainData->zView,
                                         lpDomainData->lpViewEntity,
                                         lpDomainData->lpViewAttribute,
                                         &lpAttrAddr, &cAttrType,
                                         &uAttrLength );
               if ( nRC )
                  return( zCALL_ERROR );
            }

            // determine input data type
            switch ( lpDomainData->cType )
            {
               case zTYPE_STRING:
                  if ( (zPCHAR) lpAttrAddr == 0 ) //null string
                  {
                     *((zPCHAR) lpDomainData->lpData) = 0;
                     nRC = -1;   // indicate attribute is null
                  }
                  else
                  {
                     *((zPCHAR) lpDomainData->lpData ) = 0;
                     zstrncat( (zPCHAR) lpDomainData->lpData,
                               (zPCHAR) lpAttrAddr,
                               lpDomainData->uMaxStringLength );
                     nRC = 0;
                  }

                  break;

               case zTYPE_INTEGER:
                  // convert string to long
                  if ( (zPCHAR) lpAttrAddr == 0 ) //null string
                  {
                     *((zPLONG) lpDomainData->lpData) = 0;
                     nRC = -1;   // indicate attribute is null
                  }
                  else
                  {
                     strcpy_s( szWorkString, zsizeof( szWorkString ), (zPCHAR) lpAttrAddr );
                     *((zPLONG) lpDomainData->lpData) = atol( szWorkString );
                     nRC = 0;
                  }

                  break;

               case zTYPE_PIC:
                  // return the picture string for the given context
                  {
                     zLPCONTEXT   lpContext;

                     if ( GetContext( &lpContext, lpDomain,
                                      lpDomainData->pszContextName ) )
                     {
                        zPCHAR lpEditString = (zPCHAR) SysGetPointerFromHandle( lpContext->hEditString );

                        if ( lpEditString && *lpEditString )
                           strcpy_s( (zPCHAR) lpDomainData->lpData, lpDomainData->uMaxStringLength,
                                    lpEditString );
                        else
                           *((zPCHAR) lpDomainData->lpData) = 0;

                        nRC = 0;
                     }
                     else
                     {
                        // "TZDME008 - Could not find context for Domain "
                        SendDomainError( lpDomainData->zView, lpDomain, 8, 8, 0,
                                         TrueName( lpDomainData->pszContextName, zSHOW_ZKEY ),
                                         lpDomainData->lpViewAttribute->szName );
                        nRC = zCALL_ERROR;
                     }
                  }

                  break;

               default:
                  szWorkString[ 0 ] = lpDomainData->cType;
                  szWorkString[ 1 ] = 0;
                  strcat_s( szWorkString, zsizeof( szWorkString ), ", " );
                  strcat_s( szWorkString, zsizeof( szWorkString ), lpDomainData->lpViewEntity->szName );
                  // "TZDME001 - Invalid Input Data Type"
                  SendDomainError( lpDomainData->zView, lpDomain, 8, 1,
                                   0, szWorkString, lpDomainData->lpViewAttribute->szName );
                  return( zCALL_ERROR );
            }

            nRC = 0;
         }
         else
         {
            szWorkString[ 0 ] = lpDomainData->lpViewAttribute->cType;
            szWorkString[ 1 ] = 0;
            strcat_s( szWorkString, zsizeof( szWorkString ), ", " );
            strcat_s( szWorkString, zsizeof( szWorkString ), lpDomainData->lpViewEntity->szName );
            // "TZDME003 - Attribute Type invalid for this Domain"
            SendDomainError( lpDomainData->zView, lpDomain, 8, 3, 0,
                             szWorkString, lpDomainData->lpViewAttribute->szName );
            return( zCALL_ERROR );
         }

      case zDME_COMPARE_ATTRIBUTE:
         if ( lpDomainData->lpViewAttribute->cType == zTYPE_STRING )
         {
            zPCHAR   lpAttrAddr;
            zCHAR    cAttrType;
            zULONG   uAttrLength;

            nRC = GetValueFromRecord( lpDomainData->zView, lpDomainData->lpViewEntity, lpDomainData->lpViewAttribute,
                                      &lpAttrAddr, &cAttrType, &uAttrLength );
            if ( nRC )
               return( zCALL_ERROR );

            if ( lpAttrAddr == 0 )
               lpAttrAddr = szNullS;

            // determine input data type
            switch ( lpDomainData->cType )
            {
               case zTYPE_STRING:
                  if ( lpDomainData->lpViewAttribute->bCaseSens )
                     nRC = zstrcmp( lpAttrAddr, (zPCHAR) lpDomainData->lpData );
                  else
                     nRC = zstrcmpi( lpAttrAddr, (zPCHAR) lpDomainData->lpData );

                  break;

               case zTYPE_INTEGER:
                  lWork = zatol( lpAttrAddr );
                  lWork -= *((zPLONG) lpDomainData->lpData);
                  nRC = (lWork == 0) ? 0 : (lWork < 0) ? -1 : 1;
                  break;

               default:
                  szWorkString[ 0 ] = lpDomainData->cType;
                  szWorkString[ 1 ] = 0;
                  strcat_s( szWorkString, zsizeof( szWorkString ), ", " );
                  strcat_s( szWorkString, zsizeof( szWorkString ), lpDomainData->lpViewEntity->szName );
                  // "TZDME001 - Invalid Input Data Type"
                  SendDomainError( lpDomainData->zView, lpDomain, 8, 1, 0, szWorkString,
                                   lpDomainData->lpViewAttribute->szName );
                  return( zCALL_ERROR );
            }
         }
         else
         {
            szWorkString[ 0 ] = lpDomainData->lpViewAttribute->cType;
            szWorkString[ 1 ] = 0;
            strcat_s( szWorkString, zsizeof( szWorkString ), ", " );
            strcat_s( szWorkString, zsizeof( szWorkString ), lpDomainData->lpViewEntity->szName );
            // "TZDME003 - Attribute Type invalid for this Domain"
            SendDomainError( lpDomainData->zView, lpDomain, 8, 3, 0,
                             szWorkString, lpDomainData->lpViewAttribute->szName );
            return( zCALL_ERROR );
         }

         break;

      case zDME_GET_COMPARE_VALUE:
         switch ( lpDomainData->cType )
         {
            case zTYPE_STRING:
               nRC = 0;
               break;

            case zTYPE_INTEGER:
               zltoa( *((zPLONG) lpDomainData->lpData), szWorkString );
               strcpy_s( (zPCHAR) lpDomainData->lpData, lpDomainData->uMaxStringLength, szWorkString );
               nRC = 1; // indicate returning a string value
               break;

            default:
               szWorkString[ 0 ] = lpDomainData->cType;
               szWorkString[ 1 ] = 0;
               strcat_s( szWorkString, zsizeof( szWorkString ), ", " );
               strcat_s( szWorkString, zsizeof( szWorkString ), lpDomainData->lpViewEntity->szName );

               // "TZDME001 - Invalid Input Data Type"
               SendDomainError( lpDomainData->zView, lpDomain, 8, 1, 0,
                                szWorkString, lpDomainData->lpViewAttribute->szName );
               nRC = -2;
         }

         break;

      case zDME_ADD_TO_ATTRIBUTE:
      case zDME_GET_FIRST_TBL_ENT_FOR_ATTR:
      case zDME_GET_NEXT_TBL_ENT_FOR_ATTR:
      case zDME_SET_ATTRIBUTE_VALUE_NEXT:
      case zDME_SET_ATTRIBUTE_VALUE_PREV:
      default:
         // Entry not handled
         return( zDME_NOT_HANDLED );
   }

   return( nRC );

} // AlphaNumericUpperStrip
예제 #14
0
파일: currency.c 프로젝트: DeegC/10d
//./ ADD NAME=fnGetDecimalFmtStrings
// Source Module=tzapdmac.c
////////////////////////////////////////////////
//
//  ENTRY:      fnGetDecimalFmtStrings
//
//  PURPOSE:    Determine values necessary for decorating decimal
//              strings.
//
//  PARAMETERS:
//              lpContext     - Context control structure.
//              szReturnThou  - return for a string representing the
//                              thousands character separator.
//              szReturnDecPt - return for a string representing the
//                              decimal point character.
//              lplPrecision  - desired number of characters to the right
//                              of the decimal point.  A -1 indicates
//                              variable precision.
//
//  RETURNS:
//              0 - Information has been returned.
//    zCALL_ERROR - Only returned for context "MSWindowsSetting", when we
//                  could not retrieve the International information from
//                  windows.  In that case we return 'US' defaults.
//
////////////////////////////////////////////////
//./ END + 5
zSHORT
fnGetDecimalFmtStrings( zLPCONTEXT  lpContext,
                        zPCHAR      szReturnThou,
                        zPCHAR      szReturnDecPt,
                        zPLONG      lplPrecision )
{
   zPCHAR   pszName;    // context name

   // First check for Windows setting.  If so, use all international
   // settings, including precision.
   if ( zstrcmp( pszName, "MSWindowsSetting" ) == 0 )
      SysGetNumberFormat( szReturnThou, szReturnDecPt, lplPrecision );
   else
   if ( zstrcmp( pszName, "CurrencyText" ) == 0 )
   {
      SysGetNumberFormat( szReturnThou, szReturnDecPt, lplPrecision );
      *lplPrecision = 2;
   }
   else
   if ( zstrncmp( pszName, "DECIMAL", 7 ) == 0 )  // check for DECIMALx
   {
      // Use the international settings for szReturnThou and szReturnDecPt,
      // but use the x value, if it exists, for lplPrecision.
      SysGetNumberFormat( szReturnThou, szReturnDecPt, lplPrecision );
      if ( pszName[ 7 ] == '4' || pszName[ 7 ] == '3' ||
           pszName[ 7 ] == '2' || pszName[ 7 ] == '1' ||
           pszName[ 7 ] == '0' )
      {
         *lplPrecision = atol( pszName + 7 );
      }
      else
         *lplPrecision = lpContext->lDecimalFormat;
   }
   else  // check for DecimalCommax or DecimalPointx
   if ( zstrncmp( pszName, "DecimalPoint", 12 ) == 0 )
   {
      // Use the comma or point as appropriate.  Use the x value, if it
      // exists, for lplPrecision.
      strcpy_s( szReturnThou, zsizeof( szReturnThou ), "," );
      strcpy_s( szReturnDecPt, zsizeof( szReturnDecPt ), "." );
      if ( pszName[ 12 ] == '4' || pszName[ 12 ] == '3' ||
           pszName[ 12 ] == '2' || pszName[ 12 ] == '1' ||
           pszName[ 12 ] == '0' )
      {
         *lplPrecision = atol( pszName + 12 );
      }
      else
         *lplPrecision = lpContext->lDecimalFormat;
   }
   else
   if ( zstrncmp( pszName, "DecimalComma", 12 ) == 0 )
   {
      strcpy_s( szReturnThou, zsizeof( szReturnThou ), "." );
      strcpy_s( szReturnDecPt, zsizeof( szReturnDecPt ), "," );
      if ( pszName[ 12 ] == '4' || pszName[ 12 ] == '3' ||
           pszName[ 12 ] == '2' || pszName[ 12 ] == '1' ||
           pszName[ 12 ] == '0' )
      {
         *lplPrecision = atol( pszName + 12 );
      }
      else
         *lplPrecision = lpContext->lDecimalFormat;
   }
   else  // if it is anything else
   {
      // Use the international settings for szReturnThou and szReturnDecPt,
      // but use the context value for lplPrecision.
      SysGetNumberFormat( szReturnThou, szReturnDecPt, lplPrecision );
      *lplPrecision = lpContext->lDecimalFormat;
   }

   return( 0 );
}
예제 #15
0
파일: tzsioprs.c 프로젝트: arksoftgit/10c
static zSHORT GetCatalogs( zVIEW vSubtask, zVIEW vAktView )
{
    zSHORT nRet;
    zCHAR szServerName[9];
    zCHAR szCatalogFileName[9];
    zCHAR szEinschraenkung[9];
    zCHAR szCatalogName[9];
    zCHAR *pszCatalogList = NULL;
    long lAnzahlCatalogs;
    long lLv;
    zCHAR szLocalServer[MAX_COMPUTERNAME_LENGTH + 1];
    zLONG lLocalLength;

    // First we have to see, if the catalogs should be loaded locally or from
    // the server
    lLocalLength = MAX_COMPUTERNAME_LENGTH + 1;
    memset(szLocalServer, 0, MAX_COMPUTERNAME_LENGTH + 1);
    if (GetComputerName( szLocalServer, &lLocalLength ) == 0 )
       return( -3);

    // Get the actual Servername and CatalogFileName
    memset(szServerName, 0, 9);
    GetStringFromAttribute(szServerName, vAktView, "TZSIIMWK", "wkServerName");

    if ( zstrcmp( szServerName, szLocalServer ) != 0 )
    {
       // For servers we have to see if the list of catalogs is
       // already loaded. If not we have to Create an entity for
       // the catalogfile ADRTAFEL
       // If the list of catalogfiles still exists, return
       nRet = CheckExistenceOfEntity( vAktView, "CatFiles" );
       if ( nRet == zCURSOR_SET || nRet == zCALL_ERROR )
          return( nRet );

       // First we have to Create the Catalogfilename in the WorkLOD
       CreateEntity(vAktView, "CatFiles", zPOS_AFTER);
       SetAttributeFromString( vAktView, "CatFiles",
                               "wkCatFiles", "ADRTAFEL");
       SetAttributeFromString( vAktView, "CatFiles",
                               "wkEinschraenkung", "");
    }

    // If the siron modules are not loaded, load them now
    if ( g_hLib == NULL )
    {
       nRet = fnLoadHzvaffz( vSubtask );
       if ( nRet != 0 )
         return( nRet );
    }

    // Position onto the first catalogfile
    nRet = SetCursorFirstEntity(vAktView, "CatFiles", "");
    while ( nRet == zCURSOR_SET )
    {
       // Set Catalogfilename in structure for getting the cataloglist
       memset(szCatalogFileName, 0, 9);
       GetStringFromAttribute( szCatalogFileName, vAktView,
                               "CatFiles", "wkCatFiles");
       GetStringFromAttribute( szEinschraenkung, vAktView,
                               "CatFiles", "wkCatFiles");

       lAnzahlCatalogs = 0;
       if ( zstrcmp( szServerName, szLocalServer ) == 0 )
       {
          // Read all Catalogs from local PC
          nRet = pfnGetLocalCatalogs( szCatalogFileName, szEinschraenkung,
                                      &lAnzahlCatalogs, &pszCatalogList,
                                      "", "" );
       }
       else
       {
          // Read all Catalogs from the selected server
          nRet = pfnGetServerCatalogs( szServerName, szCatalogFileName,
                                       szEinschraenkung, &lAnzahlCatalogs,
                                       &pszCatalogList, "", "" );
       }

       if ( nRet != 0 )
       {
          pfnFreeListMemory( &pszCatalogList );
          return( nRet );   // Umsetzen auf 590
       }

       for (lLv = 0; lLv < lAnzahlCatalogs; lLv++)
       {
           memset( szCatalogName, 0, 9 );
           memcpy( szCatalogName, pszCatalogList+(lLv*9), 8);
           CreateEntity (vAktView, "Catalogs", zPOS_AFTER);
           SetAttributeFromString (vAktView, "Catalogs", "wkCatalogName", szCatalogName);
       }

       // Free Memory
       pfnFreeListMemory( &pszCatalogList );

       nRet = SetCursorNextEntity( vAktView, "CatFiles", "" );
    }

    return( 0 );
}
예제 #16
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 );
}
예제 #17
0
struct MenuItem *
MakeMenuList(struct MinList *list, APTR parent, UBYTE type, ULONG id, struct MenuItem *next)
{
	struct MenuItem *first = NULL, *item, *old = NULL;
	struct Node *ln;
	LONG   count = 0;

	if (!parent || !list)
		return NULL;

	foreach (list, ln) {
		if (ln->ln_Name && (item = AllocPooled(pool, sizeof(struct SpecialMenuItem)))) {
			if (!first)
				first = item;
			else
				old->NextItem = item;

			if ((item->ItemFill = AllocPooled(pool, sizeof(struct IntuiText))) != 0) {
				// Find entries with the same name
				
				bool equalEntries = false;
				struct Node *node;
                 
				foreach (list, node) {
					if (node != ln && !zstrcmp(node->ln_Name, ln->ln_Name)) {
						equalEntries = true;
						break;
					}
				}

				if (equalEntries) {
					// if there is already an item with the same name, add path
					// informations so that the items can be differentiated better
					char t[256], path[25];

					{
						char *pathSource;
						if (id == SMIM_SESSION)
							pathSource = ((struct Session *)ln)->s_Path;
						else
							pathSource = ((struct Mappe *)ln)->mp_Path;
						
						if (pathSource != NULL)
							stccpy(path, pathSource, sizeof(path));
						else
							path[0] = '\0';
					}

					if (strlen(path) > sizeof(path) - 2)
						strcpy(path + sizeof(path) - 4, "...");

					sprintf(t, "%s (%s)", ln->ln_Name, path);
					((struct IntuiText *)item->ItemFill)->IText = AllocString(t);
				} else
					((struct IntuiText *)item->ItemFill)->IText = AllocString(ln->ln_Name);

				((struct IntuiText *)item->ItemFill)->TopEdge = 1;
				item->Flags = ITEMTEXT | ITEMENABLED | HIGHCOMP;
				((struct SpecialMenuItem *)item)->smi_Magic = id;
				((struct SpecialMenuItem *)item)->smi_Data = count;
			}
			old = item;
		}
		count++;

		if (id == SMIM_SESSION && count >= numsessions)
			break;
	}
예제 #18
0
파일: ZdCtl.cpp 프로젝트: DeegC/ZeidonTools
zSHORT OPERATION
CompareCell( ZColorItem *pColorItem, zLONG lColumn,
             zCPCHAR cpcValue, zBOOL bTestBoth )
{
   if ( (pColorItem->m_lClrFlags & zALWAYS_EQUAL) &&
        lColumn == pColorItem->m_lColumn )
   {
      return( 0 );
   }

   if ( bTestBoth &&   // check long value as well as string value
        lColumn &&     // match any column
        lColumn != pColorItem->m_lColumn )
   {
      return( -1 );    // not equal
   }

   zSHORT nRC;

   if ( (pColorItem->m_lClrFlags & zNZ) == zNZ ||   // null or zero
        (pColorItem->m_lClrFlags & zNN) == zNN )    // not null/zero
   {
      zPCHAR pch = (zPCHAR) cpcValue;
      while ( pch && *pch && (*pch == '0' || *pch == '.' || isspace( *pch )) )
         pch++;

      if ( pch && *pch )
      {
         if ( (pColorItem->m_lClrFlags & zNZ) == zNZ )  // null or zero
            return( -1 );  // it is N0T null or zero
         else
      // if ( (pColorItem->m_lClrFlags & zNN) == zNN )  // not null/zero
            return( 0 );   // it is not null/zero
      }
      else
      {
         if ( (pColorItem->m_lClrFlags & zNZ) == zNZ )  // null or zero
            return( 0 ); // it is null or zero
         else
      // if ( (pColorItem->m_lClrFlags & zNN) == zNN )  // not null/zero
            return( -1 );
      }
   }
   else
   if ( pColorItem->m_lClrFlags & zNUMERIC_COMPARE )    // vs. string compare
   {
      double d1 = atof( cpcValue );
      double d2 = atof( pColorItem->m_csValue );
      d1 -= d2;
      if ( d1 < 0 )
         nRC = -1;
      else
      if ( d1 == 0 )
         nRC = 0;
      else
      if ( d1 > 0 )
         nRC = 1;
   }
   else
   if ( pColorItem->m_lClrFlags & 0x000f0000 ) // contains, starts with (NOT)
   {
      CString cs1( pColorItem->m_csValue );
      CString cs2( cpcValue );
      cs1.MakeUpper( );
      cs2.MakeUpper( );
      int nFind = cs2.Find( cs1 );
      nRC = -1;
      if ( nFind >= 0 )
      {
         if ( (pColorItem->m_lClrFlags & zIN) == zIN )  // in (contains)
            nRC = 0;
         else
         if ( nFind == 0 )
         {
            if ( (pColorItem->m_lClrFlags & zSW) == zSW ) // starts with
               nRC = 0;
         }
         else
         {
            if ( (pColorItem->m_lClrFlags & zNS) == zNS ) // does not start with
               nRC = 0;
         }
      }
      else
      if ( (pColorItem->m_lClrFlags & zNI) == zNI || // not in (does not contain)
           (pColorItem->m_lClrFlags & zNS) == zNS )  // does not start with
      {
         nRC = 0;
      }

      return( nRC );
   }
   else
   {
      if ( (pColorItem->m_lClrFlags & zIGNORE_CASE) == zIGNORE_CASE )
         nRC = zstricmp( cpcValue, pColorItem->m_csValue );
      else
         nRC = zstrcmp( cpcValue, pColorItem->m_csValue );
   }

   switch ( pColorItem->m_lClrFlags & 0x0fff0000 )
   {
      case zLT:    // less than
         if ( nRC < 0 )
            nRC = 0;
         else
            nRC = -1;

         break;

      case zLE:    // less than or equal
         if ( nRC <= 0 )
            nRC = 0;
         else
            nRC = -1;

         break;

      case zGE:    // greater than or equal
         if ( nRC >= 0 )
            nRC = 0;
         else
            nRC = -1;

         break;

      case zGT:    // greater than
         if ( nRC > 0 )
            nRC = 0;
         else
            nRC = -1;

         break;

      case zNE:    // not equal
         if ( nRC )
            nRC = 0;
         else
            nRC = -1;

         break;

      default:
      case zEQ:    // equal (default)
         break;
   }

   return( nRC );
}