ephoto is mostly ready again!

Well, at least that was what I had time and stamina to do. Please join
the development with your ideas and requirements.

The toolbar is now placed on top, because default.edc (from
elementary) says so. We better use elementary's profile to define the
theme to use, and a theme could have it at the bottom (mobiles?).

I've added all options to toolbar, which makes it very wide on single
image viewer. We'll later introduce toolbar item "visibility priority"
to auto-hide items and add a "More" menu if the elementary's profile
says so, other options will be to make it scrollable (as it is now).

EXIF rotation support is not right in my opinion. We're using map to
rotate, but it is not doing fine, as I said in another bug. We should
have code to request evas to load the image rotated, then we re-load
the image and it should work better (need to check how that would work
with region load from JPEG, used by elm_photocam).

Preferences are out as I ran out of time.



SVN revision: 53319
This commit is contained in:
Gustavo Sverzut Barbieri 2010-10-12 22:54:20 +00:00
parent ad73446df7
commit 81d47b1344
18 changed files with 1060 additions and 1519 deletions

View File

@ -1,5 +1,2 @@
## Process this file with automake to produce Makefile.in
MAINTAINERCLEANFILES = Makefile.in Makefile
SUBDIRS = themes images
SUBDIRS = themes

View File

@ -1,67 +0,0 @@
Creative Commons Attribution-ShareAlike 2.5 License Agreement
CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE LEGAL SERVICES. DISTRIBUTION OF THIS LICENSE DOES NOT CREATE AN ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES REGARDING THE INFORMATION PROVIDED, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM ITS USE.
License
THE WORK (AS DEFINED BELOW) IS PROVIDED UNDER THE TERMS OF THIS CREATIVE COMMONS PUBLIC LICENSE ("CCPL" OR "LICENSE"). THE WORK IS PROTECTED BY COPYRIGHT AND/OR OTHER APPLICABLE LAW. ANY USE OF THE WORK OTHER THAN AS AUTHORIZED UNDER THIS LICENSE OR COPYRIGHT LAW IS PROHIBITED.
BY EXERCISING ANY RIGHTS TO THE WORK PROVIDED HERE, YOU ACCEPT AND AGREE TO BE BOUND BY THE TERMS OF THIS LICENSE. THE LICENSOR GRANTS YOU THE RIGHTS CONTAINED HERE IN CONSIDERATION OF YOUR ACCEPTANCE OF SUCH TERMS AND CONDITIONS.
1. Definitions
1. "Collective Work" means a work, such as a periodical issue, anthology or encyclopedia, in which the Work in its entirety in unmodified form, along with a number of other contributions, constituting separate and independent works in themselves, are assembled into a collective whole. A work that constitutes a Collective Work will not be considered a Derivative Work (as defined below) for the purposes of this License.
2. "Derivative Work" means a work based upon the Work or upon the Work and other pre-existing works, such as a translation, musical arrangement, dramatization, fictionalization, motion picture version, sound recording, art reproduction, abridgment, condensation, or any other form in which the Work may be recast, transformed, or adapted, except that a work that constitutes a Collective Work will not be considered a Derivative Work for the purpose of this License. For the avoidance of doubt, where the Work is a musical composition or sound recording, the synchronization of the Work in timed-relation with a moving image ("synching") will be considered a Derivative Work for the purpose of this License.
3. "Licensor" means the individual or entity that offers the Work under the terms of this License.
4. "Original Author" means the individual or entity who created the Work.
5. "Work" means the copyrightable work of authorship offered under the terms of this License.
6. "You" means an individual or entity exercising rights under this License who has not previously violated the terms of this License with respect to the Work, or who has received express permission from the Licensor to exercise rights under this License despite a previous violation.
7. "License Elements" means the following high-level license attributes as selected by Licensor and indicated in the title of this License: Attribution, ShareAlike.
2. Fair Use Rights. Nothing in this license is intended to reduce, limit, or restrict any rights arising from fair use, first sale or other limitations on the exclusive rights of the copyright owner under copyright law or other applicable laws.
3. License Grant. Subject to the terms and conditions of this License, Licensor hereby grants You a worldwide, royalty-free, non-exclusive, perpetual (for the duration of the applicable copyright) license to exercise the rights in the Work as stated below:
1. to reproduce the Work, to incorporate the Work into one or more Collective Works, and to reproduce the Work as incorporated in the Collective Works;
2. to create and reproduce Derivative Works;
3. to distribute copies or phonorecords of, display publicly, perform publicly, and perform publicly by means of a digital audio transmission the Work including as incorporated in Collective Works;
4. to distribute copies or phonorecords of, display publicly, perform publicly, and perform publicly by means of a digital audio transmission Derivative Works.
5.
For the avoidance of doubt, where the work is a musical composition:
1. Performance Royalties Under Blanket Licenses. Licensor waives the exclusive right to collect, whether individually or via a performance rights society (e.g. ASCAP, BMI, SESAC), royalties for the public performance or public digital performance (e.g. webcast) of the Work.
2. Mechanical Rights and Statutory Royalties. Licensor waives the exclusive right to collect, whether individually or via a music rights society or designated agent (e.g. Harry Fox Agency), royalties for any phonorecord You create from the Work ("cover version") and distribute, subject to the compulsory license created by 17 USC Section 115 of the US Copyright Act (or the equivalent in other jurisdictions).
6. Webcasting Rights and Statutory Royalties. For the avoidance of doubt, where the Work is a sound recording, Licensor waives the exclusive right to collect, whether individually or via a performance-rights society (e.g. SoundExchange), royalties for the public digital performance (e.g. webcast) of the Work, subject to the compulsory license created by 17 USC Section 114 of the US Copyright Act (or the equivalent in other jurisdictions).
The above rights may be exercised in all media and formats whether now known or hereafter devised. The above rights include the right to make such modifications as are technically necessary to exercise the rights in other media and formats. All rights not expressly granted by Licensor are hereby reserved.
4. Restrictions.The license granted in Section 3 above is expressly made subject to and limited by the following restrictions:
1. You may distribute, publicly display, publicly perform, or publicly digitally perform the Work only under the terms of this License, and You must include a copy of, or the Uniform Resource Identifier for, this License with every copy or phonorecord of the Work You distribute, publicly display, publicly perform, or publicly digitally perform. You may not offer or impose any terms on the Work that alter or restrict the terms of this License or the recipients' exercise of the rights granted hereunder. You may not sublicense the Work. You must keep intact all notices that refer to this License and to the disclaimer of warranties. You may not distribute, publicly display, publicly perform, or publicly digitally perform the Work with any technological measures that control access or use of the Work in a manner inconsistent with the terms of this License Agreement. The above applies to the Work as incorporated in a Collective Work, but this does not require the Collective Work apart from the Work itself to be made subject to the terms of this License. If You create a Collective Work, upon notice from any Licensor You must, to the extent practicable, remove from the Collective Work any credit as required by clause 4(c), as requested. If You create a Derivative Work, upon notice from any Licensor You must, to the extent practicable, remove from the Derivative Work any credit as required by clause 4(c), as requested.
2. You may distribute, publicly display, publicly perform, or publicly digitally perform a Derivative Work only under the terms of this License, a later version of this License with the same License Elements as this License, or a Creative Commons iCommons license that contains the same License Elements as this License (e.g. Attribution-ShareAlike 2.5 Japan). You must include a copy of, or the Uniform Resource Identifier for, this License or other license specified in the previous sentence with every copy or phonorecord of each Derivative Work You distribute, publicly display, publicly perform, or publicly digitally perform. You may not offer or impose any terms on the Derivative Works that alter or restrict the terms of this License or the recipients' exercise of the rights granted hereunder, and You must keep intact all notices that refer to this License and to the disclaimer of warranties. You may not distribute, publicly display, publicly perform, or publicly digitally perform the Derivative Work with any technological measures that control access or use of the Work in a manner inconsistent with the terms of this License Agreement. The above applies to the Derivative Work as incorporated in a Collective Work, but this does not require the Collective Work apart from the Derivative Work itself to be made subject to the terms of this License.
3. If you distribute, publicly display, publicly perform, or publicly digitally perform the Work or any Derivative Works or Collective Works, You must keep intact all copyright notices for the Work and provide, reasonable to the medium or means You are utilizing: (i) the name of the Original Author (or pseudonym, if applicable) if supplied, and/or (ii) if the Original Author and/or Licensor designate another party or parties (e.g. a sponsor institute, publishing entity, journal) for attribution in Licensor's copyright notice, terms of service or by other reasonable means, the name of such party or parties; the title of the Work if supplied; to the extent reasonably practicable, the Uniform Resource Identifier, if any, that Licensor specifies to be associated with the Work, unless such URI does not refer to the copyright notice or licensing information for the Work; and in the case of a Derivative Work, a credit identifying the use of the Work in the Derivative Work (e.g., "French translation of the Work by Original Author," or "Screenplay based on original Work by Original Author"). Such credit may be implemented in any reasonable manner; provided, however, that in the case of a Derivative Work or Collective Work, at a minimum such credit will appear where any other comparable authorship credit appears and in a manner at least as prominent as such other comparable authorship credit.
5. Representations, Warranties and Disclaimer
UNLESS OTHERWISE AGREED TO BY THE PARTIES IN WRITING, LICENSOR OFFERS THE WORK AS-IS AND MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND CONCERNING THE MATERIALS, EXPRESS, IMPLIED, STATUTORY OR OTHERWISE, INCLUDING, WITHOUT LIMITATION, WARRANTIES OF TITLE, MERCHANTIBILITY, FITNESS FOR A PARTICULAR PURPOSE, NONINFRINGEMENT, OR THE ABSENCE OF LATENT OR OTHER DEFECTS, ACCURACY, OR THE PRESENCE OF ABSENCE OF ERRORS, WHETHER OR NOT DISCOVERABLE. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OF IMPLIED WARRANTIES, SO SUCH EXCLUSION MAY NOT APPLY TO YOU.
6. Limitation on Liability. EXCEPT TO THE EXTENT REQUIRED BY APPLICABLE LAW, IN NO EVENT WILL LICENSOR BE LIABLE TO YOU ON ANY LEGAL THEORY FOR ANY SPECIAL, INCIDENTAL, CONSEQUENTIAL, PUNITIVE OR EXEMPLARY DAMAGES ARISING OUT OF THIS LICENSE OR THE USE OF THE WORK, EVEN IF LICENSOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
7. Termination
1. This License and the rights granted hereunder will terminate automatically upon any breach by You of the terms of this License. Individuals or entities who have received Derivative Works or Collective Works from You under this License, however, will not have their licenses terminated provided such individuals or entities remain in full compliance with those licenses. Sections 1, 2, 5, 6, 7, and 8 will survive any termination of this License.
2. Subject to the above terms and conditions, the license granted here is perpetual (for the duration of the applicable copyright in the Work). Notwithstanding the above, Licensor reserves the right to release the Work under different license terms or to stop distributing the Work at any time; provided, however that any such election will not serve to withdraw this License (or any other license that has been, or is required to be, granted under the terms of this License), and this License will continue in full force and effect unless terminated as stated above.
8. Miscellaneous
1. Each time You distribute or publicly digitally perform the Work or a Collective Work, the Licensor offers to the recipient a license to the Work on the same terms and conditions as the license granted to You under this License.
2. Each time You distribute or publicly digitally perform a Derivative Work, Licensor offers to the recipient a license to the original Work on the same terms and conditions as the license granted to You under this License.
3. If any provision of this License is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this License, and without further action by the parties to this agreement, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable.
4. No term or provision of this License shall be deemed waived and no breach consented to unless such waiver or consent shall be in writing and signed by the party to be charged with such waiver or consent.
5. This License constitutes the entire agreement between the parties with respect to the Work licensed here. There are no understandings, agreements or representations with respect to the Work not specified here. Licensor shall not be bound by any additional provisions that may appear in any communication from You. This License may not be modified without the mutual written agreement of the Licensor and You.
Creative Commons is not a party to this License, and makes no warranty whatsoever in connection with the Work. Creative Commons will not be liable to You or any party on any legal theory for any damages whatsoever, including without limitation any general, special, incidental or consequential damages arising in connection to this license. Notwithstanding the foregoing two (2) sentences, if Creative Commons has expressly identified itself as the Licensor hereunder, it shall have all rights and obligations of Licensor.
Except for the limited purpose of indicating to the public that the Work is licensed under the CCPL, neither party will use the trademark "Creative Commons" or any related trademark or logo of Creative Commons without the prior written consent of Creative Commons. Any permitted use will be in compliance with Creative Commons' then-current trademark usage guidelines, as may be published on its website or otherwise made available upon request from time to time.
Creative Commons may be contacted at http://creativecommons.org/.

View File

@ -1,18 +0,0 @@
MAINTAINERCLEANFILES = Makefile.in Makefile
IMAGES = \
change_directory.png \
filter.png \
view_presentation.png \
play_slideshow.png \
first.png \
last.png \
next.png \
previous.png \
preferences.png \
go_back.png
imagesdir = $(pkgdatadir)/images
images_DATA = $(IMAGES)
EXTRA_DIST = $(IMAGES)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

File diff suppressed because it is too large Load Diff

View File

@ -109,8 +109,7 @@ struct _Ephoto
{
Evas_Object *win;
Evas_Object *bg;
Evas_Object *layout;
Evas_Object *edje;
Evas_Object *pager;
Evas_Object *thumb_browser;
Evas_Object *flow_browser;

View File

@ -16,7 +16,24 @@ struct _Ephoto_Flow_Browser
Ephoto *ephoto;
Evas_Object *layout;
Evas_Object *edje;
Evas_Object *orient_layout;
Evas_Object *orient_edje;
Evas_Object *viewer;
Evas_Object *toolbar;
struct {
Elm_Toolbar_Item *zoom_in;
Elm_Toolbar_Item *zoom_out;
Elm_Toolbar_Item *zoom_1;
Elm_Toolbar_Item *go_first;
Elm_Toolbar_Item *go_prev;
Elm_Toolbar_Item *go_next;
Elm_Toolbar_Item *go_last;
Elm_Toolbar_Item *rotate_counterclock;
Elm_Toolbar_Item *rotate_clock;
Elm_Toolbar_Item *flip_horiz;
Elm_Toolbar_Item *flip_vert;
Elm_Toolbar_Item *slideshow;
} action;
const char *path;
Ephoto_Entry *entry;
Ephoto_Orient orient;
@ -155,7 +172,7 @@ _orient_apply(Ephoto_Flow_Browser *fb)
return;
}
DBG("orient: %d, signal '%s'", fb->orient, sig);
edje_object_signal_emit(fb->edje, sig, "ephoto");
edje_object_signal_emit(fb->orient_edje, sig, "ephoto");
}
static void
@ -330,23 +347,22 @@ _ephoto_flow_browser_toolbar_eval(Ephoto_Flow_Browser *fb)
{
if (!fb->entry)
{
edje_object_signal_emit(fb->edje, "slideshow,disable", "ephoto");
edje_object_signal_emit(fb->edje, "prev,disable", "ephoto");
edje_object_signal_emit(fb->edje, "next,disable", "ephoto");
elm_toolbar_item_disabled_set(fb->action.go_first, EINA_TRUE);
elm_toolbar_item_disabled_set(fb->action.go_prev, EINA_TRUE);
elm_toolbar_item_disabled_set(fb->action.go_next, EINA_TRUE);
elm_toolbar_item_disabled_set(fb->action.go_last, EINA_TRUE);
elm_toolbar_item_disabled_set(fb->action.slideshow, EINA_TRUE);
}
else
{
edje_object_signal_emit(fb->edje, "slideshow,enable", "ephoto");
Eina_Bool is_first = fb->entry == _first_entry_find(fb);
Eina_Bool is_last = fb->entry == _last_entry_find(fb);
if (fb->entry == _first_entry_find(fb))
edje_object_signal_emit(fb->edje, "prev,disable", "ephoto");
else
edje_object_signal_emit(fb->edje, "prev,enable", "ephoto");
if (fb->entry == _last_entry_find(fb))
edje_object_signal_emit(fb->edje, "next,disable", "ephoto");
else
edje_object_signal_emit(fb->edje, "next,enable", "ephoto");
elm_toolbar_item_disabled_set(fb->action.go_first, is_first);
elm_toolbar_item_disabled_set(fb->action.go_prev, is_first);
elm_toolbar_item_disabled_set(fb->action.go_next, is_last);
elm_toolbar_item_disabled_set(fb->action.go_last, is_last);
elm_toolbar_item_disabled_set(fb->action.slideshow, EINA_FALSE);
}
}
@ -396,11 +412,12 @@ _ephoto_flow_browser_recalc(Ephoto_Flow_Browser *fb)
if (fb->path)
{
const char *bname = ecore_file_file_get(fb->path);
fb->viewer = _viewer_add(fb->layout, fb->path);
elm_layout_content_set(fb->layout, "ephoto.swallow.flow", fb->viewer);
fb->viewer = _viewer_add(fb->orient_layout, fb->path);
elm_layout_content_set
(fb->orient_layout, "elm.swallow.content", fb->viewer);
evas_object_event_callback_add
(fb->viewer, EVAS_CALLBACK_MOUSE_WHEEL, _mouse_wheel, fb);
edje_object_part_text_set(fb->edje, "ephoto.text.title", bname);
edje_object_part_text_set(fb->edje, "elm.text.title", bname);
ephoto_title_set(fb->ephoto, bname);
fb->orient = ephoto_file_orient_get(fb->path);
_orient_apply(fb);
@ -419,31 +436,34 @@ _zoom_set(Ephoto_Flow_Browser *fb, double zoom)
_viewer_zoom_set(fb->viewer, zoom);
fb->zoom = zoom;
if (zoom <= ZOOM_MIN)
edje_object_signal_emit(fb->edje, "zoom_out,disable", "ephoto");
else
edje_object_signal_emit(fb->edje, "zoom_out,enable", "ephoto");
if (zoom >= ZOOM_MAX)
edje_object_signal_emit(fb->edje, "zoom_in,disable", "ephoto");
else
edje_object_signal_emit(fb->edje, "zoom_in,enable", "ephoto");
elm_toolbar_item_disabled_set(fb->action.zoom_out, zoom <= ZOOM_MIN);
elm_toolbar_item_disabled_set(fb->action.zoom_in, zoom >= ZOOM_MAX);
}
static void
_zoom_in(void *data, Evas_Object *o __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
_zoom_in(void *data, Evas_Object *o __UNUSED__, void *event_info __UNUSED__)
{
Ephoto_Flow_Browser *fb = data;
elm_toolbar_item_unselect(fb->action.zoom_in);
_zoom_set(fb, fb->zoom + ZOOM_STEP);
}
static void
_zoom_out(void *data, Evas_Object *o __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
_zoom_out(void *data, Evas_Object *o __UNUSED__, void *event_info __UNUSED__)
{
Ephoto_Flow_Browser *fb = data;
elm_toolbar_item_unselect(fb->action.zoom_out);
_zoom_set(fb, fb->zoom - ZOOM_STEP);
}
static void
_zoom_1(void *data, Evas_Object *o __UNUSED__, void *event_info __UNUSED__)
{
Ephoto_Flow_Browser *fb = data;
elm_toolbar_item_unselect(fb->action.zoom_1);
_zoom_set(fb, 1.0);
}
static void
_next_entry(Ephoto_Flow_Browser *fb)
{
@ -501,17 +521,76 @@ _last_entry(Ephoto_Flow_Browser *fb)
}
static void
_next_button(void *data, Evas_Object *o __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
_go_first(void *data, Evas_Object *o __UNUSED__, void *event_info __UNUSED__)
{
Ephoto_Flow_Browser *fb = data;
elm_toolbar_item_unselect(fb->action.go_first);
_first_entry(fb);
}
static void
_go_prev(void *data, Evas_Object *o __UNUSED__, void *event_info __UNUSED__)
{
Ephoto_Flow_Browser *fb = data;
elm_toolbar_item_unselect(fb->action.go_prev);
_prev_entry(fb);
}
static void
_go_next(void *data, Evas_Object *o __UNUSED__, void *event_info __UNUSED__)
{
Ephoto_Flow_Browser *fb = data;
elm_toolbar_item_unselect(fb->action.go_next);
_next_entry(fb);
}
static void
_prev_button(void *data, Evas_Object *o __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
_go_last(void *data, Evas_Object *o __UNUSED__, void *event_info __UNUSED__)
{
Ephoto_Flow_Browser *fb = data;
_prev_entry(fb);
elm_toolbar_item_unselect(fb->action.go_last);
_last_entry(fb);
}
static void
_go_rotate_counterclock(void *data, Evas_Object *o __UNUSED__, void *event_info __UNUSED__)
{
Ephoto_Flow_Browser *fb = data;
elm_toolbar_item_unselect(fb->action.rotate_counterclock);
_rotate_counterclock(fb);
}
static void
_go_rotate_clock(void *data, Evas_Object *o __UNUSED__, void *event_info __UNUSED__)
{
Ephoto_Flow_Browser *fb = data;
elm_toolbar_item_unselect(fb->action.rotate_clock);
_rotate_clock(fb);
}
static void
_go_flip_horiz(void *data, Evas_Object *o __UNUSED__, void *event_info __UNUSED__)
{
Ephoto_Flow_Browser *fb = data;
elm_toolbar_item_unselect(fb->action.flip_horiz);
_flip_horiz(fb);
}
static void
_go_flip_vert(void *data, Evas_Object *o __UNUSED__, void *event_info __UNUSED__)
{
Ephoto_Flow_Browser *fb = data;
elm_toolbar_item_unselect(fb->action.flip_vert);
_flip_vert(fb);
}
static void
_slideshow(void *data, Evas_Object *o __UNUSED__, void *event_info __UNUSED__)
{
Ephoto_Flow_Browser *fb = data;
elm_toolbar_item_unselect(fb->action.slideshow);
if (fb->entry)
evas_object_smart_callback_call(fb->layout, "slideshow", fb->entry);
}
static void
@ -577,6 +656,56 @@ _layout_del(void *data, Evas *e __UNUSED__, Evas_Object *o __UNUSED__, void *eve
free(fb);
}
/* FIXME: this should go in elm_icon itself! */
static Eina_Bool
_icon_load(Evas_Object *ic, const char *name, int size)
{
char *path;
if (elm_icon_standard_set(ic, name)) return EINA_TRUE;
path = efreet_icon_path_find(getenv("E_ICON_THEME"), name, size);
if (!path)
{
const char **itr, *themes[] = {
"default", "highcolor", "gnome", "Human", "oxygen", NULL
};
for (itr = themes; *itr; itr++)
{
path = efreet_icon_path_find(*itr, name, size);
if (path) break;
}
}
if (!path) return EINA_FALSE;
elm_icon_file_set(ic, path, NULL);
free(path);
return EINA_TRUE;
}
static Elm_Toolbar_Item *
_toolbar_item_add(Ephoto_Flow_Browser *fb, const char *icon, const char *label, Evas_Smart_Cb cb)
{
/* FIXME TODO: toolbar should get a string as icon, get it from theme
* for toolbar or menu, and fallback to freedesktop.org icon if not found
*/
Evas_Object *ic = elm_icon_add(fb->toolbar);
if (!_icon_load(ic, icon, elm_toolbar_icon_size_get(fb->toolbar)))
{
evas_object_del(ic);
ic = NULL;
}
return elm_toolbar_item_add(fb->toolbar, ic, label, cb, fb);
}
static Elm_Toolbar_Item *
_toolbar_item_separator_add(Ephoto_Flow_Browser *fb)
{
Elm_Toolbar_Item *it = elm_toolbar_item_add
(fb->toolbar, NULL, NULL, NULL, NULL);
elm_toolbar_item_separator_set(it, EINA_TRUE);
return it;
}
Evas_Object *
ephoto_flow_browser_add(Ephoto *ephoto, Evas_Object *parent)
{
@ -597,23 +726,74 @@ ephoto_flow_browser_add(Ephoto *ephoto, Evas_Object *parent)
elm_object_focus_allow_set(layout, EINA_TRUE);
evas_object_data_set(layout, "flow_browser", fb);
edje_object_signal_callback_add
(fb->edje, "zoom_out,clicked", "ephoto", _zoom_out, fb);
edje_object_signal_callback_add
(fb->edje, "zoom_in,clicked", "ephoto", _zoom_in, fb);
edje_object_signal_callback_add
(fb->edje, "prev,clicked", "ephoto", _prev_button, fb);
edje_object_signal_callback_add
(fb->edje, "next,clicked", "ephoto", _next_button, fb);
edje_object_signal_callback_add
(fb->edje, "back", "ephoto", _back, fb);
edje_object_signal_callback_add(fb->edje, "elm,action,back", "", _back, fb);
if (!elm_layout_file_set(layout, THEME_FILE, "ephoto/flow/layout"))
if (!elm_layout_theme_set
(layout, "layout", "application", "toolbar-content-back"))
{
evas_object_del(layout);
return NULL;
ERR("could not load style 'toolbar-content-back' from theme");
goto error;
}
fb->toolbar = edje_object_part_external_object_get
(fb->edje, "elm.external.toolbar");
if (!fb->toolbar)
{
ERR("no toolbar in layout!");
goto error;
}
elm_toolbar_homogenous_set(fb->toolbar, EINA_FALSE);
fb->action.slideshow = _toolbar_item_add
(fb, "media-playback-start", "Slideshow", _slideshow);
fb->action.zoom_in = _toolbar_item_add
(fb, "zoom-in", "Zoom In", _zoom_in);
fb->action.zoom_out = _toolbar_item_add
(fb, "zoom-out", "Zoom Out", _zoom_out);
fb->action.zoom_1 = _toolbar_item_add
(fb, "zoom-original", "Zoom 1:1", _zoom_1);
_toolbar_item_separator_add(fb);
fb->action.go_first = _toolbar_item_add(fb, "go-first", "First", _go_first);
fb->action.go_prev = _toolbar_item_add
(fb, "go-previous", "Previous", _go_prev);
fb->action.go_next = _toolbar_item_add(fb, "go-next", "Next", _go_next);
fb->action.go_last = _toolbar_item_add(fb, "go-last", "Last", _go_last);
_toolbar_item_separator_add(fb);
fb->action.rotate_counterclock = _toolbar_item_add
(fb, "object-rotate-left", "Rotate Left", _go_rotate_counterclock);
fb->action.rotate_clock = _toolbar_item_add
(fb, "object-rotate-right", "Rotate Right", _go_rotate_clock);
fb->action.flip_horiz = _toolbar_item_add
(fb, "object-flip-horizontal", "Flip Horiz.", _go_flip_horiz);
fb->action.flip_vert = _toolbar_item_add
(fb, "object-flip-vertical", "Flip Vert.", _go_flip_vert);
elm_toolbar_item_tooltip_text_set
(fb->action.rotate_counterclock,
"Rotate object to the left (counter-clockwise)");
elm_toolbar_item_tooltip_text_set
(fb->action.rotate_clock, "Rotate object to the right (clockwise)");
elm_toolbar_item_tooltip_text_set
(fb->action.flip_horiz, "Flip object horizontally");
elm_toolbar_item_tooltip_text_set
(fb->action.flip_vert, "Flip object vertically");
fb->orient_layout = elm_layout_add(layout);
if (!elm_layout_theme_set
(fb->orient_layout, "layout", "ephoto", "orient"))
{
ERR("could not load style 'ephoto/orient' from theme");
goto error;
}
fb->orient_edje = elm_layout_edje_get(fb->orient_layout);
elm_layout_content_set(fb->layout, "elm.swallow.content", fb->orient_layout);
_ephoto_flow_browser_toolbar_eval(fb);
return layout;

View File

@ -16,7 +16,7 @@ _ephoto_thumb_browser_show(Ephoto *ephoto, Ephoto_Entry *entry)
ephoto_slideshow_entry_set(ephoto->slideshow, NULL);
elm_object_focus(ephoto->thumb_browser);
evas_object_focus_set(ephoto->thumb_browser, EINA_TRUE); // TODO while elm_layout is broken WRT focus
edje_object_signal_emit(ephoto->edje, "thumb_browser,show", "ephoto");
elm_pager_content_promote(ephoto->pager, ephoto->thumb_browser);
_ephoto_state_set(ephoto, EPHOTO_STATE_THUMB);
if ((entry) && (entry->item)) elm_gengrid_item_bring_in(entry->item);
@ -29,7 +29,7 @@ _ephoto_flow_browser_show(Ephoto *ephoto, Ephoto_Entry *entry)
ephoto_flow_browser_entry_set(ephoto->flow_browser, entry);
elm_object_focus(ephoto->flow_browser);
evas_object_focus_set(ephoto->flow_browser, EINA_TRUE); // TODO while elm_layout is broken WRT focus
edje_object_signal_emit(ephoto->edje, "flow_browser,show", "ephoto");
elm_pager_content_promote(ephoto->pager, ephoto->flow_browser);
_ephoto_state_set(ephoto, EPHOTO_STATE_FLOW);
}
@ -40,7 +40,7 @@ _ephoto_slideshow_show(Ephoto *ephoto, Ephoto_Entry *entry)
ephoto_slideshow_entry_set(ephoto->slideshow, entry);
elm_object_focus(ephoto->slideshow);
evas_object_focus_set(ephoto->slideshow, EINA_TRUE); // TODO while elm_layout is broken WRT focus
edje_object_signal_emit(ephoto->edje, "slideshow,show", "ephoto");
elm_pager_content_promote(ephoto->pager, ephoto->slideshow);
_ephoto_state_set(ephoto, EPHOTO_STATE_SLIDESHOW);
}
@ -119,8 +119,6 @@ ephoto_window_add(const char *path)
{
Ephoto *ephoto = calloc(1, sizeof(Ephoto));
Ethumb_Client *client = elm_thumb_ethumb_client_get();
Evas_Coord mw, mh, iw, ih;
const char *s;
EINA_SAFETY_ON_NULL_RETURN_VAL(ephoto, NULL);
ephoto->win = elm_win_add(NULL, "ephoto", ELM_WIN_BASIC);
@ -157,75 +155,54 @@ ephoto_window_add(const char *path)
elm_win_resize_object_add(ephoto->win, ephoto->bg);
evas_object_show(ephoto->bg);
ephoto->layout = elm_layout_add(ephoto->win);
if (!elm_layout_file_set(ephoto->layout, THEME_FILE, "ephoto/main/layout"))
{
ERR("could not load group 'ephoto/main/layout' from file %s",
THEME_FILE);
evas_object_del(ephoto->win);
return NULL;
}
ephoto->edje = elm_layout_edje_get(ephoto->layout);
ephoto->pager = elm_pager_add(ephoto->win);
elm_object_style_set(ephoto->pager, "fade_invisible");
evas_object_size_hint_weight_set
(ephoto->layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
(ephoto->pager, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_fill_set
(ephoto->layout, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_win_resize_object_add(ephoto->win, ephoto->layout);
evas_object_show(ephoto->layout);
(ephoto->pager, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_win_resize_object_add(ephoto->win, ephoto->pager);
evas_object_show(ephoto->pager);
ephoto->thumb_browser = ephoto_thumb_browser_add(ephoto, ephoto->layout);
ephoto->thumb_browser = ephoto_thumb_browser_add(ephoto, ephoto->pager);
if (!ephoto->thumb_browser)
{
ERR("could not add thumb browser");
evas_object_del(ephoto->win);
return NULL;
}
elm_layout_content_set
(ephoto->layout, "ephoto.swallow.thumb_browser", ephoto->thumb_browser);
elm_pager_content_push(ephoto->pager, ephoto->thumb_browser);
evas_object_smart_callback_add
(ephoto->thumb_browser, "view", _ephoto_thumb_browser_view, ephoto);
evas_object_smart_callback_add
(ephoto->thumb_browser, "slideshow",
_ephoto_thumb_browser_slideshow, ephoto);
ephoto->flow_browser = ephoto_flow_browser_add(ephoto, ephoto->layout);
ephoto->flow_browser = ephoto_flow_browser_add(ephoto, ephoto->pager);
if (!ephoto->flow_browser)
{
ERR("could not add flow browser");
evas_object_del(ephoto->win);
return NULL;
}
elm_layout_content_set
(ephoto->layout, "ephoto.swallow.flow_browser", ephoto->flow_browser);
elm_pager_content_push(ephoto->pager, ephoto->flow_browser);
evas_object_smart_callback_add
(ephoto->flow_browser, "back", _ephoto_flow_browser_back, ephoto);
evas_object_smart_callback_add
(ephoto->flow_browser, "slideshow",
_ephoto_flow_browser_slideshow, ephoto);
ephoto->slideshow = ephoto_slideshow_add(ephoto, ephoto->layout);
ephoto->slideshow = ephoto_slideshow_add(ephoto, ephoto->pager);
if (!ephoto->slideshow)
{
ERR("could not add flow browser");
evas_object_del(ephoto->win);
return NULL;
}
elm_layout_content_set
(ephoto->layout, "ephoto.swallow.slideshow", ephoto->slideshow);
elm_pager_content_push(ephoto->pager, ephoto->slideshow);
evas_object_smart_callback_add
(ephoto->slideshow, "back", _ephoto_slideshow_back, ephoto);
edje_object_size_min_get(ephoto->edje, &mw, &mh);
edje_object_size_min_restricted_calc(ephoto->edje, &mw, &mh, mw, mh);
if (mw < 1) mw = 320;
if (mh < 1) mh = 240;
s = edje_object_data_get(ephoto->edje, "initial_size");
if ((!s) || (sscanf(s, "%d %d", &iw, &ih) != 2)) iw = ih = 0;
if (iw < mw) iw = mw;
if (ih < mh) ih = mh;
evas_object_resize(ephoto->win, iw, ih);
if ((!path) || (!ecore_file_exists(path)))
{
ephoto_thumb_browser_directory_set
@ -248,10 +225,13 @@ ephoto_window_add(const char *path)
elm_object_focus(ephoto->flow_browser);
evas_object_focus_set(ephoto->flow_browser, EINA_TRUE); // TODO while elm_layout is broken WRT focus
edje_object_signal_emit(ephoto->edje, "flow_browser,show", "ephoto");
elm_pager_content_promote(ephoto->pager, ephoto->flow_browser);
ephoto->state = EPHOTO_STATE_FLOW;
}
/* TODO restore size from last run as well? */
evas_object_resize(ephoto->win, 900, 600);
return ephoto->win;
}

View File

@ -14,7 +14,14 @@ struct _Ephoto_Thumb_Browser
Evas_Object *layout;
Evas_Object *edje;
Evas_Object *grid;
Evas_Object *toolbar;
Eio_File *ls;
struct {
Elm_Toolbar_Item *zoom_in;
Elm_Toolbar_Item *zoom_out;
Elm_Toolbar_Item *view_flow;
Elm_Toolbar_Item *slideshow;
} action;
struct {
const char *path;
void (*cb)(void *data, Ephoto_Entry *entry);
@ -310,6 +317,8 @@ _ephoto_thumb_selected(void *data, Evas_Object *o __UNUSED__, void *event_info)
evas_object_smart_callback_call(tb->layout, "view", e);
}
/* TODO: elm_fileselector_entry and use the activated/file,chosen here */
/*
static void
_changed_dir(void *data, Evas_Object *o __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
{
@ -324,6 +333,7 @@ _changed_dir(void *data, Evas_Object *o __UNUSED__, const char *emission __UNUSE
ephoto_thumb_browser_directory_set(tb->layout, p.s);
}
*/
static void
_zoom_set(Ephoto_Thumb_Browser *tb, int zoom)
@ -334,31 +344,61 @@ _zoom_set(Ephoto_Thumb_Browser *tb, int zoom)
ephoto_thumb_size_set(tb->ephoto, zoom);
elm_gengrid_item_size_set(tb->grid, zoom, zoom);
if (zoom == ZOOM_MIN)
edje_object_signal_emit(tb->edje, "zoom_out,disable", "ephoto");
else
edje_object_signal_emit(tb->edje, "zoom_out,enable", "ephoto");
if (zoom == ZOOM_MAX)
edje_object_signal_emit(tb->edje, "zoom_in,disable", "ephoto");
else
edje_object_signal_emit(tb->edje, "zoom_in,enable", "ephoto");
elm_toolbar_item_disabled_set(tb->action.zoom_out, zoom == ZOOM_MIN);
elm_toolbar_item_disabled_set(tb->action.zoom_in, zoom == ZOOM_MAX);
}
static void
_zoom_in(void *data, Evas_Object *o __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
_zoom_in(void *data, Evas_Object *o __UNUSED__, void *event_info __UNUSED__)
{
Ephoto_Thumb_Browser *tb = data;
elm_toolbar_item_unselect(tb->action.zoom_in);
_zoom_set(tb, tb->ephoto->config->thumb_size + ZOOM_STEP);
}
static void
_zoom_out(void *data, Evas_Object *o __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
_zoom_out(void *data, Evas_Object *o __UNUSED__, void *event_info __UNUSED__)
{
Ephoto_Thumb_Browser *tb = data;
elm_toolbar_item_unselect(tb->action.zoom_out);
_zoom_set(tb, tb->ephoto->config->thumb_size - ZOOM_STEP);
}
static void
_view_flow(void *data, Evas_Object *o __UNUSED__, void *event_info __UNUSED__)
{
Ephoto_Thumb_Browser *tb = data;
Elm_Gengrid_Item *it = elm_gengrid_selected_item_get(tb->grid);
Ephoto_Entry *entry;
elm_toolbar_item_unselect(tb->action.view_flow);
if (it) entry = elm_gengrid_item_data_get(it);
else entry = _first_file_entry_find(tb);
if (!entry) return;
if (entry->is_dir)
ephoto_thumb_browser_directory_set(tb->layout, entry->path);
else
evas_object_smart_callback_call(tb->layout, "view", entry);
}
static void
_slideshow(void *data, Evas_Object *o __UNUSED__, void *event_info __UNUSED__)
{
Ephoto_Thumb_Browser *tb = data;
Elm_Gengrid_Item *it = elm_gengrid_selected_item_get(tb->grid);
Ephoto_Entry *entry;
elm_toolbar_item_unselect(tb->action.slideshow);
if (it) entry = elm_gengrid_item_data_get(it);
else entry = _first_file_entry_find(tb);
if (!entry) return;
evas_object_smart_callback_call(tb->layout, "slideshow", entry);
}
static void
_key_down(void *data, Evas *e __UNUSED__, Evas_Object *o __UNUSED__, void *event_info)
{
@ -404,6 +444,47 @@ _layout_del(void *data, Evas *e __UNUSED__, Evas_Object *o __UNUSED__, void *eve
free(tb);
}
/* FIXME: this should go in elm_icon itself! */
static Eina_Bool
_icon_load(Evas_Object *ic, const char *name, int size)
{
char *path;
if (elm_icon_standard_set(ic, name)) return EINA_TRUE;
path = efreet_icon_path_find(getenv("E_ICON_THEME"), name, size);
if (!path)
{
const char **itr, *themes[] = {
"default", "highcolor", "gnome", "Human", "oxygen", NULL
};
for (itr = themes; *itr; itr++)
{
path = efreet_icon_path_find(*itr, name, size);
if (path) break;
}
}
if (!path) return EINA_FALSE;
elm_icon_file_set(ic, path, NULL);
free(path);
return EINA_TRUE;
}
static Elm_Toolbar_Item *
_toolbar_item_add(Ephoto_Thumb_Browser *tb, const char *icon, const char *label, Evas_Smart_Cb cb)
{
/* FIXME TODO: toolbar should get a string as icon, get it from theme
* for toolbar or menu, and fallback to freedesktop.org icon if not found
*/
Evas_Object *ic = elm_icon_add(tb->toolbar);
if (!_icon_load(ic, icon, elm_toolbar_icon_size_get(tb->toolbar)))
{
evas_object_del(ic);
ic = NULL;
}
return elm_toolbar_item_add(tb->toolbar, ic, label, cb, tb);
}
Evas_Object *
ephoto_thumb_browser_add(Ephoto *ephoto, Evas_Object *parent)
{
@ -421,20 +502,38 @@ ephoto_thumb_browser_add(Ephoto *ephoto, Evas_Object *parent)
evas_object_event_callback_add
(layout, EVAS_CALLBACK_KEY_DOWN, _key_down, tb);
evas_object_data_set(layout, "thumb_browser", tb);
edje_object_signal_callback_add
(tb->edje, "location,changed", "ephoto", _changed_dir, tb);
edje_object_signal_callback_add
(tb->edje, "zoom_out,clicked", "ephoto", _zoom_out, tb);
edje_object_signal_callback_add
(tb->edje, "zoom_in,clicked", "ephoto", _zoom_in, tb);
if (!elm_layout_file_set(layout, THEME_FILE, "ephoto/browser/layout"))
if (!elm_layout_theme_set
(layout, "layout", "application", "toolbar-content"))
{
ERR("could not load group 'ephoto/browser/layout' from file %s",
THEME_FILE);
ERR("could not load style 'toolbar-content' from theme");
goto error;
}
tb->toolbar = edje_object_part_external_object_get
(tb->edje, "elm.external.toolbar");
if (!tb->toolbar)
{
ERR("no toolbar in layout!");
goto error;
}
elm_toolbar_homogenous_set(tb->toolbar, EINA_FALSE);
tb->action.slideshow = _toolbar_item_add
(tb, "media-playback-start", "Slideshow", _slideshow);
tb->action.zoom_in = _toolbar_item_add
(tb, "zoom-in", "Zoom In", _zoom_in);
tb->action.zoom_out = _toolbar_item_add
(tb, "zoom-out", "Zoom Out", _zoom_out);
tb->action.view_flow = _toolbar_item_add
(tb, "image", "Larger", _view_flow);
/* TODO: elm_fileselector_entry and use it with a toolbar-vbox
*
* TODO: elm_layout_box_*, similar to elm_layout_content_set(), it will
* register the sub-object and re-add it during theme changes.
*/
tb->grid = elm_gengrid_add(layout);
EINA_SAFETY_ON_NULL_GOTO(tb->grid, error);
elm_object_style_set(tb->grid, "ephoto");
@ -451,7 +550,7 @@ ephoto_thumb_browser_add(Ephoto *ephoto, Evas_Object *parent)
_zoom_set(tb, tb->ephoto->config->thumb_size);
elm_layout_content_set(tb->layout, "ephoto.swallow.thumb", tb->grid);
elm_layout_content_set(tb->layout, "elm.swallow.content", tb->grid);
return layout;