From 5594415d49dfcd617c5ac18ac599eafa4198da82 Mon Sep 17 00:00:00 2001 From: "yanjie.hu" Date: Tue, 9 Apr 2013 21:04:33 +0800 Subject: [PATCH] Merge private Change-Id: I32aa1ddc0e24b355508bd3db2de742a886b22bc9 --- scl/gwes/efl/sclgraphics-efl.cpp | 151 +++++++++++++++++---------------------- scl/gwes/efl/sclgraphics-efl.h | 6 +- scl/gwes/efl/sclwindows-efl.cpp | 32 +++++---- scl/gwes/efl/sclwindows-efl.h | 29 ++++---- scl/gwes/gtk/sclgraphics-gtk.cpp | 11 ++- scl/gwes/gtk/sclgraphics-gtk.h | 6 +- scl/gwes/gtk/sclwindows-gtk.cpp | 22 +++--- scl/gwes/gtk/sclwindows-gtk.h | 22 +++--- scl/include/sclgraphics.h | 26 +++++-- scl/include/sclwindows.h | 46 ++++++------ scl/sclcontroller.cpp | 42 ++--------- scl/scluibuilder.cpp | 35 +++++++-- scl/sclwindows.cpp | 28 ++++---- 13 files changed, 229 insertions(+), 227 deletions(-) diff --git a/scl/gwes/efl/sclgraphics-efl.cpp b/scl/gwes/efl/sclgraphics-efl.cpp index 5ebe1e7..4b0cb3c 100644 --- a/scl/gwes/efl/sclgraphics-efl.cpp +++ b/scl/gwes/efl/sclgraphics-efl.cpp @@ -119,7 +119,7 @@ Evas_Object* extract_partimage_from_fullimage( extern sclint magnifierx, magnifiery; void -CSCLGraphicsImplEfl::draw_image(sclwindow window, const scldrawctx draw_ctx, sclchar* image_path, +CSCLGraphicsImplEfl::draw_image(sclwindow window, const scldrawctx draw_ctx, sclchar* image_path, SclImageCachedInfo *cachedinfo, sclint dest_x, sclint dest_y, sclint dest_width, sclint dest_height, sclint src_x, sclint src_y, sclint src_width, sclint src_height, sclboolean extrace_image) { @@ -213,10 +213,18 @@ CSCLGraphicsImplEfl::draw_image(sclwindow window, const scldrawctx draw_ctx, scl int image_height = 0; evas_object_image_file_set(image_object, image_path, NULL); evas_object_image_size_get(image_object, &image_width, &image_height); - const SclNinePatchInfo *nine_patch_info = utils->get_nine_patch_info(image_path); - if (nine_patch_info) { + if (cachedinfo) { evas_object_image_border_set(image_object, - nine_patch_info->left, nine_patch_info->right, nine_patch_info->top, nine_patch_info->bottom); + cachedinfo->nine_patch_left, + cachedinfo->nine_patch_right, + cachedinfo->nine_patch_top, + cachedinfo->nine_patch_bottom); + } else { + const SclNinePatchInfo *nine_patch_info = utils->get_nine_patch_info(image_path); + if (nine_patch_info) { + evas_object_image_border_set(image_object, + nine_patch_info->left, nine_patch_info->right, nine_patch_info->top, nine_patch_info->bottom); + } } const SclLayout *layout = cache->get_cur_layout(window); if (layout) { @@ -405,87 +413,12 @@ CSCLGraphicsImplEfl::destroy_font(sclfont font) } -typedef struct { - const char *szString; - const float actual_width; -} HARDCODED_WIDTH; -HARDCODED_WIDTH hardcoded_width[] = { - {"\xe3\x85\x82" , 0.59 }, // q - {"\xe3\x85\x83" , 0.59 }, // Q - {"\xe3\x85\x88" , 0.59 }, // w - {"\xe3\x85\x89" , 0.59 }, // W - {"\xe3\x84\xb7" , 0.59 }, // e - {"\xe3\x84\xb8" , 0.59 }, // E - {"\xe3\x84\xb1" , 0.59 }, // r - {"\xe3\x84\xb2" , 0.59 }, // R - {"\xe3\x85\x85" , 0.59 }, // t - {"\xe3\x85\x86" , 0.59 }, // T - {"\xe3\x85\x9b" , 0.72 }, // y - {"\xe3\x85\x95" , 0.40 }, // u - {"\xe3\x85\x91" , 0.40 }, // i - {"\xe3\x85\x90" , 0.50 }, // o - {"\xe3\x85\x92" , 0.55 }, // O - {"\xe3\x85\x94" , 0.59 }, // p - {"\xe3\x85\x96" , 0.59 }, // P - {"\xe3\x85\x81" , 0.59 }, // a - {"\xe3\x84\xb4" , 0.59 }, // s - {"\xe3\x85\x87" , 0.59 }, // d - {"\xe3\x84\xb9" , 0.59 }, // f - {"\xe3\x85\x8e" , 0.59 }, // g - {"\xe3\x85\x97" , 0.72 }, // h - {"\xe3\x85\x93" , 0.40 }, // j - {"\xe3\x85\x8f" , 0.40 }, // k - {"\xe3\x85\xa3" , 0.30 }, // l - {"\xe3\x85\x8b" , 0.59 }, // z - {"\xe3\x85\x8c" , 0.59 }, // x - {"\xe3\x85\x8a" , 0.59 }, // c - {"\xe3\x85\x8d" , 0.59 }, // v - {"\xe3\x85\xa0" , 0.72 }, // b - {"\xe3\x85\x9c" , 0.72 }, // n - {"\xe3\x85\xa1" , 0.75 }, // m - - {"\xe3\x85\xa3" , 0.30 }, // ¤Ó - {"\xe3\x86\x8d" , 0.30 }, // . - {"\xe3\x85\xa1" , 0.75 }, // ¤Ñ - {"\xe3\x84\xb1\xe3\x85\x8b" , 1.18 }, // ¤¡¤» - {"\xe3\x84\xb4\xe3\x84\xb9" , 1.18 }, // ¤¤¤© - {"\xe3\x84\xb7\xe3\x85\x8c" , 1.18 }, // ¤§¤¼ - {"\xe3\x85\x82\xe3\x85\x8d" , 1.18 }, // ¤²¤½ - {"\xe3\x85\x85\xe3\x85\x8e" , 1.18 }, // ¤µ¤¾ - {"\xe3\x85\x88\xe3\x85\x8a" , 1.18 }, // ¤¸¤º - {"\xe3\x85\x87\xe3\x85\x81" , 1.18 }, // ¤·¤± - {"\xe3\x85\x87\xe3\x85\x81" , 1.18 }, // ¤·¤± - {"\xe3\x84\xb1\xe3\x84\xb4" , 1.38 }, // ¤¡¤¤ - {"\xe1\x84\x88" , 0.59 }, // ¤³ - {"\xe1\x84\x8d" , 0.59 }, // ¤¹ - {"\xe1\x84\x84" , 0.59 }, // ¤¨ - {"\xe1\x84\x81" , 0.59 }, // ¤¢ - {"\xe1\x84\x8a" , 0.59 }, // ¤¶ - - {"\xe2\x86\x90" , 0.50 }, // Arrows - {"\xe2\x86\x91" , 0.40 }, // - {"\xe2\x86\x92" , 0.55 }, // - {"\xe2\x86\x93" , 0.40 }, // - - {"\xe3\x85\xa0" , 0.1 }, // ¤Ð - {"\341\205\262" , 0.9 }, // ¤Ð -}; - -int find_hardcoded_width(const char *szString, int font_size) { - for(unsigned int loop = 0;loop < sizeof(hardcoded_width) / sizeof(HARDCODED_WIDTH);loop++) { - if (strcmp(szString, hardcoded_width[loop].szString) == 0) { - return hardcoded_width[loop].actual_width * font_size; - } - } - return 0; -} - /** * Draws the given text on cairo-surface */ void CSCLGraphicsImplEfl::draw_text(sclwindow window, const scldrawctx draw_ctx, const SclFontInfo& font_info, const SclColor& color, - const sclchar *str, sclint pos_x, sclint pos_y, sclint width, sclint height, + const sclchar *str, SclTextCachedInfo *cachedinfo, sclint pos_x, sclint pos_y, sclint width, sclint height, SCLLabelAlignment align, sclint padding_x, sclint padding_y, sclint inner_width, sclint inner_height) { @@ -664,7 +597,12 @@ CSCLGraphicsImplEfl::draw_text(sclwindow window, const scldrawctx draw_ctx, cons object->data = st; sclint calwidth, calheight; - evas_object_textblock_size_native_get(text_object, &calwidth, &calheight); + if (cachedinfo) { + calwidth = cachedinfo->actual_size.width; + calheight = cachedinfo->actual_size.height; + } else { + evas_object_textblock_size_native_get(text_object, &calwidth, &calheight); + } // FIXME: float to int may loose precision if (calwidth > 0) { static float _SPACE_RATE = 0.1; @@ -675,10 +613,6 @@ CSCLGraphicsImplEfl::draw_text(sclwindow window, const scldrawctx draw_ctx, cons calheight *= 1 + _SPACE_RATE; } - /* FIXME : The following 2 lines are workaround for problem that EFL does not return correct font size */ - sclint hardcoded_width = find_hardcoded_width(str, font_info.font_size); - if (hardcoded_width != 0) calwidth = hardcoded_width; - if (calwidth > width || calheight > height) { sclfloat width_rate = (sclfloat)width / (sclfloat)calwidth; sclfloat height_rate = (sclfloat)height / (sclfloat)calheight; @@ -869,4 +803,51 @@ CSCLGraphicsImplEfl::get_image_size(sclchar* image_path) return ret; } +SclSize +CSCLGraphicsImplEfl::get_text_size(const SclFontInfo &fontinfo, const sclchar *str) +{ + SCL_DEBUG(); + SclSize ret = { 0, 0 }; + + CSCLWindows *windows = CSCLWindows::get_instance(); + + Evas_Object *winobj = (Evas_Object*)(windows->get_base_window()); + Evas *evas = evas_object_evas_get(winobj); + int w, h; + + Evas_Textblock_Style *st; + st = evas_textblock_style_new(); + + Evas_Object *text_object = evas_object_textblock_add(evas); + + if (text_object && st) { + const sclint STYLE_STR_LEN = 256; + sclchar strStyle[STYLE_STR_LEN] = {0}; + snprintf(strStyle, STYLE_STR_LEN - 1, "DEFAULT='font=%s font_size=%d'", + fontinfo.font_name, fontinfo.font_size); + + evas_textblock_style_set(st, strStyle); + evas_object_textblock_style_set(text_object, st); + + evas_object_textblock_clear(text_object); + char *markup = evas_textblock_text_utf8_to_markup(text_object, str); + if (markup) { + evas_object_textblock_text_markup_set(text_object, markup); + free(markup); + } + + evas_object_textblock_size_native_get(text_object, &w, &h); + + ret.width = w; + ret.height = h; + } + if (text_object) { + evas_object_del(text_object); + } + if (st) { + evas_textblock_style_free(st); + } + + return ret; +} diff --git a/scl/gwes/efl/sclgraphics-efl.h b/scl/gwes/efl/sclgraphics-efl.h index 8eb9e01..0bf90a5 100644 --- a/scl/gwes/efl/sclgraphics-efl.h +++ b/scl/gwes/efl/sclgraphics-efl.h @@ -79,7 +79,7 @@ public : CSCLGraphicsImplEfl(); ~CSCLGraphicsImplEfl(); - void draw_image(sclwindow window, const scldrawctx draw_ctx, sclchar* image_path, + void draw_image(sclwindow window, const scldrawctx draw_ctx, sclchar* image_path, SclImageCachedInfo *cachedinfo, sclint dest_x, sclint dest_y, sclint dest_width, sclint dest_height, sclint src_x, sclint src_y, sclint src_width, sclint src_height, sclboolean extrace_image); sclimage load_image(const sclchar* image_path); @@ -88,7 +88,7 @@ public : sclfont create_font(const SclFontInfo& info); void destroy_font(sclfont font); void draw_text(sclwindow window, const scldrawctx draw_ctx, const SclFontInfo& font_info, const SclColor& color, - const sclchar *str, sclint pos_x, sclint pos_y, sclint width, sclint height, + const sclchar *str, SclTextCachedInfo *cachedinfo, sclint pos_x, sclint pos_y, sclint width, sclint height, SCLLabelAlignment align, sclint padding_x, sclint padding_y, sclint inner_width, sclint inner_height); void draw_rectangle(sclwindow window, const scldrawctx draw_ctx, scldouble pos_x, scldouble pos_y, @@ -96,7 +96,7 @@ public : scldrawctx begin_paint(const sclwindow window, const sclboolean force_draw = FALSE); void end_paint(const sclwindow window, scldrawctx draw_ctx); SclSize get_image_size(sclchar* image_path); - + SclSize get_text_size(const SclFontInfo &fontinfo, const sclchar *str); private: }; } /* End of scl namespace */ diff --git a/scl/gwes/efl/sclwindows-efl.cpp b/scl/gwes/efl/sclwindows-efl.cpp index b469517..1448b7d 100644 --- a/scl/gwes/efl/sclwindows-efl.cpp +++ b/scl/gwes/efl/sclwindows-efl.cpp @@ -78,7 +78,7 @@ CSCLWindowsImplEfl::~CSCLWindowsImplEfl() * Create a content window and binds it into given parent window as a child */ sclwindow -CSCLWindowsImplEfl::create_base_window(const sclwindow parent, SclWindowContext *winctx, const scl16 width, const scl16 height) +CSCLWindowsImplEfl::create_base_window(const sclwindow parent, SclWindowContext *winctx, scl16 width, scl16 height) { SCL_DEBUG(); @@ -115,7 +115,7 @@ CSCLWindowsImplEfl::create_base_window(const sclwindow parent, SclWindowContext * Creates a window */ sclwindow -CSCLWindowsImplEfl::create_window(const sclwindow parent, SclWindowContext *winctx, const scl16 width, const scl16 height) +CSCLWindowsImplEfl::create_window(const sclwindow parent, SclWindowContext *winctx, scl16 width, scl16 height) { SCL_DEBUG(); @@ -183,7 +183,7 @@ CSCLWindowsImplEfl::create_window(const sclwindow parent, SclWindowContext *winc * Creates a window */ sclwindow -CSCLWindowsImplEfl::create_magnifier_window(const sclwindow parent, SclWindowContext *winctx, const scl16 width, const scl16 height) +CSCLWindowsImplEfl::create_magnifier_window(const sclwindow parent, SclWindowContext *winctx, scl16 width, scl16 height) { SCL_DEBUG(); @@ -258,7 +258,7 @@ CSCLWindowsImplEfl::create_magnifier_window(const sclwindow parent, SclWindowCon * Creates the dim window */ sclwindow -CSCLWindowsImplEfl::create_dim_window(const sclwindow parent, SclWindowContext *winctx, const scl16 width, const scl16 height) +CSCLWindowsImplEfl::create_dim_window(const sclwindow parent, SclWindowContext *winctx, scl16 width, scl16 height) { SCL_DEBUG(); @@ -469,7 +469,7 @@ CSCLWindowsImplEfl::show_window(const sclwindow window, sclboolean queue) * Hides the given window */ void -CSCLWindowsImplEfl::hide_window(const sclwindow window, const sclboolean fForce) +CSCLWindowsImplEfl::hide_window(const sclwindow window, sclboolean fForce) { SCL_DEBUG(); CSCLWindows *windows = CSCLWindows::get_instance(); @@ -486,7 +486,11 @@ CSCLWindowsImplEfl::hide_window(const sclwindow window, const sclboolean fForce elm_win_keyboard_mode_set(win, ELM_WIN_KEYBOARD_OFF); } else { #endif - evas_object_hide(win); + if (window == windows->get_magnifier_window()) { + evas_object_move(win, -10000, -10000); + } else { + evas_object_hide(win); + } #ifdef APPLY_WINDOW_MANAGER_CHANGE } #endif @@ -576,7 +580,7 @@ CSCLWindowsImplEfl::hide_window(const sclwindow window, const sclboolean fForce */ sclint magnifierx, magnifiery; void -CSCLWindowsImplEfl::move_window(const sclwindow window, const scl16 x, const scl16 y) +CSCLWindowsImplEfl::move_window(const sclwindow window, scl16 x, scl16 y) { SCL_DEBUG(); CSCLUtils *utils = CSCLUtils::get_instance(); @@ -665,7 +669,7 @@ CSCLWindowsImplEfl::move_window(const sclwindow window, const scl16 x, const scl * Resizes the window to the given metric */ void -CSCLWindowsImplEfl::resize_window(const sclwindow window, const scl16 width, const scl16 height) +CSCLWindowsImplEfl::resize_window(const sclwindow window, scl16 width, scl16 height) { SCL_DEBUG(); @@ -719,7 +723,7 @@ CSCLWindowsImplEfl::resize_window(const sclwindow window, const scl16 width, con * Resizes the window to the given metric */ void -CSCLWindowsImplEfl::move_resize_window(const sclwindow window, const scl16 x, const scl16 y, const scl16 width, const scl16 height) +CSCLWindowsImplEfl::move_resize_window(const sclwindow window, scl16 x, scl16 y, scl16 width, scl16 height) { SCL_DEBUG(); Evas_Object *win = (Evas_Object*)window; @@ -748,7 +752,7 @@ CSCLWindowsImplEfl::move_resize_window(const sclwindow window, const scl16 x, co * Update the window to redraw given area */ void -CSCLWindowsImplEfl::update_window(const sclwindow window, const scl16 x, const scl16 y, const scl16 width, const scl16 height) +CSCLWindowsImplEfl::update_window(const sclwindow window, scl16 x, scl16 y, scl16 width, scl16 height) { SCL_DEBUG(); @@ -961,7 +965,7 @@ CSCLWindowsImplEfl::get_window_rect(const sclwindow window, SclRectangle *rect) * Sets rotation */ void -CSCLWindowsImplEfl::set_window_rotation(const sclwindow window, const SCLRotation rotation) +CSCLWindowsImplEfl::set_window_rotation(const sclwindow window, SCLRotation rotation) { SCL_DEBUG(); @@ -1007,14 +1011,14 @@ CSCLWindowsImplEfl::set_window_rotation(const sclwindow window, const SCLRotatio * Shows a message box */ void -CSCLWindowsImplEfl::show_message_box(const sclwindow parent, const scl8 msgType, sclchar* title, sclchar* msg) +CSCLWindowsImplEfl::show_message_box(const sclwindow parent, scl8 msgType, sclchar* title, sclchar* msg) { SCL_DEBUG(); } void -CSCLWindowsImplEfl::set_keep_above(const sclwindow window, const sclboolean keepabove) +CSCLWindowsImplEfl::set_keep_above(const sclwindow window, sclboolean keepabove) { SCL_DEBUG(); } @@ -1104,7 +1108,7 @@ void release_all(Evas_Object *win) } #ifndef APPLY_WINDOW_MANAGER_CHANGE -void CSCLWindowsImplEfl::set_window_accepts_focus(const sclwindow window, const sclboolean acceptable) +void CSCLWindowsImplEfl::set_window_accepts_focus(const sclwindow window, sclboolean acceptable) { Eina_Bool accepts_focus; Ecore_X_Window_State_Hint initial_state; diff --git a/scl/gwes/efl/sclwindows-efl.h b/scl/gwes/efl/sclwindows-efl.h index fff6082..544bab0 100644 --- a/scl/gwes/efl/sclwindows-efl.h +++ b/scl/gwes/efl/sclwindows-efl.h @@ -46,25 +46,28 @@ public : CSCLWindowsImplEfl(); ~CSCLWindowsImplEfl(); - sclwindow create_base_window(const sclwindow parent, SclWindowContext *winctx, const scl16 width, const scl16 height); - sclwindow create_window(const sclwindow parent, SclWindowContext *winctx, const scl16 width, const scl16 height); - sclwindow create_magnifier_window(const sclwindow parent, SclWindowContext *winctx, const scl16 width, const scl16 height); - sclwindow create_dim_window(const sclwindow parent, SclWindowContext *winctx, const scl16 width, const scl16 height); + sclwindow create_base_window(const sclwindow parent, SclWindowContext *winctx, scl16 width, scl16 height); + sclwindow create_window(const sclwindow parent, SclWindowContext *winctx, scl16 width, scl16 height); + sclwindow create_magnifier_window(const sclwindow parent, SclWindowContext *winctx, scl16 width, scl16 height); + sclwindow create_dim_window(const sclwindow parent, SclWindowContext *winctx, scl16 width, scl16 height); bool destroy_window(sclwindow window); void show_window(const sclwindow window, sclboolean queue); - void hide_window(const sclwindow window, const sclboolean fForce = FALSE); - void move_window(const sclwindow window, const scl16 x, const scl16 y); - void resize_window(const sclwindow window, const scl16 width, const scl16 height); - void move_resize_window(const sclwindow window, const scl16 x, const scl16 y, const scl16 width, const scl16 height); - void update_window(const sclwindow window, const scl16 x = 0, const scl16 y = 0, const scl16 width = 0, const scl16 height = 0); - void set_window_rotation(const sclwindow window, const SCLRotation rotation); - void show_message_box(const sclwindow parent, const scl8 msgType, sclchar* title, sclchar* msg); + void hide_window(const sclwindow window, sclboolean fForce = FALSE); + void move_window(const sclwindow window, scl16 x, scl16 y); + void resize_window(const sclwindow window, scl16 width, scl16 height); + void move_resize_window(const sclwindow window, scl16 x, scl16 y, scl16 width, scl16 height); + void update_window(const sclwindow window, scl16 x = 0, scl16 y = 0, scl16 width = 0, scl16 height = 0); + void set_window_rotation(const sclwindow window, SCLRotation rotation); + void show_message_box(const sclwindow parent, scl8 msgType, sclchar* title, sclchar* msg); sclboolean get_window_rect(const sclwindow window, SclRectangle *rect); void set_parent(const sclwindow parent, const sclwindow window); - void set_keep_above(const sclwindow window, const sclboolean keepabove); + void set_keep_above(const sclwindow window, sclboolean keepabove); + +#ifndef APPLY_WINDOW_MANAGER_CHANGE /* EFL specific utility functions */ - void set_window_accepts_focus(const sclwindow window, const sclboolean accepts); + void set_window_accepts_focus(const sclwindow window, sclboolean accepts); +#endif }; } /* End of scl namespace */ #endif diff --git a/scl/gwes/gtk/sclgraphics-gtk.cpp b/scl/gwes/gtk/sclgraphics-gtk.cpp index e27a18b..bed53ce 100644 --- a/scl/gwes/gtk/sclgraphics-gtk.cpp +++ b/scl/gwes/gtk/sclgraphics-gtk.cpp @@ -42,7 +42,7 @@ CSCLGraphicsImplGtk::~CSCLGraphicsImplGtk() void -CSCLGraphicsImplGtk::draw_image(sclwindow window, const scldrawctx drawCtx, sclchar* imgPath, sclint destX, sclint destY, +CSCLGraphicsImplGtk::draw_image(sclwindow window, const scldrawctx drawCtx, sclchar* imgPath, SclImageCachedInfo *cachedinfo, sclint destX, sclint destY, sclint destWidth, sclint destHeight, sclint srcX, sclint srcY, sclint srcWidth, sclint srcHeight) { SCL_DEBUG(); @@ -192,7 +192,7 @@ CSCLGraphicsImplGtk::destroy_font(sclfont font) */ void CSCLGraphicsImplGtk::draw_text(sclwindow window, const scldrawctx drawCtx, const SclFontInfo& fontinfo, const SclColor& color, - const sclchar *str, sclint posx, sclint posy, sclint width, sclint height, + const sclchar *str, SclTextCachedInfo *cachedinfo, sclint posx, sclint posy, sclint width, sclint height, SCLLabelAlignment align, sclbyte padding) { SCL_DEBUG(); @@ -333,4 +333,11 @@ CSCLGraphicsImplGtk::get_image_size(sclchar* imgPath) return ret; } +SclSize +CSCLGraphicsImplGtk::get_text_size(const SclFontInfo & fontinfo, const sclchar *str) +{ + SCL_DEBUG(); + SclSize ret = {0, 0}; + return ret; +} diff --git a/scl/gwes/gtk/sclgraphics-gtk.h b/scl/gwes/gtk/sclgraphics-gtk.h index 114a0b7..f60bbda 100644 --- a/scl/gwes/gtk/sclgraphics-gtk.h +++ b/scl/gwes/gtk/sclgraphics-gtk.h @@ -29,7 +29,7 @@ public : CSCLGraphicsImplGtk(); ~CSCLGraphicsImplGtk(); - void draw_image(sclwindow window, const scldrawctx drawCtx, sclchar* imgPath, sclint destX, sclint destY, + void draw_image(sclwindow window, const scldrawctx drawCtx, sclchar* imgPath, SclImageCachedInfo *cachedinfo, sclint destX, sclint destY, sclint destWidth, sclint destHeight, sclint srcX, sclint srcY, sclint srcWidth, sclint srcHeight); sclimage load_image(const sclchar* imgPath); void unload_image(sclimage imgData); @@ -37,7 +37,7 @@ public : sclfont create_font(const SclFontInfo& info); void destroy_font(sclfont font); void draw_text(sclwindow window, const scldrawctx drawCtx, const SclFontInfo& fontinfo, const SclColor& color, - const sclchar *str, sclint posx, sclint posy, sclint width, sclint height, + const sclchar *str, SclTextCachedInfo *cachedinfo, sclint posx, sclint posy, sclint width, sclint height, SCLLabelAlignment align, sclbyte padding); void draw_rectangle(sclwindow window, const scldrawctx drawCtx, scldouble posx, scldouble posy, @@ -45,7 +45,7 @@ public : scldrawctx begin_paint(const sclwindow window, const sclboolean forcedraw = FALSE); void end_paint(const sclwindow window, scldrawctx drawCtx); SclSize get_image_size(sclchar* imgPath); - + SclSize get_text_size(const SclFontInfo &fontinfo, const sclchar *str); private: }; } /* End of scl namespace */ diff --git a/scl/gwes/gtk/sclwindows-gtk.cpp b/scl/gwes/gtk/sclwindows-gtk.cpp index 7e131ff..c0ba382 100644 --- a/scl/gwes/gtk/sclwindows-gtk.cpp +++ b/scl/gwes/gtk/sclwindows-gtk.cpp @@ -74,7 +74,7 @@ make_transparent_window (GtkWidget *window) * Create a content window and binds it into given parent window as a child */ sclwindow -CSCLWindowsImplGtk::create_base_window(const sclwindow parent, SclWindowContext *winctx, const scl16 width, const scl16 height) +CSCLWindowsImplGtk::create_base_window(const sclwindow parent, SclWindowContext *winctx, scl16 width, scl16 height) { SCL_DEBUG(); @@ -115,7 +115,7 @@ CSCLWindowsImplGtk::create_base_window(const sclwindow parent, SclWindowContext * Creates a window */ sclwindow -CSCLWindowsImplGtk::create_window(const sclwindow parent, SclWindowContext *winctx, const scl16 width, const scl16 height) +CSCLWindowsImplGtk::create_window(const sclwindow parent, SclWindowContext *winctx, scl16 width, scl16 height) { SCL_DEBUG(); /* pre-condition */ @@ -167,7 +167,7 @@ CSCLWindowsImplGtk::create_window(const sclwindow parent, SclWindowContext *winc * Creates the dim window */ sclwindow -CSCLWindowsImplGtk::create_dim_window(const sclwindow parent, SclWindowContext *winctx, const scl16 width, const scl16 height) +CSCLWindowsImplGtk::create_dim_window(const sclwindow parent, SclWindowContext *winctx, scl16 width, scl16 height) { SCL_DEBUG(); /* pre-condition */ @@ -283,7 +283,7 @@ CSCLWindowsImplGtk::show_window(const sclwindow window, sclboolean queue) * Hides the given window */ void -CSCLWindowsImplGtk::hide_window(const sclwindow window, const sclboolean fForce) +CSCLWindowsImplGtk::hide_window(const sclwindow window, sclboolean fForce) { SCL_DEBUG(); scl_assert_return(window); @@ -319,7 +319,7 @@ CSCLWindowsImplGtk::hide_window(const sclwindow window, const sclboolean fForce * Moves the window to the given position */ void -CSCLWindowsImplGtk::move_window(const sclwindow window, const scl16 x, const scl16 y) { +CSCLWindowsImplGtk::move_window(const sclwindow window, scl16 x, scl16 y) { SCL_DEBUG(); scl_assert_return(window); GtkWidget* widget = static_cast(window); @@ -330,7 +330,7 @@ CSCLWindowsImplGtk::move_window(const sclwindow window, const scl16 x, const scl * Resizes the window to the given metric */ void -CSCLWindowsImplGtk::resize_window(const sclwindow window, const scl16 width, const scl16 height) { +CSCLWindowsImplGtk::resize_window(const sclwindow window, scl16 width, scl16 height) { SCL_DEBUG(); scl_assert_return(window); GtkWidget* widget = static_cast(window); @@ -344,7 +344,7 @@ CSCLWindowsImplGtk::resize_window(const sclwindow window, const scl16 width, con * Resizes the window to the given metric */ void -CSCLWindowsImplGtk::move_resize_window(const sclwindow window, const scl16 x, const scl16 y, const scl16 width, const scl16 height) { +CSCLWindowsImplGtk::move_resize_window(const sclwindow window, scl16 x, scl16 y, scl16 width, scl16 height) { SCL_DEBUG(); scl_assert_return(window); GtkWidget* widget = static_cast(window); @@ -356,7 +356,7 @@ CSCLWindowsImplGtk::move_resize_window(const sclwindow window, const scl16 x, co * Update the window to redraw given area */ void -CSCLWindowsImplGtk::update_window(const sclwindow window, const scl16 x, const scl16 y, const scl16 width, const scl16 height) { +CSCLWindowsImplGtk::update_window(const sclwindow window, scl16 x, scl16 y, scl16 width, scl16 height) { SCL_DEBUG(); scl_assert_return(window); GtkWidget* widget = static_cast(window); @@ -436,7 +436,7 @@ CSCLWindowsImplGtk::get_window_rect(const sclwindow window, SclRectangle *rect) * Sets rotation */ void -CSCLWindowsImplGtk::set_window_rotation(const sclwindow window, const sclint degree) { +CSCLWindowsImplGtk::set_window_rotation(const sclwindow window, sclint degree) { SCL_DEBUG(); GtkWidget* widget = gtk_widget_get_toplevel(static_cast(window)); //gtk_window_set_rotate(GTK_WINDOW(widget), degree); @@ -447,7 +447,7 @@ CSCLWindowsImplGtk::set_window_rotation(const sclwindow window, const sclint deg * Shows a message box */ void -CSCLWindowsImplGtk::show_message_box(const sclwindow parent, const scl8 msgType, sclchar* title, sclchar* msg) { +CSCLWindowsImplGtk::show_message_box(const sclwindow parent, scl8 msgType, sclchar* title, sclchar* msg) { SCL_DEBUG(); scl_assert_return(strlen(msg) > 0); @@ -488,7 +488,7 @@ CSCLWindowsImplGtk::show_message_box(const sclwindow parent, const scl8 msgType, void -CSCLWindowsImplGtk::set_keep_above(const sclwindow window, const sclboolean keepabove) { +CSCLWindowsImplGtk::set_keep_above(const sclwindow window, sclboolean keepabove) { SCL_DEBUG(); gtk_window_set_keep_above(GTK_WINDOW(window), keepabove); diff --git a/scl/gwes/gtk/sclwindows-gtk.h b/scl/gwes/gtk/sclwindows-gtk.h index 70458a6..fbd69f8 100644 --- a/scl/gwes/gtk/sclwindows-gtk.h +++ b/scl/gwes/gtk/sclwindows-gtk.h @@ -29,21 +29,21 @@ public : CSCLWindowsImplGtk(); ~CSCLWindowsImplGtk(); - sclwindow create_base_window(const sclwindow parent, SclWindowContext *winctx, const scl16 width, const scl16 height); - sclwindow create_window(const sclwindow parent, SclWindowContext *winctx, const scl16 width, const scl16 height); - sclwindow create_dim_window(const sclwindow parent, SclWindowContext *winctx, const scl16 width, const scl16 height); + sclwindow create_base_window(const sclwindow parent, SclWindowContext *winctx, scl16 width, scl16 height); + sclwindow create_window(const sclwindow parent, SclWindowContext *winctx, scl16 width, scl16 height); + sclwindow create_dim_window(const sclwindow parent, SclWindowContext *winctx, scl16 width, scl16 height); bool destroy_window(sclwindow window); void show_window(const sclwindow window, sclboolean queue); - void hide_window(const sclwindow window, const sclboolean fForce = FALSE); - void move_window(const sclwindow window, const scl16 x, const scl16 y); - void resize_window(const sclwindow window, const scl16 width, const scl16 height); - void move_resize_window(const sclwindow window, const scl16 x, const scl16 y, const scl16 width, const scl16 height); - void update_window(const sclwindow window, const scl16 x = 0, const scl16 y = 0, const scl16 width = 0, const scl16 height = 0); - void set_window_rotation(const sclwindow window, const sclint degree); - void show_message_box(const sclwindow parent, const scl8 msgType, sclchar* title, sclchar* msg); + void hide_window(const sclwindow window, sclboolean fForce = FALSE); + void move_window(const sclwindow window, scl16 x, scl16 y); + void resize_window(const sclwindow window, scl16 width, scl16 height); + void move_resize_window(const sclwindow window, scl16 x, scl16 y, scl16 width, scl16 height); + void update_window(const sclwindow window, scl16 x = 0, scl16 y = 0, scl16 width = 0, scl16 height = 0); + void set_window_rotation(const sclwindow window, sclint degree); + void show_message_box(const sclwindow parent, scl8 msgType, sclchar* title, sclchar* msg); sclboolean get_window_rect(const sclwindow window, SclRectangle *rect); void set_parent(const sclwindow parentWindow, const sclwindow window); - void set_keep_above(const sclwindow window, const sclboolean keepabove); + void set_keep_above(const sclwindow window, sclboolean keepabove); }; } /* End of scl namespace */ #endif __SCL_WINDOWS_GTK_H__ diff --git a/scl/include/sclgraphics.h b/scl/include/sclgraphics.h index d6dc18c..81a9aaf 100644 --- a/scl/include/sclgraphics.h +++ b/scl/include/sclgraphics.h @@ -41,6 +41,17 @@ typedef struct _SclFontInfo { sclboolean is_bold; } SclFontInfo; +typedef struct _SclImageCachedInfo { + sclint nine_patch_left; + sclint nine_patch_right; + sclint nine_patch_top; + sclint nine_patch_bottom; +}SclImageCachedInfo; + +typedef struct _SclTextCachedInfo { + SclSize actual_size; +}SclTextCachedInfo; + const SclColor SCLCOLOR_WHITE = {255, 255, 255}; const SclColor SCLCOLOR_GREY = {128, 128, 128}; const SclColor SCLCOLOR_BLACK = {0, 0, 0}; @@ -58,11 +69,12 @@ class CSCLGraphicsImpl friend class CSCLGraphics; private: virtual void draw_image(sclwindow window, const scldrawctx draw_ctx, sclchar* image_path, + SclImageCachedInfo *cachedinfo, sclint dest_x, sclint dest_y, sclint dest_width, sclint dest_height, sclint src_x, sclint src_y, sclint src_width, sclint src_height, sclboolean extrace_image) = 0; virtual void draw_text(sclwindow window, const scldrawctx draw_ctx, const SclFontInfo& font_info, const SclColor& color, - const sclchar *str, sclint pos_x, sclint pos_y, + const sclchar *str, SclTextCachedInfo *cachedinfo, sclint pos_x, sclint pos_y, sclint width, sclint height, SCLLabelAlignment align, sclint padding_x, sclint padding_y, sclint inner_width, sclint inner_height) = 0; virtual scldrawctx begin_paint(const sclwindow window, const sclboolean force_draw = FALSE) = 0; @@ -75,6 +87,7 @@ private: scldouble width, scldouble height, const scldouble line_width, const SclColor& line_color, sclboolean fill, const SclColor& fill_color, scldouble radius, sclfloat alpha) = 0; virtual SclSize get_image_size(sclchar* image_path) = 0; + virtual SclSize get_text_size(const SclFontInfo &fontinfo, const sclchar *str) = 0; }; class CSCLGraphics @@ -90,16 +103,16 @@ public : static CSCLGraphics* get_instance(); - void draw_image(sclwindow window, const scldrawctx draw_ctx, sclchar* image_path, sclint dest_x, sclint dest_y, + void draw_image(sclwindow window, const scldrawctx draw_ctx, sclchar* image_path, SclImageCachedInfo *cachedinfo, sclint dest_x, sclint dest_y, sclint dest_width = -1, sclint dest_height = -1, sclint src_x = 0, sclint src_y = 0, sclint src_width = -1, sclint src_height = -1, sclboolean extrace_image = FALSE) { - get_scl_graphics_impl()->draw_image(window, draw_ctx, image_path, dest_x, dest_y, dest_width, dest_height, src_x, src_y, src_width, src_height, extrace_image); + get_scl_graphics_impl()->draw_image(window, draw_ctx, image_path, cachedinfo, dest_x, dest_y, dest_width, dest_height, src_x, src_y, src_width, src_height, extrace_image); } void draw_text(sclwindow window, const scldrawctx draw_ctx, const SclFontInfo& font_info, const SclColor& color, - const sclchar *str, sclint pos_x, sclint pos_y, sclint width = 0, sclint height = 0, + const sclchar *str, SclTextCachedInfo *cachedinfo, sclint pos_x, sclint pos_y, sclint width = 0, sclint height = 0, SCLLabelAlignment align = LABEL_ALIGN_LEFT_TOP, sclint padding_x = 0, sclint padding_y = 0, sclint inner_width = 0, sclint inner_height = 0) { - get_scl_graphics_impl()->draw_text(window, draw_ctx, font_info, color, str, + get_scl_graphics_impl()->draw_text(window, draw_ctx, font_info, color, str, cachedinfo, pos_x, pos_y, width, height, align, padding_x, padding_y, inner_width, inner_height); } @@ -121,6 +134,9 @@ public : return get_scl_graphics_impl()->get_image_size(image_path); } + SclSize get_text_size(const SclFontInfo & fontinfo, const sclchar *str) { + return get_scl_graphics_impl()->get_text_size(fontinfo, str); + } private: sclimage load_image(const sclchar *image_path) { return get_scl_graphics_impl()->load_image(image_path); diff --git a/scl/include/sclwindows.h b/scl/include/sclwindows.h index 8000214..f5ddad1 100644 --- a/scl/include/sclwindows.h +++ b/scl/include/sclwindows.h @@ -69,22 +69,22 @@ typedef struct _SclWindowContext { class CSCLWindowsImpl { public : - virtual sclwindow create_base_window(const sclwindow parent, SclWindowContext *winctx, const scl16 width, const scl16 height) = 0; - virtual sclwindow create_window(const sclwindow parent, SclWindowContext *winctx, const scl16 width, const scl16 height) = 0; - virtual sclwindow create_magnifier_window(const sclwindow parent, SclWindowContext *winctx, const scl16 width, const scl16 height) = 0; - virtual sclwindow create_dim_window(const sclwindow parent, SclWindowContext *winctx, const scl16 width, const scl16 height) = 0; + virtual sclwindow create_base_window(const sclwindow parent, SclWindowContext *winctx, scl16 width, scl16 height) = 0; + virtual sclwindow create_window(const sclwindow parent, SclWindowContext *winctx, scl16 width, scl16 height) = 0; + virtual sclwindow create_magnifier_window(const sclwindow parent, SclWindowContext *winctx, scl16 width, scl16 height) = 0; + virtual sclwindow create_dim_window(const sclwindow parent, SclWindowContext *winctx, scl16 width, scl16 height) = 0; virtual bool destroy_window(sclwindow window) = 0; virtual void set_parent(const sclwindow parent, const sclwindow window) = 0; virtual void show_window(const sclwindow window, sclboolean queue) = 0; - virtual void set_window_rotation(const sclwindow window, const SCLRotation rotation) = 0; - virtual void hide_window(const sclwindow window, const sclboolean force = FALSE) = 0; - virtual void move_window(const sclwindow window, const scl16 x, const scl16 y) = 0; - virtual void move_resize_window(const sclwindow window, const scl16 x, const scl16 y, const scl16 width, const scl16 height) = 0; - virtual void resize_window(const sclwindow window, const scl16 width, const scl16 height) = 0; - virtual void update_window(const sclwindow window, const scl16 x = 0, const scl16 y = 0, const scl16 width = 0, const scl16 height = 0) = 0; + virtual void set_window_rotation(const sclwindow window, SCLRotation rotation) = 0; + virtual void hide_window(const sclwindow window, sclboolean force = FALSE) = 0; + virtual void move_window(const sclwindow window, scl16 x, scl16 y) = 0; + virtual void move_resize_window(const sclwindow window, scl16 x, scl16 y, scl16 width, scl16 height) = 0; + virtual void resize_window(const sclwindow window, scl16 width, scl16 height) = 0; + virtual void update_window(const sclwindow window, scl16 x = 0, scl16 y = 0, scl16 width = 0, scl16 height = 0) = 0; virtual sclboolean get_window_rect(const sclwindow window, SclRectangle *rect) = 0; - virtual void set_keep_above(const sclwindow window, const sclboolean keep_above) = 0; + virtual void set_keep_above(const sclwindow window, sclboolean keep_above) = 0; }; class CSCLWindows @@ -97,23 +97,23 @@ public : static CSCLWindows* get_instance(); - sclwindow open_popup(const SclWindowOpener opener, const SclRectangle geometry, sclshort inputmode, sclshort layout, SCLPopupType popup_type, sclboolean is_virtual, sclboolean use_dim_window, sclint img_offset_x = 0, sclint img_offset_y = 0, sclint timeout = 0); + sclwindow open_popup(const SclWindowOpener opener, const SclRectangle& geometry, sclshort inputmode, sclshort layout, SCLPopupType popup_type, sclboolean is_virtual, sclboolean use_dim_window, sclint img_offset_x = 0, sclint img_offset_y = 0, sclint timeout = 0); bool close_popup(sclwindow window); bool close_all_popups(sclwindow skip_window = SCLWINDOW_INVALID); - sclwindow create_base_window(const sclwindow parent, const scl16 width, const scl16 height); + sclwindow create_base_window(const sclwindow parent, scl16 width, scl16 height); void show_window(const sclwindow window, sclboolean queue = FALSE); - void hide_window(const sclwindow window, const sclboolean force = FALSE); + void hide_window(const sclwindow window, sclboolean force = FALSE); void set_parent(const sclwindow parent, const sclwindow window); - void set_keep_above(const sclwindow window, const sclboolean keep_above); + void set_keep_above(const sclwindow window, sclboolean keep_above); - void set_window_rotation(const sclwindow window, const SCLRotation rotation); + void set_window_rotation(const sclwindow window, SCLRotation rotation); - void move_window(const sclwindow window, const scl16 x, const scl16 y); - void resize_window(const sclwindow window, const scl16 width, const scl16 height); - void move_resize_window(const sclwindow window, const scl16 x, const scl16 y, const scl16 width, const scl16 height); - void update_window(const sclwindow window, const scl16 x = 0, const scl16 y = 0, const scl16 width = 0, const scl16 height = 0); + void move_window(const sclwindow window, scl16 x, scl16 y); + void resize_window(const sclwindow window, scl16 width, scl16 height); + void move_resize_window(const sclwindow window, scl16 x, scl16 y, scl16 width, scl16 height); + void update_window(const sclwindow window, scl16 x = 0, scl16 y = 0, scl16 width = 0, scl16 height = 0); sclboolean get_window_rect(const sclwindow window, SclRectangle *rect); sclwindow get_base_window(); sclboolean is_base_window(sclwindow window); @@ -123,14 +123,14 @@ public : SclWindowContext* get_window_context(sclwindow window); void set_window_context(sclwindow window, SclWindowContext* context); - sclwindow create_magnifier_window(const sclwindow parent, const scl16 x, const scl16 y, const scl16 width, const scl16 height); + sclwindow create_magnifier_window(const sclwindow parent, scl16 x, scl16 y, scl16 width, scl16 height); sclwindow get_magnifier_window(); sclwindow get_nth_window_in_Z_order_list(sclbyte index); sclwindow get_nth_popup_window(sclbyte index); sclbyte get_Z_order(sclwindow window); - sclwindow create_dim_window(const sclwindow parent, SclWindowContext *winctx, const scl16 width, const scl16 height); + sclwindow create_dim_window(const sclwindow parent, SclWindowContext *winctx, scl16 width, scl16 height); sclwindow get_dim_window(); void set_update_pending(sclboolean pend); @@ -139,7 +139,7 @@ public : protected : CSCLWindowsImpl* get_scl_windows_impl(); - sclwindow create_window(const SclWindowOpener opener, const SclRectangle geometry, sclshort inputmode, sclshort layout, SCLPopupType popup_type, sclboolean is_virtual, sclint img_offset_x = 0, sclint img_offset_y = 0, sclint timeout = 0); + sclwindow create_window(const SclWindowOpener opener, const SclRectangle &geometry, sclshort inputmode, sclshort layout, SCLPopupType popup_type, sclboolean is_virtual, sclint img_offset_x = 0, sclint img_offset_y = 0, sclint timeout = 0); bool destroy_window(sclwindow window); void push_window_in_Z_order_list(sclwindow window); diff --git a/scl/sclcontroller.cpp b/scl/sclcontroller.cpp index 5931940..6fd1f11 100644 --- a/scl/sclcontroller.cpp +++ b/scl/sclcontroller.cpp @@ -3240,24 +3240,6 @@ CSCLController::timer_event(const scl32 data) } } - /* FIXME : Temporary way of clearing magnifier window */ - { - CSCLGraphics *graphics = CSCLGraphics::get_instance(); - CSCLUtils *utils = CSCLUtils::get_instance(); - sclchar composed_path[_POSIX_PATH_MAX] = {0,}; - scldrawctx draw_ctx = graphics->begin_paint(windows->get_magnifier_window()); - SclResParserManager *sclres_manager = SclResParserManager::get_instance(); - PSclMagnifierWndConfigure magnifier_configure = NULL; - if (sclres_manager) { - magnifier_configure = sclres_manager->get_magnifier_configure(); - } - if (magnifier_configure) { - utils->get_composed_path(composed_path, IMG_PATH_PREFIX, magnifier_configure->bg_image_path); - graphics->draw_image(windows->get_magnifier_window(), draw_ctx, composed_path, 0, 0); - graphics->end_paint(windows->get_magnifier_window(), draw_ctx); - } - } - windows->hide_window(windows->get_magnifier_window()); context->set_last_pressed_window(SCLWINDOW_INVALID); context->set_last_pressed_key(NOT_USED); @@ -3406,28 +3388,12 @@ void CSCLController::handle_engine_signal( SclInternalSignal signal, sclwindow t } break; case SIGACTION_CLOSE_MAGNIFIER: { - /* FIXME : Temporary way of clearing magnifier window */ - CSCLGraphics *graphics = CSCLGraphics::get_instance(); - CSCLUtils *utils = CSCLUtils::get_instance(); - sclchar composed_path[_POSIX_PATH_MAX] = {0,}; - scldrawctx draw_ctx = graphics->begin_paint(windows->get_magnifier_window()); - SclResParserManager *sclres_manager = SclResParserManager::get_instance(); - PSclMagnifierWndConfigure magnifier_configure = NULL; - if (sclres_manager) { - magnifier_configure = sclres_manager->get_magnifier_configure(); - } - if (magnifier_configure) { - utils->get_composed_path(composed_path, IMG_PATH_PREFIX, magnifier_configure->bg_image_path); - graphics->draw_image(windows->get_magnifier_window(), draw_ctx, composed_path, 0, 0); - graphics->end_paint(windows->get_magnifier_window(), draw_ctx); + if (signal == SCL_SIG_HIDE) { + windows->hide_window(windows->get_magnifier_window(), TRUE); + } else { + windows->hide_window(windows->get_magnifier_window()); } } - - if (signal == SCL_SIG_HIDE) { - windows->hide_window(windows->get_magnifier_window(), TRUE); - } else { - windows->hide_window(windows->get_magnifier_window()); - } //events->create_timer(SCL_TIMER_BUTTON_DELAY, SCL_BUTTON_MIN_DURATION, 0); break; case SIGACTION_UNSET_SHIFT: { diff --git a/scl/scluibuilder.cpp b/scl/scluibuilder.cpp index 421c781..8dad34a 100644 --- a/scl/scluibuilder.cpp +++ b/scl/scluibuilder.cpp @@ -198,6 +198,8 @@ CSCLUIBuilder::show_layout(const sclwindow window, const scl16 x, const scl16 y, } else { /* For the base and popup window */ const SclLayout* layout = cache->get_cur_layout(window); + // FIXME implement later + // SclLayoutInfoCache *info_cache = cache->get_cur_layout_info_cache(window); if (layout) { CSCLWindows *windows = CSCLWindows::get_instance(); //SclWindowContext *winctx = windows->get_window_context(window, FALSE); @@ -227,11 +229,18 @@ CSCLUIBuilder::show_layout(const sclwindow window, const scl16 x, const scl16 y, } } if (strlen(layout->image_path[BUTTON_STATE_NORMAL]) > 0) { + /*SclImageCachedInfo cached_info = {0, }; + cached_info.nine_patch_left = info_cache->bg_image_path[BUTTON_STATE_NORMAL].left; + cached_info.nine_patch_right = info_cache->bg_image_path[BUTTON_STATE_NORMAL].right; + cached_info.nine_patch_top = info_cache->bg_image_path[BUTTON_STATE_NORMAL].top; + cached_info.nine_patch_bottom = info_cache->bg_image_path[BUTTON_STATE_NORMAL].bottom;*/ + sclchar composed_path[_POSIX_PATH_MAX] = {0,}; m_utils->get_composed_path(composed_path, IMG_PATH_PREFIX, layout->image_path[BUTTON_STATE_NORMAL]); // Temporary testing for EFL backend.. Otherwise the background image covers other buttons if (winctx && (x + y + width + height == 0)) { - graphics->draw_image(targetwin, draw_ctx, composed_path, targetx, targety, layout->width, layout->height, + //graphics->draw_image(targetwin, draw_ctx, composed_path, &cached_info, targetx, targety, layout->width, layout->height, winctx->layout_image_offset.x, winctx->layout_image_offset.y, -1, -1, layout->extract_background); + graphics->draw_image(targetwin, draw_ctx, composed_path, NULL, targetx, targety, layout->width, layout->height, winctx->layout_image_offset.x, winctx->layout_image_offset.y, -1, -1, layout->extract_background); } } @@ -471,10 +480,21 @@ CSCLUIBuilder::draw_button_label(const sclwindow window, const scldrawctx draw_c pos.y = coordination->y + ((coordination->height - imgSize.height) / 2); } + /* + graphics->draw_image( + targetwin, + draw_ctx, + composed_path, + pos.x + targetaddx, + pos.y + targetaddy, + imgSize.width, + imgSize.height + );*/ graphics->draw_image( targetwin, draw_ctx, composed_path, + NULL, pos.x + targetaddx, pos.y + targetaddy, imgSize.width, @@ -541,6 +561,7 @@ CSCLUIBuilder::draw_button_label(const sclwindow window, const scldrawctx draw_c info, labelproperties->shadow_color[shiftstate][state], label, + NULL, (sclint)coordination->x + deltax + targetaddx, (sclint)coordination->y + deltax + targetaddy, (sclint)coordination->width, @@ -558,6 +579,7 @@ CSCLUIBuilder::draw_button_label(const sclwindow window, const scldrawctx draw_c info, labelproperties->font_color[shiftstate][state], label, + NULL, (sclint)coordination->x + targetaddx, (sclint)coordination->y + targetaddy, (sclint)coordination->width, @@ -760,6 +782,7 @@ CSCLUIBuilder::draw_button_bg_by_img(const sclwindow window, const scldrawctx dr targetwin, draw_ctx, composed_path, + NULL, (sclint)targetx, (sclint)targety, (sclint)coordination->width, @@ -867,6 +890,7 @@ CSCLUIBuilder::draw_button_bg_by_layoutimg(const sclwindow window, const scldraw window, draw_ctx, composed_path, + NULL, dest_x, dest_y, (sclint)coordination->width, @@ -993,20 +1017,20 @@ CSCLUIBuilder::show_magnifier(const sclwindow window, scldrawctx draw_ctx) } if (state->get_cur_action_state() == ACTION_STATE_BASE_LONGKEY) { m_utils->get_composed_path(composed_path, IMG_PATH_PREFIX, magnifier_configure->bg_long_key_image_path); - m_gwes->m_graphics->draw_image(window, draw_ctx, composed_path, 0, 0, + m_gwes->m_graphics->draw_image(window, draw_ctx, composed_path, NULL, 0, 0, magnifier_configure->width, magnifier_configure->height); } else { if (context->get_shift_state() == SCL_SHIFT_STATE_LOCK) { m_utils->get_composed_path(composed_path, IMG_PATH_PREFIX, magnifier_configure->bg_shift_lock_image_path); - m_gwes->m_graphics->draw_image(window, draw_ctx, composed_path, 0, 0, + m_gwes->m_graphics->draw_image(window, draw_ctx, composed_path, NULL, 0, 0, magnifier_configure->width, magnifier_configure->height); } else if (context->get_shift_state() == SCL_SHIFT_STATE_ON) { m_utils->get_composed_path(composed_path, IMG_PATH_PREFIX, magnifier_configure->bg_shift_image_path); - m_gwes->m_graphics->draw_image(window, draw_ctx, composed_path, 0, 0, + m_gwes->m_graphics->draw_image(window, draw_ctx, composed_path, NULL, 0, 0, magnifier_configure->width, magnifier_configure->height); } else { m_utils->get_composed_path(composed_path, IMG_PATH_PREFIX, magnifier_configure->bg_image_path); - m_gwes->m_graphics->draw_image(window, draw_ctx, composed_path, 0, 0, + m_gwes->m_graphics->draw_image(window, draw_ctx, composed_path, NULL, 0, 0, magnifier_configure->width, magnifier_configure->height); } } @@ -1112,6 +1136,7 @@ CSCLUIBuilder::draw_magnifier_label(const sclwindow window, const scldrawctx dra info, labelproperties->font_color[shiftstate][BUTTON_STATE_NORMAL], label, + NULL, magnifier_configure->label_area_rect.left, magnifier_configure->label_area_rect.top, magnifier_configure->label_area_rect.right, diff --git a/scl/sclwindows.cpp b/scl/sclwindows.cpp index c0b93fc..9ad9fa9 100644 --- a/scl/sclwindows.cpp +++ b/scl/sclwindows.cpp @@ -103,7 +103,7 @@ CSCLWindows::get_instance() return (CSCLWindows*)m_instance; } -sclwindow CSCLWindows::open_popup(const SclWindowOpener opener, const SclRectangle geometry, sclshort inputmode, sclshort layout, SCLPopupType popup_type, sclboolean is_virtual, sclboolean use_dim_window, sclint img_offset_x, sclint img_offset_y, sclint timeout) +sclwindow CSCLWindows::open_popup(const SclWindowOpener opener, const SclRectangle &geometry, sclshort inputmode, sclshort layout, SCLPopupType popup_type, sclboolean is_virtual, sclboolean use_dim_window, sclint img_offset_x, sclint img_offset_y, sclint timeout) { sclwindow window = SCLWINDOW_INVALID; @@ -267,7 +267,7 @@ bool CSCLWindows::close_all_popups(sclwindow skip_window /* = SCLWINDOW_INVALID } sclwindow -CSCLWindows::create_base_window(const sclwindow parent, const scl16 width, const scl16 height) +CSCLWindows::create_base_window(const sclwindow parent, scl16 width, scl16 height) { SCL_DEBUG(); @@ -302,7 +302,7 @@ CSCLWindows::create_base_window(const sclwindow parent, const scl16 width, const * } */ sclwindow -CSCLWindows::create_window(const SclWindowOpener opener, const SclRectangle geometry, sclshort inputmode, sclshort layout, SCLPopupType popup_type, sclboolean is_virtual, sclint img_offset_x, sclint img_offset_y, sclint timeout) +CSCLWindows::create_window(const SclWindowOpener opener, const SclRectangle &geometry, sclshort inputmode, sclshort layout, SCLPopupType popup_type, sclboolean is_virtual, sclint img_offset_x, sclint img_offset_y, sclint timeout) { SCL_DEBUG(); @@ -354,7 +354,7 @@ CSCLWindows::create_window(const SclWindowOpener opener, const SclRectangle geom } sclwindow -CSCLWindows::create_magnifier_window(const sclwindow parent, const scl16 x, const scl16 y, const scl16 width, const scl16 height) +CSCLWindows::create_magnifier_window(const sclwindow parent, scl16 x, scl16 y, scl16 width, scl16 height) { SCL_DEBUG(); @@ -397,7 +397,7 @@ CSCLWindows::get_magnifier_window() } sclwindow -CSCLWindows::create_dim_window(const sclwindow parent, SclWindowContext *winctx, const scl16 width, const scl16 height) +CSCLWindows::create_dim_window(const sclwindow parent, SclWindowContext *winctx, scl16 width, scl16 height) { SCL_DEBUG(); @@ -603,7 +603,7 @@ CSCLWindows::find_popup_window_index(sclwindow window) } void -CSCLWindows::move_window(const sclwindow window, const scl16 x, const scl16 y) +CSCLWindows::move_window(const sclwindow window, scl16 x, scl16 y) { SCL_DEBUG(); @@ -639,7 +639,7 @@ CSCLWindows::move_window(const sclwindow window, const scl16 x, const scl16 y) } void -CSCLWindows::resize_window(const sclwindow window, const scl16 width, const scl16 height) +CSCLWindows::resize_window(const sclwindow window, scl16 width, scl16 height) { SCL_DEBUG(); @@ -675,7 +675,7 @@ CSCLWindows::resize_window(const sclwindow window, const scl16 width, const scl1 } void -CSCLWindows::move_resize_window(const sclwindow window, const scl16 x, const scl16 y, const scl16 width, const scl16 height) +CSCLWindows::move_resize_window(const sclwindow window, scl16 x, scl16 y, scl16 width, scl16 height) { SCL_DEBUG(); @@ -812,7 +812,7 @@ void CSCLWindows::set_parent( const sclwindow parent, const sclwindow window ) } } -void CSCLWindows::set_window_rotation(const sclwindow window, const SCLRotation rotation) +void CSCLWindows::set_window_rotation(const sclwindow window, SCLRotation rotation) { SCL_DEBUG(); @@ -903,7 +903,7 @@ CSCLWindows::show_window(const sclwindow window, sclboolean queue /*= FALSE*/) } void -CSCLWindows::hide_window(const sclwindow window, const sclboolean force /*= FALSE*/) +CSCLWindows::hide_window(const sclwindow window, sclboolean force /*= FALSE*/) { SCL_DEBUG(); @@ -929,7 +929,7 @@ CSCLWindows::hide_window(const sclwindow window, const sclboolean force /*= FALS } void -CSCLWindows::set_keep_above(const sclwindow window, const sclboolean keep_above) +CSCLWindows::set_keep_above(const sclwindow window, sclboolean keep_above) { CSCLWindowsImpl* impl = get_scl_windows_impl(); if (impl) { @@ -953,8 +953,8 @@ CSCLWindows::get_update_pending() } void -CSCLWindows::update_window(const sclwindow window, - const scl16 x /*= 0*/, const scl16 y /*= 0*/, const scl16 width /*= 0*/, const scl16 height /*= 0*/ ) +CSCLWindows::update_window(const sclwindow window, + scl16 x /*= 0*/, scl16 y /*= 0*/, scl16 width /*= 0*/, scl16 height /*= 0*/ ) { if (!m_pending_update) { CSCLWindowsImpl* impl = get_scl_windows_impl(); @@ -967,7 +967,7 @@ CSCLWindows::update_window(const sclwindow window, sclboolean CSCLWindows::get_window_rect(const sclwindow window, SclRectangle *rect) { SCL_DEBUG(); - + sclboolean is_virtual = FALSE; sclboolean ret = FALSE; if (rect) { -- 2.7.4