Commit fff5e29c authored by Martin Pfeiffer's avatar Martin Pfeiffer

move from KoPoint/ KoRect to QRectF QPointF - causing a lot of warnings

svn path=/trunk/koffice/; revision=547322
parent 147e30d2
......@@ -35,10 +35,7 @@ int BasicElement::evilDestructionCount = 0;
BasicElement::BasicElement( BasicElement* p )
: parent( p ), m_baseline( 0 ), elementType( 0 )
{
setX( 0 );
setY( 0 );
setWidth( 0 );
setHeight( 0 );
m_boundingRect = QRectF( 0, 0, 0, 0 );
evilDestructionCount++;
}
......@@ -52,10 +49,8 @@ BasicElement::BasicElement( const BasicElement& other )
m_baseline( other.m_baseline ),
elementType( other.elementType )
{
setX( other.getX() );
setY( other.getY() );
setWidth( other.getWidth() );
setHeight( other.getHeight() );
m_boundingRect = QRectF( other.getX(), other.getY(), other.getWidth(), other.getHeight() );
evilDestructionCount++;
}
......@@ -243,4 +238,44 @@ QString BasicElement::toLatex()
return "{}";
}
void BasicElement::setWidth( double width )
{
m_boundingRect.setWidth( width );
}
void BasicElement::setHeight( double height )
{
m_boundingRect.setHeight( height );
}
void BasicElement::setX( double x )
{
m_boundingRect.setX( x );
}
void BasicElement::setY( double y )
{
m_boundingRect.setY( y );
}
double BasicElement::getHeight() const
{
return m_boundingRect.height();
}
double BasicElement::getWidth() const
{
return m_boundingRect.width();
}
double BasicElement::getY() const
{
return m_boundingRect.y();
}
double BasicElement::getX() const
{
return m_boundingRect.x();
}
KFORMULA_NAMESPACE_END
......@@ -336,20 +336,17 @@ public:
BasicElement* getParent() { return parent; }
void setParent(BasicElement* p) { parent = p; }
luPixel getX() const { return m_x; }
luPixel getY() const { return m_y; }
double getX() const;
double getY() const;
void setX( luPixel x ) { m_x = x; }
void setY( luPixel y ) { m_y = y; }
//QSize getSize() { return size; }
luPixel getWidth() const { return m_width; }
luPixel getHeight() const { return m_height; }
void setWidth( luPixel width ) { m_width = width; }
void setHeight( luPixel height ) { m_height = height; }
void setX( double x );
void setY( double y );
double getWidth() const;
double getHeight() const;
void setWidth( double width );
void setHeight( double height );
luPixel getBaseline() const { return m_baseline; }
void setBaseline( luPixel line ) { m_baseline = line; }
......@@ -440,26 +437,11 @@ protected:
private:
/**
* Our parent.
* The parent might not be null except for the FormulaElement
* that is the top of the element tree.
*/
/// The element's parent element - might not be null except of FormulaElement
BasicElement* parent;
/**
* This elements size.
*/
//QSize size;
luPixel m_width;
luPixel m_height;
/**
* Our position relative to our parent.
*/
//KoPoint position;
luPixel m_x;
luPixel m_y;
/// The boundingRect storing the element's width, height, x and y
QRectF m_boundingRect;
/**
* The position of our base line from
......
......@@ -379,10 +379,10 @@ void Artwork::drawBigCurlyBracket( QPainter& p, const ContextStyle& style, const
QChar middle = style.symbolTable().character( chars[3] );
QFontMetrics fm(p.fontMetrics());
QRect upperBound = fm.boundingRect(uppercorner);
QRect lowerBound = fm.boundingRect(lowercorner);
QRect middleBound = fm.boundingRect(middle);
QRect lineBound = fm.boundingRect(line);
QRectF upperBound = fm.boundingRect(uppercorner);
QRectF lowerBound = fm.boundingRect(lowercorner);
QRectF middleBound = fm.boundingRect(middle);
QRectF lineBound = fm.boundingRect(line);
pixel ptX = style.layoutUnitToPixelX( x );
pixel ptY = style.layoutUnitToPixelY( y );
......@@ -401,16 +401,16 @@ void Artwork::drawBigCurlyBracket( QPainter& p, const ContextStyle& style, const
// If the world was perfect and the urw-symbol font correct
// this could be 0.
//lu safety = lineBound.height() / 10;
pixel safety = 0;
double safety = 0;
pixel lineHeight = lineBound.height() - safety;
pixel gap = height/2 - upperBound.height() - middleBound.height() / 2;
double lineHeight = lineBound.height() - safety;
double gap = height/2 - upperBound.height() - middleBound.height() / 2;
if (gap > 0) {
QString ch = QString(QChar(line));
int lineCount = qRound( gap / lineHeight ) + 1;
pixel start = (height - middleBound.height()) / 2 + safety;
double start = (height - middleBound.height()) / 2 + safety;
for (int i = 0; i < lineCount; i++) {
p.drawText( ptX, ptY-lineBound.top()+qMax( start-(i+1)*lineHeight,
upperBound.width() ),
......
......@@ -23,14 +23,11 @@
#include <memory>
#include <QPoint>
#include <QRect>
#include <QPointF>
#include <QSizeF>
#include <QRectF>
#include <QString>
#include <KoPoint.h>
#include <KoRect.h>
#define KFORMULA_NAMESPACE_BEGIN namespace KFormula {
#define KFORMULA_NAMESPACE_END }
......@@ -38,39 +35,34 @@ KFORMULA_NAMESPACE_BEGIN
const int DEBUGID = 40000;
// to make kDebug a litte more interessting...
//#define TERM_RESET ""
//#define TERM_ERROR ""
/**
* The type to be used for points.
*/
typedef double pt;
typedef KoPoint PtPoint;
typedef KoRect PtRect;
//typedef KoSize PtSize;
typedef QPointF PtPoint;
typedef QRectF PtRect;
/**
* Pixels. At any zoom level.
*/
typedef int pixel;
typedef QPoint PixelPoint;
typedef QRect PixelRect;
typedef QSize PixelSize;
typedef double pixel;
typedef QPointF PixelPoint;
typedef QRectF PixelRect;
typedef QSizeF PixelSize;
/**
* Layout Unit. That's the values we store to get
* wysiwyg right.
*/
typedef int luPt;
typedef QPoint LuPtPoint;
typedef QRect LuPtRect;
typedef QSize LuPtSize;
typedef int luPixel;
typedef QPoint LuPixelPoint;
typedef QRect LuPixelRect;
typedef QSize LuPixelSize;
typedef double luPt;
typedef QPointF LuPtPoint;
typedef QRectF LuPtRect;
typedef QSizeF LuPtSize;
typedef double luPixel;
typedef QPointF LuPixelPoint;
typedef QRectF LuPixelRect;
typedef QSizeF LuPixelSize;
/**
......
......@@ -137,7 +137,7 @@ View::~View()
QPoint View::getCursorPoint() const
{
return contextStyle().layoutUnitToPixel( cursor()->getCursorPoint() );
return contextStyle().layoutUnitToPixel( cursor()->getCursorPoint().toPoint() );
}
void View::setReadOnly(bool ro)
......@@ -224,67 +224,67 @@ void View::wheelEvent( QWheelEvent* event )
const ContextStyle& context = contextStyle();
wheelEvent( event, context.pixelToLayoutUnit( event->pos() ) );
}
void View::mousePressEvent( QMouseEvent* event, const PtPoint& pos )
/*
void View::mousePressEvent( QMouseEvent* event, const QPointF& pos )
{
const ContextStyle& context = contextStyle();
mousePressEvent( event, context.ptToLayoutUnitPix( pos ) );
}
void View::mouseReleaseEvent( QMouseEvent* event, const PtPoint& pos )
void View::mouseReleaseEvent( QMouseEvent* event, const QPointF& pos )
{
const ContextStyle& context = contextStyle();
mouseReleaseEvent( event, context.ptToLayoutUnitPix( pos ) );
}
void View::mouseDoubleClickEvent( QMouseEvent* event, const PtPoint& pos )
void View::mouseDoubleClickEvent( QMouseEvent* event, const QPointF& pos )
{
const ContextStyle& context = contextStyle();
mouseDoubleClickEvent( event, context.ptToLayoutUnitPix( pos ) );
}
void View::mouseMoveEvent( QMouseEvent* event, const PtPoint& pos )
void View::mouseMoveEvent( QMouseEvent* event, const QPointF& pos )
{
const ContextStyle& context = contextStyle();
mouseMoveEvent( event, context.ptToLayoutUnitPix( pos ) );
}
void View::wheelEvent( QWheelEvent* event, const PtPoint& pos )
void View::wheelEvent( QWheelEvent* event, const QPointF& pos )
{
const ContextStyle& context = contextStyle();
wheelEvent( event, context.ptToLayoutUnitPix( pos ) );
}
void View::mousePressEvent( QMouseEvent* event, const LuPixelPoint& pos )
*/
void View::mousePressEvent( QMouseEvent* event, const QPointF& pos )
{
int flags = movementFlag( event->modifiers() );
cursor()->mousePress( pos, flags );
emitCursorChanged();
}
void View::mouseReleaseEvent( QMouseEvent* event, const LuPixelPoint& pos )
void View::mouseReleaseEvent( QMouseEvent* event, const QPointF& pos )
{
int flags = movementFlag( event->modifiers() );
cursor()->mouseRelease( pos, flags );
emitCursorChanged();
}
void View::mouseDoubleClickEvent( QMouseEvent*, const LuPixelPoint& )
void View::mouseDoubleClickEvent( QMouseEvent*, const QPointF& )
{
cursor()->moveRight( WordMovement );
cursor()->moveLeft( SelectMovement | WordMovement );
emitCursorChanged();
}
void View::mouseMoveEvent( QMouseEvent* event, const LuPixelPoint& pos )
void View::mouseMoveEvent( QMouseEvent* event, const QPointF& pos )
{
int flags = movementFlag( event->modifiers() );
cursor()->mouseMove( pos, flags );
emitCursorChanged();
}
void View::wheelEvent( QWheelEvent*, const LuPixelPoint& )
void View::wheelEvent( QWheelEvent*, const QPointF& )
{
}
......
......@@ -24,7 +24,6 @@
#include <QEvent>
#include <QObject>
#include <QRect>
//Added by qt3to4:
#include <QMouseEvent>
#include <QWheelEvent>
#include <QFocusEvent>
......@@ -73,20 +72,20 @@ public:
void mouseDoubleClickEvent(QMouseEvent* event);
void mouseMoveEvent(QMouseEvent* event);
void wheelEvent(QWheelEvent* event);
/*
// the mouse event happened at a certain point
void mousePressEvent( QMouseEvent* event, const PtPoint& pos );
void mouseReleaseEvent( QMouseEvent* event, const PtPoint& pos );
void mouseDoubleClickEvent( QMouseEvent* event, const PtPoint& pos );
void mouseMoveEvent( QMouseEvent* event, const PtPoint& pos );
void wheelEvent( QWheelEvent* event, const PtPoint& pos );
void mousePressEvent( QMouseEvent* event, const QPointF& pos );
void mouseReleaseEvent( QMouseEvent* event, const QPointF& pos );
void mouseDoubleClickEvent( QMouseEvent* event, const QPointF& pos );
void mouseMoveEvent( QMouseEvent* event, const QPointF& pos );
void wheelEvent( QWheelEvent* event, const QPointF& pos );
*/
// the mouse event happened at a certain point
void mousePressEvent( QMouseEvent* event, const LuPixelPoint& pos );
void mouseReleaseEvent( QMouseEvent* event, const LuPixelPoint& pos );
void mouseDoubleClickEvent( QMouseEvent* event, const LuPixelPoint& pos );
void mouseMoveEvent( QMouseEvent* event, const LuPixelPoint& pos );
void wheelEvent( QWheelEvent* event, const LuPixelPoint& pos );
void mousePressEvent( QMouseEvent* event, const QPointF& pos );
void mouseReleaseEvent( QMouseEvent* event, const QPointF& pos );
void mouseDoubleClickEvent( QMouseEvent* event, const QPointF& pos );
void mouseMoveEvent( QMouseEvent* event, const QPointF& pos );
void wheelEvent( QWheelEvent* event, const QPointF& pos );
void keyPressEvent(QKeyEvent* event);
virtual void focusInEvent(QFocusEvent* event);
......
......@@ -20,8 +20,6 @@
#include <QFile>
#include <QRegExp>
#include <QString>
#include <QStringList>
#include <QTextStream>
#include <kconfig.h>
......
......@@ -26,15 +26,14 @@
#include <QString>
#include <QStringList>
#include <QVector>
#include "kformuladefs.h"
#include "contextstyle.h"
class KConfig;
KFORMULA_NAMESPACE_BEGIN
class ContextStyle;
namespace KFormula
{
/**
* What we know about a unicode char. The char value itself
* is a key inside the symbol table. Here we have
......@@ -98,10 +97,10 @@ private:
*
* It contains all names that are know to the system.
*/
class KOFORMULA_EXPORT SymbolTable {
public:
SymbolTable();
class KOFORMULA_EXPORT SymbolTable
{
public:
SymbolTable();
/**
* Reads the unicode / font tables.
......@@ -186,6 +185,6 @@ private:
CharTableEntry dummyEntry;
};
KFORMULA_NAMESPACE_END
}
#endif // SYMBOLTABLE_H
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