diff options
author | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
commit | e0c6872cf40896c7be36b11dcc744620f10adf1d (patch) | |
tree | 60335e10d2f4354b0674ec22d7b53f0f8abee672 /biblio/bibtex/utils/xbibfile |
Initial commit
Diffstat (limited to 'biblio/bibtex/utils/xbibfile')
40 files changed, 10171 insertions, 0 deletions
diff --git a/biblio/bibtex/utils/xbibfile/INSTALL b/biblio/bibtex/utils/xbibfile/INSTALL new file mode 100644 index 0000000000..686510de39 --- /dev/null +++ b/biblio/bibtex/utils/xbibfile/INSTALL @@ -0,0 +1,11 @@ +Oh, maybe a few words about installation are in order. + +To compile and link the 'xbibfile' executable, you will need a C compiler and +libraries, together with a GTK version 2.0 or greater graphics library. +Basically one executable will be generated that can be stored where ever you +desire. Because there are a number of sources files involved, a 'Makefile' is +provided. Thus on a Unix or Linux system: + make + ./xbibfile & +and you are away. + diff --git a/biblio/bibtex/utils/xbibfile/Makefile b/biblio/bibtex/utils/xbibfile/Makefile new file mode 100644 index 0000000000..7c459e7cc3 --- /dev/null +++ b/biblio/bibtex/utils/xbibfile/Makefile @@ -0,0 +1,106 @@ +CC = gcc +OBJ = xbibfile.o cleanup.o selecting.o filing.o linking.o error.o\ + article.o book.o booklet.o conference.o inbook.o incol.o \ + inproc.o manual.o masters.o misc.o phd.o proceedings.o \ + techreport.o unpublished.o \ + probes.o listall.o listword.o listauthors.o listwriter.o listyears.o \ + listpubyear.o listref.o listuplinks.o + +xbibfile: $(OBJ) + $(CC) $(OBJ) -o xbibfile `pkg-config --libs gtk+-2.0` + +xbibfile.o: xbibfile.c xbibfile.h + $(CC) `pkg-config --cflags gtk+-2.0` -c xbibfile.c -o xbibfile.o + +filing.o: filing.c + $(CC) -c filing.c -o filing.o `pkg-config --cflags gtk+-2.0` + +selecting.o: selecting.c + $(CC) -c selecting.c -o selecting.o `pkg-config --cflags gtk+-2.0` + +cleanup.o: cleanup.c + $(CC) -c cleanup.c -o cleanup.o `pkg-config --cflags gtk+-2.0` + +article.o: article.c xbibfile.h + $(CC) -c article.c -o article.o `pkg-config --cflags gtk+-2.0` + +book.o: book.c xbibfile.h + $(CC) -c book.c -o book.o `pkg-config --cflags gtk+-2.0` + +inproc.o: inproc.c xbibfile.h + $(CC) -c inproc.c -o inproc.o `pkg-config --cflags gtk+-2.0` + +phd.o: phd.c xbibfile.h + $(CC) -c phd.c -o phd.o `pkg-config --cflags gtk+-2.0` + +masters.o: masters.c xbibfile.h + $(CC) -c masters.c -o masters.o `pkg-config --cflags gtk+-2.0` + +incol.o: incol.c xbibfile.h + $(CC) -c incol.c -o incol.o `pkg-config --cflags gtk+-2.0` + +booklet.o: booklet.c xbibfile.h + $(CC) -c booklet.c -o booklet.o `pkg-config --cflags gtk+-2.0` + +conference.o: conference.c xbibfile.h + $(CC) -c conference.c -o conference.o `pkg-config --cflags gtk+-2.0` + +inbook.o: inbook.c xbibfile.h + $(CC) -c inbook.c -o inbook.o `pkg-config --cflags gtk+-2.0` + +unpublished.o: unpublished.c xbibfile.h + $(CC) -c unpublished.c -o unpublished.o `pkg-config --cflags gtk+-2.0` + +manual.o: manual.c xbibfile.h + $(CC) -c manual.c -o manual.o `pkg-config --cflags gtk+-2.0` + +misc.o: misc.c xbibfile.h + $(CC) -c misc.c -o misc.o `pkg-config --cflags gtk+-2.0` + +proceedings.o: proceedings.c xbibfile.h + $(CC) -c proceedings.c -o proceedings.o `pkg-config --cflags gtk+-2.0` + +techreport.o: techreport.c xbibfile.h + $(CC) -c techreport.c -o techreport.o `pkg-config --cflags gtk+-2.0` + +linking.o: linking.c xbibfile.h + $(CC) -c linking.c -o linking.o `pkg-config --cflags gtk+-2.0` + +error.o: error.c + $(CC) -c error.c -o error.o `pkg-config --cflags gtk+-2.0` + +probes.o: probes.c + $(CC) -c probes.c -o probes.o `pkg-config --cflags gtk+-2.0` + +listall.o: listall.c + $(CC) -c listall.c -o listall.o `pkg-config --cflags gtk+-2.0` + +listword.o: listword.c + $(CC) -c listword.c -o listword.o `pkg-config --cflags gtk+-2.0` + +listauthors.o: listauthors.c + $(CC) -c listauthors.c -o listauthors.o `pkg-config --cflags gtk+-2.0` + +listwriter.o: listwriter.c + $(CC) -c listwriter.c -o listwriter.o `pkg-config --cflags gtk+-2.0` + +listyears.o: listyears.c + $(CC) -c listyears.c -o listyears.o `pkg-config --cflags gtk+-2.0` + +listpubyear.o: listpubyear.c + $(CC) -c listpubyear.c -o listpubyear.o `pkg-config --cflags gtk+-2.0` + +listref.o: listref.c + $(CC) -c listref.c -o listref.o `pkg-config --cflags gtk+-2.0` + +listuplinks.o: listuplinks.c + $(CC) -c listuplinks.c -o listuplinks.o `pkg-config --cflags gtk+-2.0` + + +clean: + rm -f *.o xbibfile + + + + + diff --git a/biblio/bibtex/utils/xbibfile/README b/biblio/bibtex/utils/xbibfile/README new file mode 100644 index 0000000000..42b332c011 --- /dev/null +++ b/biblio/bibtex/utils/xbibfile/README @@ -0,0 +1,69 @@ +Xbibfile is an interactive program to assist in preparing and using your BibTeX +references. + +Xbibfile is designed to work in the X Window environment. It is written in +standard C (well, GNU GCC) and uses the public domain GTK+ graphics package (see +URL www.gtk.org). Because of the activity of porting GTK+ to the Windows +environment, the success in that effort will enable Xbibfile to operate in that +environment in the future. All development work has been done under Linux. + +Xbibfile has been under my development and use for over four years now. It +arose out of my realisation early in my PhD candidature in the School of +Information Technology at Murdoch University that I needed software to handle my +research references. The closes that I could find on CTAN that fulfilled my +requirements was XbibTeX by Nicolas Kelly and Christian Bischof. But I would +need to make changes. That I judged to be too difficult and thought writing my +own would be a fruitful way to go. Initially the windows for creating the +various reference types was the total of Xbibfile. The addition of windows to +search for references by author name, publication date, from word used in the +summary of the reference, etc. were only recently added. When those additions +were made, the human interface was also revised thanks to suggestions from +members of the School. May be now the program is fit for wider use. + +This package consists, when compiled, of one executable "Xbibfile" and three +Perl scripts. The main thrust is Xbibfile but the Perl scripts are a useful +leftovers from an earlier version of the executable. Their function is now +performed withing Xbibfile. However, if such results are wanted for routing to +a printer, then the Perl scripts become necessary. + +A primitive Makefile is included in this distribution to compile Xbibfile. +Initial development work was done using Gtk version 1.2.10. In version 0.7 of +Xbibfile, the conversion to GTK+ 2.0 was undertaken in an attempt use the +library procedures recommended in the documentation that accompanied that later +release. A major part of the Xbibfile upgrade was the modification of the +manner of accessing the GTK library in the Makefile. + +At this stage of the development there is no documentation. Yes, I know, that +is unforgivable. But my interest has been in creating the software to fulfil my +needs. Hopefully the documentation will follow in future releases of this +package. + +Initial versions of the GTK+ package implemented a subset of the Emacs +keystrokes when the user entered data. However, the widgets on which they +operated are now recommended not for use. Thus the editing facilities available +to assist user data entry are primitive. This is particularly noticed in the +screen field used for entering your summaries of the referennce. It is these +summaries that are used in the "word search" provided under Xbibfile. If you +need to make changes to the BibTeX file after it has be saved under Xbibfile, +then your favourate text editor must be used. + +There are a number of error screens that can appear. When these occur, click +somewhere in that error window and the window will disappear. Each such error +window is implemented as a window compose of a button only; to clear the window +you click the button. + +As with most open source software, you use this software at your own risk. This +software has, however, worked successfully for me. I would appreciate it if you +could drop me a line indicating if you find this software useful. + +This software is released under the conditions of the LaTeX Project Public +License. + +Enjoy. + ++-=+-=+-=+-=+-=+-=+-=+-=+-=+-=+-=+-=+-=+-=+-=+-=+-=+-=+-=+-=+-=+-=+-=+-=+-= +Ross Maloney | email: rmaloney@murdoch.edu.au +School of Information Technology | +Murdoch University | +Perth, W.A., Australia | A graduate student aiming to understand ++-=+-=+-=+-=+-=+-=+-=+-=+-=+-=+-=+-=+-=+-=+-=+-=+-=+-=+-=+-=+-=+-=+-=+-=+-= diff --git a/biblio/bibtex/utils/xbibfile/article.c b/biblio/bibtex/utils/xbibfile/article.c new file mode 100644 index 0000000000..fdcdd2dfb8 --- /dev/null +++ b/biblio/bibtex/utils/xbibfile/article.c @@ -0,0 +1,476 @@ +/* This file is a part of XBibFile - a system for handling BibTeX references + * + * Author: Ross Maloney + * Date: October 1999 + * Modified: January 2002 + * + */ + +#include <stdio.h> +#include <gtk/gtk.h> + +#include "xbibfile.h" + +/* This file contains procedures that handle the BibTeX article style */ + + +GtkWidget *labelX, *dataX; +GtkWidget *label0, *data0; +GtkWidget *label2, *data2; +GtkWidget *label3, *data3; +GtkWidget *label10, *data10; +GtkWidget *label12, *data12; +GtkWidget *label13, *data13, *textscroll; +GtkWidget *label14, *data14; +GtkWidget *label16, *data16; +GtkWidget *label20, *data20; +GtkWidget *label22, *data22; +GtkWidget *label23, *data23; +GtkWidget *label24, *data24; +GtkWidget *label30, *data30; +GtkWidget *label31, *data31; +GtkWidget *label32, *data32; +GtkTextBuffer *text13; +GtkTextIter start, end; +PangoFontDescription *font_desc; + + +/* input text fields and labels used BibTeX format windows handled in + * this file */ + + + + +/* The procedure to save the article style */ + +void save_article(GtkWidget *widget) +{ + extern int format; + extern int length[]; + extern char slate[][]; + extern int lengthX; + extern char slateX[]; + extern char slate3[]; + extern char slate10[]; + extern char slate12[]; + extern char slate13[]; + extern char slate14[]; + extern char slate16[]; + extern char slate20[]; + extern char slate22[]; + extern char slate24[]; + extern char slate23[]; + extern char slate30[]; + extern char slate31[]; + extern char slate32[]; + extern void error(); /* defined in file error.c */ + extern FILE *finput; /* defined in file xbibfile.c */ + extern void close_window(); /* defined in file cleanup.c */ + + if (format != 1) { + error(widget, GINT_TO_POINTER(5)); + return; + } + strcpy(slateX, gtk_entry_get_text(GTK_ENTRY(dataX))); + lengthX = strlen(slateX); + strcpy(slate3, gtk_entry_get_text(GTK_ENTRY(data3))); + length[3] = strlen(slate3); + strcpy(slate10, gtk_entry_get_text(GTK_ENTRY(data10))); + length[10] = strlen(slate10); + strcpy(slate20, gtk_entry_get_text(GTK_ENTRY(data20))); + length[20] = strlen(slate20); + strcpy(slate24, gtk_entry_get_text(GTK_ENTRY(data24))); + length[24] = strlen(slate24); + if (!(length[3] && length[20] && length[10] && length[24] && lengthX)) { + error(widget, GINT_TO_POINTER(3)); + return; + } + if (!finput) { + error(widget, GINT_TO_POINTER(8)); + return; + } + /* finput = stdout; */ + fprintf(finput, "\n@ARTICLE{%s,\n", slateX); + fprintf(finput, " author = {%s},\n", slate3); + fprintf(finput, " title = {%s},\n", slate20); + fprintf(finput, " journal = {%s},\n", slate10); + fprintf(finput, " year = {%s}", slate24); + if (length[23]) + fprintf(finput, ",\n volume = {%s}", slate23); + if (length[14]) + fprintf(finput, ",\n number = {%s}", slate14); + if (length[16]) + fprintf(finput, ",\n pages = {%s}", slate16); + if (length[12]) + fprintf(finput, ",\n month = {%s}", slate12); + if (length[22]) + fprintf(finput, ",\n URL = {%s}", slate22); + if (length[2]) + fprintf(finput, ",\n note = {%s}", slate22); + if (length[13]) + fprintf(finput, ",\n annote = {%s}", slate13); + if (length[30]) + fprintf(finput, ",\n uplink = {%s}", slate30); + if (length[31]) + fprintf(finput, ",\n crosslink = {%s}", slate31); + if (length[32]) + fprintf(finput, ",\n externlink = {%s}", slate32); + fprintf(finput, " }\n"); + /* indicate that the reference is saved */ + format = 0; + length[2] = 0; + length[23] = 0; + length[13] = 0; + length[14] = 0; + length[16] = 0; + length[12] = 0; + length[22] = 0; + length[30] = 0; + length[31] = 0; + length[32] = 0; + close_window(widget); /* remove this reference window */ +} + + +/* Save the article optional fields for subsequent saving */ + +void save_artoptions(GtkWidget *widget) +{ + extern void close_window(); + extern int length[]; + extern char slate2[]; + extern char slate12[]; + extern char slate22[]; + extern char slate13[]; + extern char slate14[]; + extern char slate16[]; + extern char slate23[]; + char *text_in_field; + int count; + + strcpy(slate23, gtk_entry_get_text(GTK_ENTRY(data23))); + length[23] = strlen(slate23); + strcpy(slate14, gtk_entry_get_text(GTK_ENTRY(data14))); + length[14] = strlen(slate14); + strcpy(slate16, gtk_entry_get_text(GTK_ENTRY(data16))); + length[16] = strlen(slate16); + strcpy(slate12, gtk_entry_get_text(GTK_ENTRY(data12))); + length[12] = strlen(slate12); + strcpy(slate22, gtk_entry_get_text(GTK_ENTRY(data22))); + length[22] = strlen(slate22); + strcpy(slate2, gtk_entry_get_text(GTK_ENTRY(data2))); + length[2] = strlen(slate2); + count = gtk_text_buffer_get_char_count(text13); + gtk_text_buffer_get_iter_at_offset(text13, &end, count); + gtk_text_buffer_get_iter_at_offset(text13, &start, 0); + strcpy(slate13, gtk_text_buffer_get_text(text13, &start, &end, FALSE)); + length[13] = count; + close_window(widget); +} + + + + +/* Close the option entry window, but first delete the entries */ + +void close_artoptions(GtkWidget *widget) +{ + extern void close_window(); + extern int length[]; + + length[2] = 0; + length[23] = 0; + length[14] = 0; + length[16] = 0; + length[12] = 0; + length[22] = 0; + length[13] = 0; + close_window(widget); +} + + +/* The procedure to put the optional article style fields on the screen */ + +void artoptions(GtkWidget *widget) +{ + extern int format; + GtkTooltips *tooltips; + GtkWidget *window; + GtkWidget *decoration; + GtkWidget *totalPane; + GtkWidget *field0; + GtkWidget *field1; + GtkWidget *field2; + GtkWidget *field3; + GtkWidget *field4; + GtkWidget *field5; + GtkWidget *field6; + GtkWidget *key0; + GtkWidget *key1; + + void close_artoptions(); + void save_artoptions(); + + if (format == 0) { + error (widget, GINT_TO_POINTER(6)); + return; + } + + /* create the tooltip help feature */ + + tooltips = gtk_tooltips_new(); + + window = gtk_window_new(GTK_WINDOW_TOPLEVEL); + gtk_window_set_title(GTK_WINDOW(window), "XBibFile create"); + gtk_widget_set_usize(GTK_WIDGET(window), 400, 570); + gtk_window_position(GTK_WINDOW(window), GTK_WIN_POS_MOUSE); + decoration = gtk_frame_new("Optional article fields"); + gtk_container_add(GTK_CONTAINER(window), decoration); + totalPane = gtk_vbox_new(FALSE, 5); + gtk_container_add(GTK_CONTAINER(decoration), totalPane); + + /* put the text fields in place */ + field1 = gtk_hbox_new(FALSE, 0); + data23 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data23), TINY); + label23 = gtk_label_new("Volume:"); + gtk_widget_set_usize(GTK_WIDGET(label23), 75, -1); + gtk_box_pack_start(GTK_BOX(field1), label23, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field1), data23, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field1, FALSE, TRUE, 10); + + field2 = gtk_hbox_new(FALSE, 0); + data14 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data14),TINY); + label14 = gtk_label_new("Number:"); + gtk_widget_set_usize(GTK_WIDGET(label14), 75, -1); + gtk_box_pack_start(GTK_BOX(field2), label14, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field2), data14, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field2, FALSE, TRUE, 2); + + field3 = gtk_hbox_new(FALSE, 0); + data16 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data16), LARGE); + label16 = gtk_label_new("Pages:"); + gtk_widget_set_usize(GTK_WIDGET(label16), 75, -1); + gtk_box_pack_start(GTK_BOX(field3), label16, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field3), data16, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field3, FALSE, TRUE, 2); + + field4 = gtk_hbox_new(FALSE, 0); + data12 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data14), TINY); + label12 = gtk_label_new("Month:"); + gtk_widget_set_usize(GTK_WIDGET(label12), 75, -1); + gtk_box_pack_start(GTK_BOX(field4), label12, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field4), data12, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field4, FALSE, TRUE, 2); + + field5 = gtk_hbox_new(FALSE, 0); + data22 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data22), LARGE); + label22 = gtk_label_new("URL:"); + gtk_widget_set_usize(GTK_WIDGET(label22), 75, -1); + gtk_box_pack_start(GTK_BOX(field5), label22, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field5), data22, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field5, FALSE, TRUE, 2); + + field6 = gtk_hbox_new(FALSE, 0); + data2 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data2), LARGE); + label2 = gtk_label_new("note:"); + gtk_widget_set_usize(GTK_WIDGET(label2), 75, -1); + gtk_box_pack_start(GTK_BOX(field6), label2, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field6), data2, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field6, FALSE, TRUE, 2); + + text13 = gtk_text_buffer_new(NULL); + data13 = gtk_text_view_new_with_buffer(text13); + textscroll = gtk_scrolled_window_new(NULL, NULL); + font_desc = pango_font_description_from_string("Sans 12"); + gtk_widget_modify_font(data13, font_desc); + gtk_container_add(GTK_CONTAINER(textscroll), data13); + gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(textscroll), + GTK_POLICY_AUTOMATIC, + GTK_POLICY_AUTOMATIC); + gtk_widget_set_usize(GTK_WIDGET(data13), 30, 250); + label13 = gtk_label_new("Annotation:"); + gtk_box_pack_start(GTK_BOX(totalPane), label13, FALSE, TRUE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), textscroll, FALSE, TRUE, 2); + + /* finally, put the cancel button in place */ + field0 = gtk_hbox_new(FALSE, 0); + key0 = gtk_button_new_with_label("CANCEL"); + gtk_widget_set_usize(GTK_WIDGET(key0), 90, -1); + g_signal_connect(GTK_OBJECT(key0), "clicked", + G_CALLBACK(close_artoptions), NULL); + gtk_tooltips_set_tip(tooltips, key0, + "Discard the contents of this window", NULL); + gtk_box_pack_end(GTK_BOX(field0), key0, FALSE, FALSE, 10); + key1 = gtk_button_new_with_label("Save"); + gtk_widget_set_usize(GTK_WIDGET(key1), 90, -1); + g_signal_connect(GTK_OBJECT(key1), "clicked", + G_CALLBACK(save_artoptions), NULL); + gtk_tooltips_set_tip(tooltips, key1, + "Store the contents of this window", NULL); + gtk_box_pack_end(GTK_BOX(field0), key1, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field0, FALSE, TRUE, 10); + + /* put the composite window on the screen */ + gtk_widget_show_all(window); +} + + + +/* The procedure to put the basic article style on the screen */ + +void article(GtkWidget *widget) +{ + GtkTooltips *tooltips; + GtkWidget *window; + GtkWidget *decoration; + GtkWidget *totalPane; + GtkWidget *opDecoration; + GtkWidget *field0; + GtkWidget *field1; + GtkWidget *option; + GtkWidget *controls; + GtkWidget *key1; + GtkWidget *key2; + GtkWidget *key3; + GtkWidget *key4; + GtkWidget *field2; + GtkWidget *field3; + GtkWidget *field4; + GtkWidget *field5; + extern int format; + extern char slate0[]; + + extern void linkwindow(); + extern void closure_check(); /* defined in file cleanup.c */ + extern void close_window(); /* defined in file cleanup.c */ + void artoption(GtkWidget *); + + /* create the tooltip help feature */ + + tooltips = gtk_tooltips_new(); + + + format = 1; /* indicate processing of an ARTICLE */ + + /* create the wondow and its top panel */ + window = gtk_window_new(GTK_WINDOW_TOPLEVEL); + gtk_window_set_title(GTK_WINDOW(window), "XBibFile create"); + gtk_window_position(GTK_WINDOW(window), GTK_WIN_POS_MOUSE); + decoration = gtk_frame_new("Article type - required fields"); + gtk_widget_set_usize(GTK_WIDGET(window), 450, 330); + gtk_container_add(GTK_CONTAINER(window), decoration); + totalPane = gtk_vbox_new(FALSE, 5); + gtk_container_add(GTK_CONTAINER(decoration), totalPane); + + field1 = gtk_hbox_new(FALSE,0); + dataX = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(dataX), SMALL); + gtk_widget_set_usize(GTK_WIDGET(dataX), 345, -1); + labelX = gtk_label_new("Tag/s:"); + gtk_widget_set_usize(GTK_WIDGET(labelX), 65, -1); + gtk_box_pack_start(GTK_BOX(field1), labelX, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field1), dataX, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field1, FALSE, TRUE, 10); + + field0 = gtk_hbox_new(FALSE, 0); + data0 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data0), LARGE); + gtk_widget_set_usize(GTK_WIDGET(data0), 345, -1); + label0 = gtk_label_new("File used:"); + gtk_widget_set_usize(GTK_WIDGET(label0), 65, -1); + gtk_entry_set_text(GTK_ENTRY(data0), slate0); + gtk_box_pack_start(GTK_BOX(field0), label0, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field0), data0, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field0, FALSE, TRUE, 2); + + /* position the remaining field entries */ + field2 = gtk_hbox_new(FALSE, 0); + data3 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data3), LARGE); + gtk_widget_set_usize(GTK_WIDGET(data3), 345, -1); + label3 = gtk_label_new("Authors/s:"); + gtk_widget_set_usize(GTK_WIDGET(label3), 65, -1); + gtk_box_pack_start(GTK_BOX(field2), label3, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field2), data3, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field2, FALSE, TRUE, 8); + + field3 = gtk_hbox_new(FALSE, 0); + data20 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data20), LARGE); + gtk_widget_set_usize(GTK_WIDGET(data20), 345, -1); + label20 = gtk_label_new("Title:"); + gtk_widget_set_usize(GTK_WIDGET(label20), 65, -1); + gtk_box_pack_start(GTK_BOX(field3), label20, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field3), data20, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field3, FALSE, TRUE, 2); + + field4 = gtk_hbox_new(FALSE, 0); + data10 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data10), SMALL); + gtk_widget_set_usize(GTK_WIDGET(data10), 345, -1); + label10 = gtk_label_new("Journal:"); + gtk_widget_set_usize(GTK_WIDGET(label10), 65, -1); + gtk_box_pack_start(GTK_BOX(field4), label10, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field4), data10, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field4, FALSE, TRUE, 2); + + field5 = gtk_hbox_new(FALSE, 0); + data24 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data24), TINY); + gtk_widget_set_usize(GTK_WIDGET(data24), 200, -1); + label24 = gtk_label_new("Year:"); + gtk_widget_set_usize(GTK_WIDGET(label24), 65, -1); + gtk_box_pack_start(GTK_BOX(field5), label24, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field5), data24, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field5, FALSE, TRUE, 2); + + /* put the control keys on to the window */ + option = gtk_hbox_new(FALSE, 0); + key2 = gtk_button_new_with_label("Optional fields"); + gtk_widget_set_usize(GTK_WIDGET(key2), 130, -1); + g_signal_connect(GTK_OBJECT(key2), "clicked", + G_CALLBACK(artoptions), NULL); + gtk_tooltips_set_tip(tooltips, key2, + "Click here to get window containing remaining Article fields", + NULL); + gtk_box_pack_start(GTK_BOX(option), key2, FALSE, FALSE, 10); + controls = gtk_hbox_new(FALSE, 0); + key1 = gtk_button_new_with_label("Save"); + gtk_widget_set_usize(GTK_WIDGET(key1), 90, -1); + g_signal_connect(GTK_OBJECT(key1), "clicked", + G_CALLBACK(save_article), NULL); + gtk_tooltips_set_tip(tooltips, key1, + "Store this Article reference in database", NULL); + gtk_box_pack_start(GTK_BOX(controls), key1, FALSE, FALSE, 30); + key3 = gtk_button_new_with_label("Cancel"); + gtk_widget_set_usize(GTK_WIDGET(key3), 90, -1); + g_signal_connect(GTK_OBJECT(key3), "clicked", + G_CALLBACK(closure_check), NULL); + gtk_tooltips_set_tip(tooltips, key3, + "Discard this Article entry", NULL); + gtk_box_pack_start(GTK_BOX(controls), key3, FALSE, FALSE, 30); + key4 = gtk_button_new_with_label("Linking"); + gtk_widget_set_usize(GTK_WIDGET(key4), 90, -1); + g_signal_connect(GTK_OBJECT(key4), "clicked", + G_CALLBACK(linkwindow), NULL); + gtk_tooltips_set_tip(tooltips, key4, + "Click here for window to create links for this Article", + NULL); + gtk_box_pack_start(GTK_BOX(controls), key4, FALSE, FALSE, 30); + gtk_box_pack_start(GTK_BOX(totalPane), option, FALSE, TRUE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), controls, FALSE, TRUE, 10); + + + format = 1; + + /* make the composite visible on screen */ + gtk_widget_show_all(window); +} + + diff --git a/biblio/bibtex/utils/xbibfile/book.c b/biblio/bibtex/utils/xbibfile/book.c new file mode 100644 index 0000000000..6fe2358d31 --- /dev/null +++ b/biblio/bibtex/utils/xbibfile/book.c @@ -0,0 +1,522 @@ +/* This file is a part of XBibFile - a system for handling BibTeX references + * + * Author: Ross Maloney + * Date: October 1999 + * Modified: January 2002 + * + */ + +#include <stdio.h> +#include <gtk/gtk.h> + +#include "xbibfile.h" + +/* This file is a modified copy of article.c so that it handles the + * book BibTeX reference style */ + + +GtkWidget *labelX, *dataX; +GtkWidget *label0, *data0; +GtkWidget *label1, *data1; +GtkWidget *label2, *data2; +GtkWidget *label3, *data3; +GtkWidget *label6, *data6; +GtkWidget *label7, *data7; +GtkWidget *label12, *data12; +GtkWidget *label13, *data13, *textscroll; +GtkWidget *label14, *data14; +GtkWidget *label17, *data17; +GtkWidget *label19, *data19; +GtkWidget *label20, *data20; +GtkWidget *label22, *data22; +GtkWidget *label24, *data24; +GtkWidget *label23, *data23; +GtkWidget *label24, *data24; +GtkWidget *label30, *data30; +GtkWidget *label31, *data31; +GtkWidget *label32, *data32; +GtkTextBuffer *text13; +GtkTextIter start, end; +PangoFontDescription *font_desc; + + + + +/* The procedure to save the book style */ + +void save_book(GtkWidget *widget) +{ + extern int format; + extern int length[]; + extern char slate[][]; + extern int lengthX; + extern char slateX[]; + extern char slate1[]; + extern char slate2[]; + extern char slate3[]; + extern char slate6[]; + extern char slate7[]; + extern char slate12[]; + extern char slate13[]; + extern char slate14[]; + extern char slate17[]; + extern char slate19[]; + extern char slate20[]; + extern char slate23[]; + extern char slate22[]; + extern char slate24[]; + extern char slate30[]; + extern char slate31[]; + extern char slate32[]; + extern void error(); /* defined in file error.c */ + extern FILE *finput; /* defined in file xbibfile.c */ + extern void close_window(); /* defined in file cleanup.c */ + + if (format != 2) { + error(widget, GINT_TO_POINTER(5)); + return; + } + strcpy(slateX, gtk_entry_get_text(GTK_ENTRY(dataX))); + lengthX = strlen(slateX); + strcpy(slate3, gtk_entry_get_text(GTK_ENTRY(data3))); + length[3] = strlen(slate3); + strcpy(slate7, gtk_entry_get_text(GTK_ENTRY(data7))); + length[7] = strlen(slate7); + strcpy(slate20, gtk_entry_get_text(GTK_ENTRY(data20))); + length[20] = strlen(slate20); + strcpy(slate17, gtk_entry_get_text(GTK_ENTRY(data17))); + length[17] = strlen(slate17); + strcpy(slate24, gtk_entry_get_text(GTK_ENTRY(data24))); + length[24] = strlen(slate24); + if (!((length[3] || length[7]) + && length[20] && length[17] && length[24] && lengthX)) { + error(widget, GINT_TO_POINTER(3)); + return; + } + if (!finput) { + error(widget, GINT_TO_POINTER(8)); + return; + } + /* finput = stdout; */ + fprintf(finput, "\n@BOOK{%s,\n", slateX); + if (length[3]) fprintf(finput, " author = {%s},\n", slate3); + if (length[7]) fprintf(finput, " editor = {%s},\n", slate7); + fprintf(finput, " title = {%s},\n", slate20); + fprintf(finput, " publisher = {%s},\n", slate17); + fprintf(finput, " year = {%s}", slate24); + if (length[23]) + fprintf(finput, ",\n volume = {%s}", slate23); + if (length[14]) + fprintf(finput, ",\n number = {%s}", slate14); + if (length[19]) + fprintf(finput, ",\n series = {%s}", slate19); + if (length[1]) + fprintf(finput, ",\n address = {%s}", slate1); + if (length[6]) + fprintf(finput, ",\n edition = {%s}", slate6); + if (length[12]) + fprintf(finput, ",\n month = {%s}", slate12); + if (length[22]) + fprintf(finput, ",\n URL = {%s}", slate22); + if (length[2]) + fprintf(finput, ",\n note = {%s}", slate2); + if (length[13]) + fprintf(finput, ",\n annote = {%s}", slate13); + if (length[30]) + fprintf(finput, ",\n uplink = {%s}", slate30); + if (length[31]) + fprintf(finput, ",\n crosslink = {%s}", slate31); + if (length[32]) + fprintf(finput, ",\n externlink = {%s}", slate32); + fprintf(finput, " }\n"); + /* indicate that the reference is saved */ + format = 0; + length[1] = 0; + length[2] = 0; + length[6] = 0; + length[12] = 0; + length[13] = 0; + length[14] = 0; + length[19] = 0; + length[22] = 0; + length[23] = 0; + length[30] = 0; + length[31] = 0; + length[32] = 0; + close_window(widget); /* remove this reference window */ +} + + +/* Save the book optional fields for subsequent saving */ + +void save_bookoptions(GtkWidget *widget) +{ + extern void close_window(); + extern int length[]; + extern char slate1[]; + extern char slate2[]; + extern char slate6[]; + extern char slate12[]; + extern char slate13[]; + extern char slate14[]; + extern char slate19[]; + extern char slate22[]; + extern char slate23[]; + char *text_in_field; + int count; + + strcpy(slate1, gtk_entry_get_text(GTK_ENTRY(data1))); + length[1] = strlen(slate1); + strcpy(slate6, gtk_entry_get_text(GTK_ENTRY(data6))); + length[6] = strlen(slate6); + strcpy(slate12, gtk_entry_get_text(GTK_ENTRY(data12))); + length[12] = strlen(slate12); + strcpy(slate14, gtk_entry_get_text(GTK_ENTRY(data14))); + length[14] = strlen(slate14); + strcpy(slate19, gtk_entry_get_text(GTK_ENTRY(data19))); + length[19] = strlen(slate19); + strcpy(slate23, gtk_entry_get_text(GTK_ENTRY(data23))); + length[23] = strlen(slate23); + strcpy(slate22, gtk_entry_get_text(GTK_ENTRY(data22))); + length[22] = strlen(slate22); + strcpy(slate2, gtk_entry_get_text(GTK_ENTRY(data2))); + length[2] = strlen(slate2); + count = gtk_text_buffer_get_char_count(text13); + gtk_text_buffer_get_iter_at_offset(text13, &end, count); + gtk_text_buffer_get_iter_at_offset(text13, &start, 0); + strcpy(slate13, gtk_text_buffer_get_text(text13, &start, &end, FALSE)); + length[13] = count; + + close_window(widget); +} + + + + +/* Close the option entry window, but first delete the entries */ + +void close_bookoptions(GtkWidget *widget) +{ + extern void close_window(); + extern int length[]; + + length[23] = 0; + length[22] = 0; + length[19] = 0; + length[14] = 0; + length[13] = 0; + length[12] = 0; + length[6] = 0; + length[2] = 0; + length[1] = 0; + close_window(widget); +} + + +/* The procedure to put the optional book style fields on the screen */ + +void bookoptions(GtkWidget *widget) +{ + extern int format; + GtkTooltips *tooltips; + GtkWidget *window; + GtkWidget *decoration; + GtkWidget *totalPane; + GtkWidget *field0; + GtkWidget *field1; + GtkWidget *field2; + GtkWidget *field3; + GtkWidget *field4; + GtkWidget *field5; + GtkWidget *field6; + GtkWidget *field7; + GtkWidget *field8; + GtkWidget *key0; + GtkWidget *key1; + + void close_bookoptions(); + void save_bookoptions(); + + if (format == 0) { + error (widget, GINT_TO_POINTER(6)); + return; + } + + /* create the tooltip help feature */ + + tooltips = gtk_tooltips_new(); + + window = gtk_window_new(GTK_WINDOW_TOPLEVEL); + gtk_window_set_title(GTK_WINDOW(window), "XBibFile create"); + gtk_widget_set_usize(GTK_WIDGET(window), 400, 635); + gtk_window_position(GTK_WINDOW(window), GTK_WIN_POS_MOUSE); + decoration = gtk_frame_new("Optional book fields"); + gtk_container_add(GTK_CONTAINER(window), decoration); + totalPane = gtk_vbox_new(FALSE, 5); + gtk_container_add(GTK_CONTAINER(decoration), totalPane); + + /* put the text fields in place */ + field1 = gtk_hbox_new(FALSE, 0); + data23 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data23), TINY); + label23 = gtk_label_new("|| Volume:"); + gtk_widget_set_usize(GTK_WIDGET(label23), 75, -1); + gtk_box_pack_start(GTK_BOX(field1), label23, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field1), data23, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field1, FALSE, TRUE, 10); + + field2 = gtk_hbox_new(FALSE, 0); + data14 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data14), TINY); + label14 = gtk_label_new("|| Number:"); + gtk_widget_set_usize(GTK_WIDGET(label14), 75, -1); + gtk_box_pack_start(GTK_BOX(field2), label14, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field2), data14, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field2, FALSE, TRUE, 2); + + field3 = gtk_hbox_new(FALSE, 0); + data19 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data19), SMALL); + label19 = gtk_label_new("Series:"); + gtk_widget_set_usize(GTK_WIDGET(label19), 75, -1); + gtk_box_pack_start(GTK_BOX(field3), label19, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field3), data19, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field3, FALSE, TRUE, 2); + + field4 = gtk_hbox_new(FALSE, 0); + data1 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data1), LARGE); + label1 = gtk_label_new("Address:"); + gtk_widget_set_usize(GTK_WIDGET(label1), 75, -1); + gtk_box_pack_start(GTK_BOX(field4), label1, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field4), data1, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field4, FALSE, TRUE, 2); + + field5 = gtk_hbox_new(FALSE, 0); + data6 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data6), SMALL); + label6 = gtk_label_new("Edition:"); + gtk_widget_set_usize(GTK_WIDGET(label6), 75, -1); + gtk_box_pack_start(GTK_BOX(field5), label6, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field5), data6, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field5, FALSE, TRUE, 2); + + field6 = gtk_hbox_new(FALSE, 0); + data12 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data12), TINY); + label12 = gtk_label_new("Month:"); + gtk_widget_set_usize(GTK_WIDGET(label12), 75, -1); + gtk_box_pack_start(GTK_BOX(field6), label12, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field6), data12, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field6, FALSE, TRUE, 2); + + field7 = gtk_hbox_new(FALSE, 0); + data22 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data22), LARGE); + label22 = gtk_label_new("URL:"); + gtk_widget_set_usize(GTK_WIDGET(label22), 75, -1); + gtk_box_pack_start(GTK_BOX(field7), label22, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field7), data22, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field7, FALSE, TRUE, 2); + + field8 = gtk_hbox_new(FALSE, 0); + data2 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data2), LARGE); + label2 = gtk_label_new("note:"); + gtk_widget_set_usize(GTK_WIDGET(label2), 75, -1); + gtk_box_pack_start(GTK_BOX(field8), label2, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field8), data2, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field8, FALSE, TRUE, 2); + + text13 = gtk_text_buffer_new(NULL); + data13 = gtk_text_view_new_with_buffer(text13); + textscroll = gtk_scrolled_window_new(NULL, NULL); + font_desc = pango_font_description_from_string("Sans 12"); + gtk_widget_modify_font(data13, font_desc); + gtk_container_add(GTK_CONTAINER(textscroll), data13); + gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(textscroll), + GTK_POLICY_AUTOMATIC, + GTK_POLICY_AUTOMATIC); + gtk_widget_set_usize(GTK_WIDGET(data13), 30, 250); + label13 = gtk_label_new("Annotation:"); + gtk_box_pack_start(GTK_BOX(totalPane), label13, FALSE, TRUE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), textscroll, FALSE, TRUE, 2); + + /* finally, put the cancel button in place */ + field0 = gtk_hbox_new(FALSE, 0); + key0 = gtk_button_new_with_label("CANCEL"); + gtk_widget_set_usize(GTK_WIDGET(key0), 90, -1); + g_signal_connect(GTK_OBJECT(key0), "clicked", + G_CALLBACK(close_bookoptions), NULL); + gtk_tooltips_set_tip(tooltips, key0, + "Discard the contents of this window", NULL); + gtk_box_pack_end(GTK_BOX(field0), key0, FALSE, FALSE, 10); + key1 = gtk_button_new_with_label("Save"); + gtk_widget_set_usize(GTK_WIDGET(key1), 90, -1); + g_signal_connect(GTK_OBJECT(key1), "clicked", + G_CALLBACK(save_bookoptions), NULL); + gtk_tooltips_set_tip(tooltips, key1, + "Store the contents of this window", NULL); + gtk_box_pack_end(GTK_BOX(field0), key1, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field0, FALSE, TRUE, 10); + + /* put the composite window on the screen */ + gtk_widget_show_all(window); +} + + + +/* The procedure to put the basic book style on the screen */ + +void book(GtkWidget *widget) +{ + GtkTooltips *tooltips; + GtkWidget *window; + GtkWidget *decoration; + GtkWidget *totalPane; + GtkWidget *opDecoration; + GtkWidget *field0; + GtkWidget *field1; + GtkWidget *option; + GtkWidget *controls; + GtkWidget *key1; + GtkWidget *key2; + GtkWidget *key3; + GtkWidget *key4; + GtkWidget *field2; + GtkWidget *field3; + GtkWidget *field4; + GtkWidget *field5; + GtkWidget *field6; + extern int format; + extern char slate0[]; + + extern void linkwindow(); + extern void closure_check(); /* defined in file cleanup.c */ + extern void close_window(); /* defined in file cleanup.c */ + void bookoptions(); + + /* create the tooltip help feature */ + + tooltips = gtk_tooltips_new(); + + format = 2; /* indicate processing of an BOOK */ + + /* create the wondow and its top panel */ + window = gtk_window_new(GTK_WINDOW_TOPLEVEL); + gtk_window_set_title(GTK_WINDOW(window), "XBibFile create"); + gtk_window_position(GTK_WINDOW(window), GTK_WIN_POS_MOUSE); + decoration = gtk_frame_new("Book type - required fields"); + gtk_widget_set_usize(GTK_WIDGET(window), 450, 355); + gtk_container_add(GTK_CONTAINER(window), decoration); + totalPane = gtk_vbox_new(FALSE, 5); + gtk_container_add(GTK_CONTAINER(decoration), totalPane); + + field1 = gtk_hbox_new(FALSE,0); + dataX = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(dataX), SMALL); + gtk_widget_set_usize(GTK_WIDGET(dataX), 345, -1); + labelX = gtk_label_new("Tag/s:"); + gtk_widget_set_usize(GTK_WIDGET(labelX), 65, -1); + gtk_box_pack_start(GTK_BOX(field1), labelX, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field1), dataX, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field1, FALSE, TRUE, 10); + + field0 = gtk_hbox_new(FALSE, 0); + data0 = gtk_entry_new_with_max_length(LARGE); + gtk_widget_set_usize(GTK_WIDGET(data0), 345, -1); + label0 = gtk_label_new("File used:"); + gtk_widget_set_usize(GTK_WIDGET(label0), 65, -1); + gtk_entry_set_text(GTK_ENTRY(data0), slate0); + gtk_box_pack_start(GTK_BOX(field0), label0, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field0), data0, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field0, FALSE, TRUE, 2); + + /* position the remaining field entries */ + field2 = gtk_hbox_new(FALSE, 0); + data3 = gtk_entry_new_with_max_length(LARGE); + gtk_widget_set_usize(GTK_WIDGET(data3), 345, -1); + label3 = gtk_label_new("|| Authors/s:"); + gtk_widget_set_usize(GTK_WIDGET(label3), 65, -1); + gtk_box_pack_start(GTK_BOX(field2), label3, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field2), data3, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field2, FALSE, TRUE, 2); + + field3 = gtk_hbox_new(FALSE, 0); + data7 = gtk_entry_new_with_max_length(LARGE); + gtk_widget_set_usize(GTK_WIDGET(data7), 345, -1); + label7 = gtk_label_new("|| Editors/s:"); + gtk_widget_set_usize(GTK_WIDGET(label7), 65, -1); + gtk_box_pack_start(GTK_BOX(field3), label7, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field3), data7, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field3, FALSE, TRUE, 2); + + field4 = gtk_hbox_new(FALSE, 0); + data20 = gtk_entry_new_with_max_length(LARGE); + gtk_widget_set_usize(GTK_WIDGET(data20), 345, -1); + label20 = gtk_label_new("Title:"); + gtk_widget_set_usize(GTK_WIDGET(label20), 65, -1); + gtk_box_pack_start(GTK_BOX(field4), label20, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field4), data20, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field4, FALSE, TRUE, 2); + + field5 = gtk_hbox_new(FALSE, 0); + data17 = gtk_entry_new_with_max_length(LARGE); + gtk_widget_set_usize(GTK_WIDGET(data17), 345, -1); + label17 = gtk_label_new("Publisher:"); + gtk_widget_set_usize(GTK_WIDGET(label17), 65, -1); + gtk_box_pack_start(GTK_BOX(field5), label17, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field5), data17, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field5, FALSE, TRUE, 2); + + field6 = gtk_hbox_new(FALSE, 0); + data24 = gtk_entry_new_with_max_length(SMALL); + gtk_widget_set_usize(GTK_WIDGET(data24), 200, -1); + label24 = gtk_label_new("Year:"); + gtk_widget_set_usize(GTK_WIDGET(label24), 65, -1); + gtk_box_pack_start(GTK_BOX(field6), label24, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field6), data24, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field6, FALSE, TRUE, 2); + + /* put the control keys on to the window */ + option = gtk_hbox_new(FALSE, 0); + key2 = gtk_button_new_with_label("Optional fields"); + gtk_widget_set_usize(GTK_WIDGET(key2), 130, -1); + g_signal_connect(GTK_OBJECT(key2), "clicked", + G_CALLBACK(bookoptions), NULL); + gtk_tooltips_set_tip(tooltips, key2, + "Click here to get window containing remaining Book fields", + NULL); + gtk_box_pack_start(GTK_BOX(option), key2, FALSE, FALSE, 10); + controls = gtk_hbox_new(FALSE, 0); + key1 = gtk_button_new_with_label("Save"); + gtk_widget_set_usize(GTK_WIDGET(key1), 90, -1); + g_signal_connect(GTK_OBJECT(key1), "clicked", + G_CALLBACK(save_book), NULL); + gtk_tooltips_set_tip(tooltips, key1, + "Store this Book reference in database", NULL); + gtk_box_pack_start(GTK_BOX(controls), key1, FALSE, FALSE, 30); + key3 = gtk_button_new_with_label("Cancel"); + gtk_widget_set_usize(GTK_WIDGET(key3), 90, -1); + g_signal_connect(GTK_OBJECT(key3), "clicked", + G_CALLBACK(closure_check), NULL); + gtk_tooltips_set_tip(tooltips, key3, + "Discard this Book entry", NULL); + gtk_box_pack_start(GTK_BOX(controls), key3, FALSE, FALSE, 30); + key4 = gtk_button_new_with_label("Linking"); + gtk_widget_set_usize(GTK_WIDGET(key4), 90, -1); + g_signal_connect(GTK_OBJECT(key4), "clicked", + G_CALLBACK(linkwindow), NULL); + gtk_tooltips_set_tip(tooltips, key4, + "Click here for window to create links for this Book", + NULL); + gtk_box_pack_start(GTK_BOX(controls), key4, FALSE, FALSE, 30); + gtk_box_pack_start(GTK_BOX(totalPane), option, FALSE, TRUE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), controls, FALSE, TRUE, 10); + + + format = 2; + + /* make the composite visible on screen */ + gtk_widget_show_all(window); +} diff --git a/biblio/bibtex/utils/xbibfile/booklet.c b/biblio/bibtex/utils/xbibfile/booklet.c new file mode 100644 index 0000000000..f7d48b1cd6 --- /dev/null +++ b/biblio/bibtex/utils/xbibfile/booklet.c @@ -0,0 +1,444 @@ +/* This file is a part of XBibFile - a system for handling BibTeX references + * + * Author: Ross Maloney + * Date: October 1999 + * Modified: January 2002 + * + */ + +#include <stdio.h> +#include <gtk/gtk.h> + +#include "xbibfile.h" + +/* This file is a modified copy of phd.c so that it handles the + * Booklet BibTeX reference style */ + + +GtkWidget *labelX, *dataX; +GtkWidget *label0, *data0; +GtkWidget *label1, *data1; +GtkWidget *label2, *data2; +GtkWidget *label3, *data3; +GtkWidget *label8, *data8; +GtkWidget *label12, *data12; +GtkWidget *label13, *data13, *textscroll; +GtkWidget *label20, *data20; +GtkWidget *label22, *data22; +GtkWidget *label24, *data24; +GtkWidget *label30, *data30; +GtkWidget *label31, *data31; +GtkWidget *label32, *data32; +GtkTextBuffer *text13; +GtkTextIter start, end; +PangoFontDescription *font_desc; + + + + +/* The procedure to save the Booklet thesis style */ + +void save_booklet(GtkWidget *widget) +{ + extern int format; + extern int length[]; + extern char slate[][]; + extern int lengthX; + extern char slateX[]; + extern char slate1[]; + extern char slate3[]; + extern char slate2[]; + extern char slate8[]; + extern char slate12[]; + extern char slate13[]; + extern char slate20[]; + extern char slate22[]; + extern char slate24[]; + extern char slate30[]; + extern char slate31[]; + extern char slate32[]; + extern void error(); /* defined in file error.c */ + extern FILE *finput; /* defined in file xbibfile.c */ + extern void close_window(); /* defined in file cleanup.c */ + + if (format != 3) { + error(widget, GINT_TO_POINTER(5)); + return; + } + strcpy(slateX, gtk_entry_get_text(GTK_ENTRY(dataX))); + lengthX = strlen(slateX); + strcpy(slate20, gtk_entry_get_text(GTK_ENTRY(data20))); + length[20] = strlen(slate20); + if (!(length[20] && lengthX)) { + error(widget, GINT_TO_POINTER(3)); + return; + } + if (!finput) { + error(widget, GINT_TO_POINTER(8)); + return; + } + /* finput = stdout; */ + fprintf(finput, "\n@BOOKLET{%s,\n", slateX); + fprintf(finput, " title = {%s}", slate20); + if (length[3]) + fprintf(finput, ",\n author = {%s}", slate3); + if (length[8]) + fprintf(finput, ",\n howpublished = {%s}", slate8); + if (length[1]) + fprintf(finput, ",\n address = {%s}", slate1); + if (length[12]) + fprintf(finput, ",\n month = {%s}", slate12); + if (length[24]) + fprintf(finput, ",\n year = {%s}", slate24); + if (length[22]) + fprintf(finput, ",\n URL = {%s}", slate22); + if (length[2]) + fprintf(finput, ",\n note = {%s}", slate2); + if (length[13]) + fprintf(finput, ",\n annote = {%s}", slate13); + if (length[30]) + fprintf(finput, ",\n uplink = {%s}", slate30); + if (length[31]) + fprintf(finput, ",\n crosslink = {%s}", slate31); + if (length[32]) + fprintf(finput, ",\n externlink = {%s}", slate32); + fprintf(finput, " }\n"); + /* indicate that the reference is saved */ + format = 0; + length[1] = 0; + length[2] = 0; + length[3] = 0; + length[8] = 0; + length[12] = 0; + length[13] = 0; + length[22] = 0; + length[24] = 0; + length[30] = 0; + length[31] = 0; + length[32] = 0; + close_window(widget); /* remove this reference window */ +} + + +/* Save the Booklet optional fields for subsequent saving */ + +void save_bookletoptions(GtkWidget *widget) +{ + extern void close_window(); + extern int length[]; + extern char slate1[]; + extern char slate2[]; + extern char slate3[]; + extern char slate8[]; + extern char slate12[]; + extern char slate13[]; + extern char slate22[]; + extern char slate24[]; + char *text_in_field; + int count; + + strcpy(slate1, gtk_entry_get_text(GTK_ENTRY(data1))); + length[1] = strlen(slate1); + strcpy(slate3, gtk_entry_get_text(GTK_ENTRY(data3))); + length[3] = strlen(slate3); + strcpy(slate8, gtk_entry_get_text(GTK_ENTRY(data8))); + length[8] = strlen(slate8); + strcpy(slate12, gtk_entry_get_text(GTK_ENTRY(data12))); + length[12] = strlen(slate12); + count = gtk_text_buffer_get_char_count(text13); + gtk_text_buffer_get_iter_at_offset(text13, &end, count); + gtk_text_buffer_get_iter_at_offset(text13, &start, 0); + strcpy(slate13, gtk_text_buffer_get_text(text13, &start, &end, FALSE)); + length[13] = count; + strcpy(slate24, gtk_entry_get_text(GTK_ENTRY(data24))); + length[24] = strlen(slate24); + strcpy(slate22, gtk_entry_get_text(GTK_ENTRY(data22))); + length[22] = strlen(slate22); + strcpy(slate2, gtk_entry_get_text(GTK_ENTRY(data2))); + length[2] = strlen(slate2); + close_window(widget); +} + + + + +/* Close the option entry window, but first delete the entries */ + +void close_bookletoptions(GtkWidget *widget) +{ + extern void close_window(); + extern int length[]; + + length[1] = 0; + length[2] = 0; + length[3] = 0; + length[8] = 0; + length[12] = 0; + length[13] = 0; + length[22] = 0; + length[24] = 0; + close_window(widget); +} + + +/* The procedure to put the optional Booklet style fields on the screen */ + +void bookletoptions(GtkWidget *widget) +{ + extern int format; + GtkTooltips *tooltips; + GtkWidget *window; + GtkWidget *decoration; + GtkWidget *totalPane; + GtkWidget *field0; + GtkWidget *field1; + GtkWidget *field2; + GtkWidget *field3; + GtkWidget *field4; + GtkWidget *field5; + GtkWidget *field6; + GtkWidget *field7; + GtkWidget *key0; + GtkWidget *key1; + + void close_bookletoptions(); + void save_bookletoptions(); + + if (format == 0) { + error (widget, GINT_TO_POINTER(6)); + return; + } + + /* create the tooltip help feature */ + + tooltips = gtk_tooltips_new(); + + window = gtk_window_new(GTK_WINDOW_TOPLEVEL); + gtk_window_set_title(GTK_WINDOW(window), "XBibFile create"); + gtk_window_position(GTK_WINDOW(window), GTK_WIN_POS_MOUSE); + gtk_widget_set_usize(GTK_WIDGET(window), 400, 605); + decoration = gtk_frame_new("Optional Booklet fields"); + gtk_container_add(GTK_CONTAINER(window), decoration); + totalPane = gtk_vbox_new(FALSE, 5); + gtk_container_add(GTK_CONTAINER(decoration), totalPane); + + /* put the text fields in place */ + field1 = gtk_hbox_new(FALSE, 0); + data3 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data3), LARGE); + label3 = gtk_label_new("Author/s:"); + gtk_widget_set_usize(GTK_WIDGET(label3), 85, -1); + gtk_box_pack_start(GTK_BOX(field1), label3, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field1), data3, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field1, FALSE, TRUE, 10); + + field2 = gtk_hbox_new(FALSE, 0); + data8 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data8), SMALL); + label8 = gtk_label_new("Howpublished:"); + gtk_widget_set_usize(GTK_WIDGET(label8), 85, -1); + gtk_box_pack_start(GTK_BOX(field2), label8, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field2), data8, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field2, FALSE, TRUE, 2); + + field3 = gtk_hbox_new(FALSE, 0); + data1 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data1), LARGE); + label1 = gtk_label_new("Address:"); + gtk_widget_set_usize(GTK_WIDGET(label1), 85, -1); + gtk_box_pack_start(GTK_BOX(field3), label1, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field3), data1, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field3, FALSE, TRUE, 2); + + field4 = gtk_hbox_new(FALSE, 0); + data12 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data12), TINY); + label12 = gtk_label_new("Month:"); + gtk_widget_set_usize(GTK_WIDGET(label12), 85, -1); + gtk_box_pack_start(GTK_BOX(field4), label12, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field4), data12, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field4, FALSE, TRUE, 2); + + field5 = gtk_hbox_new(FALSE, 0); + data24 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data24), TINY); + label24 = gtk_label_new("Year:"); + gtk_widget_set_usize(GTK_WIDGET(label24), 85, -1); + gtk_box_pack_start(GTK_BOX(field5), label24, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field5), data24, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field5, FALSE, TRUE, 2); + + field6 = gtk_hbox_new(FALSE, 0); + data22 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data22), LARGE); + label22 = gtk_label_new("URL:"); + gtk_widget_set_usize(GTK_WIDGET(label22), 85, -1); + gtk_box_pack_start(GTK_BOX(field6), label22, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field6), data22, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field6, FALSE, TRUE, 2); + + field7 = gtk_hbox_new(FALSE, 0); + data2 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data2), LARGE); + label2 = gtk_label_new("note:"); + gtk_widget_set_usize(GTK_WIDGET(label2), 85, -1); + gtk_box_pack_start(GTK_BOX(field7), label2, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field7), data2, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field7, FALSE, TRUE, 2); + + text13 = gtk_text_buffer_new(NULL); + data13 = gtk_text_view_new_with_buffer(text13); + textscroll = gtk_scrolled_window_new(NULL, NULL); + font_desc = pango_font_description_from_string("Sans 12"); + gtk_widget_modify_font(data13, font_desc); + gtk_container_add(GTK_CONTAINER(textscroll), data13); + gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(textscroll), + GTK_POLICY_AUTOMATIC, + GTK_POLICY_AUTOMATIC); + gtk_widget_set_usize(GTK_WIDGET(data13), 30, 250); + label13 = gtk_label_new("Annotation:"); + gtk_box_pack_start(GTK_BOX(totalPane), label13, FALSE, TRUE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), textscroll, FALSE, TRUE, 2); + + /* finally, put the cancel button in place */ + field0 = gtk_hbox_new(FALSE, 0); + key0 = gtk_button_new_with_label("CANCEL"); + gtk_widget_set_usize(GTK_WIDGET(key0), 90, -1); + g_signal_connect(GTK_OBJECT(key0), "clicked", + G_CALLBACK(close_bookletoptions), NULL); + gtk_tooltips_set_tip(tooltips, key0, + "Discard the contents of this window", NULL); + gtk_box_pack_end(GTK_BOX(field0), key0, FALSE, FALSE, 10); + key1 = gtk_button_new_with_label("Save"); + gtk_widget_set_usize(GTK_WIDGET(key1), 90, -1); + g_signal_connect(GTK_OBJECT(key1), "clicked", + G_CALLBACK(save_bookletoptions), NULL); + gtk_tooltips_set_tip(tooltips, key1, + "Store the contents of this window", NULL); + gtk_box_pack_end(GTK_BOX(field0), key1, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field0, FALSE, TRUE, 10); + + /* put the composite window on the screen */ + gtk_widget_show_all(window); +} + + + +/* The procedure to put the basic Booklet style on the screen */ + +void booklet(GtkWidget *widget) +{ + GtkTooltips *tooltips; + GtkWidget *window; + GtkWidget *decoration; + GtkWidget *totalPane; + GtkWidget *opDecoration; + GtkWidget *field0; + GtkWidget *field1; + GtkWidget *option; + GtkWidget *controls; + GtkWidget *key1; + GtkWidget *key2; + GtkWidget *key3; + GtkWidget *key4; + GtkWidget *field2; + extern int format; + extern char slate0[]; + + extern void linkwindow(); + extern void closure_check(); /* defined in file cleanup.c */ + extern void close_window(); /* defined in file cleanup.c */ + void bookletoptions(); + void save_booklet(); + + /* create the tooltip help feature */ + + tooltips = gtk_tooltips_new(); + + format = 3; /* indicate processing of an BOOKLET */ + + /* create the wondow and its top panel */ + window = gtk_window_new(GTK_WINDOW_TOPLEVEL); + gtk_window_set_title(GTK_WINDOW(window), "XBibFile create"); + gtk_window_position(GTK_WINDOW(window), GTK_WIN_POS_MOUSE); + gtk_widget_set_usize(GTK_WIDGET(window), 450, 230); + decoration = gtk_frame_new("Booklet type - required fields"); + gtk_container_add(GTK_CONTAINER(window), decoration); + totalPane = gtk_vbox_new(FALSE, 5); + gtk_container_add(GTK_CONTAINER(decoration), totalPane); + + field1 = gtk_hbox_new(FALSE,0); + dataX = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(dataX), SMALL); + gtk_widget_set_usize(GTK_WIDGET(dataX), 345, -1); + labelX = gtk_label_new("Tags/s:"); + gtk_widget_set_usize(GTK_WIDGET(labelX), 65, -1); + gtk_box_pack_start(GTK_BOX(field1), labelX, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field1), dataX, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field1, FALSE, TRUE, 10); + + field0 = gtk_hbox_new(FALSE, 0); + data0 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data0), LARGE); + gtk_widget_set_usize(GTK_WIDGET(data0), 345, -1); + label0 = gtk_label_new("File used:"); + gtk_widget_set_usize(GTK_WIDGET(label0), 65, -1); + gtk_entry_set_text(GTK_ENTRY(data0), slate0); + gtk_box_pack_start(GTK_BOX(field0), label0, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field0), data0, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field0, FALSE, TRUE, 2); + + /* position the remaining field entries */ + field2 = gtk_hbox_new(FALSE, 0); + data20 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data20), LARGE); + gtk_widget_set_usize(GTK_WIDGET(data20), 345, -1); + label20 = gtk_label_new("Title:"); + gtk_widget_set_usize(GTK_WIDGET(label20), 65, -1); + gtk_box_pack_start(GTK_BOX(field2), label20, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field2), data20, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field2, FALSE, TRUE, 2); + + /* put the control keys on to the window */ + option = gtk_hbox_new(FALSE, 0); + key2 = gtk_button_new_with_label("Optional fields"); + gtk_widget_set_usize(GTK_WIDGET(key2), 130, -1); + g_signal_connect(GTK_OBJECT(key2), "clicked", + G_CALLBACK(bookletoptions), NULL); + gtk_tooltips_set_tip(tooltips, key2, + "Click here to get window containing remaining Booklet fields", + NULL); + gtk_box_pack_start(GTK_BOX(option), key2, FALSE, FALSE, 10); + controls = gtk_hbox_new(FALSE, 0); + key1 = gtk_button_new_with_label("Save"); + gtk_widget_set_usize(GTK_WIDGET(key1), 90, -1); + g_signal_connect(GTK_OBJECT(key1), "clicked", + G_CALLBACK(save_booklet), NULL); + gtk_tooltips_set_tip(tooltips, key1, + "Store this Booklet reference in database", NULL); + gtk_box_pack_start(GTK_BOX(controls), key1, FALSE, FALSE, 30); + key3 = gtk_button_new_with_label("Cancel"); + gtk_widget_set_usize(GTK_WIDGET(key3), 90, -1); + g_signal_connect(GTK_OBJECT(key3), "clicked", + G_CALLBACK(closure_check), NULL); + gtk_tooltips_set_tip(tooltips, key3, + "Discard this Booklet entry", NULL); + gtk_box_pack_start(GTK_BOX(controls), key3, FALSE, FALSE, 30); + key4 = gtk_button_new_with_label("Linking"); + gtk_widget_set_usize(GTK_WIDGET(key4), 90, -1); + g_signal_connect(GTK_OBJECT(key4), "clicked", + G_CALLBACK(linkwindow), NULL); + gtk_tooltips_set_tip(tooltips, key4, + "Click here for window to create links for this Booklet", + NULL); + gtk_box_pack_start(GTK_BOX(controls), key4, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), option, FALSE, TRUE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), controls, FALSE, TRUE, 10); + + format = 3; + + /* make the composite visible on screen */ + gtk_widget_show_all(window); +} + + diff --git a/biblio/bibtex/utils/xbibfile/cleanup.c b/biblio/bibtex/utils/xbibfile/cleanup.c new file mode 100644 index 0000000000..645c8f24c5 --- /dev/null +++ b/biblio/bibtex/utils/xbibfile/cleanup.c @@ -0,0 +1,100 @@ +/* This file is a part of XBibFile - a system for handling BibTeX references + * + * Author: Ross Maloney + * Date: October 1999 + * Modified: January 2002 + * + */ + +#include <gtk/gtk.h> + + +/* This file contains those procedures called to perform cleaning operations + * during the operation of the XBibFile code */ + + + +/* This procedure is called to close the current window */ + +void close_window(GtkWidget *widget) +{ + GtkWidget *parent; + + parent = gtk_widget_get_ancestor(widget, GTK_TYPE_WINDOW); + gtk_widget_destroy(parent); +} + + +/* This procedure exits the program */ + +void byebye(GtkWidget *widget) +{ + gtk_main_quit(); +} + + +/* This procedure is called to close the entry being made */ + +void go_ahead(GtkWidget *widget, GtkWidget *window) +{ + extern int format; + + close_window(window); + close_window(widget); + format = 0; +} + +void cancel(GtkWidget *widget) +{ + close_window(widget); +} + +/* A dialogue to confirm cancellation request */ + +int closure_check(GtkWidget *widget) +{ + GtkTooltips *tooltips; + GtkWidget *window; + GtkWidget *decoration; + GtkWidget *totalPane; + GtkWidget *field0; + GtkWidget *key0; + GtkWidget *key1; + GtkWidget *label; + void cancel(); + void go_ahead(); + + /* create the tooltip help feature */ + + tooltips = gtk_tooltips_new(); + + window = gtk_window_new(GTK_WINDOW_TOPLEVEL); + gtk_window_set_title(GTK_WINDOW(window), "XBibFile security"); + gtk_window_position(GTK_WINDOW(window), GTK_WIN_POS_MOUSE); + decoration = gtk_frame_new("Checking request"); + gtk_widget_set_usize(GTK_WIDGET(window), 232, 100); + gtk_container_add(GTK_CONTAINER(window), decoration); + totalPane = gtk_vbox_new(FALSE, 5); + gtk_container_add(GTK_CONTAINER(decoration), totalPane); + label = gtk_label_new("Confirm CLOSE request"); + gtk_box_pack_start(GTK_BOX(totalPane), label, FALSE, FALSE, 10); + + field0 = gtk_hbox_new(FALSE, 5); + key1 = gtk_button_new_with_label("Go Ahead"); + gtk_widget_set_usize(GTK_WIDGET(key1), 90, -1); + g_signal_connect(GTK_OBJECT(key1), "clicked", + G_CALLBACK(go_ahead), widget); + gtk_tooltips_set_tip(tooltips, key1, + "Perform the CLOSE request", NULL); + gtk_box_pack_start(GTK_BOX(field0), key1, FALSE, FALSE, 10); + key0 = gtk_button_new_with_label("Cancel"); + gtk_widget_set_usize(GTK_WIDGET(key0), 90, -1); + g_signal_connect(GTK_OBJECT(key0), "clicked", + G_CALLBACK(cancel), NULL); + gtk_tooltips_set_tip(tooltips, key0, + "Abort/Don't Do this request", NULL); + gtk_box_pack_start(GTK_BOX(field0), key0, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field0, FALSE, TRUE, 10); + + gtk_widget_show_all(window); +} diff --git a/biblio/bibtex/utils/xbibfile/conference.c b/biblio/bibtex/utils/xbibfile/conference.c new file mode 100644 index 0000000000..42cb374424 --- /dev/null +++ b/biblio/bibtex/utils/xbibfile/conference.c @@ -0,0 +1,569 @@ +/* This file is a part of XBibFile - a system for handling BibTeX references + * + * Author: Ross Maloney + * Date: October 1999 + * Modified: January 2002 + * + */ + +#include <stdio.h> +#include <gtk/gtk.h> + +#include "xbibfile.h" + +/* This file is a modified copy of inproc.c so that it handles the + * conference BibTeX reference style */ + + +GtkWidget *labelX, *dataX; +GtkWidget *label0, *data0; +GtkWidget *label1, *data1; +GtkWidget *label2, *data2; +GtkWidget *label3, *data3; +GtkWidget *label4, *data4; +GtkWidget *label7, *data7; +GtkWidget *label12, *data12; +GtkWidget *label13, *data13, *textscroll; +GtkWidget *label14, *data14; +GtkWidget *label15, *data15; +GtkWidget *label16, *data16; +GtkWidget *label17, *data17; +GtkWidget *label19, *data19; +GtkWidget *label20, *data20; +GtkWidget *label22, *data22; +GtkWidget *label23, *data23; +GtkWidget *label24, *data24; +GtkWidget *label30, *data30; +GtkWidget *label31, *data31; +GtkWidget *label32, *data32; +GtkTextBuffer *text13; +GtkTextIter start, end; +PangoFontDescription *font_desc; + + + + +/* The procedure to save the conference style */ + +void save_conference(GtkWidget *widget) +{ + extern int format; + extern int length[]; + extern char slate[][]; + extern int lengthX; + extern char slateX[]; + extern char slate1[]; + extern char slate2[]; + extern char slate3[]; + extern char slate4[]; + extern char slate7[]; + extern char slate12[]; + extern char slate13[]; + extern char slate14[]; + extern char slate15[]; + extern char slate16[]; + extern char slate17[]; + extern char slate19[]; + extern char slate20[]; + extern char slate22[]; + extern char slate23[]; + extern char slate24[]; + extern char slate30[]; + extern char slate31[]; + extern char slate32[]; + extern void error(); /* defined in file error.c */ + extern FILE *finput; /* defined in file xbibfile.c */ + extern void close_window(); /* defined in file cleanup.c */ + + if (format != 4) { + error(widget, GINT_TO_POINTER(5)); + return; + } + strcpy(slateX, gtk_entry_get_text(GTK_ENTRY(dataX))); + lengthX = strlen(slateX); + strcpy(slate3, gtk_entry_get_text(GTK_ENTRY(data3))); + length[3] = strlen(slate3); + strcpy(slate4, gtk_entry_get_text(GTK_ENTRY(data4))); + length[4] = strlen(slate4); + strcpy(slate20, gtk_entry_get_text(GTK_ENTRY(data20))); + length[20] = strlen(slate20); + strcpy(slate24, gtk_entry_get_text(GTK_ENTRY(data24))); + length[24] = strlen(slate24); + if (!(length[3] && length[4] && length[20] && length[24] && lengthX)) { + error(widget, GINT_TO_POINTER(3)); + return; + } + if (!finput) { + error(widget, GINT_TO_POINTER(8)); + return; + } + /* finput = stdout; */ + fprintf(finput, "\n@CONFERENCE{%s,\n", slateX); + fprintf(finput, " author = {%s},\n", slate3); + fprintf(finput, " title = {%s},\n", slate20); + fprintf(finput, " booktitle = {%s},\n", slate4); + fprintf(finput, " year = {%s}", slate24); + if (length[7]) + fprintf(finput, ",\n editor = {%s}", slate7); + if (length[23]) + fprintf(finput, ",\n volume = {%s}", slate23); + if (length[14]) + fprintf(finput, ",\n number = {%s}", slate14); + if (length[19]) + fprintf(finput, ",\n series = {%s}", slate19); + if (length[16]) + fprintf(finput, ",\n pages = {%s}", slate16); + if (length[1]) + fprintf(finput, ",\n address = {%s}", slate1); + if (length[12]) + fprintf(finput, ",\n month = {%s}", slate12); + if (length[15]) + fprintf(finput, ",\n organization = {%s}", slate15); + if (length[17]) + fprintf(finput, ",\n publisher = {%s}", slate17); + if (length[22]) + fprintf(finput, ",\n URL = {%s}", slate22); + if (length[2]) + fprintf(finput, ",\n note = {%s}", slate2); + if (length[13]) + fprintf(finput, ",\n annote = {%s}", slate13); + if (length[30]) + fprintf(finput, ",\n uplink = {%s}", slate30); + if (length[31]) + fprintf(finput, ",\n crosslink = {%s}", slate31); + if (length[32]) + fprintf(finput, ",\n externlink = {%s}", slate32); + fprintf(finput, " }\n"); + /* indicate that the reference is saved */ + format = 0; + length[1] = 0; + length[2] = 0; + length[7] = 0; + length[12] = 0; + length[13] = 0; + length[14] = 0; + length[15] = 0; + length[16] = 0; + length[17] = 0; + length[19] = 0; + length[22] = 0; + length[23] = 0; + length[30] = 0; + length[31] = 0; + length[32] = 0; + close_window(widget); /* remove this reference window */ +} + + +/* Save the conference optional fields for subsequent saving */ + +void save_confoptions(GtkWidget *widget) +{ + extern void close_window(); + extern int length[]; + extern char slate1[]; + extern char slate2[]; + extern char slate7[]; + extern char slate12[]; + extern char slate13[]; + extern char slate14[]; + extern char slate15[]; + extern char slate16[]; + extern char slate17[]; + extern char slate19[]; + extern char slate22[]; + extern char slate23[]; + char *text_in_field; + int count; + + strcpy(slate1, gtk_entry_get_text(GTK_ENTRY(data1))); + length[1] = strlen(slate1); + strcpy(slate7, gtk_entry_get_text(GTK_ENTRY(data7))); + length[7] = strlen(slate7); + strcpy(slate12, gtk_entry_get_text(GTK_ENTRY(data12))); + length[12] = strlen(slate12); + strcpy(slate14, gtk_entry_get_text(GTK_ENTRY(data14))); + length[14] = strlen(slate14); + strcpy(slate15, gtk_entry_get_text(GTK_ENTRY(data15))); + length[15] = strlen(slate15); + strcpy(slate16, gtk_entry_get_text(GTK_ENTRY(data16))); + length[16] = strlen(slate16); + strcpy(slate17, gtk_entry_get_text(GTK_ENTRY(data17))); + length[17] = strlen(slate17); + strcpy(slate19, gtk_entry_get_text(GTK_ENTRY(data19))); + length[19] = strlen(slate19); + strcpy(slate23, gtk_entry_get_text(GTK_ENTRY(data23))); + length[23] = strlen(slate23); + strcpy(slate22, gtk_entry_get_text(GTK_ENTRY(data22))); + length[22] = strlen(slate22); + strcpy(slate2, gtk_entry_get_text(GTK_ENTRY(data2))); + length[2] = strlen(slate2); + count = gtk_text_buffer_get_char_count(text13); + gtk_text_buffer_get_iter_at_offset(text13, &end, count); + gtk_text_buffer_get_iter_at_offset(text13, &start, 0); + strcpy(slate13, gtk_text_buffer_get_text(text13, &start, &end, FALSE)); + length[13] = count; + + close_window(widget); +} + + + + +/* Close the option entry window, but first delete the entries */ + +void close_confoptions(GtkWidget *widget) +{ + extern void close_window(); + extern int length[]; + + length[23] = 0; + length[22] = 0; + length[19] = 0; + length[17] = 0; + length[16] = 0; + length[15] = 0; + length[14] = 0; + length[13] = 0; + length[12] = 0; + length[7] = 0; + length[2] = 0; + length[1] = 0; + close_window(widget); +} + + +/* The procedure to put the optional conference style fields + * on the screen */ + +void confoptions(GtkWidget *widget) +{ + extern int format; + GtkTooltips *tooltips; + GtkWidget *window; + GtkWidget *decoration; + GtkWidget *totalPane; + GtkWidget *field0; + GtkWidget *field1; + GtkWidget *field2; + GtkWidget *field3; + GtkWidget *field4; + GtkWidget *field5; + GtkWidget *field6; + GtkWidget *field7; + GtkWidget *field8; + GtkWidget *field9; + GtkWidget *field10; + GtkWidget *field11; + GtkWidget *key0; + GtkWidget *key1; + + void close_confoptions(); + void save_confoptions(); + + if (format == 0) { + error (widget, GINT_TO_POINTER(6)); + return; + } + + /* create the tooltip help feature */ + + tooltips = gtk_tooltips_new(); + + window = gtk_window_new(GTK_WINDOW_TOPLEVEL); + gtk_window_set_title(GTK_WINDOW(window), "XBibFile create"); + gtk_window_position(GTK_WINDOW(window), GTK_WIN_POS_MOUSE); + gtk_widget_set_usize(GTK_WIDGET(window), 400, 730); + decoration = gtk_frame_new("Optional Conference fields"); + gtk_container_add(GTK_CONTAINER(window), decoration); + totalPane = gtk_vbox_new(FALSE, 5); + gtk_container_add(GTK_CONTAINER(decoration), totalPane); + + /* put the text fields in place */ + field1 = gtk_hbox_new(FALSE, 0); + data7 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data7), LARGE); + label7 = gtk_label_new("Editor/s:"); + gtk_widget_set_usize(GTK_WIDGET(label7), 75, -1); + gtk_box_pack_start(GTK_BOX(field1), label7, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field1), data7, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field1, FALSE, TRUE, 10); + + field2 = gtk_hbox_new(FALSE, 0); + data23 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data23), TINY); + label23 = gtk_label_new("|| Volume:"); + gtk_widget_set_usize(GTK_WIDGET(label23), 75, -1); + gtk_box_pack_start(GTK_BOX(field2), label23, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field2), data23, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field2, FALSE, TRUE, 2); + + field3 = gtk_hbox_new(FALSE, 0); + data14 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data14), TINY); + label14 = gtk_label_new("|| Number:"); + gtk_widget_set_usize(GTK_WIDGET(label14), 75, -1); + gtk_box_pack_start(GTK_BOX(field3), label14, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field3), data14, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field3, FALSE, TRUE, 2); + + field4 = gtk_hbox_new(FALSE, 0); + data19 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data19), SMALL); + label19 = gtk_label_new("Series:"); + gtk_widget_set_usize(GTK_WIDGET(label19), 75, -1); + gtk_box_pack_start(GTK_BOX(field4), label19, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field4), data19, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field4, FALSE, TRUE, 2); + + field5 = gtk_hbox_new(FALSE, 0); + data16 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data16), LARGE); + label16 = gtk_label_new("Pages:"); + gtk_widget_set_usize(GTK_WIDGET(label16), 75, -1); + gtk_box_pack_start(GTK_BOX(field5), label16, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field5), data16, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field5, FALSE, TRUE, 2); + + field6 = gtk_hbox_new(FALSE, 0); + data1 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data1), LARGE); + label1 = gtk_label_new("Address:"); + gtk_widget_set_usize(GTK_WIDGET(label1), 75, -1); + gtk_box_pack_start(GTK_BOX(field6), label1, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field6), data1, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field6, FALSE, TRUE, 2); + + field7 = gtk_hbox_new(FALSE, 0); + data12 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data12), TINY); + label12 = gtk_label_new("Month:"); + gtk_widget_set_usize(GTK_WIDGET(label12), 75, -1); + gtk_box_pack_start(GTK_BOX(field7), label12, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field7), data12, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field7, FALSE, TRUE, 2); + + field8 = gtk_hbox_new(FALSE, 0); + data15 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data15), LARGE); + label15 = gtk_label_new("Organization:"); + gtk_widget_set_usize(GTK_WIDGET(label15), 75, -1); + gtk_box_pack_start(GTK_BOX(field8), label15, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field8), data15, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field8, FALSE, TRUE, 2); + + field9 = gtk_hbox_new(FALSE, 0); + data17 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data17), LARGE); + label17 = gtk_label_new("Publisher:"); + gtk_widget_set_usize(GTK_WIDGET(label17), 75, -1); + gtk_box_pack_start(GTK_BOX(field9), label17, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field9), data17, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field9, FALSE, TRUE, 2); + + field10 = gtk_hbox_new(FALSE, 0); + data22 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data22), LARGE); + label22 = gtk_label_new("URL:"); + gtk_widget_set_usize(GTK_WIDGET(label22), 75, -1); + gtk_box_pack_start(GTK_BOX(field10), label22, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field10), data22, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field10, FALSE, TRUE, 2); + + field11 = gtk_hbox_new(FALSE, 0); + data2 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data2), LARGE); + label2 = gtk_label_new("note:"); + gtk_widget_set_usize(GTK_WIDGET(label2), 75, -1); + gtk_box_pack_start(GTK_BOX(field11), label2, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field11), data2, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field11, FALSE, TRUE, 2); + + text13 = gtk_text_buffer_new(NULL); + data13 = gtk_text_view_new_with_buffer(text13); + textscroll = gtk_scrolled_window_new(NULL, NULL); + font_desc = pango_font_description_from_string("Sans 12"); + gtk_widget_modify_font(data13, font_desc); + gtk_container_add(GTK_CONTAINER(textscroll), data13); + gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(textscroll), + GTK_POLICY_AUTOMATIC, + GTK_POLICY_AUTOMATIC); + gtk_widget_set_usize(GTK_WIDGET(data13), 30, 250); + label13 = gtk_label_new("Annotes:"); + gtk_box_pack_start(GTK_BOX(totalPane), label13, FALSE, TRUE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), textscroll, FALSE, TRUE, 2); + + /* finally, put the cancel button in place */ + field0 = gtk_hbox_new(FALSE, 0); + key0 = gtk_button_new_with_label("CANCEL"); + gtk_widget_set_usize(GTK_WIDGET(key0), 90, -1); + g_signal_connect(GTK_OBJECT(key0), "clicked", + G_CALLBACK(close_confoptions), NULL); + gtk_tooltips_set_tip(tooltips, key0, + "Discard the contents of this window", NULL); + gtk_box_pack_end(GTK_BOX(field0), key0, FALSE, FALSE, 10); + key1 = gtk_button_new_with_label("Save"); + gtk_widget_set_usize(GTK_WIDGET(key1), 90, -1); + g_signal_connect(GTK_OBJECT(key1), "clicked", + G_CALLBACK(save_confoptions), NULL); + gtk_tooltips_set_tip(tooltips, key1, + "Store the contents of this window", NULL); + gtk_box_pack_end(GTK_BOX(field0), key1, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field0, FALSE, TRUE, 10); + + /* put the composite window on the screen */ + gtk_widget_show_all(window); +} + + + +/* The procedure to put the basic conference style on the screen */ + +void conference(GtkWidget *widget) +{ + GtkTooltips *tooltips; + GtkWidget *window; + GtkWidget *decoration; + GtkWidget *totalPane; + GtkWidget *opDecoration; + GtkWidget *field0; + GtkWidget *field1; + GtkWidget *option; + GtkWidget *controls; + GtkWidget *key1; + GtkWidget *key2; + GtkWidget *key3; + GtkWidget *key4; + GtkWidget *field2; + GtkWidget *field3; + GtkWidget *field4; + GtkWidget *field5; + extern int format; + extern char slate0[]; + + extern void linkwindow(); + extern void closure_check(); /* defined in file cleanup.c */ + extern void close_window(); /* defined in file cleanup.c */ + void confoptions(); + void save_conference(); + + /* create the tooltip help feature */ + + tooltips = gtk_tooltips_new(); + + format = 4; /* indicate processing of an CONFERENCE */ + + /* create the wondow and its top panel */ + window = gtk_window_new(GTK_WINDOW_TOPLEVEL); + gtk_window_set_title(GTK_WINDOW(window), "XBibFile create"); + gtk_window_position(GTK_WINDOW(window), GTK_WIN_POS_MOUSE); + decoration = gtk_frame_new("Conference type - required fields"); + gtk_widget_set_usize(GTK_WIDGET(window), 450, 325); + gtk_container_add(GTK_CONTAINER(window), decoration); + totalPane = gtk_vbox_new(FALSE, 5); + gtk_container_add(GTK_CONTAINER(decoration), totalPane); + + field1 = gtk_hbox_new(FALSE,0); + dataX = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(dataX), SMALL); + gtk_widget_set_usize(GTK_WIDGET(dataX), 345, -1); + labelX = gtk_label_new("Tag/s:"); + gtk_widget_set_usize(GTK_WIDGET(labelX), 65, -1); + gtk_box_pack_start(GTK_BOX(field1), labelX, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field1), dataX, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field1, FALSE, TRUE, 10); + + field0 = gtk_hbox_new(FALSE, 0); + data0 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data0), LARGE); + gtk_widget_set_usize(GTK_WIDGET(data0), 345, -1); + label0 = gtk_label_new("File used:"); + gtk_widget_set_usize(GTK_WIDGET(label0), 65, -1); + gtk_entry_set_text(GTK_ENTRY(data0), slate0); + gtk_box_pack_start(GTK_BOX(field0), label0, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field0), data0, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field0, FALSE, TRUE, 2); + + /* position the remaining field entries */ + field2 = gtk_hbox_new(FALSE, 0); + data3 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data3), LARGE); + gtk_widget_set_usize(GTK_WIDGET(data3), 345, -1); + label3 = gtk_label_new("Authors/s:"); + gtk_widget_set_usize(GTK_WIDGET(label3), 65, -1); + gtk_box_pack_start(GTK_BOX(field2), label3, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field2), data3, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field2, FALSE, TRUE, 2); + + field3 = gtk_hbox_new(FALSE, 0); + data20 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data20), LARGE); + gtk_widget_set_usize(GTK_WIDGET(data20), 345, -1); + label20 = gtk_label_new("Title:"); + gtk_widget_set_usize(GTK_WIDGET(label20), 65, -1); + gtk_box_pack_start(GTK_BOX(field3), label20, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field3), data20, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field3, FALSE, TRUE, 2); + + field4 = gtk_hbox_new(FALSE, 0); + data4 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data4), LARGE); + gtk_widget_set_usize(GTK_WIDGET(data4), 345, -1); + label4 = gtk_label_new("BookTitle:"); + gtk_widget_set_usize(GTK_WIDGET(label4), 65, -1); + gtk_box_pack_start(GTK_BOX(field4), label4, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field4), data4, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field4, FALSE, TRUE, 2); + + field5 = gtk_hbox_new(FALSE, 0); + data24 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data24), TINY); + gtk_widget_set_usize(GTK_WIDGET(data24), 200, -1); + label24 = gtk_label_new("Year:"); + gtk_widget_set_usize(GTK_WIDGET(label24), 65, -1); + gtk_box_pack_start(GTK_BOX(field5), label24, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field5), data24, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field5, FALSE, TRUE, 2); + + /* put the control keys on to the window */ + option = gtk_hbox_new(FALSE, 0); + key2 = gtk_button_new_with_label("Optional fields"); + gtk_widget_set_usize(GTK_WIDGET(key2), 130, -1); + g_signal_connect(GTK_OBJECT(key2), "clicked", + G_CALLBACK(confoptions), NULL); + gtk_tooltips_set_tip(tooltips, key2, + "Click here to get window containing remaining Conference fields", + NULL); + gtk_box_pack_start(GTK_BOX(option), key2, FALSE, FALSE, 10); + controls = gtk_hbox_new(FALSE, 0); + key1 = gtk_button_new_with_label("Save"); + gtk_widget_set_usize(GTK_WIDGET(key1), 90, -1); + g_signal_connect(GTK_OBJECT(key1), "clicked", + G_CALLBACK(save_conference), NULL); + gtk_tooltips_set_tip(tooltips, key1, + "Store this Conference reference in database", NULL); + gtk_box_pack_start(GTK_BOX(controls), key1, FALSE, FALSE, 30); + key3 = gtk_button_new_with_label("Cancel"); + gtk_widget_set_usize(GTK_WIDGET(key3), 90, -1); + g_signal_connect(GTK_OBJECT(key3), "clicked", + G_CALLBACK(closure_check), NULL); + gtk_tooltips_set_tip(tooltips, key3, + "Discard this Conference entry", NULL); + gtk_box_pack_start(GTK_BOX(controls), key3, FALSE, FALSE, 30); + key4 = gtk_button_new_with_label("Linking"); + gtk_widget_set_usize(GTK_WIDGET(key4), 90, -1); + g_signal_connect(GTK_OBJECT(key4), "clicked", + G_CALLBACK(linkwindow), NULL); + gtk_tooltips_set_tip(tooltips, key4, + "Click here for window to create links for this Conference", + NULL); + gtk_box_pack_start(GTK_BOX(controls), key4, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), option, FALSE, TRUE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), controls, FALSE, TRUE, 10); + + + format = 4; + + /* make the composite visible on screen */ + gtk_widget_show_all(window); +} diff --git a/biblio/bibtex/utils/xbibfile/count.pl b/biblio/bibtex/utils/xbibfile/count.pl new file mode 100644 index 0000000000..fe64209197 --- /dev/null +++ b/biblio/bibtex/utils/xbibfile/count.pl @@ -0,0 +1,14 @@ +#!/usr/bin/perl +# +# this script counts the number of references (@) in a file +# +# This script is part of the XBibFile software package. +# Writer: Ross Maloney +# Date: August 2000 +# +while ( <> ) { + if ( /@/ ) { + $count++; + } +} +print "number of references = $count\n"; diff --git a/biblio/bibtex/utils/xbibfile/default.bib b/biblio/bibtex/utils/xbibfile/default.bib new file mode 100644 index 0000000000..539f9ae772 --- /dev/null +++ b/biblio/bibtex/utils/xbibfile/default.bib @@ -0,0 +1,99 @@ + +@ARTICLE{ross, + author = {Maloney}, + title = {my greatest thoughts}, + journal = {hi hopes}, + year = {1999}, + volume = {12}, + number = {4}, + pages = {56-90}, + month = {may}, + note = {fdertg.}, + uplink = {ummy}, + crosslink = {freinds, family}, + externlink = {summary.txt} } + +@ARTICLE{a, + author = {b}, + title = {c}, + journal = {d}, + year = {e}, + volume = {f}, + number = {g}, + pages = {h}, + month = {g}, + note = {jklo}, + uplink = {x}, + crosslink = {y}, + externlink = {q} } + +@ARTICLE{ross2, + author = {Maloney, Ross}, + title = {further thoughts}, + journal = {hi hopes}, + year = {2000}, + volume = {3}, + number = {4}, + pages = {12-90}, + month = {may}, + note = {defrgth.}, + uplink = {mummy}, + crosslink = {daddy, friends}, + externlink = {summary.txt} } + +@ARTICLE{xx, + author = {yy}, + title = {zz}, + journal = {xx}, + year = {fg} } + +@ARTICLE{df, + author = {fg}, + title = {hj}, + journal = {fg}, + year = {fg} } + +@ARTICLE{d, + author = {f}, + title = {g}, + journal = {h}, + year = {j}, + volume = {d}, + number = {f}, + pages = {g}, + month = {e}, + note = {dfg}, + uplink = {d}, + crosslink = {f}, + externlink = {g} } + +@ARTICLE{ross, + author = {ff}, + title = {xx}, + journal = {ghj}, + year = {1990}, + uplink = {dfg}, + crosslink = {zxc bn}, + externlink = {def nkl} } + +@INPROCEEDINGS{adc:2000, + author = {me}, + title = {mine}, + booktitle = {fgt}, + year = {2000}, + pages = {34--67}, + address = {My Place}, + organization = {Org One} } + +@INPROCEEDINGS{xyz:2000, + author = {me and mine}, + title = {my paper}, + booktitle = {paapers}, + year = {2000}, + series = {dd}, + pages = {56--90}, + month = {June}, + publisher = {dfg}, + annote = {This is a second silly test of the annotation capacity of the +InProceedings entry field. +} } diff --git a/biblio/bibtex/utils/xbibfile/error.c b/biblio/bibtex/utils/xbibfile/error.c new file mode 100644 index 0000000000..fec888f1b0 --- /dev/null +++ b/biblio/bibtex/utils/xbibfile/error.c @@ -0,0 +1,72 @@ +/* This file is a part of XBibFile - a system for handling BibTeX references + * + * Author: Ross Maloney + * Date: October 1999 + * Modified: January 2002 + * + */ + +#include <gtk/gtk.h> + +extern void close_window(); /* defined in file cleanup.c */ + +/* This file contains the error handling routines. */ + +/* The error types are: + * 1 entries not saved + * 2 last entry not saved + * 3 all required fields not supplied + * 4 requested function not implemented + * 5 this reference has been saved already + * 6 I am sorry, but you have already saved this entry + * 7 cannot open that file + * 8 currently there is no file selected + * 9 format in the current BibTeX file selected */ + +void error(GtkWidget *widget, + GtkWidget *type) +{ + GtkWidget *window; + GtkWidget *button; + GtkWidget *label; + char bell = '\007'; /* ASCII code for a bell */ + + window = gtk_window_new(GTK_WINDOW_TOPLEVEL); + gtk_window_set_title(GTK_WINDOW(window), "XBibFile security"); + gtk_window_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER); + button = gtk_button_new(); + gtk_widget_set_usize(GTK_WIDGET(button), 250, 100); + g_signal_connect(GTK_OBJECT(button), "clicked", + G_CALLBACK(close_window), NULL); + gtk_container_add(GTK_CONTAINER(window), button); + switch (GPOINTER_TO_INT(type)) { + case 1: label = gtk_label_new("Entries not saved"); + break; + case 2: label = gtk_label_new("Last entry not saved"); + break; + case 3: label = gtk_label_new("All required fields not supplied"); + break; + case 4: label = gtk_label_new("Requested function not implemented"); + break; + case 5: label = gtk_label_new("This reference has been saved already"); + break; + case 6: label = gtk_label_new("I am sorry,\n but you have already saved this entry"); + break; + case 7: label = gtk_label_new("Cannot open that file for appending"); + break; + case 8: label = gtk_label_new("Currently there is no file selected"); + break; + case 9: label = gtk_label_new("Error detected in BibTeX file\n while processing it"); + break; + default: label = gtk_label_new("Impossible error (ERROR)"); + } + gtk_container_add(GTK_CONTAINER(button), label); + + /* put the window on the screen */ + gtk_widget_show_all(window); + g_print("%c", bell); +} + + + + diff --git a/biblio/bibtex/utils/xbibfile/filing.c b/biblio/bibtex/utils/xbibfile/filing.c new file mode 100644 index 0000000000..5d290667bf --- /dev/null +++ b/biblio/bibtex/utils/xbibfile/filing.c @@ -0,0 +1,146 @@ +/* This file is a part of XBibFile - a system for handling BibTeX references + * + * Author: Ross Maloney + * Date: October 1999 + * Modified: January 2001 + * Renamed, reformed, and reworked: January 2002 + * + */ + +#include <stdio.h> +#include <gtk/gtk.h> + +/* This procedure get the name of the file that will be processed for + * cross reference information. */ + +void ref_file(GtkWidget *widget, GtkFileSelection *ref) +{ + extern char slate40[]; + extern int length[]; + extern FILE *refFile; + extern void error(); + + if (refFile) { + g_print("The cross-file is currently open, I will shut it\n"); + fclose(refFile); + refFile = 0; + } + strcpy(slate40, gtk_file_selection_get_filename(GTK_FILE_SELECTION(ref))); + length[40] = strlen(slate40); + refFile = fopen(slate40, "r"); + if (!refFile) { + error(widget, 7); + return; + } +} + +/* This procedure is very similar to the procedure new_filename(). + * However, this procedure is designed to be called when the reference file + * is to be searched. It puts the selected filename in to a location + * from which other parts of the program can access it, and + * opens it, then calls the reference search tools. */ + +void existing_filename(GtkWidget * widget, GtkFileSelection *new) +{ + extern char slate0[]; + extern int length[]; + extern FILE *refFile; /* defined in file xbibfile.c */ + extern void error(); + extern void explore_tools(); /* contained in explore.c */ + + if (refFile) { + g_print("A file is currently open, I will shut it\n"); + fclose(refFile); + refFile = 0; + } + strcpy(slate0, gtk_file_selection_get_filename(GTK_FILE_SELECTION(new))); + length[0] = strlen(slate0); + refFile = fopen(slate0, "r"); + if (!refFile) { + error(widget, 7); + return; + } + probe_menu(widget); +} + + +/* This procedure allows the user to select the file for exploring the + * reference information already stored in it */ + +void ref_select(GtkWidget *widget) +{ + GtkWidget *crossFile; + + crossFile = gtk_file_selection_new("BibTeX database to review"); + gtk_file_selection_hide_fileop_buttons(GTK_FILE_SELECTION(crossFile)); + + gtk_file_selection_set_filename(GTK_FILE_SELECTION(crossFile), + "penguin.bib"); + g_signal_connect(GTK_OBJECT( + GTK_FILE_SELECTION(crossFile)->ok_button), + "clicked", G_CALLBACK(existing_filename), crossFile); + g_signal_connect_swapped(GTK_OBJECT( + GTK_FILE_SELECTION(crossFile)->cancel_button), + "clicked", G_CALLBACK(gtk_widget_destroy), + (gpointer) crossFile); + + gtk_widget_show(crossFile); +} + + + +/* This procedure puts the selected filename in to a location + * from which other parts of the program can access it, and + * opens it, then calls the reference creation menu. */ + +void new_filename(GtkWidget * widget, GtkFileSelection *new) +{ + extern char slate0[]; + extern int length[]; + extern FILE *finput; + extern void error(); + extern void available(); /* contained in selecting.c */ + + if (finput) { + g_print("A file is currently open, I will shut it\n"); + fclose(finput); + finput = 0; + } + strcpy(slate0, gtk_file_selection_get_filename(GTK_FILE_SELECTION(new))); + length[0] = strlen(slate0); + finput = fopen(slate0, "a"); + if (!finput) { + error(widget, 7); + return; + } + available(widget); +} + + +/* This procedure allows the user to select the file into which + * the references are to be written */ + +void file_select(GtkWidget *widget) +{ + GtkWidget *inputFile; + + + inputFile = gtk_file_selection_new("BibTeX database to append"); + + gtk_file_selection_hide_fileop_buttons(GTK_FILE_SELECTION(inputFile)); + gtk_file_selection_set_filename(GTK_FILE_SELECTION(inputFile), + "penguin.bib"); + g_signal_connect(GTK_OBJECT( + GTK_FILE_SELECTION(inputFile)->ok_button), + "clicked", G_CALLBACK(new_filename), inputFile); + g_signal_connect_swapped(GTK_OBJECT( + GTK_FILE_SELECTION(inputFile)->cancel_button), + "clicked", G_CALLBACK(gtk_widget_destroy), + (gpointer) inputFile); +// g_signal_connect_swapped(GTK_OBJECT( +// GTK_FILE_SELECTION(inputFile)->ok_button), +// "clicked", G_CALLBACK(gtk_widget_destroy), +// (gpointer) inputFile); + + gtk_widget_show(inputFile); +} diff --git a/biblio/bibtex/utils/xbibfile/historical.note b/biblio/bibtex/utils/xbibfile/historical.note new file mode 100644 index 0000000000..5629b778b8 --- /dev/null +++ b/biblio/bibtex/utils/xbibfile/historical.note @@ -0,0 +1,105 @@ +XBibFile grew out of an early need in my research. I needed some +technique to handle my research references. + +The School of Information Technology where I was doing my research, at +that time was promoting the use of EndNotes for handling for referencing. +However, EndNotes was a Windows application and not available on Unix, or +specifically, Linux. Because of my background in Commputer Science, I +had made a decision early in my research to use Linux as my research +environment, using LaTeX (and possibly TeX) as my typesetting tools. +Linux had the attributes of being available at the "right price" on both +Intel and Digital Alpha hardware architectures which I would be using, +was stable in operation, and contained the broad suite of tools +available under the Open Source policy. BibTeX was to be the format +in which my references were to be recorded and processed. Although the +EndNotes format could be converted into BibTeX format, running a +Windows environment for EndNotes and a Linux environment for every +thing else appeared a little strange. + +The problem was that CTAN appeared not to has a program that could +provide the support I required for my reference making and handling. +What I required was: + . a method of inputting the references that presenced both the + required and optional fields for any of the reference types + handled by BibTeX; + . a mechanism of cross-linking references so that I could keep + track of the route by which that reference had been arrived, + e.g. this reference appears in the reference list of another + reference in my bibliography; + . a graphical means of inserting and removing cross-links between + references; + . a means of following those cross-links -- clicking on the + appropriate link field would bring-up a window appropriate for + that reference, or if already on the screen, bringing it to the + top; + . enabled the linking into each reference, the address of files which + were related e.g. the path and name of a text file that + contained a summary of the paper but was prepared independent of + XBibFile i.e. in addition to any notes that were recorded in the + "annote" field of the BibTeX recoord. +All this was to be accomplished using the BibTeX .bib file without +compromising its direct use with the BibTeX program. + +I gave myself a week to write the program to accomplish the above +requirements or at least to demonstrate that the concept was +achievable. The week was from Sunday 26 September 1999 until Sunday 3 +October. During that week I had no tutoring commitments and my two +thesis supervisors were absent so I would have few obstacles to my +progress. As a first step, this README file was prepared so that I +could keep track of what I was trying to accomplish. As the week +continued, additions were made to this README. + +I looked at a number of programs available from CTAN but none quite +filled my requirements. XBibTeX by Nicolas J. Kelly and Christian +H. Bischof provided the required BibTeX entry creation mechanism. +However, I experienced problems with the operation of the program: +with no warning the program would core-dump when saving an entry, +loosing all the work invested in that entry. Whether that behaviour +was due to my use of X11 R6 as opposed to the source codes stated +need for X11 R4, I remain uncertain. But since XBibTeX only handled a +part of my requirements, I determined that resolving that problem was not +good use of my time. I tried BibView by Holger Martin, Peter Urban, +and Armin Liebl but could not get it to compile. Gerd Neugebauer's +BibTool provided manipulation capabilities for a BibTeX database which +offered promise, but first the database had to be created. + +The first question was how to implement the project. My initial +thinking was to embed my requirements somehow inside a Web browser +because browsers have the required address linking capabilities +already built-in. However, I anticipated difficulties with that +approach in generating the BibTeX database entries and placing them on +disk. The alternative was to write in C with a X toolkit. Of the +toolkits available to me, the GIMP Toolkit (GTK+) looked the most +promising and also I wanted to get some experience in programming with +it. My interest in GTK+ occurred after reading the documentation that +accompanied version 1.0. However, that documentation contained many +gaps in the information. With Red Hat Linux 6.0 came version 1.2.1 of +GTK+ and that resolved may of those perceived shortcomings. The +writing of XBibFile was accompanied by my learning to program with the +GTK+. + +The development environment used was a Toshiba Satellite 4060XCDT +laptop computer with a 14.1" colour display and 64MB of memory. On +that hardware, Red Hat Linux 6.0 was run which consisted of a 2.2.5 +Linux kernel with egcs version 1.1.2, and GTK+ version 1.2.1. + +During that first week, the majority of time was taken up in learning +to use the GTK toolkit. First the latest version (1.2.5) available on +the Internet was downloaded. It was hoped that the developers of the +package would have improved the state of ddocumentation included in +earlier distributions. That was not the case. To supplement the +documentation, the examples included in the distribution allowed a +level of understanding to be obtained. By the afternoon of Friday, +enough of an understanding of GTK had been obtained to enable work on +XBibFile to commence. + +It took 10 days of fairly intensive work to get the first stage of the +program completed. By that time, a reference could be created and +stored. Work then ceased. Upon using BibTeX for another project, I +realised that the NOTE entry was incorrect. That entry was ment for +introducing annotation with each reference but was not supposed to be +included when a reference list was generated via BibTeX. Kopka and +Daly[1999] indicate that such a field should be titled ANNOTE. Also +Kopka and Daly[1999] indicate that the NOTE field was required in an +entry of type UNPUBLISHED; it was optional in all others. ANNOTE was +adopted in XBibFile as it appeared to be more appropriate. diff --git a/biblio/bibtex/utils/xbibfile/inbook.c b/biblio/bibtex/utils/xbibfile/inbook.c new file mode 100644 index 0000000000..f9cccf1d5c --- /dev/null +++ b/biblio/bibtex/utils/xbibfile/inbook.c @@ -0,0 +1,581 @@ +/* This file is a part of XBibFile - a system for handling BibTeX references + * + * Author: Ross Maloney + * Date: October 1999 + * Modified: January 2002 + * + */ + +#include <stdio.h> +#include <gtk/gtk.h> + +#include "xbibfile.h" + +/* This file is a modified copy of book.c so that it handles the + * inbook BibTeX reference style */ + + +GtkWidget *labelX, *dataX; +GtkWidget *label0, *data0; +GtkWidget *label1, *data1; +GtkWidget *label2, *data2; +GtkWidget *label3, *data3; +GtkWidget *label5, *data5; +GtkWidget *label6, *data6; +GtkWidget *label7, *data7; +GtkWidget *label12, *data12; +GtkWidget *label13, *data13, *textscroll; +GtkWidget *label14, *data14; +GtkWidget *label16, *data16; +GtkWidget *label17, *data17; +GtkWidget *label19, *data19; +GtkWidget *label20, *data20; +GtkWidget *label21, *data21; +GtkWidget *label22, *data22; +GtkWidget *label23, *data23; +GtkWidget *label24, *data24; +GtkWidget *label30, *data30; +GtkWidget *label31, *data31; +GtkWidget *label32, *data32; +GtkTextBuffer *text13; +GtkTextIter start, end; +PangoFontDescription *font_desc; + + + + +/* The procedure to insave the book style */ + +void save_inbook(GtkWidget *widget) +{ + extern int format; + extern int length[]; + extern char slate[][]; + extern int lengthX; + extern char slateX[]; + extern char slate1[]; + extern char slate2[]; + extern char slate3[]; + extern char slate5[]; + extern char slate6[]; + extern char slate7[]; + extern char slate12[]; + extern char slate13[]; + extern char slate14[]; + extern char slate16[]; + extern char slate17[]; + extern char slate19[]; + extern char slate20[]; + extern char slate21[]; + extern char slate22[]; + extern char slate23[]; + extern char slate24[]; + extern char slate30[]; + extern char slate31[]; + extern char slate32[]; + extern void error(); /* defined in file error.c */ + extern FILE *finput; /* defined in file xbibfile.c */ + extern void close_window(); /* defined in file cleanup.c */ + + if (format != 5) { + error(widget, GINT_TO_POINTER(5)); + return; + } + strcpy(slateX, gtk_entry_get_text(GTK_ENTRY(dataX))); + lengthX = strlen(slateX); + strcpy(slate3, gtk_entry_get_text(GTK_ENTRY(data3))); + length[3] = strlen(slate3); + strcpy(slate5, gtk_entry_get_text(GTK_ENTRY(data5))); + length[5] = strlen(slate5); + strcpy(slate7, gtk_entry_get_text(GTK_ENTRY(data7))); + length[7] = strlen(slate7); + strcpy(slate16, gtk_entry_get_text(GTK_ENTRY(data16))); + length[16] = strlen(slate16); + strcpy(slate17, gtk_entry_get_text(GTK_ENTRY(data17))); + length[17] = strlen(slate17); + strcpy(slate20, gtk_entry_get_text(GTK_ENTRY(data20))); + length[20] = strlen(slate20); + strcpy(slate24, gtk_entry_get_text(GTK_ENTRY(data24))); + length[24] = strlen(slate24); + if (!((length[3] || length[7]) && length[20] && length[5] + && length[16] && length[17] && length[24] && lengthX)) { + error(widget, GINT_TO_POINTER(3)); + return; + } + if (!finput) { + error(widget, GINT_TO_POINTER(8)); + return; + } + /* finput = stdout; */ + fprintf(finput, "\n@INBOOK{%s,\n", slateX); + if (length[3]) fprintf(finput, " author = {%s},\n", slate3); + if (length[7]) fprintf(finput, " editor = {%s},\n", slate7); + fprintf(finput, " title = {%s},\n", slate20); + if (length[5]) fprintf(finput, " chapter = {%s},\n", slate5); + if (length[16]) fprintf(finput, " pages = {%s},\n", slate16); + fprintf(finput, " publisher = {%s},\n", slate17); + fprintf(finput, " year = {%s}", slate24); + if (length[23]) + fprintf(finput, ",\n volume = {%s}", slate23); + if (length[14]) + fprintf(finput, ",\n number = {%s}", slate14); + if (length[19]) + fprintf(finput, ",\n series = {%s}", slate19); + if (length[21]) + fprintf(finput, ",\n type = {%s}", slate21); + if (length[1]) + fprintf(finput, ",\n address = {%s}", slate1); + if (length[6]) + fprintf(finput, ",\n edition = {%s}", slate6); + if (length[12]) + fprintf(finput, ",\n month = {%s}", slate12); + if (length[22]) + fprintf(finput, ",\n URL = {%s}", slate22); + if (length[2]) + fprintf(finput, ",\n note = {%s}", slate2); + if (length[13]) + fprintf(finput, ",\n annote = {%s}", slate13); + if (length[30]) + fprintf(finput, ",\n uplink = {%s}", slate30); + if (length[31]) + fprintf(finput, ",\n crosslink = {%s}", slate31); + if (length[32]) + fprintf(finput, ",\n externlink = {%s}", slate32); + fprintf(finput, " }\n"); + /* indicate that the reference is saved */ + format = 0; + length[1] = 0; + length[2] = 0; + length[6] = 0; + length[12] = 0; + length[13] = 0; + length[14] = 0; + length[19] = 0; + length[21] = 0; + length[22] = 0; + length[23] = 0; + length[30] = 0; + length[31] = 0; + length[32] = 0; + close_window(widget); /* remove this reference window */ +} + + +/* Save the inbook optional fields for subsequent saving */ + +void save_inbookoptions(GtkWidget *widget) +{ + extern void close_window(); + extern int length[]; + extern char slate1[]; + extern char slate2[]; + extern char slate6[]; + extern char slate12[]; + extern char slate13[]; + extern char slate14[]; + extern char slate19[]; + extern char slate21[]; + extern char slate22[]; + extern char slate23[]; + char *text_in_field; + int count; + + strcpy(slate1, gtk_entry_get_text(GTK_ENTRY(data1))); + length[1] = strlen(slate1); + strcpy(slate6, gtk_entry_get_text(GTK_ENTRY(data6))); + length[6] = strlen(slate6); + strcpy(slate12, gtk_entry_get_text(GTK_ENTRY(data12))); + length[12] = strlen(slate12); + strcpy(slate14, gtk_entry_get_text(GTK_ENTRY(data14))); + length[14] = strlen(slate14); + strcpy(slate19, gtk_entry_get_text(GTK_ENTRY(data19))); + length[19] = strlen(slate19); + strcpy(slate21, gtk_entry_get_text(GTK_ENTRY(data21))); + length[21] = strlen(slate21); + strcpy(slate23, gtk_entry_get_text(GTK_ENTRY(data23))); + length[23] = strlen(slate23); + strcpy(slate22, gtk_entry_get_text(GTK_ENTRY(data22))); + length[22] = strlen(slate22); + strcpy(slate2, gtk_entry_get_text(GTK_ENTRY(data2))); + length[2] = strlen(slate2); + count = gtk_text_buffer_get_char_count(text13); + gtk_text_buffer_get_iter_at_offset(text13, &end, count); + gtk_text_buffer_get_iter_at_offset(text13, &start, 0); + strcpy(slate13, gtk_text_buffer_get_text(text13, &start, &end, FALSE)); + length[13] = count; + + close_window(widget); +} + + + + +/* Close the option entry window, but first delete the entries */ + +void close_inbookoptions(GtkWidget *widget) +{ + extern void close_window(); + extern int length[]; + + length[23] = 0; + length[22] = 0; + length[21] = 0; + length[19] = 0; + length[14] = 0; + length[13] = 0; + length[12] = 0; + length[6] = 0; + length[2] = 0; + length[1] = 0; + close_window(widget); +} + + +/* The procedure to put the optional inbook style fields on the screen */ + +void inbookoptions(GtkWidget *widget) +{ + extern int format; + GtkTooltips *tooltips; + GtkWidget *window; + GtkWidget *decoration; + GtkWidget *totalPane; + GtkWidget *field0; + GtkWidget *field1; + GtkWidget *field2; + GtkWidget *field3; + GtkWidget *field4; + GtkWidget *field5; + GtkWidget *field6; + GtkWidget *field7; + GtkWidget *field8; + GtkWidget *field9; + GtkWidget *key0; + GtkWidget *key1; + + void close_inbookoptions(); + void save_inbookoptions(); + + if (format == 0) { + error (widget, GINT_TO_POINTER(6)); + return; + } + + /* create the tooltip help feature */ + + tooltips = gtk_tooltips_new(); + + window = gtk_window_new(GTK_WINDOW_TOPLEVEL); + gtk_window_set_title(GTK_WINDOW(window), "XBibFile create"); + gtk_window_position(GTK_WINDOW(window), GTK_WIN_POS_MOUSE); + gtk_widget_set_usize(GTK_WIDGET(window), 400, 665); + decoration = gtk_frame_new("Optional Inbook fields"); + gtk_container_add(GTK_CONTAINER(window), decoration); + totalPane = gtk_vbox_new(FALSE, 5); + gtk_container_add(GTK_CONTAINER(decoration), totalPane); + + /* put the text fields in place */ + field1 = gtk_hbox_new(FALSE, 0); + data23 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data23), TINY); + label23 = gtk_label_new("|| Volume:"); + gtk_widget_set_usize(GTK_WIDGET(label23), 75, -1); + gtk_box_pack_start(GTK_BOX(field1), label23, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field1), data23, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field1, FALSE, TRUE, 10); + + field2 = gtk_hbox_new(FALSE, 0); + data14 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data14), TINY); + label14 = gtk_label_new("|| Number:"); + gtk_widget_set_usize(GTK_WIDGET(label14), 75, -1); + gtk_box_pack_start(GTK_BOX(field2), label14, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field2), data14, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field2, FALSE, TRUE, 2); + + field3 = gtk_hbox_new(FALSE, 0); + data19 =gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data19), SMALL); + label19 = gtk_label_new("Series:"); + gtk_widget_set_usize(GTK_WIDGET(label19), 75, -1); + gtk_box_pack_start(GTK_BOX(field3), label19, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field3), data19, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field3, FALSE, TRUE, 2); + + field4 = gtk_hbox_new(FALSE, 0); + data21 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data21), TINY); + label21 = gtk_label_new("Type:"); + gtk_widget_set_usize(GTK_WIDGET(label21), 75, -1); + gtk_box_pack_start(GTK_BOX(field4), label21, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field4), data21, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field4, FALSE, TRUE, 2); + + field5 = gtk_hbox_new(FALSE, 0); + data1 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data1), LARGE); + label1 = gtk_label_new("Address:"); + gtk_widget_set_usize(GTK_WIDGET(label1), 75, -1); + gtk_box_pack_start(GTK_BOX(field5), label1, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field5), data1, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field5, FALSE, TRUE, 2); + + field6 = gtk_hbox_new(FALSE, 0); + data6 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data6), SMALL); + label6 = gtk_label_new("Edition:"); + gtk_widget_set_usize(GTK_WIDGET(label6), 75, -1); + gtk_box_pack_start(GTK_BOX(field6), label6, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field6), data6, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field6, FALSE, TRUE, 2); + + field7 = gtk_hbox_new(FALSE, 0); + data12 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data12), TINY); + label12 = gtk_label_new("Month:"); + gtk_widget_set_usize(GTK_WIDGET(label12), 75, -1); + gtk_box_pack_start(GTK_BOX(field7), label12, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field7), data12, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field7, FALSE, TRUE, 2); + + field8 = gtk_hbox_new(FALSE, 0); + data22 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data22), LARGE); + label22 = gtk_label_new("URL:"); + gtk_widget_set_usize(GTK_WIDGET(label22), 75, -1); + gtk_box_pack_start(GTK_BOX(field8), label22, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field8), data22, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field8, FALSE, TRUE, 2); + + field9 = gtk_hbox_new(FALSE, 0); + data2 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data2), LARGE); + label2 = gtk_label_new("note:"); + gtk_widget_set_usize(GTK_WIDGET(label2), 75, -1); + gtk_box_pack_start(GTK_BOX(field9), label2, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field9), data2, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field9, FALSE, TRUE, 2); + + text13 = gtk_text_buffer_new(NULL); + data13 = gtk_text_view_new_with_buffer(text13); + textscroll = gtk_scrolled_window_new(NULL, NULL); + font_desc = pango_font_description_from_string("Sans 12"); + gtk_widget_modify_font(data13, font_desc); + gtk_container_add(GTK_CONTAINER(textscroll), data13); + gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(textscroll), + GTK_POLICY_AUTOMATIC, + GTK_POLICY_AUTOMATIC); + gtk_widget_set_usize(GTK_WIDGET(data13), 30, 250); + label13 = gtk_label_new("Annotation:"); + gtk_box_pack_start(GTK_BOX(totalPane), label13, FALSE, TRUE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), textscroll, FALSE, TRUE, 2); + + /* finally, put the cancel button in place */ + field0 = gtk_hbox_new(FALSE, 0); + key0 = gtk_button_new_with_label("CANCEL"); + gtk_widget_set_usize(GTK_WIDGET(key0), 90, -1); + g_signal_connect(GTK_OBJECT(key0), "clicked", + G_CALLBACK(close_inbookoptions), NULL); + gtk_tooltips_set_tip(tooltips, key0, + "Discard the contents of this window", NULL); + gtk_box_pack_end(GTK_BOX(field0), key0, FALSE, FALSE, 10); + key1 = gtk_button_new_with_label("Save"); + gtk_widget_set_usize(GTK_WIDGET(key1), 90, -1); + g_signal_connect(GTK_OBJECT(key1), "clicked", + G_CALLBACK(save_inbookoptions), NULL); + gtk_tooltips_set_tip(tooltips, key1, + "Store the contents of this window", NULL); + gtk_box_pack_end(GTK_BOX(field0), key1, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field0, FALSE, TRUE, 10); + + /* put the composite window on the screen */ + gtk_widget_show_all(window); +} + + + +/* The procedure to put the basic inbook style on the screen */ + +void inbook(GtkWidget *widget) +{ + GtkTooltips *tooltips; + GtkWidget *window; + GtkWidget *decoration; + GtkWidget *totalPane; + GtkWidget *opDecoration; + GtkWidget *field0; + GtkWidget *field1; + GtkWidget *option; + GtkWidget *controls; + GtkWidget *key1; + GtkWidget *key2; + GtkWidget *key3; + GtkWidget *key4; + GtkWidget *field2; + GtkWidget *field3; + GtkWidget *field4; + GtkWidget *field5; + GtkWidget *field6; + GtkWidget *field7; + GtkWidget *field8; + extern int format; + extern char slate0[]; + + extern void linkwindow(); + extern void closure_check(); /* defined in file cleanup.c */ + extern void close_window(); /* defined in file cleanup.c */ + void inbookoptions(); + + /* create the tooltip help feature */ + + tooltips = gtk_tooltips_new(); + + + format = 5; /* indicate processing of an INBOOK */ + + /* create the wondow and its top panel */ + window = gtk_window_new(GTK_WINDOW_TOPLEVEL); + gtk_window_set_title(GTK_WINDOW(window), "XBibFile create"); + gtk_window_position(GTK_WINDOW(window), GTK_WIN_POS_MOUSE); + decoration = gtk_frame_new("InBook type - required fields"); + gtk_widget_set_usize(GTK_WIDGET(window), 450, 415); + gtk_container_add(GTK_CONTAINER(window), decoration); + totalPane = gtk_vbox_new(FALSE, 5); + gtk_container_add(GTK_CONTAINER(decoration), totalPane); + + field1 = gtk_hbox_new(FALSE,0); + dataX = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(dataX), SMALL); + gtk_widget_set_usize(GTK_WIDGET(dataX), 345, -1); + labelX = gtk_label_new("Tag/s:"); + gtk_widget_set_usize(GTK_WIDGET(labelX), 65, -1); + gtk_box_pack_start(GTK_BOX(field1), labelX, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field1), dataX, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field1, FALSE, TRUE, 10); + + field0 = gtk_hbox_new(FALSE, 0); + data0 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data0), LARGE); + gtk_widget_set_usize(GTK_WIDGET(data0), 345, -1); + label0 = gtk_label_new("File used:"); + gtk_widget_set_usize(GTK_WIDGET(label0), 65, -1); + gtk_entry_set_text(GTK_ENTRY(data0), slate0); + gtk_box_pack_start(GTK_BOX(field0), label0, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field0), data0, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field0, FALSE, TRUE, 2); + + /* position the remaining field entries */ + field2 = gtk_hbox_new(FALSE, 0); + data3 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data3), LARGE); + gtk_widget_set_usize(GTK_WIDGET(data3), 345, -1); + label3 = gtk_label_new("|| Authors/s:"); + gtk_widget_set_usize(GTK_WIDGET(label3), 65, -1); + gtk_box_pack_start(GTK_BOX(field2), label3, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field2), data3, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field2, FALSE, TRUE, 2); + + field3 = gtk_hbox_new(FALSE, 0); + data7 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data7), LARGE); + gtk_widget_set_usize(GTK_WIDGET(data7), 345, -1); + label7 = gtk_label_new("|| Editors/s:"); + gtk_widget_set_usize(GTK_WIDGET(label7), 65, -1); + gtk_box_pack_start(GTK_BOX(field3), label7, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field3), data7, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field3, FALSE, TRUE, 2); + + field4 = gtk_hbox_new(FALSE, 0); + data20 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data20), LARGE); + gtk_widget_set_usize(GTK_WIDGET(data20), 345, -1); + label20 = gtk_label_new("Title:"); + gtk_widget_set_usize(GTK_WIDGET(label20), 65, -1); + gtk_box_pack_start(GTK_BOX(field4), label20, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field4), data20, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field4, FALSE, TRUE, 2); + + field5 = gtk_hbox_new(FALSE, 0); + data5 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data5), TINY); + gtk_widget_set_usize(GTK_WIDGET(data5), 345, -1); + label5 = gtk_label_new("|| Chapter:"); + gtk_widget_set_usize(GTK_WIDGET(label5), 65, -1); + gtk_box_pack_start(GTK_BOX(field5), label5, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field5), data5, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field5, FALSE, TRUE, 2); + + field6 = gtk_hbox_new(FALSE, 0); + data16 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data16), LARGE); + gtk_widget_set_usize(GTK_WIDGET(data16), 345, -1); + label16 = gtk_label_new("|| Pages:"); + gtk_widget_set_usize(GTK_WIDGET(label16), 65, -1); + gtk_box_pack_start(GTK_BOX(field6), label16, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field6), data16, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field6, FALSE, TRUE, 2); + + field7 = gtk_hbox_new(FALSE, 0); + data17 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data17), LARGE); + gtk_widget_set_usize(GTK_WIDGET(data17), 345, -1); + label17 = gtk_label_new("Publisher:"); + gtk_widget_set_usize(GTK_WIDGET(label17), 65, -1); + gtk_box_pack_start(GTK_BOX(field7), label17, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field7), data17, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field7, FALSE, TRUE, 2); + + field8 = gtk_hbox_new(FALSE, 0); + data24 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data24), TINY); + gtk_widget_set_usize(GTK_WIDGET(data24), 200, -1); + label24 = gtk_label_new("Year:"); + gtk_widget_set_usize(GTK_WIDGET(label24), 65, -1); + gtk_box_pack_start(GTK_BOX(field8), label24, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field8), data24, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field8, FALSE, TRUE, 2); + + /* put the control keys on to the window */ + option = gtk_hbox_new(FALSE, 0); + key2 = gtk_button_new_with_label("Optional fields"); + gtk_widget_set_usize(GTK_WIDGET(key2), 130, -1); + g_signal_connect(GTK_OBJECT(key2), "clicked", + G_CALLBACK(inbookoptions), NULL); + gtk_tooltips_set_tip(tooltips, key2, + "Click here to get window containing remaining Inbook fields", + NULL); + gtk_box_pack_start(GTK_BOX(option), key2, FALSE, FALSE, 10); + controls = gtk_hbox_new(FALSE, 0); + key1 = gtk_button_new_with_label("Save"); + gtk_widget_set_usize(GTK_WIDGET(key1), 90, -1); + g_signal_connect(GTK_OBJECT(key1), "clicked", + G_CALLBACK(save_inbook), NULL); + gtk_tooltips_set_tip(tooltips, key1, + "Store this Inbook reference in database", NULL); + gtk_box_pack_start(GTK_BOX(controls), key1, FALSE, FALSE, 30); + key3 = gtk_button_new_with_label("Cancel"); + gtk_widget_set_usize(GTK_WIDGET(key3), 90, -1); + g_signal_connect(GTK_OBJECT(key3), "clicked", + G_CALLBACK(closure_check), NULL); + gtk_tooltips_set_tip(tooltips, key3, + "Discard this Inbook entry", NULL); + gtk_box_pack_start(GTK_BOX(controls), key3, FALSE, FALSE, 30); + key4 = gtk_button_new_with_label("Linking"); + gtk_widget_set_usize(GTK_WIDGET(key4), 90, -1); + g_signal_connect(GTK_OBJECT(key4), "clicked", + G_CALLBACK(linkwindow), NULL); + gtk_tooltips_set_tip(tooltips, key4, + "Click here for window to create links for this Inbook", + NULL); + gtk_box_pack_start(GTK_BOX(controls), key4, FALSE, FALSE, 30); + gtk_box_pack_start(GTK_BOX(totalPane), option, FALSE, TRUE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), controls, FALSE, TRUE, 10); + + + format = 5; + + /* make the composite visible on screen */ + gtk_widget_show_all(window); +} + + diff --git a/biblio/bibtex/utils/xbibfile/incol.c b/biblio/bibtex/utils/xbibfile/incol.c new file mode 100644 index 0000000000..770e095c81 --- /dev/null +++ b/biblio/bibtex/utils/xbibfile/incol.c @@ -0,0 +1,605 @@ +/* This file is a part of XBibFile - a system for handling BibTeX references + * + * Author: Ross Maloney + * Date: October 1999 + * Modified: January 2002 + * + */ + +#include <stdio.h> +#include <gtk/gtk.h> + +#include "xbibfile.h" + +/* This file is a modified copy of inproc.c so that it handles the + * incollection BibTeX reference style */ + + +GtkWidget *labelX, *dataX; +GtkWidget *label0, *data0; +GtkWidget *label1, *data1; +GtkWidget *label2, *data2; +GtkWidget *label3, *data3; +GtkWidget *label4, *data4; +GtkWidget *label5, *data5; +GtkWidget *label6, *data6; +GtkWidget *label7, *data7; +GtkWidget *label12, *data12; +GtkWidget *label13, *data13, *textscroll; +GtkWidget *label14, *data14; +GtkWidget *label16, *data16; +GtkWidget *label17, *data17; +GtkWidget *label19, *data19; +GtkWidget *label20, *data20; +GtkWidget *label21, *data21; +GtkWidget *label22, *data22; +GtkWidget *label23, *data23; +GtkWidget *label24, *data24; +GtkWidget *label30, *data30; +GtkWidget *label31, *data31; +GtkWidget *label32, *data32; +GtkTextBuffer *text13; +GtkTextIter start, end; +PangoFontDescription *font_desc; + + + + +/* The procedure to save the incollection style */ + +void save_incol(GtkWidget *widget) +{ + extern int format; + extern int length[]; + extern char slate[][]; + extern int lengthX; + extern char slateX[]; + extern char slate1[]; + extern char slate2[]; + extern char slate3[]; + extern char slate4[]; + extern char slate5[]; + extern char slate6[]; + extern char slate7[]; + extern char slate12[]; + extern char slate13[]; + extern char slate14[]; + extern char slate16[]; + extern char slate17[]; + extern char slate19[]; + extern char slate20[]; + extern char slate21[]; + extern char slate22[]; + extern char slate23[]; + extern char slate24[]; + extern char slate30[]; + extern char slate31[]; + extern char slate32[]; + extern void error(); /* defined in file error.c */ + extern FILE *finput; /* defined in file xbibfile.c */ + extern void close_window(); /* defined in file cleanup.c */ + + if (format != 6) { + error(widget, GINT_TO_POINTER(5)); + return; + } + strcpy(slateX, gtk_entry_get_text(GTK_ENTRY(dataX))); + lengthX = strlen(slateX); + strcpy(slate3, gtk_entry_get_text(GTK_ENTRY(data3))); + length[3] = strlen(slate3); + strcpy(slate4, gtk_entry_get_text(GTK_ENTRY(data4))); + length[4] = strlen(slate4); + strcpy(slate17, gtk_entry_get_text(GTK_ENTRY(data17))); + length[17] = strlen(slate17); + strcpy(slate20, gtk_entry_get_text(GTK_ENTRY(data20))); + length[20] = strlen(slate20); + strcpy(slate24, gtk_entry_get_text(GTK_ENTRY(data24))); + length[24] = strlen(slate24); + if (!(length[3] && length[4] && length[17] && length[20] && length[24] + && lengthX)) { + error(widget, GINT_TO_POINTER(3)); + return; + } + if (!finput) { + error(widget, GINT_TO_POINTER(8)); + return; + } + /* finput = stdout; */ + fprintf(finput, "\n@INCOLLECTION{%s,\n", slateX); + fprintf(finput, " author = {%s},\n", slate3); + fprintf(finput, " title = {%s},\n", slate20); + fprintf(finput, " booktitle = {%s},\n", slate4); + fprintf(finput, " publisher = {%s},\n", slate17); + fprintf(finput, " year = {%s}", slate24); + if (length[7]) + fprintf(finput, ",\n editor = {%s}", slate7); + if (length[23]) + fprintf(finput, ",\n volume = {%s}", slate23); + if (length[14]) + fprintf(finput, ",\n number = {%s}", slate14); + if (length[19]) + fprintf(finput, ",\n series = {%s}", slate19); + if (length[21]) + fprintf(finput, ",\n type = {%s}", slate21); + if (length[5]) + fprintf(finput, ",\n chapter = {%s}", slate5); + if (length[16]) + fprintf(finput, ",\n pages = {%s}", slate16); + if (length[1]) + fprintf(finput, ",\n address = {%s}", slate1); + if (length[6]) + fprintf(finput, ",\n edition = {%s}", slate6); + if (length[12]) + fprintf(finput, ",\n month = {%s}", slate12); + if (length[22]) + fprintf(finput, ",\n URL = {%s}", slate22); + if (length[2]) + fprintf(finput, ",\n note = {%s}", slate2); + if (length[13]) + fprintf(finput, ",\n annote = {%s}", slate13); + if (length[30]) + fprintf(finput, ",\n uplink = {%s}", slate30); + if (length[31]) + fprintf(finput, ",\n crosslink = {%s}", slate31); + if (length[32]) + fprintf(finput, ",\n externlink = {%s}", slate32); + fprintf(finput, " }\n"); + /* indicate that the reference is saved */ + format = 0; + length[1] = 0; + length[2] = 0; + length[5] = 0; + length[6] = 0; + length[7] = 0; + length[12] = 0; + length[13] = 0; + length[14] = 0; + length[16] = 0; + length[19] = 0; + length[21] = 0; + length[22] = 0; + length[23] = 0; + length[30] = 0; + length[31] = 0; + length[32] = 0; + close_window(widget); /* remove this reference window */ +} + + +/* Save the incollection optional fields for subsequent saving */ + +void save_incoloptions(GtkWidget *widget) +{ + extern void close_window(); + extern int length[]; + extern char slate1[]; + extern char slate2[]; + extern char slate5[]; + extern char slate6[]; + extern char slate7[]; + extern char slate12[]; + extern char slate13[]; + extern char slate14[]; + extern char slate16[]; + extern char slate19[]; + extern char slate21[]; + extern char slate22[]; + extern char slate23[]; + char *text_in_field; + int count; + + strcpy(slate1, gtk_entry_get_text(GTK_ENTRY(data1))); + length[1] = strlen(slate1); + strcpy(slate5, gtk_entry_get_text(GTK_ENTRY(data5))); + length[5] = strlen(slate5); + strcpy(slate6, gtk_entry_get_text(GTK_ENTRY(data6))); + length[6] = strlen(slate6); + strcpy(slate7, gtk_entry_get_text(GTK_ENTRY(data7))); + length[7] = strlen(slate7); + strcpy(slate12, gtk_entry_get_text(GTK_ENTRY(data12))); + length[12] = strlen(slate12); + strcpy(slate14, gtk_entry_get_text(GTK_ENTRY(data14))); + length[14] = strlen(slate14); + strcpy(slate16, gtk_entry_get_text(GTK_ENTRY(data16))); + length[16] = strlen(slate16); + strcpy(slate19, gtk_entry_get_text(GTK_ENTRY(data19))); + length[19] = strlen(slate19); + strcpy(slate21, gtk_entry_get_text(GTK_ENTRY(data21))); + length[21] = strlen(slate21); + strcpy(slate23, gtk_entry_get_text(GTK_ENTRY(data23))); + length[23] = strlen(slate23); + strcpy(slate22, gtk_entry_get_text(GTK_ENTRY(data22))); + length[22] = strlen(slate22); + strcpy(slate2, gtk_entry_get_text(GTK_ENTRY(data2))); + length[2] = strlen(slate2); + count = gtk_text_buffer_get_char_count(text13); + gtk_text_buffer_get_iter_at_offset(text13, &end, count); + gtk_text_buffer_get_iter_at_offset(text13, &start, 0); + strcpy(slate13, gtk_text_buffer_get_text(text13, &start, &end, FALSE)); + length[13] = count; + + close_window(widget); +} + + + + +/* Close the option entry window, but first delete the entries */ + +void close_incoloptions(GtkWidget *widget) +{ + extern void close_window(); + extern int length[]; + + length[23] = 0; + length[22] = 0; + length[21] = 0; + length[19] = 0; + length[16] = 0; + length[14] = 0; + length[13] = 0; + length[12] = 0; + length[7] = 0; + length[6] = 0; + length[5] = 0; + length[2] = 0; + length[1] = 0; + close_window(widget); +} + + +/* The procedure to put the optional incollection style fields + * on the screen */ + +void incoloptions(GtkWidget *widget) +{ + extern int format; + GtkTooltips *tooltips; + GtkWidget *window; + GtkWidget *decoration; + GtkWidget *totalPane; + GtkWidget *field0; + GtkWidget *field1; + GtkWidget *field2; + GtkWidget *field3; + GtkWidget *field4; + GtkWidget *field5; + GtkWidget *field6; + GtkWidget *field7; + GtkWidget *field8; + GtkWidget *field9; + GtkWidget *field10; + GtkWidget *field11; + GtkWidget *field12; + GtkWidget *key0; + GtkWidget *key1; + + void close_incoloptions(); + void save_incoloptions(); + + if (format == 0) { + error (widget, GINT_TO_POINTER(6)); + return; + } + + /* create the tooltip help feature */ + + tooltips = gtk_tooltips_new(); + + window = gtk_window_new(GTK_WINDOW_TOPLEVEL); + gtk_window_set_title(GTK_WINDOW(window), "XBibFile create"); + gtk_window_position(GTK_WINDOW(window), GTK_WIN_POS_MOUSE); + gtk_widget_set_usize(GTK_WIDGET(window), 400, 760); + decoration = gtk_frame_new("Optional InCollection fields"); + gtk_container_add(GTK_CONTAINER(window), decoration); + totalPane = gtk_vbox_new(FALSE, 5); + gtk_container_add(GTK_CONTAINER(decoration), totalPane); + + /* put the text fields in place */ + field1 = gtk_hbox_new(FALSE, 0); + data7 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data7), LARGE); + label7 = gtk_label_new("Editor/s:"); + gtk_widget_set_usize(GTK_WIDGET(label7), 75, -1); + gtk_box_pack_start(GTK_BOX(field1), label7, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field1), data7, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field1, FALSE, TRUE, 10); + + field2 = gtk_hbox_new(FALSE, 0); + data23 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data23), TINY); + label23 = gtk_label_new("|| Volume:"); + gtk_widget_set_usize(GTK_WIDGET(label23), 75, -1); + gtk_box_pack_start(GTK_BOX(field2), label23, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field2), data23, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field2, FALSE, TRUE, 2); + + field3 = gtk_hbox_new(FALSE, 0); + data14 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data14), TINY); + label14 = gtk_label_new("|| Number:"); + gtk_widget_set_usize(GTK_WIDGET(label14), 75, -1); + gtk_box_pack_start(GTK_BOX(field3), label14, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field3), data14, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field3, FALSE, TRUE, 2); + + field4 = gtk_hbox_new(FALSE, 0); + data19 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data19), SMALL); + label19 = gtk_label_new("Series:"); + gtk_widget_set_usize(GTK_WIDGET(label19), 75, -1); + gtk_box_pack_start(GTK_BOX(field4), label19, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field4), data19, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field4, FALSE, TRUE, 2); + + field5 = gtk_hbox_new(FALSE, 0); + data21 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data21), TINY); + label21 = gtk_label_new("Type:"); + gtk_widget_set_usize(GTK_WIDGET(label21), 75, -1); + gtk_box_pack_start(GTK_BOX(field5), label21, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field5), data21, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field5, FALSE, TRUE, 2); + + field6 = gtk_hbox_new(FALSE, 0); + data5 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data5), TINY); + label5 = gtk_label_new("Chapter:"); + gtk_widget_set_usize(GTK_WIDGET(label5), 75, -1); + gtk_box_pack_start(GTK_BOX(field6), label5, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field6), data5, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field6, FALSE, TRUE, 2); + + field7 = gtk_hbox_new(FALSE, 0); + data16 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data16), LARGE); + label16 = gtk_label_new("Pages:"); + gtk_widget_set_usize(GTK_WIDGET(label16), 75, -1); + gtk_box_pack_start(GTK_BOX(field7), label16, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field7), data16, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field7, FALSE, TRUE, 2); + + field8 = gtk_hbox_new(FALSE, 0); + data1 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data1), LARGE); + label1 = gtk_label_new("Address:"); + gtk_widget_set_usize(GTK_WIDGET(label1), 75, -1); + gtk_box_pack_start(GTK_BOX(field8), label1, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field8), data1, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field8, FALSE, TRUE, 2); + + field9 = gtk_hbox_new(FALSE, 0); + data6 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data6), SMALL); + label6 = gtk_label_new("Edition:"); + gtk_widget_set_usize(GTK_WIDGET(label6), 75, -1); + gtk_box_pack_start(GTK_BOX(field9), label6, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field9), data6, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field9, FALSE, TRUE, 2); + + field10 = gtk_hbox_new(FALSE, 0); + data12 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data12), TINY); + label12 = gtk_label_new("Month:"); + gtk_widget_set_usize(GTK_WIDGET(label12), 75, -1); + gtk_box_pack_start(GTK_BOX(field10), label12, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field10), data12, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field10, FALSE, TRUE, 2); + + field11 = gtk_hbox_new(FALSE, 0); + data22 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data22), LARGE); + label22 = gtk_label_new("URL:"); + gtk_widget_set_usize(GTK_WIDGET(label22), 75, -1); + gtk_box_pack_start(GTK_BOX(field11), label22, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field11), data22, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field11, FALSE, TRUE, 2); + + field12 = gtk_hbox_new(FALSE, 0); + data2 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data2), LARGE); + label2 = gtk_label_new("note:"); + gtk_widget_set_usize(GTK_WIDGET(label2), 75, -1); + gtk_box_pack_start(GTK_BOX(field12), label2, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field12), data2, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field12, FALSE, TRUE, 2); + + text13 = gtk_text_buffer_new(NULL); + data13 = gtk_text_view_new_with_buffer(text13); + textscroll = gtk_scrolled_window_new(NULL, NULL); + font_desc = pango_font_description_from_string("Sans 12"); + gtk_widget_modify_font(data13, font_desc); + gtk_container_add(GTK_CONTAINER(textscroll), data13); + gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(textscroll), + GTK_POLICY_AUTOMATIC, + GTK_POLICY_AUTOMATIC); + gtk_widget_set_usize(GTK_WIDGET(data13), 30, 250); + label13 = gtk_label_new("Annotation:"); + gtk_box_pack_start(GTK_BOX(totalPane), label13, FALSE, TRUE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), textscroll, FALSE, TRUE, 2); + + /* finally, put the cancel button in place */ + field0 = gtk_hbox_new(FALSE, 0); + key0 = gtk_button_new_with_label("CANCEL"); + gtk_widget_set_usize(GTK_WIDGET(key0), 90, -1); + g_signal_connect(GTK_OBJECT(key0), "clicked", + G_CALLBACK(close_incoloptions), NULL); + gtk_tooltips_set_tip(tooltips, key0, + "Discard the contents of this window", NULL); + gtk_box_pack_end(GTK_BOX(field0), key0, FALSE, FALSE, 10); + key1 = gtk_button_new_with_label("Save"); + gtk_widget_set_usize(GTK_WIDGET(key1), 90, -1); + g_signal_connect(GTK_OBJECT(key1), "clicked", + G_CALLBACK(save_incoloptions), NULL); + gtk_tooltips_set_tip(tooltips, key1, + "Store the contents of this window", NULL); + gtk_box_pack_end(GTK_BOX(field0), key1, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field0, FALSE, TRUE, 10); + + /* put the composite window on the screen */ + gtk_widget_show_all(window); +} + + + +/* The procedure to put the basic incollection style on the screen */ + +void incol(GtkWidget *widget) +{ + GtkTooltips *tooltips; + GtkWidget *window; + GtkWidget *decoration; + GtkWidget *totalPane; + GtkWidget *opDecoration; + GtkWidget *field0; + GtkWidget *field1; + GtkWidget *option; + GtkWidget *controls; + GtkWidget *key1; + GtkWidget *key2; + GtkWidget *key3; + GtkWidget *key4; + GtkWidget *field2; + GtkWidget *field3; + GtkWidget *field4; + GtkWidget *field5; + GtkWidget *field6; + extern int format; + extern char slate0[]; + + extern void linkwindow(); + extern void closure_check(); /* defined in file cleanup.c */ + extern void close_window(); /* defined in file cleanup.c */ + void incoloptions(); + void save_incol(); + + /* create the tooltip help feature */ + + tooltips = gtk_tooltips_new(); + + format = 6; /* indicate processing of an INCOLLECTION */ + + /* create the wondow and its top panel */ + window = gtk_window_new(GTK_WINDOW_TOPLEVEL); + gtk_window_set_title(GTK_WINDOW(window), "XBibFile create"); + gtk_window_position(GTK_WINDOW(window), GTK_WIN_POS_MOUSE); + decoration = gtk_frame_new("InCollection type - required fields"); + gtk_widget_set_usize(GTK_WIDGET(window), 450, 355); + gtk_container_add(GTK_CONTAINER(window), decoration); + totalPane = gtk_vbox_new(FALSE, 5); + gtk_container_add(GTK_CONTAINER(decoration), totalPane); + + field1 = gtk_hbox_new(FALSE,0); + dataX = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(dataX), SMALL); + gtk_widget_set_usize(GTK_WIDGET(dataX), 345, -1); + labelX = gtk_label_new("Tag/s:"); + gtk_widget_set_usize(GTK_WIDGET(labelX), 65, -1); + gtk_box_pack_start(GTK_BOX(field1), labelX, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field1), dataX, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field1, FALSE, TRUE, 10); + + field0 = gtk_hbox_new(FALSE, 0); + data0 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data0), LARGE); + gtk_widget_set_usize(GTK_WIDGET(data0), 345, -1); + label0 = gtk_label_new("File used:"); + gtk_widget_set_usize(GTK_WIDGET(label0), 65, -1); + gtk_entry_set_text(GTK_ENTRY(data0), slate0); + gtk_box_pack_start(GTK_BOX(field0), label0, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field0), data0, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field0, FALSE, TRUE, 2); + + /* position the remaining field entries */ + field2 = gtk_hbox_new(FALSE, 0); + data3 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data3), LARGE); + gtk_widget_set_usize(GTK_WIDGET(data3), 345, -1); + label3 = gtk_label_new("Authors/s:"); + gtk_widget_set_usize(GTK_WIDGET(label3), 65, -1); + gtk_box_pack_start(GTK_BOX(field2), label3, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field2), data3, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field2, FALSE, TRUE, 2); + + field3 = gtk_hbox_new(FALSE, 0); + data20 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data20), LARGE); + gtk_widget_set_usize(GTK_WIDGET(data20), 345, -1); + label20 = gtk_label_new("Title:"); + gtk_widget_set_usize(GTK_WIDGET(label20), 65, -1); + gtk_box_pack_start(GTK_BOX(field3), label20, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field3), data20, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field3, FALSE, TRUE, 2); + + field4 = gtk_hbox_new(FALSE, 0); + data4 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data4), LARGE); + gtk_widget_set_usize(GTK_WIDGET(data4), 345, -1); + label4 = gtk_label_new("BookTitle:"); + gtk_widget_set_usize(GTK_WIDGET(label4), 65, -1); + gtk_box_pack_start(GTK_BOX(field4), label4, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field4), data4, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field4, FALSE, TRUE, 2); + + field5 = gtk_hbox_new(FALSE, 0); + data17 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data17), LARGE); + gtk_widget_set_usize(GTK_WIDGET(data4), 345, -1); + label17 = gtk_label_new("Publisher:"); + gtk_widget_set_usize(GTK_WIDGET(label17), 65, -1); + gtk_box_pack_start(GTK_BOX(field5), label17, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field5), data17, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field5, FALSE, TRUE, 2); + + field6 = gtk_hbox_new(FALSE, 0); + data24 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data24), TINY); + gtk_widget_set_usize(GTK_WIDGET(data24), 200, -1); + label24 = gtk_label_new("Year:"); + gtk_widget_set_usize(GTK_WIDGET(label24), 65, -1); + gtk_box_pack_start(GTK_BOX(field6), label24, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field6), data24, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field6, FALSE, TRUE, 2); + + /* put the control keys on to the window */ + option = gtk_hbox_new(FALSE, 0); + key2 = gtk_button_new_with_label("Optional fields"); + gtk_widget_set_usize(GTK_WIDGET(key2), 130, -1); + g_signal_connect(GTK_OBJECT(key2), "clicked", + G_CALLBACK(incoloptions), NULL); + gtk_tooltips_set_tip(tooltips, key2, + "Click here to get window containing remaining Incollection fields", + NULL); + gtk_box_pack_start(GTK_BOX(option), key2, FALSE, FALSE, 10); + controls = gtk_hbox_new(FALSE, 0); + key1 = gtk_button_new_with_label("Save"); + gtk_widget_set_usize(GTK_WIDGET(key1), 90, -1); + g_signal_connect(GTK_OBJECT(key1), "clicked", + G_CALLBACK(save_incol), NULL); + gtk_tooltips_set_tip(tooltips, key1, + "Store this Incollection reference in database", NULL); + gtk_box_pack_start(GTK_BOX(controls), key1, FALSE, FALSE, 30); + key3 = gtk_button_new_with_label("Cancel"); + gtk_widget_set_usize(GTK_WIDGET(key3), 90, -1); + g_signal_connect(GTK_OBJECT(key3), "clicked", + G_CALLBACK(closure_check), NULL); + gtk_tooltips_set_tip(tooltips, key3, + "Discard this Incollection entry", NULL); + gtk_box_pack_start(GTK_BOX(controls), key3, FALSE, FALSE, 30); + key4 = gtk_button_new_with_label("Linking"); + gtk_widget_set_usize(GTK_WIDGET(key4), 90, -1); + g_signal_connect(GTK_OBJECT(key4), "clicked", + G_CALLBACK(linkwindow), NULL); + gtk_tooltips_set_tip(tooltips, key4, + "Click here for window to create links for this Incollection", + NULL); + gtk_box_pack_start(GTK_BOX(controls), key4, FALSE, FALSE, 30); + gtk_box_pack_start(GTK_BOX(totalPane), option, FALSE, TRUE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), controls, FALSE, TRUE, 10); + + + format = 6; + + /* make the composite visible on screen */ + gtk_widget_show_all(window); +} diff --git a/biblio/bibtex/utils/xbibfile/inproc.c b/biblio/bibtex/utils/xbibfile/inproc.c new file mode 100644 index 0000000000..814ea35f1a --- /dev/null +++ b/biblio/bibtex/utils/xbibfile/inproc.c @@ -0,0 +1,571 @@ +/* This file is a part of XBibFile - a system for handling BibTeX references + * + * Author: Ross Maloney + * Date: October 1999 + * Modified: January 2002 + * + */ + +#include <stdio.h> +#include <gtk/gtk.h> + +#include "xbibfile.h" + +/* This file is a modified copy of article.c so that it handles the + * inproceedings BibTeX reference style */ + + +GtkWidget *labelX, *dataX; +GtkWidget *label0, *data0; +GtkWidget *label1, *data1; +GtkWidget *label2, *data2; +GtkWidget *label3, *data3; +GtkWidget *label4, *data4; +GtkWidget *label7, *data7; +GtkWidget *label12, *data12; +GtkWidget *label13, *data13, *textscroll; +GtkWidget *label14, *data14; +GtkWidget *label15, *data15; +GtkWidget *label16, *data16; +GtkWidget *label17, *data17; +GtkWidget *label19, *data19; +GtkWidget *label20, *data20; +GtkWidget *label22, *data22; +GtkWidget *label23, *data23; +GtkWidget *label24, *data24; +GtkWidget *label30, *data30; +GtkWidget *label31, *data31; +GtkWidget *label32, *data32; +GtkTextBuffer *text13; +GtkTextIter start, end; +PangoFontDescription *font_desc; + + + + +/* The procedure to save the inproceedings style */ + +void save_inproc(GtkWidget *widget) +{ + extern int format; + extern int length[]; + extern char slate[][]; + extern int lengthX; + extern char slateX[]; + extern char slate1[]; + extern char slate2[]; + extern char slate3[]; + extern char slate4[]; + extern char slate7[]; + extern char slate12[]; + extern char slate13[]; + extern char slate14[]; + extern char slate15[]; + extern char slate16[]; + extern char slate17[]; + extern char slate19[]; + extern char slate20[]; + extern char slate22[]; + extern char slate23[]; + extern char slate24[]; + extern char slate30[]; + extern char slate31[]; + extern char slate32[]; + extern void error(); /* defined in file error.c */ + extern FILE *finput; /* defined in file xbibfile.c */ + extern void close_window(); /* defined in file cleanup.c */ + + if (format != 7) { + error(widget, GINT_TO_POINTER(5)); + return; + } + strcpy(slateX, gtk_entry_get_text(GTK_ENTRY(dataX))); + lengthX = strlen(slateX); + strcpy(slate3, gtk_entry_get_text(GTK_ENTRY(data3))); + length[3] = strlen(slate3); + strcpy(slate4, gtk_entry_get_text(GTK_ENTRY(data4))); + length[4] = strlen(slate4); + strcpy(slate20, gtk_entry_get_text(GTK_ENTRY(data20))); + length[20] = strlen(slate20); + strcpy(slate24, gtk_entry_get_text(GTK_ENTRY(data24))); + length[24] = strlen(slate24); + if (!(length[3] && length[4] && length[20] && length[24] && lengthX)) { + error(widget, GINT_TO_POINTER(3)); + return; + } + if (!finput) { + error(widget, GINT_TO_POINTER(8)); + return; + } + /* finput = stdout; */ + fprintf(finput, "\n@INPROCEEDINGS{%s,\n", slateX); + fprintf(finput, " author = {%s},\n", slate3); + fprintf(finput, " title = {%s},\n", slate20); + fprintf(finput, " booktitle = {%s},\n", slate4); + fprintf(finput, " year = {%s}", slate24); + if (length[7]) + fprintf(finput, ",\n editor = {%s}", slate7); + if (length[23]) + fprintf(finput, ",\n volume = {%s}", slate23); + if (length[14]) + fprintf(finput, ",\n number = {%s}", slate14); + if (length[19]) + fprintf(finput, ",\n series = {%s}", slate19); + if (length[16]) + fprintf(finput, ",\n pages = {%s}", slate16); + if (length[1]) + fprintf(finput, ",\n address = {%s}", slate1); + if (length[12]) + fprintf(finput, ",\n month = {%s}", slate12); + if (length[15]) + fprintf(finput, ",\n organization = {%s}", slate15); + if (length[17]) + fprintf(finput, ",\n publisher = {%s}", slate17); + if (length[22]) + fprintf(finput, ",\n URL = {%s}", slate22); + if (length[2]) + fprintf(finput, ",\n note = {%s}", slate2); + if (length[13]) + fprintf(finput, ",\n annote = {%s}", slate13); + if (length[30]) + fprintf(finput, ",\n uplink = {%s}", slate30); + if (length[31]) + fprintf(finput, ",\n crosslink = {%s}", slate31); + if (length[32]) + fprintf(finput, ",\n externlink = {%s}", slate32); + fprintf(finput, " }\n"); + /* indicate that the reference is saved */ + format = 0; + length[1] = 0; + length[2] = 0; + length[7] = 0; + length[12] = 0; + length[13] = 0; + length[14] = 0; + length[15] = 0; + length[16] = 0; + length[17] = 0; + length[19] = 0; + length[22] = 0; + length[23] = 0; + length[30] = 0; + length[31] = 0; + length[32] = 0; + close_window(widget); /* remove this reference window */ +} + + +/* Save the inproceedings optional fields for subsequent saving */ + +void save_inprocoptions(GtkWidget *widget) +{ + extern void close_window(); + extern int length[]; + extern char slate1[]; + extern char slate2[]; + extern char slate7[]; + extern char slate12[]; + extern char slate13[]; + extern char slate14[]; + extern char slate15[]; + extern char slate16[]; + extern char slate17[]; + extern char slate19[]; + extern char slate22[]; + extern char slate23[]; + char *text_in_field; + int count; + + strcpy(slate1, gtk_entry_get_text(GTK_ENTRY(data1))); + length[1] = strlen(slate1); + strcpy(slate7, gtk_entry_get_text(GTK_ENTRY(data7))); + length[7] = strlen(slate7); + strcpy(slate12, gtk_entry_get_text(GTK_ENTRY(data12))); + length[12] = strlen(slate12); + strcpy(slate14, gtk_entry_get_text(GTK_ENTRY(data14))); + length[14] = strlen(slate14); + strcpy(slate15, gtk_entry_get_text(GTK_ENTRY(data15))); + length[15] = strlen(slate15); + strcpy(slate16, gtk_entry_get_text(GTK_ENTRY(data16))); + length[16] = strlen(slate16); + strcpy(slate17, gtk_entry_get_text(GTK_ENTRY(data17))); + length[17] = strlen(slate17); + strcpy(slate19, gtk_entry_get_text(GTK_ENTRY(data19))); + length[19] = strlen(slate19); + strcpy(slate23, gtk_entry_get_text(GTK_ENTRY(data23))); + length[23] = strlen(slate23); + strcpy(slate22, gtk_entry_get_text(GTK_ENTRY(data22))); + length[22] = strlen(slate22); + strcpy(slate2, gtk_entry_get_text(GTK_ENTRY(data2))); + length[2] = strlen(slate2); + count = gtk_text_buffer_get_char_count(text13); + gtk_text_buffer_get_iter_at_offset(text13, &end, count); + gtk_text_buffer_get_iter_at_offset(text13, &start, 0); + strcpy(slate13, gtk_text_buffer_get_text(text13, &start, &end, FALSE)); + length[13] = count; + + close_window(widget); +} + + + + +/* Close the option entry window, but first delete the entries */ + +void close_inprocoptions(GtkWidget *widget) +{ + extern void close_window(); + extern int length[]; + + length[23] = 0; + length[22] = 0; + length[19] = 0; + length[17] = 0; + length[16] = 0; + length[15] = 0; + length[14] = 0; + length[13] = 0; + length[12] = 0; + length[7] = 0; + length[2] = 0; + length[1] = 0; + close_window(widget); +} + + +/* The procedure to put the optional inproceedings style fields + * on the screen */ + +void inprocoptions(GtkWidget *widget) +{ + extern int format; + GtkTooltips *tooltips; + GtkWidget *window; + GtkWidget *decoration; + GtkWidget *totalPane; + GtkWidget *field0; + GtkWidget *field1; + GtkWidget *field2; + GtkWidget *field3; + GtkWidget *field4; + GtkWidget *field5; + GtkWidget *field6; + GtkWidget *field7; + GtkWidget *field8; + GtkWidget *field9; + GtkWidget *field10; + GtkWidget *field11; + GtkWidget *key0; + GtkWidget *key1; + + void close_inprocoptions(); + void save_inprocoptions(); + + if (format == 0) { + error (widget, GINT_TO_POINTER(6)); + return; + } + + /* create the tooltip help feature */ + + tooltips = gtk_tooltips_new(); + + window = gtk_window_new(GTK_WINDOW_TOPLEVEL); + gtk_window_set_title(GTK_WINDOW(window), "XBibFile create"); + gtk_window_position(GTK_WINDOW(window), GTK_WIN_POS_MOUSE); + gtk_widget_set_usize(GTK_WIDGET(window), 400, 730); + decoration = gtk_frame_new("Optional InProceedings fields"); + gtk_container_add(GTK_CONTAINER(window), decoration); + totalPane = gtk_vbox_new(FALSE, 5); + gtk_container_add(GTK_CONTAINER(decoration), totalPane); + + /* put the text fields in place */ + field1 = gtk_hbox_new(FALSE, 0); + data7 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data7), LARGE); + label7 = gtk_label_new("Editor/s:"); + gtk_widget_set_usize(GTK_WIDGET(label7), 75, -1); + gtk_box_pack_start(GTK_BOX(field1), label7, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field1), data7, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field1, FALSE, TRUE, 10); + + field2 = gtk_hbox_new(FALSE, 0); + data23 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data23), TINY); + label23 = gtk_label_new("|| Volume:"); + gtk_widget_set_usize(GTK_WIDGET(label23), 75, -1); + gtk_box_pack_start(GTK_BOX(field2), label23, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field2), data23, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field2, FALSE, TRUE, 2); + + field3 = gtk_hbox_new(FALSE, 0); + data14 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data14), TINY); + label14 = gtk_label_new("|| Number:"); + gtk_widget_set_usize(GTK_WIDGET(label14), 75, -1); + gtk_box_pack_start(GTK_BOX(field3), label14, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field3), data14, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field3, FALSE, TRUE, 2); + + field4 = gtk_hbox_new(FALSE, 0); + data19 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data19), SMALL); + label19 = gtk_label_new("Series:"); + gtk_widget_set_usize(GTK_WIDGET(label19), 75, -1); + gtk_box_pack_start(GTK_BOX(field4), label19, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field4), data19, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field4, FALSE, TRUE, 2); + + field5 = gtk_hbox_new(FALSE, 0); + data16 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data16), LARGE); + label16 = gtk_label_new("Pages:"); + gtk_widget_set_usize(GTK_WIDGET(label16), 75, -1); + gtk_box_pack_start(GTK_BOX(field5), label16, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field5), data16, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field5, FALSE, TRUE, 2); + + field6 = gtk_hbox_new(FALSE, 0); + data1 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data1), LARGE); + label1 = gtk_label_new("Address:"); + gtk_widget_set_usize(GTK_WIDGET(label1), 75, -1); + gtk_box_pack_start(GTK_BOX(field6), label1, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field6), data1, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field6, FALSE, TRUE, 2); + + field7 = gtk_hbox_new(FALSE, 0); + data12 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data12), TINY); + label12 = gtk_label_new("Month:"); + gtk_widget_set_usize(GTK_WIDGET(label12), 75, -1); + gtk_box_pack_start(GTK_BOX(field7), label12, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field7), data12, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field7, FALSE, TRUE, 2); + + field8 = gtk_hbox_new(FALSE, 0); + data15 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data15), LARGE); + label15 = gtk_label_new("Organization:"); + gtk_widget_set_usize(GTK_WIDGET(label15), 75, -1); + gtk_box_pack_start(GTK_BOX(field8), label15, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field8), data15, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field8, FALSE, TRUE, 2); + + field9 = gtk_hbox_new(FALSE, 0); + data17 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data17), LARGE); + label17 = gtk_label_new("Publisher:"); + gtk_widget_set_usize(GTK_WIDGET(label17), 75, -1); + gtk_box_pack_start(GTK_BOX(field9), label17, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field9), data17, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field9, FALSE, TRUE, 2); + + field10 = gtk_hbox_new(FALSE, 0); + data22 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data22), LARGE); + label22 = gtk_label_new("URL:"); + gtk_widget_set_usize(GTK_WIDGET(label22), 75, -1); + gtk_box_pack_start(GTK_BOX(field10), label22, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field10), data22, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field10, FALSE, TRUE, 2); + + field11 = gtk_hbox_new(FALSE, 0); + data2 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data2), LARGE); + label2 = gtk_label_new("note:"); + gtk_widget_set_usize(GTK_WIDGET(label2), 75, -1); + gtk_box_pack_start(GTK_BOX(field11), label2, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field11), data2, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field11, FALSE, TRUE, 2); + + text13 = gtk_text_buffer_new(NULL); + data13 = gtk_text_view_new_with_buffer(text13); + textscroll = gtk_scrolled_window_new(NULL, NULL); + font_desc = pango_font_description_from_string("Sans 12"); + gtk_widget_modify_font(data13, font_desc); + gtk_container_add(GTK_CONTAINER(textscroll), data13); + gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(textscroll), + GTK_POLICY_AUTOMATIC, + GTK_POLICY_AUTOMATIC); + gtk_widget_set_usize(GTK_WIDGET(data13), 30, 250); + label13 = gtk_label_new("Annotation:"); + gtk_box_pack_start(GTK_BOX(totalPane), label13, FALSE, TRUE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), textscroll, FALSE, TRUE, 2); + + /* finally, put the cancel button in place */ + field0 = gtk_hbox_new(FALSE, 0); + key0 = gtk_button_new_with_label("CANCEL"); + gtk_widget_set_usize(GTK_WIDGET(key0), 90, -1); + g_signal_connect(GTK_OBJECT(key0), "clicked", + G_CALLBACK(close_inprocoptions), NULL); + gtk_tooltips_set_tip(tooltips, key0, + "Discard the contents of this window", NULL); + gtk_box_pack_end(GTK_BOX(field0), key0, FALSE, FALSE, 10); + key1 = gtk_button_new_with_label("Save"); + gtk_widget_set_usize(GTK_WIDGET(key1), 90, -1); + g_signal_connect(GTK_OBJECT(key1), "clicked", + G_CALLBACK(save_inprocoptions), NULL); + gtk_tooltips_set_tip(tooltips, key1, + "Store the contents of this window", NULL); + gtk_box_pack_end(GTK_BOX(field0), key1, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field0, FALSE, TRUE, 10); + + /* put the composite window on the screen */ + gtk_widget_show_all(window); +} + + + +/* The procedure to put the basic inproceedings style on the screen */ + +void inproc(GtkWidget *widget) +{ + GtkTooltips *tooltips; + GtkWidget *window; + GtkWidget *decoration; + GtkWidget *totalPane; + GtkWidget *opDecoration; + GtkWidget *field0; + GtkWidget *field1; + GtkWidget *option; + GtkWidget *controls; + GtkWidget *key1; + GtkWidget *key2; + GtkWidget *key3; + GtkWidget *key4; + GtkWidget *field2; + GtkWidget *field3; + GtkWidget *field4; + GtkWidget *field5; + extern int format; + extern char slate0[]; + + extern void linkwindow(); + extern void closure_check(); /* defined in file cleanup.c */ + extern void close_window(); /* defined in file cleanup.c */ + void inprocoptions(); + void save_inproc(); + + /* create the tooltip help feature */ + + tooltips = gtk_tooltips_new(); + + format = 7; /* indicate processing of an INPROCEEDINGS */ + + /* create the wondow and its top panel */ + window = gtk_window_new(GTK_WINDOW_TOPLEVEL); + gtk_window_set_title(GTK_WINDOW(window), "XBibFile create"); + gtk_window_position(GTK_WINDOW(window), GTK_WIN_POS_MOUSE); + decoration = gtk_frame_new("InProceedings type - required fields"); + gtk_widget_set_usize(GTK_WIDGET(window), 450, 320); + gtk_container_add(GTK_CONTAINER(window), decoration); + totalPane = gtk_vbox_new(FALSE, 5); + gtk_container_add(GTK_CONTAINER(decoration), totalPane); + + field1 = gtk_hbox_new(FALSE,0); + dataX = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(dataX), SMALL); + gtk_widget_set_usize(GTK_WIDGET(dataX), 345, -1); + labelX = gtk_label_new("Tag/s:"); + gtk_widget_set_usize(GTK_WIDGET(labelX), 65, -1); + gtk_box_pack_start(GTK_BOX(field1), labelX, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field1), dataX, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field1, FALSE, TRUE, 10); + + field0 = gtk_hbox_new(FALSE, 0); + data0 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data0), LARGE); + gtk_widget_set_usize(GTK_WIDGET(data0), 345, -1); + label0 = gtk_label_new("File used:"); + gtk_widget_set_usize(GTK_WIDGET(label0), 65, -1); + gtk_entry_set_text(GTK_ENTRY(data0), slate0); + gtk_box_pack_start(GTK_BOX(field0), label0, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field0), data0, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field0, FALSE, TRUE, 2); + + /* position the remaining field entries */ + field2 = gtk_hbox_new(FALSE, 0); + data3 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data3), LARGE); + gtk_widget_set_usize(GTK_WIDGET(data3), 345, -1); + label3 = gtk_label_new("Authors/s:"); + gtk_widget_set_usize(GTK_WIDGET(label3), 65, -1); + gtk_box_pack_start(GTK_BOX(field2), label3, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field2), data3, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field2, FALSE, TRUE, 2); + + field3 = gtk_hbox_new(FALSE, 0); + data20 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data20), LARGE); + gtk_widget_set_usize(GTK_WIDGET(data20), 345, -1); + label20 = gtk_label_new("Title:"); + gtk_widget_set_usize(GTK_WIDGET(label20), 65, -1); + gtk_box_pack_start(GTK_BOX(field3), label20, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field3), data20, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field3, FALSE, TRUE, 2); + + field4 = gtk_hbox_new(FALSE, 0); + data4 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data4), LARGE); + gtk_widget_set_usize(GTK_WIDGET(data4), 345, -1); + label4 = gtk_label_new("BookTitle:"); + gtk_widget_set_usize(GTK_WIDGET(label4), 65, -1); + gtk_box_pack_start(GTK_BOX(field4), label4, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field4), data4, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field4, FALSE, TRUE, 2); + + field5 = gtk_hbox_new(FALSE, 0); + data24 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data24), TINY); + gtk_widget_set_usize(GTK_WIDGET(data24), 200, -1); + label24 = gtk_label_new("Year:"); + gtk_widget_set_usize(GTK_WIDGET(label24), 65, -1); + gtk_box_pack_start(GTK_BOX(field5), label24, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field5), data24, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field5, FALSE, TRUE, 2); + + /* put the control keys on to the window */ + option = gtk_hbox_new(FALSE, 0); + key2 = gtk_button_new_with_label("Optional fields"); + gtk_widget_set_usize(GTK_WIDGET(key2), 130, -1); + g_signal_connect(GTK_OBJECT(key2), "clicked", + G_CALLBACK(inprocoptions), NULL); + gtk_tooltips_set_tip(tooltips, key2, + "Click here to get window containing remaining Inproceedings fields", + NULL); + gtk_box_pack_start(GTK_BOX(option), key2, FALSE, FALSE, 10); + controls = gtk_hbox_new(FALSE, 0); + key1 = gtk_button_new_with_label("Save"); + gtk_widget_set_usize(GTK_WIDGET(key1), 90, -1); + g_signal_connect(GTK_OBJECT(key1), "clicked", + G_CALLBACK(save_inproc), NULL); + gtk_tooltips_set_tip(tooltips, key1, + "Store this Inproceedings reference in database", NULL); + gtk_box_pack_start(GTK_BOX(controls), key1, FALSE, FALSE, 30); + key3 = gtk_button_new_with_label("Cancel"); + gtk_widget_set_usize(GTK_WIDGET(key3), 90, -1); + g_signal_connect(GTK_OBJECT(key3), "clicked", + G_CALLBACK(closure_check), NULL); + gtk_tooltips_set_tip(tooltips, key3, + "Discard this Inproceedings entry", NULL); + gtk_box_pack_start(GTK_BOX(controls), key3, FALSE, FALSE, 30); + key4 = gtk_button_new_with_label("Linking"); + gtk_widget_set_usize(GTK_WIDGET(key4), 90, -1); + g_signal_connect(GTK_OBJECT(key4), "clicked", + G_CALLBACK(linkwindow), NULL); + gtk_tooltips_set_tip(tooltips, key4, + "Click here for window to create links for this Inproceedings", + NULL); + gtk_box_pack_start(GTK_BOX(controls), key4, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), option, FALSE, TRUE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), controls, FALSE, TRUE, 10); + + + format = 7; + + /* make the composite visible on screen */ + gtk_widget_show_all(window); +} + + diff --git a/biblio/bibtex/utils/xbibfile/linking.c b/biblio/bibtex/utils/xbibfile/linking.c new file mode 100644 index 0000000000..35064b23a6 --- /dev/null +++ b/biblio/bibtex/utils/xbibfile/linking.c @@ -0,0 +1,140 @@ +/* This file is a part of XBibFile - a system for handling BibTeX references + * + * Author: Ross Maloney + * Date: October 1999 + * + */ + +#include <gtk/gtk.h> + +#include "xbibfile.h" + + + +/* input text fields and labels used BibTeX format windows handled in + * this file */ + +GtkWidget *label30, *data30; +GtkWidget *label31, *data31; +GtkWidget *label32, *data32; + +/* Procedure to cancel the linking window and remove links */ + +void cancel_linking(GtkWidget *widget) +{ + extern int length[]; + extern close_window(); + + length[30] = 0; + length[31] = 0; + length[32] = 0; + close_window(widget); +} + + + +/* Procedure to take data from the linking window */ + +void save_linking(GtkWidget *widget) +{ + extern void close_window(); /* defined in file cleanup.c */ + extern int length[]; + extern char slate30[]; + extern char slate31[]; + extern char slate32[]; + + strcpy(slate30, gtk_entry_get_text(GTK_ENTRY(data30))); + length[30] = strlen(slate30); + strcpy(slate31, gtk_entry_get_text(GTK_ENTRY(data31))); + length[31] = strlen(slate31); + strcpy(slate32, gtk_entry_get_text(GTK_ENTRY(data32))); + length[32] = strlen(slate32); + close_window(widget); +} + + +/* Procedure to put window on screen for the common linking process */ + +void linkwindow(widget) +{ + GtkTooltips *tooltips; + GtkWidget *window; + GtkWidget *decoration; + GtkWidget *totalPane; + GtkWidget *field0; + GtkWidget *key0; + GtkWidget *key1; + GtkWidget *field1; + GtkWidget *field2; + GtkWidget *field3; + extern int format; + + if (format == 0) { + error (widget, GINT_TO_POINTER(6)); + return; + } + + /* create the tooltip help feature */ + + tooltips = gtk_tooltips_new(); + + window = gtk_window_new(GTK_WINDOW_TOPLEVEL); + gtk_window_set_title(GTK_WINDOW(window), "XBibFile create"); + gtk_window_position(GTK_WINDOW(window), GTK_WIN_POS_MOUSE); + gtk_widget_set_usize(GTK_WIDGET(window), 400, 170); + decoration = gtk_frame_new("Linking Labels"); + gtk_container_add(GTK_CONTAINER(window), decoration); + totalPane = gtk_vbox_new(FALSE, 5); + gtk_container_add(GTK_CONTAINER(decoration), totalPane); + + field1 = gtk_hbox_new(FALSE, 0); + label30 = gtk_label_new("Up link:"); + gtk_widget_set_usize(GTK_WIDGET(label30), 60, -1); + gtk_box_pack_start(GTK_BOX(field1), label30, FALSE, FALSE, 10); + data30 = gtk_entry_new_with_max_length(LARGE); + gtk_widget_set_usize(GTK_WIDGET(data30), 300, -1); + gtk_box_pack_start(GTK_BOX(field1), data30, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field1, FALSE, TRUE, 10); + + field2 = gtk_hbox_new(FALSE, 0); + label31 = gtk_label_new("Cross link:"); + gtk_widget_set_usize(GTK_WIDGET(label31), 60, -1); + gtk_box_pack_start(GTK_BOX(field2), label31, FALSE, FALSE, 10); + data31 = gtk_entry_new_with_max_length(LARGE); + gtk_widget_set_usize(GTK_WIDGET(data31), 300, -1); + gtk_box_pack_start(GTK_BOX(field2), data31, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field2, FALSE, TRUE, 0); + + field3 = gtk_hbox_new(FALSE, 0); + label32 = gtk_label_new("Externals:"); + gtk_widget_set_usize(GTK_WIDGET(label32), 60, -1); + gtk_box_pack_start(GTK_BOX(field3), label32, FALSE, FALSE, 10); + data32 = gtk_entry_new_with_max_length(LARGE); + gtk_widget_set_usize(GTK_WIDGET(data32), 300, -1); + gtk_box_pack_start(GTK_BOX(field3), data32, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field3, FALSE, TRUE, 10); + + /* finally, put the cancel and save buttons + * in the window */ + field0 = gtk_hbox_new(FALSE, 0); + key0 = gtk_button_new_with_label("CANCEL"); + gtk_widget_set_usize(GTK_WIDGET(key0), 90, -1); + g_signal_connect(GTK_OBJECT(key0), "clicked", + G_CALLBACK(cancel_linking), NULL); + gtk_tooltips_set_tip(tooltips, key0, + "Discard the contents of this window", NULL); + gtk_box_pack_end(GTK_BOX(field0), key0, FALSE, FALSE, 10); + key1 = gtk_button_new_with_label("Save"); + gtk_widget_set_usize(GTK_WIDGET(key1), 90, -1); + g_signal_connect(GTK_OBJECT(key1), "clicked", + G_CALLBACK(save_linking), NULL); + gtk_tooltips_set_tip(tooltips, key1, + "Store the contents of this window", NULL); + gtk_box_pack_end(GTK_BOX(field0), key1, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field0, FALSE, TRUE, 0); + + /* make the composite window visible on the screen */ + gtk_widget_show_all(window); +} + + diff --git a/biblio/bibtex/utils/xbibfile/listall.c b/biblio/bibtex/utils/xbibfile/listall.c new file mode 100644 index 0000000000..2820a69ad6 --- /dev/null +++ b/biblio/bibtex/utils/xbibfile/listall.c @@ -0,0 +1,177 @@ +/* This file is a part of XBibFile - a system for handling BibTeX references + * + * Author: Ross Maloney + * Date: January 2002 + * + */ + +#include <stdio.h> +#include <string.h> +#include <gtk/gtk.h> + +GtkWidget *summary; +GtkWidget *text, *textblock, *scrollblock; +GtkTextBuffer *textpad; +GtkTextIter iter; + +extern FILE *refFile; /* defined in xbibfile.c */ + +void all(GtkWidget *widget) +{ + GtkTooltips *tooltips; + GtkWidget *window, *panel, *description, *controls; + GtkWidget *key0, *key1; + + extern void close_window(GtkWidget *); /* defined in file cleanup.c */ + extern void error(); /* defined in file error.c */ + void put_refs_inplace(GtkWidget *); + + tooltips = gtk_tooltips_new(); + + window = gtk_window_new(GTK_WINDOW_TOPLEVEL); + gtk_window_set_title(GTK_WINDOW(window), "XBibFile inspect"); + gtk_window_position(GTK_WINDOW(window), GTK_WIN_POS_MOUSE); + gtk_window_set_default_size(GTK_WINDOW(window), 500, 500); + panel = gtk_vbox_new(FALSE, 0); + gtk_container_add(GTK_CONTAINER(window), panel); + description = gtk_label_new("References found in the database"); + gtk_box_pack_start(GTK_BOX(panel), description, FALSE, TRUE, 10); + + /* create the text display part of the window */ + textblock = gtk_scrolled_window_new(NULL, NULL); + textpad = gtk_text_buffer_new(NULL); + text = gtk_text_view_new_with_buffer(textpad); + gtk_container_add(GTK_CONTAINER(textblock), text); + gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(textblock), + GTK_POLICY_AUTOMATIC, + GTK_POLICY_AUTOMATIC); + gtk_box_pack_start_defaults(GTK_BOX(panel), textblock); + + /* put the window control buttons in place */ + controls = gtk_hbox_new(FALSE, 0); + key0 = gtk_button_new_with_label("CANCEL"); + gtk_widget_set_usize(GTK_WIDGET(key0), 90, -1); + g_signal_connect(GTK_OBJECT(key0), "clicked", + G_CALLBACK(close_window), NULL); + gtk_tooltips_set_tip(tooltips, key0, + "Finish this reference probe", NULL); + gtk_box_pack_end(GTK_BOX(controls), key0, FALSE, FALSE, 10); + + /* and put the summary line in place */ + summary = gtk_entry_new(); + gtk_editable_set_editable(GTK_EDITABLE(summary), FALSE); + gtk_widget_set_usize(GTK_WIDGET(summary), 150, 20); + gtk_box_pack_start(GTK_BOX(controls), summary, FALSE, FALSE, 10); + gtk_box_pack_end(GTK_BOX(panel), controls, FALSE, TRUE, 10); + + /* now put the 'style' for the text output */ + gtk_text_buffer_create_tag(textpad, "blackface", + "foreground", "black", NULL); + gtk_text_buffer_create_tag(textpad, "emphasis", + "foreground", "red", NULL); + gtk_text_buffer_create_tag(textpad, "point", + "size", 11 * PANGO_SCALE, NULL); + gtk_text_buffer_create_tag(textpad, "font", + "style", PANGO_STYLE_NORMAL, NULL); + + /* put the required text into the window */ + put_refs_inplace(widget); + + /* put the composite window on the screen */ + gtk_widget_show_all(window); +} + +/* This procedure performs the required searching and returns its results + * in the text window create in the all() procedure + */ + +void put_refs_inplace(GtkWidget *widget) +{ + int i, count; + char *start, *end; + char holder[200], temp[100], report[30]; + + rewind(refFile); + gtk_text_buffer_get_iter_at_offset(textpad, &iter, 0); + i = 0; + count = 0; + while ( ( holder[i] = getc(refFile) ) != EOF ) { + if ( holder[i] == '\n' ) { + if ( holder[0] == '@' ) { + if ( strstr( holder, "ARTICLE") ) + strcpy(temp, "Article "); + if ( strstr( holder, "BOOK") ) + strcpy(temp, "Book "); + if ( strstr( holder, "BOOKLET") ) + strcpy(temp, "Booklet "); + if ( strstr( holder, "CONFERENCE") ) + strcpy(temp, "Conference "); + if ( strstr( holder, "INBOOK") ) + strcpy(temp, "inBook "); + if ( strstr( holder, "INCOLLECTION") ) + strcpy(temp, "Incollection "); + if ( strstr( holder, "INPROCEEDINGS") ) + strcpy(temp, "inProceedings "); + if ( strstr( holder, "MANUAL") ) + strcpy(temp, "Manual "); + if ( strstr( holder, "MASTERSTHESIS") ) + strcpy(temp, "Masters "); + if ( strstr( holder, "MISC") ) + strcpy(temp, "Misc "); + if ( strstr( holder, "PHDTHESIS") ) + strcpy(temp, "PhD Thesis "); + if ( strstr( holder, "PROCEEDINGS") ) + strcpy(temp, "Proceedngs "); + if ( strstr( holder, "TECHREPORT") ) + strcpy(temp, "Tech Report "); + if ( strstr( holder, "UNPUBLISHED") ) + strcpy(temp, "Unpublished "); + gtk_text_buffer_insert_with_tags_by_name(textpad, &iter, + temp, -1, + "blackface", "point", "font", NULL); + if ( start = strstr( holder, "{" ) ) + if ( end = strstr( holder, "," ) ) { + *end = ' '; + end++; + *end = ' '; + end++; + *end = '\0'; + gtk_text_buffer_insert_with_tags_by_name(textpad, &iter, + start+1, -1, + "emphasis", "point", "font", NULL); + } + else { + error(widget, GINT_TO_POINTER(9)); + g_print("Format error in this BibTeX file - no ending ,"); + } + else { + error(widget, GINT_TO_POINTER(9)); + g_print("Format error in this BibTeX file - no {"); + } + count++; + } + i = 0; + if ( start = strstr( holder, " title = {" ) ) + if ( end = strstr( holder, "}," ) ) { + if ( (end - start) > 60 ) + end = start + 60; + *end = '\n'; + end++; + *end = '\0'; + start += 10; + *start = ' '; + gtk_text_buffer_insert_with_tags_by_name(textpad, &iter, + start, -1, + "blackface", "point", "font", NULL); + } + else { + error(widget, GINT_TO_POINTER(9)); + g_print("Format error in this BibTeX file - no ending ,}"); + } + } + else + i++; + } + sprintf(report, "%d references displayed", count); + gtk_entry_set_text(GTK_ENTRY(summary), report); +} diff --git a/biblio/bibtex/utils/xbibfile/listauthors.c b/biblio/bibtex/utils/xbibfile/listauthors.c new file mode 100644 index 0000000000..b212ad4312 --- /dev/null +++ b/biblio/bibtex/utils/xbibfile/listauthors.c @@ -0,0 +1,204 @@ +/* This file is a part of XBibFile - a system for handling BibTeX references + * + * Author: Ross Maloney + * Date: January 2002 + * + */ + +#include <stdio.h> +#include <string.h> +#include <gtk/gtk.h> + + +GdkColor search, show; +GtkWidget *searchlabel, *searchword; +GtkWidget *text, *textblock, *scrollblock; +GtkWidget *summary; +GtkTextBuffer *textpad; +GtkTextIter iter; + +char holder[200], temp[200], report[30], seek[100]; +char type[20], tag[30], title[100]; + +void allauthors(GtkWidget *widget) +{ + GtkTooltips *tooltips; + GtkWidget *window, *panel, *description, *selector, *controls; + GtkWidget *key0, *key1; + + extern void close_window(GtkWidget *); /* defined in file cleanup.c */ + void put_all_authors(); + + tooltips = gtk_tooltips_new(); + + window = gtk_window_new(GTK_WINDOW_TOPLEVEL); + gtk_window_set_title(GTK_WINDOW(window), "XBibFile inspect"); + gtk_window_position(GTK_WINDOW(window), GTK_WIN_POS_MOUSE); + gtk_window_set_default_size(GTK_WINDOW(window), 500, 470); + panel = gtk_vbox_new(FALSE, 0); + gtk_container_add(GTK_CONTAINER(window), panel); + description = gtk_label_new("All author fields in database"); + gtk_box_pack_start(GTK_BOX(panel), description, FALSE, TRUE, 10); + + /* create the text display part of the window */ + textblock = gtk_scrolled_window_new(NULL, NULL); + textpad = gtk_text_buffer_new(NULL); + text = gtk_text_view_new_with_buffer(textpad); + gtk_container_add(GTK_CONTAINER(textblock), text); + gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(textblock), + GTK_POLICY_AUTOMATIC, + GTK_POLICY_AUTOMATIC); + gtk_box_pack_start_defaults(GTK_BOX(panel), textblock); + + /* put the window control buttons in place */ + controls = gtk_hbox_new(FALSE, 0); + key0 = gtk_button_new_with_label("CANCEL"); + gtk_widget_set_usize(GTK_WIDGET(key0), 90, -1); + g_signal_connect(GTK_OBJECT(key0), "clicked", + G_CALLBACK(close_window), NULL); + gtk_tooltips_set_tip(tooltips, key0, + "Finish this reference probe", NULL); + gtk_box_pack_end(GTK_BOX(controls), key0, FALSE, FALSE, 10); + /* and put the summary line in place */ + summary = gtk_entry_new(); + gtk_editable_set_editable(GTK_EDITABLE(summary), FALSE); + gtk_widget_set_usize(GTK_WIDGET(summary), 150, 20); + gtk_box_pack_start(GTK_BOX(controls), summary, FALSE, FALSE, 10); + gtk_box_pack_end(GTK_BOX(panel), controls, FALSE, TRUE, 20); + + /* now put the 'style' for the text output */ + gtk_text_buffer_create_tag(textpad, "blackface", + "foreground", "black", NULL); + gtk_text_buffer_create_tag(textpad, "emphasis", + "foreground", "red", NULL); + gtk_text_buffer_create_tag(textpad, "trigger", + "foreground", "green", NULL); + gtk_text_buffer_create_tag(textpad, "point", + "size", 11 * PANGO_SCALE, NULL); + gtk_text_buffer_create_tag(textpad, "font", + "style", PANGO_STYLE_NORMAL, NULL); + + put_all_authors(widget); + + /* put the composite window on the screen */ + gtk_widget_show_all(window); +} + + + +/* This procedure performs the searching of the BibTeX database and returns + * its results to the text window created in the procedure word() above + */ + +void put_all_authors(GtkWidget *widget) +{ + int i, count, length; + char *start, *end; + + extern void error(); /* defined in file error.c */ + extern FILE *refFile; /* defined in xbibfile.c */ + + + i = 0; + count = 0; + rewind(refFile); + gtk_text_buffer_get_iter_at_offset(textpad, &iter, 0); + while ( ( holder[i] = getc(refFile) ) != EOF ) { + if ( holder[i] == '\n' ) { + holder[i+1] = '\0'; + i = 0; + if ( holder[0] == '@' ) { + if ( strstr( holder, "ARTICLE") ) + strcpy(temp, "Article "); + if ( strstr( holder, "BOOK") ) + strcpy(temp, "Book "); + if ( strstr( holder, "BOOKLET") ) + strcpy(temp, "Booklet "); + if ( strstr( holder, "CONFERENCE") ) + strcpy(temp, "Conference "); + if ( strstr( holder, "INBOOK") ) + strcpy(temp, "inBook "); + if ( strstr( holder, "INCOLLECTION") ) + strcpy(temp, "Incollection "); + if ( strstr( holder, "INPROCEEDINGS") ) + strcpy(temp, "inProceedings "); + if ( strstr( holder, "MANUAL") ) + strcpy(temp, "Manual "); + if ( strstr( holder, "MASTERSTHESIS") ) + strcpy(temp, "Masters "); + if ( strstr( holder, "MISC") ) + strcpy(temp, "Misc "); + if ( strstr( holder, "PHDTHESIS") ) + strcpy(temp, "PhD Thesis "); + if ( strstr( holder, "PROCEEDINGS") ) + strcpy(temp, "Proceedings "); + if ( strstr( holder, "TECHREPORT") ) + strcpy(temp, "Tech Rerort "); + if ( strstr( holder, "UNPUBLISHED") ) + strcpy(temp, "Unpublished "); + strcpy(type, temp); + if ( start = strstr( holder, "{" ) ) + if ( end = strstr( holder, "," ) ) { + *end = ' '; + end++; + *end = ' '; + end++; + *end = '\0'; + strcpy(tag, start+1); + } + else { + error(widget, GINT_TO_POINTER(9)); + g_print("Format error in this BibTeX file - no ending ,"); + } + else { + error(widget, GINT_TO_POINTER(9)); + g_print("Format error in this BibTeX file - no {"); + } + } + /* if the line starts with 'author = {' */ + if ( start = strstr(holder, " author = {") ) { + end = strstr(holder, "}"); + *end = '\n'; + end++; + *end = '\0'; + strcpy(temp, start+12); + } + /* if the line starts with 'title = {' */ + if ( start = strstr( holder, " title = {" ) ) { + if ( end = strstr( holder, "}," ) ) { + if ( (end - start) > 60 ) + end = start + 60; + *end = '\n'; + end++; + *end = '\0'; + start += 11; + strcpy(title, start); + } + else { + error(widget, GINT_TO_POINTER(9)); + g_print("Format error in this BibTeX file - no ending ,}"); + } + gtk_text_buffer_insert_with_tags_by_name(textpad, &iter, + type, -1, + "blackface", "point", "font", NULL); + gtk_text_buffer_insert_with_tags_by_name(textpad, &iter, + tag, -1, + "emphasis", "point", "font", NULL); + gtk_text_buffer_insert_with_tags_by_name(textpad, &iter, + title, -1, + "blackface", "point", "font", NULL); + gtk_text_buffer_insert_with_tags_by_name(textpad, &iter, + " ", -1, + "blackface", "point", "font", NULL); + gtk_text_buffer_insert_with_tags_by_name(textpad, &iter, + temp, -1, + "trigger", "point", "font", NULL); + count++; + } + } + else + i++; + } + sprintf(report, "%d references displayed", count); + gtk_entry_set_text(GTK_ENTRY(summary), report); +} diff --git a/biblio/bibtex/utils/xbibfile/listpubyear.c b/biblio/bibtex/utils/xbibfile/listpubyear.c new file mode 100644 index 0000000000..4a66baf691 --- /dev/null +++ b/biblio/bibtex/utils/xbibfile/listpubyear.c @@ -0,0 +1,214 @@ +/* This file is a part of XBibFile - a system for handling BibTeX references + * + * Author: Ross Maloney + * Date: January 2002 + * + */ + +#include <stdio.h> +#include <string.h> +#include <gtk/gtk.h> + + +GtkWidget *searchlabel, *searchword; +GtkWidget *text, *textblock, *scrollblock; +GtkWidget *summary; +GtkTextBuffer *textpad; +GtkTextIter iter; + +char holder[200], temp[200], report[30], seek[100]; +char type[20], tag[30], title[100]; + +void find_year(GtkWidget *widget) +{ + GtkTooltips *tooltips; + GtkWidget *window, *panel, *description, *selector, *controls; + GtkWidget *key0, *key1, *key3; + + extern void close_window(GtkWidget *); /* defined in file cleanup.c */ + void put_text_pubyear(); + + tooltips = gtk_tooltips_new(); + + window = gtk_window_new(GTK_WINDOW_TOPLEVEL); + gtk_window_set_title(GTK_WINDOW(window), "XBibFile inspect"); + gtk_window_position(GTK_WINDOW(window), GTK_WIN_POS_MOUSE); + gtk_window_set_default_size(GTK_WINDOW(window), 500, 510); + panel = gtk_vbox_new(FALSE, 0); + gtk_container_add(GTK_CONTAINER(window), panel); + description = gtk_label_new("References found in the database containing specified publication year"); + gtk_box_pack_start(GTK_BOX(panel), description, FALSE, TRUE, 10); + selector = gtk_hbox_new(FALSE, 0); + searchlabel = gtk_label_new("Year to find:"); + gtk_box_pack_start(GTK_BOX(selector), searchlabel, FALSE, TRUE, 10); + searchword = gtk_entry_new_with_max_length(100); + gtk_box_pack_start(GTK_BOX(selector), searchword, FALSE, TRUE, 10); + g_signal_connect(GTK_OBJECT(searchword), "activate", + G_CALLBACK(put_text_pubyear), NULL); + key3 = gtk_button_new_with_label("Execute"); + gtk_widget_set_usize(GTK_WIDGET(key3), 90, -1); + g_signal_connect(GTK_OBJECT(key3), "clicked", + G_CALLBACK(put_text_pubyear), NULL); + gtk_tooltips_set_tip(tooltips, key3, + "Execute search with this new word", NULL); + gtk_box_pack_end(GTK_BOX(selector), key3, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(panel), selector, FALSE, TRUE, 10); + + /* create the text display part of the window */ + textblock = gtk_scrolled_window_new(NULL, NULL); + textpad = gtk_text_buffer_new(NULL); + text = gtk_text_view_new_with_buffer(textpad); + gtk_container_add(GTK_CONTAINER(textblock), text); + gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(textblock), + GTK_POLICY_AUTOMATIC, + GTK_POLICY_AUTOMATIC); + gtk_box_pack_start_defaults(GTK_BOX(panel), textblock); + + /* put the window control buttons in place */ + controls = gtk_hbox_new(FALSE, 0); + key0 = gtk_button_new_with_label("CANCEL"); + gtk_widget_set_usize(GTK_WIDGET(key0), 90, -1); + g_signal_connect(GTK_OBJECT(key0), "clicked", + G_CALLBACK(close_window), NULL); + gtk_tooltips_set_tip(tooltips, key0, + "Finish this reference probe", NULL); + gtk_box_pack_end(GTK_BOX(controls), key0, FALSE, FALSE, 10); + /* and put the summary line in place */ + summary = gtk_entry_new(); + gtk_editable_set_editable(GTK_EDITABLE(summary), FALSE); + gtk_widget_set_usize(GTK_WIDGET(summary), 150, 20); + gtk_box_pack_start(GTK_BOX(controls), summary, FALSE, FALSE, 10); + gtk_box_pack_end(GTK_BOX(panel), controls, FALSE, TRUE, 10); + + /* now put the 'style' for the text output */ + gtk_text_buffer_create_tag(textpad, "blackface", + "foreground", "black", NULL); + gtk_text_buffer_create_tag(textpad, "emphasis", + "foreground", "red", NULL); + gtk_text_buffer_create_tag(textpad, "target", + "foreground", "green", NULL); + gtk_text_buffer_create_tag(textpad, "point", + "size", 11 * PANGO_SCALE, NULL); + gtk_text_buffer_create_tag(textpad, "font", + "style", PANGO_STYLE_NORMAL, NULL); + + /* put the composite window on the screen */ + gtk_widget_show_all(window); +} + + + +/* This procedure performs the searching of the BibTeX database and returns + * its results to the text window created in the procedure find_year() above + */ + +void put_text_pubyear(GtkWidget *widget) +{ + int i, count, start_flag, print_flag, length; + char *start, *end; + + extern void error(); /* defined in file error.c */ + extern FILE *refFile; /* defined in xbibfile.c */ + + strcpy(seek, gtk_editable_get_chars(GTK_EDITABLE(searchword), 0, -1)); + + i = 0; + count = 0; + rewind(refFile); + gtk_text_buffer_get_iter_at_offset(textpad, &iter, 0); + while ( ( holder[i] = getc(refFile) ) != EOF ) { + if ( holder[i] == '\n' ) { + holder[i+1] = '\0'; + i = 0; + if ( holder[0] == '@' ) { + print_flag = 0; + if ( strstr( holder, "ARTICLE") ) + strcpy(temp, "Article "); + if ( strstr( holder, "BOOK") ) + strcpy(temp, "Book "); + if ( strstr( holder, "BOOKLET") ) + strcpy(temp, "Booklet "); + if ( strstr( holder, "CONFERENCE") ) + strcpy(temp, "Conference "); + if ( strstr( holder, "INBOOK") ) + strcpy(temp, "inBook "); + if ( strstr( holder, "INCOLLECTION") ) + strcpy(temp, "Incollection "); + if ( strstr( holder, "INPROCEEDINGS") ) + strcpy(temp, "inProceedings "); + if ( strstr( holder, "MANUAL") ) + strcpy(temp, "Manual "); + if ( strstr( holder, "MASTERSTHESIS") ) + strcpy(temp, "Masters "); + if ( strstr( holder, "MISC") ) + strcpy(temp, "Misc "); + if ( strstr( holder, "PHDTHESIS") ) + strcpy(temp, "PhD Thesis "); + if ( strstr( holder, "PROCEEDINGS") ) + strcpy(temp, "Proceedings "); + if ( strstr( holder, "TECHREPORT") ) + strcpy(temp, "Tech Rerort "); + if ( strstr( holder, "UNPUBLISHED") ) + strcpy(temp, "Unpublished "); + strcpy(type, temp); + if ( start = strstr( holder, "{" ) ) + if ( end = strstr( holder, "," ) ) { + *end = ' '; + end++; + *end = ' '; + end++; + *end = '\0'; + strcpy(tag, start+1); + } + else { + error(widget, GINT_TO_POINTER(9)); + g_print("Format error in this BibTeX file - no ending ,"); + } + else { + error(widget, GINT_TO_POINTER(9)); + g_print("Format error in this BibTeX file - no {"); + } + } + /* if the line starts with 'year = {' */ + if ( start = strstr(holder, " year = {") ) { + end = strstr(holder, "}"); + *end = '\n'; + end++; + *end = '\0'; + strcpy(temp, start+10); + if ( strstr(holder, seek) ) { + gtk_text_buffer_insert_with_tags_by_name(textpad, &iter, + type, -1, + "blackface", "point", "font", NULL); + gtk_text_buffer_insert_with_tags_by_name(textpad, &iter, + tag, -1, + "emphasis", "point", "font", NULL); + gtk_text_buffer_insert_with_tags_by_name(textpad, &iter, + title, -1, + "blackface", "point", "font", NULL); + count++; + } + } + /* if the line starts with 'title = {' */ + if ( start = strstr( holder, " title = {" ) ) { + if ( end = strstr( holder, "}," ) ) { + if ( (end - start) > 60 ) + end = start + 60; + *end = '\n'; + end++; + *end = '\0'; + start += 11; + strcpy(title, start); + } + else { + error(widget, GINT_TO_POINTER(9)); + g_print("Format error in this BibTeX file - no ending ,}"); + } + } + } + else + i++; + } + sprintf(report, "%d references displayed", count); + gtk_entry_set_text(GTK_ENTRY(summary), report); +} diff --git a/biblio/bibtex/utils/xbibfile/listref.c b/biblio/bibtex/utils/xbibfile/listref.c new file mode 100644 index 0000000000..947c4c254a --- /dev/null +++ b/biblio/bibtex/utils/xbibfile/listref.c @@ -0,0 +1,156 @@ +/* This file is a part of XBibFile - a system for handling BibTeX references + * + * Author: Ross Maloney + * Date: January 2002 + * + */ + +#include <stdio.h> +#include <string.h> +#include <gtk/gtk.h> + + +GtkWidget *searchlabel, *searchword; +GtkWidget *text, *textblock, *vscroll; +GtkWidget *summary; +GtkTextBuffer *textpad; +GtkTextIter iter; + +char holder[200], temp[200], report[30], seek[100]; +char type[20], tag[30], title[100]; + +void viewref(GtkWidget *widget) +{ + GtkTooltips *tooltips; + GtkWidget *window, *panel, *description, *selector, *controls; + GtkWidget *key0, *key1, *key3; + + extern void close_window(GtkWidget *); /* defined in file cleanup.c */ + void put_text_ref(); + + tooltips = gtk_tooltips_new(); + + window = gtk_window_new(GTK_WINDOW_TOPLEVEL); + gtk_window_set_title(GTK_WINDOW(window), "XBibFile inspect"); + gtk_window_position(GTK_WINDOW(window), GTK_WIN_POS_MOUSE); + gtk_window_set_default_size(GTK_WINDOW(window), 550, 510); + panel = gtk_vbox_new(FALSE, 0); + gtk_container_add(GTK_CONTAINER(window), panel); + description = gtk_label_new("References found in the database containing specified tag"); + gtk_box_pack_start(GTK_BOX(panel), description, FALSE, TRUE, 10); + selector = gtk_hbox_new(FALSE, 0); + searchlabel = gtk_label_new("Tag to find:"); + gtk_box_pack_start(GTK_BOX(selector), searchlabel, FALSE, TRUE, 10); + searchword = gtk_entry_new_with_max_length(100); + gtk_box_pack_start(GTK_BOX(selector), searchword, FALSE, TRUE, 10); + g_signal_connect(GTK_OBJECT(searchword), "activate", + G_CALLBACK(put_text_ref), NULL); + key3 = gtk_button_new_with_label("Execute"); + gtk_widget_set_usize(GTK_WIDGET(key3), 90, -1); + g_signal_connect(GTK_OBJECT(key3), "clicked", + G_CALLBACK(put_text_ref), NULL); + gtk_tooltips_set_tip(tooltips, key3, + "Execute search with this new word", NULL); + gtk_box_pack_end(GTK_BOX(selector), key3, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(panel), selector, FALSE, TRUE, 10); + + /* create the text display part of the window */ + textblock = gtk_scrolled_window_new(NULL, NULL); + textpad = gtk_text_buffer_new(NULL); + text = gtk_text_view_new_with_buffer(textpad); + gtk_container_add(GTK_CONTAINER(textblock), text); + gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(textblock), + GTK_POLICY_AUTOMATIC, + GTK_POLICY_AUTOMATIC); + gtk_box_pack_start_defaults(GTK_BOX(panel), textblock); + + /* put the window control buttons in place */ + controls = gtk_hbox_new(FALSE, 0); + key0 = gtk_button_new_with_label("CANCEL"); + gtk_widget_set_usize(GTK_WIDGET(key0), 90, -1); + g_signal_connect(GTK_OBJECT(key0), "clicked", + G_CALLBACK(close_window), NULL); + gtk_tooltips_set_tip(tooltips, key0, + "Finish this reference probe", NULL); + gtk_box_pack_end(GTK_BOX(controls), key0, FALSE, FALSE, 10); + /* and put the summary line in place */ + summary = gtk_entry_new(); + gtk_editable_set_editable(GTK_EDITABLE(summary), FALSE); + gtk_widget_set_usize(GTK_WIDGET(summary), 150, 20); + gtk_box_pack_start(GTK_BOX(controls), summary, FALSE, FALSE, 10); + gtk_box_pack_end(GTK_BOX(panel), controls, FALSE, TRUE, 10); + + /* now put the 'style' for the text output */ + gtk_text_buffer_create_tag(textpad, "blackface", + "foreground", "black", NULL); + gtk_text_buffer_create_tag(textpad, "emphasis", + "foreground", "red", NULL); + gtk_text_buffer_create_tag(textpad, "target", + "foreground", "green", NULL); + gtk_text_buffer_create_tag(textpad, "point", + "size", 11 * PANGO_SCALE, NULL); + gtk_text_buffer_create_tag(textpad, "font", + "style", PANGO_STYLE_NORMAL, NULL); + + /* put the composite window on the screen */ + gtk_widget_show_all(window); +} + + + +/* This procedure performs the searching of the BibTeX database and returns + * its results to the text window created in the procedure viewref() above + */ + +void put_text_ref(GtkWidget *widget) +{ + int i, count, print_flag, length; + char *start; + + extern void error(); /* defined in file error.c */ + extern FILE *refFile; /* defined in xbibfile.c */ + + strcpy(seek, gtk_entry_get_text(GTK_ENTRY(searchword))); + + i = 0; + count = 0; + rewind(refFile); + gtk_text_buffer_get_iter_at_offset(textpad, &iter, 0); + while ( ( holder[i] = getc(refFile) ) != EOF ) { + if ( holder[i] == '\n' ) { + holder[i+1] = '\0'; + i = 0; + if ( holder[0] == '@' ) { + print_flag = 0; + if ( start = strstr(holder, seek) ) { + *start = '\0'; + length = strlen(seek); + gtk_text_buffer_insert_with_tags_by_name(textpad, &iter, + holder, -1, + "blackface", "point", "font", NULL); + gtk_text_buffer_insert_with_tags_by_name(textpad, &iter, + seek, -1, + "emphasis", "point", "font", NULL); + start += length; + gtk_text_buffer_insert_with_tags_by_name(textpad, &iter, + start, -1, + "blackface", "point", "font", NULL); + count++; + print_flag = 1; + } + } + else + if ( print_flag ) + gtk_text_buffer_insert_with_tags_by_name(textpad, &iter, + holder, -1, + "blackface", "point", "font", NULL); +/* gtk_text_insert(GTK_TEXT(text), text->style->font, + NULL, NULL, + holder, -1); */ + } + else + i++; + } + sprintf(report, "%d references displayed", count); + gtk_entry_set_text(GTK_ENTRY(summary), report); +} diff --git a/biblio/bibtex/utils/xbibfile/listuplinks.c b/biblio/bibtex/utils/xbibfile/listuplinks.c new file mode 100644 index 0000000000..d5f1891a53 --- /dev/null +++ b/biblio/bibtex/utils/xbibfile/listuplinks.c @@ -0,0 +1,189 @@ +/* This file is a part of XBibFile - a system for handling BibTeX references + * + * Author: Ross Maloney + * Date: January 2002 + * + */ + +#include <stdio.h> +#include <string.h> +#include <gtk/gtk.h> + +#define SIZE 20 + + +GtkWidget *searchlabel, *searchword; +GtkWidget *text, *textblock, *scrollblock; +GtkWidget *summary; +GtkTextBuffer *textpad; +GtkTextIter iter; + +char holder[200], temp[200], report[30], seek[100]; +char type[20], tag[30], title[100]; + +void alluplinks(GtkWidget *widget) +{ + GtkTooltips *tooltips; + GtkWidget *window, *panel, *description, *selector, *controls; + GtkWidget *key0, *key1; + + extern void close_window(GtkWidget *); /* defined in file cleanup.c */ + void put_all_uplinks(); + + tooltips = gtk_tooltips_new(); + + window = gtk_window_new(GTK_WINDOW_TOPLEVEL); + gtk_window_set_title(GTK_WINDOW(window), "XBibFile inspect"); + gtk_window_position(GTK_WINDOW(window), GTK_WIN_POS_MOUSE); + gtk_window_set_default_size(GTK_WINDOW(window), 300, 470); + panel = gtk_vbox_new(FALSE, 0); + gtk_container_add(GTK_CONTAINER(window), panel); + description = gtk_label_new("All dependency fields in database"); + gtk_box_pack_start(GTK_BOX(panel), description, FALSE, TRUE, 10); + + /* create the text display part of the window */ + textblock = gtk_scrolled_window_new(NULL, NULL); + textpad = gtk_text_buffer_new(NULL); + text = gtk_text_view_new_with_buffer(textpad); + gtk_container_add(GTK_CONTAINER(textblock), text); + gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(textblock), + GTK_POLICY_AUTOMATIC, + GTK_POLICY_AUTOMATIC); + gtk_box_pack_start_defaults(GTK_BOX(panel), textblock); + + /* put the window control buttons in place */ + controls = gtk_hbox_new(FALSE, 0); + key0 = gtk_button_new_with_label("CANCEL"); + gtk_widget_set_usize(GTK_WIDGET(key0), 90, -1); + g_signal_connect(GTK_OBJECT(key0), "clicked", + G_CALLBACK(close_window), NULL); + gtk_tooltips_set_tip(tooltips, key0, + "Finish this reference probe", NULL); + gtk_box_pack_end(GTK_BOX(controls), key0, FALSE, FALSE, 10); + /* and put the summary line in place */ + summary = gtk_entry_new(); + gtk_editable_set_editable(GTK_EDITABLE(summary), FALSE); + gtk_widget_set_usize(GTK_WIDGET(summary), 150, 20); + gtk_box_pack_start(GTK_BOX(controls), summary, FALSE, FALSE, 10); + gtk_box_pack_end(GTK_BOX(panel), controls, FALSE, TRUE, 20); + + /* now put the 'style' for the text output */ + gtk_text_buffer_create_tag(textpad, "blackface", + "foreground", "black", NULL); + gtk_text_buffer_create_tag(textpad, "emphasis", + "foreground", "red", NULL); + gtk_text_buffer_create_tag(textpad, "target", + "foreground", "green", NULL); + gtk_text_buffer_create_tag(textpad, "point", + "size", 11 * PANGO_SCALE, NULL); + gtk_text_buffer_create_tag(textpad, "font", + "style", PANGO_STYLE_NORMAL, NULL); + + put_all_uplinks(widget); + + /* put the composite window on the screen */ + gtk_widget_show_all(window); +} + + + +/* This procedure performs the searching of the BibTeX database and returns + * its results to the text window created in the procedure alluplinks() above + */ + +void put_all_uplinks(GtkWidget *widget) +{ + int i, count, flag, k, pass; + char *start, *end; + struct tag_list { + char item[90]; + int total; + }; + struct tag_list links[20]; + + extern void error(); /* defined in file error.c */ + extern FILE *refFile; /* defined in xbibfile.c */ + + + /* first, find all the uplink fields present */ + i = 0; + count = 0; + rewind(refFile); + gtk_text_buffer_get_iter_at_offset(textpad, &iter, 0); + while ( ( holder[i] = getc(refFile) ) != EOF ) { + if ( holder[i] == '\n' ) { + holder[i+1] = '\0'; + i = 0; + /* if the line starts with 'uplink = {' */ + if ( start = strstr(holder, " uplink = {") ) { + end = strstr(holder, "}"); + *end = '\0'; + /* find where this uplink is to be stored */ + flag = 0; + for (k=0; k<count; k++) + if ( strstr(links[k].item, start+12) ) { + links[k].total++; + flag = 1; + } + if ( !flag ) { + strcpy(links[count].item, start+12); + links[count].total = 1; + count++; + } + } + } + i++; + } + /* display all the uplanks and their sources */ + for (k=0; k<count; k++) { + i = 0; + rewind(refFile); + gtk_text_buffer_insert_with_tags_by_name(textpad, &iter, + links[k].item, -1, + "emphasis", "point", "font", NULL); + gtk_text_buffer_insert_with_tags_by_name(textpad, &iter, + "\n", -1, + "blackface", "point", "font", NULL); + while ( ( holder[i] = getc(refFile) ) != EOF ) { + if ( holder[i] == '\n' ) { + holder[i+1] = '\0'; + i = 0; + /* if the line starts with '@' */ + if ( holder[1] == '@' ) + if ( start = strstr(holder, "{") ) + if ( end = strstr(holder, ",") ) { + *end = '\0'; + strcpy(tag, start+1); + } + else { + error(widget, GINT_TO_POINTER(9)); + g_print("Format error found in BibTeX file - no terminating ,"); + } + else { + error(widget, GINT_TO_POINTER(9)); + g_print("Format error found in BibTeX file - no { after @"); + } + /* if the line starts with 'uplink = {' */ + if ( start = strstr(holder, " uplink = {") ) { + end = strstr(holder, "}"); + *end = '\0'; + strcpy(temp, start+12); + if ( strstr(links[k].item, start+12) ) { + gtk_text_buffer_insert_with_tags_by_name(textpad, &iter, + " ", -1, + "blackface", "point", "font", NULL); + gtk_text_buffer_insert_with_tags_by_name(textpad, &iter, + tag, -1, + "blackface", "point", "font", NULL); + gtk_text_buffer_insert_with_tags_by_name(textpad, &iter, + "\n", -1, + "blackface", "point", "font", NULL); + } + } + } + i++; + } + } + sprintf(report, "%d link chains found", count); + gtk_entry_set_text(GTK_ENTRY(summary), report); +} diff --git a/biblio/bibtex/utils/xbibfile/listword.c b/biblio/bibtex/utils/xbibfile/listword.c new file mode 100644 index 0000000000..e5fb87583a --- /dev/null +++ b/biblio/bibtex/utils/xbibfile/listword.c @@ -0,0 +1,239 @@ +/* This file is a part of XBibFile - a system for handling BibTeX references + * + * Author: Ross Maloney + * Date: January 2002 + * + */ + +#include <stdio.h> +#include <string.h> +#include <gtk/gtk.h> + + +GtkWidget *searchlabel, *searchword; +GtkWidget *text, *textblock, *scrollblock; +GtkWidget *summary; +GtkTextBuffer *textpad; +GtkTextIter iter; + +char holder[200], temp[200], report[30], seek[100]; +char type[20], tag[30], title[100]; + +void word(GtkWidget *widget) +{ + GtkTooltips *tooltips; + GtkWidget *window, *panel, *description, *selector, *controls; + GtkWidget *key0, *key1, *key3; + + extern void close_window(GtkWidget *); /* defined in file cleanup.c */ + void put_text_inplace(); + + tooltips = gtk_tooltips_new(); + + window = gtk_window_new(GTK_WINDOW_TOPLEVEL); + gtk_window_set_title(GTK_WINDOW(window), "XBibFile inspect"); + gtk_window_position(GTK_WINDOW(window), GTK_WIN_POS_MOUSE); + gtk_window_set_default_size(GTK_WINDOW(window), 500, 510); + panel = gtk_vbox_new(FALSE, 0); + gtk_container_add(GTK_CONTAINER(window), panel); + description = gtk_label_new("References found in the database containing search word"); + gtk_box_pack_start(GTK_BOX(panel), description, FALSE, TRUE, 10); + selector = gtk_hbox_new(FALSE, 0); + searchlabel = gtk_label_new("Word to find:"); + gtk_box_pack_start(GTK_BOX(selector), searchlabel, FALSE, TRUE, 10); + searchword = gtk_entry_new_with_max_length(100); + gtk_box_pack_start(GTK_BOX(selector), searchword, FALSE, TRUE, 10); + g_signal_connect(GTK_OBJECT(searchword), "activate", + G_CALLBACK(put_text_inplace), NULL); + key3 = gtk_button_new_with_label("Execute"); + gtk_widget_set_usize(GTK_WIDGET(key3), 90, -1); + g_signal_connect(GTK_OBJECT(key3), "clicked", + G_CALLBACK(put_text_inplace), NULL); + gtk_tooltips_set_tip(tooltips, key3, + "Execute search with this new word", NULL); + gtk_box_pack_end(GTK_BOX(selector), key3, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(panel), selector, FALSE, TRUE, 10); + + /* create the text display part of the window */ + textblock = gtk_scrolled_window_new(NULL, NULL); + textpad = gtk_text_buffer_new(NULL); + text = gtk_text_view_new_with_buffer(textpad); + gtk_container_add(GTK_CONTAINER(textblock), text); + gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(textblock), + GTK_POLICY_AUTOMATIC, + GTK_POLICY_AUTOMATIC); + gtk_box_pack_start_defaults(GTK_BOX(panel), textblock); + + /* put the window control buttons in place */ + controls = gtk_hbox_new(FALSE, 0); + key0 = gtk_button_new_with_label("CANCEL"); + gtk_widget_set_usize(GTK_WIDGET(key0), 90, -1); + g_signal_connect(GTK_OBJECT(key0), "clicked", + G_CALLBACK(close_window), NULL); + gtk_tooltips_set_tip(tooltips, key0, + "Finish this reference probe", NULL); + gtk_box_pack_end(GTK_BOX(controls), key0, FALSE, FALSE, 10); + /* and put the summary line in place */ + summary = gtk_entry_new(); + gtk_editable_set_editable(GTK_EDITABLE(summary), FALSE); + gtk_widget_set_usize(GTK_WIDGET(summary), 150, 20); + gtk_box_pack_start(GTK_BOX(controls), summary, FALSE, FALSE, 10); + gtk_box_pack_end(GTK_BOX(panel), controls, FALSE, TRUE, 10); + + /* now put the 'style' for the text output */ + gtk_text_buffer_create_tag(textpad, "blackface", + "foreground", "black", NULL); + gtk_text_buffer_create_tag(textpad, "emphasis", + "foreground", "red", NULL); + gtk_text_buffer_create_tag(textpad, "target", + "foreground", "green", NULL); + gtk_text_buffer_create_tag(textpad, "point", + "size", 11 * PANGO_SCALE, NULL); + gtk_text_buffer_create_tag(textpad, "font", + "style", PANGO_STYLE_NORMAL, NULL); + + /* put the composite window on the screen */ + gtk_widget_show_all(window); +} + + + +/* This procedure performs the searching of the BibTeX database and returns + * its results to the text window created in the procedure word() above + */ + +void put_text_inplace(GtkWidget *widget) +{ + int i, count, start_flag, print_flag, length; + char *start, *end; + + extern void error(); /* defined in file error.c */ + extern FILE *refFile; /* defined in xbibfile.c */ + + strcpy(seek, gtk_entry_get_text(GTK_ENTRY(searchword))); + + i = 0; + count = 0; + rewind(refFile); + gtk_text_buffer_get_iter_at_offset(textpad, &iter, 0); + while ( ( holder[i] = getc(refFile) ) != EOF ) { + if ( holder[i] == '\n' ) { + holder[i+1] = '\0'; + i = 0; + if ( holder[0] == '@' ) { + start_flag = 0; + print_flag = 0; + if ( strstr( holder, "ARTICLE") ) + strcpy(temp, "Article "); + if ( strstr( holder, "BOOK") ) + strcpy(temp, "Book "); + if ( strstr( holder, "BOOKLET") ) + strcpy(temp, "Booklet "); + if ( strstr( holder, "CONFERENCE") ) + strcpy(temp, "Conference "); + if ( strstr( holder, "INBOOK") ) + strcpy(temp, "inBook "); + if ( strstr( holder, "INCOLLECTION") ) + strcpy(temp, "Incollection "); + if ( strstr( holder, "INPROCEEDINGS") ) + strcpy(temp, "inProceedings "); + if ( strstr( holder, "MANUAL") ) + strcpy(temp, "Manual "); + if ( strstr( holder, "MASTERSTHESIS") ) + strcpy(temp, "Masters "); + if ( strstr( holder, "MISC") ) + strcpy(temp, "Misc "); + if ( strstr( holder, "PHDTHESIS") ) + strcpy(temp, "PhD Thesis "); + if ( strstr( holder, "PROCEEDINGS") ) + strcpy(temp, "Proceedings "); + if ( strstr( holder, "TECHREPORT") ) + strcpy(temp, "Tech Rerort "); + if ( strstr( holder, "UNPUBLISHED") ) + strcpy(temp, "Unpublished "); + strcpy(type, temp); + if ( start = strstr( holder, "{" ) ) + if ( end = strstr( holder, "," ) ) { + *end = ' '; + end++; + *end = ' '; + end++; + *end = '\0'; + strcpy(tag, start+1); + } + else { + error(widget, GINT_TO_POINTER(9)); + g_print("Format error in this BibTeX file - no ending ,"); + } + else { + error(widget, GINT_TO_POINTER(9)); + g_print("Format error in this BibTeX file - no {"); + } + } + /* if the line starts with 'title = {' */ + if ( start = strstr( holder, " title = {" ) ) + if ( end = strstr( holder, "}," ) ) { + if ( (end - start) > 60 ) + end = start + 60; + *end = '\n'; + end++; + *end = '\0'; + start += 11; + strcpy(title, start); + } + else { + error(widget, GINT_TO_POINTER(9)); + g_print("Format error in this BibTeX file - no ending ,}"); + } + /* if the line starts with 'annote = {' */ + strcpy(temp, holder); + if ( start = strstr(temp, " annote = {") ) { + start_flag = 1; + strcpy(temp, start+12); + } + /* if the line contains the terminator '} }' */ + if ( start_flag ) { + if ( start = strstr(temp, seek) ) { + if ( !print_flag ) { + gtk_text_buffer_insert_with_tags_by_name(textpad, &iter, + type, -1, + "blackface", "point", "font", NULL); + gtk_text_buffer_insert_with_tags_by_name(textpad, &iter, + tag, -1, + "emphasis", "point", "font", NULL); + gtk_text_buffer_insert_with_tags_by_name(textpad, &iter, + title, -1, + "blackface", "point", "font", NULL); + print_flag = 1; + count++; + } + *start = '\0'; + gtk_text_buffer_insert_with_tags_by_name(textpad, &iter, + " ", -1, + "blackface", "point", "font", NULL); + gtk_text_buffer_insert_with_tags_by_name(textpad, &iter, + temp, -1, + "blackface", "point", "font", NULL); + gtk_text_buffer_insert_with_tags_by_name(textpad, &iter, + seek, -1, + "target", "point", "font", NULL); + length = strlen(seek); + start += length; + if ( end = strstr(start, "} }") ) { + *end = '\0'; + end++; + *end = '\n'; + start_flag = 0; + } + gtk_text_buffer_insert_with_tags_by_name(textpad, &iter, + start, -1, + "blackface", "point", "font", NULL); + } + } + } + else + i++; + } + sprintf(report, "%d references displayed", count); + gtk_entry_set_text(GTK_ENTRY(summary), report); +} diff --git a/biblio/bibtex/utils/xbibfile/listwriter.c b/biblio/bibtex/utils/xbibfile/listwriter.c new file mode 100644 index 0000000000..bab5d793ac --- /dev/null +++ b/biblio/bibtex/utils/xbibfile/listwriter.c @@ -0,0 +1,234 @@ +/* This file is a part of XBibFile - a system for handling BibTeX references + * + * Author: Ross Maloney + * Date: January 2002 + * + */ + +#include <stdio.h> +#include <string.h> +#include <gtk/gtk.h> + + +GtkWidget *searchlabel, *searchword; +GtkWidget *text, *textblock, *scrollblock; +GtkWidget *summary; +GtkTextBuffer *textpad; +GtkTextIter iter; + +char holder[200], temp[200], report[30], seek[100]; +char type[20], tag[30], title[100]; + +void find_author(GtkWidget *widget) +{ + GtkTooltips *tooltips; + GtkWidget *window, *panel, *description, *selector, *controls; + GtkWidget *key0, *key1, *key3; + GtkEditable *summarypad; + + extern void close_window(GtkWidget *); /* defined in file cleanup.c */ + void put_text_author(); + + tooltips = gtk_tooltips_new(); + + window = gtk_window_new(GTK_WINDOW_TOPLEVEL); + gtk_window_set_title(GTK_WINDOW(window), "XBibFile inspect"); + gtk_window_position(GTK_WINDOW(window), GTK_WIN_POS_MOUSE); + gtk_window_set_default_size(GTK_WINDOW(window), 500, 510); + panel = gtk_vbox_new(FALSE, 0); + gtk_container_add(GTK_CONTAINER(window), panel); + description = gtk_label_new("References found in the database containing specified author"); + gtk_box_pack_start(GTK_BOX(panel), description, FALSE, TRUE, 10); + selector = gtk_hbox_new(FALSE, 0); + searchlabel = gtk_label_new("Author to find:"); + gtk_box_pack_start(GTK_BOX(selector), searchlabel, FALSE, TRUE, 10); + searchword = gtk_entry_new_with_max_length(100); + gtk_box_pack_start(GTK_BOX(selector), searchword, FALSE, TRUE, 10); + g_signal_connect(GTK_OBJECT(searchword), "activate", + G_CALLBACK(put_text_author), NULL); + key3 = gtk_button_new_with_label("Execute"); + gtk_widget_set_usize(GTK_WIDGET(key3), 90, -1); + g_signal_connect(GTK_OBJECT(key3), "clicked", + G_CALLBACK(put_text_author), NULL); + gtk_tooltips_set_tip(tooltips, key3, + "Execute search with this new word", NULL); + gtk_box_pack_end(GTK_BOX(selector), key3, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(panel), selector, FALSE, TRUE, 10); + + /* create the text display part of the window */ + textblock = gtk_scrolled_window_new(NULL, NULL); + textpad = gtk_text_buffer_new(NULL); + text = gtk_text_view_new_with_buffer(textpad); + gtk_container_add(GTK_CONTAINER(textblock), text); + gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(textblock), + GTK_POLICY_AUTOMATIC, + GTK_POLICY_AUTOMATIC); + gtk_box_pack_start_defaults(GTK_BOX(panel), textblock); + + /* put the window control buttons in place */ + controls = gtk_hbox_new(FALSE, 0); + key0 = gtk_button_new_with_label("CANCEL"); + gtk_widget_set_usize(GTK_WIDGET(key0), 90, -1); + g_signal_connect(GTK_OBJECT(key0), "clicked", + G_CALLBACK(close_window), NULL); + gtk_tooltips_set_tip(tooltips, key0, + "Finish this reference probe", NULL); + gtk_box_pack_end(GTK_BOX(controls), key0, FALSE, FALSE, 10); + /* and put the summary line in place */ + summary = gtk_entry_new(); + gtk_editable_set_editable(GTK_EDITABLE(summary), FALSE); + gtk_widget_set_usize(GTK_WIDGET(summary), 150, 20); + gtk_box_pack_start(GTK_BOX(controls), summary, FALSE, FALSE, 10); + gtk_box_pack_end(GTK_BOX(panel), controls, FALSE, TRUE, 10); + + /* now put the 'style' for the text output */ + gtk_text_buffer_create_tag(textpad, "blackface", + "foreground", "black", NULL); + gtk_text_buffer_create_tag(textpad, "emphasis", + "foreground", "red", NULL); + gtk_text_buffer_create_tag(textpad, "target", + "foreground", "green", NULL); + gtk_text_buffer_create_tag(textpad, "point", + "size", 11 * PANGO_SCALE, NULL); + gtk_text_buffer_create_tag(textpad, "font", + "style", PANGO_STYLE_NORMAL, NULL); + + /* put the composite window on the screen */ + gtk_widget_show_all(window); +} + + + +/* This procedure performs the searching of the BibTeX database and returns + * its results to the text window created in the procedure find_author() above + */ + +void put_text_author(GtkWidget *widget) +{ + int i, count, start_flag, print_flag, length; + char *start, *end; + + extern void error(); /* defined in file error.c */ + extern FILE *refFile; /* defined in xbibfile.c */ + + strcpy(seek, gtk_editable_get_chars(GTK_EDITABLE(searchword), 0, -1)); + + i = 0; + count = 0; + rewind(refFile); + gtk_text_buffer_get_iter_at_offset(textpad, &iter, 0); + while ( ( holder[i] = getc(refFile) ) != EOF ) { + if ( holder[i] == '\n' ) { + holder[i+1] = '\0'; + i = 0; + if ( holder[0] == '@' ) { + print_flag = 0; + if ( strstr( holder, "ARTICLE") ) + strcpy(temp, "Article "); + if ( strstr( holder, "BOOK") ) + strcpy(temp, "Book "); + if ( strstr( holder, "BOOKLET") ) + strcpy(temp, "Booklet "); + if ( strstr( holder, "CONFERENCE") ) + strcpy(temp, "Conference "); + if ( strstr( holder, "INBOOK") ) + strcpy(temp, "inBook "); + if ( strstr( holder, "INCOLLECTION") ) + strcpy(temp, "Incollection "); + if ( strstr( holder, "INPROCEEDINGS") ) + strcpy(temp, "inProceedings "); + if ( strstr( holder, "MANUAL") ) + strcpy(temp, "Manual "); + if ( strstr( holder, "MASTERSTHESIS") ) + strcpy(temp, "Masters "); + if ( strstr( holder, "MISC") ) + strcpy(temp, "Misc "); + if ( strstr( holder, "PHDTHESIS") ) + strcpy(temp, "PhD Thesis "); + if ( strstr( holder, "PROCEEDINGS") ) + strcpy(temp, "Proceedings "); + if ( strstr( holder, "TECHREPORT") ) + strcpy(temp, "Tech Rerort "); + if ( strstr( holder, "UNPUBLISHED") ) + strcpy(temp, "Unpublished "); + strcpy(type, temp); + if ( start = strstr( holder, "{" ) ) + if ( end = strstr( holder, "," ) ) { + *end = ' '; + end++; + *end = ' '; + end++; + *end = '\0'; + strcpy(tag, start+1); + } + else { + error(widget, GINT_TO_POINTER(9)); + g_print("Format error in this BibTeX file - no ending ,"); + } + else { + error(widget, GINT_TO_POINTER(9)); + g_print("Format error in this BibTeX file - no {"); + } + } + /* if the line starts with 'author = {' */ + if ( start = strstr(holder, " author = {") ) { + end = strstr(holder, "}"); + *end = '\n'; + end++; + *end = '\0'; + strcpy(temp, start+12); + if ( strstr(temp, seek) ) + print_flag = 1; + } + /* if the line starts with 'title = {' */ + if ( start = strstr( holder, " title = {" ) ) { + if ( end = strstr( holder, "}," ) ) { + if ( (end - start) > 60 ) + end = start + 60; + *end = '\n'; + end++; + *end = '\0'; + start += 11; + strcpy(title, start); + } + else { + error(widget, GINT_TO_POINTER(9)); + g_print("Format error in this BibTeX file - no ending ,}"); + } + if ( print_flag ) { + gtk_text_buffer_insert_with_tags_by_name(textpad, &iter, + type, -1, + "blackface", "point", "font", NULL); + gtk_text_buffer_insert_with_tags_by_name(textpad, &iter, + tag, -1, + "emphasis", "point", "font", NULL); + gtk_text_buffer_insert_with_tags_by_name(textpad, &iter, + title, -1, + "blackface", "point", "font", NULL); + gtk_text_buffer_insert_with_tags_by_name(textpad, &iter, + " ", -1, + "blackface", "point", "font", NULL); + start = strstr(temp, seek); + *start = '\0'; + gtk_text_buffer_insert_with_tags_by_name(textpad, &iter, + temp, -1, + "blackface", "point", "font", NULL); + gtk_text_buffer_insert_with_tags_by_name(textpad, &iter, + seek, -1, + "target", "point", "font", NULL); + length = strlen(seek); + start += length; + gtk_text_buffer_insert_with_tags_by_name(textpad, &iter, + start, -1, + "blackface", "point", "font", NULL); + count++; + print_flag = 0; + } + } + } + else + i++; + } + sprintf(report, "%d references displayed", count); + gtk_entry_set_text(GTK_ENTRY(summary), report); +} diff --git a/biblio/bibtex/utils/xbibfile/listyears.c b/biblio/bibtex/utils/xbibfile/listyears.c new file mode 100644 index 0000000000..2b1f79a060 --- /dev/null +++ b/biblio/bibtex/utils/xbibfile/listyears.c @@ -0,0 +1,203 @@ +/* This file is a part of XBibFile - a system for handling BibTeX references + * + * Author: Ross Maloney + * Date: January 2002 + * + */ + +#include <stdio.h> +#include <string.h> +#include <gtk/gtk.h> + + +GtkWidget *searchlabel, *searchword; +GtkWidget *text, *textblock, *scrollblock; +GtkWidget *summary; +GtkTextBuffer *textpad; +GtkTextIter iter; + +char holder[200], temp[200], report[30], seek[100]; +char type[20], tag[30], title[100]; + +void allyears(GtkWidget *widget) +{ + GtkTooltips *tooltips; + GtkWidget *window, *panel, *description, *selector, *controls; + GtkWidget *key0, *key1; + + extern void close_window(GtkWidget *); /* defined in file cleanup.c */ + void put_all_years(); + + tooltips = gtk_tooltips_new(); + + window = gtk_window_new(GTK_WINDOW_TOPLEVEL); + gtk_window_set_title(GTK_WINDOW(window), "XBibFile inspect"); + gtk_window_position(GTK_WINDOW(window), GTK_WIN_POS_MOUSE); + gtk_window_set_default_size(GTK_WINDOW(window), 500, 470); + panel = gtk_vbox_new(FALSE, 0); + gtk_container_add(GTK_CONTAINER(window), panel); + description = gtk_label_new("All publication date fields in database"); + gtk_box_pack_start(GTK_BOX(panel), description, FALSE, TRUE, 10); + + /* create the text display part of the window */ + textblock = gtk_scrolled_window_new(NULL, NULL); + textpad = gtk_text_buffer_new(NULL); + text = gtk_text_view_new_with_buffer(textpad); + gtk_container_add(GTK_CONTAINER(textblock), text); + gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(textblock), + GTK_POLICY_AUTOMATIC, + GTK_POLICY_AUTOMATIC); + gtk_box_pack_start_defaults(GTK_BOX(panel), textblock); + + /* put the window control buttons in place */ + controls = gtk_hbox_new(FALSE, 0); + key0 = gtk_button_new_with_label("CANCEL"); + gtk_widget_set_usize(GTK_WIDGET(key0), 90, -1); + g_signal_connect(GTK_OBJECT(key0), "clicked", + G_CALLBACK(close_window), NULL); + gtk_tooltips_set_tip(tooltips, key0, + "Finish this reference probe", NULL); + gtk_box_pack_end(GTK_BOX(controls), key0, FALSE, FALSE, 10); + /* and put the summary line in place */ + summary = gtk_entry_new(); + gtk_editable_set_editable(GTK_EDITABLE(summary), FALSE); + gtk_widget_set_usize(GTK_WIDGET(summary), 150, 20); + gtk_box_pack_start(GTK_BOX(controls), summary, FALSE, FALSE, 10); + gtk_box_pack_end(GTK_BOX(panel), controls, FALSE, TRUE, 20); + + /* now put the 'style' for the text output */ + gtk_text_buffer_create_tag(textpad, "blackface", + "foreground", "black", NULL); + gtk_text_buffer_create_tag(textpad, "emphasis", + "foreground", "red", NULL); + gtk_text_buffer_create_tag(textpad, "target", + "foreground", "green", NULL); + gtk_text_buffer_create_tag(textpad, "point", + "size", 11 * PANGO_SCALE, NULL); + gtk_text_buffer_create_tag(textpad, "font", + "style", PANGO_STYLE_NORMAL, NULL); + + put_all_years(widget); + + /* put the composite window on the screen */ + gtk_widget_show_all(window); +} + + + +/* This procedure performs the searching of the BibTeX database and returns + * its results to the text window created in the procedure allyears() above + */ + +void put_all_years(GtkWidget *widget) +{ + int i, count, length; + char *start, *end; + + extern void error(); /* defined in file error.c */ + extern FILE *refFile; /* defined in xbibfile.c */ + + + i = 0; + count = 0; + rewind(refFile); + gtk_text_buffer_get_iter_at_offset(textpad, &iter, 0); + while ( ( holder[i] = getc(refFile) ) != EOF ) { + if ( holder[i] == '\n' ) { + holder[i+1] = '\0'; + i = 0; + if ( holder[0] == '@' ) { + if ( strstr( holder, "ARTICLE") ) + strcpy(temp, "Article "); + if ( strstr( holder, "BOOK") ) + strcpy(temp, "Book "); + if ( strstr( holder, "BOOKLET") ) + strcpy(temp, "Booklet "); + if ( strstr( holder, "CONFERENCE") ) + strcpy(temp, "Conference "); + if ( strstr( holder, "INBOOK") ) + strcpy(temp, "inBook "); + if ( strstr( holder, "INCOLLECTION") ) + strcpy(temp, "Incollection "); + if ( strstr( holder, "INPROCEEDINGS") ) + strcpy(temp, "inProceedings "); + if ( strstr( holder, "MANUAL") ) + strcpy(temp, "Manual "); + if ( strstr( holder, "MASTERSTHESIS") ) + strcpy(temp, "Masters "); + if ( strstr( holder, "MISC") ) + strcpy(temp, "Misc "); + if ( strstr( holder, "PHDTHESIS") ) + strcpy(temp, "PhD Thesis "); + if ( strstr( holder, "PROCEEDINGS") ) + strcpy(temp, "Proceedings "); + if ( strstr( holder, "TECHREPORT") ) + strcpy(temp, "Tech Rerort "); + if ( strstr( holder, "UNPUBLISHED") ) + strcpy(temp, "Unpublished "); + strcpy(type, temp); + if ( start = strstr( holder, "{" ) ) + if ( end = strstr( holder, "," ) ) { + *end = ' '; + end++; + *end = ' '; + end++; + *end = '\0'; + strcpy(tag, start+1); + } + else { + error(widget, GINT_TO_POINTER(9)); + g_print("Format error in this BibTeX file - no ending ,"); + } + else { + error(widget, GINT_TO_POINTER(9)); + g_print("Format error in this BibTeX file - no {"); + } + } + /* if the line starts with 'year = {' */ + if ( start = strstr(holder, " year = {") ) { + end = strstr(holder, "}"); + *end = '\n'; + end++; + *end = '\0'; + strcpy(temp, start+10); + gtk_text_buffer_insert_with_tags_by_name(textpad, &iter, + type, -1, + "blackface", "point", "font", NULL); + gtk_text_buffer_insert_with_tags_by_name(textpad, &iter, + tag, -1, + "emphasis", "point", "font", NULL); + gtk_text_buffer_insert_with_tags_by_name(textpad, &iter, + title, -1, + "blackface", "point", "font", NULL); + gtk_text_buffer_insert_with_tags_by_name(textpad, &iter, + " ", -1, + "blackface", "point", "font", NULL); + gtk_text_buffer_insert_with_tags_by_name(textpad, &iter, + temp, -1, + "target", "point", "font", NULL); + count++; + } + /* if the line starts with 'title = {' */ + if ( start = strstr( holder, " title = {" ) ) { + if ( end = strstr( holder, "}," ) ) { + if ( (end - start) > 60 ) + end = start + 60; + *end = '\n'; + end++; + *end = '\0'; + start += 11; + strcpy(title, start); + } + else { + error(widget, GINT_TO_POINTER(9)); + g_print("Format error in this BibTeX file - no ending ,}"); + } + } + } + else + i++; + } + sprintf(report, "%d references displayed", count); + gtk_entry_set_text(GTK_ENTRY(summary), report); +} diff --git a/biblio/bibtex/utils/xbibfile/manual.c b/biblio/bibtex/utils/xbibfile/manual.c new file mode 100644 index 0000000000..f946d885dc --- /dev/null +++ b/biblio/bibtex/utils/xbibfile/manual.c @@ -0,0 +1,457 @@ +/* This file is a part of XBibFile - a system for handling BibTeX references + * + * Author: Ross Maloney + * Date: October 1999 + * Modified: January 2002 + * + */ + +#include <stdio.h> +#include <gtk/gtk.h> + +#include "xbibfile.h" + +/* This file is a modified copy of phd.c so that it handles the + * Manual BibTeX reference style */ + + +GtkWidget *labelX, *dataX; +GtkWidget *label0, *data0; +GtkWidget *label1, *data1; +GtkWidget *label2, *data2; +GtkWidget *label3, *data3; +GtkWidget *label6, *data6; +GtkWidget *label12, *data12; +GtkWidget *label13, *data13, *textscroll; +GtkWidget *label15, *data15; +GtkWidget *label20, *data20; +GtkWidget *label22, *data22; +GtkWidget *label24, *data24; +GtkWidget *label30, *data30; +GtkWidget *label31, *data31; +GtkWidget *label32, *data32; +GtkTextBuffer *text13; +GtkTextIter start, end; +PangoFontDescription *font_desc; + + + + +/* The procedure to save the Manual style */ + +void save_manual(GtkWidget *widget) +{ + extern int format; + extern int length[]; + extern char slate[][]; + extern int lengthX; + extern char slateX[]; + extern char slate1[]; + extern char slate2[]; + extern char slate3[]; + extern char slate6[]; + extern char slate12[]; + extern char slate13[]; + extern char slate15[]; + extern char slate20[]; + extern char slate22[]; + extern char slate24[]; + extern char slate30[]; + extern char slate31[]; + extern char slate32[]; + extern void error(); /* defined in file error.c */ + extern FILE *finput; /* defined in file xbibfile.c */ + extern void close_window(); /* defined in file cleanup.c */ + + if (format != 8) { + error(widget, GINT_TO_POINTER(5)); + return; + } + strcpy(slateX, gtk_entry_get_text(GTK_ENTRY(dataX))); + lengthX = strlen(slateX); + strcpy(slate20, gtk_entry_get_text(GTK_ENTRY(data20))); + length[20] = strlen(slate20); + if (!length[20] && lengthX) { + error(widget, GINT_TO_POINTER(3)); + return; + } + if (!finput) { + error(widget, GINT_TO_POINTER(8)); + return; + } + /* finput = stdout; */ + fprintf(finput, "\n@MANUAL{%s,\n", slateX); + fprintf(finput, " title = {%s}", slate20); + if (length[3]) + fprintf(finput, ",\n author = {%s}", slate3); + if (length[15]) + fprintf(finput, ",\n organization = {%s}", slate15); + if (length[1]) + fprintf(finput, ",\n address = {%s}", slate1); + if (length[6]) + fprintf(finput, ",\n edition = {%s}", slate6); + if (length[12]) + fprintf(finput, ",\n month = {%s}", slate12); + if (length[24]) + fprintf(finput, ",\n year = {%s}", slate24); + if (length[22]) + fprintf(finput, ",\n URL = {%s}", slate22); + if (length[2]) + fprintf(finput, ",\n note = {%s}", slate2); + if (length[13]) + fprintf(finput, ",\n annote = {%s}", slate13); + if (length[30]) + fprintf(finput, ",\n uplink = {%s}", slate30); + if (length[31]) + fprintf(finput, ",\n crosslink = {%s}", slate31); + if (length[32]) + fprintf(finput, ",\n externlink = {%s}", slate32); + fprintf(finput, " }\n"); + /* indicate that the reference is saved */ + format = 0; + length[1] = 0; + length[2] = 0; + length[3] = 0; + length[6] = 0; + length[12] = 0; + length[13] = 0; + length[15] = 0; + length[20] = 0; + length[22] = 0; + length[24] = 0; + length[30] = 0; + length[31] = 0; + length[32] = 0; + close_window(widget); /* remove this reference window */ +} + + +/* Save the Manual optional fields for subsequent saving */ + +void save_manualoptions(GtkWidget *widget) +{ + extern void close_window(); + extern int length[]; + extern char slate1[]; + extern char slate2[]; + extern char slate3[]; + extern char slate6[]; + extern char slate12[]; + extern char slate13[]; + extern char slate15[]; + extern char slate22[]; + extern char slate24[]; + char *text_in_field; + int count; + + strcpy(slate1, gtk_entry_get_text(GTK_ENTRY(data1))); + length[1] = strlen(slate1); + strcpy(slate3, gtk_entry_get_text(GTK_ENTRY(data3))); + length[3] = strlen(slate3); + strcpy(slate6, gtk_entry_get_text(GTK_ENTRY(data6))); + length[6] = strlen(slate6); + strcpy(slate12, gtk_entry_get_text(GTK_ENTRY(data12))); + length[12] = strlen(slate12); + count = gtk_text_buffer_get_char_count(text13); + gtk_text_buffer_get_iter_at_offset(text13, &end, count); + gtk_text_buffer_get_iter_at_offset(text13, &start, 0); + strcpy(slate13, gtk_text_buffer_get_text(text13, &start, &end, FALSE)); + length[13] = count; + strcpy(slate15, gtk_entry_get_text(GTK_ENTRY(data15))); + length[15] = strlen(slate15); + strcpy(slate22, gtk_entry_get_text(GTK_ENTRY(data22))); + length[22] = strlen(slate22); + strcpy(slate2, gtk_entry_get_text(GTK_ENTRY(data2))); + length[2] = strlen(slate2); + strcpy(slate24, gtk_entry_get_text(GTK_ENTRY(data24))); + length[24] = strlen(slate24); + close_window(widget); +} + + + + +/* Close the option entry window, but first delete the entries */ + +void close_manualoptions(GtkWidget *widget) +{ + extern void close_window(); + extern int length[]; + + length[1] = 0; + length[2] = 0; + length[3] = 0; + length[6] = 0; + length[12] = 0; + length[13] = 0; + length[15] = 0; + length[22] = 0; + length[24] = 0; + close_window(widget); +} + + +/* The procedure to put the optional Manual style fields on the screen */ + +void manualoptions(GtkWidget *widget) +{ + extern int format; + GtkTooltips *tooltips; + GtkWidget *window; + GtkWidget *decoration; + GtkWidget *totalPane; + GtkWidget *field0; + GtkWidget *field1; + GtkWidget *field2; + GtkWidget *field3; + GtkWidget *field4; + GtkWidget *field5; + GtkWidget *field6; + GtkWidget *field7; + GtkWidget *field8; + GtkWidget *key0; + GtkWidget *key1; + + void close_mamualoptions(); + void save_manualoptions(); + + if (format == 0) { + error (widget, GINT_TO_POINTER(6)); + return; + } + + /* create the tooltip help feature */ + + tooltips = gtk_tooltips_new(); + + window = gtk_window_new(GTK_WINDOW_TOPLEVEL); + gtk_window_set_title(GTK_WINDOW(window), "XBibFile create"); + gtk_window_position(GTK_WINDOW(window), GTK_WIN_POS_MOUSE); + gtk_widget_set_usize(GTK_WIDGET(window), 400, 635); + decoration = gtk_frame_new("Optional Manual fields"); + gtk_container_add(GTK_CONTAINER(window), decoration); + totalPane = gtk_vbox_new(FALSE, 5); + gtk_container_add(GTK_CONTAINER(decoration), totalPane); + + /* put the text fields in place */ + field1 = gtk_hbox_new(FALSE, 0); + data3 = gtk_entry_new_with_max_length(LARGE); + label3 = gtk_label_new("Author:"); + gtk_widget_set_usize(GTK_WIDGET(label3), 75, -1); + gtk_box_pack_start(GTK_BOX(field1), label3, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field1), data3, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field1, FALSE, TRUE, 10); + + field2 = gtk_hbox_new(FALSE, 0); + data15 = gtk_entry_new_with_max_length(LARGE); + label15 = gtk_label_new("Organization:"); + gtk_widget_set_usize(GTK_WIDGET(label15), 75, -1); + gtk_box_pack_start(GTK_BOX(field2), label15, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field2), data15, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field2, FALSE, TRUE, 2); + + field3 = gtk_hbox_new(FALSE, 0); + data1 = gtk_entry_new_with_max_length(LARGE); + label1 = gtk_label_new("Address:"); + gtk_widget_set_usize(GTK_WIDGET(label1), 75, -1); + gtk_box_pack_start(GTK_BOX(field3), label1, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field3), data1, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field3, FALSE, TRUE, 2); + + field4 = gtk_hbox_new(FALSE, 0); + data6 = gtk_entry_new_with_max_length(SMALL); + label6 = gtk_label_new("Edition:"); + gtk_widget_set_usize(GTK_WIDGET(label6), 75, -1); + gtk_box_pack_start(GTK_BOX(field4), label6, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field4), data6, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field4, FALSE, TRUE, 2); + + field5 = gtk_hbox_new(FALSE, 0); + data12 = gtk_entry_new_with_max_length(TINY); + label12 = gtk_label_new("Month:"); + gtk_widget_set_usize(GTK_WIDGET(label12), 75, -1); + gtk_box_pack_start(GTK_BOX(field5), label12, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field5), data12, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field5, FALSE, TRUE, 2); + + field6 = gtk_hbox_new(FALSE, 0); + data24 = gtk_entry_new_with_max_length(TINY); + label24 = gtk_label_new("Year:"); + gtk_widget_set_usize(GTK_WIDGET(label24), 75, -1); + gtk_box_pack_start(GTK_BOX(field6), label24, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field6), data24, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field6, FALSE, TRUE, 2); + + field7 = gtk_hbox_new(FALSE, 0); + data22 = gtk_entry_new_with_max_length(LARGE); + label22 = gtk_label_new("URL:"); + gtk_widget_set_usize(GTK_WIDGET(label22), 75, -1); + gtk_box_pack_start(GTK_BOX(field7), label22, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field7), data22, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field7, FALSE, TRUE, 2); + + field8 = gtk_hbox_new(FALSE, 0); + data2 = gtk_entry_new_with_max_length(LARGE); + label2 = gtk_label_new("note:"); + gtk_widget_set_usize(GTK_WIDGET(label2), 75, -1); + gtk_box_pack_start(GTK_BOX(field8), label2, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field8), data2, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field8, FALSE, TRUE, 2); + + text13 = gtk_text_buffer_new(NULL); + data13 = gtk_text_view_new_with_buffer(text13); + textscroll = gtk_scrolled_window_new(NULL, NULL); + font_desc = pango_font_description_from_string("Sans 12"); + gtk_widget_modify_font(data13, font_desc); + gtk_container_add(GTK_CONTAINER(textscroll), data13); + gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(textscroll), + GTK_POLICY_AUTOMATIC, + GTK_POLICY_AUTOMATIC); + gtk_widget_set_usize(GTK_WIDGET(data13), 30, 250); + label13 = gtk_label_new("Annotation:"); + gtk_box_pack_start(GTK_BOX(totalPane), label13, FALSE, TRUE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), textscroll, FALSE, TRUE, 2); + + /* finally, put the cancel button in place */ + field0 = gtk_hbox_new(FALSE, 0); + key0 = gtk_button_new_with_label("CANCEL"); + gtk_widget_set_usize(GTK_WIDGET(key0), 90, -1); + g_signal_connect(GTK_OBJECT(key0), "clicked", + G_CALLBACK(close_manualoptions), NULL); + gtk_tooltips_set_tip(tooltips, key0, + "Discard the contents of this window", NULL); + gtk_box_pack_end(GTK_BOX(field0), key0, FALSE, FALSE, 10); + key1 = gtk_button_new_with_label("Save"); + gtk_widget_set_usize(GTK_WIDGET(key1), 90, -1); + g_signal_connect(GTK_OBJECT(key1), "clicked", + G_CALLBACK(save_manualoptions), NULL); + gtk_tooltips_set_tip(tooltips, key1, + "Store the contents of this window", NULL); + gtk_box_pack_end(GTK_BOX(field0), key1, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field0, FALSE, TRUE, 10); + + /* put the composite window on the screen */ + gtk_widget_show_all(window); +} + + + +/* The procedure to put the basic Manual style on the screen */ + +void manual(GtkWidget *widget) +{ + GtkTooltips *tooltips; + GtkWidget *window; + GtkWidget *decoration; + GtkWidget *totalPane; + GtkWidget *opDecoration; + GtkWidget *field0; + GtkWidget *field1; + GtkWidget *option; + GtkWidget *controls; + GtkWidget *key1; + GtkWidget *key2; + GtkWidget *key3; + GtkWidget *key4; + GtkWidget *field2; + GtkWidget *field3; + GtkWidget *field4; + GtkWidget *field5; + extern int format; + extern char slate0[]; + + extern void linkwindow(); + extern void closure_check(); /* defined in file cleanup.c */ + extern void close_window(); /* defined in file cleanup.c */ + void manualoptions(); + void save_manual(); + + /* create the tooltip help feature */ + + tooltips = gtk_tooltips_new(); + + format = 8; /* indicate processing of a MANUAL */ + + /* create the wondow and its top panel */ + window = gtk_window_new(GTK_WINDOW_TOPLEVEL); + gtk_window_set_title(GTK_WINDOW(window), "XBibFile create"); + gtk_window_position(GTK_WINDOW(window), GTK_WIN_POS_MOUSE); + decoration = gtk_frame_new("Manual type - required field"); + gtk_widget_set_usize(GTK_WIDGET(window), 450, 235); + gtk_container_add(GTK_CONTAINER(window), decoration); + totalPane = gtk_vbox_new(FALSE, 5); + gtk_container_add(GTK_CONTAINER(decoration), totalPane); + + field1 = gtk_hbox_new(FALSE,0); + dataX = gtk_entry_new_with_max_length(SMALL); + gtk_widget_set_usize(GTK_WIDGET(dataX), 345, -1); + labelX = gtk_label_new("Tag/s:"); + gtk_widget_set_usize(GTK_WIDGET(labelX), 65, -1); + gtk_box_pack_start(GTK_BOX(field1), labelX, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field1), dataX, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field1, FALSE, TRUE, 10); + + field0 = gtk_hbox_new(FALSE, 0); + data0 = gtk_entry_new_with_max_length(LARGE); + gtk_widget_set_usize(GTK_WIDGET(data0), 345, -1); + label0 = gtk_label_new("File used:"); + gtk_widget_set_usize(GTK_WIDGET(label0), 65, -1); + gtk_entry_set_text(GTK_ENTRY(data0), slate0); + gtk_box_pack_start(GTK_BOX(field0), label0, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field0), data0, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field0, FALSE, TRUE, 2); + + /* position the remaining field entries */ + field2 = gtk_hbox_new(FALSE, 0); + data20 = gtk_entry_new_with_max_length(LARGE); + gtk_widget_set_usize(GTK_WIDGET(data20), 345, -1); + label20 = gtk_label_new("Title:"); + gtk_widget_set_usize(GTK_WIDGET(label20), 65, -1); + gtk_box_pack_start(GTK_BOX(field2), label20, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field2), data20, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field2, FALSE, TRUE, 8); + + /* put the control keys on to the window */ + option = gtk_hbox_new(FALSE, 0); + key2 = gtk_button_new_with_label("Optional fields"); + gtk_widget_set_usize(GTK_WIDGET(key2), 130, -1); + g_signal_connect(GTK_OBJECT(key2), "clicked", + G_CALLBACK(manualoptions), NULL); + gtk_tooltips_set_tip(tooltips, key2, + "Click here to get window containing remaining Manual fields", + NULL); + gtk_box_pack_start(GTK_BOX(option), key2, FALSE, FALSE, 10); + controls = gtk_hbox_new(FALSE, 0); + key1 = gtk_button_new_with_label("Save"); + gtk_widget_set_usize(GTK_WIDGET(key1), 90, -1); + g_signal_connect(GTK_OBJECT(key1), "clicked", + G_CALLBACK(save_manual), NULL); + gtk_tooltips_set_tip(tooltips, key1, + "Store this Manual reference in database", NULL); + gtk_box_pack_start(GTK_BOX(controls), key1, FALSE, FALSE, 30); + key3 = gtk_button_new_with_label("Cancel"); + gtk_widget_set_usize(GTK_WIDGET(key3), 90, -1); + g_signal_connect(GTK_OBJECT(key3), "clicked", + G_CALLBACK(closure_check), NULL); + gtk_tooltips_set_tip(tooltips, key3, + "Discard this Manual entry", NULL); + gtk_box_pack_start(GTK_BOX(controls), key3, FALSE, FALSE, 30); + key4 = gtk_button_new_with_label("Linking"); + gtk_widget_set_usize(GTK_WIDGET(key4), 90, -1); + g_signal_connect(GTK_OBJECT(key4), "clicked", + G_CALLBACK(linkwindow), NULL); + gtk_tooltips_set_tip(tooltips, key4, + "Click here for window to create links for this Manual", + NULL); + gtk_box_pack_start(GTK_BOX(controls), key4, FALSE, FALSE, 30); + gtk_box_pack_start(GTK_BOX(totalPane), option, FALSE, TRUE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), controls, FALSE, TRUE, 10); + + + format = 8; + + /* make the composite visible on screen */ + gtk_widget_show_all(window); +} + + diff --git a/biblio/bibtex/utils/xbibfile/masters.c b/biblio/bibtex/utils/xbibfile/masters.c new file mode 100644 index 0000000000..eaefc2dc74 --- /dev/null +++ b/biblio/bibtex/utils/xbibfile/masters.c @@ -0,0 +1,456 @@ +/* This file is a part of XBibFile - a system for handling BibTeX references + * + * Author: Ross Maloney + * Date: October 1999 + * Modified: january 2002 + * + */ + +#include <stdio.h> +#include <gtk/gtk.h> + +#include "xbibfile.h" + +/* This file is a modified copy of phd.c so that it handles the + * Masters thesis BibTeX reference style */ + + +GtkWidget *labelX, *dataX; +GtkWidget *label0, *data0; +GtkWidget *label1, *data1; +GtkWidget *label2, *data2; +GtkWidget *label3, *data3; +GtkWidget *label12, *data12; +GtkWidget *label13, *data13, *textscroll; +GtkWidget *label18, *data18; +GtkWidget *label20, *data20; +GtkWidget *label21, *data21; +GtkWidget *label22, *data22; +GtkWidget *label24, *data24; +GtkWidget *label30, *data30; +GtkWidget *label31, *data31; +GtkWidget *label32, *data32; +GtkTextBuffer *text13; +GtkTextIter start, end; +PangoFontDescription *font_desc; + + + + +/* The procedure to save the Masters thesis style */ + +void save_masters(GtkWidget *widget) +{ + extern int format; + extern int length[]; + extern char slate[][]; + extern int lengthX; + extern char slateX[]; + extern char slate1[]; + extern char slate2[]; + extern char slate3[]; + extern char slate12[]; + extern char slate13[]; + extern char slate18[]; + extern char slate20[]; + extern char slate21[]; + extern char slate22[]; + extern char slate24[]; + extern char slate30[]; + extern char slate31[]; + extern char slate32[]; + extern void error(); /* defined in file error.c */ + extern FILE *finput; /* defined in file xbibfile.c */ + extern void close_window(); /* defined in file cleanup.c */ + + if (format != 9) { + error(widget, GINT_TO_POINTER(5)); + return; + } + strcpy(slateX, gtk_entry_get_text(GTK_ENTRY(dataX))); + lengthX = strlen(slateX); + strcpy(slate3, gtk_entry_get_text(GTK_ENTRY(data3))); + length[3] = strlen(slate3); + strcpy(slate18, gtk_entry_get_text(GTK_ENTRY(data18))); + length[18] = strlen(slate18); + strcpy(slate20, gtk_entry_get_text(GTK_ENTRY(data20))); + length[20] = strlen(slate20); + strcpy(slate24, gtk_entry_get_text(GTK_ENTRY(data24))); + length[24] = strlen(slate24); + if (!(length[3] && length[18] && length[20] && length[24] && lengthX)) { + error(widget, GINT_TO_POINTER(3)); + return; + } + if (!finput) { + error(widget, GINT_TO_POINTER(8)); + return; + } + /* finput = stdout; */ + fprintf(finput, "\n@MASTERSTHESIS{%s,\n", slateX); + fprintf(finput, " author = {%s},\n", slate3); + fprintf(finput, " title = {%s},\n", slate20); + fprintf(finput, " school = {%s},\n", slate18); + fprintf(finput, " year = {%s}", slate24); + if (length[21]) + fprintf(finput, ",\n type = {%s}", slate21); + if (length[1]) + fprintf(finput, ",\n address = {%s}", slate1); + if (length[12]) + fprintf(finput, ",\n month = {%s}", slate12); + if (length[22]) + fprintf(finput, ",\n URL = {%s}", slate22); + if (length[2]) + fprintf(finput, ",\n note = {%s}", slate2); + if (length[13]) + fprintf(finput, ",\n annote = {%s}", slate13); + if (length[30]) + fprintf(finput, ",\n uplink = {%s}", slate30); + if (length[31]) + fprintf(finput, ",\n crosslink = {%s}", slate31); + if (length[32]) + fprintf(finput, ",\n externlink = {%s}", slate32); + fprintf(finput, " }\n"); + /* indicate that the reference is saved */ + format = 0; + length[1] = 0; + length[2] = 0; + length[12] = 0; + length[13] = 0; + length[21] = 0; + length[22] = 0; + length[30] = 0; + length[31] = 0; + length[32] = 0; + close_window(widget); /* remove this reference window */ +} + + +/* Save the Masters thesis optional fields for subsequent saving */ + +void save_mastersoptions(GtkWidget *widget) +{ + extern void close_window(); + extern int length[]; + extern char slate1[]; + extern char slate2[]; + extern char slate12[]; + extern char slate13[]; + extern char slate21[]; + extern char slate22[]; + char *text_in_field; + int count; + + strcpy(slate1, gtk_entry_get_text(GTK_ENTRY(data1))); + length[1] = strlen(slate1); + strcpy(slate12, gtk_entry_get_text(GTK_ENTRY(data12))); + length[12] = strlen(slate12); + count = gtk_text_buffer_get_char_count(text13); + gtk_text_buffer_get_iter_at_offset(text13, &end, count); + gtk_text_buffer_get_iter_at_offset(text13, &start, 0); + strcpy(slate13, gtk_text_buffer_get_text(text13, &start, &end, FALSE)); + length[13] = count; + strcpy(slate21, gtk_entry_get_text(GTK_ENTRY(data21))); + length[21] = strlen(slate21); + strcpy(slate22, gtk_entry_get_text(GTK_ENTRY(data22))); + length[22] = strlen(slate22); + strcpy(slate2, gtk_entry_get_text(GTK_ENTRY(data2))); + length[2] = strlen(slate2); + close_window(widget); +} + + + + +/* Close the option entry window, but first delete the entries */ + +void close_mastersoptions(GtkWidget *widget) +{ + extern void close_window(); + extern int length[]; + + length[1] = 0; + length[2] = 0; + length[12] = 0; + length[13] = 0; + length[21] = 0; + length[22] = 0; + close_window(widget); +} + + +/* The procedure to put the optional Masters thesis style field + * on the screen */ + +void mastersoptions(GtkWidget *widget) +{ + extern int format; + GtkTooltips *tooltips; + GtkWidget *window; + GtkWidget *decoration; + GtkWidget *totalPane; + GtkWidget *field0; + GtkWidget *field1; + GtkWidget *field2; + GtkWidget *field3; + GtkWidget *field4; + GtkWidget *field5; + GtkWidget *key0; + GtkWidget *key1; + + void close_mastersoptions(); + void save_mastersoptions(); + + if (format == 0) { + error (widget, GINT_TO_POINTER(6)); + return; + } + + /* create the tooltip help feature */ + + tooltips = gtk_tooltips_new(); + + window = gtk_window_new(GTK_WINDOW_TOPLEVEL); + gtk_window_set_title(GTK_WINDOW(window), "XBibFile create"); + gtk_window_position(GTK_WINDOW(window), GTK_WIN_POS_MOUSE); + gtk_widget_set_usize(GTK_WIDGET(window), 400, 540); + decoration = gtk_frame_new("Optional Masters thesis fields"); + gtk_container_add(GTK_CONTAINER(window), decoration); + totalPane = gtk_vbox_new(FALSE, 5); + gtk_container_add(GTK_CONTAINER(decoration), totalPane); + + /* put the text fields in place */ + field1 = gtk_hbox_new(FALSE, 0); + data21 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data21), TINY); + label21 = gtk_label_new("Type:"); + gtk_widget_set_usize(GTK_WIDGET(label21), 75, -1); + gtk_box_pack_start(GTK_BOX(field1), label21, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field1), data21, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field1, FALSE, TRUE, 10); + + field2 = gtk_hbox_new(FALSE, 0); + data1 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data1), LARGE); + label1 = gtk_label_new("Address:"); + gtk_widget_set_usize(GTK_WIDGET(label1), 75, -1); + gtk_box_pack_start(GTK_BOX(field2), label1, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field2), data1, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field2, FALSE, TRUE, 2); + + field3 = gtk_hbox_new(FALSE, 0); + data12 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data12), TINY); + label12 = gtk_label_new("Month:"); + gtk_widget_set_usize(GTK_WIDGET(label12), 75, -1); + gtk_box_pack_start(GTK_BOX(field3), label12, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field3), data12, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field3, FALSE, TRUE, 2); + + field4 = gtk_hbox_new(FALSE, 0); + data22 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data22), LARGE); + label22 = gtk_label_new("URL:"); + gtk_widget_set_usize(GTK_WIDGET(label22), 75, -1); + gtk_box_pack_start(GTK_BOX(field4), label22, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field4), data22, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field4, FALSE, TRUE, 2); + + field5 = gtk_hbox_new(FALSE, 0); + data2 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data2), LARGE); + label2 = gtk_label_new("note:"); + gtk_widget_set_usize(GTK_WIDGET(label2), 75, -1); + gtk_box_pack_start(GTK_BOX(field5), label2, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field5), data2, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field5, FALSE, TRUE, 2); + + text13 = gtk_text_buffer_new(NULL); + data13 = gtk_text_view_new_with_buffer(text13); + textscroll = gtk_scrolled_window_new(NULL, NULL); + font_desc = pango_font_description_from_string("Sans 12"); + gtk_widget_modify_font(data13, font_desc); + gtk_container_add(GTK_CONTAINER(textscroll), data13); + gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(textscroll), + GTK_POLICY_AUTOMATIC, + GTK_POLICY_AUTOMATIC); + gtk_widget_set_usize(GTK_WIDGET(data13), 30, 250); + label13 = gtk_label_new("Annotation:"); + gtk_box_pack_start(GTK_BOX(totalPane), label13, FALSE, TRUE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), textscroll, FALSE, TRUE, 2); + + /* finally, put the cancel button in place */ + field0 = gtk_hbox_new(FALSE, 0); + key0 = gtk_button_new_with_label("CANCEL"); + gtk_widget_set_usize(GTK_WIDGET(key0), 90, -1); + g_signal_connect(GTK_OBJECT(key0), "clicked", + G_CALLBACK(close_mastersoptions), NULL); + gtk_tooltips_set_tip(tooltips, key0, + "Discard the contents of this window", NULL); + gtk_box_pack_end(GTK_BOX(field0), key0, FALSE, FALSE, 10); + key1 = gtk_button_new_with_label("Save"); + gtk_widget_set_usize(GTK_WIDGET(key1), 90, -1); + g_signal_connect(GTK_OBJECT(key1), "clicked", + G_CALLBACK(save_mastersoptions), NULL); + gtk_tooltips_set_tip(tooltips, key1, + "Store the contents of this window", NULL); + gtk_box_pack_end(GTK_BOX(field0), key1, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field0, FALSE, TRUE, 10); + + /* put the composite window on the screen */ + gtk_widget_show_all(window); +} + + + +/* The procedure to put the basic Masters thesis style on the screen */ + +void masters(GtkWidget *widget) +{ + GtkTooltips *tooltips; + GtkWidget *window; + GtkWidget *decoration; + GtkWidget *totalPane; + GtkWidget *opDecoration; + GtkWidget *field0; + GtkWidget *field1; + GtkWidget *option; + GtkWidget *controls; + GtkWidget *key1; + GtkWidget *key2; + GtkWidget *key3; + GtkWidget *key4; + GtkWidget *field2; + GtkWidget *field3; + GtkWidget *field4; + GtkWidget *field5; + extern int format; + extern char slate0[]; + + extern void linkwindow(); + extern void closure_check(); /* defined in file cleanup.c */ + extern void close_window(); /* defined in file cleanup.c */ + void mastersoptions(); + void save_masters(); + + /* create the tooltip help feature */ + + tooltips = gtk_tooltips_new(); + + format = 9; /* indicate processing of an MASTERS THESIS */ + + /* create the wondow and its top panel */ + window = gtk_window_new(GTK_WINDOW_TOPLEVEL); + gtk_window_set_title(GTK_WINDOW(window), "XBibFile create"); + gtk_window_position(GTK_WINDOW(window), GTK_WIN_POS_MOUSE); + decoration = gtk_frame_new("Masters thesis type - required fields"); + gtk_widget_set_usize(GTK_WIDGET(window), 450, 330); + gtk_container_add(GTK_CONTAINER(window), decoration); + totalPane = gtk_vbox_new(FALSE, 5); + gtk_container_add(GTK_CONTAINER(decoration), totalPane); + + field1 = gtk_hbox_new(FALSE,0); + dataX = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(dataX), SMALL); + gtk_widget_set_usize(GTK_WIDGET(dataX), 345, -1); + labelX = gtk_label_new("Tag/s:"); + gtk_widget_set_usize(GTK_WIDGET(labelX), 65, -1); + gtk_box_pack_start(GTK_BOX(field1), labelX, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field1), dataX, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field1, FALSE, TRUE, 10); + + field0 = gtk_hbox_new(FALSE, 0); + data0 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data0), LARGE); + gtk_widget_set_usize(GTK_WIDGET(data0), 345, -1); + label0 = gtk_label_new("File used:"); + gtk_widget_set_usize(GTK_WIDGET(label0), 65, -1); + gtk_entry_set_text(GTK_ENTRY(data0), slate0); + gtk_box_pack_start(GTK_BOX(field0), label0, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field0), data0, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field0, FALSE, TRUE, 2); + + /* position the remaining field entries */ + field2 = gtk_hbox_new(FALSE, 0); + data3 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data3), LARGE); + gtk_widget_set_usize(GTK_WIDGET(data3), 345, -1); + label3 = gtk_label_new("Author/s:"); + gtk_widget_set_usize(GTK_WIDGET(label3), 65, -1); + gtk_box_pack_start(GTK_BOX(field2), label3, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field2), data3, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field2, FALSE, TRUE, 2); + + field3 = gtk_hbox_new(FALSE, 0); + data20 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data20), LARGE); + gtk_widget_set_usize(GTK_WIDGET(data20), 345, -1); + label20 = gtk_label_new("Title:"); + gtk_widget_set_usize(GTK_WIDGET(label20), 65, -1); + gtk_box_pack_start(GTK_BOX(field3), label20, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field3), data20, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field3, FALSE, TRUE, 2); + + field4 = gtk_hbox_new(FALSE, 0); + data18 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data18), LARGE); + gtk_widget_set_usize(GTK_WIDGET(data18), 345, -1); + label18 = gtk_label_new("School:"); + gtk_widget_set_usize(GTK_WIDGET(label18), 65, -1); + gtk_box_pack_start(GTK_BOX(field4), label18, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field4), data18, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field4, FALSE, TRUE, 2); + + field5 = gtk_hbox_new(FALSE, 0); + data24 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data24), TINY); + gtk_widget_set_usize(GTK_WIDGET(data24), 200, -1); + label24 = gtk_label_new("Year:"); + gtk_widget_set_usize(GTK_WIDGET(label24), 65, -1); + gtk_box_pack_start(GTK_BOX(field5), label24, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field5), data24, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field5, FALSE, TRUE, 2); + + /* put the control keys on to the window */ + option = gtk_hbox_new(FALSE, 0); + key2 = gtk_button_new_with_label("Optional fields"); + gtk_widget_set_usize(GTK_WIDGET(key2), 130, -1); + g_signal_connect(GTK_OBJECT(key2), "clicked", + G_CALLBACK(mastersoptions), NULL); + gtk_tooltips_set_tip(tooltips, key2, + "Click here to get window containing remaining Masters fields", + NULL); + gtk_box_pack_start(GTK_BOX(option), key2, FALSE, FALSE, 10); + controls = gtk_hbox_new(FALSE, 0); + key1 = gtk_button_new_with_label("Save"); + gtk_widget_set_usize(GTK_WIDGET(key1), 90, -1); + g_signal_connect(GTK_OBJECT(key1), "clicked", + G_CALLBACK(save_masters), NULL); + gtk_tooltips_set_tip(tooltips, key1, + "Store this Masters reference in database", NULL); + gtk_box_pack_start(GTK_BOX(controls), key1, FALSE, FALSE, 30); + key3 = gtk_button_new_with_label("Cancel"); + gtk_widget_set_usize(GTK_WIDGET(key3), 90, -1); + g_signal_connect(GTK_OBJECT(key3), "clicked", + G_CALLBACK(closure_check), NULL); + gtk_tooltips_set_tip(tooltips, key3, + "Discard this Masters entry", NULL); + gtk_box_pack_start(GTK_BOX(controls), key3, FALSE, FALSE, 30); + key4 = gtk_button_new_with_label("Linking"); + gtk_widget_set_usize(GTK_WIDGET(key4), 90, -1); + g_signal_connect(GTK_OBJECT(key4), "clicked", + G_CALLBACK(linkwindow), NULL); + gtk_tooltips_set_tip(tooltips, key4, + "Click here for window to create links for this Masters", + NULL); + gtk_box_pack_start(GTK_BOX(controls), key4, FALSE, FALSE, 30); + gtk_box_pack_start(GTK_BOX(totalPane), option, FALSE, TRUE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), controls, FALSE, TRUE, 10); + + + format = 9; + + /* make the composite visible on screen */ + gtk_widget_show_all(window); +} + + diff --git a/biblio/bibtex/utils/xbibfile/misc.c b/biblio/bibtex/utils/xbibfile/misc.c new file mode 100644 index 0000000000..8423c479b7 --- /dev/null +++ b/biblio/bibtex/utils/xbibfile/misc.c @@ -0,0 +1,432 @@ +/* This file is a part of XBibFile - a system for handling BibTeX references + * + * Author: Ross Maloney + * Date: October 1999 + * Modified: January 2002 + * + */ + +#include <stdio.h> +#include <gtk/gtk.h> + +#include "xbibfile.h" + +/* This file is a modified copy of manual.c so that it handles the + * Misc BibTeX reference style */ + + +GtkWidget *labelX, *dataX; +GtkWidget *label0, *data0; +GtkWidget *label2, *data2; +GtkWidget *label3, *data3; +GtkWidget *label8, *data8; +GtkWidget *label12, *data12; +GtkWidget *label13, *data13, *textscroll; +GtkWidget *label20, *data20; +GtkWidget *label22, *data22; +GtkWidget *label24, *data24; +GtkWidget *label30, *data30; +GtkWidget *label31, *data31; +GtkWidget *label32, *data32; +GtkTextBuffer *text13; +GtkTextIter start, end; +PangoFontDescription *font_desc; + + + + +/* The procedure to save the Misc style */ + +void save_misc(GtkWidget *widget) +{ + extern int format; + extern int length[]; + extern char slate[][]; + extern int lengthX; + extern char slateX[]; + extern char slate2[]; + extern char slate3[]; + extern char slate8[]; + extern char slate12[]; + extern char slate13[]; + extern char slate20[]; + extern char slate22[]; + extern char slate24[]; + extern char slate30[]; + extern char slate31[]; + extern char slate32[]; + extern void error(); /* defined in file error.c */ + extern FILE *finput; /* defined in file xbibfile.c */ + extern void close_window(); /* defined in file cleanup.c */ + + if (format != 10) { + error(widget, GINT_TO_POINTER(5)); + return; + } + strcpy(slateX, gtk_entry_get_text(GTK_ENTRY(dataX))); + lengthX = strlen(slateX); + if (!lengthX) { + error(widget, GINT_TO_POINTER(3)); + return; + } + if (!finput) { + error(widget, GINT_TO_POINTER(8)); + return; + } + /* finput = stdout; */ + fprintf(finput, "\n@MISC{%s", slateX); + if (length[3]) + fprintf(finput, ",\n author = {%s}", slate3); + if (length[20]) + fprintf(finput, ",\n title = {%s}", slate20); + if (length[8]) + fprintf(finput, ",\n howpublished = {%s}", slate8); + if (length[12]) + fprintf(finput, ",\n month = {%s}", slate12); + if (length[24]) + fprintf(finput, ",\n year = {%s}", slate24); + if (length[22]) + fprintf(finput, ",\n URL = {%s}", slate22); + if (length[2]) + fprintf(finput, ",\n note = {%s}", slate2); + if (length[13]) + fprintf(finput, ",\n annote = {%s}", slate13); + if (length[30]) + fprintf(finput, ",\n uplink = {%s}", slate30); + if (length[31]) + fprintf(finput, ",\n crosslink = {%s}", slate31); + if (length[32]) + fprintf(finput, ",\n externlink = {%s}", slate32); + fprintf(finput, " }\n"); + /* indicate that the reference is saved */ + format = 0; + length[2] = 0; + length[3] = 0; + length[8] = 0; + length[12] = 0; + length[13] = 0; + length[20] = 0; + length[22] = 0; + length[24] = 0; + length[30] = 0; + length[31] = 0; + length[32] = 0; + close_window(widget); /* remove this reference window */ +} + + +/* Save the Misc optional fields for subsequent saving */ + +void save_miscoptions(GtkWidget *widget) +{ + extern void close_window(); + extern int length[]; + extern char slate2[]; + extern char slate3[]; + extern char slate8[]; + extern char slate12[]; + extern char slate13[]; + extern char slate20[]; + extern char slate22[]; + extern char slate24[]; + char *text_in_field; + int count; + + strcpy(slate3, gtk_entry_get_text(GTK_ENTRY(data3))); + length[3] = strlen(slate3); + strcpy(slate8, gtk_entry_get_text(GTK_ENTRY(data8))); + length[8] = strlen(slate8); + strcpy(slate12, gtk_entry_get_text(GTK_ENTRY(data12))); + length[12] = strlen(slate12); + count = gtk_text_buffer_get_char_count(text13); + gtk_text_buffer_get_iter_at_offset(text13, &end, count); + gtk_text_buffer_get_iter_at_offset(text13, &start, 0); + strcpy(slate13, gtk_text_buffer_get_text(text13, &start, &end, FALSE)); + length[13] = count; + strcpy(slate20, gtk_entry_get_text(GTK_ENTRY(data20))); + length[20] = strlen(slate20); + strcpy(slate22, gtk_entry_get_text(GTK_ENTRY(data22))); + length[22] = strlen(slate22); + strcpy(slate2, gtk_entry_get_text(GTK_ENTRY(data2))); + length[2] = strlen(slate2); + strcpy(slate24, gtk_entry_get_text(GTK_ENTRY(data24))); + length[24] = strlen(slate24); + close_window(widget); +} + + + + +/* Close the option entry window, but first delete the entries */ + +void close_miscoptions(GtkWidget *widget) +{ + extern void close_window(); + extern int length[]; + + length[2] = 0; + length[3] = 0; + length[8] = 0; + length[12] = 0; + length[13] = 0; + length[20] = 0; + length[22] = 0; + length[24] = 0; + close_window(widget); +} + + +/* The procedure to put the optional Misc style fields on the screen */ + +void miscoptions(GtkWidget *widget) +{ + extern int format; + GtkTooltips *tooltips; + GtkWidget *window; + GtkWidget *decoration; + GtkWidget *totalPane; + GtkWidget *field0; + GtkWidget *field1; + GtkWidget *field2; + GtkWidget *field3; + GtkWidget *field4; + GtkWidget *field5; + GtkWidget *field6; + GtkWidget *field7; + GtkWidget *key0; + GtkWidget *key1; + + void close_mamualoptions(); + void save_miscoptions(); + + if (format == 0) { + error (widget, GINT_TO_POINTER(6)); + return; + } + + /* create the tooltip help feature */ + + tooltips = gtk_tooltips_new(); + + window = gtk_window_new(GTK_WINDOW_TOPLEVEL); + gtk_window_set_title(GTK_WINDOW(window), "XBibFile create"); + gtk_window_position(GTK_WINDOW(window), GTK_WIN_POS_MOUSE); + gtk_widget_set_usize(GTK_WIDGET(window), 400, 605); + decoration = gtk_frame_new("Optional Misc fields"); + gtk_container_add(GTK_CONTAINER(window), decoration); + totalPane = gtk_vbox_new(FALSE, 5); + gtk_container_add(GTK_CONTAINER(decoration), totalPane); + + /* put the text fields in place */ + field1 = gtk_hbox_new(FALSE, 0); + data3 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data3), LARGE); + label3 = gtk_label_new("Author/s:"); + gtk_widget_set_usize(GTK_WIDGET(label3), 80, -1); + gtk_box_pack_start(GTK_BOX(field1), label3, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field1), data3, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field1, FALSE, TRUE, 10); + + field2 = gtk_hbox_new(FALSE, 0); + data20 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data20), LARGE); + label20 = gtk_label_new("Title:"); + gtk_widget_set_usize(GTK_WIDGET(label20), 80, -1); + gtk_box_pack_start(GTK_BOX(field2), label20, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field2), data20, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field2, FALSE, TRUE, 2); + + field3 = gtk_hbox_new(FALSE, 0); + data8 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data8), SMALL); + label8 = gtk_label_new("Howpublished:"); + gtk_widget_set_usize(GTK_WIDGET(label8), 80, -1); + gtk_box_pack_start(GTK_BOX(field3), label8, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field3), data8, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field3, FALSE, TRUE, 2); + + field4 = gtk_hbox_new(FALSE, 0); + data12 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data12), TINY); + label12 = gtk_label_new("Month:"); + gtk_widget_set_usize(GTK_WIDGET(label12), 80, -1); + gtk_box_pack_start(GTK_BOX(field4), label12, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field4), data12, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field4, FALSE, TRUE, 2); + + field5 = gtk_hbox_new(FALSE, 0); + data24 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data24), TINY); + label24 = gtk_label_new("Year:"); + gtk_widget_set_usize(GTK_WIDGET(label24), 80, -1); + gtk_box_pack_start(GTK_BOX(field5), label24, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field5), data24, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field5, FALSE, TRUE, 2); + + field6 = gtk_hbox_new(FALSE, 0); + data22 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data22), LARGE); + label22 = gtk_label_new("URL:"); + gtk_widget_set_usize(GTK_WIDGET(label22), 80, -1); + gtk_box_pack_start(GTK_BOX(field6), label22, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field6), data22, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field6, FALSE, TRUE, 2); + + field7 = gtk_hbox_new(FALSE, 0); + data2 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data2), LARGE); + label2 = gtk_label_new("note:"); + gtk_widget_set_usize(GTK_WIDGET(label2), 80, -1); + gtk_box_pack_start(GTK_BOX(field7), label2, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field7), data2, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field7, FALSE, TRUE, 2); + + text13 = gtk_text_buffer_new(NULL); + data13 = gtk_text_view_new_with_buffer(text13); + textscroll = gtk_scrolled_window_new(NULL, NULL); + font_desc = pango_font_description_from_string("Sans 12"); + gtk_widget_modify_font(data13, font_desc); + gtk_container_add(GTK_CONTAINER(textscroll), data13); + gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(textscroll), + GTK_POLICY_AUTOMATIC, + GTK_POLICY_AUTOMATIC); + gtk_widget_set_usize(GTK_WIDGET(data13), 30, 250); + label13 = gtk_label_new("Annotation:"); + gtk_box_pack_start(GTK_BOX(totalPane), label13, FALSE, TRUE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), textscroll, FALSE, TRUE, 2); + + /* finally, put the cancel button in place */ + field0 = gtk_hbox_new(FALSE, 0); + key0 = gtk_button_new_with_label("CANCEL"); + gtk_widget_set_usize(GTK_WIDGET(key0), 90, -1); + g_signal_connect(GTK_OBJECT(key0), "clicked", + G_CALLBACK(close_miscoptions), NULL); + gtk_tooltips_set_tip(tooltips, key0, + "Discard the contents of this window", NULL); + gtk_box_pack_end(GTK_BOX(field0), key0, FALSE, FALSE, 10); + key1 = gtk_button_new_with_label("Save"); + gtk_widget_set_usize(GTK_WIDGET(key1), 90, -1); + g_signal_connect(GTK_OBJECT(key1), "clicked", + G_CALLBACK(save_miscoptions), NULL); + gtk_tooltips_set_tip(tooltips, key1, + "Store the contents of this window", NULL); + gtk_box_pack_end(GTK_BOX(field0), key1, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field0, FALSE, TRUE, 10); + + /* put the composite window on the screen */ + gtk_widget_show_all(window); +} + + + +/* The procedure to put the basic Misc style on the screen */ + +void misc(GtkWidget *widget) +{ + GtkTooltips *tooltips; + GtkWidget *window; + GtkWidget *decoration; + GtkWidget *totalPane; + GtkWidget *opDecoration; + GtkWidget *field0; + GtkWidget *field1; + GtkWidget *option; + GtkWidget *controls; + GtkWidget *key1; + GtkWidget *key2; + GtkWidget *key3; + GtkWidget *key4; + GtkWidget *field2; + GtkWidget *field3; + GtkWidget *field4; + GtkWidget *field5; + extern int format; + extern char slate0[]; + + extern void linkwindow(); + extern void closure_check(); /* defined in file cleanup.c */ + extern void close_window(); /* defined in file cleanup.c */ + void miscoptions(); + void save_misc(); + + /* create the tooltip help feature */ + + tooltips = gtk_tooltips_new(); + + format = 10; /* indicate processing of a MISC */ + + /* create the wondow and its top panel */ + window = gtk_window_new(GTK_WINDOW_TOPLEVEL); + gtk_window_set_title(GTK_WINDOW(window), "XBibFile create"); + gtk_window_position(GTK_WINDOW(window), GTK_WIN_POS_MOUSE); + decoration = gtk_frame_new("Misc type - required fields"); + gtk_widget_set_usize(GTK_WIDGET(decoration), 450, 195); + gtk_container_add(GTK_CONTAINER(window), decoration); + totalPane = gtk_vbox_new(FALSE, 5); + gtk_container_add(GTK_CONTAINER(decoration), totalPane); + + field1 = gtk_hbox_new(FALSE,0); + dataX = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(dataX), SMALL); + gtk_widget_set_usize(GTK_WIDGET(dataX), 345, -1); + labelX = gtk_label_new("Tag/s:"); + gtk_widget_set_usize(GTK_WIDGET(labelX), 65, -1); + gtk_box_pack_start(GTK_BOX(field1), labelX, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field1), dataX, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field1, FALSE, TRUE, 10); + + field0 = gtk_hbox_new(FALSE, 0); + data0 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data0), LARGE); + gtk_widget_set_usize(GTK_WIDGET(data0), 345, -1); + label0 = gtk_label_new("File used:"); + gtk_widget_set_usize(GTK_WIDGET(label0), 65, -1); + gtk_entry_set_text(GTK_ENTRY(data0), slate0); + gtk_box_pack_start(GTK_BOX(field0), label0, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field0), data0, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field0, FALSE, TRUE, 2); + + /* put the control keys on to the window */ + option = gtk_hbox_new(FALSE, 0); + key2 = gtk_button_new_with_label("Optional fields"); + gtk_widget_set_usize(GTK_WIDGET(key2), 130, -1); + g_signal_connect(GTK_OBJECT(key2), "clicked", + G_CALLBACK(miscoptions), NULL); + gtk_tooltips_set_tip(tooltips, key2, + "Click here to get window containing remaining Miscellaneous fields", + NULL); + gtk_box_pack_start(GTK_BOX(option), key2, FALSE, FALSE, 10); + controls = gtk_hbox_new(FALSE, 0); + key1 = gtk_button_new_with_label("Save"); + gtk_widget_set_usize(GTK_WIDGET(key1), 90, -1); + g_signal_connect(GTK_OBJECT(key1), "clicked", + G_CALLBACK(save_misc), NULL); + gtk_tooltips_set_tip(tooltips, key1, + "Store this Miscellaneous reference in database", NULL); + gtk_box_pack_start(GTK_BOX(controls), key1, FALSE, FALSE, 30); + key3 = gtk_button_new_with_label("Cancel"); + gtk_widget_set_usize(GTK_WIDGET(key3), 90, -1); + g_signal_connect(GTK_OBJECT(key3), "clicked", + G_CALLBACK(closure_check), NULL); + gtk_tooltips_set_tip(tooltips, key3, + "Discard this Miscellaneous entry", NULL); + gtk_box_pack_start(GTK_BOX(controls), key3, FALSE, FALSE, 30); + key4 = gtk_button_new_with_label("Linking"); + gtk_widget_set_usize(GTK_WIDGET(key4), 90, -1); + g_signal_connect(GTK_OBJECT(key4), "clicked", + G_CALLBACK(linkwindow), NULL); + gtk_tooltips_set_tip(tooltips, key4, + "Click here for window to create links for this Miscellaneous", + NULL); + gtk_box_pack_start(GTK_BOX(controls), key4, FALSE, FALSE, 30); + gtk_box_pack_start(GTK_BOX(totalPane), option, FALSE, TRUE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), controls, FALSE, TRUE, 10); + + + format = 10; + + /* make the composite visible on screen */ + gtk_widget_show_all(window); +} + + diff --git a/biblio/bibtex/utils/xbibfile/penguin.bib b/biblio/bibtex/utils/xbibfile/penguin.bib new file mode 100644 index 0000000000..4c780f47a7 --- /dev/null +++ b/biblio/bibtex/utils/xbibfile/penguin.bib @@ -0,0 +1,75 @@ + +@INCOLLECTION{blar:2000, + author = {Tony Blar}, + title = {The Importance of being Tony}, + booktitle = {My Life in a Nut Shell}, + publisher = {British Truth Commission}, + year = {2000}, + editor = {Tony by himself}, + series = {derf}, + type = {report}, + chapter = {3}, + month = {March}, + annote = {xxx} } + +@CONFERENCE{aa, + author = {bb}, + title = {cc}, + booktitle = {dd}, + year = {ee}, + editor = {ff}, + volume = {gg}, + number = {hh}, + series = {ii}, + pages = {jj}, + address = {kk}, + month = {ll}, + organization = {mm}, + publisher = {nn}, + URL = {oo}, + note = {pp}, + annote = {qqrr} } + +@MASTERSTHESIS{aa, + author = {bb}, + title = {cc}, + school = {dd}, + year = {ee}, + type = {ff}, + address = {gg}, + month = {hh}, + URL = {ii}, + note = {jj}, + annote = {kkll} } + +@ARTICLE{mary:2000, + author = {Mary Lamb}, + title = {Caring for the Australian Economy}, + journal = {Believe it on Not}, + year = {2000}, + volume = {21}, + number = {3}, + pages = {45--70}, + month = {June}, + annote = {Mary had a little lamb +Her father shot it dead +Now Mary takes the lamb to school +Between two hunks of bread} } + +@UNPUBLISHED{mine:2000, + author = {me}, + title = {another test}, + note = {xyz}, + month = {December}, + year = {2000}, + URL = {xx}, + annote = {Go on, who is a silly boy!} } + +@UNPUBLISHED{other:2000, + author = {someone else}, + title = {just another test}, + note = {nothing}, + month = {December}, + year = {2000}, + URL = {xx}, + annote = {xx xx} } diff --git a/biblio/bibtex/utils/xbibfile/phd.c b/biblio/bibtex/utils/xbibfile/phd.c new file mode 100644 index 0000000000..3a37c8636b --- /dev/null +++ b/biblio/bibtex/utils/xbibfile/phd.c @@ -0,0 +1,455 @@ +/* This file is a part of XBibFile - a system for handling BibTeX references + * + * Author: Ross Maloney + * Date: October 1999 + * Modified: January 2002 + * + */ + +#include <stdio.h> +#include <gtk/gtk.h> + +#include "xbibfile.h" + +/* This file is a modified copy of article.c so that it handles the + * PhD thesis BibTeX reference style */ + + +GtkWidget *labelX, *dataX; +GtkWidget *label0, *data0; +GtkWidget *label1, *data1; +GtkWidget *label2, *data2; +GtkWidget *label3, *data3; +GtkWidget *label12, *data12; +GtkWidget *label13, *data13, *textscroll; +GtkWidget *label18, *data18; +GtkWidget *label20, *data20; +GtkWidget *label21, *data21; +GtkWidget *label22, *data22; +GtkWidget *label24, *data24; +GtkWidget *label30, *data30; +GtkWidget *label31, *data31; +GtkWidget *label32, *data32; +GtkTextBuffer *text13; +GtkTextIter start, end; +PangoFontDescription *font_desc; + + + + +/* The procedure to save the PhD thesis style */ + +void save_phd(GtkWidget *widget) +{ + extern int format; + extern int length[]; + extern char slate[][]; + extern int lengthX; + extern char slateX[]; + extern char slate1[]; + extern char slate2[]; + extern char slate3[]; + extern char slate12[]; + extern char slate13[]; + extern char slate18[]; + extern char slate20[]; + extern char slate21[]; + extern char slate22[]; + extern char slate24[]; + extern char slate30[]; + extern char slate31[]; + extern char slate32[]; + extern void error(); /* defined in file error.c */ + extern FILE *finput; /* defined in file xbibfile.c */ + extern void close_window(); /* defined in file cleanup.c */ + + if (format != 11) { + error(widget, GINT_TO_POINTER(5)); + return; + } + strcpy(slateX, gtk_entry_get_text(GTK_ENTRY(dataX))); + lengthX = strlen(slateX); + strcpy(slate3, gtk_entry_get_text(GTK_ENTRY(data3))); + length[3] = strlen(slate3); + strcpy(slate18, gtk_entry_get_text(GTK_ENTRY(data18))); + length[18] = strlen(slate18); + strcpy(slate20, gtk_entry_get_text(GTK_ENTRY(data20))); + length[20] = strlen(slate20); + strcpy(slate24, gtk_entry_get_text(GTK_ENTRY(data24))); + length[24] = strlen(slate24); + if (!(length[3] && length[18] && length[20] && length[24] && lengthX)) { + error(widget, GINT_TO_POINTER(3)); + return; + } + if (!finput) { + error(widget, GINT_TO_POINTER(8)); + return; + } + /* finput = stdout; */ + fprintf(finput, "\n@PHDTHESIS{%s,\n", slateX); + fprintf(finput, " author = {%s},\n", slate3); + fprintf(finput, " title = {%s},\n", slate20); + fprintf(finput, " school = {%s},\n", slate18); + fprintf(finput, " year = {%s}", slate24); + if (length[21]) + fprintf(finput, ",\n type = {%s}", slate21); + if (length[1]) + fprintf(finput, ",\n address = {%s}", slate1); + if (length[12]) + fprintf(finput, ",\n month = {%s}", slate12); + if (length[22]) + fprintf(finput, ",\n URL = {%s}", slate22); + if (length[2]) + fprintf(finput, ",\n note = {%s}", slate2); + if (length[13]) + fprintf(finput, ",\n annote = {%s}", slate13); + if (length[30]) + fprintf(finput, ",\n uplink = {%s}", slate30); + if (length[31]) + fprintf(finput, ",\n crosslink = {%s}", slate31); + if (length[32]) + fprintf(finput, ",\n externlink = {%s}", slate32); + fprintf(finput, " }\n"); + /* indicate that the reference is saved */ + format = 0; + length[1] = 0; + length[2] = 0; + length[12] = 0; + length[13] = 0; + length[21] = 0; + length[22] = 0; + length[30] = 0; + length[31] = 0; + length[32] = 0; + close_window(widget); /* remove this reference window */ +} + + +/* Save the PhD thesis optional fields for subsequent saving */ + +void save_phdoptions(GtkWidget *widget) +{ + extern void close_window(); + extern int length[]; + extern char slate1[]; + extern char slate2[]; + extern char slate12[]; + extern char slate13[]; + extern char slate21[]; + extern char slate22[]; + char *text_in_field; + int count; + + strcpy(slate1, gtk_entry_get_text(GTK_ENTRY(data1))); + length[1] = strlen(slate1); + strcpy(slate12, gtk_entry_get_text(GTK_ENTRY(data12))); + length[12] = strlen(slate12); + count = gtk_text_buffer_get_char_count(text13); + gtk_text_buffer_get_iter_at_offset(text13, &end, count); + gtk_text_buffer_get_iter_at_offset(text13, &start, 0); + strcpy(slate13, gtk_text_buffer_get_text(text13, &start, &end, FALSE)); + length[13] = count; + strcpy(slate21, gtk_entry_get_text(GTK_ENTRY(data21))); + length[21] = strlen(slate21); + strcpy(slate22, gtk_entry_get_text(GTK_ENTRY(data22))); + length[22] = strlen(slate22); + strcpy(slate2, gtk_entry_get_text(GTK_ENTRY(data2))); + length[2] = strlen(slate2); + close_window(widget); +} + + + + +/* Close the option entry window, but first delete the entries */ + +void close_phdoptions(GtkWidget *widget) +{ + extern void close_window(); + extern int length[]; + + length[1] = 0; + length[2] = 0; + length[12] = 0; + length[13] = 0; + length[21] = 0; + length[22] = 0; + close_window(widget); +} + + +/* The procedure to put the optional PhD thesis style fields on the screen */ + +void phdoptions(GtkWidget *widget) +{ + extern int format; + GtkTooltips *tooltips; + GtkWidget *window; + GtkWidget *decoration; + GtkWidget *totalPane; + GtkWidget *field0; + GtkWidget *field1; + GtkWidget *field2; + GtkWidget *field3; + GtkWidget *field4; + GtkWidget *field5; + GtkWidget *key0; + GtkWidget *key1; + + void close_phdoptions(); + void save_phdoptions(); + + if (format == 0) { + error (widget, GINT_TO_POINTER(6)); + return; + } + + /* create the tooltip help feature */ + + tooltips = gtk_tooltips_new(); + + window = gtk_window_new(GTK_WINDOW_TOPLEVEL); + gtk_window_set_title(GTK_WINDOW(window), "XBibFile create"); + gtk_window_position(GTK_WINDOW(window), GTK_WIN_POS_MOUSE); + gtk_widget_set_usize(GTK_WIDGET(window), 400, 540); + decoration = gtk_frame_new("Optional PhD thesis fields"); + gtk_container_add(GTK_CONTAINER(window), decoration); + totalPane = gtk_vbox_new(FALSE, 5); + gtk_container_add(GTK_CONTAINER(decoration), totalPane); + + /* put the text fields in place */ + field1 = gtk_hbox_new(FALSE, 0); + data21 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data21), TINY); + label21 = gtk_label_new("Type:"); + gtk_widget_set_usize(GTK_WIDGET(label21), 75, -1); + gtk_box_pack_start(GTK_BOX(field1), label21, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field1), data21, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field1, FALSE, TRUE, 10); + + field2 = gtk_hbox_new(FALSE, 0); + data1 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data1), LARGE); + label1 = gtk_label_new("Address:"); + gtk_widget_set_usize(GTK_WIDGET(label1), 75, -1); + gtk_box_pack_start(GTK_BOX(field2), label1, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field2), data1, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field2, FALSE, TRUE, 2); + + field3 = gtk_hbox_new(FALSE, 0); + data12 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data12), TINY); + label12 = gtk_label_new("Month:"); + gtk_widget_set_usize(GTK_WIDGET(label12), 75, -1); + gtk_box_pack_start(GTK_BOX(field3), label12, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field3), data12, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field3, FALSE, TRUE, 2); + + field4 = gtk_hbox_new(FALSE, 0); + data22 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data22), LARGE); + label22 = gtk_label_new("URL:"); + gtk_widget_set_usize(GTK_WIDGET(label22), 75, -1); + gtk_box_pack_start(GTK_BOX(field4), label22, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field4), data22, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field4, FALSE, TRUE, 2); + + field5 = gtk_hbox_new(FALSE, 0); + data2 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data2), LARGE); + label2 = gtk_label_new("note:"); + gtk_widget_set_usize(GTK_WIDGET(label2), 75, -1); + gtk_box_pack_start(GTK_BOX(field5), label2, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field5), data2, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field5, FALSE, TRUE, 2); + + text13 = gtk_text_buffer_new(NULL); + data13 = gtk_text_view_new_with_buffer(text13); + textscroll = gtk_scrolled_window_new(NULL, NULL); + font_desc = pango_font_description_from_string("Sans 12"); + gtk_widget_modify_font(data13, font_desc); + gtk_container_add(GTK_CONTAINER(textscroll), data13); + gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(textscroll), + GTK_POLICY_AUTOMATIC, + GTK_POLICY_AUTOMATIC); + gtk_widget_set_usize(GTK_WIDGET(data13), 30, 250); + label13 = gtk_label_new("Annotation:"); + gtk_box_pack_start(GTK_BOX(totalPane), label13, FALSE, TRUE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), textscroll, FALSE, TRUE, 2); + + /* finally, put the cancel button in place */ + field0 = gtk_hbox_new(FALSE, 0); + key0 = gtk_button_new_with_label("CANCEL"); + gtk_widget_set_usize(GTK_WIDGET(key0), 90, -1); + g_signal_connect(GTK_OBJECT(key0), "clicked", + G_CALLBACK(close_phdoptions), NULL); + gtk_tooltips_set_tip(tooltips, key0, + "Discard the contents of this window", NULL); + gtk_box_pack_end(GTK_BOX(field0), key0, FALSE, FALSE, 10); + key1 = gtk_button_new_with_label("Save"); + gtk_widget_set_usize(GTK_WIDGET(key0), 90, -1); + g_signal_connect(GTK_OBJECT(key1), "clicked", + G_CALLBACK(save_phdoptions), NULL); + gtk_tooltips_set_tip(tooltips, key1, + "Store the contents of this window", NULL); + gtk_box_pack_end(GTK_BOX(field0), key1, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field0, FALSE, TRUE, 10); + + /* put the composite window on the screen */ + gtk_widget_show_all(window); +} + + + +/* The procedure to put the basic PhD thesis style on the screen */ + +void phd(GtkWidget *widget) +{ + GtkTooltips *tooltips; + GtkWidget *window; + GtkWidget *decoration; + GtkWidget *totalPane; + GtkWidget *opDecoration; + GtkWidget *field0; + GtkWidget *field1; + GtkWidget *option; + GtkWidget *controls; + GtkWidget *key1; + GtkWidget *key2; + GtkWidget *key3; + GtkWidget *key4; + GtkWidget *field2; + GtkWidget *field3; + GtkWidget *field4; + GtkWidget *field5; + extern int format; + extern char slate0[]; + + extern void linkwindow(); + extern void closure_check(); /* defined in file cleanup.c */ + extern void close_window(); /* defined in file cleanup.c */ + void phdoptions(); + void save_phd(); + + /* create the tooltip help feature */ + + tooltips = gtk_tooltips_new(); + + format = 11; /* indicate processing of a PhD THESIS */ + + /* create the wondow and its top panel */ + window = gtk_window_new(GTK_WINDOW_TOPLEVEL); + gtk_window_set_title(GTK_WINDOW(window), "XBibFile create"); + gtk_window_position(GTK_WINDOW(window), GTK_WIN_POS_MOUSE); + decoration = gtk_frame_new("PhD thesis type - required fields"); + gtk_widget_set_usize(GTK_WIDGET(decoration), 450, 325); + gtk_container_add(GTK_CONTAINER(window), decoration); + totalPane = gtk_vbox_new(FALSE, 5); + gtk_container_add(GTK_CONTAINER(decoration), totalPane); + + field1 = gtk_hbox_new(FALSE,0); + dataX = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(dataX), SMALL); + gtk_widget_set_usize(GTK_WIDGET(dataX), 345, -1); + labelX = gtk_label_new("Tag/s:"); + gtk_widget_set_usize(GTK_WIDGET(labelX), 65, -1); + gtk_box_pack_start(GTK_BOX(field1), labelX, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field1), dataX, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field1, FALSE, TRUE, 10); + + field0 = gtk_hbox_new(FALSE, 0); + data0 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data0), LARGE); + gtk_widget_set_usize(GTK_WIDGET(data0), 345, -1); + label0 = gtk_label_new("File used:"); + gtk_widget_set_usize(GTK_WIDGET(label0), 65, -1); + gtk_entry_set_text(GTK_ENTRY(data0), slate0); + gtk_box_pack_start(GTK_BOX(field0), label0, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field0), data0, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field0, FALSE, TRUE, 2); + + /* position the remaining field entries */ + field2 = gtk_hbox_new(FALSE, 0); + data3 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data3), LARGE); + gtk_widget_set_usize(GTK_WIDGET(data3), 345, -1); + label3 = gtk_label_new("Author/s:"); + gtk_widget_set_usize(GTK_WIDGET(label3), 65, -1); + gtk_box_pack_start(GTK_BOX(field2), label3, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field2), data3, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field2, FALSE, TRUE, 2); + + field3 = gtk_hbox_new(FALSE, 0); + data20 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data20), LARGE); + gtk_widget_set_usize(GTK_WIDGET(data20), 345, -1); + label20 = gtk_label_new("Title:"); + gtk_widget_set_usize(GTK_WIDGET(label20), 65, -1); + gtk_box_pack_start(GTK_BOX(field3), label20, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field3), data20, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field3, FALSE, TRUE, 2); + + field4 = gtk_hbox_new(FALSE, 0); + data18 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data18), LARGE); + gtk_widget_set_usize(GTK_WIDGET(data18), 345, -1); + label18 = gtk_label_new("School:"); + gtk_widget_set_usize(GTK_WIDGET(label18), 65, -1); + gtk_box_pack_start(GTK_BOX(field4), label18, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field4), data18, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field4, FALSE, TRUE, 2); + + field5 = gtk_hbox_new(FALSE, 0); + data24 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data24), TINY); + gtk_widget_set_usize(GTK_WIDGET(data24), 200, -1); + label24 = gtk_label_new("Year:"); + gtk_widget_set_usize(GTK_WIDGET(label24), 65, -1); + gtk_box_pack_start(GTK_BOX(field5), label24, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field5), data24, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field5, FALSE, TRUE, 2); + + /* put the control keys on to the window */ + option = gtk_hbox_new(FALSE, 0); + key2 = gtk_button_new_with_label("Optional fields"); + gtk_widget_set_usize(GTK_WIDGET(key2), 130, -1); + g_signal_connect(GTK_OBJECT(key2), "clicked", + G_CALLBACK(phdoptions), NULL); + gtk_tooltips_set_tip(tooltips, key2, + "Click here to get window containing remaining PhD fields", + NULL); + gtk_box_pack_start(GTK_BOX(option), key2, FALSE, FALSE, 10); + controls = gtk_hbox_new(FALSE, 0); + key1 = gtk_button_new_with_label("Save"); + gtk_widget_set_usize(GTK_WIDGET(key1), 90, -1); + g_signal_connect(GTK_OBJECT(key1), "clicked", + G_CALLBACK(save_phd), NULL); + gtk_tooltips_set_tip(tooltips, key1, + "Store this PhD reference in database", NULL); + gtk_box_pack_start(GTK_BOX(controls), key1, FALSE, FALSE, 30); + key3 = gtk_button_new_with_label("Cancel"); + gtk_widget_set_usize(GTK_WIDGET(key3), 90, -1); + g_signal_connect(GTK_OBJECT(key3), "clicked", + G_CALLBACK(closure_check), NULL); + gtk_tooltips_set_tip(tooltips, key3, + "Discard this PhD entry", NULL); + gtk_box_pack_start(GTK_BOX(controls), key3, FALSE, FALSE, 30); + key4 = gtk_button_new_with_label("Linking"); + gtk_widget_set_usize(GTK_WIDGET(key4), 90, -1); + g_signal_connect(GTK_OBJECT(key4), "clicked", + G_CALLBACK(linkwindow), NULL); + gtk_tooltips_set_tip(tooltips, key4, + "Click here for window to create links for this PhD", + NULL); + gtk_box_pack_start(GTK_BOX(controls), key4, FALSE, FALSE, 30); + gtk_box_pack_start(GTK_BOX(totalPane), option, FALSE, TRUE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), controls, FALSE, TRUE, 10); + + + format = 11; + + /* make the composite visible on screen */ + gtk_widget_show_all(window); +} + + diff --git a/biblio/bibtex/utils/xbibfile/probes.c b/biblio/bibtex/utils/xbibfile/probes.c new file mode 100644 index 0000000000..fb5babfa4d --- /dev/null +++ b/biblio/bibtex/utils/xbibfile/probes.c @@ -0,0 +1,163 @@ +/* This file is a part of XBibFile - a system for handling BibTeX references + * + * Author: Ross Maloney + * Date: January 2002 + * + */ + +#include <gtk/gtk.h> + + +//extern int format; + + +/* This procedure produces a window allowing selection of the + * procedures for exploring the reference database */ + +void probe_menu(GtkWidget *widget) +{ + GtkTooltips *tooltips; + GtkWidget *window, *panel, *description, *selectionKeypad, *finish; + GtkWidget *separator, *keycentre; + GtkWidget *allkey, *allauthorkey, *allyearkey; + GtkWidget *wordkey, *authorkey, *yearkey, *refkey, *uplinkkey; + GtkWidget *journalkey, *typekey, *future3; + GtkWidget *spacer1key, *spacer2key; + + extern void close_window(); /* defined in file cleanup.c */ + extern void all(); /* defined in file listall.c */ + extern void word(); /* defined in file listword.c */ + extern void allyears(); /* defined in file listyears.c */ + extern void allauthors(); /* defined in file listauthors.c */ + extern void find_author(); /* defined in file listwriter.c */ + extern void find_year(); /* defined in file listpubyear.c */ + extern void viewref(); /* defined in file listref.c */ + extern void alluplinks(); /* defined in file listuplinks.c */ + + + /* create the tooltip help feature */ + + tooltips = gtk_tooltips_new(); + + /* form the outline of the window */ + + window = gtk_window_new(GTK_WINDOW_TOPLEVEL); + gtk_window_set_title(GTK_WINDOW(window), "XBibFile select"); + gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_MOUSE); + gtk_window_set_default_size(GTK_WINDOW(window), 420, 160); + panel = gtk_vbox_new(FALSE, 10); + gtk_container_add(GTK_CONTAINER(window), panel); + gtk_container_set_border_width(GTK_CONTAINER(window), 10); + description = gtk_label_new("Select a reference database probe"); + gtk_box_pack_start_defaults(GTK_BOX(panel), description); + selectionKeypad = gtk_table_new(5, 4, TRUE); + gtk_widget_set_usize(GTK_WIDGET(selectionKeypad), 390, 180); + gtk_box_pack_start_defaults(GTK_BOX(panel), selectionKeypad); + separator = gtk_hseparator_new(); + gtk_box_pack_start_defaults(GTK_BOX(panel), separator); + keycentre = gtk_table_new(1, 3, TRUE); + gtk_box_pack_start_defaults(GTK_BOX(panel), keycentre); + finish = gtk_button_new_with_label("Cancel"); + gtk_widget_set_usize(GTK_WIDGET(keycentre), 390, 30); + g_signal_connect(GTK_OBJECT(finish), "clicked", + G_CALLBACK(close_window), NULL); + gtk_table_attach_defaults(GTK_TABLE(keycentre), finish, 1, 2, 0, 1); + gtk_tooltips_set_tip(tooltips, finish, + "Finished inspecting that reference database", NULL); + + /* connect the List all references present process */ + allkey = gtk_button_new_with_label("List all"); + gtk_table_attach_defaults(GTK_TABLE(selectionKeypad), + allkey, 0, 1, 0 ,1); + g_signal_connect(GTK_OBJECT(allkey), "clicked", + G_CALLBACK(all), NULL); + gtk_tooltips_set_tip(tooltips, allkey, + "Show all ref_type/tag/title fields", NULL); + + /* List the authors of all references present */ + allauthorkey = gtk_button_new_with_label("List all authors"); + gtk_table_attach_defaults(GTK_TABLE(selectionKeypad), + allauthorkey, 0, 1, 1 ,2); + g_signal_connect(GTK_OBJECT(allauthorkey), "clicked", + G_CALLBACK(allauthors), NULL); + gtk_tooltips_set_tip(tooltips, allauthorkey, + "Show ref_type/tag/title tag fields for all author fields in database", NULL); + + /* List the publication year of all references present */ + allyearkey = gtk_button_new_with_label("List all years"); + gtk_table_attach_defaults(GTK_TABLE(selectionKeypad), + allyearkey, 0, 1, 2 ,3); + g_signal_connect(GTK_OBJECT(allyearkey), "clicked", + G_CALLBACK(allyears), NULL); + gtk_tooltips_set_tip(tooltips, allyearkey, + "Show ref_type/tag/title fields for all publication fields in database", NULL); + + /* connect the List references by word present */ + wordkey = gtk_button_new_with_label("List by word"); + gtk_table_attach_defaults(GTK_TABLE(selectionKeypad), + wordkey, 1, 2, 0 ,1); + g_signal_connect(GTK_OBJECT(wordkey), "clicked", + G_CALLBACK(word), NULL); + gtk_tooltips_set_tip(tooltips, wordkey, + "Show ref_type/tag/title fields corresponding to matches of specified word", NULL); + + /* connect the List references by specified author */ + authorkey = gtk_button_new_with_label("List by author"); + gtk_table_attach_defaults(GTK_TABLE(selectionKeypad), + authorkey, 1, 2, 1 ,2); + g_signal_connect(GTK_OBJECT(authorkey), "clicked", + G_CALLBACK(find_author), NULL); + gtk_tooltips_set_tip(tooltips, authorkey, + "Show ref_type/tag/title fields corresponding to specified author", NULL); + + + /* connect the List references by year of publication */ + yearkey = gtk_button_new_with_label("List by year"); + gtk_table_attach_defaults(GTK_TABLE(selectionKeypad), + yearkey, 1, 2, 2 ,3); + g_signal_connect(GTK_OBJECT(yearkey), "clicked", + G_CALLBACK(find_year), NULL); + gtk_tooltips_set_tip(tooltips, yearkey, + "Show ref_type/tag/title fields for a specified year", + NULL); + + /* connect the List references by publishing journal */ + journalkey = gtk_button_new_with_label("FUTURE 1"); + gtk_table_attach_defaults(GTK_TABLE(selectionKeypad), + journalkey, 1, 2, 3 ,4); + gtk_tooltips_set_tip(tooltips, journalkey, + "Not currently used", NULL); + + /* connect the List references by reference type */ + typekey = gtk_button_new_with_label("FUTURE 2"); + gtk_table_attach_defaults(GTK_TABLE(selectionKeypad), + typekey, 1, 2, 4 ,5); + gtk_tooltips_set_tip(tooltips, typekey, + "Not currently used", NULL); + future3 = gtk_button_new_with_label("FUTURE 3"); + gtk_table_attach_defaults(GTK_TABLE(selectionKeypad), + future3, 1, 2, 5 ,6); + gtk_tooltips_set_tip(tooltips, future3, + "Not currently used", NULL); + + /* connect the List references uplinks given */ + uplinkkey = gtk_button_new_with_label("List by uplink"); + gtk_table_attach_defaults(GTK_TABLE(selectionKeypad), + uplinkkey, 2, 3, 0 ,1); + g_signal_connect(GTK_OBJECT(uplinkkey), "clicked", + G_CALLBACK(alluplinks), NULL); + gtk_tooltips_set_tip(tooltips, uplinkkey, + "List reference citations via 'uplink' mechanism", NULL); + + /* find the whole reference via its tag */ + refkey = gtk_button_new_with_label("View Reference"); + gtk_table_attach_defaults(GTK_TABLE(selectionKeypad), + refkey, 3, 4, 0 ,1); + g_signal_connect(GTK_OBJECT(refkey), "clicked", + G_CALLBACK(viewref), NULL); + gtk_tooltips_set_tip(tooltips, refkey, + "View whole reference accessed via its tag", NULL); + + /* make the composite window visible on the screen */ + gtk_widget_show_all(window); +} diff --git a/biblio/bibtex/utils/xbibfile/proceedings.c b/biblio/bibtex/utils/xbibfile/proceedings.c new file mode 100644 index 0000000000..1b99112e7f --- /dev/null +++ b/biblio/bibtex/utils/xbibfile/proceedings.c @@ -0,0 +1,523 @@ +/* This file is a part of XBibFile - a system for handling BibTeX references + * + * Author: Ross Maloney + * Date: October 1999 + * Modified: January 2002 + * + */ + +#include <stdio.h> +#include <gtk/gtk.h> + +#include "xbibfile.h" + +/* This file is a modified copy of inproc.c so that it handles the + * proceedings BibTeX reference style */ + + +GtkWidget *labelX, *dataX; +GtkWidget *label0, *data0; +GtkWidget *label1, *data1; +GtkWidget *label2, *data2; +GtkWidget *label7, *data7; +GtkWidget *label12, *data12; +GtkWidget *label13, *data13, *textscroll; +GtkWidget *label14, *data14; +GtkWidget *label15, *data15; +GtkWidget *label17, *data17; +GtkWidget *label19, *data19; +GtkWidget *label20, *data20; +GtkWidget *label22, *data22; +GtkWidget *label23, *data23; +GtkWidget *label24, *data24; +GtkWidget *label30, *data30; +GtkWidget *label31, *data31; +GtkWidget *label32, *data32; +GtkTextBuffer *text13; +GtkTextIter start, end; +PangoFontDescription *font_desc; + + + + +/* The procedure to save the proceedings style */ + +void save_proceedings(GtkWidget *widget) +{ + extern int format; + extern int length[]; + extern char slate[][]; + extern int lengthX; + extern char slateX[]; + extern char slate1[]; + extern char slate2[]; + extern char slate7[]; + extern char slate12[]; + extern char slate13[]; + extern char slate14[]; + extern char slate15[]; + extern char slate17[]; + extern char slate19[]; + extern char slate20[]; + extern char slate22[]; + extern char slate23[]; + extern char slate24[]; + extern char slate30[]; + extern char slate31[]; + extern char slate32[]; + extern void error(); /* defined in file error.c */ + extern FILE *finput; /* defined in file xbibfile.c */ + extern void close_window(); /* defined in file cleanup.c */ + + if (format != 12) { + error(widget, GINT_TO_POINTER(5)); + return; + } + strcpy(slateX, gtk_entry_get_text(GTK_ENTRY(dataX))); + lengthX = strlen(slateX); + strcpy(slate20, gtk_entry_get_text(GTK_ENTRY(data20))); + length[20] = strlen(slate20); + strcpy(slate24, gtk_entry_get_text(GTK_ENTRY(data24))); + length[24] = strlen(slate24); + if (!(length[20] && length[24] && lengthX)) { + error(widget, GINT_TO_POINTER(3)); + return; + } + if (!finput) { + error(widget, GINT_TO_POINTER(8)); + return; + } + /* finput = stdout; */ + fprintf(finput, "\n@PROCEEDINGS{%s,\n", slateX); + fprintf(finput, " title = {%s},\n", slate20); + fprintf(finput, " year = {%s}", slate24); + if (length[7]) + fprintf(finput, ",\n editor = {%s}", slate7); + if (length[23]) + fprintf(finput, ",\n volume = {%s}", slate23); + if (length[14]) + fprintf(finput, ",\n number = {%s}", slate14); + if (length[19]) + fprintf(finput, ",\n series = {%s}", slate19); + if (length[1]) + fprintf(finput, ",\n address = {%s}", slate1); + if (length[12]) + fprintf(finput, ",\n month = {%s}", slate12); + if (length[15]) + fprintf(finput, ",\n organization = {%s}", slate15); + if (length[17]) + fprintf(finput, ",\n publisher = {%s}", slate17); + if (length[22]) + fprintf(finput, ",\n URL = {%s}", slate22); + if (length[2]) + fprintf(finput, ",\n note = {%s}", slate2); + if (length[13]) + fprintf(finput, ",\n annote = {%s}", slate13); + if (length[30]) + fprintf(finput, ",\n uplink = {%s}", slate30); + if (length[31]) + fprintf(finput, ",\n crosslink = {%s}", slate31); + if (length[32]) + fprintf(finput, ",\n externlink = {%s}", slate32); + fprintf(finput, " }\n"); + /* indicate that the reference is saved */ + format = 0; + length[1] = 0; + length[2] = 0; + length[7] = 0; + length[12] = 0; + length[13] = 0; + length[14] = 0; + length[15] = 0; + length[17] = 0; + length[19] = 0; + length[22] = 0; + length[23] = 0; + length[30] = 0; + length[31] = 0; + length[32] = 0; + close_window(widget); /* remove this reference window */ +} + + +/* Save the proceedings optional fields for subsequent saving */ + +void save_procoptions(GtkWidget *widget) +{ + extern void close_window(); + extern int length[]; + extern char slate1[]; + extern char slate2[]; + extern char slate7[]; + extern char slate12[]; + extern char slate13[]; + extern char slate14[]; + extern char slate15[]; + extern char slate16[]; + extern char slate17[]; + extern char slate19[]; + extern char slate22[]; + extern char slate23[]; + char *text_in_field; + int count; + + strcpy(slate1, gtk_entry_get_text(GTK_ENTRY(data1))); + length[1] = strlen(slate1); + strcpy(slate7, gtk_entry_get_text(GTK_ENTRY(data7))); + length[7] = strlen(slate7); + strcpy(slate12, gtk_entry_get_text(GTK_ENTRY(data12))); + length[12] = strlen(slate12); + strcpy(slate14, gtk_entry_get_text(GTK_ENTRY(data14))); + length[14] = strlen(slate14); + strcpy(slate15, gtk_entry_get_text(GTK_ENTRY(data15))); + length[15] = strlen(slate15); + strcpy(slate17, gtk_entry_get_text(GTK_ENTRY(data17))); + length[17] = strlen(slate17); + strcpy(slate19, gtk_entry_get_text(GTK_ENTRY(data19))); + length[19] = strlen(slate19); + strcpy(slate22, gtk_entry_get_text(GTK_ENTRY(data22))); + length[22] = strlen(slate22); + strcpy(slate23, gtk_entry_get_text(GTK_ENTRY(data23))); + length[23] = strlen(slate23); + strcpy(slate2, gtk_entry_get_text(GTK_ENTRY(data2))); + length[2] = strlen(slate2); + count = gtk_text_buffer_get_char_count(text13); + gtk_text_buffer_get_iter_at_offset(text13, &end, count); + gtk_text_buffer_get_iter_at_offset(text13, &start, 0); + strcpy(slate13, gtk_text_buffer_get_text(text13, &start, &end, FALSE)); + length[13] = count; + + close_window(widget); +} + + + + +/* Close the option entry window, but first delete the entries */ + +void close_procoptions(GtkWidget *widget) +{ + extern void close_window(); + extern int length[]; + + length[23] = 0; + length[22] = 0; + length[19] = 0; + length[17] = 0; + length[15] = 0; + length[14] = 0; + length[13] = 0; + length[12] = 0; + length[7] = 0; + length[2] = 0; + length[1] = 0; + close_window(widget); +} + + +/* The procedure to put the optional proceedings style fields + * on the screen */ + +void procoptions(GtkWidget *widget) +{ + extern int format; + GtkTooltips *tooltips; + GtkWidget *window; + GtkWidget *decoration; + GtkWidget *totalPane; + GtkWidget *field0; + GtkWidget *field1; + GtkWidget *field2; + GtkWidget *field3; + GtkWidget *field4; + GtkWidget *field5; + GtkWidget *field6; + GtkWidget *field7; + GtkWidget *field8; + GtkWidget *field9; + GtkWidget *field10; + GtkWidget *key0; + GtkWidget *key1; + + void close_procoptions(); + void save_procoptions(); + + if (format == 0) { + error (widget, GINT_TO_POINTER(6)); + return; + } + + /* create the tooltip help feature */ + + tooltips = gtk_tooltips_new(); + + window = gtk_window_new(GTK_WINDOW_TOPLEVEL); + gtk_window_set_title(GTK_WINDOW(window), "XBibFile create"); + gtk_window_position(GTK_WINDOW(window), GTK_WIN_POS_MOUSE); + gtk_widget_set_usize(GTK_WIDGET(window), 400, 700); + decoration = gtk_frame_new("Optional Proceedings fields"); + gtk_container_add(GTK_CONTAINER(window), decoration); + totalPane = gtk_vbox_new(FALSE, 5); + gtk_container_add(GTK_CONTAINER(decoration), totalPane); + + /* put the text fields in place */ + field1 = gtk_hbox_new(FALSE, 0); + data7 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data7), LARGE); + label7 = gtk_label_new("Editor/s:"); + gtk_widget_set_usize(GTK_WIDGET(label7), 75, -1); + gtk_box_pack_start(GTK_BOX(field1), label7, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field1), data7, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field1, FALSE, TRUE, 10); + + field2 = gtk_hbox_new(FALSE, 0); + data23 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data23), TINY); + label23 = gtk_label_new("|| Volume:"); + gtk_widget_set_usize(GTK_WIDGET(label23), 75, -1); + gtk_box_pack_start(GTK_BOX(field2), label23, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field2), data23, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field2, FALSE, TRUE, 2); + + field3 = gtk_hbox_new(FALSE, 0); + data14 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data14), TINY); + label14 = gtk_label_new("|| Number:"); + gtk_widget_set_usize(GTK_WIDGET(label14), 75, -1); + gtk_box_pack_start(GTK_BOX(field3), label14, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field3), data14, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field3, FALSE, TRUE, 2); + + field4 = gtk_hbox_new(FALSE, 0); + data19 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data19), SMALL); + label19 = gtk_label_new("Series:"); + gtk_widget_set_usize(GTK_WIDGET(label19), 75, -1); + gtk_box_pack_start(GTK_BOX(field4), label19, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field4), data19, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field4, FALSE, TRUE, 2); + + field5 = gtk_hbox_new(FALSE, 0); + data1 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data1), LARGE); + label1 = gtk_label_new("Address:"); + gtk_widget_set_usize(GTK_WIDGET(label1), 75, -1); + gtk_box_pack_start(GTK_BOX(field5), label1, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field5), data1, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field5, FALSE, TRUE, 2); + + field6 = gtk_hbox_new(FALSE, 0); + data12 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data12), TINY); + label12 = gtk_label_new("Month:"); + gtk_widget_set_usize(GTK_WIDGET(label12), 75, -1); + gtk_box_pack_start(GTK_BOX(field6), label12, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field6), data12, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field6, FALSE, TRUE, 2); + + field7 = gtk_hbox_new(FALSE, 0); + data15 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data15), LARGE); + label15 = gtk_label_new("Organization:"); + gtk_widget_set_usize(GTK_WIDGET(label15), 75, -1); + gtk_box_pack_start(GTK_BOX(field7), label15, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field7), data15, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field7, FALSE, TRUE, 2); + + field8 = gtk_hbox_new(FALSE, 0); + data17 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data17), LARGE); + label17 = gtk_label_new("Publisher:"); + gtk_widget_set_usize(GTK_WIDGET(label17), 75, -1); + gtk_box_pack_start(GTK_BOX(field8), label17, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field8), data17, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field8, FALSE, TRUE, 2); + + field9 = gtk_hbox_new(FALSE, 0); + data22 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data22), LARGE); + label22 = gtk_label_new("URL:"); + gtk_widget_set_usize(GTK_WIDGET(label22), 75, -1); + gtk_box_pack_start(GTK_BOX(field9), label22, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field9), data22, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field9, FALSE, TRUE, 2); + + field10 = gtk_hbox_new(FALSE, 0); + data2 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data2), LARGE); + label2 = gtk_label_new("note:"); + gtk_widget_set_usize(GTK_WIDGET(label2), 75, -1); + gtk_box_pack_start(GTK_BOX(field10), label2, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field10), data2, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field10, FALSE, TRUE, 2); + + text13 = gtk_text_buffer_new(NULL); + data13 = gtk_text_view_new_with_buffer(text13); + textscroll = gtk_scrolled_window_new(NULL, NULL); + font_desc = pango_font_description_from_string("Sans 12"); + gtk_widget_modify_font(data13, font_desc); + gtk_container_add(GTK_CONTAINER(textscroll), data13); + gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(textscroll), + GTK_POLICY_AUTOMATIC, + GTK_POLICY_AUTOMATIC); + gtk_widget_set_usize(GTK_WIDGET(data13), 30, 250); + label13 = gtk_label_new("Annotation:"); + gtk_box_pack_start(GTK_BOX(totalPane), label13, FALSE, TRUE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), textscroll, FALSE, TRUE, 2); + + /* finally, put the cancel button in place */ + field0 = gtk_hbox_new(FALSE, 0); + key0 = gtk_button_new_with_label("CANCEL"); + gtk_widget_set_usize(GTK_WIDGET(key0), 90, -1); + g_signal_connect(GTK_OBJECT(key0), "clicked", + G_CALLBACK(close_procoptions), NULL); + gtk_tooltips_set_tip(tooltips, key0, + "Discard the contents of this window", NULL); + gtk_box_pack_end(GTK_BOX(field0), key0, FALSE, FALSE, 10); + key1 = gtk_button_new_with_label("Save"); + gtk_widget_set_usize(GTK_WIDGET(key0), 90, -1); + g_signal_connect(GTK_OBJECT(key1), "clicked", + G_CALLBACK(save_procoptions), NULL); + gtk_tooltips_set_tip(tooltips, key1, + "Store the contents of this window", NULL); + gtk_box_pack_end(GTK_BOX(field0), key1, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field0, FALSE, TRUE, 10); + + /* put the composite window on the screen */ + gtk_widget_show_all(window); +} + + + +/* The procedure to put the basic proceedings style on the screen */ + +void proceedings(GtkWidget *widget) +{ + GtkTooltips *tooltips; + GtkWidget *window; + GtkWidget *decoration; + GtkWidget *totalPane; + GtkWidget *opDecoration; + GtkWidget *field0; + GtkWidget *field1; + GtkWidget *option; + GtkWidget *controls; + GtkWidget *key1; + GtkWidget *key2; + GtkWidget *key3; + GtkWidget *key4; + GtkWidget *field2; + GtkWidget *field3; + GtkWidget *field4; + GtkWidget *field5; + extern int format; + extern char slate0[]; + + extern void linkwindow(); + extern void closure_check(); /* defined in file cleanup.c */ + extern void close_window(); /* defined in file cleanup.c */ + void procoptions(); + void save_proceedings(); + + /* create the tooltip help feature */ + + tooltips = gtk_tooltips_new(); + + format = 12; /* indicate processing of an PROCEEDINGS */ + + /* create the wondow and its top panel */ + window = gtk_window_new(GTK_WINDOW_TOPLEVEL); + gtk_window_set_title(GTK_WINDOW(window), "XBibFile create"); + gtk_window_position(GTK_WINDOW(window), GTK_WIN_POS_MOUSE); + decoration = gtk_frame_new("Proceedings type - required fields"); + gtk_widget_set_usize(GTK_WIDGET(window), 450, 268); + gtk_container_add(GTK_CONTAINER(window), decoration); + totalPane = gtk_vbox_new(FALSE, 5); + gtk_container_add(GTK_CONTAINER(decoration), totalPane); + + field1 = gtk_hbox_new(FALSE,0); + dataX = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(dataX), SMALL); + gtk_widget_set_usize(GTK_WIDGET(dataX), 345, -1); + labelX = gtk_label_new("Tag/s:"); + gtk_widget_set_usize(GTK_WIDGET(labelX), 65, -1); + gtk_box_pack_start(GTK_BOX(field1), labelX, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field1), dataX, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field1, FALSE, TRUE, 10); + + field0 = gtk_hbox_new(FALSE, 0); + data0 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data0), LARGE); + gtk_widget_set_usize(GTK_WIDGET(data0), 345, -1); + label0 = gtk_label_new("File used:"); + gtk_widget_set_usize(GTK_WIDGET(label0), 65, -1); + gtk_entry_set_text(GTK_ENTRY(data0), slate0); + gtk_box_pack_start(GTK_BOX(field0), label0, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field0), data0, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field0, FALSE, TRUE, 8); + + /* position the remaining field entries */ + field2 = gtk_hbox_new(FALSE, 0); + data20 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data20), LARGE); + gtk_widget_set_usize(GTK_WIDGET(data20), 345, -1); + label20 = gtk_label_new("Title:"); + gtk_widget_set_usize(GTK_WIDGET(label20), 65, -1); + gtk_box_pack_start(GTK_BOX(field2), label20, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field2), data20, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field2, FALSE, TRUE, 2); + + field3 = gtk_hbox_new(FALSE, 0); + data24 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data24), TINY); + gtk_widget_set_usize(GTK_WIDGET(data24), 200, -1); + label24 = gtk_label_new("Year:"); + gtk_widget_set_usize(GTK_WIDGET(label24), 65, -1); + gtk_box_pack_start(GTK_BOX(field3), label24, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field3), data24, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field3, FALSE, TRUE, 2); + + /* put the control keys on to the window */ + option = gtk_hbox_new(FALSE, 0); + key2 = gtk_button_new_with_label("Optional fields"); + gtk_widget_set_usize(GTK_WIDGET(key2), 130, -1); + g_signal_connect(GTK_OBJECT(key2), "clicked", + G_CALLBACK(procoptions), NULL); + gtk_tooltips_set_tip(tooltips, key2, + "Click here to get window containing remaining Proceedings fields", + NULL); + gtk_box_pack_start(GTK_BOX(option), key2, FALSE, FALSE, 10); + controls = gtk_hbox_new(FALSE, 0); + key1 = gtk_button_new_with_label("Save"); + gtk_widget_set_usize(GTK_WIDGET(key1), 90, -1); + g_signal_connect(GTK_OBJECT(key1), "clicked", + G_CALLBACK(save_proceedings), NULL); + gtk_tooltips_set_tip(tooltips, key1, + "Store this Proceedings reference in database", NULL); + gtk_box_pack_start(GTK_BOX(controls), key1, FALSE, FALSE, 30); + key3 = gtk_button_new_with_label("Cancel"); + gtk_widget_set_usize(GTK_WIDGET(key3), 90, -1); + g_signal_connect(GTK_OBJECT(key3), "clicked", + G_CALLBACK(closure_check), NULL); + gtk_tooltips_set_tip(tooltips, key3, + "Discard this Proceedings entry", NULL); + gtk_box_pack_start(GTK_BOX(controls), key3, FALSE, FALSE, 30); + key4 = gtk_button_new_with_label("Linking"); + gtk_widget_set_usize(GTK_WIDGET(key4), 90, -1); + g_signal_connect(GTK_OBJECT(key4), "clicked", + G_CALLBACK(linkwindow), NULL); + gtk_tooltips_set_tip(tooltips, key4, + "Click here for window to create links for this Proceedings", + NULL); + gtk_box_pack_start(GTK_BOX(controls), key4, FALSE, FALSE, 30); + gtk_box_pack_start(GTK_BOX(totalPane), option, FALSE, TRUE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), controls, FALSE, TRUE, 10); + + + format = 12; + + /* make the composite visible on screen */ + gtk_widget_show_all(window); +} + + diff --git a/biblio/bibtex/utils/xbibfile/ramblings.txt b/biblio/bibtex/utils/xbibfile/ramblings.txt new file mode 100644 index 0000000000..de2060b3b6 --- /dev/null +++ b/biblio/bibtex/utils/xbibfile/ramblings.txt @@ -0,0 +1,15 @@ +At the outset of my PhD studies the importance of handling reference +material was clear. Systems such as BibTeX would automatically +prepare the entries for a paper's reference section from the citations +included in the paper's text. But to provide links between those +references, for historic, logical, or theme reasons required some +other method of handling this reference material. + +Looking on the Internet showed no available software of the type +required. I asked a question on the comp.text.tex usenet newsgroup in +regard to how others had addressed this problem, but received no +replies. My conclusion was that to get such software I would have to +write it. That software available only fulfilled paprt of my +requirements. In the case of XBibTeX, the software was unstable, and +crashed without warning, resulting in loss of information entered +using it. BibTool offered good promise, but it was not GUI orientated. diff --git a/biblio/bibtex/utils/xbibfile/searchrefs.pl b/biblio/bibtex/utils/xbibfile/searchrefs.pl new file mode 100644 index 0000000000..72d2417ab0 --- /dev/null +++ b/biblio/bibtex/utils/xbibfile/searchrefs.pl @@ -0,0 +1,47 @@ +#!/usr/bin/perl +# +# Script to print the key, the reference type, and the first part of the +# title of ALL references in n BiBTeX database matching a given search +# string. +# +# +# This script is part of the XBibFile software package. +# Writer: Ross Maloney +# Date: August 2000 +# + +$count = 0; +while ( <> ) { + chomp; + if ( /@/ ) { + $type = 'x'; + $ptr_flag = 0; + $note_flag = 0; + if ( /\@ARTICLE/ ) { $type = 'A' } ; + if ( /\@BOOK/ ) { $type = 'B' } ; + if ( /\@INCOLLECTION/ ) { $type = 'C' } ; + if ( /\@INPROCEEDINGS/ ) { $type = 'P' } ; + if ( /\@PHDTHESIS/ ) { $type = 'T' } ; + @reftype = split(/{/, $_); + $reftype[1] =~ s/,//; + } + elsif ( /^ +title = \{/ ) { + @fields = split(/{/, $_); + $fields[1] =~ s/},//; + } + elsif ( /^ +annote = \{/ ) { + $note_flag = 1; + } + if ( $note_flag ) { + if ( /poem/i ) { # check for test string being present + if ( $ptr_flag == 0 ) { + $count++ ; + printf "\n%s %s", $type, $reftype[1]; + printf "\t%s", substr($fields[1], 0, 50) ; + $ptr_flag = 1; + } + printf "\n* %s", $_; + } + } +} +print "\nnumber of references = $count\n" ; diff --git a/biblio/bibtex/utils/xbibfile/selecting.c b/biblio/bibtex/utils/xbibfile/selecting.c new file mode 100644 index 0000000000..6a77ec339d --- /dev/null +++ b/biblio/bibtex/utils/xbibfile/selecting.c @@ -0,0 +1,208 @@ +/* This file is a part of XBibFile - a system for handling BibTeX references + * + * Author: Ross Maloney + * Date: October 1999 + * Renamed, reformed, and reworked: January 2002 + * + */ + +#include <gtk/gtk.h> + + +//extern void close_window(); /* contained in cleanup.c */ +//extern void article(); /* contained in article.c */ +//extern void book(); /* contained in book.c */ +//extern void linkwindow(); +//extern int format; + + +/* This procedure produces a window allowing selection of the + * 14 BibTeX reference formats */ + +void available(GtkWidget *widget) +{ + GtkTooltips *tooltips; + GtkWidget *window, *panel, *description, *selectionKeypad, *separ, *finish; + GtkWidget *artkey, *bookkey; + GtkWidget *bookletkey, *confkey; + GtkWidget *inbookkey, *incolkey; + GtkWidget *inprockey, *mankey; + GtkWidget *masterskey, *misckey; + GtkWidget *procedkey, *phdkey; + GtkWidget *techkey, *unpubkey; + + extern void article(); + extern void book(); + extern void inproc(); + extern void phd(); + extern void masters(); + extern void incol(); + extern void booklet(); /* contained in file booklet.c */ + extern void conference(); /* contained in file conference.c */ + extern void inbook(); /* contained in file inbook.c */ + extern void unpublished(); /* contained in file unpublished.c */ + extern void manual(); /* contained in file manual.c */ + extern void misc(); /* contained in file misc.c */ + extern void proceedings(); /* contained in file proceedings.c */ + extern void techreport(); /* contained in file techreport.c */ + extern void close_window(GtkWidget); /* contained in file cleanup.c */ + + + /* create the tooltip help feature */ + + tooltips = gtk_tooltips_new(); + + /* form the outline of the window */ + + window = gtk_window_new(GTK_WINDOW_TOPLEVEL); + gtk_window_set_title(GTK_WINDOW(window), "XBibFile select"); + gtk_window_position(GTK_WINDOW(window), GTK_WIN_POS_MOUSE); + gtk_window_set_default_size(GTK_WINDOW(window), 250, 300); + panel = gtk_vbox_new(FALSE, 10); + description = gtk_label_new("Select a reference type"); + gtk_box_pack_start_defaults(GTK_BOX(panel), description); + selectionKeypad = gtk_table_new(7, 2, TRUE); + gtk_widget_set_usize(GTK_WIDGET(selectionKeypad), 230, 210); + gtk_container_add(GTK_CONTAINER(window), panel); + gtk_container_set_border_width(GTK_CONTAINER(window), 10); + gtk_box_pack_start_defaults(GTK_BOX(panel), selectionKeypad); + separ = gtk_hseparator_new(); + gtk_box_pack_start_defaults(GTK_BOX(panel), separ); + finish = gtk_button_new_with_label("Cancel"); + gtk_widget_set_usize(GTK_WIDGET(finish), 130, 30); + g_signal_connect(GTK_OBJECT(finish), "clicked", + G_CALLBACK(close_window), NULL); + gtk_box_pack_start_defaults(GTK_BOX(panel), finish); + gtk_tooltips_set_tip(tooltips, finish, + "Finished inserting into this reference database", NULL); + + /* connect the Article reference type */ + artkey = gtk_button_new_with_label("Article"); + gtk_table_attach_defaults(GTK_TABLE(selectionKeypad), + artkey, 0, 1, 0 ,1); + g_signal_connect(GTK_OBJECT(artkey), "clicked", + G_CALLBACK(article), NULL); + gtk_tooltips_set_tip(tooltips, artkey, + "Make an Article reference", NULL); + + /* connect the Book reference type */ + bookkey = gtk_button_new_with_label("Book"); + gtk_table_attach_defaults(GTK_TABLE(selectionKeypad), + bookkey, 0, 1, 1 ,2); + g_signal_connect(GTK_OBJECT(bookkey), "clicked", + G_CALLBACK(book), NULL); + gtk_tooltips_set_tip(tooltips, bookkey, + "Make a Book reference", NULL); + + /* connect the Booklet reference type */ + bookletkey = gtk_button_new_with_label("Booklet"); + gtk_table_attach_defaults(GTK_TABLE(selectionKeypad), + bookletkey, 0, 1, 2 ,3); + g_signal_connect(GTK_OBJECT(bookletkey), "clicked", + G_CALLBACK(booklet), NULL); + gtk_tooltips_set_tip(tooltips, bookletkey, + "Make a Booklet reference", NULL); + + /* connect the Conference reference type */ + confkey = gtk_button_new_with_label("Conference"); + gtk_table_attach_defaults(GTK_TABLE(selectionKeypad), + confkey, 0, 1, 3 ,4); + g_signal_connect(GTK_OBJECT(confkey), "clicked", + G_CALLBACK(conference), NULL); + gtk_tooltips_set_tip(tooltips, confkey, + "Make a reference to a Conference", NULL); + + /* connect the InBook reference type */ + inbookkey = gtk_button_new_with_label("In Book"); + gtk_table_attach_defaults(GTK_TABLE(selectionKeypad), + inbookkey, 0, 1, 4 ,5); + g_signal_connect(GTK_OBJECT(inbookkey), "clicked", + G_CALLBACK(inbook), NULL); + gtk_tooltips_set_tip(tooltips, inbookkey, + "Make an In Book reference", NULL); + + /* connect the InCollection reference type */ + incolkey = gtk_button_new_with_label("In Collection"); + gtk_table_attach_defaults(GTK_TABLE(selectionKeypad), + incolkey, 0, 1, 5 ,6); + g_signal_connect(GTK_OBJECT(incolkey), "clicked", + G_CALLBACK(incol), NULL); + gtk_tooltips_set_tip(tooltips, incolkey, + "Make an In Collection reference", NULL); + + /* connect the InProceedings reference type */ + inprockey = gtk_button_new_with_label("In Proceedings"); + gtk_table_attach_defaults(GTK_TABLE(selectionKeypad), + inprockey, 0, 1, 6 ,7); + g_signal_connect(GTK_OBJECT(inprockey), "clicked", + G_CALLBACK(inproc), NULL); + gtk_tooltips_set_tip(tooltips, inprockey, + "Make an In Proceedings reference", NULL); + + /* connect the Manual reference type */ + mankey = gtk_button_new_with_label("Manual"); + gtk_table_attach_defaults(GTK_TABLE(selectionKeypad), + mankey, 1, 2, 0 ,1); + g_signal_connect(GTK_OBJECT(mankey), "clicked", + G_CALLBACK(manual), NULL); + gtk_tooltips_set_tip(tooltips, mankey, + "Make a reference to a Manual", NULL); + + /* connect the Masters reference type */ + masterskey = gtk_button_new_with_label("Masters thesis"); + gtk_table_attach_defaults(GTK_TABLE(selectionKeypad), + masterskey, 1, 2, 1 ,2); + g_signal_connect(GTK_OBJECT(masterskey), "clicked", + G_CALLBACK(masters), NULL); + gtk_tooltips_set_tip(tooltips, masterskey, + "Make a reference to a Masters thesis", NULL); + + /* connect the Misc reference type */ + misckey = gtk_button_new_with_label("Misc"); + gtk_table_attach_defaults(GTK_TABLE(selectionKeypad), + misckey, 1, 2, 2 ,3); + g_signal_connect(GTK_OBJECT(misckey), "clicked", + G_CALLBACK(misc), NULL); + gtk_tooltips_set_tip(tooltips, misckey, + "Make a reference to a Miscellaneous type document", NULL); + + /* connect the PhDthesis reference type */ + phdkey = gtk_button_new_with_label("PhD thesis"); + gtk_table_attach_defaults(GTK_TABLE(selectionKeypad), + phdkey, 1, 2, 3 ,4); + g_signal_connect(GTK_OBJECT(phdkey), "clicked", + G_CALLBACK(phd), NULL); + gtk_tooltips_set_tip(tooltips, phdkey, + "Make a reference to a PhD thesis", NULL); + + /* connect the Proceedings reference type */ + procedkey = gtk_button_new_with_label("Proceedings"); + gtk_table_attach_defaults(GTK_TABLE(selectionKeypad), + procedkey, 1, 2, 4 ,5); + g_signal_connect(GTK_OBJECT(procedkey), "clicked", + G_CALLBACK(proceedings), NULL); + gtk_tooltips_set_tip(tooltips, procedkey, + "Make a reference to a Proceedings", NULL); + + /* connect the TechReport reference type */ + techkey = gtk_button_new_with_label("Tech Report"); + gtk_table_attach_defaults(GTK_TABLE(selectionKeypad), + techkey, 1, 2, 5 ,6); + g_signal_connect(GTK_OBJECT(techkey), "clicked", + G_CALLBACK(techreport), NULL); + gtk_tooltips_set_tip(tooltips, techkey, + "Make a reference to a Technical Report", NULL); + + /* connect the Unpublished reference type */ + unpubkey = gtk_button_new_with_label("Unpublished"); + gtk_table_attach_defaults(GTK_TABLE(selectionKeypad), + unpubkey, 1, 2, 6 ,7); + g_signal_connect(GTK_OBJECT(unpubkey), "clicked", + G_CALLBACK(unpublished), NULL); + gtk_tooltips_set_tip(tooltips, unpubkey, + "Make a reference to an Unpublished document", NULL); + + + /* make the composite window visible on the screen */ + gtk_widget_show_all(window); +} diff --git a/biblio/bibtex/utils/xbibfile/showrefs.pl b/biblio/bibtex/utils/xbibfile/showrefs.pl new file mode 100644 index 0000000000..ea1c03ab8f --- /dev/null +++ b/biblio/bibtex/utils/xbibfile/showrefs.pl @@ -0,0 +1,33 @@ +#!/usr/bin/perl +# +# Script to print the key, the reference type, and the first part of the +# title of ALL the references in a BiBTeX database. +# +# +# This script is part of the XBibFile software package. +# Writer: Ross Maloney +# Date: August 2000 +# + +while ( <> ) { + chomp; + if ( /@/ ) { + $count++ ; + $type = 'x'; + if ( /\@ARTICLE/ ) { $type = 'A' } ; + if ( /\@BOOK/ ) { $type = 'B' } ; + if ( /\@INCOLLECTION/ ) { $type = 'C' } ; + if ( /\@INPROCEEDINGS/ ) { $type = 'P' } ; + if ( /\@PHDTHESIS/ ) { $type = 'T' } ; + @fields = split(/{/, $_); + $fields[1] =~ s/,//; + printf "\n%s %s", $type, $fields[1]; + } + else { if ( /^ +title = \{/ ) { + @fields = split(/{/, $_); + $fields[1] =~ s/},//; + printf "\t%s", substr($fields[1], 0, 50) ; + } + } +} +print "\nnumber of references = $count\n" ; diff --git a/biblio/bibtex/utils/xbibfile/techreport.c b/biblio/bibtex/utils/xbibfile/techreport.c new file mode 100644 index 0000000000..95ee47aca1 --- /dev/null +++ b/biblio/bibtex/utils/xbibfile/techreport.c @@ -0,0 +1,475 @@ +/* This file is a part of XBibFile - a system for handling BibTeX references + * + * Author: Ross Maloney + * Date: October 1999 + * Modified: January 2002 + * + */ + +#include <stdio.h> +#include <gtk/gtk.h> + +#include "xbibfile.h" + +/* This file is a modified copy of phd.c so that it handles the + * Technical Report BibTeX reference style */ + + +GtkWidget *labelX, *dataX; +GtkWidget *label0, *data0; +GtkWidget *label1, *data1; +GtkWidget *label2, *data2; +GtkWidget *label3, *data3; +GtkWidget *label9, *data9; +GtkWidget *label12, *data12; +GtkWidget *label13, *data13, *textscroll; +GtkWidget *label14, *data14; +GtkWidget *label20, *data20; +GtkWidget *label21, *data21; +GtkWidget *label22, *data22; +GtkWidget *label24, *data24; +GtkWidget *label30, *data30; +GtkWidget *label31, *data31; +GtkWidget *label32, *data32; +GtkTextBuffer *text13; +GtkTextIter start, end; +PangoFontDescription *font_desc; + + + + +/* The procedure to save the Technical Reporot style */ + +void save_techreport(GtkWidget *widget) +{ + extern int format; + extern int length[]; + extern char slate[][]; + extern int lengthX; + extern char slateX[]; + extern char slate1[]; + extern char slate2[]; + extern char slate3[]; + extern char slate9[]; + extern char slate12[]; + extern char slate13[]; + extern char slate14[]; + extern char slate20[]; + extern char slate21[]; + extern char slate22[]; + extern char slate24[]; + extern char slate30[]; + extern char slate31[]; + extern char slate32[]; + extern void error(); /* defined in file error.c */ + extern FILE *finput; /* defined in file xbibfile.c */ + extern void close_window(); /* defined in file cleanup.c */ + + if (format != 13) { + error(widget, GINT_TO_POINTER(5)); + return; + } + strcpy(slateX, gtk_entry_get_text(GTK_ENTRY(dataX))); + lengthX = strlen(slateX); + strcpy(slate3, gtk_entry_get_text(GTK_ENTRY(data3))); + length[3] = strlen(slate3); + strcpy(slate9, gtk_entry_get_text(GTK_ENTRY(data9))); + length[9] = strlen(slate9); + strcpy(slate20, gtk_entry_get_text(GTK_ENTRY(data20))); + length[20] = strlen(slate20); + strcpy(slate24, gtk_entry_get_text(GTK_ENTRY(data24))); + length[24] = strlen(slate24); + if (!(length[3] && length[9] && length[20] && length[24] && lengthX)) { + error(widget, GINT_TO_POINTER(3)); + return; + } + if (!finput) { + error(widget, GINT_TO_POINTER(8)); + return; + } + /* finput = stdout; */ + fprintf(finput, "\n@TECHREPORT{%s,\n", slateX); + fprintf(finput, " author = {%s},\n", slate3); + fprintf(finput, " title = {%s},\n", slate20); + fprintf(finput, " institution = {%s},\n", slate9); + fprintf(finput, " year = {%s}", slate24); + if (length[21]) + fprintf(finput, ",\n type = {%s}", slate21); + if (length[14]) + fprintf(finput, ",\n number = {%s}", slate14); + if (length[1]) + fprintf(finput, ",\n address = {%s}", slate1); + if (length[12]) + fprintf(finput, ",\n month = {%s}", slate12); + if (length[22]) + fprintf(finput, ",\n URL = {%s}", slate22); + if (length[2]) + fprintf(finput, ",\n note = {%s}", slate2); + if (length[13]) + fprintf(finput, ",\n annote = {%s}", slate13); + if (length[30]) + fprintf(finput, ",\n uplink = {%s}", slate30); + if (length[31]) + fprintf(finput, ",\n crosslink = {%s}", slate31); + if (length[32]) + fprintf(finput, ",\n externlink = {%s}", slate32); + fprintf(finput, " }\n"); + /* indicate that the reference is saved */ + format = 0; + length[1] = 0; + length[2] = 0; + length[12] = 0; + length[13] = 0; + length[14] = 0; + length[21] = 0; + length[22] = 0; + length[30] = 0; + length[31] = 0; + length[32] = 0; + close_window(widget); /* remove this reference window */ +} + + +/* Save the Technical Report optional fields for subsequent saving */ + +void save_techoptions(GtkWidget *widget) +{ + extern void close_window(); + extern int length[]; + extern char slate1[]; + extern char slate2[]; + extern char slate12[]; + extern char slate13[]; + extern char slate14[]; + extern char slate21[]; + extern char slate22[]; + char *text_in_field; + int count; + + strcpy(slate1, gtk_entry_get_text(GTK_ENTRY(data1))); + length[1] = strlen(slate1); + strcpy(slate12, gtk_entry_get_text(GTK_ENTRY(data12))); + length[12] = strlen(slate12); + count = gtk_text_buffer_get_char_count(text13); + gtk_text_buffer_get_iter_at_offset(text13, &end, count); + gtk_text_buffer_get_iter_at_offset(text13, &start, 0); + strcpy(slate13, gtk_text_buffer_get_text(text13, &start, &end, FALSE)); + length[13] = count; + strcpy(slate14, gtk_entry_get_text(GTK_ENTRY(data14))); + length[14] = strlen(slate14); + strcpy(slate21, gtk_entry_get_text(GTK_ENTRY(data21))); + length[21] = strlen(slate21); + strcpy(slate22, gtk_entry_get_text(GTK_ENTRY(data22))); + length[22] = strlen(slate22); + strcpy(slate2, gtk_entry_get_text(GTK_ENTRY(data2))); + length[2] = strlen(slate2); + close_window(widget); +} + + + + +/* Close the option entry window, but first delete the entries */ + +void close_techoptions(GtkWidget *widget) +{ + extern void close_window(); + extern int length[]; + + length[1] = 0; + length[2] = 0; + length[12] = 0; + length[13] = 0; + length[14] = 0; + length[21] = 0; + length[22] = 0; + close_window(widget); +} + + +/* The procedure to put the optional Technical Report style + * fields on the screen */ + +void techoptions(GtkWidget *widget) +{ + extern int format; + GtkTooltips *tooltips; + GtkWidget *window; + GtkWidget *decoration; + GtkWidget *totalPane; + GtkWidget *field0; + GtkWidget *field1; + GtkWidget *field2; + GtkWidget *field3; + GtkWidget *field4; + GtkWidget *field5; + GtkWidget *field6; + GtkWidget *key0; + GtkWidget *key1; + + void close_techoptions(); + void save_techoptions(); + + if (format == 0) { + error (widget, GINT_TO_POINTER(6)); + return; + } + + /* create the tooltip help feature */ + + tooltips = gtk_tooltips_new(); + + window = gtk_window_new(GTK_WINDOW_TOPLEVEL); + gtk_window_set_title(GTK_WINDOW(window), "XBibFile create"); + gtk_window_position(GTK_WINDOW(window), GTK_WIN_POS_MOUSE); + gtk_widget_set_usize(GTK_WIDGET(window), 400, 570); + decoration = gtk_frame_new("Optional Technical Report fields"); + gtk_container_add(GTK_CONTAINER(window), decoration); + totalPane = gtk_vbox_new(FALSE, 5); + gtk_container_add(GTK_CONTAINER(decoration), totalPane); + + /* put the text fields in place */ + field1 = gtk_hbox_new(FALSE, 0); + data21 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data21), TINY); + label21 = gtk_label_new("Type:"); + gtk_widget_set_usize(GTK_WIDGET(label21), 75, -1); + gtk_box_pack_start(GTK_BOX(field1), label21, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field1), data21, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field1, FALSE, TRUE, 10); + + field2 = gtk_hbox_new(FALSE, 0); + data14 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data14), TINY); + label14 = gtk_label_new("Number:"); + gtk_widget_set_usize(GTK_WIDGET(label14), 75, -1); + gtk_box_pack_start(GTK_BOX(field2), label14, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field2), data14, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field2, FALSE, TRUE, 2); + + field3 = gtk_hbox_new(FALSE, 0); + data1 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data1), LARGE); + label1 = gtk_label_new("Address:"); + gtk_widget_set_usize(GTK_WIDGET(label1), 75, -1); + gtk_box_pack_start(GTK_BOX(field3), label1, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field3), data1, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field3, FALSE, TRUE, 2); + + field4 = gtk_hbox_new(FALSE, 0); + data12 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data12), TINY); + label12 = gtk_label_new("Month:"); + gtk_widget_set_usize(GTK_WIDGET(label12), 75, -1); + gtk_box_pack_start(GTK_BOX(field4), label12, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field4), data12, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field4, FALSE, TRUE, 2); + + field5 = gtk_hbox_new(FALSE, 0); + data22 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data22), LARGE); + label22 = gtk_label_new("URL:"); + gtk_widget_set_usize(GTK_WIDGET(label22), 75, -1); + gtk_box_pack_start(GTK_BOX(field5), label22, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field5), data22, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field5, FALSE, TRUE, 2); + + field6 = gtk_hbox_new(FALSE, 0); + data2 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data2), LARGE); + label2 = gtk_label_new("note:"); + gtk_widget_set_usize(GTK_WIDGET(label2), 75, -1); + gtk_box_pack_start(GTK_BOX(field6), label2, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field6), data2, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field6, FALSE, TRUE, 2); + + text13 = gtk_text_buffer_new(NULL); + data13 = gtk_text_view_new_with_buffer(text13); + textscroll = gtk_scrolled_window_new(NULL, NULL); + font_desc = pango_font_description_from_string("Sans 12"); + gtk_widget_modify_font(data13, font_desc); + gtk_container_add(GTK_CONTAINER(textscroll), data13); + gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(textscroll), + GTK_POLICY_AUTOMATIC, + GTK_POLICY_AUTOMATIC); + gtk_widget_set_usize(GTK_WIDGET(data13), 30, 250); + label13 = gtk_label_new("Annotation:"); + gtk_box_pack_start(GTK_BOX(totalPane), label13, FALSE, TRUE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), textscroll, FALSE, TRUE, 2); + + /* finally, put the cancel button in place */ + field0 = gtk_hbox_new(FALSE, 0); + key0 = gtk_button_new_with_label("CANCEL"); + gtk_widget_set_usize(GTK_WIDGET(key0), 90, -1); + g_signal_connect(GTK_OBJECT(key0), "clicked", + G_CALLBACK(close_techoptions), NULL); + gtk_tooltips_set_tip(tooltips, key0, + "Discard the contents of this window", NULL); + gtk_box_pack_end(GTK_BOX(field0), key0, FALSE, FALSE, 10); + key1 = gtk_button_new_with_label("Save"); + gtk_widget_set_usize(GTK_WIDGET(key1), 90, -1); + g_signal_connect(GTK_OBJECT(key1), "clicked", + G_CALLBACK(save_techoptions), NULL); + gtk_tooltips_set_tip(tooltips, key1, + "Store the contents of this window", NULL); + gtk_box_pack_end(GTK_BOX(field0), key1, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field0, FALSE, TRUE, 10); + + /* put the composite window on the screen */ + gtk_widget_show_all(window); +} + + + +/* The procedure to put the basic Technical Report style on the screen */ + +void techreport(GtkWidget *widget) +{ + GtkTooltips *tooltips; + GtkWidget *window; + GtkWidget *decoration; + GtkWidget *totalPane; + GtkWidget *opDecoration; + GtkWidget *field0; + GtkWidget *field1; + GtkWidget *option; + GtkWidget *controls; + GtkWidget *key1; + GtkWidget *key2; + GtkWidget *key3; + GtkWidget *key4; + GtkWidget *field2; + GtkWidget *field3; + GtkWidget *field4; + GtkWidget *field5; + extern int format; + extern char slate0[]; + + extern void linkwindow(); + extern void closure_check(); /* defined in file cleanup.c */ + extern void close_window(); /* defined in file cleanup.c */ + void techoptions(); + void save_techreport(); + + /* create the tooltip help feature */ + + tooltips = gtk_tooltips_new(); + + format = 13; /* indicate processing of a TECHREPORT */ + + /* create the wondow and its top panel */ + window = gtk_window_new(GTK_WINDOW_TOPLEVEL); + gtk_window_set_title(GTK_WINDOW(window), "XBibFile create"); + gtk_window_position(GTK_WINDOW(window), GTK_WIN_POS_MOUSE); + decoration = gtk_frame_new("Technical Report type - required fields"); + gtk_widget_set_usize(GTK_WIDGET(window), 450, 325); + gtk_container_add(GTK_CONTAINER(window), decoration); + totalPane = gtk_vbox_new(FALSE, 5); + gtk_container_add(GTK_CONTAINER(decoration), totalPane); + + field1 = gtk_hbox_new(FALSE,0); + dataX = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(dataX), SMALL); + gtk_widget_set_usize(GTK_WIDGET(dataX), 345, -1); + labelX = gtk_label_new("Tag/s:"); + gtk_widget_set_usize(GTK_WIDGET(labelX), 65, -1); + gtk_box_pack_start(GTK_BOX(field1), labelX, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field1), dataX, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field1, FALSE, TRUE, 10); + + field0 = gtk_hbox_new(FALSE, 0); + data0 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data0), LARGE); + gtk_widget_set_usize(GTK_WIDGET(data0), 345, -1); + label0 = gtk_label_new("File used:"); + gtk_widget_set_usize(GTK_WIDGET(label0), 65, -1); + gtk_entry_set_text(GTK_ENTRY(data0), slate0); + gtk_box_pack_start(GTK_BOX(field0), label0, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field0), data0, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field0, FALSE, TRUE, 2); + + /* position the remaining field entries */ + field2 = gtk_hbox_new(FALSE, 0); + data3 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data3), LARGE); + gtk_widget_set_usize(GTK_WIDGET(data3), 345, -1); + label3 = gtk_label_new("Author/s:"); + gtk_widget_set_usize(GTK_WIDGET(label3), 65, -1); + gtk_box_pack_start(GTK_BOX(field2), label3, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field2), data3, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field2, FALSE, TRUE, 8); + + field3 = gtk_hbox_new(FALSE, 0); + data20 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data20), LARGE); + gtk_widget_set_usize(GTK_WIDGET(data20), 345, -1); + label20 = gtk_label_new("Title:"); + gtk_widget_set_usize(GTK_WIDGET(label20), 65, -1); + gtk_box_pack_start(GTK_BOX(field3), label20, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field3), data20, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field3, FALSE, TRUE, 2); + + field4 = gtk_hbox_new(FALSE, 0); + data9 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data9), SMALL); + gtk_widget_set_usize(GTK_WIDGET(data9), 345, -1); + label9 = gtk_label_new("Institution:"); + gtk_widget_set_usize(GTK_WIDGET(label9), 65, -1); + gtk_box_pack_start(GTK_BOX(field4), label9, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field4), data9, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field4, FALSE, TRUE, 2); + + field5 = gtk_hbox_new(FALSE, 0); + data24 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data24), TINY); + gtk_widget_set_usize(GTK_WIDGET(data24), 200, -1); + label24 = gtk_label_new("Year:"); + gtk_widget_set_usize(GTK_WIDGET(label24), 65, -1); + gtk_box_pack_start(GTK_BOX(field5), label24, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field5), data24, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field5, FALSE, TRUE, 2); + + /* put the control keys on to the window */ + option = gtk_hbox_new(FALSE, 0); + key2 = gtk_button_new_with_label("Optional fields"); + gtk_widget_set_usize(GTK_WIDGET(key2), 130, -1); + g_signal_connect(GTK_OBJECT(key2), "clicked", + G_CALLBACK(techoptions), NULL); + gtk_tooltips_set_tip(tooltips, key2, + "Click here to get window containing remaining Tech Report fields", + NULL); + gtk_box_pack_start(GTK_BOX(option), key2, FALSE, FALSE, 10); + controls = gtk_hbox_new(FALSE, 0); + key1 = gtk_button_new_with_label("Save"); + gtk_widget_set_usize(GTK_WIDGET(key1), 90, -1); + g_signal_connect(GTK_OBJECT(key1), "clicked", + G_CALLBACK(save_techreport), NULL); + gtk_tooltips_set_tip(tooltips, key1, + "Store this Tech Report reference in database", NULL); + gtk_box_pack_start(GTK_BOX(controls), key1, FALSE, FALSE, 30); + key3 = gtk_button_new_with_label("Cancel"); + gtk_widget_set_usize(GTK_WIDGET(key3), 90, -1); + g_signal_connect(GTK_OBJECT(key3), "clicked", + G_CALLBACK(closure_check), NULL); + gtk_tooltips_set_tip(tooltips, key3, + "Discard this Tech Report entry", NULL); + gtk_box_pack_start(GTK_BOX(controls), key3, FALSE, FALSE, 30); + key4 = gtk_button_new_with_label("Linking"); + gtk_widget_set_usize(GTK_WIDGET(key4), 90, -1); + g_signal_connect(GTK_OBJECT(key4), "clicked", + G_CALLBACK(linkwindow), NULL); + gtk_tooltips_set_tip(tooltips, key4, + "Click here for window to create links for this Tech Report", + NULL); + gtk_box_pack_start(GTK_BOX(controls), key4, FALSE, FALSE, 30); + gtk_box_pack_start(GTK_BOX(totalPane), option, FALSE, TRUE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), controls, FALSE, TRUE, 10); + + + format = 13; + + /* make the composite visible on screen */ + gtk_widget_show_all(window); +} + + diff --git a/biblio/bibtex/utils/xbibfile/unpublished.c b/biblio/bibtex/utils/xbibfile/unpublished.c new file mode 100644 index 0000000000..f8007e97c3 --- /dev/null +++ b/biblio/bibtex/utils/xbibfile/unpublished.c @@ -0,0 +1,403 @@ +/* This file is a part of XBibFile - a system for handling BibTeX references + * + * Author: Ross Maloney + * Date: October 1999 + * Modified: January 2002 + * + */ + +#include <stdio.h> +#include <gtk/gtk.h> + +#include "xbibfile.h" + +/* This file is a modified copy of phd.c so that it handles the + * Unpublished BibTeX reference style */ + + +GtkWidget *labelX, *dataX; +GtkWidget *label0, *data0; +GtkWidget *label2, *data2; +GtkWidget *label3, *data3; +GtkWidget *label12, *data12; +GtkWidget *label13, *data13, *textscroll; +GtkWidget *label20, *data20; +GtkWidget *label22, *data22; +GtkWidget *label24, *data24; +GtkWidget *label30, *data30; +GtkWidget *label31, *data31; +GtkWidget *label32, *data32; +GtkTextBuffer *text13; +GtkTextIter start, end; +PangoFontDescription *font_desc; + + + + +/* The procedure to save the Unpublished style */ + +void save_unpublished(GtkWidget *widget) +{ + extern int format; + extern int length[]; + extern char slate[][]; + extern int lengthX; + extern char slateX[]; + extern char slate2[]; + extern char slate3[]; + extern char slate12[]; + extern char slate13[]; + extern char slate20[]; + extern char slate22[]; + extern char slate24[]; + extern char slate30[]; + extern char slate31[]; + extern char slate32[]; + extern void error(); /* defined in file error.c */ + extern FILE *finput; /* defined in file xbibfile.c */ + extern void close_window(); /* defined in file cleanup.c */ + + if (format != 14) { + error(widget, GINT_TO_POINTER(5)); + return; + } + strcpy(slateX, gtk_entry_get_text(GTK_ENTRY(dataX))); + lengthX = strlen(slateX); + strcpy(slate3, gtk_entry_get_text(GTK_ENTRY(data3))); + length[3] = strlen(slate3); + strcpy(slate2, gtk_entry_get_text(GTK_ENTRY(data2))); + length[2] = strlen(slate2); + strcpy(slate20, gtk_entry_get_text(GTK_ENTRY(data20))); + length[20] = strlen(slate20); + if (!(length[3] && length[2] && length[20] && lengthX)) { + error(widget, GINT_TO_POINTER(3)); + return; + } + if (!finput) { + error(widget, GINT_TO_POINTER(8)); + return; + } + /* finput = stdout; */ + fprintf(finput, "\n@UNPUBLISHED{%s,\n", slateX); + fprintf(finput, " author = {%s},\n", slate3); + fprintf(finput, " title = {%s},\n", slate20); + fprintf(finput, " note = {%s}", slate2); + if (length[12]) + fprintf(finput, ",\n month = {%s}", slate12); + if (length[24]) + fprintf(finput, ",\n year = {%s}", slate24); + if (length[22]) + fprintf(finput, ",\n URL = {%s}", slate22); + if (length[13]) + fprintf(finput, ",\n annote = {%s}", slate13); + if (length[30]) + fprintf(finput, ",\n uplink = {%s}", slate30); + if (length[31]) + fprintf(finput, ",\n crosslink = {%s}", slate31); + if (length[32]) + fprintf(finput, ",\n externlink = {%s}", slate32); + fprintf(finput, " }\n"); + /* indicate that the reference is saved */ + format = 0; + length[2] = 0; + length[3] = 0; + length[12] = 0; + length[13] = 0; + length[20] = 0; + length[22] = 0; + length[24] = 0; + length[30] = 0; + length[31] = 0; + length[32] = 0; + close_window(widget); /* remove this reference window */ +} + + +/* Save the Unpublished optional fields for subsequent saving */ + +void save_unpublishedoptions(GtkWidget *widget) +{ + extern void close_window(); + extern int length[]; + extern char slate12[]; + extern char slate22[]; + extern char slate24[]; + extern char slate13[]; + char *text_in_field; + int count; + + strcpy(slate12, gtk_entry_get_text(GTK_ENTRY(data12))); + length[12] = strlen(slate12); + strcpy(slate24, gtk_entry_get_text(GTK_ENTRY(data24))); + length[24] = strlen(slate24); + strcpy(slate22, gtk_entry_get_text(GTK_ENTRY(data22))); + length[22] = strlen(slate22); + count = gtk_text_buffer_get_char_count(text13); + gtk_text_buffer_get_iter_at_offset(text13, &end, count); + gtk_text_buffer_get_iter_at_offset(text13, &start, 0); + strcpy(slate13, gtk_text_buffer_get_text(text13, &start, &end, FALSE)); + length[13] = count; + close_window(widget); +} + + + + +/* Close the option entry window, but first delete the entries */ + +void close_unpublishedoptions(GtkWidget *widget) +{ + extern void close_window(); + extern int length[]; + + length[12] = 0; + length[22] = 0; + length[24] = 0; + length[13] = 0; + close_window(widget); +} + + +/* The procedure to put the optional Unpublished style fields on the screen */ + +void unpublishedoptions(GtkWidget *widget) +{ + extern int format; + GtkTooltips *tooltips; + GtkWidget *window; + GtkWidget *decoration; + GtkWidget *totalPane; + GtkWidget *field0; + GtkWidget *field1; + GtkWidget *field2; + GtkWidget *field3; + GtkWidget *key0; + GtkWidget *key1; + + void close_unpublishedoptions(); + void save_unpublishedoptions(); + + if (format == 0) { + error (widget, GINT_TO_POINTER(6)); + return; + } + + /* create the tooltip help feature */ + + tooltips = gtk_tooltips_new(); + + window = gtk_window_new(GTK_WINDOW_TOPLEVEL); + gtk_window_set_title(GTK_WINDOW(window), "XBibFile create"); + gtk_window_position(GTK_WINDOW(window), GTK_WIN_POS_MOUSE); + gtk_widget_set_usize(GTK_WIDGET(window), 400, 480); + decoration = gtk_frame_new("Optional Unpublished fields"); + gtk_container_add(GTK_CONTAINER(window), decoration); + totalPane = gtk_vbox_new(FALSE, 5); + gtk_container_add(GTK_CONTAINER(decoration), totalPane); + + /* put the text fields in place */ + field1 = gtk_hbox_new(FALSE, 0); + data12 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data12), TINY); + label12 = gtk_label_new("Month:"); + gtk_widget_set_usize(GTK_WIDGET(label12), 75, -1); + gtk_box_pack_start(GTK_BOX(field1), label12, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field1), data12, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field1, FALSE, TRUE, 10); + + field2 = gtk_hbox_new(FALSE, 0); + data24 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data24), TINY); + label24 = gtk_label_new("Year:"); + gtk_widget_set_usize(GTK_WIDGET(label24), 75, -1); + gtk_box_pack_start(GTK_BOX(field2), label24, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field2), data24, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field2, FALSE, TRUE, 2); + + field3 = gtk_hbox_new(FALSE, 0); + data22 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data22), LARGE); + label22 = gtk_label_new("URL:"); + gtk_widget_set_usize(GTK_WIDGET(label22), 75, -1); + gtk_box_pack_start(GTK_BOX(field3), label22, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field3), data22, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field3, FALSE, TRUE, 2); + + text13 = gtk_text_buffer_new(NULL); + data13 = gtk_text_view_new_with_buffer(text13); + textscroll = gtk_scrolled_window_new(NULL, NULL); + font_desc = pango_font_description_from_string("Sans 12"); + gtk_widget_modify_font(data13, font_desc); + gtk_container_add(GTK_CONTAINER(textscroll), data13); + gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(textscroll), + GTK_POLICY_AUTOMATIC, + GTK_POLICY_AUTOMATIC); + gtk_widget_set_usize(GTK_WIDGET(data13), 30, 250); + label13 = gtk_label_new("Annotation:"); + gtk_box_pack_start(GTK_BOX(totalPane), label13, FALSE, TRUE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), textscroll, FALSE, TRUE, 2); + + /* finally, put the cancel button in place */ + field0 = gtk_hbox_new(FALSE, 0); + key0 = gtk_button_new_with_label("CANCEL"); + gtk_widget_set_usize(GTK_WIDGET(key0), 90, -1); + g_signal_connect(GTK_OBJECT(key0), "clicked", + G_CALLBACK(close_unpublishedoptions), NULL); + gtk_tooltips_set_tip(tooltips, key0, + "Discard the contents of this window", NULL); + gtk_box_pack_end(GTK_BOX(field0), key0, FALSE, FALSE, 10); + key1 = gtk_button_new_with_label("Save"); + gtk_widget_set_usize(GTK_WIDGET(key1), 90, -1); + g_signal_connect(GTK_OBJECT(key1), "clicked", + G_CALLBACK(save_unpublishedoptions), NULL); + gtk_tooltips_set_tip(tooltips, key1, + "Store the contents of this window", NULL); + gtk_box_pack_end(GTK_BOX(field0), key1, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field0, FALSE, TRUE, 10); + + + /* put the composite window on the screen */ + gtk_widget_show_all(window); +} + + + +/* The procedure to put the basic Unpublished style on the screen */ + +void unpublished(GtkWidget *widget) +{ + GtkTooltips *tooltips; + GtkWidget *window; + GtkWidget *decoration; + GtkWidget *totalPane; + GtkWidget *opDecoration; + GtkWidget *field0; + GtkWidget *field1; + GtkWidget *option; + GtkWidget *controls; + GtkWidget *key1; + GtkWidget *key2; + GtkWidget *key3; + GtkWidget *key4; + GtkWidget *field2; + GtkWidget *field3; + GtkWidget *field4; + extern int format; + extern char slate0[]; + + extern void linkwindow(); + extern void closure_check(); /* defined in file cleanup.c */ + extern void close_window(); /* defined in file cleanup.c */ + void unpublishedoptions(); + void save_unpublished(); + + /* create the tooltip help feature */ + + tooltips = gtk_tooltips_new(); + + format = 14; /* indicate processing of UNPUBLISHED */ + + /* create the wondow and its top panel */ + window = gtk_window_new(GTK_WINDOW_TOPLEVEL); + gtk_window_set_title(GTK_WINDOW(window), "XBibFile create"); + gtk_window_position(GTK_WINDOW(window), GTK_WIN_POS_MOUSE); + decoration = gtk_frame_new("Unpublished type required fields"); + gtk_widget_set_usize(GTK_WIDGET(window), 450, 300); + gtk_container_add(GTK_CONTAINER(window), decoration); + totalPane = gtk_vbox_new(FALSE, 5); + gtk_container_add(GTK_CONTAINER(decoration), totalPane); + + field1 = gtk_hbox_new(FALSE,0); + dataX = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(dataX), SMALL); + gtk_widget_set_usize(GTK_WIDGET(dataX), 345, -1); + labelX = gtk_label_new("Tag/s:"); + gtk_widget_set_usize(GTK_WIDGET(labelX), 65, -1); + gtk_box_pack_start(GTK_BOX(field1), labelX, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field1), dataX, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field1, FALSE, TRUE, 10); + + field0 = gtk_hbox_new(FALSE, 0); + data0 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data0), LARGE); + gtk_widget_set_usize(GTK_WIDGET(data0), 345, -1); + label0 = gtk_label_new("File used:"); + gtk_widget_set_usize(GTK_WIDGET(label0), 65, -1); + gtk_entry_set_text(GTK_ENTRY(data0), slate0); + gtk_box_pack_start(GTK_BOX(field0), label0, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field0), data0, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field0, FALSE, TRUE, 2); + + /* position the remaining field entries */ + field2 = gtk_hbox_new(FALSE, 0); + data3 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data3), LARGE); + gtk_widget_set_usize(GTK_WIDGET(data3), 345, -1); + label3 = gtk_label_new("Author/s:"); + gtk_widget_set_usize(GTK_WIDGET(label3), 65, -1); + gtk_box_pack_start(GTK_BOX(field2), label3, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field2), data3, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field2, FALSE, TRUE, 8); + + field3 = gtk_hbox_new(FALSE, 0); + data20 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data20), LARGE); + gtk_widget_set_usize(GTK_WIDGET(data20), 345, -1); + label20 = gtk_label_new("Title:"); + gtk_widget_set_usize(GTK_WIDGET(label20), 65, -1); + gtk_box_pack_start(GTK_BOX(field3), label20, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field3), data20, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field3, FALSE, TRUE, 2); + + field4 = gtk_hbox_new(FALSE, 0); + data2 = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(data2), LARGE); + gtk_widget_set_usize(GTK_WIDGET(data2), 345, -1); + label2 = gtk_label_new("Note:"); + gtk_widget_set_usize(GTK_WIDGET(label2), 65, -1); + gtk_box_pack_start(GTK_BOX(field4), label2, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(field4), data2, FALSE, FALSE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), field4, FALSE, TRUE, 2); + + /* put the control keys on to the window */ + option = gtk_hbox_new(FALSE, 0); + key2 = gtk_button_new_with_label("Optional fields"); + gtk_widget_set_usize(GTK_WIDGET(key2), 130, -1); + g_signal_connect(GTK_OBJECT(key2), "clicked", + G_CALLBACK(unpublishedoptions), NULL); + gtk_tooltips_set_tip(tooltips, key2, + "Click here to get window containing remaining fields for Unpublished", + NULL); + gtk_box_pack_start(GTK_BOX(option), key2, FALSE, FALSE, 10); + controls = gtk_hbox_new(FALSE, 0); + key1 = gtk_button_new_with_label("Save"); + gtk_widget_set_usize(GTK_WIDGET(key1), 90, -1); + g_signal_connect(GTK_OBJECT(key1), "clicked", + G_CALLBACK(save_unpublished), NULL); + gtk_tooltips_set_tip(tooltips, key1, + "Store this Unpublished reference in database", NULL); + gtk_box_pack_start(GTK_BOX(controls), key1, FALSE, FALSE, 30); + key3 = gtk_button_new_with_label("Cancel"); + gtk_widget_set_usize(GTK_WIDGET(key3), 90, -1); + g_signal_connect(GTK_OBJECT(key3), "clicked", + G_CALLBACK(closure_check), NULL); + gtk_tooltips_set_tip(tooltips, key3, + "Discard this Unpublished entry", NULL); + gtk_box_pack_start(GTK_BOX(controls), key3, FALSE, FALSE, 30); + key4 = gtk_button_new_with_label("Linking"); + gtk_widget_set_usize(GTK_WIDGET(key4), 90, -1); + g_signal_connect(GTK_OBJECT(key4), "clicked", + G_CALLBACK(linkwindow), NULL); + gtk_tooltips_set_tip(tooltips, key4, + "Click here for window to create links for this Unpublished reference", + NULL); + gtk_box_pack_start(GTK_BOX(controls), key4, FALSE, FALSE, 30); + gtk_box_pack_start(GTK_BOX(totalPane), option, FALSE, TRUE, 10); + gtk_box_pack_start(GTK_BOX(totalPane), controls, FALSE, TRUE, 10); + + + format = 14; + + /* make the composite visible on screen */ + gtk_widget_show_all(window); +} diff --git a/biblio/bibtex/utils/xbibfile/xbibfile.c b/biblio/bibtex/utils/xbibfile/xbibfile.c new file mode 100644 index 0000000000..3c755a923f --- /dev/null +++ b/biblio/bibtex/utils/xbibfile/xbibfile.c @@ -0,0 +1,165 @@ +/* This file is a part of XBibFile - a system for handling BibTeX references + * + * Author: Ross Maloney + * Date: October 1999 + * Renamed and reworked: January 2002 + * + */ + +/* History + * + * Version Date + * 0.1 October 1999 Initial release with Join and Lookup + * outputing to the console terminal window. + * 0.2 December 1999 In an attempt to solve the limited fields + * for some data entry, the code for assigning + * field-lengths was generalised. + * 0.3 May 2000 Added the URL field to reference type fields + * and error corrections + * 0.4 July 2000 Added the note field and commented out the + * actions of the Join and Lookup buttons + * 0.5 December 2000 Replace gtk_widget_show() with + * gtk_widget_show_all(), and add tooltips for + * help + * 0.6 January 2002 Major revision of software layout and computer + * graphics/human interface + * 0.7 November 2002 Upgrade the Gtk routines used internally in the + * source code from version 1.2 to 2.0 + */ + +/* This file initiates XBibFile */ + +#include <stdio.h> +#include <gtk/gtk.h> + +#include "xbibfile.h" + + +/* These memory locations contain the input text fields and labels + * used by all the windows that enter the various BibTeX reference + * types. */ + +int format; /* the BibTeX format being currently used */ +FILE *finput; +FILE *refFile; +char slateX[SMALL]; /* search key */ +int lengthX; +int length[40]; /* length of strings entered via windows */ +char slate0[LARGE]; /* file currently being used for receiving */ +char slate1[LARGE]; /* address */ +char slate2[LARGE]; /* note */ +char slate3[LARGE]; /* author */ +char slate4[LARGE]; /* booktitle */ +char slate5[TINY]; /* chapter */ +char slate6[SMALL]; /* edition */ +char slate7[LARGE]; /* editor */ +char slate8[SMALL]; /* howpublished */ +char slate9[SMALL]; /* institution */ +char slate10[SMALL]; /* journal */ +char slate11[SMALL]; /* key */ +char slate12[TINY]; /* month */ +char slate13[HUGE]; /* annote */ +char slate14[SMALL]; /* number */ +char slate15[LARGE]; /* organization */ +char slate16[LARGE]; /* pages */ +char slate17[LARGE]; /* publisher */ +char slate18[LARGE]; /* school */ +char slate19[SMALL]; /* series */ +char slate20[LARGE]; /* title */ +char slate21[TINY]; /* type */ +char slate22[LARGE]; /* URL */ +char slate23[TINY]; /* volume */ +char slate24[TINY]; /* year */ +char slate30[LARGE]; /* Up Link */ +char slate31[LARGE]; /* Cross Link */ +char slate32[LARGE]; /* External Link */ +char slate40[LARGE]; /* name of file for cross-reference forming */ +GtkWidget *root; /* the widget that is the root of the current + * tree */ + + +int main(int argc, char *argv[]) +{ + GtkTooltips *tooltips; + GtkWidget *top, *panel, *buttonBox, *buttonFrame; + GtkWidget *button1, *button2, *button3; + GtkWidget *description1, *description2, *separator; + int i; + extern byebye(GtkWidget); /* in cleanup.c */ + extern file_select(GtkWidget); /* in file filing.c */ + extern ref_select(GtkWidget *); /* in file filing.c */ + + + format = 0; /* indicate start condition */ + strcpy(slate0, "GO BACK and SELECT a FILE"); + strcpy(slate40, "GO BACK and SELECT a REF FILE"); + length[0] = strlen(slate0); + length[40] = strlen(slate40); + finput = 0; + refFile = 0; + + /* initialise the string storage areas */ + for (i=0; i<40; i++) { + length[i] = 0; + } + lengthX = 0; +/* slateX = 1; */ + + /* create the initial window panel for the program */ + gtk_init(&argc, &argv); + + /* create the tooltip help feature */ + tooltips = gtk_tooltips_new(); + + top = gtk_window_new(GTK_WINDOW_TOPLEVEL); + gtk_window_set_title(GTK_WINDOW(top), "XBibFile 0.7"); + gtk_window_set_default_size(GTK_WINDOW(top), 150, 250); + panel = gtk_vbox_new(FALSE, 10); + gtk_container_add(GTK_CONTAINER(top), panel); + gtk_container_set_border_width(GTK_CONTAINER(top), 10); + description1 = gtk_label_new("Build and handle the \nBibTeX database"); + gtk_box_pack_start_defaults(GTK_BOX(panel), description1); + description2 = gtk_label_new("\nVersion 0.7.1\n"); + gtk_box_pack_start_defaults(GTK_BOX(panel), description2); + buttonBox = gtk_vbox_new(FALSE, 10); + gtk_widget_set_usize(GTK_WIDGET(buttonBox), 140, 130); + gtk_box_pack_start_defaults(GTK_BOX(panel), buttonBox); + + button1 = gtk_button_new_with_label("Create New"); + gtk_widget_set_usize(GTK_WIDGET(button1), 100, 30); + g_signal_connect(GTK_OBJECT(button1), "button-press-event", + G_CALLBACK(file_select), NULL); + gtk_tooltips_set_tip(tooltips, button1, + "Create a new BibTeX database entry", NULL); + + gtk_box_pack_start_defaults(GTK_BOX(buttonBox), button1); + + button2 = gtk_button_new_with_label("Find Reference"); + gtk_widget_set_usize(GTK_WIDGET(button2), 100, 30); + g_signal_connect(GTK_OBJECT(button2), "button-press-event", + G_CALLBACK(ref_select), NULL); + gtk_tooltips_set_tip(tooltips, button2, + "Search database for an existing reference", NULL); + gtk_box_pack_start_defaults(GTK_BOX(buttonBox), button2); + + separator = gtk_hseparator_new(); + gtk_box_pack_start_defaults(GTK_BOX(buttonBox), separator); + + button3 = gtk_button_new_with_label("exit"); + gtk_widget_set_usize(GTK_WIDGET(button3), 100, 30); + g_signal_connect(GTK_OBJECT(button3), "button-press-event", + G_CALLBACK(byebye), NULL); + gtk_tooltips_set_tip(tooltips, button3, + "Exit this program", NULL); + gtk_box_pack_start_defaults(GTK_BOX(buttonBox), button3); + + /* make this composite window visible on the screen */ + + gtk_widget_show_all(top); + + /* process all signals associated with this application */ + gtk_main(); + + /* The End */ + return(0); +} diff --git a/biblio/bibtex/utils/xbibfile/xbibfile.h b/biblio/bibtex/utils/xbibfile/xbibfile.h new file mode 100644 index 0000000000..acfb7968bc --- /dev/null +++ b/biblio/bibtex/utils/xbibfile/xbibfile.h @@ -0,0 +1,18 @@ +/* This file is a part of XBibFile - a system for handling BibTeX references + * + * Author: Ross Maloney + * Date: October 1999 + * + */ + +/* Definitions of the lengths of data fields used */ + +#define TINY 50 +#define SMALL 100 +#define LARGE 200 +#define HUGE 2200 + +#define NO_SPACING 0 +#define NO_PADDING 0 +#define FILL_YES TRUE +#define EXPAND_YES TRUE |