forked from enlightenment/edi
builds: Add a run button and the launch config to support.
I expect we can support a list of these later so for now support passing around the launch config.
This commit is contained in:
parent
7bf0fc7c3c
commit
d4670583df
|
@ -1,3 +1,7 @@
|
|||
2015-05-31 ajwillia.ms (Andy Williams)
|
||||
|
||||
* Add launch configuration so we can run a built binary
|
||||
|
||||
2015-05-30 ajwillia.ms (Andy Williams)
|
||||
|
||||
* Added a monospaced font picker to settings
|
||||
|
|
|
@ -251,6 +251,8 @@ _edi_config_init(void)
|
|||
EDI_CONFIG_VAL(D, T, gui.toolbar_hidden, EET_T_UCHAR);
|
||||
|
||||
EDI_CONFIG_LIST(D, T, tabs, _edi_proj_cfg_tab_edd);
|
||||
EDI_CONFIG_VAL(D, T, launch.path, EET_T_STRING);
|
||||
EDI_CONFIG_VAL(D, T, launch.args, EET_T_STRING);
|
||||
|
||||
_edi_config_load();
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@ typedef struct _Edi_Config Edi_Config;
|
|||
|
||||
typedef struct _Edi_Project_Config Edi_Project_Config;
|
||||
typedef struct _Edi_Project_Config_Tab Edi_Project_Config_Tab;
|
||||
typedef struct _Edi_Project_Config_Launch Edi_Project_Config_Launch;
|
||||
|
||||
struct _Edi_Config_Project
|
||||
{
|
||||
|
@ -49,6 +50,12 @@ struct _Edi_Project_Config_Tab
|
|||
Eina_Bool windowed;
|
||||
};
|
||||
|
||||
struct _Edi_Project_Config_Launch
|
||||
{
|
||||
char *path;
|
||||
char *args;
|
||||
};
|
||||
|
||||
struct _Edi_Project_Config
|
||||
{
|
||||
int version;
|
||||
|
@ -72,6 +79,7 @@ struct _Edi_Project_Config
|
|||
} gui;
|
||||
|
||||
Eina_List *tabs;
|
||||
Edi_Project_Config_Launch launch;
|
||||
};
|
||||
|
||||
extern Edi_Config *_edi_config;
|
||||
|
|
|
@ -439,6 +439,37 @@ edi_content_setup(Evas_Object *win, const char *path)
|
|||
return logpane;
|
||||
}
|
||||
|
||||
static void
|
||||
_edi_popup_cancel_cb(void *data, Evas_Object *obj EINA_UNUSED,
|
||||
void *event_info EINA_UNUSED)
|
||||
{
|
||||
evas_object_del((Evas_Object *)data);
|
||||
}
|
||||
|
||||
static void
|
||||
_edi_launcher_run(Edi_Project_Config_Launch *launch)
|
||||
{
|
||||
Evas_Object *popup, *button;
|
||||
|
||||
if (_edi_project_config->launch.path)
|
||||
{
|
||||
ecore_exe_run(launch->path, NULL);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
popup = elm_popup_add(_edi_main_win);
|
||||
elm_object_part_text_set(popup, "title,text", "Unable to launch");
|
||||
elm_object_text_set(popup, "No launch binary found, please configure in Settings");
|
||||
|
||||
button = elm_button_add(popup);
|
||||
elm_object_text_set(button, "OK");
|
||||
elm_object_part_content_set(popup, "button1", button);
|
||||
evas_object_smart_callback_add(button, "clicked", _edi_popup_cancel_cb, popup);
|
||||
|
||||
evas_object_show(popup);
|
||||
}
|
||||
|
||||
static void
|
||||
_tb_new_create_cb(void *data,
|
||||
Evas_Object *obj EINA_UNUSED,
|
||||
|
@ -457,14 +488,6 @@ _tb_new_create_cb(void *data,
|
|||
free((char*)path);
|
||||
}
|
||||
|
||||
static void
|
||||
_tb_new_cancel_cb(void *data EINA_UNUSED,
|
||||
Evas_Object *obj EINA_UNUSED,
|
||||
void *event_info EINA_UNUSED)
|
||||
{
|
||||
evas_object_del(_edi_new_popup);
|
||||
}
|
||||
|
||||
static void
|
||||
_edi_file_new()
|
||||
{
|
||||
|
@ -483,7 +506,7 @@ _edi_file_new()
|
|||
elm_object_text_set(button, "cancel");
|
||||
elm_object_part_content_set(popup, "button1", button);
|
||||
evas_object_smart_callback_add(button, "clicked",
|
||||
_tb_new_cancel_cb, NULL);
|
||||
_edi_popup_cancel_cb, _edi_new_popup);
|
||||
|
||||
button = elm_button_add(popup);
|
||||
elm_object_text_set(button, "create");
|
||||
|
@ -635,14 +658,14 @@ _tb_test_cb(void *data EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUS
|
|||
if (_edi_build_prep(obj, EINA_TRUE))
|
||||
edi_builder_test();
|
||||
}
|
||||
/*
|
||||
|
||||
static void
|
||||
_tb_run_cb(void *data EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED)
|
||||
{
|
||||
if (_edi_build_prep(obj, EINA_FALSE))
|
||||
edi_builder_run();
|
||||
_edi_launcher_run(&_edi_project_config->launch);
|
||||
}
|
||||
*/
|
||||
|
||||
static void
|
||||
_tb_clean_cb(void *data EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED)
|
||||
{
|
||||
|
@ -753,6 +776,13 @@ _edi_menu_test_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
|
|||
edi_builder_test();
|
||||
}
|
||||
|
||||
static void
|
||||
_edi_menu_run_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
|
||||
void *event_info EINA_UNUSED)
|
||||
{
|
||||
_edi_launcher_run(&_edi_project_config->launch);
|
||||
}
|
||||
|
||||
static void
|
||||
_edi_menu_clean_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
|
||||
void *event_info EINA_UNUSED)
|
||||
|
@ -803,6 +833,7 @@ _edi_menu_setup(Evas_Object *win)
|
|||
menu_it = elm_menu_item_add(menu, NULL, NULL, "Build", NULL, NULL);
|
||||
elm_menu_item_add(menu, menu_it, "system-run", "Build", _edi_menu_build_cb, NULL);
|
||||
elm_menu_item_add(menu, menu_it, "dialog-ok", "Test", _edi_menu_test_cb, NULL);
|
||||
elm_menu_item_add(menu, menu_it, "stock_media-play", "Run", _edi_menu_run_cb, NULL);
|
||||
elm_menu_item_add(menu, menu_it, "edit-clear", "Clean", _edi_menu_clean_cb, NULL);
|
||||
|
||||
menu_it = elm_menu_item_add(menu, NULL, NULL, "Help", NULL, NULL);
|
||||
|
@ -856,7 +887,7 @@ edi_toolbar_setup(Evas_Object *win)
|
|||
|
||||
tb_it = elm_toolbar_item_append(tb, "system-run", "Build", _tb_build_cb, NULL);
|
||||
tb_it = elm_toolbar_item_append(tb, "dialog-ok", "Test", _tb_test_cb, NULL);
|
||||
// tb_it = elm_toolbar_item_append(tb, "player-play", "Run", _tb_run_cb, NULL);
|
||||
tb_it = elm_toolbar_item_append(tb, "stock_media-play", "Run", _tb_run_cb, NULL);
|
||||
tb_it = elm_toolbar_item_append(tb, "edit-clear", "Clean", _tb_clean_cb, NULL);
|
||||
|
||||
elm_box_pack_end(box, tb);
|
||||
|
|
|
@ -11,7 +11,8 @@
|
|||
|
||||
#include "edi_private.h"
|
||||
|
||||
static Elm_Object_Item *_edi_settings_display, *_edi_settings_behaviour;
|
||||
static Elm_Object_Item *_edi_settings_display, *_edi_settings_builds,
|
||||
*_edi_settings_behaviour;
|
||||
|
||||
static void
|
||||
_edi_settings_exit(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
|
||||
|
@ -207,7 +208,7 @@ _edi_settings_display_create(Evas_Object *parent)
|
|||
|
||||
label = elm_label_add(hbox);
|
||||
elm_object_text_set(label, "Tabstop");
|
||||
evas_object_size_hint_align_set(label, EVAS_HINT_EXPAND, 0.5);
|
||||
evas_object_size_hint_align_set(label, 0.0D, 0.5);
|
||||
elm_box_pack_end(hbox, label);
|
||||
evas_object_show(label);
|
||||
|
||||
|
@ -237,6 +238,72 @@ _edi_settings_display_create(Evas_Object *parent)
|
|||
return frame;
|
||||
}
|
||||
|
||||
static void
|
||||
_edi_settings_builds_binary_chosen_cb(void *data, Evas_Object *obj EINA_UNUSED,
|
||||
void *event_info)
|
||||
{
|
||||
Evas_Object *label = data;
|
||||
const char *file = event_info;
|
||||
|
||||
if (!file)
|
||||
return;
|
||||
|
||||
if (_edi_project_config->launch.path)
|
||||
eina_stringshare_del(_edi_project_config->launch.path);
|
||||
|
||||
elm_object_text_set(label, file);
|
||||
_edi_project_config->launch.path = eina_stringshare_add(file);
|
||||
_edi_project_config_save();
|
||||
}
|
||||
|
||||
static Evas_Object *
|
||||
_edi_settings_builds_create(Evas_Object *parent)
|
||||
{
|
||||
Evas_Object *box, *frame, *hbox, *label, *ic, *selector, *file;
|
||||
|
||||
frame = _edi_settings_panel_create(parent, "Builds");
|
||||
box = elm_object_part_content_get(frame, "default");
|
||||
|
||||
hbox = elm_box_add(parent);
|
||||
elm_box_horizontal_set(hbox, EINA_TRUE);
|
||||
evas_object_size_hint_weight_set(hbox, EVAS_HINT_EXPAND, 0.0);
|
||||
evas_object_size_hint_align_set(hbox, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||
elm_box_pack_end(box, hbox);
|
||||
evas_object_show(hbox);
|
||||
|
||||
label = elm_label_add(hbox);
|
||||
elm_object_text_set(label, "Runtime binary");
|
||||
evas_object_size_hint_weight_set(label, 0.0, 0.0);
|
||||
evas_object_size_hint_align_set(label, 0.0, EVAS_HINT_FILL);
|
||||
elm_box_pack_end(hbox, label);
|
||||
evas_object_show(label);
|
||||
|
||||
ic = elm_icon_add(hbox);
|
||||
elm_icon_standard_set(ic, "file");
|
||||
evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
|
||||
|
||||
selector = elm_fileselector_button_add(box);
|
||||
elm_object_text_set(selector, "Select");
|
||||
elm_object_part_content_set(selector, "icon", ic);
|
||||
elm_fileselector_path_set(selector, edi_project_get());
|
||||
evas_object_size_hint_weight_set(selector, 0.25, 0.0);
|
||||
evas_object_size_hint_align_set(selector, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||
elm_box_pack_end(hbox, selector);
|
||||
evas_object_show(selector);
|
||||
|
||||
file = elm_label_add(hbox);
|
||||
elm_object_text_set(file, _edi_project_config->launch.path);
|
||||
evas_object_size_hint_weight_set(file, 0.75, 0.0);
|
||||
evas_object_size_hint_align_set(file, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||
elm_box_pack_end(hbox, file);
|
||||
evas_object_show(file);
|
||||
|
||||
evas_object_smart_callback_add(selector, "file,chosen",
|
||||
_edi_settings_builds_binary_chosen_cb, file);
|
||||
|
||||
return frame;
|
||||
}
|
||||
|
||||
static void
|
||||
_edi_settings_behaviour_autosave_cb(void *data EINA_UNUSED, Evas_Object *obj,
|
||||
void *event EINA_UNUSED)
|
||||
|
@ -313,6 +380,9 @@ edi_settings_show(Evas_Object *mainwin)
|
|||
_edi_settings_display = elm_naviframe_item_push(naviframe, "", NULL, NULL,
|
||||
_edi_settings_display_create(naviframe), NULL);
|
||||
elm_naviframe_item_title_enabled_set(_edi_settings_display, EINA_FALSE, EINA_FALSE);
|
||||
_edi_settings_builds = elm_naviframe_item_push(naviframe, "", NULL, NULL,
|
||||
_edi_settings_builds_create(naviframe), NULL);
|
||||
elm_naviframe_item_title_enabled_set(_edi_settings_builds, EINA_FALSE, EINA_FALSE);
|
||||
_edi_settings_behaviour = elm_naviframe_item_push(naviframe, "", NULL, NULL,
|
||||
_edi_settings_behaviour_create(naviframe), NULL);
|
||||
elm_naviframe_item_title_enabled_set(_edi_settings_behaviour, EINA_FALSE, EINA_FALSE);
|
||||
|
@ -320,6 +390,8 @@ edi_settings_show(Evas_Object *mainwin)
|
|||
elm_toolbar_item_append(tb, NULL, "Project", NULL, NULL);
|
||||
default_it = elm_toolbar_item_append(tb, "preferences-desktop", "Display",
|
||||
_edi_settings_category_cb, _edi_settings_display);
|
||||
elm_toolbar_item_append(tb, "system-run", "Builds",
|
||||
_edi_settings_category_cb, _edi_settings_builds);
|
||||
|
||||
tb_it = elm_toolbar_item_append(tb, NULL, NULL, NULL, NULL);
|
||||
elm_toolbar_item_separator_set(tb_it, EINA_TRUE);
|
||||
|
|
Loading…
Reference in New Issue