uncomplicate startup; this is not a library!!!
This commit is contained in:
parent
df2d1a15de
commit
b38d87bbde
|
@ -11,7 +11,6 @@ src/bin/common.h \
|
|||
src/bin/gui.c \
|
||||
src/bin/gui.h \
|
||||
src/bin/gui_mobile.c \
|
||||
src/bin/gui_mobile.h \
|
||||
src/bin/main.c \
|
||||
src/bin/option.c \
|
||||
src/bin/option_gui.c \
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
#define SIZE_HEIGHT_MIN 30
|
||||
#define SIZE_HEIGHT_MAX 400
|
||||
|
||||
#define DEFAULT_THEME "elementary/themes/default.edj"
|
||||
|
||||
#define DBG(...) EINA_LOG_DOM_DBG(c_log_dom, __VA_ARGS__)
|
||||
#define INF(...) EINA_LOG_DOM_INFO(c_log_dom, __VA_ARGS__)
|
||||
|
@ -29,6 +28,19 @@
|
|||
#define ERR(...) EINA_LOG_DOM_ERR(c_log_dom, __VA_ARGS__)
|
||||
#define CRI(...) EINA_LOG_DOM_CRIT(c_log_dom, __VA_ARGS__)
|
||||
|
||||
#define ETV_SAFE_FREE(_h, _fn) do { if (_h) { _fn((void*)_h); _h = NULL; } } while (0)
|
||||
|
||||
#define PANES_TOP "left"
|
||||
#define PANES_BOTTOM "right"
|
||||
|
||||
#include "theme.h"
|
||||
#include "widget_style.h"
|
||||
#include "widget_option.h"
|
||||
#include "gui.h"
|
||||
#include "option_gui.h"
|
||||
#include "option.h"
|
||||
#include "util.h"
|
||||
|
||||
extern int c_log_dom;
|
||||
|
||||
typedef struct _ETV_Data ETV_Data;
|
||||
|
@ -40,19 +52,8 @@ struct _ETV_Data
|
|||
};
|
||||
|
||||
extern ETV_Data *ed;
|
||||
extern Gui_Data *gd;
|
||||
extern Option_Data *od;
|
||||
|
||||
#define ETV_SAFE_FREE(_h, _fn) do { if (_h) { _fn((void*)_h); _h = NULL; } } while (0)
|
||||
|
||||
#define PANES_TOP "left"
|
||||
#define PANES_BOTTOM "right"
|
||||
|
||||
#include "theme.h"
|
||||
#include "widget_style.h"
|
||||
#include "widget_option.h"
|
||||
#include "gui.h"
|
||||
#include "gui_mobile.h"
|
||||
#include "option_gui.h"
|
||||
#include "option.h"
|
||||
#include "util.h"
|
||||
|
||||
#endif
|
||||
|
|
|
@ -2,42 +2,9 @@
|
|||
#include <string.h>
|
||||
#include "common.h"
|
||||
|
||||
int _gui_init_count = 0;
|
||||
Gui_Data *gd = NULL;
|
||||
extern ETV_Data *ed;
|
||||
|
||||
#define ETV_CHECK_GUI \
|
||||
if (!gd) \
|
||||
{ \
|
||||
CRI("Gui is not initialized. Call gui_init() before you use it."); \
|
||||
return; \
|
||||
}
|
||||
|
||||
static void _gui_widget_load(void);
|
||||
|
||||
int
|
||||
gui_init(void)
|
||||
{
|
||||
if (!gd)
|
||||
{
|
||||
gd = calloc(1, sizeof(Gui_Data));
|
||||
if (!gd)
|
||||
{
|
||||
CRI("Internal Gui_Data is not created!");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
return ++_gui_init_count;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
gui_version_set(Eina_Bool version)
|
||||
{
|
||||
ETV_CHECK_GUI;
|
||||
gd->m_version = version;
|
||||
}
|
||||
|
||||
// logo
|
||||
static Evas_Object *
|
||||
_logo_create(Evas_Object *parent)
|
||||
|
@ -384,9 +351,7 @@ _right_panes_content_create(Evas_Object *panes)
|
|||
}
|
||||
|
||||
void
|
||||
gui_create(const char *edje_file,
|
||||
Evas_Coord width, Evas_Coord height,
|
||||
Eina_Bool fullscreen)
|
||||
gui_create(const char *edje_file)
|
||||
{
|
||||
Evas_Object *o = NULL, *conform = NULL, *box = NULL, *lbox = NULL;
|
||||
Evas_Object *panes = NULL;
|
||||
|
@ -394,16 +359,7 @@ gui_create(const char *edje_file,
|
|||
|
||||
if (!edje_file) return;
|
||||
|
||||
ETV_CHECK_GUI;
|
||||
|
||||
// Window
|
||||
gd->win = o = elm_win_util_standard_add("elm-theme-viewer", "Elm Theme Viewer");
|
||||
elm_win_autodel_set(o, EINA_TRUE);
|
||||
if (fullscreen)
|
||||
elm_win_fullscreen_set(o, EINA_TRUE);
|
||||
else
|
||||
evas_object_resize(o, width, height);
|
||||
|
||||
o = evas_object_image_add(evas_object_evas_get(gd->win));
|
||||
snprintf(path, sizeof(path),
|
||||
"%s/images/ETV_logo_s.png", elm_app_data_dir_get());
|
||||
|
|
|
@ -38,21 +38,18 @@ struct _Gui_Data
|
|||
extern Evas_Object *viewer_box;
|
||||
extern Evas_Object *option_frame;
|
||||
|
||||
int gui_init(void);
|
||||
|
||||
void gui_create(const char *edje_file,
|
||||
Evas_Coord width, Evas_Coord height,
|
||||
Eina_Bool fullscreen);
|
||||
void gui_create(const char *edje_file);
|
||||
|
||||
void gui_preview_update(void);
|
||||
Evas_Object *gui_preview_create(Evas_Object *parent);
|
||||
void gui_preview_focus(void); // Set the focus to the preview object
|
||||
Evas_Object *gui_widget_menu_create(Evas_Object *parent);
|
||||
|
||||
void gui_version_set(Eina_Bool version);
|
||||
|
||||
void gui_panes_clicked_double_cb(void *data, Evas_Object *obj, void *event_info);
|
||||
|
||||
Evas_Object * gui_description_label_get(void);
|
||||
|
||||
void gui_mobile_create(const char *edje_file);
|
||||
void gui_mobile_widget_load(void);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -107,24 +107,15 @@ _mobile_option_create(ETV_Data *ed, Evas_Object *parent)
|
|||
}
|
||||
|
||||
void
|
||||
gui_mobile_create(const char *edje_file, int width, int height,
|
||||
Eina_Bool fullscreen)
|
||||
gui_mobile_create(const char *edje_file)
|
||||
{
|
||||
Evas_Object *o, *conform, *ic, *box;
|
||||
char buf[PATH_MAX];
|
||||
|
||||
if (!edje_file) return;
|
||||
|
||||
gd->win = o = elm_win_util_standard_add("elm-theme-viewer", "Elm Theme Viewer");
|
||||
elm_win_autodel_set(o, EINA_TRUE);
|
||||
if (fullscreen)
|
||||
elm_win_fullscreen_set(o, EINA_TRUE);
|
||||
else
|
||||
evas_object_resize(o, width, height);
|
||||
evas_object_show(o);
|
||||
|
||||
elm_win_conformant_set(o, EINA_TRUE);
|
||||
elm_win_indicator_mode_set(o, ELM_WIN_INDICATOR_SHOW);
|
||||
elm_win_conformant_set(gd->win, EINA_TRUE);
|
||||
elm_win_indicator_mode_set(gd->win, ELM_WIN_INDICATOR_SHOW);
|
||||
|
||||
conform = o = elm_conformant_add(gd->win);
|
||||
EXPAND(o);
|
||||
|
|
|
@ -1,9 +0,0 @@
|
|||
#ifndef __INCLUDE_GUI_MOBILE__
|
||||
#define __INCLUDE_GUI_MOBILE__
|
||||
|
||||
void gui_mobile_create(const char *edje_file,
|
||||
int width, int height,
|
||||
Eina_Bool fullscreen);
|
||||
void gui_mobile_widget_load(void);
|
||||
|
||||
#endif
|
|
@ -5,6 +5,9 @@
|
|||
int c_log_dom = -1;
|
||||
|
||||
ETV_Data *ed = NULL;
|
||||
Gui_Data *gd = NULL;
|
||||
Option_Data *od = NULL;
|
||||
|
||||
static const Ecore_Getopt options = {
|
||||
PACKAGE_NAME,
|
||||
"%prog [options]",
|
||||
|
@ -122,19 +125,31 @@ elm_main(int argc, char **argv)
|
|||
if (widget)
|
||||
ed->start_widget_type = widget_type_get_by_name(widget);
|
||||
|
||||
gui_init();
|
||||
option_init();
|
||||
od = calloc(1, sizeof(Option_Data));
|
||||
od->option_finger_size = 40;
|
||||
od->option_scale = 1.0;
|
||||
od->option_size_width = WIDGET_DEFAULT_WIDTH;
|
||||
od->option_size_height = WIDGET_DEFAULT_HEIGHT;
|
||||
|
||||
gui_version_set(mobile_version);
|
||||
gd = calloc(1, sizeof(Gui_Data));
|
||||
|
||||
gd->m_version = mobile_version;
|
||||
gd->win = elm_win_util_standard_add("elm-theme-viewer", "Elm Theme Viewer");
|
||||
|
||||
if (mobile_version)
|
||||
gui_mobile_create(edje_file, width, height, fullscreen);
|
||||
gui_mobile_create(edje_file);
|
||||
else
|
||||
{
|
||||
snprintf(buf, sizeof(buf), "%s/themes/layout.edj", elm_app_data_dir_get());
|
||||
elm_theme_extension_add(NULL, buf);
|
||||
gui_create(edje_file, width, height, fullscreen);
|
||||
gui_create(edje_file);
|
||||
}
|
||||
elm_win_autodel_set(gd->win, EINA_TRUE);
|
||||
if (fullscreen)
|
||||
elm_win_fullscreen_set(gd->win, EINA_TRUE);
|
||||
else
|
||||
evas_object_resize(gd->win, width, height);
|
||||
evas_object_show(gd->win);
|
||||
|
||||
elm_run();
|
||||
|
||||
|
|
|
@ -1,89 +1,45 @@
|
|||
#include <Elementary.h>
|
||||
#include "common.h"
|
||||
|
||||
int _option_init_count = 0;
|
||||
Option_Data *od = NULL;
|
||||
|
||||
#define ETV_CHECK_OPTION \
|
||||
if (!od) \
|
||||
{ \
|
||||
CRI("Option is not initialized. Call option_init() before you use it."); \
|
||||
return; \
|
||||
}
|
||||
|
||||
#define ETV_CHECK_OPTION_WITH_VAL(__val) \
|
||||
if (!od) \
|
||||
{ \
|
||||
CRI("Option is not initialized. Call option_init() before you use it."); \
|
||||
return __val; \
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
option_init(void)
|
||||
{
|
||||
if (!od)
|
||||
{
|
||||
od = calloc(1, sizeof(Option_Data));
|
||||
if (!od)
|
||||
{
|
||||
CRI("Internal Option_Data is not created!");
|
||||
return -1;
|
||||
}
|
||||
od->option_finger_size = 40;
|
||||
od->option_scale = 1.0;
|
||||
od->option_size_width = WIDGET_DEFAULT_WIDTH;
|
||||
od->option_size_height = WIDGET_DEFAULT_HEIGHT;
|
||||
}
|
||||
return ++_option_init_count;
|
||||
}
|
||||
|
||||
void
|
||||
option_force_resize_set(Eina_Bool resize)
|
||||
{
|
||||
ETV_CHECK_OPTION;
|
||||
od->option_force_resize = !!resize;
|
||||
}
|
||||
|
||||
Eina_Bool
|
||||
option_force_resize_get(void)
|
||||
{
|
||||
ETV_CHECK_OPTION_WITH_VAL(EINA_FALSE);
|
||||
return od->option_force_resize;
|
||||
}
|
||||
|
||||
void
|
||||
option_disabled_set(Eina_Bool disabled)
|
||||
{
|
||||
ETV_CHECK_OPTION;
|
||||
od->option_disabled = !!disabled;
|
||||
}
|
||||
|
||||
Eina_Bool
|
||||
option_disabled_get(void)
|
||||
{
|
||||
ETV_CHECK_OPTION_WITH_VAL(EINA_FALSE);
|
||||
return od->option_disabled;
|
||||
}
|
||||
|
||||
void
|
||||
option_scale_set(double scale)
|
||||
{
|
||||
ETV_CHECK_OPTION;
|
||||
od->option_scale = scale;
|
||||
}
|
||||
|
||||
double
|
||||
option_scale_get(void)
|
||||
{
|
||||
ETV_CHECK_OPTION_WITH_VAL(0.0);
|
||||
return od->option_scale;
|
||||
}
|
||||
|
||||
void
|
||||
option_size_set(Evas_Coord w, Evas_Coord h)
|
||||
{
|
||||
ETV_CHECK_OPTION;
|
||||
if (w >= 0) od->option_size_width = w;
|
||||
if (h >= 0) od->option_size_height = h;
|
||||
}
|
||||
|
@ -91,7 +47,6 @@ option_size_set(Evas_Coord w, Evas_Coord h)
|
|||
void
|
||||
option_size_get(Evas_Coord *w, Evas_Coord *h)
|
||||
{
|
||||
ETV_CHECK_OPTION;
|
||||
if (w) *w = od->option_size_width;
|
||||
if (h) *h = od->option_size_height;
|
||||
}
|
||||
|
@ -99,41 +54,35 @@ option_size_get(Evas_Coord *w, Evas_Coord *h)
|
|||
void
|
||||
option_focus_highlight_set(Eina_Bool highlight)
|
||||
{
|
||||
ETV_CHECK_OPTION;
|
||||
od->option_focus_highlight = highlight;
|
||||
}
|
||||
|
||||
Eina_Bool
|
||||
option_focus_highlight_get(void)
|
||||
{
|
||||
ETV_CHECK_OPTION_WITH_VAL(EINA_FALSE);
|
||||
return od->option_focus_highlight;
|
||||
}
|
||||
|
||||
void
|
||||
option_focus_highlight_animate_set(Eina_Bool animate)
|
||||
{
|
||||
ETV_CHECK_OPTION;
|
||||
od->option_focus_highlight_animate = animate;
|
||||
}
|
||||
|
||||
Eina_Bool
|
||||
option_focus_highlight_animate_get(void)
|
||||
{
|
||||
ETV_CHECK_OPTION_WITH_VAL(EINA_FALSE);
|
||||
return od->option_focus_highlight_animate;
|
||||
}
|
||||
|
||||
void
|
||||
option_finger_size_set(double finger_size)
|
||||
{
|
||||
ETV_CHECK_OPTION;
|
||||
od->option_finger_size = finger_size;
|
||||
}
|
||||
|
||||
double
|
||||
option_finger_size_get(void)
|
||||
{
|
||||
ETV_CHECK_OPTION_WITH_VAL(0.0);
|
||||
return od->option_finger_size;
|
||||
}
|
||||
|
|
|
@ -14,8 +14,6 @@ struct _Option_Data
|
|||
Eina_Bool option_focus_highlight_animate;
|
||||
};
|
||||
|
||||
int option_init(void);
|
||||
|
||||
void option_force_resize_set(Eina_Bool resize);
|
||||
Eina_Bool option_force_resize_get(void);
|
||||
|
||||
|
|
Loading…
Reference in New Issue