[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[E-devel] exhibit fullscreen patch



Hi,

as I'm using gqview, I really like the exhibit image viewer.
The attached patch allows you to toggle to fullscreen mode.

A further improvement would be to have a black background in fullscreen
instead of the one colored with the etk's background color.

In fullscreen mode the next image can be selected with SPACE and the
previous with 'b'.

Best regards,
Friedrich
diff -Naur exhibit/src/bin/exhibit.h exhibit_current/src/bin/exhibit.h
--- exhibit/src/bin/exhibit.h	2006-12-14 10:18:12.482892235 +0100
+++ exhibit_current/src/bin/exhibit.h	2006-12-14 10:19:13.703892235 +0100
@@ -186,6 +186,7 @@
 struct _Exhibit
 {
    Etk_Widget    *vbox;
+   Etk_Widget    *vboxf;
    Etk_Widget    *hbox;
    Etk_Widget    *menu_bar;
    Etk_Widget    *statusbar[4];
diff -Naur exhibit/src/bin/exhibit_main.c exhibit_current/src/bin/exhibit_main.c
--- exhibit/src/bin/exhibit_main.c	2006-12-14 10:18:12.487892235 +0100
+++ exhibit_current/src/bin/exhibit_main.c	2006-12-14 11:35:46.812892235 +0100
@@ -121,8 +121,10 @@
    etk_statusbar_message_pop(ETK_STATUSBAR(e->statusbar[1]), 0);
    etk_statusbar_message_push(ETK_STATUSBAR(e->statusbar[1]), size, 0);
    
-   hs = etk_scrolled_view_hscrollbar_get(ETK_SCROLLED_VIEW(e->cur_tab->scrolled_view));
-   vs = etk_scrolled_view_vscrollbar_get(ETK_SCROLLED_VIEW(e->cur_tab->scrolled_view));
+   hs = etk_scrolled_view_hscrollbar_get(
+					 ETK_SCROLLED_VIEW(e->cur_tab->scrolled_view));
+   vs = etk_scrolled_view_vscrollbar_get(
+					 ETK_SCROLLED_VIEW(e->cur_tab->scrolled_view));
       
    etk_range_value_set(hs, (double)w/2);
    etk_range_value_set(vs, (double)h/2);
@@ -494,7 +496,14 @@
 	  }
 	else if(!strcmp(ev->key, "q"))
 	  {
-	     etk_main_quit();
+				/* when in full screen mode actually don't close 
+				 * exhibit but leave full screen */
+				if (!etk_window_fullscreen_get(e->win)){
+						etk_main_quit();
+				}
+				else {
+						_ex_main_window_fullscreen_toggle(e);
+				}
 	  }
 	else if(!strcmp(ev->key, "d"))
 	  {
@@ -519,7 +528,24 @@
 	  {
 	     _ex_main_window_slideshow_toggle();
 	  }		   
+	else if(!strcmp(ev->key, "f"))
+	  {
+	     _ex_main_window_fullscreen_toggle(e);
+	  }		   
      }
+
+	 /* only active when in full screen mode */
+	 if (etk_window_fullscreen_get(e->win)) {
+			 if(!strcmp(ev->key, "f")) {
+					 _ex_main_window_fullscreen_toggle(e);
+			 }
+			 if(!strcmp(ev->key, "space")) {
+					 _ex_slideshow_next(e);
+			 }
+			 if(!strcmp(ev->key, "b")) {
+					 _ex_slideshow_prev(e);
+			 }
+	 }
 }
 
 static void
@@ -538,6 +564,38 @@
      _ex_slideshow_start();
 }
 
+void
+_ex_main_window_fullscreen_toggle(Exhibit *e) {
+		if (etk_window_fullscreen_get(e->win)) {
+				etk_container_remove(ETK_CONTAINER(e->win), e->vboxf);
+				etk_container_add(ETK_CONTAINER(e->win), e->vbox);
+				etk_widget_show_all(e->win);
+				etk_container_add(ETK_CONTAINER(e->hpaned_shadow), e->notebook);
+				if (evas_list_count(e->tabs) > 1)
+						etk_notebook_tabs_visible_set(ETK_NOTEBOOK(e->notebook), ETK_TRUE);
+				else
+						etk_notebook_tabs_visible_set(ETK_NOTEBOOK(e->notebook), ETK_FALSE);
+				etk_window_fullscreen_set(e->win, ETK_FALSE);
+
+		}
+		else{
+				etk_window_fullscreen_set(e->win, ETK_TRUE);
+				etk_widget_hide(e->statusbar[0]);
+				etk_widget_hide(e->statusbar[1]);
+				etk_widget_hide(e->statusbar[2]);
+				etk_widget_hide(e->statusbar[3]);
+				etk_widget_hide(e->sort_bar);
+				etk_container_remove(ETK_CONTAINER(e->win), e->vbox);
+				e->vboxf = etk_vbox_new(ETK_FALSE, 0);
+				etk_container_add(ETK_CONTAINER(e->win), e->vboxf);
+				etk_box_append(ETK_BOX(e->vboxf), e->notebook, 
+								ETK_BOX_START, ETK_BOX_EXPAND_FILL, 0);
+				etk_widget_show(e->vboxf);
+				etk_widget_show(e->notebook);
+				etk_notebook_tabs_visible_set(ETK_NOTEBOOK(e->notebook), ETK_FALSE);
+		}
+}
+
 static void 
 _ex_main_window_tab_toggled_cb(Etk_Object *object, void *data)
 {     
diff -Naur exhibit/src/bin/exhibit_main.h exhibit_current/src/bin/exhibit_main.h
--- exhibit/src/bin/exhibit_main.h	2006-12-14 10:18:12.488892235 +0100
+++ exhibit_current/src/bin/exhibit_main.h	2006-12-14 10:19:13.756892235 +0100
@@ -9,6 +9,7 @@
 void         _ex_main_itree_add(const char *file, const char *selected_file);
 int          _ex_main_window_slideshow_next(void *data);
 void         _ex_main_window_slideshow_toggle();    
+void         _ex_main_window_fullscreen_toggle();    
 void         _ex_main_window_tab_append(Ex_Tab *tab);
 void         _ex_main_window_tab_remove(Ex_Tab *tab);
 void         _ex_main_dialog_show(char *text, Etk_Message_Dialog_Type type);
diff -Naur exhibit/src/bin/exhibit_menus.c exhibit_current/src/bin/exhibit_menus.c
--- exhibit/src/bin/exhibit_menus.c	2006-12-14 10:18:12.489892235 +0100
+++ exhibit_current/src/bin/exhibit_menus.c	2006-12-14 10:25:23.589892235 +0100
@@ -544,6 +544,7 @@
 	 "<b>control-d:</b> add to favorites\n"
 	 "<b>control-x:</b> toggle view\n"
 	 "<b>control-q:</b> exit program\n"
+	 "<b>control-f:</b> toggle fullscreen\n"
 	 "<b>control-s:</b> toggle slideshow\n",
 	 ETK_TRUE);
    etk_container_add(ETK_CONTAINER(frame), helptext);
diff -Naur exhibit/src/bin/exhibit_slideshow.c exhibit_current/src/bin/exhibit_slideshow.c
--- exhibit/src/bin/exhibit_slideshow.c	2006-12-14 10:18:12.492892235 +0100
+++ exhibit_current/src/bin/exhibit_slideshow.c	2006-12-14 11:33:57.894892235 +0100
@@ -55,3 +55,30 @@
 
    return 1; 
 }
+
+int
+_ex_slideshow_prev(void *data)
+{
+   Etk_Tree_Row *row, *first_row;
+   int i = 0;
+   int n = 0;
+   char string[80];
+
+   row = etk_tree_selected_row_get(ETK_TREE(e->cur_tab->itree));
+   first_row = etk_tree_first_row_get(ETK_TREE(e->cur_tab->itree));
+
+   if(!row || row == first_row)
+     row = etk_tree_last_row_get(ETK_TREE(e->cur_tab->itree), ETK_FALSE, ETK_FALSE);
+   else
+     row = etk_tree_prev_row_get(row, ETK_FALSE, ETK_FALSE);
+   
+   etk_tree_row_select(row);
+   etk_tree_row_scroll_to(row, ETK_FALSE);
+
+   i = etk_tree_num_rows_get(ETK_TREE(e->cur_tab->itree));
+   n = 1 + etk_tree_row_num_get(ETK_TREE(e->cur_tab->itree), row);
+   sprintf(string, "Slideshow picture %d of %d", n, i);
+   etk_statusbar_message_push(ETK_STATUSBAR(e->statusbar[3]), string, 0);
+
+   return 1; 
+}
diff -Naur exhibit/src/bin/exhibit_slideshow.h exhibit_current/src/bin/exhibit_slideshow.h
--- exhibit/src/bin/exhibit_slideshow.h	2006-12-14 10:18:12.493892235 +0100
+++ exhibit_current/src/bin/exhibit_slideshow.h	2006-12-14 11:24:56.993892235 +0100
@@ -7,5 +7,6 @@
 void  _ex_slideshow_stop();
 void  _ex_slideshow_start();
 int   _ex_slideshow_next(void *data);    
+int   _ex_slideshow_prev(void *data);    
 
 #endif

Attachment: signature.asc
Description: PGP signature