Add a new file that separates out dialogs. This is cleaner. Cleanup some code.

Ephoto will now open with its file system in the current working directory!


SVN revision: 30170
This commit is contained in:
titan 2007-05-31 06:02:36 +00:00 committed by titan
parent d67a9d28ca
commit dc54fae6a0
9 changed files with 266 additions and 345 deletions

View File

@ -8,6 +8,7 @@ bin_PROGRAMS = ephoto
ephoto_SOURCES = ephoto.c \
ephoto_browsing.c \
ephoto_database.c \
ephoto_dialogs.c \
ephoto_edit_view.c \
ephoto_exif.c \
ephoto_gui.c \

View File

@ -80,6 +80,10 @@ Ewl_Widget *add_text(Ewl_Widget *c, char *text);
Ewl_Widget *add_shadow(Ewl_Widget *c);
Ewl_Widget *add_window(char *name, int width, int height, void *cb, void *data);
/* Ephoto Dialogs */
void about_dialog(Ewl_Widget *w, void *event, void *data);
void add_album(Ewl_Widget *w, void *event, void *data);
/* Ephoto Imaging */
unsigned int *flip_horizontal(Ewl_Widget *image);
unsigned int *flip_vertical(Ewl_Widget *image);
@ -117,6 +121,8 @@ void image_pixels_int_get(const char *file, int *width, int *height);
/* Ephoto Main View */
void show_main_view(Ewl_Widget *w, void *event, void *data);
void show_edit_view(Ewl_Widget *w, void *event, void *data);
void populate_albums(Ewl_Widget *w, void *event, void *data);
void populate_directories(Ewl_Widget *w, void *event, void *data);
/* Ephoto Viewer Views */
void show_normal_view(Ewl_Widget *w, void *event, void *data);

180
src/bin/ephoto_dialogs.c Normal file
View File

@ -0,0 +1,180 @@
#include "ephoto.h"
static void close_dialog(Ewl_Widget *w, void *event, void *data);
static void save_image(Ewl_Widget *w, void *event, void *data);
static Ewl_Widget *album_entry, *description_entry, *save_entry, *save_quality;
/*Close or Cancel the Dialog*/
static void close_dialog(Ewl_Widget *w, void *event, void *data)
{
Ewl_Widget *win;
win = data;
ewl_widget_destroy(win);
}
/*Save the Album*/
static void save(Ewl_Widget *w, void *event, void *data)
{
char *album, *description;
Ewl_Widget *win;
sqlite3 *db;
win = data;
album = ewl_text_text_get(EWL_TEXT(album_entry));
description = ewl_text_text_get(EWL_TEXT(description_entry));
if (album)
{
db = ephoto_db_init();
ephoto_db_add_album(db, album, description);
ephoto_db_close(db);
ewl_widget_destroy(win);
ewl_notebook_visible_page_set(EWL_NOTEBOOK(em->browser),
em->atree);
populate_albums(NULL, NULL, NULL);
}
}
/*Add an Album to Ephoto*/
void add_album(Ewl_Widget *w, void *event, void *data)
{
Ewl_Widget *window, *label, *button, *vbox, *hbox;
window = add_window("Add Album", 200, 100, NULL, NULL);
ewl_callback_append(window, EWL_CALLBACK_DELETE_WINDOW, close_dialog, window);
vbox = add_box(window, EWL_ORIENTATION_VERTICAL, 3);
ewl_object_fill_policy_set(EWL_OBJECT(vbox), EWL_FLAG_FILL_ALL);
label = add_label(vbox, "Enter a name for the new album:");
album_entry = add_entry(vbox, NULL, NULL, NULL);
label = add_label(vbox, "Enter a description for the album:");
description_entry = add_entry(vbox, NULL, NULL, NULL);
hbox = add_box(vbox, EWL_ORIENTATION_HORIZONTAL, 2);
ewl_object_fill_policy_set(EWL_OBJECT(hbox), EWL_FLAG_FILL_SHRINK);
button = add_button(hbox, "Save",
PACKAGE_DATA_DIR "/images/stock_save.png",
save, window);
ewl_button_image_size_set(EWL_BUTTON(button), 25, 25);
button = add_button(hbox, "Cancel",
PACKAGE_DATA_DIR "/images/dialog-close.png",
close_dialog, window);
ewl_button_image_size_set(EWL_BUTTON(button), 25, 25);
}
/*Add an About Dialog*/
void about_dialog(Ewl_Widget *w, void *event, void *data)
{
Ewl_Widget *window, *button, *vbox, *text;
window = add_window("About Ephoto", 200, 100, NULL, NULL);
ewl_callback_append(window, EWL_CALLBACK_DELETE_WINDOW, close_dialog, window);
vbox = add_box(window, EWL_ORIENTATION_VERTICAL, 3);
ewl_object_fill_policy_set(EWL_OBJECT(vbox), EWL_FLAG_FILL_ALL);
text = add_text(vbox, "Ephoto is an advanced image viewer that allows\n"
"you to view images in several methods. They\n"
"include an icon view, a list view, and a single\n"
"image view. You can also view exif data, view\n"
"images in a fullscreen mode, and view images in a\n"
"slideshow. The edit view offers simple and advanced\n"
"editing options including rotations, flips, blurs,\n"
"sharpens, conversion to black and white, and\n"
"conversions to sepia.");
ewl_text_wrap_set(EWL_TEXT(text), EWL_TEXT_WRAP_WORD);
button = add_button(vbox, "Close",
PACKAGE_DATA_DIR "/images/dialog-close.png",
close_dialog, window);
ewl_button_image_size_set(EWL_BUTTON(button), 25, 25);
return;
}
static void save_image(Ewl_Widget *w, void *event, void *data)
{
const char *file;
char flags[PATH_MAX];
char *ext;
file = ewl_text_text_get(EWL_TEXT(save_entry));
ext = strrchr(file, '.')+1;
if (!strncmp(ext, "png", 3))
{
snprintf(flags, PATH_MAX, "compress=%i",
(int)ewl_range_value_get(EWL_RANGE(save_quality)));
}
else
{
double svalue;
float jvalue;
svalue = ewl_range_value_get(EWL_RANGE(save_quality));
jvalue = (svalue / 9) * 100;
snprintf(flags, PATH_MAX, "quality=%.0f", jvalue);
}
if(!file) return;
if(VISIBLE(em->eimage))
{
evas_object_image_save(EWL_IMAGE(em->eimage)->image,
file, NULL, flags);
}
ewl_widget_destroy(EWL_WIDGET(data));
}
void save_dialog(const char *file)
{
Ewl_Widget *save_win, *vbox, *hbox, *button;
save_win = add_window("Save Image", 300, 100, NULL, NULL);
ewl_callback_append(save_win, EWL_CALLBACK_DELETE_WINDOW, close_dialog, save_win);
vbox = add_box(save_win, EWL_ORIENTATION_VERTICAL, 5);
ewl_object_fill_policy_set(EWL_OBJECT(vbox), EWL_FLAG_FILL_ALL);
add_label(vbox, "Save As:");
save_entry = add_entry(vbox, "default.jpg", NULL, NULL);
add_label(vbox, "Quality/Compression:");
save_quality = ewl_hseeker_new();
ewl_range_minimum_value_set(EWL_RANGE(save_quality), 1);
ewl_range_maximum_value_set(EWL_RANGE(save_quality), 9);
ewl_range_step_set(EWL_RANGE(save_quality), 1);
ewl_range_value_set(EWL_RANGE(save_quality), 7);
ewl_container_child_append(EWL_CONTAINER(vbox), save_quality);
ewl_widget_show(save_quality);
hbox = add_box(vbox, EWL_ORIENTATION_HORIZONTAL, 5);
ewl_object_alignment_set(EWL_OBJECT(hbox), EWL_FLAG_ALIGN_CENTER);
ewl_object_fill_policy_set(EWL_OBJECT(hbox), EWL_FLAG_FILL_SHRINK);
button = add_button(hbox, "Save",
PACKAGE_DATA_DIR "/images/stock_save.png",
save_image, save_win);
ewl_button_image_size_set(EWL_BUTTON(button), 25, 25);
button = add_button(hbox, "Close",
PACKAGE_DATA_DIR "/images/dialog-close.png",
close_dialog, NULL);
ewl_button_image_size_set(EWL_BUTTON(button), 25, 25);
return;
}

View File

@ -7,7 +7,6 @@ static void previous_image(Ewl_Widget *w, void *event, void *data);
static void next_image(Ewl_Widget *w, void *event, void *data);
static void zoom_in(Ewl_Widget *w, void *event, void *data);
static void zoom_out(Ewl_Widget *w, void *event, void *data);
//static void zoom_full(Ewl_Widget *w, void *event, void *data);
static void flip_image_horizontal(Ewl_Widget *w, void *event, void *data);
static void flip_image_vertical(Ewl_Widget *w, void *event, void *data);
static void rotate_image_left(Ewl_Widget *w, void *event, void *data);
@ -16,8 +15,8 @@ static void image_blur(Ewl_Widget *w, void *event, void *data);
static void image_sharpen(Ewl_Widget *w, void *event, void *data);
static void image_grayscale(Ewl_Widget *w, void *event, void *data);
static void image_sepia(Ewl_Widget *w, void *event, void *data);
//static void close_channel(Ewl_Widget *w, void *event, void *data);
//static void channel_mixer(Ewl_Widget *w, void *event, void *data);
static void close_channel(Ewl_Widget *w, void *event, void *data);
static void channel_mixer(Ewl_Widget *w, void *event, void *data);
/*Add the edit view*/
Ewl_Widget *add_edit_view(Ewl_Widget *c)
@ -100,11 +99,6 @@ static void add_standard_edit_tools(Ewl_Widget *c)
ewl_object_alignment_set(EWL_OBJECT(button), EWL_FLAG_ALIGN_LEFT);
ewl_object_fill_policy_set(EWL_OBJECT(button), EWL_FLAG_FILL_HFILL);
//button = add_button(c, "Zoom 1:1", PACKAGE_DATA_DIR "/images/search.png", zoom_full, NULL);
ewl_button_image_size_set(EWL_BUTTON(button), 20, 20);
ewl_object_alignment_set(EWL_OBJECT(button), EWL_FLAG_ALIGN_LEFT);
ewl_object_fill_policy_set(EWL_OBJECT(button), EWL_FLAG_FILL_HFILL);
button = add_button(c, "Rotate Left", PACKAGE_DATA_DIR "/images/undo.png", rotate_image_left, NULL);
ewl_button_image_size_set(EWL_BUTTON(button), 20, 20);
ewl_object_alignment_set(EWL_OBJECT(button), EWL_FLAG_ALIGN_LEFT);
@ -153,9 +147,9 @@ static void add_advanced_edit_tools(Ewl_Widget *c)
ewl_object_alignment_set(EWL_OBJECT(button), EWL_FLAG_ALIGN_LEFT);
ewl_object_fill_policy_set(EWL_OBJECT(button), EWL_FLAG_FILL_HFILL);
/* button = add_button(c, "Channel Editor", NULL, channel_mixer, NULL);
button = add_button(c, "Channel Editor", NULL, channel_mixer, NULL);
ewl_object_alignment_set(EWL_OBJECT(button), EWL_FLAG_ALIGN_LEFT);
ewl_object_fill_policy_set(EWL_OBJECT(button), EWL_FLAG_FILL_HFILL);*/
ewl_object_fill_policy_set(EWL_OBJECT(button), EWL_FLAG_FILL_HFILL);
return;
}
@ -203,7 +197,7 @@ static void zoom_in(Ewl_Widget *w, void *event, void *data)
ewl_object_current_size_get(EWL_OBJECT(em->eimage), &ow, &oh);
ewl_image_size_set(EWL_IMAGE(em->eimage), ow*2, oh*2);
ewl_image_size_set(EWL_IMAGE(em->eimage), ow*1.5, oh*1.5);
ewl_widget_configure(em->eimage->parent);
return;
@ -216,7 +210,7 @@ static void zoom_out(Ewl_Widget *w, void *event, void *data)
ewl_object_current_size_get(EWL_OBJECT(em->eimage), &ow, &oh);
ewl_image_size_set(EWL_IMAGE(em->eimage), ow/2, oh/2);
ewl_image_size_set(EWL_IMAGE(em->eimage), ow/1.5, oh/1.5);
ewl_widget_configure(em->eimage->parent);
return;
@ -360,56 +354,84 @@ static void image_sepia(Ewl_Widget *w, void *event, void *data)
}
/*Close the Channel Mixer*/
/*static void close_channel(Ewl_Widget *w, void *event, void *data)
static void close_channel(Ewl_Widget *w, void *event, void *data)
{
Ewl_Widget *win;
/* Ewl_Widget *win;
win = data;
ewl_widget_destroy(win);
}*/
ewl_widget_destroy(win);*/
}
/*Add a Channel Mixer*/
/*static void channel_mixer(Ewl_Widget *w, void *event, void *data)
static void channel_mixer(Ewl_Widget *w, void *event, void *data)
{
Ewl_Widget *window, *vbox, *ol, *image, *hist;
close_channel(NULL, NULL, NULL);
/* Ewl_Widget *window, *vbox, *seek;
window = add_window("Channel Editor", 200, 400, NULL, NULL);
window = add_window("Channel Editor", 400, 400, NULL, NULL);
ewl_callback_append(window, EWL_CALLBACK_DELETE_WINDOW, close_channel, window);
vbox = add_box(window, EWL_ORIENTATION_VERTICAL, 5);
vbox = add_box(window, EWL_ORIENTATION_VERTICAL, 1);
add_label(vbox, "Hue");
ol = ewl_overlay_new();
ewl_object_alignment_set(EWL_OBJECT(ol), EWL_FLAG_ALIGN_CENTER);
ewl_object_fill_policy_set(EWL_OBJECT(ol), EWL_FLAG_FILL_SHRINK);
ewl_container_child_append(EWL_CONTAINER(vbox), ol);
ewl_widget_show(ol);
seek = ewl_hseeker_new();
ewl_range_minimum_value_set(EWL_RANGE(seek), -100);
ewl_range_maximum_value_set(EWL_RANGE(seek), 100);
ewl_range_step_set(EWL_RANGE(seek), 10);
ewl_range_value_set(EWL_RANGE(seek), 0);
ewl_container_child_append(EWL_CONTAINER(vbox), seek);
ewl_widget_show(seek);
image = add_image(ol, ewl_image_file_path_get(EWL_IMAGE(em->eimage)),
0, NULL, NULL);
ewl_image_size_set(EWL_IMAGE(image), 175, 175);
ewl_object_alignment_set(EWL_OBJECT(image), EWL_FLAG_ALIGN_CENTER);
add_label(vbox, "Saturation");
hist = ewl_histogram_new();
ewl_histogram_channel_set(EWL_HISTOGRAM(hist), EWL_HISTOGRAM_CHANNEL_R);
ewl_histogram_image_set(EWL_HISTOGRAM(hist), EWL_IMAGE(image));
ewl_object_fill_policy_set(EWL_OBJECT(hist), EWL_FLAG_FILL_ALL);
ewl_container_child_append(EWL_CONTAINER(ol), hist);
ewl_widget_show(hist);
seek = ewl_hseeker_new();
ewl_range_minimum_value_set(EWL_RANGE(seek), -100);
ewl_range_maximum_value_set(EWL_RANGE(seek), 100);
ewl_range_step_set(EWL_RANGE(seek), 10);
ewl_range_value_set(EWL_RANGE(seek), 0);
ewl_container_child_append(EWL_CONTAINER(vbox), seek);
ewl_widget_show(seek);
hist = ewl_histogram_new();
ewl_histogram_channel_set(EWL_HISTOGRAM(hist), EWL_HISTOGRAM_CHANNEL_G);
ewl_histogram_image_set(EWL_HISTOGRAM(hist), EWL_IMAGE(image));
ewl_object_fill_policy_set(EWL_OBJECT(hist), EWL_FLAG_FILL_ALL);
ewl_container_child_append(EWL_CONTAINER(ol), hist);
ewl_widget_show(hist);
add_label(vbox, "Value");
hist = ewl_histogram_new();
ewl_histogram_channel_set(EWL_HISTOGRAM(hist), EWL_HISTOGRAM_CHANNEL_B);
ewl_histogram_image_set(EWL_HISTOGRAM(hist), EWL_IMAGE(image));
ewl_object_fill_policy_set(EWL_OBJECT(hist), EWL_FLAG_FILL_ALL);
ewl_container_child_append(EWL_CONTAINER(ol), hist);
ewl_widget_show(hist);
seek = ewl_hseeker_new();
ewl_range_minimum_value_set(EWL_RANGE(seek), -100);
ewl_range_maximum_value_set(EWL_RANGE(seek), 100);
ewl_range_step_set(EWL_RANGE(seek), 10);
ewl_range_value_set(EWL_RANGE(seek), 0);
ewl_container_child_append(EWL_CONTAINER(vbox), seek);
ewl_widget_show(seek);
}*/
add_label(vbox, "Light");
seek = ewl_hseeker_new();
ewl_range_minimum_value_set(EWL_RANGE(seek), -100);
ewl_range_maximum_value_set(EWL_RANGE(seek), 100);
ewl_range_step_set(EWL_RANGE(seek), 10);
ewl_range_value_set(EWL_RANGE(seek), 0);
ewl_container_child_append(EWL_CONTAINER(vbox), seek);
ewl_widget_show(seek);
add_label(vbox, "Brightness");
seek = ewl_hseeker_new();
ewl_range_minimum_value_set(EWL_RANGE(seek), -100);
ewl_range_maximum_value_set(EWL_RANGE(seek), 100);
ewl_range_step_set(EWL_RANGE(seek), 10);
ewl_range_value_set(EWL_RANGE(seek), 0);
ewl_container_child_append(EWL_CONTAINER(vbox), seek);
ewl_widget_show(seek);
add_label(vbox, "Contrast");
seek = ewl_hseeker_new();
ewl_range_minimum_value_set(EWL_RANGE(seek), -100);
ewl_range_maximum_value_set(EWL_RANGE(seek), 100);
ewl_range_step_set(EWL_RANGE(seek), 10);
ewl_range_value_set(EWL_RANGE(seek), 0);
ewl_container_child_append(EWL_CONTAINER(vbox), seek);
ewl_widget_show(seek);*/
}

View File

@ -1,75 +1,5 @@
#include "ephoto.h"
#define R_CMOD(r) \
red[(int)(r)]
#define G_CMOD(g) \
green[(int)(g)]
#define B_CMOD(b) \
blue[(int)(b)] \
/*#define A_CMOD(a) \
alpha[(int)(a)]*/
#define A_VAL(p) ((unsigned char *)(p))[3]
#define R_VAL(p) ((unsigned char *)(p))[2]
#define G_VAL(p) ((unsigned char *)(p))[1]
#define B_VAL(p) ((unsigned char *)(p))[0]
//static unsigned int *set_contrast(unsigned int *data, int ew, int eh, float v);
static void close_dialog(Ewl_Widget *w, void *event, void *data);
static void close_progress(Ewl_Widget *w, void *event, void *data);
static void save_clicked(Ewl_Widget *w, void *event, void *data);
static void save_image(Ewl_Widget *w, void *event, void *data);
static Ewl_Widget *save_win, *qseek;
/*static unsigned int *set_contrast(unsigned int *data, int ew, int eh, float v)
{
int i, val;
unsigned int *p;
unsigned char red[256], green[256], blue[256], alpha[256];
for (i = 0; i < 256; i++)
{
red[i] = (unsigned char)i;
green[i] = (unsigned char)i;
blue[i] = (unsigned char)i;
alpha[i] = (unsigned char)i;
}
for (i = 0; i < 256; i++)
{
val = (int)(((double)red[i] - 127) * v) + 127;
if (val < 0) val = 0;
if (val > 255) val = 255;
red[i] = (unsigned char)val;
val = (int)(((double)green[i] - 127) * v) + 127;
if (val < 0) val = 0;
if (val > 255) val = 255;
green[i] = (unsigned char)val;
val = (int)(((double)blue[i] - 127) * v) + 127;
if (val < 0) val = 0;
if (val > 255) val = 255;
blue[i] = (unsigned char)val;
val = (int)(((double)alpha[i] - 127) * v) + 127;
if (val < 0) val = 0;
if (val > 255) val = 255;
alpha[i] = (unsigned char)val;
}
for (i = 0; i < (ew * eh); i++)
{
p = &data[i];
R_VAL(p) = R_CMOD(R_VAL(p));
G_VAL(p) = G_CMOD(G_VAL(p));
B_VAL(p) = B_CMOD(B_VAL(p));
// A_VAL(p) = A_CMOD(A_VAL(p));
}
return data;
}*/
unsigned int *flip_horizontal(Ewl_Widget *image)
{
unsigned int *im_data, *im_data_new;
@ -414,118 +344,4 @@ void update_image(Ewl_Widget *image, int w, int h, unsigned int *data)
w, h);
}
}
static void close_dialog(Ewl_Widget *w, void *event, void *data)
{
ewl_widget_destroy(save_win);
}
static void close_progress(Ewl_Widget *w, void *event, void *data)
{
ewl_widget_destroy(w);
}
static void save_image(Ewl_Widget *w, void *event, void *data)
{
const char *file;
char flags[PATH_MAX];
char *ext;
file = data;
ext = strrchr(file, '.')+1;
if (!strncmp(ext, "png", 3))
{
snprintf(flags, PATH_MAX, "compress=%i",
(int)ewl_range_value_get(EWL_RANGE(qseek)));
}
else
{
double svalue;
float jvalue;
svalue = ewl_range_value_get(EWL_RANGE(qseek));
jvalue = (svalue / 9) * 100;
snprintf(flags, PATH_MAX, "quality=%.0f", jvalue);
}
if(!file) return;
if(VISIBLE(em->eimage))
{
evas_object_image_save(EWL_IMAGE(em->eimage)->image,
file, NULL, flags);
}
ewl_widget_destroy(EWL_WIDGET(w));
}
static void save_clicked(Ewl_Widget *w, void *event, void *data)
{
char *file;
Ewl_Widget *pwin, *vbox, *label, *pbar;
file = ewl_text_text_get(EWL_TEXT(data));
if(!file) return;
ewl_widget_destroy(save_win);
pwin = add_window("Save Progress", 200, 75, close_progress, NULL);
ewl_callback_append(pwin, EWL_CALLBACK_SHOW, save_image, file);
vbox = add_box(pwin, EWL_ORIENTATION_VERTICAL, 5);
label = add_label(vbox, "Save Progress");
pbar = ewl_progressbar_new();
ewl_progressbar_label_set(EWL_PROGRESSBAR(pbar), "Saving...");
ewl_range_unknown_set(EWL_RANGE(pbar), 1);
ewl_container_child_append(EWL_CONTAINER(vbox), pbar);
ewl_widget_show(pbar);
return;
}
void save_dialog(const char *file)
{
Ewl_Widget *vbox, *hbox, *button, *entry;
save_win = add_window("Save Image", 300, 100, close_dialog, NULL);
vbox = add_box(save_win, EWL_ORIENTATION_VERTICAL, 5);
ewl_object_fill_policy_set(EWL_OBJECT(vbox), EWL_FLAG_FILL_ALL);
add_label(vbox, "Save As:");
entry = add_entry(vbox, "default.jpg", NULL, NULL);
add_label(vbox, "Quality/Compression:");
qseek = ewl_hseeker_new();
ewl_range_minimum_value_set(EWL_RANGE(qseek), 1);
ewl_range_maximum_value_set(EWL_RANGE(qseek), 9);
ewl_range_step_set(EWL_RANGE(qseek), 1);
ewl_range_value_set(EWL_RANGE(qseek), 7);
ewl_container_child_append(EWL_CONTAINER(vbox), qseek);
ewl_widget_show(qseek);
hbox = add_box(vbox, EWL_ORIENTATION_HORIZONTAL, 5);
ewl_object_alignment_set(EWL_OBJECT(hbox), EWL_FLAG_ALIGN_CENTER);
ewl_object_fill_policy_set(EWL_OBJECT(hbox), EWL_FLAG_FILL_SHRINK);
button = add_button(hbox, "Save",
PACKAGE_DATA_DIR "/images/stock_save.png",
save_clicked, entry);
ewl_button_image_size_set(EWL_BUTTON(button), 25, 25);
button = add_button(hbox, "Close",
PACKAGE_DATA_DIR "/images/dialog-close.png",
close_dialog, NULL);
ewl_button_image_size_set(EWL_BUTTON(button), 25, 25);
return;
}

View File

@ -14,7 +14,7 @@ Ewl_Widget *add_list_view(Ewl_Widget *c)
ewl_object_fill_policy_set(EWL_OBJECT(em->list_vbox), EWL_FLAG_FILL_ALL);
ewl_notebook_page_tab_text_set(EWL_NOTEBOOK(c), em->list_vbox, "List");
em->ltree = add_ltree(em->list_vbox);
em->ltree = add_ltree(em->list_vbox);
return em->list_vbox;
}
@ -22,7 +22,7 @@ Ewl_Widget *add_list_view(Ewl_Widget *c)
/*Show the list view*/
void show_list_view(Ewl_Widget *w, void *event, void *data)
{
ewl_notebook_visible_page_set(EWL_NOTEBOOK(em->main_nb), em->main_vbox);
show_main_view(NULL, NULL, NULL);
ewl_notebook_visible_page_set(EWL_NOTEBOOK(em->view_box), em->list_vbox);
}
@ -132,7 +132,7 @@ static void *list_data_fetch(void *data, unsigned int row, unsigned int column)
const char *image;
void *val = NULL;
image = ecore_list_goto_index(em->images, row);
image = ecore_dlist_goto_index(em->images, row);
if (image)
{
val = (void *)image;

View File

@ -1,15 +1,7 @@
#include "ephoto.h"
/*Ewl Callbacks*/
static void about_dialog(Ewl_Widget *w, void *event, void *data);
static void add_album(Ewl_Widget *w, void *event, void *data);
static void cancel(Ewl_Widget *w, void *event, void *data);
static void destroy(Ewl_Widget *w, void *event, void *data);
static void populate_albums(Ewl_Widget *w, void *event, void *data);
static void populate_directories(Ewl_Widget *w, void *event, void *data);
static void save(Ewl_Widget *w, void *event, void *data);
static void update_view(Ewl_Widget *w, void *event, void *data);
static void window_fullscreen(Ewl_Widget *w, void *event, void *data);
@ -29,7 +21,6 @@ static unsigned int directory_data_count(void *data);
/*Ephoto Global Variables*/
Ephoto_Main *em;
Ewl_Widget *ae, *de;
/*Destroy the Main Window*/
static void destroy(Ewl_Widget *w, void *event, void *data)
@ -91,105 +82,10 @@ static void update_view(Ewl_Widget *w, void *event, void *data)
return;
}
/*Cancel the Dialog*/
static void cancel(Ewl_Widget *w, void *event, void *data)
{
Ewl_Widget *win;
win = data;
ewl_widget_destroy(win);
}
/*Save the Album*/
static void save(Ewl_Widget *w, void *event, void *data)
{
char *album, *description;
Ewl_Widget *win;
sqlite3 *db;
win = data;
album = ewl_text_text_get(EWL_TEXT(ae));
description = ewl_text_text_get(EWL_TEXT(de));
if (album)
{
db = ephoto_db_init();
ephoto_db_add_album(db, album, description);
ephoto_db_close(db);
ewl_widget_destroy(win);
ewl_notebook_visible_page_set(EWL_NOTEBOOK(em->browser),
em->atree);
populate_albums(NULL, NULL, NULL);
}
}
/*Add an Album to Ephoto*/
static void add_album(Ewl_Widget *w, void *event, void *data)
{
Ewl_Widget *window, *label, *button, *vbox, *hbox;
window = add_window("Add Album", 200, 100, NULL, NULL);
ewl_callback_append(window, EWL_CALLBACK_DELETE_WINDOW, cancel, window);
vbox = add_box(window, EWL_ORIENTATION_VERTICAL, 3);
ewl_object_fill_policy_set(EWL_OBJECT(vbox), EWL_FLAG_FILL_ALL);
label = add_label(vbox, "Enter a name for the new album:");
ae = add_entry(vbox, NULL, NULL, NULL);
label = add_label(vbox, "Enter a description for the album:");
de = add_entry(vbox, NULL, NULL, NULL);
hbox = add_box(vbox, EWL_ORIENTATION_HORIZONTAL, 2);
ewl_object_fill_policy_set(EWL_OBJECT(hbox), EWL_FLAG_FILL_SHRINK);
button = add_button(hbox, "Save",
PACKAGE_DATA_DIR "/images/stock_save.png",
save, window);
ewl_button_image_size_set(EWL_BUTTON(button), 25, 25);
button = add_button(hbox, "Cancel",
PACKAGE_DATA_DIR "/images/dialog-close.png",
cancel, window);
ewl_button_image_size_set(EWL_BUTTON(button), 25, 25);
}
/*Add an About Dialog*/
static void about_dialog(Ewl_Widget *w, void *event, void *data)
{
Ewl_Widget *window, *button, *vbox, *text;
window = add_window("About Ephoto", 200, 100, NULL, NULL);
ewl_callback_append(window, EWL_CALLBACK_DELETE_WINDOW, cancel, window);
vbox = add_box(window, EWL_ORIENTATION_VERTICAL, 3);
ewl_object_fill_policy_set(EWL_OBJECT(vbox), EWL_FLAG_FILL_ALL);
text = add_text(vbox, "Ephoto is an advanced image viewer that allows\n"
"you to view images in several methods. They\n"
"include an icon view, a list view, and a single\n"
"image view. You can also view exif data, view\n"
"images in a fullscreen mode, and view images in a\n"
"slideshow. The edit view offers simple and advanced\n"
"editing options including rotations, flips, blurs,\n"
"sharpens, conversion to black and white, and\n"
"conversions to sepia.");
ewl_text_wrap_set(EWL_TEXT(text), EWL_TEXT_WRAP_WORD);
button = add_button(vbox, "Close",
PACKAGE_DATA_DIR "/images/dialog-close.png",
cancel, window);
ewl_button_image_size_set(EWL_BUTTON(button), 25, 25);
return;
}
/*Create the Main Ephoto Window*/
void create_main_gui(void)
{
char buf[PATH_MAX];
Ewl_Widget *vbox, *hbox, *vsep, *button;
Ewl_Widget *mb, *menu, *mi;
@ -352,7 +248,7 @@ void create_main_gui(void)
em->db = ephoto_db_init();
em->current_album = strdup(_("Complete Library"));
em->current_directory = strdup(getenv("HOME"));
em->current_directory = strdup(getcwd(buf, PATH_MAX));
populate_albums(NULL, NULL, NULL);
ewl_callback_append(em->browser, EWL_CALLBACK_VALUE_CHANGED,
@ -362,7 +258,7 @@ void create_main_gui(void)
}
/*Update the Image List*/
static void populate_albums(Ewl_Widget *w, void *event, void *data)
void populate_albums(Ewl_Widget *w, void *event, void *data)
{
const char *album;
char *imagef;
@ -417,7 +313,7 @@ static void populate_albums(Ewl_Widget *w, void *event, void *data)
}
/*Update the Image List*/
static void populate_directories(Ewl_Widget *w, void *event, void *data)
void populate_directories(Ewl_Widget *w, void *event, void *data)
{
const char *directory;
char *imagef;

View File

@ -27,7 +27,7 @@ Ewl_Widget *add_normal_view(Ewl_Widget *c)
/*Show the normal view*/
void show_normal_view(Ewl_Widget *w, void *event, void *data)
{
ewl_notebook_visible_page_set(EWL_NOTEBOOK(em->main_nb), em->main_vbox);
show_main_view(NULL, NULL, NULL);
ewl_notebook_visible_page_set(EWL_NOTEBOOK(em->view_box), em->fbox_vbox);
}

View File

@ -44,7 +44,7 @@ Ewl_Widget *add_single_view(Ewl_Widget *c)
/*Show the single view*/
void show_single_view(Ewl_Widget *w, void *event, void *data)
{
ewl_notebook_visible_page_set(EWL_NOTEBOOK(em->main_nb), em->main_vbox);
show_main_view(NULL, NULL, NULL);
ewl_notebook_visible_page_set(EWL_NOTEBOOK(em->view_box), em->single_vbox);
ewl_image_file_path_set(EWL_IMAGE(em->simage),
ecore_dlist_current(em->images));