Commit 6060a89f authored by Thorsten Zachmann's avatar Thorsten Zachmann

o This is the start to add animations to kpresenter. Up to now only the

  framework for running page effects is done. Also we I did a cover page
  down effect to see that it is working.
  Special thanks goes to David for pointing out syncX() so that I still
  get mouse events during a page effect. Otherwise X was 100% and no
  longer forwarding key events to the application :-(.
  All the animations will be done by the KPrAnimationDirector once it
  has all the needed functionality.
  There are still a lot of open points but it is a start.

o added some pages and a shape as test data to a kpresenter document for
  testing

o rework fullscreen mode of kpresenter

o split KoPAView::setActivePage to setActivePage and updateActivePage 
  setActivePage only sets the active page
  updateActivePage also updates the gui


svn path=/trunk/koffice/; revision=676763
parent 9cd4cf31
......@@ -28,8 +28,6 @@
#include "KoPAViewMode.h"
#include "KoPAPage.h"
#include <QDebug>
KoPACanvas::KoPACanvas( KoPAView * view, KoPADocument * doc )
: QWidget( view )
, KoCanvasBase( doc )
......@@ -197,4 +195,9 @@ void KoPACanvas::inputMethodEvent(QInputMethodEvent *event)
m_toolProxy->inputMethodEvent(event);
}
void KoPACanvas::resizeEvent( QResizeEvent * event )
{
emit sizeChanged( event->size() );
}
#include "KoPACanvas.moc"
......@@ -64,6 +64,12 @@ public slots:
signals:
void documentSize(const QSize &size);
/**
* Emitted when the entire controller size changes
* @param size the size in widget pixels.
*/
void sizeChanged( const QSize & size );
protected:
/// reimplemented method from superclass
void paintEvent( QPaintEvent* event );
......@@ -90,6 +96,8 @@ protected:
/// reimplemented method from superclass
virtual void inputMethodEvent(QInputMethodEvent *event);
void resizeEvent( QResizeEvent * event );
KoPAView * m_view;
KoPADocument * m_doc;
KoShapeManager * m_shapeManager;
......
......@@ -46,6 +46,20 @@ KoPADocument::KoPADocument( QWidget* parentWidget, QObject* parent, bool singleV
KoPAMasterPage * masterPage = new KoPAMasterPage();
m_masterPages.append( masterPage );
insertPage( new KoPAPage( masterPage ), 0 /*add first*/ );
#ifndef NDEBUG
//TODO This produces some pages to be used for testing remove when we have loading support
KoPathShape *pathShape = new KoPathShape();
pathShape->lineTo( QPointF( 100, 100 ) );
pathShape->setPosition( QPointF( 100, 100 ) );
pathShape->setBorder( new KoLineBorder( 1.0 ) );
KoShapeLayer * parentShape = dynamic_cast<KoShapeLayer *>( masterPage->iterator()[0] );
if ( parentShape )
{
parentShape->addChild( pathShape );
}
insertPage( new KoPAPage( masterPage ), 1 );
insertPage( new KoPAPage( masterPage ), 2 );
#endif
}
KoPADocument::~KoPADocument()
......@@ -377,4 +391,9 @@ int KoPADocument::takePage( KoPAPageBase *page )
return index;
}
QList<KoPAPageBase*> KoPADocument::pages() const
{
return m_pages;
}
#include "KoPADocument.moc"
......@@ -99,6 +99,8 @@ public:
void addShape( KoShape *shape );
void removeShape( KoShape* shape );
QList<KoPAPageBase*> pages() const;
protected:
virtual KoView *createViewInstance( QWidget *parent ) = 0;
virtual const char *odfTagName() = 0;
......
......@@ -61,7 +61,7 @@ KoPAView::KoPAView( KoPADocument *document, QWidget *parent )
initActions();
if ( m_doc->pageCount() > 0 )
setActivePage( m_doc->pageByIndex( 0, false ) );
updateActivePage( m_doc->pageByIndex( 0, false ) );
}
KoPAView::~KoPAView()
......@@ -202,27 +202,27 @@ void KoPAView::setViewMode( KoPAViewMode* mode )
}
}
void KoPAView::setCanvasMode( bool fullScreen )
KoShapeManager* KoPAView::masterShapeManager() const
{
if ( fullScreen )
{
m_zoomController->setZoomMode(KoZoomMode::ZOOM_PAGE);
m_canvasController->setCanvasMode( KoCanvasController::Presentation );
m_canvasController->setParent( ( QWidget* )0, Qt::Window );
m_canvasController->showFullScreen();
}
else
{
m_canvasController->setCanvasMode( KoCanvasController::Centered );
m_canvasController->setParent( this, Qt::Widget );
((QGridLayout *)layout())->addWidget( m_canvasController, 1, 1 );
m_canvasController->showNormal();
}
return m_canvas->masterShapeManager();
}
KoShapeManager* KoPAView::masterShapeManager() const
void KoPAView::updateActivePage( KoPAPageBase * page )
{
return m_canvas->masterShapeManager();
setActivePage( page );
m_canvas->updateSize();
KoPageLayout &layout = m_activePage->pageLayout();
m_horizontalRuler->setRulerLength(layout.width);
m_verticalRuler->setRulerLength(layout.height);
m_horizontalRuler->setActiveRange(layout.left, layout.width - layout.right);
m_verticalRuler->setActiveRange(layout.top, layout.height - layout.bottom);
QSizeF pageSize( layout.width, layout.height );
m_zoomController->setPageSize( pageSize );
m_zoomController->setDocumentSize( pageSize );
m_canvas->update();
}
void KoPAView::setActivePage( KoPAPageBase* page )
......@@ -255,19 +255,6 @@ void KoPAView::setActivePage( KoPAPageBase* page )
// if the page is a master page no shapes are in the masterShapeManager
masterShapeManager()->setShapes( QList<KoShape*>() );
}
m_canvas->updateSize();
KoPageLayout &layout = m_activePage->pageLayout();
m_horizontalRuler->setRulerLength(layout.width);
m_verticalRuler->setRulerLength(layout.height);
m_horizontalRuler->setActiveRange(layout.left, layout.width - layout.right);
m_verticalRuler->setActiveRange(layout.top, layout.height - layout.bottom);
QSizeF pageSize( layout.width, layout.height );
m_zoomController->setPageSize( pageSize );
m_zoomController->setDocumentSize( pageSize );
m_canvas->update();
}
void KoPAView::navigatePage( KoPageApp::PageNavigation pageNavigation )
......@@ -275,7 +262,7 @@ void KoPAView::navigatePage( KoPageApp::PageNavigation pageNavigation )
KoPAPageBase * newPage = m_doc->pageByNavigation( m_activePage, pageNavigation );
if ( newPage != m_activePage ) {
setActivePage( newPage );
updateActivePage( newPage );
}
}
......
......@@ -60,9 +60,13 @@ public:
KoPACanvas * kopaCanvas() { return m_canvas; }
KoPACanvas * kopaCanvas() const { return m_canvas; }
KoPADocument * kopaDocument() { return m_doc; }
/// @return Page that is shown in the canvas
KoPAPageBase* activePage() const;
/// Set the active page and updates the UI
void updateActivePage( KoPAPageBase * page );
/// Set page shown in the canvas to @p page
void setActivePage( KoPAPageBase * page );
......@@ -84,14 +88,6 @@ public:
*/
void setViewMode( KoPAViewMode* mode );
/**
* @brief Set the canvas mode
*
* @param fullscreen if true the canvas mode is set to Presentation
* if false it is set to Centered
*/
void setCanvasMode( bool fullScreen );
public slots:
/// Shows/hides the rulers
void setShowRulers(bool show);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment