@ -80,7 +80,6 @@ UBBoardPaletteManager::UBBoardPaletteManager(QWidget* container, UBBoardControll
, mpPageNavigWidget ( NULL )
, mpPageNavigWidget ( NULL )
, mpLibWidget ( NULL )
, mpLibWidget ( NULL )
, mpCachePropWidget ( NULL )
, mpCachePropWidget ( NULL )
// , mDesktopRightPalette(NULL)
, mpTeacherBarWidget ( NULL )
, mpTeacherBarWidget ( NULL )
, mpDesktopLibWidget ( NULL )
, mpDesktopLibWidget ( NULL )
{
{
@ -225,15 +224,38 @@ void UBBoardPaletteManager::setupDockPaletteWidgets()
void UBBoardPaletteManager : : slot_changeMainMode ( UBApplicationController : : MainMode mainMode )
void UBBoardPaletteManager : : slot_changeMainMode ( UBApplicationController : : MainMode mainMode )
{
{
// Board = 0, Internet, Document, Tutorial, ParaschoolEditor, WebDocument
switch ( mainMode )
switch ( mainMode )
{
{
case UBApplicationController : : Board :
case UBApplicationController : : Board :
// call changeMode only when switch NOT from desktop mode
{
if ( ! UBApplication : : applicationController - > isShowingDesktop ( ) )
// call changeMode only when switch NOT from desktop mode
changeMode ( eUBDockPaletteWidget_BOARD ) ;
if ( ! UBApplication : : applicationController - > isShowingDesktop ( ) )
changeMode ( eUBDockPaletteWidget_BOARD ) ;
}
break ;
case UBApplicationController : : Tutorial :
{
if ( UBPlatformUtils : : hasVirtualKeyboard ( ) & & mKeyboardPalette ! = NULL )
mKeyboardPalette - > hide ( ) ;
}
break ;
case UBApplicationController : : Internet :
changeMode ( eUBDockPaletteWidget_WEB ) ;
break ;
case UBApplicationController : : Document :
changeMode ( eUBDockPaletteWidget_DOCUMENT ) ;
break ;
break ;
default :
default :
{
if ( UBPlatformUtils : : hasVirtualKeyboard ( ) & & mKeyboardPalette ! = NULL )
mKeyboardPalette - > hide ( ) ;
}
break ;
break ;
}
}
}
}
@ -260,25 +282,25 @@ void UBBoardPaletteManager::slot_changeDesktopMode(bool isDesktop)
void UBBoardPaletteManager : : setupPalettes ( )
void UBBoardPaletteManager : : setupPalettes ( )
{
{
setupDockPaletteWidgets ( ) ;
// Add the other palettes
mStylusPalette = new UBStylusPalette ( mContainer , UBSettings : : settings ( ) - > appToolBarOrientationVertical - > get ( ) . toBool ( ) ? Qt : : Vertical : Qt : : Horizontal ) ;
connect ( mStylusPalette , SIGNAL ( stylusToolDoubleClicked ( int ) ) , UBApplication : : boardController , SLOT ( stylusToolDoubleClicked ( int ) ) ) ;
mStylusPalette - > show ( ) ; // always show stylus palette at startup
if ( UBPlatformUtils : : hasVirtualKeyboard ( ) )
if ( UBPlatformUtils : : hasVirtualKeyboard ( ) )
{
{
mKeyboardPalette = UBKeyboardPalette : : crea te( 0 ) ;
mKeyboardPalette = new UBKeyboardPalette ( 0 ) ;
# ifndef Q_WS_WIN
# ifndef Q_WS_WIN
connect ( mKeyboardPalette , SIGNAL ( closed ( ) ) , mKeyboardPalette , SLOT ( onDeactivated ( ) ) ) ;
connect ( mKeyboardPalette , SIGNAL ( closed ( ) ) , mKeyboardPalette , SLOT ( onDeactivated ( ) ) ) ;
# endif
# endif
# ifndef Q_WS_MAC
# ifndef Q_WS_MAC
mKeyboardPalette - > setParent ( mContainer ) ;
// mKeyboardPalette->setParent(mContainer);
# endif
# endif
}
}
setupDockPaletteWidgets ( ) ;
// Add the other palettes
mStylusPalette = new UBStylusPalette ( mContainer , UBSettings : : settings ( ) - > appToolBarOrientationVertical - > get ( ) . toBool ( ) ? Qt : : Vertical : Qt : : Horizontal ) ;
connect ( mStylusPalette , SIGNAL ( stylusToolDoubleClicked ( int ) ) , UBApplication : : boardController , SLOT ( stylusToolDoubleClicked ( int ) ) ) ;
mStylusPalette - > show ( ) ; // always show stylus palette at startup
mZoomPalette = new UBZoomPalette ( mContainer ) ;
mZoomPalette = new UBZoomPalette ( mContainer ) ;
QList < QAction * > backgroundsActions ;
QList < QAction * > backgroundsActions ;
@ -488,7 +510,7 @@ void UBBoardPaletteManager::connectPalettes()
}
}
bool isFirstResized = true ;
void UBBoardPaletteManager : : containerResized ( )
void UBBoardPaletteManager : : containerResized ( )
{
{
int innerMargin = UBSettings : : boardMargin ;
int innerMargin = UBSettings : : boardMargin ;
@ -498,25 +520,39 @@ void UBBoardPaletteManager::containerResized()
int userTop = innerMargin ;
int userTop = innerMargin ;
int userHeight = mContainer - > height ( ) - ( 2 * innerMargin ) ;
int userHeight = mContainer - > height ( ) - ( 2 * innerMargin ) ;
mStylusPalette - > move ( userLeft , userTop ) ;
if ( mStylusPalette )
mStylusPalette - > adjustSizeAndPosition ( ) ;
{
mStylusPalette - > initPosition ( ) ;
mStylusPalette - > move ( userLeft , userTop ) ;
mStylusPalette - > adjustSizeAndPosition ( ) ;
mStylusPalette - > initPosition ( ) ;
}
mZoomPalette - > move ( userLeft + userWidth - mZoomPalette - > width ( )
if ( mZoomPalette )
, userTop + userHeight /*- mPageNumberPalette->height()*/ - innerMargin - mZoomPalette - > height ( ) ) ;
{
mZoomPalette - > adjustSizeAndPosition ( ) ;
mZoomPalette - > move ( userLeft + userWidth - mZoomPalette - > width ( )
, userTop + userHeight /*- mPageNumberPalette->height()*/ - innerMargin - mZoomPalette - > height ( ) ) ;
mZoomPalette - > adjustSizeAndPosition ( ) ;
}
if ( mKeyboardPalette )
if ( isFirstResized & & mKeyboardPalette & & mKeyboardPalette - > parent ( ) = = UBApplication : : boardController - > controlContainer ( ) )
{
{
mKeyboardPalette - > move ( userLeft + ( userWidth - mKeyboardPalette - > width ( ) ) / 2 ,
isFirstResized = false ;
userTop + userHeight - mKeyboardPalette - > height ( ) ) ;
mKeyboardPalette - > move ( userLeft + ( userWidth - mKeyboardPalette - > width ( ) ) / 2 ,
mKeyboardPalette - > adjustSizeAndPosition ( ) ;
userTop + ( userHeight - mKeyboardPalette - > height ( ) ) / 2 ) ;
mKeyboardPalette - > adjustSizeAndPosition ( ) ;
}
}
mLeftPalette - > resize ( mLeftPalette - > width ( ) - 1 , mContainer - > height ( ) ) ;
if ( mLeftPalette )
mRightPalette - > resize ( mRightPalette - > width ( ) - 1 , mContainer - > height ( ) ) ;
{
mLeftPalette - > resize ( mLeftPalette - > width ( ) , mContainer - > height ( ) ) ;
mLeftPalette - > resize ( mLeftPalette - > width ( ) - 1 , mContainer - > height ( ) ) ;
mRightPalette - > resize ( mRightPalette - > width ( ) , mContainer - > height ( ) ) ;
mLeftPalette - > resize ( mLeftPalette - > width ( ) , mContainer - > height ( ) ) ;
}
if ( mRightPalette )
{
mRightPalette - > resize ( mRightPalette - > width ( ) - 1 , mContainer - > height ( ) ) ;
mRightPalette - > resize ( mRightPalette - > width ( ) , mContainer - > height ( ) ) ;
}
}
}
@ -688,6 +724,18 @@ void UBBoardPaletteManager::changeMode(eUBDockPaletteWidgetMode newMode, bool is
{
{
mLeftPalette - > setParent ( UBApplication : : boardController - > controlContainer ( ) ) ;
mLeftPalette - > setParent ( UBApplication : : boardController - > controlContainer ( ) ) ;
mRightPalette - > setParent ( UBApplication : : boardController - > controlContainer ( ) ) ;
mRightPalette - > setParent ( UBApplication : : boardController - > controlContainer ( ) ) ;
if ( UBPlatformUtils : : hasVirtualKeyboard ( ) & & mKeyboardPalette ! = NULL )
{
if ( mKeyboardPalette - > m_isVisible )
{
mKeyboardPalette - > hide ( ) ;
mKeyboardPalette - > setParent ( UBApplication : : boardController - > controlContainer ( ) ) ;
mKeyboardPalette - > show ( ) ;
}
else
mKeyboardPalette - > setParent ( UBApplication : : boardController - > controlContainer ( ) ) ;
}
mLeftPalette - > setVisible ( true ) ;
mLeftPalette - > setVisible ( true ) ;
mRightPalette - > setVisible ( true ) ;
mRightPalette - > setVisible ( true ) ;
@ -701,6 +749,22 @@ void UBBoardPaletteManager::changeMode(eUBDockPaletteWidgetMode newMode, bool is
{
{
mLeftPalette - > setParent ( ( QWidget * ) UBApplication : : applicationController - > uninotesController ( ) - > drawingView ( ) ) ;
mLeftPalette - > setParent ( ( QWidget * ) UBApplication : : applicationController - > uninotesController ( ) - > drawingView ( ) ) ;
mRightPalette - > setParent ( ( QWidget * ) UBApplication : : applicationController - > uninotesController ( ) - > drawingView ( ) ) ;
mRightPalette - > setParent ( ( QWidget * ) UBApplication : : applicationController - > uninotesController ( ) - > drawingView ( ) ) ;
if ( UBPlatformUtils : : hasVirtualKeyboard ( ) & & mKeyboardPalette ! = NULL )
{
if ( mKeyboardPalette - > m_isVisible )
{
mKeyboardPalette - > hide ( ) ;
# ifndef Q_WS_X11
mKeyboardPalette - > setParent ( ( QWidget * ) UBApplication : : applicationController - > uninotesController ( ) - > drawingView ( ) ) ;
# else
mKeyboardPalette - > setParent ( 0 ) ;
# endif
mKeyboardPalette - > show ( ) ;
}
else
mKeyboardPalette - > setParent ( ( QWidget * ) UBApplication : : applicationController - > uninotesController ( ) - > drawingView ( ) ) ;
}
mLeftPalette - > setVisible ( false ) ;
mLeftPalette - > setVisible ( false ) ;
mRightPalette - > setVisible ( true ) ;
mRightPalette - > setVisible ( true ) ;
@ -710,12 +774,46 @@ void UBBoardPaletteManager::changeMode(eUBDockPaletteWidgetMode newMode, bool is
}
}
break ;
break ;
case eUBDockPaletteWidget_WEB :
{
if ( UBPlatformUtils : : hasVirtualKeyboard ( ) & & mKeyboardPalette ! = NULL )
{
WBBrowserWindow * brWnd = UBApplication : : webController - > GetCurrentWebBrowser ( ) ;
if ( mKeyboardPalette - > m_isVisible )
{
mKeyboardPalette - > hide ( ) ;
mKeyboardPalette - > setParent ( brWnd ) ;
mKeyboardPalette - > show ( ) ;
}
else
mKeyboardPalette - > setParent ( brWnd ) ;
}
}
break ;
default :
default :
{
{
mLeftPalette - > setVisible ( false ) ;
mLeftPalette - > setVisible ( false ) ;
mRightPalette - > setVisible ( false ) ;
mRightPalette - > setVisible ( false ) ;
mLeftPalette - > setParent ( 0 ) ;
mLeftPalette - > setParent ( 0 ) ;
mRightPalette - > setParent ( 0 ) ;
mRightPalette - > setParent ( 0 ) ;
if ( UBPlatformUtils : : hasVirtualKeyboard ( ) & & mKeyboardPalette ! = NULL )
{
if ( mKeyboardPalette - > m_isVisible )
{
mKeyboardPalette - > hide ( ) ;
mKeyboardPalette - > setParent ( 0 ) ;
mKeyboardPalette - > show ( ) ;
}
else
mKeyboardPalette - > setParent ( 0 ) ;
// mKeyboardPalette->update();
}
}
}
break ;
break ;
}
}