Ephoto: Removed buggy panes.

master
Stephen 'Okra' Houston 5 years ago
parent 5ee6630a6c
commit a9ddb8add7
  1. 2
      src/bin/ephoto.h
  2. 41
      src/bin/ephoto_config.c
  3. 3
      src/bin/ephoto_directory_browser.c
  4. 52
      src/bin/ephoto_main.c
  5. 43
      src/bin/ephoto_single_browser.c

@ -240,6 +240,7 @@ struct _Ephoto_Config
Evas_Object *slide_move;
Evas_Object *show_folders;
Evas_Object *thumb_aspect;
Evas_Object *panel_size;
};
struct _Ephoto
@ -261,7 +262,6 @@ struct _Ephoto
Evas_Object *single_browser;
Evas_Object *slideshow;
Evas_Object *dir_browser;
Evas_Object *right_menu;
Evas_Object *file_popup;
Eina_Bool folders_toggle;

@ -44,6 +44,13 @@ _config_save_cb(void *data, Evas_Object *obj EINA_UNUSED,
ephoto->config->smooth = elm_check_state_get(ephoto->config->smooth_scale);
ephoto->config->folders = elm_check_state_get(ephoto->config->show_folders);
ephoto->config->thumbnail_aspect = elm_check_state_get(ephoto->config->thumb_aspect);
if (elm_spinner_value_get(ephoto->config->panel_size) > 0)
{
ephoto->config->left_size = (elm_spinner_value_get(ephoto->config->panel_size) / 0.05) * 0.05;
ephoto->config->right_size = (elm_spinner_value_get(ephoto->config->panel_size) / 0.05) * 0.05;
evas_object_size_hint_weight_set(ephoto->dir_browser, ephoto->config->left_size, EVAS_HINT_EXPAND);
}
if (elm_spinner_value_get(ephoto->config->slide_time) > 0)
ephoto->config->slideshow_timeout =
elm_spinner_value_get(ephoto->config->slide_time);
@ -72,7 +79,8 @@ _open_hv_select(void *data, Evas_Object *obj, void *event_info)
static void
_config_general(Ephoto *ephoto, Evas_Object *parent)
{
Evas_Object *table, *check, *hoversel, *entry, *label;
Evas_Object *table, *check, *hoversel, *entry, *label, *spinner;
char buf[PATH_MAX];
table = elm_table_add(parent);
EPHOTO_EXPAND(table);
@ -121,11 +129,30 @@ _config_general(Ephoto *ephoto, Evas_Object *parent)
ephoto->config->thumb_aspect = check;
label = elm_label_add(table);
elm_object_text_set(label, _("Top Level Directory"));
elm_object_text_set(label, _("File Panel Size"));
EPHOTO_ALIGN(label, 0.5, 0.5);
elm_table_pack(table, label, 0, 5, 1, 1);
evas_object_show(label);
spinner = elm_spinner_add(table);
elm_spinner_editable_set(spinner, EINA_TRUE);
snprintf(buf, PATH_MAX, "%%1.2f %s", _("Weight (1.0 Max)"));
elm_spinner_label_format_set(spinner, buf);
elm_spinner_step_set(spinner, .05);
elm_spinner_value_set(spinner, ephoto->config->left_size);
elm_spinner_min_max_set(spinner, 0, 1);
EPHOTO_EXPAND(spinner);
EPHOTO_FILL(spinner);
elm_table_pack(table, spinner, 0, 6, 1, 1);
evas_object_show(spinner);
ephoto->config->panel_size = spinner;
label = elm_label_add(table);
elm_object_text_set(label, _("Top Level Directory"));
EPHOTO_ALIGN(label, 0.5, 0.5);
elm_table_pack(table, label, 0, 7, 1, 1);
evas_object_show(label);
hoversel = elm_hoversel_add(table);
elm_hoversel_hover_parent_set(hoversel, ephoto->win);
elm_hoversel_item_add(hoversel, _("Root Directory"), NULL, 0,
@ -140,7 +167,7 @@ _config_general(Ephoto *ephoto, Evas_Object *parent)
evas_object_data_set(hoversel, "ephoto", ephoto);
EPHOTO_WEIGHT(hoversel, EVAS_HINT_EXPAND, EVAS_HINT_FILL);
EPHOTO_FILL(hoversel);
elm_table_pack(table, hoversel, 0, 6, 1, 1);
elm_table_pack(table, hoversel, 0, 8, 1, 1);
evas_object_show(hoversel);
ephoto->config->open_dir = hoversel;
@ -153,7 +180,7 @@ _config_general(Ephoto *ephoto, Evas_Object *parent)
ELM_SCROLLER_POLICY_OFF);
EPHOTO_EXPAND(entry);
EPHOTO_FILL(entry);
elm_table_pack(table, entry, 0, 7, 1, 1);
elm_table_pack(table, entry, 0, 9, 1, 1);
evas_object_show(entry);
ephoto->config->open_dir_custom = entry;
}
@ -422,7 +449,7 @@ _config_bindings(Evas_Object *parent)
"<b>Home:</b> Navigate First<br/>"
"<b>Left Arrow:</b> Navigate Previous<br/>"
"<b>Right Arrow:</b> Navigate Next<br/>"
"<b>Space:</b> Navigate Next<br />"
"<b>Space:</b> Navigate Next<br/>"
"<b>End:</b> Navigate Last<br/>"
"<b>Ctrl+Delete:</b> Delete Image<br/>"
"<b>F2</b> Rename Image<br/>"
@ -793,8 +820,8 @@ ephoto_config_init(Ephoto *ephoto)
ephoto->config->window_width = 900*elm_config_scale_get();
ephoto->config->window_height = 500*elm_config_scale_get();
ephoto->config->fsel_hide = 0;
ephoto->config->left_size = .2;
ephoto->config->right_size = .2;
ephoto->config->left_size = .25;
ephoto->config->right_size = .25;
ephoto->config->open = eina_stringshare_add(eina_environment_home_get());
ephoto->config->prompts = 1;
ephoto->config->drop = 0;

@ -474,6 +474,7 @@ _dir_go_trash(void *data, Evas_Object *obj EINA_UNUSED,
elm_genlist_highlight_mode_set(db->fsel, EINA_TRUE);
EPHOTO_EXPAND(db->fsel);
EPHOTO_FILL(db->fsel);
evas_object_size_hint_min_set(db->fsel, 195*elm_config_scale_get(), 0);
evas_object_smart_callback_add(db->fsel, "expand,request",
_on_list_expand_req, db);
evas_object_smart_callback_add(db->fsel, "contract,request",
@ -707,6 +708,7 @@ _ephoto_directory_view_add(Ephoto_Directory_Browser *db)
elm_genlist_highlight_mode_set(db->fsel, EINA_TRUE);
EPHOTO_EXPAND(db->fsel);
EPHOTO_FILL(db->fsel);
evas_object_size_hint_min_set(db->fsel, 195*elm_config_scale_get(), 0);
evas_object_smart_callback_add(db->fsel, "expand,request",
_on_list_expand_req, db);
evas_object_smart_callback_add(db->fsel, "contract,request",
@ -1368,6 +1370,7 @@ ephoto_directory_browser_add(Ephoto *ephoto, Evas_Object *parent)
db->main = box;
elm_box_horizontal_set(db->main, EINA_FALSE);
evas_object_size_hint_min_set(db->main, 195*elm_config_scale_get(), 0);
evas_object_event_callback_add(db->main, EVAS_CALLBACK_DEL,
_ephoto_main_del, db);
evas_object_data_set(db->main, "directory_browser", db);

@ -111,10 +111,9 @@ _ephoto_slideshow_show(Ephoto *ephoto, Ephoto_Entry *entry)
evas_object_hide(ephoto->single_browser);
evas_object_hide(ephoto->thumb_browser);
elm_object_focus_set(ephoto->slideshow, EINA_TRUE);
elm_panes_content_left_min_size_set(ephoto->layout, 0);
elm_panes_content_left_size_set(ephoto->layout, 0.0);
elm_table_unpack(ephoto->main, ephoto->statusbar);
evas_object_hide(ephoto->dir_browser);
elm_box_unpack(ephoto->layout, ephoto->dir_browser);
evas_object_hide(ephoto->statusbar);
evas_object_freeze_events_set(ephoto->single_browser, EINA_TRUE);
evas_object_freeze_events_set(ephoto->thumb_browser, EINA_TRUE);
@ -156,9 +155,8 @@ _ephoto_slideshow_back(void *data, Evas_Object *obj EINA_UNUSED,
}
if (ephoto->folders_toggle)
{
elm_panes_content_left_min_size_set(ephoto->layout, 0);
elm_panes_content_left_size_set(ephoto->layout, ephoto->config->left_size);
evas_object_show(ephoto->dir_browser);
elm_box_pack_start(ephoto->layout, ephoto->dir_browser);
}
elm_table_pack(ephoto->main, ephoto->statusbar, 0, 2, 1, 1);
evas_object_show(ephoto->statusbar);
@ -271,8 +269,8 @@ _folder_icon_clicked(void *data, Evas_Object *obj,
if (!ephoto->folders_toggle)
{
elm_panes_content_left_min_size_set(ephoto->layout, 0);
elm_panes_content_left_size_set(ephoto->layout, ephoto->config->left_size);
evas_object_show(ephoto->dir_browser);
elm_box_pack_start(ephoto->layout, ephoto->dir_browser);
ephoto->folders_toggle = EINA_TRUE;
ret = elm_icon_standard_set(ephoto->folders_icon, "folder-open");
if (!ret)
@ -281,8 +279,8 @@ _folder_icon_clicked(void *data, Evas_Object *obj,
}
else
{
elm_panes_content_left_min_size_set(ephoto->layout, 0);
elm_panes_content_left_size_set(ephoto->layout, 0.0);
evas_object_hide(ephoto->dir_browser);
elm_box_unpack(ephoto->layout, ephoto->dir_browser);
ephoto->folders_toggle = EINA_FALSE;
ret = elm_icon_standard_set(ephoto->folders_icon, "folder");
if (!ret)
@ -323,15 +321,6 @@ _exit_icon_clicked(void *data, Evas_Object *obj EINA_UNUSED,
evas_object_del(ephoto->win);
}
static void
_ephoto_left_pane_resized(void *data, Evas_Object *obj EINA_UNUSED,
void *event_info EINA_UNUSED)
{
Ephoto *ephoto = data;
ephoto->config->left_size = elm_panes_content_left_size_get(ephoto->layout);
}
/*Toggle determines whether to toggle folder visibility, or just force visible*/
void
ephoto_show_folders(Ephoto *ephoto, Eina_Bool toggle)
@ -340,10 +329,9 @@ ephoto_show_folders(Ephoto *ephoto, Eina_Bool toggle)
if (!ephoto->folders_toggle || !toggle)
{
elm_panes_content_left_min_size_set(ephoto->layout, 0);
elm_panes_content_left_size_set(ephoto->layout, ephoto->config->left_size);
evas_object_show(ephoto->dir_browser);
ephoto->folders_toggle = EINA_TRUE;
elm_box_pack_end(ephoto->layout, ephoto->dir_browser);
ephoto->folders_toggle = EINA_TRUE;
ret = elm_icon_standard_set(ephoto->folders_icon, "folder-open");
if (!ret)
elm_object_text_set(ephoto->folders_button, _("Hide Folders"));
@ -351,9 +339,8 @@ ephoto_show_folders(Ephoto *ephoto, Eina_Bool toggle)
}
else if (ephoto->folders_toggle)
{
elm_panes_content_left_min_size_set(ephoto->layout, 0);
elm_panes_content_left_size_set(ephoto->layout, 0.0);
evas_object_hide(ephoto->dir_browser);
elm_box_unpack(ephoto->layout, ephoto->dir_browser);
ephoto->folders_toggle = EINA_FALSE;
ret = elm_icon_standard_set(ephoto->folders_icon, "folder");
if (!ret)
@ -416,18 +403,18 @@ ephoto_window_add(const char *path)
elm_win_resize_object_add(ephoto->win, ephoto->main);
evas_object_show(ephoto->main);
ephoto->layout = elm_panes_add(ephoto->main);
ephoto->layout = elm_box_add(ephoto->main);
elm_box_horizontal_set(ephoto->layout, EINA_TRUE);
elm_box_homogeneous_set(ephoto->layout, EINA_FALSE);
EPHOTO_EXPAND(ephoto->layout);
EPHOTO_FILL(ephoto->layout);
evas_object_smart_callback_add(ephoto->layout, "unpress",
_ephoto_left_pane_resized, ephoto);
elm_table_pack(ephoto->main, ephoto->layout, 0, 0, 1, 2);
evas_object_show(ephoto->layout);
ephoto->pager = elm_table_add(ephoto->layout);
EPHOTO_EXPAND(ephoto->pager);
EPHOTO_FILL(ephoto->pager);
elm_object_part_content_set(ephoto->layout, "right", ephoto->pager);
elm_box_pack_end(ephoto->layout, ephoto->pager);
evas_object_show(ephoto->pager);
ephoto->thumb_browser = ephoto_thumb_browser_add(ephoto, ephoto->layout);
@ -466,11 +453,9 @@ ephoto_window_add(const char *path)
_ephoto_slideshow_back, ephoto);
ephoto->dir_browser = ephoto_directory_browser_add(ephoto, ephoto->layout);
EPHOTO_WEIGHT(ephoto->dir_browser, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
EPHOTO_WEIGHT(ephoto->dir_browser, ephoto->config->left_size, EVAS_HINT_EXPAND);
EPHOTO_FILL(ephoto->dir_browser);
elm_panes_content_left_min_size_set(ephoto->layout, 0);
elm_panes_content_left_size_set(ephoto->layout, ephoto->config->left_size);
elm_object_part_content_set(ephoto->layout, "left", ephoto->dir_browser);
elm_box_pack_start(ephoto->layout, ephoto->dir_browser);
evas_object_show(ephoto->dir_browser);
ephoto->statusbar = elm_box_add(ephoto->main);
@ -632,8 +617,7 @@ ephoto_window_add(const char *path)
if (!ephoto->config->folders)
{
evas_object_hide(ephoto->dir_browser);
elm_panes_content_left_min_size_set(ephoto->layout, 0);
elm_panes_content_left_size_set(ephoto->layout, 0.0);
elm_box_unpack(ephoto->layout, ephoto->dir_browser);
ephoto->folders_toggle = EINA_FALSE;
ret = elm_icon_standard_set(ephoto->folders_icon, "folder");
if (!ret)
@ -643,9 +627,7 @@ ephoto_window_add(const char *path)
else
{
ephoto->folders_toggle = EINA_TRUE;
elm_panes_content_left_min_size_set(ephoto->layout, 0);
elm_panes_content_left_size_set(ephoto->layout, ephoto->config->left_size);
ret = elm_icon_standard_set(ephoto->folders_icon, "folder-open");
ret = elm_icon_standard_set(ephoto->folders_icon, "folder-open");
if (!ret)
elm_object_text_set(ephoto->folders_button, _("Hide Folders"));
elm_object_tooltip_text_set(ephoto->folders_button, _("Hide Folders"));

@ -1049,19 +1049,15 @@ _close_editor(void *data, Evas_Object *obj EINA_UNUSED,
{
Ephoto_Single_Browser *sb = data;
elm_object_part_content_unset(sb->mhbox, "right");
elm_panes_content_right_size_set(sb->mhbox, 0.0);
evas_object_del(sb->edit_main);
sb->edit_main = NULL;
if (sb->ephoto->folders_toggle)
{
elm_panes_content_left_size_set(sb->ephoto->layout, sb->ephoto->config->left_size);
evas_object_show(sb->ephoto->dir_browser);
elm_table_pack(sb->ephoto->main, sb->ephoto->statusbar, 0, 2, 1, 1);
evas_object_show(sb->ephoto->statusbar);
elm_box_pack_start(sb->ephoto->layout, sb->ephoto->dir_browser);
}
evas_object_del(sb->edit_main);
sb->edit_main = NULL;
elm_table_pack(sb->ephoto->main, sb->ephoto->statusbar, 0, 2, 1, 1);
evas_object_show(sb->ephoto->statusbar);
}
static void
@ -1606,7 +1602,7 @@ _ephoto_single_browser_recalc(Ephoto_Single_Browser *sb)
sb->viewer = _viewer_add(sb->main, sb->entry->path, sb);
if (sb->viewer)
{
elm_object_part_content_set(sb->mhbox, "left", sb->viewer);
elm_box_pack_start(sb->mhbox, sb->viewer);
evas_object_show(sb->viewer);
evas_object_event_callback_add(sb->viewer,
EVAS_CALLBACK_MOUSE_WHEEL, _mouse_wheel, sb);
@ -1626,7 +1622,7 @@ _ephoto_single_browser_recalc(Ephoto_Single_Browser *sb)
_("This image does not exist or is corrupted!"));
EPHOTO_EXPAND(sb->nolabel);
EPHOTO_FILL(sb->nolabel);
elm_object_part_content_set(sb->mhbox, "left", sb->nolabel);
elm_box_pack_start(sb->mhbox, sb->nolabel);
evas_object_show(sb->nolabel);
ephoto_title_set(sb->ephoto, _("Bad Image"));
}
@ -1760,7 +1756,8 @@ _editor_menu(void *data, Evas_Object *obj EINA_UNUSED, void *event_data EINA_UNU
itc->func.state_get = NULL;
itc->func.del = NULL;
elm_panes_content_left_size_set(sb->ephoto->layout, 0.0);
if (evas_object_visible_get(sb->ephoto->dir_browser))
elm_box_unpack(sb->ephoto->layout, sb->ephoto->dir_browser);
if (evas_object_visible_get(sb->ephoto->statusbar))
elm_table_unpack(sb->ephoto->main, sb->ephoto->statusbar);
evas_object_hide(sb->ephoto->dir_browser);
@ -1768,10 +1765,9 @@ _editor_menu(void *data, Evas_Object *obj EINA_UNUSED, void *event_data EINA_UNU
frame = elm_frame_add(sb->mhbox);
elm_object_text_set(frame, _("Edit"));
EPHOTO_EXPAND(frame);
EPHOTO_WEIGHT(frame, sb->ephoto->config->right_size, EVAS_HINT_EXPAND);
EPHOTO_FILL(frame);
elm_object_part_content_set(sb->mhbox, "right", frame);
elm_panes_content_right_size_set(sb->mhbox, sb->ephoto->config->right_size);
elm_box_pack_end(sb->mhbox, frame);
evas_object_show(frame);
box = elm_box_add(frame);
@ -2099,19 +2095,11 @@ _ephoto_main_back(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EIN
evas_object_del(sb->event);
sb->event = NULL;
}
_close_editor(sb, NULL, NULL);
if (sb->editing)
_close_editor(sb, NULL, NULL);
evas_object_smart_callback_call(sb->main, "back", sb->entry);
}
static void
_ephoto_right_pane_resized(void *data, Evas_Object *obj EINA_UNUSED,
void *event_info EINA_UNUSED)
{
Ephoto_Single_Browser *sb = data;
sb->ephoto->config->right_size = elm_panes_content_right_size_get(sb->mhbox);
}
static void
_ephoto_main_del(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
void *event_info EINA_UNUSED)
@ -2573,11 +2561,10 @@ ephoto_single_browser_add(Ephoto *ephoto, Evas_Object *parent)
EPHOTO_FILL(sb->main);
evas_object_data_set(sb->main, "single_browser", sb);
sb->mhbox = elm_panes_add(sb->main);
sb->mhbox = elm_box_add(sb->main);
elm_box_horizontal_set(sb->mhbox, EINA_TRUE);
EPHOTO_EXPAND(sb->mhbox);
EPHOTO_FILL(sb->mhbox);
elm_panes_content_right_size_set(sb->mhbox, 0.0);
evas_object_smart_callback_add(sb->mhbox, "unpress", _ephoto_right_pane_resized, sb);
elm_box_pack_end(sb->main, sb->mhbox);
evas_object_show(sb->mhbox);

Loading…
Cancel
Save