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

« back to all changes in this revision

Viewing changes to src/gnome2/dictlex.c

  • 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
 * _dictlex.c - gui for commentary modules
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
24
24
#endif
25
25
 
26
26
#include <gtk/gtk.h>
27
 
 
28
 
#ifdef USE_GTKMOZEMBED
29
 
#ifdef WIN32
30
 
#include "geckowin/gecko-html.h"
31
 
#else
32
 
#include "gecko/gecko-html.h"
33
 
#endif
34
 
#else
 
27
#ifdef GTKHTML
35
28
#include <gtkhtml/gtkhtml.h>
36
29
#include "gui/html.h"
37
30
#endif
38
31
 
 
32
#include "../xiphos_html/xiphos_html.h"
 
33
 
39
34
#include "gui/dictlex.h"
40
35
#include "gui/bookmark_dialog.h"
41
36
#include "gui/bookmarks_treeview.h"
83
78
 *                                           gpointer data)
84
79
 *
85
80
 * Description
86
 
 *    an ugly hack to get the selection from gecko on a dbl click
 
81
 *    an ugly hack to get the selection from widget on a dbl click
87
82
 *    and display text in dictionary pane using default dictionary if set or
88
 
 *    current dictionary - this called by gecko/Yelper.cpp
 
83
 *    current dictionary - this called by (gecko|wk)/Yelper.cpp 
89
84
 *    Yelper::ProcessMouseDblClickEvent (void* aEvent)
 
85
 *    also called by wk-html.c   button_press_handler() -- still ugly
90
86
 *
91
87
 * Return value
92
88
 *   void
230
226
 *   gint
231
227
 */
232
228
 
233
 
#ifndef USE_GTKMOZEMBED
 
229
#ifndef USE_XIPHOS_HTML
234
230
static gint html_button_pressed(GtkWidget * html,
235
231
                                GdkEventButton * event, gpointer data)
236
232
{
249
245
                break;
250
246
        case 3:
251
247
                //gui_create_pm_dictionary();
252
 
                gui_menu_popup (settings.DictWindowModule, NULL);
 
248
                gui_menu_popup (NULL, settings.DictWindowModule, NULL);
253
249
                break;
254
 
                /*gtk_signal_emit_stop_by_name(GTK_OBJECT(html),
 
250
                /*gtk_signal_emit_stop_by_name(G_OBJECT(html),
255
251
                   "button_press_event"); */
256
252
                break;
257
253
        default:
319
315
        return FALSE;
320
316
}
321
317
 
322
 
#endif /* !USE_GTKMOZEMBED */
 
318
#endif /* !USE_XIPHOS_HTML */
323
319
 
324
320
/******************************************************************************
325
321
 * Name
473
469
                     gpointer user_data)
474
470
{
475
471
        GtkWidget *widget;
476
 
 
 
472
        GtkAllocation allocation;
 
473
    
477
474
        g_return_if_fail (GTK_IS_BUTTON (user_data));
 
475
#if defined(HAVE_GTK_220) || defined(USE_GTK_3)
 
476
        g_return_if_fail (gtk_widget_get_window(user_data));
 
477
#else
478
478
        g_return_if_fail (GTK_WIDGET_NO_WINDOW (user_data));
479
 
 
 
479
#endif
480
480
        widget = GTK_WIDGET (user_data);
481
481
 
482
 
        gdk_window_get_origin (widget->window, x, y);
483
 
 
484
 
        *x += widget->allocation.x;
485
 
        *y += widget->allocation.y + widget->allocation.height;
 
482
        gdk_window_get_origin (gtk_widget_get_window(widget), x, y);
 
483
        gtk_widget_get_allocation (widget,&allocation);
 
484
        *x += allocation.x;
 
485
        *y += allocation.y + allocation.height;
486
486
 
487
487
        *push_in = FALSE;
488
488
}
533
533
        }
534
534
        return FALSE;
535
535
}
536
 
#ifdef USE_GTKMOZEMBED
 
536
#ifdef USE_XIPHOS_HTML
537
537
static void
538
 
_popupmenu_requested_cb (GeckoHtml *html,
 
538
_popupmenu_requested_cb (XiphosHtml *html,
539
539
                             gchar *uri,
540
540
                             gpointer user_data)
541
541
{
542
 
        gui_menu_popup (settings.DictWindowModule, NULL);
 
542
        gui_menu_popup (html, settings.DictWindowModule, NULL);
543
543
        //gui_create_pm_dictionary();
544
544
}
545
545
#endif
547
547
GtkWidget *gui_create_dictionary_pane(void)
548
548
{
549
549
        GtkWidget *box_dict;
550
 
//      GtkWidget *hpaned;
551
 
//      GtkWidget *vbox;
552
550
        GtkWidget *hbox2;
553
551
        GtkWidget *button10;
554
552
        GtkWidget *image1;
555
 
//      GtkWidget *comboboxentry1;
556
553
        GtkWidget *button11;
557
554
        GtkWidget *image2;
558
555
        GtkWidget *arrow1;
559
 
//      GtkWidget *frame_entry;
560
 
//      GtkWidget *toolbarDLKey;
561
556
        GtkWidget *dict_drop_down;
562
 
//      GtkWidget *tmp_toolbar_icon;
563
 
//      GtkWidget *label205;
564
 
#ifdef USE_GTKMOZEMBED
565
 
        GtkWidget *frame;
566
 
        GtkWidget *eventbox;
567
 
#else
568
557
        GtkWidget *scrolledwindow;
569
 
#endif
570
 
//      GtkListStore *model;
571
 
//      GtkListStore *store;
572
558
 
573
559
        box_dict = gtk_vbox_new(FALSE, 0);
574
560
        gtk_widget_show(box_dict);
610
596
        gtk_widget_show(image2);
611
597
        gtk_container_add(GTK_CONTAINER(button11), image2);
612
598
 
613
 
#ifdef USE_GTKMOZEMBED
614
 
        frame = gtk_frame_new(NULL);
615
 
        gtk_frame_set_shadow_type(GTK_FRAME(frame), settings.shadow_type);
616
 
        gtk_box_pack_start(GTK_BOX(box_dict), frame, TRUE, TRUE, 0);
617
 
        gtk_widget_show(frame);
618
 
 
619
 
        eventbox = gtk_event_box_new ();
620
 
        gtk_container_add(GTK_CONTAINER(frame), eventbox);
621
 
        gtk_widget_show (eventbox);
622
 
 
623
 
        widgets.html_dict = GTK_WIDGET(gecko_html_new(NULL, FALSE, DICTIONARY_TYPE));
 
599
        scrolledwindow = gtk_scrolled_window_new(NULL, NULL);
 
600
        gtk_widget_show(scrolledwindow);
 
601
        gtk_box_pack_start(GTK_BOX(box_dict), scrolledwindow, TRUE, TRUE, 0);
 
602
        
 
603
        gtk_scrolled_window_set_shadow_type((GtkScrolledWindow *)scrolledwindow,
 
604
                                             settings.shadow_type);
 
605
#ifdef USE_XIPHOS_HTML
 
606
        widgets.html_dict = GTK_WIDGET(XIPHOS_HTML_NEW(NULL, FALSE, DICTIONARY_TYPE));
624
607
        gtk_widget_show(widgets.html_dict);
625
 
        gtk_container_add(GTK_CONTAINER(eventbox),
 
608
        gtk_container_add(GTK_CONTAINER(scrolledwindow),
626
609
                         widgets.html_dict);
627
610
        g_signal_connect((gpointer)widgets.html_dict,
628
611
                      "popupmenu_requested",
629
612
                      G_CALLBACK (_popupmenu_requested_cb),
630
613
                      NULL);
631
614
#else
632
 
        scrolledwindow = gtk_scrolled_window_new(NULL, NULL);
633
 
        gtk_widget_show(scrolledwindow);
634
 
        gtk_box_pack_start(GTK_BOX(box_dict), scrolledwindow, TRUE, TRUE, 0);
635
 
 
636
 
        gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW
637
 
                                       (scrolledwindow),
638
 
                                       GTK_POLICY_AUTOMATIC,
639
 
                                       GTK_POLICY_AUTOMATIC);
640
 
        gtk_scrolled_window_set_shadow_type((GtkScrolledWindow *)scrolledwindow,
641
 
                                             settings.shadow_type);
642
615
 
643
616
        widgets.html_dict = gtk_html_new();
644
617
        gtk_widget_show(widgets.html_dict);
645
618
        gtk_container_add(GTK_CONTAINER(scrolledwindow),
646
619
                          widgets.html_dict);
647
620
 
648
 
        g_signal_connect(GTK_OBJECT(widgets.html_dict),
 
621
        g_signal_connect(G_OBJECT(widgets.html_dict),
649
622
                         "button_press_event",
650
623
                         G_CALLBACK(html_button_pressed), NULL);
651
 
        g_signal_connect(GTK_OBJECT(widgets.html_dict),
 
624
        g_signal_connect(G_OBJECT(widgets.html_dict),
652
625
                         "button_release_event",
653
626
                         G_CALLBACK(html_button_released), NULL);
654
 
        g_signal_connect(GTK_OBJECT(widgets.html_dict),
 
627
        g_signal_connect(G_OBJECT(widgets.html_dict),
655
628
                         "url_requested",
656
629
                         G_CALLBACK(url_requested), NULL);
657
 
        g_signal_connect(GTK_OBJECT(widgets.html_dict), "on_url",
 
630
        g_signal_connect(G_OBJECT(widgets.html_dict), "on_url",
658
631
                         G_CALLBACK(gui_url),
659
632
                         GINT_TO_POINTER(DICTIONARY_TYPE));
660
 
        g_signal_connect(GTK_OBJECT(widgets.html_dict), "link_clicked",
 
633
        g_signal_connect(G_OBJECT(widgets.html_dict), "link_clicked",
661
634
                         G_CALLBACK(gui_link_clicked), NULL);
662
635
#endif
663
636