//*********************************************************************** // // ENTRY: zNetStopListen // // PURPOSE: To close a socket set up to listen. // // DESCRIPTION: This call closes the socket set up to listen for connections // from other nodes on the network. // // PARAMETERS: pszNetworkName - Unique internal 'Zeidon' name of the // network. // ppHandle - Network pointer to buffer created in // zNetStartup. // // RETURNS: 0 - Listen closed successfully. // zCALL_ERROR - Error. // //*********************************************************************** int PASCAL zNetStopListen( LPSTR pszNetworkName, LPVOID * ppHandle ) { LPSOCKETS lpSockets = (LPSOCKETS) *ppHandle; int nTraceLevel = TRACELEVEL; if ( nTraceLevel > 1 ) { TraceLineS( "(zwinsock) Stopping listen", "" ); } if ( lpSockets->sockListen == INVALID_SOCKET ) { TraceLineS( "(zwinsock) No Listen socket!", "" ); return( 0 ); // Return 0 because nothing was done. } if ( closesocket( lpSockets->sockListen ) == SOCKET_ERROR ) { TraceLineS( "(zwinsock) Error shutting down listen socket", "" ); fnShowError( "closesocket" ); return( zCALL_ERROR ); } lpSockets->sockListen = INVALID_SOCKET; if ( nTraceLevel > 1 ) { TraceLineS( "(zwinsock) Listen stopped", "" ); } return( 0 ); } // zStopListen
// Get the time from the time control and map it to the data OI. zSHORT ZTime::MapToOI( zLONG lFlag ) { zVIEW vApp; #ifdef DEBUG_ALL TraceLineS( "ZTime::MapToOI: ", *m_pzsTag ); if ( m_pzsAName ) TraceLineS( "In MapToOI for ANAME ==> ", *m_pzsAName ); #endif // If the control is not Visible and Enabled, or if the view is not found, // do not do mapping. if ( m_pzsVName && (vApp = IsVisibleForMapToOI( *m_pzsVName )) != 0 ) { if ( CheckExistenceOfEntity( vApp, *m_pzsEName ) != 0 ) return( 0 ); COleDateTime time; if ( m_DateTime.GetTime( time ) ) { SetZeidonDateAttributeFromOleDateTime( time, vApp, *m_pzsEName, *m_pzsAName ); } } return( 0 ); }
ZFont::~ZFont( ) { #ifdef DEBUG_ALL if ( m_TagList.m_pHeadName ) TraceLineS( "ZFont dtor: ", m_TagList.m_pHeadName->m_csName ); else TraceLineS( "ZFont dtor: ", "(Null)" ); #endif }
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 } }
/************************************************************************************************* ** ** OPERATION: GetBorderLineWidth ** *************************************************************************************************/ zOPER_EXPORT zLONG /*GLOBAL */ OPERATION GetBorderLineWidth( zLONG lBorderStyle, zPCHAR szWidth ) { TraceLineS( "*** In GetBorderLineWidth *****", "" ); lBorderStyle >>= 24; zltoa( lBorderStyle, szWidth ); TraceLineS( "*** szWidth *****", szWidth ); return( 0 ); } // GetBorderLineWidth
//*********************************************************************** // // ENTRY: zNetClose // // PURPOSE: To shut down everything needed for winsock networking. // // DESCRIPTION: This call closes the Listen socket and then calls WSACleanup // to close winsock stuff. // // PARAMETERS: pszNetworkName - Unique internal 'Zeidon' name of the // network. // ppHandle - Network pointer to buffer created in // zNetStartup. // // RETURNS: 0 - Network closed successfully. // zCALL_ERROR - Error. // //*********************************************************************** int PASCAL zNetClose( LPSTR pszNetworkName, LPVOID * ppHandle, HINSTANCE hInstance ) { LPSOCKETS lpSockets = (LPSOCKETS) *ppHandle; if ( TRACELEVEL > 0 ) { TraceLineS( "(zwinsock) Shutting down network zWinSock", "" ); } WSACleanup( ); DestroyWindow( lpSockets->hwndMain ); gnNetworkCount--; if ( gnNetworkCount == 0 ) UnregisterClass( "WinsockClientWindow", hInstance ); // After the following call, lpSockets is no longer valid. GlobalUnlock( lpSockets->hMemHandle ); GlobalFree( lpSockets->hMemHandle ); *ppHandle = 0; return( 0 ); } // zNetClose
void TraceLineI( LPSTR psz1, LONG l ) { char szL[ 10 ]; _ltoa( l, szL, 10 ); TraceLineS( psz1, szL ); }
void TZNoteBook::DrawItem( LPDRAWITEMSTRUCT pDrawInfo ) { #if 0 //def DEBUG_ALL lots of messages TraceLineS( "TZNoteBook::DrawItem ================>", "" ); #endif if ( pDrawInfo->hwndItem != m_hWnd ) { if ( ReflectLastMsg( pDrawInfo->hwndItem ) ) return; // eat it } CRect rect; rect.left = pDrawInfo->rcItem.left; rect.right = pDrawInfo->rcItem.right; rect.top = pDrawInfo->rcItem.top; rect.bottom = pDrawInfo->rcItem.bottom; HBRUSH hLiteBrush = ::CreateSolidBrush( ::GetSysColor( COLOR_BTNFACE ) ); ::FillRect( pDrawInfo->hDC, &rect, hLiteBrush ); DeleteObject( hLiteBrush ); CTabCtrl::DrawItem( pDrawInfo ); }
// Drawing: for all 4 control types void TZNoteBook::OnDrawItem( int nIDCtl, LPDRAWITEMSTRUCT pDrawInfo ) { #if 0 //def DEBUG_ALL lots of messages TraceLineS( "TZNoteBook::OnDrawItem ================>", "" ); #endif if ( pDrawInfo->CtlType == ODT_MENU ) { CMenu* pMenu = CMenu::FromHandlePermanent( (HMENU) pDrawInfo->hwndItem ); if ( pMenu ) { pMenu->DrawItem( pDrawInfo ); return; // eat it } } else { // Reflect notification to child window control. if ( ReflectLastMsg( pDrawInfo->hwndItem ) ) return; // eat it } // not handled - do default Default( ); }
zOPER_EXPORT zLONG OPERATION Exec_Go( zVIEW vSubtask ) { zLONG lRC = 0; zPVOID hWRKS; // initialize work storage manager if ( WRKS_Init( &hWRKS ) < 0 ) { // Error in WRKS system MessageSend( vSubtask, "VM03002", "VML Interpretor", "Error Initializing Work Storage", zMSGQ_OBJECT_CONSTRAINT_ERROR, zBEEP ); TraceLineS( "VML Interpreter Error ","Initializing Work Storage" ); return( zXC_OPERATION_EXECUTED ); } if ( setjmp( g_jbWRKS ) != 0 ) { // Error return from longjmp WRKS_Close( &hWRKS ); return( zXC_STEP_EXECUTED ); } lRC = Go( vSubtask, hWRKS, &lRC ); // close work storage manager WRKS_Close( &hWRKS ); return( lRC ); }
///////////////////////////////////////////////////////////////////////////// // ZListTip // ZListTip::ZListTip( zLONG lHoverDelay ) { #ifdef DEBUG_ALL TraceLineS( "ZListTip::ctor", "====================>>>>" ); #endif // Register the window class if it has not already been registered. WNDCLASS wndcls; HINSTANCE hInst = AfxGetInstanceHandle( ); if ( ::GetClassInfo( hInst, "ZeidonListTip", &wndcls ) == 0 ) { // Otherwise we need to register a new class. wndcls.style = CS_SAVEBITS; wndcls.lpfnWndProc = ::DefWindowProc; wndcls.cbClsExtra = wndcls.cbWndExtra = 0; wndcls.hInstance = hInst; wndcls.hIcon = 0; wndcls.hCursor = LoadCursor( hInst, IDC_ARROW ); wndcls.hbrBackground = (HBRUSH)(COLOR_INFOBK + 1); wndcls.lpszMenuName = 0; wndcls.lpszClassName = "ZeidonListTip"; if ( AfxRegisterClass( &wndcls ) == 0 ) AfxThrowResourceException( ); } m_ulDblClickInterval = 0; m_ptStart.x = m_ptStart.y = 0; m_lHoverDelay = lHoverDelay; }
// 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; } }
void ZMLE::MLENKillFocus( ) { #ifdef DEBUG_ALL TraceLineS( "ZMLE::MLENKillFocus: ", *m_pzsTag ); #endif ZMapAct *pzmaGetFocus = 0; CWnd *pWnd = GetFocus( ); if ( pWnd && pWnd->m_hWnd != m_hWnd ) { // Attempt to locate the child window using the list of Zeidon MapActs zLONG k = m_pZSubtask->m_pZMIXCtrl->GetCount( ); while ( k ) { pzmaGetFocus = (ZMapAct *) m_pZSubtask->m_pZMIXCtrl->GetAt( k ); if ( pzmaGetFocus && pzmaGetFocus->m_pCtrl && pzmaGetFocus->m_pCtrl->m_hWnd == pWnd->m_hWnd ) { break; } k--; } if ( k == 0 ) pzmaGetFocus = 0; } if ( pzmaGetFocus ) ProcessEvent( this, 64 ); m_pZSubtask->InformDriverOfKillFocus( this ); Default( ); // pass it along to parent }
// Get the data from the OI and map it to the entry control. zSHORT ZMLE::MapFromOI( WPARAM wFlag ) { #ifdef DEBUG_ALL TraceLineS( "ZMLE::MapFromOI: ", *m_pzsTag ); #endif if ( m_pzsVName && m_pzsEName && m_pzsAName ) { zVIEW vApp = 0; if ( GetViewByName( &vApp, *m_pzsVName, m_pZSubtask->m_vDialog, zLEVEL_ANY ) > 0 ) { if ( m_ulLth == 0 ) { GetAttributeDisplayLength( &m_ulLth, vApp, *m_pzsEName, *m_pzsAName, *m_pzsContext ); LimitTextLength( (zSHORT) m_ulLth ); } } // if ( zstrcmp( *m_pzsTag, "MLEdit7" ) == 0 ) // DisplayEntityInstance( vApp, *m_pzsEName ); } return( ZMapAct::MapFromOI( ) ); }
zSHORT ZTime::MapFromOI( WPARAM wFlag ) { #ifdef DEBUG_ALL TraceLineS( "ZTime::MapFromOI: ", *m_pzsTag ); #endif // 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 ) { zVIEW vApp; m_ulMapActFlag2 |= zMAPACT_MAPPING_FROM_OI; zUSHORT uMapState = GetMappingAutoGray( &vApp, *m_pzsVName, *m_pzsEName, *m_pzsAName ); // TraceLineS( "ZMapAct::MapFromOI ", *m_pzsTag ); // TraceLineX( "ZMapAct::MapFromOI vApp: ", (zLONG) vApp ); if ( vApp && (uMapState & zMAPACT_ENTITY_EXISTS) ) { COleDateTime time; GetOleDateTimeFromZeidonDateAttribute( time, vApp, *m_pzsEName, *m_pzsAName ); m_DateTime.SetTime( time ); } } return( 0 ); }
///////////////////////////////////////////////////////////////////////////// // // CONSTRUCTOR: Tab/Notebook control // ///////////////////////////////////////////////////////////////////////////// // ctor TZNoteBook::TZNoteBook( TZPainterWindow *pPainterWindow, TZPainterCtrl *pCtrlParent, CWnd *pWndParent, CRect& rect, zVIEW vCtrl, zLONG lType, zBOOL bPlaceHolder, zLONG lZKey, zLONG lTabStopNbr, zLONG lCtrlID, zPCHAR pchTag, zPCHAR pchText ) : CTabCtrl( ), TZPainterCtrl( pPainterWindow, pCtrlParent, pWndParent, rect, vCtrl, this, pchTag, pchText, lType, bPlaceHolder, lZKey, lTabStopNbr, lCtrlID ) { #ifdef DEBUG_ALL TraceLineS( "TZNoteBook::ctor ", m_csTag ); #endif zLONG lTabsPerRow = 0; m_bDeletable = TRUE; // mark it as deletable m_bInitialized = FALSE; m_pZNotePage = 0; m_nPageCnt = 0; m_nTabNbrMax = 1; Attr.Style = WS_CHILD | WS_VISIBLE | WS_TABSTOP; if ( vCtrl ) { OrderEntityForView( vCtrl, szlCtrlCtrl, "Type A" ); zCHAR szBlob[ 5 * sizeof( zLONG ) ]; zULONG ulLth = zsizeof( szBlob ); GetBlobFromAttribute( szBlob, &ulLth, vCtrl, "Control", "CtrlBOI" ); // TraceLineI( "TZNoteBook ctor Blob Lth = ", ulLth ); if ( ulLth >= 3 * sizeof( zLONG ) ) { lTabsPerRow = *((zPLONG) (szBlob + sizeof( zLONG ) * 2)); } } // if ( lTabsPerRow ) // Attr.Style |= TCS_MULTILINE, CreateZ( ); ShowWindow( SW_SHOW ); #if 0 CRect r; r.top = GetClientTop( ); r.left = GetClientLeft( ); r.right = r.left + GetClientWidth( ); r.bottom = r.top + GetClientHeight( ); TraceRect( "TZNoteBook ctor Client Rect:", r ); #endif }
void ZMLE::MLENVscroll( ) { #ifdef DEBUG_ALL TraceLineS( "ZMLE::MLENVscroll: ", *m_pzsTag ); #endif Default( ); // pass it along to parent }
TZPainterCtrl * TZNotePage::GetRealCtrl( ) { #ifdef DEBUG_ALL TraceLineS( "TZNotePage::GetRealCtrl ", m_csTag ); #endif return( m_pCtrlParent->GetRealCtrl( ) ); }
// ZTime - dtor ZTime::~ZTime( ) { #ifdef DEBUG_ALL TraceLineS( "ZTime::dtor ", *m_pzsTag ); #endif if ( mIs_hWnd( m_hWnd ) ) DestroyWindow( ); }
ZDrOleClient::~ZDrOleClient( ) { #ifdef DEBUG_ALL TraceLineS( "ZDrOleClient::~ZDrOleClient dtor", "" ); #endif // TODO: add cleanup code here mDeleteInit( m_pDispatchInstance ); }
void ZMLE::MLENUpdate( ) { #ifdef DEBUG_ALL TraceLineS( "ZMLE::MLENUpdate: ", *m_pzsTag ); #endif ProcessEvent( this, 2048 ); Default( ); // pass it along to parent }
// ZTimer - dtor ZTimer::~ZTimer( ) { #ifdef DEBUG_ALL TraceLineS( "ZTimer::dtor ", *m_pzsTag ); #endif m_bEnabled = FALSE; if ( mIs_hWnd( m_hWnd ) ) DestroyWindow( ); }
zSHORT ZMLE::SelectText( zSHORT nTextStartPos, zSHORT nTextEndPos ) { #ifdef DEBUG_ALL TraceLineS( "ZEdit::SelectText: ", *m_pzsTag ); #endif SetSel( nTextStartPos - 1, nTextEndPos - 1 ); return( 0 ); }
BOOL ZTimer::DestroyWindow( ) { #ifdef DEBUG_ALL TraceLineS( "ZTimer::DestroyWindow ", *m_pzsTag ); #endif m_ulMapActFlag2 &= ~(zMAPACT_MAPPED_FROM_OI | zMAPACT_CREATE_CHILDREN | zMAPACT_CREATED); return( CStatic::DestroyWindow( ) ); }
TZPainterCtrl * TZNotePage::IsDeletable( ) { #ifdef DEBUG_ALL TraceLineS( "TZNotePage::IsDeletable ", m_csTag ); #endif if ( m_pZNoteBook ) m_pZNoteBook->m_bDeletable = TRUE; return( 0 ); }
void ZMLE::MLENSetFocus( ) { #ifdef DEBUG_ALL TraceLineS( "ZMLE::MLENSetFocus: ", *m_pzsTag ); #endif ProcessEvent( this, 32 ); if ( m_pZSubtask->InformDriverOfSetFocus( this ) ) { Default( ); // pass it along to parent } }
void TZNoteBook::CreateZ( ) { #ifdef DEBUG_ALL TraceLineS( "TZNoteBook::CreateZ ", m_csTag ); #endif Create( WS_CHILD | WS_VISIBLE | WS_TABSTOP, // || TCS_MULTILINE, CRect( Attr.X - 2, Attr.Y - 2, Attr.X + Attr.W + 4, Attr.Y + Attr.H + 4 ), m_pWndParent, -1 ); }
// Get the text for the entry control and map it to the data OI. zSHORT ZMLE::MapToOI( zLONG lFlag ) { zVIEW vApp; #ifdef DEBUG_ALL TraceLineS( "ZMLE::MapToOI: ", *m_pzsTag ); if ( m_pzsAName ) TraceLineS( "In MapToOI for ANAME ==> ", *m_pzsAName ); #endif // If the control is not Visible and Enabled, or if the view is not found, // do not do mapping. if ( m_pzsVName && (vApp = IsVisibleForMapToOI( *m_pzsVName )) != 0 ) { if ( CheckExistenceOfEntity( vApp, *m_pzsEName ) != 0 ) return( 0 ); #ifdef zREMOTE_SERVER zCHAR szMap[ 65534 ]; GetZCtrlText( this, szMap, sizeof( szMap ) ); #else CString szMap; // named szMap rather than csMap for SetAttribute below GetWindowText( szMap ); #endif zSHORT nRC = SetAttributeFromVariable( vApp, *m_pzsEName, *m_pzsAName, szMap, zTYPE_STRING, 0, *m_pzsContext, m_pzsContext->IsEmpty( ) ? (zSHORT) (lFlag | zUSE_DEFAULT_CONTEXT) : (zSHORT) lFlag ); return( nRC ); } return( 0 ); }
///////////////////////////////////////////////////////////////////////////// // // FUNCTION: fnPopMsgQ_State // // PURPOSE: This routine pops the state of the message queue object // ///////////////////////////////////////////////////////////////////////////// zLONG fnPopMsgQ_State( zVIEW vMsgQ ) { zPCHAR pStack; // blob containing Status Stack zLONG lPrevState = 0; zUSHORT uCnt; #ifdef zREMOTE_SERVER // Protect this with a semaphore!!! SysMutexLock( vSubtask, "ZDm", 0, 0 ); // TraceLineS( "PopMsgQ_State Lock Mutex ZDm", "" ); #endif GetAddrForAttribute( (zPCHAR *) &pStack, vMsgQ, szlTask, szlStatus ); if ( pStack ) { uCnt = *((zPSHORT) (pStack + sizeof( zLONG ))); if ( uCnt > 0 ) { uCnt--; *((zPSHORT) (pStack + sizeof( zLONG ))) = uCnt; } else { OperatorSend( 0, szlDrvr, "Cannot pop message queue", TRUE ); } if ( uCnt ) { lPrevState = *((zPLONG) (pStack + // sizeof( zLONG ) + the extra long is in uCnt 2 * sizeof( zSHORT ) + uCnt * sizeof( zLONG ))); } else lPrevState = 0; *((zPLONG) pStack) = lPrevState; } else { TraceLineS( "PopMsgQ_State Lock Mutex ZDm: ", "NULL Status?" ); DisplayObjectInstance( vMsgQ, 0, 0 ); ::MessageBox( 0, "PushMsgQ_State NULL Status?", "ZDr Error", MB_OK ); } #ifdef zREMOTE_SERVER // TraceLineS( "PopMsgQ_State Unlock Mutex ZDm", "" ); SysMutexUnlock( vSubtask, "ZDm", 0 ); #endif return( lPrevState ); }
void ZMLE::MLENChange( ) { #ifdef DEBUG_ALL TraceLineS( "ZMLE::MLENChange: ", *m_pzsTag ); #endif ProcessEvent( this, 1024 ); Default( ); // pass it along to parent if ( (m_ulMapActFlag2 & zMAPACT_MAPPING_FROM_OI) && (m_pZSubtask->m_ulSubtaskFlags & zSUBTASK_SELECT_FIRST_EDIT) ) { SetSel( 0, -1 ); } }