summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJin Yoon <jinny.yoon@samsung.com>2015-08-09 12:15:09 +0900
committerJin Yoon <jinny.yoon@samsung.com>2015-08-09 12:15:09 +0900
commit3dea54ed5a52641ecaf7cf9f3c0a2e81f42c9c6f (patch)
tree360dbc406aca6debb9e9a8a9e34961559ac9209b
parent9a0689b0234b17dd224d6ae79781ea948cb13080 (diff)
downloadadventure-3dea54ed5a52641ecaf7cf9f3c0a2e81f42c9c6f.tar.gz
adventure-3dea54ed5a52641ecaf7cf9f3c0a2e81f42c9c6f.tar.bz2
adventure-3dea54ed5a52641ecaf7cf9f3c0a2e81f42c9c6f.zip
Item : intial version for results
-rw-r--r--inc/city.h138
-rw-r--r--inc/item.h15
-rw-r--r--inc/map.h2
-rw-r--r--[-rwxr-xr-x]new/inc/map.h2
-rw-r--r--[-rwxr-xr-x]new/src/map.c2
-rwxr-xr-xres/edje/item.edc41
-rw-r--r--src/city.c718
-rw-r--r--src/item.c288
-rw-r--r--src/main_view.c2
9 files changed, 813 insertions, 395 deletions
diff --git a/inc/city.h b/inc/city.h
index b6226c3..746d0ca 100644
--- a/inc/city.h
+++ b/inc/city.h
@@ -1,68 +1,70 @@
-#ifndef __MOMENT_CITY_H__
-#define __MOMENT_CITY_H__
-
-enum {
- CITY_HONOLULU = 0,
- CITY_LOS_ANGELES,
- CITY_SAN_FRANCISCO,
- CITY_VANCOUVER,
- CITY_CHICAGO,
- CITY_MEICO_CITY,
- CITY_SAN_JOSE,
- CITY_NEW_YORK_CITY,
- CITY_TORONTO,
- CITY_WASHINGTON_DC,
- CITY_BRASILIA,
- CITY_BUENOS_AIRES,
- CITY_SAO_PAULO,
- CITY_DUBLIN,
- CITY_LISBON,
- CITY_LONDON,
- CITY_AMSTERDAM,
- CITY_BARCELONA,
- CITY_BERLIN,
- CITY_BRUSSELS,
- CITY_CAPE_TOWN,
- CITY_GENEVA,
- CITY_MADRID,
- CITY_PARIS,
- CITY_ROME,
- CITY_STOCKHOLM,
- CITY_WARSAW,
- CITY_ANKARA,
- CITY_ATHENS,
- CITY_HELSINKI,
- CITY_ISTANBUL,
- CITY_JERUSALEM,
- CITY_KAHIRA,
- CITY_BAGHDAD,
- CITY_DUBAI,
- CITY_MOSCOW,
- CITY_ISLAMABAD,
- CITY_DELHI,
- CITY_MUMBAI,
- CITY_BOMBAY,
- CITY_CALCUTTA,
- CITY_BANGKOK,
- CITY_JAKARTA,
- CITY_BEIJING,
- CITY_HONG_KONG,
- CITY_SINGAPORE,
- CITY_TAIPEI,
- CITY_SEOUL,
- CITY_TOKYO,
- CITY_SYDNEY,
- CITY_MAX,
-};
-
-struct _city_info_s {
- int id;
- float timezone;
- char *name;
- char *nation;
-};
-typedef struct _city_info_s city_s;
-
-extern city_s *city_get(void);
-
-#endif /* __MOMENT_CITY_H__ */
+#ifndef __MOMENT_CITY_H__
+#define __MOMENT_CITY_H__
+
+enum {
+ CITY_HONOLULU = 0,
+ CITY_LOS_ANGELES,
+ CITY_SAN_FRANCISCO,
+ CITY_VANCOUVER,
+ CITY_CHICAGO,
+ CITY_MEICO_CITY,
+ CITY_SAN_JOSE,
+ CITY_NEW_YORK_CITY,
+ CITY_TORONTO,
+ CITY_WASHINGTON_DC,
+ CITY_BRASILIA,
+ CITY_BUENOS_AIRES,
+ CITY_SAO_PAULO,
+ CITY_DUBLIN,
+ CITY_LISBON,
+ CITY_LONDON,
+ CITY_AMSTERDAM,
+ CITY_BARCELONA,
+ CITY_BERLIN,
+ CITY_BRUSSELS,
+ CITY_CAPE_TOWN,
+ CITY_GENEVA,
+ CITY_MADRID,
+ CITY_PARIS,
+ CITY_ROME,
+ CITY_STOCKHOLM,
+ CITY_WARSAW,
+ CITY_ANKARA,
+ CITY_ATHENS,
+ CITY_HELSINKI,
+ CITY_ISTANBUL,
+ CITY_JERUSALEM,
+ CITY_KAHIRA,
+ CITY_BAGHDAD,
+ CITY_DUBAI,
+ CITY_MOSCOW,
+ CITY_ISLAMABAD,
+ CITY_DELHI,
+ CITY_MUMBAI,
+ CITY_DAKA,
+ CITY_CALCUTTA,
+ CITY_BANGKOK,
+ CITY_JAKARTA,
+ CITY_BEIJING,
+ CITY_HONG_KONG,
+ CITY_SINGAPORE,
+ CITY_TAIPEI,
+ CITY_SEOUL,
+ CITY_TOKYO,
+ CITY_SYDNEY,
+ CITY_MAX,
+};
+
+struct _city_info_s {
+ int id;
+ float timezone;
+ char *name;
+ char *nation;
+ int x;
+ int y;
+};
+typedef struct _city_info_s city_s;
+
+extern city_s *city_get(void);
+
+#endif /* __MOMENT_CITY_H__ */
diff --git a/inc/item.h b/inc/item.h
index e69de29..ecf2300 100644
--- a/inc/item.h
+++ b/inc/item.h
@@ -0,0 +1,15 @@
+#ifndef __MOMENTIC_ITEM_H__
+#define __MOMENTIC_ITEM_H__
+
+#include <Elementary.h>
+
+extern Evas_Object *item_create_typing(Evas_Object *parent, int city);
+extern void item_destroy_typing(Evas_Object *item);
+
+extern Evas_Object *item_create_selecting(Evas_Object *parent, int city, int color);
+extern void item_destroy_selecting(Evas_Object *item);
+
+extern Evas_Object *item_create_result(Evas_Object *parent, int city, int color, int start, int end, struct tm *global_time);
+extern void item_destroy_result(Evas_Object *item);
+
+#endif /* __MOMENTIC_ITEM_H__ */
diff --git a/inc/map.h b/inc/map.h
index 3cc9b5d..c619769 100644
--- a/inc/map.h
+++ b/inc/map.h
@@ -41,7 +41,7 @@ enum {
CITY_ISLAMABAD,
CITY_DELHI,
CITY_MUMBAI,
- CITY_BOMBAY,
+ CITY_DAKA,
CITY_CALCUTTA,
CITY_BANGKOK,
CITY_JAKARTA,
diff --git a/new/inc/map.h b/new/inc/map.h
index a5b4878..06461f2 100755..100644
--- a/new/inc/map.h
+++ b/new/inc/map.h
@@ -41,7 +41,7 @@ enum {
CITY_ISLAMABAD,
CITY_DELHI,
CITY_MUMBAI,
- CITY_BOMBAY,
+ CITY_DAKA,
CITY_CALCUTTA,
CITY_BANGKOK,
CITY_JAKARTA,
diff --git a/new/src/map.c b/new/src/map.c
index e5da519..a2aa2de 100755..100644
--- a/new/src/map.c
+++ b/new/src/map.c
@@ -241,7 +241,7 @@ static city_info_s cities[] = {
.nation = "India",
},
{
- .id = CITY_BOMBAY,
+ .id = CITY_DAKA,
.timezone = 6.0,
.name = "Bombay",
.nation = "India",
diff --git a/res/edje/item.edc b/res/edje/item.edc
index 7fc3c93..682f57c 100755
--- a/res/edje/item.edc
+++ b/res/edje/item.edc
@@ -77,22 +77,22 @@ collections {
program {
signal: "mouse,down,1";
source: "city_event";
- action: SIGNAL_EMIT "delete,down" "entry";
- after: "delete,down,after";
+ action: SIGNAL_EMIT "down" "item";
+ after: "down,after";
}
program {
- name: "delete,down,after";
+ name: "down,after";
action: STATE_SET "press" 0.0;
target: "city";
}
program {
signal: "mouse,up,1";
source: "city_event";
- action: SIGNAL_EMIT "delete,up" "entry";
- after: "delete,up,after";
+ action: SIGNAL_EMIT "up" "item";
+ after: "up,after";
}
program {
- name: "delete,up,after";
+ name: "up,after";
action: STATE_SET "default" 0.0;
target: "city";
}
@@ -248,9 +248,34 @@ collections {
} //parts
programs {
program {
+ signal: "1";
+ source: "mark";
+ action: STATE_SET "1" 0.0;
+ target: "mark";
+ }
+ program {
+ signal: "2";
+ source: "mark";
+ action: STATE_SET "2" 0.0;
+ target: "mark";
+ }
+ program {
+ signal: "3";
+ source: "mark";
+ action: STATE_SET "3" 0.0;
+ target: "mark";
+ }
+ program {
+ signal: "4";
+ source: "mark";
+ action: STATE_SET "4" 0.0;
+ target: "mark";
+ }
+
+ program {
signal: "mouse,down,1";
source: "delete_event";
- action: SIGNAL_EMIT "delete,down" "entry";
+ action: SIGNAL_EMIT "delete,down" "item";
after: "delete,down,after";
}
program {
@@ -261,7 +286,7 @@ collections {
program {
signal: "mouse,up,1";
source: "delete_event";
- action: SIGNAL_EMIT "delete,up" "entry";
+ action: SIGNAL_EMIT "delete,up" "item";
after: "delete,up,after";
}
program {
diff --git a/src/city.c b/src/city.c
index 936a754..2a40f57 100644
--- a/src/city.c
+++ b/src/city.c
@@ -1,309 +1,409 @@
-#include "city.h"
-
-static city_s cities[] = {
- {
- .id = CITY_HONOLULU,
- .timezone = -10.0,
- .name = "Honolulu",
- .nation = "USA",
- },
- {
- .id = CITY_LOS_ANGELES,
- .timezone = -8.0,
- .name = "Los Angeles",
- .nation = "USA",
- },
- {
- .id = CITY_SAN_FRANCISCO,
- .timezone = -8.0,
- .name = "San Francisco",
- .nation = "USA",
- },
- {
- .id = CITY_VANCOUVER,
- .timezone = -8.0,
- .name = "Vancouver",
- .nation = "Canada",
- },
- {
- .id = CITY_CHICAGO,
- .timezone = -6.0,
- .name = "Chicago",
- .nation = "USA",
- },
- {
- .id = CITY_MEICO_CITY,
- .timezone = -6.0,
- .name = "Mexico City",
- .nation = "Mexico",
- },
- {
- .id = CITY_SAN_JOSE,
- .timezone = -6.0,
- .name = "San Jose",
- .nation = "Costa Rica",
- },
- {
- .id = CITY_NEW_YORK_CITY,
- .timezone = -5.0,
- .name = "New York City",
- .nation = "USA",
- },
- {
- .id = CITY_TORONTO,
- .timezone = -5.0,
- .name = "Toronto",
- .nation = "Canada",
- },
- {
- .id = CITY_WASHINGTON_DC,
- .timezone = -5.0,
- .name = "Washington DC",
- .nation = "USA",
- },
- {
- .id = CITY_BRASILIA,
- .timezone = -3.0,
- .name = "Brasilia",
- .nation = "Brazil",
- },
- {
- .id = CITY_BUENOS_AIRES,
- .timezone = -3.0,
- .name = "Buenos Aires",
- .nation = "Argentina",
- },
- {
- .id = CITY_SAO_PAULO,
- .timezone = -3.0,
- .name = "Sao Paulo",
- .nation = "Brazil",
- },
- {
- .id = CITY_DUBLIN,
- .timezone = 0.0,
- .name = "Dublin",
- .nation = "Ireland",
- },
- {
- .id = CITY_LISBON,
- .timezone = 0.0,
- .name = "Lisbon",
- .nation = "Portugal",
- },
- {
- .id = CITY_LONDON,
- .timezone = 0.0,
- .name = "London",
- .nation = "England",
- },
- {
- .id = CITY_AMSTERDAM,
- .timezone = 1.0,
- .name = "Amsterdam",
- .nation = "Netherlands",
- },
- {
- .id = CITY_BARCELONA,
- .timezone = 1.0,
- .name = "Barcelona",
- .nation = "Spain",
- },
- {
- .id = CITY_BERLIN,
- .timezone = 1.0,
- .name = "Berlin",
- .nation = "Germany",
- },
- {
- .id = CITY_BRUSSELS,
- .timezone = 1.0,
- .name = "Brussels",
- .nation = "Belgium",
- },
- {
- .id = CITY_CAPE_TOWN,
- .timezone = 1.0,
- .name = "Cape Town",
- .nation = "South Africa",
- },
- {
- .id = CITY_GENEVA,
- .timezone = 1.0,
- .name = "Geneva",
- .nation = "Switzerland",
- },
- {
- .id = CITY_MADRID,
- .timezone = 1.0,
- .name = "Madrid",
- .nation = "Spain",
- },
- {
- .id = CITY_PARIS,
- .timezone = 1.0,
- .name = "Paris",
- .nation = "France",
- },
- {
- .id = CITY_ROME,
- .timezone = 1.0,
- .name = "Rome",
- .nation = "Italy",
- },
- {
- .id = CITY_STOCKHOLM,
- .timezone = 1.0,
- .name = "Stockholm",
- .nation = "Sweden",
- },
- {
- .id = CITY_WARSAW,
- .timezone = 1.0,
- .name = "Warsaw",
- .nation = "Poland",
- },
- {
- .id = CITY_ANKARA,
- .timezone = 2.0,
- .name = "Ankara",
- .nation = "Turkey",
- },
- {
- .id = CITY_ATHENS,
- .timezone = 2.0,
- .name = "Athens",
- .nation = "Greece",
- },
- {
- .id = CITY_HELSINKI,
- .timezone = 2.0,
- .name = "Helsinki",
- .nation = "Finland",
- },
- {
- .id = CITY_ISTANBUL,
- .timezone = 2.0,
- .name = "Istanbul",
- .nation = "Turkey",
- },
- {
- .id = CITY_JERUSALEM,
- .timezone = 2.0,
- .name = "Jerusalem",
- .nation = "Israel",
- },
- {
- .id = CITY_KAHIRA,
- .timezone = 2.0,
- .name = "Jerusalem",
- .nation = "Egypt",
- },
- {
- .id = CITY_BAGHDAD,
- .timezone = 3.0,
- .name = "Baghdad",
- .nation = "Iraq",
- },
- {
- .id = CITY_DUBAI,
- .timezone = 3.0,
- .name = "Dubai",
- .nation = "United Arab Emirates",
- },
- {
- .id = CITY_MOSCOW,
- .timezone = 3.0,
- .name = "Moscow",
- .nation = "Russia",
- },
- {
- .id = CITY_ISLAMABAD,
- .timezone = 5.0,
- .name = "Islamabad",
- .nation = "Pakistan",
- },
- {
- .id = CITY_DELHI,
- .timezone = 5.5,
- .name = "Delhi",
- .nation = "India",
- },
- {
- .id = CITY_MUMBAI,
- .timezone = 5.5,
- .name = "Mumbai",
- .nation = "India",
- },
- {
- .id = CITY_BOMBAY,
- .timezone = 6.0,
- .name = "Bombay",
- .nation = "India",
- },
- {
- .id = CITY_CALCUTTA,
- .timezone = 6.0,
- .name = "Calcutta",
- .nation = "India",
- },
- {
- .id = CITY_BANGKOK,
- .timezone = 7.0,
- .name = "Bangkok",
- .nation = "Thailand",
- },
- {
- .id = CITY_JAKARTA,
- .timezone = 7.0,
- .name = "Jakarta",
- .nation = "Indonesia",
- },
- {
- .id = CITY_BEIJING,
- .timezone = 8.0,
- .name = "Beijing",
- .nation = "China",
- },
- {
- .id = CITY_HONG_KONG,
- .timezone = 8.0,
- .name = "Hong Kong",
- .nation = "China",
- },
- {
- .id = CITY_SINGAPORE,
- .timezone = 8.0,
- .name = "Singapore",
- .nation = "Singapore",
- },
- {
- .id = CITY_TAIPEI,
- .timezone = 8.0,
- .name = "Taipei",
- .nation = "Thaiwan",
- },
- {
- .id = CITY_SEOUL,
- .timezone = 9.0,
- .name = "Seoul",
- .nation = "Korea",
- },
- {
- .id = CITY_TOKYO,
- .timezone = 9.0,
- .name = "Tokyo",
- .nation = "Japan",
- },
- {
- .id = CITY_SYDNEY,
- .timezone = 10.0,
- .name = "Sydney",
- .nation = "Australia",
- },
-};
-
-city_s *city_get(void)
-{
- return cities;
-}
+#include "city.h"
+
+static city_s cities[] = {
+ {
+ .id = CITY_HONOLULU,
+ .timezone = -10.0,
+ .name = "Honolulu",
+ .nation = "USA",
+ .x = 17,
+ .y = 161,
+ },
+ {
+ .id = CITY_LOS_ANGELES,
+ .timezone = -8.0,
+ .name = "Los Angeles",
+ .nation = "USA",
+ .x = 59,
+ .y = 143,
+ },
+ {
+ .id = CITY_SAN_FRANCISCO,
+ .timezone = -8.0,
+ .name = "San Francisco",
+ .nation = "USA",
+ .x = 54,
+ .y = 139,
+ },
+ {
+ .id = CITY_VANCOUVER,
+ .timezone = -8.0,
+ .name = "Vancouver",
+ .nation = "Canada",
+ .x = 52,
+ .y = 119,
+ },
+ {
+ .id = CITY_CHICAGO,
+ .timezone = -6.0,
+ .name = "Chicago",
+ .nation = "USA",
+ .x = 93,
+ .y = 131,
+ },
+ {
+ .id = CITY_MEICO_CITY,
+ .timezone = -6.0,
+ .name = "Mexico City",
+ .nation = "Mexico",
+ .x = 80,
+ .y = 163,
+ },
+ {
+ .id = CITY_SAN_JOSE,
+ .timezone = -6.0,
+ .name = "San Jose",
+ .nation = "Costa Rica",
+ .x = 96,
+ .y = 172,
+ },
+ {
+ .id = CITY_NEW_YORK_CITY,
+ .timezone = -5.0,
+ .name = "New York City",
+ .nation = "USA",
+ .x = 111,
+ .y = 113,
+ },
+ {
+ .id = CITY_TORONTO,
+ .timezone = -5.0,
+ .name = "Toronto",
+ .nation = "Canada",
+ .x = 103,
+ .y = 129,
+ },
+ {
+ .id = CITY_WASHINGTON_DC,
+ .timezone = -5.0,
+ .name = "Washington DC",
+ .nation = "USA",
+ .x = 107,
+ .y = 137,
+ },
+ {
+ .id = CITY_BRASILIA,
+ .timezone = -3.0,
+ .name = "Brasilia",
+ .nation = "Brazil",
+ .x = 139,
+ .y = 202,
+ },
+ {
+ .id = CITY_BUENOS_AIRES,
+ .timezone = -3.0,
+ .name = "Buenos Aires",
+ .nation = "Argentina",
+ .x = 128,
+ .y = 224,
+ },
+ {
+ .id = CITY_SAO_PAULO,
+ .timezone = -3.0,
+ .name = "Sao Paulo",
+ .nation = "Brazil",
+ .x = 142,
+ .y = 210,
+ },
+ {
+ .id = CITY_DUBLIN,
+ .timezone = 0.0,
+ .name = "Dublin",
+ .nation = "Ireland",
+ .x = 216,
+ .y = 113,
+ },
+ {
+ .id = CITY_LISBON,
+ .timezone = 0.0,
+ .name = "Lisbon",
+ .nation = "Portugal",
+ .x = 214,
+ .y = 138,
+ },
+ {
+ .id = CITY_LONDON,
+ .timezone = 0.0,
+ .name = "London",
+ .nation = "England",
+ .x = 223,
+ .y = 116,
+ },
+ {
+ .id = CITY_AMSTERDAM,
+ .timezone = 1.0,
+ .name = "Amsterdam",
+ .nation = "Netherlands",
+ .x = 230,
+ .y = 114,
+ },
+ {
+ .id = CITY_BARCELONA,
+ .timezone = 1.0,
+ .name = "Barcelona",
+ .nation = "Spain",
+ .x = 226,
+ .y = 133,
+ },
+ {
+ .id = CITY_BERLIN,
+ .timezone = 1.0,
+ .name = "Berlin",
+ .nation = "Germany",
+ .x = 240,
+ .y = 116,
+ },
+ {
+ .id = CITY_BRUSSELS,
+ .timezone = 1.0,
+ .name = "Brussels",
+ .nation = "Belgium",
+ .x = 227,
+ .y = 117,
+ },
+ {
+ .id = CITY_CAPE_TOWN,
+ .timezone = 1.0,
+ .name = "Cape Town",
+ .nation = "South Africa",
+ .x = 245,
+ .y = 224,
+ },
+ {
+ .id = CITY_GENEVA,
+ .timezone = 1.0,
+ .name = "Geneva",
+ .nation = "Switzerland",
+ .x = 230,
+ .y = 125,
+ },
+ {
+ .id = CITY_MADRID,
+ .timezone = 1.0,
+ .name = "Madrid",
+ .nation = "Spain",
+ .x = 219,
+ .y = 135,
+ },
+ {
+ .id = CITY_PARIS,
+ .timezone = 1.0,
+ .name = "Paris",
+ .nation = "France",
+ .x = 227,
+ .y = 120,
+ },
+ {
+ .id = CITY_ROME,
+ .timezone = 1.0,
+ .name = "Rome",
+ .nation = "Italy",
+ .x = 239,
+ .y = 132,
+ },
+ {
+ .id = CITY_STOCKHOLM,
+ .timezone = 1.0,
+ .name = "Stockholm",
+ .nation = "Sweden",
+ .x = 244,
+ .y = 101,
+ },
+ {
+ .id = CITY_WARSAW,
+ .timezone = 1.0,
+ .name = "Warsaw",
+ .nation = "Poland",
+ .x = 248,
+ .y = 117,
+ },
+ {
+ .id = CITY_ANKARA,
+ .timezone = 2.0,
+ .name = "Ankara",
+ .nation = "Turkey",
+ .x = 261,
+ .y = 135,
+ },
+ {
+ .id = CITY_ATHENS,
+ .timezone = 2.0,
+ .name = "Athens",
+ .nation = "Greece",
+ .x = 251,
+ .y = 138,
+ },
+ {
+ .id = CITY_HELSINKI,
+ .timezone = 2.0,
+ .name = "Helsinki",
+ .nation = "Finland",
+ .x = 252,
+ .y = 98,
+ },
+ {
+ .id = CITY_ISTANBUL,
+ .timezone = 2.0,
+ .name = "Istanbul",
+ .nation = "Turkey",
+ .x = 256,
+ .y = 113,
+ },
+ {
+ .id = CITY_JERUSALEM,
+ .timezone = 2.0,
+ .name = "Jerusalem",
+ .nation = "Israel",
+ .x = 265,
+ .y = 147,
+ },
+ {
+ .id = CITY_KAHIRA,
+ .timezone = 2.0,
+ .name = "Jerusalem",
+ .nation = "Egypt",
+ .x = 260,
+ .y = 150,
+ },
+ {
+ .id = CITY_BAGHDAD,
+ .timezone = 3.0,
+ .name = "Baghdad",
+ .nation = "Iraq",
+ .x = 275,
+ .y = 144,
+ },
+ {
+ .id = CITY_DUBAI,
+ .timezone = 3.0,
+ .name = "Dubai",
+ .nation = "United Arab Emirates",
+ .x = 287,
+ .y = 156,
+ },
+ {
+ .id = CITY_MOSCOW,
+ .timezone = 3.0,
+ .name = "Moscow",
+ .nation = "Russia",
+ .x = 265,
+ .y = 109,
+ },
+ {
+ .id = CITY_ISLAMABAD,
+ .timezone = 5.0,
+ .name = "Islamabad",
+ .nation = "Pakistan",
+ .x = 308,
+ .y = 146,
+ },
+ {
+ .id = CITY_DELHI,
+ .timezone = 5.5,
+ .name = "New Delhi",
+ .nation = "India",
+ .x = 312,
+ .y = 153,
+ },
+ {
+ .id = CITY_MUMBAI,
+ .timezone = 5.5,
+ .name = "Mumbai",
+ .nation = "India",
+ .x = 308,
+ .y = 162,
+ },
+ {
+ .id = CITY_CALCUTTA,
+ .timezone = 5.5,
+ .name = "Calcutta",
+ .nation = "India",
+ .x = 326,
+ .y = 157,
+ },
+ {
+ .id = CITY_DAKA,
+ .timezone = 6.0,
+ .name = "Daka",
+ .nation = "Bangladesh",
+ .x = 328,
+ .y = 156,
+ },
+ {
+ .id = CITY_BANGKOK,
+ .timezone = 7.0,
+ .name = "Bangkok",
+ .nation = "Thailand",
+ .x = 341,
+ .y = 169,
+ },
+ {
+ .id = CITY_JAKARTA,
+ .timezone = 7.0,
+ .name = "Jakarta",
+ .nation = "Indonesia",
+ .x = 349,
+ .y = 191,
+ },
+ {
+ .id = CITY_BEIJING,
+ .timezone = 8.0,
+ .name = "Beijing",
+ .nation = "China",
+ .x = 356,
+ .y = 135,
+ },
+ {
+ .id = CITY_HONG_KONG,
+ .timezone = 8.0,
+ .name = "Hong Kong",
+ .nation = "China",
+ .x = 354,
+ .y = 159,
+ },
+ {
+ .id = CITY_SINGAPORE,
+ .timezone = 8.0,
+ .name = "Singapore",
+ .nation = "Singapore",
+ .x = 343,
+ .y = 182,
+ },
+ {
+ .id = CITY_TAIPEI,
+ .timezone = 8.0,
+ .name = "Taipei",
+ .nation = "Thaiwan",
+ .x = 364,
+ .y = 156,
+ },
+ {
+ .id = CITY_SEOUL,
+ .timezone = 9.0,
+ .name = "Seoul",
+ .nation = "Korea",
+ .x = 371,
+ .y = 139,
+ },
+ {
+ .id = CITY_TOKYO,
+ .timezone = 9.0,
+ .name = "Tokyo",
+ .nation = "Japan",
+ .x = 384,
+ .y = 141,
+ },
+ {
+ .id = CITY_SYDNEY,
+ .timezone = 10.0,
+ .name = "Sydney",
+ .nation = "Australia",
+ .x = 398,
+ .y = 223,
+ },
+};
+
+city_s *city_get(void)
+{
+ return cities;
+}
diff --git a/src/item.c b/src/item.c
index 8fe3e72..e1f40e5 100644
--- a/src/item.c
+++ b/src/item.c
@@ -3,15 +3,27 @@
#include <time.h>
#include <stdio.h>
#include <stdlib.h>
+#include <app.h>
#include "log.h"
#include "util.h"
+#include "city.h"
+#include "item.h"
+
+#define _EDJ(o) elm_layout_edje_get(o)
+
+struct _result_info_s {
+ Evas_Object *rect1;
+ Evas_Object *rect2;
+ int start;
+ int end;
+};
+typedef struct _result_info_s result_info_s;
const char *const ITEM_EDJE = "item.edj";
-void item_set_local_timezone(Evas_Object *item)
+void _text_set_here_time(Evas_Object *item, const char *part)
{
- /* http://tizen.org/privilege/systemsettings */
char *timezone_str = NULL;
struct tm *local_time = NULL;
@@ -19,6 +31,9 @@ void item_set_local_timezone(Evas_Object *item)
time_t t = 0;
char time_result[PATH_LEN] = {0, };
+ ret_if(!item);
+ ret_if(!part);
+
local_time = localtime(&t);
ret_if(!local_time);
@@ -29,22 +44,107 @@ void item_set_local_timezone(Evas_Object *item)
/* Timezone
Asia/Seoul
*/
-
if (local_time->tm_gmtoff >= 0)
- snprintf(time_result, sizeof(time_result), "%s, +%d", timezone_str, local_time->tm_gmtoff / 3600);
+ snprintf(time_result, sizeof(time_result), "%s, +%ld", timezone_str, local_time->tm_gmtoff / 3600);
else
- snprintf(time_result, sizeof(time_result), "%s, %d", timezone_str, local_time->tm_gmtoff / 3600);
+ snprintf(time_result, sizeof(time_result), "%s, %ld", timezone_str, local_time->tm_gmtoff / 3600);
free(timezone_str);
+
+ elm_object_part_text_set(item, part, timezone_str);
+}
+
+static void _item_down_cb(void *data, Evas_Object *obj, const char *emission, const char *source)
+{
+ _D("An item is down");
+}
+
+static void _item_up_cb(void *data, Evas_Object *obj, const char *emission, const char *source)
+{
+ Evas_Object *item= obj;
+
+ ret_if(!item);
+
+ _D("An item is selected");
+
+ /* Append to the selecting scroller */
+}
+
+Evas_Object *item_create_typing(Evas_Object *parent, int city)
+{
+ Evas_Object *item = NULL;
+ city_s *city_info = NULL;
+
+ char *path = NULL;
+ char full_path[PATH_LEN] = {0, };
+ char city_str[PATH_LEN] = {0, };
+
+ retv_if(!parent, NULL);
+
+ path = app_get_resource_path();
+ retv_if(!path, NULL);
+
+ snprintf(full_path, sizeof(full_path), "%s/edje/%s", path, ITEM_EDJE);
+ free(path);
+
+ item = elm_layout_add(parent);
+ retv_if(!item, NULL);
+
+ elm_layout_file_set(item, ITEM_EDJE, "item_typing");
+
+ evas_object_size_hint_weight_set(item, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(item, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_show(item);
+
+ city_info = city_get();
+ if (!city_info) {
+ _E("Critical, no city information");
+ evas_object_del(item);
+ return NULL;
+ }
+
+ snprintf(city_str, sizeof(city_str), "%s", city_info[city].name);
+ elm_object_part_text_set(item, "city", city_str);
+
+ elm_object_signal_callback_add(item, "down", "item", _item_down_cb, NULL);
+ elm_object_signal_callback_add(item, "up", "item", _item_up_cb, NULL);
+
+ return item;
+}
+
+void item_destroy_typing(Evas_Object *item)
+{
+ ret_if(!item);
+
+ elm_object_signal_callback_del(item, "down", "item", _item_down_cb);
+ elm_object_signal_callback_del(item, "up", "item", _item_up_cb);
+
+ evas_object_del(item);
+}
+
+static void _delete_down_cb(void *data, Evas_Object *obj, const char *emission, const char *source)
+{
+ _D("Delete button is down");
+}
+
+static void _delete_up_cb(void *data, Evas_Object *obj, const char *emission, const char *source)
+{
+ Evas_Object *item= obj;
+
+ ret_if(!item);
+
+ item_destroy_selecting(item);
}
-#if 0
Evas_Object *item_create_selecting(Evas_Object *parent, int city, int color)
{
Evas_Object *item = NULL;
+ city_s *city_info = NULL;
char *path = NULL;
char full_path[PATH_LEN] = {0, };
+ char city_str[PATH_LEN] = {0, };
+ char color_str[16] = {0, };
retv_if(!parent, NULL);
@@ -63,6 +163,180 @@ Evas_Object *item_create_selecting(Evas_Object *parent, int city, int color)
evas_object_size_hint_align_set(item, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_show(item);
+ city_info = city_get();
+ if (!city_info) {
+ _E("Critical, no city information");
+ evas_object_del(item);
+ return NULL;
+ }
+
+ snprintf(city_str, sizeof(city_str), "%s, %s", city_info[city].name, city_info[city].nation);
+ elm_object_part_text_set(item, "city", city_str);
+
+ snprintf(color_str, sizeof(color_str), "%d", color);
+ elm_object_signal_emit(item, color_str, "mark");
+
+ elm_object_signal_callback_add(item, "delete,down", "item", _delete_down_cb, NULL);
+ elm_object_signal_callback_add(item, "delete,up", "item", _delete_up_cb, NULL);
+
+ return item;
+}
+
+void item_destroy_selecting(Evas_Object *item)
+{
+ ret_if(!item);
+
+ elm_object_signal_callback_del(item, "delete,down", "item", _delete_down_cb);
+ elm_object_signal_callback_del(item, "delete,up", "item", _delete_up_cb);
+
+ evas_object_del(item);
+}
+
+void _text_set_local_time(Evas_Object *item, const char *part, int city, struct tm *global_time)
+{
+ city_s *city_info = NULL;
+ int hour = global_time->tm_hour;
+ int minute = global_time->tm_min;
+
+ char time_result[PATH_LEN] = {0, };
+
+ ret_if(!item);
+ ret_if(!part);
+
+ city_info = city_get();
+ ret_if(!city_info);
+
+ if (((double) ((int) city_info[city].timezone)) < city_info[city].timezone) {
+ minute += 30;
+ if (minute > 60) {
+ hour++;
+ minute -= 60;
+ }
+ }
+
+ snprintf(time_result, sizeof(time_result), "%d:%d", hour, minute);
+ elm_object_part_text_set(item, part, time_result);
+}
+
+static void _resize_graph_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
+{
+ result_info_s *result_info = NULL;
+ int x, y, w, h;
+ int start_x = 0;
+
+ edje_object_part_geometry_get(_EDJ(obj), "graph_base", &x, &y, &w, &h);
+
+ if (result_info->start > result_info->end) {
+ evas_object_move(result_info->rect2, x, y);
+ evas_object_resize(result_info->rect2, w / 10.0, h);
+ evas_object_color_set(result_info->rect2, 0, 0, 0, 255);
+ evas_object_show(result_info->rect2);
+ } else {
+ evas_object_hide(result_info->rect2);
+ }
+
+ start_x = (result_info->start / 24.0f) * w + x;
+
+ evas_object_move(result_info->rect1, start_x, y);
+ evas_object_resize(result_info->rect1, x + w - start_x, h);
+ evas_object_color_set(result_info->rect1, 0, 0, 0, 255);
+ evas_object_show(result_info->rect1);
+}
+
+Evas_Object *item_create_result(Evas_Object *parent, int city, int color, int start, int end, struct tm *global_time)
+{
+ Evas_Object *item = NULL;
+ city_s *city_info = NULL;
+ result_info_s *result_info = NULL;
+ Evas *e = NULL;
+
+ char *path = NULL;
+ char full_path[PATH_LEN] = {0, };
+ char city_str[PATH_LEN] = {0, };
+ char color_str[16] = {0, };
+
+ retv_if(!parent, NULL);
+
+ path = app_get_resource_path();
+ retv_if(!path, NULL);
+
+ snprintf(full_path, sizeof(full_path), "%s/edje/%s", path, ITEM_EDJE);
+ free(path);
+
+ result_info = calloc(1, sizeof(result_info_s));
+ retv_if(!result_info, NULL);
+
+ item = elm_layout_add(parent);
+ goto_if(!item, error);
+
+ elm_layout_file_set(item, ITEM_EDJE, "item_result");
+
+ evas_object_size_hint_weight_set(item, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(item, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_data_set(item, "result", result_info);
+ evas_object_show(item);
+
+ city_info = city_get();
+ goto_if(!city_info, error);
+
+ snprintf(city_str, sizeof(city_str), "%s, %s", city_info[city].name, city_info[city].nation);
+ elm_object_part_text_set(item, "city", city_str);
+
+ snprintf(color_str, sizeof(color_str), "%d", color);
+ elm_object_signal_emit(item, color_str, "mark");
+
+ _text_set_local_time(item, "time", city, global_time);
+
+ e = evas_object_evas_get(item);
+ goto_if(!e, error);
+
+ result_info->rect1 = evas_object_rectangle_add(e);
+ goto_if(!result_info->rect1, error);
+
+ result_info->rect2 = evas_object_rectangle_add(e);
+ goto_if(!result_info->rect2, error);
+
+ result_info->start = start;
+ result_info->end = end;
+
+ evas_object_event_callback_add(item, EVAS_CALLBACK_RESIZE, _resize_graph_cb, result_info);
+ evas_object_event_callback_add(item, EVAS_CALLBACK_MOVE, _resize_graph_cb, result_info);
+
return item;
+
+error:
+ if (result_info) {
+ if (result_info->rect1)
+ evas_object_del(result_info->rect1);
+ if (result_info->rect2)
+ evas_object_del(result_info->rect2);
+ free(result_info);
+ }
+
+ if (item)
+ evas_object_del(item);
+
+ free(result_info);
+ return NULL;
+}
+
+void item_destroy_result(Evas_Object *item)
+{
+ result_info_s *result_info = NULL;
+
+ ret_if(!item);
+
+ elm_object_signal_callback_del(item, "delete,down", "item", _delete_down_cb);
+ elm_object_signal_callback_del(item, "delete,up", "item", _delete_up_cb);
+
+ result_info = evas_object_data_del(item, "result");
+ if (result_info) {
+ if (result_info->rect1)
+ evas_object_del(result_info->rect1);
+ if (result_info->rect2)
+ evas_object_del(result_info->rect2);
+ free(result_info);
+ }
+
+ evas_object_del(item);
}
-#endif
diff --git a/src/main_view.c b/src/main_view.c
index 9aee3a4..0c7d00d 100644
--- a/src/main_view.c
+++ b/src/main_view.c
@@ -54,6 +54,8 @@ static void _delete_up_cb(void *data, Evas_Object *obj, const char *emission, co
Evas_Object *entry = obj;
Evas_Object *entry_obj = NULL;
+ ret_if(!entry);
+
entry_obj = elm_object_part_content_get(entry, "entry");
if (entry_obj)
elm_entry_entry_set(entry_obj, "");