Enlightenment CVS committal
Author : codewarrior
Project : e17
Module : proto
Dir : e17/proto/exhibit/src/bin
Modified Files:
exhibit.h exhibit_favorites.c exhibit_image.c exhibit_main.c
exhibit_main.h exhibit_menus.c exhibit_options.c
exhibit_sort.c exhibit_tab.c exhibit_tab.h
Log Message:
- lots of cleanups, moving code around, making things more logical
- config now saves window W and H and uses them next time it starts
===================================================================
RCS file: /cvs/e/e17/proto/exhibit/src/bin/exhibit.h,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -3 -r1.22 -r1.23
--- exhibit.h 2 Aug 2006 17:31:03 -0000 1.22
+++ exhibit.h 2 Aug 2006 19:23:22 -0000 1.23
@@ -5,11 +5,12 @@
#define _EX_H
#include <Eet.h>
-#include <Evas.h>
#include <Ecore.h>
#include <Ecore_X.h>
#include <Ecore_File.h>
#include <Ecore_X_Cursor.h>
+#include <Evas.h>
+#include <Ecore_Evas.h>
#include <Epsilon.h>
#include <etk/Etk.h>
#include <stdio.h>
@@ -35,7 +36,9 @@
#define EX_DEFAULT_BRIGHTEN_THRESH 100
#define EX_DEFAULT_SLIDE_INTERVAL 5.0
#define EX_DEFAULT_COMMENTS_VISIBLE 0
-
+#define EX_DEFAULT_WINDOW_WIDTH 700
+#define EX_DEFAULT_WINDOW_HEIGHT 500
+
#ifdef EX_DEBUG
# define D(x) do {printf(__FILE__ ":%d: ", __LINE__); printf x;
fflush(stdout);} while (0)
#else
@@ -73,7 +76,10 @@
double slide_interval;
int comments_visible;
int default_view;
- int default_sort;
+ int default_sort;
+
+ int last_w;
+ int last_h;
};
struct _Ex_Tab
@@ -141,9 +147,7 @@
Etk_Widget *resbar;
Etk_Widget *zoombar;
Etk_Widget *menu;
- Etk_Widget *win;
-
- char fav_path[PATH_MAX];
+ Etk_Widget *win;
int zoom;
int brightness;
@@ -194,8 +198,6 @@
};
#define WINDOW_TITLE "Exhibit"
-#define WINDOW_WIDTH 700
-#define WINDOW_HEIGHT 500
#define ZOOM_MAX 16
#define ZOOM_MIN -16
===================================================================
RCS file: /cvs/e/e17/proto/exhibit/src/bin/exhibit_favorites.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- exhibit_favorites.c 2 Aug 2006 17:31:03 -0000 1.2
+++ exhibit_favorites.c 2 Aug 2006 19:23:22 -0000 1.3
@@ -9,16 +9,16 @@
char new_path[PATH_MAX];
char *realpath;
- if(!ecore_file_is_dir(e->fav_path))
+ if(!ecore_file_is_dir(e->options->fav_path))
{
- if(ecore_file_exists(e->fav_path))
+ if(ecore_file_exists(e->options->fav_path))
return;
- if(!ecore_file_mkdir(e->fav_path))
+ if(!ecore_file_mkdir(e->options->fav_path))
return;
}
realpath = ecore_file_realpath(path);
- snprintf(new_path, sizeof(new_path), "%s/%s", e->fav_path, path);
+ snprintf(new_path, sizeof(new_path), "%s/%s", e->options->fav_path, path);
ecore_file_symlink(realpath, new_path);
if(realpath)
@@ -30,6 +30,6 @@
{
char new_path[PATH_MAX];
- snprintf(new_path, sizeof(new_path), "%s/%s", e->fav_path, path);
+ snprintf(new_path, sizeof(new_path), "%s/%s", e->options->fav_path, path);
ecore_file_unlink(new_path);
}
===================================================================
RCS file: /cvs/e/e17/proto/exhibit/src/bin/exhibit_image.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -3 -r1.26 -r1.27
--- exhibit_image.c 2 Aug 2006 17:31:03 -0000 1.26
+++ exhibit_image.c 2 Aug 2006 19:23:22 -0000 1.27
@@ -37,9 +37,9 @@
if(evas_key_modifier_is_set(evas_key_modifier_get(evas), "Control"))
{
if (ev->z > 0)
- _ex_main_button_zoom_in_cb(NULL, data);
+ _ex_tab_current_zoom_in(data);
else
- _ex_main_button_zoom_out_cb(NULL, data);
+ _ex_tab_current_zoom_out(data);
}
else
{
@@ -1073,7 +1073,7 @@
if(!r) return ETK_FALSE;
etk_tree_row_fields_get(r,
etk_tree_nth_col_get(ETK_TREE(e->cur_tab->itree), 0), NULL, &icol_string,
etk_tree_nth_col_get(ETK_TREE(e->cur_tab->itree), 1),NULL);
- snprintf(path, sizeof(path), "%s/%s", e->fav_path, icol_string);
+ snprintf(path, sizeof(path), "%s/%s", e->options->fav_path, icol_string);
if(ecore_file_exists(path))
return ETK_TRUE;
return ETK_FALSE;
===================================================================
RCS file: /cvs/e/e17/proto/exhibit/src/bin/exhibit_main.c,v
retrieving revision 1.58
retrieving revision 1.59
diff -u -3 -r1.58 -r1.59
--- exhibit_main.c 2 Aug 2006 17:31:03 -0000 1.58
+++ exhibit_main.c 2 Aug 2006 19:23:22 -0000 1.59
@@ -3,15 +3,24 @@
*/
#include "exhibit.h"
#include <Ecore_File.h>
-#include <Ecore_Evas.h>
+
extern pid_t pid;
extern Evas_List *thumb_list;
Exhibit *e;
-Ecore_Evas *ee_buf;
-Evas *evas_buf;
Evas_List *event_handlers;
+static void _ex_main_button_zoom_in_cb(Etk_Object *obj, void *data);
+static void _ex_main_button_zoom_out_cb(Etk_Object *obj, void *data);
+static void _ex_main_button_zoom_one_to_one_cb(Etk_Object *obj, void *data);
+static void _ex_main_button_fit_to_window_cb(Etk_Object *obj, void *data);
+static int _ex_main_dtree_compare_cb(Etk_Tree *tree, Etk_Tree_Row *row1,
Etk_Tree_Row *row2, Etk_Tree_Col *col, void *data);
+static void _ex_main_goto_dir_clicked_cb(Etk_Object *object, void *data);
+static void _ex_main_entry_dir_key_down_cb(Etk_Object *object, void *event,
void *data);
+static Etk_Bool _ex_main_window_deleted_cb(void *data);
+static void _ex_main_window_key_down_cb(Etk_Object *object, void *event, void
*data);
+static void _ex_main_window_resize_cb(Etk_Object *object, void *data);
+
void
_ex_main_statusbar_zoom_update(Exhibit *e)
{
@@ -41,197 +50,44 @@
}
}
-void
+static void
_ex_main_button_zoom_in_cb(Etk_Object *obj, void *data)
{
Exhibit *e;
e = data;
-
- if (e->cur_tab->fit_window)
- {
- if(evas_list_count(e->tabs) == 1)
- {
- if(e->cur_tab->comment.visible)
- {
- etk_paned_child2_set(ETK_PANED(e->hpaned),
e->cur_tab->comment.vbox, ETK_TRUE);
- etk_container_remove(ETK_CONTAINER(e->cur_tab->comment.vbox),
e->cur_tab->alignment);
- etk_container_remove(ETK_CONTAINER(e->cur_tab->comment.vbox),
e->cur_tab->comment.frame);
- etk_box_pack_start(ETK_BOX(e->cur_tab->comment.vbox),
e->cur_tab->scrolled_view, ETK_TRUE, ETK_TRUE, 0);
- etk_box_pack_start(ETK_BOX(e->cur_tab->comment.vbox),
e->cur_tab->comment.frame, ETK_FALSE, ETK_FALSE, 3);
- }
- else
- etk_paned_child2_set(ETK_PANED(e->hpaned),
e->cur_tab->scrolled_view, ETK_TRUE);
- }
- else
- {
- if(e->cur_tab->comment.visible)
- {
- etk_notebook_page_child_set(ETK_NOTEBOOK(e->notebook),
e->cur_tab->num, e->cur_tab->comment.vbox);
- etk_container_remove(ETK_CONTAINER(e->cur_tab->comment.vbox),
e->cur_tab->alignment);
- etk_container_remove(ETK_CONTAINER(e->cur_tab->comment.vbox),
e->cur_tab->comment.frame);
- etk_box_pack_start(ETK_BOX(e->cur_tab->comment.vbox),
e->cur_tab->scrolled_view, ETK_TRUE, ETK_TRUE, 0);
- etk_box_pack_start(ETK_BOX(e->cur_tab->comment.vbox),
e->cur_tab->comment.frame, ETK_FALSE, ETK_FALSE, 3);
- }
- else
- etk_notebook_page_child_set(ETK_NOTEBOOK(e->notebook),
e->cur_tab->num, e->cur_tab->scrolled_view);
- }
-
- etk_widget_size_request_set(e->cur_tab->alignment, -1, -1);
-
etk_scrolled_view_add_with_viewport(ETK_SCROLLED_VIEW(e->cur_tab->scrolled_view),
e->cur_tab->alignment);
- e->cur_tab->fit_window = ETK_FALSE;
- }
-
- if(e->zoom == ZOOM_MAX)
- e->zoom = ZOOM_MAX;
- else
- e->zoom += 2;
-
- _ex_image_zoom(ETK_IMAGE(e->cur_tab->image), e->zoom);
- _ex_main_statusbar_zoom_update(e);
+
+ _ex_tab_current_zoom_in(e);
}
-void
+static void
_ex_main_button_zoom_out_cb(Etk_Object *obj, void *data)
{
Exhibit *e;
e = data;
-
- if (e->cur_tab->fit_window)
- {
- if(evas_list_count(e->tabs) == 1)
- {
- if(e->cur_tab->comment.visible)
- {
- etk_paned_child2_set(ETK_PANED(e->hpaned),
e->cur_tab->comment.vbox, ETK_TRUE);
- etk_container_remove(ETK_CONTAINER(e->cur_tab->comment.vbox),
e->cur_tab->alignment);
- etk_container_remove(ETK_CONTAINER(e->cur_tab->comment.vbox),
e->cur_tab->comment.frame);
- etk_box_pack_start(ETK_BOX(e->cur_tab->comment.vbox),
e->cur_tab->scrolled_view, ETK_TRUE, ETK_TRUE, 0);
- etk_box_pack_start(ETK_BOX(e->cur_tab->comment.vbox),
e->cur_tab->comment.frame, ETK_FALSE, ETK_FALSE, 3);
- }
- else
- etk_paned_child2_set(ETK_PANED(e->hpaned),
e->cur_tab->scrolled_view, ETK_TRUE);
- }
- else
- {
- if(e->cur_tab->comment.visible)
- {
- etk_notebook_page_child_set(ETK_NOTEBOOK(e->notebook),
e->cur_tab->num, e->cur_tab->comment.vbox);
- etk_container_remove(ETK_CONTAINER(e->cur_tab->comment.vbox),
e->cur_tab->alignment);
- etk_container_remove(ETK_CONTAINER(e->cur_tab->comment.vbox),
e->cur_tab->comment.frame);
- etk_box_pack_start(ETK_BOX(e->cur_tab->comment.vbox),
e->cur_tab->scrolled_view, ETK_TRUE, ETK_TRUE, 0);
- etk_box_pack_start(ETK_BOX(e->cur_tab->comment.vbox),
e->cur_tab->comment.frame, ETK_FALSE, ETK_FALSE, 3);
- }
- else
- etk_notebook_page_child_set(ETK_NOTEBOOK(e->notebook),
e->cur_tab->num, e->cur_tab->scrolled_view);
- }
-
- etk_widget_size_request_set(e->cur_tab->alignment, -1, -1);
-
etk_scrolled_view_add_with_viewport(ETK_SCROLLED_VIEW(e->cur_tab->scrolled_view),
e->cur_tab->alignment);
- e->cur_tab->fit_window = ETK_FALSE;
- }
-
- if(e->zoom <= ZOOM_MIN)
- e->zoom = ZOOM_MIN;
- else
- e->zoom -= 2;
-
- _ex_image_zoom(ETK_IMAGE(e->cur_tab->image), e->zoom);
- _ex_main_statusbar_zoom_update(e);
+
+ _ex_tab_current_zoom_out(e);
}
-void
+static void
_ex_main_button_zoom_one_to_one_cb(Etk_Object *obj, void *data)
{
- Exhibit *e;
+ Exhibit *e;
e = data;
-
- if (e->cur_tab->fit_window)
- {
- if(evas_list_count(e->tabs) == 1)
- {
- if(e->cur_tab->comment.visible)
- {
- etk_paned_child2_set(ETK_PANED(e->hpaned),
e->cur_tab->comment.vbox, ETK_TRUE);
- etk_container_remove(ETK_CONTAINER(e->cur_tab->comment.vbox),
e->cur_tab->alignment);
- etk_container_remove(ETK_CONTAINER(e->cur_tab->comment.vbox),
e->cur_tab->comment.frame);
- etk_box_pack_start(ETK_BOX(e->cur_tab->comment.vbox),
e->cur_tab->scrolled_view, ETK_TRUE, ETK_TRUE, 0);
- etk_box_pack_start(ETK_BOX(e->cur_tab->comment.vbox),
e->cur_tab->comment.frame, ETK_FALSE, ETK_FALSE, 3);
- }
- else
- etk_paned_child2_set(ETK_PANED(e->hpaned),
e->cur_tab->scrolled_view, ETK_TRUE);
- }
- else
- {
- if(e->cur_tab->comment.visible)
- {
- etk_notebook_page_child_set(ETK_NOTEBOOK(e->notebook),
e->cur_tab->num, e->cur_tab->comment.vbox);
- etk_container_remove(ETK_CONTAINER(e->cur_tab->comment.vbox),
e->cur_tab->alignment);
- etk_container_remove(ETK_CONTAINER(e->cur_tab->comment.vbox),
e->cur_tab->comment.frame);
- etk_box_pack_start(ETK_BOX(e->cur_tab->comment.vbox),
e->cur_tab->scrolled_view, ETK_TRUE, ETK_TRUE, 0);
- etk_box_pack_start(ETK_BOX(e->cur_tab->comment.vbox),
e->cur_tab->comment.frame, ETK_FALSE, ETK_FALSE, 3);
- }
- else
- etk_notebook_page_child_set(ETK_NOTEBOOK(e->notebook),
e->cur_tab->num, e->cur_tab->scrolled_view);
- }
-
- etk_widget_size_request_set(e->cur_tab->alignment, -1, -1);
-
etk_scrolled_view_add_with_viewport(ETK_SCROLLED_VIEW(e->cur_tab->scrolled_view),
e->cur_tab->alignment);
- e->cur_tab->fit_window = ETK_FALSE;
- }
-
- e->zoom = 0;
- e->brightness = 128;
- e->contrast = 0;
-
- _ex_image_zoom(ETK_IMAGE(e->cur_tab->image), e->zoom);
- _ex_main_statusbar_zoom_update(e);
+
+ _ex_tab_current_zoom_one_to_one(e);
}
-void
+static void
_ex_main_button_fit_to_window_cb(Etk_Object *obj, void *data)
{
- Exhibit *e;
+ Exhibit *e;
e = data;
- if (e->cur_tab->fit_window)
- return;
-
- etk_widget_size_request_set(e->cur_tab->alignment, 10, 10);
- if(evas_list_count(e->tabs) == 1)
- {
- if(e->cur_tab->comment.visible)
- {
- etk_paned_child2_set(ETK_PANED(e->hpaned),
e->cur_tab->comment.vbox, ETK_TRUE);
- etk_container_remove(ETK_CONTAINER(e->cur_tab->comment.vbox),
e->cur_tab->scrolled_view);
- etk_container_remove(ETK_CONTAINER(e->cur_tab->comment.vbox),
e->cur_tab->comment.frame);
- etk_box_pack_start(ETK_BOX(e->cur_tab->comment.vbox),
e->cur_tab->alignment, ETK_TRUE, ETK_TRUE, 0);
- etk_box_pack_start(ETK_BOX(e->cur_tab->comment.vbox),
e->cur_tab->comment.frame, ETK_FALSE, ETK_FALSE, 3);
- }
- else
- etk_paned_child2_set(ETK_PANED(e->hpaned), e->cur_tab->alignment,
ETK_TRUE);
- }
- else
- {
- if(e->cur_tab->comment.visible)
- {
- etk_notebook_page_child_set(ETK_NOTEBOOK(e->notebook),
e->cur_tab->num, e->cur_tab->comment.vbox);
- etk_container_remove(ETK_CONTAINER(e->cur_tab->comment.vbox),
e->cur_tab->scrolled_view);
- etk_container_remove(ETK_CONTAINER(e->cur_tab->comment.vbox),
e->cur_tab->comment.frame);
- etk_box_pack_start(ETK_BOX(e->cur_tab->comment.vbox),
e->cur_tab->alignment, ETK_TRUE, ETK_TRUE, 0);
- etk_box_pack_start(ETK_BOX(e->cur_tab->comment.vbox),
e->cur_tab->comment.frame, ETK_FALSE, ETK_FALSE, 3);
- }
- else
- etk_notebook_page_child_set(ETK_NOTEBOOK(e->notebook),
e->cur_tab->num, e->cur_tab->alignment);
- }
-
- etk_widget_size_request_set(e->cur_tab->image, -1, -1);
-
- e->cur_tab->fit_window = ETK_TRUE;
- _ex_main_statusbar_zoom_update(e);
+ _ex_tab_current_fit_to_window(e);
}
void
@@ -332,48 +188,7 @@
_ex_comment_load(e);
}
-void
-_ex_main_itree_item_clicked_cb(Etk_Object *object, Etk_Tree_Row *row, void
*data)
-{
- Exhibit *e;
- Etk_Tree *tree;
- char *icol_string;
-
- e = data;
- e->zoom = 0;
- _ex_main_statusbar_zoom_update(e);
-
- tree = ETK_TREE(object);
-
- etk_tree_row_fields_get(row, etk_tree_nth_col_get(tree, 0), NULL,
- &icol_string, etk_tree_nth_col_get(tree, 1),NULL);
-
- _ex_main_image_set(e, icol_string);
-}
-
-void
-_ex_main_dtree_item_clicked_cb(Etk_Object *object, Etk_Tree_Row *row, void
*event, void *data)
-{
- Etk_Tree *tree;
- char *dcol_string;
- Exhibit *e;
-
- e = data;
- _ex_slideshow_stop(e);
-
- tree = ETK_TREE(object);
- etk_tree_row_fields_get(row, etk_tree_nth_col_get(tree, 0), NULL, NULL,
&dcol_string, NULL);
-
- E_FREE(e->cur_tab->dir);
- e->cur_tab->dir = strdup(dcol_string);
- etk_tree_clear(ETK_TREE(e->cur_tab->itree));
- etk_tree_clear(ETK_TREE(e->cur_tab->dtree));
- _ex_main_populate_files(e, NULL);
- etk_notebook_page_tab_label_set(ETK_NOTEBOOK(e->notebook), e->cur_tab->num,
_ex_file_get(e->cur_tab->cur_path));
-}
-
-
-int
+static int
_ex_main_dtree_compare_cb(Etk_Tree *tree, Etk_Tree_Row *row1, Etk_Tree_Row
*row2, Etk_Tree_Col *col, void *data)
{
char *dir1, *dir2;
@@ -386,113 +201,6 @@
return strcasecmp(dir1, dir2);
}
-int
-_ex_main_itree_name_compare_cb(Etk_Tree *tree, Etk_Tree_Row *row1,
Etk_Tree_Row *row2, Etk_Tree_Col *col, void *data)
-{
- char *f1, *f2;
-
- if (!row1 || !row2 || !col)
- return 0;
-
- etk_tree_row_fields_get(row1, col, NULL, &f1, NULL,NULL);
- etk_tree_row_fields_get(row2, col, NULL, &f2, NULL,NULL);
-
- return strcasecmp(f1, f2);
-}
-
-int
-_ex_main_itree_size_compare_cb(Etk_Tree *tree, Etk_Tree_Row *row1,
Etk_Tree_Row *row2, Etk_Tree_Col *col, void *data)
-{
- char *f1, *f2;
- struct stat s1, s2;
-
- if (!row1 || !row2 || !col)
- return 0;
-
- etk_tree_row_fields_get(row1, col, NULL, &f1, NULL,NULL);
- etk_tree_row_fields_get(row2, col, NULL, &f2, NULL,NULL);
-
- stat(f1, &s1);
- stat(f2, &s2);
-
- if(s1.st_size > s2.st_size)
- return 1;
- else
- return -1;
-}
-
-int
-_ex_main_itree_date_compare_cb(Etk_Tree *tree, Etk_Tree_Row *row1,
Etk_Tree_Row *row2, Etk_Tree_Col *col, void *data)
-{
- char *f1, *f2;
- struct stat s1, s2;
-
- if (!row1 || !row2 || !col)
- return 0;
-
- etk_tree_row_fields_get(row1, col, NULL, &f1, NULL,NULL);
- etk_tree_row_fields_get(row2, col, NULL, &f2, NULL,NULL);
-
- stat(f1, &s1);
- stat(f2, &s2);
-
- if(s1.st_mtime > s2.st_mtime)
- return 1;
- else
- return -1;
-}
-
-int
-_ex_main_itree_resol_compare_cb(Etk_Tree *tree, Etk_Tree_Row *row1,
Etk_Tree_Row *row2, Etk_Tree_Col *col, void *data)
-{
- char *f1, *f2;
- Evas_Object *i1, *i2;
- int w1, h1, w2, h2;
-
- if (!row1 || !row2 || !col)
- return 0;
-
- etk_tree_row_fields_get(row1, col, NULL, &f1, NULL,NULL);
- etk_tree_row_fields_get(row2, col, NULL, &f2, NULL,NULL);
-
- if(!ee_buf)
- {
- ee_buf = ecore_evas_buffer_new(0, 0);
- evas_buf = ecore_evas_get(ee_buf);
- }
-
- if(_ex_file_is_ebg(f1))
- {
- w1 = 800;
- h1 = 600;
- }
- else
- {
- i1 = evas_object_image_add(evas_buf);
- evas_object_image_file_set(i1, f1, NULL);
- evas_object_image_size_get(i1, &w1, &h1);
- evas_object_del(i1);
- }
-
- if(_ex_file_is_ebg(f2))
- {
- w2 = 800;
- h2 = 600;
- }
- else
- {
- i2 = evas_object_image_add(evas_buf);
- evas_object_image_file_set(i2, f2, NULL);
- evas_object_image_size_get(i2, &w2, &h2);
- evas_object_del(i2);
- }
-
- if(w1 * h1 > w2 * h2)
- return 1;
- else
- return -1;
-}
-
void
_ex_main_populate_files(Exhibit *e, const char *selected_file)
{
@@ -605,25 +313,7 @@
closedir(dir);
}
-void
-_ex_main_itree_key_down_cb(Etk_Object *object, void *event, void *data)
-{
- Etk_Event_Key_Up_Down *ev;
- Exhibit *e;
-
- e = data;
- ev = event;
-
- if(!strcmp(ev->key, "Return") || !strcmp(ev->key, "KP_Enter"))
- {
- e->cur_tab->dir =
strdup((char*)etk_entry_text_get(ETK_ENTRY(e->entry[0])));
- etk_tree_clear(ETK_TREE(e->cur_tab->itree));
- etk_tree_clear(ETK_TREE(e->cur_tab->dtree));
- _ex_main_populate_files(e, NULL);
- }
-}
-
-void
+static void
_ex_main_entry_dir_key_down_cb(Etk_Object *object, void *event, void *data)
{
Etk_Event_Key_Up_Down *ev;
@@ -708,7 +398,7 @@
}
}
-void
+static void
_ex_main_goto_dir_clicked_cb(Etk_Object *object, void *data)
{
Exhibit *e;
@@ -721,7 +411,7 @@
_ex_main_populate_files(e, NULL);
}
-Etk_Bool
+static Etk_Bool
_ex_main_window_deleted_cb(void *data)
{
Exhibit *e;
@@ -731,7 +421,7 @@
return 1;
}
-void
+static void
_ex_main_window_key_down_cb(Etk_Object *object, void *event, void *data)
{
Etk_Event_Key_Up_Down *ev;
@@ -781,6 +471,14 @@
}
}
+static void
+_ex_main_window_resize_cb(Etk_Object *object, void *data)
+{
+
+ etk_window_geometry_get(ETK_WINDOW(object), NULL, NULL,
+ &e->options->last_w, &e->options->last_h);
+}
+
void
_ex_main_window_slideshow_toggle(Exhibit *e)
{
@@ -794,7 +492,7 @@
}
}
-void
+static void
_ex_main_window_tab_toggled_cb(Etk_Object *object, void *data)
{
Exhibit *e;
@@ -857,7 +555,8 @@
etk_notebook_current_page_set(ETK_NOTEBOOK(e->notebook),
evas_list_count(e->tabs) - 1);
}
-static void _etk_main_drag_drop_cb(Etk_Object *object, void *event, void *data)
+static void
+_etk_main_drag_drop_cb(Etk_Object *object, void *event, void *data)
{
Etk_Event_Selection_Request *ev;
Etk_Selection_Data_Files *files;
@@ -925,22 +624,27 @@
/* Now load saved options */
_ex_options_load(e);
- homedir = getenv("HOME");
- if (!homedir)
- snprintf(e->fav_path, sizeof(e->fav_path), "%s",
"/tmp/exhibit_favorites");
- else
+ if(!e->options->fav_path)
{
- snprintf(e->fav_path, sizeof(e->fav_path), "%s/.e", homedir);
- if(!ecore_file_is_dir(e->fav_path))
- ecore_file_mkdir(e->fav_path);
- snprintf(e->fav_path, sizeof(e->fav_path), "%s/.e/exhibit", homedir);
- if(!ecore_file_is_dir(e->fav_path))
- ecore_file_mkdir(e->fav_path);
- snprintf(e->fav_path, sizeof(e->fav_path), "%s/.e/exhibit/favorites",
homedir);
+ int size = PATH_MAX * sizeof(char);
+ e->options->fav_path = malloc(size);
+ homedir = getenv("HOME");
+ if (!homedir)
+ snprintf(e->options->fav_path, size, "%s", "/tmp/exhibit_favorites");
+ else
+ {
+ snprintf(e->options->fav_path, size, "%s/.e", homedir);
+ if(!ecore_file_is_dir(e->options->fav_path))
+ ecore_file_mkdir(e->options->fav_path);
+ snprintf(e->options->fav_path, size, "%s/.e/exhibit", homedir);
+ if(!ecore_file_is_dir(e->options->fav_path))
+ ecore_file_mkdir(e->options->fav_path);
+ snprintf(e->options->fav_path, size, "%s/.e/exhibit/favorites",
homedir);
+ }
}
- if(!ecore_file_is_dir(e->fav_path))
- ecore_file_mkdir(e->fav_path);
+ if(!ecore_file_is_dir(e->options->fav_path))
+ ecore_file_mkdir(e->options->fav_path);
file = NULL;
tab = NULL;
@@ -954,9 +658,10 @@
etk_widget_dnd_types_set(e->win, dnd_types, dnd_types_num);
etk_window_title_set(ETK_WINDOW(e->win), WINDOW_TITLE " - Image Viewing the
Kewl Way!");
etk_window_wmclass_set(ETK_WINDOW(e->win), "exhibit", "Exhibit");
- etk_window_resize(ETK_WINDOW(e->win), WINDOW_WIDTH, WINDOW_HEIGHT);
+ etk_window_resize(ETK_WINDOW(e->win), e->options->last_w,
e->options->last_h);
etk_signal_connect("delete_event", ETK_OBJECT(e->win),
ETK_CALLBACK(_ex_main_window_deleted_cb), e);
etk_signal_connect("key_down", ETK_OBJECT(e->win),
ETK_CALLBACK(_ex_main_window_key_down_cb), e);
+ etk_signal_connect("resize", ETK_OBJECT(e->win),
ETK_CALLBACK(_ex_main_window_resize_cb), e);
e->vbox = etk_vbox_new(ETK_FALSE, 0);
etk_container_add(ETK_CONTAINER(e->win), e->vbox);
===================================================================
RCS file: /cvs/e/e17/proto/exhibit/src/bin/exhibit_main.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -3 -r1.9 -r1.10
--- exhibit_main.h 2 Aug 2006 03:10:43 -0000 1.9
+++ exhibit_main.h 2 Aug 2006 19:23:22 -0000 1.10
@@ -5,25 +5,9 @@
#define _EX_MAIN_H
void _ex_main_statusbar_zoom_update(Exhibit *e);
-void _ex_main_button_zoom_in_cb(Etk_Object *obj, void *data);
-void _ex_main_button_zoom_out_cb(Etk_Object *obj, void *data);
-void _ex_main_button_zoom_one_to_one_cb(Etk_Object *obj, void *data);
-void _ex_main_button_fit_to_window_cb(Etk_Object *obj, void *data);
-void _ex_main_itree_item_clicked_cb(Etk_Object *object, Etk_Tree_Row
*row, void *data);
-void _ex_main_itree_key_down_cb(Etk_Object *object, void *event, void
*data);
-int _ex_main_itree_name_compare_cb(Etk_Tree *tree, Etk_Tree_Row
*row1, Etk_Tree_Row *row2, Etk_Tree_Col *col, void *data);
-int _ex_main_itree_size_compare_cb(Etk_Tree *tree, Etk_Tree_Row
*row1, Etk_Tree_Row *row2, Etk_Tree_Col *col, void *data);
-int _ex_main_itree_date_compare_cb(Etk_Tree *tree, Etk_Tree_Row
*row1, Etk_Tree_Row *row2, Etk_Tree_Col *col, void *data);
-int _ex_main_itree_resol_compare_cb(Etk_Tree *tree, Etk_Tree_Row
*row1, Etk_Tree_Row *row2, Etk_Tree_Col *col, void *data);
-void _ex_main_dtree_item_clicked_cb(Etk_Object *object, Etk_Tree_Row
*row, void *event, void *data);
-int _ex_main_dtree_compare_cb(Etk_Tree *tree, Etk_Tree_Row *row1,
Etk_Tree_Row *row2, Etk_Tree_Col *col, void *data);
void _ex_main_populate_files(Exhibit *e, const char *selected_file);
-void _ex_main_entry_dir_key_down_cb(Etk_Object *object, void *event,
void *data);
int _ex_main_window_slideshow_next(void *data);
void _ex_main_window_slideshow_toggle(Exhibit *e);
-void _ex_main_goto_dir_clicked_cb(Etk_Object *object, void *data);
-Etk_Bool _ex_main_window_deleted_cb(void *data);
-void _ex_main_window_key_down_cb(Etk_Object *object, void *event, void
*data);
void _ex_main_window_tab_append(Exhibit *e, Ex_Tab *tab);
void _ex_main_window_show(char *dir);
void _ex_main_image_unset(Exhibit *e);
===================================================================
RCS file: /cvs/e/e17/proto/exhibit/src/bin/exhibit_menus.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -3 -r1.22 -r1.23
--- exhibit_menus.c 2 Aug 2006 17:31:04 -0000 1.22
+++ exhibit_menus.c 2 Aug 2006 19:23:22 -0000 1.23
@@ -304,25 +304,25 @@
void
_ex_menu_zoom_in_cb(Etk_Object *obj, void *data)
{
- _ex_main_button_zoom_in_cb(NULL, data);
+ _ex_tab_current_zoom_in(data);
}
void
_ex_menu_zoom_out_cb(Etk_Object *obj, void *data)
{
- _ex_main_button_zoom_out_cb(NULL, data);
+ _ex_tab_current_zoom_out(data);
}
void
_ex_menu_zoom_one_to_one_cb(Etk_Object *obj, void *data)
{
- _ex_main_button_zoom_one_to_one_cb(NULL, data);
+ _ex_tab_current_zoom_one_to_one(data);
}
void
_ex_menu_fit_to_window_cb(Etk_Object *obj, void *data)
{
- _ex_main_button_fit_to_window_cb(NULL, data);
+ _ex_tab_current_fit_to_window(data);
}
void
@@ -409,7 +409,7 @@
_ex_slideshow_stop(e);
E_FREE(e->cur_tab->dir);
- e->cur_tab->dir = strdup(e->fav_path);
+ e->cur_tab->dir = strdup(e->options->fav_path);
etk_tree_clear(ETK_TREE(e->cur_tab->itree));
etk_tree_clear(ETK_TREE(e->cur_tab->dtree));
_ex_main_populate_files(e, NULL);
===================================================================
RCS file: /cvs/e/e17/proto/exhibit/src/bin/exhibit_options.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -3 -r1.5 -r1.6
--- exhibit_options.c 2 Aug 2006 17:31:04 -0000 1.5
+++ exhibit_options.c 2 Aug 2006 19:23:22 -0000 1.6
@@ -84,7 +84,9 @@
CFG_OPTIONS_NEWI("lt", slide_interval, EET_T_DOUBLE);
CFG_OPTIONS_NEWI("cv", comments_visible, EET_T_INT);
CFG_OPTIONS_NEWI("dv", default_view, EET_T_INT);
-
+ CFG_OPTIONS_NEWI("lw", last_w, EET_T_INT);
+ CFG_OPTIONS_NEWI("lh", last_h, EET_T_INT);
+
_ex_config_version_edd = NEWD("Ex_Config_Version", Ex_Config_Version);
VER_NEWI("mj", major, EET_T_INT);
VER_NEWI("mn", minor, EET_T_INT);
@@ -157,6 +159,8 @@
if(!e->options)
e->options = _ex_options_new();
+ D(("Config: using default options!\n"));
+
/* TODO: free values before allocating if e->options != NULL */
e->options->app1 = NULL;
@@ -171,7 +175,8 @@
e->options->comments_visible = EX_DEFAULT_COMMENTS_VISIBLE;
e->options->default_view = EX_IMAGE_ONE_TO_ONE;
e->options->default_sort = 0; /* TODO: enumerate sort types */
-
+ e->options->last_w = EX_DEFAULT_WINDOW_WIDTH;
+ e->options->last_h = EX_DEFAULT_WINDOW_HEIGHT;
e->version = _ex_options_version_parse(VERSION);
}
@@ -211,6 +216,8 @@
ret = eet_data_write(ef, _ex_config_options_edd, "config/options",
e->options, 1);
if(!ret)
fprintf(stderr, "Problem saving config/options!");
+
+ D(("Saving configuation (%s)\n", e->options->fav_path));
eet_close(ef);
return ret;
@@ -269,6 +276,9 @@
}
e->options = eet_data_read(ef, _ex_config_options_edd, "config/options");
+
+ D(("Config: Loaded saved options (%s)\n", e->options->fav_path));
+
eet_close(ef);
return 1;
===================================================================
RCS file: /cvs/e/e17/proto/exhibit/src/bin/exhibit_sort.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -3 -r1.4 -r1.5
--- exhibit_sort.c 15 Jan 2006 12:31:48 -0000 1.4
+++ exhibit_sort.c 2 Aug 2006 19:23:22 -0000 1.5
@@ -1,12 +1,123 @@
#include "exhibit.h"
+static Ecore_Evas *ee_buf;
+static Evas *evas_buf;
+
+static int
+_ex_sort_itree_name_compare_cb(Etk_Tree *tree, Etk_Tree_Row *row1,
Etk_Tree_Row *row2, Etk_Tree_Col *col, void *data)
+{
+ char *f1, *f2;
+
+ if (!row1 || !row2 || !col)
+ return 0;
+
+ etk_tree_row_fields_get(row1, col, NULL, &f1, NULL,NULL);
+ etk_tree_row_fields_get(row2, col, NULL, &f2, NULL,NULL);
+
+ return strcasecmp(f1, f2);
+}
+
+
+static int
+_ex_sort_itree_size_compare_cb(Etk_Tree *tree, Etk_Tree_Row *row1,
Etk_Tree_Row *row2, Etk_Tree_Col *col, void *data)
+{
+ char *f1, *f2;
+ struct stat s1, s2;
+
+ if (!row1 || !row2 || !col)
+ return 0;
+
+ etk_tree_row_fields_get(row1, col, NULL, &f1, NULL,NULL);
+ etk_tree_row_fields_get(row2, col, NULL, &f2, NULL,NULL);
+
+ stat(f1, &s1);
+ stat(f2, &s2);
+
+ if(s1.st_size > s2.st_size)
+ return 1;
+ else
+ return -1;
+}
+
+static int
+_ex_sort_itree_date_compare_cb(Etk_Tree *tree, Etk_Tree_Row *row1,
Etk_Tree_Row *row2, Etk_Tree_Col *col, void *data)
+{
+ char *f1, *f2;
+ struct stat s1, s2;
+
+ if (!row1 || !row2 || !col)
+ return 0;
+
+ etk_tree_row_fields_get(row1, col, NULL, &f1, NULL,NULL);
+ etk_tree_row_fields_get(row2, col, NULL, &f2, NULL,NULL);
+
+ stat(f1, &s1);
+ stat(f2, &s2);
+
+ if(s1.st_mtime > s2.st_mtime)
+ return 1;
+ else
+ return -1;
+}
+
+static int
+_ex_sort_itree_resol_compare_cb(Etk_Tree *tree, Etk_Tree_Row *row1,
Etk_Tree_Row *row2, Etk_Tree_Col *col, void *data)
+{
+ char *f1, *f2;
+ Evas_Object *i1, *i2;
+ int w1, h1, w2, h2;
+
+ if (!row1 || !row2 || !col)
+ return 0;
+
+ etk_tree_row_fields_get(row1, col, NULL, &f1, NULL,NULL);
+ etk_tree_row_fields_get(row2, col, NULL, &f2, NULL,NULL);
+
+ if(!ee_buf)
+ {
+ ee_buf = ecore_evas_buffer_new(0, 0);
+ evas_buf = ecore_evas_get(ee_buf);
+ }
+
+ if(_ex_file_is_ebg(f1))
+ {
+ w1 = 800;
+ h1 = 600;
+ }
+ else
+ {
+ i1 = evas_object_image_add(evas_buf);
+ evas_object_image_file_set(i1, f1, NULL);
+ evas_object_image_size_get(i1, &w1, &h1);
+ evas_object_del(i1);
+ }
+
+ if(_ex_file_is_ebg(f2))
+ {
+ w2 = 800;
+ h2 = 600;
+ }
+ else
+ {
+ i2 = evas_object_image_add(evas_buf);
+ evas_object_image_file_set(i2, f2, NULL);
+ evas_object_image_size_get(i2, &w2, &h2);
+ evas_object_del(i2);
+ }
+
+ if(w1 * h1 > w2 * h2)
+ return 1;
+ else
+ return -1;
+}
+
void
_ex_sort_name_cb(Etk_Object *obj, void *data)
{
Exhibit *e;
e = data;
- etk_tree_sort(ETK_TREE(e->cur_tab->itree), _ex_main_itree_name_compare_cb,
ETK_TRUE, e->cur_tab->icol, NULL);
+ etk_tree_sort(ETK_TREE(e->cur_tab->itree), _ex_sort_itree_name_compare_cb,
ETK_TRUE, e->cur_tab->icol, NULL);
}
void
@@ -15,7 +126,7 @@
Exhibit *e;
e = data;
- etk_tree_sort(ETK_TREE(e->cur_tab->itree), _ex_main_itree_size_compare_cb,
ETK_TRUE, e->cur_tab->icol, NULL);
+ etk_tree_sort(ETK_TREE(e->cur_tab->itree), _ex_sort_itree_size_compare_cb,
ETK_TRUE, e->cur_tab->icol, NULL);
}
void
@@ -24,7 +135,7 @@
Exhibit *e;
e = data;
- etk_tree_sort(ETK_TREE(e->cur_tab->itree), _ex_main_itree_resol_compare_cb,
ETK_TRUE, e->cur_tab->icol, NULL);
+ etk_tree_sort(ETK_TREE(e->cur_tab->itree), _ex_sort_itree_resol_compare_cb,
ETK_TRUE, e->cur_tab->icol, NULL);
}
void
@@ -33,7 +144,7 @@
Exhibit *e;
e = data;
- etk_tree_sort(ETK_TREE(e->cur_tab->itree), _ex_main_itree_date_compare_cb,
ETK_TRUE, e->cur_tab->icol, NULL);
+ etk_tree_sort(ETK_TREE(e->cur_tab->itree), _ex_sort_itree_date_compare_cb,
ETK_TRUE, e->cur_tab->icol, NULL);
}
===================================================================
RCS file: /cvs/e/e17/proto/exhibit/src/bin/exhibit_tab.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -3 -r1.19 -r1.20
--- exhibit_tab.c 2 Aug 2006 17:31:04 -0000 1.19
+++ exhibit_tab.c 2 Aug 2006 19:23:22 -0000 1.20
@@ -7,6 +7,9 @@
#define EX_DND_COL_NUM 5
static void _ex_tab_tree_drag_begin_cb(Etk_Object *object, void *data);
+static void _ex_tab_dtree_item_clicked_cb(Etk_Object *object, Etk_Tree_Row
*row, void *event, void *data);
+static void _ex_tab_itree_item_clicked_cb(Etk_Object *object, Etk_Tree_Row
*row, void *data);
+static void _ex_tab_itree_key_down_cb(Etk_Object *object, void *event, void
*data);
Ex_Tab *
_ex_tab_new(Exhibit *e, char *dir)
@@ -27,7 +30,7 @@
tab->dtree = etk_tree_new();
etk_widget_size_request_set(tab->dtree, 180, 120);
- etk_signal_connect("row_clicked", ETK_OBJECT(tab->dtree),
ETK_CALLBACK(_ex_main_dtree_item_clicked_cb), e);
+ etk_signal_connect("row_clicked", ETK_OBJECT(tab->dtree),
ETK_CALLBACK(_ex_tab_dtree_item_clicked_cb), e);
tab->dcol = etk_tree_col_new(ETK_TREE(tab->dtree), "Directories",
etk_tree_model_icon_text_new(ETK_TREE(tab->dtree), ETK_TREE_FROM_EDJE), 10);
etk_tree_headers_visible_set(ETK_TREE(tab->dtree), 0);
etk_scrolled_view_policy_set(etk_tree_scrolled_view_get(ETK_TREE(tab->dtree)),
ETK_POLICY_AUTO, ETK_POLICY_SHOW);
@@ -38,8 +41,8 @@
etk_signal_connect("drag_begin", ETK_OBJECT(tab->itree),
ETK_CALLBACK(_ex_tab_tree_drag_begin_cb), tab);
etk_widget_size_request_set(tab->itree, 180, 220);
etk_tree_multiple_select_set(ETK_TREE(tab->itree), ETK_TRUE);
- etk_signal_connect("row_selected", ETK_OBJECT(tab->itree),
ETK_CALLBACK(_ex_main_itree_item_clicked_cb), e);
- etk_signal_connect("key_down", ETK_OBJECT(tab->itree),
ETK_CALLBACK(_ex_main_itree_key_down_cb), e);
+ etk_signal_connect("row_selected", ETK_OBJECT(tab->itree),
ETK_CALLBACK(_ex_tab_itree_item_clicked_cb), e);
+ etk_signal_connect("key_down", ETK_OBJECT(tab->itree),
ETK_CALLBACK(_ex_tab_itree_key_down_cb), e);
imodel = etk_tree_model_icon_text_new(ETK_TREE(tab->itree),
ETK_TREE_FROM_FILE);
etk_tree_model_icon_text_icon_width_set(imodel, 80);
tab->icol = etk_tree_col_new(ETK_TREE(tab->itree), "Files", imodel, 10);
@@ -115,6 +118,183 @@
etk_widget_show_all(tab->e->win);
}
+void
+_ex_tab_current_zoom_in(Exhibit *e)
+{
+ if (e->cur_tab->fit_window)
+ {
+ if(evas_list_count(e->tabs) == 1)
+ {
+ if(e->cur_tab->comment.visible)
+ {
+ etk_paned_child2_set(ETK_PANED(e->hpaned),
e->cur_tab->comment.vbox, ETK_TRUE);
+ etk_container_remove(ETK_CONTAINER(e->cur_tab->comment.vbox),
e->cur_tab->alignment);
+ etk_container_remove(ETK_CONTAINER(e->cur_tab->comment.vbox),
e->cur_tab->comment.frame);
+ etk_box_pack_start(ETK_BOX(e->cur_tab->comment.vbox),
e->cur_tab->scrolled_view, ETK_TRUE, ETK_TRUE, 0);
+ etk_box_pack_start(ETK_BOX(e->cur_tab->comment.vbox),
e->cur_tab->comment.frame, ETK_FALSE, ETK_FALSE, 3);
+ }
+ else
+ etk_paned_child2_set(ETK_PANED(e->hpaned),
e->cur_tab->scrolled_view, ETK_TRUE);
+ }
+ else
+ {
+ if(e->cur_tab->comment.visible)
+ {
+ etk_notebook_page_child_set(ETK_NOTEBOOK(e->notebook),
e->cur_tab->num, e->cur_tab->comment.vbox);
+ etk_container_remove(ETK_CONTAINER(e->cur_tab->comment.vbox),
e->cur_tab->alignment);
+ etk_container_remove(ETK_CONTAINER(e->cur_tab->comment.vbox),
e->cur_tab->comment.frame);
+ etk_box_pack_start(ETK_BOX(e->cur_tab->comment.vbox),
e->cur_tab->scrolled_view, ETK_TRUE, ETK_TRUE, 0);
+ etk_box_pack_start(ETK_BOX(e->cur_tab->comment.vbox),
e->cur_tab->comment.frame, ETK_FALSE, ETK_FALSE, 3);
+ }
+ else
+ etk_notebook_page_child_set(ETK_NOTEBOOK(e->notebook),
e->cur_tab->num, e->cur_tab->scrolled_view);
+ }
+
+ etk_widget_size_request_set(e->cur_tab->alignment, -1, -1);
+
etk_scrolled_view_add_with_viewport(ETK_SCROLLED_VIEW(e->cur_tab->scrolled_view),
e->cur_tab->alignment);
+ e->cur_tab->fit_window = ETK_FALSE;
+ }
+
+ if(e->zoom == ZOOM_MAX)
+ e->zoom = ZOOM_MAX;
+ else
+ e->zoom += 2;
+
+ _ex_image_zoom(ETK_IMAGE(e->cur_tab->image), e->zoom);
+ _ex_main_statusbar_zoom_update(e);
+}
+
+void
+_ex_tab_current_zoom_out(Exhibit *e)
+{
+ if (e->cur_tab->fit_window)
+ {
+ if(evas_list_count(e->tabs) == 1)
+ {
+ if(e->cur_tab->comment.visible)
+ {
+ etk_paned_child2_set(ETK_PANED(e->hpaned),
e->cur_tab->comment.vbox, ETK_TRUE);
+ etk_container_remove(ETK_CONTAINER(e->cur_tab->comment.vbox),
e->cur_tab->alignment);
+ etk_container_remove(ETK_CONTAINER(e->cur_tab->comment.vbox),
e->cur_tab->comment.frame);
+ etk_box_pack_start(ETK_BOX(e->cur_tab->comment.vbox),
e->cur_tab->scrolled_view, ETK_TRUE, ETK_TRUE, 0);
+ etk_box_pack_start(ETK_BOX(e->cur_tab->comment.vbox),
e->cur_tab->comment.frame, ETK_FALSE, ETK_FALSE, 3);
+ }
+ else
+ etk_paned_child2_set(ETK_PANED(e->hpaned),
e->cur_tab->scrolled_view, ETK_TRUE);
+ }
+ else
+ {
+ if(e->cur_tab->comment.visible)
+ {
+ etk_notebook_page_child_set(ETK_NOTEBOOK(e->notebook),
e->cur_tab->num, e->cur_tab->comment.vbox);
+ etk_container_remove(ETK_CONTAINER(e->cur_tab->comment.vbox),
e->cur_tab->alignment);
+ etk_container_remove(ETK_CONTAINER(e->cur_tab->comment.vbox),
e->cur_tab->comment.frame);
+ etk_box_pack_start(ETK_BOX(e->cur_tab->comment.vbox),
e->cur_tab->scrolled_view, ETK_TRUE, ETK_TRUE, 0);
+ etk_box_pack_start(ETK_BOX(e->cur_tab->comment.vbox),
e->cur_tab->comment.frame, ETK_FALSE, ETK_FALSE, 3);
+ }
+ else
+ etk_notebook_page_child_set(ETK_NOTEBOOK(e->notebook),
e->cur_tab->num, e->cur_tab->scrolled_view);
+ }
+
+ etk_widget_size_request_set(e->cur_tab->alignment, -1, -1);
+
etk_scrolled_view_add_with_viewport(ETK_SCROLLED_VIEW(e->cur_tab->scrolled_view),
e->cur_tab->alignment);
+ e->cur_tab->fit_window = ETK_FALSE;
+ }
+
+ if(e->zoom <= ZOOM_MIN)
+ e->zoom = ZOOM_MIN;
+ else
+ e->zoom -= 2;
+
+ _ex_image_zoom(ETK_IMAGE(e->cur_tab->image), e->zoom);
+ _ex_main_statusbar_zoom_update(e);
+}
+
+void
+_ex_tab_current_zoom_one_to_one(Exhibit *e)
+{
+ if (e->cur_tab->fit_window)
+ {
+ if(evas_list_count(e->tabs) == 1)
+ {
+ if(e->cur_tab->comment.visible)
+ {
+ etk_paned_child2_set(ETK_PANED(e->hpaned),
e->cur_tab->comment.vbox, ETK_TRUE);
+ etk_container_remove(ETK_CONTAINER(e->cur_tab->comment.vbox),
e->cur_tab->alignment);
+ etk_container_remove(ETK_CONTAINER(e->cur_tab->comment.vbox),
e->cur_tab->comment.frame);
+ etk_box_pack_start(ETK_BOX(e->cur_tab->comment.vbox),
e->cur_tab->scrolled_view, ETK_TRUE, ETK_TRUE, 0);
+ etk_box_pack_start(ETK_BOX(e->cur_tab->comment.vbox),
e->cur_tab->comment.frame, ETK_FALSE, ETK_FALSE, 3);
+ }
+ else
+ etk_paned_child2_set(ETK_PANED(e->hpaned),
e->cur_tab->scrolled_view, ETK_TRUE);
+ }
+ else
+ {
+ if(e->cur_tab->comment.visible)
+ {
+ etk_notebook_page_child_set(ETK_NOTEBOOK(e->notebook),
e->cur_tab->num, e->cur_tab->comment.vbox);
+ etk_container_remove(ETK_CONTAINER(e->cur_tab->comment.vbox),
e->cur_tab->alignment);
+ etk_container_remove(ETK_CONTAINER(e->cur_tab->comment.vbox),
e->cur_tab->comment.frame);
+ etk_box_pack_start(ETK_BOX(e->cur_tab->comment.vbox),
e->cur_tab->scrolled_view, ETK_TRUE, ETK_TRUE, 0);
+ etk_box_pack_start(ETK_BOX(e->cur_tab->comment.vbox),
e->cur_tab->comment.frame, ETK_FALSE, ETK_FALSE, 3);
+ }
+ else
+ etk_notebook_page_child_set(ETK_NOTEBOOK(e->notebook),
e->cur_tab->num, e->cur_tab->scrolled_view);
+ }
+
+ etk_widget_size_request_set(e->cur_tab->alignment, -1, -1);
+
etk_scrolled_view_add_with_viewport(ETK_SCROLLED_VIEW(e->cur_tab->scrolled_view),
e->cur_tab->alignment);
+ e->cur_tab->fit_window = ETK_FALSE;
+ }
+
+ e->zoom = 0;
+ e->brightness = 128;
+ e->contrast = 0;
+
+ _ex_image_zoom(ETK_IMAGE(e->cur_tab->image), e->zoom);
+ _ex_main_statusbar_zoom_update(e);
+}
+
+void
+_ex_tab_current_fit_to_window(Exhibit *e)
+{
+ if (e->cur_tab->fit_window)
+ return;
+
+ etk_widget_size_request_set(e->cur_tab->alignment, 10, 10);
+ if(evas_list_count(e->tabs) == 1)
+ {
+ if(e->cur_tab->comment.visible)
+ {
+ etk_paned_child2_set(ETK_PANED(e->hpaned),
e->cur_tab->comment.vbox, ETK_TRUE);
+ etk_container_remove(ETK_CONTAINER(e->cur_tab->comment.vbox),
e->cur_tab->scrolled_view);
+ etk_container_remove(ETK_CONTAINER(e->cur_tab->comment.vbox),
e->cur_tab->comment.frame);
+ etk_box_pack_start(ETK_BOX(e->cur_tab->comment.vbox),
e->cur_tab->alignment, ETK_TRUE, ETK_TRUE, 0);
+ etk_box_pack_start(ETK_BOX(e->cur_tab->comment.vbox),
e->cur_tab->comment.frame, ETK_FALSE, ETK_FALSE, 3);
+ }
+ else
+ etk_paned_child2_set(ETK_PANED(e->hpaned), e->cur_tab->alignment,
ETK_TRUE);
+ }
+ else
+ {
+ if(e->cur_tab->comment.visible)
+ {
+ etk_notebook_page_child_set(ETK_NOTEBOOK(e->notebook),
e->cur_tab->num, e->cur_tab->comment.vbox);
+ etk_container_remove(ETK_CONTAINER(e->cur_tab->comment.vbox),
e->cur_tab->scrolled_view);
+ etk_container_remove(ETK_CONTAINER(e->cur_tab->comment.vbox),
e->cur_tab->comment.frame);
+ etk_box_pack_start(ETK_BOX(e->cur_tab->comment.vbox),
e->cur_tab->alignment, ETK_TRUE, ETK_TRUE, 0);
+ etk_box_pack_start(ETK_BOX(e->cur_tab->comment.vbox),
e->cur_tab->comment.frame, ETK_FALSE, ETK_FALSE, 3);
+ }
+ else
+ etk_notebook_page_child_set(ETK_NOTEBOOK(e->notebook),
e->cur_tab->num, e->cur_tab->alignment);
+ }
+
+ etk_widget_size_request_set(e->cur_tab->image, -1, -1);
+
+ e->cur_tab->fit_window = ETK_TRUE;
+ _ex_main_statusbar_zoom_update(e);
+}
+
static void _ex_tab_tree_drag_begin_cb(Etk_Object *object, void *data)
{
Ex_Tab *tab;
@@ -195,4 +375,62 @@
etk_drag_types_set(ETK_DRAG(drag), types, num_types);
etk_drag_data_set(ETK_DRAG(drag), drag_data, strlen(drag_data) + 1);
+}
+
+static void
+_ex_tab_dtree_item_clicked_cb(Etk_Object *object, Etk_Tree_Row *row, void
*event, void *data)
+{
+ Etk_Tree *tree;
+ char *dcol_string;
+ Exhibit *e;
+
+ e = data;
+ _ex_slideshow_stop(e);
+
+ tree = ETK_TREE(object);
+ etk_tree_row_fields_get(row, etk_tree_nth_col_get(tree, 0), NULL, NULL,
&dcol_string, NULL);
+
+ E_FREE(e->cur_tab->dir);
+ e->cur_tab->dir = strdup(dcol_string);
+ etk_tree_clear(ETK_TREE(e->cur_tab->itree));
+ etk_tree_clear(ETK_TREE(e->cur_tab->dtree));
+ _ex_main_populate_files(e, NULL);
+ etk_notebook_page_tab_label_set(ETK_NOTEBOOK(e->notebook), e->cur_tab->num,
_ex_file_get(e->cur_tab->cur_path));
+}
+
+static void
+_ex_tab_itree_item_clicked_cb(Etk_Object *object, Etk_Tree_Row *row, void
*data)
+{
+ Exhibit *e;
+ Etk_Tree *tree;
+ char *icol_string;
+
+ e = data;
+ e->zoom = 0;
+ _ex_main_statusbar_zoom_update(e);
+
+ tree = ETK_TREE(object);
+
+ etk_tree_row_fields_get(row, etk_tree_nth_col_get(tree, 0), NULL,
+ &icol_string, etk_tree_nth_col_get(tree, 1),NULL);
+
+ _ex_main_image_set(e, icol_string);
+}
+
+static void
+_ex_tab_itree_key_down_cb(Etk_Object *object, void *event, void *data)
+{
+ Etk_Event_Key_Up_Down *ev;
+ Exhibit *e;
+
+ e = data;
+ ev = event;
+
+ if(!strcmp(ev->key, "Return") || !strcmp(ev->key, "KP_Enter"))
+ {
+ e->cur_tab->dir =
strdup((char*)etk_entry_text_get(ETK_ENTRY(e->entry[0])));
+ etk_tree_clear(ETK_TREE(e->cur_tab->itree));
+ etk_tree_clear(ETK_TREE(e->cur_tab->dtree));
+ _ex_main_populate_files(e, NULL);
+ }
}
===================================================================
RCS file: /cvs/e/e17/proto/exhibit/src/bin/exhibit_tab.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- exhibit_tab.h 2 Aug 2006 03:10:43 -0000 1.2
+++ exhibit_tab.h 2 Aug 2006 19:23:22 -0000 1.3
@@ -4,10 +4,13 @@
#ifndef _EX_TAB_H
#define _EX_TAB_H
-Ex_Tab *_ex_tab_new(Exhibit *e, char *dir);
-void _ex_tab_dir_set(Ex_Tab *tab, char *dir);
-void _ex_tab_delete(Ex_Tab *tab);
-void _ex_tab_select(Ex_Tab *tab);
-
+Ex_Tab *_ex_tab_new(Exhibit *e, char *dir);
+void _ex_tab_dir_set(Ex_Tab *tab, char *dir);
+void _ex_tab_delete(Ex_Tab *tab);
+void _ex_tab_select(Ex_Tab *tab);
+void _ex_tab_current_zoom_in(Exhibit *e);
+void _ex_tab_current_zoom_out(Exhibit *e);
+void _ex_tab_current_zoom_one_to_one(Exhibit *e);
+void _ex_tab_current_fit_to_window(Exhibit *e);
#endif
-------------------------------------------------------------------------
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