Work on a config dialog.
This commit is contained in:
parent
6e25d613d3
commit
1a603cbd3a
@ -92,6 +92,7 @@ dnl Make gstreamer an optional dependancy at some point
|
|||||||
PKG_CHECK_MODULES(ECDB, [
|
PKG_CHECK_MODULES(ECDB, [
|
||||||
ecore-file
|
ecore-file
|
||||||
ecore-evas
|
ecore-evas
|
||||||
|
ecore-config
|
||||||
ecore
|
ecore
|
||||||
eina-0
|
eina-0
|
||||||
evas
|
evas
|
||||||
|
@ -18,6 +18,7 @@ ecdb_SOURCES = \
|
|||||||
ecdb_burn_data_gui.c ecdb_burn_data_gui.h \
|
ecdb_burn_data_gui.c ecdb_burn_data_gui.h \
|
||||||
ecdb_filelist_custom.c ecdb_filelist_custom.h \
|
ecdb_filelist_custom.c ecdb_filelist_custom.h \
|
||||||
ecdb_about.c ecdb_about.h \
|
ecdb_about.c ecdb_about.h \
|
||||||
|
ecdb_config_dialog.c ecdb_config_dialog.h \
|
||||||
ecdb_common.h
|
ecdb_common.h
|
||||||
|
|
||||||
ecdb_CFLAGS = @ECDB_CFLAGS@
|
ecdb_CFLAGS = @ECDB_CFLAGS@
|
||||||
|
@ -9,6 +9,7 @@ int ECDB_FILELIST_SIZE_CHANGED = 0;
|
|||||||
|
|
||||||
Ecdb_Main *em;
|
Ecdb_Main *em;
|
||||||
int ecdb_setup();
|
int ecdb_setup();
|
||||||
|
int ecdb_initialize_config();
|
||||||
|
|
||||||
int
|
int
|
||||||
main(int argc, char **argv)
|
main(int argc, char **argv)
|
||||||
@ -28,16 +29,16 @@ main(int argc, char **argv)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ecore_string_init())
|
if (!ecore_file_init())
|
||||||
{
|
{
|
||||||
printf("Cannot initialize Ecore_String!\n");
|
printf("Cannot initialize Ecore_File!\n");
|
||||||
ret = 1;
|
ret = 1;
|
||||||
goto SHUTDOWN;
|
goto SHUTDOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ecore_file_init())
|
if (ecore_config_init("ecdb") != ECORE_CONFIG_ERR_SUCC)
|
||||||
{
|
{
|
||||||
printf("Cannot initialize Ecore_File!\n");
|
printf("Cannot intialize Ecore_Config!\n");
|
||||||
ret = 1;
|
ret = 1;
|
||||||
goto SHUTDOWN;
|
goto SHUTDOWN;
|
||||||
}
|
}
|
||||||
@ -143,7 +144,7 @@ main(int argc, char **argv)
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ewl_main();
|
ecore_main_loop_begin();
|
||||||
|
|
||||||
/* End testing */
|
/* End testing */
|
||||||
|
|
||||||
@ -152,7 +153,7 @@ SHUTDOWN:
|
|||||||
iso_finish();
|
iso_finish();
|
||||||
ewl_shutdown();
|
ewl_shutdown();
|
||||||
ecore_file_shutdown();
|
ecore_file_shutdown();
|
||||||
ecore_string_shutdown();
|
ecore_config_shutdown();
|
||||||
ecore_evas_shutdown();
|
ecore_evas_shutdown();
|
||||||
edje_shutdown();
|
edje_shutdown();
|
||||||
ecore_shutdown();
|
ecore_shutdown();
|
||||||
@ -191,7 +192,97 @@ ecdb_setup(void)
|
|||||||
printf("Aquiring drives failed!\n");
|
printf("Aquiring drives failed!\n");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!ecdb_initialize_config())
|
||||||
|
{
|
||||||
|
printf("Initializing the configuration failed!\n");
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
ecdb_initialize_config(void)
|
||||||
|
{
|
||||||
|
char *gui, *engine, *tmp_eng;
|
||||||
|
Eina_List *l;
|
||||||
|
|
||||||
|
// Theme
|
||||||
|
ecore_config_theme_default("theme", "default");
|
||||||
|
ecore_config_describe("theme", "The name of the theme to use.");
|
||||||
|
ecore_config_long_opt_set("theme", "The name of the theme to use.");
|
||||||
|
ecore_config_short_opt_set("theme", 't');
|
||||||
|
|
||||||
|
// Frame rate
|
||||||
|
ecore_config_int_default("frame_rate", 60);
|
||||||
|
ecore_config_describe("frame_rate", "The frame rate of the GUI.");
|
||||||
|
ecore_config_long_opt_set("frame_rate", "The frame rate of the GUI.");
|
||||||
|
ecore_config_short_opt_set("frame_rate", 'r');
|
||||||
|
|
||||||
|
// Scale
|
||||||
|
ecore_config_float_default("scale", 1.0);
|
||||||
|
ecore_config_describe("scale", "The scaling factor.");
|
||||||
|
ecore_config_long_opt_set("scale", "The scaling factor.");
|
||||||
|
ecore_config_short_opt_set("scale", 's');
|
||||||
|
|
||||||
|
// Engine
|
||||||
|
ecore_config_string_default("engine", "software_x11");
|
||||||
|
ecore_config_describe("engine", "The canvas engine.");
|
||||||
|
ecore_config_long_opt_set("engine", "The canvas engine.");
|
||||||
|
ecore_config_short_opt_set("engine", 'e');
|
||||||
|
|
||||||
|
// Load the config
|
||||||
|
ecore_config_load();
|
||||||
|
|
||||||
|
// Set up the theme path
|
||||||
|
ecore_config_theme_search_path_append(PACKAGE_DATA_DIR"/themes");
|
||||||
|
printf("Theme search path: %s\n", ecore_config_theme_search_path_get());
|
||||||
|
|
||||||
|
gui = ecore_config_theme_with_path_get("theme");
|
||||||
|
if ((!gui) || (!ecore_file_exists(gui)) || (!edje_file_group_exists(gui,
|
||||||
|
"ecdb/window")))
|
||||||
|
{
|
||||||
|
printf("Invalid file specified, attempting to fall back to default!\n");
|
||||||
|
gui = ecore_config_theme_with_path_from_name_get("default");
|
||||||
|
|
||||||
|
if (!gui)
|
||||||
|
{
|
||||||
|
printf("Default theme is missing! Please check your installation.\n");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
em->theme_path = gui;
|
||||||
|
|
||||||
|
// Set up the engines
|
||||||
|
engine = ecore_config_string_get("engine");
|
||||||
|
l = ecore_evas_engines_get();
|
||||||
|
if (!eina_list_count(l))
|
||||||
|
{
|
||||||
|
printf("There are no built engines!\n");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
EINA_LIST_FOREACH(l, l, tmp_eng)
|
||||||
|
{
|
||||||
|
if (!strcmp(tmp_eng, engine))
|
||||||
|
{
|
||||||
|
em->engine = engine;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Default to last in the list
|
||||||
|
if (!em->engine)
|
||||||
|
em->engine = strdup((char *)eina_list_last(l));
|
||||||
|
|
||||||
|
ecore_evas_engines_free(l);
|
||||||
|
|
||||||
|
// Initialize the other variables
|
||||||
|
em->scalef = ecore_config_float_get("scale");
|
||||||
|
em->fps = ecore_config_int_get("frame_rate");
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
#include <Ecore_Data.h>
|
#include <Ecore_Data.h>
|
||||||
#include <Ecore_File.h>
|
#include <Ecore_File.h>
|
||||||
#include <Ecore_Evas.h>
|
#include <Ecore_Evas.h>
|
||||||
#include <Ecore_Str.h>
|
#include <Ecore_Config.h>
|
||||||
#include <Ecore_X.h>
|
#include <Ecore_X.h>
|
||||||
#include <Eina.h>
|
#include <Eina.h>
|
||||||
#include <Efreet_Mime.h>
|
#include <Efreet_Mime.h>
|
||||||
@ -45,8 +45,12 @@ struct _Ecdb_Page
|
|||||||
typedef struct _Ecdb_Main Ecdb_Main;
|
typedef struct _Ecdb_Main Ecdb_Main;
|
||||||
struct _Ecdb_Main
|
struct _Ecdb_Main
|
||||||
{
|
{
|
||||||
char theme_path[PATH_MAX];
|
char *theme_path;
|
||||||
|
double scalef;
|
||||||
|
char *engine;
|
||||||
|
int fps;
|
||||||
Ecore_Evas *main_win_ee;
|
Ecore_Evas *main_win_ee;
|
||||||
|
Ecore_X_Window xwin;
|
||||||
Eina_List *drives;
|
Eina_List *drives;
|
||||||
|
|
||||||
/* Drag and drop stuff here */
|
/* Drag and drop stuff here */
|
||||||
@ -59,7 +63,6 @@ struct _Ecdb_Main
|
|||||||
* and leave it singular
|
* and leave it singular
|
||||||
*/
|
*/
|
||||||
Ecdb_Page *page;
|
Ecdb_Page *page;
|
||||||
double scalef;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
extern Ecdb_Main *em;
|
extern Ecdb_Main *em;
|
||||||
@ -85,6 +88,7 @@ extern int ECDB_FILELIST_SIZE_CHANGED;
|
|||||||
#include "ecdb_burn_data_gui.h"
|
#include "ecdb_burn_data_gui.h"
|
||||||
#include "ecdb_filelist_custom.h"
|
#include "ecdb_filelist_custom.h"
|
||||||
#include "ecdb_about.h"
|
#include "ecdb_about.h"
|
||||||
|
#include "ecdb_config_dialog.h"
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
/* vim: set sw=3 ts=3 sts=3 expandtab: */
|
/* vim: set sw=3 ts=3 sts=3 expandtab: */
|
||||||
#include "ecdb.h"
|
#include "ecdb.h"
|
||||||
|
|
||||||
|
static Ecore_Evas *win = NULL;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_ecdb_about_destroy(void *data, Evas_Object *obj __UNUSED__,
|
_ecdb_about_destroy(void *data, Evas_Object *obj __UNUSED__,
|
||||||
const char *emission __UNUSED__,
|
const char *emission __UNUSED__,
|
||||||
@ -9,28 +11,29 @@ _ecdb_about_destroy(void *data, Evas_Object *obj __UNUSED__,
|
|||||||
ecore_evas_free(data);
|
ecore_evas_free(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_ecdb_about_free(void *data __UNUSED__, Evas *e __UNUSED__,
|
||||||
|
Evas_Object *obj __UNUSED__,
|
||||||
|
void *ev_info __UNUSED__)
|
||||||
|
{
|
||||||
|
win = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ecdb_about_show(void)
|
ecdb_about_show(void)
|
||||||
{
|
{
|
||||||
Evas_Coord mw, mh;
|
Evas_Coord mw, mh, w, x, y;
|
||||||
Ecore_Evas *win = NULL;
|
|
||||||
Evas_Object *gui;
|
Evas_Object *gui;
|
||||||
const char *engine;
|
|
||||||
|
|
||||||
engine = getenv("ECDB_ENGINE");
|
// Only show 1 about window
|
||||||
if (engine)
|
if (win) return;
|
||||||
{
|
|
||||||
if (!strcmp(engine, "gl"))
|
if (!strcmp(em->engine, "opengl_x11"))
|
||||||
win = ecore_evas_gl_x11_new(0, 0, 0, 0, 255, 255);
|
win = ecore_evas_gl_x11_new(0, 0, 0, 0, 255, 255);
|
||||||
else if (!strcmp(engine, "xr"))
|
else if (!strcmp(em->engine, "xrender_x11"))
|
||||||
win = ecore_evas_xrender_x11_new(0, 0, 0, 0, 255, 255);
|
win = ecore_evas_xrender_x11_new(0, 0, 0, 0, 255, 255);
|
||||||
else if (!strcmp(engine, "x11"))
|
else if (!strcmp(em->engine, "software_x11"))
|
||||||
win = ecore_evas_software_x11_new(0, 0, 0, 0, 255, 255);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
win = ecore_evas_software_x11_new(0, 0, 0, 0, 255, 255);
|
win = ecore_evas_software_x11_new(0, 0, 0, 0, 255, 255);
|
||||||
}
|
|
||||||
|
|
||||||
if (!win)
|
if (!win)
|
||||||
{
|
{
|
||||||
@ -46,6 +49,8 @@ ecdb_about_show(void)
|
|||||||
edje_object_file_set(gui, em->theme_path, "ecdb/about");
|
edje_object_file_set(gui, em->theme_path, "ecdb/about");
|
||||||
edje_object_signal_callback_add(gui, "ecdb/close", "ecdb",
|
edje_object_signal_callback_add(gui, "ecdb/close", "ecdb",
|
||||||
_ecdb_about_destroy, win);
|
_ecdb_about_destroy, win);
|
||||||
|
evas_object_event_callback_add(gui, EVAS_CALLBACK_FREE, _ecdb_about_free,
|
||||||
|
NULL);
|
||||||
ecore_evas_object_associate(win, gui, ECORE_EVAS_OBJECT_ASSOCIATE_DEL);
|
ecore_evas_object_associate(win, gui, ECORE_EVAS_OBJECT_ASSOCIATE_DEL);
|
||||||
edje_object_size_min_get(gui, &mw, &mh);
|
edje_object_size_min_get(gui, &mw, &mh);
|
||||||
if (mw <= 0) mw = 350;
|
if (mw <= 0) mw = 350;
|
||||||
@ -60,6 +65,9 @@ ecdb_about_show(void)
|
|||||||
evas_object_show(gui);
|
evas_object_show(gui);
|
||||||
ecore_evas_show(win);
|
ecore_evas_show(win);
|
||||||
|
|
||||||
|
ecore_evas_geometry_get(em->main_win_ee, &x, &y, &w, NULL);
|
||||||
|
ecore_evas_move(win, x + ((w - mw) / 2), y);
|
||||||
|
|
||||||
/* Set the proper text */
|
/* Set the proper text */
|
||||||
edje_object_part_text_set(gui, "ecdb.about.label", "Close");
|
edje_object_part_text_set(gui, "ecdb.about.label", "Close");
|
||||||
edje_object_part_text_set(gui, "ecdb.about.text",
|
edje_object_part_text_set(gui, "ecdb.about.text",
|
||||||
|
319
ecdb/trunk/src/ecdb_config_dialog.c
Normal file
319
ecdb/trunk/src/ecdb_config_dialog.c
Normal file
@ -0,0 +1,319 @@
|
|||||||
|
/* vim: set sw=3 ts=3 sts=3 expandtab: */
|
||||||
|
#include "ecdb.h"
|
||||||
|
|
||||||
|
typedef struct Config_Data Config_Data;
|
||||||
|
struct Config_Data
|
||||||
|
{
|
||||||
|
char ** array;
|
||||||
|
unsigned int count;
|
||||||
|
};
|
||||||
|
|
||||||
|
static void destroy_cb(Ewl_Widget *w, void *event, void *data);
|
||||||
|
static void conf_clicked_cb(Ewl_Widget *w, void *event, void *data);
|
||||||
|
static void scale_cb(Ewl_Widget *w, void *event, void *data);
|
||||||
|
static void fps_cb(Ewl_Widget *w, void *event, void *data);
|
||||||
|
static void engine_cb(Ewl_Widget *w, void *event, void *data);
|
||||||
|
static void theme_cb(Ewl_Widget *w, void *event, void *data);
|
||||||
|
static Config_Data *theme_data_init(void);
|
||||||
|
static Config_Data *engine_data_init(void);
|
||||||
|
static int theme_data_return_active(Config_Data *data);
|
||||||
|
static int engine_data_return_active(Config_Data *data);
|
||||||
|
static unsigned int model_data_count(void *data);
|
||||||
|
static void *model_data_fetch(void *data, unsigned int row, unsigned int col);
|
||||||
|
|
||||||
|
static Ewl_Widget *conf_win = NULL;
|
||||||
|
|
||||||
|
void
|
||||||
|
ecdb_config_dialog_show(void)
|
||||||
|
{
|
||||||
|
Ewl_Widget *o, *l;
|
||||||
|
Ewl_Widget *border_box, *hbox, *main_box;
|
||||||
|
Ewl_Widget *combo;
|
||||||
|
Ewl_Model *model;
|
||||||
|
Ewl_View *view;
|
||||||
|
Config_Data *data;
|
||||||
|
|
||||||
|
/* Only show one config window */
|
||||||
|
if (conf_win)
|
||||||
|
return;
|
||||||
|
|
||||||
|
conf_win = ewl_dialog_new();
|
||||||
|
ewl_dialog_action_position_set(EWL_DIALOG(conf_win), EWL_POSITION_BOTTOM);
|
||||||
|
ewl_window_title_set(EWL_WINDOW(conf_win), "ECDB Configuration");
|
||||||
|
ewl_window_name_set(EWL_WINDOW(conf_win), "ECDB");
|
||||||
|
ewl_window_class_set(EWL_WINDOW(conf_win), "ECDB");
|
||||||
|
ewl_window_leader_foreign_set(EWL_WINDOW(conf_win),
|
||||||
|
EWL_EMBED_WINDOW(em->xwin));
|
||||||
|
ewl_callback_append(conf_win, EWL_CALLBACK_DELETE_WINDOW, destroy_cb, NULL);
|
||||||
|
ewl_dialog_has_separator_set(EWL_DIALOG(conf_win), 1);
|
||||||
|
ewl_object_fill_policy_set(EWL_OBJECT(conf_win), EWL_FLAG_FILL_NONE);
|
||||||
|
ewl_widget_show(conf_win);
|
||||||
|
|
||||||
|
/* the main_box contain the border_boxes */
|
||||||
|
ewl_dialog_active_area_set(EWL_DIALOG(conf_win), EWL_POSITION_TOP);
|
||||||
|
main_box = ewl_vbox_new();
|
||||||
|
ewl_container_child_append(EWL_CONTAINER(conf_win), main_box);
|
||||||
|
ewl_object_fill_policy_set(EWL_OBJECT(main_box), EWL_FLAG_ALIGN_CENTER);
|
||||||
|
ewl_widget_show(main_box);
|
||||||
|
|
||||||
|
/* Setup and show the stock icons */
|
||||||
|
ewl_dialog_active_area_set(EWL_DIALOG(conf_win), EWL_POSITION_BOTTOM);
|
||||||
|
|
||||||
|
o = ewl_button_new();
|
||||||
|
ewl_stock_type_set(EWL_STOCK(o), EWL_STOCK_CANCEL);
|
||||||
|
ewl_container_child_append(EWL_CONTAINER(conf_win), o);
|
||||||
|
ewl_callback_append(o, EWL_CALLBACK_CLICKED, conf_clicked_cb, conf_win);
|
||||||
|
ewl_widget_show(o);
|
||||||
|
|
||||||
|
o = ewl_button_new();
|
||||||
|
ewl_stock_type_set(EWL_STOCK(o), EWL_STOCK_APPLY);
|
||||||
|
ewl_container_child_append(EWL_CONTAINER(conf_win), o);
|
||||||
|
ewl_callback_append(o, EWL_CALLBACK_CLICKED, conf_clicked_cb, conf_win);
|
||||||
|
ewl_widget_show(o);
|
||||||
|
|
||||||
|
o = ewl_button_new();
|
||||||
|
ewl_stock_type_set(EWL_STOCK(o), EWL_STOCK_OK);
|
||||||
|
ewl_container_child_append(EWL_CONTAINER(conf_win), o);
|
||||||
|
ewl_callback_append(o, EWL_CALLBACK_CLICKED, conf_clicked_cb, conf_win);
|
||||||
|
ewl_widget_show(o);
|
||||||
|
|
||||||
|
/* Graphics */
|
||||||
|
border_box = ewl_border_new();
|
||||||
|
ewl_border_label_set(EWL_BORDER(border_box), "Graphics");
|
||||||
|
ewl_container_child_append(EWL_CONTAINER(main_box), border_box);
|
||||||
|
ewl_widget_show(border_box);
|
||||||
|
|
||||||
|
/* Scale */
|
||||||
|
hbox = ewl_grid_new();
|
||||||
|
ewl_container_child_append(EWL_CONTAINER(border_box), hbox);
|
||||||
|
ewl_object_fill_policy_set(EWL_OBJECT(hbox), EWL_FLAG_FILL_FILL);
|
||||||
|
ewl_grid_column_preferred_w_use(EWL_GRID(hbox), 1);
|
||||||
|
ewl_widget_show(hbox);
|
||||||
|
|
||||||
|
o = ewl_label_new();
|
||||||
|
ewl_label_text_set(EWL_LABEL(o), "Scale Factor:");
|
||||||
|
ewl_container_child_append(EWL_CONTAINER(hbox), o);
|
||||||
|
ewl_object_fill_policy_set(EWL_OBJECT(o), EWL_FLAG_FILL_NONE);
|
||||||
|
ewl_object_alignment_set(EWL_OBJECT(o), EWL_FLAG_ALIGN_LEFT);
|
||||||
|
ewl_widget_show(o);
|
||||||
|
|
||||||
|
l = ewl_label_new();
|
||||||
|
ewl_container_child_append(EWL_CONTAINER(hbox), l);
|
||||||
|
ewl_object_fill_policy_set(EWL_OBJECT(l), EWL_FLAG_FILL_NONE);
|
||||||
|
ewl_widget_show(l);
|
||||||
|
|
||||||
|
o = ewl_hseeker_new();
|
||||||
|
ewl_range_minimum_value_set(EWL_RANGE(o), 0.0);
|
||||||
|
ewl_range_maximum_value_set(EWL_RANGE(o), 2.0);
|
||||||
|
ewl_range_step_set(EWL_RANGE(o), 0.1);
|
||||||
|
ewl_range_value_set(EWL_RANGE(o), em->scalef);
|
||||||
|
ewl_container_child_append(EWL_CONTAINER(border_box), o);
|
||||||
|
ewl_callback_append(o, EWL_CALLBACK_VALUE_CHANGED, scale_cb, l);
|
||||||
|
scale_cb(o, NULL, NULL);
|
||||||
|
ewl_widget_show(o);
|
||||||
|
|
||||||
|
/* FPS */
|
||||||
|
hbox = ewl_grid_new();
|
||||||
|
ewl_container_child_append(EWL_CONTAINER(border_box), hbox);
|
||||||
|
ewl_object_fill_policy_set(EWL_OBJECT(hbox), EWL_FLAG_FILL_FILL);
|
||||||
|
ewl_grid_column_preferred_w_use(EWL_GRID(hbox), 1);
|
||||||
|
ewl_widget_show(hbox);
|
||||||
|
|
||||||
|
o = ewl_label_new();
|
||||||
|
ewl_label_text_set(EWL_LABEL(o), "Frame Rate:");
|
||||||
|
ewl_container_child_append(EWL_CONTAINER(hbox), o);
|
||||||
|
ewl_object_fill_policy_set(EWL_OBJECT(o), EWL_FLAG_FILL_NONE);
|
||||||
|
ewl_object_alignment_set(EWL_OBJECT(o), EWL_FLAG_ALIGN_LEFT);
|
||||||
|
ewl_widget_show(o);
|
||||||
|
|
||||||
|
l = ewl_label_new();
|
||||||
|
ewl_container_child_append(EWL_CONTAINER(hbox), l);
|
||||||
|
ewl_object_fill_policy_set(EWL_OBJECT(l), EWL_FLAG_FILL_NONE);
|
||||||
|
ewl_widget_show(l);
|
||||||
|
|
||||||
|
o = ewl_hseeker_new();
|
||||||
|
ewl_range_minimum_value_set(EWL_RANGE(o), 10.0);
|
||||||
|
ewl_range_maximum_value_set(EWL_RANGE(o), 100.0);
|
||||||
|
ewl_range_step_set(EWL_RANGE(o), 5.0);
|
||||||
|
ewl_range_value_set(EWL_RANGE(o), em->fps);
|
||||||
|
ewl_container_child_append(EWL_CONTAINER(border_box), o);
|
||||||
|
ewl_callback_append(o, EWL_CALLBACK_VALUE_CHANGED, fps_cb, l);
|
||||||
|
fps_cb(o, NULL, NULL);
|
||||||
|
ewl_widget_show(o);
|
||||||
|
|
||||||
|
/* Setup and show the border box */
|
||||||
|
border_box = ewl_border_new();
|
||||||
|
ewl_border_label_set(EWL_BORDER(border_box), "Rendering Engine");
|
||||||
|
ewl_container_child_append(EWL_CONTAINER(main_box), border_box);
|
||||||
|
ewl_object_fill_policy_set(EWL_OBJECT(border_box), EWL_FLAG_FILL_FILL);
|
||||||
|
ewl_object_alignment_set(EWL_OBJECT(border_box), EWL_FLAG_ALIGN_CENTER);
|
||||||
|
ewl_object_alignment_set(EWL_OBJECT(main_box), EWL_FLAG_ALIGN_TOP);
|
||||||
|
ewl_widget_show(border_box);
|
||||||
|
|
||||||
|
model = ewl_model_new();
|
||||||
|
ewl_model_data_fetch_set(model, model_data_fetch);
|
||||||
|
ewl_model_data_count_set(model, model_data_count);
|
||||||
|
|
||||||
|
view = ewl_label_view_get();
|
||||||
|
|
||||||
|
data = engine_data_init();
|
||||||
|
|
||||||
|
combo = ewl_combo_new();
|
||||||
|
ewl_container_child_append(EWL_CONTAINER(border_box), combo);
|
||||||
|
ewl_callback_append(combo, EWL_CALLBACK_VALUE_CHANGED, engine_cb, NULL);
|
||||||
|
ewl_mvc_model_set(EWL_MVC(combo), model);
|
||||||
|
ewl_mvc_view_set(EWL_MVC(combo), view);
|
||||||
|
ewl_mvc_data_set(EWL_MVC(combo), data);
|
||||||
|
ewl_mvc_selected_set(EWL_MVC(combo), model, data,
|
||||||
|
engine_data_return_active(data), 0);
|
||||||
|
ewl_widget_show(combo);
|
||||||
|
|
||||||
|
/* Setup and show the border box */
|
||||||
|
border_box = ewl_border_new();
|
||||||
|
ewl_border_label_set(EWL_BORDER(border_box), "Theme");
|
||||||
|
ewl_container_child_append(EWL_CONTAINER(main_box), border_box);
|
||||||
|
ewl_object_fill_policy_set(EWL_OBJECT(border_box), EWL_FLAG_FILL_FILL);
|
||||||
|
ewl_object_alignment_set(EWL_OBJECT(border_box), EWL_FLAG_ALIGN_CENTER);
|
||||||
|
ewl_object_alignment_set(EWL_OBJECT(main_box), EWL_FLAG_ALIGN_TOP);
|
||||||
|
ewl_widget_show(border_box);
|
||||||
|
|
||||||
|
data = theme_data_init();
|
||||||
|
|
||||||
|
combo = ewl_combo_new();
|
||||||
|
ewl_container_child_append(EWL_CONTAINER(border_box), combo);
|
||||||
|
ewl_callback_append(combo, EWL_CALLBACK_VALUE_CHANGED, theme_cb, NULL);
|
||||||
|
ewl_mvc_model_set(EWL_MVC(combo), model);
|
||||||
|
ewl_mvc_view_set(EWL_MVC(combo), view);
|
||||||
|
ewl_mvc_data_set(EWL_MVC(combo), data);
|
||||||
|
ewl_mvc_selected_set(EWL_MVC(combo), model, data,
|
||||||
|
theme_data_return_active(data), 0);
|
||||||
|
ewl_widget_show(combo);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
destroy_cb(Ewl_Widget *w, void *event __UNUSED__, void *data __UNUSED__)
|
||||||
|
{
|
||||||
|
ewl_widget_destroy(w);
|
||||||
|
conf_win = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
conf_clicked_cb(Ewl_Widget *w, void *event __UNUSED__, void *data)
|
||||||
|
{
|
||||||
|
Ewl_Stock_Type response;
|
||||||
|
|
||||||
|
response = ewl_stock_type_get(EWL_STOCK(w));
|
||||||
|
|
||||||
|
if ((response == EWL_STOCK_OK) || (response == EWL_STOCK_APPLY))
|
||||||
|
{
|
||||||
|
if (ecore_config_save() != ECORE_CONFIG_ERR_SUCC)
|
||||||
|
printf("Failure to save configuration!\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((response == EWL_STOCK_OK) || (response == EWL_STOCK_CANCEL))
|
||||||
|
{
|
||||||
|
ewl_widget_destroy(EWL_WIDGET(data));
|
||||||
|
conf_win = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
scale_cb(Ewl_Widget *w, void *event __UNUSED__, void *data)
|
||||||
|
{
|
||||||
|
double value;
|
||||||
|
char buffer[10];
|
||||||
|
|
||||||
|
value = ewl_range_value_get(EWL_RANGE(w));
|
||||||
|
ecore_config_float_set("scale", value);
|
||||||
|
snprintf(buffer, 10, "%f", value);
|
||||||
|
ewl_label_text_set(EWL_LABEL(data), buffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
fps_cb(Ewl_Widget *w, void *event __UNUSED__, void *data)
|
||||||
|
{
|
||||||
|
double value;
|
||||||
|
char buffer[10];
|
||||||
|
|
||||||
|
value = ewl_range_value_get(EWL_RANGE(w));
|
||||||
|
ecore_config_int_set("frame_rate", value);
|
||||||
|
snprintf(buffer, 10, "%f", value);
|
||||||
|
ewl_label_text_set(EWL_LABEL(data), buffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
engine_cb(Ewl_Widget *w, void *event __UNUSED__, void *data)
|
||||||
|
{
|
||||||
|
Config_Data *d;
|
||||||
|
Ewl_Selection_Idx *idx;
|
||||||
|
|
||||||
|
d = ewl_mvc_data_get(EWL_MVC(w));
|
||||||
|
idx = ewl_mvc_selected_get(EWL_MVC(w));
|
||||||
|
free(em->engine);
|
||||||
|
|
||||||
|
ecore_config_string_set("engine", d->array[idx->row]);
|
||||||
|
em->engine = strdup(d->array[idx->row]);
|
||||||
|
free(idx);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
theme_cb(Ewl_Widget *w, void *event __UNUSED__, void *data)
|
||||||
|
{
|
||||||
|
Config_Data *d;
|
||||||
|
Ewl_Selection_Idx *idx;
|
||||||
|
|
||||||
|
d = ewl_mvc_data_get(EWL_MVC(w));
|
||||||
|
idx = ewl_mvc_selected_get(EWL_MVC(w));
|
||||||
|
free(em->theme_path);
|
||||||
|
|
||||||
|
ecore_config_theme_set("theme", d->array[idx->row]);
|
||||||
|
em->theme_path = ecore_config_theme_with_path_get("theme");
|
||||||
|
free(idx);
|
||||||
|
}
|
||||||
|
|
||||||
|
static Config_Data *
|
||||||
|
theme_data_init(void)
|
||||||
|
{
|
||||||
|
Config_Data *ret;
|
||||||
|
|
||||||
|
ret = malloc(sizeof(Config_Data));
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
theme_data_return_active(Config_Data *data)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static Config_Data *
|
||||||
|
engine_data_init(void)
|
||||||
|
{
|
||||||
|
Config_Data *ret;
|
||||||
|
|
||||||
|
ret = malloc(sizeof(Config_Data));
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
engine_data_return_active(Config_Data *data)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static unsigned int
|
||||||
|
model_data_count(void *data)
|
||||||
|
{
|
||||||
|
Config_Data *cd = data;
|
||||||
|
return cd->count;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void *
|
||||||
|
model_data_fetch(void *data, unsigned int row, unsigned int col __UNUSED__)
|
||||||
|
{
|
||||||
|
Config_Data *cd = data;
|
||||||
|
return cd->array[row];
|
||||||
|
}
|
||||||
|
|
7
ecdb/trunk/src/ecdb_config_dialog.h
Normal file
7
ecdb/trunk/src/ecdb_config_dialog.h
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
/* vim: set sw=3 ts=3 sts=3 expandtab: */
|
||||||
|
#ifndef ECDB_CONFIG_DIALOG_H
|
||||||
|
#define ECDB_CONFIG_DIALOG_H
|
||||||
|
|
||||||
|
void ecdb_config_dialog_show(void);
|
||||||
|
|
||||||
|
#endif
|
@ -164,7 +164,7 @@ _cb_filelist_key_down(void *data, Evas *e __UNUSED__,
|
|||||||
{
|
{
|
||||||
len = strlen(text) + 2;
|
len = strlen(text) + 2;
|
||||||
text = realloc(text, len);
|
text = realloc(text, len);
|
||||||
ecore_strlcat(text, append, len);
|
strncat(text, append, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Avoid sending the same signal twice... seems to skip the
|
/* Avoid sending the same signal twice... seems to skip the
|
||||||
@ -184,21 +184,21 @@ int
|
|||||||
ecdb_create_main_gui(void)
|
ecdb_create_main_gui(void)
|
||||||
{
|
{
|
||||||
Evas_Coord mw, mh;
|
Evas_Coord mw, mh;
|
||||||
const char *scale, *engine;
|
|
||||||
|
|
||||||
engine = getenv("ECDB_ENGINE");
|
if (!strcmp(em->engine, "opengl_x11"))
|
||||||
if (engine)
|
|
||||||
{
|
{
|
||||||
if (!strcmp(engine, "gl"))
|
em->main_win_ee = ecore_evas_gl_x11_new(0, 0, 0, 0, 255, 255);
|
||||||
em->main_win_ee = ecore_evas_gl_x11_new(0, 0, 0, 0, 255, 255);
|
em->xwin = ecore_evas_gl_x11_window_get(em->main_win_ee);
|
||||||
else if (!strcmp(engine, "xr"))
|
|
||||||
em->main_win_ee = ecore_evas_xrender_x11_new(0, 0, 0, 0, 255, 255);
|
|
||||||
else if (!strcmp(engine, "x11"))
|
|
||||||
em->main_win_ee = ecore_evas_software_x11_new(0, 0, 0, 0, 255, 255);
|
|
||||||
}
|
}
|
||||||
else
|
else if (!strcmp(em->engine, "xrender_x11"))
|
||||||
|
{
|
||||||
|
em->main_win_ee = ecore_evas_xrender_x11_new(0, 0, 0, 0, 255, 255);
|
||||||
|
em->xwin = ecore_evas_xrender_x11_window_get(em->main_win_ee);
|
||||||
|
}
|
||||||
|
else if (!strcmp(em->engine, "software_x11"))
|
||||||
{
|
{
|
||||||
em->main_win_ee = ecore_evas_software_x11_new(0, 0, 0, 0, 255, 255);
|
em->main_win_ee = ecore_evas_software_x11_new(0, 0, 0, 0, 255, 255);
|
||||||
|
em->xwin = ecore_evas_software_x11_window_get(em->main_win_ee);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!em->main_win_ee)
|
if (!em->main_win_ee)
|
||||||
@ -210,10 +210,8 @@ ecdb_create_main_gui(void)
|
|||||||
ecore_evas_title_set(em->main_win_ee, "ECDB");
|
ecore_evas_title_set(em->main_win_ee, "ECDB");
|
||||||
ecore_evas_name_class_set(em->main_win_ee, "ECDB", "ECDB");
|
ecore_evas_name_class_set(em->main_win_ee, "ECDB", "ECDB");
|
||||||
ecore_evas_avoid_damage_set(em->main_win_ee, 1);
|
ecore_evas_avoid_damage_set(em->main_win_ee, 1);
|
||||||
ecore_x_dnd_aware_set(ecore_evas_software_x11_window_get(em->main_win_ee),
|
ecore_x_dnd_aware_set(em->xwin, 1);
|
||||||
1);
|
ecore_x_dnd_type_set(em->xwin, "*", 1);
|
||||||
ecore_x_dnd_type_set(ecore_evas_software_x11_window_get(em->main_win_ee),
|
|
||||||
"*", 1);
|
|
||||||
|
|
||||||
ecore_evas_callback_delete_request_set(em->main_win_ee, ecdb_shutdown);
|
ecore_evas_callback_delete_request_set(em->main_win_ee, ecdb_shutdown);
|
||||||
ecore_evas_callback_destroy_set(em->main_win_ee, ecdb_shutdown);
|
ecore_evas_callback_destroy_set(em->main_win_ee, ecdb_shutdown);
|
||||||
@ -222,13 +220,10 @@ ecdb_create_main_gui(void)
|
|||||||
ecore_evas_callback_mouse_out_set(em->main_win_ee, ecdb_cb_leave);
|
ecore_evas_callback_mouse_out_set(em->main_win_ee, ecdb_cb_leave);
|
||||||
ecore_evas_callback_resize_set(em->main_win_ee, ecdb_cb_resize);
|
ecore_evas_callback_resize_set(em->main_win_ee, ecdb_cb_resize);
|
||||||
|
|
||||||
edje_frametime_set(1.0 / 60.0);
|
edje_frametime_set(1.0 / (double)em->fps);
|
||||||
ecore_evas_show(em->main_win_ee);
|
ecore_evas_show(em->main_win_ee);
|
||||||
|
|
||||||
/* Make this configurable at some point */
|
/* Make this configurable at some point */
|
||||||
ecdb_set_main_theme(NULL);
|
|
||||||
scale = getenv("ECDB_SCALE");
|
|
||||||
em->scalef = (scale) ? atof(scale) : 1.0;
|
|
||||||
edje_scale_set(em->scalef);
|
edje_scale_set(em->scalef);
|
||||||
|
|
||||||
em->page = calloc(1, sizeof(Ecdb_Page));
|
em->page = calloc(1, sizeof(Ecdb_Page));
|
||||||
@ -253,19 +248,6 @@ ecdb_create_main_gui(void)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This needs some work. Where should user themes go? */
|
|
||||||
void
|
|
||||||
ecdb_set_main_theme(const char *theme_name)
|
|
||||||
{
|
|
||||||
if (!theme_name)
|
|
||||||
{
|
|
||||||
snprintf(em->theme_path, PATH_MAX, "%s/%s", PACKAGE_DATA_DIR,
|
|
||||||
"themes/default.edj");
|
|
||||||
evas_font_path_append(ecore_evas_get(em->main_win_ee),
|
|
||||||
PACKAGE_DATA_DIR"/font");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ecdb_handle_typebuf(Evas_Object *gui, Ewl_Widget *fl)
|
ecdb_handle_typebuf(Evas_Object *gui, Ewl_Widget *fl)
|
||||||
{
|
{
|
||||||
|
@ -4,25 +4,32 @@
|
|||||||
int
|
int
|
||||||
ecdb_shutdown(void *data, int type, void *event)
|
ecdb_shutdown(void *data, int type, void *event)
|
||||||
{
|
{
|
||||||
|
FREE(em->theme_path);
|
||||||
|
FREE(em->engine);
|
||||||
|
|
||||||
if (em->drives)
|
if (em->drives)
|
||||||
{
|
{
|
||||||
ecdb_drive_info_list_free(em->drives);
|
ecdb_drive_info_list_free(em->drives);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (em->evas_dnd_candidates)
|
if (em->evas_dnd_candidates)
|
||||||
{
|
{
|
||||||
eina_list_free(em->evas_dnd_candidates);
|
eina_list_free(em->evas_dnd_candidates);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (em->ewl_dnd_candidates)
|
if (em->ewl_dnd_candidates)
|
||||||
{
|
{
|
||||||
eina_list_free(em->ewl_dnd_candidates);
|
eina_list_free(em->ewl_dnd_candidates);
|
||||||
}
|
}
|
||||||
|
|
||||||
FREE(em);
|
FREE(em);
|
||||||
|
|
||||||
if (!ecore_file_recursive_rm("/tmp/ecdb"))
|
if (!ecore_file_recursive_rm("/tmp/ecdb"))
|
||||||
{
|
{
|
||||||
printf("Removal of temporary directory failed!\n");
|
printf("Removal of temporary directory failed!\n");
|
||||||
}
|
}
|
||||||
ewl_main_quit();
|
|
||||||
|
ecore_main_loop_quit();
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user