parent
4a80fc0d70
commit
6502da7a5a
|
@ -12,13 +12,11 @@ group
|
||||||
{
|
{
|
||||||
state: "default" 0.0;
|
state: "default" 0.0;
|
||||||
color: 0 0 0 0;
|
color: 0 0 0 0;
|
||||||
visible: 0;
|
|
||||||
}
|
}
|
||||||
description
|
description
|
||||||
{
|
{
|
||||||
state: "selected" 0.0;
|
state: "selected" 0.0;
|
||||||
color: 71 135 195 255;
|
color: 71 135 195 255;
|
||||||
visible: 1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -57,13 +55,11 @@ group
|
||||||
{
|
{
|
||||||
state: "default" 0.0;
|
state: "default" 0.0;
|
||||||
color: 0 0 0 0;
|
color: 0 0 0 0;
|
||||||
visible: 0;
|
|
||||||
}
|
}
|
||||||
description
|
description
|
||||||
{
|
{
|
||||||
state: "highlighted" 0.0;
|
state: "highlighted" 0.0;
|
||||||
color: 71 135 195 255;
|
color: 71 135 195 255;
|
||||||
visible: 1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,8 +50,10 @@ data
|
||||||
item: "/hseparator/group" "/ephoto/hseparator";
|
item: "/hseparator/group" "/ephoto/hseparator";
|
||||||
item: "/icon/group" "/ephoto/select";
|
item: "/icon/group" "/ephoto/select";
|
||||||
item: "/image_thumbnail/group" "/ephoto/select";
|
item: "/image_thumbnail/group" "/ephoto/select";
|
||||||
|
item: "/image/group" "/ephoto/select";
|
||||||
item: "/label/group" "/ephoto/label";
|
item: "/label/group" "/ephoto/label";
|
||||||
item: "/label/textpart" "/ephoto/label/text";
|
item: "/label/textpart" "/ephoto/label/text";
|
||||||
|
item: "/notebook/pages/group" "/ephoto/window";
|
||||||
item: "/row/group" "/ephoto/row";
|
item: "/row/group" "/ephoto/row";
|
||||||
item: "/scrollpane/group" "/ephoto/scrollpane";
|
item: "/scrollpane/group" "/ephoto/scrollpane";
|
||||||
item: "/shadow/group" "/ephoto/shadow";
|
item: "/shadow/group" "/ephoto/shadow";
|
||||||
|
|
|
@ -53,14 +53,20 @@ unsigned int *rotate_right(Ewl_Widget *image);
|
||||||
void update_image(Ewl_Widget *image, int w, int h, unsigned int *data);
|
void update_image(Ewl_Widget *image, int w, int h, unsigned int *data);
|
||||||
|
|
||||||
/* Ephoto Edit View */
|
/* Ephoto Edit View */
|
||||||
|
Ewl_Widget *add_edit_view(Ewl_Widget *c);
|
||||||
void add_edit_tools(Ewl_Widget *c);
|
void add_edit_tools(Ewl_Widget *c);
|
||||||
|
|
||||||
/* Ephoto List View */
|
/* Ephoto List View */
|
||||||
|
Ewl_Widget *add_list_view(Ewl_Widget *c);
|
||||||
Ewl_Widget *add_ltree(Ewl_Widget *c);
|
Ewl_Widget *add_ltree(Ewl_Widget *c);
|
||||||
|
|
||||||
/* Ephoto Normal View */
|
/* Ephoto Normal View */
|
||||||
|
Ewl_Widget *add_normal_view(Ewl_Widget *c);
|
||||||
void set_info(Ewl_Widget *w, void *event, void *data);
|
void set_info(Ewl_Widget *w, void *event, void *data);
|
||||||
|
|
||||||
|
/* Ephoto Thumbnail */
|
||||||
|
void generate_thumbnail(Ewl_Widget *image, char *path);
|
||||||
|
|
||||||
/* Ephoto Utilities*/
|
/* Ephoto Utilities*/
|
||||||
char *image_pixels_string_get(const char *file);
|
char *image_pixels_string_get(const char *file);
|
||||||
void image_pixels_int_get(const char *file, int *width, int *height);
|
void image_pixels_int_get(const char *file, int *width, int *height);
|
||||||
|
@ -72,23 +78,34 @@ void show_edit_view(Ewl_Widget *w, void *event, void *data);
|
||||||
void show_list_view(Ewl_Widget *w, void *event, void *data);
|
void show_list_view(Ewl_Widget *w, void *event, void *data);
|
||||||
|
|
||||||
/* Ephoto Global Variables */
|
/* Ephoto Global Variables */
|
||||||
extern Ewl_Widget *atree;
|
typedef struct _Ephoto_Main Ephoto_Main;
|
||||||
extern Ewl_Widget *tbar;
|
|
||||||
extern Ewl_Widget *vcombo;
|
struct _Ephoto_Main
|
||||||
extern Ewl_Widget *view_box;
|
{
|
||||||
extern Ewl_Widget *fbox_vbox;
|
char **views;
|
||||||
extern Ewl_Widget *edit_vbox;
|
Ecore_List *albums;
|
||||||
extern Ewl_Widget *list_vbox;
|
Ecore_List *images;
|
||||||
extern Ewl_Widget *fbox;
|
Ewl_Widget *atree;
|
||||||
extern Ewl_Widget *eimage;
|
Ewl_Widget *currenta;
|
||||||
extern Ewl_Widget *ltree;
|
Ewl_Widget *currentf;
|
||||||
extern Ewl_Widget *ilabel;
|
Ewl_Widget *currenti;
|
||||||
extern Ewl_Widget *currenta;
|
Ewl_Widget *edit_tools;
|
||||||
extern Ewl_Widget *currentf;
|
Ewl_Widget *edit_vbox;
|
||||||
extern Ewl_Widget *currenti;
|
Ewl_Widget *eimage;
|
||||||
extern Ewl_Widget *toolbar;
|
Ewl_Widget *fbox_vbox;
|
||||||
extern Ewl_Widget *edit_tools;
|
Ewl_Widget *fbox;
|
||||||
extern Ecore_List *images;
|
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 */
|
/* NLS */
|
||||||
#ifdef ENABLE_NLS
|
#ifdef ENABLE_NLS
|
||||||
|
|
|
@ -8,16 +8,32 @@ static void flip_image_vertical(Ewl_Widget *w, void *event, void *data);
|
||||||
static void rotate_image_left(Ewl_Widget *w, void *event, void *data);
|
static void rotate_image_left(Ewl_Widget *w, void *event, void *data);
|
||||||
static void rotate_image_right(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*/
|
/*Show the edit view*/
|
||||||
void show_edit_view(Ewl_Widget *w, void *event, void *data)
|
void show_edit_view(Ewl_Widget *w, void *event, void *data)
|
||||||
{
|
{
|
||||||
ewl_notebook_visible_page_set(EWL_NOTEBOOK(view_box), edit_vbox);
|
ewl_notebook_visible_page_set(EWL_NOTEBOOK(em->view_box), em->edit_vbox);
|
||||||
ecore_dlist_goto_first(images);
|
ecore_dlist_goto_first(em->images);
|
||||||
ewl_widget_show(edit_tools);
|
ewl_widget_show(em->edit_tools);
|
||||||
ewl_widget_hide(atree);
|
ewl_widget_hide(em->atree);
|
||||||
ewl_widget_hide(tbar);
|
ewl_widget_hide(em->tbar);
|
||||||
ewl_widget_hide(ilabel);
|
ewl_widget_hide(em->ilabel);
|
||||||
ewl_widget_reparent(eimage);
|
ewl_widget_reparent(em->eimage);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*Add edit tools to container c*/
|
/*Add edit tools to container c*/
|
||||||
|
@ -57,15 +73,15 @@ static void previous_image(Ewl_Widget *w, void *event, void *data)
|
||||||
{
|
{
|
||||||
char *image;
|
char *image;
|
||||||
|
|
||||||
ecore_dlist_previous(images);
|
ecore_dlist_previous(em->images);
|
||||||
image = ecore_dlist_current(images);
|
image = ecore_dlist_current(em->images);
|
||||||
if(!image)
|
if(!image)
|
||||||
{
|
{
|
||||||
ecore_dlist_goto_last(images);
|
ecore_dlist_goto_last(em->images);
|
||||||
image = ecore_dlist_current(images);
|
image = ecore_dlist_current(em->images);
|
||||||
}
|
}
|
||||||
ewl_image_file_path_set(EWL_IMAGE(eimage), image);
|
ewl_image_file_path_set(EWL_IMAGE(em->eimage), image);
|
||||||
ewl_widget_configure(eimage->parent);
|
ewl_widget_configure(em->eimage->parent);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -76,15 +92,15 @@ static void next_image(Ewl_Widget *w, void *event, void *data)
|
||||||
{
|
{
|
||||||
char *image;
|
char *image;
|
||||||
|
|
||||||
ecore_dlist_next(images);
|
ecore_dlist_next(em->images);
|
||||||
image = ecore_dlist_current(images);
|
image = ecore_dlist_current(em->images);
|
||||||
if(!image)
|
if(!image)
|
||||||
{
|
{
|
||||||
ecore_dlist_goto_first(images);
|
ecore_dlist_goto_first(em->images);
|
||||||
image = ecore_dlist_current(images);
|
image = ecore_dlist_current(em->images);
|
||||||
}
|
}
|
||||||
ewl_image_file_path_set(EWL_IMAGE(eimage), image);
|
ewl_image_file_path_set(EWL_IMAGE(em->eimage), image);
|
||||||
ewl_widget_configure(eimage->parent);
|
ewl_widget_configure(em->eimage->parent);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -96,12 +112,18 @@ static void flip_image_horizontal(Ewl_Widget *w, void *event, void *data)
|
||||||
{
|
{
|
||||||
unsigned int *image_data;
|
unsigned int *image_data;
|
||||||
int nw, nh;
|
int nw, nh;
|
||||||
|
Ewl_Image *image;
|
||||||
|
|
||||||
evas_object_image_size_get(EWL_IMAGE(eimage)->image, &nw, &nh);
|
evas_object_image_size_get(EWL_IMAGE(em->eimage)->image, &nw, &nh);
|
||||||
image_data = flip_horizontal(eimage);
|
image_data = flip_horizontal(em->eimage);
|
||||||
update_image(eimage, nw, nh, image_data);
|
update_image(em->eimage, nw, nh, image_data);
|
||||||
ewl_widget_configure(eimage);
|
ewl_image_size_set(EWL_IMAGE(em->eimage), nh, nw);
|
||||||
ewl_widget_configure(eimage->parent);
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -111,12 +133,18 @@ static void flip_image_vertical(Ewl_Widget *w, void *event, void *data)
|
||||||
{
|
{
|
||||||
unsigned int *image_data;
|
unsigned int *image_data;
|
||||||
int nw, nh;
|
int nw, nh;
|
||||||
|
Ewl_Image *image;
|
||||||
|
|
||||||
evas_object_image_size_get(EWL_IMAGE(eimage)->image, &nw, &nh);
|
evas_object_image_size_get(EWL_IMAGE(em->eimage)->image, &nw, &nh);
|
||||||
image_data = flip_vertical(eimage);
|
image_data = flip_vertical(em->eimage);
|
||||||
update_image(eimage, nw, nh, image_data);
|
update_image(em->eimage, nw, nh, image_data);
|
||||||
ewl_widget_configure(eimage);
|
ewl_image_size_set(EWL_IMAGE(em->eimage), nh, nw);
|
||||||
ewl_widget_configure(eimage->parent);
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -126,12 +154,18 @@ static void rotate_image_left(Ewl_Widget *w, void *event, void *data)
|
||||||
{
|
{
|
||||||
unsigned int *image_data;
|
unsigned int *image_data;
|
||||||
int nw, nh;
|
int nw, nh;
|
||||||
|
Ewl_Image *image;
|
||||||
|
|
||||||
evas_object_image_size_get(EWL_IMAGE(eimage)->image, &nh, &nw);
|
evas_object_image_size_get(EWL_IMAGE(em->eimage)->image, &nh, &nw);
|
||||||
image_data = rotate_left(eimage);
|
image_data = rotate_left(em->eimage);
|
||||||
update_image(eimage, nw, nh, image_data);
|
update_image(em->eimage, nw, nh, image_data);
|
||||||
ewl_widget_configure(eimage);
|
ewl_image_size_set(EWL_IMAGE(em->eimage), nh, nw);
|
||||||
ewl_widget_configure(eimage->parent);
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -141,12 +175,17 @@ static void rotate_image_right(Ewl_Widget *w, void *event, void *data)
|
||||||
{
|
{
|
||||||
unsigned int *image_data;
|
unsigned int *image_data;
|
||||||
int nw, nh;
|
int nw, nh;
|
||||||
|
Ewl_Image *image;
|
||||||
|
|
||||||
evas_object_image_size_get(EWL_IMAGE(eimage)->image, &nh, &nw);
|
evas_object_image_size_get(EWL_IMAGE(em->eimage)->image, &nh, &nw);
|
||||||
image_data = rotate_right(eimage);
|
image_data = rotate_right(em->eimage);
|
||||||
update_image(eimage, nw, nh, image_data);
|
update_image(em->eimage, nw, nh, image_data);
|
||||||
ewl_widget_configure(eimage);
|
image = (Ewl_Image *)em->eimage;
|
||||||
ewl_widget_configure(eimage->parent);
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,17 +58,17 @@ static char *get_image(void)
|
||||||
{
|
{
|
||||||
const char *img;
|
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);
|
return strdup(img);
|
||||||
|
|
|
@ -30,7 +30,8 @@ Ewl_Widget *add_button(Ewl_Widget *c, char *txt, char *img, void *cb, void *data
|
||||||
Ewl_Widget *add_image(Ewl_Widget *c, char *img, int thumbnail, void *cb, void *data)
|
Ewl_Widget *add_image(Ewl_Widget *c, char *img, int thumbnail, void *cb, void *data)
|
||||||
{
|
{
|
||||||
Ewl_Widget *image;
|
Ewl_Widget *image;
|
||||||
int w, h;
|
char *thumb;
|
||||||
|
int w, h, pid;
|
||||||
|
|
||||||
if(!thumbnail)
|
if(!thumbnail)
|
||||||
{
|
{
|
||||||
|
@ -39,28 +40,29 @@ Ewl_Widget *add_image(Ewl_Widget *c, char *img, int thumbnail, void *cb, void *d
|
||||||
{
|
{
|
||||||
ewl_image_file_path_set(EWL_IMAGE(image), img);
|
ewl_image_file_path_set(EWL_IMAGE(image), img);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
image_pixels_int_get(img, &w, &h);
|
image_pixels_int_get(img, &w, &h);
|
||||||
|
if(w > 75 || h > 75)
|
||||||
image = ewl_image_thumbnail_new();
|
|
||||||
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);
|
ewl_image_thumbnail_request(EWL_IMAGE_THUMBNAIL(image), img);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(image)
|
image = ewl_image_new();
|
||||||
|
if (img)
|
||||||
{
|
{
|
||||||
ewl_image_file_path_set(EWL_IMAGE(image), 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_image_proportional_set(EWL_IMAGE(image), TRUE);
|
||||||
ewl_object_alignment_set(EWL_OBJECT(image), EWL_FLAG_ALIGN_LEFT);
|
ewl_object_alignment_set(EWL_OBJECT(image), EWL_FLAG_ALIGN_LEFT);
|
||||||
|
|
|
@ -6,15 +6,29 @@ static Ewl_Widget *list_header_fetch(void *data, int column);
|
||||||
static void *list_data_fetch(void *data, unsigned int row, unsigned int column);
|
static void *list_data_fetch(void *data, unsigned int row, unsigned int column);
|
||||||
static int list_data_count(void *data);
|
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*/
|
/*Show the list view*/
|
||||||
void show_list_view(Ewl_Widget *w, void *event, void *data)
|
void show_list_view(Ewl_Widget *w, void *event, void *data)
|
||||||
{
|
{
|
||||||
ewl_notebook_visible_page_set(EWL_NOTEBOOK(view_box), list_vbox);
|
ewl_notebook_visible_page_set(EWL_NOTEBOOK(em->view_box), em->list_vbox);
|
||||||
ewl_mvc_dirty_set(EWL_MVC(ltree), 1);
|
ewl_mvc_dirty_set(EWL_MVC(em->ltree), 1);
|
||||||
ewl_widget_hide(edit_tools);
|
ewl_widget_hide(em->edit_tools);
|
||||||
ewl_widget_hide(ilabel);
|
ewl_widget_hide(em->ilabel);
|
||||||
ewl_widget_show(atree);
|
ewl_widget_show(em->atree);
|
||||||
ewl_widget_show(tbar);
|
ewl_widget_show(em->tbar);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*Create and Add a Tree to the Container c*/
|
/*Create and Add a Tree to the Container c*/
|
||||||
|
@ -30,6 +44,7 @@ Ewl_Widget *add_ltree(Ewl_Widget *c)
|
||||||
|
|
||||||
tree = ewl_tree2_new();
|
tree = ewl_tree2_new();
|
||||||
ewl_tree2_headers_visible_set(EWL_TREE2(tree), 0);
|
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_model_set(EWL_MVC(tree), model);
|
||||||
ewl_object_fill_policy_set(EWL_OBJECT(tree), EWL_FLAG_FILL_ALL);
|
ewl_object_fill_policy_set(EWL_OBJECT(tree), EWL_FLAG_FILL_ALL);
|
||||||
ewl_container_child_append(EWL_CONTAINER(c), tree);
|
ewl_container_child_append(EWL_CONTAINER(c), tree);
|
||||||
|
@ -48,17 +63,14 @@ Ewl_Widget *add_ltree(Ewl_Widget *c)
|
||||||
/* The view of the images */
|
/* The view of the images */
|
||||||
static Ewl_Widget *list_view_new(void)
|
static Ewl_Widget *list_view_new(void)
|
||||||
{
|
{
|
||||||
Ewl_Widget *icon;
|
Ewl_Widget *hbox;
|
||||||
|
|
||||||
icon = ewl_icon_new();
|
hbox = ewl_hbox_new();
|
||||||
ewl_icon_type_set(EWL_ICON(icon), EWL_ICON_TYPE_LONG);
|
ewl_box_spacing_set(EWL_BOX(hbox), 10);
|
||||||
ewl_box_orientation_set(EWL_BOX(icon), EWL_ORIENTATION_HORIZONTAL);
|
ewl_object_fill_policy_set(EWL_OBJECT(hbox), EWL_FLAG_FILL_HFILL);
|
||||||
ewl_object_alignment_set(EWL_OBJECT(icon), EWL_FLAG_ALIGN_LEFT);
|
ewl_widget_show(hbox);
|
||||||
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);
|
|
||||||
|
|
||||||
return icon;
|
return hbox;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*The row that is added to the tree*/
|
/*The row that is added to the tree*/
|
||||||
|
@ -68,36 +80,28 @@ static void list_view_assign(Ewl_Widget *w, void *data)
|
||||||
char info[PATH_MAX];
|
char info[PATH_MAX];
|
||||||
int size;
|
int size;
|
||||||
int width, height;
|
int width, height;
|
||||||
Ewl_Widget *text;
|
Ewl_Widget *img, *text;
|
||||||
|
|
||||||
image = data;
|
image = data;
|
||||||
image_pixels_int_get(image, &width, &height);
|
image_pixels_int_get(image, &width, &height);
|
||||||
if(width > 75 || height > 75)
|
|
||||||
{
|
img = add_image(w, image, 1, NULL, NULL);
|
||||||
ewl_icon_thumbnailing_set(EWL_ICON(w), 1);
|
ewl_image_constrain_set(EWL_IMAGE(img), 48);
|
||||||
}
|
|
||||||
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);
|
|
||||||
ewl_widget_name_set(w, image);
|
ewl_widget_name_set(w, image);
|
||||||
|
|
||||||
size = ecore_file_size(image);
|
size = ecore_file_size(image);
|
||||||
|
|
||||||
snprintf(info, PATH_MAX, "Name: %s\n"
|
snprintf(info, PATH_MAX, "Name: %s\nPixels: %s\nSize: %s\n",
|
||||||
"Pixels: %s\n"
|
|
||||||
"Size: %s\n",
|
|
||||||
basename(image),
|
basename(image),
|
||||||
image_pixels_string_get(image),
|
image_pixels_string_get(image),
|
||||||
file_size_get(size));
|
file_size_get(size));
|
||||||
|
|
||||||
text = ewl_text_new();
|
text = ewl_text_new();
|
||||||
ewl_text_text_set(EWL_TEXT(text), info);
|
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_widget_show(text);
|
||||||
ewl_icon_extended_data_set(EWL_ICON(w), text);
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -120,7 +124,7 @@ static void *list_data_fetch(void *data, unsigned int row, unsigned int column)
|
||||||
char *image;
|
char *image;
|
||||||
void *val = NULL;
|
void *val = NULL;
|
||||||
|
|
||||||
image = ecore_list_goto_index(images, row);
|
image = ecore_list_goto_index(em->images, row);
|
||||||
if (image)
|
if (image)
|
||||||
{
|
{
|
||||||
val = image;
|
val = image;
|
||||||
|
@ -134,7 +138,7 @@ static int list_data_count(void *data)
|
||||||
{
|
{
|
||||||
int val;
|
int val;
|
||||||
|
|
||||||
val = ecore_list_nodes(images);
|
val = ecore_list_nodes(em->images);
|
||||||
|
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,14 +1,5 @@
|
||||||
#include "ephoto.h"
|
#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*/
|
/*Ewl Callbacks*/
|
||||||
static void combo_changed(Ewl_Widget *w, void *event, void *data);
|
static void combo_changed(Ewl_Widget *w, void *event, void *data);
|
||||||
static void destroy(Ewl_Widget *w, void *event, void *data);
|
static void destroy(Ewl_Widget *w, void *event, void *data);
|
||||||
|
@ -30,37 +21,33 @@ static void *views_data_fetch(void *data, unsigned int row, unsigned int column)
|
||||||
static int views_data_count(void *data);
|
static int views_data_count(void *data);
|
||||||
|
|
||||||
/*Ephoto Global Variables*/
|
/*Ephoto Global Variables*/
|
||||||
Ewl_Widget *atree, *tbar, *vcombo, *view_box, *fbox_vbox, *edit_vbox, *list_vbox, *fbox;
|
Ephoto_Main *em;
|
||||||
Ewl_Widget *eimage, *ltree, *ilabel, *currenta, *currentf, *currenti, *toolbar, *edit_tools;
|
|
||||||
Ecore_List *images;
|
|
||||||
|
|
||||||
|
|
||||||
/*Destroy the Main Window*/
|
/*Destroy the Main Window*/
|
||||||
static void destroy(Ewl_Widget *w, void *event, void *data)
|
static void destroy(Ewl_Widget *w, void *event, void *data)
|
||||||
{
|
{
|
||||||
Ewl_Widget *window;
|
ephoto_db_close(em->db);
|
||||||
|
ewl_widget_destroy(em->win);
|
||||||
window = data;
|
ecore_list_destroy(em->albums);
|
||||||
ephoto_db_close(db);
|
ecore_list_destroy(em->images);
|
||||||
ewl_widget_destroy(window);
|
free(em->views);
|
||||||
ewl_main_quit();
|
free(em);
|
||||||
|
ewl_main_quit();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void window_fullscreen(Ewl_Widget *w, void *event, void *data)
|
static void window_fullscreen(Ewl_Widget *w, void *event, void *data)
|
||||||
{
|
{
|
||||||
int fullscreen;
|
int fullscreen;
|
||||||
Ewl_Widget *window;
|
|
||||||
|
fullscreen = ewl_window_fullscreen_get(EWL_WINDOW(em->win));
|
||||||
window = data;
|
|
||||||
fullscreen = ewl_window_fullscreen_get(EWL_WINDOW(window));
|
|
||||||
if(!fullscreen)
|
if(!fullscreen)
|
||||||
{
|
{
|
||||||
ewl_window_fullscreen_set(EWL_WINDOW(window), 1);
|
ewl_window_fullscreen_set(EWL_WINDOW(em->win), 1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ewl_window_fullscreen_set(EWL_WINDOW(window), 0);
|
ewl_window_fullscreen_set(EWL_WINDOW(em->win), 0);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -68,44 +55,46 @@ static void window_fullscreen(Ewl_Widget *w, void *event, void *data)
|
||||||
/*Create the Main Ephoto Window*/
|
/*Create the Main Ephoto Window*/
|
||||||
void create_main_gui(void)
|
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 *rvbox, *sp, *hsep, *vsep, *image;
|
||||||
Ewl_Widget *shbox, *seeker;
|
|
||||||
|
|
||||||
win = ewl_window_new();
|
em = NULL;
|
||||||
ewl_window_title_set(EWL_WINDOW(win), "Ephoto!");
|
em = calloc(1, sizeof(Ephoto_Main));
|
||||||
ewl_window_name_set(EWL_WINDOW(win), "Ephoto!");
|
|
||||||
ewl_object_size_request(EWL_OBJECT(win), 777, 542);
|
em->win = ewl_window_new();
|
||||||
ewl_callback_append(win, EWL_CALLBACK_DELETE_WINDOW, destroy, win);
|
ewl_window_title_set(EWL_WINDOW(em->win), "Ephoto!");
|
||||||
ewl_widget_show(win);
|
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();
|
vbox = ewl_vbox_new();
|
||||||
ewl_box_spacing_set(EWL_BOX(vbox), 5);
|
ewl_box_spacing_set(EWL_BOX(vbox), 5);
|
||||||
ewl_object_fill_policy_set(EWL_OBJECT(vbox), EWL_FLAG_FILL_ALL);
|
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);
|
ewl_widget_show(vbox);
|
||||||
|
|
||||||
tbar = ewl_hbox_new();
|
em->tbar = ewl_hbox_new();
|
||||||
ewl_object_fill_policy_set(EWL_OBJECT(tbar), EWL_FLAG_FILL_SHRINK);
|
ewl_object_fill_policy_set(EWL_OBJECT(em->tbar), EWL_FLAG_FILL_SHRINK);
|
||||||
ewl_object_alignment_set(EWL_OBJECT(tbar), EWL_FLAG_ALIGN_RIGHT);
|
ewl_object_alignment_set(EWL_OBJECT(em->tbar), EWL_FLAG_ALIGN_RIGHT);
|
||||||
ewl_container_child_append(EWL_CONTAINER(vbox), tbar);
|
ewl_container_child_append(EWL_CONTAINER(vbox), em->tbar);
|
||||||
ewl_widget_show(tbar);
|
ewl_widget_show(em->tbar);
|
||||||
|
|
||||||
vcombo = add_vcombo(tbar);
|
em->vcombo = add_vcombo(em->tbar);
|
||||||
|
|
||||||
spacer = ewl_spacer_new();
|
spacer = ewl_spacer_new();
|
||||||
ewl_object_minimum_w_set(EWL_OBJECT(spacer), 100);
|
ewl_object_minimum_w_set(EWL_OBJECT(spacer), 100);
|
||||||
ewl_object_maximum_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);
|
ewl_widget_show(spacer);
|
||||||
|
|
||||||
entry = ewl_entry_new();
|
entry = ewl_entry_new();
|
||||||
ewl_object_minimum_size_set(EWL_OBJECT(entry), 157, 22);
|
ewl_object_minimum_size_set(EWL_OBJECT(entry), 157, 22);
|
||||||
ewl_object_maximum_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);
|
ewl_widget_show(entry);
|
||||||
|
|
||||||
add_button(tbar, "Find", NULL, NULL, NULL);
|
add_button(em->tbar, "Find", NULL, NULL, NULL);
|
||||||
|
|
||||||
hbox = ewl_hbox_new();
|
hbox = ewl_hbox_new();
|
||||||
ewl_box_spacing_set(EWL_BOX(hbox), 2);
|
ewl_box_spacing_set(EWL_BOX(hbox), 2);
|
||||||
|
@ -113,8 +102,8 @@ void create_main_gui(void)
|
||||||
ewl_container_child_append(EWL_CONTAINER(vbox), hbox);
|
ewl_container_child_append(EWL_CONTAINER(vbox), hbox);
|
||||||
ewl_widget_show(hbox);
|
ewl_widget_show(hbox);
|
||||||
|
|
||||||
atree = add_atree(hbox);
|
em->atree = add_atree(hbox);
|
||||||
ewl_object_maximum_w_set(EWL_OBJECT(atree), 172);
|
ewl_object_maximum_w_set(EWL_OBJECT(em->atree), 172);
|
||||||
|
|
||||||
rvbox = ewl_vbox_new();
|
rvbox = ewl_vbox_new();
|
||||||
ewl_box_spacing_set(EWL_BOX(rvbox), 1);
|
ewl_box_spacing_set(EWL_BOX(rvbox), 1);
|
||||||
|
@ -122,111 +111,69 @@ void create_main_gui(void)
|
||||||
ewl_container_child_append(EWL_CONTAINER(hbox), rvbox);
|
ewl_container_child_append(EWL_CONTAINER(hbox), rvbox);
|
||||||
ewl_widget_show(rvbox);
|
ewl_widget_show(rvbox);
|
||||||
|
|
||||||
view_box = ewl_notebook_new();
|
em->view_box = ewl_notebook_new();
|
||||||
ewl_notebook_tabbar_visible_set(EWL_NOTEBOOK(view_box), 0);
|
ewl_notebook_tabbar_visible_set(EWL_NOTEBOOK(em->view_box), 0);
|
||||||
ewl_object_fill_policy_set(EWL_OBJECT(view_box), EWL_FLAG_FILL_ALL);
|
ewl_object_fill_policy_set(EWL_OBJECT(em->view_box), EWL_FLAG_FILL_ALL);
|
||||||
ewl_container_child_append(EWL_CONTAINER(rvbox), view_box);
|
ewl_container_child_append(EWL_CONTAINER(rvbox), em->view_box);
|
||||||
ewl_widget_show(view_box);
|
ewl_widget_show(em->view_box);
|
||||||
|
|
||||||
fbox_vbox = ewl_vbox_new();
|
add_normal_view(em->view_box);
|
||||||
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();
|
add_edit_view(em->view_box);
|
||||||
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();
|
add_list_view(em->view_box);
|
||||||
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);*/
|
|
||||||
|
|
||||||
hsep = ewl_hseparator_new();
|
hsep = ewl_hseparator_new();
|
||||||
ewl_container_child_append(EWL_CONTAINER(vbox), hsep);
|
ewl_container_child_append(EWL_CONTAINER(vbox), hsep);
|
||||||
ewl_widget_show(hsep);
|
ewl_widget_show(hsep);
|
||||||
|
|
||||||
toolbar = ewl_toolbar_new();
|
em->toolbar = ewl_toolbar_new();
|
||||||
ewl_box_spacing_set(EWL_BOX(toolbar), 5);
|
ewl_box_spacing_set(EWL_BOX(em->toolbar), 5);
|
||||||
ewl_object_minimum_h_set(EWL_OBJECT(toolbar), 30);
|
ewl_object_minimum_h_set(EWL_OBJECT(em->toolbar), 30);
|
||||||
ewl_object_alignment_set(EWL_OBJECT(toolbar), EWL_FLAG_ALIGN_CENTER);
|
ewl_object_alignment_set(EWL_OBJECT(em->toolbar), EWL_FLAG_ALIGN_CENTER);
|
||||||
ewl_object_fill_policy_set(EWL_OBJECT(toolbar), EWL_FLAG_FILL_SHRINK);
|
ewl_object_fill_policy_set(EWL_OBJECT(em->toolbar), EWL_FLAG_FILL_SHRINK);
|
||||||
ewl_container_child_append(EWL_CONTAINER(vbox), toolbar);
|
ewl_container_child_append(EWL_CONTAINER(vbox), em->toolbar);
|
||||||
ewl_widget_show(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);
|
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);
|
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);
|
ewl_image_constrain_set(EWL_IMAGE(image), 30);
|
||||||
|
|
||||||
vsep = ewl_vseparator_new();
|
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);
|
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);
|
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);
|
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);
|
ewl_image_constrain_set(EWL_IMAGE(image), 30);
|
||||||
|
|
||||||
vsep = ewl_vseparator_new();
|
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);
|
ewl_widget_show(vsep);
|
||||||
|
|
||||||
edit_tools = ewl_hbox_new();
|
em->edit_tools = ewl_hbox_new();
|
||||||
ewl_object_fill_policy_set(EWL_OBJECT(edit_tools), EWL_FLAG_FILL_HFILL);
|
ewl_object_fill_policy_set(EWL_OBJECT(em->edit_tools), EWL_FLAG_FILL_HFILL);
|
||||||
ewl_container_child_append(EWL_CONTAINER(toolbar), edit_tools);
|
ewl_container_child_append(EWL_CONTAINER(em->toolbar), em->edit_tools);
|
||||||
ewl_widget_show(edit_tools);
|
ewl_widget_show(em->edit_tools);
|
||||||
|
|
||||||
add_edit_tools(edit_tools);
|
add_edit_tools(em->edit_tools);
|
||||||
ewl_widget_hide(edit_tools);
|
ewl_widget_hide(em->edit_tools);
|
||||||
|
|
||||||
albums = ecore_list_new();
|
em->albums = ecore_list_new();
|
||||||
db = ephoto_db_init();
|
em->db = ephoto_db_init();
|
||||||
albums = ephoto_db_list_albums(db);
|
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");
|
populate(NULL, NULL, "Complete Library");
|
||||||
|
|
||||||
|
@ -244,47 +191,47 @@ static void populate(Ewl_Widget *w, void *event, void *data)
|
||||||
if (w)
|
if (w)
|
||||||
{
|
{
|
||||||
album = (char *)ewl_widget_name_get(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(em->currenta, "unselected", EWL_STATE_PERSISTENT);
|
||||||
ewl_widget_state_set(EWL_ICON(currenta)->label, "default", EWL_STATE_PERSISTENT);
|
ewl_widget_state_set(EWL_ICON(em->currenta)->label, "default", EWL_STATE_PERSISTENT);
|
||||||
}
|
}
|
||||||
currenta = w;
|
em->currenta = w;
|
||||||
ewl_widget_state_set(currenta, "selected", EWL_STATE_PERSISTENT);
|
ewl_widget_state_set(em->currenta, "selected", EWL_STATE_PERSISTENT);
|
||||||
ewl_widget_state_set(EWL_ICON(currenta)->label, "blue", EWL_STATE_PERSISTENT);
|
ewl_widget_state_set(EWL_ICON(em->currenta)->label, "blue", EWL_STATE_PERSISTENT);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
album = data;
|
album = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (images)
|
if (em->images)
|
||||||
{
|
{
|
||||||
ecore_dlist_destroy(images);
|
ecore_dlist_destroy(em->images);
|
||||||
}
|
}
|
||||||
|
|
||||||
images = ecore_dlist_new();
|
em->images = ecore_dlist_new();
|
||||||
images = ephoto_db_list_images(db, album);
|
em->images = ephoto_db_list_images(em->db, album);
|
||||||
|
|
||||||
ecore_dlist_goto_first(images);
|
ecore_dlist_goto_first(em->images);
|
||||||
ewl_container_reset(EWL_CONTAINER(fbox));
|
ewl_container_reset(EWL_CONTAINER(em->fbox));
|
||||||
while (ecore_dlist_current(images))
|
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_object_alignment_set(EWL_OBJECT(thumb), EWL_FLAG_ALIGN_CENTER);
|
||||||
ewl_widget_name_set(thumb, imagef);
|
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_data_set(EWL_MVC(em->ltree), em->images);
|
||||||
ewl_mvc_dirty_set(EWL_MVC(ltree), 1);
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -296,10 +243,10 @@ static Ewl_Widget *add_vcombo(Ewl_Widget *c)
|
||||||
Ewl_Model *model;
|
Ewl_Model *model;
|
||||||
Ewl_View *view;
|
Ewl_View *view;
|
||||||
|
|
||||||
views = calloc(3, sizeof(char *));
|
em->views = calloc(3, sizeof(char *));
|
||||||
views[0] = strdup("Normal");
|
em->views[0] = strdup("Normal");
|
||||||
views[1] = strdup("Edit");
|
em->views[1] = strdup("Edit");
|
||||||
views[2] = strdup("List");
|
em->views[2] = strdup("List");
|
||||||
|
|
||||||
model = ewl_model_new();
|
model = ewl_model_new();
|
||||||
ewl_model_fetch_set(model, views_data_fetch);
|
ewl_model_fetch_set(model, views_data_fetch);
|
||||||
|
@ -313,7 +260,7 @@ static Ewl_Widget *add_vcombo(Ewl_Widget *c)
|
||||||
combo = ewl_combo_new();
|
combo = ewl_combo_new();
|
||||||
ewl_mvc_model_set(EWL_MVC(combo), model);
|
ewl_mvc_model_set(EWL_MVC(combo), model);
|
||||||
ewl_mvc_view_set(EWL_MVC(combo), view);
|
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_object_fill_policy_set(EWL_OBJECT(combo), EWL_FLAG_FILL_SHRINK);
|
||||||
ewl_container_child_append(EWL_CONTAINER(c), combo);
|
ewl_container_child_append(EWL_CONTAINER(c), combo);
|
||||||
ewl_callback_append(combo, EWL_CALLBACK_VALUE_CHANGED, combo_changed, NULL);
|
ewl_callback_append(combo, EWL_CALLBACK_VALUE_CHANGED, combo_changed, NULL);
|
||||||
|
@ -337,7 +284,7 @@ static Ewl_Widget *views_header_fetch(void *data, int col)
|
||||||
/*Get the data for the view combo*/
|
/*Get the data for the view combo*/
|
||||||
static void *views_data_fetch(void *data, unsigned int row, unsigned int col)
|
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;
|
else return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -354,15 +301,15 @@ static void combo_changed(Ewl_Widget *w, void *event, void *data)
|
||||||
|
|
||||||
idx = ewl_mvc_selected_get(EWL_MVC(w));
|
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);
|
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);
|
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);
|
show_list_view(NULL, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
@ -383,6 +330,7 @@ static Ewl_Widget *add_atree(Ewl_Widget *c)
|
||||||
|
|
||||||
tree = ewl_tree2_new();
|
tree = ewl_tree2_new();
|
||||||
ewl_tree2_headers_visible_set(EWL_TREE2(tree), 0);
|
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_model_set(EWL_MVC(tree), model);
|
||||||
ewl_mvc_selection_mode_set(EWL_MVC(tree), EWL_SELECTION_MODE_SINGLE);
|
ewl_mvc_selection_mode_set(EWL_MVC(tree), EWL_SELECTION_MODE_SINGLE);
|
||||||
ewl_object_fill_policy_set(EWL_OBJECT(tree), EWL_FLAG_FILL_ALL);
|
ewl_object_fill_policy_set(EWL_OBJECT(tree), EWL_FLAG_FILL_ALL);
|
||||||
|
@ -447,7 +395,7 @@ static void *album_data_fetch(void *data, unsigned int row, unsigned int column)
|
||||||
char *album;
|
char *album;
|
||||||
void *val = NULL;
|
void *val = NULL;
|
||||||
|
|
||||||
album = ecore_list_goto_index(albums, row);
|
album = ecore_list_goto_index(em->albums, row);
|
||||||
if (album)
|
if (album)
|
||||||
{
|
{
|
||||||
val = album;
|
val = album;
|
||||||
|
@ -461,7 +409,7 @@ static int album_data_count(void *data)
|
||||||
{
|
{
|
||||||
int val;
|
int val;
|
||||||
|
|
||||||
val = ecore_list_nodes(albums);
|
val = ecore_list_nodes(em->albums);
|
||||||
|
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,14 +1,40 @@
|
||||||
#include "ephoto.h"
|
#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*/
|
/*Show the normal view*/
|
||||||
void show_normal_view(Ewl_Widget *w, void *event, void *data)
|
void show_normal_view(Ewl_Widget *w, void *event, void *data)
|
||||||
{
|
{
|
||||||
ewl_notebook_visible_page_set(EWL_NOTEBOOK(view_box), fbox_vbox);
|
ewl_notebook_visible_page_set(EWL_NOTEBOOK(em->view_box), em->fbox_vbox);
|
||||||
ewl_widget_show(atree);
|
ewl_widget_show(em->atree);
|
||||||
ewl_widget_show(tbar);
|
ewl_widget_show(em->tbar);
|
||||||
ewl_widget_show(ilabel);
|
ewl_widget_show(em->ilabel);
|
||||||
ewl_widget_hide(edit_tools);
|
ewl_widget_hide(em->edit_tools);
|
||||||
ewl_widget_configure(fbox);
|
ewl_widget_configure(em->fbox);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*Set the info that is in the info label on normal view*/
|
/*Set the info that is in the info label on normal view*/
|
||||||
|
@ -20,27 +46,20 @@ void set_info(Ewl_Widget *w, void *event, void *data)
|
||||||
|
|
||||||
if (ewl_widget_type_is(w, EWL_IMAGE_TYPE))
|
if (ewl_widget_type_is(w, EWL_IMAGE_TYPE))
|
||||||
{
|
{
|
||||||
if (currentf) ewl_widget_state_set(currentf, "unselected", EWL_STATE_PERSISTENT);
|
if (em->currentf) ewl_widget_state_set(em->currentf, "unselected", EWL_STATE_PERSISTENT);
|
||||||
currentf = w;
|
em->currentf = w;
|
||||||
ewl_widget_state_set(currentf, "selected", EWL_STATE_PERSISTENT);
|
ewl_widget_state_set(em->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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
path = (char *)ewl_widget_name_get(w);
|
path = (char *)ewl_widget_name_get(w);
|
||||||
pixels = image_pixels_string_get(path);
|
pixels = image_pixels_string_get(path);
|
||||||
size = file_size_get(ecore_file_size(path));
|
size = file_size_get(ecore_file_size(path));
|
||||||
modtime = ecore_file_mod_time(path);
|
modtime = ecore_file_mod_time(path);
|
||||||
snprintf(info, PATH_MAX, "%s - %s - %s", basename(path), pixels, size);
|
snprintf(info, PATH_MAX, "%s - %s - %s", basename(path), pixels, size);
|
||||||
|
|
||||||
ewl_label_text_set(EWL_LABEL(ilabel), info);
|
ewl_label_text_set(EWL_LABEL(em->ilabel), info);
|
||||||
ewl_widget_reparent(ilabel);
|
ewl_widget_reparent(em->ilabel);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue