~pkgcrosswire/xiphos/main

« back to all changes in this revision

Viewing changes to src/main/module_dialogs.cc

  • Committer: Dmitrijs Ledkovs
  • Date: 2010-11-14 00:38:52 UTC
  • mfrom: (1.1.6 upstream)
  • Revision ID: dmitrij.ledkov@ubuntu.com-20101114003852-sjt227lz4qqi85xj
New upstream release 3.1.4

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
 * Xiphos Bible Study Tool
3
3
 * module_dialogs.cc - view module in a dialog
4
4
 *
5
 
 * Copyright (C) 2000-2009 Xiphos Developer Team
 
5
 * Copyright (C) 2000-2010 Xiphos Developer Team
6
6
 *
7
7
 * This program is free software; you can redistribute it and/or modify
8
8
 * it under the terms of the GNU General Public License as published by
28
28
#include <swmodule.h>
29
29
#include <url.h>
30
30
 
31
 
#ifdef USE_GTKMOZEMBED
32
 
#ifdef WIN32
33
 
#include "geckowin/gecko-html.h"
34
 
#else
35
 
#include "gecko/gecko-html.h"
36
 
#endif
37
 
#else
38
 
#ifdef __cplusplus
39
 
extern "C" {
40
 
#endif
41
 
#include <gtkhtml/gtkhtml.h>
42
 
#include "gui/html.h"
43
 
#ifdef __cplusplus
44
 
}
45
 
#endif
46
 
#endif
47
 
 
48
31
#include <string.h>
49
32
 
50
33
#include "gui/bibletext_dialog.h"
202
185
 
203
186
void main_dialogs_clear_viewer(DIALOG_DATA *d)
204
187
{
205
 
        GString *tmp_str = g_string_new(NULL);
206
 
        GString *str;
207
 
        const char *buf;
208
 
 
209
 
#ifdef USE_GTKMOZEMBED
210
 
        GeckoHtml *new_browser = GECKO_HTML(d->previewer);
211
 
#else
212
 
        gboolean was_editable = FALSE;
213
 
 
214
 
        /* setup gtkhtml widget */
215
 
        GtkHTML *html = GTK_HTML(d->previewer);
216
 
        was_editable = gtk_html_get_editable(html);
217
 
        if (was_editable)
218
 
                gtk_html_set_editable(html, FALSE);
219
 
#endif
220
 
        g_string_printf(tmp_str,
221
 
                HTML_START
222
 
                "<body bgcolor=\"%s\" text=\"%s\" link=\"%s\">",
223
 
                settings.bible_bg_color, settings.bible_text_color,
224
 
                settings.link_color);
225
 
 
226
 
        str = g_string_new(tmp_str->str);
227
 
        buf = N_("Previewer");
228
 
        g_string_printf(tmp_str,
229
 
        "<b>%s</b><br><font color=\"grey\">" "<HR></font><br>", buf);
230
 
        str = g_string_append(str, tmp_str->str);
231
 
 
232
 
        g_string_printf(tmp_str, " %s", "</font></body></html>");
233
 
        str = g_string_append(str, tmp_str->str);
234
 
 
235
 
#ifdef USE_GTKMOZEMBED
236
 
        if (str->len)
237
 
                gecko_html_render_data(new_browser, str->str, str->len);
238
 
 
239
 
#else
240
 
        if (str->len)
241
 
                gtk_html_load_from_string(html,str->str,str->len);
242
 
        gtk_html_set_editable(html, was_editable);
243
 
#endif
244
 
        //free_font(mf);
 
188
        GString *str = g_string_new(NULL);
 
189
        const char *buf = N_("Previewer");
 
190
 
 
191
        g_string_printf(str,
 
192
                        HTML_START
 
193
                        "<body bgcolor=\"%s\" text=\"%s\" link=\"%s\">"
 
194
                        "<b><font color=\"grey\" size=\"-1\">%s</font></b><hr/></body></html>",
 
195
                        settings.bible_bg_color, settings.bible_text_color,
 
196
                        settings.link_color, buf);
 
197
 
 
198
        HtmlOutput(str->str, d->previewer, NULL, NULL);
245
199
        g_string_free(str, TRUE);
246
 
        g_string_free(tmp_str, TRUE);
247
200
}
248
201
 
249
202
 
272
225
        GString *tmp_str = g_string_new(NULL);
273
226
        GString *str;
274
227
        MOD_FONT *mf = get_font(mod_name);
275
 
#ifdef USE_GTKMOZEMBED
276
 
        GeckoHtml *new_browser = GECKO_HTML(sidebar.html_viewer_widget);
277
 
#else
278
 
        GtkHTML *html = GTK_HTML(sidebar.html_viewer_widget);
279
 
#endif
280
228
 
281
229
        g_string_printf(tmp_str,
282
230
                HTML_START
288
236
        if (type) {
289
237
                if (!strcmp(type,"n")) {
290
238
                        g_string_printf(tmp_str,
291
 
                                "<font color=\"grey\">%s<HR></font><br>",
 
239
                                "<font color=\"grey\">%s<hr/></font><br/>",
292
240
                                        _("Footnote"));
293
241
                        str = g_string_append(str, tmp_str->str);
294
242
                }
295
243
                if (!strcmp(type,"x")) {
296
244
                        g_string_printf(tmp_str,
297
 
                                "<font color=\"grey\">%s<HR></font><br>",
 
245
                                "<font color=\"grey\">%s<hr/></font><br/>",
298
246
                                        _("Cross Reference"));
299
247
                        str = g_string_append(str, tmp_str->str);
300
248
                }
301
249
                if (!strcmp(action ,"showStrongs")) {  //&& !strcmp(type,"Greek")
302
250
                        g_string_printf(tmp_str,
303
 
                                "<font color=\"grey\">%s: %s<HR></font><br>",
 
251
                                "<font color=\"grey\">%s: %s<hr/></font><br/>",
304
252
                                        _("Strongs"),key);
305
253
                        str = g_string_append(str, tmp_str->str);
306
254
                }
307
255
                if (!strcmp(action ,"showMorph")) {  //&& !strcmp(type,"Greek")
308
256
                        g_string_printf(tmp_str,
309
 
                                "<font color=\"grey\">%s: %s<HR></font><br>",
 
257
                                "<font color=\"grey\">%s: %s<hr/></font><br/>",
310
258
                                        _("Morphology"),key);
311
259
                        str = g_string_append(str, tmp_str->str);
312
260
                }
314
262
 
315
263
        if (!strcmp(action ,"showStrongsMorph")) {  //&& !strcmp(type,"Greek")
316
264
                g_string_printf(tmp_str,
317
 
                        "<font color=\"grey\">%s: %s<HR></font><br>",
 
265
                        "<font color=\"grey\">%s: %s<hr/></font><br/>",
318
266
                                _("Strongs"),key);
319
267
                str = g_string_append(str, tmp_str->str);
320
268
                g_string_printf(tmp_str,
325
273
                str = g_string_append(str, text);
326
274
 
327
275
                g_string_printf(tmp_str,
328
 
                        "<font color=\"grey\"><br><br>%s: %s<HR></font><br>",
 
276
                        "<font color=\"grey\"><br/><br/>%s: %s<hr/></font><br/>",
329
277
                                        _("Morphology"),morph);
330
278
                str = g_string_append(str, tmp_str->str);
331
279
                str = g_string_append(str, morph_text);
332
 
                g_string_printf(tmp_str, " %s<br>", "</font></body></html>");
 
280
                g_string_printf(tmp_str, " %s<br/>", "</font></body></html>");
333
281
                str = g_string_append(str, tmp_str->str);
334
282
 
335
283
 
346
294
 
347
295
        }
348
296
 
349
 
#ifdef USE_GTKMOZEMBED
350
 
        if (str->len)
351
 
                gecko_html_render_data(new_browser, str->str, str->len);
352
 
#else
353
 
        if (str->len)
354
 
                gtk_html_load_from_string(html,str->str,str->len);
355
 
        //gtk_html_set_editable(html, was_editable);
356
 
#endif
357
 
/*      if (str->len) {
358
 
                gtk_html_load_from_string(html,str->str,str->len);
359
 
        }
360
 
*/
 
297
        HtmlOutput(str->str, sidebar.html_viewer_widget, NULL, NULL);
361
298
        free_font(mf);
362
299
        g_string_free(str, TRUE);
363
300
        g_string_free(tmp_str, TRUE);
385
322
 *   void
386
323
 */
387
324
 
388
 
void main_dialog_information_viewer(const gchar * mod_name, const gchar * text,
389
 
                                                                        const gchar * key, const gchar * action,
390
 
                                                                        const gchar * type, const gchar * morph_text,
391
 
                                                                        const gchar * morph, DIALOG_DATA * d)
 
325
void main_dialog_information_viewer(const gchar * mod_name,
 
326
                                    const gchar * text,
 
327
                                    const gchar * key,
 
328
                                    const gchar * action,
 
329
                                    const gchar * type,
 
330
                                    const gchar * morph_text,
 
331
                                    const gchar * morph,
 
332
                                    DIALOG_DATA * d)
392
333
{
393
334
        GString *tmp_str = g_string_new(NULL);
394
335
        GString *str;
397
338
        if (!d->previewer)
398
339
                return;
399
340
 
400
 
#ifdef USE_GTKMOZEMBED
401
 
        GeckoHtml *html= GECKO_HTML(d->previewer);
402
 
#else
403
 
        GtkHTML *html= GTK_HTML(d->previewer);
404
 
#endif
405
 
 
406
341
        g_string_printf(tmp_str,
407
342
                HTML_START
408
343
                "<body bgcolor=\"%s\" text=\"%s\" link=\"%s\">",
412
347
        str = g_string_new(tmp_str->str);
413
348
        if (type) {
414
349
                if (!strcmp(type,"n")) {
415
 
                        g_string_printf(tmp_str,"<font color=\"grey\">%s<HR></font><br>",
 
350
                        g_string_printf(tmp_str,"<font color=\"grey\">%s<hr/></font><br/>",
416
351
                                        _("Footnote"));
417
352
                        str = g_string_append(str, tmp_str->str);
418
353
                }
419
354
                if (!strcmp(type,"x")) {
420
 
                        g_string_printf(tmp_str,"<font color=\"grey\">%s<HR></font><br>",
 
355
                        g_string_printf(tmp_str,"<font color=\"grey\">%s<hr/></font><br/>",
421
356
                                        _("Cross Reference"));
422
357
                        str = g_string_append(str, tmp_str->str);
423
358
                }
424
359
                if (!strcmp(action ,"showStrongs")) {  //&& !strcmp(type,"Greek")
425
 
                        g_string_printf(tmp_str,"<font color=\"grey\">%s: %s<HR></font><br>",
 
360
                        g_string_printf(tmp_str,"<font color=\"grey\">%s: %s<hr/></font><br/>",
426
361
                                        _("Strongs"),key);
427
362
                        str = g_string_append(str, tmp_str->str);
428
363
                }
429
364
                if (!strcmp(action ,"showMorph")) {  //&& !strcmp(type,"Greek")
430
 
                        g_string_printf(tmp_str,"<font color=\"grey\">%s: %s<HR></font><br>",
 
365
                        g_string_printf(tmp_str,"<font color=\"grey\">%s: %s<hr/></font><br/>",
431
366
                                        _("Morphology"),key);
432
367
                        str = g_string_append(str, tmp_str->str);
433
368
                }
434
369
        }
435
370
 
436
371
        if (!strcmp(action ,"showStrongsMorph")) {  //&& !strcmp(type,"Greek")
437
 
                g_string_printf(tmp_str,"<font color=\"grey\">%s: %s<HR></font><br>",
 
372
                g_string_printf(tmp_str,"<font color=\"grey\">%s: %s<hr/></font><br/>",
438
373
                                _("Strongs"),key);
439
374
                str = g_string_append(str, tmp_str->str);
440
375
                g_string_printf(tmp_str,
444
379
                str = g_string_append(str, tmp_str->str);
445
380
                str = g_string_append(str, text);
446
381
 
447
 
                g_string_printf(tmp_str,"<font color=\"grey\"><br><br>%s: %s<HR></font><br>",
 
382
                g_string_printf(tmp_str,"<font color=\"grey\"><br/><br/>%s: %s<hr/></font><br/>",
448
383
                                        _("Morphology"),morph);
449
384
                str = g_string_append(str, tmp_str->str);
450
385
                str = g_string_append(str, morph_text);
451
 
                g_string_printf(tmp_str, " %s<br>", "</font></body></html>");
 
386
                g_string_printf(tmp_str, " %s<br/>", "</font></body></html>");
452
387
                str = g_string_append(str, tmp_str->str);
453
388
 
454
389
 
465
400
 
466
401
        }
467
402
 
468
 
#ifdef USE_GTKMOZEMBED
469
 
        if (str->len) {
470
 
                gecko_html_open_stream(html,"text/html");
471
 
                gecko_html_write(html, str->str, str->len);
472
 
                gecko_html_close(html);
473
 
        }
474
 
#else
475
 
        if (str->len)
476
 
                gtk_html_load_from_string(html,str->str,str->len);
477
 
#endif
478
 
 
479
 
 
 
403
        HtmlOutput(str->str, d->previewer, NULL, NULL);
480
404
        free_font(mf);
481
405
        g_string_free(str, TRUE);
482
406
        g_string_free(tmp_str, TRUE);
1060
984
                while (tmp != NULL) {
1061
985
                        buf = g_strdup_printf(
1062
986
                                "<a href=\"sword://%s/%s\">"
1063
 
                                "<font color=\"%s\">%s,</font></a><br>",
 
987
                                "<font color=\"%s\">%s,</font></a><br/>",
1064
988
                                (gchar*)module,
1065
989
                                (const char *) tmp->data,
1066
990
                                settings.bible_text_color,
1076
1000
 
1077
1001
                buf = g_strdup_printf(
1078
1002
                                "<a href=\"sword://%s/%s\">"
1079
 
                                "<font color=\"%s\">%s%s</font></a><br>",
 
1003
                                "<font color=\"%s\">%s%s</font></a><br/>",
1080
1004
                                (gchar*)module,
1081
1005
                                d->key,
1082
1006
                                settings.bible_text_color,