int ZTime::OnCreate( LPCREATESTRUCT lpCreateStruct ) { #ifdef DEBUG_ALL TraceLineS( "ZTime::OnCreate ", *m_pzsTag ); #endif int nRC = CWnd::OnCreate( lpCreateStruct ); if ( nRC == -1 ) return( -1 ); CRect rect; zPCHAR pch; GetWindowRect( rect ); ScreenToClient( rect ); m_DateTime.Create( Attr.Style | DTS_TIMEFORMAT | DTS_UPDOWN, rect, this, 1 ); // The user can specify a format for the time using the control's Tag. // If there is an '@' in the Tag, the characters following the '@' are // used to specify the format using the following specifications: // // Element Description // "d" - The one- or two-digit day. // "dd" - The two-digit day. Single-digit day values are preceded by a zero. // "ddd" - The three-character weekday abbreviation. // "dddd" - The full weekday name. // "h" - The one- or two-digit hour in 12-hour format. // "hh" - The two-digit hour in 12-hour format. Single-digit values are preceded by a zero. // "H" - The one- or two-digit hour in 24-hour format. // "HH" - The two-digit hour in 24-hour format. Single-digit values are preceded by a zero. // "m" - The one- or two-digit minute. // "mm" - The two-digit minute. Single-digit values are preceded by a zero. // "M" - The one- or two-digit month number. // "MM" - The two-digit month number. Single-digit values are preceded by a zero. // "MMM" - The three-character month abbreviation. // "MMMM" - The full month name. // "t" - The one-letter AM/PM abbreviation (that is, AM is displayed as "A"). // "tt" - The two-letter AM/PM abbreviation (that is, AM is displayed as "AM"). // "yy" - The last two digits of the year (that is, 1996 would be displayed as "96"). // "yyyy" - The full year (that is, 1996 would be displayed as "1996"). if ( (pch = (zPCHAR) zstrchr( *m_pzsTag, '@' )) != 0 ) m_DateTime.SetFormat( pch + 1 ); return( nRC ); }
//////////////////////////////////////////////////////////////////////////////////////////////////////// // // OPERATION: SetWSKInLod // zOPER_EXPORT zSHORT OPERATION SetWSKInLod( zVIEW vSubtask, zVIEW vAktView, zPCHAR szFilename ) { zCHAR *pszFilename; zCHAR *pszEndname; // Get the Filename to set it into the WorkLod pszFilename = zstrrchr( szFilename, '\\' ) + 1; pszEndname = zstrchr( pszFilename, '.' ); *pszEndname = 0; CreateEntity( vAktView, "KatalogFile", zPOS_FIRST ); SetAttributeFromString( vAktView, "KatalogFile", "Name", pszFilename); // To import the file we need the extension *pszEndname = '.'; return( 0 ); } // SetWSKInLod
// 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 ); }
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 ); }
//./ 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 ); }
zOPER_EXPORT zSHORT OPERATION VML_DisplayList( zVIEW vSubtask ) { zVIEW vProfileXFER; zCHAR szShowStr[ 10 ]; zSHORT nRC; GetProfileView( &vProfileXFER ); *szShowStr = 0; // Build a string that contains each of the VML types that the user // wants shown. if ( CompareAttributeToString( vProfileXFER, "ED", "VML_ShowDeclarations", "Y" ) == 0 ) { zstrcat( szShowStr, "D" ); } if ( CompareAttributeToString( vProfileXFER, "ED", "VML_ShowControlStatements", "Y" ) == 0 ) { zstrcat( szShowStr, "C" ); } if ( CompareAttributeToString( vProfileXFER, "ED", "VML_ShowViewStatements", "Y" ) == 0 ) { zstrcat( szShowStr, "V" ); } if ( CompareAttributeToString( vProfileXFER, "ED", "VML_ShowEntityStatements", "Y" ) == 0 ) { zstrcat( szShowStr, "E" ); } if ( CompareAttributeToString( vProfileXFER, "ED", "VML_ShowOperators", "Y" ) == 0 ) { zstrcat( szShowStr, "O" ); } if ( CompareAttributeToString( vProfileXFER, "ED", "VML_ShowOther", "Y" ) == 0 ) { zstrcat( szShowStr, "?" ); } // szShowStr lists all the types that the user wants shown. eg "CV?" means // that the user wants all control, view, and 'other' vml statements // shown. for ( nRC = SetCursorFirstEntity( vProfileXFER, "VML_Text", 0 ); nRC == zCURSOR_SET; nRC = SetCursorNextEntity( vProfileXFER, "VML_Text", 0 ) ) { zCHAR szType[ 5 ]; GetStringFromAttribute( szType, vProfileXFER, "VML_Text", "Type" ); if ( zstrchr( szShowStr, *szType ) ) SetSelectStateOfEntity( vProfileXFER, "VML_Text", TRUE ); else SetSelectStateOfEntity( vProfileXFER, "VML_Text", FALSE ); } SetCursorFirstSelectedEntity( vProfileXFER, "VML_Text", 0 ); LB_SetDisplaySelectSet( vSubtask, "TextList", DISP_SELECT_SET ); LB_SetSelectSelectSet( vSubtask, "TextList", SEL_SELECT_SET ); return( 0 ); } // VML_DisplayList
// 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( ); } }