config: use white background for translation
[cnoor.git] / cnoor.c
blobf049aa1d2ab627c6e4681da20dd3c5a1a43182b4
1 #include <stdlib.h>
2 #include "config.h"
3 #include "txtwin.h"
4 #include "quran.h"
5 #include "util.h"
7 static void ins_sura(struct txtwin *tw, struct quran *quran,
8 struct quran *trans, int sura)
10 char buf[16 * 1024];
11 int start = sura_start(sura);
12 int ayas = sura_ayas(sura);
13 int i;
14 for (i = 0; i < ayas; i++) {
15 quran_aya(quran, buf, LENGTH(buf), start + i);
16 txtwin_append(tw, buf, "quran");
17 txtwin_append(tw, "\n", NULL);
18 if (!trans)
19 continue;
20 quran_aya(trans, buf, LENGTH(buf), start + i);
21 txtwin_append(tw, buf, "trans");
22 txtwin_append(tw, "\n\n", NULL);
26 static void set_tags(struct txtwin *tw)
28 txtwin_tag(tw, "quran", QURAN_FG, QURAN_BG, QURAN_FONT);
29 txtwin_tag(tw, "trans", TRANS_FG, TRANS_BG, TRANS_FONT);
32 int main(int argc, char **argv)
34 struct txtwin *tw;
35 struct quran *quran;
36 struct quran *trans = NULL;
37 txtwin_gtk_init(argc, argv);
38 tw = txtwin_alloc();
39 quran = quran_alloc(QURAN_PATH);
40 if (TRANS_PATH)
41 trans = quran_alloc(TRANS_PATH);
42 set_tags(tw);
43 ins_sura(tw, quran, trans, 1);
45 txtwin_loop(tw);
46 txtwin_free(tw);
47 quran_free(quran);
48 return 0;