--- a/uifw/EikStd/dlgsrc/EIKDPAGE.CPP Thu Aug 19 10:11:06 2010 +0300
+++ b/uifw/EikStd/dlgsrc/EIKDPAGE.CPP Tue Aug 31 15:28:30 2010 +0300
@@ -56,7 +56,7 @@
#include <aknphysics.h>
#include <aknappui.h>
#include <AknPriv.hrh>
-#include "akntrace.h"
+
//
// Global constants.
//
@@ -94,31 +94,20 @@
public:
enum TFlags
{
- ELineHandlerCalled,
- EDragEventsAllowed // turned on when dragging is allowed
+ ELineHandlerCalled
};
static CDialogPageExtension* NewL();
~CDialogPageExtension();
- void Feedback( const CEikDialogPage& aControl,
- TTouchLogicalFeedback aFeedback ) const;
-
+ void Feedback( CEikDialogPage* aControl, TTouchLogicalFeedback aFeedback ) const;
/**
- * Produces vibra-only feedback.
- * Event filtering by pointer event is used.
+ * Produces vibra-only feedback. Event filtering by pointer event is used..
*/
- void SilentFeedback( const CEikDialogPage& aDPage,
+ void SilentFeedback( CEikDialogPage* aDPage,
TTouchLogicalFeedback aFeedback,
const TPointerEvent& aPointerEvent ) const;
-
- /**
- * Produces feedback in cases where the captioned control itself
- * doesn't do it.
- */
- void HandleFormFeedback( const CEikDialogPage& aDPage,
- const TPointerEvent& aPointerEvent,
- TInt aTouchedLineIndex,
- TInt aCurrentLine );
+
+ void HandleFormFeedback( CEikDialogPage* aControl, const TPointerEvent& aPointerEvent, TInt aTouchedLineIndex, TInt aCurrentLine );
protected:
void ConstructL();
@@ -132,6 +121,7 @@
TBool iExternalScrollbar;
TBool iIsDoubleQuery;
TBool iFocusedClicked;
+ TInt iPreviousThumbPosition;
TBool iPreviousThumbDirection;
MTouchFeedback* iFeedback;
TBitFlags iFlags;
@@ -151,8 +141,8 @@
TInt iLastTouchedLine;
TPoint iSynchronizedPosition;
TBool iScrolling;
+ TBool iScrolled;
TBool iInitialLayoutDone;
- TBool iSetInitialFocusDone;
TBool iHandlingResourceChange;
TInt iCapturingItem;
// record the center point Y value of current view when touch down an item
@@ -169,8 +159,6 @@
TBool iUsesSingleClick;
// It is used to distinguish if the focus item has changed.
TBool iFocusItemChanged;
- // Boolean to check if form was scrolling on button down
- TBool iWasScrolling;
};
CDialogPageExtension::CDialogPageExtension()
@@ -212,89 +200,76 @@
}
void CDialogPageExtension::HandleFormFeedback(
- const CEikDialogPage& aDPage,
+ CEikDialogPage* aDPage,
const TPointerEvent& aPointerEvent,
TInt aTouchedLineIndex,
TInt aCurrentLine )
{
- CEikCaptionedControl* firstLine( aDPage.LineOnPageOrNull( 0 ) );
-
- if( aDPage.IsEditable() )
+ // note, that iFormControl is checked in Feedback()
+ if ( aPointerEvent.iType == TPointerEvent::EButton1Down &&
+ aCurrentLine != aTouchedLineIndex && aDPage->LineOnPageOrNull( 0 ) )
{
- // note, that iFormControl is checked in Feedback()
- if ( aPointerEvent.iType == TPointerEvent::EButton1Down &&
- aCurrentLine != aTouchedLineIndex &&
- firstLine )
- {
- // feedback for edit mode form, when non-focused line is clicked
- // feedback for focused item is responsibility of the item
- // no feedback with focus change when single click is enabled
- if ( !iUsesSingleClick )
- {
- Feedback( aDPage, ETouchFeedbackSensitiveList );
- }
- iFocusItemChanged = ETrue;
- }
- else if ( firstLine )
+ // feedback for edit/view mode form, when non-focused line is clicked
+ // feedback for focused item is responsibility of the item
+ // no feedback with focus change when single click is enabled
+ if ( !iUsesSingleClick )
{
- if ( aPointerEvent.iType == TPointerEvent::EButton1Down &&
- aTouchedLineIndex == aCurrentLine )
- {
- // Feedback for edit mode form, when focused item is
- // clicked. Basically same case as for msk simulation later on
- // the function, but on pointer
- // down. iExtension->iFocusedClicked is not valid here, since
- // it can't be known in this phase whether user drags pointer
- // away.
- Feedback( aDPage, ETouchFeedbackList );
- iFocusItemChanged = EFalse;
- }
- else if ( aPointerEvent.iType == TPointerEvent::EButton1Up )
- {
- // When focus changed, it should not send feedback on up event.
- // When up event comes, aTouchedLineIndex always equal to
- // aCurrentLine.
- if ( !iFocusItemChanged )
- {
- SilentFeedback( aDPage, ETouchFeedbackList, aPointerEvent );
- }
- }
+ Feedback( aDPage, ETouchFeedbackSensitiveItem );
+ }
+ iFocusItemChanged = ETrue;
+ }
+
+ else if ( aPointerEvent.iType == TPointerEvent::EButton1Down &&
+ aTouchedLineIndex == aCurrentLine && aDPage->LineOnPageOrNull( 0 ) )
+ {
+ // Feedback for view mode form, when focused item is
+ // clicked. Basically same case as for msk simulation later on
+ // the function, but on pointer
+ // down. iExtension->iFocusedClicked is not valid here, since
+ // it can't be known in this phase whether user drags pointer
+ // away.
+ Feedback( aDPage, ETouchFeedbackBasicItem );
+ iFocusItemChanged = EFalse;
+ }
+
+ else if ( aPointerEvent.iType == TPointerEvent::EButton1Up &&
+ aDPage->LineOnPageOrNull( 0 ) )
+ {// when focus changed, it should not send feedback on up event.
+ //when up event comes, aTouchedLineIndex always equal to aCurrentLine
+ if ( !iFocusItemChanged )
+ {
+ SilentFeedback( aDPage, ETouchFeedbackBasicItem, aPointerEvent );
}
}
}
-
-void CDialogPageExtension::Feedback( const CEikDialogPage& aDPage,
+void CDialogPageExtension::Feedback( CEikDialogPage* aDPage,
TTouchLogicalFeedback aFeedback ) const
{
- if ( iFeedback &&
- aDPage.IsForm() &&
- !aDPage.IsDimmed() &&
- aDPage.IsVisible() )
+ if ( aDPage
+ && aDPage->IsForm()
+ && iFeedback
+ && !aDPage->IsDimmed()
+ && aDPage->IsVisible() )
{
iFeedback->InstantFeedback( aFeedback );
}
}
-
-void CDialogPageExtension::SilentFeedback(
- const CEikDialogPage& aDPage,
- TTouchLogicalFeedback aFeedback,
- const TPointerEvent& aPointerEvent ) const
+void CDialogPageExtension::SilentFeedback( CEikDialogPage* aDPage,
+ TTouchLogicalFeedback aFeedback,
+ const TPointerEvent& aPointerEvent ) const
{
- if ( iFeedback &&
- aDPage.IsForm() &&
- !aDPage.IsDimmed() &&
- aDPage.IsVisible() )
+ if ( aDPage
+ && aDPage->IsForm()
+ && iFeedback
+ && !aDPage->IsDimmed()
+ && aDPage->IsVisible() )
{
- iFeedback->InstantFeedback( &aDPage,
- aFeedback,
- ETouchFeedbackVibra,
- aPointerEvent );
+ iFeedback->InstantFeedback( aDPage, aFeedback, ETouchFeedbackVibra, aPointerEvent );
}
}
-
class CAknPaneScroll : public CBase
{
public:
@@ -357,7 +332,6 @@
CEikDialogPage::~CEikDialogPage()
{
- _AKNTRACE_FUNC_ENTER;
AKNTASHOOK_REMOVE();
// Page observer needs to be nulled or an already deleted instance is
// called when pointer up event is handled. This is valid only for dialogs
@@ -367,15 +341,12 @@
delete iLines;
delete iScroll;
delete iExtension;
- _AKNTRACE_FUNC_EXIT;
}
CEikDialogPage* CEikDialogPage::NewL(TInt aPageId,RWindow& aViewWin,CEikScrollBarFrame& aSBFrame,const CEikDialogPageContainer& aParent,MEikDialogPageObserver* aPageObserver)
{
- _AKNTRACE_FUNC_ENTER;
CEikDialogPage* self=CEikDialogPage::NewLC(aPageId,aViewWin,aSBFrame,aParent,aPageObserver);
CleanupStack::Pop();
- _AKNTRACE_FUNC_EXIT;
return self;
}
@@ -393,33 +364,27 @@
CEikDialogPage* CEikDialogPage::NewLC(TInt aPageId,RWindow& aViewWin,CEikScrollBarFrame& aSBFrame,const CEikDialogPageContainer& aParent,MEikDialogPageObserver* aPageObserver)
{
- _AKNTRACE_FUNC_ENTER;
CEikDialogPage* self=new(ELeave) CEikDialogPage(aPageId,aViewWin,aSBFrame,aPageObserver);
CleanupStack::PushL(self);
CommonConstructCodeBetweenNewL(*self,aParent);
AKNTASHOOK_ADDL( self, "CEikDialogPage" );
- _AKNTRACE_FUNC_EXIT;
return self;
}
CEikDialogPage* CEikDialogPage::NewL(TInt aPageId,RWindow& aViewWin,CEikScrollBarFrame& aSBFrame,const CEikDialogPageContainer& aParent,MEikDialogPageObserver* aPageObserver,TResourceReader& aReader)
{
- _AKNTRACE_FUNC_ENTER;
CEikDialogPage* self=CEikDialogPage::NewLC(aPageId,aViewWin,aSBFrame,aParent,aPageObserver,aReader);
CleanupStack::Pop();
- _AKNTRACE_FUNC_EXIT;
return self;
}
CEikDialogPage* CEikDialogPage::NewLC(TInt aPageId,RWindow& aViewWin,CEikScrollBarFrame& aSBFrame,const CEikDialogPageContainer& aParent,MEikDialogPageObserver* aPageObserver,TResourceReader& aReader)
{
- _AKNTRACE_FUNC_ENTER;
CEikDialogPage* self=new(ELeave) CEikDialogPage(aPageId,aViewWin,aSBFrame,aPageObserver);
CleanupStack::PushL(self);
CommonConstructCodeBetweenNewL(*self,aParent);
self->ConstructFromResourceL(aReader);
AKNTASHOOK_ADDL( self, "CEikDialogPage" );
- _AKNTRACE_FUNC_EXIT;
return self;
}
@@ -428,15 +393,12 @@
: iPageObserver(aPageObserver),
iPageId(aPageId),iCurrentLine(-1)
{
- _AKNTRACE_FUNC_ENTER;
SetBlank();
SetComponentsToInheritVisibility();
- _AKNTRACE_FUNC_EXIT;
}
void CEikDialogPage::ConstructL()
{
- _AKNTRACE_FUNC_ENTER;
iLines=new(ELeave)CEikCapCArray(KLineArrayGranularity);
SetContainerWindowL( *iPageContainer );
Window().SetPointerGrab(ETrue);
@@ -445,12 +407,10 @@
iScroll = new(ELeave)CAknPaneScroll(this);
iScroll->SetLines(iLines);
iExtension = CDialogPageExtension::NewL();
- _AKNTRACE_FUNC_EXIT;
}
void CEikDialogPage::ConstructFromResourceL(TResourceReader& aReader, TBool aFormControl )
{
- _AKNTRACE_FUNC_ENTER;
iFormControl = aFormControl ;
if ( IsForm() )
@@ -475,7 +435,6 @@
iCoeEnv->CreateResourceReaderLC(indirectReader,indirectRid);
ConstructFromResourceL(indirectReader);
CleanupStack::PopAndDestroy();
- _AKNTRACE_FUNC_EXIT;
return;
}
@@ -495,6 +454,7 @@
thisLine->iIsFormControl = aFormControl ;
if ( aFormControl )
{
+ thisLine->GetAknLayoutValuesL() ; // should cause the control to have size.
if ( iFormFlags )
thisLine->SetFormFlags( iFormFlags ) ;
}
@@ -508,21 +468,17 @@
iScroll = new(ELeave)CAknPaneScroll(this);
}
iScroll->SetLines(iLines);
- _AKNTRACE_FUNC_EXIT;
}
void CEikDialogPage::ConstructFormFromResourceL( TResourceReader& aReader )
{
- _AKNTRACE_FUNC_ENTER;
iFormFlags = TInt16(aReader.ReadInt16()) ;
iFormLayout = (iFormFlags&EEikFormUseDoubleSpacedFormat) ? EDouble : ESingle;
ConstructFromResourceL( aReader, ETrue ) ;
- _AKNTRACE_FUNC_EXIT;
}
CCoeControl* CEikDialogPage::CreateLineByTypeL(const TDesC& aCaption,TInt aLineId,TInt aControlType,TAny* aReturnValue)
{
- _AKNTRACE_FUNC_ENTER;
ShowFocus( EFalse, EFalse ) ; // Turn the focus off the current line.
CEikCaptionedControl* line=new(ELeave) CEikCaptionedControl;
CleanupStack::PushL(line);
@@ -558,24 +514,21 @@
// physics engine needs to be updated when lines are added after the initial layout
UpdatePhysics();
- _AKNTRACE_FUNC_EXIT;
+
return line->iControl;
}
CEikCaptionedControl* CEikDialogPage::ConstructLineL(TInt aResourceId)
{
- _AKNTRACE_FUNC_ENTER;
TResourceReader resourceReader;
iCoeEnv->CreateResourceReaderLC(resourceReader,aResourceId);
CEikCaptionedControl* line=ConstructLineL(resourceReader);
CleanupStack::PopAndDestroy(); // resourceReader
- _AKNTRACE_FUNC_EXIT;
return line;
}
CEikCaptionedControl* CEikDialogPage::ConstructLineL(TResourceReader& aReader)
{
- _AKNTRACE_FUNC_ENTER;
CEikCaptionedControl* line=new(ELeave) CEikCaptionedControl;
CleanupStack::PushL(line);
line->iIsFormControl=iFormControl;
@@ -597,13 +550,11 @@
if (indirectRid)
CleanupStack::PopAndDestroy();
CleanupStack::Pop(); // line
- _AKNTRACE_FUNC_EXIT;
return line;
}
void CEikDialogPage::ConstructByTypeL(TInt aType,CEikCaptionedControl* aLine,CCoeControl* aContainer)
{
- _AKNTRACE_FUNC_ENTER;
SEikControlInfo controlInfo=EikControlFactory::CreateByTypeL(aType);
if (!controlInfo.iControl)
controlInfo=CreateCustomControlL(aType);
@@ -637,7 +588,6 @@
aLine->SetTrailerL(tmp->Des());
CleanupStack::PopAndDestroy(); // tmp
}
- _AKNTRACE_FUNC_EXIT;
}
SEikControlInfo CEikDialogPage::CreateCustomControlL(TInt aControlType)
@@ -648,7 +598,6 @@
void CEikDialogPage::SetActiveL()
{
- _AKNTRACE_FUNC_ENTER;
ActivateL();
MakeVisible(ETrue);
@@ -684,22 +633,22 @@
AknsUtils::RegisterControlPosition(capCtrl->iTrailer);
AknsUtils::RegisterControlPosition(capCtrl->iBitmap);
- if ( capCtrl->iIsFormControl && iCurrentLine != i)
+ if ( capCtrl->iIsFormControl && iCurrentLine != i)
+ {
+
+ if (capCtrl->ControlIsAnEdwin(capCtrl->iControlType))
{
- if (capCtrl->ControlIsAnEdwin(capCtrl->iControlType))
- {
- CEikEdwin *edwin = (CEikEdwin*)capCtrl->iControl;
- TRAP_IGNORE( edwin->TextView()->SetDocPosL( 0 ) );
- }
+ CEikEdwin *edwin = (CEikEdwin*)capCtrl->iControl;
+ TRAP_IGNORE(edwin->TextView()->SetDocPosL(0)
+ );
}
+ }
+
}
-
- _AKNTRACE_FUNC_EXIT;
}
void CEikDialogPage::SetActiveAndFocusL()
{
- _AKNTRACE_FUNC_ENTER;
SetActiveL();
SetEditableL(iIsEditable, ETrue);
//When active a page, need to show the focus in that page.
@@ -712,20 +661,16 @@
ExposeLine( iCurrentLine, EFalse );
UpdateScrollBarL();
- _AKNTRACE_FUNC_EXIT;
}
void CEikDialogPage::SetInactiveL()
{
- _AKNTRACE_FUNC_ENTER;
MakeEdwinScrollbarsVisibleL(EFalse);
MakeVisible(EFalse);
- _AKNTRACE_FUNC_EXIT;
}
void CEikDialogPage::MakeEdwinScrollbarsVisibleL(TBool aVisible)
{
- _AKNTRACE_FUNC_ENTER;
const TInt numLines=iLines->Count();
for (TInt ii=0;ii<numLines;ii++)
{
@@ -745,7 +690,6 @@
}
}
}
- _AKNTRACE_FUNC_EXIT;
}
TInt CEikDialogPage::PageId() const
@@ -764,7 +708,6 @@
TBool CEikDialogPage::SetInitialFocus()
{
- _AKNTRACE_FUNC_ENTER;
TBool focusSet=EFalse;
const TInt numLines=iLines->Count();
@@ -775,26 +718,26 @@
continue;
ChangeFocusTo(ii);
focusSet=ETrue;
+
+ if ( IsForm() )
+ {
+ // move line with initial focus to the screen
+ iLines->MoveLineToScreen( ii, iPhysics->ViewTopY(), ETrue );
+ }
break;
}
- iExtension->iSetInitialFocusDone = ETrue;
- _AKNTRACE( "return focusSet;: [%d]", focusSet );
- _AKNTRACE_FUNC_EXIT;
+
return focusSet;
}
TKeyResponse CEikDialogPage::OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType)
{
- _AKNTRACE_FUNC_ENTER;
TKeyResponse response=EKeyWasNotConsumed;
if (!(PageContainer()->PageSelector()->Dialg()->DialogFlags() & EEikDialogFlagDontEatUpDownEvents))
{
if (aType != EEventKey)
- {
- _AKNTRACE_FUNC_EXIT;
- return response;
- }
+ return response;
}
const TInt numLines=iLines->Count();
@@ -818,13 +761,11 @@
|| aKeyEvent.iCode==EKeyPrevious
))
response=OfferUpDownKeyEventL(aKeyEvent,aType,ENonCyclic);
- _AKNTRACE_FUNC_EXIT;
return response;
}
TKeyResponse CEikDialogPage::OfferUpDownKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType,TFocusNavigationMode aFocusNavigationMode)
{
- _AKNTRACE_FUNC_ENTER;
TKeyResponse response=EKeyWasNotConsumed;
if (aType==EEventKey)
{
@@ -861,10 +802,12 @@
switch (aFocusNavigationMode)
{
case ECyclic:
+ iExtension->iScrolled = ETrue;
response=HandleCyclicFocusNavigationKeyL(aKeyEvent);
break;
case ENonCyclic:
+ iExtension->iScrolled = ETrue;
response=HandleNonCyclicFocusNavigationKeyL(aKeyEvent);
break;
@@ -879,7 +822,7 @@
if (response==EKeyWasConsumed)
UpdateScrollBarThumb();
- _AKNTRACE_FUNC_EXIT;
+
return response;
}
@@ -988,7 +931,6 @@
void CEikDialogPage::SetDimmed(TBool aDimmed)
{
- _AKNTRACE_FUNC_ENTER;
CCoeControl::SetDimmed(aDimmed);
const TInt numLines=iLines->Count();
@@ -998,18 +940,13 @@
thisLine->iControl->SetDimmed(aDimmed);
thisLine->CheckDimmedDisplayState();
}
- _AKNTRACE_FUNC_EXIT;
}
TBool CEikDialogPage::RotateFocusByL(TInt aDelta)
{
- _AKNTRACE_FUNC_ENTER;
TInt numLines=iLines->Count();
if (numLines == 0)
- {
- _AKNTRACE_FUNC_EXIT;
return(EFalse);
- }
// If form is in view mode and highlight is hidden then the first
// navigation key press just displays the highlight.
@@ -1033,7 +970,7 @@
HandleHighlightTimer();
}
}
- _AKNTRACE_FUNC_EXIT;
+
return ETrue;
}
@@ -1062,27 +999,21 @@
ChangeFocusToAndExposeL(currentLine);
LineChangedL((*iLines)[currentLine]->iId);
iExtension->iFocusedClicked = ETrue;
- _AKNTRACE_FUNC_EXIT;
return(ETrue);
}
- _AKNTRACE_FUNC_EXIT;
+
return EFalse;
}
void CEikDialogPage::ChangeFocusToAndExposeL( TInt aLine, TBool /*aShowWholeControl*/ )
{
- _AKNTRACE_FUNC_ENTER;
- _AKNTRACE( "CEikDialogPage::ChangeFocusToAndExposeL() aLine: [%d]", aLine );
if ( aLine < 0 || aLine == iCurrentLine )
- {
- _AKNTRACE_FUNC_EXIT;
return;
- }
TInt oldLine = iCurrentLine;
if( aLine != iCurrentLine )
- (*iLines)[iCurrentLine]->ScrollBackEditorL();
+ (*iLines)[iCurrentLine]->ScrollBackEditor();
ChangeFocusTo( aLine );
ExposeLine( iCurrentLine, EFalse );
@@ -1100,7 +1031,6 @@
DrawDeferred();
}
- _AKNTRACE_FUNC_EXIT;
}
TInt CEikDialogPage::TopFocusableLine() const
@@ -1129,14 +1059,12 @@
TBool CEikDialogPage::LineIsFocusable(TInt aLine) const
{
- _AKNTRACE_FUNC_ENTER;
TBool focusable(ETrue);
CEikCaptionedControl* line=(*iLines)[aLine];
if (line->IsNonFocusing() || line->IsDimmed() || !(line->IsVisible()))
focusable=EFalse;
- _AKNTRACE( "focusable: [%d]", focusable );
- _AKNTRACE_FUNC_EXIT;
+
return focusable;
}
@@ -1147,8 +1075,6 @@
void CEikDialogPage::InsertLineL(TInt aPosition,TInt aResourceId)
{
- _AKNTRACE_FUNC_ENTER;
- _AKNTRACE( "aPosition: [%d]", aPosition );
// alteration is bloated but should not provide any side-effects.
if (!iFormControl)
{
@@ -1172,14 +1098,11 @@
*/
if (iCurrentLine>=aPosition)
iCurrentLine++;
- _AKNTRACE_FUNC_EXIT;
}
void CEikDialogPage::DeleteLine(TInt aLineId, TBool aRedraw)
{
- _AKNTRACE_FUNC_ENTER;
TInt index( LineIndex( aLineId ) ) ;
- _AKNTRACE( "Delete line index: [%d]", index );
if ( index == iCurrentLine ) // we're deleting the current line
{
// If this is the last line then move the focus to the line above. (becomes -1 if last line)
@@ -1222,14 +1145,13 @@
TInt targetLine = iCurrentLine ;
iCurrentLine = -1 ;
ChangeFocusTo( targetLine ) ;
- ExposeLine( targetLine, ETrue ) ;
+ ExposeLine( targetLine, EFalse ) ;
ShowFocus( ETrue, EFalse ) ;
}
DrawNow();
TRAP_IGNORE(UpdateScrollBarL()); // if OOM, scrollbar will not be updated - No great loss.
}
- _AKNTRACE_FUNC_EXIT;
}
void CEikDialogPage::AdjustAllIds(TInt aControlIdDelta)
@@ -1239,9 +1161,8 @@
TInt CEikDialogPage::FocusLineL(TInt aLineId)
{
- _AKNTRACE_FUNC_ENTER;
TInt lineIndex=LineIndex(aLineId);
- _AKNTRACE( "Delete line index: [%d]", lineIndex );
+
if (lineIndex==KErrNotFound)
return KErrNotFound;
@@ -1249,7 +1170,6 @@
// Show whole line, not scroll into line.
ChangeFocusToAndExposeL(lineIndex, ETrue);
LineChangedL(aLineId);
- _AKNTRACE_FUNC_EXIT;
return KErrNone;
}
@@ -1328,15 +1248,31 @@
return KErrNotFound;
}
+TInt CEikDialogPage::YPosToLine2(TInt aYPos) const
+ {
+ return iLines->YPosToLine( Rect(), iScroll->Top(), iScroll->Middle(), iScroll->Bottom(), aYPos );
+ }
+
+TInt CEikDialogPage::LineToYPos(TInt& aLine) const
+//
+// Calcs YPos of line relative to the ViewWin and adjusts aLine if its out of bounds
+ {
+ ASSERT(iLines);
+ const TInt numLines=iLines->Count();
+ ASSERT(numLines>0);
+ if (aLine<0)
+ aLine=0;
+ else if (aLine>=numLines)
+ aLine=numLines-1;
+ return (*iLines)[aLine]->Position().iY; // TPREMOVAL +iDataWinPos.iY;
+ }
void CEikDialogPage::ExposeLine(TInt aLine, TBool aForceResize, TBool aShowWholeLine)
//
/* Exposes the given line so that its fully visible in the ViewWin
*/ {
- _AKNTRACE_FUNC_ENTER;
if ( iSize.iHeight == 0 || aLine == -1 )
{
- _AKNTRACE_FUNC_EXIT;
return;
}
@@ -1344,7 +1280,6 @@
if ( change == CAknPaneScroll::ENoChange && !aForceResize )
{
- _AKNTRACE_FUNC_EXIT;
return;
}
@@ -1384,38 +1319,6 @@
}
}
- // If control height is greater then screen. Make sure that edwin's cursor is visible
- if (controlType == EEikCtEdwin && controlHeight > Rect().Height())
- {
- CEikEdwin* edwin = dynamic_cast<CEikEdwin*>(capCtrl->iControl);
- if (edwin)
- {
- TInt pos = edwin->CursorPos();
- TRect linerect;
- TRAP_IGNORE( linerect = edwin->TextLayout()->GetLineRectL(pos, pos) );
-
- TPoint capctrlpos = capCtrl->Position();
- TPoint edwinpos = edwin->Position();
- if (edwinpos.iY - capctrlpos.iY + (linerect.iTl.iY + linerect.iBr.iY)/2 > Rect().Height()/2) // cursor not fully visible
- {
- TInt offset = edwinpos.iY - capctrlpos.iY + (linerect.iTl.iY + linerect.iBr.iY)/2 - Rect().Height()/2;
- if (topYPosOfControlWhichMustBeViewable + offset + Rect().Height() <= bottomYPosOfControlWhichMustBeViewable)
- {
- topYPosOfControlWhichMustBeViewable += offset;
- bottomYPosOfControlWhichMustBeViewable = topYPosOfControlWhichMustBeViewable + Rect().Height();
- }
- else
- {
- topYPosOfControlWhichMustBeViewable = bottomYPosOfControlWhichMustBeViewable - Rect().Height();
- }
- }
- else
- {
- bottomYPosOfControlWhichMustBeViewable = topYPosOfControlWhichMustBeViewable + Rect().Height();
- }
- }
- }
-
SetDataPosition( topYPosOfControlWhichMustBeViewable, bottomYPosOfControlWhichMustBeViewable, aForceResize );
if ( aLine != iLastExposedLine )
@@ -1423,13 +1326,10 @@
iLastExposedLine = aLine;
iLastExposedLineViewWinYPosition = topYPosOfControlWhichMustBeViewable + idealDataWindowPosition;
}
- _AKNTRACE_FUNC_EXIT;
}
void CEikDialogPage::SetDataPosition( TInt aTopY, TInt aBottomY, TBool aForceResize )
{
- _AKNTRACE_FUNC_ENTER;
- _AKNTRACE( "[%s][%s] aTopY: [%d]", "CEikDialogPage", __FUNCTION__, aTopY );
// update rect only if the currently focused control doesn't fit
if ( iFormControl )
{
@@ -1475,7 +1375,6 @@
iLines->MoveLineToScreen( iCurrentLine, iPhysics->ViewTopY(), ETrue );
}
}
- _AKNTRACE_FUNC_EXIT;
}
/*
@@ -1517,56 +1416,6 @@
void CEikDialogPage::SizeChanged()
{
- _AKNTRACE_FUNC_ENTER;
- if ( IsForm() )
- {
- iExtension->iInitialLayoutDone = EFalse;
-
- iScroll->SetOutsideRect( Rect() );
-
- // force each line to resize
- TInt count = iLines->Count();
-
- for ( TInt i = 0; i < count; ++i )
- {
- (*iLines)[i]->HandleResourceChange( KEikDynamicLayoutVariantSwitch );
- }
-
- iLines->SetRect( Rect(), iScroll->Top(), iScroll->Middle(), iScroll->Bottom() );
- iExtension->iInitialLayoutDone = ETrue;
- UpdatePhysics();
-
- if ( iExtension->iScrolling
- || iExtension->iFlags.IsSet(
- CDialogPageExtension::EDragEventsAllowed ) )
- {
- iPhysics->Stop();
- Synchronize();
- }
-
- if ( count > 0 && iCurrentLine != KErrNotFound )
- {
- if ( iLastExposedLine != -1 )
- {
- iLastExposedLineViewWinYPosition =
- iLines->LineIndexToYPosition( iLastExposedLine, 0 );
- }
-
- ExposeLine( iCurrentLine, ETrue );
-
- if ( Size() != TSize::EUninitialized )
- {
- (*iLines)[iCurrentLine]->DrawDeferred();
- }
- }
-
- TRAP_IGNORE( UpdateScrollBarL() ); // ignore any errors.
- AknsUtils::RegisterControlPosition( this );
-
- _AKNTRACE_FUNC_EXIT;
- return;
- }
-
// update form area's size to scroll control
iScroll->SetOutsideRect( Rect() );
iLines->SetRect( Rect(), iScroll->Top(), iScroll->Middle(), iScroll->Bottom() );
@@ -1579,14 +1428,12 @@
TRAP_IGNORE( UpdateScrollBarL() ); // ignore any errors.
AknsUtils::RegisterControlPosition( this );
+ UpdatePhysics();
iExtension->iInitialLayoutDone = ETrue;
- _AKNTRACE_FUNC_EXIT;
}
TSize CEikDialogPage::MinimumSize()
{
- _AKNTRACE( "[%s][%s] MinimumSize: w = %d, h = %d.",
- "CEikDialogPage", __FUNCTION__, iLines->MinimumSize().iWidth, 0 );
return TSize( iLines->MinimumSize().iWidth, 0 ); // Can be zero height
}
@@ -1641,7 +1488,6 @@
*/
void CEikDialogPage::HandleEdwinEventL(CEikEdwin* aEdwin,TEdwinEvent aEventType)
{
- _AKNTRACE_FUNC_ENTER;
if ( IsForm() && ( aEventType == EEventTextUpdate
|| aEventType == EEventTextUpdateAPI ) )
{
@@ -1661,7 +1507,7 @@
if ( i != iCurrentLine )
{
- DrawDeferred();
+ DrawNow();
}
break;
@@ -1671,17 +1517,13 @@
}
if( iCurrentLine == iLastExposedLine || iCurrentLine == -1 )
- {
- _AKNTRACE_FUNC_EXIT;
return;
- }
if( aEventType == EEventNavigation || aEventType == EEventTextUpdate )
{
ExposeLine( iCurrentLine, EFalse );
UpdateScrollBarL();
}
- _AKNTRACE_FUNC_EXIT;
}
/**
@@ -1689,13 +1531,10 @@
*/
void CEikDialogPage::HandlePopupFieldEventL(CAknPopupField* aPopupField, TAknPopupFieldEvent aEventType, TInt /*aHint*/)
{
- _AKNTRACE_FUNC_ENTER;
switch (aEventType)
{
case EAknPopupFieldEventValueChange:
{
- _AKNTRACE( "[%s][%s][%d] EAknPopupFieldEventValueChange",
- "CEikDialogPage", __FUNCTION__, __LINE__ );
CEikCaptionedControl* line = NULL;
for ( TInt i = 0; i < iLines->Count(); ++i )
{
@@ -1706,7 +1545,7 @@
{
RecordLineL( i );
}
- DrawDeferred();
+ DrawNow();
break;
}
}
@@ -1714,8 +1553,6 @@
}
case EAknPopupFieldEventModeChange:
{
- _AKNTRACE( "[%s][%s][%d] EAknPopupFieldEventModeChange",
- "CEikDialogPage", __FUNCTION__, __LINE__ );
TInt index = iCurrentLine;
if(iIsEditable && (iExtension->iPopFieldEvents != 0))
@@ -1727,8 +1564,8 @@
{
iExtension->iPopFieldEvents = 1;
}
-
- (*iLines)[iCurrentLine]->SetRect( (*iLines)[iCurrentLine]->Rect() );
+
+ ReconsiderPageSize();
ExposeLine( index, ETrue );
DrawNow();
@@ -1739,7 +1576,6 @@
default:
break;
}
- _AKNTRACE_FUNC_EXIT;
}
void CEikDialogPage::PrepareToDrawVerticalLine() const
@@ -1765,14 +1601,19 @@
KAknsIIDQsnFrInput,
KAknsIIDDefault ) ;
}
+
}
+
}
+
}
+void CEikDialogPage::DrawVerticalLine() const
+ {
+ }
void CEikDialogPage::HandleControlEventL(CCoeControl* aControl,TCoeEvent aEventType)
{
- _AKNTRACE_FUNC_ENTER;
switch (aEventType)
{
case EEventPrepareFocusTransition:
@@ -1824,7 +1665,6 @@
default:
break;
}
- _AKNTRACE_FUNC_EXIT;
}
void CEikDialogPage::PassOnEventL(CCoeControl* aControl,MCoeControlObserver::TCoeEvent aEvent)
@@ -1845,7 +1685,7 @@
if (height > maxHeight)
height = maxHeight;
- TSize size( aEdwin->Size() );
+ TSize size = aEdwin->Size();
TInt maximumEdwinHeight = aEdwin->MaximumHeight();
// ensure maxheight as dynamic construction may be done whilst form is of zero height.
if ((maximumEdwinHeight > maxHeight) && maxHeight)
@@ -1858,19 +1698,9 @@
size.iHeight = height;
// Must force a size change on current captioned contrl even if control doesn't change size (so that edwin is resized by aknutils)
- aEdwin->SetSize(size);
-
- if ( IsForm() )
- {
- (*iLines)[iCurrentLine]->SetRect( (*iLines)[iCurrentLine]->Rect() );
- ExposeLine( iCurrentLine, ETrue );
- }
- else
- {
- ReconsiderPageSize();
- ExposeLine(iCurrentLine, ETrue);
- }
-
+ aEdwin->SetSize(size);
+ ReconsiderPageSize();
+ ExposeLine(iCurrentLine, ETrue);
PrepareToDrawVerticalLine(); // do flushes here.
/* improved redraw code
@@ -1900,9 +1730,56 @@
}
+static TInt CountNumberOfLines_Edwin(CEikEdwin *aEdwin, TRect aRect, TInt numOfLines)
+ {
+ TInt edwinLines = numOfLines;
+ TInt count = 0;
+ for(TInt i=0;i<edwinLines;i++)
+ {
+ TInt scrolledLines = aEdwin->TextLayout()->FirstLineInBand();
+ TInt docPos = aEdwin->TextLayout()->FirstCharOnLine(scrolledLines + i+1);
+ TPoint point;
+ aEdwin->TextLayout()->PosInBand(docPos, point);
+ TInt yPos = point.iY;
+ TRect lineRect;
+ aEdwin->TextLayout()->GetLineRect(yPos, lineRect);
+ lineRect.iTl += aEdwin->Position();
+ lineRect.iBr += aEdwin->Position();
+ if (aRect.Contains(lineRect.iTl) && aRect.Contains(lineRect.iBr))
+ count++;
+ }
+ return count;
+ }
+static TInt CountNumberOfLines_Ctrl(CCoeControl *aControl, TRect aRect)
+ {
+ TRect rect = TRect(aControl->Position(), aControl->Size());
+ TInt count = 0;
+ if (aRect.Contains(rect.iTl) && aRect.Contains(rect.iBr))
+ count ++;
+ return count;
+ }
+
+static TInt CountNumberOfVisibleLines(CEikCaptionedControl *aControl, TRect aClipRect)
+ {
+ TInt count = 0;
+ if (aControl->ControlIsAnEdwin(aControl->iControlType))
+ count += CountNumberOfLines_Edwin((CEikEdwin*)aControl->iControl, aClipRect, aControl->NumberOfLines());
+ else
+ count += CountNumberOfLines_Ctrl(aControl->iControl, aClipRect);
+ count += CountNumberOfLines_Ctrl(aControl->iCaption, aClipRect);
+ return count;
+ }
+
+static TInt NumberOfTextLinesVisible(CEikCapCArray *aLines, TInt aItem, TRect aClipRect)
+ {
+ if (aItem < 0) return 0;
+ CEikCaptionedControl *control = (*aLines)[aItem];
+ return CountNumberOfVisibleLines(control, aClipRect);
+ }
+
+
void CEikDialogPage::HandleScrollEventL(CEikScrollBar* aScrollBar,TEikScrollEvent aEventType)
{
- _AKNTRACE_FUNC_ENTER;
iExtension->iHandlingScrollEvent = ETrue;
switch (aEventType)
@@ -1910,6 +1787,7 @@
case EEikScrollPageUp:
case EEikScrollPageDown:
case EEikScrollThumbDragVert:
+ iExtension->iScrolled = ETrue;
iExtension->iScrolling = ETrue;
iLines->MoveLineToScreen( iCurrentLine, 0, EFalse );
break;
@@ -1935,7 +1813,6 @@
}
iExtension->iHandlingScrollEvent = EFalse;
- _AKNTRACE_FUNC_EXIT;
}
TBool CEikDialogPage::LineHandlerCalled() const
@@ -1952,11 +1829,9 @@
void CEikDialogPage::UpdateScrollBarL()
{
- _AKNTRACE_FUNC_ENTER;
// Only forms in S60 need dialog's scrollbar.
if ( !iFormControl || !iPageContainer->ScrollBar() || iSize.iHeight == 0 || iSize.iWidth == 0 || iExtension->iHandlingScrollEvent )
{
- _AKNTRACE_FUNC_EXIT;
return;
}
@@ -1964,15 +1839,23 @@
if (scrollBar)
{
+ TInt top = iScroll->Top();
+ TInt middle = iScroll->Middle();
+ TInt bottom = iScroll->Bottom();
+ TRect parent( Rect() );
+ TBool topmostPartial = top == -1;
+ iLines->CalcItemIndexes(top, middle, bottom, parent.Size());
+ TInt extraLines = topmostPartial ? NumberOfTextLinesVisible(iLines, top-1, parent) : 0;
+ iExtension->iPreviousThumbPosition = iLines->NumberOfTextLinesBeforeLine( top - extraLines );
+
// Using form layout, since this is used by AknForm only
TAknWindowComponentLayout layout = TAknWindowComponentLayout::Compose(
AknLayoutScalable_Avkon::listscroll_form_pane(),
AknLayoutScalable_Avkon::scroll_pane_cp8());
- //Using Rect() instead of main pane rect for supporting partial input mode.
- //TRect scrollBarParent( MainPane().Size() );
- AknLayoutUtils::LayoutVerticalScrollBar(iPageContainer->ScrollBar(), Rect(), layout.LayoutLine());
-
+ TRect scrollBarParent( MainPane().Size()/*mainPaneRect.Size()*/ );
+
+ AknLayoutUtils::LayoutVerticalScrollBar(iPageContainer->ScrollBar(), scrollBarParent, layout.LayoutLine());
if(!ScbState() && iCurrentLine!=-1 && iCurrentLine < iLines->Count() )
{
CEikCaptionedControl *ctrl = (*iLines)[iCurrentLine];
@@ -1981,23 +1864,19 @@
CAknPopupField::EAknPopupFieldSelectionMode mode = ((CAknPopupField*)ctrl->iControl)->SelectionMode();
if (mode == CAknPopupField::EAknPopupFieldSelectionListMode)
{
- _AKNTRACE_FUNC_EXIT;
return;
}
}
UpdateScrollBarThumb();
}
}
- _AKNTRACE_FUNC_EXIT;
}
void CEikDialogPage::UpdateScrollBarThumb()
{
- _AKNTRACE_FUNC_ENTER;
if ( !iFormControl || !iPageContainer->ScrollBar() || ScbState() )
{
- _AKNTRACE_FUNC_EXIT;
return;
}
@@ -2013,11 +1892,11 @@
vertModel.iThumbSpan = iSize.iHeight - iSize.iHeight % 2;
vertModel.iThumbPosition = Max( iPhysics->ViewTopY(), 0 );
+ iExtension->iPreviousThumbPosition = vertModel.iThumbPosition;
TRAP_IGNORE(scrollBar->SetModelL(&vertModel)); // won't leave now, but can't guarantee forever
iPageContainer->ScrollBar()->Tile(&vertModel);
iPageContainer->ScrollBar()->SetVFocusPosToThumbPos(vertModel.iThumbPosition);
}
- _AKNTRACE_FUNC_EXIT;
}
CCoeControl* CEikDialogPage::ComponentControl(TInt aIndex) const
@@ -2084,7 +1963,6 @@
void CEikDialogPage::ShowFocus(TBool aFocus, TBool aRedraw)
{
- _AKNTRACE_FUNC_ENTER;
if (iCurrentLine>=0)
{
if ( iExtension && iExtension->iUsesSingleClick && aFocus )
@@ -2099,43 +1977,14 @@
else
(*iLines)[iCurrentLine]->DrawDeferred();
}
- _AKNTRACE_FUNC_EXIT;
}
void CEikDialogPage::ChangeFocusTo(TInt aLineIndex)
{
- _AKNTRACE_FUNC_ENTER;
- _AKNTRACE( "CEikDialogPage::ChangeFocusTo() aLineIndex: [%d]", aLineIndex );
TInt oldLine = iCurrentLine;
if (aLineIndex==iCurrentLine)
return;
- // If current line has settingslist open, close it
- CEikCaptionedControl* currentLine = CurrentLine();
- if ( currentLine &&
- currentLine->ControlIsAPopfield( currentLine->ControlType() ) )
- {
- CAknPopupField *field = ( CAknPopupField* )currentLine->iControl;
- if ( field && field->SelectionMode()
- == CAknPopupField::EAknPopupFieldSelectionListMode )
- {
- TRAP_IGNORE( field->CloseSelectionListL() );
- }
- }
- // If new line is edwin, move cursor to the end of the string.
- CEikCaptionedControl* theNewLine = (*iLines)[aLineIndex];
- if ( iExtension->iSetInitialFocusDone
- && IsForm()
- && theNewLine->ControlIsAnEdwin( theNewLine->iControlType )
- && theNewLine->iIsEditable )
- {
- CEikEdwin* edwinPtr = STATIC_CAST( CEikEdwin*, theNewLine->iControl );
- if( edwinPtr->Text() )
- {
- TRAP_IGNORE( edwinPtr->SetCursorPosL( edwinPtr->TextLength(), EFalse ) );
- }
- }
-
ShowFocus( EFalse, EFalse );
iCurrentLine=aLineIndex;
ShowFocus(ETrue, EFalse );
@@ -2143,23 +1992,15 @@
if ( ( oldLine != iCurrentLine && IsForm() ) &&
iExtension->iInitialLayoutDone )
{
- // Set temporarily for EFalse to prevent one extra physics update
- // because of two calls to iLines->MoveLineToScreen
- iExtension->iInitialLayoutDone = EFalse;
-
if ( oldLine != -1 )
{
iLines->MoveLineToScreen( oldLine, 0, EFalse );
- TRAP_IGNORE( RecordLineL( oldLine ) );
+ RecordLineL( oldLine );
}
-
- // set back to correct value
- iExtension->iInitialLayoutDone = ETrue;
-
- TRAP_IGNORE( RecordLineL( iCurrentLine ) );
+
+ RecordLineL( iCurrentLine );
iLines->MoveLineToScreen( iCurrentLine, iPhysics->ViewTopY(), ETrue );
}
- _AKNTRACE_FUNC_EXIT;
}
TInt CEikDialogPage::FindLineIndex(const CCoeControl* aControl) const
@@ -2185,8 +2026,7 @@
*/
void CEikDialogPage::HandleResourceChange(TInt aType)
{
- _AKNTRACE_FUNC_ENTER;
- if ( aType==KEikDynamicLayoutVariantSwitch && !IsForm() )
+ if ( aType==KEikDynamicLayoutVariantSwitch )
{
const TInt numLines=iLines->Count();
for ( TInt i=0; i < numLines; i++ )
@@ -2266,7 +2106,6 @@
break;
}
}
- _AKNTRACE_FUNC_EXIT;
}
CCoeControl* CEikDialogPage::Control(TInt aLineId) const
@@ -2310,13 +2149,11 @@
void CEikDialogPage::FocusChanged(TDrawNow /*aDrawNow*/)
{
- _AKNTRACE_FUNC_ENTER;
if (iCurrentLine>=0 && !IsFocused())
{
CEikCaptionedControl* currentLine=(*iLines)[iCurrentLine];
currentLine->SetCurrent(EFalse);
}
- _AKNTRACE_FUNC_EXIT;
}
void CEikDialogPage::ResetLineMinimumSizes()
@@ -2333,37 +2170,12 @@
Added Enter key as a special case...
*/
-
if ( (iCurrentLine!=-1) && (iCurrentLine < iLines->Count()) )
- {
if ( (*iLines)[iCurrentLine]->OfferHotKeys() ||
(*iLines)[iCurrentLine]->TakesEnterKey() && (aKeyEvent.iCode==EKeyEnter)
- )
- {
- CEikCaptionedControl* currentLine = ( *iLines )[iCurrentLine];
- const TInt controlType( currentLine->iControlType );
-
- if ( currentLine->ControlIsAnEdwin( controlType ) )
- {
- CEikEdwin* edwin = ( CEikEdwin* )currentLine->iControl;
- TBool readOnly = edwin->IsReadOnly();
-
- // The control is an editor which is read-only,
- // such as an on/off control
- if ( readOnly )
- {
- iPageObserver->HandleDialogPageEventL(
- MEikDialogPageObserver::EDialogPageTapped );
- return EKeyWasConsumed;
- }
- }
-
+ )
if (!IsForm()|| iIsEditable)
- {
return (*iLines)[iCurrentLine]->iControl->OfferKeyEventL(aKeyEvent,aType);
- }
- }
- }
return EKeyWasNotConsumed;
}
@@ -2377,18 +2189,14 @@
void CEikDialogPage::SetEditableL( TBool aEditable, TBool /*aActivePage*/ )
{
// Tell each of the controls on the page (which are part of a form) of their editable state.
- _AKNTRACE_FUNC_ENTER;
- _AKNTRACE( "CEikDialogPage::SetEditableL() aEditable: [%d]", aEditable );
+
iIsEditable = aEditable;
- TBool initialLayoutDone = iExtension->iInitialLayoutDone;
- iExtension->iInitialLayoutDone = EFalse;
-
HighlightVisible( aEditable );
- if ( iExtension->iUsesSingleClick && iExtension->iSetInitialFocusDone )
+ if ( iExtension->iUsesSingleClick )
{
- ShowFocus( EFalse, EFalse );
+ ShowFocus( EFalse );
}
const TInt numLines=iLines->Count() ;
@@ -2460,15 +2268,6 @@
{
ExposeLine(iCurrentLine,ETrue);
}
-
- iExtension->iInitialLayoutDone = initialLayoutDone;
-
- if ( IsForm() )
- {
- UpdatePhysics();
- }
-
- _AKNTRACE_FUNC_EXIT;
}
TBool CEikDialogPage::AnythingToDisplay() const
@@ -2496,7 +2295,6 @@
void CEikDialogPage::Draw(const TRect& /*aRect*/) const
{
- _AKNTRACE_FUNC_ENTER;
if ( iFormControl )
{
// added this to see if anything on the page is visible.
@@ -2510,6 +2308,9 @@
// Have to call non const leaving function... Ignore the TRAP as result is cosmetic only.
TRAP_IGNORE( const_cast<CEikDialogPage*>(this)->DrawEmptyListL( windowGcRef ) ) ;
}
+ else
+ DrawVerticalLine();
+
if ( IsForm() )
{
@@ -2537,7 +2338,6 @@
iExtension->iRecordingGc->FlushBuffer( targetRect, lineToSkip );
}
}
- _AKNTRACE_FUNC_EXIT;
}
void CEikDialogPage::AfterAddingNewLinesL(TInt aNewLineAdded)
@@ -2554,14 +2354,9 @@
* #3 call Register component on the line, to set up listeners, etc.
* #4 Set the editable value to whatever the dialog page's editable value is.
*/
- _AKNTRACE_FUNC_ENTER;
- _AKNTRACE( "aNewLineAdded: [%d]", aNewLineAdded );
__ASSERT_DEBUG(iLines && (aNewLineAdded<=iLines->Count()), Panic(EEikDialogPanicErrorDuringAddingLine));
if (aNewLineAdded== -1)
- {
- _AKNTRACE_FUNC_EXIT;
return; // line has not been added yet.
- }
CEikCaptionedControl* lineAdded = iLines->At(aNewLineAdded);
// if aNewLineAdded is zero, then there is no line above, else set value.
CEikCaptionedControl* lineVisuallyAboveAndNumericallyBelow =
@@ -2606,7 +2401,6 @@
if ( IsForm() && iSize.iHeight != 0 && aNewLineAdded != -1 )
iLines->MoveLineToScreen( aNewLineAdded, iPhysics->ViewTopY(), EFalse );
- _AKNTRACE_FUNC_EXIT;
}
TInt CEikDialogPage::GetFormFlags() const
@@ -2669,6 +2463,8 @@
aLine->iIsFormControl = iFormControl ;
if ( iFormFlags )
aLine->SetFormFlags( iFormFlags ) ;
+
+ aLine->GetAknLayoutValuesL() ; // should cause the control to have size.
}
};
@@ -2782,6 +2578,14 @@
return EFalse;
}
+TSize CEikDialogPage::RealDataSize() const
+ {
+ if (iLines)
+ if (iLines->Count()>0)
+ return TRect((*iLines)[0]->Rect().iTl,(*iLines)[iLines->Count()-1]->Rect().iBr).Size();
+ return iSize;
+ }
+
TInt CEikDialogPage::NumberOfLines() const
{
if (iLines)
@@ -2807,10 +2611,8 @@
//
void CEikDialogPage::HandleFormPointerEventL( const TPointerEvent& aPointerEvent )
{
- _AKNTRACE_FUNC_ENTER;
if ( LineHandlerCalled() )
{
- _AKNTRACE_FUNC_EXIT;
return;
}
@@ -2822,7 +2624,6 @@
if ( ( aPointerEvent.iType == TPointerEvent::EButton1Down && touchedLine == KErrNotFound ) || !iPhysics->CanBeStopped() )
{
IgnoreEventsUntilNextPointerUp();
- _AKNTRACE_FUNC_EXIT;
return;
}
@@ -2864,7 +2665,6 @@
if ( aPointerEvent.iType == TPointerEvent::EButton1Down && touchedLine != KErrNotFound )
{
- _AKNTRACE( "TPointerEvent::EButton1Down" );
iExtension->iOldCenterY = iPhysics->ViewCenter().iY;
TInt bottom = iExtension->iOldCenterY + iSize.iHeight - iSize.iHeight / 2;
if ( bottom < 0 )
@@ -2893,18 +2693,11 @@
}
}
iExtension->iScrolling = EFalse;
- iExtension->HandleFormFeedback( *this,
- aPointerEvent,
- touchedLine,
- iCurrentLine );
+ iExtension->HandleFormFeedback( this, aPointerEvent, touchedLine, iCurrentLine );
- iExtension->iWasScrolling = ( iPhysics->OngoingPhysicsAction() !=
- CAknPhysics::EAknPhysicsActionNone );
- if(iExtension->iWasScrolling)
- {
- iPhysics->Stop();
- iExtension->Feedback( *this, ETouchFeedbackList );
- }
+ TBool wasScrolling = ( iPhysics->OngoingPhysicsAction() !=
+ CAknPhysics::EAknPhysicsActionNone );
+ iPhysics->Stop();
iExtension->iLastTouchedLine = touchedLine;
iExtension->iDragStartPosition = aPointerEvent.iPosition;
iExtension->iLastPointerPos = aPointerEvent.iPosition;
@@ -2916,17 +2709,10 @@
if ( iExtension->iUsesSingleClick )
{
- if ( !iExtension->iWasScrolling )
+ if ( !wasScrolling )
{
- if ( iFormFlags & EEikFormDisableHighlightInViewMode )
- {
- HighlightVisible( EFalse );
- }
- else
- {
- HighlightVisible( ETrue );
- HighlightTimerCallBack( this );
- }
+ HighlightVisible( ETrue );
+ HighlightTimerCallBack( this );
}
}
else
@@ -2953,18 +2739,13 @@
}
}
}
-
- iExtension->iFlags.Set( CDialogPageExtension::EDragEventsAllowed );
}
if ( aPointerEvent.iType == TPointerEvent::EDrag )
{
- _AKNTRACE( "TPointerEvent::EDrag" );
TPoint drag( iExtension->iDragStartPosition - aPointerEvent.iPosition );
- if ( Abs( drag.iY ) > iPhysics->DragThreshold()
- && iExtension->iFlags.IsSet(
- CDialogPageExtension::EDragEventsAllowed ) )
+ if ( Abs( drag.iY ) > iPhysics->DragThreshold() )
{
iExtension->iHighlightTimer->Cancel();
@@ -2984,6 +2765,7 @@
}
iExtension->iScrolling = ETrue;
+ iExtension->iScrolled = ETrue;
iExtension->iLastPointerPos = aPointerEvent.iPosition;
RemovePressedDownHighlight();
iLines->MoveLineToScreen( iCurrentLine, 0, EFalse );
@@ -3008,11 +2790,7 @@
if ( aPointerEvent.iType == TPointerEvent::EButton1Up )
{
- _AKNTRACE( "TPointerEvent::EButton1Up" );
- iExtension->HandleFormFeedback( *this,
- aPointerEvent,
- touchedLine,
- iCurrentLine );
+ iExtension->HandleFormFeedback( this, aPointerEvent, touchedLine, iCurrentLine );
if ( !IsEditable() && iExtension->iUsesSingleClick &&
HighlightVisible() )
{
@@ -3030,14 +2808,11 @@
if ( !textSelected )
{
- if ( !iExtension->iFlags.IsSet( CDialogPageExtension::EDragEventsAllowed )
- || !iPhysics->StartFlick( drag, iExtension->iStartTime ) )
+ if ( !iPhysics->StartFlick( drag, iExtension->iStartTime ) )
{
iExtension->iScrolling = EFalse;
- if ( iPageObserver && GrabbingComponent()
- && !iExtension->iWasScrolling
- && touchedLine == iCurrentLine )
+ if ( iPageObserver && GrabbingComponent() )
{
iPageObserver->HandleDialogPageEventL( MEikDialogPageObserver::EDialogPageTapped );
}
@@ -3050,21 +2825,17 @@
{
// feedback is given every time when new item
// appears to the screen -> follows the visual feedback
- iExtension->SilentFeedback( *this,
- ETouchFeedbackSensitiveList,
- aPointerEvent );
-
+ iExtension->SilentFeedback( this, ETouchFeedbackSensitiveItem, aPointerEvent );
// It might happen that there are no drag events between down and
// up if the distance is short enough.
iExtension->iHighlightTimer->Cancel();
iExtension->iScrolling = ETrue;
+ iExtension->iScrolled = ETrue;
iLines->MoveLineToScreen( iCurrentLine, 0, EFalse );
RemovePressedDownHighlight();
}
}
}
-
- iExtension->iFlags.Clear( CDialogPageExtension::EDragEventsAllowed );
}
// forward pointer event to line's observer
@@ -3092,12 +2863,12 @@
( iExtension->iFocusedClicked || iExtension->iUsesSingleClick ) &&
!iExtension->iScrolling )
{
- mskPress = ETrue;
+ mskPress = ETrue;
callDefaultImplementation = EFalse;
}
+
if ( callDefaultImplementation && ( iExtension->iFocusedClicked ||
- iExtension->iUsesSingleClick ) && newLine &&
- !iExtension->iWasScrolling )
+ iExtension->iUsesSingleClick ) && newLine )
{
if ( newLine->ControlIsAPopfield( controlType ) )
{
@@ -3121,11 +2892,10 @@
{
TKeyEvent key;
key.iCode=EKeyOK;
- key.iModifiers=EModifierSpecial;
+ key.iModifiers=0;
key.iRepeats = 0;
- iEikonEnv->SimulateKeyEventL( key, EEventKey );
+ CEikonEnv::Static()->SimulateKeyEventL( key, EEventKey );
}
- _AKNTRACE_FUNC_EXIT;
}
@@ -3135,7 +2905,6 @@
//
void CEikDialogPage::UpdatePhysics()
{
- _AKNTRACE_FUNC_ENTER;
if ( IsForm() )
{
TPoint viewCenter( iSize.iWidth / 2, 0 );
@@ -3145,13 +2914,13 @@
viewCenter.iY = Abs( (*iLines)[0]->Rect().iTl.iY - iPosition.iY );
}
- TInt viewCenterDistance = iPhysics->ViewCenterDistance();
- viewCenter.iY += viewCenterDistance;
+ viewCenter.iY += iPhysics->ViewCenterDistance();
if ( iExtension->iInitialLayoutDone )
{
TInt oldScreenHeight = iPhysics->ViewSize().iHeight;
- TInt delta = ( viewCenterDistance ) - ( oldScreenHeight / 2 );
+ TInt delta = ( iPhysics->ViewCenterDistance() ) -
+ ( oldScreenHeight / 2 );
viewCenter = iPhysics->ViewCenter();
viewCenter.iY += delta;
@@ -3160,20 +2929,9 @@
TSize worldSize( iLines->MinimumSize() );
worldSize.iHeight = Max( worldSize.iHeight, iSize.iHeight );
- // align to borders if those are crossed
- if ( viewCenter.iY < viewCenterDistance )
- {
- viewCenter.iY = viewCenterDistance;
- }
- else if ( viewCenter.iY > ( worldSize.iHeight - viewCenterDistance ) )
- {
- viewCenter.iY = worldSize.iHeight - viewCenterDistance;
- }
-
TRAP_IGNORE( iPhysics->InitPhysicsL( worldSize, iSize, viewCenter ) );
TRAP_IGNORE( UpdateScrollBarL() );
}
- _AKNTRACE_FUNC_EXIT;
}
@@ -3206,10 +2964,9 @@
if ( LineIsFocusable( touchedLine ) )
{
- TRAP_IGNORE( PrepareForFocusTransitionL();
- ChangeFocusToAndExposeL( touchedLine );
- LineChangedL( (*iLines)[touchedLine]->iId );
- );
+ TRAP_IGNORE( PrepareForFocusTransitionL() );
+ ChangeFocusToAndExposeL( touchedLine );
+ LineChangedL( (*iLines)[touchedLine]->iId );
}
}
}
@@ -3236,7 +2993,7 @@
// ---------------------------------------------------------------------------
//
void CEikDialogPage::ScrollCacheByPixels(
- TInt /*aDelta*/, TBool aDrawNow )
+ TInt /*aDelta*/, const TDesC& /*aDebugMsg*/, TBool aDrawNow )
{
if ( iLines->Count() <= 0 )
return;
@@ -3271,34 +3028,14 @@
{
if ( upperItem != iExtension->iTopItem || bottomItem != iExtension->iBottomItem )
{
- switch(iPhysics->OngoingPhysicsAction())
- {
- case CAknPhysics::EAknPhysicsActionBouncing:
- case CAknPhysics::EAknPhysicsActionDragging:
- case CAknPhysics::EAknPhysicsActionFlicking:
- iExtension->SilentFeedback( *this,
- ETouchFeedbackSensitiveList, TPointerEvent() );
- break;
- default:
- break;
- }
+ iExtension->SilentFeedback( this, ETouchFeedbackSensitiveItem, TPointerEvent() );
}
}
else if ( upperItem >= 0 || bottomItem < iLines->Count() )
{
if ( upperItem < iExtension->iTopItem || bottomItem > iExtension->iBottomItem )
{
- switch(iPhysics->OngoingPhysicsAction())
- {
- case CAknPhysics::EAknPhysicsActionBouncing:
- case CAknPhysics::EAknPhysicsActionDragging:
- case CAknPhysics::EAknPhysicsActionFlicking:
- iExtension->SilentFeedback( *this,
- ETouchFeedbackSensitiveList, TPointerEvent() );
- break;
- default:
- break;
- }
+ iExtension->SilentFeedback( this, ETouchFeedbackSensitiveItem, TPointerEvent() );
}
}
iExtension->iBottomItem = bottomItem;
@@ -3317,14 +3054,6 @@
//
void CEikDialogPage::UpdateLineInCache( CEikCaptionedControl* aLine )
{
- _AKNTRACE_FUNC_ENTER;
-
- if ( !IsActivated() )
- {
- _AKNTRACE_FUNC_EXIT;
- return;
- }
-
TInt lineIndex = iLines->FindLineIndex( aLine );
if ( lineIndex != KErrNotFound )
@@ -3351,7 +3080,6 @@
{
UpdatePhysics();
}
- _AKNTRACE_FUNC_EXIT;
}
@@ -3362,7 +3090,6 @@
void CEikDialogPage::Synchronize()
{
iExtension->iScrolling = EFalse;
- iExtension->iFlags.Clear( CDialogPageExtension::EDragEventsAllowed );
iLines->MoveLineToScreen( iCurrentLine, iPhysics->ViewTopY(), ETrue );
}
@@ -3400,7 +3127,6 @@
//
void CEikDialogPage::RecordLinesL()
{
- _AKNTRACE_FUNC_ENTER;
Parent()->Parent()->Parent()->SetCustomGc( iExtension->iRecordingGc );
iExtension->iRecordingGc->PurgeBuffer();
@@ -3416,7 +3142,6 @@
}
Parent()->Parent()->Parent()->SetCustomGc( NULL );
- _AKNTRACE_FUNC_EXIT;
}
@@ -3426,8 +3151,6 @@
//
void CEikDialogPage::RecordLineL( TInt aLine )
{
- _AKNTRACE_FUNC_ENTER;
- _AKNTRACE( "CEikDialogPage::RecordLineL() aLine: [%d]", aLine );
Parent()->Parent()->Parent()->SetCustomGc( iExtension->iRecordingGc );
CEikCaptionedControl* line = (*iLines)[aLine];
@@ -3440,7 +3163,22 @@
}
Parent()->Parent()->Parent()->SetCustomGc( NULL );
- _AKNTRACE_FUNC_EXIT;
+ }
+
+
+// ---------------------------------------------------------------------------
+// CEikDialogPage::ScrollByPixels
+// ---------------------------------------------------------------------------
+//
+void CEikDialogPage::ScrollByPixels( TInt aDelta )
+ {
+ if ( aDelta != 0 )
+ {
+ iLines->ScrollByPixels( aDelta );
+ TRAP_IGNORE( UpdateScrollBarL() );
+ DrawNow();
+ TRAP_IGNORE( RecordLinesL() );
+ }
}
@@ -3459,7 +3197,7 @@
currentLine->SetPressedDownState( EFalse );
if ( IsForm() )
{
- TRAP_IGNORE( RecordLineL( iCurrentLine ) );
+ RecordLineL( iCurrentLine );
}
}
}
@@ -3544,10 +3282,12 @@
CCoeControl* grabbingComponent = GrabbingComponent();
TBool callDefaultImplementation = ETrue;
TBool focusItem = EFalse;
- TInt touchedLineIndex = iLines->YPositionToLineIndex( aPointerEvent.iPosition.iY );
-
+ // YPosToLine is scaled to iDataWinPos, so add it to pointer Y position
+ TInt yPosition = aPointerEvent.iPosition.iY; // + iDataWinPos.iY;
+ TInt touchedLineIndex = YPosToLine2( yPosition );
// If the stylus is down and the touched line is already the current one,
// mark this fact in iExtension->iFocusedClicked to be used later when the stylus is up.
+
if ( touchedLineIndex != KErrNotFound &&
iExtension->iCapturingItem != KErrNotFound &&
touchedLineIndex != iExtension->iCapturingItem )
@@ -3731,19 +3471,16 @@
clear = ETrue;
}
- if ( focusItem || iExtension->iFocusedClicked )
+ if ( focusItem || iExtension->iFocusedClicked)
{
- iExtension->HandleFormFeedback( *this,
- aPointerEvent,
- touchedLineIndex,
- iCurrentLine );
+ iExtension->HandleFormFeedback( this, aPointerEvent, touchedLineIndex, iCurrentLine );
}
if ( focusItem )
{
PrepareForFocusTransitionL();
- (*iLines)[iCurrentLine]->ScrollBackEditorL();
+ (*iLines)[iCurrentLine]->ScrollBackEditor();
ShowFocus( EFalse, EFalse );
iCurrentLine = touchedLineIndex;
ShowFocus( ETrue, EFalse );
@@ -3762,7 +3499,7 @@
key.iCode=EKeyOK;
key.iModifiers=0;
key.iRepeats = 0;
- iEikonEnv->SimulateKeyEventL(key, EEventKey);
+ CEikonEnv::Static()->SimulateKeyEventL(key, EEventKey);
// SimulateKeyEventL has to be last, because it can
// possibly delete the dialog.. Must not do anything
// to the dialog after the call.
@@ -3907,7 +3644,6 @@
TInt CEikDialogPageContainer::ActivateFirstPageL()
{
- _AKNTRACE_FUNC_ENTER;
// Activate first page that isn't dimmed.
// SetToolTips() ;
const TInt numPages=iPageArray->Count();
@@ -3924,7 +3660,6 @@
thisPage->ReportPageChangedL();
iActivePage=ii;
}
- _AKNTRACE_FUNC_EXIT;
return thisPage->PageId();
}
}
@@ -3939,7 +3674,6 @@
firstPage->ReportPageChangedL();
iActivePage=0;
}
- _AKNTRACE_FUNC_EXIT;
return firstPage->PageId();
}
@@ -4278,7 +4012,6 @@
void CEikDialogPageContainer::ActivateL()
{
- _AKNTRACE_FUNC_ENTER;
// Pass the activate event to child controls always.
CCoeControl::ActivateL();
//
@@ -4306,7 +4039,6 @@
}
}
}
- _AKNTRACE_FUNC_EXIT;
}
void CEikDialogPageContainer::FocusChanged(TDrawNow aDrawNow)
@@ -4417,9 +4149,7 @@
CCoeControl::HandleResourceChange(aType);
- // if this is a form then its size has been set already by
- // CEikDialog::HandleResourceChange
- if ( aType == KEikDynamicLayoutVariantSwitch && !iForm )
+ if(aType==KEikDynamicLayoutVariantSwitch)
{
SizeChanged();
}
@@ -4442,15 +4172,32 @@
iPageSelector = aPageSelector;
}
-void CEikDialogPageContainer::SetPageFormSized(const TRect& aRect)
+void CEikDialogPageContainer::SetPageFormSized()
{
iForm = ETrue;
//
// Form layout
- //
+ //
+
+ /** Dialog page container and page have the same size */
+ TRect mainPaneRect;
+ AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, mainPaneRect );
+ mainPaneRect = TRect( mainPaneRect.Size() ); // Moving to point (0, 0)
+ TAknLayoutRect formPaneLt;
+ formPaneLt.LayoutRect( mainPaneRect, AknLayoutScalable_Avkon::listscroll_form_pane().LayoutLine() );
+ formPaneLt.LayoutRect( formPaneLt.Rect(), AknLayoutScalable_Avkon::list_form_gen_pane().LayoutLine() );
- SetRect(aRect);
+ //
+ // End of form layout
+ //
+
+ if ( formPaneLt.Rect() != Rect() )
+ {
+ // TODO: use static method to do variation between traditional scrolling and panning when available
+ //SetRect( formPaneLt.Rect() );
+ SetRect( mainPaneRect );
+ }
/** Only forms have line highlight animations. Animation creation is delayed
* here.