524 |
524 |
525 DEBUG("CMIDTextEditor::SetPosition -"); |
525 DEBUG("CMIDTextEditor::SetPosition -"); |
526 } |
526 } |
527 |
527 |
528 // --------------------------------------------------------------------------- |
528 // --------------------------------------------------------------------------- |
529 // CMIDTextEditor::SetCaretXY |
529 // CMIDTextEditor::SetCaretXYL |
530 // (other items are commented in the header file) |
530 // (other items are commented in the header file) |
531 // --------------------------------------------------------------------------- |
531 // --------------------------------------------------------------------------- |
532 // |
532 // |
533 void CMIDTextEditor::SetCaretXYL(TInt aX, TInt aY) |
533 void CMIDTextEditor::SetCaretXYL(TInt aX, TInt aY) |
534 { |
534 { |
535 DEBUG_INT2("CMIDTextEditor::SetCaretXY +, aX=%d, aY=%d", aX, aY); |
535 DEBUG_INT2("CMIDTextEditor::SetCaretXYL +, aX=%d, aY=%d", aX, aY); |
536 |
536 |
537 // Requested point should be already recalculated to be relative |
537 // Requested point should be already recalculated to be relative |
538 // to editor position on canvas. |
538 // to editor position on canvas. |
539 TPoint pos(aX, aY); |
539 TPoint pos(aX, aY); |
540 // If position will be found in formatted text, posInfo will be filled |
540 // If position will be found in formatted text, posInfo will be filled |
541 // with desired informations. |
541 // with desired informations. |
542 TTmPosInfo2 posInfo; |
542 TTmPosInfo2 posInfo; |
543 |
543 |
544 if (iTextEdwin->TextLayout()->FindXyPos(pos, posInfo)) |
544 if (iTextEdwin->TextLayout()->FindXyPos(pos, posInfo)) |
545 { |
545 { |
546 // Position was found. Try to set cursor to found position. |
546 // Position was found. Try to set cursor to found position. |
547 iTextEdwin->SetCursorPosL(posInfo.iDocPos.iPos, EFalse); |
547 iTextEdwin->SetCursorPosL(posInfo.iDocPos.iPos, EFalse); |
548 } |
548 } |
549 |
549 |
550 DEBUG("CMIDTextEditor::SetCaretXY -"); |
550 DEBUG("CMIDTextEditor::SetCaretXYL -"); |
551 } |
551 } |
552 |
552 |
553 // --------------------------------------------------------------------------- |
553 // --------------------------------------------------------------------------- |
554 // CMIDTextEditor::SetFocusStateL |
554 // CMIDTextEditor::SetFocusStateL |
555 // (other items are commented in the header file) |
555 // (other items are commented in the header file) |
580 DEBUG("CMIDTextEditor::SetFocusStateL, hiding cursor"); |
580 DEBUG("CMIDTextEditor::SetFocusStateL, hiding cursor"); |
581 |
581 |
582 iTextEdwin->SetCursorVisible(EFalse); |
582 iTextEdwin->SetCursorVisible(EFalse); |
583 } |
583 } |
584 else if (iEditingStateIndicator->EnabledState() == |
584 else if (iEditingStateIndicator->EnabledState() == |
585 CMIDEditingStateIndicator::EIndicatorStateRelative) |
585 CMIDEditingStateIndicator::EIndicatorStateRelative) |
586 { |
586 { |
587 // Enable the custom indicators as in Avkon if not controlled |
587 // Enable the custom indicators as in Avkon if not controlled |
588 // by the client application |
588 // by the client application |
589 iEditingStateIndicator->MakeVisible(ETrue); |
589 iEditingStateIndicator->MakeVisible(ETrue); |
590 } |
590 } |
1074 |
1074 |
1075 // Do nothing if the editor state is equal to the requested state or |
1075 // Do nothing if the editor state is equal to the requested state or |
1076 // if the constraint modifier PASSWORD is set. Passwords are single |
1076 // if the constraint modifier PASSWORD is set. Passwords are single |
1077 // line editors due to CMIDEdwinUtils::CPasswordText implementation. |
1077 // line editors due to CMIDEdwinUtils::CPasswordText implementation. |
1078 if (aMultiline == iTextEdwin->IsWrapEnabled() || |
1078 if (aMultiline == iTextEdwin->IsWrapEnabled() || |
1079 iConstraints & MMIDTextField::EPassword) |
1079 iConstraints & MMIDTextField::EPassword) |
1080 { |
1080 { |
1081 DEBUG("CMIDTextEditor::SetMultilineL -, ignoring request"); |
1081 DEBUG("CMIDTextEditor::SetMultilineL -, ignoring request"); |
1082 |
1082 |
1083 return; |
1083 return; |
1084 } |
1084 } |
1101 // Apply wrap on. |
1101 // Apply wrap on. |
1102 iTextEdwin->SetWordWrapL(aMultiline); |
1102 iTextEdwin->SetWordWrapL(aMultiline); |
1103 // Text has been changed so inform the editor window that |
1103 // Text has been changed so inform the editor window that |
1104 // it needs to redraw itself again. |
1104 // it needs to redraw itself again. |
1105 iTextEdwin->HandleTextChangedL(); |
1105 iTextEdwin->HandleTextChangedL(); |
|
1106 // Cursor position handling is done in CMIDTextEditorEdwin |
|
1107 iTextEdwin->SetCursorPosL(iTextEdwin->CursorPos(), EFalse); |
1106 |
1108 |
1107 DEBUG("CMIDTextEditor::SetMultilineL -"); |
1109 DEBUG("CMIDTextEditor::SetMultilineL -"); |
1108 } |
1110 } |
1109 |
1111 |
1110 // --------------------------------------------------------------------------- |
1112 // --------------------------------------------------------------------------- |
1384 // AND the SetEditorSize method has not been called directly yet. |
1386 // AND the SetEditorSize method has not been called directly yet. |
1385 if (iRowCountActive) |
1387 if (iRowCountActive) |
1386 { |
1388 { |
1387 TSize size = EditorSize(); |
1389 TSize size = EditorSize(); |
1388 TInt newEditorWindowHeight = iTextEdwin->EditorWindowHeight(); |
1390 TInt newEditorWindowHeight = iTextEdwin->EditorWindowHeight(); |
1389 |
|
1390 if (size.iHeight != newEditorWindowHeight) |
1391 if (size.iHeight != newEditorWindowHeight) |
1391 { |
1392 { |
1392 SetEditorSize(size.iWidth, newEditorWindowHeight); |
1393 SetEditorSize(size.iWidth, newEditorWindowHeight); |
1393 } |
1394 } |
1394 // SetEditorSize method resets the flag, make sure it remains true |
1395 // SetEditorSize method resets the flag, make sure it remains true |
1927 TInt x = editorPos.iX + editorSize.iWidth - indicatorSize.iWidth; |
1928 TInt x = editorPos.iX + editorSize.iWidth - indicatorSize.iWidth; |
1928 TInt y = editorPos.iY - indicatorSize.iHeight; |
1929 TInt y = editorPos.iY - indicatorSize.iHeight; |
1929 |
1930 |
1930 DEBUG_INT2( |
1931 DEBUG_INT2( |
1931 "CMIDTextEditor::UpdateIndicatorPosition, indicatorPos.X=%d, \ |
1932 "CMIDTextEditor::UpdateIndicatorPosition, indicatorPos.X=%d, \ |
1932 indicatorPos.Y=%d", x, y); |
1933 indicatorPos.Y=%d", x, y); |
1933 |
1934 |
1934 iEditingStateIndicator->SetPosition(x, y); |
1935 iEditingStateIndicator->SetPosition(x, y); |
1935 |
1936 |
1936 // Update the indicator. |
1937 // Update the indicator. |
1937 if (iTextEdwin->IsVisible() && iTextEdwin->IsFocused()) |
1938 if (iTextEdwin->IsVisible() && iTextEdwin->IsFocused()) |