summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAl Poole <netstar@gmail.com>2017-11-25 01:20:55 +0000
committerAl Poole <netstar@gmail.com>2017-11-25 01:20:55 +0000
commit0d038974b3bb196f8798a949cd248819e9f1e037 (patch)
tree812bedaeede2bc2a8d5f00052ad0d06fd95a6a54
parent37d44ee15bafdd18c3cd40d4d2868fd906e5d996 (diff)
elm_code: finally get the theme loading from the default EDC.devs/netstar/elm_code_from_theme
Thanks Andy for finding a working API!!!
-rw-r--r--data/elementary/themes/edc/elm/code.edc1
-rw-r--r--src/lib/elementary/elm_code_widget.c113
2 files changed, 38 insertions, 76 deletions
diff --git a/data/elementary/themes/edc/elm/code.edc b/data/elementary/themes/edc/elm/code.edc
index 35444da4ac..608b16f671 100644
--- a/data/elementary/themes/edc/elm/code.edc
+++ b/data/elementary/themes/edc/elm/code.edc
@@ -53,5 +53,6 @@ color_classes {
53 color_class { name: "elm/code/widget/color/selection"; color: 51 153 255 255; } 53 color_class { name: "elm/code/widget/color/selection"; color: 51 153 255 255; }
54 color_class { name: "elm/code/widget/color/gutter/bg"; color: 75 75 75 255; } 54 color_class { name: "elm/code/widget/color/gutter/bg"; color: 75 75 75 255; }
55 color_class { name: "elm/code/widget/color/gutter/fg"; color: 139 139 139 255; } 55 color_class { name: "elm/code/widget/color/gutter/fg"; color: 139 139 139 255; }
56 color_class { name: "elm/code/widget/color/gutter/scope/bg"; color: 54 54 54 255; }
56 color_class { name: "elm/code/widget/color/whitespace"; color: 50 50 50 127; } 57 color_class { name: "elm/code/widget/color/whitespace"; color: 50 50 50 127; }
57} 58}
diff --git a/src/lib/elementary/elm_code_widget.c b/src/lib/elementary/elm_code_widget.c
index 6eb800e1bc..e61aa6afea 100644
--- a/src/lib/elementary/elm_code_widget.c
+++ b/src/lib/elementary/elm_code_widget.c
@@ -1792,93 +1792,54 @@ _elm_code_widget_setup_palette_item(Evas_Object *grid, int type, const char *nam
1792 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL)) 1792 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL))
1793 return; 1793 return;
1794 1794
1795 printf("item %s = color %d,%d,%d,%d\n", name, r, g, b, a);
1796 evas_object_textgrid_palette_set(grid, EVAS_TEXTGRID_PALETTE_STANDARD, type, r, g, b, a); 1795 evas_object_textgrid_palette_set(grid, EVAS_TEXTGRID_PALETTE_STANDARD, type, r, g, b, a);
1797} 1796}
1798 1797
1799static void 1798static void
1800_elm_code_widget_setup_palette(Evas_Object *o, Evas_Object *layout) 1799_elm_code_widget_setup_palette(Evas_Object *o, Evas_Object *layout)
1801{ 1800{
1802 double feint = 0.5;
1803 Evas_Object *edje; 1801 Evas_Object *edje;
1804 1802
1805 edje = elm_layout_edje_get(layout); 1803 edje = elm_layout_edje_get(layout);
1806 1804
1807 // setup status colors 1805 // setup status colors
1808 _elm_code_widget_setup_palette_item(o, ELM_CODE_STATUS_TYPE_DEFAULT, "elm/code/status/default", edje); 1806 _elm_code_widget_setup_palette_item(o, ELM_CODE_STATUS_TYPE_DEFAULT, "elm/code/status/default", edje);
1809 evas_object_textgrid_palette_set(o, EVAS_TEXTGRID_PALETTE_STANDARD, ELM_CODE_STATUS_TYPE_CURRENT, 1807 _elm_code_widget_setup_palette_item(o, ELM_CODE_STATUS_TYPE_CURRENT, "elm/code/status/current", edje);
1810 12, 12, 12, 255); 1808 _elm_code_widget_setup_palette_item(o, ELM_CODE_STATUS_TYPE_IGNORED, "elm/code/status/ignored", edje);
1811 evas_object_textgrid_palette_set(o, EVAS_TEXTGRID_PALETTE_STANDARD, ELM_CODE_STATUS_TYPE_IGNORED, 1809 _elm_code_widget_setup_palette_item(o, ELM_CODE_STATUS_TYPE_NOTE, "elm/code/status/note", edje);
1812 36, 36, 36, 255); 1810 _elm_code_widget_setup_palette_item(o, ELM_CODE_STATUS_TYPE_WARNING, "elm/code/status/warning", edje);
1813 evas_object_textgrid_palette_set(o, EVAS_TEXTGRID_PALETTE_STANDARD, ELM_CODE_STATUS_TYPE_NOTE, 1811 _elm_code_widget_setup_palette_item(o, ELM_CODE_STATUS_TYPE_ERROR, "elm/code/status/error", edje);
1814 221, 119, 17, 255); 1812 _elm_code_widget_setup_palette_item(o, ELM_CODE_STATUS_TYPE_FATAL, "elm/code/status/fatal", edje);
1815 evas_object_textgrid_palette_set(o, EVAS_TEXTGRID_PALETTE_STANDARD, ELM_CODE_STATUS_TYPE_WARNING, 1813 _elm_code_widget_setup_palette_item(o, ELM_CODE_STATUS_TYPE_ADDED, "elm/code/status/added", edje);
1816 221, 119, 17, 255); 1814 _elm_code_widget_setup_palette_item(o, ELM_CODE_STATUS_TYPE_REMOVED, "elm/code/status/removed", edje);
1817 evas_object_textgrid_palette_set(o, EVAS_TEXTGRID_PALETTE_STANDARD, ELM_CODE_STATUS_TYPE_ERROR, 1815 _elm_code_widget_setup_palette_item(o, ELM_CODE_STATUS_TYPE_CHANGED, "elm/code/status/changed", edje);
1818 204, 17, 17, 255); 1816 _elm_code_widget_setup_palette_item(o, ELM_CODE_STATUS_TYPE_PASSED, "elm/code/status/passed", edje);
1819 evas_object_textgrid_palette_set(o, EVAS_TEXTGRID_PALETTE_STANDARD, ELM_CODE_STATUS_TYPE_FATAL, 1817 _elm_code_widget_setup_palette_item(o, ELM_CODE_STATUS_TYPE_FAILED, "elm/code/status/failed", edje);
1820 204, 17, 17, 255); 1818 _elm_code_widget_setup_palette_item(o, ELM_CODE_STATUS_TYPE_TODO, "elm/code/status/todo", edje);
1821
1822 evas_object_textgrid_palette_set(o, EVAS_TEXTGRID_PALETTE_STANDARD, ELM_CODE_STATUS_TYPE_ADDED,
1823 36, 96, 36, 255);
1824 evas_object_textgrid_palette_set(o, EVAS_TEXTGRID_PALETTE_STANDARD, ELM_CODE_STATUS_TYPE_REMOVED,
1825 96, 36, 36, 255);
1826 evas_object_textgrid_palette_set(o, EVAS_TEXTGRID_PALETTE_STANDARD, ELM_CODE_STATUS_TYPE_CHANGED,
1827 36, 36, 96, 255);
1828
1829 evas_object_textgrid_palette_set(o, EVAS_TEXTGRID_PALETTE_STANDARD, ELM_CODE_STATUS_TYPE_PASSED,
1830 54, 96, 54, 255);
1831 evas_object_textgrid_palette_set(o, EVAS_TEXTGRID_PALETTE_STANDARD, ELM_CODE_STATUS_TYPE_FAILED,
1832 96, 54, 54, 255);
1833
1834 evas_object_textgrid_palette_set(o, EVAS_TEXTGRID_PALETTE_STANDARD, ELM_CODE_STATUS_TYPE_TODO,
1835 51, 85, 187, 255);
1836 1819
1837 // setup token colors 1820 // setup token colors
1838 evas_object_textgrid_palette_set(o, EVAS_TEXTGRID_PALETTE_STANDARD, ELM_CODE_TOKEN_TYPE_DEFAULT, 1821 _elm_code_widget_setup_palette_item(o, ELM_CODE_TOKEN_TYPE_DEFAULT, "elm/code/token/default", edje);
1839 187, 187, 187, 255); 1822 _elm_code_widget_setup_palette_item(o, ELM_CODE_TOKEN_TYPE_COMMENT, "elm/code/token/comment", edje);
1840 evas_object_textgrid_palette_set(o, EVAS_TEXTGRID_PALETTE_STANDARD, ELM_CODE_TOKEN_TYPE_COMMENT, 1823 _elm_code_widget_setup_palette_item(o, ELM_CODE_TOKEN_TYPE_STRING, "elm/code/token/string", edje);
1841 85, 85, 85, 255); 1824 _elm_code_widget_setup_palette_item(o, ELM_CODE_TOKEN_TYPE_NUMBER, "elm/code/token/number", edje);
1842 evas_object_textgrid_palette_set(o, EVAS_TEXTGRID_PALETTE_STANDARD, ELM_CODE_TOKEN_TYPE_STRING, 1825 _elm_code_widget_setup_palette_item(o, ELM_CODE_TOKEN_TYPE_BRACE, "elm/code/token/brace", edje);
1843 255, 136, 119, 255); 1826 _elm_code_widget_setup_palette_item(o, ELM_CODE_TOKEN_TYPE_TYPE, "elm/code/token/type", edje);
1844 evas_object_textgrid_palette_set(o, EVAS_TEXTGRID_PALETTE_STANDARD, ELM_CODE_TOKEN_TYPE_NUMBER, 1827 _elm_code_widget_setup_palette_item(o, ELM_CODE_TOKEN_TYPE_CLASS, "elm/code/token/class", edje);
1845 170, 153, 34, 255); 1828 _elm_code_widget_setup_palette_item(o, ELM_CODE_TOKEN_TYPE_FUNCTION, "elm/code/token/function", edje);
1846 evas_object_textgrid_palette_set(o, EVAS_TEXTGRID_PALETTE_STANDARD, ELM_CODE_TOKEN_TYPE_BRACE, 1829 _elm_code_widget_setup_palette_item(o, ELM_CODE_TOKEN_TYPE_PARAM, "elm/code/token/param", edje);
1847 170, 102, 170, 255); 1830 _elm_code_widget_setup_palette_item(o, ELM_CODE_TOKEN_TYPE_KEYWORD, "elm/code/token/keyword", edje);
1848 evas_object_textgrid_palette_set(o, EVAS_TEXTGRID_PALETTE_STANDARD, ELM_CODE_TOKEN_TYPE_TYPE, 1831 _elm_code_widget_setup_palette_item(o, ELM_CODE_TOKEN_TYPE_PREPROCESSOR, "elm/code/token/preprocessor", edje);
1849 255, 255, 255, 255); 1832 _elm_code_widget_setup_palette_item(o, ELM_CODE_TOKEN_TYPE_ADDED, "elm/code/token/added", edje);
1850 evas_object_textgrid_palette_set(o, EVAS_TEXTGRID_PALETTE_STANDARD, ELM_CODE_TOKEN_TYPE_CLASS, 1833 _elm_code_widget_setup_palette_item(o, ELM_CODE_TOKEN_TYPE_REMOVED, "elm/code/token/removed", edje);
1851 255, 255, 255, 255); 1834 _elm_code_widget_setup_palette_item(o, ELM_CODE_TOKEN_TYPE_CHANGED, "elm/code/token/changed", edje);
1852 evas_object_textgrid_palette_set(o, EVAS_TEXTGRID_PALETTE_STANDARD, ELM_CODE_TOKEN_TYPE_FUNCTION, 1835 _elm_code_widget_setup_palette_item(o, ELM_CODE_TOKEN_TYPE_MATCH, "elm/code/token/match", edje);
1853 255, 255, 255, 255);
1854 evas_object_textgrid_palette_set(o, EVAS_TEXTGRID_PALETTE_STANDARD, ELM_CODE_TOKEN_TYPE_PARAM,
1855 187, 187, 187, 255);
1856 evas_object_textgrid_palette_set(o, EVAS_TEXTGRID_PALETTE_STANDARD, ELM_CODE_TOKEN_TYPE_KEYWORD,
1857 68, 136, 204, 255);
1858 evas_object_textgrid_palette_set(o, EVAS_TEXTGRID_PALETTE_STANDARD, ELM_CODE_TOKEN_TYPE_PREPROCESSOR,
1859 102, 255, 85, 255);
1860
1861 evas_object_textgrid_palette_set(o, EVAS_TEXTGRID_PALETTE_STANDARD, ELM_CODE_TOKEN_TYPE_ADDED,
1862 54, 255, 54, 255);
1863 evas_object_textgrid_palette_set(o, EVAS_TEXTGRID_PALETTE_STANDARD, ELM_CODE_TOKEN_TYPE_REMOVED,
1864 255, 54, 54, 255);
1865 evas_object_textgrid_palette_set(o, EVAS_TEXTGRID_PALETTE_STANDARD, ELM_CODE_TOKEN_TYPE_CHANGED,
1866 54, 54, 255, 255);
1867
1868 evas_object_textgrid_palette_set(o, EVAS_TEXTGRID_PALETTE_STANDARD, ELM_CODE_TOKEN_TYPE_MATCH,
1869 187, 187, 51, 255);
1870 1836
1871 // other styles that the widget uses 1837 // other styles that the widget uses
1872 evas_object_textgrid_palette_set(o, EVAS_TEXTGRID_PALETTE_STANDARD, ELM_CODE_WIDGET_COLOR_SELECTION, 1838 _elm_code_widget_setup_palette_item(o, ELM_CODE_WIDGET_COLOR_SELECTION, "elm/code/widget/color/selection", edje);
1873 51, 153, 255, 255); 1839 _elm_code_widget_setup_palette_item(o, ELM_CODE_WIDGET_COLOR_GUTTER_BG, "elm/code/widget/color/gutter/bg", edje);
1874 evas_object_textgrid_palette_set(o, EVAS_TEXTGRID_PALETTE_STANDARD, ELM_CODE_WIDGET_COLOR_GUTTER_BG, 1840 _elm_code_widget_setup_palette_item(o, ELM_CODE_WIDGET_COLOR_GUTTER_FG, "elm/code/widget/color/gutter/fg", edje);
1875 75, 75, 75, 255); 1841 _elm_code_widget_setup_palette_item(o, ELM_CODE_WIDGET_COLOR_GUTTER_SCOPE_BG, "elm/code/widget/color/scope/bg", edje);
1876 evas_object_textgrid_palette_set(o, EVAS_TEXTGRID_PALETTE_STANDARD, ELM_CODE_WIDGET_COLOR_GUTTER_SCOPE_BG, 1842 _elm_code_widget_setup_palette_item(o, ELM_CODE_WIDGET_COLOR_WHITESPACE, "elm/code/widget/color/whitespace", edje);
1877 54, 54, 54, 255);
1878 evas_object_textgrid_palette_set(o, EVAS_TEXTGRID_PALETTE_STANDARD, ELM_CODE_WIDGET_COLOR_GUTTER_FG,
1879 139, 139, 139, 255);
1880 evas_object_textgrid_palette_set(o, EVAS_TEXTGRID_PALETTE_STANDARD, ELM_CODE_WIDGET_COLOR_WHITESPACE,
1881 101 * feint, 101 * feint, 101 * feint, 255 * feint);
1882} 1843}
1883 1844
1884static void 1845static void
@@ -2236,6 +2197,8 @@ _elm_code_widget_efl_canvas_group_group_add(Eo *obj, Elm_Code_Widget_Data *pd)
2236{ 2197{
2237 Evas_Object *background, *gridrows, *scroller; 2198 Evas_Object *background, *gridrows, *scroller;
2238 const char *fontname, *fontsize; 2199 const char *fontname, *fontsize;
2200 Eo *edje;
2201 int r, g, b, a;
2239 2202
2240 efl_canvas_group_add(efl_super(obj, ELM_CODE_WIDGET_CLASS)); 2203 efl_canvas_group_add(efl_super(obj, ELM_CODE_WIDGET_CLASS));
2241 elm_object_focus_allow_set(obj, EINA_TRUE); 2204 elm_object_focus_allow_set(obj, EINA_TRUE);
@@ -2250,14 +2213,12 @@ _elm_code_widget_efl_canvas_group_group_add(Eo *obj, Elm_Code_Widget_Data *pd)
2250 elm_layout_content_set(obj, "elm.swallow.content", scroller); 2213 elm_layout_content_set(obj, "elm.swallow.content", scroller);
2251 elm_object_focus_allow_set(scroller, EINA_FALSE); 2214 elm_object_focus_allow_set(scroller, EINA_FALSE);
2252 pd->scroller = scroller; 2215 pd->scroller = scroller;
2253 Eo *edje = elm_layout_edje_get(efl_parent_get(pd->scroller));
2254int ret, a =0, r =0, g =0, b =0;
2255ret = edje_object_color_class_get(edje, "elm/code/status/default", &r, &g, &b, &a, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
2256printf("ret %d, color %d,%d,%d,%d\n", ret, r, g, b, a);
2257 2216
2217 edje = elm_layout_edje_get(efl_parent_get(pd->scroller));
2218 edje_object_color_class_get(edje, "elm/code/status/default", &r, &g, &b, &a, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
2258 2219
2259 background = elm_bg_add(scroller); 2220 background = elm_bg_add(scroller);
2260 evas_object_color_set(background, 36, 36, 36, 255); 2221 evas_object_color_set(background, r, g, b, a);
2261 evas_object_size_hint_weight_set(background, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 2222 evas_object_size_hint_weight_set(background, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
2262 evas_object_size_hint_align_set(background, EVAS_HINT_FILL, EVAS_HINT_FILL); 2223 evas_object_size_hint_align_set(background, EVAS_HINT_FILL, EVAS_HINT_FILL);
2263 evas_object_show(background); 2224 evas_object_show(background);