[prev in list] [next in list] [prev in thread] [next in thread]
List: koffice-devel
Subject: Re: kword frameUnderMouse bug ?
From: Frank Dekervel <Frank.dekervel () student ! kuleuven ! ac ! be>
Date: 2002-02-27 22:10:38
[Download RAW message or body]
Op woensdag 27 februari 2002 22:13, schreef Frank Dekervel:
> Op woensdag 27 februari 2002 20:54, schreef Thomas Zander:
> > Another thing is that if I put my pointer on top of the hidden embedded
> > frame the pointer changes to a hand. I don't have time to look at that
> > right now; maybe you have...
>
> yup, i also saw that, needs to be fixed, and i was silently hoping for some
> clues here ... 'll investigate and try to fix.
fixed.
i redid getMouseCursor in kwdoc.cc to use frameUnderMouse (now it contained
its own logic), it seems logical to me, but there is one issue:
frameSet->getMouseCursor iterates over all the frames, and that's not needed
since we already know the right frame (not only frameset).
Would it be okay to add a parameter KWFrame *frame=0 to
KWFrameSet::getMouseCursor ? It would certainly work but it seems a bit
strange from a conceptual point of view...
greetings,
Frank
attached you find the combined patch against kwdoc.cc, most of the added code
is comments.
["kwdoc.diff" (text/x-diff)]
Index: kwdoc.cc
===================================================================
RCS file: /home/kde/koffice/kword/kwdoc.cc,v
retrieving revision 1.330
diff -u -2 -d -p -b -r1.330 kwdoc.cc
--- kwdoc.cc 2002/02/22 23:30:31 1.330
+++ kwdoc.cc 2002/02/27 22:05:26
@@ -2373,4 +2373,7 @@ KWFrame * KWDocument::frameUnderMouse( c
{
KWFrameSet *frameSet = fit.current();
+ // only consider non-inline frames.
+ if (frameSet->isFloating())
+ continue;
if ( !frameSet->isVisible() || frameSet->isRemoveableHeader() )
continue;
@@ -2386,4 +2389,44 @@ KWFrame * KWDocument::frameUnderMouse( c
if ( frame )
{
+ // now we iteratively search for inline frames in the found non-inline frame.
+
+ // the frameset we're looking in.
+ KWFrameSet *parentFrameSet= frameSet;
+ bool still_searching=true;
+ while(still_searching) {
+ QPtrListIterator<KWFrameSet> frs = framesetsIterator();
+ still_searching=false;
+
+ for (frs.toLast(); frs.current(); --frs) {
+
+ // find all floating framesets that have parentFrameSet as parent.
+ KWFrameSet *frsFrameSet = frs.current();
+ if (!frsFrameSet->isFloating())
+ continue;
+ if (frsFrameSet->anchorFrameset() != parentFrameSet)
+ continue;
+ // endless loop.
+ if (frsFrameSet == parentFrameSet)
+ qWarning("WARNING frsFrameSet == parentFrameSet. probably you will see this a lot of times :D");
+
+
+ // is this the border of an inline frame ? exit directly, no need to do further interations.
+ KWFrame *frsFrame = frsFrameSet->frameByBorder(nPoint);
+ if (frsFrame) {
+ if (border) *border=true;
+ return frsFrame;
+ }
+
+ // is this in the body of an inline frame ? so this frame is already a 'better match' than
+ // the old frame, but we keep searching.
+ frsFrame = frsFrameSet->frameAtPos(docPoint.x(),docPoint.y());
+ if (frsFrame) {
+ parentFrameSet=frsFrameSet;
+ frame=frsFrame;
+ still_searching=true;
+ }
+ }
+ }
+
if ( border ) *border = false;
return frame;
@@ -2409,16 +2452,18 @@ QString KWDocument::generateFramesetName
QCursor KWDocument::getMouseCursor( const QPoint &nPoint, bool controlPressed )
{
- QPtrListIterator<KWFrameSet> fit = framesetsIterator();
- for ( fit.toLast(); fit.current() ; --fit )
- {
- KWFrameSet *frameSet = fit.current();
- if ( !frameSet->isVisible() || frameSet->isRemoveableHeader() )
- continue;
+ bool border=true;
+ KWFrame *frame = frameUnderMouse(nPoint, &border );
+ if (frame) {
QCursor cursor;
- if ( frameSet->getMouseCursor( nPoint, controlPressed, cursor ) )
+ // possible optimisation: frameSet iterates over all possible frames, and we don't need
+ // this since we already know the right frame.
+ KWFrameSet *frameSet = frame->frameSet();
+ // the clean way:
+ if ( frameSet->getMouseCursor(nPoint, controlPressed, cursor))
return cursor;
+ // the dirty but faster way: (code duplication with kwrameset::getMouseCursor
+ //cursor = frame->getMouseCursor( docPoint, grpMgr ? true : false, defaultCursor );
}
-
return ibeamCursor;
}
_______________________________________________
koffice-devel mailing list
koffice-devel@mail.kde.org
http://mail.kde.org/mailman/listinfo/koffice-devel
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic