diff options
Diffstat (limited to 'saedit')
-rw-r--r-- | saedit/Makefile | 21 | ||||
-rw-r--r-- | saedit/config.c | 2 | ||||
-rw-r--r-- | saedit/config.h | 1 | ||||
-rw-r--r-- | saedit/icon.svg | 118 | ||||
-rw-r--r-- | saedit/interface.ui | 5 | ||||
-rw-r--r-- | saedit/main.c | 4 | ||||
-rw-r--r-- | saedit/sae.c | 5 | ||||
-rw-r--r-- | saedit/sae.h | 1 | ||||
-rw-r--r-- | saedit/xml.c | 296 | ||||
-rw-r--r-- | saedit/xml.h | 29 |
10 files changed, 361 insertions, 121 deletions
diff --git a/saedit/Makefile b/saedit/Makefile index d5a7bdc..a45c3c1 100644 --- a/saedit/Makefile +++ b/saedit/Makefile @@ -8,28 +8,23 @@ endif LDFLAGS += -export-dynamic -GTK_CFLAGS = `pkg-config --cflags gtk+-3.0 gtksourceview-3.0` -IBUS_CFLAGS = `pkg-config --cflags ibus-1.0` +CFLAGS += `pkg-config --cflags gtk+-3.0 gtksourceview-3.0` -GTK_LDFLAGS = `pkg-config --libs gtk+-3.0 gtksourceview-3.0` -IBUS_LDFLAGS = `pkg-config --libs ibus-1.0` - -IBUS_FLAGS = ${IBUS_CFLAGS} ${IBUS_LDFLAGS} -GTK_FLAGS = ${GTK_CFLAGS} ${GTK_LDFLAGS} +LDFLAGS += `pkg-config --libs gtk+-3.0 gtksourceview-3.0` OUTPUT = saedit all:clean main.o search.o config.o xml.o sae.o compile compile: main.o search.o config.o xml.o - gcc ${CFLAGS} ${GTK_FLAGS} ${IBUS_FLAGS} ${LDFLAGS} -o '${OUTPUT}' main.o search.o config.o xml.o sae.o + gcc ${CFLAGS} ${LDFLAGS} -o '${OUTPUT}' main.o search.o config.o xml.o sae.o main.o: main.c main.h search.h config.h common.h xml.h - gcc ${CFLAGS} ${GTK_CFLAGS} ${IBUS_CFLAGS} -c -o main.o main.c + gcc ${CFLAGS}-c -o main.o main.c search.o: search.c search.h common.h - gcc ${CFLAGS} ${GTK_CFLAGS} -c -o search.o search.c + gcc ${CFLAGS} -c -o search.o search.c xml.o: xml.c xml.h common.h - gcc ${CFLAGS} ${IBUS_FLAGS} -c -o xml.o xml.c + gcc ${CFLAGS} -c -o xml.o xml.c config.o: config.c config.h common.h - gcc ${CFLAGS} ${GTK_CFLAGS} ${IBUS_FLAGS} -c -o config.o config.c + gcc ${CFLAGS} -c -o config.o config.c sae.o: sae.c sae.h common.h - gcc ${CFLAGS} ${GTK_CFLAGS} ${IBUS_CFLAGS} -c -o sae.o sae.c + gcc ${CFLAGS} -c -o sae.o sae.c clean: rm -rfv '${OUTPUT}' *.o *.o~ *~ diff --git a/saedit/config.c b/saedit/config.c index 51d554d..cdc0ffd 100644 --- a/saedit/config.c +++ b/saedit/config.c @@ -20,7 +20,7 @@ void config_options_load_from_file(Options *options, gchar *data_folder) { options->sprites = NULL; - XMLNode *node = ibus_xml_parse_file(file); + XMLNode *node = xml_parse_file(file); if (node != NULL) { GList *list = node->sub_nodes; diff --git a/saedit/config.h b/saedit/config.h index 99f3da3..0fb0ac7 100644 --- a/saedit/config.h +++ b/saedit/config.h @@ -13,7 +13,6 @@ #define CONFIG_H #include <glib.h> -#include <ibus.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> diff --git a/saedit/icon.svg b/saedit/icon.svg index c3dbf5e..6a3bf35 100644 --- a/saedit/icon.svg +++ b/saedit/icon.svg @@ -585,9 +585,9 @@ borderopacity="1.0" inkscape:pageopacity="0.0" inkscape:pageshadow="2" - inkscape:zoom="1.4142136" - inkscape:cx="11.719468" - inkscape:cy="151.53998" + inkscape:zoom="1" + inkscape:cx="-79.999984" + inkscape:cy="276.83172" inkscape:document-units="px" inkscape:current-layer="layer1" showgrid="false" @@ -617,103 +617,37 @@ style="font-size:40px;font-style:normal;font-variant:normal;font-weight:500;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans;-inkscape-font-specification:Charter" id="text3080" /> <g - id="g3104" - transform="translate(2.051949,4.8113453)"> + id="g3107" + transform="matrix(5.7032977,0,0,5.7032977,-463.19349,-3989.5514)" + style="fill:#800000"> <g - style="font-size:34.78716278px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:tb-rl;fill:#000000;fill-opacity:1;stroke:none;font-family:Cantarell;-inkscape-font-specification:Sans" - id="text3092"> + transform="translate(-0.55621842,0.00758253)" + id="text3086" + style="font-size:40px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;fill:#800000;fill-opacity:1;stroke:none;font-family:Cantarell;-inkscape-font-specification:Sans"> <path - d="m 93.626054,809.17175 0,2.95555 c -0.883283,-0.45294 -1.800521,-0.79266 -2.751719,-1.01915 -0.951223,-0.22646 -1.936406,-0.3397 -2.95555,-0.33972 -1.551389,2e-5 -2.717754,0.23782 -3.4991,0.71341 -0.770033,0.47562 -1.155047,1.18903 -1.155042,2.14023 -5e-6,0.72474 0.277431,1.2966 0.83231,1.71557 0.554867,0.40768 1.670274,0.79835 3.346226,1.17203 l 1.070113,0.2378 c 2.219481,0.47562 3.793508,1.14939 4.722085,2.02133 0.939872,0.86063 1.409815,2.06663 1.409832,3.618 -1.7e-5,1.76654 -0.702101,3.16504 -2.106254,4.19552 -1.392859,1.03048 -3.312265,1.54572 -5.758227,1.54572 -1.019163,0 -2.083612,-0.10192 -3.193353,-0.30575 -1.098427,-0.1925 -2.25913,-0.48693 -3.482113,-0.88326 l 0,-3.22733 c 1.155039,0.60017 2.293095,1.05313 3.41417,1.35887 1.121064,0.29443 2.230809,0.44164 3.32924,0.44164 1.472103,0 2.604496,-0.24913 3.397184,-0.74738 0.792663,-0.50958 1.189001,-1.22298 1.189014,-2.14023 -1.3e-5,-0.84929 -0.288774,-1.50041 -0.866282,-1.95338 -0.566209,-0.45295 -1.817504,-0.88892 -3.753888,-1.30791 l -1.087099,-0.25479 c -1.9364,-0.40766 -3.334906,-1.03047 -4.195522,-1.86845 -0.860622,-0.84929 -1.290932,-2.00999 -1.29093,-3.48212 -2e-6,-1.78917 0.634139,-3.17069 1.902423,-4.14456 1.268277,-0.97384 3.068783,-1.46077 5.401523,-1.46079 1.155032,2e-5 2.242129,0.085 3.261296,0.25479 1.019142,0.16988 1.959028,0.42466 2.819663,0.76436" - style="font-family:Sans;-inkscape-font-specification:Sans" - id="path3114" /> - <path - d="m 82.551234,865.27624 0,10.08964 -3.142395,0 0,-26.26023 3.142395,0 0,2.8876 c 0.656782,-1.13238 1.48343,-1.97035 2.479945,-2.51391 1.007821,-0.55486 2.208158,-0.83229 3.601015,-0.83231 2.31007,2e-5 4.184181,0.91725 5.622339,2.75171 1.449445,1.8345 2.174177,4.2465 2.174197,7.23601 -2e-5,2.98952 -0.724752,5.40152 -2.174197,7.236 -1.438158,1.83448 -3.312269,2.75172 -5.622339,2.75172 -1.392857,0 -2.593194,-0.27178 -3.601015,-0.81533 -0.996515,-0.55487 -1.823163,-1.3985 -2.479945,-2.5309 m 10.633186,-6.64149 c -1.7e-5,-2.29875 -0.475622,-4.09926 -1.426817,-5.40153 -0.939902,-1.31356 -2.236493,-1.97035 -3.889776,-1.97036 -1.653306,10e-6 -2.955558,0.6568 -3.906761,1.97036 -0.939895,1.30227 -1.409838,3.10278 -1.409832,5.40153 -6e-6,2.29876 0.469937,4.10493 1.409832,5.4185 0.951203,1.30226 2.253455,1.95339 3.906761,1.95339 1.653283,0 2.949874,-0.65113 3.889776,-1.95339 0.951195,-1.31357 1.4268,-3.11974 1.426817,-5.4185" - style="font-family:Sans;-inkscape-font-specification:Sans" - id="path3116" /> - <path - d="m 94.424392,892.52165 c -0.351056,-0.20381 -0.73607,-0.35102 -1.155042,-0.44163 -0.407675,-0.1019 -0.860632,-0.15286 -1.358874,-0.15287 -1.766545,10e-6 -3.125418,0.57753 -4.07662,1.73256 -0.939895,1.14373 -1.409838,2.79137 -1.409832,4.9429 l 0,10.0217 -3.142395,0 0,-19.02423 3.142395,0 0,2.95555 c 0.656782,-1.15503 1.511739,-2.00999 2.564874,-2.56488 1.053117,-0.56618 2.332722,-0.84927 3.838818,-0.84929 0.215142,2e-5 0.452945,0.017 0.713408,0.0509 0.260438,0.0227 0.549198,0.0623 0.866282,0.11891 l 0.01699,3.21033" - style="font-family:Sans;-inkscape-font-specification:Sans" - id="path3118" /> - <path - d="m 85.744587,930.09451 3.125409,0 0,19.02423 -3.125409,0 0,-19.02423 m 0,-7.40586 3.125409,0 0,3.95772 -3.125409,0 0,-3.95772" - style="font-family:Sans;-inkscape-font-specification:Sans" - id="path3120" /> - <path - d="m 86.831686,965.18742 0,5.40152 6.437664,0 0,2.42899 -6.437664,0 0,10.32744 c -6e-6,1.55139 0.209487,2.54789 0.628479,2.98952 0.430303,0.44164 1.296584,0.66246 2.598846,0.66245 l 3.210339,0 0,2.61583 -3.210339,0 c -2.412008,0 -4.076626,-0.44729 -4.99386,-1.34188 -0.917244,-0.90592 -1.375863,-2.54789 -1.37586,-4.92592 l 0,-10.32744 -2.293099,0 0,-2.42899 2.293099,0 0,-5.40152 3.142395,0" - style="font-family:Sans;-inkscape-font-specification:Sans" - id="path3122" /> - <path - d="m 96.13997,1019.8141 0,1.5288 -14.370087,0 c 0.135882,2.1515 0.781346,3.7935 1.936394,4.9259 1.166359,1.1211 2.785681,1.6816 4.857973,1.6816 1.200325,0 2.361029,-0.1472 3.482114,-0.4416 1.132378,-0.2945 2.253447,-0.7361 3.363212,-1.3249 l 0,2.9555 c -1.121089,0.4756 -2.270468,0.838 -3.448142,1.0871 -1.177704,0.2491 -2.37238,0.3737 -3.584029,0.3737 -3.034826,0 -5.441162,-0.8833 -7.219016,-2.6498 -1.766538,-1.7665 -2.649805,-4.1559 -2.649803,-7.1681 -2e-6,-3.114 0.837969,-5.5827 2.513916,-7.4058 1.687262,-1.8345 3.957711,-2.7517 6.811354,-2.7517 2.559198,0 4.58052,0.8266 6.063973,2.4799 1.494742,1.642 2.242122,3.8785 2.242141,6.7094 m -3.125409,-0.9172 c -0.02266,-1.7099 -0.503931,-3.0744 -1.443803,-4.0936 -0.928578,-1.0191 -2.162887,-1.5287 -3.70293,-1.5287 -1.743898,0 -3.142404,0.4926 -4.195523,1.4777 -1.041809,0.9852 -1.641977,2.3724 -1.800507,4.1616 l 11.142763,-0.017" - style="font-family:Sans;-inkscape-font-specification:Sans" - id="path3124" /> + inkscape:connector-curvature="0" + id="path3105" + style="fill:#800000;font-family:Sans;-inkscape-font-specification:Sans" + d="m 110.87616,841.71545 0,3.39844 c -1.01564,-0.52081 -2.07033,-0.91144 -3.16406,-1.17187 -1.09377,-0.2604 -2.22658,-0.39061 -3.39844,-0.39063 -1.78386,2e-5 -3.12501,0.27346 -4.02344,0.82031 -0.885421,0.5469 -1.328129,1.36721 -1.328123,2.46094 -6e-6,0.83335 0.319004,1.4909 0.957031,1.97266 0.638012,0.46876 1.920562,0.91798 3.847652,1.34765 l 1.23047,0.27344 c 2.55207,0.54689 4.36197,1.32163 5.42969,2.32422 1.08071,0.98959 1.62108,2.37631 1.62109,4.16016 -1e-5,2.03125 -0.80731,3.63932 -2.42187,4.82422 -1.60158,1.18489 -3.80861,1.77734 -6.62109,1.77734 -1.17189,0 -2.39584,-0.11719 -3.671879,-0.35156 -1.263026,-0.22136 -2.59766,-0.5599 -4.003906,-1.01563 l 0,-3.71094 c 1.328121,0.69011 2.636714,1.21094 3.925781,1.5625 1.289054,0.33855 2.565094,0.50782 3.828124,0.50782 1.6927,0 2.99478,-0.28646 3.90625,-0.85938 0.91144,-0.58593 1.36717,-1.40624 1.36719,-2.46094 -2e-5,-0.97655 -0.33205,-1.72525 -0.9961,-2.24609 -0.65105,-0.52082 -2.08985,-1.02213 -4.3164,-1.50391 l -1.25,-0.29296 c -2.22657,-0.46874 -3.834642,-1.18489 -4.82422,-2.14844 -0.989586,-0.97655 -1.484378,-2.31119 -1.484375,-4.00391 -3e-6,-2.05727 0.729163,-3.64581 2.1875,-4.76562 1.458327,-1.11977 3.528635,-1.67967 6.210935,-1.67969 1.32812,2e-5 2.57811,0.0977 3.75,0.29297 1.17186,0.19533 2.25259,0.4883 3.24219,0.8789" /> </g> <g - style="font-size:34.78716278px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;fill:#ff0000;fill-opacity:1;stroke:none;font-family:Cantarell;-inkscape-font-specification:Sans" - id="text3096"> - <path - d="m 50.844808,939.57603 c -2.52525,1e-5 -4.274798,0.28877 -5.248649,0.86628 -0.973865,0.57753 -1.460795,1.56271 -1.460789,2.95555 -6e-6,1.10975 0.36236,1.99302 1.087099,2.6498 0.736049,0.64547 1.732555,0.9682 2.989521,0.9682 1.732553,0 3.119735,-0.61149 4.161551,-1.83448 1.053112,-1.23431 1.579675,-2.87061 1.57969,-4.90893 l 0,-0.69642 -3.108423,0 m 6.233832,-1.29093 0,10.854 -3.125409,0 0,-2.88761 c -0.713423,1.15505 -1.602352,2.01 -2.666789,2.56488 -1.064463,0.54355 -2.366715,0.81532 -3.906762,0.81532 -1.947725,0 -3.499104,-0.54355 -4.654142,-1.63065 -1.143721,-1.09842 -1.71558,-2.56487 -1.715577,-4.39935 -3e-6,-2.14022 0.713405,-3.75388 2.140225,-4.84099 1.438136,-1.08708 3.57836,-1.63063 6.420678,-1.63065 l 4.382367,0 0,-0.30574 c -1.5e-5,-1.43813 -0.47562,-2.54788 -1.426817,-3.32924 -0.9399,-0.79266 -2.264801,-1.189 -3.974705,-1.18902 -1.087108,2e-5 -2.145896,0.13025 -3.176367,0.39068 -1.030485,0.26047 -2.021329,0.65114 -2.972536,1.17203 l 0,-2.88761 c 1.143714,-0.44161 2.253459,-0.77001 3.32924,-0.98518 1.075767,-0.22646 2.123231,-0.3397 3.142395,-0.33972 2.751706,2e-5 4.807001,0.71343 6.165889,2.14023 1.358856,1.42683 2.038292,3.5897 2.03831,6.48862" - style="fill:#ff0000;font-family:Sans;-inkscape-font-specification:Sans" - id="path3127" /> - <path - d="m 79.34718,937.65662 0,11.48248 -3.125409,0 0,-11.38057 c -1.6e-5,-1.80049 -0.351058,-3.14804 -1.053127,-4.04265 -0.702099,-0.89457 -1.755225,-1.34187 -3.159381,-1.34188 -1.687278,10e-6 -3.01784,0.5379 -3.991691,1.61366 -0.973866,1.07579 -1.460795,2.54224 -1.460789,4.39935 l 0,10.75209 -3.142395,0 0,-19.02423 3.142395,0 0,2.95555 c 0.747373,-1.1437 1.624978,-1.99866 2.632817,-2.56487 1.019146,-0.56618 2.191173,-0.84928 3.516086,-0.8493 2.185507,2e-5 3.838801,0.67946 4.959888,2.03831 1.121052,1.34757 1.681587,3.33492 1.681606,5.96206" - style="fill:#ff0000;font-family:Sans;-inkscape-font-specification:Sans" - id="path3129" /> - <path - d="m 85.614983,930.11487 3.125409,0 0,19.02423 -3.125409,0 0,-19.02423 m 0,-7.40586 3.125409,0 0,3.95772 -3.125409,0 0,-3.95772" - style="fill:#ff0000;font-family:Sans;-inkscape-font-specification:Sans" - id="path3131" /> - <path - d="m 110.07471,933.76684 c 0.78133,-1.40415 1.71556,-2.44029 2.80267,-3.10842 1.08708,-0.66809 2.36669,-1.00215 3.83882,-1.00217 1.98167,2e-5 3.5104,0.69644 4.5862,2.08927 1.07574,1.38154 1.61363,3.3519 1.61366,5.9111 l 0,11.48248 -3.14239,0 0,-11.38057 c -3e-5,-1.82314 -0.32276,-3.17635 -0.9682,-4.05963 -0.64549,-0.88325 -1.63067,-1.32489 -2.95555,-1.3249 -1.61935,10e-6 -2.89895,0.5379 -3.83882,1.61366 -0.9399,1.07579 -1.40985,2.54224 -1.40983,4.39935 l 0,10.75209 -3.14239,0 0,-11.38057 c -2e-5,-1.83446 -0.32275,-3.18767 -0.9682,-4.05963 -0.64548,-0.88325 -1.64199,-1.32489 -2.98952,-1.3249 -1.59669,10e-6 -2.86497,0.54356 -3.80485,1.63065 -0.939894,1.07578 -1.409837,2.53657 -1.409831,4.38236 l 0,10.75209 -3.142395,0 0,-19.02423 3.142395,0 0,2.95555 c 0.713402,-1.16635 1.568359,-2.02697 2.564871,-2.58186 0.9965,-0.55485 2.17985,-0.83229 3.55006,-0.83231 1.38151,2e-5 2.55353,0.35106 3.51609,1.05313 0.97384,0.7021 1.69291,1.72125 2.15721,3.05746" - style="fill:#ff0000;font-family:Sans;-inkscape-font-specification:Sans" - id="path3133" /> + id="text3090" + style="font-size:40px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;fill:#800000;fill-opacity:1;stroke:none;font-family:Cantarell;-inkscape-font-specification:Sans"> <path - d="m 137.81272,939.57603 c -2.52525,1e-5 -4.2748,0.28877 -5.24865,0.86628 -0.97387,0.57753 -1.46079,1.56271 -1.46079,2.95555 0,1.10975 0.36236,1.99302 1.0871,2.6498 0.73605,0.64547 1.73256,0.9682 2.98952,0.9682 1.73255,0 3.11974,-0.61149 4.16155,-1.83448 1.05311,-1.23431 1.57968,-2.87061 1.57969,-4.90893 l 0,-0.69642 -3.10842,0 m 6.23383,-1.29093 0,10.854 -3.12541,0 0,-2.88761 c -0.71342,1.15505 -1.60235,2.01 -2.66679,2.56488 -1.06446,0.54355 -2.36671,0.81532 -3.90676,0.81532 -1.94772,0 -3.4991,-0.54355 -4.65414,-1.63065 -1.14372,-1.09842 -1.71558,-2.56487 -1.71558,-4.39935 0,-2.14022 0.71341,-3.75388 2.14023,-4.84099 1.43813,-1.08708 3.57836,-1.63063 6.42067,-1.63065 l 4.38237,0 0,-0.30574 c -1e-5,-1.43813 -0.47562,-2.54788 -1.42682,-3.32924 -0.9399,-0.79266 -2.2648,-1.189 -3.9747,-1.18902 -1.08711,2e-5 -2.1459,0.13025 -3.17637,0.39068 -1.03048,0.26047 -2.02133,0.65114 -2.97253,1.17203 l 0,-2.88761 c 1.14371,-0.44161 2.25346,-0.77001 3.32924,-0.98518 1.07576,-0.22646 2.12323,-0.3397 3.14239,-0.33972 2.75171,2e-5 4.807,0.71343 6.16589,2.14023 1.35886,1.42683 2.03829,3.5897 2.03831,6.48862" - style="fill:#ff0000;font-family:Sans;-inkscape-font-specification:Sans" - id="path3135" /> - <path - d="m 153.59264,924.71335 0,5.40152 6.43766,0 0,2.42899 -6.43766,0 0,10.32743 c -10e-6,1.55139 0.20948,2.5479 0.62847,2.98953 0.43031,0.44163 1.29659,0.66245 2.59885,0.66245 l 3.21034,0 0,2.61583 -3.21034,0 c -2.41201,0 -4.07663,-0.4473 -4.99386,-1.34189 -0.91724,-0.90591 -1.37586,-2.54788 -1.37586,-4.92592 l 0,-10.32743 -2.2931,0 0,-2.42899 2.2931,0 0,-5.40152 3.1424,0" - style="fill:#ff0000;font-family:Sans;-inkscape-font-specification:Sans" - id="path3137" /> - <path - d="m 164.15788,930.11487 3.1254,0 0,19.02423 -3.1254,0 0,-19.02423 m 0,-7.40586 3.1254,0 0,3.95772 -3.1254,0 0,-3.95772" - style="fill:#ff0000;font-family:Sans;-inkscape-font-specification:Sans" - id="path3139" /> - <path - d="m 181.17777,932.30605 c -1.67596,2e-5 -3.00086,0.65681 -3.97471,1.97037 -0.97386,1.30227 -1.46079,3.09145 -1.46079,5.36755 0,2.27612 0.48126,4.07096 1.44381,5.38454 0.97385,1.30225 2.30441,1.95338 3.99169,1.95338 1.6646,0 2.98384,-0.65679 3.95772,-1.97037 0.97384,-1.31357 1.46077,-3.10275 1.46079,-5.36755 -2e-5,-2.25345 -0.48695,-4.03697 -1.46079,-5.35056 -0.97388,-1.32489 -2.29312,-1.98734 -3.95772,-1.98736 m 0,-2.6498 c 2.71773,2e-5 4.85229,0.88329 6.40369,2.6498 1.55136,1.76655 2.32705,4.21252 2.32707,7.33792 -2e-5,3.11409 -0.77571,5.56006 -2.32707,7.33792 -1.5514,1.76653 -3.68596,2.6498 -6.40369,2.6498 -2.72908,0 -4.86931,-0.88327 -6.42068,-2.6498 -1.54006,-1.77786 -2.31009,-4.22383 -2.31009,-7.33792 0,-3.1254 0.77003,-5.57137 2.31009,-7.33792 1.55137,-1.76651 3.6916,-2.64978 6.42068,-2.6498" - style="fill:#ff0000;font-family:Sans;-inkscape-font-specification:Sans" - id="path3141" /> - <path - d="m 210.88614,937.65662 0,11.48248 -3.12541,0 0,-11.38057 c -1e-5,-1.80049 -0.35106,-3.14804 -1.05312,-4.04265 -0.7021,-0.89457 -1.75523,-1.34187 -3.15939,-1.34188 -1.68727,10e-6 -3.01784,0.5379 -3.99169,1.61366 -0.97386,1.07579 -1.46079,2.54224 -1.46079,4.39935 l 0,10.75209 -3.14239,0 0,-19.02423 3.14239,0 0,2.95555 c 0.74738,-1.1437 1.62498,-1.99866 2.63282,-2.56487 1.01915,-0.56618 2.19117,-0.84928 3.51609,-0.8493 2.1855,2e-5 3.8388,0.67946 4.95989,2.03831 1.12105,1.34757 1.68158,3.33492 1.6816,5.96206" - style="fill:#ff0000;font-family:Sans;-inkscape-font-specification:Sans" - id="path3143" /> + id="path3102" + style="fill:#800000;font-family:Sans;-inkscape-font-specification:Sans" + d="m 97.149544,871.06958 c -2.903657,10e-6 -4.915374,0.33204 -6.035156,0.99609 -1.119799,0.66408 -1.679694,1.79689 -1.679688,3.39844 -6e-6,1.27605 0.41666,2.29167 1.25,3.04688 0.846346,0.74219 1.992178,1.11328 3.4375,1.11328 1.992175,0 3.587225,-0.70312 4.785156,-2.10938 1.210924,-1.41926 1.816394,-3.30077 1.816404,-5.64453 l 0,-0.80078 -3.574216,0 m 7.167966,-1.48437 0,12.48046 -3.59375,0 0,-3.32031 c -0.820326,1.32813 -1.842461,2.3112 -3.066404,2.94922 -1.223971,0.625 -2.721365,0.9375 -4.492187,0.9375 -2.239591,0 -4.023443,-0.625 -5.351563,-1.875 -1.315107,-1.26302 -1.972658,-2.94921 -1.972656,-5.05859 -2e-6,-2.46093 0.820309,-4.3164 2.460938,-5.56641 1.653639,-1.24999 4.114574,-1.87499 7.382812,-1.875 l 5.03906,0 0,-0.35156 c -1e-5,-1.65363 -0.54689,-2.92967 -1.640622,-3.82813 -1.080744,-0.91144 -2.60418,-1.36717 -4.570313,-1.36718 -1.25001,1e-5 -2.467457,0.14975 -3.652344,0.44921 -1.184902,0.2995 -2.324224,0.74872 -3.417968,1.34766 l 0,-3.32031 c 1.315098,-0.50779 2.591139,-0.8854 3.828125,-1.13281 1.23697,-0.2604 2.441395,-0.39061 3.613281,-0.39063 3.164048,2e-5 5.527331,0.82033 7.089841,2.46094 1.56248,1.64064 2.34373,4.12762 2.34375,7.46094" + inkscape:connector-curvature="0" /> </g> <g - style="font-size:34.78716278px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;fill:#ff0000;fill-opacity:1;stroke:none;font-family:Cantarell;-inkscape-font-specification:Sans" - id="text3100"> - <path - d="m 95.989712,1020.1628 0,1.5288 -14.370088,0 c 0.135882,2.1515 0.781347,3.7935 1.936395,4.9259 1.166358,1.1211 2.785681,1.6816 4.857973,1.6816 1.200325,0 2.361029,-0.1472 3.482114,-0.4416 1.132378,-0.2945 2.253447,-0.7361 3.363212,-1.3249 l 0,2.9555 c -1.121089,0.4756 -2.270468,0.838 -3.448142,1.0871 -1.177705,0.2491 -2.37238,0.3737 -3.584029,0.3737 -3.034826,0 -5.441162,-0.8833 -7.219016,-2.6498 -1.766538,-1.7665 -2.649805,-4.1559 -2.649803,-7.1681 -2e-6,-3.114 0.837969,-5.5827 2.513916,-7.4058 1.687262,-1.8345 3.957711,-2.7517 6.811354,-2.7518 2.559198,10e-5 4.58052,0.8267 6.063973,2.48 1.494742,1.642 2.242122,3.8785 2.242141,6.7094 m -3.125409,-0.9172 c -0.02266,-1.7099 -0.503931,-3.0744 -1.443803,-4.0936 -0.928578,-1.0192 -2.162887,-1.5287 -3.70293,-1.5287 -1.743898,0 -3.142404,0.4926 -4.195523,1.4777 -1.041809,0.9852 -1.641977,2.3724 -1.800507,4.1616 l 11.142763,-0.017" - style="fill:#ff0000;font-family:Sans;-inkscape-font-specification:Sans" - id="path3146" /> - <path - d="m 113.63808,1014.3197 0,-10.2935 3.12541,0 0,26.4301 -3.12541,0 0,-2.8536 c -0.6568,1.1324 -1.48911,1.976 -2.49693,2.5309 -0.99652,0.5435 -2.19685,0.8153 -3.60101,0.8153 -2.29877,0 -4.17288,-0.9172 -5.62234,-2.7517 -1.43815,-1.8345 -2.157216,-4.2465 -2.157214,-7.236 -2e-6,-2.9895 0.719064,-5.4015 2.157214,-7.236 1.44946,-1.8345 3.32357,-2.7517 5.62234,-2.7518 1.40416,10e-5 2.60449,0.2775 3.60101,0.8324 1.00782,0.5435 1.84013,1.3815 2.49693,2.5139 m -10.65017,6.6415 c 0,2.2987 0.46994,4.1049 1.40983,5.4185 0.95121,1.3022 2.25346,1.9534 3.90676,1.9534 1.65329,0 2.95554,-0.6512 3.90676,-1.9534 0.9512,-1.3136 1.42681,-3.1198 1.42682,-5.4185 -1e-5,-2.2988 -0.47562,-4.0993 -1.42682,-5.4016 -0.95122,-1.3135 -2.25347,-1.9703 -3.90676,-1.9703 -1.6533,0 -2.95555,0.6568 -3.90676,1.9703 -0.93989,1.3023 -1.40983,3.1028 -1.40983,5.4016" - style="fill:#ff0000;font-family:Sans;-inkscape-font-specification:Sans" - id="path3148" /> - <path - d="m 123.20116,1011.4321 3.12541,0 0,19.0242 -3.12541,0 0,-19.0242 m 0,-7.4059 3.12541,0 0,3.9577 -3.12541,0 0,-3.9577" - style="fill:#ff0000;font-family:Sans;-inkscape-font-specification:Sans" - id="path3150" /> - <path - d="m 135.9406,1006.0305 0,5.4016 6.43766,0 0,2.429 -6.43766,0 0,10.3274 c -1e-5,1.5514 0.20948,2.5479 0.62848,2.9895 0.4303,0.4417 1.29658,0.6625 2.59884,0.6625 l 3.21034,0 0,2.6158 -3.21034,0 c -2.41201,0 -4.07662,-0.4473 -4.99386,-1.3419 -0.91724,-0.9059 -1.37586,-2.5479 -1.37586,-4.9259 l 0,-10.3274 -2.2931,0 0,-2.429 2.2931,0 0,-5.4016 3.1424,0" - style="fill:#ff0000;font-family:Sans;-inkscape-font-specification:Sans" - id="path3152" /> - <path - d="m 153.87773,1013.6233 c -1.67596,0 -3.00086,0.6568 -3.97471,1.9703 -0.97386,1.3023 -1.46079,3.0915 -1.46079,5.3676 0,2.2761 0.48126,4.0709 1.4438,5.3845 0.97386,1.3023 2.30442,1.9534 3.9917,1.9534 1.6646,0 2.98384,-0.6568 3.95771,-1.9704 0.97385,-1.3136 1.46078,-3.1027 1.46079,-5.3675 -1e-5,-2.2535 -0.48694,-4.037 -1.46079,-5.3506 -0.97387,-1.3249 -2.29311,-1.9873 -3.95771,-1.9873 m 0,-2.6499 c 2.71773,10e-5 4.85229,0.8833 6.40369,2.6499 1.55136,1.7665 2.32705,4.2125 2.32707,7.3379 -2e-5,3.1141 -0.77571,5.56 -2.32707,7.3379 -1.5514,1.7665 -3.68596,2.6498 -6.40369,2.6498 -2.72908,0 -4.86931,-0.8833 -6.42068,-2.6498 -1.54006,-1.7779 -2.31009,-4.2238 -2.31009,-7.3379 0,-3.1254 0.77003,-5.5714 2.31009,-7.3379 1.55137,-1.7666 3.6916,-2.6498 6.42068,-2.6499" - style="fill:#ff0000;font-family:Sans;-inkscape-font-specification:Sans" - id="path3154" /> + id="text3094" + style="font-size:40px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;fill:#800000;fill-opacity:1;stroke:none;font-family:Cantarell;-inkscape-font-specification:Sans" + transform="translate(0,796.36209)"> <path - d="m 178.79607,1014.3536 c -0.35106,-0.2038 -0.73607,-0.351 -1.15504,-0.4416 -0.40768,-0.1019 -0.86063,-0.1528 -1.35887,-0.1529 -1.76655,10e-5 -3.12542,0.5776 -4.07663,1.7326 -0.93989,1.1437 -1.40983,2.7914 -1.40983,4.9429 l 0,10.0217 -3.14239,0 0,-19.0242 3.14239,0 0,2.9555 c 0.65678,-1.155 1.51174,-2.01 2.56488,-2.5649 1.05311,-0.5661 2.33272,-0.8492 3.83881,-0.8493 0.21515,10e-5 0.45295,0.017 0.71341,0.051 0.26044,0.023 0.5492,0.062 0.86629,0.1189 l 0.017,3.2103" - style="fill:#ff0000;font-family:Sans;-inkscape-font-specification:Sans" - id="path3156" /> + id="path3099" + style="fill:#800000;font-family:Sans;-inkscape-font-specification:Sans" + d="m 121.47542,73.044228 0,1.757812 -16.52344,0 c 0.15624,2.473966 0.89843,4.361985 2.22656,5.664063 1.34114,1.289065 3.20312,1.933596 5.58594,1.933593 1.38019,3e-6 2.71483,-0.169268 4.00391,-0.507812 1.30206,-0.338538 2.59112,-0.84635 3.86718,-1.523438 l 0,3.398438 c -1.28908,0.546875 -2.61069,0.963542 -3.96484,1.25 -1.35418,0.286458 -2.72788,0.429687 -4.12109,0.429687 -3.4896,0 -6.25652,-1.015624 -8.30078,-3.046875 -2.03126,-2.031245 -3.04688,-4.778638 -3.04688,-8.242187 0,-3.580715 0.96354,-6.419254 2.89063,-8.515625 1.94009,-2.109354 4.55077,-3.16404 7.83203,-3.164063 2.94269,2.3e-5 5.26691,0.950543 6.97265,2.851563 1.71873,1.888038 2.57811,4.45965 2.57813,7.714844 m -3.59375,-1.054688 c -0.0261,-1.966131 -0.57945,-3.53514 -1.66016,-4.707031 -1.06772,-1.171856 -2.48699,-1.757793 -4.25781,-1.757813 -2.00522,2e-5 -3.61329,0.566425 -4.82422,1.699219 -1.19792,1.132829 -1.88803,2.72788 -2.07031,4.785156 l 12.8125,-0.01953" + inkscape:connector-curvature="0" /> </g> </g> </g> diff --git a/saedit/interface.ui b/saedit/interface.ui index db4b883..7c1ba9d 100644 --- a/saedit/interface.ui +++ b/saedit/interface.ui @@ -418,6 +418,7 @@ Reid Yaro <reidyaro@gmail.com></property> <property name="visible">True</property> <property name="can_focus">False</property> <property name="label" translatable="yes">Clientdata folder</property> + <property name="height_request">24</property> <attributes> <attribute name="weight" value="bold"/> </attributes> @@ -447,6 +448,7 @@ Reid Yaro <reidyaro@gmail.com></property> <property name="visible">True</property> <property name="can_focus">False</property> <property name="label" translatable="yes">XML source file</property> + <property name="height_request">24</property> <attributes> <attribute name="weight" value="bold"/> </attributes> @@ -537,6 +539,7 @@ Reid Yaro <reidyaro@gmail.com></property> <property name="visible">True</property> <property name="can_focus">False</property> <property name="label" translatable="yes">Imagesets</property> + <property name="height_request">24</property> <attributes> <attribute name="weight" value="bold"/> </attributes> @@ -567,6 +570,7 @@ Reid Yaro <reidyaro@gmail.com></property> <property name="visible">True</property> <property name="can_focus">False</property> <property name="label" translatable="yes">Actions</property> + <property name="height_request">24</property> <attributes> <attribute name="weight" value="bold"/> </attributes> @@ -597,6 +601,7 @@ Reid Yaro <reidyaro@gmail.com></property> <property name="visible">True</property> <property name="can_focus">False</property> <property name="label" translatable="yes">Directions</property> + <property name="height_request">24</property> <attributes> <attribute name="weight" value="bold"/> </attributes> diff --git a/saedit/main.c b/saedit/main.c index b6ef4e9..44cd48c 100644 --- a/saedit/main.c +++ b/saedit/main.c @@ -514,7 +514,7 @@ void load_options() { void parse_xml_text(gchar *text, SAEInfo *sae_info) { free_lists(sae_info); - XMLNode *_root_node = ibus_xml_parse_buffer(text); + XMLNode *_root_node = xml_parse_buffer(text); sae_info->root = _root_node; if (_root_node == NULL) { show_wrong_source_buffer_dialog(); @@ -529,7 +529,7 @@ void parse_xml_text(gchar *text, SAEInfo *sae_info) { file_attr = g_strjoin(NULL, paths->sprites, file_attr, NULL); gchar *buf; if (g_file_get_contents(file_attr, &buf, NULL, NULL)) - _root_node->sub_nodes = g_list_concat(_root_node->sub_nodes, ibus_xml_parse_buffer(buf)->sub_nodes); + _root_node->sub_nodes = g_list_concat(_root_node->sub_nodes, xml_parse_buffer(buf)->sub_nodes); } if (list->next != NULL) list = g_list_find_custom(list->next, "include", xml_node_compare_with_name_func); diff --git a/saedit/sae.c b/saedit/sae.c index bb57bd5..472901e 100644 --- a/saedit/sae.c +++ b/saedit/sae.c @@ -127,9 +127,6 @@ gboolean set_up_animation_by_direction(SAEInfo *sae_info, const gchar *direction } if (sae_info->animation == NULL) return FALSE; - /*if (count > 1) { - g_list_last(sae_info->animation)->next = g_list_first(sae_info->animation); - g_list_first(sae_info->animation)->prev = g_list_last(sae_info->animation); - }*/ + return TRUE; } diff --git a/saedit/sae.h b/saedit/sae.h index 12d10e6..830e64b 100644 --- a/saedit/sae.h +++ b/saedit/sae.h @@ -13,7 +13,6 @@ #define SAE_H #include <gtk/gtk.h> -#include <ibus.h> #include "common.h" #include "xml.h" diff --git a/saedit/xml.c b/saedit/xml.c index 715a208..d7b697e 100644 --- a/saedit/xml.c +++ b/saedit/xml.c @@ -11,7 +11,7 @@ #include "xml.h" -gchar **xml_attr_new(const gchar *name, const gchar *value) { +gchar** xml_attr_new(const gchar *name, const gchar *value) { gchar **attr = g_new0(gchar*, 2); attr[0] = g_strdup(name); attr[1] = g_strdup(value); @@ -41,3 +41,297 @@ gint xml_node_compare_with_attr_func(const XMLNode *node, const gchar **attr) { return g_strcmp0(attr[1], xml_node_get_attr_value(node, attr[0])); } + +static GMarkupParser parser; + +void +xml_free (XMLNode *node) +{ + g_free (node->name); + + g_free (node->text); + + g_strfreev (node->attributes); + + g_list_foreach (node->sub_nodes, (GFunc) xml_free, NULL); + g_list_free (node->sub_nodes); + + g_slice_free (XMLNode, node); +} + +static void +_start_root_element_cb (GMarkupParseContext *context, + const gchar *element_name, + const gchar **attribute_names, + const gchar **attribute_values, + gpointer user_data, + GError **error) +{ + XMLNode **node = (XMLNode **) user_data; + g_assert (node != NULL); + + XMLNode *p = g_slice_new0 (XMLNode); + + + p->name = g_strdup (element_name); + + GArray *attributes = g_array_new (TRUE, TRUE, sizeof (gchar *)); + while (*attribute_names != NULL && *attribute_values != NULL) { + gchar *p; + p = g_strdup (*attribute_names++); + g_array_append_val (attributes, p); + p = g_strdup (*attribute_values++); + g_array_append_val (attributes, p); + } + + p->attributes = (gchar **) g_array_free (attributes, FALSE); + + g_markup_parse_context_push (context, &parser, p); + *node = p; +} + + +static void +_start_element_cb (GMarkupParseContext *context, + const gchar *element_name, + const gchar **attribute_names, + const gchar **attribute_values, + gpointer user_data, + GError **error) +{ + XMLNode *node = (XMLNode *) user_data; + + if (node->text) { + g_set_error (error, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT, " "); + return; + } + + XMLNode *p = g_slice_new0 (XMLNode); + + node->sub_nodes = g_list_append (node->sub_nodes, p); + g_markup_parse_context_push (context, &parser, p); + + p->name = g_strdup (element_name); + + GArray *attributes = g_array_new (TRUE, TRUE, sizeof (gchar *)); + while (*attribute_names != NULL && *attribute_values != NULL) { + gchar *p; + p = g_strdup (*attribute_names++); + g_array_append_val (attributes, p); + p = g_strdup (*attribute_values++); + g_array_append_val (attributes, p); + } + + p->attributes = (gchar **)g_array_free (attributes, FALSE); +} + +static void +_end_element_cb (GMarkupParseContext *context, + const gchar *element_name, + gpointer user_data, + GError **error) +{ + XMLNode *p = (XMLNode *) g_markup_parse_context_pop (context); + + if (p->text && p->sub_nodes) { + g_warning ("Error"); + } + + if (p->text == NULL && p->sub_nodes == NULL) { + p->text = g_strdup (""); + } +} + +static gboolean +_is_space (const gchar *text, + gsize text_len) +{ + gsize i = 0; + + for (i = 0; text[i] != '\0' && i < text_len; i++) { + switch (text[i]) { + case '\t': + case ' ': + case '\n': + case '\r': + continue; + default: + return FALSE; + } + } + + return TRUE; +} + +static void +_text_cb (GMarkupParseContext *context, + const gchar *text, + gsize text_len, + gpointer user_data, + GError **error) +{ + XMLNode *p = (XMLNode *)user_data; + + if (_is_space (text, text_len)) { + return; + } + + if (p->sub_nodes || p->text) { + g_set_error (error, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT, " "); + return; + } + + p->text = g_strndup (text, text_len); +} + +static GMarkupParser parser = { + _start_element_cb, + _end_element_cb, + _text_cb, + 0, + 0, +}; + +XMLNode * +xml_parse_file (const gchar *filename) +{ + gboolean retval = FALSE; + GError *error = NULL; + FILE *pf = fopen (filename, "r"); + + if (pf == NULL) { + return NULL; + } + + GMarkupParseContext *context; + XMLNode *node; + + const static GMarkupParser root_parser = { + _start_root_element_cb, + _end_element_cb, + _text_cb, + 0, + 0, + }; + + do { + context = g_markup_parse_context_new (&root_parser, 0, &node, 0); + + while (!feof (pf)) { + gchar buf[1024]; + gssize len = 0; + + len = fread (buf, 1, sizeof (buf), pf); + retval = g_markup_parse_context_parse (context, buf, len, &error); + + if (!retval) + break; + } + fclose (pf); + + if (!retval) + break; + + retval = g_markup_parse_context_end_parse (context, &error); + if (!retval) + break; + + g_markup_parse_context_free (context); + + return node; + } while (0); + + g_warning ("Parse %s failed: %s", filename, error->message); + g_error_free (error); + g_markup_parse_context_free (context); + return NULL; +} + +XMLNode * +xml_parse_buffer (const gchar *buffer) +{ + gboolean retval; + GError *error = NULL; + + GMarkupParseContext *context; + XMLNode *node; + + const static GMarkupParser root_parser = { + _start_root_element_cb, + _end_element_cb, + _text_cb, + 0, + 0, + }; + + context = g_markup_parse_context_new (&root_parser, 0, &node, 0); + + do { + retval = g_markup_parse_context_parse (context, buffer, strlen (buffer), &error); + if (!retval) + break; + + retval = g_markup_parse_context_end_parse (context, &error); + if (!retval) + break; + g_markup_parse_context_free (context); + return node; + } while (0); + + g_warning ("Parse buffer failed: %s", error->message); + g_error_free (error); + g_markup_parse_context_free (context); + return NULL; +} + + +static void +output_indent (int level, GString *output) +{ + gint i; + for (i = 0; i < level; i++) { + g_string_append (output, " "); + } +} + +static void +xml_output_indent (const XMLNode *node, int level, GString *output) +{ + gchar **attrs; + + output_indent (level, output); + g_string_append_printf (output, "<%s", node->name); + + attrs = node->attributes; + + while (attrs != NULL && *attrs != NULL) { + g_string_append_printf (output, " %s", *(attrs++)); + g_string_append_printf (output, "=\"%s\"", *(attrs++)); + } + + if (node->sub_nodes != NULL){ + g_string_append (output, ">\n"); + GList *sub_node; + + for (sub_node = node->sub_nodes; sub_node != NULL; sub_node = sub_node->next) { + xml_output_indent (sub_node->data, level + 1, output); + } + output_indent (level, output); + g_string_append_printf (output, "</%s>\n",node->name); + } + else if (node->text != NULL) { + gchar *text = g_markup_escape_text (node->text, -1); + g_string_append_printf (output, ">%s</%s>\n", text, node->name); + g_free (text); + } + else { + g_string_append (output, "/>\n"); + } +} + +void +xml_output (const XMLNode *node, GString *output) +{ + xml_output_indent (node, 0, output); +} + diff --git a/saedit/xml.h b/saedit/xml.h index cf76795..4030d72 100644 --- a/saedit/xml.h +++ b/saedit/xml.h @@ -11,14 +11,31 @@ #ifndef XML_H #define XML_H +#include <stdio.h> #include <glib.h> -#include <ibus.h> #include "common.h" -gchar **xml_attr_new(const gchar *name, const gchar *value); -gchar *xml_node_get_attr_value(const XMLNode *node, const gchar *attr_name); -gint xml_node_compare_with_name_func(gconstpointer a, gconstpointer b); -gint xml_node_compare_with_action_node_by_imageset_name_func(gconstpointer a, gconstpointer b); -gint xml_node_compare_with_attr_func(const XMLNode *node, const gchar **attr); +typedef struct { + gchar *name; + gchar *text; + gchar **attributes; + GList *sub_nodes; +} XMLNode; + + +XMLNode *xml_parse_file (const gchar *name); + +XMLNode *xml_parse_buffer (const gchar *buffer); + +void xml_free (XMLNode *node); + +void xml_output (const XMLNode *node, + GString *output); + +gchar **xml_attr_new(const gchar *name, const gchar *value); +gchar *xml_node_get_attr_value(const XMLNode *node, const gchar *attr_name); +gint xml_node_compare_with_name_func(gconstpointer a, gconstpointer b); +gint xml_node_compare_with_action_node_by_imageset_name_func(gconstpointer a, gconstpointer b); +gint xml_node_compare_with_attr_func(const XMLNode *node, const gchar **attr); #endif |