72 |
GtkWidget *mi_save; |
GtkWidget *mi_save; |
73 |
|
|
74 |
GtkWidget *view_menu; |
GtkWidget *view_menu; |
75 |
|
gboolean show_optional; |
76 |
|
|
77 |
GtkWidget *emotion_search; |
GtkWidget *emotion_search; |
78 |
|
|
188 |
return selected; |
return selected; |
189 |
} |
} |
190 |
|
|
191 |
|
static gboolean |
192 |
|
_cr_is_situation_matching (AppCrossRef *cr, AppIp *ip, ep_pattern *pat) |
193 |
|
{ |
194 |
|
gint chain; |
195 |
|
g_object_get (ip, "chaining", &chain, NULL); |
196 |
|
if (!cr->show_optional && chain == IP_CHAINING_OPTIONAL) |
197 |
|
return FALSE; |
198 |
|
|
199 |
|
return app_ip_empathy_match (ip, pat); |
200 |
|
} |
201 |
|
|
202 |
static void |
static void |
203 |
_cr_load_ipset (AppCrossRef *cr) |
_cr_load_ipset (AppCrossRef *cr) |
204 |
{ |
{ |
234 |
for (GSList *cur=selected; cur; cur = g_slist_next (cur)) { |
for (GSList *cur=selected; cur; cur = g_slist_next (cur)) { |
235 |
ep_pattern *pat = cur->data; |
ep_pattern *pat = cur->data; |
236 |
|
|
237 |
if (app_ip_empathy_match (ip, pat)) |
if (_cr_is_situation_matching (cr, ip, pat)) { |
238 |
{ |
g_ptr_set_add (cr->ipset, ip); |
239 |
g_ptr_set_add (cr->ipset, ip); |
if (g_ptr_set_len (cr->ipset) >= limit) |
240 |
if (g_ptr_set_len (cr->ipset) >= limit) |
{ overflow = TRUE; goto done; } |
241 |
{ overflow = TRUE; goto done; } |
break; |
242 |
break; |
} |
|
} |
|
243 |
} |
} |
244 |
} |
} |
245 |
} |
} |
585 |
for (GSList *cur=selected; cur; cur = g_slist_next (cur)) { |
for (GSList *cur=selected; cur; cur = g_slist_next (cur)) { |
586 |
ep_pattern *pat = cur->data; |
ep_pattern *pat = cur->data; |
587 |
|
|
588 |
if (app_ip_empathy_match (ip, pat)) |
if (_cr_is_situation_matching (cr, ip, pat)) |
589 |
{ g_ptr_set_add (cr->ipset, ip); break; } |
{ g_ptr_set_add (cr->ipset, ip); break; } |
590 |
} |
} |
591 |
|
|
697 |
} |
} |
698 |
|
|
699 |
static void |
static void |
700 |
|
_cr_tog_optional (AppCrossRef *cr) |
701 |
|
{ |
702 |
|
cr->show_optional = !cr->show_optional; |
703 |
|
_cr_load_ipset (cr); |
704 |
|
} |
705 |
|
|
706 |
|
static void |
707 |
_cr_load_view_menu (AppCrossRef *cr) |
_cr_load_view_menu (AppCrossRef *cr) |
708 |
{ |
{ |
709 |
GtkWidget *menu = gtk_menu_new (); |
GtkWidget *menu = gtk_menu_new (); |
710 |
GtkWidget *mi; |
GtkWidget *mi; |
711 |
GPtrSet *ps = Whole->documents; |
|
712 |
gboolean separator = FALSE; |
mi = gtk_check_menu_item_new_with_label ("Optional Chaining"); |
713 |
|
gtk_menu_append (GTK_MENU_SHELL (menu), mi); |
714 |
|
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (mi), cr->show_optional); |
715 |
|
g_signal_connect_swapped (mi, "toggled", |
716 |
|
G_CALLBACK (_cr_tog_optional), cr); |
717 |
|
|
718 |
|
gtk_menu_append (GTK_MENU_SHELL (menu), gtk_separator_menu_item_new ()); |
719 |
|
|
720 |
mi = gtk_image_menu_item_new_from_stock (GTK_STOCK_OPEN, NULL); |
mi = gtk_image_menu_item_new_from_stock (GTK_STOCK_OPEN, NULL); |
721 |
gtk_menu_append (GTK_MENU_SHELL (menu), mi); |
gtk_menu_append (GTK_MENU_SHELL (menu), mi); |
722 |
g_signal_connect_swapped (mi, "activate", |
g_signal_connect_swapped (mi, "activate", |
723 |
G_CALLBACK (_cr_open_transcript), NULL); |
G_CALLBACK (_cr_open_transcript), NULL); |
724 |
|
|
725 |
|
GPtrSet *ps = Whole->documents; |
726 |
for (gint xx=0; xx < g_ptr_set_len (ps); xx++) { |
for (gint xx=0; xx < g_ptr_set_len (ps); xx++) { |
727 |
AppTranscript *tx = g_ptr_set_at (ps, xx); |
AppTranscript *tx = g_ptr_set_at (ps, xx); |
728 |
|
|
733 |
gboolean cross_ref; |
gboolean cross_ref; |
734 |
g_object_get (tx, "cross-reference", &cross_ref, NULL); |
g_object_get (tx, "cross-reference", &cross_ref, NULL); |
735 |
|
|
|
if (!separator) { |
|
|
separator = TRUE; |
|
|
gtk_menu_append (GTK_MENU_SHELL (menu), gtk_separator_menu_item_new ()); |
|
|
} |
|
|
|
|
736 |
if (cross_ref) |
if (cross_ref) |
737 |
_cr_watch_transcript (cr, tx); |
_cr_watch_transcript (cr, tx); |
738 |
|
|
827 |
AppTranscript *tx1 = app_ip_get_transcript (ip1); |
AppTranscript *tx1 = app_ip_get_transcript (ip1); |
828 |
AppTranscript *tx2 = app_ip_get_transcript (ip2); |
AppTranscript *tx2 = app_ip_get_transcript (ip2); |
829 |
|
|
830 |
if (tx1 < tx2) |
gint cmp = leadr_doc_pathname_cmp (LEADR_DOC (tx1), LEADR_DOC (tx2)); |
831 |
return -1; |
|
832 |
else if (tx1 > tx2) |
if (cmp) return cmp; |
833 |
return 1; |
else return app_ip_compare_span (ip1, 's', ip2, 's'); |
|
else |
|
|
return app_ip_compare_span (ip1, 's', ip2, 's'); |
|
834 |
} |
} |
835 |
|
|
836 |
static void |
static void |
2134 |
g_free (pattern); |
g_free (pattern); |
2135 |
} |
} |
2136 |
|
|
2137 |
|
// This count will be inaccurate if show_optional=FALSE. I don't |
2138 |
|
// consider this important enough to be a bug. |
2139 |
|
// |
2140 |
static gint |
static gint |
2141 |
_es_calc_count (ep_pattern *epp) |
_es_calc_count (ep_pattern *epp) |
2142 |
{ |
{ |