/*****************************************************************************
* window_manager.cpp
*****************************************************************************
- * Copyright (C) 2003 VideoLAN
+ * Copyright (C) 2003 the VideoLAN team
* $Id$
*
* Authors: Cyril Deguet <asmax@via.ecp.fr>
#include "anchor.hpp"
#include "tooltip.hpp"
#include "../utils/position.hpp"
+#include "../src/var_manager.hpp"
WindowManager::WindowManager( intf_thread_t *pIntf ):
- SkinObject( pIntf ), m_isOnTop( false ), m_magnet( 0 ), m_pTooltip( NULL )
+ SkinObject( pIntf ), m_magnet( 0 ), m_pTooltip( NULL ), m_pPopup( NULL )
{
+ // Create and register a variable for the "on top" status
+ VarManager *pVarManager = VarManager::instance( getIntf() );
+ m_cVarOnTop = VariablePtr( new VarBoolImpl( getIntf() ) );
+ pVarManager->registerVar( m_cVarOnTop, "vlc.isOnTop" );
}
m_movingWindows.clear();
buildDependSet( m_movingWindows, &rWindow );
- // Change the opacity of the moving windows
- WinSet_t::const_iterator it;
- for( it = m_movingWindows.begin(); it != m_movingWindows.end(); it++ )
+#ifdef WIN32
+ if( config_GetInt( getIntf(), "skins2-transparency" ) )
{
- (*it)->setOpacity( m_moveAlpha );
+ // Change the opacity of the moving windows
+ WinSet_t::const_iterator it;
+ for( it = m_movingWindows.begin(); it != m_movingWindows.end(); it++ )
+ {
+ (*it)->setOpacity( m_moveAlpha );
+ }
+
+ // FIXME: We need to refresh the windows, because if 2 windows overlap
+ // and one of them becomes transparent, the other one is not refreshed
+ // automatically. I don't know why... -- Ipkiss
+ for( it = m_allWindows.begin(); it != m_allWindows.end(); it++ )
+ {
+ (*it)->refresh( 0, 0, (*it)->getWidth(), (*it)->getHeight() );
+ }
}
+#endif
}
WinSet_t::const_iterator itWin1, itWin2;
AncList_t::const_iterator itAnc1, itAnc2;
- // Restore the opacity of the moving windows
- WinSet_t::const_iterator it;
- for( it = m_movingWindows.begin(); it != m_movingWindows.end(); it++ )
+#ifdef WIN32
+ if( config_GetInt( getIntf(), "skins2-transparency" ) )
{
- (*it)->setOpacity( m_alpha );
+ // Restore the opacity of the moving windows
+ WinSet_t::const_iterator it;
+ for( it = m_movingWindows.begin(); it != m_movingWindows.end(); it++ )
+ {
+ (*it)->setOpacity( m_alpha );
+ }
}
+#endif
// Delete the dependencies
m_dependencies.clear();
}
-void WindowManager::raiseAll( TopWindow &rWindow ) const
+void WindowManager::synchVisibility() const
{
- // Raise all the windows
WinSet_t::const_iterator it;
for( it = m_allWindows.begin(); it != m_allWindows.end(); it++ )
{
- if( *it != &rWindow )
+ // Show the window if it has to be visible
+ if( (*it)->getVisibleVar().get() )
{
- (*it)->raise();
+ (*it)->innerShow();
}
}
- // Make sure to raise the given window at the end, so that it is above
- rWindow.raise();
}
-void WindowManager::showAll() const
+void WindowManager::raiseAll() const
+{
+ // Raise all the windows
+ WinSet_t::const_iterator it;
+ for( it = m_allWindows.begin(); it != m_allWindows.end(); it++ )
+ {
+ (*it)->raise();
+ }
+}
+
+
+void WindowManager::showAll( bool firstTime ) const
{
// Show all the windows
WinSet_t::const_iterator it;
for( it = m_allWindows.begin(); it != m_allWindows.end(); it++ )
{
- (*it)->show();
+ // When the theme is opened for the first time,
+ // only show the window if set as visible in the XML
+ if ((*it)->isVisible() || !firstTime)
+ {
+ (*it)->show();
+ }
(*it)->setOpacity( m_alpha );
}
}
void WindowManager::toggleOnTop()
{
- m_isOnTop = !m_isOnTop;
+ // Update the boolean variable
+ VarBoolImpl *pVarOnTop = (VarBoolImpl*)m_cVarOnTop.get();
+ pVarOnTop->set( !pVarOnTop->get() );
+
+ // Toggle the "on top" status
WinSet_t::const_iterator it;
for( it = m_allWindows.begin(); it != m_allWindows.end(); it++ )
{
- (*it)->toggleOnTop( m_isOnTop );
+ (*it)->toggleOnTop( pVarOnTop->get() );
}
}
for( itMov = m_movingWindows.begin();
itMov != m_movingWindows.end(); itMov++ )
{
+ // Skip the invisible windows
+ if( ! (*itMov)->getVisibleVar().get() )
+ {
+ continue;
+ }
+
int newLeft = (*itMov)->getLeft() + xOffset;
int newTop = (*itMov)->getTop() + yOffset;
if( newLeft > workArea.getLeft() - m_magnet &&