Enlightenment CVS committal
Author : titan
Project : e17
Module : apps/ephoto
Dir : e17/apps/ephoto/src/bin
Modified Files:
ephoto.h ephoto_edit_view.c ephoto_exif.c ephoto_gui.c
ephoto_list_view.c ephoto_main.c ephoto_normal_view.c
Log Message:
Miscellaneous cleanups
===================================================================
RCS file: /cvs/e/e17/apps/ephoto/src/bin/ephoto.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- ephoto.h 18 Feb 2007 01:02:43 -0000 1.2
+++ ephoto.h 20 Feb 2007 03:45:58 -0000 1.3
@@ -53,14 +53,20 @@
void update_image(Ewl_Widget *image, int w, int h, unsigned int *data);
/* Ephoto Edit View */
+Ewl_Widget *add_edit_view(Ewl_Widget *c);
void add_edit_tools(Ewl_Widget *c);
/* Ephoto List View */
+Ewl_Widget *add_list_view(Ewl_Widget *c);
Ewl_Widget *add_ltree(Ewl_Widget *c);
/* Ephoto Normal View */
+Ewl_Widget *add_normal_view(Ewl_Widget *c);
void set_info(Ewl_Widget *w, void *event, void *data);
+/* Ephoto Thumbnail */
+void generate_thumbnail(Ewl_Widget *image, char *path);
+
/* Ephoto Utilities*/
char *image_pixels_string_get(const char *file);
void image_pixels_int_get(const char *file, int *width, int *height);
@@ -72,23 +78,34 @@
void show_list_view(Ewl_Widget *w, void *event, void *data);
/* Ephoto Global Variables */
-extern Ewl_Widget *atree;
-extern Ewl_Widget *tbar;
-extern Ewl_Widget *vcombo;
-extern Ewl_Widget *view_box;
-extern Ewl_Widget *fbox_vbox;
-extern Ewl_Widget *edit_vbox;
-extern Ewl_Widget *list_vbox;
-extern Ewl_Widget *fbox;
-extern Ewl_Widget *eimage;
-extern Ewl_Widget *ltree;
-extern Ewl_Widget *ilabel;
-extern Ewl_Widget *currenta;
-extern Ewl_Widget *currentf;
-extern Ewl_Widget *currenti;
-extern Ewl_Widget *toolbar;
-extern Ewl_Widget *edit_tools;
-extern Ecore_List *images;
+typedef struct _Ephoto_Main Ephoto_Main;
+
+struct _Ephoto_Main
+{
+ char **views;
+ Ecore_List *albums;
+ Ecore_List *images;
+ Ewl_Widget *atree;
+ Ewl_Widget *currenta;
+ Ewl_Widget *currentf;
+ Ewl_Widget *currenti;
+ Ewl_Widget *edit_tools;
+ Ewl_Widget *edit_vbox;
+ Ewl_Widget *eimage;
+ Ewl_Widget *fbox_vbox;
+ Ewl_Widget *fbox;
+ Ewl_Widget *ilabel;
+ Ewl_Widget *list_vbox;
+ Ewl_Widget *ltree;
+ Ewl_Widget *tbar;
+ Ewl_Widget *toolbar;
+ Ewl_Widget *vcombo;
+ Ewl_Widget *view_box;
+ Ewl_Widget *win;
+ sqlite3 *db;
+};
+
+extern Ephoto_Main *em;
/* NLS */
#ifdef ENABLE_NLS
===================================================================
RCS file: /cvs/e/e17/apps/ephoto/src/bin/ephoto_edit_view.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- ephoto_edit_view.c 18 Feb 2007 01:32:10 -0000 1.3
+++ ephoto_edit_view.c 20 Feb 2007 03:45:58 -0000 1.4
@@ -8,16 +8,32 @@
static void rotate_image_left(Ewl_Widget *w, void *event, void *data);
static void rotate_image_right(Ewl_Widget *w, void *event, void *data);
+/*Add the edit view*/
+Ewl_Widget *add_edit_view(Ewl_Widget *c)
+{
+ em->edit_vbox = ewl_vbox_new();
+ ewl_object_fill_policy_set(EWL_OBJECT(em->edit_vbox),
EWL_FLAG_FILL_ALL);
+ ewl_container_child_append(EWL_CONTAINER(c), em->edit_vbox);
+ ewl_widget_show(em->edit_vbox);
+ ewl_notebook_page_tab_text_set(EWL_NOTEBOOK(c), em->edit_vbox, "Edit");
+
+ em->eimage = add_image(em->edit_vbox, NULL, 0, NULL, NULL);
+ ewl_object_alignment_set(EWL_OBJECT(em->eimage),
EWL_FLAG_ALIGN_CENTER);
+ ewl_object_fill_policy_set(EWL_OBJECT(em->eimage),
EWL_FLAG_FILL_SHRINK);
+
+ return em->edit_vbox;
+}
+
/*Show the edit view*/
void show_edit_view(Ewl_Widget *w, void *event, void *data)
{
- ewl_notebook_visible_page_set(EWL_NOTEBOOK(view_box), edit_vbox);
- ecore_dlist_goto_first(images);
- ewl_widget_show(edit_tools);
- ewl_widget_hide(atree);
- ewl_widget_hide(tbar);
- ewl_widget_hide(ilabel);
- ewl_widget_reparent(eimage);
+ ewl_notebook_visible_page_set(EWL_NOTEBOOK(em->view_box),
em->edit_vbox);
+ ecore_dlist_goto_first(em->images);
+ ewl_widget_show(em->edit_tools);
+ ewl_widget_hide(em->atree);
+ ewl_widget_hide(em->tbar);
+ ewl_widget_hide(em->ilabel);
+ ewl_widget_reparent(em->eimage);
}
/*Add edit tools to container c*/
@@ -57,15 +73,15 @@
{
char *image;
- ecore_dlist_previous(images);
- image = ecore_dlist_current(images);
+ ecore_dlist_previous(em->images);
+ image = ecore_dlist_current(em->images);
if(!image)
{
- ecore_dlist_goto_last(images);
- image = ecore_dlist_current(images);
+ ecore_dlist_goto_last(em->images);
+ image = ecore_dlist_current(em->images);
}
- ewl_image_file_path_set(EWL_IMAGE(eimage), image);
- ewl_widget_configure(eimage->parent);
+ ewl_image_file_path_set(EWL_IMAGE(em->eimage), image);
+ ewl_widget_configure(em->eimage->parent);
return;
}
@@ -76,15 +92,15 @@
{
char *image;
- ecore_dlist_next(images);
- image = ecore_dlist_current(images);
+ ecore_dlist_next(em->images);
+ image = ecore_dlist_current(em->images);
if(!image)
{
- ecore_dlist_goto_first(images);
- image = ecore_dlist_current(images);
+ ecore_dlist_goto_first(em->images);
+ image = ecore_dlist_current(em->images);
}
- ewl_image_file_path_set(EWL_IMAGE(eimage), image);
- ewl_widget_configure(eimage->parent);
+ ewl_image_file_path_set(EWL_IMAGE(em->eimage), image);
+ ewl_widget_configure(em->eimage->parent);
return;
}
@@ -96,12 +112,18 @@
{
unsigned int *image_data;
int nw, nh;
+ Ewl_Image *image;
- evas_object_image_size_get(EWL_IMAGE(eimage)->image, &nw, &nh);
- image_data = flip_horizontal(eimage);
- update_image(eimage, nw, nh, image_data);
- ewl_widget_configure(eimage);
- ewl_widget_configure(eimage->parent);
+ evas_object_image_size_get(EWL_IMAGE(em->eimage)->image, &nw, &nh);
+ image_data = flip_horizontal(em->eimage);
+ update_image(em->eimage, nw, nh, image_data);
+ ewl_image_size_set(EWL_IMAGE(em->eimage), nh, nw);
+ image = (Ewl_Image *)em->eimage;
+ image->ow = nw;
+ image->oh = nh;
+ ewl_object_preferred_inner_size_set(EWL_OBJECT(em->eimage), nw, nh);
+ ewl_widget_configure(em->eimage);
+ ewl_widget_configure(em->eimage->parent);
return;
}
@@ -111,12 +133,18 @@
{
unsigned int *image_data;
int nw, nh;
+ Ewl_Image *image;
- evas_object_image_size_get(EWL_IMAGE(eimage)->image, &nw, &nh);
- image_data = flip_vertical(eimage);
- update_image(eimage, nw, nh, image_data);
- ewl_widget_configure(eimage);
- ewl_widget_configure(eimage->parent);
+ evas_object_image_size_get(EWL_IMAGE(em->eimage)->image, &nw, &nh);
+ image_data = flip_vertical(em->eimage);
+ update_image(em->eimage, nw, nh, image_data);
+ ewl_image_size_set(EWL_IMAGE(em->eimage), nh, nw);
+ image = (Ewl_Image *)em->eimage;
+ image->ow = nw;
+ image->oh = nh;
+ ewl_object_preferred_inner_size_set(EWL_OBJECT(em->eimage), nh, nw);
+ ewl_widget_configure(em->eimage);
+ ewl_widget_configure(em->eimage->parent);
return;
}
@@ -126,12 +154,18 @@
{
unsigned int *image_data;
int nw, nh;
+ Ewl_Image *image;
- evas_object_image_size_get(EWL_IMAGE(eimage)->image, &nh, &nw);
- image_data = rotate_left(eimage);
- update_image(eimage, nw, nh, image_data);
- ewl_widget_configure(eimage);
- ewl_widget_configure(eimage->parent);
+ evas_object_image_size_get(EWL_IMAGE(em->eimage)->image, &nh, &nw);
+ image_data = rotate_left(em->eimage);
+ update_image(em->eimage, nw, nh, image_data);
+ ewl_image_size_set(EWL_IMAGE(em->eimage), nh, nw);
+ image = (Ewl_Image *)em->eimage;
+ image->ow = nw;
+ image->oh = nh;
+ ewl_object_preferred_inner_size_set(EWL_OBJECT(em->eimage), nw, nh);
+ ewl_widget_configure(em->eimage);
+ ewl_widget_configure(em->eimage->parent);
return;
}
@@ -141,12 +175,17 @@
{
unsigned int *image_data;
int nw, nh;
+ Ewl_Image *image;
- evas_object_image_size_get(EWL_IMAGE(eimage)->image, &nh, &nw);
- image_data = rotate_right(eimage);
- update_image(eimage, nw, nh, image_data);
- ewl_widget_configure(eimage);
- ewl_widget_configure(eimage->parent);
+ evas_object_image_size_get(EWL_IMAGE(em->eimage)->image, &nh, &nw);
+ image_data = rotate_right(em->eimage);
+ update_image(em->eimage, nw, nh, image_data);
+ image = (Ewl_Image *)em->eimage;
+ image->ow = nw;
+ image->oh = nh;
+ ewl_object_preferred_inner_size_set(EWL_OBJECT(em->eimage), nw, nh);
+ ewl_widget_configure(em->eimage);
+ ewl_widget_configure(em->eimage->parent);
return;
}
===================================================================
RCS file: /cvs/e/e17/apps/ephoto/src/bin/ephoto_exif.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- ephoto_exif.c 18 Feb 2007 00:17:17 -0000 1.3
+++ ephoto_exif.c 20 Feb 2007 03:45:58 -0000 1.4
@@ -58,17 +58,17 @@
{
const char *img;
- if (VISIBLE(fbox_vbox))
+ if (VISIBLE(em->fbox_vbox))
{
- img = ewl_widget_name_get(currentf);
+ img = ewl_widget_name_get(em->currentf);
}
- else if (VISIBLE(list_vbox))
+ else if (VISIBLE(em->list_vbox))
{
- img = ewl_widget_name_get(currenti);
+ img = ewl_widget_name_get(em->currenti);
}
- else if (VISIBLE(edit_vbox))
+ else if (VISIBLE(em->edit_vbox))
{
- img = ewl_image_file_path_get(EWL_IMAGE(eimage));
+ img = ewl_image_file_path_get(EWL_IMAGE(em->eimage));
}
return strdup(img);
===================================================================
RCS file: /cvs/e/e17/apps/ephoto/src/bin/ephoto_gui.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- ephoto_gui.c 15 Feb 2007 10:20:21 -0000 1.1
+++ ephoto_gui.c 20 Feb 2007 03:45:58 -0000 1.2
@@ -30,7 +30,8 @@
Ewl_Widget *add_image(Ewl_Widget *c, char *img, int thumbnail, void *cb, void
*data)
{
Ewl_Widget *image;
- int w, h;
+ char *thumb;
+ int w, h, pid;
if(!thumbnail)
{
@@ -39,28 +40,29 @@
{
ewl_image_file_path_set(EWL_IMAGE(image), img);
}
+
}
else
{
image_pixels_int_get(img, &w, &h);
-
- image = ewl_image_thumbnail_new();
- if (w > 75 || h > 75)
+ if(w > 75 || h > 75)
{
- if(image)
+ image = ewl_image_thumbnail_new();
+ ewl_image_file_path_set(EWL_IMAGE(image),
PACKAGE_DATA_DIR "/images/image.png");
+ if (img)
{
- ewl_image_file_path_set(EWL_IMAGE(image),
PACKAGE_DATA_DIR "/images/image.png");
ewl_image_thumbnail_request(EWL_IMAGE_THUMBNAIL(image), img);
}
}
else
{
- if(image)
+ image = ewl_image_new();
+ if (img)
{
ewl_image_file_path_set(EWL_IMAGE(image), img);
}
}
- ewl_image_constrain_set(EWL_IMAGE(image), 60);
+ ewl_image_constrain_set(EWL_IMAGE(image), 48);
}
ewl_image_proportional_set(EWL_IMAGE(image), TRUE);
ewl_object_alignment_set(EWL_OBJECT(image), EWL_FLAG_ALIGN_LEFT);
===================================================================
RCS file: /cvs/e/e17/apps/ephoto/src/bin/ephoto_list_view.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- ephoto_list_view.c 18 Feb 2007 01:02:43 -0000 1.2
+++ ephoto_list_view.c 20 Feb 2007 03:45:58 -0000 1.3
@@ -6,15 +6,29 @@
static void *list_data_fetch(void *data, unsigned int row, unsigned int
column);
static int list_data_count(void *data);
+/*Add the list view*/
+Ewl_Widget *add_list_view(Ewl_Widget *c)
+{
+ em->list_vbox = ewl_vbox_new();
+ ewl_object_fill_policy_set(EWL_OBJECT(em->list_vbox),
EWL_FLAG_FILL_ALL);
+ ewl_container_child_append(EWL_CONTAINER(c), em->list_vbox);
+ ewl_widget_show(em->list_vbox);
+ ewl_notebook_page_tab_text_set(EWL_NOTEBOOK(c), em->list_vbox, "List");
+
+ em->ltree = add_ltree(em->list_vbox);
+
+ return em->list_vbox;
+}
+
/*Show the list view*/
void show_list_view(Ewl_Widget *w, void *event, void *data)
{
- ewl_notebook_visible_page_set(EWL_NOTEBOOK(view_box), list_vbox);
- ewl_mvc_dirty_set(EWL_MVC(ltree), 1);
- ewl_widget_hide(edit_tools);
- ewl_widget_hide(ilabel);
- ewl_widget_show(atree);
- ewl_widget_show(tbar);
+ ewl_notebook_visible_page_set(EWL_NOTEBOOK(em->view_box),
em->list_vbox);
+ ewl_mvc_dirty_set(EWL_MVC(em->ltree), 1);
+ ewl_widget_hide(em->edit_tools);
+ ewl_widget_hide(em->ilabel);
+ ewl_widget_show(em->atree);
+ ewl_widget_show(em->tbar);
}
/*Create and Add a Tree to the Container c*/
@@ -30,6 +44,7 @@
tree = ewl_tree2_new();
ewl_tree2_headers_visible_set(EWL_TREE2(tree), 0);
+ ewl_tree2_fixed_rows_set(EWL_TREE2(tree), 1);
ewl_mvc_model_set(EWL_MVC(tree), model);
ewl_object_fill_policy_set(EWL_OBJECT(tree), EWL_FLAG_FILL_ALL);
ewl_container_child_append(EWL_CONTAINER(c), tree);
@@ -48,17 +63,14 @@
/* The view of the images */
static Ewl_Widget *list_view_new(void)
{
- Ewl_Widget *icon;
+ Ewl_Widget *hbox;
- icon = ewl_icon_new();
- ewl_icon_type_set(EWL_ICON(icon), EWL_ICON_TYPE_LONG);
- ewl_box_orientation_set(EWL_BOX(icon), EWL_ORIENTATION_HORIZONTAL);
- ewl_object_alignment_set(EWL_OBJECT(icon), EWL_FLAG_ALIGN_LEFT);
- ewl_object_fill_policy_set(EWL_OBJECT(icon), EWL_FLAG_FILL_ALL);
- ewl_callback_append(icon, EWL_CALLBACK_CLICKED, set_info, NULL);
- ewl_widget_show(icon);
+ hbox = ewl_hbox_new();
+ ewl_box_spacing_set(EWL_BOX(hbox), 10);
+ ewl_object_fill_policy_set(EWL_OBJECT(hbox), EWL_FLAG_FILL_HFILL);
+ ewl_widget_show(hbox);
- return icon;
+ return hbox;
}
/*The row that is added to the tree*/
@@ -68,36 +80,28 @@
char info[PATH_MAX];
int size;
int width, height;
- Ewl_Widget *text;
+ Ewl_Widget *img, *text;
image = data;
image_pixels_int_get(image, &width, &height);
- if(width > 75 || height > 75)
- {
- ewl_icon_thumbnailing_set(EWL_ICON(w), 1);
- }
- else
- {
- ewl_icon_thumbnailing_set(EWL_ICON(w), 0);
- }
- ewl_icon_image_set(EWL_ICON(w), image, NULL);
- ewl_icon_constrain_set(EWL_ICON(w), 67);
+
+ img = add_image(w, image, 1, NULL, NULL);
+ ewl_image_constrain_set(EWL_IMAGE(img), 48);
ewl_widget_name_set(w, image);
size = ecore_file_size(image);
-
- snprintf(info, PATH_MAX, "Name: %s\n"
- "Pixels: %s\n"
- "Size: %s\n",
+
+ snprintf(info, PATH_MAX, "Name: %s\nPixels: %s\nSize: %s\n",
basename(image),
image_pixels_string_get(image),
file_size_get(size));
text = ewl_text_new();
ewl_text_text_set(EWL_TEXT(text), info);
- ewl_object_alignment_set(EWL_OBJECT(text), EWL_FLAG_ALIGN_CENTER);
+ ewl_container_child_append(EWL_CONTAINER(w), text);
+ ewl_object_fill_policy_set(EWL_OBJECT(text), EWL_FLAG_FILL_SHRINK);
+ ewl_object_alignment_set(EWL_OBJECT(text), EWL_FLAG_ALIGN_LEFT);
ewl_widget_show(text);
- ewl_icon_extended_data_set(EWL_ICON(w), text);
return;
}
@@ -120,7 +124,7 @@
char *image;
void *val = NULL;
- image = ecore_list_goto_index(images, row);
+ image = ecore_list_goto_index(em->images, row);
if (image)
{
val = image;
@@ -134,7 +138,7 @@
{
int val;
- val = ecore_list_nodes(images);
+ val = ecore_list_nodes(em->images);
return val;
}
===================================================================
RCS file: /cvs/e/e17/apps/ephoto/src/bin/ephoto_main.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- ephoto_main.c 18 Feb 2007 01:02:43 -0000 1.3
+++ ephoto_main.c 20 Feb 2007 03:45:58 -0000 1.4
@@ -1,14 +1,5 @@
#include "ephoto.h"
-/*Ephoto Databasing Global Variables*/
-static sqlite3 *db;
-
-/*Ephoto Ecore Global Variables*/
-static Ecore_List *albums;
-
-/*Ephoto Layout Global Variable*/
-static char **views;
-
/*Ewl Callbacks*/
static void combo_changed(Ewl_Widget *w, void *event, void *data);
static void destroy(Ewl_Widget *w, void *event, void *data);
@@ -30,37 +21,33 @@
static int views_data_count(void *data);
/*Ephoto Global Variables*/
-Ewl_Widget *atree, *tbar, *vcombo, *view_box, *fbox_vbox, *edit_vbox,
*list_vbox, *fbox;
-Ewl_Widget *eimage, *ltree, *ilabel, *currenta, *currentf, *currenti,
*toolbar, *edit_tools;
-Ecore_List *images;
-
+Ephoto_Main *em;
/*Destroy the Main Window*/
static void destroy(Ewl_Widget *w, void *event, void *data)
{
- Ewl_Widget *window;
-
- window = data;
- ephoto_db_close(db);
- ewl_widget_destroy(window);
- ewl_main_quit();
+ ephoto_db_close(em->db);
+ ewl_widget_destroy(em->win);
+ ecore_list_destroy(em->albums);
+ ecore_list_destroy(em->images);
+ free(em->views);
+ free(em);
+ ewl_main_quit();
return;
}
static void window_fullscreen(Ewl_Widget *w, void *event, void *data)
{
int fullscreen;
- Ewl_Widget *window;
-
- window = data;
- fullscreen = ewl_window_fullscreen_get(EWL_WINDOW(window));
+
+ fullscreen = ewl_window_fullscreen_get(EWL_WINDOW(em->win));
if(!fullscreen)
{
- ewl_window_fullscreen_set(EWL_WINDOW(window), 1);
+ ewl_window_fullscreen_set(EWL_WINDOW(em->win), 1);
}
else
{
- ewl_window_fullscreen_set(EWL_WINDOW(window), 0);
+ ewl_window_fullscreen_set(EWL_WINDOW(em->win), 0);
}
return;
}
@@ -68,44 +55,46 @@
/*Create the Main Ephoto Window*/
void create_main_gui(void)
{
- Ewl_Widget *win, *vbox, *spacer, *text, *entry, *hbox;
+ Ewl_Widget *vbox, *spacer, *text, *entry, *hbox;
Ewl_Widget *rvbox, *sp, *hsep, *vsep, *image;
- Ewl_Widget *shbox, *seeker;
- win = ewl_window_new();
- ewl_window_title_set(EWL_WINDOW(win), "Ephoto!");
- ewl_window_name_set(EWL_WINDOW(win), "Ephoto!");
- ewl_object_size_request(EWL_OBJECT(win), 777, 542);
- ewl_callback_append(win, EWL_CALLBACK_DELETE_WINDOW, destroy, win);
- ewl_widget_show(win);
+ em = NULL;
+ em = calloc(1, sizeof(Ephoto_Main));
+
+ em->win = ewl_window_new();
+ ewl_window_title_set(EWL_WINDOW(em->win), "Ephoto!");
+ ewl_window_name_set(EWL_WINDOW(em->win), "Ephoto!");
+ ewl_object_size_request(EWL_OBJECT(em->win), 777, 542);
+ ewl_callback_append(em->win, EWL_CALLBACK_DELETE_WINDOW, destroy,
NULL);
+ ewl_widget_show(em->win);
vbox = ewl_vbox_new();
ewl_box_spacing_set(EWL_BOX(vbox), 5);
ewl_object_fill_policy_set(EWL_OBJECT(vbox), EWL_FLAG_FILL_ALL);
- ewl_container_child_append(EWL_CONTAINER(win), vbox);
+ ewl_container_child_append(EWL_CONTAINER(em->win), vbox);
ewl_widget_show(vbox);
- tbar = ewl_hbox_new();
- ewl_object_fill_policy_set(EWL_OBJECT(tbar), EWL_FLAG_FILL_SHRINK);
- ewl_object_alignment_set(EWL_OBJECT(tbar), EWL_FLAG_ALIGN_RIGHT);
- ewl_container_child_append(EWL_CONTAINER(vbox), tbar);
- ewl_widget_show(tbar);
+ em->tbar = ewl_hbox_new();
+ ewl_object_fill_policy_set(EWL_OBJECT(em->tbar), EWL_FLAG_FILL_SHRINK);
+ ewl_object_alignment_set(EWL_OBJECT(em->tbar), EWL_FLAG_ALIGN_RIGHT);
+ ewl_container_child_append(EWL_CONTAINER(vbox), em->tbar);
+ ewl_widget_show(em->tbar);
- vcombo = add_vcombo(tbar);
+ em->vcombo = add_vcombo(em->tbar);
spacer = ewl_spacer_new();
ewl_object_minimum_w_set(EWL_OBJECT(spacer), 100);
ewl_object_maximum_w_set(EWL_OBJECT(spacer), 100);
- ewl_container_child_append(EWL_CONTAINER(tbar), spacer);
+ ewl_container_child_append(EWL_CONTAINER(em->tbar), spacer);
ewl_widget_show(spacer);
entry = ewl_entry_new();
ewl_object_minimum_size_set(EWL_OBJECT(entry), 157, 22);
ewl_object_maximum_size_set(EWL_OBJECT(entry), 157, 22);
- ewl_container_child_append(EWL_CONTAINER(tbar), entry);
+ ewl_container_child_append(EWL_CONTAINER(em->tbar), entry);
ewl_widget_show(entry);
- add_button(tbar, "Find", NULL, NULL, NULL);
+ add_button(em->tbar, "Find", NULL, NULL, NULL);
hbox = ewl_hbox_new();
ewl_box_spacing_set(EWL_BOX(hbox), 2);
@@ -113,8 +102,8 @@
ewl_container_child_append(EWL_CONTAINER(vbox), hbox);
ewl_widget_show(hbox);
- atree = add_atree(hbox);
- ewl_object_maximum_w_set(EWL_OBJECT(atree), 172);
+ em->atree = add_atree(hbox);
+ ewl_object_maximum_w_set(EWL_OBJECT(em->atree), 172);
rvbox = ewl_vbox_new();
ewl_box_spacing_set(EWL_BOX(rvbox), 1);
@@ -122,111 +111,69 @@
ewl_container_child_append(EWL_CONTAINER(hbox), rvbox);
ewl_widget_show(rvbox);
- view_box = ewl_notebook_new();
- ewl_notebook_tabbar_visible_set(EWL_NOTEBOOK(view_box), 0);
- ewl_object_fill_policy_set(EWL_OBJECT(view_box), EWL_FLAG_FILL_ALL);
- ewl_container_child_append(EWL_CONTAINER(rvbox), view_box);
- ewl_widget_show(view_box);
-
- fbox_vbox = ewl_vbox_new();
- ewl_object_fill_policy_set(EWL_OBJECT(fbox_vbox), EWL_FLAG_FILL_ALL);
- ewl_container_child_append(EWL_CONTAINER(view_box), fbox_vbox);
- ewl_widget_show(fbox_vbox);
- ewl_notebook_page_tab_text_set(EWL_NOTEBOOK(view_box), fbox_vbox,
"Normal");
-
- sp = ewl_scrollpane_new();
- ewl_object_fill_policy_set(EWL_OBJECT(sp), EWL_FLAG_FILL_ALL);
- ewl_container_child_append(EWL_CONTAINER(fbox_vbox), sp);
- ewl_widget_show(sp);
-
- fbox = ewl_hfreebox_new();
- ewl_object_fill_policy_set(EWL_OBJECT(fbox), EWL_FLAG_FILL_ALL);
- ewl_container_child_append(EWL_CONTAINER(sp), fbox);
- ewl_widget_show(fbox);
-
- edit_vbox = ewl_vbox_new();
- ewl_object_fill_policy_set(EWL_OBJECT(edit_vbox), EWL_FLAG_FILL_ALL);
- ewl_container_child_append(EWL_CONTAINER(view_box), edit_vbox);
- ewl_widget_show(edit_vbox);
- ewl_notebook_page_tab_text_set(EWL_NOTEBOOK(view_box), edit_vbox,
"Edit");
-
- eimage = add_image(edit_vbox, NULL, 0, NULL, NULL);
- ewl_object_alignment_set(EWL_OBJECT(eimage), EWL_FLAG_ALIGN_CENTER);
- ewl_object_fill_policy_set(EWL_OBJECT(eimage), EWL_FLAG_FILL_SHRINK);
-
- list_vbox = ewl_vbox_new();
- ewl_object_fill_policy_set(EWL_OBJECT(list_vbox), EWL_FLAG_FILL_ALL);
- ewl_container_child_append(EWL_CONTAINER(view_box), list_vbox);
- ewl_widget_show(list_vbox);
- ewl_notebook_page_tab_text_set(EWL_NOTEBOOK(view_box), list_vbox,
"List");
-
- ltree = add_ltree(list_vbox);
-
- ilabel = add_label(rvbox, "Image Information", 1);
-
- /*shbox = ewl_hbox_new();
- ewl_object_alignment_set(EWL_OBJECT(shbox), EWL_FLAG_ALIGN_RIGHT);
- ewl_object_fill_policy_set(EWL_OBJECT(shbox), EWL_FLAG_FILL_SHRINK);
- ewl_container_child_append(EWL_CONTAINER(vbox), shbox);
- ewl_widget_show(shbox);
-
- seeker = ewl_hseeker_new();
- ewl_object_maximum_w_set(EWL_OBJECT(seeker), 150);
- ewl_object_alignment_set(EWL_OBJECT(seeker), EWL_FLAG_ALIGN_RIGHT);
- ewl_container_child_append(EWL_CONTAINER(shbox), seeker);
- ewl_widget_show(seeker);*/
+ em->view_box = ewl_notebook_new();
+ ewl_notebook_tabbar_visible_set(EWL_NOTEBOOK(em->view_box), 0);
+ ewl_object_fill_policy_set(EWL_OBJECT(em->view_box), EWL_FLAG_FILL_ALL);
+ ewl_container_child_append(EWL_CONTAINER(rvbox), em->view_box);
+ ewl_widget_show(em->view_box);
+
+ add_normal_view(em->view_box);
+
+ add_edit_view(em->view_box);
+
+ add_list_view(em->view_box);
hsep = ewl_hseparator_new();
ewl_container_child_append(EWL_CONTAINER(vbox), hsep);
ewl_widget_show(hsep);
- toolbar = ewl_toolbar_new();
- ewl_box_spacing_set(EWL_BOX(toolbar), 5);
- ewl_object_minimum_h_set(EWL_OBJECT(toolbar), 30);
- ewl_object_alignment_set(EWL_OBJECT(toolbar), EWL_FLAG_ALIGN_CENTER);
- ewl_object_fill_policy_set(EWL_OBJECT(toolbar), EWL_FLAG_FILL_SHRINK);
- ewl_container_child_append(EWL_CONTAINER(vbox), toolbar);
- ewl_widget_show(toolbar);
+ em->toolbar = ewl_toolbar_new();
+ ewl_box_spacing_set(EWL_BOX(em->toolbar), 5);
+ ewl_object_minimum_h_set(EWL_OBJECT(em->toolbar), 30);
+ ewl_object_alignment_set(EWL_OBJECT(em->toolbar),
EWL_FLAG_ALIGN_CENTER);
+ ewl_object_fill_policy_set(EWL_OBJECT(em->toolbar),
EWL_FLAG_FILL_SHRINK);
+ ewl_container_child_append(EWL_CONTAINER(vbox), em->toolbar);
+ ewl_widget_show(em->toolbar);
- image = add_image(toolbar, PACKAGE_DATA_DIR "/images/normal_view.png",
0, show_normal_view, NULL);
+ image = add_image(em->toolbar, PACKAGE_DATA_DIR
"/images/normal_view.png", 0, show_normal_view, NULL);
ewl_image_constrain_set(EWL_IMAGE(image), 30);
- image = add_image(toolbar, PACKAGE_DATA_DIR "/images/edit_view.png",
0, show_edit_view, NULL);
+ image = add_image(em->toolbar, PACKAGE_DATA_DIR
"/images/edit_view.png", 0, show_edit_view, NULL);
ewl_image_constrain_set(EWL_IMAGE(image), 30);
- image = add_image(toolbar, PACKAGE_DATA_DIR "/images/list_view.png",
0, show_list_view, NULL);
+ image = add_image(em->toolbar, PACKAGE_DATA_DIR
"/images/list_view.png", 0, show_list_view, NULL);
ewl_image_constrain_set(EWL_IMAGE(image), 30);
vsep = ewl_vseparator_new();
- ewl_container_child_append(EWL_CONTAINER(toolbar), vsep);
+ ewl_container_child_append(EWL_CONTAINER(em->toolbar), vsep);
ewl_widget_show(vsep);
- image = add_image(toolbar, PACKAGE_DATA_DIR "/images/get_exif.png", 0,
display_exif_dialog, NULL);
+ image = add_image(em->toolbar, PACKAGE_DATA_DIR
"/images/get_exif.png", 0, display_exif_dialog, NULL);
ewl_image_constrain_set(EWL_IMAGE(image), 30);
- image = add_image(toolbar, PACKAGE_DATA_DIR
"/images/stock_fullscreen.png", 0, window_fullscreen, win);
+ image = add_image(em->toolbar, PACKAGE_DATA_DIR
"/images/stock_fullscreen.png", 0, window_fullscreen, NULL);
ewl_image_constrain_set(EWL_IMAGE(image), 30);
- image = add_image(toolbar, PACKAGE_DATA_DIR
"/images/x-office-presentation.png", 0, NULL, NULL);
+ image = add_image(em->toolbar, PACKAGE_DATA_DIR
"/images/x-office-presentation.png", 0, NULL, NULL);
ewl_image_constrain_set(EWL_IMAGE(image), 30);
vsep = ewl_vseparator_new();
- ewl_container_child_append(EWL_CONTAINER(toolbar), vsep);
+ ewl_container_child_append(EWL_CONTAINER(em->toolbar), vsep);
ewl_widget_show(vsep);
- edit_tools = ewl_hbox_new();
- ewl_object_fill_policy_set(EWL_OBJECT(edit_tools), EWL_FLAG_FILL_HFILL);
- ewl_container_child_append(EWL_CONTAINER(toolbar), edit_tools);
- ewl_widget_show(edit_tools);
-
- add_edit_tools(edit_tools);
- ewl_widget_hide(edit_tools);
-
- albums = ecore_list_new();
- db = ephoto_db_init();
- albums = ephoto_db_list_albums(db);
+ em->edit_tools = ewl_hbox_new();
+ ewl_object_fill_policy_set(EWL_OBJECT(em->edit_tools),
EWL_FLAG_FILL_HFILL);
+ ewl_container_child_append(EWL_CONTAINER(em->toolbar), em->edit_tools);
+ ewl_widget_show(em->edit_tools);
+
+ add_edit_tools(em->edit_tools);
+ ewl_widget_hide(em->edit_tools);
+
+ em->albums = ecore_list_new();
+ em->db = ephoto_db_init();
+ em->albums = ephoto_db_list_albums(em->db);
- ewl_mvc_data_set(EWL_MVC(atree), albums);
+ ewl_mvc_data_set(EWL_MVC(em->atree), em->albums);
populate(NULL, NULL, "Complete Library");
@@ -244,47 +191,47 @@
if (w)
{
album = (char *)ewl_widget_name_get(w);
- if (currenta)
+ if (em->currenta)
{
- ewl_widget_state_set(currenta, "unselected",
EWL_STATE_PERSISTENT);
- ewl_widget_state_set(EWL_ICON(currenta)->label,
"default", EWL_STATE_PERSISTENT);
+ ewl_widget_state_set(em->currenta, "unselected",
EWL_STATE_PERSISTENT);
+ ewl_widget_state_set(EWL_ICON(em->currenta)->label,
"default", EWL_STATE_PERSISTENT);
}
- currenta = w;
- ewl_widget_state_set(currenta, "selected",
EWL_STATE_PERSISTENT);
- ewl_widget_state_set(EWL_ICON(currenta)->label, "blue",
EWL_STATE_PERSISTENT);
+ em->currenta = w;
+ ewl_widget_state_set(em->currenta, "selected",
EWL_STATE_PERSISTENT);
+ ewl_widget_state_set(EWL_ICON(em->currenta)->label, "blue",
EWL_STATE_PERSISTENT);
}
else
{
album = data;
}
- if (images)
+ if (em->images)
{
- ecore_dlist_destroy(images);
+ ecore_dlist_destroy(em->images);
}
- images = ecore_dlist_new();
- images = ephoto_db_list_images(db, album);
+ em->images = ecore_dlist_new();
+ em->images = ephoto_db_list_images(em->db, album);
- ecore_dlist_goto_first(images);
- ewl_container_reset(EWL_CONTAINER(fbox));
- while (ecore_dlist_current(images))
+ ecore_dlist_goto_first(em->images);
+ ewl_container_reset(EWL_CONTAINER(em->fbox));
+ while (ecore_dlist_current(em->images))
{
- imagef = ecore_dlist_current(images);
+ imagef = ecore_dlist_current(em->images);
- thumb = add_image(fbox, imagef, 1, set_info, NULL);
+ thumb = add_image(em->fbox, imagef, 1, set_info, NULL);
ewl_object_alignment_set(EWL_OBJECT(thumb),
EWL_FLAG_ALIGN_CENTER);
ewl_widget_name_set(thumb, imagef);
- ecore_dlist_next(images);
+ ecore_dlist_next(em->images);
}
- ecore_dlist_goto_first(images);
+ ecore_dlist_goto_first(em->images);
- ewl_mvc_data_set(EWL_MVC(ltree), images);
- ewl_mvc_dirty_set(EWL_MVC(ltree), 1);
+ ewl_mvc_data_set(EWL_MVC(em->ltree), em->images);
+ ewl_mvc_dirty_set(EWL_MVC(em->ltree), 1);
- ewl_image_file_set(EWL_IMAGE(eimage), ecore_dlist_current(images),
NULL);
+ ewl_image_file_set(EWL_IMAGE(em->eimage),
ecore_dlist_current(em->images), NULL);
return;
}
@@ -296,10 +243,10 @@
Ewl_Model *model;
Ewl_View *view;
- views = calloc(3, sizeof(char *));
- views[0] = strdup("Normal");
- views[1] = strdup("Edit");
- views[2] = strdup("List");
+ em->views = calloc(3, sizeof(char *));
+ em->views[0] = strdup("Normal");
+ em->views[1] = strdup("Edit");
+ em->views[2] = strdup("List");
model = ewl_model_new();
ewl_model_fetch_set(model, views_data_fetch);
@@ -313,7 +260,7 @@
combo = ewl_combo_new();
ewl_mvc_model_set(EWL_MVC(combo), model);
ewl_mvc_view_set(EWL_MVC(combo), view);
- ewl_mvc_data_set(EWL_MVC(combo), views);
+ ewl_mvc_data_set(EWL_MVC(combo), em->views);
ewl_object_fill_policy_set(EWL_OBJECT(combo), EWL_FLAG_FILL_SHRINK);
ewl_container_child_append(EWL_CONTAINER(c), combo);
ewl_callback_append(combo, EWL_CALLBACK_VALUE_CHANGED, combo_changed,
NULL);
@@ -337,7 +284,7 @@
/*Get the data for the view combo*/
static void *views_data_fetch(void *data, unsigned int row, unsigned int col)
{
- if (row < 3) return views[row];
+ if (row < 3) return em->views[row];
else return NULL;
}
@@ -354,15 +301,15 @@
idx = ewl_mvc_selected_get(EWL_MVC(w));
- if (!strcmp(views[idx->row], "Normal"))
+ if (!strcmp(em->views[idx->row], "Normal"))
{
show_normal_view(NULL, NULL, NULL);
}
- else if (!strcmp(views[idx->row], "Edit"))
+ else if (!strcmp(em->views[idx->row], "Edit"))
{
show_edit_view(NULL, NULL, NULL);
}
- else if (!strcmp(views[idx->row], "List"))
+ else if (!strcmp(em->views[idx->row], "List"))
{
show_list_view(NULL, NULL, NULL);
}
@@ -383,6 +330,7 @@
tree = ewl_tree2_new();
ewl_tree2_headers_visible_set(EWL_TREE2(tree), 0);
+ ewl_tree2_fixed_rows_set(EWL_TREE2(tree), 1);
ewl_mvc_model_set(EWL_MVC(tree), model);
ewl_mvc_selection_mode_set(EWL_MVC(tree), EWL_SELECTION_MODE_SINGLE);
ewl_object_fill_policy_set(EWL_OBJECT(tree), EWL_FLAG_FILL_ALL);
@@ -447,7 +395,7 @@
char *album;
void *val = NULL;
- album = ecore_list_goto_index(albums, row);
+ album = ecore_list_goto_index(em->albums, row);
if (album)
{
val = album;
@@ -461,7 +409,7 @@
{
int val;
- val = ecore_list_nodes(albums);
+ val = ecore_list_nodes(em->albums);
return val;
}
===================================================================
RCS file: /cvs/e/e17/apps/ephoto/src/bin/ephoto_normal_view.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- ephoto_normal_view.c 18 Feb 2007 01:02:43 -0000 1.2
+++ ephoto_normal_view.c 20 Feb 2007 03:45:58 -0000 1.3
@@ -1,14 +1,40 @@
#include "ephoto.h"
+/*Add the normal view*/
+Ewl_Widget *add_normal_view(Ewl_Widget *c)
+{
+ Ewl_Widget *sp;
+
+ em->fbox_vbox = ewl_vbox_new();
+ ewl_object_fill_policy_set(EWL_OBJECT(em->fbox_vbox),
EWL_FLAG_FILL_ALL);
+ ewl_container_child_append(EWL_CONTAINER(c), em->fbox_vbox);
+ ewl_widget_show(em->fbox_vbox);
+ ewl_notebook_page_tab_text_set(EWL_NOTEBOOK(c), em->fbox_vbox,
"Normal");
+
+ sp = ewl_scrollpane_new();
+ ewl_object_fill_policy_set(EWL_OBJECT(sp), EWL_FLAG_FILL_ALL);
+ ewl_container_child_append(EWL_CONTAINER(em->fbox_vbox), sp);
+ ewl_widget_show(sp);
+
+ em->fbox = ewl_hfreebox_new();
+ ewl_object_fill_policy_set(EWL_OBJECT(em->fbox), EWL_FLAG_FILL_ALL);
+ ewl_container_child_append(EWL_CONTAINER(sp), em->fbox);
+ ewl_widget_show(em->fbox);
+
+ em->ilabel = add_label(em->fbox_vbox, "Image Information", 1);
+
+ return em->fbox_vbox;
+}
+
/*Show the normal view*/
void show_normal_view(Ewl_Widget *w, void *event, void *data)
{
- ewl_notebook_visible_page_set(EWL_NOTEBOOK(view_box), fbox_vbox);
- ewl_widget_show(atree);
- ewl_widget_show(tbar);
- ewl_widget_show(ilabel);
- ewl_widget_hide(edit_tools);
- ewl_widget_configure(fbox);
+ ewl_notebook_visible_page_set(EWL_NOTEBOOK(em->view_box),
em->fbox_vbox);
+ ewl_widget_show(em->atree);
+ ewl_widget_show(em->tbar);
+ ewl_widget_show(em->ilabel);
+ ewl_widget_hide(em->edit_tools);
+ ewl_widget_configure(em->fbox);
}
/*Set the info that is in the info label on normal view*/
@@ -20,27 +46,20 @@
if (ewl_widget_type_is(w, EWL_IMAGE_TYPE))
{
- if (currentf) ewl_widget_state_set(currentf, "unselected",
EWL_STATE_PERSISTENT);
- currentf = w;
- ewl_widget_state_set(currentf, "selected",
EWL_STATE_PERSISTENT);
- }
- else
- {
- if (currenti)
- {
- ewl_widget_state_set(currenti, "unselected",
EWL_STATE_PERSISTENT);
- }
- currenti = w;
- ewl_widget_state_set(currenti, "selected",
EWL_STATE_PERSISTENT);
+ if (em->currentf) ewl_widget_state_set(em->currentf,
"unselected", EWL_STATE_PERSISTENT);
+ em->currentf = w;
+ ewl_widget_state_set(em->currentf, "selected",
EWL_STATE_PERSISTENT);
}
+
path = (char *)ewl_widget_name_get(w);
pixels = image_pixels_string_get(path);
size = file_size_get(ecore_file_size(path));
modtime = ecore_file_mod_time(path);
snprintf(info, PATH_MAX, "%s - %s - %s", basename(path), pixels, size);
- ewl_label_text_set(EWL_LABEL(ilabel), info);
- ewl_widget_reparent(ilabel);
+ ewl_label_text_set(EWL_LABEL(em->ilabel), info);
+ ewl_widget_reparent(em->ilabel);
return;
}
+
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs