Remove edje specific code and use elementary button, table and entry.
|
@ -29,21 +29,17 @@ PKG_PROG_PKG_CONFIG
|
|||
|
||||
### Checks for libraries
|
||||
|
||||
PKG_CHECK_MODULES([EQUATE], [elementary edje ecore-evas ecore ecore-input evas >= 1.0.0])
|
||||
PKG_CHECK_MODULES([EQUATE], [elementary >= 1.7.0])
|
||||
|
||||
|
||||
### Checks for compiler characteristics
|
||||
|
||||
AC_HEADER_STDC
|
||||
|
||||
|
||||
EFL_WITH_BIN([edje], [edje-cc], [edje_cc])
|
||||
|
||||
AC_CONFIG_FILES([
|
||||
Makefile
|
||||
src/Makefile
|
||||
data/Makefile
|
||||
data/images/Makefile
|
||||
])
|
||||
|
||||
AC_OUTPUT
|
||||
|
|
|
@ -1,23 +1,6 @@
|
|||
|
||||
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
|
||||
|
||||
|
@ -25,6 +8,3 @@ icondir = $(datadir)/icons
|
|||
icon_DATA = equate.png
|
||||
|
||||
EXTRA_DIST = $(EDCS) equate.png equate.desktop
|
||||
|
||||
clean-local:
|
||||
rm -f $(EDJS)
|
||||
|
|
271
data/equate.edc
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,3 +0,0 @@
|
|||
Makefile
|
||||
Makefile.in
|
||||
|
|
@ -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
|
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 86 KiB |
Before Width: | Height: | Size: 589 B |
Before Width: | Height: | Size: 456 B |
Before Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 3.5 KiB |
Before Width: | Height: | Size: 2.6 KiB |
Before Width: | Height: | Size: 3.1 KiB |
Before Width: | Height: | Size: 123 B |
Before Width: | Height: | Size: 1.3 KiB |
359
data/text.edc
|
@ -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")
|
||||
}
|
||||
}
|
||||
}
|
188
src/main.c
|
@ -5,8 +5,7 @@
|
|||
#include "calc.h"
|
||||
|
||||
static Evas_Object *win;
|
||||
static Evas_Object *ly;
|
||||
|
||||
static Evas_Object *entry;
|
||||
|
||||
static const struct
|
||||
{
|
||||
|
@ -56,18 +55,12 @@ static const struct
|
|||
|
||||
|
||||
static void
|
||||
_signal_cb(void *data, Evas_Object * o, const char *emission, const
|
||||
char *source)
|
||||
{
|
||||
int val = 0;
|
||||
|
||||
if (data)
|
||||
_calc_do(int op)
|
||||
{
|
||||
double result;
|
||||
char buf[BUFLEN];
|
||||
|
||||
val = (int) data;
|
||||
switch (val)
|
||||
switch (op)
|
||||
{
|
||||
case EQ_EXIT:
|
||||
elm_exit();
|
||||
|
@ -88,8 +81,8 @@ _signal_cb(void *data, Evas_Object * o, const char *emission, const
|
|||
equate_append("-");
|
||||
break;
|
||||
case OP_EQU:
|
||||
snprintf(buf, BUFLEN, "%.10g", equate_eval());
|
||||
edje_object_part_text_set(o, "EquateAnswer", buf);
|
||||
snprintf(buf, BUFLEN, "<title><align=right>%.10g</align></title>", equate_eval());
|
||||
elm_object_text_set(entry, buf);
|
||||
return;
|
||||
break;
|
||||
case OP_DEC:
|
||||
|
@ -156,88 +149,12 @@ _signal_cb(void *data, Evas_Object * o, const char *emission, const
|
|||
equate_append("9");
|
||||
break;
|
||||
default:
|
||||
E(1, "Unknown edje signal operator %d", val);
|
||||
E(1, "Unknown operator %d", op);
|
||||
break;
|
||||
/* etc */
|
||||
}
|
||||
edje_object_part_text_set(o, "EquateAnswer", equate_string_get());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
_edje_callbacks_define(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 **/
|
||||
/* OP_CLR - Clear Display */
|
||||
edje_object_signal_callback_add(o, "OP_CLR", "*", _signal_cb,
|
||||
(void *) OP_CLR);
|
||||
/* OP_DIV - Division Operator */
|
||||
edje_object_signal_callback_add(o, "OP_DIV", "*", _signal_cb,
|
||||
(void *) OP_DIV);
|
||||
/* OP_MUT - Mutplication Operator */
|
||||
edje_object_signal_callback_add(o, "OP_MUT", "*", _signal_cb,
|
||||
(void *) OP_MUT);
|
||||
/* OP_ADD - Addition Operator */
|
||||
edje_object_signal_callback_add(o, "OP_ADD", "*", _signal_cb,
|
||||
(void *) OP_ADD);
|
||||
/* OP_SUB - Subtraction Operator */
|
||||
edje_object_signal_callback_add(o, "OP_SUB", "*", _signal_cb,
|
||||
(void *) OP_SUB);
|
||||
/* 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);
|
||||
|
||||
/** 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);
|
||||
/* NUM_PI - 3.14159 */
|
||||
edje_object_signal_callback_add(o, "NUM_PI", "*", _signal_cb, (void *) NUM_PI);
|
||||
snprintf(buf, BUFLEN, "<title><align=right>%s</align></title>", equate_string_get());
|
||||
elm_object_text_set(entry, buf);
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
|
@ -250,37 +167,100 @@ _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);
|
||||
_calc_do(_keymap[i].op);
|
||||
}
|
||||
}
|
||||
return EINA_TRUE;
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
_bt_clicked(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
|
||||
{
|
||||
int val = (int) data;
|
||||
_calc_do(val);
|
||||
}
|
||||
|
||||
#define BUTTON_ADD(label, x, y, w, h, op) \
|
||||
bt = elm_button_add(tb); \
|
||||
elm_object_text_set(bt, label); \
|
||||
evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); \
|
||||
evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); \
|
||||
evas_object_smart_callback_add(bt, "clicked", _bt_clicked, (void *)op); \
|
||||
elm_table_pack(tb, bt, x, y, w, h); \
|
||||
evas_object_show(bt); \
|
||||
|
||||
|
||||
static Evas_Object *
|
||||
_gui_standard(Evas_Object *parent)
|
||||
{
|
||||
Evas_Object *tb, *bt;
|
||||
tb = elm_table_add(win);
|
||||
elm_table_homogeneous_set(tb, EINA_TRUE);
|
||||
evas_object_size_hint_weight_set(tb, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||
evas_object_show(tb);
|
||||
|
||||
BUTTON_ADD("C", 0, 0, 1, 1, OP_CLR);
|
||||
BUTTON_ADD("(", 1, 0, 1, 1, OP_CBRAK);
|
||||
BUTTON_ADD(")", 2, 0, 1, 1, OP_OBRAK);
|
||||
BUTTON_ADD("/", 3, 0, 1, 1, OP_DIV);
|
||||
|
||||
BUTTON_ADD("7", 0, 1, 1, 1, NUM_7);
|
||||
BUTTON_ADD("8", 1, 1, 1, 1, NUM_8);
|
||||
BUTTON_ADD("9", 2, 1, 1, 1, NUM_9);
|
||||
BUTTON_ADD("x", 3, 1, 1, 1, OP_MUT);
|
||||
|
||||
BUTTON_ADD("4", 0, 2, 1, 1, NUM_4);
|
||||
BUTTON_ADD("5", 1, 2, 1, 1, NUM_5);
|
||||
BUTTON_ADD("6", 2, 2, 1, 1, NUM_6);
|
||||
BUTTON_ADD("-", 3, 2, 1, 1, OP_SUB);
|
||||
|
||||
BUTTON_ADD("1", 0, 3, 1, 1, NUM_1);
|
||||
BUTTON_ADD("2", 1, 3, 1, 1, NUM_2);
|
||||
BUTTON_ADD("3", 2, 3, 1, 1, NUM_3);
|
||||
BUTTON_ADD("+", 3, 3, 1, 1, OP_ADD);
|
||||
|
||||
BUTTON_ADD("0", 0, 4, 2, 1, NUM_0);
|
||||
BUTTON_ADD(".", 2, 4, 1, 1, OP_DEC);
|
||||
BUTTON_ADD("=", 3, 4, 1, 1, OP_EQU);
|
||||
|
||||
return tb;
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
_create_gui(void)
|
||||
{
|
||||
char buf[1024];
|
||||
Evas_Object *tb, *bx;
|
||||
|
||||
win = elm_win_add(NULL, "equate", ELM_WIN_BASIC);
|
||||
elm_win_title_set(win, "Equate");
|
||||
win = elm_win_util_standard_add("equate", "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);
|
||||
bx = elm_box_add(win);
|
||||
evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||
elm_win_resize_object_add(win, bx);
|
||||
evas_object_show(bx);
|
||||
|
||||
entry = elm_entry_add(win);
|
||||
elm_entry_scrollable_set(entry, EINA_TRUE);
|
||||
evas_object_size_hint_weight_set(entry, EVAS_HINT_EXPAND, 0.0);
|
||||
evas_object_size_hint_align_set(entry, EVAS_HINT_FILL, 0.5);
|
||||
elm_scroller_policy_set(entry, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF);
|
||||
elm_object_text_set(entry, "<align=right><title>0</title></align>");
|
||||
elm_entry_single_line_set(entry, EINA_TRUE);
|
||||
elm_box_pack_end(bx, entry);
|
||||
evas_object_show(entry);
|
||||
|
||||
tb = _gui_standard(win);
|
||||
evas_object_size_hint_weight_set(tb, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||
evas_object_size_hint_align_set(tb, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||
elm_box_pack_end(bx, tb);
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
EAPI_MAIN int
|
||||
|
|