hermet pushed a commit to branch master.

http://git.enlightenment.org/tools/enventor.git/commit/?id=3bb0eb04e7861d855236108d26dd1593451d265a

commit 3bb0eb04e7861d855236108d26dd1593451d265a
Author: Hermet Park <her...@hermet.pe.kr>
Date:   Fri Feb 5 20:11:24 2016 +0900

    remove the concept of resizable view size.
    
    As far as I reviewed, this function is useless.
    We remove it because now people can control the exact size of view.
---
 src/bin/config_data.c     | 24 +++---------------------
 src/bin/main.c            | 25 +++++--------------------
 src/bin/setting.c         | 36 ++++++++----------------------------
 src/bin/statusbar.c       | 15 +++------------
 src/include/common.h      |  2 +-
 src/include/config_data.h |  2 --
 6 files changed, 20 insertions(+), 84 deletions(-)

diff --git a/src/bin/config_data.c b/src/bin/config_data.c
index 981cc7d..cb7ba48 100644
--- a/src/bin/config_data.c
+++ b/src/bin/config_data.c
@@ -37,7 +37,6 @@ typedef struct config_s
    Eina_Bool tools;
    Eina_Bool console;
    Eina_Bool auto_complete;
-   Eina_Bool view_size_configurable;
    Eina_Bool smart_undo_redo;
 } config_data;
 
@@ -167,6 +166,8 @@ config_load(void)
         cd->dat_path_list = NULL;
         cd->font_scale = 1;
         cd->view_scale = 1;
+        cd->view_size_w = 300;
+        cd->view_size_h = 300;
         cd->editor_size = DEFAULT_EDITOR_SIZE;
         cd->console_size = DEFAULT_CONSOLE_SIZE;
         cd->stats_bar = EINA_TRUE;
@@ -177,7 +178,6 @@ config_load(void)
         cd->tools = EINA_TRUE;
         cd->console = EINA_TRUE;
         cd->auto_complete = EINA_TRUE;
-        cd->view_size_configurable = EINA_FALSE;
         cd->version = ENVENTOR_CONFIG_VERSION;
         cd->smart_undo_redo = EINA_FALSE;
      }
@@ -281,9 +281,6 @@ eddc_init(void)
                                  console, EET_T_UCHAR);
    EET_DATA_DESCRIPTOR_ADD_BASIC(edd_base, config_data, "auto_complete",
                                     auto_complete, EET_T_UCHAR);
-   EET_DATA_DESCRIPTOR_ADD_BASIC(edd_base, config_data,
-                                 "view_size_configurable",
-                                 view_size_configurable, EET_T_UCHAR);
    EET_DATA_DESCRIPTOR_ADD_BASIC(edd_base, config_data, "smart_undo_redo",
                                     smart_undo_redo, EET_T_UCHAR);
 }
@@ -780,8 +777,7 @@ double
 config_view_scale_get(void)
 {
    config_data *cd = g_cd;
-   if (cd->view_size_configurable) return cd->view_scale;
-   else return 1;
+   return cd->view_scale;
 }
 
 void
@@ -802,20 +798,6 @@ config_view_size_get(Evas_Coord *w, Evas_Coord *h)
    if (h) *h = cd->view_size_h;
 }
 
-void
-config_view_size_configurable_set(Eina_Bool configurable)
-{
-   config_data *cd = g_cd;
-   cd->view_size_configurable = configurable;
-}
-
-Eina_Bool
-config_view_size_configurable_get(void)
-{
-   config_data *cd = g_cd;
-   return cd->view_size_configurable;
-}
-
 double
 config_editor_size_get(void)
 {
diff --git a/src/bin/main.c b/src/bin/main.c
index b91314a..a2803c0 100644
--- a/src/bin/main.c
+++ b/src/bin/main.c
@@ -134,13 +134,7 @@ config_update_cb(void *data)
 
    //Live View Size
    Evas_Coord w, h;
-   if (config_view_size_configurable_get())
-     config_view_size_get(&w, &h);
-   else
-     {
-        w = 0;
-        h = 0;
-     }
+   config_view_size_get(&w, &h);
    enventor_object_live_view_size_set(enventor, w, h);
    stats_view_scale_update(config_view_scale_get());
    base_tools_toggle(EINA_FALSE);
@@ -173,14 +167,9 @@ main_mouse_wheel_cb(void *data, int type EINA_UNUSED, void 
*ev)
         scale = config_view_scale_get();
         enventor_object_live_view_scale_set(ad->enventor, scale);
 
-        //Toggle on the configurable view size forcely.
-        if (!config_view_size_configurable_get())
-          {
-             config_view_size_configurable_set(EINA_TRUE);
-             Evas_Coord w, h;
-             config_view_size_get(&w, &h);
-             enventor_object_live_view_size_set(base_enventor_get(), w, h);
-          }
+        Evas_Coord w, h;
+        config_view_size_get(&w, &h);
+        enventor_object_live_view_size_set(base_enventor_get(), w, h);
 
         //Just in live edit mode case.
         live_edit_update();
@@ -430,17 +419,13 @@ enventor_live_view_resized_cb(void *data EINA_UNUSED,
    if (!config_stats_bar_get()) return;
    Enventor_Live_View_Size *size = event_info;
    stats_view_size_update(size->w, size->h);
-
-   if (!config_view_size_configurable_get())
-     config_view_size_set(size->w, size->h);
+   config_view_size_set(size->w, size->h);
 }
 
 static void
 enventor_live_view_loaded_cb(void *data EINA_UNUSED, Evas_Object *obj,
                              void *event_info EINA_UNUSED)
 {
-   if (!config_view_size_configurable_get()) return;
-
    Evas_Coord w, h;
    config_view_size_get(&w, &h);
    enventor_object_live_view_size_set(obj, w, h);
diff --git a/src/bin/setting.c b/src/bin/setting.c
index f3d5e2e..fc8813f 100644
--- a/src/bin/setting.c
+++ b/src/bin/setting.c
@@ -20,7 +20,6 @@ struct setting_s
    Evas_Object *slider_view;
    Evas_Object *view_size_w_entry;
    Evas_Object *view_size_h_entry;
-   Evas_Object *toggle_view_size;
    Evas_Object *toggle_highlight;
    Evas_Object *toggle_swallow;
    Evas_Object *toggle_stats;
@@ -125,7 +124,6 @@ setting_apply_btn_cb(void *data, Evas_Object *obj 
EINA_UNUSED,
    config_stats_bar_set(elm_check_state_get(sd->toggle_stats));
    config_part_highlight_set(elm_check_state_get(sd->toggle_highlight));
    config_dummy_parts_set(elm_check_state_get(sd->toggle_swallow));
-   
config_view_size_configurable_set(elm_check_state_get(sd->toggle_view_size));
    text_setting_config_set();
 
    Evas_Coord w = (Evas_Coord)atoi(elm_entry_entry_get(sd->view_size_w_entry));
@@ -216,17 +214,6 @@ toggle_create(Evas_Object *parent, const char *text, 
Eina_Bool state)
    return toggle;
 }
 
-static void
-toggle_view_size_changed_cb(void *data, Evas_Object *obj,
-                            void *event_info EINA_UNUSED)
-{
-   setting_data *sd = data;
-   Eina_Bool toggle_on = elm_check_state_get(obj);
-
-   elm_object_disabled_set(sd->view_size_w_entry, !toggle_on);
-   elm_object_disabled_set(sd->view_size_h_entry, !toggle_on);
-}
-
 static Evas_Object *
 general_layout_create(setting_data *sd, Evas_Object *parent)
 {
@@ -328,6 +315,12 @@ general_layout_create(setting_data *sd, Evas_Object 
*parent)
    elm_object_part_content_set(layout_padding3, "elm.swallow.content",
                                label_view_size);
 
+   //Spacer
+   Evas_Object *rect = evas_object_rectangle_add(evas_object_evas_get(box2));
+   evas_object_size_hint_weight_set(rect, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+   evas_object_size_hint_align_set(rect, EVAS_HINT_FILL, EVAS_HINT_FILL);
+   elm_box_pack_end(box2, rect);
+
    Evas_Coord w, h;
    char w_str[5], h_str[5];
    config_view_size_get(&w, &h);
@@ -337,7 +330,7 @@ general_layout_create(setting_data *sd, Evas_Object *parent)
    //Entry (View Width)
    Evas_Object *entry_view_size_w = entry_create(box2);
    evas_object_size_hint_weight_set(entry_view_size_w, 0.15, 0);
-   evas_object_size_hint_align_set(entry_view_size_w, EVAS_HINT_FILL, 0);
+   evas_object_size_hint_align_set(entry_view_size_w, 1.0, 0);
 
    digits_filter_data.accepted = "0123456789";
    digits_filter_data.rejected = NULL;
@@ -351,8 +344,6 @@ general_layout_create(setting_data *sd, Evas_Object *parent)
                                   &limit_filter_data);
 
    elm_object_text_set(entry_view_size_w, w_str);
-   elm_object_disabled_set(entry_view_size_w,
-                           !config_view_size_configurable_get());
    elm_box_pack_end(box2, entry_view_size_w);
 
    //Label (X)
@@ -362,7 +353,7 @@ general_layout_create(setting_data *sd, Evas_Object *parent)
    //Entry (View Height)
    Evas_Object *entry_view_size_h = entry_create(box2);
    evas_object_size_hint_weight_set(entry_view_size_h, 0.15, 0);
-   evas_object_size_hint_align_set(entry_view_size_h, EVAS_HINT_FILL, 0);
+   evas_object_size_hint_align_set(entry_view_size_h, 1.0, 0);
 
    elm_entry_markup_filter_append(entry_view_size_h,
                                   elm_entry_filter_accept_set,
@@ -372,18 +363,8 @@ general_layout_create(setting_data *sd, Evas_Object 
*parent)
                                   &limit_filter_data);
 
    elm_object_text_set(entry_view_size_h, h_str);
-   elm_object_disabled_set(entry_view_size_h,
-                           !config_view_size_configurable_get());
    elm_box_pack_end(box2, entry_view_size_h);
 
-   //Toggle (View Size)
-   Evas_Object *toggle_view_size;
-   toggle_view_size = toggle_create(box2, NULL,
-                                    config_view_size_configurable_get());
-   evas_object_smart_callback_add(toggle_view_size, "changed",
-                                  toggle_view_size_changed_cb, sd);
-   elm_box_pack_end(box2, toggle_view_size);
-
    //Toggle (Part Highlighting)
    Evas_Object *toggle_highlight = toggle_create(box, _("Part Highlighting"),
                                                  config_part_highlight_get());
@@ -417,7 +398,6 @@ general_layout_create(setting_data *sd, Evas_Object *parent)
    sd->slider_view = slider_view;
    sd->view_size_w_entry = entry_view_size_w;
    sd->view_size_h_entry = entry_view_size_h;
-   sd->toggle_view_size = toggle_view_size;
    sd->toggle_highlight = toggle_highlight;
    sd->toggle_swallow = toggle_swallow;
    sd->toggle_stats = toggle_stats;
diff --git a/src/bin/statusbar.c b/src/bin/statusbar.c
index 0390421..3662736 100644
--- a/src/bin/statusbar.c
+++ b/src/bin/statusbar.c
@@ -37,14 +37,9 @@ slider_changed_cb(void *data, Evas_Object *obj,
    scale = config_view_scale_get();
    enventor_object_live_view_scale_set(base_enventor_get(), scale);
 
-   //Toggle on the configurable view size forcely.
-   if (!config_view_size_configurable_get())
-     {
-        config_view_size_configurable_set(EINA_TRUE);
-        Evas_Coord w, h;
-        config_view_size_get(&w, &h);
-        enventor_object_live_view_size_set(base_enventor_get(), w, h);
-     }
+   Evas_Coord w, h;
+   config_view_size_get(&w, &h);
+   enventor_object_live_view_size_set(base_enventor_get(), w, h);
 
    //Just in live edit mode case.
    live_edit_update();
@@ -89,10 +84,6 @@ view_invert_btn_cb(void *data, Evas_Object *obj, void 
*event_info EINA_UNUSED)
 {
    stats_data *sd = data;
 
-   //Toggle on the configurable view size forcely.
-   if (!config_view_size_configurable_get())
-     config_view_size_configurable_set(EINA_TRUE);
-
    invert_data *id = malloc(sizeof(invert_data));
 
    Evas_Coord w, h;
diff --git a/src/include/common.h b/src/include/common.h
index 9e2a907..21d938a 100644
--- a/src/include/common.h
+++ b/src/include/common.h
@@ -57,7 +57,7 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n"
 
 #define ROUNDING(x, dig) (floor((x) * pow(10, dig) + 0.5) / pow(10, dig))
 
-#define ENVENTOR_CONFIG_VERSION 3
+#define ENVENTOR_CONFIG_VERSION 4
 
 #define EVENT_KEY_MODIFIER_CHECK(NAME, MASK) \
   ((MASK & ECORE_EVENT_MODIFIER_##NAME) && \
diff --git a/src/include/config_data.h b/src/include/config_data.h
index b246740..8abbf1f 100644
--- a/src/include/config_data.h
+++ b/src/include/config_data.h
@@ -30,8 +30,6 @@ void config_apply(void);
 void config_input_path_set(const char *input_path);
 void config_view_size_get(Evas_Coord *w, Evas_Coord *h);
 void config_view_size_set(Evas_Coord w, Evas_Coord h);
-Eina_Bool config_view_size_configurable_get(void);
-void config_view_size_configurable_set(Eina_Bool configurable);
 Eina_Bool config_part_highlight_get(void);
 void config_part_highlight_set(Eina_Bool highlight);
 Eina_Bool config_dummy_parts_get(void);

-- 


Reply via email to