Simple make function invoked from a build button and displayed in a console tab next to logs
This commit is contained in:
parent
7b6cd95592
commit
40c206849e
|
@ -0,0 +1,7 @@
|
|||
2014-04-27 ajwillia.ms (Andy Williams)
|
||||
|
||||
* Add simple build functions
|
||||
|
||||
2014-03-31 ajwillia.ms (Andy Williams)
|
||||
|
||||
* Complete the features of the Basic text editor
|
14
NEWS
14
NEWS
|
@ -0,0 +1,14 @@
|
|||
|
||||
pre-1.0 phase 2 "Code aware editor"
|
||||
- Simple build functions
|
||||
|
||||
|
||||
pre-1.0 phase 1 "Basic text editing"
|
||||
- Editing and saving text files
|
||||
- Tabbed browsing of open files
|
||||
- Opening editor in a new window
|
||||
- Displaying directory for the project (directory)
|
||||
- link files out to eternal viewers / editors
|
||||
- No screen waste (toolbar, menu, tab are out of the way of the developer)
|
||||
- info panel with logs and useful output
|
||||
- Create new file
|
18
TODO
18
TODO
|
@ -1,13 +1,23 @@
|
|||
This project is in heavy development, we are currenty working towards the
|
||||
"Basic text editing" phase, the following work is still to be done:
|
||||
"Code aware editor" phase, the following work is still to be done:
|
||||
|
||||
* Remember last project and allow new project to be loaded (new window or current)
|
||||
* No screen waste (toolbar, menu, tab are out of the way of the developer)
|
||||
* Creation of new projects from name input and skeleton project files
|
||||
* Automatic code indenting / formatting
|
||||
* Syntax highlighting - from elm_code project (cedric and TAsn)
|
||||
* Code folding
|
||||
* Integrated console
|
||||
* notepad, vim and editing modes
|
||||
* Refactoring code capability
|
||||
* Documentation finding
|
||||
* Code expansion (nested display of function call body)
|
||||
* Compilation error message integrated in the flow of code
|
||||
* Cross reference for c, c++ and some scripting language
|
||||
|
||||
Bugs to fix:
|
||||
|
||||
* Remember last project and allow new project to be loaded (new window or current)
|
||||
* Remember position and size of window and panels
|
||||
|
||||
The next phase is "Code aware editor" and it, along with other future phases
|
||||
The next phase is "Basic IDE" and it, along with other future phases
|
||||
are documented online at https://phab.enlightenment.org/w/edi/
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@ AM_CPPFLAGS = -DPACKAGE_DATA_DIR=\"$(datadir)/$(PACKAGE)\" \
|
|||
edi_SOURCES = \
|
||||
edi_filepanel.c \
|
||||
edi_logpanel.c \
|
||||
edi_consolepanel.c \
|
||||
edi_mainview.c \
|
||||
edi_main.c
|
||||
|
||||
|
|
|
@ -0,0 +1,114 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#define BUFFER_SIZE 1024
|
||||
|
||||
#include <Eina.h>
|
||||
#include <Ecore.h>
|
||||
|
||||
#include "edi_consolepanel.h"
|
||||
|
||||
#include "edi_private.h"
|
||||
|
||||
static Evas_Object *_console_box;
|
||||
|
||||
void _edi_consolepanel_append_line_type(const char *line, Eina_Bool err)
|
||||
{
|
||||
Evas_Object *txt;
|
||||
|
||||
txt = elm_label_add(_console_box);
|
||||
if (err)
|
||||
evas_object_color_set(txt, 255, 63, 63, 255);
|
||||
else
|
||||
evas_object_color_set(txt, 255, 255, 255, 255);
|
||||
|
||||
elm_object_text_set(txt, line);
|
||||
evas_object_size_hint_weight_set(txt, EVAS_HINT_EXPAND, 0.1);
|
||||
evas_object_size_hint_align_set(txt, 0.0, EVAS_HINT_FILL);
|
||||
evas_object_show(txt);
|
||||
|
||||
elm_box_pack_end(_console_box, txt);
|
||||
}
|
||||
|
||||
void edi_consolepanel_append_line(const char *line)
|
||||
{
|
||||
_edi_consolepanel_append_line_type(line, EINA_FALSE);
|
||||
}
|
||||
|
||||
void edi_consolepanel_append_error_line(const char *line)
|
||||
{
|
||||
_edi_consolepanel_append_line_type(line, EINA_TRUE);
|
||||
}
|
||||
|
||||
void edi_consolepanel_clear()
|
||||
{
|
||||
elm_box_clear(_console_box);
|
||||
}
|
||||
|
||||
static Eina_Bool _stdin_handler_cb(void *data EINA_UNUSED, Ecore_Fd_Handler *fd_handler EINA_UNUSED)
|
||||
{
|
||||
char message[BUFFER_SIZE];
|
||||
|
||||
if (!fgets(message, BUFFER_SIZE, stdin))
|
||||
return ECORE_CALLBACK_RENEW;
|
||||
|
||||
edi_consolepanel_append_line(message);
|
||||
return ECORE_CALLBACK_RENEW;
|
||||
}
|
||||
|
||||
static Eina_Bool _stderr_handler_cb(void *data EINA_UNUSED, Ecore_Fd_Handler *fd_handler EINA_UNUSED)
|
||||
{
|
||||
char message[BUFFER_SIZE];
|
||||
|
||||
if (!fgets(message, BUFFER_SIZE, stderr))
|
||||
return ECORE_CALLBACK_RENEW;
|
||||
|
||||
edi_consolepanel_append_error_line(message);
|
||||
return ECORE_CALLBACK_RENEW;
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
exe_data(void *d EINA_UNUSED, int t EINA_UNUSED, Ecore_Exe_Event_Data *ev)
|
||||
{
|
||||
Ecore_Exe_Event_Data_Line *el;
|
||||
|
||||
for (el = ev->lines; el && el->line; el++)
|
||||
edi_consolepanel_append_line(el->line);
|
||||
|
||||
return ECORE_CALLBACK_RENEW;
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
exe_error(void *d EINA_UNUSED, int t EINA_UNUSED, Ecore_Exe_Event_Data *ev)
|
||||
{
|
||||
Ecore_Exe_Event_Data_Line *el;
|
||||
|
||||
for (el = ev->lines; el && el->line; el++)
|
||||
edi_consolepanel_append_error_line(el->line);
|
||||
|
||||
return ECORE_CALLBACK_RENEW;
|
||||
}
|
||||
|
||||
void edi_consolepanel_add(Evas_Object *parent)
|
||||
{
|
||||
Evas_Object *scroll, *vbx;
|
||||
|
||||
scroll = elm_scroller_add(parent);
|
||||
elm_scroller_gravity_set(scroll, 0.0, 0.0);
|
||||
evas_object_size_hint_weight_set(scroll, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||
evas_object_size_hint_align_set(scroll, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||
evas_object_show(scroll);
|
||||
|
||||
vbx = elm_box_add(parent);
|
||||
evas_object_size_hint_weight_set(vbx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||
evas_object_show(vbx);
|
||||
elm_object_content_set(scroll, vbx);
|
||||
|
||||
_console_box = vbx;
|
||||
|
||||
elm_object_content_set(parent, scroll);
|
||||
|
||||
ecore_event_handler_add(ECORE_EXE_EVENT_DATA, exe_data, NULL);
|
||||
ecore_event_handler_add(ECORE_EXE_EVENT_ERROR, exe_error, NULL);
|
||||
}
|
|
@ -0,0 +1,84 @@
|
|||
#ifndef EDI_CONSOLEPANEL_H_
|
||||
# define EDI_CONSOLEPANEL_H_
|
||||
|
||||
#include <Elementary.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief These routines are used for managing the Edi console panel.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief UI management functions.
|
||||
* @defgroup UI Initialisation and management of the console panel UI
|
||||
*
|
||||
* @{
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Initialize a new Edi consolepanel and add it to the parent panel.
|
||||
*
|
||||
* @param parent The panel into which the panel will be loaded.
|
||||
*
|
||||
* @ingroup UI
|
||||
*/
|
||||
EAPI void edi_consolepanel_add(Evas_Object *parent);
|
||||
|
||||
/**
|
||||
* Show the Edi consolepanel - animating on to screen if required.
|
||||
*
|
||||
* @ingroup UI
|
||||
*/
|
||||
EAPI void edi_consolepanel_show();
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Console management functions.
|
||||
* @defgroup Console Manipulation of console output in Edi
|
||||
*
|
||||
* @{
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Append a new line to the console.
|
||||
*
|
||||
* @param line The line of text to append to the console.
|
||||
*
|
||||
* @ingroup Console
|
||||
*/
|
||||
EAPI void edi_consolepanel_append_line(const char *line);
|
||||
|
||||
/**
|
||||
* Append a new error line to the console.
|
||||
*
|
||||
* @param line The line of text to append to the console.
|
||||
*
|
||||
* @ingroup Console
|
||||
*/
|
||||
EAPI void edi_consolepanel_append_error_line(const char *line);
|
||||
|
||||
/**
|
||||
* Clear all lines from the console.
|
||||
*
|
||||
* @ingroup Console
|
||||
*/
|
||||
EAPI void edi_consolepanel_clear();
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* EDI_CONSOLEPANEL_H_ */
|
|
@ -9,7 +9,7 @@ extern "C" {
|
|||
|
||||
/**
|
||||
* @file
|
||||
* @brief These routines are used for managing the Edi file panel.
|
||||
* @brief These routines are used for managing the Edi log panel.
|
||||
*/
|
||||
|
||||
/**
|
||||
|
|
|
@ -14,13 +14,15 @@
|
|||
|
||||
#include "Edi.h"
|
||||
#include "edi_filepanel.h"
|
||||
#include "edi_logpanel.h"
|
||||
#include "edi_consolepanel.h"
|
||||
#include "edi_mainview.h"
|
||||
|
||||
#include "edi_private.h"
|
||||
|
||||
#define COPYRIGHT "Copyright © 2014 Andy Williams <andy@andyilliams.me> and various contributors (see AUTHORS)."
|
||||
|
||||
static Evas_Object *_edi_filepanel, *_edi_logpanel;
|
||||
static Evas_Object *_edi_filepanel, *_edi_logpanel, *_edi_consolepanel;
|
||||
static Evas_Object *_edi_main_win, *_edi_new_popup;
|
||||
static const char *_edi_projectpath;
|
||||
|
||||
|
@ -54,16 +56,22 @@ _edi_toggle_panel(void *data, Evas_Object *obj,
|
|||
elm_panel_toggle((Evas_Object *) data);
|
||||
}
|
||||
|
||||
void edi_consolepanel_show()
|
||||
{
|
||||
elm_panel_hidden_set(_edi_consolepanel, EINA_FALSE);
|
||||
}
|
||||
|
||||
static Evas_Object *
|
||||
edi_content_setup(Evas_Object *win, const char *path)
|
||||
{
|
||||
Evas_Object *panes, *content_out, *content_in, *button;
|
||||
Evas_Object *panes, *content_out, *content_in, *tb, *button;
|
||||
|
||||
panes = elm_table_add(win);
|
||||
evas_object_size_hint_weight_set(panes, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||
|
||||
_edi_filepanel = elm_panel_add(win);
|
||||
_edi_logpanel = elm_panel_add(win);
|
||||
_edi_consolepanel = elm_panel_add(win);
|
||||
|
||||
// add main content
|
||||
content_out = elm_box_add(win);
|
||||
|
@ -88,14 +96,6 @@ edi_content_setup(Evas_Object *win, const char *path)
|
|||
edi_mainview_add(content_in, win);
|
||||
evas_object_show(content_in);
|
||||
|
||||
button = elm_button_add(content_out);
|
||||
elm_object_text_set(button, "Logs ");
|
||||
evas_object_smart_callback_add(button, "clicked",
|
||||
_edi_toggle_panel, _edi_logpanel);
|
||||
evas_object_size_hint_align_set(button, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||
elm_box_pack_end(content_out, button);
|
||||
evas_object_show(button);
|
||||
|
||||
elm_table_pack(panes, content_out, 0, 0, 6, 5);
|
||||
evas_object_show(content_out);
|
||||
|
||||
|
@ -110,16 +110,41 @@ edi_content_setup(Evas_Object *win, const char *path)
|
|||
evas_object_show(_edi_filepanel);
|
||||
|
||||
// add lower panel
|
||||
tb = elm_toolbar_add(content_out);
|
||||
evas_object_size_hint_weight_set(tb, EVAS_HINT_EXPAND, 0.0);
|
||||
evas_object_size_hint_align_set(tb, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||
elm_toolbar_homogeneous_set(tb, EINA_FALSE);
|
||||
elm_toolbar_align_set(tb, 1.0);
|
||||
elm_toolbar_shrink_mode_set(tb, ELM_TOOLBAR_SHRINK_SCROLL);
|
||||
elm_toolbar_select_mode_set(tb, ELM_OBJECT_SELECT_MODE_ALWAYS);
|
||||
elm_box_pack_end(content_out, tb);
|
||||
evas_object_show(tb);
|
||||
|
||||
elm_toolbar_item_append(tb, NULL, "Logs", _edi_toggle_panel, _edi_logpanel);
|
||||
elm_toolbar_item_append(tb, NULL, "Console", _edi_toggle_panel, _edi_consolepanel);
|
||||
|
||||
elm_panel_orient_set(_edi_logpanel, ELM_PANEL_ORIENT_BOTTOM);
|
||||
evas_object_size_hint_weight_set(_edi_logpanel, EVAS_HINT_EXPAND, 0.15);
|
||||
evas_object_size_hint_align_set(_edi_logpanel, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||
evas_object_show(_edi_logpanel);
|
||||
|
||||
elm_panel_hidden_set(_edi_logpanel, EINA_FALSE);
|
||||
elm_panel_hidden_set(_edi_logpanel, EINA_TRUE);
|
||||
edi_logpanel_add(_edi_logpanel);
|
||||
elm_table_pack(panes, _edi_logpanel, 0, 4, 6, 1);
|
||||
evas_object_show(_edi_logpanel);
|
||||
|
||||
elm_panel_orient_set(_edi_consolepanel, ELM_PANEL_ORIENT_BOTTOM);
|
||||
evas_object_size_hint_weight_set(_edi_consolepanel, EVAS_HINT_EXPAND, 0.15);
|
||||
evas_object_size_hint_align_set(_edi_consolepanel, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||
evas_object_show(_edi_consolepanel);
|
||||
|
||||
elm_panel_hidden_set(_edi_consolepanel, EINA_FALSE);
|
||||
elm_panel_hidden_set(_edi_consolepanel, EINA_TRUE);
|
||||
edi_consolepanel_add(_edi_consolepanel);
|
||||
elm_table_pack(panes, _edi_consolepanel, 0, 4, 6, 1);
|
||||
evas_object_show(_edi_consolepanel);
|
||||
|
||||
evas_object_show(panes);
|
||||
return panes;
|
||||
}
|
||||
|
@ -227,6 +252,22 @@ _tb_paste_cb(void *data EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNU
|
|||
edi_mainview_paste();
|
||||
}
|
||||
|
||||
static void
|
||||
_tb_build_cb(void *data EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED)
|
||||
{
|
||||
unsigned int printed, buffer_len = 512;
|
||||
char buffer [buffer_len];
|
||||
FILE *pf;
|
||||
|
||||
elm_toolbar_item_selected_set(elm_toolbar_selected_item_get(obj), EINA_FALSE);
|
||||
|
||||
edi_consolepanel_clear();
|
||||
edi_consolepanel_show();
|
||||
|
||||
ecore_exe_pipe_run("make", ECORE_EXE_PIPE_READ_LINE_BUFFERED | ECORE_EXE_PIPE_READ |
|
||||
ECORE_EXE_PIPE_ERROR_LINE_BUFFERED | ECORE_EXE_PIPE_ERROR, NULL);
|
||||
}
|
||||
|
||||
static Evas_Object *
|
||||
edi_toolbar_setup(Evas_Object *win)
|
||||
{
|
||||
|
@ -253,6 +294,11 @@ edi_toolbar_setup(Evas_Object *win)
|
|||
tb_it = elm_toolbar_item_append(tb, "edit-copy", "Copy", _tb_copy_cb, NULL);
|
||||
tb_it = elm_toolbar_item_append(tb, "edit-paste", "Paste", _tb_paste_cb, NULL);
|
||||
|
||||
tb_it = elm_toolbar_item_append(tb, "separator", "", NULL, NULL);
|
||||
elm_toolbar_item_separator_set(tb_it, EINA_TRUE);
|
||||
|
||||
tb_it = elm_toolbar_item_append(tb, "system-run", "Build", _tb_build_cb, NULL);
|
||||
|
||||
evas_object_show(tb);
|
||||
return tb;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue