[ui] Convert equate to Elementary

A few functions that have not been ported but they could not
be accessed from the current edc theme.
Looking at the possibility of a scientific layout to access these.
This commit is contained in:
Andy Williams 2016-01-06 20:28:55 +00:00
parent 242cabee59
commit b34b1f896f
15 changed files with 87 additions and 743 deletions

View File

@ -1,30 +1,11 @@
MAINTAINERCLEANFILES = Makefile.in
SUBDIRS = . images
EDJE_CC = @edje_cc@
EDJE_FLAGS = -v -id $(top_srcdir)/data/images
EDCS = equate.edc text.edc
EDJS = $(EDCS:%.edc=%.edj)
SUFFIXES = .edc .edj
themedir = $(pkgdatadir)/themes
theme_DATA = $(EDJS)
all: $(EDCS)
.edc.edj:
$(EDJE_CC) $(EDJE_FLAGS) $< $@
desktopdir = $(datadir)/applications
desktop_DATA = equate.desktop
icondir = $(datadir)/icons
icon_DATA = equate.png
EXTRA_DIST = $(EDCS) equate.png equate.desktop
EXTRA_DIST = equate.png equate.desktop
clean-local:
rm -f $(EDJS)

View File

@ -1,271 +0,0 @@
#define BUTTON_TABLE_ITEM(pname, x, y, w, h) \
item { \
type: GROUP; \
source: pname; \
weight: 0.5 0.5; \
align: -1 -1; \
position: x y; \
span: w h; \
}
#define BUTTON(pname, label, emits) \
group { name: "button/"pname; \
images { \
image: "btn_normal.png" COMP; \
image: "btn_pressed.png" COMP; \
} \
parts { \
part { name: "button_image"; \
mouse_events: 1; \
description { state: "default" 0.0; \
rel1.offset: 3 3; \
rel2.offset: -4 -4; \
image { \
normal: "btn_normal.png"; \
border: 7 7 7 7; \
} \
\
} \
description { state: "clicked" 0.0; \
inherit: "default" 0.0; \
image.normal: "btn_pressed.png"; \
image.border: 7 7 7 7; \
} \
} \
\
part { \
name: "elm.text"; \
type: TEXT; \
effect: SHADOW; \
mouse_events: 0; \
scale: 1; \
description { state: "default" 0.0; \
visible: 1; \
rel1.offset: 4 4; \
rel2.offset: -5 -5; \
color: 255 255 255 240; \
color3: 20 20 20 128; \
/* color: 172 179 191 255; */ \
/* color3: 0 0 0 30; */ \
text { \
font: "Sans"; \
size: 25; \
min: 1 1; \
align: 0.5 0.5; \
text_class: "button"; \
text: label; \
} \
} \
} \
part { \
name: "over1"; \
mouse_events: 0; \
type: RECT; \
description { \
state: "default" 0.0; \
rel2.relative: 1.0 0.5; \
color: 0 0 0 0; \
} \
description { state: "disabled" 0.0; \
inherit: "default" 0.0; \
} \
} \
part { name: "over2"; \
mouse_events: 1; \
repeat_events: 1; \
ignore_flags: ON_HOLD; \
type: RECT; \
description { \
state: "default" 0.0; \
color: 0 0 0 0; \
} \
description { \
state: "disabled" 0.0; \
inherit: "default" 0.0; \
visible: 0; \
} \
} \
part { name: "over3"; \
mouse_events: 1; \
repeat_events: 1; \
type: RECT; \
description { state: "default" 0.0; \
color: 255 255 255 0; \
} \
description { state: "clicked" 0.0; \
inherit: "default" 0.0; \
color: 255 255 255 0; \
} \
} \
\
\
} \
programs { \
program { \
name: "button_click"; \
signal: "mouse,down,1"; \
source: "over2"; \
action: STATE_SET "clicked" 0.0; \
target: "button_image"; \
} \
\
program { \
name: "button_unclick"; \
signal: "mouse,up,1"; \
source: "over3"; \
action: STATE_SET "default" 0.0; \
target: "button_image"; \
} \
program { \
name: "button_click2"; \
signal: "mouse,down,1"; \
source: "over3"; \
action: STATE_SET "clicked" 0.0; \
target: "over3"; \
} \
program { \
name: "button_unclick2"; \
signal: "mouse,up,1"; \
source: "over3"; \
action: STATE_SET "default" 0.0; \
transition: DECELERATE 0.5; \
target: "over3"; \
} \
program { \
name: "button_unclick3"; \
signal: "mouse,clicked,1"; \
source: "over2"; \
action: SIGNAL_EMIT emits ""; \
} \
} \
}
images {
image: "bg.png" COMP;
image: "shading.png" COMP;
image: "brushed_texture.png" COMP;
image: "metalsphere.png" COMP;
image: "entry_disabled.png" COMP;
image: "entry_light_overlay.png" COMP;
}
collections {
BUTTON("add", "+", "OP_ADD");
BUTTON("min", "-", "OP_SUB");
BUTTON("mul", "*", "OP_MUT");
BUTTON("div", "/", "OP_DIV");
BUTTON("seven", "7", "NUM_7");
BUTTON("height", "8", "NUM_8");
BUTTON("nine", "9", "NUM_9");
BUTTON("clear", "C", "OP_CLR");
BUTTON("four", "4", "NUM_4");
BUTTON("five", "5", "NUM_5");
BUTTON("six", "6", "NUM_6");
BUTTON("obrak", "(", "OP_OBRAK");
BUTTON("one", "1", "NUM_1");
BUTTON("two", "2", "NUM_2");
BUTTON("three", "3", "NUM_3");
BUTTON("cbrak", ")", "OP_CBRAK");
BUTTON("zero", "0", "NUM_0");
BUTTON("point", ".", "OP_DEC");
BUTTON("equal", "=", "OP_EQU");
group {
name: "Main";
parts {
part {
name: "bg";
type: RECT;
mouse_events: 0;
description
{
state: "default" 0.0;
visible: 1;
color: 255 255 255 255;
}
}
part {
name: "EquateAnswer";
type: TEXT;
mouse_events: 0;
description
{
state: "default" 0.0;
visible: 1;
rel1 {
relative: 0.0 0.0;
offset: 2 0;
} rel2 {
relative: 1.0 0.0;
offset: -1 0;
}
fixed: 1 1;
align: 0.5 0;
color: 0 0 0 255;
color3: 192 192 192 255;
text
{
text: "";
font: "Sans";
size: 30;
//fit: 0 0;
min: 1 1;
align: 1.0 0.5;
}
}
}
part {
name : "table_description";
type : TABLE;
description {
state : "default" 0.0;
fixed: 0 1;
rel1.to: "EquateAnswer";
rel1.relative: 0 1;
table {
homogeneous: TABLE;
padding: 0 0;
}
}
table {
items {
BUTTON_TABLE_ITEM("button/add", 0, 0, 1, 1);
BUTTON_TABLE_ITEM("button/min", 1, 0, 1, 1);
BUTTON_TABLE_ITEM("button/mul", 2, 0, 1, 1);
BUTTON_TABLE_ITEM("button/div", 3, 0, 1, 1);
BUTTON_TABLE_ITEM("button/seven", 0, 1, 1, 1);
BUTTON_TABLE_ITEM("button/height", 1, 1, 1, 1);
BUTTON_TABLE_ITEM("button/nine", 2, 1, 1, 1);
BUTTON_TABLE_ITEM("button/clear", 3, 1, 1, 1);
BUTTON_TABLE_ITEM("button/four", 0, 2, 1, 1);
BUTTON_TABLE_ITEM("button/five", 1, 2, 1, 1);
BUTTON_TABLE_ITEM("button/six", 2, 2, 1, 1);
BUTTON_TABLE_ITEM("button/obrak", 3, 2, 1, 1);
BUTTON_TABLE_ITEM("button/one", 0, 3, 1, 1);
BUTTON_TABLE_ITEM("button/two", 1, 3, 1, 1);
BUTTON_TABLE_ITEM("button/three", 2, 3, 1, 1);
BUTTON_TABLE_ITEM("button/cbrak", 3, 3, 1, 1);
BUTTON_TABLE_ITEM("button/zero", 0, 4, 1, 1);
BUTTON_TABLE_ITEM("button/point", 1, 4, 1, 1);
BUTTON_TABLE_ITEM("button/equal", 2, 4, 2, 1);
}
}
}
}
}

View File

@ -1,14 +0,0 @@
MAINTAINERCLEANFILES = Makefile.in
EXTRA_DIST = \
bg.png \
brushed_texture.png \
btn_normal.png \
btn_pressed.png \
entry_disabled.png \
entry_light_overlay.png \
metalsphere.png \
shading.png \
text_button.png \
text_display.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 86 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 589 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 456 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 123 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

View File

@ -1,359 +0,0 @@
images {
image, "text_button.png" LOSSY 95;
image, "text_display.png" LOSSY 95;
}
collections {
group {
name, "Main";
min, 110 160;
max, 110 160;
parts {
part {
name, "bg";
type, RECT;
mouse_events, 0;
description
{
state, "default" 0.0;
visible, 1;
rel1 {
relative, 0.0 0.0;
offset, 0 0;
} rel2 {
relative, 1.0 1.0;
offset, 0 0;
}
color, 0 0 0 255;
}
}
part {
name, "answer_buf_clip";
type, RECT;
mouse_events, 0;
description
{
state, "default" 0.0;
visible, 1;
rel1 {
relative, 0.0 0.0;
offset, 5 5;
} rel2 {
relative, 1.0 0.0;
offset, -5 30;
}
color, 255 255 255 255;
}
description
{
state, "hidden" 0.0;
visible, 1;
rel1 {
relative, 0.0 0.0;
offset, 5 5;
} rel2 {
relative, 1.0 0.0;
offset, -5 30;
}
color, 255 255 255 0;
}
}
part {
name, "answer_buf_rect";
type, IMAGE;
mouse_events, 0;
clip_to, "answer_buf_clip";
description
{
state, "default" 0.0;
visible, 1;
rel1 {
relative, 0.0 0.0;
offset, 0 0;
to, "answer_buf_clip";
} rel2 {
relative, 1.0 1.0;
offset, 0 0;
to, "answer_buf_clip";
}
image
{
normal, "text_display.png";
border, 8 8 8 8;
}
color, 255 255 255 255;
}
}
part {
name, "EquateAnswer";
type, TEXT;
mouse_events, 0;
effect, OUTLINE;
clip_to, "answer_buf_clip";
description
{
state, "default" 0.0;
visible, 1;
rel1 {
relative, 0.0 0.0;
offset, 5 5;
to, "answer_buf_clip";
} rel2 {
relative, 1.0 1.0;
offset, -5 -2;
to, "answer_buf_clip";
}
color, 0 0 0 255;
color3, 192 192 192 255;
text
{
text, "";
font, "Vera";
size, 14;
fit, 0 0;
align, 1.0 0.5;
}
}
}
part {
name, "clipped_clear";
type, RECT;
mouse_events, 0;
description {
state, "default" 0.0;
visible, 1;
rel1 {
relative, 0.0 1.0;
offset, 0 0;
to, "answer_buf_clip";
} rel2 {
relative, 0.0 1.0;
offset, 24 24;
to, "answer_buf_clip";
}
color, 255 255 255 255;
}
description {
state, "clicked" 0.0;
visible, 1;
rel1 {
relative, 0.0 1.0;
offset, 0 0;
to, "answer_buf_clip";
} rel2 {
relative, 0.0 1.0;
offset, 24 24;
to, "answer_buf_clip";
}
color, 255 255 255 192;
}
}
part {
name, "clear_button_image";
type, IMAGE;
mouse_events, 1;
clip_to, "clipped_clear";
description
{
state, "default" 0.0;
visible, 1;
rel1 {
relative, 0.0 1.0;
offset, 0 0;
to, "answer_buf_clip";
} rel2 {
relative, 0.0 1.0;
offset, 24 24;
to, "answer_buf_clip";
}
image
{
normal, "text_button.png";
}
}
}
part {
name, "clear_button_text";
type, TEXT;
mouse_events, 1;
effect, SOFT_SHADOW;
description
{
state, "default" 0.0;
visible, 1;
rel1 {
relative, 0.0 0.0;
offset, 0 0;
to, "clear_button_image";
} rel2 {
relative, 1.0 1.0;
offset, 0 0;
to, "clear_button_image";
}
color, 255 255 255 255;
color3, 96 96 96 255;
text
{
text, "c";
font, "Vera";
size, 14;
fit, 0 0;
align, 0.5 0.5;
}
}
description {
state, "clicked" 0.0;
visible, 1;
rel1 {
relative, 0.0 0.0;
offset, 1 1;
to, "clear_button_image";
} rel2 {
relative, 1.0 1.0;
offset, 1 1;
to, "clear_button_image";
}
color, 255 255 255 255;
color3, 96 96 96 255;
text {
text, "c";
font, "Vera";
size, 14;
fit, 0 0;
align, 0.5 0.5;
}
}
}
#define TEXT_ON(txtrel, txtpname, txtstr) \
part { name, txtpname; type, TEXT; mouse_events, 0; \
effect, SOFT_SHADOW; description { \
state, "default" 0.0; visible, 1; \
rel1 { relative, 0.0 0.0; offset, 0 0; to, txtrel; } \
rel2 { relative, 1.0 1.0; offset, 0 0; to, txtrel; } \
color, 255 255 255 255; color3, 96 96 96 255; \
text { text, txtstr; font, "Vera"; size, 14; \
fit, 0 0; align, 0.5 0.5; } } \
description { \
state, "clicked" 0.0; visible, 1; \
rel1 { relative, 0.0 0.0; offset, 1 1; to, txtrel; } \
rel2 { relative, 1.0 1.0; offset, 1 1; to, txtrel; } \
color, 255 255 255 255; color3, 96 96 96 255; \
text { text, txtstr; font, "Vera"; size, 14; \
fit, 0 0; align, 0.5 0.5; } } }
#define RIGHT_OF(rel, clipname, pname, ptxtname, txt, bw, bh) \
part { name, clipname; type, RECT; mouse_events, 0; \
description { state, "default" 0.0; visible, 1; \
rel1 { relative, 1.0 0.0; offset, 0 0; to, rel; } \
rel2 { relative, 1.0 0.0; offset, bw bh; to, rel; } \
color, 255 255 255 255; } \
description { state, "clicked" 0.0; visible, 1; \
rel1 { relative, 1.0 0.0; offset, 0 0; to, rel; } \
rel2 { relative, 1.0 0.0; offset, bw bh; to, rel; } \
color, 255 255 255 192; } } \
part { name, pname; type, IMAGE; mouse_events, 1; \
clip_to, clipname ; \
description { state, "default" 0.0; visible, 1; \
rel1 { relative, 1.0 0.0; offset, 0 0; to, rel; } \
rel2 { relative, 1.0 0.0; offset, bw bh; to, rel; } \
image { normal, "text_button.png"; border, 0 0 0 6; } \
} } \
TEXT_ON(pname, ptxtname, txt)
#define SOUTH_OF(rel, clipname, pname, ptxtname, txt, bw, bh) \
part { name, clipname; type, RECT; mouse_events, 0; \
description { state, "default" 0.0; visible, 1; \
rel1 { relative, 0.0 1.0; offset, 0 0; to, rel; } \
rel2 { relative, 0.0 1.0; offset, bw bh; to, rel; } \
color, 255 255 255 255; } \
description { state, "clicked" 0.0; visible, 1; \
rel1 { relative, 0.0 1.0; offset, 0 0; to, rel; } \
rel2 { relative, 0.0 1.0; offset, bw bh; to, rel; } \
color, 255 255 255 192; } } \
part { name, pname; type, IMAGE; mouse_events, 1; \
clip_to, clipname ; \
description { state, "default" 0.0; visible, 1; \
rel1 { relative, 0.0 1.0; offset, 0 0; to, rel; } \
rel2 { relative, 0.0 1.0; offset, bw bh; to, rel; } \
image { normal, "text_button.png"; border, 0 2 0 0; } \
} } \
TEXT_ON(pname, ptxtname, txt)
RIGHT_OF("clear_button_image", "clipped_divide", "divide_button_image",
"divide_button_text", "/", 24, 24)
RIGHT_OF("divide_button_image", "clipped_times", "times_button_image",
"times_button_text", "*", 24, 24);
RIGHT_OF("times_button_image", "clipped_minus", "minus_button_image",
"minus_button_text", "-", 24, 24);
SOUTH_OF("clear_button_image", "clipped_seven", "seven_button_image",
"seven_button_text", "7", 24, 24);
RIGHT_OF("seven_button_image", "clipped_eight", "eight_button_image",
"eight_button_text", "8", 24, 24);
RIGHT_OF("eight_button_image", "clipped_nine", "nine_button_image",
"nine_button_text", "9", 24, 24);
RIGHT_OF("nine_button_image", "clipped_plus", "plus_button_image",
"plus_button_text", "+", 24, 48);
SOUTH_OF("seven_button_image", "clipped_four", "four_button_image",
"four_button_text", "4", 24, 24);
RIGHT_OF("four_button_image", "clipped_five", "five_button_image",
"five_button_text", "5", 24, 24);
RIGHT_OF("five_button_image", "clipped_six", "six_button_image",
"six_button_text", "6", 24, 24);
SOUTH_OF("four_button_image", "clipped_one", "one_button_image",
"one_button_text", "1", 24, 24);
RIGHT_OF("one_button_image", "clipped_two", "two_button_image",
"two_button_text", "2", 24, 24);
RIGHT_OF("two_button_image", "clipped_three", "three_button_image",
"three_button_text", "3", 24, 24);
SOUTH_OF("three_button_image", "clipped_decimal", "decimal_button_image",
"decimal_button_text", ".", 24, 24);
SOUTH_OF("one_button_image", "clipped_zero", "zero_button_image",
"zero_button_text", "0", 48, 24);
RIGHT_OF("three_button_image", "clipped_equals", "equals_button_image",
"equals_button_text", "=", 24, 48);
}
programs {
#define BUTTON_CB(pname, bclip, bname, emits, cbin, cbout) \
program { name, pname; signal, "mouse,clicked,1"; source, bname; \
action, SIGNAL_EMIT emits ""; } \
program { name, cbout; signal, "mouse,down,1"; source, bname; \
action, STATE_SET "clicked" 0.0; target, bclip; \
transition, LINEAR 0.1; } \
program { name, cbin; signal, "mouse,up,1"; source, bname; \
action, STATE_SET "default" 0.0; target, bclip; \
transition, DECELERATE 0.2; }
BUTTON_CB("clear_clicked", "clear_button_text", \
"clear_button_image", "OP_CLR", "clearin", "clearout")
BUTTON_CB("divide_clicked", "divide_button_text", \
"divide_button_image", "OP_DIV", "dividein", "divideout")
BUTTON_CB("multiply_clicked", "times_button_text", \
"times_button_image", "OP_MUT", "multiplyin", "multiplyout")
BUTTON_CB("addition_clicked", "plus_button_text", \
"plus_button_image", "OP_ADD", "additionin", "additionout")
BUTTON_CB("subtraction_clicked", "minus_button_text", \
"minus_button_image", "OP_SUB", "minusin", "minusout")
BUTTON_CB("equals_clicked", "equals_button_text", \
"equals_button_image", "OP_EQU", "clippedin", "clippedout")
BUTTON_CB("decimal_clicked", "decimal_button_text", \
"decimal_button_image", "OP_DEC", "decimalin", "decimalout")
BUTTON_CB("zero_clicked", "zero_button_text", \
"zero_button_image", "NUM_0", "zeroin", "zerout")
BUTTON_CB("one_clicked", "one_button_text", \
"one_button_image", "NUM_1", "onein", "oneout")
BUTTON_CB("two_clicked", "two_button_text", \
"two_button_image", "NUM_2", "twoin", "twoout")
BUTTON_CB("three_clicked", "three_button_text", \
"three_button_image", "NUM_3", "threein", "threeout")
BUTTON_CB("four_clicked", "four_button_text", \
"four_button_image", "NUM_4", "fourin", "fourout")
BUTTON_CB("five_clicked", "five_button_text", \
"five_button_image", "NUM_5", "fivein", "fiveout")
BUTTON_CB("six_clicked", "six_button_text", \
"six_button_image", "NUM_6", "sixin", "sixout")
BUTTON_CB("seven_clicked", "seven_button_text", \
"seven_button_image", "NUM_7", "sevenin", "sevenout")
BUTTON_CB("eight_clicked", "eight_button_text", \
"eight_button_image", "NUM_8", "eightin", "eightout")
BUTTON_CB("nine_clicked", "nine_button_text", \
"nine_button_image", "NUM_9", "ninein", "nineout")
}
}
}

View File

@ -5,8 +5,7 @@
#include "calc.h"
static Evas_Object *win;
static Evas_Object *ly;
static Evas_Object *readout;
static const struct
{
@ -56,8 +55,8 @@ static const struct
static void
_signal_cb(void *data, Evas_Object * o, const char *emission, const
char *source)
_button_cb(void *data, Evas_Object * o EINA_UNUSED,
void *event_info EINA_UNUSED)
{
int val = 0;
@ -89,7 +88,7 @@ _signal_cb(void *data, Evas_Object * o, const char *emission, const
break;
case OP_EQU:
snprintf(buf, BUFLEN, "%.10g", equate_eval());
edje_object_part_text_set(o, "EquateAnswer", buf);
elm_object_text_set(readout, buf);
return;
break;
case OP_DEC:
@ -160,84 +159,87 @@ _signal_cb(void *data, Evas_Object * o, const char *emission, const
break;
/* etc */
}
edje_object_part_text_set(o, "EquateAnswer", equate_string_get());
elm_object_text_set(readout, equate_string_get());
}
}
static void
_create_button(Evas_Object *table, const char *text, int op, int x, int y,
int w)
{
Evas_Object *button;
button = elm_button_add(table);
evas_object_size_hint_weight_set(button, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(button, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_object_text_set(button, text);
evas_object_smart_callback_add(button, "clicked", _button_cb, (void *)op);
elm_table_pack(table, button, x, y, w, 1);
evas_object_show(button);
}
static void
_edje_callbacks_define(Evas_Object * o)
_create_buttons(Evas_Object *o)
{
/** Equate Application Callbacks **/
/* EQ_EXIT - Quit Equate */
edje_object_signal_callback_add(o, "EQ_EXIT", "*", _signal_cb,
(void *) EQ_EXIT);
/** Equate Operation Callbacks **/
/** Equate Operations **/
/* OP_CLR - Clear Display */
edje_object_signal_callback_add(o, "OP_CLR", "*", _signal_cb,
(void *) OP_CLR);
_create_button(o, "C", OP_CLR, 3, 2, 1);
/* OP_DIV - Division Operator */
edje_object_signal_callback_add(o, "OP_DIV", "*", _signal_cb,
(void *) OP_DIV);
_create_button(o, "/", OP_DIV, 3, 1, 1);
/* OP_MUT - Mutplication Operator */
edje_object_signal_callback_add(o, "OP_MUT", "*", _signal_cb,
(void *) OP_MUT);
_create_button(o, "*", OP_MUT, 2, 1, 1);
/* OP_ADD - Addition Operator */
edje_object_signal_callback_add(o, "OP_ADD", "*", _signal_cb,
(void *) OP_ADD);
_create_button(o, "+", OP_ADD, 0, 1, 1);
/* OP_SUB - Subtraction Operator */
edje_object_signal_callback_add(o, "OP_SUB", "*", _signal_cb,
(void *) OP_SUB);
_create_button(o, "-", OP_SUB, 1, 1, 1);
/* OP_EQU - Equals Operator */
edje_object_signal_callback_add(o, "OP_EQU", "*", _signal_cb,
(void *) OP_EQU);
/* OP_DEC - Decimal Operator */
edje_object_signal_callback_add(o, "OP_DEC", "*", _signal_cb,
(void *) OP_DEC);
/* OP_SIN - Sin of x in degrees */
edje_object_signal_callback_add(o, "OP_SIN", "*", _signal_cb,
(void *) OP_SIN);
/* OP_COS - Cos of x in degree */
edje_object_signal_callback_add(o, "OP_COS", "*", _signal_cb,
(void *) OP_COS);
/* OP_TAN - Tan of x in degrees */
edje_object_signal_callback_add(o, "OP_TAN", "*", _signal_cb,
(void *) OP_TAN);
/* OP_ROOT - The square root of x */
edje_object_signal_callback_add(o, "OP_ROOT", "*", _signal_cb,
(void *) OP_ROOT);
/* OP_POW - Raise x to the y power */
edje_object_signal_callback_add(o, "OP_POW", "*", _signal_cb,
(void *) OP_POW);
/* OP_LOG - Logarithm */
edje_object_signal_callback_add(o, "OP_LOG", "*", _signal_cb,
(void *) OP_LOG);
/* OP_LN - the natural logarithm */
edje_object_signal_callback_add(o, "OP_LN", "*", _signal_cb, (void *) OP_LN);
/* OP_EXP - e to the x */
edje_object_signal_callback_add(o, "OP_EXP", "*", _signal_cb,
(void *) OP_EXP);
/* OP_OBRAK - open bracket */
edje_object_signal_callback_add(o, "OP_OBRAK", "*", _signal_cb,
(void *) OP_OBRAK);
/* OP_CBRAK - close bracket */
edje_object_signal_callback_add(o, "OP_CBRAK", "*", _signal_cb,
(void *) OP_CBRAK);
_create_button(o, "=", OP_EQU, 2, 5, 2);
/** Equate Number Callbacks **/
edje_object_signal_callback_add(o, "NUM_0", "*", _signal_cb, (void *) NUM_0);
edje_object_signal_callback_add(o, "NUM_1", "*", _signal_cb, (void *) NUM_1);
edje_object_signal_callback_add(o, "NUM_2", "*", _signal_cb, (void *) NUM_2);
edje_object_signal_callback_add(o, "NUM_3", "*", _signal_cb, (void *) NUM_3);
edje_object_signal_callback_add(o, "NUM_4", "*", _signal_cb, (void *) NUM_4);
edje_object_signal_callback_add(o, "NUM_5", "*", _signal_cb, (void *) NUM_5);
edje_object_signal_callback_add(o, "NUM_6", "*", _signal_cb, (void *) NUM_6);
edje_object_signal_callback_add(o, "NUM_7", "*", _signal_cb, (void *) NUM_7);
edje_object_signal_callback_add(o, "NUM_8", "*", _signal_cb, (void *) NUM_8);
edje_object_signal_callback_add(o, "NUM_9", "*", _signal_cb, (void *) NUM_9);
/* OP_DEC - Decimal Operator */
_create_button(o, ".", OP_DEC, 1, 5, 1);
/* OP_SIN - Sin of x in degrees */
// edje_object_signal_callback_add(o, "OP_SIN", "*", _signal_cb,
// (void *) OP_SIN);
/* OP_COS - Cos of x in degree */
// edje_object_signal_callback_add(o, "OP_COS", "*", _signal_cb,
// (void *) OP_COS);
/* OP_TAN - Tan of x in degrees */
// edje_object_signal_callback_add(o, "OP_TAN", "*", _signal_cb,
// (void *) OP_TAN);
/* OP_ROOT - The square root of x */
// edje_object_signal_callback_add(o, "OP_ROOT", "*", _signal_cb,
// (void *) OP_ROOT);
/* OP_POW - Raise x to the y power */
// edje_object_signal_callback_add(o, "OP_POW", "*", _signal_cb,
// (void *) OP_POW);
/* OP_LOG - Logarithm */
// edje_object_signal_callback_add(o, "OP_LOG", "*", _signal_cb,
// (void *) OP_LOG);
/* OP_LN - the natural logarithm */
// edje_object_signal_callback_add(o, "OP_LN", "*", _signal_cb, (void *) OP_LN);
/* OP_EXP - e to the x */
// edje_object_signal_callback_add(o, "OP_EXP", "*", _signal_cb,
// (void *) OP_EXP);
/* OP_OBRAK - open bracket */
_create_button(o, "(", OP_OBRAK, 3, 3, 1);
/* OP_CBRAK - close bracket */
_create_button(o, ")", OP_CBRAK, 3, 4, 1);
/** Equate Numbers **/
_create_button(o, "7", NUM_7, 0, 2, 1);
_create_button(o, "8", NUM_8, 1, 2, 1);
_create_button(o, "9", NUM_9, 2, 2, 1);
_create_button(o, "4", NUM_4, 0, 3, 1);
_create_button(o, "5", NUM_5, 1, 3, 1);
_create_button(o, "6", NUM_6, 2, 3, 1);
_create_button(o, "1", NUM_1, 0, 4, 1);
_create_button(o, "2", NUM_2, 1, 4, 1);
_create_button(o, "3", NUM_3, 2, 4, 1);
_create_button(o, "0", NUM_0, 0, 5, 1);
/* NUM_PI - 3.14159 */
edje_object_signal_callback_add(o, "NUM_PI", "*", _signal_cb, (void *) NUM_PI);
// edje_object_signal_callback_add(o, "NUM_PI", "*", _signal_cb, (void *) NUM_PI);
}
static Eina_Bool
@ -250,37 +252,42 @@ _key_down_cb(void *data, int type, void *event)
{
if (!strcmp(_keymap[i].keyname, ev->key))
{
_signal_cb((void*)_keymap[i].op, elm_layout_edje_get(ly), NULL, NULL);
_button_cb((void*)_keymap[i].op, NULL, NULL);
}
}
return EINA_TRUE;
return EINA_TRUE;
}
static void
_create_gui(void)
{
char buf[1024];
Evas_Object *table;
win = elm_win_add(NULL, "equate", ELM_WIN_BASIC);
elm_win_title_set(win, "Equate");
elm_win_autodel_set(win, EINA_TRUE);
elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
ly = elm_layout_add(win);
snprintf(buf, sizeof(buf), "%s/themes/equate.edj", elm_app_data_dir_get());
elm_layout_file_set(ly, buf, "Main");
evas_object_size_hint_weight_set(ly, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(ly, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_win_resize_object_add(win, ly);
evas_object_show(ly);
table = elm_table_add(win);
elm_table_homogeneous_set(table, EINA_TRUE);
evas_object_size_hint_weight_set(table, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(table, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_win_resize_object_add(win, table);
evas_object_show(table);
ecore_event_handler_add (ECORE_EVENT_KEY_DOWN, _key_down_cb, NULL);
evas_object_show(win);
evas_object_resize(win, 240, 320);
_edje_callbacks_define(elm_layout_edje_get(ly));
readout = elm_label_add(table);
evas_object_size_hint_weight_set(readout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(readout, 1.0, EVAS_HINT_FILL);
elm_table_pack(table, readout, 0, 0, 4, 1);
evas_object_show(readout);
_create_buttons(table);
}
EAPI_MAIN int