summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYeongJong Lee <cleanlyj@naver.com>2016-11-29 12:51:29 +0900
committerHermet Park <hermet@hermet.pe.kr>2016-11-29 12:51:29 +0900
commitc13134d6095aba439c2888056dd9e897844f1845 (patch)
tree3b80e9112de5146934b923992bac3771e6586b10
parentd796f89805a53c8d0ba519b4e9aa2229c8b018ed (diff)
file_browser: Add dragable bar for file_browser
Summary: file_browser can be resized. Test Plan: 1. Run enventor 2-1. Drag the bar between file_browser and live view 2-2. Toggle file_browser using key F9 3. Check file_browser size is saved after restart envertor Reviewers: Jaehyun_Cho, Hermet Differential Revision: https://phab.enlightenment.org/D4431
-rw-r--r--data/themes/default/layout_common.edc167
-rw-r--r--src/bin/base_gui.c24
-rw-r--r--src/bin/config_data.c22
-rw-r--r--src/bin/file_browser.c75
-rw-r--r--src/include/common.h2
-rw-r--r--src/include/config_data.h2
-rw-r--r--src/include/file_browser.h4
7 files changed, 291 insertions, 5 deletions
diff --git a/data/themes/default/layout_common.edc b/data/themes/default/layout_common.edc
index e912c72..2c02872 100644
--- a/data/themes/default/layout_common.edc
+++ b/data/themes/default/layout_common.edc
@@ -12,6 +12,8 @@ images {
12 image: "navi_group.png" COMP; 12 image: "navi_group.png" COMP;
13 image: "bg_demo.png" COMP; 13 image: "bg_demo.png" COMP;
14 image: "help_bg.png" COMP; 14 image: "help_bg.png" COMP;
15 image: "downlight_glow_left.png" COMP;
16 image: "downlight_glow_right.png" COMP;
15} 17}
16 18
17group { "fileselector_layout"; 19group { "fileselector_layout";
@@ -2396,13 +2398,16 @@ group { "main_layout";
2396 to_y: "elm.swallow.file_tab"; 2398 to_y: "elm.swallow.file_tab";
2397 } 2399 }
2398 align: 1 0; 2400 align: 1 0;
2399 min: 200 0;
2400 fixed: 1 0; 2401 fixed: 1 0;
2401 visible: 0; 2402 visible: 0;
2402 } 2403 }
2403 desc { "visible"; 2404 desc { "visible";
2404 inherit: "default"; 2405 inherit: "default";
2405 align: 0 0; 2406 rel2 {
2407 relative: 1.0 0.0;
2408 to_x: "elm.bar.left";
2409 to_y: "elm.swallow.file_tab";
2410 }
2406 visible: 1; 2411 visible: 1;
2407 } 2412 }
2408 } 2413 }
@@ -2435,6 +2440,132 @@ group { "main_layout";
2435 visible: 1; 2440 visible: 1;
2436 } 2441 }
2437 } 2442 }
2443 spacer { "whole_left";
2444 desc { "default";
2445 rel2.relative: 0.0 1.0;
2446 rel2.to: "elm.swallow.edc_navigator";
2447 }
2448 }
2449 spacer { "elm.bar.left";
2450 dragable { confine: "whole_left";
2451 x: 1 1 1;
2452 y: 0 0 0;
2453 }
2454 desc { "default";
2455 max: 0 99999;
2456 min: 0 14;
2457 fixed: 1 1;
2458 rel1.relative: 0.0 0.5;
2459 rel2.relative: 1.0 0.5;
2460 }
2461 }
2462 spacer { "elm.bar.event_left";
2463 desc { "default";
2464 rel1.to_x: "elm.bar.left";
2465 rel2.to_x: "elm.bar.left";
2466 rel2.to_y: "elm.swallow.file_tab";
2467 rel2.relative: 1.0 0.0;
2468 }
2469 }
2470 swallow { "bar_left";
2471 dragable.events: "elm.bar.left";
2472 desc { "default";
2473 min: 10 0;
2474 max: 99999 99999;
2475 fixed: 1 0;
2476 rel1.to_x: "elm.bar.event_left";
2477 rel1.relative: 0.0 0.25;
2478 rel2.to: "elm.bar.event_left";
2479 rel2.relative: 1.0 0.75;
2480 color: 0 0 0 0;
2481 }
2482 }
2483 rect { "bar_left1";
2484 repeat_events: 1;
2485 desc { "default";
2486 fixed: 1 1;
2487 rel1.to: "bar_left";
2488 rel2.to: "bar_left";
2489 rel2.relative: 0.5 1.0;
2490 color: 0 0 0 0;
2491 }
2492 }
2493 rect { "bar_left2";
2494 repeat_events: 1;
2495 desc { "default";
2496 fixed: 1 1;
2497 rel1.to: "bar_left";
2498 rel1.relative: 0.5 0.0;
2499 rel2.to: "bar_left";
2500 color: 0 0 0 0;
2501 }
2502 }
2503 image { "glow1a_left";
2504 nomouse;
2505 desc { "default";
2506 image.normal: "downlight_glow_left.png";
2507 image.border: 0 3 0 0;
2508 max: 32 99999;
2509 rel2.to_x: "elm.bar.left";
2510 rel2.to_y: "elm.swallow.file_tab";
2511 rel2.relative: 1.0 0.0;
2512 color: 255 255 255 0;
2513 align: 1.0 0.5;
2514 }
2515 desc { "active";
2516 inherit: "default";
2517 color: 255 255 255 255;
2518 }
2519 }
2520 image { "glow1b_left";
2521 nomouse;
2522 desc { "default";
2523 image.normal: "downlight_glow_right.png";
2524 max: 4 99999;
2525 rel1.to_x: "elm.bar.left";
2526 rel2.to_y: "elm.swallow.file_tab";
2527 rel2.relative: 1.0 0.0;
2528 color: 255 255 255 0;
2529 align: 0.0 0.5;
2530 }
2531 desc { "active";
2532 inherit: "default";
2533 color: 255 255 255 255;
2534 }
2535 }
2536 image { "glow2a_left";
2537 nomouse;
2538 desc { "default";
2539 image.normal: "downlight_glow_left.png";
2540 max: 4 99999;
2541 rel2.to_x: "elm.bar.left";
2542 rel2.to_y: "elm.swallow.file_tab";
2543 rel2.relative: 1.0 0.0;
2544 color: 255 255 255 0;
2545 align: 1.0 0.5;
2546 }
2547 desc { "active";
2548 inherit: "default";
2549 color: 255 255 255 255;
2550 }
2551 }
2552 image { "glow2b_left";
2553 nomouse;
2554 desc { "default";
2555 image.normal: "downlight_glow_right.png";
2556 image.border: 0 3 0 0;
2557 max: 32 99999;
2558 rel1.to_x: "elm.bar.left";
2559 rel2.to_y: "elm.swallow.file_tab";
2560 rel2.relative: 1.0 0.0;
2561 color: 255 255 255 0;
2562 align: 0.0 0.5;
2563 }
2564 desc { "active";
2565 inherit: "default";
2566 color: 255 255 255 255;
2567 }
2568 }
2438 } 2569 }
2439 programs { 2570 programs {
2440 program { "file_browser_show"; 2571 program { "file_browser_show";
@@ -2448,6 +2579,10 @@ group { "main_layout";
2448 action: STATE_SET "default"; 2579 action: STATE_SET "default";
2449 target: "elm.swallow.file_browser"; 2580 target: "elm.swallow.file_browser";
2450 transition: DECELERATE 0.25; 2581 transition: DECELERATE 0.25;
2582 after: "file_browser_hide_done";
2583 }
2584 program { "file_browser_hide_done";
2585 action: SIGNAL_EMIT "elm,state,file_browser_hide,done" "";
2451 } 2586 }
2452 program { "edc_navigator_show"; 2587 program { "edc_navigator_show";
2453 signal: "elm,state,edc_navigator,show"; 2588 signal: "elm,state,edc_navigator,show";
@@ -2496,6 +2631,34 @@ group { "main_layout";
2496 target: "error_alert"; 2631 target: "error_alert";
2497 transition: DECELERATE 1; 2632 transition: DECELERATE 1;
2498 } 2633 }
2634 program { "left_bar_mouse_in1";
2635 signal: "mouse,in"; source: "bar_left1";
2636 action: STATE_SET "active";
2637 transition: BOUNCE 0.4 0.5 4;
2638 target: "glow1a_left";
2639 target: "glow1b_left";
2640 }
2641 program { "left_bar_mouse_out1";
2642 signal: "mouse,out"; source: "bar_left1";
2643 action: STATE_SET "default";
2644 transition: DECELERATE 0.5;
2645 target: "glow1a_left";
2646 target: "glow1b_left";
2647 }
2648 program { "left_bar_mouse_in2";
2649 signal: "mouse,in"; source: "bar_left2";
2650 action: STATE_SET "active";
2651 transition: BOUNCE 0.4 0.5 4;
2652 target: "glow2a_left";
2653 target: "glow2b_left";
2654 }
2655 program { "left_bar_mouse_out2";
2656 signal: "mouse,out"; source: "bar_left2";
2657 action: STATE_SET "default";
2658 transition: DECELERATE 0.5;
2659 target: "glow2a_left";
2660 target: "glow2b_left";
2661 }
2499 } 2662 }
2500} 2663}
2501 2664
diff --git a/src/bin/base_gui.c b/src/bin/base_gui.c
index 3e4f5e7..e754db7 100644
--- a/src/bin/base_gui.c
+++ b/src/bin/base_gui.c
@@ -105,6 +105,18 @@ base_file_tab_toggle(Eina_Bool toggle)
105 } 105 }
106} 106}
107 107
108static void
109file_browser_hide_done(void *data, Evas_Object *obj EINA_UNUSED,
110 const char *emission EINA_UNUSED,
111 const char *source EINA_UNUSED)
112{
113 base_data *bd = data;
114 elm_object_signal_callback_del(bd->layout,
115 "elm,state,file_browser_hide,done", "",
116 file_browser_hide_done);
117 file_browser_hide();
118}
119
108void 120void
109base_file_browser_toggle(Eina_Bool toggle) 121base_file_browser_toggle(Eina_Bool toggle)
110{ 122{
@@ -114,9 +126,17 @@ base_file_browser_toggle(Eina_Bool toggle)
114 if (toggle) config_file_browser_set(!config_file_browser_get()); 126 if (toggle) config_file_browser_set(!config_file_browser_get());
115 127
116 if (config_file_browser_get()) 128 if (config_file_browser_get())
117 elm_object_signal_emit(bd->layout, "elm,state,file_browser,show", ""); 129 {
130 elm_object_signal_emit(bd->layout, "elm,state,file_browser,show", "");
131 file_browser_show();
132 }
118 else 133 else
119 elm_object_signal_emit(bd->layout, "elm,state,file_browser,hide", ""); 134 {
135 elm_object_signal_callback_add(bd->layout,
136 "elm,state,file_browser_hide,done", "",
137 file_browser_hide_done, bd);
138 elm_object_signal_emit(bd->layout, "elm,state,file_browser,hide", "");
139 }
120} 140}
121 141
122void 142void
diff --git a/src/bin/config_data.c b/src/bin/config_data.c
index 658ef28..4419dd6 100644
--- a/src/bin/config_data.c
+++ b/src/bin/config_data.c
@@ -23,6 +23,7 @@ typedef struct config_s
23 float font_scale; 23 float font_scale;
24 double editor_size; 24 double editor_size;
25 double console_size; 25 double console_size;
26 double file_browser_size;
26 27
27 void (*update_cb)(void *data); 28 void (*update_cb)(void *data);
28 void *update_cb_data; 29 void *update_cb_data;
@@ -184,6 +185,7 @@ config_load(void)
184 cd->win_size_h = WIN_DEFAULT_H; 185 cd->win_size_h = WIN_DEFAULT_H;
185 cd->editor_size = DEFAULT_EDITOR_SIZE; 186 cd->editor_size = DEFAULT_EDITOR_SIZE;
186 cd->console_size = DEFAULT_CONSOLE_SIZE; 187 cd->console_size = DEFAULT_CONSOLE_SIZE;
188 cd->file_browser_size = DEFAULT_FILE_BROWSER_SIZE;
187 cd->stats_bar = EINA_TRUE; 189 cd->stats_bar = EINA_TRUE;
188 cd->linenumber = EINA_TRUE; 190 cd->linenumber = EINA_TRUE;
189 cd->part_highlight = EINA_TRUE; 191 cd->part_highlight = EINA_TRUE;
@@ -287,6 +289,8 @@ eddc_init(void)
287 editor_size, EET_T_DOUBLE); 289 editor_size, EET_T_DOUBLE);
288 EET_DATA_DESCRIPTOR_ADD_BASIC(edd_base, config_data, "console_size", 290 EET_DATA_DESCRIPTOR_ADD_BASIC(edd_base, config_data, "console_size",
289 console_size, EET_T_DOUBLE); 291 console_size, EET_T_DOUBLE);
292 EET_DATA_DESCRIPTOR_ADD_BASIC(edd_base, config_data, "file_browser_size",
293 file_browser_size, EET_T_DOUBLE);
290 EET_DATA_DESCRIPTOR_ADD_BASIC(edd_base, config_data, "view_size_w", 294 EET_DATA_DESCRIPTOR_ADD_BASIC(edd_base, config_data, "view_size_w",
291 view_size_w, EET_T_INT); 295 view_size_w, EET_T_INT);
292 EET_DATA_DESCRIPTOR_ADD_BASIC(edd_base, config_data, "view_size_h", 296 EET_DATA_DESCRIPTOR_ADD_BASIC(edd_base, config_data, "view_size_h",
@@ -1061,6 +1065,24 @@ config_file_browser_get(void)
1061} 1065}
1062 1066
1063void 1067void
1068config_file_browser_size_set(double size)
1069{
1070 config_data *cd = g_cd;
1071 EINA_SAFETY_ON_NULL_RETURN(cd);
1072
1073 cd->file_browser_size = size;
1074}
1075
1076double
1077config_file_browser_size_get(void)
1078{
1079 config_data *cd = g_cd;
1080 EINA_SAFETY_ON_NULL_RETURN_VAL(cd, 0.0);
1081
1082 return cd->file_browser_size;
1083}
1084
1085void
1064config_edc_navigator_set(Eina_Bool enabled) 1086config_edc_navigator_set(Eina_Bool enabled)
1065{ 1087{
1066 config_data *cd = g_cd; 1088 config_data *cd = g_cd;
diff --git a/src/bin/file_browser.c b/src/bin/file_browser.c
index eb65bb2..58ceaf2 100644
--- a/src/bin/file_browser.c
+++ b/src/bin/file_browser.c
@@ -624,6 +624,44 @@ show_all_check_changed_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
624 } 624 }
625} 625}
626 626
627static void
628dragable_bar_mouse_up_cb(void *data, Evas *e EINA_UNUSED,
629 Evas_Object *obj EINA_UNUSED,
630 void *event_info EINA_UNUSED)
631{
632 Evas_Object *main_layout = data;
633 if (!main_layout) return;
634
635 double w;
636 edje_object_part_drag_value_get
637 (elm_layout_edje_get(main_layout), "elm.bar.left", &w, NULL);
638 if (w < 0.01)
639 {
640 config_file_browser_set(EINA_FALSE);
641 tools_file_browser_update(EINA_FALSE);
642 config_file_browser_size_set(0.0);
643 }
644 else
645 config_file_browser_size_set(w);
646}
647
648static void
649dragable_bar_mouse_down_cb(void *data, Evas *e EINA_UNUSED,
650 Evas_Object *obj EINA_UNUSED,
651 void *event_info EINA_UNUSED)
652{
653 Evas_Object *main_layout = data;
654 if (!main_layout) return;
655
656 double w;
657 edje_object_part_drag_value_get
658 (elm_layout_edje_get(main_layout), "elm.bar.left", &w, NULL);
659 if (w < 0.01)
660 {
661 config_file_browser_set(EINA_TRUE);
662 tools_file_browser_update(EINA_FALSE);
663 }
664}
627/*****************************************************************************/ 665/*****************************************************************************/
628/* Externally accessible calls */ 666/* Externally accessible calls */
629/*****************************************************************************/ 667/*****************************************************************************/
@@ -772,11 +810,23 @@ file_browser_init(Evas_Object *parent)
772 search_itc->func.content_get = gl_search_content_get_cb; 810 search_itc->func.content_get = gl_search_content_get_cb;
773 bd->search_itc = search_itc; 811 bd->search_itc = search_itc;
774 812
813 //Dragable Bar
814 Evas_Object *bar = evas_object_rectangle_add(evas_object_evas_get(parent));
815 evas_object_color_set(bar, 0, 0, 0, 0);
816 evas_object_event_callback_add(bar, EVAS_CALLBACK_MOUSE_DOWN,
817 dragable_bar_mouse_down_cb, parent);
818 evas_object_event_callback_add(bar, EVAS_CALLBACK_MOUSE_UP,
819 dragable_bar_mouse_up_cb, parent);
820 elm_object_part_content_set(parent, "bar_left", bar);
821
775 bd->base_layout = base_layout; 822 bd->base_layout = base_layout;
776 bd->search_entry = search_entry; 823 bd->search_entry = search_entry;
777 bd->genlist = genlist; 824 bd->genlist = genlist;
778 bd->show_all_check = show_all_check; 825 bd->show_all_check = show_all_check;
779 826
827 if (config_file_browser_get())
828 config_file_browser_size_set(config_file_browser_size_get());
829
780 elm_object_disabled_set(base_layout, EINA_TRUE); 830 elm_object_disabled_set(base_layout, EINA_TRUE);
781 831
782 return base_layout; 832 return base_layout;
@@ -923,3 +973,28 @@ file_browser_selected_file_main_set(void)
923 config_input_path_set(file->path); 973 config_input_path_set(file->path);
924 elm_genlist_realized_items_update(bd->genlist); 974 elm_genlist_realized_items_update(bd->genlist);
925} 975}
976
977void
978file_browser_show()
979{
980 brows_data *bd = g_bd;
981 if (!bd) return;
982
983 Evas_Object *main_layout = evas_object_smart_parent_get(bd->base_layout);
984 if (!main_layout) return;
985
986 double w = config_file_browser_size_get();
987 edje_object_part_drag_value_set(main_layout, "elm.bar.left", w, 0.0);
988}
989
990void
991file_browser_hide()
992{
993 brows_data *bd = g_bd;
994 if (!bd) return;
995
996 Evas_Object *main_layout = evas_object_smart_parent_get(bd->base_layout);
997 if (!main_layout) return;
998
999 edje_object_part_drag_value_set(main_layout, "elm.bar.left", 0.0, 0.0);
1000}
diff --git a/src/include/common.h b/src/include/common.h
index 613f8f3..c490ca3 100644
--- a/src/include/common.h
+++ b/src/include/common.h
@@ -59,7 +59,7 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n"
59 59
60#define ROUNDING(x, dig) (floor((x) * pow(10, dig) + 0.5) / pow(10, dig)) 60#define ROUNDING(x, dig) (floor((x) * pow(10, dig) + 0.5) / pow(10, dig))
61 61
62#define ENVENTOR_CONFIG_VERSION 13 62#define ENVENTOR_CONFIG_VERSION 14
63 63
64#define EVENT_KEY_MODIFIER_CHECK(NAME, MASK) \ 64#define EVENT_KEY_MODIFIER_CHECK(NAME, MASK) \
65 ((MASK & ECORE_EVENT_MODIFIER_##NAME) && \ 65 ((MASK & ECORE_EVENT_MODIFIER_##NAME) && \
diff --git a/src/include/config_data.h b/src/include/config_data.h
index 31b902a..dba9e9f 100644
--- a/src/include/config_data.h
+++ b/src/include/config_data.h
@@ -63,6 +63,8 @@ void config_smart_undo_redo_set(Eina_Bool smart_undo_redo);
63Eina_Bool config_smart_undo_redo_get(void); 63Eina_Bool config_smart_undo_redo_get(void);
64void config_file_browser_set(Eina_Bool enabled); 64void config_file_browser_set(Eina_Bool enabled);
65Eina_Bool config_file_browser_get(void); 65Eina_Bool config_file_browser_get(void);
66void config_file_browser_size_set(double size);
67double config_file_browser_size_get(void);
66void config_edc_navigator_set(Eina_Bool enabled); 68void config_edc_navigator_set(Eina_Bool enabled);
67Eina_Bool config_edc_navigator_get(void); 69Eina_Bool config_edc_navigator_get(void);
68Eina_Bool config_mirror_mode_get(void); 70Eina_Bool config_mirror_mode_get(void);
diff --git a/src/include/file_browser.h b/src/include/file_browser.h
index e341d51..852095f 100644
--- a/src/include/file_browser.h
+++ b/src/include/file_browser.h
@@ -1,3 +1,5 @@
1#define DEFAULT_FILE_BROWSER_SIZE 0.3
2
1Evas_Object *file_browser_init(Evas_Object *parent); 3Evas_Object *file_browser_init(Evas_Object *parent);
2void file_browser_term(void); 4void file_browser_term(void);
3void file_browser_workspace_set(const char *workspace_dir); 5void file_browser_workspace_set(const char *workspace_dir);
@@ -7,3 +9,5 @@ void file_browser_refresh(void);
7void file_browser_selected_file_main_set(void); 9void file_browser_selected_file_main_set(void);
8void file_brwser_refresh(void); 10void file_brwser_refresh(void);
9void file_browser_main_file_unset(void); 11void file_browser_main_file_unset(void);
12void file_browser_show();
13void file_browser_hide();