Make some changes to layout to make it seem more modular. Also change the toolbar to use image buttons.
SVN revision: 28648
This commit is contained in:
parent
dd4729e88a
commit
6309d5623d
|
@ -4,11 +4,79 @@ group
|
||||||
min: 16 16;
|
min: 16 16;
|
||||||
data
|
data
|
||||||
{
|
{
|
||||||
item: "inset/left" 14;
|
|
||||||
item: "inset/right" 14;
|
|
||||||
item: "inset/top" 5;
|
item: "inset/top" 5;
|
||||||
item: "inset/bottom" 5;
|
item: "inset/bottom" 5;
|
||||||
item: "pad" 2;
|
item: "inset/left" 3;
|
||||||
|
item: "inset/right" 3;
|
||||||
|
item: "pad" 4;
|
||||||
|
}
|
||||||
|
parts
|
||||||
|
{
|
||||||
|
part
|
||||||
|
{
|
||||||
|
name: "background";
|
||||||
|
mouse_events: 1;
|
||||||
|
description
|
||||||
|
{
|
||||||
|
state: "default" 0.0;
|
||||||
|
rel1
|
||||||
|
{
|
||||||
|
relative: 0.0 0.0;
|
||||||
|
offset: 0 0;
|
||||||
|
}
|
||||||
|
rel2
|
||||||
|
{
|
||||||
|
relative: 1.0 1.0;
|
||||||
|
offset: -1 -1;
|
||||||
|
}
|
||||||
|
image
|
||||||
|
{
|
||||||
|
normal: "button.png";
|
||||||
|
border: 5 5 5 5;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
description
|
||||||
|
{
|
||||||
|
state: "clicked" 0.0;
|
||||||
|
inherit: "default" 0.0;
|
||||||
|
image
|
||||||
|
{
|
||||||
|
normal: "button_clicked.png";
|
||||||
|
border: 5 5 5 5;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
programs
|
||||||
|
{
|
||||||
|
program
|
||||||
|
{
|
||||||
|
name: "clicked";
|
||||||
|
signal: "mouse,down,1";
|
||||||
|
source: "EWL";
|
||||||
|
action: STATE_SET "clicked" 1.0;
|
||||||
|
target: "background";
|
||||||
|
}
|
||||||
|
program
|
||||||
|
{
|
||||||
|
name: "unclicked";
|
||||||
|
signal: "mouse,up,1";
|
||||||
|
source: "EWL";
|
||||||
|
action: STATE_SET "default" 1.0;
|
||||||
|
target: "background";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
group
|
||||||
|
{
|
||||||
|
name: "/ephoto/toolbar/button";
|
||||||
|
min: 16 16;
|
||||||
|
data
|
||||||
|
{
|
||||||
|
item: "inset" 2;
|
||||||
|
item: "pad/left" 2;
|
||||||
|
item: "pad/right" 2;
|
||||||
}
|
}
|
||||||
parts
|
parts
|
||||||
{
|
{
|
||||||
|
|
|
@ -62,6 +62,7 @@ data
|
||||||
item: "/text/font" "ewl/default";
|
item: "/text/font" "ewl/default";
|
||||||
item: "/text/font_size" 10;
|
item: "/text/font_size" 10;
|
||||||
item: "/text/style" "none";
|
item: "/text/style" "none";
|
||||||
|
item: "/htoolbar/hbox/button/group" "/ephoto/toolbar/button";
|
||||||
item: "/tooltip/delay" ".2";
|
item: "/tooltip/delay" ".2";
|
||||||
item: "/tooltip/group" "/ephoto/window";
|
item: "/tooltip/group" "/ephoto/window";
|
||||||
item: "/tooltip/hoffset" "5";
|
item: "/tooltip/hoffset" "5";
|
||||||
|
|
|
@ -120,7 +120,6 @@ struct _Ephoto_Main
|
||||||
Ewl_Widget *ltree;
|
Ewl_Widget *ltree;
|
||||||
Ewl_Widget *tbar;
|
Ewl_Widget *tbar;
|
||||||
Ewl_Widget *toolbar;
|
Ewl_Widget *toolbar;
|
||||||
Ewl_Widget *vcombo;
|
|
||||||
Ewl_Widget *view_box;
|
Ewl_Widget *view_box;
|
||||||
Ewl_Widget *win;
|
Ewl_Widget *win;
|
||||||
sqlite3 *db;
|
sqlite3 *db;
|
||||||
|
|
|
@ -29,9 +29,6 @@ void show_edit_view(Ewl_Widget *w, void *event, void *data)
|
||||||
{
|
{
|
||||||
ewl_notebook_visible_page_set(EWL_NOTEBOOK(em->view_box), em->edit_vbox);
|
ewl_notebook_visible_page_set(EWL_NOTEBOOK(em->view_box), em->edit_vbox);
|
||||||
ecore_dlist_goto_first(em->images);
|
ecore_dlist_goto_first(em->images);
|
||||||
ewl_widget_enable(em->edit_tools);
|
|
||||||
ewl_widget_hide(em->atree);
|
|
||||||
ewl_widget_hide(em->tbar);
|
|
||||||
ewl_widget_hide(em->ilabel);
|
ewl_widget_hide(em->ilabel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,9 +26,6 @@ void show_list_view(Ewl_Widget *w, void *event, void *data)
|
||||||
{
|
{
|
||||||
ewl_notebook_visible_page_set(EWL_NOTEBOOK(em->view_box), em->list_vbox);
|
ewl_notebook_visible_page_set(EWL_NOTEBOOK(em->view_box), em->list_vbox);
|
||||||
ewl_mvc_dirty_set(EWL_MVC(em->ltree), 1);
|
ewl_mvc_dirty_set(EWL_MVC(em->ltree), 1);
|
||||||
ewl_widget_disable(em->edit_tools);
|
|
||||||
ewl_widget_show(em->atree);
|
|
||||||
ewl_widget_show(em->tbar);
|
|
||||||
ewl_widget_hide(em->ilabel);
|
ewl_widget_hide(em->ilabel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,14 +1,12 @@
|
||||||
#include "ephoto.h"
|
#include "ephoto.h"
|
||||||
|
|
||||||
/*Ewl Callbacks*/
|
/*Ewl Callbacks*/
|
||||||
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);
|
||||||
static void populate(Ewl_Widget *w, void *event, void *data);
|
static void populate(Ewl_Widget *w, void *event, void *data);
|
||||||
static void window_fullscreen(Ewl_Widget *w, void *event, void *data);
|
static void window_fullscreen(Ewl_Widget *w, void *event, void *data);
|
||||||
|
|
||||||
/*Ephoto Create Callbacks*/
|
/*Ephoto Create Callbacks*/
|
||||||
static Ewl_Widget *add_atree(Ewl_Widget *c);
|
static Ewl_Widget *add_atree(Ewl_Widget *c);
|
||||||
static Ewl_Widget *add_vcombo(Ewl_Widget *c);
|
|
||||||
|
|
||||||
/*Ephoto MVC Callbacks*/
|
/*Ephoto MVC Callbacks*/
|
||||||
static Ewl_Widget *album_view_new(void);
|
static Ewl_Widget *album_view_new(void);
|
||||||
|
@ -16,9 +14,6 @@ static void album_view_assign(Ewl_Widget *w, void *data);
|
||||||
static Ewl_Widget *album_header_fetch(void *data, int column);
|
static Ewl_Widget *album_header_fetch(void *data, int column);
|
||||||
static void *album_data_fetch(void *data, unsigned int row, unsigned int column);
|
static void *album_data_fetch(void *data, unsigned int row, unsigned int column);
|
||||||
static int album_data_count(void *data);
|
static int album_data_count(void *data);
|
||||||
static Ewl_Widget *views_header_fetch(void *data, int column);
|
|
||||||
static void *views_data_fetch(void *data, unsigned int row, unsigned int column);
|
|
||||||
static int views_data_count(void *data);
|
|
||||||
|
|
||||||
/*Ephoto Global Variables*/
|
/*Ephoto Global Variables*/
|
||||||
Ephoto_Main *em;
|
Ephoto_Main *em;
|
||||||
|
@ -55,8 +50,8 @@ 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 *vbox, *spacer, *entry, *hbox;
|
Ewl_Widget *vbox, *entry, *hbox;
|
||||||
Ewl_Widget *rvbox, *hsep, *vsep, *image;
|
Ewl_Widget *rvbox, *hsep, *vsep, *button;
|
||||||
|
|
||||||
em = NULL;
|
em = NULL;
|
||||||
em = calloc(1, sizeof(Ephoto_Main));
|
em = calloc(1, sizeof(Ephoto_Main));
|
||||||
|
@ -80,14 +75,6 @@ void create_main_gui(void)
|
||||||
ewl_container_child_append(EWL_CONTAINER(vbox), em->tbar);
|
ewl_container_child_append(EWL_CONTAINER(vbox), em->tbar);
|
||||||
ewl_widget_show(em->tbar);
|
ewl_widget_show(em->tbar);
|
||||||
|
|
||||||
em->vcombo = add_vcombo(em->tbar);
|
|
||||||
|
|
||||||
spacer = ewl_spacer_new();
|
|
||||||
ewl_object_minimum_w_set(EWL_OBJECT(spacer), 100);
|
|
||||||
ewl_object_maximum_w_set(EWL_OBJECT(spacer), 100);
|
|
||||||
ewl_container_child_append(EWL_CONTAINER(em->tbar), 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);
|
||||||
|
@ -135,62 +122,34 @@ void create_main_gui(void)
|
||||||
ewl_container_child_append(EWL_CONTAINER(vbox), em->toolbar);
|
ewl_container_child_append(EWL_CONTAINER(vbox), em->toolbar);
|
||||||
ewl_widget_show(em->toolbar);
|
ewl_widget_show(em->toolbar);
|
||||||
|
|
||||||
image = add_image(em->toolbar, PACKAGE_DATA_DIR "/images/normal_view.png", 0, show_normal_view, NULL);
|
button = add_button(em->toolbar, NULL, PACKAGE_DATA_DIR "/images/normal_view.png", show_normal_view, NULL);
|
||||||
ewl_image_constrain_set(EWL_IMAGE(image), 30);
|
ewl_image_size_set(EWL_IMAGE(EWL_BUTTON(button)->image_object), 30, 30);
|
||||||
ewl_attach_tooltip_text_set(image, "Normal View");
|
ewl_attach_tooltip_text_set(button, "Normal View");
|
||||||
|
|
||||||
vsep = ewl_vseparator_new();
|
button = add_button(em->toolbar, NULL, PACKAGE_DATA_DIR "/images/list_view.png", show_list_view, NULL);
|
||||||
ewl_container_child_append(EWL_CONTAINER(em->toolbar), vsep);
|
ewl_image_size_set(EWL_IMAGE(EWL_BUTTON(button)->image_object), 30, 30);
|
||||||
ewl_widget_show(vsep);
|
ewl_attach_tooltip_text_set(button, "List View");
|
||||||
|
|
||||||
image = add_image(em->toolbar, PACKAGE_DATA_DIR "/images/list_view.png", 0, show_list_view, NULL);
|
button = add_button(em->toolbar, NULL, PACKAGE_DATA_DIR "/images/edit_view.png", show_edit_view, NULL);
|
||||||
ewl_image_constrain_set(EWL_IMAGE(image), 30);
|
ewl_image_size_set(EWL_IMAGE(EWL_BUTTON(button)->image_object), 30, 30);
|
||||||
ewl_attach_tooltip_text_set(image, "List View");
|
ewl_attach_tooltip_text_set(button, "Single View");
|
||||||
|
|
||||||
vsep = ewl_vseparator_new();
|
|
||||||
ewl_container_child_append(EWL_CONTAINER(em->toolbar), vsep);
|
|
||||||
ewl_widget_show(vsep);
|
|
||||||
|
|
||||||
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_attach_tooltip_text_set(image, "Edit View");
|
|
||||||
|
|
||||||
vsep = ewl_vseparator_new();
|
vsep = ewl_vseparator_new();
|
||||||
ewl_container_child_append(EWL_CONTAINER(em->toolbar), vsep);
|
ewl_container_child_append(EWL_CONTAINER(em->toolbar), vsep);
|
||||||
ewl_widget_show(vsep);
|
ewl_widget_show(vsep);
|
||||||
|
|
||||||
image = add_image(em->toolbar, PACKAGE_DATA_DIR "/images/get_exif.png", 0, display_exif_dialog, NULL);
|
button = add_button(em->toolbar, NULL, PACKAGE_DATA_DIR "/images/get_exif.png", display_exif_dialog, NULL);
|
||||||
ewl_image_constrain_set(EWL_IMAGE(image), 30);
|
ewl_image_size_set(EWL_IMAGE(EWL_BUTTON(button)->image_object), 30, 30);
|
||||||
ewl_attach_tooltip_text_set(image, "View Exif");
|
ewl_attach_tooltip_text_set(button, "View Exif Data");
|
||||||
|
|
||||||
vsep = ewl_vseparator_new();
|
button = add_button(em->toolbar, NULL, PACKAGE_DATA_DIR "/images/stock_fullscreen.png", window_fullscreen, NULL);
|
||||||
ewl_container_child_append(EWL_CONTAINER(em->toolbar), vsep);
|
ewl_image_size_set(EWL_IMAGE(EWL_BUTTON(button)->image_object), 30, 30);
|
||||||
ewl_widget_show(vsep);
|
ewl_attach_tooltip_text_set(button, "Toggle Fullscreen");
|
||||||
|
|
||||||
image = add_image(em->toolbar, PACKAGE_DATA_DIR "/images/stock_fullscreen.png", 0, window_fullscreen, NULL);
|
button = add_button(em->toolbar, NULL, PACKAGE_DATA_DIR "/images/x-office-presentation.png", NULL, NULL);
|
||||||
ewl_image_constrain_set(EWL_IMAGE(image), 30);
|
ewl_image_size_set(EWL_IMAGE(EWL_BUTTON(button)->image_object), 30, 30);
|
||||||
ewl_attach_tooltip_text_set(image, "Fullscreen");
|
ewl_attach_tooltip_text_set(button, "Start a Slideshow");
|
||||||
|
|
||||||
vsep = ewl_vseparator_new();
|
|
||||||
ewl_container_child_append(EWL_CONTAINER(em->toolbar), vsep);
|
|
||||||
ewl_widget_show(vsep);
|
|
||||||
|
|
||||||
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_attach_tooltip_text_set(image, "Slideshow");
|
|
||||||
|
|
||||||
vsep = ewl_vseparator_new();
|
|
||||||
ewl_container_child_append(EWL_CONTAINER(em->toolbar), vsep);
|
|
||||||
ewl_widget_show(vsep);
|
|
||||||
|
|
||||||
em->edit_tools = ewl_hbox_new();
|
|
||||||
ewl_object_fill_policy_set(EWL_OBJECT(em->edit_tools), EWL_FLAG_FILL_HFILL);
|
|
||||||
ewl_container_child_append(EWL_CONTAINER(em->toolbar), em->edit_tools);
|
|
||||||
ewl_widget_show(em->edit_tools);
|
|
||||||
|
|
||||||
add_edit_tools(em->edit_tools);
|
|
||||||
ewl_widget_disable(em->edit_tools);
|
|
||||||
|
|
||||||
em->albums = ecore_list_new();
|
em->albums = ecore_list_new();
|
||||||
em->db = ephoto_db_init();
|
em->db = ephoto_db_init();
|
||||||
em->albums = ephoto_db_list_albums(em->db);
|
em->albums = ephoto_db_list_albums(em->db);
|
||||||
|
@ -259,87 +218,6 @@ static void populate(Ewl_Widget *w, void *event, void *data)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*Create the view combo*/
|
|
||||||
static Ewl_Widget *add_vcombo(Ewl_Widget *c)
|
|
||||||
{
|
|
||||||
Ewl_Widget *combo;
|
|
||||||
Ewl_Model *model;
|
|
||||||
Ewl_View *view;
|
|
||||||
|
|
||||||
em->views = calloc(3, sizeof(char *));
|
|
||||||
em->views[0] = strdup("Normal");
|
|
||||||
em->views[1] = strdup("List");
|
|
||||||
em->views[2] = strdup("Edit");
|
|
||||||
|
|
||||||
model = ewl_model_new();
|
|
||||||
ewl_model_fetch_set(model, views_data_fetch);
|
|
||||||
ewl_model_count_set(model, views_data_count);
|
|
||||||
|
|
||||||
view = ewl_view_new();
|
|
||||||
ewl_view_constructor_set(view, ewl_label_new);
|
|
||||||
ewl_view_assign_set(view, EWL_VIEW_ASSIGN(ewl_label_text_set));
|
|
||||||
ewl_view_header_fetch_set(view, views_header_fetch);
|
|
||||||
|
|
||||||
combo = ewl_combo_new();
|
|
||||||
ewl_mvc_model_set(EWL_MVC(combo), model);
|
|
||||||
ewl_mvc_view_set(EWL_MVC(combo), view);
|
|
||||||
ewl_mvc_data_set(EWL_MVC(combo), em->views);
|
|
||||||
ewl_object_fill_policy_set(EWL_OBJECT(combo), EWL_FLAG_FILL_SHRINK);
|
|
||||||
ewl_container_child_append(EWL_CONTAINER(c), combo);
|
|
||||||
ewl_callback_append(combo, EWL_CALLBACK_VALUE_CHANGED, combo_changed, NULL);
|
|
||||||
ewl_widget_show(combo);
|
|
||||||
|
|
||||||
return combo;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*Create a header for the view combo*/
|
|
||||||
static Ewl_Widget *views_header_fetch(void *data, int col)
|
|
||||||
{
|
|
||||||
Ewl_Widget *header;
|
|
||||||
|
|
||||||
header = ewl_label_new();
|
|
||||||
ewl_label_text_set(EWL_LABEL(header), "Select a View");
|
|
||||||
ewl_widget_show(header);
|
|
||||||
|
|
||||||
return header;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*Get the data for the view combo*/
|
|
||||||
static void *views_data_fetch(void *data, unsigned int row, unsigned int col)
|
|
||||||
{
|
|
||||||
if (row < 3) return em->views[row];
|
|
||||||
else return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*Show the number of items in the view*/
|
|
||||||
static int views_data_count(void *data)
|
|
||||||
{
|
|
||||||
return 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*Switch between views when the combo changes*/
|
|
||||||
static void combo_changed(Ewl_Widget *w, void *event, void *data)
|
|
||||||
{
|
|
||||||
Ewl_Selection_Idx *idx;
|
|
||||||
|
|
||||||
idx = ewl_mvc_selected_get(EWL_MVC(w));
|
|
||||||
|
|
||||||
if (!strcmp(em->views[idx->row], "Normal"))
|
|
||||||
{
|
|
||||||
show_normal_view(NULL, NULL, NULL);
|
|
||||||
}
|
|
||||||
else if (!strcmp(em->views[idx->row], "Edit"))
|
|
||||||
{
|
|
||||||
show_edit_view(NULL, NULL, NULL);
|
|
||||||
}
|
|
||||||
else if (!strcmp(em->views[idx->row], "List"))
|
|
||||||
{
|
|
||||||
show_list_view(NULL, NULL, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*Create and Add a Tree to the Container c*/
|
/*Create and Add a Tree to the Container c*/
|
||||||
static Ewl_Widget *add_atree(Ewl_Widget *c)
|
static Ewl_Widget *add_atree(Ewl_Widget *c)
|
||||||
{
|
{
|
||||||
|
|
|
@ -32,9 +32,6 @@ Ewl_Widget *add_normal_view(Ewl_Widget *c)
|
||||||
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(em->view_box), em->fbox_vbox);
|
ewl_notebook_visible_page_set(EWL_NOTEBOOK(em->view_box), em->fbox_vbox);
|
||||||
ewl_widget_disable(em->edit_tools);
|
|
||||||
ewl_widget_show(em->atree);
|
|
||||||
ewl_widget_show(em->tbar);
|
|
||||||
ewl_widget_show(em->ilabel);
|
ewl_widget_show(em->ilabel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue