#include "FUiCtrl_Form.h"
#include "FUiCtrl_Frame.h"
#include "FUi_EcoreEvas.h"
+#include "FUi_Math.h"
#include "FUi_Window.h"
#define EDIT_COPY_PASTE_MAGNIFIER 0
}
bool
-_EditCopyPasteManager::CheckHandleBounds(const Point& point)
-{
- bool hasCommandButton = false;
- bool hasParentForm = false;
- bool hasParentPanel = false;
- bool showCheck = true;
- Rectangle commandButtonBounds(0, 0, 0, 0);
- Rectangle formClientBounds(0, 0, 0, 0);
- Rectangle panelAbsoulteBounds(0, 0, 0, 0);
- Rectangle editAbsBounds = __pEdit->GetAbsoluteBounds();
- Rectangle textObjectBounds = __pEditPresenter->GetTextBounds();
- editAbsBounds.x += textObjectBounds.x;
- editAbsBounds.y += textObjectBounds.y;
- editAbsBounds.width = textObjectBounds.width;
-
- if (!(__pEdit->GetEditStyle() & EDIT_STYLE_SINGLE_LINE))
- {
- editAbsBounds.height = textObjectBounds.height;
- }
-
- _Toolbar* pCommandButton = __pEditPresenter->GetKeypadCommandButton();
- if (pCommandButton)
- {
- commandButtonBounds = pCommandButton->GetAbsoluteBounds();
- hasCommandButton = true;
- }
- _Form* pForm = __pEditPresenter->GetParentForm();
- if (pForm)
- {
- formClientBounds = pForm->GetClientBounds();
- hasParentForm = true;
- }
-
- _ScrollPanel* pPanel = __pEditPresenter->GetParentPanel();
- if (pPanel)
- {
- panelAbsoulteBounds = pPanel->GetAbsoluteBounds();
- hasParentPanel = true;
- }
-
- if (editAbsBounds.x > point.x || point.x > (editAbsBounds.x + editAbsBounds.width))
- {
- showCheck = false;
- }
-
- if (editAbsBounds.y > point.y || point.y > (editAbsBounds.y + editAbsBounds.height))
- {
- showCheck = false;
- }
- if (hasParentForm && (formClientBounds.y > point.y || point.y > (formClientBounds.y + formClientBounds.height)))
- {
- showCheck = false;
- }
- if (hasParentPanel && (panelAbsoulteBounds.y > point.y || point.y > (panelAbsoulteBounds.y + panelAbsoulteBounds.height)))
- {
- showCheck = false;
- }
- if (hasCommandButton && commandButtonBounds.Contains(point))
- {
- showCheck = false;
- }
- return showCheck;
-}
-
-bool
_EditCopyPasteManager::CheckHandleBounds(const FloatPoint& point)
{
bool hasCommandButton = false;
hasParentPanel = true;
}
- if (editAbsBounds.x > point.x || point.x > (editAbsBounds.x + editAbsBounds.width))
+ if ((!_FloatCompare(editAbsBounds.x, point.x) && (editAbsBounds.x > point.x)) || (!_FloatCompare(point.x, editAbsBounds.x + editAbsBounds.width) && point.x > (editAbsBounds.x + editAbsBounds.width)))
{
showCheck = false;
}
- if (editAbsBounds.y > point.y || point.y > (editAbsBounds.y + editAbsBounds.height))
+ if ((!_FloatCompare(editAbsBounds.y, point.y) && (editAbsBounds.y > point.y)) || (!_FloatCompare(point.y, editAbsBounds.y + editAbsBounds.height) && point.y > (editAbsBounds.y + editAbsBounds.height)))
{
showCheck = false;
}
- if (hasParentForm && (formClientBounds.y > point.y || point.y > (formClientBounds.y + formClientBounds.height)))
+ if (hasParentForm && ((!_FloatCompare(formClientBounds.y, point.y) && formClientBounds.y > point.y) || (!_FloatCompare(point.y, formClientBounds.y + formClientBounds.height) && point.y > (formClientBounds.y + formClientBounds.height))))
{
showCheck = false;
}
- if (hasParentPanel && (panelAbsoulteBounds.y > point.y || point.y > (panelAbsoulteBounds.y + panelAbsoulteBounds.height)))
+ if (hasParentPanel && ((!_FloatCompare(panelAbsoulteBounds.y, point.y) && panelAbsoulteBounds.y > point.y) || (!_FloatCompare(point.y, panelAbsoulteBounds.y + panelAbsoulteBounds.height) && point.y > (panelAbsoulteBounds.y + panelAbsoulteBounds.height))))
{
showCheck = false;
}
return r;
}
-/*
-result
-_EditPresenter::UpdateComponentInformation(void)
-{
- result r = E_SUCCESS;
-
- if (__isCursorChanged == false)
- {
- return r;
- }
-
- bool setFirstDisplayLine = true;
- if (!((__pEdit->GetEditStyle() & EDIT_STYLE_SINGLE_LINE) || (__pEdit->GetEditStyle() & EDIT_STYLE_TOKEN)))
- {
- int firstDisplayY = __pTextObject->GetFirstDisplayPositionY();
- int totalHeight = __pTextObject->GetTotalHeight();
- Rectangle displayBounds = __pTextObject->GetBounds();
- if (totalHeight >= displayBounds.height)
- {
- int textGapFromBottom = displayBounds.height - (totalHeight - firstDisplayY);
- if (textGapFromBottom > 0)
- {
- ScrollText(_CoordinateSystemUtils::ConvertToFloat(-textGapFromBottom));
- }
- }
-
- Rectangle absCursorBounds(0, 0, 0, 0);
- CalculateAbsoluteCursorBounds(__cursorPos, absCursorBounds);
- FloatRectangle floatAbsCursorBounds = _CoordinateSystemUtils::ConvertToFloat(absCursorBounds);
- setFirstDisplayLine = (IsContained(floatAbsCursorBounds) == false);
- }
-
- if (setFirstDisplayLine)
- {
- if (__pTextObject->IsChanged())
- {
- __pTextObject->Compose();
- }
- __pTextObject->SetFirstDisplayLineIndexFromTextIndex(__cursorPos);
- }
-
- __pTextObject->SetCursorIndex(__cursorPos);
-
- __isCursorChanged = false;
-
- return r;
-}
-*/
-
void
_EditPresenter::ScrollText(float distance)
{
if (upSideGap > 0.0f || downSideGap > 0.0f)
{
float gap = 0.0f;
- float GAP_CORRECTION = __verticalMargin / 2.0f;
+ float topTextMargin = __textObjectBounds.y;
+ float bottomTextMargin = __pEdit->GetBoundsF().height - __textObjectBounds.y - __textObjectBounds.height;
if (upSideGap > 0.0f)
{
- gap = scrollPosition - (upSideGap + GAP_CORRECTION);
+ gap = scrollPosition - (upSideGap + topTextMargin);
}
else
{
- gap = scrollPosition + (downSideGap + GAP_CORRECTION);
+ gap = scrollPosition + (downSideGap + bottomTextMargin);
}
__pParentPanel->SetScrollPosition(gap);