~ubuntu-branches/ubuntu/trusty/xiphos/trusty

« back to all changes in this revision

Viewing changes to src/main/previewer.cc

  • Committer: Package Import Robot
  • Author(s): Dmitrijs Ledkovs, Dmitrijs Ledkovs
  • Date: 2012-03-11 18:43:32 UTC
  • mfrom: (17.1.2 sid)
  • Revision ID: package-import@ubuntu.com-20120311184332-splq3ecpx7tyi87d
Tags: 3.1.5+dfsg-1
[ Dmitrijs Ledkovs <dmitrij.ledkov@ubuntu.com> ]  
* New upstream release.
* Build using webkit backend
* Contains unpacked source for waf binary (Closes: #654511)
* Update debian/copyright to latest specification

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
 * Xiphos Bible Study Tool
3
3
 * previewer.cc -
4
4
 *
5
 
 * Copyright (C) 2000-2010 Xiphos Developer Team
 
5
 * Copyright (C) 2000-2011 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
48
48
#include "main/xml.h"
49
49
#include "backend/sword_main.hh"
50
50
 
 
51
#include "xiphos_html/xiphos_html.h"
 
52
 
51
53
#include "gui/debug_glib_null.h"
52
54
 
53
 
#define HTML_START "<html><head><meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\"><style type=\"text/css\"><!-- A { text-decoration:none } --></style></head>"
 
55
#define HTML_START      "<html><head><meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\"><style type=\"text/css\"><!-- A { text-decoration:none } *[dir=rtl] { text-align: right; } --></style></head>"
54
56
 
55
57
using namespace std;
56
58
 
91
93
{
92
94
        GString *str = g_string_new(NULL);
93
95
        gchar *buf = _("Previewer");
 
96
        MOD_FONT *mf = get_font(settings.MainWindowModule);
94
97
 
95
98
        g_string_printf(str,
96
99
                        HTML_START
97
100
                        "<body bgcolor=\"%s\" text=\"%s\" link=\"%s\">"
98
 
                        "<font color=\"grey\" size=\"-1\"><b>%s</b></font><hr/></body></html>",
 
101
                        "<font color=\"grey\" face=\"%s\" size=\"%+d\"><b>%s</b></font><hr/></body></html>",
99
102
                        settings.bible_bg_color, settings.bible_text_color,
100
103
                        settings.link_color,
 
104
                        ((mf->old_font) ? mf->old_font : ""),
 
105
                        mf->old_font_size_value - 1,
101
106
                        buf);
 
107
        free_font(mf);
102
108
        HtmlOutput(str->str, previewer_html_widget, NULL, NULL);
103
109
        g_string_free(str, TRUE);
104
110
}
167
173
                        settings.bible_bg_color, settings.bible_text_color,
168
174
                        settings.link_color,
169
175
                        (mf->old_font ? mf->old_font : "none"),
170
 
                        (mf->old_font_size
171
 
                         ? atoi(mf->old_font_size) + settings.base_font_size
172
 
                         : settings.base_font_size) - 1);
 
176
                        mf->old_font_size_value - 1);
173
177
 
174
178
        str = g_string_new(tmp_str->str);
175
179
 
229
233
 
230
234
        str = g_string_append(str, "</font></body></html>");
231
235
 
232
 
        HtmlOutput(str->str, previewer_html_widget, mf, NULL);
 
236
        HtmlOutput((char *)AnalyzeForImageSize
 
237
                           (str->str,
 
238
                            GDK_WINDOW(gtk_widget_get_window(previewer_html_widget))),
 
239
                           previewer_html_widget, mf, NULL);
233
240
        free_font(mf);
234
241
        g_string_free(str, TRUE);
235
242
        g_string_free(tmp_str, TRUE);
265
272
        }
266
273
        GS_message(("%s",settings.searchText));
267
274
        /* open and close tags */
268
 
#ifdef USE_GTKMOZEMBED
 
275
#ifdef USE_XIPHOS_HTML
269
276
        sprintf(openstr,
270
277
                "<span style=\"background-color: %s; color: %s\">",
271
278
                settings.highlight_fg, settings.highlight_bg);
273
280
#else
274
281
        sprintf(openstr, "<font color=\"%s\"><b>", settings.found_color);
275
282
        sprintf(closestr, "</b></font>");
276
 
#endif /* !USE_GTKMOZEMBED */
 
283
#endif /* !USE_XIPHOS_HTML */
277
284
        searchbuf = g_utf8_casefold(g_strdup(settings.searchText),-1);
278
285
        if (g_str_has_prefix(searchbuf, "\"")) {
279
286
                searchbuf = g_strdelimit(searchbuf, "\"", ' ');
300
307
                        while ((token = strtok(NULL, " ")) != NULL) {
301
308
                                if (!isalnum(*token) && isalnum(*(token+1)))
302
309
                                        token++;
 
310
                                if (!strncmp(token, "lemma:", 6))
 
311
                                        token += 7;     // skip the H/G qualifier.
303
312
                                list = g_list_append(list, token);
304
313
                                ++count;
305
314
                        }
426
435
        g_string_printf(tmp_str,
427
436
                        "<font face=\"%s\" size=\"%+d\">",
428
437
                        (mf->old_font ? mf->old_font : "none"),
429
 
                        (mf->old_font_size
430
 
                         ? atoi(mf->old_font_size) + settings.base_font_size
431
 
                         : settings.base_font_size) - 1);
 
438
                        mf->old_font_size_value - 1);
432
439
        str = g_string_append(str, tmp_str->str);
433
440
 
434
441
        /* show key in html widget  */
465
472
        g_string_printf(tmp_str, " %s", "</font></body></html>");
466
473
        str = g_string_append(str, tmp_str->str);
467
474
 
468
 
        HtmlOutput(str->str, html_widget, mf, NULL);
 
475
        HtmlOutput((char *)AnalyzeForImageSize
 
476
                           (str->str,
 
477
                            GDK_WINDOW(gtk_widget_get_window(html_widget))),
 
478
                            html_widget, mf, NULL);
469
479
        free_font(mf);
470
480
        g_string_free(str, TRUE);
471
481
        g_string_free(tmp_str, TRUE);