From: Tracy B. <ar...@us...> - 2004-01-28 00:26:41
|
Log Message: ----------- Added Maximized Mode for Sidebar Mode Modified Files: -------------- /cvsroot/decaldev/source/Inject: BarLayer.cpp Revision Data ------------- Index: BarLayer.cpp =================================================================== RCS file: /cvsroot/decaldev/source/Inject/BarLayer.cpp,v retrieving revision 1.19 retrieving revision 1.20 diff -u -d -r1.19 -r1.20 --- BarLayer.cpp 8 Jan 2004 23:14:15 -0000 1.19 +++ BarLayer.cpp 28 Jan 2004 00:25:37 -0000 1.20 @@ -15,6 +15,9 @@ const int CHATBAR_SIZE = 101; const int CHATBAR_MAX_SIZE = 259; const int LOOT_SIZE = 101; +const int BUTTON_SIZE = 16; +const int MINBAR_SIZE = 20; +int MAXBAR_SIZE = 100; // Drakier: Added constants for docking position const int DOCK_TOP = 0; @@ -80,8 +83,9 @@ if( key.QueryDWORDValue( "BarDock", (DWORD &)m_nBarDock ) != ERROR_SUCCESS ) m_nBarDock = DOCK_TOP; - if (m_nBarDock != DOCK_TOP) - m_nMinMax = eStateMin; + // Drakier: TESTING for Min/Max Side Dock + //if (m_nBarDock != DOCK_TOP) + //m_nMinMax = eStateMin; // Ok, first create the 4 background controls LayerParams lpChild; @@ -102,8 +106,6 @@ m_pBtnMinMax->SetImages( 0, 0x0600113C, 0x0600113C ); ICommandEventsImpl< BUTTON_MINMAX, cBarLayer >::advise( m_pBtnMinMax ); m_pBtnMinMax->put_Matte( RGB( 0, 0, 0 ) ); - - } { @@ -189,7 +191,7 @@ m_pBtnMinMax->SetImages( 0, 0x0600113C, 0x0600113C ); else m_pBtnMinMax->SetImages( 0, 0x0600113B, 0x0600113B ); - + //::MessageBox( NULL, _T( "Here" ), _T( "[Inject.dll] cBarLayer::onCreate" ), MB_OK ); } @@ -207,6 +209,13 @@ { _ASSERTE( pCanvas != NULL ); + SIZE sz; + m_pPlugin->GetScreenSize( &sz ); + if ( sz.cx <= 1024 ) + MAXBAR_SIZE = 80; + else + MAXBAR_SIZE = 100; + ClipParams p; pCanvas->GetClipParams( &p ); @@ -260,7 +269,10 @@ dragBarRect.top = 3; dragBarRect.left = 4; dragBarRect.bottom = 4; - dragBarRect.right = 19; + if (m_nMinMax == eStateMin) // Minimized + dragBarRect.right = MINBAR_SIZE - 4; + else // Maximized + dragBarRect.right = MAXBAR_SIZE - 4; pCanvas->Fill(&dragBarRect, RGB(214, 173, 140)); @@ -280,7 +292,10 @@ dragBarRect.top = m_nBarLength - 4; dragBarRect.left = 4; dragBarRect.bottom = m_nBarLength - 3; - dragBarRect.right = 19; + if (m_nMinMax == eStateMin) // Minimized + dragBarRect.right = MINBAR_SIZE - 4; + else // Maximized + dragBarRect.right = MAXBAR_SIZE - 4; pCanvas->Fill(&dragBarRect, RGB(165, 82, 57)); @@ -417,12 +432,19 @@ { rc.left = 0; rc.top = m_nBarStartPos; - rc.right = 23; rc.bottom = m_nBarStartPos + m_nBarLength; + if (m_nMinMax == eStateMin) // Minimized + rc.right = MINBAR_SIZE; + else // Maximized + rc.right = MAXBAR_SIZE; } else if (m_nBarDock == DOCK_RIGHT) // Right Dock { - rc.left = m_nScreenWidth - 23; + if (m_nMinMax == eStateMin) // Minimized + rc.left = m_nScreenWidth - MINBAR_SIZE; + else // Maximized + rc.left = m_nScreenWidth - MAXBAR_SIZE; + rc.top = m_nBarStartPos; rc.right = m_nScreenWidth; rc.bottom = m_nBarStartPos + m_nBarLength; @@ -440,119 +462,61 @@ // { 12, 3, 28, 19 } if (m_nBarDock != DOCK_TOP) // Side Dock { - //rc.left = 3; - //rc.top = 12; - //rc.right = 19; - //rc.bottom = 28; - - rc.left = -12; - rc.top = -12; - rc.right = -2; - rc.bottom = -2; + rc.left = 3; + rc.top = 12; + rc.right = rc.left + BUTTON_SIZE; + rc.bottom = rc.top + BUTTON_SIZE; } else // Top Dock { rc.left = 12; rc.top = 3; - rc.right = 28; - rc.bottom = 19; + rc.right = rc.left + BUTTON_SIZE; + rc.bottom = rc.top + BUTTON_SIZE; } CComPtr< ILayerSite > pMinMaxSite; m_pSite->get_Child( eBtnMinMax, ePositionByID, &pMinMaxSite ); pMinMaxSite->put_Position( &rc ); - - // Now do the backwards - if (m_nBarDock != DOCK_TOP) // Side Dock - { - //rc.left = 3; - //rc.top = 30; - //rc.right = 19; - //rc.bottom = 46; - - rc.left = 3; - rc.top = 12; - rc.right = 19; - rc.bottom = 28; - } - else // Top Dock - { - rc.left = 30; - rc.top = 3; - rc.right = 46; - rc.bottom = 19; - } - CComPtr< ILayerSite > pBackwardsSite; - m_pSite->get_Child( eBtnBackwards, ePositionByID, &pBackwardsSite ); - 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; + { + if (m_nMinMax == eStateMin) // minimized + { + rc.left = 3; + rc.top = m_nBarLength - 28; + rc.right = rc.left + BUTTON_SIZE; + rc.bottom = rc.top + BUTTON_SIZE; + } + else + { + rc.left = MAXBAR_SIZE - ( BUTTON_SIZE + 3 ); + rc.top = 12; + rc.right = rc.left + BUTTON_SIZE; + rc.bottom = rc.top + BUTTON_SIZE; + } } else // Top Dock { rc.left = m_nBarLength - 28; rc.top = 3; - rc.right = m_nBarLength - 12; - rc.bottom = 19; + rc.right = rc.left + BUTTON_SIZE; + rc.bottom = rc.top + BUTTON_SIZE; } CComPtr< ILayerSite > pDockCycleSite; m_pSite->get_Child( eBtnDockCycle, ePositionByID, &pDockCycleSite ); pDockCycleSite->put_Position( &rc ); - + // Now the pager - CComPtr< ILayerSite > pPagerSite; - m_pSite->get_Child( ePager, ePositionByID, &pPagerSite ); - - if (m_nBarDock != DOCK_TOP) // Side Dock - { - rc.left = 1; - //rc.top = 50; - rc.top = 30; - rc.right = 22; - rc.bottom = m_nBarLength - 48; - } - else // Top Dock - { - rc.left = 50; - rc.top = 1; - rc.right = m_nBarLength - 48; - rc.bottom = 22; - } - pPagerSite->put_Position( &rc ); - + CComPtr< ILayerSite > pPagerSite; + m_pSite->get_Child( ePager, ePositionByID, &pPagerSite ); + m_offsets.clear(); - + long nChildren; long nOffset = 0; long nDesired; - long nChildren; pPagerSite->get_ChildCount( &nChildren ); - + for( long nChild = 0; nChild < nChildren; ++ nChild ) { ViewParams pParams; @@ -573,16 +537,23 @@ pBarNative->put_Params(&pParams); if (m_nBarDock != DOCK_TOP) // Side Dock - { - nDesired = 20; + { + if (m_nMinMax == eStateMin) // Minimized + { + rc.right = MINBAR_SIZE - 2; + } + else // Maximized + { + rc.right = MAXBAR_SIZE - 2; + } + nDesired = 20; // Button Height rc.left = 0; - rc.top = nOffset; - rc.right = 21; + rc.top = nOffset; rc.bottom = nOffset + nDesired; } else // Top Dock { - // We always give bars their desired size + // We always give bars their desired size (Width) pBarNative->get_RenderWidth( &nDesired ); rc.left = nOffset; rc.top = 0; @@ -595,11 +566,146 @@ nOffset += nDesired + 2; } + // Calc ViewSlots for SideDock Maximized Up/Down Visibility + long nTotalBtnHeight; + // nOffset is total button height + nTotalBtnHeight = nOffset; + + bool showPosBtns; + //showPosBtns = (nTotalBtnHeight > m_nBarLength); + + if (m_nBarDock != DOCK_TOP) // Side Dock + { + rc.left = 1; + if (m_nMinMax == eStateMin) // minimized + { + showPosBtns = ( nTotalBtnHeight > ( m_nBarLength - 58 ) ); // Viewable Height + if ( showPosBtns ) + { + rc.top = 50; + rc.bottom = m_nBarLength - 48; + } + else + { + rc.top = 30; + rc.bottom = m_nBarLength - 28; + } + rc.right = MINBAR_SIZE - 1; + } + else // maximized + { + showPosBtns = ( nTotalBtnHeight > ( m_nBarLength - 44 ) ); // Viewable Height + rc.top = 30; + rc.right = MAXBAR_SIZE - 1; + rc.bottom = m_nBarLength - 12; + } + } + else // Top Dock + { + showPosBtns = ( nTotalBtnHeight > ( m_nBarLength - 58 ) ); //Max Viewable Width + if ( showPosBtns ) + { + rc.left = 50; + rc.right = m_nBarLength - 48; + } + else + { + rc.left = 30; + rc.right = m_nBarLength - 28; + } + rc.top = 1; + rc.bottom = 22; + } + pPagerSite->put_Position( &rc ); + + // Now do the backwards + if ( showPosBtns ) + { + if (m_nBarDock != DOCK_TOP) // Side Dock + { + if (m_nMinMax == eStateMin) // minimized + { + rc.left = 3; + rc.top = 30; + rc.right = rc.left + BUTTON_SIZE; + rc.bottom = rc.top + BUTTON_SIZE; + } + else + { + rc.top = 12; + rc.left = (MAXBAR_SIZE / 2) - 17; + rc.right = rc.left + BUTTON_SIZE; + rc.bottom = rc.top + BUTTON_SIZE; + } + } + else // Top Dock + { + rc.left = 30; + rc.top = 3; + rc.right = rc.left + BUTTON_SIZE; + rc.bottom = rc.top + BUTTON_SIZE; + } + } + else + { + rc.left = -30; + rc.top = -30; + rc.right = rc.left + BUTTON_SIZE; + rc.bottom = rc.top + BUTTON_SIZE; + } + CComPtr< ILayerSite > pBackwardsSite; + m_pSite->get_Child( eBtnBackwards, ePositionByID, &pBackwardsSite ); + pBackwardsSite->put_Position( &rc ); + + // Drakier: this is a change because of the new LENGTH system + + // Now do the forwards + if ( showPosBtns ) + { + if (m_nBarDock != DOCK_TOP) // Side Dock + { + if (m_nMinMax == eStateMin) // minimized + { + rc.left = 3; + rc.top = m_nBarLength - 46; + rc.right = rc.left + BUTTON_SIZE; + rc.bottom = rc.top + BUTTON_SIZE; + } + else + { + rc.top = 12; + rc.left = (MAXBAR_SIZE / 2) + 1; + rc.right = rc.left + BUTTON_SIZE; + rc.bottom = rc.top + BUTTON_SIZE; + } + } + else // Top Dock + { + rc.left = m_nBarLength - 46; + rc.top = 3; + rc.right = rc.left + BUTTON_SIZE; + rc.bottom = rc.top + BUTTON_SIZE; + } + } + else + { + rc.left = -30; + rc.top = -30; + rc.right = rc.left + BUTTON_SIZE; + rc.bottom = rc.top + BUTTON_SIZE; + } + CComPtr< ILayerSite > pFwdSite; + m_pSite->get_Child( eBtnForwards, ePositionByID, &pFwdSite ); + pFwdSite->put_Position( &rc ); + /* Drakier: Testing if un-needed // Check if the position is wrong now if( m_nPosition >= m_offsets.size() ) m_nPosition = m_offsets.size() - 1; */ + if ( !showPosBtns ) + m_nPosition = 0; + POINT pt = { ( m_nPosition <= 0 ) ? 0 : m_offsets[ m_nPosition ], 0 }; if (m_nBarDock != DOCK_TOP) // Side Dock @@ -626,7 +732,7 @@ case eBtnForwards: if (m_nBarDock != DOCK_TOP) // Side Dock { - if( !m_bLocked && ( m_nPosition < ( m_offsets.size() - 1 ) ) ) + if( !m_bLocked && ( m_offsets.size() > 0 ) && ( ( m_nPosition + 1 ) < m_offsets.size() ) ) { m_bLocked = TRUE; m_nPosition++; @@ -638,7 +744,7 @@ } else // Top Dock { - if( !m_bLocked && ( m_nPosition < ( m_offsets.size() - 1 ) ) ) + if( !m_bLocked && ( m_offsets.size() > 0 ) && ( ( m_nPosition + 1 ) < m_offsets.size() ) ) { //m_bLocked = TRUE; m_nPosition++; @@ -797,7 +903,9 @@ { m_pBtnForwards->SetImages( 0, 0x0600125E, 0x0600125F ); m_pBtnBackwards->SetImages( 0, 0x06001261, 0x06001262 ); - m_nMinMax = eStateMin; + //m_nMinMax = eStateMin; + if( key.QueryDWORDValue( "BarState", m_nMinMax ) != ERROR_SUCCESS ) + m_nMinMax = eStateMax; } else { @@ -809,6 +917,7 @@ key.SetDWORDValue("BarDock", m_nBarDock); + m_pPager->FinishCommand; Reformat(); } |