///////////////////////////////////////////////////////////////////////////// // Create font from info in the application profile. Reads info in the form // facename, ptsize, weight, italic // zBOOL ZFontUI::GetProfileFont( zCPCHAR cpcKey, zCPCHAR cpcVal, CFont& font, CDC *pDC ) { CWinApp *pApp = AfxGetApp( ); ASSERT_VALID( pApp ); CString zs = pApp->GetProfileString( cpcKey, cpcVal ); if ( zs.IsEmpty( ) ) return( FALSE ); LOGFONT lf; zmemset( &lf, 0, sizeof( LOGFONT ) ); lf.lfCharSet = DEFAULT_CHARSET; int bItalic; int nPtSize; // scanf is overkill, but I'm lazy if ( sscanf( (zCPCHAR) zs, "%[a-zA-Z ],%d,%d,%d", lf.lfFaceName, &nPtSize, &lf.lfWeight, &bItalic ) != 4 ) { return( FALSE ); } lf.lfHeight = MulDiv( -nPtSize, // convert ptsize to logical units ::GetDeviceCaps( pDC ? pDC->m_hDC : ::GetDC( 0 ), LOGPIXELSY ), 72 ); lf.lfItalic = bItalic; // because lf.lfItalic is a BYTE font.DeleteObject( ); // bye return( font.CreateFontIndirect( &lf ) ); }
///////////////////////////////////////////////////////////////////////////// // // ENTRY: // // PURPOSE: Save the VKey Ctrl/Alt/Shift based on the check box settings // ///////////////////////////////////////////////////////////////////////////// zOPER_EXPORT zSHORT OPERATION SaveVKey( zVIEW vSubtask ) { zVIEW vHotkey; zACCEL_DEF ac; zLONG lVKey; zmemset( &ac, 0, sizeof( zACCEL_DEF ) ); GetViewByName( &vHotkey, "KZHKEYSO", vSubtask, zLEVEL_ANY ); GetIntegerFromAttribute( &lVKey, vHotkey, "Hotkey", "VKey" ); ac.uVK = (zUSHORT) lVKey; ac.fCtrl = (zUSHORT) GetCtrlState( vSubtask, "Ctrl", zCONTROL_STATUS_CHECKED ); ac.fAlt = (zUSHORT) GetCtrlState( vSubtask, "Alt", zCONTROL_STATUS_CHECKED ); ac.fShift = (zUSHORT) GetCtrlState( vSubtask, "Shift", zCONTROL_STATUS_CHECKED ); SetAttributeFromBlob( vHotkey, "Hotkey", "KeyCombo", &ac, sizeof( zACCEL_DEF ) ); // if ( CheckExistenceOfEntity( vHotkey, "Operation" ) > zCURSOR_UNCHANGED ) // { // zCHAR szText[ 64 ]; // // GetCtrlText( vSubtask, "DLL_Name", szText, sizeof( szText ) ); // SetAttributeFromString( vHotkey, "Operation", "DLL_Name", 0 ); // } return( 0 ); }
///////////////////////////////////////////////////////////////////////////// // // Delete Object. Delete DIB and palette. // ///////////////////////////////////////////////////////////////////////////// zBOOL ZDib::DeleteObject( ) { m_bBitmapLoaded = FALSE; if ( m_palette.m_hObject ) m_palette.DeleteObject( ); if ( m_hdd ) { ::DrawDibClose( m_hdd ); m_hdd = 0; } zmemset( &m_bitmap, 0, sizeof( m_bitmap ) ); return( CBitmap::DeleteObject( ) ); }
zBOOL ZDib2::Create( int lWidth, int lHeight, int uBits ) { // Free existing image. DestroyDIB( ); // ASSERT( lBits == 24 || lBits == 8 ); BITMAPINFOHEADER bmInfo; zmemset( &bmInfo, 0, sizeof( BITMAPINFOHEADER ) ); bmInfo.biSize = sizeof( BITMAPINFOHEADER ); bmInfo.biWidth = lWidth; bmInfo.biHeight = lHeight; bmInfo.biPlanes = 1; bmInfo.biBitCount = uBits; bmInfo.biCompression = BI_RGB; return( Create( bmInfo ) ); }
///////////////////////////////////////////////////////////////////////////// // // ENTRY: // // PURPOSE: Save the HK object(both Source & Executable???) // ///////////////////////////////////////////////////////////////////////////// zOPER_EXPORT zSHORT OPERATION zwTZHKEYAD_SaveHK_ForLPLR( zVIEW vSubtask ) { zPCHAR lpGlobalHotkey; zUSHORT usGlobalHotkeyLth; LPACCEL_TABLE lpAT; LPACCEL_TABLE lpAT_Start; zCHAR szFileSpec[ zMAX_FILESPEC_LTH + 1 ]; zVIEW vKZHKEYSO; zVIEW vKZHKEYXO; zVIEW vTaskLPLR; zULONG ulMaxLth; zSHORT nRC; GetViewByName( &vKZHKEYSO, "KZHKEYSO", vSubtask, zLEVEL_ANY ); // Get the directory. GetViewByName( &vTaskLPLR, "TaskLPLR", vSubtask, zLEVEL_TASK ); if ( vTaskLPLR == 0 ) { MessageSend( vSubtask, "HK00102", "Hot Keys", "Can't locate LPLR?", zMSGQ_OBJECT_CONSTRAINT_ERROR, zBEEP ); return( 0 ); } GetStringFromAttribute( szFileSpec, vTaskLPLR, "LPLR", "MetaSrcDir" ); zstrcat( szFileSpec, "\\ZEIDON.PHK" ); MiSetOI_ReleaseForView( vKZHKEYSO, szlReleaseCurrent ); CommitOI_ToFile( vKZHKEYSO, szFileSpec, zASCII | zENCODE_BLOBS | zNO_NULL_STRING_TERM ); SfAllocTaskMemory( vSubtask, (zCOREMEM) &lpGlobalHotkey, 65000 ); lpAT = (LPACCEL_TABLE) SfLockTaskMemory( lpGlobalHotkey ); lpAT_Start = lpAT; usGlobalHotkeyLth = 0; SfActivateSysEmptyOI( &vKZHKEYXO, "KZHKEYXO", vSubtask, zSINGLE | zLEVEL_APPLICATION ); CreateEntity( vKZHKEYXO, "App", zPOS_AFTER ); nRC = SetEntityCursor( vKZHKEYSO, "Hotkey", 0, zPOS_FIRST, 0, 0, 0, 0, 0, 0 ); while ( nRC >= 0 ) { CreateEntity( vKZHKEYXO, "Hotkey", zPOS_AFTER ); SetMatchingAttributesByName( vKZHKEYXO, "Hotkey", vKZHKEYSO, "Hotkey", zSET_ALL ); SetAttributeFromAttribute( vKZHKEYXO, "Hotkey", "COP", vKZHKEYSO, "Operation", "Name" ); SetAttributeFromAttribute( vKZHKEYXO, "Hotkey", "DLL", vKZHKEYSO, "Hotkey", "DLL_Name" ); lpAT->chType = zACCEL_HOTKEY; ulMaxLth = sizeof( zACCEL_DEF ); GetBlobFromAttribute( &(lpAT->ac), &ulMaxLth, vKZHKEYSO, "Hotkey", "KeyCombo" ); lpAT->nID = (zSHORT) GetRelativeEntityNumber( vKZHKEYSO, "Hotkey", 0, 0L ); usGlobalHotkeyLth += sizeof( zACCEL_TABLE ); lpAT++; nRC = SetCursorNextEntity( vKZHKEYSO, "Hotkey", 0 ); } zmemset( lpAT, 0xFF, sizeof( zACCEL_TABLE ) ); // terminator usGlobalHotkeyLth += sizeof( zACCEL_TABLE ); lpAT = lpAT_Start; SetAttributeFromBlob( vKZHKEYXO, "App", "Hotkey", lpAT, usGlobalHotkeyLth ); SfUnlockTaskMemory( lpAT ); SfFreeTaskMemory( lpGlobalHotkey ); GetStringFromAttribute( szFileSpec, vTaskLPLR, "LPLR", "ExecDir" ); zstrcat( szFileSpec, "\\ZEIDON.XKY" ); CommitOI_ToFile( vKZHKEYXO, szFileSpec, zASCII ); return( 0 ); }
///////////////////////////////////////////////////////////////////////////// // // Simple font class to permit an application to reuse fonts while printing // a document. // // // typedef struct tagLOGFONT { /* lf */ // int lfHeight; // int lfWidth; // int lfEscapement; // int lfOrientation; // int lfWeight; // BYTE lfItalic; // BYTE lfUnderline; // BYTE lfStrikeOut; // BYTE lfCharSet; // BYTE lfOutPrecision; // BYTE lfClipPrecision; // BYTE lfQuality; // BYTE lfPitchAndFamily; // BYTE lfFaceName[LF_FACESIZE]; // } LOGFONT; // // The LOGFONT structure defines the attributes of a font, a drawing // object used to write text on a display surface. // // Member Description // // lfHeight - Specifies the desired height, in logical units, for the // font. If this value is greater than zero, it specifies the cell // height of the font. If it is less than zero, it specifies the // character height of the font. (Character height is the cell height // minus the internal leading. Applications that specify font height in // points typically use a negative number for this member.) If this // value is zero, the font mapper uses a default height. The font // mapper chooses the largest physical font that does not exceed the // requested size (or the smallest font, if all the fonts exceed the // requested size). The absolute value of the lfHeight member must not // exceed 16,384 after it is converted to device units. // // lfWidth - Specifies the average width, in logical units, of // characters in the font. If this value is zero, the font mapper // chooses a reasonable default width for the specified font height. // (The default width is chosen by matching the aspect ratio of the // device against the digitization aspect ratio of the available fonts. // The closest match is determined by the absolute value of the // difference.) The widths of characters in TrueType fonts are scaled // by a factor of this member divided by the width of the characters in // the physical font (as specified by the tmAveCharWidth member of the // TEXTMETRIC structure). // // lfEscapement - Specifies the angle, in tenths of degrees, between // the base line of a character and the x-axis. The angle is measured // in a counterclockwise direction from the x-axis for left-handed // coordinate systems (that is, MM_TEXT, in which the y direction is // down) and in a clockwise direction from the x-axis for right-handed // coordinate systems (in which the y direction is up). // // lfOrientation - Specifies the orientation of the characters. This // value is ignored. // // lfWeight - Specifies the font weight. This member can be one of the // following values: // // Constant Value // =============== ===== // FW_DONTCARE 0 // FW_THIN 100 // FW_EXTRALIGHT 200 // FW_ULTRALIGHT 200 // FW_LIGHT 300 // FW_NORMAL 400 // FW_REGULAR 400 // FW_MEDIUM 500 // FW_SEMIBOLD 600 // FW_DEMIBOLD 600 // FW_BOLD 700 // FW_EXTRABOLD 800 // FW_ULTRABOLD 800 // FW_BLACK 900 // FW_HEAVY 900 // // The actual appearance of the font depends on the type face. Some // fonts have only FW_NORMAL, FW_REGULAR, and FW_BOLD weights. If // FW_DONTCARE is specified, a default weight is used. // // lfItalic Specifies an italic font if nonzero. // lfUnderline Specifies an underlined font if nonzero. // lfStrikeOut Specifies a strikeout font if nonzero. // lfCharSet Specifies the character set of the font. The // following values are predefined: // // Constant Value // ================ ===== // ANSI_CHARSET 0 // DEFAULT_CHARSET 1 // SYMBOL_CHARSET 2 // SHIFTJIS_CHARSET 128 // OEM_CHARSET 255 // // The DEFAULT_CHARSET value is not used by the font mapper. An // application can use this value to allow the name and size of a font // to fully describe the logical font. If the specified font name does // not exist, a font from any character set can be substituted for the // specified font; applications should use the DEFAULT_CHARSET value // sparingly to avoid unexpected results. // // The OEM character set is system-dependent. Fonts with other // character sets may exist in the system. If an application uses a // font with an unknown character set, it should not attempt to // translate or interpret strings that are to be rendered with that // font. // // lfOutPrecision - Specifies the desired output precision. The output // precision defines how closely the output must match the height, // width, character orientation, escapement, and pitch of the requested // font. This member can be one of the following values: // // OUT_CHARACTER_PRECIS OUT_STRING_PRECIS // OUT_DEFAULT_PRECIS OUT_STROKE_PRECIS // OUT_DEVICE_PRECIS OUT_TT_PRECIS // OUT_RASTER_PRECIS OUT_TT_ONLY_PRECIS // // Applications can use the values OUT_DEVICE_PRECIS, // OUT_RASTER_PRECIS, and OUT_TT_PRECIS to control how the font mapper // chooses a font when the system contains more than one font with a // given name. For example, if a system contains a font named "Symbol" // in raster and TrueType form, specifying OUT_TT_PRECIS would force // the font mapper to choose the TrueType version. (Specifying // OUT_TT_PRECIS forces the font mapper to choose a TrueType font // whenever the specified font name matches a device or raster font, // even when there is no TrueType font with the same name.) An // application can use TrueType fonts exclusively by specifying // OUT_TT_ONLY_PRECIS. When this value is specified, the system // chooses a TrueType font even when the name specified in the // lfFaceName member matches a raster or vector font. // // lfClipPrecision Specifies the desired clipping precision. The // clipping precision defines how to clip characters that are partially // outside the clipping region. This member can be any one of the // following values: // // CLIP_CHARACTER_PRECIS CLIP_MASK // CLIP_DEFAULT_PRECIS CLIP_STROKE_PRECIS // CLIP_EMBEDDED CLIP_TT_ALWAYS // CLIP_LH_ANGLES // // To use an embedded read-only font, applications must specify the // CLIP_EMBEDDED value. // // To achieve consistent rotation of device, TrueType, and vector // fonts, an application can use the OR operator to combine the // CLIP_LH_ANGLES value with any of the other lfClipPrecision values. // If the CLIP_LH_ANGLES bit is set, the rotation for all fonts is // dependent on whether the orientation of the coordinate system is // left-handed or right-handed. If CLIP_LH_ANGLES is not set, device // fonts always rotate counter-clockwise, but the rotation of other // fonts is dependent on the orientation of the coordinate system. (For // more information about the orientation of coordinate systems, see // the description of the lfEscapement member.) // // lfQuality - Specifies the output quality of the font, which defines // how carefully the graphics device interface (GDI) must attempt to // match the logical-font attributes to those of an actual physical // font. This member can be one of the following values: // // Value Meaning // ================ ====================================================== // DEFAULT_QUALITY Appearance of the font does not matter. // DRAFT_QUALITY Appearance of the font is less important than when the // PROOF_QUALITY value is used. For GDI raster fonts, // scaling is enabled. Bold, italic, underline, and // strikeout fonts are synthesized if necessary. // PROOF_QUALITY Character quality of the font is more important than // exact // matching of the logical-font attributes. For GDI raster fonts, // scaling is disabled and the font closest in size is chosen. // Bold, italic, underline, and strikeout fonts are synthesized if // necessary. // // lfPitchAndFamily - Specifies the pitch and family of the font. The two // low-order bits, which specify the pitch of the font, can be one of // the following values: // // DEFAULT_PITCH VARIABLE_PITCH FIXED_PITCH // // The four high-order bits of the member, which specify the font // family, can be one of the following values: // // Value Meaning // ============== ======================================================== // FF_DECORATIVE Novelty fonts. Old English is an example. // FF_DONTCARE Don't care or don't know. // FF_MODERN Fonts with constant stroke width, with or without // serifs. Pica, Elite, and Courier New are examples. // FF_ROMAN Fonts with variable stroke width and with serifs. // Times New Roman and New Century Schoolbook are examples. // FF_SCRIPT Fonts designed to look like handwriting. Script and // Cursive are examples. // FF_SWISS Fonts with variable stroke width and without serifs. // MS Sans Serif is an example. // // An application can specify a value for the lfPitchAndFamily member // by using the Boolean OR operator to join a pitch constant with a // family constant. Font families describe the look of a font in a // general way. They are intended for specifying fonts when the exact // typeface desired is not available. // // lfFaceName - Specifies the typeface name of the font. The length of // this string must not exceed LF_FACESIZE - 1. The EnumFontFamilies // function can be used to enumerate the typeface names of all // currently available fonts. If lfFaceName is 0, GDI uses a // device-dependent typeface. // // Comments // // Applications can use the default settings for most of these members // when creating a logical font. The members that should always be // given specific values are lfHeight and lfFaceName. If lfHeight and // lfFaceName are not set by the application, the logical font that is // created is device-dependent. // // CFont fontVertical( h, 0, 2700, 2700, FW_NORMAL, 0, 0, 0, // ANSI_CHARSET, OUT_TT_ONLY_PRECIS, // CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, // VARIABLE_PITCH | FF_SWISS, 0); // // BOOL CreateFont( int nHeight, int nWidth, // int nEscapement, int nOrientation, // int nWeight, BYTE bItalic, // BYTE bUnderline, BYTE cStrikeOut, // BYTE nCharSet, BYTE nOutPrecision, // BYTE nClipPrecision, BYTE nQuality, // BYTE nPitchAndFamily, // LPCTSTR lpszFacename ); // // CFont( int height, int width, int escapement = 0, int orientation = 0, // int weight = FW_NORMAL, UINT8 italic = false, // BYTE underline = false, UINT8 strikeout = false, // UINT8 charSet = 1, UINT8 outputPrecision = OUT_TT_ONLY_PRECIS, // UINT8 clipPrecision = CLIP_DEFAULT_PRECIS, // UINT8 quality = DEFAULT_QUALITY, // UINT8 pitchAndFamily = DEFAULT_PITCH|FF_DONTCARE, // const char far *facename = 0 ); // // BOOL CreateFont( int nHeight, int nWidth, int nEscapement, // int nOrientation, int nWeight, BYTE bItalic, // BYTE bUnderline, BYTE cStrikeOut, BYTE nCharSet, // BYTE nOutPrecision, BYTE nClipPrecision, // BYTE nQuality, BYTE nPitchAndFamily, // LPCTSTR lpszFacename ); // ///////////////////////////////////////////////////////////////////////////// ZFont::ZFont( zVIEW vSubtask, zCPCHAR cpcTag, zLONG nPtSize, zSHORT nWeight, zSHORT bItalic, zSHORT bUnderscore, zSHORT bStrikeout, zLONG lTextColor, zLONG lTextBkColor, zSHORT nEscapement, zCPCHAR cpcFaceName ) { #ifdef DEBUG_ALL TraceLineS( "ZFont ctor: ", cpcTag ); #endif m_bSet = FALSE; m_nIdNbr = 0; zmemset( &m_Panose, 0, sizeof( PANOSE ) ); m_byCharset = ANSI_CHARSET; m_byPitchFamily = 0; m_TagList.AddTail( cpcTag ); m_clrText = fnTranslateColor( lTextColor ); if ( lTextBkColor == CLR_INVALID || lTextBkColor == 0xff000000 ) m_clrTextBk = CLR_INVALID; else m_clrTextBk = fnTranslateColor( lTextBkColor ); m_nPointSize = nPtSize; m_nWeight = nWeight; if ( bItalic ) m_nFlags = 1; else m_nFlags = 0; if ( bUnderscore ) m_nFlags |= 2; if ( bStrikeout ) m_nFlags |= 16; if ( m_nWeight >= FW_BOLD ) m_nFlags |= 32; m_nEscapement = nEscapement; if ( cpcFaceName == 0 && *cpcFaceName == 0 ) { ZSubtask *pZSubtask; if ( GetWindowAndCtrl( &pZSubtask, 0, vSubtask, 0 ) == 0 && pZSubtask->m_bUseMapDlgUnits ) { m_csFaceName = "MS Sans Serif"; } else m_csFaceName = "Arial"; } else m_csFaceName = cpcFaceName; zmemset( &m_Panose, 0, sizeof( PANOSE ) ); CreateFont( nPtSize, 0, nEscapement, nEscapement, nWeight, (BYTE) bItalic, (BYTE) bUnderscore, (BYTE) bStrikeout, ANSI_CHARSET, OUT_TT_ONLY_PRECIS, CLIP_DEFAULT_PRECIS, PROOF_QUALITY, (BYTE) (nEscapement ? VARIABLE_PITCH | FF_SWISS : DEFAULT_PITCH | FF_DONTCARE), m_csFaceName ); }
ZDib::ZDib( ) { zmemset( &m_bitmap, 0, sizeof( m_bitmap ) ); m_hdd = 0; m_bBitmapLoaded = FALSE; }
/////////////////////////////////////////////////////////////////////////////// // // OPERATION: TZZAPPSD_SendServerExecs // // PURPOSE: This Entry takes the zeidon.xdm and all xod object instances // and sends them to the Server for running the application on // the server. // //////////////////////////////////////////////////////////////////////// zOPER_EXPORT zSHORT OPERATION TZZAPP2D_SendServerExecs( zVIEW vSubtask ) { zVIEW vZApp; zVIEW vLPLR; zVIEW vMeta; zSHORT nRC; zCHAR szFileName[ zMAX_FILESPEC_LTH + 1 ]; zCHAR szMetaName[ 13 ]; zCHAR szAppName[ 32 ]; zCHAR szServerSubDir[ 33 ]; zCHAR szLPLR_Path[ zMAX_FILESPEC_LTH + 1 ]; zCHAR szMsg[ zSHORT_MESSAGE_LTH + 1 ]; zVIEW vApplSubtask; zCHAR szServer[ 33 ]; // get XLP for selceted application GetViewByName( &vZApp, "KZAPPLOO", vSubtask, zLEVEL_TASK ); GetStringFromAttribute( szAppName, vZApp, "APPLICATION", "APP_NAME" ); GetStringFromAttribute( szLPLR_Path, vZApp, "APPLICATION", "APP_ADOBIN" ); SysAppendcDirSep( szLPLR_Path ); zstrcpy( szFileName, szLPLR_Path ); zstrcat( szFileName, szAppName ); zstrcat( szFileName, ".XLP" ); // open Task LPLR nRC = ActivateOI_FromFile( &vLPLR, "TZCMLPLO", vSubtask, szFileName, zMULTIPLE ); if ( nRC ) { MessageSend( vSubtask, "CM00285", "Configuration Management", "Can't activate XLP for task.", zMSGQ_OBJECT_CONSTRAINT_ERROR, zBEEP ); return( -1 ); } SetNameForView( vLPLR, "TaskLPLR", vSubtask, zLEVEL_TASK); zmemset (szServer,0,sizeof(szServer)); // GetViewByName( &vLPLR, "TaskLPLR", vSubtask, zLEVEL_TASK ); // Start the network if necessary. Use zeidon and hzkzoe as constants for now. nRC = NetStatus( "zeidon" ); if ( nRC == 0 ) { nRC = NetStartup( "zeidon", "hzkzoe" ); if ( nRC ) { MessageSend( vSubtask, "CM00285", "Configuration Management", "Network cannot be started.", zMSGQ_OBJECT_CONSTRAINT_ERROR, zBEEP ); return( 0 ); } } // First get the application name and make sure it exists in the // zeidon.app object on the server. If it isn't there, add it. GetStringFromAttribute( szAppName, vLPLR, "LPLR", "Name" ); zstrcpy( szFileName, "zeidon.app" ); SfCreateSubtask( &vApplSubtask, vSubtask, "Zeidon System" ); nRC = NetActivateOI_FromFile( 0, szServer, &vMeta, "KZAPPLOO", vApplSubtask, szFileName, zSINGLE ); if ( nRC >= 0 ) { nRC = SetCursorFirstEntityByString( vMeta, "APPLICATION", "APP_NAME", szAppName, 0 ); if ( nRC >= zCURSOR_SET ) DropObjectInstance( vMeta ); else { CreateEntity( vMeta, "APPLICATION", zPOS_LAST ); SetAttributeFromString( vMeta, "APPLICATION", "APP_NAME", szAppName ); zstrcpy( szServerSubDir, szAppName ); zstrcat( szServerSubDir, "/" ); SetAttributeFromString( vMeta, "APPLICATION", "APP_DLL", szServerSubDir ); SetAttributeFromString( vMeta, "APPLICATION", "APP_ADOBIN", szServerSubDir ); SetAttributeFromString( vMeta, "APPLICATION", "APP_LOCAL", szServerSubDir ); TraceLineS( "*** Committing server file: ", szFileName ); zstrcpy( szMsg, "Sending ZEIDON.APP: " ); MB_SetMessage( vSubtask, 1, szMsg ); // Send OI to server. NetCommitOI_ToFile( 0, szServer, vMeta, szFileName, zASCII ); DropObjectInstance( vMeta ); } } else { SfDropSubtask( vApplSubtask, 0 ); MessageSend( vSubtask, "CM00286", "Configuration Management", "ZEIDON.APP cannot be activated.", zMSGQ_OBJECT_CONSTRAINT_ERROR, zBEEP ); return( 0 ); } SfDropSubtask( vApplSubtask, 0 ); // Send the XDM before all the xods. // First format the file name for activation on the client and then // format it for commit on the server. // GetStringFromAttribute( szFileName, vLPLR, "LPLR", "ExecDir" ); zstrcpy( szFileName, szLPLR_Path ); zstrcpy( szMetaName, "ZEIDON.XDM" ); zstrcat( szFileName, szMetaName ); TraceLineS( "*** Activating client file: ", szFileName ); nRC = ActivateOI_FromFile( &vMeta, "TZDMXGPO", vSubtask, szFileName, zSINGLE ); if ( nRC >= 0 ) { // Filename includes Directory-prefix **HH** GetStringFromAttribute( szFileName, vLPLR, "LPLR", "Name" ); zstrcat( szFileName, "/" ); zstrcat( szFileName, szMetaName ); TraceLineS( "*** Committing server file: ", szFileName ); MB_SetMessage( vSubtask, 1, "Sending XDM" ); // Send OI to server. NetCommitOI_ToFile( 0, szServer, vMeta, szFileName, zASCII ); } // Next loop through all the LODs, activating each XOD and sending // it to the server. SetCursorFirstEntityByInteger( vLPLR, "W_MetaType", "Type", zREFER_LOD_META, 0 ); nRC = SetCursorFirstEntity( vLPLR, "W_MetaDef", 0 ); while ( nRC >= zCURSOR_SET ) { zstrcpy( szFileName, szLPLR_Path ); GetStringFromAttribute( szMetaName, vLPLR, "W_MetaDef", "Name" ); zstrcat( szFileName, szMetaName ); zstrcat( szFileName, ".XOD" ); TraceLineS( "*** Activating client file: ", szFileName ); nRC = ActivateOI_FromFile( &vMeta, "TZZOXODO", vSubtask, szFileName, zSINGLE ); if ( nRC >= 0 ) { // Filename includes Directory-prefix **HH** GetStringFromAttribute( szFileName, vLPLR, "LPLR", "Name" ); zstrcat( szFileName, "/" ); zstrcat( szFileName, szMetaName ); zstrcat( szFileName, ".XOD" ); TraceLineS( "*** Committing server file: ", szFileName ); zstrcpy( szMsg, "Sending XOD: " ); zstrcat( szMsg, szMetaName ); MB_SetMessage( vSubtask, 1, szMsg ); // Send OI to server. NetCommitOI_ToFile( 0, szServer, vMeta, szFileName, zASCII ); } nRC = SetCursorNextEntity( vLPLR, "W_MetaDef", 0 ); } MB_SetMessage( vSubtask, 1, "Transmission Complete" ); return( 0 ); }
/************************************************************************************************* ** ** OPERATION: SetRptShapeFromBlob ** *************************************************************************************************/ zOPER_EXPORT zLONG /*GLOBAL */ OPERATION SetRptShapeFromBlob( zVIEW vReportDef ) { zCHAR szBlob[ 8 + (6 * sizeof( zLONG )) ]; // zVIEW vReport; // zLONG lSubtype; zULONG ulPenColor = 0xFF000000; zULONG ulShapeColor = 0xFF000000; zULONG ulLth = sizeof( szBlob ); zmemset( szBlob, 0, ulLth ); GetBlobFromAttribute( szBlob, &ulLth, vReportDef, "Control", "CtrlBOI" ); // TraceLineI( "Shape control blob lth = ", ulLth ); if ( ulLth == sizeof( szBlob ) || ulLth == sizeof( szBlob ) - (1 * sizeof( zLONG )) || // remove this soon ulLth == sizeof( szBlob ) - (2 * sizeof( zLONG )) ) { zLONG lPenWidth; zLONG lPenType; zLONG lRoundValue; zLONG lFlags = 0; if ( szBlob[ 4 ] == TRUE ) { TraceLineI( "**** Horizontal Line **** ", szBlob[ 4 ] ); SetAttributeFromInteger( vReportDef, "Control", "BorderBottom", szBlob[ 4 ] ); } /* SetCtrlState( vSubtask, "Rectangle", zCONTROL_STATUS_CHECKED, szBlob[ 0 ] ? TRUE : FALSE ); SetCtrlState( vSubtask, "RoundRect", zCONTROL_STATUS_CHECKED, szBlob[ 1 ] ? TRUE : FALSE ); SetCtrlState( vSubtask, "Ellipse", zCONTROL_STATUS_CHECKED, szBlob[ 2 ] ? TRUE : FALSE ); SetCtrlState( vSubtask, "Diamond", zCONTROL_STATUS_CHECKED, szBlob[ 3 ] ? TRUE : FALSE ); SetCtrlState( vSubtask, "HorizontalLine", zCONTROL_STATUS_CHECKED, szBlob[ 4 ] ? TRUE : FALSE ); SetCtrlState( vSubtask, "VerticalLine", zCONTROL_STATUS_CHECKED, szBlob[ 5 ] ? TRUE : FALSE ); SetCtrlState( vSubtask, "DiagonalDescend", zCONTROL_STATUS_CHECKED, szBlob[ 6 ] ? TRUE : FALSE ); SetCtrlState( vSubtask, "DiagonalAscend", zCONTROL_STATUS_CHECKED, szBlob[ 7 ] ? TRUE : FALSE ); */ lPenWidth = *((zPLONG) (szBlob + 8)); lPenType = *((zPLONG) (szBlob + 8 + sizeof( zLONG ))); ulPenColor = *((zPLONG) (szBlob + 8 + (2 * sizeof( zLONG )))); lRoundValue = *((zPLONG) (szBlob + 8 + (3 * sizeof( zLONG )))); if ( ulLth == sizeof( szBlob ) ) { ulShapeColor = *((zPULONG) (szBlob + 8 + (4 * sizeof( zLONG )))); lFlags = *((zPLONG) (szBlob + 8 + (5 * sizeof( zLONG )))); } zltoa( ulPenColor, szBlob ); SetAttributeFromString( vReportDef, "Control", "wLineColorText", szBlob ); SetAttributeFromInteger( vReportDef, "Control", "wLineColorInt", ulPenColor ); SetAttributeFromInteger( vReportDef, "Control", "BorderWidth", lPenWidth ); switch ( lPenType ) { case 1: SetAttributeFromInteger( vReportDef, "Control", "BorderStyle", 1 ); break; case 2: SetAttributeFromInteger( vReportDef, "Control", "BorderStyle", 2 ); break; case 3: SetAttributeFromInteger( vReportDef, "Control", "BorderStyle", 3 ); break; case 4: SetAttributeFromInteger( vReportDef, "Control", "BorderStyle", 4 ); break; default: SetAttributeFromInteger( vReportDef, "Control", "BorderStyle", 0 ); break; } zltoa( lRoundValue, szBlob ); //SetCtrlText( vSubtask, "RoundValue", szBlob ); } else { //SetCtrlState( vSubtask, "Rectangle", zCONTROL_STATUS_CHECKED, TRUE ); //SetCtrlText( vSubtask, "PenWidth", "1" ); } /* SetCtrlProperty( vSubtask, "__ColorLine", zCONTROL_PROPERTY_INTEGER_DATA, ulPenColor, 0 ); SetCtrlProperty( vSubtask, "__ColorShape", zCONTROL_PROPERTY_INTEGER_DATA, ulShapeColor, 0 ); */ return( 0 ); } // SetRptShapeFromBlob
///////////////////////////////////////////////////////////////////////////// // // bSubcontrol - TRUE - add controls to existing pZSubtask->m_pZMIXCtrl // FALSE - delete existing pZSubtask->m_pZMIXCtrl and start // a new list // ///////////////////////////////////////////////////////////////////////////// void OPERATION CreateZeidonCtrls( zVIEW vSubobject, ZSubtask *pZSubtask, CWnd *pWndParent, ZMapAct *pzmaComposite, zSHORT nOffsetX, zSHORT nOffsetY, zBOOL bSubcontrol ) { zKZWDLGXO_Ctrl_DEF CtrlDef; zFARPROC_CONTROL lpfnCtrlProc; LPLIBRARY hCCtlLibrary; zPCHAR pchDLL_Name; zPCHAR pchCOP; zSHORT nRC; #ifdef DEBUG_ALL TraceLineX( "CreateZeidonCtrls parent - ", (zLONG) pZSubtask ); #endif nRC = CheckExistenceOfEntity( vSubobject, szlCtrl ); if ( bSubcontrol == FALSE ) { mDeleteInit( pZSubtask->m_pZMIXCtrl ); if ( nRC > zCURSOR_UNCHANGED ) { zLONG lTempCtrlCnt; // just to get the long temporarily GetIntegerFromAttribute( &lTempCtrlCnt, pZSubtask->m_vDialog, szlWnd, "CtrlCnt" ); // TraceLineI( "CreateZeidonCtrls count ", lTempCtrlCnt ); pZSubtask->m_pZMIXCtrl = new ZMultiIdxSet( (fnCOMPARE) fnCompareCtrlNodes, (fnCOMPARE) fnSeekCtrlNode, lTempCtrlCnt ); // Instead of having ZMultiIdxSet delete the nodes itself, we call // a recursive routine (fnDeleteCtrls) to guarantee the child // controls are deleted before their parents. } else pZSubtask->m_pZMIXCtrl = 0; CreateViewFromViewForTask( &(pZSubtask->m_vPE), pZSubtask->m_pZTask->m_vPE, pZSubtask->m_vDialog ); } #ifdef DEBUG_LODSTRUCT zmemset( CtrlDef.Tag, 0xFE, sizeof( CtrlDef ) ); // CtrlDef.CheckByte = 0xFE; #endif while ( nRC > zCURSOR_UNCHANGED ) { // Get the structure of attributes for this control. zPCHAR pch = 0; // for derived Text attribute GetStructFromEntityAttrs( (zPCHAR) CtrlDef.Tag, vSubobject, szlCtrl ); #ifdef DEBUG_LODSTRUCT if ( CtrlDef.CheckByte != 0xFE ) MessageBox( 0, "CtrlDef Structure Length Error", "GetStructFromEntityAttrs", MB_OK ); // zPCHAR pchCheckByte = (zPCHAR) &(CtrlDef.CheckByte); // pchCheckByte--; // if ( *pchCheckByte == (char) 0xFE ) // TraceLineS( "zdrctl CtrlDef CheckByte error??", "" ); #endif GetAddrForAttribute( (zPCHAR *) &pch, vSubobject, szlCtrl, szlD_Text ); if ( *pch ) zstrcpy( CtrlDef.Text, pch ); #ifdef DEBUG_ALL TraceLineS( "Tag ", CtrlDef.Tag ); TraceLineI( "Type ", CtrlDef.Type ); TraceLineI( "IdNbr ", CtrlDef.IdNbr ); TraceLineI( "PSDLG_X ", CtrlDef.PSDLG_X ); TraceLineI( "PSDLG_Y ", CtrlDef.PSDLG_Y ); TraceLineI( "SZDLG_X ", CtrlDef.SZDLG_X ); TraceLineI( "SZDLG_Y ", CtrlDef.SZDLG_Y ); #endif // The token is validated by the painter and/or conversion to // the executable object, but we check here anyway. nRC = SetCursorFirstEntityByInteger( pZSubtask->m_pZTask->m_vPE, szlCtrl, szlKey, CtrlDef.Type, 0 ); if ( nRC != zCURSOR_SET ) { TraceLine( "(drvr) ID (%d) not found (%d) in PPE for Ctrl: %s.%s.%s", CtrlDef.Type, nRC, pZSubtask->m_pzsDlgTag ? *(pZSubtask->m_pzsDlgTag) : "?", pZSubtask->m_pzsWndTag ? *(pZSubtask->m_pzsWndTag) : "?", CtrlDef.Tag ); DisplayEntityInstance( pZSubtask->m_pZTask->m_vPE, szlCtrl ); DisplayObjectInstance( pZSubtask->m_pZTask->m_vPE, 0, 0 ); // Skip this one and try the next. nRC = SetCursorNextEntity( vSubobject, szlCtrl, 0 ); continue; } GetAddrForAttribute( (zPCHAR *) &pchDLL_Name, pZSubtask->m_pZTask->m_vPE, szlCtrl, szlDLL ); GetAddrForAttribute( (zPCHAR *) &pchCOP, pZSubtask->m_pZTask->m_vPE, szlCtrl, szlCOP ); // If the DLL name is added to the list, this is the first time it // has been encountered ... so call its initialization routine. pZSubtask->m_pZTask->AddApplicationDLL( pZSubtask, pchDLL_Name ); hCCtlLibrary = 0; // set to zero for GetOperationDynamicCallAddress lpfnCtrlProc = (zFARPROC_CONTROL) GetOperationDynamicCallAddress( pZSubtask->m_vDialog, (LPLPLIBRARY) &hCCtlLibrary, pchDLL_Name, pchCOP, "(drvr) Ctrl" ); try { if ( lpfnCtrlProc ) // && (k % 2) == 0 ) { // TraceLineS( "Create Control: ", pchCOP ); (*lpfnCtrlProc)( pZSubtask, pWndParent, pzmaComposite, vSubobject, nOffsetX, nOffsetY, &CtrlDef ); } } #if 0 catch( CResourceException *e ) { zCHAR szMsg[ 256 ]; e->GetErrorMessage( szMsg, sizeof( szMsg ) ); zstrcat( szMsg, } #endif catch( CException *e ) { zCHAR szMsg[ 256 ]; e->GetErrorMessage( szMsg, sizeof( szMsg ) ); MessageSend( pZSubtask->m_vDialog, 0, "Zeidon Control", szMsg, zMSGQ_MODAL_ERROR, FALSE ); break; } nRC = SetCursorNextEntity( vSubobject, szlCtrl, 0 ); } // end of: while ( nRC == zCURSOR_UNCHANGED ) looping thru controls if ( bSubcontrol == FALSE ) { DropView( pZSubtask->m_vPE ); pZSubtask->m_vPE = 0; // using this to determine Ctrls have been created // Ctrl creation is complete ... notify each ctrl. if ( pZSubtask->m_pZMIXCtrl ) { pZSubtask->m_pZMIXCtrl->VisitInorder( (fnVISIT_INORDER) fnPostCreateCtrls, 0, 0, 0 ); } } }
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 ); }