From: Jeffrey D. <ha...@us...> - 2003-12-23 00:51:46
|
Log Message: ----------- Drak's updates and whatever else I have in my mangled source tree Modified Files: -------------- /cvsroot/decaldev/source/Inject: BarLayer.cpp BarLayer.h Manager.cpp RootLayer.cpp View.cpp Revision Data ------------- Index: BarLayer.cpp =================================================================== RCS file: /cvsroot/decaldev/source/Inject/BarLayer.cpp,v retrieving revision 1.17 retrieving revision 1.18 diff -u -d -r1.17 -r1.18 --- BarLayer.cpp 10 Dec 2003 19:56:03 -0000 1.17 +++ BarLayer.cpp 23 Dec 2003 00:51:44 -0000 1.18 @@ -27,6 +27,7 @@ eBtnBackwards = 2, ePager = 3, eBtnMinMax = 4, + eBtnDockCycle = 5, eChildBarFirst = 1000 }; @@ -36,20 +37,24 @@ void cBarLayer::onCreate() { + //::MessageBox( NULL, _T( "cBarLayer::onCreate" ), _T( "Inject.dll" ), MB_OK ); m_pSite->get_PluginSite( &m_pPlugin ); - m_pPlugin->get_Hooks( &m_pHooks ); + + if (!cManager::_p->m_bContainer) + m_pPlugin->get_Hooks( &m_pHooks ); + _ASSERTE( m_pPlugin.p != NULL ); m_pPlugin->LoadBitmapPortal( 0x06001115, &m_pBackground ); _ASSERTE( m_pBackground.p != NULL ); - RegKey key; key.Create( HKEY_LOCAL_MACHINE, _T( "SOFTWARE\\Decal" ) ); - DWORD dwAlpha = 255, dwRadarDraw = 1; + DWORD dwAlpha = 255, dwRadarDraw = 1, dwBarDocked = 0; m_bRadarDraw = true; + m_bDocked = false; if( key.QueryDWORDValue( "BarAlpha", dwAlpha ) == ERROR_SUCCESS ) m_pSite->put_Alpha( dwAlpha ); @@ -57,6 +62,9 @@ if( key.QueryDWORDValue( "BarRadarDraw", dwRadarDraw ) == ERROR_SUCCESS ) m_bRadarDraw = dwRadarDraw ? true : false; + if( key.QueryDWORDValue( "BarDocked", dwBarDocked ) == ERROR_SUCCESS ) + m_bDocked = (dwBarDocked == 1) ? true : false; + if( key.QueryDWORDValue( "BarState", m_nMinMax ) != ERROR_SUCCESS ) m_nMinMax = eStateMax; @@ -94,6 +102,25 @@ m_pBtnMinMax->SetImages( 0, 0x0600113C, 0x0600113C ); ICommandEventsImpl< BUTTON_MINMAX, cBarLayer >::advise( m_pBtnMinMax ); m_pBtnMinMax->put_Matte( RGB( 0, 0, 0 ) ); + + + } + + { + lpChild.ID = eBtnDockCycle; + CComPtr< ILayer > pUnk; + HRESULT hRes = ::CoCreateInstance( CLSID_Button, NULL, CLSCTX_INPROC_SERVER, IID_ILayer, reinterpret_cast< void ** >( &pUnk ) ); + + _ASSERTE( SUCCEEDED( hRes ) ); + + m_pSite->CreateChild( &lpChild, pUnk ); + pUnk->QueryInterface( & m_pBtnDockCycle ); + + _ASSERTE ( m_pBtnDockCycle.p != NULL ); + + m_pBtnDockCycle->SetImages( 0, 0x0600129A, 0x0600129B ); + ICommandEventsImpl< BUTTON_DOCKCYCLE, cBarLayer >::advise( m_pBtnDockCycle ); + m_pBtnDockCycle->put_Matte( RGB( 0, 0, 0 ) ); } { @@ -286,18 +313,32 @@ { _ASSERTE( m_pSite.p != NULL ); - // ::MessageBox( NULL, _T( "cBarLayer::reformat" ), _T( "Inject.dll" ), MB_OK ); + //::MessageBox( NULL, _T( "cBarLayer::reformat" ), _T( "Inject.dll" ), MB_OK ); SIZE sz; m_pPlugin->GetScreenSize( &sz ); long lX = sz.cx, lY = sz.cy; - m_pHooks->get_Area3DHeight( &lY ); - m_pHooks->get_Area3DWidth( &lX ); - if( (lX > 0) && (lY < 5000) ) - m_nScreenWidth = lX; - if( (lX > 0) && (lY < 5000) ) - m_nScreenHeight = lY; + // Drakier: if we are not in the container, get the 3D Area + if ( !cManager::_p->m_bContainer ) + { + m_pHooks->get_Area3DHeight( &lY ); + m_pHooks->get_Area3DWidth( &lX ); + } + + // Drakier: if we are in the container, or the 3D area's are NULL + if ( (cManager::_p->m_bContainer) || (&lX == NULL) || (&lY == NULL) ) + { + m_nScreenWidth = sz.cx - PANEL_SIZE; + m_nScreenHeight = sz.cy; + } + else // Drakier: If everything comes out right and we are not in container + { + if( (&lX != NULL) && (lX > 0) && (lX < 5000) ) + m_nScreenWidth = lX; + if( (&lY != NULL) && (lY > 0) && (lY < 5000) ) + m_nScreenHeight = lY; + } // Drakier: set up the bar position // Drakier: make sure bar isn't off of left side of screen @@ -332,17 +373,42 @@ else { // Drakier: SIDE DOCK - // Drakier: make sure bar isn't off BOTTOM of screen - if (m_nBarLength > (m_nScreenHeight - (VITALS_SIZE + CHATBAR_SIZE + LOOT_SIZE)) ) - m_nBarLength = (m_nScreenHeight - (VITALS_SIZE + CHATBAR_SIZE + LOOT_SIZE)); + // Check the Right Side if Radar is on! + if ( ( !m_bRadarDraw ) && ( m_nBarDock == DOCK_RIGHT ) && ( m_nBarStartPos < RADAR_SIZE ) ) + m_nBarStartPos = RADAR_SIZE; + + if ( cManager::_p->m_bContainer ) // Drakier: In container (use CONST sizes) + { + // Drakier: make sure bar isn't off BOTTOM of screen + if (m_nBarLength > (m_nScreenHeight - (VITALS_SIZE + CHATBAR_SIZE + LOOT_SIZE)) ) + m_nBarLength = (m_nScreenHeight - (VITALS_SIZE + CHATBAR_SIZE + LOOT_SIZE)); - // Drakier: adjust bar start position so its not offscreen - if (m_nBarStartPos > (m_nScreenHeight - (VITALS_SIZE + CHATBAR_SIZE + LOOT_SIZE)) ) - m_nBarStartPos = (m_nScreenHeight - (VITALS_SIZE + CHATBAR_SIZE + LOOT_SIZE)) - m_nBarLength; + // Drakier: adjust bar start position so its not offscreen + if (m_nBarStartPos > (m_nScreenHeight - (VITALS_SIZE + CHATBAR_SIZE + LOOT_SIZE)) ) + m_nBarStartPos = (m_nScreenHeight - (VITALS_SIZE + CHATBAR_SIZE + LOOT_SIZE)) - m_nBarLength; - // Drakier: Adjust for Panels - if ((m_nBarStartPos + m_nBarLength) > (m_nScreenHeight - (VITALS_SIZE + CHATBAR_SIZE + LOOT_SIZE)) ) - m_nBarLength = (m_nScreenHeight - (VITALS_SIZE + CHATBAR_SIZE + LOOT_SIZE)) - m_nBarStartPos; + // Drakier: Adjust for Panels + if ((m_nBarStartPos + m_nBarLength) > (m_nScreenHeight - (VITALS_SIZE + CHATBAR_SIZE + LOOT_SIZE)) ) + m_nBarLength = (m_nScreenHeight - (VITALS_SIZE + CHATBAR_SIZE + LOOT_SIZE)) - m_nBarStartPos; + } + else // Drakier: Not in container + { + // Drakier: make sure bar isn't off BOTTOM of screen + if (m_nBarLength > m_nScreenHeight ) + m_nBarLength = m_nScreenHeight; + + // Drakier: adjust bar start position so its not offscreen + if (m_nBarStartPos > m_nScreenHeight) + m_nBarStartPos = m_nScreenHeight - m_nBarLength; + + // Drakier: Adjust for Panels + if ((m_nBarStartPos + m_nBarLength) > m_nScreenHeight ) + m_nBarLength = m_nScreenHeight - m_nBarStartPos; + + // Drakier: if Docked (within 10 px) then stretch to fit + if ( m_bDocked ) + m_nBarLength = m_nScreenHeight - m_nBarStartPos; + } } // Drakier: Draw the bar @@ -420,10 +486,30 @@ pBackwardsSite->put_Position( &rc ); // Drakier: this is a change because of the new LENGTH system + // Now do the forwards if (m_nBarDock != DOCK_TOP) // Side Dock { rc.left = 3; + rc.top = m_nBarLength - 46; + rc.right = 19; + rc.bottom = m_nBarLength - 30; + } + else // Top Dock + { + rc.left = m_nBarLength - 46; + rc.top = 3; + rc.right = m_nBarLength - 30; + rc.bottom = 19; + } + CComPtr< ILayerSite > pFwdSite; + m_pSite->get_Child( eBtnForwards, ePositionByID, &pFwdSite ); + pFwdSite->put_Position( &rc ); + + // Now do the dock cycle + if (m_nBarDock != DOCK_TOP) // Side Dock + { + rc.left = 3; rc.top = m_nBarLength - 28; rc.right = 19; rc.bottom = m_nBarLength - 12; @@ -435,9 +521,9 @@ rc.right = m_nBarLength - 12; rc.bottom = 19; } - CComPtr< ILayerSite > pFwdSite; - m_pSite->get_Child( eBtnForwards, ePositionByID, &pFwdSite ); - pFwdSite->put_Position( &rc ); + CComPtr< ILayerSite > pDockCycleSite; + m_pSite->get_Child( eBtnDockCycle, ePositionByID, &pDockCycleSite ); + pDockCycleSite->put_Position( &rc ); // Now the pager CComPtr< ILayerSite > pPagerSite; @@ -449,13 +535,13 @@ //rc.top = 50; rc.top = 30; rc.right = 22; - rc.bottom = m_nBarLength - 30; + rc.bottom = m_nBarLength - 48; } else // Top Dock { rc.left = 50; rc.top = 1; - rc.right = m_nBarLength - 30; + rc.right = m_nBarLength - 48; rc.bottom = 22; } pPagerSite->put_Position( &rc ); @@ -701,6 +787,31 @@ Reformat(); } +void __stdcall cBarLayer::onDockCycleHit(long nID) { + RegKey key; + key.Create(HKEY_LOCAL_MACHINE, _T("SOFTWARE\\Decal")); + + m_nBarDock = (m_nBarDock + 1) % 3; + + if (m_nBarDock != DOCK_TOP) + { + m_pBtnForwards->SetImages( 0, 0x0600125E, 0x0600125F ); + m_pBtnBackwards->SetImages( 0, 0x06001261, 0x06001262 ); + m_nMinMax = eStateMin; + } + else + { + m_pBtnForwards->SetImages( 0, 0x06001298, 0x06001299 ); + m_pBtnBackwards->SetImages( 0, 0x06001295, 0x06001296 ); + if( key.QueryDWORDValue( "BarState", m_nMinMax ) != ERROR_SUCCESS ) + m_nMinMax = eStateMax; + } + + key.SetDWORDValue("BarDock", m_nBarDock); + + Reformat(); +} + STDMETHODIMP cBarLayer::MouseEvent(long nMsg, long wParam, long lParam) { switch (nMsg) { @@ -716,6 +827,7 @@ if (m_nBarDock != DOCK_TOP) // Side Dock { + m_bDocked = FALSE; // Drakier: Grabbing the Top drag bar if (pt.x >= rSize.left && pt.x <= rSize.right && pt.y >= rSize.top + 1 && pt.y <= rSize.top + 8) { @@ -758,13 +870,25 @@ // Drakier: For the new bar system key.SetDWORDValue("BarStart", (DWORD)m_nBarStartPos); key.SetDWORDValue("BarLength", (DWORD)m_nBarLength); + + if ( m_nBarDock != DOCK_TOP ) // Drakier: Side Docked + { + // Drakier: should we keep the decal bar STUCK to bottom of screen? + if ( (m_nBarStartPos + m_nBarLength) > (m_nScreenHeight - 10) ) + m_bDocked = TRUE; + else + m_bDocked = FALSE; + + key.SetDWORDValue("BarDocked", (DWORD)m_bDocked); + Reformat(); + } } break; case WM_MOUSEMOVE: if (m_nBarDock != DOCK_TOP) // Side Dock { - if ( m_nDragging == -1 ) // Drakier: Drag Left + if ( m_nDragging == -1 ) // Drakier: Drag Up { POINTS pt; pt = MAKEPOINTS(lParam); @@ -772,16 +896,29 @@ if( !cManager::_p->m_bContainer ) pt.y -= 28; - if ( ((m_nBarLength - (pt.y - m_DeltaY)) > 112 ) && (((pt.y - m_DeltaY) + m_nBarStartPos) >= 0) ) + if ( !m_bRadarDraw ) // Drakier: Radar On? { - m_nBarStartPos += pt.y - m_DeltaY; - m_nBarLength += (-1) * (pt.y - m_DeltaY); - m_DeltaY = pt.y; + if ( ((m_nBarLength - (pt.y - m_DeltaY)) > 112 ) && (((pt.y - m_DeltaY) + m_nBarStartPos) >= 0) && (((pt.y - m_DeltaY) + m_nBarStartPos) >= (RADAR_SIZE)) ) + { + m_nBarStartPos += pt.y - m_DeltaY; + m_nBarLength += (-1) * (pt.y - m_DeltaY); + m_DeltaY = pt.y; + } + + } + else + { + if ( ((m_nBarLength - (pt.y - m_DeltaY)) > 112 ) && (((pt.y - m_DeltaY) + m_nBarStartPos) >= 0) ) + { + m_nBarStartPos += pt.y - m_DeltaY; + m_nBarLength += (-1) * (pt.y - m_DeltaY); + m_DeltaY = pt.y; + } } Reformat( ); } - else if ( m_nDragging == 1 ) // Drakier: Drag Right + else if ( m_nDragging == 1 ) // Drakier: Drag Down { POINTS pt; pt = MAKEPOINTS(lParam); @@ -789,10 +926,21 @@ if( !cManager::_p->m_bContainer ) pt.y -= 28; - if ( ((pt.y - m_DeltaY + m_nBarLength) >= 112) && ((m_nBarStartPos + m_nBarLength + pt.y - m_DeltaY) <= (m_nScreenHeight - (VITALS_SIZE + CHATBAR_SIZE + LOOT_SIZE))) ) + if ( cManager::_p->m_bContainer ) { - m_nBarLength += pt.y - m_DeltaY; - m_DeltaY = pt.y; + if ( ((pt.y - m_DeltaY + m_nBarLength) >= 112) && ((m_nBarStartPos + m_nBarLength + pt.y - m_DeltaY) <= (m_nScreenHeight - (VITALS_SIZE + CHATBAR_SIZE + LOOT_SIZE))) ) + { + m_nBarLength += pt.y - m_DeltaY; + m_DeltaY = pt.y; + } + } + else + { + if ( ((pt.y - m_DeltaY + m_nBarLength) >= 112) && ((m_nBarStartPos + m_nBarLength + pt.y - m_DeltaY) <= m_nScreenHeight) ) + { + m_nBarLength += pt.y - m_DeltaY; + m_DeltaY = pt.y; + } } Reformat( ); } @@ -825,16 +973,16 @@ pt.y -= 28; if ( !m_bRadarDraw ) // Drakier: Radar on? { + //if ( ((pt.x - m_DeltaX + m_nBarLength) >= 112) && ((m_nBarStartPos + m_nBarLength + pt.x - m_DeltaX) <= (*m_p3DW - RADAR_SIZE)) ) if ( ((pt.x - m_DeltaX + m_nBarLength) >= 112) && ((m_nBarStartPos + m_nBarLength + pt.x - m_DeltaX) <= (m_nScreenWidth - RADAR_SIZE)) ) { m_nBarLength += pt.x - m_DeltaX; m_DeltaX = pt.x; } } - else // Drakier: Radar off! { - if ( ((pt.x - m_DeltaX + m_nBarLength) >= 112) && ((m_nBarStartPos + m_nBarLength + pt.x - m_DeltaX) <= (m_nScreenWidth /*- PANEL_SIZE*/)) ) + if ( ((pt.x - m_DeltaX + m_nBarLength) >= 112) && ((m_nBarStartPos + m_nBarLength + pt.x - m_DeltaX) <= m_nScreenWidth) ) { m_nBarLength += pt.x - m_DeltaX; m_DeltaX = pt.x; Index: BarLayer.h =================================================================== RCS file: /cvsroot/decaldev/source/Inject/BarLayer.h,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- BarLayer.h 10 Dec 2003 19:56:03 -0000 1.8 +++ BarLayer.h 23 Dec 2003 00:51:44 -0000 1.9 @@ -12,6 +12,7 @@ #define BUTTON_BACK 2 #define BUTTON_FORWARD 3 #define BUTTON_MINMAX 4 +#define BUTTON_DOCKCYCLE 5 ///////////////////////////////////////////////////////////////////////////// // cBarLayer @@ -23,6 +24,7 @@ public ICommandEventsImpl< BUTTON_BACK, cBarLayer >, public ICommandEventsImpl< BUTTON_FORWARD, cBarLayer >, public ICommandEventsImpl< BUTTON_MINMAX, cBarLayer >, + public ICommandEventsImpl< BUTTON_DOCKCYCLE, cBarLayer >, public ILayerMouseImpl, public cNoEventsImpl, public IPagerEventsImpl< PAGER_CLIENT, cBarLayer > @@ -35,7 +37,7 @@ CComPtr< IACHooks > m_pHooks; CComPtr< IPager > m_pPager; CComPtr< IButton > m_pBtnForwards, - m_pBtnBackwards, m_pBtnMinMax; + m_pBtnBackwards, m_pBtnMinMax, m_pBtnDockCycle; CComPtr< IImageCache > m_pBackground; @@ -61,6 +63,7 @@ bool m_bRadarDraw; bool m_bButtonDown; bool m_bLocked; + bool m_bDocked; void onCreate(); void onDestroy(); @@ -78,6 +81,7 @@ SINK_ENTRY_EX( BUTTON_FORWARD, DIID_ICommandEvents, DISPID_HIT, onCommandHit ) SINK_ENTRY_EX( BUTTON_FORWARD, DIID_ICommandEvents, DISPID_UNHIT, onCommandUnhit ) SINK_ENTRY_EX( BUTTON_MINMAX, DIID_ICommandEvents, DISPID_HIT, onMinMaxHit ) + SINK_ENTRY_EX( BUTTON_DOCKCYCLE, DIID_ICommandEvents, DISPID_HIT, onDockCycleHit ) SINK_ENTRY_EX( PAGER_CLIENT, DIID_IPagerEvents, DISPID_GETNEXTPOSITION, onClientGetNextPosition ) END_SINK_MAP() @@ -107,6 +111,7 @@ } void __stdcall onMinMaxHit(long nID); + void __stdcall onDockCycleHit(long nID); // Pager event handlers VARIANT_BOOL __stdcall onClientGetNextPosition( long nID, long nCommand, long *pnX, long *pnY ); Index: Manager.cpp =================================================================== RCS file: /cvsroot/decaldev/source/Inject/Manager.cpp,v retrieving revision 1.81 retrieving revision 1.82 diff -u -d -r1.81 -r1.82 --- Manager.cpp 19 Nov 2003 19:19:14 -0000 1.81 +++ Manager.cpp 23 Dec 2003 00:51:44 -0000 1.82 @@ -428,13 +428,15 @@ if( i->m_dwSinkCaps & eManagerSinkCapWindowMessage ) { CComPtr< IWindowsMessageSink > pSink; - i->m_pPlugin->QueryInterface( &pSink ); - VARIANT_BOOL bEat = VARIANT_FALSE; - pSink->WindowMessage( reinterpret_cast< long >( hWnd ), uMsg, wParam, lParam, &bEat ); + if( i->m_pPlugin->QueryInterface( &pSink ) == S_OK ) + { + VARIANT_BOOL bEat = VARIANT_FALSE; + pSink->WindowMessage( reinterpret_cast< long >( hWnd ), uMsg, wParam, lParam, &bEat ); - if( bEat ) - // This message was eaten stop processing - return 0; + if( bEat ) + // This message was eaten stop processing + return 0; + } } } Index: RootLayer.cpp =================================================================== RCS file: /cvsroot/decaldev/source/Inject/RootLayer.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- RootLayer.cpp 10 Dec 2003 19:56:03 -0000 1.9 +++ RootLayer.cpp 23 Dec 2003 00:51:44 -0000 1.10 @@ -50,24 +50,9 @@ m_pSite->CreateChild( &lpBars, pBars ); - - RegKey key; - key.Create( HKEY_LOCAL_MACHINE, _T( "SOFTWARE\\Decal" ) ); - - DWORD dwBarDock; - if( key.QueryDWORDValue( "BarDock", dwBarDock ) != ERROR_SUCCESS ) - dwBarDock = 0; - - if( dwBarDock == 1 ) - m_lDefaultX = 25; - else - m_lDefaultX = 5; - - m_lDefaultY = 5; - - if( m_nViewMode == 0 ) // Single Mode + if( m_nViewMode == 0 ) // Single Mode { - LayerParams lpPanel = { eChildPanel, { m_lDefaultY, m_lDefaultX, 0, 0 }, 0 }; + LayerParams lpPanel = { eChildPanel, { 0, 0, 0, 0 }, 0 }; CComObject< cPanel > *pPanel; CComObject< cPanel >::CreateInstance( &pPanel ); @@ -161,7 +146,7 @@ if( m_nViewMode == 1 ) // Multi Mode { - LayerParams lpPanel = { m_nNextViewID, { m_lDefaultX, m_lDefaultY, 0, 0 }, 0 }; + LayerParams lpPanel = { m_nNextViewID, { 0, 0, 0, 0 }, 0 }; CComObject< cPanel > *pPanel; CComObject< cPanel >::CreateInstance( &pPanel ); @@ -233,7 +218,7 @@ if( m_nViewMode == 1 ) // Multi Mode { - LayerParams lpPanel = { m_nNextViewID, { m_lDefaultX, m_lDefaultY, 0, 0 }, 0 }; + LayerParams lpPanel = { m_nNextViewID, { 0, 0, 0, 0 }, 0 }; CComObject< cPanel > *pPanel; CComObject< cPanel >::CreateInstance( &pPanel ); Index: View.cpp =================================================================== RCS file: /cvsroot/decaldev/source/Inject/View.cpp,v retrieving revision 1.31 retrieving revision 1.32 diff -u -d -r1.31 -r1.32 --- View.cpp 10 Dec 2003 19:56:03 -0000 1.31 +++ View.cpp 23 Dec 2003 00:51:44 -0000 1.32 @@ -123,12 +123,16 @@ // else if(vLeft.vt != VT_NULL) m_VP.left = static_cast< long >(vLeft); + else + m_VP.left = 25; // if(vTop.vt == VT_NULL) // m_VP.top = 70; // else if(vTop.vt != VT_NULL) m_VP.top = static_cast< long >(vTop); + else + m_VP.top = 25; if(vWidth.vt == VT_NULL) m_VP.width = 180; |