Change background image of magnifier
authorbunam.jeon <bunam.jeon@samsung.com>
Wed, 10 Apr 2013 12:43:37 +0000 (21:43 +0900)
committerbunam.jeon <bunam.jeon@samsung.com>
Wed, 10 Apr 2013 12:47:55 +0000 (21:47 +0900)
[Title] Change background image of magnifier
[Issue#] N/A
[Problem] N/A
[Cause] N/A
[Solution] Change background image of magnifier

Change-Id: I18589d64439969529817340b5e68bc8fbffddeb9

Source/WebKit2/PlatformTizen.cmake
Source/WebKit2/UIProcess/API/efl/tizen/Magnifier.edc
Source/WebKit2/UIProcess/API/efl/tizen/TextSelectionMagnifier.cpp
Source/WebKit2/UIProcess/API/efl/tizen/TextSelectionMagnifier.h
Source/WebKit2/UIProcess/API/efl/tizen/images/magnifier.png [deleted file]
Source/WebKit2/UIProcess/API/efl/tizen/images/magnifier_left.png [new file with mode: 0644]
Source/WebKit2/UIProcess/API/efl/tizen/images/magnifier_middle.png [new file with mode: 0644]
Source/WebKit2/UIProcess/API/efl/tizen/images/magnifier_right.png [new file with mode: 0644]

index 69a33e4..c3b86a6 100755 (executable)
@@ -318,9 +318,3 @@ IF (ENABLE_TIZEN_SCREEN_READER)
     ADD_DEFINITIONS(-DSCREEN_READER_FOCUS_RING_IMAGE_PATH="${SCREEN_READER_FOCUS_RING_IMAGE_PATH}/screenReaderFocusRing.png")
     INSTALL(FILES ${WEBKIT2_DIR}/UIProcess/API/efl/tizen/images/screenReaderFocusRing.png DESTINATION ${SCREEN_READER_FOCUS_RING_IMAGE_PATH})
 ENDIF ()
-
-IF (ENABLE_TIZEN_WEBKIT2_TEXT_SELECTION)
-    SET(MAGNIFIER_IMAGE_PATH ${CMAKE_INSTALL_PREFIX}/share/${WebKit2_LIBRARY_NAME}-${PROJECT_VERSION_MAJOR}/images)
-    ADD_DEFINITIONS(-DMAGNIFIER_IMAGE_PATH="${MAGNIFIER_IMAGE_PATH}/magnifier.png")
-    INSTALL(FILES ${WEBKIT2_DIR}/UIProcess/API/efl/tizen/images/magnifier.png DESTINATION ${MAGNIFIER_IMAGE_PATH})
-ENDIF ()
index 30fa51c..78f7fd0 100755 (executable)
@@ -2,43 +2,101 @@ collections {
 group {
         name: "magnifier";
         images {
-            image: "magnifier.png" COMP;
+            image: "magnifier_left.png" COMP;
+            image: "magnifier_middle.png" COMP;
+            image: "magnifier_right.png" COMP;
         }
         parts {
             part {
-                name: "magnifier_bg";
-                type: SWALLOW;
-                scale : 1;
+                name: "bg";
+                mouse_events: 0;
+                scale: 1;
+                type: RECT;
                 description {
                     state: "default" 0.0;
+                    fixed: 1 1;
+                    min: 352 177;
+                    align: 0.5 0.0;
                     visible: 1;
-                    align: 0.5 0.5;
-                    min: 340 180;
-                    rel1 { relative: 0.0 0.0; }
-                    rel2 { relative: 1.0 1.0; }
+                    color: 0 0 0 0;
+                }
+            }
+            part {
+                name: "bg_left";
+                mouse_events: 0;
+                scale: 1;
+                description {
+                    state: "default" 0.0;
+                    fixed: 1 1;
+                    min: 146 177;
+                    align: 0.0 0.0;
+                    rel1 { relative: 0.0 0.0; to: "bg"; }
+                    rel2 { relative: 0.5 1.0; to: "bg"; offset: -20 -1;}
+                    image {
+                        normal: "magnifier_left.png";
+                        border: 21 1 20 44;
+                    }
+                    image.middle: 1;
+                    fill.smooth: 0;
+                }
+            }
+            part {
+                name: "bg_middle";
+                mouse_events: 0;
+                scale: 1;
+                description {
+                    state: "default" 0.0;
+                    fixed: 1 1;
+                    min: 40 177;
+                    max: 40 999999;
+                    align: 0.0 0.0;
+                    rel1 { relative: 1.0 0.0; to: "bg_left"; }
+                    rel2 { relative: 0.0 1.0; to: "bg_right"; }
+                    image {
+                        normal: "magnifier_middle.png";
+                        border: 0 40 20 44;
+                    }
+                    image.middle: 1;
+                    fill.smooth: 0;
+                }
+            }
+            part {
+                name: "bg_right";
+                mouse_events: 0;
+                scale: 1;
+                description {
+                    state: "default" 0.0;
+                    fixed: 1 1;
+                    min: 146 177;
+                    rel1 { relative: 0.5 0.0; to: "bg"; offset: 21 0;}
+                    rel2.to: "bg";
+                    image {
+                        normal: "magnifier_right.png";
+                        border: 1 21 20 44;
+                    }
+                    image.middle: 1;
+                    fill.smooth: 0;
                 }
             }
             part {
-                name: "magnifier_frame";
+                name: "swallow";
                 type: SWALLOW;
-                scale : 1;
+                mouse_events: 0;
+                scale: 1;
                 description {
                     state: "default" 0.0;
-                    align: 0.5 0.5;
-                    min: 300 100;
-                    visible: 1;
+                    fixed: 1 1;
+                    align: 0.0 0.0;
                     rel1 {
-                        relative: 1.0 0.0;
-                        offset: 0 165;
-                        to: "magnifier_bg";
+                        to: "bg";
+                        offset: 21-5 22-8; //need to update when image with rounded corners releases
                     }
                     rel2 {
-                        relative: 0.0 0.0;
-                        to: "magnifier_bg";
+                        to: "bg";
+                        offset: -21+5 -44+10;
                     }
                 }
             }
         }
     }
-}
-
+}
\ No newline at end of file
index fcb7856..bff066f 100755 (executable)
@@ -42,10 +42,8 @@ TextSelectionMagnifier::TextSelectionMagnifier(EwkViewImpl* viewImpl)
     : m_viewImpl(viewImpl)
     , m_image(0)
     , m_magnifier(0)
-    , m_magnifierBackground(0)
-    , m_magnifierFrame(0)
-    , m_width(300)
-    , m_height(100)
+    , m_width(320)
+    , m_height(120)
 {
 }
 
@@ -67,13 +65,6 @@ void TextSelectionMagnifier::update(const IntPoint& point)
         elm_layout_file_set(m_magnifier, EDJE_DIR"/Magnifier.edj", "magnifier");
     }
 
-    m_magnifierBackground = elm_image_add(m_magnifier);
-    elm_image_file_set(m_magnifierBackground, MAGNIFIER_IMAGE_PATH, 0);
-    elm_object_part_content_set(m_magnifier, "magnifier_bg", m_magnifierBackground);
-    evas_object_show(m_magnifierBackground);
-
-    m_magnifierFrame = elm_frame_add(m_magnifier);
-
     int viewX, viewY, viewWidth, viewHeight;
     evas_object_geometry_get(m_viewImpl->view(), &viewX, &viewY, &viewWidth, &viewHeight);
 
@@ -108,12 +99,12 @@ void TextSelectionMagnifier::update(const IntPoint& point)
     evas_object_image_filled_set(m_image, true);
     evas_object_show(m_image);
 
-    elm_object_content_unset(m_magnifierFrame);
-    elm_object_content_set(m_magnifierFrame, m_image);
+    elm_object_part_content_set(m_magnifier, "swallow", m_image);
+    evas_object_pass_events_set(m_image, EINA_TRUE);
+    evas_object_clip_set(m_image, m_magnifier);
 
-    elm_object_style_set(m_magnifierFrame, "pad_small");
-    elm_object_part_content_set(m_magnifier, "magnifier_frame", m_magnifierFrame);
-    evas_object_show(m_magnifierFrame);
+    evas_object_layer_set(m_magnifier, EVAS_LAYER_MAX);
+    evas_object_layer_set(m_image, EVAS_LAYER_MAX);
 }
 
 void TextSelectionMagnifier::show()
@@ -138,7 +129,7 @@ void TextSelectionMagnifier::move(const IntPoint& point)
     evas_object_geometry_get(m_viewImpl->view(), &viewX, &viewY, &viewWidth, &viewHeight);
 
     int magnfierX, magnfierY, magnfierWidth, magnfierHeight;
-    evas_object_geometry_get(m_magnifierBackground, &magnfierX, &magnfierY, &magnfierWidth, &magnfierHeight);
+    evas_object_geometry_get(m_magnifier, &magnfierX, &magnfierY, &magnfierWidth, &magnfierHeight);
 
     int xPosition = point.x();
     if (xPosition < (magnfierWidth / 2))
@@ -146,7 +137,7 @@ void TextSelectionMagnifier::move(const IntPoint& point)
     if (xPosition > viewWidth - (magnfierWidth / 2))
         xPosition = viewWidth - (magnfierWidth / 2);
 
-    int yPosition = point.y() - 130;
+    int yPosition = point.y() - 230;
     if (yPosition < (magnfierHeight / 2))
         yPosition = magnfierHeight / 2;
     if (yPosition > viewHeight - (magnfierHeight / 2))
index 2a60db6..90b3651 100755 (executable)
@@ -55,8 +55,6 @@ private:
     EwkViewImpl* m_viewImpl;
     Evas_Object* m_image;
     Evas_Object* m_magnifier;
-    Evas_Object* m_magnifierBackground;
-    Evas_Object* m_magnifierFrame;
     int m_width;
     int m_height;
 };
diff --git a/Source/WebKit2/UIProcess/API/efl/tizen/images/magnifier.png b/Source/WebKit2/UIProcess/API/efl/tizen/images/magnifier.png
deleted file mode 100644 (file)
index 7761a23..0000000
Binary files a/Source/WebKit2/UIProcess/API/efl/tizen/images/magnifier.png and /dev/null differ
diff --git a/Source/WebKit2/UIProcess/API/efl/tizen/images/magnifier_left.png b/Source/WebKit2/UIProcess/API/efl/tizen/images/magnifier_left.png
new file mode 100644 (file)
index 0000000..307c1dc
Binary files /dev/null and b/Source/WebKit2/UIProcess/API/efl/tizen/images/magnifier_left.png differ
diff --git a/Source/WebKit2/UIProcess/API/efl/tizen/images/magnifier_middle.png b/Source/WebKit2/UIProcess/API/efl/tizen/images/magnifier_middle.png
new file mode 100644 (file)
index 0000000..38bee91
Binary files /dev/null and b/Source/WebKit2/UIProcess/API/efl/tizen/images/magnifier_middle.png differ
diff --git a/Source/WebKit2/UIProcess/API/efl/tizen/images/magnifier_right.png b/Source/WebKit2/UIProcess/API/efl/tizen/images/magnifier_right.png
new file mode 100644 (file)
index 0000000..4467cd6
Binary files /dev/null and b/Source/WebKit2/UIProcess/API/efl/tizen/images/magnifier_right.png differ