Support individual group view scale.
Now, groups keep their own view scale on their own contexts. This will help user simultaneous group editing.
This commit is contained in:
parent
d57b173d39
commit
fd050aacf2
|
@ -21,7 +21,6 @@ typedef struct config_s
|
|||
|
||||
unsigned int version;
|
||||
float font_scale;
|
||||
double view_scale;
|
||||
double editor_size;
|
||||
double console_size;
|
||||
|
||||
|
@ -189,7 +188,6 @@ config_load(void)
|
|||
cd->fnt_path_list = NULL;
|
||||
cd->dat_path_list = NULL;
|
||||
cd->font_scale = 1;
|
||||
cd->view_scale = 1;
|
||||
cd->view_size_w = 300;
|
||||
cd->view_size_h = 300;
|
||||
cd->win_size_w = WIN_DEFAULT_W;
|
||||
|
@ -299,8 +297,6 @@ eddc_init(void)
|
|||
EET_T_STRING);
|
||||
EET_DATA_DESCRIPTOR_ADD_BASIC(edd_base, config_data, "font_scale", font_scale,
|
||||
EET_T_FLOAT);
|
||||
EET_DATA_DESCRIPTOR_ADD_BASIC(edd_base, config_data, "view_scale",
|
||||
view_scale, EET_T_DOUBLE);
|
||||
EET_DATA_DESCRIPTOR_ADD_BASIC(edd_base, config_data, "editor_size",
|
||||
editor_size, EET_T_DOUBLE);
|
||||
EET_DATA_DESCRIPTOR_ADD_BASIC(edd_base, config_data, "console_size",
|
||||
|
@ -939,28 +935,6 @@ config_auto_indent_set(Eina_Bool auto_indent)
|
|||
cd->auto_indent = auto_indent;
|
||||
}
|
||||
|
||||
void
|
||||
config_view_scale_set(double view_scale)
|
||||
{
|
||||
config_data *cd = g_cd;
|
||||
EINA_SAFETY_ON_NULL_RETURN(cd);
|
||||
|
||||
if (view_scale > MAX_VIEW_SCALE)
|
||||
view_scale = MAX_VIEW_SCALE;
|
||||
else if (view_scale < MIN_VIEW_SCALE)
|
||||
view_scale = MIN_VIEW_SCALE;
|
||||
cd->view_scale = view_scale;
|
||||
}
|
||||
|
||||
double
|
||||
config_view_scale_get(void)
|
||||
{
|
||||
config_data *cd = g_cd;
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(cd, 0);
|
||||
|
||||
return cd->view_scale;
|
||||
}
|
||||
|
||||
void
|
||||
config_view_size_set(Evas_Coord w, Evas_Coord h)
|
||||
{
|
||||
|
|
|
@ -344,7 +344,8 @@ live_edit_symbol_set(live_data *ld)
|
|||
snprintf(buf, sizeof(buf), "%s_bg", LIVEEDIT_ITEMS[ld->type].name);
|
||||
Evas_Object *layout_symbol = elm_layout_add(ld->layout);
|
||||
elm_layout_file_set(layout_symbol, EDJE_PATH, buf);
|
||||
elm_object_scale_set(layout_symbol, config_view_scale_get());
|
||||
elm_object_scale_set(layout_symbol,
|
||||
enventor_object_live_view_scale_get(base_enventor_get()));
|
||||
elm_object_part_content_set(ld->layout, "elm.swallow.symbol", layout_symbol);
|
||||
}
|
||||
|
||||
|
@ -2184,7 +2185,8 @@ live_edit_update(void)
|
|||
Evas_Object *layout_symbol =
|
||||
elm_object_part_content_get(ld->layout, "elm.swallow.symbol");
|
||||
if (layout_symbol)
|
||||
elm_object_scale_set(layout_symbol, config_view_scale_get());
|
||||
elm_object_scale_set(layout_symbol,
|
||||
enventor_object_live_view_scale_get(base_enventor_get()));
|
||||
|
||||
live_edit_update_internal(ld);
|
||||
}
|
||||
|
|
|
@ -36,7 +36,6 @@ enventor_common_setup(Enventor_Object *enventor)
|
|||
config_font_get(&font_name, &font_style);
|
||||
enventor_object_font_set(enventor, font_name, font_style);
|
||||
enventor_object_font_scale_set(enventor, config_font_scale_get());
|
||||
enventor_object_live_view_scale_set(enventor, config_view_scale_get());
|
||||
enventor_object_auto_indent_set(enventor, config_auto_indent_get());
|
||||
enventor_object_auto_complete_set(enventor, config_auto_complete_get());
|
||||
enventor_object_smart_undo_redo_set(enventor, config_smart_undo_redo_get());
|
||||
|
@ -123,7 +122,6 @@ config_update_cb(void *data EINA_UNUSED)
|
|||
|
||||
syntax_color_update(enventor);
|
||||
|
||||
stats_view_scale_update(config_view_scale_get());
|
||||
base_tools_toggle(EINA_FALSE);
|
||||
base_statusbar_toggle(EINA_FALSE);
|
||||
base_console_auto_hide();
|
||||
|
@ -145,13 +143,14 @@ main_mouse_wheel_cb(void *data EINA_UNUSED, int type EINA_UNUSED, void *ev)
|
|||
if ((event->x >= x) && (event->x <= (x + w)) &&
|
||||
(event->y >= y) && (event->y <= (y + h)))
|
||||
{
|
||||
double scale = config_view_scale_get();
|
||||
double scale = enventor_object_live_view_scale_get(base_enventor_get());
|
||||
|
||||
if (event->z < 0) scale += 0.05;
|
||||
else scale -= 0.05;
|
||||
|
||||
config_view_scale_set(scale);
|
||||
scale = config_view_scale_get();
|
||||
if (scale > MAX_VIEW_SCALE) scale = MAX_VIEW_SCALE;
|
||||
else if (scale < MIN_VIEW_SCALE) scale = MIN_VIEW_SCALE;
|
||||
|
||||
enventor_object_live_view_scale_set(base_enventor_get(), scale);
|
||||
|
||||
//Just in live edit mode case.
|
||||
|
@ -414,23 +413,28 @@ enventor_cursor_line_changed_cb(void *data EINA_UNUSED,
|
|||
}
|
||||
|
||||
static void
|
||||
enventor_cursor_group_changed_cb(void *data EINA_UNUSED,
|
||||
Enventor_Object *obj EINA_UNUSED,
|
||||
enventor_cursor_group_changed_cb(void *data EINA_UNUSED, Enventor_Object *obj,
|
||||
void *event_info)
|
||||
{
|
||||
const char *group_name = event_info;
|
||||
stats_edc_group_update(group_name);
|
||||
base_edc_navigator_group_update();
|
||||
|
||||
//Set default view size if this view has no size.
|
||||
//View Size
|
||||
int w, h;
|
||||
enventor_object_live_view_size_get(obj, &w, &h);
|
||||
|
||||
//Set default view size if this view has no size.
|
||||
if ((w == 0) && (h == 0))
|
||||
{
|
||||
config_view_size_get(&w, &h);
|
||||
enventor_object_live_view_size_set(obj, w, h);
|
||||
}
|
||||
stats_view_size_update(w, h);
|
||||
|
||||
//View Scale
|
||||
double scale = enventor_object_live_view_scale_get(obj);
|
||||
stats_view_scale_update(scale);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -845,7 +849,6 @@ statusbar_set()
|
|||
Evas_Object *obj = stats_init(base_layout_get());
|
||||
elm_object_part_content_set(base_layout_get(), "elm.swallow.statusbar", obj);
|
||||
base_statusbar_toggle(EINA_FALSE);
|
||||
stats_view_scale_update(config_view_scale_get());
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -37,8 +37,8 @@ view_scale_slider_changed_cb(void *data EINA_UNUSED, Evas_Object *obj,
|
|||
|
||||
/* Here logic is mostly duplicated with main_mouse_wheel_cb() in main.c */
|
||||
|
||||
config_view_scale_set(rounded);
|
||||
scale = config_view_scale_get();
|
||||
if (scale > MAX_VIEW_SCALE) scale = MAX_VIEW_SCALE;
|
||||
else if (scale < MIN_VIEW_SCALE) scale = MIN_VIEW_SCALE;
|
||||
enventor_object_live_view_scale_set(base_enventor_get(), scale);
|
||||
|
||||
//Just in live edit mode case.
|
||||
|
@ -221,7 +221,8 @@ view_scale_btn_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
|
|||
elm_slider_horizontal_set(slider, EINA_FALSE);
|
||||
elm_slider_inverted_set(slider, EINA_TRUE);
|
||||
elm_slider_min_max_set(slider, MIN_VIEW_SCALE, MAX_VIEW_SCALE);
|
||||
elm_slider_value_set(slider, (double) config_view_scale_get());
|
||||
elm_slider_value_set(slider,
|
||||
enventor_object_live_view_scale_get(base_enventor_get()));
|
||||
evas_object_smart_callback_add(slider, "changed",
|
||||
view_scale_slider_changed_cb, sd);
|
||||
|
||||
|
@ -364,6 +365,7 @@ stats_init(Evas_Object *parent)
|
|||
|
||||
stats_cursor_pos_update(0, 0, 0, 0);
|
||||
stats_edc_group_update(NULL);
|
||||
stats_view_scale_update(1.0);
|
||||
|
||||
return layout;
|
||||
}
|
||||
|
|
|
@ -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 11
|
||||
#define ENVENTOR_CONFIG_VERSION 12
|
||||
|
||||
#define EVENT_KEY_MODIFIER_CHECK(NAME, MASK) \
|
||||
((MASK & ECORE_EVENT_MODIFIER_##NAME) && \
|
||||
|
|
|
@ -47,8 +47,6 @@ void config_font_set(const char *font_name, const char *font_style);
|
|||
void config_font_get(const char **font_name, const char **font_style);
|
||||
void config_font_scale_set(float font_scale);
|
||||
float config_font_scale_get(void);
|
||||
void config_view_scale_set(double view_scale);
|
||||
double config_view_scale_get(void);
|
||||
Eina_Bool config_tools_get(void);
|
||||
void config_tools_set(Eina_Bool enabled);
|
||||
Eina_Bool config_config_get(void);
|
||||
|
|
|
@ -19,7 +19,6 @@ typedef struct edj_mgr_s
|
|||
edj_data *edj;
|
||||
Enventor_Object *enventor;
|
||||
Evas_Object *layout;
|
||||
double view_scale;
|
||||
|
||||
Eina_Bool reload_need : 1;
|
||||
} edj_mgr;
|
||||
|
@ -87,7 +86,6 @@ edj_mgr_init(Enventor_Object *enventor)
|
|||
elm_layout_file_set(layout, EDJE_PATH, "viewer_layout");
|
||||
em->enventor = enventor;
|
||||
em->layout = layout;
|
||||
em->view_scale = 1;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -169,7 +167,6 @@ edj_mgr_view_switch_to(view_data *vd)
|
|||
|
||||
elm_object_part_content_set(em->layout, "elm.swallow.content",
|
||||
view_obj_get(vd));
|
||||
view_scale_set(vd, em->view_scale);
|
||||
//Switching effect
|
||||
if (prev != view_obj_get(vd))
|
||||
{
|
||||
|
@ -223,21 +220,6 @@ edj_mgr_reload_need_get(void)
|
|||
return em->reload_need;
|
||||
}
|
||||
|
||||
void
|
||||
edj_mgr_view_scale_set(double view_scale)
|
||||
{
|
||||
edj_mgr *em = g_em;
|
||||
em->view_scale = view_scale;
|
||||
view_scale_set(VIEW_DATA, view_scale);
|
||||
}
|
||||
|
||||
double
|
||||
edj_mgr_view_scale_get(void)
|
||||
{
|
||||
edj_mgr *em = g_em;
|
||||
return em->view_scale;
|
||||
}
|
||||
|
||||
void
|
||||
edj_mgr_all_views_reload(void)
|
||||
{
|
||||
|
|
|
@ -41,6 +41,7 @@ struct viewer_s
|
|||
|
||||
/* view size configured by application */
|
||||
Evas_Coord_Size view_config_size;
|
||||
double view_scale;
|
||||
|
||||
//Keep the part info which state has been changed
|
||||
struct {
|
||||
|
@ -105,11 +106,9 @@ img_changed_cb(void *data, int type EINA_UNUSED, void *event)
|
|||
static void
|
||||
view_obj_min_update(view_data *vd)
|
||||
{
|
||||
double scale = edj_mgr_view_scale_get();
|
||||
|
||||
double min_w = (double) vd->view_config_size.w * scale;
|
||||
double min_w = (double) vd->view_config_size.w * vd->view_scale;
|
||||
if (1 > min_w) min_w = 1;
|
||||
double min_h = (double) vd->view_config_size.h * scale;
|
||||
double min_h = (double) vd->view_config_size.h * vd->view_scale;
|
||||
if (1 > min_h) min_h = 1;
|
||||
|
||||
evas_object_size_hint_min_set(vd->layout, min_w, min_h);
|
||||
|
@ -568,7 +567,6 @@ view_obj_idler_cb(void *data)
|
|||
vd->base = base_create(vd->scroller);
|
||||
|
||||
view_obj_create(vd);
|
||||
view_scale_set(vd, edj_mgr_view_scale_get());
|
||||
|
||||
event_layer_set(vd);
|
||||
|
||||
|
@ -629,6 +627,7 @@ view_init(Enventor_Object *enventor, Enventor_Item *it, const char *group,
|
|||
|
||||
vd->view_config_size.w = 0;
|
||||
vd->view_config_size.h = 0;
|
||||
vd->view_scale = 1;
|
||||
|
||||
return vd;
|
||||
}
|
||||
|
@ -773,6 +772,13 @@ view_data_get(view_data *vd)
|
|||
return vd->data;
|
||||
}
|
||||
|
||||
double
|
||||
view_scale_get(view_data *vd)
|
||||
{
|
||||
if (!vd) return 1.0;
|
||||
return vd->view_scale;
|
||||
}
|
||||
|
||||
void
|
||||
view_scale_set(view_data *vd, double scale)
|
||||
{
|
||||
|
@ -801,6 +807,8 @@ view_scale_set(view_data *vd, double scale)
|
|||
|
||||
elm_scroller_region_show(vd->scroller, ((Evas_Coord) cx) - (sw / 2),
|
||||
((Evas_Coord) cy) - (sh / 2), sw, sh);
|
||||
|
||||
vd->view_scale = scale;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -175,8 +175,6 @@ void edj_mgr_view_del(view_data *vd);
|
|||
void edj_mgr_reload_need_set(Eina_Bool reload);
|
||||
Eina_Bool edj_mgr_reload_need_get(void);
|
||||
void edj_mgr_clear(void);
|
||||
void edj_mgr_view_scale_set(double scale);
|
||||
double edj_mgr_view_scale_get(void);
|
||||
void edj_mgr_all_views_reload(void);
|
||||
|
||||
|
||||
|
@ -207,6 +205,7 @@ void view_programs_stop(view_data *vd);
|
|||
Eina_Stringshare *view_group_name_get(view_data *vd);
|
||||
void *view_data_get(view_data *vd);
|
||||
void view_scale_set(view_data *vd, double scale);
|
||||
double view_scale_get(view_data *vd);
|
||||
void view_size_get(view_data *vd, Evas_Coord *w, Evas_Coord *h);
|
||||
void view_size_set(view_data *vd, Evas_Coord w, Evas_Coord h);
|
||||
Eina_List *view_parts_list_get(view_data *vd);
|
||||
|
|
|
@ -536,7 +536,7 @@ _enventor_object_live_view_scale_set(Eo *obj EINA_UNUSED,
|
|||
Enventor_Object_Data *pd EINA_UNUSED,
|
||||
double scale)
|
||||
{
|
||||
edj_mgr_view_scale_set(scale);
|
||||
view_scale_set(VIEW_DATA, scale);
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
|
@ -559,7 +559,7 @@ EOLIAN static double
|
|||
_enventor_object_live_view_scale_get(Eo *obj EINA_UNUSED,
|
||||
Enventor_Object_Data *pd EINA_UNUSED)
|
||||
{
|
||||
return edj_mgr_view_scale_get();
|
||||
return view_scale_get(VIEW_DATA);
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
|
|
Loading…
Reference in New Issue